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qLmNdCisKKyMgQysrCitbKi5jcHBdCitpbmRlbnRfc3R5bGUgPSBzcGFjZQoraW5kZW50X3NpemUgPSAyCisKKyMgQy1TaGFycAorIyBbKi5jc10KKworIyBECisjIFsqLmRdCisKKyMgRXJsYW5nCisjIFsqLmVybF0KKworIyBHby1sYW5nCitbKi5nb10KK2luZGVudF9zdHlsZSA9IHRhYgoraW5kZW50X3NpemUgPSA4CisKKyMgQyBoZWFkZXIgZmlsZXMKKyMgWyouaF0KKworIyBIYXNrZWxsCisjIFsqLmhzXQorCisjIEhheGUKKyMgWyouaHhdCisKKyMgSmF2YQorIyBbKi5qYXZhXQorCisjIEphdmFzY3JpcHQKK1sqLmpzXQoraW5kZW50X3N0eWxlID0gc3BhY2UKK2luZGVudF9zaXplID0gMgorCisjIEpTT04KK1sqLmpzb25dCitpbmRlbnRfc3R5bGUgPSBzcGFjZQoraW5kZW50X3NpemUgPSAyCisKKyMgTHVhCisjIFsqLmx1YV0KKworWyoubWFya2Rvd25dCitpbmRlbnRfc3R5bGUgPSBzcGFjZQordHJpbV90cmFpbGluZ193aGl0ZXNwYWNlID0gZmFsc2UKKworWyoubWRdCitpbmRlbnRfc3R5bGUgPSBzcGFjZQordHJpbV90cmFpbGluZ193aGl0ZXNwYWNlID0gZmFsc2UKKworIyBPQ2FtbAorIyBbKi5tbF0KKworIyBEZWxwaGkgUGFzY2FsCisjIFsqLnBhc10KKworIyBQSFAKKyMgWyoucGhwXQorCisjIFBlcmwKKyMgWyoucG1dCisKKyMgUHl0aG9uCisjIFsqLnB5XQorCisjIFJ1YnkKKyMgWyoucmJdCisKKyMgVHlwZXNjcmlwdAorIyBbKi50c10KKworIyBYTUwKKyMgWyoueG1sXQpkaWZmIC0tZ2l0IGEvLmVzbGludGlnbm9yZSBiLy5lc2xpbnRpZ25vcmUKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZGRlMmRiYQotLS0gL2Rldi9udWxsCisrKyBiLy5lc2xpb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WZXJzaW9uIDEuMAotLSBDb21pbmcgU29vbgorPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KK1RocmlmdCAwLjEyLjAKKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisjIyBOZXcgTGFuZ3VhZ2VzCisgICAgKiBDb21tb24gTElTUCAoY2wpCisgICAgKiBTd2lmdAorICAgICogVHlwZXNjcmlwdCAobm9kZXRzKQogCi1WZXJzaW9uIDAuOS4xCisjIyBEZXByZWNhdGVkIExhbmd1YWdlcworICAgICogQ29jb2EKIAotVEhSSUZULTIxMzcgICBSdWJ5ICAgICAgICAgICAgICAgICBSdWJ5IHRlc3QgbGliIGZhaWxzIGplbmtpbnMgYnVpbGQgIzg2NAotVEhSSUZULTIxMzYgICBCdWlsZCBQcm9jZXMgICAgICAgICBWYWdyYW50IGJ1aWxkIG5vdCBjb21waWxpbmcgamF2YSwgcnVieSwgcGhwLCBnbyBsaWJzIGR1ZSB0byBtaXNzaW5nIGRlcGVuZGVuY2llcyAKLVRIUklGVC0yMTM1ICAgR28gICAgICAgICAgICAgICAgICAgR08gbGliIGxlYXZlcyBiZWhpbmQgdGVzdCBmaWxlcyB0aGF0IGFyZSBhdXRvIGdlbmVyYXRlZCAKLVRIUklGVC0yMTM0ICAgQ29tcGlsZXIgICAgICAgICAgICAgbWluZ3ctY3Jvc3MtY29tcGlsZSBzY3JpcHQgZmFpbGluZyB3aXRoIHN0cmlwIGVycm9ycwotVEhSSUZULTIxMzMgICBKYXZhICAgICAgICAgICAgICAgICBqYXZhIFRlc3RUQmluYXJ5UHJvdG9jb2wuamF2YSB0ZXN0IGZhaWxpbmcKLVRIUklGVC0yMTI5ICAgUEhQICAgICAgICAgICAgICAgICAgcGhwIGV4dCBtaX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VzcyAgICAgICAgVmFncmFudCBmYWlscyB0byBidWlsZCBlcmxhbmcKLVRIUklGVC0yMDUwICAgQnVpbGQgUHJvY2VzcyAgICAgICAgVmFncmFudCBDIyBsaWIgY29tcGlsZSBmYWlscyB3aXRoIFRFeGNlcHRpb24gbWlzc2luZwotVEhSSUZULTIwNDcgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnQuUHJvdG9jb2wuVENvbXBhY3RQcm90b2NvbCwgaW50VG9aaWdaYWcgZGF0YSBsb3N0IChUQ29tcGFjdFByb3RvY29sLmNzKQotVEhSSUZULTIwMzYgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnQgZ2VtIHdhcm5zIGFib3V0IGNsYXNzIHZhcmlhYmxlIGFjY2VzcyBmcm9tIHRvcCBsZXZlbAotVEhSSUZULTIwMzIgICBDIyAgICAgICAgICAgICAgICAgICBDIyBjbGllbnQgbGVha3Mgc29ja2V0cy9oYW5kbGVzCi1USFJJRlQtMjAxNyAgIENvbXBpbGVyICAgICAgICAgICAgIFJlc291cmNlIExlYWsgaW4gdGhyaWZ0IHN0cnVjdCB1bmRlciBjb21waWxlci9jcHAvc3JjL3BhcnNlL3RfcHJvZ3JhbS5oCi1USFJJRlQtMjAxNCAgIEMrKyAgICAgICAgICAgICAgICAgIENoYW5nZSBDKysgbGliIGluY2x1ZGVzIHRvIHVzZSA8bmFtZXNwYWNlLz4gc3R5bGUgdGhyb3VnaG91dAotVEhSSUZULTIwMTIgICBHbyAgICAgICAgICAgICAgICAgICBNb2Rlcm5pemluZyBHbyAKLVRIUklGVC0yMDAzICAgICAgICAgICAgICAgICAgICAgICAgRGVwcmVjYXRlIHNlbnVtCi1USFJJRlQtMjAwMiAgIEhhc2tlbGwgICAgICAgICAgICAgIEhhc2tlbGw6IFRlc3QgdXNlIERhdGEuTWF5YmUgaW5zdGVhZCBvZiBNYXliZQotVEhSSUZULTIwMDEgICBXZWJzaXRlICAgICAgICAgICAgICBodHRwOi8vdGhyaWZ0LmF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Rlc3QgQXBhY2hlIFRocmlmdCBmdWxseSByZXByb2R1Y2FibGUKLVRIUklGVC0xOTg0ICAgUHl0aG9uICAgICAgICAgICAgICAgbmFtZXNwYWNlIGNvbGxpc2lvbiBpbiBweXRob24gYmluZGluZ3MKLVRIUklGVC0xOTgwICAgR28gICAgICAgICAgICAgICAgICAgTW9kZXJuaXplIEdvIHRvb2xpbmcsIGZpeCBnbyBjbGllbnQgbGliYXJ5LgotVEhSSUZULTE5NzggICBSdWJ5ICAgICAgICAgICAgICAgICBSdWJ5OiBUaHJpZnQgc2hvdWxkIGFsbG93IGZvciB0aGUgU1NMIHZlcmlmeSBtb2RlIHRvIGJlIHNldAotVEhSSUZULTE5NzcgICBDIyAgICAgICAgICAgICAgICAgICBDIyBjb21waWxlciBzaG91bGQgZ2VuZXJhdGUgY29uc3RhbnQgZmlsZXMgcHJlZml4ZWQgd2l0aCB0aHJpZnQgZmlsZSBuYW1lCi1USFJJRlQtMTk3NSAgICAgICAgICAgICAgICAgICAgICAgIFRCaW5hcnlQcm90b2NvbCBDaGVja0xlbmd0aCBjYW4ndCBiZSB1c2VkIGZvciBhIGNsaWVudAotVEhSSUZULTE5NzMgICBDIyAgICAgICAgICAgICAgICAgICBUQ29tcGFjdFByb3RvY29sIGluIEMjIGxpYiBkb2VzIG5vdCBzZXJpYWxpemUgYW5kIGRlc2VyaWFsaXplIG5lZ2F0aXZlIGludDMyIGFuZCBpbnQ2NCBudW1iCi1USFJJRlQtMTk3MiAgIEphdmEgICAgICAgICAgICAgICAgIEFkZCBzdXBwb3J0IGZvciBhc3luYyBwcm9jZXNzb3JzCi1USFJJRlQtMTk3MSAgIFR1dG9yaWFsICAgICAgICAgICAgIFtHcmFwaHZpel0gQWRkcyB0dXRvcmlhbC9nZW5lcmFsIGRlc2NyaXB0aW9uIGRvY3VtZW50YXRpb24KLVRIUklGVC0xOTcwICAgICAgICAgICAgICAgICAgICAgICAgW0dyYXBodml6XSBBZGRzIG9wdGlvbiB0byByZW5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HMgdG8gbm90IGJlIHVzZWQKLVRIUklGVC0xOTAyICAgQysrICAgICAgICAgICAgICAgICAgQysrOiBTdXBwb3J0IGZvciBNdWx0aXBsZXhpbmcgU2VydmljZXMgb24gYW55IFRyYW5zcG9ydCwgUHJvdG9jb2wgYW5kIFNlcnZlcgotVEhSSUZULTE5MDEgICBDIyAgICAgICAgICAgICAgICAgICBDIzogU3VwcG9ydCBmb3IgTXVsdGlwbGV4aW5nIFNlcnZpY2VzIG9uIGFueSBUcmFuc3BvcnQsIFByb3RvY29sIGFuZCBTZXJ2ZXIKLVRIUklGVC0xODk5ICAgQ2VscGhpICAgICAgICAgICAgICAgRGVscGhpOiBTdXBwb3J0IGZvciBNdWx0aXBsZXhpbmcgU2VydmljZXMgb24gYW55IFRyYW5zcG9ydCwgUHJvdG9jb2wgYW5kIFNlcnZlcgotVEhSSUZULTE4OTcgICAgICAgICAgICAgICAgICAgICAgICBTdXBwb3J0IHZhbGlkYXRpb24gb2YgcmVxdWlyZWQgZmllbGRzCi1USFJJRlQtMTg5NiAgIENvY29hICAgICAgICAgICAgICAgIEFkZCBUQmFzZSBwcm90b2NvbCBmb3IgQ29jb2EKLVRIUklGVC0xODk1ICAgRGVscGhpICAgICAgICAgICAgICAgRGVscGhpOiByZXNlcnZlZCB2YXJpYWJsZSBuYW1lICJyZXN1bHQiIG5vdCBkZXRlY3RlZCBwcm9wZXJseQotVEhSSUZULTE4OTAgICBDKysgICAgICAgICAgICAgICAgICBDKys6IE1ha2UgbmFtZWQgcGlwZXMgc2VydmVyIHdvcmsgYXN5bmNocm9ub3VzbHkgCi1USFJJRlQtMTg4OCAgIEphdmEgICAgICAgICAgICAgICAgIEphdmEgVGhyaWZ0IGNsaWVudCBjYW4ndCBjb25uZWN0IHRvIFB5dGhvbiBUaHJpZnQgc2VydmVyIG9uIHNhbWUgaG9zdAotVEhSSUZULTE4ODIgICAgICAgICAgICAgICAgICAgICAgICBVc2Ugc2luZ2xlIGluY2x1ZGUKLVRIUkl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C0xODU5ICAgQysrICAgICAgICAgICAgICAgICAgR2VuZXJhdGVkIGVycm9yIGMrKyBjb2RlIHdpdGggLW91dCBhbmQgaW5jbHVkZV9wcmVmaXggcGFyYW0KLVRIUklGVC0xODUwICAgICAgICAgICAgICAgICAgICAgICAgbWFrZSBjaGVjayBoYW5ncyBvbiBUU29ja2V0IHRlc3RzIGluIFRyYW5zcG9ydFRlc3QuY3BwCi1USFJJRlQtMTg0NiAgICAgICAgICAgICAgICAgICAgICAgIFJlc3RvcmUgc29ja2V0LmggaGVhZGVyIHRvIHN1cHBvcnQgYnVpbGRzIHdpdGggQW5kcm9pZCBOREsKLVRIUklGVC0xODQyICAgICAgICAgICAgICAgICAgICAgICAgTWVtb3J5IGxlYWsgd2l0aCBQaXBlcwotVEhSSUZULTE4MzggICBDb21waWxlciAgICAgICAgICAgICBDYW4ndCBidWlsZCBjb21waWxlciBvbiBPUyBYIGJlY2F1c2Ugb2YgbWlzc2luZyB0aHJpZnR5LmgKLVRIUklGVC0xODMxICAgICAgICAgICAgICAgICAgICAgICAgQnVnIGluIGxpc3QgZGVzZXJpYWxpemVyCi1USFJJRlQtMTgyNCAgICAgICAgICAgICAgICAgICAgICAgIG1hbnkgY29tcGlsZSB3YXJuaW5nLCBiZWNhc2UgVGhyZWFkLmggaW5jbHVkZXMgY29uZmlnLmgKLVRIUklGVC0xODIzICAgICAgICAgICAgICAgICAgICAgICAgTWlzc2luZyBwYXJlbnRoZXNpcyBicmVha3MgIklTXy4uLiIgbWFjcm8gaW4gZ2VuZXJhdGVkIGNvZGUKLVRIUklGVC0xODIyICAgICAgICAgICAgICAgICAgICAgICAgUEhQIHVuaXQgdGVzdCBkb2VzIG5vdCB3b3JrCi1USFJJRlQtMTgxNiAgICAgICAgICAgICAgICAgICAgICAgIE5lZWQgInJlcXVpcmUiIGluY2x1ZGVkIHRocmlmdCBmaWxlcyBpbiAieHh4X3R5cGVzLmpzIgotVEhSSUZULTE4MTUgICAgICAgICAgICAgICAgICAg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ICAgICAgICAgICAgICBDIzogQWRkIFRNZW1vcnlCdWZmZXIgc2VyaWFsaXplci9kZXNlcmlhbGl6ZXIKLVRIUklGVC0xNzgzICAgQyMgICAgICAgICAgICAgICAgICAgQyMgZG9lc24ndCBoYW5kbGUgcmVxdWlyZWQgZmllbGRzIGNvcnJlY3RseQotVEhSSUZULTE3ODIgICBKYXZhc2NyaXB0ICAgICAgICAgICBhc3luYyBvbmx5IGRlZmluZWQgaW4gc2lsdmVybGlnaHQKLVRIUklGVC0xNzgwICAgICAgICAgICAgICAgICAgICAgICAgQWRkIG9wdGlvbiB0byBnZW5lcmF0ZSBudWxsYWJsZSB2YWx1ZXMKLVRIUklGVC0xNzc5ICAgICAgICAgICAgICAgICAgICAgICAgTWlzc2luZyBwcm9jZXNzX1hYWFggbWV0aG9kIGluIGdlbmVyYXRlZCBUUHJvY2Vzc29yIGltcGxlbWVudGF0aW9uIGZvciBhbGwgJ29uZXdheScgc2VydmljZQotVEhSSUZULTE3NzggICAgICAgICAgICAgICAgICAgICAgICBDb25maWd1cmUgcmVxdWlyZXMgbWFudWFsIGludGVydmVudGlvbiBkdWUgdG8gdGFyIGZhaWx1cmUKLVRIUklGVC0xNzc3ICAgICAgICAgICAgICAgICAgICAgICAgVFBpcGVTZXJ2ZXIgaXMgVU5TVE9QUEFCTEUKLVRIUklGVC0xNzczICAgUHl0aG9uICAgICAgICAgICAgICAgUHl0aG9uIGxpYnJhcnkgc2hvdWxkIHJ1biBvbiBweXRob24gMi40Ci1USFJJRlQtMTc2OSAgICAgICAgICAgICAgICAgICAgICAgIHVuaW9ucyBjYW4ndCBoYXZlIHJlcXVpcmVkIGZpZWxkcyAoQysrKQotVEhSSUZULTE3NjggICAgICAgICAgICAgICAgICAgICAgICB1bmlvbnMgY2FuJ3QgaGF2ZSByZXF1aXJlZCBmaWVsZHMgKENvbXBpbGVyKQotVEhSSUZULTE3NjcgICAgICAgICAgICAgICAgICAgICAgICB1bmlvbnMgY2FuJ3QgaGF2Z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C0xNjcyICAgQyMgICAgICAgICAgICAgICAgICAgTW9ub1RvdWNoIChhbmQgTW9ubyBmb3IgQW5kcm9pZCkgIGNvbXBhdGliaWxpdHkKLVRIUklGVC0xNjczICAgUnVieSAgICAgICAgICAgICAgICAgUnVieSBjb21waWxlIGZsYWdzIGZvciBleHRlbnNpb24gZm9yIG11bHRpIGFyY2ggYnVpbGRzIChvcyAgeCkKLVRIUklGVC0xNjc0ICAgRCAgICAgICAgICAgICAgICAgICAgVXBkYXRlIFRocmlmdCBEIGxpYnJhcnkgdG8gYmUgY29tcGF0aWJsZSB3aXRoICAyLjA2MAotVEhSSUZULTE2NzUgICBKYXZhICAgICAgICAgICAgICAgICBEbyB3ZSBoYXZlIGFueSBwbGFuIHRvIHN1cHBvcnQgIHNjYWxhPwotVEhSSUZULTE2NzYgICBDKysgICAgICAgICAgICAgICAgICBBbGxvdyBzcGVjaWZ5aW5nIElQL2hvc3RuYW1lIGluICBUU2VydmVyOjpzZXJ2ZQotVEhSSUZULTE2ODUgICBXZWJzaXRlICAgICAgICAgICAgICBQbGVhc2UgYWRkICJhZXJlby5jb20iIHRvICJQb3dlcmVkIGJ5IEFwYWNoZSBUaHJpZnQiIGxpc3QgaW4gYWJvdXQgIHBhZ2UKLVRIUklGVC0xNjg2ICAgUEhQICAgICAgICAgICAgICAgICAgcGhwIGdlbmVyYXRvciB1c2VzICJhbmQiIGluc3RlYWQgb2YgIiYmIiwgYW5kIGNhdXNlcyBjb21waWxlciBlcnJvcnMgd2l0aCBWaXN1YWwgIFN0dWRpbwotVEhSSUZULTE2ODggICBXZWJzaXRlICAgICAgICAgICAgICBVcGRhdGUgSURMIHBhZ2UgIG1hcmt1cAotVEhSSUZULTE2ODkgICBDKysgICAgICAgICAgICAgICAgICBkb24ndCBleGl0KC0xKSBpbiAgVE5vbmJsb2NraW5nU2VydmVyCi1USFJJRlQtMTY5MSAgIERlbHBoaSAgICAgICAgICAgICAgIFNlcmlhbGl6ZXIvZGVzZXJpYWxp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b3N0X3BhdGgjIyIgfCBzZWQgJ3MvXC9pbmNsdWRlXC9ib29zdC0vLycgfCBzZWQgJ3MvXy8uLydgCisgICAgICAgICAgICAgICAgICAgIFZfQ0hFQ0s9YGV4cHIgJF92ZXJzaW9uX3RtcCBcPiAkX3ZlcnNpb25gCisgICAgICAgICAgICAgICAgICAgIGlmIHRlc3QgIngkVl9DSEVDSyIgPSAieDEiIDsgdGhlbgorICAgICAgICAgICAgICAgICAgICAgICAgX3ZlcnNpb249JF92ZXJzaW9uX3RtcAorICAgICAgICAgICAgICAgICAgICBmaQorICAgICAgICAgICAgICAgICAgICBWRVJTSU9OX1VOREVSU0NPUkU9YGVjaG8gJF92ZXJzaW9uIHwgc2VkICdzL1wuL18vJ2AKKyAgICAgICAgICAgICAgICAgICAgQk9PU1RfQ1BQRkxBR1M9Ii1JJF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgvaW5jbHVkZS9ib29zdC0kVkVSU0lPTl9VTkRFUlNDT1JFIgorICAgICAgICAgICAgICAgIGRvbmUKKyAgICAgICAgICAgICAgICBkbmwgaWYgbm90aGluZyBmb3VuZCBzZWFyY2ggZm9yIGxheW91dCB1c2VkIGluIFdpbmRvd3MgZGlzdHJpYnV0aW9ucworICAgICAgICAgICAgICAgIGlmIHRlc3QgLXogIiRCT09TVF9DUFBGTEFHUyI7IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgaWYgdGVzdCAtZCAiJF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgvYm9vc3QiICYmIHRlc3QgLXIgIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9wYXRoL2Jvb3N0IjsgdGhlbgorICAgICAgICAgICAgICAgICAgICAgICAgQk9PU1RfQ1BQRkxBR1M9Ii1JJF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgiCisgICAgICAgICAgICAgICAgICAgIGZpCisgICAgICAgICAgICAgICAgZmkKKyAgICAgICAgICAgICAgICBkbmwgaWYgd2UgZm91bmQgc29tZXRoaW5nIGFuZCBCT09TVF9MREZMQUdTIHdhcyB1bnNldCBiZWZvcmUKKyAgICAgICAgICAgICAgICBkbmwgKGJlY2F1c2UgIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9saWJfcGF0aCIgPSAiIiksIHNldCBpdCBoZXJlLgorICAgICAgICAgICAgICAgIGlmIHRlc3QgLW4gIiRCT09TVF9DUFBGTEFHUyIgJiYgdGVzdCAteiAiJEJPT1NUX0xERkxBR1MiOyB0aGVuCisgICAgICAgICAgICAgICAgICAgIGZvciBsaWJzdWJkaXIgaW4gJGxpYnN1YmRpcnMgOyBkbworICAgICAgICAgICAgICAgICAgICAgICAgaWYgbHMgIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9wYXRoLyRsaWJzdWJkaXIvbGliYm9vc3RfIiogPi9kZXYvbnVsbCAyPiYxIDsgdGhlbiBicmVhazsgZmkKKyAgICAgICAgICAgICAgICAgICAgZG9uZQorICAgICAgICAgICAgICAgICAgICBCT09TVF9MREZMQUdTPSItTCRfQVhfQk9PU1RfQkFTRV9ib29zdF9wYXRoLyRsaWJzdWJkaXIiCisgICAgICAgICAgICAgICAgZmkKKyAgICAgICAgICAgIGZpCisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIGlmIHRlc3QgIngkY3Jvc3NfY29tcGlsaW5nIiAhPSAieHllcyIgOyB0aGVuCisgICAgICAgICAgICAgICAgZm9yIF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGggaW4gL3VzciAvdXNyL2xvY2FsIC9vcHQgL29wdC9sb2NhbCA7IGRvCisgICAgICAgICAgICAgICAgICAgIGlmIHRlc3QgLWQgIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9wYXRoIiAmJiB0ZXN0IC1yICIkX0FYX0JPT1NUX0JBU0VfYm9vc3RfcGF0aCIgOyB0aGVuCisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgaSBpbiBgbHMgLWQgJF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgvaW5jbHVkZS9ib29zdC0qIDI+L2Rldi9udWxsYDsgZG8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdmVyc2lvbl90bXA9YGVjaG8gJGkgfCBzZWQgInMjJF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgjIyIgfCBzZWQgJ3MvXC9pbmNsdWRlXC9ib29zdC0vLycgfCBzZWQgJ3MvXy8uLydgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVl9DSEVDSz1gZXhwciAkX3ZlcnNpb25fdG1wIFw+ICRfdmVyc2lvbmAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiB0ZXN0ICJ4JFZfQ0hFQ0siID0gIngxIiA7IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3ZlcnNpb249JF92ZXJzaW9uX3RtcAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZXN0X3BhdGg9JF9BWF9CT09TVF9CQVNFX2Jvb3N0X3BhdGgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaQorICAgICAgICAgICAgICAgICAgICAgICAgZG9uZQorICAgICAgICAgICAgICAgICAgICBmaQorICAgICAgICAgICAgICAgIGRvbmUKKworICAgICAgICAgICAgICAgIFZFUlNJT05fVU5ERVJTQ09SRT1gZWNobyAkX3ZlcnNpb24gfCBzZWQgJ3MvXC4vXy8nYAorICAgICAgICAgICAgICAgIEJPT1NUX0NQUEZMQUdTPSItSSRiZXN0X3BhdGgvaW5jbHVkZS9ib29zdC0kVkVSU0lPTl9VTkRFUlNDT1JFIgorICAgICAgICAgICAgICAgIGlmIHRlc3QgLXogIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9saWJfcGF0aCIgOyB0aGVuCisgICAgICAgICAgICAgICAgICAgIGZvciBsaWJzdWJkaXIgaW4gJGxpYnN1YmRpcnMgOyBkbworICAgICAgICAgICAgICAgICAgICAgICAgaWYgbHMgIiRiZXN0X3BhdGgvJGxpYnN1YmRpci9saWJib29zdF8iKiA+L2Rldi9udWxsIDI+JjEgOyB0aGVuIGJyZWFrOyBmaQorICAgICAgICAgICAgICAgICAgICBkb25lCisgICAgICAgICAgICAgICAgICAgIEJPT1NUX0xERkxBR1M9Ii1MJGJlc3RfcGF0aC8kbGlic3ViZGlyIgorICAgICAgICAgICAgICAgIGZpCisgICAgICAgICAgICBmaQorCisgICAgICAgICAgICBpZiB0ZXN0IC1uICIkQk9PU1RfUk9PVCIgOyB0aGVuCisgICAgICAgICAgICAgICAgZm9yIGxpYnN1YmRpciBpbiAkbGlic3ViZGlycyA7IGRvCisgICAgICAgICAgICAgICAgICAgIGlmIGxzICIkQk9PU1RfUk9PVC9zdGFnZS8kbGlic3ViZGlyL2xpYmJvb3N0XyIqID4vZGV2L251bGwgMj4mMSA7IHRoZW4gYnJlYWs7IGZpCisgICAgICAgICAgICAgICAgZG9uZQorICAgICAgICAgICAgICAgIGlmIHRlc3QgLWQgIiRCT09TVF9ST09UIiAmJiB0ZXN0IC1yICIkQk9PU1RfUk9PVCIgJiYgdGVzdCAtZCAiJEJPT1NUX1JPT1Qvc3RhZ2UvJGxpYnN1YmRpciIgJiYgdGVzdCAtciAiJEJPT1NUX1JPT1Qvc3RhZ2UvJGxpYnN1YmRpciI7IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgdmVyc2lvbl9kaXI9YGV4cHIgLy8kQk9PU1RfUk9PVCA6ICcuKi9cKC4qXCknYAorICAgICAgICAgICAgICAgICAgICBzdGFnZV92ZXJzaW9uPWBlY2hvICR2ZXJzaW9uX2RpciB8IHNlZCAncy9ib29zdF8vLycgfCBzZWQgJ3MvXy8uL2cnYAorICAgICAgICAgICAgICAgICAgICAgICAgc3RhZ2VfdmVyc2lvbl9zaG9ydGVuPWBleHByICRzdGFnZV92ZXJzaW9uIDogJ1woW1swLTldXSpcLltbMC05XV0qXCknYAorICAgICAgICAgICAgICAgICAgICBWX0NIRUNLPWBleHByICRzdGFnZV92ZXJzaW9uX3Nob3J0ZW4gXD5cPSAkX3ZlcnNpb25gCisgICAgICAgICAgICAgICAgICAgIGlmIHRlc3QgIngkVl9DSEVDSyIgPSAieDEiICYmIHRlc3QgLXogIiRfQVhfQk9PU1RfQkFTRV9ib29zdF9saWJfcGF0aCIgOyB0aGVuCisgICAgICAgICAgICAgICAgICAgICAgICBBQ19NU0dfTk9USUNFKFdlIHdpbGwgdXNlIGEgc3RhZ2VkIGJvb3N0IGxpYnJhcnkgZnJvbSAkQk9PU1RfUk9PVCkKKyAgICAgICAgICAgICAgICAgICAgICAgIEJPT1NUX0NQUEZMQUdTPSItSSRCT09TVF9ST09UIgorICAgICAgICAgICAgICAgICAgICAgICAgQk9PU1RfTERGTEFHUz0iLUwkQk9PU1RfUk9PVC9zdGFnZS8kbGlic3ViZGlyIgorICAgICAgICAgICAgICAgICAgICBmaQorICAgICAgICAgICAgICAgIGZpCisgICAgICAgICAgICBmaQorICAgICAgICBmaQorCisgICAgICAgIENQUEZMQUdTPSIkQ1BQRkxBR1MgJEJPT1NUX0NQUEZMQUdTIgorICAgICAgICBleHBvcnQgQ1BQRkxBR1MKKyAgICAgICAgTERGTEFHUz0iJExERkxBR1MgJEJPT1NUX0xERkxBR1MiCisgICAgICAgIGV4cG9ydCBMREZMQUdTCisKKyAgICAgICAgQUNfTEFOR19QVVNIKEMrKykKKyAgICAgICAgICAgIEFDX0NPTVBJTEVfSUZFTFNFKFtfQVhfQk9PU1RfQkFTRV9QUk9HUkFNKCRXQU5UX0JPT1NUX1ZFUlNJT04pXSxbCisgICAgICAgICAgICBBQ19NU0dfUkVTVUxUKHllcykKKyAgICAgICAgc3VjY2VlZGVkPXllcworICAgICAgICBmb3VuZF9zeXN0ZW09eWVzCisgICAgICAgICAgICBdLFsKKyAgICAgICAgICAgIF0pCisgICAgICAgIEFDX0xBTkdfUE9QKFtDKytdKQorICAgIGZpCisKKyAgICBpZiB0ZXN0ICJ4JHN1Y2NlZWRlZCIgIT0gInh5ZXMiIDsgdGhlbg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QorICAgIGZpCisKKyAgICBDUFBGTEFHUz0iJENQUEZMQUdTX1NBVkVEIgorICAgIExERkxBR1M9IiRMREZMQUdTX1NBVkVEIgogCiBdKQpkaWZmIC0tZ2l0IGEvYWNsb2NhbC9heF9jaGVja19vcGVuc3NsLm00IGIvYWNsb2NhbC9heF9jaGVja19vcGVuc3NsLm00CmluZGV4IGE4N2M1YTYuLjI4ZTQ4Y2IgMTAwNjQ0Ci0tLSBhL2FjbG9jYWwvYXhfY2hlY2tfb3BlbnNzbC5tNAorKysgYi9hY2xvY2FsL2F4X2NoZWNrX29wZW5zc2wubTQKQEAgLTEsNSArMSw1IEBACiAjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotIyAgICAgaHR0cDovL3d3dy5nbnUub3JnL3NvZnR3YXJlL2F1dG9jb25mLWFyY2hpdmUvYXhfY2hlY2tfb3BlbnNzbC5odG1sCisjICAgICBodHRwczovL3d3dy5nbnUub3JnL3NvZnR3YXJlL2F1dG9jb25mLWFyY2hpdmUvYXhfY2hlY2tfb3BlbnNzbC5odG1sCiAjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQogIwogIyBTWU5PUFNJUwpAQCAtMzIsNyArMzIsNyBAQAogIyAgIGFuZCB0aGlzIG5vdGljZSBhcmUgcHJlc2VydmVkLiBUaGlzIGZpbGUgaXMgb2ZmZXJlZCBhcy1pcywgd2l0aG91dCBhbnkKICMgICB3YXJyYW50eS4KIAotI3NlcmlhbCA4Cisjc2VyaWFsIDEwCiAKIEFVX0FMSUFTKFtDSEVDS19TU0xdLCBbQVhfQ0hFQ0tfT1BFTlNTTF0pCiBBQ19ERUZVTihbQVhfQ0hFQ0tfT1BFTlNTTF0sIFsKQEAgLTUxLDcgKzUxLDcgQEAKICAgICAgICAgXSwgWwogICAgICAgICAgICAgIyBpZiBwa2ctY29uZmlnIGlzIGluc3RhbGxlZCBhbmQgb3BlbnNzbCBoYXMgaW5zdGFsbGVkIGEgLnBjIGZpbGUsCiAgICAgICAgICAgICAjIHRoZW4gdXNlIHRoYXQgaW5mb3JtYXRpb24gYW5kIGRvbid0IHNlYXJjaCBzc2xkaXJzCi0gICAgICAgICAgICBBQ19QQVRIX1BST0coW1BLR19DT05GSUddLCBbcGtnLWNvbmZpZ10pCisgICAgICAgICAgICBBQ19DSEVDS19UT09MKFtQS0dfQ09ORklHXSwgW3BrZy1jb25maWddKQogICAgICAgICAgICAgaWYgdGVzdCB4IiRQS0dfQ09ORklHIiAhPSB4IiI7IHRoZW4KICAgICAgICAgICAgICAgICBPUEVOU1NMX0xERkxBR1M9YCRQS0dfQ09ORklHIG9wZW5zc2wgLS1saWJzLW9ubHktTCAyPi9kZXYvbnVsbGAKICAgICAgICAgICAgICAgICBpZiB0ZXN0ICQ/ID0gMDsgdGhlbgpkaWZmIC0tZ2l0IGEvYWNsb2NhbC9heF9jb21wYXJlX3ZlcnNpb24ubTQgYi9hY2xvY2FsL2F4X2NvbXBhcmVfdmVyc2lvbi5tNApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi45YzhlMjA4Ci0tLSAvZGV2L251bGwKKysrIGIvYWNsb2NhbC9heF9jb21wYXJlX3ZlcnNpb24ubTQKQEAgLTAsMCArMSwxNzcgQEAKKyMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisjICAgIGh0dHBzOi8vd3d3LmdudS5vcmcvc29mdHdhcmUvYXV0b2NvbmYtYXJjaGl2ZS9heF9jb21wYXJlX3ZlcnNpb24uaHRtbAorIyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKyMKKyMgU1lOT1BTSVMKKyMKKyMgICBBWF9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DEuMTIuNS1yNjE3IHdpbGwgYmUgY29udmVydGVkIHRvIHRoZSBmb3JtCisgICMgMDAwMTAwMTIwMDA1MDYxNy4gIEluIG90aGVyIHdvcmRzLCBlYWNoIG51bWJlciBpcyB6ZXJvIHBhZGRlZCB0byBmb3VyCisgICMgZGlnaXRzLCBhbmQgbm9uIGRpZ2l0cyBhcmUgcmVtb3ZlZC4KKyAgQVNfVkFSX1BVU0hERUYoW0FdLFtheF9jb21wYXJlX3ZlcnNpb25fQV0pCisgIEE9YGVjaG8gIiQxIiB8IHNlZCAtZSAncy9cKFtbMC05XV0qXCkvWlwxWi9nJyBcCisgICAgICAgICAgICAgICAgICAgICAtZSAncy9aXChbWzAtOV1dXClaL1owXDFaL2cnIFwKKyAgICAgICAgICAgICAgICAgICAgIC1lICdzL1pcKFtbMC05XV1bWzAtOV1dXClaL1owXDFaL2cnIFwKKyAgICAgICAgICAgICAgICAgICAgIC1lICdzL1pcKFtbMC05XV1bWzAtOV1dW1swLTldXVwpWi9aMFwxWi9nJyBcCisgICAgICAgICAgICAgICAgICAgICAtZSAncy9bW14wLTldXS8vZydgCisKKyAgQVNfVkFSX1BVU0hERUYoW0JdLFtheF9jb21wYXJlX3ZlcnNpb25fQl0pCisgIEI9YGVjaG8gIiQzIiB8IHNlZCAtZSAncy9cKFtbMC05XV0qXCkvWlwxWi9nJyBcCisgICAgICAgICAgICAgICAgICAgICAtZSAncy9aXChbWzAtOV1dXClaL1owXDFaL2cnIFwKKyAgICAgICAgICAgICAgICAgICAgIC1lICdzL1pcKFtbMC05XV1bWzAtOV1dXClaL1owXDFaL2cnIFwKKyAgICAgICAgICAgICAgICAgICAgIC1lICdzL1pcKFtbMC05XV1bWzAtOV1dW1swLTldXVwpWi9aMFwxWi9nJyBcCisgICAgICAgICAgICAgICAgICAgICAtZSAncy9bW14wLTldXS8vZydgCisKKyAgZG5sICMgSW4gdGhlIGNhc2Ugb2YgbGUsIGdlLCBsdCwgYW5kIGd0LCB0aGUgc3Ry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fTsgZG8KKyAgICAgIGZvciBzd2l0Y2ggaW4gLXN0ZD1jKyske2FsdGVybmF0aXZlfSArc3RkPWMrKyR7YWx0ZXJuYXRpdmV9ICItaCBzdGQ9YysrJHthbHRlcm5hdGl2ZX0iOyBkbworICAgICAgICBjYWNoZXZhcj1BU19UUl9TSChbYXhfY3ZfY3h4X2NvbXBpbGVfY3h4JDFfJHN3aXRjaF0pCisgICAgICAgIEFDX0NBQ0hFX0NIRUNLKHdoZXRoZXIgJENYWCBzdXBwb3J0cyBDKyskMSBmZWF0dXJlcyB3aXRoICRzd2l0Y2gsCisgICAgICAgICAgICAgICAgICAgICAgICRjYWNoZXZhciwKKyAgICAgICAgICBbYWNfc2F2ZV9DWFg9IiRDWFgiCisgICAgICAgICAgIENYWD0iJENYWCAkc3dpdGNoIgorICAgICAgICAgICBBQ19DT01QSUxFX0lGRUxTRShbQUNfTEFOR19TT1VSQ0UoW19BWF9DWFhfQ09NUElMRV9TVERDWFhfdGVzdGJvZHlfJDFdKV0sCisgICAgICAgICAgICBbZXZhbCAkY2FjaGV2YXI9eWVzXSwKKyAgICAgICAgICAgIFtldmFsICRjYWNoZXZhcj1ub10pCisgICAgICAgICAgIENYWD0iJGFjX3NhdmVfQ1hYIl0pCisgICAgICAgIGlmIGV2YWwgdGVzdCB4XCQkY2FjaGV2YXIgPSB4eWVzOyB0aGVuCisgICAgICAgICAgQ1hYPSIkQ1hYICRzd2l0Y2giCisgICAgICAgICAgaWYgdGVzdCAtbiAiJENYWENQUCIgOyB0aGVuCisgICAgICAgICAgICBDWFhDUFA9IiRDWFhDUFAgJHN3aXRjaCIKKyAgICAgICAgICBmaQorICAgICAgICAgIGFjX3N1Y2Nlc3M9eWVzCisgICAgICAgICAgYnJlYWsKKyAgICAgICAgZmkKKyAgICAgIGRvbmUKKyAgICAgIGlmIHRlc3QgeCRhY19zdWNjZXNzID0geHllczsgdGhlbgorICAgICAgICBicmVhaworICAgICAgZmkKKyAgICBkb25lCisgIGZpXSkK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2YWx1ZSA9PSB0cnVlLCAiIik7CisgICAgICByZXR1cm4gKHN1bWYgPiAwLjApID8gc3VtaSA6IGFkZChjLCB2KTsKKyAgICB9CisKKyAgfQorCisgIG5hbWVzcGFjZSB0ZXN0X25vZXhjZXB0CisgIHsKKworICAgIGludCBmKCkgeyByZXR1cm4gMDsgfQorICAgIGludCBnKCkgbm9leGNlcHQgeyByZXR1cm4gMDsgfQorCisgICAgc3RhdGljX2Fzc2VydChub2V4Y2VwdChmKCkpID09IGZhbHNlLCAiIik7CisgICAgc3RhdGljX2Fzc2VydChub2V4Y2VwdChnKCkpID09IHRydWUsICIiKTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfY29uc3RleHByCisgIHsKKworICAgIHRlbXBsYXRlIDwgdHlwZW5hbWUgQ2hhclQgPgorICAgIHVuc2lnbmVkIGxvbmcgY29uc3RleHByCisgICAgc3RybGVuX2Nfcihjb25zdCBDaGFyVCAqY29uc3QgcywgY29uc3QgdW5zaWduZWQgbG9uZyBhY2MpIG5vZXhjZXB0CisgICAgeworICAgICAgcmV0dXJuICpzID8gc3RybGVuX2NfcihzICsgMSwgYWNjICsgMSkgOiBhY2M7CisgICAgfQorCisgICAgdGVtcGxhdGUgPCB0eXBlbmFtZSBDaGFyVCA+CisgICAgdW5zaWduZWQgbG9uZyBjb25zdGV4cHIKKyAgICBzdHJsZW5fYyhjb25zdCBDaGFyVCAqY29uc3Qgcykgbm9leGNlcHQKKyAgICB7CisgICAgICByZXR1cm4gc3RybGVuX2NfcihzLCAwVUwpOworICAgIH0KKworICAgIHN0YXRpY19hc3NlcnQoc3RybGVuX2MoIiIpID09IDBVTCwgIiIpOworICAgIHN0YXRpY19hc3NlcnQoc3RybGVuX2MoIjEiKSA9PSAxVUwsICIiKTsKKyAgICBzdGF0aWNfYXNzZXJ0KHN0cmxlbl9jKCJleGFtcGxlIikgPT0gN1VMLCAiIik7CisgICAgc3RhdGljX2Fzc2VydChzdHJsZW5fYygiYW5vdGhlclwwZXhhbXBsZSIpID09IDdVTCwgIiIpOworCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9ydmFsdWVfcmVmZXJlbmNlcworICB7CisKKyAgICB0ZW1wbGF0ZSA8IGludCBOID4KKyAgICBzdHJ1Y3QgYW5zd2VyCisgICAgeworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQgdmFsdWUgPSBOOworICAgIH07CisKKyAgICBhbnN3ZXI8MT4gZihpbnQmKSAgICAgICB7IHJldHVybiBhbnN3ZXI8MT4oKTsgfQorICAgIGFuc3dlcjwyPiBmKGNvbnN0IGludCYpIHsgcmV0dXJuIGFuc3dlcjwyPigpOyB9CisgICAgYW5zd2VyPDM+IGYoaW50JiYpICAgICAgeyByZXR1cm4gYW5zd2VyPDM+KCk7IH0KKworICAgIHZvaWQKKyAgICB0ZXN0KCkKKyAgICB7CisgICAgICBpbnQgaSA9IDA7CisgICAgICBjb25zdCBpbnQgYyA9IDA7CisgICAgICBzdGF0aWNfYXNzZXJ0KGRlY2x0eXBlKGYoaSkpOjp2YWx1ZSA9PSAxLCAiIik7CisgICAgICBzdGF0aWNfYXNzZXJ0KGRlY2x0eXBlKGYoYykpOjp2YWx1ZSA9PSAyLCAiIik7CisgICAgICBzdGF0aWNfYXNzZXJ0KGRlY2x0eXBlKGYoMCkpOjp2YWx1ZSA9PSAzLCAiIik7CisgICAgfQorCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF91bmlmb3JtX2luaXRpYWxpemF0aW9uCisgIHsKKworICAgIHN0cnVjdCB0ZXN0CisgICAgeworICAgICAgc3RhdGljIGNvbnN0IGludCB6ZXJvIHt9OworICAgICAgc3RhdGljIGNvbnN0IGludCBvbmUgezF9OworICAgIH07CisKKyAgICBzdGF0aWNfYXNzZXJ0KHRlc3Q6Onplcm8gPT0gMCwgIiIpOworICAgIHN0YXRpY19hc3NlcnQodGVzdDo6b25lID09IDEsICIiKTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfbGFtYmRhcworICB7CisKKyAgICB2b2lkCisgICAgdGVzdDEoKQorICAgIHsKKyAgICAgIGF1dG8gbGFtYmRhMSA9IFtdKCl7fTsKKyAgICAgIGF1dG8gbGFtYmRhMiA9IGxhbWJkYTE7CisgICAgICBsYW1iZGExKCk7CisgICAgICBsYW1iZGEyKCk7CisgICAgfQorCisgICAgaW50CisgICAgdGVzdDIoKQorICAgIHsKKyAgICAgIGF1dG8gYSA9IFtdKGludCBpLCBpbnQgail7IHJldHVybiBpICsgajsgfSgxLCAyKTsKKyAgICAgIGF1dG8gYiA9IFtdKCkgLT4gaW50IHsgcmV0dXJuICcwJzsgfSgpOworICAgICAgYXV0byBjID0gWz1dKCl7IHJldHVybiBhICsgYjsgfSgpOworICAgICAgYXV0byBkID0gWyZdKCl7IHJldHVybiBjOyB9KCk7CisgICAgICBhdXRvIGUgPSBbYSwgJmJdKGludCB4KSBtdXRhYmxlIHsKKyAgICAgICAgY29uc3QgYXV0byBpZGVudGl0eSA9IFtdKGludCB5KXsgcmV0dXJuIHk7IH07CisgICAgICAgIGZvciAoYXV0byBpID0gMDsgaSA8IGE7ICsraSkKKyAgICAgICAgICBhICs9IGItLTsKKyAgICAgICAgcmV0dXJuIHggKyBpZGVudGl0eShhICsgYik7CisgICAgICB9KDApOworICAgICAgcmV0dXJuIGEgKyBiICsgYyArIGQgKyBlOworICAgIH0KKworICAgIGludAorICAgIHRlc3QzKCkKKyAgICB7CisgICAgICBjb25zdCBhdXRvIG51bGxhcnkgPSBbXSgpeyByZXR1cm4gMDsgfTsKKyAgICAgIGNvbnN0IGF1dG8gdW5hcnkgPSBbXShpbnQgeCl7IHJldHVybiB4OyB9OworICAgICAgdXNpbmcgbnVsbGFyeV90ID0gZGVjbHR5cGUobnVsbGFyeSk7CisgICAgICB1c2luZyB1bmFyeV90ID0gZGVjbHR5cGUodW5hcnkpOworICAgICAgY29uc3QgYXV0byBoaWdoZXIxc3QgPSBbXShudWxsYXJ5X3QgZil7IHJldHVybiBmKCk7I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c3BsdXMKKworI2Vycm9yICJUaGlzIGlzIG5vdCBhIEMrKyBjb21waWxlciIKKworI2VsaWYgX19jcGx1c3BsdXMgPCAyMDE0MDJMCisKKyNlcnJvciAiVGhpcyBpcyBub3QgYSBDKysxNCBjb21waWxlciIKKworI2Vsc2UKKworbmFtZXNwYWNlIGN4eDE0Cit7CisKKyAgbmFtZXNwYWNlIHRlc3RfcG9seW1vcnBoaWNfbGFtYmRhcworICB7CisKKyAgICBpbnQKKyAgICB0ZXN0KCkKKyAgICB7CisgICAgICBjb25zdCBhdXRvIGxhbWJkYSA9IFtdKGF1dG8mJi4uLiBhcmdzKXsKKyAgICAgICAgY29uc3QgYXV0byBpc3RpbnkgPSBbXShhdXRvIHgpeworICAgICAgICAgIHJldHVybiAoc2l6ZW9mKHgpID09IDFVTCkgPyAxIDogMDsKKyAgICAgICAgfTsKKyAgICAgICAgY29uc3QgaW50IGFyZXRpbnlbXSA9IHsgaXN0aW55KGFyZ3MpLi4uIH07CisgICAgICAgIHJldHVybiBhcmV0aW55WzBdOworICAgICAgfTsKKyAgICAgIHJldHVybiBsYW1iZGEoMSwgMUwsIDEuMGYsICcxJyk7CisgICAgfQorCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9iaW5hcnlfbGl0ZXJhbHMKKyAgeworCisgICAgY29uc3RleHByIGF1dG8gaXZpaSA9IDBiMDAwMDAwMDAwMDEwMTAxMDsKKyAgICBzdGF0aWNfYXNzZXJ0KGl2aWkgPT0gNDIsICJ3cm9uZyB2YWx1ZSIpOworCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9nZW5lcmFsaXplZF9jb25zdGV4cHIKKyAgeworCisgICAgdGVtcGxhdGUgPCB0eXBlbmFtZSBDaGFyVCA+CisgICAgY29uc3RleHByIHVuc2lnbmVkIGxvbmcKKyAgICBzdHJsZW5fYyhjb25zdCBDaGFyVCAqY29uc3Qgcykgbm9leGNlcHQKKyAgICB7CisgICAgICBhdXRvIGxlbmd0aCA9IDBVTDsKKyAgICAgIGZvciAoYXV0byBwID0gczsgKnA7ICsrcCkKKyAgICAgICAgKytsZW5ndGg7CisgICAgICByZXR1cm4gbGVuZ3RoOworICAgIH0KKworICAgIHN0YXRpY19hc3NlcnQoc3RybGVuX2MoIiIpID09IDBVTCwgIiIpOworICAgIHN0YXRpY19hc3NlcnQoc3RybGVuX2MoIngiKSA9PSAxVUwsICIiKTsKKyAgICBzdGF0aWNfYXNzZXJ0KHN0cmxlbl9jKCJ0ZXN0IikgPT0gNFVMLCAiIik7CisgICAgc3RhdGljX2Fzc2VydChzdHJsZW5fYygiYW5vdGhlclwwdGVzdCIpID09IDdVTCwgIiIpOworCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9sYW1iZGFfaW5pdF9jYXB0dXJlCisgIHsKKworICAgIGludAorICAgIHRlc3QoKQorICAgIHsKKyAgICAgIGF1dG8geCA9IDA7CisgICAgICBjb25zdCBhdXRvIGxhbWJkYTEgPSBbYSA9IHhdKGludCBiKXsgcmV0dXJuIGEgKyBiOyB9OworICAgICAgY29uc3QgYXV0byBsYW1iZGEyID0gW2EgPSBsYW1iZGExKHgpXSgpeyByZXR1cm4gYTsgfTsKKyAgICAgIHJldHVybiBsYW1iZGEyKCk7CisgICAgfQorCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9kaWdpdF9zZXBhcmF0b3JzCisgIHsKKworICAgIGNvbnN0ZXhwciBhdXRvIHRlbl9taWxsaW9uID0gMTAwJzAwMCcwMDA7CisgICAgc3RhdGljX2Fzc2VydCh0ZW5fbWlsbGlvbiA9PSAxMDAwMDAwMDAsICIiKTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfcmV0dXJuX3R5cGVfZGVkdWN0aW9uCisgIHsKKworICAgIGF1dG8gZihpbnQmIHgpIHsgcmV0dXJuIHg7IH0KKyAgICBkZWNsdHlwZShhdXRvKSBnKGludCYgeCkgeyByZXR1cm4geDsgfQorCisgICAgdGVtcGxhdGUgPCB0eXBlbmFtZSBUMSwgdHlwZW5hbWUgVDIgPgorICAgIHN0cnVjdCBpc19zYW1lCisgICAgeworICAgICAgc3RhdGljIGNvbnN0ZXhwciBhdXRvIHZhbHVlID0gZmFsc2U7CisgICAgfTsKKworICAgIHRlbXBsYXRlIDwgdHlwZW5hbWUgVCA+CisgICAgc3RydWN0IGlzX3NhbWU8VCwgVD4KKyAgICB7CisgICAgICBzdGF0aWMgY29uc3RleHByIGF1dG8gdmFsdWUgPSB0cnVlOworICAgIH07CisKKyAgICBpbnQKKyAgICB0ZXN0KCkKKyAgICB7CisgICAgICBhdXRvIHggPSAwOworICAgICAgc3RhdGljX2Fzc2VydChpc19zYW1lPGludCwgZGVjbHR5cGUoZih4KSk+Ojp2YWx1ZSwgIiIpOworICAgICAgc3RhdGljX2Fzc2VydChpc19zYW1lPGludCYsIGRlY2x0eXBlKGcoeCkpPjo6dmFsdWUsICIiKTsKKyAgICAgIHJldHVybiB4OworICAgIH0KKworICB9CisKK30gIC8vIG5hbWVzcGFjZSBjeHgxNAorCisjZW5kaWYgIC8vIF9fY3BsdXNwbHVzID49IDIwMTQwMkwKKworXV0pCisKKworZG5sICBUZXN0cyBmb3IgbmV3IGZlYXR1cmVzIGluIEMrKzE3CisKK200X2RlZmluZShbX0FYX0NYWF9DT01QSUxFX1NURENYWF90ZXN0Ym9keV9uZXdfaW5fMTddLCBbWworCisvLyBJZiB0aGUgY29tcGlsZXIgYWRtaXRzIHRoYXQgaXQgaXMgbm90IHJlYWR5IGZvciBDKysxNywgd2h5IHRvcnR1cmUgaXQ/CisvLyBIb3BlZnVsbHksIHRoaXMgd2lsbCBzcGVlZCB1cCB0aGUgdGVzdC4KKworI2lmbmRlZiBfX2NwbHVzcGx1cworCisjZXJyb3IgIlRoaXMgaXMgbm90IGEgQysrIGNvbXBpbGVyIgorCisjZWxpZiBfX2NwbHVzcGx1cyA8IDIwMTcwM0wKKworI2Vycm9yICJUaGlzIGlzIG5vdCBhIEMrKzE3IGNvbXBpbGVyIgorCisjZW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YmFyKT46OnZhbHVlKTsKKyAgfQorCisgIG5hbWVzcGFjZSB0ZXN0X3R5cGVuYW1lX2luX3RlbXBsYXRlX3RlbXBsYXRlX3BhcmFtZXRlcgorICB7CisKKyAgICB0ZW1wbGF0ZTx0ZW1wbGF0ZTx0eXBlbmFtZT4gdHlwZW5hbWUgWD4gc3RydWN0IEQ7CisKKyAgfQorCisgIG5hbWVzcGFjZSB0ZXN0X2ZhbGx0aHJvdWdoX25vZGlzY2FyZF9tYXliZV91bnVzZWRfYXR0cmlidXRlcworICB7CisKKyAgICBpbnQgZjEoKQorICAgIHsKKyAgICAgIHJldHVybiA0MjsKKyAgICB9CisKKyAgICBbW25vZGlzY2FyZF1dIGludCBmMigpCisgICAgeworICAgICAgW1ttYXliZV91bnVzZWRdXSBhdXRvIHVudXNlZCA9IGYxKCk7CisKKyAgICAgIHN3aXRjaCAoZjEoKSkKKyAgICAgIHsKKyAgICAgIGNhc2UgMTc6CisgICAgICAgIGYxKCk7CisgICAgICAgIFtbZmFsbHRocm91Z2hdXTsKKyAgICAgIGNhc2UgNDI6CisgICAgICAgIGYxKCk7CisgICAgICB9CisgICAgICByZXR1cm4gZjEoKTsKKyAgICB9CisKKyAgfQorCisgIG5hbWVzcGFjZSB0ZXN0X2V4dGVuZGVkX2FnZ3JlZ2F0ZV9pbml0aWFsaXphdGlvbgorICB7CisKKyAgICBzdHJ1Y3QgYmFzZTEKKyAgICB7CisgICAgICBpbnQgYjEsIGIyID0gNDI7CisgICAgfTsKKworICAgIHN0cnVjdCBiYXNlMgorICAgIHsKKyAgICAgIGJhc2UyKCkgeworICAgICAgICBiMyA9IDQyOworICAgICAgfQorICAgICAgaW50IGIzOworICAgIH07CisKKyAgICBzdHJ1Y3QgZGVyaXZlZCA6IGJhc2UxLCBiYXNlMgorICAgIHsKKyAgICAgICAgaW50IGQ7CisgICAgfTsKKworICAgIGRlcml2ZWQgZDEge3sxLCAyfSwge30sIDR9OyAgLy8gZnVsbCBpbml0aWFsaXphdGlvbgorICAgIGRlcml2ZWQgZDIge3t9LCB7fSwgNH07ICAgICAgLy8gdmFsdWUtaW5pdGlhbGl6ZWQgYmFzZXMKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfZ2VuZXJhbF9yYW5nZV9iYXNlZF9mb3JfbG9vcAorICB7CisKKyAgICBzdHJ1Y3QgaXRlcgorICAgIHsKKyAgICAgIGludCBpOworCisgICAgICBpbnQmIG9wZXJhdG9yKiAoKQorICAgICAgeworICAgICAgICByZXR1cm4gaTsKKyAgICAgIH0KKworICAgICAgY29uc3QgaW50JiBvcGVyYXRvciogKCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgcmV0dXJuIGk7CisgICAgICB9CisKKyAgICAgIGl0ZXImIG9wZXJhdG9yKysoKQorICAgICAgeworICAgICAgICArK2k7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICB9OworCisgICAgc3RydWN0IHNlbnRpbmVsCisgICAgeworICAgICAgaW50IGk7CisgICAgfTsKKworICAgIGJvb2wgb3BlcmF0b3I9PSAoY29uc3QgaXRlciYgaSwgY29uc3Qgc2VudGluZWwmIHMpCisgICAgeworICAgICAgcmV0dXJuIGkuaSA9PSBzLmk7CisgICAgfQorCisgICAgYm9vbCBvcGVyYXRvciE9IChjb25zdCBpdGVyJiBpLCBjb25zdCBzZW50aW5lbCYgcykKKyAgICB7CisgICAgICByZXR1cm4gIShpID09IHMpOworICAgIH0KKworICAgIHN0cnVjdCByYW5nZQorICAgIHsKKyAgICAgIGl0ZXIgYmVnaW4oKSBjb25zdAorICAgICAgeworICAgICAgICByZXR1cm4gezB9OworICAgICAgfQorCisgICAgICBzZW50aW5lbCBlbmQoKSBjb25zdAorICAgICAgeworICAgICAgICByZXR1cm4gezV9OworICAgICAgfQorICAgIH07CisKKyAgICB2b2lkIGYoKQorICAgIHsKKyAgICAgIHJhbmdlIHIge307CisKKyAgICAgIGZvciAoYXV0byBpIDogcikKKyAgICAgIHsKKyAgICAgICAgW1ttYXliZV91bnVzZWRdXSBhdXRvIHYgPSBpOworICAgICAgfQorICAgIH0KKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfbGFtYmRhX2NhcHR1cmVfYXN0ZXJpc2tfdGhpc19ieV92YWx1ZQorICB7CisKKyAgICBzdHJ1Y3QgdAorICAgIHsKKyAgICAgIGludCBpOworICAgICAgaW50IGZvbygpCisgICAgICB7CisgICAgICAgIHJldHVybiBbKnRoaXNdKCkKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiBpOworICAgICAgICB9KCk7CisgICAgICB9CisgICAgfTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfZW51bV9jbGFzc19jb25zdHJ1Y3Rpb24KKyAgeworCisgICAgZW51bSBjbGFzcyBieXRlIDogdW5zaWduZWQgY2hhcgorICAgIHt9OworCisgICAgYnl0ZSBmb28gezQyfTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfY29uc3RleHByX2lmCisgIHsKKworICAgIHRlbXBsYXRlIDxib29sIGNvbmQ+CisgICAgaW50IGYgKCkKKyAgICB7CisgICAgICBpZiBjb25zdGV4cHIoY29uZCkKKyAgICAgIHsKKyAgICAgICAgcmV0dXJuIDEzOworICAgICAgfQorICAgICAgZWxzZQorICAgICAgeworICAgICAgICByZXR1cm4gNDI7CisgICAgICB9CisgICAgfQorCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9zZWxlY3Rpb25fc3RhdGVtZW50X3dpdGhfaW5pdGlhbGl6ZXIKKyAgeworCisgICAgaW50IGYoKQorICAgIHsKKyAgICAgIHJldHVybiAxMzsKKyAgICB9CisKKyAgICBpbnQgZjIoKQorICAgIHsKKyAgICAgIGlmIChhdXRvIGkgPSBmKCk7IGkgPiAwKQorICAgICAgeworICAgICAgICByZXR1cm4gMzsKKyAgICAgIH0KKworICAgICAgc3dpdGNoIChhdXRvIGkgPSBmKCk7IGkgKyA0KQorICAgICAgeworICAgICAgY2FzZSAxNzoKKyAgICAgICAgcmV0dXJuIDI7CisKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHJldHVybiAxOworICAgICAgfQorICAgIH0KKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfdGVtcGxhdGVfYXJndW1lbnRfZGVkdWN0aW9uX2Zvcl9jbGFzc190ZW1wbGF0ZXMKKyAgeworCisgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQxLCB0eXBlbmFtZSBUMj4KKyAgICBzdHJ1Y3QgcGFpcgorICAgIHsKKyAgICAgIHBhaXIgKFQxIHAxLCBUMiBwMikKKyAgICAgICAgOiBtMSB7cDF9LAorICAgICAgICAgIG0yIHtwMn0KKyAgICAgIHt9CisKKyAgICAgIFQxIG0xOworICAgICAgVDIgbTI7CisgICAgfTsKKworICAgIHZvaWQgZigpCisgICAgeworICAgICAgW1ttYXliZV91bnVzZWRdXSBhdXRvIHAgPSBwYWlyezEzLCA0MnV9OworICAgIH0KKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3Rfbm9uX3R5cGVfYXV0b190ZW1wbGF0ZV9wYXJhbWV0ZXJzCisgIHsKKworICAgIHRlbXBsYXRlIDxhdXRvIG4+CisgICAgc3RydWN0IEIKKyAgICB7fTsKKworICAgIEI8NT4gYjE7CisgICAgQjwnYSc+IGIyOworCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9zdHJ1Y3R1cmVkX2JpbmRpbmdzCisgIHsKKworICAgIGludCBhcnJbMl0gPSB7IDEsIDIgfTsKKyAgICBzdGQ6OnBhaXI8aW50LCBpbnQ+IHByID0geyAxLCAyIH07CisKKyAgICBhdXRvIGYxKCkgLT4gaW50KCYpWzJdCisgICAgeworICAgICAgcmV0dXJuIGFycjsKKyAgICB9CisKKyAgICBhdXRvIGYyKCkgLT4gc3RkOjpwYWlyPGludCwgaW50PiYKKyAgICB7CisgICAgICByZXR1cm4gcHI7CisgICAgfQorCisgICAgc3RydWN0IFMKKyAgICB7CisgICAgICBpbnQgeDEgOiAyOworICAgICAgdm9sYXRpbGUgZG91YmxlIHkxOworICAgIH07CisKKyAgICBTIGYzKCkKKyAgICB7CisgICAgICByZXR1cm4ge307CisgICAgfQorCisgICAgYXV0byBbIHgxLCB5MSBdID0gZjEoKTsKKyAgICBhdXRvJiBbIHhyMSwgeXIxIF0gPSBmMSgpOworICAgIGF1dG8gWyB4MiwgeTIgXSA9IGYyKCk7CisgICAgYXV0byYgWyB4cjIsIHlyMiBdID0gZjIoKTsKKyAgICBjb25zdCBhdXRvIFsgeDMsIHkzIF0gPSBmMygpOworCisgIH0KKworICBuYW1lc3BhY2UgdGVzdF9leGNlcHRpb25fc3BlY190eXBlX3N5c3RlbQorICB7CisKKyAgICBzdHJ1Y3QgR29vZCB7fTsKKyAgICBzdHJ1Y3QgQmFkIHt9OworCisgICAgdm9pZCBnMSgpIG5vZXhjZXB0OworICAgIHZvaWQgZzIoKTsKKworICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgQmFkCisgICAgZihUKiwgVCopOworCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgVDEsIHR5cGVuYW1lIFQyPgorICAgIEdvb2QKKyAgICBmKFQxKiwgVDIqKTsKKworICAgIHN0YXRpY19hc3NlcnQgKHN0ZDo6aXNfc2FtZV92PEdvb2QsIGRlY2x0eXBlKGYoZzEsIGcyKSk+KTsKKworICB9CisKKyAgbmFtZXNwYWNlIHRlc3RfaW5saW5lX3ZhcmlhYmxlcworICB7CisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBUPiB2b2lkIGYoVCkKKyAgICB7fQorCisgICAgdGVtcGxhdGU8Y2xhc3MgVD4gaW5saW5lIFQgZyhUKQorICAgIHsKKyAgICAgIHJldHVybiBUe307CisgICAgfQorCisgICAgdGVtcGxhdGU8PiBpbmxpbmUgdm9pZCBmPD4oaW50KQorICAgIHt9CisKKyAgICB0ZW1wbGF0ZTw+IGludCBnPD4oaW50KQorICAgIHsKKyAgICAgIHJldHVybiA1OworICAgIH0KKworICB9CisKK30gIC8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qYXZhIiBhbmQgImphdmFjIiwgb3IKIGRubCBjb21waWxpbmcgb3IgcnVubmluZyB1c2VyLXByb3ZpZGVkIEphdmEgY29kZS4KIGRubApAQCAtNTcsNiArNTcsMTAgQEAKICAgICAgICAgICAgIGVjaG8gIlJ1bm5pbmcgXCIkSkFWQUMgY29uZmlndGVzdF9heF9qYXZhY19hbmRfamF2YS5qYXZhXCIiID4mQVNfTUVTU0FHRV9MT0dfRkQKICAgICAgICAgICAgIGlmICRKQVZBQyBjb25maWd0ZXN0X2F4X2phdmFjX2FuZF9qYXZhLmphdmEgPiZBU19NRVNTQUdFX0xPR19GRCAyPiYxIDsgdGhlbgogCisgICAgICAgICAgICAgICMgcHJldmVudCAkSkFWQSBWTSBpc3N1ZXMgd2l0aCBVVEYtOCBwYXRoIG5hbWVzIChUSFJJRlQtMzI3MSkKKyAgICAgICAgICAgICAgb0xDX0FMTD0iJExDX0FMTCIKKyAgICAgICAgICAgICAgTENfQUxMPSIiCisKICAgICAgICAgICAgICAgSUZTPSIsIgogICAgICAgICAgICAgICBmb3IgSkFWQSBpbiAkSkFWQV9QUk9HUyA7IGRvCiAgICAgICAgICAgICAgICAgSUZTPSIkb0lGUyIKQEAgLTY5LDYgKzczLDEwIEBACiAKICAgICAgICAgICAgICAgZG9uZQogCisgICAgICAgICAgICAgICMgcmVzdG9yZSBMQ19BTEwKKyAgICAgICAgICAgICAgTENfQUxMPSIkb0xDX0FMTCIKKyAgICAgICAgICAgICAgb0xDX0FMTD0iIgorCiAgICAgICAgICAgICBmaQogCiAgICAgICAgICAgZG9uZQpAQCAtMTEwLDcgKzExOCw3IEBACiBBQ19ERUZVTihbQVhfQ0hFQ0tfQU5UX1ZFUlNJT05dLAogICAgICAgICAgWwogICAgICAgICAgIEFDX01TR19DSEVDS0lORyhmb3IgYW50IHZlcnNpb24gPiAkMikKLSAgICAgICAgICBBTlRfVkFMSUQ9YGV4cHIgJCgkMSAtdmVyc2lvbiAyPi9kZXYvbnVsbCB8IHN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gICAgICAgICAgQUNfUlVOX0lGRUxTRShbQUNfTEFOR19QUk9HUkFNKFtbCisgICAgICAgICAgQUNfTElOS19JRkVMU0UoW0FDX0xBTkdfUFJPR1JBTShbWwogICAgICAgICAgICNpbmNsdWRlIDx6bGliLmg+CiAgICAgICAgICAgI2lmIFpMSUJfVkVSTlVNID49IDB4JFdBTlRfWkxJQl9WRVJTSU9OCiAgICAgICAgICAgI2Vsc2UKZGlmZiAtLWdpdCBhL2FjbG9jYWwvYXhfbHVhLm00IGIvYWNsb2NhbC9heF9sdWEubTQKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNTkyMDE2NwotLS0gL2Rldi9udWxsCisrKyBiL2FjbG9jYWwvYXhfbHVhLm00CkBAIC0wLDAgKzEsNjY0IEBACisjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorIyAgICAgICAgICBodHRwczovL3d3dy5nbnUub3JnL3NvZnR3YXJlL2F1dG9jb25mLWFyY2hpdmUvYXhfbHVhLmh0bWwKKyMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisjCisjIFNZTk9QU0lTCisjCisjICAgQVhfUFJPR19MVUFbKFtNSU5JTVVNLVZFUlNJT05dLCBbVE9PLUJJRy1WRVJTSU9OXSwgW0FDVElPTi1JRi1GT1VORF0sIFtBQ1RJT04tSUYtTk9ULUZPVU5EXSldCisjICAgQVhfTFVBX0hFQURFUlNbKFtBQ1RJT04tSUYtRk9VTkRdLCBbQUNUSU9OLUlGLU5PVC1GT1VORF0pXQorIyAgIEFYX0xVQV9MSUJTWyhbQUNUSU9OLUlGLUZPVU5EXSwgW0FDVElPTi1JRi1OT1QtRk9VTkRdKV0KKyMgICBBWF9MVUFfUkVBRExJTkVbKFtBQ1RJT04tSUYtRk9VTkRdLCBbQUNU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ICAgICAgIFtfYXhfY2hlY2tfdGV4dD0iZm9yIGEgTHVhIGludGVycHJldGVyIHdpdGggdmVyc2lvbiA+PSAkMSJdLAorICAgICAgICBbX2F4X2NoZWNrX3RleHQ9ImZvciBhIEx1YSBpbnRlcnByZXRlciB3aXRoIHZlcnNpb24gPj0gJDEsIDwgJDIiXSkKKyAgICAgIEFDX0NBQ0hFX0NIRUNLKFskX2F4X2NoZWNrX3RleHRdLAorICAgICAgICBbYXhfY3ZfcGF0aGxlc3NfTFVBXSwKKyAgICAgICAgWyBmb3IgYXhfY3ZfcGF0aGxlc3NfTFVBIGluIF9BWF9MVUFfSU5URVJQUkVURVJfTElTVCBub25lOyBkbworICAgICAgICAgICAgdGVzdCAieCRheF9jdl9wYXRobGVzc19MVUEiID0gJ3hub25lJyAmJiBicmVhaworICAgICAgICAgICAgX0FYX0xVQV9DSEtfSVNfSU5UUlAoWyRheF9jdl9wYXRobGVzc19MVUFdLCBbXSwgW2NvbnRpbnVlXSkKKyAgICAgICAgICAgIF9BWF9MVUFfQ0hLX1ZFUihbJGF4X2N2X3BhdGhsZXNzX0xVQV0sIFskMV0sIFskMl0sIFticmVha10pCisgICAgICAgICAgZG9uZQorICAgICAgICBdKQorICAgICAgZG5sIFNldCAkTFVBIHRvIHRoZSBhYnNvbHV0ZSBwYXRoIG9mICRheF9jdl9wYXRobGVzc19MVUEuCisgICAgICBBU19JRihbdGVzdCAieCRheF9jdl9wYXRobGVzc19MVUEiID0gJ3hub25lJ10sCisgICAgICAgIFtMVUE9JzonXSwKKyAgICAgICAgW0FDX1BBVEhfUFJPRyhbTFVBXSwgWyRheF9jdl9wYXRobGVzc19MVUFdKV0pCisgICAgICBheF9kaXNwbGF5X0xVQT0kYXhfY3ZfcGF0aGxlc3NfTFVBCisgICAgXSkKKyAgXSkKKworICBBU19JRihbdGVzdCAieCRMVUEiID0gJ3g6J10sCisgIFsgZG5sIFJ1biBhbnkgdXNlci1zcGVjaWZpZWQgYWN0aW9uLCBvciB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Uk4oW1skMCBpcyBkZXByZWNhdGVkLCBwbGVhc2UgdXNlIEFYX1BST0dfTFVBIGluc3RlYWRdXSkKKyAgQVhfUFJPR19MVUEKK10pCisKKworZG5sID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KK2RubCBfQVhfTFVBX0NIS19JU19JTlRSUChQUk9HLCBbQUNUSU9OLUlGLVRSVUVdLCBbQUNUSU9OLUlGLUZBTFNFXSkKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitBQ19ERUZVTihbX0FYX0xVQV9DSEtfSVNfSU5UUlBdLAorWworICBkbmwgQSBtaW5pbWFsIEx1YSBmYWN0b3JpYWwgdG8gcHJvdmUgdGhpcyBpcyBhbiBpbnRlcnByZXRlci4gVGhpcyBzaG91bGQgd29yaworICBkbmwgZm9yIEx1YSBpbnRlcnByZXRlcnMgdmVyc2lvbiA1LjAgYW5kIGJleW9uZC4KKyAgX2F4X2x1YV9mYWN0b3JpYWw9W2AkMSAyPi9kZXYvbnVsbCAtZSAnCisgICAgLS0gYSBzaW1wbGUgZmFjdG9yaWFsCisgICAgZnVuY3Rpb24gZmFjdCAobikKKyAgICAgIGlmIG4gPT0gMCB0aGVuCisgICAgICAgIHJldHVybiAxCisgICAgICBlbHNlCisgICAgICAgIHJldHVybiBuICogZmFjdChuLTEpCisgICAgICBlbmQKKyAgICBlbmQKKyAgICBwcmludCgiZmFjdCg1KSBpcyAiIC4uIGZhY3QoNSkpJ2BdCisgIEFTX0lGKFt0ZXN0ICIkX2F4X2x1YV9mYWN0b3JpYWwiID0gJ2ZhY3QoNSkgaXMgMTIwJ10sCisgICAgWyQyXSwgWyQzXSkKK10pCisKKworZG5sID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P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YWwgdmVyID0gdmVyc3RyMm51bSh0cmltdmVyKQorICAgIGxvY2FsIG1heHZlciA9IHZlcnN0cjJudW0oIiQzIikgb3IgMWU5CisgICAgaWYgbWludmVyIDw9IHZlciBhbmQgdmVyIDwgbWF4dmVyIHRoZW4KKyAgICAgIHByaW50KCJ5ZXMiKQorICAgIGVsc2UKKyAgICAgIHByaW50KCJubyIpCisgICAgZW5kJ2BdCisgICAgQVNfSUYoW3Rlc3QgIngkX2F4X2x1YV9nb29kX3ZlcnNpb24iID0gInh5ZXMiXSwKKyAgICAgIFskNF0sIFskNV0pCitdKQorCisKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitkbmwgX0FYX0xVQV9GTkRfUFJGWF9QVEgoUFJPRywgUFJFRklYLCBTQ1JJUFQtT1ItTU9EVUxFLURJUikKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitBQ19ERUZVTihbX0FYX0xVQV9GTkRfUFJGWF9QVEhdLAorWworICBkbmwgR2V0IHRoZSBzY3JpcHQgb3IgbW9kdWxlIGRpcmVjdG9yeSBieSBxdWVyeWluZyB0aGUgTHVhIGludGVycHJldGVyLAorICBkbmwgZmlsdGVyaW5nIG9uIHRoZSBnaXZlbiBwcmVmaXgsIGFuZCBzZWxlY3RpbmcgdGhlIHNoYWxsb3dlc3QgcGF0aC4gSWYgbm8KKyAgZG5sIHBhdGggaXMgZm91bmQgbWF0Y2hpbmcgdGhlIHByZWZpeCwgdGhlIHJlc3VsdCB3aWxsIGJlIGFuIGVtcHR5IHN0cmluZy4KKyAgZG5sIFRoZSB0aGlyZCBhcmd1bWVudCBkZXRlcm1pbmVzIHRoZSB0eXBlIG9mIHNlYXJjaCwgaXQgY2FuIGJlICdzY3JpcHQnIG9yCisgIGRubCAnbW9kdWxlJy4gU3VwcGx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mVmaXgpIHRoZW4KKyAgICAgICAgICBsb2NhbCBkZXB0aCA9IHN0cmluZy5sZW4oc3RyaW5nLmdzdWIocGF0aCwgIkA8OkBeL0A6PkAiLCAiIikpCisgICAgICAgICAgaWYgZGVwdGggPCBtaW5kZXB0aCB0aGVuCisgICAgICAgICAgICBtaW5wYXRoID0gcGF0aAorICAgICAgICAgICAgbWluZGVwdGggPSBkZXB0aAorICAgICAgICAgIGVuZAorICAgICAgICBlbmQKKyAgICAgIGVuZCkKKyAgICBwcmludChtaW5wYXRoKSdgXQorXSkKKworCitkbmwgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorZG5sIEFYX0xVQV9IRUFERVJTKFtBQ1RJT04tSUYtRk9VTkRdLCBbQUNUSU9OLUlGLU5PVC1GT1VORF0pCitkbmwgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorQUNfREVGVU4oW0FYX0xVQV9IRUFERVJTXSwKK1sKKyAgZG5sIENoZWNrIGZvciBMVUFfVkVSU0lPTi4KKyAgQUNfTVNHX0NIRUNLSU5HKFtpZiBMVUFfVkVSU0lPTiBpcyBkZWZpbmVkXSkKKyAgQVNfSUYoW3Rlc3QgIngkTFVBX1ZFUlNJT04iICE9ICd4J10sCisgICAgW0FDX01TR19SRVNVTFQoW3llc10pXSwKKyAgICBbIEFDX01TR19SRVNVTFQoW25vXSkKKyAgICAgIEFDX01TR19FUlJPUihbY2Fubm90IGNoZWNrIEx1YSBoZWFkZXJzIHdpdGhvdXQga25vd2luZyBMVUFfVkVSU0lPTl0pCisgICAgXSkKKworICBkbmwgTWFrZSBMVUFfSU5DTFVERSBhIHByZWNpb3VzIHZhcmlhYmxlLgorICBBQ19BUkdfVkFSKFtMVUFfSU5DTFVERV0sIFtUaGUgTHVhIGluY2x1ZGVzLCBlLmcuIC1JL3Vz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KTsKK30KK11dKQorICAgICAgICAgICAgICAgIF0sCisgICAgICAgICAgICAgICAgWyBheF9jdl9sdWFfaGVhZGVyX3ZlcnNpb249YC4vY29uZnRlc3QkRVhFRVhUIHAgfCBcCisgICAgICAgICAgICAgICAgICAgICRTRUQgLW4gInN8Xkx1YSBcKEA8OkAwLTlAOj5AXHsxLFx9XC5APDpAMC05QDo+QFx7MSxcfVwpLlx7MCxcfXxcMXxwImAKKyAgICAgICAgICAgICAgICBdLAorICAgICAgICAgICAgICAgIFtheF9jdl9sdWFfaGVhZGVyX3ZlcnNpb249J3Vua25vd24nXSkKKyAgICAgICAgICAgICAgQ1BQRkxBR1M9JF9heF9sdWFfc2F2ZWRfY3BwZmxhZ3MKKyAgICAgICAgICAgIF0pCisKKyAgICAgICAgICBkbmwgQ29tcGFyZSB0aGlzIHRvIHRoZSBwcmV2aW91c2x5IGZvdW5kIExVQV9WRVJTSU9OLgorICAgICAgICAgIEFDX01TR19DSEVDS0lORyhbaWYgTHVhIGhlYWRlciB2ZXJzaW9uIG1hdGNoZXMgJExVQV9WRVJTSU9OXSkKKyAgICAgICAgICBBU19JRihbdGVzdCAieCRheF9jdl9sdWFfaGVhZGVyX3ZlcnNpb24iID0gIngkTFVBX1ZFUlNJT04iXSwKKyAgICAgICAgICAgIFsgQUNfTVNHX1JFU1VMVChbeWVzXSkKKyAgICAgICAgICAgICAgYXhfaGVhZGVyX3ZlcnNpb25fbWF0Y2g9J3llcycKKyAgICAgICAgICAgIF0sCisgICAgICAgICAgICBbIEFDX01TR19SRVNVTFQoW25vXSkKKyAgICAgICAgICAgICAgYXhfaGVhZGVyX3ZlcnNpb25fbWF0Y2g9J25vJworICAgICAgICAgICAgXSkKKyAgICAgICAgXSwKKyAgICAgICAgWyBBQ19NU0dfV0FSTihbY3Jvc3MgY29tcGlsaW5nIHNvIGFzc3VtaW5nIGhlYWRlciB2ZXJzaW9uIG51bWJlciBtYXRjaGVzXSkKKyAgICAgICAgICBheF9oZWFkZXJfdmVyc2lvbl9tYXRjaD0neWVzJworICAgICAgICBdKQorICAgIF0pCisKKyAgZG5sIFdhcyBMVUFfSU5DTFVERSBzcGVjaWZpZWQ/CisgIEFTX0lGKFt0ZXN0ICJ4JGF4X2hlYWRlcl92ZXJzaW9uX21hdGNoIiAhPSAneHllcycgJiYKKyAgICAgICAgIHRlc3QgIngkTFVBX0lOQ0xVREUiICE9ICd4J10sCisgICAgW0FDX01TR19FUlJPUihbY2Fubm90IGZpbmQgaGVhZGVycyBmb3Igc3BlY2lmaWVkIExVQV9JTkNMVURFXSldKQorCisgIGRubCBUZXN0IHRoZSBmaW5hbCByZXN1bHQgYW5kIHJ1biB1c2VyIGNvZGUuCisgIEFTX0lGKFt0ZXN0ICJ4JGF4X2hlYWRlcl92ZXJzaW9uX21hdGNoIiA9ICd4eWVzJ10sIFskMV0sCisgICAgW200X2RlZmF1bHQoWyQyXSwgW0FDX01TR19FUlJPUihbY2Fubm90IGZpbmQgTHVhIGluY2x1ZGVzXSldKV0pCitdKQorCitkbmwgQVhfTFVBX0hFQURFUlNfVkVSU0lPTiBubyBsb25nZXIgZXhpc3RzLCB1c2UgQVhfTFVBX0hFQURFUlMuCitBQ19ERUZVTihbQVhfTFVBX0hFQURFUlNfVkVSU0lPTl0sCitbCisgIEFDX01TR19XQVJOKFtbJDAgaXMgZGVwcmVjYXRlZCwgcGxlYXNlIHVzZSBBWF9MVUFfSEVBREVSUyBpbnN0ZWFkXV0pCitdKQorCisKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitkbmwgQVhfTFVBX0xJQlMoW0FDVElPTi1JRi1GT1VORF0sIFtBQ1RJT04tSUYtTk9ULUZPVU5EXSkKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitBQ19ERUZVTihbQVhfTFVBX0xJQlNdL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JUX1ZFUlNJT04gXAorICAgICAgICBsdWEgXAorICAgICAgXSwKKyAgICAgIFtfYXhfZm91bmRfbHVhX2xpYnM9J3llcyddLAorICAgICAgW19heF9mb3VuZF9sdWFfbGlicz0nbm8nXSwKKyAgICAgIFskX2F4X2x1YV9leHRyYV9saWJzXSkKKyAgICBMSUJTPSRfYXhfbHVhX3NhdmVkX2xpYnMKKworICAgIEFTX0lGKFt0ZXN0ICJ4JGFjX2N2X3NlYXJjaF9sdWFfbG9hZCIgIT0gJ3hubycgJiYKKyAgICAgICAgICAgdGVzdCAieCRhY19jdl9zZWFyY2hfbHVhX2xvYWQiICE9ICd4bm9uZSByZXF1aXJlZCddLAorICAgICAgW0xVQV9MSUI9IiRhY19jdl9zZWFyY2hfbHVhX2xvYWQgJF9heF9sdWFfZXh0cmFfbGlicyJdKQorICBdKQorCisgIGRubCBUZXN0IHRoZSByZXN1bHQgYW5kIHJ1biB1c2VyIGNvZGUuCisgIEFTX0lGKFt0ZXN0ICJ4JF9heF9mb3VuZF9sdWFfbGlicyIgPSAneHllcyddLCBbJDFdLAorICAgIFttNF9kZWZhdWx0KFskMl0sIFtBQ19NU0dfRVJST1IoW2Nhbm5vdCBmaW5kIEx1YSBsaWJzXSldKV0pCitdKQorCisKK2RubCA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CitkbmwgQVhfTFVBX1JFQURMSU5FKFtBQ1RJT04tSUYtRk9VTkRdLCBbQUNUSU9OLUlGLU5PVC1GT1VORF0pCitkbmwgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorQUNfREVGVU4oW0FYX0xVQV9SRUFETElORV0sCitbCisgIEFYX0xJQl9SRUFETElORQorICBBU19JRihbdGVzdCAieCRhY19jdl9oZWFkZXJfcmVhZGxpbmVfcmVhZGxpbmVfaCIgIT0gJ3gnICY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3Ci0tLSAvZGV2L251bGwKKysrIGIvYWNsb2NhbC9heF9wcm9nX2hheGVfdmVyc2lvbi5tNApAQCAtMCwwICsxLDYwIEBACisjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorIyAgIGh0dHBzOi8vd3d3LmdudS5vcmcvc29mdHdhcmUvYXV0b2NvbmYtYXJjaGl2ZS9heF9wcm9nX2hheGVfdmVyc2lvbi5odG1sCisjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorIworIyBTWU5PUFNJUworIworIyAgIEFYX1BST0dfSEFYRV9WRVJTSU9OKFtWRVJTSU9OXSxbQUNUSU9OLUlGLVRSVUVdLFtBQ1RJT04tSUYtRkFMU0VdKQorIworIyBERVNDUklQVElPTgorIworIyAgIE1ha2VzIHN1cmUgdGhhdCBoYXhlIHN1cHBvcnRzIHRoZSB2ZXJzaW9uIGluZGljYXRlZC4gSWYgdHJ1ZSB0aGUgc2hlbGwKKyMgICBjb21tYW5kcyBpbiBBQ1RJT04tSUYtVFJVRSBhcmUgZXhlY3V0ZWQuIElmIG5vdCB0aGUgc2hlbGwgY29tbWFuZHMgaW4KKyMgICBBQ1RJT04tSUYtRkFMU0UgYXJlIHJ1bi4gVGhlICRIQVhFX1ZFUlNJT04gdmFyaWFibGUgd2lsbCBiZSBmaWxsZWQgd2l0aAorIyAgIHRoZSBkZXRlY3RlZCB2ZXJzaW9uLgorIworIyAgIFRoaXMgbWFjcm8gdXNlcyB0aGUgJEhBWEUgdmFyaWFibGUgdG8gcGVyZm9ybSB0aGUgY2hlY2suIElmICRIQVhFIGlzIG5vdAorIyAgIHNldCBwcmlvciB0byBjYWxsaW5nIHRoaXMgbWFjcm8sIHRoZSBtYWNybyB3aWxsIGZhaWwuCisjCisjICAgRXhhbXBsZToKKyMKKyMgICAgIEFDX1BBVEh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CisJICAgIEFDX1NVQlNUKFtIQVhFX1ZFUlNJT05dLFskaGF4ZV92ZXJzaW9uXSkKKworICAgICAgICBBWF9DT01QQVJFX1ZFUlNJT04oWyRheF9oYXhlX3ZlcnNpb25dLFtsZV0sWyRoYXhlX3ZlcnNpb25dLFsKKwkgICAgOgorICAgICAgICAgICAgJDIKKyAgICAgICAgXSxbCisJICAgIDoKKyAgICAgICAgICAgICQzCisgICAgICAgIF0pCisgICAgXSxbCisgICAgICAgIEFDX01TR19XQVJOKFtjb3VsZCBub3QgZmluZCBIYXhlXSkKKyAgICAgICAgJDMKKyAgICBdKQorXSkKZGlmZiAtLWdpdCBhL2FjbG9jYWwvYXhfcHJvZ19wZXJsX21vZHVsZXMubTQgYi9hY2xvY2FsL2F4X3Byb2dfcGVybF9tb2R1bGVzLm00CmluZGV4IDExYTMyNmMuLjcwYjMyMzAgMTAwNjQ0Ci0tLSBhL2FjbG9jYWwvYXhfcHJvZ19wZXJsX21vZHVsZXMubTQKKysrIGIvYWNsb2NhbC9heF9wcm9nX3BlcmxfbW9kdWxlcy5tNApAQCAtMSw1ICsxLDUgQEAKICMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0jICAgaHR0cDovL3d3dy5nbnUub3JnL3NvZnR3YXJlL2F1dG9jb25mLWFyY2hpdmUvYXhfcHJvZ19wZXJsX21vZHVsZXMuaHRtbAorIyAgIGh0dHBzOi8vd3d3LmdudS5vcmcvc29mdHdhcmUvYXV0b2NvbmYtYXJjaGl2ZS9heF9wcm9nX3BlcmxfbW9kdWxlcy5odG1sCiAjID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQogIwogIyBTWU5PUFNJUwpAQCAtMzIsNyArMzIsNyBAQAogIyAgIGFuZCB0aGlzIG5vdGljZSBhcmUgcHJlc2VydmVkLiBUaG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VYSVQgL0IKKyAgICBjaW5zdCAteSBjdXJsICAgICAgICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKKyAgICBjaW5zdCAteSA3emlwICAgICAgICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKKyAgICBjaW5zdCAteSBweXRob24zICAgICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKKyAgICBjaW5zdCAteSBvcGVuc3NsLmxpZ2h0ICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKKykKKworY2luc3QgLXkgamRrOCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorY2luc3QgLXkgd2luZmxleGJpc29uMyAgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorCis6OiB6bGliIC0gbm90IGF2YWlsYWJsZSB0aHJvdWdoIGNob2NvbGF0ZXkKK0NEICIlQVBQVkVZT1JfU0NSSVBUUyUiICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKK2NhbGwgYnVpbGQtemxpYi5iYXQgICAgICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKKworOjogbGliZXZlbnQgLSBub3QgYXZhaWxhYmxlIHRocm91Z2ggY2hvY29sYXRleQorQ0QgIiVBUFBWRVlPUl9TQ1JJUFRTJSIgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorY2FsbCBidWlsZC1saWJldmVudC5iYXQgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorCis6OiBweXRob24gcGFja2FnZXMgKGNvcnJlY3QgcGF0aCB0byBwaXAgc2V0IGluIGNsX3NldGVudi5iYXQpCitwaXAuZXhlIF4KKyAgICBpbnN0YWxsIGJhY2twb3J0cy5zc2xfbWF0Y2hfaG9zdG5hbWUgXgorICAgICAgICAgICAgaXBhZGRyZXNzIF4KKyAgICAgICAgICAgIHNpeCBeCisgICAgICAgICAgICB0b3JuYWRvIF4KKyAgICAgICAgICAgIHR3aXN0ZWQgICAgICAgICAgICAgICAg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IiVVUkwlIgorICAgIElGIEVSUk9STEVWRUwgMSAoCisgICAgICAgIGN1cmwgLUwgLWYgLW8gIiVVUkxGSUxFJSIgIiVGVVJMJSIKKyAgICApCispIEVMU0UgKAorICAgIGFwcHZleW9yIERvd25sb2FkRmlsZSAiJVVSTCUiCisgICAgSUYgRVJST1JMRVZFTCAxICgKKyAgICAgICAgYXBwdmV5b3IgRG93bmxvYWRGaWxlICIlRlVSTCUiICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorICAgICkKKykKKzd6IHggIiVVUkxGSUxFJSIgLXNvIHwgN3ogeCAtc2kgLXR0YXIgPiBudWwgICAgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorCis6OiBHZW5lcmF0ZQorTUtESVIgIiVCVUlMRERJUiUiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBFWElUIC9CCitDRCAiJUJVSUxERElSJSIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IEVYSVQgL0IKK2NtYWtlICIlU1JDRElSJSIgXgorICAgICAgLUciTk1ha2UgTWFrZWZpbGVzIiBeCisgICAgICAtRENNQUtFX0lOU1RBTExfUFJFRklYPSIlSU5TVERJUiUiIF4KKyAgICAgIC1EQ01BS0VfQlVJTERfVFlQRT0iJUNPTkZJR1VSQVRJT04lIiAgICAgICAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorCis6OiBCdWlsZAorbm1ha2UgL2ZNYWtlZmlsZSBpbnN0YWxsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBFWElUIC9CCitJRiAiJUNPTkZJR1VSQVRJT04lIiA9PSAiRGVidWciICgKKyAgICBDT1BZICIlQlVJTERESVIlXHpsaWJkLnBkYiIgIiVJTlNURElSJVxiaW5cIiAgICAgICAgICAgICAgICAgfHwgRVhJVCAvQgorKQorCitFTkRMT0NBTApkaWZmIC0tZ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LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorRUNITyBBUFBWRVlPUl9CVUlMRF9GT0xERVIgPSAlQVBQVkVZT1JfQlVJTERfRk9MREVSJQorRUNITyBDT05GSUdVUkFUSU9OICAgICAgICAgPSAlQ09ORklHVVJBVElPTiUKK0VDSE8gUExBVEZPUk0gICAgICAgICAgICAgID0gJVBMQVRGT1JNJQorRUNITyBQUk9GSUxFICAgICAgICAgICAgICAgPSAlUFJPRklMRSUKK0VDSE8vCitFQ0hPIE91ciBWYXJpYWJsZXMKK0VDSE8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorRUNITyBBUFBWRVlPUl9TQ1JJUFRTICAgICAgPSAlQVBQVkVZT1JfU0NSSVBUUyUKK0VDSE8gQkFTSCAgICAgICAgICAgICAgICAgID0gJUJBU0glCitFQ0hPIEJPT1NUX1JPT1QgICAgICAgICAgICA9ICVCT09TVF9ST09UJQorRUNITyBCT09TVF9JTkNMVURFRElSICAgICAgPSAlQk9PU1RfSU5DTFVERURJUiUKK0VDSE8gQk9PU1RfTElCUkFSWURJUiAgICAgID0gJUJPT1NUX0xJQlJBUllESVIlCitFQ0hPIEJVSUxERElSICAgICAgICAgICAgICA9ICVCVUlMRERJUiUKK0VDSE8gQ09NUElMRVIgICAgICAgICAgICAgID0gJUNPTVBJTEVSJQorRUNITyBHRU5FUkFUT1IgICAgICAgICAgICAgPSAlR0VORVJBVE9SJQorRUNITyBJTlNURElSICAgICAgICAgICAgICAgPSAlSU5TVERJUiUKK0VDSE8gSkFWQV9IT01FICAgICAgICAgICAgID0gJUpBVkFfSE9NRSUKK0VDSE8gT1BFTlNTTF9ST09UICAgICAgICAgID0gJU9QRU5TU0xfUk9PVCUKK0VDSE8gU0VUVVAgICAgICAgICAg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XBwb3J0IiBPTikKK2VuZGlmKCkKK0NNQUtFX0RFUEVOREVOVF9PUFRJT04oQlVJTERfQ1BQICJCdWlsZCBDKysgbGlicmFyeSIgT04KKyAgICAgICAgICAgICAgICAgICAgICAgIkJVSUxEX0xJQlJBUklFUztXSVRIX0NQUDtCb29zdF9GT1VORCIgT0ZGKQorQ01BS0VfREVQRU5ERU5UX09QVElPTihXSVRIX1BMVUdJTiAiQnVpbGQgY29tcGlsZXIgcGx1Z2luIHN1cHBvcnQiIE9GRgorICAgICAgICAgICAgICAgICAgICAgICAiQlVJTERfQ09NUElMRVI7QlVJTERfQ1BQIiBPRkYpCisKKyMgQyBHTGliCitvcHRpb24oV0lUSF9DX0dMSUIgIkJ1aWxkIEMgKEdMaWIpIFRocmlmdCBsaWJyYXJ5IiBPTikKK2lmKFdJVEhfQ19HTElCKQorICAgIGZpbmRfcGFja2FnZShHTElCIFFVSUVUIENPTVBPTkVOVFMgZ29iamVjdCkKK2VuZGlmKCkKK0NNQUtFX0RFUEVOREVOVF9PUFRJT04oQlVJTERfQ19HTElCICJCdWlsZCBDIChHTGliKSBsaWJyYXJ5IiBPTgorICAgICAgICAgICAgICAgICAgICAgICAiQlVJTERfTElCUkFSSUVTO1dJVEhfQ19HTElCO0dMSUJfRk9VTkQiIE9GRikKKworaWYoQlVJTERfQ1BQKQorICAgIHNldChib29zdF9jb21wb25lbnRzKQorICAgIGlmKEJVSUxEX1RFU1RJTkcpCisgICAgICAgIGxpc3QoQVBQRU5EIGJvb3N0X2NvbXBvbmVudHMgc3lzdGVtIHRocmVhZCkKKyAgICBlbmRpZigpCisgICAgaWYoQlVJTERfVEVTVElORykKKyAgICAgICAgbGlzdChBUFBFTkQgYm9vc3RfY29tcG9uZW50cyB1bml0X3Rlc3RfZnJhbWV3b3JrIGZpbGVzeXN0ZW0gY2hyb25vIHByb2dyYW1fb3B0aW9ucykKKyAgICBlbmRpZigpCisgICAgaWYoYm9vc3RfY29tcG9uZW50cykKKyAgICAgICA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RGVidWcgYnVpbGQgdHlwZXMsIGFwcGVuZCBhICJkIiB0byB0aGUgbGlicmFyeSBuYW1lcy4KKyAgICBzZXQoQ01BS0VfREVCVUdfUE9TVEZJWCAiZCIgQ0FDSEUgU1RSSU5HICJTZXQgZGVidWcgbGlicmFyeSBwb3N0Zml4IiBGT1JDRSkKKyAgICBzZXQoQ01BS0VfUkVMRUFTRV9QT1NURklYICIiIENBQ0hFIFNUUklORyAiU2V0IHJlbGVhc2UgbGlicmFyeSBwb3N0Zml4IiBGT1JDRSkKKyAgICBzZXQoQ01BS0VfUkVMV0lUSERFQklORk9fUE9TVEZJWCAiIiBDQUNIRSBTVFJJTkcgIlNldCByZWxlYXNlIGxpYnJhcnkgcG9zdGZpeCIgRk9SQ0UpCisKKyAgICAjIEJ1aWxkIHVzaW5nIC9NVCBvcHRpb24gaW5zdGVhZCBvZiAvTUQgaWYgdGhlIFdJVEhfTVQgb3B0aW9ucyBpcyBzZXQKKyAgICBpZihXSVRIX01UKQorICAgICAgICBzZXQoQ29tcGlsZXJGbGFncworICAgICAgICAgICAgICAgIENNQUtFX0NYWF9GTEFHUworICAgICAgICAgICAgICAgIENNQUtFX0NYWF9GTEFHU19ERUJVRworICAgICAgICAgICAgICAgIENNQUtFX0NYWF9GTEFHU19SRUxFQVNFCisgICAgICAgICAgICAgICAgQ01BS0VfQ1hYX0ZMQUdTX1JFTFdJVEhERUJJTkZPCisgICAgICAgICAgICAgICAgQ01BS0VfQ19GTEFHUworICAgICAgICAgICAgICAgIENNQUtFX0NfRkxBR1NfREVCVUcKKyAgICAgICAgICAgICAgICBDTUFLRV9DX0ZMQUdTX1JFTEVBU0UKKyAgICAgICAgICAgICAgICBDTUFLRV9DX0ZMQUdTX1JFTFdJVEhERUJJTkZPCisgICAgICAgICAgICAgICAgKQorICAgICAgICBmb3JlYWNoKENvbXBpbGVyRmxhZyAke0NvbXBpbGVyRmxhZ3N9KQorICAgICAgICAgIHN0cmluZyhSRVBMQUNFICIvTUQiICI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VuZGlmKCkKKworaWYoV0lUSF9TVEFUSUNfTElCKQorICAgIGFkZF9saWJyYXJ5KCR7bmFtZX1fc3RhdGljIFNUQVRJQyAke0FSR059KQorICAgIHNldF90YXJnZXRfcHJvcGVydGllcygke25hbWV9X3N0YXRpYyBQUk9QRVJUSUVTCisgICAgICAgIE9VVFBVVF9OQU1FICR7bmFtZX0ke1NUQVRJQ19QT1NURklYfQorICAgICAgICBWRVJTSU9OICR7dGhyaWZ0X1ZFUlNJT059CisgICAgICAgIFNPVkVSU0lPTiAke3RocmlmdF9WRVJTSU9OfSApCisgICAgaW5zdGFsbChUQVJHRVRTICR7bmFtZX1fc3RhdGljCisgICAgICAgIFJVTlRJTUUgREVTVElOQVRJT04gIiR7QklOX0lOU1RBTExfRElSfSIKKyAgICAgICAgTElCUkFSWSBERVNUSU5BVElPTiAiJHtMSUJfSU5TVEFMTF9ESVJ9IgorICAgICAgICBBUkNISVZFIERFU1RJTkFUSU9OICIke0xJQl9JTlNUQUxMX0RJUn0iCisgICAgICAgIFBVQkxJQ19IRUFERVIgREVTVElOQVRJT04gIiR7SU5DTFVERV9JTlNUQUxMX0RJUn0iKQorZW5kaWYoKQorCitlbmRtYWNybyhBRERfTElCUkFSWV9USFJJRlQpCisKKworbWFjcm8oVEFSR0VUX0lOQ0xVREVfRElSRUNUT1JJRVNfVEhSSUZUIG5hbWUpCisKK2lmKFdJVEhfU0hBUkVEX0xJQikKKyAgICB0YXJnZXRfaW5jbHVkZV9kaXJlY3Rvcmllcygke25hbWV9ICR7QVJHTn0pCitlbmRpZigpCisKK2lmKFdJVEhfU1RBVElDX0xJQikKKyAgICB0YXJnZXRfaW5jbHVkZV9kaXJlY3Rvcmllcygke25hbWV9X3N0YXRpYyAke0FSR059KQorZW5kaWYoKQorCitlbmRtYWNybyhUQVJHRVRfSU5DTFVERV9ESVJFQ1RPUklFU19USFJJRlQpCisKKworbWFjcm8oVEFSR0VUX0xJTktfTElCUkFSSUVTX1RIUklGVCBuYW1lK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uNjUuMSAgICAgICAgfCAgICAgICB8Cit8IGNtYWtlICAgICB8IDMuNS4xICAgICAgICAgfCAzLjEwLjIgICAgICAgIHwgICAgICAgfAorfCBjcHBjaGVjayAgfCAxLjcyICAgICAgICAgIHwgMS44MiAgICAgICAgICB8ICAgICAgIHwKK3wgZmxleCAgICAgIHwgMi42LjAgICAgICAgICB8IDIuNi40ICAgICAgICAgfCAgICAgICB8Cit8IGxpYmM2ICAgICB8IDIuMjMgICAgICAgICAgfCAyLjI3ICAgICAgICAgIHwgZ2xpYmMgfAorfCBsaWJldmVudCAgfCAyLjAuMjEgICAgICAgIHwgMi4xLjggICAgICAgICB8ICAgICAgIHwKK3wgbGlic3RkYysrIHwgNS40LjAgICAgICAgICB8IDcuMy4wICAgICAgICAgfCAgICAgICB8Cit8IG1ha2UgICAgICB8IDQuMSAgICAgICAgICAgfCA0LjEgICAgICAgICAgIHwgICAgICAgfAorfCBvcGVuc3NsICAgfCAxLjAuMmcgICAgICAgIHwgMS4xLjBnICAgICAgICB8ICAgICAgIHwKK3wgcXQ1ICAgICAgIHwgNS41LjEgICAgICAgICB8IDUuOS41ICAgICAgICAgfCAgICAgICB8CisKKyMjIENvbXBpbGVyL0xhbmd1YWdlIFZlcnNpb25zIHBlciBEb2NrZXJmaWxlICMjCisKK3wgTGFuZ3VhZ2UgIHwgdWJ1bnR1LXhlbmlhbCB8IHVidW50dS1iaW9uaWMgfCBOb3RlcyB8Cit8IDotLS0tLS0tLSB8IDotLS0tLS0tLS0tLS0gfCA6LS0tLS0tLS0tLS0tIHwgOi0tLS0gfAorfCBhcyBvZiAgICAgfCBNYXIgMDYsIDIwMTggIHwgSmFuIDQsIDIwMTkgICB8ICAgICAgIHwKK3wgYXMzICAgICAgIHwgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgfCBOb3QgaW4gQ0kgfAorfCBDKysgZ2NjICAgfCA1LjQuMCAgICAgICAgIHwgNy4zLjAgICAgICAgICB8ICAgICAgIHwKK3wgQysrIGNsYW5nIHwgMy44ICAgICAgICAgICB8IDYuMCAgICAgICAgICAgfCAgICAgICB8Cit8IEMjIChtb25vKSB8IDQuMi4xLjAgICAgICAgfCA0LjYuMi43ICAgICAgIHwgICAgICAgfAorfCBjX2dsaWIgICAgfCAyLjQ4LjIgICAgICAgIHwgMi41Ni4wICAgICAgICB8ICAgICAgIHwKK3wgY2wgKHNiY2wpIHwgICAgICAgICAgICAgICB8IDEuNC4xNSAgICAgICAgfCAgICAgICB8Cit8IGNvY29hICAgICB8ICAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgIHwgTm90IGluIENJIHwKK3wgZCAgICAgICAgIHwgMi4wNzUuMSAgICAgICB8IDIuMDgzLjEgICAgICAgfCAgICAgICB8Cit8IGRhcnQgICAgICB8IDEuMjIuMSAgICAgICAgfCAxLjI0LjMgICAgICAgIHwgICAgICAgfAorfCBkZWxwaGkgICAgfCAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICB8IE5vdCBpbiBDSSB8Cit8IGRvdG5ldCAgICB8IDIuMS40ICAgICAgICAgfCAyLjIuMTAxICAgICAgIHwgICAgICAgfAorfCBlcmxhbmcgICAgfCAxOC4zICAgICAgICAgIHwgMjAuMi4yICAgICAgICB8ICAgICAgIHwKK3wgZ28gICAgICAgIHwgMS43LjYgICAgICAgICB8IDEuMTEuNCAgICAgICAgfCAgICAgICB8Cit8IGhhc2tlbGwgICB8IDcuMTAuMyAgICAgICAgfCA4LjAuMiAgICAgICAgIHwgICAgICAgfAorfCBoYXhlICAgICAgfCAzLjIuMSAgICAgICAgIHwgMy40LjQgICAgICAgICB8IFRIUklGVC00MzUyOiBhdm9pZCAzLjQuMiB8Cit8IGphdmEgICAgICB8IDEuOC4wXzE1MSAgICAgfCAxLjguMF8xOTEgICAgIHwgICAgICAgfAorfCBqcyAgICAgICAgfCAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICB8IFVuc3VyZSBob3cgdG8gbG9vayBmb3IgdmVyc2lvbiBpbmZvPyB8Cit8IGx1YSAgICAgICB8IDUuMi40ICAgICAgICAgfCA1LjIuNCAgICAgICAgIHwgTHVhIDUuMzogc2VlIFRIUklGVC00Mzg2IHwKK3wgbm9kZWpzICAgIHwgNi4xMy4wICAgICAgICB8IDguMTUuMCAgICAgICAgfCAgICAgICB8Cit8IG9jYW1sICAgICB8ICAgICAgICAgICAgICAgfCA0LjA1LjAgICAgICAgIHwgVEhSSUZULTQ1MTc6IG9jYW1sIDQuMDIuMyBvbiB4ZW5pYWwgYXBwZWFycyBicm9rZW4gfAorfCBwZXJsICAgICAgfCA1LjIyLjEgICAgICAgIHwgNS4yNi4xICAgICAgICB8ICAgICAgIHwKK3wgcGhwICAgICAgIHwgNy4wLjIyICAgICAgICB8IDcuMi4xMCAgICAgICAgfCAgICAgICB8Cit8IHB5dGhvbiAgICB8IDIuNy4xMiAgICAgICAgfCAyLjcuMTVyYzEgICAgIHwgICAgICAgfAorfCBweXRob24zICAgfCAzLjUuMiAgICAgICAgIHwgMy42LjcgICAgICAgICB8ICAgICAgIHwKK3wgcnVieSAgICAgIHwgMi4zLjFwMTEyICAgICB8IDIuNS4xcDU3ICAgICAgfCAgICAgICB8Cit8IHJ1c3QgICAgICB8IDEuMTcuMCAgICAgICAgfCAxLjMwLjAgICAgICAgIHwgICAgICAgfAorfCBzbWFsbHRhbGsgfCAgICAgICAgICAgICAgIHwgICAgICAgICAgICAgICB8IE5vdCBpbiBDSSB8Cit8IHN3aWZ0ICAgICB8ICAgICAgICAgICAgICAgfCA0LjIuMSAgICAgICAgIHwgICAgICAgfApkaWZmIC0tZ2l0IGEvYnVpbGQvZG9ja2VyL29sZC9WYWdyYW50ZmlsZSBiL2J1aWxkL2RvY2tlci9vbGQvVmFncmFudGZpbGUKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNWVhYzZlNgotLS0gL2Rldi9udWxsCisrKyBiL2J1aWxkL2RvY2tlci9vbGQvVmFncmFudGZpbGUKQEAgLTAs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isgICAgICBjbGFuZy1hbmFseXplciBcCisgICAgICBjbWFrZTMgXAorICAgICAgY3VybCBcCisgICAgICBmbGV4IFwKKyAgICAgIGdjYyBcCisgICAgICBnY2MtYysrIFwKKyAgICAgIGdkYiBcCisgICAgICBnaXQgXAorICAgICAgbGlidG9vbCBcCisgICAgICBtNCBcCisgICAgICBtYWtlIFwKKyAgICAgIHRhciBcCisgICAgICB1bnppcCBcCisgICAgICB2YWxncmluZCBcCisgICAgICB3Z2V0ICYmIFwKKyAgICAgIGxuIC1zIC91c3IvYmluL2NtYWtlMyAvdXNyL2Jpbi9jbWFrZSAmJiBcCisgICAgICBsbiAtcyAvdXNyL2Jpbi9jcGFjazMgL3Vzci9iaW4vY3BhY2sgJiYgXAorICAgICAgbG4gLXMgL3Vzci9iaW4vY3Rlc3QzIC91c3IvYmluL2N0ZXN0CisKKyMgQysrIGRlcGVuZGVuY2llcworUlVOIHl1bSBpbnN0YWxsIC15IFwKKyAgICAgIGJvb3N0LWRldmVsLXN0YXRpYyBcCisgICAgICB6bGliLWRldmVsIFwKKyAgICAgIG9wZW5zc2wtZGV2ZWwgXAorICAgICAgbGliZXZlbnQtZGV2ZWwgJiYgXAorICAgIGNkIC91c3IvbGliNjQgJiYgXAorICAgIGxuIC1zIGxpYmJvb3N0X3RocmVhZC1tdC5hIGxpYmJvb3N0X3RocmVhZC5hCisKKyMgQyMgRGVwZW5kZW5jaWVzCitSVU4geXVtIGluc3RhbGwgLXkgXAorICAgICAgbW9uby1jb3JlIFwKKyAgICAgIG1vbm8tZGV2ZWwgXAorICAgICAgbW9uby13ZWItZGV2ZWwgXAorICAgICAgbW9uby1leHRyYXMKKworIyBEIERlcGVuZGVuY2llcworUlVOIHl1bSBpbnN0YWxsIC15IGh0dHA6Ly9kb3dubG9hZHMuZGxhbmcub3JnL3JlbGVhc2VzLzIueC8yLjA3Ni4wL2RtZC0yLjA3Ni4wLTAuZmVkb3JhLng4Nl82NC5ycG0geGRnLXV0aWxzCitSVU4g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gRXJsYW5nIERlcGVuZGVuY2llcworUlVOIGN1cmwgLXNTTCBodHRwOi8vcGFja2FnZXMuZXJsYW5nLXNvbHV0aW9ucy5jb20vcnBtL2NlbnRvcy9lcmxhbmdfc29sdXRpb25zLnJlcG8gLW8gL2V0Yy95dW0ucmVwb3MuZC9lcmxhbmdfc29sdXRpb25zLnJlcG8gJiYgXAorICAgIHl1bSBpbnN0YWxsIC15IFwKKyAgICAgIGVybGFuZy1rZXJuZWwgXAorICAgICAgZXJsYW5nLWVydHMgXAorICAgICAgZXJsYW5nLXN0ZGxpYiBcCisgICAgICBlcmxhbmctZXVuaXQgXAorICAgICAgZXJsYW5nLXJlYmFyIFwKKyAgICAgIGVybGFuZy10b29scworCisjIEdMaWJDIERlcGVuZGVuY2llcworUlVOIHl1bSBpbnN0YWxsIC15IGdsaWIyLWRldmVsCisKKyMgR28gRGVwZW5kZW5jaWVzCitSVU4gY3VybCAtc1NMIGh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9nb2xhbmcvZ28xLjkubGludXgtYW1kNjQudGFyLmd6IHwgdGFyIC1DIC91c3IvbG9jYWwvIC14egorRU5WIFBBVEggL3Vzci9sb2NhbC9nby9iaW46JFBBVEgKKworIyBIYXNrZWxsIERlcGVuZGVuY2llcworUlVOIHl1bSAteSBpbnN0YWxsIGhhc2tlbGwtcGxhdGZvcm0KKworIyBIYXhlIERlcGVuZGVuY2llcworIyBOb3QgaW4gZGViaWFuL3N0cmV0Y2gKKworIyBKYXZhIERlcGVuZGVuY2llcworUlVOIHl1bSBpbnN0YWxsIC15IFwKKyAgICAgIGFudCBcCisgICAgICBqdW5pdCBcCisgICAgICBhbnQtanVuaXQgXAorICAgICAgamF2YS0xLjguMC1vcGVuamRrLWRldmVsCisKKyMgTHVhIERlcGVuZGVuY2llcworIyBMdWEgaW4gZXBlbCBpcyB0b28gb2xkICg1LjEuNCwgbmVlZCA1LjIpIHNvIHdlIGdldCB0aGUgbGF0ZXN0CitSVU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WxwZXIgXAorICAgICAgZmxleCBcCisgICAgICBwa2ctY29uZmlnICYmIFwKKyAgICBhcHQtZ2V0IC10IGplc3NpZS1iYWNrcG9ydHMgaW5zdGFsbCAteSAtLW5vLWluc3RhbGwtcmVjb21tZW5kcyBjbWFrZQorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIEMrKyBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIGxpYmJvb3N0LWRldiBcCisgICAgICBsaWJib29zdC1maWxlc3lzdGVtLWRldiBcCisgICAgICBsaWJib29zdC1wcm9ncmFtLW9wdGlvbnMtZGV2IFwKKyAgICAgIGxpYmJvb3N0LXN5c3RlbS1kZXYgXAorICAgICAgbGliYm9vc3QtdGVzdC1kZXYgXAorICAgICAgbGliYm9vc3QtdGhyZWFkLWRldiBcCisgICAgICBsaWJldmVudC1kZXYgXAorICAgICAgbGlic3NsLWRldiBcCisgICAgICBxdDUtZGVmYXVsdCBcCisgICAgICBxdGJhc2U1LWRldiBcCisgICAgICBxdGJhc2U1LWRldi10b29scworCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIEphdmEgZGVwZW5kZW5jaWVzYCBcCisgICAgICBhbnQgXAorICAgICAgYW50LW9wdGlvbmFsIFwKKyAgICAgIG9wZW5qZGstNy1qZGsgXAorICAgICAgbWF2ZW4KKworUlVOIGFwdC1nZXQgaW5zdGFsbCAteSAtLW5vLWluc3RhbGwtcmVjb21tZW5kcyBcCitgIyBQeXRob24gZGVwZW5kZW5jaWVzYCBcCisgICAgICBweXRob24tYWxsIFwKKyAgICAgIHB5dGhvbi1hbGwtZGJnIFwKKyAgICAgIHB5dGhvbi1hbGwtZGV2IFwKKyAgICAgIHB5dGhvbi1waXAgXAorICAgICAgcHl0aG9uLXNldHVwdG9vbHMgXAorICAgICAgcHl0aG9uLXR3aXN0ZWQgXAorICAg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WNvbW1lbmRzIFwKK2AjIE9DYW1sIGRlcGVuZGVuY2llc2AgXAorICAgICAgb2NhbWwgXAorICAgICAgb3BhbSAmJiBcCisgICAgb3BhbSBpbml0IC0teWVzICYmIFwKKyAgICBvcGFtIGluc3RhbGwgLS15ZXMgb2FzaXMKKworUlVOIGFwdC1nZXQgaW5zdGFsbCAteSAtLW5vLWluc3RhbGwtcmVjb21tZW5kcyBcCitgIyBQZXJsIGRlcGVuZGVuY2llc2AgXAorICAgICAgbGliYml0LXZlY3Rvci1wZXJsIFwKKyAgICAgIGxpYmNsYXNzLWFjY2Vzc29yLWNsYXNzLXBlcmwgXAorICAgICAgbGliY3J5cHQtc3NsZWF5LXBlcmwgXAorICAgICAgbGliaW8tc29ja2V0LXNzbC1wZXJsIFwKKyAgICAgIGxpYm5ldC1zc2xlYXktcGVybAorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFBocCBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIHBocDcuMCBcCisgICAgICBwaHA3LjAtY2xpIFwKKyAgICAgIHBocDcuMC1kZXYgXAorICAgICAgcGhwLXBlYXIgXAorICAgICAgcmUyYyBcCisgICAgICBwaHB1bml0CisKK1JVTiBhcHQtZ2V0IGluc3RhbGwgLXkgLS1uby1pbnN0YWxsLXJlY29tbWVuZHMgXAorYCMgUHl0aG9uIGRlcGVuZGVuY2llc2AgXAorICAgICAgcHl0aG9uLWFsbCBcCisgICAgICBweXRob24tYWxsLWRiZyBcCisgICAgICBweXRob24tYWxsLWRldiBcCisgICAgICBweXRob24tYmFja3BvcnRzLnNzbC1tYXRjaC1ob3N0bmFtZSBcCisgICAgICBweXRob24taXBhZGRyZXNzIFwKKyAgICAgIHB5dGhvbi1waXAgXAorICAgICAgcHl0aG9uLXNldHVwdG9vbHMgXAorICAgICAgcHl0aG9uLXNpeCBcCisgICAgICBweXRob24tdG9ybmFkbyBcCisgICAgICBweXRob24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gR2VuZXJhbCBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIGJhc2gtY29tcGxldGlvbiBcCisgICAgICBiaXNvbiBcCisgICAgICBidWlsZC1lc3NlbnRpYWwgXAorICAgICAgY2xhbmcgXAorICAgICAgY21ha2UgXAorICAgICAgZGViaGVscGVyIFwKKyAgICAgIGZsZXggXAorICAgICAgZ2RiIFwKKyAgICAgIGxsdm0gXAorICAgICAgbmluamEtYnVpbGQgXAorICAgICAgcGtnLWNvbmZpZyBcCisgICAgICB2YWxncmluZCBcCisgICAgICB2aW0KK0VOViBQQVRIIC91c3IvbGliL2xsdm0tMy44L2JpbjokUEFUSAorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIEMrKyBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIGxpYmJvb3N0LWFsbC1kZXYgXAorICAgICAgbGliZXZlbnQtZGV2IFwKKyAgICAgIGxpYnNzbC1kZXYgXAorICAgICAgcXQ1LWRlZmF1bHQgXAorICAgICAgcXRiYXNlNS1kZXYgXAorICAgICAgcXRiYXNlNS1kZXYtdG9vbHMKKworUlVOIGFwdC1nZXQgaW5zdGFsbCAteSAtLW5vLWluc3RhbGwtcmVjb21tZW5kcyBcCitgIyBjc2hhcnAgKG1vbm8pIGRlcGVuZGVuY2llc2AgXAorICAgICAgbW9uby1kZXZlbAorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIEQgZGVwZW5kZW5jaWVzYCBcCisgICAgICBkbWQtYmluPTIuMDcwLjItMCBcCisgICAgICBsaWJwaG9ib3MyLWRldj0yLjA3MC4yLTAgXAorICAgICAgZHViIFwKKyAgICAgIGRmbXQgXAorICAgICAgZHNjYW5uZXIgXAorICAgICAgeGRnLXV0aWxzCitSVU4gbWtkaXIgLXAgL3Vzci9pbmNsdWRlL2RtZC9kcnVudGltZS9pbXBvcnQvZ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1zc2xlYXktcGVybAorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFBocCBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIHBocCBcCisgICAgICBwaHAtY2xpIFwKKyAgICAgIHBocC1kZXYgXAorICAgICAgcGhwLXBlYXIgXAorICAgICAgcmUyYyBcCisgICAgICBjb21wb3NlcgorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFB5dGhvbiBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIHB5dGhvbi1hbGwgXAorICAgICAgcHl0aG9uLWFsbC1kYmcgXAorICAgICAgcHl0aG9uLWFsbC1kZXYgXAorICAgICAgcHl0aG9uLWlwYWRkcmVzcyBcCisgICAgICBweXRob24tcGlwIFwKKyAgICAgIHB5dGhvbi1zZXR1cHRvb2xzIFwKKyAgICAgIHB5dGhvbi1zaXggXAorICAgICAgcHl0aG9uLXRvcm5hZG8gXAorICAgICAgcHl0aG9uLXR3aXN0ZWQgXAorICAgICAgcHl0aG9uLXdoZWVsIFwKKyAgICAgIHB5dGhvbi16b3BlLmludGVyZmFjZSAmJiBcCisgICBwaXAgaW5zdGFsbCAtLXVwZ3JhZGUgYmFja3BvcnRzLnNzbF9tYXRjaF9ob3N0bmFtZQorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFB5dGhvbjMgZGVwZW5kZW5jaWVzYCBcCisgICAgICBweXRob24zLWFsbCBcCisgICAgICBweXRob24zLWFsbC1kYmcgXAorICAgICAgcHl0aG9uMy1hbGwtZGV2IFwKKyAgICAgIHB5dGhvbjMtcGlwIFwKKyAgICAgIHB5dGhvbjMtc2V0dXB0b29scyBcCisgICAgICBweXRob24zLXNpeCBcCisgICAgICBweXRob24zLXRvcm5hZG8gXAorICAgICAgcHl0aG9uMy10d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B0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFBocCBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIHBocDcuMCBcCisgICAgICBwaHA3LjAtY2xpIFwKKyAgICAgIHBocDcuMC1kZXYgXAorICAgICAgcGhwLXBlYXIgXAorICAgICAgcmUyYyBcCisgICAgICBjb21wb3NlcgorCitSVU4gYXB0LWdldCBpbnN0YWxsIC15IC0tbm8taW5zdGFsbC1yZWNvbW1lbmRzIFwKK2AjIFB5dGhvbiBkZXBlbmRlbmNpZXNgIFwKKyAgICAgIHB5dGhvbi1hbGwgXAorICAgICAgcHl0aG9uLWFsbC1kYmcgXAorICAgICAgcHl0aG9uLWFsbC1kZXYgXAorICAgICAgcHl0aG9uLWJhY2twb3J0cy5zc2wtbWF0Y2gtaG9zdG5hbWUgXAorICAgICAgcHl0aG9uLWlwYWRkcmVzcyBcCisgICAgICBweXRob24tcGlwIFwKKyAgICAgIHB5dGhvbi1zZXR1cHRvb2xzIFwKKyAgICAgIHB5dGhvbi1zaXggXAorICAgICAgcHl0aG9uLXRvcm5hZG8gXAorICAgICAgcHl0aG9uLXR3aXN0ZWQgXAorICAgICAgcHl0aG9uLXdoZWVsIFwKKyAgICAgIHB5dGhvbi16b3BlLmludGVyZmFjZSBcCisgICAgICBweXRob24zLWFsbCBcCisgICAgICBweXRob24zLWFsbC1kYmcgXAorICAgICAgcHl0aG9uMy1hbGwtZGV2IFwKKyAgICAgIHB5dGhvbjMtc2V0dXB0b29scyBcCisgICAgICBweXRob24zLXNpeCBcCisgICAgICBweXRob24zLXRvcm5hZG8gXAorICAgICAgcHl0aG9uMy10d2lzdGVkIFwKKyAgICAgIHB5dGhvbjMtd2hlZWwgXAorICAgICAgcHl0aG9uMy16b3BlLmludGVyZmFjZSAmJiBcCisgICAgcGlwIGluc3RhbGwgLS11cGdyYWRlIGJhY2twb3J0cy5zc2xfbWF0Y2hfaG9zdG5hbWUKKworUlVOI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sgIlZDLWNvbW1vbiIgXSwKKyAgICAgICAgdGVtcGxhdGUgICAgICAgICA9PiAxLAorICAgICAgICBjZmxhZ3MgICAgICAgICAgID0+IGFkZChwaWNrZXIoZGVmYXVsdCA9PiAiLURVTklDT0RFIC1EX1VOSUNPREUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVidWcgICA9PiAiL01EZCAvT2QgLURERUJVRyAtRF9ERUJVRyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxlYXNlID0+ICIvTUQgL08yIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApKSwKKyAgICAgICAgYmluX2NmbGFncyAgICAgICA9PiBhZGQocGlja2VyKGRlYnVnICAgPT4gIi9NRGQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsZWFzZSA9PiAiL01EIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKSksCisgICAgICAgIGJpbl9sZmxhZ3MgICAgICAgPT4gYWRkKCIvc3Vic3lzdGVtOmNvbnNvbGUgL29wdDpyZWYiKSwKKyAgICAgICAgZXhfbGlicyAgICAgICAgICA9PiBhZGQoc3ViIHsKKyAgICAgICAgICAgIG15IEBleF9saWJzID0gKCk7CisgICAgICAgICAgICBwdXNoIEBleF9saWJzLCAnd3MyXzMyLmxpYicgdW5sZXNzICRkaXNhYmxlZHtzb2NrfTsKKyAgICAgICAgICAgIHB1c2ggQGV4X2xpYnMsICdnZGkzMi5saWIgYWR2YXBpMzIubGliIGNyeXB0MzIubGliIHVzZXIzMi5saWInOworICAgICAgICAgICAgcmV0dXJuIGpvaW4oIiAiLCBAZXhfbGlicyk7CisgICAgICAgIH0pLAorICAgIH0sCisKK1RvIGJ1aWxkLCBvcGVuIHRoZSBhcHByb3ByaWF0ZSBWaXN1YWwgU3R1ZGlvIGNvbW1hbmQgcHJvbXB0IGFuZCB0aGVuIHJ1biA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9WRVJTSU9OJVwlQ09NUElMRVIlXCVBUkNIJVwlQlVJTERUWVBFJVwKKyAgU0VUIEJPT1NUX0xJQkRJUj1saWIlQVJDSDp+LTIsMiUtbXN2Yy0lQ09NUElMRVI6fi0zLDIlLjAKKyAgSUYgIiVCVUlMRFRZUEUlIiA9PSAiRGVidWciIChTRVQgWkxJQl9TVEFUSUNfU1VGRklYPWQpCisKKyAgRUNITy8KKyAgRUNITyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgIEVDSE8gICAgIENvbmZpZ3VyYXRpb246ICVQQUNLQUdFX05BTUUlICVQQUNLQUdFX1ZFUlNJT04lICVDT01QSUxFUiU6JUFSQ0glOiVCVUlMRFRZUEUlICIlR0VORVJBVE9SJSIKK0lGIERFRklORUQgQ09NUElMRVJPTkxZICgKKyAgRUNITyAgICAgICAgICAgICAgICAgICAgQ09NUElMRVIgT05MWQorKQorICBFQ0hPICAgQnVpbGQgRGlyZWN0b3J5OiAlQlVJTERESVIlCisgIEVDSE8gSW5zdGFsbCBEaXJlY3Rvcnk6ICVPVVRESVIlCisgIEVDSE8gIFNvdXJjZSBEaXJlY3Rvcnk6ICVTT1VSQ0VESVIlCisgIEVDSE8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICBFQ0hPLworCisgIE1LRElSICIlQlVJTERESVIlIgorICBDRCAiJUJVSUxERElSJSIgfHwgRVhJVCAvQgorCisgIENNQUtFLkVYRSAlfmRwMHRocmlmdCBeCisgICAgLUciJUdFTkVSQVRPUiUiIF4KKyAgICAtREJJU09OX0VYRUNVVEFCTEU9JVdJTjNQX1JPT1QlXGRpc3Rcd2luZmxleGJpc29uXHdpbl9iaXNvbi5leGUgXgorICAgIC1EQ01BS0VfQlVJTERfVFlQRT0lQlVJTERUWVBFJSBeCisgICAgLURGTEVYX0V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ICJEZWJ1ZyIgKFNFVCBaTElCX1NUQVRJQ19TVUZGSVg9ZCkKKworICBFQ0hPLworICBFQ0hPID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKyAgRUNITyAgICAgQ29uZmlndXJhdGlvbjogJVBBQ0tBR0VfTkFNRSUgJVBBQ0tBR0VfVkVSU0lPTiUgJUNPTVBJTEVSJTolQVJDSCU6JUJVSUxEVFlQRSUgIiVHRU5FUkFUT1IlIgorSUYgREVGSU5FRCBDT01QSUxFUk9OTFkgKAorICBFQ0hPICAgICAgICAgICAgICAgICAgICBDT01QSUxFUiBPTkxZCispCisgIEVDSE8gICBCdWlsZCBEaXJlY3Rvcnk6ICVCVUlMRERJUiUKKyAgRUNITyBJbnN0YWxsIERpcmVjdG9yeTogJU9VVERJUiUKKyAgRUNITyAgU291cmNlIERpcmVjdG9yeTogJVNPVVJDRURJUiUKKyAgRUNITyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgIEVDSE8vCisKK0lGICVPUFRfSURFJSA9PSAxICgKKworICBDQUxMIDpTRVRSVU5QQVRIIHx8IEVYSVQgL0IKKyAgQ0FMTCBERVZFTlYgIiFCVUlMRERJUiFBcGFjaGUgVGhyaWZ0LnNsbiIgfHwgRVhJVCAvQgorICBFWElUIC9CCisgIAorKQorCisgIE1LRElSICIlQlVJTERESVIlIgorICBDRCAiJUJVSUxERElSJSIgfHwgRVhJVCAvQgorCitJRiAlT1BUX0dFTkVSQVRFJSA9PSAxICgKKworICBDTUFLRS5FWEUgJX5kcDB0aHJpZnQgXgorICAgIC1HIiVHRU5FUkFUT1IlIiBeCisgICAgLURCSVNPTl9FWEVDVVRBQkxFPSVXSU4zUF9ST09UJVxkaXN0XHdpbmZsZXhiaXNvblx3aW5fYmlzb24uZXhlIF4KKyAgICAtREJPT1NUX1JP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04lXCVDT01QSUxFUiVcJUFSQ0glCisKKyAgRUNITy8KKyAgRUNITyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgIEVDSE8gICAgICAgICAgQnVpbGRpbmc6ICVQQUNLQUdFX05BTUUlIHYlUEFDS0FHRV9WRVJTSU9OJSAlQ09NUElMRVIlOiVBUkNIJTohQlVJTERUWVBFISAiJUdFTkVSQVRPUiUiCisgIEVDSE8gICBCdWlsZCBEaXJlY3Rvcnk6ICFCVUlMRERJUiEKKyAgRUNITyBJbnN0YWxsIERpcmVjdG9yeTogIU9VVERJUiEKKyAgRUNITyAgU291cmNlIERpcmVjdG9yeTogJVNPVVJDRURJUiUKKyAgRUNITyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisgIEVDSE8vCisKKyAgSUYgTk9UIERFRklORUQgTk9BU0sgKAorICAgIENIT0lDRSAvTSAiRG8geW91IHdhbnQgdG8gYnVpbGQgdGhpcyBjb25maWd1cmF0aW9uPyAiIC9jIFlOCisgICAgSUYgIUVSUk9STEVWRUwhIE5FUSAxIChFWElUIC9CICFFUlJPUkxFVkVMISkKKyAgKQorCisgIE1LRElSICIhQlVJTERESVIhIgorICBDRCAiIUJVSUxERElSISIgfHwgRVhJVCAvQgorCisgIENNQUtFLkVYRSAtRyIlR0VORVJBVE9SJSIgLURDTUFLRV9JTlNUQUxMX1BSRUZJWD0hT1VURElSISAtRENNQUtFX0JVSUxEX1RZUEU9IUJVSUxEVFlQRSEgIiVTT1VSQ0VESVIlIiB8fCBFWElUIC9CCisgIE5NQUtFIC9mTWFrZWZpbGUgaW5zdGFsbCB8fCBFWElUIC9CCisKKyAgSUYgIiFCVUlMRFRZUEUhIiA9PSAiRGVidWciICgKKyAgICBDT1BZICIhQlVJTERESVIhXHpsaWJkLnBkYiIgIiFPVVRESVIhXGJ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EhSSUZUX0FERF9DT01QSUxFUihjX2dsaWIgICJFbmFibGUgY29tcGlsZXIgZm9yIEMgd2l0aCBHbGliIiBPTikKK1RIUklGVF9BRERfQ09NUElMRVIoY3BwICAgICAiRW5hYmxlIGNvbXBpbGVyIGZvciBDKysiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihqYXZhICAgICJFbmFibGUgY29tcGlsZXIgZm9yIEphdmEiICAgT04pCitUSFJJRlRfQUREX0NPTVBJTEVSKGFzMyAgICAgIkVuYWJsZSBjb21waWxlciBmb3IgQWN0aW9uU2NyaXB0IDMiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihkYXJ0ICAgICJFbmFibGUgY29tcGlsZXIgZm9yIERhcnQiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihoYXhlICAgICJFbmFibGUgY29tcGlsZXIgZm9yIEhheGUiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihjc2hhcnAgICJFbmFibGUgY29tcGlsZXIgZm9yIEMjIiBPTikKK1RIUklGVF9BRERfQ09NUElMRVIobmV0Y29yZSAiRW5hYmxlIGNvbXBpbGVyIGZvciAuTkVUIENvcmUiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihweSAgICAgICJFbmFibGUgY29tcGlsZXIgZm9yIFB5dGhvbiAyLjAiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihyYiAgICAgICJFbmFibGUgY29tcGlsZXIgZm9yIFJ1YnkiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihwZXJsICAgICJFbmFibGUgY29tcGlsZXIgZm9yIFBlcmwiIE9OKQorVEhSSUZUX0FERF9DT01QSUxFUihwaHAgICAgICJFbmFibGUgY29tcGlsZXIgZm9yIFBIUCIgT04pCitUSFJJRlRfQUREX0NPTVBJTEVSKGVybCAgICAgIkVuYWJsZSBjb21waWxlciBmb3IgRXJsYW5nIiBPTikKK1RIUklGVF9BRERfQ09NUElMRVIoY29jb2EgICAiRW5hYmxlIGNvbXBpb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G1ha2UuCisKK1NVQkRJUlMgPSBzcmMgc3JjL3RocmlmdC9wbHVnaW4gLgoraWYgV0lUSF9URVNUUworU1VCRElSUyArPSB0ZXN0CitlbmRpZgogCiBiaW5fUFJPR1JBTVMgPSB0aHJpZnQKIAotbm9pbnN0X0xJQlJBUklFUyA9IGxpYnBhcnNlLmEKLQogdGhyaWZ0X09CSkRJUiA9IG9iagogCi10aHJpZnRfU09VUkNFUyA9IHNyYy9tYWluLmNjIFwKLSAgICAgICAgICAgICAgICAgc3JjL21kNS5jIFwKLSAgICAgICAgICAgICAgICAgc3JjL2dlbmVyYXRlL3RfZ2VuZXJhdG9yLmNjIFwKLSAgICAgICAgICAgICAgICAgc3JjL2dlbmVyYXRlL3RfZ2VuZXJhdG9yX3JlZ2lzdHJ5LmggXAotICAgICAgICAgICAgICAgICBzcmMvZ2xvYmFscy5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL21haW4uaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wbGF0Zm9ybS5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL21kNS5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL3BhcnNlL3RfZG9jLmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvdF90eXBlLmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvdF9iYXNlX3R5cGUuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X2VudW0uaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X2VudW1fdmFsdWUuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X3R5cGVkZWYuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X2NvbnRhaW5lci5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL3BhcnNlL3RfbGlzdC5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL3BhcnNlL3Rfc2V0LmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvdF9tYXAuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X3N0cnVjdC5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL3BhcnNlL3RfZmllbGQuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X3NlcnZpY2UuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X2Z1bmN0aW9uLmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvdF9wcm9ncmFtLmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvdF9zY29wZS5oIFwKLSAgICAgICAgICAgICAgICAgc3JjL3BhcnNlL3RfY29uc3QuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9wYXJzZS90X2NvbnN0X3ZhbHVlLmggXAotICAgICAgICAgICAgICAgICBzcmMvcGFyc2UvcGFyc2UuY2MgXAotICAgICAgICAgICAgICAgICBzcmMvZ2VuZXJhdGUvdF9nZW5lcmF0b3IuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9nZW5lcmF0ZS90X29vcF9nZW5lcmF0b3IuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy9nZW5lcmF0ZS90X2h0bWxfZ2VuZXJhdG9yLmggXAotICAgICAgICAgICAgICAgICBzcmMvd2luZG93cy9jb25maWcuaCBcCi0gICAgICAgICAgICAgICAgIHNyYy93aW5kb3dzL3ZlcnNpb24uaAorcGx1Z2luX2dlbiA9IHNyYy90aHJpZnQvcGx1Z2luL3BsdWdpbl90eXBlcy5oIFwKKyAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BsdWdpbi9wbHVnaW5fdHlwZXMuY3BwIFwKKyAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BsdWdpbi9wbHVnaW5fY29uc3RhbnRzLmggXAorICAgICAgICAgICAgIHNyYy90aHJpZnQvcGx1Z2luL3BsdWdpbl9jb25zdGFudHMuY3BwCisKK2NvbXBpbGVyX2NvcmUgPSAgc3JjL3RocmlmdC9jb21tb24uaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY29tbW9uLmNjIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9nZW5lcmF0ZS90X2dlbmVyYXRvci5jYyBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvZ2VuZXJhdGUvdF9nZW5lcmF0b3JfcmVnaXN0cnkuaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvZ2xvYmFscy5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wbGF0Zm9ybS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9sb2dnaW5nLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfZG9jLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfdHlwZS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X2Jhc2VfdHlwZS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X2VudW0uaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9lbnVtX3ZhbHVlLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfdHlwZWRlZi5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X3R5cGVkZWYuY2MgXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfY29udGFpbmVyLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfbGlzdC5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X3NldC5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X21hcC5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X3N0cnVjdC5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X2ZpZWxkLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3Rfc2VydmljZS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X2Z1bmN0aW9uLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfcHJvZ3JhbS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X3Njb3BlLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfY29uc3QuaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9jb25zdF92YWx1ZS5oIFwKKyAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS9wYXJzZS5jYyBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvZ2VuZXJhdGUvdF9nZW5lcmF0b3IuaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvZ2VuZXJhdGUvdF9vb3BfZ2VuZXJhdG9yLmggXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2dlbmVyYXRlL3RfaHRtbF9nZW5lcmF0b3IuaCAKKwordGhyaWZ0X1NPVVJDRVMgPSBzcmMvdGhyaWZ0L21haW4uaCBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvbWFpbi5jYyBcCisgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvYXVkaXQvdF9hdWRpdC5jcHAgXAorICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2F1ZGl0L3RfYXVkaXQuaAogCiAjIFNwZWNpZmljIGNsaWVudCBnZW5lcmF0b3Igc291cmNlCi10aHJpZnRfU09VUkNFUyArPSBzcmMvZ2VuZXJhdGUvdF9jX2dsaWJfZ2VuZXJhdG9yLmNjIFwKLSAgICAgICAgICAgICAgICAgIHN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1Xbm8tdW51c2VkCitpZiAhV0lUSF9QTFVHSU4KK3RocmlmdF9TT1VSQ0VTICs9ICQoY29tcGlsZXJfY29yZSkKK2Vsc2UKIAotbGlicGFyc2VfYV9TT1VSQ0VTID0gc3JjL3RocmlmdHkueXkgXAotICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdGwubGwKK2xpYl9MVExJQlJBUklFUyA9IGxpYnRocmlmdGMubGEKKwordGhyaWZ0X0NQUEZMQUdTICs9IC1EVEhSSUZUX0VOQUJMRV9QTFVHSU49MQordGhyaWZ0X0xEQUREICs9IGxpYnRocmlmdGMubGEKKworbm9kaXN0X2xpYnRocmlmdGNfbGFfU09VUkNFUyA9ICQocGx1Z2luX2dlbikKK2xpYnRocmlmdGNfbGFfU09VUkNFUyA9ICQoY29tcGlsZXJfY29yZSkgXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wbHVnaW4vdHlwZV91dGlsLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wbHVnaW4vcGx1Z2luLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wbHVnaW4vcGx1Z2luLmNjIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGx1Z2luL3BsdWdpbl9vdXRwdXQuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BsdWdpbi9wbHVnaW5fb3V0cHV0LmNjIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGx1Z2luL3BsdWdpbi50aHJpZnQgXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9sb2dnaW5nLmNjCisKKworbGlidGhyaWZ0Y19sYV9DUFBGTEFHUyA9IC1JJChzcmNkaXIpL3NyYyAtSXNyYyAtSSQodG9wX2J1aWxkZGlyKS9saWIvY3BwL3NyYyAtRFRIUklGVF9FTkFCTEVfUExVR0lOPTEKK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ZnQvZ2VuZXJhdGUvdF9odG1sX2dlbmVyYXRvci5oIAorCitpbmNsdWRlX3BhcnNlZGlyID0gJChpbmNsdWRlX3RocmlmdGRpcikvcGFyc2UKK2luY2x1ZGVfcGFyc2VfSEVBREVSUyA9IHNyYy90aHJpZnQvcGFyc2UvdF9zZXJ2aWNlLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X3Byb2dyYW0uaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfZmllbGQuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3Rfc2NvcGUuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfdHlwZWRlZi5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9zZXQuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfY29uc3RfdmFsdWUuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfZW51bV92YWx1ZS5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9jb25zdC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9saXN0LmggXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X21hcC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9jb250YWluZXIuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfYmFzZV90eXBlLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wYXJzZS90X2VudW0uaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfZnVuY3Rpb24uaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3RfdHlwZS5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGFyc2UvdF9kb2MuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3BhcnNlL3Rfc3RydWN0LmgKKworaW5jbHVkZV9wbHVnaW5kaXIgPSAkKGluY2x1ZGVfdGhyaWZ0ZGlyKS9wbHVnaW4KK2luY2x1ZGVfcGx1Z2luX0hFQURFUlMgPSBzcmMvdGhyaWZ0L3BsdWdpbi9wbHVnaW4uaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wbHVnaW4vdHlwZV91dGlsLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcGx1Z2luL3BsdWdpbl9vdXRwdXQuaAorCitpbmNsdWRlX3dpbmRvd3NkaXIgPSAkKGluY2x1ZGVfdGhyaWZ0ZGlyKS93aW5kb3dzCitpbmNsdWRlX3dpbmRvd3NfSEVBREVSUyA9IHNyYy90aHJpZnQvd2luZG93cy9jb25maWcuaAorZW5kaWYKIAogV0lORE9XU19ESVNUID0gXAogICAgICAgICAgICAgIGNvbXBpbGVyLnNsbiBcCiAgICAgICAgICAgICAgY29tcGlsZXIudmN4cHJvaiBcCi0gICAgICAgICAgICAgY29tcGlsZXIudmN4cHJvai5maWx0ZXJzIFwKLSAgICAgICAgICAgICBSRUFETUVfV2luZG93cy50eHQKKyAgICAgICAgICAgICBjb21waWxlci52Y3hwcm9qLmZpbHRlcnMKIAogRVhUUkFfRElTVCA9IFwKKyAgICAgICAgICAgICBjb2Rpbmdfc3RhbmRhcmRzLm1kIFwKKyAgICAgICAgICAgICBSRUFETUUubWQgXAorICAgICAgICAgICAgIENNYWtlTGlzdHMudHh0IFwKKyAgICAgICAgICA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pZnQtYm9vdHN0cmFwCisKK3RocmlmdF90aHJpZnRfYm9vdHN0cmFwX1NPVVJDRVMgPSBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9jb21tb24uaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9jb21tb24uY2MgXAorICAgICAgICAgICAgICAgICB0aHJpZnQvYXVkaXQvdF9hdWRpdC5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L2F1ZGl0L3RfYXVkaXQuY3BwIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L2dlbmVyYXRlL3RfZ2VuZXJhdG9yLmNjIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L2dlbmVyYXRlL3RfZ2VuZXJhdG9yX3JlZ2lzdHJ5LmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvZ2xvYmFscy5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BsYXRmb3JtLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvbG9nZ2luZy5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BhcnNlL3RfZG9jLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF90eXBlLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9iYXNlX3R5cGUuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X2VudW0uaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X2VudW1fdmFsdWUuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X3R5cGVkZWYuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X3R5cGVkZWYuY2MgXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9jb250YWluZXIuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X2xpc3QuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X3NldC5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BhcnNlL3RfbWFwLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9zdHJ1Y3QuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X2ZpZWxkLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9zZXJ2aWNlLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9mdW5jdGlvbi5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BhcnNlL3RfcHJvZ3JhbS5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BhcnNlL3Rfc2NvcGUuaCBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9wYXJzZS90X2NvbnN0LmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvcGFyc2UvdF9jb25zdF92YWx1ZS5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3BhcnNlL3BhcnNlLmNjIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L2dlbmVyYXRlL3RfZ2VuZXJhdG9yLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvZ2VuZXJhdGUvdF9vb3BfZ2VuZXJhdG9yLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvZ2VuZXJhdGUvdF9odG1sX2dlbmVyYXRvci5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L3dpbmRvd3MvY29uZmlnLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvdmVyc2lvbi5oIFwKKyAgICAgICAgICAgICAgICAgdGhyaWZ0L2dlbmVyYXRlL3RfY3BwX2dlbmVyYXRvci5jYyBcCisgICAgICAgICAgICAgICAgIHRocmlmdC9tYWluLmggXAorICAgICAgICAgICAgICAgICB0aHJpZnQvbWFpbi5jYworCittYWluLmNjOiB2ZXJzaW9uLmgKKwordGhyaWZ0X3RocmlmdF9ib290c3RyYXB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IG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkICAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdCAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG1hcCk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX2FzM19kb2MgICAgICAgICAgICAgICAgIChzd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SUVMRCAnJXMnIFRZUEUgJyVzJ1xuIiwKLSAgICAgICAgICAgdGZpZWxkLT5nZXRfbmFtZSgpLmNfc3RyKCksIHR5cGVfbmFtZSh0eXBlKS5jX3N0cigpKTsKLSAgfQotfQotCi0vKioKLSAqIEdlbmVyYXRlcyBhbiB1bnNlcmlhbGl6ZXIgZm9yIGEgc3RydWN0LCBpbnZva2VzIHJlYWQoKQotICovCi12b2lkIHRfYXMzX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgb3V0IDw8Ci0gICAgaW5kZW50KCkgPDwgcHJlZml4IDw8ICIgPSBuZXcgIiA8PCB0eXBlX25hbWUodHN0cnVjdCkgPDwgIigpOyIgPDwgZW5kbCA8PAotICAgIGluZGVudCgpIDw8IHByZWZpeCA8PCAiLnJlYWQoaXByb3QpOyIgPDwgZW5kbDsKLX0KLQotLyoqCi0gKiBEZXNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgcmVhZGluZyBpdHMgc2l6ZSBhbmQgdGhlbiBpdGVyYXRpbmcKLSAqLwotdm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lcihvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgc2NvcGVfdXAob3V0KTsKLQotICBzdHJpbmcgb2JqOwotCi0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lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHN0cmluZyBrZXkgPSB0bXAoIl9rZXkiKTsKLSAgc3RyaW5nIHZhbCA9IHRtcCgiX3ZhbCIpOwotICB0X2ZpZWxkIGZrZXkodG1hcC0+Z2V0X2tleV90eXBlKCksIGtleSk7Ci0gIHRfZmllbGQgZnZhbCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgdmFsKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgIGRlY2xhcmVfZmllbGQoJmZrZXkpIDw8IGVuZGw7Ci0gIGluZGVudChvdXQpIDw8Ci0gICAgZGVjbGFyZV9maWVsZCgmZnZhbCkgPDwgZW5kbDsKLQotICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZma2V5KTsKLSAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZnZhbCk7Ci0KLSAgaW5kZW50KG91dCkgPDwKLSAgICBwcmVmaXggPDwgIlsiIDw8IGtleSA8PCAiXSA9ICIgPDwgdmFsIDw8ICI7IiA8PCBlbmRsOwotfQotCi0vKioKLSAqIERlc2VyaWFsaXplcyBhIHNldCBlbGVtZW50Ci0gKi8KLXZvaWQgdF9hczNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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G9mIGFueSB0eXBlLgotICoKLSAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkIHRvIHNlcmlhbGl6ZQotICogQHBhcmFtIHByZWZpeCBOYW1lIHRvIHByZXBlbmQgdG8gZmllbGQgbmFtZQotICovCi12b2lkIHRfYXMzX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHRfdHlwZSogdHlwZSA9IGdldF90cnVlX3R5cGUodGZpZWxkLT5nZXRfdHlwZSgpKTsKLQotICAvLyBEbyBub3RoaW5nIGZvciB2b2lkIHR5cGVzCi0gIGlmICh0eXBlLT5pc192b2lkKCkpIHsKLSAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIFNFUklBTElaRSBDT0RFIEZPUiB2b2lkIFRZUEU6ICIgKwotICAgICAgcHJlZml4ICsgdGZpZWxkLT5nZXRfbmFtZSgpOwotICB9Ci0KLSAgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKLSAgICBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0X3N0cnVjdCopdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKSk7Ci0gIH0gZWxzZSBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpIHsKLSAgICBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUsCi0gICAgICAg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19zdHIoKSwKLSAgICAgICAgICAgdHlwZV9uYW1lKHR5cGUpLmNfc3RyKCkpOwotICB9Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyBhbGwgdGhlIG1lbWJlcnMgb2YgYSBzdHJ1Y3QuCi0gKgotICogQHBhcmFtIHRzdHJ1Y3QgVGhlIHN0cnVjdCB0byBzZXJpYWxpemUKLSAqIEBwYXJhbSBwcmVmaXggIFN0cmluZyBwcmVmaXggdG8gYXR0YWNoIHRvIGFsbCBmaWVsZHMKLSAqLwotdm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gICh2b2lkKSB0c3RydWN0OwotICBvdXQgPDwKLSAgICBpbmRlbnQoKSA8PCBwcmVmaXggPDwgIi53cml0ZShvcHJvdCk7IiA8PCBlbmRsOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgd3JpdGluZyBpdHMgc2l6ZSB0aGVuIHRoZSBlbGVtZW50cy4KLSAqCi0gKiBAcGFyYW0gdHR5cGUgIFRoZSB0eXBlIG9mIGNvbnRhaW5lcgotICogQHBhcmFtIHByZWZpeCBTdHJpbmcgcHJlZml4IGZvciBmaWVsZHMKLSAqLwotdm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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ICBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG91dCwgKHRfbGlzdCopdHR5cGUsIGl0ZXIpOwotICAgIH0KLQotICAgIHNjb3BlX2Rvd24ob3V0KTsKLQotICBpZiAodHR5cGUtPmlzX21hcCgpKSB7Ci0gICAgaW5kZW50KG91dCkgPDwKLSAgICAgICJvcHJvdC53cml0ZU1hcEVuZCgpOyIgPDwgZW5kbDsKLSAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlU2V0RW5kKCk7IiA8PCBlbmRsOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlTGlzdEVuZCgpOyIgPDwgZW5kbDsKLSAgfQotCi0gIHNjb3BlX2Rvd24ob3V0KTsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgotICovCi12b2lkIHRfYXMzX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcCkgewotICB0X2ZpZWxkIGtmaWVsZCh0bWFwLT5nZXRfa2V5X3R5cGUoKSwgaXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsICIiKTsKLSAgdF9maWVsZCB2ZmllbGQodG1hcC0+Z2V0X3ZhbF90eXBlKCksIG1hcCArICJbIiArIGl0ZXIgKyAiXSIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkLCAiIik7Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIHNldC4KLSAqLwotdm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlcikgewotICB0X2ZpZWxkIGVmaWVsZCh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGl0ZXIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmZWZpZWxkLCAiIik7Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIGxpc3QuCi0gKi8KLXZvaWQgdF9hczNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlcikgewotICB0X2ZpZWxkIGVmaWVsZCh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIpOwotfQotCi0vKioKLSAqIFJldHVybnMgYSBBczMgdHlwZSBuYW1lCi0gKgotICogQHBhcmFtIHR0eXBlIFRoZSB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heSB0eXBlIjsKLSAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6Ci0gICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CWVRFOgotICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgotICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgotICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgotICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgotICAgICAgICAgICAgY25hbWUgPSAiR0FycmF5ICoiOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBhcnJheSBpbmZvIGZvciB0eXBlIjsKLSAgICAgICAgfQotICAgICAgfQotICAgIH0KLQotICAgIGlmIChpc19jb25zdCkgewotICAgICAgcmV0dXJuICJjb25zdCAiICsgY25hbWU7Ci0gICAgfSBlbHNlIHsKLSAgICAgIHJldHVybiBjbmFtZTsKLSAgICB9Ci0gIH0KLQotICAvLyBjaGVjayBmb3IgYSBuYW1lc3BhY2UKLSAgc3RyaW5nIHBuYW1lID0gdGhpcy0+bnNwYWNlICsgdHR5cGUtPmdldF9uYW1lKCk7Ci0KLSAgaWYgKGlzX2NvbXBsZXhfdHlwZSAodHR5cGUpKSB7Ci0gICAgcG5hbWUgKz0gIiAqIjsKLSAgfQotCi0gIGlmIChpc19jb25zdCkgewotICAgIHJldHVybiAiY29uc3QgIiArIHBuYW1lOwotICB9IGVsc2UgewotICAgIHJldHVybiBwbmFtZTsKLSAgfQotfQotCi0vKioKLSAqIE1hcHMgYSBUaHJpZnQgcHJpbWl0aXZlIHRvIG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ci0gICAgaWYgKGZpcnN0KSB7Ci0gICAgICBmaXJzdCA9IGZhbHNlOwotICAgIH0gZWxzZSB7Ci0gICAgICByZXN1bHQgKz0gIiwgIjsKLSAgICB9Ci0gICAgcmVzdWx0ICs9IHR5cGVfbmFtZSgoKmZfaXRlciktPmdldF90eXBlKCksIGZhbHNlLCBmYWxzZSkgKyAiKiAiICsKLSAgICAgICAgICAgICAgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpOwotICB9Ci0gIHJldHVybiByZXN1bHQ7Ci19Ci0KLQotLyoqCi0gKiBEZWNsYXJlcyBhIGZpZWxkLCBpbmNsdWRpbmcgYW55IG5lY2Vzc2FyeSBpbml0aWFsaXphdGlvbi4KLSAqLwotc3RyaW5nIHRfY19nbGliX2dlbmVyYXRvcjo6ZGVjbGFyZV9maWVsZCh0X2ZpZWxkICp0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5pdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNvbnN0YW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlZmVyZW5jZSkgewotICBzdHJpbmcgcmVzdWx0ID0gIiI7Ci0gIGlmIChjb25zdGFudCkgewotICAgIHJlc3VsdCArPSAiY29uc3QgIjsKLSAgfQotICByZXN1bHQgKz0gdHlwZV9uYW1lKHRmaWVsZC0+Z2V0X3R5cGUoKSk7Ci0gIGlmIChwb2ludGVyKSB7Ci0gICAgcmVzdWx0ICs9ICIqIjsKLSAgfQotICBpZiAocmVmZXJlbmNlKSB7Ci0gICAgcmVzdWx0ICs9ICIqIjsKLSAgfQotICByZXN1bHQgKz0gIiAiICsgdGZpZWxkLT5nZXRfbmFtZSgpOwotICBpZiAoaW5pdCkgewotICAgIHRfdHlwZSog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ykgPDwgZnVuY3Rpb25fc2lnbmF0dXJlICgmc2VydmljZV9mdW5jdGlvbikgPDwgIjsiIDw8IGVuZGw7Ci0KLSAgICB0X2Z1bmN0aW9uIHNlbmRfZnVuY3Rpb24gKGdfdHlwZV92b2lkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV9uYW1lX2xjICsgc3RyaW5nICgiX2NsaWVudF9zZW5kXyIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGZ1bm5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF9hcmdsaXN0KCkpOwotICAgIGluZGVudChmX2hlYWRlcl8pIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSAoJnNlbmRfZnVuY3Rpb24pIDw8ICI7IiA8PCBlbmRsOwotCi0gICAgLy8gaW1wbGVtZW50IHJlY3YgaWYgbm90IGEgb25ld2F5IHNlcnZpY2UKLSAgICBpZiAoISgqZl9pdGVyKS0+aXNfb25ld2F5KCkpIHsKLSAgICAgIHRfc3RydWN0IG5vYXJncyAocHJvZ3JhbV8pOwotICAgICAgdF9mdW5jdGlvbiByZWN2X2Z1bmN0aW9uICgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfbmFtZV9sYyArIHN0cmluZyAoIl9jbGllbnRfcmVjdl8iKSAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBmdW5uYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbm9hcmdzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF94Y2VwdGlvbnMoKSk7Ci0gICAgICBpbmRlbnQoZl9oZWFkZXJfKSA8PCBmdW5jdGlvbl9zaWduYXR1cmUgKCZyZWN2X2Z1bmN0aW9uKSA8PCAiOyIgPDwgZW5kbDsKLSAgICB9Ci0gIH0K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HlwZV92b2lkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV9uYW1lX2xjICsgc3RyaW5nICgiX2NsaWVudF9zZW5kXyIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGZ1bm5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF9hcmdsaXN0KCkpOwotCi0gICAgLy8gT3BlbiB0aGUgc2VuZCBmdW5jdGlvbgotICAgIGluZGVudChmX3NlcnZpY2VfKSA8PAotICAgICAgZnVuY3Rpb25fc2lnbmF0dXJlICgmc2VuZF9mdW5jdGlvbikgPDwgZW5kbDsKLSAgICBzY29wZV91cChmX3NlcnZpY2VfKTsKLQotICAgIC8vIFNlcmlhbGl6ZSB0aGUgcmVxdWVzdAotICAgIGZfc2VydmljZV8gPDwKLSAgICAgIGluZGVudCgpIDw8ICJnaW50MzIgY3NlcWlkID0gMDsiIDw8IGVuZGwgPDwKLSAgICAgIGluZGVudCgpIDw8ICJUaHJpZnRQcm90b2NvbCAqIHByb3RvY29sID0gIiA8PCAKLSAgICAgICAgdGhpcy0+bnNwYWNlX3VjIDw8IHNlcnZpY2VfbmFtZV91YyA8PCAKLSAgICAgICAgIl9DTElFTlQgKGlmYWNlKS0+b3V0cHV0X3Byb3RvY29sOyIgPDwgZW5kbCA8PAotICAgICAgZW5kbCA8PAotICAgICAgaW5kZW50KCkgPDwgImlmICh0aHJpZnRfcHJvdG9jb2xfd3JpdGVfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsIFwiIiA8PAotICAgICAgICBuYW1lIDw8ICJcIiwgVF9DQUxMLCBjc2VxaWQsIGVycm9yKSA8IDApIiA8PCBlbmRsIDw8Ci0gICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4gRkFMU0U7IiA8PCBlbmRsIDw8Ci0gICAgICBlbmRsOwotCi0gICAgZ2VuZXJhdGVfc3RydWN0X3dyaXRlciAoZl9zZXJ2aWNlXywgYXJn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KmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfbmFtZV9sYwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHN0cmluZyAoIl9jbGllbnRfcmVjdl8iKSArIGZ1bm5hbWUsICZub2FyZ3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgqZl9pdGVyKS0+Z2V0X3hjZXB0aW9ucygpKTsKLSAgICAgIC8vIE9wZW4gZnVuY3Rpb24KLSAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PAotICAgICAgICBmdW5jdGlvbl9zaWduYXR1cmUgKCZyZWN2X2Z1bmN0aW9uKSA8PCBlbmRsOwotICAgICAgc2NvcGVfdXAoZl9zZXJ2aWNlXyk7Ci0KLSAgICAgIGZfc2VydmljZV8gPDwgZW5kbCA8PAotICAgICAgICBpbmRlbnQoKSA8PCAiZ2ludDMyIHJzZXFpZDsiIDw8IGVuZGwgPDwKLSAgICAgICAgaW5kZW50KCkgPDwgImdjaGFyICogZm5hbWU7IiA8PCBlbmRsIDw8Ci0gICAgICAgIGluZGVudCgpIDw8ICJUaHJpZnRNZXNzYWdlVHlwZSBtdHlwZTsiIDw8IGVuZGwgPDwKLSAgICAgICAgaW5kZW50KCkgPDwgIlRocmlmdFByb3RvY29sICogcHJvdG9jb2wgPSAiIDw8IAotICAgICAgICAgICAgICAgICAgICAgIHRoaXMtPm5zcGFjZV91YyA8PCBzZXJ2aWNlX25hbWVfdWMgPDwKLSAgICAgICAgICAgICAgICAgICAgICAiX0NMSUVOVCAoaWZhY2UpLT5pbnB1dF9wcm90b2NvbDsiIDw8IGVuZGwgPDwKLSAgICAgICAgZW5kbCA8PAotICAgICAgICBpbmRlbnQoKSA8PCAiaWYgKHRocmlmdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gIiA8PCAKLSAgICAgICAgICAgICAgICAgICAgICAiKHByb3RvY29sLCAmZm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gIiA8PCB0aGlzLT5uc3BhY2VfbGMgPDwKLSAgICAgICAgc2VydmljZV9uYW1lX2xjIDw8ICJfY2xpZW50X3NldF9wcm9wZXJ0eTsiIDw8IGVuZGwgPDwKLSAgICAiICBnb2JqZWN0X2NsYXNzLT5nZXRfcHJvcGVydHkgPSAiIDw8IHRoaXMtPm5zcGFjZV9sYyA8PAotICAgICAgICBzZXJ2aWNlX25hbWVfbGMgPDwgIl9jbGllbnRfZ2V0X3Byb3BlcnR5OyIgPDwgZW5kbCA8PAotICAgIGVuZGwgPDwKLSAgICAiICBwYXJhbV9zcGVjID0gZ19wYXJhbV9zcGVjX29iamVjdCAoXCJpbnB1dF9wcm90b2NvbFwiLCIgPDwgZW5kbCA8PAotICAgICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImlucHV0IHByb3RvY29sIChjb25zdHJ1Y3QpXCIsIiA8PAotICAgICAgICBlbmRsIDw8Ci0gICAgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiU2V0IHRoZSBjbGllbnQgaW5wdXQgcHJvdG9jb2xcIiwiIDw8Ci0gICAgICAgIGVuZGwgPDwKLSAgICAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZUX1RZUEVfUFJPVE9DT0wsIiA8PCBlbmRsIDw8Ci0gICAgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fUkVBRFdSSVRFKTsiIDw8IGVuZGwgPDwKLSAgICAiICBnX29iamVjdF9jbGFzc19pbnN0YWxsX3Byb3BlcnR5IChnb2JqZWN0X2NsYXNzLCIgPDwgZW5kbCA8PAotICAgICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1BfIiA8PCB0aGlzLT5uc3BhY2VfdWMgPDwKLSAgICAgICAgc2VydmljZV9uYW1lX3VjIDw8ICJfQ0xJRU5UX0lOUFVUX1BST1RPQ09MLCBwYXJhbV9zcGVjKTsi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rlcl9zdGF0aWMgKFRIUklGVF9UWVBFX1NUUlVDVCwgIiA8PCBlbmRsIDw8Ci0gICAgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIiIDw8IHRoaXMtPm5zcGFjZSA8PCBuYW1lIDw8ICJUeXBlXCIsIiA8PCBlbmRsIDw8Ci0gICAgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnR5cGVfaW5mbywgMCk7IiA8PCBlbmRsIDw8Ci0gICAgIiAgfSIgPDwgZW5kbCA8PAotICAgIGVuZGwgPDwKLSAgICAiICByZXR1cm4gdHlwZTsiIDw8IGVuZGwgPDwKLSAgICAifSIgPDwgZW5kbCA8PAotICAgIGVuZGw7Ci19Ci0KLS8qKgotICogR2VuZXJhdGVzIGZ1bmN0aW9ucyB0byB3cml0ZSBUaHJpZnQgc3RydWN0dXJlcyB0byBhIHN0cmVhbS4KLSAqLwotdm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3N0cnVjdF93cml0ZXIgKG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QgKnRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHRoaXNfbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGhpc19nZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19mdW5jdGlvbikgewotICBzdHJpbmcgbmFtZSA9IHRzdHJ1Y3QtPmdldF9uYW1lKCk7Ci0gIHN0cmluZyBuYW1lX3UgPSBpbml0aWFsX2NhcHNfdG9fdW5kZXJzY29yZXMobmFtZSk7Ci0gIHN0cmluZyBuYW1lX3VjID0gdG9fdXBwZXJfY2FzZSh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gICAgcHJpbnRmICgiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnJXMnIFRZUEUgJyVzJ1xuIiwKLSAgICAgICAgICAgIG5hbWUuY19zdHIoKSwgdHlwZV9uYW1lICh0eXBlKS5jX3N0cigpKTsKLSAgfQotfQotCi12b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QgKnRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVycm9yX3JldCkgewotICAodm9pZCkgdHN0cnVjdDsKLSAgb3V0IDw8Ci0gICAgaW5kZW50KCkgPDwgImlmICgocmV0ID0gdGhyaWZ0X3N0cnVjdF93cml0ZSAoVEhSSUZUX1NUUlVDVCAoIiA8PCBwcmVmaXggPDwgIiksIHByb3RvY29sLCBlcnJvcikpIDwgMCkiIDw8IGVuZGwgPDwKLSAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4gIiA8PCBlcnJvcl9yZXQgPDwgIjsiIDw8IGVuZGwgPDwKLSAgICBpbmRlbnQoKSA8PCAieGZlciArPSByZXQ7IiA8PCBlbmRsIDw8Ci0gICAgZW5kbDsKLX0KLQotdm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSAqdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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bnQoKSA8PCAiaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfbGlzdF9lbmQgKHByb3RvY29sLCBlcnJvcikpIDwgMCkiIDw8IGVuZGwgPDwKLSAgICAgIGluZGVudCgpIDw8ICIgIHJldHVybiAiIDw8IGVycm9yX3JldCA8PCAiOyIgPDwgZW5kbCA8PAotICAgICAgaW5kZW50KCkgPDwgInhmZXIgKz0gcmV0OyIgPDwgZW5kbDsKLSAgfQotCi0gIHNjb3BlX2Rvd24ob3V0KTsKLX0KLQotdm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCAqdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtleSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHZhbHVlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7Ci0gIHRfZmllbGQga2ZpZWxkICh0bWFwLT5nZXRfa2V5X3R5cGUoKSwga2V5KTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkIChvdXQsICZrZmllbGQsICIiLCAiIiwgZXJyb3JfcmV0KTsKLQotICB0X2ZpZWxkIHZmaWVsZCAodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHZhbHVlKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkIChvdXQsICZ2ZmllbGQsICIiLCAiIiwgZXJyb3JfcmV0KTsKLX0KLQotdm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCAqdHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGVsZW1lbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpIHsKLSAgdF9maWVsZCBlZmllbGQgKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgZWxlbWVudCk7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCAob3V0LCAmZWZpZWxkLCAiIiwgIiIsIGVycm9yX3JldCk7Ci19Ci0KLXZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QgKnRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7Ci0gIHRfdHlwZSAqdHR5cGUgPSB0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpOwotCi0gIC8vIGNhc3QgdG8gbm9uLWNvbnN0Ci0gIHN0cmluZyBjYXN0ID0gIiI7Ci0gIHN0cmluZyBuYW1lID0gImdfcHRyX2FycmF5X2luZGV4ICgoR1B0ckFycmF5ICopICIgKy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c2VfdHlwZTo6VFlQRV9JMTY6Ci0gICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgotICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKLSAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6Ci0gICAgICAgICAgY2FzdCA9ICIoR0FycmF5KikiOwotICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKLSAgICAgICAgICBjYXN0ID0gIihHUHRyQXJyYXkqKSI7Ci0gICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgdGhyb3cgIkNvbXBpbGVyIGVycm9yOiBubyBhcnJheSBpbmZvIGZvciB0eXBlIjsKLSAgICAgIH0KLSAgICB9IGVsc2UgewotICAgICAgY2FzdCA9ICIoR1B0ckFycmF5KikiOwotICAgIH0KLSAgfQotCi0gIHRfZmllbGQgZWZpZWxkICh0dHlwZSwgIigiICsgY2FzdCArIG5hbWUgKyAiKSIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQgKG91dCwgJmVmaWVsZCwgIiIsICIiLCBlcnJvcl9yZXQpOwotfQotCi0vKiBkZXNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4gKi8KLXZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQgKnRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBzdWZmaXg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lwZSgpOwotICBzdHJpbmcgZWxlbSA9IHRtcCAoIl9lbGVtIik7Ci0gIHN0cmluZyB0ZWxlbV9wdHIgPSB0ZWxlbS0+aXNfc3RyaW5nKCkgfHwgIXRlbGVtLT5pc19iYXNlX3R5cGUoKSA/ICIiIDogIioiOwotCi0gIGRlY2xhcmVfbG9jYWxfdmFyaWFibGUob3V0LCB0ZWxlbSwgZWxlbSk7Ci0KLSAgdF9maWVsZCBmZWxlbSAodGVsZW0sIHRlbGVtX3B0ciArIGVsZW0pOwotICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZCAob3V0LCAmZmVsZW0sICIiLCAiIiwgZXJyb3JfcmV0KTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgICJnX2hhc2hfdGFibGVfaW5zZXJ0ICgoR0hhc2hUYWJsZSAqKSAiIDw8IHByZWZpeCA8PCAiLCAoZ3BvaW50ZXIpICIgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW0gPDwgIiwgKGdwb2ludGVyKSAxKTsiIDw8IGVuZGw7Ci19Ci0KLXZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0ICp0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGluZGV4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7Ci0gICh2b2lkKSBpbmRleDsKLSAgdF90eXBlICp0dHlw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vfc2VydmVyICAgICh0X3NlcnZpY2UqIHRzZXJ2aWNlKTsKLSAgdm9pZCBnZW5lcmF0ZV9wcm9jZXNzX2Z1bmN0aW9uICAodF9zZXJ2aWNlKiB0c2VydmljZSwgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKLQotICAvKioKLSAgICogU2VyaWFsaXphdGlvbiBjb25zdHJ1Y3RzCi0gICAqLwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBmaWVsZE5hbWUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0ICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50ICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCAgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGZpZWxkTmFtZT0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBtYXApOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50ICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBsaXN0TmFtZSk7Ci0KLSAgLyoqCi0gICAqIEhlbHBlciByZW5kZ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WVsZE5hbWUgTmFtZSB0byBvZiB0aGUgdmFyaWFibGUgaG9sZGluZyB0aGUgZmllbGQKLSAqLwotdm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBmaWVsZE5hbWUpIHsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOwotCi0gIC8vIERvIG5vdGhpbmcgZm9yIHZvaWQgdHlwZXMKLSAgaWYgKHR5cGUtPmlzX3ZvaWQoKSkgewotICAgIHRocm93ICJDQU5OT1QgR0VORVJBVEUgU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArCi0gICAgICB0ZmllbGQtPmdldF9uYW1lKCk7Ci0gIH0KLQotICBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgewotICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qob3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRfc3RydWN0Kil0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGROYW1lKTsKLSAgfSBlbHNlIGlmICh0eXBlLT5pc19jb250YWluZXIoKSkgewotICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIob3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkTmFtZSk7Ci0gIH0gZWxzZSBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkgfHwgdHlwZS0+aXNfZW51bSgp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6ZV9zZXRfZWxlbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBlbGVtZW50TmFtZSkgewotICB0X2ZpZWxkIGVmaWVsZCh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGVsZW1lbnROYW1lKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgZGVjb250YWluZXJpemUoJmVmaWVsZCwgZWxlbWVudE5hbWUpKTsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbGlzdC4KLSAqLwotdm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaW5kZXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBsaXN0TmFtZSkgewotICB0X2ZpZWxkIGVmaWVsZCh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCAiWyIgKyBsaXN0TmFtZSArICIgb2JqZWN0QXRJbmRleDogIiArIGluZGV4ICsgIl0iKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgZGVjb250YWluZXJpemUoJmVmaWVsZCwgZWZpZWxkLmdldF9uYW1lKCkpKTsKLX0KLQotCi0vKioKLSAqIFJldHVybnMgYW4gT2J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B0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50ICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwdXNoX2JhY2ssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpbmRleCk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQgICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHN1ZmZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0ICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiAgIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lciAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudCAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqICAgICB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZnVuY3Rpb25fY2FsbCAgICAgICAgICAgIChvc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGFyZ2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGlmYWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGFyZ19wcmVmaXgpOwotICAvKgotICAgKiBIZWxwZXIgcmVuZGVyaW5nIGZ1bmN0aW9ucwotICAgKi8KLQotICBzdGQ6OnN0cmluZyBuYW1lc3BhY2VfcHJlZml4KHN0ZDo6c3RyaW5nIG5zKTsKLSAgc3RkOjpzdHJpbmcgbmFtZXNwYWNlX29wZW4oc3RkOjpz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ZXJhdGVfc3RydWN0X3N3YXAoZl90eXBlc19pbXBsXywgdHN0cnVjdCk7Ci19Ci0KLS8qKgotICogV3JpdGVzIHRoZSBzdHJ1Y3QgZGVmaW5pdGlvbiBpbnRvIHRoZSBoZWFkZXIgZmlsZQotICoKLSAqIEBwYXJhbSBvdXQgT3V0cHV0IHN0cmVhbQotICogQHBhcmFtIHRzdHJ1Y3QgVGhlIHN0cnVjdAotICovCi12b2lkIHRfY3BwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc3RydWN0X2RlZmluaXRpb24ob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4Y2VwdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHBvaW50ZXJzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVhZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHdyaXRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc3dhcCkgewotICBzdHJpbmcgZXh0ZW5kcyA9ICIiOwotICBpZiAoaXNfZXhjZXB0aW9uKSB7Ci0gICAgZXh0ZW5kcyA9ICIgOiBwdWJsaWMgOjphcGFjaGU6OnRocmlmdDo6VEV4Y2VwdGlvbiI7Ci0gIH0KLQotICAvLyBHZXQgbWVtYmVycwotICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7Ci0gIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpO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aXRlciktPmdldF9yZXR1cm50eXBlKCkpKSB7Ci0gICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmIChyZXN1bHQuX19pc3NldC5zdWNjZXNzKSB7IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIC8vIF9yZXR1cm4gcG9pbnRlciBoYXMgbm93IGJlZW4gZmlsbGVkIiA8PCBlbmRsOwotICAgICAgICAgICAgaWYgKHN0eWxlID09ICJDb2IiICYmICFnZW5fbm9fY2xpZW50X2NvbXBsZXRpb25fKSB7Ci0gICAgICAgICAgICAgIG91dCA8PAotICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIGNvbXBsZXRlZCA9IHRydWU7IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgY29tcGxldGVkX18odHJ1ZSk7IiA8PCBlbmRsOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgb3V0IDw8Ci0gICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIHJldHVybjsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7Ci0gICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG91dCA8PAotICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiaWYgKHJlc3VsdC5fX2lzc2V0LnN1Y2Nlc3MpIHsiIDw8IGVuZGw7Ci0gICAgICAgICAgICBpZiAoc3R5bGUgPT0gIkNvYiIgJiYgIWdlbl9ub19jbGllbnRfY29tcGxldGlvbl8pIHsKLSAgICAgICAgICAgICAgb3V0IDw8Ci0gICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgY29tcGxldGVkID0gdHJ1ZTsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBjb21wbGV0ZWRfXyh0cnVlKTsiIDw8IGVuZGw7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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgc3RyaW5nIGVsZW0gPSB0bXAoIl9lbGVtIik7Ci0gIHRfZmllbGQgZmVsZW0odHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgIGRlY2xhcmVfZmllbGQoJmZlbGVtKSA8PCBlbmRsOwotCi0gIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgIHByZWZpeCA8PCAiLmluc2VydCgiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOwotfQotCi12b2lkIHRfY3BwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgdXNlX3B1c2gsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpbmRleCkgewotICBpZiAodXNlX3B1c2gpIHsKLSAgICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKLSAgICB0X2ZpZWxkIGZlbGVtKHRsaXN0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOwotICAgIGluZGVudChvdXQpIDw8IGRlY2xhcmVfZ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hdG9yOjpnZW5lcmF0ZV9kb2NzdHJpbmdfY29tbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiBjb21tZW50X3N0YXJ0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiBsaW5lX3ByZWZpeCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cmluZyYgY29udGVudHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGNvbW1lbnRfZW5kKSB7Ci0gIGlmIChjb21tZW50X3N0YXJ0ICE9ICIiKSBpbmRlbnQob3V0KSA8PCBjb21tZW50X3N0YXJ0OwotICBzdHJpbmdzdHJlYW0gZG9jcyhjb250ZW50cywgaW9zX2Jhc2U6OmluKTsKLSAgd2hpbGUgKCFkb2NzLmVvZigpKSB7Ci0gICAgY2hhciBsaW5lWzEwMjRdOwotICAgIGRvY3MuZ2V0bGluZShsaW5lLCAxMDI0KTsKLQotICAgIC8vIEp1c3QgcHJudCBhIG5ld2xpbmUgd2hlbiB0aGUgbGluZSAmIHByZWZpeCBhcmUgZW1wdHkuCi0gICAgaWYgKHN0cmxlbihsaW5lKSA9PSAwICYmIGxpbmVfcHJlZml4ID09ICIiICYmICFkb2NzLmVvZigpKSB7Ci0gICAgICAgIG91dCA8PCBzdGQ6OmVuZGw7Ci0gICAgfSBlbHNlIGlmIChzdHJsZW4obGluZSkgPiAwIHx8ICFkb2NzLmVvZigpKSB7ICAvLyBza2lwIHRoZSBlbXB0eSBsYXN0IGxpbmUKLSAgICAgIGluZGVudChvdXQpIDw8IGxpbmVfcHJlZml4IDw8IGxpbmUgPDwgc3RkOjplbmRsOwotICAgIH0KLSAgfQotICBpZiAoY29tbWVudF9lbmQgIT0gIiIp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VydmljZV9zZXJ2ZXIodF9zZXJ2aWNlKiB0c2VydmljZSk7Ci0gICAgdm9pZCBnZW5lcmF0ZV9wcm9jZXNzX2Z1bmN0aW9uKHRfc2VydmljZSogdHNlcnZpY2UsIHRfZnVuY3Rpb24qIHRmdW5jdGlvbik7Ci0KLSAgICAvKioKLSAgICAgKiBTZXJpYWxpemF0aW9uIGNvbnN0cnVjdHMKLSAgICAgKi8KLQotICAgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCAgICAgICAgZGVjbGFyZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbmNsYXNzID0gZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNvZXJjZURhdGEgPSBmYWxzZSk7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICAgICAgICBkZWNsYXJlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKLQotICAgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICAgICAgICBkZWNsYXJlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKLQotICAgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqICAgICAgdHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgICAgICAgIGRlY2xhcmUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICAgICAgICBkZWNsYXJlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOwotCi0gICAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgICAgICAgIGRlY2xhcmUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOwotCi0gICAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOwotCi0gICAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgdml0ZXIpOwotCi0gICAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqICAgICB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX2dvX2RvY3N0cmluZyhzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QpOwotCi0gICAgdm9pZCBnZW5lcmF0ZV9nb19kb2NzdHJpbmcoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZnVuY3Rpb24qIHRmdW5jdGlvbik7Ci0KLSAgICB2b2lkIGdlbmVyYXRlX2dvX2RvY3N0cmluZyhzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9kb2MqICAgIHRkb2MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciogc3ViaGVhZGVyKTsKLQotICAgIHZvaWQgZ2VuZXJhdGVfZ29fZG9jc3RyaW5nKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2RvYyogdGRvYyk7Ci0KLSAgICAvKioKLSAgICAgKiBIZWxwZXIgcmVuZGVyaW5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nQiICYmIHZhbHVlMiAhPSAiaW50ZXJmYWNlIikgewotICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwotICAgICAgICB9Ci0KLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlICdtJzoKLSAgICBjYXNlICdNJzoKLSAgICAgICAgaWYgKHZhbHVlMiAhPSAibWFwIikgewotICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwotICAgICAgICB9Ci0KLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlICdwJzoKLSAgICBjYXNlICdQJzoKLSAgICAgICAgaWYgKHZhbHVlMiAhPSAicGFja2FnZSIpIHsKLSAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIGJyZWFrOwotCi0gICAgY2FzZSAncic6Ci0gICAgY2FzZSAnUic6Ci0gICAgICAgIGlmICh2YWx1ZTIgIT0gInJhbmdlIiAmJiB2YWx1ZTIgIT0gInJldHVybiIpIHsKLSAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIGJyZWFrOwotCi0gICAgY2FzZSAncyc6Ci0gICAgY2FzZSAnUyc6Ci0gICAgICAgIGlmICh2YWx1ZTIgIT0gInNlbGVjdCIgJiYgdmFsdWUyICE9ICJzdHJ1Y3QiICYmIHZhbHVlMiAhPSAic3dpdGNoIikgewotICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwotICAgICAgICB9Ci0KLSAgICAgICAgYnJlYWs7Ci0KLSAgICBjYXNlICd0JzoKLSAgICBjYXNlICdUJzoKLSAgICAgICAgaWYgKHZhbHVlMiAhPSAidHlwZSIpIHsKLSAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIGJyZWFrOwotCi0gICAgY2FzZSAndic6Ci0gICAgY2FzZSAnVic6Ci0gICAgICAgIGlmICh2YWx1ZTIgIT0gInZhciIpIHsKLSAgICAgICAgICAgIHJldHVybiB2YWx1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FtZSA8PCAiLCBuaWwgIiA8PCBlbmRsOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgZnJvbV9zdHJpbmdfbWFwcGluZyA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBjYXNlIFwiIiA8PCB0ZW51bV9uYW1lIDw8ICJfIiA8PCBpdGVyX3N0ZF9uYW1lIDw8ICJcIjogcmV0dXJuICIgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVudW1fbmFtZSA8PCAiXyIgPDwgaXRlcl9uYW1lIDw8ICIsIG5pbCAiICA8PCBlbmRsOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgdG9fc3RyaW5nX21hcHBpbmcgPDwKLSAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICB9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIFwiPFVOU0VUPlwiIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7Ci0gICAgZnJvbV9zdHJpbmdfbWFwcGluZyA8PAotICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgfSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuICIgPDwgdGVudW1fbmFtZSA8PCAiKG1hdGguTWluSW50MzIgLSAxKSwiIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAiIGZtdC5FcnJvcmYoXCJub3QgYSB2YWxpZCAiIDw8IHRlbnVtX25hbWUgPDwgIiBzdHJpbmdcIikiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOwotCi0gICAgZl90eXBlc18gPDwgIikiIDw8IGVuZGwgPDwgZW5kbAotICA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KCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChmaWVsZF90eXBlLT5pc19iYXNlX3R5cGUoKSB8fCBmaWVsZF90eXBlLT5pc19lbnVtKCkpIHsKLSAgICAgICAgICAgICAgICBvdXQgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCBwdWJsaWNpemUodl9pdGVyLT5maXJzdC0+Z2V0X3N0cmluZygpKSA8PCAiOiAiIDw8IHJlbmRlcl9jb25zdF92YWx1ZShmaWVsZF90eXBlLCB2X2l0ZXItPnNlY29uZCwgbmFtZSkgPDwgIiwiOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzdHJpbmcgayh0bXAoImsiKSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nIHYodG1wKCJ2IikpOwotICAgICAgICAgICAgICAgIG91dCA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IHYgPDwgIiA6PSAiIDw8IHJlbmRlcl9jb25zdF92YWx1ZShmaWVsZF90eXBlLCB2X2l0ZXItPnNlY29uZCwgdikgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCBuYW1lIDw8ICIuIiA8PCBwdWJsaWNpemUodl9pdGVyLT5maXJzdC0+Z2V0X3N0cmluZygpKSA8PCAiID0gIiA8PCB2OwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgb3V0IDw8ICJ9IjsKLQotICAgICAgICBpbmRlbnRfZG93bigpOwotICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfbWFwKCkpIHsKLSAgICAgICAgdF90eXBlKiBrdHlwZSA9ICgodF9tYXAqKXR5cGUpLT5nZXRfa2V5X3R5cGUoKTsKLSAgICAgICAgdF90eXBlKiB2dHlwZSA9ICgodF9tYXAqKXR5cGUpLT5nZXRfdmFsX3R5cGUoKTsKLSAgICAgICAgY29uc3QgbWFwP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gIGluZGVudChvdXQpIDw8IHB1YmxpY2l6ZSh2YXJpYWJsZV9uYW1lX3RvX2dvX25hbWUoKCptX2l0ZXIpLT5nZXRfbmFtZSgpKSkgPDwgIiAiCi0gICAgICAgICAgICAgICAgICAgICAgICA8PCBnb1R5cGUgPDwgIiBgdGhyaWZ0OlwiIgotICAgICAgICAgICAgICAgICAgICAgICAgPDwgZXNjYXBlX3N0cmluZygoKm1faXRlciktPmdldF9uYW1lKCkpCi0gICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCIgPDwgc29ydGVkX2tleXNfcG9zOwotCi0gICAgICAgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9SRVFVSVJFRCkgewotICAgICAgICAgICAgICAgIG91dCA8PCAiLHJlcXVpcmVkIjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgb3V0IDw8ICJcImAiIDw8IGVuZGw7Ci0gICAgICAgICAgICBzb3J0ZWRfa2V5c19wb3MgKys7Ci0gICAgICAgIH0KLSAgICB9IGVsc2UgewotICAgICAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7Ci0gICAgICAgICAgICAvLyBUaGlzIGZpbGxzIGluIGRlZmF1bHQgdmFsdWVzLCBhcyBvcHBvc2VkIHRvIG51bGxzCi0gICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCBwdWJsaWNpemUoKCptX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiICIgPDwKLSAgICAgICAgICAgICAgICB0eXBlX3RvX2dvX3R5cGUoKCptX2l0ZXIpLT5nZXRfdHlwZSgpKSA8PCBlbmRsOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgaW5kZW50X2Rvd24oKTsKLSAgICBvdXQgPDwKLSAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGV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hc2VfdHlwZTo6VFlQRV9JNjQ6Ci0gICAgICAgICAgICAgICAgICAgIGlfY2hlY2tfdmFsdWUgPSAoZmllbGRfZGVmYXVsdF92YWx1ZSA9PSBOVUxMKSA/IDAgOiBmaWVsZF9kZWZhdWx0X3ZhbHVlLT5nZXRfaW50ZWdlcigpOwotICAgICAgICAgICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJyZXR1cm4gcC4iIDw8IGZpZWxkX25hbWUgPDwgIiAhPSAiIDw8IGlfY2hlY2tfdmFsdWUgPDwgZW5kbDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKLSAgICAgICAgICAgICAgICAgICAgZF9jaGVja192YWx1ZSA9IChmaWVsZF9kZWZhdWx0X3ZhbHVlID09IE5VTEwpID8gMC4wIDogZmllbGRfZGVmYXVsdF92YWx1ZS0+Z2V0X2RvdWJsZSgpOwotICAgICAgICAgICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJyZXR1cm4gcC4iIDw8IGZpZWxkX25hbWUgPDwgIiAhPSAiIDw8IGRfY2hlY2tfdmFsdWUgPDwgZW5kbDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IG5vIGNvbnN0IG9mIGJhc2UgdHlwZSAiICsgdF9iYXNlX3R5cGU6OnRfYmFzZV9uYW1lKHRiYXNlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkgewotICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIGludDY0KHAuIiA8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l9pdGVyOwotCi0gICAgICAgIGZvciAoZnJfaXRlciA9IGZpZWxkcy5yYmVnaW4oKTsgZnJfaXRlciAhPSBmaWVsZHMucmVuZCgpOyArK2ZyX2l0ZXIpIHsKLSAgICAgICAgICAgIHN0cmluZyBmaWVsZF9tZXRob2RfcHJlZml4KCJ3cml0ZUZpZWxkIik7Ci0gICAgICAgICAgICBmaWVsZF9uYW1lID0gKCpmcl9pdGVyKS0+Z2V0X25hbWUoKTsKLSAgICAgICAgICAgIGZpZWxkX2lkID0gKCpmcl9pdGVyKS0+Z2V0X2tleSgpOwotCi0gICAgICAgICAgICBpZiAoZmllbGRfaWQgPCAwKSB7Ci0gICAgICAgICAgICAgICAgZmllbGRfbWV0aG9kX3ByZWZpeCArPSAiXyI7Ci0gICAgICAgICAgICAgICAgZmllbGRfaWQgKj0gLTE7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChjYW5fYmVfbmlsKCgqZnJfaXRlciktPmdldF90eXBlKCkpICYmIGZpZWxkX2lkICE9IDApIHsKLSAgICAgICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImNhc2UgcC4iIDw8IHB1YmxpY2l6ZSh2YXJpYWJsZV9uYW1lX3RvX2dvX25hbWUoZmllbGRfbmFtZSkpIDw8ICIgIT0gbmlsOiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBpZiBlcnIgOj0gcC4iIDw8IGZpZWxkX21ldGhvZF9wcmVmaXggPDwgZmllbGRfaWQgPDwgIihvcHJvdCk7IGVyciAhPSBuaWwgeyByZXR1cm4gZXJyIH0iIDw8IGVuZGw7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG91dCA8PAotICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiZGVmYXVsdDoiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgaW5kZ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ZWQgPT0gdF9maWVsZDo6VF9PUFRJT05BTCB8fCAoKmZfaXRlciktPmdldF90eXBlKCktPmlzX2VudW0oKSkgewotICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKLSAgICAgICAgICAgIG91dCA8PAotICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGZpZWxkX2Nhbl9iZV9uaWwpIHsKLSAgICAgICAgICAgIGluZGVudF9kb3duKCk7Ci0gICAgICAgICAgICBvdXQgPDwKLSAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKLSAgICAgICAgfQotCi0gICAgICAgIGluZGVudF9kb3duKCk7Ci0gICAgICAgIG91dCA8PAotICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIGVyciIgPDwgZW5kbCA8PAotICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKLSAgICB9Ci19Ci0KLS8qKgotICogR2VuZXJhdGVzIGEgdGhyaWZ0IHNlcnZpY2UuCi0gKgotICogQHBhcmFtIHRzZXJ2aWNlIFRoZSBzZXJ2aWNlIGRlZmluaXRpb24KLSAqLwotdm9pZCB0X2dvX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VydmljZSh0X3NlcnZpY2UqIHRzZXJ2aWNlKQotewotICAgIHN0cmluZyBmX3NlcnZpY2VfbmFtZSA9IHBhY2thZ2VfZGlyXyArICIvIiArIHVuZGVyc2NvcmUoc2VydmljZV9uYW1lXykgKyAiLmdvIjsKLSAgICBmX3NlcnZpY2VfLm9wZW4oZl9zZXJ2aWNlX25hbWUuY19zdHIoKSk7Ci0gICAgZl9zZXJ2aWNlXyA8PAotICAgICAgICAgICAgICAgZ29fYXV0b2dlbl9jb21tZW50KCkgPDwKLSAgICAgICAgICAgICAgIGdvX3BhY2thZ2UoKSA8PAotICAgICAgICAgICAgICAgcmVu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wgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJQcm90b2NvbEZhY3Rvcnk6IGYsIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIklucHV0UHJvdG9jb2w6IGYuR2V0UHJvdG9jb2wodCksIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIk91dHB1dFByb3RvY29sOiBmLkdldFByb3RvY29sKHQpLCIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJTZXFJZDogMCwiIDw8IGVuZGwgLyo8PAotICAgICAgaW5kZW50KCkgPDwgIlJlcXM6IG1ha2UobWFwW2ludDMyXURlZmVycmVkKSIgPDwgZW5kbCovOwotICAgICAgICBpbmRlbnRfZG93bigpOwotICAgICAgICBmX3NlcnZpY2VfIDw8Ci0gICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7Ci0gICAgfQotCi0gICAgaW5kZW50X2Rvd24oKTsKLSAgICBmX3NlcnZpY2VfIDw8Ci0gICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOwotICAgIC8vIENvbnN0cnVjdG9yIGZ1bmN0aW9uCi0gICAgZl9zZXJ2aWNlXyA8PAotICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImZ1bmMgTmV3IiA8PCBzZXJ2aWNlTmFtZSA8PCAiQ2xpZW50UHJvdG9jb2wodCB0aHJpZnQuVFRyYW5zcG9ydCwgaXByb3QgdGhyaWZ0LlRQcm90b2NvbCwgb3Byb3QgdGhyaWZ0LlRQcm90b2NvbCkgKiIgPDwgc2VydmljZU5hbWUgPDwgIkNsaWVudCB7IiA8PCBlbmRsOwotICAgIGluZGVudF91cCgpOwotICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJyZXR1cm4gJ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c19vbmV3YXkoKSkgewotICAgICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgIGluZGVudCgpIDw8ICJkIDo9IGRlZmVyLkRlZmVycmVkKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgIGluZGVudCgpIDw8ICJwLlJlcXNbcC5TZXFJZF0gPSBkIiA8PCBlbmRsOwotICAgICAgICB9Ci0gICAgICAgICovCi0gICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiaWYgZXJyID0gcC5zZW5kIiA8PCBmdW5uYW1lIDw8ICIoIjsKLSAgICAgICAgYm9vbCBmaXJzdCA9IHRydWU7Ci0KLSAgICAgICAgZm9yIChmbGRfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmbGRfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZmxkX2l0ZXIpIHsKLSAgICAgICAgICAgIGlmIChmaXJzdCkgewotICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGZfc2VydmljZV8gPDwgIiwgIjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgZl9zZXJ2aWNlXyA8PCB2YXJpYWJsZV9uYW1lX3RvX2dvX25hbWUoKCpmbGRfaXRlciktPmdldF9uYW1lKCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgZl9zZXJ2aWNlXyA8PCAiKTsgZXJyICE9IG5pbCB7IHJldHVybiB9IiA8PCBlbmRsOwotCi0gICAgICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgewotICAgICAgICAgICAgZl9zZXJ2aWNlXyA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAicmV0dXJuIHAucmVjdiIgPDwgZnVubmFtZSA8PCAiKCkiIDw8IGVuZGw7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBmX3NlcnZ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AgICBpbmRlbnQoKSA8PCAib3Byb3QuRmx1c2goKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJyZXR1cm4iIDw8IGVuZGw7Ci0gICAgICAgIGluZGVudF9kb3duKCk7Ci0gICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOwotCi0gICAgICAgIGlmICh0cnVlKSB7IC8vISgqZl9pdGVyKS0+aXNfb25ld2F5KCkgfHwgdHJ1ZSkge30KLSAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHJlc3VsdG5hbWUgPSBwdWJsaWNpemUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSArICJSZXN1bHQiOwotICAgICAgICAgICAgLy8gT3BlbiBmdW5jdGlvbgotICAgICAgICAgICAgZl9zZXJ2aWNlXyA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJmdW5jIChwICoiIDw8IHNlcnZpY2VOYW1lIDw8ICJDbGllbnQpIHJlY3YiIDw8IHB1YmxpY2l6ZSgoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICIoKSAoIjsKLQotICAgICAgICAgICAgaWYgKCEoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgewotICAgICAgICAgICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YWx1ZSAiIDw8IHR5cGVfdG9fZ29fdHlwZSgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCkpIDw8ICIsICI7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRfc3RydWN0KiBleGNlcHRpb25zID0gKCpmX2l0ZXIpLT5nZXRfeGNlcHRpb25zKCk7Ci0gICAgICAgICAgICBzdHJpbmcgZXJycyA9IGFyZ3VtZW50X2xpc3QoZXhjZXB0aW9ucyk7Ci0KLSAgICAgICAgICAgIGlmIChlcnJzLnNpemUoKSkgewotICAgICAgICAgICAgICAgIGZfc2VydmljZV8gPDwgZXJycyA8PCAiLCAiOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmX3NlcnZpY2VfIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICJlcnIgZXJyb3IpIHsiIDw8IGVuZGw7Ci0gICAgICAgICAgICBpbmRlbnRfdXAoKTsKLSAgICAgICAgICAgIC8vIFRPRE8obWNzbGVlKTogVmFsaWRhdGUgbWVzc2FnZSByZXBseSBoZXJlLCBzZXEgaWRzIGV0Yy4KLSAgICAgICAgICAgIHN0cmluZyByZXN1bHQodG1wKCJyZXN1bHQiKSk7Ci0gICAgICAgICAgICBzdHJpbmcgZXJyb3IodG1wKCJlcnJvciIpKTsKLSAgICAgICAgICAgIHN0cmluZyBlcnJvcjIodG1wKCJlcnJvciIpKTsKLSAgICAgICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlwcm90IDo9IHAuSW5wdXRQcm90b2NvbCIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiaWYgaXByb3QgPT0gbmlsIHsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgaXByb3QgPSBwLlByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChwLlRyYW5zcG9ydCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcC5JbnB1dFByb3RvY29sID0gaXByb3QiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIl8sIG1UeXBlSWQsIHNlcUlkLCBlcnIgOj0gaXByb3QuUmVhZE1lc3NhZ2VCZWdpbigpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiBlcnIgIT0gbmlsIHsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiBtVHlwZUlkID09IHRocmlmdC5FWENFUFRJT04geyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAiIDw8IGVycm9yIDw8ICIgOj0gdGhyaWZ0Lk5ld1RBcHBsaWNhdGlvbkV4Y2VwdGlvbih0aHJpZnQuVU5LTk9XTl9BUFBMSUNBVElPTl9FWENFUFRJT04sIFwiVW5rbm93biBFeGNlcHRpb25cIikiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgdmFyICIgPDwgZXJyb3IyIDw8ICIgZXJyb3IiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgIiA8PCBlcnJvcjIgPDwgIiwgZXJyID0gIiA8PCBlcnJvciA8PCAiLlJlYWQoaXByb3QpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIGlmIGVyciAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgIHJldHVybiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICB9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIGlmIGVyciA9IGlwcm90LlJlYWRNZXNzYWdlRW5kKCk7IGVyciAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgIHJldHVybiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICB9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIGVyciA9ICIgPDwgZXJyb3IyIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiBwLlNlcUlkICE9IHNlcUlkIHsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgZXJyID0gdGhyaWZ0Lk5ld1RBcHBsaWNhdGlvbkV4Y2VwdGlvbih0aHJpZnQuQkFEX1NFUVVFTkNFX0lELCBcInBpbmcgZmFpbGVkOiBvdXQgb2Ygc2VxdWVuY2UgcmVzcG9uc2VcIikiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IHJlc3VsdCA8PCAiIDo9IE5ldyIgPDwgcHVibGljaXplKHJlc3VsdG5hbWUpIDw8ICIoKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiZ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PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgImltcG9ydCAoIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgICAgICAgXCJmbGFnXCIiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgICAgICBcImZtdFwiIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgICAgICAgXCJtYXRoXCIiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgICAgICBcIm5ldFwiIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgICAgICAgXCJuZXQvdXJsXCIiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgICAgICBcIm9zXCIiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAgICAgICBcInN0cmNvbnZcIiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgICAgICAgIFwic3RyaW5nc1wiIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgICAgICAgXCIiICsgZ2VuX3RocmlmdF9pbXBvcnRfICsgIlwiIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgICAgICAgXCIiIDw8IHNlcnZpY2VfbW9kdWxlIDw8ICJcIiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgIGluZGVudCgpIDw8ICIpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgZW5kbCA8PAotICAgICAgICAgICAgIGluZGVudCgpIDw8ICJmdW5jIFVzYWdlKCkgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIGZtdC5GcHJpbnRsbihvcy5TdGRlcnIs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AgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1fYXJnczsgKytpKSB7Ci0gICAgICAgICAgICBpbnQgZmxhZ0FyZyA9IGkgKyAxOwotICAgICAgICAgICAgdF90eXBlKiB0aGVfdHlwZShhcmdzW2ldLT5nZXRfdHlwZSgpKTsKLSAgICAgICAgICAgIHRfdHlwZSogdGhlX3R5cGUyKGdldF90cnVlX3R5cGUodGhlX3R5cGUpKTsKLQotICAgICAgICAgICAgaWYgKHRoZV90eXBlMi0+aXNfZW51bSgpKSB7Ci0gICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAidG1wIiA8PCBpIDw8ICIsIGVyciA6PSAoc3RyY29udi5BdG9pKGZsYWcuQXJnKCIgPDwgZmxhZ0FyZyA8PCAiKSkpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmIGVyciAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiIHJldHVybiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImFyZ3ZhbHVlIiA8PCBpIDw8ICIgOj0gIiA8PCBwYWNrYWdlX25hbWVfIDw8ICIuIiA8PCBwdWJsaWNpemUodGhlX3R5cGUtPmdldF9uYW1lKCkpIDw8ICIodG1wIiA8PCBpIDw8ICIpIiA8PCBlbmRsOwotICAgICAgICAgICAgfSBlbHNlIGlmICh0aGVfdHlwZTItPmlzX2Jhc2VfdHlwZSgpKSB7Ci0gICAgICAgICAgICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSBlID0gKCh0X2Jhc2VfdHlwZSopdGhlX3R5cGUyKS0+Z2V0X2Jhc2UoKTsKLSAgICAgICAgICAgICAgICBzdHJpbmcgZXJyKHRtcCgiZXJyIikpOwotCi0gICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7Ci0gICAgICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9WT0lEOgotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgotICAgICAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiYXJndmFsdWUiIDw8IGkgPDwgIiA6PSBmbGFnLkFyZygiIDw8IGZsYWdBcmcgPDwgIikiIDw8IGVuZGw7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgotICAgICAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiYXJndmFsdWUiIDw8IGkgPDwgIiA6PSBmbGFnLkFyZygiIDw8IGZsYWdBcmcgPDwgIikgPT0gXCJ0cnVlXCIiIDw8IGVuZGw7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CWVRFOgotICAgICAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAidG1wIiA8PCBpIDw8ICIsICIgPDwgZXJyIDw8ICIgOj0gKHN0cmNvbnYuQXRvaShmbGFnLkFyZygiIDw8IGZsYWdBcmcgPDwgIikpKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiaWYgIiA8PCBlcnIgPDwgIiAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBVc2FnZSgpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIHJldHVybiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiYXJndmFsdWUiIDw8IGkgPDwgIiA6PSBieXRlKHRtcCIgPDwgaSA8PCAiKSIgPDwgZW5kbDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKLSAgICAgICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgInRtcCIgPDwgaSA8PCAiLCAiIDw8IGVyciA8PCAiIDo9IChzdHJjb252LkF0b2koZmxhZy5BcmcoIiA8PCBmbGFnQXJnIDw8ICIpKSkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmICIgPDwgZXJyIDw8ICIgIT0gbmlsIHsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgVXNhZ2UoKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImFyZ3ZhbHVlIiA8PCBpIDw8ICIgOj0gYnl0ZSh0bXAiIDw8IGkgPDwgIikiIDw8IGVuZGw7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6Ci0gICAgICAgICAgICAgICAgICAgIGZfcmVtb3RlIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ0bXAiIDw8IGkgPDwgIiwgIiA8PCBlcnIgPDwgIiA6PSAoc3RyY29udi5BdG9pKGZsYWcuQXJnKCIgPDwgZmxhZ0FyZyA8PCAiKSkpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiAiIDw8IGVyciA8PCAiICE9IG5pbCB7IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgcmV0dXJuIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJhcmd2YWx1ZSIgPDwgaSA8PCAiIDo9IGludDMyKHRtcCIgPDwgaSA8PCAiKSIgPDwgZW5kbDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKLSAgICAgICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImFyZ3ZhbHVlIiA8PCBpIDw8ICIsICIgPDwgZXJyIDw8ICIgOj0gKHN0cmNvbnYuUGFyc2VJbnQoZmxhZy5BcmcoIiA8PCBmbGFnQXJnIDw8ICIpLCAxMCwgNjQpKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiaWYgIiA8PCBlcnIgPDwgIiAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBVc2FnZSgpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIHJldHVybiIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKLSAgICAgICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImFyZ3ZhbHVlIiA8PCBpIDw8ICIsICIgPDwgZXJyIDw8ICIgOj0gKHN0cmNvbnYuUGFyc2VGbG9hdChmbGFnLkFyZygiIDw8IGZsYWdBcmcgPDwgIiksIDY0KSkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmICIgPDwgZXJyIDw8ICIgIT0gbmlsIHsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgVXNhZ2UoKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgKCJJbnZhbGlkIGJhc2UgdHlwZSBpbiBnZW5lcmF0ZV9zZXJ2aWNlX3JlbW90ZSIpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIC8vZl9yZW1vdGUgPDwgcHVibGljaXplKGFyZ3NbaV0tPmdldF9uYW1lKCkpIDw8ICIoc3RyY29udi5BdG9pKGZsYWcuQXJnKCIgPDwgZmxhZ0FyZyA8PCAiKSkpIjsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodGhlX3R5cGUyLT5pc19zdHJ1Y3QoKSkgewotICAgICAgICAgICAgICAgIHN0cmluZyBhcmcodG1wKCJhcmciKSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nIG1iVHJhbnModG1wKCJtYlRyYW5zIikpOwotICAgICAgICAgICAgICAgIHN0cmluZyBlcnIxKHRtcCgiZXJyIikpOwotICAgICAgICAgICAgICAgIHN0cmluZyBmYWN0b3J5KHRtcCgiZmFjdG9yeSIpKTsKLSAgICAgICAgICAgICAgICBzdHJpbmcganNQcm90KHRtcCgianNQcm90IikpOwotICAgICAgICAgICAgICAgIHN0cmluZyBlcnIyKHRtcCgiZXJyIikpOwotICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHRzdHJ1Y3RfbmFtZShwdWJsaWNpemUodGhlX3R5cGUtPmdldF9uYW1lKCkpKTsKLSAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IGFyZyA8PCAiIDo9IGZsYWcuQXJnKCIgPDwgZmxhZ0FyZyA8PCAiKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IG1iVHJ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iA8PCB0c3RydWN0X25hbWUgPDwgIigpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgZXJyMiA8PCAiIDo9IGFyZ3ZhbHVlIiA8PCBpIDw8ICIuUmVhZCgiIDw8IGpzUHJvdCA8PCAiKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiAiIDw8IGVycjIgPDwgIiAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodGhlX3R5cGUyLT5pc19jb250YWluZXIoKSB8fCB0aGVfdHlwZTItPmlzX3hjZXB0aW9uKCkpIHsKLSAgICAgICAgICAgICAgICBzdHJpbmcgYXJnKHRtcCgiYXJnIikpOwotICAgICAgICAgICAgICAgIHN0cmluZyBtYlRyYW5zKHRtcCgibWJUcmFucyIpKTsKLSAgICAgICAgICAgICAgICBzdHJpbmcgZXJyMSh0bXAoImVyciIpKTsKLSAgICAgICAgICAgICAgICBzdHJpbmcgZmFjdG9yeSh0bXAoImZhY3RvcnkiKSk7Ci0gICAgICAgICAgICAgICAgc3RyaW5nIGpzUHJvdCh0bXAoImpzUHJvdCIpKTsKLSAgICAgICAgICAgICAgICBzdHJpbmcgZXJyMih0bXAoImVyciIpKTsKLSAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBhcmdOYW1lKHB1YmxpY2l6ZShhcmdzW2ldLT5nZXRfbmFtZSgpKSk7Ci0gICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCBhcmcgPDwgIiA6PSBmbGFnLkFyZygiIDw8IGZsYWdBcmcgPDwgIikiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCBtYlRyYW5zIDw8ICIgOj0gdGhyaWZ0Lk5ld1RNZW1vcnlCdWZmZXJMZW4obGVuKCIgPDwgYXJnIDw8ICIpKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJkZWZlciAiIDw8IG1iVHJhbnMgPDwgIi5DbG9zZSgpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgIl8sICIgPDwgZXJyMSA8PCAiIDo9ICIgPDwgbWJUcmFucyA8PCAiLldyaXRlU3RyaW5nKCIgPDwgYXJnIDw8ICIpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmICIgPDwgZXJyMSA8PCAiICE9IG5pbCB7ICIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IGZhY3RvcnkgPDwgIiA6PSB0aHJpZnQuTmV3VFNpbXBsZUpTT05Qcm90b2NvbEZhY3RvcnkoKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IGpzUHJvdCA8PCAiIDo9ICIgPDwgZmFjdG9yeSA8PCAiLkdldFByb3RvY29sKCIgPDwgbWJUcmFucyA8PCAiKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJjb250YWluZXJTdHJ1Y3QiIDw8IGkgPDwgIiA6PSAiIDw8IHBhY2thZ2VfbmFtZV8gPDwgIi5OZXciIDw8IHB1Yk5hbWUgPDwgIkFyZ3MoKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8IGVycjIgPDwgIiA6PSBjb250YWluZXJTdHJ1Y3QiIDw8IGkgPDwgIi5SZWFkRmllbGQiIDw8IChpICsgMSkgPDwgIigiIDw8IGpzUHJvdCA8PCAiKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiAiIDw8IGVycjIgPDwgIiAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJhcmd2YWx1ZSIgPDwgaSA8PCAiIDo9IGNvbnRhaW5lclN0cnVjdCIgPDwgaSA8PCAiLiIgPDwgYXJnTmFtZSA8PCBlbmRsOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB0aHJvdyAoIkludmFsaWQgYXJndW1lbnQgdHlwZSBpbiBnZW5lcmF0ZV9zZXJ2aWNlX3JlbW90ZSIpOwotICAgICAgICAgICAgICAgIHN0cmluZyBlcnIxKHRtcCgiZXJyIikpOwotICAgICAgICAgICAgICAgIGZfcmVtb3RlIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImFyZ3ZhbHVlIiA8PCBpIDw8ICIsICIgPDwgZXJyMSA8PCAiIDo9IGV2YWwoZmxhZy5BcmcoIiA8PCBmbGFnQXJnIDw8ICIpKSIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJpZiAiIDw8IGVycjEgPDwgIiAhPSBuaWwgeyIgPDwgZW5kbCA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIFVzYWdlKCkiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm4iIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKHRoZV90eXBlLT5pc190eXBlZGVmKCkpIHsKLSAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ2YWx1ZSIgPDwgaSA8PCAiIDo9ICIgPDwgcGFja2FnZV9uYW1lXyA8PCAiLiIgPDwgcHVibGljaXplKHRoZV90eXBlLT5nZXRfbmFtZSgpKSA8PCAiKGFyZ3ZhbHVlIiA8PCBpIDw8ICIpIiA8PCBlbmRsOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ2YWx1ZSIgPDwgaSA8PCAiIDo9IGFyZ3ZhbHVlIiA8PCBpIDw8IGVuZGw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBmX3JlbW90ZSA8PAotICAgICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiZm10LlByaW50KGNsaWVudC4iIDw8IHB1Yk5hbWUgPDwgIigiOwotICAgICAgICBib29sIGFyZ0ZpcnN0ID0gdHJ1ZTsKLQotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bV9hcmdzOyArK2kpIHsKLSAgICAgICAgICAgIGlmIChhcmdGaXJzdCkgewotICAgICAgICAgICAgICAgIGFyZ0ZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGZfcmVtb3RlIDw8ICIsICI7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChhcmdzW2ldLT5nZXRfdHlwZSgpLT5pc19lbnVtKCkpIHsKLSAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PCAidmFsdWUiIDw8IGk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGFyZ3NbaV0tPmdldF90eXBlKCktPmlzX2Jhc2VfdHlwZSgpKSB7Ci0gICAgICAgICAgICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSBlID0gKCh0X2Jhc2VfdHlwZSopKGFyZ3NbaV0tPmdldF90eXBlKCkpKS0+Z2V0X2Jhc2UoKTsKLQotICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfVk9JRDoKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKLSAgICAgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6Ci0gICAgICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CWVRFOgotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgotICAgICAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgotICAgICAgICAgICAgICAgICAgICBmX3JlbW90ZSA8PCAidmFsdWUiIDw8IGk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgKCJJbnZhbGlkIGJhc2UgdHlwZSBpbiBnZW5lcmF0ZV9zZXJ2aWNlX3JlbW90ZSIpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIC8vZl9yZW1vdGUgPDwgcHVibGljaXplKGFyZ3NbaV0tPmdldF9uYW1lKCkpIDw8ICIoc3RyY29udi5BdG9pKGZsYWcuQXJnKCIgPDwgZmxhZ0FyZyA8PCAiKSkpIjsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZl9yZW1vdGUgPDwgInZhbHVlIiA8PCBpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgZl9yZW1vdGUgPDwKLSAgICAgICAgICAgICAgICAgIikpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJmbXQuUHJpbnQoXCJcXG5cIikiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImJyZWFrIiA8PCBlbmRsOwotICAgICAgICBpbmRlbnRfZG93bigpOwotICAgIH0KLQotICAgIGZfcmVtb3RlIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgImNhc2UgXCJcIjoiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBVc2FnZSgpIiA8PCBlbmRsIDw8Ci0gICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgYnJlYWsiIDw8IGVuZGwgPDwKLSAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiZGVmYXVsdDoiIDw8IGVuZGwgPDwK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mFzZV90eXBlKil0eXBlKS0+aXNfYmluYXJ5KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkQmluYXJ5KCkiOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG91dCA8PCAiUmVhZFN0cmluZygpIjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgotICAgICAgICAgICAgICAgIG91dCA8PCAiUmVhZEJvb2woKSI7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQllURToKLSAgICAgICAgICAgICAgICBvdXQgPDwgIlJlYWRCeXRlKCkiOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKLSAgICAgICAgICAgICAgICBvdXQgPDwgIlJlYWRJMTYoKSI7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgotICAgICAgICAgICAgICAgIG91dCA8PCAiUmVhZEkzMigpIjsKLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6Ci0gICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkSTY0KCkiOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKLSAgICAgICAgICAgICAgICBvdXQgPDwgIlJlYWREb3VibGUoKSI7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgdGh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HN0cmluZyBuYW1lKHByZWZpeCArIHB1YmxpY2l6ZSh2YXJpYWJsZV9uYW1lX3RvX2dvX25hbWUodGZpZWxkLT5nZXRfbmFtZSgpKSkpOwotCi0gICAgLy8gRG8gbm90aGluZyBmb3Igdm9pZCB0eXBlcwotICAgIGlmICh0eXBlLT5pc192b2lkKCkpIHsKLSAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBjYW5ub3QgZ2VuZXJhdGUgc2VyaWFsaXplIGZvciB2b2lkIHR5cGU6ICIgKyBuYW1lOwotICAgIH0KLQotICAgIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7Ci0gICAgICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qob3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0X3N0cnVjdCopdHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lKTsKLSAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX2NvbnRhaW5lcigpKSB7Ci0gICAgICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIob3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gICAgfSBlbHNlIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSB8fCB0eXBlLT5pc19lbnVtKCkpIHsKLSAgICAgICAgaW5kZW50KG91dCkgPDwKLSAgICAgICAgICAgICAgICAgICAgImlmIGVyciA6PSBvcHJvdC4iOwotCi0gICAgICAgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSkgewotICAgICAgICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOwotCi0gICAgICAgICAgICBzd2l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gewotICAgICAgICBpZiAoaGFzX2RvYykgewotICAgICAgICAgICAgc3MgPDwgZW5kbDsKLSAgICAgICAgfQotCi0gICAgICAgIGhhc19kb2MgPSB0cnVlOwotICAgICAgICBzcyA8PCBzdWJoZWFkZXIgPDwgIjpcbiI7Ci0gICAgICAgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIHBfaXRlcjsKLQotICAgICAgICBmb3IgKHBfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBwX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK3BfaXRlcikgewotICAgICAgICAgICAgdF9maWVsZCogcCA9ICpwX2l0ZXI7Ci0gICAgICAgICAgICBzcyA8PCAiIC0gIiA8PCBwdWJsaWNpemUodmFyaWFibGVfbmFtZV90b19nb19uYW1lKHAtPmdldF9uYW1lKCkpKTsKLQotICAgICAgICAgICAgaWYgKHAtPmhhc19kb2MoKSkgewotICAgICAgICAgICAgICAgIHNzIDw8ICI6ICIgPDwgcC0+Z2V0X2RvYygpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzcyA8PCBlbmRsOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgaWYgKGhhc19kb2MpIHsKLSAgICAgICAgZ2VuZXJhdGVfZG9jc3RyaW5nX2NvbW1lbnQob3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIi8vICIsIHNzLnN0cigpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIik7Ci0gICAgfQotfQotCi0vKioKLSAqIEdlbmVyYXRlcyB0aGUgZG9jc3RyaW5nIGZvciBhIGdlbmVyaWMgb2JqZWN0LgotICovCi12b2lkIHRfZ29fZ2VuZXJhdG9yOjpnZW5lcmF0ZV9nb19kb2NzdHJpbmcob2ZzdHJlYW0mIG91dCwKLSAgICAgICAg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UklORzoKLSAgICAgICAgICAgIGlmICgoKHRfYmFzZV90eXBlKil0eXBlKS0+aXNfYmluYXJ5KCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gInRocmlmdC5CSU5BUlkiOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZXR1cm4gInRocmlmdC5TVFJJTkciOwotCi0gICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKLSAgICAgICAgICAgIHJldHVybiAidGhyaWZ0LkJPT0wiOwotCi0gICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQllURToKLSAgICAgICAgICAgIHJldHVybiAidGhyaWZ0LkJZVEUiOwotCi0gICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgotICAgICAgICAgICAgcmV0dXJuICJ0aHJpZnQuSTE2IjsKLQotICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKLSAgICAgICAgICAgIHJldHVybiAidGhyaWZ0LkkzMiI7Ci0KLSAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6Ci0gICAgICAgICAgICByZXR1cm4gInRocmlmdC5JNjQiOwotCi0gICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgotICAgICAgICAgICAgcmV0dXJuICJ0aHJpZnQuRE9VQkxFIjsKLSAgICAgICAgfQotICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7Ci0gICAgICAgIHJldHVybiAidGhyaWZ0LkkzMiI7Ci0gICAgfSBlbHNlIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7Ci0gICAgICAgIHJldHVybiAidGhyaWZ0LlNUUlVDVCI7Ci0gICAgfSBlbHNlIGlmICh0eXBlLT5pc19tYXAoKSkgewotICAgICAgICByZXR1cm4gInRocmlmdC5NQVAiOwotICAgIH0gZWxzZS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tKCkpIHsKLSAgICAgICAgcmV0dXJuICJuaWwiOwotICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR0eXBlLT5pc194Y2VwdGlvbigpKSB7Ci0gICAgICAgIHJldHVybiAiKCIgKyB0eXBlX25hbWUodHR5cGUpICsgIiwgIiArIHR5cGVfbmFtZSh0dHlwZSkgKyAiLnRocmlmdF9zcGVjKSI7Ci0gICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKLSAgICAgICAgcmV0dXJuICIoIiArCi0gICAgICAgICAgICAgICB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgKyAiLCIgKwotICAgICAgICAgICAgICAgdHlwZV90b19zcGVjX2FyZ3MoKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgKyAiLCIgKwotICAgICAgICAgICAgICAgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X3ZhbF90eXBlKCkpICsgIiwiICsKLSAgICAgICAgICAgICAgIHR5cGVfdG9fc3BlY19hcmdzKCgodF9tYXAqKXR0eXBlKS0+Z2V0X3ZhbF90eXBlKCkpICsKLSAgICAgICAgICAgICAgICIpIjsKLSAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgewotICAgICAgICByZXR1cm4gIigiICsKLSAgICAgICAgICAgICAgIHR5cGVfdG9fZW51bSgoKHRfc2V0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKSkgKyAiLCIgKwotICAgICAgICAgICAgICAgdHlwZV90b19zcGVjX2FyZ3MoKCh0X3NldCopdHR5cGUpLT5nZXRfZWxlbV90eXBlKCkpICsKLSAgICAgICAgICAgICAgICIpIjsKLSAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICAgICAgcmV0dXJuICIoIiArCi0gICAgICAgICAgICAgICB0eXBlX3RvX2VudW0oKCh0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mVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudCAgKG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCk7Ci0KLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCAob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4ID0gIiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfdHlwZSAgICAgICAgICAob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkICAgICAgICAgIChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUgPSAiIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0ICAgICAgICAgKG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXggPSAiIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCA9ICIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHZpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudCAgICAob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGl0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudCAgIChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyKTsKLQotICAvKioKLSAgICogSGVscGVyIHJlbmRlcmluZyBmdW5jdGlvbnMKLSAgICovCi0KLSAgc3RyaW5nIGhzX2F1dG9nZW5fY29tbWVudCgpOwotICBzdHJpbmcgaHNfbGFuZ3VhZ2VfcHJhZ21hKCk7Ci0gIHN0cmluZyBoc19pbXBvcnRzKCk7Ci0KLSAgc3RyaW5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HVUFHRSBPdmVybG9hZGVkU3RyaW5ncyAjLX1cbiIKLSAgICAgICAgICAgICAgICAiey0jIE9QVElPTlNfR0hDIC1mbm8td2Fybi1taXNzaW5nLWZpZWxkcyAjLX1cbiIKLSAgICAgICAgICAgICAgICAiey0jIE9QVElPTlNfR0hDIC1mbm8td2Fybi1taXNzaW5nLXNpZ25hdHVyZXMgIy19XG4iCi0gICAgICAgICAgICAgICAgInstIyBPUFRJT05TX0dIQyAtZm5vLXdhcm4tbmFtZS1zaGFkb3dpbmcgIy19XG4iCi0gICAgICAgICAgICAgICAgInstIyBPUFRJT05TX0dIQyAtZm5vLXdhcm4tdW51c2VkLWltcG9ydHMgIy19XG4iCi0gICAgICAgICAgICAgICAgInstIyBPUFRJT05TX0dIQyAtZm5vLXdhcm4tdW51c2VkLW1hdGNoZXMgIy19XG4iKTsKLX0KLQotLyoqCi0gKiBBdXRvZ2VuJ2QgY29tbWVudAotICovCi1zdHJpbmcgdF9oc19nZW5lcmF0b3I6OmhzX2F1dG9nZW5fY29tbWVudCgpIHsKLSAgcmV0dXJuIHN0cmluZygiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiIpICsKLSAgICAgICAgICAgICAgICAiLS0gQXV0b2dlbmVyYXRlZCBieSBUaHJpZnQgQ29tcGlsZXIgKCIgKyBUSFJJRlRfVkVSU0lPTiArICIpICAgICAgICAgICAgICAgICAgICAgIC0tXG4iICsKLSAgICAgICAgICAgICAgICAiLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLS1cbiIgKwotICAgICAgICAgICAgICAgICItLSBETyBOT1QgRURJVCBVTkxFU1MgWU9VIEFSRSBTVVJFIFlPVSBLTk9XIFdIQVQgWU9VIEFSRSBET0lORyAtLVxuIiArCi0gICAgICAgICAgICAgICAgIi0tLS0tLS0tLS0tLS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YgYSBtYXAuCi0gKgotICovCi12b2lkIHRfaHNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHZpdGVyKSB7Ci0gIHRfZmllbGQga2ZpZWxkKHRtYXAtPmdldF9rZXlfdHlwZSgpLCBraXRlcik7Ci0gIG91dCA8PCAiZG8geyI7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQpOwotICBvdXQgPDwgIjsiOwotCi0gIHRfZmllbGQgdmZpZWxkKHRtYXAtPmdldF92YWxfdHlwZSgpLCB2aXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZ2ZmllbGQpOwotICBvdXQgPDwgIn0iOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBzZXQuCi0gKi8KLXZvaWQgdF9oc19nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyKSB7Ci0gIHRfZmllbGQgZWZpZWxkKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsIC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jb250cm9sIGNvZGU/Ci0gICAgaWYoICgwIDw9IGljKSAmJiAoMzEgPj0gaWMpKQotICAgIHsKLSAgICAgIHN3aXRjaCggYykKLSAgICAgIHsKLSAgICAgICAgY2FzZSAnXHInIDogIAotICAgICAgICBjYXNlICdcbicgOiAgCi0gICAgICAgICAgcmVzdWx0IDw8ICI8YnIvPiI7ICAKLSAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSAnXHQnIDoKLSAgICAgICAgICByZXN1bHQgPDwgIiAiOyAgCi0gICAgICAgICAgYnJlYWs7Ci0gICAgICB9Ci0gICAgICArK2ZpcnN0cG9zOwotICAgICAgY29udGludWU7ICAgICAgICAKLSAgICB9Ci0gICAgCi0gICAgLy8gcmVhY2hlZCB0aGUgZW5kPwotICAgIGlmKCBmaXJzdHBvcyA+PSBzdHIubGVuZ3RoKCkpIHsKLSAgICAgIGJyZWFrOwotICAgIH0KLQotICAgIC8vIHRyeSB0byBkZXRlY3QgaW5wdXQgZW5jb2RpbmcKLSAgICBpZiggaW5wdXRfdHlwZV8gPT0gSU5QVVRfVU5LTk9XTikgewotICAgICAgZGV0ZWN0X2lucHV0X2VuY29kaW5nKHN0cixmaXJzdHBvcyk7Ci0gICAgICBpZiggaW5wdXRfdHlwZV8gPT0gSU5QVVRfVVRGOCkgewotICAgICAgICBsYXN0cG9zID0gc3RyLmxlbmd0aCgpOwotICAgICAgICByZXN1bHQgPDwgc3RyLnN1YnN0ciggZmlyc3Rwb3MsIGxhc3Rwb3MtZmlyc3Rwb3MpOwotICAgICAgICBicmVhazsKLSAgICAgIH0KLSAgICB9Ci0gICAgCi0gICAgLy8gY29udmVydCB0aGUgY2hhcmFjdGVyIHRvIHNvbWV0aGluZyB1c2VmdWwgYmFzZWQgb24gdGhlIGRldGVjdGVkIGVuY29kaW5nCi0gICAgc3dpdGNoKCBpbnB1dF90eXBlXykgewotICAgICAgY2FzZSBJTlBVVF9QTEFJTjogCi0gICAgICAgIHJlc3VsdCA8PCAiJiM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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiAgIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudCAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEgPSB0cnVlKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkICAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdCAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEgPSB0cnVlKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEgPSB0cnVlKTsKLQotICB2b2lkIGdlbmVyYXRlX2phdmFfZG9jICAgICAgICAgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgZmllbGQpOwotCi0gIHZvaWQgZ2VuZXJhdGVfamF2YV9kb2MgICAgICAgICAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2RvYyogICAgICB0ZG9jKTsKLQotICB2b2lkIGdlbmVyYXRlX2phdmFfZG9jICAgICAgICAgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGRvYyk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9qYXZhX2RvY3N0cmluZ19jb21tZW50ICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjb250ZW50cyk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZWVwX2NvcHlfY29udGFpbmVyKHN0ZDo6b2ZzdHJl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luZGVudChvdXQpIDw8ICIgIHJldHVybiAwOyIgPDwgZW5kbDsKLSAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKLSAgfQotfQotCi0vKioKLSAqIEphdmEgc3RydWN0IGRlZmluaXRpb24uIFRoaXMgaGFzIHZhcmlvdXMgcGFyYW1ldGVycywgYXMgaXQgY291bGQgYmUKLSAqIGdlbmVyYXRlZCBzdGFuZGFsb25lIG9yIGluc2lkZSBhbm90aGVyIGNsYXNzIGFzIGEgaGVscGVyLiBJZiBpdAotICogaXMgYSBoZWxwZXIgdGhhbiBpdCBpcyBhIHN0YXRpYyBjbGFzcy4KLSAqCi0gKiBAcGFyYW0gdHN0cnVjdCAgICAgIFRoZSBzdHJ1Y3QgZGVmaW5pdGlvbgotICogQHBhcmFtIGlzX2V4Y2VwdGlvbiBJcyB0aGlzIGFuIGV4Y2VwdGlvbj8KLSAqIEBwYXJhbSBpbl9jbGFzcyAgICAgSWYgaW5zaWRlIGEgY2xhc3MsIG5lZWRzIHRvIGJlIHN0YXRpYyBjbGFzcwotICogQHBhcmFtIGlzX3Jlc3VsdCAgICBJZiB0aGlzIGlzIGEgcmVzdWx0IGl0IG5lZWRzIGEgZGlmZmVyZW50IHdyaXRlcgotICovCi12b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X2RlZmluaXRpb24ob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4Y2VwdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2NsYXNzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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Ci19Ci0KLS8qKgotICogR2VuZXJhdGVzIGFuIHVuc2VyaWFsaXplciBmb3IgYSBzdHJ1Y3QsIGludm9rZXMgcmVhZCgpCi0gKi8KLXZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgb3V0IDw8Ci0gICAgaW5kZW50KCkgPDwgcHJlZml4IDw8ICIgPSBuZXcgIiA8PCB0eXBlX25hbWUodHN0cnVjdCkgPDwgIigpOyIgPDwgZW5kbCA8PAotICAgIGluZGVudCgpIDw8IHByZWZpeCA8PCAiLnJlYWQoaXByb3QpOyIgPDwgZW5kbDsKLX0KLQotLyoqCi0gKiBEZXNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgcmVhZGluZyBpdHMgc2l6ZSBhbmQgdGhlbiBpdGVyYXRpbmcKLSAqLwotdm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LCBib29sIGhhc19tZXRhZGF0YSkgewotCi0gIHNjb3BlX3VwKG91dCk7Ci0KLSAgc3RyaW5nIG9iajsKLQotICBpZiAodHR5cGUtPmlzX21hcCgpKSB7Ci0gICAgb2JqID0gdG1wKCJfbWFwIik7Ci0gIH0gZWxzZSBpZiAodHR5cGUtPm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mF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LCBib29sIGhhc19tZXRhZGF0YSkgewotICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKLSAgdF9maWVsZCBmZWxlbSh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PCBkZWNsYXJlX2ZpZWxkKCZmZWxlbSkgPDwgZW5kbDsKLQotICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZmZWxlbSwgIiIsIGhhc19tZXRhZGF0YSk7Ci0KLSAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICIuYWRkKCIgPDwgZWxlbSA8PCAiKTsiIDw8IGVuZGw7Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgotICoKLSAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkIHRvIHNlcmlhbGl6ZQotICogQHBhcmFtIHByZWZpeCBOYW1lIHRvIHByZXBlbmQgdG8gZmllbGQgbmFtZQotICovCi12b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwgYm9vbCBoYXNfbWV0YWRhdGEpIHsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X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y3QgdG8gc2VyaWFsaXplCi0gKiBAcGFyYW0gcHJlZml4ICBTdHJpbmcgcHJlZml4IHRvIGF0dGFjaCB0byBhbGwgZmllbGRzCi0gKi8KLXZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgKHZvaWQpIHRzdHJ1Y3Q7Ci0gIG91dCA8PCBpbmRlbnQoKSA8PCBwcmVmaXggPDwgIi53cml0ZShvcHJvdCk7IiA8PCBlbmRsOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgd3JpdGluZyBpdHMgc2l6ZSB0aGVuIHRoZSBlbGVtZW50cy4KLSAqCi0gKiBAcGFyYW0gdHR5cGUgIFRoZSB0eXBlIG9mIGNvbnRhaW5lcgotICogQHBhcmFtIHByZWZpeCBTdHJpbmcgcHJlZml4IGZvciBmaWVsZHMKLSAqLwotdm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LCBib29sIGhhc19tZXRhZGF0YSkgewotICBzY29wZV91cChvdXQpOwotCi0gIGlmIChoYXNfbWV0YWRhdGEpIHsKLSAgICBpZiAodHR5cGUtPmlzX21hcCgpKSB7Ci0gICAgICBpbmRlbnQob3V0KSA8PAotICAgICAgICAib3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QoKSkgewotICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvdXQsICh0X3NldCopdHR5cGUsIGl0ZXIsIGhhc19tZXRhZGF0YSk7Ci0gIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgewotICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LCAodF9saXN0Kil0dHlwZSwgaXRlciwgaGFzX21ldGFkYXRhKTsKLSAgfQotICBzY29wZV9kb3duKG91dCk7Ci0KLSAgaWYgKGhhc19tZXRhZGF0YSkgewotICAgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKLSAgICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZU1hcEVuZCgpOyIgPDwgZW5kbDsKLSAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgewotICAgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlU2V0RW5kKCk7IiA8PCBlbmRsOwotICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgewotICAgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlTGlzdEVuZCgpOyIgPDwgZW5kbDsKLSAgICB9Ci0gIH0KLQotICBzY29wZV9kb3duKG91dCk7Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIG1hcC4KLSAqLwotdm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGl0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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pZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdCAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50ICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqICAgICAgdHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9tYXBfZWxlbWVudCAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50IChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqICAgICB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQgICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0ICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiAgIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lciAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWFwKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudCAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqICAgICB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfamF2YV9kb2MgICAgICAgICAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICBmaWVsZCk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9qYXZhX2RvYyAgICAgICAgICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZG9jKiAgICAgIHRkb2MpOwotCi0gIHZvaWQgZ2VuZXJhdGVfamF2YV9kb2MgICAgICAgICAgICAgICAgIChzdGQ6Om9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z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hbGl6ZV9saXN0X2VsZW1lbnQob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOwotICB0X2ZpZWxkIGZlbGVtKHRsaXN0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOwotCi0gIGluZGVudChvdXQpIDw8Ci0gICAgZGVjbGFyZV9maWVsZCgmZmVsZW0pIDw8IGVuZGw7Ci0KLSAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0pOwotCi0gIGluZGVudChvdXQpIDw8Ci0gICAgcHJlZml4IDw8ICIuYWRkRWxlbWVudCgiIDw8Ci0gICAgYm94X3R5cGUodGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgZWxlbSkgPDwgIik7IiA8PCBlbmRsOwotfQotCi0KLS8qKgotICogU2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgotICoKLSAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkIHRvIHNlcmlhbGl6ZQotICogQHBhcmFtIHByZWZpeCBOYW1lIHRvIHByZXBlbmQgdG8gZmllbGQgbmFtZQotICovCi12b2lkIHRfamF2YW1lX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHRfdHlwZSogdHlwZSA9IGdldF90cnVlX3R5cGU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gKi8KLXZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgewotICAodm9pZCkgdHN0cnVjdDsKLSAgb3V0IDw8Ci0gICAgaW5kZW50KCkgPDwgcHJlZml4IDw8ICIud3JpdGUob3Byb3QpOyIgPDwgZW5kbDsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIGEgY29udGFpbmVyIGJ5IHdyaXRpbmcgaXRzIHNpemUgdGhlbiB0aGUgZWxlbWVudHMuCi0gKgotICogQHBhcmFtIHR0eXBlICBUaGUgdHlwZSBvZiBjb250YWluZXIKLSAqIEBwYXJhbSBwcmVmaXggU3RyaW5nIHByZWZpeCBmb3IgZmllbGRzCi0gKi8KLXZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG9mc3RyZWFtJiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHNjb3BlX3VwKG91dCk7Ci0KLSAgaWYgKHR0eXBlLT5pc19tYXAoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAib3Byb3Qud3JpdGVNYXBCZWdpbihuZXcgVE1hcCgiIDw8Ci0gICAgICB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgPDwgIiwgIiA8PAotICAgICAgdHlw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VycyBvZiBhIG1hcC4KLSAqLwotdm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBtYXApIHsKLSAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGl0ZXIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAma2ZpZWxkLCAiIik7Ci0gIHN0cmluZyB2YWxfdHlwZSA9IHR5cGVfbmFtZSh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgdHJ1ZSwgZmFsc2UpOwotICB0X2ZpZWxkIHZmaWVsZCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgIigoIiArIHZhbF90eXBlICsgIikiICsgbWFwICsgIi5nZXQoIiArIGl0ZXIgKyAiKSkiKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJnZmaWVsZCwgIiIpOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBzZXQuCi0gKi8KLXZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQob2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGl0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CB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24pOwotCi0gIC8qKgotICAgKiBTZXJpYWxpemF0aW9uIGNvbnN0cnVjdHMKLSAgICovCi0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZCAgICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcz1mYWxzZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiAgIHRzdHJ1Y3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqICAgICB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudCAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkICAgICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdCAgICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB2aXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICAvKioKLSAgICogSGVscGVyIHJlbmRlcmluZyBmdW5jdGlvbnMKLSAgICovCi0KLSAgc3RkOjpzdHJpbmcganNfaW5jbHVkZXMoKTsKLSAgc3RkOjpzdHJpbmcgcmVuZGVyX2luY2x1ZGVz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ci0gICAgICAgICAgd2hpbGUgKChsb2MgPSBucy5maW5kKCIuIikpICE9IHN0ZDo6c3RyaW5nOjpucG9zKSB7Ci0gICAgICAgICAgICAgIHBpZWNlcy5wdXNoX2JhY2sobnMuc3Vic3RyKDAsIGxvYykpOwotICAgICAgICAgICAgICBucyA9IG5zLnN1YnN0cihsb2MrMSk7Ci0gICAgICAgICAgfQotICAgICAgfQotCi0gICAgICBpZiAobnMuc2l6ZSgpID4gMCkgewotICAgICAgICAgIHBpZWNlcy5wdXNoX2JhY2sobnMpOwotICAgICAgfQotCi0gICAgICByZXR1cm4gcGllY2VzOwotICB9Ci0KLSAgc3RkOjpzdHJpbmcganNfdHlwZV9uYW1lc3BhY2UodF9wcm9ncmFtKiBwKSB7Ci0gICAgaWYgKGdlbl9ub2RlXykgewotICAgICAgaWYgKHAgIT0gTlVMTCAmJiBwICE9IHByb2dyYW1fKSB7Ci0gICAgICAgIHJldHVybiBwLT5nZXRfbmFtZSgpICsgIl90dHlwZXMuIjsKLSAgICAgIH0KLSAgICAgIHJldHVybiAidHR5cGVzLiI7Ci0gICAgfQotICAgIHJldHVybiBqc19uYW1lc3BhY2UocCk7Ci0gIH0KLQotICBzdGQ6OnN0cmluZyBqc19leHBvcnRfbmFtZXNwYWNlKHRfcHJvZ3JhbSogcCkgewotICAgIGlmIChnZW5fbm9kZV8pIHsKLSAgICAgIHJldHVybiAiZXhwb3J0cy4iOwotICAgIH0KLSAgICByZXR1cm4ganNfbmFtZXNwYWNlKHApOwotICB9Ci0KLSAgc3RkOjpzdHJpbmcganNfbmFtZXNwYWNlKHRfcHJvZ3JhbSogcCkgewotICAgICAgc3RkOjpzdHJpbmcgbnMgPSBwLT5nZXRfbmFtZXNwYWNlKCJqcyIpOwotICAgICAgaWYgKG5zLnNpemUoKSA+IDApIHsKLSAgICAgICAgICBucyArPSAiLiI7Ci0gICAgICB9Ci0KLQotICAgICAgcmV0dXJuIG5zOwotICB9Ci0KLSBwcml2YXRlOgotCi0gIC8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IiArIHZhciArICI7IjsKLSAgfQotfQotCi1zdGQ6OnN0cmluZyB0X2pzX2dlbmVyYXRvcjo6cmVuZGVyX3JlY3ZfcmV0dXJuKHN0ZDo6c3RyaW5nIHZhcikgewotICBpZiAoZ2VuX25vZGVfKSB7Ci0gICAgcmV0dXJuICJyZXR1cm4gY2FsbGJhY2sobnVsbCwgIiArIHZhciArICIpOyI7Ci0gIH0gZWxzZSB7Ci0gICAgcmV0dXJuICJyZXR1cm4gIiArIHZhciArICI7IjsKLSAgfQotfQotCi0vKioKLSAqIERlc2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgotICovCi12b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcykgewotICAodm9pZCkgaW5jbGFzczsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOwotCi0gIGlmICh0eXBlLT5pc192b2lkKCkpIHsKLSAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArCi0gICAgICBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7Ci0gIH0KLQotICBzdHJpbmcgbmFtZSA9IHByZWZpeCt0ZmllbGQtPmdldF9uYW1lKCk7Ci0KLSAgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKLSAgICBnZW5l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IGtleSBhc3N1bXB0aW9ucywKLSAqIGZpcnN0IHRoYXQgdGhlcmUgaXMgYSBjb25zdCBjaGFyKiB2YXJpYWJsZSBuYW1lZCBkYXRhIHRoYXQgcG9pbnRzIHRvIHRoZQotICogYnVmZmVyIGZvciBkZXNlcmlhbGl6YXRpb24sIGFuZCB0aGF0IHRoZXJlIGlzIGEgdmFyaWFibGUgcHJvdG9jb2wgd2hpY2gKLSAqIGlzIGEgcmVmZXJlbmNlIHRvIGEgVFByb3RvY29sIHNlcmlhbGl6YXRpb24gb2JqZWN0LgotICovCi12b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3Qob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgewotICAgIG91dCA8PAotICAgICAgICBpbmRlbnQoKSA8PCBwcmVmaXggPDwgIiA9IG5ldyAiIDw8ICBqc190eXBlX25hbWVzcGFjZSh0c3RydWN0LT5nZXRfcHJvZ3JhbSgpKTw8dHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiKCk7IiA8PCBlbmRsIDw8Ci0gICAgICAgIGluZGVudCgpIDw8IHByZWZpeCA8PCAiLnJlYWQoaW5wdXQpOyIgPDwgZW5kbDsKLQotfQotCi12b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB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dF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgewotICBzdHJpbmcgZWxlbSA9IHRtcCgiZWxlbSIpOwotICB0X2ZpZWxkIGZlbGVtKHRsaXN0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOwotCi0gIGluZGVudChvdXQpIDw8Ci0gICAgInZhciAiIDw8IGVsZW0gPDwgIiA9IG51bGw7IiA8PCBlbmRsOwotCi0gIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgICAgcHJlZml4IDw8ICIucHVzaCgiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOwotfQotCi0KLS8qKgotICogU2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgotICoKLSAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkIHRvIHNlcmlhbGl6ZQotICogQHBhcmFtIHByZWZpeCBOYW1lIHRvIHByZXBlbmQgdG8gZmllbGQgbmFtZQotICovCi12b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOwotCi0gIC8vIERvIG5vdGhpbmcgZm9yIHZvaWQgdHlwZXMKLSA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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyKSB7Ci0gIHRfZmllbGQgZWZpZWxkKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZlZmllbGQpOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBsaXN0LgotICovCi12b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlcikgewotICB0X2ZpZWxkIGVmaWVsZCh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCk7Ci19Ci0KLS8qKgotICogRGVjbGFyZXMgYSBmaWVsZCwgd2hpY2ggbWF5IGluY2x1ZGUgaW5pdGlhbGl6YXRpb24gYXMgbmVjZXNzYXJ5LgotICoKLSAqIEBwYXJhbSB0dHlwZSBUaGUgdHlwZQotICovCi1zdHJpbmcgdF9qc19nZW5lcmF0b3I6OmRlY2xhcmVfZmllbGQodF9maWVsZCogdGZpZWxkLCBib29sIGluaXQsIGJvb2wgb2JqKSB7Ci0gIHN0cmluZyByZXN1bHQgPSAidGhpcy4iICsgdGZpZWxkLT5nZXRfbmFtZSgpOwotCi0gIGlmKCFvYmopewotICAgICAgcmVzdWx0ID0gInZhciAiICsgdGZpZWxk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lbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0KTsKLQotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50IChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqICAgICB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfdHlwZSAgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSk7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQgICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqICAgIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU9ICIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgdml0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50ICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3R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fQotCi1zdHJpbmcgdF9vY2FtbF9nZW5lcmF0b3I6OnN0cnVjdF9tZW1iZXJfY29weV9vZih0X3R5cGUgKnR5cGUsIHN0cmluZyB3aGF0KSB7Ci0gICAgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKLSAgICAgICAgcmV0dXJuIHdoYXQgKyBzdHJpbmcgKCIjY29weSIpOwotICAgIH0gaWYgKHR5cGUtPmlzX21hcCgpKSB7Ci0gICAgICAgIHN0cmluZyBjb3B5X29mX2sgPSBzdHJ1Y3RfbWVtYmVyX2NvcHlfb2YoKCh0X21hcCAqKXR5cGUpLT5nZXRfa2V5X3R5cGUoKSwgImsiKTsKLSAgICAgICAgc3RyaW5nIGNvcHlfb2ZfdiA9IHN0cnVjdF9tZW1iZXJfY29weV9vZigoKHRfbWFwICopdHlwZSktPmdldF92YWxfdHlwZSgpLCAidiIpOwotCi0gICAgICAgIGlmKGNvcHlfb2ZfayA9PSAiayIgJiYgY29weV9vZl92ID09ICJ2IikgewotICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmcgKCIoSGFzaHRibC5jb3B5ICIpICsgd2hhdCArIHN0cmluZygiKSIpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmcgKCIoKGZ1biBvaCAtPiBsZXQgbmggPSBIYXNodGJsLmNyZWF0ZSAoSGFzaHRibC5sZW5ndGggb2gpIGluIEhhc2h0YmwuaXRlciAoZnVuIGsgdiAtPiBIYXNodGJsLmFkZCBuaCAiKQotICAgICAgICAgICAgICAgICAgICArIGNvcHlfb2ZfayArIHN0cmluZygiICIpICsgY29weV9vZl92Ci0gICAgICAgICAgICAgICAgICAgICsgc3RyaW5nKCIpIG9oOyBuaCkgIikKLSAgICAgICAgICAgICAgICAgICAgKyB3aGF0ICsgIikiOwotICAgICAgICB9Ci0gICAgfSBpZiAodHlwZS0+aXNfc2V0KCkpIHsKLSAgICAgICAgc3RyaW5nIGNvcHlfb2YgPSBzdHJ1Y3RfbWVtYmVyX2NvcHlfb2YoKCh0X3NldCAqKXR5cGUpLT5nZXRfZWxlbV90eXBlKCksICJrIik7Ci0KLSAgICAgICAgaWYoY29weV9vZiA9PSAiayIpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RyaW5nICgiKEhhc2h0YmwuY29weSAiKSArIHdoYXQgKyBzdHJpbmcoIikiKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3RyaW5nICgiKChmdW4gb2ggLT4gbGV0IG5oID0gSGFzaHRibC5jcmVhdGUgKEhhc2h0YmwubGVuZ3RoIG9oKSBpbiBIYXNodGJsLml0ZXIgKGZ1biBrIHYgLT4gSGFzaHRibC5hZGQgbmggIikKLSAgICAgICAgICAgICAgICAgICAgKyBjb3B5X29mICsgc3RyaW5nKCIgdHJ1ZSIpCi0gICAgICAgICAgICAgICAgICAgICsgc3RyaW5nKCIpIG9oOyBuaCkgIikKLSAgICAgICAgICAgICAgICAgICAgKyB3aGF0ICsgIikiOwotICAgICAgICB9Ci0gICAgfSBpZiAodHlwZS0+aXNfbGlzdCgpKSB7Ci0gICAgICAgIHN0cmluZyBjb3B5X29mID0gc3RydWN0X21lbWJlcl9jb3B5X29mKCgodF9saXN0ICopdHlwZSktPmdldF9lbGVtX3R5cGUoKSwgIngiKTsKLSAgICAgICAgaWYoY29weV9vZiAhPSAieCIpIHsKLSAgICAgICAgICAgIHJldHVybiBzdHJpbmcoIihMaXN0Lm1hcCAoZnVuIHggLT4gIikKLSAgICAgICAgICAgICAgICArIGNvcHlfb2YgKyBzdHJpbmcgKCIpICIpCi0gICAgICAgICAgICAgICAgKyB3aGF0ICsgc3RyaW5nKCIpIik7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gd2hhdDsKLSAgICAgICAgfQotICAgIH0KLSAgICByZXR1cm4gd2hhdDsKLX0KLQotdm9pZC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KiB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gICh2b2lkKSB0c3RydWN0OwotICBpbmRlbnQob3V0KSA8PCBwcmVmaXggPDwgIiN3cml0ZShvcHJvdCkiOwotfQotCi12b2lkIHRfb2NhbWxfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgaWYgKHR0eXBlLT5pc19tYXAoKSkgewotICAgIGluZGVudChvdXQpIDw8ICJvcHJvdCN3cml0ZU1hcEJlZ2luKCI8PCB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgPDwgIiwiOwotICAgIG91dCA8PCB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfdmFsX3R5cGUoKSkgPDwgIiwiOwotICAgIG91dCA8PCAiSGFzaHRibC5sZW5ndGggIiA8PCBwcmVmaXggPDwgIik7IiA8PCBlbmRsOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAib3Byb3Qjd3JpdGVTZXRCZWdpbigiIDw8IHR5cGVfdG9fZW51bSgoKHRfc2V0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKSkgPDwgIiwiOwotICAgIG91dCA8PCAiSGFzaHRibC5sZW5ndGggIiA8PCBwcmVmaXggPDwgIik7IiA8PCBlbmRsOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgI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ZXIgPSB0bXAoIl9pdGVyIik7Ci0gICAgaW5kZW50KG91dCkgPDwgIkxpc3QuaXRlciAoZnVuICI8PGl0ZXI8PCIgLT4gIjsKLSAgICBpbmRlbnRfdXAoKTsKLSAgICBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG91dCwgKHRfbGlzdCopdHR5cGUsIGl0ZXIpOwotICAgIGluZGVudF9kb3duKCk7Ci0gICAgaW5kZW50KG91dCkgPDwgIikgIiA8PCBwcmVmaXggPDwgIjsiIDw8ICBlbmRsOwotICB9Ci0KLSAgaWYgKHR0eXBlLT5pc19tYXAoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAib3Byb3Qjd3JpdGVNYXBFbmQiOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAib3Byb3Qjd3JpdGVTZXRFbmQiOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90I3dyaXRlTGlzdEVuZCI7Ci0gIH0KLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgotICoKLSAqLwotdm9pZCB0X29jYW1sX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyB2aXRlcikgewotICB0X2ZpZWxkIGtmaWVsZCh0bWFwLT5nZXRfa2V5X3R5cGUoKSwga2l0ZXIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAma2ZpZWxkKTsKLQotICB0X2ZpZWxkIHZmaWVsZCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgdml0ZXIpOwotICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkKTsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgc2V0LgotICovCi12b2lkIHRfb2NhbWxfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQob2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyKSB7Ci0gIHRfZmllbGQgZWZpZWxkKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZlZmllbGQpOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBsaXN0LgotICovCi12b2lkIHRfb2NhbWxfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGl0ZXIpIHsKLSAgdF9maWVsZCBlZmllbGQodGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZlZmllbG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nZW5lcmF0ZV9wcm9jZXNzX2Z1bmN0aW9uICAodF9zZXJ2aWNlKiB0c2VydmljZSwgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKLQotICAvKioKLSAgICogU2VyaWFsaXphdGlvbiBjb25zdHJ1Y3RzCi0gICAqLwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQgICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluY2xhc3M9ZmFsc2UpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0ICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50ICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCAgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgdml0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50ICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgLyoqCi0gICAqIEhlbHBlciByZW5kZXJpbmcgZnVuY3Rpb25zCi0gICAqLwotCi0gIHN0ZDo6c3RyaW5nIHBlcmxfaW5jbHVkZX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mdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgewotICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwKLSAgICAgICAgICAicmV0dXJuOyIgPDwgZW5kbDsKLSAgICAgIH0gZWxzZSB7Ci0gICAgICAgIGZfc2VydmljZV8gPDwKLSAgICAgICAgICBpbmRlbnQoKSA8PCAiZGllIFwiIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIiBmYWlsZWQ6IHVua25vd24gcmVzdWx0XCI7IiA8PCBlbmRsOwotICAgICAgfQotCi0gICAgICAvLyBDbG9zZSBmdW5jdGlvbgotICAgICAgaW5kZW50X2Rvd24oKTsKLSAgICAgIGZfc2VydmljZV8gPDwgIn0iPDxlbmRsOwotCi0gICAgfQotICB9Ci0KLX0KLQotLyoqCi0gKiBEZXNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4KLSAqLwotdm9pZCB0X3BlcmxfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcykgewotICAodm9pZCkgaW5jbGFzczsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOwotCi0gIGlmICh0eXBlLT5pc192b2lkKCkpIHsKLSAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArCi0gICAgICBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKC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ICI7IiA8PCBlbmRsOwotfQotCi12b2lkIHRfcGVybF9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIHN0cmluZyBlbGVtID0gdG1wKCJlbGVtIik7Ci0gIHRfZmllbGQgZmVsZW0odHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgICJteSAkIiA8PCBlbGVtIDw8ICIgPSB1bmRlZjsiIDw8IGVuZGw7Ci0KLSAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0pOwotCi0gIGluZGVudChvdXQpIDw8Ci0gICAgIiQiIDw8IHByZWZpeCA8PCAiLT57JCIgPDwgZWxlbSA8PCAifSA9IDE7IiA8PCBlbmRsOwotfQotCi12b2lkIHRfcGVybF9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgc3RyaW5nIGVsZW0gPSB0bXAoImVsZW0iKTsKLSAgdF9maWVsZCBmZWxlbSh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgICJteSAkIiA8PCBlbGVtIDw8ICIgPSB1bmRlZj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mlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LCAodF9saXN0Kil0dHlwZSwgaXRlcik7Ci0gICAgc2NvcGVfZG93bihvdXQpOwotICB9Ci0KLSAgc2NvcGVfZG93bihvdXQpOwotCi0gIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIiR4ZmVyICs9ICRvdXRwdXQtPndyaXRlTWFwRW5kKCk7IiA8PCBlbmRsOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAiJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVTZXRFbmQoKTsiIDw8IGVuZGw7Ci0gIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgewotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAiJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVMaXN0RW5kKCk7IiA8PCBlbmRsOwotICB9Ci0KLSAgc2NvcGVfZG93bihvdXQpOwotfQotCi0vKioKLSAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBtYXAuCi0gKgotICovCi12b2lkIHRfcGVybF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdml0ZXIpIHsKLSAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtpdGVyKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwg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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudCAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiAgICAgdGxpc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkICAgICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdCAgICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcga2l0ZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB2aXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiAgICAgIHRtYXAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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AgaW5kZW50X2Rvd24oKTsKLSAgZl9zZXJ2aWNlXyA8PAotICAgICJ9IiA8PCBlbmRsIDw8IGVuZGw7Ci19Ci0KLS8qKgotICogRGVzZXJpYWxpemVzIGEgZmllbGQgb2YgYW55IHR5cGUuCi0gKi8KLXZvaWQgdF9waHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcykgewotICB0X3R5cGUqIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHRmaWVsZC0+Z2V0X3R5cGUoKSk7Ci0KLSAgaWYgKHR5cGUtPmlzX3ZvaWQoKSkgewotICAgIHRocm93ICJDQU5OT1QgR0VORVJBVEUgREVTRVJJQUxJWkUgQ09ERSBGT1Igdm9pZCBUWVBFOiAiICsKLSAgICAgIHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKLSAgfQotCi0gIHN0cmluZyBuYW1lID0gcHJlZml4ICsgdGZpZWxkLT5nZXRfbmFtZSgpOwotCi0gIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7Ci0gICAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRfc3RydWN0Kil0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gIH0gZWxzZSB7Ci0KLSAgICBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpIHsKLSAgICAgIGd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IHNjb3BlX2Rvd24ob3V0KTsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgotICoKLSAqLwotdm9pZCB0X3BocF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdml0ZXIpIHsKLSAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtpdGVyKTsKLSAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmtmaWVsZCwgIiIpOwotCi0gIHRfZmllbGQgdmZpZWxkKHRtYXAtPmdldF92YWxfdHlwZSgpLCB2aXRlcik7Ci0gIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZ2ZmllbGQsICIiKTsKLX0KLQotLyoqCi0gKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgc2V0LgotICovCi12b2lkIHRfcGhwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlcikgewotICB0X2ZpZWxkIGVmaWVsZCh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGl0ZXIpOwotICBnZW5lcmF0ZV9zZXJpY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mVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluY2xhc3M9ZmFsc2UpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0ICAgICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50ICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCAgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAoc3RkOjpvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgdml0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50ICAgIChzdGQ6Om9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50ICAgKHN0ZDo6b2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9weXRob25fZG9jc3RyaW5nICAgICAgICAgKHN0ZDo6b2ZzdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0KTsKLQotICB2b2lkIGdlbmVyYXRlX3B5dGhvbl9kb2NzdHJpbmcgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKLQotICB2b2lkIGdlbmVyYXRlX3B5dGhvbl9kb2NzdHJpbmcgICAgICAgICAoc3RkOjpvZnN0cmVhbSYgb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9kb2MqICAgIHRkb2MsCi0gICAgICAgICAgICAg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GUob3Byb3QpIiA8PCBlbmRsIDw8Ci0gICAgICBpbmRlbnQoKSA8PCAib3Byb3Qud3JpdGVNZXNzYWdlRW5kKCkiIDw8IGVuZGwgPDwKLSAgICAgIGluZGVudCgpIDw8ICJvcHJvdC50cmFucy5mbHVzaCgpIiA8PCBlbmRsOwotCi0gICAgLy8gQ2xvc2UgZnVuY3Rpb24KLSAgICBpbmRlbnRfZG93bigpOwotICAgIGZfc2VydmljZV8gPDwgZW5kbDsKLSAgfQotfQotCi0vKioKLSAqIERlc2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgotICovCi12b2lkIHRfcHlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcykgewotICAodm9pZCkgaW5jbGFzczsKLSAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOwotCi0gIGlmICh0eXBlLT5pc192b2lkKCkpIHsKLSAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArCi0gICAgICBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7Ci0gIH0KLQotICBzdHJpbmcgbmFtZSA9IHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKLQotICBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgewotICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVj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b2lkIHRfcHlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKLSAgc3RyaW5nIGtleSA9IHRtcCgiX2tleSIpOwotICBzdHJpbmcgdmFsID0gdG1wKCJfdmFsIik7Ci0gIHRfZmllbGQgZmtleSh0bWFwLT5nZXRfa2V5X3R5cGUoKSwga2V5KTsKLSAgdF9maWVsZCBmdmFsKHRtYXAtPmdldF92YWxfdHlwZSgpLCB2YWwpOwotCi0gIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZrZXkpOwotICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZmdmFsKTsKLQotICBpbmRlbnQob3V0KSA8PAotICAgIHByZWZpeCA8PCAiWyIgPDwga2V5IDw8ICJdID0gIiA8PCB2YWwgPDwgZW5kbDsKLX0KLQotLyoqCi0gKiBXcml0ZSBhIHNldCBlbGVtZW50Ci0gKi8KLXZvaWQgdF9weV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgewotICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKLSAgdF9maWVsZCBmZWxlbSh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOwotCi0gIGd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dHRhY2ggdG8gYWxsIGZpZWxkcwotICovCi12b2lkIHRfcHlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG9mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gICh2b2lkKSB0c3RydWN0OwotICBpbmRlbnQob3V0KSA8PAotICAgIHByZWZpeCA8PCAiLndyaXRlKG9wcm90KSIgPDwgZW5kbDsKLX0KLQotdm9pZCB0X3B5X2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7Ci0gIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlTWFwQmVnaW4oIiA8PAotICAgICAgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X2tleV90eXBlKCkpIDw8ICIsICIgPDwKLSAgICAgIHR5cGVfdG9fZW51bSgoKHRfbWFwKil0dHlwZSktPmdldF92YWxfdHlwZSgpKSA8PCAiLCAiIDw8Ci0gICAgICAibGVuKCIgPDwgcHJlZml4IDw8ICIpKSIgPDwgZW5kbDsKLSAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlU2V0QmVnaW4oIiA8PAotICAgICAgdHlwZV90b19lbnVtKCgodF9zZX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dGVyKTsKLSAgICBpbmRlbnRfZG93bigpOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICBzdHJpbmcgaXRlciA9IHRtcCgiaXRlciIpOwotICAgIGluZGVudChvdXQpIDw8Ci0gICAgICAiZm9yICIgPDwgaXRlciA8PCAiIGluICIgPDwgcHJlZml4IDw8ICI6IiA8PCBlbmRsOwotICAgIGluZGVudF91cCgpOwotICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LCAodF9saXN0Kil0dHlwZSwgaXRlcik7Ci0gICAgaW5kZW50X2Rvd24oKTsKLSAgfQotCi0gIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlTWFwRW5kKCkiIDw8IGVuZGw7Ci0gIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7Ci0gICAgaW5kZW50KG91dCkgPDwKLSAgICAgICJvcHJvdC53cml0ZVNldEVuZCgpIiA8PCBlbmRsOwotICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKLSAgICBpbmRlbnQob3V0KSA8PAotICAgICAgIm9wcm90LndyaXRlTGlzdEVuZCgpIiA8PCBlbmRsOwotICB9Ci19Ci0KLS8qKgotICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIG1hcC4KLSAqCi0gKi8KLXZvaWQgdF9weV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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IHRzZXJ2aWNlKTsKLSAgdm9pZCBnZW5lcmF0ZV9zZXJ2aWNlX2ludGVyZmFjZSAodF9zZXJ2aWNlKiB0c2VydmljZSk7Ci0gIHZvaWQgZ2VuZXJhdGVfc2VydmljZV9jbGllbnQgICAgKHRfc2VydmljZSogdHNlcnZpY2UpOwotICB2b2lkIGdlbmVyYXRlX3NlcnZpY2Vfc2VydmVyICAgICh0X3NlcnZpY2UqIHRzZXJ2aWNlKTsKLSAgdm9pZCBnZW5lcmF0ZV9wcm9jZXNzX2Z1bmN0aW9uICAodF9zZXJ2aWNlKiB0c2VydmljZSwgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKLQotICAvKioKLSAgICogU2VyaWFsaXphdGlvbiBjb25zdHJ1Y3RzCi0gICAqLwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQgICAgICAgICh0X3JiX29mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiAgICB0ZmllbGQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluY2xhc3M9ZmFsc2UpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0ICAgICAgICh0X3JiX29mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogICB0c3RydWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lciAgICAodF9yYl9vZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiAgICAgdHR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXg9IiIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQgICh0X3JiX29mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0c2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50ICAodF9yYl9vZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQgKHRfcmJfb2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogICAgIHRsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCAgICAgICAgICAodF9yYl9vZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogICAgdGZpZWxkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3QgICAgICAgICAodF9yYl9vZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqICAgdHN0cnVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeD0iIik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyICAgICAgKHRfcmJfb2ZzdHJlYW0gJm91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogICAgIHR0eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4PSIiKTsKLQotICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudCAgICAodF9yYl9vZnN0cmVhbSAmb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqICAgICAgdG1hcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGtpdGVyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgdml0ZXIpOwotCi0gIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50ICAgICh0X3JiX29mc3RyZWFtICZvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogICAgICB0bWFwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlcik7Ci0KLSAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50ICAgKHRfcmJfb2ZzdHJlYW0gJm91dCwKL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6YWxsPiIgPDwgZW5kbDsKLSAgfSBlbHNlIHsKLSAgICBpbmRlbnQoc194c2RfdHlwZXNfKSA8PCAiPC94c2Q6c2VxdWVuY2U+IiA8PCBlbmRsOwotICB9Ci0gIGluZGVudF9kb3duKCk7Ci0gIGluZGVudChzX3hzZF90eXBlc18pIDw8Ci0gICAgIjwveHNkOmNvbXBsZXhUeXBlPiIgPDwgZW5kbCA8PAotICAgIGVuZGw7Ci19Ci0KLXZvaWQgdF94c2RfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9lbGVtZW50KG9zdHJlYW0mIG91dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiBhdHRycywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgb3B0aW9uYWwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG5pbGxhYmxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBsaXN0X2VsZW1lbnQpIHsKLSAgc3RyaW5nIHNtaW5PY2N1cnMgPSAob3B0aW9uYWwgfHwgbGlzdF9lbGVtZW50KSA/ICIgbWluT2NjdXJzPVwiMFwiIiA6ICIiOwotICBzdHJpbmcgc21heE9jY3VycyA9IGxpc3RfZWxlbWVudCA/ICIgbWF4T2NjdXJzPVwidW5ib3VuZGVkXCIiIDogIiI7Ci0gIHN0cmluZyBzb3B0aW9uYWwgPSBzbWluT2NjdXJzICsgc21heE9jY3VyczsKLSAgc3RyaW5nIHNuaWxsYWJsZSA9IG5pbGxhYmxlID8gIiBuaWxsYWJsZT1cInRydWVcIiIgOiAiIjsKLQotICBpZiAodHR5cGUtPmlzX3ZvaWQoKS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ICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX3N0YXRpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRlZnZhbCA9IGZhbHNlKTsKKyAgc3RkOjpzdHJpbmcgcmVuZGVyX2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSk7CisKKyAgLyoqCisgICAqIFNlcnZpY2UtbGV2ZWwgZ2VuZXJhdGlvbiBmdW5jdGlvbnMKKyAgICovCisKKyAgdm9pZCBnZW5lcmF0ZV9hczNfc3RydWN0KHRfc3RydWN0KiB0c3RydWN0LCBib29sIGlzX2V4Y2VwdGlvbik7CisKKyAgdm9pZCBnZW5lcmF0ZV9hczNfc3RydWN0X2RlZmluaXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQgPSBmYWxzZSk7CisgIC8vIHJlbW92ZWQgLS0gZXF1YWxpdHksY29tcGFyZV90bworICB2b2lkIGdlbmVyYXRlX2FzM19zdHJ1Y3RfcmVhZGVyKHN0ZDo6b3N0cmVhbSYgb3V0LCB0X3N0cnVjd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cjx0X2NvbnN0Kj4gY29uc3RzKSB7CisgIGlmIChjb25zdHMuZW1wdHkoKSkgeworICAgIHJldHVybjsKKyAgfQorCisgIHN0cmluZyBmX2NvbnN0c19uYW1lID0gcGFja2FnZV9kaXJfICsgIi8iICsgcHJvZ3JhbV9uYW1lXyArICJDb25zdGFudHMuYXMiOworICBvZnN0cmVhbV93aXRoX2NvbnRlbnRfYmFzZWRfY29uZGl0aW9uYWxfdXBkYXRlIGZfY29uc3RzOworICBmX2NvbnN0cy5vcGVuKGZfY29uc3RzX25hbWUpOworCisgIC8vIFByaW50IGhlYWRlcgorICBmX2NvbnN0cyA8PCBhdXRvZ2VuX2NvbW1lbnQoKSA8PCBhczNfcGFja2FnZSgpOworCisgIHNjb3BlX3VwKGZfY29uc3RzKTsKKyAgZl9jb25zdHMgPDwgZW5kbDsKKworICBmX2NvbnN0cyA8PCBhczNfdHlwZV9pbXBvcnRzKCk7CisKKyAgaW5kZW50KGZfY29uc3RzKSA8PCAicHVibGljIGNsYXNzICIgPDwgcHJvZ3JhbV9uYW1lXyA8PCAiQ29uc3RhbnRzIHsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIHZlY3Rvcjx0X2NvbnN0Kj46Oml0ZXJhdG9yIGNfaXRlcjsKKyAgZm9yIChjX2l0ZXIgPSBjb25zdHMuYmVnaW4oKTsgY19pdGVyICE9IGNvbnN0cy5lbmQoKTsgKytjX2l0ZXIpIHsKKyAgICBwcmludF9jb25zdF92YWx1ZShmX2NvbnN0cywKKyAgICAgICAgICAgICAgICAgICAgICAoKmNfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgKCpjX2l0ZXIpLT5nZXRfdHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3ZhbHVlKCksCisgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOworICB9CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChmX2NvbnN0cykgPDwgIn0iIDw8IGVuZGw7CisgIHNjb3BlX2Rvd24oZl9jb25zdHMpOworICBmX2NvbnN0cy5jbG9zZSgpOworfQorCit2b2lkIHRfYXMzX2dlbmVyYXRvcjo6cHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fc3RhdGljLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVmdmFsKSB7CisgIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHR5cGUpOworCisgIGluZGVudChvdXQpOworICBpZiAoIWRlZnZhbCkgeworICAgIG91dCA8PCAoaW5fc3RhdGljID8gInZhciAiIDogInB1YmxpYyBzdGF0aWMgY29uc3QgIik7CisgIH0KKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgc3RyaW5nIHYyID0gcmVuZGVyX2NvbnN0X3ZhbHVlKG91dCwgbmFtZSwgdHlwZSwgdmFsdWUpOworICAgIG91dCA8PCBuYW1lOworICAgIGlmICghZGVmdmFsKSB7CisgICAgICBvdXQgPDwgIjoiIDw8IHR5cGVfbmFtZSh0eXBlKTsKKyAgICB9CisgICAgb3V0IDw8ICIgPSAiIDw8IHYyIDw8ICI7IiA8PCBlbmRsIDw8IGVuZGw7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgb3V0IDw8IG5hbWU7CisgICAgaWYgKCFkZWZ2YWwpIHsKKyAgICAgIG91dCA8PCAiOiIgPDwgdHl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90eXBlID0gTlVMTDsKKyAgICAgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgICAgIGlmICgoKmZfaXRlciktPmdldF9uYW1lKCkgPT0gdl9pdGVyLT5maXJzdC0+Z2V0X3N0cmluZygpKSB7CisgICAgICAgICAgZmllbGRfdHlwZSA9ICgqZl9pdGVyKS0+Z2V0X3R5cGUoKTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgaWYgKGZpZWxkX3R5cGUgPT0gTlVMTCkgeworICAgICAgICB0aHJvdyAidHlwZSBlcnJvcjogIiArIHR5cGUtPmdldF9uYW1lKCkgKyAiIGhhcyBubyBmaWVsZCAiICsgdl9pdGVyLT5maXJzdC0+Z2V0X3N0cmluZygpOworICAgICAgfQorICAgICAgc3RyaW5nIHZhbCA9IHJlbmRlcl9jb25zdF92YWx1ZShvdXQsIG5hbWUsIGZpZWxkX3R5cGUsIHZfaXRlci0+c2Vjb25kKTsKKyAgICAgIGluZGVudChvdXQpIDw8IG5hbWUgPDwgIi4iOworICAgICAgb3V0IDw8IHZfaXRlci0+Zmlyc3QtPmdldF9zdHJpbmcoKSA8PCAiID0gIiA8PCB2YWwgPDwgIjsiIDw8IGVuZGw7CisgICAgfQorICAgIGlmICghaW5fc3RhdGljKSB7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaW5kZW50KG91dCkgPDwgIn0oKTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR5cGUtPmlzX21hcCgpKSB7CisgICAgb3V0IDw8IG5hbWU7CisgICAgaWYgKCFkZWZ2YWwpIHsKKyAgICAgIG91dCA8PCAiOiIgPDwgdHlwZV9uYW1lKHR5cGUpOworICAgIH0KKyAgICBvdXQgPD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AgIH0KKyAgICBpZiAoIWluX3N0YXRpYykgeworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9KCk7IiA8PCBlbmRsOworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgIH0KKyAgICBvdXQgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19saXN0KCkgfHwgdHlwZS0+aXNfc2V0KCkpIHsKKyAgICBvdXQgPDwgbmFtZTsKKyAgICBpZiAoIWRlZnZhbCkgeworICAgICAgb3V0IDw8ICI6IiA8PCB0eXBlX25hbWUodHlwZSk7CisgICAgfQorICAgIG91dCA8PCAiID0gbmV3ICIgPDwgdHlwZV9uYW1lKHR5cGUsIGZhbHNlLCB0cnVlKSA8PCAiKCk7IiA8PCBlbmRsOworICAgIGlmICghaW5fc3RhdGljKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAieyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgICAgaW5kZW50KG91dCkgPDwgIm5ldyBmdW5jdGlvbigpOnZvaWQgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgIH0KKyAgICB0X3R5cGUqIGV0eXBlOworICAgIGlmICh0eXBlLT5pc19saXN0KCkpIHsKKyAgICAgIGV0eXBlID0gKCh0X2xpc3QqKXR5cGUpLT5nZXRfZWxlbV90eXBlKCk7CisgICAgfSBlbHNlIHsKKyAgICAgIGV0eXBlID0gKCh0X3NldCopdHlwZSktPmdldF9lbGVtX3R5cGUoKTsKKyAgICB9CisgICAgY29uc3QgdmVjdG9yPHRfY29uc3RfdmFsdWUqPiYgdmFsID0gdmFsdWUtPmdldF9saXN0KCk7CisgICAgdmVjdG9yPHRfY29uc3RfdmFsdWUqPjo6Y29uc3RfaXRlcmF0b3Igdl9pdGVyOworICAgIGZvciAodl9pdGVyID0gdmFsLmJlZ2luKCk7IHZfaXRlciAhPSB2YWwuZW5kKCk7ICsrdl9pdGVyKSB7CisgICAgICBzdHJpbmcgdmFsID0gcmVuZGVyX2NvbnN0X3ZhbHVlKG91dCwgbmFtZSwgZXR5cGUsICp2X2l0ZXIpOworICAgICAgaW5kZW50KG91dCkgPDwgbmFtZSA8PCAiLiIgPDwgKHR5cGUtPmlzX2xpc3QoKSA/ICJwdXNoIiA6ICJhZGQiKSA8PCAiKCIgPDwgdmFsIDw8ICIpOyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgfQorICAgIGlmICghaW5fc3RhdGljKSB7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaW5kZW50KG91dCkgPDwgIn0oKTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gY29uc3Qgb2YgdHlwZSAiICsgdHlwZS0+Z2V0X25hbWUoKTsKKyAgfQorfQorCitzdHJpbmcgdF9hczNfZ2VuZXJhdG9yOjpyZW5kZXJfY29uc3RfdmFsdWUob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSkgeworICAodm9pZCluYW1lOworICB0eXBlID0gZ2V0X3RydWVfdHlwZSh0eXBlKTsKKyAgc3RkOjpvc3RyaW5nc3RyZWFtIHJlbmRlcjsKKworICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICB0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNl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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgIGdlbmVyYXRlX2FzM19kb2Mob3V0LCB0c3RydWN0KTsKKworICBib29sIGlzX2ZpbmFsID0gKHRzdHJ1Y3QtPmFubm90YXRpb25zXy5maW5kKCJmaW5hbCIpICE9IHRzdHJ1Y3QtPmFubm90YXRpb25zXy5lbmQoKSk7CisgIGJvb2wgYmluZGFibGUgPSAhaXNfZXhjZXB0aW9uICYmICFpbl9jbGFzcyAmJiBiaW5kYWJsZV87CisKKyAgaW5kZW50KG91dCkgPDwgKGluX2NsYXNzID8gIiIgOiAicHVibGljICIpIDw8IChpc19maW5hbCA/ICJmaW5hbCAiIDogIiIpIDw8ICJjbGFzcyAiCisgICAgICAgICAgICAgIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgIiAiOworCisgIGlmIChpc19leGNlcHRpb24pIHsKKyAgICBvdXQgPDwgImV4dGVuZHMgRXJyb3IgIjsKKyAgfSBlbHNlIGlmIChiaW5kYWJsZSkgeworICAgIG91dCA8PCAiZXh0ZW5kcyBFdmVudERpc3BhdGNoZXIgIjsKKyAgfQorICBvdXQgPDwgImltcGxlbWVudHMgVEJhc2UgIjsKKworICBzY29wZV91cChvdXQpOworCisgIGluZGVudChvdXQpIDw8ICJwcml2YXRlIHN0YXRpYyBjb25zdCBTVFJVQ1RfREVTQzpUU3RydWN0ID0gbmV3IFRTdHJ1Y3QoXCIiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgPDwgIlwiKTsiIDw8IGVuZGw7CisKKyAgLy8gTWVtYmVycyB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PCAiZmllbGQgPSBpcHJvdC5yZWFkRmllbGRCZWdpbigpOyIgPDwgZW5kbDsKKworICAvLyBDaGVjayBmb3IgZmllbGQgU1RPUCBtYXJrZXIgYW5kIGJyZWFrCisgIGluZGVudChvdXQpIDw8ICJpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5TVE9QKSB7ICIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGluZGVudChvdXQpIDw8ICJicmVhazsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworCisgIC8vIFN3aXRjaCBzdGF0ZW1lbnQgb24gdGhlIGZpZWxkIHdlIGFyZSByZWFkaW5nCisgIGluZGVudChvdXQpIDw8ICJzd2l0Y2ggKGZpZWxkLmlkKSIgPDwgZW5kbDsKKworICBzY29wZV91cChvdXQpOworCisgIC8vIEdlbmVyYXRlIGRlc2VyaWFsaXphdGlvbiBjb2RlIGZvciBrbm93biBjYXNlcworICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikgeworICAgIGluZGVudChvdXQpIDw8ICJjYXNlICIgPDwgdXBjYXNlX3N0cmluZygoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICI6IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGluZGVudChvdXQpIDw8ICJpZiAoZmllbGQudHlwZSA9PSAiIDw8IHR5cGVfdG9fZW51bSgoKmZfaXRlciktPmdldF90eXBlKCkpIDw8ICIpIHsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisKKyAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIsICJ0aGlzLiIpOworICAgIGdlbmVyYXRlX2lzc2V0X3NldChvdXQsICpmX2l0ZXIpOworICAgIGluZGVudF9kb3duKCk7CisgICAgb3V0IDw8IGlu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29uc3RhbnRfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpCisgICAgICAgICAgICAgICAgPDwgIl9GSUVMRF9ERVNDKTsiIDw8IGVuZGw7CisKKyAgICAvLyBXcml0ZSBmaWVsZCBjb250ZW50cworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIsICJ0aGlzLiIpOworCisgICAgLy8gV3JpdGUgZmllbGQgY2xvc2VyCisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlRmllbGRFbmQoKTsiIDw8IGVuZGw7CisKKyAgICBpbmRlbnRfZG93bigpOworICAgIGluZGVudChvdXQpIDw8ICJ9IjsKKyAgfQorICAvLyBXcml0ZSB0aGUgc3RydWN0IG1hcAorICBvdXQgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAib3Byb3Qud3JpdGVGaWVsZFN0b3AoKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgIDw8ICJvcHJvdC53cml0ZVN0cnVjdEVuZCgpOyIgPDwgZW5kbDsKKworICBpbmRlbnRfZG93bigpOworICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3JlZmxlY3Rpb25fZ2V0dGVycyhvc3RyaW5nc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjYXBfbmFtZSkgeworICAodm9pZCl0eXBlOworICAodm9pZCljYXBfbmFtZTsKKyAgaW5kZW50KG91dCkgPDwgImNhc2UgIiA8PCB1cGNhc2Vfc3RyaW5nKGZpZWxkX25hbWUpIDw8ICI6IiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KG91dCkgPDwgInJldHVybiB0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiOyIgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd24oKTsKK30KKwordm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3JlZmxlY3Rpb25fc2V0dGVycyhvc3RyaW5nc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjYXBfbmFtZSkgeworICAodm9pZCl0eXBlOworICAodm9pZCljYXBfbmFtZTsKKyAgaW5kZW50KG91dCkgPDwgImNhc2UgIiA8PCB1cGNhc2Vfc3RyaW5nKGZpZWxkX25hbWUpIDw8ICI6IiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KG91dCkgPDwgImlmICh2YWx1ZSA9PSBudWxsKSB7IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAiICB1bnNldCIgPDwgZ2V0X2NhcF9uYW1lKGZpZWxkX25hbWUpIDw8ICIoKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgIiAgdGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIiA9IHZhbHVlOyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJicmVhazsiIDw8IGVuZGwgPDwgZW5kbDsKKworICBpbmRlbnRfZ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8PCBzZXJ2aWNlX25hbWVfIDw8ICJJbXBsIiA8PCBleHRlbmRzX2NsaWVudAorICAgICAgICAgICAgICAgICAgICAgPDwgIiBpbXBsZW1lbnRzICIgPDwgc2VydmljZV9uYW1lXyA8PCAiIHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIGZ1bmN0aW9uICIgPDwgc2VydmljZV9uYW1lXyA8PCAiSW1wbCIKKyAgICAgICAgICAgICAgICAgICAgIDw8ICIoaXByb3Q6VFByb3RvY29sLCBvcHJvdDpUUHJvdG9jb2w9bnVsbCkiIDw8IGVuZGw7CisgIHNjb3BlX3VwKGZfc2VydmljZV8pOworICBpZiAoZXh0ZW5kcy5lbXB0eSgpKSB7CisgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiaXByb3RfID0gaXByb3Q7IiA8PCBlbmRsOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImlmIChvcHJvdCA9PSBudWxsKSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIm9wcm90XyA9IGlwcm90OyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0gZWxzZSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIm9wcm90XyA9IG9wcm90OyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0iOworICB9IGVsc2UgeworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgInN1cGVyKGlwcm90LCBvcHJvdCk7IiA8PCBlbmRsOworICB9CisgIHNjb3BlX2Rvd24oZl9zZXJ2aWNlXyk7CisgIGZfc2VydmljZV8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fYmFzZSgpOworICAgICAgc3dpdGNoICh0YmFzZSkgeworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9WT0lEOgorICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IGNhbm5vdCBzZXJpYWxpemUgdm9pZCBmaWVsZCBpbiBhIHN0cnVjdDogIiArIG5hbWU7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgICAgIG91dCA8PCAicmVhZEJpbmFyeSgpOyI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgb3V0IDw8ICJyZWFkU3RyaW5nKCk7IjsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgb3V0IDw8ICJyZWFkQm9vbCgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgb3V0IDw8ICJyZWFkQnl0ZSgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgIG91dCA8PCAicmVhZEkxNigpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAicmVhZEkzMigpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIG91dCA8PCAicmVhZEk2NCgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIG91dCA8PCAicmVhZERvdWJsZSgpOyI7CisgICAgICAgIGJyZWFrOworICA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bXBpbGVyIGVycm9yOiBjYW5ub3Qgc2VyaWFsaXplIHZvaWQgZmllbGQgaW4gYSBzdHJ1Y3Q6ICIgKyBuYW1lOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICBvdXQgPDwgIndyaXRlQmluYXJ5KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAid3JpdGVTdHJpbmcoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAid3JpdGVCb29sKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAid3JpdGVCeXRlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIndyaXRlSTMyKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIndyaXRlSTY0KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlKCIgP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aXRzIHNpemUgdGhlbiB0aGUgZWxlbWVudHMuCisgKgorICogQHBhcmFtIHR0eXBlICBUaGUgdHlwZSBvZiBjb250YWluZXIKKyAqIEBwYXJhbSBwcmVmaXggU3RyaW5nIHByZWZpeCBmb3IgZmllbGRzCisgKi8KK3ZvaWQgdF9hczNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwgdF90eXBlKiB0dHlwZSwgc3RyaW5nIHByZWZpeCkgeworICBzY29wZV91cChvdXQpOworCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBzdHJpbmcgaXRlciA9IHRtcCgiX2tleSIpOworICAgIHN0cmluZyBjb3VudGVyID0gdG1wKCJfc2l6ZUNvdW50ZXIiKTsKKyAgICBpbmRlbnQob3V0KSA8PCAidmFyICIgPDwgY291bnRlciA8PCAiOmludCA9IDA7IiA8PCBlbmRsOworICAgIGluZGVudChvdXQpIDw8ICJmb3IgKHZhciAiIDw8IGl0ZXIgPDwgIjoqIGluICIgPDwgcHJlZml4IDw8ICIpIHsiIDw8IGVuZGw7CisgICAgaW5kZW50KG91dCkgPDwgIiAgIiA8PCBjb3VudGVyIDw8ICsiKys7IiA8PCBlbmRsOworICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworCisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlTWFwQmVnaW4obmV3IFRNYXAoIiA8PCB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkKKyAgICAgICAgICAgICAgICA8PCAiLCAiIDw8IHR5cGVfdG9fZW51bSgoKHRfbWFwKil0dHlwZSktPmdldF92YWxfdHlwZSgpKSA8PCAiLCAiIDw8IGNvdW50ZXIgPDwgIikpOyIKKyAgICAgICAgICAgICAgICA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGluZGVudCh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cGUsIGl0ZXIsIHByZWZpeCk7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50KG91dCwgKHRfc2V0Kil0dHlwZSwgaXRlcik7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LCAodF9saXN0Kil0dHlwZSwgaXRlcik7CisgIH0KKworICBzY29wZV9kb3duKG91dCk7CisKKyAgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZU1hcEVuZCgpOyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVTZXRFbmQoKTsiIDw8IGVuZGw7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZUxpc3RFbmQoKTsiIDw8IGVuZGw7CisgIH0KKworICBzY29wZV9kb3duKG91dCk7Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIG1hcC4KKyAqLwordm9pZCB0X2FzM19nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcCkgeworICB0X2ZpZWxkIGtmaWVsZ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lzLT5vdXRfZGlyX2Jhc2VfID0gImdlbi1jX2dsaWIiOworCisgICAgLyogbm8gb3B0aW9ucyB5ZXQgKi8KKyAgICBmb3IoIGl0ZXIgPSBwYXJzZWRfb3B0aW9ucy5iZWdpbigpOyBpdGVyICE9IHBhcnNlZF9vcHRpb25zLmVuZCgpOyArK2l0ZXIpIHsKKyAgICAgIHRocm93ICJ1bmtub3duIG9wdGlvbiBjX2dsaWI6IiArIGl0ZXItPmZpcnN0OworICAgIH0KKworICAgIC8qIHNldCB0aGUgbmFtZXNwYWNlICovCisgICAgdGhpcy0+bnNwYWNlID0gcHJvZ3JhbV8tPmdldF9uYW1lc3BhY2UoImNfZ2xpYiIpOworCisgICAgaWYgKHRoaXMtPm5zcGFjZS5lbXB0eSgpKSB7CisgICAgICB0aGlzLT5uc3BhY2UgPSAiIjsKKyAgICAgIHRoaXMtPm5zcGFjZV91ID0gIiI7CisgICAgICB0aGlzLT5uc3BhY2VfdWMgPSAiIjsKKyAgICAgIHRoaXMtPm5zcGFjZV9sYyA9ICIiOworICAgIH0gZWxzZSB7CisgICAgICAvKiByZXBsYWNlIGRvdHMgd2l0aCB1bmRlcnNjb3JlcyAqLworICAgICAgY2hhciogdG1wID0gc3RyZHVwKHRoaXMtPm5zcGFjZS5jX3N0cigpKTsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IGkgPSAwOyBpIDwgc3RybGVuKHRtcCk7IGkrKykgeworICAgICAgICBpZiAodG1wW2ldID09ICcuJykgeworICAgICAgICAgIHRtcFtpXSA9ICdfJzsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgdGhpcy0+bnNwYWNlID0gc3RyaW5nKHRtcCwgc3RybGVuKHRtcCkpOworICAgICAgZnJlZSh0bXApOworCisgICAgICAvKiBjbGVhbiB1cCB0aGUgbmFtZXNwYWNlIGZvciBDLgorICAgICAgICogQW4gaW5wdXQgb2YgJ25hbWVzcGFjZSBmb28nIHNob3VsZCByZXN1bHQgaW46CisgICAgICAgKiAgL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AgICAgICAgICAgICAgICAgYm9vbCBpc19mdW5jdGlvbiA9IHRydWUpOworICB2b2lkIGdlbmVyYXRlX3N0cnVjdF9yZWFkZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGhpc19uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHRoaXNfZ2V0ID0gIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2Z1bmN0aW9uID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBzdWZmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpOworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qob3N0cmVhbSYgb3V0LCB0X3N0cnVjdCogdHN0cnVjdCwgc3RyaW5nIHByZWZpeCwgaW50IGVycm9yX3JldCk7CisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihvc3RyZWFtJiBvdXQsIHRfdHlwZSogdHR5cGUsIHN0cmluZyBwcmVmaXgsIGludCBlcnJvcl9yZXQpOworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcga2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpOworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsIHRfc2V0KiB0c2V0LCBzdHJpbmcgZWxlbWVudCwgaW50IGVycm9yX3JldCk7CisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgc3VmZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBhbGxvY2F0ZSA9IHRydWUpOworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGFsbG9jYXRlID0gdHJ1ZSk7CisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwgdF90eXBlKiB0dHlwZSwgc3RyaW5nIHByZWZpeCwgaW50IGVycm9yX3JldCk7CisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LCB0X21hcCogdG1hcCwgc3RyaW5nIHByZWZpeCwgaW50IGVycm9yX3JldCk7CisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQob3N0cmVhbSYgb3V0LCB0X3NldCogdHNldCwgc3RyaW5nIHByZWZpeCwgaW50IGVycm9yX3JldCk7CisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KTsKKworICBzdHJpbmcgZ2VuZXJhdGVfbmV3X2hhc2hfZnJvbV90eXBlKHRfdHlwZSoga2V5LCB0X3R5cGUqIHZhbHVlKTsKKyAgc3RyaW5nIGdlbmVyYXRlX25ld19hcnJheV9mcm9tX3R5cGUodF90eXBlKiB0dHlwZ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W1lX3VjCisgICAgICAgICAgICAgICAgPDwgIl9FUlJPUl9ET01BSU4pOyIgPDwgZW5kbCA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworfQorCisvKioqKioqKioqKioqKioqKioqKioKKyAqIEhFTFBFUiBGVU5DVElPTlMgKgorICoqKioqKioqKioqKioqKioqKioqLworCisvKioKKyAqIFJldHVybnMgdHJ1ZSBpZiB0dHlwZSBpcyBub3QgYSBwcmltaXRpdmUuCisgKi8KK2Jvb2wgdF9jX2dsaWJfZ2VuZXJhdG9yOjppc19jb21wbGV4X3R5cGUodF90eXBlKiB0dHlwZSkgeworICB0dHlwZSA9IGdldF90cnVlX3R5cGUodHR5cGUpOworCisgIHJldHVybiB0dHlwZS0+aXNfY29udGFpbmVyKCkgfHwgdHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR0eXBlLT5pc194Y2VwdGlvbigpOworfQorCitib29sIHRfY19nbGliX2dlbmVyYXRvcjo6aXNfbnVtZXJpYyh0X3R5cGUqIHR0eXBlKSB7CisgIHJldHVybiB0dHlwZS0+aXNfZW51bSgpIHx8ICh0dHlwZS0+aXNfYmFzZV90eXBlKCkgJiYgIXR0eXBlLT5pc19zdHJpbmcoKSk7Cit9CisKKy8qKgorICogTWFwcyBhIFRocmlmdCB0X3R5cGUgdG8gYSBDIHR5cGUuCisgKi8KK3N0cmluZyB0X2NfZ2xpYl9nZW5lcmF0b3I6OnR5cGVfbmFtZSh0X3R5cGUqIHR0eXBlLCBib29sIGluX3R5cGVkZWYsIGJvb2wgaXNfY29uc3QpIHsKKyAgaWYgKHR0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIHN0cmluZyBibmFtZSA9IGJhc2VfdHlwZV9uYW1lKHR0eXBlKTsKKworICAgIGlmIChpc19jb25zdCkgeworICAgICAgcmV0dXJuICJjb25zdCAiICsgYm5hbWU7CisgICAgfSBlbHNlIHsKKyAgICAgIHJldHVybiBibmFtZTsKKyAgICB9CisgIH0KKworICBpZiAodHR5c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Rpb25fbGlzdCh0X3N0cnVjdCogdHN0cnVjdCkgeworICBzdHJpbmcgcmVzdWx0ID0gIiI7CisKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKyAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworICBib29sIGZpcnN0ID0gdHJ1ZTsKKyAgZm9yIChmX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZl9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmX2l0ZXIpIHsKKyAgICBpZiAoZmlyc3QpIHsKKyAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgfSBlbHNlIHsKKyAgICAgIHJlc3VsdCArPSAiLCAiOworICAgIH0KKyAgICByZXN1bHQgKz0gdHlwZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X3R5cGUoKSwgZmFsc2UsIGZhbHNlKSArICIqICIgKyAoKmZfaXRlciktPmdldF9uYW1lKCk7CisgIH0KKyAgcmV0dXJuIHJlc3VsdDsKK30KKworLyoqCisgKiBEZWNsYXJlcyBhIGZpZWxkLCBpbmNsdWRpbmcgYW55IG5lY2Vzc2FyeSBpbml0aWFsaXphdGlvbi4KKyAqLworc3RyaW5nIHRfY19nbGliX2dlbmVyYXRvcjo6ZGVjbGFyZV9maWVsZCh0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5pdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNvbnN0YW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlZmVyZW5jZSkgeworICBzdHJpbmcgcmVzdWx0ID0gIiI7CisgIGlmIChjb25zdGFud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CBjb25zdGFudF92YWx1ZShmbmFtZSwgKHRfdHlwZSopZXR5cGUsIHZhbHVlKSA8PCAiOyIKKyAgICAgICAgICAgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICByZW5kZXIgPDwgIiAgICAiIDw8IHR5cGVfbmFtZShldHlwZSkgPDwgIiAiIDw8IGZuYW1lIDw8ICIgPSAiCisgICAgICAgICAgIDw8IGNvbnN0YW50X3ZhbHVlKGZuYW1lLCAodF90eXBlKilldHlwZSwgdmFsdWUpIDw8ICI7IiA8PCBlbmRsOworICB9CisgIHJldHVybiByZW5kZXIuc3RyKCk7Cit9CisKKy8qKgorICogR2VuZXJhdGVzIEMgY29kZSB0aGF0IGluaXRpYWxpemVzIGNvbXBsZXggY29uc3RhbnRzLgorICovCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfY29uc3RfaW5pdGlhbGl6ZXIoc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgdG9wX2xldmVsKSB7CisgIHN0cmluZyBuYW1lX3UgPSBpbml0aWFsX2NhcHNfdG9fdW5kZXJzY29yZXMobmFtZSk7CisgIHN0cmluZyBuYW1lX2xjID0gdG9fbG93ZXJfY2FzZShuYW1lX3UpOworICBzdHJpbmcgdHlwZV91ID0gaW5pdGlhbF9jYXBzX3RvX3VuZGVyc2NvcmVzKHR5cGUtPmdldF9uYW1lKCkpOworICBzdHJpbmcgdHlwZV91YyA9IHRvX3VwcGVyX2Nhc2UodHlwZV91KTsKKyAgc3RyaW5nIG1heWJlX3N0YXRpYyA9IHRvcF9sZXZlbCA/ICIiIDog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fbmFtZSA9ICgqZl9pdGVyKS0+Z2V0X25hbWUoKTsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgaWYgKGZpZWxkX3R5cGUgPT0gTlVMTCkgeworICAgICAgICB0aHJvdyAidHlwZSBlcnJvcjogIiArIHR5cGUtPmdldF9uYW1lKCkgKyAiIGhhcyBubyBmaWVsZCAiCisgICAgICAgICAgKyB2X2l0ZXItPmZpcnN0LT5nZXRfc3RyaW5nKCk7CisgICAgICB9CisgICAgICBmaWVsZF9uYW1lID0gdG1wKGZpZWxkX25hbWUpOworCisgICAgICBnZW5lcmF0ZV9jb25zdF9pbml0aWFsaXplcihuYW1lICsgIl9jb25zdGFudF8iICsgZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2X2l0ZXItPnNlY29uZCk7CisgICAgICBpbml0aWFsaXplcnMgPDwgIiAgICBjb25zdGFudC0+IiA8PCB2X2l0ZXItPmZpcnN0LT5nZXRfc3RyaW5nKCkgPDwgIiA9ICIKKyAgICAgICAgICAgICAgICAgICA8PCBjb25zdGFudF92YWx1ZShuYW1lICsgIl9jb25zdGFudF8iICsgZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZfaXRlci0+c2Vjb25kKSA8PCAiOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgIDw8ICIgICAgY29uc3RhbnQtPl9faXNzZXRfIiA8PCB2X2l0ZXItPmZpcnN0LT5nZXRfc3RyaW5nKCkKKyAgICAgICAgICAgICAgICAgICA8PCAiID0gVFJVRTsiIDw8IGVuZGw7CisgICAgfQorCisgICAgLy8gaW1wbGVtZW50IHRoZSBpbml0aWFsaXplcgorICAgIGZfdHlwZXNfaW1wbF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worICAgICAgICBsaXN0X2FwcGVuZGVyID0gImdfYXJyYXlfYXBwZW5kX3ZhbCI7CisgICAgICAgIGxpc3RfdmFyaWFibGUgPSB0cnVlOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gYXJyYXkgaW5mbyBmb3IgdHlwZSI7CisgICAgICB9CisgICAgfSBlbHNlIGlmIChldHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBsaXN0X3R5cGUgPSAiR0FycmF5ICoiOworICAgICAgbGlzdF9hcHBlbmRlciA9ICJnX2FycmF5X2FwcGVuZF92YWwiOworICAgICAgbGlzdF92YXJpYWJsZSA9IHRydWU7CisgICAgfQorCisgICAgZm9yICh2X2l0ZXIgPSB2YWwuYmVnaW4oKTsgdl9pdGVyICE9IHZhbC5lbmQoKTsgKyt2X2l0ZXIpIHsKKyAgICAgIHN0cmluZyBmbmFtZSA9IHRtcChuYW1lKTsKKworICAgICAgZ2VuZXJhdGVfY29uc3RfaW5pdGlhbGl6ZXIoZm5hbWUsIGV0eXBlLCAoKnZfaXRlcikpOworICAgICAgaWYgKGxpc3RfdmFyaWFibGUpIHsKKyAgICAgICAgaW5pdGlhbGl6ZXJzIDw8ICIgICAgIiA8PCB0eXBlX25hbWUoZXR5cGUpIDw8ICIgIiA8PCBmbmFtZSA8PCAiID0gIgorICAgICAgICAgICAgICAgICAgICAgPDwgY29uc3RhbnRfdmFsdWUoZm5hbWUsICh0X3R5cGUqKWV0eXBlLCAoKnZfaXRlcikpIDw8ICI7IgorICAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgICAgYXBwZW5kZXJzIDw8ICIgICAgIiA8PCBsaXN0X2FwcGVuZGVyIDw8ICIoY29uc3RhbnQsICIgPDwgZm5hbWUgPDwgIik7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGFwcGVuZGVycyA8PCAiICAgICIgPDwgbGlzdF9hcHBlbmRlciA8PCAiKGNvbnN0YW50LCAiCisgICAgICAgICAgICAgICAgICA8PCBjb25zdGFudF92YWx1ZShmbmFtZSwgKHRfdHlwZSopZXR5cGUsICgqdl9pdGVyKSkgPDwgIik7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIH0KKyAgICB9CisKKyAgICBmX3R5cGVzX2ltcGxfIDw8IG1heWJlX3N0YXRpYyA8PCBsaXN0X3R5cGUgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgPDwgdGhpcy0+bnNwYWNlX2xjIDw8IG5hbWVfbGMgPDwgIl9jb25zdGFudCAodm9pZCkiIDw8IGVuZGw7CisgICAgc2NvcGVfdXAoZl90eXBlc19pbXBsXyk7CisgICAgZl90eXBlc19pbXBsXyA8PCBpbmRlbnQoKSA8PCAic3RhdGljICIgPDwgbGlzdF90eXBlIDw8ICIgY29uc3RhbnQgPSBOVUxMOyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAoY29uc3RhbnQgPT0gTlVMTCkiIDw8IGVuZGw7CisgICAgc2NvcGVfdXAoZl90eXBlc19pbXBsXyk7CisgICAgaWYgKCFpbml0aWFsaXplcnMuc3RyKCkuZW1wdHkoKSkgeworICAgICAgZl90eXBlc19pbXBsXyA8PCBpbml0aWFsaXplcnMuc3RyKCkKKyAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICB9CisgICAgZl90eXBlc19pbXBsXyA8PCBpbmRlbnQoKSA8PCAiY29uc3RhbnQgPSAiIDw8IGxpc3RfaW5pdGlhbGl6ZXIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgPDwgYXBwZW5kZXJzLnN0cigpOworICAgIHNjb3BlX2Rvd24oZl90eXBlc19pbX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RfYXJnbGlzdCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF94Y2VwdGlvbnMoKSk7CisgICAgaW5kZW50KGZfaGVhZGVyXykgPDwgZnVuY3Rpb25fc2lnbmF0dXJlKCZzZXJ2aWNlX2Z1bmN0aW9uKSA8PCAiOyIgPDwgZW5kbDsKKworICAgIHRfZnVuY3Rpb24gc2VuZF9mdW5jdGlvbihnX3R5cGVfdm9pZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV9uYW1lX2xjICsgc3RyaW5nKCJfY2xpZW50X3NlbmRfIikgKyBmdW5uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF9hcmdsaXN0KCkpOworICAgIGluZGVudChmX2hlYWRlcl8pIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSgmc2VuZF9mdW5jdGlvbikgPDwgIjsiIDw8IGVuZGw7CisKKyAgICAvLyBpbXBsZW1lbnQgcmVjdiBpZiBub3QgYSBvbmV3YXkgc2VydmljZQorICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgdF9zdHJ1Y3Qgbm9hcmdzKHByb2dyYW1fKTsKKyAgICAgIHRfZnVuY3Rpb24gcmVjdl9mdW5jdGlvbigoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV9uYW1lX2xjICsgc3RyaW5nKCJfY2xpZW50X3JlY3ZfIikgKyBmdW5uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZub2FyZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCpmX2l0ZXIpLT5nZXRfeGNlcHRpb25zKCkpOworICAgICAgaW5kZW50KGZfaGVhZGVyXykgPDwgZnVuY3Rpb25fc2lnbmF0dXJlKCZyZWN2X2Z1bmN0aW9uKSA8PCAiOyIgPD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ybiBGQUxTRTsiIDw8IGVuZGwgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIFRSVUU7IgorICAgICAgICAgICAgICAgPDwgZW5kbDsKKworICAgIHNjb3BlX2Rvd24oZl9zZXJ2aWNlXyk7CisgICAgZl9zZXJ2aWNlXyA8PCBlbmRsOworCisgICAgLy8gR2VuZXJhdGUgcmVjdiBmdW5jdGlvbiBvbmx5IGlmIG5vdCBhbiBhc3luYyBmdW5jdGlvbgorICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgdF9zdHJ1Y3Qgbm9hcmdzKHByb2dyYW1fKTsKKyAgICAgIHRfZnVuY3Rpb24gcmVjdl9mdW5jdGlvbigoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV9uYW1lX2xjICsgc3RyaW5nKCJfY2xpZW50X3JlY3ZfIikgKyBmdW5uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZub2FyZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCpmX2l0ZXIpLT5nZXRfeGNlcHRpb25zKCkpOworICAgICAgLy8gT3BlbiBmdW5jdGlvbgorICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSgmcmVjdl9mdW5jdGlvbikgPDwgZW5kbDsKKyAgICAgIHNjb3BlX3VwKGZfc2VydmljZV8pOworCisgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJnaW50MzIgcnNlcWlkOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiZ2NoYXIgKiBmbmFtZSA9IE5VTEw7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJUaHJpZnRNZXNzYWdlVHlwZSBtdHlwZTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgIlRocmlmdFByb3RvY29sICogcHJvdG9jb2wgPSAiCisgICAgICAgICAgICAgICAgIDw8IHRoaXMtPm5zcGFjZV91YyA8PCBiYXNlX3NlcnZpY2VfbmFtZV91YworICAgICAgICAgICAgICAgICA8PCAiX0NMSUVOVCAoaWZhY2UpLT5pbnB1dF9wcm90b2NvbDsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgIlRocmlmdEFwcGxpY2F0aW9uRXhjZXB0aW9uICp4Y2VwdGlvbjsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiaWYgKHRocmlmdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gIgorICAgICAgICAgICAgICAgICAgICAiKHByb3RvY29sLCAmZm5hbWUsICZtdHlwZSwgJnJzZXFpZCwgZXJyb3IpIDwgMCkgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiaWYgKGZuYW1lKSBnX2ZyZWUgKGZuYW1lKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInJldHVybiBGQUxTRTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAobXR5cGUgPT0gVF9FWENFUFRJT04pIHsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImlmIChmbmFtZSkgZ19mcmVlIChmbmFtZSk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ4Y2VwdGlvbiA9IGdfb2JqZWN0X25ldyAiCisgICAgICAgICAgICAgICAgICAgICIoVEhSSUZUX1RZUEVfQVBQTElDQVRJT05fRVhDRVBUSU9OLCBOVUxMKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInRocmlmdF9zdHJ1Y3RfcmVhZCAoVEhSSUZUX1NUUlVDVCAoeGNlcHRpb24pLCAiCisgICAgICAgICAgICAgICAgICAgICJwcm90b2NvbCwgTlVMTCk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ0aHJpZnRfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2VuZCAiCisgICAgICAgICAgICAgICAgICAgICIocHJvdG9jb2wsIE5VTEwpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAidGhyaWZ0X3RyYW5zcG9ydF9yZWFkX2VuZCAiCisgICAgICAgICAgICAgICAgICAgICIocHJvdG9jb2wtPnRyYW5zcG9ydCwgTlVMTCk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJnX3NldF9lcnJvciAoZXJyb3IsICIKKyAgICAgICAgICAgICAgICAgICAgIlRIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT05fRVJST1IseGNlcHRpb24tPnR5cGUsICIKKyAgICAgICAgICAgICAgICAgICAgIlwiYXBwbGljYXRpb24gZXJyb3I6ICVzXCIsIHhjZXB0aW9uLT5tZXNzYWdlKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgImdfb2JqZWN0X3VucmVmICh4Y2VwdGlvbik7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJyZXR1cm4gRkFMU0U7IiA8PCBlbmRsOworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0gZWxzZSBpZiAobXR5cGUgIT0gVF9SRVBMWSkgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiaWYgKGZuYW1lKSBnX2ZyZWUgKGZuYW1lKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInRocmlmdF9wcm90b2NvbF9za2lwIChwcm90b2NvbCwgVF9TVFJVQ1QsICIKKyAgICAgICAgICAgICAgICAgICAgIk5VTEwpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAidGhyaWZ0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9lbmQgKHByb3RvY29sLCAiCisgICAgICAgICAgICAgICAgICAgICJOVUxMKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInRocmlmdF90cmFuc3BvcnRfcmVhZF9lbmQgKCIKKyAgICAgICAgICAgICAgICAgICAgInByb3RvY29sLT50cmFuc3BvcnQsIE5VTEwpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiZ19zZXRfZXJyb3IgKGVycm9yLCAiCisgICAgICAgICAgICAgICAgICAgICJUSFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX0VSUk9SLCAiCisgICAgICAgICAgICAgICAgICAgICJUSFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX0VSUk9SX0lOVkFMSURfTUVTU0FHRV9UWVBFLCAiCisgICAgICAgICAgICAgICAgICAgICJcImludmFsaWQgbWVzc2FnZSB0eXBlICVkLCBleHBlY3RlZCBUX1JFUExZXCIsIG10eXBlKTsiCisgICAgICAgICAgICAgICAgIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInJldHVybiBGQUxTRTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAifSBlbHNlIGlmIChzdHJuY21wIChmbmFtZSwgXCIiIDw8IG5hbWUKKyAgICAgICAgICAgICAgICAgPDwgIlwiLCAiIDw8IG5hbWUubGVuZ3RoKCkgPDwgIikgIT0gMCkgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAidGhyaWZ0X3Byb3RvY29sX3NraXAgKHByb3RvY29sLCBUX1NUUlVDVCwgIgorICAgICAgICAgICAgICAgICAgICAiTlVMTCk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ0aHJpZnRfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2VuZCAocHJvdG9jb2wsIgorICAgICAgICAgICAgICAgICAgICAiZXJyb3IpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAidGhyaWZ0X3RyYW5zcG9ydF9yZWFkX2VuZCAoIgorICAgICAgICAgICAgICAgICAgICAicHJvdG9jb2wtPnRyYW5zcG9ydCwgZXJyb3IpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiZ19zZXRfZXJyb3IgKGVycm9yLCAiCisgICAgICAgICAgICAgICAgICAgICJUSFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX0VSUk9SLCAiCisgICAgICAgICAgICAgICAgICAgICJUSFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX0VSUk9SX1dST05HX01FVEhPRF9OQU1FLCAiCisgICAgICAgICAgICAgICAgICAgICJcIndyb25nIG1ldGhvZCBuYW1lICVzLCBleHBlY3RlZCAiIDw8IG5hbWUKKyAgICAgICAgICAgICAgICAgICAgPDwgIlwiLCBmbmFtZSk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAoZm5hbWUpIGdfZnJlZSAoZm5hbWUpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIEZBTFNFOyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAoZm5hbWUpIGdfZnJlZSAoZm5hbWUpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBlbmRsOworCisgICAgICB0X3N0cnVjdCogeHMgPSAoKmZfaXRlciktPmdldF94Y2VwdGlvbnMoKTsKKyAgICAgIGNvbnN0IHN0ZDo6dmVjdG9yPHRfZmllbGQqPiYgeGNlcHRpb25zID0geHMtPmdldF9tZW1iZXJzKCk7CisgICAgICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciB4X2l0ZXI7CisKKyAgICAgIHsKKyAgICAgICAgdF9zdHJ1Y3QgcmVzdWx0KHByb2dyYW1fLCB0c2VydmljZS0+Z2V0X25hbWUoKSArICJfIiArICgqZl9pdGVyKS0+Z2V0X25hbWUoKSArICJfcmVzdWx0Iik7CisgICAgICAgIHRfZmllbGQgc3VjY2VzcygoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksICIqX3JldHVybiIsIDApOworICAgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgICAgcmVzdWx0LmFwcGVuZCgmc3VjY2Vzcyk7CisgICAgICAgIH0KKworICAgICAgICAvLyBhZGQgcmVhZGVycyBmb3IgZXhjZXB0aW9ucywgZGVyZWZlcmVuY2luZyB0aGUgcG9pbnRlci4KKyAgICAgICAgZm9yICh4X2l0ZXIgPSB4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9IHhjZXB0aW9ucy5lbmQoKTsgeF9pdGVyKyspIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiaWYgKCoiIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiICE9IE5VTEwpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgIiAgICBnX3NldF9lcnJvciAoZXJyb3IsICIKKyAgICAgICAgICAgICAgICAgICA8PCB0aGlzLT5uc3BhY2VfdWMKKyAgICAgICAgICAgICAgICAgICA8PCB0b191cHBlcl9jYXNlKGluaXRpYWxfY2Fwc190b191bmRlcnNjb3JlcygoKnhfaXRlciktPmdldF90eXBlKCktPmdldF9uYW1lKCkpKQorICAgICAgICAgICAgICAgICAgIDw8ICJfRVJST1IsICIgPDwgdGhpcy0+bnNwYWNlX3VjCisgICAgICAgICAgICAgICAgICAgPDwgdG9fdXBwZXJfY2FzZShpbml0aWFsX2NhcHNfdG9fdW5kZXJzY29yZXMoKCp4X2l0ZXIpLT5nZXRfdHlwZSgpLT5nZXRfbmFtZSgpKSkKKyAgICAgICAgICAgICAgICAgICA8PCAiX0VSUk9SX0NPREUsIFwiIiA8PCAoKnhfaXRlciktPmdldF90eXBlKCktPmdldF9uYW1lKCkgPDwgIlwiKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiICAgIHJldHVybiBGQUxTRTsiIDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7CisgICAgICB9CisgICAgICAvLyBDbG9zZSBmdW5jdGlvbgorICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJyZXR1cm4gVFJVRTsiIDw8IGVuZGw7CisgICAgICBzY29wZV9kb3duKGZfc2VydmljZV8pOworICAgICAgZl9zZXJ2aWNlXyA8PCBlbmRsOworICAgIH0KKworICAgIC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m90b2NvbFwiLCIgPDwgZW5kbAorICAgICAgICAgICAgICAgPDwgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRIUklGVF9UWVBFX1BST1RPQ09MLCIgPDwgZW5kbAorICAgICAgICAgICAgICAgPDwgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fUkVBRFdSSVRFKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgIDw8ICIgIGdfb2JqZWN0X2NsYXNzX2luc3RhbGxfcHJvcGVydHkgKGdvYmplY3RfY2xhc3MsIiA8PCBlbmRsCisgICAgICAgICAgICAgICA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9QXyIgPDwgdGhpcy0+bnNwYWNlX3VjIDw8IHNlcnZpY2VfbmFtZV91YworICAgICAgICAgICAgICAgPDwgIl9DTElFTlRfSU5QVVRfUFJPVE9DT0wsIHBhcmFtX3NwZWMpOyIgPDwgZW5kbCA8PCBlbmRsCisgICAgICAgICAgICAgICA8PCAiICBwYXJhbV9zcGVjID0gZ19wYXJhbV9zcGVjX29iamVjdCAoXCJvdXRwdXRfcHJvdG9jb2xcIiwiIDw8IGVuZGwKKyAgICAgICAgICAgICAgIDw8ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm91dHB1dCBwcm90b2NvbCAoY29uc3RydWN0KVwiLCIgPDwgZW5kbAorICAgICAgICAgICAgICAgPDwgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiU2V0IHRoZSBjbGllbnQgb3V0cHV0IHByb3RvY29sXCIsIiA8PCBlbmRsCisgICAgICAgICAgICAgICA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZUX1RZUEVfUFJPVE9DT0wsIiA8PCBlbmRsCisgICAgICAgICAgICAgICA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19QQVJBTV9SRUFEV1J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WUgPSAoKmZ1bmN0aW9uX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgIHN0cmluZyBtZXRob2RfbmFtZSA9IGluaXRpYWxfY2Fwc190b191bmRlcnNjb3JlcyhmdW5jdGlvbl9uYW1lKTsKKyAgICB0X3R5cGUqIHJldHVybl90eXBlID0gKCpmdW5jdGlvbl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKTsKKyAgICB0X3N0cnVjdCogYXJnX2xpc3QgPSAoKmZ1bmN0aW9uX2l0ZXIpLT5nZXRfYXJnbGlzdCgpOworICAgIHRfc3RydWN0KiB4X2xpc3QgPSAoKmZ1bmN0aW9uX2l0ZXIpLT5nZXRfeGNlcHRpb25zKCk7CisKKyAgICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBhcmdzID0gYXJnX2xpc3QtPmdldF9tZW1iZXJzKCk7CisgICAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgeGNlcHRpb25zID0geF9saXN0LT5nZXRfbWVtYmVycygpOworCisgICAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZmllbGRfaXRlcjsKKworICAgIHRfZnVuY3Rpb24gaW1wbGVtZW50aW5nX2Z1bmN0aW9uKHJldHVybl90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfbmFtZV9sYyArICJfaGFuZGxlcl8iICsgbWV0aG9kX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnX2xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeF9saXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgqZnVuY3Rpb25faXRlciktPmlzX29uZXdheSgpKTsKKworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCBmdW5jdGlvbl9zaWduYXR1cmUoJmltcGxlbWVudGluZ19mdW5jdGlvbikgPDwgZW5kbDsKKyAgICBzY29wZV91c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aGUgcmVzdWx0LCBpZiBhbnksIHRvIHRoZSBjYWxsZXIKKyAgICBpZiAoISgqZnVuY3Rpb25faXRlciktPmlzX29uZXdheSgpKSB7CisgICAgICBpZiAoaGFzX3JldHVybl92YWx1ZSkgeworICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJnX29iamVjdF9zZXQgKHJlc3VsdF9zdHJ1Y3QsIFwic3VjY2Vzc1wiLCAiOworICAgICAgICBpZiAodHlwZV9uYW1lKHJldHVybl90eXBlKSAhPSBwcm9wZXJ0eV90eXBlX25hbWUocmV0dXJuX3R5cGUpKSB7CisgICAgICAgICAgLy8gUm91bmR0cmlwIGNhc3QgdG8gZml4IHRoZSBwb3NpdGlvbiBvZiBzaWduIGJpdC4KKyAgICAgICAgICBmX3NlcnZpY2VfIDw8ICIoIiA8PCBwcm9wZXJ0eV90eXBlX25hbWUocmV0dXJuX3R5cGUpIDw8ICIpIgorICAgICAgICAgICAgICAgICAgICAgPDwgIigiIDw8IHR5cGVfbmFtZShyZXR1cm5fdHlwZSkgPDwgIikiOworICAgICAgICB9CisgICAgICAgIGZfc2VydmljZV8gPDwgInJldHVybl92YWx1ZSwgIgorICAgICAgICAgICAgICAgICAgIDw8ICJOVUxMKTsiIDw8IGVuZGw7CisKKyAgICAgICAgLy8gRGVhbGxvY2F0ZSAob3IgdW5yZWYpIHJldHVybl92YWx1ZQorICAgICAgICByZXR1cm5fdHlwZSA9IGdldF90cnVlX3R5cGUocmV0dXJuX3R5cGUpOworICAgICAgICBpZiAocmV0dXJuX3R5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgICAgICAgdF9iYXNlX3R5cGUqIGJhc2VfdHlwZSA9ICgodF9iYXNlX3R5cGUqKXJldHVybl90eXBlKTsKKworICAgICAgICAgIGlmIChiYXNlX3R5cGUtPmdldF9iYXNlKCkgPT0gdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HKSB7CisgICAgICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJpZiAocmV0dXJuX3ZhbHVlICE9IE5VTEwpIiA8PCBlbmRsOworICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICBpZiAoYmFzZV90eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJnX2J5dGVfYXJyYXlfdW5yZWYgKHJldHVybl92YWx1ZSk7IiA8PCBlbmRsOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiZ19mcmVlIChyZXR1cm5fdmFsdWUpOyIgPDwgZW5kbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKHJldHVybl90eXBlLT5pc19jb250YWluZXIoKSkgeworICAgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImlmIChyZXR1cm5fdmFsdWUgIT0gTlVMTCkiIDw8IGVuZGw7CisgICAgICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgICAgICBpZiAocmV0dXJuX3R5cGUtPmlzX2xpc3QoKSkgeworICAgICAgICAgICAgdF90eXBlKiBlbGVtX3R5cGUgPSAoKHRfbGlzdCopcmV0dXJuX3R5cGUpLT5nZXRfZWxlbV90eXBlKCk7CisKKyAgICAgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCk7CisgICAgICAgICAgICBpZiAoaXNfbnVtZXJpYyhlbGVtX3R5cGUpKSB7CisgICAgICAgICAgICAgIGZfc2VydmljZV8gPDwgImdfYXJyYXlfdW5yZWYiOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgZl9zZXJ2aWNlXyA8PCAiZ19wdHJfYXJyYXlfdW5yZWYiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZl9zZXJ2aWNlXy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MTCkiIDw8IGVuZGw7CisgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgaWYgKGJhc2VfdHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImdfYnl0ZV9hcnJheV91bnJlZiAoIiA8PCBhcmdfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImdfZnJlZSAoIiA8PCBhcmdfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgfQorICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSBpZiAoYXJnX3R5cGUtPmlzX2NvbnRhaW5lcigpKSB7CisgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImlmICgiIDw8IGFyZ19uYW1lIDw8ICIgIT0gTlVMTCkiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworCisgICAgICAgIGlmIChhcmdfdHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICAgICAgdF90eXBlKiBlbGVtX3R5cGUgPSAoKHRfbGlzdCopYXJnX3R5cGUpLT5nZXRfZWxlbV90eXBlKCk7CisKKyAgICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpOworICAgICAgICAgIGlmIChpc19udW1lcmljKGVsZW1fdHlwZSkpIHsKKyAgICAgICAgICAgIGZfc2VydmljZV8gPDwgImdfYXJyYXlfdW5yZWYiOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmX3NlcnZpY2VfIDw8ICJnX3B0cl9hcnJheV91bnJlZiI7CisgICAgICAgICAgfQorICAgICAgICAgIGZfc2VydmljZV8gPDwgIiAoIiA8PCBhcmdfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgIH0gZWxzZSBpZiAoYXJnX3R5cGUtPmlzX21hcCgpIHx8IGFyZ190eXBlLT5pc19zZXQoKSkgeworICAgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImdfaGFzaF90YWJsZV91bnJlZiAoIiA8PCBhcmdfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgfSBlbHNlIGlmIChhcmdfdHlwZS0+aXNfc3RydWN0KCkpIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiaWYgKCIgPDwgYXJnX25hbWUgPDwgIiAhPSBOVUxMKSIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImdfb2JqZWN0X3VucmVmICgiIDw8IGFyZ19uYW1lIDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIH0KKyAgICB9CisKKyAgICBpZiAoISgqZnVuY3Rpb25faXRlciktPmlzX29uZXdheSgpKSB7CisgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJnX29iamVjdF91bnJlZiAocmVzdWx0X3N0cnVjdCk7IiA8PCBlbmRsIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICAgPDwgImlmIChyZXN1bHQgPT0gVFJVRSkiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgInJlc3VsdCA9IiA8PCBlbmRsOworICAgICAgaW5kZW50X3VwKCk7CisgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICIoKHRocmlmdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2VuZCAiCisgICAgICAgICAgICAgICAgIDw8ICIob3V0cHV0X3Byb3RvY29sLCBlcnJvcikgIT0gLTEpICYmI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gorICAgICAgICAgICAgYXNzaWduX2Z1bmN0aW9uX25hbWUgPSAiZ192YWx1ZV9nZXRfaW50IjsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgICBhc3NpZ25fZnVuY3Rpb25fbmFtZSA9ICJnX3ZhbHVlX2dldF9pbnQ2NCI7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICAgICAgYXNzaWduX2Z1bmN0aW9uX25hbWUgPSAiZ192YWx1ZV9nZXRfZG91YmxlIjsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogIgorICAgICAgICAgICAgICAgICAgInVucmVjb2duaXplZCBiYXNlIHR5cGUgXCIiICsgYmFzZV90eXBlLT5nZXRfbmFtZSgpICsgIlwiICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJmb3Igc3RydWN0IG1lbWJlciBcIiIKKyAgICAgICAgICAgICAgICArIG1lbWJlcl9uYW1lICsgIlwiIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZfdHlwZXNfaW1wbF8gPDwgaW5kZW50KCkgPDwgInNlbGYtPiIgPDwgbWVtYmVyX25hbWUgPDwgIiA9ICIgPDwgYXNzaWduX2Z1bmN0aW9uX25hbWUKKyAgICAgICAgICAgICAgICAgICAgICA8PCAiICh2YWx1ZSk7IiA8PCBlbmRsOworICAgICAgfSBlbHNlIGlmIChtZW1iZXJfdHlwZS0+aXNfZW51bSgpKSB7CisgICAgICAgIGZfdHlwZXNfaW1wbF8gPDwgaW5kZW50KCkgPDwgInNlbGYtPiIgPDwg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AgICAgaWYgKGJhc2VfdHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICAgIHNldHRlcl9mdW5jdGlvbl9uYW1lID0gImdfdmFsdWVfc2V0X2JveGVkIjsKKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc2V0dGVyX2Z1bmN0aW9uX25hbWUgPSAiZ192YWx1ZV9zZXRfc3RyaW5nIjsKKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6ICIKKyAgICAgICAgICAgICAgICAidW5yZWNvZ25pemVkIGJhc2UgdHlwZSBcIiIgKyBiYXNlX3R5cGUtPmdldF9uYW1lKCkgKyAiXCIgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJmb3Igc3RydWN0IG1lbWJlciBcIiIKKyAgICAgICAgICAgICAgKyBtZW1iZXJfbmFtZSArICJcIiI7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSBpZiAobWVtYmVyX3R5cGUtPmlzX2VudW0oKSkgeworICAgICAgICBzZXR0ZXJfZnVuY3Rpb25fbmFtZSA9ICJnX3ZhbHVlX3NldF9pbnQiOworICAgICAgfSBlbHNlIGlmIChtZW1iZXJfdHlwZS0+aXNfc3RydWN0KCkgfHwgbWVtYmVyX3R5cGUtPmlzX3hjZXB0aW9uKCkpIHsKKyAgICAgICAgc2V0dGVyX2Z1bmN0aW9uX25hbWUgPSAiZ192YWx1ZV9zZXRfb2JqZWN0IjsKKyAgICAgIH0gZWxzZSBpZiAobWVtYmVyX3R5cGUtPmlzX2NvbnRhaW5lcigpKSB7CisgICAgICAgIHNldHRlcl9mdW5jdGlvbl9uYW1lID0gImdfdmFsdWVfc2V0X2JveGVkIjsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHRocm93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IGluZGVudChmX3R5cGVzX2ltcGxfKSA8PCAib2JqZWN0LT4iIDw8IG5hbWUgPDwgIiA9IE5VTEw7IiA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodC0+aXNfY29udGFpbmVyKCkpIHsKKyAgICAgIHN0cmluZyBuYW1lID0gKCptX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgICAgc3RyaW5nIGluaXRfZnVuY3Rpb247CisgICAgICB0X3R5cGUqIGV0eXBlID0gTlVMTDsKKworICAgICAgaWYgKHQtPmlzX21hcCgpKSB7CisgICAgICAgIHRfdHlwZSoga2V5ID0gKCh0X21hcCopdCktPmdldF9rZXlfdHlwZSgpOworICAgICAgICB0X3R5cGUqIHZhbHVlID0gKCh0X21hcCopdCktPmdldF92YWxfdHlwZSgpOworICAgICAgICBpbml0X2Z1bmN0aW9uID0gZ2VuZXJhdGVfbmV3X2hhc2hfZnJvbV90eXBlKGtleSwgdmFsdWUpOworICAgICAgfSBlbHNlIGlmICh0LT5pc19zZXQoKSkgeworICAgICAgICBldHlwZSA9ICgodF9zZXQqKXQpLT5nZXRfZWxlbV90eXBlKCk7CisgICAgICAgIGluaXRfZnVuY3Rpb24gPSBnZW5lcmF0ZV9uZXdfaGFzaF9mcm9tX3R5cGUoZXR5cGUsIE5VTEwpOworICAgICAgfSBlbHNlIGlmICh0LT5pc19saXN0KCkpIHsKKyAgICAgICAgZXR5cGUgPSAoKHRfbGlzdCopdCktPmdldF9lbGVtX3R5cGUoKTsKKyAgICAgICAgaW5pdF9mdW5jdGlvbiA9IGdlbmVyYXRlX25ld19hcnJheV9mcm9tX3R5cGUoZXR5cGUpOworICAgICAgfQorCisgICAgICBpbmRlbnQoZl90eXBlc19pbXBsXykgPDwgIm9iamVjdC0+IiA8PCBuYW1lIDw8ICIgPSAiIDw8IGluaXRfZnVuY3Rpb24gPDwgZW5kbDsKKworICAgICAgLy8gUHJlLXBvcHVsYXRlIHRoZSBjb250YWluZXIgd2l0aCB0aGUgc3BlY2lmaWVkIGRlZmF1bHQgdmFsdWVzLCBpZiBhbnkKKyAgICAgIGlmICgoKm1faXRlciktPmdldF92YWx1ZSgpKSB7CisgICAgICAgIHRfY29uc3RfdmFsdWUqIG1lbWJlcl92YWx1ZSA9ICgqbV9pdGVyKS0+Z2V0X3ZhbHVlKCk7CisKKyAgICAgICAgaWYgKHQtPmlzX2xpc3QoKSkgeworICAgICAgICAgIGNvbnN0IHZlY3Rvcjx0X2NvbnN0X3ZhbHVlKj4mIGxpc3QgPSBtZW1iZXJfdmFsdWUtPmdldF9saXN0KCk7CisKKyAgICAgICAgICBpZiAoaXNfbnVtZXJpYyhldHlwZSkpIHsKKyAgICAgICAgICAgIGluZGVudChmX3R5cGVzX2ltcGxfKSA8PAorICAgICAgICAgICAgICAiZ19hcnJheV9hcHBlbmRfdmFscyAob2JqZWN0LT4iIDw8IG5hbWUgPDwgIiwgJl9fZGVmYXVsdF8iIDw8CisgICAgICAgICAgICAgIG5hbWUgPDwgIiwgIiA8PCBsaXN0LnNpemUoKSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgaW5kZW50KGZfdHlwZXNfaW1wbF8pIDw8CisgICAgICAgICAgICAgICJmb3IgKGxpc3RfaW5kZXggPSAwOyBsaXN0X2luZGV4IDwgIiA8PCBsaXN0LnNpemUoKSA8PCAiOyAiIDw8CisgICAgICAgICAgICAgICJsaXN0X2luZGV4ICs9IDEpIiA8PCBlbmRsOworICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICBpbmRlbnQoZl90eXBlc19pbXBsXykgPDwKKyAgICAgICAgICAgICAgImdfcHRyX2FycmF5X2FkZCAob2JqZWN0LT4iIDw8IG5hbWUgPDwgIiwiIDw8IGVuZGwgPDwKKyAgICAgICAgICAgICAgaW5kZW50KCkgPDwgc3RyaW5nKDE3LCAnICcpIDw8ICJnX3N0cmR1cCAoX19kZWZhdWx0XyIgPDwKKyAgICA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UkFZLCIgPDwgZW5kbCA8PCBhcmdzX2luZGVudCA8PCAiR19QQVJBTV9SRUFEV1JJVEUpKTsiCisgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGFyZ3NfaW5kZW50ICs9IHN0cmluZygyMSwgJyAnKTsKKyAgICAgICAgICAgIGZfdHlwZXNfaW1wbF8gPDwgImdfcGFyYW1fc3BlY19zdHJpbmcgKFwiIiA8PCBtZW1iZXJfbmFtZSA8PCAiXCIsIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGFyZ3NfaW5kZW50IDw8ICJOVUxMLCIgPDwgZW5kbCA8PCBhcmdzX2luZGVudCA8PCAiTlVMTCwiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgYXJnc19pbmRlbnQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgKChtZW1iZXJfdmFsdWUgIT0gTlVMTCkgPyAiXCIiICsgbWVtYmVyX3ZhbHVlLT5nZXRfc3RyaW5nKCkgKyAiXCIiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIk5VTEwiKSA8PCAiLCIgPDwgZW5kbCA8PCBhcmdzX2luZGVudAorICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiR19QQVJBTV9SRUFEV1JJVEUpKTsiIDw8IGVuZGw7CisgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKGJhc2VfdHlwZSA9PSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MKSB7CisgICAgICAgICAgYXJnc19pbmRlbnQgKz0gc3RyaW5nKDIyLCAnICcpOworICAgICAgICAgIGZfdHlwZXNfaW1wbF8gPDwgImdfcGFyYW1fc3BlY19ib29sZWFuIChcIiIgPDwgbWVtYmVyX25hbWUgPDwgIlwiLCIgPDwgZW5kbCA8PCBhcmdzX2luZGVudAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIk5VTEwsIiA8PCBlbmRsIDw8IGFyZ3NfaW5kZW50IDw8ICJOVUxMLCIgPDwgZW5kbCA8PCBhcmdzX2luZGVudAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgKCgobWVtYmVyX3ZhbHVlICE9IE5VTEwpICYmIChtZW1iZXJfdmFsdWUtPmdldF9pbnRlZ2VyKCkgIT0gMCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gIlRSVUUiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIkZBTFNFIikgPDwgIiwiIDw8IGVuZGwgPDwgYXJnc19pbmRlbnQgPDwgIkdfUEFSQU1fUkVBRFdSSVRFKSk7IgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgICAgfSBlbHNlIGlmICgoYmFzZV90eXBlID09IHRfYmFzZV90eXBlOjpUWVBFX0k4KSB8fCAoYmFzZV90eXBlID09IHRfYmFzZV90eXBlOjpUWVBFX0kxNikKKyAgICAgICAgICAgICAgICAgICB8fCAoYmFzZV90eXBlID09IHRfYmFzZV90eXBlOjpUWVBFX0kzMikgfHwgKGJhc2VfdHlwZSA9PSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQpCisgICAgICAgICAgICAgICAgICAgfHwgKGJhc2VfdHlwZSA9PSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEUpKSB7CisgICAgICAgICAgc3RyaW5nIHBhcmFtX3NwZWNfZnVuY3Rpb25fbmFtZSA9ICJnX3BhcmFtX3NwZWNfaW50IjsKKyAgICAgICAgICBzdHJpbmcgbWluX3ZhbHVlOworICAgICAgICAgIHN0cmluZyBtYXhfdmFsdWU7CisgICAgICAgICAgb3N0cmluZ3N0cmVhbSBkZWZhdWx0X3ZhbHVlOworCisgICAgICAgICAgc3dpdGNoIChiYXNlX3R5cGUpIHsKKyAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICAgICAgbWluX3ZhbHVlID0gIkdfTUlOSU5UOCI7CisgICAgICAgICAgICBtYXhfdmFsdWUgPSAiR19NQVhJTlQ4IjsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgICAgICBtaW5fdmFsdWUgPSAiR19NSU5JTlQxNiI7CisgICAgICAgICAgICBtYXhfdmFsdWUgPSAiR19NQVhJTlQxNiI7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICAgICAgbWluX3ZhbHVlID0gIkdfTUlOSU5UMzIiOworICAgICAgICAgICAgbWF4X3ZhbHVlID0gIkdfTUFYSU5UMzIiOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgICAgIHBhcmFtX3NwZWNfZnVuY3Rpb25fbmFtZSA9ICJnX3BhcmFtX3NwZWNfaW50NjQiOworICAgICAgICAgICAgbWluX3ZhbHVlID0gIkdfTUlOSU5UNjQiOworICAgICAgICAgICAgbWF4X3ZhbHVlID0gIkdfTUFYSU5UNjQiOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgICAgIHBhcmFtX3NwZWNfZnVuY3Rpb25fbmFtZSA9ICJnX3BhcmFtX3NwZWNfZG91YmxlIjsKKyAgICAgICAgICAgIG1pbl92YWx1ZSA9ICItSU5GSU5JVFkiOworICAgICAgICAgICAgbWF4X3ZhbHVlID0gIklORklOSVRZIjsKKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogIgorICAgICAgICAgICAgICAgICAgInVucmVjb2duaXplZCBiYXNlIHR5cGUgXCIiICsgbWVtYmVyX3R5cGUtPmdldF9uYW1lKCkgKyAiXCIgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZm9yIHN0cnVjdCBtZW1iZXIgXCIiCisgICAgICAgICAgICAgICAgKyBtZW1iZXJfbmFtZSArICJcIiI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICB9CisKKyAgICAgICAgICBpZiAobWVtYmVyX3ZhbHVlICE9IE5VTEwpIHsKKyAgICAgICAgICAgIGRlZmF1bHRfdmFsdWUgPDwgKGJhc2VfdHlwZSA9PSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEUgPyBtZW1iZXJfdmFsdWUtPmdldF9kb3VibGUoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1lbWJlcl92YWx1ZS0+Z2V0X2ludGVnZXIoKSk7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRlZmF1bHRfdmFsdWUgPDwgIjAiOworICAgICAgICAgIH0KKworICAgICAgICAgIGFyZ3NfaW5kZW50ICs9IHN0cmluZyhwYXJhbV9zcGVjX2Z1bmN0aW9uX25hbWUubGVuZ3RoKCkgKyAyLCAnICcpOworICAgICAgICAgIGZfdHlwZXNfaW1wbF8gPDwgcGFyYW1fc3BlY19mdW5jdGlvbl9uYW1lIDw8ICIgKFwiIiA8PCBtZW1iZXJfbmFtZSA8PCAiXCIsIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBhcmdzX2luZGVudCA8PCAiTlVMTCwiIDw8IGVuZGwgPDwgYXJnc19pbmRlbnQgPDwgIk5VTEwsIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBhcmdzX2luZGVudCA8PCBtaW5fdmFsdWUgPDwgIiwiIDw8IGVuZGwgPDw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JsZSAqLyIgPDwgZW5kbCA8PCAiICAgIH07IiA8PCBlbmRsIDw8IGVuZGwKKyAgICAgICAgICAgICAgICA8PCAiICAgIHR5cGUgPSBnX3R5cGVfcmVnaXN0ZXJfc3RhdGljIChUSFJJRlRfVFlQRV9TVFJVQ1QsICIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiIiA8PCB0aGlzLT5uc3BhY2UgPDwgbmFtZSA8PCAiVHlwZVwiLCIKKyAgICAgICAgICAgICAgICA8PCBlbmRsIDw8ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ0eXBlX2luZm8sIDApOyIgPDwgZW5kbCA8PCAiICB9IgorICAgICAgICAgICAgICAgIDw8IGVuZGwgPDwgZW5kbCA8PCAiICByZXR1cm4gdHlwZTsiIDw8IGVuZGwgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKworLyoqCisgKiBHZW5lcmF0ZXMgZnVuY3Rpb25zIHRvIHdyaXRlIFRocmlmdCBzdHJ1Y3R1cmVzIHRvIGEgc3RyZWFtLgorICovCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc3RydWN0X3dyaXRlcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyB0aGlzX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGhpc19nZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2Z1bmN0aW9uKSB7CisgIHN0cmluZyBuYW1lID0gdHN0cnVjdC0+Z2V0X25hbWUoKTsKKyAgc3RyaW5nIG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PCBlbmRsOworCisgIGlmIChpc19mdW5jdGlvbikgeworICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm4geGZlcjsiIDw8IGVuZGw7CisgIH0KKworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBjb2RlIHRvIHJlYWQgVGhyaWZ0IHN0cnVjdHVyZXMgZnJvbSBhIHN0cmVhbS4KKyAqLwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3N0cnVjdF9yZWFkZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGhpc19uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHRoaXNfZ2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19mdW5jdGlvbikgeworICBzdHJpbmcgbmFtZSA9IHRzdHJ1Y3QtPmdldF9uYW1lKCk7CisgIHN0cmluZyBuYW1lX3UgPSBpbml0aWFsX2NhcHNfdG9fdW5kZXJzY29yZXMobmFtZSk7CisgIHN0cmluZyBuYW1lX3VjID0gdG9fdXBwZXJfY2FzZShuYW1lX3UpOworICBpbnQgZXJyb3JfcmV0ID0gMDsKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKyAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworCisgIGlmIChpc19mdW5jdGlvbikgeworICAgIGVycm9yX3JldCA9IC0xOworICAgIGluZGVudChv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GVuZGwgPDwgaW5kZW50KCkgPDwgInsiCisgICAgICAgICAgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICA8PCAiICAgICAgICAgICAgICAgVEhSSUZUX1BST1RPQ09MX0VSUk9SX0lOVkFMSURfREFUQSwiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICA8PCAiICAgICAgICAgICAgICAgXCJtaXNzaW5nIGZpZWxkXCIpOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiICByZXR1cm4gLTE7IiA8PCBlbmRsCisgICAgICAgICAgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKyAgICB9CisgIH0KKworICBpZiAoaXNfZnVuY3Rpb24pIHsKKyAgICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIHhmZXI7IiA8PCBlbmRsOworICB9CisKKyAgLy8gZW5kIHRoZSBmdW5jdGlvbi9zdHJ1Y3R1cmUKKyAgaW5kZW50X2Rvd24oKTsKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHN1ZmZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IG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ICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgb3V0IDw8ICJib29sIChwcm90b2NvbCwgIiA8PCBuYW1lOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAiYnl0ZSAocHJvdG9jb2wsICIgPDwgbmFtZTsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgb3V0IDw8ICJpMTYgKHByb3RvY29sLCAiIDw8IG5hbWU7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAiaTMyIChwcm90b2NvbCwgIiA8PCBuYW1lOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgImk2NCAocHJvdG9jb2wsICIgPDwgbmFtZTsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgb3V0IDw8ICJkb3VibGUgKHByb3RvY29sLCAiIDw8IG5hbWU7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgICAgIG91dCA8PCAiYmluYXJ5IChwcm90b2NvbCwgIiA8PCBuYW1lIDw8ICIgPyAoKEdCeXRlQXJyYXkgKikgIiA8PCBuYW1lIDw8ICIpLT5kYXRhIDogTlVMTCwgIgorICAgICAgICAgICAgICA8PCBuYW1lIDw8ICIgPyAoKEdCeXRlQXJyYXkgKikgIiA8PCBuYW1lIDw8ICIpLT5sZW4gOiAwIjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBvdXQgPDwgInN0cmluZyAocHJvdG9jb2wsICIgPDwgbmFtZTsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gQyB3cml0ZXIgZm9yIGJhc2UgdHlwZSAiICsgdF9iYXNlX3R5cGU6OnRfYmFzZV9uYW1lKHRiYXNlKSArIG5hbWU7CisgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgIG91dCA8PCAiaTMyIChwcm90b2NvbCwgKGdpbnQzMikgIiA8PCBuYW1lOworICAgIH0KKyAgICBvdXQgPDwgIiwgZXJyb3IpKSA8IDApIiA8PCBlbmRsCisgICAgICAgIDw8IGluZGVudCgpIDw8ICIgIHJldHVybiAiIDw8IGVycm9yX3JldCA8PCAiOyIgPDwgZW5kbAorICAgICAgICA8PCBpbmRlbnQoKSA8PCAieGZlciArPSByZXQ7IiA8PCBlbmRsIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgdGhyb3cgc3RkOjpsb2dpY19lcnJvcigiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnIiArIG5hbWUgKyAiJyBUWVBFICciCisgICAgICAgICAgICAgICAgICAgICAgICAgICArIHR5cGVfbmFtZSh0eXBlKSk7CisgIH0KK30KKwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVycm9yX3JldCkgeworICAodm9pZCl0c3RydWN0OworICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICgocmV0ID0gdGhyaWZ0X3N0cnVjdF93cml0ZSAoVEhSSUZUX1NUUlVDVCAoIiA8PCBwcmVmaXgKKyAgICAgIDw8ICIpLCBwcm90b2NvbCwgZXJyb3IpKSA8IDApIiA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICIgIHJldHVybiAiIDw8IGVycm9yX3JldCA8PCAiOyIgPDwgZW5kbAorICAgICAgPDwgaW5kZW50KCkgPDwgInhmZXIgKz0gcmV0OyIgPDwgZW5kbCA8PCBlbmRsOworfQorCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpIHsKKyAgc2NvcGVfdXAob3V0KTsKKworICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgdF90eXBlKiB0a2V5ID0gKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKTsKKyAgICB0X3R5cGUqIHR2YWwgPSAoKHRfbWFwKil0dHlwZSktPmdldF92YWxfdHlwZSgpOworICAgIHN0cmluZyB0a2V5X25hbWUgPSB0eXBlX25hbWUodGtleSk7CisgICAgc3RyaW5nIHR2YWxfbmFtZSA9IHR5cGVfbmFtZSh0dmFsKTsKKyAgICBzdHJpbmcgdGtleV9wdHI7CisgICAgc3RyaW5nIHR2YWxfcHRyOworICAgIHN0cmluZyBrZXluYW1lID0gdG1wKCJrZXkiKTsKKyAgICBzdHJpbmcgdmF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PCBlbmRsCisgICAgICAgIDw8IGVuZGw7CisgICAgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRfbWFwKil0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGtleV9wdHIgKyAiICIgKyBrZXluYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dmFsX3B0ciArICIgIiArIHZhbG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yX3JldCk7CisgICAgc2NvcGVfZG93bihvdXQpOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfbWFwX2VuZCAocHJvdG9jb2wsICIKKyAgICAgICAgICAgImVycm9yKSkgPCAwKSIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiAiIDw8IGVycm9yX3JldCA8PCAiOyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAieGZlciArPSByZXQ7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIHRfdHlwZSogdGVsZW0gPSAoKHRfc2V0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKTsKKyAgICBzdHJpbmcgdGVsZW1fbmFtZSA9IHR5cGVfbmFtZSh0ZWxlbSk7CisgICAgc3RyaW5nIHRlbGVtX3B0ciA9IHRlbGVtLT5pc19zdHJpbmcoKSB8fCAhdGVsZW0tPmlzX2Jhc2VfdHlwZSgpID8gIiIgOiAiKiI7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJHTGlzdCAqa2V5X2xpc3QgPSBOVUxMLCAqaXRlciA9IE5VTEw7IiA8PCBl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A8PCBwcmVmaXggPDwgIiksIChncG9pbnRlcikgZWxlbSk7IiA8PCBlbmRsCisgICAgICAgIDw8IGVuZGw7CisgICAgZ2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50KG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRfc2V0Kil0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVsZW1fcHRyICsgImVsZW0iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcl9yZXQpOworICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX3NldF9lbmQgKHByb3RvY29sLCAiCisgICAgICAgICAgICJlcnJvcikpIDwgMCkiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gIiA8PCBlcnJvcl9yZXQgPDwgIjsiIDw8IGVuZGw7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgInhmZXIgKz0gcmV0OyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgc3RyaW5nIGxlbmd0aCA9ICIoIiArIHByZWZpeCArICIgPyAiICsgcHJlZml4ICsgIi0+bGVuIDogMCkiOworICAgIHN0cmluZyBpID0gdG1wKCJpIik7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJndWludCAiIDw8IGkgPDwgIjsiIDw8IGVuZGwKKyAgICAgICAgPDwgZW5kbAorICAgICAgICA8PCBpbmRlbnQoKSA8PCAiaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfbGlzdF9iZWdpbiAocHJvdG9jb2wsICIKKyAgICAgICAgPDwgdHlwZV90b19lbnVtKCgodF9saXN0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3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcga2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpIHsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtleSk7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsICIiLCAiIiwgZXJyb3JfcmV0KTsKKworICB0X2ZpZWxkIHZmaWVsZCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgdmFsdWUpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkLCAiIiwgIiIsIGVycm9yX3JldCk7Cit9CisKK3ZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGVsZW1lbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBlcnJvcl9yZXQpIHsKKyAgdF9maWVsZCBlZmllbGQodHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtZW50KTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIsICIiLCBlcnJvcl9yZXQpOworfQorCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7CisgIHRfdHlwZSogdHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHRsaXN0LT5nZXRfZWxlbV90eXBlKCkpOworCisgIC8vIGNhc3QgdG8gbm9uLWNvbnN0CisgIHN0cmluZyBjYXN0ID0gIiI7CisgIHN0cmluZyBuYW1lID0gImdfcHRyX2FycmF5X2luZGV4ICgoR1B0ckFycmF5ICopICIgKyBsaXN0ICsgIiwgIiArIGluZGV4ICsgIikiOworCisgIGlmICh0dHlwZS0+aXNfdm9pZCgpKSB7CisgICAgdGhyb3cgc3RkOjpydW50aW1lX2Vycm9yKCJjb21waWxlciBlcnJvcjogbGlzdCBlbGVtZW50IHR5cGUgY2Fubm90IGJlIHZvaWQiKTsKKyAgfSBlbHNlIGlmIChpc19udW1lcmljKHR0eXBlKSkgeworICAgIG5hbWUgPSAiZ19hcnJheV9pbmRleCAoIiArIGxpc3QgKyAiLCAiICsgYmFzZV90eXBlX25hbWUodHR5cGUpICsgIiwgIiArIGluZGV4ICsgIikiOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zdHJpbmcoKSkgeworICAgIGNhc3QgPSAiKGdjaGFyKikiOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19tYXAoKSB8fCB0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBjYXN0ID0gIihHSGFzaFRhYmxlKikiOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICB0X3R5cGUqIGV0eXBlID0gKCh0X2xpc3QqKXR0eXBlKS0+Z2V0X2VsZW1fdHlwZSgpOworICAgIGlmIChldHlwZS0+aXNfdm9pZCgpKSB7CisgICAgICB0aHJvdyBzdGQ6OnJ1bnRpbWVfZXJyb3IoImNvbXBpbGVyIGVycm9yOiBsaXN0IGVsZW1lbnQgdHlwZSBjYW5ub3QgYmUgdm9pZCIpOworICAgIH0KKyAgICBjYXN0ID0gaXNfbnVtZXJpYyhldHlwZSkgPyAiKEdBcnJheSopIiA6ICIoR1B0ckFycmF5KikiOworICB9CisKKyAgdF9maWVsZCBlZmllbGQodHR5cGUsICIoIiArIGNhc3QgKyBuYW1lICsgIikiKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIsICIiLCBlcnJvcl9yZXQpOworfQorCisvKiBkZXNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4gKi8KK3ZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHN1ZmZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJy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hbCB2YXJpYWJsZSBpbmRpY2F0aW5nIHRoZSB2YWx1ZSB3YXMgc2V0LCBzbyB0aGF0IHdlIGNhbiBkbyAgICAvLyB2YWxpZGF0aW9uIGxhdGVyLgorICBpZiAocHJlZml4ICE9ICIiICYmIHRmaWVsZC0+Z2V0X3JlcSgpICE9IHRfZmllbGQ6OlRfUkVRVUlSRUQpIHsKKyAgICBpbmRlbnQob3V0KSA8PCBwcmVmaXggPDwgIl9faXNzZXRfIiA8PCB0ZmllbGQtPmdldF9uYW1lKCkgPDwgc3VmZml4IDw8ICIgPSBUUlVFOyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmIChwcmVmaXggIT0gIiIgJiYgdGZpZWxkLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9SRVFVSVJFRCkgeworICAgIGluZGVudChvdXQpIDw8ICJpc3NldF8iIDw8IHRmaWVsZC0+Z2V0X25hbWUoKSA8PCAiID0gVFJVRTsiIDw8IGVuZGw7CisgIH0KK30KKwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGFsbG9jYXRlKSB7CisgIHN0cmluZyBuYW1lX3VjID0gdG9fdXBwZXJfY2FzZShpbml0aWFsX2NhcHNfdG9fdW5kZXJzY29yZXModHN0cnVjdC0+Z2V0X25hbWUoKSkpOworICBpZiAodHN0cnVjdC0+a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PDwgZW5kbDsKKyAgICB9CisgIH0KKyAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gIiA8PCBlcnJvcl9yZXQgPDwgIjsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAieGZlciArPSByZXQ7IiA8PCBlbmRsOworfQorCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVycm9yX3JldCkgeworICBzY29wZV91cChvdXQpOworCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgImd1aW50MzIgc2l6ZTsiIDw8IGVuZGwKKyAgICAgICAgPDwgaW5kZW50KCkgPDwgImd1aW50MzIgaTsiIDw8IGVuZGwKKyAgICAgICAgPDwgaW5kZW50KCkgPDwgIlRocmlmdFR5cGUga2V5X3R5cGU7IiA8PCBlbmRsCisgICAgICAgIDw8IGluZGVudCgpIDw8ICJUaHJpZnRUeXBlIHZhbHVlX3R5cGU7IiA8PCBlbmRsCisgICAgICAgIDw8IGVuZGwKKyAgICAgICAgPDwgaW5kZW50KCkgPDwgIi8qIHJlYWQgdGhlIG1hcCBiZWdpbiBtYXJrZXIgKi8iIDw8IGVuZGwKKyAgICAgICAgPDwgaW5kZW50KCkgPDwgImlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfbW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CBlbmRsCisgICAgICAgIDw8IGVuZGw7CisKKyAgICAvLyBpdGVyYXRlIG92ZXIgdGhlIGVsZW1lbnRzCisgICAgb3V0IDw8IGluZGVudCgpIDw8ICIvKiBpdGVyYXRlIHRocm91Z2ggbGlzdCBlbGVtZW50cyAqLyIgPDwgZW5kbAorICAgICAgICA8PCBpbmRlbnQoKSA8PCAiZm9yIChpID0gMDsgaSA8IHNpemU7IGkrKykiIDw8IGVuZGw7CisgICAgc2NvcGVfdXAob3V0KTsKKyAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodF9saXN0Kil0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yX3JldCk7CisgICAgc2NvcGVfZG93bihvdXQpOworCisgICAgLy8gcmVhZCBsaXN0IGVuZAorICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfcmVhZF9saXN0X2VuZCAocHJvdG9jb2wsICIKKyAgICAgICAgICAgImVycm9yKSkgPCAwKSIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiAiIDw8IGVycm9yX3JldCA8PCAiOyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAieGZlciArPSByZXQ7IiA8PCBlbmRsOworICB9CisKKyAgc2NvcGVfZG93bihvdXQpOworfQorCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6ZGVjbGFyZV9sb2NhbF92YXJpYWJsZShvc3RyZWFtJiBvdXQsIHRfdHlwZSogdH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IgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgdG5hbWUgPDwgcHRyIDw8ICIgIiA8PCBuYW1lCisgICAgICAgIDw8IChwdHIgIT0gIiIgPyAiID0gZ19uZXcgKCIgKyB0bmFtZSArICIsIDEpIiA6ICIgPSBOVUxMIikgPDwgIjsiIDw8IGVuZGw7CisgIH0KK30KKwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmRlY2xvcmVfbG9jYWxfdmFyaWFibGVfZm9yX3dyaXRlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyYgbmFtZSkgeworICBzdHJpbmcgdG5hbWUgPSB0eXBlX25hbWUodHR5cGUpOworICB0dHlwZSA9IGdldF90cnVlX3R5cGUodHR5cGUpOworICBzdHJpbmcgcHRyID0gdHR5cGUtPmlzX3N0cmluZygpIHx8ICF0dHlwZS0+aXNfYmFzZV90eXBlKCkgPyAiICIgOiAiKiAiOworICBzdHJpbmcgaW5pdF92YWwgPSB0dHlwZS0+aXNfZW51bSgpID8gIiIgOiAiID0gTlVMTCI7CisgIG91dCA8PCBpbmRlbnQoKSA8PCB0bmFtZSA8PCBwdHIgPDwgbmFtZSA8PCBpbml0X3ZhbCA8PCAiOyIgPDwgZW5kbDsKK30KKwordm9pZCB0X2NfZ2xpYl9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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zZXJpYWxpemVfZmllbGQob3V0LCAmZmtleSwgIiIsICIiLCBlcnJvcl9yZXQpOworICB0X2ZpZWxkIGZ2YWwodHZhbCwgdHZhbF9wdHIgKyB2YWxuYW1lKTsKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZnZhbCwgIiIsICIiLCBlcnJvcl9yZXQpOworCisgIGluZGVudChvdXQpIDw8ICJpZiAoIiA8PCBwcmVmaXggPDwgIiAmJiAiIDw8IGtleW5hbWUgPDwgIikiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAiZ19oYXNoX3RhYmxlX2luc2VydCAoKEdIYXNoVGFibGUgKikiIDw8IHByZWZpeCA8PCAiLCAoZ3BvaW50ZXIpICIgPDwga2V5bmFtZQorICAgICAgICAgICAgICA8PCAiLCAoZ3BvaW50ZXIpICIgPDwgdmFsbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7Cit9CisKK3ZvaWQgdF9jX2dsaWJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7CisgIHRfdHlwZSogdGVsZW0gPSB0c2V0LT5nZXRfZWxlbV90eXBlKCk7CisgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICBzdHJpbmcgdGVsZW1fcHRyID0gdGVsZW0tPmlzX3N0cmluZygpIHx8ICF0ZWxlbS0+aXNfYmFzZV90eXBlKCkgPyAiIiA6ICIqIjsKKworICBkZWNsYXJlX2xvY2FsX3ZhcmlhYmxlKG91dCwgdGVsZW0sIGVsZW0sIHRydWUpOworCisgIHRfZmllbGQgZmVsZW0odGVsZW0sIHRlbGVtX3B0ciArIGVsZW0pOworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZmZWxlbSwgIiIsICIiLCBlcnJvcl9yZXQpOworCisgIGluZGVudChvdXQpIDw8ICJpZiAoIiA8PCBwcmVmaXggPDwgIiAmJiAiIDw8IGVsZW0gPDwgIikiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAiZ19oYXNoX3RhYmxlX2luc2VydCAoKEdIYXNoVGFibGUgKikgIiA8PCBwcmVmaXggPDwgIiwgKGdwb2ludGVyKSAiIDw8IGVsZW0KKyAgICAgICAgICAgICAgPDwgIiwgKGdwb2ludGVyKSAiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworfQorCit2b2lkIHRfY19nbGliX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZXJyb3JfcmV0KSB7CisgICh2b2lkKWluZGV4OworICB0X3R5cGUqIHR0eXBlID0gZ2V0X3RydWVfdHlwZSh0bGlzdC0+Z2V0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IHZvaWQgZ2VuZXJhdGVfc2VydmljZSh0X3NlcnZpY2UqIHRzZXJ2aWNlKTsKKworICB2b2lkIHByaW50X2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWZ2YWwgPSBmYWxzZSk7CisgIHN0ZDo6c3RyaW5nIHJlbmRlcl9jb25zdF92YWx1ZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYm94X2l0ID0gZmFsc2UpOworCisgIHZvaWQgZ2VuZXJhdGVfY29jb2Ffc3RydWN0KHRfc3RydWN0KiB0c3RydWN0LCBib29sIGlzX2V4Y2VwdGlvbik7CisgIHZvaWQgZ2VuZXJhdGVfY29jb2Ffc3RydWN0X2ludGVyZmFjZShzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiA9IGZhbHNlKTsKKyAgdm9pZCBnZW5lcmF0ZV9jb2NvYV9zdHJ1Y3RfaW1wbGVtZW50YXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0ID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX2NvY29hX3N0cnVjdF9pbml0aWFsaXplcl9zaWduYXR1cmUoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KTsKKyAgdm9pZCBnZW5lcmF0ZV9jb2NvYV9zdHJ1Y3RfaW5pdF93aXRoX2NvZGVyX21ldGhvZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2NvY29hX3N0cnVjdF9lbmNvZGVfd2l0aF9jb2Rlcl9tZXRob2Qob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4Y2VwdGlvbik7CisgIHZvaWQgZ2VuZXJhdGVfY29jb2Ffc3RydWN0X2NvcHlfbWV0aG9kKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uKTsKKyAgdm9pZCBnZW5lcmF0ZV9jb2NvYV9zdHJ1Y3RfaGFzaF9tZXRob2Qob3N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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2VydmljZSogdHNlcnZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG5lZWRzX3Byb3RvY29sKTsKKyAgdm9pZCBnZW5lcmF0ZV9jb2NvYV9zZXJ2aWNlX2NsaWVudF9zZW5kX2Z1bmN0aW9uX2ludm9jYXRpb24ob3N0cmVhbSYgb3V0LCB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24pOworICB2b2lkIGdlbmVyYXRlX2NvY29hX3NlcnZpY2VfY2xpZW50X3NlbmRfYXN5bmNfZnVuY3Rpb25faW52b2NhdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZnVuY3Rpb24qIHRmdW5jdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZhaWx1cmVCbG9ja05hbWUpOworICB2b2lkIGdlbmVyYXRlX2NvY29hX3NlcnZpY2VfY2xpZW50X3JlY3ZfZnVuY3Rpb25faW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXJ2aWNlKiB0c2VydmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZnVuY3Rpb24qIHRmdW5jdGlvbiwKKyAgICAgICAgIC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N0ZDo6c3RyaW5nIGZpZWxkTmFtZSA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIoc3RkOjpvc3RyZWFtJiBvdXQsIHRfdHlwZSogdHR5cGUsIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG1hcCk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc2V0KiB0bWFwLCBzdGQ6OnN0cmluZyBpdGVyKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaW5kZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBsaXN0TmFtZSk7CisKKyAgLyoqCisgICAqIEhlbHBlciByZW5kZXJpbmcgZnVuY3Rpb25zCisgICAqLworCisgIHN0ZDo6c3RyaW5nIGNvY29hX3ByZWZpeCgpOworICBzdGQ6OnN0cmluZyBjb2NvYV9pbXBvcnRzKCk7CisgIHN0ZDo6c3RyaW5nIGNvY29hX3RocmlmdF9pbXBvcnRzKCk7CisgIHN0ZDo6c3R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pc19zdHJ1Y3QoKSkgeworICAgICAgY29uc3RfaW50ZXJmYWNlIDw8ICJGT1VOREFUSU9OX0VYUE9SVCAiIDw8IHR5cGVfbmFtZSh0eXBlKSA8PCAiICIKKyAgICAgICAgICAgICAgICAgICAgICA8PCBjb2NvYV9wcmVmaXhfIDw8IGNhcGl0YWxpemUoKCpjX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiOyIgPDwgZW5kbDsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICBuZWVkc19jbGFzcyA9IHRydWU7CisgICAgfQorICB9CisKKworICBzdHJpbmcgY29uc3RhbnRzX2NsYXNzX25hbWUgPSBjb2NvYV9wcmVmaXhfICsgY2FwaXRhbGl6ZShwcm9ncmFtX25hbWVfKSArICJDb25zdGFudHMiOworCisgIGlmIChuZWVkc19jbGFzcykgeworCisgICAgY29uc3RfaW50ZXJmYWNlIDw8IGVuZGw7CisKKyAgICBjb25zdF9pbnRlcmZhY2UgPDwgIkBpbnRlcmZhY2UgIiA8PCBjb25zdGFudHNfY2xhc3NfbmFtZSA8PCAiIDogTlNPYmplY3QgIjsKKyAgICBzY29wZV91cChjb25zdF9pbnRlcmZhY2UpOworICAgIHNjb3BlX2Rvd24oY29uc3RfaW50ZXJmYWNlKTsKKworICAgIC8vIGdldHRlciBtZXRob2QgZm9yIGVhY2ggY29uc3RhbnQgZGVmaW5lZC4KKyAgICBmb3IgKGNfaXRlciA9IGNvbnN0cy5iZWdpbigpOyBjX2l0ZXIgIT0gY29uc3RzLmVuZCgpOyArK2NfaXRlcikgeworICAgICAgc3RyaW5nIG5hbWUgPSAoKmNfaXRlciktPmdldF9uYW1lKCk7CisgICAgICB0X3R5cGUqIHR5cGUgPSAoKmNfaXRlciktPmdldF90eXBlKCktPmdldF90cnVlX3R5cGUoKTsKKyAgICAgIGlmICh0eXBlLT5pc19jb250YWluZXIoKSB8fCB0eXBlLT5pc19zdHJ1Y3QoKSkgeworICAgICAgICB0X3R5cGUqIHR5cGUgPS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ZXIgPSBtZW1iZXJzLmJlZ2luKCk7IG1faXRlciAhPSBtZW1iZXJzLmVuZCgpOykgeworICAgIGlmIChtX2l0ZXIgPT0gbWVtYmVycy5iZWdpbigpKSB7CisgICAgICBvdXQgPDwgY2FwaXRhbGl6ZSgoKm1faXRlciktPmdldF9uYW1lKCkpOworICAgIH0gZWxzZSB7CisgICAgICBvdXQgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgIH0KKyAgICBvdXQgPDwgIjogKCIgPDwgdHlwZV9uYW1lKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSkgPDwgIikgIiA8PCAoKm1faXRlciktPmdldF9uYW1lKCk7CisgICAgKyttX2l0ZXI7CisgICAgaWYgKG1faXRlciAhPSBtZW1iZXJzLmVuZCgpKSB7CisgICAgICBvdXQgPDwgIiAiOworICAgIH0KKyAgfQorfQorCisvKioKKyAqIEdlbmVyYXRlIHRoZSBpbml0V2l0aENvZGVyIG1ldGhvZCBmb3IgdGhpcyBzdHJ1Y3Qgc28gaXQncyBjb21wYXRpYmxlIHdpdGgKKyAqIHRoZSBOU0NvZGluZyBwcm90b2NvbAorICovCit2b2lkIHRfY29jb2FfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9jb2NvYV9zdHJ1Y3RfaW5pdF93aXRoX2NvZGVyX21ldGhvZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uKSB7CisKKyAgaW5kZW50KG91dCkgPDwgIi0gKGluc3RhbmNldHlwZSkgaW5pdFdpdGhDb2RlcjogKE5TQ29kZXIgKikgZGVjb2RlciIgPDwgZW5kbDsKKyAgc2NvcGVfdXAob3V0KTsKK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ICAgICBwcmludF9jb25zdF92YWx1ZShvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNlbGYuIiArICgqbV9pdGVyKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICgqbV9pdGVyKS0+Z2V0X3ZhbHVlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOworICAgICAgICB9CisgICAgICB9CisgICAgfQorICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIHNlbGY7IiA8PCBlbmRsOworICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICBvdXQgPDwgZW5kbDsKKyAgfQorCisgIC8vIGluaXRpYWxpemVyIHdpdGggYWxsIGZpZWxkcyBhcyBwYXJhbXMKKyAgaWYgKCFtZW1iZXJzLmVtcHR5KCkpIHsKKyAgICBnZW5lcmF0ZV9jb2NvYV9zdHJ1Y3RfaW5pdGlhbGl6ZXJfc2lnbmF0dXJlKG91dCwgdHN0cnVjdCk7CisgICAgb3V0IDw8IGVuZGw7CisgICAgc2NvcGVfdXAob3V0KTsKKyAgICBpZiAoaXNfZXhjZXB0aW9uKSB7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInNlbGYgPSBbc2VsZiBpbml0XTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIHsKKyAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAic2VsZiA9IFtzdXBlciBpbml0XTsiIDw8IGVuZGw7CisgICAgfQorCisgICAgaW5kZW50KG91dCkgPDwgImlmIChzZWxmKSI7CisgICAgc2NvcGVfdXAob3V0KTsKKyAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIl8iIDw8ICgqb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Gw7CisgICAgaWYgKGxvZ191bmV4cGVjdGVkXykgeworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIgIE5TTG9nKEBcIiVzOiBmaWVsZCBJRCAlaSBoYXMgdW5leHBlY3RlZCB0eXBlICVpLiAgU2tpcHBpbmcuXCIsICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAiX19QUkVUVFlfRlVOQ1RJT05fXywgKGludClmaWVsZElELCAoaW50KWZpZWxkVHlwZSk7IiA8PCBlbmRsOworICAgIH0KKworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICBpZiAoIVtUUHJvdG9jb2xVdGlsIHNraXBUeXBlOiBmaWVsZFR5cGUgb25Qcm90b2NvbDogaW5Qcm90b2NvbCBlcnJvcjogX190aHJpZnRFcnJvcl0pIHJldHVybiBOTzsiIDw8IGVuZGw7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICJicmVhazsiIDw8IGVuZGw7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgfQorCisgIC8vIEluIHRoZSBkZWZhdWx0IGNhc2Ugd2Ugc2tpcCB0aGUgZmllbGQKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJkZWZhdWx0OiIgPDwgZW5kbDsKKyAgaWYgKGxvZ191bmV4cGVjdGVkXykgeworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICBOU0xvZyhAXCIlczogdW5leHBlY3RlZCBmaWVsZCBJRCAlaSB3aXRoIHR5cGUgJWkuICBTa2lwcGluZy5cIiwgIgorICAgICAgICAgICAgICAgICAgICAgICAiX19QUkVUVFlfRlVOQ1RJT05fXywgKGludClmaWVsZElELCAoaW50KWZpZWxkVHlwZSk7IiA8PCBlbmRsOworICB9CisKKyAgb3V0IDw8IGluZGVudCgpIDw8ICIgIGlmICghW1RQcm90b2NvbFV0aWwgc2tpcFR5cGU6IGZpZWxkVHlwZSBvblByb3RvY29sOiBpblByb3RvY29sIGVycm9yO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8ICIgKikgcmVzdWx0ICI7CisgICAgaWYgKG5lZWRzX3Byb3RvY29sKSB7CisgICAgICBvdXQgPDwgInByb3RvY29sIjsKKyAgICB9IGVsc2UgeworICAgICAgb3V0IDw8ICJlcnJvciI7CisgICAgfQorICB9CisgIGlmIChuZWVkc19wcm90b2NvbCkgeworICAgIG91dCA8PCAiOiAoaWQ8VFByb3RvY29sPikgaW5Qcm90b2NvbCBlcnJvciI7CisgIH0KKyAgb3V0IDw8ICI6IChOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKilfX3RocmlmdEVycm9yIiA8PCBlbmRsOworICBzY29wZV91cChvdXQpOworCisgIC8vIFRPRE8obWNzbGVlKTogTWVzc2FnZSB2YWxpZGF0aW9uIGhlcmUsIHdhcyB0aGUgc2VxaWQgZXRjIG9rPworCisgIC8vIGNoZWNrIGZvciBhbiBleGNlcHRpb24KKyAgb3V0IDw8IGluZGVudCgpIDw8ICJOU0Vycm9yICppbmNvbWluZ0V4Y2VwdGlvbiA9IFtzZWxmIGNoZWNrSW5jb21pbmdNZXNzYWdlRXhjZXB0aW9uOiBpblByb3RvY29sXTsiIDw8IGVuZGwKKyAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAoaW5jb21pbmdFeGNlcHRpb24pIjsKKyAgc2NvcGVfdXAob3V0KTsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiAoX190aHJpZnRFcnJvcikiOworICBzY29wZV91cChvdXQpOworICBvdXQgPDwgaW5kZW50KCkgPDwgIipfX3RocmlmdEVycm9yID0gaW5jb21pbmdFeGNlcHRpb247IiA8PCBlbmRsOworICBzY29wZV9kb3duKG91dCk7CisgIG91dCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIE5POyIgPDwgZW5kbDsKKyAgc2NvcGVfZG93bihvdXQpOworCisgIC8vIEZJWE1FIC0gY291bGQgb3B0aW1pemUgaGVyZSB0byByZWR1Y2UgY3JlYXRpb24gb2YgdGVtcG9yYXJ5IG9iamVjdHMu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kbAorICAgICAgICA8PCBpbmRlbnQoKSA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IFRBcHBsaWNhdGlvbkVycm9yTWlzc2luZ1Jlc3VsdCIgPDwgZW5kbAorICAgICAgICA8PCBpbmRlbnQoKSA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86IEB7VEFwcGxpY2F0aW9uRXJyb3JNZXRob2RLZXk6IEBcIiIKKyAgICAgICAgPDwgdGZ1bmN0aW9uLT5nZXRfbmFtZSgpIDw8ICJcIn1dOyIgPDwgZW5kbDsKKyAgICBzY29wZV9kb3duKG91dCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gTk87IiA8PCBlbmRsOworICB9CisKKyAgLy8gQ2xvc2UgZnVuY3Rpb24KKyAgc2NvcGVfZG93bihvdXQpOworICBvdXQgPDwgZW5kbDsKK30KKworLyoqCisgKiBHZW5lcmF0ZXMgYW4gaW52b2NhdGlvbiBvZiBhIGdpdmVuICdzZW5kXycgZnVuY3Rpb24uCisgKgorICogQHBhcmFtIHRmdW5jdGlvbiBUaGUgc2VydmljZSB0byBnZW5lcmF0ZSBhbiBpbXBsZW1lbnRhdGlvbiBmb3IKKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfY29jb2Ffc2VydmljZV9jbGllbnRfc2VuZF9mdW5jdGlvbl9pbnZvY2F0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24pIHsKKworICB0X3N0cnVjdCogYXJnX3N0cnVjdCA9IHRmdW5jdGlvbi0+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RlX2NvY29hX3NlcnZpY2VfY2xpZW50X3NlbmRfYXN5bmNfZnVuY3Rpb25faW52b2NhdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGZ1bmN0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBmYWlsdXJlQmxvY2tOYW1lKSB7CisKKyAgdF9zdHJ1Y3QqIGFyZ19zdHJ1Y3QgPSB0ZnVuY3Rpb24tPmdldF9hcmdsaXN0KCk7CisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIGZpZWxkcyA9IGFyZ19zdHJ1Y3QtPmdldF9tZW1iZXJzKCk7CisgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIGZsZF9pdGVyOworICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICghW3NlbGYgc2VuZF8iIDw8IHRmdW5jdGlvbi0+Z2V0X25hbWUoKTsKKyAgYm9vbCBmaXJzdCA9IHRydWU7CisgIGZvciAoZmxkX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZmxkX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZsZF9pdGVyKSB7CisgICAgc3RyaW5nIGZpZWxkTmFtZSA9ICgqZmxkX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgIG91dCA8PCAiICI7CisgICAgaWYgKGZpcnN0KSB7CisgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgb3V0IDw8ICI6ICIgPDwgZmllbGROYW1lOworICAgIH0gZWxzZSB7CisgICAgICBvdXQgPDwgZmllbGROYW1lIDw8ICI6ICIgPDwgZmllbGROYW1lOworICAgIH0KKyAgfQorICBpZiAoIWZpZWxkcy5lbXB0eSgpKSB7CisgICAgb3V0IDw8ICIgcHJvdG9jb2wiOworICB9CisgIG91dCA8PCAiOiBwcm90b2NvbCBlcnJvcjogJnRocmlmdEVycm9yXSkgIjsKKyAgc2NvcGVfdXAob3V0KTsKKyAgb3V0IDw8IGluZGVudCgpIDw8IGZhaWx1cmVCbG9ja05hbWUgPDwgIih0aHJpZnRFcnJvcik7IiA8PCBlbmRsCisgICAgICA8PCBpbmRlbnQoKSA8PCAicmV0dXJuOyIgPDwgZW5kbDsKKyAgc2NvcGVfZG93bihvdXQpOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHNlcnZpY2UgY2xpZW50IGltcGxlbWVudGF0aW9uLgorICoKKyAqIEBwYXJhbSB0c2VydmljZSBUaGUgc2VydmljZSB0byBnZW5lcmF0ZSBhbiBpbXBsZW1lbnRhdGlvbiBmb3IKKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfY29jb2Ffc2VydmljZV9jbGllbnRfaW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXJ2aWNlKiB0c2VydmljZSkgeworCisgIHN0cmluZyBuYW1lID0gY29jb2FfcHJlZml4XyArIHRzZXJ2aWNlLT5nZXRfbmFtZSgpICsgIkNsaWVudCI7CisKKyAgb3V0IDw8ICJAaW50ZXJmYWNlICIgPDwgbmFtZSA8PCAiICgpICI7CisgIHNjb3BlX3VwKG91dCk7CisgIG91dCA8PCBlbmRsOworICBvdXQgPDwgaW5kZW50KCkgPDwgImlkPFRQcm90b2NvbD4gaW5Qcm90b2NvbDsiIDw8IGVuZGw7CisgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWQ8VFByb3RvY29sPiBvdXRQcm90b2NvbDsiIDw8IGVuZGw7CisgIG91dCA8PCBlbmRsOworICBzY29wZV9kb3duKG91dCk7CisgIG91dCA8PCBlbmRsOworICBvdXQgPDwgIkBlbmQiIDw8IGVuZGwgPDwgZW5kbDsKKworICBvdXQgPDwgIkBpbXBsZW1lbnRhdGlvbiAiIDw8IG5hbWUgPDwgZW5kbDsKKworICAvLyBpbml0aWFsaXplcnMKKyAgb3V0IDw8ICItIChpZCkgaW5pdFdpdGhQcm90b2NvbDogKGlkIDxUUHJvdG9jb2w+KSBwcm90b2NvbCIgPDwgZW5kbDsKKyAgc2NvcGVfdXAob3V0KTsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gW3NlbGYgaW5pdFdpdGhJblByb3RvY29sOiBwcm90b2NvbCBvdXRQcm90b2NvbDogcHJvdG9jb2xdOyIgPDwgZW5kbDsKKyAgc2NvcGVfZG93bihvdXQpOworICBvdXQgPDwgZW5kbDsKKworICBvdXQgPDwgIi0gKGlkKSBpbml0V2l0aEluUHJvdG9jb2w6IChpZCA8VFByb3RvY29sPikgYW5JblByb3RvY29sIG91dFByb3RvY29sOiAoaWQgPFRQcm90b2NvbD4pICIKKyAgICAgICAgICJhbk91dFByb3RvY29sIiA8PCBlbmRsOworICBzY29wZV91cChvdXQpOworICBvdXQgPDwgaW5kZW50KCkgPDwgInNlbGYgPSBbc3VwZXIgaW5pdF07IiA8PCBlbmRsOworICBvdXQgPDwgaW5kZW50KCkgPDwgImlmIChzZWxmKSAiOworICBzY29wZV91cChvdXQpOworICBvdXQgPDwgaW5kZW50KCkgPDwgImluUHJvdG9jb2wgPSBhbkluUHJvdG9jb2w7IiA8PCBlbmRsOworICBvdXQgPDwgaW5kZW50KCkgPDwgIm91dFByb3RvY29sID0gYW5PdXRQcm90b2NvbDsiIDw8IGVuZGw7CisgIHNjb3BlX2Rvd24ob3V0KTsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR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bnZvY2F0aW9uKG91dCwgKmZfaXRlciwgInJlc29sdmVyIik7CisKKyAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiW3RyYW5zcG9ydCBmbHVzaFdpdGhDb21wbGV0aW9uOl57IiA8PCBlbmRsOworICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIk5TRXJyb3IgKnRocmlmdEVycm9yOyIgPDwgZW5kbDsKKworICAgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8IHR5cGVfbmFtZSgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCkpIDw8ICIgcmVzdWx0OyIgPDwgZW5kbDsKKyAgICAgICAgfQorICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICghW3NlbGYgcmVjdl8iIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKTsKKyAgICAgICAgaWYgKCEoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgeworICAgICAgICAgIG91dCA8PCAiOiAmcmVzdWx0IHByb3RvY29sIjsKKyAgICAgICAgfQorICAgICAgICBvdXQgPDwgIjogcHJvdG9jb2wgZXJyb3I6ICZ0aHJpZnRFcnJvcl0pICI7CisgICAgICAgIHNjb3BlX3VwKG91dCk7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmVzb2x2ZXIodGhyaWZ0RXJyb3IpOyIgPDwgZW5kbAorICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInJldHVybjsiIDw8IGVuZGw7CisgICAgICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICAgIH0KKworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXNvbHZlcigiOworICAgICAgaWYgKCgqZl9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KSA8PCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogVE1lc3NhZ2VUeXBlUkVQTFkiIDw8IGVuZGw7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6IHNlcUlEIiA8PCBlbmRsOworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBfX3RocmlmdEVycm9yXSkgcmV0dXJuIE5POyIgPDwgZW5kbDsKKyAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKCFbcmVzdWx0IHdyaXRlOiBvdXRQcm90b2NvbCBlcnJvcjogX190aHJpZnRFcnJvcl0pIHJldHVybiBOTzsiIDw8IGVuZGw7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICghW291dFByb3RvY29sIHdyaXRlTWVzc2FnZUVuZDogX190aHJpZnRFcnJvcl0pIHJldHVybiBOTzsiIDw8IGVuZGw7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmICghW1tvdXRQcm90b2NvbCB0cmFuc3BvcnRdIGZsdXNoOiBfX3RocmlmdEVycm9yXSkgcmV0dXJuIE5POyIgPDwgZW5kbDsKKyAgICB9CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gWUVTOyIgPDwgZW5kbDsKKworICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgfQorCisgIG91dCA8PCAiQGVuZCIgPDwgZW5kbCA8PCBlbmRsOworfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgorICoKKyAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkCisgKiBAcGFyYW0gZmllbGROYW1lIFRoZSB2YXJpYWJsZSBuYW1lIGZvciB0aGlzIGZpZWxkCisgKi8KK3ZvaWQgdF9jb2Nv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GJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAicmVhZEkzMjomIiA8PCBmaWVsZE5hbWUgPDwgIiBlcnJvcjogX190aHJpZnRFcnJvcl0iOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgInJlYWRJNjQ6JiIgPDwgZmllbGROYW1lIDw8ICIgZXJyb3I6IF9fdGhyaWZ0RXJyb3JdIjsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgb3V0IDw8ICJyZWFkRG91YmxlOiYiIDw8IGZpZWxkTmFtZSA8PCAiIGVycm9yOiBfX3RocmlmdEVycm9yXSI7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBPYmplY3RpdmUtQyBuYW1lIGZvciBiYXNlIHR5cGUgIgorICAgICAgICAgICAgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgInJlYWRJMzI6JiIgPDwgZmllbGROYW1lIDw8ICIgZXJyb3I6IF9fdGhyaWZ0RXJyb3JdIjsKKyAgICB9CisgICAgb3V0IDw8ICIpIHJldHVybiBOTzsiIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgcHJpbnRmKCJETyBOT1QgS05PVyBIT1cgVE8gREVTRVJJQUxJWkUgRklFTEQgJyVzJyBUWVBFICclcydcbiIsCisgICAgICAgICAgIHRmaWVsZC0+Z2V0X25hbWUoKS5jX3N0cigpLAorICAgICAgICAgICB0eXBlX25hbWUodHlwZSkuY19zdHIoKSk7CisgIH0KK30KKworLyoqCisgKiBHZW5lcmF0ZXMgYW4gdW5zZXJpYWxpemVyIGZvciBhIHN0cnVjdCwgYWxsb2NhdGVzIHRoZSBzdHJ1Y3QgYW5kIGludm9rZXMgcmVhZDoKKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgZmllbGROYW1lKSB7CisgIGluZGVudChvdXQpIDw8IHR5cGVfbmFtZSh0c3RydWN0KSA8PCBmaWVsZE5hbWUgPDwgIiA9IFtbIiA8PCB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSkKKyAgICAgICAgICAgICAgPDwgIiBhbGxvY10gaW5pdF07IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAiaWYgKCFbIiA8PCBmaWVsZE5hbWUgPDwgIiByZWFkOiBpblByb3RvY29sIGVycm9yOiBfX3RocmlmdEVycm9yXSkgcmV0dXJuIE5POyIgPDwgZW5kbDsKK30KKworLyoqCisgKiBEZXNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgcmVhZGluZyBpdHMgc2l6ZSBhbmQgdGhlbiBpdGVyYXRpbmcKKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBmaWVsZE5hbWUpIHsKKyAgc3RyaW5nIHNpemUgPSB0bXAoIl9zaX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cmV0dXJuICJbIiArIGZpZWxkX25hbWUgKyAiIGRvdWJsZVZhbHVlXSI7CisgICAgICBkZWZhdWx0OgorICAgICAgICBicmVhazsKKyAgICB9CisgIH0KKworICAvLyBkbyBub3RoaW5nCisgIHJldHVybiBmaWVsZF9uYW1lOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBjb2RlIHRvIGRlc2VyaWFsaXplIGEgbWFwIGVsZW1lbnQKKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgZmllbGROYW1lKSB7CisgIHN0cmluZyBrZXkgPSB0bXAoIl9rZXkiKTsKKyAgc3RyaW5nIHZhbCA9IHRtcCgiX3ZhbCIpOworICB0X3R5cGUqIGtleVR5cGUgPSB0bWFwLT5nZXRfa2V5X3R5cGUoKTsKKyAgdF90eXBlKiB2YWxUeXBlID0gdG1hcC0+Z2V0X3ZhbF90eXBlKCk7CisgIHRfZmllbGQgZmtleShrZXlUeXBlLCBrZXkpOworICB0X2ZpZWxkIGZ2YWwodmFsVHlwZSwgdmFsKTsKKworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZma2V5LCBrZXkpOworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZmdmFsLCB2YWwpOworCisgIGluZGVudChvdXQpIDw8ICJbIiA8PCBmaWVsZE5hbWUgPDwgIiBzZXRPYmplY3Q6ICIgPDwgYm94KHZhbFR5cGUsIHZhbCkKKyAgICAgICAgICAgICAgPDwgIiBmb3JLZXk6ICIgPDwgYm94KGtleVR5cGUsIGtleSkgPDwgIl07IiA8PCBlbmRsOworfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIHNldCBlbGVtZW50CisgKi8KK3ZvaWQgdF9jb2NvYV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkTmFtZSkgeworICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKKyAgdF90eXBlKiB0eXBlID0gdHNldC0+Z2V0X2VsZW1fdHlwZSgpOworICB0X2ZpZWxkIGZlbGVtKHR5cGUsIGVsZW0pOworCisgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZlbGVtLCBlbGVtKTsKKworICBpbmRlbnQob3V0KSA8PCAiWyIgPDwgZmllbGROYW1lIDw8ICIgYWRkT2JqZWN0OiAiIDw8IGJveCh0eXBlLCBlbGVtKSA8PCAiXTsiIDw8IGVuZGw7Cit9CisKKy8qKgorICogRGVzZXJpYWxpemVzIGEgbGlzdCBlbGVtZW50CisgKi8KK3ZvaWQgdF9jb2NvYV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgZmllbGROYW1lKSB7CisgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICB0X3R5cGUqIHR5cGUgPSB0bGlzdC0+Z2V0X2VsZW1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bGl6ZV9jb250YWluZXIob3V0LCB0eXBlLCBmaWVsZE5hbWUpOworICB9IGVsc2UgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpIHx8IHR5cGUtPmlzX2VudW0oKSkgeworICAgIGluZGVudChvdXQpIDw8ICJpZiAoIVtvdXRQcm90b2NvbCAiOworCisgICAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgICB0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNlID0gKCh0X2Jhc2VfdHlwZSopdHlwZSktPmdldF9iYXNlKCk7CisgICAgICBzd2l0Y2ggKHRiYXNlKSB7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1ZPSUQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogY2Fubm90IHNlcmlhbGl6ZSB2b2lkIGZpZWxkIGluIGEgc3RydWN0OiAiICsgZmllbGROYW1lOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICBvdXQgPDwgIndyaXRlQmluYXJ5OiAiIDw8IGZpZWxkTmFtZSA8PCAiIGVycm9yOiBfX3RocmlmdEVycm9yXSI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgb3V0IDw8ICJ3cml0ZVN0cmluZzogIiA8PCBmaWVsZE5hbWUgPDwgIiBlcnJvcjogX190aHJpZnRFcnJvcl0iOworICAgICAgICB9CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICBvdXQgPDwgIndyaXRlQm9vbDogIiA8PCBmaWVsZE5hbWUgPDwgIiBlcnJvcjogX190aHJpZnRFcnJvcl0iOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAid3JpdGVCeXRlOiAoVUludDgpIiA8PCBmaWVsZE5hbWUgPDwgIiBlcnJvcjogX190aHJpZnRFcnJvcl0iOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2OiAiIDw8IGZpZWxkTmFtZSA8PCAiIGVycm9yOiBfX3RocmlmdEVycm9yXSI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAid3JpdGVJMzI6ICIgPDwgZmllbGROYW1lIDw8ICIgZXJyb3I6IF9fdGhyaWZ0RXJyb3JdIjsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgb3V0IDw8ICJ3cml0ZUk2NDogIiA8PCBmaWVsZE5hbWUgPDwgIiBlcnJvcjogX190aHJpZnRFcnJvcl0iOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlOiAiIDw8IGZpZWxkTmFtZSA8PCAiIGVycm9yOiBfX3RocmlmdEVycm9yXSI7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBPYmplY3RpdmUtQyBuYW1lIGZvciBiYXNlIHR5cGUgIgorICAgICAgICAgICAgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgIndyaXRlSTMyOiAiIDw8IGZpZWxkTmFtZSA8PCAiIGVycm9yOiBfX3RocmlmdEVycm9yXSI7CisgICAgfQorICAgIG91dCA8PCAiKSByZX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fY29jb2FfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkTmFtZSkgeworICBzY29wZV91cChvdXQpOworCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCFbb3V0UHJvdG9jb2wgd3JpdGVNYXBCZWdpbldpdGhLZXlUeXBlOiAiCisgICAgICAgICAgICAgICAgPDwgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X2tleV90eXBlKCkpCisgICAgICAgICAgICAgICAgPDwgIiB2YWx1ZVR5cGU6ICIgPDwgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X3ZhbF90eXBlKCkpIDw8ICIgc2l6ZTogKFNJbnQzMilbIgorICAgICAgICAgICAgICAgIDw8IGZpZWxkTmFtZSA8PCAiIGNvdW50XSBlcnJvcjogX190aHJpZnRFcnJvcl0pIHJldHVybiBOTzsiIDw8IGVuZGw7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgImlmICghW291dFByb3RvY29sIHdyaXRlU2V0QmVnaW5XaXRoRWxlbWVudFR5cGU6ICIKKyAgICAgICAgICAgICAgICA8PCB0eXBlX3RvX2VudW0oKCh0X3NldCopdHR5cGUpLT5nZXRfZWxlbV90eXBlKCkpIDw8ICIgc2l6ZTogKFNJbnQzMilbIiA8PCBmaWVsZE5hbWUKKyAgICAgICAgICAgICAgICA8PCAiIGNvdW50XSBlcnJvcjogX190aHJpZnRFcnJvcl0pIHJldHVybiBOTzsiIDw8IGVuZGw7CisgI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IHsKKyAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCFbb3V0UHJvdG9jb2wgd3JpdGVTZXRFbmQ6IF9fdGhyaWZ0RXJyb3JdKSByZXR1cm4gTk87IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCFbb3V0UHJvdG9jb2wgd3JpdGVMaXN0RW5kOiBfX3RocmlmdEVycm9yXSkgcmV0dXJuIE5POyIgPDwgZW5kbDsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgorICovCit2b2lkIHRfY29jb2FfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcE5hbWUpIHsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtleSk7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsIHVuYm94KGtmaWVsZC5nZXRfdHlwZSgpLCBrZXkpKTsKKyAgdF9maWVsZCB2ZmllbGQodG1hcC0+Z2V0X3ZhbF90eXBlKCksICJbIiArIG1hcE5hbWUgKyAiIG9iamVjdEZvcktleTogIiArIGtleSArICJdIik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZ2ZmllbGQsIHVuYm94KHZmaWVsZC5nZXRfdHlwZSgpLCB2ZmllbGQuZ2V0X25hbWUoKSkpOworfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBzZXQuCisgKi8KK3ZvaWQgdF9jb2NvYV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGVsZW1lbnROYW1lKSB7CisgIHRfZmllbGQgZWZpZWxkKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgZWxlbWVudE5hbWUpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmZWZpZWxkLCB1bmJveChlZmllbGQuZ2V0X3R5cGUoKSwgZWxlbWVudE5hbWUpKTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbGlzdC4KKyAqLwordm9pZCB0X2NvY29hX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpbmRleCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGxpc3ROYW1lKSB7CisgIHRfZmllbGQgZWZpZWxkKHRsaXN0LT5nZXRfZWxlbV90eXBlKCksICJbIiArIGxpc3ROYW1lICsgIiBvYmplY3RBdEluZGV4OiAiICsgaW5kZXggKyAiXSIpOworICBnZW5lc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cgImNvbXBpbGVyIGVycm9yOiBubyBjb25zdCBvZiB0eXBlICIgKyB0eXBlLT5nZXRfbmFtZSgpOworICB9Cit9CisKK3N0cmluZyB0X2NvY29hX2dlbmVyYXRvcjo6cmVuZGVyX2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBib3hfaXQpIHsKKyAgdHlwZSA9IGdldF90cnVlX3R5cGUodHlwZSk7CisgIHN0ZDo6b3N0cmluZ3N0cmVhbSByZW5kZXI7CisKKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOworICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgIC8vIFdlIG11c3QgaGFuZGxlIGJpbmFyeSBjb25zdGFudCBidXQgdGhlIHN5bnRheCBvZiBJREwgZGVmaW5lcworICAgICAgLy8gbm90aGluZyBhYm91dCBiaW5hcnkgY29uc3RhbnQuCisgICAgICAvLyAgIGlmIHR5cGUtPmlzX2JpbmFyeSgpKQorICAgICAgLy8gICAgICAvLyBiaW5hcnkgY29kZQorICAgICAgcmVuZGVyIDw8ICJAXCIiIDw8IGdldF9lc2NhcGVkX3N0cmluZyh2YWx1ZSkgPDwgJyInOworICAgICAgYnJlYWs7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgcmVuZGVyIDw8ICgodmFsdWUtPmdldF9pbnR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kZXIuc3RyKCk7Cit9CisKKyNpZiAwCisvKioKK09SSUdJTkFMCisgKiBTcGl0IG91dCBjb2RlIHRoYXQgZXZhbHVhdGVzIHRvIHRoZSBzcGVjaWZpZWQgY29uc3RhbnQgdmFsdWUuCisgKi8KK3N0cmluZyB0X2NvY29hX2dlbmVyYXRvcjo6cmVuZGVyX2NvbnN0X3ZhbHVlKHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGJveF9pdCkgeworICB0eXBlID0gZ2V0X3RydWVfdHlwZSh0eXBlKTsKKyAgc3RkOjpvc3RyaW5nc3RyZWFtIHJlbmRlcjsKKworICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICB0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNlID0gKCh0X2Jhc2VfdHlwZSopdHlwZSktPmdldF9iYXNlKCk7CisgICAgc3dpdGNoICh0YmFzZSkgeworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgcmVuZGVyIDw8ICJAXCIiIDw8IGdldF9lc2NhcGVkX3N0cmluZyh2YWx1ZSkgPDwgJyInOworICAgICAgYnJlYWs7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgcmVuZGVyIDw8ICgodmFsdWUtPmdldF9pbnRlZ2VyKCkgPiAwKSA/ICJZRVMiIDogIk5PIik7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZU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UiKSA9PSAwKSB7CisgICAgICAgIGdlbl9jb2Jfc3R5bGVfID0gdHJ1ZTsKKyAgICAgIH0gZWxzZSBpZiggaXRlci0+Zmlyc3QuY29tcGFyZSgibm9fY2xpZW50X2NvbXBsZXRpb24iKSA9PSAwKSB7CisgICAgICAgIGdlbl9ub19jbGllbnRfY29tcGxldGlvbl8gPSB0cnVlOworICAgICAgfSBlbHNlIGlmKCBpdGVyLT5maXJzdC5jb21wYXJlKCJub19kZWZhdWx0X29wZXJhdG9ycyIpID09IDApIHsKKyAgICAgICAgZ2VuX25vX2RlZmF1bHRfb3BlcmF0b3JzXyA9IHRydWU7CisgICAgICB9IGVsc2UgaWYoIGl0ZXItPmZpcnN0LmNvbXBhcmUoInRlbXBsYXRlcyIpID09IDApIHsKKyAgICAgICAgZ2VuX3RlbXBsYXRlc18gPSB0cnVlOworICAgICAgICBnZW5fdGVtcGxhdGVzX29ubHlfID0gKGl0ZXItPnNlY29uZCA9PSAib25seSIpOworICAgICAgfSBlbHNlIGlmKCBpdGVyLT5maXJzdC5jb21wYXJlKCJtb3ZlYWJsZV90eXBlcyIpID09IDApIHsKKyAgICAgICAgZ2VuX21vdmVhYmxlXyA9IHRydWU7CisgICAgICB9IGVsc2UgaWYgKCBpdGVyLT5maXJzdC5jb21wYXJlKCJub19vc3RyZWFtX29wZXJhdG9ycyIpID09IDApIHsKKyAgICAgICAgZ2VuX25vX29zdHJlYW1fb3BlcmF0b3JzXyA9IHRydWU7CisgICAgICB9IGVsc2UgaWYgKCBpdGVyLT5maXJzdC5jb21wYXJlKCJub19za2VsZXRvbiIpID09IDApIHsKKyAgICAgICAgZ2VuX25vX3NrZWxldG9uXyA9IHRydWU7CisgICAgICB9IGVsc2UgeworICAgICAgICB0aHJvdyAidW5rbm93biBvcHRpb24gY3BwOiIgKyBpdGVyLT5maXJzdDsKKyAgICAgIH0KKyAgICB9CisKKyAgICBvdXRfZGlyX2Jhc2VfID0gImdlbi1jcHAiOworICB9CisKKyAgLyo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vbnN0X3ZhbHVlKHN0ZDo6b3N0cmVhbSYgb3V0LCBzdGQ6OnN0cmluZyBuYW1lLCB0X3R5cGUqIHR5cGUsIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKyAgc3RkOjpzdHJpbmcgcmVuZGVyX2NvbnN0X3ZhbHVlKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKworICB2b2lkIGdlbmVyYXRlX3N0cnVjdF9kZWNsYXJhdGlvbihzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlcnMgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCByZWFkID0gdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB3cml0ZSA9IHRydWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc3dhcCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3VzZXJfc3RydWN0ID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX3N0cnVjdF9kZWZpbml0aW9uKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgZm9yY2V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ICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzdWZmaXggPSAiIik7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3Qoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyID0gZmFsc2UpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKHN0ZDo6b3N0cmVhbSYgb3V0LCB0X3R5cGUqIHR0eXBlLCBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwgdF9zZXQqIHRzZXQsIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LCB0X21hcCogdG1hcCwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcHVzaF9iYWNrLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpbmRleCk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHN1ZmZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zdHJ1Y3Qoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyID0gZmFsc2UpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihzdGQ6Om9zdHJlYW0mIG91dCwgdF90eXBlKiB0dHlwZSwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LCB0X21hcCogdG1hcCwgc3RkOjpzdHJpbmcgaXRlcik7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc2V0KiB0bWFwLCBzdGQ6OnN0cmluZyBpdGVyKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsIHRfbGlzdCogdGxpc3QsIHN0ZDo6c3RyaW5nIGl0ZXIpOworCisgIHZvaWQgZ2VuZXJhdGVfZnVuY3Rpb25fY2FsbChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdGFyZ2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGFyZ19wcmVmaXgpOworICAvKgorICAgKiBIZWxwZXIgcmVuZGVyaW5nIGZ1bmN0aW9ucworICAgKi8KKworICBzdGQ6OnN0cmluZyBuYW1lc3BhY2VfcHJlZml4KHN0ZDo6c3RyaW5nIG5zKTsKKyAgc3RkOjpzdHJpbmcgbmFtZXNwYWNlX29wZW4oc3RkOjpzdHJpbmcgbnMpOworICBzdGQ6OnN0cmluZyBuYW1lc3BhY2VfY2xvc2Uoc3RkOjpzdHJpbmcgbnMpOworICBzdGQ6OnN0cmluZyB0eXBlX25hbWUodF90eXBlKiB0dHlwZSwgYm9vbCBpbl90eXBlZGVmID0gZmFsc2UsIGJvb2wgYXJnID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBiYXNlX3R5cGVfbmFtZSh0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNlKTsKKyAgc3RkOjpzdHJpbmcgZGVjbGFyZV9maWVsZCh0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbml0ID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBjb25zdGFudCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVmZXJlbmNlID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBmdW5jdGlvbl9zaWduYXR1cmUodF9mdW5jdGlvbiogdGZ1bmN0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgc3R5bGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgbmFtZV9wYXJhbXMgPSB0cnVlKTsKKyAgc3RkOjpzdHJpbmcgY29iX2Z1bmN0aW9uX3NpZ25hdHVyZSh0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBuYW1lX3BhcmFtcyA9IHRydWUpOworICBzdGQ6OnN0cmluZyBhcmd1bWVudF9saXN0KHRfc3RydWN0KiB0c3RydWN0LCBib29sIG5hbWVfcGFyYW1zID0gdHJ1ZSwgYm9vbCBzdGFydF9jb21tYSA9IGZhbHNlKTsKKyAgc3RkOjpzdHJpbmcgdHlwZV90b19lbnVtKHRfdHlwZSogdHR5cGUpOworCisgIHZvaWQgZ2VuZXJhdGVfZW51bV9jb25zdGFudF9saXN0KHN0ZDo6b3N0cmVhbSYgZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmVjdG9yPHRfZW51bV92YWx1ZSo+JiBjb25zdGFudHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciogc3VmZml4LAorICAgICAgICAgICAgICAgICAgICAgICAg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GVuZGwgPDwgZW5kbDsKKyAgfQorCisgIC8vIENsb3NlIGlmbmRlZgorICBmX3R5cGVzXyA8PCAiI2VuZGlmIiA8PCBlbmRsOworICBmX3R5cGVzX3RjY18gPDwgIiNlbmRpZiIgPDwgZW5kbDsKKworICAvLyBDbG9zZSBvdXRwdXQgZmlsZQorICBmX3R5cGVzXy5jbG9zZSgpOworICBmX3R5cGVzX2ltcGxfLmNsb3NlKCk7CisgIGZfdHlwZXNfdGNjXy5jbG9zZSgpOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHR5cGVkZWYuIFRoaXMgaXMganVzdCBhIHNpbXBsZSAxLWxpbmVyIGluIEMrKworICoKKyAqIEBwYXJhbSB0dHlwZWRlZiBUaGUgdHlwZSBkZWZpbml0aW9uCisgKi8KK3ZvaWQgdF9jcHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV90eXBlZGVmKHRfdHlwZWRlZiogdHR5cGVkZWYpIHsKKyAgZl90eXBlc18gPDwgaW5kZW50KCkgPDwgInR5cGVkZWYgIiA8PCB0eXBlX25hbWUodHR5cGVkZWYtPmdldF90eXBlKCksIHRydWUpIDw8ICIgIgorICAgICAgICAgICA8PCB0dHlwZWRlZi0+Z2V0X3N5bWJvbGljKCkgPDwgIjsiIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2NwcF9nZW5lcmF0b3I6OmdlbmVyYXRlX2VudW1fY29uc3RhbnRfbGlzdChzdGQ6Om9zdHJlYW0mIGYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZlY3Rvcjx0X2VudW1fdmFsdWUqPiYgY29uc3RhbnRzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIHN1ZmZp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LCAqdl9pdGVyKTsKKyAgICAgIGluZGVudChvdXQpIDw8IG5hbWUgPDwgIi5pbnNlcnQoIiA8PCB2YWwgPDwgIik7IiA8PCBlbmRsOworICAgIH0KKyAgICBvdXQgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICB0aHJvdyAiSU5WQUxJRCBUWVBFIElOIHByaW50X2NvbnN0X3ZhbHVlOiAiICsgdHlwZS0+Z2V0X25hbWUoKTsKKyAgfQorfQorCisvKioKKyAqCisgKi8KK3N0cmluZyB0X2NwcF9nZW5lcmF0b3I6OnJlbmRlcl9jb25zdF92YWx1ZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKSB7CisgICh2b2lkKW5hbWU7CisgIHN0ZDo6b3N0cmluZ3N0cmVhbSByZW5kZXI7CisKKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOworICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgIHJlbmRlciA8PCAnIicgPDwgZ2V0X2VzY2FwZWRfc3RyaW5nKHZhbHVlKSA8PCAnIic7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICByZW5kZXIgPDwgKCh2YWx1ZS0+Z2V0X2ludGVnZXIoKSA+IDApID8gInRydWUiIDogImZhbHNlIik7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRf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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX21vdmUpIHsKKworICBzdGQ6OnN0cmluZyB0bXBfbmFtZSA9IHRtcCgib3RoZXIiKTsKKworICBpbmRlbnQob3V0KSA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICI6OiIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKTsKKworICBpZiAoaXNfbW92ZSkgeworICAgIG91dCA8PCAiKCAiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgIiYmICI7CisgIH0gZWxzZSB7CisgICAgb3V0IDw8ICIoY29uc3QgIiA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICImICI7CisgIH0KKyAgb3V0IDw8IHRtcF9uYW1lIDw8ICIpICI7CisgIGlmIChpc19leGNlcHRpb24pCisgICAgb3V0IDw8ICI6IFRFeGNlcHRpb24oKSAiOworICBvdXQgPDwgInsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworCisgIC8vIGVsaW1pbmF0ZSBjb21waWxlciB1bnVzZWQgd2FybmluZworICBpZiAobWVtYmVycy5lbXB0eSgpKQorICAgIGluZGVudChvdXQpIDw8ICIodm9pZCkgIiA8PCB0bXBfbmFtZSA8PCAiOyIgPDwgZW5kbDsKKworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBmX2l0ZXI7CisgIGJvb2wgaGFzX25vbnJlcXVpcmVkX2ZpZWxkcyA9IGZhbHNlOworICBmb3IgKGZfaXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgZl9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgaWYgKCg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KCkgPDwgIiA9ICIKKyAgICAgICAgICAgICAgICA8PCBtYXliZU1vdmUodG1wX25hbWUgKyAiLiIgKyAoKmZfaXRlciktPmdldF9uYW1lKCksIGlzX21vdmUpIDw8ICI7IiA8PCBlbmRsOworICB9CisgIGlmIChoYXNfbm9ucmVxdWlyZWRfZmllbGRzKSB7CisgICAgaW5kZW50KG91dCkgPDwgIl9faXNzZXQgPSAiIDw8IG1heWJlTW92ZSh0bXBfbmFtZSArICIuX19pc3NldCIsIGlzX21vdmUpIDw8ICI7IiA8PCBlbmRsOworICB9CisKKyAgaW5kZW50KG91dCkgPDwgInJldHVybiAqdGhpczsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworfQorCisvKioKKyAqIFdyaXRlcyB0aGUgc3RydWN0IGRlY2xhcmF0aW9uIGludG8gdGhlIGhlYWRlciBmaWxlCisgKgorICogQHBhcmFtIG91dCBPdXRwdXQgc3RyZWFtCisgKiBAcGFyYW0gdHN0cnVjdCBUaGUgc3RydWN0CisgKi8KK3ZvaWQgdF9jcHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zdHJ1Y3RfZGVjbGFyYXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcmVhZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB3cml0ZSwKKyAgICAgICAgICAgICAg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cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zdHJlYW0mIGZvcmNlX2NwcF9vdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBzZXR0ZXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfdXNlcl9zdHJ1Y3QpIHsKKyAgLy8gR2V0IG1lbWJlcnMKKyAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgbV9pdGVyOworICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBtZW1iZXJzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKworICAvLyBEZXN0cnVjdG9yCisgIGlmICh0c3RydWN0LT5hbm5vdGF0aW9uc18uZmluZCgiZmluYWwiKSA9PSB0c3RydWN0LT5hbm5vdGF0aW9uc18uZW5kKCkpIHsKKyAgICBmb3JjZV9jcHBfb3V0IDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiOjp+IiA8PCB0c3RydWN0LT5nZXRfbmFtZSgpCisgICAgICAgICAgICAgICAgICA8PCAiKCkgbm9leGNlcHQgeyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKworICAgIGluZGVudF9kb3duKCk7CisgICAgZm9yY2VfY3BwX291dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICB9CisKKyAgLy8gQ3JlYXRlIGEgc2V0dGVyIGZ1bmN0aW9uIGZvciBlYWNoIGZpZWxkCisgIGlmIChzZXR0ZXJzKSB7CisgICAgZm9yIChtX2l0ZXIgPSBtZW1iZXJzLmJlZ2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CkgPDwgInJldHVybjsiIDw8IGVuZGw7CisgICAgICB9IGVsc2UgeworICAgICAgICBmX2hlYWRlcl8gPDwgaW5kZW50KCkgPDwgZGVjbGFyZV9maWVsZCgmcmV0dXJuZmllbGQsIHRydWUpIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICAgIDw8ICJyZXR1cm4gX3JldHVybjsiIDw8IGVuZGw7CisgICAgICB9CisgICAgfSBlbHNlIGlmIChzdHlsZSA9PSAiQ29iU3YiKSB7CisgICAgICBpZiAocmV0dXJudHlwZS0+aXNfdm9pZCgpKSB7CisgICAgICAgIGZfaGVhZGVyXyA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIGNvYigpOyIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHRfZmllbGQgcmV0dXJuZmllbGQocmV0dXJudHlwZSwgIl9yZXR1cm4iKTsKKyAgICAgICAgZl9oZWFkZXJfIDw8IGluZGVudCgpIDw8IGRlY2xhcmVfZmllbGQoJnJldHVybmZpZWxkLCB0cnVlKSA8PCBlbmRsIDw8IGluZGVudCgpCisgICAgICAgICAgICAgICAgICA8PCAicmV0dXJuIGNvYihfcmV0dXJuKTsiIDw8IGVuZGw7CisgICAgICB9CisKKyAgICB9IGVsc2UgeworICAgICAgdGhyb3cgIlVOS05PV04gU1RZTEUiOworICAgIH0KKworICAgIGluZGVudF9kb3duKCk7CisgICAgZl9oZWFkZXJfIDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICB9CisgIGluZGVudF9kb3duKCk7CisgIGZfaGVhZGVyXyA8PCAifTsiIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2NwcF9nZW5lcmF0b3I6OmdlbmVyYXRlX2Z1bmN0aW9uX2NhbGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGZ1bmN0aW9uLAorICAgICAg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aWZ0OjpURXhjZXB0aW9uKFwiIgorICAgICAgICAgICAgICAgICAgPDwgIlRQcm90b2NvbEZhY3RvcnkgcmV0dXJuZWQgdW5leHBlY3RlZCBwcm90b2NvbCB0eXBlIGluICIgPDwgc2VydmljZV9uYW1lXworICAgICAgICAgICAgICAgICAgPDwgc3R5bGUgPDwgIkNsaWVudCIgPDwgc2hvcnRfc3VmZml4IDw8ICIgY29uc3RydWN0b3JcIik7IiA8PCBlbmRsIDw8IGluZGVudCgpCisgICAgICAgICAgICAgICAgICA8PCAiICB9IiA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9oZWFkZXJfIDw8IGluZGVudCgpIDw8ICIgIHBpcHJvdF8ocHJvdG9jb2xGYWN0b3J5LT5nZXRQcm90b2NvbChpdHJhbnNfKSksIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiICBwb3Byb3RfKHByb3RvY29sRmFjdG9yeS0+Z2V0UHJvdG9jb2wob3RyYW5zXykpIHsiIDw8IGVuZGw7CisgICAgICB9CisgICAgICBmX2hlYWRlcl8gPDwgaW5kZW50KCkgPDwgIiAgaXByb3RfID0gcGlwcm90Xy5nZXQoKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICA8PCAiICBvcHJvdF8gPSBwb3Byb3RfLmdldCgpOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKyAgICB9IGVsc2UgeworICAgICAgZl9oZWFkZXJfIDw8IGluZGVudCgpIDw8ICIgICIgPDwgZXh0ZW5kcyA8PCBzdHlsZSA8PCBjbGllbnRfc3VmZml4CisgICAgICAgICAgICAgICAgPDwgIihjaGFubmVsLCBwcm90b2NvbEZhY3RvcnkpIHt9IiA8PCBlbmRsOworICAgIH0KKyAgfQorCisgIGlmIChzdHlsZSA9PSAiQ29iIikgeworICAgIGZfaGVhZGVyXyA8PCBpbmRlbnQoKQorICA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cm9tIHRoZSBzZW5kIGZ1bmN0aW9uIHRvIHRoZQorICAgICAgLy8gcmVjdiBmdW5jdGlvbi4gIE9uZXdheSBtZXRob2RzIGRvbid0IGhhdmUgYSByZWN2IGZ1bmN0aW9uLCBzbyB3ZSBkb24ndCBuZWVkIHRvCisgICAgICAvLyBtb3ZlIHRoZSBzZXFpZCBmb3IgdGhlbS4gIEF0dGVtcHRpbmcgdG8gZG8gc28gd291bGQgcmVzdWx0IGluIGEgc2VxaWQgbGVhay4KKyAgICAgIHRfZnVuY3Rpb24gc2VuZF9mdW5jdGlvbihnX3R5cGVfaTMyLCAvKnJldHVybmluZyBzZXFpZCovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nKCJzZW5kXyIpICsgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgqZl9pdGVyKS0+Z2V0X2FyZ2xpc3QoKSk7CisgICAgICBpbmRlbnQoZl9oZWFkZXJfKSA8PCBmdW5jdGlvbl9zaWduYXR1cmUoJnNlbmRfZnVuY3Rpb24sICIiKSA8PCAiOyIgPDwgZW5kbDsKKyAgICB9IGVsc2UgeworICAgICAgdF9mdW5jdGlvbiBzZW5kX2Z1bmN0aW9uKGdfdHlwZV92b2lkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZygic2VuZF8iKSArICgqZl9pdGVyKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF9hcmdsaXN0KCkpOworICAgICAgaW5kZW50KGZfaGVhZGVyXykgPDwgZnVuY3Rpb25fc2lnbmF0dXJlKCZzZW5kX2Z1bmN0aW9uLCAiIikgPDwgIjsiIDw8IGVuZGw7CisgICAgfQorICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgaWYgKHN0eWxlID09ICJDb25jdXJyZW50IikgeworICAgICAgICB0X2ZpZWxkIHNlcUlkQXJnKGdfdHlwZV9pMzIsICJzZXFpZCIpOworICAgICAgICB0X3N0cnVjdCBzZXFJZEFyZ1N0cnVjdChwcm9ncmFtXyk7CisgICAgICAgIHNlcUlkQXJnU3RydWN0LmFwcGVuZCgmc2VxSWRBcmcpOworICAgICAgICB0X2Z1bmN0aW9uIHJlY3ZfZnVuY3Rpb24oKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nKCJyZWN2XyIpICsgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNlcUlkQXJnU3RydWN0KTsKKyAgICAgICAgaW5kZW50KGZfaGVhZGVyXykgPDwgZnVuY3Rpb25fc2lnbmF0dXJlKCZyZWN2X2Z1bmN0aW9uLCAiIikgPDwgIjsiIDw8IGVuZGw7CisgICAgICB9IGVsc2UgeworICAgICAgICB0X3N0cnVjdCBub2FyZ3MocHJvZ3JhbV8pOworICAgICAgICB0X2Z1bmN0aW9uIHJlY3ZfZnVuY3Rpb24oKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nKCJyZWN2XyIpICsgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm5vYXJncyk7CisgICAgICAgIGluZGVudChmX2hlYWRlcl8pIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSgmcmVjdl9mdW5jdGlvbiwgIiIpIDw8ICI7IiA8PCBlbmRsOworICAgICAgfQorICAgIH0KKyAgfQorICBpbmRlbnRfZG93bigpOworCisgIGlmIChleHRlbmRzLmVtcHR5KCkpIHsKKyAgICBmX2hlYWRlcl8gPDwgIiBwcm90ZWN0ZWQ6IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOwor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KCk7IiA8PCBlbmRsOworCisgICAgICBpZiAoc3R5bGUgPT0gIkNvbmN1cnJlbnQiKSB7CisgICAgICAgIG91dCA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICJzZW50cnkuY29tbWl0KCk7IiA8PCBlbmRsOworCisgICAgICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIGNzZXFpZDsiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICAgIG91dCA8PCBlbmRsOworCisgICAgICAvLyBHZW5lcmF0ZSByZWN2IGZ1bmN0aW9uIG9ubHkgaWYgbm90IGFuIG9uZXdheSBmdW5jdGlvbgorICAgICAgaWYgKCEoKmZfaXRlciktPmlzX29uZXdheSgpKSB7CisgICAgICAgIHRfc3RydWN0IG5vYXJncyhwcm9ncmFtXyk7CisKKyAgICAgICAgdF9maWVsZCBzZXFJZEFyZyhnX3R5cGVfaTMyLCAic2VxaWQiKTsKKyAgICAgICAgdF9zdHJ1Y3Qgc2VxSWRBcmdTdHJ1Y3QocHJvZ3JhbV8pOworICAgICAgICBzZXFJZEFyZ1N0cnVjdC5hcHBlbmQoJnNlcUlkQXJnKTsKKworICAgICAgICB0X3N0cnVjdCogcmVjdl9mdW5jdGlvbl9hcmdzID0gJm5vYXJnczsKKyAgICAgICAgaWYgKHN0eWxlID09ICJDb25jdXJyZW50IikgeworICAgICAgICAgIHJlY3ZfZnVuY3Rpb25fYXJncyA9ICZzZXFJZEFyZ1N0cnVjdDsKKyAgICAgICAgfQorCisgICAgICAgIHRfZnVuY3Rpb24gcmVjdl9mdW5jdGlvbigoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcoInJlY3ZfIikgKyAoKmZfaXRlciktPmdldF9uYW1lKCksCisgICAg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U2VudHJ5IHNlbnRyeSgmdGhpcy0+c3luY18sIHNlcWlkKTsiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHN0eWxlID09ICJDb2IiICYmICFnZW5fbm9fY2xpZW50X2NvbXBsZXRpb25fKSB7CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJib29sIGNvbXBsZXRlZCA9IGZhbHNlOyIgPDwgZW5kbCA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICJ0cnkgeyI7CisgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8IGVuZGw7CisgICAgICAgIGlmIChzdHlsZSA9PSAiQ29uY3VycmVudCIpIHsKKyAgICAgICAgICBvdXQgPDwKKyAgICAgICAgICAgIGluZGVudCgpIDw8ICJ3aGlsZSh0cnVlKSB7IiA8PCBlbmRsIDw8CisgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICBpZighdGhpcy0+c3luY18uZ2V0UGVuZGluZyhmbmFtZSwgbXR5cGUsIHJzZXFpZCkpIHsiIDw8IGVuZGw7CisgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8CisgICAgICAgICAgaW5kZW50KCkgPDwgX3RoaXMgPDwgImlwcm90Xy0+cmVhZE1lc3NhZ2VCZWdpbihmbmFtZSwgbXR5cGUsIHJzZXFpZCk7IiA8PCBlbmRsOworICAgICAgICBpZiAoc3R5bGUgPT0gIkNvbmN1cnJlbnQiKSB7CisgICAgICAgICAgc2NvcGVfZG93bihvdXQpOworICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYoc2VxaWQgPT0gcnNlcWlkKSB7IiA8PCBlbmRsOworICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICB9CisgICAgICAgIG91dCA8PAorICAgICAgICAgIGluZGVudCgpIDw8ICJpZiAobXR5cGUgPT0gOjphcG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9yZXR1cm4iKTsKKyAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgZGVjbGFyZV9maWVsZCgmcmV0dXJuZmllbGQpIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgcmVzdWx0bmFtZSA8PCAiIHJlc3VsdDsiIDw8IGVuZGw7CisKKyAgICAgICAgaWYgKCEoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgeworICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmVzdWx0LnN1Y2Nlc3MgPSAmX3JldHVybjsiIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJlc3VsdC5yZWFkKCIgPDwgX3RoaXMgPDwgImlwcm90Xyk7IiA8PCBlbmRsIDw8IGluZGVudCgpIDw8IF90aGlzCisgICAgICAgICAgICA8PCAiaXByb3RfLT5yZWFkTWVzc2FnZUVuZCgpOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCBfdGhpcworICAgICAgICAgICAgPDwgImlwcm90Xy0+Z2V0VHJhbnNwb3J0KCktPnJlYWRFbmQoKTsiIDw8IGVuZGwgPDwgZW5kbDsKKworICAgICAgICAvLyBDYXJlZnVsLCBvbmx5IGxvb2sgZm9yIF9yZXN1bHQgaWYgbm90IGEgdm9pZCBmdW5jdGlvbgorICAgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgICAgaWYgKGlzX2NvbXBsZXhfdHlwZSgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCkpKSB7CisgICAgICAgICAgICBvdXQgPDwKKyAgICAgICAgICAgICAgaW5kZW50KCkgPDwgImlmIChyZXN1bHQuX19pc3NldC5zdWNjZXNzKSB7IiA8PCBlbmRsOworICAgICAgICAgICAgb3V0IDw8CisgICAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIC8vIF9yZXR1cm4gcG9pbnRlciBoYXMgbm93IGJlZW4gZmlsbGVkIiA8PCBlbmRsOworICAgICAgICAgICAgaWYgKHN0eWxlID09ICJDb2IiICYmICFnZW5fbm9fY2xpZW50X2NvbXBsZXRpb25fKSB7CisgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICBjb21wbGV0ZWQgPSB0cnVlOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiICBjb21wbGV0ZWRfXyh0cnVlKTsiCisgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHN0eWxlID09ICJDb25jdXJyZW50IikgeworICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIiAgc2VudHJ5LmNvbW1pdCgpOyIgPDwgZW5kbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG91dCA8PAorICAgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICByZXR1cm47IiA8PCBlbmRsIDw8CisgICAgICAgICAgICAgIGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmIChyZXN1bHQuX19pc3NldC5zdWNjZXNzKSB7IiA8PCBlbmRsOworICAgICAgICAgICAgaWYgKHN0eWxlID09ICJDb2IiICYmICFnZW5fbm9fY2xpZW50X2NvbXBsZXRpb25fKSB7CisgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICBjb21wbGV0ZWQgPSB0cnVlOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiICBjb21wbGV0ZWRfXyh0cnVlKTsiCisgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHN0eWxlID09ICJDb25jdXJyZW50IikgeworICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KC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AgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIgIHRocm93IHJlc3VsdC4iIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiOyIgPDwgZW5kbCA8PCBpbmRlbnQoKQorICAgICAgICAgICAgICA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFdlIG9ubHkgZ2V0IGhlcmUgaWYgd2UgYXJlIGEgdm9pZCBmdW5jdGlvbgorICAgICAgICBpZiAoKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpIHsKKyAgICAgICAgICBpZiAoc3R5bGUgPT0gIkNvYiIgJiYgIWdlbl9ub19jbGllbnRfY29tcGxldGlvbl8pIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiY29tcGxldGVkID0gdHJ1ZTsiIDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgImNvbXBsZXRlZF9fKHRydWUpOyIKKyAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgICAgIH0KKyAgICAgICAgICBpZiAoc3R5bGUgPT0gIkNvbmN1cnJlbnQiKSB7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInNlbnRyeS5jb21taXQoKTsiIDw8IGVuZGw7CisgICAgICAgICAgfQorICAgICAgICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm47IiA8PCBlbmRsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIGlmIChzdHlsZSA9PSAiQ29iIiAmJiAhZ2VuX25vX2NsaWVudF9jb21wbGV0aW9uXykgeworICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJjb21wbGV0ZWQgPSB0cnVlOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiY29tcGxldGVkX18odHJ1ZSk7IgorICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICAgICAgfQorICAgICAgICAgIGlmIChzdHlsZSA9PSAiQ29uY3VycmVudCIpIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiLy8gaW4gYSBiYWQgc3RhdGUsIGRvbid0IGNvbW1pdCIgPDwgZW5kbDsKKyAgICAgICAgICB9CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ0aHJvdyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI6OmFwYWNoZTo6dGhyaWZ0OjpUQXBwbGljYXRpb25FeGNlcHRpb24oOjphcGFjaGU6OnRocmlmdDo6IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVEFwcGxpY2F0aW9uRXhjZXB0aW9uOjpNSVNTSU5HX1JFU1VMVCwgXCIiIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICA8PCAiIGZhaWxlZDogdW5rbm93biByZXN1bHRcIik7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGlmIChzdHlsZSA9PSAiQ29uY3VycmVudCIpIHsKKyAgICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgICAgb3V0IDw8CisgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICB9IiA8PCBlbmRsIDw8CisgICAgICAgICAgICBpbmRlbnQoKSA8PCAiICAvLyBzZXFpZCAhPSByc2VxaWQiIDw8IGVuZGwgPDwKKyAgICAgICAgICAgIGluZGVudCgpIDw8ICIgIHRoaXMtPnN5bmNfLnVwZGF0ZVBlbmRpbmcoZm5hbWUsIG10eXBlLCByc2VxaWQpOyIgPDwgZW5kbCA8PAorICAgICAgICAgICAgZW5kbCA8PAorICAgICAgICAgICAgaW5kZW50KCkgPDwgIiAgLy8gdGhpcyB3aWxsIHRlbXBvcmFyaWx5IHVubG9jayB0aGUgcmVhZE11dGV4LCBhbmQgbGV0IG90aGVyIGNsaWVudHMgZ2V0IHdvcmsgZG9uZSIgPDwgZW5kbCA8PAorICAgICAgICAgICAgaW5kZW50KC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lbmRsOworICAgIGlmIChnZW5lcmF0b3JfLT5nZW5fdGVtcGxhdGVzXykgeworICAgICAgaW5kZW50KGZfaGVhZGVyXykgPDwgInZvaWQgcHJvY2Vzc18iIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiKCIgPDwgZmluaXNoX2NvYl8KKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJpbnQzMl90IHNlcWlkLCBQcm90b2NvbF8qIGlwcm90LCBQcm90b2NvbF8qIG9wcm90IiA8PCBjYWxsX2NvbnRleHRfCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiKTsiIDw8IGVuZGw7CisgICAgfQorICAgIGlmIChzdHlsZV8gPT0gIkNvYiIpIHsKKyAgICAgIC8vIFhYWCBGYWN0b3IgdGhpcyBvdXQsIGV2ZW4gaWYgaXQgaXMgYSBwYWluLgorICAgICAgc3RyaW5nIHJldF9hcmcgPSAoKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA/ICIiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAiLCBjb25zdCAiICsgdHlwZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKSkgKyAiJiBfcmV0dXJuIik7CisgICAgICBmX2hlYWRlcl8gPDwgaW5kZW50KCkgPDwgInZvaWQgcmV0dXJuXyIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpCisgICAgICAgICAgICAgICAgPDwgIig6OnN0ZDo6ZnVuY3Rpb248dm9pZChib29sIG9rKT4gY29iLCBpbnQzMl90IHNlcWlkLCAiCisgICAgICAgICAgICAgICAgPDwgIjo6YXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUUHJvdG9jb2wqIG9wcm90LCAiCisgICAgICAgICAgICAgICAgPDwgInZvaWQqIGN0eCIgPDwgcmV0X2FyZyA8PCAiKTsiIDw8IGVuZGw7CisgICAgICBpZi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nQoKSA8PCAicmV0dXJuIDA7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworICBmX3NrZWxldG9uIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7CisKKyAgLy8gQ2xvc2UgdGhlIGZpbGVzCisgIGZfc2tlbGV0b24uY2xvc2UoKTsKK30KKworLyoqCisgKiBEZXNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4KKyAqLwordm9pZCB0X2NwcF9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgc3VmZml4KSB7CisgIHRfdHlwZSogdHlwZSA9IGdldF90cnVlX3R5cGUodGZpZWxkLT5nZXRfdHlwZSgpKTsKKworICBpZiAodHlwZS0+aXNfdm9pZCgpKSB7CisgICAgdGhyb3cgIkNBTk5PVCBHRU5FUkFURSBERVNFUklBTElaRSBDT0RFIEZPUiB2b2lkIFRZUEU6ICIgKyBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7CisgIH0KKworICBzdHJpbmcgbmFtZSA9IHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKSArIHN1ZmZpeDsKKworICBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvdXQsICh0X3N0cnVjdCopdHlwZSwgbmFtZSwgaXNfcmVmZXJlbmNlKHRmaWVsZCkpOworICB9IGVsc2UgaWYgKHR5cGUtPmlzX2Nvb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KS5jX3N0cigpKTsKKyAgfQorfQorCisvKioKKyAqIEdlbmVyYXRlcyBhbiB1bnNlcmlhbGl6ZXIgZm9yIGEgdmFyaWFibGUuIFRoaXMgbWFrZXMgdHdvIGtleSBhc3N1bXB0aW9ucywKKyAqIGZpcnN0IHRoYXQgdGhlcmUgaXMgYSBjb25zdCBjaGFyKiB2YXJpYWJsZSBuYW1lZCBkYXRhIHRoYXQgcG9pbnRzIHRvIHRoZQorICogYnVmZmVyIGZvciBkZXNlcmlhbGl6YXRpb24sIGFuZCB0aGF0IHRoZXJlIGlzIGEgdmFyaWFibGUgcHJvdG9jb2wgd2hpY2gKKyAqIGlzIGEgcmVmZXJlbmNlIHRvIGEgVFByb3RvY29sIHNlcmlhbGl6YXRpb24gb2JqZWN0LgorICovCit2b2lkIHRfY3BwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlcikgeworICBpZiAocG9pbnRlcikgeworICAgIGluZGVudChvdXQpIDw8ICJpZiAoISIgPDwgcHJlZml4IDw8ICIpIHsgIiA8PCBlbmRsOworICAgIGluZGVudChvdXQpIDw8ICIgICIgPDwgcHJlZml4IDw8ICIgPSA6OnN0ZDo6c2hhcmVkX3B0cjwiIDw8IHR5cGVfbmFtZSh0c3RydWN0KSA8PCAiPihuZXcgIgorICAgICAgICAgICAgICAgIDw8IHR5cGVfbmFtZSh0c3RydWN0KSA8PCAiKTsiIDw8IGVuZGw7CisgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7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ZmFsc2UsIGZhbHNlLCB0cnVlKSA8PCAiID0gIiA8PCBwcmVmaXggPDwgIlsiIDw8IGtleQorICAgICAgICAgICAgICA8PCAiXTsiIDw8IGVuZGw7CisKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZnZhbCk7Cit9CisKK3ZvaWQgdF9jcHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsIHRfc2V0KiB0c2V0LCBzdHJpbmcgcHJlZml4KSB7CisgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICB0X2ZpZWxkIGZlbGVtKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgZWxlbSk7CisKKyAgaW5kZW50KG91dCkgPDwgZGVjbGFyZV9maWVsZCgmZmVsZW0pIDw8IGVuZGw7CisKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0pOworCisgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiLmluc2VydCgiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOworfQorCit2b2lkIHRfY3BwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB1c2VfcHVzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGluZGV4KSB7CisgIGlmICh1c2VfcHVzaCkgeworICAgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICAgIHRfZmllbGQgZmVsZW0odGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgZWxlbSk7CisgICAgaW5kZW50KG91dCkgPDwgZGVjbGFyZV9maWVsZCgmZmVsZW0pIDw8IGVuZGw7CisgICAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0pOworICAgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiLnB1c2hfYmFjaygiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHRfZmllbGQgZmVsZW0odGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgcHJlZml4ICsgIlsiICsgaW5kZXggKyAiXSIpOworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZlbGVtKTsKKyAgfQorfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4KKyAqCisgKiBAcGFyYW0gdGZpZWxkIFRoZSBmaWVsZCB0byBzZXJpYWxpemUKKyAqIEBwYXJhbSBwcmVmaXggTmFtZSB0byBwcmVwZW5kIHRvIGZpZWxkIG5hbWUKKyAqLwordm9pZCB0X2NwcF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHN1ZmZpeCkgeworICB0X3R5cGUqIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHRmaWVsZC0+Z2V0X3R5cGUoKSk7CisKKyAgc3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AgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICBvdXQgPDwgIndyaXRlQmluYXJ5KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAid3JpdGVTdHJpbmcoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAid3JpdGVCb29sKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAid3JpdGVCeXRlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIndyaXRlSTMyKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIndyaXRlSTY0KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gQysrIHdyaXRlciBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpCisgICAgICAgICAgICArIG5hbWU7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAid3JpdGVJMzIoKGludDMyX3QpIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnJXMnIFRZUEUgJyVzJ1xuIiwKKyAgICAgICAgICAgbmFtZS5jX3N0cigpLAorICAgICAgICAgICB0eXBlX25hbWUodHlwZSkuY19zdHIoKSk7CisgIH0KK30KKworLyoqCisgKiBTZXJpYWxpemVzIGFsbCB0aGUgbWVtYmVycyBvZiBhIHN0cnVjdC4KKyAqCisgKiBAcGFyYW0gdHN0cnVjdCBUaGUgc3RydWN0IHRvIHNlcmlhbGl6ZQorICogQHBhcmFtIHByZWZpeCAgU3RyaW5nIHByZWZpeCB0byBhdHRhY2ggdG8gYWxsIGZpZWxkcworICovCit2b2lkIHRfY3BwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHBvaW50ZXIpIHsKKyAgaWYgKHBvaW50ZXIpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCIgPDwgcHJlZml4IDw8ICIpIHsiIDw8IGVuZGw7CisgICAgaW5kZW50KG91dCkgPDwgIiAgeGZlciArPSAiIDw8IHByZWZpeCA8PCAiLT53cml0ZShvcHJvdCk7ICIgPD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YXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgIHJldHVybiAic3RkOjpzdHJpbmciOworICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgcmV0dXJuICJib29sIjsKKyAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICByZXR1cm4gImludDhfdCI7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgIHJldHVybiAiaW50MTZfdCI7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgIHJldHVybiAiaW50MzJfdCI7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgIHJldHVybiAiaW50NjRfdCI7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgIHJldHVybiAiZG91YmxlIjsKKyAgZGVmYXVsdDoKKyAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IG5vIEMrKyBiYXNlIHR5cGUgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICB9Cit9CisKKy8qKgorICogRGVjbGFyZXMgYSBmaWVsZCwgd2hpY2ggbWF5IGluY2x1ZGUgaW5pdGlhbGl6YXRpb24gYXMgbmVjZXNzYXJ5LgorICoKKyAqIEBwYXJhbSB0dHlwZSBUaGUgdHlwZQorICogQHJldHVybiBGaWVsZCBkZWNsYXJhdGlvbiwgaS5lLiBpbnQgeCA9IDA7CisgKi8KK3N0cmluZyB0X2NwcF9nZW5lcmF0b3I6OmRlY2xhcmVfZmllbGQodF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluaXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9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DbCIpIHsKKyAgICAgIGNvYl90eXBlID0gIigiICsgc2VydmljZV9uYW1lXyArICJDb2JDbGllbnQiOworICAgICAgaWYgKGdlbl90ZW1wbGF0ZXNfKSB7CisgICAgICAgIGNvYl90eXBlICs9ICJUPFByb3RvY29sXz4iOworICAgICAgfQorICAgICAgY29iX3R5cGUgKz0gIiogY2xpZW50KSI7CisgICAgfSBlbHNlIGlmIChzdHlsZSA9PSAiQ29iU3YiKSB7CisgICAgICBjb2JfdHlwZSA9ICh0dHlwZS0+aXNfdm9pZCgpID8gIigpIiA6ICgiKCIgKyB0eXBlX25hbWUodHR5cGUpICsgIiBjb25zdCYgX3JldHVybikiKSk7CisgICAgICBpZiAoaGFzX3hjZXB0aW9ucykgeworICAgICAgICBleG5fY29iCisgICAgICAgICAgICA9ICIsIDo6c3RkOjpmdW5jdGlvbjx2b2lkKDo6YXBhY2hlOjp0aHJpZnQ6OlREZWxheWVkRXhjZXB0aW9uKiBfdGhyb3cpPiAvKiBleG5fY29iICovIjsKKyAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgdGhyb3cgIlVOS05PV04gU1RZTEUiOworICAgIH0KKworICAgIHJldHVybiAidm9pZCAiICsgcHJlZml4ICsgdGZ1bmN0aW9uLT5nZXRfbmFtZSgpICsgIig6OnN0ZDo6ZnVuY3Rpb248dm9pZCIgKyBjb2JfdHlwZSArICI+IGNvYiIKKyAgICAgICAgICAgKyBleG5fY29iICsgYXJndW1lbnRfbGlzdChhcmdsaXN0LCBuYW1lX3BhcmFtcywgdHJ1ZSkgKyAiKSI7CisgIH0gZWxzZSB7CisgICAgdGhyb3cgIlVOS05PV04gU1RZTEUiOworICB9Cit9CisKKy8qKgorICogUmVuZGVycyBhIGZpZWxkIGxpc3QKKyAqCisgKiBAcGFyYW0gdHN0cnVjdCBUaGUgc3RydWN0IGRlZmluaXRpb24KKyAqIEByZXR1cm4gQ29tbWEgc2VwZWFyYXRlZCBsaXN0IG9mIGFsbCBmaWVsZCBuYW1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LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNQdWJsaWMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbHVkZUlzc2V0ID0gdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXggPSAiIik7CisgIGJvb2wgcHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9zdGF0aWMsCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWZ2YWwgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG5lZWR0eXBlID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyByZW5kZXJfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpOworICB2b2lkIHByaW50X2NvbnN0X2NvbnN0cnVjdG9yKHN0ZDo6b3N0cmVhbSYgb3V0LCBzdGQ6OnZlY3Rvcjx0X2NvbnN0Kj4gY29uc3RzKTsKKyAgdm9pZCBwcmludF9jb25zdF9kZWZfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpOworCisgIHZvaWQgZ2VuZXJhdGVfY3NoYXJwX3N0cnVjdCh0X3N0cnVjdCogdHN0cnVjdCwgYm9vbCBpc19leGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2NzaGFycF91bmlvbih0X3N0cnVjdCogdHVuaW9uKTsKKyAgdm9pZCBnZW5lcmF0ZV9jc2hhcnBfc3RydWN0X2RlZmluaXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQgPSBmYWxzZSk7CisgIHZvaWQgZ2VuZXJhdGVfY3NoYXJwX3VuaW9uX2RlZmluaXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0dW5pb24pOworICB2b2lkIGdlbmVyYXRlX2NzaGFycF91bmlvbl9jbGFzcyhzdGQ6Om9zdHJlYW0mIG91dCwgdF9zdHJ1Y3QqIHR1bmlvbiwgdF9maWVsZCogdGZpZWxkKTsKKyAgdm9pZCBnZW5lcmF0ZV9jc2hhcnBfd2NmZmF1bHQoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KTsKKyAgdm9pZCBnZW5lcmF0ZV9jc2hhcnBfc3Ryd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b25kaXRpb25hbF91cGRhdGUgZl9jb25zdHM7CisgIGZfY29uc3RzLm9wZW4oZl9jb25zdHNfbmFtZS5jX3N0cigpKTsKKworICBmX2NvbnN0cyA8PCBhdXRvZ2VuX2NvbW1lbnQoKSA8PCBjc2hhcnBfdHlwZV91c2luZ3MoKSA8PCBlbmRsOworCisgIHN0YXJ0X2NzaGFycF9uYW1lc3BhY2UoZl9jb25zdHMpOworCisgIGluZGVudChmX2NvbnN0cykgPDwgInB1YmxpYyBzdGF0aWMgY2xhc3MgIiA8PCBtYWtlX3ZhbGlkX2NzaGFycF9pZGVudGlmaWVyKHByb2dyYW1fbmFtZV8pCisgICAgICAgICAgICAgICAgICAgPDwgIkNvbnN0YW50cyIgPDwgZW5kbDsKKyAgc2NvcGVfdXAoZl9jb25zdHMpOworCisgIHZlY3Rvcjx0X2NvbnN0Kj46Oml0ZXJhdG9yIGNfaXRlcjsKKyAgYm9vbCBuZWVkX3N0YXRpY19jb25zdHJ1Y3RvciA9IGZhbHNlOworICBmb3IgKGNfaXRlciA9IGNvbnN0cy5iZWdpbigpOyBjX2l0ZXIgIT0gY29uc3RzLmVuZCgpOyArK2NfaXRlcikgeworICAgIGdlbmVyYXRlX2NzaGFycF9kb2MoZl9jb25zdHMsICgqY19pdGVyKSk7CisgICAgaWYgKHByaW50X2NvbnN0X3ZhbHVlKGZfY29uc3RzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAoKmNfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3R5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKCpjX2l0ZXIpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpKSB7CisgICAgICBuZWVkX3N0YXRpY19jb25zdHJ1Y3RvciA9IHRydWU7CisgICAgfQorICB9CisKKyAgaWYgKG5lZWRfc3RhdGljX2NvbnN0cnVjdG9yKSB7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BjYWxsIHRoaXMgYXJlIHVzaW5nIGluX3N0YXRpYyB0byBiZSB0aGUgb3Bwb3NpdGUgb2Ygd2hhdCBpdAorLy8gd291bGQgaW1wbHkKK2Jvb2wgdF9jc2hhcnBfZ2VuZXJhdG9yOjpwcmludF9jb25zdF92YWx1ZShzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9zdGF0aWMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWZ2YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBuZWVkdHlwZSkgeworICBpbmRlbnQob3V0KTsKKyAgYm9vbCBuZWVkX3N0YXRpY19jb25zdHJ1Y3Rpb24gPSAhaW5fc3RhdGljOworICB3aGlsZSAodHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHlwZSA9ICgodF90eXBlZGVmKil0eXBlKS0+Z2V0X3R5cGUoKTsKKyAgfQorCisgIGlmICghZGVmdmFsIHx8IG5lZWR0eXBlKSB7CisgICAgb3V0IDw8IChpbl9zdGF0aWMgPyAiIiA6IHR5cGUtPmlzX2Jhc2VfdHlwZSgpID8gInB1YmxpYyBjb25zdCAiIDogInB1YmxpYyBzdGF0aWMgIikKKyAgICAgICAgPDwgdHlwZV9uYW1lKHR5cGUpIDw8ICIgIjsKKyAgfQorICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICBzdHJpbmcgdjIgPSByZW5kZXJfY29uc3R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F9zdGF0aWNfY29uc3RydWN0aW9uOworfQorCitzdGQ6OnN0cmluZyB0X2NzaGFycF9nZW5lcmF0b3I6OnJlbmRlcl9jb25zdF92YWx1ZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKSB7CisgICh2b2lkKW5hbWU7CisgIHN0ZDo6b3N0cmluZ3N0cmVhbSByZW5kZXI7CisKKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOworICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgIHJlbmRlciA8PCAnIicgPDwgZ2V0X2VzY2FwZWRfc3RyaW5nKHZhbHVlKSA8PCAnIic7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICByZW5kZXIgPDwgKCh2YWx1ZS0+Z2V0X2ludGVnZXIoKSA+IDApID8gInRydWUiIDogImZhbHNlIik7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgcmVuZGVyIDw8IHZhbHVlLT5nZXRfaW50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QgPSAoKHRfdHlwZWRlZiopdCktPmdldF90eXBlKCk7CisgICAgfQorICAgIGlmICgoKm1faXRlciktPmdldF92YWx1ZSgpICE9IE5VTEwpIHsKKyAgICAgIGlmIChmaWVsZF9pc19yZXF1aXJlZCgoKm1faXRlcikpKSB7CisgICAgICAgIHByaW50X2NvbnN0X3ZhbHVlKG91dCwgInRoaXMuIiArIHByb3BfbmFtZSgqbV9pdGVyKSwgdCwgKCptX2l0ZXIpLT5nZXRfdmFsdWUoKSwgdHJ1ZSwgdHJ1ZSk7CisgICAgICB9IGVsc2UgeworICAgICAgICBwcmludF9jb25zdF92YWx1ZShvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzLl8iICsgKCptX2l0ZXIpLT5nZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICB0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAoKm1faXRlciktPmdldF92YWx1ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlKTsKKyAgICAgICAgLy8gT3B0aW9uYWxzIHdpdGggZGVmYXVsdHMgYXJlIG1hcmtlZCBzZXQKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInRoaXMuX19pc3NldC4iIDw8IG5vcm1hbGl6ZV9uYW1lKCgqbV9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIiA9IHRydWU7IgorICAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgfQorICAgIH0KKyAgfQorICBpbmRlbnRfZG93bigpOworICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworCisgIGlmIChoYXNfcmVxdWlyZWRfZmllbGRzKSB7CisgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyAiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgIigiOworICAgIGJvb2wgZmlyc3QgPSB0cnVlOworICAgIGZvciAobV9pdGVyID0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i5JTlZBTElEX0RBVEEsICIKKyAgICAgICAgICAgICAgPDwgIlwicmVxdWlyZWQgZmllbGQgIiA8PCBwcm9wX25hbWUoKCpmX2l0ZXIpKSA8PCAiIG5vdCBzZXRcIik7IgorICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgIHsKKyAgICAgICAgaWYgKG51bGxhYmxlXyAmJiAhaGFzX2RlZmF1bHQpIHsKKyAgICAgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAoIiA8PCBwcm9wX25hbWUoKCpmX2l0ZXIpKSA8PCAiICE9IG51bGwpIHsiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAobnVsbF9hbGxvd2VkKSB7CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpCisgICAgICAgICAgICAgIDw8ICJpZiAoIiA8PCBwcm9wX25hbWUoKCpmX2l0ZXIpKSA8PCAiICE9IG51bGwgJiYgX19pc3NldC4iCisgICAgICAgICAgICAgIDw8IG5vcm1hbGl6ZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIikgeyIKKyAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgaW5kZW50KG91dCkgPDwgImlmIChfX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiKSB7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgfQorICAgICAgaW5kZW50KG91dCkgPDwgImZpZWxkLk5hbWUgPSBcIiIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICJcIjsiIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAiZmllbGQuVHlwZSA9ICIgPDwgdHlwZV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gICAgaWYgKCEoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgeworICAgICAgICAgIGZfc2VydmljZV8gPDwgInJldHVybiAiOworICAgICAgICB9CisgICAgICAgIGZfc2VydmljZV8gPDwgIkVuZF8iIDw8IGZ1bm5hbWUgPDwgIihhc3luY1Jlc3VsdCk7IiA8PCBlbmRsOworICAgICAgfQorICAgICAgZl9zZXJ2aWNlXyA8PCBlbmRsOworCisgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIiNlbHNlIiA8PCBlbmRsOworICAgIH0KKworICAgIC8vIHN5bmNocm9ub3VzIGludm9rZQorICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAic2VuZF8iIDw8IGZ1bm5hbWUgPDwgIigiOworICAKKyAgICBmaXJzdCA9IHRydWU7CisgICAgZm9yIChmbGRfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmbGRfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZmxkX2l0ZXIpIHsKKyAgICAgIGlmIChmaXJzdCkgeworICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCAiLCAiOworICAgICAgfQorICAgICAgZl9zZXJ2aWNlXyA8PCBub3JtYWxpemVfbmFtZSgoKmZsZF9pdGVyKS0+Z2V0X25hbWUoKSk7CisgICAgfQorICAgIGZfc2VydmljZV8gPDwgIik7IiA8PCBlbmRsOworICAKKyAgICBpZiAoISgqZl9pdGVyKS0+aXNfb25ld2F5KCkpIHsKKyAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCk7CisgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgIGZfc2VydmljZV8gPDwgInJldHVybiAiOworICAgICAgfQorICAgICAgZl9zZXJ2aWNlXyA8PCAicmVjdl8iIDw8IGZ1bm5hbWUgPDwgIigpO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HJvdC5SZWFkU3RydWN0RW5kKCk7IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIHJldHZhbDsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisKKyAgc2NvcGVfZG93bihvdXQpOworICBvdXQgPDwgaW5kZW50KCkgPDwgImZpbmFsbHkiIDw8IGVuZGw7CisgIHNjb3BlX3VwKG91dCk7CisgIG91dCA8PCBpbmRlbnQoKSA8PCAiaXByb3QuRGVjcmVtZW50UmVjdXJzaW9uRGVwdGgoKTsiIDw8IGVuZGw7CisgIHNjb3BlX2Rvd24ob3V0KTsKKworICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworfQorCit2b2lkIHRfY3NoYXJwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJvcGVydHlsZXNzKSB7CisgIHRfdHlwZSogdHlwZSA9IHRmaWVsZC0+Z2V0X3R5cGUoKTsKKyAgd2hpbGUgKHR5cGUtPmlzX3R5cGVkZWYoKSkgeworICAgIHR5cGUgPSAoKHRfdHlwZWRlZiopdHlwZSktPmdldF90eXBlKCk7CisgIH0KKworICBpZiAodHlwZS0+aXNfdm9pZCgpKSB7CisgICAgdGhyb3cgIkNBTk5PVCBHRU5FUkFURSBERVNFUklBTElaRSBDT0RFIEZPUiB2b2lkIFRZUEU6ICIgKyBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7CisgIH0KKworICBzdHJpbmcgbmFtZSA9IHByZWZp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JlYWRCaW5hcnkoKTsiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAiUmVhZFN0cmluZygpOyI7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAiUmVhZEJvb2woKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAiUmVhZEJ5dGUoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIlJlYWRJMTYoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIlJlYWRJMzIoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIlJlYWRJNjQoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIlJlYWREb3VibGUoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gQyMgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgIlJlYWRJMzIoKTsiOworICAgIH0KKyAgICBvdXQgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICBwcmludGYoIkRPIE5PVCBLTk9XIEhPVyBUTyBERVNFUklBTElaRSBGSUVMRCAnJXMnIFRZUEUgJyVzJ1xuIiwKKyAgICAgICAgICAgdGZpZWxkLT5nZXRfbmFtZSgpLmNfc3RyKCksCisgICAgICAgICAgIHR5cGVfbmFtZSh0eXBlKS5jX3N0cigpKTsKKyAgfQorfQorCit2b2lkIHRfY3NoYXJwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKKyAgaWYgKHVuaW9uXyAmJiB0c3RydWN0LT5pc191bmlvbigpKSB7CisgICAgb3V0IDw8IGluZGVudCgpIDw8IHByZWZpeCA8PCAiID0gIiA8PCB0eXBlX25hbWUodHN0cnVjdCkgPDwgIi5SZWFkKGlwcm90KTsiIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgb3V0IDw8IGluZGVudCgpIDw8IHByZWZpeCA8PCAiID0gbmV3ICIgPDwgdHlwZV9uYW1lKHRzdHJ1Y3QpIDw8ICIoKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgPDwgcHJlZml4IDw8ICIuUmVhZChpcHJvdCk7IiA8PCBlbmRsOworICB9Cit9CisKK3ZvaWQgdF9jc2hhcnBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4KSB7CisgIHNjb3BlX3VwKG91dCk7CisKKyAgc3RyaW5nI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YXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKKyAgdF9maWVsZCBmZWxlbSh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKKworICBpbmRlbnQob3V0KSA8PCBkZWNsYXJlX2ZpZWxkKCZmZWxlbSkgPDwgZW5kbDsKKworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICZmZWxlbSk7CisKKyAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICIuQWRkKCIgPDwgZWxlbSA8PCAiKTsiIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9jc2hhcnBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZWxlbWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19wcm9wZXJ0eWxlc3MpIHsKKyAgdF90eXBlKiB0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICB3aGlsZSAodHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHl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ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIG91dCA8PCAiV3JpdGVEb3VibGUoIiA8PCBudWxsYWJsZV9uYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBDIyBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAiV3JpdGVJMzIoKGludCkiIDw8IG51bGxhYmxlX25hbWUgPDwgIik7IjsKKyAgICB9CisgICAgb3V0IDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgcHJpbnRmKCJETyBOT1QgS05PVyBIT1cgVE8gU0VSSUFMSVpFICclcyVzJyBUWVBFICclcydcbiIsCisgICAgICAgICAgIHByZWZpeC5jX3N0cigpLAorICAgICAgICAgICB0ZmllbGQtPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgdHlwZV9uYW1lKHR5cGUpLmNfc3RyKCkpOworICB9Cit9CisKK3ZvaWQgdF9jc2hhcnBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICAodm9pZCl0c3RydWN0OworICBvdXQgPDwgaW5kZW50KCkgPDwgcHJlZml4IDw8ICIuV3JpdGUob3Byb3QpOyIgPDwgZW5kbDsKK30KKwordm9pZCB0X2NzaGFyc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yKTsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKKworICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LldyaXRlTWFwRW5kKCk7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC5Xcml0ZVNldEVuZCgpOyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LldyaXRlTGlzdEVuZCgpOyIgPDwgZW5kbDsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKK30KKwordm9pZCB0X2NzaGFycF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcCkgeworICB0X2ZpZWxkIGtmaWVsZCh0bWFwLT5nZXRfa2V5X3R5cGUoKSwgaXRlcik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsICIiLCB0cnVlKTsKKyAgdF9maWVsZCB2ZmllbGQodG1hcC0+Z2V0X3ZhbF90eXBlKCksIG1hcCArICJbIiArIGl0ZXIgKyAiXSIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkLCAiIiwgdHJ1ZSk7Cit9CisKK3ZvaWQgdF9jc2hhcnBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQob3N0cmVhbSYgb3V0LCB0X3NldCogdHNldCwgc3RyaW5nIGl0ZXIpIHsKKyAgdF9maWVsZCBlZmllbGQodHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIsIHRydWUpOworfQorCit2b2lkIHRfY3NoYXJwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGl0ZXIpIHsKKyAgdF9maWVsZCBlZmllbGQodGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZlZmllbGQsICIiLCB0cnVlKTsKK30KKwordm9pZCB0X2NzaGFycF9nZW5lcmF0b3I6OmdlbmVyYXRlX3Byb3BlcnR5KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc1B1YmxpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGdlbmVyYXRlSXNzZXQpIHsKKyAgZ2VuZXJhdGVfY3NoYXJwX3Byb3BlcnR5KG91dCwgdGZpZWxkLCBpc1B1YmxpYywgZ2VuZXJhdGVJc3NldCwgIl8iKTsKK30KK3ZvaWQgdF9jc2hhcnBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9jc2hhcnBfcHJvcGVydHkob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNQdWJsaWMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZ2VuZXJhdGVJc3NldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgpIHsKKyAgaWYgKChzZXJpYWxpemVfIHx8IHdjZl8pICYmIGlzUHVibGljKSB7CisgICAgaW5kZW50KG91dCkgPDwgIltEYXRhTWVtYmVyKE9yZGVyID0gMCldIiA8PCBlbmRsOworICB9CisgIGJvb2wgaGFzX2RlZmF1bHQgPSBmaWVsZF9oYXNfZGVmYXVsdCh0ZmllbGQpOworICBib29sIGlzX3JlcXVpcmVkID0gZmllbGRfaXNfcmVxdWlyZWQodGZpZWxkKTsKKyAgaWYgKChudWxsYWJsZV8gJiYgIWhhc19kZWZhdWx0KSB8fCAoaXNfcmVxdWlyZWQpKSB7CisgICAgaW5kZW50KG91dCkgPDwgKGlzUHVibGljID8gInB1YmxpYyAiIDogInByaXZhdGUgIikKKyAgICAgICAgICAgICAgICA8PCB0eXBlX25hbWUodGZpZWxkLT5nZXRfdHlwZSgpLCBmYWxzZSwgZmFsc2UsIHRydWUsIGlzX3JlcXVpcmVkKSA8PCAiICIKKyAgICAgICAgICAgICAgICA8PCBwcm9wX25hbWUodGZpZWxkKSA8PCAiIHsgZ2V0OyBzZXQ7IH0iIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgaW5kZW50KG91dCkgPDwgKGlzUHVibGljID8gInB1YmxpYyAiIDogInByaXZhdGUgIikKKyAgICAgICAgICAgICAgICA8PCB0eXBlX25hbWUodGZpZWxkLT5nZXRfdHlwZSgpLCBmYWxzZSwgZmFsc2UsIHRydWUpIDw8ICIgIiA8PCBwcm9wX25hbWUodGZpZWxkKQorICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgc2NvcGVfdXAob3V0KTsKKyAgICBpbmRlbnQob3V0KSA8PCAiZ2V0IiA8PCBlbmRsOworICAgIHNjb3BlX3VwKG91dCk7CisgICAgYm9vbCB1c2VfbnVsbGFibGUgPSBmYWxzZTsKKyAgICBpZiAobnVsbGFibGVfKSB7CisgICAgICB0X3R5cGUqIHR0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICAgICAgd2hpbGUgKHR0eXBlLT5pc190eXBlZGVmKCkpIHsKKyAgICAgICAgdHR5cGUgPSAoKHRfdHlwZWRlZiopdHR5cGUpLT5nZXRfdHlwZSgpOworICAgICAgfQorICAgICAgaWYgKHR0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgICAgICB1c2VfbnVsbGFibGUgPSAoKHRfYmFzZV90eXBlKil0dHlwZSktPmdldF9iYXNlKCkgIT0gdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOworICAgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfZW51bSgpKSB7CisgICAgICAgIHVzZV9udWxsYWJsZSA9IHRydWU7CisgICAgICB9CisgICAgfQorICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gIiA8PCBmaWVsZFByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKSA8PCAiOyIgPDwgZW5kbDsKKyAgICBzY29wZV9kb3duKG91dCk7CisgICAgaW5kZW50KG91dCkgPDwgInNldCIgPDwgZW5kbDsKKyAgICBzY29wZV91cChvdXQpOworICAgIGlmICh1c2VfbnVsbGFibGUpIHsKKyAgICAgIGlmIChnZW5lcmF0ZUlzc2V0KSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJfX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUodGZpZWxk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worc3RyaW5nIHRfY3NoYXJwX2dlbmVyYXRvcjo6Z2V0X21hcHBlZF9tZW1iZXJfbmFtZShzdHJpbmcgbmFtZSkgeworICBpZiggISBtZW1iZXJfbWFwcGluZ19zY29wZXMuZW1wdHkoKSkgeworICAgIG1lbWJlcl9tYXBwaW5nX3Njb3BlJiBhY3RpdmUgPSBtZW1iZXJfbWFwcGluZ19zY29wZXMuYmFjaygpOworICAgIG1hcDxzdHJpbmcsIHN0cmluZz46Oml0ZXJhdG9yIGl0ZXIgPSBhY3RpdmUubWFwcGluZ190YWJsZS5maW5kKG5hbWUpOworICAgIGlmIChhY3RpdmUubWFwcGluZ190YWJsZS5lbmQoKSAhPSBpdGVyKSB7CisgICAgICByZXR1cm4gaXRlci0+c2Vjb25kOworICAgIH0KKyAgfQorCisgIHB2ZXJib3NlKCJubyBtYXBwaW5nIGZvciBtZW1iZXIgJXNcbiIsIG5hbWUuY19zdHIoKSk7CisgIHJldHVybiBuYW1lOworfQorCit2b2lkIHRfY3NoYXJwX2dlbmVyYXRvcjo6cHJlcGFyZV9tZW1iZXJfbmFtZV9tYXBwaW5nKHRfc3RydWN0KiB0c3RydWN0KSB7CisgIHByZXBhcmVfbWVtYmVyX25hbWVfbWFwcGluZyh0c3RydWN0LCB0c3RydWN0LT5nZXRfbWVtYmVycygpLCB0c3RydWN0LT5nZXRfbmFtZSgpKTsKK30KKwordm9pZCB0X2NzaGFycF9nZW5lcmF0b3I6OnByZXBhcmVfbWVtYmVyX25hbWVfbWFwcGluZyh2b2lkKiBzY29wZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgbWVtYmVycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiBzdHJ1Y3RuYW1lKSB7CisgIC8vIGJlZ2luIG5ldyBzY29wZQorICBtZW1iZX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NfbWFwcGluZykgeworICBzdHJpbmcgbmFtZSh0ZmllbGQtPmdldF9uYW1lKCkpOworICBpZiAoc3VwcHJlc3NfbWFwcGluZykgeworICAgIG5hbWVbMF0gPSB0b3VwcGVyKG5hbWVbMF0pOworICB9IGVsc2UgeworICAgIG5hbWUgPSBnZXRfbWFwcGVkX21lbWJlcl9uYW1lKG5hbWUpOworICB9CisgIHJldHVybiBuYW1lOworfQorCitzdHJpbmcgdF9jc2hhcnBfZ2VuZXJhdG9yOjp0eXBlX25hbWUodF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2NvbnRhaW5lciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2luaXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9wYXJhbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3JlcXVpcmVkKSB7CisgICh2b2lkKWluX2luaXQ7CisgIHdoaWxlICh0dHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHR5cGUgPSAoKHRfdHlwZWRlZiopdHR5cGUpLT5nZXRfdHlwZSgpOworICB9CisKKyAgaWYgKHR0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIHJldHVybiBiYXNlX3R5cGVfbmFtZSgodF9iYXNlX3R5cGUqKXR0eXBlLCBpbl9jb250YWluZXIsIGluX3BhcmFtLCBpc19yZXF1aXJlZCk7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgdF9tYXAqIHRtYXAgPSAodF9tYXAqKXR0eXBlOworICAgIHJldHVybiAiRGljdGlvbmFyeTwiICsgdHlwZV9uYW1lKHRtYXAtPmdldF9rZXlfdHlwZSgpLCB0cnVlKSArICIsICIKKyAgICAgICAgICAgKyB0eXBlX25hbWUodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHRydW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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fcGFyYW0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3JlcXVpcmVkKSB7CisgICh2b2lkKWluX2NvbnRhaW5lcjsKKyAgc3RyaW5nIHBvc3RmaXggPSAoIWlzX3JlcXVpcmVkICYmIG51bGxhYmxlXyAmJiBpbl9wYXJhbSkgPyAiPyIgOiAiIjsKKyAgc3dpdGNoICh0YmFzZS0+Z2V0X2Jhc2UoKSkgeworICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1ZPSUQ6CisgICAgcmV0dXJuICJ2b2lkIjsKKyAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgaWYgKHRiYXNlLT5pc19iaW5hcnkoKSkgeworICAgICAgcmV0dXJuICJieXRlW10iOworICAgIH0gZWxzZSB7CisgICAgICByZXR1cm4gInN0cmluZyI7CisgICAgfQorICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgcmV0dXJuICJib29sIiArIHBvc3RmaXg7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgcmV0dXJuICJzYnl0ZSIgKyBwb3N0Zml4OworICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICByZXR1cm4gInNob3J0IiArIHBvc3RmaXg7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgIHJldHVybiAiaW50IiArIHBvc3RmaXg7CisgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgIHJldHVybiAibG9uZyIgKyBwb3N0Zml4OworICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICByZXR1cm4gImRvdWJsZSIgKyBwb3N0Zml4OworICBkZWZhdWx0OgorICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gQyMgbmFtZSB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mIChwLT5oYXNfZG9jKCkpIHsKKyAgICAgICAgc3RkOjpzdHJpbmcgc3RyID0gcC0+Z2V0X2RvYygpOworICAgICAgICBzdHIuZXJhc2Uoc3RkOjpyZW1vdmUoc3RyLmJlZ2luKCksIHN0ci5lbmQoKSwgJ1xuJyksCisgICAgICAgICAgICAgICAgICBzdHIuZW5kKCkpOyAvLyByZW1vdmUgdGhlIG5ld2xpbmVzIHRoYXQgYXBwZWFyIGZyb20gdGhlIHBhcnNlcgorICAgICAgICBwcyA8PCBzdHI7CisgICAgICB9CisgICAgICBwcyA8PCAiPC9wYXJhbT4iOworICAgIH0KKyAgICBnZW5lcmF0ZV9kb2NzdHJpbmdfY29tbWVudChvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIi8vLyAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI8c3VtbWFyeT5cbiIgKyB0ZnVuY3Rpb24tPmdldF9kb2MoKSArICI8L3N1bW1hcnk+IiArIHBzLnN0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiKTsKKyAgfQorfQorCitzdGQ6OnN0cmluZyB0X2NzaGFycF9nZW5lcmF0b3I6OmdldF9lbnVtX2NsYXNzX25hbWUodF90eXBlKiB0eXBlKSB7CisgIHN0cmluZyBwYWNrYWdlID0gIiI7CisgIHRfcHJvZ3JhbSogcHJvZ3JhbSA9IHR5cGUtPmdldF9wcm9ncmFtKCk7CisgIGlmIChwcm9ncmFtICE9IE5VTEwgJiYgcHJvZ3JhbSAhPSBwcm9ncmFtXykgeworICAgIHBhY2thZ2UgPSBwcm9ncmFtLT5nZXRfbmFtZXNwYWNlKCJjc2hhcnAiKSArICIuIjsKKyAgfQorICByZXR1cm4gcGFja2FnZSArIHR5cGUtPmdldF9uYW1lKCk7Cit9CisKKworVEhSSUZUX1JFR0lTVEVSX0dFTkVSQVRPUigKKyAgICBjc2hhcnAsCis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gIiA8PCAoKnBfaXRlciktPmdldF9uYW1lKCkgPDwgImAsICIgPDwgKCpwX2l0ZXIpLT5nZXRfa2V5KCk7CisKKyAgICAgICAgdF9jb25zdF92YWx1ZSogY3YgPSAoKnBfaXRlciktPmdldF92YWx1ZSgpOworICAgICAgICBpZiAoY3YgIT0gTlVMTCkgeworICAgICAgICAgIG1ldGEgPDwgIiwgcXsiIDw8IHJlbmRlcl9jb25zdF92YWx1ZSgoKnBfaXRlciktPmdldF90eXBlKCksIGN2KSA8PCAifSI7CisgICAgICAgIH0KKyAgICAgICAgbWV0YSA8PCAiKSI7CisgICAgICB9CisKKyAgICAgIG1ldGEgPDwgIl0iOworCisgICAgICBpZiAoISgqZm5faXRlciktPmdldF94Y2VwdGlvbnMoKS0+Z2V0X21lbWJlcnMoKS5lbXB0eSgpIHx8ICgqZm5faXRlciktPmlzX29uZXdheSgpKSB7CisgICAgICAgIG1ldGEgPDwgIiwiIDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgIlsiOworCisgICAgICAgIGJvb2wgZmlyc3QgPSB0cnVlOworICAgICAgICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBleGNlcHRpb25zID0gKCpmbl9pdGVyKS0+Z2V0X3hjZXB0aW9ucygpLT5nZXRfbWVtYmVycygpOworICAgICAgICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBleF9pdGVyOworICAgICAgICBmb3IgKGV4X2l0ZXIgPSBleGNlcHRpb25zLmJlZ2luKCk7IGV4X2l0ZXIgIT0gZXhjZXB0aW9ucy5lbmQoKTsgKytleF9pdGVyKSB7CisgICAgICAgICAgaWYgKGZpcnN0KSB7CisgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtZXRhIDw8ICIsICI7CisgICAgICAgICAgfQorCisgICAgICAgICAgbWV0YSA8PCAiVEV4Y2VwdGlvbk1ldGEoYCIgPDwgKCpleF9pdGVy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VyOworICAgICAgICBmb3IgKHZfaXRlciA9IHZhbC5iZWdpbigpOyB2X2l0ZXIgIT0gdmFsLmVuZCgpOyArK3ZfaXRlcikgeworICAgICAgICAgIHN0cmluZyB2YWwgPSByZW5kZXJfY29uc3RfdmFsdWUoZXR5cGUsICp2X2l0ZXIpOworICAgICAgICAgIGluZGVudChvdXQpIDw8ICJ2IH49ICIgPDwgdmFsIDw8ICI7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX3NldCgpKSB7CisgICAgICAgIHRfdHlwZSogZXR5cGUgPSAoKHRfc2V0Kil0eXBlKS0+Z2V0X2VsZW1fdHlwZSgpOworICAgICAgICBjb25zdCB2ZWN0b3I8dF9jb25zdF92YWx1ZSo+JiB2YWwgPSB2YWx1ZS0+Z2V0X2xpc3QoKTsKKyAgICAgICAgdmVjdG9yPHRfY29uc3RfdmFsdWUqPjo6Y29uc3RfaXRlcmF0b3Igdl9pdGVyOworICAgICAgICBmb3IgKHZfaXRlciA9IHZhbC5iZWdpbigpOyB2X2l0ZXIgIT0gdmFsLmVuZCgpOyArK3ZfaXRlcikgeworICAgICAgICAgIHN0cmluZyB2YWwgPSByZW5kZXJfY29uc3RfdmFsdWUoZXR5cGUsICp2X2l0ZXIpOworICAgICAgICAgIGluZGVudChvdXQpIDw8ICJ2IH49ICIgPDwgdmFsIDw8ICI7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICB0aHJvdyAiQ29tcGlsZXIgZXJyb3I6IEludmFsaWQgdHlwZSBpbiByZW5kZXJfY29uc3RfdmFsdWU6ICIgKyB0eXBlLT5nZXRfbmFtZSgpOworICAgICAgfQorICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiB2OyIgPDwgZW5kbDsKKworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9KCkiOworICAgIH0KKworICAgIHJldHVybiBvdXQuc3Ry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dF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgcmV0dXJuICJib29sIjsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIHJldHVybiAiYnl0ZSI7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgcmV0dXJuICJzaG9ydCI7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgcmV0dXJuICJpbnQiOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIHJldHVybiAibG9uZyI7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgcmV0dXJuICJkb3VibGUiOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgIkNvbXBpbGVyIGVycm9yOiBObyBEIHR5cGUgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0KKworICAgIGlmICh0dHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICAgIHRfY29udGFpbmVyKiB0Y29udGFpbmVyID0gKHRfY29udGFpbmVyKil0dHlwZTsKKyAgICAgIGlmICh0Y29udGFpbmVyLT5oYXNfY3BwX25hbWUoKSkgeworICAgICAgICByZXR1cm4gdGNvbnRhaW5lci0+Z2V0X2NwcF9uYW1lKCk7CisgICAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgICAgICB0X21hcCogdG1hcCA9ICh0X21hcCopdHR5cGU7CisgICAgICAgIHRfdHlwZSoga3R5cGUgPSB0bWFwLT5nZXRfa2V5X3R5cGUoKTsKKworICAgICAgICBzdHJpbmcgbmFtZSA9IHJlbmRlcl90eXBlX25hbWUodG1hcC0+Z2V0X3ZhbF90eXBlKCkpICsgIlsiOworICAgICAgICBpZiAoIWlzX2ltbXV0YWJsZV90eXBlKGt0eXBlKSkgeworICAgICAgICAgIG5hbWUgKz0gImltbXV0YWJsZSgiOworICAgICAgICB9CisgICAgICAgIG5hbWUgKz0gcmVuZGVyX3R5cGVfbmFtZShrdHlwZSk7CisgICAgICAgIGlmICghaXNfaW1tdXRhYmxlX3R5cGUoa3R5cGUpKSB7CisgICAgICAgICAgbmFtZSArPSAiKSI7CisgICAgICAgIH0KKyAgICAgICAgbmFtZSArPSAiXSI7CisgICAgICAgIHJldHVybiBuYW1lOworICAgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICAgICAgdF9zZXQqIHRzZXQgPSAodF9zZXQqKXR0eXBlOworICAgICAgICByZXR1cm4gIkhhc2hTZXQhKCIgKyByZW5kZXJfdHlwZV9uYW1lKHRzZXQtPmdldF9lbGVtX3R5cGUoKSkgKyAiKSI7CisgICAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICAgICAgdF9saXN0KiB0bGlzdCA9ICh0X2xpc3QqKXR0eXBlOworICAgICAgICByZXR1cm4gcmVuZGVyX3R5cGVfbmFtZSh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpKSArICJbXSI7CisgICAgICB9CisgICAgfQorCisgICAgaWYgKHR0eXBlLT5pc19zdHJ1Y3QoKSAmJiBpc0FyZykgeworICAgICAgcmV0dXJuICJyZWYgY29uc3QoIiArIHR0eXBlLT5nZXRfbmFtZSgpICsgIikiOworICAgIH0gZWxzZSB7CisgICAgICByZXR1cm4gdHR5cGUtPmdldF9uYW1lKCk7CisgICAgfQorICB9CisKKyAgLyoqCisgICAqIFJldHVybnMgdGhlIEQgVFJlcSBlbnVtIG1lbWJlciBjb3JyZXNwb25kaW5nIHRvIHJlcS4KKyAgICovCisgIHN0cmluZyByZW5kZXJfcmVxKHRfZmllbGQ6OmVfcmVxIHJlcSkgY29uc3QgeworICAgIHN3aXRjaCAocmVxKSB7Cis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KKyAgdm9pZCBnZW5lcmF0ZV9zdHJ1Y3QodF9zdHJ1Y3QqIHRzdHJ1Y3QpOworICB2b2lkIGdlbmVyYXRlX3hjZXB0aW9uKHRfc3RydWN0KiB0eGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2UodF9zZXJ2aWNlKiB0c2VydmljZSk7CisKKyAgdm9pZCBwcmludF9jb25zdF92YWx1ZShzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX3N0YXRpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRlZnZhbCA9IGZhbHNlKTsKKyAgc3RkOjpzdHJpbmcgcmVuZGVyX2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSk7CisKKyAgLyoqCisgICAqIFNlcnZpY2UtbGV2ZWwgZ2VuZXJhdGlvbiBmdW5jdGlvbnMKKyAgICovCisKKyAgdm9pZCBnZW5lcmF0ZV9kYXJ0X3N0cnVjdCh0X3N0cnVjdCogdHN0cnVjdCwgYm9vbCBpc19leGNlcHRpb24pOworCisgIHZvaWQgZ2VuZXJhdGVfZGFydF9zdHJ1Y3RfZGVmaW5pdGlvbihzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydW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V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAoKmNfaXRlciktPmdldF90eXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgKCpjX2l0ZXIpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICBmYWxzZSk7CisgICAgZl9jb25zdHMgPDwgZW5kbDsKKyAgfQorCisgIHNjb3BlX2Rvd24oZl9jb25zdHMpOworCisgIGZfY29uc3RzLmNsb3NlKCk7Cit9CisKK3ZvaWQgdF9kYXJ0X2dlbmVyYXRvcjo6cHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fc3RhdGljLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVmdmFsKSB7CisgIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHR5cGUpOworCisgIGluZGVudChvdXQpOworICBpZiAoIWRlZnZhbCkgeworICAgIG91dCA8PCAoaW5fc3RhdGljID8gInZhciAiIDogInN0YXRpYyBmaW5hbCAiKTsKKyAgfQorICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICBpZiAoIWRlZnZhbCkgeworICAgICAgb3V0IDw8IHR5cGVfbmFtZSh0eXBlKSA8PCAiICI7CisgICAgfQorICAgIHN0cmluZyB2MiA9IHJlbmRlcl9jb25zdF92YWx1ZShvdXQsIG5hbWUsIHR5cGUsIHZhbHVlKTsKKyAgICBvdXQgPDwgbmFtZTsKKyAgICBvdXQgPDwgIiA9IC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9tKFsiIDw8IGVuZGw7CisgICAgICBldHlwZSA9ICgodF9zZXQqKXR5cGUpLT5nZXRfZWxlbV90eXBlKCk7CisgICAgfQorICAgIGNvbnN0IHZlY3Rvcjx0X2NvbnN0X3ZhbHVlKj4mIHZhbCA9IHZhbHVlLT5nZXRfbGlzdCgpOworICAgIHZlY3Rvcjx0X2NvbnN0X3ZhbHVlKj46OmNvbnN0X2l0ZXJhdG9yIHZfaXRlcjsKKworICAgIGluZGVudF91cCgpOworICAgIGZvciAodl9pdGVyID0gdmFsLmJlZ2luKCk7IHZfaXRlciAhPSB2YWwuZW5kKCk7ICsrdl9pdGVyKSB7CisgICAgICBzdHJpbmcgdmFsID0gcmVuZGVyX2NvbnN0X3ZhbHVlKG91dCwgbmFtZSwgZXR5cGUsICp2X2l0ZXIpOworICAgICAgaW5kZW50KG91dCkgPDwgdmFsIDw8ICIsIiA8PCBlbmRsOworICAgIH0KKyAgICBpbmRlbnRfZG93bigpOworCisgICAgaWYgKHR5cGUtPmlzX2xpc3QoKSkgeworICAgICAgaW5kZW50KG91dCkgPDwgIl07IiA8PCBlbmRsOworICAgIH0gZWxzZSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiXSk7IiA8PCBlbmRsOworICAgIH0KKworICB9IGVsc2UgeworICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gY29uc3Qgb2YgdHlwZSAiICsgdHlwZS0+Z2V0X25hbWUoKTsKKyAgfQorfQorCitzdHJpbmcgdF9kYXJ0X2dlbmVyYXRvcjo6cmVuZGVyX2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpI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FuZGFsb25lIG9yIGluc2lkZSBhbm90aGVyIGNsYXNzIGFzIGEgaGVscGVyLiBJZiBpdAorICogaXMgYSBoZWxwZXIgdGhhbiBpdCBpcyBhIHN0YXRpYyBjbGFzcy4KKyAqCisgKiBAcGFyYW0gdHN0cnVjdCAgICAgIFRoZSBzdHJ1Y3QgZGVmaW5pdGlvbgorICogQHBhcmFtIGlzX2V4Y2VwdGlvbiBJcyB0aGlzIGFuIGV4Y2VwdGlvbj8KKyAqIEBwYXJhbSBpbl9jbGFzcyAgICAgSWYgaW5zaWRlIGEgY2xhc3MsIG5lZWRzIHRvIGJlIHN0YXRpYyBjbGFzcworICogQHBhcmFtIGlzX3Jlc3VsdCAgICBJZiB0aGlzIGlzIGEgcmVzdWx0IGl0IG5lZWRzIGEgZGlmZmVyZW50IHdyaXRlcgorICovCit2b2lkIHRfZGFydF9nZW5lcmF0b3I6OmdlbmVyYXRlX2RhcnRfc3RydWN0X2RlZmluaXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBleHBvcnRfZmlsZV9uYW1lKSB7CisgIGdlbmVyYXRlX2RhcnRfZG9jKG91dCwgdHN0cnVjdCk7CisKKyAgc3RyaW5nIGNsYXNzX25hbWUgPSB0c3RydWN0LT5nZXRfbmFtZSgpOworICBpZiAoIWV4cG9ydF9maWxlX25hbWUuZW1wdHkoKSkgeworICAgIGV4cG9ydF9jbGFzc190b19saWJyYXJ5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bmRsOworICAgICAgc2NvcGVfZG93bihvdXQpOworICAgICAgaW5kZW50KG91dCkgPDwgInJldC53cml0ZSh0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCIgPDwgZmllbGRfbmFtZSA8PCAiX25hbWUgIT0gbnVsbCkiOworICAgICAgc2NvcGVfdXAob3V0KTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJyZXQud3JpdGUoXCIpXCIpOyIgPDwgZW5kbDsKKyAgICAgIHNjb3BlX2Rvd24ob3V0KTsKKyAgICB9IGVsc2UgeworICAgICAgaW5kZW50KG91dCkgPDwgInJldC53cml0ZSh0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgfQorCisgICAgaWYgKGNhbl9iZV9udWxsKSB7CisgICAgICBzY29wZV9kb3duKG91dCk7CisgICAgfQorICAgIGlmIChjb3VsZF9iZV91bnNldCkgeworICAgICAgc2NvcGVfZG93bihvdXQpOworICAgIH0KKworICAgIG91dCA8PCBlbmRsOworICAgIGZpcnN0ID0gZmFsc2U7CisgIH0KKworICBpbmRlbnQob3V0KSA8PCAicmV0LndyaXRlKFwiKVwiKTsiIDw8IGVuZGwyOworCisgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gcmV0LnRvU3RyaW5nKCk7IiA8PCBlbmRsOworCisgIHNjb3BlX2Rvd24ob3V0LCBlbmRsMik7Cit9CisKKy8qKgorICogUmV0dXJucyBhIHN0cmluZyB3aXRoIHRoZSBkYXJ0IHJlcHJlc2VudGF0aW9uIG9mIHRoZSBnaXZlbiB0aHJpZnQgdHlwZQorICogKGUuZy4gZm9yIHRoZSB0eXBlIHN0cnVjdCBpdCByZXR1cm5zICJUVHlwZS5TVFJVQ1QiKQorICovCitzdGQ6OnN0cmluZyB0X2RhcnRfZ2VuZXJhdG9yOjpnZXRfZGFydF90eXBlX3N0cmluZyh0X3R5cGUq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llbnQiOworICBleHBvcnRfY2xhc3NfdG9fbGlicmFyeShnZXRfZmlsZV9uYW1lKHNlcnZpY2VfbmFtZV8pLCBjbGFzc19uYW1lKTsKKyAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJjbGFzcyAiIDw8IGNsYXNzX25hbWUgPDwgZXh0ZW5kc19jbGllbnQKKyAgICAgICAgICAgICAgICAgICAgIDw8ICIgaW1wbGVtZW50cyAiIDw8IHNlcnZpY2VfbmFtZV87CisgIHNjb3BlX3VwKGZfc2VydmljZV8pOworICBmX3NlcnZpY2VfIDw8IGVuZGw7CisKKyAgaW5kZW50KGZfc2VydmljZV8pIDw8IGNsYXNzX25hbWUgPDwgIihUUHJvdG9jb2wgaXByb3QsIFtUUHJvdG9jb2wgb3Byb3QgPSBudWxsXSkiOworCisgIGlmICghZXh0ZW5kcy5lbXB0eSgpKSB7CisgICAgaW5kZW50X3VwKCk7CisgICAgZl9zZXJ2aWNlXyA8PCBlbmRsOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiOiBzdXBlcihpcHJvdCwgb3Byb3QpOyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICB9IGVsc2UgeworICAgIHNjb3BlX3VwKGZfc2VydmljZV8pOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiX2lwcm90ID0gaXByb3Q7IiA8PCBlbmRsOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiX29wcm90ID0gKG9wcm90ID09IG51bGwpID8gaXByb3QgOiBvcHJvdDsiIDw8IGVuZGw7CisgICAgc2NvcGVfZG93bihmX3NlcnZpY2VfKTsKKyAgfQorICBmX3NlcnZpY2VfIDw8IGVuZGw7CisKKyAgaWYgKGV4dGVuZHMuZW1wdHkoKSkgeworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiVFByb3RvY29sIF9pcHJvdDsiIDw8IGVuZGwyOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiVFByb3RvY29sIGdldCB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BlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAicmVhZEJvb2woKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAicmVhZEJ5dGUoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgInJlYWRJMTYoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgInJlYWRJMzIoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgInJlYWRJNjQoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgInJlYWREb3VibGUoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gRGFydCBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAicmVhZEkzMigpOyI7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIERFU0VSSUFMSVpFIEZJRUxEICclcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICBmaWVsZF9uYW1lLmNfc3RyKCksCisgICAgICAgICAgIHR5cGVfbmFtZSh0eXBlKS5jX3N0cigpKTsKKyAgfQorfQorCisvKioKKyAqIEdlbmVyYXRlcyBhbiB1bnNl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OworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIndyaXRlSTMyKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIndyaXRlSTY0KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gRGFydCBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAid3JpdGVJMzIoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnJXMlcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICBwcmVmaXguY19zdHIoKSwKKyAgICAgICAgICAgZmllbGRfbmFtZS5jX3N0cigpLAorICAgICAgICAgICB0eXBlX25hbWUodHlwZSkuY19zdHIoKSk7CisgIH0KK30KKworLyoqCisgKiBTZXJpYWxpemVzIGFsbCB0aGUgbWVtYmVycyBvZiBhI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AqKXR0eXBlLCBpdGVyLCBwcmVmaXgpOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvdXQsICh0X3NldCopdHR5cGUsIGl0ZXIpOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG91dCwgKHRfbGlzdCopdHR5cGUsIGl0ZXIpOworICB9CisKKyAgc2NvcGVfZG93bihvdXQpOworCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVNYXBFbmQoKTsiIDw8IGVuZGw7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlU2V0RW5kKCk7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVMaXN0RW5kKCk7IiA8PCBlbmRsOworICB9CisKKyAgc2NvcGVfZG93bihvdXQpOworfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBtYXAuCisgKi8KK3ZvaWQgdF9kYXJ0X2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbWFwKSB7CisgIHRfZm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MV0pKTsKKyAgICB9CisKKyAgICBpZiAoaSAhPSAwICYmICFpc19jdXJyZW50X2xjICYmIChpc19wcmV2X2xjIHx8IGlzX25leHRfbGMpKSB7CisgICAgICByZXQgKz0gIl8iOworICAgIH0KKyAgICByZXQgKz0gbGM7CisKKyAgICBpc19wcmV2X2xjID0gaXNfY3VycmVudF9sYzsKKyAgICBpc19jdXJyZW50X2xjID0gaXNfbmV4dF9sYzsKKyAgfQorCisgIHJldHVybiByZXQ7Cit9CisKK3N0ZDo6c3RyaW5nIHRfZGFydF9nZW5lcmF0b3I6OmdldF9jb25zdGFudHNfY2xhc3NfbmFtZShzdGQ6OnN0cmluZyBuYW1lKSB7CisgIC8vIGUuZy4gY2hhbmdlIG15X2dyZWF0X21vZGVsIHRvIE15R3JlYXRNb2RlbENvbnN0YW50cworICBzdHJpbmcgcmV0OworICBjb25zdCBjaGFyKiB0bXAgPSBuYW1lLmNfc3RyKCk7CisgIGJvb2wgaXNfcHJldl91bmRlcnNjb3JlID0gdHJ1ZTsKKworICBmb3IgKHVuc2lnbmVkIGludCBpID0gMDsgaSA8IG5hbWUubGVuZ3RoKCk7IGkrKykgeworICAgIGlmICh0bXBbaV0gPT0gJ18nKSB7CisgICAgICBpc19wcmV2X3VuZGVyc2NvcmUgPSB0cnVlOworICAgIH0gZWxzZSB7CisgICAgICBpZiAoaXNfcHJldl91bmRlcnNjb3JlKSB7CisgICAgICAgIHJldCArPSB0b3VwcGVyKHRtcFtpXSk7CisgICAgICB9IGVsc2UgeworICAgICAgICByZXQgKz0gdG1wW2ldOworICAgICAgfQorCisgICAgICBpc19wcmV2X3VuZGVyc2NvcmUgPSBmYWxzZTsKKyAgICB9CisgIH0KKworICByZXR1cm4gcmV0ICsgIkNvbnN0YW50cyI7Cit9CisKK3N0cmluZyB0X2RhcnRfZ2VuZXJhdG9yOjpjb25zdGFudF9uYW1lKHN0cmluZyBuYW1lKSB7CisgIHN0cmluZyBjb25zdGFudF9uYW1lOworCisgIGJvb2wgaXNfZmlyc3QgPSB0cnVlOworICBib29sIHdhc19wcmV2aW91c19jaGFyX3VwcGVyID0gZmFsc2U7CisgIGZvciAoc3RyaW5nOjppdGVyYXRvciBpdGVyID0gbmFtZS5iZWdpbigpOyBpdGVyICE9IG5hbWUuZW5kKCk7ICsraXRlcikgeworICAgIHN0cmluZzo6dmFsdWVfdHlwZSBjaGFyYWN0ZXIgPSAoKml0ZXIpOworCisgICAgYm9vbCBpc191cHBlciA9IGlzdXBwZXIoY2hhcmFjdGVyKTsKKworICAgIGlmIChpc191cHBlciAmJiAhaXNfZmlyc3QgJiYgIXdhc19wcmV2aW91c19jaGFyX3VwcGVyKSB7CisgICAgICBjb25zdGFudF9uYW1lICs9ICdfJzsKKyAgICB9CisgICAgY29uc3RhbnRfbmFtZSArPSB0b3VwcGVyKGNoYXJhY3Rlcik7CisKKyAgICBpc19maXJzdCA9IGZhbHNlOworICAgIHdhc19wcmV2aW91c19jaGFyX3VwcGVyID0gaXNfdXBwZXI7CisgIH0KKworICByZXR1cm4gY29uc3RhbnRfbmFtZTsKK30KKworLyoqCisgKiBFbWl0cyBhIGRvYyBjb21tZW50IGlmIHRoZSBwcm92aWRlZCBvYmplY3QgaGFzIGEgZG9jIGluIFRocmlmdAorICovCit2b2lkIHRfZGFydF9nZW5lcmF0b3I6OmdlbmVyYXRlX2RhcnRfZG9jKG9zdHJlYW0mIG91dCwgdF9kb2MqIHRkb2MpIHsKKyAgaWYgKHRkb2MtPmhhc19kb2MoKSkgeworICAgIGdlbmVyYXRlX2RvY3N0cmluZ19jb21tZW50KG91dCwgIiIsICIvLy8gIiwgdGRvYy0+Z2V0X2RvYygpLCAiIik7CisgIH0KK30KKworLyoqCisgKiBFbWl0cyBhIGRvYyBjb21tZW50IGlmIHRoZSBwcm92aWRlZCBmdW5jdGlvbiBvYmplY3QgaGFzIGEgZG9jIGluIFRocmlmdAorICovCit2b2lkIHRfZGFydF9nZW5lcmF0b3I6OmdlbmVyYXRlX2RhcnRfZG9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VydHlfd3JpdGVyXyhvc3RyZWFtJiBvdXQsIHRfZmllbGQqIHRmaWVsZCwgYm9vbCBpc1B1YmxpYyk7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHkob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN0cnVjdF9pc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc1B1YmxpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXggPSAiIik7CisgIHZvaWQgZ2VuZXJhdGVfZGVscGhpX2lzc2V0X3JlYWRlcl9kZWZpbml0aW9uKG9zdHJlYW0mIG91dCwgdF9maWVsZCogdGZpZWxkLCBib29sIGlzX3hjZXB0aW9uKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHlfcmVhZGVyX2RlZmluaXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fY2xhc3MpOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9wcm9wZXJ0eV93cml0ZXJfZGVmaW5pdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbl9jbGFzcyk7CisgIHZvaWQgZ2VuZXJhdGVfZGVscGhpX3Byb3BlcnR5X3JlYWRlcl9pbXBsKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGZpZWxkUHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uX2NsYXNzKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHlfd3JpdGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfdW5pb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgeGNlcHRpb25fZmFjdG9yeV9uYW1lKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfY2xlYXJfdW5pb25fdmFsdWUob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfdW5pb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgeGNlcHRpb25fZmFjdG9yeV9uYW1lKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfaXNzZXRfcmVhZGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3Rfd3JpdGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfcmVzdWx0X3dyaXRlcl9pbXBsKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uKTsKKworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfdG9zdHJpbmdfaW1wbChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194X2ZhY3RvcnkpOworCisgIHZvaWQgYWRkX2RlbHBoaV91c2VzX2xpc3Qoc3RyaW5nIHVuaXRuYW1lKTsKKworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfcmVhZGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9jcmVhdGVfZXhjZXB0aW9uX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uKTsKKworICBib29sIGNvbnN0X25lZWRzX3Zhcih0X3R5cGUqIHR5cGUpOworICB2b2lkIHByaW50X2NvbnN0X3Byb3Aoc3RkOjpvc3RyZWFtJiBvdXQsIHN0cmluZyBuYW1lLCB0X3R5cGUqIHR5cGUsIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKyAgdm9pZCBwcmludF9wcml2YXRlX2ZpZWxkKHN0ZDo6b3N0cmVhbSYgb3V0LCBzdHJpbmcgbmFtZSwgdF90eXBlKiB0eXBlLCB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSk7CisgIHZvaWQgcHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiB2YXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKyAgdm9pZCBpbml0aWFsaXplX2ZpZWxkKHN0ZDo6b3N0cmVhbSYgdmFycywKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKyAgdm9pZCBmaW5hbGl6ZV9maWVsZChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfbm0gPSAiIik7CisgIHN0ZDo6c3RyaW5nIHJlbmRlcl9jb25zdF92YWx1ZShzdGQ6Om9zdHJlYW0mIGxvY2FsX3ZhcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSk7CisgIHZvaWQgcHJpbnRfY29uc3RfZGVmX3ZhbHVlKHN0ZDo6b3N0cmVhbSYgdmFycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNsc19ubSA9ICIiKTsKKyAgc3RkOjpzdHJpbmcgbWFrZV9jb25zdGFudHNfY2xhc3NuYW1lKCk7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfc3RydWN0KHRfc3RydWN0KiB0c3RydWN0LCBib29sIGlzX2V4Y2VwdGlvbik7CisgIHZvaWQgZ2VuZXJhdGVfZGVscGhpX3N0cnVjdF9pbXBsKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3Jlc3VsdCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hfZmFjdG9yeSA9IGZhbHNlKTsKKyAgdm9pZCBwcmludF9kZWxwaGlfc3RydWN0X3R5cGVfZmFjdG9yeV9mdW5jKG9zdHJlYW0mIG91dCwgdF9zdHJ1Y3QqIHRzdHJ1Y3QpOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfdHlwZV9mYWN0b3J5KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0ID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194X2ZhY3RvcnkgPSBmYWxzZSk7CisgIHZvaWQgZ2VuZXJhdGVfZGVscGhpX3N0cnVjdF90eXBlX2ZhY3RvcnlfcmVnaXN0cmF0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3Jlc3VsdCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hfZmFjdG9yeSA9IGZhbHNlKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfc3RydWN0X2RlZmluaXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194X2ZhY3RvcnkgPSBmYWxzZSk7CisgIHZvaWQgZ2VuZXJhdGVfZGVscGhpX3N0cnVjdF9yZWFkZXIoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfc3RydWN0X3Jlc3VsdF93cml0ZXIoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KTsKKyAgdm9pZCBnZW5lcmF0ZV9kZWxwaGlfc3RydWN0X3dyaXRlcihzdGQ6Om9zdHJlYW0mIG91dCwgdF9zdHJ1Y3QqIHRzdHJ1Y3QpOworICB2b2lkIGdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfdG9zdHJpbmcoc3RkOjpvc3RyZWFtJiBvdXQs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KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4KTsKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpvc3RyZWFtJiBsb2NhbF92YXJzKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgbG9jYWxfdmFycyk7CisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpvc3RyZWFtJiBsb2NhbF92YXJzKTsKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogbGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om9zdHJlYW0mIGxvY2FsX3ZhcnMpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpvc3RyZWFtJiBsb2NhbF92YXJzKTsKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om9zdHJlYW0mIGxvY2FsX3ZhcnMpOworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgbG9jYWxfdmFycyk7CisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om9zdHJlYW0mIGxvY2FsX3ZhcnMpOworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGl0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgbG9jYWxfdmFycyk7CisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgbG9jYWxfdmFycyk7CisKKyAgdm9pZCBkZWxwaGlfdHlwZV91c2luZ3Moc3RkOjpvc3RyZWFtJiBvdXQpOworICBzdGQ6OnN0cmluZyBkZWxwaGlfdGhyaWZ0X3VzaW5ncygpOworCisgIHN0ZDo6c3RyaW5nIHR5cGVfbmFtZSh0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBiX2NscyA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBiX25vX3Bvc3RmaXggPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYl9leGNlcHRpb25fZmFjdG9yeSA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBiX2Z1bGxfZXhjZXB0aW9uX2ZhY3RvcnkgPSBmYWxzZSk7CisgIHN0ZDo6c3RyaW5nIG5vcm1hbGl6ZV9jbHNubShzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBiX25vX2NoZWNrX2tleXdvcmQgPSBmYWxzZSk7CisgIHN0ZDo6c3RyaW5nIG1ha2VfdmFsaW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nRlbnRzKSB7CisgIHN0cmluZyBzdHIoeG1sX2VuY29kZShjb250ZW50cykpOworCisgIC8vIFhNTERvYyBzcGVjaWZpYzogY29udmVydCBsaW5lYnJlYWtzIGludG8gPHBhcmE+Z3JhcGhzPC9wYXJhPgorICBzdHIgPSByZXBsYWNlX2FsbChzdHIsICJcclxuIiwgIlxyIik7CisgIHN0ciA9IHJlcGxhY2VfYWxsKHN0ciwgIlxuIiwgIlxyIik7CisgIHN0ciA9IHJlcGxhY2VfYWxsKHN0ciwgIlxyIiwgIjwvcGFyYT5cbjxwYXJhPiIpOworCisgIHJldHVybiBzdHI7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfZG9jc3RyaW5nX2NvbW1lbnQob3N0cmVhbSYgb3V0LCBzdHJpbmcgY29udGVudHMpIHsKKyAgaWYgKHhtbGRvY18pIHsKKyAgICBnZW5lcmF0ZV9kb2NzdHJpbmdfY29tbWVudChvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInskUkVHSU9OICdYTUxEb2MnfS8vLyA8c3VtbWFyeT5cbiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIi8vLyAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI8cGFyYT4iICsgY29udGVudHMgKyAiPC9wYXJhPiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIi8vLyA8L3N1bW1hcnk+XG57JEVORFJFR0lPTn1cbiIpOworICB9Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfZG9jKG9zdHJlYW0mIG91dCwgdF9maWVsZCogZmllbGQpIHsKKyAgaWYgKHhtbGRvY18pIHsKKyAgICBpZiAoZmllbGQtPmdldF90eXBlKCktPmlzX2VudW0oKSkgeworICAgICAgc3RyaW5nIGNvbWJpbmVkX21lc3NhZ2UgPSB4bWxkb2NfZW5j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KTsgKytwX2l0ZXIpIHsKKyAgICAgIHRfZmllbGQqIHAgPSAqcF9pdGVyOworICAgICAgcHMgPDwgIlxuPHBhcmFtIG5hbWU9XCIiIDw8IHhtbGF0dHJpYl9lbmNvZGUocC0+Z2V0X25hbWUoKSkgPDwgIlwiPiI7CisgICAgICBpZiAocC0+aGFzX2RvYygpKSB7CisgICAgICAgIHN0ZDo6c3RyaW5nIHN0ciA9IHAtPmdldF9kb2MoKTsKKyAgICAgICAgc3RyLmVyYXNlKHN0ZDo6cmVtb3ZlKHN0ci5iZWdpbigpLCBzdHIuZW5kKCksICdcbicpLAorICAgICAgICAgICAgICAgICAgc3RyLmVuZCgpKTsgLy8gcmVtb3ZlIHRoZSBuZXdsaW5lcyB0aGF0IGFwcGVhciBmcm9tIHRoZSBwYXJzZXIKKyAgICAgICAgcHMgPDwgeG1sZG9jX2VuY29kZShzdHIpOworICAgICAgfQorICAgICAgcHMgPDwgIjwvcGFyYW0+IjsKKyAgICB9CisgICAgZ2VuZXJhdGVfZG9jc3RyaW5nX2NvbW1lbnQob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ7JFJFR0lPTiAnWE1MRG9jJ30iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIvLy8gIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiPHN1bW1hcnk+PHBhcmE+IiArIHhtbGRvY19lbmNvZGUodGZ1bmN0aW9uLT5nZXRfZG9jKCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiPC9wYXJhPjwvc3VtbWFyeT4iICsgcHMuc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInskRU5EUkVHSU9OfVxuIik7CisgIH0KK30KKworYm9vbCB0X2RlbHBoaV9nZW5lcmF0b3I6OmZpbmRfa2V5d29yZChzdGQ6Om1hcDxzdGQ6OnN0cmluZywgaW50PiYga2V5d29yZF9tYXAsIHN0ZDo6c3RyaW5nIG5hbWUpIHsKKyAgc3RkOjpzdHJpbmc6OnNpemVfdHlwZSBsZW4gPSBuYW1lLmxlbmd0aCgpOworCisgIGlmIChsZW4gPD0gMCkgeworICAgIHJldHVybiBmYWxzZTsKKyAgfQorCisgIHN0ZDo6c3RyaW5nOjpzaXplX3R5cGUgbmxhc3QgPSBuYW1lLmZpbmRfbGFzdF9vZignXycpOworCisgIGlmIChubGFzdCA+PSAxKSB7CisgICAgaWYgKG5sYXN0ID09IChsZW4gLSAxKSkgeworICAgICAgc3RyaW5nIG5ld19uYW1lKG5hbWUsIDAsIG5sYXN0KTsKKyAgICAgIHJldHVybiBmaW5kX2tleXdvcmQoa2V5d29yZF9tYXAsIG5ld19uYW1lKTsKKyAgICB9CisgIH0KKyAgcmV0dXJuIChrZXl3b3JkX21hcFtuYW1lXSA9PSAxKTsKK30KKworc3RkOjpzdHJpbmcgdF9kZWxwaGlfZ2VuZXJhdG9yOjpub3JtYWxpemVfbmFtZShzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGJfbWV0aG9kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGJfZXhjZXB0aW9uX21ldGhvZCkgeworICBzdHJpbmcgdG1wKG5hbWUpOworICBzdGQ6OnRyYW5zZm9ybSh0bXAuYmVnaW4oKSwgdG1wLmVuZCgpLCB0bXAuYmVnaW4oKSwgc3RhdGljX2Nhc3Q8aW50ICgqKShpbnQpPihzdGQ6OnRvbG93ZXIpKTsKKworICBib29sIGJfZm91bmQgPSBmYWxzZTsKKworICBpZiAoZmluZF9rZXl3b3JkKGRlbHBoaV9rZXl3b3JkcywgdG1wKSkgeworICAgIGJfZm91bmQgPSB0cnVlOworICB9IGVsc2UgaWYgKGJfbWV0aG9kICYmIGZpbmRfa2V5d29yZChkZWxwaGlfcmVzZXJ2ZWRfbWV0aG9kLCB0bXApKSB7CisgICAgYl9mb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ICAgICAgICAgIDw8IGVuZGw7CisgIGluZGVudChmX2FsbCkgPDwgImMiIDw8IHRtcF91bml0CisgICAgICAgICAgICAgICAgPDwgIl9PcHRpb25fUmVnaXN0ZXJfVHlwZXMgPSAiIDw8IChyZWdpc3Rlcl90eXBlc18gPyAiVHJ1ZSIgOiAiRmFsc2UiKSA8PCAiOyIKKyAgICAgICAgICAgICAgICA8PCBlbmRsOworICBpbmRlbnQoZl9hbGwpIDw8ICJjIiA8PCB0bXBfdW5pdAorICAgICAgICAgICAgICAgIDw8ICJfT3B0aW9uX0NvbnN0UHJlZml4ICAgID0gIiA8PCAoY29uc3RwcmVmaXhfID8gIlRydWUiIDogIkZhbHNlIikgPDwgIjsiIDw8IGVuZGw7CisgIGluZGVudChmX2FsbCkgPDwgImMiIDw8IHRtcF91bml0IDw8ICJfT3B0aW9uX0V2ZW50cyAgICAgICAgID0gIiA8PCAoZXZlbnRzXyA/ICJUcnVlIiA6ICJGYWxzZSIpCisgICAgICAgICAgICAgICAgPDwgIjsiIDw8IGVuZGw7CisgIGluZGVudChmX2FsbCkgPDwgImMiIDw8IHRtcF91bml0IDw8ICJfT3B0aW9uX1htbERvYyAgICAgICAgID0gIiA8PCAoeG1sZG9jXyA/ICJUcnVlIiA6ICJGYWxzZSIpCisgICAgICAgICAgICAgICAgPDwgIjsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisKKyAgZl9hbGwgPDwgZW5kbDsKKyAgZl9hbGwgPDwgInR5cGUiIDw8IGVuZGw7CisgIGlmIChoYXNfZm9yd2FyZCkgeworICAgIGZfYWxsIDw8IHNfZm9yd2FyZF9kZWNyLnN0cigpIDw8IGVuZGw7CisgIH0KKyAgaWYgKGhhc19lbnVtKSB7CisgICAgaW5kZW50KGZfYWxsKSA8PCBlbmRsOworICAgIGluZGVudChmX2FsbCkgPDwgInskU0NPUEVERU5VTVMgT059IiA8PCBlbmRsIDw8IGVuZGw7CisgICAgZl9hbGwgPDwgc19lbnVtLnN0cig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rvd24oKTsKKyAgaW5kZW50KHNfY29uc3QpIDw8ICJwdWJsaWMiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBmb3IgKGNfaXRlciA9IGNvbnN0cy5iZWdpbigpOyBjX2l0ZXIgIT0gY29uc3RzLmVuZCgpOyArK2NfaXRlcikgeworICAgIGdlbmVyYXRlX2RlbHBoaV9kb2Moc19jb25zdCwgKmNfaXRlcik7CisgICAgcHJpbnRfY29uc3RfcHJvcChzX2NvbnN0LAorICAgICAgICAgICAgICAgICAgICAgbm9ybWFsaXplX25hbWUoKCpjX2l0ZXIpLT5nZXRfbmFtZSgpKSwKKyAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3R5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3ZhbHVlKCkpOworICB9CisgIGluZGVudChzX2NvbnN0KSA8PCAieyRJRiBDb21waWxlclZlcnNpb24gPj0gMjEuMH0iIDw8IGVuZGw7CisgIGluZGVudChzX2NvbnN0KSA8PCAiY2xhc3MgY29uc3RydWN0b3IgQ3JlYXRlOyIgPDwgZW5kbDsKKyAgaW5kZW50KHNfY29uc3QpIDw8ICJjbGFzcyBkZXN0cnVjdG9yIERlc3Ryb3k7IiA8PCBlbmRsOworICBpbmRlbnQoc19jb25zdCkgPDwgInskSUZFTkR9IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQoc19jb25zdCkgPDwgImVuZDsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd24oKTsKKworICBzdGQ6Om9zdHJpbmdzdHJlYW0gdmFycywgY29kZTsKKworICBpbmRlbnRfdXBfaW1wbCgpOworICBmb3IgKGNfaXRlciA9IGNvbnN0cy5iZWdpbigpOyBjX2l0ZXIgIT0gY29uc3RzLmVuZCgpOyArK2NfaXRlcikgeworICAgIGluaXRpYWxpemVfZmllbGQodmFycywKKyAgICAgICAgICAgICAgICAgICAgIGNvZGUs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W1wbCkgPDwgImJlZ2luIiA8PCBlbmRsOworICBpbmRlbnRfdXBfaW1wbCgpOworICBmb3IgKGNfaXRlciA9IGNvbnN0cy5iZWdpbigpOyBjX2l0ZXIgIT0gY29uc3RzLmVuZCgpOyArK2NfaXRlcikgeworICAgIGlmIChjb25zdF9uZWVkc192YXIoKCpjX2l0ZXIpLT5nZXRfdHlwZSgpKSkgeworICAgICAgZmluYWxpemVfZmllbGQoc19jb25zdF9pbXBsLAorICAgICAgICAgICAgICAgICAgICAgbm9ybWFsaXplX25hbWUoKCpjX2l0ZXIpLT5nZXRfbmFtZSgpKSwKKyAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3R5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3ZhbHVlKCkpOworICAgIH0KKyAgfQorICBpbmRlbnRfaW1wbChzX2NvbnN0X2ltcGwpIDw8ICJpbmhlcml0ZWQ7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bl9pbXBsKCk7CisgIGluZGVudF9pbXBsKHNfY29uc3RfaW1wbCkgPDwgImVuZDsiIDw8IGVuZGw7CisgIGluZGVudF9pbXBsKHNfY29uc3RfaW1wbCkgPDwgInskRUxTRX0iIDw8IGVuZGw7CisKKyAgdmFycy5zdHIoIiIpOworICBjb2RlLnN0cigiIik7CisKKyAgaW5kZW50X3VwX2ltcGwoKTsKKyAgZm9yIChjX2l0ZXIgPSBjb25zdHMuYmVnaW4oKTsgY19pdGVyICE9IGNvbnN0cy5lbmQoKTsgKytjX2l0ZXIpIHsKKyAgICBpZiAoY29uc3RfbmVlZHNfdmFyKCgqY19pdGVyKS0+Z2V0X3R5cGUoKSkpIHsKKyAgICAgIGluaXRpYWxpemVfZmllbGQodmFycywKKyAgICAgICAgICAgICAgICAgICAgICAgY29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgY29uc3RhbnRzX2NsYXNzICsgIi5GIiArIHByb3BfbmFtZSgoKmNfaXRlci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aXplX25hbWUoKCpjX2l0ZXIpLT5nZXRfbmFtZSgpKSwKKyAgICAgICAgICAgICAgICAgICAoKmNfaXRlciktPmdldF90eXBlKCksCisgICAgICAgICAgICAgICAgICAgKCpjX2l0ZXIpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICBjb25zdGFudHNfY2xhc3MpOworICB9CisgIGluZGVudF9kb3duX2ltcGwoKTsKKyAgaW5kZW50X2ltcGwoc19jb25zdF9pbXBsKSA8PCAiZW5kOyIgPDwgZW5kbDsKKyAgaW5kZW50X2ltcGwoc19jb25zdF9pbXBsKSA8PCAieyRJRkVORH0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OnByaW50X2NvbnN0X2RlZl92YWx1ZShzdGQ6Om9zdHJlYW0mIHZhcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGNsc19ubSkgeworCisgIHN0cmluZyBjbHNfcHJlZml4OworCisgIGlmIChjbHNfbm0gPT0gIiIpIHsKKyAgICBjbHNfcHJlZml4ID0gIiI7CisgIH0gZWxzZSB7CisgICAgY2xzX3ByZWZpeCA9IGNsc19ubSArICIuIjsKKyAgfQorCisgIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgY29uc3QgdmVjd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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpIHsKKyAgKHZvaWQpdmFsdWU7CisgIGluZGVudChvdXQpIDw8ICJjbGFzcyB2YXIgRiIgPDwgbmFtZSA8PCAiOiAiIDw8IHR5cGVfbmFtZSh0eXBlKSA8PCAiOyIgPDwgZW5kbDsKK30KKworYm9vbCB0X2RlbHBoaV9nZW5lcmF0b3I6OmNvbnN0X25lZWRzX3Zhcih0X3R5cGUqIHR5cGUpIHsKKyAgdF90eXBlKiB0cnVldHlwZSA9IHR5cGU7CisgIHdoaWxlICh0cnVldHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHJ1ZXR5cGUgPSAoKHRfdHlwZWRlZiopdHJ1ZXR5cGUpLT5nZXRfdHlwZSgpOworICB9CisgIHJldHVybiAoIXRydWV0eXBlLT5pc19iYXNlX3R5cGUoKSk7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpwcmludF9jb25zdF9wcm9wKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSkgeworICAodm9pZCl2YWx1ZTsKKyAgaWYgKGNvbnN0X25lZWRzX3Zhcih0eXBlKSkgeworICAgIGluZGVudChvdXQpIDw8ICJjbGFzcyBwcm9wZXJ0eSAiIDw8IG5hbWUgPDwgIjogIiA8PCB0eXBlX25hbWUodHlwZSkgPDwgIiByZWFkIEYiIDw8IG5hbWUgPDwgIjsiCisgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gdmFyczsgLy8gZHVtbXkKKyAgICBzdHJpbmcgdjIgPSByZW5kZXJfY29uc3RfdmFsdWUodmFycywgb3V0LCBuYW1lLCB0eXBlLCB2YWx1ZSk7CisgICAgaW5kZW50KG91dCkgPDwgImNvbnN0ICIgPDwgbmFtZSA8PCAiID0gIiA8PCB2MiA8PCAiOyIgPDwgZW5kbDsKKyAgfQorfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6cHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiB2YXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSkgeworICB0X3R5cGUqIHRydWV0eXBlID0gdHlwZTsKKyAgd2hpbGUgKHRydWV0eXBlLT5pc190eXBlZGVmKCkpIHsKKyAgICB0cnVldHlwZSA9ICgodF90eXBlZGVmKil0cnVldHlwZSktPmdldF90eXBlKCk7CisgIH0KKworICBpZiAodHJ1ZXR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgLy8gYWxyZWFkeSBkb25lCisgICAgLy8gc3RyaW5nIHYyID0gcmVuZGVyX2NvbnN0X3ZhbHVlKCB2YXJzLCBvdXQsIG5hbWUsIHR5cGUsIHZhbHVlKTsKKyAgICAvLyBpbmRlbnRfaW1wbChvdXQpIDw8IG5hbWUgPDwgIiA6PSAiIDw8IHYyIDw8ICI7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgK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zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGNsc19ubSkgeworICAodm9pZClvdXQ7CisgICh2b2lkKW5hbWU7CisgICh2b2lkKXR5cGU7CisgICh2b2lkKXZhbHVlOworICAodm9pZCljbHNfbm07Cit9CisKK3N0cmluZyB0X2RlbHBoaV9nZW5lcmF0b3I6OnJlbmRlcl9jb25zdF92YWx1ZShvc3RyZWFtJiB2YXJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpIHsKKyAgKHZvaWQpbmFtZTsKKworICB0X3R5cGUqIHRydWV0eXBlID0gdHlwZTsKKyAgd2hpbGUgKHRydWV0eXBlLT5pc190eXBlZGVmKCkpIHsKKyAgICB0cnVldHlwZSA9ICgodF90eXBlZGVmKil0cnVldHlwZSktPmdldF90eXBlKCk7CisgIH0KKworICBzdGQ6Om9zdHJpbmdzdHJlYW0gcmVuZGVyOworCisgIGlmICh0cnVldHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICB0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNlID0gKCh0X2Jhc2VfdHlwZSopd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cHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hfZmFjdG9yeSkgeworCisgIGlmIChpc19leGNlcHRpb24gJiYgKCFpc194X2ZhY3RvcnkpKSB7CisgICAgZ2VuZXJhdGVfZGVscGhpX3N0cnVjdF9pbXBsKG91dCwgY2xzX3ByZWZpeCwgdHN0cnVjdCwgaXNfZXhjZXB0aW9uLCBpc19yZXN1bHQsIHRydWUpOworICB9CisKKyAgc3RyaW5nIGNsc19ubTsKKworICBzdHJpbmcgZXhjZXB0aW9uX2ZhY3RvcnlfbmFtZTsKKworICBpZiAoaXNfZXhjZXB0aW9uKSB7CisgICAgZXhjZXB0aW9uX2ZhY3RvcnlfbmFtZSA9IG5vcm1hbGl6ZV9jbHNubSh0c3RydWN0LT5nZXRfbmFtZSgpLCAiIiwgdHJ1ZSkgKyAiRmFjdG9yeSI7CisgIH0KKworICBpZiAoaXNfZXhjZXB0aW9uKSB7CisgICAgY2xzX25tID0gdHlwZV9uYW1lKHRzdHJ1Y3QsIHRydWUsICghaXNfeF9mYWN0b3J5KSwgaXNfeF9mYWN0b3J5LCB0cnVlKTsKKyAgfSBlbHNlIHsKKyAgICBjbHNfbm0gPSB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSwgZmFsc2UpOworICB9CisKKyAgc3RkOjpvc3RyaW5nc3RyZWFtIHZhcnMsIGNvZGU7CisKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgbWVtYmVycyA9IHRzdHJ1Y3QtPmdldF9tZW1iZXJzKCk7CisgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIG1faXRlcjsKKworICBpbmRlbnRfdXBfaW1wbCgpOworICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgdF90eXBlKiB0ID0gKCptX2l0ZXIpLT5nZXRfdHlwZSgpOworICAgIHdoaWxlICh0LT5pc190eXBlZGVmKCkpIHsKKyAgICAgIHQgPSAoKHRfdHlwZWRlZiopdCktPmdldF90eXBlKCk7CisgICAgfQorICAgIGlmICgoKm1faXRlciktPmdldF92YWx1ZSgpICE9IE5VTEwpIHsKKyAgICAgIGluaXRpYWxpemVfZmllbGQodmFycywKKyAgICAgICAgICAgICAgICAgICAgICAgY29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIkYiICsgcHJvcF9uYW1lKCgqbV9pdGVyKS0+Z2V0X25hbWUoKSwgaXNfZXhjZXB0aW9uKSwKKyAgICAgICAgICAgICAgICAgICAgICAgdCwKKyAgICAgICAgICAgICAgICAgICAgICAgKCptX2l0ZXIpLT5nZXRfdmFsdWUoKSk7CisgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgIT0gdF9maWVsZDo6VF9SRVFVSVJFRCkgeworICAgICAgICBpbmRlbnRfaW1wbChjb2RlKSA8PCAiRl9faXNzZXRfIiA8PCBwcm9wX25hbWUoKCptX2l0ZXIpLCBpc19leGNlcHRpb24pIDw8ICIgOj0gVHJ1ZTsiCisgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICB9CisgICAgfQorICB9CisgIGluZGVudF9kb3duX2ltcGwoKTsKKworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJjb25zdHJ1Y3RvciAiIDw8IGNsc19wcmVmaXggPDwgY2xzX25tIDw8ICIuIgorICAgICAgICAgICAgICAg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d25faW1wbCgpOworICAgIGluZGVudF9pbXBsKG91dCkgPDwgImVuZDsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgfQorCisgIGlmICh0c3RydWN0LT5pc191bmlvbigpKSB7CisgICAgaW5kZW50X2ltcGwob3V0KSA8PCAicHJvY2VkdXJlICIgPDwgY2xzX3ByZWZpeCA8PCBjbHNfbm0gPDwgIi4iCisgICAgICAgICAgICAgICAgICAgICA8PCAiQ2xlYXJVbmlvblZhbHVlczsiIDw8IGVuZGw7CisgICAgaW5kZW50X2ltcGwob3V0KSA8PCAiYmVnaW4iIDw8IGVuZGw7CisgICAgaW5kZW50X3VwX2ltcGwoKTsKKyAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgICB0X3R5cGUqIHQgPSAoKm1faXRlciktPmdldF90eXBlKCk7CisgICAgICB3aGlsZSAodC0+aXNfdHlwZWRlZigpKSB7CisgICAgICAgIHQgPSAoKHRfdHlwZWRlZiopdCktPmdldF90eXBlKCk7CisgICAgICB9CisKKyAgICAgIGdlbmVyYXRlX2RlbHBoaV9jbGVhcl91bmlvbl92YWx1ZShvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHNfbm0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqbV9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJGIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHN0cnVjdC0+aXNfdW5pb24oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc194X2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhjZXB0aW9uX2ZhY3RvcnlfbmFtZSk7CisgICAgfQorICAgIGluZGVudF9kb3duX2ltcGwoKTsKKyAgICBpbmRlbnRfaW1wbChvdXQpIDw8ICJlbmQ7IiA8PCBlbmRsIDw8IGVuZGw7CisgIH0KKworICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgdF90eXBlKiB0ID0gKCptX2l0ZXIpLT5nZXRfdHlwZSgpOworICAgIHdoaWxlICh0LT5pc190eXBlZGVmKCkpIHsKKyAgICAgIHQgPSAoKHRfdHlwZWRlZiopdCktPmdldF90eXBlKCk7CisgICAgfQorICAgIGdlbmVyYXRlX2RlbHBoaV9wcm9wZXJ0eV9yZWFkZXJfaW1wbChvdXQsIGNsc19wcmVmaXgsIGNsc19ubSwgdCwgKm1faXRlciwgIkYiLCBpc19leGNlcHRpb24pOworICAgIGdlbmVyYXRlX2RlbHBoaV9wcm9wZXJ0eV93cml0ZXJfaW1wbChvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsc19ubSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKm1faXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkYiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRzdHJ1Y3QtPmlzX3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19wcmVmaXgsIHRzdHJ1Y3QsIGlzX2V4Y2VwdGlvbik7CisgIH0KK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OnByaW50X2RlbHBoaV9zdHJ1Y3RfdHlwZV9mYWN0b3J5X2Z1bmMob3N0cmVhbSYgb3V0LCB0X3N0cnVjdCogdHN0cnVjdCkgeworICBzdHJpbmcgc3RydWN0X2ludGZfbmFtZSA9IHR5cGVfbmFtZSh0c3RydWN0KTsKKyAgb3V0IDw8ICJDcmVhdGVfIjsKKyAgb3V0IDw8IHN0cnVjdF9pbnRmX25hbWU7CisgIG91dCA8PCAiX0ltcGwiOworfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVscGhpX3N0cnVjdF90eXBlX2ZhY3Rvcnkob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeF9mYWN0b3J5KSB7CisgICh2b2lkKWNsc19wcmVmaXg7CisgIGlmIChpc19leGNlcHRpb24pCisgICAgcmV0dXJuOworICBpZiAoaXNfcmVzdWx0KQorICAgIHJldHVybjsKKyAgaWYgKGlzX3hfZmFjdG9yeSkKKyAgICByZXR1cm47CisKKyAgc3RyaW5nIHN0cnVjdF9pbnRmX25hbWUgPSB0eXBlX25hbWUodHN0cnVjdCk7CisgIHN0cmluZyBjbHNfbm0gPSB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSwgZmFsc2UpOworCisgIG91dCA8PCAiZnVuY3Rpb24gIjsKKyAgcHJpbnRfZGVscGhpX3N0cnVjdF90eXBlX2ZhY3RvcnlfZnVuYyhvdXQsIHRzdHJ1Y3QpOworICBvdXQgPDwgIjogIjsKKyAgb3V0IDw8IHN0cnVjdF9pbnRmX25hbWU7CisgIG91dCA8PCAiOyIgPDwgZW5kbDsKKyAgb3V0IDw8ICJiZWdpbiIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGluZGVudChvdXQpIDw8ICJSZXN1bHQgOj0gIiA8PCBjbHNfbm0gPDwgIi5DcmVhdGU7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworICBvdXQgPDwgImVuZDsiIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfdHlwZV9mYWN0b3J5X3JlZ2lzdHJhdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hfZmFjdG9yeSkgeworICAodm9pZCljbHNfcHJlZml4OworICBpZiAoaXNfZXhjZXB0aW9uKQorICAgIHJldHVybjsKKyAgaWYgKGlzX3Jlc3VsdCkKKyAgICByZXR1cm47CisgIGlmIChpc194X2ZhY3RvcnkpCisgICAgcmV0dXJuOworCisgIHN0cmluZyBzdHJ1Y3RfaW50Zl9uYW1lID0gdHlwZV9uYW1lKHRzdHJ1Y3QpOworCisgIGluZGVudChvdXQpIDw8ICIgIFR5cGVSZWdpc3RyeS5SZWdpc3RlclR5cGVGYWN0b3J5PCIgPDwgc3RydWN0X2ludGZfbmFtZSA8PCAiPigiOworICBwcmludF9kZWxwaGlfc3RydWN0X3R5cGVfZmFjdG9yeV9mdW5jKG91dCwgdHN0cnVjdCk7CisgIG91dCA8PCAiKTsiOworICBvdXQgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2RlbHBoaV9zdHJ1Y3RfZGVmaW5pdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeF9mYWN0b3J5KS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W5lcmF0ZV9kZWxwaGlfZG9jKHNfc2VydmljZSwgdHNlcnZpY2UpOworICBpZiAodHNlcnZpY2UtPmdldF9leHRlbmRzKCkgIT0gTlVMTCkgeworICAgIGV4dGVuZHMgPSB0eXBlX25hbWUodHNlcnZpY2UtPmdldF9leHRlbmRzKCksIHRydWUsIHRydWUpOworICAgIGV4dGVuZHNfY2xpZW50ID0gZXh0ZW5kcyArICIuVENsaWVudCI7CisgIH0KKyAgaW5kZW50KHNfc2VydmljZSkgPDwgIlRDbGllbnQgPSBjbGFzcyggIiA8PCBleHRlbmRzX2NsaWVudCA8PCAiLCAiIDw8IGltcGxlbWVudHMgPDwgIikiIDw8IGVuZGw7CisKKyAgaW5kZW50KHNfc2VydmljZSkgPDwgInB1YmxpYyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisKKyAgaW5kZW50KHNfc2VydmljZSkgPDwgImNvbnN0cnVjdG9yIENyZWF0ZSggcHJvdDogSVByb3RvY29sKTsgb3ZlcmxvYWQ7IiA8PCBlbmRsOworCisgIGluZGVudF9pbXBsKHNfc2VydmljZV9pbXBsKSA8PCAiY29uc3RydWN0b3IgIiA8PCBub3JtYWxpemVfY2xzbm0oc2VydmljZV9uYW1lXywgIlQiKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIi5UQ2xpZW50LkNyZWF0ZSggcHJvdDogSVByb3RvY29sKTsiIDw8IGVuZGw7CisgIGluZGVudF9pbXBsKHNfc2VydmljZV9pbXBsKSA8PCAiYmVnaW4iIDw8IGVuZGw7CisgIGluZGVudF91cF9pbXBsKCk7CisgIGluZGVudF9pbXBsKHNfc2VydmljZV9pbXBsKSA8PCAiQ3JlYXRlKCBwcm90LCBwcm90ICk7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bl9pbXBsKCk7CisgIGluZGVudF9pbXBsKHNfc2VydmljZV9pbXBsKSA8PCAiZW5kOyIgPDwgZW5kbCA8PCBlbmRsOworCisgIGluZGVudChzX3NlcnZ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AgaW5kZW50KHNfc2VydmljZSkgPDwgInByb3RlY3RlZCIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBpbmRlbnQoc19zZXJ2aWNlKSA8PCAicHJvY2Vzc01hcF86IElUaHJpZnREaWN0aW9uYXJ5PHN0cmluZywgVFByb2Nlc3NGdW5jdGlvbj47IiA8PCBlbmRsOworICAgIGluZGVudF9kb3duKCk7CisgIH0KKworICBpbmRlbnQoc19zZXJ2aWNlKSA8PCAicHVibGljIiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaWYgKGV4dGVuZHMuZW1wdHkoKSkgeworICAgIGluZGVudChzX3NlcnZpY2UpIDw8ICJmdW5jdGlvbiBQcm9jZXNzKCBjb25zdCBpcHJvdDogSVByb3RvY29sOyBjb25zdCBvcHJvdDogSVByb3RvY29sOyBjb25zdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgImV2ZW50cyA6IElQcm9jZXNzb3JFdmVudHMpOiBTeXN0ZW0uQm9vbGVhbjsiIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgaW5kZW50KHNfc2VydmljZSkgPDwgImZ1bmN0aW9uIFByb2Nlc3MoIGNvbnN0IGlwcm90OiBJUHJvdG9jb2w7IGNvbnN0IG9wcm90OiBJUHJvdG9jb2w7IGNvbnN0ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAiZXZlbnRzIDogSVByb2Nlc3NvckV2ZW50cyk6IFN5c3RlbS5Cb29sZWFuOyByZWludHJvZHVjZTsiIDw8IGVuZGw7CisgIH0KKworICBpbmRlbnRfaW1wbChzX3NlcnZpY2VfaW1wbCkgPDwgImZ1bmN0aW9uICIgPDwgZnVsbF9jbHMgPDwgIi5Qcm9jZXNzKCBjb25zdCBpcHJvdDogSVByb3RvY29sOyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY29uc3Qgb3Byb3Q6IElQcm90b2NvbDsgY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BpZiAoZXZlbnRzXykgeworICAgICAgaW5kZW50X2ltcGwoc19zZXJ2aWNlX2ltcGwpIDw8ICJpZiBldmVudHMgPD4gbmlsIHRoZW4gZXZlbnRzLlBvc3RXcml0ZTsiIDw8IGVuZGw7CisgICAgfQorICB9IGVsc2UgaWYgKGV2ZW50c18pIHsKKyAgICBpbmRlbnRfaW1wbChzX3NlcnZpY2VfaW1wbCkgPDwgImlmIGV2ZW50cyA8PiBuaWwgdGhlbiBldmVudHMuT25ld2F5Q29tcGxldGU7IiA8PCBlbmRsOworICB9CisKKyAgaW5kZW50X2Rvd25faW1wbCgpOworICBpbmRlbnRfaW1wbChzX3NlcnZpY2VfaW1wbCkgPDwgImVuZDsiIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zdHJlYW0mIGxvY2FsX3ZhcnMpIHsKKyAgdF90eXBlKiB0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICB3aGlsZSAodHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHlwZSA9ICgodF90eXBlZGVmKil0eXBlKS0+Z2V0X3R5cGUoKTsKKyAgfQorCisgIGlmICh0eXBlLT5pc192b2lkKCkpIHsKKyAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIEN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yAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICBpZiAoYW5zaXN0cl9iaW5hcnlfKSB7CisgICAgICAgICAgICBvdXQgPDwgIlJlYWRBbnNpU3RyaW5nKCk7IjsKKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgb3V0IDw8ICJSZWFkQmluYXJ5KCk7IjsKKyAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgb3V0IDw8ICJSZWFkU3RyaW5nKCk7IjsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgb3V0IDw8ICJSZWFkQm9vbCgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgb3V0IDw8ICJSZWFkQnl0ZSgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgIG91dCA8PCAiUmVhZEkxNigpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAiUmVhZEkzMigpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIG91dCA8PCAiUmVhZEk2NCgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIG91dCA8PCAiUmVhZERvdWJsZSgpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBEZWxwaGkgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgIlJlYWRJMzIoKSI7CisgICAgICBvdXQgPDwgIik7IjsKKyAgICB9CisgICAgb3V0IDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgcHJpbnRmKCJETyBOT1QgS05PVyBIT1cgVE8gREVTRVJJQUxJWkUgRklFTEQgJyVzJyBUWVBFICclcydcbiIsCisgICAgICAgICAgIHRmaWVsZC0+Z2V0X25hbWUoKS5jX3N0cigpLAorICAgICAgICAgICB0eXBlX25hbWUodHlwZSkuY19zdHIoKSk7CisgIH0KK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICBzdHJpbmcgdHlwX25hbWU7CisKKyAgaWYgKHRzdHJ1Y3QtPmlzX3hjZXB0aW9uKCkpIHsKKyAgICB0eXBfbmFtZSA9IHR5cGVfbmFtZSh0c3RydWN0LCB0cnVlLCBmYWxzZSwgdHJ1ZSwgdHJ1ZSk7CisgIH0gZWxzZSB7CisgICAgdHlwX25hbWUgPSB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSwgZmFsc2UpOworICB9CisKKyAgaW5kZW50X2ltcGwob3V0KSA8PCBwcmVmaXggPDwgbmFtZSA8PCAiIDo9ICIgPDwgdHlwX25hbWUgPDwgIi5DcmVhdGU7IiA8PCBlbmRsOworICBpbmRlbnRfaW1wbChvdXQpIDw8IHByZWZpeCA8PCBuYW1lIDw8ICIuUmVhZChpcHJvdCk7IiA8PCBlbmRsOworfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgbG9jYWxfdmFycykgeworCisgIHN0cmluZyBvYmo7CisgIHN0cmluZyBjb3VudGVyOworICBzdHJpbmcgbG9jYWxfdmFyOworCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBvYmogPSB0bXAoIl9tYXAiKTsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBvYmogPSB0bXAoIl9zZXQiKTsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgb2JqID0gdG1wKCJfbGlzdCIpOworICB9CisKKyAgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIGxvY2FsX3ZhciA9IG9iaiArICI6IFRUaHJpZnRNYXA7IjsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBsb2NhbF92YXIgPSBvYmogKyAiOiBUVGhyaWZ0U2V0OyI7CisgIH0gZWxzZSBpZiAodHR5c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gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3N0cmVhbSYgbG9jYWxfdmFycykgeworCisgIHN0cmluZyBrZXkgPSB0bXAoIl9rZXkiKTsKKyAgc3RyaW5nIHZhbCA9IHRtcCgiX3ZhbCIpOworICBzdHJpbmcgbG9jYWxfdmFyOworCisgIHRfZmllbGQgZmtleSh0bWFwLT5nZXRfa2V5X3R5cGUoKSwga2V5KTsKKyAgdF9maWVsZCBmdmFsKHRtYXAtPmdldF92YWxfdHlwZSgpLCB2YWwpOworCisgIGxvY2FsX3ZhcnMgPDwgIiAgIiA8PCBkZWNsYXJlX2ZpZWxkKCZma2V5KSA8PCBlbmRsOworICBsb2NhbF92YXJzIDw8ICIgICIgPDwgZGVjbGFyZV9maWVsZCgmZnZhbCkgPDwgZW5kbDsKKworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsIGlzX3hjZXB0aW9uLCAmZmtleSwgIiIsIGxvY2FsX3ZhcnMpOworICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsIGlzX3hjZXB0aW9uLCAmZnZhbCwgIiIsIGxvY2FsX3ZhcnMpOworCisgIGluZGVudF9pbXBsKG91dCkgPDwgcHJlZml4IDw8ICIuQWRkT3JTZXRWYWx1ZSggIiA8PCBrZXkgPDwgIiwgIiA8PCB2YWwgPDwgIik7IiA8PCBlbmRsOworfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc3RyZWFtJiBsb2NhbF92YXJzKSB7CisgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICB0X2ZpZWxkIGZlbGVtKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgZWxlbSk7CisgIGxvY2FsX3ZhcnMgPDwgIiAgIiA8PCBkZWNsYXJlX2ZpZWxkKCZmZWxlbSkgPDwgZW5kbDsKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCBpc194Y2VwdGlvbiwgJmZlbGVtLCAiIiwgbG9jYWxfdmFycyk7CisgIGluZGVudF9pbXBsKG91dCkgPDwgcHJlZml4IDw8ICIuQWRkKCIgPDwgZWxlbSA8PCAiKTsiIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc3RyZWFtJiBsb2NhbF92YXJzKSB7CisgIHN0cmluZyBlbGVtID0gdG1wKCJfZWxlbSIpOworICB0X2ZpZWxkIGZlbGVtKHRsaXN0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOworICBsb2NhbF92YXJzIDw8ICIgICIgPDwgZGVjbGFyZV9maWVsZCgmZmVsZW0pIDw8IGVuZGw7CisgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgaXNfeGNlcHRpb24sICZmZWxlbSwgIiIsIGxvY2FsX3ZhcnMpOworICBpbmRlbnRfaW1wbChvdXQpIDw8IHByZWZpeCA8PCAiLkFkZCgiIDw8IGVsZW0gPDwgIik7IiA8PCBlbmRsOworfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvc3RyZWFtJiBsb2NhbF92YXJzKSB7CisgICh2b2lkKWxvY2FsX3ZhcnM7CisKKyAgdF90eXBlKiB0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICB3aGlsZSAodHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdHlwZSA9ICgodF90eXBlZGVmKil0eXBlKS0+Z2V0X3R5cGUoKTsKKyAgfQorCisgIHN0cmluZyBuYW1lID0gcHJlZml4ICsgcHJvcF9uYW1lKHRmaWVsZCwgaXNfeGNlcHRpb24pOworCisgIGlmICh0eXBlLT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zaVN0cmluZygiOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvdXQgPDwgIldyaXRlQmluYXJ5KCI7CisgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAiV3JpdGVTdHJpbmcoIjsKKyAgICAgICAgfQorICAgICAgICBvdXQgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgb3V0IDw8ICJXcml0ZUJvb2woIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgb3V0IDw8ICJXcml0ZUJ5dGUoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgIG91dCA8PCAiV3JpdGVJMTYoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIG91dCA8PCAiV3JpdGVJMzIoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIG91dCA8PCAiV3JpdGVJNjQoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIG91dCA8PCAiV3JpdGVEb3VibGUoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBEZWxwaGkgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgIldyaXRlSTMyKFN5c3RlbS5JbnRlZ2VyKCIgPDwgbmFtZSA8PCAiKSk7IjsKKyAgICB9CisgICAgb3V0IDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgcHJpbnRmKCJETyBOT1QgS05PVyBIT1cgVE8gU0VSSUFMSVpFICclcyVzJyBUWVBFICclcydcbiIsCisgICAgICAgICAgIHByZWZpeC5jX3N0cigpLAorICAgICAgICAgICB0ZmllbGQtPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgdHlwZV9uYW1lKHR5cGUpLmNfc3RyKCkpOworICB9Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zdHJlYW0mIGxvY2FsX3ZhcnMpIHsKKyAgKHZvaWQpbG9jYWxfdmFyczsKKyAgKHZvaWQpdHN0cnVjdDsKKyAgb3V0IDw8IGluZGVudF9pbXBsKCkgPDwgcHJlZml4IDw8ICIuV3JpdGUob3Byb3QpOyIgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3N0cmVhbSYgbG9jYWxfdmFycykgeworICBzdHJpbmcgb2JqOworICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgb2JqID0gdG1wKCJtYXAiKTsKKyAgICBsb2NhbF92YXJzIDw8ICIgICIgPDwgb2JqIDw8ICIgOiBUVGhyaWZ0TWFwOyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfaW1wbChvdXQpIDw8ICJUaHJpZnQuUHJvdG9jb2wuSW5pdCggIiA8PCBvYmogPDwgIiwgIgorICAgICAgICAgICAgICAgICAgICAgPDwgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X2tleV90eXBlKCkpIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgICAgIDw8IHR5cGVfdG9fZW51bSgoKHRfbWFwKil0dHlwZSktPmdldF92YWxfdHlwZSgpKSA8PCAiLCAiIDw8IHByZWZpeAorICAgICAgICAgICAgICAgICAgICAgPDwgIi5Db3VudCk7IiA8PCBlbmRsOworICAgIGluZGVudF9pbXBsKG91dCkgPDwgIm9wcm90LldyaXRlTWFwQmVnaW4oICIgPDwgb2JqIDw8ICIpOyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBvYmogPSB0bXAoInNldF8iKTsKKyAgICBsb2NhbF92YXJzIDw8ICIgICIgPDwgb2JqIDw8ICIgOiBUVGhyaWZ0U2V0OyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfaW1wbChvdXQpIDw8ICJUaHJp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LCBwcmVmaXgsIGxvY2FsX3ZhcnMpOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvdXQsIGlzX3hjZXB0aW9uLCAodF9zZXQqKXR0eXBlLCBpdGVyLCBsb2NhbF92YXJzKTsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvdXQsIGlzX3hjZXB0aW9uLCAodF9saXN0Kil0dHlwZSwgaXRlciwgbG9jYWxfdmFycyk7CisgIH0KKworICBpbmRlbnRfZG93bl9pbXBsKCk7CisgIGluZGVudF9pbXBsKG91dCkgPDwgImVuZDsiIDw8IGVuZGw7CisKKyAgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIGluZGVudF9pbXBsKG91dCkgPDwgIm9wcm90LldyaXRlTWFwRW5kKCk7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGluZGVudF9pbXBsKG91dCkgPDwgIm9wcm90LldyaXRlU2V0RW5kKCk7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICBpbmRlbnRfaW1wbChvdXQpIDw8ICJvcHJvdC5Xcml0ZUxpc3RFbmQoKTsiIDw8IGVuZGw7CisgIH0KK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3N0cmVhbSYgbG9jYWxfdmFycykgeworICB0X2ZpZWxkIGtmaWVsZCh0bWFwLT5nZXRfa2V5X3R5cGUoKSwgaXRlcik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsIGlzX3hjZXB0aW9uLCAma2ZpZWxkLCAiIiwgbG9jYWxfdmFycyk7CisgIHRfZmllbGQgdmZpZWxkKHRtYXAtPmdldF92YWxfdHlwZSgpLCBtYXAgKyAiWyIgKyBpdGVyICsgIl0iKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgaXNfeGNlcHRpb24sICZ2ZmllbGQsICIiLCBsb2NhbF92YXJzKTsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3N0cmVhbSYgbG9jYWxfdmFycykgeworICB0X2ZpZWxkIGVmaWVsZCh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGl0ZXIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCBpc194Y2VwdGlvbiwgJmVmaWVsZCwgIiIsIGxvY2FsX3ZhcnMpOworfQorCit2b2lkIHRfZGVscGhpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3N0cmVhbSYgbG9jYWxfdmFycykgeworICB0X2ZpZWxkIGVmaWVsZCh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgaXNfeGNlcHRpb24sICZlZmllbGQsICIiLCBsb2NhbF92YXJzKTsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX3Byb3BlcnR5KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc1B1YmxpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uKSB7CisgIGdlbmVyYXRlX2RlbHBoaV9wcm9wZXJ0eShvdXQsIGlzX3hjZXB0aW9uLCB0ZmllbGQsIGlzUHVibGljLCAiR2V0Iik7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHkob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHN0cnVjdF9pc194Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzUHVibGljLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBmaWVsZFByZWZpeCkgeworICAodm9pZClpc1B1YmxpYzsKKworICB0X3R5cGUqIGZ0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICBib29sIGlzX3hjZXB0aW9uID0gZnR5cGUtPmlzX3hjZXB0aW9uKCk7CisgIGdlbmVyYXRlX2RlbHBoaV9kb2Mob3V0LCB0ZmllbGQpOworICBpbmRlbnQob3V0KSA8PCAicHJvcGVydHkgIiA8PCBwcm9wX25hbWUodGZpZWxkLCBzdHJ1Y3RfaXNfeGNlcHRpb24pIDw8ICI6ICIKKyAgICAgICAgICAgICAgPDwgdHlwZV9uYW1lKGZ0eXBlLCBmYWxzZSwgdHJ1ZSwgaXNfeGNlcHRpb24sIHRydWUpIDw8ICIgcmVhZCAiCisgICAgICAgICAgICAgIDw8IGZpZWxkUHJlZml4ICsgcHJvcF9uYW1lKHRmaWVsZCwgc3RydWN0X2lzX3hjZXB0aW9uKSA8PCAiIHdyaXRlIFNldCIKKyAgICAgICAgICAgICAgPDwgcHJvcF9uYW1lKHRmaWVsZCwgc3RydWN0X2lzX3hjZXB0aW9uKSA8PCAiOyIgPDwgZW5kbDsKK30KKworc3RkOjpzdHJpbmcgdF9kZWxwaGlfZ2VuZXJhdG9yOjpwcm9wX25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gICAgICAgICAgICAgICAgICAgICBib29sIGJfY2xzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYl9ub19wb3N0Zml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYl9leGNlcHRpb25fZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGJfZnVsbF9leGNlcHRpb25fZmFjdG9yeSkgeworCisgIGlmICh0dHlwZS0+aXNfdHlwZWRlZigpKSB7CisgICAgdF90eXBlZGVmKiB0ZGVmID0gKHRfdHlwZWRlZiopdHR5cGU7CisgICAgaWYgKHRkZWYtPmlzX2ZvcndhcmRfdHlwZWRlZigpKSB7IC8vIGZvcndhcmQgdHlwZXMgYWNjb3JkaW5nIHRvIFRIUklGVC0yNDIxCisgICAgICBpZiAodGRlZi0+Z2V0X3R5cGUoKSAhPSBOVUxMKSB7CisgICAgICAgIHJldHVybiB0eXBlX25hbWUodGRlZi0+Z2V0X3R5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBiX2NscywKKyAgICAgICAgICAgICAgICAgICAgICAgICBiX25vX3Bvc3RmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgYl9leGNlcHRpb25fZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBiX2Z1bGxfZXhjZXB0aW9uX2ZhY3RvcnkpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgdGhyb3cgInVucmVzb2x2ZWQgZm9yd2FyZCBkZWNsYXJhdGlvbjogIiArIHRkZWYtPmdldF9zeW1ib2xpYygpOworICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICByZXR1cm4gbm9ybWFsaXplX25hbWUoIlQiICsgdGRlZi0+Z2V0X3N5bWJvbGljKCkpOworICAgIH0KKyAgfQorCisgIHN0cmluZyB0eXBfbm07CisKKyAgc3RyaW5nIHNfZmFjdG9yeTsKKworICBpZiAodHR5cGUtPml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cm4gcmVzdWx0OworfQorCitzdHJpbmcgdF9kZWxwaGlfZ2VuZXJhdG9yOjpmdW5jdGlvbl9zaWduYXR1cmUodF9mdW5jdGlvbiogdGZ1bmN0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZm9yX2FzeW5jLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGZ1bGxfY2xzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24pIHsKKyAgdF90eXBlKiB0dHlwZSA9IHRmdW5jdGlvbi0+Z2V0X3JldHVybnR5cGUoKTsKKyAgc3RyaW5nIHByZWZpeDsKKyAgaWYgKGZ1bGxfY2xzID09ICIiKSB7CisgICAgcHJlZml4ID0gIiI7CisgIH0gZWxzZSB7CisgICAgcHJlZml4ID0gZnVsbF9jbHMgKyAiLiI7CisgIH0KKworICBpZiggZm9yX2FzeW5jKSB7CisgICAgaWYgKGlzX3ZvaWQodHR5cGUpKSB7CisgICAgICByZXR1cm4gImZ1bmN0aW9uICIgKyBwcmVmaXggKyBub3JtYWxpemVfbmFtZSh0ZnVuY3Rpb24tPmdldF9uYW1lKCksIHRydWUsIGlzX3hjZXB0aW9uKSArICJBc3luYygiCisgICAgICAgICAgICAgKyBhcmd1bWVudF9saXN0KHRmdW5jdGlvbi0+Z2V0X2FyZ2xpc3QoKSkgKyAiKTogSUZ1dHVyZTxJbnRlZ2VyPjsiOyAgLy8gbm8gSUZ1dHVyZTx2b2lkPiBpbiBEZWxwaGkKKyAgICB9IGVsc2UgeworICAgICAgcmV0dXJuICJmdW5jdGlvbiAiICsgcHJlZml4ICsgbm9ybWFsaXplX25hbWUodGZ1bmN0aW9uLT5nZXRfbmFtZSgpLCB0cnVlLCBpc194Y2VwdGlvbikgKyAiQXN5bmMoIgorICAgICAgICAgICAgICsgYXJndW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AgaWYgKGZpcnN0KSB7CisgICAgICBmaXJzdCA9IGZhbHNlOworICAgIH0gZWxzZSB7CisgICAgICBsaW5lICs9ICI7IjsKKyAgICB9CisKKyAgICBpZiAobGluZS5zaXplKCkgPiA4MCkgeworICAgICAgaWYgKGZpcnN0bGluZSkgeworICAgICAgICByZXN1bHQgPDwgZW5kbCA8PCBuZXdsaW5lX2luZGVudDsKKyAgICAgICAgZmlyc3RsaW5lID0gZmFsc2U7CisgICAgICB9CisgICAgICByZXN1bHQgPDwgbGluZSA8PCBlbmRsOworICAgICAgbGluZSA9IG5ld2xpbmVfaW5kZW50OworICAgIH0gZWxzZSBpZiAobGluZS5zaXplKCkgPiAwKSB7CisgICAgICBsaW5lICs9ICIgIjsKKyAgICB9CisKKyAgICB0dCA9ICgqZl9pdGVyKS0+Z2V0X3R5cGUoKTsKKyAgICBsaW5lICs9IGlucHV0X2FyZ19wcmVmaXgodHQpOyAvLyBjb25zdD8KKyAgICBsaW5lICs9IGNvbnN0cnVjdG9yX3BhcmFtX25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSArICI6ICIKKyAgICAgICAgICAgICsgdHlwZV9uYW1lKHR0LCBmYWxzZSwgdHJ1ZSwgdHQtPmlzX3hjZXB0aW9uKCksIHRydWUpOworICB9CisKKyAgaWYgKGxpbmUuc2l6ZSgpID4gMCkgeworICAgIHJlc3VsdCA8PCBsaW5lOworICB9CisKKyAgc3RyaW5nIHJlc3VsdF9zdHI7CisKKyAgaWYgKGZpcnN0bGluZSkgeworICAgIHJlc3VsdF9zdHIgPSAiICIgKyByZXN1bHQuc3RyKCk7CisgIH0gZWxzZSB7CisgICAgcmVzdWx0X3N0ciA9IHJlc3VsdC5zdHIoKTsKKyAgfQorCisgIHJldHVybiByZXN1bHRfc3RyOworfQorCitzdHJpbmcgdF9kZWxwaGlfZ2VuZXJhdG9yOjp0eXBlX3RvX2VudW0odF90eXBlKiB0eXBlKSB7CisgIHdoaWxlICh0eXBlLT5pc190e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AgICAgcmV0dXJuICJGYWxzZSI7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgIHJldHVybiAiMCI7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICByZXR1cm4gIjAuMCI7CisgICAgfQorICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkgeworICAgIHJldHVybiAiVCIgKyB0eXBlLT5nZXRfbmFtZSgpICsgIigwKSI7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIHJldHVybiAibmlsIjsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19tYXAoKSkgeworICAgIHJldHVybiAibmlsIjsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19zZXQoKSkgeworICAgIHJldHVybiAibmlsIjsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19saXN0KCkpIHsKKyAgICByZXR1cm4gIm5pbCI7CisgIH0KKworICB0aHJvdyAiSU5WQUxJRCBUWVBFIElOIHR5cGVfdG9fZW51bTogIiArIHR5cGUtPmdldF9uYW1lKCk7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHlfd3JpdGVyX2RlZmluaXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ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hpX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVscGhpX2lzc2V0X3JlYWRlcl9kZWZpbml0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hjZXB0aW9uKSB7CisgIGluZGVudChvdXQpIDw8ICJmdW5jdGlvbiBHZXRfX2lzc2V0XyIgPDwgcHJvcF9uYW1lKHRmaWVsZCwgaXNfeGNlcHRpb24pIDw8ICI6IFN5c3RlbS5Cb29sZWFuOyIgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2RlbHBoaV9jbGVhcl91bmlvbl92YWx1ZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBmaWVsZFByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbl9jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc191bmlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbl9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB4Y2VwdGlvbl9mYWN0b3J5X25hbWUpIHsKKyAgKHZvaWQpY2xzX3ByZWZpeDsKKyAgKHZvaWQpbmFtZTsKKyAgKHZvaWQpdHlwZTsKKyAgKHZvaWQpaXNfdW5pb247CisgICh2b2lkKWlzX3hjZXB0aW9uX2ZhY3Rvcnk7CisgICh2b2lkKXhjZXB0aW9uX2ZhY3RvcnlfbmFtZTsKKworICB0X3R5cGUqIGZ0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICBib29sIGlzX3hjZXB0aW9uID0gZnR5cGUtPmlzX3hjZXB0aW9uKCk7CisKKyAgaW5kZW50X2ltcGwob3V0KSA8PCAiaWYgRl9faXNzZXRfIiA8PCBwcm9wX25hbWUodGZpZWxkLCBpc194Y2VwdGlvbl9jbGFzcykgPDwgIiB0aGVuIGJlZ2luIgorICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgIGluZGVudF91cF9pbXBsKCk7CisgIGluZGVudF9pbXBsKG91dCkgPDwgIkZfX2lzc2V0XyIgPDwgcHJvcF9uYW1lKHRmaWVsZCwgaXNfeGNlcHRpb25fY2xhc3MpIDw8ICIgOj0gRmFsc2U7IiA8PCBlbmRsOworICBpbmRlbnRfaW1wbChvdXQpIDw8IGZpZWxkUHJlZml4IDw8IHByb3BfbmFtZSh0ZmllbGQsIGlzX3hjZXB0aW9uX2NsYXNzKSA8PCAiIDo9ICIKKyAgICAgICAgICAgICAgICAgICA8PCAiRGVmYXVsdCggIiA8PCB0eXBlX25hbWUoZnR5cGUsIGZhbHNlLCB0cnVlLCBpc194Y2VwdGlvbiwgdHJ1ZSkgPDwgIik7IgorICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgIGluZGVudF9kb3duX2ltcGwoKTsKKyAgaW5kZW50X2ltcGwob3V0KSA8PCAiZW5kOyIgPDwgZW5kbDsKK30KKwordm9pZCB0X2RlbHBoaV9nZW5lcmF0b3I6OmdlbmVyYXRlX2RlbHBoaV9wcm9wZXJ0eV93cml0ZXJfaW1wbChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBmaWVsZFByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbl9jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc191bmlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc194Y2VwdGlvbl9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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KworICBpZiAoaXNfeGNlcHRpb25fY2xhc3MgJiYgKCFpc194Y2VwdGlvbl9mYWN0b3J5KSkgeworICAgIGluZGVudF9pbXBsKG91dCkgPDwgeGNlcHRpb25fZmFjdG9yeV9uYW1lIDw8ICIuIiA8PCBwcm9wX25hbWUodGZpZWxkLCBpc194Y2VwdGlvbl9jbGFzcykKKyAgICAgICAgICAgICAgICAgICAgIDw8ICIgOj0gVmFsdWU7IiA8PCBlbmRsOworICB9CisKKyAgaW5kZW50X2Rvd25faW1wbCgpOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJlbmQ7IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfcHJvcGVydHlfcmVhZGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb25fY2xhc3MpIHsKKyAgKHZvaWQpdHlwZTsKKworICB0X3R5cGUqIGZ0eXBlID0gdGZpZWxkLT5nZXRfdHlwZSgpOworICBib29sIGlzX3hjZXB0aW9uID0gZnR5cGUtPmlzX3hjZXB0aW9uKCk7CisKKyAgaW5kZW50X2ltcGwob3V0KSA8PCAiZnVuY3Rpb24gIiA8PCBjbHNfcHJlZml4IDw8IG5hbWUgPDwgIi4iCisgICAgICAgICAgICAgICAgICAgPDwgIkdldCIgPDwgcHJvcF9uYW1lKHRmaWVsZCwgaXNfeGNlcHRpb25fY2xhc3MpIDw8ICI6ICIKKyAgICAgICAgICAgICAgICAgICA8PCB0eXBlX25hbWUoZnR5cGUsIGZhbHNlLCB0cnVlLCBpc194Y2VwdGlvbiwgdHJ1ZSkgPDwgIjsiIDw8IGVuZGw7CisgIGluZGVudF9pbXBsKG91dCkgPDwgImJlZ2luIiA8PCBlbmRsOworICBpbmRlbnRfdXBfaW1wbCgpOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJSZXN1bHQgOj0gIiA8PCBmaWVsZFByZWZpeCA8PCBwcm9wX25hbWUodGZpZWxkLCBpc194Y2VwdGlvbl9jbGFzcykgPDwgIjsiCisgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd25faW1wbCgpOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJlbmQ7IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfaXNzZXRfcmVhZGVyX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjbHNfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmllbGRQcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24pIHsKKyAgKHZvaWQpdHlwZTsKKworICBzdHJpbmcgaXNzZXRfbmFtZSA9ICJfX2lzc2V0XyIgKyBwcm9wX25hbWUodGZpZWxkLCBpc194Y2VwdGlvbik7CisgIGluZGVudF9pbXBsKG91dCkgPDwgImZ1bmN0aW9uICIgPDwgY2xzX3ByZWZpeCA8PCBuYW1lIDw8ICIuIgorICAgICAgICAgICAgICAgICAgIDw8ICJHZXQiIDw8IGlzc2V0X25hbWUgPDwgIjogU3lzdGVtLkJvb2xlYW47IiA8PCBlbmRsOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJiZWdpbiIgPDwgZW5kbDsKKyAgaW5kZW50X3VwX2ltcGwoKTsKKyAgaW5kZW50X2ltcGwob3V0KSA8PCAiUmVzdWx0IDo9ICIgPDwgZmllbGRQcmVmaXggPDwgaXNzZXRfbmFtZSA8PCAiOyIgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd25faW1wbCgpOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJlbmQ7IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfY3JlYXRlX2V4Y2VwdGlvbl9pbXBsKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjbHNfcHJlZml4L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ICAgICAgICBzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24pIHsKKworICBvc3RyaW5nc3RyZWFtIGxvY2FsX3ZhcnM7CisgIG9zdHJpbmdzdHJlYW0gY29kZV9ibG9jazsKKworICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBmaWVsZHMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBmX2l0ZXI7CisKKyAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgImJlZ2luIiA8PCBlbmRsOworICBpbmRlbnRfdXBfaW1wbCgpOworCisgIGluZGVudF9pbXBsKGxvY2FsX3ZhcnMpIDw8ICJ0cmFja2VyIDogSVByb3RvY29sUmVjdXJzaW9uVHJhY2tlcjsiIDw8IGVuZGw7CisgIGluZGVudF9pbXBsKGNvZGVfYmxvY2spIDw8ICJ0cmFja2VyIDo9IGlwcm90Lk5leHRSZWN1cnNpb25MZXZlbDsiIDw8IGVuZGw7CisKKyAgLy8gbG9jYWwgYm9vbHMgZm9yIHJlcXVpcmVkIGZpZWxkcworICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikgeworICAgIGlmICgoKmZfaXRlciktPmdldF9yZXEoKSA9PSB0X2ZpZWxkOjpUX1JFUVVJUkVEKSB7CisgICAgICBpbmRlbnRfaW1wbChsb2NhbF92YXJzKSA8PCAiX3JlcV9pc3NldF8iIDw8IHByb3BfbmFtZSgqZl9pdGVyLCBpc19leGNlcHRpb24pIDw8ICIgOiBTeXN0ZW0uQm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wgIiA6PSBUUlVFOyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgfQorCisgICAgaW5kZW50X2Rvd25faW1wbCgpOworCisgICAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgImVuZCBlbHNlIGJlZ2luIiA8PCBlbmRsOworICAgIGluZGVudF91cF9pbXBsKCk7CisgICAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgIlRQcm90b2NvbFV0aWwuU2tpcChpcHJvdCwgZmllbGRfLlR5cGVfKTsiIDw8IGVuZGw7CisgICAgaW5kZW50X2Rvd25faW1wbCgpOworICAgIGluZGVudF9pbXBsKGNvZGVfYmxvY2spIDw8ICJlbmQ7IiA8PCBlbmRsOworICAgIGluZGVudF9kb3duX2ltcGwoKTsKKyAgICBpbmRlbnRfaW1wbChjb2RlX2Jsb2NrKSA8PCAiZW5kIjsKKyAgfQorCisgIGlmICghZmlyc3QpIHsKKyAgICBjb2RlX2Jsb2NrIDw8IGVuZGw7CisgICAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgImVsc2UgYmVnaW4iIDw8IGVuZGw7CisgICAgaW5kZW50X3VwX2ltcGwoKTsKKyAgfQorCisgIGluZGVudF9pbXBsKGNvZGVfYmxvY2spIDw8ICJUUHJvdG9jb2xVdGlsLlNraXAoaXByb3QsIGZpZWxkXy5UeXBlXyk7IiA8PCBlbmRsOworCisgIGlmICghZmlyc3QpIHsKKyAgICBpbmRlbnRfZG93bl9pbXBsKCk7CisgICAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgImVuZDsiIDw8IGVuZGw7CisgICAgaW5kZW50X2Rvd25faW1wbCgpOworICAgIGluZGVudF9pbXBsKGNvZGVfYmxvY2spIDw8ICJlbmQ7IiA8PCBlbmRsOworICB9CisKKyAgaW5kZW50X2ltcGwoY29kZV9ibG9jaykgPDwgImlwcm90LlJlYWRGaWVsZEVuZDsiIDw8IGVuZGw7CisKKyAgaW5k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7IiA8PCBlbmRsIDw8IGVuZGw7CisKKyAgc3RyaW5nIGNsc19ubTsKKworICBjbHNfbm0gPSB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSwgZmFsc2UsIGlzX2V4Y2VwdGlvbiwgaXNfZXhjZXB0aW9uKTsKKworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJwcm9jZWR1cmUgIiA8PCBjbHNfcHJlZml4IDw8IGNsc19ubSA8PCAiLlJlYWQoIGNvbnN0IGlwcm90OiBJUHJvdG9jb2wpOyIKKyAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICBpbmRlbnRfaW1wbChvdXQpIDw8ICJ2YXIiIDw8IGVuZGw7CisgIGluZGVudF91cF9pbXBsKCk7CisgIGluZGVudF9pbXBsKG91dCkgPDwgImZpZWxkXyA6IFRUaHJpZnRGaWVsZDsiIDw8IGVuZGw7CisgIGluZGVudF9pbXBsKG91dCkgPDwgInN0cnVjIDogVFRocmlmdFN0cnVjdDsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duX2ltcGwoKTsKKyAgb3V0IDw8IGxvY2FsX3ZhcnMuc3RyKCkgPDwgZW5kbDsKKyAgb3V0IDw8IGNvZGVfYmxvY2suc3RyKCk7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfc3RydWN0X3Jlc3VsdF93cml0ZXJfaW1wbChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGNsc19wcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24p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ltcGwoKTsKKyAgb3V0IDw8IGNvZGVfYmxvY2suc3RyKCk7Cit9CisKK3ZvaWQgdF9kZWxwaGlfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWxwaGlfc3RydWN0X3Rvc3RyaW5nX2ltcGwob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgY2xzX3ByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3hfZmFjdG9yeSkgeworCisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIGZpZWxkcyA9IHRzdHJ1Y3QtPmdldF9tZW1iZXJzKCk7CisgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIGZfaXRlcjsKKworICBzdHJpbmcgY2xzX25tOworCisgIGlmIChpc19leGNlcHRpb24pIHsKKyAgICBjbHNfbm0gPSB0eXBlX25hbWUodHN0cnVjdCwgdHJ1ZSwgKCFpc194X2ZhY3RvcnkpLCBpc194X2ZhY3RvcnksIHRydWUpOworICB9IGVsc2UgeworICAgIGNsc19ubSA9IHR5cGVfbmFtZSh0c3RydWN0LCB0cnVlLCBmYWxzZSk7CisgIH0KKworICBzdHJpbmcgdG1wX3NiID0gdG1wKCJfc2IiKTsKKyAgc3RyaW5nIHRtcF9maXJzdCA9IHRtcCgiX2ZpcnN0Iik7CisgIGJvb2wgdXNlRmlyc3RGbGFnID0gZmFsc2U7CisKKyAgaW5kZW50X2ltc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yAgc3RyaW5nIHJlc3VsdCA9ICIiOworICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGluY2x1ZGVzLnNpemUoKTsgKytpKSB7CisgICAgcmVzdWx0ICs9ICItaW5jbHVkZShcIiIgKyBtYWtlX3NhZmVfZm9yX21vZHVsZV9uYW1lKGluY2x1ZGVzW2ldLT5nZXRfbmFtZSgpKQorICAgICAgICAgICAgICArICJfdHlwZXMuaHJsXCIpLlxuIjsKKyAgfQorICBpZiAoaW5jbHVkZXMuc2l6ZSgpID4gMCkgeworICAgIHJlc3VsdCArPSAiXG4iOworICB9CisgIHJldHVybiByZXN1bHQ7Cit9CisKKy8qKgorICogQXV0b2dlbidkIGNvbW1lbnQKKyAqLworc3RyaW5nIHRfZXJsX2dlbmVyYXRvcjo6ZXJsX2F1dG9nZW5fY29tbWVudCgpIHsKKyAgcmV0dXJuIHN0ZDo6c3RyaW5nKCIlJVxuIikgKyAiJSUgQXV0b2dlbmVyYXRlZCBieSBUaHJpZnQgQ29tcGlsZXIgKCIgKyBUSFJJRlRfVkVSU0lPTiArICIpXG4iCisgICAgICAgICArICIlJVxuIiArICIlJSBETyBOT1QgRURJVCBVTkxFU1MgWU9VIEFSRSBTVVJFIFRIQVQgWU9VIEtOT1cgV0hBVCBZT1UgQVJFIERPSU5HXG4iCisgICAgICAgICArICIlJVxuIjsKK30KKworLyoqCisgKiBDb21tZW50IG91dCB0ZXh0CisgKi8KKworc3RyaW5nIHRfZXJsX2dlbmVyYXRvcjo6Y29tbWVudChzdHJpbmcgaW4pIHsKKyAgc2l6ZV90IHBvcyA9IDA7CisgIGluLmluc2VydChwb3MsICIlJSAiKTsKKyAgd2hpbGUgKChwb3MgPSBpbi5maW5kX2ZpcnN0X29mKCdcbicsIHBvcykpICE9IHN0cmluZzo6bnBvcykgeworICAgIGluLmluc2VydCgrK3BvcywgIiUlICIpOworICB9CisgIHJldHVybiBpbjsKK30KKworLyoqCisgKiBQcmludHMgc3RhbmRhcmQgdGhyaWZ0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LmFwcGVuZChyZXMtPnNlY29uZCk7CisgICAgfSBlbHNlIHsKKyAgICAgIHJlc3VsdC5wdXNoX2JhY2soKml0KTsKKyAgICB9CisgIH0KKyAgcmV0dXJuIHJlc3VsdDsKK30KKwordm9pZCB0X2dlbmVyYXRvcjo6Z2VuZXJhdGVfY29uc3RzKHZlY3Rvcjx0X2NvbnN0Kj4gY29uc3RzKSB7CisgIHZlY3Rvcjx0X2NvbnN0Kj46Oml0ZXJhdG9yIGNfaXRlcjsKKyAgZm9yIChjX2l0ZXIgPSBjb25zdHMuYmVnaW4oKTsgY19pdGVyICE9IGNvbnN0cy5lbmQoKTsgKytjX2l0ZXIpIHsKKyAgICBnZW5lcmF0ZV9jb25zdCgqY19pdGVyKTsKKyAgfQorfQorCit2b2lkIHRfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kb2NzdHJpbmdfY29tbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGNvbW1lbnRfc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGxpbmVfcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiBjb250ZW50cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cmluZyYgY29tbWVudF9lbmQpIHsKKyAgaWYgKCFjb21tZW50X3N0YXJ0LmVtcHR5KCkpCisgICAgaW5kZW50KG91dCkgPDwgY29tbWVudF9zdGFydDsKKyAgc3RyaW5nc3RyZWFtIGRvY3MoY29udGVudHMsIGlvc19iYXNlOjppbik7CisgIHdoaWxlICghKGRvY3MuZW9mKCkgfHwgZG9jcy5mYWlsKCkpKSB7CisgICAgY2hhciBsaW5lWzEwMjRdOworICAgIGRvY3MuZ2V0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RfVkVSU0lPTiArICIpIjsKKyAgfQorCisgIC8qKgorICAgKiBJbmRlbnRhdGlvbiBsZXZlbCBtb2RpZmllcnMKKyAgICovCisKKyAgdm9pZCBpbmRlbnRfdXAoKSB7ICsraW5kZW50XzsgfQorCisgIHZvaWQgaW5kZW50X2Rvd24oKSB7IC0taW5kZW50XzsgfQorCisgIC8qKgorICAqIEluZGVudGF0aW9uIHZhbGlkYXRpb24gaGVscGVyCisgICovCisgIGludCBpbmRlbnRfY291bnQoKSB7IHJldHVybiBpbmRlbnRfOyB9CisKKyAgdm9pZCBpbmRlbnRfdmFsaWRhdGUoIGludCBleHBlY3RlZCwgY29uc3QgY2hhciAqIGZ1bmNfbmFtZSkgeworICAgIGlmIChpbmRlbnRfICE9IGV4cGVjdGVkKSB7IAorICAgICAgcHZlcmJvc2UoIldyb25nIGluZGVudCBjb3VudCBpbiAlczogZGlmZmVyZW5jZSA9ICVpIFxuIiwgZnVuY19uYW1lLCAoZXhwZWN0ZWQgLSBpbmRlbnRfKSk7CisgICAgfQorICB9CisKKyAgLyoqCisgICAqIEluZGVudGF0aW9uIHByaW50IGZ1bmN0aW9uCisgICAqLworICBzdGQ6OnN0cmluZyBpbmRlbnQoKSB7CisgICAgc3RkOjpzdHJpbmcgaW5kID0gIiI7CisgICAgaW50IGk7CisgICAgZm9yIChpID0gMDsgaSA8IGluZGVudF87ICsraSkgeworICAgICAgaW5kICs9IGluZGVudF9zdHIoKTsKKyAgICB9CisgICAgcmV0dXJuIGluZDsKKyAgfQorCisgIC8qKgorICAgKiBJbmRlbnRhdGlvbiB1dGlsaXR5IHdyYXBwZXIKKyAgICovCisgIHN0ZDo6b3N0cmVhbSYgaW5kZW50KHN0ZDo6b3N0cmVhbSYgb3MpIHsgcmV0dXJuIG9zIDw8IGluZGVudCgpOyB9CisKKyAgLyoqCisgICAqIENhcGl0YWxpemF0aW9uIGhlbHBlcnMKKyAgICovCisgIHN0ZDo6c3RyaW5nIGNhcGl0YWxpemUoc3RkO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6ZSgpOyArK2kpIHsKKyAgICAgIGlmIChpc3VwcGVyKGluW2ldKSkgeworICAgICAgICBpbltpXSA9IHRvbG93ZXIoaW5baV0pOworICAgICAgICBpbi5pbnNlcnQoaSwgIl8iKTsKKyAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIGluOworICB9CisKKyAgLyoqCisgICAgKiBUcmFuc2Zvcm1zIGEgc3RyaW5nIHdpdGggd29yZHMgc2VwYXJhdGVkIGJ5IHVuZGVyc2NvcmVzIHRvIGEgY2FtZWwgY2FzZSBlcXVpdmFsZW50CisgICAgKiBlLmcuIGFfbXVsdGlfd29yZCAtPiBhTXVsdGlXb3JkCisgICAgKiAgICAgIHNvbWVfbmFtZSAgICAtPiAgc29tZU5hbWUKKyAgICAqICAgICAgbmFtZSAgICAgICAgIC0+ICBuYW1lCisgICAgKi8KKyAgc3RkOjpzdHJpbmcgY2FtZWxjYXNlKHN0ZDo6c3RyaW5nIGluKSB7CisgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG91dDsKKyAgICBib29sIHVuZGVyc2NvcmUgPSBmYWxzZTsKKworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgaW4uc2l6ZSgpOyBpKyspIHsKKyAgICAgIGlmIChpbltpXSA9PSAnXycpIHsKKyAgICAgICAgdW5kZXJzY29yZSA9IHRydWU7CisgICAgICAgIGNvbnRpbnVlOworICAgICAgfQorICAgICAgaWYgKHVuZGVyc2NvcmUpIHsKKyAgICAgICAgb3V0IDw8IChjaGFyKXRvdXBwZXIoaW5baV0pOworICAgICAgICB1bmRlcnNjb3JlID0gZmFsc2U7CisgICAgICAgIGNvbnRpbnVlOworICAgICAgfQorICAgICAgb3V0IDw8IGluW2ldOworICAgIH0KKworICAgIHJldHVybiBvdXQuc3RyKCk7CisgIH0KKworICBjb25zdCBzdGQ6OnN0cmluZyBlbWl0X2RvdWJsZV9hc19zdHJpbmcoY29uc3QgZG91YmxlIHZhbHVlKSB7CisgICAgICBzdGQ6OnN0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5KCk7CisgIHRfZ2VuZXJhdG9yX3JlZ2lzdHJ5KGNvbnN0IHRfZ2VuZXJhdG9yX3JlZ2lzdHJ5Jik7Cit9OworCisjZGVmaW5lIFRIUklGVF9SRUdJU1RFUl9HRU5FUkFUT1IobGFuZ3VhZ2UsIGxvbmdfbmFtZSwgZG9jKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGNsYXNzIHRfIyNsYW5ndWFnZSMjX2dlbmVyYXRvcl9mYWN0b3J5X2ltcGwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICA6IHB1YmxpYyB0X2dlbmVyYXRvcl9mYWN0b3J5X2ltcGw8dF8jI2xhbmd1YWdlIyNfZ2VuZXJhdG9yPiB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHB1YmxpYzogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgdF8jI2xhbmd1YWdlIyNfZ2VuZXJhdG9yX2ZhY3RvcnlfaW1wbCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICA6IHRfZ2VuZXJhdG9yX2ZhY3RvcnlfaW1wbDx0XyMjbGFuZ3VhZ2UjI19nZW5lcmF0b3I+KCNsYW5ndWFnZSwgbG9uZ19uYW1lLCBkb2MpIHt9ICAgICAgICAgICBcCisgIH07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHN0YXRpYyB0XyMjbGFuZ3VhZ2UjI19nZW5lcmF0b3JfZmFjdG9yeV9pbXBsIF9yZWdpc3RlcmVyOworCisjZW5kaWYKZGlmZiAtLWdpdCBhL2NvbXB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HVlKiB2YWx1ZSwgY29uc3Qgc3RyaW5nJiBuYW1lLCBib29sIG9wdCA9IGZhbHNlKTsKKworICAvKioKKyAgICogU3RydWN0IGdlbmVyYXRpb24gY29kZQorICAgKi8KKworICB2b2lkIGdlbmVyYXRlX2dvX3N0cnVjdCh0X3N0cnVjdCogdHN0cnVjdCwgYm9vbCBpc19leGNlcHRpb24pOworICB2b2lkIGdlbmVyYXRlX2dvX3N0cnVjdF9kZWZpbml0aW9uKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24gPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3Jlc3VsdCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfYXJncyA9IGZhbHNlKTsKKyAgdm9pZCBnZW5lcmF0ZV9nb19zdHJ1Y3RfaW5pdGlhbGl6ZXIoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2FyZ3Nfb3JfcmVzdWx0ID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX2lzc2V0X2hlbHBlcnMoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cmluZyYgdHN0cnVjdF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQgPSBmYWxzZSk7CisgIHZvaWQgZ2VuZXJhdGVfY291bnRzZXRmaWVsZHNfaGVscGVyKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiB0c3RydWN0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0ID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX2dvX3N0cnVjdF9yZWFkZXIoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cmluZyYgdHN0cnVjdF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQgPSBmYWxzZSk7CisgIHZvaWQgZ2VuZXJhdGVfZ29fc3RydWN0X3dyaXRlcihzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiB0c3RydWN0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3Jlc3VsdCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB1c2VzX2NvdW50c2V0ZmllbGRzID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX2dvX2Z1bmN0aW9uX2hlbHBlcnModF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKKyAgdm9pZCBnZXRfcHVibGljaXplZF9uYW1lX2FuZF9kZWZfdmFsdWUodF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcqIE9VVF9wdWJfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSoqIE9VVF9kZWZfdmFsdWUpIGNvbnN0OworCisgIC8qKgorICAgKiBTZXJ2aWNlLWxldmVsIGdlbmVyYXRpb24gZnVuY3Rpb25zCisgICAqLworCisgIHZvaWQgZ2VuZXJhdGVfc2VydmljZV9oZWxwZXJzKHRfc2VydmljZSogdHNlcnZpY2UpOworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2VfaW50ZXJmYWNlKHRfc2VydmljZSogdHNlcnZpY2UpOworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2VfY2xpZW50KHRfc2VydmljZSogdHNlcnZpY2UpOworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2VfcmVtb3RlKHRfc2VydmljZSogdHNlcnZpY2UpOworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2Vfc2VydmVyKHRfc2VydmljZSogdHNlcnZpY2UpOworICB2b2lkIGdlbmVyYXRlX3Byb2Nlc3NfZnVuY3Rpb24odF9zZXJ2aWNlKiB0c2VydmljZSwgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKKworICAvKioKKyAgICogU2VyaWFsaXphdGlvbiBjb25zdHJ1Y3RzCisgICAqLworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluY2xhc3MgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGNvZXJjZURhdGEgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlua2V5ID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9jb250YWluZXIgPSBmYWxzZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3Qoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3BvaW50ZXJfZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHBvaW50ZXJfZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWNsYXJlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlua2V5ID0gZmFsc2UpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdChzdGQ6Om9zdHJlYW0mIG91dCwgdF9zdHJ1Y3QqIHRzdHJ1Y3QsIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9jb250YWluZXIoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBwb2ludGVyX2ZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcga2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHZpdGVyKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwgdF9zZXQqIHRtYXAsIHN0ZDo6c3RyaW5nIGl0ZXIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwgdF9saXN0KiB0bGlzdCwgc3RkOjpzdHJpbmcgaXRlcik7CisKKyAgdm9pZCBnZW5lcmF0ZV9nb19kb2NzdHJpbmcoc3RkOjpvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KTsKKworICB2b2lkIGdlbmVyYXRlX2dvX2RvY3N0cmluZyhzdGQ6Om9zdHJlYW0mIG91dCwgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKKworICB2b2lkIGdlbmVyYXRlX2dvX2RvY3N0cmluZyhzdGQ6Om9zdHJ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4gdmFsdWU7CisgICAgfQorCisgICAgYnJlYWs7CisKKyAgY2FzZSAnaSc6CisgIGNhc2UgJ0knOgorICAgIGlmICh2YWx1ZTIgIT0gImlmIiAmJiB2YWx1ZTIgIT0gImltcG9ydCIgJiYgdmFsdWUyICE9ICJpbnRlcmZhY2UiKSB7CisgICAgICByZXR1cm4gdmFsdWU7CisgICAgfQorCisgICAgYnJlYWs7CisKKyAgY2FzZSAnbSc6CisgIGNhc2UgJ00nOgorICAgIGlmICh2YWx1ZTIgIT0gIm1hcCIpIHsKKyAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICBicmVhazsKKworICBjYXNlICdwJzoKKyAgY2FzZSAnUCc6CisgICAgaWYgKHZhbHVlMiAhPSAicGFja2FnZSIpIHsKKyAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICBicmVhazsKKworICBjYXNlICdyJzoKKyAgY2FzZSAnUic6CisgICAgaWYgKHZhbHVlMiAhPSAicmFuZ2UiICYmIHZhbHVlMiAhPSAicmV0dXJuIikgeworICAgICAgcmV0dXJuIHZhbHVlOworICAgIH0KKworICAgIGJyZWFrOworCisgIGNhc2UgJ3MnOgorICBjYXNlICdTJzoKKyAgICBpZiAodmFsdWUyICE9ICJzZWxlY3QiICYmIHZhbHVlMiAhPSAic3RydWN0IiAmJiB2YWx1ZTIgIT0gInN3aXRjaCIpIHsKKyAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICBicmVhazsKKworICBjYXNlICd0JzoKKyAgY2FzZSAnVCc6CisgICAgaWYgKHZhbHVlMiAhPSAidHlwZSIpIHsKKyAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICBicmVhazsKKworICBjYXNlICd2JzoKKyAgY2FzZSAnVic6CisgICAgaWYgKHZhbHVlMiAhPSAidmFyIikgeworICAgICAgcmV0dXJuIHZhbHVlOworICAgIH0KKworICAgIGJyZWFrOworCisgIGRlZmF1bHQ6CisgICAgcmV0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gICBvdXQgPDwgdmFsdWUtPmdldF9pbnRlZ2VyKCk7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICAgIG91dCA8PCAiaW50MTZ9eyI7CisgICAgICAgICAgb3V0IDw8IHZhbHVlLT5nZXRfaW50ZWdlcigpOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgICBvdXQgPDwgImludDMyfXsiOworICAgICAgICAgIG91dCA8PCB2YWx1ZS0+Z2V0X2ludGVnZXIoKTsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgb3V0IDw8ICJpbnQ2NH17IjsKKyAgICAgICAgICBvdXQgPDwgdmFsdWUtPmdldF9pbnRlZ2VyKCk7CisgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgICAgb3V0IDw8ICJmbG9hdDY0fXsiOworICAgICAgICAgIGlmICh2YWx1ZS0+Z2V0X3R5cGUoKSA9PSB0X2NvbnN0X3ZhbHVlOjpDVl9JTlRFR0VSKSB7CisgICAgICAgICAgICBvdXQgPDwgdmFsdWUtPmdldF9pbnRlZ2VyKCk7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG91dCA8PCB2YWx1ZS0+Z2V0X2RvdWJsZSgpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgICBvdXQgPDwgInN0cmluZ317IjsKKyAgICAgICAgICBvdXQgPDwgJyInICsgZ2V0X2VzY2FwZWRfc3RyaW5nKHZhbHVlKSArICciJzsKKyAgICAgICAgICBicmVhazsKKworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gY29uc3Qgb2YgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgICAgb3V0IDw8ICJ9KS54IjsKKyAgICB9IGVsc2UgeworICAgICAgc3dpdGNoICh0YmFzZSkgeworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICAgIG91dCA8PCAiW11ieXRlKFwiIiA8PCBnZXRfZXNjYXBlZF9zdHJpbmcodmFsdWUpIDw8ICJcIikiOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvdXQgPDwgJyInIDw8IGdldF9lc2NhcGVkX3N0cmluZyh2YWx1ZSkgPDwgJyInOworICAgICAgICAgIH0KKworICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgICBvdXQgPDwgKHZhbHVlLT5nZXRfaW50ZWdlcigpID4gMCA/ICJ0cnVlIiA6ICJmYWxzZSIpOworICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgaWYgKG9wdCkgeworICAgICAgICAgICAgb3V0IDw8ICImKCZzdHJ1Y3R7eCBpbnR9eyI7CisgICAgICAgICAgfQorICAgICAgICAgIG91dCA8PCB2YWx1ZS0+Z2V0X2ludGVnZXIoKTsKKyAgICAgICAgICBpZiAob3B0KSB7CisgICAgICAgICAgICBvdXQgPDwgIn0pLngiOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgICBpZiAodmFsdWUtPmdldF90eXBlKCkgPT0gdF9jb25zdF92YWx1ZTo6Q1ZfSU5URUdFUikgeworICAgICAgICAgICAgb3V0IDw8IHZhbHVlLT5nZXRfaW50ZWdlcigpOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvdXQgPDwgdmFsdWUtPmdldF9kb3VibGUoKTsKKyAgICAgICAgICB9CisKKyAgICAgICAgICBicmVhazsKKworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gY29uc3Qgb2YgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0KKyAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCB2YWx1ZS0+Z2V0X2ludGVnZXIoKTsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgb3V0IDw8ICImIiA8PCBwdWJsaWNpemUodHlwZV9uYW1lKHR5cGUpKSA8PCAieyI7CisgICAgaW5kZW50X3VwKCk7CisgICAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gKCh0X3N0cnVjdCopdHlwZSktPmdldF9tZW1iZXJzKCk7CisgICAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworICAgIGNvbnN0IG1hcDx0X2NvbnN0X3ZhbHVlKiwgdF9jb25zdF92YWx1ZSosIHRfY29uc3RfdmFsdWU6OnZhbHVlX2NvbXBhcmU+JiB2YWwgPSB2YWx1ZS0+Z2V0X21hcCgpOworICAgIG1hcDx0X2Nvb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ID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsKKyAgICAgICArK21faXRlcikgeworICAgIGJvb2wgcG9pbnRlcl9maWVsZCA9IGlzX3BvaW50ZXJfZmllbGQoKm1faXRlcik7CisgICAgc3RyaW5nIHB1YmxpY2l6ZWRfbmFtZTsKKyAgICB0X2NvbnN0X3ZhbHVlKiBkZWZfdmFsdWU7CisgICAgZ2V0X3B1YmxpY2l6ZWRfbmFtZV9hbmRfZGVmX3ZhbHVlKCptX2l0ZXIsICZwdWJsaWNpemVkX25hbWUsICZkZWZfdmFsdWUpOworICAgIGlmICghcG9pbnRlcl9maWVsZCAmJiBkZWZfdmFsdWUgIT0gTlVMTCAmJiAhb21pdF9pbml0aWFsaXphdGlvbigqbV9pdGVyKSkgeworICAgICAgb3V0IDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgcHVibGljaXplZF9uYW1lIDw8ICI6ICIKKyAgICAgICAgICA8PCByZW5kZXJfZmllbGRfaW5pdGlhbF92YWx1ZSgqbV9pdGVyLCAoKm1faXRlciktPmdldF9uYW1lKCksIHBvaW50ZXJfZmllbGQpIDw8ICIsIgorICAgICAgICAgIDw8IGVuZGw7CisgICAgfQorICB9CisKKyAgb3V0IDw8ICJ9IiA8PCBlbmRsOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHN0cnVjdCBkZWZpbml0aW9uIGZvciBhIHRocmlmdCBkYXRhIHR5cGUuCisgKgorICogQHBhcmFtIHRzdHJ1Y3QgVGhlIHN0cnVjdCBkZWZpbml0aW9uCisgKi8KK3ZvaWQgdF9nb19nZW5lcmF0b3I6OmdlbmVyYXRlX2dvX3N0cnVjdF9kZWZpbml0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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2hlbHBlcnMob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiB0c3RydWN0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgICh2b2lkKWlzX3Jlc3VsdDsKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKyAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworICBjb25zdCBzdHJpbmcgZXNjYXBlZF90c3RydWN0X25hbWUoZXNjYXBlX3N0cmluZyh0c3RydWN0LT5nZXRfbmFtZSgpKSk7CisKKyAgZm9yIChmX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZl9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmX2l0ZXIpIHsKKyAgICBjb25zdCBzdHJpbmcgZmllbGRfbmFtZShwdWJsaWNpemUoZXNjYXBlX3N0cmluZygoKmZfaXRlciktPmdldF9uYW1lKCkpKSk7CisgICAgaWYgKCgqZl9pdGVyKS0+Z2V0X3JlcSgpID09IHRfZmllbGQ6OlRfT1BUSU9OQUwgfHwgaXNfcG9pbnRlcl9maWVsZCgqZl9pdGVyKSkgeworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJmdW5jIChwICoiIDw8IHRzdHJ1Y3RfbmFtZSA8PCAiKSBJc1NldCIgPDwgZmllbGRfbmFtZSA8PCAiKCkgYm9vbCB7IgorICAgICAgICAgIDw8IGVuZGw7CisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIHRfdHlwZSogdHR5cGUgPSAoKmZfaXRlciktPmdldF90eXBlKCktPmdldF90cnVlX3R5cGUoKTsKKyAgICAgIGJvb2wgaXNfYnl0ZXNsaWNlID0gdHR5cGUtPmlzX2JpbmFyeSgpOworICAgICAgYm9vbCBjb21wYXJlX3RvX25pbF9vbmx5ID0gdHR5cGUtPmlzX3NldCgpIHx8IHR0eXBlLT5pc19saXN0KCkgfHwgdHR5cGUtPmlzX21hcCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAoaXNfYnl0ZXNsaWNlICYmICEoKmZfaXRlciktPmdldF92YWx1ZSgpKTsKKyAgICAgIGlmIChpc19wb2ludGVyX2ZpZWxkKCpmX2l0ZXIpIHx8IGNvbXBhcmVfdG9fbmlsX29ubHkpIHsKKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gcC4iIDw8IGZpZWxkX25hbWUgPDwgIiAhPSBuaWwiIDw8IGVuZGw7CisgICAgICB9IGVsc2UgeworICAgICAgICBzdHJpbmcgZGVmX3Zhcl9uYW1lID0gdHN0cnVjdF9uYW1lICsgIl8iICsgZmllbGRfbmFtZSArICJfREVGQVVMVCI7CisgICAgICAgIGlmIChpc19ieXRlc2xpY2UpIHsKKyAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiAhYnl0ZXMuRXF1YWwocC4iIDw8IGZpZWxkX25hbWUgPDwgIiwgIiA8PCBkZWZfdmFyX25hbWUgPDwgIikiCisgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gcC4iIDw8IGZpZWxkX25hbWUgPDwgIiAhPSAiIDw8IGRlZl92YXJfbmFtZSA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7CisgICAgfQorICB9Cit9CisKKy8qKgorICogR2VuZXJhdGVzIHRoZSBDb3VudFNldEZpZWxkcyBoZWxwZXIgbWV0aG9kIGZvciBhIHN0cnVjdAorICovCit2b2lkIHRfZ29fZ2VuZXJhdG9yOjpnZW5lcmF0ZV9jb3VudHNldGZpZWxkc19oZWxwZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cmluZyYgdHN0cnVjdF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgICh2b2lkKWlzX3Jlc3VsdDsKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKyAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworICBjb25zdCBzdHJpbmcgZXNjYXBlZF90c3RydWN0X25hbWUoZXNjYXBlX3N0cmluZyh0c3RydWN0LT5nZXRfbmFtZSgpKSk7CisKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJmdW5jIChwICoiIDw8IHRzdHJ1Y3RfbmFtZSA8PCAiKSBDb3VudFNldEZpZWxkcyIgPDwgdHN0cnVjdF9uYW1lIDw8ICIoKSBpbnQgeyIKKyAgICAgIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBvdXQgPDwgaW5kZW50KCkgPDwgImNvdW50IDo9IDAiIDw8IGVuZGw7CisgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgaWYgKCgqZl9pdGVyKS0+Z2V0X3JlcSgpID09IHRfZmllbGQ6OlRfUkVRVUlSRUQpCisgICAgICBjb250a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TsKKyAgICBpbmRlbnRfZG93bigpOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICByZXR1cm4gbmlsIiA8PCBlbmRsOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICB9Cit9CisKK3ZvaWQgdF9nb19nZW5lcmF0b3I6OmdlbmVyYXRlX2dvX3N0cnVjdF93cml0ZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RyaW5nJiB0c3RydWN0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHVzZXNfY291bnRzZXRmaWVsZHMpIHsKKyAgKHZvaWQpaXNfcmVzdWx0OworICBzdHJpbmcgbmFtZSh0c3RydWN0LT5nZXRfbmFtZSgpKTsKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X3NvcnRlZF9tZW1iZXJzKCk7CisgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIGZfaXRlcjsKKyAgaW5kZW50KG91dCkgPDwgImZ1bmMgKHAgKiIgPDwgdHN0cnVjdF9uYW1lIDw8ICIpICIgPDwgd3JpdGVfbWV0aG9kX25hbWVfIDw8ICIob3Byb3QgdGhyaWZ0LlRQcm90b2NvbCkgZXJyb3IgeyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGlmICh0c3RydWN0LT5pc191bmlvbigpICYmIHVzZXNfY291bnRzZXRmaWVsZHMpIHsKKyAgICBzdGQ6OnN0cmluZyB0c3RydWN0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IHN0cmluZyBzZXJ2aWNlTmFtZShwdWJsaWNpemUodHNlcnZpY2UtPmdldF9uYW1lKCkpKTsKKworICBpZiAodHNlcnZpY2UtPmdldF9leHRlbmRzKCkgIT0gTlVMTCkgeworICAgIGV4dGVuZHMgPSB0eXBlX25hbWUodHNlcnZpY2UtPmdldF9leHRlbmRzKCkpOworICAgIHNpemVfdCBpbmRleCA9IGV4dGVuZHMucmZpbmQoIi4iKTsKKworICAgIGlmIChpbmRleCAhPSBzdHJpbmc6Om5wb3MpIHsKKyAgICAgIGV4dGVuZHNfY2xpZW50ID0gZXh0ZW5kcy5zdWJzdHIoMCwgaW5kZXggKyAxKSArIHB1YmxpY2l6ZShleHRlbmRzLnN1YnN0cihpbmRleCArIDEpKQorICAgICAgICAgICAgICAgICAgICAgICArICJDbGllbnQiOworICAgICAgZXh0ZW5kc19jbGllbnRfbmV3ID0gZXh0ZW5kcy5zdWJzdHIoMCwgaW5kZXggKyAxKSArICJOZXciCisgICAgICAgICAgICAgICAgICAgICAgICAgICArIHB1YmxpY2l6ZShleHRlbmRzLnN1YnN0cihpbmRleCArIDEpKSArICJDbGllbnQiOworICAgIH0gZWxzZSB7CisgICAgICBleHRlbmRzX2NsaWVudCA9IHB1YmxpY2l6ZShleHRlbmRzKSArICJDbGllbnQiOworICAgICAgZXh0ZW5kc19jbGllbnRfbmV3ID0gIk5ldyIgKyBleHRlbmRzX2NsaWVudDsKKyAgICB9CisgIH0KKworICBleHRlbmRzX2ZpZWxkID0gZXh0ZW5kc19jbGllbnQuc3Vic3RyKGV4dGVuZHNfY2xpZW50LmZpbmQoIi4iKSArIDEpOworCisgIGdlbmVyYXRlX2dvX2RvY3N0cmluZyhmX3R5cGVzXywgdHNlcnZpY2UpOworICBmX3R5cGVzXyA8PCBpbmRlbnQoKSA8PCAidHlwZSAiIDw8IHNlcnZpY2VOYW1lIDw8ICJDbGllbnQgc3RydWN0IHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGlmICghZ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BuaWwgJiYgZXJyMiAhPSBuaWwgeyIgPDwgZW5kbDsKKyAgICBmX3R5cGVzXyA8PCBpbmRlbnQoKSA8PCAiICBlcnIgPSBlcnIyIiA8PCBlbmRsOworICAgIGZfdHlwZXNfIDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgIGZfdHlwZXNfIDw8IGluZGVudCgpIDw8ICJpZiBlcnIgIT0gbmlsIHsiIDw8IGVuZGw7CisgICAgZl90eXBlc18gPDwgaW5kZW50KCkgPDwgIiAgcmV0dXJuIiA8PCBlbmRsOworICAgIGZfdHlwZXNfIDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgIGZfdHlwZXNfIDw8IGluZGVudCgpIDw8ICJyZXR1cm4gdHJ1ZSwgZXJyIiA8PCBlbmRsOworICB9IGVsc2UgeworICAgIGZfdHlwZXNfIDw8IGVuZGw7CisgICAgZl90eXBlc18gPDwgaW5kZW50KCkgPDwgInJldHVybiB0cnVlLCBuaWwiIDw8IGVuZGw7CisgIH0KKyAgaW5kZW50X2Rvd24oKTsKKyAgZl90eXBlc18gPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKworLyoqCisgKiBEZXNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4KKyAqLwordm9pZCB0X2dvX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWNsYXJlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgY29lcmNlRGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5rZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2NvbnRhaW5lcl92YWx1ZSkgeworICAodm9pZClpbmNsYXNzOworICAodm9pZCljb2VyY2VEYXRhOworICB0X3R5cGUqIG9yaWdfdHlwZSA9IHRmaWVsZC0+Z2V0X3R5cGUoKTsKKyAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZShvcmlnX3R5cGUpOworICBzdHJpbmcgbmFtZShwcmVmaXggKyBwdWJsaWNpemUodGZpZWxkLT5nZXRfbmFtZSgpKSk7CisKKyAgaWYgKHR5cGUtPmlzX3ZvaWQoKSkgeworICAgIHRocm93ICJDQU5OT1QgR0VORVJBVEUgREVTRVJJQUxJWkUgQ09ERSBGT1Igdm9pZCBUWVBFOiAiICsgbmFtZTsKKyAgfQorCisgIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRfc3RydWN0Kil0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19wb2ludGVyX2ZpZWxkKHRmaWVsZCwgaW5fY29udGFpbmVyX3ZhbHVlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjbGFyZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3V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AgICAgICAgfQorCisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAiUmVhZEJvb2woKSI7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICBvdXQgPDwgIlJlYWRCeXRlKCkiOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgIG91dCA8PCAiUmVhZEkxNigpIjsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIlJlYWRJMzIoKSI7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgb3V0IDw8ICJSZWFkSTY0KCkiOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIG91dCA8PCAiUmVhZERvdWJsZSgpIjsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gR28gbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICBvdXQgPDwgIlJlYWRJMzIoKSI7CisgICAgfQorCisgICAgb3V0IDw8ICI7IGVyciAhPSBuaWwgeyIgPDwgZW5kbDsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiB0aHJpZnQuUHJlcGVuZEVycm9yKFwiZXJyb3IgcmVhZGluZyBmaWVsZCAiIDw8IHRmaWVsZC0+Z2V0X2tleSgpCisgIC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ydWN0LCBjYWxsaW5nIHJlYWQoKQorICovCit2b2lkIHRfZ29fZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3Qob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlcl9maWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRlY2xhcmUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICBzdHJpbmcgZXEoZGVjbGFyZSA/ICIgOj0gIiA6ICIgPSAiKTsKKworICBvdXQgPDwgaW5kZW50KCkgPDwgcHJlZml4IDw8IGVxIDw8IChwb2ludGVyX2ZpZWxkID8gIiYiIDogIiIpOworICBnZW5lcmF0ZV9nb19zdHJ1Y3RfaW5pdGlhbGl6ZXIob3V0LCB0c3RydWN0KTsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiBlcnIgOj0gIiA8PCBwcmVmaXggPDwgIi4iIDw8IHJlYWRfbWV0aG9kX25hbWVfIDw8ICAiKGlwcm90KTsgZXJyICE9IG5pbCB7IiA8PCBlbmRsOworICBvdXQgPDwgaW5kZW50KCkgPDwgIiAgcmV0dXJuIHRocmlmdC5QcmVwZW5kRXJyb3IoZm10LlNwcmludGYoXCIlVCBlcnJvciByZWFkaW5nIHN0cnVjdDogXCIsICIKKyAgICAgIDw8IHByZWZpeCA8PCAiKSwgZXJyKSIgPDwgZW5kbDsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworfQorCisvKioKKyAqIFNlcmlhbGl6ZSBhIGNvbnRhaW5lciBieSB3cml0aW5nIG91dCB0aGUgaGVhZGVyIGZvbGxvd2VkIGJ5CisgKiBkYXRhIGFuZCB0aGVuIGEgZm9vdGVyLgorICovCit2b2lkIHRfZ29fZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogb3JpZ190eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgcG9pbnRlcl9maWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRlY2xhcmUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICB0X3R5cGUqIHR0eXBlID0gZ2V0X3RydWVfdHlwZShvcmlnX3R5cGUpOworICBzdHJpbmcgZXEoIiA9ICIpOworCisgIGlmIChkZWNsYXJlKSB7CisgICAgZXEgPSAiIDo9ICI7CisgIH0KKworICAvLyBEZWNsYXJlIHZhcmlhYmxlcywgcmVhZCBoZWFkZXIKKyAgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiXywgXywgc2l6ZSwgZXJyIDo9IGlwcm90LlJlYWRNYXBCZWdpbigpIiA8PCBlbmRsOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgZXJyICE9IG5pbCB7IiA8PCBlbmRsOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiICByZXR1cm4gdGhyaWZ0LlByZXBlbmRFcnJvcihcImVycm9yIHJlYWRpbmcgbWFwIGJlZ2luOiBcIiwgZXJyKSIgPDwgZW5kbDsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ0TW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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWNsYXJlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKKyAgKHZvaWQpZGVjbGFyZTsKKyAgc3RyaW5nIGVsZW0gPSB0bXAoIl9lbGVtIik7CisgIHRfZmllbGQgZmVsZW0oKCh0X2xpc3QqKXRsaXN0KS0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKTsKKyAgZmVsZW0uc2V0X3JlcSh0X2ZpZWxkOjpUX09QVF9JTl9SRVFfT1VUKTsKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0sIHRydWUsICIiLCBmYWxzZSwgZmFsc2UsIGZhbHNlLCB0cnVlKTsKKyAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICIgPSBhcHBlbmQoIiA8PCBwcmVmaXggPDwgIiwgIiA8PCBlbGVtIDw8ICIpIiA8PCBlbmRsOworfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgYSBmaWVsZCBvZiBhbnkgdHlwZS4KKyAqCisgKiBAcGFyYW0gdGZpZWxkIFRoZSBmaWVsZCB0byBzZXJpYWxpemUKKyAqIEBwYXJhbSBwcmVmaXggTmFtZSB0byBwcmVwZW5kIHRvIGZpZWxkIG5hbWUKKyAqLwordm9pZCB0X2dvX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Rya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ICAgICAgc3dpdGNoICh0YmFzZSkgeworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9WT0lEOgorICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IGNhbm5vdCBzZXJpYWxpemUgdm9pZCBmaWVsZCBpbiBhIHN0cnVjdDogIiArIG5hbWU7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgaWYgKHR5cGUtPmlzX2JpbmFyeSgpICYmICFpbmtleSkgeworICAgICAgICAgIG91dCA8PCAiV3JpdGVCaW5hcnkoIiA8PCBuYW1lIDw8ICIpIjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBvdXQgPDwgIldyaXRlU3RyaW5nKHN0cmluZygiIDw8IG5hbWUgPDwgIikpIjsKKyAgICAgICAgfQorCisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAiV3JpdGVCb29sKGJvb2woIiA8PCBuYW1lIDw8ICIpKSI7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICBvdXQgPDwgIldyaXRlQnl0ZShpbnQ4KCIgPDwgbmFtZSA8PCAiKSkiOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgIG91dCA8PCAiV3JpdGVJMTYoaW50MTYoIiA8PCBuYW1lIDw8ICIpKSI7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgb3V0IDw8ICJXcml0ZUkzMihpbnQzMigiIDw8IG5hbWUgPDwgIikpIjsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICA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tIGFib3J0aW5nLiI7CisgIH0KKworICBpZiAocmVzb2x2ZWRfdHlwZS0+aXNfYmluYXJ5KCkpCisgICAgcmV0dXJuICJzdHJpbmciOworCisgIHJldHVybiB0eXBlX3RvX2dvX3R5cGUodHlwZSk7Cit9CisKKy8qKgorICogQ29udmVydHMgdGhlIHBhcnNlIHR5cGUgdG8gYSBnbyB0eXBlCisgKi8KK3N0cmluZyB0X2dvX2dlbmVyYXRvcjo6dHlwZV90b19nb190eXBlKHRfdHlwZSogdHlwZSkgeworICByZXR1cm4gdHlwZV90b19nb190eXBlX3dpdGhfb3B0KHR5cGUsIGZhbHNlKTsKK30KKworLyoqCisgKiBDb252ZXJ0cyB0aGUgcGFyc2UgdHlwZSB0byBhIGdvIHR5cGUsIHRha2luZyBpbnRvIGFjY291bnQgd2hldGhlciB0aGUgZmllbGQKKyAqIGFzc29jaWF0ZWQgd2l0aCB0aGUgdHlwZSBpcyBUX09QVElPTkFMLgorICovCitzdHJpbmcgdF9nb19nZW5lcmF0b3I6OnR5cGVfdG9fZ29fdHlwZV93aXRoX29wdCh0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG9wdGlvbmFsX2ZpZWxkKSB7CisgIHN0cmluZyBtYXliZV9wb2ludGVyKG9wdGlvbmFsX2ZpZWxkID8gIioiIDogIiIpOworCisgIGlmICh0eXBlLT5pc190eXBlZGVmKCkgJiYgKCh0X3R5cGVkZWYqKXR5cGUpLT5pc19mb3J3YXJkX3R5cGVkZWYoKSkgeworICAgIHR5cGUgPSAoKHRfdHlwZWRlZiopdHlwZSktPmdldF90cnVlX3R5cGUoKTsKKyAgfQorCisgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIHRfYmFzZV90eXBlOjp0X2Jhc2UgdGJhc2UgPSAoKHRfYmFzZV90eXBlKil0eXBlKS0+Z2V0X2Jhc2UoKTsKKworICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1ZPSUQ6CisgICAgICB0aHJvdyAiIjsKKworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgaWYgKHR5cGUtPmlzX2JpbmFyeSgpKSB7CisgICAgICAgIHJldHVybiBtYXliZV9wb2ludGVyICsgIltdYnl0ZSI7CisgICAgICB9CisKKyAgICAgIHJldHVybiBtYXliZV9wb2ludGVyICsgInN0cmluZyI7CisKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICByZXR1cm4gbWF5YmVfcG9pbnRlciArICJib29sIjsKKworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICByZXR1cm4gbWF5YmVfcG9pbnRlciArICJpbnQ4IjsKKworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgcmV0dXJuIG1heWJlX3BvaW50ZXIgKyAiaW50MTYiOworCisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICByZXR1cm4gbWF5YmVfcG9pbnRlciArICJpbnQzMiI7CisKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgIHJldHVybiBtYXliZV9wb2ludGVyICsgImludDY0IjsKKworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgcmV0dXJuIG1heWJlX3BvaW50ZXIgKyAiZmxvYXQ2NCI7CisgICAgfQorICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkgeworICAgIHJldHVybiBtYXliZV9wb2ludGVyICsgcHVibGljaXplKHR5cGVfbmFtZSh0eXBlKSk7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIHJldHVybiAiKiIgKyBwdWJsaWNpemUodHlwZV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N0cigpKTsKKyAgcmV0dXJuIGZhbHNlOworICAqLworIH0KKworVEhSSUZUX1JFR0lTVEVSX0dFTkVSQVRPUihnbywgIkdvIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiAgICBwYWNrYWdlX3ByZWZpeD0gIFBhY2thZ2UgcHJlZml4IGZvciBnZW5lcmF0ZWQgZmlsZXMuXG4iIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiAgICB0aHJpZnRfaW1wb3J0PSAgIE92ZXJyaWRlIHRocmlmdCBwYWNrYWdlIGltcG9ydCBwYXRoIChkZWZhdWx0OiIgKyBERUZBVUxUX1RIUklGVF9JTVBPUlQgKyAiKVxuIiBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICIgICAgcGFja2FnZT0gICAgICAgICBQYWNrYWdlIG5hbWUgKGRlZmF1bHQ6IGluZmVycmVkIGZyb20gdGhyaWZ0IGZpbGUgbmFtZSlcbiIgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAiICAgIGlnbm9yZV9pbml0aWFsaXNtc1xuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAiICAgICAgICAgICAgICAgICAgICAgRGlzYWJsZSBhdXRvbWF0aWMgc3BlbGxpbmcgY29ycmVjdGlvbiBvZiBpbml0aWFsaXNtcyAoZS5nLiBcIlVSTFwiKVxuIiBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICIgICAgcmVhZF93cml0ZV9wcml2YXRlXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICIgICAgICAgICAgICAgICAgICAgICBNYWtlIHJlYWQvd3JpdGUgbWV0aG9kcyBwcml2YXRlLCBkZWZhdWx0IGlzIHB1YmxpYyBSZWFkL1dyaXRlXG4iKQpkaWZmIC0tZ2l0IGEvY29tcGlsZXIvY3BwL3NyYy90aHJpZnQvZ2VuZXJhdGUvdF9ndl9nZW5lcmF0b3IuY2MgYi9jb21waWxlci9jcHAvc3JjL3RocmlmdC9nZW5lcmF0ZS90X2d2X2dlbm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XBfbmFtZShwcm9ncmFtX25hbWVfKSA8PCAiQ29uc3RhbnRzIHsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIHZlY3Rvcjx0X2NvbnN0Kj46Oml0ZXJhdG9yIGNfaXRlcjsKKyAgZm9yIChjX2l0ZXIgPSBjb25zdHMuYmVnaW4oKTsgY19pdGVyICE9IGNvbnN0cy5lbmQoKTsgKytjX2l0ZXIpIHsKKyAgICBwcmludF9jb25zdF92YWx1ZShmX2NvbnN0cywKKyAgICAgICAgICAgICAgICAgICAgICAoKmNfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgKCpjX2l0ZXIpLT5nZXRfdHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICgqY19pdGVyKS0+Z2V0X3ZhbHVlKCksCisgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOworICB9CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChmX2NvbnN0cykgPDwgIn0iIDw8IGVuZGw7CisgIGZfY29uc3RzLmNsb3NlKCk7Cit9CisKK3ZvaWQgdF9oYXhlX2dlbmVyYXRvcjo6cHJpbnRfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX3N0YXRpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBkZWZ2YWwpIHsKKyAgdHlwZSA9IGdldF90cnVlX3R5cGUodHlwZSk7CisKKyAgaW5kZW50KG91dCk7CisgIGlmICghZGV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gZWxzZSB7CisgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBjb25zdCBvZiB0eXBlICIgKyB0eXBlLT5nZXRfbmFtZSgpOworICB9Cit9CisKK3N0cmluZyB0X2hheGVfZ2VuZXJhdG9yOjpyZW5kZXJfY29uc3RfdmFsdWUob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSkgeworICAodm9pZCluYW1lOworICB0eXBlID0gZ2V0X3RydWVfdHlwZSh0eXBlKTsKKyAgc3RkOjpvc3RyaW5nc3RyZWFtIHJlbmRlcjsKKworICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICB0X2Jhc2VfdHlwZTo6dF9iYXNlIHRiYXNlID0gKCh0X2Jhc2VfdHlwZSopdHlwZSktPmdldF9iYXNlKCk7CisgICAgc3dpdGNoICh0YmFzZSkgeworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgcmVuZGVyIDw8ICciJyA8PCBnZXRfZXNjYXBlZF9zdHJpbmcodmFsdWUpIDw8ICciJzsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgIHJlbmRlciA8PCAoKHZhbHVlLT5nZXRfaW50ZWdlcigpID4gMCkgPyAidHJ1ZSIgOiAiZmFsc2UiKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICByZW5kZXIgPDwgIihieXRlKSIgPDwgdmFsdWUtPmdldF9pbnRlZ2VyKCk7CisgICAgICBicmVhazsKKyAgIC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GRCZWdpbigiIDw8IGNvbnN0YW50X25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKQorICAgICAgICAgICAgICAgIDw8ICJfRklFTERfREVTQyk7IiA8PCBlbmRsOworCisgICAgLy8gV3JpdGUgZmllbGQgY29udGVudHMKKyAgICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAqZl9pdGVyLCAidGhpcy4iKTsKKworICAgIC8vIFdyaXRlIGZpZWxkIGNsb3NlcgorICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZUZpZWxkRW5kKCk7IiA8PCBlbmRsOworCisgICAgaWYgKG51bGxfYWxsb3dlZCkgeworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgIH0KKyAgICBpZiAoY291bGRfYmVfdW5zZXQpIHsKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICB9CisgIH0KKworICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVGaWVsZFN0b3AoKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZVN0cnVjdEVuZCgpOyIgPDwgZW5kbDsKKworICBpbmRlbnQob3V0KSA8PCAib3Byb3QuRGVjcmVtZW50UmVjdXJzaW9uRGVwdGgoKTsiIDw8IGVuZGw7CisgIHNjb3BlX2Rvd24ob3V0KTsKKyAgaW5kZW50KG91dCkgPDwgImNhdGNoKGU6RHluYW1pYykiIDw8IGVuZGw7CisgIHNjb3BlX3VwKG91dCk7CisgIGluZGVudChvdXQpIDw8ICJvcHJvdC5EZWNyZW1lbnRSZWN1cnNpb25EZXB0aCgpOyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgInRocm93IGU7IiA8PCBlbmRsOworICBzY29wZV9kb3duKG91dCk7CisKKyAgaW5kZW50X2Rvd24oKTsKK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JlZ2luKFNUUlVDVF9ERVNDKTsiIDw8IGVuZGw7CisKKyAgYm9vbCBmaXJzdCA9IHRydWU7CisgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgaWYgKGZpcnN0KSB7CisgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgb3V0IDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgImlmICI7CisgICAgfSBlbHNlIHsKKyAgICAgIG91dCA8PCAiIGVsc2UgaWYgIjsKKyAgICB9CisKKyAgICBvdXQgPDwgIih0aGlzLiIgPDwgZ2VuZXJhdGVfaXNzZXRfY2hlY2soKmZfaXRlcikgPDwgIikgeyIgPDwgZW5kbDsKKworICAgIGluZGVudF91cCgpOworCisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlRmllbGRCZWdpbigiIDw8IGNvbnN0YW50X25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKQorICAgICAgICAgICAgICAgIDw8ICJfRklFTERfREVTQyk7IiA8PCBlbmRsOworCisgICAgLy8gV3JpdGUgZmllbGQgY29udGVudHMKKyAgICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAqZl9pdGVyLCAidGhpcy4iKTsKKworICAgIC8vIFdyaXRlIGZpZWxkIGNsb3NlcgorICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZUZpZWxkRW5kKCk7IiA8PCBlbmRsOworCisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBpbmRlbnQob3V0KSA8PCAifSI7CisgIH0KKworICBpbmRlbnQob3V0KSA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVGaWVsZFN0b3AoKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZVN0cnVjdEVuZCgpOyIgPDwgZW5kbDsKKworICBpbmRlbnQob3V0KSA8PCAib3Byb3QuRGVjcmVtZW50UmVjdXJzaW9uRGVwdGgoKTsiIDw8IGVuZGw7CisgIHNjb3BlX2Rvd24ob3V0KTsKKyAgaW5kZW50KG91dCkgPDwgImNhdGNoKGU6RHluYW1pYykiIDw8IGVuZGw7CisgIHNjb3BlX3VwKG91dCk7CisgIGluZGVudChvdXQpIDw8ICJvcHJvdC5EZWNyZW1lbnRSZWN1cnNpb25EZXB0aCgpOyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgInRocm93IGU7IiA8PCBlbmRsOworICBzY29wZV9kb3duKG91dCk7CisKKyAgaW5kZW50X2Rvd24oKTsKKyAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9oYXhlX2dlbmVyYXRvcjo6Z2VuZXJhdGVfcmVmbGVjdGlvbl9nZXR0ZXJzKG9zdHJpbmdzdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGNhcF9uYW1lKSB7CisgICh2b2lkKXR5cGU7CisgICh2b2lkKWNhcF9uYW1lOworICBpbmRlbnQob3V0KSA8PCAiY2FzZSAiIDw8IHVwY2FzZV9zdHJpbmcoZmllbGRfbmFtZSkgPDwgIl9GSUVMRF9JRDoiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIHRoaXMuIiA8PCBmaWVsZF9uYW1lIDw8ICI7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworfQorCit2b2lkIHRfaGF4ZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3JlZmxlY3Rpb25fc2V0dGVycyhvc3RyaW5nc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjYXBfbmFtZSkgeworICAodm9pZCl0eXBlOworICAodm9pZCljYXBfbmFtZTsKKyAgaW5kZW50KG91dCkgPDwgImNhc2UgIiA8PCB1cGNhc2Vfc3RyaW5nKGZpZWxkX25hbWUpIDw8ICJfRklFTERfSUQ6IiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KG91dCkgPDwgImlmICh2YWx1ZSA9PSBudWxsKSB7IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAiICB1bnNldCIgPDwgZ2V0X2NhcF9uYW1lKGZpZWxkX25hbWUpIDw8ICIoKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgIiAgdGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIiA9IHZhbHVlOyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKworICBpbmRlbnRfZG93bigpOworfQorCit2b2lkIHRfaGF4ZV9nZW5lcmF0b3I6OmdlbmVyYXRlX2dlbmVyaWNfZmllbGRfZ2V0dGVyc19zZXR0ZXJzKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCkgeworCisgIHN0ZDo6b3N0cmluZ3N0cmVh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PCBpbmRlbnQoKSA8PCAiaXByb3RfID0gaXByb3Q7IiA8PCBlbmRsOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgImlmIChvcHJvdCA9PSBudWxsKSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIm9wcm90XyA9IGlwcm90OyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0gZWxzZSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIm9wcm90XyA9IG9wcm90OyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAic3VwZXIoaXByb3QsIG9wcm90KTsiIDw8IGVuZGw7CisgIH0KKyAgc2NvcGVfZG93bihmX3NlcnZpY2VfKTsKKyAgZl9zZXJ2aWNlXyA8PCBlbmRsOworCisgIGlmIChleHRlbmRzLmVtcHR5KCkpIHsKKyAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJwcml2YXRlIHZhciBpcHJvdF8gOiBUUHJvdG9jb2w7IiA8PCBlbmRsIDw8IGluZGVudCgpCisgICAgICAgICAgICAgICA8PCAicHJpdmF0ZSB2YXIgb3Byb3RfIDogVFByb3RvY29sOyIgPDwgZW5kbCA8PCBpbmRlbnQoKQorICAgICAgICAgICAgICAgPDwgInByaXZhdGUgdmFyIHNlcWlkXyA6IEludDsiIDw8IGVuZGwgPDwgZW5kbDsKKworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIGZ1bmN0aW9uIGdldElucHV0UHJvdG9jb2woKSA6IFRQcm90b2NvbCIg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worICAgICAgICB9CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSIgPDwgZW5kbDsKKyAgICAgIH0KKworICAgICAgLy8gSWYgeW91IGdldCBoZXJlIGl0J3MgYW4gZXhjZXB0aW9uLCB1bmxlc3MgYSB2b2lkIGZ1bmN0aW9uCisgICAgICBpZiAoKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpIHsKKyAgICAgICAgaWYgKGNhbGxiYWNrc18pIHsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgImlmIChvblN1Y2Nlc3MgIT0gbnVsbCkgb25TdWNjZXNzKCk7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicmV0dXJuOyIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChjYWxsYmFja3NfKSB7CisgICAgICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJpZiAob25FcnJvciAhPSBudWxsKSIgPDwgZW5kbDsKKyAgICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykKKyAgICAgICAgICAgICAgPDwgIm9uRXJyb3IoIG5ldyBUQXBwbGljYXRpb25FeGNlcHRpb24oVEFwcGxpY2F0aW9uRXhjZXB0aW9uLk1JU1NJTkdfUkVTVUxULCIgPDwgZW5kbDsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgZmFpbGVkOiB1bmtub3duIHJlc3VsdFwiKSk7IiA8PCBlbmRsOworICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaW5kZW50KGZfc2VydmljZV8pCisgICAgICAgICAgICAgIDw8ICJ0aHJvdyBuZXcgVEFwcGxpY2F0aW9uRXhjZXB0aW9uKFRBcHBsaWNhdGlvbkV4Y2VwdGlvbi5NSVNTSU5HX1JFU1VMVCwiIDw8IGVuZGw7CisgICAgICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIiIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIGZhaWxlZDogdW5rbm93biByZXN1bHRcIik7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9CisKKyAgICAgIGlmIChjYWxsYmFja3NfKSB7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSBjYXRjaCggZSA6IFRFeGNlcHRpb24pIHsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgImlmIChvbkVycm9yICE9IG51bGwpIG9uRXJyb3IoZSk7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIn0iIDw8IGVuZGw7CisgICAgICB9CisKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIn0pOyIgPDwgZW5kbDsKKyAgICB9CisKKyAgICBpZiAoISgoKmZfaXRlciktPmlzX29uZXdheSgpIHx8ICgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSkgeworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIHJldHZhbDsiIDw8IGVuZGw7CisgICAgfQorCisgICAgLy8gQ2xvc2UgZnVuY3Rpb24KKyAgICBzY29w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VfSTMyOgorICAgICAgICBvdXQgPDwgInJlYWRJMzIoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgInJlYWRJNjQoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgInJlYWREb3VibGUoKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gSGF4ZSBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAicmVhZEkzMigpOyI7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIERFU0VSSUFMSVpFIEZJRUxEICclcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICB0ZmllbGQtPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgdHlwZV9uYW1lKHR5cGUpLmNfc3RyKCkpOworICB9Cit9CisKKy8qKgorICogR2VuZXJhdGVzIGFuIHVuc2VyaWFsaXplciBmb3IgYSBzdHJ1Y3QsIGludm9rZXMgcmVhZCgpCisgKi8KK3ZvaWQgdF9oYXhlX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeC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cmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBtYXApIHsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGl0ZXIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAma2ZpZWxkLCAiIik7CisgIHRfZmllbGQgdmZpZWxkKHRtYXAtPmdldF92YWxfdHlwZSgpLCBtYXAgKyAiLmdldCgiICsgaXRlciArICIpIik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZ2ZmllbGQsICIiKTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgc2V0LgorICovCit2b2lkIHRfaGF4ZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsIHRfc2V0KiB0c2V0LCBzdHJpbmcgaXRlcikgeworICB0X2ZpZWxkIGVmaWVsZCh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGl0ZXIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmZWZpZWxkLCAiIik7Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIGxpc3QuCisgKi8KK3ZvaWQgdF9oYXhlX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsIHRfbGlzdCogdGxpc3QsIHN0cmluZyBpdGVyKSB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sKKyAgICAgIHRfYmFzZV90eXBlOjp0X2Jhc2UgdGJhc2UgPSAoKHRfYmFzZV90eXBlKil0a2V5KS0+Z2V0X2Jhc2UoKTsKKyAgICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBpZiAoISh0a2V5LT5pc19iaW5hcnkoKSkpIHsKKyAgICAgICAgICByZXR1cm4gIlN0cmluZ01hcDwgIiArIHR5cGVfbmFtZSh0dmFsKSArICI+IjsKKyAgICAgICAgfQorICAgICAgICBicmVhazsgLy8gZGVmYXVsdCB0byBPYmplY3RNYXA8PgorICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgIHJldHVybiAiSW50TWFwPCAiICsgdHlwZV9uYW1lKHR2YWwpICsgIj4iOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIHJldHVybiAiSW50NjRNYXA8ICIgKyB0eXBlX25hbWUodHZhbCkgKyAiPiI7CisgICAgICBkZWZhdWx0OgorICAgICAgICBicmVhazsgLy8gZGVmYXVsdCB0byBPYmplY3RNYXA8PgorICAgICAgfQorICAgIH0KKyAgICBpZiAodGtleS0+aXNfZW51bSgpKSB7CisgICAgICByZXR1cm4gIkludE1hcDwgIiArIHR5cGVfbmFtZSh0dmFsKSArICI+IjsKKyAgICB9CisgICAgcmV0dXJuICJPYmplY3RNYXA8ICIgKyB0eXBlX25hbWUodGtleSkgKyAiLCAiICsgdHlwZV9uYW1lKHR2YWwpICsgIj4iOworICB9CisKKyAgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIHRfdHlwZSogdGtleSA9IGdldF90cnVlX3R5cGUoKCh0X3NldCopdHR5cGUpLT5nZXRfZWxlbV90eXBlKCkpOworICAgIGlmICh0a2V5LT5pc19iYXNlX3R5cGUoKSkgeworICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXRrZXkpLT5nZXRfYmFzZSgpOworICAgICAgc3dpdGNoICh0YmFzZSkgeworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgIGlmICghKHRrZXktPmlzX2JpbmFyeSgpKSkgeworICAgICAgICAgIHJldHVybiAiU3RyaW5nU2V0IjsKKyAgICAgICAgfQorICAgICAgICBicmVhazsgLy8gZGVmYXVsdCB0byBPYmplY3RTZXQKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICByZXR1cm4gIkludFNldCI7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgcmV0dXJuICJJbnQ2NFNldCI7CisgICAgICBkZWZhdWx0OgorICAgICAgICBicmVhazsgLy8gZGVmYXVsdCB0byBPYmplY3RTZXQKKyAgICAgIH0KKyAgICB9CisgICAgaWYgKHRrZXktPmlzX2VudW0oKSkgeworICAgICAgcmV0dXJuICJJbnRTZXQiOworICAgIH0KKyAgICByZXR1cm4gIk9iamVjdFNldDwgIiArIHR5cGVfbmFtZSh0a2V5KSArICI+IjsKKyAgfQorCisgIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgdF90eXBlKiB0ZWxtID0gKCh0X2xpc3QqKXR0eXBlKS0+Z2V0X2VsZW1fdHlwZSgpOworICAgIHJldHVybiAiTGlzdDwgIiArIHR5cGVfbmFtZSh0ZWxtKSArICI+IjsKKyAgfQorCisgIC8vIENoZWNrIGZvciBuYW1lc3BhY2luZworICB0X3Byb2dyYW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3N0YXJ0ID0gMDsKKyAgICB3aGlsZSAoY29tbWFfc3RhcnQgPCBpbm5lcl90eXBlcy5sZW5ndGgoKSkgeworICAgICAgc2l6ZV90IGNvbW1hX3BvcyA9IGNvbW1hX3N0YXJ0OworICAgICAgaW50IG5lc3RlZCA9IDA7CisKKyAgICAgIHdoaWxlIChjb21tYV9wb3MgPCBpbm5lcl90eXBlcy5sZW5ndGgoKSkgeworICAgICAgICBib29sIGZvdW5kID0gZmFsc2U7CisgICAgICAgIHN3aXRjaCAoaW5uZXJfdHlwZXNbY29tbWFfcG9zXSkgeworICAgICAgICBjYXNlICc8JzoKKyAgICAgICAgICArK25lc3RlZDsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSAnPic6CisgICAgICAgICAgLS1uZXN0ZWQ7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgJywnOgorICAgICAgICAgIGZvdW5kID0gKG5lc3RlZCA9PSAwKTsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBpZiAoZm91bmQpIHsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICArK2NvbW1hX3BvczsKKyAgICAgIH0KKworICAgICAgaWYgKG5ld19pbm5lci5sZW5ndGgoKSA+IDApIHsKKyAgICAgICAgbmV3X2lubmVyICs9ICIsIjsKKyAgICAgIH0KKworICAgICAgc3RyaW5nIGlubmVyID0gaW5uZXJfdHlwZXMuc3Vic3RyKGNvbW1hX3N0YXJ0LCBjb21tYV9wb3MgLSBjb21tYV9zdGFydCk7CisgICAgICBuZXdfaW5uZXIgKz0gZ2V0X2NhcF9uYW1lKGlubmVyKTsKKyAgICAgIGNvbW1hX3N0YXJ0ID0gKytjb21tYV9wb3M7CisgICAgfQorCisgICAgcmV0dXJuIGdldF9jYXBfbmFtZShvdXRlcl90eXBlKSArICI8IiArIG5ld19pbm5lciArICI+IjsKKyAgfQorCisgIC8vIHBhY2thZ2UgbmFtZQorICBzaXplX3Qga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CisgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgb3B0aW9ucyA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICBib29sIGlvID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgbWV0aG9kID0gZmFsc2UpOworCisgIHN0cmluZyB0eXBlX3RvX2VudW0odF90eXBlKiB0dHlwZSk7CisKKyAgc3RyaW5nIHR5cGVfdG9fZGVmYXVsdCh0X3R5cGUqIHR0eXBlKTsKKworICBzdHJpbmcgcmVuZGVyX2hzX3R5cGUodF90eXBlKiB0eXBlLCBib29sIG5lZWRzX3BhcmVucyk7CisKKyAgc3RyaW5nIHR5cGVfdG9fY29uc3RydWN0b3IodF90eXBlKiB0dHlwZSk7CisKKyAgc3RyaW5nIHJlbmRlcl9oc190eXBlX2Zvcl9mdW5jdGlvbl9uYW1lKHRfdHlwZSogdHlwZSk7CisKK3ByaXZhdGU6CisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl90eXBlc187CisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl9jb25zdHNfOworICBvZnN0cmVhbV93aXRoX2NvbnRlbnRfYmFzZWRfY29uZGl0aW9uYWxfdXBkYXRlIGZfc2VydmljZV87CisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl9pZmFjZV87CisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl9jbGllbnRfOworfTsKKworLyoqCisgKiBQcmVwYXJlcyBmb3IgZmlsZSBnZW5lcmF0aW9uIGJ5IG9wZW5pbmcgdXAgdGhlIG5lY2Vzc2FyeSBmaWxlIG91dHB1dAorICogc3RyZWFtcy4KKyAqCisgKiBAcGFyYW0gdHByb2dyYW0gVGhlIHByb2dyYW0gdG8gZ2VuZXJhd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ltcG9ydCAiIDw8IHBuYW1lIDw8ICJfVHlwZXMiIDw8IGVuZGw7Cit9CisKK3N0cmluZyB0X2hzX2dlbmVyYXRvcjo6aHNfbGFuZ3VhZ2VfcHJhZ21hKCkgeworICByZXR1cm4gc3RyaW5nKAorICAgICAgInstIyBMQU5HVUFHRSBEZXJpdmVEYXRhVHlwZWFibGUgIy19XG4iCisgICAgICAiey0jIExBTkdVQUdFIERlcml2ZUdlbmVyaWMgIy19XG4iCisgICAgICAiey0jIExBTkdVQUdFIE92ZXJsb2FkZWRTdHJpbmdzICMtfVxuIgorICAgICAgInstIyBPUFRJT05TX0dIQyAtZm5vLXdhcm4tbWlzc2luZy1maWVsZHMgIy19XG4iCisgICAgICAiey0jIE9QVElPTlNfR0hDIC1mbm8td2Fybi1taXNzaW5nLXNpZ25hdHVyZXMgIy19XG4iCisgICAgICAiey0jIE9QVElPTlNfR0hDIC1mbm8td2Fybi1uYW1lLXNoYWRvd2luZyAjLX1cbiIKKyAgICAgICJ7LSMgT1BUSU9OU19HSEMgLWZuby13YXJuLXVudXNlZC1pbXBvcnRzICMtfVxuIgorICAgICAgInstIyBPUFRJT05TX0dIQyAtZm5vLXdhcm4tdW51c2VkLW1hdGNoZXMgIy19XG4iKTsKK30KKworLyoqCisgKiBBdXRvZ2VuJ2QgY29tbWVudAorICovCitzdHJpbmcgdF9oc19nZW5lcmF0b3I6OmhzX2F1dG9nZW5fY29tbWVudCgpIHsKKyAgcmV0dXJuIHN0cmluZygiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiIpCisgICAgICAgICArICItLSBBdXRvZ2VuZXJhdGVkIGJ5IFRocmlmdCBDb21waWxlciAoIiArIFRIUklGVF9WRVJTSU9OICsgIikgICAgICAgICAgICAgICAgICAgICAgLS1cbiIKKyAgICAgICAgICsgIi0tICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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ArK21faXRlcikgeworICAgICAgaWYgKGZpcnN0KSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ7ICI7CisgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICB9IGVsc2UgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAiLCAiOworICAgICAgfQorICAgICAgc3RyaW5nIG1uYW1lID0gKCptX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgICAgb3V0IDw8IGZpZWxkX25hbWUodG5hbWUsIG1uYW1lKSA8PCAiIDo6ICI7CisgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9PUFRJT05BTAorICAgICAgICAgIHx8ICgodF90eXBlKikoKm1faXRlciktPmdldF90eXBlKCkpLT5pc194Y2VwdGlvbigpKSB7CisgICAgICAgIG91dCA8PCAiUC5NYXliZSAiOworICAgICAgfQorICAgICAgb3V0IDw8IHJlbmRlcl9oc190eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSwgdHJ1ZSkgPDwgZW5kbDsKKyAgICB9CisgICAgaW5kZW50KG91dCkgPDwgIn0iOworICAgIGluZGVudF9kb3duKCk7CisgIH0KKworICBvdXQgPDwgIiBkZXJpdmluZyAoUC5TaG93LFAuRXEsRy5HZW5lcmljLFRZLlR5cGVhYmxlKSIgPDwgZW5kbDsKKworICBpZiAoaXNfZXhjZXB0aW9uKQorICAgIG91dCA8PCAiaW5zdGFuY2UgWC5FeGNlcHRpb24gIiA8PCB0bmFtZSA8PCBlbmRsOworCisgIGluZGVudChvdXQpIDw8ICJpbnN0YW5jZSBILkhhc2hhYmxlICIgPDwgdG5hbWUgPDwgIiB3aGVyZSIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGluZGVudChvdXQpIDw8ICJoYXNoV2l0aFNhbHQgc2FsdCByZWNvcmQgPSBzYWx0IjsKKyAgZm9yICh2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0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PDwgImFyYml0cmFyeSA9IE0ubGlmdE0gIiA8PCB0bmFtZTsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBib29sIGZpcnN0ID0gdHJ1ZTsKKyAgICBmb3IgKHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7CisgICAgICAgICArK21faXRlcikgeworICAgICAgaWYgKGZpcnN0KSB7CisgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgIG91dCA8PCAiICI7CisgICAgICB9IGVsc2UgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAiYE0uYXBgIjsKKyAgICAgIH0KKyAgICAgIG91dCA8PCAiKCI7CisgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9PUFRJT05BTAorICAgICAgICAgIHx8ICgodF90eXBlKikoKm1faXRlciktPmdldF90eXBlKCkpLT5pc194Y2VwdGlvbigpKSB7CisgICAgICAgIG91dCA8PCAiTS5saWZ0TSBQLkp1c3QgIjsKKyAgICAgIH0KKyAgICAgIG91dCA8PCAiUUMuYXJiaXRyYXJ5KSIgPDwgZW5kbDsKKyAgICB9CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGluZGVudF9kb3duKCk7CisgICAgaW5kZW50X2Rvd24oKTsKKworICAgIC8vIFNocmluaworICAgIGluZGVudChvdXQpIDw8ICJzaHJpbmsgb2JqIHwgb2JqID09IGRlZmF1bHRfIiA8PCB0bmFtZSA8PCAiID0gW10iIDw8IGVuZGw7CisgICAgaW5kZW50KG91dCkgPDwgIiAgICAgICAgICAgfCBQLm90aGVyd2lzZSA9IE0uY2F0TWF5YmVzIiA8PCBlbmRsO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UsdHlwLHNlcWlkKSIgPDwgZW5kbDsKKworICB9IGVsc2UgeworICAgIGZfc2VydmljZV8gPDwgImRvIiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiXyA8LSBULnJlYWRWYWwgaXByb3QgKFQuVF9TVFJVQ1QgTWFwLmVtcHR5KSIgPDwgZW5kbDsKKyAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIlQud3JpdGVNZXNzYWdlIG9wcm90IChuYW1lLFQuTV9FWENFUFRJT04sc2VxaWQpICQiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJULndyaXRlQXBwRXhuIG9wcm90IChULkFwcEV4biBULkFFX1VOS05PV05fTUVUSE9EIChcIlVua25vd24gZnVuY3Rpb24gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAiXCIgKysgTFQudW5wYWNrIG5hbWUpKSIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGluZGVudF9kb3duKCk7CisgIH0KKworICBpbmRlbnRfZG93bigpOworCisgIC8vIEdlbmVyYXRlIHRoZSBzZXJ2ZXIgaW1wbGVtZW50YXRpb24KKyAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJwcm9jZXNzIGhhbmRsZXIgKGlwcm90LCBvcHJvdCkgPSBkbyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisKKyAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJULnJlYWRNZXNzYWdlIGlwcm90ICgiIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICBwcm9jXyBoYW5kbGVyIChpcHJvdCxvcHJvdCkpIiA8PCBlbmRsOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIlAucmV0dXJuIFAuVHJ1ZSIgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd24oKTsKK30KKworYm9vbCBoYXNOb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ydmljZV8pIDw8ICJsZXQgcmVzID0gZGVmYXVsdF8iIDw8IHJlc3VsdG5hbWUgPDwgInsiCisgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBmaWVsZF9uYW1lKHJlc3VsdG5hbWUsICgqeF9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIiA9IFAuSnVzdCBlfSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiVC53cml0ZU1lc3NhZ2Ugb3Byb3QgKFwiIiA8PCB0ZnVuY3Rpb24tPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJcIiwgVC5NX1JFUExZLCBzZXFpZCkgJCIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAid3JpdGVfIiA8PCByZXN1bHRuYW1lIDw8ICIgb3Byb3QgcmVzIjsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiUC5yZXR1cm4gKCkiOworICAgICAgfQorCisgICAgICBmX3NlcnZpY2VfIDw8ICIpKSIgPDwgZW5kbDsKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBpbmRlbnRfZG93bigpOworICAgIH0KKyAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIigoXFxfIC0+IGRvIiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworCisgICAgaWYgKCF0ZnVuY3Rpb24tPmlzX29uZXdheSgpKSB7CisgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIlQud3JpdGVNZXNzYWdlIG9wcm90IChcIiIgPDwgdGZ1bmN0aW9uLT5nZXRfbmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIlwiLCBULk1fRVhDRVBUSU9OLCBzZ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N0cG9zIDwgc3RyLmxlbmd0aCgpKSB7CisgICAgICBjID0gc3RyLmF0KGxhc3Rwb3MpOworICAgICAgaWMgPSBjOworICAgICAgaWYgKCgzMiA+IGljKSB8fCAoMTI3IDwgaWMpKSB7CisgICAgICAgIGJyZWFrOworICAgICAgfQorICAgICAgKytsYXN0cG9zOworICAgIH0KKworICAgIC8vIGNvcHkgd2hhdCB3ZSBnb3Qgc28gZmFyCisgICAgaWYgKGxhc3Rwb3MgPiBmaXJzdHBvcykgeworICAgICAgcmVzdWx0IDw8IHN0ci5zdWJzdHIoZmlyc3Rwb3MsIGxhc3Rwb3MgLSBmaXJzdHBvcyk7CisgICAgICBmaXJzdHBvcyA9IGxhc3Rwb3M7CisgICAgfQorCisgICAgLy8gcmVhY2hlZCB0aGUgZW5kPworICAgIGlmIChmaXJzdHBvcyA+PSBzdHIubGVuZ3RoKCkpIHsKKyAgICAgIGJyZWFrOworICAgIH0KKworICAgIC8vIHNvbWUgY29udHJvbCBjb2RlPworICAgIGlmIChpYyA8PSAzMSkgeworICAgICAgc3dpdGNoIChjKSB7CisgICAgICBjYXNlICdccic6CisgICAgICBjYXNlICdcbic6CisgICAgICBjYXNlICdcdCc6CisgICAgICAgIHJlc3VsdCA8PCBjOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6IC8vIHNpbGVudGx5IGNvbnN1bWUgYWxsIG90aGVyIGN0cmwgY2hhcnMKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisgICAgICArK2ZpcnN0cG9zOworICAgICAgY29udGludWU7CisgICAgfQorCisgICAgLy8gcmVhY2hlZCB0aGUgZW5kPworICAgIGlmIChmaXJzdHBvcyA+PSBzdHIubGVuZ3RoKCkpIHsKKyAgICAgIGJyZWFrOworICAgIH0KKworICAgIC8vIHRyeSB0byBkZXRlY3QgaW5wdXQgZW5jb2RpbmcKKyAgICBpZiAoaW5wdXRfdHlwZV8gPT0gSU5QVVRfVU5LTk9XTikgeworICAgICAgZGV0ZWN0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JPT1RTVFJBUF9DU1MoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIvKiFcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKiBCb290c3RyYXAgdjIuMC4zXG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKlxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKiBDb3B5cmlnaHQgMjAxMiBUd2l0dGVyLCBJbmNcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UgdjIuMFxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKiBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjBcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKlxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIgKiBEZXNpZ25lZCBhbmQgYnVpbHQgd2l0aCBhbGwgdGhlIGxvdmUgaW4gdGhlIHdvcmxkIEB0d2l0dGVyIGJ5IEBtZG8gYW5kIEBmYXQuXG4iICAgICAgICAgICAgICBcCisgICIgKi9cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY2xlYXJmaXh7Knpvb206MTt9LmNsZWFyZml4OmJlZm9yZSwuY2xlYXJmaXg6YWZ0ZXJ7ZGlzcGxheTp0YWJsZTtjb250ZW50OlwiXCI7fVxuIiAgICAgICAgICAgICBcCisgICIuY2xlYXJmaXg6YWZ0ZXJ7Y2xlYXI6Ym90aDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuaGlkZS10ZXh0e2ZvbnQ6MC8wICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhO2NvbG9yOnRyYW5zcGFyZW50O3RleHQtc2hhZG93Om5vbmU7YmFja2dyb3VuZC1jb2xvcjp0cmFuc3BhcmVudDtib3JkZXI6MDt9XG4iICAgICAgICAgICAgICAgICBcCisgICIuaW5wdXQtYmxvY2stbGV2ZWx7ZGlzcGxheTpibG9jazt3aWR0aDoxMDAlO21pbi1oZWlnaHQ6MjhweDstd2Via2l0LWJveC1zaXppbmc6Ym9yZGVyLWJveDstIiAgICBcCisgICJtb3otYm94LXNpemluZzpib3JkZXItYm94Oy1tcy1ib3gtc2l6aW5nOmJvcmRlci1ib3g7Ym94LXNpemluZzpib3JkZXItYm94O31cbiIgICAgICAgICAgICAgICAgICBcCisgICJhcnRpY2xlLGFzaWRlLGRldGFpbHMsZmlnY2FwdGlvbixmaWd1cmUsZm9vdGVyLGhlYWRlcixoZ3JvdXAsbmF2LHNlY3Rpb257ZGlzcGxheTpibG9jazt9XG4iICAgICBcCisgICJhdWRpbyxjYW52YXMsdmlkZW97ZGlzcGxheTppbmxpbmUtYmxvY2s7KmRpc3BsYXk6aW5saW5lOyp6b29tOjE7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhdWRpbzpub3QoW2NvbnRyb2xzXSl7ZGlzcGxheTpub25lO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJodG1se2ZvbnQtc2l6ZToxMDAlOy13ZWJraXQtdGV4dC1zaXplLWFkanVzdDoxMDAlOy1tcy10ZXh0LXNpemUtYWRqdXN0OjEwMCU7fVxuIiAgICAgICAgICAgICAgICBcCisgICJhOmZvY3Vze291dGxpbmU6dGhpbiBkb3R0ZWQgIzMzMztvdXRsaW5lOjVweCBhdXRvICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICItd2Via2l0LWZvY3VzLXJpbmctY29sb3I7b3V0bGluZS1vZmZzZXQ6LTJweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhOmhvdmVyLGE6YWN0aXZle291dGxpbmU6MDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJzdWIsc3Vwe3Bvc2l0aW9uOnJlbGF0aXZlO2ZvbnQtc2l6ZTo3NSU7bGluZS1oZWlnaHQ6MDt2ZXJ0aWNhbC1hbGlnbjpiYXNlbGluZTt9XG4iICAgICAgICAgICAgICBcCisgICJzdXB7dG9wOi0wLjVlbTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJzdWJ7Ym90dG9tOi0wLjI1ZW07fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJpbWd7bWF4LXdpZHRoOjEwMCU7dmVydGljYWwtYWxpZ246bWlkZGxlO2JvcmRlcjowOy1tcy1pbnRlcnBvbGF0aW9uLW1vZGU6YmljdWJpYzt9XG4iICAgICAgICAgICBcCisgICJidXR0b24saW5wdXQsc2VsZWN0LHRleHRhcmVhe21hcmdpbjowO2ZvbnQtc2l6ZToxMDAlO3ZlcnRpY2FsLWFsaWduOm1pZGRsZTt9XG4iICAgICAgICAgICAgICAgICBcCisgICJidXR0b24saW5wdXR7Km92ZXJmbG93OnZpc2libGU7bGluZS1oZWlnaHQ6bm9ybWFsO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJidXR0b246Oi1tb3otZm9jdXMtaW5uZXIsaW5wdXQ6Oi1tb3otZm9jdXMtaW5uZXJ7cGFkZGluZzowO2JvcmRlcjowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJidXR0b24saW5wdXRbdHlwZT1cImJ1dHRvblwiXSxpbnB1dFt0eXBlPVwicmVzZXRcIl0saW5wdXRbdHlwZT1cInN1Ym1pdFwiXXtjdXJzb3I6cG9pbnRlcjstIiAgICBcCisgICJ3ZWJraXQtYXBwZWFyYW5jZTpidXR0b247fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJpbnB1dFt0eXBlPVwic2VhcmNoXCJdey13ZWJraXQtYm94LXNpemluZzpjb250ZW50LWJveDstbW96LWJveC1zaXppbmc6Y29udGVudC1ib3g7Ym94LXNpemluZzoiICBcCisgICJjb250ZW50LWJveDstd2Via2l0LWFwcGVhcmFuY2U6dGV4dGZpZWxkO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJpbnB1dFt0eXBlPVwic2VhcmNoXCJdOjotd2Via2l0LXNlYXJjaC1kZWNvcmF0aW9uLGlucHV0W3R5cGU9XCJzZWFyY2hcIl06Oi13ZWJraXQtc2VhcmNoLSIgICAgICBcCisgICJjYW5jZWwtYnV0dG9uey13ZWJraXQtYXBwZWFyYW5jZTpub25lO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0ZXh0YXJlYXtvdmVyZmxvdzphdXRvO3ZlcnRpY2FsLWFsaWduOnRvcDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJib2R5e21hcmdpbjowO2ZvbnQtZmFtaWx5OlwiSGVsdmV0aWNhICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJOZXVlXCIsSGVsdmV0aWNhLEFyaWFsLHNhbnMtc2VyaWY7Zm9udC1zaXplOjEzcHg7bGluZS1oZWlnaHQ6MThweDtjb2xvcjojMzMzMzMzO2JhY2tncm91bmQtIiAgICBcCisgICJjb2xvcjojZmZmZmZmO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhe2NvbG9yOiMwMDg4Y2M7dGV4dC1kZWNvcmF0aW9uOm5vbmU7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhOmhvdmVye2NvbG9yOiMwMDU1ODA7dGV4dC1kZWNvcmF0aW9uOnVuZGVybGluZTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93e21hcmdpbi1sZWZ0Oi0yMHB4Oyp6b29tOjE7fS5yb3c6YmVmb3JlLC5yb3c6YWZ0ZXJ7ZGlzcGxheTp0YWJsZTtjb250ZW50OlwiXCI7fVxuIiAgICAgICAgICBcCisgICIucm93OmFmdGVye2NsZWFyOmJvdGg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJbY2xhc3MqPVwic3BhblwiXXtmbG9hdDpsZWZ0O21hcmdpbi1sZWZ0OjIwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY29udGFpbmVyLC5uYXZiYXItZml4ZWQtdG9wIC5jb250YWluZXIsLm5hdmJhci1maXhlZC1ib3R0b20gLmNvbnRhaW5lcnt3aWR0aDo5NDBweDt9XG4iICAgICAgICBcCisgICIuc3BhbjEye3dpZHRoOjk0MHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjExe3dpZHRoOjg2MHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjEwe3dpZHRoOjc4MHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3Bhbjl7d2lkdGg6NzAwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3Bhbjh7d2lkdGg6NjIwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3Bhbjd7d2lkdGg6NTQwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjZ7d2lkdGg6NDYwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjV7d2lkdGg6MzgwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjR7d2lkdGg6MzAwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjN7d2lkdGg6MjIwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjJ7d2lkdGg6MTQwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuc3BhbjF7d2lkdGg6NjBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0MTJ7bWFyZ2luLWxlZnQ6OTgwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0MTF7bWFyZ2luLWxlZnQ6OTAwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0MTB7bWFyZ2luLWxlZnQ6ODIwcHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0OXttYXJnaW4tbGVmdDo3NDBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0OHttYXJnaW4tbGVmdDo2NjBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0N3ttYXJnaW4tbGVmdDo1ODBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0NnttYXJnaW4tbGVmdDo1MDBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0NXttYXJnaW4tbGVmdDo0MjBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0NHttYXJnaW4tbGVmdDozNDBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0M3ttYXJnaW4tbGVmdDoyNjBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0MnttYXJnaW4tbGVmdDoxODBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIub2Zmc2V0MXttYXJnaW4tbGVmdDoxMDBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlke3dpZHRoOjEwMCU7Knpvb206MTt9LnJvdy1mbHVpZDpiZWZvcmUsLnJvdy1mbHVpZDphZnRlcntkaXNwbGF5OnRhYmxlO2NvbnRlbnQ6XCJcIjt9IiBcCisgICJcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkOmFmdGVye2NsZWFyOmJvdGg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJbY2xhc3MqPVwic3BhblwiXXtkaXNwbGF5OmJsb2NrO3dpZHRoOjEwMCU7bWluLWhlaWdodDoyOHB4Oy13ZWJraXQtYm94LXNpemluZzpib3JkZXItYm94Oy1tb3otIiBcCisgICJib3gtc2l6aW5nOmJvcmRlci1ib3g7LW1zLWJveC1zaXppbmc6Ym9yZGVyLWJveDtib3gtc2l6aW5nOmJvcmRlci1ib3g7ZmxvYXQ6bGVmdDttYXJnaW4tbGVmdDoiICBcCisgICIyLjEyNzY1OTU3NCU7Km1hcmdpbi1sZWZ0OjIuMDc0NDY4MDg0NjM4Mjk3NyU7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIFtjbGFzcyo9XCJzcGFuXCJdOmZpcnN0LWNoaWxke21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuMTJ7d2lkdGg6OTkuOTk5OTk5OTg5OTk5OTklOyp3aWR0aDo5OS45NDY4MDg1MDA2MzgyOCU7fVxuIiAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuMTF7d2lkdGg6OTEuNDg5MzYxNjkzJTsqd2lkdGg6OTEuNDM2MTcwMjAzNjM4MyU7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuMTB7d2lkdGg6ODIuOTc4NzIzMzk1OTk5OTklOyp3aWR0aDo4Mi45MjU1MzE5MDY2MzgyOCU7fVxuIiAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuOXt3aWR0aDo3NC40NjgwODUwOTklOyp3aWR0aDo3NC40MTQ4OTM2MDk2MzgzJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuOHt3aWR0aDo2NS45NTc0NDY4MDE5OTk5OSU7KndpZHRoOjY1LjkwNDI1NTMxMjYzODI4JTt9XG4iICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuN3t3aWR0aDo1Ny40NDY4MDg1MDUlOyp3aWR0aDo1Ny4zOTM2MTcwMTU2MzgzJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuNnt3aWR0aDo0OC45MzYxNzAyMDc5OTk5OSU7KndpZHRoOjQ4Ljg4Mjk3ODcxODYzODI5JTt9XG4iICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuNXt3aWR0aDo0MC40MjU1MzE5MTElOyp3aWR0aDo0MC4zNzIzNDA0MjE2MzgzJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuNHt3aWR0aDozMS45MTQ4OTM2MTQlOyp3aWR0aDozMS44NjE3MDIxMjQ2MzgzJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuM3t3aWR0aDoyMy40MDQyNTUzMTclOyp3aWR0aDoyMy4zNTEwNjM4Mjc2MzgzJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuMnt3aWR0aDoxNC44OTM2MTcwMiU7KndpZHRoOjE0Ljg0MDQyNTUzMDYzODMlO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucm93LWZsdWlkIC5zcGFuMXt3aWR0aDo2LjM4Mjk3ODcyMyU7KndpZHRoOjYuMzI5Nzg3MjMzNjM4Mjk4JTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY29udGFpbmVye21hcmdpbi1yaWdodDphdXRvO21hcmdpbi1sZWZ0OmF1dG87Knpvb206MTt9LmNvbnRhaW5lcjpiZWZvcmUsLmNvbnRhaW5lcjphZnRlcnsiICAgICBcCisgICJkaXNwbGF5OnRhYmxlO2NvbnRlbnQ6XCJcIjt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY29udGFpbmVyOmFmdGVye2NsZWFyOmJvdGg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY29udGFpbmVyLWZsdWlke3BhZGRpbmctcmlnaHQ6MjBweDtwYWRkaW5nLWxlZnQ6MjBweDsqem9vbToxO30uY29udGFpbmVyLWZsdWlkOmJlZm9yZSwuIiAgICAgICBcCisgICJjb250YWluZXItZmx1aWQ6YWZ0ZXJ7ZGlzcGxheTp0YWJsZTtjb250ZW50OlwiXCI7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuY29udGFpbmVyLWZsdWlkOmFmdGVye2NsZWFyOmJvdGg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJwe21hcmdpbjowIDAgOXB4O2ZvbnQtZmFtaWx5OlwiSGVsdmV0aWNhICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJOZXVlXCIsSGVsdmV0aWNhLEFyaWFsLHNhbnMtc2VyaWY7Zm9udC1zaXplOjEzcHg7bGluZS1oZWlnaHQ6MThweDt9cCAiICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJzbWFsbHtmb250LXNpemU6MTFweDtjb2xvcjojOTk5OTk5O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGVhZHttYXJnaW4tYm90dG9tOjE4cHg7Zm9udC1zaXplOjIwcHg7Zm9udC13ZWlnaHQ6MjAwO2xpbmUtaGVpZ2h0OjI3cHg7fVxuIiAgICAgICAgICAgICAgICAgICBcCisgICJoMSxoMixoMyxoNCxoNSxoNnttYXJnaW46MDtmb250LWZhbWlseTppbmhlcml0O2ZvbnQtd2VpZ2h0OmJvbGQ7Y29sb3I6aW5oZXJpdDt0ZXh0LXJlbmRlcmluZzoiICBcCisgICJvcHRpbWl6ZWxlZ2liaWxpdHk7fWgxIHNtYWxsLGgyIHNtYWxsLGgzIHNtYWxsLGg0IHNtYWxsLGg1IHNtYWxsLGg2ICIgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJzbWFsbHtmb250LXdlaWdodDpub3JtYWw7Y29sb3I6Izk5OTk5OTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoMXtmb250LXNpemU6MzBweDtsaW5lLWhlaWdodDozNnB4O31oMSBzbWFsbHtmb250LXNpemU6MThweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoMntmb250LXNpemU6MjRweDtsaW5lLWhlaWdodDozNnB4O31oMiBzbWFsbHtmb250LXNpemU6MThweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoM3tmb250LXNpemU6MThweDtsaW5lLWhlaWdodDoyN3B4O31oMyBzbWFsbHtmb250LXNpemU6MTRweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoNCxoNSxoNntsaW5lLWhlaWdodDoxOHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoNHtmb250LXNpemU6MTRweDt9aDQgc21hbGx7Zm9udC1zaXplOjEycHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoNXtmb250LXNpemU6MTJweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJoNntmb250LXNpemU6MTFweDtjb2xvcjojOTk5OTk5O3RleHQtdHJhbnNmb3JtOnVwcGVyY2FzZTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIucGFnZS1oZWFkZXJ7cGFkZGluZy1ib3R0b206MTdweDttYXJnaW46MThweCAwO2JvcmRlci1ib3R0b206MXB4IHNvbGlkICNlZWVlZWU7fVxuIiAgICAgICAgICAgICBcCisgICIucGFnZS1oZWFkZXIgaDF7bGluZS1oZWlnaHQ6MTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ1bCxvbHtwYWRkaW5nOjA7bWFyZ2luOjAgMCA5cHggMjVweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ1bCB1bCx1bCBvbCxvbCBvbCxvbCB1bHttYXJnaW4tYm90dG9tOjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ1bHtsaXN0LXN0eWxlOmRpc2M7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJvbHtsaXN0LXN0eWxlOmRlY2ltYWw7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJsaXtsaW5lLWhlaWdodDoxOHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ1bC51bnN0eWxlZCxvbC51bnN0eWxlZHttYXJnaW4tbGVmdDowO2xpc3Qtc3R5bGU6bm9uZTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJkbHttYXJnaW4tYm90dG9tOjE4cHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJkdCxkZHtsaW5lLWhlaWdodDoxOHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJkdHtmb250LXdlaWdodDpib2xkO2xpbmUtaGVpZ2h0OjE3cHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJkZHttYXJnaW4tbGVmdDo5cHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuZGwtaG9yaXpvbnRhbCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJkdHtmbG9hdDpsZWZ0O3dpZHRoOjEyMHB4O2NsZWFyOmxlZnQ7dGV4dC1hbGlnbjpyaWdodDtvdmVyZmxvdzpoaWRkZW47dGV4dC1vdmVyZmxvdzplbGxpcHNpczsiICBcCisgICJ3aGl0ZS1zcGFjZTpub3dyYXA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIuZGwtaG9yaXpvbnRhbCBkZHttYXJnaW4tbGVmdDoxMzBweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJocnttYXJnaW46MThweCAwO2JvcmRlcjowO2JvcmRlci10b3A6MXB4IHNvbGlkICNlZWVlZWU7Ym9yZGVyLWJvdHRvbToxcHggc29saWQgI2ZmZmZmZjt9XG4iICAgICBcCisgICJzdHJvbmd7Zm9udC13ZWlnaHQ6Ym9sZDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJlbXtmb250LXN0eWxlOml0YWxpYzt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubXV0ZWR7Y29sb3I6Izk5OTk5OTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhYmJyW3RpdGxlXXtjdXJzb3I6aGVscDtib3JkZXItYm90dG9tOjFweCBkb3R0ZWQgI2RkZDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhYmJyLmluaXRpYWxpc217Zm9udC1zaXplOjkwJTt0ZXh0LXRyYW5zZm9ybTp1cHBlcmNhc2U7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJibG9ja3F1b3Rle3BhZGRpbmc6MCAwIDAgMTVweDttYXJnaW46MCAwIDE4cHg7Ym9yZGVyLWxlZnQ6NXB4IHNvbGlkICNlZWVlZWU7fWJsb2NrcXVvdGUgIiAgICAgICBcCisgICJwe21hcmdpbi1ib3R0b206MDtmb250LXNpemU6MTZweDtmb250LXdlaWdodDozMDA7bGluZS1oZWlnaHQ6MjIuNXB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJibG9ja3F1b3RlIHNtYWxse2Rpc3BsYXk6YmxvY2s7bGluZS1oZWlnaHQ6MThweDtjb2xvcjojOTk5OTk5O31ibG9ja3F1b3RlICIgICAgICAgICAgICAgICAgICAgICBcCisgICJzbWFsbDpiZWZvcmV7Y29udGVudDonXFwyMDE0IFxcMDBBMCc7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJibG9ja3F1b3RlLnB1bGwtcmlnaHR7ZmxvYXQ6cmlnaHQ7cGFkZGluZy1yaWdodDoxNXB4O3BhZGRpbmctbGVmdDowO2JvcmRlci1yaWdodDo1cHggc29saWQgIiAgICBcCisgICIjZWVlZWVlO2JvcmRlci1sZWZ0OjA7fWJsb2NrcXVvdGUucHVsbC1yaWdodCBwLGJsb2NrcXVvdGUucHVsbC1yaWdodCAiICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJzbWFsbHt0ZXh0LWFsaWduOnJpZ2h0O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJxOmJlZm9yZSxxOmFmdGVyLGJsb2NrcXVvdGU6YmVmb3JlLGJsb2NrcXVvdGU6YWZ0ZXJ7Y29udGVudDpcIlwiO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJhZGRyZXNze2Rpc3BsYXk6YmxvY2s7bWFyZ2luLWJvdHRvbToxOHB4O2ZvbnQtc3R5bGU6bm9ybWFsO2xpbmUtaGVpZ2h0OjE4cHg7fVxuIiAgICAgICAgICAgICAgICBcCisgICJzbWFsbHtmb250LXNpemU6MTAwJTt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJjaXRle2ZvbnQtc3R5bGU6bm9ybWFsO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJjb2RlLHByZXtwYWRkaW5nOjAgM3B4IDJweDtmb250LWZhbWlseTpNZW5sbyxNb25hY28sQ29uc29sYXMsXCJDb3VyaWVyICIgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJOZXdcIixtb25vc3BhY2U7Zm9udC1zaXplOjEycHg7Y29sb3I6IzMzMzMzMzstd2Via2l0LWJvcmRlci1yYWRpdXM6M3B4Oy1tb3otYm9yZGVyLXJhZGl1czozcHg7IiBcCisgICJib3JkZXItcmFkaXVzOjNweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJjb2Rle3BhZGRpbmc6MnB4IDRweDtjb2xvcjojZDE0O2JhY2tncm91bmQtY29sb3I6I2Y3ZjdmOTtib3JkZXI6MXB4IHNvbGlkICNlMWUxZTg7fVxuIiAgICAgICAgICBcCisgICJwcmV7ZGlzcGxheTpibG9jaztwYWRkaW5nOjguNXB4O21hcmdpbjowIDAgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICI5cHg7Zm9udC1zaXplOjEyLjAyNXB4O2xpbmUtaGVpZ2h0OjE4cHg7d29yZC1icmVhazpicmVhay1hbGw7d29yZC13cmFwOmJyZWFrLXdvcmQ7d2hpdGUtc3BhY2U6IiBcCisgICJwcmU7d2hpdGUtc3BhY2U6cHJlLXdyYXA7YmFja2dyb3VuZC1jb2xvcjojZjVmNWY1O2JvcmRlcjoxcHggc29saWQgI2NjYztib3JkZXI6MXB4IHNvbGlkICIgICAgICBcCisgICJyZ2JhKDAsIDAsIDAsICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIwLjE1KTstd2Via2l0LWJvcmRlci1yYWRpdXM6NHB4Oy1tb3otYm9yZGVyLXJhZGl1czo0cHg7Ym9yZGVyLXJhZGl1czo0cHg7fXByZS5wcmV0dHlwcmludHsiICAgICBcCisgICJtYXJnaW4tYm90dG9tOjE4cHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJwcmUgY29kZXtwYWRkaW5nOjA7Y29sb3I6aW5oZXJpdDtiYWNrZ3JvdW5kLWNvbG9yOnRyYW5zcGFyZW50O2JvcmRlcjowO31cbiIgICAgICAgICAgICAgICAgICAgICBcCisgICIucHJlLXNjcm9sbGFibGV7bWF4LWhlaWdodDozNDBweDtvdmVyZmxvdy15OnNjcm9sbDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwsLmJhZGdle2ZvbnQtc2l6ZToxMC45OThweDtmb250LXdlaWdodDpib2xkO2xpbmUtaGVpZ2h0OjE0cHg7Y29sb3I6I2ZmZmZmZjt2ZXJ0aWNhbC0iICAgICBcCisgICJhbGlnbjpiYXNlbGluZTt3aGl0ZS1zcGFjZTpub3dyYXA7dGV4dC1zaGFkb3c6MCAtMXB4IDAgcmdiYSgwLCAwLCAwLCAiICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIwLjI1KTtiYWNrZ3JvdW5kLWNvbG9yOiM5OTk5OTk7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWx7cGFkZGluZzoxcHggNHB4ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIycHg7LXdlYmtpdC1ib3JkZXItcmFkaXVzOjNweDstbW96LWJvcmRlci1yYWRpdXM6M3B4O2JvcmRlci1yYWRpdXM6M3B4O31cbiIgICAgICAgICAgICAgICAgICAgICBcCisgICIuYmFkZ2V7cGFkZGluZzoxcHggOXB4ICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIycHg7LXdlYmtpdC1ib3JkZXItcmFkaXVzOjlweDstbW96LWJvcmRlci1yYWRpdXM6OXB4O2JvcmRlci1yYWRpdXM6OXB4O31cbiIgICAgICAgICAgICAgICAgICAgICBcCisgICJhLmxhYmVsOmhvdmVyLGEuYmFkZ2U6aG92ZXJ7Y29sb3I6I2ZmZmZmZjt0ZXh0LWRlY29yYXRpb246bm9uZTtjdXJzb3I6cG9pbnRlcjt9XG4iICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW1wb3J0YW50LC5iYWRnZS1pbXBvcnRhbnR7YmFja2dyb3VuZC1jb2xvcjojYjk0YTQ4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW1wb3J0YW50W2hyZWZdLC5iYWRnZS1pbXBvcnRhbnRbaHJlZl17YmFja2dyb3VuZC1jb2xvcjojOTUzYjM5O31cbiIgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtd2FybmluZywuYmFkZ2Utd2FybmluZ3tiYWNrZ3JvdW5kLWNvbG9yOiNmODk0MDY7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtd2FybmluZ1tocmVmXSwuYmFkZ2Utd2FybmluZ1tocmVmXXtiYWNrZ3JvdW5kLWNvbG9yOiNjNjc2MDU7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtc3VjY2VzcywuYmFkZ2Utc3VjY2Vzc3tiYWNrZ3JvdW5kLWNvbG9yOiM0Njg4NDc7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtc3VjY2Vzc1tocmVmXSwuYmFkZ2Utc3VjY2Vzc1tocmVmXXtiYWNrZ3JvdW5kLWNvbG9yOiMzNTY2MzU7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW5mbywuYmFkZ2UtaW5mb3tiYWNrZ3JvdW5kLWNvbG9yOiMzYTg3YWQ7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW5mb1tocmVmXSwuYmFkZ2UtaW5mb1tocmVmXXtiYWNrZ3JvdW5kLWNvbG9yOiMyZDY5ODc7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW52ZXJzZSwuYmFkZ2UtaW52ZXJzZXtiYWNrZ3JvdW5kLWNvbG9yOiMzMzMzMzM7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIubGFiZWwtaW52ZXJzZVtocmVmXSwuYmFkZ2UtaW52ZXJzZVtocmVmXXtiYWNrZ3JvdW5kLWNvbG9yOiMxYTFhMWE7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZXttYXgtd2lkdGg6MTAwJTtiYWNrZ3JvdW5kLWNvbG9yOnRyYW5zcGFyZW50O2JvcmRlci1jb2xsYXBzZTpjb2xsYXBzZTtib3JkZXItc3BhY2luZzowO30iICBcCisgICJcbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGV7d2lkdGg6MTAwJTttYXJnaW4tYm90dG9tOjE4cHg7fS50YWJsZSB0aCwudGFibGUgIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0ZHtwYWRkaW5nOjhweDtsaW5lLWhlaWdodDoxOHB4O3RleHQtYWxpZ246bGVmdDt2ZXJ0aWNhbC1hbGlnbjp0b3A7Ym9yZGVyLXRvcDoxcHggc29saWQgIiAgICAgICBcCisgICIjZGRkZGRkO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUgdGh7Zm9udC13ZWlnaHQ6Ym9sZDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUgdGhlYWQgdGh7dmVydGljYWwtYWxpZ246Ym90dG9tO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUgY2FwdGlvbit0aGVhZCB0cjpmaXJzdC1jaGlsZCB0aCwudGFibGUgY2FwdGlvbit0aGVhZCB0cjpmaXJzdC1jaGlsZCB0ZCwudGFibGUgIiAgICAgICAgICBcCisgICJjb2xncm91cCt0aGVhZCB0cjpmaXJzdC1jaGlsZCB0aCwudGFibGUgY29sZ3JvdXArdGhlYWQgdHI6Zmlyc3QtY2hpbGQgdGQsLnRhYmxlICIgICAgICAgICAgICAgICBcCisgICJ0aGVhZDpmaXJzdC1jaGlsZCB0cjpmaXJzdC1jaGlsZCB0aCwudGFibGUgdGhlYWQ6Zmlyc3QtY2hpbGQgdHI6Zmlyc3QtY2hpbGQgIiAgICAgICAgICAgICAgICAgICBcCisgICJ0ZHtib3JkZXItdG9wOjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUgdGJvZHkrdGJvZHl7Ym9yZGVyLXRvcDoycHggc29saWQgI2RkZGRkZDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtY29uZGVuc2VkIHRoLC50YWJsZS1jb25kZW5zZWQgdGR7cGFkZGluZzo0cHggNXB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWR7Ym9yZGVyOjFweCBzb2xpZCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIjZGRkZGRkO2JvcmRlci1jb2xsYXBzZTpzZXBhcmF0ZTsqYm9yZGVyLWNvbGxhcHNlOmNvbGxhcHNlZDtib3JkZXItbGVmdDowOy13ZWJraXQtYm9yZGVyLSIgICAgICBcCisgICJyYWRpdXM6NHB4Oy1tb3otYm9yZGVyLXJhZGl1czo0cHg7Ym9yZGVyLXJhZGl1czo0cHg7fS50YWJsZS1ib3JkZXJlZCB0aCwudGFibGUtYm9yZGVyZWQgIiAgICAgICBcCisgICJ0ZHtib3JkZXItbGVmdDoxcHggc29saWQgI2RkZGRkZDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWQgY2FwdGlvbit0aGVhZCB0cjpmaXJzdC1jaGlsZCB0aCwudGFibGUtYm9yZGVyZWQgY2FwdGlvbit0Ym9keSB0cjpmaXJzdC1jaGlsZCAiICBcCisgICJ0aCwudGFibGUtYm9yZGVyZWQgY2FwdGlvbit0Ym9keSB0cjpmaXJzdC1jaGlsZCB0ZCwudGFibGUtYm9yZGVyZWQgY29sZ3JvdXArdGhlYWQgIiAgICAgICAgICAgICBcCisgICJ0cjpmaXJzdC1jaGlsZCB0aCwudGFibGUtYm9yZGVyZWQgY29sZ3JvdXArdGJvZHkgdHI6Zmlyc3QtY2hpbGQgdGgsLnRhYmxlLWJvcmRlcmVkICIgICAgICAgICAgICBcCisgICJjb2xncm91cCt0Ym9keSB0cjpmaXJzdC1jaGlsZCB0ZCwudGFibGUtYm9yZGVyZWQgdGhlYWQ6Zmlyc3QtY2hpbGQgdHI6Zmlyc3QtY2hpbGQgIiAgICAgICAgICAgICBcCisgICJ0aCwudGFibGUtYm9yZGVyZWQgdGJvZHk6Zmlyc3QtY2hpbGQgdHI6Zmlyc3QtY2hpbGQgdGgsLnRhYmxlLWJvcmRlcmVkIHRib2R5OmZpcnN0LWNoaWxkICIgICAgICBcCisgICJ0cjpmaXJzdC1jaGlsZCB0ZHtib3JkZXItdG9wOjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWQgdGhlYWQ6Zmlyc3QtY2hpbGQgdHI6Zmlyc3QtY2hpbGQgdGg6Zmlyc3QtY2hpbGQsLnRhYmxlLWJvcmRlcmVkICIgICAgICAgICAgICAgICBcCisgICJ0Ym9keTpmaXJzdC1jaGlsZCB0cjpmaXJzdC1jaGlsZCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0ZDpmaXJzdC1jaGlsZHstd2Via2l0LWJvcmRlci10b3AtbGVmdC1yYWRpdXM6NHB4O2JvcmRlci10b3AtbGVmdC1yYWRpdXM6NHB4Oy1tb3otYm9yZGVyLSIgICAgICBcCisgICJyYWRpdXMtdG9wbGVmdDo0cHg7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWQgdGhlYWQ6Zmlyc3QtY2hpbGQgdHI6Zmlyc3QtY2hpbGQgdGg6bGFzdC1jaGlsZCwudGFibGUtYm9yZGVyZWQgIiAgICAgICAgICAgICAgICBcCisgICJ0Ym9keTpmaXJzdC1jaGlsZCB0cjpmaXJzdC1jaGlsZCAiICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0ZDpsYXN0LWNoaWxkey13ZWJraXQtYm9yZGVyLXRvcC1yaWdodC1yYWRpdXM6NHB4O2JvcmRlci10b3AtcmlnaHQtcmFkaXVzOjRweDstbW96LWJvcmRlci0iICAgICBcCisgICJyYWRpdXMtdG9wcmlnaHQ6NHB4O31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWQgdGhlYWQ6bGFzdC1jaGlsZCB0cjpsYXN0LWNoaWxkIHRoOmZpcnN0LWNoaWxkLC50YWJsZS1ib3JkZXJlZCAiICAgICAgICAgICAgICAgICBcCisgICJ0Ym9keTpsYXN0LWNoaWxkIHRyOmxhc3QtY2hpbGQgdGQ6Zmlyc3QtY2hpbGR7LXdlYmtpdC1ib3JkZXItcmFkaXVzOjAgMCAwICIgICAgICAgICAgICAgICAgICAgICBcCisgICI0cHg7LW1vei1ib3JkZXItcmFkaXVzOjAgMCAwIDRweDtib3JkZXItcmFkaXVzOjAgMCAwICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICI0cHg7LXdlYmtpdC1ib3JkZXItYm90dG9tLWxlZnQtcmFkaXVzOjRweDtib3JkZXItYm90dG9tLWxlZnQtcmFkaXVzOjRweDstbW96LWJvcmRlci1yYWRpdXMtIiAgICBcCisgICJib3R0b21sZWZ0OjRweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtYm9yZGVyZWQgdGhlYWQ6bGFzdC1jaGlsZCB0cjpsYXN0LWNoaWxkIHRoOmxhc3QtY2hpbGQsLnRhYmxlLWJvcmRlcmVkIHRib2R5Omxhc3QtY2hpbGQgIiBcCisgICJ0cjpsYXN0LWNoaWxkICIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0ZDpsYXN0LWNoaWxkey13ZWJraXQtYm9yZGVyLWJvdHRvbS1yaWdodC1yYWRpdXM6NHB4O2JvcmRlci1ib3R0b20tcmlnaHQtcmFkaXVzOjRweDstbW96LSIgICAgICBcCisgICJib3JkZXItcmFkaXVzLWJvdHRvbXJpZ2h0OjRweDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUtc3RyaXBlZCB0Ym9keSB0cjpudGgtY2hpbGQob2RkKSB0ZCwudGFibGUtc3RyaXBlZCB0Ym9keSB0cjpudGgtY2hpbGQob2RkKSAiICAgICAgICAgICAgICBcCisgICJ0aHtiYWNrZ3JvdW5kLWNvbG9yOiNmOWY5Zjk7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICIudGFibGUgdGJvZHkgdHI6aG92ZXIgdGQsLnRhYmxlIHRib2R5IHRyOmhvdmVyIHRoe2JhY2tncm91bmQtY29sb3I6I2Y1ZjVmNTt9XG4iICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjF7ZmxvYXQ6bm9uZTt3aWR0aDo0NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjJ7ZmxvYXQ6bm9uZTt3aWR0aDoxMjRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjN7ZmxvYXQ6bm9uZTt3aWR0aDoyMDRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjR7ZmxvYXQ6bm9uZTt3aWR0aDoyODRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjV7ZmxvYXQ6bm9uZTt3aWR0aDozNjRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjZ7ZmxvYXQ6bm9uZTt3aWR0aDo0NDRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3Bhbjd7ZmxvYXQ6bm9uZTt3aWR0aDo1MjRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3Bhbjh7ZmxvYXQ6bm9uZTt3aWR0aDo2MDRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3Bhbjl7ZmxvYXQ6bm9uZTt3aWR0aDo2ODRweDttYXJnaW4tbGVmdDowO31cbiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjEwe2Zsb2F0Om5vbmU7d2lkdGg6NzY0cHg7bWFyZ2luLWxlZnQ6MDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjExe2Zsb2F0Om5vbmU7d2lkdGg6ODQ0cHg7bWFyZ2luLWxlZnQ6MDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjEye2Zsb2F0Om5vbmU7d2lkdGg6OTI0cHg7bWFyZ2luLWxlZnQ6MDt9XG4iICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjEze2Zsb2F0Om5vbmU7d2lkdGg6MTAwNHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE0e2Zsb2F0Om5vbmU7d2lkdGg6MTA4NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE1e2Zsb2F0Om5vbmU7d2lkdGg6MTE2NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE2e2Zsb2F0Om5vbmU7d2lkdGg6MTI0NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE3e2Zsb2F0Om5vbmU7d2lkdGg6MTMyNHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE4e2Zsb2F0Om5vbmU7d2lkdGg6MTQwNHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjE5e2Zsb2F0Om5vbmU7d2lkdGg6MTQ4NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICJ0YWJsZSAuc3BhbjIwe2Zsb2F0Om5vbmU7d2lkdGg6MTU2NHB4O21hcmdpbi1sZWZ0OjA7fVxuIiAgICAgICAgICAgICAgICAgICAgICAgIC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Y29uZC5jb21wYXJlKCJ1bmRhdGVkIikgPT0gMCkgeworICAgICAgICAgIHVuZGF0ZWRfZ2VuZXJhdGVkX2Fubm90YXRpb25zXyAgPSB0cnVlOworICAgICAgICB9IGVsc2UgaWYoaXRlci0+c2Vjb25kLmNvbXBhcmUoInN1cHByZXNzIikgPT0gMCkgeworICAgICAgICAgIHN1cHByZXNzX2dlbmVyYXRlZF9hbm5vdGF0aW9uc18gPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHRocm93ICJ1bmtub3duIG9wdGlvbiBqYXZhOiIgKyBpdGVyLT5maXJzdCArICI9IiArIGl0ZXItPnNlY29uZDsKKyAgICAgICAgfQorICAgICAgfSBlbHNlIGlmKCBpdGVyLT5maXJzdC5jb21wYXJlKCJ1bnNhZmVfYmluYXJpZXMiKSA9PSAwKSB7CisgICAgICAgIHVuc2FmZV9iaW5hcmllc18gPSB0cnVlOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgdGhyb3cgInVua25vd24gb3B0aW9uIGphdmE6IiArIGl0ZXItPmZpcnN0OworICAgICAgfQorICAgIH0KKworICAgIGlmIChqYXZhNV8pIHsKKyAgICAgIGFuZHJvaWRfbGVnYWN5XyA9IHRydWU7CisgICAgfQorCisgICAgb3V0X2Rpcl9iYXNlXyA9IChiZWFuX3N0eWxlXyA/ICJnZW4tamF2YWJlYW4iIDogImdlbi1qYXZhIik7CisgIH0KKworICAvKioKKyAgICogSW5pdCBhbmQgY2xvc2UgbWV0aG9kcworICAgKi8KKworICB2b2lkIGluaXRfZ2VuZXJhdG9yKCk7CisgIHZvaWQgY2xvc2VfZ2VuZXJhdG9yKCk7CisKKyAgdm9pZCBnZW5lcmF0ZV9jb25zdHMoc3RkOjp2ZWN0b3I8dF9jb25zdCo+IGNvbnN0cyk7CisKKyAgLyoqCisgICAqIFByb2dyYW0tbGV2ZWwgZ2VuZXJhdGlvbiBmdW5jdGlvbnMKKyAgICovCisKKyAgdm9pZCBnZW5lcmF0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lhbGl6YXRpb24gY29uc3RydWN0cworICAgKi8KKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KHN0ZDo6b3N0cmVhbSYgb3V0LCB0X3N0cnVjdCogdHN0cnVjdCwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEgPSB0cnVlKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3NldF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0c2V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG9iaiA9ICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9tYXBfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBvYmogPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgb2JqID0gIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZmllbGQqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KHN0ZDo6b3N0cmVhbSYgb3V0LCB0X3N0cnVjdCogdHN0cnVjdCwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhID0gdHJ1ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfc2V0X2VsZW1lbnQoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2V0KiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSA9IHRydWUpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEgPSB0cnVlKTsKKworICB2b2lkIGdlbmVyYXRlX2RlZXBfY29weV9jb250YWluZXIoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzb3VyY2VfbmFtZV9wMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNvdXJjZV9uYW1lX3AyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcmVzdWx0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpOworICB2b2lkIGdlbmVyYXRlX2RlZXBfY29weV9ub25fY29udGFpbmVyKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNvdXJjZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc3RfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpOworCisgIGVudW0gaXNzZXRfdHlwZSB7IElTU0VUX05PTkUsIElTU0VUX1BSSU1JVElWRSwgSVNTRVRfQklUU0VUIH07CisgIGlzc2V0X3R5cGUgbmVlZHNfaXNzZXQodF9zdHJ1Y3QqIHRzdHJ1Y3QsIHN0ZDo6c3RyaW5nKiBvdXRQcmltaXRpdmVUeXBlID0gTlVMTCk7CisKKyAgLyoqCisgICAqIEhlbHBlciByZW5kZXJpbmcgZnVuY3Rpb25zCisgICAqLworCisgIHN0ZDo6c3RyaW5nIGphdmFfcGFja2FnZSgpOworICBzdGQ6OnN0cmluZyBqYXZhX3N1cHByZXNzaW9ucygpOworICBzdGQ6OnN0cmluZyBqYXZhX251bGxhYmxlX2Fubm90YXRpb24oKTsKKyAgc3RkOjpzdHJpbmcgdHlwZV9uYW1lKHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2NvbnRhaW5lciA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9pbml0ID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIHNraXBfZ2VuZXJpYyA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBmb3JjZV9uYW1lc3BhY2UgPSBmYWxzZSk7CisgIHN0ZDo6c3RyaW5nIGJhc2VfdHlwZV9uYW1lKHRfYmFzZV90eXBlKiB0YmFzZSwgYm9vbCBpbl9jb250YWluZXIgPSBmYWxzZSk7CisgIHN0ZDo6c3RyaW5nIGRlY2xhcmVfZmllbGQodF9maWVsZCogdGZpZWxkLCBib29sIGluaXQgPSBmYWxzZSwgYm9vbCBjb21tZW50ID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBmdW5jdGlvbl9zaWduYXR1cmUodF9mdW5jdGlvbiogdGZ1bmN0aW9uLCBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisgIHN0ZDo6c3RyaW5nIGZ1bmN0aW9uX3NpZ25hdHVyZV9hc3luYyh0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHVzZV9iYXNlX21ldGhvZCA9IGZhbHNlLAorICAgICAgICAgICAgICAgICAgICA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hbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9zdGF0aWMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVmdmFsKSB7CisgIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHR5cGUpOworCisgIGluZGVudChvdXQpOworICBpZiAoIWRlZnZhbCkgeworICAgIG91dCA8PCAoaW5fc3RhdGljID8gIiIgOiAicHVibGljIHN0YXRpYyBmaW5hbCAiKSA8PCB0eXBlX25hbWUodHlwZSkgPDwgIiAiOworICB9CisgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIHN0cmluZyB2MiA9IHJlbmRlcl9jb25zdF92YWx1ZShvdXQsIHR5cGUsIHZhbHVlKTsKKyAgICBvdXQgPDwgbmFtZSA8PCAiID0gIiA8PCB2MiA8PCAiOyIgPDwgZW5kbCA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkgeworICAgIG91dCA8PCBuYW1lIDw8ICIgPSAiIDw8IHJlbmRlcl9jb25zdF92YWx1ZShvdXQsIHR5cGUsIHZhbHVlKSA8PCAiOyIgPDwgZW5kbCA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKKyAgICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiB1bnNvcnRlZF9maWVsZHMgPSAoKHRfc3RydWN0Kil0eXBlKS0+Z2V0X21lbWJlcnMoKTsKKyA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i5hcnJheSgpOyIgPDwgZW5kbDsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworCisgICAgICBvdXQgPDwgZW5kbDsKKworICAgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyBqYXZhLm5pby5CeXRlQnVmZmVyIGJ1ZmZlciIgPDwgZ2V0X2NhcF9uYW1lKCJmb3IiKQorICAgICAgICAgICAgICAgICAgPDwgZ2V0X2NhcF9uYW1lKGZpZWxkLT5nZXRfbmFtZSgpKSA8PCAiKCkgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudChvdXQpIDw8ICIgIGlmIChnZXRTZXRGaWVsZCgpID09IF9GaWVsZHMuIiA8PCBjb25zdGFudF9uYW1lKGZpZWxkLT5nZXRfbmFtZSgpKSA8PCAiKSB7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKworICAgICAgaWYodW5zYWZlX2JpbmFyaWVzXyl7CisgICAgICAgIGluZGVudChvdXQpCisgICAgICAgICAgPDwgIiAgICByZXR1cm4gKGphdmEubmlvLkJ5dGVCdWZmZXIpZ2V0RmllbGRWYWx1ZSgpOyIKKyAgICAgICAgICA8PCBlbmRsOworICAgICAgfWVsc2V7CisgICAgICAgIGluZGVudChvdXQpCisgICAgICAgICAgPDwgIiAgICByZXR1cm4gb3JnLmFwYWNoZS50aHJpZnQuVEJhc2VIZWxwZXIuY29weUJpbmFyeSgoamF2YS5uaW8uQnl0ZUJ1ZmZlcilnZXRGaWVsZFZhbHVlKCkpOyIKKyAgICAgICAgICA8PCBlbmRsOworICAgICAgfQorCisgICAgICBpbmRlbnQob3V0KSA8PCAiICB9IGVsc2UgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudChvdXQpIDw8ICIgICAgdGhyb3cgbmV3IGphdmEubGFuZy5SdW50aW1lRXhjZXB0aW9uKFwiQ2Fubm90IGdldCBmaWVsZCAnIiA8PCBmaWVsZC0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICAgPDwgI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gICAgICAgICA8PCAiJyBiZWNhdXNlIHVuaW9uIGlzIGN1cnJlbnRseSBzZXQgdG8gXCIgKyBnZXRGaWVsZERlc2MoZ2V0U2V0RmllbGQoKSkubmFtZSk7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIGluZGVudChvdXQpIDw8ICIgIH0iIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICB9CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGdlbmVyYXRlX2phdmFfZG9jKG91dCwgZmllbGQpOworICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgaWYgKGlzX2RlcHJlY2F0ZWQpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIkBEZXByZWNhdGVkIiA8PCBlbmRsOworICAgICAgfQorICAgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyB2b2lkIHNldCIgPDwgZ2V0X2NhcF9uYW1lKGZpZWxkLT5nZXRfbmFtZSgpKSA8PCAiKGJ5dGVbXSB2YWx1ZSkgeyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAiICBzZXQiIDw8IGdldF9jYXBfbmFtZShmaWVsZC0+Z2V0X25hbWUoKSk7CisKKyAgICAgIGlmKHVuc2FmZV9iaW5hcmllc18peworICAgICAgICBpbmRlbnQob3V0KSA8PCAiKGphdmEubmlvLkJ5dGVCdWZmZXIud3JhcCh2YWx1ZSkpOyIgPDwgZW5kbDsKKyAgICAgIH1lbHNleworICAgICAgICBpbmRlbnQob3V0KSA8PCAiKGphdmEubmlvLkJ5dGVCdWZmZXIud3JhcCh2YWx1ZS5jbG9uZSgpKSk7IiA8PCBlbmRsOworICAgICAgfQorCisgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKworICAgICAgb3V0IDw8IGVuZGw7CisgICAgfQorICAgIGlmIChpc19kZXByZWNhd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bj8KKyAqIEBwYXJhbSBpbl9jbGFzcyAgICAgSWYgaW5zaWRlIGEgY2xhc3MsIG5lZWRzIHRvIGJlIHN0YXRpYyBjbGFzcworICogQHBhcmFtIGlzX3Jlc3VsdCAgICBJZiB0aGlzIGlzIGEgcmVzdWx0IGl0IG5lZWRzIGEgZGlmZmVyZW50IHdyaXRlcgorICovCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X2RlZmluaXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQpIHsKKyAgZ2VuZXJhdGVfamF2YV9kb2Mob3V0LCB0c3RydWN0KTsKKworICBib29sIGlzX2ZpbmFsID0gKHRzdHJ1Y3QtPmFubm90YXRpb25zXy5maW5kKCJmaW5hbCIpICE9IHRzdHJ1Y3QtPmFubm90YXRpb25zXy5lbmQoKSk7CisgIGJvb2wgaXNfZGVwcmVjYXRlZCA9IHRoaXMtPmlzX2RlcHJlY2F0ZWQodHN0cnVjdC0+YW5ub3RhdGlvbnNfKTsKKworICBpZiAoIWluX2NsYXNzICYmICFzdXBwcmVzc19nZW5lcmF0ZWRfYW5ub3RhdGlvbnNfKSB7CisgICAgZ2VuZXJhdGVfamF2YXhfZ2VuZXJhdGVkX2Fubm90YXRpb24ob3V0KTsKKyAgfQorCisgIGlmIChpc19kZXByZWNhdGVkKSB7CisgICAgaW5kZW50KG91dCk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gPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBpbmRlbnQob3V0KSA8PCAidGhpcygpOyIgPDwgZW5kbDsKKyAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgIT0gdF9maWVsZDo6VF9PUFRJT05BTCkgeworICAgICAgICB0X3R5cGUqIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgICAgIGlmKHVuc2FmZV9iaW5hcmllc18peworICAgICAgICAgICAgaW5kZW50KG91dCkgPDwgInRoaXMuIiA8PCAoKm1faXRlciktPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgPSAiIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICBpbmRlbnQob3V0KSA8PCAidGhpcy4iIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiA9IG9yZy5hcGFjaGUudGhyaWZ0LlRCYXNlSGVscGVyLmNvcHlCaW5hcnkoIiA8PCAoKm1faXRlciktPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgInRoaXMuIiA8PCAoKm1faXRlciktPmdldF9uYW1lKCkgPDwgIiA9ICIgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICI7IgorICAgICAgICAgICAg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lbV90eXBlKCktPmdldF90cnVlX3R5cGUoKS0+aXNfc3RydWN0KCkpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIm91dC53cml0ZVR5cGVkTGlzdCgiIDw8IG5hbWUgPDwgIik7IiA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIm91dC53cml0ZUxpc3QoIiA8PCBuYW1lIDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgIH0KKyAgICB9IGVsc2UgaWYgKHQtPmlzX21hcCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlTWFwKCIgPDwgbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmICh0LT5pc19iYXNlX3R5cGUoKSkgeworICAgICAgaWYgKHQtPmlzX2JpbmFyeSgpKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJvdXQud3JpdGVJbnQoIiA8PCBuYW1lIDw8ICIhPW51bGwgPyAxIDogMCk7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnQob3V0KSA8PCAiaWYoIiA8PCBuYW1lIDw8ICIgIT0gbnVsbCkgeyAiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlQnl0ZUFycmF5KCIgPDwgbmFtZSA8PCAiLmFycmF5KCksICIgPDwgbmFtZSA8PCAiLnBvc2l0aW9uKCkgKyAiCisgICAgICAgICAgICAgICAgICAgIDw8IG5hbWUgPDwgIi5hcnJheU9mZnNldCgpLCAiIDw8IG5hbWUgPDwgIi5saW1pdCgpIC0gIiA8PCBuYW1lCisgICAgICAgICAgICAgICAgICAgIDw8ICIucG9zaXRpb24oKSApOyIgPDwgZW5kbDsKKyAgICAgICAgc2NvcGVfZG93bihvdXQpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgc3dpdGNoICgoKHRfYmFzZV90eXBlKil0KS0+Z2V0X2Jhc2UoKSkgeworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlSW50KG5ldyBTaG9ydCgiIDw8IG5hbWUgPDwgIikuaW50VmFsdWUoKSk7IiA8PCBlbmRsOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlSW50KCIgPDwgbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICAgIGluZGVudChvdXQpIDw8ICJvdXQud3JpdGVMb25nKCIgPDwgbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlSW50KCIgPDwgbmFtZSA8PCAiID8gMSA6IDApOyIgPDwgZW5kbDsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlQnl0ZSgiIDw8IG5hbWUgPDwgIik7IiA8PCBlbmRsOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAib3V0LndyaXRlRG91YmxlKCIgPDwgbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICAgIGluZGVudChvdXQpIDw8ICJvdXQud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ldFByaW1pdGl2ZVR5cGUgPT0gInNob3J0IikgeworICAgICAgaW5kZW50KG91dCkgPDwgIl9faXNzZXRfYml0ZmllbGQgPSAoc2hvcnQpIGluLnJlYWRJbnQoKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmIChiaXRzZXRQcmltaXRpdmVUeXBlID09ICJpbnQiKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiX19pc3NldF9iaXRmaWVsZCA9IGluLnJlYWRJbnQoKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmIChiaXRzZXRQcmltaXRpdmVUeXBlID09ICJsb25nIikgeworICAgICAgaW5kZW50KG91dCkgPDwgIl9faXNzZXRfYml0ZmllbGQgPSBpbi5yZWFkTG9uZygpOyIgPDwgZW5kbDsKKyAgICB9CisgICAgb3V0IDw8IGVuZGw7CisgICAgYnJlYWs7CisgIGNhc2UgSVNTRVRfQklUU0VUOgorICAgIGluZGVudChvdXQpIDw8ICIvL0JpdFNldCIgPDwgZW5kbDsKKyAgICBpbmRlbnQob3V0KSA8PCAiX19pc3NldF9iaXRfdmVjdG9yID0gKGphdmEudXRpbC5CaXRTZXQpIGluLnJlYWRTZXJpYWxpemFibGUoKTsiIDw8IGVuZGw7CisgICAgb3V0IDw8IGVuZGw7CisgICAgYnJlYWs7CisgIH0KKyAgLy8gcmVhZCBhbGwgdGhlIGZpZWxkcworICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgdF90eXBlKiB0ID0gZ2V0X3RydWVfdHlwZSgoKm1faXRlciktPmdldF90eXBlKCkpOworICAgIHN0cmluZyBuYW1lID0gKCptX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgIHN0cmluZyBwcmVmaXggPSAidGhpcy4iICsgbmFtZTsKKworICAgIGlmICh0LT5pc19zdHJ1Y3QoKSkgeworICAgICAgaW5kZW50KG91dCkgPDwgcHJlZ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OyIgPDwgZW5kbDsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICIgPSBpbi5yZWFkTG9uZygpOyIgPDwgZW5kbDsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICAgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiID0gKGluLnJlYWRJbnQoKT09MSk7IiA8PCBlbmRsOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICAgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiID0gaW4ucmVhZEJ5dGUoKTsiIDw8IGVuZGw7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICAgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiID0gaW4ucmVhZERvdWJsZSgpOyIgPDwgZW5kbDsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICI9IGluLnJlYWRTdHJpbmcoKTsiIDw8IGVuZGw7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfVk9JRDoKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKKyAgb3V0IDw8IGVuZGw7CisKKyAgaW5kZW50KG91dCkgPDwgInB1YmxpYyBzdGF0aWMgZmluYWwgYW5kcm9pZC5vcy5QYXJjZWxhYmxlLkNyZWF0b3I8IiA8PCB0bmF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BnZW5lcmF0ZV9pc3NldF9jaGVjaygqbV9pdGVyKQorICAgICAgICAgICAgICAgICAgPDwgIikgPyAiIDw8IEJfWUVTIDw8ICIgOiAiIDw8IEJfTk8gPDwgIik7IiA8PCBlbmRsOworICAgIH0KKworICAgIGlmIChpc19vcHRpb25hbCB8fCBjYW5fYmVfbnVsbCkgeworICAgICAgaW5kZW50KG91dCkgPDwgImlmICgiICsgZ2VuZXJhdGVfaXNzZXRfY2hlY2soKm1faXRlcikgKyAiKSIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgIH0KKworICAgIGlmICh0LT5pc19lbnVtKCkpIHsKKyAgICAgIGluZGVudChvdXQpIDw8ICJoYXNoQ29kZSA9IGhhc2hDb2RlICogIiA8PCBNVUwgPDwgIiArICIgPDwgbmFtZSA8PCAiLmdldFZhbHVlKCk7IiA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodC0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICAgIHN3aXRjaCgoKHRfYmFzZV90eXBlKil0KS0+Z2V0X2Jhc2UoKSkgeworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgIGluZGVudChvdXQpIDw8ICJoYXNoQ29kZSA9IGhhc2hDb2RlICogIiA8PCBNVUwgPDwgIiArICIgPDwgbmFtZSA8PCAiLmhhc2hDb2RlKCk7IiA8PCBlbmRsOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgaW5kZW50KG91dCkgPDwgImhhc2hDb2RlID0gaGFzaENvZGUgKiAiIDw8IE1VTCA8PCAiICsgKCgiIDw8IG5hbWUgPDwgIikgPyAiCisgICAgICAgICAgICAgICAgICAgIDw8IEJfWUVTIDw8ICIgOiAiIDw8IEJfTk8gPDwgIik7IiA8PCBlbmRsOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZU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PCAiJyBpcyB1bnNldCEgU3RydWN0OlwiICsgdG9TdHJpbmcoKSk7IiA8PCBlbmRsIDw8IGluZGVudCgpCisgICAgICAgICAgICA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKHR5cGVfY2FuX2JlX251bGwoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSkgeworICAgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAoIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIiA9PSBudWxsKSB7IiA8PCBlbmRsOworICAgICAgICAgIGluZGVudChvdXQpCisgICAgICAgICAgICAgIDw8ICIgIHRocm93IG5ldyBvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2xFeGNlcHRpb24oXCJSZXF1aXJlZCBmaWVsZCAnIgorICAgICAgICAgICAgICA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIicgd2FzIG5vdCBwcmVzZW50ISBTdHJ1Y3Q6IFwiICsgdG9TdHJpbmcoKSk7IiA8PCBlbmRsOworICAgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIGluZGVudChvdXQpIDw8ICIvLyBhbGFzLCB3ZSBjYW5ub3QgY2hlY2sgJyIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgPDwgIicgYmVjYXVzZSBpdCdzIGEgcHJpbWl0aXZlIGFuZCB5b3UgY2hvc2UgdGhlIG5vbi1iZWFucyBnZW5lcmF0b3IuIgorICAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9CisgIH0KKworICBvdXQgPDwgaW5kZW50KCkgPDwgIi8vIGNoZWNrIGZvciBzdWItc3RydWN0IHZhbGlkaXR5IiA8PCBlbmRsOworICBmb3IgKGZfaXRlci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kIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X2ZpZWxkX2J5X2lkKG9zdHJlYW0mIG91dCwgdF9zdHJ1Y3QqIHRzdHJ1Y3QpIHsKKyAgKHZvaWQpdHN0cnVjdDsKKyAgaW5kZW50KG91dCkgPDwgamF2YV9udWxsYWJsZV9hbm5vdGF0aW9uKCkgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgInB1YmxpYyBfRmllbGRzIGZpZWxkRm9ySWQoaW50IGZpZWxkSWQpIHsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICIgIHJldHVybiBfRmllbGRzLmZpbmRCeVRocmlmdElkKGZpZWxkSWQpOyIgPDwgZW5kbDsKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9yZWZsZWN0aW9uX2dldHRlcnMob3N0cmluZ3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgY2FwX25hbWUpIHsKKyAgaW5kZW50KG91dCkgPDwgImNhc2UgIiA8PCBjb25zdGFudF9uYW1lKGZpZWxkX25hbWUpIDw8ICI6IiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KG91dCkgPDwgInJldHVybiAiIDw8ICh0eXBlLT5pc19ib29sKCkgPyAiaXMiIDogImdldCIpIDw8IGNhcF9uYW1lIDw8ICIoKTsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgaW5kZW50X2Rvd24oKTsKK30KKwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9yZWZsZWN0aW9uX3NldHRlcnMob3N0cmluZ3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgY2FwX25hbWUpIHsKKyAgY29uc3QgYm9vbCBpc19iaW5hcnkgPSB0eXBlLT5pc19iaW5hcnkoKTsKKyAgaW5kZW50KG91dCkgPDwgImNhc2UgIiA8PCBjb25zdGFudF9uYW1lKGZpZWxkX25hbWUpIDw8ICI6IiA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KG91dCkgPDwgImlmICh2YWx1ZSA9PSBudWxsKSB7IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAiICB1bnNldCIgPDwgZ2V0X2NhcF9uYW1lKGZpZWxkX25hbWUpIDw8ICIoKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKyAgaWYgKGlzX2JpbmFyeSkgeworICAgIGluZGVudF91cCgpOworICAgIGluZGVudChvdXQpIDw8ICJpZiAodmFsdWUgaW5zdGFuY2VvZiBieXRlW10pIHsiIDw8IGVuZGw7CisgICAgaW5kZW50KG91dCkgPDwgIiAgc2V0IiA8PCBjYXBfbmFtZSA8PCAiKChieXRlW10pdmFsdWUpOyIgPDwgZW5kbDsKKyAgICBpbmRlbnQob3V0KSA8PCAifSBlbHNlIHsiIDw8IGVuZGw7CisgIH0KKyAgaW5kZW50KG91dCkgPDwgIiAgc2V0IiA8PCBjYXBfbmFtZSA8PCAiKCgiIDw8IHR5cGVfbmFtZSh0eXBlLCB0cnVlL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0KSA8PCAicHVibGljIG9yZy5hcGFjaGUudGhyaWZ0Lk9wdGlvbjxJbnRlZ2VyPiBnZXQiIDw8IGNhcF9uYW1lOworICAgICAgICBvdXQgPDwgZ2V0X2NhcF9uYW1lKCJzaXplKCkgeyIpIDw8IGVuZGw7CisKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAodGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIiA9PSBudWxsKSB7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiBvcmcuYXBhY2hlLnRocmlmdC5PcHRpb24ubm9uZSgpOyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIn0gZWxzZSB7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiBvcmcuYXBhY2hlLnRocmlmdC5PcHRpb24uc29tZSh0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiLnNpemUoKSk7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGlmIChpc19kZXByZWNhdGVkKSB7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgIkBEZXByZWNhdGVkIiA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGluZGVudChvdXQpIDw8ICJwdWJsaWMgaW50IGdldCIgPDwgY2FwX25hbWU7CisgICAgICAgIG91dCA8PCBnZXRfY2FwX25hbWUoInNpemUoKSB7IikgPDwgZW5kbDsKKworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiAodGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIiA9PSBudWxsKSA/IDAgOiAiCisgICAgICAgICAgICAgICAgICAgIDw8ICJ0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiLnNpemUoKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7CisgICAgICB9CisgICAgfQorCisgICAgaWYgKHR5cGUtPmlzX3NldCgpIHx8IHR5cGUtPmlzX2xpc3QoKSkgeworICAgICAgdF90eXBlKiBlbGVtZW50X3R5cGU7CisgICAgICBpZiAodHlwZS0+aXNfc2V0KCkpIHsKKyAgICAgICAgZWxlbWVudF90eXBlID0gKCh0X3NldCopdHlwZSktPmdldF9lbGVtX3R5cGUoKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGVsZW1lbnRfdHlwZSA9ICgodF9saXN0Kil0eXBlKS0+Z2V0X2VsZW1fdHlwZSgpOworICAgICAgfQorCisgICAgICAvLyBJdGVyYXRvciBnZXR0ZXIgZm9yIHNldHMgYW5kIGxpc3RzCisgICAgICBpZiAob3B0aW9uYWwpIHsKKyAgICAgICAgaWYgKGlzX2RlcHJlY2F0ZWQpIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAiQERlcHJlY2F0ZWQiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyBvcmcuYXBhY2hlLnRocmlmdC5PcHRpb248amF2YS51dGlsLkl0ZXJhdG9yPCIgPDwgdHlwZV9uYW1lKGVsZW1lbnRfdHlwZSwgdHJ1ZSwgZmFsc2UpCisgICAgICAgICAgICAgICAgICAgIDw8ICI+PiBnZXQiIDw8IGNhcF9uYW1lOworICAgICAgICBvdXQgPDwgZ2V0X2NhcF9uYW1lKCJpdGVyYXRvcigpIHsiKSA8PCBlbmRsOworCisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAiaWYgKHRoaXMuIiA8PCBmaWVsZF9uYW1lIDw8ICIgPT0gbnVsbCkgeyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gb3JnLmFwYWNoZS50aHJpZnQuT3B0aW9uLm5vbmUoKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gb3JnLmFwYWNoZS50aHJpZnQuT3B0aW9uLnNvbWUodGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIi5pdGVyYXRvcigpKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKGlzX2RlcHJlY2F0ZWQpIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAiQERlcHJlY2F0ZWQiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgaW5kZW50KG91dCkgPDwgamF2YV9udWxsYWJsZV9hbm5vdGF0aW9uKCkgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyBqYXZhLnV0aWwuSXRlcmF0b3I8IiA8PCB0eXBlX25hbWUoZWxlbWVudF90eXBlLCB0cnVlLCBmYWxzZSkKKyAgICAgICAgICAgICAgICAgICAgPDwgIj4gZ2V0IiA8PCBjYXBfbmFtZTsKKyAgICAgICAgb3V0IDw8IGdldF9jYXBfbmFtZSgiaXRlcmF0b3IoKSB7IikgPDwgZW5kbDsKKworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiAodGhpcy4iIDw8IGZpZWxkX25hbWUgPDwgIiA9PSBudWxsKSA/IG51bGwgOiAiCisgICAgICAgICAgICAgICAgICAgIDw8ICJ0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiLml0ZXJhdG9yKCk7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICAgICAgfQorCisgICAgICAvLyBBZGQgdG8gc2V0IG9yIGxpc3QsIGNyZWF0ZSBpZiB0aGUgc2V0L2xpc3QgaXMgbnVsbAorICAgICAgaWYgKGlzX2RlcHJlY2F0ZWQpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIkBEZXByZWNhdGVkIiA8PCBlbmRsOworICAgICAgfQorICAgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyB2b2lkIGFkZCIgPDwgZ2V0X2NhcF9uYW1lKCJ0byIpOworICAgICAgb3V0IDw8IGNhcF9uYW1lIDw8ICIoIiA8PCB0eXBlX25hbWUoZWxlbWVudF90eXBlKSA8PCAiIGVsZW0pIHsiIDw8IGVuZGw7CisKKyAgICAgIGluZGVudF91cCgpOworICAgICAgaW5kZW50KG91dCkgPDwgImlmICh0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiID09IG51bGwpIHsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ0aGlzLiIgPDwgZmllbGRfbmFtZTsKKyAgICAgIGlmIChpc19lbnVtX3NldCh0eXBlKSkgeworICAgICAgICBvdXQgPDwgIiA9ICIgPDwgdHlwZV9uYW1lKHR5cGUsIGZh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91dCkgPDwgIiAgc2V0IiA8PCBjYXBfbmFtZSA8PCAiKG9yZy5hcGFjaGUudGhyaWZ0LlRCYXNlSGVscGVyLnJpZ2h0U2l6ZSgiCisgICAgICAgICAgICAgICAgICA8PCBmaWVsZF9uYW1lIDw8ICIpKTsiIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAiICByZXR1cm4gIiA8PCBmaWVsZF9uYW1lIDw8ICIgPT0gbnVsbCA/IG51bGwgOiAiIDw8IGZpZWxkX25hbWUgPDwgIi5hcnJheSgpOyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworCisgICAgICBpbmRlbnQob3V0KSA8PCAicHVibGljIGphdmEubmlvLkJ5dGVCdWZmZXIgYnVmZmVyIiA8PCBnZXRfY2FwX25hbWUoImZvciIpIDw8IGNhcF9uYW1lIDw8ICIoKSB7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIGlmKHVuc2FmZV9iaW5hcmllc18peworICAgICAgICBpbmRlbnQob3V0KSA8PCAiICByZXR1cm4gIiA8PCBmaWVsZF9uYW1lIDw8ICI7IgorICAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgfWVsc2UgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAiICByZXR1cm4gb3JnLmFwYWNoZS50aHJpZnQuVEJhc2VIZWxwZXIuY29weUJpbmFyeSgiIDw8IGZpZWxkX25hbWUgPDwgIik7IgorICAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgfQorICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKyAgICB9IGVsc2UgeworICAgICAgaWYgKG9wdGlvbmFsKSB7CisgICAgICAgIGlmIChpc19kZXByZWNhdGVkKSB7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgIkBEZXByZWNhdGVkIiA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGluZGVudChvdXQpIDw8ICJwdWJsaWMgb3JnLmFwYWNoZS50aHJpZnQuT3B0aW9uPCIgPDwgdHlwZV9uYW1lKHR5cGUsIHRydWUpIDw8ICI+IjsKKyAgICAgICAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpICYmICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpID09IHRfYmFzZV90eXBlOjpUWVBFX0JPT0wpIHsKKyAgICAgICAgICBvdXQgPDwgIiBpcyI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgb3V0IDw8ICIgZ2V0IjsKKyAgICAgICAgfQorICAgICAgICBvdXQgPDwgY2FwX25hbWUgPDwgIigpIHsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworCisgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAodGhpcy5pc1NldCIgPDwgY2FwX25hbWUgPDwgIigpKSB7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiBvcmcuYXBhY2hlLnRocmlmdC5PcHRpb24uc29tZSh0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gb3JnLmFwYWNoZS50aHJpZnQuT3B0aW9uLm5vbmUoKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKGlzX2RlcHJlY2F0ZWQpIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAiQERlcHJlY2F0ZWQiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHR5cGVfY2FuX2JlX251bGwodHlwZSkpIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCBqYXZhX251bGxhYmxlX2Fubm90YXRpb24oKSA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGluZGVudChvdXQpIDw8ICJwdWJsaWMgIiA8PCB0eXBlX25hbWUodHlwZSk7CisgICAgICAgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSAmJiAoKHRfYmFzZV90eXBlKil0eXBlKS0+Z2V0X2Jhc2UoKSA9PSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MKSB7CisgICAgICAgICAgb3V0IDw8ICIgaXMiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAiIGdldCI7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8IGNhcF9uYW1lIDw8ICIoKSB7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInJldHVybiB0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiOyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKyAgICAgIH0KKyAgICB9CisKKyAgICAvLyBTaW1wbGUgc2V0dGVyCisgICAgZ2VuZXJhdGVfamF2YV9kb2Mob3V0LCBmaWVsZCk7CisgICAgaWYgKHR5cGUtPmlzX2JpbmFyeSgpKSB7CisgICAgICBpZiAoaXNfZGVwcmVjYXRlZCkgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAiQERlcHJlY2F0ZWQiIDw8IGVuZGw7CisgICAgICB9CisgICAgICBpbmRlbnQob3V0K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XIgZm9yLgorICovCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcnZpY2VfY2xpZW50KHRfc2VydmljZSogdHNlcnZpY2UpIHsKKyAgc3RyaW5nIGV4dGVuZHMgPSAiIjsKKyAgc3RyaW5nIGV4dGVuZHNfY2xpZW50ID0gIiI7CisgIGlmICh0c2VydmljZS0+Z2V0X2V4dGVuZHMoKSA9PSBOVUxMKSB7CisgICAgZXh0ZW5kc19jbGllbnQgPSAib3JnLmFwYWNoZS50aHJpZnQuVFNlcnZpY2VDbGllbnQiOworICB9IGVsc2UgeworICAgIGV4dGVuZHMgPSB0eXBlX25hbWUodHNlcnZpY2UtPmdldF9leHRlbmRzKCkpOworICAgIGV4dGVuZHNfY2xpZW50ID0gZXh0ZW5kcyArICIuQ2xpZW50IjsKKyAgfQorCisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIHN0YXRpYyBjbGFzcyBDbGllbnQgZXh0ZW5kcyAiIDw8IGV4dGVuZHNfY2xpZW50CisgICAgICAgICAgICAgICAgICAgICA8PCAiIGltcGxlbWVudHMgSWZhY2UgeyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisKKyAgaW5kZW50KGZfc2VydmljZV8pCisgICAgICA8PCAicHVibGljIHN0YXRpYyBjbGFzcyBGYWN0b3J5IGltcGxlbWVudHMgb3JnLmFwYWNoZS50aHJpZnQuVFNlcnZpY2VDbGllbnRGYWN0b3J5PENsaWVudD4geyIKKyAgICAgIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInB1YmxpYyBGYWN0b3J5KCkge30iIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIENsaWVudCBnZXRDbGllbnQob3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVFByb3RvY29sIHByb3QpIHsiCisgICAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICBpbmRlbnRfdXAoKTsKKyAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJyZXR1cm4gbmV3IENsaWVudChwcm90KTsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSIgPDwgZW5kbDsKKyAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJwdWJsaWMgQ2xpZW50IGdldENsaWVudChvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2wgaXByb3QsICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2wgb3Byb3QpIHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInJldHVybiBuZXcgQ2xpZW50KGlwcm90LCBvcHJvdCk7IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIn0iIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworCisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIENsaWVudChvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2wgcHJvdCkiIDw8IGVuZGw7CisgIHNjb3BlX3VwKGZfc2VydmljZV8pOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInN1cGVyKHByb3QsIHByb3QpOyIgPDwgZW5kbDsKKyAgc2NvcGVfZG93bihmX3NlcnZpY2VfKTsKKyAgZl9zZXJ2aWNlXyA8PCBlbmRsOworCisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIENsaWVudChvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2wgaXByb3QsICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJvcmc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AgICAgICAgICAgICAgICAgICAgICJwcm90b2NvbEZhY3RvcnkpIHsiIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICAgIHRoaXMuY2xpZW50TWFuYWdlciA9IGNsaWVudE1hbmFnZXI7IiA8PCBlbmRsOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIiAgICB0aGlzLnByb3RvY29sRmFjdG9yeSA9IHByb3RvY29sRmFjdG9yeTsiIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICB9IiA8PCBlbmRsOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIiAgcHVibGljIEFzeW5jQ2xpZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJnZXRBc3luY0NsaWVudChvcmcuYXBhY2hlLnRocmlmdC50cmFuc3BvcnQuVE5vbmJsb2NraW5nVHJhbnNwb3J0ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJ0cmFuc3BvcnQpIHsiIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICAgIHJldHVybiBuZXcgQXN5bmNDbGllbnQocHJvdG9jb2xGYWN0b3J5LCBjbGllbnRNYW5hZ2VyLCB0cmFuc3BvcnQpOyIKKyAgICAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICB9IiA8PCBlbmRsOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInB1YmxpYyBBc3luY0NsaWVudChvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2xGYWN0b3J5ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICJwcm90b2NvbEZhY3RvcnksIG9yZy5hcGFjaGUudGhyaWZ0LmFzeW5jLlRBc3luY0NsaWVudE1hbmFnZXIgIgorICAgICAgICAgIC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luZGVudChmX3NlcnZpY2VfKSA8PCAiICB0aGlzLl9fX2N1cnJlbnRNZXRob2QgPSBtZXRob2RfY2FsbDsiIDw8IGVuZGw7CisgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICIgIF9fX21hbmFnZXIuY2FsbChtZXRob2RfY2FsbCk7IiA8PCBlbmRsOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSIgPDwgZW5kbDsKKworICAgIGZfc2VydmljZV8gPDwgZW5kbDsKKworICAgIC8vIFRBc3luY01ldGhvZCBvYmplY3QgZm9yIHRoaXMgZnVuY3Rpb24gY2FsbAorICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicHVibGljIHN0YXRpYyBjbGFzcyAiICsgZnVuY2xhc3NuYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBleHRlbmRzIG9yZy5hcGFjaGUudGhyaWZ0LmFzeW5jLlRBc3luY01ldGhvZENhbGw8IgorICAgICAgICAgICAgICAgICAgICAgICAgICArIHR5cGVfbmFtZSgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCksIHRydWUpICsgIj4geyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKworICAgIC8vIE1lbWJlciB2YXJpYWJsZXMKKyAgICBmb3IgKGZsZF9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZsZF9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmbGRfaXRlcikgeworICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJwcml2YXRlICIgKyB0eXBlX25hbWUoKCpmbGRfaXRlciktPmdldF90eXBlKCkpICsgIiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKmZsZF9pdGVyKS0+Z2V0X25hbWUoKSArICI7IiA8PCBlbmRsOworICAgIH0KKworICAgIC8vIE5PVEUgc2luY2Ugd2UgdXNlIGEgbmV3IENsaWVudCBpbnN0YW5jZSB0byBkZXNlcmlhbGl6ZSwgbGV0J3Mga2VlcCBzZXFpZCB0byAwIGZvciBub3cKKyAgICAvLyBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInByaXZhdGUgaW50IHNlcWlkOyIgPDwgZW5kbCA8PCBlbmRsOworCisgICAgLy8gQ29uc3RydWN0b3IKKyAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInB1YmxpYyAiICsgZnVuY2xhc3NuYW1lICsgIigiCisgICAgICAgICAgICAgICAgICAgICAgICAgICsgYXN5bmNfYXJndW1lbnRfbGlzdCgqZl9pdGVyLCBhcmdfc3RydWN0LCByZXRfdHlwZSwgdHJ1ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgPDwgIiwgb3JnLmFwYWNoZS50aHJpZnQuYXN5bmMuVEFzeW5jQ2xpZW50IGNsaWVudCwgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAib3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVFByb3RvY29sRmFjdG9yeSBwcm90b2NvbEZhY3RvcnksICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yZy5hcGFjaGUudGhyaWZ0LnRyYW5zcG9ydC5UTm9uYmxvY2tpbmdUcmFuc3BvcnQgdHJhbnNwb3J0KSB0aHJvd3MgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAib3JnLmFwYWNoZS50aHJpZnQuVEV4Y2VwdGlvbiB7IiA8PCBlbmRsOworICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiICBzdXBlcihjbGllbnQsIHByb3RvY29sRmFjdG9yeSwgdHJhbnNwb3J0LCByZXN1bHRIYW5kbGVyLCAiCisgICAgICAgICAgICAgICAgICAgICAgIDw8ICgoKmZfaXRlciktPmlzX29uZXdheSgpID8gInRydWUiIDogImZhbHNlIikgPDwgIik7IiA8PCBlbmRsOworCisgICAgLy8gQXNzaWduIG1lbWJlciB2YXJpYWJsZXMKKyAgICBmb3IgKGZsZF9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZsZF9pdGVyICE9IGZpZWxkc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Dw8ICJyZXN1bHQuIiA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIiA9ICIKKyAgICAgICAgICAgICAgICAgICA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0iOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCAifSI7CisgICAgICB9CisgICAgfQorICAgIGZfc2VydmljZV8gPDwgZW5kbDsKKyAgfQorCisgIGlmICh0ZnVuY3Rpb24tPmlzX29uZXdheSgpKSB7CisgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJyZXR1cm4gbnVsbDsiIDw8IGVuZGw7CisgIH0gZWxzZSB7CisgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJyZXR1cm4gcmVzdWx0OyIgPDwgZW5kbDsKKyAgfQorICBpbmRlbnRfZG93bigpOworICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIn0iOworCisgIC8vIENsb3NlIGZ1bmN0aW9uCisgIGZfc2VydmljZV8gPDwgZW5kbDsKKworICAvLyBDbG9zZSBjbGFzcworICBpbmRlbnRfZG93bigpOworICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKKy8qKgorICogRGVzZXJpYWxpemVzIGEgZmllbGQgb2YgYW55IHR5cGUuCisgKgorICogQHBhcmFtIHRmaWVsZCBUaGUgZmllbGQKKyAqIEBwYXJhbSBwcmVmaXggVGhlIHZhcmlhYmxlIG5hbWUgb3IgY29udGFpbmVyIGZvciB0aGlzIGZpZWxkCisgKi8KK3ZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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iKCk7IiA8PCBlbmRsOworICBpZiAocmV1c2Vfb2JqZWN0c18pIHsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICB9CisgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiLnJlYWQoaXByb3QpOyIgPDwgZW5kbDsKK30KKworLyoqCisgKiBEZXNlcmlhbGl6ZXMgYSBjb250YWluZXIgYnkgcmVhZGluZyBpdHMgc2l6ZSBhbmQgdGhlbiBpdGVyYXRpbmcKKyAqLwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSkgeworCisgIHNjb3BlX3VwKG91dCk7CisKKyAgc3RyaW5nIG9iajsKKworICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgb2JqID0gdG1wKCJfbWFwIik7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgb2JqID0gdG1wKCJfc2V0Iik7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIG9iaiA9IHRtcCgiX2xpc3QiKTsKKyAgfQorCisgIGlmIChoYXNfbWV0YWRhdGEpIHsKKyAgICAvLyBEZWNsYXJlIHZhcmlhYmxlcywgcmVhZCBoZWFkZXIKKyAgICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVE1hcCAiIDw8IG9iaiA8PCAiID0gaXByb3QucmVhZE1hcEJlZ2luKCk7IgorICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgICAgaW5kZW50KG91dCkgPDwgIm9yZy5hcGFjaGUudGhyaWZ0LnByb3RvY29sLlRTZXQgIiA8PCBvYmogPDwgIiA9IGlwcm90LnJlYWRTZXRCZWdpbigpOyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVExpc3QgIiA8PCBvYmogPDwgIiA9IGlwcm90LnJlYWRMaXN0QmVnaW4oKTsiCisgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgIH0KKyAgfSBlbHNlIHsKKyAgICAvLyBEZWNsYXJlIHZhcmlhYmxlcywgcmVhZCBoZWFkZXIKKyAgICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVE1hcCAiIDw8IG9iagorICAgICAgICAgICAgICAgICAgPDwgIiA9IG5ldyBvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UTWFwKCIKKyAgICAgICAgICAgICAgICAgIDw8IHR5cGVfdG9fZW51bSgoKHRfbWFwKil0dHlwZSktPmdldF9rZXlfdHlwZSgpKSA8PCAiLCAiCisgICAgICAgICAgICAgICAgICA8PCB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfdmFsX3R5cGUoKSkgPDwgIiwgIgorICAgICAgICAgICAgICAgICAgPDwgImlwcm90LnJlYWRJMzIoKSk7IiA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICA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HlwZSwgcHJlZml4LCBvYmosIGhhc19tZXRhZGF0YSk7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudChvdXQsICh0X2xpc3QqKXR0eXBlLCBwcmVmaXgsIG9iaiwgaGFzX21ldGFkYXRhKTsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKKworICBpZiAoaGFzX21ldGFkYXRhKSB7CisgICAgLy8gUmVhZCBjb250YWluZXIgZW5kCisgICAgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgICAgaW5kZW50KG91dCkgPDwgImlwcm90LnJlYWRNYXBFbmQoKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICAgIGluZGVudChvdXQpIDw8ICJpcHJvdC5yZWFkU2V0RW5kKCk7IiA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgICAgaW5kZW50KG91dCkgPDwgImlwcm90LnJlYWRMaXN0RW5kKCk7IiA8PCBlbmRsOworICAgIH0KKyAgfQorICBzY29wZV9kb3duKG91dCk7Cit9CisKKy8qKgorICogR2VuZXJhdGVzIGNvZGUgdG8gZGVzZXJpYWxpemUgYSBtYXAKKyAqLwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgb2JqLAorICA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yAgICBzY29wZV91cChvdXQpOworICB9CisKKyAgaW5kZW50KG91dCkgPDwgcHJlZml4IDw8ICIucHV0KCIgPDwga2V5IDw8ICIsICIgPDwgdmFsIDw8ICIpOyIgPDwgZW5kbDsKKworICBpZiAoZ2V0X3RydWVfdHlwZShma2V5LmdldF90eXBlKCkpLT5pc19lbnVtKCkpIHsKKyAgICBzY29wZV9kb3duKG91dCk7CisgIH0KKworICBpZiAocmV1c2Vfb2JqZWN0c18gJiYgIWdldF90cnVlX3R5cGUoZmtleS5nZXRfdHlwZSgpKS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCBrZXkgPDwgIiA9IG51bGw7IiA8PCBlbmRsOworICB9CisKKyAgaWYgKHJldXNlX29iamVjdHNfICYmICFnZXRfdHJ1ZV90eXBlKGZ2YWwuZ2V0X3R5cGUoKSktPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgdmFsIDw8ICIgPSBudWxsOyIgPDwgZW5kbDsKKyAgfQorfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIHNldCBlbGVtZW50CisgKi8KK3ZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc2V0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG9iaiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEpIHsKKyAgc3RyaW5nIGVsZW0gPSB0bXAoI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IGVuZGw7CisgIH0KK30KKworLyoqCisgKiBEZXNlcmlhbGl6ZXMgYSBsaXN0IGVsZW1lbnQKKyAqLwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgb2JqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEpIHsKKyAgc3RyaW5nIGVsZW0gPSB0bXAoIl9lbGVtIik7CisgIHRfZmllbGQgZmVsZW0odGxpc3QtPmdldF9lbGVtX3R5cGUoKSwgZWxlbSk7CisKKyAgaW5kZW50KG91dCkgPDwgZGVjbGFyZV9maWVsZCgmZmVsZW0sIHJldXNlX29iamVjdHNfLCBmYWxzZSkgPDwgZW5kbDsKKworICAvLyBGb3IgbG9vcCBpdGVyYXRlcyBvdmVyIGVsZW1lbnRzCisgIHN0cmluZyBpID0gdG1wKCJfaSIpOworICBpbmRlbnQob3V0KSA8PCAiZm9yIChpbnQgIiA8PCBpIDw8ICIgPSAwOyAiIDw8IGkgPDwgIiA8ICIgPDwgb2JqIDw8ICIuc2l6ZSIKKyAgICAgICAgICAgICAgPDwgIjsgIgorICAgICAgICAgICAgICA8PCAiKysiIDw8IGkgPDwgIikiIDw8IGVuZGw7CisgIHNjb3BlX3VwKG91dCk7CisKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmVsZW0sICIiLCBoYXNfbWV0YWRhdGEpOworCisgIGlmIChnZXRfdHJ1ZV90eXBlKGZlbGVtLmdldF90eXBlKCkpLT5pc19lbnVtKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAiaWYgKCIgPDwgZWxlbSA8PCAiICE9IG51bGwpIiA8PCBlbmRsOworICAgIHNjb3BlX3VwKG91dCk7CisgIH0KKworICBpbmRlbnQob3V0KSA8PCBwcmVmaXggPDwgIi5hZGQoIiA8PCBlbGVtIDw8ICIpOyIgPDwgZW5kbDsKKworICBpZiAoZ2V0X3RydWVfdHlwZShmZWxlbS5nZXRfdHlwZSgpKS0+aXNfZW51bSgpKSB7CisgICAgc2NvcGVfZG93bihvdXQpOworICB9CisKKyAgaWYgKHJldXNlX29iamVjdHNfICYmICFnZXRfdHJ1ZV90eXBlKGZlbGVtLmdldF90eXBlKCkpLT5pc19iYXNlX3R5cGUoKSkgeworICAgIGluZGVudChvdXQpIDw8IGVsZW0gPDwgIiA9IG51bGw7IiA8PCBlbmRsOworICB9Cit9CisKKy8qKgorICogU2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgorICoKKyAqIEBwYXJhbSB0ZmllbGQgVGhlIGZpZWxkIHRvIHNlcmlhbGl6ZQorICogQHBhcmFtIHByZWZpeCBOYW1lIHRvIHByZXBlbmQgdG8gZmllbGQgbmFtZQorICovCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEpIHsKKyAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVf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yAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfVk9JRDoKKyAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBjYW5ub3Qgc2VyaWFsaXplIHZvaWQgZmllbGQgaW4gYSBzdHJ1Y3Q6ICIgKyBuYW1lOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpIHsKKyAgICAgICAgICBvdXQgPDwgIndyaXRlQmluYXJ5KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAid3JpdGVTdHJpbmcoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAid3JpdGVCb29sKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAid3JpdGVCeXRlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIndyaXRlSTMyKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIndyaXRlSTY0KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9i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pOyIgPDwgZW5kbDsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIGEgY29udGFpbmVyIGJ5IHdyaXRpbmcgaXRzIHNpemUgdGhlbiB0aGUgZWxlbWVudHMuCisgKgorICogQHBhcmFtIHR0eXBlICBUaGUgdHlwZSBvZiBjb250YWluZXIKKyAqIEBwYXJhbSBwcmVmaXggU3RyaW5nIHByZWZpeCBmb3IgZmllbGRzCisgKi8KK3ZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2NvbnRhaW5lcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhKSB7CisgIHNjb3BlX3VwKG91dCk7CisKKyAgaWYgKGhhc19tZXRhZGF0YSkgeworICAgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZU1hcEJlZ2luKG5ldyBvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UTWFwKCIKKyAgICAgICAgICAgICAgICAgIDw8IHR5cGVfdG9fZW51bSgoKHRfbWFwKil0dHlwZSktPmdldF9rZXlfdHlwZSgpKSA8PCAiLCAiCisgICAgICAgICAgICAgICAgICA8PCB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfdmFsX3R5cGUoKSkgPDwgIiwgIiA8PCBwcmVmaXggPDwgIi5zaXplKCkpKTsiCisgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgICBpbmRlbn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gPDwgIm9wcm90LndyaXRlTWFwRW5kKCk7IiA8PCBlbmRsOworICAgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVTZXRFbmQoKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qud3JpdGVMaXN0RW5kKCk7IiA8PCBlbmRsOworICAgIH0KKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgorICovCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaGFzX21ldGFkYXRhKSB7CisgICh2b2lkKW1hcDsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGl0ZXIgKyAiLmdldEtleSgpIik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsICIiLCBoYXNfbWV0YWRhdGEpOworICB0X2ZpZWxkIHZmaWVsZCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgaXRlciArICIuZ2V0VmFsdWUoKSIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkLCAiIiwgaGFzX21ldGFkYXRhKTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgc2V0LgorICovCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NldCogdHNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBoYXNfbWV0YWRhdGEpIHsKKyAgdF9maWVsZCBlZmllbGQodHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIsIGhhc19tZXRhZGF0YSk7Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIGxpc3QuCisgKi8KK3ZvaWQgdF9qYXZhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX2xpc3RfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9saXN0KiB0bGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGhhc19tZXRhZGF0YSkgeworICB0X2ZpZWxkIGVmaWVsZCh0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpLCBpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmVmaWVsZCwgIiIsIGhhc19tZXRhZGF0YSk7Cit9CisKKy8qKgorICogUmV0dXJucyBhIEphdmEgdHlwZSBuYW1lCisgKgorICogQHBhcmFtIHR0eXBlIFRoZSB0eXBlCisgKiBAcGFyYW0gY29udGFpbmVyIElzIHRoZSB0eXBlIGdvaW5nIGluc2lkZSBhIGNvbnRhaW5lcj8KKyAqIEByZXR1cm4gSmF2YSB0eXBlIG5hbWUsIGkuZS4gamF2YS51dGlsLkhhc2hNYXA8S2V5LFZhbHVlPgorICovCitzdHJpbmcgdF9qYXZhX2dlbmVyYXRvcjo6dHlwZV9uYW1lKHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY29udGFpbmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2luaXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc2tpcF9nZW5lcmljLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGZvcmNlX25hbWVzcGFjZSkgeworICAvLyBJbiBKYXZhIHR5cGVkZWZzIGFyZSBqdXN0IHJlc29sdmVkIHRvIHRoZWlyIHJlYWwgdHlwZQorICB0dHlwZSA9IGdldF90cnVlX3R5cGUodHR5cGUpOworICBzdHJpbmcgcHJlZml4OworCisgIGlmICh0dHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICByZXR1cm4gYmFzZV90eXBlX25hbWUoKHRfYmFzZV90eXBlKil0dHlwZSwgaW5fY29udGFpbmVyKTsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICB0X21hcCogdG1hcCA9ICh0X21hcCopdHR5cGU7CisgICAgaWYgKGluX2luaXQpIHsKKyAgICAgIGlmIChpc19lbnVtX21hcCh0bWFwKSkgeworICAgICAgICBwcmVmaXggPSAiamF2YS51dGlsLkVudW1NYXAiOworICAgICAgfSBlbHNlIGlmIChzb3J0ZWRfY29udGFpbmVyc18pIHsKKyAgICAgICAgcHJlZml4ID0gImphdmEudXRpbC5UcmVlTWFwIjsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHByZWZpeCA9ICJqYXZhLnV0aWwuSGFzaE1hcCI7CisgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgIHByZWZpeCA9ICJqYXZhLnV0aWwuTWFwIjsKKyAgICB9CisgICAgcmV0dXJuIHByZWZpeCArIChza2lwX2dlbmVyaWMgPyAiIiA6ICI8IiArIHR5cGVfbmFtZSh0bWFwLT5nZXRfa2V5X3R5cGUoKSwgdHJ1ZSkgKyAiLCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB0eXBlX25hbWUodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHRydWUpICsgIj4iKTsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICB0X3NldCogdHNldCA9ICh0X3NldCopdHR5cGU7CisgICAgaWYgKGluX2luaXQpIHsKKyAgICAgIGlmIChpc19lbnVtX3NldCh0c2V0KSkgeworICAgICAgICBwcmVmaXggPSAiamF2YS51dGlsLkVudW1TZXQiOworICAgICAgfSBlbHNlIGlmIChzb3J0ZWRfY29udGFpbmVyc18pIHsKKyAgICAgICAgcHJlZml4ID0gImphdmEudXRpbC5UcmVlU2V0IjsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHByZWZpeCA9ICJqYXZhLnV0aWwuSGFzaFNldCI7CisgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgIHByZWZpeCA9ICJqYXZhLnV0aWwuU2V0IjsKKyAgICB9CisgICAgcmV0dXJuIHByZWZpeCArIChza2lwX2dlbmVyaWMgPyAiIiA6ICI8IiArIHR5cGVfbmFtZSh0c2V0LT5nZXRfZWxlbV90eXBlKCksIHRydWUpICsgIj4iKTsKK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2VuZXJhdG9yOjpjb25zdGFudF9uYW1lKHN0cmluZyBuYW1lKSB7CisgIHN0cmluZyBjb25zdGFudF9uYW1lOworCisgIGJvb2wgaXNfZmlyc3QgPSB0cnVlOworICBib29sIHdhc19wcmV2aW91c19jaGFyX3VwcGVyID0gZmFsc2U7CisgIGZvciAoc3RyaW5nOjppdGVyYXRvciBpdGVyID0gbmFtZS5iZWdpbigpOyBpdGVyICE9IG5hbWUuZW5kKCk7ICsraXRlcikgeworICAgIHN0cmluZzo6dmFsdWVfdHlwZSBjaGFyYWN0ZXIgPSAoKml0ZXIpOworCisgICAgYm9vbCBpc191cHBlciA9IGlzdXBwZXIoY2hhcmFjdGVyKTsKKworICAgIGlmIChpc191cHBlciAmJiAhaXNfZmlyc3QgJiYgIXdhc19wcmV2aW91c19jaGFyX3VwcGVyKSB7CisgICAgICBjb25zdGFudF9uYW1lICs9ICdfJzsKKyAgICB9CisgICAgY29uc3RhbnRfbmFtZSArPSB0b3VwcGVyKGNoYXJhY3Rlcik7CisKKyAgICBpc19maXJzdCA9IGZhbHNlOworICAgIHdhc19wcmV2aW91c19jaGFyX3VwcGVyID0gaXNfdXBwZXI7CisgIH0KKworICByZXR1cm4gY29uc3RhbnRfbmFtZTsKK30KKwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWVwX2NvcHlfY29udGFpbmVyKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzb3VyY2VfbmFtZV9wMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzb3VyY2VfbmFtZV9wMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyByZXN1bHRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpIHsKKworICB0X2NvbnRhaW5lciogY29udGFpbmVyID0gKHRfY29udGFpbmVyKil0eXBlOworICBzdGQ6OnN0cmluZyBzb3VyY2VfbmFtZTsKKyAgaWYgKHNvdXJjZV9uYW1lX3AyID09ICIiKQorICAgIHNvdXJjZV9uYW1lID0gc291cmNlX25hbWVfcDE7CisgIGVsc2UKKyAgICBzb3VyY2VfbmFtZSA9IHNvdXJjZV9uYW1lX3AxICsgIi4iICsgc291cmNlX25hbWVfcDI7CisKKyAgYm9vbCBjb3B5X2NvbnN0cnVjdF9jb250YWluZXI7CisgIGlmIChjb250YWluZXItPmlzX21hcCgpKSB7CisgICAgdF9tYXAqIHRtYXAgPSAodF9tYXAqKWNvbnRhaW5lcjsKKyAgICBjb3B5X2NvbnN0cnVjdF9jb250YWluZXIgPSB0bWFwLT5nZXRfa2V5X3R5cGUoKS0+aXNfYmFzZV90eXBlKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiB0bWFwLT5nZXRfdmFsX3R5cGUoKS0+aXNfYmFzZV90eXBlKCk7CisgIH0gZWxzZSB7CisgICAgdF90eXBlKiBlbGVtX3R5cGUgPSBjb250YWluZXItPmlzX2xpc3QoKSA/ICgodF9saXN0Kiljb250YWluZXIpLT5nZXRfZWxlbV90eXBlKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogKCh0X3NldCopY29udGFpbmVyKS0+Z2V0X2VsZW1fdHlwZSgpOworICAgIGNvcHlfY29uc3RydWN0X2NvbnRhaW5lciA9IGVsZW1fdHlwZS0+aXNfYmFzZV90eXBlKCk7CisgIH0KKworICBpZiAoY29weV9jb25zdHJ1Y3RfY29udGFpbmVyKSB7CisgICAgLy8gZGVlcCBjb3B5IG9mIGJhc2UgdHlwZXMgY2FuIGJlIGRvbmUgbXVjaCBtb3JlIGVmZmljaWVudGx5IHRoYW4gaXR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b3JfZWxlbWVudF9uYW1lCisgICAgICAgICAgICAgICAgPDwgIl9rZXkgPSAiIDw8IGl0ZXJhdG9yX2VsZW1lbnRfbmFtZSA8PCAiLmdldEtleSgpOyIgPDwgZW5kbDsKKyAgICBpbmRlbnQob3V0KSA8PCB0eXBlX25hbWUodmFsX3R5cGUsIHRydWUsIGZhbHNlKSA8PCAiICIgPDwgaXRlcmF0b3JfZWxlbWVudF9uYW1lCisgICAgICAgICAgICAgICAgPDwgIl92YWx1ZSA9ICIgPDwgaXRlcmF0b3JfZWxlbWVudF9uYW1lIDw8ICIuZ2V0VmFsdWUoKTsiIDw8IGVuZGw7CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGlmIChrZXlfdHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9jb250YWluZXIob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcl9lbGVtZW50X25hbWUgKyAiX2tleSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRfZWxlbWVudF9uYW1lICsgIl9rZXkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSk7CisgICAgfSBlbHNlIHsKKyAgICAgIGluZGVudChvdXQpIDw8IHR5cGVfbmFtZShrZXlfdHlwZSwgdHJ1ZSwgZmFsc2UpIDw8ICIgIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lIDw8ICJfa2V5ID0gIjsKKyAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9ub25fY29udGFpbmVyKG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yX2VsZW1lbnRfbmFtZSArICJfa2V5IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdF9lbGVtZW50X25hbWUgKyAiX2tleSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSk7CisgICAgICBvdXQgPDwgIjsiIDw8IGVuZGw7CisgICAgfQorCisgICAgb3V0IDw8IGVuZGw7CisKKyAgICBpZiAodmFsX3R5cGUtPmlzX2NvbnRhaW5lcigpKSB7CisgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfY29udGFpbmVyKG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlcmF0b3JfZWxlbWVudF9uYW1lICsgIl92YWx1ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRfZWxlbWVudF9uYW1lICsgIl92YWx1ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbF90eXBlKTsKKyAgICB9IGVsc2UgeworICAgICAgaW5kZW50KG91dCkgPDwgdHlwZV9uYW1lKHZhbF90eXBlLCB0cnVlLCBmYWxzZSkgPDwgIiAiIDw8IHJlc3VsdF9lbGVtZW50X25hbWUgPDwgIl92YWx1ZSA9ICI7CisgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfbm9uX2NvbnRhaW5lcihvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcl9lbGVtZW50X25hbWUgKyAiX3ZhbHVlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdF9lbGVtZW50X25hbWUgKyAiX3ZhbHVlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbF90eXBlKTsKKyAgICAgIG91dCA8PCAiOyIgPDwgZW5kbDsKKyAgICB9CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGluZGVudChvdXQpIDw8IHJlc3VsdF9uYW1lIDw8ICIucHV0KCIgPDwgcmVzdWx0X2VsZW1lbnRfbmFtZSA8PCAiX2tleSwgIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lCisgICAgICAgICAgICAgICAgPDwgIl92YWx1ZSk7IiA8PCBlbmRsOworCisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKworICB9IGVsc2UgeworICAgIHRfdHlwZSogZWxlbV90eXBlOworCisgICAgaWYgKGNvbnRhaW5lci0+aXNfc2V0KCkpIHsKKyAgICAgIGVsZW1fdHlwZSA9ICgodF9zZXQqKWNvbnRhaW5lciktPmdldF9lbGVtX3R5cGUoKTsKKyAgICB9IGVsc2UgeworICAgICAgZWxlbV90eXBlID0gKCh0X2xpc3QqKWNvbnRhaW5lciktPmdldF9lbGVtX3R5cGUoKTsKKyAgICB9CisKKyAgICBpbmRlbnQob3V0KSA8PCAiZm9yICgiIDw8IHR5cGVfbmFtZShlbGVtX3R5cGUsIHRydWUsIGZhbHNlKSA8PCAiICIgPDwgaXRlcmF0b3JfZWxlbWVudF9uYW1lCisgICAgICAgICAgICAgICAgPDwgIiA6ICIgPDwgc291cmNlX25hbWUgPDwgIikgeyIgPDwgZW5kbDsKKworICAgIGluZGVudF91cCgpOworCisgICAgaWYgKGVsZW1fdHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICAgIC8vIHJlY3Vyc2l2ZSBkZWVwIGNvcHkKKyAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9jb250YWluZXIob3V0LCBpdGVyYXRvcl9lbGVtZW50X25hbWUsICIiLCByZXN1bHRfZWxlbWVudF9uYW1lLCBlbGVtX3R5cGUpOworICAgICAgaW5kZW50KG91dCkgPDwgcmVzdWx0X25hbWUgPDwgIi5hZGQoIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lIDw8ICIpOyIgPDwgZW5kbDsKKyAgICB9IGVsc2UgeworICAgICAgLy8gaXRlcmF0aXZlIGNvcHkKKyAgICAgIGlmIChlbGVtX3R5cGUtPmlzX2JpbmFyeSgpKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJqYXZhLm5pby5CeXRlQnVmZmVyIHRlbXBfYmluYXJ5X2VsZW1lbnQgPSAiOworICAgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfbm9uX2NvbnRhaW5lcihvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yX2VsZW1lbnRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRlbXBfYmluYXJ5X2VsZW1lbnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtX3R5cGUpOworICAgICAgICBvdXQgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudChvdXQpIDw8IHJlc3VsdF9uYW1lIDw8ICIuYWRkKHRlbXBfYmluYXJ5X2VsZW1lbnQpOyIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGluZGVudChvdXQpIDw8IHJlc3VsdF9uYW1lIDw8ICIuYWRkKCI7CisgICAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9ub25fY29udGFpbmVyKG91dCwgaXRlcmF0b3JfZWxlbWVudF9uYW1lLCByZXN1bHRfbmFtZSwgZWxlbV90eXBlKTsKKyAgICAgICAgb3V0IDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgIH0KKyAgICB9CisKKyAgICBpbmRlbnRfZG93bigpOworCisgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7CisgIH0KK30KKwordm9pZCB0X2phdmFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZWVwX2NvcHlfbm9uX2NvbnRhaW5lcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNvdXJjZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBkZXN0X25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSkgeworICAodm9pZClkZXN0X25hbWU7CisgIHR5cGUgPSBnZXRfdHJ1ZV90eXBlKHR5cGUpOworICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkgfHwgdHlwZS0+aXNfZW51bSgpIHx8IHR5cGUtPmlzX3R5cGVkZWYoKSkgeworICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkgeworICAgICAgb3V0IDw8ICJvcmcuYXBhY2hlLnRocmlmdC5UQmFzZUhlbHBlci5jb3B5QmluYXJ5KCIgPDwgc291cmNlX25hbWUgPDwgIikiOworICAgIH0gZWxzZSB7CisgICAgICAvLyBldmVyeXRoaW5nIGVsc2UgY2FuIGJlIGNvcGllZCBkaXJlY3RseQorICAgICAgb3V0IDw8IHNvdXJjZV9uYW1lOworICAgIH0KKyAgfSBlbHNlIHsKKyAgICBvdXQgPDwgIm5ldyAiIDw8IHR5cGVfbmFtZSh0eXBlLCB0cnVlLCB0cnVlKSA8PCAiKCIgPDwgc291cmNlX25hbWUgPDwgIikiOworICB9Cit9CisKK3N0ZDo6c3RyaW5nIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2lzc2V0X2NoZWNrKHRfZmllbGQqIGZpZWxkKSB7CisgIHJldHVybiBnZW5lcmF0ZV9pc3NldF9jaGVjayhmaWVsZC0+Z2V0X25hbWUoKSk7Cit9CisKK3N0ZDo6c3RyaW5nIHRfamF2YV9nZW5lcmF0b3I6Omlzc2V0X2ZpZWxkX2lkKHRfZmllbGQqIGZpZWxkKSB7CisgIHJldHVybiAiX18iICsgdXBjYXNlX3N0cmluZyhmaWVsZC0+Z2V0X25hbWUoKSArICJfaXNzZXRfaWQiKTsKK30KKworc3Rk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IiA8PCBlbmRsOworCisgIGluZGVudF9kb3duKCk7CisKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7Cit9CisKK3RfamF2YV9nZW5lcmF0b3I6Omlzc2V0X3R5cGUgdF9qYXZhX2dlbmVyYXRvcjo6bmVlZHNfaXNzZXQodF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nKiBvdXRQcmltaXRpdmVUeXBlKSB7CisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7CisKKyAgaW50IGNvdW50ID0gMDsKKyAgZm9yIChtX2l0ZXIgPSBtZW1iZXJzLmJlZ2luKCk7IG1faXRlciAhPSBtZW1iZXJzLmVuZCgpOyArK21faXRlcikgeworICAgIGlmICghdHlwZV9jYW5fYmVfbnVsbChnZXRfdHJ1ZV90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSkpKSB7CisgICAgICBjb3VudCsrOworICAgIH0KKyAgfQorICBpZiAoY291bnQgPT0gMCkgeworICAgIHJldHVybiBJU1NFVF9OT05FOworICB9IGVsc2UgaWYgKGNvdW50IDw9IDY0KSB7CisgICAgaWYgKG91dFByaW1pdGl2ZVR5cGUgIT0gTlVMTCkgeworICAgICAgaWYgKGNvdW50IDw9IDgpCisgICAgICAgICpvdXRQcmltaXRpdmVUeXBlID0gImJ5dGUiOworICAgICAgZWxzZSBpZiAoY291bnQgPD0gMTYpCisgICAgICAgICpvdXRQcmltaXRpdmVUeXBlID0gInNob3J0IjsKKyAgICAgIGVsc2UgaWYgKGNvdW50IDw9IDMyKQorICAgICAgICAqb3V0UHJpbWl0aXZlVHlwZSA9ICJpbnQiOworICAgICAgZWxzZ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duKCk7CisgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworfQorCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X3N0YW5kYXJkX3NjaGVtZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgIGluZGVudChvdXQpIDw8ICJwcml2YXRlIHN0YXRpYyBjbGFzcyAiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgPDwgIlN0YW5kYXJkU2NoZW1lRmFjdG9yeSBpbXBsZW1lbnRzIG9yZy5hcGFjaGUudGhyaWZ0LnNjaGVtZS5TY2hlbWVGYWN0b3J5IHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAicHVibGljICIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiU3RhbmRhcmRTY2hlbWUgZ2V0U2NoZW1lKCkgeyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gbmV3ICIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiU3RhbmRhcmRTY2hlbWUoKTsiIDw8IGVuZGw7CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworCisgIG91dCA8PCBpbmRlbnQoKSA8PCAicHJpdmF0ZSBzdGF0aWMgY2xhc3MgIiA8PCB0c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ZXIpIHsKKyAgICAgIGlmICgoKmZfaXRlciktPmdldF9yZXEoKSA9PSB0X2ZpZWxkOjpUX09QVElPTkFMCisgICAgICAgICAgfHwgKCpmX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9PUFRfSU5fUkVRX09VVCkgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAiaWYgKGluY29taW5nLmdldCgiIDw8IGkgPDwgIikpIHsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsICgqZl9pdGVyKSwgInN0cnVjdC4iLCBmYWxzZSk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJzdHJ1Y3Quc2V0IiA8PCBnZXRfY2FwX25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCBnZXRfY2FwX25hbWUoImlzU2V0IikKKyAgICAgICAgICAgICAgICAgICAgPDwgIih0cnVlKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICBpKys7CisgICAgICB9CisgICAgfQorICB9CisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworfQorCit2b2lkIHRfamF2YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X3R1cGxlX3dyaXRlcihvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KSB7CisgIGluZGVudChvdXQpIDw8ICJAT3ZlcnJpZGUiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJwdWJsaWMgdm9pZCB3cml0ZShvcmcuYXBhY2hlLnRocmlmdC5wcm90b2NvbC5UUHJvdG9jb2wgcHJvdCwgIgorICAgICAgICAgICAgICA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICIgc3RydWN0KSB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XQoKTsiIDw8IGVuZGw7CisgICAgaW50IGkgPSAwOworICAgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgICBpZiAoKCpmX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9PUFRJT05BTAorICAgICAgICAgIHx8ICgqZl9pdGVyKS0+Z2V0X3JlcSgpID09IHRfZmllbGQ6OlRfT1BUX0lOX1JFUV9PVVQpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgImlmIChzdHJ1Y3QuIiA8PCBnZW5lcmF0ZV9pc3NldF9jaGVjaygoKmZfaXRlcikpIDw8ICIpIHsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAib3B0aW9uYWxzLnNldCgiIDw8IGkgPDwgIik7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgaSsrOworICAgICAgfQorICAgIH0KKworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZUJpdFNldChvcHRpb25hbHMsICIgPDwgb3B0aW9uYWxfY291bnQgPDwgIik7IiA8PCBlbmRsOworICAgIGludCBqID0gMDsKKyAgICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikgeworICAgICAgaWYgKCgqZl9pdGVyKS0+Z2V0X3JlcSgpID09IHRfZmllbGQ6OlRfT1BUSU9OQUwKKyAgICAgICAgICB8fCAoKmZfaXRlciktPmdldF9yZXEoKSA9PSB0X2ZpZWxkOjpUX09QVF9JTl9SRVFfT1VUKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAoc3RydWN0LiIgPDwgZ2VuZXJhdGVfaXNzZXRf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Do6c3RyaW5nIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fc3RhdGljLAorICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGVmdmFsID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyByZW5kZXJfY29uc3RfdmFsdWUoc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpOworCisgIC8qKgorICAgKiBTZXJ2aWNlLWxldmVsIGdlbmVyYXRpb24gZnVuY3Rpb25zCisgICAqLworCisgIHZvaWQgZ2VuZXJhdGVfamF2YV9zdHJ1Y3QodF9zdHJ1Y3QqIHRzdHJ1Y3QsIGJvb2wgaXNfZXhjZXB0aW9uKTsKKworICB2b2lkIGdlbmVyYXRlX2phdmFfc3RydWN0X2RlZmluaXRpb24oc3RkOjpvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfeGNlcHRpb24gPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY2xhc3MgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0ID0gZmFsc2UpOworICB2b2lkIGdlbmVyYXRlX2phdmFfc3RydWN0X2VxdWFsaXR5KHN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3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNvdXJjZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc3RfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpOworCisgIGJvb2wgaGFzX2JpdF92ZWN0b3IodF9zdHJ1Y3QqIHRzdHJ1Y3QpOworCisgIC8qKgorICAgKiBIZWxwZXIgcmVuZGVyaW5nIGZ1bmN0aW9ucworICAgKi8KKworICBzdGQ6OnN0cmluZyBqYXZhX3BhY2thZ2UoKTsKKyAgc3RkOjpzdHJpbmcgamF2YV90eXBlX2ltcG9ydHMoKTsKKyAgc3RkOjpzdHJpbmcgamF2YV90aHJpZnRfaW1wb3J0cygpOworICBzdGQ6OnN0cmluZyB0eXBlX25hbWUodF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY29udGFpbmVyID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX2luaXQgPSBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgc2tpcF9nZW5lcmljID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBiYXNlX3R5cGVfbmFtZSh0X2Jhc2VfdHlwZSogdGJhc2UsIGJvb2wgaW5fY29udGFpbmVyID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBkZWNsYXJlX2ZpZWxkKHRfZmllbGQqIHRmaWVsZCwgYm9vbCBpbml0ID0gZmFsc2UpOworICBzdGQ6OnN0cmluZyBmdW5jdGlvbl9zaWduYXR1cmUodF9mdW5jdGlvbiogdGZ1bmN0aW9uLCBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisgIHN0ZDo6c3RyaW5nIGFyZ3VtZW50X2xpc3QodF9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haW4uY2MKKyAqLwordm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OnByaW50X2NvbnN0X3ZhbHVlKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluX3N0YXRpYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGRlZnZhbCkgeworICB0eXBlID0gZ2V0X3RydWVfdHlwZSh0eXBlKTsKKworICBpbmRlbnQob3V0KTsKKyAgaWYgKCFkZWZ2YWwpIHsKKyAgICBvdXQgPDwgKGluX3N0YXRpYyA/ICIiIDogInB1YmxpYyBzdGF0aWMgZmluYWwgIikgPDwgdHlwZV9uYW1lKHR5cGUpIDw8ICIgIjsKKyAgfQorICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICBzdHJpbmcgdjIgPSByZW5kZXJfY29uc3RfdmFsdWUob3V0LCBuYW1lLCB0eXBlLCB2YWx1ZSk7CisgICAgb3V0IDw8IG5hbWUgPDwgIiA9ICIgPDwgdjIgPDwgIjsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICBvdXQgPDwgbmFtZSA8PCAiID0gIiA8PCByZW5kZXJfY29uc3RfdmFsdWUob3V0LCBuYW1lLCB0eXBlLCB2YWx1ZSkgPDwgIjsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2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B0aHJvdyAiY29tcGlsZXIgZXJyb3I6IG5vIGNvbnN0IG9mIHR5cGUgIiArIHR5cGUtPmdldF9uYW1lKCk7CisgIH0KK30KKworc3RyaW5nIHRfamF2YW1lX2dlbmVyYXRvcjo6cmVuZGVyX2NvbnN0X3ZhbHVlKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9jb25zdF92YWx1ZSogdmFsdWUpIHsKKyAgKHZvaWQpbmFtZTsKKyAgdHlwZSA9IGdldF90cnVlX3R5cGUodHlwZSk7CisgIHN0ZDo6b3N0cmluZ3N0cmVhbSByZW5kZXI7CisKKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKSB7CisgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOworICAgIHN3aXRjaCAodGJhc2UpIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgIHJlbmRlciA8PCAnIicgPDwgZ2V0X2VzY2FwZWRfc3RyaW5nKHZhbHVlKSA8PCAnIic7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICByZW5kZXIgPDwgKCh2YWx1ZS0+Z2V0X2ludGVnZXIoKSA+IDApID8gInRydWUiIDogImZhbHNlIik7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgcmVuZGVyIDw8ICIoYnl0ZSkiIDw8IHZhbHVlLT5nZXRfaW50ZWdlcigpOworICAgICAgYnJlYWs7CisgICAgY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ksIHRydWUsIGZhbHNlKSA8PCAiICIgPDwgZmllbGQtPmdldF9uYW1lKCkgPDwgIjsiCisgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvdXQsIGZpZWxkLCAiIik7CisgICAgaW5kZW50KG91dCkgPDwgInJldHVybiAiIDw8IGZpZWxkLT5nZXRfbmFtZSgpIDw8ICI7IiA8PCBlbmRsOworICAgIGluZGVudF9kb3duKCk7CisgICAgaW5kZW50KG91dCkgPDwgIn0gZWxzZSB7IiA8PCBlbmRsOworICAgIGluZGVudChvdXQpIDw8ICIgIFRQcm90b2NvbFV0aWwuc2tpcChpcHJvdCwgZmllbGQudHlwZSk7IiA8PCBlbmRsOworICAgIGluZGVudChvdXQpIDw8ICIgIHJldHVybiBudWxsOyIgPDwgZW5kbDsKKyAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworICB9CisKKyAgaW5kZW50KG91dCkgPDwgImRlZmF1bHQ6IiA8PCBlbmRsOworICBpbmRlbnQob3V0KSA8PCAiICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwic2V0RmllbGQgd2Fzbid0IG51bGwsIGJ1dCBkaWRuJ3QgbWF0Y2ggYW55ICIKKyAgICAgICAgICAgICAgICAgIm9mIHRoZSBjYXNlIHN0YXRlbWVudHMhXCIpOyIgPDwgZW5kbDsKKworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKworICBpbmRlbnRfZG93bigpOworICBpbmRlbnQob3V0KSA8PCAifSBlbHNlIHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAiVFByb3RvY29sVXRpbC5za2lwKGlwcm90LCBmaWVsZC50eXBlKTsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJyZXR1cm4gbnVsbDsi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8PCAiICByZXR1cm4gMDsiIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworfQorCisvKioKKyAqIEphdmEgc3RydWN0IGRlZmluaXRpb24uIFRoaXMgaGFzIHZhcmlvdXMgcGFyYW1ldGVycywgYXMgaXQgY291bGQgYmUKKyAqIGdlbmVyYXRlZCBzdGFuZGFsb25lIG9yIGluc2lkZSBhbm90aGVyIGNsYXNzIGFzIGEgaGVscGVyLiBJZiBpdAorICogaXMgYSBoZWxwZXIgdGhhbiBpdCBpcyBhIHN0YXRpYyBjbGFzcy4KKyAqCisgKiBAcGFyYW0gdHN0cnVjdCAgICAgIFRoZSBzdHJ1Y3QgZGVmaW5pdGlvbgorICogQHBhcmFtIGlzX2V4Y2VwdGlvbiBJcyB0aGlzIGFuIGV4Y2VwdGlvbj8KKyAqIEBwYXJhbSBpbl9jbGFzcyAgICAgSWYgaW5zaWRlIGEgY2xhc3MsIG5lZWRzIHRvIGJlIHN0YXRpYyBjbGFzcworICogQHBhcmFtIGlzX3Jlc3VsdCAgICBJZiB0aGlzIGlzIGEgcmVzdWx0IGl0IG5lZWRzIGEgZGlmZmVyZW50IHdyaXRlcgorICovCit2b2lkIHRfamF2YW1lX2dlbmVyYXRvcjo6Z2VuZXJhdGVfamF2YV9zdHJ1Y3RfZGVmaW5pdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfZXhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbl9jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wga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zZSkgPDwgZW5kbDsKKyAgfQorCisgIC8vIGlzc2V0IGRhdGEKKyAgaWYgKG1lbWJlcnMuc2l6ZSgpID4gMCkgeworICAgIG91dCA8PCBlbmRsOworCisgICAgaW5kZW50KG91dCkgPDwgIi8vIGlzc2V0IGlkIGFzc2lnbm1lbnRzIiA8PCBlbmRsOworCisgICAgaW50IGkgPSAwOworICAgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsgKyttX2l0ZXIpIHsKKyAgICAgIGlmICghdHlwZV9jYW5fYmVfbnVsbCgoKm1faXRlciktPmdldF90eXBlKCkpKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgIiA8PCBpc3NldF9maWVsZF9pZCgqbV9pdGVyKSA8PCAiID0gIiA8PCBpIDw8ICI7IgorICAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgICBpKys7CisgICAgICB9CisgICAgfQorCisgICAgaWYgKGkgPiAwKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAicHJpdmF0ZSBib29sZWFuW10gX19pc3NldF92ZWN0b3IgPSBuZXcgYm9vbGVhblsiIDw8IGkgPDwgIl07IiA8PCBlbmRsOworICAgIH0KKworICAgIG91dCA8PCBlbmRsOworICB9CisKKyAgYm9vbCBhbGxfb3B0aW9uYWxfbWVtYmVycyA9IHRydWU7CisKKyAgLy8gRGVmYXVsdCBjb25zdHJ1Y3RvcgorICBpbmRlbnQob3V0KSA8PCAicHVibGljICIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiKCkgeyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsgKyttX2l0ZXIpIHsKKyAgICB0X3R5cGUqIHQgPSBnZXRfdHJ1ZV90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgaWYgKCgqbV9pdGVyKS0+Z2V0X3ZhbHVlKCkgIT0gTlVMTCkgeworICAgICAgcHJpbnRfY29uc3RfdmFsdWUob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMuIiArICgqbV9pdGVyKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHQsCisgICAgICAgICAgICAgICAgICAgICAgICAoKm1faXRlciktPmdldF92YWx1ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRydWUpOworICAgIH0KKyAgICBpZiAoKCptX2l0ZXIpLT5nZXRfcmVxKCkgIT0gdF9maWVsZDo6VF9PUFRJT05BTCkgeworICAgICAgYWxsX29wdGlvbmFsX21lbWJlcnMgPSBmYWxzZTsKKyAgICB9CisgIH0KKyAgaW5kZW50X2Rvd24oKTsKKyAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKworICBpZiAoIW1lbWJlcnMuZW1wdHkoKSAmJiAhYWxsX29wdGlvbmFsX21lbWJlcnMpIHsKKyAgICAvLyBGdWxsIGNvbnN0cnVjdG9yIGZvciBhbGwgZmllbGRzCisgICAgaW5kZW50KG91dCkgPDwgInB1YmxpYyAiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgIigiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgYm9vbCBmaXJzdCA9IHRydWU7CisgICAgZm9yIChtX2l0ZXIgPSBtZW1iZXJzLmJlZ2luKCk7IG1faXRlciAhPSBtZW1iZXJzLmVuZCgpOyArK21faXRlcikgeworICAgICAgaWYgKCgqbV9pdGVyKS0+Z2V0X3JlcSgpICE9IHRfZmllbGQ6OlRfT1BUSU9OQUwpIHsKKyAgICAgICAgaWYgKCFmaXJzdCkgeworICAgICAgICAgIG91dCA8PCAiLCIgPD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byb3Qud3JpdGVGaWVsZEJlZ2luKCIgPDwgY29uc3RhbnRfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpCisgICAgICAgICAgICAgICAgPDwgIl9GSUVMRF9ERVNDKTsiIDw8IGVuZGw7CisKKyAgICAvLyBXcml0ZSBmaWVsZCBjb250ZW50cworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIsICJ0aGlzLiIpOworCisgICAgLy8gV3JpdGUgZmllbGQgY2xvc2VyCisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlRmllbGRFbmQoKTsiIDw8IGVuZGw7CisKKyAgICBpbmRlbnRfZG93bigpOworICAgIGluZGVudChvdXQpIDw8ICJ9IjsKKyAgfQorICAvLyBXcml0ZSB0aGUgc3RydWN0IG1hcAorICBvdXQgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAib3Byb3Qud3JpdGVGaWVsZFN0b3AoKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgIDw8ICJvcHJvdC53cml0ZVN0cnVjdEVuZCgpOyIgPDwgZW5kbDsKKworICBpbmRlbnRfZG93bigpOworICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3JlZmxlY3Rpb25fZ2V0dGVycyhvc3RyaW5nc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjYXBfbmFtZSkgeworICBpbmRlbnQob3V0KSA8PCAiY2FzZSAiIDw8IGNvbnN0YW50X25hbWUoZmllbGRfbmFtZSkgPDwgIjoiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSAmJiAhdHlwZS0+aXNfc3RyaW5nKCkpIHsKKyAgICB0X2Jhc2VfdHlwZSogYmFzZV90eXBlID0gKHRfYmFzZV90eXBlKil0eXBlOworCisgICAgaW5kZW50KG91dCkgPDwgInJldHVybiBuZXcgIiA8PCB0eXBlX25hbWUodHlwZSwgdHJ1ZSwgZmFsc2UpIDw8ICIoIgorICAgICAgICAgICAgICAgIDw8IChiYXNlX3R5cGUtPmlzX2Jvb2woKSA/ICJpcyIgOiAiZ2V0IikgPDwgY2FwX25hbWUgPDwgIigpKTsiIDw8IGVuZGwgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIGdldCIgPDwgY2FwX25hbWUgPDwgIigpOyIgPDwgZW5kbCA8PCBlbmRsOworICB9CisKKyAgaW5kZW50X2Rvd24oKTsKK30KKwordm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3JlZmxlY3Rpb25fc2V0dGVycyhvc3RyaW5nc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjYXBfbmFtZSkgeworICBpbmRlbnQob3V0KSA8PCAiY2FzZSAiIDw8IGNvbnN0YW50X25hbWUoZmllbGRfbmFtZSkgPDwgIjoiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBpbmRlbnQob3V0KSA8PCAiaWYgKHZhbHVlID09IG51bGwpI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mYWxzZSwgdHJ1ZSkgPDwgIigpOyIKKyAgICAgICAgICAgICAgICAgIDw8IGVuZGw7CisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaW5kZW50KG91dCkgPDwgIn0iIDw8IGVuZGw7CisgICAgICBpZiAodHlwZS0+aXNfc2V0KCkpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInRoaXMuIiA8PCBmaWVsZF9uYW1lIDw8ICIucHV0KCIgPDwgYm94X3R5cGUoZWxlbWVudF90eXBlLCAiZWxlbSIpIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgICAgPDwgYm94X3R5cGUoZWxlbWVudF90eXBlLCAiZWxlbSIpIDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ0aGlzLiIgPDwgZmllbGRfbmFtZSA8PCAiLmFkZEVsZW1lbnQoIiA8PCBib3hfdHlwZShlbGVtZW50X3R5cGUsICJlbGVtIikKKyAgICAgICAgICAgICAgICAgICAgPDwgIik7IiA8PCBlbmRsOworICAgICAgfQorICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7CisKKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX21hcCgpKSB7CisgICAgICAvLyBQdXQgdG8gbWFwCisgICAgICB0X3R5cGUqIGtleV90eXBlID0gKCh0X21hcCopdHlwZSktPmdldF9rZXlfdHlwZSgpOworICAgICAgdF90eXBlKiB2YWxfdHlwZSA9ICgodF9tYXAqKXR5cGUpLT5nZXRfdmFsX3R5cGUoKTsKKworICAgICAgaW5kZW50KG91dCk7CisgICAgICBvdXQgPDwgInB1YmxpYyB2b2lkIHB1dFRvIiA8PCBjYXBfbmFtZSA8PCAiKCIgPDwgdHlwZV9uYW1lKGtleV90eXBlLCB0cnVlKSA8PCAiIGtleSwgIgorICAgICAgICAgIDw8IHR5cGVfbmFtZSh2YW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nlc3MiKSA8PCBnZXRfY2FwX25hbWUoImlzU2V0IikKKyAgICAgICAgICAgICAgIDw8ICIodHJ1ZSk7IiA8PCBlbmRsOworICB9CisKKyAgaWYgKCF0ZnVuY3Rpb24tPmlzX29uZXdheSgpICYmIHhjZXB0aW9ucy5zaXplKCkgPiAwKSB7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJ9IjsKKyAgICBmb3IgKHhfaXRlciA9IHhjZXB0aW9ucy5iZWdpbigpOyB4X2l0ZXIgIT0geGNlcHRpb25zLmVuZCgpOyArK3hfaXRlcikgeworICAgICAgZl9zZXJ2aWNlXyA8PCAiIGNhdGNoICgiIDw8IHR5cGVfbmFtZSgoKnhfaXRlciktPmdldF90eXBlKCksIGZhbHNlLCBmYWxzZSkgPDwgIiAiCisgICAgICAgICAgICAgICAgIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiKSB7IiA8PCBlbmRsOworICAgICAgaWYgKCF0ZnVuY3Rpb24tPmlzX29uZXdheSgpKSB7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICJyZXN1bHQuIiA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIiA9ICIKKyAgICAgICAgICAgICAgICAgICA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIn0iOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCAifSI7CisgICAgICB9CisgICAgfQorICAgIGZfc2VydmljZV8gPDwgIiBjYXRjaCAoVGhyb3dhYmxlIHRoKSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIlRBcH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JTkc6CisgICAgICBpZiAoIXR5cGUtPmlzX2JpbmFyeSgpKSB7CisgICAgICAgIG91dCA8PCAicmVhZFN0cmluZygpOyI7CisgICAgICB9IGVsc2UgeworICAgICAgICBvdXQgPDwgInJlYWRCaW5hcnkoKTsiOworICAgICAgfQorICAgICAgYnJlYWs7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgb3V0IDw8ICJyZWFkQm9vbCgpOyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgb3V0IDw8ICJyZWFkQnl0ZSgpOyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgIG91dCA8PCAicmVhZEkxNigpOyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgIG91dCA8PCAicmVhZEkzMigpOyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgIG91dCA8PCAicmVhZEk2NCgpOyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgIG91dCA8PCAicmVhZERvdWJsZSgpOyI7CisgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBKYXZhIG5hbWUgZm9yIGJhc2UgdHlwZSAiICsgdF9iYXNlX3R5cGU6OnRfYmFzZV9uYW1lKHRiYXNlKTsKKyAgICB9CisgICAgb3V0IDw8IGVuZGw7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgbmFtZSA8PCAiID0gIgorICAgICAgICAgICAgICAgIDw8IHR5cGVfbmFtZSh0ZmllbGQtPmdldF90eXBlKCksIHRydWUsI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UtPmlzX2xpc3QoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJpcHJvdC5yZWFkTGlzdEVuZCgpOyIgPDwgZW5kbDsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKK30KKworLyoqCisgKiBHZW5lcmF0ZXMgY29kZSB0byBkZXNlcmlhbGl6ZSBhIG1hcAorICovCit2b2lkIHRfamF2YW1lX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKKyAgc3RyaW5nIGtleSA9IHRtcCgiX2tleSIpOworICBzdHJpbmcgdmFsID0gdG1wKCJfdmFsIik7CisgIHRfZmllbGQgZmtleSh0bWFwLT5nZXRfa2V5X3R5cGUoKSwga2V5KTsKKyAgdF9maWVsZCBmdmFsKHRtYXAtPmdldF92YWxfdHlwZSgpLCB2YWwpOworCisgIGluZGVudChvdXQpIDw8IGRlY2xhcmVfZmllbGQoJmZrZXkpIDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8IGRlY2xhcmVfZmllbGQoJmZ2YWwpIDw8IGVuZGw7CisKKyAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfZmllbGQob3V0LCAmZmtleSk7CisgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZ2YWwpOworCisgIGluZGVudChvdXQpIDw8IHByZWZpeCA8PCAiLnB1dCgiIDw8IGJveF90eXBlKHRtYXAtPmdldF9rZXlfdHlwZSgpLCBrZXkpIDw8ICIsICIKKyAgICAgICAgICAgICAgPDwgYm94X3R5cGUodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHZhbCkgPDwgIik7IiA8PCBlbmRsOworfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIHNldCBlbGVtZW50CisgKi8KK3ZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXQqIHRzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICBzdHJpbmcgZWxlbSA9IHRtcCgiX2VsZW0iKTsKKyAgdF9maWVsZCBmZWxlbSh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pOworCisgIGluZGVudChvdXQpIDw8IGRlY2xhcmVfZmllbGQoJmZlbGVtKSA8PCBlbmRsOworCisgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgJmZlbGVtKTsKKworICBpbmRlbnQob3V0KSA8PCBwcmVmaXggPDwgIi5wdXQoIiA8PCBib3hfdHlwZSh0c2V0LT5nZXRfZWxlbV90eXBlKCksIGVsZW0pIDw8ICIsICIKKyAgICAgICAgICAgICAgPDwgYm94X3R5cGUodHNldC0+Z2V0X2VsZW1fdHlwZSgpLCBlbGVtKSA8PCAiKTsiIDw8IGVuZGw7Cit9CisKKy8qKgorICogRGVzZXJpYWxpemVzIGEgbGlzdCBlbGVtZW50CisgKi8KK3ZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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CAiKTsiOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIG91dCA8PCAid3JpdGVTdHJpbmcoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAid3JpdGVCb29sKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgIG91dCA8PCAid3JpdGVCeXRlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgIndyaXRlSTMyKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICBvdXQgPDwgIndyaXRlSTY0KCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlKCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gSmF2YSBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIG91dCA8PCAid3JpdGVJMzIoIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgfQorICAgIG91dCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnJXMlcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICBwcmVmaXguY19zdHIoKSwKKyAgICAgICAgICAgdGZpZWxkLT5nZXRfbmFtZSgpLmNfc3RyKCksCisgICAgICAgICAgIHR5cGVfbmFtZSh0eXBlKS5jX3N0cigpKTsKKyAgfQorfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgYWxsIHRoZSBtZW1iZXJzIG9mIGEgc3RydWN0LgorICoKKyAqIEBwYXJhbSB0c3RydWN0IFRoZSBzdHJ1Y3QgdG8gc2VyaWFsaXplCisgKiBAcGFyYW0gcHJlZml4ICBTdHJpbmcgcHJlZml4IHRvIGF0dGFjaCB0byBhbGwgZmllbGRzCisgKi8KK3ZvaWQgdF9qYXZhbWVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHByZWZpeCkgeworICAodm9pZCl0c3RydWN0OworICBvdXQgPDwgaW5kZW50KCkgPDwgcHJlZml4IDw8ICIud3JpdGUob3Byb3QpOyIgPDwgZW5kbDsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIGEgY29udGFpbmVyIGJ5IHdyaXRpbmcgaXRzIHNpemUgdGhlbiB0aGUgZWxlbWVudHMuCisgKgorICogQHBhcmFtIHR0eXBlICBUaGUgdHlwZSBvZiBjb250YWluZXIKKyAqIEBwYXJhbSBwcmVmaXggU3RyaW5nIHByZWZpeCBmb3IgZmllbGRzCis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gIm9wcm90LndyaXRlTWFwRW5kKCk7IiA8PCBlbmRsOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdC53cml0ZVNldEVuZCgpOyIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90LndyaXRlTGlzdEVuZCgpOyIgPDwgZW5kbDsKKyAgfQorCisgIHNjb3BlX2Rvd24ob3V0KTsKK30KKworLyoqCisgKiBTZXJpYWxpemVzIHRoZSBtZW1iZXJzIG9mIGEgbWFwLgorICovCit2b2lkIHRfamF2YW1lX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgbWFwKSB7CisgIHRfZmllbGQga2ZpZWxkKHRtYXAtPmdldF9rZXlfdHlwZSgpLCBpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmtmaWVsZCwgIiIpOworICBzdHJpbmcgdmFsX3R5cGUgPSB0eXBlX25hbWUodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHRydWUsIGZhbHNlKTsKKyAgdF9maWVsZCB2ZmllbGQodG1hcC0+Z2V0X3ZhbF90eXBlKCksICIoKCIgKyB2YWxfdHlwZSArICIpIiArIG1hcCArICIuZ2V0KCIgKyBpdGVyICsgIikpIik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZ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qIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5fY29udGFpbmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaW5faW5pdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIHNraXBfZ2VuZXJpYykgeworICAodm9pZClpbl9pbml0OworICAodm9pZClza2lwX2dlbmVyaWM7CisgIC8vIEluIEphdmEgdHlwZWRlZnMgYXJlIGp1c3QgcmVzb2x2ZWQgdG8gdGhlaXIgcmVhbCB0eXBlCisgIHR0eXBlID0gZ2V0X3RydWVfdHlwZSh0dHlwZSk7CisgIHN0cmluZyBwcmVmaXg7CisKKyAgaWYgKHR0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIHJldHVybiBiYXNlX3R5cGVfbmFtZSgodF9iYXNlX3R5cGUqKXR0eXBlLCBpbl9jb250YWluZXIpOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIHJldHVybiAiSGFzaHRhYmxlIjsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICByZXR1cm4gIkhhc2h0YWJsZSI7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIHJldHVybiAiVmVjdG9yIjsKKyAgfQorCisgIC8vIENoZWNrIGZvciBuYW1lc3BhY2luZworICB0X3Byb2dyYW0qIHByb2dyYW0gPSB0dHlwZS0+Z2V0X3Byb2dyYW0oKTsKKyAgaWYgKHByb2dyYW0gIT0gTlVMTCAmJiBwcm9ncmFtICE9IHByb2dyYW1fKSB7CisgICAgc3RyaW5nIHBhY2thZ2UgPSBwcm9ncmFtLT5nZXRfbmFtZXNwYWNlKCJqYXZhIik7CisgICAgaWYgKCFwYWNrYWdlLmVtcHR5KCkpIHsKKyAgICAgIHJldHVybiBwYWNrYWdlICsgIi4iICsgdHR5cGUtPmdldF9uY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AgICBzcyA8PCAiICIgPDwgcC0+Z2V0X2RvYygpOworICAgICAgfQorICAgIH0KKyAgICBnZW5lcmF0ZV9kb2NzdHJpbmdfY29tbWVudChvdXQsICIvKipcbiIsICIgKiAiLCBzcy5zdHIoKSwgIiAqL1xuIik7CisgIH0KK30KKwordm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OmdlbmVyYXRlX2RlZXBfY29weV9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgc291cmNlX25hbWVfcDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzb3VyY2VfbmFtZV9wMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHJlc3VsdF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0eXBlKSB7CisKKyAgdF9jb250YWluZXIqIGNvbnRhaW5lciA9ICh0X2NvbnRhaW5lciopdHlwZTsKKyAgc3RkOjpzdHJpbmcgc291cmNlX25hbWU7CisgIGlmIChzb3VyY2VfbmFtZV9wMiA9PSAiIikKKyAgICBzb3VyY2VfbmFtZSA9IHNvdXJjZV9uYW1lX3AxOworICBlbHNlCisgICAgc291cmNlX25hbWUgPSBzb3VyY2VfbmFtZV9wMSArICIuIiArIHNvdXJjZV9uYW1lX3AyOworCisgIGluZGVudChvdXQpIDw8IHR5cGVfbmFtZSh0eXBlLCB0cnVlLCBmYWxzZSkgPDwgIiAiIDw8IHJlc3VsdF9uYW1lIDw8ICIgPSBuZXcgIgorICAgICAgICAgICAgICA8PCB0eXBlX25hbWUoY29udGFpbmVyLCBmYWxzZSwgdHJ1ZSkgPDwgIigpOyIgPDwgZW5k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bHNlKSA8PCAiICIgPDwgaXRlcmF0b3JfZWxlbWVudF9uYW1lIDw8ICJfdmFsdWUgPSAoIgorICAgICAgICAgICAgICAgIDw8IHR5cGVfbmFtZSh2YWxfdHlwZSwgdHJ1ZSwgZmFsc2UpIDw8ICIpIiA8PCBzb3VyY2VfbmFtZSA8PCAiLmdldCgiCisgICAgICAgICAgICAgICAgPDwgaXRlcmF0b3JfZWxlbWVudF9uYW1lIDw8ICJfa2V5KTsiIDw8IGVuZGw7CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGlmIChrZXlfdHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9jb250YWluZXIob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcl9lbGVtZW50X25hbWUgKyAiX2tleSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRfZWxlbWVudF9uYW1lICsgIl9rZXkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSk7CisgICAgfSBlbHNlIHsKKyAgICAgIGluZGVudChvdXQpIDw8IHR5cGVfbmFtZShrZXlfdHlwZSwgdHJ1ZSwgZmFsc2UpIDw8ICIgIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lIDw8ICJfa2V5ID0gIjsKKyAgICAgIGdlbmVyYXRlX2RlZXBfY29weV9ub25fY29udGFpbmVyKG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yX2VsZW1lbnRfbmFtZSArICJfa2V5IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdF9lbGVtZW50X25hbWUgKyAiX2tleSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSk7CisgICAgICBvdXQgPDwgIjsiIDw8IGVuZGw7CisgICAgfQorCisgICAgb3V0IDw8IGVuZGw7CisKKyAgICBpZiAodmFsX3R5cGUtPmlzX2NvbnRhaW5lcigpKSB7CisgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfY29udGFpbmVyKG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlcmF0b3JfZWxlbWVudF9uYW1lICsgIl92YWx1ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRfZWxlbWVudF9uYW1lICsgIl92YWx1ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbF90eXBlKTsKKyAgICB9IGVsc2UgeworICAgICAgaW5kZW50KG91dCkgPDwgdHlwZV9uYW1lKHZhbF90eXBlLCB0cnVlLCBmYWxzZSkgPDwgIiAiIDw8IHJlc3VsdF9lbGVtZW50X25hbWUgPDwgIl92YWx1ZSA9ICI7CisgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfbm9uX2NvbnRhaW5lcihvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcl9lbGVtZW50X25hbWUgKyAiX3ZhbHVlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdF9lbGVtZW50X25hbWUgKyAiX3ZhbHVlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbF90eXBlKTsKKyAgICAgIG91dCA8PCAiOyIgPDwgZW5kbDsKKyAgICB9CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGluZGVudChvdXQpIDw8IHJlc3VsdF9uYW1lIDw8ICIucHV0KCIgPDwgcmVzdWx0X2VsZW1lbnRfbmFtZSA8PCAiX2tleSwgIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lCisgIC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yX2VsZW1lbnRfbmFtZSwgIiIsIHJlc3VsdF9lbGVtZW50X25hbWUsIGVsZW1fdHlwZSk7CisgICAgICBpZiAoZWxlbV90eXBlLT5pc19saXN0KCkpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgcmVzdWx0X25hbWUgPDwgIi5hZGRFbGVtZW50KCIgPDwgcmVzdWx0X2VsZW1lbnRfbmFtZSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICB9IGVsc2UgeworICAgICAgICBpbmRlbnQob3V0KSA8PCByZXN1bHRfbmFtZSA8PCAiLnB1dCgiIDw8IHJlc3VsdF9lbGVtZW50X25hbWUgPDwgIiwgIiA8PCByZXN1bHRfZWxlbWVudF9uYW1lCisgICAgICAgICAgICAgICAgICAgIDw8ICIpOyIgPDwgZW5kbDsKKyAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgLy8gaXRlcmF0aXZlIGNvcHkKKyAgICAgIGlmIChlbGVtX3R5cGUtPmlzX2JpbmFyeSgpKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8IHR5cGVfbmFtZShlbGVtX3R5cGUsIHRydWUsIGZhbHNlKSA8PCAiIHRlbXBfYmluYXJ5X2VsZW1lbnQgPSAiOworICAgICAgICBnZW5lcmF0ZV9kZWVwX2NvcHlfbm9uX2NvbnRhaW5lcihvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yX2VsZW1lbnRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRlbXBfYmluYXJ5X2VsZW1lbnQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtX3R5cGUpOworICAgICAgICBvdXQgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGlmIChlbGVtX3R5cGUtPmlzX2xpc3QoKSkgeworICAgICAgICAgIGluZGVudChvdXQpIDw8IHJlc3VsdF9uYW1lIDw8ICIuYWRkRWxlbWVudCh0ZW1wX2JpbmFyeV9lbGVtZW50KTsiIDw8IGVuZGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgcmVzdWx0X25hbWUgPDwgIi5wdXQodGVtcF9iaW5hcnlfZWxlbWVudCwgdGVtcF9iaW5hcnlfZWxlbWVudCk7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICBpbmRlbnQob3V0KSA8PCByZXN1bHRfbmFtZSA8PCAiLmFkZEVsZW1lbnQoIjsKKyAgICAgICAgZ2VuZXJhdGVfZGVlcF9jb3B5X25vbl9jb250YWluZXIob3V0LCBpdGVyYXRvcl9lbGVtZW50X25hbWUsIHJlc3VsdF9uYW1lLCBlbGVtX3R5cGUpOworICAgICAgICBvdXQgPDwgIik7IiA8PCBlbmRsOworICAgICAgfQorICAgIH0KKworICAgIGluZGVudF9kb3duKCk7CisKKyAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgfQorfQorCit2b2lkIHRfamF2YW1lX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVlcF9jb3B5X25vbl9jb250YWluZXIob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNvdXJjZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc3RfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUpIHsKKyAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpIHx8IHR5cGUtPmlzX2VudW0oKSB8fCB0eXBlLT5pc190eXBlZGVmKCkpIHsKKyAgICAvLyBiaW5hcnkgZmllbGRzIG5lZWQgdG8gYm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l0ZXIpIHsKKyAgICBpZiAoIXR5cGVfY2FuX2JlX251bGwoZ2V0X3RydWVfdHlwZSgoKm1faXRlciktPmdldF90eXBlKCkpKSkgeworICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICB9CisgIHJldHVybiBmYWxzZTsKK30KKwordm9pZCB0X2phdmFtZV9nZW5lcmF0b3I6OmdlbmVyYXRlX2phdmFfc3RydWN0X2NsZWFyKHN0ZDo6b3N0cmVhbSYgb3V0LCB0X3N0cnVjdCogdHN0cnVjdCkgeworICBpbmRlbnQob3V0KSA8PCAicHVibGljIHZvaWQgY2xlYXIoKSB7IiA8PCBlbmRsOworCisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7CisKKyAgaW5kZW50X3VwKCk7CisgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsgKyttX2l0ZXIpIHsKKyAgICB0X3R5cGUqIHQgPSBnZXRfdHJ1ZV90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgaWYgKCgqbV9pdGVyKS0+Z2V0X3ZhbHVlKCkgIT0gTlVMTCkgeworICAgICAgcHJpbnRfY29uc3RfdmFsdWUob3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMuIiArICgqbV9pdGVyKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHQsCisgICAgICAgICAgICAgICAgICAgICAgICAoKm1faXRlciktPmdldF92YWx1ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRydWUpOworICAgIH0gZWxzZSB7CisgICAgICBpZiAodHlwZV9jYW5fYmVfbnVsbCh0KSkgeworICAgICAg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y5zdWJzdHIoMCwgbG9jKSk7CisgICAgICAgIG5zID0gbnMuc3Vic3RyKGxvYyArIDEpOworICAgICAgfQorICAgIH0KKworICAgIGlmIChucy5zaXplKCkgPiAwKSB7CisgICAgICBwaWVjZXMucHVzaF9iYWNrKG5zKTsKKyAgICB9CisKKyAgICByZXR1cm4gcGllY2VzOworICB9CisKKyAgc3RkOjpzdHJpbmcganNfdHlwZV9uYW1lc3BhY2UodF9wcm9ncmFtKiBwKSB7CisgICAgaWYgKGdlbl9ub2RlXykgeworICAgICAgaWYgKHAgIT0gTlVMTCAmJiBwICE9IHByb2dyYW1fKSB7CisgICAgICAgIHJldHVybiBtYWtlX3ZhbGlkX25vZGVKc19pZGVudGlmaWVyKHAtPmdldF9uYW1lKCkpICsgIl90dHlwZXMuIjsKKyAgICAgIH0KKyAgICAgIHJldHVybiAidHR5cGVzLiI7CisgICAgfQorICAgIHJldHVybiBqc19uYW1lc3BhY2UocCk7CisgIH0KKworICBzdGQ6OnN0cmluZyBqc19leHBvcnRfbmFtZXNwYWNlKHRfcHJvZ3JhbSogcCkgeworICAgIGlmIChnZW5fbm9kZV8pIHsKKyAgICAgIHJldHVybiAiZXhwb3J0cy4iOworICAgIH0KKyAgICByZXR1cm4ganNfbmFtZXNwYWNlKHApOworICB9CisKKyAgYm9vbCBoYXNfanNfbmFtZXNwYWNlKHRfcHJvZ3JhbSogcCkgeworICAgIGlmIChub19uc18pIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgc3RkOjpzdHJpbmcgbnMgPSBwLT5nZXRfbmFtZXNwYWNlKCJqcyIpOworICAgIHJldHVybiAobnMuc2l6ZSgpID4gMCk7CisgIH0KKworICBzdGQ6OnN0cmluZyBqc19uYW1lc3BhY2UodF9wcm9ncmFtKiBwKSB7CisgICAgaWYgKG5vX25zXykgeworICAgICAgcmV0dXJuICIiOworICAgIH0KKyAgICBzdGQ6OnN0cmluZyBucyA9IHAtPmdldF9uYW1lc3BhY2UoImpz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9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX2V4cG9ydGVkKSB7CisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7CisKKyAgaWYgKGdlbl9ub2RlXykgeworICAgIHN0cmluZyBwcmVmaXggPSBoYXNfanNfbmFtZXNwYWNlKHRzdHJ1Y3QtPmdldF9wcm9ncmFtKCkpID8ganNfbmFtZXNwYWNlKHRzdHJ1Y3QtPmdldF9wcm9ncmFtKCkpIDoganNfY29uc3RfdHlwZV87CisgICAgb3V0IDw8IHByZWZpeCA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8CisgICAgICAoaXNfZXhwb3J0ZWQgPyAiID0gbW9kdWxlLmV4cG9ydHMuIiArIHRzdHJ1Y3QtPmdldF9uYW1lKCkgOiAiIik7CisgICAgaWYgKGdlbl90c18pIHsKKyAgICAgIGZfdHlwZXNfdHNfIDw8IHRzX3ByaW50X2RvYyh0c3RydWN0KSA8PCB0c19pbmRlbnQoKSA8PCB0c19kZWNsYXJlKCkgPDwgImNsYXNzICIKKyAgICAgICAgICAgICAgICAgIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgKGlzX2V4Y2VwdGlvbiA/ICIgZXh0ZW5kcyBUaHJpZnQuVEV4Y2VwdGlvbiIgOiAiIikKKyAgICAgICAgICAgICAgICAgIDw8ICIgeyIgPDwgZW5kbDsKKyAgICB9CisgIH0gZWxzZSB7CisgICAgb3V0IDw8IGpzX25hbWVzcGFjZSh0c3RydWN0LT5nZXRfcHJvZ3JhbSgpKSA8PCB0c3RydWN0LT5nZXRfbmFtZSgpOworICAgIGlmIChnZW5fdHNfKSB7CisgICAgICBmX3R5cGVzX3RzXyA8PCB0c19wcmludF9kb2ModHN0cnVjdCkgPDwgdHNfaW5kZW50KCkgPDwgdHNfZGVjbGFyZSgpIDw8ICJjbGFzcyAiCisgICAgICAgICAgICAgICAgICA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8IChpc19leGNlcHRpb24gPyAiIGV4dGVuZHMgVGhyaWZ0LlRFeGNlcHRpb24iIDogIiIpCisgICAgICAgICAgICAgICAgICA8PCAiIHsiIDw8IGVuZGw7CisgICAgfQorICB9CisKKyAgaWYgKGdlbl9lczZfKSB7CisgICAgaWYgKGdlbl9ub2RlXyAmJiBpc19leGNlcHRpb24pIHsKKyAgICAgIG91dCA8PCAiID0gY2xhc3MgZXh0ZW5kcyBUaHJpZnQuVEV4Y2VwdGlvbiB7IiA8PCBlbmRsOworICAgIH0gZWxzZSB7CisgICAgICBvdXQgPDwgIiA9IGNsYXNzIHsiIDw8IGVuZGw7CisgICAgfQorICAgIGluZGVudF91cCgpOworICAgIGluZGVudChvdXQpIDw8ICJjb25zdHJ1Y3RvcihhcmdzKSB7IiA8PCBlbmRsOworICB9IGVsc2UgeworICAgIG91dCA8PCAiID0gZnVuY3Rpb24oYXJncykgeyIgPDwgZW5kbDsKKyAgfQorCisgIGluZGVudF91cCgpOworCisgIC8vIENhbGwgc3VwZXIoKSBtZXRob2Qgb24gaW5oZXJpdGVkIEVycm9yIGNsYXNzCisgIGlmIChnZW5fbm9kZV8gJiYgaXNfZXhjZXB0aW9uKSB7CisgICAgaWYgKGdlbl9lczZfKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAic3VwZXIoYXJncyk7IiA8PCBlbmRsOworICAgIH0gZWxzZSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiVGhya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HsKKyAgICAgIGlmIChnZW5fbm9kZV8pIHsKKyAgICAgICAgZl90eXBlc190c18gPDwgdHNfaW5kZW50KCkgPDwgInB1YmxpYyAiIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiOiAiCisgICAgICAgICAgICAgICAgICAgIDw8IHRzX2dldF90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSkgPDwgIjsiIDw8IGVuZGw7CisgICAgICB9IGVsc2UgeworICAgICAgICBmX3R5cGVzX3RzXyA8PCB0c19pbmRlbnQoKSA8PCAoKm1faXRlciktPmdldF9uYW1lKCkgPDwgIjogIgorICAgICAgICAgICAgICAgICAgICA8PCB0c19nZXRfdHlwZSgoKm1faXRlciktPmdldF90eXBlKCkpIDw8ICI7IiA8PCBlbmRsOworICAgICAgfQorICAgICAgCisgICAgfQorICB9CisKKyAgLy8gR2VuZXJhdGUgY29uc3RydWN0b3IgZnJvbSBhcnJheQorICBpZiAobWVtYmVycy5zaXplKCkgPiAwKSB7CisKKyAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKSB7CisgICAgICB0X3R5cGUqIHQgPSBnZXRfdHJ1ZV90eXBlKCgqbV9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgICBpZiAoKCptX2l0ZXIpLT5nZXRfdmFsdWUoKSAhPSBOVUxMICYmICh0LT5pc19zdHJ1Y3QoKSB8fCB0LT5pc194Y2VwdGlvbigpKSkgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAidGhpcy4iIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiID0gIgorICAgICAgICAgICAgICAgICAgICA8PCByZW5kZXJfY29uc3RfdmFsdWUodCwgKCptX2l0ZXIpLT5nZXRfdmFsdWUoKSkgPDwgIjsiIDw8IGVuZGw7CisgICAgICB9CisgICAgfQorCisgICAgLy8gRWFybHkgcmV0dXJ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gfQorCisgICAgICAgIGlmIChldHlwZS0+aXNfc3RydWN0KCkpIHsKKyAgICAgICAgICBpZiAodHlwZV9saXN0Lmxlbmd0aCgpID4gMCkgeworICAgICAgICAgICAgdHlwZV9saXN0ICs9ICIsICI7CisgICAgICAgICAgfQorICAgICAgICAgIHR5cGVfbGlzdCArPSBqc190eXBlX25hbWVzcGFjZShldHlwZS0+Z2V0X3Byb2dyYW0oKSkgKyBldHlwZS0+Z2V0X25hbWUoKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICBpZiAodHlwZV9saXN0Lmxlbmd0aCgpID4gMCkgeworICAgICAgICAgICAgdHlwZV9saXN0ICs9ICIsICI7CisgICAgICAgICAgfQorICAgICAgICAgIHR5cGVfbGlzdCArPSAibnVsbCI7CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgKCIgPSAiICsgY29weUZ1bmMgKyAiKGFyZ3MuIiArICgqbV9pdGVyKS0+Z2V0X25hbWUoKSArCisgICAgICAgICAgICAgICAgIiwgWyIgKyB0eXBlX2xpc3QgKyAiXSk7Iik7CisgICAgICAgIG91dCA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgb3V0IDw8ICIgPSBhcmdzLiIgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICI7IiA8PCBlbmRsOworICAgICAgfQorCisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaWYgKCEoKm1faXRlciktPmdldF9yZXEoKSkgeworICAgICAgICBpbmRlbnQob3V0KSA8PCAifSBlbHNlIHsiIDw8IGVuZGw7CisgICAgICAgICBpbmRlbnQob3V0KQorICAgICAgICAgICAgPDwgIiAgdGhyb3cgbmV3IFRocmlmdC5UUHJvdG9jb2xFeGNlcHRpb24oVGhyaWZ0LlRQcm90b2NvbEV4Y2VwdGlvblR5cGUuVU5LTk9XTiwgIgorICAgICAgICAgICAgICAgIidSZXF1aXJlZCBmaWVsZCAiIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiIGlzIHVuc2V0IScpOyIgPDwgZW5kbDsKKyAgICAgIH0KKyAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgaWYgKGdlbl90c18pIHsKKyAgICAgICAgZl90eXBlc190c18gPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8IHRzX2dldF9yZXEoKm1faXRlcikgPDwgIjogIgorICAgICAgICAgICAgICAgICAgICA8PCB0c19nZXRfdHlwZSgoKm1faXRlciktPmdldF90eXBlKCkpIDw8ICI7ICI7CisgICAgICB9CisgICAgfQorICAgIGluZGVudF9kb3duKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgIGlmIChnZW5fdHNfKSB7CisgICAgICBmX3R5cGVzX3RzXyA8PCAifSk7IiA8PCBlbmRsOworICAgIH0KKyAgfQorCisgIC8vIERvbmUgd2l0aCBjb25zdHJ1Y3RvcgorICBpbmRlbnRfZG93bigpOworICBpZiAoZ2VuX2VzNl8pIHsKKyAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICB9IGVsc2UgeworICAgIGluZGVudChvdXQpIDw8ICJ9OyIgPDwgZW5kbDsKKyAgfQorCisgIGlmIChnZW5fdHNfKSB7CisgICAgZl90eXBlc190c18gPDwgdHNfaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7CisgIH0KKworICBpZiAoIWdlbl9lczZfKSB7CisgICAgaWYgKGlzX2V4Y2VwdGlvbikgeworICAgICAgb3V0IDw8ICJUaHJpZnQuaW5oZXJpdHMoIiA8PCBqc19uYW1lc3BhY2UodHN0cnVjdC0+Z2V0X3Byb2dyYW0oKSkgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKQorICAgICAgICAgIDw8ICIsIFRocmlmdC5URXhjZXB0aW9uKTsiIDw8IGVuZGw7CisgICAgICBvdXQgPDwganNfbmFtZXNwYWNlKHRzdHJ1Y3Q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AgICAgICAgICAgICAgICAgICAgICAgICAgKyAoKmZfaXRlciktPmdldF9uYW1lKCkgKyAiX3Jlc3VsdCI7CisKKyAgICAgIGZfc2VydmljZV8gPDwgZW5kbDsKKyAgICAgIC8vIE9wZW4gcmVjZWl2ZSBmdW5jdGlvbgorICAgICAgaWYgKGdlbl9ub2RlXykgeworICAgICAgICBpZiAoZ2VuX2VzNl8pIHsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInJlY3ZfIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIiAoaW5wdXQsIG10eXBlLCByc2VxaWQpIHsiIDw8IGVuZGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8IGpzX25hbWVzcGFjZSh0c2VydmljZS0+Z2V0X3Byb2dyYW0oKSkgPDwgc2VydmljZV9uYW1lXworICAgICAgICAgICAgICAgICAgICAgIDw8ICJDbGllbnQucHJvdG90eXBlLnJlY3ZfIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkKKyAgICAgICAgICAgICAgICAgICAgICA8PCAiID0gZnVuY3Rpb24oaW5wdXQsbXR5cGUscnNlcWlkKSB7IiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICBpZiAoZ2VuX2VzNl8pIHsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgInJlY3ZfIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIiAoKSB7IiA8PCBlbmRsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHRfc3RydWN0IG5vYXJncyhwcm9ncmFtXyk7CisKKyAgICAgICAgICB0X2Z1bmN0aW9uIHJlY3ZfZnVuY3Rpb24oKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZygicmVjdl8iKSArICgqZl9pdGVyKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbm9hcmdzKTsKKyAgICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwganNfbmFtZXNwYWNlKHRzZXJ2aWNlLT5nZXRfcHJvZ3JhbSgpKSA8PCBzZXJ2aWNlX25hbWVfCisgICAgICAgICAgICAgICAgICAgIDw8ICJDbGllbnQucHJvdG90eXBlLiIgPDwgZnVuY3Rpb25fc2lnbmF0dXJlKCZyZWN2X2Z1bmN0aW9uKSA8PCAiIHsiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgIH0KKworICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgIHN0ZDo6c3RyaW5nIGlucHV0VmFyOworICAgICAgaWYgKGdlbl9ub2RlXykgeworICAgICAgICBpbnB1dFZhciA9ICJpbnB1dCI7CisgICAgICB9IGVsc2UgeworICAgICAgICBpbnB1dFZhciA9ICJ0aGlzLmlucHV0IjsKKyAgICAgIH0KKworICAgICAgaWYgKGdlbl9ub2RlXykgeworICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8IGpzX2NvbnN0X3R5cGVfIDw8ICJjYWxsYmFjayA9IHRoaXMuX3JlcXNbcnNlcWlkXSB8fCBmdW5jdGlvbigpIHt9OyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJkZWxldGUgdGhpcy5fcmVxc1tyc2VxaWRdOyIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwganNfY29uc3RfdHlwZV8gPDwgInJldCA9IHRoaXMuaW5wdXQucmVhZE1lc3NhZ2VCZWdpbigpOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8IGpzX2NvbnN0X3R5cGVfIDw8ICJtdHlwZSA9IHJldC5tdHlwZTsiIDw8IGVuZGw7CisgICAgICB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ikKKyAgICAgICAgICAgICAgICAgICA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKGdlbl9ub2RlXykgeworICAgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAiY2FsbGJhY2sobnVsbCk7IiA8PCBlbmRsOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAicmV0dXJuOyIgPDwgZW5kbDsKKyAgICAgICAgfQorICAgICAgfQorCisgICAgICAvLyBDbG9zZSByZWNlaXZlIGZ1bmN0aW9uCisgICAgICBpbmRlbnRfZG93bigpOworICAgICAgaWYgKGdlbl9lczZfKSB7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifSIgPDwgZW5kbDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGluZGVudChmX3NlcnZpY2VfKSA8PCAifTsiIDw8IGVuZGw7CisgICAgICB9CisgICAgfQorICB9CisKKyAgLy8gRmluaXNoIGNsYXNzIGRlZmluaXRpb25zCisgIGlmIChnZW5fdHNfKSB7CisgICAgZl9zZXJ2aWNlX3RzXyA8PCB0c19pbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKyAgfQorICBpZiAoZ2VuX2VzNl8pIHsKKyAgICBpbmRlbnRfZG93bigpOworICAgIGZfc2VydmljZV8gPDwgIn07IiA8PCBlbmRsOworICB9Cit9CisKK3N0ZDo6c3RyaW5nIHRfanNfZ2VuZXJhdG9yOjpyZW5kZXJfcmVjdl90aHJvdyhzdGQ6OnN0cmluZyB2YXIpIHsKKyAgaWYgKGdlbl9ub2RlXykgeworICAgIHJldHVybiAicmV0dXJuIGNhbGxiYWNrKCIgKyB2YXIgKyAiKTsiOworICB9IGVsc2UgeworICAgIHJldHVybiAidGhyb3cgIiArIHZhciArICI7IjsKKyAgfQorfQorCitzdGQ6OnN0cmluZyB0X2pzX2dlbmVyYXRvcjo6cmVuZGVyX3JlY3ZfcmV0dXJuKHN0ZDo6c3RyaW5nIHZhcikgeworICBpZiAoZ2VuX25vZGVfKSB7CisgICAgcmV0dXJuICJyZXR1cm4gY2FsbGJhY2sobnVsbCwgIiArIHZhciArICIpOyI7CisgIH0gZWxzZSB7CisgICAgcmV0dXJuICJyZXR1cm4gIiArIHZhciArICI7IjsKKyAgfQorfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgorICovCit2b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2ZpZWxkKiB0ZmllbGQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbmNsYXNzKSB7CisgICh2b2lkKWluY2xhc3M7CisgIHRfdHlwZSogdHlwZSA9IGdldF90cnVlX3R5cGUodGZpZWxkLT5nZXRfdHlwZSgpKTsKKworICBpZiAodHlwZS0+aXNfdm9pZCgpKSB7CisgICAgdGhyb3cgIkNBTk5PVCBHRU5FUkFURSBERVNFUklBTElaRSBDT0RFIEZPUiB2b2lkIFRZUEU6ICIgKyBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7CisgIH0KKworICBzdHJpbmcgbmFtZSA9IHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKKworICBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvdXQsICh0X3N0cnVjdCopdHlwZSwgbmFtZSk7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICBnZW5lcmF0ZV9kZXN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3V0KSA8PCAib3V0cHV0LndyaXRlTGlzdEVuZCgpOyIgPDwgZW5kbDsKKyAgfQorfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBtYXAuCisgKgorICovCit2b2lkIHRfanNfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbWFwKiB0bWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBraXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdml0ZXIpIHsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJmtmaWVsZCk7CisKKyAgdF9maWVsZCB2ZmllbGQodG1hcC0+Z2V0X3ZhbF90eXBlKCksIHZpdGVyKTsKKyAgZ2VuZXJhdGVfc2VyaWFsaXplX2ZpZWxkKG91dCwgJnZmaWVsZCk7Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIHNldC4KKyAqLwordm9pZCB0X2pzX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX3NldF9lbGVtZW50KG9zdHJlYW0mIG91dCwgdF9zZXQqIHRzZXQsIHN0cmluZyBpdGVyKSB7CisgIHRfZmllbGQgZWZpZWxkKHRzZXQtPmdldF9lbGVtX3R5cGUoKSwgaXRlcik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZlZmllbGQpOworfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBsaXN0LgorICov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ZXR0ZXIsIG51bWJlciBvciB1bmRlcnNjb3JlCisgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc3RyLnNpemUoKTsgKytpKSB7CisgICAgYyA9IHN0ci5hdChpKTsKKyAgICBpZiAoKCgnQScgPiBjKSB8fCAoYyA+ICdaJykpICYmICgoJ2EnID4gYykgfHwgKGMgPiAneicpKSAmJiAoKCcwJyA+IGMpIHx8IChjID4gJzknKSkKKyAgICAgICAgJiYgKCdfJyAhPSBjKSAmJiAoJyQnICE9IGMpKSB7CisgICAgICBzdHIucmVwbGFjZShpLCAxLCAiXyIpOworICAgIH0KKyAgfQorCisgIHJldHVybiBzdHI7Cit9CisKK1RIUklGVF9SRUdJU1RFUl9HRU5FUkFUT1IoanMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJKYXZhc2NyaXB0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiAgICBqcXVlcnk6ICAgICAgICAgIEdlbmVyYXRlIGpRdWVyeSBjb21wYXRpYmxlIGNvZGUuXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICIgICAgbm9kZTogICAgICAgICAgICBHZW5lcmF0ZSBub2RlLmpzIGNvbXBhdGlibGUgY29kZS5cbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiAgICB0czogICAgICAgICAgICAgIEdlbmVyYXRlIFR5cGVTY3JpcHQgZGVmaW5pdGlvbiBmaWxlcy5cbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIiAgICB3aXRoX25zOiAgICAgICAgIENyZWF0ZSBnbG9iYWwgbmFtZXNwYWNlIG9iamVjdHMgd2hlbiB1c2luZyBub2RlLmpzXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICIgICAgZXM2OiAgICAgICAgICAgICBDcmVhdGUgRVM2IGNvZGUgd2l0aCBQcm9taXNlc1xuIikKZGlmZiAtLWdpdCBhL2NvbXBpbGVyL2NwcC9zcmMvdGhyaWZ0L2dlbmVyYXRlL3RfanNvbl9nZ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ZWFrOworICAgIGNhc2UgJy8nOgorICAgICAgc3MgPDwgIlxcLyI7CisgICAgICBicmVhazsKKyAgICBjYXNlICdcYic6CisgICAgICBzcyA8PCAiXFxiIjsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgJ1xmJzoKKyAgICAgIHNzIDw8ICJcXGYiOworICAgICAgYnJlYWs7CisgICAgY2FzZSAnXG4nOgorICAgICAgc3MgPDwgIlxcbiI7CisgICAgICBicmVhazsKKyAgICBjYXNlICdccic6CisgICAgICBzcyA8PCAiXFxyIjsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgJ1x0JzoKKyAgICAgIHNzIDw8ICJcXHQiOworICAgICAgYnJlYWs7CisgICAgZGVmYXVsdDoKKyAgICAgIHNzIDw8ICppdGVyOworICAgICAgYnJlYWs7CisgICAgfQorICB9CisgIHJldHVybiBzcy5zdHIoKTsKK30KKwordm9pZCB0X2pzb25fZ2VuZXJhdG9yOjpzdGFydF9vYmplY3QoYm9vbCBzaG91bGRfaW5kZW50KSB7CisgIGZfanNvbl8gPDwgKHNob3VsZF9pbmRlbnQgPyBpbmRlbnQoKSA6ICIiKSA8PCAieyIgPDwgZW5kbDsKKyAgaW5kZW50X3VwKCk7CisgIGNvbW1hX25lZWRlZF8ucHVzaChmYWxzZSk7Cit9CisKK3ZvaWQgdF9qc29uX2dlbmVyYXRvcjo6c3RhcnRfYXJyYXkoKSB7CisgIGZfanNvbl8gPDwgIlsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworICBjb21tYV9uZWVkZWRfLnB1c2goZmFsc2UpOworfQorCit2b2lkIHRfanNvbl9nZW5lcmF0b3I6OndyaXRlX2NvbW1hX2lmX25lZWRlZCgpIHsKKyAgaWYgKGNvbW1hX25lZWRlZF8udG9wKCkpIHsKKyAgICBmX2pzb25fIDw8ICIsIiA8PCBlbmRsOworICB9Cit9CisKK3ZvaWQgdF9qc29uX2dlbmVyYXRvcjo6aW5kaWNhdGVfY29tbWFfbmVlZGVkKCkgeworICB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gc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBsb2NhbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfY29udGFpbmVyKHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGxvY2FsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisKKyAgdm9pZCBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zZXRfZWxlbWVudChzdGQ6Om9zdHJlYW0mIG91dCwgdF9zZXQqIHRzZXQsIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LCB0X21hcCogdG1hcCwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfZGVzZXJpYWxpemVfbGlzdF9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2xpc3QqIHRsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7C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QqIHRmaWVsZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGxvY2FsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKKyAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOworCisgIGlmICh0eXBlLT5pc192b2lkKCkpIHsKKyAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArIHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKKyAgfQorCisgIHN0cmluZyBuYW1lID0gcHJlZml4ICsgdGZpZWxkLT5nZXRfbmFtZSgpOworCisgIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgZ2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG91dCwgKHRfc3RydWN0Kil0eXBlLCBsb2NhbCwgbmFtZSk7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpIHsKKyAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3V0LCB0eXBlLCBsb2NhbCwgbmFtZSk7CisgIH0gZWxzZSBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkgfHwgdHlwZS0+aXNfZW51bSgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgKGxvY2FsID8gImxvY2FsICIgOiAiIikgPDwgbmFtZSA8PCAiID0gaXByb3Q6IjsKKworICAgIGlmICh0eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9ICgodF9iYXNlX3R5cGUqKXR5cGUpLT5nZXRfYmFzZSgpOworICAgICAgc3dpdGNoICh0YmFzZSkgeworICAgICAgY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mlzX2VudW0oKSkgeworICAgICAgb3V0IDw8ICJyZWFkSTMyKCkiOworICAgIH0KKyAgICBvdXQgPDwgZW5kbDsKKworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIERFU0VSSUFMSVpFIEZJRUxEICclcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICB0ZmllbGQtPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgdHlwZS0+Z2V0X25hbWUoKS5jX3N0cigpKTsKKyAgfQorfQorCit2b2lkIHRfbHVhX2dlbmVyYXRvcjo6Z2VuZXJhdGVfZGVzZXJpYWxpemVfc3RydWN0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgbG9jYWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgpIHsKKyAgaW5kZW50KG91dCkgPDwgKGxvY2FsID8gImxvY2FsICIgOiAiIikgPDwgcHJlZml4IDw8ICIgPSAiIDw8IHRzdHJ1Y3QtPmdldF9uYW1lKCkgPDwgIjpuZXd7fSIKKyAgICAgICAgICAgICAgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCBwcmVmaXggPDwgIjpyZWFkKGlwcm90KSIgPDwgZW5kbDsKK30KKwordm9pZCB0X2x1YV9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2NvbnRhaW5lcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2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ICAgIHN0cmluZyBpdGVyID0gdG1wKCJpdGVyIik7CisgICAgaW5kZW50KG91dCkgPDwgImZvciBfLCIgPDwgaXRlciA8PCAiIGluIGlwYWlycygiIDw8IHByZWZpeCA8PCAiKSBkbyIgPDwgZW5kbDsKKyAgICBpbmRlbnRfdXAoKTsKKyAgICBnZW5lcmF0ZV9zZXJpYWxpemVfbGlzdF9lbGVtZW50KG91dCwgKHRfbGlzdCopdHR5cGUsIGl0ZXIpOworICAgIGluZGVudF9kb3duKCk7CisgICAgaW5kZW50KG91dCkgPDwgImVuZCIgPDwgZW5kbDsKKyAgfQorCisgIC8vIEZpbmlzaCB3cml0aW5nCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Q6d3JpdGVNYXBFbmQoKSIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Q6d3JpdGVTZXRFbmQoKSIgPDwgZW5kbDsKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgaW5kZW50KG91dCkgPDwgIm9wcm90OndyaXRlTGlzdEVuZCgpIiA8PCBlbmRsOworICB9Cit9CisKK3ZvaWQgdF9sdWFfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zZXJpYWxpemVfbWFwX2VsZW1lbnQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X21hcCogdG1hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgdml0ZXIpIHsKKyAgdF9maWVsZCBrZmllbGQodG1hcC0+Z2V0X2tleV90eXBlKCksIGtp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mYWxzZTsKKyAgICB3Y2ZfbmFtZXNwYWNlXy5jbGVhcigpOworCisgICAgbWFwPHN0cmluZywgc3RyaW5nPjo6Y29uc3RfaXRlcmF0b3IgaXRlcjsKKworICAgIGZvciAoaXRlciA9IHBhcnNlZF9vcHRpb25zLmJlZ2luKCk7IGl0ZXIgIT0gcGFyc2VkX29wdGlvbnMuZW5kKCk7ICsraXRlcikKKyAgICB7CisgICAgICAgIGlmIChpdGVyLT5maXJzdC5jb21wYXJlKCJudWxsYWJsZSIpID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIG51bGxhYmxlXyA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoaXRlci0+Zmlyc3QuY29tcGFyZSgiaGFzaGNvZGUiKSA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBoYXNoY29kZV8gPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGl0ZXItPmZpcnN0LmNvbXBhcmUoInVuaW9uIikgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgdW5pb25fID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChpdGVyLT5maXJzdC5jb21wYXJlKCJzZXJpYWwiKSA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBzZXJpYWxpemVfID0gdHJ1ZTsKKyAgICAgICAgICAgIHdjZl9uYW1lc3BhY2VfID0gaXRlci0+c2Vjb25kOyAvLyBzaW5jZSB0aGVyZSBjYW4gYmUgb25seSBvbmUgbmFtZXNwYWNlCisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoaXRlci0+Zmlyc3QuY29tcGFyZSgid2NmIikgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgd2NmXyA9IHRydWU7CisgICAgICAgICAgICB3Y2ZfbmFtZXNwYWNlXyA9IGl0ZXItPnNlY29uZDsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAg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VyOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGZpZWxkID09IE5VTEwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgInR5cGUgZXJyb3I6ICIgKyB0eXBlLT5nZXRfbmFtZSgpICsgIiBoYXMgbm8gZmllbGQgIiArIHZfaXRlci0+Zmlyc3QtPmdldF9zdHJpbmcoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdF90eXBlKiBmaWVsZF90eXBlID0gZmllbGQtPmdldF90eXBlKCk7CisKKyAgICAgICAgICAgIHN0cmluZyB2YWwgPSByZW5kZXJfY29uc3RfdmFsdWUob3V0LCBuYW1lLCBmaWVsZF90eXBlLCB2X2l0ZXItPnNlY29uZCk7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgbmFtZSA8PCAiLiIgPDwgcHJvcF9uYW1lKGZpZWxkKSA8PCAiID0gIiA8PCB2YWwgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBjbGVhbnVwX21lbWJlcl9uYW1lX21hcHBpbmcoc3RhdGljX2Nhc3Q8dF9zdHJ1Y3QqPih0eXBlKSk7CisgICAgfQorICAgIGVsc2UgaWYgKHR5cGUtPmlzX21hcCgpKQorICAgIHsKKyAgICAgICAgdF90eXBlKiBrdHlwZSA9IHN0YXRpY19jYXN0PHRfbWFwKj4odHlwZSktPmdldF9rZXlfdHlwZSgpOworICAgICAgICB0X3R5cGUqIHZ0eXBlID0gc3RhdGljX2Nhc3Q8dF9tYXAqPih0eXBlKS0+Z2V0X3ZhbF90eXBlKCk7CisgICAgICAgIGNvbnN0IG1hcDx0X2NvbnN0X3ZhbHVlKiwgdF9jb25zdF92YWx1ZSosIHRfY29uc3RfdmFsdWU6OnZhbHVlX2NvbXBhcmU+JiB2YWwgPSB2YWx1ZS0+Z2V0X21hcCgpOworICAgICAgICBtYXA8dF9jb25zdF92YWx1ZSosIHRfY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ICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmVuZGVyIDw8IHZhbHVlLT5nZXRfZG91YmxlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gY29uc3Qgb2YgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgICB9CisgICAgfQorICAgIGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkKKyAgICB7CisgICAgICAgIHJlbmRlciA8PCB0eXBlLT5nZXRfbmFtZSgpIDw8ICIuIiA8PCB2YWx1ZS0+Z2V0X2lkZW50aWZpZXJfbmFtZSgpOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBzdHJpbmcgdCA9IHRtcCgidG1wIik7CisgICAgICAgIHByaW50X2NvbnN0X3ZhbHVlKG91dCwgdCwgdHlwZSwgdmFsdWUsIHRydWUsIHRydWUsIHRydWUpOworICAgICAgICByZW5kZXIgPDwgdDsKKyAgICB9CisKKyAgICByZXR1cm4gcmVuZGVyLnN0cigpOworfQorCit2b2lkIHRfbmV0Y29yZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3N0cnVjdCh0X3N0cnVjdCogdHN0cnVjdCkKK3sKKyAgICBpZiAodW5pb25fICYmIHRzdHJ1Y3QtPmlzX3VuaW9uKCkpCisgICAgeworICAgICAgICBnZW5lcmF0ZV9uZXRjb3JlX3VuaW9uKHRzdHJ1Y3QpOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBnZW5lcmF0ZV9uZXRjb3JlX3N0cnVjdCh0c3RydWN0LCBmYWxzZSk7CisgICAgfQorfQorCit2b2lkIHRfbmV0Y29yZV9nZW5lcmF0b3I6OmdlbmVyYXRlX3hjZXB0aW9uKHRfc3RydWN0KiB0eGNlcHRpb24pCit7CisgICAgZ2VuZXJhdGVfbmV0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fZGVmYXVsdCA9IGZpZWxkX2hhc19kZWZhdWx0KCgqbV9pdGVyKSk7CisgICAgICAgIGlmIChpc19yZXF1aXJlZCkKKyAgICAgICAgeworICAgICAgICAgICAgaGFzX3JlcXVpcmVkX2ZpZWxkcyA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoaGFzX2RlZmF1bHQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaGFzX25vbl9yZXF1aXJlZF9kZWZhdWx0X3ZhbHVlX2ZpZWxkcyA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBoYXNfbm9uX3JlcXVpcmVkX2ZpZWxkcyA9IHRydWU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBib29sIGdlbmVyYXRlX2lzc2V0ID0gKG51bGxhYmxlXyAmJiBoYXNfbm9uX3JlcXVpcmVkX2RlZmF1bHRfdmFsdWVfZmllbGRzKSB8fCAoIW51bGxhYmxlXyAmJiBoYXNfbm9uX3JlcXVpcmVkX2ZpZWxkcyk7CisgICAgaWYgKGdlbmVyYXRlX2lzc2V0KQorICAgIHsKKyAgICAgICAgb3V0IDw8IGVuZGw7CisgICAgICAgIGlmIChzZXJpYWxpemVfIHx8IHdjZl8pCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiW0RhdGFNZW1iZXIoT3JkZXIgPSAxKV0iIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJwdWJsaWMgSXNzZXQgX19pc3NldDsiIDw8IGVuZGw7CisgICAgICAgIGlmIChzZXJpYWxpemVfIHx8IHdjZl8pCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiW0RhdGFDb250cmFjdF0iIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInB1Y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yIgPDwgZW5kbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworCisgICAgICAgIGlmIChnZW5lcmF0ZV9pc3NldCAmJiAoc2VyaWFsaXplXyB8fCB3Y2ZfKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIjcmVnaW9uIFhtbFNlcmlhbGl6ZXIgc3VwcG9ydCIgPDwgZW5kbCA8PCBlbmRsOworCisgICAgICAgICAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVxdWlyZWQgPSBmaWVsZF9pc19yZXF1aXJlZCgqbV9pdGVyKTsKKyAgICAgICAgICAgICAgICBib29sIGhhc19kZWZhdWx0ID0gZmllbGRfaGFzX2RlZmF1bHQoKm1faXRlcik7CisgICAgICAgICAgICAgICAgLy8gaWYgaXQgaXMgcmVxdWlyZWQsIGRvbid0IG5lZWQgSXNzZXQgZm9yIHRoYXQgdmFyaWFibGUKKyAgICAgICAgICAgICAgICAvLyBpZiBpdCBpcyBub3QgcmVxdWlyZWQsIGlmIGl0IGhhcyBhIGRlZmF1bHQgdmFsdWUsIHdlIG5lZWQgdG8gZ2VuZXJhdGUgSXNzZXQKKyAgICAgICAgICAgICAgICAvLyBpZiB3ZSBhcmUgbm90IG51bGxhYmxlLCB0aGVuIHdlIGdlbmVyYXRlIElzc2V0CisgICAgICAgICAgICAgICAgaWYgKCFpc19yZXF1aXJlZCAmJiAoIW51bGxhYmxlXyB8fCBoYXNfZGVmYXVsdCkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInB1YmxpYyBib29sIFNob3VsZFNlcmlhbGl6ZSIgPDwgcHJvcF9uYW1lKCptX2l0ZXIpIDw8ICIoKSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiBfX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUoKCptX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiOyIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIiNlbmRyZWdpb24gWG1sU2VyaWFsaXplciBzdXBwb3J0IiA8PCBlbmRsIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBXZSBhbHdheXMgd2FudCBhIGRlZmF1bHQsIG5vIGFyZ3VtZW50IGNvbnN0cnVjdG9yIGZvciBSZWFkaW5nCisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJwdWJsaWMgIiA8PCBzaGFycF9zdHJ1Y3RfbmFtZSA8PCAiKCkiIDw8IGVuZGwKKyAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisKKyAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKQorICAgIHsKKyAgICAgICAgdF90eXBlKiB0ID0gKCptX2l0ZXIpLT5nZXRfdHlwZSgpOworICAgICAgICB3aGlsZSAodC0+aXNfdHlwZWRlZigpKQorICAgICAgICB7CisgICAgICAgICAgICB0ID0gc3RhdGljX2Nhc3Q8dF90eXBlZGVmKj4odCktPmdldF90eXBlKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCgqbV9pdGVyKS0+Z2V0X3ZhbHVlKCkgIT0gTlVMTCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGZpZWxkX2lzX3JlcXVpcmVkKCgqbV9pdGVyKSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcHJpbnRfY29uc3RfdmFsdWUob3V0LCAidGhpcy4iICsgcHJvcF9uYW1lKCptX2l0ZXIpLCB0LCAoKm1faXRlciktPmdldF92YWx1ZSgpLCB0cnVlLCB0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBwcmludF9jb25zdF92YWx1ZShvdXQsICJ0aGlzLl8iICsgKCptX2l0ZXIpLT5nZXRfbmFtZSgpLCB0LCAoKm1faXRlciktPmdldF92YWx1ZSgpLCB0cnVlLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAvLyBPcHRpb25hbHMgd2l0aCBkZWZhdWx0cyBhcmUgbWFya2VkIHNldAorICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAidGhpcy5fX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUoKCptX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiID0gdHJ1ZTsiIDw8IGVuZGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKworICAgIGlmIChoYXNfcmVxdWlyZWRfZmllbGRzKQorICAgIHsKKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJwdWJsaWMgIiA8PCBzaGFycF9zdHJ1Y3RfbmFtZSA8PCAiKCI7CisgICAgICAgIGJvb2wgZmlyc3QgPSB0cnVlOworICAgICAgICBmb3IgKG1faXRlciA9IG1lbWJlcnMuYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsrbV9pdGVyKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoZmllbGRfaXNfcmVxdWlyZWQoKm1faXRlcikpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8ICIsICI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG91dCA8PCB0eXBlX25hbWUoKCptX2l0ZXIpLT5nZXRfdHlwZSgpKSA8PCAiICIgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG91dCA8PCAiKSA6IHRoaXMoKSIgPDwgZW5kbAorICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworCisgICAgICAgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsgKyttX2l0ZXIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChmaWVsZF9pc19yZXF1aXJlZCgqbV9pdGVyKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInRoaXMuIiA8PCBwcm9wX25hbWUoKm1faXRlcikgPDwgIiA9ICIgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICI7IiA8PCBlbmRsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKK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uZXcgVEZpZWxkKCk7IiA8PCBlbmRsOworICAgICAgICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikKKyAgICAgICAgeworICAgICAgICAgICAgYm9vbCBpc19yZXF1aXJlZCA9IGZpZWxkX2lzX3JlcXVpcmVkKCpmX2l0ZXIpOworICAgICAgICAgICAgYm9vbCBoYXNfZGVmYXVsdCA9IGZpZWxkX2hhc19kZWZhdWx0KCpmX2l0ZXIpOworICAgICAgICAgICAgaWYgKG51bGxhYmxlXyAmJiAhaGFzX2RlZmF1bHQgJiYgIWlzX3JlcXVpcmVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKCIgPDwgcHJvcF9uYW1lKCpmX2l0ZXIpIDw8ICIgIT0gbnVsbCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmICghaXNfcmVxdWlyZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYm9vbCBudWxsX2FsbG93ZWQgPSB0eXBlX2Nhbl9iZV9udWxsKCgqZl9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgICAgICAgICAgICAgaWYgKG51bGxfYWxsb3dlZCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKCIgPDwgcHJvcF9uYW1lKCpmX2l0ZXIpIDw8ICIgIT0gbnVsbCAmJiBfX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiKSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImlmIChfX2lzc2V0LiIgPDwgbm9ybWFsaXplX25hbWUoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiKSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiZmllbGQuTmFtZSA9IFwiIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIlwiOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJmaWVsZC5UeXBlID0gIiA8PCB0eXBlX3RvX2VudW0oKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSA8PCAiOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJmaWVsZC5JRCA9ICIgPDwgKCpmX2l0ZXIpLT5nZXRfa2V5KCkgPDwgIjsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiYXdhaXQgb3Byb3QuV3JpdGVGaWVsZEJlZ2luQXN5bmMoZmllbGQsIGNhbmNlbGxhdGlvblRva2VuKTsiIDw8IGVuZGw7CisKKyAgICAgICAgICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIpOworCisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImF3YWl0IG9wcm90LldyaXRlRmllbGRFbmRBc3luYyhjYW5jZWxsYXR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kcy5lbmQoKTsgKytmX2l0ZXIpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIG91dCA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICJpZiI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJlbHNlIGlmIjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG51bGxhYmxlXykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBvdXQgPDwgIih0aGlzLiIgPDwgcHJvcF9uYW1lKCgqZl9pdGVyKSkgPDwgIiAhPSBudWxsKSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBvdXQgPDwgIih0aGlzLl9faXNzZXQuIiA8PCBub3JtYWxpemVfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICIpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgICAgICAgIGJvb2wgbnVsbF9hbGxvd2VkID0gIW51bGxhYmxlXyAmJiB0eXBlX2Nhbl9iZV9udWxsKCgqZl9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgICAgICAgICBpZiAobnVsbF9hbGxvd2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKCIgPDwgcHJvcF9uYW1lKCpmX2l0ZXIpIDw8ICIgIT0gbnVsbCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiZmllbGQuTmFtZSA9IFwiIiA8PCBwcm9wX25hbWUoKmZfaXRlcikgPDwgIlwiOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJmaWVsZC5UeXBlID0gIiA8PCB0eXBlX3RvX2VudW0oKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSA8PCAiOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJmaWVsZC5JRCA9ICIgPDwgKCpmX2l0ZXIpLT5nZXRfa2V5KCkgPDwgIjsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiYXdhaXQgb3Byb3QuV3JpdGVGaWVsZEJlZ2luQXN5bmMoZmllbGQsIGNhbmNlbGxhdGlvblRva2VuKTsiIDw8IGVuZGw7CisKKyAgICAgICAgICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIpOworCisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImF3YWl0IG9wcm90LldyaXRlRmllbGRFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7IiA8PCBlbmRsOworCisgICAgICAgICAgICBpZiAobnVsbF9hbGxvd2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCB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gaW5kZW50KCkgPDwgImlmICgiIDw8IHByb3BfbmFtZSgoKmZfaXRlcikpIDw8ICIgIT0gbnVsbCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKCFpc19yZXF1aXJlZCkKKyAgICAgICAgeworICAgICAgICAgICAgYm9vbCBudWxsX2FsbG93ZWQgPSB0eXBlX2Nhbl9iZV9udWxsKCgqZl9pdGVyKS0+Z2V0X3R5cGUoKSk7CisgICAgICAgICAgICBpZiAobnVsbF9hbGxvd2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKCIgPDwgcHJvcF9uYW1lKCgqZl9pdGVyKSkgPDwgIiAhPSBudWxsICYmIF9faXNzZXQuIiA8PCBub3JtYWxpemVfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICIpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKF9faXNzZXQuIiA8PCBub3JtYWxpemVfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICIpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHVzZUZpcnN0RmxhZyAmJiAoIWhhZF9yZXF1aXJlZCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYoIV9fZmlyc3QpIHsgc2IuQXBwZW5kKFwiLCBcIik7IH0iIDw8IGVuZGw7CisgICAgICAgICAgICBpZiAoIWlzX3JlcXVpcmVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiX19maXJzdCA9IGZhbHNlOyIgPDwgZW5kbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAic2IuQXBwZW5kKFwiIiA8PCBwcm9wX25hbWUoKmZfaXRlcikgPDwgIjogXCIpOyIgPDwgZW5kbDsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAic2IuQXBwZW5kKFwiLCAiIDw8IHByb3BfbmFtZSgqZl9pdGVyKSA8PCAiOiBcIik7IiA8PCBlbmRsOworICAgICAgICB9CisKKyAgICAgICAgdF90eXBlKiB0dHlwZSA9ICgqZl9pdGVyKS0+Z2V0X3R5cGUoKTsKKyAgICAgICAgaWYgKHR0eXBlLT5pc194Y2VwdGlvbigpIHx8IHR0eXBlLT5pc19zdHJ1Y3QoKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJzYi5BcHBlbmQoIiA8PCBwcm9wX25hbWUoKmZfaXRlcikgPDwgIj09IG51bGwgPyBcIjxudWxsPlwiIDogIiA8PCBwcm9wX25hbWUoKmZfaXRlcikgPDwgIi5Ub1N0cmluZygpKTsiIDw8IGVuZGw7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInNiLkFwcGVuZCgiIDw8IHByb3BfbmFtZSgqZl9pdGVyKSA8PCAiKTsiIDw8IGVuZGw7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIWlzX3JlcXVpcmVkKQorICAgICAgICB7C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FcXVhbHModGhpcywgb3RoZXIpKSByZXR1cm4gdHJ1ZTsiIDw8IGVuZGw7CisKKyAgICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBmaWVsZHMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICAgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIGZfaXRlcjsKKworICAgIGJvb2wgZmlyc3QgPSB0cnVlOworCisgICAgZm9yIChmX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZl9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmX2l0ZXIpCisgICAgeworICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiAiOworICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBvdXQgPDwgZW5kbDsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiJiYgIjsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWZpZWxkX2lzX3JlcXVpcmVkKCgqZl9pdGVyKSkgJiYgIShudWxsYWJsZV8gJiYgIWZpZWxkX2hhc19kZWZhdWx0KCgqZl9pdGVyKSkpKQorICAgICAgICB7CisgICAgICAgICAgICBvdXQgPDwgIigoX19pc3NldC4iIDw8IG5vcm1hbGl6ZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIiA9PSBvdGhlci5fX2lzc2V0LiIKKyAgICAgICAgICAgICAgICA8PCBub3JtYWxpemVfbmFtZSgoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICIpICYmICgoIV9faXNzZXQuIgorICAgICAgICAgICAgICAgIDw8IG5vcm1hbGl6ZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIikgfHwgKCI7CisgICAgICAgIH0KKyAgICAgICAgdF90eXBlKiB0dHlwZSA9ICgqZl9pdGVyKS0+Z2V0X3R5cGUoKTsKKyAgICAgICAgaWYgKHR0eXBlLT5pc19jb250YWluZXIoKSB8fCB0dHlwZS0+aXNfYmluYXJ5KCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCAiVENvbGxlY3Rpb25zLkVxdWFscygiOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICJTeXN0ZW0uT2JqZWN0LkVxdWFscygiOworICAgICAgICB9CisgICAgICAgIG91dCA8PCBwcm9wX25hbWUoKCpmX2l0ZXIpKSA8PCAiLCBvdGhlci4iIDw8IHByb3BfbmFtZSgoKmZfaXRlcikpIDw8ICIpIjsKKyAgICAgICAgaWYgKCFmaWVsZF9pc19yZXF1aXJlZCgoKmZfaXRlcikpICYmICEobnVsbGFibGVfICYmICFmaWVsZF9oYXNfZGVmYXVsdCgoKmZfaXRlcikpKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICIpKSkiOworICAgICAgICB9CisgICAgfQorICAgIGlmIChmaXJzdCkKKyAgICB7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIHRydWU7IiA8PCBlbmRsOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICBvdXQgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgfQorCisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKK30KKwordm9pZCB0X25ldGNvcmVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9uZXRjb3JlX3N0cnVjdF9oYXNoY29kZShvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0KQoreworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicHVibGljIG92ZXJyaWRlIGludCBHZXRIYXNoQ29kZSgpIHsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgImludCBoYXNoY29kZSA9IDA7IiA8PCBlbmRsOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCAidW5jaGVja2VkIHsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisKKyAgICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBmaWVsZHMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICAgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIGZfaXRlcjsKKworICAgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKQorICAgIHsKKyAgICAgICAgdF90eXBlKiB0dHlwZSA9ICgqZl9pdGVyKS0+Z2V0X3R5cGUoKTsKKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJoYXNoY29kZSA9IChoYXNoY29kZSAqIDM5NykgXiAiOworICAgICAgICBpZiAoZmllbGRfaXNfcmVxdWlyZWQoKCpmX2l0ZXIpKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICIoIjsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChudWxsYWJsZV8pCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCAiKCIgPDwgcHJvcF9uYW1lKCgqZl9pdGVyKSkgPDwgIiA9PSBudWxsID8gMCA6ICI7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBvdXQgPDwgIighX19pc3NldC4iIDw8IG5vcm1hbGl6ZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIiA/IDAgOiAiOworICAgICAgICB9CisgICAgICAgIGlmICh0dHlwZS0+aXNfY29udGFpbmVyKCkpCisgICA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gICAgIDw8IGluZGVudCgpIDw8ICJ2YXIgbXNnID0gYXdhaXQgSW5wdXRQcm90b2NvbC5SZWFkTWVzc2FnZUJlZ2luQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJpZiAobXNnLlR5cGUgPT0gVE1lc3NhZ2VUeXBlLkV4Y2VwdGlvbikiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgIGluZGVudF91cCgpOworCisgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInZhciB4ID0gYXdhaXQgVEFwcGxpY2F0aW9uRXhjZXB0aW9uLlJlYWRBc3luYyhJbnB1dFByb3RvY29sLCBjYW5jZWxsYXRpb25Ub2tlbik7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgImF3YWl0IElucHV0UHJvdG9jb2wuUmVhZE1lc3NhZ2VFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInRocm93IHg7IiA8PCBlbmRsOworICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKworICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ2YXIgcmVzdWx0ID0gbmV3ICIgPDwgcmVzdWx0bmFtZSA8PCAiKCk7IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgImF3YWl0IHJlc3VsdC5SZWFkQXN5bmMoSW5wdXRQcm90b2NvbCwgY2FuY2VsbGF0aW9uVG9rZW4pOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJhd2FpdCBJbnB1dFByb3RvY29sLlJlYWRNZXNzYWdlRW5kQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyIgPDwgZW5kbDsKKworICAgICAgICAgICAgaWYgKCEoKmZ1bmN0aW9uc19pdGVyYXRvciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAobnVsbGFibGVfKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVfY2FuX2JlX251bGwoKCpmdW5jdGlvbnNfaXRlcmF0b3IpLT5nZXRfcmV0dXJudHlwZSgpKSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiAocmVzdWx0LlN1Y2Nlc3MgIT0gbnVsbCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudF91cCgpOworICAgICAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gcmVzdWx0LlN1Y2Nlc3M7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKHJlc3VsdC5TdWNjZXNzLkhhc1ZhbHVlKSIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiByZXN1bHQuU3VjY2Vzcy5WYWx1ZTsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiaWYgKHJlc3VsdC5fX2lzc2V0LnN1Y2Nlc3MpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAicmV0dXJuIHJlc3VsdC5TdWNjZXNzOyIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgeGNlcHRpb25zID0geHMtPmdldF9tZW1iZXJzKCk7CisgICAgICAgICAgICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciB4X2l0ZXI7CisgICAgICAgICAgICBmb3IgKHhfaXRlciA9IHhjZXB0aW9ucy5iZWdpbigpOyB4X2l0ZXIgIT0geGNlcHRpb25zLmVuZCgpOyArK3hfaXRlcikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAobnVsbGFibGVfKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiAocmVzdWx0LiIgPDwgcHJvcF9uYW1lKCp4X2l0ZXIpIDw8ICIgIT0gbnVsbCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ0aHJvdyByZXN1bHQuIiA8PCBwcm9wX25hbWUoKnhfaXRlcikgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiAocmVzdWx0Ll9faXNzZXQuIiA8PCBub3JtYWxpemVfbmFtZSgoKnhfaXRlciktPmdldF9uYW1lKCkpIDw8ICIpIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgICAgICAgICAgICAgaW5kZW50X3VwKCk7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAidGhyb3cgcmVzdWx0LiIgPDwgcHJvcF9uYW1lKCp4X2l0ZXIpIDw8ICI7IiA8PCBlbmRsOworICAgICAgICAgICAgICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoKCpmdW5jdGlvbnNfaXRlcmF0b3IpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm47IiA8PCBlbmRsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAidGhyb3cgbmV3IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbihUQXBwbGljYXRpb25FeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5NaXNzaW5nUmVzdWx0LCBcIiIKKyAgICAgICAgICAgICAgICAgICAgPDwgZnVuY3Rpb25fbmFtZSA8PCAiIGZhaWxlZDogdW5rbm93biByZXN1bHRcIik7IiA8PCBlbmRsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBjbGVhbnVwX21lbWJlcl9uYW1lX21hcHBpbmcoKCpmdW5jdGlvbnNfaXRlcmF0b3IpLT5nZXRfeGNlcHRpb25zKCkpOworICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbCA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGluZGVudF9kb3duKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF9uZXRjb3JlX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VydmljZV9zZXJ2ZXIob3N0cmVhbSYgb3V0L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bmFtZV9tYXBwaW5nKGFyZ19zdHJ1Y3QpOworICAgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKQorICAgIHsKKyAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICB7CisgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICIsICI7CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgImFyZ3MuIiA8PCBwcm9wX25hbWUoKmZfaXRlcik7CisgICAgICAgIGlmIChudWxsYWJsZV8gJiYgIXR5cGVfY2FuX2JlX251bGwoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICIuVmFsdWUiOworICAgICAgICB9CisgICAgfQorCisgICAgY2xlYW51cF9tZW1iZXJfbmFtZV9tYXBwaW5nKGFyZ19zdHJ1Y3QpOworCisgICAgaWYgKCFmaXJzdCkKKyAgICB7CisgICAgICAgIG91dCA8PCAiLCAiOworICAgIH0KKworICAgIG91dCA8PCAiY2FuY2VsbGF0aW9uVG9rZW4pOyIgPDwgZW5kbDsKKworICAgIHZlY3Rvcjx0X2ZpZWxkKj46OmNvbnN0X2l0ZXJhdG9yIHhfaXRlcjsKKworICAgIHByZXBhcmVfbWVtYmVyX25hbWVfbWFwcGluZyh4cywgeHMtPmdldF9tZW1iZXJzKCksIHJlc3VsdG5hbWUpOworICAgIGlmICh4Y2VwdGlvbnMuc2l6ZSgpID4gMCkKKyAgICB7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSIgPDwgZW5kbDsKKworICAgICAgICBmb3IgKHhfaXRlciA9IHhjZXB0aW9ucy5iZWdpbigpOyB4X2l0ZXIgIT0geGNlcHRpb25zLmVuZCgpOyArK3hfaX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SgpOworICAgIHdoaWxlICh0eXBlLT5pc190eXBlZGVmKCkpCisgICAgeworICAgICAgICB0eXBlID0gc3RhdGljX2Nhc3Q8dF90eXBlZGVmKj4odHlwZSktPmdldF90eXBlKCk7CisgICAgfQorCisgICAgaWYgKHR5cGUtPmlzX3ZvaWQoKSkKKyAgICB7CisgICAgICAgIHRocm93ICJDQU5OT1QgR0VORVJBVEUgREVTRVJJQUxJWkUgQ09ERSBGT1Igdm9pZCBUWVBFOiAiICsgcHJlZml4ICsgdGZpZWxkLT5nZXRfbmFtZSgpOworICAgIH0KKworICAgIHN0cmluZyBuYW1lID0gcHJlZml4ICsgKGlzX3Byb3BlcnR5bGVzcyA/ICIiIDogcHJvcF9uYW1lKHRmaWVsZCkpOworCisgICAgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpCisgICAgeworICAgICAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9zdHJ1Y3Qob3V0LCBzdGF0aWNfY2FzdDx0X3N0cnVjdCo+KHR5cGUpLCBuYW1lKTsKKyAgICB9CisgICAgZWxzZSBpZiAodHlwZS0+aXNfY29udGFpbmVyKCkpCisgICAgeworICAgICAgICBnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9jb250YWluZXIob3V0LCB0eXBlLCBuYW1lKTsKKyAgICB9CisgICAgZWxzZSBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkgfHwgdHlwZS0+aXNfZW51bSgpKQorICAgIHsKKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8IG5hbWUgPDwgIiA9ICI7CisKKyAgICAgICAgaWYgKHR5cGUtPmlzX2VudW0oKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICIoIiA8PCB0eXBlX25hbWUodHlwZSwgZmFsc2UsIHRydWUpIDw8ICIpIjsKKyAgICAgICAgfQorCisgICAgICAgIG91dCA8PCAiYXdhaXQgaXByb3QuIjsKKworICAgICAgICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRfYmFzZV90eXBlOjp0X2Jhc2UgdGJhc2UgPSBzdGF0aWNfY2FzdDx0X2Jhc2VfdHlwZSo+KHR5cGUpLT5nZXRfYmFzZSgpOworICAgICAgICAgICAgc3dpdGNoICh0YmFzZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfVk9JRDoKKyAgICAgICAgICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IGNhbm5vdCBzZXJpYWxpemUgdm9pZCBmaWVsZCBpbiBhIHN0cnVjdDogIiArIG5hbWU7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgICAgICAgICBpZiAodHlwZS0+aXNfYmluYXJ5KCkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgIlJlYWRCaW5hcnlBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7IjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkU3RyaW5nQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICAgICAgICAgIG91dCA8PCAiUmVhZEJvb2xBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7IjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsiOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkSTE2QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgICAgICAgICBvdXQgPDwgIlJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7IjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICAgICAgICAgIG91dCA8PCAiUmVhZEk2NEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsiOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJSZWFkRG91YmxlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gQyMgbmFtZSBmb3IgYmFzZSB0eXBlICIgKyB0X2Jhc2VfdHlwZTo6dF9iYXNlX25hbWUodGJhc2UpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkKKyAgICAgICAgeworICAgICAgICAgICAgb3V0IDw8ICJSZWFkSTMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8IGVuZGw7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgI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GUoKSkKKyAgICAgICAgeworICAgICAgICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9IHN0YXRpY19jYXN0PHRfYmFzZV90eXBlKj4odHlwZSktPmdldF9iYXNlKCk7CisgICAgICAgICAgICBzd2l0Y2ggKHRiYXNlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9WT0lEOgorICAgICAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogY2Fubm90IHNlcmlhbGl6ZSB2b2lkIGZpZWxkIGluIGEgc3RydWN0OiAiICsgbmFtZTsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICAgICAgICAgIGlmICh0eXBlLT5pc19iaW5hcnkoKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG91dCA8PCAiV3JpdGVCaW5hcnlBc3luYygiOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBvdXQgPDwgIldyaXRlU3RyaW5nQXN5bmMoIjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgb3V0IDw8IG5hbWUgPDwgIiwgY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJXcml0ZUJvb2xBc3luYygiIDw8IG51bGxhYmxlX25hbWUgPDwgIiwgY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICAgICAgICAgIG91dCA8PCAiV3JpdGVCeXRlQXN5bmMoIiA8PCBudWxsYWJsZV9uYW1lIDw8ICIsIGNhbmNlbGxhdGlvblRva2VuKTsiOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJXcml0ZUkxNkFzeW5jKCIgPDwgbnVsbGFibGVfbmFtZSA8PCAiLCBjYW5jZWxsYXRpb25Ub2tlbik7IjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICAgICAgICAgIG91dCA8PCAiV3JpdGVJMzJBc3luYygiIDw8IG51bGxhYmxlX25hbWUgPDwgIiwgY2FuY2VsbGF0aW9uVG9rZW4pOyI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgICAgICAgICBvdXQgPDwgIldyaXRlSTY0QXN5bmMoIiA8PCBudWxsYWJsZV9uYW1lIDw8ICIsIGNhbmNlbGxhdGlvblRva2VuKTsiOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgICAgICAgICAgb3V0IDw8ICJXcml0ZURvdWJsZUFzeW5jKCIgPDwgbnVsbGFibGVfbmFtZSA8PCAiLCBjYW5jZWxsYXRpb25Ub2tlbik7IjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgImNvbXBpbGVyIGVycm9yOiBubyBDIyBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAodHlwZS0+aXNfZW51bSg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ZGw7CisgICAgICAgIGluZGVudF91cCgpOworCisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiZ2V0IiA8PCBlbmRsCisgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAieyIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgICAgYm9vbCB1c2VfbnVsbGFibGUgPSBmYWxzZTsKKyAgICAgICAgaWYgKG51bGxhYmxlXykKKyAgICAgICAgeworICAgICAgICAgICAgdF90eXBlKiB0dHlwZSA9IHRmaWVsZC0+Z2V0X3R5cGUoKTsKKyAgICAgICAgICAgIHdoaWxlICh0dHlwZS0+aXNfdHlwZWRlZigpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHR0eXBlID0gc3RhdGljX2Nhc3Q8dF90eXBlZGVmKj4odHR5cGUpLT5nZXRfdHlwZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHR0eXBlLT5pc19iYXNlX3R5cGUoKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB1c2VfbnVsbGFibGUgPSBzdGF0aWNfY2FzdDx0X2Jhc2VfdHlwZSo+KHR0eXBlKS0+Z2V0X2Jhc2UoKSAhPSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgInJldHVybiAiIDw8IGZpZWxkUHJlZml4ICsgdGZpZWxkLT5nZXRfbmFtZSgpIDw8ICI7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfZG93bigpOworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwKKyAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJzZXQiIDw8IGVuZGwKKyAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJ7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKworICAgICAgICBpZiAodXN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ICAvLyBwcmV2ZW50IG5hbWUgY29uZmxpY3RzIHdpdGgga25vd24gbWV0aG9kcyAoVEhSSUZULTI5NDIpCisgICAgdXNlZF9tZW1iZXJfbmFtZXMuaW5zZXJ0KCJSZWFkIik7CisgICAgdXNlZF9tZW1iZXJfbmFtZXMuaW5zZXJ0KCJXcml0ZSIpOworCisgICAgZm9yIChpdGVyID0gbWVtYmVycy5iZWdpbigpOyBpdGVyICE9IG1lbWJlcnMuZW5kKCk7ICsraXRlcikKKyAgICB7CisgICAgICAgIHN0cmluZyBvbGRuYW1lID0gKCppdGVyKS0+Z2V0X25hbWUoKTsKKyAgICAgICAgc3RyaW5nIG5ld25hbWUgPSBwcm9wX25hbWUoKml0ZXIsIHRydWUpOworICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gbmV3IG5hbWUgY29uZmxpY3RzIHdpdGggYW5vdGhlciBtZW1iZXIKKyAgICAgICAgICAgIGlmICh1c2VkX21lbWJlcl9uYW1lcy5maW5kKG5ld25hbWUpICE9IHVzZWRfbWVtYmVyX25hbWVzLmVuZCgpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHB2ZXJib3NlKCJzdHJ1Y3QgJXM6IG1lbWJlciAlcyBjb25mbGljdHMgd2l0aCBhbm90aGVyIG1lbWJlclxuIiwgc3RydWN0bmFtZS5jX3N0cigpLCBuZXduYW1lLmNfc3RyKCkpOworICAgICAgICAgICAgICAgIG5ld25hbWUgKz0gJ18nOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBhZGQgYWx3YXlzLCB0aGlzIGhlbHBzIHVzIHRvIGRldGVjdCBlZGdlIGNhc2VzIGxpa2UKKyAgICAgICAgICAgIC8vIGRpZmZlcmVudCBzcGVsbGluZ3MgKCJmb28iIGFuZCAiRm9vIikgd2l0aGluIHRoZSBzYW1lIHN0cnVjdAorICAgICAgICAgICAgcHZlcmJvc2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pCisgICAgeworICAgICAgICBzdHJpbmcgbnMgPSBwcm9ncmFtLT5nZXRfbmFtZXNwYWNlKCJuZXRjb3JlIik7CisgICAgICAgIGlmICghbnMuZW1wdHkoKSkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIG5zICsgIi4iICsgbm9ybWFsaXplX25hbWUodHR5cGUtPmdldF9uYW1lKCkpICsgcG9zdGZpeDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiBub3JtYWxpemVfbmFtZSh0dHlwZS0+Z2V0X25hbWUoKSkgKyBwb3N0Zml4OworfQorCitzdHJpbmcgdF9uZXRjb3JlX2dlbmVyYXRvcjo6YmFzZV90eXBlX25hbWUodF9iYXNlX3R5cGUqIHRiYXNlLCBib29sIGluX2NvbnRhaW5lciwgYm9vbCBpbl9wYXJhbSwgYm9vbCBpc19yZXF1aXJlZCkKK3sKKyAgICAodm9pZClpbl9jb250YWluZXI7CisgICAgc3RyaW5nIHBvc3RmaXggPSAoIWlzX3JlcXVpcmVkICYmIG51bGxhYmxlXyAmJiBpbl9wYXJhbSkgPyAiPyIgOiAiIjsKKyAgICBzd2l0Y2ggKHRiYXNlLT5nZXRfYmFzZSgpKQorICAgIHsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1ZPSUQ6CisgICAgICAgIHJldHVybiAidm9pZCI7CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9TVFJJTkc6CisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh0YmFzZS0+aXNfYmluYXJ5KCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuICJieXRlW10iOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuICJzdHJpbmciOworICAgICAgICB9CisgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICByZXR1cm4gImJvb2wiICsgcG9zdGZpeDsKKyAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBF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QRV9JNjQ6CisgICAgICAgICAgICAgICAgcmVzdWx0ICs9ICIgPSAwIjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICAgICAgICAgIHJlc3VsdCArPSAiID0gKGRvdWJsZSkwIjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICh0dHlwZS0+aXNfZW51bSgpKQorICAgICAgICB7CisgICAgICAgICAgICByZXN1bHQgKz0gIiA9ICgiICsgdHlwZV9uYW1lKHR0eXBlLCBmYWxzZSwgdHJ1ZSkgKyAiKTAiOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKHR0eXBlLT5pc19jb250YWluZXIoKSkKKyAgICAgICAgeworICAgICAgICAgICAgcmVzdWx0ICs9ICIgPSBuZXcgIiArIHR5cGVfbmFtZSh0dHlwZSwgZmFsc2UsIHRydWUpICsgIigpIjsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHJlc3VsdCArPSAiID0gbmV3ICIgKyB0eXBlX25hbWUodHR5cGUsIGZhbHNlLCB0cnVlKSArICIoKSI7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIHJlc3VsdCArICI7IjsKK30KKworc3RyaW5nIHRfbmV0Y29yZV9nZW5lcmF0b3I6OmZ1bmN0aW9uX3NpZ25hdHVyZSh0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sIHN0cmluZyBwcmVmaXgpCit7CisgICAgdF90eXBlKiB0dHlwZSA9IHRmdW5jdGlvbi0+Z2V0X3JldHVybnR5cGUoKTsKKyAgICByZXR1cm4gdHlwZV9uYW1lKHR0eXBlKSArICIgIiArIG5vcm1hbGl6ZV9uYW1lKHByZWZpeCArIHRmdW5jdGlvbi0+Z2V0X25hbWUoKSkgKyAiKCIgKyBhcmd1bWV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N0ID0gdHJ1ZTsKKyAgICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikKKyAgICB7CisgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgeworICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHJlc3VsdCArPSAiLCAiOworICAgICAgICB9CisgICAgICAgIHJlc3VsdCArPSB0eXBlX25hbWUoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSArICIgIiArIG5vcm1hbGl6ZV9uYW1lKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSk7CisgICAgfQorICAgIHJldHVybiByZXN1bHQ7Cit9CisKK3N0cmluZyB0X25ldGNvcmVfZ2VuZXJhdG9yOjp0eXBlX3RvX2VudW0odF90eXBlKiB0eXBlKQoreworICAgIHdoaWxlICh0eXBlLT5pc190eXBlZGVmKCkpCisgICAgeworICAgICAgICB0eXBlID0gc3RhdGljX2Nhc3Q8dF90eXBlZGVmKj4odHlwZSktPmdldF90eXBlKCk7CisgICAgfQorCisgICAgaWYgKHR5cGUtPmlzX2Jhc2VfdHlwZSgpKQorICAgIHsKKyAgICAgICAgdF9iYXNlX3R5cGU6OnRfYmFzZSB0YmFzZSA9IHN0YXRpY19jYXN0PHRfYmFzZV90eXBlKj4odHlwZSktPmdldF9iYXNlKCk7CisgICAgICAgIHN3aXRjaCAodGJhc2UpCisgICAgICAgIHsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9WT0lEOgorICAgICAgICAgICAgdGhyb3cgIk5PIFRfVk9JRCBDT05TVFJVQ1QiOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgICAgIHJldHVybiAiVFR5cGUuU3RyaW5nIjsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICAgICAgcmV0dXJuICJUVHlwZS5Cb29sIjsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgICAgIHJldHVybiAiVFR5cGUuQnl0ZSI7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICAgICAgcmV0dXJuICJUVHlwZS5JMTYiOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kzMjoKKyAgICAgICAgICAgIHJldHVybiAiVFR5cGUuSTMyIjsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgICByZXR1cm4gIlRUeXBlLkk2NCI7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfRE9VQkxFOgorICAgICAgICAgICAgcmV0dXJuICJUVHlwZS5Eb3VibGUiOworICAgICAgICB9CisgICAgfQorICAgIGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkKKyAgICB7CisgICAgICAgIHJldHVybiAiVFR5cGUuSTMyIjsKKyAgICB9CisgICAgZWxzZSBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkKKyAgICB7CisgICAgICAgIHJldHVybiAiVFR5cGUuU3RydWN0IjsKKyAgICB9CisgICAgZWxzZSBpZiAodHlwZS0+aXNfbWFwKCkpCisgICAgeworICAgICAgICByZXR1cm4gIlRUeXBlLk1hcCI7CisgICAgfQorICAgIGVsc2UgaWYgKHR5cGUtPmlzX3NldCgpKQorICAgIHsKKyAgICAgICAgcmV0dXJuICJUVHlwZS5TZXQiOworICAgIH0KKyAgICBlbHNlIGlmICh0eXBlLT5pc19saXN0KCkpCisgICAgeworICAgICAgICByZXR1cm4gIlRUeXBlLkxpc3QiOworICAgIH0KKworICAgIHRocm93ICJJTlZBTElEIFRZUEUgSU4gdHlwZV90b19l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ZXRfZG9jKCkpOworICAgIH0KK30KKwordm9pZCB0X25ldGNvcmVfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9uZXRjb3JlX2RvYyhvc3RyZWFtJiBvdXQsIHRfZnVuY3Rpb24qIHRmdW5jdGlvbikKK3sKKyAgICBpZiAodGZ1bmN0aW9uLT5oYXNfZG9jKCkpCisgICAgeworICAgICAgICBzdHJpbmdzdHJlYW0gcHM7CisgICAgICAgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIGZpZWxkcyA9IHRmdW5jdGlvbi0+Z2V0X2FyZ2xpc3QoKS0+Z2V0X21lbWJlcnMoKTsKKyAgICAgICAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgcF9pdGVyOworICAgICAgICBmb3IgKHBfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBwX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK3BfaXRlcikKKyAgICAgICAgeworICAgICAgICAgICAgdF9maWVsZCogcCA9ICpwX2l0ZXI7CisgICAgICAgICAgICBwcyA8PCBlbmRsIDw8ICI8cGFyYW0gbmFtZT1cIiIgPDwgcC0+Z2V0X25hbWUoKSA8PCAiXCI+IjsKKyAgICAgICAgICAgIGlmIChwLT5oYXNfZG9jKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RyaW5nIHN0ciA9IHAtPmdldF9kb2MoKTsKKyAgICAgICAgICAgICAgICBzdHIuZXJhc2UocmVtb3ZlKHN0ci5iZWdpbigpLCBzdHIuZW5kKCksICdcbicpLCBzdHIuZW5kKCkpOworICAgICAgICAgICAgICAgIHBzIDw8IHN0cjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBzIDw8ICI8L3BhcmFtPiI7CisgICAgICAgIH0KKworICAgICAgICBkb2NzdHJpbmdfY29tbWVudChvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLy8vICIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI8c3VtbWFyeT4iICsgZW5kbCArIHRmdW5jdGlvbi0+Z2V0X2RvYygpICsgIjwvc3VtbWFyeT4iICsgcHMuc3RyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIiKTsKKyAgICB9Cit9CisKK3ZvaWQgdF9uZXRjb3JlX2dlbmVyYXRvcjo6ZG9jc3RyaW5nX2NvbW1lbnQob3N0cmVhbSYgb3V0LCBjb25zdCBzdHJpbmcmIGNvbW1lbnRfc3RhcnQsIGNvbnN0IHN0cmluZyYgbGluZV9wcmVmaXgsIGNvbnN0IHN0cmluZyYgY29udGVudHMsIGNvbnN0IHN0cmluZyYgY29tbWVudF9lbmQpCit7CisgICAgaWYgKGNvbW1lbnRfc3RhcnQgIT0gIiIpCisgICAgeworICAgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgY29tbWVudF9zdGFydDsKKyAgICB9CisKKyAgICBzdHJpbmdzdHJlYW0gZG9jcyhjb250ZW50cywgc3RkOjppb3NfYmFzZTo6aW4pOworCisgICAgd2hpbGUgKCEoZG9jcy5lb2YoKSB8fCBkb2NzLmZhaWwoKSkpCisgICAgeworICAgICAgICBjaGFyIGxpbmVbMTAyNF07CisgICAgICAgIGRvY3MuZ2V0bGluZShsaW5lLCAxMDI0KTsKKworICAgICAgICAvLyBKdXN0IHBybnQgYSBuZXdsaW5lIHdoZW4gdGhlIGxpbmUgJiBwcmVmaXggYXJlIGVtcHR5LgorICAgICAgICBpZiAoc3RybGVuKGxpbmUpID09IDAgJiYgbGluZV9wcmVmaXggPT0gIiIgJiYgIWRvY3MuZW9mKCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIG91dCA8PCBlbmRsOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKHN0cmxlbihsaW5lKSA+IDAgfHwgIWRvY3MuZW9mKCkpCisgICAgICAgIHsgLy8gc2tpcCB0aGUgZ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9jb3B5X29mKCgodF9tYXAqKXR5cGUpLT5nZXRfa2V5X3R5cGUoKSwgImsiKTsKKyAgICBzdHJpbmcgY29weV9vZl92ID0gc3RydWN0X21lbWJlcl9jb3B5X29mKCgodF9tYXAqKXR5cGUpLT5nZXRfdmFsX3R5cGUoKSwgInYiKTsKKworICAgIGlmIChjb3B5X29mX2sgPT0gImsiICYmIGNvcHlfb2ZfdiA9PSAidiIpIHsKKyAgICAgIHJldHVybiBzdHJpbmcoIihIYXNodGJsLmNvcHkgIikgKyB3aGF0ICsgc3RyaW5nKCIpIik7CisgICAgfSBlbHNlIHsKKyAgICAgIHJldHVybiBzdHJpbmcoCisgICAgICAgICAgICAgICAgICIoKGZ1biBvaCAtPiBsZXQgbmggPSBIYXNodGJsLmNyZWF0ZSAoSGFzaHRibC5sZW5ndGggb2gpIGluIEhhc2h0YmwuaXRlciAoZnVuIGsgdiAiCisgICAgICAgICAgICAgICAgICItPiBIYXNodGJsLmFkZCBuaCAiKSArIGNvcHlfb2ZfayArIHN0cmluZygiICIpICsgY29weV9vZl92ICsgc3RyaW5nKCIpIG9oOyBuaCkgIikKKyAgICAgICAgICAgICArIHdoYXQgKyAiKSI7CisgICAgfQorICB9CisgIGlmICh0eXBlLT5pc19zZXQoKSkgeworICAgIHN0cmluZyBjb3B5X29mID0gc3RydWN0X21lbWJlcl9jb3B5X29mKCgodF9zZXQqKXR5cGUpLT5nZXRfZWxlbV90eXBlKCksICJrIik7CisKKyAgICBpZiAoY29weV9vZiA9PSAiayIpIHsKKyAgICAgIHJldHVybiBzdHJpbmcoIihIYXNodGJsLmNvcHkgIikgKyB3aGF0ICsgc3RyaW5nKCIpIik7CisgICAgfSBlbHNlIHsKKyAgICAgIHJldHVybiBzdHJpbmcoCisgICAgICAgICAgICAgICAgICIoKGZ1biBvaCAtPiBsZXQgbmggPSBIYXNodGJsLmNyZWF0ZSAoSGFzaHRibC5sZW5ndGggb2gpIGluIEhhc2h0YmwuaXRlciAoZnVuIGsgdiA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faXRlciAhPSBtZW1iZXJzLmVuZCgpOyArK21faXRlcikgeworICAgICAgZ2VuZXJhdGVfb2NhbWxfc3RydWN0X21lbWJlcihvdXQsIHRuYW1lLCAoKm1faXRlcikpOworICAgICAgb3V0IDw8IGVuZGw7CisgICAgfQorICB9CisgIGdlbmVyYXRlX29jYW1sX21ldGhvZF9jb3B5KG91dCwgbWVtYmVycyk7CisgIGdlbmVyYXRlX29jYW1sX3N0cnVjdF93cml0ZXIob3V0LCB0c3RydWN0KTsKKyAgaW5kZW50X2Rvd24oKTsKKyAgaW5kZW50KG91dCkgPDwgImVuZCIgPDwgZW5kbDsKKworICBpZiAoaXNfZXhjZXB0aW9uKSB7CisgICAgaW5kZW50KG91dCkgPDwgImV4Y2VwdGlvbiAiIDw8IGNhcGl0YWxpemUodG5hbWUpIDw8ICIgb2YgIiA8PCB0bmFtZSA8PCBlbmRsOworICB9CisKKyAgZ2VuZXJhdGVfb2NhbWxfc3RydWN0X3JlYWRlcihvdXQsIHRzdHJ1Y3QpOworfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHN0cnVjdHVyZSBtZW1iZXIgZm9yIGEgdGhyaWZ0IGRhdGEgdHlwZS4KKyAqCisgKiBAcGFyYW0gdG5hbWUgTmFtZSBvZiB0aGUgcGFyZW50IHN0cnVjdHVyZSBmb3IgdGhlIG1lbWJlcgorICogQHBhcmFtIHRtZW1iZXIgTWVtYmVyIGRlZmluaXRpb24KKyAqLwordm9pZCB0X29jYW1sX2dlbmVyYXRvcjo6Z2VuZXJhdGVfb2NhbWxfc3RydWN0X21lbWJlcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyB0bmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdG1lbWJlcikgeworICBzdHJpbmcgeCA9IHRtcCgiX3giKTsKKyAgc3RyaW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ZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAibWF0Y2ggcmVzdWx0I2dldF9zdWNjZXNzIHdpdGggU29tZSB2IC0+IHYgfCBOb25lIC0+ICgiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgfQorCisgICAgICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciB4X2l0ZXI7CisgICAgICBmb3IgKHhfaXRlciA9IHhjZXB0aW9ucy5iZWdpbigpOyB4X2l0ZXIgIT0geGNlcHRpb25zLmVuZCgpOyArK3hfaXRlcikgeworICAgICAgICBmX3NlcnZpY2VfIDw8IGluZGVudCgpIDw8ICIobWF0Y2ggcmVzdWx0I2dldF8iIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICAgIDw8ICIgd2l0aCBOb25lIC0+ICgpIHwgU29tZSBfdiAtPiIgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICIgIHJhaXNlICgiIDw8IGNhcGl0YWxpemUodHlwZV9uYW1lKCgqeF9pdGVyKS0+Z2V0X3R5cGUoKSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIF92KSk7IiA8PCBlbmRsOworICAgICAgfQorCisgICAgICAvLyBDYXJlZnVsLCBvbmx5IHJldHVybiBfcmVzdWx0IGlmIG5vdCBhIHZvaWQgZnVuY3Rpb24KKyAgICAgIGlmICgoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgeworICAgICAgICBpbmRlbnQoZl9zZXJ2aWNlXykgPDwgIigpIiA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9zZXJ2aWNlXworICAgICAgICAgICAgPDwgaW5kZW50KCkKKyAgICAgICAgICAgIDw8ICJyYWlzZSAoQXBwbGljYXRpb25fRXhu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VuZGw7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIHN0cmluZyBpdGVyID0gdG1wKCJfaXRlciIpOworICAgIGluZGVudChvdXQpIDw8ICJMaXN0Lml0ZXIgKGZ1biAiIDw8IGl0ZXIgPDwgIiAtPiAiOworICAgIGluZGVudF91cCgpOworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9saXN0X2VsZW1lbnQob3V0LCAodF9saXN0Kil0dHlwZSwgaXRlcik7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBpbmRlbnQob3V0KSA8PCAiKSAiIDw8IHByZWZpeCA8PCAiOyIgPDwgZW5kbDsKKyAgfQorCisgIGlmICh0dHlwZS0+aXNfbWFwKCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAib3Byb3Qjd3JpdGVNYXBFbmQiOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19zZXQoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdCN3cml0ZVNldEVuZCI7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX2xpc3QoKSkgeworICAgIGluZGVudChvdXQpIDw8ICJvcHJvdCN3cml0ZUxpc3RFbmQiOworICB9Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIG1hcC4KKyAqCisgKi8KK3ZvaWQgdF9vY2FtbF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9tYXBfZWxlbWVudChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGtpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyB2aXRlcikgeworICB0X2ZpZWxkIGtm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Dw8ICJ9IiA8PCBlbmRsOworCisgICAgaWYgKCEoKmZfaXRlciktPmlzX29uZXdheSgpKSB7CisgICAgICBzdGQ6OnN0cmluZyByZXN1bHRuYW1lID0gcGVybF9uYW1lc3BhY2UodHNlcnZpY2UtPmdldF9wcm9ncmFtKCkpICsgc2VydmljZV9uYW1lXyArICJfIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpICsgIl9yZXN1bHQiOworICAgICAgdF9zdHJ1Y3Qgbm9hcmdzKHByb2dyYW1fKTsKKworICAgICAgdF9mdW5jdGlvbiByZWN2X2Z1bmN0aW9uKCgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcoInJlY3ZfIikgKyAoKmZfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm5vYXJncyk7CisgICAgICAvLyBPcGVuIGZ1bmN0aW9uCisgICAgICBmX3NlcnZpY2VfIDw8IGVuZGwgPDwgInN1YiAiIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSgmcmVjdl9mdW5jdGlvbikgPDwgZW5kbDsKKworICAgICAgaW5kZW50X3VwKCk7CisKKyAgICAgIGZfc2VydmljZV8gPDwgaW5kZW50KCkgPDwgIm15ICRyc2VxaWQgPSAwOyIgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAibXkgJGZuYW1lOyIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAibXkgJG10eXBlID0gMDsiIDw8IGVuZGwgPDwgZW5kbDsKKworICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKSA8PCAiJHNlbGYtPntpbnB1dH0tPnJlYWRNZXNzYWdlQmVnaW4oXFwkZm5hbWUsIFxcJG10eXBlLCBcXCRyc2VxaWQpOyIKKyAgICAgICAgICAgICAgICAgPDwgZ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8IGluZGVudCgpIDw8ICJkaWUgXCIiIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiIGZhaWxlZDogdW5rbm93biByZXN1bHRcIjsiCisgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIH0KKworICAgICAgLy8gQ2xvc2UgZnVuY3Rpb24KKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBmX3NlcnZpY2VfIDw8ICJ9IiA8PCBlbmRsOworICAgIH0KKyAgfQorfQorCisvKioKKyAqIERlc2VyaWFsaXplcyBhIGZpZWxkIG9mIGFueSB0eXBlLgorICovCit2b2lkIHRfcGVybF9nZW5lcmF0b3I6OmdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcHJlZml4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGluY2xhc3MpIHsKKyAgKHZvaWQpaW5jbGFzczsKKyAgdF90eXBlKiB0eXBlID0gZ2V0X3RydWVfdHlwZSh0ZmllbGQtPmdldF90eXBlKCkpOworCisgIGlmICh0eXBlLT5pc192b2lkKCkpIHsKKyAgICB0aHJvdyAiQ0FOTk9UIEdFTkVSQVRFIERFU0VSSUFMSVpFIENPREUgRk9SIHZvaWQgVFlQRTogIiArIHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKKyAgfQorCisgIHN0cmluZyBuYW1lID0gdGZpZWxkLT5nZXRfbmFtZSgpOworCisgIC8vIEhhY2sgZm9yIHdoZW4gcHJlZml4IGlzIGRlZmluZWQgKGFsd2F5cyBhIGhhc2ggcmVmKQorICBpZiAoIXByZWZpeC5lbXB0eSgpKSB7CisgICAgbmFtZSA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VfVk9JRDoKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORzoKKyAgICAgICAgcmVzdWx0ICs9ICIgPSAnJyI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9CT09MOgorICAgICAgICByZXN1bHQgKz0gIiA9IDAiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTg6CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIHJlc3VsdCArPSAiID0gMCI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgIHJlc3VsdCArPSAiID0gMC4wIjsKKyAgICAgICAgYnJlYWs7CisgICAgICBkZWZhdWx0OgorICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IG5vIFBFUkwgaW5pdGlhbGl6ZXIgZm9yIGJhc2UgdHlwZSAiCisgICAgICAgICAgICArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIHJlc3VsdCArPSAiID0gMCI7CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19jb250YWluZXIoKSkgeworICAgICAgcmVzdWx0ICs9ICIgPSBbXSI7CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19zdHJ1Y3QoKSB8fCB0eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgICBpZiAob2JqKSB7CisgICAgICAgIHJlc3VsdCArPSAiID0gIiArIHBlcmxfbmFtZXNwYWNlKHR5cGUtPmdld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8vIFRyYW5zZm9ybSB0aGUgamF2YS1zdHlsZSBuYW1lc3BhY2UgaW50byBhIHBhdGguCisgICAgZm9yIChzdGQ6OnN0cmluZzo6aXRlcmF0b3IgaXQgPSBucy5iZWdpbigpOyBpdCAhPSBucy5lbmQoKTsgKytpdCkgeworICAgICAgaWYgKCppdCA9PSAnLicpIHsKKyAgICAgICAgKml0ID0gJy8nOworICAgICAgfQorICAgIH0KKworICAgIHJldHVybiBucyArICcvJzsKKyAgfQorCisgIC8qKgorICAgKiBUcmFuc2Zvcm0gY2xhc3NfbWV0aG9kIGludG8gQ2xhc3NNZXRob2QKKyAgICoKKyAgICogQHBhcmFtIHN0cgorICAgKiBAcmV0dXJuIHN0aXJuZworICAgKi8KKyAgc3RyaW5nIGNsYXNzaWZ5KHN0cmluZyBzdHIpIHsKKyAgICBzdHJpbmcgY2xhc3NlID0gIiI7CisKKyAgICB2ZWN0b3I8c3RyaW5nPiB4ID0gc3BsaXQoc3RyLCAnXycpOworCisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCB4LnNpemUoKTsgKytpKSB7CisgICAgICBjbGFzc2UgPSBjbGFzc2UgKyBjYXBpdGFsaXplKHhbaV0pOworICAgIH0KKworICAgIHJldHVybiBjbGFzc2U7CisgIH0KKworICAvKioKKyAgICogU3BsaXQgbWV0aG9kCisgICAqIEBwYXJhbSBzCisgICAqIEBwYXJhbSBkZWxpbQorICAgKiBAcGFyYW0gZWxlbXMKKyAgICogQHJldHVybgorICAgKi8KKyAgdmVjdG9yPHN0cmluZz4mIHNwbGl0KGNvbnN0IHN0cmluZyYgcywgY2hhciBkZWxpbSwgdmVjdG9yPHN0cmluZz4mIGVsZW1zKSB7CisgICAgc3RyaW5nc3RyZWFtIHNzKHMpOworICAgIHN0cmluZyBpdGVtOworCisgICAgd2hpbGUgKGdldGxpbmUoc3MsIGl0ZW0sIGRlbGltKSkgeworICAgICAgZWxlbXMucHVzaF9iYWNrKGl0ZW0pOworICAgIH0KKworICAgIHJldHVybiBlbGVtczsKKyAgfQorCisgIHZlY3RvcjxzdHJpbmc+IHNwbGl0KGNvbnN0IHN0cmluZyYgcywgY2hhciBkZWxpbSkgeworICAgIHZlY3RvcjxzdHJpbmc+IGVsZW1zOworCisgICAgcmV0dXJuIHNwbGl0KHMsIGRlbGltLCBlbGVtcyk7CisgIH0KKworICAvKioKKyAgICogQ2FwaXRhbGl6ZSBtZXRob2QKKyAgICogQHBhcmFtIHN0cgorICAgKiBAcmV0dXJuCisgICAqLworICBzdHJpbmcgY2FwaXRhbGl6ZShzdHJpbmcgc3RyKSB7CisgICAgc3RyaW5nOjppdGVyYXRvciBpdChzdHIuYmVnaW4oKSk7CisKKyAgICBpZiAoaXQgIT0gc3RyLmVuZCgpKQorICAgICAgc3RyWzBdID0gdG91cHBlcigodW5zaWduZWQgY2hhcilzdHJbMF0pOworCisgICAgLy8gICAgd2hpbGUoKytpdCAhPSBzdHIuZW5kKCkpCisgICAgLy8gICAgeworICAgIC8vICAgICAgKml0ID0gdG9sb3dlcigodW5zaWduZWQgY2hhcikqaXQpOworICAgIC8vICAgIH0KKyAgICByZXR1cm4gc3RyOworICB9CisKK3ByaXZhdGU6CisgIC8qKgorICAgKiBGaWxlIHN0cmVhbXMKKyAgICovCisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl90eXBlc187CisgIG9mc3RyZWFtX3dpdGhfY29udGVudF9iYXNlZF9jb25kaXRpb25hbF91cGRhdGUgZl9zZXJ2aWNlXzsKKworICBzdGQ6OnN0cmluZyBwYWNrYWdlX2Rpcl87CisgIC8qKgorICAgKiBHZW5lcmF0ZSBwcm90b2NvbC1pbmRlcGVuZGVudCB0ZW1wbGF0ZT8gT3IgQmluYXJ5IGlubGluZSBjb2RlPworICAgKi8KKyAgYm9vbCBiaW5hcnlfaW5saW5lXzsKKworICAvKioKKyAgICogR2VuZXJhdGUgYSBSRVNUIGhhbmRsZXIgY2xhc3MKKyAg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ZVxcVE1lc3NhZ2VUeXBlO1xuIgorICAgICAgICAgICAgICAgICAgICAidXNlIFRocmlmdFxcRXhjZXB0aW9uXFxURXhjZXB0aW9uO1xuIgorICAgICAgICAgICAgICAgICAgICAidXNlIFRocmlmdFxcRXhjZXB0aW9uXFxUUHJvdG9jb2xFeGNlcHRpb247XG4iCisgICAgICAgICAgICAgICAgICAgICJ1c2UgVGhyaWZ0XFxQcm90b2NvbFxcVFByb3RvY29sO1xuIgorICAgICAgICAgICAgICAgICAgICAidXNlIFRocmlmdFxcUHJvdG9jb2xcXFRCaW5hcnlQcm90b2NvbEFjY2VsZXJhdGVkO1xuIgorICAgICAgICAgICAgICAgICAgICAidXNlIFRocmlmdFxcRXhjZXB0aW9uXFxUQXBwbGljYXRpb25FeGNlcHRpb247XG4iOworCisgIGlmIChqc29uX3NlcmlhbGl6YWJsZV8pIHsKKyAgICBpbmNsdWRlcyArPSAidXNlIEpzb25TZXJpYWxpemFibGU7XG4iCisgICAgICAgICAgICAgICAgInVzZSBzdGRDbGFzcztcbiI7CisgIH0KKworICByZXR1cm4gaW5jbHVkZXM7Cit9CisKKy8qKgorICogQ2xvc2UgdXAgKG9yIGRvd24pIHNvbWUgZmlsZXouCisgKi8KK3ZvaWQgdF9waHBfZ2VuZXJhdG9yOjpjbG9zZV9nZW5lcmF0b3IoKSB7CisgIGlmIChjbGFzc21hcF8pIHsKKyAgICAvLyBDbG9zZSB0eXBlcyBmaWxlCisgICAgZl90eXBlc18uY2xvc2UoKTsKKyAgfQorfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHR5cGVkZWYuIFRoaXMgaXMgbm90IGRvbmUgaW4gUEhQLCB0eXBlcyBhcmUgYWxsIGltcGxpY2l0LgorICoKKyAqIEBwYXJhbSB0dHlwZWRlZiBUaGUgdHlwZSBkZWZpbml0aW9uCisgKi8KK3ZvaWQgdF9waHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV90eXBlZGVmKHRfdHlwZWRlZiogdHR5cGV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SB7CisgICAgICBzdHJpbmcgbmFtZSA9ICgqY19pdGVyKS0+Z2V0X25hbWUoKTsKKworICAgICAgaW5kZW50KGZfY29uc3RzKSA8PCAic3RhdGljIHByb3RlY3RlZCAkIiA8PCBuYW1lIDw8ICI7IiA8PCBlbmRsOworICAgIH0KKworICAgIC8vIENyZWF0ZSBpbml0IGZ1bmN0aW9uCisgICAgZm9yIChjX2l0ZXIgPSBjb25zdHMuYmVnaW4oKTsgY19pdGVyICE9IGNvbnN0cy5lbmQoKTsgKytjX2l0ZXIpIHsKKyAgICAgIHN0cmluZyBuYW1lID0gKCpjX2l0ZXIpLT5nZXRfbmFtZSgpOworCisgICAgICBmX2NvbnN0cyA8PCBlbmRsOworCisgICAgICBmX2NvbnN0cyA8PCBpbmRlbnQoKSA8PCAicHJvdGVjdGVkIHN0YXRpYyBmdW5jdGlvbiBpbml0XyIgPDwgbmFtZSA8PCAiKCkiIDw8ZW5kbAorICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInsiIDw8IGVuZGw7CisgICAgICBpbmRlbnRfdXAoKTsKKworICAgICAgaW5kZW50KGZfY29uc3RzKSA8PCAicmV0dXJuICI7CisgICAgICBnZW5lcmF0ZV9waHBfZG9jKGZfY29uc3RzLCAqY19pdGVyKTsKKyAgICAgIGZfY29uc3RzIDw8IHJlbmRlcl9jb25zdF92YWx1ZSgoKmNfaXRlciktPmdldF90eXBlKCksICgqY19pdGVyKS0+Z2V0X3ZhbHVlKCkpOworICAgICAgZl9jb25zdHMgPDwgIjsiIDw8IGVuZGw7CisKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBpbmRlbnQoZl9jb25zdHMpIDw8ICJ9IiA8PCBlbmRsOworICAgIH0KKworICAgIGluZGVudF9kb3duKCk7CisgICAgZl9jb25zdHMgPDwgIn0iIDw8IGVuZGw7CisgICAgaWYgKCFjbGFzc21hcF8pIHsKKyAgICAgIGZfY29uc3RzLmNsb3NlKCk7CisgICAgfQorICB9Cit9CisKK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RydWN0IGRlZmluaXRpb24gZm9yIGEgdGhyaWZ0IGRhdGEgdHlwZS4gVGhpcyBpcyBub3RoaW5nIGluIFBIUAorICogd2hlcmUgdGhlIG9iamVjdHMgYXJlIGFsbCBqdXN0IGFzc29jaWF0aXZlIGFycmF5cyAodW5sZXNzIG9mIGNvdXJzZSB3ZQorICogZGVjaWRlIHRvIHN0YXJ0IHVzaW5nIG9iamVjdHMgZm9yIHRoZW0uLi4pCisgKgorICogQHBhcmFtIHRzdHJ1Y3QgVGhlIHN0cnVjdCBkZWZpbml0aW9uCisgKi8KK3ZvaWQgdF9waHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9waHBfc3RydWN0X2RlZmluaXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIG1lbWJlcnMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7CisKKyAgZ2VuZXJhdGVfcGhwX2RvYyhvdXQsIHRzdHJ1Y3QpOworICBvdXQgPDwgImNsYXNzICIgPDwgcGhwX25hbWVzcGFjZV9kZWNsYXJhdGlvbih0c3RydWN0KTsKKyAgaWYgKGlzX2V4Y2VwdGlvbikgeworICAgIG91dCA8PCAiIGV4dGVuZHMgIgorICAgICAgICA8PCAiVEV4Y2VwdGlvbiI7CisgIH0gZWxzZSBpZiAob29wXykgeworICAgIG91dCA8PCAiIGV4dGVuZHMgIgorICAgICAg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ZworICBpbmRlbnQob3V0KSA8PCAic3dpdGNoICgkZmlkKSB7IiA8PCBlbmRsOworCisgIGluZGVudF91cCgpOworCisgIC8vIEdlbmVyYXRlIGRlc2VyaWFsaXphdGlvbiBjb2RlIGZvciBrbm93biBjYXNlcworICBmb3IgKGZfaXRlciA9IGZpZWxkcy5iZWdpbigpOyBmX2l0ZXIgIT0gZmllbGRzLmVuZCgpOyArK2ZfaXRlcikgeworICAgIGluZGVudChvdXQpIDw8ICJjYXNlICIgPDwgKCpmX2l0ZXIpLT5nZXRfa2V5KCkgPDwgIjoiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgaW5kZW50KG91dCkgPDwgImlmICgkZnR5cGUgPT0gIiA8PCB0eXBlX3RvX2VudW0oKCpmX2l0ZXIpLT5nZXRfdHlwZSgpKSA8PCAiKSB7IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2ZpZWxkKG91dCwgKmZfaXRlciwgInRoaXMtPiIpOworICAgIGluZGVudF9kb3duKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IGVsc2UgeyIgPDwgZW5kbDsKKworICAgIGluZGVudF91cCgpOworICAgIGlmIChiaW5hcnlfaW5saW5lXykgeworICAgICAgaW5kZW50KG91dCkgPDwgIiR4ZmVyICs9IFRQcm90b2NvbDo6c2tpcEJpbmFyeSgkaW5wdXQsICRmdHlwZSk7IiA8PCBlbmRsOworICAgIH0gZWxzZSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiJHhmZXIgKz0gJGlucHV0LT5za2lwKCRmdHlwZSk7IiA8PCBlbmRsOworICAgIH0KKworICAgIGluZGVudF9kb3duKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IiA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICJicmVhazsiIDw8IGVuZGw7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgfQorCisgIC8vIEluIHRoZSB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gdHlwZSBpbiBzdHJ1Y3R1cmUuJywgIgorICAgICAgICAgIDw8ICJUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSk7IiA8PCBlbmRsOworICAgICAgc2NvcGVfZG93bihvdXQpOworICAgIH0KKworICAgIC8vIFdyaXRlIGZpZWxkIGhlYWRlcgorICAgIGlmIChiaW5hcnlfaW5saW5lXykgeworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIkb3V0cHV0IC49IHBhY2soJ2MnLCAiIDw8IHR5cGVfdG9fZW51bSgoKmZfaXRlciktPmdldF90eXBlKCkpIDw8ICIpOyIKKyAgICAgICAgICA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICIkb3V0cHV0IC49IHBhY2soJ24nLCAiIDw8ICgqZl9pdGVyKS0+Z2V0X2tleSgpIDw8ICIpOyIgPDwgZW5kbDsKKyAgICB9IGVsc2UgeworICAgICAgaW5kZW50KG91dCkgPDwgIiR4ZmVyICs9ICRvdXRwdXQtPndyaXRlRmllbGRCZWdpbigiCisgICAgICAgICAgICAgICAgICA8PCAiJyIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICInLCAiIDw8IHR5cGVfdG9fZW51bSgoKmZfaXRlciktPmdldF90eXBlKCkpCisgICAgICAgICAgICAgICAgICA8PCAiLCAiIDw8ICgqZl9pdGVyKS0+Z2V0X2tleSgpIDw8ICIpOyIgPDwgZW5kbDsKKyAgICB9CisKKyAgICAvLyBXcml0ZSBmaWVsZCBjb250ZW50cworICAgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICpmX2l0ZXIsICJ0aGlzLT4iKTsKKworICAgIC8vIFdyaXRlIGZpZWxkIGNsb3NlcgorICAgIGlmICghYmluYXJ5X2lubGluZV8pIHsKKyAgICAgIGluZGVudChvdXQpIDw8ICIkeGZlciArPSAkb3V0cHV0LT53cml0ZUZpZWxkRW5kKCk7IiA8PCBlbmRsOworICAgIH0KKworICAgIGluZGVudF9kb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hdG9yOjpnZW5lcmF0ZV9waHBfc3RydWN0X3JlcXVpcmVkX3ZhbGlkYXRvcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWV0aG9kX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB3cml0ZV9tb2RlKSB7CisgIGluZGVudChvdXQpIDw8ICJwcml2YXRlIGZ1bmN0aW9uICIgPDwgbWV0aG9kX25hbWUgPDwgIigpIHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGNvbnN0IHZlY3Rvcjx0X2ZpZWxkKj4mIGZpZWxkcyA9IHRzdHJ1Y3QtPmdldF9tZW1iZXJzKCk7CisKKyAgaWYgKGZpZWxkcy5zaXplKCkgPiAwKSB7CisgICAgdmVjdG9yPHRfZmllbGQqPjo6Y29uc3RfaXRlcmF0b3IgZl9pdGVyOworCisgICAgZm9yIChmX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZl9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmX2l0ZXIpIHsKKyAgICAgIHRfZmllbGQqIGZpZWxkID0gKCpmX2l0ZXIpOworICAgICAgaWYgKGZpZWxkLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9SRVFVSVJFRAorICAgICAgICAgIHx8IChmaWVsZC0+Z2V0X3JlcSgpID09IHRfZmllbGQ6OlRfT1BUX0lOX1JFUV9PVVQgJiYgd3JpdGVfbW9kZSkpIHsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgImlmICgkdGhpcy0+IiA8PCBmaWVsZC0+Z2V0X25hbWUoKSA8PCAiID09PSBudWxsKSB7IiA8PCBlbmRsOworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgInRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oJ1JlcXVpcmVkIGZpZWxkICIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiLiIKKyAgICAgICAgICAgICAgICAgICAgPDwgZmllbGQtPmdldF9uYW1lKCkgPDwgIiBpcyB1bnNldCEnKTsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworICAgICAgfQorICAgIH0KKyAgfQorCisgIGluZGVudF9kb3duKCk7CisgIGluZGVudChvdXQpIDw8ICJ9IiA8PCBlbmRsOworfQorCit2b2lkIHRfcGhwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfcGhwX3N0cnVjdF9qc29uX3NlcmlhbGl6ZShvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0KSB7CisgIGluZGVudChvdXQpIDw8ICJwdWJsaWMgZnVuY3Rpb24ganNvblNlcmlhbGl6ZSgpIHsiIDw8IGVuZGw7CisgIGluZGVudF91cCgpOworCisgIGlmIChuZWVkc19waHBfd3JpdGVfdmFsaWRhdG9yKHRzdHJ1Y3QsIGlzX3Jlc3VsdCkpIHsKKyAgICBpbmRlbnQob3V0KSA8PCAiJHRoaXMtPl92YWxpZGF0ZUZvcldyaXRlKCk7IiA8PCBlbmRsOworICB9CisKKyAgaW5kZW50KG91dCkgPDwgIiRqc29uID0gbmV3IHN0ZENsYXNzOyIgPDwgZW5kbDsKKworICBjb25zdCB2ZWN0b3I8dF9maWVsZCo+JiBmaWVs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gfSBlbHNlIHsKKyAgICBmX3NlcnZpY2VfcHJvY2Vzc29yIDw8IGluZGVudCgpIDw8ICIgICRpbnB1dC0+c2tpcCgiCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiVFR5cGU6OlNUUlVDVCk7IiA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICIgICRpbnB1dC0+cmVhZE1lc3NhZ2VFbmQoKTsiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICIgICR4ID0gbmV3ICIKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJUQXBwbGljYXRpb25FeGNlcHRpb24oJ0Z1bmN0aW9uICcuJGZuYW1lLicgbm90IGltcGxlbWVudGVkLicsICIKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJUQXBwbGljYXRpb25FeGNlcHRpb246OlVOS05PV05fTUVUSE9EKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgICRvdXRwdXQtPndyaXRlTWVzc2FnZUJlZ2luKCRmbmFtZSwgIgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIlRNZXNzYWdlVHlwZTo6RVhDRVBUSU9OLCAkcnNlcWlkKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgICR4LT53cml0ZSgkb3V0cHV0KTsiIDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgIiAgJG91dHB1dC0+d3JpdGVNZXNzYWdlRW5kKCk7IgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgZW5kbCA8PCBpbmRlbnQoKSA8PCAiICAkb3V0cHV0LT5nZXRUcmFuc3BvcnQoKS0+Zmx1c2goKTsiIDw8IGVuZGwgPDwgaW5kZW50KCkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgIHJldHVybjsiIDw8IGVuZGw7CisgIH0KKworICBpbmRlbnRfZG93bigpO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KKyAgICB9IGVsc2UgeworICAgICAgb3V0IDw8ICIsICI7CisgICAgfQorICAgIG91dCA8PCAiJGFyZ3MtPiIgPDwgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpOworICB9CisgIG91dCA8PCAiKTsiIDw8IGVuZGw7CisKKyAgaWYgKCF0ZnVuY3Rpb24tPmlzX29uZXdheSgpICYmIHhjZXB0aW9ucy5zaXplKCkgPiAwKSB7CisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBmb3IgKHhfaXRlciA9IHhjZXB0aW9ucy5iZWdpbigpOyB4X2l0ZXIgIT0geGNlcHRpb25zLmVuZCgpOyArK3hfaXRlcikgeworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ9IGNhdGNoICgiCisgICAgICAgICAgICAgICAgIDw8IHBocF9uYW1lc3BhY2UoZ2V0X3RydWVfdHlwZSgoKnhfaXRlciktPmdldF90eXBlKCkpLT5nZXRfcHJvZ3JhbSgpKQorICAgICAgICAgICAgICAgICA8PCAoKnhfaXRlciktPmdldF90eXBlKCktPmdldF9uYW1lKCkgPDwgIiAkIiA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIikgeyIKKyAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIGlmICghdGZ1bmN0aW9uLT5pc19vbmV3YXkoKSkgeworICAgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIkcmVzdWx0LT4iIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiID0gJCIKKyAgICAgICAgICAgICAgICAgICA8PCAoKnhfaXRlciktPmdldF9uYW1lKCkgPDwgIjsiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF9kb3duKCk7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKTsKKyAgICAgIH0KKyAgICB9CisgICAgb3V0IDw8ICJ9IiA8PCBlbmRsOworICB9CisKKyAgLy8gU2hvcnRjdXQgb3V0IGhlcmUgZm9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kbCA8PCBpbmRlbnQoKQorICAgICAgICAgICAgICAgICAgICAgICA8PCAiJHRoaXMtPm91dHB1dF8tPndyaXRlTWVzc2FnZUVuZCgpOyIgPDwgZW5kbCA8PCBpbmRlbnQoKQorICAgICAgICAgICAgICAgICAgICAgICA8PCAiJHRoaXMtPm91dHB1dF8tPmdldFRyYW5zcG9ydCgpLT5mbHVzaCgpOyIgPDwgZW5kbDsKKyAgICB9CisKKyAgICBzY29wZV9kb3duKGZfc2VydmljZV9jbGllbnQpOworCisgICAgc2NvcGVfZG93bihmX3NlcnZpY2VfY2xpZW50KTsKKworICAgIGlmICghKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgc3RkOjpzdHJpbmcgcmVzdWx0bmFtZSA9IHBocF9uYW1lc3BhY2UodHNlcnZpY2UtPmdldF9wcm9ncmFtKCkpICsgc2VydmljZV9uYW1lXyArICJfIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgKCpmX2l0ZXIpLT5nZXRfbmFtZSgpICsgIl9yZXN1bHQiOworICAgICAgdF9zdHJ1Y3Qgbm9hcmdzKHByb2dyYW1fKTsKKworICAgICAgdF9mdW5jdGlvbiByZWN2X2Z1bmN0aW9uKCgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcoInJlY3ZfIikgKyAoKmZfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm5vYXJncyk7CisgICAgICAvLyBPcGVuIGZ1bmN0aW9uCisgICAgICBmX3NlcnZpY2VfY2xpZW50IDw8IGVuZGwgPDwgaW5kZW50KCkgPDwgInB1YmxpYyBmdW5jdGlvbiAiIDw8IGZ1bmN0aW9uX3NpZ25hdHVyZSgmcmVjdl9mdW5jdGlvbikKKyAgICAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIHNjb3BlX3VwKGZfc2VydmljZV9jbGllbnQpOworCisgICAgICBmX3NlcnZpY2VfY2xpZW50IDw8IGluZGVudCgpIDw8ICIkYmluX2FjY2VsID0gKCR0aGlzLT5pbnB1dF8gaW5zdGFuY2VvZiAiCisgICAgICAgICAgICAgICAgICAgICAgIDw8ICJUQmluYXJ5UHJvdG9jb2xBY2NlbGVyYXRlZCkiCisgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgJiYgZnVuY3Rpb25fZXhpc3RzKCd0aHJpZnRfcHJvdG9jb2xfcmVhZF9iaW5hcnknKTsiIDw8IGVuZGw7CisKKyAgICAgIGZfc2VydmljZV9jbGllbnQgPDwgaW5kZW50KCkgPDwgImlmICgkYmluX2FjY2VsKSB7IiA8PCBlbmRsOworCisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIGZfc2VydmljZV9jbGllbnQgPDwgaW5kZW50KCkgPDwgIiRyZXN1bHQgPSB0aHJpZnRfcHJvdG9jb2xfcmVhZF9iaW5hcnkoIiA8PCBlbmRsOworCisgICAgICBpbmRlbnRfdXAoKTsKKyAgICAgIGZfc2VydmljZV9jbGllbnQgPDwgaW5kZW50KCkgPDwgIiR0aGlzLT5pbnB1dF8sIiA8PCBlbmRsCisgICAgICAgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICInIiA8PCByZXN1bHRuYW1lIDw8ICInLCIgPDwgZW5kbAorICAgICAgICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAiJHRoaXMtPmlucHV0Xy0+aXNTdHJpY3RSZWFkKCkiIDw8IGVuZGw7CisKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBmX3NlcnZpY2VfY2xpZW50IDw8IGluZGVudCgpIDw8ICIpOyIgPDwgZW5kbDsKKworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIGZfc2VydmljZV9jbGllbnQgPDwgaW5kZW50KCkgPDwgIn0gZWxzZSB7IiA8PCBlbmRsOworCisgICAgICBpbmRlbnRfdXAoKTsKKyAgICA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X2NsaWVudCk7CisgICAgfQorICB9CisKKyAgaW5kZW50X2Rvd24oKTsKKyAgZl9zZXJ2aWNlX2NsaWVudCA8PCAifSIgPDwgZW5kbDsKKworICAvLyBDbG9zZSBzZXJ2aWNlIGNsaWVudCBmaWxlCisgIGlmICghY2xhc3NtYXBfKSB7CisgICAgZl9zZXJ2aWNlX2NsaWVudC5jbG9zZSgpOworICB9Cit9CisKKy8qKgorICogRGVzZXJpYWxpemVzIGEgZmllbGQgb2YgYW55IHR5cGUuCisgKi8KK3ZvaWQgdF9waHBfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9kZXNlcmlhbGl6ZV9maWVsZChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZCogdGZpZWxkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBwcmVmaXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpbmNsYXNzKSB7CisgIHRfdHlwZSogdHlwZSA9IGdldF90cnVlX3R5cGUodGZpZWxkLT5nZXRfdHlwZSgpKTsKKworICBpZiAodHlwZS0+aXNfdm9pZCgpKSB7CisgICAgdGhyb3cgIkNBTk5PVCBHRU5FUkFURSBERVNFUklBTElaRSBDT0RFIEZPUiB2b2lkIFRZUEU6ICIgKyBwcmVmaXggKyB0ZmllbGQtPmdldF9uYW1lKCk7CisgIH0KKworICBzdHJpbmcgbmFtZSA9IHByZWZpeCArIHRmaWVsZC0+Z2V0X25hbWUoKTsKKworICBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIGdlbmVyYXRlX2Rlc2VyaWFsaXplX3N0cnVjdChvdXQsICh0X3N0cnVjdCopdHlwZSwgbmFtZSk7CisgIH0gZWxzZSB7CisKKyAgICBpZiAodHlwZS0+aXN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FrOworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfU1RSSU5HOgorICAgICAgICAgICAgb3V0IDw8ICJyZWFkU3RyaW5nKCQiIDw8IG5hbWUgPDwgIik7IjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgICAgIG91dCA8PCAicmVhZEJvb2woJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgICAgIG91dCA8PCAicmVhZEJ5dGUoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMTY6CisgICAgICAgICAgICBvdXQgPDwgInJlYWRJMTYoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgICAgICBvdXQgPDwgInJlYWRJMzIoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgICBvdXQgPDwgInJlYWRJNjQoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgICAgICBvdXQgPDwgInJlYWREb3VibGUoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gUEhQIG5hbWUgZm9yIGJhc2UgdHlwZSAiIC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gICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgICBvdXQgPDwgIndyaXRlSTE2KCQiIDw8IG5hbWUgPDwgIik7IjsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JMzI6CisgICAgICAgICAgb3V0IDw8ICJ3cml0ZUkzMigkIiA8PCBuYW1lIDw8ICIpOyI7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICAgIG91dCA8PCAid3JpdGVJNjQoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgICBvdXQgPDwgIndyaXRlRG91YmxlKCQiIDw8IG5hbWUgPDwgIik7IjsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICB0aHJvdyAiY29tcGlsZXIgZXJyb3I6IG5vIFBIUCBuYW1lIGZvciBiYXNlIHR5cGUgIiArIHRfYmFzZV90eXBlOjp0X2Jhc2VfbmFtZSh0YmFzZSk7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfZW51bSgpKSB7CisgICAgICAgIG91dCA8PCAid3JpdGVJMzIoJCIgPDwgbmFtZSA8PCAiKTsiOworICAgICAgfQorICAgICAgb3V0IDw8IGVuZGw7CisgICAgfQorICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIFNFUklBTElaRSBGSUVMRCAnJXMlcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICBwcmVmaXguY19zdHIoKSwKKyAgICAgICAgICAgdGZpZWxkLT5nZXRfbmFtZSgpLmNfc3RyKCksCisgICAgICAgICAgIHR5cGUtPmdldF9uYW1lKCkuY19zdHIoKSk7CisgIH0K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lmIChiaW5hcnlfaW5saW5lXykgeworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICIkb3V0cHV0IC49IHBhY2soJ2MnLCAiIDw8IHR5cGVfdG9fZW51bSgoKHRfbGlzdCopdHR5cGUpLT5nZXRfZWxlbV90eXBlKCkpCisgICAgICAgICAgPDwgIik7IiA8PCBlbmRsIDw8IGluZGVudCgpIDw8ICIkb3V0cHV0IC49IHN0cnJldihwYWNrKCdsJywgY291bnQoJCIgPDwgcHJlZml4IDw8ICIpKSk7IgorICAgICAgICAgIDw8IGVuZGw7CisKKyAgICB9IGVsc2UgeworICAgICAgaW5kZW50KG91dCkgPDwgIiRvdXRwdXQtPndyaXRlTGlzdEJlZ2luKCIgPDwgdHlwZV90b19lbnVtKCgodF9saXN0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKSkKKyAgICAgICAgICAgICAgICAgIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgIDw8ICJjb3VudCgkIiA8PCBwcmVmaXggPDwgIikpOyIgPDwgZW5kbDsKKyAgICB9CisgIH0KKworICBpZiAodHR5cGUtPmlzX21hcCgpKSB7CisgICAgc3RyaW5nIGtpdGVyID0gdG1wKCJraXRlciIpOworICAgIHN0cmluZyB2aXRlciA9IHRtcCgidml0ZXIiKTsKKyAgICBpbmRlbnQob3V0KSA8PCAiZm9yZWFjaCAoJCIgPDwgcHJlZml4IDw8ICIgYXMgIgorICAgICAgICAgICAgICAgIDw8ICIkIiA8PCBraXRlciA8PCAiID0+ICQiIDw8IHZpdGVyIDw8ICIpIHsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG91dCwgKHRfbWFwKil0dHlwZSwga2l0ZXIsIHZpdGVyKTsKKyAgICBzY29wZV9kb3duKG91dCk7CisgIH0gZWxzZSBpZiAodHR5cGUtPmlzX3NldCgpKSB7CisgICAgc3RyaW5nIGl0ZXIgPSB0bXAoIml0Z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zX3NldCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiJG91dHB1dC0+d3JpdGVTZXRFbmQoKTsiIDw8IGVuZGw7CisgICAgfSBlbHNlIGlmICh0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICBpbmRlbnQob3V0KSA8PCAiJG91dHB1dC0+d3JpdGVMaXN0RW5kKCk7IiA8PCBlbmRsOworICAgIH0KKyAgfQorfQorCisvKioKKyAqIFNlcmlhbGl6ZXMgdGhlIG1lbWJlcnMgb2YgYSBtYXAuCisgKgorICovCit2b2lkIHRfcGhwX2dlbmVyYXRvcjo6Z2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBraXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHZpdGVyKSB7CisgIHRfZmllbGQga2ZpZWxkKHRtYXAtPmdldF9rZXlfdHlwZSgpLCBraXRlcik7CisgIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZChvdXQsICZrZmllbGQsICIiKTsKKworICB0X2ZpZWxkIHZmaWVsZCh0bWFwLT5nZXRfdmFsX3R5cGUoKSwgdml0ZXIpOworICBnZW5lcmF0ZV9zZXJpYWxpemVfZmllbGQob3V0LCAmdmZpZWxkLCAiIik7Cit9CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgbWVtYmVycyBvZiBhIHNldC4KKyAqLwordm9pZCB0X3BocF9nZW5lcmF0b3I6OmdlbmVyYXRlX3NlcmlhbGl6ZV9zZXRfZWxlbWVudChvc3RyZWFtJiBvdXQsIHRfc2V0KiB0c2V0LCBzdHJpbmcgaXRlcikgeworICB0X2ZpZWxkIG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HNlIGlmICh0eXBlLT5pc19zZXQoKSkgeworICAgIHRfc2V0KiB0c2V0ID0gc3RhdGljX2Nhc3Q8dF9zZXQqPih0eXBlKTsKKyAgICB0X3R5cGUqIHRfZWxlbSA9IHRzZXQtPmdldF9lbGVtX3R5cGUoKTsKKyAgICBpZiAodF9lbGVtLT5pc19jb250YWluZXIoKSkgeworICAgICAgcmV0dXJuICIoIiArIHR5cGVfdG9fcGhwZG9jKHRfZWxlbSkgKyAiKVtdIjsKKyAgICB9IGVsc2UgeworICAgICAgcmV0dXJuIHR5cGVfdG9fcGhwZG9jKHRfZWxlbSkgKyAiW10iOworICAgIH0KKyAgfSBlbHNlIGlmICh0eXBlLT5pc19saXN0KCkpIHsKKyAgICB0X2xpc3QqIHRsaXN0ID0gc3RhdGljX2Nhc3Q8dF9saXN0Kj4odHlwZSk7CisgICAgdF90eXBlKiB0X2VsZW0gPSB0bGlzdC0+Z2V0X2VsZW1fdHlwZSgpOworICAgIGlmICh0X2VsZW0tPmlzX2NvbnRhaW5lcigpKSB7CisgICAgICByZXR1cm4gIigiICsgdHlwZV90b19waHBkb2ModF9lbGVtKSArICIpW10iOworICAgIH0gZWxzZSB7CisgICAgICByZXR1cm4gdHlwZV90b19waHBkb2ModF9lbGVtKSArICJbXSI7CisgICAgfQorICB9CisKKyAgdGhyb3cgIklOVkFMSUQgVFlQRSBJTiB0eXBlX3RvX2VudW06ICIgKyB0eXBlLT5nZXRfbmFtZSgpOworfQorCitUSFJJRlRfUkVHSVNURVJfR0VORVJBVE9SKAorICAgIHBocCwKKyAgICAiUEhQIiwKKyAgICAiICAgIGlubGluZWQ6ICAgICAgICAgR2VuZXJhdGUgUEhQIGlubGluZWQgZmlsZXNcbiIKKyAgICAiICAgIHNlcnZlcjogICAgICAgICAgR2VuZXJhdGUgUEhQIHNlcnZlciBzdHVic1xuIgorICAgICIgICAgb29wOiAgICAgICAgICAgICBHZW5lcmF0ZSBQSFAgd2l0aCBvYmplY3Qgb3JpZW50ZWQ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AiCisgICAgICAgICAgICAgICAgICA8PCAiJyIgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICInIgorICAgICAgICAgICAgICAgICAgPDwgIiwgIiA8PCB0eXBlX3RvX3NwZWNfYXJncygoKm1faXRlciktPmdldF90eXBlKCkpIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgIDw8IHJlbmRlcl9maWVsZF9kZWZhdWx0X3ZhbHVlKCptX2l0ZXIpIDw8ICIsICIKKyAgICAgICAgICAgICAgICAgIDw8ICIpLCIKKyAgICAgICAgICAgICAgICAgIDw8ICIgICMgIiA8PCBzb3J0ZWRfa2V5c19wb3MgPDwgZW5kbDsKKworICAgICAgc29ydGVkX2tleXNfcG9zKys7CisgICAgfQorCisgICAgaW5kZW50X2Rvd24oKTsKKyAgICBpbmRlbnQob3V0KSA8PCAiKSIgPDwgZW5kbDsKKyAgfSBlbHNlIHsKKyAgICBpbmRlbnQob3V0KSA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICIudGhyaWZ0X3NwZWMgPSAoKSIgPDwgZW5kbDsKKyAgfQorfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIHN0cnVjdCBkZWZpbml0aW9uIGZvciBhIHRocmlmdCBkYXRhIHR5cGUuCisgKgorICogQHBhcmFtIHRzdHJ1Y3QgVGhlIHN0cnVjdCBkZWZpbml0aW9uCisgKi8KK3ZvaWQgdF9weV9nZW5lcmF0b3I6OmdlbmVyYXRlX3B5X3N0cnVjdF9kZWZpbml0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19leGNlcHRpb24pIHsKKyAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgbWVtYmVycyA9IHRzdHJ1Y3QtPmdldF9tZW1iZX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HsKKyAgICAgIC8vIEluaXRpYWxpemUgZmllbGRzCisgICAgICB0X3R5cGUqIHR5cGUgPSAoKm1faXRlciktPmdldF90eXBlKCk7CisgICAgICBpZiAoIXR5cGUtPmlzX2Jhc2VfdHlwZSgpICYmICF0eXBlLT5pc19lbnVtKCkgJiYgKCptX2l0ZXIpLT5nZXRfdmFsdWUoKSAhPSBOVUxMKSB7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJpZiAiIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiIGlzICIKKyAgICAgICAgICAgICAgICAgICAgPDwgInNlbGYudGhyaWZ0X3NwZWNbIiA8PCAoKm1faXRlciktPmdldF9rZXkoKSA8PCAiXVs0XToiIDw8IGVuZGw7CisgICAgICAgIGluZGVudF91cCgpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAoKm1faXRlciktPmdldF9uYW1lKCkgPDwgIiA9ICIgPDwgcmVuZGVyX2ZpZWxkX2RlZmF1bHRfdmFsdWUoKm1faXRlcikKKyAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIH0KKworICAgICAgaWYgKGlzX2ltbXV0YWJsZSh0c3RydWN0KSkgeworICAgICAgICBpZiAoZ2VuX25ld3N0eWxlXyB8fCBnZW5fZHluYW1pY18pIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAic3VwZXIoIiA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICIsIHNlbGYpLl9fc2V0YXR0cl9fKCciCisgICAgICAgICAgICAgICAgICAgICAgPDwgKCptX2l0ZXIpLT5nZXRfbmFtZSgpIDw8ICInLCAiIDw8ICgqbV9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiKSIgPDwgZW5kbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBpbmRlbnQob3V0KSA8PCAic2VsZi5fX2RpY3RfX1snIiA8PCAoKm1faXRlciktPmdldF9u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ICAgaWYgKGdlbl90d2lzdGVkXykgeworICAgICAgLy8gd2UgbmVlZCBhIGxlYWRpbmcgY29tbWEgaWYgdGhlcmUgYXJlIGFyZ3MsIHNpbmNlIGl0J3MgY2FsbGVkIGFzIG1heWJlRGVmZXJyZWQoZnVuY25hbWUsCisgICAgICAvLyBhcmcpCisgICAgICBmaXJzdCA9IGZhbHNlOworICAgIH0KKyAgICBmb3IgKGZsZF9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZsZF9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmbGRfaXRlcikgeworICAgICAgaWYgKGZpcnN0KSB7CisgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICB9IGVsc2UgeworICAgICAgICBmX3NlcnZpY2VfIDw8ICIsICI7CisgICAgICB9CisgICAgICBmX3NlcnZpY2VfIDw8ICgqZmxkX2l0ZXIpLT5nZXRfbmFtZSgpOworICAgIH0KKworICAgIGZfc2VydmljZV8gPDwgIikiIDw8IGVuZGw7CisKKyAgICBpZiAoISgqZl9pdGVyKS0+aXNfb25ld2F5KCkpIHsKKyAgICAgIGlmIChnZW5fdHdpc3RlZF8pIHsKKyAgICAgICAgLy8gbm90aGluZy4gU2VlIHRoZSBuZXh0IGJsb2NrLgorICAgICAgfSBlbHNlIGlmIChnZW5fdG9ybmFkb18pIHsKKyAgICAgICAgaW5kZW50KGZfc2VydmljZV8pIDw8ICJyZXR1cm4gZnV0dXJlIiA8PCBlbmRsOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgZl9zZXJ2aWNlXyA8PCBpbmRlbnQoKTsKKyAgICAgICAgaWYgKCEoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKSkgeworICAgICAgICAgIGZfc2VydmljZV8gPDwgInJldHVybiAiOworICAgICAgICB9CisgICAgICAgIGZfc2VydmljZV8gPDwgInNlbGYucmVjdl8iIDw8IGZ1bm5hbWUgPDwgIigpIiA8PCBlbmRsOworICAgICAgfQorICAgI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VE1lc3NhZ2VUeXBlLkVYQ0VQVElPTiIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCBpbmRlbnRfc3RyKCkgPDwgInJlc3VsdCA9IGV4IiA8PCBlbmRsCisgICAgICAgICAgICAgICAgIDw8IGluZGVudCgpIDw8ICJleGNlcHQgRXhjZXB0aW9uOiIgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCBpbmRlbnRfc3RyKCkKKyAgICAgICAgICAgICAgICAgPDwgImxvZ2dpbmcuZXhjZXB0aW9uKCdVbmV4cGVjdGVkIGV4Y2VwdGlvbiBpbiBoYW5kbGVyJykiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgaW5kZW50X3N0cigpIDw8ICJtc2dfdHlwZSA9IFRNZXNzYWdlVHlwZS5FWENFUFRJT04iIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgaW5kZW50X3N0cigpCisgICAgICAgICAgICAgICAgIDw8ICJyZXN1bHQgPSBUQXBwbGljYXRpb25FeGNlcHRpb24oVEFwcGxpY2F0aW9uRXhjZXB0aW9uLklOVEVSTkFMX0VSUk9SLCAiCisgICAgICAgICAgICAgICAgICAgICInSW50ZXJuYWwgZXJyb3InKSIKKyAgICAgICAgICAgICAgICAgPDwgZW5kbAorICAgICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAib3Byb3Qud3JpdGVNZXNzYWdlQmVnaW4oXCIiIDw8IHRmdW5jdGlvbi0+Z2V0X25hbWUoKQorICAgICAgICAgICAgICAgICA8PCAiXCIsIG1zZ190eXBlLCBzZXFpZCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInJlc3VsdC53cml0ZShvcHJvdCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgIm9wcm90LndyaXRlTWVzc2Fn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nJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0JPT0w6CisgICAgICAgIG91dCA8PCAicmVhZEJvb2woKSI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JODoKKyAgICAgICAgb3V0IDw8ICJyZWFkQnl0ZSgpIjsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgb3V0IDw8ICJyZWFkSTE2KCkiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBvdXQgPDwgInJlYWRJMzIoKSI7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgIG91dCA8PCAicmVhZEk2NCgpIjsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgb3V0IDw8ICJyZWFkRG91YmxlKCkiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93ICJjb21waWxlciBlcnJvcjogbm8gUHl0aG9uIG5hbWUgZm9yIGJhc2UgdHlwZSAiICsgdF9iYXNlX3R5cGU6OnRfYmFzZV9uYW1lKHRiYXNlKTsKKyAgICAgIH0KKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSkgeworICAgICAgb3V0IDw8ICJyZWFkSTMyKCkiOworICAgIH0KKyAgICBvdXQgPDwgZW5kbDsKKworICB9IGVsc2UgeworICAgIHByaW50ZigiRE8gTk9UIEtOT1cgSE9XIFRPIERFU0VSSUFMSVpFIEZJRUxEICclcycgVFlQRSAnJXMnXG4iLAorICAgICAgICAgICB0ZmllbGQtPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgdHlwZS0+Z2V0X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y3QoKSB8fCB0dHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgIHJldHVybiAiWyIgKyB0eXBlX25hbWUodHR5cGUpICsgIiwgTm9uZV0iOworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19tYXAoKSkgeworICAgIHJldHVybiAiKCIgKyB0eXBlX3RvX2VudW0oKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgKyAiLCAiCisgICAgICAgICAgICsgdHlwZV90b19zcGVjX2FyZ3MoKCh0X21hcCopdHR5cGUpLT5nZXRfa2V5X3R5cGUoKSkgKyAiLCAiCisgICAgICAgICAgICsgdHlwZV90b19lbnVtKCgodF9tYXAqKXR0eXBlKS0+Z2V0X3ZhbF90eXBlKCkpICsgIiwgIgorICAgICAgICAgICArIHR5cGVfdG9fc3BlY19hcmdzKCgodF9tYXAqKXR0eXBlKS0+Z2V0X3ZhbF90eXBlKCkpICsgIiwgIgorICAgICAgICAgICArIChpc19pbW11dGFibGUodHR5cGUpID8gIlRydWUiIDogIkZhbHNlIikgKyAiKSI7CisKKyAgfSBlbHNlIGlmICh0dHlwZS0+aXNfc2V0KCkpIHsKKyAgICByZXR1cm4gIigiICsgdHlwZV90b19lbnVtKCgodF9zZXQqKXR0eXBlKS0+Z2V0X2VsZW1fdHlwZSgpKSArICIsICIKKyAgICAgICAgICAgKyB0eXBlX3RvX3NwZWNfYXJncygoKHRfc2V0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKSkgKyAiLCAiCisgICAgICAgICAgICsgKGlzX2ltbXV0YWJsZSh0dHlwZSkgPyAiVHJ1ZSIgOiAiRmFsc2UiKSArICIpIjsKKworICB9IGVsc2UgaWYgKHR0eXBlLT5pc19saXN0KCkpIHsKKyAgICByZXR1cm4gIigiICsgdHlwZV90b19lbnVtKCgodF9saXN0Kil0dHlwZSktPmdldF9lbGVtX3R5cGUoKSkgKyAiLCAiCisgICAgICAgICAgICsgdHlwZV90b19zcGVjX2FyZ3MoKCh0X2xp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ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX21hcF9lbGVtZW50KHRfcmJfb2ZzdHJlYW0mIG91dCwgdF9tYXAqIHRtYXAsIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX2Rlc2VyaWFsaXplX2xpc3RfZWxlbWVudCh0X3JiX29mc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfbGlzdCogdGxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHByZWZpeCA9ICIiKTsKKworICB2b2lkIGdlbmVyYXRlX3NlcmlhbGl6ZV9maWVsZCh0X3JiX29mc3RyZWFtJiBvdXQsIHRfZmllbGQqIHRmaWVsZCwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX3N0cnVjdCh0X3JiX29mc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0LCBzdGQ6OnN0cmluZyBwcmVmaXggPSAiIik7CisKKyAgdm9pZCBnZW5lcmF0ZV9zZXJpYWxpemVfY29udGFpbmVyKHRfcmJfb2ZzdHJlYW0mIG91dCwgdF90eXBlKiB0dHlwZSwgc3RkOjpzdHJpbmcgcHJlZml4ID0gIiIpOworCisgIHZvaWQgZ2VuZXJhdGVfc2VyaWFsaXplX21hcF9lbGVtZW50KHRfcmJfb2ZzdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9tYXAqIHRtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGtpdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB2aXRlcik7CisK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JiBmaWVsZHMgPSB0c3RydWN0LT5nZXRfbWVtYmVycygpOworICB2ZWN0b3I8dF9maWVsZCo+Ojpjb25zdF9pdGVyYXRvciBmX2l0ZXI7CisKKyAgb3V0LmluZGVudCgpIDw8ICJGSUVMRFMgPSB7IiA8PCBlbmRsOworICBvdXQuaW5kZW50X3VwKCk7CisgIGZvciAoZl9pdGVyID0gZmllbGRzLmJlZ2luKCk7IGZfaXRlciAhPSBmaWVsZHMuZW5kKCk7ICsrZl9pdGVyKSB7CisgICAgaWYgKGZfaXRlciAhPSBmaWVsZHMuYmVnaW4oKSkgeworICAgICAgb3V0IDw8ICIsIiA8PCBlbmRsOworICAgIH0KKworICAgIC8vIGdlbmVyYXRlIHRoZSBmaWVsZCBkb2NzdHJpbmdzIHdpdGhpbiB0aGUgRklFTERTIGNvbnN0YW50LiBubyByZWFsIGJldHRlciBwbGFjZS4uLgorICAgIGdlbmVyYXRlX3Jkb2Mob3V0LCAqZl9pdGVyKTsKKworICAgIG91dC5pbmRlbnQoKSA8PCB1cGNhc2Vfc3RyaW5nKCgqZl9pdGVyKS0+Z2V0X25hbWUoKSkgPDwgIiA9PiAiOworCisgICAgZ2VuZXJhdGVfZmllbGRfZGF0YShvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF90eXBlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF9uYW1lKCksCisgICAgICAgICAgICAgICAgICAgICAgICAoKmZfaXRlciktPmdldF92YWx1ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgKCpmX2l0ZXIpLT5nZXRfcmVxKCkgPT0gdF9maWVsZDo6VF9PUFRJT05BTCk7CisgIH0KKyAgb3V0LmluZGVudF9kb3duKCk7CisgIG91dCA8PCBlbmRsOworICBvdXQuaW5kZW50KCkgPDwgIn0iIDw8IGVuZGwgPDwgZW5kbDsKKworICBvdXQuaW5kZW50KCkgPDwgImRlZiBzdHJ1Y3RfZmllbGRzOyBGSUVMRFM7IGVuZCIgPDwgZW5kbCA8PCBlbmRsOworfQorCit2b2lkIHRfcmJfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9maWVsZF9kYXRhKHRfcmJfb2ZzdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiBmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgZmllbGRfbmFtZSA9ICIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2NvbnN0X3ZhbHVlKiBmaWVsZF92YWx1ZSA9IE5VTEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgb3B0aW9uYWwgPSBmYWxzZSkgeworICBmaWVsZF90eXBlID0gZ2V0X3RydWVfdHlwZShmaWVsZF90eXBlKTsKKworICAvLyBCZWdpbiB0aGlzIGZpZWxkJ3MgZGVmbgorICBvdXQgPDwgIns6dHlwZSA9PiAiIDw8IHR5cGVfdG9fZW51bShmaWVsZF90eXBlKTsKKworICBpZiAoIWZpZWxkX25hbWUuZW1wdHkoKSkgeworICAgIG91dCA8PCAiLCA6bmFtZSA9PiAnIiA8PCBmaWVsZF9uYW1lIDw8ICInIjsKKyAgfQorCisgIGlmIChmaWVsZF92YWx1ZSAhPSBOVUxMKSB7CisgICAgb3V0IDw8ICIsIDpkZWZhdWx0ID0+ICI7CisgICAgcmVuZGVyX2NvbnN0X3ZhbHVlKG91dCwgZmllbGRfdHlwZSwgZmllbGRfdmFsdWUpOworICB9CisKKyAgaWYgKCFmaWVsZF90eXBlLT5pc19iYXNlX3R5cGUoKSkgeworICAgIGlmIChmaWVsZF90eXBlLT5pc19zdHJ1Y3QoKSB8fCBmaWVsZF90eXBlLT5pc194Y2VwdGlvbigpKSB7CisgICAgICBvdXQgPDwgIiwgOmNsYXNzID0+ICIgPDw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b2dyYW0tbGV2ZWwgZ2VuZXJhdGlvbiBmdW5jdGlvbnMKKyAgICovCisKKyAgdm9pZCBnZW5lcmF0ZV90eXBlZGVmKHRfdHlwZWRlZiogdHR5cGVkZWYpOworICB2b2lkIGdlbmVyYXRlX2VudW0odF9lbnVtKiB0ZW51bSk7CisgIHZvaWQgZ2VuZXJhdGVfc3RydWN0KHRfc3RydWN0KiB0c3RydWN0KTsKKyAgdm9pZCBnZW5lcmF0ZV94Y2VwdGlvbih0X3N0cnVjdCogdHhjZXB0aW9uKTsKKyAgdm9pZCBnZW5lcmF0ZV9zZXJ2aWNlKHRfc2VydmljZSogdHNlcnZpY2UpOworCisKKyAgdm9pZCByZW5kZXJfY29uc3RfdmFsdWUob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICB0X3R5cGUqIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHRfY29uc3RfdmFsdWUqIHZhbHVlKTsKKworICB2b2lkIGdlbmVyYXRlX3N3aWZ0X3N0cnVjdChvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3ByaXZhdGUpOworCisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X2luaXQob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgYWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJpdmF0ZSk7CisKKyAgdm9pZCBnZW5lcmF0ZV9zd2lmdF9zdHJ1Y3RfaW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJpdmF0ZSk7CisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X2hhc2hhYmxlX2V4dGVuc2lvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogdHN0cnVjdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJpdmF0ZSk7CisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X2VxdWF0YWJsZV9leHRlbnNpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJpdmF0ZSk7CisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X3RocmlmdF9leHRlbnNpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgaXNfcHJpdmF0ZSk7CisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X3JlYWRlcihvc3RyZWFtJiBvdXQsIHRfc3RydWN0KiB0c3RydWN0LCBib29sIGlzX3ByaXZhdGUpOworCisKKyAgdm9pZCBn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3aWZ0X3NlcnZpY2VfY2xpZW50X3NlbmRfZnVuY3Rpb25faW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXJ2aWNlKiB0c2VydmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfZnVuY3Rpb24qIHRmdW5jdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgbmVlZHNfcHJvdG9jb2wpOworICB2b2lkIGdlbmVyYXRlX3N3aWZ0X3NlcnZpY2VfY2xpZW50X3NlbmRfZnVuY3Rpb25faW52b2NhdGlvbihvc3RyZWFtJiBvdXQsIHRfZnVuY3Rpb24qIHRmdW5jdGlvbik7CisgIHZvaWQgZ2VuZXJhdGVfc3dpZnRfc2VydmljZV9jbGllbnRfc2VuZF9hc3luY19mdW5jdGlvbl9pbnZvY2F0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGZ1bmN0aW9uKTsKKyAgdm9pZCBnZW5lcmF0ZV9zd2lmdF9zZXJ2aWNlX2NsaWVudF9yZWN2X2Z1bmN0aW9uX2ltcGxlbWVudGF0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2VydmljZSogdHNlcnZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICA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luaXQob3V0LCB0c3RydWN0LCBmYWxzZSwgaXNfcHJpdmF0ZSk7CisgIH0KKyAgaWYgKHN0cnVjdF9oYXNfb3B0aW9uYWxfZmllbGRzKHRzdHJ1Y3QpKSB7CisgICAgZ2VuZXJhdGVfc3dpZnRfc3RydWN0X2luaXQob3V0LCB0c3RydWN0LCB0cnVlLCBpc19wcml2YXRlKTsKKyAgfQorCisgIGJsb2NrX2Nsb3NlKG91dCk7CisKKyAgb3V0IDw8IGVuZGw7Cit9CisKKy8qKgorICogR2VuZXJhdGUgc3RydWN0IGluaXQgZm9yIHByb3BlcnRpZXMKKyAqCisgKiBAcGFyYW0gdHN0cnVjdCBUaGUgc3RydWN0dXJlIGRlZmluaXRpb24KKyAqIEBwYXJhbSBhbGwgICAgIEdlbmVyYXRlIGluaXQgd2l0aCBhbGwgb3IganVzdCByZXF1aXJlZCBwcm9wZXJ0aWVzCisgKiBAcGFyYW0gaXNfcHJpdmF0ZQorICogICAgICAgICAgICAgICAgSXMgdGhlIGluaXRpYWxpemVyIHB1YmxpYyBvciBwcml2YXRlCisgKi8KK3ZvaWQgdF9zd2lmdF9nZW5lcmF0b3I6OmdlbmVyYXRlX3N3aWZ0X3N0cnVjdF9pbml0KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBhbGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3ByaXZhdGUpIHsKKworICBzdHJpbmcgdmlzaWJpbGl0eSA9IGlzX3ByaXZhdGUgPyAoZ2VuX2NvY29hXyA/ICJwcml2YXRlIiA6ICJmaWxlcHJpdmF0ZSIpIDogInB1YmxpYyI7CisKKyAgaW5kZW50KG91dCkgPDwgdmlzaWJpbGl0eSA8PC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Ck7CisKKyAgICAgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTspIHsKKyAgICAgICAgdF9maWVsZCogdGZpZWxkID0gKm1faXRlcjsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgIihsaHMuIiA8PCBtYXliZV9lc2NhcGVfaWRlbnRpZmllcih0ZmllbGQtPmdldF9uYW1lKCkpCisgICAgICAgICAgICAgICAgICAgIDw8IChnZW5fY29jb2FfID8gIiA/IiA6ICIgIikgPDwgIj09IHJocy4iIDw8IG1heWJlX2VzY2FwZV9pZGVudGlmaWVyKHRmaWVsZC0+Z2V0X25hbWUoKSkgPDwgIikiOyAvLyBzd2lmdCAyID89PSBvcGVyYXRvciBub3QgaW4gMz8KKyAgICAgICAgaWYgKCsrbV9pdGVyICE9IG1lbWJlcnMuZW5kKCkpIHsKKyAgICAgICAgICBvdXQgPDwgIiAmJiI7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8IGVuZGw7CisgICAgICB9CisgICAgICBpbmRlbnRfZG93bigpOworICAgIH0gZWxzZSB7CisgICAgICBibG9ja19vcGVuKG91dCk7CisgICAgICBpbmRlbnQob3V0KSA8PCAic3dpdGNoIChsaHMsIHJocykgeyIgPDwgZW5kbDsKKyAgICAgIGZvciAobV9pdGVyID0gbWVtYmVycy5iZWdpbigpOyBtX2l0ZXIgIT0gbWVtYmVycy5lbmQoKTsgKyttX2l0ZXIpIHsKKyAgICAgICAgdF9maWVsZCogdGZpZWxkID0gKm1faXRlcjsKKyAgICAgICAgaW5kZW50KG91dCkgPDwgImNhc2UgKC4iIDw8IHRmaWVsZC0+Z2V0X25hbWUoKSA8PCAiKGxldCBsdmFsKSwgLiIKKyAgICAgICAgICAgICAgICAgICAgPDwgdGZpZWxkLT5nZXRfbmFtZSgpIDw8ICIobGV0IHJ2YWwpKTogcmV0dXJuIGx2YWwgPT0gcnZhbCIKKyAgICAgICAgICAgICAgICAgICAgPDwgZW5kbDsKKyAgICAgIH0KKyAgICAgIGluZGVudChvdXQpIDw8ICJkZWZhdWx0OiByZXR1cm4gZmFsc2UiIDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAifSIgPDwgZW5kbDsKKyAgICAgIGluZGVudF9kb3duKCk7CisgICAgICBpbmRlbnQob3V0KSA8PCAifSgpIiA8PCBlbmRsOworICAgIH0KKyAgfQorICBlbHNlIHsKKyAgICBvdXQgPDwgIiB0cnVlIiA8PCBlbmRsOworICB9CisKKyAgYmxvY2tfY2xvc2Uob3V0KTsKKyAgb3V0IDw8IGVuZGw7Cit9CisKKy8qKgorICogR2VuZXJhdGUgc3RydWN0IGltcGxlbWVudGF0aW9uLiBQcm9kdWNlcyBleHRlbnNpb25zIHRoYXQKKyAqIGZ1bGZpbGwgdGhlIHJlcXVpc2l0ZSBwcm90b2NvbHMgdG8gY29tcGxldGUgdGhlIHZhbHVlLgorICoKKyAqIEBwYXJhbSB0c3RydWN0IFRoZSBzdHJ1Y3QgZGVmaW5pdGlvbgorICogQHBhcmFtIGlzX3Jlc3VsdAorICogICAgICAgICAgICAgICAgSWYgdGhpcyBpcyBhIHJlc3VsdCBpdCBuZWVkcyBhIGRpZmZlcmVudCB3cml0ZXIKKyAqIEBwYXJhbSBpc19wcml2YXRlCisgKiAgICAgICAgICAgICAgICBJcyB0aGUgc3RydWN0IHB1YmxpYyBvciBwcml2YXRlCisgKi8KK3ZvaWQgdF9zd2lmdF9nZW5lcmF0b3I6OmdlbmVyYXRlX3N3aWZ0X3N0cnVjdF9pbXBsZW1lbnRhdGlvbihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zdHJ1Y3QqIHRzdHJ1Y3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQsCisgICAgICAgICAgIC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gdF9zd2lmdF9nZW5lcmF0b3I6OmdlbmVyYXRlX3N3aWZ0X3N0cnVjdF90aHJpZnRfZXh0ZW5zaW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc19yZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3ByaXZhdGUpIHsKKworICBpbmRlbnQob3V0KSA8PCAiZXh0ZW5zaW9uICIgPDwgdHN0cnVjdC0+Z2V0X25hbWUoKSA8PCAiIDogVFN0cnVjdCI7CisKKyAgYmxvY2tfb3BlbihvdXQpOworCisgIG91dCA8PCBlbmRsOworICBpZiAoIWdlbl9jb2NvYV8pIHsKKyAgICAvKiogU3dpZnQgMywgbm8gd3JpdGVyIHdlIGp1c3Qgd3JpdGUgZmllbGQgSUQncyAqLworICAgIHN0cmluZyBhY2Nlc3MgPSAoaXNfcHJpdmF0ZSkgPyAoZ2VuX2NvY29hXyA/ICJwcml2YXRlIiA6ICJmaWxlcHJpdmF0ZSIpIDogInB1YmxpYyI7CisgICAgLy8gZ2VuZXJhdGUgZmllbGRJRCdzIGRpY3Rpb25hcnkKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgYWNjZXNzIDw8ICIgc3RhdGljIHZhciBmaWVsZElkczogW1N0cmluZzogSW50MzJdIjsKKyAgICBibG9ja19vcGVuKG91dCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJyZXR1cm4gWyI7CisgICAgY29uc3QgdmVjdG9yPHRfZmllbGQqPiYgZmllbGRzID0gdHN0cnVjdC0+Z2V0X21lbWJlcnMoKTsKKyAgICB2ZWN0b3I8dF9maWVsZCo+Ojpj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F9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k2NDoKKyAgICAgICAgICBwYWRkaW5nID0gIiAgICAgICAgICAgICAiOworICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OiBicmVhazsKKyAgICAgIH0KKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX2VudW0oKSB8fCB0eXBlLT5pc19zZXQoKSB8fCB0eXBlLT5pc19tYXAoKSkgeworICAgICAgcGFkZGluZyA9ICIgICAgICAgICAgICAgIjsKKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKKyAgICAgIHBhZGRpbmcgPSAiICAgICAgICAgICAiOworICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICBwYWRkaW5nID0gIiAgICAgICAgICAgICI7CisgICAgfQorCisgICAgaW5kZW50KG91dCkgPDwgcGFkZGluZyA8PCAicmV0ID0gIiA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICIuIgorICAgICAgICAgICAgICAgIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiKHZhbDogIiA8PCAidHJ5ICIKKyAgICAgICAgICAgICAgICA8PCB0eXBlX25hbWUoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpLCBmYWxzZSwgZmFsc2UpCisgICAgICAgICAgICAgICAgPDwgIi5yZWFkKGZyb206IHByb3RvKSkiIDw8IGVuZGw7CisgIH0KKworICBpbmRlbnQob3V0KSA8PCAiY2FzZSBsZXQgKF8sIHVua25vd25UeXBlKTogIHRyeSBwcm90by5za2lwKHR5cGU6IHVua25vd25UeXBlKSIgPDwgZW5kbDsKKworICBibG9ja19jbG9zZShvdXQpOworICBpbmRlbnQob3V0KSA8PCAidHJ5IHByb3RvLnJlYWRGaWVsZEVuZCgpIiA8PCBlbmRsOworCisgIGJsb2NrX2Nsb3NlKG91dCk7CisgIG91dCA8PCBlbmRsOworCisgIGluZGVudChvdXQpIDw8ICJ0cnkgcHJvdG8ucmVhZFN0cnVjdEVuZCgpIiA8PCBlbmRsOworCisgIGluZGVudChvdXQpIDw8ICJpZiBsZXQgcmV0ID0gcmV0IjsKKyAgYmxvY2tfb3BlbihvdXQpOworICBpbmRlbnQob3V0KSA8PCAicmV0dXJuIHJldCIgPDwgZW5kbDsKKyAgYmxvY2tfY2xvc2Uob3V0KTsKKyAgb3V0IDw8IGVuZGw7CisgIGluZGVudChvdXQpIDw8ICJ0aHJvdyBUUHJvdG9jb2xFcnJvcihlcnJvcjogLnVua25vd24sIG1lc3NhZ2U6IFwiTWlzc2luZyByZXF1aXJlZCB2YWx1ZSBmb3IgdHlwZTogIgorICAgICAgICAgICAgICA8PCB0c3RydWN0LT5nZXRfbmFtZSgpIDw8ICJcIikiOworICBibG9ja19jbG9zZShvdXQpOworICBvdXQgPDwgZW5kbDsKKworfQorCisvKioKKyAqIEdlbmVyYXRlcyBhIGZ1bmN0aW9uIHRvIHJlYWQgYSBzdHJ1Y3QgZnJvbQorICogZnJvbSBhIHByb3RvY29sLiAoVFN0cnVjdCBjb21wbGlhbmNlKQorICoKKyAqIEBwYXJhbSB0c3RydWN0IFRoZSBzdHJ1Y3R1cmUgZGVmaW5pdGlvbgorICogQHBhcmFtIGlzX3ByaXZhdGUKKyAqICAgICAgICAgICAgICAgIElzIHRoZSBzdHJ1Y3QgcHVibGljIG9yIHByaXZhdGUKKyAqLwordm9pZCB0X3N3aWZ0X2dlbmVyYXRvcjo6Z2VuZXJhdGVfc3dpZnRfc3RydWN0X3JlYWRlcihvc3RyZWFtJiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiB0c3RydWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIGlzX3ByaX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lwZTo6VFlQRV9ET1VCTEU6CisgICAgICAgICAgICBwYWRkaW5nID0gIiAgICAgICAgICAgIjsKKyAgICAgICAgICBicmVhazsKKworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfQk9PTDoKKyAgICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICAgICAgcGFkZGluZyA9ICIgICAgICAgICAgICAiOworICAgICAgICAgIGJyZWFrOworICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTE2OgorICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTY0OgorICAgICAgICAgICAgcGFkZGluZyA9ICIgICAgICAgICAgICAgIjsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgICBkZWZhdWx0OiBicmVhazsKKyAgICAgICAgfQorICAgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkgfHwgdHlwZS0+aXNfc2V0KCkgfHwgdHlwZS0+aXNfbWFwKCkpIHsKKyAgICAgICAgcGFkZGluZyA9ICIgICAgICAgICAgICAgIjsKKyAgICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfc3RydWN0KCkgfHwgdHlwZS0+aXNfeGNlcHRpb24oKSkgeworICAgICAgICBwYWRkaW5nID0gIiAgICAgICAgICAgIjsKKyAgICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICAgIHBhZGRpbmcgPSAiICAgICAgICAgICAgIjsKKyAgICAgIH0KKworICAgICAgb3V0IDw8IHBhZGRpbmcgPDwgbWF5YmVfZXNjYXBlX2lkZW50aWZpZXIoKCpmX2l0ZXIpLT5nZXRfbmFtZSgpKSA8PCAiID0gdHJ5ICIKKyAgICAgICAgICA8PCB0eXBlX25hbWUoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpLCBmYWxzZSwgZmFsc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lcmF0b3IgZl9pdGVyOworCisgICAgZm9yIChmX2l0ZXIgPSBmaWVsZHMuYmVnaW4oKTsgZl9pdGVyICE9IGZpZWxkcy5lbmQoKTsgKytmX2l0ZXIpIHsKKyAgICAgIGJvb2wgb3B0aW9uYWwgPSBmaWVsZF9pc19vcHRpb25hbCgqZl9pdGVyKTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJ2YXIgIiA8PCBtYXliZV9lc2NhcGVfaWRlbnRpZmllcigoKmZfaXRlciktPmdldF9uYW1lKCkpIDw8ICIgOiAiCisgICAgICAgICAgICAgICAgICA8PCB0eXBlX25hbWUoKCpmX2l0ZXIpLT5nZXRfdHlwZSgpLCBvcHRpb25hbCwgIW9wdGlvbmFsKSA8PCBlbmRsOworICAgIH0KKworICAgIG91dCA8PCBlbmRsOworCisgICAgLy8gTG9vcCBvdmVyIHJlYWRpbmcgaW4gZmllbGRzCisgICAgaW5kZW50KG91dCkgPDwgImZpZWxkczogd2hpbGUgdHJ1ZSI7CisgICAgYmxvY2tfb3BlbihvdXQpOworICAgIG91dCA8PCBlbmRsOworCisgICAgaW5kZW50KG91dCkgPDwgImxldCAoXywgZmllbGRUeXBlLCBmaWVsZElEKSA9IHRyeSBfX3Byb3RvLnJlYWRGaWVsZEJlZ2luKCkiIDw8IGVuZGwgPDwgZW5kbDsKKyAgICBpbmRlbnQob3V0KSA8PCAic3dpdGNoIChmaWVsZElELCBmaWVsZFR5cGUpIjsKKworICAgIGJsb2NrX29wZW4ob3V0KTsKKworICAgIGluZGVudChvdXQpIDw8ICJjYXNlIChfLCAuU1RPUCk6IiA8PCBlbmRsOworICAgIGluZGVudF91cCgpOworICAgIGluZGVudChvdXQpIDw8ICJicmVhayBmaWVsZHMiIDw8IGVuZGwgPDwgZW5kbDsKKyAgICBpbmRlbnRfZG93bigpOworCisgICAgLy8gR2VuZXJhdGUgZGVzZXJpYWxpemF0aW9uIGNvZGUgZm9yIGtub3duIGNhc2VzCisgICAgZm9yIChmX2l0ZX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luZGVudChvdXQpIDw8ICJzZWxmLnNlcnZpY2UgPSBzZXJ2aWNlIiA8PCBlbmRsOworICBibG9ja19jbG9zZShvdXQpOworICBvdXQgPDwgZW5kbDsKKworICBibG9ja19jbG9zZShvdXQpOworICBvdXQgPDwgZW5kbDsKK30KKworLyoqCisgKiBHZW5lcmF0ZXMgYSBmdW5jdGlvbiB0aGF0IHdpbGwgc2VuZCB0aGUgYXJndW1lbnRzCisgKiBmb3IgYSBzZXJ2aWNlIGZ1bmN0aW9uIHZpYSBhIHByb3RvY29sLgorICoKKyAqIEBwYXJhbSB0c2VydmljZSAgVGhlIHNlcnZpY2UgdG8gZ2VuZXJhdGUKKyAqIEBwYXJhbSB0ZnVuY3Rpb24gVGhlIGZ1bmN0aW9uIHRvIGdlbmVyYXRlCisgKiBAcGFyYW0gbmVlZHNfcHJvdG9jb2wKKyAqICAgICAgICAgICAgICAgICAgV2V0aGVyIHRoZSBmaXJzdCBwYXJhbWV0ZXIgbXVzdCBiZSBhIHByb3RvY29sIG9yIGlmCisgKiAgICAgICAgICAgICAgICAgIHRoZSBwcm90b2NvbCBpcyB0byBiZSBhc3N1bWVkCisgKi8KK3ZvaWQgdF9zd2lmdF9nZW5lcmF0b3I6OmdlbmVyYXRlX3N3aWZ0X3NlcnZpY2VfY2xpZW50X3NlbmRfZnVuY3Rpb25faW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X3NlcnZpY2UgKnRzZXJ2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0X2Z1bmN0aW9uKiB0ZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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ZUVuZCgpIiA8PCBlbmRsOworICB9CisKKyAgYmxvY2tfY2xvc2Uob3V0KTsKKyAgb3V0IDw8IGVuZGw7Cit9CisKKy8qKgorICogR2VuZXJhdGVzIGEgZnVuY3Rpb24gdGhhdCB3aWxsIHJlY3YgdGhlIHJlc3VsdCBmb3IgYQorICogc2VydmljZSBmdW5jdGlvbiB2aWEgYSBwcm90b2NvbC4KKyAqCisgKiBAcGFyYW0gdHNlcnZpY2UgIFRoZSBzZXJ2aWNlIHRvIGdlbmVyYXRlCisgKiBAcGFyYW0gdGZ1bmN0aW9uIFRoZSBmdW5jdGlvbiB0byBnZW5lcmF0ZQorICogQHBhcmFtIG5lZWRzX3Byb3RvY29sCisgKiAgICAgICAgICAgICAgICAgIFdldGhlciB0aGUgZmlyc3QgcGFyYW1ldGVyIG11c3QgYmUgYSBwcm90b2NvbCBvciBpZgorICogICAgICAgICAgICAgICAgICB0aGUgcHJvdG9jb2wgaXMgdG8gYmUgYXNzdW1lZAorICovCit2b2lkIHRfc3dpZnRfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9zd2lmdF9zZXJ2aWNlX2NsaWVudF9yZWN2X2Z1bmN0aW9uX2ltcGxlbWVudGF0aW9uKG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9zZXJ2aWNlKiB0c2VydmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9mdW5jdGlvbiogdGZ1bmN0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG5lZWRzX3Byb3RvY29sKSB7CisKKyAgLy8gT3BlbiBmdW5jdGlvbgorICBpbmRlbnQob3V0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gICAgaW5kZW50X2Rvd24oKTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgIn0gY2F0Y2ggbGV0IGVycm9yIHsiIDw8IGVuZGw7CisgICAgaW5kZW50X3VwKCk7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJjb21wbGV0aW9uKC5lcnJvcihlcnJvcikpIiA8PCBlbmRsOworICAgIGJsb2NrX2Nsb3NlKG91dCk7CisKKyAgICBvdXQgPDwgZW5kbDsKKworICAgIGJvb2wgcmV0X2lzX3ZvaWQgPSAoKmZfaXRlciktPmdldF9yZXR1cm50eXBlKCktPmlzX3ZvaWQoKTsKKyAgICBib29sIGlzX29uZXdheSA9ICgqZl9pdGVyKS0+aXNfb25ld2F5KCk7CisKKyAgICBzdHJpbmcgZXJyb3JfY29tcGxldGlvbl9jYWxsID0gImNvbXBsZXRpb24oLmVycm9yKGVycm9yKSkiOworICAgIGluZGVudChvdXQpIDw8ICJ0cmFuc3BvcnQuZmx1c2giOworICAgIGJsb2NrX29wZW4ob3V0KTsKKyAgICBvdXQgPDwgaW5kZW50KCkgPDwgIih0cmFucywgZXJyb3IpIGluIiA8PCBlbmRsIDw8IGVuZGw7CisgICAgb3V0IDw8IGluZGVudCgpIDw8ICJpZiBsZXQgZXJyb3IgPSBlcnJvciI7CisgICAgYmxvY2tfb3BlbihvdXQpOworICAgIG91dCA8PCBpbmRlbnQoKSA8PCBlcnJvcl9jb21wbGV0aW9uX2NhbGwgPDwgZW5kbDsKKyAgICBibG9ja19jbG9zZShvdXQpOworCisgICAgaWYgKCFpc19vbmV3YXkpIHsKKyAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiZG8iOworICAgICAgYmxvY2tfb3BlbihvdXQpOworICAgICAgaW5kZW50KG91dCk7CisgICAgICBpZiAoIXJldF9pc192b2lkKSB7CisgICAgICAgIG91dCA8PCAibGV0IHJlc3VsdCA9ICI7CisgICAgICB9CisgICAgICBvdXQgPDwgInRyeSBzZWxmLnJlY3ZfIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIihvbjogcHJvdG8pIiA8PCBlbmRsOworCisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgKHJldF9pc192b2lkID8gImNvbXBsZXRpb24oLnN1Y2Nlc3MoVm9pZCgpKSkiIDogImNvbXBsZXRpb24oLnN1Y2Nlc3MocmVzdWx0KSkiKSA8PCBlbmRsOworICAgICAgaW5kZW50X2Rvd24oKTsKKyAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAifSBjYXRjaCBsZXQgZXJyb3IgeyIgPDwgZW5kbDsKKyAgICAgIGluZGVudF91cCgpOworICAgICAgb3V0IDw8IGluZGVudCgpIDw8IGVycm9yX2NvbXBsZXRpb25fY2FsbCA8PCBlbmRsOworCisgICAgICBibG9ja19jbG9zZShvdXQpOworICAgIH0gZWxzZSB7CisgICAgICBvdXQgPDwgaW5kZW50KCkgPDwgImNvbXBsZXRpb24oLnN1Y2Nlc3MoVm9pZCgpKSkiIDw8IGVuZGw7CisgICAgfQorICAgIGJsb2NrX2Nsb3NlKG91dCk7CisgICAgYmxvY2tfY2xvc2Uob3V0KTsKKworICB9CisgIGJsb2NrX2Nsb3NlKG91dCk7CisgIG91dCA8PCBlbmRsOworfQorCit2b2lkIHRfc3dpZnRfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9vbGRfc3dpZnRfc2VydmljZV9jbGllbnRfYXN5bmNfaW1wbGVtZW50YXRpb24ob3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc2VydmljZSogdHNlcnZpY2UpIHsKKworICBzdHJpbmcgbmFtZSA9IHRzZXJ2aWNlLT5nZXRfbmFtZSgpICsgIkFzeW5jQ2xpZW50IjsKKyAgc3RyaW5nIHByb3RvY29sX25hbWUgPSB0c2VydmljZS0+Z2V0X25hbWUoKSArICJBc3luYyI7CisKKyAgaW5kZW50K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Byb3RvY29sRmFjdG9yeS5uZXdQcm90b2NvbE9uVHJhbnNwb3J0KF9fdHJhbnNwb3J0KSIgPDwgZW5kbAorICAgICAgICA8PCBlbmRsOworCisgICAgZ2VuZXJhdGVfc3dpZnRfc2VydmljZV9jbGllbnRfc2VuZF9hc3luY19mdW5jdGlvbl9pbnZvY2F0aW9uKG91dCwgKmZfaXRlcik7CisgICAgb3V0IDw8IGVuZGw7CisKKyAgICBpbmRlbnQob3V0KSA8PCAiX190cmFuc3BvcnQuZmx1c2hXaXRoQ29tcGxldGlvbigiOworCisgICAgaWYgKCgqZl9pdGVyKS0+aXNfb25ld2F5KCkpIHsKKyAgICAgIG91dCA8PCAic3VjY2VzcywgZmFpbHVyZTogZmFpbHVyZSkiIDw8IGVuZGw7CisgICAgfQorICAgIGVsc2UgeworICAgICAgYmxvY2tfb3BlbihvdXQpOworICAgICAgaW5kZW50KG91dCkgPDwgImRvIjsKKyAgICAgIGJsb2NrX29wZW4ob3V0KTsKKworICAgICAgaW5kZW50KG91dCk7CisgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgIG91dCA8PCAibGV0IHJlc3VsdCA9ICI7CisgICAgICB9CisgICAgICBvdXQgPDwgInRyeSBzZWxmLnJlY3ZfIiA8PCAoKmZfaXRlciktPmdldF9uYW1lKCkgPDwgIihfX3Byb3RvY29sKSIgPDwgZW5kbDsKKworICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJzdWNjZXNzKCI7CisgICAgICBpZiAoISgqZl9pdGVyKS0+Z2V0X3JldHVybnR5cGUoKS0+aXNfdm9pZCgpKSB7CisgICAgICAgIG91dCA8PCAicmVzdWx0IjsKKyAgICAgIH0KKyAgICAgIG91dCA8PCAiKSIgPDwgZW5kbDsKKworICAgICAgYmxvY2tfY2xvc2Uob3V0KTsKKyAgICAgIGluZGVudChvdXQpIDw8ICJjYXRjaCBsZXQgZXJyb3IiOworICAg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IpOworICAgICAgb3V0IDw8IGVuZGw7CisgICAgICBpbmRlbnQob3V0KSA8PCAiX190cmFuc3BvcnQuZmx1c2hXaXRoQ29tcGxldGlvbigiOworCisgICAgICBpZiAoKCpmX2l0ZXIpLT5pc19vbmV3YXkoKSkgeworICAgICAgICBvdXQgPDwgInsgX19mdWxmaWxsKCkgfSwgZmFpbHVyZTogeyBfX3JlamVjdCgkMCkgfSkiIDw8IGVuZGw7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgYmxvY2tfb3BlbihvdXQpOworICAgICAgICBpbmRlbnQob3V0KSA8PCAiZG8iOworICAgICAgICBibG9ja19vcGVuKG91dCk7CisKKyAgICAgICAgaW5kZW50KG91dCk7CisgICAgICAgIGlmICghKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpIHsKKyAgICAgICAgICBvdXQgPDwgImxldCByZXN1bHQgPSAiOworICAgICAgICB9CisgICAgICAgIG91dCA8PCAidHJ5IHNlbGYucmVjdl8iIDw8ICgqZl9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiKF9fcHJvdG9jb2wpIiA8PCBlbmRsOworCisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAiX19mdWxmaWxsKCI7CisgICAgICAgIGlmICghKCpmX2l0ZXIpLT5nZXRfcmV0dXJudHlwZSgpLT5pc192b2lkKCkpIHsKKyAgICAgICAgICBvdXQgPDwgInJlc3VsdCI7CisgICAgICAgIH0KKyAgICAgICAgb3V0IDw8ICIpIiA8PCBlbmRsOworCisgICAgICAgIGJsb2NrX2Nsb3NlKG91dCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJjYXRjaCBsZXQgZXJyb3IiOworICAgICAgICBibG9ja19vcGVuKG91dCk7CisgICAgICAgIGluZGVudChvdXQpIDw8ICJfX3JlamVjdChlcnJvcikiIDw8IGVuZGw7CisgICAgICAgIGJsb2NrX2Nsb3NlKG91dCk7CisgICAgICAgIGJsb2NrX2N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Rpb24tPmlzX29uZXdheSgpKSB7CisgICAgICAgICAgb3V0IDw8IGluZGVudCgpIDw8ICJ0cnkgb3V0UHJvdG9jb2wud3JpdGVNZXNzYWdlQmVnaW4obmFtZTogXCIiIDw8IHRmdW5jdGlvbi0+Z2V0X25hbWUoKSA8PCAiXCIsIHR5cGU6IC5yZXBseSwgc2VxdWVuY2VJRDogc2VxdWVuY2VJRCkiIDw8IGVuZGwKKyAgICAgICAgICAgICAgPDwgaW5kZW50KCkgPDwgInRyeSByZXN1bHQud3JpdGUodG86IG91dFByb3RvY29sKSIgPDwgZW5kbAorICAgICAgICAgICAgICA8PCBpbmRlbnQoKSA8PCAidHJ5IG91dFByb3RvY29sLndyaXRlTWVzc2FnZUVuZCgpIiA8PCBlbmRsOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICBmb3IgKHhfaXRlciA9IHhmaWVsZHMuYmVnaW4oKTsgeF9pdGVyICE9IHhmaWVsZHMuZW5kKCk7ICsreF9pdGVyKSB7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgImNhdGNoIGxldCBlcnJvciBhcyAiIDw8ICgqeF9pdGVyKS0+Z2V0X3R5cGUoKS0+Z2V0X25hbWUoKTsKKyAgICAgICAgICBibG9ja19vcGVuKG91dCk7CisgICAgICAgICAgaW5kZW50KG91dCkgPDwgInJlc3VsdC4iIDw8ICgqeF9pdGVyKS0+Z2V0X25hbWUoKSA8PCAiID0gZXJyb3IiIDw8IGVuZGw7CisgICAgICAgICAgYmxvY2tfY2xvc2Uob3V0KTsKKyAgICAgICAgfQorCisgICAgICAgIGluZGVudChvdXQpIDw8ICJjYXRjaCBsZXQgZXJyb3IiOworICAgICAgICBibG9ja19vcGVuKG91dCk7CisgICAgICAgIG91dCA8PCBpbmRlbnQoKSA8PCAidGhyb3cgZXJyb3IiIDw8IGVuZGw7CisgICAgICAgIGJsb2NrX2Nsb3NlKG91dCk7CisKKyAgICAgICAgb3V0IDw8IGVuZGw7CisKKyAgICAgIC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PTDoKKyAgICAgICAgICByZXR1cm4gcmVzdWx0ICsgImJvb2wiOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0k4OgorICAgICAgICAgIHJldHVybiByZXN1bHQgKyAiaTgiOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0kxNjoKKyAgICAgICAgICByZXR1cm4gcmVzdWx0ICsgImkxNiI7CisgICAgICAgIGNhc2UgdF9iYXNlX3R5cGU6OlRZUEVfSTMyOgorICAgICAgICAgIHJldHVybiByZXN1bHQgKyAiaTMyIjsKKyAgICAgICAgY2FzZSB0X2Jhc2VfdHlwZTo6VFlQRV9JNjQ6CisgICAgICAgICAgcmV0dXJuIHJlc3VsdCArICJpNjQiOworICAgICAgICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFX0RPVUJMRToKKyAgICAgICAgICByZXR1cm4gcmVzdWx0ICsgImRvdWJsZSI7CisgICAgICB9CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19lbnVtKCkpIHsKKyAgICAgIHJldHVybiByZXN1bHQgKyAiaTMyIjsKKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX3N0cnVjdCgpIHx8IHR5cGUtPmlzX3hjZXB0aW9uKCkpIHsKKyAgICAgIHJldHVybiByZXN1bHQgKyAic3RydWN0IjsKKyAgICB9IGVsc2UgaWYgKHR5cGUtPmlzX21hcCgpKSB7CisgICAgICByZXR1cm4gcmVzdWx0ICsgIm1hcCI7CisgICAgfSBlbHNlIGlmICh0eXBlLT5pc19zZXQoKSkgeworICAgICAgcmV0dXJuIHJlc3VsdCArICJzZXQiOworICAgIH0gZWxzZSBpZiAodHlwZS0+aXNfbGlzdCgpKSB7CisgICAgICByZXR1cm4gcmVzdWx0ICsgImxpc3QiOworICAgIH0KKyAgfSBlbHNlIHsKKyAgICBpZiAodHlwZS0+aXNfYmFzZV90eXBlKCkpIHsKKyAgICAgIHRfYmFzZV90eXBlOjp0X2Jhc2UgdGJhc2UgPSAoKH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W5nLCBzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yIGl0ZXI7CisKKyAgICAvKiBubyBvcHRpb25zIHlldCAqLworICAgIGZvciggaXRlciA9IHBhcnNlZF9vcHRpb25zLmJlZ2luKCk7IGl0ZXIgIT0gcGFyc2VkX29wdGlvbnMuZW5kKCk7ICsraXRlcikgeworICAgICAgdGhyb3cgInVua25vd24gb3B0aW9uIHhzZDoiICsgaXRlci0+Zmlyc3Q7CisgICAgfQorCisgICAgb3V0X2Rpcl9iYXNlXyA9ICJnZW4teHNkIjsKKyAgfQorCisgIHZpcnR1YWwgfnRfeHNkX2dlbmVyYXRvcigpIHt9CisKKyAgLyoqCisgICAqIEluaXQgYW5kIGNsb3NlIG1ldGhvZHMKKyAgICovCisKKyAgdm9pZCBpbml0X2dlbmVyYXRvcigpOworICB2b2lkIGNsb3NlX2dlbmVyYXRvcigpOworCisgIC8qKgorICAgKiBQcm9ncmFtLWxldmVsIGdlbmVyYXRpb24gZnVuY3Rpb25zCisgICAqLworCisgIHZvaWQgZ2VuZXJhdGVfdHlwZWRlZih0X3R5cGVkZWYqIHR0eXBlZGVmKTsKKyAgdm9pZCBnZW5lcmF0ZV9lbnVtKHRfZW51bSogdGVudW0pIHsgKHZvaWQpdGVudW07IH0KKworICB2b2lkIGdlbmVyYXRlX3NlcnZpY2UodF9zZXJ2aWNlKiB0c2VydmljZSk7CisgIHZvaWQgZ2VuZXJhdGVfc3RydWN0KHRfc3RydWN0KiB0c3RydWN0KTsKKworcHJpdmF0ZToKKyAgdm9pZCBnZW5lcmF0ZV9lbGVtZW50KHN0ZDo6b3N0cmVhbSYgb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRfdHlwZSogdHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICB0X3N0cnVjdCogYXR0cnMgPSBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAg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gIH0gZWxzZSB7CisgICAgaW5kZW50KHNfeHNkX3R5cGVzXykgPDwgIjwveHNkOnNlcXVlbmNlPiIgPDwgZW5kbDsKKyAgfQorICBpbmRlbnRfZG93bigpOworICBpbmRlbnQoc194c2RfdHlwZXNfKSA8PCAiPC94c2Q6Y29tcGxleFR5cGU+IiA8PCBlbmRsIDw8IGVuZGw7Cit9CisKK3ZvaWQgdF94c2RfZ2VuZXJhdG9yOjpnZW5lcmF0ZV9lbGVtZW50KG9zdHJlYW0mIG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF90eXBlKiB0dHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRfc3RydWN0KiBhdHRycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgb3B0aW9uYWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sIG5pbGxhYmxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBsaXN0X2VsZW1lbnQpIHsKKyAgc3RyaW5nIHNtaW5PY2N1cnMgPSAob3B0aW9uYWwgfHwgbGlzdF9lbGVtZW50KSA/ICIgbWluT2NjdXJzPVwiMFwiIiA6ICIiOworICBzdHJpbmcgc21heE9jY3VycyA9IGxpc3RfZWxlbWVudCA/ICIgbWF4T2NjdXJzPVwidW5ib3VuZGVkXCIiIDogIiI7CisgIHN0cmluZyBzb3B0aW9uYWwgPSBzbWluT2NjdXJzICsgc21heE9jY3VyczsKKyAgc3RyaW5nIHNuaWxsYWJsZSA9IG5pbGxhYmxlID8gIiBuaWxsYWJsZT1cInRydWVcIiIgOiAiIjsKKworICBpZiAodHR5cGUtPmlzX3ZvaWQoKSB8fCB0dHlwZS0+aXNfbGlzdCgpKSB7CisgICAgaW5kZW50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NlYXJjaCBwYXRoIGZvciBpbmNsdXNpb25zCisgKi8KK3ZlY3RvcjxzdHJpbmc+IGdfaW5jbF9zZWFyY2hwYXRoOworCisvKioKKyAqIEdsb2JhbCBkZWJ1ZyBzdGF0ZQorICovCitpbnQgZ19kZWJ1ZyA9IDA7CisKKy8qKgorICogU3RyaWN0bmVzcyBsZXZlbAorICovCitpbnQgZ19zdHJpY3QgPSAxMjc7CisKKy8qKgorICogV2FybmluZyBsZXZlbAorICovCitpbnQgZ193YXJuID0gMTsKKworLyoqCisgKiBWZXJib3NlIG91dHB1dAorICovCitpbnQgZ192ZXJib3NlID0gMDsKKworLyoqCisgKiBHbG9iYWwgdGltZSBzdHJpbmcKKyAqLworY2hhciogZ190aW1lX3N0cjsKKworLyoqCisgKiBUaGUgbGFzdCBwYXJzZWQgZG9jdGV4dCBjb21tZW50LgorICovCitjaGFyKiBnX2RvY3RleHQ7CisKKy8qKgorICogVGhlIEZpcnN0IGRvY3RleHQgY29tbWVudAorICovCitjaGFyKiBnX3Byb2dyYW1fZG9jdGV4dF9jYW5kaWRhdGU7CisKKy8qKgorICogV2hldGhlciBvciBub3QgbmVnYXRpdmUgZmllbGQga2V5cyBhcmUgYWNjZXB0ZWQuCisgKi8KK2ludCBnX2FsbG93X25lZ19maWVsZF9rZXlzOworCisvKioKKyAqIFdoZXRoZXIgb3Igbm90IDY0LWJpdCBjb25zdGFudHMgd2lsbCBnZW5lcmF0ZSBhIHdhcm5pbmcuCisgKi8KK2ludCBnX2FsbG93XzY0Yml0X2NvbnN0cyA9IDA7CisKKy8qKgorICogRmxhZ3MgdG8gY29udHJvbCBjb2RlIGdlbmVyYXRpb24KKyAqLworYm9vbCBnZW5fcmVjdXJzZSA9IGZhbHNlOworCisvKioKKyAqIEZsYWdzIHRvIGNvbnRyb2wgdGhyaWZ0IGF1ZGl0CisgKi8KK2Jvb2wgZ19hdWRpdCA9IGZhbHNlOworCisvKioKKyAqIEZsYWcgdG8gY29udHJvbCByZXR1cm4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YXRoW2ldID0gJy8nOworICAgIH0KKyAgfQorICByZXR1cm4gcmVzb2x2ZWRfcGF0aDsKKyNlbHNlCisgIHJldHVybiByZWFscGF0aChwYXRoLCByZXNvbHZlZF9wYXRoKTsKKyNlbmRpZgorfQorCitib29sIGNoZWNrX2lzX2RpcmVjdG9yeShjb25zdCBjaGFyKiBkaXJfbmFtZSkgeworI2lmZGVmIF9XSU4zMgorICBEV09SRCBhdHRyaWJ1dGVzID0gOjpHZXRGaWxlQXR0cmlidXRlc0EoZGlyX25hbWUpOworICBpZiAoYXR0cmlidXRlcyA9PSBJTlZBTElEX0ZJTEVfQVRUUklCVVRFUykgeworICAgIGZwcmludGYoc3RkZXJyLAorICAgICAgICAgICAgIk91dHB1dCBkaXJlY3RvcnkgJXMgaXMgdW51c2FibGU6IEdldExhc3RFcnJvcigpID0gJWxkXG4iLAorICAgICAgICAgICAgZGlyX25hbWUsCisgICAgICAgICAgICBHZXRMYXN0RXJyb3IoKSk7CisgICAgcmV0dXJuIGZhbHNlOworICB9CisgIGlmICgoYXR0cmlidXRlcyAmIEZJTEVfQVRUUklCVVRFX0RJUkVDVE9SWSkgIT0gRklMRV9BVFRSSUJVVEVfRElSRUNUT1JZKSB7CisgICAgZnByaW50ZihzdGRlcnIsICJPdXRwdXQgZGlyZWN0b3J5ICVzIGV4aXN0cyBidXQgaXMgbm90IGEgZGlyZWN0b3J5XG4iLCBkaXJfbmFtZSk7CisgICAgcmV0dXJuIGZhbHNlOworICB9CisgIHJldHVybiB0cnVlOworI2Vsc2UKKyAgc3RydWN0IHN0YXQgc2I7CisgIGlmIChzdGF0KGRpcl9uYW1lLCAmc2IpIDwgMCkgeworICAgIGZwcmludGYoc3RkZXJyLCAiT3V0cHV0IGRpcmVjdG9yeSAlcyBpcyB1bnVzYWJsZTogJXNcbiIsIGRpcl9uYW1lLCBzdHJlcnJvcihlcnJubykpOworICAgIHJldHVybiBmYWxzZTsKKyAgfQorICBpZiAoIVNfSVNESVIoc2Iuc3R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KKyAgdmVjdG9yPHN0cmluZz46Oml0ZXJhdG9yIGxfaXRlcjsKKyAgZm9yIChsX2l0ZXIgPSBsaW5lcy5iZWdpbigpICsgMTsgbF9pdGVyICE9IGxpbmVzLmVuZCgpOyArK2xfaXRlcikgeworICAgIGlmIChsX2l0ZXItPmVtcHR5KCkpIHsKKyAgICAgIGNvbnRpbnVlOworICAgIH0KKworICAgIHBvcyA9IGxfaXRlci0+ZmluZF9maXJzdF9ub3Rfb2YoIiBcdCIpOworICAgIGlmICghZm91bmRfcHJlZml4KSB7CisgICAgICBpZiAocG9zICE9IHN0cmluZzo6bnBvcykgeworICAgICAgICBpZiAobF9pdGVyLT5hdChwb3MpID09ICcqJykgeworICAgICAgICAgIGZvdW5kX3ByZWZpeCA9IHRydWU7CisgICAgICAgICAgcHJlZml4X2xlbiA9IHBvczsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBoYXZlX3ByZWZpeCA9IGZhbHNlOworICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICB9IGVsc2UgeworICAgICAgICAvLyBXaGl0ZXNwYWNlLW9ubHkgbGluZS4gIFRydW5jYXRlIGl0LgorICAgICAgICBsX2l0ZXItPmNsZWFyKCk7CisgICAgICB9CisgICAgfSBlbHNlIGlmIChsX2l0ZXItPnNpemUoKSA+IHBvcyAmJiBsX2l0ZXItPmF0KHBvcykgPT0gJyonICYmIHBvcyA9PSBwcmVmaXhfbGVuKSB7CisgICAgICAvLyBCdXNpbmVzcyBhcyB1c3VhbC4KKyAgICB9IGVsc2UgaWYgKHBvcyA9PSBzdHJpbmc6Om5wb3MpIHsKKyAgICAgIC8vIFdoaXRlc3BhY2Utb25seSBsaW5lLiAgTGV0J3MgdHJ1bmNhdGUgaXQgZm9yIHRoZW0uCisgICAgICBsX2l0ZXItPmNsZWFyKCk7CisgICAgfSBlbHNlIHsKKyAgICAgIC8vIFRoZSBwYXR0ZXJuIGhhcyBiZWVuIGJyb2tlbi4KKyAgICAgIGh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SIpID09IDApIHsKKyAgICAgICAgZ192ZXJib3NlID0gMTsKKyAgICAgIH0gZWxzZSBpZiAoc3RyY21wKGFyZywgIi1yIikgPT0gMCB8fCBzdHJjbXAoYXJnLCAiLXJlY3Vyc2UiKSA9PSAwKSB7CisgICAgICAgIGdlbl9yZWN1cnNlID0gdHJ1ZTsKKyAgICAgIH0gZWxzZSBpZiAoc3RyY21wKGFyZywgIi1hbGxvdy1uZWcta2V5cyIpID09IDApIHsKKyAgICAgICAgZ19hbGxvd19uZWdfZmllbGRfa2V5cyA9IHRydWU7CisgICAgICB9IGVsc2UgaWYgKHN0cmNtcChhcmcsICItYWxsb3ctNjRiaXQtY29uc3RzIikgPT0gMCkgeworICAgICAgICBnX2FsbG93XzY0Yml0X2NvbnN0cyA9IHRydWU7CisgICAgICB9IGVsc2UgaWYgKHN0cmNtcChhcmcsICItZ2VuIikgPT0gMCkgeworICAgICAgICBhcmcgPSBhcmd2WysraV07CisgICAgICAgIGlmIChhcmcgPT0gTlVMTCkgeworICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiTWlzc2luZyBnZW5lcmF0b3Igc3BlY2lmaWNhdGlvblxuIik7CisgICAgICAgICAgdXNhZ2UoKTsKKyAgICAgICAgfQorICAgICAgICBnZW5lcmF0b3Jfc3RyaW5ncy5wdXNoX2JhY2soYXJnKTsKKyAgICAgIH0gZWxzZSBpZiAoc3RyY21wKGFyZywgIi1JIikgPT0gMCkgeworICAgICAgICAvLyBBbiBhcmd1bWVudCBvZiAiLUlcIGFzZGYiIGlzIGludmFsaWQgYW5kIGhhcyB1bmtub3duIHJlc3VsdHMKKyAgICAgICAgYXJnID0gYXJndlsrK2ldOworCisgICAgICAgIGlmIChhcmcgPT0gTlVMTCkgeworICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiTWlzc2luZyBJbmNsdWRlIGRpcmVjdG9yeVxuIik7CisgICAgICAgICAgdXNhZ2UoKTsKKyAgICAgICAgfQorICAgICAgICBnX2luY2xfc2VhcmNocGF0aC5wdXNoX2JhY2soYXJnKTsKKyAgICAgIH0gZWxzZSBpZiAoKHN0cmNtcChhcmcsICItbyIpID09IDApIHx8IChzdHJjbXAoYXJnLCAiLW91dCIpID09IDApKSB7CisgICAgICAgIG91dF9wYXRoX2lzX2Fic29sdXRlID0gKHN0cmNtcChhcmcsICItb3V0IikgPT0gMCkgPyB0cnVlIDogZmFsc2U7CisgICAgICAgIGFyZyA9IGFyZ3ZbKytpXTsKKyAgICAgICAgaWYgKGFyZyA9PSBOVUxMKSB7CisgICAgICAgICAgZnByaW50ZihzdGRlcnIsICItbzogbWlzc2luZyBvdXRwdXQgZGlyZWN0b3J5XG4iKTsKKyAgICAgICAgICB1c2FnZSgpOworICAgICAgICB9CisgICAgICAgIG91dF9wYXRoID0gYXJnOworCisjaWZkZWYgX1dJTjMyCisgICAgICAgIC8vIHN0cmlwIG91dCB0cmFpbGluZyBcIG9uIFdpbmRvd3MKKyAgICAgICAgc3RkOjpzdHJpbmc6OnNpemVfdHlwZSBsYXN0ID0gb3V0X3BhdGgubGVuZ3RoKCkgLSAxOworICAgICAgICBpZiAob3V0X3BhdGhbbGFzdF0gPT0gJ1xcJykgeworICAgICAgICAgIG91dF9wYXRoLmVyYXNlKGxhc3QpOworICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgaWYgKCFjaGVja19pc19kaXJlY3Rvcnkob3V0X3BhdGguY19zdHIoKSkpCisgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgfSBlbHNlIGlmIChzdHJjbXAoYXJnLCAiLWF1ZGl0IikgPT0gMCkgeworICAgICAgICBnX2F1ZGl0ID0gdHJ1ZTsKKyAgICAgICAgYXJnID0gYXJndlsrK2ldOworICAgICAgICBpZiAoYXJnID09IE5VTEwpIHsKKyAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIk1pc3Npbmcgb2xkIHRocmlmdCBmaWxlIG5hbWUgZm9yIGF1ZGl0IG9wZXJhdGlvblxuIik7CisgICAgICAgICAgdXN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ICAgICAgICAgIHVzYWdlKCk7CisgICAgICAgIH0KKyAgICAgICAgbmV3X3RocmlmdF9pbmNsdWRlX3BhdGggPSBzdHJpbmcoYXJnKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiVW5yZWNvZ25pemVkIG9wdGlvbjogJXNcbiIsIGFyZyk7CisgICAgICAgIHVzYWdlKCk7CisgICAgICB9CisKKyAgICAgIC8vIFRva2VuaXplIG1vcmUKKyAgICAgIGFyZyA9IHN0cnRvayhOVUxMLCAiICIpOworICAgIH0KKyAgfQorCisgIC8vIGRpc3BsYXkgaGVscAorICBpZiAoKHN0cmNtcChhcmd2W2FyZ2MgLSAxXSwgIi1oZWxwIikgPT0gMCkgfHwgKHN0cmNtcChhcmd2W2FyZ2MgLSAxXSwgIi0taGVscCIpID09IDApKSB7CisgICAgaGVscCgpOworICB9CisKKyAgLy8gaWYgeW91J3JlIGFza2luZyBmb3IgdmVyc2lvbiwgeW91IGhhdmUgYSByaWdodCBub3QgdG8gcGFzcyBhIGZpbGUKKyAgaWYgKChzdHJjbXAoYXJndlthcmdjIC0gMV0sICItdmVyc2lvbiIpID09IDApIHx8IChzdHJjbXAoYXJndlthcmdjIC0gMV0sICItLXZlcnNpb24iKSA9PSAwKSkgeworICAgIHZlcnNpb24oKTsKKyAgICBleGl0KDApOworICB9CisKKyAgLy8gSW5pdGlhbGl6ZSBnbG9iYWwgdHlwZXMKKyAgaW5pdEdsb2JhbHMoKTsKKworICBpZiAoZ19hdWRpdCkgeworICAgIC8vIEF1ZGl0IG9wZXJhdGlvbgorCisgICAgaWYgKG9sZF9pbnB1dF9maWxlLmVtcHR5KCkpIHsKKyAgICAgIGZwcmludGYoc3RkZXJyLCAiTWlzc2luZyBmaWxlIG5hbWUgb2Ygb2xkIHRocmlmdCBmaWxlIGZvciBhdWRpdFxuIik7CisgICAgICB1c2FnZSgpOworICAgIH0KKworICAgIGNoYXIgbmV3X3RocmlmdF9maWxlX3JwW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gICAgIGJyZWFrOworICAgIGNhc2UgVFlQRV9TVFJJTkc6CisgICAgICByZXR1cm4gInN0cmluZyI7CisgICAgICBicmVhazsKKyAgICBjYXNlIFRZUEVfQk9PTDoKKyAgICAgIHJldHVybiAiYm9vbCI7CisgICAgICBicmVhazsKKyAgICBjYXNlIFRZUEVfSTg6CisgICAgICByZXR1cm4gImk4IjsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVFlQRV9JMTY6CisgICAgICByZXR1cm4gImkxNiI7CisgICAgICBicmVhazsKKyAgICBjYXNlIFRZUEVfSTMyOgorICAgICAgcmV0dXJuICJpMzIiOworICAgICAgYnJlYWs7CisgICAgY2FzZSBUWVBFX0k2NDoKKyAgICAgIHJldHVybiAiaTY0IjsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVFlQRV9ET1VCTEU6CisgICAgICByZXR1cm4gImRvdWJsZSI7CisgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgcmV0dXJuICIodW5rbm93bikiOworICAgICAgYnJlYWs7CisgICAgfQorICB9CisKK3ByaXZhdGU6CisgIHRfYmFzZSBiYXNlXzsKKworICBib29sIHN0cmluZ19saXN0XzsKKyAgYm9vbCBiaW5hcnlfOworICBib29sIHN0cmluZ19lbnVtXzsKKyAgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IHN0cmluZ19lbnVtX3ZhbHNfOworfTsKKworI2VuZGlmCmRpZmYgLS1naXQgYS9jb21waWxlci9jcHAvc3JjL3RocmlmdC9wYXJzZS90X2NvbnN0LmggYi9jb21waWxlci9jcHAvc3JjL3RocmlmdC9wYXJzZS90X2NvbnN0LmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uM2MwOGUwZAotLS0gL2Rldi9udWxsCisrKyBiL2NvbXBpbGVyL2NwcC9zcmMvdGhyaWZ0L3BhcnNlL3RfY29uc3QuaApAQCAtMCwwICsxLDUwIEBACisvKgorICogTGljZW5zZWQgdG8gd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yB1bnF1YWxpZmllZCEiOworICAgIH0KKyAgICByZXQgPSByZXQuc3Vic3RyKHMgKyAxKTsKKyAgICBzID0gcmV0LmZpbmQoJy4nKTsKKyAgICBpZiAocyAhPSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgcmV0ID0gcmV0LnN1YnN0cihzICsgMSk7CisgICAgfQorICAgIHJldHVybiByZXQ7CisgIH0KKworICBzdGQ6OnN0cmluZyBnZXRfaWRlbnRpZmllcl93aXRoX3BhcmVudCgpIGNvbnN0IHsKKyAgICBzdGQ6OnN0cmluZyByZXQgPSBnZXRfaWRlbnRpZmllcigpOworICAgIHNpemVfdCBzID0gcmV0LmZpbmQoJy4nKTsKKyAgICBpZiAocyA9PSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgdGhyb3cgImVycm9yOiBpZGVudGlmaWVyICIgKyByZXQgKyAiIGlzIHVucXVhbGlmaWVkISI7CisgICAgfQorICAgIHNpemVfdCBzMiA9IHJldC5maW5kKCcuJywgcyArIDEpOworICAgIGlmIChzMiAhPSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgcmV0ID0gcmV0LnN1YnN0cihzICsgMSk7CisgICAgfQorICAgIHJldHVybiByZXQ7CisgIH0KKworICB2b2lkIHNldF9lbnVtKHRfZW51bSogdGVudW0pIHsgZW51bV8gPSB0ZW51bTsgfQorCisgIHRfY29uc3RfdmFsdWVfdHlwZSBnZXRfdHlwZSgpIGNvbnN0IHsgaWYgKHZhbFR5cGVfID09IENWX1VOS05PV04pIHsgdGhyb3cgc3RkOjpzdHJpbmcoInVua25vd24gdF9jb25zdF92YWx1ZSIpOyB9IHJldHVybiB2YWxUeXBlXzsgfQorCisgIC8qKgorICAgKiBDb21wYXJhdG9yIHRvIHNvcnQgbWFwIGZpZWxkcyBpbiBhc2NlbmRpbmcgb3JkZXIgYnkga2V5IGFuZCB0aGVuIHZhbHVlLgorICAgKiBUaGlzIGlzIHVzZWQgZm9yIG1hcCBjb21wYXJpc29uIGluIGxleGljb2dyYXBoaWMgb3JkZXIuCisgICAqLworICBzdHJ1Y3QgbWFwX2VudHJ5X2NvbXBhcmUgeworICBwcml2YXRlOgorICAgIHR5cGVkZWYgc3RkOjpwYWlyPHRfY29uc3RfdmFsdWUqLCB0X2NvbnN0X3ZhbHVlKj4gQ29uc3RQYWlyOworICBwdWJsaWM6CisgICAgYm9vbCBvcGVyYXRvcigpKENvbnN0UGFpciBsZWZ0LCBDb25zdFBhaXIgcmlnaHQpIGNvbnN0IHsKKyAgICAgIGlmICgqKGxlZnQuZmlyc3QpIDwgKihyaWdodC5maXJzdCkpIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICB9IGVsc2UgeworICAgICAgICBpZiAoKihyaWdodC5maXJzdCkgPCAqKGxlZnQuZmlyc3QpKSB7CisgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHJldHVybiAqKGxlZnQuc2Vjb25kKSA8ICoocmlnaHQuc2Vjb25kKTsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgfTsKKworICBib29sIG9wZXJhdG9yIDwgKGNvbnN0IHRfY29uc3RfdmFsdWUmIHRoYXQpIGNvbnN0IHsKKyAgICA6OnRfY29uc3RfdmFsdWU6OnRfY29uc3RfdmFsdWVfdHlwZSB0MSA9IGdldF90eXBlKCk7CisgICAgOjp0X2NvbnN0X3ZhbHVlOjp0X2NvbnN0X3ZhbHVlX3R5cGUgdDIgPSB0aGF0LmdldF90eXBlKCk7CisgICAgaWYgKHQxICE9IHQyKQorICAgICAgcmV0dXJuIHQxIDwgdDI7CisgICAgc3dpdGNoICh0MSkgeworICAgIGNhc2UgOjp0X2NvbnN0X3ZhbHVlOjpDVl9JTlRFR0VSOgorICAgICAgcmV0dXJuIGludFZhbF8gPCB0aGF0LmludFZhbF87CisgICAgY2FzZSA6OnRfY29uc3RfdmFsdWU6OkNWX0RPVUJMRToKKyAgICAgIHJldHVybiBkb3VibG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UpLAorICAgICAgb25ld2F5XyhvbmV3YXkpIHsKKyAgICBpZiAob25ld2F5XyAmJiAoIXJldHVybnR5cGVfLT5pc192b2lkKCkpKSB7CisgICAgICBwd2FybmluZygxLCAiT25ld2F5IG1ldGhvZHMgc2hvdWxkIHJldHVybiB2b2lkLlxuIik7CisgICAgfQorICB9CisKKyAgdF9mdW5jdGlvbih0X3R5cGUqIHJldHVybnR5cGUsCisgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSwKKyAgICAgICAgICAgICB0X3N0cnVjdCogYXJnbGlzdCwKKyAgICAgICAgICAgICB0X3N0cnVjdCogeGNlcHRpb25zLAorICAgICAgICAgICAgIGJvb2wgb25ld2F5ID0gZmFsc2UpCisgICAgOiByZXR1cm50eXBlXyhyZXR1cm50eXBlKSwKKyAgICAgIG5hbWVfKG5hbWUpLAorICAgICAgYXJnbGlzdF8oYXJnbGlzdCksCisgICAgICB4Y2VwdGlvbnNfKHhjZXB0aW9ucyksCisgICAgICBvd25feGNlcHRpb25zXyhmYWxzZSksCisgICAgICBvbmV3YXlfKG9uZXdheSkgeworICAgIGlmIChvbmV3YXlfICYmICF4Y2VwdGlvbnNfLT5nZXRfbWVtYmVycygpLmVtcHR5KCkpIHsKKyAgICAgIHRocm93IHN0ZDo6c3RyaW5nKCJPbmV3YXkgbWV0aG9kcyBjYW4ndCB0aHJvdyBleGNlcHRpb25zLiIpOworICAgIH0KKyAgICBpZiAob25ld2F5XyAmJiAoIXJldHVybnR5cGVfLT5pc192b2lkKCkpKSB7CisgICAgICBwd2FybmluZygxLCAiT25ld2F5IG1ldGhvZHMgc2hvdWxkIHJldHVybiB2b2lkLlxuIik7CisgICAgfQorICB9CisKKyAgfnRfZnVuY3Rpb24oKSB7CisgICAgaWYgKG93bl94Y2VwdGlvbnNfKQorICAgICAgZGVsZXRlIHhjZXB0aW9uc187CisgIH0KKworICB0X3R5cGUqIGdldF9yZXR1cm50eXBlKCkgY29uc3QgeyByZXR1cm4gcmV0d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RfcHJvZ3JhbSgpLT5nZXRfbmFtZSgpLmNfc3RyKCksCisgICAgICAgICAgICAgICAgIGl0LT5maXJzdC5jX3N0cigpLAorICAgICAgICAgICAgICAgICBpdC0+c2Vjb25kLmNfc3RyKCksCisgICAgICAgICAgICAgICAgIHByb2ctPmdldF9uYW1lKCkuY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgaXQtPmZpcnN0LmNfc3RyKCksCisgICAgICAgICAgICAgICAgIGl0LT5zZWNvbmQuY19zdHIoKSk7CisgICAgICB9IGVsc2UgeworICAgICAgICBtYXRjaCA9IGZhbHNlOworICAgICAgfQorICAgIH0KKyAgICBmb3IgKHN0ZDo6bWFwPHN0ZDo6c3RyaW5nLCBzdGQ6OnN0cmluZz46Oml0ZXJhdG9yIGl0ID0gdC0+Z2V0X3Byb2dyYW0oKS0+bmFtZXNwYWNlc18uYmVnaW4oKTsKKyAgICAgICAgIGl0ICE9IHQtPmdldF9wcm9ncmFtKCktPm5hbWVzcGFjZXNfLmVuZCgpOworICAgICAgICAgKytpdCkgeworICAgICAgaWYgKDAgPT0gaXQtPnNlY29uZC5jb21wYXJlKHByb2ctPmdldF9uYW1lc3BhY2UoaXQtPmZpcnN0KSkpIHsKKyAgICAgICAgcHdhcm5pbmcoMSwKKyAgICAgICAgICAgICAgICAgIkR1cGxpY2F0ZSB0eXBlbmFtZSAlcyBmb3VuZCBpbiAlcywlcywlcyBhbmQgJXMsJXMsJXMgW2ZpbGUsc2NvcGUsbnNdIiwKKyAgICAgICAgICAgICAgICAgdC0+Z2V0X25hbWUoKS5jX3N0cigpLAorICAgICAgICAgICAgICAgICB0LT5nZXRfcHJvZ3JhbSgpLT5nZXRfbmFtZSgpLmNfc3RyKCksCisgICAgICAgICAgICAgICAgIGl0LT5maXJzdC5jX3N0cigpLAorICAgICAgICAgICAgICAgICBpdC0+c2Vjb25kLmNfc3RyKCksCisgICAgICAgICAgICAgICAgIHByb2ctPmdldF9uYW1lKCkuY19zdHIoKSwKKyAg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mFtZV87CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9CisgIH0KKworICB2b2lkIHZhbGlkYXRlX3VuaW9uX21lbWJlcnMoKSB7CisgICAgaWYgKGlzX3VuaW9uXyAmJiAoIW5hbWVfLmVtcHR5KCkpICYmICghbWVtYmVyc192YWxpZGF0ZWQpKSB7CisgICAgICBtZW1iZXJzX3R5cGU6OmNvbnN0X2l0ZXJhdG9yIG1faXRlcjsKKyAgICAgIGZvciAobV9pdGVyID0gbWVtYmVyc19pbl9pZF9vcmRlcl8uYmVnaW4oKTsgbV9pdGVyICE9IG1lbWJlcnNfaW5faWRfb3JkZXJfLmVuZCgpOyArK21faXRlcikgeworICAgICAgICB2YWxpZGF0ZV91bmlvbl9tZW1iZXIoKm1faXRlcik7CisgICAgICB9CisgICAgICBtZW1iZXJzX3ZhbGlkYXRlZCA9IHRydWU7CisgICAgfQorICB9CisKKyAgdm9pZCBzZXRfdW5pb24oYm9vbCBpc191bmlvbikgeworICAgIGlzX3VuaW9uXyA9IGlzX3VuaW9uOworICAgIHZhbGlkYXRlX3VuaW9uX21lbWJlcnMoKTsKKyAgfQorCisgIHZvaWQgc2V0X3hzZF9hbGwoYm9vbCB4c2RfYWxsKSB7IHhzZF9hbGxfID0geHNkX2FsbDsgfQorCisgIGJvb2wgZ2V0X3hzZF9hbGwoKSBjb25zdCB7IHJldHVybiB4c2RfYWxsXzsgfQorCisgIGJvb2wgYXBwZW5kKHRfZmllbGQqIGVsZW0pIHsKKyAgICB0eXBlZGVmIG1lbWJlcnNfdHlwZTo6aXRlcmF0b3IgaXRlcl90eXBlOworICAgIHN0ZDo6cGFpcjxpdGVyX3R5cGUsIGl0ZXJfdHlwZT4gYm91bmRzID0gc3RkOjplcXVhbF9yYW5nZShtZW1iZXJzX2luX2lkX29yZGVyXy5iZWdpbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZW1iZXJzX2luX2lkX29yZGVyXy5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdF9maWVsZDo6a2V5X2NvbXBhcmUoKSk7CisgICAgaWYgKGJvdW5kcy5maXJzdCAhPSBib3VuZHMuc2Vjb25kKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIC8vIHJldHVybnMgZmFsc2Ugd2hlbiB0aGVyZSBpcyBhIGNvbmZsaWN0IG9mIGZpZWxkIG5hbWVzCisgICAgaWYgKGdldF9maWVsZF9ieV9uYW1lKGVsZW0tPmdldF9uYW1lKCkpICE9IE5VTEwpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgbWVtYmVyc18ucHVzaF9iYWNrKGVsZW0pOworICAgIG1lbWJlcnNfaW5faWRfb3JkZXJfLmluc2VydChib3VuZHMuc2Vjb25kLCBlbGVtKTsKKyAgICB2YWxpZGF0ZV91bmlvbl9tZW1iZXIoZWxlbSk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKworICBjb25zdCBtZW1iZXJzX3R5cGUmIGdldF9tZW1iZXJzKCkgY29uc3QgeyByZXR1cm4gbWVtYmVyc187IH0KKworICBjb25zdCBtZW1iZXJzX3R5cGUmIGdldF9zb3J0ZWRfbWVtYmVycygpIHsgcmV0dXJuIG1lbWJlcnNfaW5faWRfb3JkZXJfOyB9CisKKyAgYm9vbCBpc19zdHJ1Y3QoKSBjb25zdCB7IHJldHVybiAhaXNfeGNlcHRpb25fOyB9CisKKyAgYm9vbCBpc194Y2VwdGlvbigpIGNvbnN0IHsgcmV0dXJuIGlzX3hjZXB0aW9uXzsgfQorCisgIGJvb2wgaXNfdW5pb24oKSBjb25zdCB7IHJldHVybiBpc191bmlvbl87IH0KKworICB0X2ZpZWxkKiBnZXRfZmllbGRfY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mQ8ZnJvbV90eXBlPihjb25zdCBmcm9tX3R5cGUmIGZyb20pCisKKyNkZWZpbmUgVEhSSUZUX0NPTlZFUlRfQ09NUExFVEVfREVDTChmcm9tX3R5cGUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdm9pZCBjb252ZXJ0KGNvbnN0IGZyb21fdHlwZSYgZnJvbSwgVG9UeXBlPGZyb21fdHlwZT46OnR5cGUqIHRvKQorCisjZGVmaW5lIFRIUklGVF9DT05WRVJUX1VOQVJZX0RFQ0woZnJvbV90eXBlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlIDw+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHR5cGVuYW1lIFRvVHlwZTxmcm9tX3R5cGU+Ojp0eXBlKiBjb252ZXJ0PGZyb21fdHlwZT4oY29uc3QgZnJvbV90eXBlJiBmcm9tKQorCisjZGVmaW5lIFRIUklGVF9DT05WRVJTSU9OX0RFQ0woZnJvbV90eXBlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX0ZPUldBUkQoZnJvbV90eXBlKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX0NPTVBMRVRFX0RFQ0woZnJvbV90eXBlKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX1VOQVJZX0RFQ0woZnJvbV90eXBlKQorCisjZGVmaW5lIFRIUklGVF9DT05WRVJUX0NPTVBMRVRFKGZyb21fdHlwZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJTSU9OX0RFQ0woZnJvbV90eXBlKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgVG9UeXBlPGZyb21fdHlwZT46OnR5cGUqIHRvID0gY29udmVydF9mb3J3YXJkKGZyb20pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgY29udmVydChmcm9tLCB0byk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmV0dXJuIHRvOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX0NPTVBMRVRFX0RFQ0woZnJvbV90eXBlKQorCisjZGVmaW5lIFRIUklGVF9DT05WRVJTSU9OKGZyb21fdHlwZSwgLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX0ZPUldBUkQoZnJvbV90eXBlKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgKHZvaWQpZnJvbTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmV0dXJuIG5ldyBUb1R5cGU8ZnJvbV90eXBlPjo6dHlwZShfX1ZBX0FSR1NfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9DT05WRVJUX0NPTVBMRVRFKGZyb21fdHlwZSkKKworI2RlZmluZSBUSFJJRlRfQVNTSUdOX0RPQygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChmcm9tLl9faXNzZXQuZG9jKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdG8tPnNldF9kb2MoZnJvbS5kb2MpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9IHdoaWxlICgwKQorCisjZGVmaW5lIFRIUklGVF9BU1NJR05fQU5OT1RBVElPTlMoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIFRIUklGVF9BU1NJR05fRE9DKCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaWYgKGZyb20uX19pc3NldC5hbm5vdGF0aW9ucykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0by0+YW5ub3RhdGlvbnNfID0gZnJvbS5hbm5vdGF0aW9uczsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gd2hpbGUgKDApCisKKyNkZWZpbmUgVEhSSUZUX0FTU0lHTl9NRVRBREFUQSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0by0+c2V0X25hbWUoZnJvbS5tZXRhZGF0YS5uYW1lKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoZnJvbS5tZXRhZGF0YS5fX2lzc2V0LmRvYykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRvLT5zZXRfZG9jKGZyb20ubWV0YWRhdGEuZG9jKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoZnJvbS5tZXRhZGF0YS5fX2lzc2V0LmFubm90YXRpb25zKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRvLT5hbm5vdGF0aW9uc18gPS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isKKyAgZ190eXBlX2NhY2hlLmNvbXBpbGVBbGwoKTsKKyAgZ19jb25zdF9jYWNoZS5jb21waWxlQWxsKCk7CisgIGdfc2VydmljZV9jYWNoZS5jb21waWxlQWxsKCk7Cit9CisKK3RlbXBsYXRlIDx0eXBlbmFtZSBUPgorVCogcmVzb2x2ZV90eXBlKGludDY0X3QgbmFtZSkgeworICByZXR1cm4gcmVpbnRlcnByZXRfY2FzdDxUKj4oZ190eXBlX2NhY2hlW25hbWVdKTsKK30KKworOjp0X2NvbnN0KiByZXNvbHZlX2NvbnN0KGludDY0X3QgbmFtZSkgeworICByZXR1cm4gZ19jb25zdF9jYWNoZVtuYW1lXTsKK30KKworOjp0X3NlcnZpY2UqIHJlc29sdmVfc2VydmljZShpbnQ2NF90IG5hbWUpIHsKKyAgcmV0dXJuIGdfc2VydmljZV9jYWNoZVtuYW1lXTsKK30KKworVEhSSUZUX0NPTlZFUlRfRk9SV0FSRCh0X2Jhc2VfdHlwZSkgeworI2RlZmluZSBUX0JBU0VUWVBFX0NBU0UodHlwZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBjYXNlIHRfYmFzZTo6VFlQRV8jI3R5cGU6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHQgPSA6OnRfYmFzZV90eXBlOjpUWVBFXyMjdHlwZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGJyZWFrCisKKyAgOjp0X2Jhc2VfdHlwZTo6dF9iYXNlIHQgPSA6OnRfYmFzZV90eXBlOjpUWVBFX1ZPSUQ7CisgIGJvb2wgaXNfYmluYXJ5ID0gZmFsc2U7CisgIHN3aXRjaCAoZnJvbS52YWx1ZSkgeworICAgIFRfQkFTRVRZUEVfQ0FTRSh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IChmcm9tLl9faXNzZXQuY3BwX25hbWUpCisgICAgdG8tPnNldF9jcHBfbmFtZShmcm9tLmNwcF9uYW1lKTsKK30KK1RIUklGVF9DT05WRVJTSU9OKHRfbWFwLAorICAgICAgICAgICAgICAgICAgcmVzb2x2ZV90eXBlPCA6OnRfdHlwZT4oZnJvbS5rZXlfdHlwZSksCisgICAgICAgICAgICAgICAgICByZXNvbHZlX3R5cGU8IDo6dF90eXBlPihmcm9tLnZhbF90eXBlKSkgeworICBhc3NlcnQodG8pOworICBUSFJJRlRfQVNTSUdOX01FVEFEQVRBKCk7CisgIGlmIChmcm9tLl9faXNzZXQuY3BwX25hbWUpCisgICAgdG8tPnNldF9jcHBfbmFtZShmcm9tLmNwcF9uYW1lKTsKK30KK1RIUklGVF9DT05WRVJTSU9OKHRfY29uc3RfdmFsdWUsICkgeworI2RlZmluZSBUX0NPTlNUX1ZBTFVFX0NBU0UodHlwZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBpZiAoZnJvbS5fX2lzc2V0LnR5cGUjI192YWwpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB0by0+c2V0XyMjdHlwZShmcm9tLnR5cGUjI192YWwpCisKKyAgYXNzZXJ0KHRvKTsKKyAgaWYgKGZyb20uX19pc3NldC5tYXBfdmFsKSB7CisgICAgdG8tPnNldF9tYXAoKTsKKyAgICBmb3IgKHN0ZDo6bWFwPHRfY29uc3RfdmFsdWUsIHRfY29uc3RfdmFsdWU+Ojpjb25zdF9pdGVyYXRvciBpdCA9IGZyb20ubWFwX3ZhbC5iZWdpbigpOworICAgICAgICAgaXQgIT0gZnJvbS5tYXBfdmFsLmVuZCgpOyBpdCsrKSB7CisgICAgICB0by0+YWRkX21hcChjb252ZXJ0KGl0LT5maXJzdCksIGNvbnZlcnQoaXQtPnNlY29uZCkp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JlcSkpOworICBpZiAoZnJvbS5fX2lzc2V0LnZhbHVlKSB7CisgICAgdG8tPnNldF92YWx1ZShjb252ZXJ0KGZyb20udmFsdWUpKTsKKyAgfQorfQorVEhSSUZUX0NPTlZFUlNJT04odF9zdHJ1Y3QsIGdfcHJvZ3JhbV9jYWNoZVtmcm9tLm1ldGFkYXRhLnByb2dyYW1faWRdKSB7CisgIGFzc2VydCh0byk7CisgIFRIUklGVF9BU1NJR05fTUVUQURBVEEoKTsKKyAgdG8tPnNldF91bmlvbihmcm9tLmlzX3VuaW9uKTsKKyAgdG8tPnNldF94Y2VwdGlvbihmcm9tLmlzX3hjZXB0aW9uKTsKKyAgYm9vc3Q6OmZvcl9lYWNoKGZyb20ubWVtYmVycyB8IGJvb3N0OjphZGFwdG9yczo6dHJhbnNmb3JtZWQoY29udmVydDx0X2ZpZWxkPiksCisgICAgICAgICAgICAgICAgICBzdGQ6OmJpbmQoJjo6dF9zdHJ1Y3Q6OmFwcGVuZCwgdG8sIHN0ZDo6cGxhY2Vob2xkZXJzOjpfMSkpOworfQorVEhSSUZUX0NPTlZFUlNJT04odF9jb25zdCwKKyAgICAgICAgICAgICAgICAgIHJlc29sdmVfdHlwZTwgOjp0X3R5cGU+KGZyb20udHlwZSksCisgICAgICAgICAgICAgICAgICBmcm9tLm5hbWUsCisgICAgICAgICAgICAgICAgICBjb252ZXJ0PHRfY29uc3RfdmFsdWU+KGZyb20udmFsdWUpKSB7CisgIGFzc2VydCh0byk7CisgIFRIUklGVF9BU1NJR05fRE9DKCk7Cit9CisKK1RIUklGVF9DT05WRVJTSU9OKHRfZnVuY3Rpb24sCisgICAgICAgICAgICAgICAgICByZXNvbHZlX3R5cGU8IDo6dF90eXBlPihmcm9tLnJldHVybnR5cGUpLAorICAgICAgICAgICAgICAgICAgZnJvbS5uYW1lLAorICAgICAgICAgICAgICAgICAgcmVzb2x2ZV90eXBlPCA6OnRfc3RydWN0Pihmcm9tLmFyZ2xpc3QpLAorICAgICAgICAgICAgICAgICAgcmVzb2x2ZV90eXBlPCA6OnRfc3RydWN0Pihmcm9tLnhjZXB0aW9ucyksCisgICAgICAgICAgICAgICAgICBmcm9tLmlzX29uZXdheSkgeworICBhc3NlcnQodG8pOworICBUSFJJRlRfQVNTSUdOX0RPQygpOworfQorCitUSFJJRlRfQ09OVkVSU0lPTih0X3NlcnZpY2UsIGdfcHJvZ3JhbV9jYWNoZVtmcm9tLm1ldGFkYXRhLnByb2dyYW1faWRdKSB7CisgIGFzc2VydCh0byk7CisgIGFzc2VydChmcm9tLm1ldGFkYXRhLnByb2dyYW1faWQpOworICBhc3NlcnQoZ19wcm9ncmFtX2NhY2hlW2Zyb20ubWV0YWRhdGEucHJvZ3JhbV9pZF0pOworICBUSFJJRlRfQVNTSUdOX01FVEFEQVRBKCk7CisKKyAgYm9vc3Q6OmZvcl9lYWNoKGZyb20uZnVuY3Rpb25zIHwgYm9vc3Q6OmFkYXB0b3JzOjp0cmFuc2Zvcm1lZChjb252ZXJ0PHRfZnVuY3Rpb24+KSwKKyAgICAgICAgICAgICAgICAgIHN0ZDo6YmluZCgmOjp0X3NlcnZpY2U6OmFkZF9mdW5jdGlvbiwgdG8sIHN0ZDo6cGxhY2Vob2xkZXJzOjpfMSkpOworCisgIGlmIChmcm9tLl9faXNzZXQuZXh0ZW5kc18pCisgICAgdG8tPnNldF9leHRlbmRzKHJlc29sdmVfc2VydmljZShmcm9tLmV4dGVuZHNfKSk7Cit9CisKK1RIUklGVF9DT05WRVJUX0ZPUldBUkQodF90eXBlKSB7CisjZGVmaW5lIFRfVFlQRV9DQVNFX0ZXX1QoY2FzZSwgdHlwZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGlmIChmcm9tLl9faXNzZXQuY2FzZSMjX3ZhbCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHJldH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FlQRV9DQVNFX1QoY2FzZSwgdF8jI2Nhc2UpCisKKyAgaWYgKGZhbHNlKSB7CisgIH0KKyAgVF9UWVBFX0NBU0UoYmFzZV90eXBlKTsKKyAgVF9UWVBFX0NBU0UodHlwZWRlZik7CisgIFRfVFlQRV9DQVNFKGVudW0pOworICBUX1RZUEVfQ0FTRShzdHJ1Y3QpOworICBUX1RZUEVfQ0FTRV9UKHhjZXB0aW9uLCB0X3N0cnVjdCk7CisgIFRfVFlQRV9DQVNFKGxpc3QpOworICBUX1RZUEVfQ0FTRShzZXQpOworICBUX1RZUEVfQ0FTRShtYXApOworICBUX1RZUEVfQ0FTRShzZXJ2aWNlKTsKKyAgZWxzZSB7CisgICAgdGhyb3cgVGhyaWZ0UGx1Z2luRXJyb3IoIkludmFsaWQgZGF0YTogVHlwZSB1bmlvbiBoYXMgbm8gdmFsdWUuIik7CisgIH0KKyN1bmRlZiBUX1RZUEVfQ0FTRV9UCisjdW5kZWYgVF9UWVBFX0NBU0UKK30KKworVEhSSUZUX0NPTlZFUlNJT04odF9zY29wZSwgKSB7CisgIGFzc2VydCh0byk7CisjZGVmaW5lIFRfU0NPUEVfUkVTT0xWRSh0eXBlLCBuYW1lLCBhKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGZvciAoc3RkOjp2ZWN0b3I8aW50NjRfdD46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gZnJvbS5uYW1lIyNzLmJlZ2luKCk7IGl0ICE9IGZyb20ubmFtZSMjcy5lbmQoKTsgICBcCisgICAgICAgaXQrKykgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgOjp0XyMjdHlwZSogdCA9IHJlc29sdmVfIyN0eXBlIGEoKml0KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdm9pZCBjb252ZXJ0PGZyb21fdHlwZSwgdG9fdHlwZT4oZnJvbV90eXBlICogZnJvbSwgdG9fdHlwZSAmIHRvKQorI2RlZmluZSBUSFJJRlRfQ09OVkVSU0lPTih0eXBlKSBUSFJJRlRfQ09OVkVSU0lPTl9OKDo6dHlwZSwgcGx1Z2luOjp0eXBlKQorCisjZGVmaW5lIFRIUklGVF9BU1NJR05fTihmcm9tX25hbWUsIHRvX25hbWUsIHByZWZpeCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaWYgKGZyb20pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0by5fX3NldF8jI3RvX25hbWUocHJlZml4KGZyb20tPmZyb21fbmFtZSkpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gd2hpbGUgKDApCisKKyNkZWZpbmUgVEhSSUZUX0FTU0lHTihuYW1lKSBUSFJJRlRfQVNTSUdOX04oZ2V0XyMjbmFtZSgpLCBuYW1lLCApCisjZGVmaW5lIFRIUklGVF9BU1NJR05fQ09OVkVSVCh0eXBlLCBmcm9tX25hbWUsIHRvX25hbWUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaWYgKGZyb20gJiYgZnJvbS0+ZnJvbV9uYW1lKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0by5fX3NldF8jI3RvX25hbWUoY29udmVydChmcm9tLT5mcm9tX25hbWUpKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gd2hpbGUgKDApCisKKyNkZWZpbmUgVEhSSUZUX0FTU0lHTl9PUFQobmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoZnJvbS0+aGFzXyMjbmFtZSgpKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIFRIUklGVF9BU1NJR04obmFtZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKKworI2RlZmluZSBUSFJJRlRfQVNTSUdOX0xJU1RfTih0eXBlLCBmcm9tX25hbWUsIHRvX25hbWUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChmcm9tICYmICFmcm9tLT5mcm9tX25hbWUuZW1wdHkoKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgc3RkOjp0cmFuc2Zvcm0oZnJvbS0+ZnJvbV9uYW1lLmJlZ2luKCksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgZnJvbS0+ZnJvbV9uYW1lLmVuZCgpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgc3RkOjpiYWNrX2luc2VydGVyKHRvLnRvX25hbWUpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgY29udmVydDwgOjp0eXBlPik7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9IHdoaWxlICgwKQorCisjZGVmaW5lIFRIUklGVF9BU1NJR05fTUVUQURBVEEoKSBjb252ZXJ0KHJlaW50ZXJwcmV0X2Nhc3Q8dF90eXBlKj4oZnJvbSksIHRvLm1ldGFkYXRhKQorCisvLyBhIGdlbmVyYXRvciBvZiBzZXF1ZW50aWFsIHVuaXF1ZSBpZGVudGlmaWVycyBmb3IgYWRkcmVzc2VzIC0tIHNvCisvLyB0aGF0IHRoZSBUeXBlQ2FjaGUgYmVsb3cgY2FuIHVzZSB0aG9zZSBJRHMgaW5zdGVhZCBvZgorLy8gYWRkcmVzc2VzLiBUaGlzIGFsbG93cyBHZW5lcmF0b3JJbnB1dCdzIHZhcmlvdXMKKy8vIHRfe3Byb2dyYW0sdHlwZSxldGN9X2lkIHR5cGVz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yNkZWZpbmUgVF9TVE9SRSh0eXBlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgVHlwZUNhY2hlPHRfIyN0eXBlPiB0eXBlIyNfY2FjaGU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgcGx1Z2luOjp0XyMjdHlwZSMjX2lkIHN0b3JlX3R5cGU8dF8jI3R5cGU+KHRfIyN0eXBlICogdCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZXR1cm4gdHlwZSMjX2NhY2hlLnN0b3JlPHRfIyN0eXBlPih0KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQorVF9TVE9SRSh0eXBlKQorVF9TVE9SRShjb25zdCkKK1RfU1RPUkUoc2VydmljZSkKKyN1bmRlZiBUX1NUT1JFCisvLyB0aGlzIGlkX2dlbmVyYXRvciBpcyBmb3IgZ2Vuc3ltbS1pbmcgdF9wcm9ncmFtX2lkCitpZF9nZW5lcmF0b3IgcHJvZ3JhbV9jYWNoZSA7CisKKyNkZWZpbmUgVEhSSUZUX0FTU0lHTl9JRF9OKHQsIGZyb21fbmFtZSwgdG9fbmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoZnJvbSAmJiBmcm9tLT5mcm9tX25hbWUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRvLl9fc2V0XyMjdG9fbmFtZShzdG9yZV90eXBlPHQ+KGZyb20tPmZyb21fbmFtZSkpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKKworI2RlZmluZSBUSFJJRlRfQVNTSUdOX0lEKG5hbWUpIFRIUklGVF9BU1NJR05fSURfTih0X3R5cGUsIGdldF8jI25hbWUoKSwgbmFtZSkKKworI2RlZmluZSBUSFJJRlRfQVNTSUdOX0xJU1RfSUQodCwgbmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChmcm9tICYmICFmcm9tLT5nZXRfIyNuYW1lIyNzKCkuZW1wdHkoKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgc3RkOjp0cmFuc2Zvcm0oZnJvbS0+Z2V0XyMjbmFtZSMjcygpLmJlZ2luKCksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgZnJvbS0+Z2V0XyMjbmFtZSMjcygpLmVuZCgpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgc3RkOjpiYWNrX2luc2VydGVyKHRvLm5hbWUjI3MpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgJnN0b3JlX3R5cGU8dD4pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9IHdoaWxlICgwKQorCitUSFJJRlRfQ09OVkVSU0lPTl9OKDo6dF90eXBlLCBwbHVnaW46OlR5cGVNZXRhZGF0YSkgeworICB0by5wcm9ncmFtX2lkID0gcHJvZ3JhbV9jYWNoZS5nZW5zeW0ocmVpbnRlcnByZXRfY2FzdDxpbnQ2NF90Pihmcm9tLT5nZXRfcHJvZ3JhbSgpKSk7CisgIFRIUklGVF9BU1NJR05fTihhbm5vdGF0aW9uc18sIGFubm90YXRpb25zLCApOworICBpZiAoZnJvbS0+aGFzX2RvYygpKSB7CisgICAgdG8uX19zZXRfZG9jKGZyb20tPmdldF9kb2MoKSk7CisgIH0KKyAgVEhSSUZUX0FTU0lHTihuYW1lKTsKK30KKworVEhSSUZUX0NPTlZFUlNJT04odF90eXBlZGVmKSB7CisgIFRIUklGVF9BU1NJR05fTUVUQURBVEEoKTsKKyAgVEhSSUZUX0FTU0lHTl9JRCh0eXBlKTsKKyAgVEhSSUZUX0FTU0lHTihzeW1ib2xpYyk7CisgIFRIUklGVF9BU1NJR05fTihpc19mb3J3YXJkX3R5cGVkZWYoKSwgZm9yd2FyZCwgKTsKK30KKworVEhSSUZUX0NPTlZFUlNJT04odF9lbnVtX3ZhbHVlKSB7CisgIFRIUklGVF9BU1NJR05fT1BUKGRvYyk7CisgIFRIUklGVF9BU1NJR04obmFtZSk7CisgIFRIUklGVF9BU1NJR04odmFsdWUpOworfQorCitUSFJJRlRfQ09OVkVSU0lPTih0X2VudW0pIHsKKyAgVEhSSUZUX0FTU0lHTl9NRVRBREFUQSgpOworICBUSFJJRlRfQVNTSUdOX0xJU1RfTih0X2VudW1fdm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F9BU1NJR05fSUQoZWxlbV90eXBlKTsKK30KK1RIUklGVF9DT05WRVJTSU9OKHRfbWFwKSB7CisgIFRIUklGVF9BU1NJR05fTUVUQURBVEEoKTsKKyAgVEhSSUZUX0FTU0lHTl9PUFQoY3BwX25hbWUpOworICBUSFJJRlRfQVNTSUdOX0lEKGtleV90eXBlKTsKKyAgVEhSSUZUX0FTU0lHTl9JRCh2YWxfdHlwZSk7Cit9CisKK1RIUklGVF9DT05WRVJTSU9OKHRfc2VydmljZSkgeworICBUSFJJRlRfQVNTSUdOX01FVEFEQVRBKCk7CisgIFRIUklGVF9BU1NJR05fTElTVF9OKHRfZnVuY3Rpb24sIGdldF9mdW5jdGlvbnMoKSwgZnVuY3Rpb25zKTsKKyAgVEhSSUZUX0FTU0lHTl9JRF9OKHRfc2VydmljZSwgZ2V0X2V4dGVuZHMoKSwgZXh0ZW5kc18pOworfQorCitUSFJJRlRfQ09OVkVSU0lPTih0X2Jhc2VfdHlwZSkgeworICBUSFJJRlRfQVNTSUdOX01FVEFEQVRBKCk7CisgIGlmIChmcm9tLT5pc19iaW5hcnkoKSkgeworICAgIHRvLnZhbHVlID0gcGx1Z2luOjp0X2Jhc2U6OlRZUEVfQklOQVJZOworICB9IGVsc2UgeworICAgIHN3aXRjaCAoZnJvbS0+Z2V0X2Jhc2UoKSkgeworI2RlZmluZSBUX0JBU0VUWVBFX0NBU0UobmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBjYXNlIHRfYmFzZV90eXBlOjpUWVBFXyMjbmFtZTogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRvLnZhbHVlID0gcGx1Z2luOjp0X2Jhc2U6OlRZUEVfIyNuYW1lOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGJyZWFrCisgICAgICBUX0JBU0VUWVBFX0NBU0UoVk9JRCk7CisgICAgICBUX0JBU0VUWVBFX0NBU0UoU1RSSU5HKTsKKyAgICAgIFRfQkFTRVRZUEVfQ0FTRShCT09MKTsKKyAgICAgIFRfQkFTRVRZUEVfQ0FTRShJOCk7CisgICAgICBUX0JBU0VUWVBFX0NBU0UoSTE2KTsKKyAgICAgIFRfQkFTRVRZUEVfQ0FTRShJMzIpOworICAgICAgVF9CQVNFVFlQRV9DQVNFKEk2NCk7CisgICAgICBUX0JBU0VUWVBFX0NBU0UoRE9VQkxFKTsKKyAgICBkZWZhdWx0OgorICAgICAgdGhyb3cgcGx1Z2luOjpUaHJpZnRQbHVnaW5FcnJvcigiQmFzZSB0eXBlIHVuaW9uIGhhcyBubyB2YWx1ZSIpOworICAgICAgYnJlYWs7CisjdW5kZWYgVF9CQVNFVFlQRV9DQVNFCisgICAgfQorICB9Cit9CitUSFJJRlRfQ09OVkVSU0lPTih0X3R5cGUpIHsKKyNkZWZpbmUgVF9DT05WRVJUX1VOSU9OX04obmFtZSwgdHlwZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZWxzZSBpZiAoZnJvbS0+aXNfIyNuYW1lKCkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0by5fX2lzc2V0Lm5hbWUjI192YWwgPSB0cnVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBjb252ZXJ0KHJlaW50ZXJwcmV0X2Nhc3Q8IDo6dHlwZSo+KGZyb20pLCB0by5uYW1lIyNfdmFsKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQorI2RlZmluZSBUX0NPTlZFUlRfVU5JT04obmFtZSkgVF9DT05WRVJUX1VOSU9OX04obmFtZSwgdF8jI25hbWUpCisgIGlmIChmYWxzZSkgeworICB9CisgIFRfQ09OVkVSVF9VTklPTihiYXNlX3R5cGUpCisgIFRfQ09OVkVSVF9VTklPTih0eXBlZGVmKQorICBUX0NPTlZFUlRfVU5JT04oZW51bSkKKyAgVF9DT05WRVJUX1VOSU9OKHN0cnVjdCkKKyAgVF9DT05WRVJUX1VOSU9OX04oeGNlcHRpb24sIHRfc3RydWN0KQorICBUX0NPTlZFUlRfVU5JT04obGlzdCkKKyAgVF9DT05WRVJUX1VOSU9OKHNldCkKKyAgVF9DT05WRVJUX1VOSU9OKG1hcCkKKyAgVF9DT05WRVJUX1VOSU9OKHNlcnZpY2UpCisgIGVsc2UgeworICAgIHRocm93IHBsdWdpbjo6VGhyaWZ0UGx1Z2luRXJyb3IoIlR5cGUgdW5pb24gaGFzIG5vIHZhbHVlIik7CisgIH0KKyN1bmRlZiBUX0NPTlZFUlRfVU5JT05fTgorI3VuZGVmIFRfQ09OVkVSVF9VTklPTgorfQorCitUSFJJRlRfQ09OVkVSU0lPTih0X3Njb3BlKSB7CisjZGVmaW5lIFRfU0NPUEVfQVNTSUdOKG5hbWUsIHR5cGUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGJvb3N0Ojpjb3B5KGZyb20tPm5hbWUjI3NfIHwgYm9vc3Q6OmFkYXB0b3JzOjptYXBfdmFsdWVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgIHwgYm9vc3Q6OmFkYXB0b3JzOjp0cmFuc2Zvcm1lZCgmc3RvcmVfdHlwZTx0eXBlPiksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgIHN0ZDo6YmFja19pbnNlcnRlcih0by5uYW1lIyNzKSkKKyAgVF9TQ09QRV9BU1NJR04odHlwZSwgdF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F9nbG9iYWxfY2FjaGUoY29uc3QgVHlwZVJlZ2lzdHJ5Jik7Cit2b2lkIGNsZWFyX2dsb2JhbF9jYWNoZSgpOworfQorfQorfQorCisvLyBjb252ZXJzaW9uIGZyb20gcmF3IGNvbXBpbGVyIHR5cGVzIHRvIHBsdWdpbiB3aXJlIHR5cGUKK25hbWVzcGFjZSBwbHVnaW5fb3V0cHV0IHsKKwordGVtcGxhdGUgPHR5cGVuYW1lIEZyb20sIHR5cGVuYW1lIFRvPgordm9pZCBjb252ZXJ0KEZyb20qIGZyb20sIFRvJiB0byk7CisKK3RlbXBsYXRlIDx0eXBlbmFtZSBGcm9tPgordHlwZW5hbWUgYXBhY2hlOjp0aHJpZnQ6OnBsdWdpbjo6VG9UeXBlPEZyb20+Ojp0eXBlIGNvbnZlcnQoRnJvbSogZnJvbSk7CisKK3ZvaWQgZ2V0X2dsb2JhbF9jYWNoZShhcGFjaGU6OnRocmlmdDo6cGx1Z2luOjpUeXBlUmVnaXN0cnkmKTsKK3ZvaWQgY2xlYXJfZ2xvYmFsX2NhY2hlKCk7Cit9CisKKyNkZWZpbmUgVEhSSUZUX1RZUEVfTUFQUElORyhUWVBFKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgY2xhc3MgVFlQRTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgbmFtZXNwYWNlIGFwYWNoZSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgbmFtZXNwYWNlIHRocmlmdCB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgbmFtZXNwYWNlIHBsdWdpbiB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgY2xhc3MgVFlQRTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgc3RydWN0IFRvVHlwZTwgOjpUWVBFPiB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0eXBlZGVmIFRZUEUgdHlwZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgc3RydWN0IFRvVHlwZTxUWVBFPiB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0eXBlZGVmIDo6VFlQRSB0eXBlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQorVEhSSUZUX1RZUEVfTUFQUElORyh0X2Jhc2VfdHlwZSkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9jb25zdCkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9jb25zdF92YWx1ZSkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9jb250YWluZXIpCitUSFJJRlRfVFlQRV9NQVBQSU5HKHRfZG9jKQorVEhSSUZUX1RZUEVfTUFQUElORyh0X2VudW0pCitUSFJJRlRfVFlQRV9NQVBQSU5HKHRfZW51bV92YWx1ZSkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9maWVsZCkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9mdW5jdGlvbikKK1RIUklGVF9UWVBFX01BUFBJTkcodF9saXN0KQorVEhSSUZUX1RZUEVfTUFQUElORyh0X21hcCkKK1RIUklGVF9UWVBFX01BUFBJTkcodF9wcm9ncmFtKQorVEhSSUZUX1RZUEVfTUFQUElORyh0X3Njb3BlKQorVEhSSUZUX1RZUEVfTUFQUElORyh0X3NlcnZpY2UpCitUSFJJRlRfVFlQRV9NQVBQSU5HKHRfc2V0KQorVEhSSUZUX1RZUEVfTUFQUElORyh0X3N0cnVjdCkKK1RIUklGVF9UWVBFX01BUFBJTkcodF90eXBlKQorVEhSSUZUX1RZUEVfTUFQUElORyh0X3R5cGVkZWYpCisjdW5kZWYgVEhSSUZUX1RZUEVfTUFQUElORworI2VuZGlmCmRpZmYgLS1naXQgYS9jb21waWxlci9jcHA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qIiovIikKK211bHRpY21fYmVnaW4gKCIvKiIpCitkb2N0ZXh0X2JlZ2luICgiLyoqIikKK2NvbW1lbnQgICAgICAgKCIvLyJbXlxuXSopCit1bml4Y29tbWVudCAgICgiIyJbXlxuXSopCitzeW1ib2wgICAgICAgIChbOjtcLFx7XH1cKFwpXD08PlxbXF1dKQorbGl0ZXJhbF9iZWdpbiAoWydcIl0pCisKKyUlCisKK3t3aGl0ZXNwYWNlfSAgICAgICAgIHsgLyogZG8gbm90aGluZyAqLyAgICAgICAgICAgICAgICAgfQore3NpbGx5Y29tbX0gICAgICAgICAgeyAvKiBkbyBub3RoaW5nICovICAgICAgICAgICAgICAgICB9CisKK3tkb2N0ZXh0X2JlZ2lufSB7CisgIHN0ZDo6c3RyaW5nIHBhcnNlZCgiLyoqIik7CisgIGludCBzdGF0ZSA9IDA7ICAvLyAwID0gbm9ybWFsLCAxID0gIioiIHNlZW4sICIqLyIgc2VlbgorICB3aGlsZShzdGF0ZSA8IDIpCisgIHsKKyAgICBpbnQgY2ggPSB5eWlucHV0KCk7CisgICAgcGFyc2VkLnB1c2hfYmFjayhjaCk7CisgICAgc3dpdGNoIChjaCkgeworICAgICAgY2FzZSBFT0Y6CisgICAgICAgIHl5ZXJyb3IoIlVuZXhwZWN0ZWQgZW5kIG9mIGZpbGUgaW4gZG9jLWNvbW1lbnQgYXQgJWRcbiIsIHl5bGluZW5vKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICAgIGNhc2UgJyonOgorICAgICAgICBzdGF0ZSA9IDE7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSAnLyc6CisgICAgICAgIHN0YXRlID0gKHN0YXRlID09IDEpID8gMiA6IDA7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgc3RhdGUgPSAwOworICAgICAgICBicmVhazsKKyAgICB9CisgIH0KKyAgcGRlYnVnKCJkb2N0ZXh0ID0gXCIlc1wiXG4iLHBhcnNlZC5jX3N0cigpKTs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Iik7CisgIGludCBzdGF0ZSA9IDA7ICAvLyAwID0gbm9ybWFsLCAxID0gIioiIHNlZW4sICIqLyIgc2VlbgorICB3aGlsZShzdGF0ZSA8IDIpCisgIHsKKyAgICBpbnQgY2ggPSB5eWlucHV0KCk7CisgICAgcGFyc2VkLnB1c2hfYmFjayhjaCk7CisgICAgc3dpdGNoIChjaCkgeworICAgICAgY2FzZSBFT0Y6CisgICAgICAgIHl5ZXJyb3IoIlVuZXhwZWN0ZWQgZW5kIG9mIGZpbGUgaW4gbXVsdGlsaW5lIGNvbW1lbnQgYXQgJWRcbiIsIHl5bGluZW5vKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICAgIGNhc2UgJyonOgorICAgICAgICBzdGF0ZSA9IDE7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSAnLyc6CisgICAgICAgIHN0YXRlID0gKHN0YXRlID09IDEpID8gMiA6IDA7CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgc3RhdGUgPSAwOworICAgICAgICBicmVhazsKKyAgICB9CisgIH0KKyAgcGRlYnVnKCJtdWx0aV9jb21tID0gXCIlc1wiXG4iLHBhcnNlZC5jX3N0cigpKTsKK30KKwore2NvbW1lbnR9ICAgICAgICAgICAgeyAvKiBkbyBub3RoaW5nICovICAgICAgICAgICAgICAgICB9Cit7dW5peGNvbW1lbnR9ICAgICAgICB7IC8qIGRvIG5vdGhpbmcgKi8gICAgICAgICAgICAgICAgIH0KKwore3N5bWJvbH0gICAgICAgICAgICAgeyByZXR1cm4geXl0ZXh0WzBdOyAgICAgICAgICAgICAgICB9CisiKiIgICAgICAgICAgICAgICAgICB7IHJldHVybiB5eXRleHRbMF07ICAgICAgICAgICAgICAgIH0KKworImZhbHNlIiAgICAgICAgICAgICAgeyB5eWx2YWwuaWNvbnN0PTA7IHJldHVybiB0b2tfaW50X2NvbnN0YW50OyB9CisidHJ1ZSIgICAgICAgICAgICAgICB7IHl5bHZhbC5pY29uc3Q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gICAgICB7IHJldHVybiB0b2tfdm9pZDsgICAgICAgICAgICAgICAgIH0KKyJib29sIiAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19ib29sOyAgICAgICAgICAgICAgICAgfQorImJ5dGUiICAgICAgICAgICAgICAgeworICBlbWl0X2J5dGVfdHlwZV93YXJuaW5nKCk7CisgIHJldHVybiB0b2tfaTg7Cit9CisiaTgiICAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfaTg7ICAgICAgICAgICAgICAgICAgIH0KKyJpMTYiICAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19pMTY7ICAgICAgICAgICAgICAgICAgfQorImkzMiIgICAgICAgICAgICAgICAgeyByZXR1cm4gdG9rX2kzMjsgICAgICAgICAgICAgICAgICB9CisiaTY0IiAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfaTY0OyAgICAgICAgICAgICAgICAgIH0KKyJkb3VibGUiICAgICAgICAgICAgIHsgcmV0dXJuIHRva19kb3VibGU7ICAgICAgICAgICAgICAgfQorInN0cmluZyIgICAgICAgICAgICAgeyByZXR1cm4gdG9rX3N0cmluZzsgICAgICAgICAgICAgICB9CisiYmluYXJ5IiAgICAgICAgICAgICB7IHJldHVybiB0b2tfYmluYXJ5OyAgICAgICAgICAgICAgIH0KKyJzbGlzdCIgeworICBwd2FybmluZygwLCAiXCJzbGlzdFwiIGlzIGRlcHJlY2F0ZWQgYW5kIHdpbGwgYmUgcmVtb3ZlZCBpbiBhIGZ1dHVyZSBjb21waWxlciB2ZXJzaW9uLiAgVGhpcyB0eXBlIHNob3VsZCBiZSByZXBsYWNlZCB3aXRoIFwic3RyaW5nXCIuXG4iKTsKKyAgcmV0dXJuIHRva19zbGlzdDsKK30KKyJzZW51bSIgeworICBwd2FybmluZygwLCAiXCJzZW51bVwiIGlzIGRlcHJlY2F0ZWQgYW5kIHdpbGwgYmUgcmVtb3ZlZCBpbiBhIGZ1dHVyZSBjb21waWxlciB2ZXJzaW9uLiAgVGhpcyB0eXBlIHNob3VsZCBiZSByZXBsYWNlZCB3aXRoIFwic3RyaW5nXCIuXG4iKTsKKyAgcmV0dXJuIHRva19zZW51bTsKK30KKyJtYXAiICAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19tYXA7ICAgICAgICAgICAgICAgICAgfQorImxpc3QiICAgICAgICAgICAgICAgeyByZXR1cm4gdG9rX2xpc3Q7ICAgICAgICAgICAgICAgICB9Cisic2V0IiAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfc2V0OyAgICAgICAgICAgICAgICAgIH0KKyJvbmV3YXkiICAgICAgICAgICAgIHsgcmV0dXJuIHRva19vbmV3YXk7ICAgICAgICAgICAgICAgfQorInR5cGVkZWYiICAgICAgICAgICAgeyByZXR1cm4gdG9rX3R5cGVkZWY7ICAgICAgICAgICAgICB9Cisic3RydWN0IiAgICAgICAgICAgICB7IHJldHVybiB0b2tfc3RydWN0OyAgICAgICAgICAgICAgIH0KKyJ1bmlvbiIgICAgICAgICAgICAgIHsgcmV0dXJuIHRva191bmlvbjsgICAgICAgICAgICAgICAgfQorImV4Y2VwdGlvbiIgICAgICAgICAgeyByZXR1cm4gdG9rX3hjZXB0aW9uOyAgICAgICAgICAgICB9CisiZXh0ZW5kcyIgICAgICAgICAgICB7IHJldHVybiB0b2tfZXh0ZW5kczsgICAgICAgICAgICAgIH0KKyJ0aHJvd3MiICAgICAgICAgICAgIHsgcmV0dXJuIHRva190aHJvd3M7ICAgICAgICAgICAgICAgfQorInNlcnZpY2UiICAgICAgICAgICAgeyByZXR1cm4gdG9rX3NlcnZpY2U7ICAgICAgICAgICAgICB9CisiZW51bSIgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfZW51bTsgICAgICAgICAgICAgICAgIH0KKyJjb25zdCIgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19jb25zdDsgICAgICAgICAgICAgICAgfQorInJlcXVpcmVkIiAgICAgICAgICAgeyByZXR1cm4gdG9rX3JlcXVpcmVkOyAgICAgICAgICAgICB9Cisib3B0aW9uYWwiICAgICAgICAgICB7IHJldHVybiB0b2tfb3B0aW9uYWw7ICAgICAgICAgICAgIH0KKyJhc3luYyIgeworICBwd2FybmluZygwLCAiXCJhc3luY1wiIGlzIGRlcHJlY2F0ZWQuICBJdCBpcyBjYWxsZWQgXCJvbmV3YXlcIiBub3cuXG4iKTsKKyAgcmV0dXJuIHRva19vbmV3YXk7Cit9CisiJiIgICAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfcmVmZXJlbmNlOyAgICAgICAgICAgIH0KKwore2ludGNvbnN0YW50fSB7CisgIGVycm5vID0gMDsKKyAgeXlsdmFsLmljb25zdCA9IHN0cnRvbGwoeXl0ZXh0LCBOVUxMLCAxMCk7CisgIGlmIChlcnJubyA9PSBFUkFOR0UpIHsKKyAgICBpbnRlZ2VyX292ZXJmbG93KHl5dGV4dCk7CisgIH0KKyAgcmV0dXJuIHRva19pbnRfY29uc3RhbnQ7Cit9CisKK3toZXhjb25zdGFudH0geworICBlcnJubyA9IDA7CisgIGNoYXIgc2lnbiA9IHl5dGV4dFswXTsKKyAgaW50IHNoaWZ0ID0gc2lnbiA9PSAnMCcgPyAyIDogMzsKKyAgeXlsdmFsLmljb25zdCA9IHN0cnRvbGwoeXl0ZXh0K3NoaWZ0LCBOVUxMLCAxNik7CisgIGlmIChzaWduID09ICctJykgeworICAgIHl5bHZhbC5pY29uc3QgPSAteXlsdmFsLmljb25zdDsKKyAgfQorICBpZiAoZXJybm8gPT0gRVJBTkdFKSB7CisgICAgaW50ZWdlcl9vdmVyZmxvdyh5eXRleHQpOworICB9CisgIHJldHVybiB0b2tfaW50X2NvbnN0YW50OworfQorCit7aWRlbnRpZmllcn0geworICB5eWx2YWwuaWQgPSBzdHJkdXAoeXl0ZXh0KTsKKyAgcmV0dXJuIHRva19pZGVudGlmaWVyOworfQorCit7ZHViY29uc3RhbnR9IHsKKyAvKiBEZWxpYmVyYXRlbHkgcGxhY2VkIGFmdGVyIGlkZW50aWZpZXIsIHNpbmNlICJlMTAiIGlzIE5PVCBhIGRvdWJsZSBsaXRlcmFsIChUSFJJRlQtMzQ3NykgKi8KKyAgeXlsdmFsLmRjb25zdCA9IGF0b2YoeXl0ZXh0KTsKKyAgcmV0dXJuIHRva19kdWJfY29uc3RhbnQ7Cit9CisKK3tsaXRlcmFsX2JlZ2lufSB7CisgIGNoYXIgbWFyayA9IHl5dGV4dFswXTsKKyAgc3RkOjpzdHJpbmcgcmVzdWx0OworICBmb3IoOzspCisgIHsKKyAgICBpbnQgY2ggPSB5eWlucHV0KCk7CisgICAgc3dpdGNoIChjaCkgeworICAgICAgY2FzZSBFT0Y6CisgICAgICAgIHl5ZXJyb3IoIkVuZCBvZiBmaWxlIHdoaWxlIHJlYWQgc3RyaW5nIGF0ICVkXG4iLCB5eWxpbmVubyk7CisgICAgICAgIGV4aXQoMSk7CisgICAgICBjYXNlICdcbic6CisgICAgICAgIHl5ZXJyb3IoIkVuZCBvZiBsaW5lIHdoaWxlIHJlYWQgc3RyaW5nIGF0ICVkXG4iLCB5eWxpbmVubyAtIDEpOworICAgICAgICBleGl0KDEpOworICAgICAgY2FzZSAnXFwnOgorICAgICAgICBjaCA9IHl5aW5wdXQoKTsKKyAgICAgICAgc3dpdGNoIChjaCkgeworICAgICAgICAgIGNhc2UgJ3InOgorICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnXHInKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgIGNhc2UgJ24nOgorICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnXG4nKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgIGNhc2UgJ3QnOgorICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnXHQnKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgIGNhc2UgJyInOgorICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnIicpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgY2FzZSAnXCcnOgorICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnXCcnKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgIGNhc2UgJ1xcJzoKKyAgICAgICAgICAgIHJlc3VsdC5wdXNoX2JhY2soJ1xcJyk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgeXllcnJvcigiQmFkIGVzY2FwZSBjaGFyYWN0ZXJcbiIpOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAgIGJyZWFrOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgaWYgKGNoID09IG1hcmspIHsKKyAgICAgICAgICB5eWx2YWwuaWQgPSBzdHJkdXAocmVzdWx0LmNfc3RyKCkpOworICAgICAgICAgIHJldHVybiB0b2tfbGl0ZXJhbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICByZXN1bHQucHVzaF9iYWNrKGNoKTsKKyAgICAgICAgfQorICAgIH0KKyAgfQorfQorCisKKy4geworICB1bmV4cGVjdGVkX3Rva2VuKHl5dGV4dCk7Cit9CisKKyUlCisKKyNpZmRlZiBfTVNDX1ZFUgorI3ByYWdtYSB3YXJuaW5nKCBwb3AgKQorI2VuZGlmCisKKy8qIHZpbTogZmlsZXR5cGU9bGV4CisqLwpkaWZmIC0tZ2l0IGEvY29tcGlsZXIvY3BwL3NyYy90aHJpZnQvdGhyaWZ0eS55eSBiL2NvbXBpbGVyL2NwcC9zcmMvdGhyaWZ0L3RocmlmdHkueXkKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZGYzNGFkZgotLS0gL2Rldi9udWxsCisrKyBiL2NvbXBpbGVyL2NwcC9zcmMvdGhyaWZ0L3RocmlmdHkueXkKQEAgLTAsMCArMSwxMjAxIEBACislY29kZSByZXF1aXJlcyB7CisjaW5jbHVkZSAidGhyaWZ0L3BhcnNlL3RfcHJvZ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ICAgICAgIHRkb2M7CisgIHRfdHlwZSogICAgICAgIHR0eXBlOworICB0X2Jhc2VfdHlwZSogICB0YmFzZTsKKyAgdF90eXBlZGVmKiAgICAgdHR5cGVkZWY7CisgIHRfZW51bSogICAgICAgIHRlbnVtOworICB0X2VudW1fdmFsdWUqICB0ZW51bXY7CisgIHRfY29uc3QqICAgICAgIHRjb25zdDsKKyAgdF9jb25zdF92YWx1ZSogdGNvbnN0djsKKyAgdF9zdHJ1Y3QqICAgICAgdHN0cnVjdDsKKyAgdF9zZXJ2aWNlKiAgICAgdHNlcnZpY2U7CisgIHRfZnVuY3Rpb24qICAgIHRmdW5jdGlvbjsKKyAgdF9maWVsZCogICAgICAgdGZpZWxkOworICBjaGFyKiAgICAgICAgICBkdGV4dDsKKyAgdF9maWVsZDo6ZV9yZXEgZXJlcTsKKyAgdF9hbm5vdGF0aW9uKiAgdGFubm90OworICB0X2ZpZWxkX2lkICAgICB0ZmllbGRpZDsKK30KKworLyoqCisgKiBTdHJpbmdzIGlkZW50aWZpZXIKKyAqLworJXRva2VuPGlkPiAgICAgdG9rX2lkZW50aWZpZXIKKyV0b2tlbjxpZD4gICAgIHRva19saXRlcmFsCisldG9rZW48ZHRleHQ+ICB0b2tfZG9jdGV4dAorCisvKioKKyAqIENvbnN0YW50IHZhbHVlcworICovCisldG9rZW48aWNvbnN0PiB0b2tfaW50X2NvbnN0YW50CisldG9rZW48ZGNvbnN0PiB0b2tfZHViX2NvbnN0YW50CisKKy8qKgorICogSGVhZGVyIGtleXdvcmRzCisgKi8KKyV0b2tlbiB0b2tfaW5jbHVkZQorJXRva2VuIHRva19uYW1lc3BhY2UKKyV0b2tlbiB0b2tfY3BwX2luY2x1ZGUKKyV0b2tlbiB0b2tfY3BwX3R5cGUKKyV0b2tlbiB0b2tfeHNkX2FsbAorJXRva2VuIHRva194c2Rfb3B0aW9uYWwKKyV0b2tlbiB0b2tfeHNkX25pbGxhYmxlCisldG9rZW4gdG9rX3hzZF9hdHRycworCisvKioKKyAqIEJhc2UgZGF0YXR5cGUga2V5d29yZHMKKyAqLworJXRva2VuIHRva192b2lkCisldG9rZW4gdG9rX2Jvb2wKKyV0b2tlbiB0b2tfc3RyaW5nCisldG9rZW4gdG9rX2JpbmFyeQorJXRva2VuIHRva19zbGlzdAorJXRva2VuIHRva19zZW51bQorJXRva2VuIHRva19pOAorJXRva2VuIHRva19pMTYKKyV0b2tlbiB0b2tfaTMyCisldG9rZW4gdG9rX2k2NAorJXRva2VuIHRva19kb3VibGUKKworLyoqCisgKiBDb21wbGV4IHR5cGUga2V5d29yZHMKKyAqLworJXRva2VuIHRva19tYXAKKyV0b2tlbiB0b2tfbGlzdAorJXRva2VuIHRva19zZXQKKworLyoqCisgKiBGdW5jdGlvbiBtb2RpZmllcnMKKyAqLworJXRva2VuIHRva19vbmV3YXkKKworLyoqCisgKiBUaHJpZnQgbGFuZ3VhZ2Uga2V5d29yZHMKKyAqLworJXRva2VuIHRva190eXBlZGVmCisldG9rZW4gdG9rX3N0cnVjdAorJXRva2VuIHRva194Y2VwdGlvbgorJXRva2VuIHRva190aHJvd3MKKyV0b2tlbiB0b2tfZXh0ZW5kcworJXRva2VuIHRva19zZXJ2aWNlCisldG9rZW4gdG9rX2VudW0KKyV0b2tlbiB0b2tfY29uc3QKKyV0b2tlbiB0b2tfcmVxdWlyZWQKKyV0b2tlbiB0b2tfb3B0aW9uYWwKKyV0b2tlbiB0b2tfdW5pb24KKyV0b2tlbiB0b2tfcmVmZXJlbmNlCisKKy8qKgorICogR3JhbW1hciBub2RlcworICovCisKKyV0eXBlPHR0eXBlPiAgICAgQmFzZVR5cGUKKyV0eXBlPHR0eXBlPiAgICAgU2ltcGxlQmFzZVR5cGUKKyV0eXBlPHR0eXBlPiAgICAgQ29udGFpbmVyVHlwZQorJXR5cGU8dHR5cGU+ICAgICBTaW1wbGVDb250YWluZXJUeXBlCisldHlwZTx0dHlwZT4gICAgIE1hcFR5cGUKKyV0eXBlPHR0eXBlPiAgICAgU2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cmFsCisgICAgeworICAgICAgcGRlYnVnKCJIZWFkZXIgLT4gdG9rX2NwcF9pbmNsdWRlIHRva19saXRlcmFsIik7CisgICAgICBkZWNsYXJlX3ZhbGlkX3Byb2dyYW1fZG9jdGV4dCgpOworICAgICAgaWYgKGdfcGFyc2VfbW9kZSA9PSBQUk9HUkFNKSB7CisgICAgICAgIGdfcHJvZ3JhbS0+YWRkX2NwcF9pbmNsdWRlKCQyKTsKKyAgICAgIH0KKyAgICB9CisKK0luY2x1ZGU6CisgIHRva19pbmNsdWRlIHRva19saXRlcmFsCisgICAgeworICAgICAgcGRlYnVnKCJJbmNsdWRlIC0+IHRva19pbmNsdWRlIHRva19saXRlcmFsIik7CisgICAgICBkZWNsYXJlX3ZhbGlkX3Byb2dyYW1fZG9jdGV4dCgpOworICAgICAgaWYgKGdfcGFyc2VfbW9kZSA9PSBJTkNMVURFUykgeworICAgICAgICBzdGQ6OnN0cmluZyBwYXRoID0gaW5jbHVkZV9maWxlKHN0ZDo6c3RyaW5nKCQyKSk7CisgICAgICAgIGlmICghcGF0aC5lbXB0eSgpKSB7CisgICAgICAgICAgZ19wcm9ncmFtLT5hZGRfaW5jbHVkZShwYXRoLCBzdGQ6OnN0cmluZygkMikpOworICAgICAgICB9CisgICAgICB9CisgICAgfQorCitEZWZpbml0aW9uTGlzdDoKKyAgRGVmaW5pdGlvbkxpc3QgQ2FwdHVyZURvY1RleHQgRGVmaW5pdGlvbgorICAgIHsKKyAgICAgIHBkZWJ1ZygiRGVmaW5pdGlvbkxpc3QgLT4gRGVmaW5pdGlvbkxpc3QgRGVmaW5pdGlvbiIpOworICAgICAgaWYgKCQyICE9IE5VTEwgJiYgJDMgIT0gTlVMTCkgeworICAgICAgICAkMy0+c2V0X2RvYygkMik7CisgICAgICB9CisgICAgfQorfAorICAgIHsKKyAgICAgIHBkZWJ1ZygiRGVmaW5pdGlvbkxpc3QgLT4gIik7CisgICAgfQorCitEZWZpbml0aW9uOgorICBDb25zdAorICAgIHsK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VydmljZShnX3BhcmVudF9wcmVmaXggKyAkMS0+Z2V0X25hbWUoKSwgJDEpOworICAgICAgICB9CisgICAgICAgIGdfcHJvZ3JhbS0+YWRkX3NlcnZpY2UoJDEpOworICAgICAgICBpZiAoISBnX3Byb2dyYW0tPmlzX3VuaXF1ZV90eXBlbmFtZSgkMSkpIHsKKyAgICAgICAgICB5eWVycm9yKCJUeXBlIFwiJXNcIiBpcyBhbHJlYWR5IGRlZmluZWQuIiwgJDEtPmdldF9uYW1lKCkuY19zdHIoKSk7CisgICAgICAgICAgZXhpdCgxKTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgJCQgPSAkMTsKKyAgICB9CisKK1R5cGVEZWZpbml0aW9uOgorICBUeXBlZGVmCisgICAgeworICAgICAgcGRlYnVnKCJUeXBlRGVmaW5pdGlvbiAtPiBUeXBlZGVmIik7CisgICAgICBpZiAoZ19wYXJzZV9tb2RlID09IFBST0dSQU0pIHsKKyAgICAgICAgZ19wcm9ncmFtLT5hZGRfdHlwZWRlZigkMSk7CisgICAgICB9CisgICAgfQorfCBFbnVtCisgICAgeworICAgICAgcGRlYnVnKCJUeXBlRGVmaW5pdGlvbiAtPiBFbnVtIik7CisgICAgICBpZiAoZ19wYXJzZV9tb2RlID09IFBST0dSQU0pIHsKKyAgICAgICAgZ19wcm9ncmFtLT5hZGRfZW51bSgkMSk7CisgICAgICB9CisgICAgfQorfCBTZW51bQorICAgIHsKKyAgICAgIHBkZWJ1ZygiVHlwZURlZmluaXRpb24gLT4gU2VudW0iKTsKKyAgICAgIGlmIChnX3BhcnNlX21vZGUgPT0gUFJPR1JBTSkgeworICAgICAgICBnX3Byb2dyYW0tPmFkZF90eXBlZGVmKCQxKTsKKyAgICAgIH0KKyAgICB9Cit8IFN0cnVjdAorICAgIHsKKyAgICAgIHBkZWJ1ZygiVHlwZURlZmluaXRpb24gLT4gU3RydWN0Iik7CisgICAgICBpZiAoZ19wYXJzZV9tb2RlID09IFBST0dSQU0pIHsKKyAgICAgICAgZ19wcm9ncmFtLT5hZGRfc3RydWN0KCQxKTsKKyAgICAgIH0KKyAgICB9Cit8IFhjZXB0aW9uCisgICAgeworICAgICAgcGRlYnVnKCJUeXBlRGVmaW5pdGlvbiAtPiBYY2VwdGlvbiIpOworICAgICAgaWYgKGdfcGFyc2VfbW9kZSA9PSBQUk9HUkFNKSB7CisgICAgICAgIGdfcHJvZ3JhbS0+YWRkX3hjZXB0aW9uKCQxKTsKKyAgICAgIH0KKyAgICB9CisKK0NvbW1hT3JTZW1pY29sb25PcHRpb25hbDoKKyAgJywnCisgICAge30KK3wgJzsnCisgICAge30KK3wKKyAgICB7fQorCitUeXBlZGVmOgorICB0b2tfdHlwZWRlZiBGaWVsZFR5cGUgdG9rX2lkZW50aWZpZXIgVHlwZUFubm90YXRpb25zIENvbW1hT3JTZW1pY29sb25PcHRpb25hbAorICAgIHsKKyAgICAgIHBkZWJ1ZygiVHlwZURlZiAtPiB0b2tfdHlwZWRlZiBGaWVsZFR5cGUgdG9rX2lkZW50aWZpZXIiKTsKKyAgICAgIHZhbGlkYXRlX3NpbXBsZV9pZGVudGlmaWVyKCAkMyk7CisgICAgICB0X3R5cGVkZWYgKnRkID0gbmV3IHRfdHlwZWRlZihnX3Byb2dyYW0sICQyLCAkMyk7CisgICAgICAkJCA9IHRkOworICAgICAgaWYgKCQ0ICE9IE5VTEwpIHsKKyAgICAgICAgJCQtPmFubm90YXRpb25zXyA9ICQ0LT5hbm5vdGF0aW9uc187CisgICAgICAgIGRlbGV0ZSAkNDsKKyAgICAgIH0KKyAgICB9CisKK0VudW06CisgIHRva19lbnVtIHRva19pZGVudGlmaWVyICd7JyBFbnVtRGVmTGlzdCAnfScgVHlwZUFubm90YXRpb25zCisgICAgeworICAgICAgcGRlYnVnKCJFbnVtIC0+IHRva19lbnVtIHRva19pZGVudGlmaWVyIHsgRW51bURlZkxpc3QgfSIpOworICAgICAgJCQgPSAkNDsKKyAgICAgIHZhbGlkYXRlX3NpbXBsZV9pZGV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nQoZ19wYXJlbnRfcHJlZml4ICsgY29uc3RfbmFtZSwgbmV3IHRfY29uc3QoZ190eXBlX2kzMiwgKCpjX2l0ZXIpLT5nZXRfbmFtZSgpLCBjb25zdF92YWwpKTsKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9CisKK0VudW1EZWZMaXN0OgorICBFbnVtRGVmTGlzdCBFbnVtRGVmCisgICAgeworICAgICAgcGRlYnVnKCJFbnVtRGVmTGlzdCAtPiBFbnVtRGVmTGlzdCBFbnVtRGVmIik7CisgICAgICAkJCA9ICQxOworICAgICAgJCQtPmFwcGVuZCgkMik7CisgICAgfQorfAorICAgIHsKKyAgICAgIHBkZWJ1ZygiRW51bURlZkxpc3QgLT4gIik7CisgICAgICAkJCA9IG5ldyB0X2VudW0oZ19wcm9ncmFtKTsKKyAgICAgIHlfZW51bV92YWwgPSAtMTsKKyAgICB9CisKK0VudW1EZWY6CisgIENhcHR1cmVEb2NUZXh0IEVudW1WYWx1ZSBUeXBlQW5ub3RhdGlvbnMgQ29tbWFPclNlbWljb2xvbk9wdGlvbmFsCisgICAgeworICAgICAgcGRlYnVnKCJFbnVtRGVmIC0+IEVudW1WYWx1ZSIpOworICAgICAgJCQgPSAkMjsKKyAgICAgIGlmICgkMSAhPSBOVUxMKSB7CisgICAgICAgICQkLT5zZXRfZG9jKCQxKTsKKyAgICAgIH0KKwkgIGlmICgkMyAhPSBOVUxMKSB7CisgICAgICAgICQkLT5hbm5vdGF0aW9uc18gPSAkMy0+YW5ub3RhdGlvbnNfOworICAgICAgICBkZWxldGUgJDM7CisgICAgICB9CisgICAgfQorCitFbnVtVmFsdWU6CisgIHRva19pZGVudGlmaWVyICc9JyB0b2tfaW50X2NvbnN0YW50CisgICAgeworICAgICAgcGRlYnVnKCJFbnVtVmFsdWUgLT4gdG9rX2lkZW50aWZpZXIgPSB0b2tfaW50X2NvbnN0YW50Iik7CisgICAgICBpZiAoJDMgPCBJTlQzMl9NSU4gfHwgJD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ICAgJCQgPSBuZXcgdF9lbnVtX3ZhbHVlKCQxLCB5X2VudW1fdmFsKTsKKyAgICB9CisKK1NlbnVtOgorICB0b2tfc2VudW0gdG9rX2lkZW50aWZpZXIgJ3snIFNlbnVtRGVmTGlzdCAnfScgVHlwZUFubm90YXRpb25zCisgICAgeworICAgICAgcGRlYnVnKCJTZW51bSAtPiB0b2tfc2VudW0gdG9rX2lkZW50aWZpZXIgeyBTZW51bURlZkxpc3QgfSIpOworICAgICAgdmFsaWRhdGVfc2ltcGxlX2lkZW50aWZpZXIoICQyKTsKKyAgICAgICQkID0gbmV3IHRfdHlwZWRlZihnX3Byb2dyYW0sICQ0LCAkMik7CisgICAgICBpZiAoJDYgIT0gTlVMTCkgeworICAgICAgICAkJC0+YW5ub3RhdGlvbnNfID0gJDYtPmFubm90YXRpb25zXzsKKyAgICAgICAgZGVsZXRlICQ2OworICAgICAgfQorICAgIH0KKworU2VudW1EZWZMaXN0OgorICBTZW51bURlZkxpc3QgU2VudW1EZWYKKyAgICB7CisgICAgICBwZGVidWcoIlNlbnVtRGVmTGlzdCAtPiBTZW51bURlZkxpc3QgU2VudW1EZWYiKTsKKyAgICAgICQkID0gJDE7CisgICAgICAkJC0+YWRkX3N0cmluZ19lbnVtX3ZhbCgkMik7CisgICAgfQorfAorICAgIHsKKyAgICAgIHBkZWJ1ZygiU2VudW1EZWZMaXN0IC0+ICIpOworICAgICAgJCQgPSBuZXcgdF9iYXNlX3R5cGUoInN0cmluZyIsIHRfYmFzZV90eXBlOjpUWVBFX1NUUklORyk7CisgICAgICAkJC0+c2V0X3N0cmluZ19lbnVtKHRydWUpOworICAgIH0KKworU2VudW1EZWY6CisgIHRva19saXRlcmFsIENvbW1hT3JTZW1pY29sb25PcHRpb25hbAorICAgIHsKKyAgICAgIHBkZWJ1ZygiU2VudW1EZWYgLT4gdG9rX2xpdGVyYWwiKTsKKyAgICAgICQkID0gJDE7CisgICAgfQorCitDb25zdDoKKyAgdG9rX2NvbnN0IEZpZWxkVHlwZSB0b2tfaWRlbnRpZmllciAnPScgQ29uc3RWYWx1ZSBDb21tYU9yU2VtaWNvbG9uT3B0aW9uYWwKKyAgICB7CisgICAgICBwZGVidWcoIkNvbnN0IC0+IHRva19jb25zdCBGaWVsZFR5cGUgdG9rX2lkZW50aWZpZXIgPSBDb25zdFZhbHVlIik7CisgICAgICBpZiAoZ19wYXJzZV9tb2RlID09IFBST0dSQU0pIHsKKyAgICAgICAgdmFsaWRhdGVfc2ltcGxlX2lkZW50aWZpZXIoICQzKTsKKyAgICAgICAgZ19zY29wZS0+cmVzb2x2ZV9jb25zdF92YWx1ZSgkNSwgJDIpOworICAgICAgICAkJCA9IG5ldyB0X2NvbnN0KCQyLCAkMywgJDUpOworICAgICAgICB2YWxpZGF0ZV9jb25zdF90eXBlKCQkKTsKKworICAgICAgICBnX3Njb3BlLT5hZGRfY29uc3RhbnQoJDMsICQkKTsKKyAgICAgICAgaWYgKGdfcGFyZW50X3Njb3BlICE9IE5VTEwpIHsKKyAgICAgICAgICBnX3BhcmVudF9zY29wZS0+YWRkX2NvbnN0YW50KGdfcGFyZW50X3ByZWZpeCArICQzLCAkJCk7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSB7CisgICAgICAgICQkID0gTlVMTDsKKyAgICAgIH0KKyAgICB9CisKK0NvbnN0VmFsdWU6CisgIHRva19pbnRfY29uc3RhbnQKKyAgICB7CisgICAgICBwZGVidWcoIkNvbnN0VmFsdWUgPT4gdG9rX2ludF9jb25zdGFudCIpOworICAgICAgJCQgPSBuZXcgdF9jb25zdF92YWx1ZSgpOworICAgICAgJCQtPnNldF9pbnRlZ2VyKCQxKTsKKyAgICAgIGlmICghZ19hbGxvd182NGJpdF9jb25zdHMgJiYgKCQxIDwgSU5UMzJfTUlOIHx8ICQxID4gSU5UMzJfTUFYKSkgeworICAgICAgICBwd2FybmluZygxLCAiNjQtYml0IGNvbnN0YW50IFwiJSIgUFJJaTY0IlwiIG1heSBub3Qgd29yayBpbiBhb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aXN0Q29udGVudHMgPT4gQ29uc3RMaXN0Q29udGVudHMgQ29uc3RWYWx1ZSBDb21tYU9yU2VtaWNvbG9uT3B0aW9uYWwiKTsKKyAgICAgICQkID0gJDE7CisgICAgICAkJC0+YWRkX2xpc3QoJDIpOworICAgIH0KK3wKKyAgICB7CisgICAgICBwZGVidWcoIkNvbnN0TGlzdENvbnRlbnRzID0+Iik7CisgICAgICAkJCA9IG5ldyB0X2NvbnN0X3ZhbHVlKCk7CisgICAgICAkJC0+c2V0X2xpc3QoKTsKKyAgICB9CisKK0NvbnN0TWFwOgorICAneycgQ29uc3RNYXBDb250ZW50cyAnfScKKyAgICB7CisgICAgICBwZGVidWcoIkNvbnN0TWFwID0+IHsgQ29uc3RNYXBDb250ZW50cyB9Iik7CisgICAgICAkJCA9ICQyOworICAgIH0KKworQ29uc3RNYXBDb250ZW50czoKKyAgQ29uc3RNYXBDb250ZW50cyBDb25zdFZhbHVlICc6JyBDb25zdFZhbHVlIENvbW1hT3JTZW1pY29sb25PcHRpb25hbAorICAgIHsKKyAgICAgIHBkZWJ1ZygiQ29uc3RNYXBDb250ZW50cyA9PiBDb25zdE1hcENvbnRlbnRzIENvbnN0VmFsdWUgQ29tbWFPclNlbWljb2xvbk9wdGlvbmFsIik7CisgICAgICAkJCA9ICQxOworICAgICAgJCQtPmFkZF9tYXAoJDIsICQ0KTsKKyAgICB9Cit8CisgICAgeworICAgICAgcGRlYnVnKCJDb25zdE1hcENvbnRlbnRzID0+Iik7CisgICAgICAkJCA9IG5ldyB0X2NvbnN0X3ZhbHVlKCk7CisgICAgICAkJC0+c2V0X21hcCgpOworICAgIH0KKworU3RydWN0SGVhZDoKKyAgdG9rX3N0cnVjdAorICAgIHsKKyAgICAgICQkID0gc3RydWN0X2lzX3N0cnVjdDsKKyAgICB9Cit8IHRva191bmlvbgorICAgIHsKKyAgICAgICQkID0gc3RydWN0X2lzX3VuaW9uOworICAgIH0KKworU3RydWN0OgorICBTdHJ1Y3RIZWFkIHRva19pZGVudGlmaWVyIFhzZEFsbCAneycgRmllbGRMaXN0ICd9JyBUeXBlQW5ub3RhdGlvbnMKKyAgICB7CisgICAgICBwZGVidWcoIlN0cnVjdCAtPiB0b2tfc3RydWN0IHRva19pZGVudGlmaWVyIHsgRmllbGRMaXN0IH0iKTsKKyAgICAgIHZhbGlkYXRlX3NpbXBsZV9pZGVudGlmaWVyKCAkMik7CisgICAgICAkNS0+c2V0X3hzZF9hbGwoJDMpOworICAgICAgJDUtPnNldF91bmlvbigkMSA9PSBzdHJ1Y3RfaXNfdW5pb24pOworICAgICAgJCQgPSAkNTsKKyAgICAgICQkLT5zZXRfbmFtZSgkMik7CisgICAgICBpZiAoJDcgIT0gTlVMTCkgeworICAgICAgICAkJC0+YW5ub3RhdGlvbnNfID0gJDctPmFubm90YXRpb25zXzsKKyAgICAgICAgZGVsZXRlICQ3OworICAgICAgfQorICAgIH0KKworWHNkQWxsOgorICB0b2tfeHNkX2FsbAorICAgIHsKKyAgICAgICQkID0gdHJ1ZTsKKyAgICB9Cit8CisgICAgeworICAgICAgJCQgPSBmYWxzZTsKKyAgICB9CisKK1hzZE9wdGlvbmFsOgorICB0b2tfeHNkX29wdGlvbmFsCisgICAgeworICAgICAgJCQgPSB0cnVlOworICAgIH0KK3wKKyAgICB7CisgICAgICAkJCA9IGZhbHNlOworICAgIH0KKworWHNkTmlsbGFibGU6CisgIHRva194c2RfbmlsbGFibGUKKyAgICB7CisgICAgICAkJCA9IHRydWU7CisgICAgfQorfAorICAgIHsKKyAgICAgICQkID0gZmFsc2U7CisgICAgfQorCitYc2RBdHRyaWJ1dGVzOgorICB0b2tfeHNkX2F0dHJzICd7JyBGaWVsZExpc3QgJ30nCisgICAgeworICAgICAgJCQgPSAkMzsKKyAgICB9Cit8CisgICAgeworICAgICAgJCQgPSBOVUxMOworICAgIH0KKworWGNlcHRpb246CisgIHRva194Y2VwdGlvbiB0b2tfaWRlbnRpZmllciAneycgRmllbGRMaXN0ICd9JyBUeXBlQW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aW9uKCQzLCAkNCwgJDYsICQ4LCAkMik7CisgICAgICBpZiAoJDEgIT0gTlVMTCkgeworICAgICAgICAkJC0+c2V0X2RvYygkMSk7CisgICAgICB9CisgICAgICBpZiAoJDkgIT0gTlVMTCkgeworICAgICAgICAkJC0+YW5ub3RhdGlvbnNfID0gJDktPmFubm90YXRpb25zXzsKKyAgICAgICAgZGVsZXRlICQ5OworICAgICAgfQorICAgIH0KKworT25ld2F5OgorICB0b2tfb25ld2F5CisgICAgeworICAgICAgJCQgPSB0cnVlOworICAgIH0KK3wKKyAgICB7CisgICAgICAkJCA9IGZhbHNlOworICAgIH0KKworVGhyb3dzOgorICB0b2tfdGhyb3dzICcoJyBGaWVsZExpc3QgJyknCisgICAgeworICAgICAgcGRlYnVnKCJUaHJvd3MgLT4gdG9rX3Rocm93cyAoIEZpZWxkTGlzdCApIik7CisgICAgICAkJCA9ICQzOworICAgICAgaWYgKGdfcGFyc2VfbW9kZSA9PSBQUk9HUkFNICYmICF2YWxpZGF0ZV90aHJvd3MoJCQpKSB7CisgICAgICAgIHl5ZXJyb3IoIlRocm93cyBjbGF1c2UgbWF5IG5vdCBjb250YWluIG5vbi1leGNlcHRpb24gdHlwZXMiKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICAgIH0KKyAgICB9Cit8CisgICAgeworICAgICAgJCQgPSBuZXcgdF9zdHJ1Y3QoZ19wcm9ncmFtKTsKKyAgICB9CisKK0ZpZWxkTGlzdDoKKyAgRmllbGRMaXN0IEZpZWxkCisgICAgeworICAgICAgcGRlYnVnKCJGaWVsZExpc3QgLT4gRmllbGRMaXN0ICwgRmllbGQiKTsKKyAgICAgICQkID0gJDE7CisgICAgICBpZiAoISgkJC0+YXBwZW5kKCQyKSkpIHsKKyAgICAgICAgeXllcnJvcigiXCIlZDogJXNcIiAtIGZpZWxkIGlkZW50aWZpZXIvbmFtZSBoYXMgYWxyZWFkeSBiZWVuIHVzZWQiLCAkMi0+Z2V0X2tleSgpLCAkMi0+Z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ICAgICQkLT5zZXRfcmVmZXJlbmNlKCQ1KTsKKyAgICAgICQkLT5zZXRfcmVxKCQzKTsKKyAgICAgIGlmICgkNyAhPSBOVUxMKSB7CisgICAgICAgIGdfc2NvcGUtPnJlc29sdmVfY29uc3RfdmFsdWUoJDcsICQ0KTsKKyAgICAgICAgdmFsaWRhdGVfZmllbGRfdmFsdWUoJCQsICQ3KTsKKyAgICAgICAgJCQtPnNldF92YWx1ZSgkNyk7CisgICAgICB9CisgICAgICAkJC0+c2V0X3hzZF9vcHRpb25hbCgkOCk7CisgICAgICAkJC0+c2V0X3hzZF9uaWxsYWJsZSgkOSk7CisgICAgICBpZiAoJDEgIT0gTlVMTCkgeworICAgICAgICAkJC0+c2V0X2RvYygkMSk7CisgICAgICB9CisgICAgICBpZiAoJDEwICE9IE5VTEwpIHsKKyAgICAgICAgJCQtPnNldF94c2RfYXR0cnMoJDEwKTsKKyAgICAgIH0KKyAgICAgIGlmICgkMTEgIT0gTlVMTCkgeworICAgICAgICAkJC0+YW5ub3RhdGlvbnNfID0gJDExLT5hbm5vdGF0aW9uc187CisgICAgICAgIGRlbGV0ZSAkMTE7CisgICAgICB9CisgICAgfQorCitGaWVsZElkZW50aWZpZXI6CisgIHRva19pbnRfY29uc3RhbnQgJzonCisgICAgeworICAgICAgaWYgKCQxIDw9IDApIHsKKyAgICAgICAgaWYgKGdfYWxsb3dfbmVnX2ZpZWxkX2tleXMpIHsKKyAgICAgICAgICAvKgorICAgICAgICAgICAqIGdfYWxsb3dfbmVnX2ZpZWxkX2tleXMgZXhpc3RzIHRvIGFsbG93IHVzZXJzIHRvIGFkZCBleHBsaWNpdGx5CisgICAgICAgICAgICogc3BlY2lmaWVkIGtleSB2YWx1ZXMgdG8gb2xkIC50aHJpZnQgZmlsZXMgd2l0aG91dCBicmVha2luZworICAgICAgICAgICAqIHByb3RvY29sIGNvbXBhdGliaWxpdHkuCisgICAgICAgICAgICovCisgICAgICAgICAgaWYgKCQxICE9IHlfZmllbGRfdmFsKSB7CisgICAgICAgICAgICAvKgorICAgICAgICAgICAgICogd2FybiBpZiB0aGUgdXNlci1zcGVjaWZpZWQgbmVnYXRpdmUgdmFsdWUgaXNuJ3Qgd2hhdAorICAgICAgICAgICAgICogdGhyaWZ0IHdvdWxkIGhhdmUgYXV0by1hc3NpZ25lZC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHdhcm5pbmcoMSwgIk5vbnBvc2l0aXZlIGZpZWxkIGtleSAoJSIgUFJJaTY0IikgZGlmZmVycyBmcm9tIHdoYXQgd291bGQgYmUgIgorICAgICAgICAgICAgICAgICAgICAgImF1dG8tYXNzaWduZWQgYnkgdGhyaWZ0ICglZCkuXG4iLCAkMSwgeV9maWVsZF92YWwpOworICAgICAgICAgIH0KKyAgICAgICAgICAvKgorICAgICAgICAgICAqIExlYXZlICQxIGFzLWlzLCBhbmQgdXBkYXRlIHlfZmllbGRfdmFsIHRvIGJlIG9uZSBsZXNzIHRoYW4gJDEuCisgICAgICAgICAgICogVGhlIEZpZWxkTGlzdCBwYXJzaW5nIHdpbGwgY2F0Y2ggYW55IGR1cGxpY2F0ZSBrZXkgdmFsdWVzLgorICAgICAgICAgICAqLworICAgICAgICAgIHlfZmllbGRfdmFsID0gc3RhdGljX2Nhc3Q8aW50MzJfdD4oJDEgLSAxKTsKKyAgICAgICAgICAkJC52YWx1ZSA9IHN0YXRpY19jYXN0PGludDMyX3Q+KCQxKTsKKyAgICAgICAgICAkJC5hdXRvX2Fzc2lnbmVkID0gZmFsc2U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgcHdhcm5pbmcoMSwgIk5vbnBvc2l0aXZlIHZhbHVlICglZCkgbm90IGFsbG93ZWQgYXMgYSBmaWVsZCBrZXkuXG4iLAorICAgICAgICAgICAgICAgICAgICQxKTsKKyAgICAgICAgICAkJC52YWx1ZSA9IHlfZmllbGRfdmFsLS07CisgICAgICAgICAgJCQuYXV0b19hc3NpZ25lZCA9IHRydWU7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSB7CisgICAgICAgICQkLnZhbHVlID0gc3RhdGljX2Nhc3Q8aW50MzJfdD4oJDEpOworICAgICAgICAkJC5hdXRvX2Fzc2lnbmVkID0gZmFsc2U7CisgICAgICB9CisgICAgICBpZiggKFNIUlRfTUlOID4gJCQudmFsdWUpIHx8ICgkJC52YWx1ZSA+IFNIUlRfTUFYKSkgeworICAgICAgICBwd2FybmluZygxLCAiRmllbGQga2V5ICglZCkgZXhjZWVkcyBhbGxvd2VkIHJhbmdlICglZC4uJWQpLlxuIiwKKyAgICAgICAgICAgICAgICAgJCQudmFsdWUsIFNIUlRfTUlOLCBTSFJUX01BWCk7CisgICAgICB9CisgICAgfQorfAorICAgIHsKKyAgICAgICQkLnZhbHVlID0geV9maWVsZF92YWwtLTsKKyAgICAgICQkLmF1dG9fYXNzaWduZWQgPSB0cnVlOworICAgICAgaWYoIChTSFJUX01JTiA+ICQkLnZhbHVlKSB8fCAoJCQudmFsdWUgPiBTSFJUX01BWCkpIHsKKyAgICAgICAgcHdhcm5pbmcoMSwgIkZpZWxkIGtleSAoJWQpIGV4Y2VlZHMgYWxsb3dlZCByYW5nZSAoJWQuLiVkKS5cbiIsCisgICAgICAgICAgICAgICAgICQkLnZhbHVlLCBTSFJUX01JTiwgU0hSVF9NQVgpOworICAgICAgfQorICAgIH0KKworRmllbGRSZWZlcmVuY2U6CisgIHRva19yZWZlcmVuY2UKKyAgICB7CisgICAgICAkJCA9IHRydWU7CisgICAgfQorfAorICAgeworICAgICAkJCA9IGZhbHNlOworICAgfQorCitGaWVsZFJlcXVpcmVkbmVzczoKKyAgdG9rX3JlcXVpcmVkCisgICAgeworICAgICAgJCQgPSB0X2ZpZWxkOjpUX1JFUVVJUkVEOworICAgIH0KK3wgdG9rX29wdGlvbmFsCisgICAgeworICAgICAgaWYgKGdfYXJnbGlzdCkgeworICAgICAgICBpZiAoZ19wYXJzZV9tb2RlID09IFBST0dSQU0pIHsKKyAgICAgICAgICBwd2FybmluZygxLCAib3B0aW9uYWwga2V5d29yZCBpcyBpZ25vcmVkIGluIGFyZ3VtZW50IGxpc3RzLlxuIik7CisgICAgICAgIH0KKyAgICAgICAgJCQgPSB0X2ZpZWxkOjpUX09QVF9JTl9SRVFfT1VUOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgJCQgPSB0X2ZpZWxkOjpUX09QVElPTkFMOworICAgICAgfQorICAgIH0KK3wKKyAgICB7CisgICAgICAkJCA9IHRfZmllbGQ6OlRfT1BUX0lOX1JFUV9PVVQ7CisgICAgfQorCitGaWVsZFZhbHVlOgorICAnPScgQ29uc3RWYWx1ZQorICAgIHsKKyAgICAgIGlmIChnX3BhcnNlX21vZGUgPT0gUFJPR1JBTSkgeworICAgICAgICAkJCA9ICQyOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgJCQgPSBOVUxMOworICAgICAgfQorICAgIH0KK3wKKyAgICB7CisgICAgICAkJCA9IE5VTEw7CisgICAgfQorCitGdW5jdGlvblR5cGU6CisgIEZpZWxkVHlwZQorICAgIHsKKyAgICAgIHBkZWJ1ZygiRnVuY3Rpb25UeXBlIC0+IEZpZWxkVHlwZSIpOworICAgICAgJCQgPSAkMTsKKyAgICB9Cit8IHRva192b2lkCisgICAgeworICAgICAgcGRlYnVnKCJGdW5jdGlvblR5cGUgLT4gdG9rX3ZvaWQiKTsKKyAgICAgICQkID0gZ190eXBlX3ZvaWQ7CisgICAgfQorCitGaWVsZFR5cGU6CisgIHRva19pZGVudGlmaWVyCisgICAgeworICAgICAgcGRlYnVnKCJGaWVsZFR5cGUgLT4gdG9rX2lkZW50aWZpZXIiKTsKKyAgICAgIGlmIChnX3BhcnNlX21vZGUgPT0gSU5DTFVERVMpIHsKKyAgICAgICAgLy8gSWdub3JlIGlkZW50aWZpZXJzIGluIGluY2x1ZGUgbW9kZQorICAgICAgICAkJCA9IE5VTEw7CisgICAgICB9IGVsc2UgeworICAgICAgICAvLyBMb29rdXAgdGhlIGlkZW50aWZpZXIgaW4gdGhlIGN1cnJlbnQgc2NvcGUKKyAgICAgICAgJCQgPSBnX3Njb3BlLT5nZXRfdHlwZSgkMSk7CisgICAgICAgIGlmICgkJCA9PSBOVUxMKSB7CisgICAgICAgICAgLyoKKyAgICAgICAgICAgKiBFaXRoZXIgdGhpcyB0eXBlIGlzbid0IHlldCBkZWNsYXJlZCwgb3IgaXQncyBuZXZlcgorICAgICAgICAgICAgIGRlY2xhcmVkLiAgRWl0aGVyIHdheSBhbGxvdyBpdCBhbmQgd2UnbGwgZmlndXJlIGl0IG91dAorICAgICAgICAgICAgIGR1cmluZyBnZW5lcmF0aW9uLgorICAgICAgICAgICAqLworICAgICAgICAgICQkID0gbmV3IHRfdHlwZWRlZihnX3Byb2dyYW0sICQxLCB0cnVlKTsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KK3wgQmFzZVR5cGUKKyAgICB7CisgICAgICBwZGVidWcoIkZpZWxkVHlwZSAtPiBCYXNlVHlwZSIpOworICAgICAgJCQgPSAkMTsKKyAgICB9Cit8IENvbnRhaW5lclR5cGUKKyAgICB7CisgICAgICBwZGVidWcoIkZpZWxkVHlwZSAtPiBDb250YWluZXJUeXBlIik7CisgICAgICAkJCA9ICQxOworICAgIH0KKworQmFzZVR5cGU6IFNpbXBsZUJhc2VUeXBlIFR5cGVBbm5vdGF0aW9ucworICAgIHsKKyAgICAgIHBkZWJ1ZygiQmFzZVR5cGUgLT4gU2ltcGxlQmFzZVR5cGUgVHlwZUFubm90YXRpb25zIik7CisgICAgICBpZiAoJDIgIT0gTlVMTCkgeworICAgICAgICAkJCA9IG5ldyB0X2Jhc2VfdHlwZSgqc3RhdGljX2Nhc3Q8dF9iYXNlX3R5cGUqPigkMSkpOworICAgICAgICAkJC0+YW5ub3RhdGlvbnNfID0gJDItPmFubm90YXRpb25zXzsKKyAgICAgICAgZGVsZXRlICQyOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgJCQgPSAkMTsKKyAgICAgIH0KKyAgICB9CisKK1NpbXBsZUJhc2VUeXBlOgorICB0b2tfc3RyaW5nCisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfc3RyaW5nIik7CisgICAgICAkJCA9IGdfdHlwZV9zdHJpbmc7CisgICAgfQorfCB0b2tfYmluYXJ5CisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfYmluYXJ5Iik7CisgICAgICAkJCA9IGdfdHlwZV9iaW5hcnk7CisgICAgfQorfCB0b2tfc2xpc3QKKyAgICB7CisgICAgICBwZGVidWcoIkJhc2VUeXBlIC0+IHRva19zbGlzdCIpOworICAgICAgJCQgPSBnX3R5cGVfc2xpc3Q7CisgICAgfQorfCB0b2tfYm9vbAorICAgIHsKKyAgICAgIHBkZWJ1ZygiQmFzZVR5cGUgLT4gdG9rX2Jvb2wiKTsKKyAgICAgICQkID0gZ190eXBlX2Jvb2w7CisgICAgfQorfCB0b2tfaTgKKyAgICB7CisgICAgICBwZGVidWcoIkJhc2VUeXBlIC0+IHRva19pOCIpOworICAgICAgJCQgPSBnX3R5cGVfaTg7CisgICAgfQorfCB0b2tfaTE2CisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfaTE2Iik7CisgICAgICAkJCA9IGdfdHlwZV9pMTY7CisgICAgfQorfCB0b2tfaTMyCisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfaTMyIik7CisgICAgICAkJCA9IGdfdHlwZV9pMzI7CisgICAgfQorfCB0b2tfaTY0CisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfaTY0Iik7CisgICAgICAkJCA9IGdfdHlwZV9pNjQ7CisgICAgfQorfCB0b2tfZG91YmxlCisgICAgeworICAgICAgcGRlYnVnKCJCYXNlVHlwZSAtPiB0b2tfZG91YmxlIik7CisgICAgICAkJCA9IGdfdHlwZV9kb3VibGU7CisgICAgfQorCitDb250YWluZXJUeXBlOiBTaW1wbGVDb250YWluZXJUeXBlIFR5cGVBbm5vdGF0aW9ucworICAgIHsKKyAgICAgIHBkZWJ1ZygiQ29udGFpbmVyVHlwZSAtPiBTaW1wbGVDb250YWluZXJUeXBlIFR5cGVBbm5vdGF0aW9ucyIpOworICAgICAgJCQgPSAkMTsKKyAgICAgIGlmICgkMiAhPSBOVUxMKSB7CisgICAgICAgICQkLT5hbm5vdGF0aW9uc18gPSAkMi0+YW5ub3RhdGlvbnNfOworICAgICAgICBkZWxldGUgJDI7CisgICAgICB9CisgICAgfQorCitTaW1wbGVDb250YWluZXJUeXBlOgorICBNYXBUeXBlCisgICAgeworICAgICAgcGRlYnVnKCJTaW1wbGVDb250YWluZXJUeXBlIC0+IE1hcFR5cGUiKTsKKyAgICAgICQkID0gJDE7CisgICAgfQorfCBTZXRUeXBlCisgICAgeworICAgICAgcGRlYnVnKCJTaW1wbGVDb250YWluZXJUeXBlIC0+IFNldFR5cGUiKTsKKyAgICAgICQkID0gJDE7CisgICAgfQorfCBMaXN0VHlwZQorICAgIHsKKyAgICAgIHBkZWJ1ZygiU2ltcGxlQ29udGFpbmVyVHlwZSAtPiBMaXN0VHlwZSIpOworICAgICAgJCQgPSAkMTsKKyAgICB9CisKK01hcFR5cGU6CisgIHRva19tYXAgQ3BwVHlwZSAnPCcgRmllbGRUeXBlICcsJyBGaWVsZFR5cGUgJz4nCisgICAgeworICAgICAgcGRlYnVnKCJNYXBUeXBlIC0+IHRva19tYXAgPEZpZWxkVHlwZSwgRmllbGRUeXBlPiIpOworICAgICAgJCQgPSBuZXcgdF9tYXAoJDQsICQ2KTsKKyAgICAgIGlmICgkMiAhPSBOVUxMKSB7CisgICAgICAgICgodF9jb250YWluZXIqKSQkKS0+c2V0X2NwcF9uYW1lKHN0ZDo6c3RyaW5nKCQyKSk7CisgICAgICB9CisgICAgfQorCitTZXRUeXBlOgorICB0b2tfc2V0IENwcFR5cGUgJzwnIEZpZWxkVHlwZSAnPicKKyAgICB7CisgICAgICBwZGVidWcoIlNldFR5cGUgLT4gdG9rX3NldDxGaWVsZFR5cGU+Iik7CisgICAgICAkJCA9IG5ldyB0X3NldCgkNCk7CisgICAgICBpZiAoJDIgIT0gTlVMTCkgeworICAgICAgICAoKHRfY29udGFpbmVyKikkJCktPnNldF9jcHBfbmFtZShzdGQ6OnN0cmluZygkMikpOworICAgICAgfQorICAgIH0KKworTGlzdFR5cGU6CisgIHRva19saXN0ICc8JyBGaWVsZFR5cGUgJz4nIENwcFR5cGUKKyAgICB7CisgICAgICBwZGVidWcoIkxpc3RUeXBlIC0+IHRva19saXN0PEZpZWxkVHlwZT4iKTsKKyAgICAgIGNoZWNrX2Zvcl9saXN0X29mX2J5dGVzKCQzKTsKKyAgICAgICQkID0gbmV3IHRfbGlzdCgkMyk7CisgICAgICBpZiAoJDUgIT0gTlVMTCkgeworICAgICAgICAoKHRfY29udGFpbmVyKikkJCktPnNldF9jcHBfbmFtZShzdGQ6OnN0cmluZygkNSkpOworICAgICAgfQorICAgIH0KKworQ3BwVHlwZToKKyAgdG9rX2NwcF90eXBlIHRva19saXRlcmFsCisgICAgeworICAgICAgJCQgPSAkMjsKKyAgICB9Cit8CisgICAgeworICAgICAgJCQgPSBOVUxMOworICAgIH0KKworVHlwZUFubm90YXRpb25zOgorICAnKCcgVHlwZUFubm90YXRpb25MaXN0ICcpJworICAgIHsKKyAgICAgIHBkZWJ1ZygiVHlwZUFubm90YXRpb25zIC0+ICggVHlwZUFubm90YXRpb25MaXN0ICkiKTsKKyAgICAgICQkID0gJDI7CisgICAgfQorfAorICAgIHsKKyAgICAgICQkID0gTlVMTDsKKyAgICB9CisKK1R5cGVBbm5vdGF0aW9uTGlzdDoKKyAgVHlwZUFubm90YXRpb25MaXN0IFR5cGVBbm5vdGF0aW9uCisgICAgeworICAgICAgcGRlYnVnKCJUeXBlQW5ub3RhdGlvbkxpc3QgLT4gVHlwZUFubm90YXRpb25MaXN0ICwgVHlwZUFubm90YXRpb24iKTsKKyAgICAgICQkID0gJDE7CisgICAg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LCBzbyBubyBuZWVkIGZvciB5eXdyYXAKLSAqLwotJW9wdGlvbiBub3l5d3JhcAotCi0vKioKLSAqIFdlIGRvbid0IHVzZSBpdCwgYW5kIGl0IGZpcmVzIHVwIHdhcm5pbmdzIGF0IC1XYWxsCi0gKi8KLSVvcHRpb24gbm91bnB1dAotCi0vKioKLSAqIEhlbHBlciBkZWZpbml0aW9ucywgY29tbWVudHMsIGNvbnN0YW50cywgYW5kIHdoYXRub3QKLSAqLwotCi1pbnRjb25zdGFudCAgIChbKy1dP1swLTldKykKLWhleGNvbnN0YW50ICAgKCIweCJbMC05QS1GYS1mXSspCi1kdWJjb25zdGFudCAgIChbKy1dP1swLTldKihcLlswLTldKyk/KFtlRV1bKy1dP1swLTldKyk/KQotaWRlbnRpZmllciAgICAoW2EtekEtWl9dKFwuW2EtekEtWl8wLTldfFthLXpBLVpfMC05XSkqKQotd2hpdGVzcGFjZSAgICAoWyBcdFxyXG5dKikKLXNpbGx5Y29tbSAgICAgKCIvKiIiKiIqIiovIikKLW11bHRpY29tbSAgICAgKCIvKiJbXipdIi8iKihbXiovXXxbXipdIi8ifCIqIlteL10pKiIqIioiKi8iKQotZG9jdGV4dCAgICAgICAoIi8qKiIoW14qL118W14qXSIvInwiKiJbXi9dKSoiKiIqIiovIikKLWNvbW1lbnQgICAgICAgKCIvLyJbXlxuXSopCi11bml4Y29tbWVudCAgICgiIyJbXlxuXSopCi1zeW1ib2wgICAgICAgIChbOjtcLFx7XH1cKFwpXD08PlxbXF1dKQotc3RfaWRlbnRpZmllciAoW2EtekEtWi1dKFwuW2EtekEtWl8wLTktXXxbYS16QS1aXzAtOS1dKSopCi1saXRlcmFsX2JlZ2luIChbJ1wiXSkKLQotJSUKLQote3doaXRlc3BhY2V9ICAgICAgICAgeyAvKiBkbyBub3RoaW5nICovICAgICAgICAgICAgICAgICB9Ci17c2lsbHljb21tfSAgICAgICAgICB7IC8qIGRvIG5vdGhpbmcgKi8gICAgICAgICAgICAgICAgIH0KLXttdWx0aWNvbW19ICAgICAgICAgIHsgLyogZG8gbm90aGluZyAqLyAgICAgICAgICAgICAgICAgfQote2NvbW1lbnR9ICAgICAgICAgICAgeyAvKiBkbyBub3RoaW5nICovICAgICAgICAgICAgICAgICB9Ci17dW5peGNvbW1lbnR9ICAgICAgICB7IC8qIGRvIG5vdGhpbmcgKi8gICAgICAgICAgICAgICAgIH0KLQote3N5bWJvbH0gICAgICAgICAgICAgeyByZXR1cm4geXl0ZXh0WzBdOyAgICAgICAgICAgICAgICB9Ci0iKiIgICAgICAgICAgICAgICAgICB7IHJldHVybiB5eXRleHRbMF07ICAgICAgICAgICAgICAgIH0KLQotImZhbHNlIiAgICAgICAgICAgICAgeyB5eWx2YWwuaWNvbnN0PTA7IHJldHVybiB0b2tfaW50X2NvbnN0YW50OyB9Ci0idHJ1ZSIgICAgICAgICAgICAgICB7IHl5bHZhbC5pY29uc3Q9MTsgcmV0dXJuIHRva19pbnRfY29uc3RhbnQ7IH0KLQotIm5hbWVzcGFjZSIgICAgICAgICAgeyByZXR1cm4gdG9rX25hbWVzcGFjZTsgICAgICAgICAgICB9Ci0iY3BwX25hbWVzcGFjZSIgICAgICB7IHJldHVybiB0b2tfY3BwX25hbWVzcGFjZTsgICAgICAgIH0KLSJjcHBfaW5jbHVkZSIgICAgICAgIHsgcmV0dXJuIHRva19jcHBfaW5jbHVkZTsgICAgICAgICAgfQotImNwcF90eXBlIiAgICAgICAgICAgeyByZXR1cm4gdG9rX2NwcF90eXBlOyAgICAgICAgICAgICB9Ci0iamF2YV9wYWNrYWdlIiAgICAgICB7IHJldHVybiB0b2tfamF2YV9wYWNrYWdlOyAgICAgICAgIH0KLSJjb2NvYV9wcmVmaXgiICAgICAgIHsgcmV0dXJuIHRva19jb2NvYV9wcmVmaXg7ICAgICAgICAgfQotImNzaGFycF9uYW1lc3BhY2UiICAgeyByZXR1cm4gdG9rX2NzaGFycF9uYW1lc3BhY2U7ICAgICB9Ci0iZGVscGhpX25hbWVzcGFjZSIgICB7IHJldHVybiB0b2tfZGVscGhpX25hbWVzcGFjZTsgICAgIH0KLSJwaHBfbmFtZXNwYWNlIiAgICAgIHsgcmV0dXJuIHRva19waHBfbmFtZXNwYWNlOyAgICAgICAgfQotInB5X21vZHVsZSIgICAgICAgICAgeyByZXR1cm4gdG9rX3B5X21vZHVsZTsgICAgICAgICAgICB9Ci0icGVybF9wYWNrYWdlIiAgICAgICB7IHJldHVybiB0b2tfcGVybF9wYWNrYWdlOyAgICAgICAgIH0KLSJydWJ5X25hbWVzcGFjZSIgICAgIHsgcmV0dXJuIHRva19ydWJ5X25hbWVzcGFjZTsgICAgICAgfQotInNtYWxsdGFsa19jYXRlZ29yeSIgeyByZXR1cm4gdG9rX3NtYWxsdGFsa19jYXRlZ29yeTsgICB9Ci0ic21hbGx0YWxrX3ByZWZpeCIgICB7IHJldHVybiB0b2tfc21hbGx0YWxrX3ByZWZpeDsgICAgIH0KLSJ4c2RfYWxsIiAgICAgICAgICAgIHsgcmV0dXJuIHRva194c2RfYWxsOyAgICAgICAgICAgICAgfQotInhzZF9vcHRpb25hbCIgICAgICAgeyByZXR1cm4gdG9rX3hzZF9vcHRpb25hbDsgICAgICAgICB9Ci0ieHNkX25pbGxhYmxlIiAgICAgICB7IHJldHVybiB0b2tfeHNkX25pbGxhYmxlOyAgICAgICAgIH0KLSJ4c2RfbmFtZXNwYWNlIiAgICAgIHsgcmV0dXJuIHRva194c2RfbmFtZXNwYWNlOyAgICAgICAgfQotInhzZF9hdHRycyIgICAgICAgICAgeyByZXR1cm4gdG9rX3hzZF9hdHRyczsgICAgICAgICAgICB9Ci0iaW5jbHVkZSIgICAgICAgICAgICB7IHJldHVybiB0b2tfaW5jbHVkZTsgICAgICAgICAgICAgIH0KLSJ2b2lkIiAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva192b2lkOyAgICAgICAgICAgICAgICAgfQotImJvb2wiICAgICAgICAgICAgICAgeyByZXR1cm4gdG9rX2Jvb2w7ICAgICAgICAgICAgICAgICB9Ci0iYnl0ZSIgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfYnl0ZTsgICAgICAgICAgICAgICAgIH0KLSJpMTYiICAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19pMTY7ICAgICAgICAgICAgICAgICAgfQotImkzMiIgICAgICAgICAgICAgICAgeyByZXR1cm4gdG9rX2kzMjsgICAgICAgICAgICAgICAgICB9Ci0iaTY0IiAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfaTY0OyAgICAgICAgICAgICAgICAgIH0KLSJkb3VibGUiICAgICAgICAgICAgIHsgcmV0dXJuIHRva19kb3VibGU7ICAgICAgICAgICAgICAgfQotInN0cmluZyIgICAgICAgICAgICAgeyByZXR1cm4gdG9rX3N0cmluZzsgICAgICAgICAgICAgICB9Ci0iYmluYXJ5IiAgICAgICAgICAgICB7IHJldHVybiB0b2tfYmluYXJ5OyAgICAgICAgICAgICAgIH0KLSJzbGlzdCIgewotICBwd2FybmluZygwLCAiXCJzbGlzdFwiIGlzIGRlcHJlY2F0ZWQgYW5kIHdpbGwgYmUgcmVtb3ZlZCBpbiBhIGZ1dHVyZSBjb21waWxlciB2ZXJzaW9uLiAgVGhpcyB0eXBlIHNob3VsZCBiZSByZXBsYWNlZCB3aXRoIFwic3RyaW5nXCIuXG4iKTsKLSAgcmV0dXJuIHRva19zbGlzdDsKLX0KLSJzZW51bSIgewotICBwd2FybmluZygwLCAiXCJzZW51bVwiIGlzIGRlcHJlY2F0ZWQgYW5kIHdpbGwgYmUgcmVtb3ZlZCBpbiBhIGZ1dHVyZSBjb21waWxlciB2ZXJzaW9uLiAgVGhpcyB0eXBlIHNob3VsZCBiZSByZXBsYWNlZCB3aXRoIFwic3RyaW5nXCIuXG4iKTsKLSAgcmV0dXJuIHRva19zZW51bTsKLX0KLSJtYXAiICAgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19tYXA7ICAgICAgICAgICAgICAgICAgfQotImxpc3QiICAgICAgICAgICAgICAgeyByZXR1cm4gdG9rX2xpc3Q7ICAgICAgICAgICAgICAgICB9Ci0ic2V0IiAgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfc2V0OyAgICAgICAgICAgICAgICAgIH0KLSJvbmV3YXkiICAgICAgICAgICAgIHsgcmV0dXJuIHRva19vbmV3YXk7ICAgICAgICAgICAgICAgfQotInR5cGVkZWYiICAgICAgICAgICAgeyByZXR1cm4gdG9rX3R5cGVkZWY7ICAgICAgICAgICAgICB9Ci0ic3RydWN0IiAgICAgICAgICAgICB7IHJldHVybiB0b2tfc3RydWN0OyAgICAgICAgICAgICAgIH0KLSJ1bmlvbiIgICAgICAgICAgICAgIHsgcmV0dXJuIHRva191bmlvbjsgICAgICAgICAgICAgICAgfQotImV4Y2VwdGlvbiIgICAgICAgICAgeyByZXR1cm4gdG9rX3hjZXB0aW9uOyAgICAgICAgICAgICB9Ci0iZXh0ZW5kcyIgICAgICAgICAgICB7IHJldHVybiB0b2tfZXh0ZW5kczsgICAgICAgICAgICAgIH0KLSJ0aHJvd3MiICAgICAgICAgICAgIHsgcmV0dXJuIHRva190aHJvd3M7ICAgICAgICAgICAgICAgfQotInNlcnZpY2UiICAgICAgICAgICAgeyByZXR1cm4gdG9rX3NlcnZpY2U7ICAgICAgICAgICAgICB9Ci0iZW51bSIgICAgICAgICAgICAgICB7IHJldHVybiB0b2tfZW51bTsgICAgICAgICAgICAgICAgIH0KLSJjb25zdCIgICAgICAgICAgICAgIHsgcmV0dXJuIHRva19jb25zdDsgICAgICAgICAgICAgICAgfQotInJlcXVpcmVkIiAgICAgICAgICAgeyByZXR1cm4gdG9rX3JlcXVpcmVkOyAgICAgICAgICAgICB9Ci0ib3B0aW9uYWwiICAgICAgICAgICB7IHJldHVybiB0b2tfb3B0aW9uYWw7ICAgICAgICAgICAgIH0KLSJhc3luYyIgewotICBwd2FybmluZygwLCAiXCJhc3luY1wiIGlzIGRlcHJlY2F0ZWQuICBJdCBpcyBjYWxsZWQgXCJvbmV3YXlcIiBub3cuXG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Nhc2UgJyInOgotICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnIicpOwotICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgY2FzZSAnXCcnOgotICAgICAgICAgICAgcmVzdWx0LnB1c2hfYmFjaygnXCcnKTsKLSAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgIGNhc2UgJ1xcJzoKLSAgICAgICAgICAgIHJlc3VsdC5wdXNoX2JhY2soJ1xcJyk7Ci0gICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgeXllcnJvcigiQmFkIGVzY2FwZSBjaGFyYWN0ZXJcbiIpOwotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgZGVmYXVsdDoKLSAgICAgICAgaWYgKGNoID09IG1hcmspIHsKLSAgICAgICAgICB5eWx2YWwuaWQgPSBzdHJkdXAocmVzdWx0LmNfc3RyKCkpOwotICAgICAgICAgIHJldHVybiB0b2tfbGl0ZXJhbDsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICByZXN1bHQucHVzaF9iYWNrKGNoKTsKLSAgICAgICAgfQotICAgIH0KLSAgfQotfQotCi0KLXtkb2N0ZXh0fSB7Ci0gLyogVGhpcyBkb2VzIG5vdCBzaG93IHVwIGluIHRoZSBwYXJzZSB0cmVlLiAqLwotIC8qIFJhdGhlciwgdGhlIHBhcnNlciB3aWxsIGdyYWIgaXQgb3V0IG9mIHRoZSBnbG9iYWwuICovCi0gIGlmIChnX3BhcnNlX21vZGUgPT0gUFJPR1JBTSkgewotICAgIGNsZWFyX2RvY3RleHQoKTsKLSAgICBnX2RvY3RleHQgPSBzdHJkdXAoeXl0ZXh0ICsgMyk7Ci0gICAgZ19kb2N0ZXh0W3N0cmxlbihnX2RvY3RleHQpIC0gMl0gPSAnXDAnOwotICAgIGdfZG9jdGV4dCA9IGNsZWFuX3VwX2RvY3RleHQ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2tfaW50X2NvbnN0YW50ICc6JwotICAgIHsKLSAgICAgIGlmICgkMSA8PSAwKSB7Ci0gICAgICAgIGlmIChnX2FsbG93X25lZ19maWVsZF9rZXlzKSB7Ci0gICAgICAgICAgLyoKLSAgICAgICAgICAgKiBnX2FsbG93X25lZ19maWVsZF9rZXlzIGV4aXN0cyB0byBhbGxvdyB1c2VycyB0byBhZGQgZXhwbGljaXRseQotICAgICAgICAgICAqIHNwZWNpZmllZCBrZXkgdmFsdWVzIHRvIG9sZCAudGhyaWZ0IGZpbGVzIHdpdGhvdXQgYnJlYWtpbmcKLSAgICAgICAgICAgKiBwcm90b2NvbCBjb21wYXRpYmlsaXR5LgotICAgICAgICAgICAqLwotICAgICAgICAgIGlmICgkMSAhPSB5X2ZpZWxkX3ZhbCkgewotICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAqIHdhcm4gaWYgdGhlIHVzZXItc3BlY2lmaWVkIG5lZ2F0aXZlIHZhbHVlIGlzbid0IHdoYXQKLSAgICAgICAgICAgICAqIHRocmlmdCB3b3VsZCBoYXZlIGF1dG8tYXNzaWduZWQuCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHB3YXJuaW5nKDEsICJOb25wb3NpdGl2ZSBmaWVsZCBrZXkgKCUiUFJJaTY0IikgZGlmZmVycyBmcm9tIHdoYXQgd291bGQgYmUgIgotICAgICAgICAgICAgICAgICAgICAgImF1dG8tYXNzaWduZWQgYnkgdGhyaWZ0ICglZCkuXG4iLCAkMSwgeV9maWVsZF92YWwpOwotICAgICAgICAgIH0KLSAgICAgICAgICAvKgotICAgICAgICAgICAqIExlYXZlICQxIGFzLWlzLCBhbmQgdXBkYXRlIHlfZmllbGRfdmFsIHRvIGJlIG9uZSBsZXNzIHRoYW4gJDEuCi0gICAgICAgICAgICogVGhlIEZpZWxkTGlzdCBwYXJzaW5nIHdpbGwgY2F0Y2ggYW55IGR1cGxpY2F0ZSBrZXkgdmFsdWVzLgotICAgICAgICAgICAqLwotICA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wZGVidWcoIkxpc3RUeXBlIC0+IHRva19saXN0PEZpZWxkVHlwZT4iKTsKLSAgICAgICQkID0gbmV3IHRfbGlzdCgkMyk7Ci0gICAgICBpZiAoJDUgIT0gTlVMTCkgewotICAgICAgICAoKHRfY29udGFpbmVyKikkJCktPnNldF9jcHBfbmFtZShzdGQ6OnN0cmluZygkNSkpOwotICAgICAgfQotICAgIH0KLQotQ3BwVHlwZToKLSAgdG9rX2NwcF90eXBlIHRva19saXRlcmFsCi0gICAgewotICAgICAgJCQgPSAkMjsKLSAgICB9Ci18Ci0gICAgewotICAgICAgJCQgPSBOVUxMOwotICAgIH0KLQotVHlwZUFubm90YXRpb25zOgotICAnKCcgVHlwZUFubm90YXRpb25MaXN0ICcpJwotICAgIHsKLSAgICAgIHBkZWJ1ZygiVHlwZUFubm90YXRpb25zIC0+ICggVHlwZUFubm90YXRpb25MaXN0ICkiKTsKLSAgICAgICQkID0gJDI7Ci0gICAgfQotfAotICAgIHsKLSAgICAgICQkID0gTlVMTDsKLSAgICB9Ci0KLVR5cGVBbm5vdGF0aW9uTGlzdDoKLSAgVHlwZUFubm90YXRpb25MaXN0IFR5cGVBbm5vdGF0aW9uCi0gICAgewotICAgICAgcGRlYnVnKCJUeXBlQW5ub3RhdGlvbkxpc3QgLT4gVHlwZUFubm90YXRpb25MaXN0ICwgVHlwZUFubm90YXRpb24iKTsKLSAgICAgICQkID0gJDE7Ci0gICAgICAkJC0+YW5ub3RhdGlvbnNfWyQyLT5rZXldID0gJDItPnZhbDsKLSAgICAgIGRlbGV0ZSAkMjsKLSAgICB9Ci18Ci0gICAgewotICAgICAgLyogSnVzdCB1c2UgYSBkdW1teSBzdHJ1Y3R1cmUgdG8gaG9sZCB0aGUgYW5ub3RhdGlvbnMuICovCi0gICAgICAkJCA9IG5ldyB0X3N0cnVjdChnX3Byb2dyYW0pOwotICAgIH0KLQotVHlwZUFubm90YXRpb246Ci0gIHRva19pZGVudGlmaWVyICc9JyB0b2tfbGl0ZXJh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9ncmFtLmgiCisjaW5jbHVkZSAidGhyaWZ0L3BsdWdpbi90eXBlX3V0aWwuaCIKKyNpbmNsdWRlICJ0aHJpZnQvcGx1Z2luL3BsdWdpbl90eXBlcy5oIgorCisjaW5jbHVkZSA8bWFwPgorI2luY2x1ZGUgPHZlY3Rvcj4KKworI2luY2x1ZGUgPGJvb3N0L3ByZXByb2Nlc3Nvci5ocHA+CisjaW5jbHVkZSA8Ym9vc3QvdGVzdC9pbmNsdWRlZC91bml0X3Rlc3QuaHBwPgorI2luY2x1ZGUgPGJvb3N0L3Rlc3QvcGFyYW1ldGVyaXplZF90ZXN0LmhwcD4KKwordXNpbmcgbmFtZXNwYWNlIGFwYWNoZTo6dGhyaWZ0OwordXNpbmcgbmFtZXNwYWNlIGJvb3N0Ojp1bml0X3Rlc3Q7CisKK25hbWVzcGFjZSB0ZXN0X2RhdGEgeworI2RlZmluZSBUX1RFU1RfVFlQRVMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDE0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgIChwcm9ncmFtLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlX3R5cGUsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtX3ZhbHVlLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdF92YWx1ZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0LCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBtYXAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlZGVmLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgIC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KHBsdWdpbjo6Y29udmVydChwKSk7CisKKyNkZWZpbmUgVEhSSUZUX0NIRUNLKHIsIGRhdGEsIGVsZW0pIEJPT1NUX1BQX0VYUEFORChCT09TVF9DSEVDS19FUVVBTChkYXRhIGVsZW0sIHN1dDItPmVsZW0pKTsKKyAgQk9PU1RfUFBfTElTVF9GT1JfRUFDSChUSFJJRlRfQ0hFQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgc3V0LT4sCisgICAgICAgICAgICAgICAgICAgICAgICAgQk9PU1RfUFBfVFVQTEVfVE9fTElTVCg3LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGlzX3ZvaWQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zdHJpbmcoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19ib29sKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfc3RyaW5nX2xpc3QoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19iaW5hcnkoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zdHJpbmdfZW51bSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2Jhc2VfdHlwZSgpKSkpCit9CisKK3ZvaWQgdGVzdF9jb25zdF92YWx1ZSh0X2NvbnN0X3ZhbHVlKiBzdXQpIHsKKyAgYm9vc3Q6OnNjb3BlZF9wdHI8dF9jb25zdF92YWx1ZT4gc3V0Mihyb3VuZF90cmlwKHN1dCkpOworCisgIEJPT1NUX0NIRUNLX0VRVUFMKHN1dC0+Z2V0X3R5cGUoKSwgc3V0Mi0+Z2V0X3R5cGUoKSk7CisgIHN3aXRjaCAoc3V0LT5n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gICAgQk9PU1RfQ0hFQ0tfRVFVQUwoc3V0LT5nZXRfbGlzdCgpLmZyb250KCktPmdldF90eXBlKCksIHN1dDItPmdldF9saXN0KCkuZnJvbnQoKS0+Z2V0X3R5cGUoKSk7CisgICAgYnJlYWs7CisgIGRlZmF1bHQ6CisgICAgQk9PU1RfQVNTRVJUKGZhbHNlKTsKKyAgICBicmVhazsKKyAgfQorfQorCit2b2lkIHRlc3RfY29uc3QodF9jb25zdCogc3V0KSB7CisgIGJvb3N0OjpzY29wZWRfcHRyPCA6OnRfY29uc3Q+IHN1dDIocm91bmRfdHJpcChzdXQpKTsKKworICBCT09TVF9QUF9MSVNUX0ZPUl9FQUNIKFRIUklGVF9DSEVDSywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdXQtPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2V0X3R5cGUoKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF92YWx1ZSgpLT5nZXRfdHlwZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9kb2MoKSkpKQorfQorCit2b2lkIHRlc3RfZW51bV92YWx1ZSh0X2VudW1fdmFsdWUqIHN1dCkgeworICBib29zdDo6c2NvcGVkX3B0cjx0X2VudW1fdmFsdWU+IHN1dDIocm91bmRfdHJpcChzdXQpKTsKKworICBCT09TVF9QUF9MSVNUX0ZPUl9FQUNIKFRIUklGVF9DSEVDSywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdXQtPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDMsIChnZXRfbmFtZSgpLCBnZXRfdmFsdWUoKSwgZ2V0X2RvYygpKSkpCit9CisKK3ZvaWQgdGVzdF9lbnVtKHRfZW51bSogc3V0KSB7CisgIGJvb3N0OjpzY29wZWRfcHRyPCA6OnRfZW51bT4gc3V0Mihyb3VuZF90cmlwKHN1dCkpOworCisgIEJPT1NUX1BQX0xJU1RfRk9SX0VBQ0goVEhSSUZUX0NIRUNLLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN1dC0+LAorICAgICAgICAgICAgICAgICAgICAgICAgIEJPT1NUX1BQX1RVUExFX1RPX0xJU1QoNiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9taW5fdmFsdWUoKS0+Z2V0X3ZhbHVlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X21heF92YWx1ZSgpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfY29uc3RhbnRfYnlfdmFsdWUoMTEpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfY29uc3RhbnRfYnlfbmFtZSgiVkFMMSIpLT5nZXRfdmFsdWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfZG9jKCkpKSkKK30KKwordm9pZCB0ZXN0X2xpc3QodF9saXN0KiBzdXQpIHsKKyAgYm9vc3Q6OnNjb3BlZF9wdHI8dF9saXN0PiBzdXQyKHJvdW5kX3RyaXAoc3V0KSk7CisKKyAgQk9PU1RfUFBfTElTVF9GT1JfRUFDSChUSFJJRlRfQ0hFQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgc3V0LT4sCisgICAgICAgICAgICAgICAgICAgICAgICAgQk9PU1RfUFBfVFVQTEVfVE9fTElTVCg0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdldF9lbGVtX3R5cGUoKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNfY3BwX25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfZG9jKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X25hbWUoKSkpKQorICBpZiAoc3V0LT5oYXNfY3BwX25hbWUoKSkKKyAgICBCT09TVF9DSEVDS19FUVVBTChzdXQtPmdldF9jcHBfbmFtZSgpLCBzdXQyLT5nZXRfY3BwX25hbWUoKSk7Cit9Cit2b2lkIHRlc3Rfc2V0KHRfc2V0KiBzdXQpIHsKKyAgYm9vc3Q6OnNjb3BlZF9wdHI8dF9zZXQ+IHN1dDIocm91bmRfdHJpcChzdXQpKTsKKworICBCT09TVF9QUF9MSVNUX0ZPUl9FQUNIKFRIUklGVF9DSEVDSywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdXQtPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2V0X2VsZW1fdHlwZSgpLT5nZXRfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc19jcHBfbmFtZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9kb2MoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfbmFtZSgpKSkpCisgIGlmIChzdXQtPmhhc19jcHBfbmFtZSgpKQorICAgIEJPT1NUX0NIRUNLX0VRVUFMKHN1dC0+Z2V0X2NwcF9uYW1lKCksIHN1dDItPmdldF9jcHBfbmFtZSgpKTsKK30KK3ZvaWQgdGVzdF9tYXAodF9tYXAqIHN1dCkgeworICBib29zdDo6c2NvcGVkX3B0cjx0X21hcD4gc3V0Mihyb3VuZF90cmlwKHN1dCkpOworCisgIEJPT1NUX1BQX0xJU1RfRk9SX0VBQ0goVEhSSUZUX0NIRUNLLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN1dC0+LAorICAgICAgICAgICAgICAgICAgICAgICAgIEJPT1NUX1BQX1RVUExFX1RPX0xJU1QoNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnZXRfa2V5X3R5cGUoKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfdmFsX3R5cGUoKS0+Z2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNfY3BwX25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfZG9jKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X25hbWUoKSkpKQorICBpZiAoc3V0LT5oYXNfY3BwX25hbWUoKSkKKyAgICBCT09TVF9DSEVDS19FUVVBTChzdXQtPmdldF9jcHBfbmFtZSgpLCBzdXQyLT5nZXRfY3BwX25hbWUoKSk7Cit9CisKK3ZvaWQgdGVzdF90eXBlZGVmKHRfdHlwZWRlZiogc3V0KSB7CisgIGJvb3N0OjpzY29wZWRfcHRyPHRfdHlwZWRlZj4gc3V0Mihyb3VuZF90cmlwKHN1dCkpOworCisgIEJPT1NUX1BQX0xJU1RfRk9SX0VBQ0goVEhSSUZUX0NIRUNLLAorICAgICAgICAgICAgICAgICAgICAgICAgIHN1dC0+LAorICAgICAgICAgICAgICAgICAgICAgICAgIEJPT1NUX1BQX1RVUExFX1RPX0xJU1QoNCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnZXRfZG9jKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X25hbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfc3ltYm9saWMoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19mb3J3YXJkX3R5cGVkZWYoKSkpKQorfQorCit2b2lkIHRlc3RfdHlwZSh0X3R5cGUqIHN1dCkgeworICBib29zdDo6c2NvcGVkX3B0cjx0X3R5cGU+IHN1dDIocm91bmRfdHJpcChzdXQpKTsKKworICBCT09TVF9QUF9MSVNUX0ZPUl9FQUNIKFRIUklGVF9DSEVDSywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdXQtPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDE1LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGlzX3ZvaWQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19iYXNlX3R5cGUoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zdHJpbmcoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19ib29sKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfdHlwZWRlZigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2VudW0oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zdHJ1Y3QoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc194Y2VwdGlvbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2NvbnRhaW5lcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2xpc3QoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zZXQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19tYXAoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19zZXJ2aWNlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X2RvYygpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9uYW1lKCkpKSkKK30KKwordm9pZCB0ZXN0X2ZpZWxkKHRfZmllbGQqIHN1dCkgeworICBib29zdDo6c2NvcGVkX3B0cjx0X2ZpZWxkPiBzdXQyKHJvdW5kX3RyaXAoc3V0KSk7CisKKyAgQk9PU1RfUFBfTElTVF9GT1JfRUFDSChUSFJJRlRfQ0hFQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgc3V0LT4sCisgICAgICAgICAgICAgICAgICAgICAgICAgQk9PU1RfUFBfVFVQTEVfVE9fTElTVCg1LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdldF9yZXEoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfcmVmZXJlbmNlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X2tleSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9kb2MoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfbmFtZSgpKSkpCisgIGlmIChzdXQtPmdldF92YWx1ZSgpKSB7CisgICAgVEhSSUZUX0NIRUNLKCwgc3V0LT4sIGdldF92YWx1ZSgpLT5nZXRfdHlwZSgpKTsKKyAgfSBlbHNlIHsKKyAgICBCT09TVF9DSEVDSyghc3V0Mi0+Z2V0X3ZhbHVlKCkpOworICB9CisgIGlmIChzdXQtPmdldF90eXBlKCkpIHsKKyAgICBUSFJJRlRfQ0hFQ0soLCBzdXQtPiwgZ2V0X3R5cGUoKS0+Z2V0X25hbWUoKSk7CisgIH0gZWxzZSB7CisgICAgQk9PU1RfQ0hFQ0soIXN1dDItPmdldF90eXBlKCkpOworICB9Cit9Cit2b2lkIHRlc3Rfc3RydWN0KHRfc3RydWN0KiBzdXQpIHsKKyAgYm9vc3Q6OnNjb3BlZF9wdHI8dF9zdHJ1Y3Q+IHN1dDIocm91bmRfdHJpcChzdXQpKTsKKworICBCT09TVF9QUF9MSVNUX0ZPUl9FQUNIKFRIUklGVF9DSEVDSywKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdXQtPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBCT09TVF9QUF9UVVBMRV9UT19MSVNUKDUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaXNfdW5pb24oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc194Y2VwdGlvbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3N0cnVjdCgpLAorICAgIC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AgICAgIFNvdXJjZUxpbmVJbmZvKCk7CisgICAgICAgIFNvdXJjZUxpbmVJbmZvKCBjaGFyIGNvbnN0KiBfZmlsZSwgc3RkOjpzaXplX3QgX2xpbmUgKTsKKyMgIGlmZGVmIENBVENIX0NPTkZJR19DUFAxMV9HRU5FUkFURURfTUVUSE9EUworICAgICAgICBTb3VyY2VMaW5lSW5mbyhTb3VyY2VMaW5lSW5mbyBjb25zdCYgb3RoZXIpICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgU291cmNlTGluZUluZm8oIFNvdXJjZUxpbmVJbmZvICYmICkgICAgICAgICAgICAgICAgICA9IGRlZmF1bHQ7CisgICAgICAgIFNvdXJjZUxpbmVJbmZvJiBvcGVyYXRvciA9ICggU291cmNlTGluZUluZm8gY29uc3QmICkgPSBkZWZhdWx0OworICAgICAgICBTb3VyY2VMaW5lSW5mbyYgb3BlcmF0b3IgPSAoIFNvdXJjZUxpbmVJbmZvICYmICkgICAgID0gZGVmYXVsdDsKKyMgIGVuZGlmCisgICAgICAgIGJvb2wgZW1wdHkoKSBjb25zdDsKKyAgICAgICAgYm9vbCBvcGVyYXRvciA9PSAoIFNvdXJjZUxpbmVJbmZvIGNvbnN0JiBvdGhlciApIGNvbnN0OworICAgICAgICBib29sIG9wZXJhdG9yIDwgKCBTb3VyY2VMaW5lSW5mbyBjb25zdCYgb3RoZXIgKSBjb25zdDsKKworICAgICAgICBjaGFyIGNvbnN0KiBmaWxlOworICAgICAgICBzdGQ6OnNpemVfdCBsaW5lOworICAgIH07CisKKyAgICBzdGQ6Om9zdHJlYW0mIG9wZXJhdG9yIDw8ICggc3RkOjpvc3RyZWFtJiBvcywgU291cmNlTGluZUluZm8gY29uc3QmIGluZm8gKTsKKworICAgIC8vIFRoaXMgaXMganVzdCBoZXJlIHRvIGF2b2lkIGNvbXBpbGVyIHdhcm5pbmdzIHdpdGggbWFjcm8gY29uc3RhbnRzIGFuZCBib29sZWFuIGxpdGVyYWxzCisgICAgaW5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jZSBDYXRjaCB7CisKKyAgICAvLyBBbiBpbnRydXNpdmUgcmVmZXJlbmNlIGNvdW50aW5nIHNtYXJ0IHBvaW50ZXIuCisgICAgLy8gVCBtdXN0IGltcGxlbWVudCBhZGRSZWYoKSBhbmQgcmVsZWFzZSgpIG1ldGhvZHMKKyAgICAvLyB0eXBpY2FsbHkgaW1wbGVtZW50aW5nIHRoZSBJU2hhcmVkIGludGVyZmFjZQorICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgY2xhc3MgUHRyIHsKKyAgICBwdWJsaWM6CisgICAgICAgIFB0cigpIDogbV9wKCBDQVRDSF9OVUxMICl7fQorICAgICAgICBQdHIoIFQqIHAgKSA6IG1fcCggcCApeworICAgICAgICAgICAgaWYoIG1fcCApCisgICAgICAgICAgICAgICAgbV9wLT5hZGRSZWYoKTsKKyAgICAgICAgfQorICAgICAgICBQdHIoIFB0ciBjb25zdCYgb3RoZXIgKSA6IG1fcCggb3RoZXIubV9wICl7CisgICAgICAgICAgICBpZiggbV9wICkKKyAgICAgICAgICAgICAgICBtX3AtPmFkZFJlZigpOworICAgICAgICB9CisgICAgICAgIH5QdHIoKXsKKyAgICAgICAgICAgIGlmKCBtX3AgKQorICAgICAgICAgICAgICAgIG1fcC0+cmVsZWFzZSgpOworICAgICAgICB9CisgICAgICAgIHZvaWQgcmVzZXQoKSB7CisgICAgICAgICAgICBpZiggbV9wICkKKyAgICAgICAgICAgICAgICBtX3AtPnJlbGVhc2UoKTsKKyAgICAgICAgICAgIG1fcCA9IENBVENIX05VTEw7CisgICAgICAgIH0KKyAgICAgICAgUHRyJiBvcGVyYXRvciA9ICggVCogcCApeworICAgICAgICAgICAgUHRyIHRlbXAoIHAgKTsKKyAgICAgICAgICAgIHN3YXAoIHRlbXAgKTsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorICAgICAgICBQdHImIG9wZXJhdG9yID0gKCBQdHIgY29uc3QmIG90aGVyICl7CisgICAgICAgICAgICBQdHIgdGVtcCggb3RoZXIgKTsKKyAgICAgICAgICAgIHN3YXAoIHRlbXAgKTsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorICAgICAgICB2b2lkIHN3YXAoIFB0ciYgb3RoZXIgKSB7IHN0ZDo6c3dhcCggbV9wLCBvdGhlci5tX3AgKTsgfQorICAgICAgICBUKiBnZXQoKSBjb25zdHsgcmV0dXJuIG1fcDsgfQorICAgICAgICBUJiBvcGVyYXRvciooKSBjb25zdCB7IHJldHVybiAqbV9wOyB9CisgICAgICAgIFQqIG9wZXJhdG9yLT4oKSBjb25zdCB7IHJldHVybiBtX3A7IH0KKyAgICAgICAgYm9vbCBvcGVyYXRvciAhKCkgY29uc3QgeyByZXR1cm4gbV9wID09IENBVENIX05VTEw7IH0KKyAgICAgICAgb3BlcmF0b3IgU2FmZUJvb2w6OnR5cGUoKSBjb25zdCB7IHJldHVybiBTYWZlQm9vbDo6bWFrZVNhZmUoIG1fcCAhPSBDQVRDSF9OVUxMICk7IH0KKworICAgIHByaXZhdGU6CisgICAgICAgIFQqIG1fcDsKKyAgICB9OworCisgICAgc3RydWN0IElTaGFyZWQgOiBOb25Db3B5YWJsZSB7CisgICAgICAgIHZpcnR1YWwgfklTaGFyZWQoKTsKKyAgICAgICAgdmlydHVhbCB2b2lkIGFkZFJlZigpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCB2b2lkIHJlbGVhc2UoKSBjb25zdCA9IDA7CisgICAgfTsKKworICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQgPSBJU2hhcmVkPgorICAgIHN0cnVjdCBTaGFyZWRJbXBsIDogVCB7CisKKyAgICAgICAgU2hhcmVkSW1wbCgpIDogbV9yYyggMCApe30KKworICAgICAgICB2aXJ0dWFsIHZvaWQgYWRkUmVmKCkgY29uc3QgeworICAgICAgICAgICAgKyttX3JjOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgdm9pZCByZWxlYXNlKCkgY29uc3QgeworICAgICAgICAgICAgaWYoIC0tbV9yYyA9PSAwICkKKyAgICAgICAgICAgICAgICBkZWxldGUgdGhpczsKKyAgICAgICAgfQorCisgICAgICAgIG11dGFibGUgdW5zaWduZWQgaW50IG1fcmM7CisgICAgfTsKKworfSAvLyBlbmQgbmFtZXNwYWNlIENhdGNoCisKKyNpZmRlZiBfX2NsYW5nX18KKyNwcmFnbWEgY2xhbmcgZGlhZ25vc3RpYyBwb3AKKyNlbmRpZgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgY2xhc3MgVGVzdENhc2U7CisgICAgY2xhc3MgU3RyZWFtOworICAgIHN0cnVjdCBJUmVzdWx0Q2FwdHVyZTsKKyAgICBzdHJ1Y3QgSVJ1bm5lcjsKKyAgICBzdHJ1Y3QgSUdlbmVyYXRvcnNGb3JUZXN0OworICAgIHN0cnVjdCBJQ29uZmlnOworCisgICAgc3RydWN0IElDb250ZXh0CisgICAgeworICAgICAgICB2aXJ0dWFsIH5JQ29udGV4dCgpOworCisgICAgICAgIHZpcnR1YWwgSVJlc3VsdENhcHR1cmUqIGdldFJlc3VsdENhcHR1cmUoKSA9IDA7CisgICAgICAgIHZpcnR1YWwgSVJ1bm5lciogZ2V0UnVubmVyKCkgPSAwOworICAgICAgICB2aXJ0dWFsIHNpemVfdCBnZXRHZW5lcmF0b3JJbmRleCggc3RkOjpzdHJpbmcgY29uc3QmIGZpbGVJbmZvLCBzaXplX3QgdG90YWxTaXplICkgPSAwOworICAgICAgICB2aXJ0dWFsIGJvb2wgYWR2YW5jZUdlbmVyYXRvcnNGb3JDdXJyZW50VGVzdCgpID0gMDsKKyAgICAgICAgdmlydHVhbCBQdHI8SUNvbmZpZyBjb25zdD4gZ2V0Q29uZmlnKCkgY29uc3QgPSAwOworICAgIH07CisKKyAgICBzdHJ1Y3QgSU11dGFibGVDb250ZXh0IDogSUNvbnRleHQKKyAgICB7CisgICAgICAgIHZpcnR1YWwgfklNdXRhYmxlQ29udGV4dCgpOwor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AgICBDIG9iajsKKyAgICAgICAgKG9iai4qbV9tZXRob2QpKCk7CisgICAgfQorCitwcml2YXRlOgorICAgIHZpcnR1YWwgfk1ldGhvZFRlc3RDYXNlKCkge30KKworICAgIHZvaWQgKEM6OiptX21ldGhvZCkoKTsKK307CisKK3R5cGVkZWYgdm9pZCgqVGVzdEZ1bmN0aW9uKSgpOworCitzdHJ1Y3QgTmFtZUFuZERlc2MgeworICAgIE5hbWVBbmREZXNjKCBjb25zdCBjaGFyKiBfbmFtZSA9ICIiLCBjb25zdCBjaGFyKiBfZGVzY3JpcHRpb249ICIiICkKKyAgICA6IG5hbWUoIF9uYW1lICksIGRlc2NyaXB0aW9uKCBfZGVzY3JpcHRpb24gKQorICAgIHt9CisKKyAgICBjb25zdCBjaGFyKiBuYW1lOworICAgIGNvbnN0IGNoYXIqIGRlc2NyaXB0aW9uOworfTsKKwordm9pZCByZWdpc3RlclRlc3RDYXNlCisgICAgKCAgIElUZXN0Q2FzZSogdGVzdENhc2UsCisgICAgICAgIGNoYXIgY29uc3QqIGNsYXNzTmFtZSwKKyAgICAgICAgTmFtZUFuZERlc2MgY29uc3QmIG5hbWVBbmREZXNjLAorICAgICAgICBTb3VyY2VMaW5lSW5mbyBjb25zdCYgbGluZUluZm8gKTsKKworc3RydWN0IEF1dG9SZWcgeworCisgICAgQXV0b1JlZworICAgICAgICAoICAgVGVzdEZ1bmN0aW9uIGZ1bmN0aW9uLAorICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvLAorICAgICAgICAgICAgTmFtZUFuZERlc2MgY29uc3QmIG5hbWVBbmREZXNjICk7CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBDPgorICAgIEF1dG9SZWcKKyAgICAgICAgKCAgIHZvaWQgKEM6OiptZXRob2QpKCksCisgICAgICAgICAgICBjaGFyIGNvbnN0KiBjbGFzc05hbWUsCisgICAgICAgICAgICBOYW1lQW5kRGVzYyBjb25zdCYgbmFtZUFuZER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uIHwgMiwKKworICAgICAgICBGYXRhbEVycm9yQ29uZGl0aW9uID0gMHgyMDAgfCBGYWlsdXJlQml0CisKKyAgICB9OyB9OworCisgICAgaW5saW5lIGJvb2wgaXNPayggUmVzdWx0V2FzOjpPZlR5cGUgcmVzdWx0VHlwZSApIHsKKyAgICAgICAgcmV0dXJuICggcmVzdWx0VHlwZSAmIFJlc3VsdFdhczo6RmFpbHVyZUJpdCApID09IDA7CisgICAgfQorICAgIGlubGluZSBib29sIGlzSnVzdEluZm8oIGludCBmbGFncyApIHsKKyAgICAgICAgcmV0dXJuIGZsYWdzID09IFJlc3VsdFdhczo6SW5mbzsKKyAgICB9CisKKyAgICAvLyBSZXN1bHREaXNwb3NpdGlvbjo6RmxhZ3MgZW51bQorICAgIHN0cnVjdCBSZXN1bHREaXNwb3NpdGlvbiB7IGVudW0gRmxhZ3MgeworICAgICAgICBOb3JtYWwgPSAweDAxLAorCisgICAgICAgIENvbnRpbnVlT25GYWlsdXJlID0gMHgwMiwgICAvLyBGYWlsdXJlcyBmYWlsIHRlc3QsIGJ1dCBleGVjdXRpb24gY29udGludWVzCisgICAgICAgIEZhbHNlVGVzdCA9IDB4MDQsICAgICAgICAgICAvLyBQcmVmaXggZXhwcmVzc2lvbiB3aXRoICEKKyAgICAgICAgU3VwcHJlc3NGYWlsID0gMHgwOCAgICAgICAgIC8vIEZhaWx1cmVzIGFyZSByZXBvcnRlZCBidXQgZG8gbm90IGZhaWwgdGhlIHRlc3QKKyAgICB9OyB9OworCisgICAgaW5saW5lIFJlc3VsdERpc3Bvc2l0aW9uOjpGbGFncyBvcGVyYXRvciB8ICggUmVzdWx0RGlzcG9zaXRpb246OkZsYWdzIGxocywgUmVzdWx0RGlzcG9zaXRpb246OkZsYWdzIHJocyApIHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PFJlc3VsdERpc3Bvc2l0aW9uOjpGbGFncz4oIHN0YXRpY19jYXN0PGludD4oIGxocyApIHwgc3RhdGljX2Nh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lc3Npb247CisgICAgICAgIFJlc3VsdERpc3Bvc2l0aW9uOjpGbGFncyByZXN1bHREaXNwb3NpdGlvbjsKKyAgICB9OworCisgICAgc3RydWN0IEFzc2VydGlvblJlc3VsdERhdGEKKyAgICB7CisgICAgICAgIEFzc2VydGlvblJlc3VsdERhdGEoKSA6IGRlY29tcG9zZWRFeHByZXNzaW9uKCBDQVRDSF9OVUxMICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgcmVzdWx0VHlwZSggUmVzdWx0V2FzOjpVbmtub3duICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgbmVnYXRlZCggZmFsc2UgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCBwYXJlbnRoZXNpemVkKCBmYWxzZSApIHt9CisKKyAgICAgICAgdm9pZCBuZWdhdGUoIGJvb2wgcGFyZW50aGVzaXplICkgeworICAgICAgICAgICAgbmVnYXRlZCA9ICFuZWdhdGVkOworICAgICAgICAgICAgcGFyZW50aGVzaXplZCA9IHBhcmVudGhlc2l6ZTsKKyAgICAgICAgICAgIGlmKCByZXN1bHRUeXBlID09IFJlc3VsdFdhczo6T2sgKQorICAgICAgICAgICAgICAgIHJlc3VsdFR5cGUgPSBSZXN1bHRXYXM6OkV4cHJlc3Npb25GYWlsZWQ7CisgICAgICAgICAgICBlbHNlIGlmKCByZXN1bHRUeXBlID09IFJlc3VsdFdhczo6RXhwcmVzc2lvbkZhaWxlZCApCisgICAgICAgICAgICAgICAgcmVzdWx0VHlwZSA9IFJlc3VsdFdhczo6T2s7CisgICAgICAgIH0KKworICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgcmVjb25zdHJ1Y3RFeHByZXNzaW9uKCkgY29uc3QgeworICAgICAgICAgICAgaWYoIGRlY29tcG9zZWRFeHByZXNzaW9uICE9IENBVENIX05VTEwgKSB7CisgICAgICAgICAgICAgICAgZGVjb21wb3NlZEV4cHJlc3Npb24tPnJlY29uc3RydWN0RXhwcmVzc2lvbiggcmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24gKTsKKyAgICAgICAgICAgICAgICBpZiggcGFyZW50aGVzaXplZCApIHsKKyAgICAgICAgICAgICAgICAgICAgcmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24uaW5zZXJ0KCAwLCAxLCAnKCcgKTsKKyAgICAgICAgICAgICAgICAgICAgcmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24uYXBwZW5kKCAxLCAnKScgKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYoIG5lZ2F0ZWQgKSB7CisgICAgICAgICAgICAgICAgICAgIHJlY29uc3RydWN0ZWRFeHByZXNzaW9uLmluc2VydCggMCwgMSwgJyEnICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGRlY29tcG9zZWRFeHByZXNzaW9uID0gQ0FUQ0hfTlVMTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiByZWNvbnN0cnVjdGVkRXhwcmVzc2lvbjsKKyAgICAgICAgfQorCisgICAgICAgIG11dGFibGUgRGVjb21wb3NlZEV4cHJlc3Npb24gY29uc3QqIGRlY29tcG9zZWRFeHByZXNzaW9uOworICAgICAgICBtdXRhYmxlIHN0ZDo6c3RyaW5nIHJlY29uc3RydWN0ZWRFeHByZXNzaW9uOworICAgICAgICBzdGQ6OnN0cmluZyBtZXNzYWdlOworICAgICAgICBSZXN1bHRXYXM6Ok9mVHlwZSByZXN1bHRUeXBlOworICAgICAgICBib29sIG5lZ2F0ZWQ7CisgICAgICAgIGJvb2wgcGFyZW50aGVzaXplZDsKKyAgICB9OworCisgICAgY2xhc3MgQXNzZXJ0aW9uUmVzdWx0IHsKKyAgICBwdWJsaWM6CisgICAgICAgIEFzc2VydGlvblJlc3VsdCgpOworICAgICAgICBBc3NlcnRpb25SZXN1bHQoIEFzc2VydGlvbkluZm8gY29uc3QmIGluZm8sIEFzc2VydGlvblJlc3VsdERhdGEgY29uc3QmIG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AgIE1hdGNoQW55T2Y8Q29tcGFyYXRvclQ+IG9wZXJhdG9yIHx8ICggTWF0Y2hlckJhc2UgY29uc3QmIG90aGVyICkgY29uc3Q7CisgICAgICAgICAgICBNYXRjaE5vdE9mPENvbXBhcmF0b3JUPiBvcGVyYXRvciAhICgpIGNvbnN0OworICAgICAgICB9OworCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEFyZ1Q+CisgICAgICAgIHN0cnVjdCBNYXRjaEFsbE9mIDogTWF0Y2hlckJhc2U8QXJnVD4geworICAgICAgICAgICAgdmlydHVhbCBib29sIG1hdGNoKCBBcmdUIGNvbnN0JiBhcmcgKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IG1fbWF0Y2hlcnMuc2l6ZSgpOyArK2kgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghbV9tYXRjaGVyc1tpXS0+bWF0Y2goYXJnKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aXJ0dWFsIHN0ZDo6c3RyaW5nIGRlc2NyaWJlKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc2NyaXB0aW9uOworICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uLnJlc2VydmUoIDQgKyBtX21hdGNoZXJzLnNpemUoKSozMiApOworICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uICs9ICIoICI7CisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IG1fbWF0Y2hlcnMuc2l6ZSgpOyArK2kgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBpICE9IDAgKQorICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24gKz0gIiBhbmQgIjsKKyAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24gKz0gbV9tYXRjaGVyc1tpXS0+dG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24gKz0gIiApIjsKKyAgICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRpb247CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIE1hdGNoQWxsT2Y8QXJnVD4mIG9wZXJhdG9yICYmICggTWF0Y2hlckJhc2U8QXJnVD4gY29uc3QmIG90aGVyICkgeworICAgICAgICAgICAgICAgIG1fbWF0Y2hlcnMucHVzaF9iYWNrKCAmb3RoZXIgKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPE1hdGNoZXJCYXNlPEFyZ1Q+IGNvbnN0Kj4gbV9tYXRjaGVyczsKKyAgICAgICAgfTsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgQXJnVD4KKyAgICAgICAgc3RydWN0IE1hdGNoQW55T2YgOiBNYXRjaGVyQmFzZTxBcmdUPiB7CisKKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaCggQXJnVCBjb25zdCYgYXJnICkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgIGZvciggc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBtX21hdGNoZXJzLnNpemUoKTsgKytpICkgeworICAgICAgICAgICAgICAgICAgICBpZiAobV9tYXRjaGVyc1tpXS0+bWF0Y2goYXJnKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aXJ0dWFsIHN0ZDo6c3RyaW5nIGRlc2NyaWJlKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc2NyaXB0aW9uOworICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uLnJlc2VydmUoIDQgKyBtX21hdGNoZXJzLnNpemUoKSozMiApOworICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uICs9ICIoICI7CisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IG1fbWF0Y2hlcnMuc2l6ZSgpOyArK2kgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBpICE9IDAgKQorICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb24gKz0gIiBvciAiOworICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbiArPSBtX21hdGNoZXJzW2ldLT50b1N0cmluZygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbiArPSAiICkiOworICAgICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgTWF0Y2hBbnlPZjxBcmdUPiYgb3BlcmF0b3IgfHwgKCBNYXRjaGVyQmFzZTxBcmdUPiBjb25zdCYgb3RoZXIgKSB7CisgICAgICAgICAgICAgICAgbV9tYXRjaGVycy5wdXNoX2JhY2soICZvdGhlciApOworICAgICAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8TWF0Y2hlckJhc2U8QXJnVD4gY29uc3QqPiBtX21hdGNoZXJzOworICAgICAgICB9OworCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEFyZ1Q+CisgICAgICAgIHN0cnVjdCBNYXRjaE5vdE9mIDogTWF0Y2hlckJhc2U8QXJnVD4geworCisgICAgICAgICAgICBNYXRjaE5vdE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QmFzZTsKKworfSAvLyBuYW1lc3BhY2UgQ2F0Y2gKKworbmFtZXNwYWNlIENhdGNoIHsKKworICAgIHN0cnVjdCBUZXN0RmFpbHVyZUV4Y2VwdGlvbnt9OworCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4gY2xhc3MgRXhwcmVzc2lvbkxoczsKKworICAgIHN0cnVjdCBDb3B5YWJsZVN0cmVhbSB7CisgICAgICAgIENvcHlhYmxlU3RyZWFtKCkge30KKyAgICAgICAgQ29weWFibGVTdHJlYW0oIENvcHlhYmxlU3RyZWFtIGNvbnN0JiBvdGhlciApIHsKKyAgICAgICAgICAgIG9zcyA8PCBvdGhlci5vc3Muc3RyKCk7CisgICAgICAgIH0KKyAgICAgICAgQ29weWFibGVTdHJlYW0mIG9wZXJhdG9yPSggQ29weWFibGVTdHJlYW0gY29uc3QmIG90aGVyICkgeworICAgICAgICAgICAgb3NzLnN0cihzdGQ6OnN0cmluZygpKTsKKyAgICAgICAgICAgIG9zcyA8PCBvdGhlci5vc3Muc3RyKCk7CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICB9OworCisgICAgY2xhc3MgUmVzdWx0QnVpbGRlciA6IHB1YmxpYyBEZWNvbXBvc2VkRXhwcmVzc2lvbiB7CisgICAgcHVibGljOgorICAgICAgICBSZXN1bHRCdWlsZGVyKCAgY2hhciBjb25zdCogbWFjcm9OYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjb25zdCogY2FwdHVyZWRFeHByZXNzaW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgUmVzdWx0RGlzcG9zaXRpb246OkZsYWdzIHJlc3VsdERpc3Bvc2l0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjb25zdCogc2Vjb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V0dXJuIGFwcGx5RXZhbHVhdG9yPE9wPiggbGhzLCBzdGF0aWNfY2FzdDx1bnNpZ25lZCBsb25nPiggcmhzICkgKTsKKyAgICB9CisKKyAgICAvLyBpbnQgdG8gdW5zaWduZWQgWAorICAgIHRlbXBsYXRlPE9wZXJhdG9yIE9wPiBib29sIGNvbXBhcmUoIGludCBsaHMsIHVuc2lnbmVkIGludCByaHMgKSB7CisgICAgICAgIHJldHVybiBhcHBseUV2YWx1YXRvcjxPcD4oIHN0YXRpY19jYXN0PHVuc2lnbmVkIGludD4oIGxocyApLCByaHMgKTsKKyAgICB9CisgICAgdGVtcGxhdGU8T3BlcmF0b3IgT3A+IGJvb2wgY29tcGFyZSggaW50IGxocywgdW5zaWduZWQgbG9uZyByaHMgKSB7CisgICAgICAgIHJldHVybiBhcHBseUV2YWx1YXRvcjxPcD4oIHN0YXRpY19jYXN0PHVuc2lnbmVkIGludD4oIGxocyApLCByaHMgKTsKKyAgICB9CisgICAgdGVtcGxhdGU8T3BlcmF0b3IgT3A+IGJvb2wgY29tcGFyZSggaW50IGxocywgdW5zaWduZWQgY2hhciByaHMgKSB7CisgICAgICAgIHJldHVybiBhcHBseUV2YWx1YXRvcjxPcD4oIHN0YXRpY19jYXN0PHVuc2lnbmVkIGludD4oIGxocyApLCByaHMgKTsKKyAgICB9CisKKyAgICAvLyBsb25nIHRvIHVuc2lnbmVkIFgKKyAgICB0ZW1wbGF0ZTxPcGVyYXRvciBPcD4gYm9vbCBjb21wYXJlKCBsb25nIGxocywgdW5zaWduZWQgaW50IHJocyApIHsKKyAgICAgICAgcmV0dXJuIGFwcGx5RXZhbHVhdG9yPE9wPiggc3RhdGljX2Nhc3Q8dW5zaWduZWQgbG9uZz4oIGxocyApLCByaHMgKTsKKyAgICB9CisgICAgdGVtcGxhdGU8T3BlcmF0b3IgT3A+IGJvb2wgY29tcGFyZSggbG9uZyBsaHMsIHVuc2lnbmVkIGxvbmcgcmhzICkgeworICAgICAgICByZXR1cm4gYX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RvPiggcmhzICk7CisgICAgfQorCisgICAgdm9pZCBlbmRFeHByZXNzaW9uKCkgeworICAgICAgICBtX3RydXRoeSA9IG1fbGhzID8gdHJ1ZSA6IGZhbHNlOworICAgICAgICBtX3JiCisgICAgICAgICAgICAuc2V0UmVzdWx0VHlwZSggbV90cnV0aHkgKQorICAgICAgICAgICAgLmVuZEV4cHJlc3Npb24oICp0aGlzICk7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIHJlY29uc3RydWN0RXhwcmVzc2lvbiggc3RkOjpzdHJpbmcmIGRlc3QgKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgIGRlc3QgPSBDYXRjaDo6dG9TdHJpbmcoIG1fdHJ1dGh5ICk7CisgICAgfQorCitwcml2YXRlOgorICAgIHRlbXBsYXRlPEludGVybmFsOjpPcGVyYXRvciBPcCwgdHlwZW5hbWUgUmhzVD4KKyAgICBCaW5hcnlFeHByZXNzaW9uPFQsIE9wLCBSaHNUJj4gY2FwdHVyZUV4cHJlc3Npb24oIFJoc1QmIHJocyApIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIEJpbmFyeUV4cHJlc3Npb248VCwgT3AsIFJoc1QmPiggbV9yYiwgbV9saHMsIHJocyApOworICAgIH0KKworICAgIHRlbXBsYXRlPEludGVybmFsOjpPcGVyYXRvciBPcD4KKyAgICBCaW5hcnlFeHByZXNzaW9uPFQsIE9wLCBib29sPiBjYXB0dXJlRXhwcmVzc2lvbiggYm9vbCByaHMgKSBjb25zdCB7CisgICAgICAgIHJldHVybiBCaW5hcnlFeHByZXNzaW9uPFQsIE9wLCBib29sPiggbV9yYiwgbV9saHMsIHJocyApOworICAgIH0KKworcHJpdmF0ZToKKyAgICBSZXN1bHRCdWlsZGVyJiBtX3JiOworICAgIFQgbV9saHM7CisgICAgYm9vbCBtX3RydXRoeTsKK307CisKK3RlbXBsYXRlPHR5cGVuYW1lIExoc1QsIEludGVybmFsOjpPcGVyYXRvciBPcCwgdHlwZW5hbWUgUmhzVD4KK2NsYXNzIEJpbmFyeUV4cHJlc3Npb24gOiBwdWJsaWMgRGVjb21wb3NlZEV4cHJlc3Npb24geworcHVibGljOgorICAgIEJpbmFyeUV4cHJlc3Npb24oIFJlc3VsdEJ1aWxkZXImIHJiLCBMaHNUIGxocywgUmhzVCByaHMgKQorICAgICAgICA6IG1fcmIoIHJiICksIG1fbGhzKCBsaHMgKSwgbV9yaHMoIHJocyApIHt9CisKKyAgICBCaW5hcnlFeHByZXNzaW9uJiBvcGVyYXRvciA9ICggQmluYXJ5RXhwcmVzc2lvbiYgKTsKKworICAgIHZvaWQgZW5kRXhwcmVzc2lvbigpIGNvbnN0IHsKKyAgICAgICAgbV9yYgorICAgICAgICAgICAgLnNldFJlc3VsdFR5cGUoIEludGVybmFsOjpjb21wYXJlPE9wPiggbV9saHMsIG1fcmhzICkgKQorICAgICAgICAgICAgLmVuZEV4cHJlc3Npb24oICp0aGlzICk7CisgICAgfQorCisgICAgdmlydHVhbCBib29sIGlzQmluYXJ5RXhwcmVzc2lvbigpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIHJlY29uc3RydWN0RXhwcmVzc2lvbiggc3RkOjpzdHJpbmcmIGRlc3QgKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgIHN0ZDo6c3RyaW5nIGxocyA9IENhdGNoOjp0b1N0cmluZyggbV9saHMgKTsKKyAgICAgICAgc3RkOjpzdHJpbmcgcmhzID0gQ2F0Y2g6OnRvU3RyaW5nKCBtX3JocyApOworICAgICAgICBjaGFyIGRlbGltID0gbGhzLnNpemUoKSArIHJocy5zaXplKCkgPCA0MCAmJgorICAgICAgICAgICAgICAgICAgICAgbGhzLmZpbmQoJ1xuJykgPT0gc3RkOjpzdHJpbmc6Om5wb3MgJiYKKyAgICAgICAgICAgICAgICAgICAgIHJocy5maW5kKCdcbicpID09IHN0ZDo6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JbmZvIGxpbmVJbmZvOworICAgICAgICBSZXN1bHRXYXM6Ok9mVHlwZSB0eXBlOworICAgICAgICBzdGQ6OnN0cmluZyBtZXNzYWdlOworICAgICAgICB1bnNpZ25lZCBpbnQgc2VxdWVuY2U7CisKKyAgICAgICAgYm9vbCBvcGVyYXRvciA9PSAoIE1lc3NhZ2VJbmZvIGNvbnN0JiBvdGhlciApIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBzZXF1ZW5jZSA9PSBvdGhlci5zZXF1ZW5jZTsKKyAgICAgICAgfQorICAgICAgICBib29sIG9wZXJhdG9yIDwgKCBNZXNzYWdlSW5mbyBjb25zdCYgb3RoZXIgKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gc2VxdWVuY2UgPCBvdGhlci5zZXF1ZW5jZTsKKyAgICAgICAgfQorICAgIHByaXZhdGU6CisgICAgICAgIHN0YXRpYyB1bnNpZ25lZCBpbnQgZ2xvYmFsQ291bnQ7CisgICAgfTsKKworICAgIHN0cnVjdCBNZXNzYWdlQnVpbGRlciB7CisgICAgICAgIE1lc3NhZ2VCdWlsZGVyKCBzdGQ6OnN0cmluZyBjb25zdCYgbWFjcm9OYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgUmVzdWx0V2FzOjpPZlR5cGUgdHlwZSApCisgICAgICAgIDogbV9pbmZvKCBtYWNyb05hbWUsIGxpbmVJbmZvLCB0eXBlICkKKyAgICAgICAge30KKworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBNZXNzYWdlQnVpbGRlciYgb3BlcmF0b3IgPDwgKCBUIGNvbnN0JiB2YWx1ZSApIHsKKyAgICAgICAgICAgIG1fc3RyZWFtIDw8IHZhbHVlOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgTWVzc2FnZUluZm8gbV9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W50cyBjb25zdCYgb3RoZXIgKSB7CisgICAgICAgICAgICBwYXNzZWQgKz0gb3RoZXIucGFzc2VkOworICAgICAgICAgICAgZmFpbGVkICs9IG90aGVyLmZhaWxlZDsKKyAgICAgICAgICAgIGZhaWxlZEJ1dE9rICs9IG90aGVyLmZhaWxlZEJ1dE9rOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgc3RkOjpzaXplX3QgdG90YWwoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gcGFzc2VkICsgZmFpbGVkICsgZmFpbGVkQnV0T2s7CisgICAgICAgIH0KKyAgICAgICAgYm9vbCBhbGxQYXNzZWQoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gZmFpbGVkID09IDAgJiYgZmFpbGVkQnV0T2sgPT0gMDsKKyAgICAgICAgfQorICAgICAgICBib29sIGFsbE9rKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIGZhaWxlZCA9PSAwOworICAgICAgICB9CisKKyAgICAgICAgc3RkOjpzaXplX3QgcGFzc2VkOworICAgICAgICBzdGQ6OnNpemVfdCBmYWlsZWQ7CisgICAgICAgIHN0ZDo6c2l6ZV90IGZhaWxlZEJ1dE9rOworICAgIH07CisKKyAgICBzdHJ1Y3QgVG90YWxzIHsKKworICAgICAgICBUb3RhbHMgb3BlcmF0b3IgLSAoIFRvdGFscyBjb25zdCYgb3RoZXIgKSBjb25zdCB7CisgICAgICAgICAgICBUb3RhbHMgZGlmZjsKKyAgICAgICAgICAgIGRpZmYuYXNzZXJ0aW9ucyA9IGFzc2VydGlvbnMgLSBvdGhlci5hc3NlcnRpb25zOworICAgICAgICAgICAgZGlmZi50ZXN0Q2FzZXMgPSB0ZXN0Q2FzZXMgLSBvdGhlci50ZXN0Q2FzZXM7CisgICAgICAgICAgICByZXR1cm4gZGlmZjsKKyAgICAgICAgfQorCisgICAgICAgIFRvdGFscyBkZWx0YSggVG90YWxzIGNvbnN0JiBwcmV2VG90YWxzICkgY29uc3QgeworICAgICAgICAgICAgVG90YWxzIGRpZmYgPSAqdGhpcyAtIHByZXZUb3RhbHM7CisgICAgICAgICAgICBpZiggZGlmZi5hc3NlcnRpb25zLmZhaWxlZCA+IDAgKQorICAgICAgICAgICAgICAgICsrZGlmZi50ZXN0Q2FzZXMuZmFpbGVkOworICAgICAgICAgICAgZWxzZSBpZiggZGlmZi5hc3NlcnRpb25zLmZhaWxlZEJ1dE9rID4gMCApCisgICAgICAgICAgICAgICAgKytkaWZmLnRlc3RDYXNlcy5mYWlsZWRCdXRPazsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICArK2RpZmYudGVzdENhc2VzLnBhc3NlZDsKKyAgICAgICAgICAgIHJldHVybiBkaWZmOworICAgICAgICB9CisKKyAgICAgICAgVG90YWxzJiBvcGVyYXRvciArPSAoIFRvdGFscyBjb25zdCYgb3RoZXIgKSB7CisgICAgICAgICAgICBhc3NlcnRpb25zICs9IG90aGVyLmFzc2VydGlvbnM7CisgICAgICAgICAgICB0ZXN0Q2FzZXMgKz0gb3RoZXIudGVzdENhc2VzOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgQ291bnRzIGFzc2VydGlvbnM7CisgICAgICAgIENvdW50cyB0ZXN0Q2FzZXM7CisgICAgfTsKK30KKworI2luY2x1ZGUgPHN0cmluZz4KKworbmFtZXNwYWNlIENhdGNoIHsKKworICAgIHN0cnVjdCBTZWN0aW9uSW5mbyB7CisgICAgICAgIFNlY3Rpb25JbmZvCisgICAgICAgICAgICAoICAgU291cmNlTGluZUluZm8gY29uc3QmIF9saW5lSW5mbywKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgX25hbWUsCisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY29uc3QmIF9kZXNjcmlwdGlvbiA9IHN0ZDo6c3RyaW5nKCkgKTsKKworICAgICAgICBzdGQ6OnN0cmluZyBuYW1lOworICAgICAgICBzdGQ6OnN0cmluZyBkZXNjcmlwdGlvbjsKKyAgICAgICAgU291cmNlTGluZUluZm8gbGluZUluZm87CisgICAgfTsKKworICAgIHN0cnVjdCBTZWN0aW9uRW5kSW5mbyB7CisgICAgICAgIFNlY3Rpb25FbmRJbmZvKCBTZWN0aW9uSW5mbyBjb25zdCYgX3NlY3Rpb25JbmZvLCBDb3VudHMgY29uc3QmIF9wcmV2QXNzZXJ0aW9ucywgZG91YmxlIF9kdXJhdGlvbkluU2Vjb25kcyApCisgICAgICAgIDogc2VjdGlvbkluZm8oIF9zZWN0aW9uSW5mbyApLCBwcmV2QXNzZXJ0aW9ucyggX3ByZXZBc3NlcnRpb25zICksIGR1cmF0aW9uSW5TZWNvbmRzKCBfZHVyYXRpb25JblNlY29uZHMgKQorICAgICAgICB7fQorCisgICAgICAgIFNlY3Rpb25JbmZvIHNlY3Rpb25JbmZvOworICAgICAgICBDb3VudHMgcHJldkFzc2VydGlvbnM7CisgICAgICAgIGRvdWJsZSBkdXJhdGlvbkluU2Vjb25kczsKKyAgICB9OworCit9IC8vIGVuZCBuYW1lc3BhY2UgQ2F0Y2gKKworLy8gI2luY2x1ZGVkIGZyb206IGNhdGNoX3RpbWVyLmgKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX1RJTUVSX0hfSU5DTFVERUQKKworI2lmZGVmIF9NU0NfVkVSCisKK25hbWVzcGFjZSBDYXRjaCB7CisgICAgdHlwZWRlZiB1bnNpZ25lZCBsb25nIGxvbmcgVUludDY0OworfQorI2Vsc2UKKyNpbmNsdWRlIDxzdGRpbnQuaD4KK25hbWVzcGFjZSBDYXRjaCB7CisgICAgdHlwZWRlZiB1aW50NjRfdCBVSW50NjQ7Cit9CisjZW5kaWYKKworbmFtZXNwYWNlIENhdGNoIHsKKyAgICBjbGFzcyBUaW1lciB7CisgICAgcHVibGljOgorICAgICAgICBUaW1lcigpIDogbV90aWNrcyggMCApIHt9CisgICAgICAgIHZvaW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9pdGVyYXRvciBpdEVuZCApIGNvbnN0ID0gMDsKKyAgICB9OworCisgICAgc3RydWN0IElFeGNlcHRpb25UcmFuc2xhdG9yUmVnaXN0cnkgeworICAgICAgICB2aXJ0dWFsIH5JRXhjZXB0aW9uVHJhbnNsYXRvclJlZ2lzdHJ5KCk7CisKKyAgICAgICAgdmlydHVhbCBzdGQ6OnN0cmluZyB0cmFuc2xhdGVBY3RpdmVFeGNlcHRpb24oKSBjb25zdCA9IDA7CisgICAgfTsKKworICAgIGNsYXNzIEV4Y2VwdGlvblRyYW5zbGF0b3JSZWdpc3RyYXIgeworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBjbGFzcyBFeGNlcHRpb25UcmFuc2xhdG9yIDogcHVibGljIElFeGNlcHRpb25UcmFuc2xhdG9yIHsKKyAgICAgICAgcHVibGljOgorCisgICAgICAgICAgICBFeGNlcHRpb25UcmFuc2xhdG9yKCBzdGQ6OnN0cmluZygqdHJhbnNsYXRlRnVuY3Rpb24pKCBUJiApICkKKyAgICAgICAgICAgIDogbV90cmFuc2xhdGVGdW5jdGlvbiggdHJhbnNsYXRlRnVuY3Rpb24gKQorICAgICAgICAgICAge30KKworICAgICAgICAgICAgdmlydHVhbCBzdGQ6OnN0cmluZyB0cmFuc2xhdGUoIEV4Y2VwdGlvblRyYW5zbGF0b3JzOjpjb25zdF9pdGVyYXRvciBpdCwgRXhjZXB0aW9uVHJhbnNsYXRvcnM6OmNvbnN0X2l0ZXJhdG9yIGl0RW5kICkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBpdCA9PSBpdEVuZCApCisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgqaXQpLT50cmFuc2xhdGUoIGl0KzEsIGl0RW5kICk7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GVyLm1fZXBzaWxvbiApLAorICAgICAgICAgICAgbV9tYXJnaW4oIG90aGVyLm1fbWFyZ2luICksCisgICAgICAgICAgICBtX3NjYWxlKCBvdGhlci5tX3NjYWxlICksCisgICAgICAgICAgICBtX3ZhbHVlKCBvdGhlci5tX3ZhbHVlICkKKyAgICAgICAge30KKworICAgICAgICBzdGF0aWMgQXBwcm94IGN1c3RvbSgpIHsKKyAgICAgICAgICAgIHJldHVybiBBcHByb3goIDAgKTsKKyAgICAgICAgfQorCisjaWYgZGVmaW5lZChDQVRDSF9DT05GSUdfQ1BQMTFfVFlQRV9UUkFJVFMpCisKKyAgICAgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHR5cGVuYW1lID0gdHlwZW5hbWUgc3RkOjplbmFibGVfaWY8c3RkOjppc19jb25zdHJ1Y3RpYmxlPGRvdWJsZSwgVD46OnZhbHVlPjo6dHlwZT4KKyAgICAgICAgQXBwcm94IG9wZXJhdG9yKCkoIFQgdmFsdWUgKSB7CisgICAgICAgICAgICBBcHByb3ggYXBwcm94KCBzdGF0aWNfY2FzdDxkb3VibGU+KHZhbHVlKSApOworICAgICAgICAgICAgYXBwcm94LmVwc2lsb24oIG1fZXBzaWxvbiApOworICAgICAgICAgICAgYXBwcm94Lm1hcmdpbiggbV9tYXJnaW4gKTsKKyAgICAgICAgICAgIGFwcHJveC5zY2FsZSggbV9zY2FsZSApOworICAgICAgICAgICAgcmV0dXJuIGFwcHJveDsKKyAgICAgICAgfQorCisgICAgICAgIHRlbXBsYXRlIDx0eXBlbmFtZSBULCB0eXBlbmFtZSA9IHR5cGVuYW1lIHN0ZDo6ZW5hYmxlX2lmPHN0ZDo6aXNfY29uc3RydWN0aWJsZTxkb3VibGUsIFQ+Ojp2YWx1ZT46OnR5cGU+CisgICAgICAgIGV4cGxpY2l0IEFwcHJveCggVCB2YWx1ZSApOiBBcHByb3goc3RhdGljX2Nhc3Q8ZG91YmxlPih2YWx1ZSkpCisgICAgICAgIHt9CisKK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PSBkb3VibGUobmV3RXBzaWxvbik7CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKworICAgICAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgVCwgdHlwZW5hbWUgPSB0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjxzdGQ6OmlzX2NvbnN0cnVjdGlibGU8ZG91YmxlLCBUPjo6dmFsdWU+Ojp0eXBlPgorICAgICAgICBBcHByb3gmIG1hcmdpbiggVCBuZXdNYXJnaW4gKSB7CisgICAgICAgICAgICBtX21hcmdpbiA9IGRvdWJsZShuZXdNYXJnaW4pOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHR5cGVuYW1lID0gdHlwZW5hbWUgc3RkOjplbmFibGVfaWY8c3RkOjppc19jb25zdHJ1Y3RpYmxlPGRvdWJsZSwgVD46OnZhbHVlPjo6dHlwZT4KKyAgICAgICAgQXBwcm94JiBzY2FsZSggVCBuZXdTY2FsZSApIHsKKyAgICAgICAgICAgIG1fc2NhbGUgPSBkb3VibGUobmV3U2NhbGUpOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgQXBwcm94IG9wZXJhdG9yKCkoIGRvdWJsZSB2YWx1ZSApIHsKKyAgICAgICAgICAgIEFwcHJveCBhcHByb3goIHZhbHVlICk7CisgICAgICAgICAgICBhcHByb3guZXBzaWxvbiggbV9lcHNpbG9uICk7CisgICAgICAgICAgICBhcHByb3gubWFyZ2luKCBtX21hcmdpbiApOworICAgICAgICAgICAgYXBwcm94LnNjYWxlKCBtX3NjYWxlICk7CisgICAgICAgICAgICByZXR1cm4gYXBwcm94OworICAgICAgICB9CisKKyAgICAgICAgZnJpZW5kIGJvb2wgb3BlcmF0b3IgPT0gKCBkb3VibGUgbGhzLCBBcHByb3ggY29uc3QmIHJocyApIHsKKyAgICAgICAgICAgIC8vIFRoYW5rcyB0byBSaWNoYXJkIEhhcnJpcyBmb3IgaGlzIGhlbHAgcmVmaW5pbmcgdGhpcyBmb3JtdWxhCisgICAgICAgICAgICBib29sIHJlbGF0aXZlT0sgPSBzdGQ6OmZhYnMoIGxocyAtIHJocy5tX3ZhbHVlICkgPCByaHMubV9lcHNpbG9uICogKHJocy5tX3NjYWxlICsgKHN0ZDo6bWF4KSggc3RkOjpmYWJzKGxocyksIHN0ZDo6ZmFicyhyaHMubV92YWx1ZSkgKSApOworICAgICAgICAgICAgaWYgKHJlbGF0aXZlT0spIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBzdGQ6OmZhYnMobGhzIC0gcmhzLm1fdmFsdWUpIDwgcmhzLm1fbWFyZ2luOworICAgICAgICB9CisKKyAgICAgICAgZnJpZW5kIGJvb2wgb3BlcmF0b3IgPT0gKCBBcHByb3ggY29uc3QmIGxocywgZG91YmxlIHJocyApIHsKKyAgICAgICAgICAgIHJldHVybiBvcGVyYXRvcj09KCByaHMsIGxocyApOworICAgICAgICB9CisKKyAgICAgICAgZnJpZW5kIGJvb2wgb3BlcmF0b3IgIT0gKCBkb3VibGUgbGhzLCBBcHByb3ggY29uc3QmIHJocyApIHsKKyAgICAgICAgICAgIHJldHVybiAhb3BlcmF0b3I9PSggbGhzLCByaHMgKTsKKyAgICAgICAgfQorCisgICAgICAgIGZyaWVuZCBib29sIG9wZXJhdG9yICE9ICggQXBwcm94IGNvbnN0JiBsaHMsIGRvdWJsZSByaHMgKSB7CisgICAgICAgICAgICByZXR1cm4gIW9wZXJhdG9yPT0oIHJocywgbGhzICk7CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgYm9vbCBvcGVyYXRvciA8PSAoIGRvdWJsZSBsaHMsIEFwcHJveCBjb25zdCYgcmhzICkgeworICAgICAgICAgICAgcmV0dXJuIGxocyA8IHJocy5tX3ZhbHVlIHx8IGxocyA9PSByaHM7CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgYm9vbCBvcGVyYXRvciA8PSAoIEFwcHJveCBjb25zdCYgbGhzLCBkb3VibGUgcmhzICkgeworICAgICAgICAgICAgcmV0dXJuIGxocy5tX3ZhbHVlIDwgcmhzIHx8IGxocyA9PSByaHM7CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgYm9vbCBvcGVyYXRvciA+PSAoIGRvdWJsZSBsaHMsIEFwcHJveCBjb25zdCYgcmhzICkgeworICAgICAgICAgICAgcmV0dXJuIGxocyA+IHJocy5tX3ZhbHVlIHx8IGxocyA9PSByaHM7CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgYm9vbCBvcGVyYXRvciA+PSAoIEFwcHJveCBjb25zdCYgbGhzLCBkb3VibGUgcmhzICkgeworICAgICAgICAgICAgcmV0dXJuIGxocy5tX3ZhbHVlID4gcmhzIHx8IGxocyA9PSByaHM7CisgICAgICAgIH0KKworICAgICAgICBBcHByb3gmIGVwc2lsb24oIGRvdWJsZSBuZXdFcHNpbG9uICkgeworICAgICAgICAgICAgbV9lcHNpbG9uID0gbmV3RXBzaWxvbjsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorCisgICAgICAgIEFwcHJveCYgbWFyZ2luKCBkb3VibGUgbmV3TWFyZ2luICkgeworICAgICAgICAgICAgbV9tYXJnaW4gPSBuZXdNYXJnaW47CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKworICAgICAgICBBcHByb3gmIHNjYWxlKCBkb3VibGUgbmV3U2NhbGUgKSB7CisgICAgICAgICAgICBtX3NjYWxlID0gbmV3U2NhbGU7CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKyNlbmRpZgorCisgICAgICAgIHN0ZDo6c3RyaW5nIHRvU3RyaW5nKCkgY29uc3QgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKy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mVnaW4oKSwgdi5lbmQoKSwgbV9jb21wYXJhdG9yKSAhPSB2LmVuZCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2aXJ0dWFsIHN0ZDo6c3RyaW5nIGRlc2NyaWJlKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgIHJldHVybiAiQ29udGFpbnM6ICIgKyBDYXRjaDo6dG9TdHJpbmcoIG1fY29tcGFyYXRvciApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBUIGNvbnN0JiBtX2NvbXBhcmF0b3I7CisgICAgICAgIH07CisKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgc3RydWN0IENvbnRhaW5zTWF0Y2hlciA6IE1hdGNoZXJCYXNlPHN0ZDo6dmVjdG9yPFQ+LCBzdGQ6OnZlY3RvcjxUPiA+IHsKKworICAgICAgICAgICAgQ29udGFpbnNNYXRjaGVyKHN0ZDo6dmVjdG9yPFQ+IGNvbnN0ICZjb21wYXJhdG9yKSA6IG1fY29tcGFyYXRvciggY29tcGFyYXRvciApIHt9CisKKyAgICAgICAgICAgIGJvb2wgbWF0Y2goc3RkOjp2ZWN0b3I8VD4gY29uc3QgJnYpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgICAgICAvLyAhVEJEOiBzZWUgbm90ZSBpbiBFcXVhbHNNYXRjaGVyCisgICAgICAgICAgICAgICAgaWYgKG1fY29tcGFyYXRvci5zaXplKCkgPiB2LnNpemUoKSkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbV9jb21wYXJhdG9yLnNpemUoKTsgKytpKQorICAgICAgICAgICAgICAgICAgICBpZiAoc3RkOjpmaW5kKHYuYmVnaW4oKSwgdi5lbmQoKSwgbV9jb21wYXJhdG9yW2ldKSA9PSB2LmVuZCgpKQorICAgICAgICAgIC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XRjCisgICAgICAgICAgICAgICAgLy8gLSB0aGVuIGp1c3QgY2FsbCB0aGF0IGRpcmVjdGx5CisgICAgICAgICAgICAgICAgaWYgKG1fY29tcGFyYXRvci5zaXplKCkgIT0gdi5zaXplKCkpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHYuc2l6ZSgpOyArK2kpCisgICAgICAgICAgICAgICAgICAgIGlmIChtX2NvbXBhcmF0b3JbaV0gIT0gdltpXSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZpcnR1YWwgc3RkOjpzdHJpbmcgZGVzY3JpYmUoKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICAgICAgcmV0dXJuICJFcXVhbHM6ICIgKyBDYXRjaDo6dG9TdHJpbmcoIG1fY29tcGFyYXRvciApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RkOjp2ZWN0b3I8VD4gY29uc3QmIG1fY29tcGFyYXRvcjsKKyAgICAgICAgfTsKKworICAgIH0gLy8gbmFtZXNwYWNlIFZlY3RvcgorCisgICAgLy8gVGhlIGZvbGxvd2luZyBmdW5jdGlvbnMgY3JlYXRlIHRoZSBhY3R1YWwgbWF0Y2hlciBvYmplY3RzLgorICAgIC8vIFRoaXMgYWxsb3dzIHRoZSB0eXBlcyB0byBiZSBpbmZlcnJlZAorCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICBWZWN0b3I6OkNvbnRhaW5zTWF0Y2hlcjxUPiBDb250YWlucyggc3RkOjp2ZWN0b3I8VD4gY29uc3QmIGNvbXBhcmF0b3IgKSB7CisgICAgICAgIHJldHVybiBWZWN0b3I6OkNvbnRhaW5zTWF0Y2hlcjxUPiggY29tcGFyYXRvciApOwor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3KCBzdG9yYWdlICkgVCggKl9vdGhlciApIDogQ0FUQ0hfTlVMTCApCisgICAgICAgIHt9CisKKyAgICAgICAgfk9wdGlvbigpIHsKKyAgICAgICAgICAgIHJlc2V0KCk7CisgICAgICAgIH0KKworICAgICAgICBPcHRpb24mIG9wZXJhdG9yPSAoIE9wdGlvbiBjb25zdCYgX290aGVyICkgeworICAgICAgICAgICAgaWYoICZfb3RoZXIgIT0gdGhpcyApIHsKKyAgICAgICAgICAgICAgICByZXNldCgpOworICAgICAgICAgICAgICAgIGlmKCBfb3RoZXIgKQorICAgICAgICAgICAgICAgICAgICBudWxsYWJsZVZhbHVlID0gbmV3KCBzdG9yYWdlICkgVCggKl9vdGhlciApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisgICAgICAgIE9wdGlvbiYgb3BlcmF0b3IgPSAoIFQgY29uc3QmIF92YWx1ZSApIHsKKyAgICAgICAgICAgIHJlc2V0KCk7CisgICAgICAgICAgICBudWxsYWJsZVZhbHVlID0gbmV3KCBzdG9yYWdlICkgVCggX3ZhbHVlICk7CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHJlc2V0KCkgeworICAgICAgICAgICAgaWYoIG51bGxhYmxlVmFsdWUgKQorICAgICAgICAgICAgICAgIG51bGxhYmxlVmFsdWUtPn5UKCk7CisgICAgICAgICAgICBudWxsYWJsZVZhbHVlID0gQ0FUQ0hfTlVMTDsKKyAgICAgICAgfQorCisgICAgICAgIFQmIG9wZXJhdG9yKigpIHsgcmV0dXJuICpudWxsYWJsZVZhbHVlOyB9CisgICAgICAgIFQgY29uc3QmIG9wZXJhdG9yKigpIGNvbnN0IHsgcmV0dXJuICpudWxsYWJsZVZhbHVlOyB9CisgICAgICAgIFQqIG9wZXJhdG9yLT4oKSB7IHJldHVybiBudWxsYWJsZVZhbHVlOyB9CisgICAgICAgIGNvbnN0IFQqIG9wZXJhdG9yLT4oKSBjb25zdCB7IHJldHVybiBudWxsYWJsZVZhbHVlOyB9CisKKyAgICAgICAgVCB2YWx1ZU9yKCBUIGNvbnN0JiBkZWZhdWx0VmFsdWUgKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbnVsbGFibGVWYWx1ZSA/ICpudWxsYWJsZVZhbHVlIDogZGVmYXVsdFZhbHVlOworICAgICAgICB9CisKKyAgICAgICAgYm9vbCBzb21lKCkgY29uc3QgeyByZXR1cm4gbnVsbGFibGVWYWx1ZSAhPSBDQVRDSF9OVUxMOyB9CisgICAgICAgIGJvb2wgbm9uZSgpIGNvbnN0IHsgcmV0dXJuIG51bGxhYmxlVmFsdWUgPT0gQ0FUQ0hfTlVMTDsgfQorCisgICAgICAgIGJvb2wgb3BlcmF0b3IgISgpIGNvbnN0IHsgcmV0dXJuIG51bGxhYmxlVmFsdWUgPT0gQ0FUQ0hfTlVMTDsgfQorICAgICAgICBvcGVyYXRvciBTYWZlQm9vbDo6dHlwZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBTYWZlQm9vbDo6bWFrZVNhZmUoIHNvbWUoKSApOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgICBUICpudWxsYWJsZVZhbHVlOworICAgICAgICB1bmlvbiB7CisgICAgICAgICAgICBjaGFyIHN0b3JhZ2Vbc2l6ZW9mKFQpXTsKKworICAgICAgICAgICAgLy8gVGhlc2UgYXJlIGhlcmUgdG8gZm9yY2UgYWxpZ25tZW50IGZvciB0aGUgc3RvcmFnZQorICAgICAgICAgICAgbG9uZyBkb3VibGUgZHVtbXkxOworICAgICAgICAgICAgdm9pZCAoKmR1bW15MikoKTsKKyAgICAgICAgICAgIGxvbmcgZG91YmxlIGR1bW15MzsKKyNpZmRlZiBDQVRDSF9DT05GSUdfQ1BQMTFfTE9OR19MT05HCisgICAgICAgICAgICBsb25nIGxvbmcgZHVtbXk0OworI2VuZGlmCisgICAgICAgIH07CisgICAgfTsKKworfSA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VGVzdENhc2VJbmZvIHsKKyAgICAgICAgZW51bSBTcGVjaWFsUHJvcGVydGllc3sKKyAgICAgICAgICAgIE5vbmUgPSAwLAorICAgICAgICAgICAgSXNIaWRkZW4gPSAxIDw8IDEsCisgICAgICAgICAgICBTaG91bGRGYWlsID0gMSA8PCAyLAorICAgICAgICAgICAgTWF5RmFpbCA9IDEgPDwgMywKKyAgICAgICAgICAgIFRocm93cyA9IDEgPDwgNCwKKyAgICAgICAgICAgIE5vblBvcnRhYmxlID0gMSA8PCA1CisgICAgICAgIH07CisKKyAgICAgICAgVGVzdENhc2VJbmZvKCAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfY2xhc3NOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY29uc3QmIF9kZXNjcmlwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2V0PHN0ZDo6c3RyaW5nPiBjb25zdCYgX3RhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICBTb3VyY2VMaW5lSW5mbyBjb25zdCYgX2xpbmVJbmZvICk7CisKKyAgICAgICAgVGVzdENhc2VJbmZvKCBUZXN0Q2FzZUluZm8gY29uc3QmIG90aGVyICk7CisKKyAgICAgICAgZnJpZW5kIHZvaWQgc2V0VGFncyggVGVzdENhc2VJbmZvJiB0ZXN0Q2FzZUluZm8sIHN0ZDo6c2V0PHN0ZDo6c3RyaW5nPiBjb25zdCYgdGFncyApOworCisgICAgICAgIGJvb2wgaXNIaWRkZW4oKSBjb25zdDsKKyAgICAgICAgYm9vbCB0aHJvd3MoKSBjb25zdDsKKyAgICAgICAgYm9vbCBva1RvRmFpbCgpIGNvbnN0OworICAgICAgICBib29sIGV4cGVjdGVkVG9GYWlsKCkgY29uc3Q7CisKKyAgICAgICAgc3RkOjpzdHJpbmcgbmFtZTsKKyAgICAg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b3Nlcywgc2luY2UKKy8vIGFsbCBpdHMgbWV0aG9kcyBhcmUgb3B0aW9uYWwuCitAcHJvdG9jb2wgT2NGaXh0dXJlCisKK0BvcHRpb25hbAorCistKHZvaWQpIHNldFVwOworLSh2b2lkKSB0ZWFyRG93bjsKKworQGVuZAorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgY2xhc3MgT2NNZXRob2QgOiBwdWJsaWMgU2hhcmVkSW1wbDxJVGVzdENhc2U+IHsKKworICAgIHB1YmxpYzoKKyAgICAgICAgT2NNZXRob2QoIENsYXNzIGNscywgU0VMIHNlbCApIDogbV9jbHMoIGNscyApLCBtX3NlbCggc2VsICkge30KKworICAgICAgICB2aXJ0dWFsIHZvaWQgaW52b2tlKCkgY29uc3QgeworICAgICAgICAgICAgaWQgb2JqID0gW1ttX2NscyBhbGxvY10gaW5pdF07CisKKyAgICAgICAgICAgIHBlcmZvcm1PcHRpb25hbFNlbGVjdG9yKCBvYmosIEBzZWxlY3RvcihzZXRVcCkgICk7CisgICAgICAgICAgICBwZXJmb3JtT3B0aW9uYWxTZWxlY3Rvciggb2JqLCBtX3NlbCApOworICAgICAgICAgICAgcGVyZm9ybU9wdGlvbmFsU2VsZWN0b3IoIG9iaiwgQHNlbGVjdG9yKHRlYXJEb3duKSAgKTsKKworICAgICAgICAgICAgYXJjU2FmZVJlbGVhc2UoIG9iaiApOworICAgICAgICB9CisgICAgcHJpdmF0ZToKKyAgICAgICAgdmlydHVhbCB+T2NNZXRob2QoKSB7fQorCisgICAgICAgIENsYXNzIG1fY2xzOworICAgICAgICBTRUwgbV9zZWw7CisgICAgfTsKKworICAgIG5hbWVzcGFjZSBEZXRhaWx7CisKKyAgICAgICAgaW5saW5lIHN0ZDo6c3RyaW5nIGdldEFubm90YXRpb24oICAgQ2xhc3MgY2xzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgYW5ub3RhdGlvbk5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiB0ZXN0Q2FzZU5hbWUgKSB7CisgICAgICAgICAgICBOU1N0cmluZyogc2VsU3RyID0gW1tOU1N0cmluZyBhbGxvY10gaW5pdFdpdGhGb3JtYXQ6QCJDYXRjaF8lc18lcyIsIGFubm90YXRpb25OYW1lLmNfc3RyKCksIHRlc3RDYXNlTmFtZS5jX3N0cigpXTsKKyAgICAgICAgICAgIFNFTCBzZWwgPSBOU1NlbGVjdG9yRnJvbVN0cmluZyggc2VsU3RyICk7CisgICAgICAgICAgICBhcmNTYWZlUmVsZWFzZSggc2VsU3RyICk7CisgICAgICAgICAgICBpZCB2YWx1ZSA9IHBlcmZvcm1PcHRpb25hbFNlbGVjdG9yKCBjbHMsIHNlbCApOworICAgICAgICAgICAgaWYoIHZhbHVlICkKKyAgICAgICAgICAgICAgICByZXR1cm4gWyhOU1N0cmluZyopdmFsdWUgVVRGOFN0cmluZ107CisgICAgICAgICAgICByZXR1cm4gIiI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpbmxpbmUgc2l6ZV90IHJlZ2lzdGVyVGVzdE1ldGhvZHMoKSB7CisgICAgICAgIHNpemVfdCBub1Rlc3RNZXRob2RzID0gMDsKKyAgICAgICAgaW50IG5vQ2xhc3NlcyA9IG9iamNfZ2V0Q2xhc3NMaXN0KCBDQVRDSF9OVUxMLCAwICk7CisKKyAgICAgICAgQ2xhc3MqIGNsYXNzZXMgPSAoQ0FUQ0hfVU5TQUZFX1VOUkVUQUlORUQgQ2xhc3MgKiltYWxsb2MoIHNpemVvZihDbGFzcykgKiBub0NsYXNzZXMpOworICAgICAgICBvYmpjX2dldENsYXNzTGlzdCggY2xhc3Nlcywgbm9DbGFzc2VzICk7CisKKyAgICAgICAgZm9yKCBpbnQgYyA9IDA7IGMgPCBub0NsYXNzZXM7IGMrKyApIHsKKyAgICAgICAgICAgIENsYXNzIGNscyA9IGNsYXNzZXNbY107CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdV9pbnQgY291bnQ7CisgICAgICAgICAgICAgICAgTWV0aG9kKiBtZXRob2RzID0gY2xhc3NfY29weU1ldGhvZExpc3QoIGNscywgJmNvdW50ICk7CisgICAgICAgICAgICAgICAgZm9yKCB1X2ludCBtID0gMDsgbSA8IGNvdW50IDsgbSsrICkgeworICAgICAgICAgICAgICAgICAgICBTRUwgc2VsZWN0b3IgPSBtZXRob2RfZ2V0TmFtZShtZXRob2RzW21dKTsKKyAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWV0aG9kTmFtZSA9IHNlbF9nZXROYW1lKHNlbGVjdG9yKTsKKyAgICAgICAgICAgICAgICAgICAgaWYoIHN0YXJ0c1dpdGgoIG1ldGhvZE5hbWUsICJDYXRjaF9UZXN0Q2FzZV8iICkgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB0ZXN0Q2FzZU5hbWUgPSBtZXRob2ROYW1lLnN1YnN0ciggMTUgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWUgPSBEZXRhaWw6OmdldEFubm90YXRpb24oIGNscywgIk5hbWUiLCB0ZXN0Q2FzZU5hbWUgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRlc2MgPSBEZXRhaWw6OmdldEFubm90YXRpb24oIGNscywgIkRlc2NyaXB0aW9uIiwgdGVzdENhc2VOYW1lICk7CisgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBjbGFzc05hbWUgPSBjbGFzc19nZXROYW1lKCBjbHMgKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TXV0YWJsZVJlZ2lzdHJ5SHViKCkucmVnaXN0ZXJUZXN0KCBtYWtlVGVzdENhc2UoIG5ldyBPY01ldGhvZCggY2xzLCBzZWxlY3RvciApLCBjbGFzc05hbWUsIG5hbWUuY19zdHIoKSwgZGVzYy5jX3N0cigpLCBTb3VyY2VMaW5lSW5mbygpICkgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vVGVzdE1ldGhvZHMrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmcmVlKG1ldGhvZHMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBub1Rlc3RNZXRob2RzOworICAgIH0KKworICAgIG5hbWVzcGFjZSBNYXRjaGVycyB7CisgICAgICAgIG5hbWVzcGFjZSBJbXBsIHsKKyAgICAgICAgbmFtZXNwYWNlIE5TU3RyaW5nTWF0Y2hlcnMgeworCisgICAgICAgICAgICBzdHJ1Y3QgU3RyaW5nSG9sZGVyIDogTWF0Y2hlckJhc2U8TlNTdHJpbmcqPnsKKyAgICAgICAgICAgICAgICBTdHJpbmdIb2xkZXIoIE5TU3RyaW5nKiBzdWJzdHIgKSA6IG1fc3Vic3RyKCBbc3Vic3RyIGNvcHldICl7fQorICAgICAgICAgICAgICAgIFN0cmluZ0hvbGRlciggU3RyaW5nSG9sZGVyIGNvbnN0JiBvdGhlciApIDogbV9zdWJzdHIoIFtvdGhlci5tX3N1YnN0ciBjb3B5XSApe30KKyAgICAgICAgICAgICAgICBTdHJpbmdIb2xkZXIoKSB7CisgICAgICAgICAgICAgICAgICAgIGFyY1NhZmVSZWxlYXNlKCBtX3N1YnN0ciApOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaCggTlNTdHJpbmcqIGFyZyApIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIE5TU3RyaW5nKiBtX3N1YnN0cjsKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIHN0cnVjdCBFcXVhbHMgOiBTdHJpbmdIb2xkZXIgeworICAgICAgICAgICAgICAgIEVxdWFscyggTlNTdHJpbmcqIHN1YnN0ciApIDogU3RyaW5nSG9sZGVyKCBzdWJzdHIgKXt9CisKKyAgICAgICAgICAgICAgICB2aXJ0dWFsIGJvb2wgbWF0Y2goIE5TU3RyaW5nKiBzdHIgKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAgKHN0ciAhPSBuaWwgfHwgbV9zdWJzdHIgPT0gbmlsICkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBbc3RyIGlzRXF1YWxUb1N0cmluZzptX3N1YnN0cl07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdmlydHVhbCBzdGQ6OnN0cmluZyBkZXNjcmliZSgpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICJlcXVhbHMgc3RyaW5nOiAiICsgQ2F0Y2g6OnRvU3RyaW5nKCBtX3N1YnN0ciApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIHN0cnVjdCBDb250YWlucyA6IFN0cmluZ0hvbGRlciB7CisgICAgICAgICAgICAgICAgQ29udGFpbnMoIE5TU3RyaW5nKiBzdWJzdHIgKSA6IFN0cmluZ0hvbGRlciggc3Vic3RyICl7fQorCisgICAgICAgICAgICAgICAgdmlydHVhbCBib29sIG1hdGNoKCBOU1N0cmluZyogc3RyICkgY29uc3QgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gIChzdHIgIT0gbmlsIHx8IG1fc3Vic3RyID09IG5pbCApICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgW3N0ciByYW5nZU9mU3RyaW5nOm1fc3Vic3RyXS5sb2NhdGlvbiAhPSBOU05vdEZvdW5kOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHZpcnR1YWwgc3RkOjpzdHJpbmcgZGVzY3JpYmUoKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAiY29udGFpbnMgc3RyaW5nOiAiICsgQ2F0Y2g6OnRvU3RyaW5nKCBtX3N1YnN0ciApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIHN0cnVjdCBTdGFydHNXaXRoIDogU3RyaW5nSG9sZGVyIHsKKyAgICAgICAgICAgICAgICBTdGFydHNXaXRoKCBOU1N0cmluZyogc3Vic3RyICkgOiBTdHJpbmdIb2xkZXIoIHN1YnN0ciApe30KKworICAgICAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaCggTlNTdHJpbmcqIHN0ciApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICAoc3RyICE9IG5pbCB8fCBtX3N1YnN0ciA9PSBuaWwgKSAmJgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtzdHIgcmFuZ2VPZlN0cmluZzptX3N1YnN0cl0ubG9jYXRpb24gPT0gMDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2aXJ0dWFsIHN0ZDo6c3RyaW5nIGRlc2NyaWJlKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gInN0YXJ0cyB3aXRoOiAiICsgQ2F0Y2g6OnRvU3RyaW5nKCBtX3N1YnN0ciApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBzdHJ1Y3QgRW5kc1dpdGggOiBTdHJpbmdIb2xkZXIgeworICAgICAgICAgICAgICAgIEVuZHNXaXRoKCBOU1N0cmluZyogc3Vic3RyICkgOiBTdHJpbmdIb2xkZXIoIHN1YnN0ciApe30KKworICAgICAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaCggTlNTdHJpbmcqIHN0ciApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICAoc3RyICE9IG5pbCB8fCBtX3N1YnN0ciA9PSBuaWwgKSAmJgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtzdHIgcmFuZ2VPZlN0cmluZzptX3N1YnN0cl0ubG9jYXRpb24gPT0gW3N0ciBsZW5ndGhdIC0gW21fc3Vic3RyIGxlbmd0aF07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdmlydHVhbCBzdGQ6OnN0cmluZyBkZXNjcmliZSgpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICJlbmRzIHdpdGg6ICIgKyBDYXRjaDo6dG9TdHJpbmcoIG1fc3Vic3RyICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKworICAgICAgICB9IC8vIG5hbWVzcGFjZSBOU1N0cmluZ01hdGNoZXJzCisgICAgICAgIH0gLy8gbmFtZXNwYWNlIEltcGwKKworICAgICAgICBpbmxpbmUgSW1wbDo6TlNTdHJpbmdNYXRjaGVyczo6RXF1YWxzCisgICAgICAgICAgICBFcXVhbHMoIE5TU3RyaW5nKiBzdWJzdHIgKXsgcmV0dXJuIEltcGw6Ok5TU3RyaW5nTWF0Y2hlcnM6OkVxdWFscyggc3Vic3RyICk7IH0KKworICAgICAgICBpbmxpbmUgSW1wbDo6TlNTdHJpbmdNYXRjaGVyczo6Q29udGFpbnMKKyAgICAgICAgICAgIENvbnRhaW5zKCBOU1N0cmluZyogc3Vic3RyICl7IHJldHVybiBJbXBsOjpOU1N0cmluZ01hdGNoZXJzOjpDb250YWlucyggc3Vic3RyICk7IH0KKworICAgICAgICBpbmxpbmUgSW1wbDo6TlNTdHJpbmdNYXRjaGVyczo6U3RhcnRzV2l0aAorICAgICAgICAgICAgU3RhcnRzV2l0aCggTlNTdHJpbmcqIHN1YnN0ciApeyByZXR1cm4gSW1wbDo6TlNTdHJpbmdNYXRjaG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CBtX3dpbGRjYXJkIHwgV2lsZGNhcmRBdEVuZCApOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgfldpbGRjYXJkUGF0dGVybigpOworICAgICAgICB2aXJ0dWFsIGJvb2wgbWF0Y2hlcyggc3RkOjpzdHJpbmcgY29uc3QmIHN0ciApIGNvbnN0IHsKKyAgICAgICAgICAgIHN3aXRjaCggbV93aWxkY2FyZCApIHsKKyAgICAgICAgICAgICAgICBjYXNlIE5vV2lsZGNhcmQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBtX3BhdHRlcm4gPT0gYWRqdXN0Q2FzZSggc3RyICk7CisgICAgICAgICAgICAgICAgY2FzZSBXaWxkY2FyZEF0U3RhcnQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmRzV2l0aCggYWRqdXN0Q2FzZSggc3RyICksIG1fcGF0dGVybiApOworICAgICAgICAgICAgICAgIGNhc2UgV2lsZGNhcmRBdEVuZDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXJ0c1dpdGgoIGFkanVzdENhc2UoIHN0ciApLCBtX3BhdHRlcm4gKTsKKyAgICAgICAgICAgICAgICBjYXNlIFdpbGRjYXJkQXRCb3RoRW5kczoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnRhaW5zKCBhZGp1c3RDYXNlKCBzdHIgKSwgbV9wYXR0ZXJuICk7CisgICAgICAgICAgICB9CisKKyNpZmRlZiBfX2NsYW5nX18KKyNwcmFnbWEgY2xhbmcgZGlhZ25vc3RpYyBwdXNoCisjcHJhZ21hIGNsYW5nIGRpYWdub3N0aWMgaWdub3JlZCAiLVd1bnJlYWNoYWJsZS1jb2RlIgorI2VuZGlmCisgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAiVW5rbm93biBlbnVtIiApOworI2lmZGVmIF9fY2xhbmdfXworI3ByYWdtYSBjbGFuZyBkaWFnbm9zdGljIHBvcAorI2VuZGlmCisgICAgICAgIH0KKyAgICBwcml2YXRlOgorICAgICAgICBzdGQ6OnN0cmluZyBhZGp1c3RDYXNlKCBzdGQ6OnN0cmluZyBjb25zdCYgc3RyICkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1fY2FzZVNlbnNpdGl2aXR5ID09IENhc2VTZW5zaXRpdmU6Ok5vID8gdG9Mb3dlciggc3RyICkgOiBzdHI7CisgICAgICAgIH0KKyAgICAgICAgQ2FzZVNlbnNpdGl2ZTo6Q2hvaWNlIG1fY2FzZVNlbnNpdGl2aXR5OworICAgICAgICBXaWxkY2FyZFBvc2l0aW9uIG1fd2lsZGNhcmQ7CisgICAgICAgIHN0ZDo6c3RyaW5nIG1fcGF0dGVybjsKKyAgICB9OworfQorCisjaW5jbHVkZSA8c3RyaW5nPgorI2luY2x1ZGUgPHZlY3Rvcj4KKworbmFtZXNwYWNlIENhdGNoIHsKKworICAgIGNsYXNzIFRlc3RTcGVjIHsKKyAgICAgICAgc3RydWN0IFBhdHRlcm4gOiBTaGFyZWRJbXBsPD4geworICAgICAgICAgICAgdmlydHVhbCB+UGF0dGVybigpOworICAgICAgICAgICAgdmlydHVhbCBib29sIG1hdGNoZXMoIFRlc3RDYXNlSW5mbyBjb25zdCYgdGVzdENhc2UgKSBjb25zdCA9IDA7CisgICAgICAgIH07CisgICAgICAgIGNsYXNzIE5hbWVQYXR0ZXJuIDogcHVibGljIFBhdHRlcm4geworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICBOYW1lUGF0dGVybiggc3RkOjpzdHJpbmcgY29uc3QmIG5hbWUgKQorICAgICAgICAgICAgOiBtX3dpbGRjYXJkUGF0dGVybiggdG9Mb3dlciggbmFtZSApLCBDYXNlU2Vuc2l0aXZlOjpObyApCisgICAgICAgICAgICB7fQorICAgICAgICAgICAgdmlydHVhbCB+TmFtZVBhdHRlcm4oKTsKKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaGVzKCBUZXN0Q2FzZUluZm8gY29uc3QmIHRlc3RDYXNlICkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBtX3dpbGRjYXJkUGF0dGVybi5tYXRjaGVzKCB0b0xvd2VyKCB0ZXN0Q2FzZS5uYW1lICkgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIFdpbGRjYXJkUGF0dGVybiBtX3dpbGRjYXJkUGF0dGVybjsKKyAgICAgICAgfTsKKworICAgICAgICBjbGFzcyBUYWdQYXR0ZXJuIDogcHVibGljIFBhdHRlcm4geworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICBUYWdQYXR0ZXJuKCBzdGQ6OnN0cmluZyBjb25zdCYgdGFnICkgOiBtX3RhZyggdG9Mb3dlciggdGFnICkgKSB7fQorICAgICAgICAgICAgdmlydHVhbCB+VGFnUGF0dGVybigpOworICAgICAgICAgICAgdmlydHVhbCBib29sIG1hdGNoZXMoIFRlc3RDYXNlSW5mbyBjb25zdCYgdGVzdENhc2UgKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRlc3RDYXNlLmxjYXNlVGFncy5maW5kKCBtX3RhZyApICE9IHRlc3RDYXNlLmxjYXNlVGFncy5lbmQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG1fdGFnOworICAgICAgICB9OworCisgICAgICAgIGNsYXNzIEV4Y2x1ZGVkUGF0dGVybiA6IHB1YmxpYyBQYXR0ZXJuIHsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgRXhjbHVkZWRQYXR0ZXJuKCBQdHI8UGF0dGVybj4gY29uc3QmIHVuZGVybHlpbmdQYXR0ZXJuICkgOiBtX3VuZGVybHlpbmdQYXR0ZXJuKCB1bmRlcmx5aW5nUGF0dGVybiApIHt9CisgICAgICAgICAgICB2aXJ0dWFsIH5FeGNsdWRlZFBhdHRlcm4oKTsKKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCBtYXRjaGVzKCBUZXN0Q2FzZUluZm8gY29uc3QmIHRlc3RDYXNlICkgY29uc3QgeyByZXR1cm4gIW1fdW5kZXJseWluZ1BhdHRlcm4tPm1hdGNoZXMoIHRlc3RDYXNlICk7IH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIFB0cjxQYXR0ZXJuPiBtX3VuZGVybHlpbmdQYXR0ZXJuOworICAgICAgICB9OworCisgICAgICAgIHN0cnVjdCBGaWx0ZXIgeworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8UHRyPFBhdHRlcm4+ID4gbV9wYXR0ZXJuczsKKworICAgICAgICAgICAgYm9vbCBtYXRjaGVzKCBUZXN0Q2FzZUluZm8gY29uc3QmIHRlc3RDYXNlICkgY29uc3QgeworICAgICAgICAgICAgICAgIC8vIEFsbCBwYXR0ZXJucyBpbiBhIGZpbHRlciBtdXN0IG1hdGNoIGZvciB0aGUgZmlsdGVyIHRvIGJlIGEgbWF0Y2gKKyAgICAgICAgICAgICAgICBmb3IoIHN0ZDo6dmVjdG9yPFB0cjxQYXR0ZXJuPiA+Ojpjb25zdF9pdGVyYXRvciBpdCA9IG1fcGF0dGVybnMuYmVnaW4oKSwgaXRFbmQgPSBtX3BhdHRlcm5zLmVuZCgpOyBpdCAhPSBpdEVuZDsgKytpdCApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYoICEoKml0KS0+bWF0Y2hlcyggdGVzdENhc2UgKSApCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgcHVibGljOgorICAgICAgICBib29sIGhhc0ZpbHRlcnMoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gIW1fZmlsdGVycy5lbXB0eSgpOworICAgICAgICB9CisgICAgICAgIGJvb2wgbWF0Y2hlc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lsdGVyOworICAgICAgICBUZXN0U3BlYyBtX3Rlc3RTcGVjOworICAgICAgICBJVGFnQWxpYXNSZWdpc3RyeSBjb25zdCogbV90YWdBbGlhc2VzOworCisgICAgcHVibGljOgorICAgICAgICBUZXN0U3BlY1BhcnNlciggSVRhZ0FsaWFzUmVnaXN0cnkgY29uc3QmIHRhZ0FsaWFzZXMgKSA6IG1fdGFnQWxpYXNlcyggJnRhZ0FsaWFzZXMgKSB7fQorCisgICAgICAgIFRlc3RTcGVjUGFyc2VyJiBwYXJzZSggc3RkOjpzdHJpbmcgY29uc3QmIGFyZyApIHsKKyAgICAgICAgICAgIG1fbW9kZSA9IE5vbmU7CisgICAgICAgICAgICBtX2V4Y2x1c2lvbiA9IGZhbHNlOworICAgICAgICAgICAgbV9zdGFydCA9IHN0ZDo6c3RyaW5nOjpucG9zOworICAgICAgICAgICAgbV9hcmcgPSBtX3RhZ0FsaWFzZXMtPmV4cGFuZEFsaWFzZXMoIGFyZyApOworICAgICAgICAgICAgbV9lc2NhcGVDaGFycy5jbGVhcigpOworICAgICAgICAgICAgZm9yKCBtX3BvcyA9IDA7IG1fcG9zIDwgbV9hcmcuc2l6ZSgpOyArK21fcG9zICkKKyAgICAgICAgICAgICAgICB2aXNpdENoYXIoIG1fYXJnW21fcG9zXSApOworICAgICAgICAgICAgaWYoIG1fbW9kZSA9PSBOYW1lICkKKyAgICAgICAgICAgICAgICBhZGRQYXR0ZXJuPFRlc3RTcGVjOjpOYW1lUGF0dGVybj4oKTsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorICAgICAgICBUZXN0U3BlYyB0ZXN0U3BlYygpIHsKKyAgICAgICAgICAgIGFkZEZpbHRlcigpOworICAgICAgICAgICAgcmV0dXJuIG1fdGVzdFNwZWM7CisgICAgICAgIH0KKyAgICBwcml2YXRlOgorICAgICAgICB2b2lkIHZpc2l0Q2hhciggY2hhciBjICkgeworICAgICAgICAgICAgaWYoIG1fbW9kZSA9PSBOb25lICkgeworICAgICAgICAgICAgICAgIHN3aXRjaCggYyApIHsKKyAgICAgICAgICAgICAgICBjYXNlICcgJzogcmV0dXJuOworICAgICAgICAgICAgICAgIGNhc2UgJ34nOiBtX2V4Y2x1c2lvbiA9IHRydWU7IHJldHVybjsKKyAgICAgICAgICAgICAgICBjYXNlICdbJzogcmV0dXJuIHN0YXJ0TmV3TW9kZSggVGFnLCArK21fcG9zICk7CisgICAgICAgICAgICAgICAgY2FzZSAnIic6IHJldHVybiBzdGFydE5ld01vZGUoIFF1b3RlZE5hbWUsICsrbV9wb3MgKTsKKyAgICAgICAgICAgICAgICBjYXNlICdcXCc6IHJldHVybiBlc2NhcGUoKTsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OiBzdGFydE5ld01vZGUoIE5hbWUsIG1fcG9zICk7IGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKCBtX21vZGUgPT0gTmFtZSApIHsKKyAgICAgICAgICAgICAgICBpZiggYyA9PSAnLCcgKSB7CisgICAgICAgICAgICAgICAgICAgIGFkZFBhdHRlcm48VGVzdFNwZWM6Ok5hbWVQYXR0ZXJuPigpOworICAgICAgICAgICAgICAgICAgICBhZGRGaWx0ZXIoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiggYyA9PSAnWycgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBzdWJTdHJpbmcoKSA9PSAiZXhjbHVkZToiICkKKyAgICAgICAgICAgICAgICAgICAgICAgIG1fZXhjbHVzaW9uID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgYWRkUGF0dGVybjxUZXN0U3BlYzo6TmFtZVBhdHRlcm4+KCk7CisgICAgICAgICAgICAgICAgICAgIHN0YXJ0TmV3TW9kZSggVGFnLCArK21fcG9zICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYoIGMgPT0gJ1xcJyApCisgICAgICAgICAgICAgICAgICAgIGVzY2FwZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiggbV9tb2RlID09IEVzY2FwZWROYW1lICkKKyAgICAgICAgICAgICAgICBtX21vZGUgPSBOYW1lOworICAgICAgICAgICAgZWxzZSBpZiggbV9tb2RlID09IFF1b3RlZE5hbWUgJiYgYyA9PSAnIicgKQorICAgICAgICAgICAgICAgIGFkZFBhdHRlcm48VGVzdFNwZWM6Ok5hbWVQYXR0ZXJuPigpOworICAgICAgICAgICAgZWxzZSBpZiggbV9tb2RlID09IFRhZyAmJiBjID09ICddJyApCisgICAgICAgICAgICAgICAgYWRkUGF0dGVybjxUZXN0U3BlYzo6VGFnUGF0dGVybj4oKTsKKyAgICAgICAgfQorICAgICAgICB2b2lkIHN0YXJ0TmV3TW9kZSggTW9kZSBtb2RlLCBzdGQ6OnNpemVfdCBzdGFydCApIHsKKyAgICAgICAgICAgIG1fbW9kZSA9IG1vZGU7CisgICAgICAgICAgICBtX3N0YXJ0ID0gc3RhcnQ7CisgICAgICAgIH0KKyAgICAgICAgdm9pZCBlc2NhcGUoKSB7CisgICAgICAgICAgICBpZiggbV9tb2RlID09IE5vbmUgKQorICAgICAgICAgICAgICAgIG1fc3RhcnQgPSBtX3BvczsKKyAgICAgICAgICAgIG1fbW9kZSA9IEVzY2FwZWROYW1lOworICAgICAgICAgICAgbV9lc2NhcGVDaGFycy5wdXNoX2JhY2soIG1fcG9zICk7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjpzdHJpbmcgc3ViU3RyaW5nKCkgY29uc3QgeyByZXR1cm4gbV9hcmcuc3Vic3RyKCBtX3N0YXJ0LCBtX3BvcyAtIG1fc3RhcnQgKTsgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICB2b2lkIGFkZFBhdHRlcm4oKSB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyB0b2tlbiA9IHN1YlN0cmluZygpOworICAgICAgICAgICAgZm9yKCBzaXplX3QgaSA9IDA7IGkgPCBtX2VzY2FwZUNoYXJzLnNpemUoKTsgKytpICkKKyAgICAgICAgICAgICAgICB0b2tlbiA9IHRva2VuLnN1YnN0ciggMCwgbV9lc2NhcGVDaGFyc1tpXS1tX3N0YXJ0LWkgKSArIHRva2VuLnN1YnN0ciggbV9lc2NhcGVDaGFyc1tpXS1tX3N0YXJ0LWkrMSApOworICAgICAgICAgICAgbV9lc2NhcGVDaGFycy5jbGVhcigpOworICAgICAgICAgICAgaWYoIHN0YXJ0c1dpdGgoIHRva2VuLCAiZXhjbHVkZToiICkgKSB7CisgICAgICAgICAgICAgICAgbV9leGNsdXNpb24gPSB0cnVlOworICAgICAgICAgICAgICAgIHRva2VuID0gdG9rZW4uc3Vic3RyKCA4ICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiggIXRva2VuLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgUHRyPFRlc3RTcGVjOjpQYXR0ZXJuPiBwYXR0ZXJuID0gbmV3IFQoIHRva2VuICk7CisgICAgICAgICAgICAgICAgaWYoIG1fZXhjbHVzaW9uICkKKyAgICAgICAgICAgICAgICAgICAgcGF0dGVybiA9IG5ldyBUZXN0U3BlYzo6RXhjbHVkZWRQYXR0ZXJuKCBwYXR0ZXJuICk7CisgICAgICAgICAgICAgICAgbV9jdXJyZW50RmlsdGVyLm1fcGF0dGVybnMucHVzaF9iYWNrKCBwYXR0ZXJuICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtX2V4Y2x1c2lvbiA9IGZhbHNlOworICAgICAgICAgICAgbV9tb2RlID0gTm9uZTsKKyAgICAgICAgfQorICAgICAgICB2b2lkIGFkZEZpbHRlcigpIHsKKyAgICAgICAgICAgIGlmKCAhbV9jdXJyZW50RmlsdGVyLm1fcGF0dGVybnMuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICBtX3Rlc3RTcGVjLm1fZmlsdGVycy5wdXNoX2JhY2soIG1fY3VycmVudEZpbHRlciApOworICAgICAgICAgICAgICAgIG1fY3VycmVudEZpbHRlciA9IFRlc3RTcGVjOjpGaWx0ZXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisgICAgaW5saW5lIFRlc3RTcGVjIHBhcnNlVGVzdFNwZWMoIHN0ZDo6c3RyaW5nIGNvbnN0JiBhcmcgKSB7CisgICAgICAgIHJldHVybiBUZXN0U3BlY1BhcnNlciggSVRhZ0FsaWFzUmVnaXN0cnk6OmdldCgpICkucGFyc2UoIGFyZyApLnRlc3RTcGVjKCk7CisgICAgfQorCit9IC8vIG5hbWVzcGFjZSBDYXRjaAorCisjaWZkZWYgX19jbGFuZ19fCisjcHJhZ21hIGNsYW5nIGRpYWdub3N0aWMgcG9wCisjZW5kaWYKKworLy8gI2luY2x1ZGVkIGZyb206IGNhdGNoX2ludGVyZmFjZXNfY29uZmlnLmgKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX0lOVEVSRkFDRVNfQ09ORklHX0hfSU5DTFVERUQKKworI2luY2x1ZGUgPGlvc2Z3ZD4KKyNpbmNsdWRlIDxzdHJpbmc+CisjaW5jbHVkZSA8dmVjdG9yPgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgc3RydWN0IFZlcmJvc2l0eSB7IGVudW0gTGV2ZWwgeworICAgICAgICBOb091dHB1dCA9IDAsCisgICAgICAgIFF1aWV0LAorICAgICAgICBOb3JtYWwKKyAgICB9OyB9OworCisgICAgc3RydWN0IFdhcm5BYm91dCB7IGVudW0gV2hhdCB7CisgICAgICAgIE5vdGhpbmcgPSAweDAwLAorICAgICAgICBOb0Fzc2VydGlvbnMgPSAweDAxCisgICAgfTsgfTsKKworICAgIHN0cnVjdCBTaG93RHVyYXRpb25zIHsgZW51bSBPck5vdCB7CisgICAgICAgIERlZmF1bHRGb3JSZXBvcnRlciwKKyAgICAgICAgQWx3YXlzLAorICAgICAgICBOZXZlcgorICAgIH07IH07CisgICAgc3RydWN0IFJ1blRlc3RzIHsgZW51bSBJbldoYXRPcmRlciB7CisgICAgICAgIEluRGVjbGFyYXRpb25PcmRlciwKKyAgICAgICAgSW5MZXhpY29ncmFwaGljYWxPcmRlciwKKyAgICAgICAgSW5SYW5kb21PcmRlcgorICAgIH07IH07CisgICAgc3RydWN0IFVzZUNvbG91ciB7IGVudW0gWWVzT3JObyB7CisgICAgICAgIEF1dG8sCisgICAgICAgIFllcywKKyAgICAgICAgTm8KKyAgICB9OyB9OworCisgICAgY2xhc3MgVGVzdFNwZWM7CisKKyAgICBzdHJ1Y3QgSUNvbmZpZyA6IElTaGFyZWQgeworCisgICAgICAgIHZpcnR1YWwgfklDb25maWcoKTsKKworICAgICAgICB2aXJ0dWFsIGJvb2wgYWxsb3dUaHJvd3MoKSBjb25zdCA9IDA7CisgICAgICAgIHZpcnR1YWwgc3RkOjpvc3RyZWFtJiBzdHJlYW0oKSBjb25zdCA9IDA7CisgICAgICAgIHZpcnR1YWwgc3RkOjpzdHJpbmcgbmFtZSgpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCBib29sIGluY2x1ZGVTdWNjZXNzZnVsUmVzdWx0cygpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCBib29sIHNob3VsZERlYnVnQnJlYWsoKSBjb25zdCA9IDA7CisgICAgICAgIHZpcnR1YWwgYm9vbCB3YXJuQWJvdXRNaXNzaW5nQXNzZXJ0aW9ucygpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCBpbnQgYWJvcnRBZnRlcigpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCBib29sIHNob3dJbnZpc2libGVzKCkgY29uc3QgPSAwOworICAgICAgICB2aXJ0dWFsIFNob3dEdXJhdGlvbnM6Ok9yTm90IHNob3dEdXJhdGlvbnMoKSBjb25zdCA9IDA7CisgICAgICAgIHZpcnR1YWwgVGVzdFNwZWMgY29u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3V0U3RyZWFtKCk7CisgICAgICAgIHZpcnR1YWwgfkRlYnVnT3V0U3RyZWFtKCkgQ0FUQ0hfTk9FWENFUFQ7CisKKyAgICBwdWJsaWM6IC8vIElTdHJlYW0KKyAgICAgICAgdmlydHVhbCBzdGQ6Om9zdHJlYW0mIHN0cmVhbSgpIGNvbnN0IENBVENIX09WRVJSSURFOworICAgIH07Cit9CisKKyNpbmNsdWRlIDxtZW1vcnk+CisjaW5jbHVkZSA8dmVjdG9yPgorI2luY2x1ZGUgPHN0cmluZz4KKyNpbmNsdWRlIDxzdGRleGNlcHQ+CisKKyNpZm5kZWYgQ0FUQ0hfQ09ORklHX0NPTlNPTEVfV0lEVEgKKyNkZWZpbmUgQ0FUQ0hfQ09ORklHX0NPTlNPTEVfV0lEVEggODAKKyNlbmRpZgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgc3RydWN0IENvbmZpZ0RhdGEgeworCisgICAgICAgIENvbmZpZ0RhdGEoKQorICAgICAgICA6ICAgbGlzdFRlc3RzKCBmYWxzZSApLAorICAgICAgICAgICAgbGlzdFRhZ3MoIGZhbHNlICksCisgICAgICAgICAgICBsaXN0UmVwb3J0ZXJzKCBmYWxzZSApLAorICAgICAgICAgICAgbGlzdFRlc3ROYW1lc09ubHkoIGZhbHNlICksCisgICAgICAgICAgICBzaG93U3VjY2Vzc2Z1bFRlc3RzKCBmYWxzZSApLAorICAgICAgICAgICAgc2hvdWxkRGVidWdCcmVhayggZmFsc2UgKSwKKyAgICAgICAgICAgIG5vVGhyb3coIGZhbHNlICksCisgICAgICAgICAgICBzaG93SGVscCggZmFsc2UgKSwKKyAgICAgICAgICAgIHNob3dJbnZpc2libGVzKCBmYWxzZSApLAorICAgICAgICAgICAgZmlsZW5hbWVzQXNUYWdzKCBmYWxzZSApLAorICAgICAgICAgICAgYWJvcnRBZnRlciggLTEgKSwKKyAgICAgICAgICAgIHJuZ1NlZWQoIDAgKSwKKyAgICAgICAgICAgIHZlcmJvc2l0eSggVmVyYm9zaXR5OjpOb3JtYWwgKSwKKyAgICAgICAgICAgIHdhcm5pbmdzKCBXYXJuQWJvdXQ6Ok5vdGhpbmcgKSwKKyAgICAgICAgICAgIHNob3dEdXJhdGlvbnMoIFNob3dEdXJhdGlvbnM6OkRlZmF1bHRGb3JSZXBvcnRlciApLAorICAgICAgICAgICAgcnVuT3JkZXIoIFJ1blRlc3RzOjpJbkRlY2xhcmF0aW9uT3JkZXIgKSwKKyAgICAgICAgICAgIHVzZUNvbG91ciggVXNlQ29sb3VyOjpBdXRvICkKKyAgICAgICAge30KKworICAgICAgICBib29sIGxpc3RUZXN0czsKKyAgICAgICAgYm9vbCBsaXN0VGFnczsKKyAgICAgICAgYm9vbCBsaXN0UmVwb3J0ZXJzOworICAgICAgICBib29sIGxpc3RUZXN0TmFtZXNPbmx5OworCisgICAgICAgIGJvb2wgc2hvd1N1Y2Nlc3NmdWxUZXN0czsKKyAgICAgICAgYm9vbCBzaG91bGREZWJ1Z0JyZWFrOworICAgICAgICBib29sIG5vVGhyb3c7CisgICAgICAgIGJvb2wgc2hvd0hlbHA7CisgICAgICAgIGJvb2wgc2hvd0ludmlzaWJsZXM7CisgICAgICAgIGJvb2wgZmlsZW5hbWVzQXNUYWdzOworCisgICAgICAgIGludCBhYm9ydEFmdGVyOworICAgICAgICB1bnNpZ25lZCBpbnQgcm5nU2VlZDsKKworICAgICAgICBWZXJib3NpdHk6OkxldmVsIHZlcmJvc2l0eTsKKyAgICAgICAgV2FybkFib3V0OjpXaGF0IHdhcm5pbmdzOworICAgICAgICBTaG93RHVyYXRpb25zOjpPck5vdCBzaG93RHVyYXRpb25zOworICAgICAgICBSdW5UZXN0czo6SW5XaGF0T3JkZXIgcnVuT3JkZXI7CisgICAgICAgIFVzZUNvbG91cjo6WWVzT3JObyB1c2VDb2xvdXI7CisKKyAgICAgICAgc3RkOjpzdHJpbmcgb3V0cHV0RmlsZW5hbWU7CisgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU7CisgICAgICAgIHN0ZDo6c3RyaW5nIHByb2Nlc3NOYW1lOworCisgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiByZXBvcnRlck5hbWVzOworICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gdGVzdHNPclRhZ3M7CisgICAgICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiBzZWN0aW9uc1RvUnVuOworICAgIH07CisKKyAgICBjbGFzcyBDb25maWcgOiBwdWJsaWMgU2hhcmVkSW1wbDxJQ29uZmlnPiB7CisgICAgcHJpdmF0ZToKKyAgICAgICAgQ29uZmlnKCBDb25maWcgY29uc3QmIG90aGVyICk7CisgICAgICAgIENvbmZpZyYgb3BlcmF0b3IgPSAoIENvbmZpZyBjb25zdCYgb3RoZXIgKTsKKyAgICAgICAgdmlydHVhbCB2b2lkIGR1bW15KCk7CisgICAgcHVibGljOgorCisgICAgICAgIENvbmZpZygpCisgICAgICAgIHt9CisKKyAgICAgICAgQ29uZmlnKCBDb25maWdEYXRhIGNvbnN0JiBkYXRhICkKKyAgICAgICAgOiAgIG1fZGF0YSggZGF0YSApLAorICAgICAgICAgICAgbV9zdHJlYW0oIG9wZW5TdHJlYW0oKSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKCAhZGF0YS50ZXN0c09yVGFncy5lbXB0eSgpICkgeworICAgICAgICAgICAgICAgIFRlc3RTcGVjUGFyc2VyIHBhcnNlciggSVRhZ0FsaWFzUmVnaXN0cnk6OmdldCgpICk7CisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IGRhdGEudGVzdHNPclRhZ3Muc2l6ZSgpOyArK2kgKQorICAgICAgICAgICAgICAgICAgICBwYXJzZXIucGFyc2UoIGRhdGEudGVzdHNPclRhZ3NbaV0gKTsKKyAgICAgICAgICAgICAgICBtX3Rlc3RTcGVjID0gcGFyc2VyLnRlc3RTcGVjKCk7CisgICAgICAgICAg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ZXR1cm4gbV9kYXRhLnJ1bk9yZGVyOyB9CisgICAgICAgIHZpcnR1YWwgdW5zaWduZWQgaW50IHJuZ1NlZWQoKSBjb25zdCBDQVRDSF9PVkVSUklERSAgICAgICAgICAgICB7IHJldHVybiBtX2RhdGEucm5nU2VlZDsgfQorICAgICAgICB2aXJ0dWFsIFVzZUNvbG91cjo6WWVzT3JObyB1c2VDb2xvdXIoKSBjb25zdCBDQVRDSF9PVkVSUklERSAgICAgeyByZXR1cm4gbV9kYXRhLnVzZUNvbG91cjsgfQorICAgICAgICB2aXJ0dWFsIGJvb2wgc2hvdWxkRGVidWdCcmVhaygpIGNvbnN0IENBVENIX09WRVJSSURFIHsgcmV0dXJuIG1fZGF0YS5zaG91bGREZWJ1Z0JyZWFrOyB9CisgICAgICAgIHZpcnR1YWwgaW50IGFib3J0QWZ0ZXIoKSBjb25zdCBDQVRDSF9PVkVSUklERSB7IHJldHVybiBtX2RhdGEuYWJvcnRBZnRlcjsgfQorICAgICAgICB2aXJ0dWFsIGJvb2wgc2hvd0ludmlzaWJsZXMoKSBjb25zdCBDQVRDSF9PVkVSUklERSB7IHJldHVybiBtX2RhdGEuc2hvd0ludmlzaWJsZXM7IH0KKworICAgIHByaXZhdGU6CisKKyAgICAgICAgSVN0cmVhbSBjb25zdCogb3BlblN0cmVhbSgpIHsKKyAgICAgICAgICAgIGlmKCBtX2RhdGEub3V0cHV0RmlsZW5hbWUuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBDb3V0U3RyZWFtKCk7CisgICAgICAgICAgICBlbHNlIGlmKCBtX2RhdGEub3V0cHV0RmlsZW5hbWVbMF0gPT0gJyUnICkgeworICAgICAgICAgICAgICAgIGlmKCBtX2RhdGEub3V0cHV0RmlsZW5hbWUgPT0gIiVkZWJ1ZyIgKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERlYnVnT3V0U3RyZWFtKCk7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAg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AgICAgICAgICAgc3RkOjpzaXplX3QgaW5kZW50ID0gX2F0dHIuaW5pdGlhbEluZGVudCAhPSBzdGQ6OnN0cmluZzo6bnBvcworICAgICAgICAgICAgICAgID8gX2F0dHIuaW5pdGlhbEluZGVudAorICAgICAgICAgICAgICAgIDogX2F0dHIuaW5kZW50OworICAgICAgICAgICAgc3RkOjpzdHJpbmcgcmVtYWluZGVyID0gX3N0cjsKKworICAgICAgICAgICAgd2hpbGUoICFyZW1haW5kZXIuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICBpZiggbGluZXMuc2l6ZSgpID49IDEwMDAgKSB7CisgICAgICAgICAgICAgICAgICAgIGxpbmVzLnB1c2hfYmFjayggIi4uLiBtZXNzYWdlIHRydW5jYXRlZCBkdWUgdG8gZXhjZXNzaXZlIHNpemUiICk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgdGFiUG9zID0gc3RkOjpzdHJpbmc6Om5wb3M7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3Qgd2lkdGggPSAoc3RkOjptaW4pKCByZW1haW5kZXIuc2l6ZSgpLCBfYXR0ci53aWR0aCAtIGluZGVudCApOworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHBvcyA9IHJlbWFpbmRlci5maW5kX2ZpcnN0X29mKCAnXG4nICk7CisgICAgICAgICAgICAgICAgaWYoIHBvcyA8PSB3aWR0aCApIHsKKyAgICAgICAgICAgICAgICAgICAgd2lkdGggPSBwb3M7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHBvcyA9IHJlbWFpbmRlci5maW5kX2xhc3Rfb2YoIF9hdHRyLnRhYkNoYXIsIHdpZHRoICk7CisgICAgICAgICAgICAgICAgaWYoIHBvcyAhPSBzdGQ6OnN0cmluZzo6bnBvcyApIHsKKyAgICAgICAgICAgICAgICAgICAgdGFiUG9zID0gcG9zOworICAgICAgICAgICAgICAgICAgICBpZiggcmVtYWluZGVyW3dpZHRoXSA9PSAnXG4nICkKKyAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoLS07CisgICAgICAgICAgICAgICAgICAgIHJlbWFpbmRlciA9IHJlbWFpbmRlci5zdWJzdHIoIDAsIHRhYlBvcyApICsgcmVtYWluZGVyLnN1YnN0ciggdGFiUG9zKzEgKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiggd2lkdGggPT0gcmVtYWluZGVyLnNpemUoKSApIHsKKyAgICAgICAgICAgICAgICAgICAgc3BsaWNlTGluZSggaW5kZW50LCByZW1haW5kZXIsIHdpZHRoICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYoIHJlbWFpbmRlclt3aWR0aF0gPT0gJ1xuJyApIHsKKyAgICAgICAgICAgICAgICAgICAgc3BsaWNlTGluZSggaW5kZW50LCByZW1haW5kZXIsIHdpZHRoICk7CisgICAgICAgICAgICAgICAgICAgIGlmKCB3aWR0aCA8PSAxIHx8IHJlbWFpbmRlci5zaXplKCkgIT0gMSApCisgICAgICAgICAgICAgICAgICAgICAgICByZW1haW5kZXIgPSByZW1haW5kZXIuc3Vic3RyKCAxICk7CisgICAgICAgICAgICAgICAgICAgIGluZGVudCA9IF9hdHRyLmluZGVudDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHBvcyA9IHJlbWFpbmRlci5maW5kX2xhc3Rfb2YoIHdyYXBwYWJsZUNoYXJzLCB3aWR0aCApOworICAgICAgICAgICAgICAgICAgICBpZiggcG9zICE9IHN0ZDo6c3RyaW5nOjpucG9zICYmIHBvcyA+IDAgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGxpY2VMaW5lKCBpbmRlbnQsIHJlbWFpbmRlciwgcG9zICk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiggcmVtYWluZGVyWzBdID09ICcgJyApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtYWluZGVyID0gcmVtYWluZGVyLnN1YnN0ciggMSApOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgc3BsaWNlTGluZSggaW5kZW50LCByZW1haW5kZXIsIHdpZHRoLTEgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLmJhY2soKSArPSAiLSI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYoIGxpbmVzLnNpemUoKSA9PSAxICkKKyAgICAgICAgICAgICAgICAgICAgICAgIGluZGVudCA9IF9hdHRyLmluZGVudDsKKyAgICAgICAgICAgICAgICAgICAgaWYoIHRhYlBvcyAhPSBzdGQ6OnN0cmluZzo6bnBvcyApCisgICAgICAgICAgICAgICAgICAgICAgICBpbmRlbnQgKz0gdGFiUG9zOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgc3BsaWNlTGluZSggc3RkOjpzaXplX3QgX2luZGVudCwgc3RkOjpzdHJpbmcmIF9yZW1haW5kZXIsIHN0ZDo6c2l6ZV90IF9wb3MgKSB7CisgICAgICAgICAgICBsaW5lcy5wdXNoX2JhY2soIHN0ZDo6c3RyaW5nKCBfaW5kZW50LCAnICcgKSArIF9yZW1haW5kZXIuc3Vic3RyKCAwLCBfcG9zICkgKTsKKyAgICAgICAgICAgIF9yZW1haW5kZXIgPSBfcmVtYWluZGVyLnN1YnN0ciggX3BvcyApOworICAgICAgICB9CisKKyAgICAgICAgdHlwZWRlZiBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yIGNvbnN0X2l0ZXJhdG9yOworCisgICAgICAgIGNvbnN0X2l0ZXJhdG9yIGJlZ2luKCkgY29uc3QgeyByZXR1cm4gbGluZXMuYmVnaW4oKTsgfQorICAgICAgICBjb25zdF9pdGVyYXRvciBlbmQoKSBjb25zdCB7IHJldHVybiBsaW5lcy5lbmQoKTsgfQorICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgbGFzdCgpIGNvbnN0IHsgcmV0dXJuIGxpbmVzLmJhY2soKTsgfQorICAgICAgICBzdGQ6OnNpemVfdCBzaXplKCkgY29uc3QgeyByZXR1cm4gbGluZXMuc2l6ZSgpOyB9CisgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBvcGVyYXRvcltdKCBzdGQ6OnNpemVfdCBfaW5kZXggKSBjb25zdCB7IHJldHVybiBsaW5lc1tfaW5kZXhdOyB9CisgICAgICAgIHN0ZDo6c3RyaW5nIHRvU3RyaW5nKCkgY29uc3QgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgIG9zcyA8PCAqdGhpczsKKyAgICAgICAgICAgIHJldHVybiBvc3Muc3RyKCk7CisgICAgICAgIH0KKworICAgICAgICBpbmxpbmUgZnJpZW5kIHN0ZDo6b3N0cmVhbSYgb3BlcmF0b3IgPDwgKCBzdGQ6Om9zdHJlYW0mIF9zdHJlYW0sIFRleHQgY29uc3QmIF90ZXh0ICkgeworICAgICAgICAgICAgZm9yKCBUZXh0Ojpjb25zdF9pdGVyYXRvciBpdCA9IF90ZXh0LmJlZ2luKCksIGl0RW5kID0gX3RleHQuZW5kKCk7CisgICAgICAgICAgICAgICAgaXQgIT0gaXRFbmQ7ICsraXQgKSB7CisgICAgICAgICAgICAgICAgaWYoIGl0ICE9IF90ZXh0LmJlZ2luKCkgKQorICAgICAgICAgICAgICAgICAgICBfc3RyZWFtIDw8ICJcbiI7CisgICAgICAgICAgICAgICAgX3N0cmVhbSA8PCAqaXQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gX3N0cmVhbTsKKyAgICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgICAgc3RkO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25zdFJlZjxUIGNvbnN0PnsgdHlwZWRlZiBUIHR5cGU7IH07CisKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4gICAgc3RydWN0IElzQm9vbCAgICAgICB7IHN0YXRpYyBjb25zdCBib29sIHZhbHVlID0gZmFsc2U7IH07CisgICAgICAgIHRlbXBsYXRlPD4gICAgICAgICAgICAgIHN0cnVjdCBJc0Jvb2w8Ym9vbD4geyBzdGF0aWMgY29uc3QgYm9vbCB2YWx1ZSA9IHRydWU7IH07CisKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgdm9pZCBjb252ZXJ0SW50byggc3RkOjpzdHJpbmcgY29uc3QmIF9zb3VyY2UsIFQmIF9kZXN0ICkgeworICAgICAgICAgICAgc3RkOjpzdHJpbmdzdHJlYW0gc3M7CisgICAgICAgICAgICBzcyA8PCBfc291cmNlOworICAgICAgICAgICAgc3MgPj4gX2Rlc3Q7CisgICAgICAgICAgICBpZiggc3MuZmFpbCgpICkKKyAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OnJ1bnRpbWVfZXJyb3IoICJVbmFibGUgdG8gY29udmVydCAiICsgX3NvdXJjZSArICIgdG8gZGVzdGluYXRpb24gdHlwZSIgKTsKKyAgICAgICAgfQorICAgICAgICBpbmxpbmUgdm9pZCBjb252ZXJ0SW50byggc3RkOjpzdHJpbmcgY29uc3QmIF9zb3VyY2UsIHN0ZDo6c3RyaW5nJiBfZGVzdCApIHsKKyAgICAgICAgICAgIF9kZXN0ID0gX3NvdXJjZTsKKyAgICAgICAgfQorICAgICAgICBjaGFyIHRvTG93ZXJDaChjaGFyIGMpIHsKKyAgICAgICAgICAgIHJldHVybiBzdGF0aWNfY2FzdDxjaGFyPiggc3RkOjp0b2xvd2VyKCBjICkgKTsKKyAgICAgICAgfQorICAgICAgICBpbmxpbmUgdm9pZCBjb252ZXJ0SW50byggc3RkOjpzdHJpbmcgY29uc3QmIF9zb3VyY2UsIGJvb2w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DsKKyAgICAgICAgICAgICAgICBkZWxldGUgZnVuY3Rpb25PYmo7CisgICAgICAgICAgICAgICAgZnVuY3Rpb25PYmogPSBuZXdGdW5jdGlvbk9iajsKKyAgICAgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB+Qm91bmRBcmdGdW5jdGlvbigpIHsgZGVsZXRlIGZ1bmN0aW9uT2JqOyB9CisKKyAgICAgICAgICAgIHZvaWQgc2V0KCBDb25maWdUJiBjb25maWcsIHN0ZDo6c3RyaW5nIGNvbnN0JiB2YWx1ZSApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBmdW5jdGlvbk9iai0+c2V0KCBjb25maWcsIHZhbHVlICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBib29sIHRha2VzQXJnKCkgY29uc3QgeyByZXR1cm4gZnVuY3Rpb25PYmotPnRha2VzQXJnKCk7IH0KKworICAgICAgICAgICAgYm9vbCBpc1NldCgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb25PYmogIT0gQ0xBUkFfTlVMTDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIElBcmdGdW5jdGlvbjxDb25maWdUPiogZnVuY3Rpb25PYmo7CisgICAgICAgIH07CisKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgQz4KKyAgICAgICAgc3RydWN0IE51bGxCaW5kZXIgOiBJQXJnRnVuY3Rpb248Qz57CisgICAgICAgICAgICB2aXJ0dWFsIHZvaWQgc2V0KCBDJiwgc3RkOjpzdHJpbmcgY29uc3QmICkgY29uc3Qge30KKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCB0YWtlc0FyZygpIGNvbnN0IHsgcmV0dXJuIHRydWU7IH0KKyAgICAgICAgICAgIHZpcnR1YWwgSUFyZ0Z1bmN0aW9uPEM+KiBjbG9uZSgpIGNvbnN0IHsgcmV0dXJuIG5ldyBOdWxsQmluZGVyKCAqdGhpcyApOyB9CisgICAgICAgIH07CisKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgQywgdHlwZW5hbWUgTT4KKyAgICAgICAgc3RydWN0IEJvdW5kRGF0YU1lbWJlciA6IElBcmdGdW5jdGlvbjxDPnsKKyAgICAgICAgICAgIEJvdW5kRGF0YU1lbWJlciggTSBDOjoqIF9tZW1iZXIgKSA6IG1lbWJlciggX21lbWJlciApIHt9CisgICAgICAgICAgICB2aXJ0dWFsIHZvaWQgc2V0KCBDJiBwLCBzdGQ6OnN0cmluZyBjb25zdCYgc3RyaW5nVmFsdWUgKSBjb25zdCB7CisgICAgICAgICAgICAgICAgY29udmVydEludG8oIHN0cmluZ1ZhbHVlLCBwLiptZW1iZXIgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCB0YWtlc0FyZygpIGNvbnN0IHsgcmV0dXJuICFJc0Jvb2w8TT46OnZhbHVlOyB9CisgICAgICAgICAgICB2aXJ0dWFsIElBcmdGdW5jdGlvbjxDPiogY2xvbmUoKSBjb25zdCB7IHJldHVybiBuZXcgQm91bmREYXRhTWVtYmVyKCAqdGhpcyApOyB9CisgICAgICAgICAgICBNIEM6OiogbWVtYmVyOworICAgICAgICB9OworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBDLCB0eXBlbmFtZSBNPgorICAgICAgICBzdHJ1Y3QgQm91bmRVbmFyeU1ldGhvZCA6IElBcmdGdW5jdGlvbjxDPnsKKyAgICAgICAgICAgIEJvdW5kVW5hcnlNZXRob2QoIHZvaWQgKEM6OipfbWVtYmVyKSggTSApICkgOiBtZW1iZXIoIF9tZW1iZXIgKSB7fQorICAgICAgICAgICAgdmlydHVhbCB2b2lkIHNldCggQyYgcCwgc3RkOjpzdHJpbmcgY29uc3QmIHN0cmluZ1ZhbHVlICkgY29uc3QgeworICAgICAgICAgICAgICAgIHR5cGVuYW1lIFJlbW92ZUNvbnN0UmVm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bmUoKSBjb25zdCB7IHJldHVybiBuZXcgQm91bmROdWxsYXJ5TWV0aG9kKCAqdGhpcyApOyB9CisgICAgICAgICAgICB2b2lkIChDOjoqbWVtYmVyKSgpOworICAgICAgICB9OworCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEM+CisgICAgICAgIHN0cnVjdCBCb3VuZFVuYXJ5RnVuY3Rpb24gOiBJQXJnRnVuY3Rpb248Qz57CisgICAgICAgICAgICBCb3VuZFVuYXJ5RnVuY3Rpb24oIHZvaWQgKCpfZnVuY3Rpb24pKCBDJiApICkgOiBmdW5jdGlvbiggX2Z1bmN0aW9uICkge30KKyAgICAgICAgICAgIHZpcnR1YWwgdm9pZCBzZXQoIEMmIG9iaiwgc3RkOjpzdHJpbmcgY29uc3QmIHN0cmluZ1ZhbHVlICkgY29uc3QgeworICAgICAgICAgICAgICAgIGJvb2wgdmFsdWU7CisgICAgICAgICAgICAgICAgY29udmVydEludG8oIHN0cmluZ1ZhbHVlLCB2YWx1ZSApOworICAgICAgICAgICAgICAgIGlmKCB2YWx1ZSApCisgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uKCBvYmogKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZpcnR1YWwgYm9vbCB0YWtlc0FyZygpIGNvbnN0IHsgcmV0dXJuIGZhbHNlOyB9CisgICAgICAgICAgICB2aXJ0dWFsIElBcmdGdW5jdGlvbjxDPiogY2xvbmUoKSBjb25zdCB7IHJldHVybiBuZXcgQm91bmRVbmFyeUZ1bmN0aW9uKCAqdGhpcyApOyB9CisgICAgICAgICAgICB2b2lkICgqZnVuY3Rpb24pKCBDJiApOworICAgICAgICB9OworCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEMsIHR5cGVuYW1lIFQ+CisgICAgICAgIHN0cnVjdCBCb3VuZEJpbmFyeUZ1bmN0aW9uIDogSUFyZ0Z1bmN0aW9uPEM+eworICAgICAgICAgICAgQm91bmRCaW5hcnlGdW5jdG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TsKKworICAgICAgICByZXR1cm4gYXJnczsKKyAgICB9CisKKyAgICBjbGFzcyBQYXJzZXIgeworICAgICAgICBlbnVtIE1vZGUgeyBOb25lLCBNYXliZVNob3J0T3B0LCBTbGFzaE9wdCwgU2hvcnRPcHQsIExvbmdPcHQsIFBvc2l0aW9uYWwgfTsKKyAgICAgICAgTW9kZSBtb2RlOworICAgICAgICBzdGQ6OnNpemVfdCBmcm9tOworICAgICAgICBib29sIGluUXVvdGVzOworICAgIHB1YmxpYzoKKworICAgICAgICBzdHJ1Y3QgVG9rZW4geworICAgICAgICAgICAgZW51bSBUeXBlIHsgUG9zaXRpb25hbCwgU2hvcnRPcHQsIExvbmdPcHQgfTsKKyAgICAgICAgICAgIFRva2VuKCBUeXBlIF90eXBlLCBzdGQ6OnN0cmluZyBjb25zdCYgX2RhdGEgKSA6IHR5cGUoIF90eXBlICksIGRhdGEoIF9kYXRhICkge30KKyAgICAgICAgICAgIFR5cGUgdHlwZTsKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGRhdGE7CisgICAgICAgIH07CisKKyAgICAgICAgUGFyc2VyKCkgOiBtb2RlKCBOb25lICksIGZyb20oIDAgKSwgaW5RdW90ZXMoIGZhbHNlICl7fQorCisgICAgICAgIHZvaWQgcGFyc2VJbnRvVG9rZW5zKCBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gY29uc3QmIGFyZ3MsIHN0ZDo6dmVjdG9yPFRva2VuPiYgdG9rZW5zICkgeworICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgZG91YmxlRGFzaCA9ICItLSI7CisgICAgICAgICAgICBmb3IoIHN0ZDo6c2l6ZV90IGkgPSAxOyBpIDwgYXJncy5zaXplKCkgJiYgYXJnc1tpXSAhPSBkb3VibGVEYXNoOyArK2kgKQorICAgICAgICAgICAgICAgIHBhcnNlSW50b1Rva2VucyggYXJnc1tpXSwgdG9rZW5zKTsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgcGFyc2VJbnRvVG9rZW5zKCBzdGQ6OnN0cmluZyBjb25zdCYgYXJnLCBzdGQ6OnZlY3RvcjxUb2tlbj4mIHRva2VucyApIHsKKyAgICAgICAgICAgIGZvciggc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBhcmcuc2l6ZSgpOyArK2kgKSB7CisgICAgICAgICAgICAgICAgY2hhciBjID0gYXJnW2ldOworICAgICAgICAgICAgICAgIGlmKCBjID09ICciJyApCisgICAgICAgICAgICAgICAgICAgIGluUXVvdGVzID0gIWluUXVvdGVzOworICAgICAgICAgICAgICAgIG1vZGUgPSBoYW5kbGVNb2RlKCBpLCBjLCBhcmcsIHRva2VucyApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbW9kZSA9IGhhbmRsZU1vZGUoIGFyZy5zaXplKCksICdcMCcsIGFyZywgdG9rZW5zICk7CisgICAgICAgIH0KKyAgICAgICAgTW9kZSBoYW5kbGVNb2RlKCBzdGQ6OnNpemVfdCBpLCBjaGFyIGMsIHN0ZDo6c3RyaW5nIGNvbnN0JiBhcmcsIHN0ZDo6dmVjdG9yPFRva2VuPiYgdG9rZW5zICkgeworICAgICAgICAgICAgc3dpdGNoKCBtb2RlICkgeworICAgICAgICAgICAgICAgIGNhc2UgTm9uZTogcmV0dXJuIGhhbmRsZU5vbmUoIGksIGMgKTsKKyAgICAgICAgICAgICAgICBjYXNlIE1heWJlU2hvcnRPcHQ6IHJldHVybiBoYW5kbGVNYXliZVNob3J0T3B0KCBpLCBjICk7CisgICAgICAgICAgICAgICAgY2FzZSBTaG9ydE9wdDoKKyAgICAgICAgICAgICAgICBjYXNlIExvbmdPcHQ6CisgICAgICAgICAgICAgICAgY2FzZSBTbGFzaE9wdDogcmV0dXJuIGhhbmRsZU9wdCggaSwgYywgYXJnLCB0b2tlbnMgKTsKKyAgICAgICAgICAgICAgICBjYXNlIFBvc2l0aW9uYWw6IHJldHVybiBoYW5kbGVQb3NpdGlvbmFsKCBpLCBjLCBhcmcsIHRva2VucyApOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHRocm93IHN0ZDo6bG9naWNfZXJyb3IoICJVbmtub3duIG1vZGUiICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBNb2RlIGhhbmRsZU5vbmUoIHN0ZDo6c2l6ZV90IGksIGNoYXIgYyApIHsKKyAgICAgICAgICAgIGlmKCBpblF1b3RlcyApIHsKKyAgICAgICAgICAgICAgICBmcm9tID0gaTsKKyAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25hbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHN3aXRjaCggYyApIHsKKyAgICAgICAgICAgICAgICBjYXNlICctJzogcmV0dXJuIE1heWJlU2hvcnRPcHQ7CisjaWZkZWYgQ0xBUkFfUExBVEZPUk1fV0lORE9XUworICAgICAgICAgICAgICAgIGNhc2UgJy8nOiBmcm9tID0gaSsxOyByZXR1cm4gU2xhc2hPcHQ7CisjZW5kaWYKKyAgICAgICAgICAgICAgICBkZWZhdWx0OiBmcm9tID0gaTsgcmV0dXJuIFBvc2l0aW9uYWw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgTW9kZSBoYW5kbGVNYXliZVNob3J0T3B0KCBzdGQ6OnNpemVfdCBpLCBjaGFyIGMgKSB7CisgICAgICAgICAgICBzd2l0Y2goIGMgKSB7CisgICAgICAgICAgICAgICAgY2FzZSAnLSc6IGZyb20gPSBpKzE7IHJldHVybiBMb25nT3B0OworICAgICAgICAgICAgICAgIGRlZmF1bHQ6IGZyb20gPSBpOyByZXR1cm4gU2hvcnRPcHQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBNb2RlIGhhbmRsZU9wdCggc3RkOjpzaXplX3QgaSwgY2hhciBjLCBzdGQ6OnN0cmluZyBjb25zdCYgYXJnLCBzdGQ6OnZlY3RvcjxUb2tlbj4mIHRva2VucyApIHsKKyAgICAgICAgICAgIGlmKCBzdGQ6OnN0cmluZyggIjo9XDAiLCAzICkuZmluZCggYyApID09IHN0ZDo6c3RyaW5nOjpucG9zICkKKyAgICAgICAgICAgICAgICByZXR1cm4gbW9kZTsKKworICAgICAgICAgICAgc3RkOjpzdHJpbmcgb3B0TmFtZSA9IGFyZy5zdWJzdHIoIGZyb20sIGktZnJvbSApOworICAgICAgICAgICAgaWYoIG1vZGUgPT0gU2hvcnRPcHQgKQorICAgICAgICAgICAgICAgIGZvciggc3RkOjpzaXplX3QgaiA9IDA7IGogPCBvcHROYW1lLnNpemUoKTsgKytqICkKKyAgICAgICAgICAgICAgICAgICAgdG9rZW5zLnB1c2hfYmFjayggVG9rZW4oIFRva2VuOjpTaG9ydE9wdCwgb3B0TmFtZS5zdWJzdHIoIGosIDEgKSApICk7CisgICAgICAgICAgICBlbHNlIGlmKCBtb2RlID09IFNsYXNoT3B0ICYmIG9wdE5hbWUuc2l6ZSgpID09IDEgKQorICAgICAgICAgICAgICAgIHRva2Vucy5wdXNoX2JhY2soIFRva2VuKCBUb2tlbjo6U2hvcnRPcHQsIG9wdE5hbWUgKSApOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHRva2Vucy5wdXNoX2JhY2soIFRva2VuKCBUb2tlbjo6TG9uZ09wdCwgb3B0TmFtZSApICk7CisgICAgICAgICAgICByZXR1cm4gTm9uZTsKKyAgICAgICAgfQorICAgICAgICBNb2RlIGhhbmRsZVBvc2l0aW9uYWwoIHN0ZDo6c2l6ZV90IGksIGNoYXIgYywgc3RkOjpzdHJpbmcgY29uc3QmIGFyZywgc3RkOjp2ZWN0b3I8VG9rZW4+JiB0b2tlbnMgKSB7CisgICAgICAgICAgICBpZiggaW5RdW90ZXMgfHwgc3RkOjpzdHJpbmcoICJcMCIsIDEgKS5maW5kKCBjICkgPT0gc3RkOjpzdHJpbmc6Om5wb3MgKQorICAgICAgICAgICAgICAgIHJldHVybiBtb2RlOworCisgICAgICAgICAgICBzdGQ6OnN0cmluZyBkYXRhID0gYXJnLnN1YnN0ci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GlvbjxDb25maWdUPiBjb25zdCYgX2JvdW5kRmllbGQgKSA6IENvbW1vbkFyZ1Byb3BlcnRpZXM8Q29uZmlnVD4oIF9ib3VuZEZpZWxkICkge30KKworICAgICAgICAgICAgdXNpbmcgQ29tbW9uQXJnUHJvcGVydGllczxDb25maWdUPjo6cGxhY2Vob2xkZXI7IC8vICFUQkQKKworICAgICAgICAgICAgc3RkOjpzdHJpbmcgZGJnTmFtZSgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBpZiggIWxvbmdOYW1lLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gIi0tIiArIGxvbmdOYW1lOworICAgICAgICAgICAgICAgIGlmKCAhc2hvcnROYW1lcy5lbXB0eSgpICkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICItIiArIHNob3J0TmFtZXNbMF07CisgICAgICAgICAgICAgICAgcmV0dXJuICJwb3NpdGlvbmFsIGFyZ3MiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RkOjpzdHJpbmcgY29tbWFuZHMoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgICAgICBib29sIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gc2hvcnROYW1lcy5iZWdpbigpLCBpdEVuZCA9IHNob3J0TmFtZXMuZW5kKCk7CisgICAgICAgICAgICAgICAgZm9yKDsgaXQgIT0gaXRFbmQ7ICsraXQgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBmaXJzdCApCisgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBvc3MgPDwgIiwgIjsKKyAgICAgICAgICAgICAgICAgICAgb3NzIDw8ICItIiA8PCAqaXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmKCAhbG9uZ05hbWUuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYoICFmaXJzdCApCisgICAgICAgICAgICAgICAgICAgICAgICBvc3MgPDwgIiwgIjsKKyAgICAgICAgICAgICAgICAgICAgb3NzIDw8ICItLSIgPDwgbG9uZ05hbWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmKCAhcGxhY2Vob2xkZXIuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgICAgIG9zcyA8PCAiIDwiIDw8IHBsYWNlaG9sZGVyIDw8ICI+IjsKKyAgICAgICAgICAgICAgICByZXR1cm4gb3NzLnN0cigpOworICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgICAgIHR5cGVkZWYgQ0xBUkFfQVVUT19QVFIoIEFyZyApIEFyZ0F1dG9QdHI7CisKKyAgICAgICAgZnJpZW5kIHZvaWQgYWRkT3B0TmFtZSggQXJnJiBhcmcsIHN0ZDo6c3RyaW5nIGNvbnN0JiBvcHROYW1lICkKKyAgICAgICAgeworICAgICAgICAgICAgaWYoIG9wdE5hbWUuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgaWYoIERldGFpbDo6c3RhcnRzV2l0aCggb3B0TmFtZSwgIi0tIiApICkgeworICAgICAgICAgICAgICAgIGlmKCAhYXJnLmxvbmdOYW1lLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAiT25seSBvbmUgbG9uZyBvcHQgbWF5IGJlIHNwZWNpZmllZC4gJyIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgYXJnLmxvbmdOYW1lCisgICAgICAgICAgICAgICAgICAgICAgICArICInIGFscmVhZHkgc3BlY2lmaWVkLCBub3cgYXR0ZW1wdGluZyB0byBhZGQgJyIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgb3B0TmFtZSArICInIiApOworICAgICAgICAgICAgICAgIGFyZy5sb25nTmFtZSA9IG9wdE5hbWUuc3Vic3RyKCAyICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKCBEZXRhaWw6OnN0YXJ0c1dpdGgoIG9wdE5hbWUsICItIiApICkKKyAgICAgICAgICAgICAgICBhcmcuc2hvcnROYW1lcy5wdXNoX2JhY2soIG9wdE5hbWUuc3Vic3RyKCAxICkgKTsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAib3B0aW9uIG11c3QgYmVnaW4gd2l0aCAtIG9yIC0tLiBPcHRpb24gd2FzOiAnIiArIG9wdE5hbWUgKyAiJyIgKTsKKyAgICAgICAgfQorICAgICAgICBmcmllbmQgdm9pZCBzZXRQb3NpdGlvbmFsQXJnKCBBcmcmIGFyZywgaW50IHBvc2l0aW9uICkKKyAgICAgICAgeworICAgICAgICAgICAgYXJnLnBvc2l0aW9uID0gcG9zaXRpb247CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBBcmdCdWlsZGVyIHsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgQXJnQnVpbGRlciggQXJnKiBhcmcgKSA6IG1fYXJnKCBhcmcgKSB7fQorCisgICAgICAgICAgICAvLyBCaW5kIGEgbm9uLWJvb2xlYW4gZGF0YSBtZW1iZXIgKHJlcXVpcmVzIHBsYWNlaG9sZGVyIHN0cmluZykKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEMsIHR5cGVuYW1lIE0+CisgICAgICAgICAgICB2b2lkIGJpbmQoIE0gQzo6KiBmaWVsZCwgc3RkOjpzdHJpbmcgY29uc3QmIHBsYWNlaG9sZGVyICkgeworICAgICAgICAgICAgICAgIG1fYXJnLT5ib3VuZEZpZWxkID0gbmV3IERldGFpbDo6Qm91bmREYXRhTWVtYmVyPEMsTT4oI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b2JqZWN0IHRvIG9wZXJhdGUgb24gKHJlcXVpcmVzIGEgcGxhY2Vob2xkZXIgc3RyaW5nKQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgQywgdHlwZW5hbWUgVD4KKyAgICAgICAgICAgIHZvaWQgYmluZCggdm9pZCAoKiBiaW5hcnlGdW5jdGlvbikoIEMmLCBUICksIHN0ZDo6c3RyaW5nIGNvbnN0JiBwbGFjZWhvbGRlciApIHsKKyAgICAgICAgICAgICAgICBtX2FyZy0+Ym91bmRGaWVsZCA9IG5ldyBEZXRhaWw6OkJvdW5kQmluYXJ5RnVuY3Rpb248QywgVD4oIGJpbmFyeUZ1bmN0aW9uICk7CisgICAgICAgICAgICAgICAgbV9hcmctPnBsYWNlaG9sZGVyID0gcGxhY2Vob2xkZXI7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIEFyZ0J1aWxkZXImIGRlc2NyaWJlKCBzdGQ6OnN0cmluZyBjb25zdCYgZGVzY3JpcHRpb24gKSB7CisgICAgICAgICAgICAgICAgbV9hcmctPmRlc2NyaXB0aW9uID0gZGVzY3JpcHRpb247CisgICAgICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQXJnQnVpbGRlciYgZGV0YWlsKCBzdGQ6OnN0cmluZyBjb25zdCYgZGV0YWlsICkgeworICAgICAgICAgICAgICAgIG1fYXJnLT5kZXRhaWwgPSBkZXRhaWw7CisgICAgICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZDoKKyAgICAgICAgICAgIEFyZyogbV9hcmc7CisgICAgICAgIH07CisKKyAgICAgICAgY2xhc3MgT3B0QnVpbGRlciA6IHB1YmxpYyBBcmdCdWlsZGVyIHsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgT3B0QnVpbGRlciggQXJnKiBhcmcgKSA6IEFyZ0J1aWxkZXIoIGFyZyApIHt9CisgICAgICAgICAgICBPcHRCdWlsZGVyKCBPcHRCdWlsZGVyJiBvdGhlciApIDogQXJnQnVpbGRlciggb3RoZXIgKSB7fQorCisgICAgICAgICAgICBPcHRCdWlsZGVyJiBvcGVyYXRvcltdKCBzdGQ6OnN0cmluZyBjb25zdCYgb3B0TmFtZSApIHsKKyAgICAgICAgICAgICAgICBhZGRPcHROYW1lKCAqQXJnQnVpbGRlcjo6bV9hcmcsIG9wdE5hbWUgKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgQ29tbWFuZExpbmUoKQorICAgICAgICA6ICAgbV9ib3VuZFByb2Nlc3NOYW1lKCBuZXcgRGV0YWlsOjpOdWxsQmluZGVyPENvbmZpZ1Q+KCkgKSwKKyAgICAgICAgICAgIG1faGlnaGVzdFNwZWNpZmllZEFyZ1Bvc2l0aW9uKCAwICksCisgICAgICAgICAgICBtX3Rocm93T25VbnJlY29nbmlzZWRUb2tlbnMoIGZhbHNlICkKKyAgICAgICAge30KKyAgICAgICAgQ29tbWFuZExpbmUoIENvbW1hbmRMaW5lIGNvbnN0JiBvdGhlciApCisgICAgICAgIDogICBtX2JvdW5kUHJvY2Vzc05hbWUoIG90aGVyLm1fYm91bmRQcm9jZXNzTmFtZSApLAorICAgICAgICAgICAgbV9vcHRpb25zICggb3RoZXIubV9vcHRpb25zICksCisgICAgICAgICAgICBtX3Bvc2l0aW9uYWxBcmdzKCBvdGhlci5tX3Bvc2l0aW9uYWxBcmdzICksCisgICAgICAgICAgICBtX2hpZ2hlc3RTcGVjaWZpZWRBcmdQb3NpdGlvbiggb3RoZXIubV9oaWdoZXN0U3BlY2lmaWVkQXJnUG9zaXRpb24gKSwKKyAgICAgICAgICAgIG1fdGhyb3dPblVucmVjb2duaXNlZFRva2Vucyggb3RoZXIubV90aHJvd09uVW5yZWNvZ25pc2VkVG9rZW5zICkKKyAgICAgICAgeworICAgICAgICAgICAgaWYoIG90aGVyLm1fZmxvYXRpbmdBcmcuZ2V0KCkgKQorICAgICAgICAgICAgICAgIG1fZmxvYXRpbmdBcmcucmVzZXQoIG5ldyBBcmcoICpvdGhlci5tX2Zsb2F0aW5nQXJnICkgKTsKKyAgICAgICAgfQorCisgICAgICAgIENvbW1hbmRMaW5lJiBzZXRUaHJvd09uVW5yZWNvZ25pc2VkVG9rZW5zKCBib29sIHNob3VsZFRocm93ID0gdHJ1ZSApIHsKKyAgICAgICAgICAgIG1fdGhyb3dPblVucmVjb2duaXNlZFRva2VucyA9IHNob3VsZFRocm93OworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgT3B0QnVpbGRlciBvcGVyYXRvcltdKCBzdGQ6OnN0cmluZyBjb25zdCYgb3B0TmFtZSApIHsKKyAgICAgICAgICAgIG1fb3B0aW9ucy5wdXNoX2JhY2soIEFyZygpICk7CisgICAgICAgICAgICBhZGRPcHROYW1lKCBtX29wdGlvbnMuYmFjaygpLCBvcHROYW1lICk7CisgICAgICAgICAgICBPcHRCdWlsZGVyIGJ1aWxkZXIoICZtX29wdGlvbnMuYmFjaygpICk7CisgICAgICAgICAgICByZXR1cm4gYnVpbGRlcjsKKyAgICAgICAgfQorCisgICAgICAgIEFyZ0J1aWxkZXIgb3BlcmF0b3JbXSggaW50IHBvc2l0aW9uICkgeworICAgICAgICAgICAgbV9wb3NpdGlvbmFsQXJncy5pbnNlcnQoIHN0ZDo6bWFrZV9wYWlyKCBwb3NpdGlvbiwgQXJnKCkgKSApOworICAgICAgICAgICAgaWYoIHBvc2l0aW9uID4gbV9oaWdoZXN0U3BlY2lmaWVkQXJnUG9zaXRpb24gKQorICAgICAgICAgICAgICAgIG1faGlnaGVzdFNwZWNpZmllZEFyZ1Bvc2l0aW9uID0gcG9zaXRpb247CisgICAgICAgICAgICBzZXRQb3NpdGlvbmFsQXJnKCBtX3Bvc2l0aW9uYWxBcmdzW3Bvc2l0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sTT4oIF91bmFyeU1ldGhvZCApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBvcHRVc2FnZSggc3RkOjpvc3RyZWFtJiBvcywgc3RkOjpzaXplX3QgaW5kZW50ID0gMCwgc3RkOjpzaXplX3Qgd2lkdGggPSBEZXRhaWw6OmNvbnNvbGVXaWR0aCApIGNvbnN0IHsKKyAgICAgICAgICAgIHR5cGVuYW1lIHN0ZDo6dmVjdG9yPEFyZz46OmNvbnN0X2l0ZXJhdG9yIGl0QmVnaW4gPSBtX29wdGlvbnMuYmVnaW4oKSwgaXRFbmQgPSBtX29wdGlvbnMuZW5kKCksIGl0OworICAgICAgICAgICAgc3RkOjpzaXplX3QgbWF4V2lkdGggPSAwOworICAgICAgICAgICAgZm9yKCBpdCA9IGl0QmVnaW47IGl0ICE9IGl0RW5kOyArK2l0ICkKKyAgICAgICAgICAgICAgICBtYXhXaWR0aCA9IChzdGQ6Om1heCkoIG1heFdpZHRoLCBpdC0+Y29tbWFuZHMoKS5zaXplKCkgKTsKKworICAgICAgICAgICAgZm9yKCBpdCA9IGl0QmVnaW47IGl0ICE9IGl0RW5kOyArK2l0ICkgeworICAgICAgICAgICAgICAgIERldGFpbDo6VGV4dCB1c2FnZSggaXQtPmNvbW1hbmRzKCksIERldGFpbDo6VGV4dEF0dHJpYnV0ZXMoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0V2lkdGgoIG1heFdpZHRoK2luZGVudCApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRJbmRlbnQoIGluZGVudCApICk7CisgICAgICAgICAgICAgICAgRGV0YWlsOjpUZXh0IGRlc2MoIGl0LT5kZXNjcmlwdGlvbiwgRGV0YWlsOjpUZXh0QXR0cmlidXRlcygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRXaWR0aCggd2lkdGggLSBtYXhXaWR0aCAtIDMgKSApOworCisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IChzdGQ6Om1heCkoIHVzYWdlLnNpemUoKSwgZGVzYy5zaXplKCkgKTsgKytpICkgeworICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyB1c2FnZUNvbCA9IGkgPCB1c2FnZS5zaXplKCkgPyB1c2FnZVtpXSA6ICIiOworICAgICAgICAgICAgICAgICAgICBvcyA8PCB1c2FnZUNvbDsKKworICAgICAgICAgICAgICAgICAgICBpZiggaSA8IGRlc2Muc2l6ZSgpICYmICFkZXNjW2ldLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgb3MgIDw8IHN0ZDo6c3RyaW5nKCBpbmRlbnQgKyAyICsgbWF4V2lkdGggLSB1c2FnZUNvbC5zaXplKCksICcgJyApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgZGVzY1tpXTsKKyAgICAgICAgICAgICAgICAgICAgb3MgPDwgIlxuIjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgc3RkOjpzdHJpbmcgb3B0VXNhZ2UoKSBjb25zdCB7CisgICAgICAgICAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gb3NzOworICAgICAgICAgICAgb3B0VXNhZ2UoIG9zcyApOworICAgICAgICAgICAgcmV0dXJuIG9zcy5zdHIoKTsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgYXJnU3lub3BzaXMoIHN0ZDo6b3N0cmVhbSYgb3MgKSBjb25zdCB7CisgICAgICAgICAgICBmb3IoIGludCBpID0gMTsgaSA8PSBtX2hpZ2hlc3RTcGVjaWZpZWRBcmdQb3NpdGlvbjsgKytpICkgeworICAgICAgICAgICAgICAgIGlmKCBpID4gMSApCisgICAgICAgICAgICAgICAgICAgIG9zIDw8ICIgIjsKKyAgICAgICAgICAgICAgICB0eXBlbmFtZSBzdGQ6Om1hcDxpbnQsIEFyZz46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gbV9wb3NpdGlvbmFsQXJncy5maW5kKCBpICk7CisgICAgICAgICAgICAgICAgaWYoIGl0ICE9IG1fcG9zaXRpb25hbEFyZ3MuZW5kKCkgKQorICAgICAgICAgICAgICAgICAgICBvcyA8PCAiPCIgPDwgaXQtPnNlY29uZC5wbGFjZWhvbGRlciA8PCAiPiI7CisgICAgICAgICAgICAgICAgZWxzZSBpZiggbV9mbG9hdGluZ0FyZy5nZXQoKSApCisgICAgICAgICAgICAgICAgICAgIG9zIDw8ICI8IiA8PCBtX2Zsb2F0aW5nQXJnLT5wbGFjZWhvbGRlciA8PCAiPiI7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAibm9uIGNvbnNlY3V0aXZlIHBvc2l0aW9uYWwgYXJndW1lbnRzIHdpdGggbm8gZmxvYXRpbmcgYXJncyIgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vICFUQkQgTm8gaW5kaWNhdGlvbiBvZiBtYW5kYXRvcnkgYXJncworICAgICAgICAgICAgaWYoIG1fZmxvYXRpbmdBcmcuZ2V0KCkgKSB7CisgICAgICAgICAgICAgICAgaWYoIG1faGlnaGVzdFNwZWNpZmllZEFyZ1Bvc2l0aW9uID4gMSApCisgICAgICAgICAgICAgICAgICAgIG9zIDw8ICIgIjsKKyAgICAgICAgICAgICAgICBvcyA8PCAiWzwiIDw8IG1fZmxvYXRpbmdBcmctPnBsYWNlaG9sZGVyIDw8ICI+IC4uLl0iOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIGFyZ1N5bm9wc2lzKCkgY29uc3QgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgIGFyZ1N5bm9wc2lzKCBvc3MgKTsKKyAgICAgICAgICAgIHJldHVybiBvc3Muc3RyKCk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHVzYWdlKCBzdGQ6Om9zdHJlYW0mIG9zLCBzdGQ6OnN0cmluZyBjb25zdCYgcHJvY05hbWUgKSBjb25zdCB7CisgICAgICAgICAgICB2YWxpZGF0ZSgpOworICAgICAgICAgICAgb3MgPDwgInVzYWdlOlxuICAiIDw8IHByb2NOYW1lIDw8ICIgIjsKKyAgICAgICAgICAgIGFyZ1N5bm9wc2lzKCBvcyApOworICAgICAgICAgICAgaWYoICFtX29wdGlvbnMuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICBvcyA8PCAiIFtvcHRpb25zXVxuXG53aGVyZSBvcHRpb25zIGFyZTogXG4iOworICAgICAgICAgICAgICAgIG9wdFVzYWdlKCBvcywgMiApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgb3MgPDwgIlxuIjsKKyAgICAgICAgfQorICAgICAgICBzdGQ6OnN0cmluZyB1c2FnZSggc3RkOjpzdHJpbmcgY29uc3QmIHByb2NOYW1lICkgY29uc3QgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgIHVzYWdlKCBvc3MsIHByb2NOYW1lICk7CisgICAgICAgICAgICByZXR1cm4gb3NzLnN0cigpOworICAgICAgICB9CisKKyAgICAgICAgQ29uZmlnVCBwYXJzZSggc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IGNvbnN0JiBhcmdzICkgY29uc3QgeworICAgICAgICAgICAgQ29uZmlnVCBjb25maWc7CisgICAgICAgICAgICBwYXJzZUludG8oIGFyZ3MsIGNvbmZpZyApOworICAgICAgICAgICAgcmV0dXJuIGNvbmZpZzsKKyAgICAgICAgfQorCisgICAgICAgIHN0ZDo6dmVjdG9yPFBhcnNlcjo6VG9rZW4+IHBhcnNlSW50byggc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IGNvbnN0JiBhcmdzLCBDb25maWdUJiBjb25maWcgKSBjb25zdCB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBwcm9jZXNzTmFtZSA9IGFyZ3MuZW1wdHkoKSA/IHN0ZDo6c3RyaW5nKCkgOiBhcmdzWzBdOworICAgICAgICAgICAgc3RkOjpzaXplX3QgbGFzdFNsYXNoID0gcHJvY2Vzc05hbWUuZmluZF9sYXN0X29mKCAiL1xcIiApOworICAgICAgICAgICAgaWYoIGxhc3RTbGFzaCAhPSBzdGQ6OnN0cmluZzo6bnBvcyApCisgICAgICAgICAgICAgICAgcHJvY2Vzc05hbWUgPSBwcm9jZXNzTmFtZS5zdWJzdHIoIGxhc3RTbGFzaCsxICk7CisgICAgICAgICAgICBtX2JvdW5kUHJvY2Vzc05hbWUuc2V0KCBjb25maWcsIHByb2Nlc3NOYW1lICk7CisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxQYXJzZXI6OlRva2VuPiB0b2tlbnM7CisgICAgICAgICAgICBQYXJzZXIgcGFyc2VyOworICAgICAgICAgICAgcGFyc2VyLnBhcnNlSW50b1Rva2VucyggYXJncywgdG9rZW5zICk7CisgICAgICAgICAgICByZXR1cm4gcG9wdWxhdGUoIHRva2VucywgY29uZmlnICk7CisgICAgICAgIH0KKworICAgICAgICBzdGQ6OnZlY3RvcjxQYXJzZXI6OlRva2VuPiBwb3B1bGF0ZSggc3RkOjp2ZWN0b3I8UGFyc2VyOjpUb2tlbj4gY29uc3QmIHRva2VucywgQ29uZmlnVCYgY29uZmlnICkgY29uc3QgeworICAgICAgICAgICAgdmFsaWRhdGUoKTsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPFBhcnNlcjo6VG9rZW4+IHVudXNlZFRva2VucyA9IHBvcHVsYXRlT3B0aW9ucyggdG9rZW5zLCBjb25maWcgKTsKKyAgICAgICAgICAgIHVudXNlZFRva2VucyA9IHBvcHVsYXRlRml4ZWRBcmdzKCB1bnVzZWRUb2tlbnMsIGNvbmZpZyApOworICAgICAgICAgICA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o6TG9uZ09wdCAmJiBhcmcuaGFzTG9uZ05hbWUoIHRva2VuLmRhdGEgKSApICkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBhcmcudGFrZXNBcmcoKSApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoIGkgPT0gdG9rZW5zLnNpemUoKS0xIHx8IHRva2Vuc1tpKzFdLnR5cGUgIT0gUGFyc2VyOjpUb2tlbjo6UG9zaXRpb25hbCApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcnMucHVzaF9iYWNrKCAiRXhwZWN0ZWQgYXJndW1lbnQgdG8gb3B0aW9uOiAiICsgdG9rZW4uZGF0YSApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmcuYm91bmRGaWVsZC5zZXQoIGNvbmZpZywgdG9rZW5zWysraV0uZGF0YSApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnLmJvdW5kRmllbGQuc2V0KCBjb25maWcsICJ0cnVlIiApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjYXRjaCggc3RkOjpleGNlcHRpb24mIGV4ICkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JzLnB1c2hfYmFjayggc3RkOjpzdHJpbmcoIGV4LndoYXQoKSApICsgIlxuLSB3aGlsZSBwYXJzaW5nOiAoIiArIGFyZy5jb21tYW5kcygpICsgIikiICk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYoIGl0ID09IGl0RW5kICkgeworICAgICAgICAgICAgICAgICAgICBpZiggdG9rZW4udHlwZSA9PSBQYXJzZXI6OlRva2VuOjpQb3NpdGlvbmFsIHx8ICFtX3Rocm93T25VbnJlY29nbmlzZWRUb2tlbnMgKQorICAgICAgICAgICAgICAgICAgICAgICAgdW51c2VkVG9rZW5zLnB1c2hfYmFjayggdG9rZW4gKTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiggZXJyb3JzLmVtcHR5KCkgJiYgbV90aHJvd09uVW5yZWNvZ25pc2VkVG9rZW5zICkKKyAgICAgICAgICAgICAgICAgICAgICAgIGVycm9ycy5wdXNoX2JhY2soICJ1bnJlY29nbmlzZWQgb3B0aW9uOiAiICsgdG9rZW4uZGF0YSApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKCAhZXJyb3JzLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgICAgICBmb3IoIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBlcnJvcnMuYmVnaW4oKSwgaXRFbmQgPSBlcnJvcnMuZW5kKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpdCAhPSBpdEVuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgICsraXQgKSB7CisgICAgICAgICAgICAgICAgICAgIGlmKCBpdCAhPSBlcnJvcnMuYmVnaW4oKSApCisgICAgICAgICAgICAgICAgICAgICAgICBvc3MgPDwgIlxuIjsKKyAgICAgICAgICAgICAgICAgICAgb3NzIDw8ICppdDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdGhyb3cgc3RkOjpydW50aW1lX2Vycm9yKCBvc3Muc3RyKCkgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB1bnVzZWRUb2tlbnM7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjp2ZWN0b3I8UGFyc2VyOjpUb2tlbj4gcG9wdWxhdGVGaXhlZEFyZ3MoIHN0ZDo6dmVjdG9yPFBhcnNlcjo6VG9rZW4+IGNvbnN0JiB0b2tlbnMsIENvbmZpZ1QmIGNvbmZpZyApIGNvbnN0IHsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPFBhcnNlcjo6VG9rZW4+IHVudXNlZFRva2VuczsKKyAgICAgICAgICAgIGludCBwb3NpdGlvbiA9IDE7CisgICAgICAgICAgICBmb3IoIHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgdG9rZW5zLnNpemUoKTsgKytpICkgeworICAgICAgICAgICAgICAgIFBhcnNlcjo6VG9rZW4gY29uc3QmIHRva2VuID0gdG9rZW5zW2ldOworICAgICAgICAgICAgICAgIHR5cGVuYW1lIHN0ZDo6bWFwPGludCwgQXJnPjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtX3Bvc2l0aW9uYWxBcmdzLmZpbmQoIHBvc2l0aW9uICk7CisgICAgICAgICAgICAgICAgaWYoIGl0ICE9IG1fcG9zaXRpb25hbEFyZ3MuZW5kKCkgKQorICAgICAgICAgICAgICAgICAgICBpdC0+c2Vjb25kLmJvdW5kRmllbGQuc2V0KCBjb25maWcsIHRva2VuLmRhdGEgKTsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHVudXNlZFRva2Vucy5wdXNoX2JhY2soIHRva2VuICk7CisgICAgICAgICAgICAgICAgaWYoIHRva2VuLnR5cGUgPT0gUGFyc2VyOjpUb2tlbjo6UG9zaXRpb25hbCApCisgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdW51c2VkVG9rZW5zOworICAgICAgICB9CisgICAgICAgIHN0ZDo6dmVjdG9yPFBhcnNlcjo6VG9rZW4+IHBvcHVsYXRlRmxvYXRpbmdBcmdzKCBzdGQ6OnZlY3RvcjxQYXJzZXI6OlRva2VuPiBjb25zdCYgdG9rZW5zLCBDb25maWdUJiBjb25maWcgKSBjb25zdCB7CisgICAgICAgICAgICBpZiggIW1fZmxvYXRpbmdBcmcuZ2V0KCkgKQorICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbnM7CisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxQYXJzZXI6OlRva2VuPiB1bnVzZWRUb2tlbnM7CisgICAgICAgICAgICBmb3IoIHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgdG9rZW5zLnNpemUoKTsgKytpICkgeworICAgICAgICAgICAgICAgIFBhcnNlcjo6VG9rZW4gY29uc3QmIHRva2VuID0gdG9rZW5zW2ldOworICAgICAgICAgICAgICAgIGlmKCB0b2tlbi50eXBlID09IFBhcnNlcjo6VG9rZW46OlBvc2l0aW9uYWwgKQorICAgICAgICAgICAgICAgICAgICBtX2Zsb2F0aW5nQXJnLT5ib3VuZEZpZWxkLnNldCggY29uZmlnLCB0b2tlbi5kYXRhICk7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB1bnVzZWRUb2tlbnMucHVzaF9iYWNrKCB0b2tlbiApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHVudXNlZFRva2VuczsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgdmFsaWRhdGUoKSBjb25zdAorICAgICAgICB7CisgICAgICAgICAgICBpZiggbV9vcHRpb25zLmVtcHR5KCkgJiYgbV9wb3NpdGlvbmFsQXJncy5lbXB0eSgpICYmICFtX2Zsb2F0aW5nQXJnLmdldCgpICkKKyAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAiTm8gb3B0aW9ucyBvciBhcmd1bWVudHMgc3BlY2lmaWVkIiApOworCisgICAgICAgICAgICBmb3IoIHR5cGVuYW1lIHN0ZDo6dmVjdG9yPEFyZz46OmNvbnN0X2l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nIGNvbnN0JiBfcmVwb3J0ZXJOYW1lICkgeyBjb25maWcucmVwb3J0ZXJOYW1lcy5wdXNoX2JhY2soIF9yZXBvcnRlck5hbWUgKTsgfQorCisgICAgaW5saW5lIHZvaWQgYWRkV2FybmluZyggQ29uZmlnRGF0YSYgY29uZmlnLCBzdGQ6OnN0cmluZyBjb25zdCYgX3dhcm5pbmcgKSB7CisgICAgICAgIGlmKCBfd2FybmluZyA9PSAiTm9Bc3NlcnRpb25zIiApCisgICAgICAgICAgICBjb25maWcud2FybmluZ3MgPSBzdGF0aWNfY2FzdDxXYXJuQWJvdXQ6OldoYXQ+KCBjb25maWcud2FybmluZ3MgfCBXYXJuQWJvdXQ6Ok5vQXNzZXJ0aW9ucyApOworICAgICAgICBlbHNlCisgICAgICAgICAgICB0aHJvdyBzdGQ6OnJ1bnRpbWVfZXJyb3IoICJVbnJlY29nbmlzZWQgd2FybmluZzogJyIgKyBfd2FybmluZyArICdcJycgKTsKKyAgICB9CisgICAgaW5saW5lIHZvaWQgc2V0T3JkZXIoIENvbmZpZ0RhdGEmIGNvbmZpZywgc3RkOjpzdHJpbmcgY29uc3QmIG9yZGVyICkgeworICAgICAgICBpZiggc3RhcnRzV2l0aCggImRlY2xhcmVkIiwgb3JkZXIgKSApCisgICAgICAgICAgICBjb25maWcucnVuT3JkZXIgPSBSdW5UZXN0czo6SW5EZWNsYXJhdGlvbk9yZGVyOworICAgICAgICBlbHNlIGlmKCBzdGFydHNXaXRoKCAibGV4aWNhbCIsIG9yZGVyICkgKQorICAgICAgICAgICAgY29uZmlnLnJ1bk9yZGVyID0gUnVuVGVzdHM6OkluTGV4aWNvZ3JhcGhpY2FsT3JkZXI7CisgICAgICAgIGVsc2UgaWYoIHN0YXJ0c1dpdGgoICJyYW5kb20iLCBvcmRlciApICkKKyAgICAgICAgICAgIGNvbmZpZy5ydW5PcmRlciA9IFJ1blRlc3RzOjpJblJhbmRvbU9yZGVyOworICAgICAgICBlbHNlCisgICAgICAgICAgICB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ICAgICAgICAgID8gU2hvd0R1cmF0aW9uczo6QWx3YXlzCisgICAgICAgICAgICA6IFNob3dEdXJhdGlvbnM6Ok5ldmVyOworICAgIH0KKyAgICBpbmxpbmUgdm9pZCBzZXRVc2VDb2xvdXIoIENvbmZpZ0RhdGEmIGNvbmZpZywgc3RkOjpzdHJpbmcgY29uc3QmIHZhbHVlICkgeworICAgICAgICBzdGQ6OnN0cmluZyBtb2RlID0gdG9Mb3dlciggdmFsdWUgKTsKKworICAgICAgICBpZiggbW9kZSA9PSAieWVzIiApCisgICAgICAgICAgICBjb25maWcudXNlQ29sb3VyID0gVXNlQ29sb3VyOjpZZXM7CisgICAgICAgIGVsc2UgaWYoIG1vZGUgPT0gIm5vIiApCisgICAgICAgICAgICBjb25maWcudXNlQ29sb3VyID0gVXNlQ29sb3VyOjpObzsKKyAgICAgICAgZWxzZSBpZiggbW9kZSA9PSAiYXV0byIgKQorICAgICAgICAgICAgY29uZmlnLnVzZUNvbG91ciA9IFVzZUNvbG91cjo6QXV0bzsKKyAgICAgICAgZWxzZQorICAgICAgICAgICAgdGhyb3cgc3RkOjpydW50aW1lX2Vycm9yKCAiY29sb3VyIG1vZGUgbXVzdCBiZSBvbmUgb2Y6IGF1dG8sIHllcyBvciBubyIgKTsKKyAgICB9CisgICAgaW5saW5lIHZvaWQgZm9yY2VDb2xvdXIoIENvbmZpZ0RhdGEmIGNvbmZpZyApIHsKKyAgICAgICAgY29uZmlnLnVzZUNvbG91ciA9IFVzZUNvbG91cjo6WWVzOworICAgIH0KKyAgICBpbmxpbmUgdm9pZCBsb2FkVGVzdE5hbWVzRnJvbUZpbGUoIENvbmZpZ0RhdGEmIGNvbmZpZywgc3RkOjpzdHJpbmcgY29uc3QmIF9maWxlbmFtZSApIHsKKyAgICAgICAgc3RkOjppZnN0cmVhbSBmKCBfZmlsZW5hbWUuY19zdHIoKSApOworICAgICAgICBpZiggIWYuaXNfb3BlbigpICkKKyAgICAgICAgICAgIHRocm93IHN0ZDo6ZG9tYWluX2Vycm9yKCAiVW5hYmxlIHRvIGxvYWQgaW5wdXQgZmlsZTogIiArIF9maWxlbmFtZSApOworCisgICAgICAgIHN0ZDo6c3RyaW5nIGxpbmU7CisgICAgICAgIHdoaWxlKCBzdGQ6OmdldGxpbmUoIGYsIGxpbmUgKSApIHsKKyAgICAgICAgICAgIGxpbmUgPSB0cmltKGxpbmUpOworICAgICAgICAgICAgaWYoICFsaW5lLmVtcHR5KCkgJiYgIXN0YXJ0c1dpdGgoIGxpbmUsICcjJyApICkgeworICAgICAgICAgICAgICAgIGlmKCAhc3RhcnRzV2l0aCggbGluZSwgJyInICkgKQorICAgICAgICAgICAgICAgICAgICBsaW5lID0gJyInICsgbGluZSArICciJzsKKyAgICAgICAgICAgICAgICBhZGRUZXN0T3JUYWdzKCBjb25maWcsIGxpbmUgKyAnLCcgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGlubGluZSBDbGFyYTo6Q29tbWFuZExpbmU8Q29uZmlnRGF0YT4gbWFrZUNvbW1hbmRMaW5lUGFyc2VyKCkgeworCisgICAgICAgIHVzaW5nIG5hbWVzcGFjZSBDbGFyYTsKKyAgICAgICAgQ29tbWFuZExpbmU8Q29uZmlnRGF0YT4gY2xpOworCisgICAgICAgIGNsaS5iaW5kUHJvY2Vzc05hbWUoICZDb25maWdEYXRhOjpwcm9jZXNzTmFtZSApOworCisgICAgICAgIGNsaVsiLT8iXVsiLWgiXVsiLS1oZWxwIl0KKyAgICAgICAgICAgIC5kZXNjcmliZSggImRpc3BsYXkgdXNhZ2UgaW5mb3JtYXRpb24iICkKKyAgICAgICAgICAgIC5iaW5kKCAmQ29uZmlnRGF0YTo6c2hvd0hlbHAgKTsKKworICAgICAgICBjbGlbIi1sIl1bIi0tbGlzdC10ZXN0cyJdCisgICAgICAgICAgICAuZGVzY3JpYmUoICJsaXN0IGFsbC9tYXRjaGluZyB0ZXN0IGNhc2VzIiApCisgICAgICAgICAgICAuYmluZCggJkNvbmZpZ0RhdGE6Omxpc3RUZXN0cyApOworCisgICAgICAgIGNsaVsiLXQiXVsiLS1saXN0LXRhZ3MiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAibGlzdCBhbGwvbWF0Y2hpbmcgdGFncyIgKQorICAgICAgICAgICAgLmJpbmQoICZDb25maWdEYXRhOjpsaXN0VGFncyApOworCisgICAgICAgIGNsaVsiLXMiXVsiLS1zdWNjZXNzIl0KKyAgICAgICAgICAgIC5kZXNjcmliZSggImluY2x1ZGUgc3VjY2Vzc2Z1bCB0ZXN0cyBpbiBvdXRwdXQiICkKKyAgICAgICAgICAgIC5iaW5kKCAmQ29uZmlnRGF0YTo6c2hvd1N1Y2Nlc3NmdWxUZXN0cyApOworCisgICAgICAgIGNsaVsiLWIiXVsiLS1icmVhayJdCisgICAgICAgICAgICAuZGVzY3JpYmUoICJicmVhayBpbnRvIGRlYnVnZ2VyIG9uIGZhaWx1cmUiICkKKyAgICAgICAgICAgIC5iaW5kKCAmQ29uZmlnRGF0YTo6c2hvdWxkRGVidWdCcmVhayApOworCisgICAgICAgIGNsaVsiLWUiXVsiLS1ub3Rocm93Il0KKyAgICAgICAgICAgIC5kZXNjcmliZSggInNraXAgZXhjZXB0aW9uIHRlc3RzIiApCisgICAgICAgICAgICAuYmluZCggJkNvbmZpZ0RhdGE6Om5vVGhyb3cgKTsKKworICAgICAgICBjbGlbIi1pIl1bIi0taW52aXNpYmxlcyJdCisgICAgICAgICAgICAuZGVzY3JpYmUoICJzaG93IGludmlzaWJsZXMgKHRhYnMsIG5ld2xpbmVzKSIgKQorICAgICAgICAgICAgLmJpbmQoICZDb25maWdEYXRhOjpzaG93SW52aXNpYmxlcyApOworCisgICAgICAgIGNsaVsiLW8iXVsiLS1vdXQiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAib3V0cHV0IGZpbGVuYW1lIiApCisgICAgICAgICAgICAuYmluZCggJkNvbmZpZ0RhdGE6Om91dHB1dEZpbGVuYW1lLCAiZmlsZW5hbWUiICk7CisKKyAgICAgICAgY2xpWyItciJdWyItLXJlcG9ydGVyIl0KKy8vICAgICAgICAgICAgLnBsYWNlaG9sZGVyKCAibmFtZVs6ZmlsZW5hbWVdIiApCisgICAgICAgICAgICAuZGVzY3JpYmUoICJyZXBvcnRlciB0byB1c2UgKGRlZmF1bHRzIHRvIGNvbnNvbGUpIiApCisgICAgICAgICAgICAuYmluZCggJmFkZFJlcG9ydGVyTmFtZSwgIm5hbWUiICk7CisKKyAgICAgICAgY2xpWyItbiJdWyItLW5hbWUiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAic3VpdGUgbmFtZSIgKQorICAgICAgICAgICAgLmJpbmQoICZDb25maWdEYXRhOjpuYW1lLCAibmFtZSIgKTsKKworICAgICAgICBjbGlbIi1hIl1bIi0tYWJvcnQiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAiYWJvcnQgYXQgZmlyc3QgZmFpbHVyZSIgKQorICAgICAgICAgICAgLmJpbmQoICZhYm9ydEFmdGVyRmlyc3QgKTsKKworICAgICAgICBjbGlbIi14Il1bIi0tYWJvcnR4Il0KKyAgICAgICAgICAgIC5kZXNjcmliZSggImFib3J0IGFmdGVyIHggZmFpbHVyZXMiICkKKyAgICAgICAgICAgIC5iaW5kKCAmYWJvcnRBZnRlclgsICJuby4gZmFpbHVyZXMiICk7CisKKyAgICAgICAgY2xpWyItdyJdWyItLXdhcm4iXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAiZW5hYmxlIHdhcm5pbmdzIiApCisgICAgICAgICAgICAuYmluZCggJmFkZFdhcm5pbmcsICJ3YXJuaW5nIG5hbWUiICk7CisKKy8vIC0gbmVlZHMgdXBkYXRpbmcgaWYgcmVpbnN0YXRlZAorLy8gICAgICAgIGNsaS5pbnRvKCAmc2V0VmVyYm9zaXR5ICkKKy8vICAgICAgICAgICAgLmRlc2NyaWJlKCAibGV2ZWwgb2YgdmVyYm9zaXR5ICgwPW5vIG91dHB1dCkiICkKKy8vICAgICAgICAgICAgLnNob3J0T3B0KCAidiIpCisvLyAgICAgICAgICAgIC5sb25nT3B0KCAidmVyYm9zaXR5IiApCisvLyAgICAgICAgICAgIC5wbGFjZWhvbGRlciggImxldmVsIiApOworCisgICAgICAgIGNsaVtfXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAid2hpY2ggdGVzdCBvciB0ZXN0cyB0byB1c2UiICkKKyAgICAgICAgICAgIC5iaW5kKCAmYWRkVGVzdE9yVGFncywgInRlc3QgbmFtZSwgcGF0dGVybiBvciB0YWdzIiApOworCisgICAgICAgIGNsaVsiLWQiXVsiLS1kdXJhdGlvbnMiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAic2hvdyB0ZXN0IGR1cmF0aW9ucyIgKQorICAgICAgICAgICAgLmJpbmQoICZzZXRTaG93RHVyYXRpb25zLCAieWVzfG5vIiApOworCisgICAgICAgIGNsaVsiLWYiXVsiLS1pbnB1dC1maWxlIl0KKyAgICAgICAgICAgIC5kZXNjcmliZSggImxvYWQgdGVzdCBuYW1lcyB0byBydW4gZnJvbSBhIGZpbGUiICkKKyAgICAgICAgICAgIC5iaW5kKCAmbG9hZFRlc3ROYW1lc0Zyb21GaWxlLCAiZmlsZW5hbWUiICk7CisKKyAgICAgICAgY2xpWyItIyJdWyItLWZpbGVuYW1lcy1hcy10YWdzIl0KKyAgICAgICAgICAgIC5kZXNjcmliZSggImFkZHMgYSB0YWcgZm9yIHRoZSBmaWxlbmFtZSIgKQorICAgICAgICAgICAgLmJpbmQoICZDb25maWdEYXRhOjpmaWxlbmFtZXNBc1RhZ3MgKTsKKworICAgICAgICBjbGlbIi1jIl1bIi0tc2VjdGlvbiJdCisgICAgICAgICAgICAgICAgLmRlc2NyaWJlKCAic3BlY2lmeSBzZWN0aW9uIHRvIHJ1biIgKQorICAgICAgICAgICAgICAgIC5iaW5kKCAmYWRkU2VjdGlvblRvUnVuLCAic2VjdGlvbiBuYW1lIiApOworCisgICAgICAgIC8vIExlc3MgY29tbW9uIGNvbW1hbmRzIHdoaWNoIGRvbid0IGhhdmUgYSBzaG9ydCBmb3JtCisgICAgICAgIGNsaVsiLS1saXN0LXRlc3QtbmFtZXMtb25seSJdCisgICAgICAgICAgICAuZGVzY3JpYmUoICJsaXN0IGFsbC9tYXRjaGluZyB0ZXN0IGNhc2VzIG5hbWVzIG9ubHkiICkKKyAgICAgICAgICAgIC5iaW5kKCAmQ29uZmlnRGF0YTo6bGlzdFRlc3ROYW1lc09ubHkgKTsKKworICAgICAgICBjbGlbIi0tbGlzdC1yZXBvcnRlcnMiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAibGlzdCBhbGwgcmVwb3J0ZXJzIiApCisgICAgICAgICAgICAuYmluZCggJkNvbmZpZ0RhdGE6Omxpc3RSZXBvcnRlcnMgKTsKKworICAgICAgICBjbGlbIi0tb3JkZXIiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAidGVzdCBjYXNlIG9yZGVyIChkZWZhdWx0cyB0byBkZWNsKSIgKQorICAgICAgICAgICAgLmJpbmQoICZzZXRPcmRlciwgImRlY2x8bGV4fHJhbmQiICk7CisKKyAgICAgICAgY2xpWyItLXJuZy1zZWVkIl0KKyAgICAgICAgICAgIC5kZXNjcmliZSggInNldCBhIHNwZWNpZmljIHNlZWQgZm9yIHJhbmRvbSBudW1iZXJzIiApCisgICAgICAgICAgICAuYmluZCggJnNldFJuZ1NlZWQsICIndGltZSd8bnVtYmVyIiApOworCisgICAgICAgIGNsaVsiLS1mb3JjZS1jb2xvdXIiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAiZm9yY2UgY29sb3VyaXNlZCBvdXRwdXQgKGRlcHJlY2F0ZWQpIiApCisgICAgICAgICAgICAuYmluZCggJmZvcmNlQ29sb3VyICk7CisKKyAgICAgICAgY2xpWyItLXVzZS1jb2xvdXIiXQorICAgICAgICAgICAgLmRlc2NyaWJlKCAic2hvdWxkIG91dHB1dCBiZSBjb2xvdXJpc2VkIiApCisgICAgICAgICAgICAuYmlu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5pbml0aWFsSW5kZW50LCAnICcgKQorICAgICAgICAgICAgICAgIDogc3RkOjpzdHJpbmcoIF9hdHRyLmluZGVudCwgJyAnICk7CisKKyAgICAgICAgICAgIHR5cGVkZWYgc3RkOjpzdHJpbmc6OmNvbnN0X2l0ZXJhdG9yIGl0ZXJhdG9yOworICAgICAgICAgICAgaXRlcmF0b3IgaXQgPSBfc3RyLmJlZ2luKCk7CisgICAgICAgICAgICBjb25zdCBpdGVyYXRvciBzdHJFbmQgPSBfc3RyLmVuZCgpOworCisgICAgICAgICAgICB3aGlsZSggaXQgIT0gc3RyRW5kICkgeworCisgICAgICAgICAgICAgICAgaWYoIGxpbmVzLnNpemUoKSA+PSAxMDAwICkgeworICAgICAgICAgICAgICAgICAgICBsaW5lcy5wdXNoX2JhY2soICIuLi4gbWVzc2FnZSB0cnVuY2F0ZWQgZHVlIHRvIGV4Y2Vzc2l2ZSBzaXplIiApOworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgc3VmZml4OworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHdpZHRoID0gKHN0ZDo6bWluKSggc3RhdGljX2Nhc3Q8c2l6ZV90Piggc3RyRW5kLWl0ICksIF9hdHRyLndpZHRoLXN0YXRpY19jYXN0PHNpemVfdD4oIGluZGVudC5zaXplKCkgKSApOworICAgICAgICAgICAgICAgIGl0ZXJhdG9yIGl0RW5kID0gaXQrd2lkdGg7CisgICAgICAgICAgICAgICAgaXRlcmF0b3IgaXROZXh0ID0gX3N0ci5lbmQoKTsKKworICAgICAgICAgICAgICAgIGl0ZXJhdG9yIGl0TmV3TGluZSA9IHN0ZDo6ZmluZCggaXQsIGl0RW5kLCAnXG4nICk7CisgICAgICAgICAgICAgICAgaWYoIGl0TmV3TGluZSAhPSBpdEVuZCApCisgICAgICAgICAgICAgICAgICAgIGl0RW5kID0gaXROZXdMaW5lOworCisgICAgICAgICAgICAgICAgaWYoIGl0RW5kICE9IHN0ckVuZCAgKSB7CisgICAgICAgICAgICAgICAgICAgIGJvb2wgZm91bmRXcmFwUG9pbnQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgaXRlcmF0b3IgZmluZEl0ID0gaXRFbmQ7CisgICAgICAgICAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCB3cmFwcGFibGVBZnRlckNoYXJzLmZpbmQoICpmaW5kSXQgKSAhPSBzdGQ6OnN0cmluZzo6bnBvcyAmJiBmaW5kSXQgIT0gaXRFbmQgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRFbmQgPSBmaW5kSXQrMTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdE5leHQgPSBmaW5kSXQrMTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3VuZFdyYXBQb2ludCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmKCBmaW5kSXQgPiBpdCAmJiB3cmFwcGFibGVCZWZvcmVDaGFycy5maW5kKCAqZmluZEl0ICkgIT0gc3RkOjpzdHJpbmc6Om5wb3MgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRFbmQgPSBmaW5kSXQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXROZXh0ID0gZmluZEl0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kV3JhcFBvaW50ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYoIHdyYXBwYWJsZUluc3RlYWRPZkNoYXJzLmZpbmQoICpmaW5kSXQgKSAhPSBzdGQ6OnN0cmluZzo6bnBvcyApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdE5leHQgPSBmaW5kSXQrMTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdEVuZCA9IGZpbmRJdDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3VuZFdyYXBQb2ludCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiggZmluZEl0ID09IGl0ICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAtLWZpbmRJdDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB3aGlsZSggIWZvdW5kV3JhcFBvaW50ICk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYoICFmb3VuZFdyYXBQb2ludCApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5vIGdvb2Qgd3JhcCBjaGFyLCBzbyB3ZSdsbCBicmVhayBtaWQgd29yZCBhbmQgYWRkIGEgaHlwaGVuCisgICAgICAgICAgICAgICAgICAgICAgICAtLWl0RW5kOworICAgICAgICAgICAgICAgICAgICAgICAgaXROZXh0ID0gaXRFbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICBzdWZmaXggPSAiLSI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSggaXRFbmQgPiBpdCAmJiB3cmFwcGFibGVJbnN0ZWFkT2ZDaGFycy5maW5kKCAqKGl0RW5kLTEpICkgIT0gc3RkOjpzdHJpbmc6Om5wb3MgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0taXRFbmQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbGluZXMucHVzaF9iYWNrKCBpbmRlbnQgKyBzdGQ6OnN0cmluZyggaXQsIGl0RW5kICkgKyBzdWZmaXggKTsKKworICAgICAgICAgICAgICAgIGlmKCBpbmRlbnQuc2l6ZSgpICE9IF9hdHRyLmluZGVudCApCisgICAgICAgICAgICAgICAgICAgIGluZGVudCA9IHN0ZDo6c3RyaW5nKCBfYXR0ci5pbmRlbnQsICcgJyApOworICAgICAgICAgICAgICAgIGl0ID0gaXROZXh0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdHlwZWRlZiBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yIGNvbnN0X2l0ZXJhdG9yOworCisgICAgICAgIGNvbnN0X2l0ZXJhdG9yIGJlZ2luKCkgY29uc3QgeyByZXR1cm4gbGluZXMuYmVnaW4oKTsgfQorICAgICAgICBjb25zdF9pdGVyYXRvciBlbmQoKSBjb25zdCB7IHJldHVybiBsaW5lcy5lbmQoKTsgfQorICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgbGFzdCgpIGNvbnN0IHsgcmV0dXJuIGxpbmVzLmJhY2soKTsgfQorICAgICAgICBzdGQ6OnNpemVfdCBzaXplKCkgY29uc3QgeyByZXR1cm4gbGluZXMuc2l6ZSgpOyB9CisgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBvcGVyYXRvcltdKCBzdGQ6OnNpemVfdCBfaW5kZXggKSBjb25zdCB7IHJldHVybiBsaW5lc1tfaW5kZXhdOyB9CisgICAgICAgIHN0ZDo6c3RyaW5nIHRvU3RyaW5nKCkgY29uc3QgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgIG9zcyA8PCAqdGhpczsKKyAgICAgICAgICAgIHJldHVybiBvc3Muc3RyKCk7CisgICAgICAgIH0KKworICAgICAgICBpbmxpbmUgZnJpZW5kIHN0ZDo6b3N0cmVhbSYgb3BlcmF0b3IgPDwgKCBzdGQ6Om9zdHJlYW0mIF9zdHJlYW0sIFRleHQgY29uc3QmIF90ZXh0ICkgeworICAgICAgICAgICAgZm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KKyAgICAgICAgZW51bSBDb2RlIHsKKyAgICAgICAgICAgIE5vbmUgPSAwLAorCisgICAgICAgICAgICBXaGl0ZSwKKyAgICAgICAgICAgIFJlZCwKKyAgICAgICAgICAgIEdyZWVuLAorICAgICAgICAgICAgQmx1ZSwKKyAgICAgICAgICAgIEN5YW4sCisgICAgICAgICAgICBZZWxsb3csCisgICAgICAgICAgICBHcmV5LAorCisgICAgICAgICAgICBCcmlnaHQgPSAweDEwLAorCisgICAgICAgICAgICBCcmlnaHRSZWQgPSBCcmlnaHQgfCBSZWQsCisgICAgICAgICAgICBCcmlnaHRHcmVlbiA9IEJyaWdodCB8IEdyZWVuLAorICAgICAgICAgICAgTGlnaHRHcmV5ID0gQnJpZ2h0IHwgR3JleSwKKyAgICAgICAgICAgIEJyaWdodFdoaXRlID0gQnJpZ2h0IHwgV2hpdGUsCisKKyAgICAgICAgICAgIC8vIEJ5IGludGVudGlvbgorICAgICAgICAgICAgRmlsZU5hbWUgPSBMaWdodEdyZXksCisgICAgICAgICAgICBXYXJuaW5nID0gWWVsbG93LAorICAgICAgICAgICAgUmVzdWx0RXJyb3IgPSBCcmlnaHRSZWQsCisgICAgICAgICAgICBSZXN1bHRTdWNjZXNzID0gQnJpZ2h0R3JlZW4sCisgICAgICAgICAgICBSZXN1bHRFeHBlY3RlZEZhaWx1cmUgPSBXYXJuaW5nLAorCisgICAgICAgICAgICBFcnJvciA9IEJyaWdodFJlZCwKKyAgICAgICAgICAgIFN1Y2Nlc3MgPSBHcmVlbiwKKworICAgICAgICAgICAgT3JpZ2luYWxFeHByZXNzaW9uID0gQ3lhbiwKKyAgICAgICAgICAgIFJlY29uc3RydWN0ZWRFeHByZXNzaW9uID0gWWVsbG93LAorCisgICAgICAgICAgICBTZWNvbmRhcnlUZXh0ID0gTGlnaHRHcmV5LAorICAgICAgICAgICAgSGVhZGVycyA9IFdoaXRlCisgICAgICAgIH07CisKKyAgICAgICAgLy8gVXNlIGNvbnN0cnVjdGVkIG9iamVj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tICkKKyAgICAgICAgOiAgIG1fc3RyZWFtKCAmX3N0cmVhbSApLCBtX2Z1bGxDb25maWcoIF9mdWxsQ29uZmlnICkge30KKworICAgICAgICBzdGQ6Om9zdHJlYW0mIHN0cmVhbSgpIGNvbnN0ICAgIHsgcmV0dXJuICptX3N0cmVhbTsgfQorICAgICAgICBQdHI8SUNvbmZpZyBjb25zdD4gZnVsbENvbmZpZygpIGNvbnN0IHsgcmV0dXJuIG1fZnVsbENvbmZpZzsgfQorCisgICAgcHJpdmF0ZToKKyAgICAgICAgc3RkOjpvc3RyZWFtKiBtX3N0cmVhbTsKKyAgICAgICAgUHRyPElDb25maWcgY29uc3Q+IG1fZnVsbENvbmZpZzsKKyAgICB9OworCisgICAgc3RydWN0IFJlcG9ydGVyUHJlZmVyZW5jZXMgeworICAgICAgICBSZXBvcnRlclByZWZlcmVuY2VzKCkKKyAgICAgICAgOiBzaG91bGRSZWRpcmVjdFN0ZE91dCggZmFsc2UgKQorICAgICAgICB7fQorCisgICAgICAgIGJvb2wgc2hvdWxkUmVkaXJlY3RTdGRPdXQ7CisgICAgfTsKKworICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgc3RydWN0IExhenlTdGF0IDogT3B0aW9uPFQ+IHsKKyAgICAgICAgTGF6eVN0YXQoKSA6IHVzZWQoIGZhbHNlICkge30KKyAgICAgICAgTGF6eVN0YXQmIG9wZXJhdG9yPSggVCBjb25zdCYgX3ZhbHVlICkgeworICAgICAgICAgICAgT3B0aW9uPFQ+OjpvcGVyYXRvcj0oIF92YWx1ZSApOworICAgICAgICAgICAgdXNlZCA9IGZhbHNlOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisgICAgICAgIHZvaWQgcmVzZXQoKSB7CisgICAgICAgICAgICBPcHRpb248VD46OnJlc2V0KCk7CisgICAgICAgICAgICB1c2VkID0gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgYm9vbCB1c2VkOworICAgIH07CisKKyAgICBzdHJ1Y3QgVGVzdFJ1bkluZm8geworICAgICAgICBUZXN0UnVuSW5mbyggc3RkOjpzdHJpbmcgY29uc3QmIF9uYW1lICkgOiBuYW1lKCBfbmFtZSApIHt9CisgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU7CisgICAgfTsKKyAgICBzdHJ1Y3QgR3JvdXBJbmZvIHsKKyAgICAgICAgR3JvdXBJbmZvKCAgc3RkOjpzdHJpbmcgY29uc3QmIF9uYW1lLAorICAgICAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBfZ3JvdXBJbmRleCwKKyAgICAgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgX2dyb3Vwc0NvdW50ICkKKyAgICAgICAgOiAgIG5hbWUoIF9uYW1lICksCisgICAgICAgICAgICBncm91cEluZGV4KCBfZ3JvdXBJbmRleCApLAorICAgICAgICAgICAgZ3JvdXBzQ291bnRzKCBfZ3JvdXBzQ291bnQgKQorICAgICAgICB7fQorCisgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU7CisgICAgICAgIHN0ZDo6c2l6ZV90IGdyb3VwSW5kZXg7CisgICAgICAgIHN0ZDo6c2l6ZV90IGdyb3Vwc0NvdW50czsKKyAgICB9OworCisgICAgc3RydWN0IEFzc2VydGlvblN0YXRzIHsKKyAgICAgICAgQXNzZXJ0aW9uU3RhdHMoIEFzc2VydGlvblJlc3VsdCBjb25zdCYgX2Fzc2VydGlvblJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPE1lc3NhZ2VJbmZvPiBjb25zdCYgX2luZm9NZXNzYWdlcywKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvdGFscyBjb25zdCYgX3RvdGFscyApCisgICAgICAgIDogICBhc3NlcnRpb25SZXN1bHQoIF9hc3NlcnRpb25SZXN1bHQgKSwKKyAgICAgICAgICAgIGluZm9NZXNzYWdlcyggX2luZm9NZXNzYWdlcyApLAorICAgICAgICAgICAgdG90YWxzKCBfdG90YWxzICkKKyAgICAgICAgeworICAgICAgICAgICAgaWYoIGFzc2VydGlvblJlc3VsdC5oYXNNZXNzYWdlKCkgKSB7CisgICAgICAgICAgICAgICAgLy8gQ29weSBtZXNzYWdlIGludG8gbWVzc2FnZXMgbGlzdC4KKyAgICAgICAgICAgICAgICAvLyAhVEJEIFRoaXMgc2hvdWxkIGhhdmUgYmVlbiBkb25lIGVhcmxpZXIsIHNvbWV3aGVyZQorICAgICAgICAgICAgICAgIE1lc3NhZ2VCdWlsZGVyIGJ1aWxkZXIoIGFzc2VydGlvblJlc3VsdC5nZXRUZXN0TWFjcm9OYW1lKCksIGFzc2VydGlvblJlc3VsdC5nZXRTb3VyY2VJbmZvKCksIGFzc2VydGlvblJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyIDw8IGFzc2VydGlvblJlc3VsdC5nZXRNZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgYnVpbGRlci5tX2luZm8ubWVzc2FnZSA9IGJ1aWxkZXIubV9zdHJlYW0uc3RyKCk7CisKKyAgICAgICAgICAgICAgICBpbmZvTWVzc2FnZXMucHVzaF9iYWNrKCBidWlsZGVyLm1faW5mbyApOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgfkFzc2VydGlvblN0YXRzKCk7CisKKyMgIGlmZGVmIENBVENIX0NPTkZJR19DUFAxMV9HRU5FUkFURURfTUVUSE9EUworICAgICAgICBBc3NlcnRpb25TdGF0cyggQXNzZXJ0aW9uU3RhdHMgY29uc3QmICkgICAgICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgQXNzZXJ0aW9uU3RhdHMoIEFzc2VydGlvblN0YXRzICYmICkgICAgICAgICAgICAgICAgICA9IGRlZmF1bHQ7CisgICAgICAgIEFzc2VydGlvblN0YXRzJiBvcGVyYXRvciA9ICggQXNzZXJ0aW9uU3RhdHMgY29uc3QmICkgPSBkZWZhdWx0OworICAgICAgICBBc3NlcnRpb25TdGF0cyYgb3BlcmF0b3IgPSAoIEFzc2VydGlvblN0YXRzICYmICkgICAgID0gZGVmYXVsdDsKKyMgIGVuZGlmCisKKyAgICAgICAgQXNzZXJ0aW9uUmVzdWx0IGFzc2VydGlvblJlc3VsdDsKKyAgICAgICAgc3RkOjp2ZWN0b3I8TWVzc2FnZUluZm8+IGluZm9NZXNzYWdlczsKKyAgICAgICAgVG90YWxzIHRvdGFsczsKKyAgICB9OworCisgICAgc3RydWN0IFNlY3Rpb25TdGF0cyB7CisgICAgICAgIFNlY3Rpb25TdGF0cyggICBTZWN0aW9uSW5mbyBjb25zdCYgX3NlY3Rpb25JbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgQ291bnRzIGNvbnN0JiBfYXNzZXJ0aW9ucywKKyAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZSBfZHVyYXRpb25JblNlY29uZHMsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIF9taXNzaW5nQXNzZXJ0aW9ucyApCisgICAgICAgIDogICBzZWN0aW9uSW5mbyggX3NlY3Rpb25JbmZvICksCisgICAgICAgICAgICBhc3NlcnRpb25zKCBfYXNzZXJ0aW9ucyApLAorICAgICAgICAgICAgZHVyYXRpb25JblNlY29uZHMoIF9kdXJhdGlvbkluU2Vjb25kcyApLAorICAgICAgICAgICAgbWlzc2luZ0Fzc2VydGlvbnMoIF9taXNzaW5nQXNzZXJ0aW9ucyApCisgICAgICAgIHt9CisgICAgICAgIHZpcnR1YWwgflNlY3Rpb25TdGF0cygpOworIyAgaWZkZWYgQ0FUQ0hfQ09ORklHX0NQUDExX0dFTkVSQVRFRF9NRVRIT0RTCisgICAgICAgIFNlY3Rpb25TdGF0cyggU2VjdGlvblN0YXRzIGNvbnN0JiApICAgICAgICAgICAgICA9IGRlZmF1bHQ7CisgICAgICAgIFNlY3Rpb25TdGF0cyggU2VjdGlvblN0YXRzICYmICkgICAgICAgICAgICAgICAgICA9IGRlZmF1bHQ7CisgICAgICAgIFNlY3Rpb25TdGF0cyYgb3BlcmF0b3IgPSAoIFNlY3Rpb25TdGF0cyBjb25zdCYgKSA9IGRlZmF1bHQ7CisgICAgICAgIFNlY3Rpb25TdGF0cyYgb3BlcmF0b3IgPSAoIFNlY3Rpb25TdGF0cyAmJiApICAgICA9IGRlZmF1bHQ7CisjICBlbmRpZgorCisgICAgICAgIFNlY3Rpb25JbmZvIHNlY3Rpb25JbmZvOworICAgICAgICBDb3VudHMgYXNzZXJ0aW9uczsKKyAgICAgICAgZG91YmxlIGR1cmF0aW9uSW5TZWNvbmRzOworICAgICAgICBib29sIG1pc3NpbmdBc3NlcnRpb25zOworICAgIH07CisKKyAgICBzdHJ1Y3QgVGVzdENhc2VTdGF0cyB7CisgICAgICAgIFRlc3RDYXNlU3RhdHMoICBUZXN0Q2FzZUluZm8gY29uc3QmIF90ZXN0SW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvdGFscyBjb25zdCYgX3RvdGFscywKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfc3RkT3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgY29uc3QmIF9zdGRFcnIsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIF9hYm9ydGluZyApCisgICAgICAgIDogdGVzdEluZm8oIF90ZXN0SW5mbyApLAorICAgICAgICAgICAgdG90YWxzKCBfdG90YWxzICksCisgICAgICAgICAgICBzdGRPdXQoIF9zdGRPdXQgKSwKKyAgICAgICAgICAgIHN0ZEVyciggX3N0ZEVyciApLAorICAgICAgICAgICAgYWJvcnRpbmcoIF9hYm9ydGluZyApCisgICAgICAgIHt9CisgICAgICAgIHZpcnR1YWwgflRlc3RDYXNlU3RhdHMoKTsKKworIyAgaWZkZWYgQ0FUQ0hfQ09ORklHX0NQUDExX0dFTkVSQVRFRF9NRVRIT0RTCisgICAgICAgIFRlc3RDYXNlU3RhdHMoIFRlc3RDYXNlU3RhdHMgY29uc3QmICkgICAgICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgVGVzdENhc2VTdGF0cyggVGVzdENhc2VTdGF0cyAmJiApICAgICAgICAgICAgICAgICAgPSBkZWZhdWx0OworICAgICAgICBUZXN0Q2FzZVN0YXRzJiBvcGVyYXRvciA9ICggVGVzdENhc2VTdGF0cyBjb25zdCYgKSA9IGRlZmF1bHQ7CisgICAgICAgIFRlc3RDYXNlU3RhdHMmIG9wZXJhdG9yID0gKCBUZXN0Q2FzZVN0YXRzICYmICkgICAgID0gZGVmYXVsdDsKKyMgIGVuZGlmCisKKyAgICAgICAgVGVzdENhc2VJbmZvIHRlc3RJbmZvOworICAgICAgICBUb3RhbHMgdG90YWxzOworICAgICAgICBzdGQ6OnN0cmluZyBzdGRPdXQ7CisgICAgICAgIHN0ZDo6c3RyaW5nIHN0ZEVycjsKKyAgICAgICAgYm9vbCBhYm9ydGluZzsKKyAgICB9OworCisgICAgc3RydWN0IFRlc3RHcm91cFN0YXRzIHsKKyAgICAgICAgVGVzdEdyb3VwU3RhdHMoIEdyb3VwSW5mbyBjb25zdCYgX2dyb3VwSW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvdGFscyBjb25zdCYgX3RvdGFscywKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgX2Fib3J0aW5nICkKKyAgICAgICAgOiAgIGdyb3VwSW5mbyggX2dyb3VwSW5mbyApLAorICAgICAgICAgICAgdG90YWxzKCBfdG90YWxzICksCisgICAgICAgICAgICBhYm9ydGluZyggX2Fib3J0aW5nICkKKyAgICAgICAge30KKyAgICAgICAgVGVzdEdyb3VwU3RhdHMoIEdyb3VwSW5mbyBjb25zdCYgX2dyb3VwSW5mbyApCisgICAgICAgIDogICBncm91cEluZm8oIF9ncm91cEluZm8gKSwKKyAgICAgICAgICAgIGFib3J0aW5nKCBmYWxzZSApCisgICAgICAgIHt9CisgICAgICAgIHZpcnR1YWwgflRlc3RHcm91cFN0YXRzKCk7CisKKyMgIGlmZGVmIENBVENIX0NPTkZJR19DUFAxMV9HRU5FUkFURURfTUVUSE9EUworICAgICAgICBUZXN0R3JvdXBTdGF0cyggVGVzdEdyb3VwU3RhdHMgY29uc3QmICkgICAgICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgVGVzdEdyb3VwU3RhdHMoIFRlc3RHcm91cFN0YXRzICYmICkgICAgICAgICAgICAgICAgICA9IGRlZmF1bHQ7CisgICAgICAgIFRlc3RHcm91cFN0YXRzJiBvcGVyYXRvciA9ICggVGVzdEdyb3VwU3RhdHMgY29uc3QmICkgPSBkZWZhdWx0OworICAgICAgICBUZXN0R3JvdXBTdGF0cyYgb3BlcmF0b3IgPSAoIFRlc3RHcm91cFN0YXRzICYmICkgICAgID0gZGVmYXVsdDsKKyMgIGVuZGlmCisKKyAgICAgICAgR3JvdXBJbmZvIGdyb3VwSW5mbzsKKyAgICAgICAgVG90YWxzIHRvdGFsczsKKyAgICAgICAgYm9vbCBhYm9ydGluZzsKKyAgICB9OworCisgICAgc3RydWN0IFRlc3RSdW5TdGF0cyB7CisgICAgICAgIFRlc3RSdW5TdGF0cyggICBUZXN0UnVuSW5mbyBjb25zdCYgX3J1bkluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICBUb3RhbHMgY29uc3QmIF90b3RhbHMsCisgICAgICAgICAgICAgICAgICAgICAgICBib29sIF9hYm9ydGluZyApCisgICAgICAgIDogICBydW5JbmZvKCBfcnVuSW5mbyApLAorICAgICAgICAgICAgdG90YWxzKCBfdG90YWxzICksCisgICAgICAgICAgICBhYm9ydGluZyggX2Fib3J0aW5nICkKKyAgICAgICAge30KKyAgICAgICAgdmlydHVhbCB+VGVzdFJ1blN0YXRzKCk7CisKKyMgIGlmbmRlZiBDQVRDSF9DT05GSUdfQ1BQMTFfR0VORVJBVEVEX01FVEhPRFMKKyAgICAgICAgVGVzdFJ1blN0YXRzKCBUZXN0UnVuU3RhdHMgY29uc3QmIF9vdGhlciApCisgICAgICAgIDogICBydW5JbmZvKCBfb3RoZXIucnVuSW5mbyApLAorICAgICAgICAgICAgdG90YWxzKCBfb3RoZXIudG90YWxzICksCisgICAgICAgICAgICBhYm9ydGluZyggX290aGVyLmFib3J0aW5nICkKKyAgICAgICAge30KKyMgIGVsc2UKKyAgICAgICAgVGVzdFJ1blN0YXRzKCBUZXN0UnVuU3RhdHMgY29uc3QmICkgICAgICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgVGVzdFJ1blN0YXRzKCBUZXN0UnVuU3RhdHMgJiYgKSAgICAgICAgICAgICAgICAgID0gZGVmYXVsdDsKKyAgICAgICAgVGVzdFJ1blN0YXRzJiBvcGVyYXRvciA9ICggVGVzdFJ1blN0YXRzIGNvbnN0JiApID0gZGVmYXVsdDsKKyAgICAgICAgVGVzdFJ1blN0YXRzJiBvcGVyYXRvciA9ICggVGVzdFJ1blN0YXRzICYmICkgICAgID0gZGVmYXVsdDsKKyMgIGVuZGlmCisKKyAgICAgICAgVGVzdFJ1bkluZm8gcnVuSW5mbzsKKyAgICAgICAgVG90YWxzIHRvdGFsczsKKyAgICAgICAgYm9vbCBhYm9ydGluZzsKKyAgICB9OworCisgICAgY2xhc3MgTXVsdGlwbGVSZXBvcnRlcnM7CisKKyAgICBzdHJ1Y3QgSVN0cmVhbWluZ1JlcG9ydGVyIDogSVNoYXJlZCB7CisgICAgICAgIHZpcnR1YWwgfklTdHJlYW1pbmdSZXBvcnRlcigpOworCisgICAgICAgIC8vIEltcGxlbWVudGluZyBjbGFzcyBtdXN0IGFsc28gcHJvdmlkZSB0aGUgZm9sbG93aW5nIHN0YXRpYyBtZXRob2Q6CisgICAgICAgIC8vIHN0YXRpYyBzdGQ6OnN0cmluZyBnZXREZXNjcmlwdGlvbigpOworCisgICAgICAgIHZpcnR1YWwgUmVwb3J0ZXJQcmVmZXJlbmNlcyBnZXRQcmVmZXJlbmNlcygpIGNvbnN0ID0gMDsKKworICAgICAgICB2aXJ0dWFsIHZvaW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ciBpdCA9IG1hdGNoZWRUZXN0Q2FzZXMuYmVnaW4oKSwgaXRFbmQgPSBtYXRjaGVkVGVzdENhc2VzLmVuZCgpOworICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICsraXQgKSB7CisgICAgICAgICAgICBtYXRjaGVkVGVzdHMrKzsKKyAgICAgICAgICAgIFRlc3RDYXNlSW5mbyBjb25zdCYgdGVzdENhc2VJbmZvID0gaXQtPmdldFRlc3RDYXNlSW5mbygpOworICAgICAgICAgICAgaWYoIHN0YXJ0c1dpdGgoIHRlc3RDYXNlSW5mby5uYW1lLCAnIycgKSApCisgICAgICAgICAgICAgICBDYXRjaDo6Y291dCgpIDw8ICciJyA8PCB0ZXN0Q2FzZUluZm8ubmFtZSA8PCAnIicgPDwgc3RkOjplbmRsOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgQ2F0Y2g6OmNvdXQoKSA8PCB0ZXN0Q2FzZUluZm8ubmFtZSA8PCBzdGQ6OmVuZGw7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1hdGNoZWRUZXN0czsKKyAgICB9CisKKyAgICBzdHJ1Y3QgVGFnSW5mbyB7CisgICAgICAgIFRhZ0luZm8oKSA6IGNvdW50ICggMCApIHt9CisgICAgICAgIHZvaWQgYWRkKCBzdGQ6OnN0cmluZyBjb25zdCYgc3BlbGxpbmcgKSB7CisgICAgICAgICAgICArK2NvdW50OworICAgICAgICAgICAgc3BlbGxpbmdzLmluc2VydCggc3BlbGxpbmcgKTsKKyAgICAgICAgfQorICAgICAgICBzdGQ6OnN0cmluZyBhbGwoKSBjb25zdCB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBvdXQ7CisgICAgICAgICAgICBmb3IoIHN0ZDo6c2V0PHN0ZDo6c3RyaW5nPjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBzcGVsbGluZ3MuYmVnaW4oKSwgaXRFbmQgPSBzcGVsbGluZ3MuZW5kKCk7Cis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PSBtYXRjaGVkVGVzdENhc2VzLmJlZ2luKCksIGl0RW5kID0gbWF0Y2hlZFRlc3RDYXNlcy5lbmQoKTsKKyAgICAgICAgICAgICAgICBpdCAhPSBpdEVuZDsKKyAgICAgICAgICAgICAgICArK2l0ICkgeworICAgICAgICAgICAgZm9yKCBzdGQ6OnNldDxzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yICB0YWdJdCA9IGl0LT5nZXRUZXN0Q2FzZUluZm8oKS50YWdzLmJlZ2luKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhZ0l0RW5kID0gaXQtPmdldFRlc3RDYXNlSW5mbygpLnRhZ3MuZW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHRhZ0l0ICE9IHRhZ0l0RW5kOworICAgICAgICAgICAgICAgICAgICArK3RhZ0l0ICkgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHRhZ05hbWUgPSAqdGFnSXQ7CisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbGNhc2VUYWdOYW1lID0gdG9Mb3dlciggdGFnTmFtZSApOworICAgICAgICAgICAgICAgIHN0ZDo6bWFwPHN0ZDo6c3RyaW5nLCBUYWdJbmZvPjo6aXRlcmF0b3IgY291bnRJdCA9IHRhZ0NvdW50cy5maW5kKCBsY2FzZVRhZ05hbWUgKTsKKyAgICAgICAgICAgICAgICBpZiggY291bnRJdCA9PSB0YWdDb3VudHMuZW5kKCkgKQorICAgICAgICAgICAgICAgICAgICBjb3VudEl0ID0gdGFnQ291bnRzLmluc2VydCggc3RkOjptYWtlX3BhaXIoIGxjYXNlVGFnTmFtZSwgVGFnSW5mbygpICkgKS5maXJzdDsKKyAgICAgICAgICAgICAgICBjb3VudEl0LT5zZWNvbmQuYWRkKCB0YWdOYW1lICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IoIHN0ZDo6bWFwPHN0ZDo6c3RyaW5nLCBUYWdJbmZvPjo6Y29uc3RfaXRlcmF0b3IgY291bnRJdCA9IHRhZ0NvdW50cy5iZWdpbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY291bnRJdEVuZCA9IHRhZ0NvdW50cy5lbmQoKTsKKyAgICAgICAgICAgICAgICBjb3VudEl0ICE9IGNvdW50SXRFbmQ7CisgICAgICAgICAgICAgICAgKytjb3VudEl0ICkgeworICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgIG9zcyA8PCAiICAiIDw8IHN0ZDo6c2V0dygyKSA8PCBjb3VudEl0LT5zZWNvbmQuY291bnQgPDwgIiAgIjsKKyAgICAgICAgICAgIFRleHQgd3JhcHBlciggY291bnRJdC0+c2Vjb25kLmFsbCgpLCBUZXh0QXR0cmlidXRlcygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNldEluaXRpYWxJbmRlbnQoIDAgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRJbmRlbnQoIG9zcy5zdHIoKS5zaXplKCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRXaWR0aCggQ0FUQ0hfQ09ORklHX0NPTlNPTEVfV0lEVEgtMTAgKSApOworICAgICAgICAgICAgQ2F0Y2g6OmNvdXQoKSA8PCBvc3Muc3RyKCkgPDwgd3JhcHBlciA8PCAnXG4nOworICAgICAgICB9CisgICAgICAgIENhdGNoOjpjb3V0KCkgPDwgcGx1cmFsaXNlKCB0YWdDb3VudHMuc2l6ZSgpLCAidGFnIiApIDw8ICdcbicgPDwgc3RkOjplbmRsOworICAgICAgICByZXR1cm4gdGFnQ291bnRzLnNpemUoKTsKKyAgICB9CisKKyAgICBpbmxpbmUgc3RkOjpzaXplX3QgbGlzdFJlcG9ydGVycyggQ29uZmlnIGNvbnN0JiAvKmNvbmZpZyovICkgeworICAgICAgICBDYXRjaDo6Y291dCgpIDw8ICJBdmFpbGFibGUgcmVwb3J0ZXJzOlxuIjsKKyAgICAgICAgSVJlcG9ydGVyUmVnaXN0cnk6OkZhY3RvcnlNYXAgY29uc3QmIGZhY3RvcmllcyA9IGdldFJlZ2lzdHJ5SHViKCkuZ2V0UmVwb3J0ZXJSZWdpc3RyeSgpLmdldEZhY3RvcmllcygpOworICAgICAgICBJUmVwb3J0ZXJSZWdpc3RyeTo6RmFjdG9yeU1hcDo6Y29uc3RfaXRlcmF0b3IgaXRCZWdpbiA9IGZhY3Rvcmllcy5iZWdpbigpLCBpdEVuZCA9IGZhY3Rvcmllcy5lbmQoKSwgaXQ7CisgICAgICAgIHN0ZDo6c2l6ZV90IG1heE5hbWVMZW4gPSAwOworICAgICAgICBmb3IoaXQgPSBpdEJlZ2luOyBpdCAhPSBpdEVuZDsgKytpdCApCisgICAgICAgICAgICBtYXhOYW1lTGVuID0gKHN0ZDo6bWF4KSggbWF4TmFtZUxlbiwgaXQtPmZpcnN0LnNpemUoKSApOworCisgICAgICAgIGZvcihpdCA9IGl0QmVnaW47IGl0ICE9IGl0RW5kOyArK2l0ICkgeworICAgICAgICAgICAgVGV4dCB3cmFwcGVyKCBpdC0+c2Vjb25kLT5nZXREZXNjcmlwdGlvbigpLCBUZXh0QXR0cmlidXRlcygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRJbml0aWFsSW5kZW50KCAwICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNldEluZGVudCggNyttYXhOYW1lTGVuICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNldFdpZHRoKCBDQVRDSF9DT05GSUdfQ09OU09MRV9XSURUSCAtIG1heE5hbWVMZW4tOCApICk7CisgICAgICAgICAgICBDYXRjaDo6Y291dCgpIDw8ICIgICIKKyAgICAgICAgICAgICAgICAgICAgPDwgaXQtPmZpcnN0CisgICAgICAgICAgICAgICAgICAgIDw8ICc6JworICAgICAgICAgICAgICAgICAgICA8PCBzdGQ6OnN0cmluZyggbWF4TmFtZUxlbiAtIGl0LT5maXJzdC5zaXplKCkgKyAyLCAnICcgKQorICAgICAgICAgICAgICAgICAgICA8PCB3cmFwcGVyIDw8ICdcbic7CisgICAgICAgIH0KKyAgICAgICAgQ2F0Y2g6OmNvdXQoKSA8PCBzdGQ6OmVuZGw7CisgICAgICAgIHJldHVybiBmYWN0b3JpZXMuc2l6ZSgpOworICAgIH0KKworICAgIGlubGluZSBPcHRpb248c3RkOjpzaXplX3Q+IGxpc3QoIENvbmZpZyBjb25zdCYgY29uZmlnICkgeworICAgICAgICBPcHRpb248c3RkOjpzaXplX3Q+IGxpc3RlZENvdW50OworICAgICAgICBpZiggY29uZmlnLmxpc3RUZXN0cygpICkKKyAgICAgICAgICAgIGxpc3RlZENvdW50ID0gbGlzdGVkQ291bnQudmFsdWVPcigwKSArIGxpc3RUZXN0cyggY29uZmlnICk7CisgICAgICAgIGlmKCBjb25maWcubGlzdFRlc3ROYW1lc09ubHkoKSApCisgICAgICAgICAgICBsaXN0ZWRDb3VudCA9IGxpc3RlZENvdW50LnZhbHVlT3IoMCkgKyBsaXN0VGVzdHNOYW1lc09ubHkoIGNvbmZpZyApOworICAgICAgICBpZiggY29uZmlnLmxpc3RUYWdzKCkgKQorICAgICAgICAgICAgbGlzdGVkQ291bnQgPSBsaXN0ZWRDb3VudC52YWx1ZU9yKDApICsgbGlzdFRhZ3MoIGNvbmZpZyApOworICAgICAgICBpZiggY29uZmlnLmxpc3RSZXBvcnRlcnMoKSApCisgICAgICAgICAgICBsaXN0ZWRDb3VudCA9IGxpc3RlZENvdW50LnZhbHVlT3IoMCkgKyBsaXN0UmVwb3J0ZXJzKC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GJvb2wgaXNTZWN0aW9uVHJhY2tlcigpIGNvbnN0ID0gMDsKKyAgICAgICAgdmlydHVhbCBib29sIGlzSW5kZXhUcmFja2VyKCkgY29uc3QgPSAwOworICAgIH07CisKKyAgICBjbGFzcyAgVHJhY2tlckNvbnRleHQgeworCisgICAgICAgIGVudW0gUnVuU3RhdGUgeworICAgICAgICAgICAgTm90U3RhcnRlZCwKKyAgICAgICAgICAgIEV4ZWN1dGluZywKKyAgICAgICAgICAgIENvbXBsZXRlZEN5Y2xlCisgICAgICAgIH07CisKKyAgICAgICAgUHRyPElUcmFja2VyPiBtX3Jvb3RUcmFja2VyOworICAgICAgICBJVHJhY2tlciogbV9jdXJyZW50VHJhY2tlcjsKKyAgICAgICAgUnVuU3RhdGUgbV9ydW5TdGF0ZTsKKworICAgIHB1YmxpYzoKKworICAgICAgICBzdGF0aWMgVHJhY2tlckNvbnRleHQmIGluc3RhbmNlKCkgeworICAgICAgICAgICAgc3RhdGljIFRyYWNrZXJDb250ZXh0IHNfaW5zdGFuY2U7CisgICAgICAgICAgICByZXR1cm4gc19pbnN0YW5jZTsKKyAgICAgICAgfQorCisgICAgICAgIFRyYWNrZXJDb250ZXh0KCkKKyAgICAgICAgOiAgIG1fY3VycmVudFRyYWNrZXIoIENBVENIX05VTEwgKSwKKyAgICAgICAgICAgIG1fcnVuU3RhdGUoIE5vdFN0YXJ0ZWQgKQorICAgICAgICB7fQorCisgICAgICAgIElUcmFja2VyJiBzdGFydFJ1bigpOworCisgICAgICAgIHZvaWQgZW5kUnVuKCkgeworICAgICAgICAgICAgbV9yb290VHJhY2tlci5yZXNldCgpOworICAgICAgICAgICAgbV9jdXJyZW50VHJhY2tlciA9IENBVENIX05VTEw7CisgICAgICAgICAgICBtX3J1blN0YXRlID0gTm90U3RhcnRlZDsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgc3RhcnRDeWNsZSgpIHsKKyAgICAgICAgICAgIG1fY3VycmVudFRyYWNrZXIgPSBtX3Jvb3RUcmFja2VyLmdldCgpOworICAgICAgICAgICAgbV9ydW5TdGF0ZSA9IEV4ZWN1dGluZzsKKyAgICAgICAgfQorICAgICAgICB2b2lkIGNvbXBsZXRlQ3ljbGUoKSB7CisgICAgICAgICAgICBtX3J1blN0YXRlID0gQ29tcGxldGVkQ3ljbGU7CisgICAgICAgIH0KKworICAgICAgICBib29sIGNvbXBsZXRlZEN5Y2xlKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1fcnVuU3RhdGUgPT0gQ29tcGxldGVkQ3ljbGU7CisgICAgICAgIH0KKyAgICAgICAgSVRyYWNrZXImIGN1cnJlbnRUcmFja2VyKCkgeworICAgICAgICAgICAgcmV0dXJuICptX2N1cnJlbnRUcmFja2VyOworICAgICAgICB9CisgICAgICAgIHZvaWQgc2V0Q3VycmVudFRyYWNrZXIoIElUcmFja2VyKiB0cmFja2VyICkgeworICAgICAgICAgICAgbV9jdXJyZW50VHJhY2tlciA9IHRyYWNrZXI7CisgICAgICAgIH0KKyAgICB9OworCisgICAgY2xhc3MgVHJhY2tlckJhc2UgOiBwdWJsaWMgSVRyYWNrZXIgeworICAgIHByb3RlY3RlZDoKKyAgICAgICAgZW51bSBDeWNsZVN0YXRlIHsKKyAgICAgICAgICAgIE5vdFN0YXJ0ZWQsCisgICAgICAgICAgICBFeGVjdXRpbmcsCisgICAgICAgICAgICBFeGVjdXRpbmdDaGlsZHJlbiwKKyAgICAgICAgICAgIE5lZWRzQW5vdGhlclJ1biwKKyAgICAgICAgICAgIENvbXBsZXRlZFN1Y2Nlc3NmdWxseSwKKyAgICAgICAgICAgIEZhaWxlZAorICAgICAgICB9OworICAgICAgICBjbGFzcyBUcmFja2VySGFzTmFtZSB7CisgICAgICAgICAgICBOYW1lQW5kTG9jYXRpb24gbV9uYW1lQW5kTG9jYXRpb247CisgICAgICAgIHB1YmxpYzoKKyAgICAgICAgICAgIFRyYWNrZXJIYXNOYW1lKCBOYW1lQW5kTG9jYXRpb24gY29uc3QmIG5hbWVBbmRMb2NhdGlvbiApIDogbV9uYW1lQW5kTG9jYXRpb24oIG5hbWVBbmRMb2NhdGlvbiApIHt9CisgICAgICAgICAgICBib29sIG9wZXJhdG9yICgpKCBQdHI8SVRyYWNrZXI+IGNvbnN0JiB0cmFja2VyICkgeworICAgICAgICAgICAgICAgIHJldHVybgorICAgICAgICAgICAgICAgICAgICB0cmFja2VyLT5uYW1lQW5kTG9jYXRpb24oKS5uYW1lID09IG1fbmFtZUFuZExvY2F0aW9uLm5hbWUgJiYKKyAgICAgICAgICAgICAgICAgICAgdHJhY2tlci0+bmFtZUFuZExvY2F0aW9uKCkubG9jYXRpb24gPT0gbV9uYW1lQW5kTG9jYXRpb24ubG9jYXRpb247CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHR5cGVkZWYgc3RkOjp2ZWN0b3I8UHRyPElUcmFja2VyPiA+IENoaWxkcmVuOworICAgICAgICBOYW1lQW5kTG9jYXRpb24gbV9uYW1lQW5kTG9jYXRpb247CisgICAgICAgIFRyYWNrZXJDb250ZXh0JiBtX2N0eDsKKyAgICAgICAgSVRyYWNrZXIqIG1fcGFyZW50OworICAgICAgICBDaGlsZHJlbiBtX2NoaWxkcmVuOworICAgICAgICBDeWNsZVN0YXRlIG1fcnVuU3RhdGU7CisgICAgcHVibGljOgorICAgICAgICBUcmFja2VyQmFzZSggTmFtZUFuZExvY2F0aW9uIGNvbnN0JiBuYW1lQW5kTG9jYXRpb24sIFRyYWNrZXJDb250ZXh0JiBjdHgsIElUcmFja2VyKiBwYXJlbnQgKQorICAgICAgICA6ICAgbV9uYW1lQW5kTG9jYXRpb24oIG5hbWVBbmRMb2NhdGlvbiApLAorICAgICAgICAgICAgbV9jdHgoIGN0eCApLAorICAgICAgICAgICAgbV9wYXJlbnQoIHBhcmVudCApLAorICAgICAgICAgICAgbV9ydW5TdGF0ZSggTm90U3RhcnRlZCApCisgICAgICAgIHt9CisgICAgICAgIHZpcnR1YWwgflRyYWNrZXJCYXNlKCk7CisKKyAgICAgICAgdmlydHVhbCBOYW1lQW5kTG9jYXRpb24gY29uc3QmIG5hbWVBbmRMb2NhdGlvbigpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIHJldHVybiBtX25hbWVBbmRMb2NhdGlvbjsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIGJvb2wgaXNDb21wbGV0ZSgpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIHJldHVybiBtX3J1blN0YXRlID09IENvbXBsZXRlZFN1Y2Nlc3NmdWxseSB8fCBtX3J1blN0YXRlID09IEZhaWxlZDsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIGJvb2wgaXNTdWNjZXNzZnVsbHlDb21wbGV0ZWQoKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICByZXR1cm4gbV9ydW5TdGF0ZSA9PSBDb21wbGV0ZWRTdWNjZXNzZnVsbHk7CisgICAgICAgIH0KKyAgICAgICAgdmlydHVhbCBib29sIGlzT3BlbigpIGNvbnN0IENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIHJldHVybiBtX3J1blN0YXRlICE9IE5vdFN0YXJ0ZWQgJiYgIWlzQ29tcGxldGUoKTsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIGJvb2wgaGFzQ2hpbGRyZW4oKSBjb25zdCBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICByZXR1cm4gIW1fY2hpbGRyZW4uZW1wdHkoKTsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgdm9pZCBhZGRDaGlsZCggUHRyPElUcmFja2VyPiBjb25zdCYgY2hpbGQgKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICBtX2NoaWxkcmVuLnB1c2hfYmFjayggY2hpbGQgKTsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgSVRyYWNrZXIqIGZpbmRDaGlsZCggTmFtZUFuZExvY2F0aW9uIGNvbnN0JiBuYW1lQW5kTG9jYXRpb24gKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICBDaGlsZHJlbjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBzdGQ6OmZpbmRfaWYoIG1fY2hpbGRyZW4uYmVnaW4oKSwgbV9jaGlsZHJlbi5lbmQoKSwgVHJhY2tlckhhc05hbWUoIG5hbWVBbmRMb2NhdGlvbiApICk7CisgICAgICAgICAgICByZXR1cm4oIGl0ICE9IG1fY2hpbGRyZW4uZW5kKCkgKQorICAgICAgICAgICAgICAgID8gaXQtPmdldCgpCisgICAgICAgICAgICAgICAgOiBDQVRDSF9OVUxMOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgSVRyYWNrZXImIHBhcmVudCgpIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIGFzc2VydCggbV9wYXJlbnQgKTsgLy8gU2hvdWxkIGFsd2F5cyBiZSBub24tbnVsbCBleGNlcHQgZm9yIHJvb3QKKyAgICAgICAgICAgIHJldHVybiAqbV9wYXJlbnQ7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgb3BlbkNoaWxkKCkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgaWYoIG1fcnVuU3RhdGUgIT0gRXhlY3V0aW5nQ2hpbGRyZW4gKSB7CisgICAgICAgICAgICAgICAgbV9ydW5TdGF0ZSA9IEV4ZWN1dGluZ0NoaWxkcmVuOworICAgICAgICAgICAgICAgIGlmKCBtX3BhcmVudCApCisgICAgICAgICAgICAgICAgICAgIG1fcGFyZW50LT5vcGVuQ2hpbGQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgYm9vbCBpc1NlY3Rpb25UcmFja2VyKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeyByZXR1cm4gZmFsc2U7IH0KKyAgICAgICAgdmlydHVhbCBib29sIGlzSW5kZXhUcmFja2VyKCkgY29uc3QgQ0FUQ0hfT1ZFUlJJREUgeyByZXR1cm4gZmFsc2U7IH0KKworICAgICAgICB2b2lkIG9wZW4oKSB7CisgICAgICAgICAgICBtX3J1blN0YXRlID0gRXhlY3V0aW5nOworICAgICAgICAgICAgbW92ZVRvVGhpcygpOworICAgICAgICAgICAgaWYoIG1fcGFyZW50ICkKKyAgICAgICAgICAgICAgICBtX3BhcmVudC0+b3BlbkNoaWxkKCk7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgY2xvc2UoKSBDQVRDSF9PVkVSUklERSB7CisKKyAgICAgICAgICAgIC8vIENsb3NlIGFueSBzdGlsbCBvcGVuIGNoaWxkcmVuIChlLmcuIGdlbmVyYXRvcnMpCisgICAgICAgICAgICB3aGlsZSggJm1fY3R4LmN1cnJlbnRUcmFja2VyKCkgIT0gdGhpcyApCisgICAgICAgICAgICAgICAgbV9jdHguY3VycmVudFRyYWNrZXIoKS5jbG9zZSgpOworCisgICAgICAgICAgICBzd2l0Y2goIG1fcnVuU3RhdGUgKSB7CisgICAgICAgICAgICAgICAgY2FzZSBOb3RTdGFydGVkOgorICAgICAgICAgICAgICAgIGNhc2UgQ29tcGxldGVkU3VjY2Vzc2Z1bGx5OgorICAgICAgICAgICAgICAgIGNhc2UgRmFpbGVkOgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAiSWxsb2dpY2FsIHN0YXRlIiApOworCisgICAgICAgICAgICAgICAgY2FzZSBOZWVkc0Fub3RoZXJSdW46CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOzsKKworICAgICAgICAgICAgICAgIGNhc2UgRXhlY3V0aW5nOgorICAgICAgICAgICAgICAgICAgICBtX3J1blN0YXRlID0gQ29tcGxldGVkU3VjY2Vzc2Z1bGx5OworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIEV4ZWN1dGluZ0NoaWxkcmVuOgorICAgICAgICAgICAgICAgICAgICBpZiggbV9jaGlsZHJlbi5lbXB0eSgpIHx8IG1fY2hpbGRyZW4uYmFjaygpLT5pc0NvbXBsZXRlKCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgbV9ydW5TdGF0ZSA9IENvbXBsZXRlZFN1Y2Nlc3NmdWxseTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAiVW5leHBlY3RlZCBzdGF0ZSIgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1vdmVUb1BhcmVudCgpOworICAgICAgICAgICAgbV9jdHguY29tcGxldGVDeWNsZSgpOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgdm9pZCBmYWlsKCkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgbV9ydW5TdGF0ZSA9IEZhaWxlZDsKKyAgICAgICAgICAgIGlmKCBtX3BhcmVudCApCisgICAgICAgICAgICAgICAgbV9wYXJlbnQtPm1hcmtBc05lZWRpbmdBbm90aGVyUnVuKCk7CisgICAgICAgICAgICBtb3ZlVG9QYXJlbnQoKTsKKyAgICAgICAgICAgIG1fY3R4LmNvbXBsZXRlQ3ljbGUoKTsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIHZvaWQgbWFya0FzTmVlZGluZ0Fub3RoZXJSdW4oKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICBtX3J1blN0YXRlID0gTmVlZHNBbm90aGVyUnVuOworICAgICAgICB9CisgICAgcHJpdmF0ZToKKyAgICAgICAgdm9pZCBtb3ZlVG9QYXJlbnQoKSB7CisgICAgICAgICAgICBhc3NlcnQoIG1fcGFyZW50ICk7CisgICAgICAgICAgICBtX2N0eC5zZXRDdXJyZW50VHJhY2tlciggbV9wYXJlbnQgKTsKKyAgICAgICAgfQorICAgICAgICB2b2lkIG1vdmVUb1RoaXMoKSB7CisgICAgICAgICAgICBtX2N0eC5zZXRDdXJyZW50VHJhY2tlciggdGhpcyApOworICAgICAgICB9CisgICAgfTsKKworICAgIGNsYXNzIFNlY3Rpb25UcmFja2VyIDogcHVibGljIFRyYWNrZXJCYXNlIHsKKyAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IG1fZmlsdGVyczsKKyAgICBwdWJsaWM6CisgICAgICAgIFNlY3Rpb25UcmFja2VyKCBOYW1lQW5kTG9jYXRpb24gY29uc3QmIG5hbWVBbmRMb2NhdGlvbiwgVHJhY2tlckNvbnRleHQmIGN0eCwgSVRyYWNrZXIqIHBhcmVudCApCisgICAgICAgIDogICBUcmFja2VyQmFzZSggbmFtZUFuZExvY2F0aW9uLCBjdHgsIHBhcmVudCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKCBwYXJlbnQgKSB7CisgICAgICAgICAgICAgICAgd2hpbGUoICFwYXJlbnQtPmlzU2VjdGlvblRyYWNrZXIoKSApCisgICAgICAgICAgICAgICAgICAgIHBhcmVudCA9ICZwYXJlbnQtPnBhcmVudCgpOworCisgICAgICAgICAgICAgICAgU2VjdGlvblRyYWNrZXImIHBhcmVudFNlY3Rpb24gPSBzdGF0aWNfY2FzdDxTZWN0aW9uVHJhY2tlciY+KCAqcGFyZW50ICk7CisgICAgICAgICAgICAgICAgYWRkTmV4dEZpbHRlcnMoIHBhcmVudFNlY3Rpb24ubV9maWx0ZXJzICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdmlydHVhbCB+U2VjdGlvblRyYWNrZXIoKTsKKworICAgICAgICB2aXJ0dWFsIGJvb2wgaXNTZWN0aW9uVHJhY2tlcigpIGNvbnN0IENBVENIX09WRVJSSURFIHsgcmV0dXJuIHRydWU7IH0KKworICAgICAgICBzdGF0aWMgU2VjdGlvblRyYWNrZXImIGFjcXVpcmUoIFRyYWNrZXJDb250ZXh0JiBjdHgsIE5hbWVBbmRMb2NhdGlvbiBjb25zdCYgbmFtZUFuZExvY2F0aW9uICkgeworICAgICAgICAgICAgU2VjdGlvblRyYWNrZXIqIHNlY3Rpb24gPSBDQVRDSF9OVUxMOworCisgICAgICAgICAgICBJVHJhY2tlciYgY3VycmVudFRyYWNrZXIgPSBjdHguY3VycmVudFRyYWNrZXIoKTsKKyAgICAgICAgICAgIGlmKCBJVHJhY2tlciogY2hpbGRUcmFja2VyID0gY3VycmVudFRyYWNrZXIuZmluZENoaWxkKCBuYW1lQW5kTG9jYXRpb24gKSApIHsKKyAgICAgICAgICAgICAgICBhc3NlcnQoIGNoaWxkVHJhY2tlciApOworICAgICAgICAgICAgICAgIGFzc2VydCggY2hpbGRUcmFja2VyLT5pc1NlY3Rpb25UcmFja2VyKCkgKTsKKyAgICAgICAgICAgICAgICBzZWN0aW9uID0gc3RhdGljX2Nhc3Q8U2VjdGlvblRyYWNrZXIqPiggY2hpbGRUcmFja2VyICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBzZWN0aW9uID0gbmV3IFNlY3Rpb25UcmFja2VyKCBuYW1lQW5kTG9jYXRpb24sIGN0eCwgJmN1cnJlbnRUcmFja2VyICk7CisgICAgICAgICAgICAgICAgY3VycmVudFRyYWNrZXIuYWRkQ2hpbGQoIHNlY3Rpb24gKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKCAhY3R4LmNvbXBsZXRlZEN5Y2xlKCkgKQorICAgICAgICAgICAgICAgIHNlY3Rpb24tPnRyeU9wZW4oKTsKKyAgICAgICAgICAgIHJldHVybiAqc2VjdGlvbjsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgdHJ5T3BlbigpIHsKKyAgICAgICAgICAgIGlmKCAhaXNDb21wbGV0ZSgpICYmIChtX2ZpbHRlcnMuZW1wdHkoKSB8fCBtX2ZpbHRlcnNbMF0uZW1wdHkoKSB8fCAgbV9maWx0ZXJzWzBdID09IG1fbmFtZUFuZExvY2F0aW9uLm5hbWUgKSApCisgICAgICAgICAgICAgICAgb3BlbigpOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBhZGRJbml0aWFsRmlsdGVycyggc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IGNvbnN0JiBmaWx0ZXJzICkgeworICAgICAgICAgICAgaWYoICFmaWx0ZXJzLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgbV9maWx0ZXJzLnB1c2hfYmFjaygiIik7IC8vIFJvb3QgLSBzaG91bGQgbmV2ZXIgYmUgY29uc3VsdGVkCisgICAgICAgICAgICAgICAgbV9maWx0ZXJzLnB1c2hfYmFjaygiIik7IC8vIFRlc3QgQ2FzZSAtIG5vdCBhIHNlY3Rpb24gZmlsdGVyCisgICAgICAgICAgICAgICAgbV9maWx0ZXJzLmluc2VydCggbV9maWx0ZXJzLmVuZCgpLCBmaWx0ZXJzLmJlZ2luKCksIGZpbHRlcnMuZW5kKCkgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB2b2lkIGFkZE5leHRGaWx0ZXJzKCBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gY29uc3QmIGZpbHRlcnMgKSB7CisgICAgICAgICAgICBpZiggZmlsdGVycy5zaXplKCkgPiAxICkKKyAgICAgICAgICAgICAgICBtX2ZpbHRlcnMuaW5zZXJ0KCBtX2ZpbHRlcnMuZW5kKCksICsrZmlsdGVycy5iZWdpbigpLCBmaWx0ZXJzLmVuZCgpICk7CisgICAgICAgIH0KKyAgICB9OworCisgICAgY2xhc3MgSW5kZXhUcmFja2VyIDogcHVibGljIFRyYWNrZXJCYXNlIHsKKyAgICAgICAgaW50IG1fc2l6ZTsKKyAgICAgICAgaW50IG1faW5kZXg7CisgICAgcHVibGljOgorICAgICAgICBJbmRleFRyYWNrZXIoIE5hbWVBbmRMb2NhdGlvbiBjb25zdCYgbmFtZUFuZExvY2F0aW9uLCBUcmFja2VyQ29udGV4dCYgY3R4LCBJVHJhY2tlciogcGFyZW50LCBpbnQgc2l6ZSApCisgICAgICAgIDogICBUcmFja2VyQmFzZSggbmFtZUFuZExvY2F0aW9uLCBjdHgsIHBhcmVudCApLAorICAgICAgICAgICAgbV9zaXplKCBzaXplICksCisgICAgICAgICAgICBtX2luZGV4KCAtMSApCisgICAgICAgIHt9CisgICAgICAgIHZpcnR1YWwgfkluZGV4VHJhY2tlcigpOworCisgICAgICAgIHZpcnR1YWwgYm9vbCBpc0luZGV4VHJhY2tlcigpIGNvbnN0IENBVENIX09WRVJSSURFIHsgcmV0dXJuIHRydWU7IH0KKworICAgICAgICBzdGF0aWMgSW5kZXhUcmFja2VyJiBhY3F1aXJlKCBUcmFja2VyQ29udGV4dCYgY3R4LCBOYW1lQW5kTG9jYXRpb24gY29uc3QmIG5hbWVBbmRMb2NhdGlvbiwgaW50IHNpemUgKSB7CisgICAgICAgICAgICBJbmRleFRyYWNrZXIqIHRyYWNrZXIgPSBDQVRDSF9OVUxMOworCisgICAgICAgICAgICBJVHJhY2tlciYgY3VycmVudFRyYWNrZXIgPSBjdHguY3VycmVudFRyYWNrZXIoKTsKKyAgICAgICAgICAgIGlmKCBJVHJhY2tlciogY2hpbGRUcmFja2VyID0gY3VycmVudFRyYWNrZXIuZmluZENoaWxkKCBuYW1lQW5kTG9jYXRpb24gKSApIHsKKyAgICAgICAgICAgICAgICBhc3NlcnQoIGNoaWxkVHJhY2tlciApOworICAgICAgICAgICAgICAgIGFzc2VydCggY2hpbGRUcmFja2VyLT5pc0luZGV4VHJhY2tlcigpICk7CisgICAgICAgICAgICAgICAgdHJhY2tlciA9IHN0YXRpY19jYXN0PEluZGV4VHJhY2tlcio+KCBjaGlsZFRyYWNrZXIgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIHRyYWNrZXIgPSBuZXcgSW5kZXhUcmFja2VyKCBuYW1lQW5kTG9jYXRpb24sIGN0eCwgJmN1cnJlbnRUcmFja2VyLCBzaXplICk7CisgICAgICAgICAgICAgICAgY3VycmVudFRyYWNrZXIuYWRkQ2hpbGQoIHRyYWNrZXIgKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYoICFjdHguY29tcGxldGVkQ3ljbGUoKSAmJiAhdHJhY2tlci0+aXNDb21wbGV0ZSgpICkgeworICAgICAgICAgICAgICAgIGlmKCB0cmFja2VyLT5tX3J1blN0YXRlICE9IEV4ZWN1dGluZ0NoaWxkcmVuICYmIHRyYWNrZXItPm1fcnVuU3RhdGUgIT0gTmVlZHNBbm90aGVyUnVuICkKKyAgICAgICAgICAgICAgICAgICAgdHJhY2tlci0+bW92ZU5leHQoKTsKKyAgICAgICAgICAgICAgICB0cmFja2VyLT5vcGVuKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiAqdHJhY2tlcjsKKyAgICAgICAgfQorCisgICAgICAgIGludCBpbmRleCgpIGNvbnN0IHsgcmV0dXJuIG1faW5kZXg7IH0KKworICAgICAgICB2b2lkIG1vdmVOZXh0KCkgeworICAgICAgICAgICAgbV9pbmRleCsrOworICAgICAgICAgICAgbV9jaGlsZHJlbi5jbGVhcigpOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIGNsb3NlKCkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgVHJhY2tlckJhc2U6OmNsb3NlKCk7CisgICAgICAgICAgICBpZiggbV9ydW5TdGF0ZSA9PSBDb21wbGV0ZWRTdWNjZXNzZnVsbHkgJiYgbV9pbmRleCA8IG1fc2l6ZS0xICkKKyAgICAgICAgICAgICAgICBtX3J1blN0YXRlID0gRXhlY3V0aW5nOworICAgICAgICB9CisgICAgfTsKKworICAgIGlubGluZSBJVHJhY2tlciYgVHJhY2tlckNvbnRleHQ6OnN0YXJ0UnVuKCkgeworICAgICAgICBtX3Jvb3RUcmFja2VyID0gbmV3IFNlY3Rpb25UcmFja2VyKCBOYW1lQW5kTG9j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ICAgICAgICAgICAgLy8gUGFzcyBpbiBndWFyYW50ZWUgc2l6ZSB0byBiZSBmaWxsZWQKKyAgICAgICAgICAgIFNldFRocmVhZFN0YWNrR3VhcmFudGVlKCZndWFyYW50ZWVTaXplKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyB2b2lkIHJlc2V0KCkgeworICAgICAgICAgICAgaWYgKGlzU2V0KSB7CisgICAgICAgICAgICAgICAgLy8gVW5yZWdpc3RlciBoYW5kbGVyIGFuZCByZXN0b3JlIHRoZSBvbGQgZ3VhcmFudGVlCisgICAgICAgICAgICAgICAgUmVtb3ZlVmVjdG9yZWRFeGNlcHRpb25IYW5kbGVyKGV4Y2VwdGlvbkhhbmRsZXJIYW5kbGUpOworICAgICAgICAgICAgICAgIFNldFRocmVhZFN0YWNrR3VhcmFudGVlKCZndWFyYW50ZWVTaXplKTsKKyAgICAgICAgICAgICAgICBleGNlcHRpb25IYW5kbGVySGFuZGxlID0gQ0FUQ0hfTlVMTDsKKyAgICAgICAgICAgICAgICBpc1NldCA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgfkZhdGFsQ29uZGl0aW9uSGFuZGxlcigpIHsKKyAgICAgICAgICAgIHJlc2V0KCk7CisgICAgICAgIH0KKyAgICBwcml2YXRlOgorICAgICAgICBzdGF0aWMgYm9vbCBpc1NldDsKKyAgICAgICAgc3RhdGljIFVMT05HIGd1YXJhbnRlZVNpemU7CisgICAgICAgIHN0YXRpYyBQVk9JRCBleGNlcHRpb25IYW5kbGVySGFuZGxlOworICAgIH07CisKKyAgICBib29sIEZhdGFsQ29uZGl0aW9uSGFuZGxlcjo6aXNTZXQgPSBmYWxzZTsKKyAgICBVTE9ORyBGYXRhbENvbmRpdGlvbkhhbmRsZXI6Omd1YXJhbnRlZVNpemUgPSAwOworICAgIFBWT0lEIEZhdGFsQ29uZGl0aW9uSGFuZGxlcjo6ZXhjZXB0aW9uSGFuZGxlckhhbmRsZSA9IENB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FRlcm1pbmF0aW9uIHJlcXVlc3Qgc2lnbmFsIiB9LAorICAgICAgICAgICAgeyBTSUdBQlJULCAiU0lHQUJSVCAtIEFib3J0IChhYm5vcm1hbCB0ZXJtaW5hdGlvbikgc2lnbmFsIiB9CisgICAgfTsKKworICAgIHN0cnVjdCBGYXRhbENvbmRpdGlvbkhhbmRsZXIgeworCisgICAgICAgIHN0YXRpYyBib29sIGlzU2V0OworICAgICAgICBzdGF0aWMgc3RydWN0IHNpZ2FjdGlvbiBvbGRTaWdBY3Rpb25zIFtzaXplb2Yoc2lnbmFsRGVmcykvc2l6ZW9mKFNpZ25hbERlZnMpXTsKKyAgICAgICAgc3RhdGljIHN0YWNrX3Qgb2xkU2lnU3RhY2s7CisgICAgICAgIHN0YXRpYyBjaGFyIGFsdFN0YWNrTWVtW1NJR1NUS1NaXTsKKworICAgICAgICBzdGF0aWMgdm9pZCBoYW5kbGVTaWduYWwoIGludCBzaWcgKSB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lID0gIjx1bmtub3duIHNpZ25hbD4iOworICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemVvZihzaWduYWxEZWZzKSAvIHNpemVvZihTaWduYWxEZWZzKTsgKytpKSB7CisgICAgICAgICAgICAgICAgU2lnbmFsRGVmcyAmZGVmID0gc2lnbmFsRGVmc1tpXTsKKyAgICAgICAgICAgICAgICBpZiAoc2lnID09IGRlZi5pZCkgeworICAgICAgICAgICAgICAgICAgICBuYW1lID0gZGVmLm5hbWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJlc2V0KCk7CisgICAgICAgICAgICByZXBvcnRGYXRhbChuYW1lKTsKKyAgICAgICAgICAgIHJhaXNlKCBzaWcgKTsKKyAgICAgICAgfQorCisgICAgICAgIEZhdGFsQ29uZGl0aW9uSGFuZGxlcigpIHsKKyAgICAgICAgICAgIGlzU2V0ID0gdHJ1ZTsKKyAgICAgICAgICAgIHN0YWNrX3Qgc2lnU3RhY2s7CisgICAgICAgICAgICBzaWdTdGFjay5zc19zcCA9IGFsdFN0YWNrTWVtOworICAgICAgICAgICAgc2lnU3RhY2suc3Nfc2l6ZSA9IFNJR1NUS1NaOworICAgICAgICAgICAgc2lnU3RhY2suc3NfZmxhZ3MgPSAwOworICAgICAgICAgICAgc2lnYWx0c3RhY2soJnNpZ1N0YWNrLCAmb2xkU2lnU3RhY2spOworICAgICAgICAgICAgc3RydWN0IHNpZ2FjdGlvbiBzYSA9IHsgMCB9OworCisgICAgICAgICAgICBzYS5zYV9oYW5kbGVyID0gaGFuZGxlU2lnbmFsOworICAgICAgICAgICAgc2Euc2FfZmxhZ3MgPSBTQV9PTlNUQUNLOworICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemVvZihzaWduYWxEZWZzKS9zaXplb2YoU2lnbmFsRGVmcyk7ICsraSkgeworICAgICAgICAgICAgICAgIHNpZ2FjdGlvbihzaWduYWxEZWZzW2ldLmlkLCAmc2EsICZvbGRTaWdBY3Rpb25zW2ldKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIH5GYXRhbENvbmRpdGlvbkhhbmRsZXIoKSB7CisgICAgICAgICAgICByZXNldCgpOworICAgICAgICB9CisgICAgICAgIHN0YXRpYyB2b2lkIHJlc2V0KCkgeworICAgICAgICAgICAgaWYoIGlzU2V0ICkgeworICAgICAgICAgICAgICAgIC8vIFNldCBzaWduYWxzIGJhY2sgdG8gcHJldmlvdXMgdmFsdWVzIC0tIGhvcGVmdWxseSBub2JvZHkgb3Zlcndyb3RlIHRoZW0gaW4gdGhlIG1lYW50aW1lCisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemVvZihzaWduYWxEZWZzKS9zaXplb2YoU2lnbmFsRGVmcyk7ICsraSApIH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Zy0+bmFtZSgpICksCisgICAgICAgICAgICBtX2NvbnRleHQoIGdldEN1cnJlbnRNdXRhYmxlQ29udGV4dCgpICksCisgICAgICAgICAgICBtX2FjdGl2ZVRlc3RDYXNlKCBDQVRDSF9OVUxMICksCisgICAgICAgICAgICBtX2NvbmZpZyggX2NvbmZpZyApLAorICAgICAgICAgICAgbV9yZXBvcnRlciggcmVwb3J0ZXIgKSwKKyAgICAgICAgICAgIG1fc2hvdWxkUmVwb3J0VW5leHBlY3RlZCAoIHRydWUgKQorICAgICAgICB7CisgICAgICAgICAgICBtX2NvbnRleHQuc2V0UnVubmVyKCB0aGlzICk7CisgICAgICAgICAgICBtX2NvbnRleHQuc2V0Q29uZmlnKCBtX2NvbmZpZyApOworICAgICAgICAgICAgbV9jb250ZXh0LnNldFJlc3VsdENhcHR1cmUoIHRoaXMgKTsKKyAgICAgICAgICAgIG1fcmVwb3J0ZXItPnRlc3RSdW5TdGFydGluZyggbV9ydW5JbmZvICk7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIH5SdW5Db250ZXh0KCkgeworICAgICAgICAgICAgbV9yZXBvcnRlci0+dGVzdFJ1bkVuZGVkKCBUZXN0UnVuU3RhdHMoIG1fcnVuSW5mbywgbV90b3RhbHMsIGFib3J0aW5nKCkgKSApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCB0ZXN0R3JvdXBTdGFydGluZyggc3RkOjpzdHJpbmcgY29uc3QmIHRlc3RTcGVjLCBzdGQ6OnNpemVfdCBncm91cEluZGV4LCBzdGQ6OnNpemVfdCBncm91cHNDb3VudCApIHsKKyAgICAgICAgICAgIG1fcmVwb3J0ZXItPnRlc3RHcm91cFN0YXJ0aW5nKCBHcm91cEluZm8oIHRlc3RTcGVjLCBncm91cEluZGV4LCBncm91cHNDb3VudCApICk7CisgICAgICAgIH0KKyAgICAgICAgdm9pZCB0ZXN0R3JvdXBFbmRlZCggc3RkOjpzdHJpbmcgY29uc3QmIHRlc3RTcGVjLCBUb3RhbHMgY29uc3QmIHRvdGFscywgc3RkOjpzaXplX3QgZ3JvdXBJbmRleCwgc3RkOjpzaXplX3QgZ3JvdXBzQ291bnQgKSB7CisgICAgICAgICAgICBtX3JlcG9ydGVyLT50ZXN0R3JvdXBFbmRlZCggVGVzdEdyb3VwU3RhdHMoIEdyb3VwSW5mbyggdGVzdFNwZWMsIGdyb3VwSW5kZXgsIGdyb3Vwc0NvdW50ICksIHRvdGFscywgYWJvcnRpbmcoKSApICk7CisgICAgICAgIH0KKworICAgICAgICBUb3RhbHMgcnVuVGVzdCggVGVzdENhc2UgY29uc3QmIHRlc3RDYXNlICkgeworICAgICAgICAgICAgVG90YWxzIHByZXZUb3RhbHMgPSBtX3RvdGFsczsKKworICAgICAgICAgICAgc3RkOjpzdHJpbmcgcmVkaXJlY3RlZENvdXQ7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyByZWRpcmVjdGVkQ2VycjsKKworICAgICAgICAgICAgVGVzdENhc2VJbmZvIHRlc3RJbmZvID0gdGVzdENhc2UuZ2V0VGVzdENhc2VJbmZvKCk7CisKKyAgICAgICAgICAgIG1fcmVwb3J0ZXItPnRlc3RDYXNlU3RhcnRpbmcoIHRlc3RJbmZvICk7CisKKyAgICAgICAgICAgIG1fYWN0aXZlVGVzdENhc2UgPSAmdGVzdENhc2U7CisKKyAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICBJVHJhY2tlciYgcm9vdFRyYWNrZXIgPSBtX3RyYWNrZXJDb250ZXh0LnN0YXJ0UnVuKCk7CisgICAgICAgICAgICAgICAgYXNzZXJ0KCByb290VHJhY2tlci5pc1NlY3Rpb25UcmFja2VyKCkgKTsKKyAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxTZWN0aW9uVHJhY2tlciY+KCByb290VHJhY2tlciApLmFkZEluaXRpYWxGaWx0ZXJzKCBtX2NvbmZpZy0+Z2V0U2VjdGlvbnNUb1J1bigpICk7CisgICAgICAgICAgICAgICAgZG8geworICAgICA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ZXN0Q2FzZXMuZmFpbGVkKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtX3RvdGFscy50ZXN0Q2FzZXMgKz0gZGVsdGFUb3RhbHMudGVzdENhc2VzOworICAgICAgICAgICAgbV9yZXBvcnRlci0+dGVzdENhc2VFbmRlZCggVGVzdENhc2VTdGF0cyggICB0ZXN0SW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGFUb3RhbHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0ZWRDb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdGVkQ2VyciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWJvcnRpbmcoKSApICk7CisKKyAgICAgICAgICAgIG1fYWN0aXZlVGVzdENhc2UgPSBDQVRDSF9OVUxMOworICAgICAgICAgICAgbV90ZXN0Q2FzZVRyYWNrZXIgPSBDQVRDSF9OVUxMOworCisgICAgICAgICAgICByZXR1cm4gZGVsdGFUb3RhbHM7CisgICAgICAgIH0KKworICAgICAgICBQdHI8SUNvbmZpZyBjb25zdD4gY29uZmlnKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1fY29uZmlnOworICAgICAgICB9CisKKyAgICBwcml2YXRlOiAvLyBJUmVzdWx0Q2FwdHVyZQorCisgICAgICAgIHZpcnR1YWwgdm9pZCBhc3NlcnRpb25FbmRlZCggQXNzZXJ0aW9uUmVzdWx0IGNvbnN0JiByZXN1bHQgKSB7CisgICAgICAgICAgICBpZiggcmVzdWx0LmdldFJlc3VsdFR5cGUoKSA9PSBSZXN1bHRXYXM6Ok9rICkgeworICAgICAgICAgICAgICAgIG1fdG90YWxzLmFzc2VydGlvbnMucGFzc2VkKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKCAhcmVzdWx0LmlzT2soKSApIHsKKyAgICAgICAgICAgICAgICBtX3RvdGFscy5hc3NlcnRpb25zLmZhaWxlZCsrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBXZSBoYXZlIG5vIHVzZSBmb3IgdGhlIHJldHVybiB2YWx1ZSAod2hldGhlciBtZXNzYWdlcyBzaG91bGQgYmUgY2xlYXJlZCksIGJlY2F1c2UgbWVzc2FnZXMgd2VyZSBtYWRlIHNjb3BlZAorICAgICAgICAgICAgLy8gYW5kIHNob3VsZCBiZSBsZXQgdG8gY2xlYXIgdGhlbXNlbHZlcyBvdXQuCisgICAgICAgICAgICBzdGF0aWNfY2FzdDx2b2lkPihtX3JlcG9ydGVyLT5hc3NlcnRpb25FbmRlZChBc3NlcnRpb25TdGF0cyhyZXN1bHQsIG1fbWVzc2FnZXMsIG1fdG90YWxzKSkpOworCisgICAgICAgICAgICAvLyBSZXNldCB3b3JraW5nIHN0YXRlCisgICAgICAgICAgICBtX2xhc3RBc3NlcnRpb25JbmZvID0gQXNzZXJ0aW9uSW5mbyggc3RkOjpzdHJpbmcoKSwgbV9sYXN0QXNzZXJ0aW9uSW5mby5saW5lSW5mbywgIntVbmtub3duIGV4cHJlc3Npb24gYWZ0ZXIgdGhlIHJlcG9ydGVkIGxpbmV9IiAsIG1fbGFzdEFzc2VydGlvbkluZm8ucmVzdWx0RGlzcG9zaXRpb24gKTsKKyAgICAgICAgICAgIG1fbGFzdFJlc3VsdCA9IHJlc3VsdDsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgYm9vbCBzZWN0aW9uU3RhcnRlZCAoCisgICAgICAgICAgICBTZWN0aW9uSW5mbyBjb25zdCYgc2VjdGlvbkluZm8sCisgICAgICAgICAgICBDb3VudHMmIGFzc2VydGlvbnMKKyAgICAgICAgKQorICAgICAgICB7CisgICAgICAgICAgICBJVHJhY2tlciYgc2VjdGlvblRyYWNrZXIgPSBTZWN0aW9uVHJhY2tlcjo6YWNxdWlyZSggbV90cmFja2VyQ29udGV4dCwgVGVzdENhc2VUcmFja2luZzo6TmFtZUFuZExvY2F0aW9uKCBzZWN0aW9uSW5mby5uYW1lLCBzZWN0aW9uSW5mby5saW5lSW5mbyApICk7CisgICAgICAgICAgICBpZiggIXNlY3Rpb25UcmFja2VyLmlzT3BlbigpICkKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICBtX2FjdGl2ZVNlY3Rpb25zLnB1c2hfYmFjayggJnNlY3Rpb25UcmFja2VyICk7CisKKyAgICAgICAgICAgIG1fbGFzdEFzc2VydGlvbkluZm8ubGluZUluZm8gPSBzZWN0aW9uSW5mby5saW5lSW5mbzsKKworICAgICAgICAgICAgbV9yZXBvcnRlci0+c2VjdGlvblN0YXJ0aW5nKCBzZWN0aW9uSW5mbyApOworCisgICAgICAgICAgICBhc3NlcnRpb25zID0gbV90b3RhbHMuYXNzZXJ0aW9uczsKKworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgYm9vbCB0ZXN0Rm9yTWlzc2luZ0Fzc2VydGlvbnMoIENvdW50cyYgYXNzZXJ0aW9ucyApIHsKKyAgICAgICAgICAgIGlmKCBhc3NlcnRpb25zLnRvdGFsKCkgIT0gMCApCisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgaWYoICFtX2NvbmZpZy0+d2FybkFib3V0TWlzc2luZ0Fzc2VydGlvbnMoKSApCisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgaWYoIG1fdHJhY2tlckNvbnRleHQuY3VycmVudFRyYWNrZXIoKS5oYXNDaGlsZHJlbigpICkKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICBtX3RvdGFscy5hc3NlcnRpb25zLmZhaWxlZCsrOworICAgICAgICAgICAgYXNzZXJ0aW9ucy5mY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GluZUluZm8sIHRlc3RDYXNlSW5mby5uYW1lLCB0ZXN0Q2FzZUluZm8uZGVzY3JpcHRpb24gKTsKKworICAgICAgICAgICAgQ291bnRzIGFzc2VydGlvbnM7CisgICAgICAgICAgICBhc3NlcnRpb25zLmZhaWxlZCA9IDE7CisgICAgICAgICAgICBTZWN0aW9uU3RhdHMgdGVzdENhc2VTZWN0aW9uU3RhdHMoIHRlc3RDYXNlU2VjdGlvbiwgYXNzZXJ0aW9ucywgMCwgZmFsc2UgKTsKKyAgICAgICAgICAgIG1fcmVwb3J0ZXItPnNlY3Rpb25FbmRlZCggdGVzdENhc2VTZWN0aW9uU3RhdHMgKTsKKworICAgICAgICAgICAgVGVzdENhc2VJbmZvIHRlc3RJbmZvID0gbV9hY3RpdmVUZXN0Q2FzZS0+Z2V0VGVzdENhc2VJbmZvKCk7CisKKyAgICAgICAgICAgIFRvdGFscyBkZWx0YVRvdGFsczsKKyAgICAgICAgICAgIGRlbHRhVG90YWxzLnRlc3RDYXNlcy5mYWlsZWQgPSAxOworICAgICAgICAgICAgbV9yZXBvcnRlci0+dGVzdENhc2VFbmRlZCggVGVzdENhc2VTdGF0cyggICB0ZXN0SW5mbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsdGFUb3RhbHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlICkgKTsKKyAgICAgICAgICAgIG1fdG90YWxzLnRlc3RDYXNlcy5mYWlsZWQrKzsKKyAgICAgICAgICAgIHRlc3RHcm91cEVuZGVkKCBzdGQ6OnN0cmluZygpLCBtX3R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gICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbV9sYXN0QXNzZXJ0aW9uSW5mbyA9IEFzc2VydGlvbkluZm8oICJURVNUX0NBU0UiLCB0ZXN0Q2FzZUluZm8ubGluZUluZm8sIHN0ZDo6c3RyaW5nKCksIFJlc3VsdERpc3Bvc2l0aW9uOjpOb3JtYWwgKTsKKworICAgICAgICAgICAgICAgIHNlZWRSbmcoICptX2NvbmZpZyApOworCisgICAgICAgICAgICAgICAgVGltZXIgdGltZXI7CisgICAgICAgICAgICAgICAgdGltZXIuc3RhcnQoKTsKKyAgICAgICAgICAgICAgICBpZiggbV9yZXBvcnRlci0+Z2V0UHJlZmVyZW5jZXMoKS5zaG91bGRSZWRpcmVjdFN0ZE91dCApIHsKKyAgICAgICAgICAgICAgICAgICAgU3RyZWFtUmVkaXJlY3QgY291dFJlZGlyKCBDYXRjaDo6Y291dCgpLCByZWRpcmVjdGVkQ291dCApOworICAgICAgICAgICAgICAgICAgICBTdHJlYW1SZWRpcmVjdCBjZXJyUmVkaXIoIENhdGNoOjpjZXJyKCksIHJlZGlyZWN0ZWRDZXJyICk7CisgICAgICAgICAgICAgICAgICAgIGludm9rZUFjdGl2ZVRlc3RDYXNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgICBpbnZva2VBY3RpdmVUZXN0Q2FzZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkdXJhdGlvbiA9IHRpbWVyLmdldEVsYXBzZWRTZWNvbmRzKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCggVGVzdEZhaWx1cmVFeGNlcHRpb24mICkgeworICAgICAgICAgICAgICAgIC8vIFRoaXMganVzdCBtZWFucyB0aGUgdGVzdCB3YXMgYWJvcnRlZCBkdWUgdG8gZmFpbHVyZQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goLi4uKSB7CisgICAgICAgICAgICAg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WlsZWRCdXRPazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU2VjdGlvblN0YXRzIHRlc3RDYXNlU2VjdGlvblN0YXRzKCB0ZXN0Q2FzZVNlY3Rpb24sIGFzc2VydGlvbnMsIGR1cmF0aW9uLCBtaXNzaW5nQXNzZXJ0aW9ucyApOworICAgICAgICAgICAgbV9yZXBvcnRlci0+c2VjdGlvbkVuZGVkKCB0ZXN0Q2FzZVNlY3Rpb25TdGF0cyApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBpbnZva2VBY3RpdmVUZXN0Q2FzZSgpIHsKKyAgICAgICAgICAgIEZhdGFsQ29uZGl0aW9uSGFuZGxlciBmYXRhbENvbmRpdGlvbkhhbmRsZXI7IC8vIEhhbmRsZSBzaWduYWxzCisgICAgICAgICAgICBtX2FjdGl2ZVRlc3RDYXNlLT5pbnZva2UoKTsKKyAgICAgICAgICAgIGZhdGFsQ29uZGl0aW9uSGFuZGxlci5yZXNldCgpOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorCisgICAgICAgIFJlc3VsdEJ1aWxkZXIgbWFrZVVuZXhwZWN0ZWRSZXN1bHRCdWlsZGVyKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIFJlc3VsdEJ1aWxkZXIoICAgbV9sYXN0QXNzZXJ0aW9uSW5mby5tYWNyb05hbWUuY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1fbGFzdEFzc2VydGlvbkluZm8ubGluZUluZm8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtX2xhc3RBc3NlcnRpb25JbmZvLmNhcHR1cmVkRXhwcmVzc2lvbi5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbV9sYXN0QXNzZXJ0aW9uSW5mby5yZXN1bHREaXNwb3NpdGlvbiApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBoYW5kbGVVbmZpbmlzaGVkU2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AgICAgICAgICAgIHVuc2lnbmVkIGludCBfcGF0Y2hOdW1iZXIsCisgICAgICAgICAgICAgICAgICAgIGNoYXIgY29uc3QgKiBjb25zdCBfYnJhbmNoTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgaW50IF9idWlsZE51bWJlciApOworCisgICAgICAgIHVuc2lnbmVkIGludCBjb25zdCBtYWpvclZlcnNpb247CisgICAgICAgIHVuc2lnbmVkIGludCBjb25zdCBtaW5vclZlcnNpb247CisgICAgICAgIHVuc2lnbmVkIGludCBjb25zdCBwYXRjaE51bWJlcjsKKworICAgICAgICAvLyBidWlsZE51bWJlciBpcyBvbmx5IHVzZWQgaWYgYnJhbmNoTmFtZSBpcyBub3QgbnVsbAorICAgICAgICBjaGFyIGNvbnN0ICogY29uc3QgYnJhbmNoTmFtZTsKKyAgICAgICAgdW5zaWduZWQgaW50IGNvbnN0IGJ1aWxkTnVtYmVyOworCisgICAgICAgIGZyaWVuZCBzdGQ6Om9zdHJlYW0mIG9wZXJhdG9yIDw8ICggc3RkOjpvc3RyZWFtJiBvcywgVmVyc2lvbiBjb25zdCYgdmVyc2lvbiApOworCisgICAgcHJpdmF0ZToKKyAgICAgICAgdm9pZCBvcGVyYXRvcj0oIFZlcnNpb24gY29uc3QmICk7CisgICAgfTsKKworICAgIGlubGluZSBWZXJzaW9uIGxpYnJhcnlWZXJzaW9uKCk7Cit9CisKKyNpbmNsdWRlIDxmc3RyZWFtPgorI2luY2x1ZGUgPHN0ZGxpYi5oPgorI2luY2x1ZGUgPGxpbWl0cz4KKworbmFtZXNwYWNlIENhdGNoIHsKKworICAgIFB0cjxJU3RyZWFtaW5nUmVwb3J0ZXI+IGNyZWF0ZVJlcG9ydGVyKCBzdGQ6OnN0cmluZyBjb25zdCYgcmVwb3J0ZXJOYW1lLCBQdHI8Q29uZmlnPiBjb25zdCYgY29uZmlnICkgeworICAgICAgICBQdHI8SVN0cmVhbWluZ1JlcG9ydGVyPiByZXBvcnRlciA9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KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIFNlc3Npb24gOiBOb25Db3B5YWJsZSB7CisgICAgICAgIHN0YXRpYyBib29sIGFscmVhZHlJbnN0YW50aWF0ZWQ7CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgc3RydWN0IE9uVW51c2VkT3B0aW9ucyB7IGVudW0gRG9XaGF0IHsgSWdub3JlLCBGYWlsIH07IH07CisKKyAgICAgICAgU2Vzc2lvbigpCisgICAgICAgIDogbV9jbGkoIG1ha2VDb21tYW5kTGluZVBhcnNlcigpICkgeworICAgICAgICAgICAgaWYoIGFscmVhZHlJbnN0YW50aWF0ZWQgKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbXNnID0gIk9ubHkgb25lIGluc3RhbmNlIG9mIENhdGNoOjpTZXNzaW9uIGNhbiBldmVyIGJlIHVzZWQiOworICAgICAgICAgICAgICAgIENhdGNoOjpjZXJyKCkgPDwgbXNnIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgICAgICB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCBtc2cgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFscmVhZHlJbnN0YW50aWF0ZWQgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIH5TZXNzaW9uKCkgeworICAgICAgICAgICAgQ2F0Y2g6OmNsZWFuVXAoKTsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgc2hvd0hlbHAoIHN0ZDo6c3RyaW5nIGNvbnN0JiBwcm9jZXNzTmFtZSApIHsKKyAgICAgICAgICAgIENhdGNoOjpjb3V0KCkgPDwgIlxuQ2F0Y2ggdiIgPDwgbGlicmFyeVZlcnNpb24oKSA8PCAiXG4iOworCisgICAgICAgICAgICBtX2NsaS51c2FnZSggQ2F0Y2g6OmNvdXQoKSwgcHJvY2Vzc05hbWUgKTsKKyAgICAgICAgICAgIENhdGNoOjpjb3V0KCkgPDwgIkZvciBtb3JlIGRldGFpbCB1c2FnZSBwbGVhc2Ugc2VlIHRoZSBwcm9qZWN0IGRvY3NcbiIgPDwgc3RkOjplbmRsOworICAgICAgICB9CisKKyAgICAgICAgaW50IGFwcGx5Q29tbWFuZExpbmUoIGludCBhcmdjLCBjaGFyIGNvbnN0KiBjb25zdCogY29uc3QgYXJndiwgT25VbnVzZWRPcHRpb25zOjpEb1doYXQgdW51c2VkT3B0aW9uQmVoYXZpb3VyID0gT25VbnVzZWRPcHRpb25zOjpGYWlsICkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtX2NsaS5zZXRUaHJvd09uVW5yZWNvZ25pc2VkVG9rZW5zKCB1bnVzZWRPcHRpb25CZWhhdmlvdXIgPT0gT25VbnVzZWRPcHRpb25zOjpGYWlsICk7CisgICAgICAgICAgICAgICAgbV91bnVzZWRUb2tlbnMgPSBtX2NsaS5wYXJzZUludG8oIENsYXJhOjphcmdzVG9WZWN0b3IoIGFyZ2MsIGFyZ3YgKSwgbV9jb25maWdEYXRhICk7CisgICAgICAgICAgICAgICAgaWYoIG1fY29uZmlnRGF0YS5zaG93SGVscCApCisgICAgICAgICAgICAgICAgICAgIHNob3dIZWxwKCBtX2NvbmZpZ0RhdGEucHJvY2Vzc05hbWUgKTsKKyAgICAgICAgICAgICAgICBtX2NvbmZpZy5yZXNldCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goIHN0ZDo6ZXhjZXB0aW9uJiBleCApIHsKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbG91ciBjb2xvdXJHdWFyZCggQ29sb3VyOjpSZWQgKTsKKyAgICAgICAgICAgICAgICAgICAgQ2F0Y2g6OmNlcnIoKQorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIlxuRXJyb3IocykgaW4gaW5wdXQ6XG4iCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBUZXh0KCBleC53aGF0KCksIFRleHRBdHRyaWJ1dGVzKCkuc2V0SW5kZW50KDIpICkKKyAgICAgICAgICAgICAgICAgICAgICAgIDw8ICJcblxuIjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbV9jbGkudXNhZ2UoIENhdGNoOjpjb3V0KCksIG1fY29uZmlnRGF0YS5wcm9jZXNzTmFtZSApOworICAgICAgICAgICAgICAgIHJldHVybiAoc3RkOjpudW1lcmljX2xpbWl0czxpbnQ+OjptYXgpKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgdXNlQ29uZmlnRGF0YSggQ29uZmlnRGF0YSBjb25zdCYgX2NvbmZpZ0RhdGEgKSB7CisgICAgICAgICAgICBtX2NvbmZpZ0RhdGEgPSBfY29uZmlnRGF0YTsKKyAgICAgICAgICAgIG1fY29uZmlnLnJlc2V0KCk7CisgICAgICAgIH0KKworICAgICAgICBpbnQgcnVuKCBpbnQgYXJnYywgY2hhciBjb25zdCogY29uc3QqIGNvbnN0IGFyZ3YgKSB7CisKKyAgICAgICAgICAgIGludCByZXR1cm5Db2RlID0gYXBwbHlDb21tYW5kTGluZSggYXJnYywgYXJndiApOworICAgICAgICAgICAgaWYoIHJldHVybkNvZGUgPT0gMCApCisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSA9IHJ1bigpOworICAgICAgICAgICAgcmV0dXJuIHJldHVybkNvZGU7CisgICAgICAgIH0KKworICAgICNpZiBkZWZpbmVkKFdJTjMyKSAmJiBkZWZpbmVkKFVOSUNPREUpCisgICAgICAgIGludCBydW4oIGludCBhcmdjLCB3Y2hhcl90IGNvbnN0KiBjb25zdCogY29uc3QgYXJndiApIHsKKworICAgICAgICAgICAgY2hhciAqKnV0ZjhBcmd2ID0gbmV3IGNoYXIgKlsgYXJnYyBdOworCisgICAgICAgICAgICBmb3IgKCBpbnQgaSA9IDA7IGkgPCBhcmdjOyArK2kgKSB7CisgICAgICAgICAgICAgICAgaW50IGJ1ZlNpemUgPSBXaWRlQ2hhclRvTXVsdGlCeXRlKCBDUF9VVEY4LCAwLCBhcmd2W2ldLCAtMSwgTlVMTCwgMCwgTlVMTCwgTlVMTCApOworCisgICAgICAgICAgICAgICAgdXRmOEFyZ3ZbIGkgXSA9IG5ldyBjaGFyWyBidWZTaXplIF07CisKKyAgICAgICAgICAgICAgICBXaWRlQ2hhclRvTXVsdGlCeXRlKCBDUF9VVEY4LCAwLCBhcmd2W2ldLCAtMSwgdXRmOEFyZ3ZbaV0sIGJ1ZlNpemUsIE5VTEwsIE5VTEwgKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50IHJldHVybkNvZGUgPSBhcHBseUNvbW1hbmRMaW5lKCBhcmdjLCB1dGY4QXJndiApOworICAgICAgICAgICAgaWYoIHJldHVybkNvZGUgPT0gMCApCisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSA9IHJ1bigpOworCisgICAgICAgICAgICBmb3IgKCBpbnQgaSA9IDA7IGkgPCBhcmdjOyArK2kgKQorICAgICAgICAgICAgICAgIGRlbGV0ZSBbXSB1dGY4QXJndlsgaSBdOworCisgICAgICAgICAgICBkZWxldGUgW10gdXRmOEFyZ3Y7CisKKyAgICAgICAgICAgIHJldHVybiByZXR1cm5Db2RlOworICAgICAgICB9CisgICAgI2VuZGlmCisKKyAgICAgICAgaW50IHJ1bigpIHsKKyAgICAgICAgICAgIGlmKCBtX2NvbmZpZ0RhdGEuc2hvd0hlbHAgKQorICAgICAgICAgICAgICAgIHJldHVybiAwOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjb25maWcoKTsgLy8gRm9yY2UgY29uZmlnIHRvIGJlIGNvbnN0cnVjdGVkCisKKyAgICAgICAgICAgICAgICBzZWVkUm5nKCAqbV9jb25maWcgKTsKKworICAgICAgICAgICAgICAgIGlmKCBtX2NvbmZpZ0RhdGEuZmlsZW5hbWVzQXNUYWdzICkKKyAgICAgICAgICAgICAgICAgICAgYXBwbHlGaWxlbmFtZXNBc1RhZ3MoICptX2NvbmZpZyApOworCisgICAgICAgICAgICAgICAgLy8gSGFuZGxlIGxpc3QgcmVxdWVzdAorICAgICAgICAgICAgICAgIGlmKCBPcHRpb248c3RkOjpzaXplX3Q+IGxpc3RlZCA9IGxpc3QoIGNvbmZpZygpICkgKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8aW50PiggKmxpc3RlZCApOworCisgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PGludD4oIHJ1blRlc3RzKCBtX2NvbmZpZyApLmFzc2VydGlvbnMuZmFpbGVkICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCggc3RkOjpleGNlcHRpb24mIGV4ICkgeworICAgICAgICAgICAgICAgIENhdGNoOjpjZXJyKCkgPDwgZXgud2hhdCgpIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgICAgICByZXR1cm4gKHN0ZDo6bnVtZXJpY19saW1pdHM8aW50Pjo6bWF4KSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQ2xhcmE6OkNvbW1hbmRMaW5lPENvbmZpZ0RhdGE+IGNvbnN0JiBjbGkoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbV9jbGk7CisgICAgICAgIH0KKyAgICAgICAgc3RkOjp2ZWN0b3I8Q2xhcmE6OlBhcnNlcjo6VG9rZW4+IGNvbnN0JiB1bnVzZWRUb2tlbnMoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbV91bnVzZWRUb2tlbnM7CisgICAgICAgIH0KKyAgICAgICAgQ29uZmlnRGF0YSYgY29uZmlnRGF0YSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtX2NvbmZpZ0RhdGE7CisgICAgICAgIH0KKyAgICAgICAgQ29uZmlnJiBjb25maWcoKSB7CisgICAgICAgICAgICBpZiggIW1fY29uZmlnICkKKyAgICAgICAgICAgICAgICBtX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29ncmFwaGljYWxPcmRlcjoKKyAgICAgICAgICAgICAgICBzdGQ6OnNvcnQoIHNvcnRlZC5iZWdpbigpLCBzb3J0ZWQuZW5kKCkgKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgUnVuVGVzdHM6OkluUmFuZG9tT3JkZXI6CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzZWVkUm5nKCBjb25maWcgKTsKKyAgICAgICAgICAgICAgICAgICAgUmFuZG9tTnVtYmVyR2VuZXJhdG9yOjpzaHVmZmxlKCBzb3J0ZWQgKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFJ1blRlc3RzOjpJbkRlY2xhcmF0aW9uT3JkZXI6CisgICAgICAgICAgICAgICAgLy8gYWxyZWFkeSBpbiBkZWNsYXJhdGlvbiBvcmRlcgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHJldHVybiBzb3J0ZWQ7CisgICAgfQorICAgIGJvb2wgbWF0Y2hUZXN0KCBUZXN0Q2FzZSBjb25zdCYgdGVzdENhc2UsIFRlc3RTcGVjIGNvbnN0JiB0ZXN0U3BlYywgSUNvbmZpZyBjb25zdCYgY29uZmlnICkgeworICAgICAgICByZXR1cm4gdGVzdFNwZWMubWF0Y2hlcyggdGVzdENhc2UgKSAmJiAoIGNvbmZpZy5hbGxvd1Rocm93cygpIHx8ICF0ZXN0Q2FzZS50aHJvd3MoKSApOworICAgIH0KKworICAgIHZvaWQgZW5mb3JjZU5vRHVwbGljYXRlVGVzdENhc2VzKCBzdGQ6OnZlY3RvcjxUZXN0Q2FzZT4gY29uc3QmIGZ1bmN0aW9ucyApIHsKKyAgICAgICAgc3RkOjpzZXQ8VGVzdENhc2U+IHNlZW5GdW5jdGlvbnM7CisgICAgICAgIGZvciggc3RkOjp2ZWN0b3I8VGVzdENhc2U+Ojpjb25zdF9pdGV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AgICBzdGQ6OnN0cmluZyBuYW1lID0gdGVzdENhc2UuZ2V0VGVzdENhc2VJbmZvKCkubmFtZTsKKyAgICAgICAgICAgIGlmKCBuYW1lLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgICAgICAgICBvc3MgPDwgIkFub255bW91cyB0ZXN0IGNhc2UgIiA8PCArK21fdW5uYW1lZENvdW50OworICAgICAgICAgICAgICAgIHJldHVybiByZWdpc3RlclRlc3QoIHRlc3RDYXNlLndpdGhOYW1lKCBvc3Muc3RyKCkgKSApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbV9mdW5jdGlvbnMucHVzaF9iYWNrKCB0ZXN0Q2FzZSApOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCBzdGQ6OnZlY3RvcjxUZXN0Q2FzZT4gY29uc3QmIGdldEFsbFRlc3RzKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1fZnVuY3Rpb25zOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgc3RkOjp2ZWN0b3I8VGVzdENhc2U+IGNvbnN0JiBnZXRBbGxUZXN0c1NvcnRlZCggSUNvbmZpZyBjb25zdCYgY29uZmlnICkgY29uc3QgeworICAgICAgICAgICAgaWYoIG1fc29ydGVkRnVuY3Rpb25zLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgIGVuZm9yY2VOb0R1cGxpY2F0ZVRlc3RDYXNlcyggbV9mdW5jdGlvbnMgKTsKKworICAgICAgICAgICAgaWYoICBtX2N1cnJlbnRTb3J0T3JkZXIgIT0gY29uZmlnLnJ1bk9yZGVyKCkgfHwgbV9zb3J0ZWRGdW5jdGlvbnMuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICBtX3NvcnRlZEZ1bmN0aW9ucyA9IHNvcnRUZXN0cyggY29uZmlnLCBtX2Z1bmN0aW9ucyApOworICAgICAgICAgICAgICAgIG1fY3VycmVudFNvcnRPcmRlciA9IGNvbmZpZy5ydW5PcmRlcigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG1fc29ydGVkRnVuY3Rpb25zOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgICBzdGQ6OnZlY3RvcjxUZXN0Q2FzZT4gbV9mdW5jdGlvbnM7CisgICAgICAgIG11dGFibGUgUnVuVGVzdHM6OkluV2hhdE9yZGVyIG1fY3VycmVudFNvcnRPcmRlcjsKKyAgICAgICAgbXV0YWJsZSBzdGQ6OnZlY3RvcjxUZXN0Q2FzZT4gbV9zb3J0ZWRGdW5jdGlvbnM7CisgICAgICAgIHNpemVfdCBtX3VubmFtZWRDb3VudDsKKyAgICAgICAgc3RkOjppb3NfYmFzZTo6SW5pdCBtX29zdHJlYW1Jbml0OyAvLyBGb3JjZXMgY291dC8gY2VyciB0byBiZSBpbml0aWFsaXNlZAorICAgIH07CisKKyAgICAvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKworICAgIGNsYXNzIEZyZWVGdW5jdGlvblRlc3RDYXNlIDogcHVibGljIFNoYXJlZEltcGw8SVRlc3RDYXNlPiB7CisgICAgcHVibGljOgorCisgICAgICAgIEZyZWVGdW5jdGlvblRlc3RDYXNlKCBUZXN0RnVuY3Rpb24gZnVuICkgOiBtX2Z1biggZnVuICkge30KKworICAgICAgICB2aXJ0dWFsIHZvaWQgaW52b2tlKCkgY29uc3QgeworICAgICAgICAgICAgbV9mdW4oKTsKKyAgICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgICAgdmlydHVhbCB+RnJlZUZ1bmN0aW9uVGVzdENhc2UoKTsKKworICAgICAgICBUZXN0RnVuY3Rpb24gbV9mdW47CisgICAgfTsKKworICAgIGlubGluZSBzdGQ6OnN0cmluZyBleHRyYWN0Q2xhc3NOYW1lKCBzdGQ6OnN0cmluZyBjb25zdCYgY2xhc3NPclF1YWxpZmllZE1ldGhvZE5hbWUgKSB7CisgICAgICAgIHN0ZDo6c3RyaW5nIGNsYXNzTmFtZSA9IGNsYXNzT3JRdWFsaWZpZWRNZXRob2ROYW1lOworICAgICAgICBpZiggc3RhcnRzV2l0aCggY2xhc3NOYW1lLCAnJicgKSApCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGxhc3RDb2xvbnMgPSBjbGFzc05hbWUucmZpbmQoICI6OiIgKTsKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHBlbnVsdGltYXRlQ29sb25zID0gY2xhc3NOYW1lLnJmaW5kKCAiOjoiLCBsYXN0Q29sb25zLTEgKTsKKyAgICAgICAgICAgIGlmKCBwZW51bHRpbWF0ZUNvbG9ucyA9PSBzdGQ6OnN0cmluZzo6bnBvcyApCisgICAgICAgICAgICAgICAgcGVudWx0aW1hdGVDb2xvbnMgPSAxOworICAgICAgICAgICAgY2xhc3NOYW1lID0gY2xhc3NOYW1lLnN1YnN0ciggcGVudWx0aW1hdGVDb2xvbnMsIGxhc3RDb2xvbnMtcGVudWx0aW1hdGVDb2xvbnMgKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gY2xhc3NOYW1lOworICAgIH0KKworICAgIHZvaWQgcmVnaXN0ZXJUZXN0Q2FzZQorICAgICAgICAoICAgSVRlc3RDYXNlKiB0ZXN0Q2FzZSwKKyAgICAgICAgICAgIGNoYXIgY29uc3QqIGNsYXNzT3JRdWFsaWZpZWRNZXRob2ROYW1lLAorICAgICAgICAgICAgTmFtZUFuZERlc2MgY29uc3QmIG5hbWVBbmREZXNjLAorICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvICkgeworCisgICAgICAgIGdldE11dGFibGVSZWdpc3RyeUh1YigpLnJlZ2lzdGVyVGVzdAorICAgICAgICAgICAgKCBtYWtlVGVzdENhc2UKKyAgICAgICAgICAgICAgICAoICAgdGVzdENhc2UsCisgICAgICAgICAgICAgICAgICAgIGV4dHJhY3RDbGFzc05hbWUoIGNsYXNzT3JRdWFsaWZpZWRNZXRob2ROYW1lICksCisgICAgICAgICAgICAgICAgICAgIG5hbWVBbmREZXNjLm5hbWUsCisgICAgICAgICAgICAgICAgICAgIG5hbWVBbmREZXNjLmRlc2NyaXB0aW9uLAorICAgICAgICAgICAgICAgICAgICBsaW5lSW5mbyApICk7CisgICAgfQorICAgIHZvaWQgcmVnaXN0ZXJUZXN0Q2FzZUZ1bmN0aW9uCisgICAgICAgICggICBUZXN0RnVuY3Rpb24gZnVuY3Rpb24sCisgICAgICAgICAgICBTb3VyY2VMaW5lSW5mbyBjb25zdCYgbGluZUluZm8sCisgICAgICAgICAgICBOYW1lQW5kRGVzYyBjb25zdCYgbmFtZUFuZERlc2MgKSB7CisgICAgICAgIHJlZ2lzdGVyVGVzdENhc2UoIG5ldyBGcmVlRnVuY3Rpb25UZXN0Q2FzZSggZnVuY3Rpb24gKSwgIiIsIG5hbWVBbmREZXNjLCBsaW5lSW5mbyApOworICAgIH0KKworICAgIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCisgICAgQXV0b1JlZzo6QXV0b1JlZworICAgICAgICAoICAgVGVzdEZ1bmN0aW9uIGZ1bmN0aW9uLAorICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvLAorICAgICAgICAgICAgTmFtZUFuZERlc2MgY29uc3QmIG5hbWVBbmREZXNjICkgeworICAgICAgICByZWdpc3RlclRlc3RDYXNlRnVuY3Rpb24oIGZ1bmN0aW9uLCBsaW5lSW5mbywgbmFtZUFuZERlc2MgKTsKKyAgICB9CisKKyAgICBBdXRvUmVnOjp+QXV0b1JlZygpIHt9CisKK30gLy8gZW5kIG5hbWVzcGFjZSBDYXRjaAorCisvLyAjaW5j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gICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgdm9pZCByZWdpc3RlclRyYW5zbGF0b3IoIGNvbnN0IElFeGNlcHRpb25UcmFuc2xhdG9yKiB0cmFuc2xhdG9yICkgeworICAgICAgICAgICAgbV90cmFuc2xhdG9ycy5wdXNoX2JhY2soIHRyYW5zbGF0b3IgKTsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgc3RkOjpzdHJpbmcgdHJhbnNsYXRlQWN0aXZlRXhjZXB0aW9uKCkgY29uc3QgeworICAgICAgICAgICAgdHJ5IHsKKyNpZmRlZiBfX09CSkNfXworICAgICAgICAgICAgICAgIC8vIEluIE9iamVjdGl2ZS1DIHRyeSBvYmplY3RpdmUtYyBleGNlcHRpb25zIGZpcnN0CisgICAgICAgICAgICAgICAgQHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnlUcmFuc2xhdG9ycygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBAY2F0Y2ggKE5TRXhjZXB0aW9uICpleGNlcHRpb24pIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIENhdGNoOjp0b1N0cmluZyggW2V4Y2VwdGlvbiBkZXNjcmlwdGlvbl0gKTsKKyAgICAgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgICAgIHJldHVybiB0cnlUcmFuc2xhdG9ycygpOworI2VuZGlmCisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCggVGVzdEZhaWx1cmVFeGNlcHRpb24mICkgeworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goIHN0ZDo6ZXhjZXB0aW9uJiBleCApIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZXgud2hhdCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goIHN0ZDo6c3RyaW5nJiBtc2cgKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1zZzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoKCBjb25zdCBjaGFyKiBtc2cgKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1zZzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoKC4uLikgeworICAgICAgICAgICAgICAgIHJldHVybiAiVW5rbm93biBleGNlcHRpb24iOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3RkOjpzdHJpbmcgdHJ5VHJhbnNsYXRvcnMoKSBjb25zdCB7CisgICAgICAgICAgICBpZiggbV90cmFuc2xhdG9ycy5lbXB0eSgpICkKKyAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICByZXR1cm4gbV90cmFuc2xhdG9yc1swXS0+dHJhbnNsYXRlKCBtX3RyYW5zbGF0b3JzLmJlZ2luKCkrMSwgbV90cmFuc2xhdG9ycy5lbmQoKSApOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgICBzdGQ6OnZlY3Rvcjxjb25zdCBJRXhjZXB0aW9uVHJhbnNsYXRvcio+IG1fdHJhbnNsYXRvcnM7CisgICAgfTsKK30KKworLy8gI2luY2x1ZGVkIGZyb206IGNhdGNoX3RhZ19hbGlhc19yZWdpc3RyeS5oCisjZGVmaW5lIFRXT0JMVUVDVUJFU19DQVRDSF9UQUdfQUxJQVNfUkVHSVNUUllfSF9JTkNMVURFRAorCisjaW5jbHVkZSA8bWFwPgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgY2xhc3MgVGFnQWxpYXNSZWdpc3RyeSA6IHB1YmxpYyBJVGFnQWxpYXNSZWdpc3RyeSB7CisgICAgcHVibGljOgorICAgICAgICB2aXJ0dWFsIH5UYWdBbGlhc1JlZ2lzdHJ5KCk7CisgICAgICAgIHZpcnR1YWwgT3B0aW9uPFRhZ0FsaWFzPiBmaW5kKCBzdGQ6OnN0cmluZyBjb25zdCYgYWxpYXMgKSBj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isKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBXcml0ZXJGLCBzaXplX3QgYnVmZmVyU2l6ZT0yNTY+CisgICAgY2xhc3MgU3RyZWFtQnVmSW1wbCA6IHB1YmxpYyBTdHJlYW1CdWZCYXNlIHsKKyAgICAgICAgY2hhciBkYXRhW2J1ZmZlclNpemVdOworICAgICAgICBXcml0ZXJGIG1fd3JpdGVyOworCisgICAgcHVibGljOgorICAgICAgICBTdHJlYW1CdWZJbXBsKCkgeworICAgICAgICAgICAgc2V0cCggZGF0YSwgZGF0YSArIHNpemVvZihkYXRhKSApOworICAgICAgICB9CisKKyAgICAgICAgflN0cmVhbUJ1ZkltcGwoKSBDQVRDSF9OT0VYQ0VQVCB7CisgICAgICAgICAgICBzeW5jKCk7CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICAgIGludCBvdmVyZmxvdyggaW50IGMgKSB7CisgICAgICAgICAgICBzeW5jKCk7CisKKyAgICAgICAgICAgIGlmKCBjICE9IEVPRiApIHsKKyAgICAgICAgICAgICAgICBpZiggcGJhc2UoKSA9PSBlcHB0cigpICkKKyAgICAgICAgICAgICAgICAgICAgbV93cml0ZXIoIHN0ZDo6c3RyaW5nKCAxLCBzdGF0aWNfY2FzdDxjaGFyPiggYyApICkgKTsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHNwdXRjKCBzdGF0aWNfY2FzdDxjaGFyPiggYyApICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIGludCBzeW5jKCkgeworICAgICAgICAgICAgaWYoIHBiYXNlKCkgIT0gcHB0cigpICkgeworICAgICAgICAgICAgICAgIG1fd3JpdGVyKCBzdGQ6OnN0cmluZyggcGJhc2UoKSwgc3RhdGljX2Nhc3Q8c3RkOjpzdHJpbmc6OnNpemVfdHlwZT4oIHBwdHIoKSAtIHBiYXNlKCkgKSApICk7CisgICAgICAgICAgICAg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k7CisKKyAgICBwdWJsaWM6CisgICAgICAgIHZpcnR1YWwgfkNvbnRleHQoKSB7CisgICAgICAgICAgICBkZWxldGVBbGxWYWx1ZXMoIG1fZ2VuZXJhdG9yc0J5VGVzdE5hbWUgKTsKKyAgICAgICAgfQorCisgICAgcHVibGljOiAvLyBJQ29udGV4dAorICAgICAgICB2aXJ0dWFsIElSZXN1bHRDYXB0dXJlKiBnZXRSZXN1bHRDYXB0dXJlKCkgeworICAgICAgICAgICAgcmV0dXJuIG1fcmVzdWx0Q2FwdHVyZTsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIElSdW5uZXIqIGdldFJ1bm5lcigpIHsKKyAgICAgICAgICAgIHJldHVybiBtX3J1bm5lcjsKKyAgICAgICAgfQorICAgICAgICB2aXJ0dWFsIHNpemVfdCBnZXRHZW5lcmF0b3JJbmRleCggc3RkOjpzdHJpbmcgY29uc3QmIGZpbGVJbmZvLCBzaXplX3QgdG90YWxTaXplICkgeworICAgICAgICAgICAgcmV0dXJuIGdldEdlbmVyYXRvcnNGb3JDdXJyZW50VGVzdCgpCisgICAgICAgICAgICAuZ2V0R2VuZXJhdG9ySW5mbyggZmlsZUluZm8sIHRvdGFsU2l6ZSApCisgICAgICAgICAgICAuZ2V0Q3VycmVudEluZGV4KCk7CisgICAgICAgIH0KKyAgICAgICAgdmlydHVhbCBib29sIGFkdmFuY2VHZW5lcmF0b3JzRm9yQ3VycmVudFRlc3QoKSB7CisgICAgICAgICAgICBJR2VuZXJhdG9yc0ZvclRlc3QqIGdlbmVyYXRvcnMgPSBmaW5kR2VuZXJhdG9yc0ZvckN1cnJlbnRUZXN0KCk7CisgICAgICAgICAgICByZXR1cm4gZ2VuZXJhdG9ycyAmJiBnZW5lcmF0b3JzLT5tb3ZlTmV4dCgpOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCBQdHI8SUNvbmZpZyBjb25zdD4gZ2V0Q29uZmlnKCkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIG1fY29uZmlnOworICAgICAgICB9CisKKyAgICBwdWJsaWM6IC8vIElNdXRhYmxlQ29udGV4dAorICAgICAgICB2aXJ0dWFsIHZvaWQgc2V0UmVzdWx0Q2FwdHVyZSggSVJlc3VsdENhcHR1cmUqIHJlc3VsdENhcHR1cmUgKSB7CisgICAgICAgICAgICBtX3Jlc3VsdENhcHR1cmUgPSByZXN1bHRDYXB0dXJlOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgdm9pZCBzZXRSdW5uZXIoIElSdW5uZXIqIHJ1bm5lciApIHsKKyAgICAgICAgICAgIG1fcnVubmVyID0gcnVubmVyOworICAgICAgICB9CisgICAgICAgIHZpcnR1YWwgdm9pZCBzZXRDb25maWcoIFB0cjxJQ29uZmlnIGNvbnN0PiBjb25zdCYgY29uZmlnICkgeworICAgICAgICAgICAgbV9jb25maWcgPSBjb25maWc7CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgSU11dGFibGVDb250ZXh0JiBnZXRDdXJyZW50TXV0YWJsZUNvbnRleHQoKTsKKworICAgIHByaXZhdGU6CisgICAgICAgIElHZW5lcmF0b3JzRm9yVGVzdCogZmluZEdlbmVyYXRvcnNGb3JDdXJyZW50VGVzdCgpIHsKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHRlc3ROYW1lID0gZ2V0UmVzdWx0Q2FwdHVyZSgpLT5nZXRDdXJyZW50VGVzdE5hbWUoKTsKKworICAgICAgICAgICAgc3RkOjptYXA8c3RkOjpzdHJpbmcsIElHZW5lcmF0b3JzRm9yVGVzdCo+Ojpjb25zdF9pdGVyYXRvciBpdCA9CisgICAgICAgICAgICAgICAgbV9nZW5lcmF0b3JzQnlUZXN0TmFtZS5maW5kKCB0ZXN0TmFtZSApOworICAgICAgICAgICAgcmV0dXJuIGl0ICE9IG1fZ2VuZXJhdG9yc0J5VGVzdE5hbWUuZW5kKCkKKyAgICAgICAgICAgICAgICA/IGl0LT5zZWNvbmQKKyAgICAgICAgICAgICAgICA6IEN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ZXh0ICkKKyAgICAgICAgICAgIGN1cnJlbnRDb250ZXh0ID0gbmV3IENvbnRleHQoKTsKKyAgICAgICAgcmV0dXJuICpjdXJyZW50Q29udGV4dDsKKyAgICB9CisgICAgSUNvbnRleHQmIGdldEN1cnJlbnRDb250ZXh0KCkgeworICAgICAgICByZXR1cm4gZ2V0Q3VycmVudE11dGFibGVDb250ZXh0KCk7CisgICAgfQorCisgICAgdm9pZCBjbGVhblVwQ29udGV4dCgpIHsKKyAgICAgICAgZGVsZXRlIGN1cnJlbnRDb250ZXh0OworICAgICAgICBjdXJyZW50Q29udGV4dCA9IENBVENIX05VTEw7CisgICAgfQorfQorCisvLyAjaW5jbHVkZWQgZnJvbTogY2F0Y2hfY29uc29sZV9jb2xvdXJfaW1wbC5ocHAKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX0NPTlNPTEVfQ09MT1VSX0lNUExfSFBQX0lOQ0xVREVECisKKy8vICNpbmNsdWRlZCBmcm9tOiBjYXRjaF9lcnJub19ndWFyZC5ocHAKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX0VSUk5PX0dVQVJEX0hQUF9JTkNMVURFRAorCisjaW5jbHVkZSA8Y2Vycm5vPgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgY2xhc3MgRXJybm9HdWFyZCB7CisgICAgcHVibGljOgorICAgICAgICBFcnJub0d1YXJkKCk6bV9vbGRFcnJubyhlcnJubyl7fQorICAgICAgICB+RXJybm9HdWFyZCgpIHsgZXJybm8gPSBtX29sZEVycm5vOyB9CisgICAgcHJpdmF0ZToKKyAgICAgICAgaW50IG1fb2xkRXJybm87CisgICAgfTsKKworfQorCituYW1lc3BhY2UgQ2F0Y2ggeworICAgIG5hbWVzcGFjZSB7CisKKyAgICAgICAgc3RydWN0IElDb2xvdXJJbXBsIHsKKyAgICAgICAgICAgIHZpcnR1YWwgfklDb2xvdXJJbXBsKCkge30KKyAgICAgICAgICAgIHZpcnR1YWwgdm9pZCB1c2UoIENvbG91cjo6Q29kZSBfY29sb3VyQ29kZSApID0gMDsKKyAgICAgICAgfTsKKworICAgICAgICBzdHJ1Y3QgTm9Db2xvdXJJbXBsIDogSUNvbG91ckltcGwgeworICAgICAgICAgICAgdm9pZCB1c2UoIENvbG91cjo6Q29kZSApIHt9CisKKyAgICAgICAgICAgIHN0YXRpYyBJQ29sb3VySW1wbCogaW5zdGFuY2UoKSB7CisgICAgICAgICAgICAgICAgc3RhdGljIE5vQ29sb3VySW1wbCBzX2luc3RhbmNlOworICAgICAgICAgICAgICAgIHJldHVybiAmc19pbnN0YW5jZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworICAgIH0gLy8gYW5vbiBuYW1lc3BhY2UKK30gLy8gbmFtZXNwYWNlIENhdGNoCisKKyNpZiAhZGVmaW5lZCggQ0FUQ0hfQ09ORklHX0NPTE9VUl9OT05FICkgJiYgIWRlZmluZWQoIENBVENIX0NPTkZJR19DT0xPVVJfV0lORE9XUyApICYmICFkZWZpbmVkKCBDQVRDSF9DT05GSUdfQ09MT1VSX0FOU0kgKQorIyAgIGlmZGVmIENBVENIX1BMQVRGT1JNX1dJTkRPV1MKKyMgICAgICAgZGVmaW5lIENBVENIX0NPTkZJR19DT0xPVVJfV0lORE9XUworIyAgIGVsc2UKKyMgICAgICAgZGVmaW5lIENBVENIX0NPTkZJR19DT0xPVVJfQU5TSQorIyAgIGVuZGlmCisjZW5kaWYKKworI2lmIGRlZmluZWQgKCBDQVRDSF9DT05GSUdfQ09MT1VSX1dJTkRPV1MgKSAvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCituYW1lc3BhY2UgQ2F0Y2ggeworbmFtZXNwYWNlIHsKKworICAgIGNsYXNzIFdpbjMyQ29sb3VySW1wbCA6IHB1YmxpYyBJQ29sb3VySW1wbCB7CisgICAgcHVibGljOgorICAgICAgICBXaW4zMkNvbG91ckltcGwoKSA6IHN0ZG91dEhhbmR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mlnaHRXaGl0ZTogICByZXR1cm4gc2V0VGV4dEF0dHJpYnV0ZSggRk9SRUdST1VORF9JTlRFTlNJVFkgfCBGT1JFR1JPVU5EX0dSRUVOIHwgRk9SRUdST1VORF9SRUQgfCBGT1JFR1JPVU5EX0JMVUUgKTsKKworICAgICAgICAgICAgICAgIGNhc2UgQ29sb3VyOjpCcmlnaHQ6IHRocm93IHN0ZDo6bG9naWNfZXJyb3IoICJub3QgYSBjb2xvdXIiICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICAgIHZvaWQgc2V0VGV4dEF0dHJpYnV0ZSggV09SRCBfdGV4dEF0dHJpYnV0ZSApIHsKKyAgICAgICAgICAgIFNldENvbnNvbGVUZXh0QXR0cmlidXRlKCBzdGRvdXRIYW5kbGUsIF90ZXh0QXR0cmlidXRlIHwgb3JpZ2luYWxCYWNrZ3JvdW5kQXR0cmlidXRlcyApOworICAgICAgICB9CisgICAgICAgIEhBTkRMRSBzdGRvdXRIYW5kbGU7CisgICAgICAgIFdPUkQgb3JpZ2luYWxGb3JlZ3JvdW5kQXR0cmlidXRlczsKKyAgICAgICAgV09SRCBvcmlnaW5hbEJhY2tncm91bmRBdHRyaWJ1dGVzOworICAgIH07CisKKyAgICBJQ29sb3VySW1wbCogcGxhdGZvcm1Db2xvdXJJbnN0YW5jZSgpIHsKKyAgICAgICAgc3RhdGljIFdpbjMyQ29sb3VySW1wbCBzX2luc3RhbmNlOworCisgICAgICAgIFB0cjxJQ29uZmlnIGNvbnN0PiBjb25maWcgPSBnZXRDdXJyZW50Q29udGV4dCgpLmdldENvbmZpZygpOworICAgICAgICBVc2VDb2xvdXI6Olllc09yTm8gY29sb3VyTW9kZSA9IGNvbmZpZworICAgICAgICAgICAgPyBjb25maWctPnVzZUNvbG91cigpCisgICAgICAgICAgICA6IFVzZUNvbG91cjo6QXV0bzsKKyAgICAgICAgaWYoIGNvbG91ck1vZGUgPT0gVXNlQ29sb3VyOjp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BjYXNlIENvbG91cjo6V2hpdGU6ICAgICByZXR1cm4gc2V0Q29sb3VyKCAiWzBtIiApOworICAgICAgICAgICAgICAgIGNhc2UgQ29sb3VyOjpSZWQ6ICAgICAgIHJldHVybiBzZXRDb2xvdXIoICJbMDszMW0iICk7CisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OkdyZWVuOiAgICAgcmV0dXJuIHNldENvbG91ciggIlswOzMybSIgKTsKKyAgICAgICAgICAgICAgICBjYXNlIENvbG91cjo6Qmx1ZTogICAgICByZXR1cm4gc2V0Q29sb3VyKCAiWzA7MzRtIiApOworICAgICAgICAgICAgICAgIGNhc2UgQ29sb3VyOjpDeWFuOiAgICAgIHJldHVybiBzZXRDb2xvdXIoICJbMDszNm0iICk7CisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OlllbGxvdzogICAgcmV0dXJuIHNldENvbG91ciggIlswOzMzbSIgKTsKKyAgICAgICAgICAgICAgICBjYXNlIENvbG91cjo6R3JleTogICAgICByZXR1cm4gc2V0Q29sb3VyKCAiWzE7MzBtIiApOworCisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OkxpZ2h0R3JleTogICAgIHJldHVybiBzZXRDb2xvdXIoICJbMDszN20iICk7CisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OkJyaWdodFJlZDogICAgIHJldHVybiBzZXRDb2xvdXIoICJbMTszMW0iICk7CisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OkJyaWdodEdyZWVuOiAgIHJldHVybiBzZXRDb2xvdXIoICJbMTszMm0iICk7CisgICAgICAgICAgICAgICAgY2FzZSBDb2xvdXI6OkJyaWdodFdoaXRlOiAgIHJldHVybiBzZXRDb2xvdXIoICJbMTszN20iICk7CisKKyAgICAgICAgICAgICAgICBjYXNlIENvbG91cjo6QnJpZ2h0OiB0aHJvdyBzdGQ6OmxvZ2ljX2Vycm9yKCAibm90IGEgY29sb3VyIiApOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHN0YXRpYyBJQ29sb3VySW1wbCogaW5zdGFuY2UoKSB7CisgICAgICAgICAgICBzdGF0aWMgUG9zaXhDb2xvdXJJbXBsIHNfaW5zdGFuY2U7CisgICAgICAgICAgICByZXR1cm4gJnNfaW5zdGFuY2U7CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICAgIHZvaWQgc2V0Q29sb3VyKCBjb25zdCBjaGFyKiBfZXNjYXBlQ29kZSApIHsKKyAgICAgICAgICAgIENhdGNoOjpjb3V0KCkgPDwgJ1wwMzMnIDw8IF9lc2NhcGVDb2RlOworICAgICAgICB9CisgICAgfTsKKworICAgIElDb2xvdXJJbXBsKiBwbGF0Zm9ybUNvbG91ckluc3RhbmNlKCkgeworICAgICAgICBFcnJub0d1YXJkIGd1YXJkOworICAgICAgICBQdHI8SUNvbmZpZyBjb25zdD4gY29uZmlnID0gZ2V0Q3VycmVudENvbnRleHQoKS5nZXRDb25maWcoKTsKKyAgICAgICAgVXNlQ29sb3VyOjpZZXNPck5vIGNvbG91ck1vZGUgPSBjb25maWcKKyAgICAgICAgICAgID8gY29uZmlnLT51c2VDb2xvdXIoKQorICAgICAgICAgICAgOiBVc2VDb2xvdXI6OkF1dG87CisgICAgICAgIGlmKCBjb2xvdXJNb2RlID09IFVzZUNvbG91cjo6QXV0byApCisgICAgICAgICAgICBjb2xvdXJNb2RlID0gKCFpc0RlYnVnZ2VyQWN0aXZlKCkgJiYgaXNhdHR5KFNURE9VVF9GSUxFTk8pICkKKyAgICAgICAgICAgICAgICA/IFVzZUNvbG91cjo6WWVzCisgICAgICAgICAgICAgICAgOiBVc2VDb2xvdXI6Ok5vOworICAgICAgICByZXR1cm4gY29sb3VyTW9kZSA9PSBVc2VDb2xvdXI6OlllcworICAgICAgICAgICAgPyBQb3NpeENvbG91ckltcGw6Omluc3RhbmNlKCkKKyAgICAgICAgICAgIDogTm9Db2xvdXJJbXBsOjppbnN0YW5jZSgpOworICAgIH0KKworfSAvL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X0NBVENIX0dFTkVSQVRPUlNfSU1QTF9IUFBfSU5DTFVERUQKKworI2luY2x1ZGUgPHZlY3Rvcj4KKyNpbmNsdWRlIDxzdHJpbmc+CisjaW5jbHVkZSA8bWFwPgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgc3RydWN0IEdlbmVyYXRvckluZm8gOiBJR2VuZXJhdG9ySW5mbyB7CisKKyAgICAgICAgR2VuZXJhdG9ySW5mbyggc3RkOjpzaXplX3Qgc2l6ZSApCisgICAgICAgIDogICBtX3NpemUoIHNpemUgKSwKKyAgICAgICAgICAgIG1fY3VycmVudEluZGV4KCAwICkKKyAgICAgICAge30KKworICAgICAgICBib29sIG1vdmVOZXh0KCkgeworICAgICAgICAgICAgaWYoICsrbV9jdXJyZW50SW5kZXggPT0gbV9zaXplICkgeworICAgICAgICAgICAgICAgIG1fY3VycmVudEluZGV4ID0gMDsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHN0ZDo6c2l6ZV90IGdldEN1cnJlbnRJbmRleCgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtX2N1cnJlbnRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHN0ZDo6c2l6ZV90IG1fc2l6ZTsKKyAgICAgICAgc3RkOjpzaXplX3QgbV9jdXJyZW50SW5kZXg7CisgICAgfTsKKworICAgIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCisgICAgY2xhc3MgR2VuZXJhdG9yc0ZvclRlc3QgOiBwdWJsaWMgSUdlbmVyYXRvcnNGb3JUZXN0IHsKKworICAgIHB1YmxpYzoKKyAgICAgICAgfkdlbmVyYXRvcnNGb3JUZXN0KCkgeworICAgICAgICAgICAgZGVsZXRlQWxsKCBtX2dlbmVyYXRvcnNJbk9yZGVyICk7CisgICAgICAgIH0KKworICAgICAgICBJR2VuZXJhdG9ySW5mbyYgZ2V0R2VuZXJhdG9ySW5mbyggc3RkOjpzdHJpbmcgY29uc3QmIGZpbGVJbmZvLCBzdGQ6OnNpemVfdCBzaXplICkgeworICAgICAgICAgICAgc3RkOjptYXA8c3RkOjpzdHJpbmcsIElHZW5lcmF0b3JJbmZvKj46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gbV9nZW5lcmF0b3JzQnlOYW1lLmZpbmQoIGZpbGVJbmZvICk7CisgICAgICAgICAgICBpZiggaXQgPT0gbV9nZW5lcmF0b3JzQnlOYW1lLmVuZCgpICkgeworICAgICAgICAgICAgICAgIElHZW5lcmF0b3JJbmZvKiBpbmZvID0gbmV3IEdlbmVyYXRvckluZm8oIHNpemUgKTsKKyAgICAgICAgICAgICAgICBtX2dlbmVyYXRvcnNCeU5hbWUuaW5zZXJ0KCBzdGQ6Om1ha2VfcGFpciggZmlsZUluZm8sIGluZm8gKSApOworICAgICAgICAgICAgICAgIG1fZ2VuZXJhdG9yc0luT3JkZXIucHVzaF9iYWNrKCBpbmZvICk7CisgICAgICAgICAgICAgICAgcmV0dXJuICppbmZvOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuICppdC0+c2Vjb25kOworICAgICAgICB9CisKKyAgICAgICAgYm9vbCBtb3ZlTmV4dCgpIHsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPElHZW5lcmF0b3JJbmZvKj46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gbV9nZW5lcmF0b3JzSW5PcmRlci5iZWdpbigpOworICAgICAgICAgICAgc3RkOjp2ZWN0b3I8SUdlbmVyYXRvckluZm8qPjo6Y29uc3RfaXRlcmF0b3IgaXRFbmQgPSBtX2dlbmVyYXRvcnNJbk9yZGVyLmVuZCgpOworICAgICAgICAgICAgZm9yKDsgaXQgIT0gaXRFbmQ7ICsraXQgKSB7C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gpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIG1fcmVzdWx0RGF0YS5yZXN1bHRUeXBlOworICAgIH0KKworICAgIGJvb2wgQXNzZXJ0aW9uUmVzdWx0OjpoYXNFeHByZXNzaW9uKCkgY29uc3QgeworICAgICAgICByZXR1cm4gIW1faW5mby5jYXB0dXJlZEV4cHJlc3Npb24uZW1wdHkoKTsKKyAgICB9CisKKyAgICBib29sIEFzc2VydGlvblJlc3VsdDo6aGFzTWVzc2FnZSgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuICFtX3Jlc3VsdERhdGEubWVzc2FnZS5lbXB0eSgpOworICAgIH0KKworICAgIHN0ZDo6c3RyaW5nIEFzc2VydGlvblJlc3VsdDo6Z2V0RXhwcmVzc2lvbigpIGNvbnN0IHsKKyAgICAgICAgaWYoIGlzRmFsc2VUZXN0KCBtX2luZm8ucmVzdWx0RGlzcG9zaXRpb24gKSApCisgICAgICAgICAgICByZXR1cm4gJyEnICsgbV9pbmZvLmNhcHR1cmVkRXhwcmVzc2lvbjsKKyAgICAgICAgZWxzZQorICAgICAgICAgICAgcmV0dXJuIG1faW5mby5jYXB0dXJlZEV4cHJlc3Npb247CisgICAgfQorICAgIHN0ZDo6c3RyaW5nIEFzc2VydGlvblJlc3VsdDo6Z2V0RXhwcmVzc2lvbkluTWFjcm8oKSBjb25zdCB7CisgICAgICAgIGlmKCBtX2luZm8ubWFjcm9OYW1lLmVtcHR5KCkgKQorICAgICAgICAgICAgcmV0dXJuIG1faW5mby5jYXB0dXJlZEV4cHJlc3Npb247CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHJldHVybiBtX2luZm8ubWFjcm9OYW1lICsgIiggIiArIG1faW5mby5jYXB0dXJlZEV4cHJlc3Npb24gKyAiICkiOworICAgIH0KKworICAgIGJvb2wgQXNzZXJ0aW9uUmVzdWx0OjpoYXNFeHBhbmRlZEV4cHJlc3Npb24oKSBjb25zdCB7CisgICAgICAgIHJldHVybiBoYXNFeHByZ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PQkxVRUNVQkVTX0NBVENIX1RFU1RfQ0FTRV9JTkZPX0hQUF9JTkNMVURFRAorCisjaW5jbHVkZSA8Y2N0eXBlPgorCituYW1lc3BhY2UgQ2F0Y2ggeworCisgICAgaW5saW5lIFRlc3RDYXNlSW5mbzo6U3BlY2lhbFByb3BlcnRpZXMgcGFyc2VTcGVjaWFsVGFnKCBzdGQ6OnN0cmluZyBjb25zdCYgdGFnICkgeworICAgICAgICBpZiggc3RhcnRzV2l0aCggdGFnLCAnLicgKSB8fAorICAgICAgICAgICAgdGFnID09ICJoaWRlIiB8fAorICAgICAgICAgICAgdGFnID09ICIhaGlkZSIgKQorICAgICAgICAgICAgcmV0dXJuIFRlc3RDYXNlSW5mbzo6SXNIaWRkZW47CisgICAgICAgIGVsc2UgaWYoIHRhZyA9PSAiIXRocm93cyIgKQorICAgICAgICAgICAgcmV0dXJuIFRlc3RDYXNlSW5mbzo6VGhyb3dzOworICAgICAgICBlbHNlIGlmKCB0YWcgPT0gIiFzaG91bGRmYWlsIiApCisgICAgICAgICAgICByZXR1cm4gVGVzdENhc2VJbmZvOjpTaG91bGRGYWlsOworICAgICAgICBlbHNlIGlmKCB0YWcgPT0gIiFtYXlmYWlsIiApCisgICAgICAgICAgICByZXR1cm4gVGVzdENhc2VJbmZvOjpNYXlGYWlsOworICAgICAgICBlbHNlIGlmKCB0YWcgPT0gIiFub25wb3J0YWJsZSIgKQorICAgICAgICAgICAgcmV0dXJuIFRlc3RDYXNlSW5mbzo6Tm9uUG9ydGFibGU7CisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHJldHVybiBUZXN0Q2FzZUluZm86Ok5vbmU7CisgICAgfQorICAgIGlubGluZSBib29sIGlzUmVzZXJ2ZWRUYWcoIHN0ZDo6c3RyaW5nIGNvbnN0JiB0YWcgKSB7CisgICAgICAgIHJldHVybiBwYXJzZVNwZWNpYWxUYWcoIHRhZyApID09IFRlc3RDYXNlSW5mbzo6Tm9uZSAmJiB0YWcuc2l6ZSgpID4gMCAmJiAhc3RkOjppc2FsbnVtKCB0YWdbMF0gKTsKKyAgICB9CisgICAgaW5saW5lIHZvaWQgZW5mb3JjZU5vdFJlc2VydmVkVGFnKCBzdGQ6OnN0cmluZyBjb25zdCYgdGFnLCBTb3VyY2VMaW5lSW5mbyBjb25zdCYgX2xpbmVJbmZvICkgeworICAgICAgICBpZiggaXNSZXNlcnZlZFRhZyggdGFnICkgKSB7CisgICAgICAgICAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gc3M7CisgICAgICAgICAgICBzcyA8PCBDb2xvdXIoQ29sb3VyOjpSZWQpCisgICAgICAgICAgICAgICA8PCAiVGFnIG5hbWUgWyIgPDwgdGFnIDw8ICJdIG5vdCBhbGxvd2VkLlxuIgorICAgICAgICAgICAgICAgPDwgIlRhZyBuYW1lcyBzdGFydGluZyB3aXRoIG5vbiBhbHBoYS1udW1lcmljIGNoYXJhY3RlcnMgYXJlIHJlc2VydmVkXG4iCisgICAgICAgICAgICAgICA8PCBDb2xvdXIoQ29sb3VyOjpGaWxlTmFtZSkKKyAgICAgICAgICAgICAgIDw8IF9saW5lSW5mbyA8PCAnXG4nOworICAgICAgICAgICAgdGhyb3cgc3RkOjpydW50aW1lX2Vycm9yKHNzLnN0cigpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIFRlc3RDYXNlIG1ha2VUZXN0Q2FzZSggIElUZXN0Q2FzZSogX3Rlc3RDYXNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfY2xhc3NOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgX2Rlc2NPclRhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIF9saW5lSW5mbyApCisgICAgeworICAgICAgICBib29sIGlzSGlkZGVuKCBzdGFydHNXaXRoKCBfbmFtZSwgIi4vIiApICk7IC8vIExlZ2FjeSBzdXBwb3J0CisKKyAgICAgICAgLy8gUGFyc2Ugb3V0IHRhZ3MKKyAgICAgICAgc3RkOjpzZXQ8c3RkOjpzdHJpbmc+IHRhZ3M7CisgICAgICAgIHN0ZDo6c3RyaW5nIGRlc2MsIHRhZzsKKyAgICAgICAgYm9vbCBpblRhZyA9IGZhbHNlOworICAgICAgICBmb3IoIHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgX2Rlc2NPclRhZ3Muc2l6ZSgpOyArK2kgKSB7CisgICAgICAgICAgICBjaGFyIGMgPSBfZGVzY09yVGFnc1tpXTsKKyAgICAgICAgICAgIGlmKCAhaW5UYWcgKSB7CisgICAgICAgICAgICAgICAgaWYoIGMgPT0gJ1snICkKKyAgICAgICAgICAgICAgICAgICAgaW5UYWcgPSB0cnVlOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgZGVzYyArPSBjOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgaWYoIGMgPT0gJ10nICkgeworICAgICAgICAgICAgICAgICAgICBUZXN0Q2FzZUluZm86OlNwZWNpYWxQcm9wZXJ0aWVzIHByb3AgPSBwYXJzZVNwZWNpYWxUYWcoIHRhZyApOworICAgICAgICAgICAgICAgICAgICBpZiggcHJvcCA9PSBUZXN0Q2FzZUluZm86OklzSGlkZGVuICkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlzSGlkZGVuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiggcHJvcCA9PSBUZXN0Q2FzZUluZm86Ok5vbmUgKQorICAgICAgICAgICAgICAgICAgICAgICAgZW5mb3JjZU5vdFJlc2VydmVkVGFnKCB0YWcsIF9saW5lSW5mbyApOworCisgICAgICAgICAgICAgICAgICAgIHRhZ3MuaW5zZXJ0KCB0YWcgKTsKKyAgICAgICAgICAgICAgICAgICAgdGFnLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIGluVGFnID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgdGFnICs9IGM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYoIGlzSGlkZGVuICkgeworICAgICAgICAgICAgdGFncy5pbnNlcnQoICJoaWRlIiApOworICAgICAgICAgICAgdGFncy5pbnNlcnQoICIuIiApOworICAgICAgICB9CisKKyAgICAgICAgVGVzdENhc2VJbmZvIGluZm8oIF9uYW1lLCBfY2xhc3NOYW1lLCBkZXNjLCB0YWdzLCBfbGluZUluZm8gKTsKKyAgICAgICAgcmV0dXJuIFRlc3RDYXNlKCBfdGVzdENhc2UsIGluZm8gKTsKKyAgICB9CisKKyAgICB2b2lkIHNldFRhZ3MoIFRlc3RDYXNlSW5mbyYgdGVzdENhc2VJbmZvLCBzdGQ6OnNldDxzdGQ6OnN0cmluZz4gY29uc3QmIHRhZ3MgKQorICAgIHsKKyAgICAgICAgdGVzdENhc2VJbmZvLnRhZ3MgPSB0YWdzOworICAgICAgICB0ZXN0Q2FzZUluZm8ubGNhc2VUYWdzLmNsZWFyKCk7CisKKyAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIG9zczsKKyAgICAgICAgZm9yKCBzdGQ6OnNldDxzdGQ6OnN0cmluZz46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gdGFncy5iZWdpbigpLCBpdEVuZCA9IHRhZ3MuZW5kKCk7IGl0ICE9IGl0RW5kOyArK2l0ICkgeworICAgICAgICAgICAgb3NzIDw8ICdbJyA8PCAqaXQgPDwgJ10nOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbGNhc2VUYWcgPSB0b0xvd2VyKCAqaXQgKTsKKyAgICAgICAgICAgIHRlc3RDYXNlSW5mby5wcm9wZXJ0aWVzID0gc3RhdGljX2Nhc3Q8VGVzdENhc2VJbmZvOjpTcGVjaWFsUHJvcGVydGllcz4oIHRlc3RDYXNlSW5mby5wcm9wZXJ0aWVzIHwgcGFyc2VTcGVjaWFsVGFnKCBsY2FzZVRhZyApICk7CisgICAgICAgICAgICB0ZXN0Q2FzZUluZm8ubGNhc2VUYWdzLmluc2VydCggbGNhc2VUYWcgKTsKKyAgICAgICAgfQorICAgICAgICB0ZXN0Q2FzZUluZm8udGFnc0FzU3RyaW5nID0gb3NzLnN0cigpOworICAgIH0KKworICAgIFRlc3RDYXNlSW5mbzo6VGVzdENhc2VJbmZvKCBzdGQ6OnN0cmluZyBjb25zdCYgX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfY2xhc3NOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgX2Rlc2NyaXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnNldDxzdGQ6OnN0cmluZz4gY29uc3QmIF90YWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTb3VyY2VMaW5lSW5mbyBjb25zdCYgX2xpbmVJbmZvICkKKyAgICA6ICAgbmFtZSggX25hbWUgKSwKKyAgICAgICAgY2xhc3NOYW1lKCBfY2xhc3NOYW1lICksCisgICAgICAgIGRlc2NyaXB0aW9uKCBfZGVzY3JpcHRpb24gKSwKKyAgICAgICAgbGluZUluZm8oIF9saW5lSW5mbyApLAorICAgICAgICBwcm9wZXJ0aWVzKCBOb25lICkKKyAgICB7CisgICAgICAgIHNldFRhZ3MoICp0aGlzLCBfdGFncyApOworICAgIH0KKworICAgIFRlc3RDYXNlSW5mbzo6VGVzdENhc2VJbmZvKCBUZXN0Q2FzZUluZm8gY29uc3QmIG90aGVyICkKKyAgICA6ICAgbmFtZSggb3RoZXIubmFtZSApLAorICAgICAgICBjbGFzc05hbWUoIG90aGVyLmNsYXNzTmFtZSApLAorICAgICAgICBkZXNjcmlwdGlvbiggb3RoZXIuZGVzY3JpcHRpb24gKSwKKyAgICAgICAgdGFncyggb3RoZXIudGFncyApLAorICAgICAgICBsY2FzZVRhZ3MoIG90aGVyLmxjYXNlVGFncyApLAorICAgICAgICB0YWdzQXNTdHJpbmcoIG90aGVyLnRhZ3NBc1N0cmluZyApLAorICAgICAgICBsaW5lSW5mbyggb3RoZXIubGluZUluZm8gKSwKKyAgICAgICAgcHJvcGVydGllcyggb3RoZXIucHJvcGVydGllcyApCisgICAge30KKworICAgIGJvb2wgVGVzdENhc2VJbmZvOjppc0hpZGRlbigpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuICggcHJvcGVydGllcyAmIElzSGlkZGVuICkgIT0gMDsKKyAgICB9CisgICAgYm9vbCBUZXN0Q2FzZUluZm86OnRocm93cygpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuICggcHJvcGVydGllcyAmIFRocm93cyApICE9IDA7CisgICAgfQorICAgIGJvb2wgVGVzdENhc2VJbmZvOjpva1RvRmFpbCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuICggcHJvcGVydGllcyAmIChTaG91bGRGYWlsIHwgTWF5RmFpbCApICkgIT0gMDsKKyAgICB9CisgICAgYm9vbCBUZXN0Q2FzZUluZm86OmV4cGVjdGVkVG9GYWlsKCkgY29uc3QgeworICAgICAgICByZXR1cm4gKCBwcm9wZXJ0aWVzICYgKFNob3VsZEZhaWwgKSApICE9IDA7CisgICAgfQorCisgICAgVGVzdENhc2U6OlRlc3RDYXNlKCBJVGVzdENhc2UqIHRlc3RDYXNlLCBUZXN0Q2FzZUluZm8gY29uc3QmIGluZm8gKSA6IFRlc3RDYXNlSW5mbyggaW5mbyApLCB0ZXN0KCB0ZXN0Q2FzZSApIHt9CisKKyAgICBUZXN0Q2FzZTo6VGVzdENhc2UoIFRlc3RDYXNlIGNvbnN0JiBvdGhlciApCisgICAgOiAgIFRlc3RDYXNlSW5mbyggb3RoZXIgKSwKKyAgICAgICAgdGVzdCggb3RoZXIudGVzdCApCisgICAge30KKworICAgIFRlc3RDYXNlIFRlc3RDYXNlOjp3aXRoTmFtZSggc3RkOjpzdHJpbmcgY29uc3QmIF9uZXdOYW1lICkgY29uc3QgeworICAgICAgICBUZXN0Q2FzZSBvdGhlciggKnRoaXMgKTsKKyAgICAgICAgb3RoZXIubmFtZSA9IF9uZXdOYW1lOworICAgICAgICByZXR1cm4gb3RoZXI7CisgICAgfQorCisgICAgdm9pZCBUZXN0Q2FzZTo6c3dhcCggVGVzdENhc2UmIG90aGVyICkgeworICAgICAgICB0ZXN0LnN3YXAoIG90aGVyLnRlc3QgKTsKKyAgICAgICAgbmFtZS5zd2FwKCBvdGhlci5uYW1lICk7CisgICAgICAgIGNsYXNzTmFtZS5zd2FwKCBvdGhlci5jbGFzc05hbWUgKTsKKyAgICAgICAgZGVzY3JpcHRpb24uc3dhcCggb3RoZXIuZGVzY3JpcHRpb24gKTsKKyAgICAgICAgdGFncy5zd2FwKCBvdGhlci50YWdzICk7CisgICAgICAgIGxjYXNlVGFncy5zd2FwKCBvdGhlci5sY2FzZVRhZ3MgKTsKKyAgICAgICAgdGFnc0FzU3RyaW5nLnN3YXAoIG90aGVyLnRhZ3NBc1N0cmluZyApOworICAgICAgICBzdGQ6OnN3YXAoIFRlc3RDYXNlSW5mbzo6cHJvcGVydGllcywgc3RhdGljX2Nhc3Q8VGVzdENhc2VJbmZvJj4oIG90aGVyICkucHJvcGVydGllcyApOworICAgICAgICBzdGQ6OnN3YXAoIGxpbmVJbmZvLCBvdGhlci5saW5lSW5mbyApOworICAgIH0KKworICAgIHZvaWQgVGVzdENhc2U6Omludm9rZSgpIGNvbnN0IHsKKyAgICAgICAgdGVzdC0+aW52b2tlKCk7CisgICAgfQorCisgICAgYm9vbCBUZXN0Q2FzZTo6b3BlcmF0b3IgPT0gKCBUZXN0Q2FzZSBjb25zdCYgb3RoZXIgKSBjb25zdCB7CisgICAgICAgIHJldHVybiAgdGVzdC5nZXQoKSA9PSBvdGhlci50ZXN0LmdldCgpICYmCisgICAgICAgICAgICAgICAgbmFtZSA9PSBvdGhlci5uYW1lICYmCisgICAgICAgICAgICAgICAgY2xhc3NOYW1lID09IG90aGVyLmNsYXNzTmFtZTsKKyAgICB9CisKKyAgICBib29sIFRlc3RDYXNlOjpvcGVyYXRvciA8ICggVGVzdENhc2UgY29uc3QmIG90aGVyICkgY29uc3QgeworICAgICAgICByZXR1cm4gbmFtZSA8IG90aGVyLm5hbWU7CisgICAgfQorICAgIFRlc3RDYXNlJiBUZXN0Q2FzZTo6b3BlcmF0b3IgPSAoIFRlc3RDYXNlIGNvbnN0JiBvdGhlciApIHsKKyAgICAgICAgVGVzdENhc2UgdGVtcCggb3RoZXIgKTsKKyAgICAgICAgc3dhcCggdGVtcCApOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgVGVzdENhc2VJbmZvIGNvbnN0JiBUZXN0Q2FzZTo6Z2V0VGVzdENhc2VJbmZvKCkgY29uc3QKKyAgICB7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKK30gLy8gZW5kIG5hbWVzcGFjZSBDYXRjaAorCisvLyAjaW5jbHVkZWQgZnJvbTogY2F0Y2hfdmVyc2lvbi5ocHAKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX1ZFUlNJT05fSFBQX0lOQ0xVREVECisKK25hbWVzcGFjZSBDYXRjaCB7CisKKyAgICBWZXJzaW9uOjpWZXJzaW9uCisgICAgICAgICggICB1bnNpZ25lZCBpbnQgX21ham9yVmVyc2lvbiwKKyAgICAgICAgICAgIHVuc2lnbmVkIGludCBfbWlub3JWZXJzaW9uLAorICAgICAgICAgICAgdW5zaWduZWQgaW50IF9wYXRjaE51bWJlciwKKyAgICAgICAgICAgIGNoYXIgY29uc3QgKiBjb25zdCBfYnJhbmNoTmFtZSwKKyAgICAgICAgICAgIHVuc2lnbmVkIGludCBfYnVpbGROdW1iZXIgKQorICAgIDogICBtYWpvclZlcnNpb24oIF9tYWpvclZlcnNpb24gKSwKKyAgICAgICAgbWlub3JWZXJzaW9uKCBfbWlub3JWZXJzaW9uICksCisgICAgICAgIHBhdGNoTnVtYmVyKCBfcGF0Y2hOdW1iZXIgKSwKKyAgICAgICAgYnJhbmNoTmFtZSggX2JyYW5jaE5hbWUgKSwKKyAgICAgICAgYnVpbGROdW1iZXIoIF9idWlsZE51bWJlciApCisgICAge30KKworICAgIHN0ZDo6b3N0cmVhbSYgb3BlcmF0b3IgPDwgKCBzdGQ6Om9zdHJlYW0mIG9zLCBWZXJzaW9uIGNvbnN0JiB2ZXJzaW9uICkgeworICAgICAgICBvcyAgPDwgdmVyc2lvbi5tYWpvclZlcnNpb24gPDwgJy4nCisgICAgICAgICAgICA8PCB2ZXJzaW9uLm1pbm9yVmVyc2lvbiA8PCAnLicKKyAgICAgICAgICAgIDw8IHZlcnNpb24ucGF0Y2hOdW1iZXI7CisgICAgICAgIC8vIGJyYW5jaE5hbWUgaXMgbmV2ZXIgbnVsbCAtPiAwdGggY2hhciBpcyBcMCBpZiBpdCBpcyBlbXB0eQorICAgICAgICBpZiAodmVyc2lvbi5icmFuY2hOYW1lWzBdKSB7CisgICAgICAgICAgICBvcyA8PCAnLScgPDwgdmVyc2lvbi5icmFuY2hOYW1lCisgICAgICAgICAgICAgICA8PCAnLicgPDwgdmVyc2lvbi5idWlsZE51bWJlcjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gb3M7CisgICAgfQorCisgICAgaW5saW5lIFZlcnNpb24gbGlicmFyeVZlcnNpb24oKSB7CisgICAgICAgIHN0YXRpYyBWZXJzaW9uIHZlcnNpb24oIDEsIDksIDQsICIiLCAwICk7CisgICAgICAgIHJldHVybiB2ZXJzaW9uOworICAgIH0KKworfQorCisvLyAjaW5jbHVkZWQgZnJvbTogY2F0Y2hfbWVzc2FnZS5ocHAKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENI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zIGNvbnN0JiBhc3NlcnRpb25TdGF0cyApIHsKKyAgICAgICAgaWYoIGFzc2VydGlvblN0YXRzLmFzc2VydGlvblJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgIT0gUmVzdWx0V2FzOjpPayApIHsKKyAgICAgICAgICAgIGZvciggc3RkOjp2ZWN0b3I8TWVzc2FnZUluZm8+Ojpjb25zdF9pdGVyYXRvciBpdCA9IGFzc2VydGlvblN0YXRzLmluZm9NZXNzYWdlcy5iZWdpbigpLCBpdEVuZCA9IGFzc2VydGlvblN0YXRzLmluZm9NZXNzYWdlcy5lbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgaXQgIT0gaXRFbmQ7CisgICAgICAgICAgICAgICAgICAgICsraXQgKSB7CisgICAgICAgICAgICAgICAgaWYoIGl0LT50eXBlID09IFJlc3VsdFdhczo6SW5mbyApIHsKKyAgICAgICAgICAgICAgICAgICAgUmVzdWx0QnVpbGRlciByYiggaXQtPm1hY3JvTmFtZS5jX3N0cigpLCBpdC0+bGluZUluZm8sICIiLCBSZXN1bHREaXNwb3NpdGlvbjo6Tm9ybWFsICk7CisgICAgICAgICAgICAgICAgICAgIHJiIDw8IGl0LT5tZXNzYWdlOworICAgICAgICAgICAgICAgICAgICByYi5zZXRSZXN1bHRUeXBlKCBSZXN1bHRXYXM6OkluZm8gKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0aW9uUmVzdWx0IHJlc3VsdCA9IHJiLmJ1aWxkKCk7CisgICAgICAgICAgICAgICAgICAgIG1fbGVnYWN5UmVwb3J0ZXItPlJlc3VsdCggcmVzdWx0ICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1fbGVnYWN5UmVwb3J0ZXItPlJlc3VsdCggYXNzZXJ0aW9uU3RhdHMuYXNzZXJ0aW9uUmVzdWx0ICk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICB2b2lkIExlZ2FjeVJlcG9yd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7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBVSW50NjQgdDsKKyAgICAgICAgICAgIFF1ZXJ5UGVyZm9ybWFuY2VDb3VudGVyKCByZWludGVycHJldF9jYXN0PExBUkdFX0lOVEVHRVIqPiggJnQgKSApOworICAgICAgICAgICAgcmV0dXJuICgodC1oem8pKjEwMDAwMDApL2h6OworICAgICAgICB9CisjZWxzZQorICAgICAgICBVSW50NjQgZ2V0Q3VycmVudFRpY2tzKCkgeworICAgICAgICAgICAgdGltZXZhbCB0OworICAgICAgICAgICAgZ2V0dGltZW9mZGF5KCZ0LENBVENIX05VTEwpOworICAgICAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PFVJbnQ2ND4oIHQudHZfc2VjICkgKiAxMDAwMDAwdWxsICsgc3RhdGljX2Nhc3Q8VUludDY0PiggdC50dl91c2VjICk7CisgICAgICAgIH0KKyNlbmRpZgorICAgIH0KKworICAgIHZvaWQgVGltZXI6OnN0YXJ0KCkgeworICAgICAgICBtX3RpY2tzID0gZ2V0Q3VycmVudFRpY2tzKCk7CisgICAgfQorICAgIHVuc2lnbmVkIGludCBUaW1lcjo6Z2V0RWxhcHNlZE1pY3Jvc2Vjb25kcygpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PHVuc2lnbmVkIGludD4oZ2V0Q3VycmVudFRpY2tzKCkgLSBtX3RpY2tzKTsKKyAgICB9CisgICAgdW5zaWduZWQgaW50IFRpbWVyOjpnZXRFbGFwc2VkTWlsbGlzZWNvbmRzKCkgY29uc3QgeworICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8dW5zaWduZWQgaW50PihnZXRFbGFwc2VkTWljcm9zZWNvbmRzKCkvMTAwMCk7CisgICAgfQorICAgIGRvdWJsZSBUaW1lcjo6Z2V0RWxhcHNlZFNlY29uZHMoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBnZXRFbGFwc2VkTWljcm9zZWNvbmRzKCkvMTAwMDAwMC4wOworICA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Gx1cmFsaXNlci5tX2NvdW50IDw8ICcgJyA8PCBwbHVyYWxpc2VyLm1fbGFiZWw7CisgICAgICAgIGlmKCBwbHVyYWxpc2VyLm1fY291bnQgIT0gMSApCisgICAgICAgICAgICBvcyA8PCAncyc7CisgICAgICAgIHJldHVybiBvczsKKyAgICB9CisKKyAgICBTb3VyY2VMaW5lSW5mbzo6U291cmNlTGluZUluZm8oKSA6IGZpbGUoIiIpLCBsaW5lKCAwICl7fQorICAgIFNvdXJjZUxpbmVJbmZvOjpTb3VyY2VMaW5lSW5mbyggY2hhciBjb25zdCogX2ZpbGUsIHN0ZDo6c2l6ZV90IF9saW5lICkKKyAgICA6ICAgZmlsZSggX2ZpbGUgKSwKKyAgICAgICAgbGluZSggX2xpbmUgKQorICAgIHt9CisgICAgYm9vbCBTb3VyY2VMaW5lSW5mbzo6ZW1wdHkoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBmaWxlWzBdID09ICdcMCc7CisgICAgfQorICAgIGJvb2wgU291cmNlTGluZUluZm86Om9wZXJhdG9yID09ICggU291cmNlTGluZUluZm8gY29uc3QmIG90aGVyICkgY29uc3QgeworICAgICAgICByZXR1cm4gbGluZSA9PSBvdGhlci5saW5lICYmIChmaWxlID09IG90aGVyLmZpbGUgfHwgc3RkOjpzdHJjbXAoZmlsZSwgb3RoZXIuZmlsZSkgPT0gMCk7CisgICAgfQorICAgIGJvb2wgU291cmNlTGluZUluZm86Om9wZXJhdG9yIDwgKCBTb3VyY2VMaW5lSW5mbyBjb25zdCYgb3RoZXIgKSBjb25zdCB7CisgICAgICAgIHJldHVybiBsaW5lIDwgb3RoZXIubGluZSB8fCAoIGxpbmUgPT0gb3RoZXIubGluZSAmJiAoc3RkOjpzdHJjbXAoZmlsZSwgb3RoZXIuZmlsZSkgPCAwKSk7CisgICAgfQorCisgICAgdm9pZCBzZWVkUm5nKCBJQ29uZmlnIGNvbnN0JiBjb25maWcgKSB7CisgICAgICAgIGlmKCBjb25maWcucm5nU2VlZC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pTZWN0aW9uSW5mbworICAgICAgICAoICAgU291cmNlTGluZUluZm8gY29uc3QmIF9saW5lSW5mbywKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfbmFtZSwKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNvbnN0JiBfZGVzY3JpcHRpb24gKQorICAgIDogICBuYW1lKCBfbmFtZSApLAorICAgICAgICBkZXNjcmlwdGlvbiggX2Rlc2NyaXB0aW9uICksCisgICAgICAgIGxpbmVJbmZvKCBfbGluZUluZm8gKQorICAgIHt9CisKKyAgICBTZWN0aW9uOjpTZWN0aW9uKCBTZWN0aW9uSW5mbyBjb25zdCYgaW5mbyApCisgICAgOiAgIG1faW5mbyggaW5mbyApLAorICAgICAgICBtX3NlY3Rpb25JbmNsdWRlZCggZ2V0UmVzdWx0Q2FwdHVyZSgpLnNlY3Rpb25TdGFydGVkKCBtX2luZm8sIG1fYXNzZXJ0aW9ucyApICkKKyAgICB7CisgICAgICAgIG1fdGltZXIuc3RhcnQoKTsKKyAgICB9CisKKyAgICBTZWN0aW9uOjp+U2VjdGlvbigpIHsKKyAgICAgICAgaWYoIG1fc2VjdGlvbkluY2x1ZGVkICkgeworICAgICAgICAgICAgU2VjdGlvbkVuZEluZm8gZW5kSW5mbyggbV9pbmZvLCBtX2Fzc2VydGlvbnMsIG1fdGltZXIuZ2V0RWxhcHNlZFNlY29uZHMoKSApOworICAgICAgICAgICAgaWYoIHN0ZDo6dW5jYXVnaHRfZXhjZXB0aW9uKCkgKQorICAgICAgICAgICAgICAgIGdldFJlc3VsdENhcHR1cmUoKS5zZWN0aW9uRW5kZWRFYXJseSggZW5kSW5mbyApOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIGdldFJlc3VsdENhcHR1cmUoKS5zZWN0aW9uRW5kZWQoIGVuZEluZm8gKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIFRoaXMgaW5kaWNhdGVzIHdoZXRoZXIgdGhlIHNlY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GtpbmZvX3Byb2MgICBpbmZvOworICAgICAgICAgICAgc2l6ZV90ICAgICAgICAgICAgICBzaXplOworCisgICAgICAgICAgICAvLyBJbml0aWFsaXplIHRoZSBmbGFncyBzbyB0aGF0LCBpZiBzeXNjdGwgZmFpbHMgZm9yIHNvbWUgYml6YXJyZQorICAgICAgICAgICAgLy8gcmVhc29uLCB3ZSBnZXQgYSBwcmVkaWN0YWJsZSByZXN1bHQuCisKKyAgICAgICAgICAgIGluZm8ua3BfcHJvYy5wX2ZsYWcgPSAwOworCisgICAgICAgICAgICAvLyBJbml0aWFsaXplIG1pYiwgd2hpY2ggdGVsbHMgc3lzY3RsIHRoZSBpbmZvIHdlIHdhbnQsIGluIHRoaXMgY2FzZQorICAgICAgICAgICAgLy8gd2UncmUgbG9va2luZyBmb3IgaW5mb3JtYXRpb24gYWJvdXQgYSBzcGVjaWZpYyBwcm9jZXNzIElELgorCisgICAgICAgICAgICBtaWJbMF0gPSBDVExfS0VSTjsKKyAgICAgICAgICAgIG1pYlsxXSA9IEtFUk5fUFJPQzsKKyAgICAgICAgICAgIG1pYlsyXSA9IEtFUk5fUFJPQ19QSUQ7CisgICAgICAgICAgICBtaWJbM10gPSBnZXRwaWQoKTsKKworICAgICAgICAgICAgLy8gQ2FsbCBzeXNjdGwuCisKKyAgICAgICAgICAgIHNpemUgPSBzaXplb2YoaW5mbyk7CisgICAgICAgICAgICBpZiggc3lzY3RsKG1pYiwgc2l6ZW9mKG1pYikgLyBzaXplb2YoKm1pYiksICZpbmZvLCAmc2l6ZSwgQ0FUQ0hfTlVMTCwgMCkgIT0gMCApIHsKKyAgICAgICAgICAgICAgICBDYXRjaDo6Y2VycigpIDw8ICJcbioqIENhbGwgdG8gc3lzY3RsIGZhaWxlZCAtIHVuYWJsZSB0byBkZXRlcm1pbmUgaWYgZGVidWdnZXIgaXMgYWN0aXZlICoqXG4iIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Cis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KXsKKyAgICAgICAgICAgIC8vIExpYnN0ZGMrKyBoYXMgYSBidWcsIHdoZXJlIHN0ZDo6aWZzdHJlYW0gc2V0cyBlcnJubyB0byAwCisgICAgICAgICAgICAvLyBUaGlzIHdheSBvdXIgdXNlcnMgY2FuIHByb3Blcmx5IGFzc2VydCBvdmVyIGVycm5vIHZhbHVlcworICAgICAgICAgICAgRXJybm9HdWFyZCBndWFyZDsKKyAgICAgICAgICAgIHN0ZDo6aWZzdHJlYW0gaW4oIi9wcm9jL3NlbGYvc3RhdHVzIik7CisgICAgICAgICAgICBmb3IoIHN0ZDo6c3RyaW5nIGxpbmU7IHN0ZDo6Z2V0bGluZShpbiwgbGluZSk7ICkgeworICAgICAgICAgICAgICAgIHN0YXRpYyBjb25zdCBpbnQgUFJFRklYX0xFTiA9IDExOworICAgICAgICAgICAgICAgIGlmKCBsaW5lLmNvbXBhcmUoMCwgUFJFRklYX0xFTiwgIlRyYWNlclBpZDpcdCIpID09IDAgKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFdlJ3JlIHRyYWNlZCBpZiB0aGUgUElEIGlzIG5vdCAwIGFuZCBubyBvdGhlciBQSUQgc3RhcnRzCisgICAgICAgICAgICAgICAgICAgIC8vIHdpdGggMCBkaWdpdCwgc28gaXQncyBlbm91Z2ggdG8gY2hlY2sgZm9yIGp1c3QgYSBzaW5nbGUKKyAgICAgICAgICAgICAgICAgICAgLy8gY2hhcmFjdGVyLgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGluZS5sZW5ndGgoKSA+IFBSRUZJWF9MRU4gJiYgbGluZVtQUkVGSVhfTEVOXSAhPSAnMCc7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9IC8vIG5hbWVzcGFjZSBDYXRjaAorI2VsaWYgZGVmaW5lZChfTVNDX1ZFUikKKyAgICBleHRlcm4gIkMiIF9fZGVjbHNwZWMoZ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9yIE1hYy8gWENvZGUgYW5kIG90aGVyIElERXMKKyAgICAgICAgICAgIENhdGNoOjpjb3V0KCkgPDwgdGV4dDsKKyAgICAgICAgfQorICAgIH0KKyNlbmRpZiAvLyBQbGF0Zm9ybQorCisvLyAjaW5jbHVkZWQgZnJvbTogY2F0Y2hfdG9zdHJpbmcuaHBwCisjZGVmaW5lIFRXT0JMVUVDVUJFU19DQVRDSF9UT1NUUklOR19IUFBfSU5DTFVERUQKKworbmFtZXNwYWNlIENhdGNoIHsKKworbmFtZXNwYWNlIERldGFpbCB7CisKKyAgICBjb25zdCBzdGQ6OnN0cmluZyB1bnByaW50YWJsZVN0cmluZyA9ICJ7P30iOworCisgICAgbmFtZXNwYWNlIHsKKyAgICAgICAgY29uc3QgaW50IGhleFRocmVzaG9sZCA9IDI1NTsKKworICAgICAgICBzdHJ1Y3QgRW5kaWFubmVzcyB7CisgICAgICAgICAgICBlbnVtIEFyY2ggeyBCaWcsIExpdHRsZSB9OworCisgICAgICAgICAgICBzdGF0aWMgQXJjaCB3aGljaCgpIHsKKyAgICAgICAgICAgICAgICB1bmlvbiBfeworICAgICAgICAgICAgICAgICAgICBpbnQgYXNJbnQ7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgYXNDaGFyW3NpemVvZiAoaW50KV07CisgICAgICAgICAgICAgICAgfSB1OworCisgICAgICAgICAgICAgICAgdS5hc0ludCA9IDE7CisgICAgICAgICAgICAgICAgcmV0dXJuICggdS5hc0NoYXJbc2l6ZW9mKGludCktMV0gPT0gMSApID8gQmlnIDogTGl0dGxlOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgIH0KKworICAgIHN0ZDo6c3RyaW5nIHJhd01lbW9yeVRvU3RyaW5nKCBjb25zdCB2b2lkICpvYmplY3QsIHN0ZDo6c2l6ZV90IHNpemUgKQorICAgIHsKKyAgICAgICAgLy8gUmV2ZXJzZSBvcmRlciBmb3IgbGl0dGxlIGVuZGlhbiBhcmNoaXRlY3R1cmVzCisgICAgICAgIGludCBpID0gMCwgZW5kID0gc3RhdGljX2Nhc3Q8aW50Piggc2l6ZSApLCBpbmMgPSAxOworICAgICAgICBpZiggRW5kaWFubmVzczo6d2hpY2goKSA9PSBFbmRpYW5uZXNzOjpMaXR0bGUgKSB7CisgICAgICAgICAgICBpID0gZW5kLTE7CisgICAgICAgICAgICBlbmQgPSBpbmMgPSAtMTsKKyAgICAgICAgfQorCisgICAgICAgIHVuc2lnbmVkIGNoYXIgY29uc3QgKmJ5dGVzID0gc3RhdGljX2Nhc3Q8dW5zaWduZWQgY2hhciBjb25zdCAqPihvYmplY3QpOworICAgICAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gb3M7CisgICAgICAgIG9zIDw8ICIweCIgPDwgc3RkOjpzZXRmaWxsKCcwJykgPDwgc3RkOjpoZXg7CisgICAgICAgIGZvciggOyBpICE9IGVuZDsgaSArPSBpbmMgKQorICAgICAgICAgICAgIG9zIDw8IHN0ZDo6c2V0dygyKSA8PCBzdGF0aWNfY2FzdDx1bnNpZ25lZD4oYnl0ZXNbaV0pOworICAgICAgIHJldHVybiBvcy5zdHIoKTsKKyAgICB9Cit9CisKK3N0ZDo6c3RyaW5nIHRvU3RyaW5nKCBzdGQ6OnN0cmluZyBjb25zdCYgdmFsdWUgKSB7CisgICAgc3RkOjpzdHJpbmcgcyA9IHZhbHVlOworICAgIGlmKCBnZXRDdXJyZW50Q29udGV4dCgpLmdldENvbmZpZygpLT5zaG93SW52aXNpYmxlcygpICkgeworICAgICAgICBmb3Ioc2l6ZV90IGkgPSAwOyBpIDwgcy5zaXplKCk7ICsraSApIHsKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHN1YnM7CisgICAgICAgICAgICBzd2l0Y2goIHNbaV0gKSB7CisgICAgICAgICAgICBjYXNlICdcbic6IHN1YnMgPSAiXFxuIjsgYnJlYWs7CisgICAgICAgICAgICBjYXNlICdcdCc6IHN1YnMgPSAiXFx0IjsgYnJlYWs7CisgICAgICAgICAgICBkZWZh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Q6Om9zdHJpbmdzdHJlYW0gb3NzOworICAgIG9zcyA8PCBzdGQ6OnNldHByZWNpc2lvbiggcHJlY2lzaW9uICkKKyAgICAgICAgPDwgc3RkOjpmaXhlZAorICAgICAgICA8PCB2YWx1ZTsKKyAgICBzdGQ6OnN0cmluZyBkID0gb3NzLnN0cigpOworICAgIHN0ZDo6c2l6ZV90IGkgPSBkLmZpbmRfbGFzdF9ub3Rfb2YoICcwJyApOworICAgIGlmKCBpICE9IHN0ZDo6c3RyaW5nOjpucG9zICYmIGkgIT0gZC5zaXplKCktMSApIHsKKyAgICAgICAgaWYoIGRbaV0gPT0gJy4nICkKKyAgICAgICAgICAgIGkrKzsKKyAgICAgICAgZCA9IGQuc3Vic3RyKCAwLCBpKzEgKTsKKyAgICB9CisgICAgcmV0dXJuIGQ7Cit9CisKK3N0ZDo6c3RyaW5nIHRvU3RyaW5nKCBjb25zdCBkb3VibGUgdmFsdWUgKSB7CisgICAgcmV0dXJuIGZwVG9TdHJpbmcoIHZhbHVlLCAxMCApOworfQorc3RkOjpzdHJpbmcgdG9TdHJpbmcoIGNvbnN0IGZsb2F0IHZhbHVlICkgeworICAgIHJldHVybiBmcFRvU3RyaW5nKCB2YWx1ZSwgNSApICsgJ2YnOworfQorCitzdGQ6OnN0cmluZyB0b1N0cmluZyggYm9vbCB2YWx1ZSApIHsKKyAgICByZXR1cm4gdmFsdWUgPyAidHJ1ZSIgOiAiZmFsc2UiOworfQorCitzdGQ6OnN0cmluZyB0b1N0cmluZyggY2hhciB2YWx1ZSApIHsKKyAgICBpZiAoIHZhbHVlID09ICdccicgKQorICAgICAgICByZXR1cm4gIidcXHInIjsKKyAgICBpZiAoIHZhbHVlID09ICdcZicgKQorICAgICAgICByZXR1cm4gIidcXGYnIjsKKyAgICBpZiAoIHZhbHVlID09ICdcbicgKQorICAgICAgICByZXR1cm4gIidcXG4nIjsKKyAgICBpZiAoIHZhbHVlID09ICdcdCcgKQorICAgICAgICByZXR1cm4gIidcXHQnI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vbldpdGhTZWNvbmRBcmd1bWVudCggc3RkOjpzdHJpbmcgY29uc3QmIGNhcHR1cmVkRXhwcmVzc2lvbiwgc3RkOjpzdHJpbmcgY29uc3QmIHNlY29uZEFyZyApIHsKKyAgICAgICAgcmV0dXJuIHNlY29uZEFyZy5lbXB0eSgpIHx8IHNlY29uZEFyZyA9PSAiXCJcIiIKKyAgICAgICAgICAgID8gY2FwdHVyZWRFeHByZXNzaW9uCisgICAgICAgICAgICA6IGNhcHR1cmVkRXhwcmVzc2lvbiArICIsICIgKyBzZWNvbmRBcmc7CisgICAgfQorICAgIFJlc3VsdEJ1aWxkZXI6OlJlc3VsdEJ1aWxkZXIoICAgY2hhciBjb25zdCogbWFjcm9OYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjb25zdCogY2FwdHVyZWRFeHByZXNzaW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVzdWx0RGlzcG9zaXRpb246OkZsYWdzIHJlc3VsdERpc3Bvc2l0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjb25zdCogc2Vjb25kQXJnICkKKyAgICA6ICAgbV9hc3NlcnRpb25JbmZvKCBtYWNyb05hbWUsIGxpbmVJbmZvLCBjYXB0dXJlZEV4cHJlc3Npb25XaXRoU2Vjb25kQXJndW1lbnQoIGNhcHR1cmVkRXhwcmVzc2lvbiwgc2Vjb25kQXJnICksIHJlc3VsdERpc3Bvc2l0aW9uICksCisgICAgICAgIG1fc2hvdWxkRGVidWdCcmVhayggZmFsc2UgKSwKKyAgICAgICAgbV9zaG91bGRUaHJvdyggZmFsc2UgKSwKKyAgICAgICAgbV9ndWFyZEV4Y2VwdGlvbiggZmFsc2UgKQorICAgIHt9CisKKyAgICBSZXN1bHRCdWlsZGVyO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WFwPHN0ZDo6c3RyaW5nLCBUYWdBbGlhcz46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gbV9yZWdpc3RyeS5iZWdpbigpLCBpdEVuZCA9IG1fcmVnaXN0cnkuZW5kKCk7CisgICAgICAgICAgICAgICAgaXQgIT0gaXRFbmQ7CisgICAgICAgICAgICAgICAgKytpdCApIHsKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHBvcyA9IGV4cGFuZGVkVGVzdFNwZWMuZmluZCggaXQtPmZpcnN0ICk7CisgICAgICAgICAgICBpZiggcG9zICE9IHN0ZDo6c3RyaW5nOjpucG9zICkgeworICAgICAgICAgICAgICAgIGV4cGFuZGVkVGVzdFNwZWMgPSAgZXhwYW5kZWRUZXN0U3BlYy5zdWJzdHIoIDAsIHBvcyApICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0LT5zZWNvbmQudGFnICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGFuZGVkVGVzdFNwZWMuc3Vic3RyKCBwb3MgKyBpdC0+Zmlyc3Quc2l6ZSgpICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGV4cGFuZGVkVGVzdFNwZWM7CisgICAgfQorCisgICAgdm9pZCBUYWdBbGlhc1JlZ2lzdHJ5OjphZGQoIHN0ZDo6c3RyaW5nIGNvbnN0JiBhbGlhcywgc3RkOjpzdHJpbmcgY29uc3QmIHRhZywgU291cmNlTGluZUluZm8gY29uc3QmIGxpbmVJbmZvICkgeworCisgICAgICAgIGlmKCAhc3RhcnRzV2l0aCggYWxpYXMsICJbQCIgKSB8fCAhZW5kc1dpdGgoIGFsaWFzLCAnXScgKSApIHsKKyAgICAgICAgICAgIHN0ZDo6b3N0cmluZ3N0cmVhbSBvc3M7CisgICAgICAgICAgICBvc3MgPDwgQ29sb3VyKCBDb2xvdXI6OlJlZCApCisgICAgICAgICAgICAgICAgPDwgImVycm9yOiB0Y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mU6Ok5vCisgICAgICAgICAgICAgICAgICAgPyB0b0xvd2VyKCBzdHIgKQorICAgICAgICAgICAgICAgICAgIDogc3RyOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIENhc2VkU3RyaW5nOjpjYXNlU2Vuc2l0aXZpdHlTdWZmaXgoKSBjb25zdCB7CisgICAgICAgICAgICByZXR1cm4gbV9jYXNlU2Vuc2l0aXZpdHkgPT0gQ2FzZVNlbnNpdGl2ZTo6Tm8KKyAgICAgICAgICAgICAgICAgICA/ICIgKGNhc2UgaW5zZW5zaXRpdmUpIgorICAgICAgICAgICAgICAgICAgIDogc3RkOjpzdHJpbmcoKTsKKyAgICAgICAgfQorCisgICAgICAgIFN0cmluZ01hdGNoZXJCYXNlOjpTdHJpbmdNYXRjaGVyQmFzZSggc3RkOjpzdHJpbmcgY29uc3QmIG9wZXJhdGlvbiwgQ2FzZWRTdHJpbmcgY29uc3QmIGNvbXBhcmF0b3IgKQorICAgICAgICA6IG1fY29tcGFyYXRvciggY29tcGFyYXRvciApLAorICAgICAgICAgIG1fb3BlcmF0aW9uKCBvcGVyYXRpb24gKSB7CisgICAgICAgIH0KKworICAgICAgICBzdGQ6OnN0cmluZyBTdHJpbmdNYXRjaGVyQmFzZTo6ZGVzY3JpYmUoKSBjb25zdCB7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBkZXNjcmlwdGlvbjsKKyAgICAgICAgICAgIGRlc2NyaXB0aW9uLnJlc2VydmUoNSArIG1fb3BlcmF0aW9uLnNpemUoKSArIG1fY29tcGFyYXRvci5tX3N0ci5zaXplKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1fY29tcGFyYXRvci5jYXNlU2Vuc2l0aXZpdHlTdWZmaXgoKS5zaXplKCkpOworICAgICAgICAgICAgZGVzY3JpcHRpb24gKz0gbV9vcGVyYXRpb247CisgICAgICAgICAgICBkZXNjcmlwdGlvbiArPSAiOiBcIiI7CisgICAgICAgICAgICB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uZDsKKyAgICAgICAgICAgICAgICArK2l0ICkKKyAgICAgICAgICAgIGNsZWFyQnVmZmVyIHw9ICgqaXQpLT5hc3NlcnRpb25FbmRlZCggYXNzZXJ0aW9uU3RhdHMgKTsKKyAgICAgICAgcmV0dXJuIGNsZWFyQnVmZmVyOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBzZWN0aW9uRW5kZWQoIFNlY3Rpb25TdGF0cyBjb25zdCYgc2VjdGlvblN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICBmb3IoIFJlcG9ydGVyczo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtX3JlcG9ydGVycy5iZWdpbigpLCBpdEVuZCA9IG1fcmVwb3J0ZXJzLmVuZCgpOworICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICsraXQgKQorICAgICAgICAgICAgKCppdCktPnNlY3Rpb25FbmRlZCggc2VjdGlvblN0YXRzICk7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIHRlc3RDYXNlRW5kZWQoIFRlc3RDYXNlU3RhdHMgY29uc3QmIHRlc3RDYXNlU3RhdHMgKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgIGZvciggUmVwb3J0ZXJzOjpjb25zdF9pdGVyYXRvciBpdCA9IG1fcmVwb3J0ZXJzLmJlZ2luKCksIGl0RW5kID0gbV9yZXBvcnRlcnMuZW5kKCk7CisgICAgICAgICAgICAgICAgaXQgIT0gaXRFbmQ7CisgICAgICAgICAgICAgICAgKytpdCApCisgICAgICAgICAgICAoKml0KS0+dGVzdENhc2VFbmRlZCggdGVzdENhc2VTdGF0cyApOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCB0ZXN0R3JvdXBFbmRlZCggVGVzdEdyb3VwU3RhdHMgY29uc3QmIHRlc3RHcm91cFN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICBmb3IoIFJlcG9ydGVyczo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtX3JlcG9ydGVycy5iZWdpbigpLCBpdEVuZCA9IG1fcmVwb3J0ZXJzLmVuZCgpOworICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICsraXQgKQorICAgICAgICAgICAgKCppdCktPnRlc3RHcm91cEVuZGVkKCB0ZXN0R3JvdXBTdGF0cyApOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCB0ZXN0UnVuRW5kZWQoIFRlc3RSdW5TdGF0cyBjb25zdCYgdGVzdFJ1blN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICBmb3IoIFJlcG9ydGVyczo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtX3JlcG9ydGVycy5iZWdpbigpLCBpdEVuZCA9IG1fcmVwb3J0ZXJzLmVuZCgpOworICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICsraXQgKQorICAgICAgICAgICAgKCppdCktPnRlc3RSdW5FbmRlZCggdGVzdFJ1blN0YXRzICk7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIHNraXBUZXN0KCBUZXN0Q2FzZUluZm8gY29uc3QmIHRlc3RJbmZvICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICBmb3IoIFJlcG9ydGVyczo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtX3JlcG9ydGVycy5iZWdpbigpLCBpdEVuZCA9IG1fcmVwb3J0ZXJzLmVuZCgpOworICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICsraXQgKQorICAgICAgICAgICAgKCppdCktPnNraXBUZXN0KCB0ZXN0SW5mbyApOworICAgIH0KKworICAgIHZpcnR1YWwgTXVsdGlwbGVSZXBvcnRlcnMqIHRyeUFzTXVsdGkoKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworfTsKKworUHRyPElTdHJlYW1pbmdSZXBvcnRl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kgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBzdGF0cy5zZWN0aW9uSW5mby5saW5lSW5mbyA9PSBvdGhlci5zdGF0cy5zZWN0aW9uSW5mby5saW5lSW5mbzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3IgPT0gKCBQdHI8U2VjdGlvbk5vZGU+IGNvbnN0JiBvdGhlciApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gb3BlcmF0b3I9PSggKm90aGVyICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFNlY3Rpb25TdGF0cyBzdGF0czsKKyAgICAgICAgICAgIHR5cGVkZWYgc3RkOjp2ZWN0b3I8UHRyPFNlY3Rpb25Ob2RlPiA+IENoaWxkU2VjdGlvbnM7CisgICAgICAgICAgICB0eXBlZGVmIHN0ZDo6dmVjdG9yPEFzc2VydGlvblN0YXRzPiBBc3NlcnRpb25zOworICAgICAgICAgICAgQ2hpbGRTZWN0aW9ucyBjaGlsZFNlY3Rpb25zOworICAgICAgICAgICAgQXNzZXJ0aW9ucyBhc3NlcnRpb25zOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgc3RkT3V0OworICAgICAgICAgICAgc3RkOjpzdHJpbmcgc3RkRXJyOworICAgICAgICB9OworCisgICAgICAgIHN0cnVjdCBCeVNlY3Rpb25JbmZvIHsKKyAgICAgICAgICAgIEJ5U2VjdGlvbkluZm8oIFNlY3Rpb25JbmZvIGNvbnN0JiBvdGhlciApIDogbV9vdGhlciggb3RoZXIgKSB7fQorICAgICAgICAgICAgQnlTZWN0aW9uSW5mbyggQnlTZWN0aW9uSW5mbyBjb25zdCYgb3RoZXIgKSA6IG1fb3RoZXIoIG90aGVyLm1fb3RoZXIgKSB7fQorICAgICAgICAgICAgYm9vbCBvcGVyYXRvcigpICggUHRyPFNlY3Rpb25Ob2RlPiBjb25zdCYgbm9kZSApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1c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3RSdW5JbmZvIGNvbnN0JiApIENBVENIX09WRVJSSURFIHt9CisgICAgICAgIHZpcnR1YWwgdm9pZCB0ZXN0R3JvdXBTdGFydGluZyggR3JvdXBJbmZvIGNvbnN0JiApIENBVENIX09WRVJSSURFIHt9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIHRlc3RDYXNlU3RhcnRpbmcoIFRlc3RDYXNlSW5mbyBjb25zdCYgKSBDQVRDSF9PVkVSUklERSB7fQorCisgICAgICAgIHZpcnR1YWwgdm9pZCBzZWN0aW9uU3RhcnRpbmcoIFNlY3Rpb25JbmZvIGNvbnN0JiBzZWN0aW9uSW5mbyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIFNlY3Rpb25TdGF0cyBpbmNvbXBsZXRlU3RhdHMoIHNlY3Rpb25JbmZvLCBDb3VudHMoKSwgMCwgZmFsc2UgKTsKKyAgICAgICAgICAgIFB0cjxTZWN0aW9uTm9kZT4gbm9kZTsKKyAgICAgICAgICAgIGlmKCBtX3NlY3Rpb25TdGFjay5lbXB0eSgpICkgeworICAgICAgICAgICAgICAgIGlmKCAhbV9yb290U2VjdGlvbiApCisgICAgICAgICAgICAgICAgICAgIG1fcm9vdFNlY3Rpb24gPSBuZXcgU2VjdGlvbk5vZGUoIGluY29tcGxldGVTdGF0cyApOworICAgICAgICAgICAgICAgIG5vZGUgPSBtX3Jvb3RTZWN0aW9uOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgU2VjdGlvbk5vZGUmIHBhcmVudE5vZGUgPSAqbV9zZWN0aW9uU3RhY2suYmFjaygpOworICAgICAgICAgICAgICAgIFNlY3Rpb25Ob2RlOjpDaGlsZFNlY3Rpb25zOjpjb25zdF9pdGVyYXRvciBpdCA9CisgICAgICAgICAgICAgICAgICAgIHN0ZDo6ZmluZF9pZiggICBwYXJlbnROb2RlLmNoaWxkU2VjdGlvbnMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudE5vZGUuY2hpbGRTZWN0aW9ucy5lbmQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ5U2VjdGlvbkluZm8oIHNlY3Rpb25JbmZvICkgKTsKKyAgICAgICAgICAgICAgICBpZiggaXQgPT0gcGFyZW50Tm9kZS5jaGlsZFNlY3Rpb25zLmVuZCgpICkgeworICAgICAgICAgICAgICAgICAgICBub2RlID0gbmV3IFNlY3Rpb25Ob2RlKCBpbmNvbXBsZXRlU3RhdHMgKTsKKyAgICAgICAgICAgICAgICAgICAgcGFyZW50Tm9kZS5jaGlsZFNlY3Rpb25zLnB1c2hfYmFjayggbm9kZSApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIG5vZGUgPSAqaXQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtX3NlY3Rpb25TdGFjay5wdXNoX2JhY2soIG5vZGUgKTsKKyAgICAgICAgICAgIG1fZGVlcGVzdFNlY3Rpb24gPSBub2RlOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIGFzc2VydGlvblN0YXJ0aW5nKCBBc3NlcnRpb25JbmZvIGNvbnN0JiApIENBVENIX09WRVJSSURFIHt9CisKKyAgICAgICAgdmlydHVhbCBib29sIGFzc2VydGlvbkVuZGVkKCBBc3NlcnRpb25TdGF0cyBjb25zdCYgYXNzZXJ0aW9uU3RhdHMgKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICBhc3NlcnQoICFtX3NlY3Rpb25TdGFjay5lbXB0eSgpICk7CisgICAgICAgICAgICBTZWN0aW9uTm9kZSYgc2VjdGlvbk5vZGUgPSAqbV9zZWN0aW9uU3RhY2suYmFjaygpOworICAgICAgICAgICAgc2VjdGlvbk5vZGUuYXNzZXJ0aW9ucy5wdXNoX2JhY2soIGFzc2VydGlvblN0YXRzICk7CisgICAgICAgICAgICAvLyB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gIH0KKyAgICB9OworCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICBjbGFzcyBMaXN0ZW5lclJlZ2lzdHJhciB7CisKKyAgICAgICAgY2xhc3MgTGlzdGVuZXJGYWN0b3J5IDogcHVibGljIFNoYXJlZEltcGw8SVJlcG9ydGVyRmFjdG9yeT4geworCisgICAgICAgICAgICB2aXJ0dWFsIElTdHJlYW1pbmdSZXBvcnRlciogY3JlYXRlKCBSZXBvcnRlckNvbmZpZyBjb25zdCYgY29uZmlnICkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVCggY29uZmlnICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2aXJ0dWFsIHN0ZDo6c3RyaW5nIGdldERlc2NyaXB0aW9uKCkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBzdGQ6OnN0cmluZygpOworICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgcHVibGljOgorCisgICAgICAgIExpc3RlbmVyUmVnaXN0cmFyKCkgeworICAgICAgICAgICAgZ2V0TXV0YWJsZVJlZ2lzdHJ5SHViKCkucmVnaXN0ZXJMaXN0ZW5lciggbmV3IExpc3RlbmVyRmFjdG9yeSgpICk7CisgICAgICAgIH0KKyAgICB9OworfQorCisjZGVmaW5lIElOVEVSTkFMX0NBVENIX1JFR0lTVEVSX0xFR0FDWV9SRVBPUlRFUiggbmFtZSwgcmVwb3J0ZXJUeXBlICkgXAorICAgIG5hbWVzcGFjZXsgQ2F0Y2g6OkxlZ2FjeVJlcG9ydGVyUmVnaXN0cmFyPHJlcG9ydGVyVHlwZT4gY2F0Y2hfaW50ZXJuYWxfUmVnaXN0cmFyRm9yIyNyZXBvcnRlclR5cGUoIG5hbWUgKTsgfQorCisjZGVmaW5lIElOVEVSTkFMX0NBVENIX1JFR0lTVEVSX1JFUE9SVEVSKCBuYW1lLCByZXBvcnRlclR5cGUgKSBcCisgICAgbmFtZXNwYWNleyBDYXRjaDo6UmVwb3J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A9IEZvclRleHROb2RlcyApCisgICAgICAgIDogICBtX3N0ciggc3RyICksCisgICAgICAgICAgICBtX2ZvcldoYXQoIGZvcldoYXQgKQorICAgICAgICB7fQorCisgICAgICAgIHZvaWQgZW5jb2RlVG8oIHN0ZDo6b3N0cmVhbSYgb3MgKSBjb25zdCB7CisKKyAgICAgICAgICAgIC8vIEFwb3N0cm9waGUgZXNjYXBpbmcgbm90IG5lY2Vzc2FyeSBpZiB3ZSBhbHdheXMgdXNlICIgdG8gd3JpdGUgYXR0cmlidXRlcworICAgICAgICAgICAgLy8gKHNlZTogaHR0cDovL3d3dy53My5vcmcvVFIveG1sLyNzeW50YXgpCisKKyAgICAgICAgICAgIGZvciggc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBtX3N0ci5zaXplKCk7ICsrIGkgKSB7CisgICAgICAgICAgICAgICAgY2hhciBjID0gbV9zdHJbaV07CisgICAgICAgICAgICAgICAgc3dpdGNoKCBjICkgeworICAgICAgICAgICAgICAgICAgICBjYXNlICc8JzogICBvcyA8PCAiJmx0OyI7IGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlICcmJzogICBvcyA8PCAiJmFtcDsiOyBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBjYXNlICc+JzoKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFNlZTogaHR0cDovL3d3dy53My5vcmcvVFIveG1sLyNzeW50YXgKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBpID4gMiAmJiBtX3N0cltpLTFdID09ICddJyAmJiBtX3N0cltpLTJdID09ICddJyApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3MgPDwgIiZndDsiOworICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zIDw8IGM7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBjYXNlICdcIic6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiggbV9mb3JXaGF0ID09IEZvckF0dHJpYnV0ZXMgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zIDw8ICImcXVvdDsiOworICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9zIDw8IGM7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gRXNjYXBlIGNvbnRyb2wgY2hhcnMgLSBiYXNlZCBvbiBjb250cmlidXRpb24gYnkgQGVzcGVuYWxiIGluIFBSICM0NjUgYW5kCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBieSBAbXJwaSBQUiAjNTg4CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoICggYyA+PSAwICYmIGMgPCAnXHgwOScgKSB8fCAoIGMgPiAnXHgwRCcgJiYgYyA8ICdceDIwJykgfHwgYz09J1x4N0YnICkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNlZSBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzQwNDEwNy93aHktYXJlLWNvbnRyb2wtY2hhcmFjdGVycy1pbGxlZ2FsLWluLXhtbC0xLTAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcyA8PCAiXFx4IiA8PCBzdGQ6OnVwcGVyY2FzZSA8PCBzdGQ6OmhleCA8PCBzdGQ6OnNldGZpbGwoJzAnKSA8PCBzdGQ6OnNldHcoMikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBzdGF0aWNfY2FzdDxpbnQ+KCBjICk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3MgPDwgYzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmcmllbmQgc3RkOjpvc3RyZWFtJiBvcGVyYXRvciA8PCAoIHN0ZDo6b3N0cmVhbSYgb3MsIFhtbEVuY29kZSBjb25zdCYgeG1sRW5jb2RlICkgeworICAgICAgICAgICAgeG1sRW5jb2RlLmVuY29kZVRvKCBvcyApOworICAgICAgICAgICAgcmV0dXJuIG9zOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgICBzdGQ6OnN0cmluZyBtX3N0cjsKKyAgICAgICAgRm9yV2hhdCBtX2ZvcldoYXQ7CisgICAgfTsKKworICAgIGNsYXNzIFhtbFdyaXRlciB7CisgICAgcHVibGljOgorCisgICAgICAgIGNsYXNzIFNjb3BlZEVsZW1lbnQgeworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICBTY29wZWRFbGVtZW50KCBYbWxXcml0ZXIqIHdyaXRlciApCisgICAgICAgICAgICA6ICAgbV93cml0ZXIoIHdyaXRlciApCisgICAgICAgICAgICB7fQorCisgICAgICAgICAgICBTY29wZWRFbGVtZW50KCBTY29wZWRFbGVtZW50IGNvbnN0JiBvdGhlciApCisgICAgICAgICAgICA6ICAgbV93cml0ZXIoIG90aGVyLm1fd3JpdGVyICl7CisgICAgICAgICAgICAgICAgb3RoZXIubV93cml0ZXIgPSBDQVRDSF9OVUxMOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB+U2NvcGVkRWxlbWVudCgpIHsKKyAgICAgICAgICAgICAgICBpZiggbV93cml0ZXIgKQorICAgICAgICAgICAgICAgICAgICBtX3dyaXRlci0+ZW5kRWxlbWVudCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTY29wZWRFbGVtZW50JiB3cml0ZVRleHQoIHN0ZDo6c3RyaW5nIGNvbnN0JiB0ZXh0LCBib29sIGluZGVudCA9IHRydWUgKSB7CisgICAgICAgICAgICAgICAgbV93cml0ZXItPndyaXRlVGV4dCggdGV4dCwgaW5kZW50ICk7CisgICAgICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICAgICAgU2NvcGVkRWxlbWVudCYgd3JpdGVBdHRyaWJ1dGUoIHN0ZDo6c3RyaW5nIGNvbnN0JiBuYW1lLCBUIGNvbnN0JiBhdHRyaWJ1dGUgKSB7CisgICAgICAgICAgICAgICAgbV93cml0ZXItPndyaXRlQXR0cmlidXRlKCBuYW1lLCBhdHRyaWJ1dGUgKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIG11dGFibGUgWG1sV3JpdGVyKiBtX3dyaXRlcjsKKyAgICAgICAgfTsKKworICAgICAgICBYbWxXcml0ZXIoKQorICAgICAgICA6ICAgbV90YWdJc09wZW4oIGZhbHNlICksCisgICAgICAgICAgICBtX25lZWRzTmV3bGluZSggZmFsc2UgKSwKKyAgICAgICAgICAgIG1fb3MoIENhdGNoOjpjb3V0KCkgKQorICAgICAgICB7CisgICAgICAgICAgICB3cml0ZURlY2xhcmF0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBYbWxXcml0ZXIoIHN0ZDo6b3N0cmVhbSYgb3MgKQorICAgICAgICA6ICAgbV90YWdJc09wZW4oIGZhbHNlICksCisgICAgICAgICAgICBtX25lZWRzTmV3bGluZSggZmFsc2UgKSwKKyAgICAgICAgICAgIG1fb3MoIG9zICkKKyAgICAgICAgeworICAgICAgICAgICAgd3JpdGVEZWNsYXJhdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgflhtbFdyaXRlcigpIHsKKyAgICAgICAgICAgIHdoaWxlKCAhbV90YWdzLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgIGVuZEVsZW1lbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIFhtbFdyaXRlciYgc3RhcnRFbGVtZW50KCBzdGQ6OnN0cmluZyBjb25zdCYgbmFtZSApIHsKKyAgICAgICAgICAgIGVuc3VyZVRhZ0Nsb3NlZCgpOworICAgICAgICAgICAgbmV3bGluZUlmTmVjZXNzYXJ5KCk7CisgICAgICAgICAgICBtX29zIDw8IG1faW5kZW50IDw8ICc8JyA8PCBuYW1lOworICAgICAgICAgICAgbV90YWdzLnB1c2hfYmFjayggbmFtZSApOworICAgICAgICAgICAgbV9pbmRlbnQgKz0gIiAgIjsKKyAgICAgICAgICAgIG1fdGFnSXNPcGVuID0gdHJ1ZTsKKyAgICAgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgICAgfQorCisgICAgICAgIFNjb3BlZEVsZW1lbnQgc2NvcGVkRWxlbWVudCggc3RkOjpzdHJpbmcgY29uc3QmIG5hbWUgKSB7CisgICAgICAgICAgICBTY29wZWRFbGVtZW50IHNjb3BlZCggdGhpcyApOworICAgICAgICAgICAgc3RhcnRFbGVtZW50KCBuYW1lICk7CisgICAgICAgICAgICByZXR1cm4gc2NvcGVkOworICAgICAgICB9CisKKyAgICAgICAgWG1sV3JpdGVyJiBlbmRFbGVtZW50KCkgeworICAgICAgICAgICAgbmV3bGluZUlmTmVjZXNzYXJ5KCk7CisgICAgICAgICAgICBtX2luZGVudCA9IG1faW5kZW50LnN1YnN0ciggMCwgbV9pbmRlbnQuc2l6ZSgpLTIgKTsKKyAgICAgICAgICAgIGlmKCBtX3RhZ0lzT3BlbiApIHsKKyAgICAgICAgICAgICAgICBtX29zIDw8ICIvPiI7CisgICAgICAgICAgICAgICAgbV90YWdJc09wZW4gPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIG1fb3MgPDwgbV9pbmRlbnQgPDwgIjwvIiA8PCBtX3RhZ3MuYmFjaygpIDw8ICI+IjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1fb3MgPDwgc3RkOjplbmRsOworICAgICAgICAgICAgbV90YWdzLnBvcF9iYWNrKCk7CisgICAgICAgICAgICByZXR1cm4gKnRoa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UgKSB7CisgICAgICAgICAgICBpZiggIXRleHQuZW1wdHkoKSApeworICAgICAgICAgICAgICAgIGJvb2wgdGFnV2FzT3BlbiA9IG1fdGFnSXNPcGVuOworICAgICAgICAgICAgICAgIGVuc3VyZVRhZ0Nsb3NlZCgpOworICAgICAgICAgICAgICAgIGlmKCB0YWdXYXNPcGVuICYmIGluZGVudCApCisgICAgICAgICAgICAgICAgICAgIG1fb3MgPDwgbV9pbmRlbnQ7CisgICAgICAgICAgICAgICAgbV9vcyA8PCBYbWxFbmNvZGUoIHRleHQgKTsKKyAgICAgICAgICAgICAgICBtX25lZWRzTmV3bGluZSA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKworICAgICAgICBYbWxXcml0ZXImIHdyaXRlQ29tbWVudCggc3RkOjpzdHJpbmcgY29uc3QmIHRleHQgKSB7CisgICAgICAgICAgICBlbnN1cmVUYWdDbG9zZWQoKTsKKyAgICAgICAgICAgIG1fb3MgPDwgbV9pbmRlbnQgPDwgIjwhLS0iIDw8IHRleHQgPDwgIi0tPiI7CisgICAgICAgICAgICBtX25lZWRzTmV3bGluZSA9IHRydWU7CisgICAgICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIHdyaXRlU3R5bGVzaGVldFJlZiggc3RkOjpzdHJpbmcgY29uc3QmIHVybCApIHsKKyAgICAgICAgICAgIG1fb3MgPDwgIjw/eG1sLXN0eWxlc2hlZXQgdHlwZT1cInRleHQveHNsXCIgaHJlZj1cIiIgPDwgdXJsIDw8ICJcIj8+XG4iOworICAgICAgICB9CisKKyAgICAgICAgWG1sV3JpdGVyJiB3cml0ZUJsYW5rTGluZSgpIHsKKyAgICAgICAgICAgIGVuc3VyZVRhZ0Nsb3NlZCgpOworICAgICAgICAgICAgbV9vcyA8PCAnXG4nOworICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBlbnN1cmVUYWdDbG9zZWQoKSB7CisgICAgICAgICAgICBpZiggbV90YWdJc09wZW4gKSB7CisgICAgICAgICAgICAgICAgbV9vcyA8PCAiPiIgPDwgc3RkOjplbmRsOworICAgICAgICAgICAgICAgIG1fdGFnSXNPcGVuID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICAgIFhtbFdyaXRlciggWG1sV3JpdGVyIGNvbnN0JiApOworICAgICAgICB2b2lkIG9wZXJhdG9yPSggWG1sV3JpdGVyIGNvbnN0JiApOworCisgICAgICAgIHZvaWQgd3JpdGVEZWNsYXJhdGlvbigpIHsKKyAgICAgICAgICAgIG1fb3MgPDwgIjw/eG1sIHZlcnNpb249XCIxLjBcIiBlbmNvZGluZz1cIlVURi04XCI/PlxuIjsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgbmV3bGluZUlmTmVjZXNzYXJ5KCkgeworICAgICAgICAgICAgaWYoIG1fbmVlZHNOZXdsaW5lICkgeworICAgICAgICAgICAgICAgIG1fb3MgPDwgc3RkOjplbmRsOworICAgICAgICAgICAgICAgIG1fbmVlZHNOZXdsaW5lID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBib29sIG1fdGFnSXNPcGVuOworICAgICAgICBib29sIG1fbmVlZHNOZXdsaW5lOworICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gbV90YWdzOworICAgICAgICBzdGQ6OnN0cmluZyBtX2luZGVudDsKKyAgICAgICAgc3RkOjpvc3RyZWFtJiBtX29zOworICAgIH07CisKK30KKy8vICNpbmNsdWRlZCBmcm9tOiBjYXRjaF9yZWVuYWJsZV93YXJuaW5ncy5oCisKKyNkZWZpbmUgVFdPQkxVRUNVQkVTX0NBVENIX1JFRU5BQkxFX1dBUk5JTkdTX0hfSU5DTFVERUQKKworI2lmZGVmIF9fY2xhbmdfXworIyAgICBpZmRlZiBfX0lDQyAvLyBpY3BjIGRlZmluZXMgdGhlIF9fY2xhbmdfXyBtYWNybworIyAgICAgICAgcHJhZ21hIHdhcm5pbmcocG9wKQorIyAgICBlbHNlCisjICAgICAgICBwcmFnbWEgY2xhbmcgZGlhZ25vc3RpYyBwb3AKKyMgICAgZW5kaWYKKyNlbGlmIGRlZmluZWQgX19HTlVDX18KKyMgICAgcHJhZ21hIEdDQyBkaWFnbm9zdGljIHBvcAorI2VuZGlmCisKKworbmFtZXNwYWNlIENhdGNoIHsKKyAgICBjbGFzcyBYbWxSZXBvcnRlciA6IHB1YmxpYyBTdHJlYW1pbmdSZXBvcnRlckJhc2UgeworICAgIHB1YmxpYzoKKyAgICAgICAgWG1sUmVwb3J0ZXIoIFJlcG9ydGVyQ29uZmlnIGNvbnN0JiBfY29uZmlnICkKKyAgICAgICAgOiAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZSggX2NvbmZpZyApLAorICAgICAgICAgICAgbV94bWwoX2NvbmZpZy5zdHJlYW0oKSksCisgICAgICAgICAgICBtX3NlY3Rpb25EZXB0aCggMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIG1fcmVwb3J0ZXJQcmVmcy5zaG91bGRSZWRpcmVjdFN0ZE91dCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIH5YbWxSZXBvcnRlcigpIENBVENIX09WRVJSSURFOworCisgICAgICAgIHN0YXRpYyBzdGQ6OnN0cmluZyBnZXREZXNjcmlwdGlvbigpIHsKKyAgICAgICAgICAgIHJldHVybiAiUmVwb3J0cyB0ZXN0IHJlc3VsdHMgYXMgYW4gWE1MIGRvY3VtZW50IjsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgc3RkOjpzdHJpbmcgZ2V0U3R5bGVzaGVldFJlZigpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBzdGQ6OnN0cmluZygpOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCB3cml0ZVNvdXJjZUluZm8oIFNvdXJjZUxpbmVJbmZvIGNvbnN0JiBzb3VyY2VJbmZvICkgeworICAgICAgICAgICAgbV94bWwKKyAgICAgICAgICAgICAgICAud3JpdGVBdHRyaWJ1dGUoICJmaWxlbmFtZSIsIHNvdXJjZUluZm8uZmlsZSApCisgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAibGluZSIsIHNvdXJjZUluZm8ubGluZSApOworICAgICAgICB9CisKKyAgICBwdWJsaWM6IC8vIFN0cmVhbWluZ1JlcG9ydGVyQmFzZQorCisgICAgICAgIHZpcnR1YWwgdm9pZCBub01hdGNoaW5nVGVzdENhc2VzKCBzdGQ6OnN0cmluZyBjb25zdCYgcyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZTo6bm9NYXRjaGluZ1Rlc3RDYXNlcyggcyApOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIHRlc3RSdW5TdGFydGluZyggVGVzdFJ1bkluZm8gY29uc3QmIHRlc3RJbmZvICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgU3RyZWFtaW5nUmVwb3J0ZXJCYXNlOjp0ZXN0UnVuU3RhcnRpbmcoIHRlc3RJbmZvICk7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBzdHlsZXNoZWV0UmVmID0gZ2V0U3R5bGVzaGVldFJlZigpOworICAgICAgICAgICAgaWYoICFzdHlsZXNoZWV0UmVmLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgIG1feG1sLndyaXRlU3R5bGVzaGVldFJlZiggc3R5bGVzaGVldFJlZiApOworICAgICAgICAgICAgbV94bWwuc3RhcnRFbGVtZW50KCAiQ2F0Y2giICk7CisgICAgICAgICAgICBpZiggIW1fY29uZmlnLT5uYW1lKCkuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgbV94bWwud3JpdGVBdHRyaWJ1dGUoICJuYW1lIiwgbV9jb25maWctPm5hbWUoKSApOworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIHRlc3RHcm91cFN0YXJ0aW5nKCBHcm91cEluZm8gY29uc3QmIGdyb3VwSW5mbyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZTo6dGVzdEdyb3VwU3RhcnRpbmcoIGdyb3VwSW5mbyApOworICAgICAgICAgICAgbV94bWwuc3RhcnRFbGVtZW50KCAiR3JvdXAiICkKKyAgICAgICAgICAgICAgICAud3JpdGVBdHRyaWJ1dGUoICJuYW1lIiwgZ3JvdXBJbmZvLm5hbWUgKTsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgdm9pZCB0ZXN0Q2FzZVN0YXJ0aW5nKCBUZXN0Q2FzZUluZm8gY29uc3QmIHRlc3RJbmZvICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgU3RyZWFtaW5nUmVwb3J0ZXJCYXNlOjp0ZXN0Q2FzZVN0YXJ0aW5nKHRlc3RJbmZvKTsKKyAgICAgICAgICAgIG1feG1sLnN0YXJ0RWxlbWVudCggIlRlc3RDYXNlIiApCisgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAibmFtZSIsIHRyaW0oIHRlc3RJbmZvLm5hbWUgKSApCisgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAiZGVzY3JpcHRpb24iLCB0ZXN0SW5mby5kZXNjcmlwdGlvbiApCisgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAidGFncyIsIHRlc3RJbmZvLnRhZ3NBc1N0cmluZyApOworCisgICAgICAgICAgICB3cml0ZVNvdXJjZUluZm8oIHRlc3RJbmZvLmxpbmVJbmZvICk7CisKKyAgICAgICAgICAgIGlmICggbV9jb25maWctPnNob3dEdXJhdGlvbnMoKSA9PSBTaG93RHVyYXRpb25zOjpBbHdheXMgKQorICAgICAgICAgICAgICAgIG1fdGVzdENhc2VUaW1lci5zdGFydCgpOworICAgICAgICAgICAgbV94bWwuZW5zdXJlVGFnQ2xvc2VkKCk7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgc2VjdGlvblN0YXJ0aW5nKCBTZWN0aW9uSW5mbyBjb25zdCYgc2VjdGlvbkluZm8gKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICBTdHJlYW1pbmdSZXBvcnRlckJhc2U6OnNlY3Rpb25TdGFydGluZyggc2VjdGlvbkluZm8gKTsKKyAgICAgICAgICAgIGlmKCBtX3NlY3Rpb25EZXB0aCsrID4gMCApIHsKKyAgICAgICAgICAgICAgICBtX3htbC5zdGFydEVsZW1lbnQoICJTZWN0aW9uIiApCisgICAgICAgICAgICAgICAgICAgIC53cml0ZUF0dHJpYnV0ZSggIm5hbWUiLCB0cmltKCBzZWN0aW9uSW5mby5uYW1lICkgKQorICAgICAgICAgICAgICAgICAgICAud3JpdGVBdHRyaWJ1dGUoICJkZXNjcmlwdGlvbiIsIHNlY3Rpb25JbmZvLmRlc2NyaXB0aW9uICk7CisgICAgICAgICAgICAgICAgd3JpdGVTb3VyY2VJbmZvKCBzZWN0aW9uSW5mby5saW5lSW5mbyApOworICAgICAgICAgICAgICAgIG1feG1sLmVuc3VyZVRhZ0Nsb3NlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIGFzc2VydGlvblN0YXJ0aW5nKCBBc3NlcnRpb25JbmZvIGNvbnN0JiApIENBVENIX09WRVJSSURFIHsgfQorCisgICAgICAgIHZpcnR1YWwgYm9vbCBhc3NlcnRpb25FbmRlZCggQXNzZXJ0aW9uU3RhdHMgY29uc3QmIGFzc2VydGlvblN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworCisgICAgICAgICAgICBBc3NlcnRpb25SZXN1bHQgY29uc3QmIHJlc3VsdCA9IGFzc2VydGlvblN0YXRzLmFzc2VydGlvblJlc3VsdDsKKworICAgICAgICAgICAgYm9vbCBpbmNsdWRlUmVzdWx0cyA9IG1fY29uZmlnLT5pbmNsdWRlU3VjY2Vzc2Z1bFJlc3VsdHMoKSB8fCAhcmVzdWx0LmlzT2soKTsKKworICAgICAgICAgICAgaWYoIGluY2x1ZGVSZXN1bHRzICkgeworICAgICAgICAgICAgICAgIC8vIFByaW50IGFueSBpbmZvIG1lc3NhZ2VzIGluIDxJbmZvPiB0YWdzLgorICAgICAgICAgICAgICAgIGZvciggc3RkOjp2ZWN0b3I8TWVzc2FnZUluZm8+Ojpjb25zdF9pdGVyYXRvciBpdCA9IGFzc2VydGlvblN0YXRzLmluZm9NZXNzYWdlcy5iZWdpbigpLCBpdEVuZCA9IGFzc2VydGlvblN0YXRzLmluZm9NZXNzYWdlcy5lbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICAgICAgKytpdCApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYoIGl0LT50eXBlID09IFJlc3VsdFdhczo6SW5mbyApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1feG1sLnNjb3BlZEVsZW1lbnQoICJJbmZvIiApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC53cml0ZVRleHQoIGl0LT5tZXNzYWdlICk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIGl0LT50eXBlID09IFJlc3VsdFdhczo6V2FybmluZyApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1feG1sLnNjb3BlZEVsZW1lbnQoICJXYXJuaW5nIiApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC53cml0ZVRleHQoIGl0LT5tZXNzYWdlICk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIERyb3Agb3V0IGlmIHJlc3VsdCB3YXMgc3VjY2Vzc2Z1bCBidXQgd2UncmUgbm90IHByaW50aW5nIHRoZW0uCisgICAgICAgICAgICBpZiggIWluY2x1ZGVSZXN1bHRzICYmIHJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgIT0gUmVzdWx0V2FzOjpXYXJuaW5nICkKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKworICAgICAgICAgICAgLy8gUHJpbnQgdGhlIGV4cHJlc3Npb24gaWYgdGhlcmUgaXMgb25lLgorICAgICAgICAgICAgaWYoIHJlc3VsdC5oYXNFeHByZXNzaW9uKCkgKSB7CisgICAgICAgICAgICAgICAgbV94bWwuc3RhcnRFbGVtZW50KCAiRXhwcmVzc2lvbiIgKQorICAgICAgICAgICAgICAgICAgICAud3JpdGVBdHRyaWJ1dGUoICJzdWNjZXNzIiwgcmVzdWx0LnN1Y2NlZWRlZCgpICkKKyAgICAgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAidHlwZSIsIHJlc3VsdC5nZXRUZXN0TWFjcm9OYW1lKCkgKTsKKworICAgICAgICAgICAgICAgIHdyaXRlU291cmNlSW5mbyggcmVzdWx0LmdldFNvdXJjZUluZm8oKSApOworCisgICAgICAgICAgICAgICAgbV94bWwuc2NvcGVkRWxlbWVudCggIk9yaWdpbmFsIiApCisgICAgICAgICAgICAgICAgICAgIC53cml0ZVRleHQoIHJlc3VsdC5nZXRFeHByZXNzaW9uKCkgKTsKKyAgICAgICAgICAgICAgICBtX3htbC5zY29wZWRFbGVtZW50KCAiRXhwYW5kZWQiICkKKyAgICAgICAgICAgICAgICAgICAgLndyaXRlVGV4dCggcmVzdWx0LmdldEV4cGFuZGVkRXhwcmVzc2lvbigpICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEFuZC4uLiBQcmludCBhIHJlc3VsdCBhcHBsaWNhYmxlIHRvIGVhY2ggcmVzdWx0IHR5cGUuCisgICAgICAgICAgICBzd2l0Y2goIHJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgKSB7CisgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OlRocmV3RXhjZXB0aW9uOgorICAgICAgICAgICAgICAgICAgICBtX3htbC5zdGFydEVsZW1lbnQoICJFeGNlcHRpb24iICk7CisgICAgICAgICAgICAgICAgICAgIHdyaXRlU291cmNlSW5mbyggcmVzdWx0LmdldFNvdXJjZUluZm8oKSApOworICAgICAgICAgICAgICAgICAgICBtX3htbC53cml0ZVRleHQoIHJlc3VsdC5nZXRNZXNzYWdlKCkgKTsKKyAgICAgICAgICAgICAgICAgICAgbV94bWwuZW5kRWxlbWVudCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6RmF0YWxFcnJvckNvbmRpdGlvbjoKKyAgICAgICAgICAgICAgICAgICAgbV94bWwuc3RhcnRFbGVtZW50KCAiRmF0YWxFcnJvckNvbmRpdGlvbiIgKTsKKyAgICAgICAgICAgICAgICAgICAgd3JpdGVTb3VyY2VJbmZvKCByZXN1bHQuZ2V0U291cmNlSW5mbygpICk7CisgICAgICAgICAgICAgICAgICAgIG1feG1sLndyaXRlVGV4dCggcmVzdWx0LmdldE1lc3NhZ2UoKSApOworICAgICAgICAgICAgICAgICAgICBtX3htbC5lbmRFbGVtZW50KCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpJbmZvOgorICAgICAgICAgICAgICAgICAgICBtX3htbC5zY29wZWRFbGVtZW50KCAiSW5mbyIgKQorICAgICAgICAgICAgICAgICAgICAgICAgLndyaXRlVGV4dCggcmVzdWx0LmdldE1lc3NhZ2UoKSApOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6V2FybmluZzoKKyAgICAgICAgICAgICAgICAgICAgLy8gV2FybmluZyB3aWxsIGFscmVhZHkgaGF2ZSBiZWVuIHdyaXR0ZW4KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkV4cGxpY2l0RmFpbHVyZToKKyAgICAgICAgICAgICAgICAgICAgbV94bWwuc3RhcnRFbGVtZW50KCAiRmFpbHVyZSIgKTsKKyAgICAgICAgICAgICAgICAgICAgd3JpdGVTb3VyY2VJbmZvKCByZXN1bHQuZ2V0U291cmNlSW5mbygpICk7CisgICAgICAgICAgICAgICAgICAgIG1feG1sLndyaXRlVGV4dCggcmVzdWx0LmdldE1lc3NhZ2UoKSApOworICAgICAgICAgICAgICAgICAgICBtX3htbC5lbmRFbGVtZW50KCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiggcmVzdWx0Lmhhc0V4cHJlc3Npb24oKSApCisgICAgICAgICAgICAgICAgbV94bWwuZW5kRWxlbWVudCgpOworCisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHZpcnR1YWwgdm9pZCBzZWN0aW9uRW5kZWQoIFNlY3Rpb25TdGF0cyBjb25zdCYgc2VjdGlvblN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgU3RyZWFtaW5nUmVwb3J0ZXJCYXNlOjpzZWN0aW9uRW5kZWQoIHNlY3Rpb25TdGF0cyApOworICAgICAgICAgICAgaWYoIC0tbV9zZWN0aW9uRGVwdGggPiAwICkgeworICAgICAgICAgICAgICAgIFhtbFdyaXRlcjo6U2NvcGVkRWxlbWVudCBlID0gbV94bWwuc2NvcGVkRWxlbWVudCggIk92ZXJhbGxSZXN1bHRzIiApOworICAgICAgICAgICAgICAgIGUud3JpdGVBdHRyaWJ1dGUoICJzdWNjZXNzZXMiLCBzZWN0aW9uU3RhdHMuYXNzZXJ0aW9ucy5wYXNzZWQgKTsKKyAgICAgICAgICAgICAgICBlLndyaXRlQXR0cmlidXRlKCAiZmFpbHVyZXMiLCBzZWN0aW9uU3RhdHMuYXNzZXJ0aW9ucy5mYWlsZWQgKTsKKyAgICAgICAgICAgICAgICBlLndyaXRlQXR0cmlidXRlKCAiZXhwZWN0ZWRGYWlsdXJlcyIsIHNlY3Rpb25TdGF0cy5hc3NlcnRpb25zLmZhaWxlZEJ1dE9rICk7CisKKyAgICAgICAgICAgICAgICBpZiAoIG1fY29uZmlnLT5zaG93RHVyYXRpb25zKCkgPT0gU2hvd0R1cmF0aW9uczo6QWx3YXlzICkKKyAgICAgICAgICAgICAgICAgICAgZS53cml0ZUF0dHJpYnV0ZSggImR1cmF0aW9uSW5TZWNvbmRzIiwgc2VjdGlvblN0YXRzLmR1cmF0aW9uSW5TZWNvbmRzICk7CisKKyAgICAgICAgICAgICAgICBtX3htbC5lbmRFbGVtZW50KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgdGVzdENhc2VFbmRlZCggVGVzdENhc2VTdGF0cyBjb25zdCYgdGVzdENhc2VTdGF0cyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZTo6dGVzdENhc2VFbmRlZCggdGVzdENhc2VTdGF0cyApOworICAgICAgICAgICAgWG1sV3JpdGVyOjpTY29wZWRFbGVtZW50IGUgPSBtX3htbC5zY29wZWRFbGVtZW50KCAiT3ZlcmFsbFJlc3VsdCIgKTsKKyAgICAgICAgICAgIGUud3JpdGVBdHRyaWJ1dGUoICJzdWNjZXNzIiwgdGVzdENhc2VTdGF0cy50b3RhbHMuYXNzZXJ0aW9ucy5hbGxPaygpICk7CisKKyAgICAgICAgICAgIGlmICggbV9jb25maWctPnNob3dEdXJhdGlvbnMoKSA9PSBTaG93RHVyYXRpb25zOjpBbHdheXMgKQorICAgICAgICAgICAgICAgIGUud3JpdGVBdHRyaWJ1dGUoICJkdXJhdGlvbkluU2Vjb25kcyIsIG1fdGVzdENhc2VUaW1lci5nZXRFbGFwc2VkU2Vjb25kcygpICk7CisKKyAgICAgICAgICAgIGlmKCAhdGVzdENhc2VTdGF0cy5zdGRPdXQuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgbV94bWwuc2NvcGVkRWxlbWVudCggIlN0ZE91dCIgKS53cml0ZVRleHQoIHRyaW0oIHRlc3RDYXNlU3RhdHMuc3RkT3V0ICksIGZhbHNlICk7CisgICAgICAgICAgICBpZiggIXRlc3RDYXNlU3RhdHMuc3RkRXJyLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgIG1feG1sLnNjb3BlZEVsZW1lbnQoICJTdGRFcnIiICkud3JpdGVUZXh0KCB0cmltKCB0ZXN0Q2FzZVN0YXRzLnN0ZEVyciApLCBmYWxzZSApOworCisgICAgICAgICAgICBtX3htbC5lbmRFbGVtZW50KCk7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgdGVzdEdyb3VwRW5kZWQoIFRlc3RHcm91cFN0YXRzIGNvbnN0JiB0ZXN0R3JvdXBTdGF0cyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZTo6dGVzdEdyb3VwRW5kZWQoIHRlc3RHcm91cFN0YXRzICk7CisgICAgICAgICAgICAvLyBUT0RPOiBDaGVjayB0ZXN0R3JvdXBTdGF0cy5hYm9ydGluZyBhbmQgYWN0IGFjY29yZGluZ2x5LgorICAgICAgICAgICAgbV94bWwuc2NvcGVkRWxlbWVudCggIk92ZXJhbGxSZXN1bHRzIiApCisgICAgICAgICAgICAgICAgLndyaXRlQXR0cmlidXRlKCAic3VjY2Vzc2VzIiwgdGVzdEdyb3VwU3RhdHMudG90YWxzLmFzc2VydGlvbnMucGFzc2VkICkKKyAgICAgICAgICAgICAgICAud3JpdGVBdHRyaWJ1dGUoICJmYWlsdXJlcyIsIHRlc3RHcm91cFN0YXRzLnRvdGFscy5hc3NlcnR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OworICAgICAgICB9CisKKyAgICAgICAgdmlydHVhbCB2b2lkIHRlc3RSdW5FbmRlZEN1bXVsYXRpdmUoKSBDQVRDSF9PVkVSUklERSB7CisgICAgICAgICAgICB4bWwuZW5kRWxlbWVudCgpOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCB3cml0ZUdyb3VwKCBUZXN0R3JvdXBOb2RlIGNvbnN0JiBncm91cE5vZGUsIGRvdWJsZSBzdWl0ZVRpbWUgKSB7CisgICAgICAgICAgICBYbWxXcml0ZXI6OlNjb3BlZEVsZW1lbnQgZSA9IHhtbC5zY29wZWRFbGVtZW50KCAidGVzdHN1aXRlIiApOworICAgICAgICAgICAgVGVzdEdyb3VwU3RhdHMgY29uc3QmIHN0YXRzID0gZ3JvdXBOb2RlLnZhbHVlOworICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAibmFtZSIsIHN0YXRzLmdyb3VwSW5mby5uYW1lICk7CisgICAgICAgICAgICB4bWwud3JpdGVBdHRyaWJ1dGUoICJlcnJvcnMiLCB1bmV4cGVjdGVkRXhjZXB0aW9ucyApOworICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAiZmFpbHVyZXMiLCBzdGF0cy50b3RhbHMuYXNzZXJ0aW9ucy5mYWlsZWQtdW5leHBlY3RlZEV4Y2VwdGlvbnMgKTsKKyAgICAgICAgICAgIHhtbC53cml0ZUF0dHJpYnV0ZSggInRlc3RzIiwgc3RhdHMudG90YWxzLmFzc2VydGlvbnMudG90YWwoKSApOworICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAiaG9zdG5hbWUiLCAidGJkIiApOyAvLyAhVEJECisgICAgICAgICAgICBpZiggbV9jb25maWctPnNob3dEdXJhdGlvbnMoKSA9PSBTaG93RHVyYXRpb25zOjpOZXZlciApCisgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAidGltZSIsICIiICk7CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAidGltZSIsIHN1aXRlVGltZSApOworICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAidGltZXN0YW1wIiwgZ2V0Q3VycmVudFRpbWVzdGFtcCgpICk7CisKKyAgICAgICAgICAgIC8vIFdyaXRlIHRlc3QgY2FzZXMKKyAgICAgICAgICAgIGZvciggVGVzdEdyb3VwTm9kZTo6Q2hpbGROb2Rlczo6Y29uc3RfaXRlcmF0b3IKKyAgICAgICAgICAgICAgICAgICAgaXQgPSBncm91cE5vZGUuY2hpbGRyZW4uYmVnaW4oKSwgaXRFbmQgPSBncm91cE5vZGUuY2hpbGRyZW4uZW5kKCk7CisgICAgICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICAgICArK2l0ICkKKyAgICAgICAgICAgICAgICB3cml0ZVRlc3RDYXNlKCAqKml0ICk7CisKKyAgICAgICAgICAgIHhtbC5zY29wZWRFbGVtZW50KCAic3lzdGVtLW91dCIgKS53cml0ZVRleHQoIHRyaW0oIHN0ZE91dEZvclN1aXRlLnN0cigpICksIGZhbHNlICk7CisgICAgICAgICAgICB4bWwuc2NvcGVkRWxlbWVudCggInN5c3RlbS1lcnIiICkud3JpdGVUZXh0KCB0cmltKCBzdGRFcnJGb3JTdWl0ZS5zdHIoKSApLCBmYWxzZSApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCB3cml0ZVRlc3RDYXNlKCBUZXN0Q2FzZU5vZGUgY29uc3QmIHRlc3RDYXNlTm9kZSApIHsKKyAgICAgICAgICAgIFRlc3RDYXNlU3RhdHMgY29uc3QmIHN0YXRzID0gdGVzdENhc2VOb2RlLnZhbHVlOworCisgICAgICAgICAgICAvLyBBbGwgdGVzdCBjYXNlcyBoYXZlIGV4YWN0bHkgb25lIHNlY3Rpb24gLSB3aGljaCByZXByZXNlbnRzIHRoZQorICAgICAgICAgICAgLy8gdGVzdCBjYXNlIGl0c2VsZi4gVGhhdCBzZWN0aW9uIG1heSBoYXZlIDAtbiBuZXN0ZWQgc2VjdGlvbnMKKyAgICAgICAgICAgIGFzc2VydCggdGVzdENhc2VOb2RlLmNoaWxkcmVuLnNpemUoKSA9PSAxICk7CisgICAgICAgICAgICBTZWN0aW9uTm9kZSBjb25zdCYgcm9vdFNlY3Rpb24gPSAqdGVzdENhc2VOb2RlLmNoaWxkcmVuLmZyb250KCk7CisKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGNsYXNzTmFtZSA9IHN0YXRzLnRlc3RJbmZvLmNsYXNzTmFtZTsKKworICAgICAgICAgICAgaWYoIGNsYXNzTmFtZS5lbXB0eSgpICkgeworICAgICAgICAgICAgICAgIGlmKCByb290U2VjdGlvbi5jaGlsZFNlY3Rpb25zLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWUgPSAiZ2xvYmFsIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHdyaXRlU2VjdGlvbiggY2xhc3NOYW1lLCAiIiwgcm9vdFNlY3Rpb24gKTsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgd3JpdGVTZWN0aW9uKCAgc3RkOjpzdHJpbmcgY29uc3QmIGNsYXNzTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBjb25zdCYgcm9vdE5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VjdGlvbk5vZGUgY29uc3QmIHNlY3Rpb25Ob2RlICkgeworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbmFtZSA9IHRyaW0oIHNlY3Rpb25Ob2RlLnN0YXRzLnNlY3Rpb25JbmZvLm5hbWUgKTsKKyAgICAgICAgICAgIGlmKCAhcm9vdE5hbWUuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgbmFtZSA9IHJvb3ROYW1lICsgJy8nICsgbmFtZTsKKworICAgICAgICAgICAgaWYoICFzZWN0aW9uTm9kZS5hc3NlcnRpb25zLmVtcHR5KCkgfHwKKyAgICAgICAgICAgICAgICAhc2VjdGlvbk5vZGUuc3RkT3V0LmVtcHR5KCkgfHwKKyAgICAgICAgICAgICAgICAhc2VjdGlvbk5vZGUuc3RkRXJyLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgWG1sV3JpdGVyOjpTY29wZWRFbGVtZW50IGUgPSB4bWwuc2NvcGVkRWxlbWVudCggInRlc3RjYXNlIiApOworICAgICAgICAgICAgICAgIGlmKCBjbGFzc05hbWUuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAiY2xhc3NuYW1lIiwgbmFtZSApOworICAgICAgICAgICAgICAgICAgICB4bWwud3JpdGVBdHRyaWJ1dGUoICJuYW1lIiwgInJvb3QiICk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgICB4bWwud3JpdGVBdHRyaWJ1dGUoICJjbGFzc25hbWUiLCBjbGFzc05hbWUgKTsKKyAgICAgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAibmFtZSIsIG5hbWUgKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAidGltZSIsIENhdGNoOjp0b1N0cmluZyggc2VjdGlvbk5vZGUuc3RhdHMuZHVyYXRpb25JblNlY29uZHMgKSApOworCisgICAgICAgICAgICAgICAgd3JpdGVBc3NlcnRpb25zKCBzZWN0aW9uTm9kZSApOworCisgICAgICAgICAgICAgICAgaWYoICFzZWN0aW9uTm9kZS5zdGRPdXQuZW1wdHkoKSApCisgICAgICAgICAgICAgICAgICAgIHhtbC5zY29wZWRFbGVtZW50KCAic3lzdGVtLW91dCIgKS53cml0ZVRleHQoIHRyaW0oIHNlY3Rpb25Ob2RlLnN0ZE91dCApLCBmYWxzZSApOworICAgICAgICAgICAgICAgIGlmKCAhc2VjdGlvbk5vZGUuc3RkRXJyLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICB4bWwuc2NvcGVkRWxlbWVudCggInN5c3RlbS1lcnIiICkud3JpdGVUZXh0KCB0cmltKCBzZWN0aW9uTm9kZS5zdGRFcnIgKSwgZmFsc2UgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciggU2VjdGlvbk5vZGU6OkNoaWxkU2VjdGlvbnM6OmNvbnN0X2l0ZXJhdG9yCisgICAgICAgICAgICAgICAgICAgIGl0ID0gc2VjdGlvbk5vZGUuY2hpbGRTZWN0aW9ucy5iZWdpbigpLAorICAgICAgICAgICAgICAgICAgICBpdEVuZCA9IHNlY3Rpb25Ob2RlLmNoaWxkU2VjdGlvbnMuZW5kKCk7CisgICAgICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICAgICArK2l0ICkKKyAgICAgICAgICAgICAgICBpZiggY2xhc3NOYW1lLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICB3cml0ZVNlY3Rpb24oIG5hbWUsICIiLCAqKml0ICk7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB3cml0ZVNlY3Rpb24oIGNsYXNzTmFtZSwgbmFtZSwgKippdCApOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCB3cml0ZUFzc2VydGlvbnMoIFNlY3Rpb25Ob2RlIGNvbnN0JiBzZWN0aW9uTm9kZSApIHsKKyAgICAgICAgICAgIGZvciggU2VjdGlvbk5vZGU6OkFzc2VydGlvbnM6OmNvbnN0X2l0ZXJhdG9yCisgICAgICAgICAgICAgICAgICAgIGl0ID0gc2VjdGlvbk5vZGUuYXNzZXJ0aW9ucy5iZWdpbigpLCBpdEVuZCA9IHNlY3Rpb25Ob2RlLmFzc2VydGlvbnMuZW5kKCk7CisgICAgICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICAgICArK2l0ICkKKyAgICAgICAgICAgICAgICB3cml0ZUFzc2VydGlvbiggKml0ICk7CisgICAgICAgIH0KKyAgICAgICAgdm9pZCB3cml0ZUFzc2VydGlvbiggQXNzZXJ0aW9uU3RhdHMgY29uc3QmIHN0YXRzICkgeworICAgICAgICAgICAgQXNzZXJ0aW9uUmVzdWx0IGNvbnN0JiByZXN1bHQgPSBzdGF0cy5hc3NlcnRpb25SZXN1bHQ7CisgICAgICAgICAgICBpZiggIXJlc3VsdC5pc09rKCkgKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZWxlbWVudE5hbWU7CisgICAgICAgICAgICAgICAgc3dpdGNoKCByZXN1bHQuZ2V0UmVzdWx0VHlwZSgpICkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VGhyZXdFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpGYXRhbEVycm9yQ29uZGl0aW9uOgorICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudE5hbWUgPSAiZXJyb3IiOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpFeHBsaWNpdEZhaWx1cmU6CisgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50TmFtZSA9ICJmYWlsdXJlIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6RXhwcmVzc2lvbkZhaWxlZDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnROYW1lID0gImZhaWx1cmUiOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpEaWRudFRocm93RXhjZXB0aW9uOgorICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudE5hbWUgPSAiZmFpbHVyZSI7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICAvLyBXZSBzaG91bGQgbmV2ZXIgc2VlIHRoZXNlIGhlcmU6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpJbmZvOgorICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6V2FybmluZzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6Ok9rOgorICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VW5rbm93bjoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkZhaWx1cmVCaXQ6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50TmFtZSA9ICJpbnRlcm5hbEVycm9yIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIFhtbFdyaXRlcjo6U2NvcGVkRWxlbWVudCBlID0geG1sLnNjb3BlZEVsZW1lbnQoIGVsZW1lbnROYW1lICk7CisKKyAgICAgICAgICAgICAgICB4bWwud3JpdGVBdHRyaWJ1dGUoICJtZXNzYWdlIiwgcmVzdWx0LmdldEV4cGFuZGVkRXhwcmVzc2lvbigpICk7CisgICAgICAgICAgICAgICAgeG1sLndyaXRlQXR0cmlidXRlKCAidHlwZSIsIHJlc3VsdC5nZXRUZXN0TWFjcm9OYW1lKCkgKTsKKworICAgICAgICAgICAgICAgIHN0ZDo6b3N0cmluZ3N0cmVhbSBvc3M7CisgICAgICAgICAgICAgICAgaWYoICFyZXN1bHQuZ2V0TWVzc2FnZSgpLmVtcHR5KCkgKQorICAgICAgICAgICAgICAgICAgICBvc3MgPDwgcmVzdWx0LmdldE1lc3NhZ2UoKSA8PCAnXG4nOworICAgICAgICAgICAgICAgIGZvciggc3RkOjp2ZWN0b3I8TWVzc2FnZUluZm8+Ojpjb25zdF9pdGVyYXRvcgorICAgICAgICAgICAgICAgICAgICAgICAgaXQgPSBzdGF0cy5pbmZvTWVzc2FnZXMuYmVnaW4oKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGl0RW5kID0gc3RhdHMuaW5mb01lc3NhZ2VzLmVuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ICE9IGl0RW5kOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICsraXQgKQorICAgICAgICAgICAgICAgICAgICBpZiggaXQtPnR5cGUgPT0gUmVzdWx0V2FzOjpJbmZvICkKKyAgICAgICAgICAgICAgICAgICAgICAgIG9zcyA8PCBpdC0+bWVzc2FnZSA8PCAnXG4nOworCisgICAgICAgICAgICAgICAgb3NzIDw8ICJhdCAiIDw8IHJlc3VsdC5nZXRTb3VyY2VJbmZvKCk7CisgICAgICAgICAgICAgICAgeG1sLndyaXRlVGV4dCggb3NzLnN0cigpLCBmYWxzZSApOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgWG1sV3JpdGVyIHhtbDsKKyAgICAgICAgVGltZXIgc3VpdGVUaW1lcjsKKyAgICAgICAgc3RkOjpvc3RyaW5nc3RyZWFtIHN0ZE91dEZvclN1aXRlOworICAgICAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gc3RkRXJyRm9yU3VpdGU7CisgICAgICAgIHVuc2lnbmVkIGludCB1bmV4cGVjdGVkRXhjZXB0aW9uczsKKyAgICAgICAgYm9vbCBtX29rVG9GYWlsOworICAgIH07CisKKyAgICBJTlRFUk5BTF9DQVRDSF9SRUdJU1RFUl9SRVBPUlRFUiggImp1bml0IiwgSnVuaXRSZXBvcnRlciApCisKK30gLy8gZW5kIG5hbWVzcGFjZSBDYXRjaAorCisvLyAjaW5jbHVkZWQgZnJvbTogLi4vcmVwb3J0ZXJzL2NhdGNoX3JlcG9ydGVyX2NvbnNvbGUuaHBwCisjZGVmaW5lIFRXT0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c3NlcnRpb25TdGF0cyApIENBVENIX09WRVJSSURFIHsKKyAgICAgICAgICAgIEFzc2VydGlvblJlc3VsdCBjb25zdCYgcmVzdWx0ID0gX2Fzc2VydGlvblN0YXRzLmFzc2VydGlvblJlc3VsdDsKKworICAgICAgICAgICAgYm9vbCBpbmNsdWRlUmVzdWx0cyA9IG1fY29uZmlnLT5pbmNsdWRlU3VjY2Vzc2Z1bFJlc3VsdHMoKSB8fCAhcmVzdWx0LmlzT2soKTsKKworICAgICAgICAgICAgLy8gRHJvcCBvdXQgaWYgcmVzdWx0IHdhcyBzdWNjZXNzZnVsIGJ1dCB3ZSdyZSBub3QgcHJpbnRpbmcgdGhlbS4KKyAgICAgICAgICAgIGlmKCAhaW5jbHVkZVJlc3VsdHMgJiYgcmVzdWx0LmdldFJlc3VsdFR5cGUoKSAhPSBSZXN1bHRXYXM6Oldhcm5pbmcgKQorICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKworICAgICAgICAgICAgbGF6eVByaW50KCk7CisKKyAgICAgICAgICAgIEFzc2VydGlvblByaW50ZXIgcHJpbnRlciggc3RyZWFtLCBfYXNzZXJ0aW9uU3RhdHMsIGluY2x1ZGVSZXN1bHRzICk7CisgICAgICAgICAgICBwcmludGVyLnByaW50KCk7CisgICAgICAgICAgICBzdHJlYW0gPDwgc3RkOjplbmRsOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICB2aXJ0dWFsIHZvaWQgc2VjdGlvblN0YXJ0aW5nKCBTZWN0aW9uSW5mbyBjb25zdCYgX3NlY3Rpb25JbmZvICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgbV9oZWFkZXJQcmludGVkID0gZmFsc2U7CisgICAgICAgICAgICBTdHJlYW1pbmdSZXBvcnRlckJhc2U6OnNlY3Rpb25TdGFydGluZyggX3NlY3Rpb25JbmZvICk7CisgICAgICAgIH0KKyAgICAgICAgdmlydHVhbCB2b2lkIHNlY3Rpb25FbmRlZCggU2VjdGlvblN0YXRzIGNvbnN0JiBfc2VjdGlvblN0YXRzICkgQ0FUQ0hfT1ZFUlJJREUgeworICAgICAgICAgICAgaWYoIF9zZWN0aW9uU3RhdHMubWlzc2luZ0Fzc2VydGlvbnMgKSB7CisgICAgICAgICAgICAgICAgbGF6eVByaW50KCk7CisgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ciggQ29sb3VyOjpSZXN1bHRFcnJvciApOworICAgICAgICAgICAgICAgIGlmKCBtX3NlY3Rpb25TdGFjay5zaXplKCkgPiAxICkKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8ICJcbk5vIGFzc2VydGlvbnMgaW4gc2VjdGlvbiI7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgIlxuTm8gYXNzZXJ0aW9ucyBpbiB0ZXN0IGNhc2UiOworICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAiICciIDw8IF9zZWN0aW9uU3RhdHMuc2VjdGlvbkluZm8ubmFtZSA8PCAiJ1xuIiA8PCBzdGQ6OmVuZGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiggbV9jb25maWctPnNob3dEdXJhdGlvbnMoKSA9PSBTaG93RHVyYXRpb25zOjpBbHdheXMgKSB7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8IGdldEZvcm1hdHRlZER1cmF0aW9uKF9zZWN0aW9uU3RhdHMuZHVyYXRpb25JblNlY29uZHMpIDw8ICIgczogIiA8PCBfc2VjdGlvblN0YXRzLnNlY3Rpb25JbmZvLm5hbWUgPDwgc3RkOjplbmRsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYoIG1faGVhZGVyUHJpbnRlZCApIHsKKyAgICAgICAgICAgICAgICBtX2hlYWRlclByaW50ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN0cmVhbWluZ1JlcG9ydGVyQmFzZTo6c2VjdGlv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XN0UnVuU3RhdHMudG90YWxzICk7CisgICAgICAgICAgICBwcmludFRvdGFscyggX3Rlc3RSdW5TdGF0cy50b3RhbHMgKTsKKyAgICAgICAgICAgIHN0cmVhbSA8PCBzdGQ6OmVuZGw7CisgICAgICAgICAgICBTdHJlYW1pbmdSZXBvcnRlckJhc2U6OnRlc3RSdW5FbmRlZCggX3Rlc3RSdW5TdGF0cyApOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorCisgICAgICAgIGNsYXNzIEFzc2VydGlvblByaW50ZXIgeworICAgICAgICAgICAgdm9pZCBvcGVyYXRvcj0gKCBBc3NlcnRpb25QcmludGVyIGNvbnN0JiApOworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICBBc3NlcnRpb25QcmludGVyKCBzdGQ6Om9zdHJlYW0mIF9zdHJlYW0sIEFzc2VydGlvblN0YXRzIGNvbnN0JiBfc3RhdHMsIGJvb2wgX3ByaW50SW5mb01lc3NhZ2VzICkKKyAgICAgICAgICAgIDogICBzdHJlYW0oIF9zdHJlYW0gKSwKKyAgICAgICAgICAgICAgICBzdGF0cyggX3N0YXRzICksCisgICAgICAgICAgICAgICAgcmVzdWx0KCBfc3RhdHMuYXNzZXJ0aW9uUmVzdWx0ICksCisgICAgICAgICAgICAgICAgY29sb3VyKCBDb2xvdXI6Ok5vbmUgKSwKKyAgICAgICAgICAgICAgICBtZXNzYWdlKCByZXN1bHQuZ2V0TWVzc2FnZSgpICksCisgICAgICAgICAgICAgICAgbWVzc2FnZXMoIF9zdGF0cy5pbmZvTWVzc2FnZXMgKSwKKyAgICAgICAgICAgICAgICBwcmludEluZm9NZXNzYWdlcyggX3ByaW50SW5mb01lc3NhZ2VzICkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2goIHJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpPazoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbG91ciA9IENvbG91cjo6U3VjY2VzczsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhc3NPckZhaWwgPSAiUEFTU0VEIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vaWYoIHJlc3VsdC5oYXNNZXNzYWdlKCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgaWYoIF9zdGF0cy5pbmZvTWVzc2FnZXMuc2l6ZSgpID09IDEgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VMYWJlbCA9ICJ3aXRoIG1lc3NhZ2UiOworICAgICAgICAgICAgICAgICAgICAgICAgaWYoIF9zdGF0cy5pbmZvTWVzc2FnZXMuc2l6ZSgpID4gMSApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUxhYmVsID0gIndpdGggbWVzc2FnZXMiOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpFeHByZXNzaW9uRmFpbGVkOgorICAgICAgICAgICAgICAgICAgICAgICAgaWYoIHJlc3VsdC5pc09rKCkgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3VyID0gQ29sb3VyOjpTdWNjZXNzOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhc3NPckZhaWwgPSAiRkFJTEVEIC0gYnV0IHdhcyBvayI7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvdXIgPSBDb2xvdXI6OkVycm9yOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhc3NPckZhaWwgPSAiRkFJTEVEIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBfc3RhdHMuaW5mb01lc3NhZ2VzLnNpemUoKSA9PSAxICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgPSAid2l0aCBtZXNzYWdlIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBfc3RhdHMuaW5mb01lc3NhZ2VzLnNpemUoKSA+IDEgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VMYWJlbCA9ICJ3aXRoIG1lc3NhZ2VzIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VGhyZXdFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBjb2xvdXIgPSBDb2xvdXI6OkVycm9yOworICAgICAgICAgICAgICAgICAgICAgICAgcGFzc09yRmFpbCA9ICJGQUlMRUQiOworICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUxhYmVsID0gImR1ZSB0byB1bmV4cGVjdGVkIGV4Y2VwdGlvbiB3aXRoICI7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoX3N0YXRzLmluZm9NZXNzYWdlcy5zaXplKCkgPT0gMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgKz0gIm1lc3NhZ2UiOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF9zdGF0cy5pbmZvTWVzc2FnZXMuc2l6ZSgpID4gMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgKz0gIm1lc3NhZ2VzIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6RmF0YWxFcnJvckNvbmRpdGlvbjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbG91ciA9IENvbG91cjo6RXJyb3I7CisgICAgICAgICAgICAgICAgICAgICAgICBwYXNzT3JGYWlsID0gIkZBSUxFRCI7CisgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgPSAiZHVlIHRvIGEgZmF0YWwgZXJyb3IgY29uZGl0aW9uIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6RGlkbnRUaHJvd0V4Y2VwdGlvbjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbG91ciA9IENvbG91cjo6RXJyb3I7CisgICAgICAgICAgICAgICAgICAgICAgICBwYXNzT3JGYWlsID0gIkZBSUxFRCI7CisgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgPSAiYmVjYXVzZSBubyBleGNlcHRpb24gd2FzIHRocm93biB3aGVyZSBvbmUgd2FzIGV4cGVjdGVkIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6SW5mbzoKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VMYWJlbCA9ICJpbmZvIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6V2FybmluZzoKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VMYWJlbCA9ICJ3YXJuaW5nIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6RXhwbGljaXRGYWlsdXJlOgorICAgICAgICAgICAgICAgICAgICAgICAgcGFzc09yRmFpbCA9ICJGQUlMRUQiOworICAgICAgICAgICAgICAgICAgICAgICAgY29sb3VyID0gQ29sb3VyOjpFcnJvcjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCBfc3RhdHMuaW5mb01lc3NhZ2VzLnNpemUoKSA9PSAxICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlTGFiZWwgPSAiZXhwbGljaXRseSB3aXRoIG1lc3NhZ2UiOworICAgICAgICAgICAgICAgICAgICAgICAgaWYoIF9zdGF0cy5pbmZvTWVzc2FnZXMuc2l6ZSgpID4gMSApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZUxhYmVsID0gImV4cGxpY2l0bHkgd2l0aCBtZXNzYWdlcyI7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlc2UgY2FzZXMgYXJlIGhlcmUgdG8gcHJldmVudCBjb21waWxlciB3YXJuaW5ncworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VW5rbm93bjoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkZhaWx1cmVCaXQ6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBwYXNzT3JGYWlsID0gIioqIGludGVybmFsIGVycm9yICoqIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbG91ciA9IENvbG91cjo6RXJyb3I7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZvaWQgcHJpbnQoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcHJpbnRTb3VyY2VJbmZvKCk7CisgICAgICAgICAgICAgICAgaWYoIHN0YXRzLnRvdGFscy5hc3NlcnRpb25zLnRvdGFsKCkgPiAwICkgeworICAgICAgICAgICAgICAgICAgICBpZiggcmVzdWx0LmlzT2soKSApCisgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgJ1xuJzsKKyAgICAgICAgICAgICAgICAgICAgcHJpbnRSZXN1bHRUeXBlKCk7CisgICAgICAgICAgICAgICAgICAgIHByaW50T3JpZ2luYWxFeHByZXNzaW9uKCk7CisgICAgICAgICAgICAgICAgICAgIHByaW50UmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24oKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAnXG4nOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBwcmludE1lc3NhZ2UoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgdm9pZCBwcmludFJlc3VsdFR5cGUoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgaWYoICFwYXNzT3JGYWlsLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgICAgIENvbG91ciBjb2xvdXJHdWFyZCggY29sb3VyICk7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBwYXNzT3JGYWlsIDw8ICI6XG4iOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgcHJpbnRPcmlnaW5hbEV4cHJlc3Npb24oKSBjb25zdCB7CisgICAgICAgICAgICAgICAgaWYoIHJlc3VsdC5oYXNFeHByZXNzaW9uKCkgKSB7CisgICAgICAgICAgICAgICAgICAgIENvbG91ciBjb2xvdXJHdWFyZCggQ29sb3VyOjpPcmlnaW5hbEV4cHJlc3Npb24gKTsKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtICA8PCAiICAiOworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgcmVzdWx0LmdldEV4cHJlc3Npb25Jbk1hY3JvKCk7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAnXG4nOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgcHJpbnRSZWNvbnN0cnVjdGVkRXhwcmVzc2lvbigpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBpZiggcmVzdWx0Lmhhc0V4cGFuZGVkRXhwcmVzc2lvbigpICkgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgIndpdGggZXhwYW5zaW9uOlxuIjsKKyAgICAgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBDb2xvdXI6OlJlY29uc3RydWN0ZWRFeHByZXNzaW9uICk7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBUZXh0KCByZXN1bHQuZ2V0RXhwYW5kZWRFeHByZXNzaW9uKCksIFRleHRBdHRyaWJ1dGVzKCkuc2V0SW5kZW50KDIpICkgPDwgJ1xuJzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIHByaW50TWVzc2FnZSgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBpZiggIW1lc3NhZ2VMYWJlbC5lbXB0eSgpICkKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8IG1lc3NhZ2VMYWJlbCA8PCAnOicgPDwgJ1xuJzsKKyAgICAgICAgICAgICAgICBmb3IoIHN0ZDo6dmVjdG9yPE1lc3NhZ2VJbmZvPjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBtZXNzYWdlcy5iZWdpbigpLCBpdEVuZCA9IG1lc3NhZ2VzLmVuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgaXQgIT0gaXRFbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICArK2l0ICkgeworICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGlzIGFzc2VydGlvbiBpcyBhIHdhcm5pbmcgaWdub3JlIGFueSBJTkZPIG1lc3NhZ2VzCisgICAgICAgICAgICAgICAgICAgIGlmKCBwcmludEluZm9NZXNzYWdlcyB8fCBpdC0+dHlwZSAhPSBSZXN1bHRXYXM6OkluZm8gKQorICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8IFRleHQoIGl0LT5tZXNzYWdlLCBUZXh0QXR0cmlidXRlcygpLnNldEluZGVudCgyKSApIDw8ICdcbic7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBwcmludFNvdXJjZUluZm8oKSBjb25zdCB7CisgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBDb2xvdXI6OkZpbGVOYW1lICk7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8IHJlc3VsdC5nZXRTb3VyY2VJbmZvKCkgPDwgIjogIjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RkOjpvc3RyZWFtJiBzdHJlYW07CisgICAgICAgICAgICBBc3NlcnRpb25TdGF0cyBjb25zdCYgc3RhdHM7CisgICAgICAgICAgICBBc3NlcnRpb25SZXN1bHQgY29uc3QmIHJlc3VsdDsKKyAgICAgICAgICAgIENvbG91cjo6Q29kZSBjb2xvdXI7CisgICAgICAgICAgICBzdGQ6OnN0cmluZyBwYXNzT3JGYWlsOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWVzc2FnZUxhYmVsOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgbWVzc2FnZTsKKyAgICAgICAgICAgIHN0ZDo6dmVjdG9yPE1lc3NhZ2VJbmZvPiBtZXNzYWdlczsKKyAgICAgICAgICAgIGJvb2wgcHJpbnRJbmZvTWVzc2FnZXM7CisgICAgICAgIH07CisKKyAgICAgICAgdm9pZCBsYXp5UHJpbnQoKSB7CisKKyAgICAgICAgICAgIGlmKCAhY3VycmVudFRlc3RSdW5JbmZvLnVzZWQgKQorICAgICAgICAgICAgICAgIGxhenlQcmludFJ1bkluZm8oKTsKKyAgICAgICAgICAgIGlmKCAhY3VycmVudEdyb3VwSW5mby51c2VkICkKKyAgICAgICAgICAgICAgICBsYXp5UHJpbnRHcm91cEluZm8oKTsKKworICAgICAgICAgICAgaWYoICFtX2hlYWRlclByaW50ZWQgKSB7CisgICAgICAgICAgICAgICAgcHJpbnRUZXN0Q2FzZUFuZFNlY3Rpb25IZWFkZXIoKTsKKyAgICAgICAgICAgICAgICBtX2hlYWRlclByaW50ZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHZvaWQgbGF6eVByaW50UnVuSW5mbygpIHsKKyAgICAgICAgICAgIHN0cmVhbSAgPDwgJ1xuJyA8PCBnZXRMaW5lT2ZDaGFyczwnfic+KCkgPDwgJ1xuJzsKKyAgICAgICAgICAgIENvbG91ciBjb2xvdXIoIENvbG91cjo6U2Vjb25kYXJ5VGV4dCApOworICAgICAgICAgICAgc3RyZWFtICA8PCBjdXJyZW50VGVzdFJ1bkluZm8tPm5hbWUKKyAgICAgICAgICAgICAgICAgICAgPDwgIiBpcyBhIENhdGNoIHYiICA8PCBsaWJyYXJ5VmVyc2lvbigpIDw8ICIgaG9zdCBhcHBsaWNhdGlvbi5cbiIKKyAgICAgICAgICAgICAgICAgICAgPDwgIlJ1biB3aXRoIC0/IGZvciBvcHRpb25zXG5cbiI7CisKKyAgICAgICAgICAgIGlmKCBtX2NvbmZpZy0+cm5nU2VlZCgpICE9IDAgKQorICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAiUmFuZG9tbmVzcyBzZWVkZWQgdG86ICIgPDwgbV9jb25maWctPnJuZ1NlZWQoKSA8PCAiXG5cbiI7CisKKyAgICAgICAgICAgIGN1cnJlbnRUZXN0UnVuSW5mby51c2VkID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICB2b2lkIGxhenlQcmludEdyb3VwSW5mbygpIHsKKyAgICAgICAgICAgIGlmKCAhY3VycmVudEdyb3VwSW5mby0+bmFtZS5lbXB0eSgpICYmIGN1cnJlbnRHcm91cEluZm8tPmdyb3Vwc0NvdW50cyA+IDEgKSB7CisgICAgICAgICAgICAgICAgcHJpbnRDbG9zZWRIZWFkZXIoICJHcm91cDogIiArIGN1cnJlbnRHcm91cEluZm8tPm5hbWUgKTsKKyAgICAgICAgICAgICAgICBjdXJyZW50R3JvdXBJbmZvLnVzZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHZvaWQgcHJpbnRUZXN0Q2FzZUFuZFNlY3Rpb25IZWFkZXIoKSB7CisgICAgICAgICAgICBhc3NlcnQoICFtX3NlY3Rpb25TdGFjay5lbXB0eSgpICk7CisgICAgICAgICAgICBwcmludE9wZW5IZWFkZXIoIGN1cnJlbnRUZXN0Q2FzZUluZm8tPm5hbWUgKTsKKworICAgICAgICAgICAgaWYoIG1fc2VjdGlvblN0YWNrLnNpemUoKSA+IDEgKSB7CisgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBDb2xvdXI6OkhlYWRlcnMgKTsKKworICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPFNlY3Rpb25JbmZvPjo6Y29uc3RfaXRlcmF0b3IKKyAgICAgICAgICAgICAgICAgICAgaXQgPSBtX3NlY3Rpb25TdGFjay5iZWdpbigpKzEsIC8vIFNraXAgZmlyc3Qgc2VjdGlvbiAodGVzdCBjYXNlKQorICAgICAgICAgICAgICAgICAgICBpdEVuZCA9IG1fc2VjdGlvblN0YWNrLmVuZCgpOworICAgICAgICAgICAgICAgIGZvciggOyBpdCAhPSBpdEVuZDsgKytpdCApCisgICAgICAgICAgICAgICAgICAgIHByaW50SGVhZGVyU3RyaW5nKCBpdC0+bmFtZSwgMiApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTb3VyY2VMaW5lSW5mbyBsaW5lSW5mbyA9IG1fc2VjdGlvblN0YWNrLmJhY2soKS5saW5lSW5mbzsKKworICAgICAgICAgICAgaWYoICFsaW5lSW5mby5lbXB0eSgpICl7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8IGdldExpbmVPZkNoYXJzPCctJz4oKSA8PCAnXG4nOworICAgICAgICAgICAgICAgIENvbG91ciBjb2xvdXJHdWFyZCggQ29sb3VyOjpGaWxlTmFtZSApOworICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBsaW5lSW5mbyA8PCAnXG4nOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RyZWFtIDw8IGdldExpbmVPZkNoYXJzPCcuJz4oKSA8PCAnXG4nIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgcHJpbnRDbG9zZWRIZWFkZXIoIHN0ZDo6c3RyaW5nIGNvbnN0JiBfbmFtZSApIHsKKyAgICAgICAgICAgIHByaW50T3BlbkhlYWRlciggX25hbWUgKTsKKyAgICAgICAgICAgIHN0cmVhbSA8PCBnZXRMaW5lT2ZDaGFyczwnLic+KCkgPDwgJ1xuJzsKKyAgICAgICAgfQorICAgICAgICB2b2lkIHByaW50T3BlbkhlYWRlciggc3RkOjpzdHJpbmcgY29uc3QmIF9uYW1lICkgeworICAgICAgICAgICAgc3RyZWFtICA8PCBnZXRMaW5lT2ZDaGFyczwnLSc+KCkgPDwgJ1xuJzsKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb2xvdXIgY29sb3VyR3VhcmQoIENvbG91cjo6SGVhZGVycyApOworICAgICAgICAgICAgICAgIHByaW50SGVhZGVyU3RyaW5nKCBfbmFtZSApOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gaWYgc3RyaW5nIGhhcyBhIDogaW4gZmlyc3QgbGluZSB3aWxsIHNldCBpbmRlbnQgdG8gZm9sbG93IGl0IG9uCisgICAgICAgIC8vIHN1YnNlcXVlbnQgbGluZXMKKyAgICAgICAgdm9pZCBwcmludEhlYWRlclN0cmluZyggc3RkOjpzdHJpbmcgY29uc3QmIF9zdHJpbmcsIHN0ZDo6c2l6ZV90IGluZGVudCA9IDAgKSB7CisgICAgICAgICAgICBzdGQ6OnNpemVfdCBpID0gX3N0cmluZy5maW5kKCAiOiAiICk7CisgICAgICAgICAgICBpZiggaSAhPSBzdGQ6OnN0cmluZzo6bnBvcyApCisgICAgICAgICAgICAgICAgaSs9MjsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBpID0gMDsKKyAgICAgICAgICAgIHN0cmVhbSA8PCBUZXh0KCBfc3RyaW5nLCBUZXh0QXR0cmlidXRlcygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNldEluZGVudCggaW5kZW50K2kpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNldEluaXRpYWxJbmRlbnQoIGluZGVudCApICkgPDwgJ1xuJzsKKyAgICAgICAgfQorCisgICAgICAgIHN0cnVjdCBTdW1tYXJ5Q29sdW1uIHsKKworICAgICAgICAgICAgU3VtbWFyeUNvbHVtbiggc3RkOjpzdHJpbmcgY29uc3QmIF9sYWJlbCwgQ29sb3VyOjpDb2RlIF9jb2xvdXIgKQorICAgICAgICAgICAgOiAgIGxhYmVsKCBfbGFiZWwgKSwKKyAgICAgICAgICAgICAgICBjb2xvdXIoIF9jb2xvdXIgKQorICAgICAgICAgICAge30KKyAgICAgICAgICAgIFN1bW1hcnlDb2x1bW4gYWRkUm93KCBzdGQ6OnNpemVfdCBjb3VudCApIHsKKyAgICAgICAgICAgICAgICBzdGQ6Om9zdHJpbmdzdHJlYW0gb3NzOworICAgICAgICAgICAgICAgIG9zcyA8PCBjb3VudDsKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyByb3cgPSBvc3Muc3RyKCk7CisgICAgICAgICAgICAgICAgZm9yKCBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz46Oml0ZXJhdG9yIGl0ID0gcm93cy5iZWdpbigpOyBpdCAhPSByb3dzLmVuZCgpOyArK2l0ICkgeworICAgICAgICAgICAgICAgICAgICB3aGlsZSggaXQtPnNpemUoKSA8IHJvdy5zaXplKCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgKml0ID0gJyAnICsgKml0OworICAgICAgICAgICAgICAgICAgICB3aGlsZSggaXQtPnNpemUoKSA+IHJvdy5zaXplKCkgKQorICAgICAgICAgICAgICAgICAgICAgICAgcm93ID0gJyAnICsgcm93OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByb3dzLnB1c2hfYmFjayggcm93ICk7CisgICAgICAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzdGQ6OnN0cmluZyBsYWJlbDsKKyAgICAgICAgICAgIENvbG91cjo6Q29kZSBjb2xvdXI7CisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gcm93czsKKworICAgICAgICB9OworCisgICAgICAgIHZvaWQgcHJpbnRUb3RhbHMoIFRvdGFscyBjb25zdCYgdG90YWxzICkgeworICAgICAgICAgICAgaWYoIHRvdGFscy50ZXN0Q2FzZXMudG90YWwoKSA9PSAwICkgeworICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBDb2xvdXIoIENvbG91cjo6V2FybmluZyApIDw8ICJObyB0ZXN0cyByYW5cbiI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKCB0b3RhbHMuYXNzZXJ0aW9ucy50b3RhbCgpID4gMCAmJiB0b3RhbHMudGVzdENhc2VzLmFsbFBhc3NlZCgpICkgeworICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBDb2xvdXIoIENvbG91cjo6UmVzdWx0U3VjY2VzcyApIDw8ICJBbGwgdGVzdHMgcGFzc2VkIjsKKyAgICAgICAgICAgICAgICBzdHJlYW0gPDwgIiAoIgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgcGx1cmFsaXNlKCB0b3RhbHMuYXNzZXJ0aW9ucy5wYXNzZWQsICJhc3NlcnRpb24iICkgPDwgIiBpbiAiCisgICAgICAgICAgICAgICAgICAgICAgICA8PCBwbHVyYWxpc2UoIHRvdGFscy50ZXN0Q2FzZXMucGFzc2VkLCAidGVzdCBjYXNlIiApIDw8ICcpJworICAgICAgICAgICAgICAgICAgICAgICAgPDwgJ1xuJzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworCisgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8U3VtbWFyeUNvbHVtbj4gY29sdW1uczsKKyAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2hfYmFjayggU3VtbWFyeUNvbHVtbiggIiIsIENvbG91cjo6Tm9uZSApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFkZFJvdyggdG90YWxzLnRlc3RDYXNlcy50b3RhbCgpICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkUm93KCB0b3RhbHMuYXNzZXJ0aW9ucy50b3RhbCgpICkgKTsKKyAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2hfYmFjayggU3VtbWFyeUNvbHVtbiggInBhc3NlZCIsIENvbG91cjo6U3VjY2VzcyApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFkZFJvdyggdG90YWxzLnRlc3RDYXNlcy5wYXNzZWQgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hZGRSb3coIHRvdGFscy5hc3NlcnRpb25zLnBhc3NlZCApICk7CisgICAgICAgICAgICAgICAgY29sdW1ucy5wdXNoX2JhY2soIFN1bW1hcnlDb2x1bW4oICJmYWlsZWQiLCBDb2xvdXI6OlJlc3VsdEVycm9yICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkUm93KCB0b3RhbHMudGVzdENhc2VzLmZhaWxlZCApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFkZFJvdyggdG90YWxzLmFzc2VydGlvbnMuZmFpbGVkICkgKTsKKyAgICAgICAgICAgICAgICBjb2x1bW5zLnB1c2hfYmFjayggU3VtbWFyeUNvbHVtbiggImZhaWxlZCBhcyBleHBlY3RlZCIsIENvbG91cjo6UmVzdWx0RXhwZWN0ZWRGYWlsdXJlICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkUm93KCB0b3RhbHMudGVzdENhc2VzLmZhaWxlZEJ1dE9rICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkUm93KCB0b3RhbHMuYXNzZXJ0aW9ucy5mYWlsZWRCdXRPayApICk7CisKKyAgICAgICAgICAgICAgICBwcmludFN1bW1hcnlSb3coICJ0ZXN0IGNhc2VzIiwgY29sdW1ucywgMCApOworICAgICAgICAgICAgICAgIHByaW50U3VtbWFyeVJvdyggImFzc2VydGlvbnMiLCBjb2x1bW5zLCAxICk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdm9pZCBwcmludFN1bW1hcnlSb3coIHN0ZDo6c3RyaW5nIGNvbnN0JiBsYWJlbCwgc3RkOjp2ZWN0b3I8U3VtbWFyeUNvbHVtbj4gY29uc3QmIGNvbHMsIHN0ZDo6c2l6ZV90IHJvdyApIHsKKyAgICAgICAgICAgIGZvciggc3RkOjp2ZWN0b3I8U3VtbWFyeUNvbHVtbj46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gY29scy5iZWdpbigpOyBpdCAhPSBjb2xzLmVuZCgpOyArK2l0ICkgeworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHZhbHVlID0gaXQtPnJvd3Nbcm93XTsKKyAgICAgICAgICAgICAgICBpZiggaXQtPmxhYmVsLmVtcHR5KCkgKSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBsYWJlbCA8PCAiOiAiOworICAgICAgICAgICAgICAgICAgICBpZiggdmFsdWUgIT0gIjAiICkKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCB2YWx1ZTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8IENvbG91ciggQ29sb3VyOjpXYXJuaW5nICkgPDwgIi0gbm9uZSAtIjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiggdmFsdWUgIT0gIjAiICkgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gIDw8IENvbG91ciggQ29sb3VyOjpMaWdodEdyZXkgKSA8PCAiIHwgIjsKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtICA8PCBDb2xvdXIoIGl0LT5jb2xvdXIgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHZhbHVlIDw8ICcgJyA8PCBpdC0+bGFiZWw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc3RyZWFtIDw8ICdcbic7CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgc3RkOjpzaXplX3QgbWFrZVJhdGlvKCBzdGQ6OnNpemVfdCBudW1iZXIsIHN0ZDo6c2l6ZV90IHRvdGFsICkgeworICAgICAgICAgICAgc3RkOjpzaXplX3QgcmF0aW8gPSB0b3RhbCA+IDAgPyBDQVRDSF9DT05GSUdfQ09OU09MRV9XSURUSCAqIG51bWJlci8gdG90YWwgOiAwOworICAgICAgICAgICAgcmV0dXJuICggcmF0aW8gPT0gMCAmJiBudW1iZXIgPiAwICkgPyAxIDogcmF0aW87CisgICAgICAgIH0KKyAgICAgICAgc3RhdGljIHN0ZDo6c2l6ZV90JiBmaW5kTWF4KCBzdGQ6OnNpemVfdCYgaSwgc3RkOjpzaXplX3QmIGosIHN0ZDo6c2l6ZV90JiBrICkgeworICAgICAgICAgICAgaWYoIGkgPiBqICYmIGkgPiBrICkKKyAgICAgICAgICAgICAgICByZXR1cm4gaTsKKyAgICAgICAgICAgIGVsc2UgaWYoIGogPiBrICkKKyAgICAgICAgICAgICAgICByZXR1cm4gajsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICByZXR1cm4gazsKKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgcHJpbnRUb3RhbHNEaXZpZGVyKCBUb3RhbHMgY29uc3QmIHRvdGFscyApIHsKKyAgICAgICAgICAgIGlmKCB0b3RhbHMudGVzdENhc2VzLnRvdGFsKCkgPiAwICkgeworICAgICAgICAgICAgICAgIHN0ZDo6c2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mcoIGZhaWxlZEJ1dE9rUmF0aW8sICc9JyApOworICAgICAgICAgICAgICAgIGlmKCB0b3RhbHMudGVzdENhc2VzLmFsbFBhc3NlZCgpICkKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8IENvbG91ciggQ29sb3VyOjpSZXN1bHRTdWNjZXNzICkgPDwgc3RkOjpzdHJpbmcoIHBhc3NlZFJhdGlvLCAnPScgKTsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCBDb2xvdXIoIENvbG91cjo6U3VjY2VzcyApIDw8IHN0ZDo6c3RyaW5nKCBwYXNzZWRSYXRpbywgJz0nICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBzdHJlYW0gPDwgQ29sb3VyKCBDb2xvdXI6Oldhcm5pbmcgKSA8PCBzdGQ6OnN0cmluZyggQ0FUQ0hfQ09ORklHX0NPTlNPTEVfV0lEVEgtMSwgJz0nICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdHJlYW0gPDwgJ1xuJzsKKyAgICAgICAgfQorICAgICAgICB2b2lkIHByaW50U3VtbWFyeURpdmlkZXIoKSB7CisgICAgICAgICAgICBzdHJlYW0gPDwgZ2V0TGluZU9mQ2hhcnM8Jy0nPigpIDw8ICdcbic7CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICAgIGJvb2wgbV9oZWFkZXJQcmludGVkOworICAgIH07CisKKyAgICBJTlRFUk5BTF9DQVRDSF9SRUdJU1RFUl9SRVBPUlRFUiggImNvbnNvbGUiLCBDb25zb2xlUmVwb3J0ZXIgKQorCit9IC8vIGVuZCBuYW1lc3BhY2UgQ2F0Y2gKKworLy8gI2luY2x1ZGVkIGZyb206IC4uL3JlcG9ydGVycy9jYXRjaF9yZXBvcnRlcl9jb21wYWN0LmhwcAorI2RlZmluZSBUV09CTFVFQ1VCRVNfQ0FUQ0hfUkVQT1JURVJfQ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9zdGF0cy5pbmZvTWVzc2FnZXMuYmVnaW4oKSApCisgICAgICAgICAgICAsIHByaW50SW5mb01lc3NhZ2VzKCBfcHJpbnRJbmZvTWVzc2FnZXMgKQorICAgICAgICAgICAge30KKworICAgICAgICAgICAgdm9pZCBwcmludCgpIHsKKyAgICAgICAgICAgICAgICBwcmludFNvdXJjZUluZm8oKTsKKworICAgICAgICAgICAgICAgIGl0TWVzc2FnZSA9IG1lc3NhZ2VzLmJlZ2luKCk7CisKKyAgICAgICAgICAgICAgICBzd2l0Y2goIHJlc3VsdC5nZXRSZXN1bHRUeXBlKCkgKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpPazoKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVzdWx0VHlwZSggQ29sb3VyOjpSZXN1bHRTdWNjZXNzLCBwYXNzZWRTdHJpbmcoKSApOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRPcmlnaW5hbEV4cHJlc3Npb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICggISByZXN1bHQuaGFzRXhwcmVzc2lvbigpICkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlbWFpbmluZ01lc3NhZ2VzKCBDb2xvdXI6Ok5vbmUgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlbWFpbmluZ01lc3NhZ2VzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkV4cHJlc3Npb25GYWlsZWQ6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiggcmVzdWx0LmlzT2soKSApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZXN1bHRUeXBlKCBDb2xvdXI6OlJlc3VsdFN1Y2Nlc3MsIGZhaWxlZFN0cmluZygpICsgc3RkOjpzdHJpbmcoICIgLSBidXQgd2FzIG9rIiApICk7CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZXN1bHRUeXBlKCBDb2xvdXI6OkVycm9yLCBmYWlsZWRTdHJpbmcoKSApOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRPcmlnaW5hbEV4cHJlc3Npb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVtYWluaW5nTWVzc2FnZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VGhyZXdFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlc3VsdFR5cGUoIENvbG91cjo6RXJyb3IsIGZhaWxlZFN0cmluZygpICk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludElzc3VlKCAidW5leHBlY3RlZCBleGNlcHRpb24gd2l0aCBtZXNzYWdlOiIgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRFeHByZXNzaW9uV2FzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlbWFpbmluZ01lc3NhZ2VzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkZhdGFsRXJyb3JDb25kaXRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlc3VsdFR5cGUoIENvbG91cjo6RXJyb3IsIGZhaWxlZFN0cmluZygpICk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludElzc3VlKCAiZmF0YWwgZXJyb3IgY29uZGl0aW9uIHdpdGggbWVzc2FnZToiICk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludE1lc3NhZ2UoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50RXhwcmVzc2lvbldhcygpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZW1haW5pbmdNZXNzYWdlcygpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpEaWRudFRocm93RXhjZXB0aW9uOgorICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZXN1bHRUeXBlKCBDb2xvdXI6OkVycm9yLCBmYWlsZWRTdHJpbmcoKSApOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRJc3N1ZSggImV4cGVjdGVkIGV4Y2VwdGlvbiwgZ290IG5vbmUiICk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludEV4cHJlc3Npb25XYXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVtYWluaW5nTWVzc2FnZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6SW5mbzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVzdWx0VHlwZSggQ29sb3VyOjpOb25lLCAiaW5mbyIgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZW1haW5pbmdNZXNzYWdlcygpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpXYXJuaW5nOgorICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZXN1bHRUeXBlKCBDb2xvdXI6Ok5vbmUsICJ3YXJuaW5nIiApOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRNZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlbWFpbmluZ01lc3NhZ2VzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkV4cGxpY2l0RmFpbHVyZToKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50UmVzdWx0VHlwZSggQ29sb3VyOjpFcnJvciwgZmFpbGVkU3RyaW5nKCkgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByaW50SXNzdWUoICJleHBsaWNpdGx5IiApOworICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRSZW1haW5pbmdNZXNzYWdlcyggQ29sb3VyOjpOb25lICk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlc2UgY2FzZXMgYXJlIGhlcmUgdG8gcHJldmVudCBjb21waWxlciB3YXJuaW5ncworICAgICAgICAgICAgICAgICAgICBjYXNlIFJlc3VsdFdhczo6VW5rbm93bjoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBSZXN1bHRXYXM6OkZhaWx1cmVCaXQ6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUmVzdWx0V2FzOjpFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludFJlc3VsdFR5cGUoIENvbG91cjo6RXJyb3IsICIqKiBpbnRlcm5hbCBlcnJvciAqKiIgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgLy8gQ29sb3VyOjpMaWdodEdyZXkKKworICAgICAgICAgICAgc3RhdGljIENvbG91cjo6Q29kZSBkaW1Db2xvdXIoKSB7IHJldHVybiBDb2xvdXI6OkZpbGVOYW1lOyB9CisKKyNpZmRlZiBDQVRDSF9QTEFURk9STV9NQUMKKyAgICAgICAgICAgIHN0YXRpYyBjb25zdCBjaGFyKiBmYWlsZWRTdHJpbmcoKSB7IHJldHVybiAiRkFJTEVEIjsgfQorICAgICAgICAgICAgc3RhdGljIGNvbnN0IGNoYXIqIHBhc3NlZFN0cmluZygpIHsgcmV0dXJuICJQQVNTRUQiOyB9CisjZWxzZQorICAgICAgICAgICAgc3RhdGljIGNvbnN0IGNoYXIqIGZhaWxlZFN0cmluZygpIHsgcmV0dXJuICJmYWlsZWQiOyB9CisgICAgICAgICAgICBzdGF0aWMgY29uc3QgY2hhciogcGFzc2VkU3RyaW5nKCkgeyByZXR1cm4gInBhc3NlZCI7IH0KKyNlbmRpZgorCisgICAgICAgICAgICB2b2lkIHByaW50U291cmNlSW5mbygpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBDb2xvdXIgY29sb3VyR3VhcmQoIENvbG91cjo6RmlsZU5hbWUgKTsKKyAgICAgICAgICAgICAgICBzdHJlYW0gPDwgcmVzdWx0LmdldFNvdXJjZUluZm8oKSA8PCAnOic7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZvaWQgcHJpbnRSZXN1bHRUeXBlKCBDb2xvdXI6OkNvZGUgY29sb3VyLCBzdGQ6OnN0cmluZyBjb25zdCYgcGFzc09yRmFpbCApIGNvbnN0IHsKKyAgICAgICAgICAgICAgICBpZiggIXBhc3NPckZhaWwuZW1wdHkoKSApIHsKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBjb2xvdXIgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAnICcgPDwgcGFzc09yRmFpbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgJzonOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdm9pZCBwcmludElzc3VlKCBzdGQ6OnN0cmluZyBjb25zdCYgaXNzdWUgKSBjb25zdCB7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8ICcgJyA8PCBpc3N1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdm9pZCBwcmludEV4cHJlc3Npb25XYXMoKSB7CisgICAgICAgICAgICAgICAgaWYoIHJlc3VsdC5oYXNFeHByZXNzaW9uKCkgKSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAnOyc7CisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbG91ciBjb2xvdXIoIGRpbUNvbG91cigpICk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgIiBleHByZXNzaW9uIHdhczoiOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHByaW50T3JpZ2luYWxFeHByZXNzaW9uKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2b2lkIHByaW50T3JpZ2luYWxFeHByZXNzaW9uKCkgY29uc3QgeworICAgICAgICAgICAgICAgIGlmKCByZXN1bHQuaGFzRXhwcmVzc2lvbigpICkgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgJyAnIDw8IHJlc3VsdC5nZXRFeHByZXNzaW9uKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2b2lkIHByaW50UmVjb25zdHJ1Y3RlZEV4cHJlc3Npb24oKSBjb25zdCB7CisgICAgICAgICAgICAgICAgaWYoIHJlc3VsdC5oYXNFeHBhbmRlZEV4cHJlc3Npb24oKSApIHsKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ciggZGltQ29sb3VyKCkgKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAiIGZvcjogIjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgcmVzdWx0LmdldEV4cGFuZGVkRXhwcmVzc2lvbigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdm9pZCBwcmludE1lc3NhZ2UoKSB7CisgICAgICAgICAgICAgICAgaWYgKCBpdE1lc3NhZ2UgIT0gbWVzc2FnZXMuZW5kKCkgKSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAiICciIDw8IGl0TWVzc2FnZS0+bWVzc2FnZSA8PCAnXCcnOworICAgICAgICAgICAgICAgICAgICArK2l0TWVzc2FnZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZvaWQgcHJpbnRSZW1haW5pbmdNZXNzYWdlcyggQ29sb3VyOjpDb2RlIGNvbG91ciA9IGRpbUNvbG91cigpICkgeworICAgICAgICAgICAgICAgIGlmICggaXRNZXNzYWdlID09IG1lc3NhZ2VzLmVuZCgpICkKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworCisgICAgICAgICAgICAgICAgLy8gdXNpbmcgbWVzc2FnZXMuZW5kKCkgZGlyZWN0bHkgeWllbGRzIGNvbXBpbGF0aW9uIGVycm9yOgorICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPE1lc3NhZ2VJbmZvPjo6Y29uc3RfaXRlcmF0b3IgaXRFbmQgPSBtZXNzYWdlcy5lbmQoKTsKKyAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNpemVfdCBOID0gc3RhdGljX2Nhc3Q8c3RkOjpzaXplX3Q+KCBzdGQ6OmRpc3RhbmNlKCBpdE1lc3NhZ2UsIGl0RW5kICkgKTsKKworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBjb2xvdXIgKTsKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtIDw8ICIgd2l0aCAiIDw8IHBsdXJhbGlzZSggTiwgIm1lc3NhZ2UiICkgPDwgJzonOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZvcig7IGl0TWVzc2FnZSAhPSBpdEVuZDsgKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoaXMgYXNzZXJ0aW9uIGlzIGEgd2FybmluZyBpZ25vcmUgYW55IElORk8gbWVzc2FnZXMKKyAgICAgICAgICAgICAgICAgICAgaWYoIHByaW50SW5mb01lc3NhZ2VzIHx8IGl0TWVzc2FnZS0+dHlwZSAhPSBSZXN1bHRXYXM6OkluZm8gKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPDwgIiAnIiA8PCBpdE1lc3NhZ2UtPm1lc3NhZ2UgPDwgJ1wnJzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICggKytpdE1lc3NhZ2UgIT0gaXRFbmQgKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29sb3VyIGNvbG91ckd1YXJkKCBkaW1Db2xvdXIoKSApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA8PCAiIGFuZCI7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIHN0ZDo6b3N0cmVhbSYgc3RyZWFtOworICAgICAgICAgICAgQXNzZXJ0aW9uU3RhdHMgY29uc3QmIHN0YXRzOworICAgICAgICAgICAgQXNzZXJ0aW9uUmVzdWx0IGNvbnN0JiByZXN1bHQ7CisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxNZXNzYWdlSW5mbz4gbWVzc2FnZXM7CisgICAgICAgICAgICBzdGQ6OnZlY3RvcjxNZXNzYWdlSW5mbz46OmNvbnN0X2l0ZXJhdG9yIGl0TWVzc2FnZTsKKyAgICAgICAgICAgIGJvb2wgcHJpbnRJbmZvTWVzc2FnZXM7CisgICAgICAgIH07CisKKyAgICAgICAgLy8gQ29sb3VyLCBtZXNzYWdlIHZhcmlhbnRzOgorICAgICAgICAvLyAtIHdoaXRlOiBObyB0ZXN0cyByYW4uCisgICAgICAgIC8vIC0gICByZWQ6IEZhaWxlZCBbYm90aC9hbGxdIE4gdGVzdCBjYXNlcywgZmFpbGVkIFtib3RoL2FsbF0gTSBhc3NlcnRpb25zLgorICAgICAgICAvLyAtIHdoaXRlOiBQYXNzZWQgW2JvdGgvYWxsXSBOIHRlc3QgY2FzZXMgKG5vIGFzc2VydGlvbnMpLgorICAgICAgICAvLyAtICAgcmVkOiBGYWlsZWQgTiB0ZXN0cyBjYXNlcywgZmFpbGVkIE0gYXNzZXJ0aW9ucy4KKyAgICAgICAgLy8gLSBncmVlbjogUGFzc2VkIFtib3RoL2FsbF0gTiB0ZXN0cyBjYXNlcyB3aXRoIE0gYXNzZXJ0aW9ucy4KKworICAgICAgICBzdGQ6OnN0cmluZyBib3RoT3JBbGwoIHN0ZDo6c2l6ZV90IGNvdW50ICkgY29uc3QgeworICAgICAgICAgICAgcmV0dXJuIGNvdW50ID09IDEgPyBzdGQ6OnN0cmluZygpIDogY291bnQgPT0gMiA/ICJib3RoICIgOiAiYWxsICIgOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBwcmludFRvdGFscyggY29uc3QgVG90YWxzJiB0b3RhbHMgKSBjb25zdCB7CisgICAgICAgICAgICBpZiggdG90YWxzLnRlc3RDYXNlcy50b3RhbCgpID09IDAgKSB7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8ICJObyB0ZXN0cyByYW4uIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoIHRvdGFscy50ZXN0Q2FzZXMuZmFpbGVkID09IHRvdGFscy50ZXN0Q2FzZXMudG90YWwoKSApIHsKKyAgICAgICAgICAgICAgICBDb2xvdXIgY29sb3VyKCBDb2xvdXI6OlJlc3VsdEVycm9yICk7CisgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgcXVhbGlmeV9hc3NlcnRpb25zX2ZhaWxlZCA9CisgICAgICAgICAgICAgICAgICAgIHRvdGFscy5hc3NlcnRpb25zLmZhaWxlZCA9PSB0b3RhbHMuYXNzZXJ0aW9ucy50b3RhbCgpID8KKyAgICAgICAgICAgICAgICAgICAgICAgIGJvdGhPckFsbCggdG90YWxzLmFzc2VydGlvbnMuZmFpbGVkICkgOiBzdGQ6OnN0cmluZygpOworICAgICAgICAgICAgICAgIHN0cmVhbSA8PAorICAgICAgICAgICAgICAgICAgICAiRmFpbGVkICIgPDwgYm90aE9yQWxsKCB0b3RhbHMudGVzdENhc2VzLmZhaWxlZCApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBwbHVyYWxpc2UoIHRvdGFscy50ZXN0Q2FzZXMuZmFpbGVkLCAidGVzdCBjYXNlIiAgKSA8PCAiLCAiCisgICAgICAgICAgICAgICAgICAgICJmYWlsZWQgIiA8PCBxdWFsaWZ5X2Fzc2VydGlvbnNfZmFpbGVkIDw8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbHVyYWxpc2UoIHRvdGFscy5hc3NlcnRpb25zLmZhaWxlZCwgImFzc2VydGlvbiIgKSA8PCAnLic7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKCB0b3RhbHMuYXNzZXJ0aW9ucy50b3RhbCgpID09IDAgKSB7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8CisgICAgICAgICAgICAgICAgICAgICJQYXNzZWQgIiA8PCBib3RoT3JBbGwoIHRvdGFscy50ZXN0Q2FzZXMudG90YWwoKSApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBwbHVyYWxpc2UoIHRvdGFscy50ZXN0Q2FzZXMudG90YWwoKSwgInRlc3QgY2FzZSIgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiAobm8gYXNzZXJ0aW9ucykuIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoIHRvdGFscy5hc3NlcnRpb25zLmZhaWxlZCApIHsKKyAgICAgICAgICAgICAgICBDb2xvdXIgY29sb3VyKCBDb2xvdXI6OlJlc3VsdEVycm9yICk7CisgICAgICAgICAgICAgICAgc3RyZWFtIDw8CisgICAgICAgICAgICAgICAgICAgICJGYWlsZWQgIiA8PCBwbHVyYWxpc2UoIHRvdGFscy50ZXN0Q2FzZXMuZmFpbGVkLCAidGVzdCBjYXNlIiAgKSA8PCAiLCAiCisgICAgICAgICAgICAgICAgICAgICJmYWlsZWQgIiA8PCBwbHVyYWxpc2UoIHRvdGFscy5hc3NlcnRpb25zLmZhaWxlZCwgImFzc2VydGlvbiIgKSA8PCAnLic7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBDb2xvdXIgY29sb3VyKCBDb2xvdXI6OlJlc3VsdFN1Y2Nlc3MgKTsKKyAgICAgICAgICAgICAgICBzdHJlYW0gPDwKKyAgICAgICAgICAgICAgICAgICAgIlBhc3NlZCAiIDw8IGJvdGhPckFsbCggdG90YWxzLnRlc3RDYXNlcy5wYXNzZWQgKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgcGx1cmFsaXNlKCB0b3RhbHMudGVzdENhc2VzLnBhc3NlZCwgInRlc3QgY2FzZSIgICkgPDwKKyAgICAgICAgICAgICAgICAgICAgIiB3aXRoICIgIDw8IHBsdXJhbGlzZSggdG90YWxzLmFzc2VydGlvbnMucGFzc2VkLCAiYXNzZXJ0aW9uIiApIDw8ICcuJzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisKKyAgICBJTlRFUk5BTF9DQVRDSF9SRUdJU1RFUl9SRVBPUlRFUiggImNvbXBhY3QiLCBDb21wYWN0UmVwb3J0ZXIgKQorCit9IC8vIGV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AgICAgICAgICAgIiAqIEF1dG9nZW5lcmF0ZWQgYnkgVGhyaWZ0IENvbXBpbGVyICgpIiAiXG4iCisgICAgICAgICAgICAiICoiICJcbiIKKyAgICAgICAgICAgICIgKiBETyBOT1QgRURJVCBVTkxFU1MgWU9VIEFSRSBTVVJFIFRIQVQgWU9VIEtOT1cgV0hBVCBZT1UgQVJFIERPSU5HIiAiXG4iCisgICAgICAgICAgICAiICogIEBnZW5lcmF0ZWQiICJcbiIKKyAgICAgICAgICAgICIgKi8iOworCitzdGQ6OnBhaXI8c3RyaW5nLCB0X2VudW0qPiBUZXN0RGF0YUdlbmVyYXRvcjo6Z2V0X3Rlc3RfZW51bV9kYXRhKHRfcHJvZ3JhbSogcHJvZ3JhbSkKK3sKKyAgICBzdHJpbmcgZXhwZWN0ZWRfcmVzdWx0ID0gREVGQVVMVF9GSUxFX0hFQURFUiArCisgICAgICAgICJcbiIKKyAgICAgICAgIlxuIgorICAgICAgICAiLy8vIDxzdW1tYXJ5PlxuIgorICAgICAgICAiLy8vIFRlc3REb2NcbiIKKyAgICAgICAgIi8vLyA8L3N1bW1hcnk+XG4iCisgICAgICAgICJwdWJsaWMgZW51bSBUZXN0TmFtZVxuIgorICAgICAgICAie1xuIgorICAgICAgICAiICBOb25lID0gMCxcbiIKKyAgICAgICAgIiAgRmlyc3QgPSAxLFxuIgorICAgICAgICAiICBTZWNvbmQgPSAyLFxuIgorICAgICAgICAifVxuIjsKKworICAgIHRfZW51bSogZW51bV8gPSBuZXcgdF9lbnVtKHByb2dyYW0pOworICAgIGVudW1fLT5zZXRfbmFtZSgiVGVzdE5hbWUiKTsKKyAgICBlbnVtXy0+c2V0X2RvYygiVGVzdERvYyIpOworICAgIGVudW1fLT5hcHBlbmQobmV3IHRfZW51bV92YWx1ZSgiTm9uZSIsIDApKTsKKyAgICBlbnVtXy0+YXBwZW5kKG5ldyB0X2VudW1fdmFsdWUoIkZpcnN0IiwgMSkpOworICAgIGVudW1fLT5hcHBlbmQobmV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MgPSB7IHsgInVuaW9uIiwgInVuaW9uIiB9IH07CisgICAgc3RyaW5nIG9wdGlvbl9zdHJpbmcgPSAiIjsKKworICAgIHN0cmluZyBleHBlY3RlZF9uYW1lc3BhY2VzID0gInVzaW5nIFN5c3RlbTtcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucztcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljO1xuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidXNpbmcgU3lzdGVtLlRleHQ7XG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uSU87XG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uVGhyZWFkaW5nO1xuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrcztcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFRocmlmdDtcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFRocmlmdC5Db2xsZWN0aW9ucztcbiIgKyBlbmRsOworCisgICAgdF9wcm9ncmFtKiBwcm9ncmFtID0gbmV3IHRfcHJvZ3JhbShwYXRoLCBuYW1lKTsKKyAgICB0X25ldGNvcmVfZ2VuZXJhdG9yKiBnZW4gPSBuZXcgdF9uZXRjb3JlX2dlbmVyYXRvcihwcm9ncmFtLCBwYXJzZWRfb3B0aW9ucywgb3B0aW9uX3N0cmluZyk7CisKKyAgICBSRVFVSVJFX0ZBTFNFKGdlbi0+aXNfd2NmX2VuYWJsZWQoKSk7CisgICAgUkVRVUlSRShnZW4tPm5ldGNvcmVfdHlwZV91c2luZ3MoKSA9PSBleHBlY3RlZF9uYW1lc3BhY2VzKTsKKworICAgIGRlbGV0ZSBnZW47CisgICAgZGVsZXRlIHByb2dyYW07Cit9CisKK1RFU1RfQ0FTRSgidF9uZXRjb3JlX2dlbmVyYXRvcjo6bmV0Y29yZV90eXBlX3VzaW5ncygpIHdpdGggb3B0aW9uIHdjZiBzaG91bGQgcmV0dXJuIHZhbGlkIG5hbWVzcGFjZXMiLCAiW2hlbHBlcnNdIikKK3sKKyAgICBzdHJpbmcgcGF0aCA9ICJDYXNzYW5kcmFUZXN0LnRocmlmdCI7CisgICAgc3RyaW5nIG5hbWUgPSAibmV0Y29yZSI7CisgICAgbWFwPHN0cmluZywgc3RyaW5nPiBwYXJzZWRfb3B0aW9ucyA9IHsgeyAid2NmIiwgIndjZiIgfSB9OworICAgIHN0cmluZyBvcHRpb25fc3RyaW5nID0gIiI7CisKKyAgICBzdHJpbmcgZXhwZWN0ZWRfbmFtZXNwYWNlc193Y2YgPSAidXNpbmcgU3lzdGVtO1xuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucztcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYztcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uVGV4dDtcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uSU87XG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidXNpbmcgU3lzdGVtLlRocmVhZGluZztcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ1c2luZyBTeXN0ZW0uVGhyZWFkaW5nLlRhc2tzO1xuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzaW5nIFRocmlmdDtcbiIKKyAgICAgICAgICAgICAg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AiYWJzdHJhY3QiIH0sCisgICAgICAgIHsgImFzIiB9LAorICAgICAgICB7ICJiYXNlIiB9LAorICAgICAgICB7ICJib29sIiB9LAorICAgICAgICB7ICJicmVhayIgfSwKKyAgICAgICAgeyAiYnl0ZSIgfSwKKyAgICAgICAgeyAiY2FzZSIgfSwKKyAgICAgICAgeyAiY2F0Y2giIH0sCisgICAgICAgIHsgImNoYXIiIH0sCisgICAgICAgIHsgImNoZWNrZWQiIH0sCisgICAgICAgIHsgImNsYXNzIiB9LAorICAgICAgICB7ICJjb25zdCIgfSwKKyAgICAgICAgeyAiY29udGludWUiIH0sCisgICAgICAgIHsgImRlY2ltYWwiIH0sCisgICAgICAgIHsgImRlZmF1bHQiIH0sCisgICAgICAgIHsgImRlbGVnYXRlIiB9LAorICAgICAgICB7ICJkbyIgfSwKKyAgICAgICAgeyAiZG91YmxlIiB9LAorICAgICAgICB7ICJlbHNlIiB9LAorICAgICAgICB7ICJlbnVtIiB9LAorICAgICAgICB7ICJldmVudCIgfSwKKyAgICAgICAgeyAiZXhwbGljaXQiIH0sCisgICAgICAgIHsgImV4dGVybiIgfSwKKyAgICAgICAgeyAiZmFsc2UiIH0sCisgICAgICAgIHsgImZpbmFsbHkiIH0sCisgICAgICAgIHsgImZpeGVkIiB9LAorICAgICAgICB7ICJmbG9hdCIgfSwKKyAgICAgICAgeyAiZm9yIiB9LAorICAgICAgICB7ICJmb3JlYWNoIiB9LAorICAgICAgICB7ICJnb3RvIiB9LAorICAgICAgICB7ICJpZiIgfSwKKyAgICAgICAgeyAiaW1wbGljaXQiIH0sCisgICAgICAgIHsgImluIiB9LAorICAgICAgICB7ICJpbnQiIH0sCisgICAgICAgIHsgImludGVyZmFjZSIgfSwKKyAgICAgICAgeyAiaW50ZXJuYWwiIH0sCisgICAgICAgIHsgImlzIiB9LAorICAgICAgICB7ICJsb2NrIiB9LAorICAgICAgICB7ICJsb25nIiB9LAorICAgICAgICB7ICJuYW1lc3BhY2UiIH0sCisgICAgICAgIHsgIm5ldyIgfSwKKyAgICAgICAgeyAibnVsbCIgfSwKKyAgICAgICAgeyAib2JqZWN0IiB9LAorICAgICAgICB7ICJvcGVyYXRvciIgfSwKKyAgICAgICAgeyAib3V0IiB9LAorICAgICAgICB7ICJvdmVycmlkZSIgfSwKKyAgICAgICAgeyAicGFyYW1zIiB9LAorICAgICAgICB7ICJwcml2YXRlIiB9LAorICAgICAgICB7ICJwcm90ZWN0ZWQiIH0sCisgICAgICAgIHsgInB1YmxpYyIgfSwKKyAgICAgICAgeyAicmVhZG9ubHkiIH0sCisgICAgICAgIHsgInJlZiIgfSwKKyAgICAgICAgeyAicmV0dXJuIiB9LAorICAgICAgICB7ICJzYnl0ZSIgfSwKKyAgICAgICAgeyAic2VhbGVkIiB9LAorICAgICAgICB7ICJzaG9ydCIgfSwKKyAgICAgICAgeyAic2l6ZW9mIiB9LAorICAgICAgICB7ICJzdGFja2FsbG9jIiB9LAorICAgICAgICB7ICJzdGF0aWMiIH0sCisgICAgICAgIHsgInN0cmluZyIgfSwKKyAgICAgICAgeyAic3RydWN0IiB9LAorICAgICAgICB7ICJzd2l0Y2giIH0sCisgICAgICAgIHsgInRoaXMiIH0sCisgICAgICAgIHsgInRocm93IiB9LAorICAgICAgICB7ICJ0cnVlIiB9LAorICAgICAgICB7ICJ0cnkiIH0sCisgICAgICAgIHsgInR5cGVvZiIgfSwKKyAgICAgICAgeyAidWludCIgfSwKKyAgICAgICAgeyAidWxvbmciIH0sCisgICAgICAgIHsgInVuY2hlY2tlZCIgfSwKKyAgICAgICAgeyAidW5zYWZlIiB9LAorICAgICAgICB7ICJ1c2hvcnQiIH0sCisgICAgICAgIHsgInVzaW5nIiB9LAorICAgICAgICB7ICJ2b2lkIiB9LAorICAgICAgICB7ICJ2b2xhdGlsZSIgfSwKKyAgICAgICAgeyAid2hpbGUiIH0sCisgICAgICAgIC8vIENvbnRleHR1YWwgS2V5d29yZHMKKyAgICAgICAgeyAiYWRkIiB9LAorICAgICAgICB7ICJhbGlhcyIgfSwKKyAgICAgICAgeyAiYXNjZW5kaW5nIiB9LAorICAgICAgICB7ICJhc3luYyIgfSwKKyAgICAgICAgeyAiYXdhaXQiIH0sCisgICAgICAgIHsgImRlc2NlbmRpbmciIH0sCisgICAgICAgIHsgImR5bmFtaWMiIH0sCisgICAgICAgIHsgImZyb20iIH0sCisgICAgICAgIHsgImdldCIgfSwKKyAgICAgICAgeyAiZ2xvYmFsIiB9LAorICAgICAgICB7ICJncm91cCIgfSwKKyAgICAgICAgeyAiaW50byIgfSwKKyAgICAgICAgeyAiam9pbiIgfSwKKyAgICAgICAgeyAibGV0IiB9LAorICAgICAgICB7ICJvcmRlcmJ5IiB9LAorICAgICAgICB7ICJwYXJ0aWFsIiB9LAorICAgICAgICB7ICJyZW1vdmUiIH0sCisgICAgICAgIHsgInNlbGVjdCIgfSwKKyAgICAgICAgeyAic2V0IiB9LAorICAgICAgICB7ICJ2YWx1ZSIgfSwKKyAgICAgICAgeyAidmFyIiB9LAorICAgICAgICB7ICJ3aGVuIiB9LAorICAgICAgICB7ICJ3aGVyZSIgfSwKKyAgICAgICAgeyAieWllbGQiIH0KKyAgICB9OworCisgICAgc3RyaW5nIG1pc3NlZF9rZXl3b3JkcyA9ICIiOworCisgICAgdF9wcm9ncmFtKiBwcm9ncmFtID0gbmV3IHRfcHJvZ3JhbShwYXRoLCBuYW1lKTsKKyAgICB0X25ldGNvcmVfZ2VuZXJhdG9yKiBnZW4gPSBuZXcgdF9uZXRjb3JlX2dlbmVyYXRvcihwcm9ncmFtLCBwYXJzZWRfb3B0aW9ucywgb3B0aW9uX3N0cmluZyk7CisgICAgZ2VuLT5pbml0X2dlbmVyYXRvcigpOworICAgIG1hcDxzdHJpbmcsIGludD4gZ2VuZXJhdG9yc19rZXl3b3JkcyA9IGdlbi0+Z2V0X2tleXdvcmRzX2xpc3QoKTsKKworICAgIGZvciAodmVjdG9yPHN0cmluZz46Oml0ZXJhdG9yIGl0ID0gY3VycmVudF9rZXl3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IjogImh0dHA6Ly90aHJpZnQuYXBhY2hlLm9yZy8iLAorICAgICJob21lcGFnZSI6ICJodHRwOi8vdGhyaWZ0LmFwYWNoZS5vcmciLAogICAgICJ0eXBlIjogImxpYnJhcnkiLAorICAgICJrZXl3b3JkcyI6IFsiUlBDIl0sCiAgICAgImxpY2Vuc2UiOiAiQXBhY2hlLTIuMCIsCisgICAgInJlYWRtZSI6ICJSRUFETUUubWQiLAogICAgICJhdXRob3JzIjogWwogICAgICAgICB7CiAgICAgICAgICAgICAibmFtZSI6ICJBcGFjaGUgVGhyaWZ0IERldmVsb3BlcnMiLApAQCAtMTYsMTAgKzE4LDIyIEBACiAgICAgICAgICJpc3N1ZXMiOiAiaHR0cHM6Ly9pc3N1ZXMuYXBhY2hlLm9yZy9qaXJhL2Jyb3dzZS9USFJJRlQiCiAgICAgfSwKICAgICAicmVxdWlyZSI6IHsKLSAgICAgICAgInBocCI6ICI+PTUuMy4wIgorICAgICAgICAicGhwIjogIl41LjUgfHwgXjcuMCIKKyAgICB9LAorICAgICJyZXF1aXJlLWRldiI6IHsKKyAgICAgICAgInBocHVuaXQvcGhwdW5pdCI6ICJ+NC44LjM2IiwKKyAgICAgICAgInNxdWl6bGFicy9waHBfY29kZXNuaWZmZXIiOiAiMy4qIgogICAgIH0sCiAgICAgImF1dG9sb2FkIjogewotICAgICAgICAicHNyLTAiOiB7IlRocmlmdCI6ICJsaWIvcGhwL2xpYi8ifQorICAgICAgICAicHNyLTQiOiB7IlRocmlmdFxcIjogImxpYi9waHAvbGliLyJ9CiAgICAgfSwKLSAgICAibWluaW11bS1zdGFiaWxpdHkiOiAiZGV2IgorICAgICJhdXRvbG9hZC1kZXYiOiB7CisgICAgICAgICJwc3ItNCI6IHsiVGVzdFxcVGhyaWZ0XFwiOiAibGliL3BocC90ZXN0LyJ9CisgICAgfSwKKyAgICAibWluaW11bS1zdGFiaWxpdHkiOiAic3RhYmxlIiwKKyAgICAiZXh0cmEiOiB7CisgICAgICAgICJicmF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hcHRlci5SZWdpc3Rlcih0eXBlb2YoTWF0aFJlc3BvbnNlQ2FsbEhhbmRsZXIpKTsKKyAgICAgICAgICAgIHJldHVybiBhZGFwdGVyOworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQorICAgICAgICB7CisgICAgICAgICAgICBzdHJpbmcgc2VydmVyID0gImxvY2FsaG9zdCI7CisKKyAgICAgICAgICAgIC8vIHN0YXJ0IGFsbCBzZXJ2ZXJzCisgICAgICAgICAgICB2YXIgcmVxID0gU3RhcnRSZXF1ZXN0U2VydmVyKHNlcnZlcik7CisgICAgICAgICAgICB2YXIgcnNwID0gU3RhcnRSZXNwb25zZVNlcnZlcihzZXJ2ZXIpOworCisgICAgICAgICAgICAvLyBzZW5kIHRoZSBmaXJzdCBtZXNzYWdlCisgICAgICAgICAgICB2YXIgcmFuZG9tID0gbmV3IFJhbmRvbSgpOworICAgICAgICAgICAgdmFyIGNsaWVudCA9IG5ldyBNYXRoUmVxdWVzdENsaWVudChzZXJ2ZXIpOworICAgICAgICAgICAgY2xpZW50LkRvVGhlTWF0aChyYW5kb20uTmV4dCgpLCByYW5kb20uTmV4dCgpKTsKKworICAgICAgICAgICAgLy8gbm93IHdoYXQ/CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJIaXQgPEVOVEVSPiB0byBzdG9wIC4uLiAiKTsKKyAgICAgICAgICAgIENvbnNvbGUuUmVhZExpbmUoKTsKKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvbnRyaWIvUmVidXMvUHJvcGVydGllcy9Bc3NlbWJseUluZm8uY3MgYi9jb250cmliL1JlYnVzL1Byb3BlcnRpZXMvQXNzZW1ibHlJbmZvLmNzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmU0NzZlYWIKLS0tIC9kZXYvbnVsbAorKysgYi9jb250cmliL1JlYnVzL1Byb3BlcnRpZXMvQXNz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RlZCwgaW50IGRpdmlkZWQpCisgICAgICAgIHsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJhZGRlZCA9IHswfSIsIGFkZGVkKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJtdWx0aXBsaWVkPSB7MH0iLCBtdWx0aXBsaWVkKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJzdWJ0cmFjdGVkID0gezB9Iiwgc3VidHJhY3RlZCk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiZGl2aWRlZCA9IHswfSIsIGRpdmlkZWQpOworCisgICAgICAgICAgICBQaW5nQW5kRG9Bbm90aGVyQ2FsY3VsYXRpb24oKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHVibGljIHZvaWQgVGhyZWVSZXN1bHRzKGludCBhZGRlZCwgaW50IG11bHRpcGxpZWQsIGludCBzdWJ0cmFjdGVkKQorICAgICAgICB7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiYWRkZWQgPSB7MH0iLCBhZGRlZCk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgibXVsdGlwbGllZD0gezB9IiwgbXVsdGlwbGllZCk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgic3VidHJhY3RlZCA9IHswfSIsIHN1YnRyYWN0ZWQpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkRJVi8wIGVycm9yIGR1cmluZyBkaXZpc2lvbiIpOworCisgICAgICAgICAgICBQaW5nQW5kRG9Bbm90aGVyQ2FsY3VsYXRpb24oKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHVibGljIHZvaWQgUG9uZyhsb25nIHZhbHVlKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgbGF0ZW5jeSA9IERhdGVUaW1lLk5vdy5UaWNrcyAtIHZhbHVlOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIl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JzaGlwKG8gPT4gby5Gcm9tUmVidXNDb25maWd1cmF0aW9uU2VjdGlvbigpKQorICAgICAgICAgICAgICAgIC5DcmVhdGVCdXMoKS5TdGFydCgpOworICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgdm9pZCBTZXJpYWxpemVUaHJpZnRDYWxsKEFjdGlvbjxCYXNpY01hdGhTZXJ2ZXIuSWZhY2U+IGFjdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgLy8gVGhyaWZ0IHByb3RvY29sL3RyYW5zcG9ydCBzdGFjaworICAgICAgICAgICAgdmFyIHN0bSA9IG5ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgICAgIHZhciB0cm5zID0gbmV3IFRTdHJlYW1UcmFuc3BvcnQobnVsbCwgc3RtKTsKKyAgICAgICAgICAgIHZhciBwcm90ID0gbmV3IFRCaW5hcnlQcm90b2NvbCh0cm5zKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgLy8gc2VyaWFsaXplIHRoZSBjYWxsIGludG8gYSBidW5jaCBvZiBieXRlcworICAgICAgICAgICAgdmFyIGNsaWVudCA9IG5ldyBCYXNpY01hdGhTZXJ2ZXIuQ2xpZW50KHByb3QpOworICAgICAgICAgICAgaWYoIGFjdGlvbiAhPSBudWxsKQorICAgICAgICAgICAgICAgIGFjdGlvbihjbGllbnQpOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudEV4Y2VwdGlvbigiYWN0aW9uIG11c3Qgbm90IGJlIG51bGwiKTsKKworICAgICAgICAgICAgLy8gbWFrZSBzdXJlIGV2ZXJ5dGhpbmcgaXMgd3JpdHRlbiB0byB0aGUgTWVtb3J5U3RyZWFtCisgICAgICAgICAgICB0cm5zLkZsdXNoKCk7CisKKyAgICAgICAgICAgIC8vIHNlbmQgdGhlIG1lc3NhZ2UKKyAgICAgICAgICAgIHZhciBtc2cgPSBuZXcgTWF0aFJlcXVlc3RDYWxsKCkgeyByYXdCeXRlcyA9IHN0bS5Ub0FycmF5KCkgfTsKKyAgICAgICAgICAgIE1RQWRhcHRlci5CdXMuU2VuZChtc2cpOworICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgdm9pZCBQaW5nKGxvbmcgdmFsdWUpCisgICAgICAgIHsKKyAgICAgICAgICAgIFNlcmlhbGl6ZVRocmlmdENhbGwoY2xpZW50ID0+CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2xpZW50LlBpbmcodmFsdWUpOworICAgICAgICAgICAgfSk7CisgICAgICAgIH0KKworCisgICAgICAgIHB1YmxpYyB2b2lkIERvVGhlTWF0aCggaW50IGFyZzEsIGludCBhcmcyKQorICAgICAgICB7CisgICAgICAgICAgICBTZXJpYWxpemVUaHJpZnRDYWxsKGNsaWVudCA9PgorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudC5Eb1RoZU1hdGgoYXJnMSwgYXJnMik7CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgIH0KK30KKwpkaWZmIC0tZ2l0IGEvY29udHJpYi9SZWJ1cy9TZXJ2aWNlSW1wbC9TZXJ2ZXIuY3MgYi9jb250cmliL1JlYnVzL1NlcnZpY2VJbXBsL1NlcnZlci5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xNDlkNTEzCi0tLSAvZGV2L251bGwKKysrIGIvY29udHJpYi9SZWJ1cy9TZXJ2aWNlSW1wbC9TZXJ2ZXIuY3MKQEAgLTAsMCArMSwxNDMgQEAKKy8qKgorICogTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQorICogb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuIFNlZSB0aGUgTk9USUNFIGZpbGUKKyAqIGRpc3RyaWJ1dGVkIHdpdGggdGhpcyB3b3JrIGZvciBhZGRpdGlvbmFsIGluZm9yb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sbCk7ICAvLyBvbmV3YXkgb25seQorICAgICAgICB9CisgICAgfQorCisKKyAgICAvLyBzZXJ2ZXMgaW5jb21pbmcgY2FsY3VsYXRpb24gcmVxdWVzdHMKKyAgICBpbnRlcm5hbCBjbGFzcyBNYXRoUmVxdWVzdHNIYW5kbGVyIDogQmFzaWNNYXRoU2VydmVyLklmYWNlCisgICAgeworICAgICAgICBwdWJsaWMgdm9pZCBQaW5nKGxvbmcgdmFsdWUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBjbGllbnQgPSBuZXcgTWF0aFJlc3BvbnNlQ2xpZW50KCJsb2NhbGhvc3QiKTsKKyAgICAgICAgICAgIGNsaWVudC5Qb25nKHZhbHVlKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHVibGljIHZvaWQgRG9UaGVNYXRoKGludCBhcmcxLCBpbnQgYXJnMikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGNsaWVudCA9IG5ldyBNYXRoUmVzcG9uc2VDbGllbnQoImxvY2FsaG9zdCIpOworICAgICAgICAgICAgaWYoIGFyZzIgIT0gMCkKKyAgICAgICAgICAgICAgICBjbGllbnQuRm91clJlc3VsdHMoIGFyZzErYXJnMiwgYXJnMSphcmcyLCBhcmcxLWFyZzIsIGFyZzEvYXJnMik7CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgY2xpZW50LlRocmVlUmVzdWx0cyggYXJnMSthcmcyLCBhcmcxKmFyZzIsIGFyZzEtYXJnMik7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8vIHByb3ZpZGVzIHRoZSBjbGllbnQtc2lkZSBpbnRlcmZhY2UgZm9yIGNhbGN1bGF0aW9uIHJlc3BvbnNlcworICAgIGludGVybmFsIGNsYXNzIE1hdGhSZXNwb25zZUNsaWVudCA6IEJhc2ljTWF0aENsaWVudC5JZmFjZQorICAgIHsKKyAgICAgICAgcHJpdmF0ZSBCdWlsdGluQ29udGFpbmVyQWRhcHRlciBNUUFkYXB0ZXI7CisKKworICAgICAgICBwdWJsaWMgTWF0aFJlc3BvbnNlQ2xpZW50KHN0cmluZyBzZXJ2ZXIpCisgICAgICAgIHsKKyAgICAgICAgICAgIE1RQWRhcHRlciA9IG5ldyBCdWlsdGluQ29udGFpbmVyQWRhcHRlcigpOworICAgICAgICAgICAgQ29uZmlndXJlLldpdGgoTVFBZGFwdGVyKQorICAgICAgICAgICAgICAgIC5UcmFuc3BvcnQodCA9PiB0LlVzZVJhYmJpdE1xSW5PbmVXYXlNb2RlKCJhbXFwOi8vIiArIHNlcnZlcikpICAvLyB3ZSBuZWVkIHNlbmQgb25seQorICAgICAgICAgICAgICAgIC5NZXNzYWdlT3duZXJzaGlwKG8gPT4gby5Gcm9tUmVidXNDb25maWd1cmF0aW9uU2VjdGlvbigpKQorICAgICAgICAgICAgICAgIC5DcmVhdGVCdXMoKS5TdGFydCgpOworICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgdm9pZCBTZXJpYWxpemVUaHJpZnRDYWxsKEFjdGlvbjxCYXNpY01hdGhDbGllbnQuSWZhY2U+IGFjdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgLy8gVGhyaWZ0IHByb3RvY29sL3RyYW5zcG9ydCBzdGFjaworICAgICAgICAgICAgdmFyIHN0bSA9IG5ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgICAgIHZhciB0cm5zID0gbmV3IFRTdHJlYW1UcmFuc3BvcnQobnVsbCwgc3RtKTsKKyAgICAgICAgICAgIHZhciBwcm90ID0gbmV3IFRCaW5hcnlQcm90b2NvbCh0cm5zKTsKKworICAgICAgICAgICAgLy8gc2VyaWFsaXplIHRoZSBjYWxsIGludG8gYSBidW5jaCBvZiBieXRlcworICAgICAgICAgICAgdmFyIGNsaWVudCA9IG5ldyBCYXNpY01hdGhDbGllbnQuQ2xpZW50KHByb3QpOworICAgICAgICAgICAgaWYgKGFjdGlvbiAhPSBudWxsKQorICAgICAgICAgICAgICAgIGFjdGlvbihjbGllbnQpOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudEV4Y2VwdGlvbigiYWN0aW9uIG11c3Qgbm90IGJlIG51bGwiKTsKKworICAgICAgICAgICAgLy8gbWFrZSBzdXJlIGV2ZXJ5dGhpbmcgaXMgd3JpdHRlbiB0byB0aGUgTWVtb3J5U3RyZWFtCisgICAgICAgICAgICB0cm5zLkZsdXNoKCk7CisKKyAgICAgICAgICAgIC8vIHNlbmQgdGhlIG1lc3NhZ2UKKyAgICAgICAgICAgIHZhciBtc2cgPSBuZXcgTWF0aFJlc3BvbnNlQ2FsbCgpIHsgcmF3Qnl0ZXMgPSBzdG0uVG9BcnJheSgpIH07CisgICAgICAgICAgICBNUUFkYXB0ZXIuQnVzLlNlbmQobXNnKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHVibGljIHZvaWQgUG9uZyhsb25nIHZhbHVlKQorICAgICAgICB7CisgICAgICAgICAgICBTZXJpYWxpemVUaHJpZnRDYWxsKGNsaWVudCA9PgorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudC5Qb25nKHZhbHVlKTsKKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgdm9pZCBUaHJlZVJlc3VsdHMoaW50IGFkZGVkLCBpbnQgbXVsdGlwbGllZCwgaW50IHN1Y3RyYWN0ZWQpCisgICAgICAgIHsKKyAgICAgICAgICAgIFNlcmlhbGl6ZVRocmlmdENhbGwoY2xpZW50ID0+CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2xpZW50LlRocmVlUmVzdWx0cyhhZGRlZCwgbXVsdGlwbGllZCwgc3VjdHJhY3RlZCk7CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHVibGljIHZvaWQgRm91clJlc3VsdHMoaW50IGFkZGVkLCBpbnQgbXVsdGlwbGllZCwgaW50IHN1Y3RyYWN0ZWQsIGludCBkaXZp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pbXBvcnQgZmJfc3RhdHVzCiAKKwogY2xhc3MgRmFjZWJvb2tCYXNlKEZhY2Vib29rU2VydmljZS5JZmFjZSk6CiAKLSAgZGVmIF9faW5pdF9fKHNlbGYsIG5hbWUpOgotICAgIHNlbGYubmFtZSA9IG5hbWUKLSAgICBzZWxmLmFsaXZlID0gaW50KHRpbWUudGltZSgpKQotICAgIHNlbGYuY291bnRlcnMgPSB7fQorICAgIGRlZiBfX2luaXRfXyhzZWxmLCBuYW1lKToKKyAgICAgICAgc2VsZi5uYW1lID0gbmFtZQorICAgICAgICBzZWxmLmFsaXZlID0gaW50KHRpbWUudGltZSgpKQorICAgICAgICBzZWxmLmNvdW50ZXJzID0ge30KIAotICBkZWYgZ2V0TmFtZShzZWxmLCApOgotICAgIHJldHVybiBzZWxmLm5hbWUKKyAgICBkZWYgZ2V0TmFtZShzZWxmLCApOgorICAgICAgICByZXR1cm4gc2VsZi5uYW1lCiAKLSAgZGVmIGdldFZlcnNpb24oc2VsZiwgKToKLSAgICByZXR1cm4gJycKKyAgICBkZWYgZ2V0VmVyc2lvbihzZWxmLCApOgorICAgICAgICByZXR1cm4gJycKIAotICBkZWYgZ2V0U3RhdHVzKHNlbGYsICk6Ci0gICAgcmV0dXJuIGZiX3N0YXR1cy5BTElWRQorICAgIGRlZiBnZXRTdGF0dXMoc2VsZiwgKToKKyAgICAgICAgcmV0dXJuIGZiX3N0YXR1cy5BTElWRQogCi0gIGRlZiBnZXRDb3VudGVycyhzZWxmKToKLSAgICByZXR1cm4gc2VsZi5jb3VudGVycworICAgIGRlZiBnZXRDb3VudGVycyhzZWxmKToKKyAgICAgICAgcmV0dXJuIHNlbGYuY291bnRlcnMKIAotICBkZWYgcmVzZXRDb3VudGVyKHNlbGYsIGtleSk6Ci0gICAgc2VsZi5jb3VudGVyc1trZXldID0gMAorICAgIGRlZiByZXNldENvdW50ZXIoc2VsZiwga2V5KToKKyAgICAgICAgc2VsZi5jb3VudGVyc1trZXldID0gMAogCi0gIG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2cKLQotICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBmYl9zdGF0dXMuQUxJVkUpOgotICAgICAgICAgICAgICAgIHJldHVybiAyCi0gICAgICAgICAgICBlbHNlOgotICAgICAgICAgICAgICAgIHJldHVybiAzCisgICAgICAgICAgICBwcmludChtc2cpCisgICAgICAgICAgICByZXR1cm4gMiBpZiBzdGF0dXMgPT0gZmJfc3RhdHVzLkFMSVZFIGVsc2UgMwogICAgICAgICBleGNlcHQ6Ci0gICAgICAgICAgICBwcmludCAiRmFpbGVkIHRvIGdldCBzdGF0dXMiCisgICAgICAgICAgICBwcmludCgiRmFpbGVkIHRvIGdldCBzdGF0dXMiKQogICAgICAgICAgICAgcmV0dXJuIDMKIAogICAgICMgc2NhbGFyIGNvbW1hbmRzCi0gICAgaWYgY29tbWFuZCBpbiBbInZlcnNpb24iLCJhbGl2ZSIsIm5hbWUiXToKKyAgICBpZiBjb21tYW5kIGluIFsidmVyc2lvbiIsICJhbGl2ZSIsICJuYW1lIl06CiAgICAgICAgIHRyeToKLSAgICAgICAgICAgIHJlc3VsdCA9IGZiMzAzX3dyYXBwZXIoY29tbWFuZCwgIHBvcnQsIHRyYW5zX2ZhY3RvcnksIHByb3RfZmFjdG9yeSkKLSAgICAgICAgICAgIHByaW50IHJlc3VsdAorICAgICAgICAgICAgcmVzdWx0ID0gZmIzMDNfd3JhcHBlcihjb21tYW5kLCBwb3J0LCB0cmFuc19mYWN0b3J5LCBwcm90X2ZhY3RvcnkpCisgICAgICAgICAgICBwcmludChyZXN1bHQpCiAgICAgICAgICAgICByZXR1cm4gMAogICAgICAgICBleGNlcHQ6Ci0gICAgICAgICAgICBwcmludCAiZmFpbGVkIHRvIGdldCAiLGNvbW1hbmQKKyAgICAgICAgICAgIHByaW50KCJmYWlsZWQgdG8gZ2V0ICIsIGNvbW1hbmQpCiAgICAgICAgICAgICByZXR1cm4gMwogCiAgICAgIyBjb3VudGVycwogICAgIGlmIGNvbW1hbmQgaW4gWyJjb3VudGVycyJdOgogICAgICAgICB0cnk6Ci0gICAgICAgICAgICBjb3VudGVycyA9IGZiMzAzX3dyYXBwZXIoJ2NvdW50ZXJzJywgIHBvcnQsIHRyYW5zX2ZhY3RvcnksIHByb3RfZmFjdG9yeSkKKyAgICAgICAgICAgIGNvdW50ZXJzID0gZmIzMDNfd3JhcHBlcignY291bnRlcnMnLCBwb3J0LCB0cmFuc19mYWN0b3J5LCBwcm90X2ZhY3RvcnkpCiAgICAgICAgICAgICBmb3IgY291bnRlciBpbiBjb3VudGVyczoKLSAgICAgICAgICAgICAgICBwcmludCAiJXM6ICVkIiAlIChjb3VudGVyLCBjb3VudGVyc1tjb3VudGVyXSkKKyAgICAgICAgICAgICAgICBwcmludCgiJXM6ICVkIiAlIChjb3VudGVyLmVuY29kZSgndXRmLTgnKSwgY291bnRlcnNbY291bnRlcl0pKQogICAgICAgICAgICAgcmV0dXJuIDAKICAgICAgICAgZXhjZXB0OgotICAgICAgICAgICAgcHJpbnQgImZhaWxlZCB0byBnZXQgY291bnRlcnMiCisgICAgICAgICAgICBwcmludCgiZmFpbGVkIHRvIGdldCBjb3VudGVycyIpCiAgICAgICAgICAgICByZXR1cm4gMwogCi0KICAgICAjIE9ubHkgcm9vdCBzaG91bGQgYmUgYWJsZSB0byBydW4gdGhlIGZvbGxvd2luZyBjb21tYW5kcwogICAgIGlmIG9zLmdldHVpZCgpID09IDA6CiAgICAgICAgICMgYXN5bmMgY29tbWFuZHMKLSAgICAgICAgaWYgY29tbWFuZCBpbiBbInN0b3AiLCJyZWxvYWQiXSA6CisgICAgICAgIGlmIGNvbW1hbmQgaW4gWyJzdG9wIiwgInJlbG9hZCJdOgogICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgIGZiMzAzX3dyYXBwZXIoY29tbWFuZCwgcG9ydCwgdHJhbnNfZmFjdG9yeSwgcHJvdF9mYWN0b3J5KQogICAgICAgICAgICAgICAgIHJldHVybiAwCiAgICAgICAgICAgICBleGNlcHQ6Ci0gICAgICAgICAgICAgICAgcHJpbnQgImZhaWxlZCB0byB0ZWxsIHRoZSBzZXJ2aWNlIHRvICIsIGNvbW1hbmQKKyAgICAgICAgICAgICAgICBwcmludCgiZmFpbGVkIHRvIHRlbGwgdGhlIHNlcnZpY2UgdG8gIiwgY29tbWFuZCkKICAgICAgICAgICAgICAgICByZXR1cm4gMwogICAgIGVsc2U6Ci0gICAgICAgIGlmIGNvbW1hbmQgaW4gWyJzdG9wIiwicmVsb2FkIl06Ci0gICAgICAgICAgICBwcmludCAicm9vdCBwcml2aWxlZ2VzIGFyZSByZXF1aXJlZCB0byBzdG9wIG9yIHJlbG9hZCB0aGUgc2VydmljZS4iCisgICAgICAgIGlmIGNvbW1hbmQgaW4gWyJzdG9wIiwgInJlbG9hZCJdOgorICAgICAgICAgICAgcHJpbnQoInJvb3QgcHJpdmlsZWdlcyBhcmUgcmVxdWlyZWQgdG8gc3RvcCBvciByZWxvYWQgdGhlIHNlcnZpY2UuIikKICAgICAgICAgICAgIHJldHVybiA0CiAKLSAgICBwcmludCAiVGhlIGZvbGxvd2luZyBjb21tYW5kcyBhcmUgYXZhaWxhYmxlOiIKLSAgICBmb3IgY29tbWFuZCBpbiBbImNvdW50ZXJzIiwibmFtZSIsInZlcnNpb24iLCJhbGl2ZSIsInN0YXR1cyJdOgotICAgICAgICBwcmludCAiXHQlcyIgJSBjb21tYW5kCi0gICAgcHJpbnQgIlRoZSBmb2xsb3dpbmcgY29tbWFuZHMgYXJlIGF2YWlsYWJsZSBmb3IgdXNlcnMgd2l0aCByb290IHByaXZpbGVnZXM6IgotICAgIGZvciBjb21tYW5kIGluIFsic3RvcCIsInJlbG9hZCJdOgotICAgICAgICBwcmludCAiXHQlcyIgJSBjb21tYW5kCisgICAgcHJpbnQoIlRoZSBmb2xsb3dpbmcgY29tbWFuZHMgYXJlIGF2YWlsYWJsZToiKQorICAgIGZvciBjb21tYW5kIGluIFsiY291bnRlcnMiLCAibmFtZSIsICJ2ZXJzaW9uIi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tIGFkZHIybGluZTsgZ290ICVyJyAlIFwKLSAgICAgICAgICAgICAgICAgICAgKGZpbGVfYW5kX2xpbmUsKQorICAgICAgICAgICAgICAgIChmaWxlX2FuZF9saW5lLCkKICAgICAgICAgICAgIG1zZyArPSAnXG5maWxlPSVyLCBhZGRyZXNzPSVyJyAlIChmaWxlbmFtZSwgYWRkcmVzcy5hZGRyZXNzKQogICAgICAgICAgICAgcmFpc2UgRXhjZXB0aW9uKG1zZykKIAogICAgICAgICBhZGRyZXNzLnNvdXJjZUZpbGUgPSBmaWxlX2FuZF9saW5lWzppZHhdCi0gICAgICAgIGFkZHJlc3Muc291cmNlTGluZSA9IGZpbGVfYW5kX2xpbmVbaWR4KzE6XQorICAgICAgICBhZGRyZXNzLnNvdXJjZUxpbmUgPSBmaWxlX2FuZF9saW5lW2lkeCArIDE6XQogCiAgICAgKHJlbWFpbmluZ19vdXQsIGNtZF9lcnIpID0gcHJvYy5jb21tdW5pY2F0ZSgpCiAgICAgcmV0Y29kZSA9IHByb2Mud2FpdCgpCkBAIC0xODAsNyArMTgyLDcgQEAKIAogICAgIHZpcnRfY2FsbF9yZWdleCA9IHJlLmNvbXBpbGUocideXHMqVF9WSVJUVUFMX0NBTEw6IChcZCspIGNhbGxzIG9uICguKik6JCcpCiAgICAgZ2VuX3Byb3RfcmVnZXggPSByZS5jb21waWxlKAotICAgICAgICAgICAgcideXHMqVF9HRU5FUklDX1BST1RPQ09MOiAoXGQrKSBjYWxscyB0byAoLiopIHdpdGggYSAoLiopOiQnKQorICAgICAgICByJ15ccypUX0dFTkVSSUNfUFJPVE9DT0w6IChcZCspIGNhbGxzIHRvICguKikgd2l0aCBhICguKik6JCcpCiAgICAgYnRfcmVnZXggPSByZS5jb21waWxlKHInXlxzKiMoXGQrKVxzKiguKikgXFsoMHhbMC05QS1aYS16XSspXF0kJykKIAogICAgICMgUGFyc2UgYWxsIG9mIHRoZSBpbnB1dCwgYW5kIHN0b3JlIGl0IGFzIEVudHJ5IG9iamVjdHMKQEAgLTIwOSw3ICsyMTEsNyBAQAogICAgICAgICAgICAgICAgICMgIl9aIiB0byB0aGUgdHlwZSBuYW1lIHRvIG1ha2UgaXQgbG9vayBsaWtlIGFuIGV4dGVybmFsIG5hbWUuCiAgICAgICAgICAgICAgICAgdHlwZV9uYW1lID0gJ19aJyArIHR5cGVfbmFtZQogICAgICAgICAgICAgaGVhZGVyID0gJ1RfVklSVFVBTF9DQUxMOiAlZCBjYWxscyBvbiAiJXMiJyAlIFwKLSAgICAgICAgICAgICAgICAgICAgKG51bV9jYWxscywgdHlwZV9uYW1lKQorICAgICAgICAgICAgICAgIChudW1fY2FsbHMsIHR5cGVfbmFtZSkKICAgICAgICAgICAgIGlmIGN1cnJlbnRfZW50cnkgaXMgbm90IE5vbmU6CiAgICAgICAgICAgICAgICAgZW50cmllcy5hcHBlbmQoY3VycmVudF9lbnRyeSkKICAgICAgICAgICAgIGN1cnJlbnRfZW50cnkgPSBFbnRyeShoZWFkZXIpCkBAIC0yMjQsNyArMjI2LDcgQEAKICAgICAgICAgICAgICAgICB0eXBlX25hbWUxID0gJ19aJyArIHR5cGVfbmFtZTEKICAgICAgICAgICAgICAgICB0eXBlX25hbWUyID0gJ19aJyArIHR5cGVfbmFtZTIKICAgICAgICAgICAgIGhlYWRlciA9ICdUX0dFTkVSSUNfUFJPVE9DT0w6ICVkIGNhbGxzIHRvICIlcyIgd2l0aCBhICIlcyInICUgXAotICAgICAgICAgICAgICAgICAgICAobnVtX2NhbGxzLCB0eXBlX25hbWUxLCB0eXBlX25hbWUyKQorICAgICAgICAgICAgICAgIChudW1fY2FsbHMsIHR5cGVfbmFtZTEsIHR5cGVfbmFtZTIpCiAgICAgICAgICAgICBpZiBjdXJyZW50X2VudHJ5IGlzIG5vdCBOb25lOgogICAgICAgICAgICAgICAgIGVudHJpZXMuYXBwZW5kKGN1cnJlbnRfZW50cnkpCiAgICAgICAgICAgICBjdXJyZW50X2VudHJ5ID0gRW50cnkoaGVhZGVyKQ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mlmdCI7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgREVGQVVMVF9JTkNMVURFUyA9ICIqKi8qIiArIFRIUklGVF9GSUxFX1NVRkZJWDsKKworICAgIC8qKgorICAgICAqIFRoZSBjdXJyZW50IE1hdmVuIHByb2plY3QuCisgICAgICoKKyAgICAgKiBAcGFyYW1ldGVyIGRlZmF1bHQtdmFsdWU9IiR7cHJvamVjdH0iCisgICAgICogQHJlYWRvbmx5CisgICAgICogQHJlcXVpcmVkCisgICAgICovCisgICAgcHJvdGVjdGVkIE1hdmVuUHJvamVjdCBwcm9qZWN0OworCisgICAgLyoqCisgICAgICogQSBoZWxwZXIgdXNlZCB0byBhZGQgcmVzb3VyY2VzIHRvIHRoZSBwcm9qZWN0LgorICAgICAqCisgICAgICogQGNvbXBvbmVudAorICAgICAqIEByZXF1aXJlZAorICAgICAqLworICAgIHByb3RlY3RlZCBNYXZlblByb2plY3RIZWxwZXIgcHJvamVjdEhlbHBlcjsKKworICAgIC8qKgorICAgICAqIFRoaXMgaXMgdGhlIHBhdGggdG8gdGhlIHtAY29kZSB0aHJpZnR9IGV4ZWN1dGFibGUuIEJ5IGRlZmF1bHQgaXQgd2lsbCBzZWFyY2ggdGhlIHtAY29kZSAkUEFUSH0uCisgICAgICoKKyAgICAgKiBAcGFyYW1ldGVyIGRlZmF1bHQtdmFsdWU9InRocmlmdCIKKyAgICAgKiBAcmVxdWlyZWQKKyAgICAgKi8KKyAgICBwcml2YXRlIFN0cmluZyB0aHJpZnRFeGVjdXRhYmxlOworCisgICAgLyoqCisgICAgICogVGhpcyBzdHJpbmcgaXMgcGFzc2VkIHRvIHRoZSB7QGNvZGUgLS1nZW59IG9wdGlvbiBvZiB0aGUge0Bjb2RlIHRocmlmdH0gcGFyYW1ldGVyLiBCeSBkZWZhdWx0CisgICAgICogaXQgd2lsbCBnZW5lcmF0ZSBKYXZhIG91dHB1dC4gVGhlIG1haW4gcmVhc29uIGZvciB0aGlzI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LyoqCisgICAgICogQHBhcmFtZXRlcgorICAgICAqLworICAgIHByaXZhdGUgYm9vbGVhbiBjaGVja1N0YWxlbmVzcyA9IGZhbHNlOworCisgICAgLyoqCisgICAgICogRXhlY3V0ZXMgdGhlIG1vam8uCisgICAgICovCisgICAgcHVibGljIHZvaWQgZXhlY3V0ZSgpIHRocm93cyBNb2pvRXhlY3V0aW9uRXhjZXB0aW9uLCBNb2pvRmFpbHVyZUV4Y2VwdGlvbiB7CisgICAgICAgIGNoZWNrUGFyYW1ldGVycygpOworICAgICAgICBmaW5hbCBGaWxlIHRocmlmdFNvdXJjZVJvb3QgPSBnZXRUaHJpZnRTb3VyY2VSb290KCk7CisgICAgICAgIGlmICh0aHJpZnRTb3VyY2VSb290LmV4aXN0cygpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIEltbXV0YWJsZVNldDxGaWxlPiB0aHJpZnRGaWxlcyA9IGZpbmRUaHJpZnRGaWxlc0luRGlyZWN0b3J5KHRocmlmdFNvdXJjZVJvb3QpOworICAgICAgICAgICAgICAgIGZpbmFsIEZpbGUgb3V0cHV0RGlyZWN0b3J5ID0gZ2V0T3V0cHV0RGlyZWN0b3J5KCk7CisgICAgICAgICAgICAgICAgSW1tdXRhYmxlU2V0PEZpbGU+IG91dHB1dEZpbGVzID0gZmluZEdlbmVyYXRlZEZpbGVzSW5EaXJlY3RvcnkoZ2V0T3V0cHV0RGlyZWN0b3J5KCkpOworCisgICAgICAgICAgICAgICAgaWYgKHRocmlmdEZpbGVzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICBnZXRMb2coKS5pbmZvKCJObyB0aHJpZnQgZmlsZXMgdG8gY29tcGlsZS4iKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoZWNrU3RhbGVuZXNzICYmICgobGFzdE1vZGlmaWVkKHRocmlmdEZpbGVzKSArIHN0YWxlTWlsbGlzKSA8IGxhc3RNb2RpZmllZChvdXRwdXRGaWxlcykpKSB7CisgICAgICAgICAgICAgICAgICAgIGdldExvZygpLmluZm8oIlNraXBwaW5nIGNvbXBpbGF0aW9uIGJlY2F1c2UgdGFyZ2V0IGRpcmVjdG9yeSBuZXdlciB0aGFuIHNvdXJjZXMuIik7CisgICAgICAgICAgICAgICAgICAgIGF0dGFjaEZpbGVzKCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgSW1tdXRhYmxlU2V0PEZpbGU+IGRlcml2ZWRUaHJpZnRQYXRoRWxlbWVudHMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VUaHJpZnRQYXRoRnJvbUphcnModGVtcG9yYXJ5VGhyaWZ0RmlsZURpcmVjdG9yeSwgZ2V0RGVwZW5kZW5jeUFydGlmYWN0RmlsZXMoKSk7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dERpcmVjdG9yeS5ta2RpcnMoKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBRdWljayBmaXggdG8gZml4IGlzc3VlcyB3aXRoIHR3byBtdm4gaW5zdGFsbHMgaW4gYSByb3cgKGllIG5vIGNsZWFuKQorICAgICAgICAgICAgICAgICAgICAvLyBjbGVhbkRpcmVjdG9yeShvdXRwdXREaXJlY3RvcnkpOworCisgICAgICAgICAgICAgICAgICAgIFRocmlmdCB0aHJpZnQgPSBuZXcgVGhyaWZ0LkJ1aWxkZXIodGhyaWZ0RXhlY3V0YWJsZSwgb3V0cHV0RGlyZWN0b3J5KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRHZW5lcmF0b3IoZ2VuZXJhdG9yKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hZGRUaHJpZnRQYXRoRWxlbWVudCh0aHJpZnRTb3VyY2VSb290KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hZGRUaHJpZnRQYXRoRWxlbWVudHMoZGVyaXZlZFRocmlmdFBhdGhFbGVtZW50cykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkVGhyaWZ0UGF0aEVsZW1lbnRzKGFzTGlzdChhZGRpdGlvbmFsVGhyaWZ0UGF0aEVsZW1lbnRzKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYWRkVGhyaWZ0RmlsZXModGhyaWZ0RmlsZXMpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmJ1aWxkKCk7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBleGl0U3RhdHVzID0gdGhyaWZ0LmNvbXBpbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGV4aXRTdGF0dXMgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TG9nKCkuZXJyb3IoInRocmlmdCBmYWlsZWQgb3V0cHV0OiAiICsgdGhyaWZ0LmdldE91dHB1dCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdldExvZygpLmVycm9yKCJ0aHJpZnQgZmFpbGVkIGVycm9yOiAiICsgdGhyaWZ0LmdldEVycm9yKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1vam9GYWlsdXJlRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhyaWZ0IGRpZCBub3QgZXhpdCBjbGVhbmx5LiBSZXZpZXcgb3V0cHV0IGZvciBtb3JlIGluZm9ybWF0aW9uLiIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGF0dGFjaEZpbGVzKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBNb2pvRXhlY3V0aW9uRXhjZXB0aW9uKCJBbiBJTyBlcnJvciBvY2N1cnJlZCIsIGUpOworICAgICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIC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hhbiBpbmNsdWRpbmcgLmphciBhcyB0aGVyZSBtYXkgYmUgb3RoZXIgZXh0ZW5zaW9ucyBpbiB1c2UgKHNhciwgaGFyLCB6aXApCisgICAgICAgICAgICBpZiAoY2xhc3NwYXRoRWxlbWVudEZpbGUuaXNGaWxlKCkgJiYgY2xhc3NwYXRoRWxlbWVudEZpbGUuY2FuUmVhZCgpICYmCisgICAgICAgICAgICAgICAgICAgICFjbGFzc3BhdGhFbGVtZW50RmlsZS5nZXROYW1lKCkuZW5kc1dpdGgoIi54bWwiKSkgeworCisgICAgICAgICAgICAgICAgLy8gY3JlYXRlIHRoZSBqYXIgZmlsZS4gdGhlIGNvbnN0cnVjdG9yIHZhbGlkYXRlcy4KKyAgICAgICAgICAgICAgICBKYXJGaWxlIGNsYXNzcGF0aEphcjsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBjbGFzc3BhdGhKYXIgPSBuZXcgSmFyRmlsZShjbGFzc3BhdGhFbGVtZW50RmlsZSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKGZvcm1hdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiJXMgd2FzIG5vdCBhIHJlYWRhYmxlIGFydGlmYWN0IiwgY2xhc3NwYXRoRWxlbWVudEZpbGUpKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgKiBDb3B5IGVhY2ggLnRocmlmdCBmaWxlIGZvdW5kIGluIHRoZSBKQVIgaW50byBhIHRlbXBvcmFyeSBkaXJlY3RvcnksIHByZXNlcnZpbmcgdGhlCisgICAgICAgICAgICAgICAgICogZGlyZWN0b3J5IHBhdGggaXQgaGFkIHJlbGF0aXZlIHRvIGl0cyBjb250YWluaW5nIEpBUi4gQWRkIHRoZSByZXN1bHRpbmcgcm9vdCBkaXJlY3RvcnkKKyAgICAgICAgICAgICAgICAgKiAodW5pcXVlIGZvciBlYWNoIEpBUiBwcm9jZXNzZWQpIHRvIHRoZSBzZXQgb2YgdGhyaWZ0IGluY2x1ZGUgZGlyZWN0b3JpZXMgdG8gdXNlIHdoZW4KKyAgICAgICAgICAgICAgICAgKiBjb21waWxpbmcuCisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgZm9yIChKYXJFbnRyeSBqYXJFbnRyeSA6IGxpc3QoY2xhc3NwYXRoSmFyLmVudHJpZXMoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGphckVudHJ5TmFtZSA9IGphckVudHJ5LmdldE5hbWUoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGphckVudHJ5LmdldE5hbWUoKS5lbmRzV2l0aChUSFJJRlRfRklMRV9TVUZGSVgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdHJ1bmNhdGVkSmFyUGF0aCA9IHRydW5jYXRlUGF0aChjbGFzc3BhdGhKYXIuZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIEZpbGUgdGhyaWZ0Um9vdERpcmVjdG9yeSA9IG5ldyBGaWxlKHRlbXBvcmFyeVRocmlmdEZpbGVEaXJlY3RvcnksIHRydW5jYXRlZEphclBhdGgpOworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgRmlsZSB1bmNvbXByZXNzZWRDb3B5ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEZpbGUodGhyaWZ0Um9vdERpcmVjdG9yeSwgamFyRW50cnlOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVuY29tcHJlc3NlZENvcHkuZ2V0UGFyZW50RmlsZSgpLm1rZGlycygpOworICAgICAgICAgICAgICAgICAgICAgICAgY29weVN0cmVhbVRvRmlsZShuZXcgUmF3SW5wdXRTdHJlYW1GYWNhZGUoY2xhc3NwYXRoSmFyCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRJbnB1dFN0cmVhbShqYXJFbnRyeSkpLCB1bmNvbXByZXNzZWRDb3B5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocmlmdERpcmVjdG9yaWVzLmFkZCh0aHJpZnRSb290RGlyZWN0b3J5KTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgfSBlbHNlIGlmIChjbGFzc3BhdGhFbGVtZW50RmlsZS5pc0RpcmVjdG9yeSgpKSB7CisgICAgICAgICAgICAgICAgRmlsZVtdIHRocmlmdEZpbGVzID0gY2xhc3NwYXRoRWxlbWVudEZpbGUubGlzdEZpbGVzKG5ldyBGaWxlbmFtZUZpbHRlcigpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gYWNjZXB0KEZpbGUgZGlyLCBTdHJpbmcgbmFtZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5hbWUuZW5kc1dpdGgoVEhSSUZUX0ZJTEVfU1VGRklYKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworCisgICAgICAgICAgICAgICAgaWYgKHRocmlmdEZpbGVzLmxlbmd0aCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyaWZ0RGlyZWN0b3JpZXMuYWRkKGNsYXNzcGF0aEVsZW1lbnRGaWxlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gSW1tdXRhYmxlU2V0LmNvcHlPZih0aHJpZnREaXJlY3Rvcmllcyk7CisgICAgfQorCisgICAgSW1tdXRhYmxlU2V0PEZpbGU+IGZpbmRUaHJpZnRGaWxlc0luRGlyZWN0b3J5KEZpbGUgZGlyZWN0b3J5KSB0aHJvd3MgSU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EJ5dGVzKCkpKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaEFsZ29yaXRobUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1vam9FeGVjdXRpb25FeGNlcHRpb24oIkZhaWxlZCB0byBleHBhbmQgZGVwZW5kZW50IGphciIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgU3RyaW5nIHJlcG9zaXRvcnkgPSBsb2NhbFJlcG9zaXRvcnkuZ2V0QmFzZWRpcigpLnJlcGxhY2UoJ1xcJywgJy8nKTsKKyAgICAgICAgaWYgKCFyZXBvc2l0b3J5LmVuZHNXaXRoKCIvIikpIHsKKyAgICAgICAgICAgIHJlcG9zaXRvcnkgKz0gIi8iOworICAgICAgICB9CisKKyAgICAgICAgU3RyaW5nIHBhdGggPSBqYXJQYXRoLnJlcGxhY2UoJ1xcJywgJy8nKTsKKyAgICAgICAgaW50IHJlcG9zaXRvcnlJbmRleCA9IHBhdGguaW5kZXhPZihyZXBvc2l0b3J5KTsKKyAgICAgICAgaWYgKHJlcG9zaXRvcnlJbmRleCAhPSAtMSkgeworICAgICAgICAgICAgcGF0aCA9IHBhdGguc3Vic3RyaW5nKHJlcG9zaXRvcnlJbmRleCArIHJlcG9zaXRvcnkubGVuZ3RoKCkpOworICAgICAgICB9CisKKyAgICAgICAgLy8gQnkgbm93IHRoZSBwYXRoIHNob3VsZCBiZSBnb29kLCBidXQgZG8gYSBmaW5hbCBjaGVjayB0byBmaXggd2luZG93cyBtYWNoaW5lcy4KKyAgICAgICAgaW50IGNvbG9uSW5kZXggPSBwYXRoLmluZGV4T2YoJzonKTsKKyAgICAgICAgaWYgKGNvbG9uSW5kZXggIT0gLTEpIHsKKyAgICAgICAgICAgIC8vIDIgPSA6XCBpbiBDOlwKKyAgICAgICAgICAgIHBhdGggPSBwYXRoLnN1YnN0cmluZyhjb2xvbkluZGV4ICsgMik7CisgICAgICAgIH0KKworICAg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BkaXJlY3RvcnkgaW50byB3aGljaCB0aGUgamF2YSBzb3VyY2UgZmlsZXMKKyAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lsbCBiZSBnZW5lcmF0ZWQuCisgICAgICAgICAqIEB0aHJvd3MgTnVsbFBvaW50ZXJFeGNlcHRpb24gICAgIElmIGVpdGhlciBvZiB0aGUgYXJndW1lbnRzIGFyZSB7QGNvZGUgbnVsbH0uCisgICAgICAgICAqIEB0aHJvd3MgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIElmIHRoZSB7QGNvZGUgamF2YU91dHB1dERpcmVjdG9yeX0gaXMKKyAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90IGEgZGlyZWN0b3J5LgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEJ1aWxkZXIoU3RyaW5nIGV4ZWN1dGFibGUsIEZpbGUgamF2YU91dHB1dERpcmVjdG9yeSkgeworICAgICAgICAgICAgdGhpcy5leGVjdXRhYmxlID0gY2hlY2tOb3ROdWxsKGV4ZWN1dGFibGUsICJleGVjdXRhYmxlIik7CisgICAgICAgICAgICB0aGlzLmphdmFPdXRwdXREaXJlY3RvcnkgPSBjaGVja05vdE51bGwoamF2YU91dHB1dERpcmVjdG9yeSk7CisgICAgICAgICAgICBjaGVja0FyZ3VtZW50KGphdmFPdXRwdXREaXJlY3RvcnkuaXNEaXJlY3RvcnkoKSk7CisgICAgICAgICAgICB0aGlzLnRocmlmdEZpbGVzID0gbmV3SGFzaFNldCgpOworICAgICAgICAgICAgdGhpcy50aHJpZnRQYXRoRWxlbWVudHMgPSBuZXdIYXNoU2V0KCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQWRkcyBhIHRocmlmdCBmaWxlIHRvIGJlIGNvbXBpbGVkLiBUaHJpZnQgZmlsZXMgbXVzdCBiZSBvbiB0aGUgdGhyaWZ0cGF0aAorICAgICAgICAgKiBhbmQgdGhpcyBtZXRob2Qgd2lsbCBmYWlsIGlmIGEgdGhyaWZ0IGZpbGUgaXMgYWRkZWQgd2l0aG91dCBmaXJzdCBhZGRpbmcgYQorICAgICAgICAgKiBwYXJlbnQgZGlyZWN0b3J5IHRvIHRoZSB0aHJpZnRwYXRoLgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gdGhyaWZ0RmlsZQorICAgICAgICAgKiBAcmV0dXJuIFRoZSBidWlsZGVyLgorICAgICAgICAgKiBAdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBJZiBhIHRocmlmdCBmaWxlIGlzIGFkZGVkIHdpdGhvdXQgZmlyc3QKKyAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkaW5nIGEgcGFyZW50IGRpcmVjdG9yeSB0byB0aGUgdGhyaWZ0cGF0aC4KKyAgICAgICAgICogQHRocm93cyBOdWxsUG9pbnRlckV4Y2VwdGlvbiAgSWYge0Bjb2RlIHRocmlmdEZpbGV9IGlzIHtAY29kZSBudWxsfS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBCdWlsZGVyIGFkZFRocmlmdEZpbGUoRmlsZSB0aHJpZnRGaWxlKSB7CisgICAgICAgICAgICBjaGVja05vdE51bGwodGhyaWZ0RmlsZSk7CisgICAgICAgICAgICBjaGVja0FyZ3VtZW50KHRocmlmdEZpbGUuaXNGaWxlKCkpOworICAgICAgICAgICAgY2hlY2tBcmd1bWVudCh0aHJpZnRGaWxlLmdldE5hbWUoKS5lbmRzV2l0aCgiLnRocmlmdCIpKTsKKyAgICAgICAgICAgIGNoZWNrVGhyaWZ0RmlsZUlzSW5UaHJpZnRQYXRoKHRocmlmdEZpbGUpOworICAgICAgICAgICAgdGhyaWZ0RmlsZXMuYWRkKHRocmlmdEZpbGUpOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQWRkcyB0aGUgb3B0aW9uIHN0cmluZyBmb3IgdGhlIFRocmlmdCBleGVjdXRhYmxlJ3Mge0Bjb2RlIC0tZ2VufSBwYXJhbWV0ZXIuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBnZW5lcmF0b3IKKyAgICAgICAgICogQHJldHVybiBUaGUgYnVpbGRlcgorICAgICAgICAgKiBAdGhyb3dzIE51bGxQb2ludGVyRXhjZXB0aW9uIElmIHtAY29kZSBnZW5lcmF0b3J9IGlzIHtAY29kZSBudWxsfS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldEdlbmVyYXRvcihTdHJpbmcgZ2VuZXJhdG9yKSB7CisgICAgICAgICAgICBjaGVja05vdE51bGwoZ2VuZXJhdG9yKTsKKyAgICAgICAgICAgIHRoaXMuZ2VuZXJhdG9yID0gZ2VuZXJhdG9yOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgY2hlY2tUaHJpZnRGaWxlSXNJblRocmlmdFBhdGgoRmlsZSB0aHJpZnRGaWxlKSB7CisgICAgICAgICAgICBhc3NlcnQgdGhyaWZ0RmlsZS5pc0ZpbGUoKTsKKyAgICAgICAgICAgIGNoZWNrU3RhdGUoY2hlY2tUaHJpZnRGaWxlSXNJblRocmlmdFBhdGhIZWxwZXIodGhyaWZ0RmlsZS5nZXRQYXJlbnRGaWxlKCkpKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBjaGVja1RocmlmdEZpbGVJc0luVGhyaWZ0UGF0aEhlbHBlcihGaWxlIGRpcmVjdG9yeSkgeworICAgICAgICAgICAgYXNzZXJ0IGRpcmVjdG9yeS5pc0RpcmVjdG9yeSgpOworICAgICAgICAgICAgaWYgKHRocmlmdFBhdGhFbGVtZW50cy5jb250YWlucyhkaXJlY3RvcnkpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGZpbmFsIEZpbGUgcGFyZW50RGlyZWN0b3J5ID0gZGlyZWN0b3J5LmdldFBhcmVudEZpbGUoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gKHBhcmVudERpcmVjdG9yeSA9PSBudWxsKSA/IGZhbHNlCisgICAgICAgICAgICAgICAgICAgICAgICA6IGNoZWNrVGhyaWZ0RmlsZUlzSW5UaHJpZnRQYXRoSGVscGVyKHBhcmVudERpcmVjdG9yeSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHNlZSAjYWRkVGhyaWZ0RmlsZShGaWxlKQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEJ1aWxkZXIgYWRkVGhyaWZ0RmlsZXMoSXRlcmFibGU8RmlsZT4gdGhyaWZ0RmlsZXMpIHsKKyAgICAgICAgICAgIGZvciAoRmlsZSB0aHJpZnRGaWxlIDogdGhyaWZ0RmlsZXMpIHsKKyAgICAgICAgICAgICAgICBhZGRUaHJpZnRGaWxlKHRocmlmdEZpbGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQWRkcyB0aGUge0Bjb2RlIHRocmlmdFBhdGhFbGVtZW50fSB0byB0aGUgdGhyaWZ0UGF0aC4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIHRocmlmdFBhdGhFbGVtZW50IEEgZGlyZWN0b3J5IHRvIGJlIHNlYXJjaGVkIGZvciBpbXBvcnRlZCB0aHJpZnQgbWVzc2FnZQorICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyIGRlZmluaXRpb25zLgorICAgICAgICAgKiBAcmV0dXJuIFRoZSBidWlsZGVyLgorICAgICAgICAgKiBAdGhyb3dzIE51bGxQb2ludGVyRXhjZXB0aW9uICAgICBJZiB7QGNvZGUgdGhyaWZ0UGF0aEVsZW1lbnR9IGlzIHtAY29kZSBudWxsfS4KKyAgICAgICAgICogQHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gSWYge0Bjb2RlIHRocmlmdFBhdGhFbGVtZW50fSBpcyBub3QgYQorICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXJlY3RvcnkuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQnVpbGRlciBhZGRUaHJpZnRQYXRoRWxlbWVudChGaWxlIHRocmlmdFBhdGhFbGVtZW50KSB7CisgICAgICAgICAgICBjaGVja05vdE51bGwodGhyaWZ0UGF0aEVsZW1lbnQpOworICAgICAgICAgICAgY2hlY2tBcmd1bWVudCh0aHJpZnRQYXRoRWxlbWVudC5pc0RpcmVjdG9yeSgpKTsKKyAgICAgICAgICAgIHRocmlmdFBhdGhFbGVtZW50cy5hZGQodGhyaWZ0UGF0aEVsZW1lbnQpOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHNlZSAjYWRkVGhyaWZ0UGF0aEVsZW1lbnQoRmlsZSkKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBCdWlsZGVyIGFkZFRocmlmdFBhdGhFbGVtZW50cyhJdGVyYWJsZTxGaWxlPiB0aHJpZnRQYXRoRWxlbWVudHMpIHsKKyAgICAgICAgICAgIGZvciAoRmlsZSB0aHJpZnRQYXRoRWxlbWVudCA6IHRocmlmdFBhdGhFbGVtZW50cykgeworICAgICAgICAgICAgICAgIGFkZFRocmlmdFBhdGhFbGVtZW50KHRocmlmdFBhdGhFbGVtZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEByZXR1cm4gQSBjb25maWd1cmVkIHtAbGluayBUaHJpZnR9IGluc3RhbmNlLgorICAgICAgICAgKiBAdGhyb3d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mlmdFBhdGhFbGVtZW50KGlkbERpcik7CisgICAgfQorCisgICAgQFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0VGhyaWZ0Q29tcGlsZSgpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBleGVjdXRlVGhyaWZ0Q29tcGlsZSgpOworICAgIH0KKworICAgIEBUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdFRocmlmdENvbXBpbGVXaXRoR2VuZXJhdG9yT3B0aW9uKCkgdGhyb3dzIEV4Y2VwdGlvbiB7CisgICAgICAgIGJ1aWxkZXIuc2V0R2VuZXJhdG9yKCJqYXZhOnByaXZhdGUtbWVtYmVycyIpOworICAgICAgICBleGVjdXRlVGhyaWZ0Q29tcGlsZSgpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBleGVjdXRlVGhyaWZ0Q29tcGlsZSgpIHRocm93cyBDb21tYW5kTGluZUV4Y2VwdGlvbiB7CisgICAgICAgIGZpbmFsIEZpbGUgdGhyaWZ0RmlsZSA9IG5ldyBGaWxlKGlkbERpciwgInNoYXJlZC50aHJpZnQiKTsKKworICAgICAgICBidWlsZGVyLmFkZFRocmlmdEZpbGUodGhyaWZ0RmlsZSk7CisKKyAgICAgICAgZmluYWwgVGhyaWZ0IHRocmlmdCA9IGJ1aWxkZXIuYnVpbGQoKTsKKworICAgICAgICBhc3NlcnRUcnVlKCJGaWxlIG5vdCBmb3VuZDogc2hhcmVkLnRocmlmdCIsIHRocmlmdEZpbGUuZXhpc3RzKCkpOworICAgICAgICBhc3NlcnRGYWxzZSgiZ2VuLWphdmEgZGlyZWN0b3J5IHNob3VsZCBub3QgZXhpc3QiLCBnZW5KYXZhRGlyLmV4aXN0cygpKTsKKworICAgICAgICAvLyBleGVjdXRlIHRoZSBjb21waWxlCisgICAgICAgIGZpbmFsIGludCByZXN1bHQgPSB0aHJpZnQuY29tcGlsZSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoMCwgcmVzdWx0KTsKKworICAgICAgICBh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pYmV2ZW50OiAtLXdpdGhvdXQtbGliZXZlbnQgfSBcCiAgICV7P3dpdGhvdXRfemxpYjogICAgIC0td2l0aG91dC16bGliICAgICB9IFwKLSAgLS13aXRob3V0LWphdmEgXAorICAlez93aXRob3V0X3Rlc3RzOiAgICAtLXdpdGhvdXQtdGVzdHMgICAgfSBcCisgICV7P3dpdGhvdXRfamF2YTogICAgIC0td2l0aG91dC1qYXZhICAgICB9IFwKKyAgJXs/d2l0aG91dF9weXRob246ICAgLS13aXRob3V0LXB5dGhvbiAgIH0gXAorICAlez93aXRob3V0X3J1Ynk6ICAgICAtLXdpdGhvdXQtcnVieSAgICAgfSBcCisgICV7P3dpdGhvdXRfcGhwOiAgICAgIC0td2l0aG91dC1waHAgICAgICB9IFwKKyAgJXshP3dpdGhvdXRfcGhwOiAgICAgUEhQX1BSRUZJWD0ke1JQTV9CVUlMRF9ST09UfS91c3IvbGliL3BocCB9IFwKICAgLS13aXRob3V0LWNzaGFycCBcCi0gIC0td2l0aG91dC1weXRob24gXAogICAtLXdpdGhvdXQtZXJsYW5nIFwKIAotbWFrZQorJWlmIDAleyE/d2l0aG91dF9ydWJ5OjF9CitldmFsICQoZ3JlcCAiXldJVEhfUlVCWV9UUlVFIiBjb25maWcubG9nKQoraWYgW1sgIiR7V0lUSF9SVUJZX1RSVUV9IiAhPSAiIiBdXTsgdGhlbgorICBzZXQgK3gKKyAgZWNobyAiIgorICBlY2hvICJjb25maWd1cmUgZGV0ZXJtaW5lZCB0aGF0IHJ1YnkgcmVxdWlyZW1lbnRzIGFyZSBtaXNzaW5nIChidW5kbGVyIGdlbT8pLCBlaXRoZXIgaW5zdGFsbCBtaXNzaW5nIGNvbXBvbmVudHMiID4mMgorICBlY2hvICJvciBkaXNhYmxlIHRoZSBydWJ5IHN1Yi1wYWNrYWdlcyBhcyBmb2xsb3dzOiIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4mMgorICBlY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IElORk8gMCBJRCAodmFyaW50KSAgICAgIHwgICAgICAgSU5GTyAwICBEQVRBIC4uLgorICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworICAgIHwgICAgICAgICAuLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuLi4gICAgICAgICAgICAgICAgICAgfAorICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAorICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQVlMT0FEICAgICAgICAgICAgICAgICAgICAgICAgICAgfAorICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAorICAgICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworCitUaGUgYExFTkdUSGAgZmllbGQgaXMgMzIgYml0cywgYW5kIGNvdW50cyB0aGUgcmVtYWluaW5nIGJ5dGVzIGluIHRoZQorcGFja2V0LCBOT1QgaW5jbHVkaW5nIHRoZSBsZW5ndGggZmllbGQuICBUaGUgaGVhZGVyIHNpemUgZmllbGQgaXMgMTYKK2JpdHMsIGFuZCBkZWZpbmVzIHRoZSBzaXplIG9mIHRoZSBoZWFkZXIgcmVtYWluaW5nIE5PVCBpbmNsdWRpbmcgdGhlCitgSEVBREVSIE1BR0lDYCwgYEZMQUdTYCwgYFNFUVVFTkNFIE5VTUJFUmAgYW5kIGhlYWRlciBzaXplIGZpZWxkcy4gIFRoZQorSGVhZGVyIHNpemUgZmllbGQgaXMgaW4gYnl0ZX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0gSUQncyBzaG91bGQgc2hhcmUgdGhlIHNhbWUgSUQgc3BhY2UuCisKKyMjIyBQQURESU5HOgorCitIZWFkZXIgd2lsbCBiZSBwYWRkZWQgb3V0IHRvIG5leHQgNC1ieXRlIGJvdW5kYXJ5IHdpdGggYDB4MDBgLgorCitNYXggZnJhbWUgc2l6ZSBpcyBgMHgzRkZGRkZGRmAsIHdoaWNoIGlzIHNsaWdodGx5IGxlc3MgdGhhbiBgSFRUUF9NQUdJQ2AuCitUaGlzIGFsbG93cyB1cyB0byBkaXN0aW5ndXNoIGJldHdlZW4gZGlmZmVyZW50IChvbGRlcikgdHJhbnNwb3J0cy4KKworIyMjIFRyYW5zZm9ybSBJRHM6CisKKyAgICBaTElCX1RSQU5TRk9STSAweDAxIC0gTm8gZGF0YSBmb3IgdGhpcy4gIFVzZSB6bGliIHRvIChkZSljb21wcmVzcyB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS4KKworICAgIEhNQUNfVFJBTlNGT1JNIDB4MDIgLSBWYXJpYWJsZSBhbW91bnQgb2YgbWFjIGRhdGEuICBPbmUgYnl0ZSB0byBzcGVjaWZ5CisgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUuIE1hYyBkYXRhIGlzIGFwcGVuZGVkIGF0IHRoZSBlbmQgb2YgdGhlIHBhY2tldC4KKyAgICBTTkFQUFlfVFJBTlNGT1JNICAweDAzICAtIE5vIGRhdGEgZm9yIHRoaXMuICBVc2Ugc25hcHB5IHRvIChkZSljb21wcmVzcyB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS4KKworCisjIyNJbmZvIElEczoKKworICAgIElORk9fS0VZVkFMVUUgMHgwMSAtIHZhcmludDMyIG51bWJlciBvZiBoZWFkZXJzLgorICAgICAgICAgICAgICAgICAgICAgICAtIGtleS92YWx1ZSBwYWlycyBvZiB2YXJzdHJpbmdzICh2YXJpbnQxNiBsZW5ndGggcGx1cworICAgICAgICAgICAgICAgICAgICAgIC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zIHRvIGFsbCB0YXJnZXQgbGFuZ3VhZ2VzLgorCisgICAgWzVdICBOYW1lc3BhY2UgICAgICAgOjo9ICAoICduYW1lc3BhY2UnICggTmFtZXNwYWNlU2NvcGUgSWRlbnRpZmllciApIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCAnc21hbGx0YWxrLmNhdGVnb3J5JyBTVElkZW50aWZpZXIgKSB8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICggJ3NtYWxsdGFsay5wcmVmaXgnIElkZW50aWZpZXIgKSApIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICggJ3BocF9uYW1lc3BhY2UnIExpdGVyYWwgKSB8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoICd4c2RfbmFtZXNwYWNlJyBMaXRlcmFsICkKKworICAgIFs2XSAgTmFtZXNwYWNlU2NvcGUgIDo6PSAgJyonIHwgJ2NwcCcgfCAnamF2YScgfCAncHknIHwgJ3BlcmwnIHwgJ3JiJyB8ICdjb2NvYScgfCAnY3NoYXJwJworCitOLkIuOiBTbWFsbHRhbGsgaGFzIHR3byBkaXN0aW5jdCB0eXBlcyBvZiBuYW1lc3BhY2UgY29tbWFuZHM6CisKKy0gc21hbGx0YWxrLnByZWZpeDogUHJlcGVuZGVkIHRvIGdlbmVyYXRlZCBjbGFzc25hbWVzLgorICAtIFNtYWxsdGFsayBkb2VzIG5vdCBoYXZlIG5hbWVzcGFjZXMgZm9yIGNsYXNzZXMsIHNvIHByZWZpeGVzCisgICAgYXJlIHVzZWQgdG8gYXZvaWQgY2xhc3MtbmFtZSBjb2xsaXNpb25zLgorICAgIE9mdGVuLCB0aGUgcHJlZml4IGlzIHRoZSBhdXRob3IncyBpbml0aWFscywgbGlrZSAiS0IiIG9yICJKV1MiLAorICAgIG9yIGFuIGFiYnJldmlhdGlvbiBvZiB0aGUgcGFja2FnZSBuYW1lLCBsaWtlICJNQyIgZ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ZhaWxhYmxlKTsKKyAgICAgICAgcmV0dXJuIHNvY2tldC5ieXRlc0F2YWlsYWJsZT4wOworICAgICAgfQorICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiByZWFkKGJ1ZjpCeXRlQXJyYXksIG9mZjppbnQsIGxlbjppbnQpOmludAorICAgIHsKKyAgICAgIHZhciBuMTppbnQgPSAwLCBuMjppbnQgPSAwLCBuMzppbnQgPSAwLCBuNDppbnQgPSAwLCBjaWR4OmludCA9IDI7CisgICAgICB2YXIgY2h1bmtTaXplOkJ5dGVBcnJheSA9IG5ldyBCeXRlQXJyYXkoKTsKKworICAgICAgdHJ5CisgICAgICB7CisgICAgICAgIGlucHV0LnJlYWRCeXRlcyhidWYsIG9mZiwgbGVuKTsKKyAgICAgICAgcmV0dXJuIGxlbjsKKyAgICAgIH0KKyAgICAgIGNhdGNoIChlOkVPRkVycm9yKQorICAgICAgeworICAgICAgICB0cmFjZShlKTsKKyAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFcnJvcihUVHJhbnNwb3J0RXJyb3IuRU5EX09GX0ZJTEUsICJObyBtb3JlIGRhdGEgYXZhaWxhYmxlLiIpOworICAgICAgfQorICAgICAgY2F0Y2ggKGU6SU9FcnJvcikKKyAgICAgIHsKKyAgICAgICAgdHJhY2UoZSk7CisgICAgICAgIGlmKGlzT3BlbigpKQorICAgICAgICB7CisgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFcnJvcihUVHJhbnNwb3J0RXJyb3IuVU5LTk9XTiwgIklPIGVycm9yIHdoaWxlIHJlYWRpbmc6ICIgKyBlKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEVycm9yKFRUcmFuc3BvcnRFcnJvci5OT1RfT1BFTiwgIlNvY2tldCBzZWVtIG5vdCB0byBiZSBvcGVuZ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ICAgc3JjL3RocmlmdC9jX2dsaWIvcHJvY2Vzc29yL3RocmlmdF9kaXNwYXRjaF9wcm9jZXNzb3IuYyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm9jZXNzb3IvdGhyaWZ0X211bHRpcGxleGVkX3Byb2Nlc3Nvci5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9wcm90b2NvbC5jIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3IuYyBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfcHJvdG9jb2xfZmFjdG9yeS5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9iaW5hcnlfcHJvdG9jb2wuYyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfc3RvcmVkX21lc3NhZ2VfcHJvdG9jb2wuYyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfbXVsdGlwbGV4ZWRfcHJvdG9jb2wuYyBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfYmluYXJ5X3Byb3RvY29sX2ZhY3RvcnkuYyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfY29tcGFjdF9wcm90b2NvbC5jIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9jb21wYWN0X3Byb3RvY29sX2ZhY3RvcnkuYyBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X3RyYW5zcG9ydC5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfdHJhbnNwb3J0X2ZhY3RvcnkuYyBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X2J1ZmZlcmVkX3RyYW5zcG9ydF9mYWN0b3J5LmMgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvdHJhbnNwb3J0L3RocmlmdF9mcmFtZWRfdHJhbnNwb3J0X2ZhY3RvcnkuYyBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X3NvY2tldC5jIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfc3NsX3NvY2tldC5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfc2VydmVyX3RyYW5zcG9ydC5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfc2VydmVyX3NvY2tldC5jIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfYnVmZmVyZWRfdHJhb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ZGVfcHJvdG9jb2xfSEVBREVSUyA9IHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9wcm90b2NvbC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3IuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfcHJvdG9jb2xfZmFjdG9yeS5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3Byb3RvY29sL3RocmlmdF9iaW5hcnlfcHJvdG9jb2wuaCBcCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfYmluYXJ5X3Byb3RvY29sX2ZhY3RvcnkuaAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvcHJvdG9jb2wvdGhyaWZ0X2JpbmFyeV9wcm90b2NvbF9mYWN0b3J5LmggXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvcHJvdG9jb2wvdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2wuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi9wcm90b2NvbC90aHJpZnRfY29tcGFjdF9wcm90b2NvbF9mYWN0b3J5LmggXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvcHJvdG9jb2wvdGhyaWZ0X211bHRpcGxleGVkX3Byb3RvY29sLmggXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvcHJvdG9jb2wvdGhyaWZ0X3N0b3JlZF9tZXNzYWdlX3Byb3RvY29sLmgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIAogCiBpbmNsdWRlX3RyYW5zcG9ydGRpciA9ICQoaW5jbHVkZV90aHJpZnRkaXIpL3RyYW5zcG9ydAogaW5jbHVkZV90cmFuc3BvcnRfSEVBREVSUyA9IHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0LmggXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfZmRfdHJhbnNwb3J0LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfZnJhbWVkX3RyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X21lbW9yeV9idWZmZXIuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jX2dsaWIvdHJhbnNwb3J0L3RocmlmdF9zZXJ2ZXJfc29ja2V0LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY19nbGliL3RyYW5zcG9ydC90aHJpZnRfc2VydmVyX3RyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X3NvY2tldC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X3BsYXRmb3JtX3NvY2tldC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2NfZ2xpYi90cmFuc3BvcnQvdGhyaWZ0X3NzbF9zb2NrZXQuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3Rocml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gYSBtZXRob2QgY2FsbCAqLworICBpZiAodGhyaWZ0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAoaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbXR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc2VxaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikgPCAwKSB7CisgICAgZ193YXJuaW5nICgiZXJyb3IgcmVhZGluZyBzdGFydCBvZiBtZXNzYWdlOiAlcyIsCisgICAgICAgICAgICAgICAoZXJyb3IgIT0gTlVMTCkgPyAoKmVycm9yKS0+bWVzc2FnZSA6ICIobnVsbCkiKTsKKyAgICByZXR1cm4gRkFMU0U7CisgIH0KKyAgZWxzZSBpZiAobXR5cGUgIT0gVF9DQUxMICYmIG10eXBlICE9IFRfT05FV0FZKSB7CisgICAgZ193YXJuaW5nICgicmVjZWl2ZWQgaW52YWxpZCBtZXNzYWdlIHR5cGUgJWQgZnJvbSBjbGllbnQiLCBtdHlwZSk7CisgICAgcmV0dXJuIEZBTFNFOworICB9CisKKyAgLyogRGlzcGF0Y2ggdGhlIG1ldGhvZCBjYWxsICovCisgIHJldHVybiBUSFJJRlRfRElTUEFUQ0hfUFJPQ0VTU09SX0dFVF9DTEFTUyAoZGlzcGF0Y2hfcHJvY2Vzc29yKQorICAgIC0+ZGlzcGF0Y2hfY2FsbCAoZGlzcGF0Y2hfcHJvY2Vzc29yLAorICAgICAgICAgICAgICAgICAgICAgaW4sCisgICAgICAgICAgICAgICAgICAgICBvdXQsCisgICAgICAgICAgICAgICAgICAgICBmbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgIHNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitzdGF0aWMgZ2Jvb2xlYW4KK3RocmlmdF9kaXNwYXRjaF9wcm9jZXNzb3JfcmVhbF9kaXNwYXRjaF9jYWxsIChUaHJpZnREaXNwYXRjaFByb2Nlc3NvciAqc2VsZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRQcm90b2NvbCAqaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0UHJvdG9jb2wgKm91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqZm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDMyIHNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRUcmFuc3BvcnQgKnRyYW5zcG9ydDsKKyAgVGhyaWZ0QXBwbGljYXRpb25FeGNlcHRpb24gKnhjZXB0aW9uOworICBnY2hhciAqbWVzc2FnZTsKKyAgZ2ludDMyIHJlc3VsdDsKKyAgZ2Jvb2xlYW4gZGlzcGF0Y2hfcmVzdWx0ID0gRkFMU0U7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKHNlbGYpOworCisgIC8qIEJ5IGRlZmF1bHQsIHJldHVybiBhbiBhcHBsaWNhdGlvbiBleGNlcHRpb24gdG8gdGhlIGNsaWVudCBpbmRpY2F0aW5nIHRoZQorICAgICBtZXRob2QgbmFtZSBpcyBub3QgcmVjb2duaXplZC4gKi8KKworICBpZiAoKHRocmlmdF9wcm90b2NvbF9za2lwIChpbiwgVF9TVFJVQ1QsIGVycm9yKSA8IDApIHx8CisgICAgICAodGhyaWZ0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9lbmQgKGluLCBlcnJvcikgPCAwKSkKKyAgICByZXR1cm4gRkFMU0U7CisKKyAgZ19vYmplY3RfZ2V0IChpbiwgInRyYW5zcG9ydCIsICZ0cmFuc3BvcnQsIE5VTEwpOworICByZXN1bHQgPSB0aHJpZnRfdHJhbnNwb3J0X3JlYWRfZW5kICh0cmFuc3BvcnQsIGVycm9yKTsKKyAgZ19vYmplY3RfdW5yZWYgKHRyYW5zcG9ydCk7CisgIGlmIChyZXN1bHQgPCAwKQorICAgIHJldHVybiBGQUxTRTsKKworICBpZiAodGhyaWZ0X3Byb3RvY29sX3dyaXRlX21lc3NhZ2VfYmVnaW4gKG91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0VYQ0VQVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXFpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikgPCAwKQorICAgIHJldHVybiBGQUxTRTsKKyAgbWVzc2FnZSA9IGdfc3RyY29uY2F0ICgiSW52YWxpZCBtZXRob2QgbmFtZTogJyIsIGZuYW1lLCAiJyIsIE5VTEwpOworICBnX2ZyZWUgKGZuYW1lKTsKKyAgeGNlcHRpb24gPQorICAgIGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQVBQTElDQVRJT05fRVhDRVBUSU9OLAorICAgICAgICAgICAgICAgICAgInR5cGUiLCAgICBUSFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX0VSUk9SX1VOS05PV05fTUVUSE9ELAorICAgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCBtZXNzYWdlLAorICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIGdfZnJlZSAobWVzc2FnZSk7CisgIHJlc3VsdCA9IHRocmlmdF9zdHJ1Y3Rfd3JpdGUgKFRIUklGVF9TVFJVQ1QgKHhjZXB0aW9uKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0LAorICA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AgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcik7CisKKyAgLyogcHJvdGVjdGVkICovCisgIGdib29sZWFuICgqZGlzcGF0Y2hfY2FsbCkgKFRocmlmdERpc3BhdGNoUHJvY2Vzc29yICpzZWxmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRQcm90b2NvbCAqaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFByb3RvY29sICpvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdjaGFyICpmbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDMyIHNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcik7Cit9OwordHlwZWRlZiBzdHJ1Y3QgX1RocmlmdERpc3BhdGNoUHJvY2Vzc29yQ2xhc3MgVGhyaWZ0RGlzcGF0Y2hQcm9jZXNzb3JDbGFzczsKKworLyogVXNlZCBieSBUSFJJRlRfVFlQRV9ESVNQQVRDSF9QUk9DRVNTT1IgKi8KK0dUeXBlIHRocmlmdF9kaXNwYXRjaF9wcm9jZXNzb3JfZ2V0X3R5cGUgKHZvaWQpOworCisvKiEKKyAqIFByb2Nlc3NlcyBhIHJlcXVlc3QuCisgKiBccHVibGljIFxtZW1iZXJvZiBUaHJpZnREaXNwYXRjaFByb2Nlc3NvckNsYXNzCisgKi8KK2dib29sZWFuIHRocmlmdF9kaXNwYXRjaF9wcm9jZXNzb3JfcHJvY2VzcyAoVGhyaWZ0UHJvY2Vzc29yICpwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFByb3RvY29sICppbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0UHJvdG9jb2wgKm91dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vyc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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQogewotICBUSFJJRlRfVU5VU0VEX1ZBUiAobmFtZSk7Ci0gIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKLQogICBnaW50MzIgcmV0OwogICBnaW50MzIgeGZlciA9IDA7CiAKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIFRIUklGVF9VTlVTRURfVkFSIChuYW1lKTsKKwogICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgKGdpbnQ4KSBmaWVsZF90eXBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkKICAgewpAQCAtMTYyLDExICsxNjMsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIHNpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCiB7Ci0gIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKLQogICBnaW50MzIgcmV0OwogICBnaW50MzIgeGZlciA9IDA7CiAKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCiAgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2J5dGUgKHByb3RvY29sLCAoZ2ludDgpIGtleV90eXBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkKICAgewpAQCAtMjAyLDExICsyMDMsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3VpbnQzMiBzaXplLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCiB7Ci0gIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsgCi0KICAgZ2ludDMyIHJldDsKICAgZ2ludDMyIHhmZXIgPSAwOwogCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKwogICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgKGdpbnQ4KSBlbGVtZW50X3R5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKQogICB7CkBAIC0yNTYsOCArMjU3LDExIEBACiB0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3dyaXRlX2Jvb2wgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2Jvb2xlYW4gdmFsdWUsIEdFcnJvciAqKmVycm9yKQogeworICBndWludDggdG1wOworCiAgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKLSAgZ3VpbnQ4IHRtcCA9IHZhbHVlID8gMSA6IDA7CisKKyAgdG1wID0gdmFsdWUgPyAxIDogMDsKICAgcmV0dXJuIHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgdG1wLCBlcnJvcik7CiB9CiAKQEAgLTI4MCw5ICsyODQsMTEgQEAKIHRocml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fd3JpdGUgKHByb3RvY29sLT50cmFuc3BvcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29uc3QgZ3BvaW50ZXIpICZiaXRzLCA4LCBlcnJvcikpCiAgIHsKQEAgLTM0NCw5ICszNTYsMTEgQEAKIHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfd3JpdGVfc3RyaW5nIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgKnN0ciwgR0Vycm9yICoqZXJyb3IpCiB7CisgIGd1aW50MzIgbGVuOworCiAgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKIAotICBndWludDMyIGxlbiA9IHN0ciAhPSBOVUxMID8gc3RybGVuIChzdHIpIDogMDsKKyAgbGVuID0gc3RyICE9IE5VTEwgPyBzdHJsZW4gKHN0cikgOiAwOwogICAvKiB3cml0ZSB0aGUgc3RyaW5nIGxlbmd0aCArIDEgd2hpY2ggaW5jbHVkZXMgdGhlIG51bGwgdGVybWluYXRvciAqLwogICByZXR1cm4gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2JpbmFyeSAocHJvdG9jb2wsIChjb25zdCBncG9pbnRlcikgc3RyLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiwgZXJyb3IpOwpAQCAtMzU3LDEwICszNzEsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBncG9pbnRlciBidWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3VpbnQzMiBsZW4sIEdFcnJvciAqKmVycm9yKQogewotICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CiAgIGdpbnQzMiByZXQ7CiAgIGdpbnQzMiB4ZmVyID0gMDsKIAorICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfaTMyIChwcm90b2NvbCwgbGVuLCBlcnJvcikpIDwgMCkKICAgewogICAgIHJldHVybiAtMTsKQEAgLTM4NiwxMiArNDAxLDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0TWVzc2FnZVR5cGUgKm1lc3NhZ2VfdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaW50MzIgKnNlcWlkLCBHRXJyb3IgKiplcnJvcikKIHsKLSAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOwotCiAgIGdpbnQzMiByZXQ7CiAgIGdpbnQzMiB4ZmVyID0gMDsKICAgZ2ludDMyIHN6OwogCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKwogICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF9yZWFkX2kzMiAocHJvdG9jb2wsICZzeiwgZXJyb3IpKSA8IDApCiAgIHsKICAgICByZXR1cm4gLTE7CkBAIC00NjQsMTMgKzQ3OSwxNCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaW50MTYgKmZpZWxkX2lkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKIHsKLSAgVEhSSUZUX1VOVVNFRF9WQVIgKG5hbWUpOwotICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7Ci0KICAgZ2ludDMyIHJldDsKICAgZ2ludDMyIHhmZXIgPSAwOwogICBnaW50OCB0eXBlOwogCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBUSFJJRlRfVU5VU0VEX1ZBUiAobmFtZSk7CisKICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfcmVhZF9ieXRlIChwcm90b2NvbCwgJnR5cGUsIGVycm9yKSkgPCAwKQogICB7CiAgICAgcmV0dXJuIC0xOwpAQCAtNTA2LDEzICs1MjIsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd1aW50MzIgKnNpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKIHsKLSAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOwotCiAgIGdpbnQzMiByZXQ7CiAgIGdpbnQzMiB4ZmVyID0gMDsKICAgZ2ludDggaywgdjsKICAgZ2ludDMyIHNpemVpOwogCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKwogICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF9yZWFkX2J5dGUgKHByb3RvY29sLCAmaywgZXJyb3IpKSA8IDApCiAgIHsKICAgICByZXR1cm4gLTE7CkBAIC01NTksMTMgKzU3NSwxMyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmVsZW1lbnRfdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndW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gICAgICAgICAgICAgICAgICAgICAgICAgICBiLCAxLCBlcnJvcikpIDwgMCkKICAgewogICAgIHJldHVybiAtMTsKICAgfQpAQCAtNjQxLDEzICs2NTgsMTQgQEAKIHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfcmVhZF9ieXRlIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGdpbnQ4ICp2YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKIHsKLSAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOwogICBnaW50MzIgcmV0OwogICBncG9pbnRlciBiWzFdOwogCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKwogICBpZiAoKHJldCA9Ci0gICAgICAgdGhyaWZ0X3RyYW5zcG9ydF9yZWFkIChwcm90b2NvbC0+dHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiwgMSwgZXJyb3IpKSA8IDApCisgICAgICAgdGhyaWZ0X3RyYW5zcG9ydF9yZWFkX2FsbCAocHJvdG9jb2wtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLCAxLCBlcnJvcikpIDwgMCkKICAgewogICAgIHJldHVybiAtMTsKICAgfQpAQCAtNjU5LDE4ICs2NzcsMjIgQEAKIHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfcmVhZF9pMTYgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgZ2ludDE2ICp2YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQogewotICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPTCAocHJvdG9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VfYXJyYXlbNF07CisgICAgZ2ludDMyIGludDMyOworICB9IGI7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOwogCiAgIGlmICgocmV0ID0KLSAgICAgICB0aHJpZnRfdHJhbnNwb3J0X3JlYWQgKHByb3RvY29sLT50cmFuc3BvcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLCA0LCBlcnJvcikpIDwgMCkKKyAgICAgICB0aHJpZnRfdHJhbnNwb3J0X3JlYWRfYWxsIChwcm90b2NvbC0+dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuYnl0ZV9hcnJheSwgNCwgZXJyb3IpKSA8IDApCiAgIHsKICAgICByZXR1cm4gLTE7CiAgIH0KLSAgKnZhbHVlID0gKihnaW50MzIgKikgYjsKLSAgKnZhbHVlID0gZ19udG9obCAoKnZhbHVlKTsKKyAgKnZhbHVlID0gZ19udG9obCAoYi5pbnQzMik7CiAgIHJldHVybiByZXQ7CiB9CiAKQEAgLTY5NywxOCArNzIzLDIyIEBACiB0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3JlYWRfaTY0IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGdpbnQ2NCAqdmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKIHsKLSAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19CSU5BUllfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOwogICBnaW50MzIgcmV0OwotICBncG9pbnRlciBiWzhdOworICB1bmlvbgorICB7CisgICAgZ2ludDggYnl0ZV9hcnJheVs4XTsKKyAgICBnaW50NjQgaW50NjQ7CisgIH0gYjsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPT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uICovCiAgIGlmICgocmV0ID0KICAgICAgICB0aHJpZnRfcHJvdG9jb2xfcmVhZF9pMzIgKHByb3RvY29sLCAmcmVhZF9sZW4sIGVycm9yKSkgPCAwKQpAQCAtNzUwLDE0ICs3ODQsMjEgQEAKICAgfQogICB4ZmVyICs9IHJldDsKIAotICBpZiAocmVhZF9sZW4gPiAwKQotICB7Ci0gICAgLyogYWxsb2NhdGUgdGhlIG1lbW9yeSBmb3IgdGhlIHN0cmluZyAqLwotICAgIGxlbiA9IChndWludDMyKSByZWFkX2xlbiArIDE7IC8vIHNwYWNlIGZvciBudWxsIHRlcm1pbmF0b3IKLSAgICAqc3RyID0gZ19uZXcwIChnY2hhciwgbGVuKTsKKyAgaWYgKHJlYWRfbGVuIDwgMCkgeworICAgIGdfc2V0X2Vycm9yIChlcnJvciwgVEhSSUZUX1BST1RPQ09MX0VSUk9SLAorICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfTkVHQVRJVkVfU0laRSwKKyAgICAgICAgICAgICAgICAgImdvdCBuZWdhdGl2ZSBzaXplIG9mICVkIiwgcmVhZF9sZW4pOworICAgICpzdHIgPSBOVUxMOworICAgIHJldHVybiAtMTsKKyAgfQorCisgIC8qIGFsbG9jYXRlIHRoZSBtZW1vcnkgZm9yIHRoZSBzdHJpbmcgKi8KKyAgbGVuID0gKGd1aW50MzIpIHJlYWRfbGVuICsgMTsgLyogc3BhY2UgZm9yIG51bGwgdGVybWluYXRvciAqLworICAqc3RyID0gZ19uZXcwIChnY2hhciwgbGVuKTsKKyAgaWYgKHJlYWRfbGVuID4gMCkgewogICAgIGlmICgocmV0ID0KLSAgICAgICAgIHRocmlmdF90cmFuc3BvcnRfcmVhZCAocHJvdG9jb2wtPnRyYW5zcG9ydCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKnN0ciwgcmVhZF9sZW4sIGVycm9yKSkgPCAwKQorICAgICAgICAgdGhyaWZ0X3RyYW5zcG9ydF9yZWFkX2FsbCAocHJvdG9jb2wtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpzdHIsIHJlYWRfbGVuLCBlcnJvcikpIDwgMCkKICAgICB7CiAgICAgICBnX2ZyZWUgKCpzdHIpOwogICAgICAgKnN0ciA9IE5VTEw7CkBAIC03NjYsNyArODA3LDcgQEAKICAgICB9CiAgICAgeGZlciArPSByZXQ7CiAgIH0gZWxzZSB7Ci0gICAgKnN0ciA9IE5VTEw7CisgICAgKipzdHIgPSAwOwogICB9CiAKICAgcmV0dXJuIHhmZXI7CkBAIC03NzcsMTEgKzgxOCwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3BvaW50ZXIgKmJ1ZiwgZ3VpbnQzMiAqbGVuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCiB7Ci0gIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQklOQVJZX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKICAgZ2ludDMyIHJldDsKICAgZ2ludDMyIHhmZXIgPSAwOwogICBnaW50MzIgcmVhZF9sZW4gPSAwOwogIAorICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0JJTkFSWV9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKICAgLyogcmVhZCB0aGUgbGVuZ3RoIGludG8gcmVhZF9sZW4gKi8KICAgaWYgKChyZXQgPQogICAgICAgIHRocmlmdF9wcm90b2NvbF9yZWFkX2kzMiAocHJvdG9jb2wsICZyZWFkX2xlbiwgZXJyb3IpKSA8IDApCkBAIC03OTYsOCArODM4LDggQEAKICAgICAqbGVuID0gKGd1aW50MzIpIHJlYWRfbGVuOwogICAgICpidWYgPSBnX25ldyAoZ3VjaGFyLCAqbGVuKTsKICAgICBpZiAoKHJldCA9Ci0gICAgICAgICB0aHJpZnRfdHJhbnNw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FJPVE9DT0wpCisKK3N0YXRpYyBjb25zdCBnaW50OCBQUk9UT0NPTF9JRCA9IChnaW50OCkweDgydTsKK3N0YXRpYyBjb25zdCBnaW50OCBWRVJTSU9OX04gPSAxOworc3RhdGljIGNvbnN0IGdpbnQ4IFZFUlNJT05fTUFTSyA9IDB4MWY7ICAgICAgIC8qIDAwMDEgMTExMSAqLworc3RhdGljIGNvbnN0IGdpbnQ4IFRZUEVfTUFTSyA9IChnaW50OCkweGUwdTsgIC8qIDExMTAgMDAwMCAqLworc3RhdGljIGNvbnN0IGdpbnQ4IFRZUEVfQklUUyA9IDB4MDc7ICAgICAgICAgIC8qIDAwMDAgMDExMSAqLworc3RhdGljIGNvbnN0IGdpbnQzMiBUWVBFX1NISUZUX0FNT1VOVCA9IDU7CisKK2VudW0gVHlwZXMgeworICBDVF9TVE9QICAgICAgICAgICA9IDB4MDAsCisgIENUX0JPT0xFQU5fVFJVRSAgID0gMHgwMSwKKyAgQ1RfQk9PTEVBTl9GQUxTRSAgPSAweDAyLAorICBDVF9CWVRFICAgICAgICAgICA9IDB4MDMsCisgIENUX0kxNiAgICAgICAgICAgID0gMHgwNCwKKyAgQ1RfSTMyICAgICAgICAgICAgPSAweDA1LAorICBDVF9JNjQgICAgICAgICAgICA9IDB4MDYsCisgIENUX0RPVUJMRSAgICAgICAgID0gMHgwNywKKyAgQ1RfQklOQVJZICAgICAgICAgPSAweDA4LAorICBDVF9MSVNUICAgICAgICAgICA9IDB4MDksCisgIENUX1NFVCAgICAgICAgICAgID0gMHgwQSwKKyAgQ1RfTUFQICAgICAgICAgICAgPSAweDBCLAorICBDVF9TVFJVQ1QgICAgICAgICA9IDB4MEMKK307CisKK3N0YXRpYyBjb25zdCBnaW50OCBUVHlwZVRvQ1R5cGVbMTZdID0geworICBDVF9TVE9QLCAvKiBUX1NUT1AgKi8KKyAgMCwgLyogdW51c2VkICovCisgIENUX0JPT0xFQU5fVFJVRSwgLyogVF9CT09MICovCisgIENUX0JZVEUsIC8qIFRfQllURSAqLworICBDVF9ET1VCTEUsIC8qIFRfRE9VQkxFICovCisgIDAsIC8qIHVudXNlZCAqLworICBDVF9JMTYsIC8qIFRfSTE2ICovCisgIDAsIC8qIHVudXNlZCAqLworICBDVF9JMzIsIC8qIFRfSTMyICovCisgIDAsIC8qIHVudXNlZCAqLworICBDVF9JNjQsIC8qIFRfSTY0ICovCisgIENUX0JJTkFSWSwgLyogVF9TVFJJTkcgKi8KKyAgQ1RfU1RSVUNULCAvKiBUX1NUUlVDVCAqLworICBDVF9NQVAsIC8qIFRfTUFQICovCisgIENUX1NFVCwgLyogVF9TRVQgKi8KKyAgQ1RfTElTVCwgLyogVF9MSVNUICovCit9OworCitzdGF0aWMgZ3VpbnQ2NAordGhyaWZ0X2JpdHdpc2VfY2FzdF9ndWludDY0IChjb25zdCBnZG91YmxlIHYpCit7CisgIHVuaW9uIHsKKyAgICBnZG91YmxlIGZyb207CisgICAgZ3VpbnQ2NCB0bzsKKyAgfSB1OworICB1LmZyb20gPSB2OworICByZXR1cm4gdS50bzsKK30KKworc3RhdGljIGdkb3VibGUKK3RocmlmdF9iaXR3aXNlX2Nhc3RfZ2RvdWJsZSAoY29uc3QgZ3VpbnQ2NCB2KQoreworICB1bmlvbiB7CisgICAgZ3VpbnQ2NCBmcm9tOworICAgIGdkb3VibGUgdG87CisgIH0gdTsKKyAgdS5mcm9tID0gdjsKKyAgcmV0dXJuIHUudG87Cit9CisKKy8qKgorICogQ29udmVydCBsIGludG8gYSB6aWd6YWcgbG9uZy4gVGhpcyBhbGxvd3MgbmVnYXRpdmUgbnVtYmVycyB0byBiZQorICogcmVwcmVzZW50ZWQgY29tcGFjdGx5IGFzIGEgdmFyaW50LgorICovCitzdGF0aWMgZ3VpbnQ2NAoraTY0X3RvX3ppZ3phZyAoY29uc3QgZ2ludDY0IGwpCit7CisgIHJldHVybiAoKChndWludDY0KWwpIDw8IDEpIF4gKGwgPj4gNjMpOworfQorCisvKioKKyAqIENvbnZlcnQgbiBpbnRvIGEgemlnemFnIGludC4gVGhpcyBhbGxvd3MgbmVnYXRpdmUgbnVtYmVycyB0byBiZQorICogcmVwcmVzZW50ZWQgY29tcGFjdGx5IGFzIGEgdmFyaW50LgorICovCitzdGF0aWMgZ3VpbnQzMgoraTMyX3RvX3ppZ3phZyAoY29uc3QgZ2ludDMyIG4pCit7CisgIHJldHVybiAoKChndWludDMyKW4pIDw8IDEpIF4gKG4gPj4gMzEpOworfQorCisvKioKKyAqIENvbnZlcnQgZnJvbSB6aWd6YWcgaW50IHRvIGludC4KKyAqLworc3RhdGljIGdpbnQzMgoremlnemFnX3RvX2kzMiAoZ3VpbnQzMiBuKQoreworICByZXR1cm4gKG4gPj4gMSkgXiAoZ3VpbnQzMikgKC0oZ2ludDMyKSAobiAmIDEpKTsKK30KKworLyoqCisgKiBDb252ZXJ0IGZyb20gemlnemFnIGxvbmcgdG8gbG9uZy4KKyAqLworc3RhdGljIGdpbnQ2NAoremlnemFnX3RvX2k2NCAoZ3VpbnQ2NCBuKQoreworICByZXR1cm4gKG4gPj4gMSkgXiAoZ3VpbnQ2NCkgKC0oZ2ludDY0KSAobiAmIDEpKTsKK30KKworVGhyaWZ0VHlwZSB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9nZXRfdHR5cGUgKFRocmlmdENvbXBhY3RQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDggdHlwZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChwcm90b2NvbCk7CisKKyAgc3dpdGNoICh0eXBlKSB7CisgICAgY2FzZSBUX1NUT1A6CisgICAgICByZXR1cm4gVF9TVE9QOworICAgIGNhc2UgQ1RfQk9PTEVBTl9GQUxTRToKKyAgICBjYXNlIENUX0JPT0xFQU5fVFJVRToKKyAgICAgIHJldHVybiBUX0JPT0w7CisgICAgY2FzZSBDVF9CWVRFOgorICAgICAgcmV0dXJuIFRfQllURTsKKyAgICBjYXNlIENUX0kxNjoKKyAgICAgIHJldHVybiBUX0kxNjsKKyAgICBjYXNlIENUX0kzMjoKKyAgICAgIHJldHVybiBUX0kzMjsKKyAgICBjYXNlIENUX0k2NDoKKyAgICAgIHJldHVybiBUX0k2NDsKKyAgICBjYXNlIENUX0RPVUJMRToKKyAgICAgIHJldHVybiBUX0RPVUJMRTsKKyAgICBjYXNlIENUX0JJTkFSWToKKyAgICAgIHJldHVybiBUX1NUUklORzsKKyAgICBjYXNlIENUX0xJU1Q6CisgICAgICByZXR1cm4gVF9MSVNUOworICAgIGNhc2UgQ1RfU0VUOgorICAgICAgcmV0dXJuIFRfU0VUOworICAgIGNhc2UgQ1RfTUFQOgorICAgICAgcmV0dXJuIFRfTUFQOworICAgIGNhc2UgQ1RfU1RSVUNUOgorICAgICAgcmV0dXJuIFRfU1RSVUNUOworICAgIGRlZmF1bHQ6CisgICAgICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICJ1bnJlY29nbml6ZWQgdHlwZSIpOworICAgICAgcmV0dXJuIC0xOworICB9Cit9CisKKy8qKgorICogV3JpdGUgYW4gaTMyIGFzIGEgdmFyaW50LiBSZXN1bHRzIGluIDEtNSBieXRlcyBvbiB0aGUgd2lyZS4KKyAqLworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV92YXJpbnQzMiAoVGhyaWZ0Q29tcGFjdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIG4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIGd1aW50OCBidWZbNV07CisgIGdpbnQzMiB4ZmVyOworICBndWludDMyIG07CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICB4ZmVyID0gMDsKKyAgbSA9IG47CisKKyAgd2hpbGUgKFRSVUUpIHsKKyAgICBpZiAoKG0gJiB+MHg3RikgPT0gMCkgeworICAgICAgYnVmW3hmZXIrK10gPSAoZ2ludDgpbTsKKyAgICAgIGJyZWFrOworICAgIH0gZWxzZSB7CisgICAgICBidWZbeGZlcisrXSA9IChnaW50OCkoKG0gJiAweDdGKSB8IDB4ODApOworICAgICAgbSA+Pj0gNzsKKyAgICB9CisgIH0KKworICBpZiAodGhyaWZ0X3RyYW5zcG9ydF93cml0ZSAoVEhSSUZUX1BST1RPQ09MIChwcm90b2NvbCktPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb25zdCBncG9pbnRlcikgYnVmLCB4ZmVyLCBlcnJvcikpIHsKKyAgICByZXR1cm4geGZlcjsKKyAgfSBlbHNlIHsKKyAgICByZXR1cm4gLTE7CisgIH0KK30KKworLyoqCisgKiBXcml0ZSBhbiBpNjQgYXMgYSB2YXJpbnQuIFJlc3VsdHMgaW4gMS0xMCBieXRlcyBvbiB0aGUgd2lyZS4KKyAqLworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV92YXJpbnQ2NCAoVGhyaWZ0Q29tcGFjdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDY0IG4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIGd1aW50OCBidWZbMTBdOworICBnaW50MzIgeGZlcjsKKyAgZ3VpbnQ2NCBtOworCisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgeGZlciA9IDA7CisgIG0gPSBuOworCisgIHdoaWxlIChUUlVFKSB7CisgICAgaWYgKChtICYgfjB4N0ZMKSA9PSAwKSB7CisgICAgICBidWZbeGZlcisrXSA9IChnaW50OCltOworICAgICAgYnJlYWs7CisgICAgfSBlbHNlIHsKKyAgICAgIGJ1Zlt4ZmVyKytdID0gKGdpbnQ4KSgobSAmIDB4N0YpIHwgMHg4MCk7CisgICAgICBtID4+PSA3OworICAgIH0KKyAgfQorCisgIGlmICh0aHJpZnRfdHJhbnNwb3J0X3dyaXRlIChUSFJJRlRfUFJPVE9DT0wgKHByb3RvY29sKS0+dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbnN0IGdwb2ludGVyKSBidWYsIHhmZXIsIGVycm9yKSkgeworICAgIHJldHVybiB4ZmVyOworICB9IGVsc2UgeworICAgIHJldHVybiAtMTsKKyAgfQorfQorCisvKioKKyAqIFJlYWQgYW4gaTY0IGZyb20gdGhlIHdpcmUgYXMgYSBwcm9wZXIgdmFyaW50LiBUaGUgTVNCIG9mIGVhY2ggYnl0ZSBpcyBzZXQKKyAqIGlmIHRoZXJlIGlzIGFub3RoZXIgYnl0ZSB0byBmb2xsb3cuIFRoaXMgY2FuIHJlYWQgdXAgdG8gMTAgYnl0ZXMuCisgKi8KK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF92YXJpbnQ2NCAoVGhyaWZ0Q29tcGFjdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQ2NCAqaTY0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sICp0cDsKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisgIGd1aW50NjQgdmFsOworICBnaW50IHNoaWZ0OworICBndWludDggYnl0ZTsKKworICB0cCA9IFRIUklGVF9QUk9UT0NPTCAocHJvdG9jb2wpOworICB4ZmVyID0gMDsKKyAgdmFsID0gMDsKKyAgc2hpZnQgPSAwOworICBieXRlID0gMDsKKworICB3aGlsZSAoVFJVRSkgeworICAgIGlmICgocmV0ID0gdGhyaWZ0X3RyYW5zcG9ydF9yZWFkX2FsbCAodHAtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChncG9pbnRlcikgJmJ5dGUsIDEsIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgICsreGZlcjsKKyAgICB2YWwgfD0gKGd1aW50NjQpKGJ5dGUgJiAweDdmKSA8PCBzaGlmdDsKKyAgICBzaGlmdCArPSA3OworICAgIGlmICghKGJ5dGUgJiAweDgwKSkgeworICAgICAgKmk2NCA9IChnaW50NjQpIHZhbDsKKyAgICAgIHJldHVybiB4ZmVyOworICAgIH0KKyAgICBpZiAoR19VTkxJS0VMWSAoeGZlciA9PSAxMCkpIHsgLyogNyAqIDkgPCA2NCA8IDcgKiAxMCAqLworICAgICAgZ19zZXRfZXJyb3IgKGVycm9yLCBUSFJJRlRfUFJPVE9DT0xfRVJST1IsCisgICAgICAgICAgICAgICAgICAgVEhSSUZUX1BST1RPQ09MX0VSUk9SX0lOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAidmFyaWFibGUtbGVuZ3RoIGludCBvdmVyIDEwIGJ5dGVzIik7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICB9Cit9CisKKy8qKgorICogUmVhZCBhbiBpMzIgZnJvbSB0aGUgd2lyZSBhcyBhIHZhcmludC4gVGhlIE1TQiBvZiBlYWNoIGJ5dGUgaXMgc2V0CisgKiBpZiB0aGVyZSBpcyBhbm90aGVyIGJ5dGUgdG8gZm9sbG93LiBUaGlzIGNhbiByZWFkIHVwIHRvIDUgYnl0ZXMuCisgKi8KK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF92YXJpbnQzMiAoVGhyaWZ0Q29tcGFjdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQzMiAqaTMyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIGdpbnQ2NCB2YWw7CisgIGdpbnQzMiByZXQ7CisgIGdpbnQzMiB4ZmVyOworCisgIHhmZXIgPSAwOworCisgIGlmICgocmV0ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF92YXJpbnQ2NCAocHJvdG9jb2wsICZ2YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSA8IDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgeGZlciArPSByZXQ7CisKKyAgKmkzMiA9IChnaW50MzIpdmFsOworCisgIHJldHVybiB4ZmVyOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luX2ludGVybmFsIChUaHJpZnRDb21wYWN0UHJvdG9jb2wKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAqbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUaHJpZnRUeXBlIGZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDE2IGZpZWxkX2lkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQ4IHR5cGVfb3ZlcnJpZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIGdpbnQzMiByZXQ7CisgIGdpbnQzMiB4ZmVyOworICBnaW50OCB0eXBlX3RvX3dyaXRlOworCisgIFRIUklGVF9VTlVTRURfVkFSIChuYW1lKTsKKworICB4ZmVyID0gMDsKKworICAvKiBpZiB0aGVyZSdzIGEgdHlwZSBvdmVycmlkZSwgdXNlIHRoYXQuICovCisgIHR5cGVfdG9fd3JpdGUKKyAgICA9ICh0eXBlX292ZXJyaWRlID09IC0xID8gVFR5cGVUb0NUeXBlW2ZpZWxkX3R5cGVdIDogdHlwZV9vdmVycmlkZSk7CisKKyAgLyogY2hlY2sgaWYgd2UgY2FuIHVzZSBkZWx0YSBlbmNvZGluZyBmb3IgdGhlIGZpZWxkIGlkICovCisgIGlmIChmaWVsZF9pZCA+IHByb3RvY29sLT5fbGFzdF9maWVsZF9pZAorICAgICAgJiYgZmllbGRfaWQgLSBwcm90b2NvbC0+X2xhc3RfZmllbGRfaWQgPD0gMTUpIHsKKyAgICAvKiB3cml0ZSB0aGVtIHRvZ2V0aGVyICovCisgICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfYnl0ZSAoVEhSSUZUX1BST1RPQ09MIChwcm90b2NvbCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdpbnQ4KSAoKGZpZWxkX2lkCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJvdG9jb2wtPl9sYXN0X2ZpZWxkX2lkKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IDQgfCB0eXBlX3RvX3dyaXRlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICB4ZmVyICs9IHJldDsKKyAgfSBlbHNlIHsKKyAgICAvKiB3cml0ZSB0aGVtIHNlcGFyYXRlICovCisgICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfYnl0ZSAoVEhSSUZUX1BST1RPQ09MIChwcm90b2NvbCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZV90b193cml0ZSwgZXJyb3IpKSA8IDApIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgeGZlciArPSByZXQ7CisKKyAgICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9pMTYgKFRIUklGVF9QUk9UT0NPTCAocHJvdG9jb2wpLCBmaWVsZF9pZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9CisKKyAgcHJvdG9jb2wtPl9sYXN0X2ZpZWxkX2lkID0gZmllbGRfaWQ7CisgIHJldHVybiB4ZmVyOworfQorCisvKioKKyAqIE1ldGhvZCBmb3Igd3JpdGluZyB0aGUgc3RhcnQgb2YgbGlzdHMgYW5kIHNldHMuIExpc3QgYW5kIHNldHMgb24KKyAqIHRoZSB3aXJlIGRpZmZlciBvbmx5IGJ5IHRoZSB0eXBlIGluZGljYXRvci4KKyAqLworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9jb2xsZWN0aW9uX2JlZ2luIChUaHJpZnRDb21wYWN0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVGhyaWZ0VHlwZSBlbGVtX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWludDMyIHNpemUsIEdFcnJvciAqKmVycm9yKQoreworICBnaW50MzIgcmV0OworICBnaW50MzIgeGZlcjsKKworICB4ZmVyID0gMDsKKworICBpZiAoc2l6ZSA8PSAxNCkgeworICAgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2J5dGUgKFRIUklGVF9QUk9UT0NPTCAocHJvdG9jb2wpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnaW50OCkgKHNpemUgPDwgNAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgVFR5cGVUb0NUeXBlW2VsZW1fdHlwZV0pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9IGVsc2UgeworICAgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2J5dGUgKFRIUklGVF9QUk9UT0NPTCAocHJvdG9jb2wpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnaW50OCkgKDB4ZjAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IFRUeXBlVG9DVHlwZVtlbGVtX3R5cGVdKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICB4ZmVyICs9IHJldDsKKworICAgIGlmICgocmV0ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfdmFyaW50MzIgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChndWludDMyKSBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9CisKKyAgcmV0dXJuIHhmZXI7Cit9CisKKy8qCisgKiBwdWJsaWMgbWV0aG9kcworICovCisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWVzc2FnZV9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgKm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUaHJpZnRNZXNzYWdlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50MzIgc2VxaWQsIEdFcnJvciAqKmVycm9yKQoreworICBnaW50OCB2ZXJzaW9uOworICBnaW50MzIgcmV0OworICBnaW50MzIgeGZlcjsKKworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHZlcnNpb24gPSAoVkVSU0lPTl9OICYgVkVSU0lPTl9NQVNLKQorICAgICAgICAgICAgfCAoKChnaW50MzIpIG1lc3NhZ2VfdHlwZSA8PCBUWVBFX1NISUZUX0FNT1VOVCkgJiBUWVBFX01BU0spOworICB4ZmVyID0gMDsKKworICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgUFJPVE9DT0xfSUQsIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgIHhmZXIgKz0gcmV0OworCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2J5dGUgKHByb3RvY29sLCB2ZXJzaW9uLCBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3ZhcmludDMyIChjcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGd1aW50MzIpIHNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9zdHJpbmcgKHByb3RvY29sLCBuYW1lLCBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICByZXR1cm4geGZlcjsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICAvKiBzYXRpc2Z5IC1XYWxsICovCisgIFRIUklGVF9VTlVTRURfVkFSIChwcm90b2NvbCk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cnVjdF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAqbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisgIEdRdWV1ZSAqcTsKKworICAvKiBzYXRpc2Z5IC1XYWxsICovCisgIFRIUklGVF9VTlVTRURfVkFSIChuYW1lKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKyAgcSA9ICYoY3AtPl9sYXN0X2ZpZWxkKTsKKworICBnX3F1ZXVlX3B1c2hfdGFpbCAocSwgR0lOVF9UT19QT0lOVEVSICgoZ2ludCkgY3AtPl9sYXN0X2ZpZWxkX2lkKSk7CisgIGNwLT5fbGFzdF9maWVsZF9pZCA9IDA7CisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cnVjdF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworICBHUXVldWUgKnE7CisKKyAgLyogc2F0aXNmeSAtV2FsbCAqLworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKyAgcSA9ICYoY3AtPl9sYXN0X2ZpZWxkKTsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwLT5fbGFzdF9maWVsZF9pZCA9IChnaW50MTYpIEdQT0lOVEVSX1RPX0lOVCAoZ19xdWV1ZV9wb3BfdGFpbCAocSkpOworICByZXR1cm4gMDsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdjaGFyICpuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUgZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50MTYgZmllbGRfaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBjcCA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCk7CisKKyAgaWYgKGZpZWxkX3R5cGUgPT0gVF9CT09MKSB7CisgICAgY3AtPl9ib29sX2ZpZWxkX25hbWUgPSBuYW1lOworICAgIGNwLT5fYm9vbF9maWVsZF90eXBlID0gZmllbGRfdHlwZTsKKyAgICBjcC0+X2Jvb2xfZmllbGRfaWQgPSBmaWVsZF9pZDsKKyAgICByZXR1cm4gMDsKKyAgfSBlbHNlIHsKKyAgICByZXR1cm4gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW5faW50ZXJuYWwgKGNwLCBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkX2lkLCAtMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKKyAgfQorfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgLyogc2F0aXNmeSAtV2FsbCAqLworICBUSFJJRlRfVU5VU0VEX1ZBUiAocHJvdG9jb2wpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworICByZXR1cm4gMDsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9zdG9wIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKyAgcmV0dXJuIHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgKGdpbnQ4KSBUX1NUT1AsIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tYXBfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVGhyaWZ0VHlwZSBrZXlfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVGhyaWZ0VHlwZSB2YWx1ZV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIHNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBnaW50MzIgcmV0OworICBnaW50MzIgeGZlcjsKKworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHhmZXIgPSAwOworCisgIGlmICgocmV0ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfdmFyaW50MzIgKGNwLCAoZ3VpbnQzMikgc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSA8IDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgeGZlciArPSByZXQ7CisKKyAgaWYgKHNpemUgPiAwKSB7CisgICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfYnl0ZSAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdpbnQ4KSAoVFR5cGVUb0NUeXBlW2tleV90eXBlXSA8PCA0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBUVHlwZVRvQ1R5cGVbdmFsdWVfdHlwZV0pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9CisKKyAgcmV0dXJuIHhmZXI7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWFwX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChwcm90b2NvbCk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2xpc3RfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUgZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3VpbnQzMiBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBjcCA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2NvbGxlY3Rpb25fYmVnaW4gKGNwLCBlbGVtZW50X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbGlzdF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKHByb3RvY29sKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKyAgcmV0dXJuIDA7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc2V0X2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUgZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIHNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHJldHVybiB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9jb2xsZWN0aW9uX2JlZ2luIChjcCwgZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSwgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3NldF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChwcm90b2NvbCk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2Jvb2wgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdib29sZWFuIHZhbHVlLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sICpjcDsKKworICBnaW50MzIgcmV0OworICBnaW50MzIgeGZlcjsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKworICB4ZmVyID0gMDsKKworICBpZiAoY3AtPl9ib29sX2ZpZWxkX25hbWUgIT0gTlVMTCkgeworICAgIC8qIHdlIGhhdmVuJ3Qgd3JpdHRlbiB0aGUgZmllbGQgaGVhZGVyIHlldCAqLworICAgIGlmICgocmV0ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW5faW50ZXJuYWwgKGNwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3AtPl9ib29sX2ZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcC0+X2Jvb2xfZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNwLT5fYm9vbF9maWVsZF9pZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnaW50OCkgKHZhbHVlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IENUX0JPT0xFQU5fVFJVRSA6IENUX0JPT0xFQU5fRkFMU0UpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSA8IDApIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgeGZlciArPSByZXQ7CisKKyAgICBjcC0+X2Jvb2xfZmllbGRfbmFtZSA9IE5VTEw7CisgIH0gZWxzZSB7CisgICAgLyogd2UncmUgbm90IHBhcnQgb2YgYSBmaWVsZCwgc28ganVzdCB3cml0ZSB0aGUgdmFsdWUgKi8KKyAgICBpZiAoKHJldCA9IHRocmlmdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2ludDgpICh2YWx1ZSA/IENUX0JPT0xFQU5fVFJVRQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogQ1RfQk9PTEVBTl9GQUxTRSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSA8IDApIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgeGZlciArPSByZXQ7CisgIH0KKyAgcmV0dXJuIHhmZXI7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYnl0ZSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBjb25zdCBnaW50OCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGlmICh0aHJpZnRfdHJhbnNwb3J0X3dyaXRlIChwcm90b2NvbC0+dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbnN0IGdwb2ludGVyKSAmdmFsdWUsIDEsIGVycm9yKSkgeworICAgIHJldHVybiAxOworICB9IGVsc2UgeworICAgIHJldHVybiAtMTsKKyAgfQorfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kxNiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBjb25zdCBnaW50MTYgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHJldHVybiB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV92YXJpbnQzMiAoY3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgaTMyX3RvX3ppZ3phZyAoKGdpbnQzMikgdmFsdWUpLAorICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9pMzIgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgY29uc3QgZ2ludDMyIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sICpjcDsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKworICByZXR1cm4gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfdmFyaW50MzIgKGNwLAorICAgICAgICAgICAgICAgICAgICAgICAgIGkzMl90b196aWd6YWcgKHZhbHVlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfaTY0IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGNvbnN0IGdpbnQ2NCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBjcCA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3ZhcmludDY0IChjcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBpNjRfdG9femlnemFnICh2YWx1ZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2RvdWJsZSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnZG91YmxlIHZhbHVlLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgZ3VpbnQ2NCBiaXRzOworCisgIGdfYXNzZXJ0IChzaXplb2YgKGdkb3VibGUpID09IHNpemVvZiAoZ3VpbnQ2NCkpOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgYml0cyA9IEdVSU5UNjRfVE9fTEUgKHRocmlmdF9iaXR3aXNlX2Nhc3RfZ3VpbnQ2NCAodmFsdWUpKTsKKyAgaWYgKHRocmlmdF90cmFuc3BvcnRfd3JpdGUgKHByb3RvY29sLT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29uc3QgZ3BvaW50ZXIpICZiaXRzLCA4LCBlcnJvcikpIHsKKyAgICByZXR1cm4gODsKKyAgfSBlbHNlIHsKKyAgICByZXR1cm4gLTE7CisgIH0KK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9zdHJpbmcgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgKnN0ciwgR0Vycm9yICoqZXJyb3IpCit7CisgIHNpemVfdCBsZW47CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBsZW4gPSBzdHIgIT0gTlVMTCA/IHN0cmxlbiAoc3RyKSA6IDA7CisgIGlmIChsZW4gPiBHX01BWElOVDMyKSB7CisgICAgZ19zZXRfZXJyb3IgKGVycm9yLCBUSFJJRlRfUFJPVE9DT0xfRVJST1IsCisgICAgICAgICAgICAgICAgIFRIUklGVF9QUk9UT0NPTF9FUlJPUl9TSVpFX0xJTUlULAorICAgICAgICAgICAgICAgICAic3RyaW5nIHNpemUgKGd1ZXNzOiAlbHUpIGlzIHRvbyBsYXJnZSIsICh1bnNpZ25lZCBsb25nKSBsZW4pOworICAgIHJldHVybiAtMTsKKyAgfQorCisgIC8qIHdyaXRlIHRoZSBzdHJpbmcgbGVuZ3RoICsgMSB3aGljaCBpbmNsdWRlcyB0aGUgbnVsbCB0ZXJtaW5hdG9yICovCisgIHJldHVybiB0aHJpZnRfcHJvdG9jb2xfd3JpdGVfYmluYXJ5IChwcm90b2NvbCwgKGNvbnN0IGdwb2ludGVyKSBzdHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29uc3QgZ3VpbnQzMikgbGVuLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYmluYXJ5IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdwb2ludGVyIGJ1ZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ3VpbnQzMiBsZW4sIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdpbnQzMiByZXQ7CisgIGdpbnQzMiB4ZmVyOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHhmZXIgPSAwOworCisgIGlmICgocmV0ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfdmFyaW50MzIgKGNwLCBsZW4sIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgIHhmZXIgKz0gcmV0OworCisgIGlmIChsZW4gPiAwKSB7CisgICAgLyogY2hlY2tpbmcgbGVuICsgeGZlciA+IHVpbnRfbWF4LCBidXQgd2UgZG9uJ3Qgd2FudCB0byBvdmVyZmxvdyB3aGlsZQorICAgICAqIGNoZWNraW5nIGZvciBvdmVyZmxvd3MuIHRyYW5zZm9ybWluZyB0byBsZW4gPiB1aW50X21heCAtIHhmZXIuCisgICAgICovCisgICAgaWYgKGxlbiA+IChndWludDMyKSAoR19NQVhJTlQzMiAtIHhmZXIpKSB7CisgICAgICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfU0laRV9MSU1JVCwKKyAgICAgICAgICAgICAgICAgICAic2l6ZSAlZCArICVkIGlzIHRvbyBsYXJnZSIsIGxlbiwgeGZlcik7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgaWYgKHRocmlmdF90cmFuc3BvcnRfd3JpdGUgKHByb3RvY29sLT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb25zdCBncG9pbnRlcikgYnVmLCBsZW4sIGVycm9yKSA9PSBGQUxTRSkgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICB4ZmVyICs9IGxlbjsKKyAgfQorCisgIHJldHVybiB4ZmVyOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqKm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdE1lc3NhZ2VUeXBlICptZXNzYWdlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQzMiAqc2VxaWQsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdpbnQzMiByZXQ7CisgIGdpbnQzMiB4ZmVyOworCisgIGdpbnQ4IHByb3RvY29sX2lkLCB2ZXJzaW9uX2FuZF90eXBlLCB2ZXJzaW9uOworCisgIHhmZXIgPSAwOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZwcm90b2NvbF9pZCwgZXJyb3IpKSA8IDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgeGZlciArPSByZXQ7CisKKyAgaWYgKHByb3RvY29sX2lkICE9IFBST1RPQ09MX0lEKSB7CisgICAgZ19zZXRfZXJyb3IgKGVycm9yLCBUSFJJRlRfUFJPVE9DT0xfRVJST1IsCisgICAgICAgICAgICAgICAgIFRIUklGVF9QUk9UT0NPTF9FUlJPUl9CQURfVkVSU0lPTiwKKyAgICAgICAgICAgICAgICAgImJhZCBwcm90b2NvbCBpZCIpOworICAgIHJldHVybiAtMTsKKyAgfQorCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZ2ZXJzaW9uX2FuZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgIHhmZXIgKz0gcmV0OworCisgIHZlcnNpb24gPSAoZ2ludDgpKHZlcnNpb25fYW5kX3R5cGUgJiBWRVJTSU9OX01BU0spOworICBpZiAodmVyc2lvbiAhPSBWRVJTSU9OX04pIHsKKyAgICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICAgVEhSSUZUX1BST1RPQ09MX0VSUk9SX0JBRF9WRVJTSU9OLAorICAgICAgICAgICAgICAgICAiYmFkIHZlcnNpb24gYW5kL29yIHR5cGUiKTsKKyAgICByZXR1cm4gLTE7CisgIH0KKworICAqbWVzc2FnZV90eXBlCisgICAgPSAoVGhyaWZ0TWVzc2FnZVR5cGUpKCh2ZXJzaW9uX2FuZF90eXBlID4+IFRZUEVfU0hJRlRfQU1PVU5UKSAmIFRZUEVfQklUUyk7CisKKyAgaWYgKChyZXQgPSB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX3ZhcmludDMyIChjcCwgc2VxaWQsIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgIHhmZXIgKz0gcmV0OworCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfc3RyaW5nIChwcm90b2NvbCwgbmFtZSwgZXJyb3IpKSA8IDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgeGZlciArPSByZXQ7CisKKyAgcmV0dXJuIHhmZXI7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChwcm90b2NvbCk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfc3RydWN0X2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgKipuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworICBHUXVldWUgKnE7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKyAgcSA9ICYoY3AtPl9sYXN0X2ZpZWxkKTsKKworICAqbmFtZSA9IE5VTEw7CisKKyAgZ19xdWV1ZV9wdXNoX3RhaWwgKHEsIEdJTlRfVE9fUE9JTlRFUiAoKGdpbnQpIGNwLT5fbGFzdF9maWVsZF9pZCkpOworICBjcC0+X2xhc3RfZmllbGRfaWQgPSAwOworCisgIHJldHVybiAwOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfc3RydWN0X2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sICpjcDsKKyAgR1F1ZXVlICpxOworCisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBjcCA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCk7CisgIHEgPSAmKGNwLT5fbGFzdF9maWVsZCk7CisKKyAgY3AtPl9sYXN0X2ZpZWxkX2lkID0gKGdpbnQxNikgR1BPSU5URVJfVE9fSU5UIChnX3F1ZXVlX3BvcF90YWlsIChxKSk7CisKKyAgcmV0dXJuIDA7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgKipuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VHlwZSAqZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQxNiAqZmllbGRfaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sICpjcDsKKworICBnaW50MzIgcmV0OworICBnaW50MzIgeGZlcjsKKworICBnaW50MTYgbW9kaWZpZXI7CisgIGdpbnQ4IGJ5dGU7CisgIGdpbnQ4IHR5cGU7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBjcCA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCk7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKG5hbWUpOworCisgIHhmZXIgPSAwOworCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZieXRlLCBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICB0eXBlID0gKGJ5dGUgJiAweDBmKTsKKworICAvKiBpZiBpdCdzIGEgc3RvcCwgdGhlbiB3ZSBjYW4gcmV0dXJuIGltbWVkaWF0ZWx5LCBhcyB0aGUgc3RydWN0IGlzIG92ZXIuICovCisgIGlmICh0eXBlID09IFRfU1RPUCkgeworICAgICpmaWVsZF90eXBlID0gVF9TVE9QOworICAgICpmaWVsZF9pZCA9IDA7CisgICAgcmV0dXJuIHhmZXI7CisgIH0KKworICAvKiBtYXNrIG9mZiB0aGUgNCBNU0Igb2YgdGhlIHR5cGUgaGVhZGVyLgorICAgKiBpdCBjb3VsZCBjb250YWluIGEgZmllbGQgaWQgZGVsdGEuCisgICAqLworICBtb2RpZmllciA9IChnaW50MTYpKCgoZ3VpbnQ4KWJ5dGUgJiAweGYwKSA+PiA0KT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5fbGFzdF9maWVsZF9pZCA9ICpmaWVsZF9pZDsKKworICByZXR1cm4geGZlcjsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAocHJvdG9jb2wpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworICByZXR1cm4gMDsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX21hcF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmtleV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKnZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3VpbnQzMiAqc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisKKyAgZ2ludDgga3ZfdHlwZTsKKyAgZ2ludDMyIG1zaXplOworCisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICBrdl90eXBlID0gMDsKKyAgbXNpemUgPSAwOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKworICB4ZmVyID0gMDsKKworICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfdmFyaW50MzIgKGNwLCAmbXNpemUsIGVycm9yKSkgPDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgeGZlciArPSByZXQ7CisKKyAgLyogc3RpbGwgcmVhZCB0aGUga3YgYnl0ZSBpZiBuZWdhdGl2ZSBzaXplICovCisgIGlmIChtc2l6ZSAhPSAwKSB7CisgICAgaWYgKChyZXQgPSB0aHJpZnRfcHJvdG9jb2xfcmVhZF9ieXRlIChwcm90b2NvbCwgJmt2X3R5cGUsIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9CisKKyAgaWYgKGNwLT5jb250YWluZXJfbGltaXQgPiAwICYmIG1zaXplID4gY3AtPmNvbnRhaW5lcl9saW1pdCkgeworICAgIGdfc2V0X2Vycm9yIChlcnJvciwgVEhSSUZUX1BST1RPQ09MX0VSUk9SLAorICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfU0laRV9MSU1JVCwKKyAgICAgICAgICAgICAgICAgImdvdCBzaXplIG92ZXIgbGltaXQgKCVkID4gJWQpIiwgbXNpemUsIGNwLT5jb250YWluZXJfbGltaXQpOworICAgIHJldHVybiAtMTsKKyAgfSBlbHNlIGlmIChtc2l6ZSA+IDApIHsKKyAgICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX2dldF90dHlwZSAoY3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnaW50OCkoKGd1aW50OClrdl90eXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPj4gNCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgICprZXlfdHlwZSA9IHJldDsKKyAgICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX2dldF90dHlwZSAoY3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnaW50OCkoKGd1aW50OClrdl90eXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiAweGYpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIDwgMCkgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICAqdmFsdWVfdHlwZSA9IHJldDsKKyAgICAqc2l6ZSA9IChndWludDMyKSBtc2l6ZTsKKyAgfSBlbHNlIGlmIChtc2l6ZSA9PSAwKSB7CisgICAgKmtleV90eXBlID0gMDsKKyAgICAqdmFsdWVfdHlwZSA9IDA7CisgICAgKnNpemUgPSAwOworICB9IGVsc2UgeworICAgIGdfc2V0X2Vycm9yIChlcnJvciwgVEhSSUZUX1BST1RPQ09MX0VSUk9SLAorICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfTkVHQVRJVkVfU0laRSwKKyAgICAgICAgICAgICAgICAgImdvdCBuZWdhdGl2ZSBzaXplIG9mICVkIiwgbXNpemUpOworICAgIHJldHVybiAtMTsKKyAgfQorCisgIHJldHVybiB4ZmVyOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWFwX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKHByb3RvY29sKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKyAgcmV0dXJuIDA7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9saXN0X2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmVsZW1lbnRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3VpbnQzMiAqc2l6ZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisKKyAgZ2ludDggc2l6ZV9hbmRfdHlwZTsKKyAgZ2ludDMyIGxzaXplOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHNpemVfYW5kX3R5cGUgPSAwOworCisgIHhmZXIgPSAwOworCisgIGlmICgocmV0ID0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZzaXplX2FuZF90eXBlLCBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICBsc2l6ZSA9ICgoZ3VpbnQ4KXNpemVfYW5kX3R5cGUgPj4gNCkgJiAweDBmOworICBpZiAobHNpemUgPT0gMTUpIHsKKyAgICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfdmFyaW50MzIgKGNwLCAmbHNpemUsIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworICB9CisKKyAgaWYgKGxzaXplIDwgMCkgeworICAgIGdfc2V0X2Vycm9yIChlcnJvciwgVEhSSUZUX1BST1RPQ09MX0VSUk9SLAorICAgICAgICAgICAgICAgICBUSFJJRlRfUFJPVE9DT0xfRVJST1JfTkVHQVRJVkVfU0laRSwKKyAgICAgICAgICAgICAgICAgImdvdCBuZWdhdGl2ZSBzaXplIG9mICVkIiwgbHNpemUpOworICAgIHJldHVybiAtMTsKKyAgfSBlbHNlIGlmIChjcC0+Y29udGFpbmVyX2xpbWl0ID4gMCAmJiBsc2l6ZSA+IGNwLT5jb250YWluZXJfbGltaXQpIHsKKyAgICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICAgVEhSSUZUX1BST1RPQ09MX0VSUk9SX1NJWkVfTElNSVQsCisgICAgICAgICAgICAgICAgICJnb3Qgc2l6ZSBvdmVyIGxpbWl0ICglZCA+ICVkKSIsIGxzaXplLCBjcC0+Y29udGFpbmVyX2xpbWl0KTsKKyAgICByZXR1cm4gLTE7CisgIH0KKworICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX2dldF90dHlwZSAoY3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2ludDgpKHNpemVfYW5kX3R5cGUgJiAweDBmKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgICplbGVtZW50X3R5cGUgPSByZXQ7CisgICpzaXplID0gKGd1aW50MzIpIGxzaXplOworCisgIHJldHVybiB4ZmVyOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbGlzdF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAocHJvdG9jb2wpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworICByZXR1cm4gMDsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX3NldF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmVsZW1lbnRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWludDMyICpzaXplLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgZ19yZXR1cm5fdmFsX2lmX2ZhaWwgKFRIUklGVF9JU19DT01QQUNUX1BST1RPQ09MIChwcm90b2NvbCksIC0xKTsKKworICByZXR1cm4gdGhyaWZ0X3Byb3RvY29sX3JlYWRfbGlzdF9iZWdpbiAocHJvdG9jb2wsIGVsZW1lbnRfdHlwZSwgc2l6ZSwgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfc2V0X2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKHByb3RvY29sKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKyAgcmV0dXJuIDA7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9ib29sIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGdib29sZWFuICp2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisKKyAgZ2ludDggdmFsOworCisgIGdfcmV0dXJu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dpbnQ4ICopIGI7CisgIHJldHVybiByZXQ7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9pMTYgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgZ2ludDE2ICp2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sICpjcDsKKworICBnaW50MzIgcmV0OworICBnaW50MzIgdmFsOworICBnaW50MzIgeGZlcjsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGNwID0gVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKTsKKworICB4ZmVyID0gMDsKKworICBpZiAoKHJldCA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfdmFyaW50MzIgKGNwLCAmdmFsLCBlcnJvcikpIDwgMCkgeworICAgIHJldHVybiAtMTsKKyAgfQorICB4ZmVyICs9IHJldDsKKworICAqdmFsdWUgPSAoZ2ludDE2KSB6aWd6YWdfdG9faTMyICgoZ3VpbnQzMikgdmFsKTsKKworICByZXR1cm4geGZlcjsKK30KKworZ2ludDMyCit0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2kzMiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBnaW50MzIgKnZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKmNwOworCisgIGdpbnQzMiByZXQ7CisgIGdpbnQzMiB2YWw7CisgIGdpbnQzMiB4ZmVyOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2w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vY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZG91YmxlICp2YWx1ZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIGdpbnQzMiByZXQ7CisgIHVuaW9uIHsKKyAgICBndWludDY0IGJpdHM7CisgICAgZ3VpbnQ4IGJbOF07CisgIH0gdTsKKworICBnX2Fzc2VydCAoc2l6ZW9mIChnZG91YmxlKSA9PSBzaXplb2YgKGd1aW50NjQpKTsKKworICBnX3JldHVybl92YWxfaWZfZmFpbCAoVEhSSUZUX0lTX0NPTVBBQ1RfUFJPVE9DT0wgKHByb3RvY29sKSwgLTEpOworCisgIGlmICgocmV0ID0KKyAgICAgICB0aHJpZnRfdHJhbnNwb3J0X3JlYWRfYWxsIChwcm90b2NvbC0+dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuYiwgOCwgZXJyb3IpKSA8IDApIHsKKyAgICByZXR1cm4gLTE7CisgIH0KKyAgdS5iaXRzID0gR1VJTlQ2NF9GUk9NX0xFICh1LmJpdHMpOworICAqdmFsdWUgPSB0aHJpZnRfYml0d2lzZV9jYXN0X2dkb3VibGUgKHUuYml0cyk7CisgIHJldHVybiByZXQ7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9zdHJpbmcgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqKnN0ciwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisKKyAgZ2ludDMyIHJlYWRfbGVuOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3A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nY2hhciwgcmVhZF9sZW4gKyAxKTsKKyAgaWYgKHJlYWRfbGVuID4gMCkgeworICAgIGlmICgocmV0ID0KKyAgICAgICAgIHRocmlmdF90cmFuc3BvcnRfcmVhZF9hbGwgKHByb3RvY29sLT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqc3RyLCByZWFkX2xlbiwgZXJyb3IpKSA8IDApIHsKKyAgICAgIGdfZnJlZSAoKnN0cik7CisgICAgICAqc3RyID0gTlVMTDsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgeGZlciArPSByZXQ7CisgIH0gZWxzZSB7CisgICAgKipzdHIgPSAwOworICB9CisKKyAgcmV0dXJuIHhmZXI7Cit9CisKK2dpbnQzMgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9iaW5hcnkgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncG9pbnRlciAqYnVmLCBndWludDMyICpsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdENvbXBhY3RQcm90b2NvbCAqY3A7CisKKyAgZ2ludDMyIHJldDsKKyAgZ2ludDMyIHhmZXI7CisKKyAgZ2ludDMyIHJlYWRfbGVuOworCisgIGdfcmV0dXJuX3ZhbF9pZl9mYWlsIChUSFJJRlRfSVNfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpLCAtMSk7CisKKyAgY3AgPSBUSFJJRlRfQ09NUEFDVF9QUk9UT0NPTCAocHJvdG9jb2wpOworCisgIHhmZXIgPSAwOworICByZWFkX2xlbiA9IDA7CisKKyAgLyogcmVhZCB0aGUgbGVuZ3RoIGludG8gcmVhZF9sZW4gKi8KKyAgaWYgKChyZXQgPQorICAgICAgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfdmFyaW50MzIgKGNwLCAmcmVhZF9sZW4sIGVycm9yKSkgPCAwKSB7CisgICAgcmV0dXJuIC0xOworICB9CisgIHhmZXIgKz0gcmV0OworCisgIGlmIChjcC0+c3RyaW5nX2xpbWl0ID4gMCAmJiByZWFkX2xlbiA+IGNwLT5zdHJpbmdfbGltaXQpIHsKKyAgICBnX3NldF9lcnJvciAoZXJyb3IsIFRIUklGVF9QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICAgVEhSSUZUX1BST1RPQ09MX0VSUk9SX1NJWkVfTElNSVQsCisgICAgICAgICAgICAgICAgICJnb3Qgc2l6ZSBvdmVyIGxpbWl0ICglZCA+ICVkKSIsIHJlYWRfbGVuLCBjcC0+c3RyaW5nX2xpbWl0KTsKKyAgICAqYnVmID0gTlVMTDsKKyAgICAqbGVuID0gMDsKKyAgICByZXR1cm4gLTE7CisgIH0KKworICBpZiAocmVhZF9sZW4gPiAwKSB7CisgICAgLyogYWxsb2NhdGUgdGhlIG1lbW9yeSBhcyBhbiBhcnJheSBvZiB1bnNpZ25lZCBjaGFyIGZvciBiaW5hcnkgZGF0YSAqLworICAgICpsZW4gPSAoZ3VpbnQzMikgcmVhZF9sZW47CisgICAgKmJ1ZiA9IGdfbmV3IChndWNoYXIsICpsZW4pOworICAgIGlmICgocmV0ID0KKyAgICAgICAgIHRocmlmdF90cmFuc3BvcnRfcmVhZF9hbGwgKHByb3RvY29sLT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqYnVmLCAqbGVuLCBlcnJvcikpIDwgMCkgeworICAgICAgZ19mcmVlICgqYnVmKTsKKyAgICAgICpidWYgPSBOVUxMOworICAgICAgKmxlbiA9IDA7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHhmZXIgKz0gcmV0OworCisgIH0gZWxzZSBpZiAocmVhZF9sZW4gPT0gMCkgeworICAgICpsZW4gPSAoZ3VpbnQzMikgcmVhZF9sZW47CisgICAgKmJ1ZiA9IE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Aoa2xhc3MpOworICBwYXJhbV9zcGVjID0gTlVMTDsKKworICAvKiBzZXR1cCBhY2Nlc3NvcnMgYW5kIG11dGF0b3JzICovCisgIGdvYmplY3RfY2xhc3MtPmdldF9wcm9wZXJ0eSA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX2dldF9wcm9wZXJ0eTsKKyAgZ29iamVjdF9jbGFzcy0+c2V0X3Byb3BlcnR5ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfc2V0X3Byb3BlcnR5OworCisgIHBhcmFtX3NwZWMgPSBnX3BhcmFtX3NwZWNfaW50ICgic3RyaW5nX2xpbWl0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNYXggYWxsb3dlZCBzdHJpbmcgc2l6ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSBtYXggc3RyaW5nIGxpbWl0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIC8qIG1pbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19NQVhJTlQzMiwgLyogbWF4ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAvKiBkZWZhdWx0IHZhbHVlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX0NPTlNUUlVDVF9PTkxZIHwgR19QQVJBTV9SRUFEV1JJVEUpOworICBnX29iamVjdF9jbGFzc19pbnN0YWxsX3Byb3BlcnR5IChnb2JqZWN0X2NsYXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9QX1RIUklGVF9DT01QQUNUX1BST1RPQ09MX1NUUklOR19MSU1JVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fc3BlYyk7CisKKyAgcGFyYW1fc3BlYyA9IGdfcGFyYW1fc3BlY19pbnQgKCJjb250YWluZXJfbGltaXQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1heCBhbGxvd2VkIGNvbnRhaW5lciBzaXplIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTZXQgdGhlIG1heCBjb250YWluZXIgbGltaXQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgLyogbWluICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX01BWElOVDMyLCAvKiBtYXggKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIC8qIGRlZmF1bHQgdmFsdWUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fQ09OU1RSVUNUX09OTFkgfCBHX1BBUkFNX1JFQURXUklURSk7CisgIGdfb2JqZWN0X2NsYXNzX2luc3RhbGxfcHJvcGVydHkgKGdvYmplY3RfY2xhc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1BfVEhSSUZUX0NPTVBBQ1RfUFJPVE9DT0xfQ09OVEFJTkVSX0xJTUlULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9zcGVjKTsKKworICBjbHMtPndyaXRlX21lc3NhZ2VfYmVnaW4gPSB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2JlZ2luOworICBjbHMtPndyaXRlX21lc3NhZ2VfZW5kID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWVzc2FnZV9lbmQ7CisgIGNscy0+d3JpdGVfc3RydWN0X2JlZ2luID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc3RydWN0X2JlZ2luOworICBjbHMtPndyaXRlX3N0cnVjdF9lbmQgPSB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9zdHJ1Y3RfZW5kOworICBjbHMtPndyaXRlX2ZpZWxkX2JlZ2luID0gdGhyaWZ0X2NvbXBhY3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gUFJPUF9USFJJRlRfQ09NUEFDVF9QUk9UT0NPTF9GQUNUT1JZX1NUUklOR19MSU1JVCwKKyAgICBQUk9QX1RIUklGVF9DT01QQUNUX1BST1RPQ09MX0ZBQ1RPUllfQ09OVEFJTkVSX0xJTUlUCit9OworCitHX0RFRklORV9UWVBFIChUaHJpZnRDb21wYWN0UHJvdG9jb2xGYWN0b3J5LCB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9mYWN0b3J5LAorICAgICAgICAgICAgICAgVEhSSUZUX1RZUEVfUFJPVE9DT0xfRkFDVE9SWSkKKworVGhyaWZ0UHJvdG9jb2wgKgordGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfZmFjdG9yeV9nZXRfcHJvdG9jb2wgKFRocmlmdFByb3RvY29sRmFjdG9yeSAqZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRUcmFuc3BvcnQgKnRyYW5zcG9ydCkKK3sKKyAgVGhyaWZ0Q29tcGFjdFByb3RvY29sRmFjdG9yeSAqdGNmOworICBUaHJpZnRDb21wYWN0UHJvdG9jb2wgKnRjOworCisgIHRjZiA9IFRIUklGVF9DT01QQUNUX1BST1RPQ09MX0ZBQ1RPUlkgKGZhY3RvcnkpOworCisgIHRjID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9DT01QQUNUX1BST1RPQ09MLAorICAgICAgICAgICAgICAgICAgICAgInRyYW5zcG9ydCIsIHRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfbGltaXQiLCB0Y2YtPnN0cmluZ19saW1pdCwKKyAgICAgICAgICAgICAgICAgICAgICJjb250YWluZXJfbGltaXQiLCB0Y2YtPmNvbnRhaW5lcl9saW1pdCwKKyAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0wgKHRjKTsKK30KKworLyogcHJvcGVydHkgYWNjZXN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gKi8KKyAgZ29iamVjdF9jbGFzcy0+Z2V0X3Byb3BlcnR5ID0gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfZmFjdG9yeV9nZXRfcHJvcGVydHk7CisgIGdvYmplY3RfY2xhc3MtPnNldF9wcm9wZXJ0eSA9IHRocmlmdF9jb21wYWN0X3Byb3RvY29sX2ZhY3Rvcnlfc2V0X3Byb3BlcnR5OworCisgIHBhcmFtX3NwZWMgPSBnX3BhcmFtX3NwZWNfaW50ICgic3RyaW5nX2xpbWl0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNYXggYWxsb3dlZCBzdHJpbmcgc2l6ZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSBtYXggc3RyaW5nIGxpbWl0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIC8qIG1pbiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19NQVhJTlQzMiwgLyogbWF4ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAvKiBkZWZhdWx0IHZhbHVlICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX0NPTlNUUlVDVF9PTkxZIHwgR19QQVJBTV9SRUFEV1JJVEUpOworICBnX29iamVjdF9jbGFzc19pbnN0YWxsX3Byb3BlcnR5IChnb2JqZWN0X2NsYXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9QX1RIUklGVF9DT01QQUNUX1BST1RPQ09MX0ZBQ1RPUllfU1RSSU5HX0xJTUlULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9zcGVjKTsKKworICBwYXJhbV9zcGVjID0gZ19wYXJhbV9zcGVjX2ludCAoImNvbnRhaW5lcl9saW1pdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWF4IGFsbG93ZWQgY29udGFpbmVyI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YW5zcG9ydCA9IGdfdmFsdWVfZ2V0X29iamVjdCAodmFsdWUpOworICAgICAgcHJvdG9jb2wtPnRyYW5zcG9ydCA9IGdfdmFsdWVfZHVwX29iamVjdCAodmFsdWUpOwogICAgICAgYnJlYWs7CiAgIH0KIH0KIAogCiBnaW50MzIKLXRocmlmdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdjaGFyICpuYW1lLCAKK3RocmlmdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgKm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVGhyaWZ0TWVzc2FnZVR5cGUgbWVzc2FnZV90eXBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiBzZXFpZCwgR0Vycm9yICoqZXJyb3IpCiB7CkBAIC0yNDMsNyArMjQzLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4sIGVycm9yKTsKIH0KIAotZ2ludDMyIAorZ2ludDMyCiB0aHJpZnRfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqKm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRNZXNzYWdlVHlwZSAqbWVzc2FnZV90eXBlLApAQCAtMjU0LDcgKzI1NCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXFpZCwgZXJyb3IpOwogfQogCi1naW50MzIgCitnaW50MzIKIHRocmlmdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCiB7CkBAIC0yNjIsNyArMjYyLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOwogfQogCi1naW50MzIgCitnaW50MzIKIHRocmlmdF9wcm90b2NvbF9yZWFkX3N0cnVjdF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqKm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQpAQCAtMjc5LDcgKzI3OSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOwogfQogCi1naW50MzIgCitnaW50MzIKIHRocmlmdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgKipuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmZpZWxkX3R5cGUsCkBAIC0yOTMsNyArMjkzLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOwogfQogCi1naW50MzIgCitnaW50MzIKIHRocmlmdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKIHsKQEAgLTMwMSw3ICszMDEsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOwogfQogCi1naW50MzIgCitnaW50MzIKIHRocmlmdF9wcm90b2NvbF9yZWFkX21hcF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRUeXBlICprZXlfdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VHlwZSAqdmFsdWVfdHlwZSwgZ3VpbnQzMiAqc2l6ZSwKQEAgLTMxMSwxNyArMzExLDE3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3R5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOyAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKIH0KIAotZ2ludDMyIAorZ2ludDMyCiB0aHJpZnRfcHJvdG9jb2xfcmVhZF9tYXBfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIEdFcnJvciAqKmVycm9yKQogewogICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAocHJvdG9jb2wpLT5yZWFkX21hcF9lbmQgKHByb3RvY29sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKIH0KIAotZ2ludDMyIAorZ2ludDMyCiB0aHJpZnRfcHJvdG9jb2xfcmVhZF9saXN0X2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRUeXBlICplbGVtZW50X3R5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWludDMyICpzaXplLCBHRXJyb3IgKiplcnJvcikKQEAgLTQxMiw3ICs0MTIsNyBAQAogfQogCiBnaW50MzIKLXRocmlmdF9wcm90b2NvbF9yZWFkX2JpbmFyeSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBncG9pbnRlciAqYnVmLCAKK3RocmlmdF9wcm90b2NvbF9yZWFkX2JpbmFyeSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBncG9pbnRlciAqYnVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWludDMyICpsZW4sIEdFcnJvciAqKmVycm9yKQogewogICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAocHJvdG9jb2wpLT5yZWFkX2JpbmFyeSAocHJvdG9jb2wsIGJ1ZiwKQEAgLTQ2NSw3ICs0NjUsNyBAQAogICAgICAgfQogICAgIGNhc2UgVF9TVFJVQ1Q6CiAgICAgICB7Ci0gICAgICAgIGd1aW50MzIgcmVzdWx0ID0gMDsKKyAgICAgICAgZ2ludDMyIHJlc3VsdCA9IDA7CiAgICAgICAgIGdjaGFyICpuYW1lOwogICAgICAgICBnaW50MTYgZmlkOwogICAgICAgICBUaHJpZnRUeXBlIGZ0eXBlOwpAQCAtNDc1LDYgKzQ3NSwxMCBAQAogICAgICAgICB7CiAgICAgICAgICAgcmVzdWx0ICs9IHRocmlmdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJm5hbWUsICZmdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWQsIGVycm9yKTsKKyAgICAgICAgICBpZiAocmVzdWx0IDwgMCkKKyAgICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OyAgCisgICAgICAgICAgfQogICAgICAgICAgIGlmIChmdHlwZSA9PSBUX1NUT1ApCiAgICAgICAgICAgewogICAgICAgICAgICAgYnJlYWs7CkBAIC00ODUsOSArNDg5LDkgQEAKICAgICAgICAgcmVzdWx0ICs9IHRocmlmdF9wcm90b2NvbF9yZWFkX3N0cnVjdF9lbmQgKHByb3RvY29sLCBlcnJvcik7CiAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICB9Ci0gICAgY2FzZSBUX01BUDoKKyAgICBjYXNlIFRfU0VUOgogICAgICAgewotICAgICAgICBndWludDMyIHJlc3VsdCA9IDA7CisgICAgICAgIGdpbnQzMiByZXN1bHQgPSAwOwogICAgICAgICBUaHJpZnRUeXBlIGVsZW1fdHlwZTsKICAgICAgICAgZ3VpbnQzMiBpLCBzaXplOwogICAgICAgICByZXN1bHQgKz0gdGhyaWZ0X3Byb3RvY29sX3JlYWRfc2V0X2JlZ2luIChwcm90b2NvbCwgJmVsZW1fdHlwZSwgJnNpemUsCkBAIC00OTksOSArNTAzLDI1IEBACiAgICAgICAgIHJlc3VsdCArPSB0aHJpZnRfcHJvdG9jb2xfcmVhZF9zZXRfZW5kIChwcm90b2NvbCwgZXJyb3IpOwogICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgfQorICAgIGNhc2UgVF9NQVA6CisgICAgICB7CisgICAgICAgIGdpbnQzMiByZXN1bHQgPSAwOworICAgICAgICBUaHJpZnRUeXBlIGVsZW1fdHlwZTsKKyAgICAgICAgVGhyaWZ0VHlwZSBrZXlfdHlwZTsKKyAgICAgICAgZ3VpbnQz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gICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfc3RydWN0X2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGNvbnN0IGdjaGFyICpuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX3N0cnVjdF9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9zdHJ1Y3RfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9zdHJ1Y3RfZW5kIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfZmllbGRfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgKm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUgZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDE2IGZpZWxkX2lkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2ZpZWxkX2JlZ2luIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUsIGZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZF9pZCwgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfZmllbGRfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9maWVsZF9lbmQgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3dyaXRlX2ZpZWxkX3N0b3AgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2ZpZWxkX3N0b3AgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9tYXBfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUga2V5X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUaHJpZnRUeXBlIHZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIHNpemUsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9tYXBfYmVnaW4gKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5X3R5cGUsIHZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9tYXBfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9tYXBfZW5kIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfbGlzdF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRocmlmdFR5cGUgZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGd1aW50MzIgc2l6ZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2xpc3RfYmVnaW4gKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudF90eXBlLCBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfbGlzdF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2xpc3RfZW5kIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3dyaXRlX3NldF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVGhyaWZ0VHlwZSBlbGVtZW50X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBndWludDMyIHNpemUsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9zZXRfYmVnaW4gKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudF90eXBlLCBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfc2V0X2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+d3JpdGVfc2V0X2VuZCAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3dyaXRlX2Jvb2wgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnYm9vbGVhbiB2YWx1ZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2Jvb2wgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfYnl0ZSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBjb25zdCBnaW50OCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+d3JpdGVfYnl0ZSAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9pMTYgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgY29uc3QgZ2ludDE2IHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPndyaXRlX2kxNiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3dyaXRlX2kzMiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBjb25zdCBnaW50MzIgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+d3JpdGVfaTMyIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfaTY0IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGNvbnN0IGdpbnQ2NCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9pNjQgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9kb3VibGUgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdkb3VibGUgdmFsdWUsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9kb3VibGUgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl93cml0ZV9zdHJpbmcgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdjaGFyICpzdHIsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT53cml0ZV9zdHJpbmcgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLCBzdHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3Jfd3JpdGVfYmluYXJ5IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGNvbnN0IGdwb2ludGVyIGJ1ZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGd1aW50MzIgbGVuLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+d3JpdGVfYmluYXJ5IChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwgYnVmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiwgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9tZXNzYWdlX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAqKm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRNZXNzYWdlVHlwZSAqbWVzc2FnZV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDMyICpzZXFpZCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfbWVzc2FnZV9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lLCBtZXNzYWdlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXFpZCwgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9tZXNzYWdlX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX21lc3NhZ2VfZW5kIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9zdHJ1Y3RfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgKipuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+cmVhZF9zdHJ1Y3RfYmVnaW4gKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3JlYWRfc3RydWN0X2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+cmVhZF9zdHJ1Y3RfZW5kIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX2ZpZWxkX2JlZ2luIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgKipuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDE2ICpmaWVsZF9pZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+cmVhZF9maWVsZF9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkX2lkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX2ZpZWxkX2VuZCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGhyaWZ0UHJvdG9jb2xEZWNvcmF0b3IgKnNlbGYgPSBUSFJJRlRfUFJPVE9DT0xfREVDT1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+cmVhZF9maWVsZF9lbmQgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9tYXBfYmVnaW4gKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VHlwZSAqa2V5X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFR5cGUgKnZhbHVlX3R5cGUsIGd1aW50MzIgKnNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX21hcF9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9tYXBfZW5kIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX21hcF9lbmQgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3JlYWRfbGlzdF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VHlwZSAqZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3VpbnQzMiAqc2l6ZSwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfbGlzdF9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUsIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3JlYWRfbGlzdF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfbGlzdF9lbmQgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX3NldF9iZWdpbiAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRUeXBlICplbGVtZW50X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd1aW50MzIgKnNpemUsIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX3NldF9iZWdpbiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplLCBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX3NldF9lbmQgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfc2V0X2VuZCAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9ib29sIChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGdib29sZWFuICp2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX2Jvb2wgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLCB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX2J5dGUgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgZ2ludDggKnZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfYnl0ZSAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKK30KKworZ2ludDMyCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3JlYWRfaTE2IChUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2wsIGdpbnQxNiAqdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX2kxNiAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsIHZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworfQorCitnaW50MzIKK3RocmlmdF9wcm90b2NvbF9kZWNvcmF0b3JfcmVhZF9pMzIgKFRocmlmdFByb3RvY29sICpwcm90b2NvbCwgZ2ludDMyICp2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAocHJvdG9jb2wpOworCisgIHJldHVybiBUSFJJRlRfUFJPVE9DT0xfR0VUX0NMQVNTIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCktPnJlYWRfaTMyIChzZWxmLT5jb25jcmV0ZV9wcm90b2NvbCwgdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX2k2NCAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBnaW50NjQgKnZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgV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T1JBVE9SIChwcm90b2NvbCk7CisKKyAgcmV0dXJuIFRIUklGVF9QUk9UT0NPTF9HRVRfQ0xBU1MgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sKS0+cmVhZF9zdHJpbmcgKHNlbGYtPmNvbmNyZXRlX3Byb3RvY29sLCBzdHIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcik7Cit9CisKK2dpbnQzMgordGhyaWZ0X3Byb3RvY29sX2RlY29yYXRvcl9yZWFkX2JpbmFyeSAoVGhyaWZ0UHJvdG9jb2wgKnByb3RvY29sLCBncG9pbnRlciAqYnVmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWludDMyICpsZW4sIEdFcnJvciAqKmVycm9yKQoreworICBUaHJpZnRQcm90b2NvbERlY29yYXRvciAqc2VsZiA9IFRIUklGVF9QUk9UT0NPTF9ERUNPUkFUT1IgKHByb3RvY29sKTsKKworICByZXR1cm4gVEhSSUZUX1BST1RPQ09MX0dFVF9DTEFTUyAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wpLT5yZWFkX2JpbmFyeSAoc2VsZi0+Y29uY3JldGVfcHJvdG9jb2wsIGJ1ZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiwgZXJyb3IpOworfQorCisKK3N0YXRpYyB2b2lkCit0aHJpZnRfcHJvdG9jb2xfZGVjb3JhdG9yX3NldF9wcm9wZXJ0eSAoR09iamVjdCAgICAgICpvYmplY3QsCisgICAgZ3VpbnQgICAgICAgICBwcm9wZXJ0eV9pZCwKKyAgICBjb25zdCBHVmFsdWUgKnZhbHVlLAorICAgIEdQYXJhbVNwZWMgICAqcHNwZWMpCit7CisgIFRocmlmdFByb3RvY29sRGVjb3JhdG9yICpzZWxmID0gVEhSSUZUX1BST1RPQ09MX0RFQ09SQVRPUiAob2JqZWN0KTsKKworICBz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VUX0NMQVNTIChzZXJ2ZXItPm91dHB1dF9wcm90b2NvbF9mYWN0b3J5KQorICAgICAgICAgIC0+Z2V0X3Byb3RvY29sIChzZXJ2ZXItPm91dHB1dF9wcm90b2NvbF9mYWN0b3J5LCBvdXRwdXRfdHJhbnNwb3J0KTsKKworICAgICAgICB3aGlsZSAoVEhSSUZUX1BST0NFU1NPUl9HRVRfQ0xBU1MgKHNlcnZlci0+cHJvY2Vzc29yKQorICAgICAgICAgICAgICAgLT5wcm9jZXNzIChzZXJ2ZXItPnByb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRfcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dF9wcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgJnByb2Nlc3NfZXJyb3IpICYmCisgICAgICAgICAgICAgICB0aHJpZnRfdHJhbnNwb3J0X3BlZWsgKGlucHV0X3RyYW5zcG9ydCwgJnByb2Nlc3NfZXJyb3IpKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBpZiAocHJvY2Vzc19lcnJvciAhPSBOVUxMKQorICAgICAgICB7CisgICAgICAgICAgZ19tZXNzYWdlICgidGhyaWZ0X3NpbXBsZV9zZXJ2ZXJfc2VydmU6ICVzIiwgcHJvY2Vzc19lcnJvci0+bWVzc2FnZSk7CisgICAgICAgICAgZ19jbGVhcl9lcnJvciAoJnByb2Nlc3NfZXJyb3IpOworCisgICAgICAgICAgLyogTm90ZSB3ZSBkbyBub3QgcHJvcGFnYXRlIHByb2Nlc3NpbmcgZXJyb3JzIHRvIHRoZSBjYWxsZXIgYXMgdGhleQorICAgICAgICAgICAqIG5vcm1hbGx5IGFyZSB0cmFuc2llbnQgYW5kIG5vdCBmYXRhbCB0byB0aGUgc2VydmVyICovCisgICAgICAgIH0KKworICAgICAgICAvKiBUT0RPOiBoYW5kbGUgZXhjZXB0aW9ucyAqLworICAgICAgICBUSFJJRlRfVFJBT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gICBjYXNlIFBST1BfVEhSSUZUX0FQUExJQ0FUSU9OX0VYQ0VQVElPTl9UWVBFOgorICAgICAgZ192YWx1ZV9zZXRfaW50ICh2YWx1ZSwgdGFlLT50eXBlKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgUFJPUF9USFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX01FU1NBR0U6CisgICAgICBnX3ZhbHVlX3NldF9zdHJpbmcgKHZhbHVlLCB0YWUtPm1lc3NhZ2UpOworICAgICAgYnJlYWs7CisgICAgZGVmYXVsdDoKKyAgICAgIEdfT0JKRUNUX1dBUk5fSU5WQUxJRF9QUk9QRVJUWV9JRCAob2JqZWN0LCBwcm9wZXJ0eV9pZCwgcHNwZWMpOworICAgICAgYnJlYWs7CisgIH0KK30KKworc3RhdGljIHZvaWQKK3RocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb25fc2V0X3Byb3BlcnR5IChHT2JqZWN0ICpvYmplY3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3VpbnQgcHJvcGVydHlfaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR1ZhbHVlICp2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHUGFyYW1TcGVjICpwc3BlYykKK3sKKyAgVGhyaWZ0QXBwbGljYXRpb25FeGNlcHRpb24gKnRhZSA9IFRIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT04gKG9iamVjdCk7CisKKyAgc3dpdGNoIChwcm9wZXJ0eV9pZCkKKyAgeworICAgIGNhc2UgUFJPUF9USFJJRlRfQVBQTElDQVRJT05fRVhDRVBUSU9OX1RZUEU6CisgICAgICB0YWUtPnR5cGUgPSBnX3ZhbHVlX2dldF9pbnQgKHZhbHVlKTsKKyAgICAgIHRhZS0+X19pc3NldF90eXBlID0gVFJVRTsKKyAgICAgIGJyZWFrOworICAg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1RfQ0xBU1MoY2xhc3MpOworICBHUGFyYW1TcGVjICpwYXJhbV9zcGVjOworCiAgIGNscy0+cmVhZCA9IHRocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb25fcmVhZDsKICAgY2xzLT53cml0ZSA9IHRocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb25fd3JpdGU7CisKKyAgZ29iamVjdF9jbGFzcy0+ZmluYWxpemUgPSB0aHJpZnRfYXBwbGljYXRpb25fZXhjZXB0aW9uX2ZpbmFsaXplOworICBnb2JqZWN0X2NsYXNzLT5nZXRfcHJvcGVydHkgPSB0aHJpZnRfYXBwbGljYXRpb25fZXhjZXB0aW9uX2dldF9wcm9wZXJ0eTsKKyAgZ29iamVjdF9jbGFzcy0+c2V0X3Byb3BlcnR5ID0gdGhyaWZ0X2FwcGxpY2F0aW9uX2V4Y2VwdGlvbl9zZXRfcHJvcGVydHk7CisKKyAgcGFyYW1fc3BlYyA9IGdfcGFyYW1fc3BlY19pbnQgKCJ0eXBlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeGNlcHRpb24gdHlwZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVGhlIHR5cGUgb2YgdGhlIGV4Y2VwdGlvbiwgb25lIG9mIHRoZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmFsdWVzIGRlZmluZWQgYnkgdGhlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJUaHJpZnRBcHBsaWNhdGlvbkV4Y2VwdGlvbkVycm9yICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJlbnVtZXJhdGlvbi4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT05fRVJST1JfTiAtIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19QQVJBTV9SRUFEV1JJVEUpOworICBnX29iamVjdF9jbGFzc19pbnN0YWxsX3Byb3BlcnR5IChnb2JqZWN0X2NsYXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9QX1RIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT05fVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fc3BlYyk7CisKKyAgcGFyYW1fc3BlYyA9IGdfcGFyYW1fc3BlY19zdHJpbmcgKCJtZXNzYWdlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeGNlcHRpb24gbWVzc2FnZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQSBzdHJpbmcgZGVzY3JpYmluZyB0aGUgZXhjZXB0aW9uIHRoYXQgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9jY3VycmVkLiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19QQVJBTV9SRUFEV1JJVEUpOworICBnX29iamVjdF9jbGFzc19pbnN0YWxsX3Byb3BlcnR5IChnb2JqZWN0X2NsYXNzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9QX1RIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT05fTUVTU0FHRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fc3BlYyk7CiB9CmRpZmYgLS1naXQgYS9saWIvY19nbGliL3NyYy90aHJpZnQvY19nbGliL3RocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb24uaCBiL2xpYi9jX2dsaWIvc3JjL3RocmlmdC9jX2dsaWIvdGhyaWZ0X2FwcGxpY2F0aW9uX2V4Y2VwdGlvbi5oC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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bXBkYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSA8IDApIHsKKyAgICAgIHJldHVybiByZXQ7CisgICAgfQorICAgIGdvdCArPSByZXQ7CiAKLSAgICAvLyBjb3B5IHRoZSBkYXRhIHN0YXJ0aW5nIGZyb20gd2hlcmUgd2UgbGVmdCBvZmYKLSAgICBtZW1jcHkgKGJ1ZiArIGhhdmUsIHRtcGRhdGEsIGdvdCk7CisgICAgLyogY29weSB0aGUgZGF0YSBzdGFydGluZyBmcm9tIHdoZXJlIHdlIGxlZnQgb2ZmICovCisgICAgbWVtY3B5ICgoZ3VpbnQ4ICopYnVmICsgaGF2ZSwgdG1wZGF0YSwgZ290KTsKICAgICByZXR1cm4gZ290ICsgaGF2ZTsgCiAgIH0gZWxzZSB7Ci0gICAgZ290ICs9IFRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT5yZWFkICh0LT50cmFuc3BvcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bXBkYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKKyAgICBndWludDMyIGdpdmU7CisKKyAgICBpZiAoKHJldCA9IFRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT5yZWFkICh0LT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG1wZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgPCAwKSB7CisgICAgICByZXR1cm4gcmV0OworICAgIH0KKyAgICBnb3QgKz0gcmV0OwogICAgIHQtPnJfYnVmID0gZ19ieXRlX2FycmF5X2FwcGVuZCAodC0+cl9idWYsIHRtcGRhdGEsIGdvdCk7CiAgICAgCi0gICAgLy8gaGFuZCBvdmVyIHdoYXQgd2UgaGF2ZSB1cCB0byB3aGF0IHRoZSBjYWxsZXIgd2FudHMKLSAgICBndWludDMyIGdpdmUgPSB3YW50IDwgdC0+cl9idWYtPmxlbiA/IHdhbnQgOiB0LT5yX2J1Zi0+bGVuOworICAgIC8qIGhhbmQgb3ZlciB3aGF0IHdlIGhhdmUgdXAgdG8gd2hhdCB0aGUgY2FsbGVyIHdhbnRzICovCisgICAgZ2l2ZSA9IHdhbnQgPCB0LT5yX2J1Zi0+bGVuID8gd2FudCA6IHQtPnJfYnVmLT5sZW47CiAKIAotICAgIG1lbWNweSAoYnVmICsgbGVuIC0gd2FudCwgdC0+cl9idWYtPmRhdGEsIGdpdmUpOworICAgIG1lbWNweSAoKGd1aW50OCAqKWJ1ZiArIGxlbiAtIHdhbnQsIHQtPnJfYnVmLT5kYXRhLCBnaXZlKTsKICAgICB0LT5yX2J1ZiA9IGdfYnl0ZV9hcnJheV9yZW1vdmVfcmFuZ2UgKHQtPnJfYnVmLCAwLCBnaXZlKTsKICAgICB3YW50IC09IGdpdmU7CiAKQEAgLTE1NSwzNSArMTcxLDM3IEBACiAgIGd1aW50MzIgaGF2ZV9ieXRlcyA9IHQtPndfYnVmLT5sZW47CiAgIGd1aW50MzIgc3BhY2UgPSB0LT53X2J1Zl9zaXplIC0gdC0+d19idWYtPmxlbjsKIAotICAvLyB3ZSBuZWVkIHR3byBzeXNjYWxscyBiZWNhdXNlIHRoZSBidWZmZXJlZCBkYXRhIHBsdXMgdGhlIGJ1ZmZlciBpdHNlbGYKLSAgLy8gaXMgdG9vIGJpZy4KLSAgaWYgKChoYXZlX2J5dGVzICsgbGVuID49IDIqdC0+d19idWYtPmxlbikgfHwgKGhhdmVfYnl0ZXMgPT0gMCkpCisgIC8qIHdlIG5lZWQgdHdvIHN5c2NhbGxzIGJlY2F1c2UgdGhlIGJ1ZmZlcmVkIGRhdGEgcGx1cyB0aGUgYnVmZmVyIGl0c2VsZgorICAgKiBpcyB0b28gYmlnLiAqLworICBpZiAoKGhhdmVfYnl0ZXMgKyBsZW4gPj0gMip0LT53X2J1Zl9zaXplKSB8fCAoaGF2ZV9ieXRlcyA9PSAwKSkKICAgewogICAgIGlmIChoYXZlX2J5dGVzID4gMCkKICAgICB7Ci0gICAgICBUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+d3JpdGUgKHQtPnRyYW5zcG9ydCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+d19idWYtPmRhdGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhdmVfYnl0ZXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKKyAgICAgIGlmICghVEhSSUZUX1RSQU5TUE9SVF9HRVRfQ0xBU1MgKHQtPnRyYW5zcG9ydCktPndyaXRlICh0LT50cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+d19idWYtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZV9ieXRlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikpIHsKKyAgICAgICAgcmV0dXJuIEZBTFNFOworICAgICAgfQorICAgICAgdC0+d19idWYgPSBnX2J5dGVfYXJyYXlfcmVtb3ZlX3JhbmdlICh0LT53X2J1ZiwgMCwgaGF2ZV9ieXRlcyk7CiAgICAgfQotICAgIFRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT53cml0ZSAodC0+dHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmLCBsZW4sIGVycm9yKTsKLSAgICBpZiAodC0+d19idWYtPmxlbiA+IDApCi0gICAgewotICAgICAgdC0+d19idWYgPSBnX2J5dGVfYXJyYXlfcmVtb3ZlX3JhbmdlICh0LT53X2J1ZiwgMCwgdC0+d19idWYtPmxlbik7CisgICAgaWYgKCFUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+d3JpdGUgKHQtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmLCBsZW4sIGVycm9yKSkgeworICAgICAgcmV0dXJuIEZBTFNFOwogICAgIH0KLQogICAgIHJldHVybiBUUlVFOwogICB9CiAKICAgdC0+d19idWYgPSBnX2J5dGVfYXJyYXlfYXBwZW5kICh0LT53X2J1ZiwgYnVmLCBzcGFjZSk7Ci0gIFRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT53cml0ZSAodC0+dHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQtPndfYnVmLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQtPndfYnVmLT5sZW4sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworICBpZiAoIVRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT53cml0ZSAodC0+dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+d19idWYtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LT53X2J1Zi0+bGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpKSB7CisgICAgcmV0dXJuIEZBTFNFOworICB9CiAKICAgdC0+d19idWYgPSBnX2J5dGVfYXJyYXlfcmVtb3ZlX3JhbmdlICh0LT53X2J1ZiwgMCwgdC0+d19idWYtPmxlbik7Ci0gIHQtPndfYnVmID0gZ19ieXRlX2FycmF5X2FwcGVuZCAodC0+d19idWYsIGJ1ZitzcGFjZSwgbGVuLXNwYWNlKTsKKyAgdC0+d19idWYgPSBnX2J5dGVfYXJyYXlfYXBwZW5kICh0LT53X2J1ZiwgKGd1aW50OCAqKWJ1ZiArIHNwYWNlLCBsZW4tc3BhY2UpOwogCiAgIHJldHVybiBUUlVFOwogfQpAQCAtMjI1LDExICsyNDMsMTMgQEAKIAogICBpZiAodC0+d19idWYgIT0gTlVMTCAmJiB0LT53X2J1Zi0+bGVuID4gMCkKICAgewotICAgIC8vIHdyaXRlIHRoZSBidWZmZXIgYW5kIHRoZW4gZW1wdHkgaXQKLSAgICBUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+d3JpdGUgKHQtPnRyYW5zcG9ydCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQtPndfYnVmLT5kYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+d19idWYtPmxlbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKTsKKyAgICAvKiB3cml0ZSB0aGUgYnVmZmVyIGFuZCB0aGVuIGVtcHR5IGl0ICovCisgICAgaWYgKCFUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+d3JpdGUgKHQtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0+d19idWYtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQtPndfYnVmLT5sZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSkgeworICAgICAgcmV0dXJuIEZBTFNFOworICAgIH0KICAgICB0LT53X2J1ZiA9IGdfYnl0ZV9hcnJheV9yZW1vdmVfcmFuZ2UgKHQtPndfYnVmLCAwLCB0LT53X2J1Zi0+bGVuKTsKICAgfQogICBUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+Zmx1c2ggKHQtPnRyYW5zcG9ydCwKQEAgLTI3MSw5ICsyOTEsMTAgQEAKIHRocmlmdF9idWZmZXJlZF90cmFuc3BvcnRfZ2V0X3Byb3BlcnR5IChHT2JqZWN0ICpvYmplY3QsIGd1aW50IHByb3BlcnR5X2lkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdWYWx1ZSAqdmFsdWUsIEdQYXJhbVNwZWMgKnBzcGVjKQogewotICBUSFJJRlRf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ob2JqKSAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0lOU1RBTkNFX1RZUEUgKChvYmopLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRIUklGVF9UWVBFX0JVRkZFUkVEX1RSQU5TUE9SVF9GQUNUT1JZKSkKKyNkZWZpbmUgVEhSSUZUX0JVRkZFUkVEX1RSQU5TUE9SVF9GQUNUT1JZX0NMQVNTKGMpICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19DTEFTU19DQVNUICgoYyksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUSFJJRlRfVFlQRV9CVUZGRVJFRF9UUkFOU1BPUlRfRkFDVE9SWSwgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRCdWZmZXJlZFRyYW5zcG9ydEZhY3RvcnlDbGFzcykpCisjZGVmaW5lIFRIUklGVF9JU19CVUZGRVJFRF9UUkFOU1BPUlRfRkFDVE9SWV9DTEFTUyhjKSAgICAgICAgICAgICAgICAgICBcCisgIChHX1RZUEVfQ0hFQ0tfQ0xBU1NfVFlQRSAoKGMpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZUX1RZUEVfQlVGRkVSRURfVFJBTlNQT1JUX0ZBQ1RPUlkpKQorI2RlZmluZSBUSFJJRlRfQlVGRkVSRURfVFJBTlNQT1JUX0ZBQ1RPUllfR0VUX0NMQVNTKG9iaikgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0lOU1RBTkNFX0dFVF9DTEFTUyAoKG9iaiksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZU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RFRyYW5zcG9ydENsYXNzICpjbHMpCit7CisgIFRocmlmdFRyYW5zcG9ydENsYXNzICp0dGM7CisgIEdPYmplY3RDbGFzcyAqZ29iamVjdF9jbGFzczsKKyAgR1BhcmFtU3BlYyAqcGFyYW1fc3BlYzsKKworICB0dGMgPSBUSFJJRlRfVFJBTlNQT1JUX0NMQVNTIChjbHMpOworICBnb2JqZWN0X2NsYXNzID0gR19PQkpFQ1RfQ0xBU1MgKGNscyk7CisgIHBhcmFtX3NwZWMgPSBOVUxMOworCisgIC8qIHNldHVwIGFjY2Vzc29ycyBhbmQgbXV0YXRvcnMgKi8KKyAgZ29iamVjdF9jbGFzcy0+Z2V0X3Byb3BlcnR5ID0gdGhyaWZ0X2ZkX3RyYW5zcG9ydF9nZXRfcHJvcGVydHk7CisgIGdvYmplY3RfY2xhc3MtPnNldF9wcm9wZXJ0eSA9IHRocmlmdF9mZF90cmFuc3BvcnRfc2V0X3Byb3BlcnR5OworCisgIHBhcmFtX3NwZWMgPSBnX3BhcmFtX3NwZWNfaW50ICgiZmQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZpbGUgZGVzY3JpcHRvciAoY29uc3RydWN0KSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSBmaWxlIGRlc2NyaXB0b3IiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5UX01JTiwgLyogbWluICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRfTUFYLCAvKiBtYXgsIDEwMjQqMTAyNCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEsIC8qIGRlZmF1bHQgdmFsdWUgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fQ09OU1RSVUNUX09OTFkgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR19QQVJBTV9SRUFEV1JJVEUpOworICBnX29iamVjdF9jbGFzc19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HJpZnRfZnJhbWVkX3RyYW5zcG9ydF9vcGVuIChUaHJpZnRUcmFuc3BvcnQgKnRyYW5zcG9ydCwgR0Vycm9yICoqZXJyb3IpCkBAIC03MSwyNSArNzgsMzQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQogewogICBUaHJpZnRGcmFtZWRUcmFuc3BvcnQgKnQgPSBUSFJJRlRfRlJBTUVEX1RSQU5TUE9SVCAodHJhbnNwb3J0KTsKLSAgZ2ludDMyIHN6LCBieXRlczsKKyAgZ3VpbnQzMiBzejsKKyAgZ2ludDMyIGJ5dGVzOworICBnYm9vbGVhbiByZXN1bHQgPSBGQUxTRTsKIAogICAvKiByZWFkIHRoZSBzaXplICovCi0gIFRIUklGVF9UUkFOU1BPUlRfR0VUX0NMQVNTICh0LT50cmFuc3BvcnQpLT5yZWFkICh0LT50cmFuc3BvcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ3VpbnQzMiAqKSAmc3osCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YgKHN6KSwgZXJyb3IpOwotICBzeiA9IG50b2hsIChzeik7CisgIGlmICh0aHJpZnRfdHJhbnNwb3J0X3JlYWQgKHQtPnRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN6LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YgKHN6KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpID09IHNpemVvZiAoc3opKQorICB7CisgICAgZ3VjaGFyICp0bXBkYXRhOwogCi0gIC8qIGNyZWF0ZSBhIGJ1ZmZlciB0byBob2xkIHRoZSBkYXRhIGFuZCByZWFkIHRoYXQgbXVjaCBkYXRhICovCi0gIGd1Y2hhciB0bXBkYXRhW3N6XTsKLSAgYnl0ZXMgPSBUSFJJRlRfVFJBTlNQT1JUX0dFVF9DTEFTUyAodC0+dHJhbnNwb3J0KS0+cmVhZCAodC0+dHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bXBkYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpOworICAgIHN6ID0gbnRvaGwgKHN6KTsKIAotICAvKiBhZGQgdGhlIGRhdGEgdG8gdGhlIGJ1ZmZlciAqLwotICBnX2J5dGVfYXJyYXlfYXBwZW5kICh0LT5yX2J1ZiwgdG1wZGF0YSwgYnl0ZXMpOworICAgIC8qIGNyZWF0ZSBhIGJ1ZmZlciB0byBob2xkIHRoZSBkYXRhIGFuZCByZWFkIHRoYXQgbXVjaCBkYXRhICovCisgICAgdG1wZGF0YSA9IGdfYWxsb2NhIChzeik7CisgICAgYnl0ZXMgPSB0aHJpZnRfdHJhbnNwb3J0X3JlYWQgKHQtPnRyYW5zcG9ydCwgdG1wZGF0YSwgc3osIGVycm9yKTsKIAotICByZXR1cm4gVFJVRTsKKyAgICBpZiAoYnl0ZXMgPiAwICYmIChlcnJvciA9PSBOVUxMIHx8ICplcnJvciA9PSBOVUxMKSkKKyAgICB7CisgICAgICAvKiBhZGQgdGhlIGRhdGEgdG8gdGhlIGJ1ZmZlciAqLworICAgICAgZ19ieXRlX2FycmF5X2FwcGVuZCAodC0+cl9idWYsIHRtcGRhdGEsIGJ5dGVzKTsKKworICAgICAgcmVzdWx0ID0gVFJVRTsKKyAgICB9CisgIH0KKworICByZXR1cm4gcmVzdWx0OwogfQogCiAvKiB0aGUgYWN0dWFsIHJlYWQgaXMgInNsb3ciIGJlY2F1c2UgaXQgY2FsbHMgdGhlIHVuZGVybHlpbmcgdHJhbnNwb3J0ICovCkBA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uc3BvcnRGYWN0b3J5KSkKKyNkZWZpbmUgVEhSSUZUX0lTX0ZSQU1FRF9UUkFOU1BPUlRfRkFDVE9SWShvYmopICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19JTlNUQU5DRV9UWVBFICgob2JqKSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUSFJJRlRfVFlQRV9GUkFNRURfVFJBTlNQT1JUX0ZBQ1RPUlkpKQorI2RlZmluZSBUSFJJRlRfRlJBTUVEX1RSQU5TUE9SVF9GQUNUT1JZX0NMQVNTKGMpICAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0NMQVNTX0NBU1QgKChjKSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRIUklGVF9UWVBFX0ZSQU1FRF9UUkFOU1BPUlRfRkFDVE9SWSwgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdEZyYW1lZFRyYW5zcG9ydEZhY3RvcnlDbGFzcykpCisjZGVmaW5lIFRIUklGVF9JU19GUkFNRURfVFJBTlNQT1JUX0ZBQ1RPUllfQ0xBU1MoYykgICAgICAgICAgICAgICAgICAgICBcCisgIChHX1RZUEVfQ0hFQ0tfQ0xBU1NfVFlQRSAoKGMpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZUX1RZUEVfRlJBTUVEX1RSQU5TUE9SVF9GQUNUT1JZKSkKKyNkZWZpbmUgVEhSSUZUX0ZSQU1FRF9UUkFOU1BPUlRfRkFDVE9SWV9HRVRfQ0xBU1Mob2JqKSAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9JTlNUQU5DRV9HRVRfQ0xBU1MgKChvYmopLC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TlVMTDsKIApAQCAtMjA1LDE4ICsyNDEsMzggQEAKIAogICBwYXJhbV9zcGVjID0gZ19wYXJhbV9zcGVjX3VpbnQgKCJidWZfc2l6ZSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJ1ZmZlciBzaXplIChjb25zdHJ1Y3QpIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSByZWFkIGJ1ZmZlciBzaXplIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSByZWFkL3dyaXRlIGJ1ZmZlciBzaXplIGxpbWl0IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAvKiBtaW4gKi8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDQ4NTc2LCAvKiBtYXgsIDEwMjQqMTAyNCAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxMiwgLyogZGVmYXVsdCB2YWx1ZSAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfTUFYVUlOVDMyLCAvKiBtYXggKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX01BWFVJTlQzMiwgLyogZGVmYXVsdCAqLwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fQ09OU1RSVUNUX09OTFkgfAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fUkVBRFdSSVRFKTsKICAgZ19vYmplY3RfY2xhc3NfaW5zdGFsbF9wcm9wZXJ0eSAoZ29iamVjdF9jbGFzcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPUF9USFJJRlRfTUVNT1JZX0JVRkZFUl9CVUZGRVJfU0laRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fc3BlYyk7CiAKLSAgVGhyaWZ0VHJhbnNwb3J0Q2xhc3MgKnR0YyA9IFRIUklGVF9UUkFOU1BPUlRfQ0xBU1MgKGNscyk7CisgIHBhcmFtX3NwZWMgPSBnX3BhcmFtX3NwZWNfcG9pbnRlciAoImJ1ZiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImludGVybmFsIGJ1ZmZlciAoR0J5dGVBcnJheSkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTZXQgdGhlIGludGVybmFsIGJ1ZmZlciAoR0J5dGVBcnJheSkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fQ09OU1RSVUNUX09OTFkgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdfUEFSQU1fUkVBRFdSSVRFKTsKKyAgZ19vYmplY3RfY2xhc3NfaW5zdGFsbF9wcm9wZXJ0eSAoZ29iamVjdF9jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPUF9USFJJRlRfTUVNT1JZX0JVRkZFUl9CVUZGRVIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtX3NwZWMpOwogCisgIHBhcmFtX3NwZWMgPSBnX3BhcmFtX3NwZWNfYm9vbGVhbiAoIm93bmVyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW50ZXJuYWwgYnVmZmVyIG1lbW9yeSBtYW5hZ2VtZW50IHBvbGljeSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlNldCB3aGV0aGVyIGludGVybmFsIGJ1ZmZlciBzaG91bGQgYmUiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIHVucmVmZXJlbmNlZCB3aGVuIHRocmlmdF9tZW1vcnlfYnVmZmVyIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBpcyBmaW5hbGl6ZWQiLAorICAgICAgICAgIC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3MgKnRzdGMgPSBUSFJJRlRfU0VSVkVSX1RSQU5TUE9SVF9DTEFTUyAoY2xzKTsKICAgR09iamVjdENsYXNzICpnb2JqZWN0X2NsYXNzID0gR19PQkpFQ1RfQ0xBU1MgKGNscyk7CiAgIEdQYXJhbVNwZWMgKnBhcmFtX3NwZWMgPSBOVUxMOwogCkBAIC0yMjYsMTIgKzIyNCwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJwb3J0IChjb25zdHJ1Y3QpIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2V0IHRoZSBwb3J0IHRvIGxpc3RlbiB0byIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgLyogbWluICovCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjU1MzQsIC8qIG1heCAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY1NTM1LCAvKiBtYXggKi8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5MDkwLCAvKiBkZWZhdWx0IGJ5IGNvbnZlbnRpb24gKi8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX0NPTlNUUlVDVF9PTkxZIHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX1JFQURXUklURSk7CiAgIGdfb2JqZWN0X2NsYXNzX2luc3RhbGxfcHJvcGVydHkgKGdvYmplY3RfY2xhc3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1BfVEhSSUZUX1NFUlZFUl9TT0NLRVRfUE9SVCwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST1BfVEhSSUZUX1NFUlZFUl9TT0NLRVRfUE9SVCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fc3BlYyk7CiAKICAgcGFyYW1fc3BlYyA9IGdfcGFyYW1fc3BlY191a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iBGQUxTRTsKKyAgICByID0gcmVjdiAoc29ja2V0LT5zZCwgJmJ1ZiwgMSwgTVNHX1BFRUspOworICAgIGlmIChyID09IC0xKQorICAgIHsKKyAgICAgIGVycm5vX2NvcHkgPSBlcnJubzsKKworICAgICAgI2lmIGRlZmluZWQgX19GcmVlQlNEX18gfHwgZGVmaW5lZCBfX01BQ0hfXworICAgICAgLyogRnJlZUJTRCByZXR1cm5zIC0xIGFuZCBFQ09OTlJFU0VUIGlmIHRoZSBzb2NrZXQgd2FzIGNsb3NlZCBieSB0aGUgb3RoZXIKKyAgICAgICAgIHNpZGUgKi8KKyAgICAgIGlmIChlcnJub19jb3B5ID09IEVDT05OUkVTRVQpCisgICAgICB7CisgICAgICAgIHRocmlmdF9zb2NrZXRfY2xvc2UgKHRyYW5zcG9ydCwgZXJyb3IpOworICAgICAgfQorICAgICAgZWxzZQorICAgICAgeworICAgICAgI2VuZGlmCisKKyAgICAgIGdfc2V0X2Vycm9yIChlcnJvciwKKyAgICAgICAgICAgICAgICAgICBUSFJJRlRfVFJBTlNQT1JUX0VSUk9SLAorICAgICAgICAgICAgICAgICAgIFRIUklGVF9UUkFOU1BPUlRfRVJST1JfU09DS0VULAorICAgICAgICAgICAgICAgICAgICJmYWlsZWQgdG8gcGVlayBhdCBzb2NrZXQgLSAlcyIsCisgICAgICAgICAgICAgICAgICAgc3RyZXJyb3IgKGVycm5vX2NvcHkpKTsKKworICAgICAgI2lmIGRlZmluZWQgX19GcmVlQlNEX18gfHwgZGVmaW5lZCBfX01BQ0hfXworICAgICAgfQorICAgICAgI2VuZGlmCisgICAgfQorICAgIGVsc2UgaWYgKHIgPiAwKQorICAgIHsKKyAgICAgIHJlc3VsdCA9IFRSVUU7CisgICAgfQogICB9CiAKLSAgLyogY3JlYXRlIGEgc29ja2V0IHN0cnVjdHVyZSAqLwotICBtZW1zZXQgKCZwaW4sIDAsIHNpemVvZihwaW4pKTsKLSAgcGluLnNpbl9mYW1pbHkgPSBBRl9JTkVU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ydCAoY29uc3RydWN0KSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlNldCB0aGUgcG9ydCBvZiB0aGUgcmVtb3RlIGhvc3QiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIC8qIG1pbiAqLwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY1NTM0LCAvKiBtYXggKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwdSwgLyogbWluICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjU1MzV1LCAvKiBtYXggKi8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5MDkwLCAvKiBkZWZhdWx0IGJ5IGNvbnZlbnRpb24gKi8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX0NPTlNUUlVDVF9PTkxZIHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHX1BBUkFNX1JFQURXUklURSk7CiAgIGdfb2JqZWN0X2NsYXNzX2luc3RhbGxfcHJvcGVydHkgKGdvYmplY3RfY2xhc3MsIFBST1BfVEhSSUZUX1NPQ0tFVF9QT1JULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9zcGVjKTsKIAotICBUaHJpZnRUcmFuc3BvcnRDbGFzcyAqdHRjID0gVEhSSUZUX1RSQU5TUE9SVF9DTEFTUyAoY2xzKTsKLQogICBnb2JqZWN0X2NsYXNzLT5maW5hbGl6ZSA9IHRocmlmdF9zb2NrZXRfZmluYWxpemU7CiAgIHR0Yy0+aXNfb3BlbiA9IHRocmlmdF9zb2NrZXRfaXNfb3BlbjsKKyAgdHRjLT5wZWVrID0gdGhyaWZ0X3NvY2tldF9wZWVrOwogICB0dGMtPm9wZW4gPSB0aHJpZnRfc29ja2V0X29wZW47CiAgIHR0Yy0+Y2xvc2UgPSB0aHJpZnRfc29ja2V0X2Nsb3NlOwogICB0dGMtP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NwcCAkPAogCiBURVNUUyA9IFwKQEAgLTIxNCw3ICszMDgsNyBAQAogCSAgICAkeyQ8X1ZBTEdSSU5EX0xFQUtfT1BUU30gIC4vJDwKIAogY2xlYW4tbG9jYWw6Ci0JJChSTSkgLXIgZ2VuLWNfZ2xpYiBnZW4tY3BwCisJJChSTSkgZ2VuLWNfZ2xpYi8qIGdlbi1jcHAvKgogCiBDTEVBTkZJTEVTID0gICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICouYmIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKQEAgLTIyMywzICszMTcsOCBAQAogICAgICouZ2NubyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAqLmdjZGEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgKi5nY292CisKK0VYVFJBX0RJU1QgPSBcCisgICAgICAgICAgICAgQ01ha2VMaXN0cy50eHQgXAorICAgICAgICAgICAgIENvbnRhaW5lclRlc3QudGhyaWZ0CisKZGlmZiAtLWdpdCBhL2xpYi9jX2dsaWIvdGVzdC90ZXN0YXBwbGljYXRpb25leGNlcHRpb24uYyBiL2xpYi9jX2dsaWIvdGVzdC90ZXN0YXBwbGljYXRpb25leGNlcHRpb24uYwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi44OWUzOWUyCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2NfZ2xpYi90ZXN0L3Rlc3RhcHBsaWNhdGlvbmV4Y2VwdGlvbi5jCkBAIC0wLDAgKzEsMTgwIEBACisvKgorICogTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQorICogb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuIFNlZSB0aGUgTk9USUNFIGZpbGUKKyAqIGRpc3RyaWJ1dGVkIHdpdGggdGhpcyB3b3JrIGZvciBhZGRpdGlvb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nRfYmluYXJ5X3Byb3RvY29sX3dyaXRlX2xpc3RfYmVnaW4gKHByb3RvY29sLCBUX1ZPSUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsIE5VTEwpID09IC0xKTsKICAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3IgPSAwOwogCiAgICAgLyogdGVzdCAybmQgd3JpdGUgZXJyb3Igb24gYSBsaXN0ICovCiAgICAgdHJhbnNwb3J0X3dyaXRlX2NvdW50ID0gMDsKICAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3JfYXQgPSAxOwotICAgIGFzc2VydCAodGhyaWZ0X2JpbmFyeV9wcm90b2NvbF93cml0ZV9saXN0X2JlZ2luIChwcm90b2NvbCwgVF9WT0lELAorICAgIGdfYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3dyaXRlX2xpc3RfYmVnaW4gKHByb3RvY29sLCBUX1ZPSUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsIE5VTEwpID09IC0xKTsKICAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3JfYXQgPSAtMTsKIAogICAgIC8qIHRlc3Qgc2V0IG9wZXJhdGlvbiBzKi8KLSAgICBhc3NlcnQgKHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfd3JpdGVfc2V0X2JlZ2luIChwcm90b2NvbCwgVF9WT0lELAorICAgIGdfYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3dyaXRlX3NldF9iZWdpbiAocHJvdG9jb2wsIFRfVk9JRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA+IDApOwotICAgIGFzc2VydCAodGhyaWZ0X2JpbmFyeV9wcm90b2NvbF93cml0ZV9zZXRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisgICAgZ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mVhZF9tYXBfYmVnaW4gKHByb3RvY29sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXlfdHlwZSwgJnZhbHVlX3R5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNpemUsIE5VTEwpID09IC0xKTsKIApAQCAtNTc3LDcgKzY4Myw3IEBACiAKICAgLyogdGVzdCByZWFkIGZhaWx1cmUgKi8KICAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAxOwotICBhc3NlcnQgKHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfcmVhZF9saXN0X2JlZ2luIChwcm90b2NvbCwgJmVsZW1lbnRfdHlwZSwKKyAgZ19hc3NlcnQgKHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfcmVhZF9saXN0X2JlZ2luIChwcm90b2NvbCwgJmVsZW1lbnRfdHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNpemUsIE5VTEwpID09IC0xKTsKICAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAwOwogCkBAIC01OTksMjMgKzcwNSwyMyBAQAogCiAgIC8qIGJyb2tlbiByZWFkICovCiAgIHRyYW5zcG9ydF9yZWFkX2Vycm9yID0gMTsKLSAgYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCisgIGdfYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtZXNzYWdlX3R5cGUsICZzZXFpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPT0gLTEpOwogICB0cmFuc3BvcnRfcmVhZF9lcnJvciA9IDA7CiAKICAgLyogaW52YWxpZCBwcm90b2NvbCB2ZXJzaW9uICovCi0gIGFzc2VydCAodGhyaWZ0X2JpbmFyeV9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAmbWVzc2FnZV9uYW1lLAorICBnX2Fzc2VydCAodGhyaWZ0X2JpbmFyeV9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAmbWVzc2FnZV9uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbWVzc2FnZV90eXBlLCAmc2VxaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IC0xKTsKIAogICAvKiBzeiA+IDAgKi8KLSAgYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCisgIGdfYXNzZXJ0ICh0aHJpZnRfYmluYXJ5X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtZXNzYWdlX3R5cGUsICZzZXFpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPiAwKTsKIAogICAvKiByZWFkIGEgdmFsaWQgbWVzc2FnZSAqLwotICBhc3NlcnQgKHRocmlmdF9iaW5hcnlfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2JlZ2luIChwcm90b2NvbCwgJm1lc3NhZ2VfbmFtZSwKKyAgZ19hc3NlcnQgKHRocmlmdF9iaW5hcnl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ogcGFyZW50IGNvbm5lY3RzLCB3YWl0IGEgYml0IGZvciB0aGUgc29ja2V0IHRvIGJlIGNyZWF0ZWQgKi8KLSAgICBzbGVlcCAoMSk7CisgICAgeworICAgICAgLyogY2hpbGQgbGlzdGVucyAqLworICAgICAgdGhyaWZ0X3NlcnZlciAocG9ydCk7CisgICAgICBleGl0ICgwKTsKKyAgICB9IGVsc2UgeworCS8qIHBhcmVudCBjb25uZWN0cywgd2FpdCBhIGJpdCBmb3IgdGhlIHNvY2tldCB0byBiZSBjcmVhdGVkICovCisJc2xlZXAgKDEpOwogCi0gICAgdHNvY2tldCA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfU09DS0VULCAiaG9zdG5hbWUiLCAibG9jYWxob3N0IiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAicG9ydCIsIHBvcnQsIE5VTEwpOwotICAgIHRyYW5zcG9ydCA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQlVGRkVSRURfVFJBTlNQT1JULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRyYW5zcG9ydCIsIFRIUklGVF9UUkFOU1BPUlQgKHRzb2NrZXQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIndfYnVmX3NpemUiLCA0LCBOVUxMKTsKKwl0c29ja2V0ID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9TT0NLRVQsICJob3N0bmFtZSIsICJsb2NhbGhvc3QiLAorCQkJCSJwb3J0IiwgcG9ydCwgTlVMTCk7CisJdHJhbnNwb3J0ID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9CVUZGRVJFRF9UUkFOU1BPUlQsCisJCQkJICAidHJhbnNwb3J0IiwgVEhSSUZUX1RSQU5TUE9SVCAodHNvY2tldCksCisJCQkJICAid19idWZfc2l6ZSIsIDQsIE5VTEwpOwogCi0gICAgYXNzZXJ0ICh0aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0X29wZW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VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kzMiAocHJvdG9jb2wsIDIsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2k2NCAocHJvdG9jb2wsIDIsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kxNiAocHJvdG9jb2wsIC0yLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9pMzIgKHByb3RvY29sLCAtMiwgTlVMTCkgPiAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfaTY0IChwcm90b2NvbCwgLTIsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2RvdWJsZSAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEVTVF9ET1VCTEUsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cmluZyAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEVTVF9TVFJJTkcsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cmluZyAocHJvdG9jb2wsICIiLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9iaW5hcnkgKHByb3RvY29sLCBiaW5hcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9iaW5hcnkgKHByb3RvY29sLCBOVUxMLCAwLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9iaW5hcnkgKHByb3RvY29sLCBiaW5hcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuLCBOVUxMKSA+IDApOworCisgICAgLyogdGVzdCB3cml0ZSBlcnJvcnMgKi8KKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3IgPSAxOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgVEVTVF9CWVRFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA9PSAtMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kxNiAocHJvdG9jb2wsIFRFU1RfSTE2LCBOVUxMKSA9PSAtMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kzMiAocHJvdG9jb2wsIFRFU1RfSTMyLCBOVUxMKSA9PSAtMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2k2NCAocHJvdG9jb2wsIFRFU1RfSTY0LCBOVUxMKSA9PSAtMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2kxNiAocHJvdG9jb2wsIFRFU1RfTkkxNiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPT0gLTEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9pMzIgKHByb3RvY29sLCBURVNUX05JMzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IC0xKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfaTY0IChwcm90b2NvbCwgVEVTVF9OSTY0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA9PSAtMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2RvdWJsZSAocHJvdG9jb2wsIFRFU1RfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IC0xKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYmluYXJ5IChwcm90b2NvbCwgYmluYXJ5LCBsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPT0gLTEpOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvciA9IDA7CisKKyAgICAvKiB0ZXN0IGJpbmFyeSBwYXJ0aWFsIGZhaWx1cmUgKi8KKyAgICB0cmFuc3BvcnRfd3JpdGVfY291bnQgPSAwOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvcl9hdCA9IDE7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2JpbmFyeSAocHJvdG9jb2wsIGJpbmFyeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4sIE5VTEwpID09IC0xKTsKKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3JfYXQgPSAtMTsKKworICAgIC8qIGNsZWFuIHVwICovC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KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAicG9ydCIsIHBvcnQsIE5VTEwpOworICAgIHRyYW5zcG9ydCA9IFRIUklGVF9UUkFOU1BPUlQgKHRzb2NrZXQpOworICAgIHRocmlmdF90cmFuc3BvcnRfb3BlbiAodHJhbnNwb3J0LCBOVUxMKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X3RyYW5zcG9ydF9pc19vcGVuICh0cmFuc3BvcnQpKTsKKworICAgIC8qIGNyZWF0ZSBhIFRocmlmdENvbXBhY3RUcmFuc3BvcnQgKi8KKyAgICB0YyA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQ09NUEFDVF9QUk9UT0NPTCwgInRyYW5zcG9ydCIsCisgICAgICAgICAgICAgICAgICAgICAgIHRzb2NrZXQsIE5VTEwpOworICAgIHByb3RvY29sID0gVEhSSUZUX1BST1RPQ09MICh0Yyk7CisgICAgZ19hc3NlcnQgKHByb3RvY29sICE9IE5VTEwpOworCisgICAgLyogdGVzdCBzdHJ1Y3R1cmVzICovCisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cnVjdF9iZWdpbiAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwgTlVMTCkgPT0gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cnVjdF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKworICAgIC8qIHRlc3QgZmllbGQgc3RhdGUgdy5yLnQuIGRlbHRhcyAqLworCisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLCAxLCBOVUxMKSA9PSAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTYsIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNywgTlVMTCkgPT0gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LCBOVUxMKSA+IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMCwgTlVMTCkgPT0gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ2LCBOVUxMKSA+IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NywgTlVMTCkgPT0gMSk7CisKKyAgICAvKiB0ZXN0IGZpZWxkcyAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA+IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKworICAgIC8qIHRlc3QgZmllbGQgc3RhdGUgdy5yLnQuIHN0cnVjdHMgKi8KKworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA+IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTYsIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9zdHJ1Y3RfYmVnaW4gKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsIE5VTEwpID09IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNywgTlVMTCkgPiAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc3RydWN0X2JlZ2luIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgsIE5VTEwpID4gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOSwgTlVMTCkgPT0gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9zdHJ1Y3RfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgsIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjUsIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc3RydWN0X2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworCisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE3LCBOVUxMKSA9PSAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgICAvKiB0ZXN0IGZpZWxkIHN0YXRlIHcuci50LiBib29scyAqLworCisgICAgLyogZGVsdGFzICovCisgICAgLyogbm9uLWJvb2wgZmllbGQgLT4gYm9vbCBmaWVsZCAtPiBub24tYm9vbCBmaWVsZCAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOCwgTlVMTCkgPT0gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwgVF9CT09MLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5LCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYm9vbCAocHJvdG9jb2wsIFRFU1RfQk9PTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAsIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICAvKiBib29sIC0+IGJvb2wgZmllbGQgLT4gYm9vbCAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ib29sIChwcm90b2NvbCwgVEVTVF9CT09MLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9iZWdpbiAocHJvdG9jb2wsICJ0ZXN0IiwgVF9CT09MLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYm9vbCAocHJvdG9jb2wsIFRFU1RfQk9PTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IDEpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYm9vbCAocHJvdG9jb2wsIFRFU1RfQk9PTCwgTlVMTCkgPiAwKTsKKworICAgIC8qIG5vIGRlbHRhcyAqLworICAgIC8qIG5vbi1ib29sIGZpZWxkIC0+IGJvb2wgZmllbGQgLT4gbm9uLWJvb2wgZmllbGQgKi8KKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwgTlVMTCkgPiAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLCBUX0JPT0wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYm9vbCAocHJvdG9jb2wsIFRFU1RfQk9PTCwgTlVMTCkgPiAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsIE5VTEwpID4gMSk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworICAgIC8qIGJvb2wgLT4gYm9vbCBmaWVsZCAtPiBib29sICovCisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2Jvb2wgKHByb3RvY29sLCBURVNUX0JPT0wsIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLCBUX0JPT0wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA9PSAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYm9vbCAocHJvdG9jb2wsIFRFU1RfQk9PTCwgTlVMTCkgPiAxKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2Jvb2wgKHByb3RvY29sLCBURVNUX0JPT0wsIE5VTEwpID4gMCk7CisKKyAgICAvKiB0ZXN0IHdyaXRlIGVycm9yICovCisgICAgdHJhbnNwb3J0X3dyaXRlX2Vycm9yID0gMTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwgTlVMTCkgPT0gLTEpOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvciA9IDA7CisKKyAgICAvKiB0ZXN0IDJuZCB3cml0ZSBlcnJvciAqLworICAgIHRyYW5zcG9ydF93cml0ZV9jb3VudCA9IDA7CisgICAgdHJhbnNwb3J0X3dyaXRlX2Vycm9yX2F0ID0gMTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfZmllbGRfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwgTlVMTCkgPT0gLTEpOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvcl9hdCA9IC0xOworCisgICAgLyogdGVzdCAybmQgcmVhZCBmYWlsdXJlIG9uIGEgZmllbGQgKi8KKyAgICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgVF9ET1VCTEUsIE5VTEwpOworCisgICAgLyogdGVzdCB3cml0ZV9maWVsZF9zdG9wICovCisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2ZpZWxkX3N0b3AgKHByb3RvY29sLCBOVUxMKSA+IDApOworCisgICAgLyogd3JpdGUgYSBtYXAgKi8KKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWFwX2JlZ2luIChwcm90b2NvbCwgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQkxFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLCBOVUxMKSA+IDApOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tYXBfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgICAvKiB0ZXN0IDFzdCByZWFkIGZhaWx1cmUgb24gbWFwLS0tbm90aGluZyB0byBkbyBvbiBvdXIgc2lkZSAqLworCisgICAgLyogdGVzdCAybmQgcmVhZCBmYWlsdXJlIG9uIGEgbWFwICovCisgICAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYnl0ZSAocHJvdG9jb2wsIFRfRE9VQkxFLCBOVUxMKTsKKworICAgIC8qIHRlc3QgMXN0IHdyaXRlIGZhaWx1cmUgb24gYSBtYXAgKi8KKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3IgPSAxOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tYXBfYmVnaW4gKHByb3RvY29sLCBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsIE5VTEwpID09IC0xKTsKKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3IgPSAwOworCisgICAgLyogdGVzdCAybmQgd3JpdGUgZmFpbHVyZSBvbiBhIG1hcCAqLworICAgIHRyYW5zcG9ydF93cml0ZV9jb3VudCA9IDA7CisgICAgdHJhbnNwb3J0X3dyaXRlX2Vycm9yX2F0ID0gMTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWFwX2JlZ2luIChwcm90b2NvbCwgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfRE9VQk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aW4gKHByb3RvY29sLCBUX0RPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsIE5VTEwpID09IC0xKTsKKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3JfYXQgPSAtMTsKKworICAgIC8qIHRlc3Qgc2V0IG9wZXJhdGlvbiBzKi8KKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc2V0X2JlZ2luIChwcm90b2NvbCwgVF9ET1VCTEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwgTlVMTCkgPiAwKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc2V0X2VuZCAocHJvdG9jb2wsIE5VTEwpID09IDApOworCisgICAgLyogaW52YWxpZCBwcm90b2NvbCAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgMCwgTlVMTCkgPiAwKTsKKworICAgIC8qIGludmFsaWQgdmVyc2lvbiAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgKGdpbnQ4KSAweDgydSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID4gMCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2J5dGUgKHByb3RvY29sLCAwLCBOVUxMKSA+IDApOworCisgICAgLyogc2VuZCBhIHZhbGlkIG1lc3NhZ2UgKi8KKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYnl0ZSAocHJvdG9jb2wsIChnaW50OCkgMHg4MnUsCisgICAgICA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vbF93cml0ZV9tZXNzYWdlX2JlZ2luIChwcm90b2NvbCwgInRlc3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX0NBTEwsIDEsIE5VTEwpID4gMCk7CisKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfbWVzc2FnZV9lbmQgKHByb3RvY29sLCBOVUxMKSA9PSAwKTsKKworICAgIC8qIHNlbmQgYnJva2VuIHdyaXRlcyAqLworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvciA9IDE7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfQ0FMTCwgMSwgTlVMTCkgPT0gLTEpOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvciA9IDA7CisKKyAgICB0cmFuc3BvcnRfd3JpdGVfY291bnQgPSAwOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvcl9hdCA9IDE7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAidGVzdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRfQ0FMTCwgMSwgTlVMTCkgPT0gLTEpOworICAgIHRyYW5zcG9ydF93cml0ZV9lcnJvcl9hdCA9IC0xOworCisgICAgdHJhbnNwb3J0X3dyaXRlX2NvdW50ID0gMDsKKyAgICB0cmFuc3BvcnRfd3JpdGVfZXJyb3JfYXQgPSAyOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9tZXNzYWdlX2JlZ2luIChwcm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ZnQgIT0gTlVMTCk7CisgICAgdHJhbnNwb3J0ID0gVEhSSUZUX1RSQU5TUE9SVCAoZnQpOworCisgICAgdGhyaWZ0X3RyYW5zcG9ydF9vcGVuICh0cmFuc3BvcnQsIE5VTEwpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfdHJhbnNwb3J0X2lzX29wZW4gKHRyYW5zcG9ydCkpOworCisgICAgLyogY3JlYXRlIGEgY29tcGFjdCBwcm90b2NvbCAqLworICAgIHRjID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9DT01QQUNUX1BST1RPQ09MLCAidHJhbnNwb3J0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LCBOVUxMKTsKKyAgICBwcm90b2NvbCA9IFRIUklGVF9QUk9UT0NPTCAodGMpOworICAgIGdfYXNzZXJ0IChwcm90b2NvbCAhPSBOVUxMKTsKKworICAgIC8qIHdyaXRlIGEgYnVuY2ggb2YgcHJpbWl0aXZlcyAqLworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ib29sIChwcm90b2NvbCwgVEVTVF9CT09MLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPiAwKTsKKyAgICB0aHJpZnRfdHJhbnNwb3J0X2ZsdXNoICh0cmFuc3BvcnQsIE5VTEwpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9ieXRlIChwcm90b2NvbCwgVEVTVF9CWVRFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPiAwKTsKKyAgICB0aHJpZnRfdHJhbnNwb3J0X2ZsdXNoICh0cmFuc3BvcnQsIE5VTEwpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9pMTYgKHByb3RvY29sLCBURVNUX0kxNiw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19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX3N0cmluZyAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEVTVF9TVFJJTkcsIE5VTEwpID4gMCk7CisgICAgdGhyaWZ0X3RyYW5zcG9ydF9mbHVzaCAodHJhbnNwb3J0LCBOVUxMKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfc3RyaW5nIChwcm90b2NvbCwgIiIsIE5VTEwpID4gMCk7CisgICAgdGhyaWZ0X3RyYW5zcG9ydF9mbHVzaCAodHJhbnNwb3J0LCBOVUxMKTsKKyAgICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfd3JpdGVfYmluYXJ5IChwcm90b2NvbCwgYmluYXJ5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiwgTlVMTCkgPiAwKTsKKyAgICB0aHJpZnRfdHJhbnNwb3J0X2ZsdXNoICh0cmFuc3BvcnQsIE5VTEwpOworICAgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF93cml0ZV9iaW5hcnkgKHByb3RvY29sLCBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCBOVUxMKSA+IDApOworICAgIHRocmlmdF90cmFuc3BvcnRfZmx1c2ggKHRyYW5zcG9ydCwgTlVMTCk7CisgICAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3dyaXRlX2JpbmFyeSAocHJvdG9jb2wsIGJpbmFyeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4sIE5VTEwpID4gMCk7CisgICAgdGhyaWZ0X3RyYW5zcG9ydF9mbHVzaCAodHJhbnNwb3J0L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cm90b2NvbCwgJnppZ3phZ19uMTYsIE5VTEwpID4gMCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2J5dGUgKHByb3RvY29sLCAmemlnemFnX24zMiwgTlVMTCkgPiAwKTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZ6aWd6YWdfbjY0LCBOVUxMKSA+IDApOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9kb3VibGUgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZV9kb3VibGUsIE5VTEwpID4gMCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX3N0cmluZyAocHJvdG9jb2wsICZzdHJpbmcsIE5VTEwpID4gMCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX3N0cmluZyAocHJvdG9jb2wsICZlbXB0eV9zdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID4gMCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2JpbmFyeSAocHJvdG9jb2wsICZiaW5hcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmxlbiwgTlVMTCkgPiAwKTsKKworICBnX2Fzc2VydCAodmFsdWVfYm9vbGVhbiA9PSBURVNUX0JPT0wpOworICBnX2Fzc2VydCAodmFsdWVfYnl0ZSA9PSBURVNUX0JZVEUpOworICBnX2Fzc2VydCAodmFsdWVfMTYgPT0gVEVTVF9JMTYpOworICBnX2Fzc2VydCAodmFsdWVfMzIgPT0gVEVTVF9JMzIpOworICBnX2Fzc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nRfcmVhZF9lcnJvcl9hdCA9IDA7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2JpbmFyeSAocHJvdG9jb2wsICZiaW5hcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmxlbiwgTlVMTCkgPT0gLTEpOworICB0cmFuc3BvcnRfcmVhZF9lcnJvcl9hdCA9IC0xOworCisgIHRyYW5zcG9ydF9yZWFkX2NvdW50ID0gMDsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAxOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9iaW5hcnkgKHByb3RvY29sLCAmYmluYXJ5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZsZW4sIE5VTEwpID09IC0xKTsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAtMTsKKworICB0cmFuc3BvcnRfcmVhZF9lcnJvciA9IDE7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2Jvb2wgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWVfYm9vbGVhbiwgTlVMTCkgPT0gLTEpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9ieXRlIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlX2J5dGUsIE5VTEwpID09IC0xKTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfaTE2IChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWVfMTYsIE5VTEwpID09IC0xKTsKKyAgZ19hc3NlcnQgKH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ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX2lkID09IDE2KTsKKyAgZmllbGRfaWQgPSAwOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPT0gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF9pZCA9PSAxNyk7CisgIGZpZWxkX2lkID0gMDsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID4gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF9pZCA9PSAxNSk7CisgIGZpZWxkX2lkID0gMDsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID09IDEpOworICBnX2Fzc2VydCAoZmllbGRfaWQgPT0gMzApOworICBmaWVsZF9pZCA9IDA7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA+IDEpOworICBnX2Fzc2VydCAoZmllbGRfaWQgPT0gNDYpOworICBmaWVsZF9pZCA9IDA7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX2lkID09IDQ3KTsKKyAgZmllbGRfaWQgPSAwOworCisgIC8qIHRlc3QgZmllbGQgb3BlcmF0aW9ucyAqLworCisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKTsKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKTsKKworICAvKiB0ZXN0IGZpZWxkIHN0YXRlIHcuci50LiBzdHJ1Y3RzICovCisKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID4gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF9pZCA9PSAxKTsKKyAgZmllbGRfaWQgPSAwOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPT0gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF9pZCA9PSAxNik7CisgIGZpZWxkX2lkID0gMDsKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKTsKKworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9zdHJ1Y3RfYmVnaW4gKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc3RydWN0X25hbWUsIE5VTEwpID09IDApOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPiAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX2lkID09IDE3KTsKKyAgZmllbGRfaWQgPSAwOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworCisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX3N0cnVjdF9iZWdpbiAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzdHJ1Y3RfbmFtZSwgTlVMTCkgPT0gMCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA+IDEpOworICBnX2Fzc2VydCAoZmllbGRfaWQgPT0gMTgpOworICBmaWVsZF9pZCA9IDA7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX2lkID09IDE5KTsKKyAgZmllbGRfaWQgPSAwOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9zdHJ1Y3RfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID09IDEpOworICBnX2Fzc2VydCAoZmllbGRfaWQgPT0gMTgpOworICBmaWVsZF9pZCA9IDA7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX2lkID09IDI1KTsKKyAgZmllbGRfaWQgPSAwOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9zdHJ1Y3RfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID09IDEpOworICBnX2Fzc2VydCAoZmllbGRfaWQgPT0gMTcpOworICBmaWVsZF9pZCA9IDA7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisKKyAgLyogdGVzdCBmaWVsZCBzdGF0ZSB3LnIudC4gYm9vbHMgKi8KKworICAvKiBkZWx0YXMgKi8KKyAgLyogbm9uLWJvb2wgZmllbGQgLT4gYm9vbCBmaWVsZCAtPiBub24tYm9vbCBmaWVsZCAqLworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPT0gMSk7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAxKTsKKyAgZ19hc3NlcnQgKGZpZWxkX3R5cGUgPT0gVF9CT09MKTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfYm9vbCAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZV9ib29sZWFuLCBOVUxMKSA9PSAwKTsKKyAgZ19hc3NlcnQgKHZhbHVlX2Jvb2xlYW4gPT0gVEVTVF9CT09MKTsKKyAgdmFsdWVfYm9vbGVhbiA9ICEgVEVTVF9CT09MOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPT0gMSk7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIC8qIGJvb2wgLT4gYm9vbCBmaWVsZCAtPiBib29sICovCisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2Jvb2wgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWVfYm9vbGVhbiwgTlVMTCkgPiAwKTsKKyAgZ19hc3NlcnQgKHZhbHVlX2Jvb2xlYW4gPT0gVEVTVF9CT09MKTsKKyAgdmFsdWVfYm9vbGVhbiA9ICEgVEVTVF9CT09MOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsICZmaWVsZF9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZmaWVsZF9pZCwgTlVMTCkgPT0gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF90eXBlID09IFRfQk9PTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2Jvb2wgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWVfYm9vbGVhbiwgTlVMTCkgPT0gMCk7CisgIGdfYXNzZXJ0ICh2YWx1ZV9ib29sZWFuID09IFRFU1RfQk9PTCk7CisgIHZhbHVlX2Jvb2xlYW4gPSAhIFRFU1RfQk9PTDsKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfYm9vbCAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZV9ib29sZWFuLCBOVUxMKSA+IDApOworICBnX2Fzc2VydCAodmFsdWVfYm9vbGVhbiA9PSBURVNUX0JPT0wpOworICB2YWx1ZV9ib29sZWFuID0gISBURVNUX0JPT0w7CisKKyAgLyogbm8gZGVsdGFzICovCisgIC8qIG5vbi1ib29sIGZpZWxkIC0+IGJvb2wgZmllbGQgLT4gbm9uLWJvb2wgZmllbGQgKi8KKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID4gMSk7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA+IDEpOworICBnX2Fzc2VydCAoZmllbGRfdHlwZSA9PSBUX0JPT0wpOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9ib29sIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlX2Jvb2xlYW4sIE5VTEwpID09IDApOworICBnX2Fzc2VydCAodmFsdWVfYm9vbGVhbiA9PSBURVNUX0JPT0wpOworICB2YWx1ZV9ib29sZWFuID0gISBURVNUX0JPT0w7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfZW5kIChwcm90b2NvbCwgTlVMTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2JlZ2luIChwcm90b2NvbCwgJmZpZWxkX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA+IDEpOworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2ZpZWxkX2VuZCAocHJvdG9jb2wsIE5VTEwpOworICAvKiBib29sIC0+IGJvb2wgZmllbGQgLT4gYm9vbCAqLworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9ib29sIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlX2Jvb2xlYW4sIE5VTEwpID4gMCk7CisgIGdfYXNzZXJ0ICh2YWx1ZV9ib29sZWFuID09IFRFU1RfQk9PTCk7CisgIHZhbHVlX2Jvb2xlYW4gPSAhIFRFU1RfQk9PTDsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID4gMSk7CisgIGdfYXNzZXJ0IChmaWVsZF90eXBlID09IFRfQk9PTCk7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2Jvb2wgKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWVfYm9vbGVhbiwgTlVMTCkgPT0gMCk7CisgIGdfYXNzZXJ0ICh2YWx1ZV9ib29sZWFuID09IFRFU1RfQk9PTCk7CisgIHZhbHVlX2Jvb2xlYW4gPSAhIFRFU1RfQk9PTDsKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9lbmQgKHByb3RvY29sLCBOVUxMKTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfYm9vbCAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZV9ib29sZWFuLCBOVUxMKSA+IDApOworICBnX2Fzc2VydCAodmFsdWVfYm9vbGVhbiA9PSBURVNUX0JPT0wpOworICB2YWx1ZV9ib29sZWFuID0gISBURVNUX0JPT0w7CisKKyAgLyogdGVzdCBmaXJzdCByZWFkIGVycm9yIG9uIGEgZmllbGQgKi8KKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAxOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9maWVsZF9iZWdpbiAocHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfbmFtZSwgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZmllbGRfaWQsIE5VTEwpID09IC0xKTsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAwOworCisgIC8qIHRlc3QgMm5kIHdyaXRlIGZhaWx1cmUgKi8KKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9ieXRlIChwcm90b2NvbCwgJnZhbHVlLCBOVUxMKTsKKworICAvKiB0ZXN0IDJuZCByZWFkIGZhaWx1cmUgb24gYSBmaWVsZCAqLworICB0cmFuc3BvcnRfcmVhZF9jb3VudCA9IDA7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gMTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX25hbWUsICZmaWVsZF90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKSA9PSAtMSk7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gLTE7CisKKyAgLyogdGVzdCBmaWVsZCBzdG9wICovCisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfZmllbGRfYmVnaW4gKHByb3RvY29sLCAmZmllbGRfbmFtZSwgJmZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmZpZWxkX2lkLCBOVUxMKTsKKworICAvKiB0ZXN0IG1hcCBvcGVyYXRpb25zICovCisKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tYXBfYmVnaW4gKHByb3RvY29sLCAma2V5X3R5cGUsICZ2YWx1ZV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc2l6ZSwgTlVMTCk7CisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWFwX2VuZCAocHJvdG9jb2wsIE5VTEwpOworCisgIC8qIHRlc3QgMXN0IHJlYWQgZmFpbHVyZSBvbiBhIG1hcCAqLworICB0cmFuc3BvcnRfcmVhZF9jb3VudCA9IDA7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gMDsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWFwX2JlZ2luIChwcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAma2V5X3R5cGUsICZ2YWx1ZV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzaXplLCBOVUxMKSA9PSAtMSk7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gLTE7CisKKyAgLyogdGVzdCAybmQgcmVhZCBmYWlsdXJlIG9uIGEgbWFwICovCisgIHRyYW5zcG9ydF9yZWFkX2NvdW50ID0gMDsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAxOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tYXBfYmVnaW4gKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXlfdHlwZSwgJnZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNpemUsIE5VTEwpID09IC0xKTsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAtMTsKKworICAvKiB0ZXN0IDFzdCB3cml0ZSBmYWlsdXJlIG9uIG1hcC0tLW5vdGhpbmcgdG8gZG8gb24gb3VyIHNpZGUgKi8KKworICAvKiB0ZXN0IDJuZCB3cml0ZSBmYWlsdXJlICovCisgIHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfYnl0ZSAocHJvdG9jb2wsICZ2YWx1ZSwgTlVMTCk7CisKKyAgLyogdGVzdCBuZWdhdGl2ZSBtYXAgc2l6ZSAqLworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tYXBfYmVnaW4gKHByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXlfdHlwZSwgJnZhbHVlX3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNpemUsIE5VTEwpID09IC0xKTsKKworICAvKiB0ZXN0IGxpc3Qgb3BlcmF0aW9ucyAqLworICB0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX2xpc3RfYmVnaW4gKHByb3RvY29sLCAmZWxlbWVudF90eXBlLCAmc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9saXN0X2VuZCAocHJvdG9jb2wsIE5VTEwpOworCisgIC8qIHRlc3Qgc21hbGwgbGlzdCAxc3QgcmVhZCBmYWlsdXJlICovCisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yID0gMTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbGlzdF9iZWdpbiAocHJvdG9jb2wsICZlbGVtZW50X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzaXplLCBOVUxMKSA9PSAtMSk7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yID0gMDsKKworICAvKiB0ZXN0IGJpZyBsaXN0IDFzdCByZWFkIGZhaWx1cmUgKi8KKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAxOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9saXN0X2JlZ2luIChwcm90b2NvbCwgJmVsZW1lbnRfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnNpemUsIE5VTEwpID09IC0xKTsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3IgPSAwOworCisgIC8q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ZCAocHJvdG9jb2wsIE5VTEwpOworCisgIC8qIGJyb2tlbiByZWFkICovCisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yID0gMTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtZXNzYWdlX3R5cGUsICZzZXFpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPT0gLTEpOworICB0cmFuc3BvcnRfcmVhZF9lcnJvciA9IDA7CisKKyAgLyogaW52YWxpZCBwcm90b2NvbCAqLworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2JlZ2luIChwcm90b2NvbCwgJm1lc3NhZ2VfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1lc3NhZ2VfdHlwZSwgJnNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA9PSAtMSk7CisKKyAgLyogaW52YWxpZCB2ZXJzaW9uICovCisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAmbWVzc2FnZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbWVzc2FnZV90eXBlLCAmc2VxaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IC0xKTsKKworICAvKiByZWFkIGEgdmFsaWQgbWVzc2FnZSAqLworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2JlZ2luIChwcm90b2NvbCwgJm1lc3NhZ2VfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1lc3NhZ2VfdHlwZSwgJnNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA+IDApOworICBnX2ZyZWUgKG1lc3NhZ2VfbmFtZSk7CisKKyAgLyogYnJva2VuIDJuZCByZWFkIG9uIGEgbWVzc2FnZSAqLworICB0cmFuc3BvcnRfcmVhZF9jb3VudCA9IDA7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gMTsKKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtZXNzYWdlX3R5cGUsICZzZXFpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPT0gLTEpOworICB0cmFuc3BvcnRfcmVhZF9lcnJvcl9hdCA9IC0xOworCisgIC8qIGJyb2tlbiAzcmQgcmVhZCBvbiBhIG1lc3NhZ2UgKi8KKyAgdHJhbnNwb3J0X3JlYWRfY291bnQgPSAwOworICB0cmFuc3BvcnRfcmVhZF9lcnJvcl9hdCA9IDI7CisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfYmVnaW4gKHByb3RvY29sLCAmbWVzc2FnZV9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbWVzc2FnZV90eXBlLCAmc2VxaWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpID09IC0xKTsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAtMTsKKworICAvKiBicm9rZW4gNHRoIHJlYWQgb24gYSBtZXNzYWdlICovCisgIHRyYW5zcG9ydF9yZWFkX2NvdW50ID0gMDsKKyAgdHJhbnNwb3J0X3JlYWRfZXJyb3JfYXQgPSAzOworICBnX2Fzc2VydCAodGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2xfcmVhZF9tZXNzYWdlX2JlZ2luIChwcm90b2NvbCwgJm1lc3NhZ2VfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1lc3NhZ2VfdHlwZSwgJnNlcWlkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSA9PSAtMSk7CisgIHRyYW5zcG9ydF9yZWFkX2Vycm9yX2F0ID0gLTE7CisKKyAgLyogcmVhZCBhIHZhbGlkIG1lc3NhZ2UgKi8KKyAgZ19hc3NlcnQgKHRocmlmdF9jb21wYWN0X3Byb3RvY29sX3JlYWRfbWVzc2FnZV9iZWdpbiAocHJvdG9jb2wsICZtZXNzYWdlX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtZXNzYWdlX3R5cGUsICZzZXFpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkgPiAwKTsKKyAgZ19mcmVlIChtZXNzYWdlX25hbWUpOworCisgIGdfYXNzZXJ0ICh0aHJpZnRfY29tcGFjdF9wcm90b2NvbF9yZWFkX21lc3NhZ2VfZW5kIChwcm90b2NvbCwgTlVMTCkgPT0gMCk7CisKKyAgLyogaGFuZGxlIDJuZCB3cml0ZSBmYWlsdXJlIG9uIGEgb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1NfQ0FTVCAoKGMpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9URVNUX0NPTlRBSU5FUl9TRVJWSUNFX0hBTkRMRVIsICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGVzdENvbnRhaW5lclNlcnZpY2VIYW5kbGVyQ2xhc3MpKQorI2RlZmluZSBJU19URVNUX0NPTlRBSU5FUl9TRVJWSUNFX0hBTkRMRVIob2JqKSAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0lOU1RBTkNFX1RZUEUgKChvYmopLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEVfVEVTVF9DT05UQUlORVJfU0VSVklDRV9IQU5ETEVSKSkKKyNkZWZpbmUgSVNfVEVTVF9DT05UQUlORVJfU0VSVklDRV9IQU5ETEVSX0NMQVNTKGMpICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19DTEFTU19UWVBFICgoYyksICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1RFU1RfQ09OVEFJTkVSX1NFUlZJQ0VfSEFORExFUikpCisjZGVmaW5lIFRFU1RfQ09OVEFJTkVSX1NFUlZJQ0VfSEFORExFUl9HRVRfQ0xBU1Mob2JqKSAgICAgICAgICAgICAgICAgICBcCisgIChHX1RZUEVfSU5TVEFOQ0VfR0VUX0NMQVNTICgob2JqKSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1RFU1RfQ09OVEFJTkVSX1NFUlZJQ0VfSEFORExFUiwgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXN0Q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LCBncG9pbnRlciBwdHJfYXJyYXkpCit7CisgIGdfcHRyX2FycmF5X2FkZCAoKEdQdHJBcnJheSAqKXB0cl9hcnJheSwgZ19zdHJkdXAgKChnY2hhciAqKWVsZW1lbnQpKTsKK30KKworLyogQWNjZXB0IGEgc3RyaW5nIGxpc3QgZnJvbSB0aGUgY2xpZW50IGFuZCBhcHBlbmQgaXRzIGNvbnRlbnRzIHRvIG91ciBpbnRlcm5hbAorICAgbGlzdCAqLworc3RhdGljIGdib29sZWFuCit0ZXN0X2NvbnRhaW5lcl9zZXJ2aWNlX2hhbmRsZXJfcmVjZWl2ZV9zdHJpbmdfbGlzdCAoVFRlc3RDb250YWluZXJTZXJ2aWNlSWYgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEdQdHJBcnJheSAqc3RyaW5nTGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGVzdENvbnRhaW5lclNlcnZpY2VIYW5kbGVyICpzZWxmID0gVEVTVF9DT05UQUlORVJfU0VSVklDRV9IQU5ETEVSIChpZmFjZSk7CisKKyAgLyogQXBwZW5kIHRoZSBjbGllbnQncyBzdHJpbmdzIHRvIG91ciBvd24gaW50ZXJuYWwgc3RyaW5nIGxpc3QgKi8KKyAgZ19wdHJfYXJyYXlfZm9yZWFjaCAoKEdQdHJBcnJheSAqKXN0cmluZ0xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgIGFwcGVuZF9zdHJpbmdfdG9fcHRyX2FycmF5LAorICAgICAgICAgICAgICAgICAgICAgICBzZWxmLT5zdHJpbmdfbGlzdCk7CisKKyAgZ19jbGVhcl9lcnJvciAoZXJyb3IpOworICByZXR1cm4gVFJVRTsKK30KKworLyogUmV0dXJuIHRoZSBjb250ZW50cyBvZiBvdXIgaW50ZXJuYWwgc3RyaW5nIGxpc3QgdG8gdGhlIGNsaWVudCAqLworc3RhdGljIGdib29sZWFuCit0ZXN0X2NvbnRhaW5lcl9zZXJ2aWNlX2hhbmRsZXJfcmV0dXJuX3N0cmluZ19saXN0IChUVGVzdENvbnRhaW5lclNlcnZpY2VJZiAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHUHRyQXJyYXkgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRlc3RDb250YWluZXJTZXJ2aWNlSGFuZGxlciAqc2VsZiA9IFRFU1RfQ09OVEFJTkVSX1NFUlZJQ0VfSEFORExFUiAoaWZhY2UpOworCisgIC8qIFJldHVybiAoY29waWVzIG9mKSB0aGUgc3RyaW5ncyBjb250YWluZWQgaW4gb3VyIGxpc3QgKi8KKyAgZ19wdHJfYXJyYXlfZm9yZWFjaCAoc2VsZi0+c3RyaW5nX2xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgIGFwcGVuZF9zdHJpbmdfdG9fcHRyX2FycmF5LAorICAgICAgICAgICAgICAgICAgICAgICAqX3JldHVybik7CisKKyAgZ19jbGVhcl9lcnJvciAoZXJyb3IpOworICByZXR1cm4gVFJVRTsKK30KKworc3RhdGljIGdib29sZWFuCit0ZXN0X2NvbnRhaW5lcl9zZXJ2aWNlX2hhbmRsZXJfcmV0dXJuX2xpc3Rfc3RyaW5nX2xpc3QgKFRUZXN0Q29udGFpbmVyU2VydmljZUlmICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR1B0ckFycmF5ICoqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICoqZXJyb3IpCit7CisgIFRlc3RDb250YWluZXJTZXJ2aWNlSGFuZGxlciAqc2VsZiA9IFRFU1RfQ09OVEFJTkVSX1NFUlZJQ0VfSEFORExFUiAoaWZhY2UpOworICBHUHRyQXJyYXkgKm5lc3RlZF9saXN0OworCisgIC8qIFJldHVybiBhIGxpc3QgY29udGFpbmluZyBvdXIgbGlzdCBvZiBzdHJpbmdzICovCisgIG5lc3RlZF9saXN0CisgICAgPSBnX3B0cl9hcnJheV9uZXdfd2l0aF9mcmVlX2Z1bmMgKChHRGVzdHJveU5vdGlmeSlnX3B0cl9hcnJheV91bnJlZik7CisgIGdfcHRyX2FycmF5X2FkZCAobmVzdGVkX2xpc3QsIHNlbGYtPnN0cmluZ19saXN0KTsKKyAgZ19wdHJfYXJyYXlfcmVmIChzZWxmLT5zdHJpbmdfbGlzdCk7CisKKyAgZ19wdHJfYXJyYXlfYWRkICgqX3JldHVybiwgbmVzdGVkX2xpc3QpOworCisgIGdfY2xlYXJfZXJyb3IgKGVycm9yKTsKKyAgcmV0dXJuIFRSVUU7Cit9CisKK3N0YXRpYyBnYm9vbGVhbgordGVzdF9jb250YWluZXJfc2VydmljZV9oYW5kbGVyX3JldHVybl90eXBlZGVmZF9saXN0X3N0cmluZ19saXN0IChUVGVzdENvbnRhaW5lclNlcnZpY2VJZiAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0TGlzdFN0cmluZ0xpc3QgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgKiplcnJvcikKK3sKKyAgVGVzdENvbnRhaW5lclNlcnZpY2VIYW5kbGVyICpzZWxmID0gVEVTVF9DT05UQUlORVJfU0VSVklDRV9IQU5ETEVSIChpZmFjZSk7CisgIFRUZXN0U3RyaW5nTGlzdCAqbmVzdGVkX2xpc3Q7CisKKyAgLyogUmV0dXJuIGEgbGlzdCBjb250YWluaW5nIG91ciB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ICAgICAgICAgICAgICBHRXJyb3IgKiopKQoreworICBUaHJpZnRTb2NrZXQgKnNvY2tldDsKKyAgVGhyaWZ0VHJhbnNwb3J0ICp0cmFuc3BvcnQ7CisgIFRocmlmdFByb3RvY29sICpwcm90b2NvbDsKKworICBUVGVzdENvbnRhaW5lclNlcnZpY2VJZiAqY2xpZW50OworCisgIEdFcnJvciAqZXJyb3IgPSBOVUxMOworCisgIC8qIENyZWF0ZSBhIGNsaWVudCB3aXRoIHdoaWNoIHRvIGFjY2VzcyB0aGUgc2VydmVyICovCisgIHNvY2tldCAgICA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfU09DS0VULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJob3N0bmFtZSIsIFRFU1RfU0VSVkVSX0hPU1ROQU1FLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJwb3J0IiwgICAgIFRFU1RfU0VSVkVSX1BPUlQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIHRyYW5zcG9ydCA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQlVGRkVSRURfVFJBTlNQT1JULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0cmFuc3BvcnQiLCBzb2NrZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIHByb3RvY29sICA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQklOQVJZX1BST1RPQ09MLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0cmFuc3BvcnQiLCB0cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgdGhyaWZ0X3RyYW5zcG9ydF9vcGVuICh0cmFuc3BvcnQsICZlcnJvcik7CisgIGdfYXNzZXJ0X25vX2Vycm9yIChlcnJvcik7CisKKyAgY2xpZW50ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9DT05UQUlORVJfU0V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IgKGluZGV4ID0gMDsgaW5kZXggPCAzOyBpbmRleCArPSAxKQorICAgIGdfcHRyX2FycmF5X2FkZCAob3V0Z29pbmdfc3RyaW5nX2xpc3QsICZ0ZXN0X2RhdGFbaW5kZXhdKTsKKworICAvKiBTZW5kIG91ciBkYXRhIHRvIHRoZSBzZXJ2ZXIgYW5kIG1ha2Ugc3VyZSB3ZSBnZXQgdGhlIHNhbWUgZGF0YSBiYWNrIG9uCisgICAgIHJldHJpZXZlICovCisgIGdfYXNzZXJ0CisgICAgKHRfdGVzdF9jb250YWluZXJfc2VydmljZV9jbGllbnRfcmVjZWl2ZV9zdHJpbmdfbGlzdCAoY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dGdvaW5nX3N0cmluZ19saXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSAmJgorICAgICAqZXJyb3IgPT0gTlVMTCk7CisKKyAgaW5jb21pbmdfc3RyaW5nX2xpc3QgPSBnX3B0cl9hcnJheV9uZXcgKCk7CisgIGdfYXNzZXJ0CisgICAgKHRfdGVzdF9jb250YWluZXJfc2VydmljZV9jbGllbnRfcmV0dXJuX3N0cmluZ19saXN0IChjbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW5jb21pbmdfc3RyaW5nX2xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcikgJiYKKyAgICAgKmVycm9yID09IE5VTEwpOworCisgIC8qIE1ha2Ugc3VyZSB0aGUgdHdvIGxpc3RzIGFyZSBlcXVpdmFsZW50ICovCisgIGdfYXNzZXJ0X2NtcGludCAoaW5jb21pbmdfc3RyaW5nX2xpc3QtPmxlbiwgPT0sIG91dGdvaW5nX3N0cmluZ19saXN0LT5s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JheV9uZXdfd2l0aF9mcmVlX2Z1bmMgKChHRGVzdHJveU5vdGlmeSlnX3B0cl9hcnJheV91bnJlZik7CisgIGdfYXNzZXJ0CisgICAgKHRfdGVzdF9jb250YWluZXJfc2VydmljZV9jbGllbnRfcmV0dXJuX2xpc3Rfc3RyaW5nX2xpc3QgKGNsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmluY29taW5nX2xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yKSAmJgorICAgICAqZXJyb3IgPT0gTlVMTCk7CisKKyAgLyogTWFrZSBzdXJlIHRoZSBsaXN0IGFuZCBpdHMgY29udGVudHMgYXJlIHZhbGlkICovCisgIGdfYXNzZXJ0X2NtcGludCAoaW5jb21pbmdfbGlzdC0+bGVuLCA+LCAwKTsKKworICBuZXN0ZWRfbGlzdCA9IChHUHRyQXJyYXkgKilnX3B0cl9hcnJheV9pbmRleCAoaW5jb21pbmdfbGlzdCwgMCk7CisgIGdfYXNzZXJ0IChuZXN0ZWRfbGlzdCAhPSBOVUxMKTsKKyAgZ19hc3NlcnRfY21waW50IChuZXN0ZWRfbGlzdC0+bGVuLCA+PSwgMCk7CisKKyAgLyogQ2xlYW4gdXAgYW5kIGV4aXQgKi8KKyAgZ19wdHJfYXJyYXlfdW5yZWYgKGluY29taW5nX2xpc3QpOworfQorCitzdGF0aWMgdm9pZAordGVzdF9jb250YWluZXJfc2VydmljZV9saXN0X3N0cmluZ19saXN0ICh2b2lkKQoreworICBleGVjdXRlX3dpdGhfc2VydmljZV9jbGllbnQgKHRlc3RfY29udGFpbmVyX3NlcnZpY2VfbGlzdF9zdHJpbmdfbGlzdF9pbm5lcik7Cit9CisKK3N0YXRpYyB2b2lkCit0ZXN0X2NvbnRhaW5lcl9zZXJ2aWNlX3R5cGVkZWZkX2xpc3Rfc3RyaW5nX2xpc3RfaW5uZXIgKFRUZXN0Q29udGFpbmVyU2VydmljZUlmICpjbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUVGVzdExpc3RTdHJpbmdMaXN0ICppbmNvbWluZ19saXN0OworICBUVGVzdFN0cmluZ0xpc3QgKm5lc3RlZF9saXN0OworCisgIGdfY2xlYXJfZXJyb3IgKGVycm9yKTsKKworICAvKiBSZWNlaXZlIGEgbGlzdCBvZiBzdHJpbmcgbGlzdHMgZnJvbSB0aGUgc2VydmVyICovCisgIGluY29taW5nX2xpc3QgPQorICAgIGdfcHRyX2FycmF5X25ld193aXRoX2ZyZWVfZnVuYyAoKEdEZXN0cm95Tm90aWZ5KWdfcHRyX2FycmF5X3VucmVmKTsKKyAgZ19hc3NlcnQKKyAgICAodF90ZXN0X2NvbnRhaW5lcl9zZXJ2aWNlX2NsaWVudF9yZXR1cm5fbGlzdF9zdHJpbmdfbGlzdCAoY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW5jb21pbmdfbGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IpICYmCisgICAgICplcnJvciA9PSBOVUxMKTsKKworICAvKiBNYWtlIHN1cmUgdGhlIGxpc3QgYW5kIGl0cyBjb250ZW50cyBhcmUgdmFsaWQgKi8KKyAgZ19hc3NlcnRfY21waW50IChpbmNvbWluZ19saXN0LT5sZW4sID4sIDApOworCisgIG5lc3RlZF9saXN0ID0gKFRUZXN0U3RyaW5nTGlzdCAqKWdfcHRyX2FycmF5X2luZGV4IChpbmNvbWluZ19saXN0LCAwKTsKKyAgZ19hc3NlcnQgKG5lc3RlZF9saXN0ICE9IE5VTEwpOworICBnX2Fzc2VydF9jbXBpbnQgKG5lc3Rl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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgIHRyYW5zcG9ydF9mYWN0b3J5ID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9CVUZGRVJFRF9UUkFOU1BPUlRfRkFDVE9SWSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgcHJvdG9jb2xfZmFjdG9yeSA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQklOQVJZX1BST1RPQ09MX0ZBQ1RPUlksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICBzZXJ2ZXIgPSBnX29iamVjdF9uZXcgKFRIUklGVF9UWVBFX1NJTVBMRV9TRVJWRVIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAicHJvY2Vzc29yIiwgICAgICAgICAgICAgICAgcHJvY2Vzc29yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgInNlcnZlcl90cmFuc3BvcnQiLCAgICAgICAgIHNlcnZlcl90cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5wdXRfdHJhbnNwb3J0X2ZhY3RvcnkiLCAgdHJhbnNwb3J0X2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAib3V0cHV0X3RyYW5zcG9ydF9mYWN0b3J5IiwgdHJhbnNwb3J0X2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5wdXRfcHJvdG9jb2xfZmFjdG9yeSIsICAgcHJvdG9jb2xfZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICJvdXRwdXRfcHJvdG9jb2xfZmFjdG9yeSIsICBwcm90b2NvbF9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICAvKiBTdGFydCB0aGUgc2VydmVyICovCisgICAgdGhyaWZ0X3NlcnZlcl9zZXJ2ZSAo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BnZG91YmxlIHRpbnk7CisgIGdkb3VibGUgemVybzsKKyAgZ2RvdWJsZSBuZWd6ZXJvOwogCi0gIGdfaGFzaF90YWJsZV9pbnNlcnQgKGhtLT5jb250YWluLCByYW5kb20sIHJhbmRvbSk7CisgIC8qIE5vdGUgdGhlcmUgc2VlbXMgdG8gYmUgbm8gd2F5IHRvIGdldCBub3QtYS1udW1iZXIgKCJOQU4iKSB2YWx1ZXMgcGFzdAorICAgICBHT2JqZWN0J3MgcmFuZ2UtY2hlY2tpbmcsIHNvIHRoYXQgcG9ydGlvbiBvZiB0aGUgdGVzdCBoYXMgYmVlbiBjb21tZW50ZWQKKyAgICAgb3V0IGJlbG93LiAqLwogCisgIC8qIEEgRG91YmxlcyBzdHJ1Y3R1cmUncyBtZW1iZXJzIGFyZSBhdmFpbGFibGUgYXMgR09iamVjdCBwcm9wZXJ0aWVzCisgICAgIHRoYXQgY2FuIGJlIGluaXRpYWxpemVkIGF0IGNvbnN0cnVjdGlvbi4uLiAqLworICBkb3VibGVzID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9ET1VCTEVTLAorICAgICAgICAgICAgICAgICAgICAgICAgICAvKiAibmFuIiwgICAgICAwICogSU5GSU5JVFksICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICJpbmYiLCAgICAgICAgICBJTkZJTklUWSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIm5lZ2luZiIsICAgICAgLUlORklOSVRZLAorICAgICAgICAgICAgICAgICAgICAgICAgICAicmVwZWF0aW5nIiwgICAgIDEuMCAvIDMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJiaWciLCAgICAgICBHX01BWERPVUJMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgInRpbnkiLCAgICAgICAgICAxMEUtMTAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAiemVybyIsICAgICAgICAgIDEuMCAqIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJuZWd6ZXJvIiwgICAgICAtMS4wICogMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgZ19hc3NlcnQgKGRvdWJsZXMgIT0gTlVMTCk7CisKKyAgLyogLi4uYW5kIGxhdGVyIHJldHJpZXZlZCAqLworICBnX29iamVjdF9nZXQgKGRvdWJsZXMsCisgICAgICAgICAgICAgICAgIm5hbiIsICAgICAgICZuYW4sCisgICAgICAgICAgICAgICAgImluZiIsICAgICAgICZpbmYsCisgICAgICAgICAgICAgICAgIm5lZ2luZiIsICAgICZuZWdpbmYsCisgICAgICAgICAgICAgICAgInJlcGVhdGluZyIsICZyZXBlYXRpbmcsCisgICAgICAgICAgICAgICAgImJpZyIsICAgICAgICZiaWcsCisgICAgICAgICAgICAgICAgInRpbnkiLCAgICAgICZ0aW55LAorICAgICAgICAgICAgICAgICJ6ZXJvIiwgICAgICAmemVybywKKyAgICAgICAgICAgICAgICAibmVnemVybyIsICAgJm5lZ3plcm8sCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgLyogZ19hc3NlcnRfY21waW50IChpc25hbiAobmFuKSwgICAgIT0sICAwKTsgKi8KKyAgZ19hc3NlcnRfY21waW50IChpc2luZiAoaW5mKSwgICAgPT0sICAxKTsKKyAgZ19hc3NlcnRfY21waW50IChpc2luZiAobmVnaW5mKSwgPT0sIC0xKTsKKworICBnX2Fzc2VydF9jbXBmbG9hdCAocmVwZWF0aW5nLCA9PSwgICAgIDEuMCAvIDMpOworICBnX2Fzc2VydF9jbXBmbG9hdCAoYmlnLCAgICAgICA9PSwgR19NQVhET1VCTEUpOworICBnX2Fzc2VydF9jbXBmbG9hdCAodGlueSwgICAgICA9PSwgICAgIDEwRS0xMDEpOworICBnX2Fzc2VydF9jbXBmbG9hdCAoemVybywgICAgICA9PSwgICAgIDEuMCAqIDApOworICBnX2Fzc2VydF9jbXBmbG9hdCAobmVnemVybywgICA9PSwgICAgLTEuMCAqIDApOworCisgIGdfb2JqZWN0X3VucmVmIChkb3VibGVzK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ldCAob25lX29mX2VhY2gsCisgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgICZhX2JpdGUsCisgICAgICAgICAgICAgICAgImludGVnZXIxNiIsICZpbnRlZ2VyMTYsCisgICAgICAgICAgICAgICAgImludGVnZXI2NCIsICZpbnRlZ2VyNjQsCisgICAgICAgICAgICAgICAgImJ5dGVfbGlzdCIsICZieXRlX2xpc3QsCisgICAgICAgICAgICAgICAgImkxNl9saXN0IiwgICZpMTZfbGlzdCwKKyAgICAgICAgICAgICAgICAiaTY0X2xpc3QiLCAgJmk2NF9saXN0LAorICAgICAgICAgICAgICAgIE5VTEwpOworCisgIGdfYXNzZXJ0X2NtcGludCAoYV9iaXRlLCAgICA9PSwgMHg3Zik7CisgIGdfYXNzZXJ0X2NtcGludCAoaW50ZWdlcjE2LCA9PSwgMHg3ZmZmKTsKKyAgZ19hc3NlcnRfY21waW50IChpbnRlZ2VyNjQsID09LCBHX0dJTlQ2NF9DT05TVEFOVCAoMTAwMDAwMDAwMDApKTsKKworICBnX2Fzc2VydCAoYnl0ZV9saXN0ICE9IE5VTEwpOworICBnX2Fzc2VydF9jbXBpbnQgKGJ5dGVfbGlzdC0+bGVuLCA9PSwgMyk7CisgIGdfYXNzZXJ0X2NtcGludCAoZ19hcnJheV9pbmRleCAoYnl0ZV9saXN0LCBnaW50OCwgMCksID09LCAxKTsKKyAgZ19hc3NlcnRfY21waW50IChnX2FycmF5X2luZGV4IChieXRlX2xpc3QsIGdpbnQ4LCAxKSwgPT0sIDIpOworICBnX2Fzc2VydF9jbXBpbnQgKGdfYXJyYXlfaW5kZXggKGJ5dGVfbGlzdCwgZ2ludDgsIDIpLCA9PSwgMyk7CisKKyAgZ19hc3NlcnQgKGkxNl9saXN0ICE9IE5VTEwpOworICBnX2Fzc2VydF9jbXBpbnQgKGkxNl9saXN0LT5sZW4sID09LCAzKTsKKyAgZ19hc3NlcnRfY21waW50IChnX2FycmF5X2luZGV4IChpMTZfbGlzdCwgZ2ludDE2LCAwK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DgpKTsKKyAgZ19hcnJheV9hcHBlbmRfdmFscyAoYnl0ZV9saXN0LCBpbml0aWFsX2J5dGVfbGlzdCwgNSk7CisKKyAgaTE2X2xpc3QgPSBnX2FycmF5X25ldyAoRkFMU0UsIEZBTFNFLCBzaXplb2YgKGdpbnQxNikpOworICBnX2FycmF5X2FwcGVuZF92YWxzIChpMTZfbGlzdCwgaW5pdGlhbF9pMTZfbGlzdCwgNSk7CisKKyAgaTY0X2xpc3QgPSBnX2FycmF5X25ldyAoRkFMU0UsIEZBTFNFLCBzaXplb2YgKGdpbnQ2NCkpOworICBnX2FycmF5X2FwcGVuZF92YWxzIChpNjRfbGlzdCwgaW5pdGlhbF9pNjRfbGlzdCwgNSk7CisKKyAgLyogQWxsIG9mIE9uZU9mRWFjaCdzIHByb3BlcnRpZXMgY2FuIGJlIHNldCBhdCBjb25zdHJ1Y3Rpb24uLi4gKi8KKyAgb25lX29mX2VhY2ggPQorICAgIGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfT05FX09GX0VBQ0gsCisgICAgICAgICAgICAgICAgICAiaW1fdHJ1ZSIsICAgICAgICAgIFRSVUUsCisgICAgICAgICAgICAgICAgICAiaW1fZmFsc2UiLCAgICAgICAgIEZBTFNFLAorICAgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgICAgICAgICAweDUwLAorICAgICAgICAgICAgICAgICAgImludGVnZXIxNiIsICAgICAgICAweDdlNTcsCisgICAgICAgICAgICAgICAgICAiaW50ZWdlcjMyIiwgICAgICAgIDB4ZGVhZGJlZWYsCisgICAgICAgICAgICAgICAgICAiaW50ZWdlcjY0IiwgICAgICAgIEdfR0lOVDY0X0NPTlNUQU5UICgweGZhMTVlZmFjYWRlMTViYWQpLAorICAgICAgICAgICAgICAgICAgImRvdWJsZV9wcmVjaXNpb24iLCBNX1BJLAorICAgICAgICAgICAgICAgICAgInNvbWVfY2hhcmFjdGVycyIsICAiRGVidWcgVEhJUyEiLAorICAgICAgICAgICAgICAgICAgInpvbWdfdW5pY29kZSIsICAgICAiXHhkN1xuXGFcdCIsCisgICAgICAgICAgICAgICAgICAid2hhdF93aG8iLCAgICAgICAgIFRSVUUsCisgICAgICAgICAgICAgICAgICAiYmFzZTY0IiwgICAgICAgICAgIGJhc2U2NCwKKyAgICAgICAgICAgICAgICAgICJieXRlX2xpc3QiLCAgICAgICAgYnl0ZV9saXN0LAorICAgICAgICAgICAgICAgICAgImkxNl9saXN0IiwgICAgICAgICBpMTZfbGlzdCwKKyAgICAgICAgICAgICAgICAgICJpNjRfbGlzdCIsICAgICAgICAgaTY0X2xpc3QsCisgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgZ19hc3NlcnQgKG9uZV9vZl9lYWNoICE9IE5VTEwpOworCisgIGdfYXJyYXlfdW5yZWYgKGk2NF9saXN0KTsKKyAgaTY0X2xpc3QgPSBOVUxMOworICBnX2FycmF5X3VucmVmIChpMTZfbGlzdCk7CisgIGkxNl9saXN0ID0gTlVMTDsKKyAgZ19hcnJheV91bnJlZiAoYnl0ZV9saXN0KTsKKyAgYnl0ZV9saXN0ID0gTlVMTDsKKyAgZ19ieXRlX2FycmF5X3VucmVmIChiYXNlNjQpOworICBiYXNlNjQgPSBOVUxMOworCisgIC8qIC4uLmFuZCBsYXRlciByZXRyaWV2ZWQgKi8KKyAgZ19vYmplY3RfZ2V0IChvbmVfb2ZfZWFjaCwKKyAgICAgICAgICAgICAgICAiaW1fdHJ1ZSIsICAgICAgICAgICZpbV90cnVlLAorICAgICAgICAgICAgICAgICJpbV9mYWxzZSIsICAgICAgICAgJmltX2ZhbHNlLAorICAgICAgICAgICAgICAgICJhX2JpdGUiLCAgICAgICAgICAgJmFfYml0ZSwKKyAgICAgICAgICAgICAgICAiaW50ZWdlcjE2IiwgICAgICAgICZpbnRlZ2VyMTYsCisgICAgICAgICAgICAgICAgImludGVnZXIzMiIsICAgICAgICAmaW50ZWdlcjMyLAorICAgICAgICAgICAgICAgICJpbnRlZ2VyNjQiLCAgICAgICAgJmludGVnZXI2NCwKKyAgICAgICAgICAgICAgICAiZG91YmxlX3ByZWNpc2lvbiIsICZkb3VibGVfcHJlY2lzaW9uLAorICAgICAgICAgICAgICAgICJzb21lX2NoYXJhY3RlcnMiLCAgJnNvbWVfY2hhcmFjdGVycywKKyAgICAgICAgICAgICAgICAiem9tZ191bmljb2RlIiwgICAgICZ6b21nX3VuaWNvZGUsCisgICAgICAgICAgICAgICAgIndoYXRfd2hvIiwgICAgICAgICAmd2hhdF93aG8sCisgICAgICAgICAgICAgICAgImJhc2U2NCIsICAgICAgICAgICAmYmFzZTY0LAorICAgICAgICAgICAgICAgICJieXRlX2xpc3QiLCAgICAgICAgJmJ5dGVfbGlzdCwKKyAgICAgICAgICAgICAgICAiaTE2X2xpc3QiLCAgICAgICAgICZpMTZfbGlzdCwKKyAgICAgICAgICAgICAgICAiaTY0X2xpc3QiLCAgICAgICAgICZpNjRfbGlzdCwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBnX2Fzc2VydCAoaW1fdHJ1ZSAgPT0gVFJVRSk7CisgIGdfYXNzZXJ0IChpbV9mYWxzZSA9PSBGQUxTRSk7CisKKyAgZ19hc3NlcnRfY21waGV4IChhX2JpdGUsICAgID09LCAweDUwKTsKKyAgZ19hc3NlcnRfY21waGV4IChpbnRlZ2VyMTYsID09LCAweDdlNTcpOworICBnX2Fzc2VydF9jbXBoZXggKGludGVnZXIzMiwgPT0sIChnaW50MzIpMHhkZWFkYmVlZik7CisgIGdfYXNzZXJ0X2NtcGhleCAoaW50ZWdlcjY0LCA9PSwgR19HSU5UNjRfQ09OU1RBTlQgKDB4ZmExNWVmYWNhZGUxNWJhZCkpOworCisgIGdfYXNzZXJ0X2NtcGZsb2F0IChkb3VibGVfcHJlY2lzaW9uLCA9PSwgTV9QSSk7CisKKyAgZ19hc3NlcnRfY21wc3RyIChzb21lX2NoYXJhY3RlcnMsID09LCAiRGVidWcgVEhJUyEiKTsKKyAgZ19hc3NlcnRfY21wc3RyICh6b21nX3VuaWNvZGUsICAgID09LCAiXHhkN1xuXGFcdCIpOworCisgIGdfYXNzZXJ0ICh3aGF0X3dobyA9PSBUUlVFKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKGJhc2U2NC0+bGVuLCA9PSwgOCk7CisgIGdfYXNzZXJ0X2NtcGludCAobWVtY21wIChiYXNlNjQtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsX2Jhc2U2NCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDggKiBzaXplb2YgKGd1aW50OCkpLCA9PSwgMCk7CisKKyAgZ19hc3NlcnRfY21waW50IChieXRlX2xpc3QtPmxlbiwgPT0sIDUpOworICBnX2Fzc2VydF9jbXBpbnQgKG1lbWNtcCAoYnl0ZV9saXN0LT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbF9ieXRlX2xpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICA1ICogc2l6ZW9mIChnaW50OCkpLCAgPT0sIDApOworCisgIGdfYXNzZXJ0X2NtcGludCAoaTE2X2xpc3QtPmxlbiwgPT0sIDUpOworICBnX2Fzc2VydF9jbXBpbnQgKG1lbWNtcCAoaTE2X2xpc3QtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsX2kxNl9saXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgNSAqIHNpemVvZiAoZ2ludDE2KSksID09LCAwKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKGk2NF9saXN0LT5sZW4sID09LCA1KTsKKyAgZ19hc3NlcnRfY21waW50IChtZW1jbXAgKGk2NF9saXN0LT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbF9pNjRfbGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDUgKiBzaXplb2YgKGdpbnQ2NCkpLCA9PSwgMCk7CisKKyAgZ19hcnJheV91bnJlZiAoaTY0X2xpc3QpO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dfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfTkVTVElORywgTlVMTCk7CiAKLSAgcmV0dXJuIDA7CisgIC8qIE5lc3RpbmcncyAibXlfYm9uayIgbWVtYmVyIGlzIGluaXRpYWxpemVkIHdpdGggYSBuZXcsIGRlZmF1bHQgQm9uayBvYmplY3QKKyAgICAgZHVyaW5nIGNvbnN0cnVjdGlvbiAqLworICBnX29iamVjdF9nZXQgKG5lc3RpbmcsICJteV9ib25rIiwgJmJvbmssIE5VTEwpOworCisgIGdfYXNzZXJ0IChib25rICE9IE5VTEwpOworICBnX2Fzc2VydCAoVF9URVNUX0lTX0JPTksgKGJvbmspKTsKKworICBnX29iamVjdF9nZXQgKGJvbmssCisgICAgICAgICAgICAgICAgInR5cGUiLCAgICAmdHlwZSwKKyAgICAgICAgICAgICAgICAibWVzc2FnZSIsICZtZXNzYWdlLAorICAgICAgICAgICAgICAgIE5VTEwpOworCisgIGdfYXNzZXJ0X2NtcGludCAodHlwZSwgPT0sIDApOworICBnX2Fzc2VydCAobWVzc2FnZSA9PSBOVUxMKTsKKworICBnX29iamVjdF91bnJlZiAoYm9uayk7CisgIGJvbmsgPSBOVUxMOworCisgIC8qIEl0IGNhbiBiZSByZXBsYWNlZC4uLiAqLworICBib25rID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9CT05LLAorICAgICAgICAgICAgICAgICAgICAgICAidHlwZSIsICAgIDEwMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCAiUmVwbGFjZW1lbnQgQm9uayIsCisgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICBnX29iamVjdF9zZXQgKG5lc3RpbmcsICJteV9ib25rIiwgYm9uaywgTlVMTCk7CisgIGdfb2JqZWN0X3VucmVmIChib25rKTsKKyAgYm9uayA9IE5VTEw7CisKKyAgZ19vYmplY3RfZ2V0IChuZXN0aW5nLCAibXlfYm9uayIsICZib25rLCBOVUxMKTsKKworICBnX2Fzc2VydCAoYm9uayAhPSBOVUxMKTsKKyAgZ19hc3NlcnQgKFRfVEVTVF9JU19CT05LIChib25rKSk7CisKKyAgZ19vYmplY3RfZ2V0IChib25rLAorICAgICAgICAgICAgICAgICJ0eXBlIiwgICAgJnR5cGUsCisgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCAmbWVzc2FnZSwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKHR5cGUsID09LCAxMDApOworICBnX2Fzc2VydF9jbXBzdHIgKG1lc3NhZ2UsID09LCAiUmVwbGFjZW1lbnQgQm9uayIpOworCisgIGdfZnJlZSAobWVzc2FnZSk7CisgIGdfb2JqZWN0X3VucmVmIChib25rKTsKKyAgYm9uayA9IE5VTEw7CisKKyAgLyogLi4ub3Igc2V0IHRvIG51bGwgKi8KKyAgZ19vYmplY3Rfc2V0IChuZXN0aW5nLCAibXlfYm9uayIsIE5VTEwsIE5VTEwpOworICBnX29iamVjdF9nZXQgKG5lc3RpbmcsICJteV9ib25rIiwgJmJvbmssIE5VTEwpOworCisgIGdfYXNzZXJ0IChib25rID09IE5VTEwpOworCisgIGdfb2JqZWN0X3VucmVmIChuZXN0aW5nKTsKK30KKworc3RhdGljIHZvaWQKK3Rlc3Rfc3RydWN0c19uZXN0aW5nX3Byb3BlcnRpZXNfbXlfb29lICh2b2lkKQoreworICBUVGVzdE5lc3RpbmcgKm5lc3Rpbmc7CisgIFRUZXN0T25lT2ZFYWNoICpvbmVfb2ZfZWFjaCA9IE5VTEw7CisgIGdpbnQgYV9iaXRlOworICBnaW50IGludGVnZXIxNjsKKworICBuZXN0aW5nID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9ORVNUSU5HLCBOVUxMKTsKKworICAvKiBOZXN0aW5nJ3MgIm15X29vZSIgbWVtYmVyIGlzIGluaXRpYWxpemVkIHdpdGggYSBuZXcsIGRlZmF1bHQgT25lT2ZFYWNoCisgICAgIG9iamVjdCBkdXJpbmcgY29uc3RydWN0aW9uICovCisgIGdfb2JqZWN0X2dldCAobmVzdGluZywgIm15X29vZSIsICZvbmVfb2ZfZWFjaCwgTlVMTCk7CisKKyAgZ19hc3NlcnQgKG9uZV9vZl9lYWNoICE9IE5VTEwpOworICBnX2Fzc2VydCAoVF9URVNUX0lTX09ORV9PRl9FQUNIIChvbmVfb2ZfZWFjaCkpOworCisgIGdfb2JqZWN0X2dldCAob25lX29mX2VhY2gsCisgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgICZhX2JpdGUsCisgICAgICAgICAgICAgICAgImludGVnZXIxNiIsICZpbnRlZ2VyMTYsCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgZ19hc3NlcnRfY21waGV4IChhX2JpdGUsICAgID09LCAweDdmKTsKKyAgZ19hc3NlcnRfY21waGV4IChpbnRlZ2VyMTYsID09LCAweDdmZmYpOworCisgIGdfb2JqZWN0X3VucmVmIChvbmVfb2ZfZWFjaCk7CisgIG9uZV9vZl9lYWNoID0gTlVMTDsKKworICAvKiBJdCBjYW4gYmUgcmVwbGFjZWQuLi4gKi8KKyAgb25lX29mX2VhY2ggPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX09ORV9PRl9FQUNILAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgIDB4NTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW50ZWdlcjE2IiwgMHg1MDUwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIGdfb2JqZWN0X3NldCAobmVzdGluZywgIm15X29vZSIsIG9uZV9vZl9lYWNoLCBOVUxMKTsKKyAgZ19vYmplY3RfdW5yZWYgKG9uZV9vZl9lYWNoKTsKKyAgb25lX29mX2VhY2ggPSBOVUxMOworCisgIGdfb2JqZWN0X2dldCAobmVzdGluZywgIm15X29vZSIsICZvbmVfb2ZfZWFjaCwgTlVMTCk7CisKKyAgZ19hc3NlcnQgKG9uZV9vZl9lYWNoICE9IE5VTEwpOworICBnX2Fzc2VydCAoVF9URVNUX0lTX09ORV9PRl9FQUNIIChvbmVfb2ZfZWFjaCkpOworCisgIGdfb2JqZWN0X2dldCAob25lX29mX2VhY2gsCisgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgICZhX2JpdGUsCisgICAgICAgICAgICAgICAgImludGVnZXIxNiIsICZpbnRlZ2VyMTYsCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgZ19hc3NlcnRfY21waGV4IChhX2JpdGUsICAgID09LCAweDUwKTsKKyAgZ19hc3NlcnRfY21waGV4IChpbnRlZ2VyMTYsID09LCAweDUwNTApOworCisgIGdfb2JqZWN0X3VucmVmIChvbmVfb2ZfZWFjaCk7CisgIG9uZV9vZl9lYWNoID0gTlVMTDsKKworICAvKiAuLi5vciBzZXQgdG8gbnVsbCAqLworICBnX29iamVjdF9zZXQgKG5lc3RpbmcsICJteV9vb2UiLCBOVUxMLCBOVUxMKTsKKyAgZ19vYmplY3RfZ2V0IChuZXN0aW5nLCAibXlfb29lIiwgJm9uZV9vZl9lYWNoLCBOVUxMKTsKKworICBnX2Fzc2VydCAob25lX29mX2VhY2ggPT0gTlVMTCk7CisKKyAgZ19vYmplY3RfdW5yZWYgKG5lc3RpbmcpOworfQorCitzdGF0aWMgdm9pZAordGVzdF9zdHJ1Y3RzX2hvbHlfbW9sZXlfY3JlYXRlX2FuZF9kZXN0cm95ICh2b2lkKQoreworICBHT2JqZWN0ICpvYmplY3QgPSBOVUxMOworCisgIC8qIEEgSG9seU1vbGV5IHN0cnVjdHVyZSBjYW4gYmUgY3JlYXRlZC4uLiAqLworICBvYmplY3QgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX0hPTFlfTU9MRVksIE5VTEwpOworCisgIGdfYXNzZXJ0IChvYmplY3QgIT0gTlVMTCk7CisgIGdfYXNzZXJ0IChUX1RFU1RfSVNfSE9MWV9NT0xFWSAob2JqZWN0KSk7CisKKyAgLyogLi4uYW5kIGRlc3Ryb3llZCAqLworICBnX29iamVjdF91bnJlZiAob2JqZWN0KTsKK30KKworc3RhdGljIHZvaWQKK3Rlc3Rfc3RydWN0c19ob2x5X21vbGV5X3Byb3BlcnRpZXNfYmlnICh2b2lkKQoreworICBUVGVzdEhvbHlNb2xleSAqaG9seV9tb2xleTsKKyAgR1B0ckFycmF5ICpiaWcgPSBOVUxMOworICBnaW50IGFfYml0ZSA9IDA7CisgIGdpbnQgaW50ZWdlcjE2ID0gMDsKKworICBob2x5X21vbGV5ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9IT0xZX01PTEVZLCBOVUxMKTsKKworICAvKiBBIEhvbHlNb2xleSdzICJiaWciIG1lbWJlciBpcyBpcyBpbml0aWFsaXplZCBvbiBjb25zdHJ1Y3Rpb24gKi8KKyAgZ19vYmplY3RfZ2V0IChob2x5X21vbGV5LCAiYmlnIiwgJmJpZywgTlVMTCk7CisKKyAgZ19hc3NlcnQgKGJpZyAhPSBOVUxMKTsKKyAgZ19hc3NlcnRfY21waW50IChiaWctPmxlbiwgPT0sIDApOworCisgIC8qIEl0IGNhbiBiZSBtb2RpZmllZC4uLiAqLworICBnX3B0cl9hcnJheV9hZGQgKGJpZywKKyAgICAgICAgICAgICAgICAgICBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX09ORV9PRl9FQUNILAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgIDB4NTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW50ZWdlcjE2IiwgMHg1MDUwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkpOworCisgIGdfcHRyX2FycmF5X3VucmVmIChiaWcpOworICBiaWcgPSBOVUxMOworCisgIGdfb2JqZWN0X2dldCAoaG9seV9tb2xleSwgImJpZyIsICZiaWcsIE5VTEwpOworCisgIGdfYXNzZXJ0X2NtcGludCAoYmlnLT5sZW4sID09LCAxKTsKKyAgZ19vYmplY3RfZ2V0IChnX3B0cl9hcnJheV9pbmRleCAoYmlnLCAwKSwKKyAgICAgICAgICAgICAgICAiYV9iaXRlIiwgICAgJmFfYml0ZSwKKyAgICAgICAgICAgICAgICAiaW50ZWdlcjE2IiwgJmludGVnZXIxNiwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBnX2Fzc2VydF9jbXBoZXggKGFfYml0ZSwgICAgPT0sIDB4NTApOworICBnX2Fzc2VydF9jbXBoZXggKGludGVnZXIxNiwgPT0sIDB4NTA1MCk7CisKKyAgZ19wdHJfYXJyYXlfdW5yZWYgKGJpZyk7CisgIGJpZyA9IE5VTEw7CisKKyAgLyogLi4ucmVwbGFjZWQuLi4gKi8KKyAgYmlnID0gZ19wdHJfYXJyYXlfbmV3X3dpdGhfZnJlZV9mdW5jIChnX29iamVjdF91bnJlZik7CisgIGdfcHRyX2FycmF5X2FkZCAoYmlnLAorICAgICAgICAgICAgICAgICAgIGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfT05FX09GX0VBQ0gsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYV9iaXRlIiwgICAgMHg2NCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbnRlZ2VyMTYiLCAweDE1NDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSk7CisKKyAgZ19vYmplY3Rfc2V0IChob2x5X21vbGV5LCAiYmlnIiwgYmlnLCBOVUxMKTsKKworICBnX3B0cl9hcnJheV91bnJlZiAoYmlnKTsKKyAgYmlnID0gTlVMTDsKKworICBnX29iamVjdF9nZXQgKGhvbHlfbW9sZXksICJiaWciLCAmYmlnLCBOVUxMKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKGJpZy0+bGVuLCA9PSwgMSk7CisgIGdfb2JqZWN0X2dldCAoZ19wdHJfYXJyYXlfaW5kZXggKGJpZywgMCksCisgICAgICAgICAgICAgICAgImFfYml0ZSIsICAgICZhX2JpdGUsCisgICAgICAgICAgICAgICAgImludGVnZXIxNiIsICZpbnRlZ2VyMTYsCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgZ19hc3NlcnRfY21waGV4IChhX2JpdGUsICAgID09LCAweDY0KTsKKyAgZ19hc3NlcnRfY21waGV4IChpbnRlZ2VyMTYsID09LCAweDE1NDEpOworCisgIGdfcHRyX2FycmF5X3VucmVmIChiaWcpOworICBiaWcgPSBOVUxMOworCisgIC8qIC4uLm9yIHNldCB0byBOVUxMICovCisgIGdfb2JqZWN0X3NldCAoaG9seV9tb2xleSwgImJpZyIsIE5VTEwsIE5VTEwpOworICBnX29iamVjdF9nZXQgKGhvbHlfbW9sZXksICJiaWciLCAmYmlnLCBOVUxMKTsKKworICBnX2Fzc2VydCAoYmlnID09IE5VTEwpOworCisgIGdfb2JqZWN0X3VucmVmIChob2x5X21vbGV5KTsKK30KKworc3RhdGljIHZvaWQKK3Rlc3Rfc3RydWN0c19ob2x5X21vbGV5X3Byb3BlcnRpZXNfY29udGFpbiAodm9pZCkKK3sKKyAgc3RhdGljIGdjaGFyICpzdHJpbmdzWzJdID0geyAiQXBhY2hlIiwgIlRocmlmdCIgfTsKKworICBUVGVzdEhvbHlNb2xleSAqaG9seV9tb2xleTsKKyAgR0hhc2hUYWJsZSAqY29udGFpbiA9IE5VTEw7CisgIEdQdHJBcnJheSAqc3RyaW5nX2xpc3Q7CisgIEdMaXN0ICprZXlfbGlzdDsKKworICBob2x5X21vbGV5ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9IT0xZX01PTEVZLCBOVUxMKTsKKworICAvKiBBIEhvbHlNb2xleSdzICJjb250YWluIiBtZW1iZXIgaXMgaW5pdGlhbGl6ZWQgb24gY29uc3RydWN0aW9uICovCisgIGdfb2JqZWN0X2dldCAoaG9seV9tb2xleSwgImNvbnRhaW4iLCAmY29udGFpbiwgTlVMTCk7CisKKyAgZ19hc3NlcnQgKGNvbnRhaW4gIT0gTlVMTCk7CisgIGdf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ogLi4ucmVwbGFjZWQuLi4gKi8KKyAgY29udGFpbiA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19kaXJlY3RfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19kaXJlY3RfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChHRGVzdHJveU5vdGlmeSkgZ19wdHJfYXJyYXlfdW5yZWYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICBnX29iamVjdF9zZXQgKGhvbHlfbW9sZXksICJjb250YWluIiwgY29udGFpbiwgTlVMTCk7CisgIGdfaGFzaF90YWJsZV91bnJlZiAoY29udGFpbik7CisgIGNvbnRhaW4gPSBOVUxMOworCisgIGdfb2JqZWN0X2dldCAoaG9seV9tb2xleSwgImNvbnRhaW4iLCAmY29udGFpbiwgTlVMTCk7CisKKyAgZ19hc3NlcnRfY21waW50IChnX2hhc2hfdGFibGVfc2l6ZSAoY29udGFpbiksID09LCAwKTsKKworICBnX2hhc2hfdGFibGVfdW5yZWYgKGNvbnRhaW4pOworICBjb250YWluID0gTlVMTDsKKworICAvKiAuLi5vciBzZXQgdG8gTlVMTCAqLworICBnX29iamVjdF9zZXQgKGhvbHlfbW9sZXksICJjb250YWluIiwgTlVMTCwgTlVMTCk7CisgIGdfb2JqZWN0X2dldCAoaG9seV9tb2xleSwgImNvbnRhaW4iLCAmY29udGFpbiwgTlVMTCk7CisKKyAgZ19hc3NlcnQgKGNvbnRhaW4gPT0gTlVMTCk7CisKKyAgZ19vYmplY3RfdW5yZWYgKGhvbHlfbW9sZXkpOworfQorCitzdGF0aWMgdm9pZAordGVzdF9zdHJ1Y3RzX2hvbHlfbW9sZXlfcHJvcGVydGllc19ib25rcyAodm9pZCkKK3sKKyAgVFRlc3RIb2x5TW9sZXkgKmhvbHlfbW9sZXk7CisgIEdIYXNoVGFibGUgKmJvbmtzID0gTlVMTDsKKyAgR1B0ckFycmF5ICpib25rX2xpc3QgPSBOVUxMOworICBUVGVzdEJvbmsgKmJvbmsgPSBOVUxMOworICBnaW50IHR5cGU7CisgIGdjaGFyICptZXNzYWdlOworICBHTGlzdCAqa2V5X2xpc3Q7CisKKyAgaG9seV9tb2xleSA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfSE9MWV9NT0xFWSwgTlVMTCk7CisKKyAgLyogQSBIb2x5TW9sZXkncyAiYm9ua3MiIG1lbWJlciBpcyBpbml0aWFsaXplZCBvbiBjb25zdHJ1Y3Rpb24gKi8KKyAgZ19vYmplY3RfZ2V0IChob2x5X21vbGV5LCAiYm9ua3MiLCAmYm9ua3MsIE5VTEwpOworCisgIGdfYXNzZXJ0IChib25rcyAhPSBOVUxMKTsKKyAgZ19hc3NlcnRfY21waW50IChnX2hhc2hfdGFibGVfc2l6ZSAoYm9ua3MpLCA9PSwgMCk7CisKKyAgLyogSXQgY2FuIGJlIG1vZGlmaWVkLi4uICovCisgIGJvbmsgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX0JPTkssCisgICAgICAgICAgICAgICAgICAgICAgICJ0eXBlIiwgICAgMTAwLAorICAgICAgICAgICAgICAgICAgICAgICAibWVzc2FnZSIsICJTYW1wbGUgQm9uayIsCisgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICBib25rX2xpc3QgPSBnX3B0cl9hcnJheV9uZXdfd2l0aF9mcmVlX2Z1bmMgKGdfb2JqZWN0X3VucmVmKTsKKyAgZ19wdHJfYXJyYXlfYWRkIChib25rX2xpc3QsIGJvbmspOworICBib25rID0gTlVMTDsKKworICBnX2hhc2hfdGFibGVfaW5zZXJ0IChib25rcywgZ19zdHJkdXAgKCJTYW1wbGUgQm9ua3MiKSwgYm9ua19saXN0KTsKKyAgYm9ua19saXN0ID0gTlVMTDsKKworICBnX2hhc2hfdGFibGVfdW5yZWYgKGJvbmtzKTsKKyAgYm9ua3MgPSBOVUxMOworCisgIGdfb2JqZWN0X2dldCAoaG9seV9tb2xleSwgImJvbmtzIiwgJmJvbmtzLCBOVUxMKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKGdfaGFzaF90YWJsZV9zaXplIChib25rcyksID09LCAxKTsKKworICBrZXlfbGlzdCA9IGdfaGFzaF90YWJsZV9nZXRfa2V5cyAoYm9ua3MpOworICBib25rX2xpc3QgPSBnX2hhc2hfdGFibGVfbG9va3VwIChib25rcywgZ19saXN0X250aF9kYXRhIChrZXlfbGlzdCwgMCkpOworCisgIGdfYXNzZXJ0X2NtcGludCAoYm9ua19saXN0LT5sZW4sID09LCAxKTsKKworICBib25rID0gKGdfcHRyX2FycmF5X2luZGV4IChib25rX2xpc3QsIDApKTsKKyAgZ19vYmplY3RfZ2V0IChib25rLAorICAgICAgICAgICAgICAgICJ0eXBlIiwgICAgJnR5cGUsCisgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCAmbWVzc2FnZSwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBnX2Fzc2VydF9jbXBpbnQgKHR5cGUsID09LCAxMDApOworICBnX2Fzc2VydF9jbXBzdHIgKG1lc3NhZ2UsID09LCAiU2FtcGxlIEJvbmsiKTsKKworICBib25rID0gTlVMTDsKKyAgZ19mcmVlIChtZXNzYWdlKTsKKyAgZ19saXN0X2ZyZWUgKGtleV9saXN0KTsKKyAgZ19oYXNoX3RhYmxlX3VucmVmIChib25rcyk7CisgIGJvbmtzID0gTlVMTDsKKworICAvKiAuLi5yZXBsYWNlZC4uLiAqLworICBib25rcyA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19zdHJfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfc3RyX2VxdWFsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19mcmVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEdEZXN0cm95Tm90aWZ5KSBnX3B0cl9hcnJheV91bnJlZik7CisgIGdfb2JqZWN0X3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WFsaXplZCBkdXJpbmcgY29uc3RydWN0aW9uICovCisgIGdfb2JqZWN0X2dldCAod3JhcHBlciwgImZvbyIsICZmb28sIE5VTEwpOworCisgIGdfYXNzZXJ0IChmb28gIT0gTlVMTCk7CisgIGdfYXNzZXJ0IChUX1RFU1RfSVNfRU1QVFkgKGZvbykpOworCisgIGdfb2JqZWN0X3VucmVmIChmb28pOworICBmb28gPSBOVUxMOworCisgIC8qIEEgV3JhcHBlcidzIGZvbyBwcm9wZXJ0eSBjYW4gYmUgcmVwbGFjZWQuLi4gKi8KKyAgZm9vID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9FTVBUWSwgTlVMTCk7CisgIGdfb2JqZWN0X3NldCAod3JhcHBlciwgImZvbyIsIGZvbywgTlVMTCk7CisKKyAgZ19vYmplY3RfdW5yZWYgKGZvbyk7CisgIGZvbyA9IE5VTEw7CisKKyAgZ19vYmplY3RfZ2V0ICh3cmFwcGVyLCAiZm9vIiwgJmZvbywgTlVMTCk7CisgIGdfYXNzZXJ0IChmb28gIT0gTlVMTCk7CisgIGdfYXNzZXJ0IChUX1RFU1RfSVNfRU1QVFkgKGZvbykpOworCisgIGdfb2JqZWN0X3VucmVmIChmb28pOworICBmb28gPSBOVUxMOworCisgIC8qIC4uLm9yIHNldCB0byBOVUxMICovCisgIGdfb2JqZWN0X3NldCAod3JhcHBlciwgImZvbyIsIE5VTEwsIE5VTEwpOworICBnX29iamVjdF9nZXQgKHdyYXBwZXIsICJmb28iLCAmZm9vLCBOVUxMKTsKKworICBnX2Fzc2VydCAoZm9vID09IE5VTEwpOworCisgIGdfb2JqZWN0X3VucmVmICh3cmFwcGVyKTsKK30KKworc3RhdGljIHZvaWQKK3Rlc3Rfc2VydmljZXNfaW5oZXJpdGVkICh2b2lkKQoreworICBUaHJpZnRQcm90b2NvbCAqcHJvdG9jb2w7CisgIFRUZXN0SW5oZXJpdGVkQ2xpZW50ICppbmhlcml0ZWRfY2xpZW50OworICBHT2JqZWN0ICppbnB1dF9wcm90b2NvbCwgKm91dHB1dF9wcm90b2NvbDsKKworICBwcm90b2NvbCA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQklOQVJZX1BST1RPQ09MLCBOVUxMKTsKKyAgaW5oZXJpdGVkX2NsaWVudCA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfSU5IRVJJVEVEX0NMSUVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgLyogVFRlc3RJbmhlcml0ZWRDbGllbnQgaW5oZXJpdHMgZnJvbSBUVGVzdFNydkNsaWVudCAqLworICBnX2Fzc2VydCAoZ190eXBlX2lzX2EgKFRfVEVTVF9UWVBFX0lOSEVSSVRFRF9DTElFTlQsCisgICAgICAgICAgICAgICAgICAgICAgIFRfVEVTVF9UWVBFX1NSVl9DTElFTlQpKTsKKworICAvKiBUVGVzdEluaGVyaXRlZENsaWVudCBpbXBsZW1lbnRzIFRUZXN0U3J2Q2xpZW50J3MgaW50ZXJmYWNlICovCisgIGdfYXNzZXJ0IChnX3R5cGVfaXNfYSAoVF9URVNUX1RZUEVfSU5IRVJJVEVEX0NMSUVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgVF9URVNUX1RZUEVfU1JWX0lGKSk7CisKKyAgLyogVFRlc3RJbmhlcml0ZWRDbGllbnQncyBpbmhlcml0ZWQgcHJvcGVydGllcyBjYW4gYmUgc2V0IGFuZCByZXRyaWV2ZWQgKi8KKyAgZ19vYmplY3Rfc2V0IChpbmhlcml0ZWRfY2xpZW50LAorICAgICAgICAgICAgICAgICJpbnB1dF9wcm90b2NvbCIsIHByb3RvY29sLAorICAgICAgICAgICAgICAgICJvdXRwdXRfcHJvdG9jb2wiLCBwcm90b2NvbCwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBnX29iamVjdF9nZXQgKGluaGVyaXRlZF9jbGllbnQsCisgICAgICAgICAgICAgICAgImlucHV0X3Byb3RvY29sIi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+cGVlayAodHJhbnNwb3J0LCAmZXJyb3IpKTsKKworICAvKiBhbHJlYWR5IGNsb3NlZCAqLworICBnX2Fzc2VydCAoY2xvc2UgKGZkKSAhPSAwKTsKKyAgZ19hc3NlcnQgKGVycm5vID09IEVCQURGKTsKKworICBnX29iamVjdF91bnJlZiAodHJhbnNwb3J0KTsKKworICBnX3JlbW92ZSAoZmlsZW5hbWUpOworICBnX2ZyZWUgKGZpbGVuYW1lKTsKKworICAvKiB0ZXN0IGJhZCBmZCAqLworICB0cmFuc3BvcnQgPSBUSFJJRlRfVFJBTlNQT1JUIChnX29iamVjdF9uZXcgKFRIUklGVF9UWVBFX0ZEX1RSQU5TUE9SVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZmQiLCAtMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSk7CisgIGtsYXNzID0gVEhSSUZUX1RSQU5TUE9SVF9HRVRfQ0xBU1MgKHRyYW5zcG9ydCk7CisKKyAgZ19hc3NlcnQgKCEga2xhc3MtPmlzX29wZW4gKHRyYW5zcG9ydCkpOworICBlcnJvciA9IE5VTEw7CisgIGdfYXNzZXJ0ICghIGtsYXNzLT5wZWVrICh0cmFuc3BvcnQsICZlcnJvcikpOworICBlcnJvciA9IE5VTEw7CisgIGdfYXNzZXJ0ICghIGtsYXNzLT5vcGVuICh0cmFuc3BvcnQsICZlcnJvcikpOworICBlcnJvciA9IE5VTEw7CisgIGdfYXNzZXJ0ICghIGtsYXNzLT5jbG9zZSAodHJhbnNwb3J0LCAmZXJyb3IpKTsKKworICBnX29iamVjdF91bnJlZiAodHJhbnNwb3J0KTsKK30KKworc3RhdGljIHZvaWQKK3Rlc3RfcmVhZF9hbmRfd3JpdGUgKHZvaWQpCit7CisgIGdjaGFyIG91dF9idWZbOF07CisgIGdjaGFyICpiOworICBnaW50IHdhbnQsIGdvdDsKKyAgVGhyaWZ0VHJhbnN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TlNQT1JUIChnX29iamVjdF9uZXcgKFRIUklGVF9UWVBFX0ZEX1RSQU5TUE9SVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZmQiLCBmZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKSk7CisgIGtsYXNzID0gVEhSSUZUX1RSQU5TUE9SVF9HRVRfQ0xBU1MgKHRyYW5zcG9ydCk7CisKKyAgbWVtc2V0KG91dF9idWYsIDAsIDgpOworICBiID0gb3V0X2J1ZjsKKyAgd2FudCA9IDc7CisgIHdoaWxlICh3YW50ID4gMCkgeworICAgIGdvdCA9IGtsYXNzLT5yZWFkICh0cmFuc3BvcnQsIChncG9pbnRlcikgYiwgd2FudCwgJmVycm9yKTsKKyAgICBnX2Fzc2VydCAoZ290ID4gMCAmJiBnb3QgPD0gd2FudCk7CisgICAgYiArPSBnb3Q7CisgICAgd2FudCAtPSBnb3Q7CisgIH0KKyAgZ19hc3NlcnQgKG1lbWNtcCAob3V0X2J1ZiwgVEVTVF9EQVRBLCA3KSA9PSAwKTsKKworICBtZW1zZXQob3V0X2J1ZiwgMCwgOCk7CisgIGIgPSBvdXRfYnVmOworICB3YW50ID0gNDsKKyAgd2hpbGUgKHdhbnQgPiAwKSB7CisgICAgZ290ID0ga2xhc3MtPnJlYWQgKHRyYW5zcG9ydCwgKGdwb2ludGVyKSBiLCB3YW50LCAmZXJyb3IpOworICAgIGdfYXNzZXJ0IChnb3QgPiAwICYmIGdvdCA8PSB3YW50KTsKKyAgICBiICs9IGdvdDsKKyAgICB3YW50IC09IGdvdDsKKyAgfQorICBnX2Fzc2VydCAobWVtY21wIChvdXRfYnVmLCBURVNUX0RBVEEgKyA3LCA0KSA9PSAwKTsKKworICBnX2Fzc2VydCAoa2xhc3MtPmNsb3NlICh0cmFuc3BvcnQsICZlcnJvcikpOworICBnX29iamVjdF91bnJlZiAodHJhbnNwb3J0KTsKKworICAvKi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KGdwb2ludGVyKSBidWYsIDEwLCAmZXJyb3IpID09IFRSVUUpOwotICBhc3NlcnQgKGVycm9yID09IE5VTEwpOworICBnX2Fzc2VydCAodGhyaWZ0X21lbW9yeV9idWZmZXJfd3JpdGUgKFRIUklGVF9UUkFOU1BPUlQgKHRidWZmZXIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ3BvaW50ZXIpIFRFU1RfREFUQSwgMTAsICZlcnJvcikgPT0gVFJVRSk7CisgIGdfYXNzZXJ0IChlcnJvciA9PSBOVUxMKTsKIAotICBhc3NlcnQgKHRocmlmdF9tZW1vcnlfYnVmZmVyX3JlYWQgKFRIUklGVF9UUkFOU1BPUlQgKHRidWZmZXIpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZWFkLCAxMCwgJmVycm9yKSA+IDApOwotICBhc3NlcnQgKGVycm9yID09IE5VTEwpOworICBtZW1zZXQocmVhZCwgMCwgMTApOworICBiID0gcmVhZDsKKyAgd2FudCA9IDEwOworICB3aGlsZSAod2FudCA+IDApIHsKKyAgICBnb3QgPSB0aHJpZnRfbWVtb3J5X2J1ZmZlcl9yZWFkIChUSFJJRlRfVFJBTlNQT1JUICh0YnVmZmVyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ3BvaW50ZXIpIGIsIHdhbnQsICZlcnJvcik7CisgICAgZ19hc3NlcnQgKGdvdCA+IDAgJiYgZ290IDw9IHdhbnQpOworICAgIGdfYXNzZXJ0IChlcnJvciA9PSBOVUxMKTsKKyAgICBiICs9IGdvdDsKKyAgICB3YW50IC09IGdvdDsKKyAgfQorICBnX2Fzc2VydCAobWVtY21wIChyZWFkLCBURVNUX0RBVEEsIDEwKSA9PSAwKTsKKyAgZ19vYmplY3RfdW5yZWYgKHRidWZmZXIpOworfQorCitzdGF0aWMgdm9pZAordGVzdF9yZWFkX2FuZF93cml0ZV9kZWZhdWx0ICh2b2lkKQoreworICBUaHJpZnRNZW1vcnlCdWZmZXIgKnRidWZmZXIgPSBOVUxMOworICBnaW50IGdvdCwgd2FudCwgaTsKKyAgZ2NoYXIgcmVhZFsxMF07CisgIGdjaGFyICpiOworICBHRXJyb3IgKmVycm9yID0gTlVMTDsKKworICB0YnVmZmVyID0gZ19vYmplY3RfbmV3IChUSFJJRlRfVFlQRV9NRU1PUllfQlVGRkVSLCBOVUxMKTsKKyAgZm9yIChpID0gMDsgaSA8IDEwMDsgKytpKSB7CisgICAgZ19hc3NlcnQgKHRocmlmdF9tZW1vcnlfYnVmZmVyX3dyaXRlIChUSFJJRlRfVFJBTlNQT1JUICh0YnVmZmVyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ3BvaW50ZXIpIFRFU1RfREFUQSwgMTAsICZlcnJvcikgPT0gVFJVRSk7CisgICAgZ19hc3NlcnQgKGVycm9yID09IE5VTEwpOworICB9CisKKyAgZm9yIChpID0gMDsgaSA8IDEwMDsgKytpKSB7CisgICAgbWVtc2V0KHJlYWQsIDAsIDEwKTsKKyAgICBiID0gcmVhZDsKKyAgICB3YW50ID0gMTA7CisgICAgd2hpbGUgKHdhbnQgPiAwKSB7CisgICAgICBnb3QgPSB0aHJpZnRfbWVtb3J5X2J1ZmZlcl9yZWFkIChUSFJJRlRfVFJBTlNQT1JUICh0YnVmZmVyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChncG9pbnRlcikgYiwgd2FudCwgJmVycm9yKTsKKyAgICAgIGdfYXNzZXJ0IChnb3QgPiAwICYmIGdvdCA8PSB3YW50KTsKKyAgICAgIGdfYXNzZXJ0IChlcnJvciA9PSBOVUxMKTsKKyAgICAgIGIgKz0gZ290OworICAgICAgd2FudCAtPSBnb3Q7CisgICAgfQorICAgIGdfYXNzZXJ0IChtZW1jbXAgKHJlYWQsIFRFU1RfREFUQSwgMTApID09IDApOworICB9CisgIGdfb2JqZWN0X3VucmVmICh0YnVmZmVy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5pc3RkLmg+CkBAIC01MSw4ICs1MCwxMyBAQAogCiBnYm9vbGVhbgogdGVzdF9wcm9jZXNzb3JfcHJvY2VzcyAoVGhyaWZ0UHJvY2Vzc29yICpwcm9jZXNzb3IsIFRocmlmdFByb3RvY29sICppbiwKLSAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFByb3RvY29sICpvdXQpCisgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRQcm90b2NvbCAqb3V0LCBHRXJyb3IgKiplcnJvcikKIHsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKHByb2Nlc3Nvcik7CisgIFRIUklGVF9VTlVTRURfVkFSIChpbik7CisgIFRIUklGVF9VTlVTRURfVkFSIChvdXQpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCiAgIHJldHVybiBGQUxTRTsKIH0KIApAQCAtODQsMTEgKzg4LDEyIEBACiAKICAgLyogcnVuIHRoZSBzZXJ2ZXIgaW4gYSBjaGlsZCBwcm9jZXNzICovCiAgIHBpZCA9IGZvcmsgKCk7Ci0gIGFzc2VydCAocGlkID49IDApOworICBnX2Fzc2VydCAocGlkID49IDApOwogCiAgIGlmIChwaWQgPT0gMCkKICAgewotICAgIFRIUklGVF9TRVJWRVJfR0VUX0NMQVNTIChUSFJJRlRfU0VSVkVSIChzcykpLT5zZXJ2ZSAoVEhSSUZUX1NFUlZFUiAoc3MpKTsKKyAgICBUSFJJRlRfU0VSVkVSX0dFVF9DTEFTUyAoVEhSSUZUX1NFUlZFUiAoc3MpKS0+c2VydmUgKFRIUklGVF9TRVJWRVIgKHNzKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOwogICAgIGV4aXQgKDApOwogICB9IGVsc2UgewogICAgIHNsZWVwICg1KTsKQEAgLTk3LDE1ICsxMDIsMTggQEAKICAgICBnX29iamVjdF91bnJlZiAoc3MpOwogICAgIGdfb2JqZWN0X3VucmV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F9UWVBFX0lOU0FOSVRZLCBOVUxMKTsKKyAgZ19vYmplY3RfZ2V0IChhcmd1bWVudCwKKyAgICAgICAgICAgICAgICAidXNlck1hcCIsICZ1c2VyX21hcCwKKyAgICAgICAgICAgICAgICAieHRydWN0cyIsICZ4dHJ1Y3RzLAorICAgICAgICAgICAgICAgIE5VTEwpOworCisgIG51bWJlcnogPSBUX1RFU1RfTlVNQkVSWl9GSVZFOworICBudW1iZXJ6MiA9IFRfVEVTVF9OVU1CRVJaX0VJR0hUOworICB1c2VyX2lkX3B0ciA9IGdfbWFsbG9jIChzaXplb2YgKnVzZXJfaWRfcHRyKTsKKyAgKnVzZXJfaWRfcHRyID0gNTsKKyAgdXNlcl9pZF9wdHIyID0gZ19tYWxsb2MgKHNpemVvZiAqdXNlcl9pZF9wdHIpOworICAqdXNlcl9pZF9wdHIyID0gODsKKyAgZ19oYXNoX3RhYmxlX2luc2VydCAodXNlcl9tYXAsIChncG9pbnRlciludW1iZXJ6LCB1c2VyX2lkX3B0cik7CisgIGdfaGFzaF90YWJsZV9pbnNlcnQgKHVzZXJfbWFwLCAoZ3BvaW50ZXIpbnVtYmVyejIsIHVzZXJfaWRfcHRyMik7CisgIGdfaGFzaF90YWJsZV91bnJlZiAodXNlcl9tYXApOworCisgIHh0cnVjdCA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfWFRSVUNULAorICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAiSGVsbG8yIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAiaTMyX3RoaW5nIiwgICAgMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgMkxMLAorICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICB4dHJ1Y3QyID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YVFJVQ1QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAiR29vZGJ5ZTQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgNCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgIDQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJpNjRfdGhpbmciLCAgICA0TEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICBnX3B0cl9hcnJheV9hZGQgKHh0cnVjdHMsIHh0cnVjdDIpOworICBnX3B0cl9hcnJheV9hZGQgKHh0cnVjdHMsIHh0cnVjdCk7CisgIGdfcHRyX2FycmF5X3VucmVmICh4dHJ1Y3RzKTsKKworICBfcmV0dXJuID0gZ19oYXNoX3RhYmxlX25ld19mdWxsIChnX2ludDY0X2hhc2gsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfaW50NjRfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEdEZXN0cm95Tm90aWZ5KWdfaGFzaF90YWJsZV91bnJlZik7CisKKyAgZ19vYmplY3Rfd2Vha19yZWYgKEdfT0JKRUNUIChhcmd1bWVudCksIHNldF9pbmRpY2F0b3IsIChncG9pbnRlcikgJmluZGljYXRvcik7CisKKyAgZ19hc3NlcnQgKHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9pbnNhbml0eSAoTlVMTCwgJl9yZXR1cm4sIGFyZ3VtZW50LCAmZXJyb3IpKTsKKyAgZ19hc3NlcnQgKCEgaW5kaWNhdG9yKTsKKworICBnX2hhc2hfdGFibGVfdW5yZWYgKF9yZXR1cm4pOworICBnX2Fzc2VydCAoISBpbmRpY2F0b3IpOworCisgIGdfb2JqZWN0X3VucmVmIChhcmd1bWVudCk7CisgIGdfYXNzZXJ0IChpbmRpY2F0b3IpOworfQorC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ICAgICAgKHZlcnNpb24gKGNhc3NhbmRyYTpkZXNjcmliZS12ZXJzaW9uIGNhc3NhbmRyYSkpCisgICAgICAgICAgIChrZXlzcGFjZS1kZXNjcmlwdGlvbnMgKGxvb3AgZm9yIHNwYWNlIGluIGtleXNwYWNlLW5hbWVzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sbGVjdCAoY29ucyBzcGFjZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGxvb3AgZm9yIGtleSBiZWluZyBlYWNoIGhhc2gta2V5CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZiAoY2Fzc2FuZHJhOmRlc2NyaWJlLWtleXNwYWNlIGNhc3NhbmRyYSBzcGFjZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzaW5nIChoYXNoLXZhbHVlIHZhbHVlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sbGVjdCAoY29ucyBrZXkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGxvb3AgZm9yIGtleSBiZWluZyBlYWNoIGhhc2gta2V5IG9mIHZhbHVlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzaW5nIChoYXNoLXZhbHVlIHZhbHVlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0IChjb25zIGtleSB2YWx1ZSkpKSkpKSkpCisgICAgICAoZm9ybWF0IHN0cmVhbSAifiZjb25uZWN0aW9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CisgICAgYnJlYWs7CisgIH0KKworICBOU0RpY3Rpb25hcnkgKnVzZXJJbmZvOworICBpZiAocmVhc29uKSB7CisgICAgdXNlckluZm8gPSBAe1RBcHBsaWNhdGlvbkVycm9yTmFtZUtleTpuYW1lLAorICAgICAgICAgICAgICAgICBUQXBwbGljYXRpb25FcnJvclJlYXNvbktleTpyZWFzb259OworICB9CisgIGVsc2UgeworICAgIHVzZXJJbmZvID0gQHtUQXBwbGljYXRpb25FcnJvck5hbWVLZXk6bmFtZX07CisgIH0KKworICByZXR1cm4gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRBcHBsaWNhdGlvbkVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6dHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOnVzZXJJbmZvXTsKK30KKworCisrKGluc3RhbmNldHlwZSkgcmVhZDooaWQ8VFByb3RvY29sPilwcm90b2NvbAoreworICBOU1N0cmluZyAqcmVhc29uID0gbmlsOworICBTSW50MzIgdHlwZSA9IFRBcHBsaWNhdGlvbkVycm9yVW5rbm93bjsKKyAgU0ludDMyIGZpZWxkVHlwZTsKKyAgU0ludDMyIGZpZWxkSUQ7CisKKyAgTlNFcnJvciAqZXJyb3I7CisgIGlmICghW3Byb3RvY29sIHJlYWRTdHJ1Y3RCZWdpblJldHVybmluZ05hbWU6TlVMTCBlcnJvcjomZXJyb3JdKSB7CisgICAgcmV0dXJuIGVycm9yOworICB9CisKKyAgd2hpbGUgKHRydWUpIHsKKworICAgIGlmICghW3Byb3RvY29sIHJlYWRGaWVsZEJlZ2luUmV0dXJuaW5nTmFtZTpOVUxMCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiZmaWVsZFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkSUQ6JmZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6JmVycm9yXSkKKyAgICB7CisgICAgICByZXR1cm4gZXJyb3I7CisgICAgfQorCisgICAgaWYgKGZpZWxkVHlwZSA9PSBUVHlwZVNUT1ApIHsKKyAgICAgIGJyZWFrOworICAgIH0KKworICAgIHN3aXRjaCAoZmllbGRJRCkgeworICAgIGNhc2UgMToKKyAgICAgIGlmIChmaWVsZFR5cGUgPT0gVFR5cGVTVFJJTkcpIHsKKyAgICAgICAgaWYgKCFbcHJvdG9jb2wgcmVhZFN0cmluZzomcmVhc29uIGVycm9yOiZlcnJvcl0pIHsKKyAgICAgICAgICByZXR1cm4gZXJyb3I7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBpZiAoIVtUUHJvdG9jb2xVdGlsIHNraXBUeXBlOmZpZWxkVHlwZSBvblByb3RvY29sOnByb3RvY29sIGVycm9yOiZlcnJvcl0pIHsKKyAgICAgICAgICByZXR1cm4gZXJyb3I7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGJyZWFrOworCisgICAgY2FzZSAyOgorICAgICAgaWYgKGZpZWxkVHlwZSA9PSBUVHlwZUkzMikgeworICAgICAgICBpZiAoIVtwcm90b2NvbCByZWFkSTMyOiZ0eXBlIGVycm9yOiZlcnJvcl0pIHsKKyAgICAgICAgICByZXR1cm4gZXJyb3I7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBpZiAoIVtUUHJvdG9jb2xVdGlsIHNraXBUeXBlOmZpZWxkVHlwZSBvblByb3RvY29sOnByb3RvY29sIGVycm9yOiZlcnJvcl0pIHsKKyAgICAgICAgICByZXR1cm4gZXJyb3I7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGJyZWFrOworCisgICAgZGVmYXVsdDoKKyAgICAgIGlmICghW1RQcm90b2NvbFV0aWwgc2tpcFR5cGU6ZmllbGRUeXBlIG9uUHJvdG9jb2w6cHJvdG9jb2wgZXJyb3I6JmVycm9yXSkgeworICAgICAgICByZXR1cm4gZXJyb3I7CisgICAgICB9CisgICAgICBicmVhazsKKyAgICB9CisgICAgaWYgKCFbcHJvdG9jb2wgcmVhZEZpZWxkRW5kOiZlcnJvcl0pIHsKKyAgICAgIHJldHVybiBlcnJvcjsKKyAgICB9CisKKyAgfQorCisgIGlmICghW3Byb3RvY29sIHJlYWRTdHJ1Y3RFbmQ6JmVycm9yXSkgeworICAgIHJldHVybiBlcnJvcjsKKyAgfQorCisgIHJldHVybiBbTlNFcnJvciBlcnJvcldpdGhUeXBlOnR5cGUgcmVhc29uOnJlYXNvbl07Cit9CisKKworLShCT09MKSB3cml0ZTooaWQ8VFByb3RvY29sPilwcm90b2NvbCBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgaWYgKCFbcHJvdG9jb2wgd3JpdGVTdHJ1Y3RCZWdpbldpdGhOYW1lOkAiVEFwcGxpY2F0aW9uRXhjZXB0aW9uIiBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKworICBpZiAoc2VsZi5sb2NhbGl6ZWREZXNjcmlwdGlvbiAhPSBuaWwpIHsKKyAgICBpZiAoIVtwcm90b2NvbCB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTpAIm1lc3NhZ2UiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6VFR5cGVTVFJJTkcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDoxIGVycm9yOmVycm9yXSkKKyAgICB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorCisgICAgaWYgKCFbcHJvdG9jb2wgd3JpdGVTdHJpbmc6c2VsZi5sb2NhbGl6ZWREZXNjcmlwdGlvbiBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisKKyAgICBpZiAoIVtwcm90b2NvbCB3cml0ZUZpZWxkRW5kOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKyAgfQorCisgIGlmICghW3Byb3RvY29sIHdyaXRlRmllbGRCZWdpbldpdGhOYW1lOkAidHlwZSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6VFR5cGVJMzIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkSUQ6MgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjplcnJvcl0pCisgIHsKKyAgICByZXR1cm4gTk87CisgIH0KKworICBpZiAoIVtwcm90b2NvbCB3cml0ZUkzMjooU0ludDMyKXNlbGYuY29kZSBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKworICBpZiAoIVtwcm90b2NvbCB3cml0ZUZpZWxkRW5kOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIGlmICghW3Byb3RvY29sIHdyaXRlRmllbGRTdG9wOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIGlmICghW3Byb3RvY29sIHdyaXRlU3RydWN0RW5kOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIHJldHVybiBZRVM7Cit9CisKK0BlbmQKZGlmZiAtLWdpdCBhL2xpYi9jb2NvYS9zcmMvVEFwcGxpY2F0aW9uRXhjZXB0aW9uLmggYi9saWIvY29jb2Evc3JjL1RBcHBsaWNhdGlvbkV4Y2VwdGlvbi5oCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCA3YjAyN2Q2Li4wMDAwMDAwCi0tLSBhL2xpYi9jb2NvYS9zcmMvVEFwcGxpY2F0aW9uRXhjZXB0aW9uLmgKKysrIC9kZXYvbnVsbApAQCAtMSw0OSArMCwwIEBACi0vKgotICogTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQot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G9tYWluOiBUUHJvdG9jb2xFcnJvckRvbWFpbiwKKyAgICAgICAgY29kZTogSW50KFRQcm90b2NvbEVycm9yLlVua25vd24ucmF3VmFsdWUpLAorICAgICAgICB1c2VySW5mbzogW1RQcm90b2NvbEVycm9yRmllbGROYW1lS2V5OiBuYW1lXSkKKyAgICB9CisgICAgCisgIH0KKyAgCisgIHB1YmxpYyBmdW5jIHJlYWRFeGNlcHRpb24oKSB0aHJvd3MgLT4gRXJyb3JUeXBlIHsKKyAgICAKKyAgICB2YXIgcmVhc29uIDogU3RyaW5nPworICAgIHZhciB0eXBlID0gVEFwcGxpY2F0aW9uRXJyb3IuVW5rbm93bgorICAgIAorICAgIHRyeSByZWFkU3RydWN0QmVnaW4oKQorICAgIAorICAgIGZpZWxkczogd2hpbGUgKHRydWUpIHsKKyAgICAgIAorICAgICAgbGV0IChfLCBmaWVsZFR5cGUsIGZpZWxkSUQpID0gdHJ5IHJlYWRGaWVsZEJlZ2luKCkKKyAgICAgIAorICAgICAgc3dpdGNoIChmaWVsZElELCBmaWVsZFR5cGUpIHsKKyAgICAgIGNhc2UgKF8sIC5TVE9QKToKKyAgICAgICAgYnJlYWsgZmllbGRzCisgICAgICAgIAorICAgICAgY2FzZSAoMSwgLlNUUklORyk6CisgICAgICAgIHJlYXNvbiA9IHRyeSByZWFkVmFsdWUoKSBhcyBTdHJpbmcKKyAgICAgICAgCisgICAgICBjYXNlICgyLCAuSTMyKToKKyAgICAgICAgbGV0IHR5cGVWYWwgPSB0cnkgcmVhZFZhbHVlKCkgYXMgSW50MzIKKyAgICAgICAgaWYgbGV0IHRtcCA9IFRBcHBsaWNhdGlvbkVycm9yKHJhd1ZhbHVlOiB0eXBlVmFsKSB7CisgICAgICAgICAgdHlwZSA9IHRtcAorICAgICAgICB9CisgICAgICAgIAorICAgICAgY2FzZSBsZXQgKF8sIHVua25vd25UeXBlKToKKyAgICAgICAgdHJ5IHNraXBUeXBlKHVua25vd25UeXBlKQorICAgICAgfQorICAgIC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6KE5TU3RyaW5nICoqKW5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6KFNJbnQzMiAqKXR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6KFNJbnQzMiAqKXNlcXVlbmNlSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCiB7Ci0gIGludDMyX3Qgc2l6ZSA9IFtzZWxmIHJlYWRJMzJdOworICBTSW50MzIgc2l6ZTsKKyAgaWYgKCFbc2VsZiByZWFkSTMyOiZzaXplIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorICA7CisKICAgaWYgKHNpemUgPCAwKSB7CiAgICAgaW50IHZlcnNpb24gPSBzaXplICYgVkVSU0lPTl9NQVNLOwogICAgIGlmICh2ZXJzaW9uICE9IFZFUlNJT05fMSkgewotICAgICAgQHRocm93IFtUUHJvdG9jb2xFeGNlcHRpb24gZXhjZXB0aW9uV2l0aE5hbWU6IEAiVFByb3RvY29sRXhjZXB0aW9uIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhc29uOiBAIkJhZCB2ZXJzaW9uIGluIHJlYWRNZXNzYWdlQmVnaW4iXTsKKyAgICAgIFBST1RPQ09MX0VSUk9SKE5PLCBCYWRWZXJzaW9uLCBAIkJhZCBtZXNzYWdlIHZlcnNpb24iKTsKICAgICB9CiAgICAgaWYgKHR5cGUgIT0gTlVMTCkgewogICAgICAgKnR5cGUgPSBzaXplICYgMHgwMEZGOwogICAgIH0KLSAgICBOU1N0cmluZyAqIG1lc3NhZ2VOYW1lID0gW3NlbGYgcmVhZFN0cmluZ107CisgICAgTlNTdHJpbmcgKm1lc3NhZ2VOYW1lOworICAgIGlmICghW3NlbGYgcmVhZFN0cmluZzombWVzc2FnZU5hbWUgZXJyb3I6ZXJyb3JdKSB7CisgICAg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Byb3RvY29sRXhjZXB0aW9uIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhc29uOiBAIk1pc3NpbmcgdmVyc2lvbiBpbiByZWFkTWVzc2FnZUJlZ2luLCBvbGQgY2xpZW50PyJdOwotICAgIH0KLSAgICBpZiAoW3NlbGYgbWVzc2FnZVNpemVMaW1pdF0gPiAwICYmIHNpemUgPiBbc2VsZiBtZXNzYWdlU2l6ZUxpbWl0XSkgewotICAgICAgQHRocm93IFtUUHJvdG9jb2xFeGNlcHRpb24gZXhjZXB0aW9uV2l0aE5hbWU6IEAiVFByb3RvY29sRXhjZXB0aW9uIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb246IFtOU1N0cmluZyBzdHJpbmdXaXRoRm9ybWF0OiBAIk1lc3NhZ2UgdG9vIGJpZy4gIFNpemUgbGltaXQgaXM6ICVkIE1lc3NhZ2Ugc2l6ZSBpczogJWQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWVzc2FnZVNpemVMaW1pdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV1dOwotICAgIH0KLSAgICBOU1N0cmluZyAqIG1lc3NhZ2VOYW1lID0gW3NlbGYgcmVhZFN0cmluZ0JvZHk6IHNpemVdOwotICAgIGlmIChuYW1lICE9IE5VTEwpIHsKLSAgICAgICpuYW1lID0gbWVzc2FnZU5hbWU7Ci0gICAgfQotICAgIGludCBtZXNzYWdlVHlwZSA9IFtzZWxmIHJlYWRCeXRlXTsKKwogICAgIGlmICh0eXBlICE9IE5VTEwpIHsKICAgICAgICp0eXBlID0gbWVzc2FnZVR5cGU7CiAgICAgfQotICAgIGludCBzZXFJRCA9IFtzZWxmIHJlYWRJMzJdOwotICAgIGlmIChzZXF1ZW5jZUlEICE9IE5VTEwpIHsKLSAgICAgICpzZXF1ZW5jZUlEID0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HJldHVybiBZRVM7Cit9CisKKworLShCT09MKSByZWFkRmllbGRCZWdpblJldHVybmluZ05hbWU6KE5TU3RyaW5nICpfX2F1dG9yZWxlYXNpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyICopZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDooU0ludDMyICopZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIGlmIChuYW1lICE9IG5pbCkgewogICAgICpuYW1lID0gbmlsOwogICB9Ci0gIGludCBmdCA9IFtzZWxmIHJlYWRCeXRlXTsKKworICBVSW50OCBmdDsKKyAgaWYgKCFbc2VsZiByZWFkQnl0ZTomZnQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CiAgIGlmIChmaWVsZFR5cGUgIT0gTlVMTCkgewogICAgICpmaWVsZFR5cGUgPSBmdDsKICAgfQotICBpZiAoZnQgIT0gVFR5cGVfU1RPUCkgewotICAgIGludCBmaWQgPSBbc2VsZiByZWFkSTE2XTsKKyAgaWYgKGZ0ICE9IFRUeXBlU1RPUCkgeworICAgIFNJbnQxNiBmaWQ7CisgICAgaWYgKCFbc2VsZiByZWFkSTE2OiZmaWQgZXJyb3I6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQogICAgIGlmIChmaWVsZElEICE9IE5VTEwpIHsKICAgICAgICpmaWVsZElEID0gZmlkOwogICAgIH0KICAgfQorICByZXR1cm4gWUVTOwogfQogCiAKLS0gKHZvaWQpIHJlYWRGaWVsZEVuZCB7fQotCi0KLS0gKGludDMyX3QpIHJlYWRJMzIKKy0oQk9PTCkgcmVhZEZpZWxkRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgogewotICB1aW50OF90IGkzMnJkWzRdOw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xlZCIpOworICB9CisKKyAgKnZhbHVlID0gYnVmZlswXTsKKworICByZXR1cm4gWUVTOworfQorCisKKy0oQk9PTCkgcmVhZEkxNjooU0ludDE2ICopdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIFVJbnQ4IGJ1ZmZbMl07CisgIGlmICghW190cmFuc3BvcnQgcmVhZEFsbDpidWZmIG9mZnNldDowIGxlbmd0aDoyIGVycm9yOmVycm9yXSkgeworICAgIFBST1RPQ09MX1RSQU5TUE9SVF9FUlJPUihOTywgZXJyb3IsIEAiVHJhbnNwb3J0IHJlYWQgZmFpbGVkIik7CisgIH0KKworICAqdmFsdWUgPQorICAgICgoU0ludDE2KShidWZmWzBdICYgMHhmZikgPDwgOCkgfAorICAgICgoU0ludDE2KShidWZmWzFdICYgMHhmZikpOworCisgIHJldHVybiBZRVM7Cit9CisKKworLShCT09MKSByZWFkSTMyOihTSW50MzIgKil2YWx1ZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDggaTMycmRbNF07CisgIGlmICghW190cmFuc3BvcnQgcmVhZEFsbDppMzJyZCBvZmZzZXQ6MCBsZW5ndGg6NCBlcnJvcjplcnJvcl0pIHsKKyAgICBQUk9UT0NPTF9UUkFOU1BPUlRfRVJST1IoTk8sIGVycm9yLCBAIlRyYW5zcG9ydCByZWFkIGZhaWxlZCIpOworICB9CisKKyAgKnZhbHVlID0KICAgICAoKGkzMnJkWzBdICYgMHhmZikgPDwgMjQpIHwKICAgICAoKGkzMnJkWzFdICYgMHhmZikgPDwgMTYpIHwKICAgICAoKGkzMnJkWzJdICYgMHhmZikgPDwgIDgpIHwKICAgICAoKGkzMnJkWzNdICYgMHhmZikpOworCisgIHJldHVybiBZRVM7CiB9CiAKIAotLSAoTlNTdHJpbmcgKikgcmVhZFN0cmluZworLShCT09MKSByZWFkSTY0OihTSW50NjQgKil2YWx1ZSB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Uk9UT0NPTF9FUlJPUihOTywgVW5rbm93biwgQCJVbmFibGUgdG8gYWxsb2NhdGUgJWQgYnl0ZXMiLCAoaW50KXNpemUpOworICB9CisKKyAgaWYgKCFbX3RyYW5zcG9ydCByZWFkQWxsOmRhdGEubXV0YWJsZUJ5dGVzIG9mZnNldDowIGxlbmd0aDpzaXplIGVycm9yOmVycm9yXSkgeworICAgIFBST1RPQ09MX1RSQU5TUE9SVF9FUlJPUihOTywgZXJyb3IsIEAiVHJhbnNwb3J0IHJlYWQgZmFpbGVkIik7CisgIH0KKworICAqdmFsdWUgPSBkYXRhOworCisgIHJldHVybiBZRVM7CiB9CiAKIAotLSAodm9pZCkgcmVhZE1hcEJlZ2luUmV0dXJuaW5nS2V5VHlwZTogKGludCAqKSBrZXlUeXBlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVUeXBlOiAoaW50ICopIHZhbHVlVHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogKGludCAqKSBzaXplCistKEJPT0wpIHJlYWRNYXBCZWdpblJldHVybmluZ0tleVR5cGU6KFNJbnQzMiAqKWtleVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlVHlwZTooU0ludDMyICopdmFsdWVUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgaW50IGt0ID0gW3NlbGYgcmVhZEJ5dGVdOwotICBpbnQgdnQgPSBbc2VsZiByZWFkQnl0ZV07Ci0gIGludCBzID0gW3NlbGYgcmVhZEkzMl07CisgIFVJbnQ4IGt0OworICBpZiAoIVtzZWxmIHJlYWRCeXRlOiZrdCBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKworICBVSW50OCB2dDsKKyAgaWYgKCFbc2VsZiByZWFkQnl0ZTomdnQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgU0ludDMyIHM7CisgIGlmICghW3NlbGYgcmVhZEkzMjomcyBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKwogICBpZiAoa2V5VHlwZSAhPSBOVUxMKSB7CiAgICAgKmtleVR5cGUgPSBrdDsKICAgfQorCiAgIGlmICh2YWx1ZVR5cGUgIT0gTlVMTCkgewogICAgICp2YWx1ZVR5cGUgPSB2dDsKICAgfQorCiAgIGlmIChzaXplICE9IE5VTEwpIHsKICAgICAqc2l6ZSA9IHM7CiAgIH0KKworICByZXR1cm4gWUVTOwogfQogCi0tICh2b2lkKSByZWFkTWFwRW5kIHt9CiAKLQotLSAodm9pZCkgcmVhZFNldEJlZ2luUmV0dXJuaW5nRWxlbWVudFR5cGU6IChpbnQgKikgZWxlbWVudFR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50ICopIHNpemUKKy0oQk9PTCkgcmVhZE1hcEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgaW50IGV0ID0gW3NlbGYgcmVhZEJ5dGVdOwotICBpbnQgcyA9IFtzZWxmIHJlYWRJMzJdOworICByZXR1cm4gWUVTOworfQorCisKKy0oQk9PTCkgcmVhZFNldEJlZ2luUmV0dXJuaW5nRWxlbWVudFR5cGU6KFNJbnQzMiAqKWVsZW1lbnRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIgKilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50OCBldDsKKyAgaWYgKCFbc2VsZiByZWFkQnl0ZTomZXQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgU0ludDMyIHM7CisgIGlmICghW3NlbGYgcmVhZEkzMjomcyBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKwogICBpZiAoZWxlbWVudFR5cGUgIT0gTlVMTCkgewogICAgICplbGVtZW50VHlwZSA9IGV0OwogICB9CisKICAgaWYgKHNpemUgIT0gTlVMTCkgewogICAgICpzaXplID0gczsKICAgfQorCisgIHJldHVybiBZRVM7CiB9CiAKIAotLSAodm9pZCkgcmVhZFNldEVuZCB7fQotCi0KLS0gKHZvaWQpIHJlYWRMaXN0QmVnaW5SZXR1cm5pbmdFbGVtZW50VHlwZTogKGludCAqKSBlbGVtZW50VHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50ICopIHNpemUKKy0oQk9PTCkgcmVhZFNldEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgaW50IGV0ID0gW3NlbGYgcmVhZEJ5dGVdOwotICBpbnQgcyA9IFtzZWxmIHJlYWRJMzJdOworICByZXR1cm4gWUVTOworfQorCisKKy0oQk9PTCkgcmVhZExpc3RCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOihTSW50MzIgKillbGVtZW50VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50OCBldDsKKyAgaWYgKCFbc2VsZiByZWFkQnl0ZTomZXQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgU0ludDMyIHM7CisgIGlmICghW3NlbGYgcmVhZEkzMjomcyBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKwogICBpZiAoZWxlbWVudFR5cGUgIT0gTlVMTCkgewogICAgICplbGVtZW50VHlwZSA9IGV0OwogICB9CisKICAgaWYgKHNpemUgIT0gTlVMTCkgewogICAgICpzaXplID0gczsKICAgfQorCisgIHJldHVybiBZRVM7CiB9CiAKIAotLSAodm9pZCkgcmVhZExpc3RFbmQge30KLQotCi0tICh2b2lkKSB3cml0ZUJ5dGU6ICh1aW50OF90KSB2YWx1ZQorLShCT09MKSByZWFkTGlzdEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgW21UcmFuc3BvcnQgd3JpdGU6ICZ2YWx1ZSBvZmZzZXQ6IDAgbGVuZ3RoOiAxXTsKKyAgcmV0dXJuIFlFUzsKIH0KIAogCi0tICh2b2lkKSB3cml0ZU1lc3NhZ2VCZWdpbldpdGhOYW1lOiAoTlNTdHJpbmcgKikgbmFtZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogKGludCkgbWVzc2FnZVR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6IChpbnQpIHNlcXVlbmNlSUQKKworLShCT09MKSB3cml0ZU1lc3NhZ2VCZWdpbldpdGhOYW1lOihOU1N0cmluZyAqKW5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyKW1lc3NhZ2VUeXBlCisgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6KFNJbnQzMilzZXF1ZW5jZUlECisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCiB7Ci0gIGlmIChtU3RyaWN0V3JpdGUpIHsKKyAgaWYgKF9zdHJpY3RXcml0ZSkgeworCiAgICAgaW50IHZlcnNpb24gPSBWRVJTSU9OXzEgfCBtZXNzYWdlVHlwZTsKLSAgICBbc2VsZiB3cml0ZUkzMjogdmVyc2lvbl07Ci0gICAgW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gKHZvaWQpIHdyaXRlRmllbGRCZWdpbldpdGhOYW1lOiAoTlNTdHJpbmcgKikgbmFtZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IChpbnQpIGZpZWxkVHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkSUQ6IChpbnQpIGZpZWxkSUQKKy0oQk9PTCkgd3JpdGVNZXNzYWdlRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgogewotICBbc2VsZiB3cml0ZUJ5dGU6IGZpZWxkVHlwZV07Ci0gIFtzZWxmIHdyaXRlSTE2OiBmaWVsZElEXTsKKyAgX2N1cnJlbnRNZXNzYWdlTmFtZSA9IG5pbDsKKyAgcmV0dXJuIFlFUzsKIH0KIAogCi0tICh2b2lkKSB3cml0ZUkzMjogKGludDMyX3QpIHZhbHVlCistKEJPT0wpIHdyaXRlU3RydWN0QmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgdWludDhfdCBidWZmWzRdOworICByZXR1cm4gWUVTOworfQorCisKKy0oQk9PTCkgd3JpdGVTdHJ1Y3RFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBZRVM7Cit9CisKKworLShCT09MKSB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIpZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOihTSW50MzIpZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgaWYgKCFbc2VsZiB3cml0ZUJ5dGU6Zmll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QpIGluaXRXaXRoVHJhbnNwb3J0OihpZCA8VFRyYW5zcG9ydD4pYVRyYW5zcG9ydAoreworICBzZWxmID0gW3NlbGYgaW5pdF07CisKKyAgaWYgKHNlbGYgIT0gbmlsKSB7CisgICAgX3RyYW5zcG9ydCA9IGFUcmFuc3BvcnQ7CisgIH0KKworICByZXR1cm4gc2VsZjsKK30KKworLShpZCA8VFRyYW5zcG9ydD4pIHRyYW5zcG9ydAoreworICByZXR1cm4gX3RyYW5zcG9ydDsKK30KKworLShCT09MKSB3cml0ZUJ5dGVEaXJlY3Q6KFVJbnQ4KW4gZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIGlmICghW190cmFuc3BvcnQgd3JpdGU6KFVJbnQ4ICopJm4gb2Zmc2V0OjAgbGVuZ3RoOjEgZXJyb3I6ZXJyb3JdKSB7CisgICAgUFJPVE9DT0xfVFJBTlNQT1JUX0VSUk9SKE5PLCBlcnJvciwgQCJUcmFuc3BvcnQgd3JpdGUgZmFpbGVkIik7CisgIH0KKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSB3cml0ZVZhcmludDMyOihVSW50MzIpbiBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDggaTMyYnVmWzVdID0gezB9OworICBVSW50MzIgaWR4ID0gMDsKKworICB3aGlsZSAodHJ1ZSkgeworICAgIGlmICgobiAmIH4weDdGKSA9PSAwKSB7CisgICAgICBpMzJidWZbaWR4KytdID0gKFVJbnQ4KW47CisgICAgICBicmVhazsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICBpMzJidWZbaWR4KytdID0gKFVJbnQ4KSgobiAmIDB4N0YpIHwgMHg4MCk7CisgICAgICBuID4+PSA3OworICAgIH0KKyAgfQorCisgIGlmICghW190cmFuc3BvcnQgd3JpdGU6aTMyYnVmIG9mZnNldDowIGxlbmd0aDppZHggZXJyb3I6ZXJyb3JdKSB7CisgICAgUFJPVE9DT0xfVFJBTlNQT1JUX0VSUk9SKE5PLCBlcnJvciwgQCJUcmFuc3BvcnQgd3JpdGUgZmFpbGVkIik7CisgIH0KKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHdyaXRlTWVzc2FnZUJlZ2luV2l0aE5hbWU6KE5TU3RyaW5nICopbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIpbWVzc2FnZVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgc2VxdWVuY2VJRDooU0ludDMyKXNlcXVlbmNlSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgaWYgKCFbc2VsZiB3cml0ZUJ5dGVEaXJlY3Q6Q09NUEFDVF9QUk9UT0NPTF9JRCBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKyAgaWYgKCFbc2VsZiB3cml0ZUJ5dGVEaXJlY3Q6KFVJbnQ4KSgoQ09NUEFDVF9WRVJTSU9OICYgQ09NUEFDVF9WRVJTSU9OX01BU0spIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKCgoVUludDMyKW1lc3NhZ2VUeXBlKSA8PCBDT01QQUNUX1RZUEVfU0hJRlRfQU1PVU5UKSAmIENPTVBBQ1RfVFlQRV9NQVNLKSkgZXJyb3I6ZXJyb3JdKQorICB7CisgICAgcmV0dXJuIE5POworICB9CisgIGlmICghW3NlbGYgd3JpdGVWYXJpbnQzMjooVUludDMyKXNlcXVlbmNlSUQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisgIGlmICghW3NlbGYgd3JpdGVTdHJpbmc6bmFtZSBlcnJvcjplcnJvcl0pIHsKKyAgICByZXR1cm4gTk87CisgIH0KKworICBfY3VycmVudE1lc3NhZ2VOYW1lID0gbmFtZTsKKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHdyaXRlU3RydWN0QmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBbX2xhc3RGaWVsZCBhZGRPYmplY3Q6QChfbGFzdEZpZWxkSWQpXTsKKyAgX2xhc3RGaWVsZElkID0gMDsKKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSB3cml0ZVN0cnVjdEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgX2xhc3RGaWVsZElkID0gW19sYXN0RmllbGQubGFzdE9iamVjdCBzaG9ydFZhbHVlXTsKKyAgW19sYXN0RmllbGQgcmVtb3ZlTGFzdE9iamVjdF07CisgIHJldHVybiBZRVM7Cit9CisKKy0oQk9PTCkgd3JpdGVGaWVsZEJlZ2luV2l0aE5hbWU6KE5TU3RyaW5nICopbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyKWZpZWxkVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDooU0ludDMyKWZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIGlmIChmaWVsZFR5cGUgPT0gVFR5cGVCT09MKSB7CisgICAgX2Jvb2xGaWVsZE5hbWUgPSBbbmFtZSBjb3B5XTsKKyAgICBfYm9vbEZpZWxkVHlwZSA9IEAoZmllbGRUeXBlKTsKKyAgICBfYm9vbEZpZWxkSWQgPSBAKGZpZWxkSUQpOworICAgIHJldHVybiBZRVM7CisgIH0KKyAgZWxzZSB7CisgICAgcmV0dXJuIFtzZWxmIHdyaXRlRmllbGRCZWdpbkludGVybmFsV2l0aE5hbWU6bmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOmZpZWxkVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOmZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVPdmVycmlkZToweEZGCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ZXJyb3JdOworICB9Cit9CisKKy0oQk9PTCkgd3JpdGVGaWVsZEJlZ2luSW50ZXJuYWxXaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6KFNJbnQzMilmaWVsZFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDooU0ludDMyKWZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVPdmVycmlkZTooVUludDgpdHlwZU92ZXJyaWRlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIFVJbnQ4IHR5cGVUb1dyaXRlID0gdHlwZU92ZXJyaWRlID09IDB4RkYgPyBbc2VsZiBjb21wYWN0VHlwZUZvclRUeXBlOmZpZWxkVHlwZV0gOiB0eXBlT3ZlcnJpZGU7CisKKyAgLy8gY2hlY2sgaWYgd2UgY2FuIHVzZSBkZWx0YSBlbmNvZGluZyBmb3IgdGhlIGZpZWxkIGlkCisgIGlmIChmaWVsZElEID4gX2xhc3RGaWVsZElkICYmIGZpZWxkSUQgLSBfbGFzdEZpZWxkSWQgPD0gMTUpIHsKKyAgICAvLyBXcml0ZSB0aGVtIHRvZ2V0aGVyCisgICAgaWYgKCFbc2VsZiB3cml0ZUJ5dGVEaXJlY3Q6KGZpZWxkSUQgLSBfbGFzdEZpZWxkSWQpIDw8IDQgfCB0eXBlVG9Xcml0ZSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgZWxzZSB7CisgICAgLy8gV3JpdGUgdGhlbSBzZXBhcmF0ZQorICAgIGlmICghW3NlbGYgd3JpdGVCeXRlRGlyZWN0OnR5cGVUb1dyaXRlIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKyAgICBpZiAoIVtzZWxmIHdyaXRlSTE2OmZpZWxkSUQgZXJyb3I6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorICB9CisKKyAgX2xhc3RGaWVsZElkID0gZmllbGRJRDsKKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHdyaXRlRmllbGRTdG9wOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW3NlbGYgd3JpdGVCeXRlRGlyZWN0OlRDVHlwZV9TVE9QIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZU1hcEJlZ2luV2l0aEtleVR5cGU6KFNJbnQzMilrZXlUeXBlCisgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlVHlwZTooU0ludDMyKXZhbHVlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgaWYgKHNpemUgPT0gMCkgeworICAgIGlmICghW3NlbGYgd3JpdGVCeXRlRGlyZWN0OjAgZXJyb3I6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorICB9CisgIGVsc2UgeworICAgIGlmICghW3NlbGYgd3JpdGVWYXJpbnQzMjooVUludDMyKXNpemUgZXJyb3I6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorICAgIGlmICghW3NlbGYgd3JpdGVCeXRlRGlyZWN0OltzZWxmIGNvbXBhY3RUeXBlRm9yVFR5cGU6a2V5VHlwZV0gPDwgNCB8IFtzZWxmIGNvbXBhY3RUeXBlRm9yVFR5cGU6dmFsdWVUeXBlXSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSB3cml0ZUxpc3RCZWdpbldpdGhFbGVtZW50VHlwZTooU0ludDMyKWVsZW1lbnRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIpc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtzZWxmIHdyaXRlQ29sbGVjdGlvbkJlZ2luV2l0aEVsZW1lbnRUeXBlOmVsZW1lbnRUeXBlIHNpemU6c2l6ZSBlcnJvcjplcnJvcl07Cit9CisKKy0oQk9PTCkgd3JpdGVTZXRCZWdpbldpdGhFbGVtZW50VHlwZTooU0ludDMyKWVsZW1lbnRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbc2VsZiB3cml0ZUNvbGxlY3Rpb25CZWdpbldpdGhFbGVtZW50VHlwZTplbGVtZW50VHlwZSBzaXplOnNpemUgZXJyb3I6ZXJyb3JdOworfQorCistKEJPT0wpIHdyaXRlQm9vbDooQk9PTCliIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBCT09MIHJlc3VsdDsKKyAgaWYgKF9ib29sRmllbGRJZCAhPSBuaWwgJiYgX2Jvb2xGaWVsZE5hbWUgIT0gbmlsICYmIF9ib29sRmllbGRUeXBlICE9IG5pbCkgeworICAgIC8vIHd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cmV0dXJuIFlFUzsKK30KKworLShCT09MKSB3cml0ZUZpZWxkRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHdyaXRlQ29sbGVjdGlvbkJlZ2luV2l0aEVsZW1lbnRUeXBlOihTSW50MzIpZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50OCBjdHlwZUVsZW1lbnQgPSBbc2VsZiBjb21wYWN0VHlwZUZvclRUeXBlOmVsZW1lbnRUeXBlXTsKKworICBpZiAoc2l6ZSA8PSAxNCkgeworICAgIGlmICghW3NlbGYgd3JpdGVCeXRlRGlyZWN0OnNpemUgPDwgNCB8IGN0eXBlRWxlbWVudCBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgZWxzZSB7CisgICAgaWYgKCFbc2VsZiB3cml0ZUJ5dGVEaXJlY3Q6MHhmMCB8IGN0eXBlRWxlbWVudCBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgICAgaWYgKCFbc2VsZiB3cml0ZVZhcmludDMyOihVSW50MzIpc2l6ZSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSB3cml0ZVZhcmludDY0OihVSW50NjQpbiBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDggdmFyaW50NjRvdXRbMTBdID0gezB9OworICBpbnQgaWR4ID0gMDsKKworICB3aGlsZSAodHJ1ZSkgeworICAgIGlmICgobiAm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daYWc6KFNJbnQ2NCluCit7CisgIHJldHVybiAoVUludDY0KShuIDw8IDEpIF4gKFVJbnQ2NCkobiA+PiA2Myk7Cit9CisKKy0oQk9PTCkgcmVhZE1lc3NhZ2VCZWdpblJldHVybmluZ05hbWU6KE5TU3RyaW5nICoqKXBuYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIgKilwdHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VxdWVuY2VJRDooU0ludDMyICopcHNlcXVlbmNlSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIFVJbnQ4IHByb3RvY29sSWQ7CisgIGlmICghW3NlbGYgcmVhZEJ5dGU6JnByb3RvY29sSWQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgaWYgKHByb3RvY29sSWQgIT0gQ09NUEFDVF9QUk9UT0NPTF9JRCkgeworICAgIGlmIChlcnJvcikgeworICAgICAgKmVycm9yID0gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRQcm90b2NvbEVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFByb3RvY29sRXJyb3JVbmtub3duCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHtUUHJvdG9jb2xFcnJvckV4dGVuZGVkRXJyb3JLZXk6IEAoVFByb3RvY29sRXh0ZW5kZWRFcnJvck1pc21hdGNoZWRQcm90b2NvbCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xFcnJvckV4cGVjdGVkSWRLZXk6IEAoQ09NUEFDVF9QUk9UT0NPTF9JRCl9XTsKKyAgICB9CisgICAgcmV0dXJuIE5POworICB9CisKKyAgVUludDggdmVyc2lvbkFuZFR5cGU7CisgI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bWUgIT0gTlVMTCkgeworICAgICpwbmFtZSA9IG5hbWU7CisgIH0KKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSByZWFkU3RydWN0QmVnaW5SZXR1cm5pbmdOYW1lOihOU1N0cmluZyAqKilwbmFtZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgW19sYXN0RmllbGQgYWRkT2JqZWN0OkAoX2xhc3RGaWVsZElkKV07CisgIF9sYXN0RmllbGRJZCA9IDA7CisKKyAgaWYgKHBuYW1lICE9IE5VTEwpIHsKKyAgICAqcG5hbWUgPSBAIiI7CisgIH0KKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHJlYWRTdHJ1Y3RFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIF9sYXN0RmllbGRJZCA9IFtfbGFzdEZpZWxkLmxhc3RPYmplY3Qgc2hvcnRWYWx1ZV07CisgIFtfbGFzdEZpZWxkIHJlbW92ZUxhc3RPYmplY3RdOworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHJlYWRGaWVsZEJlZ2luUmV0dXJuaW5nTmFtZTooTlNTdHJpbmcgKiopcG5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIgKilwZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDooU0ludDMyICopcGZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50OCBieXRlOworICBpZiAoIVtzZWxmIHJlYWRCeXRlOiZieXRlIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIFVJbnQ4IHR5cGUgPSBieXRlICYgMHgwZjsKKworICAvLyBpZiBpdCdzIGEgc3RvcCwgdGhlbiB3ZSBjYW4gcmV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EwpIHsKKyAgICAqcG5hbWUgPSBAIiI7CisgIH0KKyAgaWYgKHBmaWVsZFR5cGUgIT0gTlVMTCkgeworICAgICpwZmllbGRUeXBlID0gZmllbGRUeXBlOworICB9CisgIGlmIChwZmllbGRJRCAhPSBOVUxMKSB7CisgICAgKnBmaWVsZElEID0gZmllbGRJZDsKKyAgfQorCisgIC8vIGlmIHRoaXMgaGFwcGVucyB0byBiZSBhIGJvb2xlYW4gZmllbGQsIHRoZSB2YWx1ZSBpcyBlbmNvZGVkIGluIHRoZSB0eXBlCisgIGlmICh0eXBlID09IFRDVHlwZV9CT09MRUFOX1RSVUUgfHwKKyAgICAgIHR5cGUgPT0gVENUeXBlX0JPT0xFQU5fRkFMU0UpCisgIHsKKyAgICAvLyBzYXZlIHRoZSBib29sZWFuIHZhbHVlIGluIGEgc3BlY2lhbCBpbnN0YW5jZSB2YXJpYWJsZS4KKyAgICBfYm9vbGVhblZhbHVlID0gW05TTnVtYmVyIG51bWJlcldpdGhCb29sOnR5cGUgPT0gVENUeXBlX0JPT0xFQU5fVFJVRV07CisgIH0KKworICAvLyBwdXNoIHRoZSBuZXcgZmllbGQgb250byB0aGUgZmllbGQgc3RhY2sgc28gd2UgY2FuIGtlZXAgdGhlIGRlbHRhcyBnb2luZy4KKyAgX2xhc3RGaWVsZElkID0gZmllbGRJZDsKKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHJlYWRNYXBCZWdpblJldHVybmluZ0tleVR5cGU6KFNJbnQzMiAqKXBrZXlUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6KFNJbnQzMiAqKXB2YWx1ZVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTooU0ludDMyICopcHNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDgga2V5QW5kVmFsdWVUeXBlID0gMDsKKyAgVUludDMyIHNpemU7CisgIGlmICghW3NlbGYgcmVhZFZhcmludDMyOiZzaXplIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorICBpZiAoc2l6ZSAhPSAwKSB7CisgICAgaWYgKCFbc2VsZiByZWFkQnl0ZToma2V5QW5kVmFsdWVUeXBlIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKyAgfQorCisgIFVJbnQ4IGtleVR5cGU7CisgIGlmICghW3NlbGYgdHR5cGU6JmtleVR5cGUgZm9yQ29tcGFjdFR5cGU6a2V5QW5kVmFsdWVUeXBlID4+IDQgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgVUludDggdmFsdWVUeXBlOworICBpZiAoIVtzZWxmIHR0eXBlOiZ2YWx1ZVR5cGUgZm9yQ29tcGFjdFR5cGU6a2V5QW5kVmFsdWVUeXBlICYgMHhmIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIGlmIChwa2V5VHlwZSAhPSBOVUxMKSB7CisgICAgKnBrZXlUeXBlID0ga2V5VHlwZTsKKyAgfQorICBpZiAocHZhbHVlVHlwZSAhPSBOVUxMKSB7CisgICAgKnB2YWx1ZVR5cGUgPSB2YWx1ZVR5cGU7CisgIH0KKyAgaWYgKHBzaXplICE9IE5VTEwpIHsKKyAgICAqcHNpemUgPSBzaXplOworICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSByZWFkTGlzdEJlZ2luUmV0dXJuaW5nRWxlbWVudFR5cGU6KFNJbnQzMiAqKXBlbGVtZW50VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXBzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDggc2l6ZUFuZFR5cGU7CisgIGlmICghW3NlbGYgcmVhZEJ5dGU6JnNpemVBbmRUeXBlIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIFVJbnQzMiBzaXplID0gKHNpemVBbmRUeXBlID4+IDQpICYgMHgwZjsKKyAgaWYgKHNpemUgPT0gMTUpIHsKKyAgICBpZiAoIVtzZWxmIHJlYWRWYXJpbnQzMjomc2l6ZSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKworICBVSW50OCBlbGVtZW50VHlwZTsKKyAgaWYgKCFbc2VsZiB0dHlwZTomZWxlbWVudFR5cGUgZm9yQ29tcGFjdFR5cGU6c2l6ZUFuZFR5cGUgJiAweDBmIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIGlmIChwZWxlbWVudFR5cGUgIT0gTlVMTCkgeworICAgICpwZWxlbWVudFR5cGUgPSBlbGVtZW50VHlwZTsKKyAgfQorICBpZiAocHNpemUgIT0gTlVMTCkgeworICAgICpwc2l6ZSA9IHNpemU7CisgIH0KKworICByZXR1cm4gWUVTOworfQorCistKEJPT0wpIHJlYWRTZXRCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOihTSW50MzIgKilwZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXBzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW3NlbGYgcmVhZExpc3RCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOnBlbGVtZW50VHlwZSBzaXplOnBzaXplIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSByZWFkQm9vbDooQk9PTCAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpb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MKSByZWFkU3RyaW5nOihOU1N0cmluZyAqX19hdXRvcmVsZWFzaW5nICopdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIFVJbnQzMiBsZW5ndGg7CisgIGlmICghW3NlbGYgcmVhZFZhcmludDMyOiZsZW5ndGggZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgTlNTdHJpbmcgKnJlc3VsdDsKKworICBpZiAobGVuZ3RoICE9IDApIHsKKworICAgIE5TRGF0YSAqZGF0YTsKKyAgICBpZiAoIVtzZWxmIHJlYWRCaW5hcnlPZkxlbmd0aDpsZW5ndGggZGF0YTomZGF0YSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisKKyAgICByZXN1bHQgPSBbW05TU3RyaW5nIGFsbG9jXSBpbml0V2l0aERhdGE6ZGF0YQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGluZzpOU1VURjhTdHJpbmdFbmNvZGluZ107CisgIH0KKyAgZWxzZSB7CisgICAgcmVzdWx0ID0gQCIiOworICB9CisKKyAgaWYgKHZhbHVlKSB7CisgICAgKnZhbHVlID0gcmVzdWx0OworICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSByZWFkQmluYXJ5OihOU0RhdGEgKl9fYXV0b3JlbGVhc2luZyAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50MzIgbGVuZ3RoOworICBpZiAoIVtzZWxmIHJlYWRWYXJpbnQzMjombGVuZ3RoIGVycm9yOmVycm9yXSkgeworICAgIHJldHVybiBOTzsKKyAgfQorCisgIHJldHVybiBbc2VsZiByZWFkQmluYXJ5T2ZMZW5ndGg6bGVuZ3RoIGRhdGE6dmFsdWUgZXJyb3I6ZXJyb3JdOworfQorCistKEJPT0wpIHJlYWRCaW5hcnlP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ooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSByZWFkVmFyaW50MzI6KFVJbnQzMiAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50MzIgcmVzdWx0ID0gMDsKKyAgaW50IHNoaWZ0ID0gMDsKKworICB3aGlsZSAodHJ1ZSkgeworCisgICAgVUludDggYnl0ZTsKKyAgICBpZiAoIVtzZWxmIHJlYWRCeXRlOiZieXRlIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKworICAgIHJlc3VsdCB8PSAoVUludDMyKShieXRlICYgMHg3ZikgPDwgc2hpZnQ7CisgICAgaWYgKCEoYnl0ZSAmIDB4ODApKSB7CisgICAgICBicmVhazsKKyAgICB9CisKKyAgICBzaGlmdCArPSA3OworICB9CisKKyAgaWYgKHZhbHVlKSB7CisgICAgKnZhbHVlID0gcmVzdWx0OworICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworLShCT09MKSByZWFkVmFyaW50NjQ6KFVJbnQ2NCAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBpbnQgc2hpZnQgPSAwOworICBVSW50NjQgcmVzdWx0ID0gMDsKKworICB3aGlsZSAodHJ1ZSkgeworCisgICAgVUludDggYnl0ZTsKKyAgICBpZiAoIVtzZWxmIHJlYWRCeXRlOiZieXRlIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKworICAgIHJlc3VsdCB8PSAoVUludDY0KShieXRlICYgMHg3ZikgPDwgc2hpZnQ7CisgICAgaWYgKCEoYnl0ZSAmIDB4ODApKSB7CisgICAgICBicmVhazsKKyAgICB9CisKKyAgICBzaGlmdCArPSA3OworICB9CisKKyAgaWYgKHZhbHVlKSB7CisgICAgKnZhbHVlID0gcmVzdWx0OworICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworLShTSW50MzIpIHppZ1phZ1RvaTMyOihVSW50MzIpbgoreworICByZXR1cm4gKFNJbnQzMikobiA+PiAxKSBeICgtKFNJbnQzMikobiAmIDEpKTsKK30KKworLShTSW50NjQpIHppZ1phZ1RvaTY0OihVSW50NjQpbgoreworICByZXR1cm4gKFNJbnQ2NCkobiA+PiAxKSBeICgtKFNJbnQ2NCkobiAmIDEpKTsKK30KKworLShCT09MKSB0dHlwZTooVUludDggKil0dHlwZSBmb3JDb21wYWN0VHlwZTooVUludDgpY3R5cGUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHN3aXRjaCAoY3R5cGUgJiAweDBmKSB7CisgIGNhc2UgVENUeXBlX1NUT1A6CisgICAgKnR0eXBlID0gVFR5cGVTVE9QOworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfQk9PTEVBTl9GQUxTRToKKyAgY2FzZSBUQ1R5cGVfQk9PTEVBTl9UUlVFOgorICAgICp0dHlwZSA9IFRUeXBlQk9PTDsKKyAgICByZXR1cm4gWUVTOworCisgIGNhc2UgVENUeXBlX0JZVEU6CisgICAgKnR0eXBlID0gVFR5cGVCWVRFOworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfSTE2OgorICAgICp0dHlwZSA9IFRUeXBlSTE2OworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfSTMyOgorICAgICp0dHlwZSA9IFRUeXBlSTMyOworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfSTY0OgorICAgICp0dHlwZSA9IFRUeXBlSTY0OworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfRE9VQkxFOgorICAgICp0dHlwZSA9IFRUeXBlRE9VQkxFOworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfQklOQVJZOgorICAgICp0dHlwZSA9IFRUeXBlU1RSSU5HOworICAgIHJldHVybiBZRVM7CisKKyAgY2FzZSBUQ1R5cGVfTElTVDoKKyAgICAqdHR5cGUgPSBUVHlwZUxJU1Q7CisgICAgcmV0dXJuIFlFUzsKKworICBjYXNlIFRDVHlwZV9TRVQ6CisgICAgKnR0eXBlID0gVFR5cGVTRVQ7CisgICAgcmV0dXJuIFlFUzsKKworICBjYXNlIFRDVHlwZV9NQVA6CisgICAgKnR0eXBlID0gVFR5cGVNQVA7CisgICAgcmV0dXJuIFlFUzsKKworICBjYXNlIFRDVHlwZV9TVFJVQ1Q6CisgICAgKnR0eXBlID0gVFR5cGVTVFJVQ1Q7CisgICAgcmV0dXJuIFlFUzsKKworICBkZWZhdWx0OgorICAgIGlmIChlcnJvcikgeworICAgICAgKmVycm9yID0gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRQcm90b2NvbEVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFByb3RvY29sRXJyb3JVbmtub3duCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHtUUHJvdG9jb2xFcnJvclR5cGVLZXk6IEAoKFVJbnQ4KShjdHlwZSAmIDB4MEYpKX1dOworICAgIH0KKyAgICByZXR1cm4gTk87CisgIH0KK30KKworLShVSW50OCkgY29tcGFjdFR5cGVGb3JUVHlwZTooVUludDgpdHR5cGUKK3sKKyAgc3RhdGljIFVJbnQ4IHR0eXBlVG9Db21wYWN0VHlwZVtdID0geworICAgIFtUVHlwZVNUT1BdID0gVENUeXBlX1NUT1AsCisgICAgW1RUeXBlQk9PTF0gPSBUQ1R5cGVfQk9PTEVBTl9GQUxTRSwKKyAgICBbVFR5cGVCWVRFXSA9IFRDVHlwZV9CWVRFLAorICAgIFtUVHlwZURPVUJMRV0gPSBUQ1R5cGVfRE9VQkxFLAorICAgIFtUVHlwZUkxNl0gPSBUQ1R5cGVfSTE2LAorICAgIF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0gMSwKKyAgVFR5cGVCT09MICAgPSAyLAorICBUVHlwZUJZVEUgICA9IDMsCisgIFRUeXBlRE9VQkxFID0gNCwKKyAgVFR5cGVJMTYgICAgPSA2LAorICBUVHlwZUkzMiAgICA9IDgsCisgIFRUeXBlSTY0ICAgID0gMTAsCisgIFRUeXBlU1RSSU5HID0gMTEsCisgIFRUeXBlU1RSVUNUID0gMTIsCisgIFRUeXBlTUFQICAgID0gMTMsCisgIFRUeXBlU0VUICAgID0gMTQsCisgIFRUeXBlTElTVCAgID0gMTUKIH07CiAKIAogQHByb3RvY29sIFRQcm90b2NvbCA8TlNPYmplY3Q+CiAKLS0gKGlkIDxUVHJhbnNwb3J0PikgdHJhbnNwb3J0OworLShpZCA8VFRyYW5zcG9ydD4pIHRyYW5zcG9ydDsKIAotLSAodm9pZCkgcmVhZE1lc3NhZ2VCZWdpblJldHVybmluZ05hbWU6IChOU1N0cmluZyAqKikgbmFtZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IChpbnQgKikgdHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6IChpbnQgKikgc2VxdWVuY2VJRDsKLS0gKHZvaWQpIHJlYWRNZXNzYWdlRW5kOworLShCT09MKSByZWFkTWVzc2FnZUJlZ2luUmV0dXJuaW5nTmFtZTooTlNTdHJpbmcgKl9fbnVsbGFibGUgX19hdXRvcmVsZWFzaW5nICpfX251bGxhYmxlKW5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6KG51bGxhYmxlIFNJbnQzMiAqKXR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6KG51bGxhYmxlIFNJbnQzMiAqKXNlcXVlbmNlSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOworLShCT09MKSByZWFkTWVzc2FnZUVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CiAKLS0gKHZvaWQpIHJlYWRTdHJ1Y3RCZWdpblJldHVybmluZ05hbWU6IChOU1N0cmluZyAqKikgbmFtZTsKLS0gKHZvaWQpIHJlYWRTdHJ1Y3RFbmQ7CistKEJPT0wpIHJlYWRTdHJ1Y3RCZWdpblJldHVybmluZ05hbWU6KE5TU3RyaW5nICpfX251bGxhYmxlIF9fYXV0b3JlbGVhc2luZyAqX19udWxsYWJsZSluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOworLShCT09MKSByZWFkU3RydWN0RW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAotLSAodm9pZCkgcmVhZEZpZWxkQmVnaW5SZXR1cm5pbmdOYW1lOiAoTlNTdHJpbmcgKiopIG5hbWUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogKGludCAqKSBmaWVsZFR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDogKGludCAqKSBmaWVsZElEOwotLSAodm9pZCkgcmVhZEZpZWxkRW5kOworLShCT09MKSByZWFkRmllbGRCZWdpblJldHVybmluZ05hbWU6KE5TU3RyaW5nICpfX251bGxhYmxlIF9fYXV0b3JlbGVhc2luZyAqX19udWxsYWJsZSluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyICopZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDoobnVsbGFibGUgU0ludDMyICopZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOworLShCT09MKSByZWFkRmllbGRFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCi0tIChOU1N0cmluZyAqKSByZWFkU3RyaW5nOworLShCT09MKSByZWFkU3RyaW5nOihOU1N0cmluZyAqX19ub25udWxsIF9fYXV0b3JlbGVhc2luZyAqX19ub25udWxsKXZhbHVlIGVycm9yOihOU0Vycm9yICoqKWVycm9yOwogCi0tIChCT09MKSByZWFkQm9vbDsKKy0oQk9PTCkgcmVhZEJvb2w6KEJPT0wgKil2YWx1ZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CiAKLS0gKHVuc2lnbmVkIGNoYXIpIHJlYWRCeXRlOworLShCT09MKSByZWFkQnl0ZTooVUludDggKil2YWx1ZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CiAKLS0gKHNob3J0KSByZWFkSTE2OworLShCT09MKSByZWFkSTE2OihTSW50MTYgKil2YWx1ZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CiAKLS0gKGludDMyX3QpIHJlYWRJMzI7CistKEJPT0wpIHJlYWRJMzI6KFNJbnQzMiAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAotLSAoaW50NjRfdCkgcmVhZEk2NDsKKy0oQk9PTCkgcmVhZEk2NDooU0ludDY0ICopdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCi0tIChkb3VibGUpIHJlYWREb3VibGU7CistKEJPT0wpIHJlYWREb3VibGU6KGRvdWJsZSAqKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAotLSAoTlNEYXRhICopIHJlYWRCaW5hcnk7CistKEJPT0wpIHJlYWRCaW5hcnk6KE5TRGF0YSAqX19ub25udWxsIF9fYXV0b3JlbGVhc2luZyAqX19ub25udWxsKXZhbHVlIGVycm9yOihOU0Vycm9yICoqKWVycm9yOwogCi0tICh2b2lkKSByZWFkTWFwQmVnaW5SZXR1cm5pbmdLZXlUeXBlOiAoaW50ICopIGtleVR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6IChpbnQgKikgdmFsdWVUeXBlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50ICopIHNpemU7Ci0tICh2b2lkKSByZWFkTWFwRW5kOworLShCT09MKSByZWFkTWFwQmVnaW5SZXR1cm5pbmdLZXlUeXBlOihudWxsYWJsZSBTSW50MzIgKilrZXlUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6KG51bGxhYmxlIFNJbnQzMiAqKXZhbHVlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIgKilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOworLShCT09MKSByZWFkTWFwRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAogCi0tICh2b2lkKSByZWFkU2V0QmVnaW5SZXR1cm5pbmdFbGVtZW50VHlwZTogKGludCAqKSBlbGVtZW50VHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IChpbnQgKikgc2l6ZTsKLS0gKHZvaWQpIHJlYWRTZXRFbmQ7CistKEJPT0wpIHJlYWRTZXRCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOihudWxsYWJsZSBTSW50MzIgKillbGVtZW50VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTooU0ludDMyICopc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CistKEJPT0wpIHJlYWRTZXRFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCiAKLS0gKHZvaWQpIHJlYWRMaXN0QmVnaW5SZXR1cm5pbmdFbGVtZW50VHlwZTogKGludCAqKSBlbGVtZW50VHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50ICopIHNpemU7Ci0tICh2b2lkKSByZWFkTGlzdEVuZDsKKy0oQk9PTCkgcmVhZExpc3RCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOihudWxsYWJsZSBTSW50MzIgKillbGVtZW50VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKKy0oQk9PTCkgcmVhZExpc3RFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCiAKLS0gKHZvaWQpIHdyaXRlTWVzc2FnZUJlZ2luV2l0aE5hbWU6IChOU1N0cmluZyAqKSBuYW1lCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAoaW50KSBtZXNzYWdlVHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgc2VxdWVuY2VJRDogKGludCkgc2VxdWVuY2VJRDsKLS0gKHZvaWQpIHdyaXRlTWVzc2FnZUVuZDsKKy0oQk9PTCkgd3JpdGVNZXNzYWdlQmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6KFNJbnQzMiltZXNzYWdlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICBzZXF1ZW5jZUlEOihTSW50MzIpc2VxdWVuY2VJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKKy0oQk9PTCkgd3JpdGVNZXNzYWdlRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAotLSAodm9pZCkgd3JpdGVTdHJ1Y3RCZWdpbldpdGhOYW1lOiAoTlNTdHJpbmcgKikgbmFtZTsKLS0gKHZvaWQpIHdyaXRlU3RydWN0RW5kOworLShCT09MKSB3cml0ZVN0cnVjdEJlZ2luV2l0aE5hbWU6KE5TU3RyaW5nICopbmFtZSBlcnJvcjooTlNFcnJvciAqKillcnJvcjsKKy0oQk9PTCkgd3JpdGVTdHJ1Y3RFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCi0tICh2b2lkKSB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTogKE5TU3RyaW5nICopIG5hbWUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAoaW50KSBmaWVsZFR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOiAoaW50KSBmaWVsZElEOworLShCT09MKSB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIpZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOihTSW50MzIpZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3I7CiAKLS0gKHZvaWQpIHdyaXRlSTMyOiAoaW50MzJfdCkgdmFsdWU7CistKEJPT0wpIHdyaXRlSTMyOihTSW50MzIpdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCi0tICh2b2lkKSB3cml0ZUk2NDogKGludDY0X3QpIHZhbHVlOworLShCT09MKSB3cml0ZUk2NDooU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b3JlbGVhc2luZyAqKWVycm9yOwogCi0tICh2b2lkKSB3cml0ZUZpZWxkRW5kOworLShCT09MKSB3cml0ZUZpZWxkRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKIAotLSAodm9pZCkgd3JpdGVNYXBCZWdpbldpdGhLZXlUeXBlOiAoaW50KSBrZXlUeXBlCi0gICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6IChpbnQpIHZhbHVlVHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50KSBzaXplOwotLSAodm9pZCkgd3JpdGVNYXBFbmQ7CistKEJPT0wpIHdyaXRlTWFwQmVnaW5XaXRoS2V5VHlwZTooU0ludDMyKWtleVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVUeXBlOihTSW50MzIpdmFsdWVUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTooU0ludDMyKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcjsKKy0oQk9PTCkgd3JpdGVNYXBFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yOwogCiAKLS0gKHZvaWQpIHdyaXRlU2V0QmVnaW5XaXRoRWxlbWVudFR5cGU6IChpbnQpIGVsZW1lbnRUeXBlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAoaW50KSBzaXplOwotLSAodm9pZCkgd3JpdGVTZXRFbmQ7CistKEJPT0wpIHdyaXRlU2V0QmVnaW5XaXRoRWxlbWVudFR5cGU6KFNJbnQzMillbGVtZW50VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIpc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillc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XJuaW5nTmFtZTooTlNTdHJpbmcgKiopbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyICopdHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VxdWVuY2VJRDooU0ludDMyICopc2VxdWVuY2VJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCByZWFkTWVzc2FnZUJlZ2luUmV0dXJuaW5nTmFtZTpuYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6dHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXF1ZW5jZUlEOnNlcXVlbmNlSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjplcnJvcl07Cit9CisKKy0oQk9PTCkgcmVhZE1lc3NhZ2VFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZE1lc3NhZ2VFbmQ6ZXJyb3JdOworfQorCistKEJPT0wpIHJlYWRTdHJ1Y3RCZWdpblJldHVybmluZ05hbWU6KE5TU3RyaW5nICoqKW5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCByZWFkU3RydWN0QmVnaW5SZXR1cm5pbmdOYW1lOm5hbWUgZXJyb3I6ZXJyb3JdOworfQorCistKEJPT0wpIHJlYWRTdHJ1Y3RFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZFN0cnVjdEVuZDplcnJvcl07Cit9CisKKy0oQk9PTCkgcmVhZEZpZWxkQmVnaW5SZXR1cm5pbmdOYW1lOihOU1N0cmluZyAqKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyICopZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRJRDooU0ludDMyICopZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZEZpZWxkQmVnaW5SZXR1cm5pbmdOYW1lOm5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOmZpZWxkSUQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ZXJyb3JdOworfQorLShCT09MKSByZWFkRmllbGRFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZEZpZWxkRW5kOmVycm9yXTsKK30KKworLShCT09MKSByZWFkU3RyaW5nOihOU1N0cmluZyAqX19hdXRvcmVsZWFzaW5nICopdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZFN0cmluZzp2YWx1ZSBlcnJvcjplcnJvcl07Cit9CisKKy0oQk9PTCkgcmVhZEJvb2w6KEJPT0wgKil2YWx1Z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19hdXRvcmVsZWFzaW5nICopdmFsdWUgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZEJpbmFyeTp2YWx1ZSBlcnJvcjplcnJvcl07Cit9CisKKy0oQk9PTCkgcmVhZE1hcEJlZ2luUmV0dXJuaW5nS2V5VHlwZTooU0ludDMyICopa2V5VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVUeXBlOihTSW50MzIgKil2YWx1ZVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTooU0ludDMyICopc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHJlYWRNYXBCZWdpblJldHVybmluZ0tleVR5cGU6a2V5VHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6dmFsdWVUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTpzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjplcnJvcl07Cit9CistKEJPT0wpIHJlYWRNYXBFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZE1hcEVuZDplcnJvcl07Cit9CisKKworLShCT09MKSByZWFkU2V0QmVnaW5SZXR1cm5pbmdFbGVtZW50VHlwZTooU0ludDMyICopZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMiAqKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgcmVhZFNldEJlZ2luUmV0dXJuaW5nRWxlbWVudFR5cGU6ZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTpzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ZXJyb3JdOworfQorLShCT09MKSByZWFkU2V0RW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHJlYWRTZXRFbmQ6ZXJyb3JdOworfQorCistKEJPT0wpIHJlYWRMaXN0QmVnaW5SZXR1cm5pbmdFbGVtZW50VHlwZTooU0ludDMyICopZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIgKilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCByZWFkTGlzdEJlZ2luUmV0dXJuaW5nRWxlbWVudFR5cGU6ZWxlbWVudFR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6c2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjplcnJvcl07Cit9CistKEJPT0wpIHJlYWRMaXN0RW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHJlYWRMaXN0RW5kOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZU1lc3NhZ2VCZWdpbldpdGhOYW1lOihOU1N0cmluZyAqKW5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTooU0ludDMyKW1lc3NhZ2VUeXBlCisgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6KFNJbnQzMilzZXF1ZW5jZUlECisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgd3JpdGVNZXNzYWdlQmVnaW5XaXRoTmFtZTpuYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTptZXNzYWdlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcXVlbmNlSUQ6c2VxdWVuY2VJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ZXJyb3JdOworfQorLShCT09MKSB3cml0ZU1lc3NhZ2VFbmQ6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgd3JpdGVNZXNzYWdlRW5kOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZVN0cnVjdEJlZ2luV2l0aE5hbWU6KE5TU3RyaW5nICopbmFtZSBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCB3cml0ZVN0cnVjdEJlZ2luV2l0aE5hbWU6bmFtZSBlcnJvcjplcnJvcl07Cit9CistKEJPT0wpIHdyaXRlU3RydWN0RW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlU3RydWN0RW5kOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTooTlNTdHJpbmcgKiluYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOihTSW50MzIpZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOihTSW50MzIpZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCB3cml0ZUZpZWxkQmVnaW5XaXRoTmFtZTpuYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ZmllbGRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkSUQ6ZmllbGRJRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUkzMjooU0ludDMyKXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlSTMyOnZhbHVlIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUk2NDooU0ludDY0KXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlSTY0OnZhbHVlIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUkxNjooU0ludDE2KXZhbHVlIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25j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b25jcmV0ZVByb3RvY29sIHdyaXRlRmllbGRTdG9wOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUZpZWxkRW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlRmllbGRFbmQ6ZXJyb3JdOworfQorCistKEJPT0wpIHdyaXRlTWFwQmVnaW5XaXRoS2V5VHlwZTooU0ludDMyKWtleVR5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVUeXBlOihTSW50MzIpdmFsdWVUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTooU0ludDMyKXNpemUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlTWFwQmVnaW5XaXRoS2V5VHlwZTprZXlUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVUeXBlOnZhbHVlVHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTpzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZU1hcEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCB3cml0ZU1hcEVuZDplcnJvcl07Cit9CisKKy0oQk9PTCkgd3JpdGVTZXRCZWdpbldpdGhFbGVtZW50VHlwZTooU0ludDMyKWVsZW1lbnRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6KFNJbnQzMilzaXplCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIHJldHVybiBbX2NvbmNyZXRlUHJvdG9jb2wgd3JpdGVTZXRCZWdpbldpdGhFbGVtZW50VHlwZTplbGVtZW50VHlwZSBzaXplOnNpemUgZXJyb3I6ZXJyb3JdOworfQorCistKEJPT0wpIHdyaXRlU2V0RW5kOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICByZXR1cm4gW19jb25jcmV0ZVByb3RvY29sIHdyaXRlU2V0RW5kOmVycm9yXTsKK30KKworLShCT09MKSB3cml0ZUxpc3RCZWdpbldpdGhFbGVtZW50VHlwZTooU0ludDMyKWVsZW1lbnRUeXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOihTSW50MzIpc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCB3cml0ZUxpc3RCZWdpbldpdGhFbGVtZW50VHlwZTplbGVtZW50VHlwZSBzaXplOnNpemUgZXJyb3I6ZXJyb3JdOworfQorCistKEJPT0wpIHdyaXRlTGlzdEVuZDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgcmV0dXJuIFtfY29uY3JldGVQcm90b2NvbCB3cml0ZUxpc3RFbmQ6ZXJyb3JdOworfQorCitAZW5kCmRpZmYgLS1naXQgYS9saWIvY29jb2Evc3JjL3Byb3RvY29sL1RQcm90b2NvbEVycm9yLmggYi9saWIvY29jb2Evc3JjL3Byb3RvY29sL1RQcm90b2NvbEVycm9yLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYWIwYmM0MAotLS0gL2Rldi9udWxsCisrKyBiL2xpYi9jb2NvYS9zcmMvcHJvdG9jb2wvVFByb3RvY29sRXJyb3Iu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AqIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCisKKyNpbXBvcnQgIlRFcnJvci5oIgorCisKK2V4dGVybiBOU1N0cmluZyAqVFByb3RvY29sRXJyb3JEb21haW47CisKK3R5cGVkZWYgTlNfRU5VTSAoaW50LCBUUHJvdG9jb2xFcnJvcikgeworICBUUHJvdG9jb2xFcnJvclVua25vd24gICAgICAgICAgICAgICAgICAgPSAwLAorICBUUHJvdG9jb2xFcnJvckludmFsaWREYXRhICAgICAgICAgICAgICAgPSAxLAorICBUUHJvdG9jb2xFcnJvck5lZ2F0aXZlU2l6ZSAgICAgICAgICAgICAgPSAyLAorICBUUHJvdG9jb2xFcnJvclNpemVMaW1pdCAgICAgICAgICAgICAgICAgPSAzLAorICBUUHJvdG9jb2xFcnJvckJhZFZlcnNpb24gICAgICAgICAgICAgICAgPSA0LAorICBUUHJvdG9jb2xFcnJvck5vdEltcGxlbWVudGVkICAgICAgICAgICAgPSA1LAorICBUUHJvdG9jb2xFcnJvckRlcHRoTGltaXQgICAgICAgICAgICAgICAgPSA2LAorfTsKKworCit0eXBlZGVmIE5TX0VOVU0oaW50LCBUUHJvdG9jb2xFeHRlbmRlZEVycm9yKSB7CisgIFRQcm90b2NvbEV4dGVuZGVkRXJyb3JNaXNzaW5nUmVxdWlyZWRGaWVsZCAgPSAxMDAxLAorICBUUHJvdG9jb2xFeHRlbmRlZEVycm9yVW5leHBlY3RlZFR5cGUgICAgICAgID0gMTAwMiwKKyAgVFByb3RvY29sRXh0ZW5kZWRFcnJvck1pc21hdGNoZWRQcm90b2NvbCAgICA9IDEwMDMsCit9OworCitleHRlcm4gTlNTdHJpbmcgKlRQcm90b2NvbEVycm9yRXh0ZW5kZWRFcnJvcktleTsKK2V4dGVybiBOU1N0cmluZyAqVFByb3RvY29sRXJyb3JGaWVsZE5hbWVLZXk7CitleHRlcm4gTlNTdHJpbmcgKlRQcm90b2NvbEVycm9yRXhwZWN0ZWRJZEtleTsKK2V4dGVybiBOU1N0cmluZyAqVFByb3RvY29sRXJyb3JFeHBlY3RlZFZlcnNpb25LZXk7CitleHRlcm4gTlNTdHJpbmcgKlRQcm90b2NvbEVycm9yVHlwZUtleTsKK2V4dGVybiBOU1N0cmluZyAqVFByb3RvY29sRXJyb3JTb3VyY2VMaW5lS2V5OworZXh0ZXJuIE5TU3RyaW5nICpUUHJvdG9jb2xFcnJvclNvdXJjZUZpbGVLZXk7CitleHRlcm4gTlNTdHJpbmcgKlRQcm90b2NvbEVycm9yU291cmNlTWV0aG9kS2V5OworZXh0ZXJuIE5TU3RyaW5nICpUUHJvdG9jb2xFcnJvck1lc3NhZ2VOYW1lS2V5OworCisKKyNkZWZpbmUgUFJPVE9DT0xfRVJST1IocmV0LCBlcnIsIC4uLikgXAorICBpZiAoZXJyb3IpIHsgIFwKKyAgICAqZXJyb3IgPSBbTlNFcnJvciBlcnJvcldpdGhEb21haW46VFByb3RvY29sRXJyb3JEb21haW4gXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTpUUHJvdG9jb2xFcnJvciAjIyBlcnIgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VySW5mbzpAe05TTG9jYWxpemVkRGVzY3JpcHRpb25LZXk6IFtOU1N0cmluZyBzdHJpbmdXaXRoRm9ybWF0Ol9fVkFfQVJHU19fXSwgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEAiU291cmNlRmlsZSI6IFtOU1N0cmluZyBzdHJpbmdXaXRoVVRGOFN0cmluZzpfX0ZJTEVfX10sIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAIlNvdXJjZUxpbmUiOiBAKF9fTElORV9fKSwgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEAiU291cmNlRnVuY3Rpb24iOiBbTlNTdHJpbmcgc3RyaW5nV2l0aFVURjhTdHJpbmc6X19QUkVUVFlfRlVOQ1RJT05fX10sIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAIk1lc3NhZ2UiOiBzZWxmLmN1cnJlbnRNZXNzYWdlTmFtZSA/IHNlbGYuY3VycmVudE1lc3NhZ2VOYW1lIDogQCIifV07IFwKKyAgfSBcCisgIHJldHVybiByZXQKKworI2RlZmluZSBQUk9UT0NPTF9UUkFOU1BPUlRfRVJST1IocmV0LCBlcnJvclB0ciwgLi4uKSBcCisgIGlmIChlcnJvclB0cikgeyBcCisgICAgKmVycm9yID0gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRQcm90b2NvbEVycm9yRG9tYWluIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFByb3RvY29sRXJyb3JVbmtub3duIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHtOU0xvY2FsaXplZERlc2NyaXB0aW9uS2V5OiBbW05TU3RyaW5nIHN0cmluZ1dpdGhGb3JtYXQ6X19WQV9BUkdTX19dIHN0cmluZ0J5QXBwZW5kaW5nRm9ybWF0OkAiOiAlQCIsIFsoKmVycm9yUHRyKSBsb2NhbGl6ZWREZXNjcmlwdGlvbl1dLCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXJyb3JTb3VyY2VGaWxlS2V5OiBbTlNTdHJpbmcgc3RyaW5nV2l0aFVURjhTdHJpbmc6X19GSUxFX19dLCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXJyb3JTb3VyY2VMaW5lS2V5OiBAKF9fTElORV9fKSwgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEVycm9yU291cmNlTWV0aG9kS2V5OiBbTlNTdHJpbmcgc3RyaW5nV2l0aFVURjhTdHJpbmc6X19QUkVUVFlfRlVOQ1RJT05fX10sIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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RJMTY6JnZhbCBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgYnJlYWs7CisKKyAgY2FzZSBUVHlwZUkzMjogeworICAgIFNJbnQzMiB2YWw7CisgICAgaWYgKCFbcHJvdG9jb2wgcmVhZEkzMjomdmFsIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKyAgfQorICBicmVhazsKKworICBjYXNlIFRUeXBlSTY0OiB7CisgICAgU0ludDY0IHZhbDsKKyAgICBpZiAoIVtwcm90b2NvbCByZWFkSTY0OiZ2YWwgZXJyb3I6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorICB9CisgIGJyZWFrOworCisgIGNhc2UgVFR5cGVET1VCTEU6IHsKKyAgICBkb3VibGUgdmFsOworICAgIGlmICghW3Byb3RvY29sIHJlYWREb3VibGU6JnZhbCBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisgIH0KKyAgYnJlYWs7CisKKyAgY2FzZSBUVHlwZVNUUklORzogeworICAgIE5TU3RyaW5nICp2YWw7CisgICAgaWYgKCFbcHJvdG9jb2wgcmVhZFN0cmluZzomdmFsIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KKyAgfQorICBicmVhazsKKworICBjYXNlIFRUeXBlU1RSVUNUOiB7CisgICAgaWYgKCFbcHJvdG9jb2wgcmVhZFN0cnVjdEJlZ2luUmV0dXJuaW5nTmFtZTpOVUxMIGVycm9yOmVycm9yXSkgeworICAgICAgcmV0dXJuIE5POworICAgIH0KICAgICB3aGlsZSAodHJ1ZSkgewotICAgICAgaW50IGZpZWxkVHlwZTsKLSAgICAgIFtwcm90b2NvbCByZWFkRmllbGRCZWdpblJldHVybmluZ05hbWU6IG5pbCB0eXBlOiAmZmllbGRUeXBlIGZpZWxkSUQ6IG5pbF07Ci0gICAgICBpZiAoZmllbGRUeXBlID09IFRUeXBlX1NUT1ApIHsKKyAgICAgIFNJbnQzMiBmaWVsZFR5cGU7CisgICAgICBpZiAoIVtwcm90b2NvbCByZWFkRmllbGRCZWdpblJldHVybmluZ05hbWU6bmlsIHR5cGU6JmZpZWxkVHlwZSBmaWVsZElEOm5pbCBlcnJvcjplcnJvcl0pIHsKKyAgICAgICAgcmV0dXJuIE5POworICAgICAgfQorICAgICAgaWYgKGZpZWxkVHlwZSA9PSBUVHlwZVNUT1ApIHsKICAgICAgICAgYnJlYWs7CiAgICAgICB9Ci0gICAgICBbVFByb3RvY29sVXRpbCBza2lwVHlwZTogZmllbGRUeXBlIG9uUHJvdG9jb2w6IHByb3RvY29sXTsKLSAgICAgIFtwcm90b2NvbCByZWFkRmllbGRFbmRdOworICAgICAgaWYgKCFbc2VsZiBza2lwVHlwZTpmaWVsZFR5cGUgb25Qcm90b2NvbDpwcm90b2NvbCBlcnJvcjplcnJvcl0pIHsKKyAgICAgICAgcmV0dXJuIE5POworICAgICAgfQorICAgICAgaWYgKCFbcHJvdG9jb2wgcmVhZEZpZWxkRW5kOmVycm9yXSkgeworICAgICAgICByZXR1cm4gTk87CisgICAgICB9CiAgICAgfQotICAgIFtwcm90b2NvbCByZWFkU3RydWN0RW5kXTsKLSAgICBicmVhazsKLSAgY2FzZSBUVHlwZV9NQVA6Ci0gIHsKLSAgICBpbnQga2V5VHlwZTsKLSAgICBpbnQgdmFsdWVUeXBlOwotICAgIGludCBzaXplOwotICAgIFtwcm90b2NvbCByZWFkTWFwQmVnaW5SZXR1cm5pbmdLZXlUeXBlOiAma2V5VHlwZSB2YWx1ZVR5cGU6ICZ2YWx1ZVR5cGUgc2l6ZTogJnNpemVdOworICAgIGlmICghW3Byb3RvY29sIHJlYWRTdHJ1Y3RFbmQ6ZXJyb3JdKSB7CisgICAgICByZXR1cm4gTk87CisgICAgfQorICB9CisgIGJyZWFrOworCisgIGNhc2UgVFR5cGVNQVA6IHsKKyAgICBTSW50MzIga2V5VHlwZTsKKyAgICBTSW50MzIgdmFsdWVUeXBlOworICAgIFNJbnQzMiBzaXplOworICAgIGlmICghW3Byb3RvY29sIHJlYWRNYXBCZWdpblJldHVybmluZ0tleVR5cGU6JmtleVR5cGUgdmFsdWVUeXBlOiZ2YWx1ZVR5cGUgc2l6ZTomc2l6ZSBlcnJvcjplcnJvcl0pIHsKKyAgICAgIHJldHVybiBOTzsKKyAgICB9CiAgICAgaW50IGk7CiAgICAgZm9yIChpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgW1RQcm90b2NvbFV0aWwgc2tpcFR5cGU6IGtleVR5cGUgb25Qcm90b2NvbDogcHJvdG9jb2xdOwotICAgICAgW1RQcm90b2NvbFV0aWwgc2tpcFR5cGU6IHZhbHVlVHlwZSBvblByb3RvY29sOiBwcm90b2NvbF07Ci0gICAgfQotICAgIFtwcm90b2NvbCByZWFkTWFwRW5kXTsKLSAgfQotICAgIGJyZWFrOwotICAgIGNhc2UgVFR5cGVfU0VUOgotICAgIHsKLSAgICAgIGludCBlbGVtVHlwZTsKLSAgICAgIGludCBzaXplOwotICAgICAgW3Byb3RvY29sIHJlYWRTZXRCZWdpblJldHVybmluZ0VsZW1lbnRUeXBlOiAmZWxlbVR5cGUgc2l6ZTogJnNpemVdOwotICAgICAgaW50IGk7Ci0gICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7Ci0gICAgICAgIFtUUHJvdG9jb2xVdGlsIHNraXBUeXBlOiBlbGVtVHlwZSBvblByb3RvY29sOiBwcm90b2NvbF07CisgICAgICBpZiAoIVtUUHJvdG9jb2xVdGlsIHNraXBUeXBlOmtleVR5cGUgb25Qcm90b2NvbDpwcm90b2NvbCBlcnJvcjplcnJvcl0pIHsKKyAgICAgICAgcmV0dXJuIE5POwogICAgICAgfQotICAgICAgW3Byb3RvY29sIHJlYWRTZXRFbmRdOwotICAgIH0KLSAgICAgIGJyZWFrOwotICAgIGNhc2UgVFR5cGVfTElTVDoKLSAgICB7Ci0gICAgIC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uc3BvcnRdOwotICAgICAgICAKLSAgICAgICAgaWQgPFRQcm90b2NvbD4gaW5Qcm90b2NvbCA9IFttSW5wdXRQcm90b2NvbEZhY3RvcnkgbmV3UHJvdG9jb2xPblRyYW5zcG9ydDogdHJhbnNwb3J0XTsKLSAgICAgICAgaWQgPFRQcm90b2NvbD4gb3V0UHJvdG9jb2wgPSBbbU91dHB1dFByb3RvY29sRmFjdG9yeSBuZXdQcm90b2NvbE9uVHJhbnNwb3J0OiB0cmFuc3BvcnRdOwotICAgICAgICAKLSAgICAgICAgQHRyeSB7Ci0gICAgICAgICAgICBCT09MIHJlc3VsdCA9IE5POwotICAgICAgICAgICAgZG8gewotICAgICAgICAgICAgICAgIEBhdXRvcmVsZWFzZXBvb2wgewotICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBbcHJvY2Vzc29yIHByb2Nlc3NPbklucHV0UHJvdG9jb2w6IGluUHJvdG9jb2wgb3V0cHV0UHJvdG9jb2w6IG91dFByb3RvY29sXTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IHdoaWxlIChyZXN1bHQpOwotICAgICAgICB9Ci0gICAgICAgIEBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiAqIHRlKSB7Ci0gICAgICAgICAgICAvL05TTG9nKEAiQ2F1Z2h0IHRyYW5zcG9ydCBleGNlcHRpb24sIGFiYW5kb25pbmcgY2xpZW50IGNvbm5lY3Rpb246ICVAIiwgdGUpOwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBOU05vdGlmaWNhdGlvbiAqIG4gPSBbTlNOb3RpZmljYXRpb24gbm90aWZpY2F0aW9uV2l0aE5hbWU6IGtUU29ja2V0U2VydmVyX0NsaWVudENvbm5lY3Rpb25GaW5pc2hlZEZvclByb2Nlc3Nvck5vdGlmaWNhdGlvbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHNlbGYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOiBbTlNEaWN0aW9uYXJ5IGRpY3Rpb25hcnlXaXRoT2JqZWN0c0FuZEtleXM6IAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzb3IsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtUU29ja2V0U2VydmVyX1Byb2Nlc3NvcktleSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrVFNvY2tlclNlcnZlcl9UcmFuc3BvcnRLZXksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5pbF1dOwotICAgICAgICBbW05TTm90aWZpY2F0aW9uQ2VudGVyIGRlZmF1bHRDZW50ZXJdIHBlcmZvcm1TZWxlY3Rvck9uTWFpblRocmVhZDogQHNlbGVjdG9yKHBvc3ROb3RpZmljYXRpb246KSB3aXRoT2JqZWN0OiBuIHdhaXRVbnRpbERvbmU6IFlFU107Ci0gICAgICAgIAorICAgIHNpemVfdCBudWxsVGVybWluYXRlZFBhdGhMZW5ndGggPSBwYXRoLmxlbmd0aCArIDE7CisgICAgc3RydWN0IHNvY2thZGRyX3VuIGFkZHI7CisgICAgaWYgKG51bGxUZXJtaW5hdGVkUGF0aExlbmd0aD4gc2l6ZW9mKGFkZHIuc3VuX3BhdGgpKSB7CisgICAgICBOU0xvZyhAIlRTb2NrZXRTZXJ2ZXI6IFVuYWJsZSB0byBjcmVhdGUgc29ja2V0IGF0IH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QGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uICogdGUpIHsKLSAgICAvL05TTG9nKEAiQ2F1Z2h0IHRyYW5zcG9ydCBleGNlcHRpb24sIGFiYW5kb25pbmcgY2xpZW50IGNvbm5lY3Rpb246ICVAIiwgdGUpOwotICB9CisgICAgYWRkci5zdW5fZmFtaWx5ID0gQUZfTE9DQUw7CisgICAgbWVtY3B5KGFkZHIuc3VuX3BhdGgsIHBhdGguVVRGOFN0cmluZywgbnVsbFRlcm1pbmF0ZWRQYXRoTGVuZ3RoKTsKKyAgICBhZGRyLnN1bl9sZW4gPSBTVU5fTEVOKCZhZGRyKTsKIAotICBOU05vdGlmaWNhdGlvbiAqIG4gPSBbTlNOb3RpZmljYXRpb24gbm90aWZpY2F0aW9uV2l0aE5hbWU6IGtUU29ja2V0U2VydmVyX0NsaWVudENvbm5lY3Rpb25GaW5pc2hlZEZvclByb2Nlc3Nvck5vdGlmaWNhdGlvbgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IHNlbGYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOiBbTlNEaWN0aW9uYXJ5IGRpY3Rpb25hcnlXaXRoT2JqZWN0c0FuZEtleXM6IAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzb3IsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtUU29ja2V0U2VydmVyX1Byb2Nlc3NvcktleSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrVFNvY2tlclNlcnZlcl9UcmFuc3BvcnRLZXksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5pbF1dOwotICBbW05TTm90aWZpY2F0aW9uQ2VudGVyIGRlZmF1bHRDZW50ZXJdIHBlcmZvcm1TZWxlY3Rvck9uTWFpblRocmVhZDogQHNlbGVjdG9yKHBvc3ROb3RpZmljYXRpb246KSB3aXRoT2JqZWN0OiBuIHdhaXRVbnRpbERvbmU6IFlFU107Ci0gIAotICBbcG9vbCByZWxlYXNlXTsKLSNlbmRpZgorICAgIE5TRGF0YSAqYWRkcmVzcyA9IFtOU0RhdGEgZGF0YVdpdGhCeXRlczomYWRkciBsZW5ndGg6c2l6ZW9mKGFkZHIpXTsKKyAgICBpZiAoQ0ZTb2NrZXRTZXRBZGRyZXNzKHNvY2tldCwgKF9fYnJpZGdlIENGRGF0YVJlZilhZGRyZXNzKSAhPSBrQ0ZTb2NrZXRTdWNjZXNzKSB7CisgICAgICBDRlNvY2tldEludmFsaWRhdGUoc29ja2V0KTsKKyAgICAgIENGUmVsZWFzZShzb2NrZXQpOworICAgICAgTlNMb2coQCJUU29ja2V0U2VydmVyOiBDb3VsZCBub3QgYmluZCB0byBhZGRyZXNzIik7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICByZXR1cm4gc29ja2V0OworICB9IGVsc2UgeworICAgIE5TTG9nKEAiVFNvY2tldFNlcnZlcjogTm8gc2VydmVyIHNvY2tldCIpOworICAgIHJldHVybiBOVUxMOworICB9Cit9CisKKy0odm9pZCkgZGVhbGxvYworeworICBbW05TTm90aWZpY2F0aW9uQ2VudGVyIGRlZmF1bHRDZW50ZXJdIHJlbW92ZU9ic2VydmVyOnNlbGZdOworCisgIGlmIChfZG9tYWluU29ja2V0UGF0aCAhPSBuaWwpIHsKKyAgICB1bmxpbmsoX2RvbWFpblNvY2tldFBhdGguVVRGOFN0cmluZyk7CisgIH0KIH0KIAogCistKHZvaWQp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w+IG91dFByb3RvY29sID0gW19vdXRwdXRQcm90b2NvbEZhY3RvcnkgbmV3UHJvdG9jb2xPblRyYW5zcG9ydDp0cmFuc3BvcnRdOworCisgICAgTlNFcnJvciAqZXJyb3I7CisgICAgaWYgKCFbcHJvY2Vzc29yIHByb2Nlc3NPbklucHV0UHJvdG9jb2w6aW5Qcm90b2NvbCBvdXRwdXRQcm90b2NvbDpvdXRQcm90b2NvbCBlcnJvcjomZXJyb3JdKSB7CisgICAgICAvLyBIYW5kbGUgZXJyb3IKKyAgICAgIE5TTG9nKEAiRXJyb3IgcHJvY2Vzc2luZyByZXF1ZXN0OiAlQCIsIGVycm9yKTsKKyAgICB9CisKKyAgICBkaXNwYXRjaF9hc3luYyhkaXNwYXRjaF9nZXRfbWFpbl9xdWV1ZSgpLCBeeworCisgICAgICBbTlNOb3RpZmljYXRpb25DZW50ZXIuZGVmYXVsdENlbnRlciBwb3N0Tm90aWZpY2F0aW9uTmFtZTpUU29ja2V0U2VydmVyQ2xpZW50Q29ubmVjdGlvbkZpbmlzaGVkCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdDpzZWxmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VySW5mbzpAe1RTb2NrZXRTZXJ2ZXJQcm9jZXNzb3JLZXk6IHByb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFNvY2tlclNlcnZlclRyYW5zcG9ydEtleTogdHJhbnNwb3J0fV07CisgICAgfSk7CisKKyAgfQorfQogCiBAZW5kCi0KLQotCmRpZmYgLS1naXQgYS9saWIvY29jb2Evc3JjL3RyYW5zcG9ydC9UQXN5bmNUcmFuc3BvcnQuaCBiL2xpYi9jb2NvYS9zcmMvdHJhbnNwb3J0L1RBc3luY1RyYW5zcG9ydC5oCm5ldyB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FkQnVmZmVyID09IG5pbCkgewotICAgICAgICBbc2VsZiByZWFkRnJhbWVdOworICBpbnQgbGVuID0gKGludClbX3dyaXRlQnVmZmVyIGxlbmd0aF07CisgIGludCBkYXRhX2xlbiA9IGxlbiAtIEhFQURFUl9TSVpFOworICBpZiAoZGF0YV9sZW4gPCAwKSB7CisgICAgaWYgKGVycm9yKSB7CisgICAgICAqZXJyb3IgPSBbTlNFcnJvciBlcnJvcldpdGhEb21haW46VFRyYW5zcG9ydEVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFRyYW5zcG9ydEVycm9yVW5rbm93bgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOkB7fV07CiAgICAgfQotICAgIAotICAgIGlmIChyZWFkQnVmZmVyICE9IG5pbCkgewotICAgICAgICBpbnQgYnVmZmVyX2xlbiA9IFtyZWFkQnVmZmVyIGxlbmd0aF07Ci0gICAgICAgIGlmIChidWZmZXJfbGVuLXJlYWRPZmZzZXQgPj0gbGVuKSB7Ci0gICAgICAgICAgICBbcmVhZEJ1ZmZlciBnZXRCeXRlczpidWYgcmFuZ2U6TlNNYWtlUmFuZ2UocmVhZE9mZnNldCxsZW4pXTsgLy8gY29weSBkYXRhCi0gICAgICAgICAgICByZWFkT2Zmc2V0ICs9IGxlbjsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIC8vIHZvaWQgdGhlIHByZXZpb3VzIHJlYWRCdWZmZXIgZGF0YSBhbmQgcmVxdWVzdCBhIG5ldyBmcmFtZQotICAgICAgICAgICAgW3NlbGYgcmVhZEZyYW1lXTsKLSAgICAgICAgICAgIFtyZWFkQnVmZmVyIGdldEJ5dGVzOmJ1ZiByYW5nZTpOU01ha2VSYW5nZSgwLGxlbildOyAvLyBjb3B5IGRhdGEKLSAgICAgICAgICAgIHJlYWRPZmZzZXQgPSBsZW47Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgcmV0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c2luZyAqKWVycm9yCit7CisgIFVJbnQzMiBnb3QgPSBbc2VsZiByZWFkQXZhaWw6b3V0QnVmZmVyIG9mZnNldDpvdXRCdWZmZXJPZmZzZXQgbWF4TGVuZ3RoOmxlbmd0aCBlcnJvcjplcnJvcl07CisgIGlmIChnb3QgIT0gbGVuZ3RoKSB7CisKKyAgICAvLyBSZXBvcnQgdW5kZXJmbG93IG9ubHkgaWYgcmVhZEF2YWlsIGRpZG4ndCByZXBvcnQgZXJyb3IgYWxyZWFkeQorICAgIGlmIChlcnJvciAmJiAhKmVycm9yKSB7CisgICAgICAqZXJyb3IgPSBbTlNFcnJvciBlcnJvcldpdGhEb21haW46VFRyYW5zcG9ydEVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFRyYW5zcG9ydEVycm9yRW5kT2ZGaWxlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86bmlsXTsKICAgICB9Ci0gICAgLy8gY29weSBpbnRvIGludGVybmFsIG1lbW9yeSBidWZmZXIKLSAgICBbbVRyYW5zcG9ydCByZWFkQWxsOltyZWFkQnVmZmVyIG11dGFibGVCeXRlc10gb2Zmc2V0OjAgbGVuZ3RoOnNpemVdOworCisgICAgcmV0dXJuIE5POworICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworLShVSW50MzIpIHJlYWRBdmFpbDooVUludDggKilvdXRCdWZmZXIgb2Zmc2V0OihVSW50MzIpb3V0QnVmZmVyT2Zmc2V0IG1heExlbmd0aDooVUludDMyKWxlbmd0aCBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDMyIGdvdCA9IDA7CisgIHdoaWxlIChnb3QgPCBsZW5ndGgpIHsKKworICAgIE5TVUludGVnZXIgYXZhaWwgPSBfcmVhZEJ1ZmZlci5sZW5ndGggLSBfcmVhZE9mZnNldDsKKyAgICBpZiAoYXZhaWwgPT0gMCkgeworICAgICAgaWYgKCFbc2VsZiByZWFkRnJhbWU6ZXJyb3JdKSB7CisgICAgICAgIHJldHVybiAwOworICAgICAgfQorICAgICAgYXZhaWwgPSBfcmVhZEJ1ZmZlci5sZW5ndGg7CisgICAgfQorCisgICAgTlNSYW5nZSByYW5nZTsKKyAgICByYW5nZS5sb2NhdGlvbiA9IF9yZWFkT2Zmc2V0OworICAgIHJhbmdlLmxlbmd0aCA9IE1JTihsZW5ndGggLSBnb3QsIGF2YWlsKTsKKworICAgIFtfcmVhZEJ1ZmZlciBnZXRCeXRlczpvdXRCdWZmZXIrb3V0QnVmZmVyT2Zmc2V0K2dvdCByYW5nZTpyYW5nZV07CisgICAgX3JlYWRPZmZzZXQgKz0gcmFuZ2UubGVuZ3RoOworICAgIGdvdCArPSByYW5nZS5sZW5ndGg7CisgIH0KKworICByZXR1cm4gZ290OworfQorCistKEJPT0wpIHJlYWRGcmFtZTooTlNFcnJvciAqKillcnJvcgoreworICBVSW50OCBpMzJyZFtIRUFERVJfU0laRV07CisgIGlmICghW190cmFuc3BvcnQgcmVhZEFsbDppMzJyZCBvZmZzZXQ6MCBsZW5ndGg6SEVBREVSX1NJWkUgZXJyb3I6ZXJyb3JdKSB7CisgICAgcmV0dXJuIE5POworICB9CisKKyAgU0ludDMyIHNpemUgPQorICAgICgoaTMycmRbMF0gJiAweGZmKSA8PCAyNCkgfAorICAgICgoaTMycmRbMV0gJiAweGZmKSA8PCAxNikgfAorICAgICgoaTMycmRbMl0gJiAweGZmKSA8PCAgOCkgfAorICAgICgoaTMycmRbM10gJiAweGZmKSk7CisKKyAgaWYgKF9yZWFkQnVmZmVyID09IG5pbCkgeworCisgICAgX3JlYWRCdWZmZXIgPSBbTlNNdXRhYmxlRGF0YSBkYXRhV2l0aExlbmd0aDpzaXplXTsKKworICB9CisgIGVsc2UgeworCisgICAgU0ludDMyIGxlbiA9IChTSW50MzIpX3JlYWRCdWZmZXIubGVuZ3RoOworICAgIGlmIChsZW4gPj0gc2l6Z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ZXI6XihOU0RhdGEgKmRhdGEsIE5TVVJMUmVzcG9uc2UgKnJlc3BvbnNlLCBOU0Vycm9yICplcnJvcikgeworCisgICAgLy8gQ2hlY2sgcmVzcG9uc2UgdHlwZQorICAgIGlmICghZXJyb3IgJiYgIVtyZXNwb25zZSBpc0tpbmRPZkNsYXNzOk5TSFRUUFVSTFJlc3BvbnNlLmNsYXNzXSkgeworCisgICAgICBlcnJvciA9IFtOU0Vycm9yIGVycm9yV2l0aERvbWFpbjpUVHJhbnNwb3J0RXJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTpUVHJhbnNwb3J0RXJyb3JVbmtub3duCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHtUVHJhbnNwb3J0RXJyb3JIdHRwRXJyb3JLZXk6IEAoVEh0dHBUcmFuc3BvcnRFcnJvckludmFsaWRSZXNwb25zZSl9XTsKKworICAgIH0KKworICAgIC8vIENoZWNrIHN0YXR1cyBjb2RlCisgICAgTlNIVFRQVVJMUmVzcG9uc2UgKmh0dHBSZXNwb25zZSA9IChpZClyZXNwb25zZTsKKyAgICBpZiAoIWVycm9yICYmIGh0dHBSZXNwb25zZS5zdGF0dXNDb2RlICE9IDIwMCkgeworCisgICAgICBUSHR0cFRyYW5zcG9ydEVycm9yIGNvZGU7CisgICAgICBpZiAoaHR0cFJlc3BvbnNlLnN0YXR1c0NvZGUgPT0gNDAxKSB7CisgICAgICAgIGNvZGUgPSBUSHR0cFRyYW5zcG9ydEVycm9yQXV0aGVudGljYXRpb247CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgY29kZSA9IFRIdHRwVHJhbnNwb3J0RXJyb3JJbnZhbGlkU3RhdHVzOworICAgICAgfQorCisgICAgICBlcnJvciA9IFtOU0Vycm9yIGVycm9yV2l0aERvbWFpbjpUVHJhbnNwb3J0RXJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOlRUcmFuc3BvcnRFcnJvclVua25vd24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOkB7VFRyYW5zcG9ydEVycm9ySHR0cEVycm9yS2V5OiBAKGNvZGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAInN0YXR1c0NvZGUiOkAoaHR0cFJlc3BvbnNlLnN0YXR1c0NvZGUpfV07CisgICAgfQorCisgICAgLy8gQWxsb3cgZmFjdG9yeSB0byBjaGVjaworICAgIGlmICghZXJyb3IpIHsKKyAgICAgIGVycm9yID0gW19mYWN0b3J5IHZhbGlkYXRlUmVzcG9uc2U6aHR0cFJlc3BvbnNlIGRhdGE6ZGF0YV07CisgICAgfQorCisgICAgX3Jlc3BvbnNlRGF0YU9mZnNldCA9IDA7CisKKyAgICBpZiAoZXJyb3IpIHsKKworICAgICAgX3Jlc3BvbnNlRGF0YSA9IG5pbDsKKworICAgICAgZmFpbHVyZShlcnJvcik7CisKKyAgICB9CisgICAgZWxzZSB7CisKKyAgICAgIGlmIChkYXRhID09IG5pbCkgeworICAgICAgICBkYXRhID0gW05TRGF0YSBkYXRhXTsKKyAgICAgIH0KKworICAgICAgX3Jlc3BvbnNlRGF0YSA9IGRhdGE7CisKKyAgICAgIGNvbXBsZXRlZChzZWxmKTsKKyAgICB9CisKKyAgfSBlcnJvcjomZXJyb3JdOworCisgIGlmICghdGFzaykgeworICAgIGZhaWx1cmUoZXJyb3IpOworICAgIHJldHVybjsKKyAgfQorCisgIFt0YXNrIHJlc3VtZV07Cit9CisKKy0oQk9PTCkgZmx1c2g6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIGRpc3BhdGNoX3NlbWFwaG9yZV90IGNvbXBsZXRlZCA9IGRpc3BhdGNoX3NlbWFwaG9yZV9jcmVhdGUoMCk7CisKKyAgX19ibG9jayBCT09MIHJlc3VsdDsKKyAgX19ibG9jayBOU0Vycm9yICppbn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TAoreworICByZXR1cm4gW3NlbGYgaW5pdFdpdGhVUkw6YVVSTAorICAgICAgICAgICAgICAgICB1c2VyQWdlbnQ6bmlsCisgICAgICAgICAgICAgICAgICAgdGltZW91dDowXTsKK30KKworCistKGlkKSBpbml0V2l0aFVSTDooTlNVUkwgKilhVVJMCisgICAgICAgIHVzZXJBZ2VudDooTlNTdHJpbmcgKilhVXNlckFnZW50CisgICAgICAgICAgdGltZW91dDooaW50KWFUaW1lb3V0Cit7CisgIHNlbGYgPSBbc3VwZXIgaW5pdF07CisgIGlmICghc2VsZikgeworICAgIHJldHVybiBuaWw7CisgIH0KKworICBfdGltZW91dCA9IGFUaW1lb3V0OworICBfdXNlckFnZW50ID0gYVVzZXJBZ2VudDsKKyAgX3VybCA9IGFVUkw7CisKKyAgW3NlbGYgc2V0dXBSZXF1ZXN0XTsKKworICAvLyBjcmVhdGUgb3VyIHJlcXVlc3QgZGF0YSBidWZmZXIKKyAgX3JlcXVlc3REYXRhID0gW1tOU011dGFibGVEYXRhIGFsbG9jXSBpbml0V2l0aENhcGFjaXR5OjEwMjRdOworCisgIHJldHVybiBzZWxmOworfQorCistKHZvaWQpIHNldFVSTDooTlNVUkwgKilhVVJMCit7CisgIF91cmwgPSBhVVJMOworCisgIFtzZWxmIHNldHVwUmVxdWVzdF07Cit9CisKKy0oQk9PTCkgcmVhZEFsbDooVUludDggKilvdXRCdWZmZXIgb2Zmc2V0OihVSW50MzIpb3V0QnVmZmVyT2Zmc2V0IGxlbmd0aDooVUludDMyKWxlbmd0aCBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDMyIGdvdCA9IFtzZWxmIHJlYWRBdmFpbDpvdXRCdWZmZXIgb2Zmc2V0Om91dEJ1ZmZlck9mZnNldCBtYXhMZW5ndGg6bGVuZ3RoIGVycm9yOmVycm9yXTsKKyAgaWYgKGdvdCAhPSBsZW5ndGgpIHsKKworICAgIC8vIFJlcG9ydCB1bmRlcmZsb3cgb25seSBpZiByZWFkQXZhaWwgZGlkbid0IHJlcG9ydCBlcnJvciBhbHJlYWR5CisgICAgaWYgKGVycm9yICYmICEqZXJyb3IpIHsKKyAgICAgICplcnJvciA9IFtOU0Vycm9yIGVycm9yV2l0aERvbWFpbjpUVHJhbnNwb3J0RXJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTpUVHJhbnNwb3J0RXJyb3JFbmRPZkZpbGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VySW5mbzpuaWxdOworICAgIH0KKworICAgIHJldHVybiBOTzsKKyAgfQorCisgIHJldHVybiBZRVM7Cit9CisKKy0oVUludDMyKSByZWFkQXZhaWw6KFVJbnQ4ICopb3V0QnVmZmVyIG9mZnNldDooVUludDMyKW91dEJ1ZmZlck9mZnNldCBtYXhMZW5ndGg6KFVJbnQzMiltYXhMZW5ndGggZXJyb3I6KE5TRXJyb3IgKl9fYXV0b3JlbGVhc2luZyAqKWVycm9yCit7CisgIE5TVUludGVnZXIgYXZhaWwgPSBfcmVzcG9uc2VEYXRhLmxlbmd0aCAtIF9yZXNwb25zZURhdGFPZmZzZXQ7CisKKyAgTlNSYW5nZSByYW5nZTsKKyAgcmFuZ2UubG9jYXRpb24gPSBfcmVzcG9uc2VEYXRhT2Zmc2V0OworICByYW5nZS5sZW5ndGggPSBNSU4obWF4TGVuZ3RoLCBhdmFpbCk7CisKKyAgW19yZXNwb25zZURhdGEgZ2V0Qnl0ZXM6b3V0QnVmZmVyK291dEJ1ZmZlck9mZnNldCByYW5nZTpyYW5nZV07CisgIF9yZXNwb25zZURhdGFPZmZzZXQgKz0gcmFuZ2UubGVuZ3RoOworCisgIHJldHVybiAoVUludDMyKXJhbmdlLmxlbmd0aDsKK30KKworLShCT09MKSB3cml0ZTooY29uc3QgVUludDggKilkYXRhIG9mZnNldDooVUludDMyKW9mZnNldCBsZW5ndGg6KFVJbnQzMilsZW5ndGggZXJyb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gfQorCisgIE5TSFRUUFVSTFJlc3BvbnNlICpodHRwUmVzcG9uc2UgPSAoTlNIVFRQVVJMUmVzcG9uc2UgKilyZXNwb25zZTsKKyAgaWYgKFtodHRwUmVzcG9uc2Ugc3RhdHVzQ29kZV0gIT0gMjAwKSB7CisgICAgaWYgKGVycm9yKSB7CisKKyAgICAgIFRIdHRwVHJhbnNwb3J0RXJyb3IgY29kZTsKKyAgICAgIGlmIChodHRwUmVzcG9uc2Uuc3RhdHVzQ29kZSA9PSA0MDEpIHsKKyAgICAgICAgY29kZSA9IFRIdHRwVHJhbnNwb3J0RXJyb3JBdXRoZW50aWNhdGlvbjsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBjb2RlID0gVEh0dHBUcmFuc3BvcnRFcnJvckludmFsaWRTdGF0dXM7CisgICAgICB9CisKKyAgICAgICplcnJvciA9IFtOU0Vycm9yIGVycm9yV2l0aERvbWFpbjpUVHJhbnNwb3J0RXJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTpUVHJhbnNwb3J0RXJyb3JVbmtub3duCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHtUVHJhbnNwb3J0RXJyb3JIdHRwRXJyb3JLZXk6IEAoY29kZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAInN0YXR1c0NvZGUiOkAoaHR0cFJlc3BvbnNlLnN0YXR1c0NvZGUpfV07CisgICAgfQorICAgIHJldHVybiBOTzsKKyAgfQorCisgIHJldHVybiBZRVM7Cit9CisKK0BlbmQKZGlmZiAtLWdpdCBhL2xpYi9jb2NvYS9zcmMvdHJhbnNwb3J0L1RNZW1vcnlCdWZmZXIuaCBiL2xpYi9jb2NvYS9zcmMvdHJhbnNwb3J0L1RNZW1vcnlCdWZmZXIuaAppbmRleCBmYTRkMzcxLi42MjQ5ZDMyIDEwMDY0NAotLS0gYS9saWIvY29jb2Evc3JjL3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ZmZXJPZmZzZXQgbGVuZ3RoOihVSW50MzIpbGVuZ3RoIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50MzIgZ290ID0gW3NlbGYgcmVhZEF2YWlsOm91dEJ1ZmZlciBvZmZzZXQ6b3V0QnVmZmVyT2Zmc2V0IG1heExlbmd0aDpsZW5ndGggZXJyb3I6ZXJyb3JdOworICBpZiAoZ290ICE9IGxlbmd0aCkgeworCisgICAgLy8gUmVwb3J0IHVuZGVyZmxvdyBvbmx5IGlmIHJlYWRBdmFpbCBkaWRuJ3QgcmVwb3J0IGVycm9yIGFscmVhZHkKKyAgICBpZiAoZXJyb3IgJiYgISplcnJvcikgeworICAgICAgKmVycm9yID0gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRUcmFuc3BvcnRFcnJvckRvbWFpbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOlRUcmFuc3BvcnRFcnJvckVuZE9mRmlsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOm5pbF07CisgICAgfQorCisgICAgcmV0dXJuIE5POworICB9CisKKyAgcmV0dXJuIFlFUzsKIH0KIAotLSAodm9pZClmbHVzaCB7Ci0JLy8gbm9vcAorLShVSW50MzIpIHJlYWRBdmFpbDooVUludDggKilvdXRCdWZmZXIgb2Zmc2V0OihVSW50MzIpb3V0QnVmZmVyT2Zmc2V0IG1heExlbmd0aDooVUludDMyKW1heExlbmd0aCBlcnJvcjooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKK3sKKyAgVUludDMyIGF2YWlsID0gKFVJbnQzMilfYnVmZmVyLmxlbmd0aCAtIF9idWZmZXJPZmZzZXQ7CisgIGlmIChhdmFpbCA9PSAwKSB7CisgICAgcmV0dXJuIDA7CisgIH0KKworICBOU1JhbmdlIHJhbmdlOworICByYW5nZS5sb2NhdGlvbiA9IF9idWZmZXJPZmZzZXQ7C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QHRocm93IFtUVHJhbnNwb3J0RXhjZXB0aW9uIGV4Y2VwdGlvbldpdGhSZWFzb246IEAiQ2Fubm90IHJlYWQuIFJlbW90ZSBzaWRlIGhhcyBjbG9zZWQuIl07CisKKyAgICBVSW50MzIgcmVhZCA9IChVSW50MzIpW19pbnB1dCByZWFkOmJ1ZitvZmYrZ290IG1heExlbmd0aDpsZW4tZ290XTsKKyAgICBpZiAocmVhZCA8PSAwKSB7CisgICAgICBpZiAoZXJyb3IpIHsKKyAgICAgICAgKmVycm9yID0gW05TRXJyb3IgZXJyb3JXaXRoRG9tYWluOlRUcmFuc3BvcnRFcnJvckRvbWFpbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFRyYW5zcG9ydEVycm9yTm90T3BlbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHt9XTsKKyAgICAgIH0KKyAgICAgIHJldHVybiBOTzsKICAgICB9Ci0gICAgZ290ICs9IHJldDsKKworICAgIGdvdCArPSByZWFkOwogICB9CisKKyAgcmV0dXJuIFlFUzsKK30KKworCistKFVJbnQzMikgcmVhZEF2YWlsOihVSW50OCAqKWJ1ZiBvZmZzZXQ6KFVJbnQzMilvZmYgbWF4TGVuZ3RoOihVSW50MzIpbGVuIGVycm9yOihOU0Vycm9yICpfX2F1dG9yZWxlYXNpbmcgKillcnJvcgoreworICBVSW50MzIgZ290ID0gMDsKKyAgd2hpbGUgKGdvdCA8IGxlbikgeworCisgICAgVUludDMyIHJlYWQgPSAoVUludDMyKVtfaW5wdXQgcmVhZDpidWYrb2ZmK2dvdCBtYXhMZW5ndGg6bGVuLWdvdF07CisgICAgaWYgKHJlYWQgPD0gMCkgeworICAgICAgYnJlYWs7CisgICAgfQorCisgICAgZ290ICs9IHJlYWQ7CisgIH0KKwogICByZXR1cm4gZ290OwogfQogCiAKLS0gKHZvaWQpIHdyaXRlOiAoY29uc3QgdWludDhfdCAqKSBkYXRhIG9mZnNldDog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XJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOlRUcmFuc3BvcnRFcnJvck5vdE9wZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOkB7fV07CisgICAgICB9CisgICAgICByZXR1cm4gTk87CiAgICAgfQotICAgIGdvdCArPSByZXN1bHQ7CisgICAgZWxzZSBpZiAodG90YWwgPT0gMCkgeworICAgICAgaWYgKGVycm9yKSB7CisgICAgICAgICplcnJvciA9IFtOU0Vycm9yIGVycm9yV2l0aERvbWFpbjpUVHJhbnNwb3J0RXJyb3JEb21haW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOlRUcmFuc3BvcnRFcnJvckVuZE9mRmlsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86QHt9XTsKKyAgICAgIH0KKyAgICAgIHJldHVybiBOTzsKKyAgICB9CisKKyAgICBnb3QgKz0gdG90YWw7CiAgIH0KKworICByZXR1cm4gWUVTOwogfQogCi0tICh2b2lkKSBmbHVzaAorLShCT09MKSBmbHVzaDooTlNFcnJvciAqX19hdXRvcmVsZWFzaW5nICopZXJyb3IKIHsKLSAgLy8gbm8gZmx1c2ggZm9yIHlvdSEKKyAgcmV0dXJuIFlFUzsKK30KKworLSh2b2lkKSBjbG9zZQoreworICBOU0lucHV0U3RyZWFtICppbnB1dCA9IHNlbGYuaW5wdXQ7CisgIGlmIChpbnB1dCkgeworICAgIC8vIENsb3NlIGFuZCByZXNldCBpbnB1dHN0cmVhbQorICAgIENGUmVhZFN0cmVhbVNldFByb3BlcnR5KChfX2JyaWRnZSBDRlJlYWRTdHJlYW1SZWYpKGlucHV0KSwga0NGU3RyZWFtUHJvcGVydHlTaG91bGRDbG9zZU5hdGl2ZVNvY2tldCwga0NGQm9vbGVhblRydWUpOworICAgIFtpbnB1dCBzZXREZWxlZ2F0ZTpuaWxdOworICAgIFtpbnB1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c3BvcnRFcnJvckRvbWFpbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTpUU1NMU29ja2V0VHJhbnNwb3J0RXJyb3JIb3N0YW5hbWVSZXNvbHV0aW9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJJbmZvOm5pbF07CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG5pbDsKKyAgICAgIH0KKyAgICAgIFtOU1RocmVhZCBzbGVlcEZvclRpbWVJbnRlcnZhbDowLjJdOworICAgIH0KKyAgICBlbHNlIHsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgfQorCisgIG1lbXNldCgmcGluLCAwLCBzaXplb2YocGluKSk7CisgIHBpbi5zaW5fZmFtaWx5ID0gQUZfSU5FVDsKKyAgbWVtY3B5KCZwaW4uc2luX2FkZHIsIGhwLT5oX2FkZHIsIHNpemVvZihzdHJ1Y3QgaW5fYWRkcikpOworICBwaW4uc2luX3BvcnQgPSBodG9ucyhwb3J0KTsKKworICAvKiBjcmVhdGUgdGhlIHNvY2tldCAqLworICBpZiAoKF9zZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApKSA9PSAtMSkgeworICAgIE5TTG9nKEAiZmFpbGVkIHRvIGNyZWF0ZSBzb2NrZXQgZm9yIGhvc3QgJUA6JWQiLCBob3N0bmFtZSwgcG9ydCk7CisgICAgaWYgKGVycm9yKSB7CisgICAgICAqZXJyb3IgPSBbTlNFcnJvciBlcnJvcldpdGhEb21haW46VFNTTFNvY2tldFRyYW5zcG9ydEVycm9yRG9tYWluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6VFNTTFNvY2tldFRyYW5zcG9ydEVycm9yU29ja2V0Q3JlYXRlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckluZm86bmlsXTsKKyAgICB9CisgICAgcmV0dXJuIG5pbDsKKyAgfQorCisgIC8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isgICAgQ0ZNdXRhYmxlQXJyYXlSZWYgbmV3UG9saWNpZXMgPSBOVUxMOworCisgICAgZG8geworCisgICAgICBTZWNUcnVzdFJlZiB0cnVzdCA9IChfX2JyaWRnZSBTZWNUcnVzdFJlZilbYVN0cmVhbSBwcm9wZXJ0eUZvcktleTooTlNTdHJpbmcgKilrQ0ZTdHJlYW1Qcm9wZXJ0eVNTTFBlZXJUcnVzdF07CisKKyAgICAgIC8vIEFkZCBuZXcgcG9saWN5IHRvIGN1cnJlbnQgbGlzdCBvZiBwb2xpY2llcworICAgICAgU2VjUG9saWN5UmVmIHBvbGljeSA9IFNlY1BvbGljeUNyZWF0ZVNTTChOTywgKF9fYnJpZGdlIENGU3RyaW5nUmVmKShfc3NsSG9zdG5hbWUpKTsKKyAgICAgIGlmICghcG9saWN5KSB7CisgICAgICAgIGJyZWFrOworICAgICAgfQorCisgICAgICBDRkFycmF5UmVmIHBvbGljaWVzOworICAgICAgaWYgKFNlY1RydXN0Q29weVBvbGljaWVzKHRydXN0LCAmcG9saWNpZXMpICE9IGVyclNlY1N1Y2Nlc3MpIHsKKyAgICAgICAgQ0ZSZWxlYXNlKHBvbGljeSk7CisgICAgICAgIGJyZWFrOworICAgICAgfQorCisgICAgICBuZXdQb2xpY2llcyA9IENGQXJyYXlDcmVhdGVNdXRhYmxlQ29weShOVUxMLCAwLCBwb2xpY2llcyk7CisgICAgICBDRkFycmF5QXBwZW5kVmFsdWUobmV3UG9saWNpZXMsIHBvbGljeSk7CisKKyAgICAgIENGUmVsZWFzZShwb2xpY2llcyk7CisgICAgICBDRlJlbGVhc2UocG9saWN5KTsKKworICAgICAgLy8gVXBkYXRlIHRydXN0IHBvbGljaWVzCisgICAgICBpZiAoU2VjVHJ1c3RTZXRQb2xpY2llcyh0cnVzdCwgbmV3UG9saWNpZXMpICE9IGVyclNlY1N1Y2Nlc3MpIHsKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisKKyAgICAgIC8vIEV2YWx1YXRlIHRoZSB0cnVzdCBjaGFpbgorICAgICAgaWYgKFNlY1RydXN0RXZhbHVhdGUodHJ1c3QsICZ0cnVzdFJlc3VsdCkgIT0gZXJyU2VjU3VjY2VzcykgeworICAgICAgICBicmVhazsKKyAgICAgIH0KKworICAgICAgc3dpdGNoICh0cnVzdFJlc3VsdCkgeworICAgICAgY2FzZSBrU2VjVHJ1c3RSZXN1bHRQcm9jZWVkOgorICAgICAgICAvLyBOU0xvZyhAIlRydXN0ZWQgYnkgVVNFUiIpOworICAgICAgICBwcm9jZWVkID0gWUVTOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBrU2VjVHJ1c3RSZXN1bHRVbnNwZWNpZmllZDoKKyAgICAgICAgLy8gTlNMb2coQCJUcnVzdGVkIGJ5IE9TIik7CisgICAgICAgIHByb2NlZWQgPSBZRVM7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIGtTZWNUcnVzdFJlc3VsdFJlY292ZXJhYmxlVHJ1c3RGYWlsdXJlOgorICAgICAgICBwcm9jZWVkID0gcmVjb3ZlckZyb21UcnVzdEZhaWx1cmUodHJ1c3QsIHRydXN0UmVzdWx0KTsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2Uga1NlY1RydXN0UmVzdWx0RGVueToKKyAgICAgICAgLy8gTlNMb2coQCJEZW55Iik7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIGtTZWNUcnVzdFJlc3VsdEZhdGFsVHJ1c3RGYWlsdXJlOgorICAgICAgICAvLyBOU0xvZyhAIkZhdGFsVHJ1c3RGYWlsdXJlIik7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIGtTZWNUcnVzdFJlc3VsdE90aGVyRXJyb3I6CisgICAgICAgIC8vIE5TTG9nKEAiT3RoZXJFcnJvciIpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBrU2VjVHJ1c3RSZXN1bHRJbnZhbGlkOgorICAgICAgICAvLyBOU0xvZyhAIkludmFsaWQiKTsKKyAg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eS9VdGlsLmNwcCBcCisgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvY2Vzc29yL1BlZWtQcm9jZXNzb3IuY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9URGVidWdQcm90b2NvbC5jcHAgXAotICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1REZW5zZVByb3RvY29sLmNwcCBcCiAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvdG9jb2wvVEpTT05Qcm90b2NvbC5jcHAgXAogICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RCYXNlNjRVdGlscy5jcHAgXAogICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RNdWx0aXBsZXhlZFByb3RvY29sLmNwcCBcCisgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvdG9jb2wvVFByb3RvY29sLmNwcCBcCiAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1RUcmFuc3BvcnRFeGNlcHRpb24uY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVEZEVHJhbnNwb3J0LmNwcCBcCiAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1RGaWxlVHJhbnNwb3J0LmNwcCBcCkBAIC03OCw0OCArOTUsNTggQEAKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVFNvY2tldFBvb2wuY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVFNlcnZlclNvY2tldC5jcHAgXAogICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9UU1NMU2VydmVyU29ja2V0LmNwcCBcCisgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1ROb25ibG9ja2luZ1NlcnZlclNvY2tldC5jcHAgXAorICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9UTm9uYmxvY2tpbmdTU0xTZXJ2ZXJTb2NrZXQuY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVFRyYW5zcG9ydFV0aWxzLmNwcCBcCiAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1RCdWZmZXJUcmFuc3BvcnRzLmNwcCBcCisgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvc2VydmVyL1RDb25uZWN0ZWRDbGllbnQuY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9zZXJ2ZXIvVFNlcnZlci5jcHAgXAorICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3NlcnZlci9UU2VydmVyRnJhbWV3b3JrLmNwcCBcCiAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvc2VydmVyL1RTaW1wbGVTZXJ2ZXIuY3BwIFwKICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9zZXJ2ZXIvVFRocmVhZFBvb2xTZXJ2ZXIuY3BwIFwKLSAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9zZXJ2ZXIvVFRocmVhZGVkU2VydmVyLmNwcCBcCi0gICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvYXN5bmMvVEFzeW5jQ2hhbm5lbC5jcHAgXAotICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb2Nlc3Nvci9QZWVrUHJvY2Vzc29yLmNwcAorICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3NlcnZlci9UVGh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0xERkxBR1MgICA9IC1yZWxlYXNlICQoVkVSU0lPTikgJChCT09TVF9MREZMQUdTKSAkKFFUX0xJQlMpCitsaWJ0aHJpZnRxdDVfbGFfTERGTEFHUyAgID0gLXJlbGVhc2UgJChWRVJTSU9OKSAkKEJPT1NUX0xERkxBR1MpICQoUVQ1X0xJQlMpCiAKIGluY2x1ZGVfdGhyaWZ0ZGlyID0gJChpbmNsdWRlZGlyKS90aHJpZnQKIGluY2x1ZGVfdGhyaWZ0X0hFQURFUlMgPSBcCkBAIC0xMjcsMTUgKzE1NCwxNSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdGhyaWZ0LWNvbmZpZy5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L1REaXNwYXRjaFByb2Nlc3Nvci5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L1RocmlmdC5oIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L1RSZWZsZWN0aW9uTG9jYWwuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9UT3V0cHV0LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvVFByb2Nlc3Nvci5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L1RBcHBsaWNhdGlvbkV4Y2VwdGlvbi5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L1RMb2dnaW5nLmggXAotICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY3h4ZnVuY3Rpb25hbC5oCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9UVG9TdHJpbmcuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9UQmFzZS5oCiAKIGluY2x1ZGVfY29uY3VycmVuY3lkaXIgPSAkKGluY2x1ZGVfdGhyaWZ0ZGlyKS9jb25jdXJyZW5jeQogaW5jbHVkZV9jb25jdXJyZW5jeV9IRUFERVJTID0gXAotICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY29uY3VycmVuY3kvQm9vc3RUaHJlYWRGYWN0b3J5LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY29uY3VycmVuY3kvRXhjZXB0aW9uLmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvY29uY3VycmVuY3kvTXV0ZXguaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9jb25jdXJyZW5jeS9Nb25pdG9yLmggXApAQCAtMTU3LDEzICsxODQsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RCaW5hcnlQcm90b2NvbC50Y2MgXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvdG9jb2wvVENvbXBhY3RQcm90b2NvbC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RDb21wYWN0UHJvdG9jb2wudGNjIFwKLSAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1REZW5zZVByb3RvY29sLmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvdG9jb2wvVERlYnVnUHJvdG9jb2wuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9USGVhZGVyUHJvdG9jb2wuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9UQmFzZTY0VXRpbHMuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9USlNPTlByb3RvY29sLmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcHJvdG9jb2wvVE11bHRpcGxleGVkUHJvdG9jb2wuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9UUHJvdG9jb2xEZWNvcmF0b3IuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9UUHJvdG9jb2xUYXAuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9UUHJvdG9jb2xUeXBlcy5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RQcm90b2NvbEV4Y2VwdGlvbi5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3Byb3RvY29sL1RWaXJ0dWFsUHJvdG9jb2wuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9wcm90b2NvbC9UUHJvdG9jb2wuaApAQCAtMTczLDEwICsyMDEsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9QbGF0Zm9ybVNvY2tldC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9URkRUcmFuc3BvcnQuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVEZpbGVUcmFuc3BvcnQuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVEhlYWRlclRyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9UU2ltcGxlRmlsZVRyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9UU2VydmVyU29ja2V0LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1RTU0xTZXJ2ZXJTb2NrZXQuaCBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVFNlcnZlclRyYW5zcG9ydC5oIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9UTm9uYmxvY2tpbmdTZXJ2ZXJUcmFuc3BvcnQuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC90cmFuc3BvcnQvVE5vbmJsb2NraW5nU2VydmVyU29ja2V0LmggXAorICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvdHJhbnNwb3J0L1ROb25ibG9ja2luZ1NTTFNlcnZlclNvY2tldC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9USHR0cFRyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9USHR0cENsaWVudC5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3RyYW5zcG9ydC9USHR0cFNlcnZlci5oIFwKQEAgLTE5NSw3ICsyMjcsOSBAQAogCiBpbmNsdWRlX3NlcnZlcmRpciA9ICQoaW5jbHVkZV90aHJpZnRkaXIpL3NlcnZlcgogaW5jbHVkZV9zZXJ2ZXJfSEVBREVSUyA9IFwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3NlcnZlci9UQ29ubmVjdGVkQ2xpZW50LmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvc2VydmVyL1RTZXJ2ZXIuaCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9zZXJ2ZXIvVFNlcnZlckZyYW1ld29yay5oIFwKICAgICAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L3NlcnZlci9UU2ltcGxlU2VydmVyLmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvc2VydmVyL1RUaHJlYWRQb29sU2VydmVyLmggXAogICAgICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvc2VydmVyL1RUaHJlYWRlZFNlcnZlci5oIFwKQEAgLTIxNCw2ICsyNDgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9hc3luYy9UQXN5bmNQcm9jZXNzb3IuaCBcCiAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2FzeW5jL1RBc3luY0J1ZmZlclByb2Nlc3Nvci5oIFwKICAgICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvYXN5bmMvVEFzeW5jUHJvdG9jb2xQcm9jZXNzb3IuaCBcCisgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2FzeW5jL1RDb25jdXJyZW50Q2xpZW50U3luY0luZm8uaCBcCiAgICAgICAgICAgICAgICAgICAgICBzcmMvdGhyaWZ0L2FzeW5jL1RFdmh0dHBDbGllbnRDaGFubmVsLmggXAogICAgICAgICAgICAgICAgICAgICAgc3JjL3RocmlmdC9hc3luYy9URXZodHRwU2VydmVyLmgKIApAQCAtMjIyLDIyICsyNTcsMjYgQEAKICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcXQvVFFJT0RldmljZVRyYW5zcG9ydC5oIFwKICAgICAgICAgICAgICAgICAgIHNyYy90aHJpZnQvcXQvVFFUY3BTZXJ2ZXIuaAogCi1USFJJRlQgPSAkKHRvcF9idWlsZGRpcikvY29tcGlsZXIvY3BwL3RocmlmdAotCiBXSU5ET1dTX0RJU1QgPSBcCi0gICAgICAgICAgICAgUkVBRE1FX1dJTkRPV1MgXAogICAgICAgICAgICAgIHNyYy90aHJpZnQvd2luZG93cyBcCiAgICAgICAgICAgICAgdGhyaWZ0LnNsbiBcCiAgICAgICAgICAgICAgbGlidGhyaWZ0LnZjeHByb2ogXAogICAgICAgICAgICAgIGxpYnRocmlmdC52Y3hwcm9qLmZpbHRlcnMgXAogICAgICAgICAgICAgIGxpYnRocmlmdG5iLnZjeHByb2ogXAotICAgICAgICAgICAgIGxpYnRocmlmdG5iLnZjeHByb2ouZmlsdGVycworICAgICAgICAgICAgIGxpYnRocmlmdG5iLnZjeHByb2ouZmlsdGVycyBcCisgICAgICAgICAgICAgM3JkcGFydHkucHJvcHMKIAogRVhUUkFfRElTVCA9IFwKLSAgICAgICAgICAgICBSRUFETUUgXAotICAgICAgICAgICAgIFJFQURNRS5TU0wgXAorICAgICAgICAgICAgIENNYWtlTGlzdHMudHh0IFwKKyAgICAgICAgICAgICBjb2Rpbmdfc3RhbmRhcmRzLm1kIFwKKyAgICAgICAgICAgICBSRUFETUUubWQgXAogICAgICAgICAgICAgIHRocmlmdC1uYi5wYy5pbiBcCiAgICAgICAgICAgICAgdGhyaWZ0LnBjLmluIFwKICAgICAgICAgICAgICB0aHJpZnQtei5wYy5pbiBcCiAgICAgICAgICAgICAgdGhyaWZ0LXF0LnBjLmluIFwKKyAgICAgICAgICAgICB0aHJpZnQtcXQ1LnBjLmluIFwKKyAgICAgICAgICAgICBzcmMvdGhyaWZ0L3F0L0NNYWtlTGlzdHMudHh0IFwKICAgICAgICAgICAgICAkKFdJTkRPV1NfRElTVCkKKworc3R5bGUtbG9jYWw6CisJJChDUFBTVFlMRV9DTUQpCmRpZmYgLS1naXQgYS9saWIvY3BwL1JFQURNRSBiL2xpYi9jcHAvUkVBRE1FCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCA1NzZkMDE3Li4wMDAwMDAwCi0tLSBhL2xpYi9jcHAvUkVBRE1FCisrKyAvZGV2L251bGwKQEAgLTEsNjcgKzAsMCBAQAotVGhyaWZ0IEMrKyBTb2Z0d2FyZSBMaWJyYXJ5Ci0KLUxpY2Vuc2UKLT09PT09PT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jsKKyAgICAgIGNhc2UgSU5URVJOQUxfRVJST1I6CisgICAgICAgIHJldHVybiAiVEFwcGxpY2F0aW9uRXhjZXB0aW9uOiBJbnRlcm5hbCBlcnJvciI7CisgICAgICBjYXNlIFBST1RPQ09MX0VSUk9SOgorICAgICAgICByZXR1cm4gIlRBcHBsaWNhdGlvbkV4Y2VwdGlvbjogUHJvdG9jb2wgZXJyb3IiOworICAgICAgY2FzZSBJTlZBTElEX1RSQU5TRk9STToKKyAgICAgICAgcmV0dXJuICJUQXBwbGljYXRpb25FeGNlcHRpb246IEludmFsaWQgdHJhbnNmb3JtIjsKKyAgICAgIGNhc2UgSU5WQUxJRF9QUk9UT0NPTDoKKyAgICAgICAgcmV0dXJuICJUQXBwbGljYXRpb25FeGNlcHRpb246IEludmFsaWQgcHJvdG9jb2wiOworICAgICAgY2FzZSBVTlNVUFBPUlRFRF9DTElFTlRfVFlQRToKKyAgICAgICAgcmV0dXJuICJUQXBwbGljYXRpb25FeGNlcHRpb246IFVuc3VwcG9ydGVkIGNsaWVudCB0eXBlIjsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHJldHVybiAiVEFwcGxpY2F0aW9uRXhjZXB0aW9uOiAoSW52YWxpZCBleGNlcHRpb24gdHlwZSkiOwogICAgICAgfTsKICAgICB9IGVsc2UgewogICAgICAgcmV0dXJuIG1lc3NhZ2VfLmNfc3RyKCk7CkBAIC0xMDIsMTQgKzEwMywxMyBAQAogICB1aW50MzJfdCByZWFkKHByb3RvY29sOjpUUHJvdG9jb2wqIGlwcm90KTsKICAgdWludDMyX3Qgd3JpdGUocHJvdG9jb2w6OlRQcm90b2NvbCogb3Byb3QpIGNvbnN0OwogCi0gcHJvdGVjdGVkOgorcHJvdGVjdGVkOgogICAvKioKICAgICogRXJyb3IgY29kZQogICAgKi8KICAgVEFwcGxpY2F0aW9uRXhjZXB0aW9uVHlwZSB0eXBlXzsKLQogfTsKLQotfX0gLy8gYXBhY2hlOjp0aHJpZnQKK30KK30g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Edsb2JhbE91dHB1dC5wcmludGYoInJlY2VpdmVkIGludmFsaWQgbWVzc2FnZSB0eXBlICVkIGZyb20gY2xpZW50IiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgbXR5cGUpOworICAgICAgR2xvYmFsT3V0cHV0LnByaW50ZigicmVjZWl2ZWQgaW52YWxpZCBtZXNzYWdlIHR5cGUgJWQgZnJvbSBjbGllbnQiLCBtdHlwZSk7CiAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCi0gICAgcmV0dXJuIHRoaXMtPmRpc3BhdGNoQ2FsbFRlbXBsYXRlZChpbiwgb3V0LCBmbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcWlkLCBjb25uZWN0aW9uQ29udGV4dCk7CisgICAgcmV0dXJuIHRoaXMtPmRpc3BhdGNoQ2FsbFRlbXBsYXRlZChpbiwgb3V0LCBmbmFtZSwgc2VxaWQsIGNvbm5lY3Rpb25Db250ZXh0KTsKICAgfQogCiAgIC8qKgpAQCAtOTAsMTEgKzg4LDE0IEBACiAgICAqLwogICB2aXJ0dWFsIGJvb2wgZGlzcGF0Y2hDYWxsKGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VFByb3RvY29sKiBpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRQcm90b2NvbCogb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBmbmFtZSwgaW50MzJfdCBzZXFpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgZm5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzZXFpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiBjYWxsQ29udGV4dCkgPSAwOwogCi0gIHZpcnR1YWwgYm9vbCBkaXNwYXRjaENhbGxUZW1wbGF0ZWQoUHJvdG9jb2xfKiBpbiwgUHJvdG9jb2xfKiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGZuYW1lLCBpbnQzMl90IHNlcWlkLAorICB2aXJ0dWFsIGJvb2wgZGlzcGF0Y2hDYWxsVGVtcGxhdGVkKFByb3RvY29sXyogaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHJvdG9jb2xfKiBvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGZuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2VxaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCogY2FsbENvbnRleHQpID0gMDsKIH07CiAKQEAgLTEwMyw5ICsxMDQsOSBAQAogICogcGVyZm9ybSBhIGR5bmFtaWNfY2FzdC4KICAqLwogY2xhc3MgVERpc3BhdGNoUHJvY2Vzc29yIDogcHVibGljIFRQcm9jZXNzb3IgewotIHB1YmxpYzoKLSAgdmlydHVhbCBib29sIHByb2Nlc3MoYm9vc3Q6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4gaW4sCi0gICAgICAgICAgICAgICAgICAgICAgIGJvb3N0OjpzaGFyZWRfcHRyPHByb3RvY29sOjpUUHJvdG9jb2w+IG91dCwKK3B1YmxpYzoKKyAgdmlydHVhbCBib29sIHByb2Nlc3Moc3RkOjpzaGFyZWRfcHRyPHByb3RvY29sOjpUUHJvdG9jb2w+IGluLAorICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4gb3V0LAogICAgICAgICAgICAgICAgICAgICAgICB2b2lkKiBjb25uZWN0aW9uQ29udGV4dCkgewogICAgIHN0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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBmcHJpbnRmKHN0ZGVyciwgIlslcywlZF0gIiBmb3JtYXRfc3RyaW5nICIgXG4iLCBfX0ZJTEVfXywgX19MSU5FX18sICMjX19WQV9BUkdTX18pOyAgICAgICAgICAgIFwKICAgfQogI2Vsc2UKLSAgI2RlZmluZSBUX0RFQlVHKGZvcm1hdF9zdHJpbmcsLi4uKQorI2RlZmluZSBUX0RFQlVHKGZvcm1hdF9zdHJpbmcsIC4uLikKICNlbmRpZgogCi0KIC8qKgotICogYW5hbGFnb3VzIHRvIFRfREVCVUcgYnV0IGFsc28gcHJpbnRzIHRoZSB0aW1lCisgKiBhbmFsb2dvdXMgdG8gVF9ERUJVRyBidXQgYWxzbyBwcmludHMgdGhlIHRpbWUKICAqCiAgKiBAcGFyYW0gc3RyaW5nICBmb3JtYXRfc3RyaW5nIGlucHV0OiBwcmludGYgc3R5bGUgZm9ybWF0IHN0cmluZwogICovCiAjaWYgVF9HTE9CQUxfREVCVUdHSU5HX0xFVkVMID4gMAotICAjZGVmaW5lIFRfREVCVUdfVChmb3JtYXRfc3RyaW5nLC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgIGlmIChUX0dMT0JBTF9ERUJVR0dJTkdfTEVWRUwgPiAwKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICB0aW1lX3Qgbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIGNoYXIgZGJndGltZVsyNl0gOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgdGltZSgmbm93KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBUSFJJRlRfQ1RJTUVfUigmbm93LCBkYmd0aW1lKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBkYmd0aW1lWzI0XSA9ICdcMCc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIGZwcmludGYoc3RkZXJyLCJbJXMsJWRdIFslc10gIiBmb3JtYXRfc3RyaW5nICIgXG4iLCBfX0ZJTEVfXywgX19MSU5FX18sZGJndGltZSwjI19fVkFfQVJHU19fKTsgXAotICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgfQorI2RlZmluZSBUX0RFQlVHX1QoZm9ybWF0X3N0cmluZywgLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChUX0dMT0JBTF9ERUJVR0dJTkdfTEVWRUwgPiAwKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdGltZV90IG5vdzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgY2hhciBkYmd0aW1lWzI2XTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdGltZSgmbm93KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgVEhSSUZUX0NUSU1FX1IoJm5vdywgZGJndGltZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgZGJndGltZVsyNF0gPSAnXDAnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgZnByaW50ZihzdGRlcnIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAiWyVzLCVkXSBbJXNdICIgZm9ybWF0X3N0cmluZyAiIFxuIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICBfX0ZJTEVfXywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICBfX0xJTkVfXywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICBkYmd0aW1lLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAjI19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9CiAjZWxzZQotICAjZGVmaW5lIFRfREVCVUdfVChmb3JtYXRfc3RyaW5nLC4uLikKKyNkZWZpbmUgVF9ERUJVR19UKGZvcm1hdF9zdHJpbmcsIC4uLikKICNlbmRpZgogCi0KIC8qKgotICogYW5hbGFnb3VzIHRvIFRfREVCVUcgYnV0IHVzZXMgaW5wdXQgbGV2ZWwgdG8gZGV0ZXJtaW5lIHdoZXRoZXIgb3Igbm90IHRoZSBzdHJpbmcKKyAqIGFuYWxvZ291cyB0byBUX0RFQlVHIGJ1dCB1c2VzIGlucHV0IGxldmVsIHRvIGRldGVybWluZSB3aGV0aGVyIG9yIG5vdCB0aGUgc3RyaW5nCiAgKiBzaG91bGQgYmUgbG9nZ2VkLgogICoKICAqIEBwYXJhbSBpbnQgICAgIGxldmVsOiBzcGVjaWZpZWQgZGVidWcgbGV2ZWwKICAqIEBwYXJhbSBzdHJpbmcgIGZvcm1hdF9zdHJpbmcgaW5wdXQ6IGZvcm1hdCBzdHJpbmcKICAqLwotI2RlZmluZSBUX0RFQlVHX0wobGV2ZWwsIGZvcm1hdF9zdHJpbmcsLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gIGlmICgobGV2ZWwpID4gMCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBmcHJpbnRmKHN0ZGVyciwiWyVzLCVkXSAiIGZvcm1hdF9zdHJpbmcgIiBcbiIsIF9fRklMRV9fLCBfX0xJTkVfXywjI19fVkFfQVJHU19fKTsgXAorI2RlZmluZSBUX0RFQlVHX0wobGV2ZWwsIGZvcm1hdF9zdHJpbmcsIC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBpZiAoKGxldmVsKSA+IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGZwcmludGYoc3RkZXJyLCAiWyVzLCVkXSAiIGZvcm1hdF9zdHJpbmcgIiBcbiIsIF9fRklMRV9fLCBfX0xJTkVfXywgIyNfX1ZBX0FSR1NfXyk7ICAgICAgICAgICAgXAogICB9CiAKLQogLyoqCiAgKiBFeHBsaWNpdCBlcnJvciBsb2dnaW5nLiBQcmludHMgdGltZSwgZmlsZSBuYW1lIGFuZCBsaW5lIG51bWJlcgogICoKICAqIEBwYXJhbSBzdHJpbmcgIGZvcm1hdF9zdHJpbmcgaW5wdXQ6IHByaW50ZiBzdHlsZSBmb3JtYXQgc3RyaW5nCiAgKi8KLSNkZWZpbmUgVF9FUlJPUihmb3JtYXRfc3RyaW5nLC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB0aW1lX3Qgbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBjaGFyIGRiZ3RpbWVbMjZdIDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB0aW1lKCZub3cpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBUSFJJRlRfQ1RJTUVfUigmbm93LCBkYmd0aW1lKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgZGJndGltZVsyNF0gPSAnXDAnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgZnByaW50ZihzdGRlcnIsIlslcywlZF0gWyVzXSBFUlJPUjogIiBmb3JtYXRfc3RyaW5nICIgXG4iLCBfX0ZJTEVfXywgX19MSU5FX18sZGJndGltZSwjI19fVkFfQVJHU19fKTsgXAorI2RlZmluZSBUX0VSUk9SKGZvcm1hdF9zdHJpbmcsIC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRpbWVfdCBub3c7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGNoYXIgZGJndGltZVsyNl07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRpbWUoJm5vdyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIFRIUklGVF9DVElNRV9SKCZub3csIGRiZ3RpbWUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGRiZ3RpbWVbMjRdID0gJ1wwJzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGZwcmludGYoc3RkZXJyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgIlslcywlZF0gWyVzXSBFUlJPUjogIiBmb3JtYXRfc3RyaW5nICIgXG4iLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgX19GSUxFX18sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgX19MSU5FX18sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgZGJndGltZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgIyNfX1ZBX0FSR1NfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICB9CiAKLQogLyoqCi0gKiBBbmFsYWdvdXMgdG8gVF9FUlJPUiwgYWRkaXRpb25hbGx5IGFib3J0aW5nIHRoZSBwcm9jZXNzLgorICogQW5hbG9nb3VzIHRvIFRfRVJST1IsIGFkZGl0aW9uYWxseSBhYm9ydGluZyB0aGUgcHJvY2Vzcy4KICAqIFdBUk5JTkc6IG1hY3JvIGNhbGxzIGFib3J0KCksIGVuZGluZyBwcm9ncmFtIGV4ZWN1dGlvbgogICoKICAqIEBwYXJhbSBzdHJpbmcgIGZvcm1hdF9zdHJpbmcgaW5wdXQ6IHByaW50ZiBzdHlsZSBmb3JtYXQgc3RyaW5nCiAgKi8KLSNkZWZpbmUgVF9FUlJPUl9BQk9SVChmb3JtYXRfc3RyaW5nLC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB0aW1lX3Qgbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBjaGFyIGRiZ3RpbWVbMjZdIDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB0aW1lKCZub3cpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICBUSFJJRlRfQ1RJTUVfUigmbm93LCBkYmd0aW1lKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgZGJndGltZVsyNF0gPSAnXDAnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgZnByaW50ZihzdGRlcnIsIlslcywlZF0gWyVzXSBFUlJPUjogR29pbmcgdG8gYWJvcnQgIiBmb3JtYXRfc3RyaW5nICIgXG4iLCBfX0ZJTEVfXywgX19MSU5FX18sZGJndGltZSwjI19fVkFfQVJHU19fKTsgXAotICAgIGV4aXQoMSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorI2RlZmluZSBUX0VSUk9SX0FCT1JUKGZvcm1hdF9zdHJpbmcsIC4uLikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRpbWVfdCBub3c7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGNoYXIgZGJndGltZVsyNl07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRpbWUoJm5vdyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIFRIUklGVF9DVElNRV9SKCZub3csIGRiZ3RpbWUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGRiZ3RpbWVbMjRdID0gJ1wwJzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGZwcmludGYoc3RkZXJyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgIlslcywlZF0gWyVzXSBFUlJPUjogR29pbmcgdG8gYWJvcnQgIiBmb3JtYXRfc3RyaW5nICIgXG4iLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgX19GSUxFX18sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgX19MSU5FX18sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgZGJndGltZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgIyNfX1ZBX0FSR1NfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGV4aXQoMSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICB9CiAKLQogLyoqCiAgKiBMb2cgaW5wdXQgbWVzc2FnZQogICoKICAqIEBwYXJhbSBzdHJpbmcgIGZvcm1hdF9zdHJpbmcgaW5wdXQ6IHByaW50ZiBzdHlsZSBmb3JtYXQgc3RyaW5nCiAgKi8KICNpZiBUX0dMT0JBTF9MT0dHSU5HX0xFVkVMID4gMAotICAjZGVmaW5lIFRfTE9HX09QRVIoZm9ybWF0X3N0cmluZywuLi4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgaWYgKFRfR0xPQkFMX0xPR0dJTkdfTEVWRUwgPiAwKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICB0aW1lX3Qgbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBjaGFyIGRiZ3RpbWVbMjZdIDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICB0aW1lKCZub3cpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgICBUSFJJRlRfQ1RJTUVfUigmbm93LCBkYmd0aW1lKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgZGJndGltZVsyNF0gPSAnXDAnOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgZnByaW50ZihzdGRlcnIsIlslc10gIiBmb3JtYXRfc3RyaW5nICIgXG4iLCBkYmd0aW1lLCMjX19WQV9BUkdTX18pOyAgXAotICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIH0KKyNkZWZpbmUgVF9MT0dfT1BFUihmb3JtYXRfc3RyaW5nLCAuLi4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoVF9HTE9CQUxfTE9HR0lOR19MRVZFTCA+IDApIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRpbWVfdCBub3c7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGNoYXIgZGJndGltZVsyNl07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRpbWUoJm5vdyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIFRIUklGVF9DVElNRV9SKCZub3csIGRiZ3RpbWUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGRiZ3RpbWVbMjRdID0gJ1wwJzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGZwcmludGYoc3RkZXJyLCAiWyVzXSAiIGZvcm1hdF9zdHJpbmcgIiBcbiIsIGRiZ3RpbWUsICMjX19WQV9BUkdTX18pOyAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQogI2Vsc2UKLSAgI2RlZmluZSBUX0xPR19PUEVSKGZvcm1hdF9zdHJpbmcsLi4uKQorI2RlZmluZSBUX0xPR19PUEVSKGZvcm1hdF9zdHJpbmcsIC4uLikKICNlbmRpZgogCi0KIC8qKgogICogVF9HTE9CQUxfREVCVUdfVklSVFVBTCA9IDAgb3IgdW5zZXQ6IG5vcm1hbCBvcGVyYXRpb24sCiAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlydHVhbCBjYWxsIGRlYnVnIG1lc3NhZ2VzIGRpc2FibGVkCkBAIC0xNjUsMjkgKzE3MiwyNCBAQAogICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwYWNoZTo6dGhyaWZ0Ojpwcm9maWxlX3ByaW50X2luZm8oKQogICovCiAjaWYgVF9HTE9CQUxfREVCVUdfVklSVFVBTCA+IDEKLSAgI2RlZmluZSBUX1ZJUlRVQUxfQ0FMTCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIDo6YXBhY2hlOjp0aHJpZnQ6OnByb2ZpbGVfdmlydHVhbF9jYWxsKHR5cGVpZCgqdGhpcykpCi0gICNkZWZpbmUgVF9HRU5FUklDX1BST1RPQ09MKHRlbXBsYXRlX2NsYXNzLCBnZW5lcmljX3Byb3QsIHNwZWNpZmljX3Byb3QpIFwKLSAgICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgaWYgKCEoc3BlY2lmaWNfcHJvdCkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIDo6YXBhY2hlOjp0aHJpZnQ6OnByb2ZpbGVfZ2VuZXJpY19wcm90b2NvbCggICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgICAgICB0eXBlaWQoKnRlbXBsYXRlX2NsYXNzKSwgdHlwZWlkKCpnZW5lcmljX3Byb3QpKTsgICAgICAgICAgICAgIFwKLSAgICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIH0gd2hpbGUgKDApCisjZGVmaW5lIFRfVklSVFVBTF9DQUxMKCkgOjphcGFjaGU6OnRocmlmdDo6cHJvZmlsZV92aXJ0dWFsX2NhbGwodHlwZWlkKCp0aGlzKSkKKyNkZWZpbmUgVF9HRU5FUklDX1BST1RPQ09MKHRlbXBsYXRlX2NsYXNzLCBnZW5lcmljX3Byb3QsIHNwZWNpZmljX3Byb3QpICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoIShzcGVjaWZpY19wcm90KSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIDo6YXBhY2hlOjp0aHJpZnQ6OnByb2ZpbGVfZ2VuZXJpY19wcm90b2NvbCh0eXBlaWQoKnRlbXBsYXRlX2NsYXNzKSwgdHlwZWlkKCpnZW5lcmljX3Byb3QpKTsgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKICNlbGlmIFRfR0xPQkFMX0RFQlVHX1ZJUlRVQUwgPT0gMQotICAjZGVmaW5lIFRfVklSVFVBTF9DQUxMKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgZnByaW50ZihzdGRlcnIsIlslcywlZF0gdmlydHVhbCBjYWxsXG4iLCBfX0ZJTEVfXywgX19MSU5FX18pCi0gICNkZWZpbmUgVF9HRU5FUklDX1BST1RPQ09MKHRlbXBsYXRlX2NsYXNzLCBnZW5lcmljX3Byb3QsIHNwZWNpZmljX3Byb3QpIFwKLSAgICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgICAgaWYgKCEoc3BlY2lmaWNfcHJvdCkpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICAgIGZwcmludGYoc3RkZXJyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICAgICAgICAgICAgICAiWyVzLCVkXSBmYWlsZWQgdG8gY2FzdCB0byBzcGVjaWZpYyBwcm90b2NvbCB0eXBlXG4iLCAgICAgXAotICAgICAgICAgICAgICAgIF9fRklMRV9fLCBfX0xJTkVfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0gICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKLSAgICB9IHdoaWxlICgwKQorI2RlZmluZSBUX1ZJUlRVQUxfQ0FMTCgpIGZwcmludGYoc3RkZXJyLCAiWyVzLCVkXSB2aXJ0dWFsIGNhbGxcbiIsIF9fRklMRV9fLCBfX0xJTkVfXykKKyNkZWZpbmUgVF9HRU5FUklDX1BST1RPQ09MKHRlbXBsYXRlX2NsYXNzLCBnZW5lcmljX3Byb3QsIHNwZWNpZmljX3Byb3QpICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoIShzcGVjaWZpY19wcm90KSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGZwcmludGYoc3RkZXJyLCAiWyVzLCVkXSBmYWlsZWQgdG8gY2FzdCB0byBzcGVjaWZpYyBwcm90b2NvbCB0eXBlXG4iLCBfX0ZJTEVfXywgX19MSU5FX18pOyAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKICNlbHNlCi0gICNkZWZpbmUgVF9WSVJUVUFMX0NBTEwoKQotICAjZGVmaW5lIFRfR0VORVJJQ19QUk9UT0NPTCh0ZW1wbGF0ZV9jbGFzcywgZ2VuZXJpY19wcm90LCBzcGVjaWZpY19wcm90KQorI2RlZmluZSBUX1ZJUlRVQUxfQ0FMTCgpCisjZGVmaW5lIFRfR0VORVJJQ19QUk9UT0NPTCh0ZW1wbGF0ZV9jbGFzcywgZ2VuZXJpY19wcm90LCBzcGVjaWZpY19wcm90KQogI2VuZGlmCiAKICNlbmRpZiAvLyAjaWZuZGVmIF9USFJJRlRfVExPR0dJTkdfSF8KZGlmZiAtLWdpdCBhL2xpYi9jcHAvc3JjL3RocmlmdC9UT3V0cHV0LmNwcCBiL2xpYi9jcHAvc3JjL3RocmlmdC9UT3V0cHV0LmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5hZTNhOWUyCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2NwcC9zcmMvdGhyaWZ0L1RPdXRwdXQuY3BwCkBAIC0wLDAgKzEsMTI2IEBACisvK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gaWYgKG51bUNhbGxlcnNfID49IDApIHsKICAgICAgIG1lbWNweShjYWxsZXJzXywgYnQuY2FsbGVyc18sIG51bUNhbGxlcnNfICogc2l6ZW9mKHZvaWQqKSk7CiAgICAgfQogICB9CiAKLSAgYm9vbCBvcGVyYXRvcj09KEJhY2t0cmFjZSBjb25zdCAmYnQpIGNvbnN0IHsKLSAgICByZXR1cm4gKGNtcChidCkgPT0gMCk7Ci0gIH0KKyAgYm9vbCBvcGVyYXRvcj09KEJhY2t0cmFjZSBjb25zdCYgYnQpIGNvbnN0IHsgcmV0dXJuIChjbXAoYnQpID09IDApOyB9CiAKICAgc2l6ZV90IGhhc2goKSBjb25zdCB7CiAgICAgaW50cHRyX3QgcmV0ID0gMDsKQEAgLTgzLDggKzgxLDggQEAKICAgICB9CiAKICAgICBmb3IgKGludCBuID0gMDsgbiA8IG51bUNhbGxlcnNfOyArK24pIHsKLSAgICAgIGludCBkaWZmID0gcmVpbnRlcnByZXRfY2FzdDxpbnRwdHJfdD4oY2FsbGVyc19bbl0pIC0KLSAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxpbnRwdHJfdD4oYnQuY2FsbGVyc19bbl0pOworICAgICAgaW50IGRpZmYgPSByZWludGVycHJldF9jYXN0PGludHB0cl90PihjYWxsZXJzX1tuXSkKKyAgICAgICAgICAgICAgICAgLSByZWludGVycHJldF9jYXN0PGludHB0cl90PihidC5jYWxsZXJzX1tuXSk7CiAgICAgICBpZiAoZGlmZiAhPSAwKSB7CiAgICAgICAgIHJldHVybiBkaWZmOwogICAgICAgfQpAQCAtOTMsOCArOTEsOCBAQAogICAgIHJldHVybiAwOwogICB9CiAKLSAgdm9pZCBwcmludChGSUxFICpmLCBpbnQgaW5kZW50PTAsIGludCBzdGFydD0wKSBjb25zdCB7Ci0gICAgY2hhciAqKnN0cmluZ3MgPSBiYWNrdHJhY2Vfc3ltYm9scyhjYWxsZXJzXywgbnVtQ2FsbGVyc18pOworICB2b2lkIHByaW50KEZJTEUqI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9IHByb3RvY29sOjpUX09ORVdBWSkgewotICAgICAgR2xvYmFsT3V0cHV0LnByaW50ZigicmVjZWl2ZWQgaW52YWxpZCBtZXNzYWdlIHR5cGUgJWQgZnJvbSBjbGllbnQiLAotICAgICAgICAgICAgICAgICAgICAgICAgICBtdHlwZSk7CisgICAgICBHbG9iYWxPdXRwdXQucHJpbnRmKCJyZWNlaXZlZCBpbnZhbGlkIG1lc3NhZ2UgdHlwZSAlZCBmcm9tIGNsaWVudCIsIG10eXBlKTsKICAgICAgIF9yZXR1cm4oZmFsc2UpOwogICAgICAgcmV0dXJuOwogICAgIH0KQEAgLTg2LDEzICs4NywxNSBAQAogICAgIHJldHVybiB0aGlzLT5kaXNwYXRjaENhbGxUZW1wbGF0ZWQoX3JldHVybiwgaW4sIG91dCwgZm5hbWUsIHNlcWlkKTsKICAgfQogCi0gIHZpcnR1YWwgdm9pZCBkaXNwYXRjaENhbGwoYXBhY2hlOjp0aHJpZnQ6OnN0ZGN4eDo6ZnVuY3Rpb248dm9pZChib29sIG9rKT4gX3JldHVybiwKKyAgdmlydHVhbCB2b2lkIGRpc3BhdGNoQ2FsbChzdGQ6OmZ1bmN0aW9uPHZvaWQoYm9vbCBvayk+IF9yZXR1cm4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUUHJvdG9jb2wqIGluLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VFByb3RvY29sKiBvdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGZuYW1lLCBpbnQzMl90IHNlcWlkKSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGZuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc2VxaWQpID0gMDsKIAotICB2aXJ0dW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NvbnN0IHN0ZDo6c3RyaW5nJiBwYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIGFkZHJlc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0IGV2ZW50X2Jhc2UqIGViLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBldmRuc19iYXNlKiBkbnNiYXNlKQogCi1URXZodHRwQ2xpZW50Q2hhbm5lbDo6VEV2aHR0cENsaWVudENoYW5uZWwoCi0gICAgY29uc3Qgc3RkOjpzdHJpbmcmIGhvc3QsCi0gICAgY29uc3Qgc3RkOjpzdHJpbmcmIHBhdGgsCi0gICAgY29uc3QgY2hhciogYWRkcmVzcywKLSAgICBpbnQgcG9ydCwKLSAgICBzdHJ1Y3QgZXZlbnRfYmFzZSogZWIpCi0gIDogaG9zdF8oaG9zdCkKLSAgLCBwYXRoXyhwYXRoKQotICAsIHJlY3ZCdWZfKE5VTEwpCi0gICwgY29ubl8oTlVMTCkKLXsKLSAgY29ubl8gPSBldmh0dHBfY29ubmVjdGlvbl9uZXcoYWRkcmVzcywgcG9ydCk7CisgIDogaG9zdF8oaG9zdCksIHBhdGhfKHBhdGgpLCBjb25uXyhOVUxMKSB7CisgIGNvbm5fID0gZXZodHRwX2Nvbm5lY3Rpb25fYmFzZV9uZXcoZWIsIGRuc2Jhc2UsIGFkZHJlc3MsIHBvcnQpOwogICBpZiAoY29ubl8gPT0gTlVMTCkgewogICAgIHRocm93IFRFeGNlcHRpb24oImV2aHR0cF9jb25uZWN0aW9uX25ldyBmYWlsZWQiKTsKICAgfQotICBldmh0dHBfY29ubmVjdGlvbl9zZXRfYmFzZShjb25uXywgZWIpOwogfQogCi0KIFRFdmh0dHBDbGllbnRDaGFubmVsOjp+VEV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Bldmh0dHBfc2VuZF9yZXBseShyZXEsIEhUVFBfSU5URVJOQUwsIGUud2hhdCgpLCAwKTsKICAgfQogfQogCi0KIHZvaWQgVEV2aHR0cFNlcnZlcjo6cHJvY2VzcyhzdHJ1Y3QgZXZodHRwX3JlcXVlc3QqIHJlcSkgewogICBSZXF1ZXN0Q29udGV4dCogY3R4ID0gbmV3IFJlcXVlc3RDb250ZXh0KHJlcSk7Ci0gIHJldHVybiBwcm9jZXNzb3JfLT5wcm9jZXNzKAotICAgICAgYXBhY2hlOjp0aHJpZnQ6OnN0ZGN4eDo6YmluZCgKLSAgICAgICAgJlRFdmh0dHBTZXJ2ZXI6OmNvbXBsZXRlLAotICAgICAgICB0aGlzLAotICAgICAgICBjdHgsCi0gICAgICAgIGFwYWNoZTo6dGhyaWZ0OjpzdGRjeHg6OnBsYWNlaG9sZGVyczo6XzEpLAotICAgICAgY3R4LT5pYnVmLAotICAgICAgY3R4LT5vYnVmKTsKKyAgcmV0dXJuIHByb2Nlc3Nvcl8tPnByb2Nlc3Moc3RkOjpiaW5kKCZURXZodHRwU2VydmVyOjpjb21wbGV0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN0eCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnBsYWNlaG9sZGVyczo6XzEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdHgtPmlidWYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN0eC0+b2J1Zik7CiB9CiAKLQogdm9pZCBURXZodHRwU2VydmVyOjpjb21wbGV0ZShSZXF1ZXN0Q29udGV4dCogY3R4LCBib29sIHN1Y2Nlc3MpIHsKLSAgKHZvaWQpIHN1Y2Nlc3M7Ci0gIHN0Z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JhdGUgPSBwcm9maWxpbmdTYW1wbGVSYXRlOwogICBtdXRleFByb2ZpbGluZ0NhbGxiYWNrID0gY2FsbGJhY2s7CiB9CiAKLSNkZWZpbmUgUFJPRklMRV9NVVRFWF9TVEFSVF9MT0NLKCkgXAotICAgIGludDY0X3QgX2xvY2tfc3RhcnRUaW1lID0gbWF5YmVHZXRQcm9maWxpbmdTdGFydFRpbWUoKTsKKyNkZWZpbmUgUFJPRklMRV9NVVRFWF9TVEFSVF9MT0NLKCkgaW50NjRfdCBfbG9ja19zdGFydFRpbWUgPSBtYXliZUdldFByb2ZpbGluZ1N0YXJ0VGltZSgpOwogCi0jZGVmaW5lIFBST0ZJTEVfTVVURVhfTk9UX0xPQ0tFRCgpIFwKLSAgZG8geyBcCi0gICAgaWYgKF9sb2NrX3N0YXJ0VGltZSA+IDApIHsgXAotICAgICAgaW50NjRfdCBlbmRUaW1lID0gVXRpbDo6Y3VycmVudFRpbWVVc2VjKCk7IFwKLSAgICAgICgqbXV0ZXhQcm9maWxpbmdDYWxsYmFjaykodGhpcywgZW5kVGltZSAtIF9sb2NrX3N0YXJ0VGltZSk7IFwKLSAgICB9IFwKKyNkZWZpbmUgUFJPRklMRV9NVVRFWF9OT1RfTE9DS0VEKCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoX2xvY2tfc3RhcnRUaW1lID4gMCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGludDY0X3QgZW5kVGltZSA9IFV0aWw6OmN1cnJlbnRUaW1lVXNlYygpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICgqbXV0ZXhQcm9maWxpbmdDYWxsYmFjaykodGhpcywgZW5kVGltZSAtIF9sb2NrX3N0YXJ0VGltZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgfSB3aGlsZSAoMCkKIAotI2RlZmluZSBQUk9GSUxFX01VVEVYX0xPQ0tFRCgpIFwKLSAgZG8geyBcCi0gICAgcHJvZmlsZVRpbWVfID0gX2xvY2tfc3RhcnRUaW1lOyBcCi0gICAgaWYgKHByb2ZpbGVUaW1lXyA+IDApIHsgXAotICAgICAgcHJvZmlsZVRpbWVfID0gVXRpbDo6Y3VycmVudFRpbWVVc2VjKCkgLSBwcm9maWxlVGltZV87IFwKLSAgICB9IFwKKyNkZWZpbmUgUFJPRklMRV9NVVRFWF9MT0NLRUQoKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBwcm9maWxlVGltZV8gPSBfbG9ja19zdGFydFRpbWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAocHJvZmlsZVRpbWVfID4gMCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHByb2ZpbGVUaW1lXyA9IFV0aWw6OmN1cnJlbnRUaW1lVXNlYygpIC0gcHJvZmlsZVRpbWVfOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgfSB3aGlsZSAoMCkKIAotI2RlZmluZSBQUk9GSUxFX01VVEVYX1NUQVJUX1VOTE9DSygpIFwKLSAgaW50NjRfdCBfdGVtcF9wcm9maWxlVGltZSA9IHByb2ZpbGVUaW1lXzsgXAorI2RlZmluZSBQUk9GSUxFX01VVEVYX1NUQVJUX1VOTE9DSygpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBpbnQ2NF90IF90ZW1wX3Byb2ZpbGVUaW1lID0gcHJvZmlsZVRpbWVfOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICBwcm9maWxlVGltZV8gPSAwOwogCi0jZGVmaW5lIFBST0ZJTEVfTVVURVhfVU5MT0NLRUQoKSBcCi0gIGRvIHsgXAotICAgIGlmIChfdGVtcF9wcm9maWxlVGltZSA+IDApIHsgXAotICAgICAgKCptdXRleFByb2ZpbGluZ0NhbGxiYWNrKSh0aGlzLCBfdGVtcF9wcm9maWxlVGltZSk7IFwKLSAgICB9IFwKKyNkZWZpbmUgUFJPRklMRV9NVVRFWF9VTkxPQ0tFRCgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoX3RlbXBfcHJvZmlsZVRpbWUgPiAwKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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pdHkgPD0gSElHSEVTVCkgewotICAgICAgcmV0dXJuIChpbnQpKG1pbl9wcmlvcml0eSArIHN0ZXBzcGVycXVhbnRhICogcHJpb3JpdHkpOwotICAgIH0gZWxzZSB7Ci0gICAgICAvLyBzaG91bGQgbmV2ZXIgZ2V0IGhlcmUgZm9yIHByaW9yaXR5IGluY3JlbWVudHMuCi0gICAgICBhc3NlcnQoZmFsc2UpOwotICAgICAgcmV0dXJuIChpbnQpKG1pbl9wcmlvcml0eSArIHN0ZXBzcGVycXVhbnRhICogTk9STUFMKTsKLSAgICB9CisgIGlmIChwcmlvcml0eSA8PSBQb3NpeFRocmVhZEZhY3Rvcnk6OkhJR0hFU1QpIHsKKyAgICByZXR1cm4gKGludCkobWluX3ByaW9yaXR5ICsgc3RlcHNwZXJxdWFudGEgKiBwcmlvcml0eSk7CisgIH0gZWxzZSB7CisgICAgLy8gc2hvdWxkIG5ldmVyIGdldCBoZXJlIGZvciBwcmlvcml0eSBpbmNyZW1lbnRzLgorICAgIGFzc2VydChmYWxzZSk7CisgICAgcmV0dXJuIChpbnQpKG1pbl9wcmlvcml0eSArIHN0ZXBzcGVycXVhbnRhICogUG9zaXhUaHJlYWRGYWN0b3J5OjpOT1JNQUwpOwogICB9Cit9CiAKLSBwdWJsaWM6Ci0KLSAgSW1wbChQT0xJQ1kgcG9saWN5LCBQUklPUklUWSBwcmlvcml0eSwgaW50IHN0YWNrU2l6ZSwgYm9vbCBkZXRhY2hlZCkgOgorUG9zaXhUaHJlYWRGYWN0b3J5OjpQb3NpeFRocmVhZEZhY3RvcnkoUE9MSUNZIHBvbGljeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBSSU9SSVRZIHByaW9yaXR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YWNrU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgZGV0YWNoZWQpCisgIDogVGh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0YWNrU2l6ZV87IH0KK3N0ZDo6c2hhcmVkX3B0cjxUaHJlYWQ+IFBvc2l4VGhyZWFkRmFjdG9yeTo6bmV3VGhyZWFkKHN0ZDo6c2hhcmVkX3B0cjxSdW5uYWJsZT4gcnVubmFibGUpIGNvbnN0IHsKKyAgc3RkOjpzaGFyZWRfcHRyPFB0aHJlYWRUaHJlYWQ+IHJlc3VsdAorICAgICAgPSBzdGQ6OnNoYXJlZF9wdHI8UHRocmVhZFRocmVhZD4obmV3IFB0aHJlYWRUaHJlYWQodG9QdGhyZWFkUG9saWN5KHBvbGljeV8pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvUHRocmVhZFByaW9yaXR5KHBvbGljeV8sIHByaW9yaXR5XyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tTaXplXywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0RldGFjaGVkKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVubmFibGUpKTsKKyAgcmVzdWx0LT53ZWFrUmVmKHJlc3VsdCk7CisgIHJ1bm5hYmxlLT50aHJlYWQocmVzdWx0KTsKKyAgcmV0dXJuIHJlc3VsdDsKK30KIAotICB2b2lkIHNldFN0YWNrU2l6ZShpbnQgdmFsdWUpIHsgc3RhY2tTaXplXyA9IHZhbHVlOyB9CitpbnQgUG9zaXhUaHJlYWRGYWN0b3J5OjpnZXRTdGFja1NpemUoKSBjb25zdCB7CisgIHJldHVybiBzdGFja1NpemVfOworfQogCi0gIFBSSU9SSVRZIGdldFByaW9yaXR5KCkgY29uc3QgeyByZXR1cm4gcHJpb3JpdHlfOyB9Cit2b2lkIFBvc2l4VGhyZWFkRmFjdG9yeTo6c2V0U3RhY2tTaXplKGludCB2YWx1ZSkgeworICBzdGFja1NpemVfID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ZyBkaWZmZXJlbnQgY29uZGl0aW9ucworICogaG93ZXZlciB0aGV5IGFsbCBzaGFyZSB0aGUgc2FtZSBtdXRleF8uCisgKgogICogQHZlcnNpb24gJElkOiQKICAqLwotY2xhc3MgVGhyZWFkTWFuYWdlcjo6SW1wbCA6IHB1YmxpYyBUaHJlYWRNYW5hZ2VyICB7CitjbGFzcyBUaHJlYWRNYW5hZ2VyOjpJbXBsIDogcHVibGljIFRocmVhZE1hbmFnZXIgewogCi0gcHVibGljOgotICBJbXBsKCkgOgotICAgIHdvcmtlckNvdW50XygwKSwKLSAgICB3b3JrZXJNYXhDb3VudF8oMCksCi0gICAgaWRsZUNvdW50XygwKSwKLSAgICBwZW5kaW5nVGFza0NvdW50TWF4XygwKSwKLSAgICBleHBpcmVkQ291bnRfKDApLAotICAgIHN0YXRlXyhUaHJlYWRNYW5hZ2VyOjpVTklOSVRJQUxJWkVEKSwKLSAgICBtb25pdG9yXygmbXV0ZXhfKSwKLSAgICBtYXhNb25pdG9yXygmbXV0ZXhfKSB7fQorcHVibGljOgorICBJbXBsKCkKKyAgICA6IHdvcmtlckNvdW50XygwKSwKKyAgICAgIHdvcmtlck1heENvdW50XygwKSwKKyAgICAgIGlkbGVDb3VudF8oMCksCisgICAgICBwZW5kaW5nVGFza0NvdW50TWF4XygwKSwKKyAgICAgIGV4cGlyZWRDb3VudF8oMCksCisgICAgICBzdGF0ZV8oVGhyZWFkTWFuYWdlcjo6VU5JTklUSUFMSVpFRCksCisgICAgICBtb25pdG9yXygmbXV0ZXhfKSwKKyAgICAgIG1heE1vbml0b3JfKCZtdXRleF8pLAorICAgICAgd29ya2VyTW9uaXRvcl8oJm11dGV4Xykge30KIAogICB+SW1wbCgpIHsgc3RvcCgpOyB9CiAKICAgdm9pZCBzdGFydCgpOworICB2b2lkIHN0b3AoKTsKIAotICB2b2lkIHN0b3AoKSB7IHN0b3BJbXBsKGZhbHNlKTsgfQotCi0gIHZvaWQgam9pbigpIHsgc3RvcEltcGwodH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G1hbmFnZXIKKyAgICAgICAgKiAodGVjaG5pY2FsbHkgd2UncmUgbm90aWZ5aW5nIHRoZSBuZXh0IGJsb2NrZWQgdGhyZWFkIGJ1dCBldmVudHVhbGx5CisgICAgICAgICogdGhlIG1hbmFnZXIgd2lsbCBzZWUgaXQuCisgICAgICAgICovCisgICAgICBhY3RpdmUgPSBpc0FjdGl2ZSgpOworCisgICAgICB3aGlsZSAoYWN0aXZlICYmIG1hbmFnZXJfLT50YXNrc18uZW1wdHkoKSkgeworICAgICAgICBtYW5hZ2VyXy0+aWRsZUNvdW50XysrOworICAgICAgICBtYW5hZ2VyXy0+bW9uaXRvcl8ud2FpdCgpOworICAgICAgICBhY3RpdmUgPSBpc0FjdGl2ZSgpOworICAgICAgICBtYW5hZ2VyXy0+aWRsZUNvdW50Xy0tOworICAgICAgfQorCisgICAgICBzaGFyZWRfcHRyPFRocmVhZE1hbmFnZXI6OlRhc2s+IHRhc2s7CisKKyAgICAgIGlmIChhY3RpdmUpIHsKKyAgICAgICAgaWYgKCFtYW5hZ2VyXy0+dGFza3NfLmVtcHR5KCkpIHsKKyAgICAgICAgICB0YXNrID0gbWFuYWdlcl8tPnRhc2tzXy5mcm9udCgpOworICAgICAgICAgIG1hbmFnZXJfLT50YXNrc18ucG9wX2Zyb250KCk7CisgICAgICAgICAgaWYgKHRhc2stPnN0YXRlXyA9PSBUaHJlYWRNYW5hZ2VyOjpUYXNrOjpXQUlUSU5HKSB7CisgICAgICAgICAgICAvLyBJZiB0aGUgc3RhdGUgaXMgY2hhbmdlZCB0byBhbnl0aGluZyBvdGhlciB0aGFuIEVYRUNVVElORyBvciBUSU1FRE9VVCBoZXJlCisgICAgICAgICAgICAvLyB0aGVuIHRoZSBleGVjdXRpb24gbG9vcCBuZWVkcyB0byBiZSBjaGFuZ2VkIGJlbG93LgorICAgICAgICAgICAgdGFzay0+c3RhdGVfID0KKyAgICAgICAgICAgICAgICAodGFzay0+Z2V0RXhwaXJlVGltZSgpICYmIHRhc2stPmdldEV4cGlyZVRpbWUoKSA8IFV0aWw6OmN1cnJlbnRUaW1lKCkpID8KKyAgICAgICAgICAgICAgICAgICAgVGhyZWFkTWFuYWdlcjo6VGFzazo6VElNRURPVVQgOgorICAgICAgICAgICAgICAgICAgICBUaHJlYWRNYW5hZ2VyOjpUYXNrOjpFWEVDVVRJTkc7CisgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyogSWYgd2UgaGF2ZSBhIHBlbmRpbmcgdGFzayBtYXggYW5kIHdlIGp1c3QgZHJvcHBlZCBiZWxvdyBpdCwgd2FrZXVwIGFueQorICAgICAgICAgICAgdGhyZWFkIHRoYXQgbWlnaHQgYmUgYmxvY2tlZCBvbiBhZGQuICovCisgICAgICAgIGlmIChtYW5hZ2VyXy0+cGVuZGluZ1Rhc2tDb3VudE1heF8gIT0gMAorICAgICAgICAgICAgJiYgbWFuYWdlcl8tPnRhc2tzXy5zaXplKCkgPD0gbWFuYWdlcl8tPnBlbmRpbmdUYXNrQ291bnRNYXhfIC0gMSkgeworICAgICAgICAgIG1hbmFnZXJfLT5tYXhNb25pdG9yXy5ub3RpZnkoKTsKKyAgICAgICAgfQorICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEV4ZWN1dGlvbiAtIG5vdCBob2xkaW5nIGEgbG9jaworICAgICAgICovCisgICAgICBpZiAodGFzaykgeworICAgICAgICBpZiAodGFzay0+c3RhdGVfID09IFRocmVhZE1hbmFnZXI6OlRhc2s6OkVYRUNVVElORykgeworCisgICAgICAgICAgLy8gUmVsZWFzZSB0aGUgbG9jayBzbyB3ZSBjYW4gcnVuIHRoZSB0YXNrIHdpdGhvdXQgYmxvY2tpbmcgdGhlIHRocmVhZCBtYW5hZ2VyCisgICAgICAgICAgbWFuYWdlcl8tPm11dGV4Xy51bmxvY2soKTsKKworICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICB0YXNrLT5ydW4oKTsKKyAgICAgICAgICB9IGNhdGNoIChjb25zdCBzdGQ6OmV4Y2VwdGlvbiYgZSkgeworICAgICAgICAgICAgR2xvYmFsT3V0cHV0LnByaW50ZigiW0VSUk9SXSB0YXNrLT5ydW4oKSByYWlzZWQgYW4gZXhjZXB0aW9uOiAlcyIsIGUud2hhdCgpKTsKKyAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgIEdsb2JhbE91dHB1dC5wcmludGYoIltFUlJPUl0gdGFzay0+cnVuKCkgcmFpc2VkIGFuIHVua25vd24gZXhjZXB0aW9uIik7CisgICAgICAgICAgfQorCisgICAgICAgICAgLy8gUmUtYWNxdWlyZSB0aGUgbG9jayB0byBwcm9jZWVkIGluIHRoZSB0aHJlYWQgbWFuYWdlcgorICAgICAgICAgIG1hbmFnZXJfLT5tdXRleF8ubG9jaygpOworCisgICAgICAgIH0gZWxzZSBpZiAobWFuYWdlcl8tPmV4cGlyZUNhbGxiYWNrXykgeworICAgICAgICAgIC8vIFRoZSBvbmx5IG90aGVyIHN0YXRlIHRoZSB0YXNrIGNvdWxkIGhhdmUgYmVlbiBpbiBpcyBUSU1FRE9VVCAoc2VlIGFib3ZlKQorICAgICAgICAgIG1hbmFnZXJfLT5leHBpcmVDYWxsYmFja18odGFzay0+Z2V0UnVubmFibGUoKSk7CisgICAgICAgICAgbWFuYWdlcl8tPmV4cGlyZWRDb3VudF8rKzsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbmFsIGFjY291bnRpbmcgZm9yIHRoZSB3b3JrZXIgdGhyZWFkIHRoYXQgaXMgZG9uZSB3b3JraW5nCisgICAgICovCisgICAgbWFuYWdlcl8tPmRlYWRXb3JrZXJzXy5pbnNlcnQodGhpcy0+dGhyZWFkKCkpOworICAgIGlmICgtLW1hbmFnZXJfLT53b3JrZXJDb3VudF8gPT0gbWFuYWdlcl8tPndvcmtlck1heENvdW50XykgeworICAgICAgbWFuYWdlcl8tPndvcmtlck1vbml0b3JfLm5vdGlmeSgpOworICAgIH0KIC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OlRhc2s+IHRhc2sgPSB0YXNrc18uZnJvbnQoKTsKLSAgICBpZiAodGFzay0+Z2V0RXhwaXJlVGltZSgpID09IDBMTCkgewotICAgICAgYnJlYWs7Ci0gICAgfQorICBmb3IgKFRhc2tRdWV1ZTo6aXRlcmF0b3IgaXQgPSB0YXNrc18uYmVnaW4oKTsgaXQgIT0gdGFza3NfLmVuZCgpOyApCisgIHsKICAgICBpZiAobm93ID09IDBMTCkgewogICAgICAgbm93ID0gVXRpbDo6Y3VycmVudFRpbWUoKTsKICAgICB9Ci0gICAgaWYgKHRhc2stPmdldEV4cGlyZVRpbWUoKSA+IG5vdykgewotICAgICAgYnJlYWs7CisKKyAgICBpZiAoKCppdCktPmdldEV4cGlyZVRpbWUoKSA+IDBMTCAmJiAoKml0KS0+Z2V0RXhwaXJlVGltZSgpIDwgbm93KSB7CisgICAgICBpZiAoZXhwaXJlQ2FsbGJhY2tfKSB7CisgICAgICAgIGV4cGlyZUNhbGxiYWNrXygoKml0KS0+Z2V0UnVubmFibGUoKSk7CisgICAgICB9CisgICAgICBpdCA9IHRhc2tzXy5lcmFzZShpdCk7CisgICAgICArK2V4cGlyZWRDb3VudF87CisgICAgICBpZiAoanVzdE9uZSkgeworICAgICAgICByZXR1cm47CisgICAgICB9CiAgICAgfQotICAgIGlmIChleHBpcmVDYWxsYmFja18pIHsKLSAgICAgIGV4cGlyZUNhbGxiYWNrXyh0YXNrLT5nZXRSdW5uYWJsZSgpKTsKKyAgICBlbHNlCisgICAgeworICAgICAgKytpdDsKICAgICB9Ci0gICAgdGFza3NfLnBvcCgpOwotICAgIGV4cGlyZWRDb3VudF8rKzsKICAgfQogfQogCi0KIHZvaWQgVGhyZWFkTWFuYWdlcjo6SW1wbDo6c2V0RXhwaXJlQ2FsbGJhY2soRXhwaXJlQ2FsbGJhY2sgZXhwaXJlQ2FsbGJhY2spIHsKKyAgR3VhcmQgZyhtdXRleF8pOwogICBleHBpcmVDYWxsYmFja18gPSBleHBpcmVDYWxs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pbGUgKG1hbmFnZXJfLT5zdGF0ZV8gPT0gVGltZXJNYW5hZ2VyOjpTVEFSVEVEICYmCi0gICAgICAgICAgICAgICAoZXhwaXJlZFRhc2tFbmQgPSBtYW5hZ2VyXy0+dGFza01hcF8udXBwZXJfYm91bmQobm93KSkgPT0gbWFuYWdlcl8tPnRhc2tNYXBfLmJlZ2luKCkpIHsKKyAgICAgICAgd2hpbGUgKG1hbmFnZXJfLT5zdGF0ZV8gPT0gVGltZXJNYW5hZ2VyOjpTVEFSVEVECisgICAgICAgICAgICAgICAmJiAoZXhwaXJlZFRhc2tFbmQgPSBtYW5hZ2VyXy0+dGFza01hcF8udXBwZXJfYm91bmQobm93KSkKKyAgICAgICAgICAgICAgICAgID09IG1hbmFnZXJfLT50YXNrTWFwXy5iZWdpbigpKSB7CiAgICAgICAgICAgaW50NjRfdCB0aW1lb3V0ID0gMExMOwogICAgICAgICAgIGlmICghbWFuYWdlcl8tPnRhc2tNYXBfLmVtcHR5KCkpIHsKICAgICAgICAgICAgIHRpbWVvdXQgPSBtYW5hZ2VyXy0+dGFza01hcF8uYmVnaW4oKS0+Zmlyc3QgLSBub3c7CiAgICAgICAgICAgfQotICAgICAgICAgIGFzc2VydCgodGltZW91dCAhPSAwICYmIG1hbmFnZXJfLT50YXNrQ291bnRfID4gMCkgfHwgKHRpbWVvdXQgPT0gMCAmJiBtYW5hZ2VyXy0+dGFza0NvdW50XyA9PSAwKSk7CisgICAgICAgICAgYXNzZXJ0KCh0aW1lb3V0ICE9IDAgJiYgbWFuYWdlcl8tPnRhc2tDb3VudF8gPiAwKQorICAgICAgICAgICAgICAgICB8fCAodGltZW91dCA9PSAwICYmIG1hbmFnZXJfLT50YXNrQ291bnRfID09IDApKTsKICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgbWFuYWdlcl8tPm1vbml0b3JfLndhaXQodGltZW91dCk7Ci0gICAgICAgICAgfSBjYXRjaCAoVGltZWRPdXRFeGNlcHRpb24gJikge30KKyAgICAgICAgICB9IGNhdGNoIChUaW1lZE91dEV4Y2VwdGlvbiYpIHsKKyAgICAgICAgICB9CiAgICAgICAgICAgbm93ID0gVXRpbDo6Y3VycmVudFRpbWUoKTsKICAgICAgICAgfQogCkBAIC0xMTAsNiArMTExLDcgQEAKICAgICAgICAgICBmb3IgKHRhc2tfaXRlcmF0b3IgaXggPSBtYW5hZ2VyXy0+dGFza01hcF8uYmVnaW4oKTsgaXggIT0gZXhwaXJlZFRhc2tFbmQ7IGl4KyspIHsKICAgICAgICAgICAgIHNoYXJlZF9wdHI8VGltZXJNYW5hZ2VyOjpUYXNrPiB0YXNrID0gaXgtPnNlY29uZDsKICAgICAgICAgICAgIGV4cGlyZWRUYXNrcy5pbnNlcnQodGFzayk7CisgICAgICAgICAgICB0YXNrLT5pdF8gPSBtYW5hZ2VyXy0+dGFza01hcF8uZW5kKCk7CiAgICAgICAgICAgICBpZiAodGFzay0+c3RhdGVfID09IFRpbWVyTWFuYWdlcjo6VGFzazo6V0FJVElORykgewogICAgICAgICAgICAgICB0YXNrLT5zdGF0ZV8gPSBUaW1lck1hbmFnZXI6OlRhc2s6OkVYRUNVVElORzsKICAgICAgICAgICAgIH0KQEAgLTExOSw3ICsxMjEsOSBAQAogICAgICAgICB9CiAgICAgICB9CiAKLSAgICAgIGZvciAoc3RkOjpzZXQ8c2hhcmVkX3B0cjxUYXNrPiA+OjppdGVyYXRvciBpeCA9ICBleHBpcmVkVGFza3MuYmVnaW4oKTsgaXggIT0gZXhwaXJlZFRhc2tzLmVuZCgpOyBpeCsrKSB7CisgICAgICBmb3IgKHN0ZDo6c2V0PHNoYXJlZF9wdHI8VGFzaz4gPjo6aXRlcmF0b3IgaXggPSBleHBpcmVkVGFza3MuYmVnaW4oKTsKKyAgICAgICAgICAgaXggIT0gZXhwaXJlZFRhc2tzLmVuZCgpOworICAgICAgICAgICArK2l4KSB7CiAgICAgICAgICgqaXgpLT5ydW4oKTsKICAgICAgIH0KIApAQCAtMTM1LDIwICsxMzksMj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gZnJlcXVlbmN5X21hcF87Ci0gIH0KKyAgY29uc3Qgc3RkOjptYXA8c3RkOjpzdHJpbmcsIGludDY0X3Q+JiBnZXRfZnJlcXVlbmN5X21hcCgpIHsgcmV0dXJuIGZyZXF1ZW5jeV9tYXBfOyB9CiAKIHByb3RlY3RlZDoKICAgdm9pZCBwcmludEFuZFBhc3NUb0J1ZmZlcihhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRUeXBlIGZ0eXBlKSB7CiAgICAgc3dpdGNoIChmdHlwZSkgewotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfQk9PTDoKLSAgICAgICAgewotICAgICAgICAgIGJvb2wgYm9vbHY7Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZEJvb2woYm9vbHYpOwotICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgIHByaW50ZigiJWQiLCBib29sdik7Ci0gICAgICAgICAgfQorICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0JPT0w6IHsKKyAgICAgIGJvb2wgYm9vbHY7CisgICAgICBwaXByb3RfLT5yZWFkQm9vbChib29sdik7CisgICAgICBpZiAocHJpbnRfKSB7CisgICAgICAgIHByaW50ZigiJWQiLCBib29sdik7CisgICAgICB9CisgICAgfSBicmVhazsKKyAgICBjYXNlIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VF9CWVRFOiB7CisgICAgICBpbnQ4X3QgYnl0ZXY7CisgICAgICBwaXByb3RfLT5yZWFkQnl0ZShieXRldik7CisgICAgICBpZiAocHJpbnRfKSB7CisgICAgICAgIHByaW50ZigiJWQiLCBieXRldik7CisgICAgICB9CisgICAgfSBicmVhazsKKyAgICBjYXNlIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VF9JMTY6IHsKKyAgICAgIGludDE2X3QgaTE2OworICAgICAgcGlwcm90Xy0+cmVhZEkxNihpMTYpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIiVkIiwgaTE2KTsKKyAgICAgIH0KKyAgICB9IGJyZWFrOworICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0kzMjogeworICAgICAgaW50MzJfdCBpMzI7CisgICAgICBwaXByb3RfLT5yZWFkSTMyKGkzMik7CisgICAgICBpZiAocHJpbnRfKSB7CisgICAgICAgIHByaW50ZigiJWQiLCBpMzIpOworICAgICAgfQorICAgIH0gYnJlYWs7CisgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfSTY0OiB7CisgICAgICBpbnQ2NF90IGk2NDsKKyAgICAgIHBpcHJvdF8tPnJlYWRJNjQoaTY0KTsKKyAgICAgIGlmIChwcmludF8pIHsKKyAgICAgICAgcHJpbnRmKCIlbGQiLCBpNjQpOworICAgICAgfQorICAgIH0gYnJlYWs7CisgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfRE9VQkxFOiB7CisgICAgICBkb3VibGUgZHViOworICAgICAgcGlwcm90Xy0+cmVhZERvdWJsZShkdWIpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIiVmIiwgZHViKTsKKyAgICAgIH0KKyAgICB9IGJyZWFrOworICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX1NUUklORzogeworICAgICAgc3RkOjpzdHJpbmcgc3RyOworICAgICAgcGlwcm90Xy0+cmVhZFN0cmluZyhzdHIpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIiVzIiwgc3RyLmNfc3RyKCkpOworICAgICAgfQorICAgIH0gYnJlYWs7CisgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfU1RSVUNUOiB7CisgICAgICBzdGQ6OnN0cmluZyBuYW1lOworICAgICAgaW50MTZfdCBmaWQ7CisgICAgICBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRUeXBlIGZ0eXBlOworICAgICAgcGlwcm90Xy0+cmVhZFN0cnVjdEJlZ2luKG5hbWUpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIjwiKTsKKyAgICAgIH0KKyAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIHBpcHJvdF8tPnJlYWRGaWVsZEJlZ2luKG5hbWUsIGZ0eXBlLCBmaWQpOworICAgICAgICBpZiAoZnR5cGUgPT0gYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX1NUT1ApIHsKKyAgICAgICAgICBicmVhazsKICAgICAgICAgfQotICAgICAgICBicmVhazsKLSAgICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0JZVEU6Ci0gICAgICAgIHsKLSAgICAgICAgICBpbnQ4X3QgYnl0ZXY7Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZEJ5dGUoYnl0ZXYpOwotICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgIHByaW50ZigiJWQiLCBieXRldik7Ci0gICAgICAgICAgfQorICAgICAgICBwcmludEFuZFBhc3NUb0J1ZmZlcihmdHlwZSk7CisgICAgICAgIGlmIChwcmludF8pIHsKKyAgICAgICAgICBwcmludGYoIiwiKTsKICAgICAgICAgfQotICAgICAgICBicmVhazsKLSAgICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0kxNjoKLSAgICAgICAgewotICAgICAgICAgIGludDE2X3QgaTE2OwotICAgICAgICAgIHBpcHJvdF8tPnJlYWRJMTYoaTE2KTsKLSAgICAgICAgICBpZiAocHJpbnRfKSB7Ci0gICAgICAgICAgICBwcmludGYoIiVkIiwgaTE2KTsKLSAgICAgICAgICB9CisgICAgICAgIHBpcHJvdF8tPnJlYWRGaWVsZEVuZCgpOworICAgICAgfQorICAgICAgcGlwcm90Xy0+cmVhZFN0cnVjdEVuZCgpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIlxiPiIpOworICAgICAgfQorICAgIH0gYnJlYWs7CisgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfTUFQOiB7CisgICAgICBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRUeXBlIGtleVR5cGU7CisgICAgICBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRUeXBlIHZhbFR5cGU7CisgICAgICB1aW50MzJfdCBpLCBzaXplOworICAgICAgcGlwcm90Xy0+cmVhZE1hcEJlZ2luKGtleVR5cGUsIHZhbFR5cGUsIHNpemUpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoInsiKTsKKyAgICAgIH0KKyAgICAgIGZvciAoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgcHJpbnRBbmRQYXNzVG9CdWZmZXIoa2V5VHlwZSk7CisgICAgICAgIGlmIChwcmludF8pIHsKKyAgICAgICAgICBwcmludGYoIj0+Iik7CiAgICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgICBjYXNlIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VF9JMzI6Ci0gICAgICAgIHsKLSAgICAgICAgICBpbnQzMl90IGkzMjsKLSAgICAgICAgICBwaXByb3RfLT5yZWFkSTMyKGkzMik7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCIlZCIsIGkzMik7Ci0gICAgICAgICAgfQorICAgICAgICBwcmludEFuZFBhc3NUb0J1ZmZlcih2YWxUeXBlKTsKKyAgICAgICAgaWYgKHByaW50XykgeworICAgICAgICAgIHByaW50ZigiLCIpOwogICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfSTY0OgotICAgICAgICB7Ci0gICAgICAgICAgaW50NjRfdCBpNjQ7Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZEk2NChpNjQpOwotICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgIHByaW50ZigiJWxkIiwgaTY0KTsKLSAgICAgICAgICB9CisgICAgICB9CisgICAgICBwaXByb3RfLT5yZWFkTWFwRW5kKCk7CisgICAgICBpZiAocHJpbnRfKSB7CisgICAgICAgIHByaW50ZigiXGJ9Iik7CisgICAgICB9CisgICAgfSBicmVhazsKKyAgICBjYXNlIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VF9TRVQ6IHsKKyAgICAgIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VFR5cGUgZWxlbVR5cGU7CisgICAgICB1aW50MzJfdCBpLCBzaXplOworICAgICAgcGlwcm90Xy0+cmVhZFNldEJlZ2luKGVsZW1UeXBlLCBzaXplKTsKKyAgICAgIGlmIChwcmludF8pIHsKKyAgICAgICAgcHJpbnRmKCJ7Iik7CisgICAgICB9CisgICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKGVsZW1UeXBlKTsKKyAgICAgICAgaWYgKHByaW50XykgeworICAgICAgICAgIHByaW50ZigiLCIpOwogICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfRE9VQkxFOgotICAgICAgICB7Ci0gICAgICAgICAgZG91YmxlIGR1YjsKLSAgICAgICAgICBwaXByb3RfLT5yZWFkRG91YmxlKGR1Yik7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCIlZiIsIGR1Yik7Ci0gICAgICAgICAgfQorICAgICAgfQorICAgICAgcGlwcm90Xy0+cmVhZFNldEVuZCgpOworICAgICAgaWYgKHByaW50XykgeworICAgICAgICBwcmludGYoIlxifSIpOworICAgICAgfQorICAgIH0gYnJlYWs7CisgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfTElTVDogeworICAgICAgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUVHlwZSBlbGVtVHlwZTsKKyAgICAgIHVpbnQzMl90IGksIHNpemU7CisgICAgICBwaXByb3RfLT5yZWFkTGlzdEJlZ2luKGVsZW1UeXBlLCBzaXplKTsKKyAgICAgIGlmIChwcmludF8pIHsKKyAgICAgICAgcHJpbnRmKCJbIik7CisgICAgICB9CisgICAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKGVsZW1UeXBlKTsKKyAgICAgICAgaWYgKHByaW50XykgeworICAgICAgICAgIHByaW50ZigiLCIpOwogICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfU1RSSU5HOgotICAgICAgICB7Ci0gICAgICAgICAgc3RkOjpzdHJpbmcgc3RyOwotICAgICAgICAgIHBpcHJvdF8tPnJlYWRTdHJpbmcoc3RyKTsKLSAgICAgICAgICBpZiAocHJpbnRfKSB7Ci0gICAgICAgICAgICBwcmludGYoIiVzIiwgc3RyLmNfc3RyKCkpOwotICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBicmVhazsKLSAgICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX1NUUlVDVDoKLSAgICAgICAgewotICAgICAgICAgIHN0ZDo6c3RyaW5nIG5hbWU7Ci0gICAgICAgICAgaW50MTZfdCBmaWQ7Ci0gICAgICAgICAgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUVHlwZSBmdHlwZTsKLSAgICAgICAgICBwaXByb3RfLT5yZWFkU3RydWN0QmVnaW4obmFtZSk7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCI8Iik7Ci0gICAgICAgICAgfQotICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICBwaXByb3RfLT5yZWFkRmllbGRCZWdpbihuYW1lLCBmdHlwZSwgZmlkKTsKLSAgICAgICAgICAgIGlmIChmdHlwZSA9PSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfU1RPUCkgewotICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKGZ0eXBlKTsKLSAgICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgICAgcHJpbnRmKCIsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBwaXByb3RfLT5yZWFkRmllbGRFbmQoKTsKLSAgICAgICAgICB9Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZFN0cnVjdEVuZCgpOwotICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgIHByaW50ZigiXGI+Iik7Ci0gICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfTUFQOgotICAgICAgICB7Ci0gICAgICAgICAgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUVHlwZSBrZXlUeXBlOwotICAgICAgICAgIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VFR5cGUgdmFsVHlwZTsKLSAgICAgICAgICB1aW50MzJfdCBpLCBzaXplOwotICAgICAgICAgIHBpcHJvdF8tPnJlYWRNYXBCZWdpbihrZXlUeXBlLCB2YWxUeXBlLCBzaXplKTsKLSAgICAgICAgICBpZiAocHJpbnRfKSB7Ci0gICAgICAgICAgICBwcmludGYoInsiKTsKLSAgICAgICAgICB9Ci0gICAgICAgICAgZm9yIChpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgcHJpbnRBbmRQYXNzVG9CdWZmZXIoa2V5VHlwZSk7Ci0gICAgICAgICAgICBpZiAocHJpbnRfKSB7Ci0gICAgICAgICAgICAgIHByaW50ZigiPT4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKHZhbFR5cGUpOwotICAgICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgICBwcmludGYoIiwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICB9Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZE1hcEVuZCgpOwotICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgIHByaW50ZigiXGJ9Iik7Ci0gICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfU0VUOgotICAgICAgICB7Ci0gICAgICAgICAgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUVHlwZSBlbGVtVHlwZTsKLSAgICAgICAgICB1aW50MzJfdCBpLCBzaXplOwotICAgICAgICAgIHBpcHJvdF8tPnJlYWRTZXRCZWdpbihlbGVtVHlwZSwgc2l6ZSk7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCJ7Iik7Ci0gICAgICAgICAgfQotICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKLSAgICAgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKGVsZW1UeXBlKTsKLSAgICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgICAgcHJpbnRmKCIsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgfQotICAgICAgICAgIHBpcHJvdF8tPnJlYWRTZXRFbmQoKTsKLSAgICAgICAgICBpZiAocHJpbnRfKSB7Ci0gICAgICAgICAgICBwcmludGYoIlxifSIpOwotICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBicmVhazsKLSAgICAgIGNhc2UgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0xJU1Q6Ci0gICAgICAgIHsKLSAgICAgICAgICBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRUeXBlIGVsZW1UeXBlOwotICAgICAgICAgIHVpbnQzMl90IGksIHNpemU7Ci0gICAgICAgICAgcGlwcm90Xy0+cmVhZExpc3RCZWdpbihlbGVtVHlwZSwgc2l6ZSk7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCJbIik7Ci0gICAgICAgICAgfQotICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKLSAgICAgICAgICAgIHByaW50QW5kUGFzc1RvQnVmZmVyKGVsZW1UeXBlKTsKLSAgICAgICAgICAgIGlmIChwcmludF8pIHsKLSAgICAgICAgICAgICAgcHJpbnRmKCIsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgfQotICAgICAgICAgIHBpcHJvdF8tPnJlYWRMaXN0RW5kKCk7Ci0gICAgICAgICAgaWYgKHByaW50XykgewotICAgICAgICAgICAgcHJpbnRmKCJcYl0iKTsKLSAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgICBkZWZhdWx0OgotICAgICAgICBicmVhazsKKyAgICAgIH0KKyAgICAgIHBpcHJvdF8tPnJlYWRMaXN0RW5kKCk7CisgICAgICBpZiAocHJpbnRfKSB7CisgICAgICAgIHByaW50ZigiXGJdIik7CisgICAgICB9CisgICAgfSBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgYnJlYWs7CiAgICAgfQogICB9CiAKLSAgYm9vc3Q6OnNoYXJlZF9wdHI8YXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUUHJvdG9jb2w+IHBpcHJvdF87CisgIHN0ZDo6c2hhcmVkX3B0cjxhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRQcm90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2VQcm90b2NvbCA6IHB1YmxpYyBUUHJvdG9jb2xEZWNvcmF0b3IKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgIHB1YmxpYzoKLSAgICAgICAgICAgICAgICBTdG9yZWRNZXNzYWdlUHJvdG9jb2woIHNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4gX3Byb3RvY29sLAotICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgX25hbWUsIGNvbnN0IFRNZXNzYWdlVHlwZSBfdHlwZSwgCi0gICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgX3NlcWlkKSA6Ci0gICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbERlY29yYXRvcihfcHJvdG9jb2wpLAotICAgICAgICAgICAgICAgICAgICBuYW1lKF9uYW1lKSwKLSAgICAgICAgICAgICAgICAgICAgdHlwZShfdHlwZSksCi0gICAgICAgICAgICAgICAgICAgIHNlcWlkKF9zZXFpZCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgfQorICB1aW50MzJfdCByZWFkTWVzc2FnZUJlZ2luX3ZpcnQoc3RkOjpzdHJpbmcmIF9uYW1lLCBUTWVzc2FnZVR5cGUmIF90eXBlLCBpbnQzMl90JiBfc2VxaWQpIHsKIAotICAgICAgICAgICAgICAgIHVpbnQzMl90IHJlYWRNZXNzYWdlQmVnaW5fdmlydChzdGQ6OnN0cmluZyYgX25hbWUsIFRNZXNzYWdlVHlwZSYgX3R5cGUsIGludDMyX3QmIF9zZXFpZCkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICBfbmFtZSAgPSBuYW1lOwotICAgICAgICAgICAgICAgICAgICBfdHlwZSAgPSB0eXBlOwotICAgICAgICAgICAgICAgICAgICBfc2VxaWQgPSBzZXFpZDsKKyAgICBfbmFtZSA9IG5hbWU7CisgICAgX3R5cGUgPSB0eXBlOworICAgIF9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SBbaW5dIHNlcnZpY2VOYW1lIE5hbWUgb2YgYSBzZXJ2aWNlLCBoYXMgdG8gYmUgaWRlbnRpY2FsIHRvIHRoZSBuYW1lCi0gICAgICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBkZWNsYXJlZCBpbiB0aGUgVGhyaWZ0IElETCwgZS5nLiAiV2VhdGhlclJlcG9ydCIuCi0gICAgICAgICAgICAgKiBccGFyYW0gW2luXSBwcm9jZXNzb3IgICBJbXBsZW1lbnRhdGlvbiBvZiBhIHNlcnZpY2UsIHVzdXNhbGx5IHJlZmVycmVkIHRvCi0gICAgICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICBhcyAiaGFuZGxlcnMiLCBlLmcuIFdlYXRoZXJSZXBvcnRIYW5kbGVyLAotICAgICAgICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgaW1wbGVtZW50aW5nIFdlYXRoZXJSZXBvcnRJZiBpbnRlcmZhY2UuCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIHZvaWQgcmVnaXN0ZXJQcm9jZXNzb3IoIGNvbnN0IHN0ZDo6c3RyaW5nICYgc2VydmljZU5hbWUsIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkX3B0cjxUUHJvY2Vzc29yPiBwcm9jZXNzb3IgKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHNlcnZpY2VzW3NlcnZpY2VOYW1lXSA9IHByb2Nlc3NvcjsKLSAgICAgICAgICAgIH0KKyAgLyoqCisgICAgKiAnUmVnaXN0ZXInIGEgc2VydmljZSB3aXRoIHRoaXMgPGNvZGU+VE11bHRpcGxleGVkUHJvY2Vzc29yPC9jb2RlPi4gIFRoaXMKKyAgICAqIGFsbG93cyB1cyB0byBicm9rZXIgcmVxdWVzdHMgdG8gaW5kaXZpZHVhbCBzZXJ2aWNlcyBieSB1c2luZyB0aGUgc2VydmljZQorICAgICogbmFtZSB0byBzZWxlY3QgdGhl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vbGk+Ci0gICAgICAgICAgICAgKiAgICAgPGxpPlVzaW5nIHRoZSBzZXJ2aWNlIG5hbWUgdG8gbG9jYXRlIHRoZSBhcHByb3ByaWF0ZSBwcm9jZXNzb3IuPC9saT4KLSAgICAgICAgICAgICAqICAgICA8bGk+RGlzcGF0Y2ggdG8gdGhlIHByb2Nlc3Nvciwgd2l0aCBhIGRlY29yYXRlZCBpbnN0YW5jZSBvZiBUUHJvdG9jb2wKLSAgICAgICAgICAgICAqICAgICAgICAgdGhhdCBhbGxvd3MgcmVhZE1lc3NhZ2VCZWdpbigpIHRvIHJldHVybiB0aGUgb3JpZ2luYWwgVE1lc3NhZ2UuPC9saT4KLSAgICAgICAgICAgICAqIDwvb2w+Ci0gICAgICAgICAgICAgKiAgCi0gICAgICAgICAgICAgKiBcdGhyb3dzIFRFeGNlcHRpb24gSWYgdGhlIG1lc3NhZ2UgdHlwZSBpcyBub3QgVF9DQUxMIG9yIFRfT05FV0FZLCBpZgotICAgICAgICAgICAgICogdGhlIHNlcnZpY2UgbmFtZSB3YXMgbm90IGZvdW5kIGluIHRoZSBtZXNzYWdlLCBvciBpZiB0aGUgc2VydmljZQotICAgICAgICAgICAgICogbmFtZSB3YXMgbm90IGZvdW5kIGluIHRoZSBzZXJ2aWNlIG1hcC4gCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGJvb2wgcHJvY2Vzcyggc2hhcmVkX3B0cjxwcm90b2NvbDo6VFByb3RvY29sPiBpbiwgCi0gICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4gb3V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICpjb25uZWN0aW9uQ29udGV4dCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBuYW1lOwotICAgICAgICAgICAgICAgIHByb3RvY29sOjpUTWVzc2FnZVR5cGUgdHlwZTsKLSAgICAgICAgICAgICA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V4cGVjdGVkIG1lc3NhZ2UgdHlwZS4gCi0gICAgICAgICAgICAgICAgICAgIGluLT5za2lwKDo6YXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX1NUUlVDVCk7Ci0gICAgICAgICAgICAgICAgICAgIGluLT5yZWFkTWVzc2FnZUVuZCgpOwotICAgICAgICAgICAgICAgICAgICBpbi0+Z2V0VHJhbnNwb3J0KCktPnJlYWRFbmQoKTsKLSAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgbXNnKCJUTXVsdGlwbGV4ZWRQcm9jZXNzb3I6IFVuZXhwZWN0ZWQgbWVzc2FnZSB0eXBlIik7Ci0gICAgICAgICAgICAgICAgICAgIDo6YXBhY2hlOjp0aHJpZnQ6OlRBcHBsaWNhdGlvbkV4Y2VwdGlvbiB4KAotICAgICAgICAgICAgICAgICAgICAgICAgOjphcGFjaGU6OnRocmlmdDo6VEFwcGxpY2F0aW9uRXhjZXB0aW9uOjpQUk9UT0NPTF9FUlJPUiwgCi0gICAgICAgICAgICAgICAgICAgICAgICBtc2cpOwotICAgICAgICAgICAgICAgICAgICBvdXQtPndyaXRlTWVzc2FnZUJlZ2luKG5hbWUsIDo6YXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUX0VYQ0VQVElPTiwgc2VxaWQpOwotICAgICAgICAgICAgICAgICAgICB4LndyaXRlKG91dC5nZXQoKSk7Ci0gICAgICAgICAgICAgICAgICAgIG91dC0+d3JpdGVNZXNzYWdlRW5kKCk7Ci0gICAgICAgICAgICAgICAgICAgIG91dC0+Z2V0VHJhbnNwb3J0KCktPndyaXRlRW5kKCk7Ci0gICAgICAgICAgICAgICAgICAgIG91dC0+Z2V0VHJhbnNwb3J0KCktPmZsdXNoKCk7Ci0gICAgICAgICAgICAgICAgICAgIHRocm93IFRFeGNlcHRpb24obXNnKTsKLSAgICAgICAgICAgICAgICB9CisgICAgLy8gVXNlIHRoZSBhY3R1YWwgdW5kZXJseWluZyBw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ljZXNfdDo6aXRlcmF0b3IgaXQgPSBzZXJ2aWNlcy5maW5kKHRva2Vuc1swXSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYoIGl0ICE9IHNlcnZpY2VzLmVuZCgpICkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkX3B0cjxUUHJvY2Vzc29yPiBwcm9jZXNzb3IgPSBpdC0+c2Vjb25kOwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gTGV0IHRoZSBwcm9jZXNzb3IgcmVnaXN0ZXJlZCBmb3IgdGhpcyBzZXJ2aWNlIG5hbWUgCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBwcm9jZXNzIHRoZSBtZXNzYWdlLgotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb2Nlc3Nvci0+cHJvY2VzcyggCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkX3B0cjxwcm90b2NvbDo6VFByb3RvY29sPiggCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBwcm90b2NvbDo6U3RvcmVkTWVzc2FnZVByb3RvY29sKCBpbiwgdG9rZW5zWzFdLCB0eXBlLCBzZXFpZCApICksIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dCwgY29ubmVjdGlvbkNvbnRleHQgKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFVua25vd24gc2VydmljZS4gCi0gICAgICAgICAgICAgICAgICAgICAgICBpbi0+c2tpcCg6OmFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbDo6VF9TVFJVQ1QpOwotICAgICAgICAgICAgICAgICAgICAgICAgaW4tPnJlYWRNZXNzYWdlRW5kKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbi0+Z2V0VHJhbnNwb3J0KCktPnJlYWRFbmQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgbXNnKCJUTXVsdGlwbGV4ZWRQcm9jZXNzb3I6IFVua25vd24gc2VydmljZTogIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtc2cgKz0gdG9rZW5zWzBdOwotICAgICAgICAgICAgICAgICAgICAgICAgOjphcGFjaGU6OnRocmlmdDo6VEFwcGxpY2F0aW9uRXhjZXB0aW9uIHgoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgOjphcGFjaGU6OnRocmlmdDo6VEFwcGxpY2F0aW9uRXhjZXB0aW9uOjpQUk9UT0NPTF9FUlJPUiwgCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbXNnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG91dC0+d3JpdGVNZXNzYWdlQmVnaW4obmFtZSwgOjphcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRfRVhDRVBUSU9OLCBzZXFpZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB4LndyaXRlKG91dC5nZXQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBvdXQtPndyaXRlTWVzc2FnZUVuZCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgb3V0LT5nZXRUcmFuc3BvcnQoKS0+d3JpdGVFbmQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG91dC0+Z2V0VHJhbnNwb3J0KCktPmZsdXNoKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtc2cgKz0gIi4gRGlkIHlvdSBmb3JnZXQgdG8gY2FsbCByZWdpc3RlclByb2Nlc3NvcigpPyI7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBURXhjZXB0aW9uKG1zZyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotIC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2VzX3Q6Oml0ZXJhdG9yIGl0ID0gc2VydmljZXMuZmluZCh0b2tlbnNbMF0pOworCisgICAgICBpZiAoaXQgIT0gc2VydmljZXMuZW5kKCkpIHsKKyAgICAgICAgc3RkOjpzaGFyZWRfcHRyPFRQcm9jZXNzb3I+IHByb2Nlc3NvciA9IGl0LT5zZWNvbmQ7CisgICAgICAgIC8vIExldCB0aGUgcHJvY2Vzc29yIHJlZ2lzdGVyZWQgZm9yIHRoaXMgc2VydmljZSBuYW1lCisgICAgICAgIC8vIHByb2Nlc3MgdGhlIG1lc3NhZ2UuCisgICAgICAgIHJldHVybiBwcm9jZXNzb3IKKyAgICAgICAgICAgIC0+cHJvY2VzcyhzdGQ6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBwcm90b2NvbDo6U3RvcmVkTWVzc2FnZVByb3RvY29sKGluLCB0b2tlbnNbMV0sIHR5cGUsIHNlcWlkKSksCisgICAgICAgICAgICAgICAgICAgICAgb3V0LAorICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb25Db250ZXh0KTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIC8vIFVua25vd24gc2VydmljZS4KKyAgICAgICAgdGhyb3cgcHJvdG9jb2xfZXJyb3IoaW4sIG91dCwgbmFtZSwgc2VxaWQsIAorICAgICAgICAgICAgIlVua25vd24gc2VydmljZTogIiArIHRva2Vuc1swXSArCisJCQkJIi4gRGlkIHlvdSBmb3JnZXQgdG8gY2FsbCByZWdpc3RlclByb2Nlc3NvcigpPyIpOworICAgICAgfQorICAgIH0gZWxzZSBpZiAodG9rZW5zLnNpemUoKSA9PSAxKSB7CisJICBpZiAoZGVmYXVsdFByb2Nlc3NvcikgeworICAgICAgICAvLyBub24tbXVsdGlwbGV4ZWQgY2xpZW50IGZvcndhcmRzIHRvIGRlZmF1bHQgcHJvY2Vzc29yCisgICAgICAgIHJldHVybiBkZWZh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MHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4M2UsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHgzZiwKKyAgICAweDM0LAorICAgIDB4MzUsCisgICAgMHgzNiwKKyAgICAweDM3LAorICAgIDB4MzgsCisgICAgMHgzOSwKKyAgICAweDNhLAorICAgIDB4M2IsCisgICAgMHgzYywKKyAgICAweDNkLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHgwMCwKKyAgICAweDAxLAorICAgIDB4MDIsCisgICAgMHgwMywKKyAgICAweDA0LAorICAgIDB4MDUsCisgICAgMHgwNiwKKyAgICAweDA3LAorICAgIDB4MDgsCisgICAgMHgwOSwKKyAgICAweDBhLAorICAgIDB4MGIsCisgICAgMHgwYywKKyAgICAweDBkLAorICAgIDB4MGUsCisgICAgMHgwZiwKKyAgICAweDEwLAorICAgIDB4MTEsCisgICAgMHgxMiwKKyAgICAweDEzLAorICAgIDB4MTQsCisgICAgMHgxNSwKKyAgICAweDE2LAorICAgIDB4MTcsCisgICAgMHgxOCwKKyAgICAweDE5LAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4MWEsCisgICAgMHgxYiwKKyAgICAweDFjLAorICAgIDB4MWQsCisgICAgMHgxZSwKKyAgICAweDFmLAorICAgIDB4MjAsCisgICAgMHgyMSwKKyAgICAweDIyLAorICAgIDB4MjMsCisgICAgMHgyNCwKKyAgICAweDI1LAorICAgIDB4MjYsCisgICAgMHgyNywKKyAgICAweDI4LAorICAgIDB4MjksCisgICAgMHgyYSwKKyAgICAweDJiLAorICAgIDB4MmMsCisgICAgMHgyZCwKKyAgICAweDJlLAorICAgIDB4MmYsCisgICAgMHgzMCwKKyAgICAweDMxLAorICAgIDB4MzIsCisgICAgMHgzMywKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAorICAgIDB4ZmYsCisgICAgMHhmZiwKKyAgICAweGZmLAogfTsKIAotdm9pZCBiYXNlNjRfZGVjb2RlKHVpbnQ4X3QgKmJ1ZiwgdWludDMyX3QgbGVuKSB7Ci0gIGJ1ZlswXSA9IChrQmFzZTY0RGVjb2RlVGFibGVbYnVmWzBdXSA8PCAyKSB8Ci0gICAgICAgICAgIChrQmFzZTY0RGVjb2RlVGFibGVbYnVmWzFdXSA+PiA0KTsKK3ZvaWQgYmFzZTY0X2RlY29kZSh1aW50OF90KiBidWYsIHVpbnQzMl90IGxlbikgeworICBidWZbMF0gPSA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GltaXRfID0gY29udGFpbmVyX2xpbWl0OwotICB9CisgIHZvaWQgc2V0Q29udGFpbmVyU2l6ZUxpbWl0KGludDMyX3QgY29udGFpbmVyX2xpbWl0KSB7IGNvbnRhaW5lcl9saW1pdF8gPSBjb250YWluZXJfbGltaXQ7IH0KIAogICB2b2lkIHNldFN0cmljdChib29sIHN0cmljdF9yZWFkLCBib29sIHN0cmljdF93cml0ZSkgewogICAgIHN0cmljdF9yZWFkXyA9IHN0cmljdF9yZWFkOwpAQCAtOTUsMjIgKzgwLDE3IEBACiAKICAgLypvbCovIHVpbnQzMl90IHdyaXRlTWVzc2FnZUVuZCgpOwogCi0KICAgaW5saW5lIHVpbnQzMl90IHdyaXRlU3RydWN0QmVnaW4oY29uc3QgY2hhciogbmFtZSk7CiAKICAgaW5saW5lIHVpbnQzMl90IHdyaXRlU3RydWN0RW5kKCk7CiAKLSAgaW5saW5lIHVpbnQzMl90IHdyaXRlRmllbGRCZWdpbihjb25zdCBjaGFyKiBuYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIGZpZWxkVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnQxNl90IGZpZWxkSWQpOworICBpbmxpbmUgdWludDMyX3Qgd3JpdGVGaWVsZEJlZ2luKGNvbnN0IGNoYXIqIG5hbWUsIGNvbnN0IFRUeXBlIGZpZWxkVHlwZSwgY29uc3QgaW50MTZfdCBmaWVsZElkKTsKIAogICBpbmxpbmUgdWludDMyX3Qgd3JpdGVGaWVsZEVuZCgpOwogCiAgIGlubGluZSB1aW50MzJfdCB3cml0ZUZpZWxkU3RvcCgpOwogCi0gIGlubGluZSB1aW50MzJfdCB3cml0ZU1hcEJlZ2luKGNvbnN0IFRUeXBlIGtleVR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIHZhbFR5cGUsCi0gICAgICAgICAgICAgICAgICA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eW5hbWljX3BvaW50ZXJfY2FzdDxUcmFuc3BvcnRfPih0cmFucyk7CisgIHN0ZDo6c2hhcmVkX3B0cjxUUHJvdG9jb2w+IGdldFByb3RvY29sKHN0ZDo6c2hhcmVkX3B0cjxUVHJhbnNwb3J0PiB0cmFucykgeworICAgIHN0ZDo6c2hhcmVkX3B0cjxUcmFuc3BvcnRfPiBzcGVjaWZpY190cmFucyA9IHN0ZDo6ZHluYW1pY19wb2ludGVyX2Nhc3Q8VHJhbnNwb3J0Xz4odHJhbnMpOwogICAgIFRQcm90b2NvbCogcHJvdDsKICAgICBpZiAoc3BlY2lmaWNfdHJhbnMpIHsKLSAgICAgIHByb3QgPSBuZXcgVEJpbmFyeVByb3RvY29sVDxUcmFuc3BvcnRfPihzcGVjaWZpY190cmFucywgc3RyaW5nX2xpbWl0XywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXJfbGltaXRfLCBzdHJpY3RfcmVhZF8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaWN0X3dyaXRlXyk7CisgICAgICBwcm90ID0gbmV3IFRCaW5hcnlQcm90b2NvbFQ8VHJhbnNwb3J0XywgQnl0ZU9yZGVyXz4oc3BlY2lmaWNfdHJhbnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nX2xpbWl0XywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXJfbGltaXRfLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmljdF9yZWFkXywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpY3Rfd3JpdGVfKTsKICAgICB9IGVsc2UgewotICAgICAgcHJvdCA9IG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnMsIHN0cmluZ19saW1pdF8sIGNvbnRhaW5lcl9saW1pdF8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpY3RfcmVhZF8sIHN0cmljdF93cml0ZV8pOworICAgICAgcHJvdCA9IG5ldyBUQmluYXJ5UHJvdG9jb2xUPFRUcmFuc3BvcnQsIEJ5dGVPcmRlcl8+KHRyYW5zLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZ19saW1pdF8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyX2xpbWl0XywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpY3RfcmVhZF8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaWN0X3dyaXRlXyk7CiAgICAgfQogCi0gICAgcmV0dXJuIGJvb3N0OjpzaGFyZWRfcHRyPFRQcm90b2NvbD4ocHJvdCk7CisgICAgcmV0dXJuIHN0ZDo6c2hhcmVkX3B0cjxUUHJvdG9jb2w+KHByb3QpOwogICB9CiAKLSBwcml2YXRlOgorcHJpdmF0ZToKICAgaW50MzJfdCBzdHJpbmdfbGltaXRfOwogICBpbnQzMl90IGNvbnRhaW5lcl9saW1pdF87CiAgIGJvb2wgc3RyaWN0X3JlYWRfOwogICBib29sIHN0cmljdF93cml0ZV87Ci0KIH07CiAKIHR5cGVkZWYgVEJpbmFyeVByb3RvY29sRmFjdG9yeVQ8VFRyYW5zcG9ydD4gVEJpbmFyeVByb3RvY29sRmFjdG9yeTsKLQotfX19IC8vIGFwYWNoZTo6dGhyaWZ0Ojpwcm90b2NvbAordHlwZWRlZiBUQmluYXJ5UHJvdG9jb2xGYWN0b3J5VDxUVH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IAotdGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8+Ci11aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8+Ojp3cml0ZU1hcEJlZ2luKGNvbnN0IFRUeXBlIGtleVR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIHZhbFR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IHNpemUpIHsKK3RlbXBsYXRlIDxjbGFzcyBUcmFuc3BvcnRfLCBjbGFzcyBCeXRlT3JkZXJfPgordWludDMyX3QgVEJpbmFyeVByb3RvY29sVDxUcmFuc3BvcnRfLCBCeXRlT3JkZXJfPjo6d3JpdGVNYXBCZWdpbihjb25zdCBUVHlwZSBrZXlUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVHlwZSB2YWxUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCBzaXplKSB7CiAgIHVpbnQzMl90IHdzaXplID0gMDsKICAgd3NpemUgKz0gd3JpdGVCeXRlKChpbnQ4X3Qpa2V5VHlwZSk7CiAgIHdzaXplICs9IHdyaXRlQnl0ZSgoaW50OF90KXZhbFR5cGUpOwpAQCAtOTYsODkgKzk2LDg4IEBACiAgIHJldHVybiB3c2l6ZTsKIH0KIAotdGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8+Ci11aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8+Ojp3cml0ZU1hcEVuZCgpIHsKK3RlbXBsYXRlIDxjbGFzcyBUcmFuc3BvcnRfLCBjbGFzcyBCeXRlT3JkZXJfPgordWludDM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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUTWVzc2FnZVR5cGUmIG1lc3NhZ2VUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQzMl90JiBzZXFpZCkgewogICB1aW50MzJfdCByZXN1bHQgPSAwOwogICBpbnQzMl90IHN6OwogICByZXN1bHQgKz0gcmVhZEkzMihzeik7CkBAIC0yMTYsNyArMjE1LDggQEAKICAgICByZXN1bHQgKz0gcmVhZEkzMihzZXFpZCk7CiAgIH0gZWxzZSB7CiAgICAgaWYgKHRoaXMtPnN0cmljdF9yZWFkXykgewotICAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6QkFEX1ZFUlNJT04sICJObyB2ZXJzaW9uIGlkZW50aWZpZXIuLi4gb2xkIHByb3RvY29sIGNsaWVudCBpbiBzdHJpY3QgbW9kZT8iKTsKKyAgICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246OkJBRF9WRVJTSU9OLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJObyB2ZXJzaW9uIGlkZW50aWZpZXIuLi4gb2xkIHByb3RvY29sIGNsaWVudCBpbiBzdHJpY3QgbW9kZT8iKTsKICAgICB9IGVsc2UgewogICAgICAgLy8gSGFuZGxlIHByZS12ZXJzaW9uZWQgaW5wdXQKICAgICAgIGludDhfdCB0eXBlOwpAQCAtMjI5LDI3ICsyMjksMjcgQEAKICAgcmV0dXJuIHJlc3VsdDsKIH0KIAotdGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8+Ci11aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8+OjpyZWFkTWVzc2FnZUVuZCgpIHsKK3RlbXBsYXRlIDxjbGFzcyBUcmFuc3Bvc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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFR5cGUmIHZhbFR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QmIHNpemUpIHsKK3RlbXBsYXRlIDxjbGFzcyBUcmFuc3BvcnRfLCBjbGFzcyBCeXRlT3JkZXJfPgordWludDMyX3QgVEJpbmFyeVByb3RvY29sVDxUcmFuc3BvcnRfLCBCeXRlT3JkZXJfPjo6cmVhZE1hcEJlZ2luKFRUeXBlJiBrZXlUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUeXBlJiB2YWxUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90JiBzaXplKSB7CiAgIGludDhfdCBrLCB2OwogICB1aW50MzJfdCByZXN1bHQgPSAwOwogICBpbnQzMl90IHNpemVpOwpAQCAtMjg4LDE0ICsyODgsMTMgQEAKICAgcmV0dXJuIHJlc3VsdDsKIH0KIAotdGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8+Ci11aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8+OjpyZWFkTWFwRW5kKCkgewordGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8sIGNsYXNzIEJ5dGVPcmRlcl8+Cit1aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8sIEJ5dGVPcmRlcl8+OjpyZWFkTWFwRW5kKCkgewogICByZXR1cm4gMDsKIH0KIAotdGVtcGxhdGUgPGNsYXNzIFRyYW5zcG9ydF8+Ci11aW50MzJfdCBUQmluYXJ5UHJvdG9jb2xUPFRyYW5zcG9ydF8+OjpyZWFkTGlzdEJlZ2luKFRUeXBlJiBlbGVtVHlwZSwKLSAgICAgICAgICAgICAgIC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hbnMsCiAgICAgICAgICAgICAgICAgICAgIGludDMyX3Qgc3RyaW5nX2xpbWl0LAotICAgICAgICAgICAgICAgICAgICBpbnQzMl90IGNvbnRhaW5lcl9saW1pdCkgOgotICAgIFRWaXJ0dWFsUHJvdG9jb2w8IFRDb21wYWN0UHJvdG9jb2xUPFRyYW5zcG9ydF8+ID4odHJhbnMpLAotICAgIHRyYW5zXyh0cmFucy5nZXQoKSksCi0gICAgbGFzdEZpZWxkSWRfKDApLAotICAgIHN0cmluZ19saW1pdF8oc3RyaW5nX2xpbWl0KSwKLSAgICBzdHJpbmdfYnVmXyhOVUxMKSwKLSAgICBzdHJpbmdfYnVmX3NpemVfKDApLAotICAgIGNvbnRhaW5lcl9saW1pdF8oY29udGFpbmVyX2xpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgIGludDMyX3QgY29udGFpbmVyX2xpbWl0KQorICAgIDogVFZpcnR1YWxQcm90b2NvbDxUQ29tcGFjdFByb3RvY29sVDxUcmFuc3BvcnRfPiA+KHRyYW5zKSwKKyAgICAgIHRyYW5zXyh0cmFucy5nZXQoKSksCisgICAgICBsYXN0RmllbGRJZF8oMCksCisgICAgICBzdHJpbmdfbGltaXRfKHN0cmluZ19saW1pdCksCisgICAgICBzdHJpbmdfYnVmXyhOVUxMKSwKKyAgICAgIHN0cmluZ19idWZfc2l6ZV8oMCksCisgICAgICBjb250YWluZXJfbGltaXRfKGNvbnRhaW5lcl9saW1pdCkgewogICAgIGJvb2xlYW5GaWVsZF8ubmFtZSA9IE5VTEw7CiAgICAgYm9vbFZhbHVlXy5oYXNCb29sVmFsdWUgPSBmYWxzZTsKICAgfQogCi0gIH5UQ29tcGFjdFByb3RvY29sVCgpIHsKLSAgICBmcmVlKHN0cmluZ19idWZfKTsKLSAgfQotCisgIH5UQ29tcGFjdFByb3RvY29sVCgpIHsgZnJlZShzdHJpbmdfYnVmXyk7IH0KIAogICAvKioKICAgICogV3JpdGluZyBmdW5jdGlvbnMKQEAgLTExNCwyMSArMTE0LDE1IEBACiAKICAgdWludDMyX3Qgd3JpdGVTdHJ1Y3RFbmQoKTsKIAotICB1aW50MzJfdCB3cml0ZUZpZWxkQmVnaW4oY29uc3QgY2hhciogbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIGZpZWxkVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDE2X3QgZmllbGRJZCk7CisgIHVpbnQzMl90IHdyaXRlRmllbGRCZWdpbihjb25zdCBjaGFyKiBuYW1lLCBjb25zdCBUVHlwZSBmaWVsZFR5cGUsIGNvbnN0IGludDE2X3QgZmllbGRJZCk7CiAKICAgdWludDMyX3Qgd3JpdGVGaWVsZFN0b3AoKTsKIAotICB1aW50MzJfdCB3cml0ZUxpc3RCZWdpbihjb25zdCBUVHlwZSBlbGVtVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDMyX3Qgc2l6ZSk7CisgIHVpbnQzMl90IHdyaXRlTGlzdEJlZ2luKGNvbnN0IFRUeXBlIGVsZW1UeXBlLCBjb25zdCB1aW50MzJfdCBzaXplKTsKIAotICB1aW50MzJfdCB3cml0ZVNldEJlZ2luKGNvbnN0IFRUeXBlIGVsZW1UeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IHNpemUpOworICB1aW50MzJfdCB3cml0ZVNldEJlZ2luKGNvbnN0IFRUeXBlIGVsZW1UeXBlLCBjb25zdCB1aW50MzJfdCBzaXplKTsKIAotICB2aXJ0dWFsIHVpbnQzMl90IHdyaXRlTWFwQmVnaW4oY29uc3QgVFR5cGUga2V5VHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIHZhbFR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50MzJfdCBzaXplKTsKKyAgdmlydHVhbCB1aW50MzJfdCB3cml0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gICA7Ci0gICAgY2FzZSBUX1NFVCAgICA6IHJldHVybiAic2V0IiAgICA7Ci0gICAgY2FzZSBUX0xJU1QgICA6IHJldHVybiAibGlzdCIgICA7Ci0gICAgY2FzZSBUX1VURjggICA6IHJldHVybiAidXRmOCIgICA7Ci0gICAgY2FzZSBUX1VURjE2ICA6IHJldHVybiAidXRmMTYiICA7Ci0gICAgZGVmYXVsdDogcmV0dXJuICJ1bmtub3duIjsKKyAgY2FzZSBUX1NUT1A6CisgICAgcmV0dXJuICJzdG9wIjsKKyAgY2FzZSBUX1ZPSUQ6CisgICAgcmV0dXJuICJ2b2lkIjsKKyAgY2FzZSBUX0JPT0w6CisgICAgcmV0dXJuICJib29sIjsKKyAgY2FzZSBUX0JZVEU6CisgICAgcmV0dXJuICJieXRlIjsKKyAgY2FzZSBUX0kxNjoKKyAgICByZXR1cm4gImkxNiI7CisgIGNhc2UgVF9JMzI6CisgICAgcmV0dXJuICJpMzIiOworICBjYXNlIFRfVTY0OgorICAgIHJldHVybiAidTY0IjsKKyAgY2FzZSBUX0k2NDoKKyAgICByZXR1cm4gImk2NCI7CisgIGNhc2UgVF9ET1VCTEU6CisgICAgcmV0dXJuICJkb3VibGUiOworICBjYXNlIFRfU1RSSU5HOgorICAgIHJldHVybiAic3RyaW5nIjsKKyAgY2FzZSBUX1NUUlVDVDoKKyAgICByZXR1cm4gInN0cnVjdCI7CisgIGNhc2UgVF9NQVA6CisgICAgcmV0dXJuICJtYXAiOworICBjYXNlIFRfU0VUOgorICAgIHJldHVybiAic2V0IjsKKyAgY2FzZSBUX0xJU1Q6CisgICAgcmV0dXJuICJsaXN0IjsKKyAgY2FzZSBUX1VURjg6CisgICAgcmV0dXJuICJ1dGY4IjsKKyAgY2FzZSBUX1VURjE2OgorICAgIHJldHVybiAidXRmMTYiOworICBkZWZhdWx0OgorICAgIHJldHVybiAidW5rbm93biI7CiAgIH0KIH0KIApAQCAtNzUsMTkgKzkxLDE5IEBACiB9CiAKIHVpbnQzMl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A7IGJyZWFrOwotICAgIGNhc2UgVF9PTkVXQVkgICAgOiBtdHlwZSA9ICJvbmV3YXkiIDsgYnJlYWs7CisgIGNhc2UgVF9DQUxMOgorICAgIG10eXBlID0gImNhbGwiOworICAgIGJyZWFrOworICBjYXNlIFRfUkVQTFk6CisgICAgbXR5cGUgPSAicmVwbHkiOworICAgIGJyZWFrOworICBjYXNlIFRfRVhDRVBUSU9OOgorICAgIG10eXBlID0gImV4biI7CisgICAgYnJlYWs7CisgIGNhc2UgVF9PTkVXQVk6CisgICAgbXR5cGUgPSAib25ld2F5IjsKKyAgICBicmVhazsKICAgfQogCiAgIHVpbnQzMl90IHNpemUgPSB3cml0ZUluZGVudGVkKCIoIiArIG10eXBlICsgIikgIiArIG5hbWUgKyAiKCIpOwpAQCAtMTk5LDEzICsyMjIsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFR5cGUgZmllbGRUeXBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnQxNl90IGZpZWxkSWQpIHsKICAgLy8gc3ByaW50ZihpZF9zdHIsICIlMDJkIiwgZmllbGRJZCk7Ci0gIHN0cmluZyBpZF9zdHIgPSBib29zdDo6bGV4aWNhbF9jYXN0PHN0cmluZz4oZmllbGRJZCk7Ci0gIGlmIChpZF9zdHIubGVuZ3RoKCkgPT0gMSkgaWRfc3RyID0gJzAnICsgaWRfc3RyOworICBzdHJpbmcgaWRfc3RyID0gdG9fc3RyaW5nKGZpZWxkSWQpOworICBpZiAoaWRfc3RyLmxlbmd0aCgpID09IDEpCisgICAgaWRfc3RyID0gJzAnICsgaWRfc3RyOwogCi0gIHJldHVybiB3cml0ZUluZGVudGVkKAotICAgICAgaWRfc3RyICsgIjogIiArCi0gICAgICBuYW1lICsgIiAoIiArCi0gICAgICBmaWVsZFR5cGVOYW1lKGZpZWxkVHlwZSkgKyAiKSA9ICIpOworICByZXR1cm4gd3J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nJlYWs7Ci0gICAgICAgIGNhc2UgJ1xmJzogb3V0cHV0ICs9ICJcXGYiOyBicmVhazsKLSAgICAgICAgY2FzZSAnXG4nOiBvdXRwdXQgKz0gIlxcbiI7IGJyZWFrOwotICAgICAgICBjYXNlICdccic6IG91dHB1dCArPSAiXFxyIjsgYnJlYWs7Ci0gICAgICAgIGNhc2UgJ1x0Jzogb3V0cHV0ICs9ICJcXHQiOyBicmVhazsKLSAgICAgICAgY2FzZSAnXHYnOiBvdXRwdXQgKz0gIlxcdiI7IGJyZWFrOwotICAgICAgICBkZWZhdWx0OgotICAgICAgICAgIG91dHB1dCArPSAiXFx4IjsKLSAgICAgICAgICBvdXRwdXQgKz0gYnl0ZV90b19oZXgoKml0KTsKKyAgICAgIGNhc2UgJ1xhJzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXGEiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1xiJzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXGIiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1xmJzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXGYiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1xuJzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXG4iOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1xyJzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXHIiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1x0JzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXHQiOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ1x2JzoKKyAgICAgICAgb3V0cHV0ICs9ICJcXHYiOworICAgICAgICBicmVhazsKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIG91dHB1dCArPSAiXFx4IjsKKyAgICAgICAgb3V0cHV0ICs9IGJ5dGVfdG9faGV4KCppdCk7CiAgICAgICB9CiAgICAgfQogICB9CkBAIC0zNTQsNSArMzg4LDYgQEA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90IGkzMik7Ci0KLSAgaW5saW5lIHVpbnQzMl90IHN1YldyaXRlU3RyaW5nKGNvbnN0IHN0ZDo6c3RyaW5nJiBzdHIpOwotCi0gIHVpbnQzMl90IHN1YldyaXRlQm9vbChjb25zdCBib29sIHZhbHVlKSB7Ci0gICAgcmV0dXJuIFRCaW5hcnlQcm90b2NvbDo6d3JpdGVCb29sKHZhbHVlKTsKLSAgfQotCi0KLSAgLyoKLSAgICogUmVhZGluZyBmdW5jdGlvbnMKLSAgICovCi0KLSAgdWludDMyX3QgcmVhZE1lc3NhZ2VCZWdpbihzdGQ6OnN0cmluZyYgbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBUTWVzc2FnZVR5cGUmIG1lc3NhZ2VUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDMyX3QmIHNlcWlkKTsKLQotICB1aW50MzJfdCByZWFkTWVzc2FnZUVuZCgpOwotCi0gIHVpbnQzMl90IHJlYWRTdHJ1Y3RCZWdpbihzdGQ6OnN0cmluZyYgbmFtZSk7Ci0KLSAgdWludDMyX3QgcmVhZFN0cnVjdEVuZCgpOwotCi0gIHVpbnQzMl90IHJlYWRGaWVsZEJlZ2luKHN0ZDo6c3RyaW5nJiBuYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZSYgZmllbGRUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQxNl90JiBmaWVsZElkKTsKLQotICB1aW50MzJfdCByZWFkRmllbGRFbmQoKTsKLQotICB1aW50MzJfdCByZWFkTWFwQmVnaW4oVFR5cGUmIGtleVR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBUVHlwZSYgdmFsVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90JiBzaXplKTsKLQotICB1aW50MzJfdCByZWFkTWFwRW5kKCk7Ci0KLSAgdWludDMyX3QgcmVhZExpc3RCZWdpbihUVHlwZSYgZWxlbVR5cGUsCi0gICA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Ml90IFRIZWFkZXJQcm90b2NvbDo6d3JpdGVGaWVsZEVuZCgpIHsKKyAgcmV0dXJuIHByb3RvXy0+d3JpdGVGaWVsZEVuZCgpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlRmllbGRTdG9wKCkgeworICByZXR1cm4gcHJvdG9fLT53cml0ZUZpZWxkU3RvcCgpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlTWFwQmVnaW4oY29uc3QgVFR5cGUga2V5VHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVHlwZSB2YWxUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90IHNpemUpIHsKKyAgcmV0dXJuIHByb3RvXy0+d3JpdGVNYXBCZWdpbihrZXlUeXBlLCB2YWxUeXBlLCBzaXplKTsKK30KKwordWludDMyX3QgVEhlYWRlclByb3RvY29sOjp3cml0ZU1hcEVuZCgpIHsKKyAgcmV0dXJuIHByb3RvXy0+d3JpdGVNYXBFbmQoKTsKK30KKwordWludDMyX3QgVEhlYWRlclByb3RvY29sOjp3cml0ZUxpc3RCZWdpbihjb25zdCBUVHlwZSBlbGVtVHlwZSwgY29uc3QgdWludDMyX3Qgc2l6ZSkgeworICByZXR1cm4gcHJvdG9fLT53cml0ZUxpc3RCZWdpbihlbGVtVHlwZSwgc2l6ZSk7Cit9CisKK3VpbnQzMl90IFRIZWFkZXJQcm90b2NvbDo6d3JpdGVMaXN0RW5kKCkgeworICByZXR1cm4gcHJvdG9fLT53cml0ZUxpc3RFbmQoKTsKK30KKwordWludDMyX3QgVEhlYWRlclByb3RvY29sOjp3cml0ZVNldEJlZ2luKGNvbnN0IFRUeXBlIGVsZW1UeXBlLCBjb25zdCB1aW50MzJfdCBzaXplKSB7CisgIHJldHVybiBwcm90b18tPndyaXRlU2V0QmVnaW4oZWxlbVR5cGUsIHNpemUpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlU2V0RW5kKCkgeworICByZXR1cm4gcHJvdG9fLT53cml0ZVNldEVuZCgpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlQm9vbChjb25zdCBib29sIHZhbHVlKSB7CisgIHJldHVybiBwcm90b18tPndyaXRlQm9vbCh2YWx1ZSk7Cit9CisKK3VpbnQzMl90IFRIZWFkZXJQcm90b2NvbDo6d3JpdGVCeXRlKGNvbnN0IGludDhfdCBieXRlKSB7CisgIHJldHVybiBwcm90b18tPndyaXRlQnl0ZShieXRlKTsKK30KKwordWludDMyX3QgVEhlYWRlclByb3RvY29sOjp3cml0ZUkxNihjb25zdCBpbnQxNl90IGkxNikgeworICByZXR1cm4gcHJvdG9fLT53cml0ZUkxNihpMTYpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlSTMyKGNvbnN0IGludDMyX3QgaTMyKSB7CisgIHJldHVybiBwcm90b18tPndyaXRlSTMyKGkzMik7Cit9CisKK3VpbnQzMl90IFRIZWFkZXJQcm90b2NvbDo6d3JpdGVJNjQoY29uc3QgaW50NjRfdCBpNjQpIHsKKyAgcmV0dXJuIHByb3RvXy0+d3JpdGVJNjQoaTY0KTsKK30KKwordWludDMyX3QgVEhlYWRlclByb3RvY29sOjp3cml0ZURvdWJsZShjb25zdCBkb3VibGUgZHViKSB7CisgIHJldHVybiBwcm90b18tPndyaXRlRG91YmxlKGR1Yik7Cit9CisKK3VpbnQzMl90IFRIZWFkZXJQcm90b2NvbDo6d3JpdGVTdHJpbmcoY29uc3Qgc3RkOjpzdHJpbmcmIHN0cikgeworICByZXR1cm4gcHJvdG9fLT53cml0ZVN0cmluZyhzdHIpOworfQorCit1aW50MzJfdCBUSGVhZGVyUHJvdG9jb2w6OndyaXRlQmluYXJ5KGNvbnN0IHN0ZDo6c3RyaW5nJiBzdHIpIHsKKyAgcmV0dX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EUgICBGCi0gICAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsJ2InLCd0JywnbicsICAwLCdmJywncicsICAwLCAgMCwgLy8gMAotICAgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsIC8vIDEKLSAgICAxLCAgMSwnIicsICAxLCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAvLyAyCisgICAgLy8gIDAgICAxICAgMiAgIDMgICA0ICAgNSAgIDYgICA3ICAgOCAgIDkgICBBICAgQiAgIEMgICBEICAgRSAgIEYKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgJ2InLAorICAgICd0JywKKyAgICAnbicsCisgICAgMCwKKyAgICAnZicsCisgICAgJ3InLAorICAgIDAsCisgICAgMCwgLy8gMAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsCisgICAgMCwKKyAgICAwLAorICAgIDAsIC8vIDEKKyAgICAxLAorICAgIDEsCisgICAgJyInLAorICAgIDEsCisgICAgMSwKKyAgICAxLAorICAgIDEsCisgICAgMSwKKyAgICAxLAorICAgIDEsCisgICAgMSwKKyAgICAxLAorICAgIDEsCisgICAgMSwKKyAgICAxLAorICAgIDEsIC8vIDIKIH07CiAKLQogLy8gVGhpcyBzdHJpbmcncyBjaGFyYWN0ZXJzIG11c3QgbWF0Y2ggdXAgd2l0aCB0aGUgZWxlbWVudHMgaW4ga0VzY2FwZUNoYXJWYWxzLgogLy8gSSBkb24ndCBoYXZlICcvJyBvbiB0aGlzIGxpc3QgZXZlbiB0aG91Z2ggaXQgYXBwZWFycyBvbiB3d3cuanNvbi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AgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBcJyIgKyBzdGQ6OnN0cmluZygoY2hhciAqKSZjaCwgMSkgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXCc7IGdvdCBcJyIgKyBzdGQ6OnN0cmluZygoY2hhciAqKSZjaDIsIDEpICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlwnLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgXCciICsgc3RkOjpzdHJpbmcoKGNoYXIqKSZjaCwgMSkgKyAiXCc7IGdvdCBcJyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBzdGQ6OnN0cmluZygoY2hhciopJmNoMiwgMSkgKyAiXCcuIik7CiAgIH0KICAgcmV0dXJuIDE7CiB9CkBAIC0xOTIsMTQgKzI0MywxMiBAQAogc3RhdGljIHVpbnQ4X3QgaGV4VmFsKHVpbnQ4X3QgY2gpIHsKICAgaWYgKChjaCA+PSAnMCcpICYmIChjaCA8PSAnOScpKSB7CiAgICAgcmV0dXJuIGNoIC0gJzAnOwotICB9Ci0gIGVsc2UgaWYgKChjaCA+PSAnYScpICYmIChjaCA8PSAnZicpKSB7CisgIH0gZWxzZSBpZiAoKGNoID49ICdhJykgJiYgKGNoIDw9ICdmJykpIHsKICAgICByZXR1cm4gY2ggLSAnYScgKyAxMDsKLSAgfQotICBlbHNlIHsKKyAgfSBlbHNlIHsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBoZXggdmFsIChbMC05YS1mXSk7IGdvdCBcJyIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHN0ZDo6c3RyaW5nKChjaGFyICopJmNoLCAxKSArICJcJy4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4c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YWRKU09OU3ludGF4Q2hhcihrSlNPTlN0cmluZ0RlbGltaXRlcik7CisgIHN0ZDo6dmVjdG9yPHVpbnQxNl90PiBjb2RldW5pdHM7CiAgIHVpbnQ4X3QgY2g7CiAgIHN0ci5jbGVhcigpOwogICB3aGlsZSAodHJ1ZSkgewpAQCAtNzA1LDM1ICs3NTQsNjUgQEAKICAgICAgIGNoID0gcmVhZGVyXy5yZWFkKCk7CiAgICAgICArK3Jlc3VsdDsKICAgICAgIGlmIChjaCA9PSBrSlNPTkVzY2FwZUNoYXIpIHsKLSAgICAgICAgcmVzdWx0ICs9IHJlYWRKU09ORXNjYXBlQ2hhcigmY2gpOwotICAgICAgfQotICAgICAgZWxzZSB7CisgICAgICAgIHVpbnQxNl90IGNwOworICAgICAgICByZXN1bHQgKz0gcmVhZEpTT05Fc2NhcGVDaGFyKCZjcCk7CisgICAgICAgIGlmIChpc0hpZ2hTdXJyb2dhdGUoY3ApKSB7CisgICAgICAgICAgY29kZXVuaXRzLnB1c2hfYmFjayhjcCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaWYgKGlzTG93U3Vycm9nYXRlKGNwKQorICAgICAgICAgICAgICAgJiYgY29kZXVuaXRzLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWlzc2luZyBVVEYtMTYgaGlnaCBzdXJyb2dhdGUgcGFpci4iKTsKKyAgICAgICAgICB9CisgICAgICAgICAgY29kZXVuaXRzLnB1c2hfYmFjayhjcCk7CisgICAgICAgICAgY29kZXVuaXRzLnB1c2hfYmFjaygwKTsKKyAgICAgICAgICBzdHIgKz0gYm9vc3Q6OmxvY2FsZTo6Y29udjo6dXRmX3RvX3V0ZjxjaGFyPihjb2RldW5pdHMuZGF0YSgpKTsKKyAgICAgICAgICBjb2RldW5pdHMuY2xlYXIoKTsKKyAgICAgICAgfQorICAgICAgICBjb250aW51ZTsKKyAgICAgIH0gZWxzZSB7CiAgICAgICAgIHNpemVfdCBwb3MgPSBrRXNjYXBlQ2hhcnMuZmluZChjaCk7Ci0gICAgICAgIGlmIChwb3MgPT0gc3RkOjpzdHJpbmc6Om5wb3MpIHsKKyAgICAgICAgaWYgKHBvcyA9PSBrRXNjYXBlQ2hhcnMubnBvcykgewogICAgICAgICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGNvbnRyb2wgY2hhciwgZ290ICciICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcoKGNvbnN0IGNoYXIgKikmY2gsIDEpICArICInLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgY29udHJvbCBjaGFyLCBnb3QgJyIgKyBzdGQ6OnN0cmluZygoY29uc3QgY2hhciopJmNoLCAxKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICInLiIpOwogICAgICAgICB9CiAgICAgICAgIGNoID0ga0VzY2FwZUNoYXJWYWxzW3Bvc107CiAgICAgICB9CiAgICAgfQorICAgIGlmICghY29kZXVuaXRzLmVtcHR5KCkpIHsKKyAgICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTWlzc2luZyBVVEYtMTYgbG93IHN1cnJvZ2F0ZSBwYWlyLiIpOworICAgIH0KICAgICBzdHIgKz0gY2g7CiAgIH0KKworICBpZiAoIWNvZGV1bml0cy5lbXB0eSgpKSB7CisgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQ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3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBudW1lcmljIHZhbHVlOyBnb3QgXCIiICsgc3RyICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXCIiKTsKKyAgICBudW0gPSBmcm9tU3RyaW5nPE51bWJlclR5cGU+KHN0cik7CisgIH0gY2F0Y2ggKGNvbnN0IHN0ZDo6cnVudGltZV9lcnJvciYpIHsKKyAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBudW1lcmljIHZhbHVlOyBnb3QgXCIiICsgc3RyICsgIlwiIik7CiAgIH0KICAgaWYgKGNvbnRleHRfLT5lc2NhcGVOdW0oKSkgewogICAgIHJlc3VsdCArPSByZWFkSlNPTlN5bnRheENoYXIoa0pTT05TdHJpbmdEZWxpbWl0ZXIpOwpAQCAtNzg4LDUwICs4NzgsNDIgQEAKIH0KIAogLy8gUmVhZHMgYSBKU09OIG51bWJlciBvciBzdHJpbmcgYW5kIGludGVycHJldHMgaXQgYXMgYSBkb3VibGUuCi11aW50MzJfdCBUSlNPTlByb3RvY29sOjpyZWFkSlNPTkRvdWJsZShkb3VibGUgJm51bSkgewordWludDMyX3QgVEpTT05Qcm90b2NvbDo6cmVhZEpTT05Eb3VibGUoZG91YmxlJiBudW0pIHsKICAgdWludDMyX3QgcmVzdWx0ID0gY29udGV4dF8tPnJlYWQocmVhZGVyXyk7CiAgIHN0ZDo6c3RyaW5nIHN0cjsKICAgaWYgKHJlYWRlcl8ucGVlaygpID09IGtKU09OU3RyaW5nRGVsaW1pdGVyKSB7CiAgICAgcmVzdWx0ICs9IHJlYWRKU09OU3RyaW5nKHN0ciwgdHJ1ZSk7C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+KHN0cik7Ci0gICAgICB9Ci0gICAgICBjYXRjaCAoYm9vc3Q6OmJhZF9sZXhpY2FsX2Nhc3QgZSkgewotICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBudW1lcmljIHZhbHVlOyBnb3QgXCIiICsgc3RyICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXCIiKTsKKyAgICAgICAgbnVtID0gZnJvbVN0cmluZzxkb3VibGU+KHN0cik7CisgICAgICB9IGNhdGNoIChzdGQ6OnJ1bnRpbWVfZXJyb3ImIGUpIHsKKyAgICAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBudW1lcmljIHZhbHVlOyBnb3QgXCIiICsgc3RyICsgIlwiIik7CiAgICAgICB9CiAgICAgfQotICB9Ci0gIGVsc2UgeworICB9IGVsc2UgewogICAgIGlmIChjb250ZXh0Xy0+ZXNjYXBlTnVtKCkpIHsKICAgICAgIC8vIFRoaXMgd2lsbCB0aHJvdyAtIHdlIHNob3VsZCBoYXZlIGhhZCBhIHF1b3RlIGlmIGVzY2FwZU51bSA9PSB0cnVlCiAgICAgICByZWFkSlNPTlN5bnRheENoYXIoa0pTT05TdHJpbmdEZWxpbWl0ZXIpOwogICAgIH0KICAgICByZXN1bHQgKz0gcmVhZEpTT05OdW1lcmljQ2hhcnMoc3RyKTsKICAgICB0cnkgewotICAgICAgbnVtID0gYm9vc3Q6OmxleGljYWxfY2FzdDxkb3VibGU+KHN0cik7Ci0gICAgfQotICAgIGNhdGNoIChib29zdDo6YmFkX2xleGljYWxfY2FzdCBlKSB7Ci0gICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgbnVtZXJpYyB2YWx1ZTsgZ290IFwiIiArIHN0ciArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJcIiIpOworICAgICAgbnVtID0gZnJvbVN0cmluZzxkb3VibGU+KHN0cik7CisgICAgfSBjYXRjaCAoc3RkOjpydW50aW1lX2Vycm9yJiBlKSB7CisgICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBudW1lcmljIHZhbHVlOyBnb3QgXCIiICsgc3RyICsgIlwiIik7CiAgICAgfQogICB9CiAgIHJldHVybiByZXN1bHQ7CkBAIC04NDAsNyArOTIyLDcgQEAKIHVpbnQzMl90IFRKU09OUHJvdG9jb2w6OnJlYWRKU09OT2JqZWN0U3RhcnQoKSB7CiAgIHVpbnQzMl90IHJlc3VsdCA9IGNvbnRleHRfLT5yZWFkKHJlYWRlcl8pOwogICByZXN1bHQgKz0gcmVhZEpTT05TeW50YXhDaGFyKGtKU09OT2JqZWN0U3RhcnQpOwotICBwdXNoQ29udGV4dChib29zdDo6c2hhcmVkX3B0cjxUSlNPTkNvbnRleHQ+KG5ldyBKU09OUGFpckNvbnRleHQoKSkpOworICBwdXNoQ29udGV4dChzdGQ6OnNoYXJlZF9wdHI8VEpTT05Db250ZXh0PihuZXcgSlNPTlBhaXJDb250ZXh0KCkpKTsKICAgcmV0dXJuIHJlc3VsdDsKIH0KIApAQCAtODUzLDcgKzkzNSw3IEBACiB1aW50MzJfdCBUSlNPTlByb3RvY29sOjpyZWFkSlNPTkFycmF5U3RhcnQoKSB7CiAgIHVpbnQ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eXBlLAotICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgX3NlcWlkKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGlmKCBfdHlwZSA9PSBUX0NBTEwgfHwgX3R5cGUgPT0gVF9PTkVXQVkgKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRQcm90b2NvbERlY29yYXRvcjo6d3JpdGVNZXNzYWdlQmVnaW5fdmlydCggc2VydmljZU5hbWUgKyBzZXBhcmF0b3IgKyBfbmFtZSwgX3R5cGUsIF9zZXFpZCApOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFByb3RvY29sRGVjb3JhdG9yOjp3cml0ZU1lc3NhZ2VCZWdpbl92aXJ0KF9uYW1lLCBfdHlwZSwgX3NlcWlkKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9CituYW1lc3BhY2UgYXBhY2hlIHsKK25hbWVzcGFjZSB0aHJpZnQgeworbmFtZXNwYWNlIHByb3RvY29sIHsKK3VpbnQzMl90IFRNdWx0aXBsZXhlZFByb3RvY29sOjp3cml0ZU1lc3NhZ2VCZWdpbl92aXJ0KGNvbnN0IHN0ZDo6c3RyaW5nJiBfbmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRNZXNzYWdlVHlwZSBfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgX3NlcWlkKSB7CisgIGlmIChfdHlwZSA9PSBUX0NBTEwgfHwgX3R5cGUgPT0gVF9PTkVXQVkpIHsKKyAgICByZXR1cm4gVFByb3RvY29sRGVjb3JhdG9yOjp3cml0ZU1lc3NhZ2VCZWdpbl92aXJ0KHNlcnZpY2VOYW1lICsgc2VwYXJhdG9yICsgX25hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zZXFpZCk7CisgIH0gZWxzZSB7CisgICAgcmV0dXJuIFRQcm90b2NvbERlY29yYXRvcjo6d3JpdGVNZXNzYWdlQmVnaW5fdmlydChfbmFtZSwgX3R5cGUsIF9zZXFpZCk7CisgIH0KIH0KLQorfQorfQorfQpkaWZmIC0tZ2l0IGEvbGliL2NwcC9zcmMvdGhyaWZ0L3Byb3RvY29sL1RNdWx0aXBsZXhlZFByb3RvY29sLmggYi9saWIvY3BwL3NyYy90aHJpZnQvcHJvdG9jb2wvVE11bHRpcGxleGVkUHJvdG9jb2wuaAppbmRleCBhNTljN2I0Li45NGJkODJlIDEwMDY0NAotLS0gYS9saWIvY3BwL3NyYy90aHJpZnQvcHJvdG9jb2wvVE11bHRpcGxleGVkUHJvdG9jb2wuaAorKysgYi9saWIvY3BwL3NyYy90aHJpZnQvcHJvdG9jb2wvVE11bHRpcGxleGVkUHJvdG9jb2wuaApAQCAtMjIsODIgKzIyLDc0IEBACiAKICNpbmNsdWRlIDx0aHJpZnQvcHJvdG9jb2wvVFByb3RvY29sRGVjb3JhdG9yLmg+CiAKLW5hbWVzcGFjZSBhcGFjaGUgCi17IAotICAgIG5hbWVzcGFjZSB0aHJpZnQgCi0gICAgeyAKLSAgICAgICAgbmFtZXNwYWNlIHByb3RvY29sIAotICAgICAgICB7Ci0gICAgICAgICAgICB1c2luZyBib29zdDo6c2hhcmVkX3B0cjsKK25hbWVzcGFjZSBhcGFjaGUgeworbmFtZXNwYWNlIHRocmlmdCB7CituYW1lc3BhY2UgcHJvdG9jb2wgewordXNpbmcgc3RkOjpzaGFyZWRfcHRyOwogCi0gICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAqIDxjb2RlPlRNdWx0aXBsZXhlZFByb3RvY29sPC9jb2RlPiBpcyBhIHByb3RvY29sLWluZGVwZW5kZW50IGNvbmNyZXRlIGRlY29yYXRvcgotICAgICAgICAgICAgICogdGhhdCBhbGxvd3MgYSBUaHJpZnQgY2xpZW50IHRvIGNvbW11bmljYXRlIHdpdGggYSBtdWx0aXBsZXhpbmcgVGhyaWZ0IHNlcnZlciwKLSAgICAgICAgICAgICAqIGJ5IHByZXBlbmRpbmcgdGhlIHNlcnZpY2UgbmFtZSB0byB0aGUgZnVuY3Rpb24gbmFtZSBkdXJpbmcgZnVuY3Rpb24gY2FsbHMuCi0gICAgICAgICAgICAgKgotICAgICAgICAgICAgICogXG5vdGUgVEhJUyBJUyBOT1QgVVNFRCBCWSBTRVJWRVJTLiAgT24gdGhlIHNlcnZlciwgdXNlIAotICAgICAgICAgICAgICoge0BsaW5rIGFwYWNoZTo6dGhyaWZ0OjpUTXVsdGlwbGV4ZWRQcm9jZXNzb3IgVE11bHRpcGxleGVkUHJvY2Vzc29yfSB0byBoYW5kbGUgcmVxdWVzdHMKLSAgICAgICAgICAgICAqIGZyb20gYSBtdWx0aXBsZXhpbmcgY2xpZW50LgotICAgICAgICAgICAgICoKLSAgICAgICAgICAgICAqIFRoaXMgZXhhbXBsZSB1c2VzIGEgc2luZ2xlIHNvY2tldCB0cmFuc3BvcnQgdG8gaW52b2tlIHR3byBzZXJ2aWNlczoKLSAgICAgICAgICAgICAqCi0gICAgICAgICAgICAgKiA8YmxvY2txdW90ZT48Y29kZT4KLSAgICAgICAgICAgICAqICAgICBzaGFyZWRfcHRyPFRTb2NrZXQ+IHRyYW5zcG9ydChuZXcgVFNvY2tldCgibG9jYWxob3N0IiwgOTA5MCkpOwotICAgICAgICAgICAgICogICAgIHRyYW5zcG9ydC0+b3BlbigpOwotICAgICAgICAgICAgICoKLSAgICAgICAgICAgICAqICAgICBzaGFyZWRfcHRyPFRCaW5hcnlQcm90b2NvbD4gcHJvdG9jb2wobmV3IFRCaW5hcnlQcm90b2NvbCh0cmFuc3BvcnQpKTsKLSAgICAgICAgICAgICAqCi0gICAgICAgICAgICAgKiAgICAgc2hhcmVkX3B0cjxUTXVsdGlwbGV4ZWRQcm90b2NvbD4gbXAxKG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChwcm90b2NvbCwgIkNhbGN1bGF0b3IiKSk7Ci0gICAgICAgICAgICAgKiAgICAgc2hhcmVkX3B0cjxDYWxjdWxhdG9yQ2xpZW50PiBzZXJ2aWNlMShuZXcgQ2FsY3VsYXRvckNsaWVudChtcDEpKTsKLSAgICAgICAgICAgICAqCi0gICAgICAgICAgICAgKiAgICAgc2hhcmVkX3B0cjxUTXVsdGlwbGV4ZWRQcm90b2NvbD4gbXAyKG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChwcm90b2NvbCwgIldlYXRoZXJSZXBvcnQiKSk7Ci0gICAgICAgICAgICAgKiAgICAgc2hhcmVkX3B0cjxXZWF0aGVyUmVwb3J0Q2xpZW50PiBzZXJ2aWNlMihuZXcgV2VhdGhlclJlcG9ydENsaWVudChtcDIpKTsKLSAgICAgICAgICAgICAqCi0gICAgICAgICAgICAgKiAgICAgc2VydmljZTEtPmFkZCgyLDIpOwotICAgICAgICAgICAgICogICAgIGludCB0ZW1wID0gc2VydmljZTItPmdldFRlbXBlcmF0dXJlKCk7Ci0gICAgICAgICAgICAgKiA8L2NvZGU+PC9ibG9ja3F1b3RlPgotICAgICAgICAgICAgICoKLSAgICAgICAgICAgICAqIEBzZWUgYXBhY2hlOjp0aHJpZnQ6OnByb3RvY29sOjpUUHJvdG9jb2xEZWNvcmF0b3IKLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgIGNsYXNzIFRNdWx0aXBsZXhlZFByb3RvY29sIDogcHVibGljIFRQcm90b2NvbERlY29yYXRvcgotICAgICAgICAgICAgewotICAgICAgICAgICAgcHVibGljOgotICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAqIFdyYXAgdGhlIHNwZWNpZmllZCBwcm90b2NvbCwgYWxsb3dpbmcgaXQgdG8gYmUgdXNlZCB0byBjb21tdW5pY2F0ZSB3aXRoIGEKLSAgICAgICAgICAgICAgICAgKiBtdWx0aXBsZXhpbmcgc2VydmVyLiAgVGhlIDxjb2RlPnNlcnZpY2VOYW1lPC9jb2RlPiBpcyByZXF1aXJlZCBhcyBpdCBpcwotICAgICAgICAgICAgICAgICAqIHByZXBlbmRlZCB0byB0aGUgbWVzc2FnZSBoZWFkZXIgc28gdGhhdCB0aGUgbXVsdGlwbGV4aW5nIHNlcnZlciBjYW4gYnJva2VyCi0gICAgICAgICAgICAgICAgICogdGhlIGZ1bmN0aW9uIGNhbGwgdG8gdGhlIHByb3BlciBzZXJ2aWNlLgotICAgICAgICAgICAgICAgICAqCi0gICAgICAgICAgICAgICAgICogXHBhcmFtIF9wcm90b2NvbCAgICBZb3VyIGNvbW11bmljYXRpb24gcHJvdG9jb2wgb2YgY2hvaWNlLCBlLmcuIDxjb2RlPlRCaW5hcnlQcm90b2NvbDwvY29kZT4uCi0gICAgICAgICAgICAgICAgICogXHBhcmFtIF9zZXJ2aWNlTmFtZSBUaGUgc2VydmljZSBuYW1lIG9mIHRoZSBzZXJ2aWNlIGNvbW11bmljYXRpbmcgdmlhIHRoaXMgcHJvdG9jb2wuCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgIFRNdWx0aXBsZXhlZFByb3RvY29sKCBzaGFyZWRfcHRyPFRQcm90b2NvbD4gX3Byb3RvY29sLCBjb25zdCBzdGQ6OnN0cmluZyYgX3NlcnZpY2VOYW1lICkgCi0gICAgICAgICAgICAgICAgICAgIDogVFByb3RvY29sRGVjb3JhdG9yKF9wcm90b2NvbCksCi0gICAgICAgICAgICAgICAgICAgICAgc2VydmljZU5hbWUoX3NlcnZpY2VOYW1lKSwKLSAgICAgICAgICAgICAgICAgICAgICBzZXBhcmF0b3IoIjoiKQotICAgICAgICAg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EdMSUJDICovCiAjZWxpZiBfX1RIUklGVF9CWVRFX09SREVSID09IF9fVEhSSUZUX0xJVFRMRV9FTkRJQU4KLSMgIGRlZmluZSBodG9sZWxsKG4pIChuKQotIyAgZGVmaW5lIGxldG9obGwobikgKG4pCisjICBkZWZpbmUgVEhSSUZUX2h0b2xlbGwobikgKG4pCisjICBkZWZpbmUgVEhSSUZUX2xldG9obGwobikgKG4pCisjICBkZWZpbmUgVEhSSUZUX2h0b2xlbChuKSAobikKKyMgIGRlZmluZSBUSFJJRlRfbGV0b2hsKG4pIChuKQorIyAgZGVmaW5lIFRIUklGVF9odG9sZXMobikgKG4pCisjICBkZWZpbmUgVEhSSUZUX2xldG9ocyhuKSAobikKICMgaWYgZGVmaW5lZChfX0dOVUNfXykgJiYgZGVmaW5lZChfX0dMSUJDX18pCiAjICBpbmNsdWRlIDxieXRlc3dhcC5oPgotIyAgZGVmaW5lIG50b2hsbChuKSBic3dhcF82NChuKQotIyAgZGVmaW5lIGh0b25sbChuKSBic3dhcF82NChuKQorIyAgZGVmaW5lIFRIUklGVF9udG9obGwobikgYnN3YXBfNjQobikKKyMgIGRlZmluZSBUSFJJRlRfaHRvbmxsKG4pIGJzd2FwXzY0KG4pCiAjIGVsaWYgZGVmaW5lZChfTVNDX1ZFUikgLyogTWljcm9zb2Z0IFZpc3VhbCBDKysgKi8KLSMgIGRlZmluZSBudG9obGwobikgKCBfYnl0ZXN3YXBfdWludDY0KCh1aW50NjRfdCluKSApCi0jICBkZWZpbmUgaHRvbmxsKG4pICggX2J5dGVzd2FwX3VpbnQ2NCgodWludDY0X3QpbikgKQotIyBlbHNlIC8qIE5vdCBHTlVDL0dMSUJDIG9yIE1TVkMgKi8KLSMgIGRlZmluZSBudG9obGwobikgKCAoKCh1aW50NjRfdCludG9obCgodWludDMyX3QpbikpIDw8IDMyKSArIG50b2hsKCh1aW50MzJfdCkobiA+PiAzMikpICkKLSMgIGRlZmluZSBodG9ubGwobikgKCAoKCh1aW50NjRfdCl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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFR5cGUmIGZpZWxkVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDE2X3QmIGZpZWxkSWQpID0gMDsKKyAgdmlydHVhbCB1aW50MzJfdCByZWFkRmllbGRCZWdpbl92aXJ0KHN0ZDo6c3RyaW5nJiBuYW1lLCBUVHlwZSYgZmllbGRUeXBlLCBpbnQxNl90JiBmaWVsZElkKSA9IDA7CiAKICAgdmlydHVhbCB1aW50MzJfdCByZWFkRmllbGRFbmRfdmlydCgpID0gMDsKIAotICB2aXJ0dWFsIHVpbnQzMl90IHJlYWRNYXBCZWdpbl92aXJ0KFRUeXBlJiBrZXlUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUeXBlJiB2YWxUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90JiBzaXplKSA9IDA7CisgIHZpcnR1YWwgdWludDMyX3QgcmVhZE1hcEJlZ2luX3ZpcnQoVFR5cGUmIGtleVR5cGUsIFRUeXBlJiB2YWxUeXBlLCB1aW50MzJfdCYgc2l6ZSkgPSAwOwogCiAgIHZpcnR1YWwgdWludDMyX3QgcmVhZE1hcEVuZF92aXJ0KCkgPSAwOwogCi0gIHZpcnR1YWwgdWludDMyX3QgcmVhZExpc3RCZWdpbl92aXJ0KFRUeXBlJiBlbGVtVHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QmIHNpemUpID0gMDsKKyAgdmlydHVhbCB1aW50MzJfdCByZWFkTGlzdEJlZ2luX3ZpcnQoVFR5cGUmIGVsZW1UeXBlLCB1aW50MzJfdCYgc2l6ZSkgPSAwOwogCiAgIHZpcnR1YWwgdWludDMyX3QgcmVhZExpc3RFbmRfdmlydCgpID0gMDsKIAotICB2aXJ0dWFsIHVpbnQzMl90IHJlYWRTZXRCZWdpbl92aXJ0KFRUe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VF9CWVRFOiB7CisgICAgaW50OF90IGJ5dGV2ID0gMDsKKyAgICByZXR1cm4gcHJvdC5yZWFkQnl0ZShieXRldik7CisgIH0KKyAgY2FzZSBUX0kxNjogeworICAgIGludDE2X3QgaTE2OworICAgIHJldHVybiBwcm90LnJlYWRJMTYoaTE2KTsKKyAgfQorICBjYXNlIFRfSTMyOiB7CisgICAgaW50MzJfdCBpMzI7CisgICAgcmV0dXJuIHByb3QucmVhZEkzMihpMzIpOworICB9CisgIGNhc2UgVF9JNjQ6IHsKKyAgICBpbnQ2NF90IGk2NDsKKyAgICByZXR1cm4gcHJvdC5yZWFkSTY0KGk2NCk7CisgIH0KKyAgY2FzZSBUX0RPVUJMRTogeworICAgIGRvdWJsZSBkdWI7CisgICAgcmV0dXJuIHByb3QucmVhZERvdWJsZShkdWIpOworICB9CisgIGNhc2UgVF9TVFJJTkc6IHsKKyAgICBzdGQ6OnN0cmluZyBzdHI7CisgICAgcmV0dXJuIHByb3QucmVhZEJpbmFyeShzdHIpOworICB9CisgIGNhc2UgVF9TVFJVQ1Q6IHsKKyAgICB1aW50MzJfdCByZXN1bHQgPSAwOworICAgIHN0ZDo6c3RyaW5nIG5hbWU7CisgICAgaW50MTZfdCBmaWQ7CisgICAgVFR5cGUgZnR5cGU7CisgICAgcmVzdWx0ICs9IHByb3QucmVhZFN0cnVjdEJlZ2luKG5hbWUpOworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICByZXN1bHQgKz0gcHJvdC5yZWFkRmllbGRCZWdpbihuYW1lLCBmdHlwZSwgZmlkKTsKKyAgICAgIGlmIChmdHlwZSA9PSBUX1NUT1ApIHsKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisgICAgICByZXN1bHQgKz0gc2tpcChwcm90LCBmdHlwZSk7CisgICAgICByZXN1bHQgKz0gcHJvdC5yZWFkRmllbGRFbmQoKTsKKyAgICB9CisgICAgcmVzdWx0ICs9IHByb3QucmVhZFN0cnVjdEVuZCgpOworICAgIHJldHVybiByZXN1bHQ7CisgIH0KKyAgY2FzZSBUX01BUDogeworICAgIHVpbnQzMl90IHJlc3VsdCA9IDA7CisgICAgVFR5cGUga2V5VHlwZTsKKyAgICBUVHlwZSB2YWxUeXBlOworICAgIHVpbnQzMl90IGksIHNpemU7CisgICAgcmVzdWx0ICs9IHByb3QucmVhZE1hcEJlZ2luKGtleVR5cGUsIHZhbFR5cGUsIHNpemUpOworICAgIGZvciAoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgIHJlc3VsdCArPSBza2lwKHByb3QsIGtleVR5cGUpOworICAgICAgcmVzdWx0ICs9IHNraXAocHJvdCwgdmFsVHlwZSk7CisgICAgfQorICAgIHJlc3VsdCArPSBwcm90LnJlYWRNYXBFbmQoKTsKKyAgICByZXR1cm4gcmVzdWx0OworICB9CisgIGNhc2UgVF9TRVQ6IHsKKyAgICB1aW50MzJfdCByZXN1bHQgPSAwOworICAgIFRUeXBlIGVsZW1UeXBlOworICAgIHVpbnQzMl90IGksIHNpemU7CisgICAgcmVzdWx0ICs9IHByb3QucmVhZFNldEJlZ2luKGVsZW1UeXBlLCBzaXplKTsKKyAgICBmb3IgKGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICByZXN1bHQgKz0gc2tpcChwcm90LCBlbGVtVHlwZSk7CisgICAgfQorICAgIHJlc3VsdCArPSBwcm90LnJlYWRTZXRFbmQoKTsKKyAgICByZXR1cm4gcmVzdWx0OworICB9CisgIGNhc2UgVF9MSVNUOiB7CisgICAgdWludDMyX3QgcmVzdWx0ID0gMDsKKyAgICBUVHlwZSBlbGVtVHlwZTsKKyAgICB1aW50MzJfdCBpLCBzaXplOworICAgIHJlc3VsdCArPSBwcm90LnJlYWRMaXN0QmVnaW4oZWxlbVR5cGUsIHNpemUpOworICAgIGZvciAoaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgIHJlc3VsdCArPSBza2lwKHByb3QsIGVsZW1UeXBlKTsKKyAgICB9CisgICAgc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3RvY29sIAotICAgICAgICB7Ci0gICAgICAgICAgICB1c2luZyBib29zdDo6c2hhcmVkX3B0cjsKK25hbWVzcGFjZSBhcGFjaGUgeworbmFtZXNwYWNlIHRocmlmdCB7CituYW1lc3BhY2UgcHJvdG9jb2wgewordXNpbmcgc3RkOjpzaGFyZWRfcHRyOwogCi0gICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAqIDxjb2RlPlRQcm90b2NvbERlY29yYXRvcjwvY29kZT4gZm9yd2FyZHMgYWxsIHJlcXVlc3RzIHRvIGFuIGVuY2xvc2VkCi0gICAgICAgICAgICAgKiA8Y29kZT5UUHJvdG9jb2w8L2NvZGU+IGluc3RhbmNlLCBwcm92aWRpbmcgYSB3YXkgdG8gYXV0aG9yIGNvbmNpc2UKLSAgICAgICAgICAgICAqIGNvbmNyZXRlIGRlY29yYXRvciBzdWJjbGFzc2VzLiAgCi0gICAgICAgICAgICAgKgotICAgICAgICAgICAgICogPHA+U2VlIHAuMTc1IG9mIERlc2lnbiBQYXR0ZXJucyAoYnkgR2FtbWEgZXQgYWwuKTwvcD4KLSAgICAgICAgICAgICAqIAotICAgICAgICAgICAgICogQHNlZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRNdWx0aXBsZXhlZFByb3RvY29sCi0gICAgICAgICAgICAgKi8KLSAgICAgICAgICAgIGNsYXNzIFRQcm90b2NvbERlY29yYXRvciA6IHB1YmxpYyBUUHJvdG9jb2wKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgIHB1YmxpYzoKLSAgICAgICAgICAgICAgICB2aXJ0dWFsIH5UUHJvdG9jb2xEZWNvcmF0b3IoKSB7fQotICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIC8vIERlc2M6IEluaXRpYWxpemVzIHRoZSBwcm90b2NvbCBkZWNvcmF0b3Igb2JqZWN0LgotICAgICAgICAgICAgICAgIFRQcm90b2NvbERlY29yYXRvciggc2hhcmVkX3B0cjxUUHJvdG9jb2w+IHByb3RvICkgCi0gICAgICAgICAgICAgICAgICAgIDogVFByb3RvY29sKHByb3RvLT5nZXRUcmFuc3BvcnQoKSksIHByb3RvY29sKHByb3RvKQotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB9CisvKioKKyAqIDxjb2RlPlRQcm90b2NvbERlY29yYXRvcjwvY29kZT4gZm9yd2FyZHMgYWxsIHJlcXVlc3RzIHRvIGFuIGVuY2xvc2VkCisgKiA8Y29kZT5UUHJvdG9jb2w8L2NvZGU+IGluc3RhbmNlLCBwcm92aWRpbmcgYSB3YXkgdG8gYXV0aG9yIGNvbmNpc2UKKyAqIGNvbmNyZXRlIGRlY29yYXRvciBzdWJjbGFzc2VzLgorICoKKyAqIDxwPlNlZSBwLjE3NSBvZiBEZXNpZ24gUGF0dGVybnMgKGJ5IEdhbW1hIGV0IGFsLik8L3A+CisgKgorICogQHNlZSBhcGFjaGU6OnRocmlmdDo6cHJvdG9jb2w6OlRNdWx0aXBsZXhlZFByb3RvY29sCisgKi8KK2NsYXNzIFRQcm90b2NvbERlY29yYXRvciA6IHB1YmxpYyBUUHJvdG9jb2wgeworcHVibGljOgorICB2aXJ0dWFsIH5UUHJvdG9jb2xEZWNvcmF0b3IoKSB7fQogCi0gICAgICAgICAgICAgICAgdmlydHVhbCB1aW50MzJfdCB3cml0ZU1lc3NhZ2VCZWdpbl92aXJ0KAotICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgbmFtZSwgCi0gICAgICAgICAgICAgICAgICAgIGNvbnN0IFRNZXNzYWdlVHlwZSBtZXNzYWdlVHlwZSwgCi0gICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3Qgc2VxaWQpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvdG9jb2wtPndyaXRlTWVzc2FnZUJlZ2luKG5hbWUsIG1lc3NhZ2VUeXBlLCBzZXFpZCk7IAotICAgICAgICAgICAgICAgIH0KLSAgIC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2VUeXBlJiBtZXNzYWdlVHlwZSwgaW50MzJfdCYgc2VxaWQpIHsKKyAgICAodm9pZCluYW1lOworICAgICh2b2lkKW1lc3NhZ2VUeXBlOworICAgICh2b2lkKXNlcWlkOwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CkBAIC01NSw3ICs1NSw3IEBACiAgIH0KIAogICB1aW50MzJfdCByZWFkU3RydWN0QmVnaW4oc3RkOjpzdHJpbmcmIG5hbWUpIHsKLSAgICAodm9pZCkgbmFtZTsKKyAgICAodm9pZCluYW1lOwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CkBAIC02NSwxMiArNjUsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CiAKLSAgdWludDMyX3QgcmVhZEZpZWxkQmVnaW4oc3RkOjpzdHJpbmcmIG5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIFRUeXBlJiBmaWVsZFR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIGludDE2X3QmIGZpZWxkSWQpIHsKLSAgICAodm9pZCkgbmFtZTsKLSAgICAodm9pZCkgZmllbGRUeXBlOwotICAgICh2b2lkKSBmaWVsZElkOworICB1aW50MzJfdCByZWFkRmllbGRCZWdpbihzdGQ6OnN0cmlu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ELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHJlYWRpbmcgKHlldCkuIik7CiAgIH0KIAogICB1aW50MzJfdCByZWFkQnl0ZShpbnQ4X3QmIGJ5dGUpIHsKLSAgICAodm9pZCkgYnl0ZTsKKyAgICAodm9pZClieXRlOwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CiAKICAgdWludDMyX3QgcmVhZEkxNihpbnQxNl90JiBpMTYpIHsKLSAgICAodm9pZCkgaTE2OworICAgICh2b2lkKWkxNjsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgcmVhZGluZyAoeWV0KS4iKTsKICAgfQogCiAgIHVpbnQzMl90IHJlYWRJMzIoaW50MzJfdCYgaTMyKSB7Ci0gICAgKHZvaWQpIGkzMjsKKyAgICAodm9pZClpMzI7CiAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6Tk9UX0lNUExFTUVOVEVELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHJlYWRpbmcgKHlldCkuIik7CiAgIH0KIAogICB1aW50MzJfdCByZWFkSTY0KGludDY0X3QmIGk2NCkgewotICAgICh2b2lkKSBpNjQ7CisgICAgKHZvaWQpaTY0OwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CiAKICAgdWludDMyX3QgcmVhZERvdWJsZShkb3VibGUmIGR1YikgewotICAgICh2b2lkKSBkdWI7CisgICAgKHZvaWQpZHViOwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCByZWFkaW5nICh5ZXQpLiIpOwogICB9CiAKICAgdWludDMyX3QgcmVhZFN0cmluZyhzdGQ6OnN0cmluZyYgc3RyKSB7Ci0gICAgKHZvaWQpIHN0cjsKKyAgICAodm9pZClzdHI7CiAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6Tk9UX0lNUExFTUVOVEVELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHJlYWRpbmcgKHlldCkuIik7CiAgIH0KIAogICB1aW50MzJfdCByZWFkQmluYXJ5KHN0ZDo6c3RyaW5nJiBzdHIpIHsKLSAgICAodm9pZCkgc3RyOworICAgICh2b2lkKXN0cjsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgcmVhZGluZyAoeWV0KS4iKTsKICAgfQpAQCAtMTc0LDkgKzE3Miw5IEBACiAgIHVpbnQzMl90IHdyaXRlTWVzc2FnZUJlZ2luKGNvbnN0IHN0ZDo6c3RyaW5nJiBuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUTWVzc2FnZVR5cGUgbWVzc2FnZVR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3Qgc2VxaWQpIHsKLSAgICAodm9pZCkgbmFtZTsKLSAgICAodm9pZCkgbWVzc2FnZVR5cGU7Ci0gICAgKHZvaWQpIHNlcWlkOworICAgICh2b2lkKW5hbWU7CisgICAgKHZvaWQpbWVzc2FnZVR5cGU7CisgICAgKHZvaWQpc2VxaWQ7CiAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6Tk9UX0lNUExFTUVOVEVELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHdyaXRpbmcgKHlldCkuIik7CiAgIH0KQEAgLTE4Niw5ICsxODQsOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHdyaXRpbmcgKHlldCkuIik7CiAgIH0KIAotCiAgIHVpbnQzMl90IHdyaXRlU3RydWN0QmVnaW4oY29uc3QgY2hhciogbmFtZSkgewotICAgICh2b2lkKSBuYW1lOworICAgICh2b2lkKW5hbWU7CiAgICAgdGhyb3cgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbjo6Tk9UX0lNUExFTUVOVEVELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcyBwcm90b2NvbCBkb2VzIG5vdCBzdXBwb3J0IHdyaXRpbmcgKHlldCkuIik7CiAgIH0KQEAgLTE5OCwxMiArMTk1LDEwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgd3JpdGluZyAoeWV0KS4iKTsKICAgfQogCi0gIHVpbnQzMl90IHdyaXRlRmllbGRCZWdpbihjb25zdCBjaGFyKiBuYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFR5cGUgZmllbGRUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MTZfdCBmaWVsZElkKSB7Ci0gICAgKHZvaWQpIG5hbWU7Ci0gICAgKHZvaWQpIGZpZWxkVHlwZTsKLSAgICAodm9pZCkgZmllbGRJZDsKKyAgdWludDMyX3Qgd3JpdGVGaWVsZEJlZ2luKGNvbnN0IGNoYXIqIG5hbWUsIGNvbnN0IFRUeXBlIGZpZWxkVHlwZSwgY29uc3QgaW50MTZfdCBmaWVsZElkKSB7CisgICAgKHZvaWQpbmFtZTsKKyAgICAodm9pZClmaWVsZFR5cGU7CisgICAgKHZvaWQpZmllbGRJZDsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgd3JpdGluZyAoeWV0KS4iKTsKICAgfQpAQCAtMjE4LDEyICsyMTMsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCB3cml0aW5nICh5ZXQpLiIpOwogICB9CiAKLSAgdWludDMyX3Qgd3JpdGVNYXBCZWdpbihjb25zdCBUVHlwZSBrZXlUeXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUeXBlIHZhbFR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDMyX3Qgc2l6ZSkgewotICAgICh2b2lkKSBrZXlUeXBlOwotICAgICh2b2lkKSB2YWxUeXBlOwotICAgICh2b2lkKSB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IH0KIAogICB1aW50MzJfdCB3cml0ZUkzMihjb25zdCBpbnQzMl90IGkzMikgewotICAgICh2b2lkKSBpMzI7CisgICAgKHZvaWQpaTMyOwogICAgIHRocm93IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb246Ok5PVF9JTVBMRU1FTlRFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRoaXMgcHJvdG9jb2wgZG9lcyBub3Qgc3VwcG9ydCB3cml0aW5nICh5ZXQpLiIpOwogICB9CiAKICAgdWludDMyX3Qgd3JpdGVJNjQoY29uc3QgaW50NjRfdCBpNjQpIHsKLSAgICAodm9pZCkgaTY0OworICAgICh2b2lkKWk2NDsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgd3JpdGluZyAoeWV0KS4iKTsKICAgfQogCiAgIHVpbnQzMl90IHdyaXRlRG91YmxlKGNvbnN0IGRvdWJsZSBkdWIpIHsKLSAgICAodm9pZCkgZHViOworICAgICh2b2lkKWR1YjsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIHByb3RvY29sIGRvZXMgbm90IHN1cHBvcnQgd3JpdGluZyAoeWV0KS4iKTsKICAgfQogCiAgIHVpbnQzMl90IHdyaXRlU3RyaW5nKGNvbnN0IHN0ZDo6c3RyaW5nJiBzdHIpIHsKLSAgICAodm9pZCkgc3RyOworICAgICh2b2lkKXN0cjsKICAgICB0aHJvdyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uOjpOT1RfSU1QTEVNRU5URUQsCiAgICA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NoIChjb25zdCBUVHJhbnNwb3J0RXhjZXB0aW9uJiB0dHgpIHsKKyAgICAgIHN3aXRjaCAodHR4LmdldFR5cGUoKSkgeworICAgICAgICBjYXNlIFRUcmFuc3BvcnRFeGNlcHRpb246OkVORF9PRl9GSUxFOgorICAgICAgICBjYXNlIFRUcmFuc3BvcnRFeGNlcHRpb246OklOVEVSUlVQVEVEOgorICAgICAgICBjYXNlIFRUcmFuc3BvcnRFeGNlcHRpb246OlRJTUVEX09VVDoKKyAgICAgICAgICAvLyBDbGllbnQgZGlzY29ubmVjdGVkIG9yIHdhcyBpbnRlcnJ1cHRlZCBvciBkaWQgbm90IHJlc3BvbmQgd2l0aGluIHRoZSByZWNlaXZlIHRpbWVvdXQuCisgICAgICAgICAgLy8gTm8gbG9nZ2luZyBuZWVkZWQuICBEb25lLgorICAgICAgICAgIGRvbmUgPSB0cnVlOworICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAvLyBBbGwgb3RoZXIgdHJhbnNwb3J0IGV4Y2VwdGlvbnMgYXJlIGxvZ2dlZC4KKyAgICAgICAgICAvLyBTdGF0ZSBvZiBjb25uZWN0aW9uIGlzIHVua25vd24uICBEb25lLgorICAgICAgICAgIHN0cmluZyBlcnJTdHIgPSBzdHJpbmcoIlRDb25uZWN0ZWRDbGllbnQgZGllZDogIikgKyB0dHgud2hhdCgpOworICAgICAgICAgIEdsb2JhbE91dHB1dChlcnJTdHIuY19zdHIoKSk7CisgICAgICAgICAgZG9uZSA9IHRydWU7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9IGNhdGNoIChjb25zdCBURXhjZXB0aW9uJiB0ZXgpIHsKKyAgICAgIHN0cmluZyBlcnJTdHIgPSBzdHJpbmcoIlRDb25uZWN0ZWRDbGllbnQgcHJvY2Vzc2luZyBleGNlcHRpb246ICIpICsgdGV4LndoYXQoKTsKKyAgICAgIEdsb2JhbE91dHB1d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GJlIGludmVzdGlnYXRlZC4KKyAgICAgIGlmKCFzdHJzdHIodGUud2hhdCgpLCAicmV0cnkiKSkgeworICAgICAgICBHbG9iYWxPdXRwdXQucHJpbnRmKCJUQ29ubmVjdGlvbjo6d29ya1NvY2tldCgpOiAlcyIsIHRlLndoYXQoKSk7CisgICAgICAgIGNsb3NlKCk7CiAKLSAgICAgIHJldHVybjsKKyAgICAgICAgcmV0dXJuOworICAgICAgfQogICAgIH0KIAogICAgIGlmIChyZWFkQnVmZmVyUG9zXyA8IHNpemVvZihmcmFtaW5nLnNpemUpKSB7CkBAIC00NzYsMTcgKzQ2MywzMSBAQAogICAgIGlmIChyZWFkV2FudF8gPiBzZXJ2ZXJfLT5nZXRNYXhGcmFtZVNpemUoKSkgewogICAgICAgLy8gRG9uJ3QgYWxsb3cgZ2lhbnQgZnJhbWUgc2l6ZXMuICBUaGlzIHByZXZlbnRzIGJhZCBjbGllbnRzIGZyb20KICAgICAgIC8vIGNhdXNpbmcgdXMgdG8gdHJ5IGFuZCBhbGxvY2F0ZSBhIGdpYW50IGJ1ZmZlci4KLSAgICAgIEdsb2JhbE91dHB1dC5wcmludGYoIlROb25ibG9ja2luZ1NlcnZlcjogZnJhbWUgc2l6ZSB0b28gbGFyZ2UgIgotICAgICAgICAgICAgICAgICAgICAgICAgICAiKCUiIFBSSXUzMiAiID4gJSIgUFJJdTY0ICIpIGZyb20gY2xpZW50ICVzLiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICJSZW1vdGUgc2lkZSBub3QgdXNpbmcgVEZyYW1lZFRyYW5zcG9ydD8iLAotICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkV2FudF8sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICh1aW50NjRfdClzZXJ2ZXJfLT5nZXRNYXhGcmFtZVNpemUoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgdFNvY2tldF8tPmdldFNvY2tldEluZm8oKS5jX3N0cigpKTsKKyAgICAgIEdsb2JhbE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bG9zZSgpOworICAgICAgfQorCiAgICAgICByZXR1cm47CiAgICAgfSBlbHNlIHsKICAgICAgIHRyeSB7CiAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXJfKSB7Ci0gICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyXy0+cHJvY2Vzc0NvbnRleHQoY29ubmVjdGlvbkNvbnRleHRfLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFRTb2NrZXQoKSk7CisgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyXy0+cHJvY2Vzc0NvbnRleHQoY29ubmVjdGlvbkNvbnRleHRfLCBnZXRUU29ja2V0KCkpOwogICAgICAgICB9CiAgICAgICAgIC8vIEludm9rZSB0aGUgcHJvY2Vzc29yCi0gICAgICAgIHByb2Nlc3Nvcl8tPnByb2Nlc3MoaW5wdXRQcm90b2NvbF8sIG91dHB1dFByb3RvY29sXywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uQ29udGV4dF8pOwotICAgICAgfSBjYXRjaCAoY29uc3QgVFRyYW5zcG9ydEV4Y2VwdGlvbiAmdHR4KSB7Ci0gICAgICAgIEdsb2JhbE91dHB1dC5wcmludGYoIlROb25ibG9ja2luZ1NlcnZlciB0cmFuc3BvcnQgZXJyb3IgaW4gIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJwcm9jZXNzKCk6ICVzIiwgdHR4LndoYXQoKSk7CisgICAgICAgIHByb2Nlc3Nvcl8tPnByb2Nlc3MoaW5wdXRQcm90b2NvbF8sIG91dHB1dFByb3RvY29sXywgY29ubmVjdGlvbkNvbnRleHRfKTsKKyAgICAgIH0gY2F0Y2ggKGNvbnN0IFRUcmFuc3BvcnRFeGNlcHRpb24mIHR0eCkgeworICAgICAgICBHbG9iYWxPdXRwdXQucHJpbnRmKAorICAgICAgICAgICAgIlROb25ibG9ja2luZ1NlcnZlciB0cmFuc3BvcnQgZXJyb3I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gICAgICBQbGF0Zm9ybVRocmVhZEZhY3Rvcnk6Ok9USEVSLCAgLy8gc2NoZWR1bGVyCisgICAgICAgIFBsYXRmb3JtVGhyZWFkRmFjdG9yeTo6Tk9STUFMLCAvLyBwcmlvcml0eQorICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3RhY2sgc2l6ZSAoTUIpCiAjZW5kaWYKLSAgICAgIGZhbHNlICAgICAgICAgICAgICAgICAgICAgICAvLyBkZXRhY2hlZAotICAgICkpOworICAgICAgICBmYWxzZSAvLyBkZXRhY2hlZAorICAgICAgICApKTsKIAogICAgIGFzc2VydChpb1RocmVhZEZhY3RvcnlfLmdldCgpKTsKIApAQCAtMTI1Nyw3ICsxMTQ3LDggQEAKICAqLwogdm9pZCBUTm9uYmxvY2tpbmdTZXJ2ZXI6OnNlcnZlKCkgewogCi0gIHJlZ2lzdGVyRXZlbnRzKE5VTEwpOworICBpZiAoaW9UaHJlYWRzXy5lbXB0eSgpKQorICAgIHJlZ2lzdGVyRXZlbnRzKE5VTEwpOwogCiAgIC8vIFJ1biB0aGUgcHJpbWFyeSAobGlzdGVuZXIpIElPIHRocmVhZCBsb29wIGluIG91ciBtYWluIHRocmVhZDsgdGhpcyB3aWxsCiAgIC8vIG9ubHkgcmV0dXJuIHdoZW4gdGhlIHNlcnZlciBpcyBzaHV0dGluZyBkb3duLgpAQCAtMTI3NCwxMiArMTE2NSwxMiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBudW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhSSUZUX1NPQ0tFVCBsaXN0ZW5Tb2NrZXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB1c2VIaWdoUHJpb3JpdHkpCi0gICAgICA6IHNlcnZlcl8oc2VydmVyKQotICAgICAgLCBudW1iZXJfKG51bWJlcikKLSAgICA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b3Igbm90aWZ5LiIsCi0gICAgICAgICAgICAgICAgICAgICAgbnVtYmVyXyk7CisgIEdsb2JhbE91dHB1dC5wcmludGYoIlROb25ibG9ja2luZzogSU8gdGhyZWFkICMlZCByZWdpc3RlcmVkIGZvciBub3RpZnkuIiwgbnVtYmVyXyk7CiB9CiAKIGJvb2wgVE5vbmJsb2NraW5nSU9UaHJlYWQ6Om5vdGlmeShUTm9uYmxvY2tpbmdTZXJ2ZXI6OlRDb25uZWN0aW9uKiBjb25uKSB7CkBAIC0xNDA0LDQ2ICsxMjk1LDExNSBAQAogICAgIHJldHVybiBmYWxzZTsKICAgfQogCi0gIGNvbnN0IGludCBrU2l6ZSA9IHNpemVvZihjb25uKTsKLSAgaWYgKHNlbmQoZmQsIGNvbnN0X2Nhc3Rfc29ja29wdCgmY29ubiksIGtTaXplLCAwKSAhPSBrU2l6ZSkgewotICAgIHJldHVybiBmYWxzZTsKKyAgaW50IHJldCA9IC0xOworICBsb25nIGtTaXplID0gc2l6ZW9mKGNvbm4pOworICBjb25zdCBjaGFyICogcG9zID0gKGNvbnN0IGNoYXIgKiljb25zdF9jYXN0X3NvY2tvcHQoJmNvbm4pOworCisjaWYgZGVmaW5lZChIQVZFX1BPTExfSCkgfHwgZGVmaW5lZChIQVZFX1NZU19QT0xMX0gpCisgIHN0cnVjdCBwb2xsZmQgcGZkID0ge2ZkLCBQT0xMT1VULCAwfTsKKworICB3aGlsZSAoa1NpemUgPiAwKSB7CisgICAgcGZkLnJldmVudHMgPSAwOworICAgIHJldCA9IHBvbGwoJnBmZCwgMSwgLTEpOworICAgIGlmIChyZXQgPCAwKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfSBlbHNlIGlmIChyZXQgPT0gMCkgeworICAgICAgY29udGludWU7CisgICAgfQorCisgICAgaWYgKHBmZC5yZXZlbnRzICYgUE9MTEhVUCB8fCBwZmQucmV2ZW50cyAmIFBPTExFUlIpIHsKKyAgICAgIDo6VEhSSUZUX0NMT1NFU09DS0VUKGZkKTsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpZiAocGZkLnJldmVudHMgJiBQT0xMT1VUKSB7CisgICAgICByZXQgPSBzZW5kKGZkLCBwb3MsIGtTaXplLCAwKTsKKyAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgIGlmIChlcnJubyA9PSBFQUdBSU4pIHsKKyAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorCisgICAgICAgIDo6VEhSSUZUX0NMT1NFU09DS0VUKGZkKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgfQorCisgICAgICBrU2l6ZSAtPSByZXQ7CisgICAgICBwb3MgKz0gcmV0OworICAgIH0KICAgfQorI2Vsc2UKKyAgZmRfc2V0IHdmZHMsIGVmZHM7CisKKyAgd2hpbGUgKGtTaXplID4gMCkgeworICAgIEZEX1pFUk8oJndmZHMpOworICAgIEZEX1pFUk8oJmVmZHMpOworICAgIEZEX1NFVChmZCwgJndmZHMpOworICAgIEZEX1NFVChmZCwgJmVmZHMpOworICAgIHJldCA9IHNlbGVjdChzdGF0aWNfY2FzdDxpbnQ+KGZkICsgMSksIE5VTEwsICZ3ZmRzLCAmZWZkcywgTlVMTCk7CisgICAgaWYgKHJldCA8IDApIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9IGVsc2UgaWYgKHJldCA9PSAwKSB7CisgICAgICBjb250aW51ZTsKKyAgICB9CisKKyAgICBpZiAoRkRfSVNTRVQoZmQsICZlZmRzKSkgeworICAgICAgOjpUSFJJRlRfQ0xPU0VTT0NLRVQoZmQpOworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGlmIChGRF9JU1NFVChmZCwgJndmZHMpKSB7CisgICAgICByZXQgPSBzZW5kKGZkLCBwb3MsIGtTaXplLCAwKTsKKyAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgIGlmIChlcnJubyA9PSBFQUdBSU4pIHsKKyAgICAgICAgIC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bGVyKCkge30KIAogICAvKioKQEAgLTU3LDggKzU4LDggQEAKICAgLyoqCiAgICAqIENhbGxlZCB3aGVuIGEgbmV3IGNsaWVudCBoYXMgY29ubmVjdGVkIGFuZCBpcyBhYm91dCB0byBiZWluZyBwcm9jZXNzaW5nLgogICAgKi8KLSAgdmlydHVhbCB2b2lkKiBjcmVhdGVDb250ZXh0KGJvb3N0OjpzaGFyZWRfcHRyPFRQcm90b2NvbD4gaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29zdDo6c2hhcmVkX3B0cjxUUHJvdG9jb2w+IG91dHB1dCkgeworICB2aXJ0dWFsIHZvaWQqIGNyZWF0ZUNvbnRleHQoc3RkOjpzaGFyZWRfcHRyPFRQcm90b2NvbD4gaW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8VFByb3RvY29sPiBvdXRwdXQpIHsKICAgICAodm9pZClpbnB1dDsKICAgICAodm9pZClvdXRwdXQ7CiAgICAgcmV0dXJuIE5VTEw7CkBAIC02OSw4ICs3MCw4IEBACiAgICAqIGNvbnRleHQuCiAgICAqLwogICB2aXJ0dWFsIHZvaWQgZGVsZXRlQ29udGV4dCh2b2lkKiBzZXJ2ZXJDb250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29zdDo6c2hhcmVkX3B0cjxUUHJvdG9jb2w+aW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb3N0OjpzaGFyZWRfcHRyPFRQcm90b2NvbD5vdXRwdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPFRQcm90b2NvbD4gaW5wdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxUUHJvdG9jb2w+IG91dHB1dCkgewogICAgICh2b2lkKXNlcnZlckNvbnRleHQ7CiAgICAgKHZvaWQpaW5wdXQ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gICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VFRyYW5zcG9ydEZhY3Rvcnk+JiB0cmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRQcm90b2NvbEZhY3Rvcnk+JiBwcm90b2NvbEZhY3RvcnkpCisgIDogVFNlcnZlcihwcm9jZXNzb3IsIHNlcnZlclRyYW5zcG9ydCwgdHJhbnNwb3J0RmFjdG9yeSwgcHJvdG9jb2xGYWN0b3J5KSwKKyAgICBjbGllbnRzXygwKSwKKyAgICBod21fKDApLAorICAgIGxpbWl0XyhJTlQ2NF9NQVgpIHsKK30KKworVFNlcnZlckZyYW1ld29yazo6VFNlcnZlckZyYW1ld29yayhjb25zdCBzaGFyZWRfcHRyPFRQcm9jZXNzb3JGYWN0b3J5PiYgcHJvY2Vzc29yRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUU2VydmVyVHJhbnNwb3J0PiYgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRUcmFuc3BvcnRGYWN0b3J5PiYgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRUcmFuc3BvcnRGYWN0b3J5PiYgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUUHJvdG9jb2xGYWN0b3J5PiYgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VFByb3RvY29sRmFjdG9yeT4mIG91dHB1dFByb3RvY29sRmFjdG9yeSkKKyAgOiBUU2VydmVyKHByb2Nlc3NvckZhY3RvcnksCisgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICBpbnB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICBvdXRwdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICBvdXRwdXRQcm90b2NvbEZhY3RvcnkpLAorICAgIGNsaWVudHNfKDApLAorICAgIGh3bV8oMCksCisgICAgbGltaXRfKElOVDY0X01BWCkgeworfQorCitUU2VydmVyRnJhbWV3b3JrOjpUU2VydmVyRnJhbWV3b3JrKGNvbnN0IHNoYXJlZF9wdHI8VFByb2Nlc3Nvcj4mIHByb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUU2VydmVyVHJhbnNwb3J0PiYgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRUcmFuc3BvcnRGYWN0b3J5PiYgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRUcmFuc3BvcnRGYWN0b3J5PiYgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUUHJvdG9jb2xGYWN0b3J5PiYgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VFByb3RvY29sRmFjdG9yeT4mIG91dHB1dFByb3RvY29sRmFjdG9yeSkKKyAgOiBUU2VydmVyKHByb2Nlc3NvciwKKyA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gICAgd2hpbGUgKGNsaWVudHNfID49IGxpbWl0XykgeworICAgICAgICAgIG1vbl8ud2FpdCgpOworICAgICAgICB9CisgICAgICB9CisKKyAgICAgIGNsaWVudCA9IHNlcnZlclRyYW5zcG9ydF8tPmFjY2VwdCgpOworCisgICAgICBpbnB1dFRyYW5zcG9ydCA9IGlucHV0VHJhbnNwb3J0RmFjdG9yeV8tPmdldFRyYW5zcG9ydChjbGllbnQpOworICAgICAgb3V0cHV0VHJhbnNwb3J0ID0gb3V0cHV0VHJhbnNwb3J0RmFjdG9yeV8tPmdldFRyYW5zcG9ydChjbGllbnQpOworICAgICAgaWYgKCFvdXRwdXRQcm90b2NvbEZhY3RvcnlfKSB7CisgICAgICAgIGlucHV0UHJvdG9jb2wgPSBpbnB1dFByb3RvY29sRmFjdG9yeV8tPmdldFByb3RvY29sKGlucHV0VHJhbnNwb3J0LCBvdXRwdXRUcmFuc3BvcnQpOworICAgICAgICBvdXRwdXRQcm90b2NvbCA9IGlucHV0UHJvdG9jb2w7CisgICAgICB9IGVsc2UgeworICAgICAgICBpbnB1dFByb3RvY29sID0gaW5wdXRQcm90b2NvbEZhY3RvcnlfLT5nZXRQcm90b2NvbChpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgIG91dHB1dFByb3RvY29sID0gb3V0cHV0UHJvdG9jb2xGYWN0b3J5Xy0+Z2V0UHJvdG9jb2wob3V0cHV0VHJhbnNwb3J0KTsKKyAgICAgIH0KKworICAgICAgbmV3bHlDb25uZWN0ZWRDbGllbnQoc2hhcmVkX3B0cjxUQ29ubmVjdGVkQ2xpZW50PigKKyAgICAgICAgICBuZXcgVENvbm5lY3RlZENsaWVudChnZXRQcm9jZXNzb3IoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wsIGNsaWVudCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2N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saW1pdGluZyBhZnRlciBvbkNsaWVudENvbm5lY3RlZCByZXR1cm5zIGJ5IGJsb2NraW5nIHRoZQorICAgKiBzZXJ2ZSgpIHRocmVhZCBpZiB0aGUgbGltaXQgaGFzIGJlZW4gcmVhY2hlZC4KKyAgICovCisgIHZvaWQgbmV3bHlDb25uZWN0ZWRDbGllbnQoY29uc3Qgc3RkOjpzaGFyZWRfcHRyPFRDb25uZWN0ZWRDbGllbnQ+JiBwQ2xpZW50KTsKKworICAvKioKKyAgICogU21hcnQgcG9pbnRlciBjbGllbnQgZGVsZXRpb24uCisgICAqIENhbGxzIG9uQ2xpZW50RGlzY29ubmVjdGVkIGFuZCB0aGVuIGRlbGV0ZXMgcENsaWVudC4KKyAgICovCisgIHZvaWQgZGlzcG9zZUNvbm5lY3RlZENsaWVudChUQ29ubmVjdGVkQ2xpZW50KiBwQ2xpZW50KTsKKworICAvKioKKyAgICogTW9uaXRvciBmb3IgbGltaXRpbmcgdGhlIG51bWJlciBvZiBjb25jdXJyZW50IGNsaWVudHMuCisgICAqLworICBhcGFjaGU6OnRocmlmdDo6Y29uY3VycmVuY3k6Ok1vbml0b3IgbW9uXzsKKworICAvKioKKyAgICogVGhlIG51bWJlciBvZiBjb25jdXJyZW50IGNsaWVudHMuCisgICAqLworICBpbnQ2NF90IGNsaWVudHNfOworCisgIC8qKgorICAgKiBUaGUgaGlnaCB3YXRlciBtYXJrIG9mIGNvbmN1cnJlbnQgY2xpZW50cy4KKyAgICovCisgIGludDY0X3QgaHdtXzsKKworICAvKioKKyAgICogVGhlIGxpbWl0IG9uIHRoZSBudW1iZXIgb2YgY29uY3VycmVudCBjbGllbnRzLgorICAgKi8KKyAgaW50NjRfdCBsaW1pdF87Cit9OworfQorfQorfSAvLyBhcGFjaGU6OnRocmlmdDo6c2VydmVyCisKKyNlbmRpZiAvLyAjaWZuZGVmIF9USFJJRlRfU0VSVkVSX1RTRVJWRVJGUkFNRVdPUktfSF8KZGlmZiAtLWdpdCBhL2xp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ZW50SGFuZGxlcl8tPmNyZWF0ZUNvbnRleHQoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wpOwotICAgIH0KLSAgICB0cnkgewotICAgICAgZm9yICg7OykgewotICAgICAgICBpZiAoZXZlbnRIYW5kbGVyXykgewotICAgICAgICAgIGV2ZW50SGFuZGxlcl8tPnByb2Nlc3NDb250ZXh0KGNvbm5lY3Rpb25Db250ZXh0LCBjbGllbnQpOwotICAgICAgICB9Ci0gICAgICAgIGlmICghcHJvY2Vzc29yLT5wcm9jZXNzKGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY29sLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uQ29udGV4dCkgfHwKLSAgICAgICAgICAvLyBQZWVrIGFoZWFkLCBpcyB0aGUgcmVtb3RlIHNpZGUgY2xvc2VkPwotICAgICAgICAgICAgIWlucHV0UHJvdG9jb2wtPmdldFRyYW5zcG9ydCgpLT5wZWVrKCkpIHsKLSAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgfQotICAgIH0gY2F0Y2ggKGNvbnN0IFRUcmFuc3BvcnRFeGNlcHRpb24mIHR0eCkgewotICAgICAgc3RyaW5nIGVyclN0ciA9IHN0cmluZygiVFNpbXBsZVNlcnZlciBjbGllbnQgZGllZDogIikgKyB0dHgud2hhdCgpOwotICAgICAgR2xvYmFsT3V0cHV0KGVyclN0ci5jX3N0cigpKTsKLSAgICB9IGNhdGNoIChjb25zdCBzdGQ6OmV4Y2VwdGlvbiYgeCkgewotICAgICAgR2xvYmFsT3V0cHV0LnByaW50ZigiVFNpbXBsZVNlcnZlciBleGNlcHRpb246ICVzOiAlcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVpZCh4KS5uYW1lKCksIHgud2hhdCgpKTsKLSAgICB9IGNhdGNoICguLi4pIHsKLSAgICAgIEdsb2JhbE91dHB1dCgiVFNpbXBsZVNlcnZlciB1bmNhdWdodCBleGN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V0cHV0UHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VGhyZWFkTWFuYWdlcj4mIHRocmVhZE1hbmFnZXIpCisgIDogVFNlcnZlckZyYW1ld29yayhwcm9jZXNzb3JGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2xGYWN0b3J5KSwKKyAgICB0aHJlYWRNYW5hZ2VyXyh0aHJlYWRNYW5hZ2VyKSwKKyAgICB0aW1lb3V0XygwKSwKKyAgICB0YXNrRXhwaXJhdGlvbl8oMCkgeworfQogCi0gIH5UYXNrKCkge30KK1RUaHJlYWRQb29sU2VydmVyOjpUVGhyZWFkUG9vbFNlcnZlcihjb25zdCBzaGFyZWRfcHRyPFRQcm9jZXNzb3I+JiBwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUU2VydmVyVHJhbnNwb3J0PiYgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VFRyYW5zcG9ydEZhY3Rvcnk+JiBpbnB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUVHJhbnNwb3J0RmFjdG9yeT4mIG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUUHJvdG9jb2xGYWN0b3J5PiYgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUUHJvdG9jb2xGYWN0b3J5PiYgb3V0cHV0UHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VGhyZWFkTWFuYWdlcj4mIHRocmVhZE1hbmFnZXIpCisgIDogVFNlcnZlckZyYW1ld29yayhwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICBpbnB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBvdXRwdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbEZhY3RvcnkpLAorICAgIHRocmVhZE1hbmFnZXJfKHRocmVhZE1hbmFnZXIpLAorICAgIHRpbWVvdXRfKDApLAorICAgIHRhc2tFeHBpcmF0aW9uXygwKSB7Cit9CiAKLSAgdm9pZCBydW4oKSB7Ci0gICAgYm9vc3Q6OnNoYXJlZF9wdHI8VFNlcnZlckV2ZW50SGFuZGxlcj4gZXZlbnRIYW5kbGVyID0KLSAgICAgIHNlcnZlcl8uZ2V0RXZlbnRIYW5kbGVyKCk7Ci0gICAgdm9pZCogY29ubmVjdGlvbkNvbnRleHQgPSBOVUxMOwotICAgIGlmIChldmVudEhhbmRsZXIpIHsKLSAgICAgIGNvbm5lY3Rpb25Db250ZXh0ID0gZXZlbnRIYW5kbGVyLT5jcmVhdGVDb250ZXh0KGlucHV0Xywgb3V0cHV0Xyk7Ci0gICAgfQotICAgI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WN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUUHJvdG9jb2xGYWN0b3J5PiYgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRQcm90b2NvbEZhY3Rvcnk+JiBvdXRwdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRocmVhZEZhY3Rvcnk+JiB0aHJlYWRGYWN0b3J5KQorICA6IFRTZXJ2ZXJGcmFtZXdvcmsocHJvY2Vzc29yRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgIGlucHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sRmFjdG9yeSksCisgICAgdGhyZWFkRmFjdG9yeV8odGhyZWFkRmFjdG9yeSkgeworfQorCitUVGhyZWFkZWRTZXJ2ZXI6OlRUaHJlYWRlZFNlcnZlcihjb25zdCBzaGFyZWRfcHRyPFRQcm9jZXNzb3I+JiBwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRTZXJ2ZXJUcmFuc3BvcnQ+JiBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRUcmFuc3BvcnRGYWN0b3J5PiYgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2hhcmVkX3B0cjxUVHJhbnNwb3J0RmFjdG9yeT4mIG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaGFyZWRfcHRyPFRQcm90b2NvbEZhY3Rvcnk+JiBpbnB1dFByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VFByb3RvY29sRmFjdG9yeT4mIG91dHB1dFByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHNoYXJlZF9wdHI8VGhyZWFkRmFjdG9yeT4mIHRocmVhZEZhY3RvcnkpCisgIDogVFNlcnZlckZyYW1ld29yayhwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICBpbnB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBvdXRwdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbEZhY3RvcnkpLAorICAgIHRocmVhZEZhY3RvcnlfKHRocmVhZEZhY3RvcnkpIHsKK30KKworVFRocmVhZGVkU2VydmVyOjp+VFRocmVhZGVkU2VydmVyKCkgeworfQogCiB2b2lkIFRUaHJlYWRlZFNlcnZlcjo6c2VydmUoKSB7CisgIFRTZXJ2ZXJGcmFtZXdvcms6OnNlcnZlKCk7CiAKLSAgc2hhcmVkX3B0cjxUVHJhbnNwb3J0PiBjbGllbnQ7Ci0gIHNoYXJlZF9wdHI8VFRyYW5zcG9ydD4gaW5wdXRUcmFuc3BvcnQ7Ci0gIHNoYXJlZF9wdHI8VFRyYW5zcG9ydD4gb3V0cHV0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+Z2V0VHJhbnNwb3J0KGNsaWVudCk7Ci0gICAgICBpbnB1dFByb3RvY29sID0gaW5wdXRQcm90b2NvbEZhY3RvcnlfLT5nZXRQcm90b2NvbChpbnB1dFRyYW5zcG9ydCk7Ci0gICAgICBvdXRwdXRQcm90b2NvbCA9IG91dHB1dFByb3RvY29sRmFjdG9yeV8tPmdldFByb3RvY29sKG91dHB1dFRyYW5zcG9ydCk7Ci0KLSAgICAgIHNoYXJlZF9wdHI8VFByb2Nlc3Nvcj4gcHJvY2Vzc29yID0gZ2V0UHJvY2Vzc29yKGlucHV0UHJvdG9jb2wsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbCwgY2xpZW50KTsKLQotICAgICAgVFRocmVhZGVkU2VydmVyOjpUYXNrKiB0YXNrID0gbmV3IFRUaHJlYWRlZFNlcnZlcjo6VGFzaygqdGhpcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc29yLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50KTsKLQotICAgICAgLy8gQ3JlYXRlIGEgdGFzawotICAgICAgc2hhcmVkX3B0cjxSdW5uYWJsZT4gcnVubmFibGUgPQotICAgICAgICBzaGFyZWRfcHRyPFJ1bm5hYmxlPih0YXNrKTsKLQotICAgICAgLy8gQ3JlYXRlIGEgdGhyZWFkIGZvciB0aGlzIHRhc2sKLSAgICAgIHNoYXJlZF9wdHI8VGhyZWFkPiB0aHJlYWQ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cHRpb246OkJBRF9BUkdTLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJJbnZhbGlkIE1lbW9yeVBvbGljeSBmb3IgVE1lbW9yeUJ1ZmZlciIpOworICAgIGNhc2UgT0JTRVJWRToKKyAgICBjYXNlIFRBS0VfT1dORVJTSElQOgorICAgICAgaW5pdENvbW1vbihidWYsIHN6LCBwb2xpY3kgPT0gVEFLRV9PV05FUlNISVAsIHN6KTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgQ09QWToKKyAgICAgIGluaXRDb21tb24oTlVMTCwgc3osIHRydWUsIDApOworICAgICAgdGhpcy0+d3JpdGUoYnVmLCBzeik7CisgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpCQURfQVJHUywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkludmFsaWQgTWVtb3J5UG9saWN5IGZvciBUTWVtb3J5QnVmZmVyIik7CiAgICAgfQogICB9CiAKQEAgLTU1NywxMyArNTUwLDkgQEAKICAgICB9CiAgIH0KIAotICBib29sIGlzT3BlbigpIHsKLSAgICByZXR1cm4gdHJ1ZTsKLSAgfQorICBib29sIGlzT3BlbigpIHsgcmV0dXJuIHRydWU7IH0KIAotICBib29sIHBlZWsoKSB7Ci0gICAgcmV0dXJuIChyQmFzZV8gPCB3QmFzZV8pOwotICB9CisgIGJvb2wgcGVlaygpIHsgcmV0dXJuIChyQmFzZV8gPCB3QmFzZV8pOyB9CiAKICAgdm9pZCBvcGVuKCkge30KIApAQCAtNjQ2LDcgKzYzNSw3IEBACiAKICAgLy8gcmV0dXJuIG51bWJlciBvZiBieXRlcyByZWFkCiAgIHVpbnQzMl90IHJlYWRFbmQoKSB7Ci0gICAgLy9UaGlzIGNhc3Qgc2hvdWxkIGJlIHNhZmUsIGJlY2F1c2UgYnVmZmVyXydzIHNpemUgaXMgYSB1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HJlYWRPbmx5XyhyZWFkT25seSkgewogICB0aHJlYWRGYWN0b3J5Xy5zZXREZXRhY2hlZChmYWxzZSk7CiAgIG9wZW5Mb2dGaWxlKCk7CiB9CkBAIC05OSwxMiArMTA1LDE0IEBACiAgICAgLy8gZmx1c2ggYW55IGV2ZW50cyBpbiB0aGUgcXVldWUKICAgICBmbHVzaCgpOwogICAgIEdsb2JhbE91dHB1dC5wcmludGYoImVycm9yLCBjdXJyZW50IGZpbGUgKCVzKSBub3QgY2xvc2VkIiwgZmlsZW5hbWVfLmNfc3RyKCkpOwotICAgIGlmICgtMSA9PSA6OlRIUklGVF9DTE9TRVNPQ0tFVChmZF8pKSB7Ci0gICAgICBpbnQgZXJybm9fY29weSA9IFRIUklGVF9HRVRfU09DS0VUX0VSUk9SOworICAgIGlmICgtMSA9PSA6OlRIUklGVF9DTE9TRShmZF8pKSB7CisgICAgICBpbnQgZXJybm9fY29weSA9IFRIUklGVF9FUlJOTzsKICAgICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlRGaWxlVHJhbnNwb3J0OiByZXNldE91dHB1dEZpbGUoKSA6OmNsb3NlKCkgIiwgZXJybm9fY29weSk7Ci0gICAgICB0aHJvdyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb246OlVOS05PV04sICJURmlsZVRyYW5zcG9ydDogZXJyb3IgaW4gZmlsZSBjbG9zZSIsIGVycm5vX2NvcHkpOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpVTktOT1dOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVEZpbGVUcmFuc3BvcnQ6IGVycm9yIGluIGZpbGUgY2xvc2UiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJub19jb3B5KTsKICAgICB9IGVsc2UgewotICAgICAgLy9zdWNjZXNzZnVsbHkgY2xvc2VkIGZkCisgICAgICAvL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ArMzg5LDIwIEBACiAgICAgICAgICAgICBzZWVrVG9FbmQoKTsKICAgICAgICAgICAgIHVuZmx1c2hlZCA9IDA7CiAgICAgICAgICAgICBoYXNJT0Vycm9yID0gZmFsc2U7Ci0gICAgICAgICAgICBUX0xPR19PUEVSKCJURmlsZVRyYW5zcG9ydDogbG9nIGZpbGUgJXMgcmVvcGVuZWQgYnkgd3JpdGVyIHRocmVhZCBkdXJpbmcgZXJyb3IgcmVjb3ZlcnkiLCBmaWxlbmFtZV8uY19zdHIoKSk7CisgICAgICAgICAgICBUX0xPR19PUEVSKAorICAgICAgICAgICAgICAgICJURmlsZVRyYW5zcG9ydDogbG9nIGZpbGUgJXMgcmVvcGVuZWQgYnkgd3JpdGVyIHRocmVhZCBkdXJpbmcgZXJyb3IgcmVjb3ZlcnkiLAorICAgICAgICAgICAgICAgIGZpbGVuYW1lXy5jX3N0cigpKTsKICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKLSAgICAgICAgICAgIFRfRVJST1IoIlRGaWxlVHJhbnNwb3J0OiB1bmFibGUgdG8gcmVvcGVuIGxvZyBmaWxlICVzIGR1cmluZyBlcnJvciByZWNvdmVyeSIsIGZpbGVuYW1lXy5jX3N0cigpKTsKKyAgICAgICAgICAgIFRfRVJST1IoIlRGaWxlVHJhbnNwb3J0OiB1bmFibGUgdG8gcmVvcGVuIGxvZyBmaWxlICVzIGR1cmluZyBlcnJvciByZWNvdmVyeSIsCisgICAgICAgICAgICAgICAgICAgIGZpbGVuYW1lXy5jX3N0cigpKTsKICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICAvLyBzYW5pdHkgY2hlY2sgb24gZXZlbnQKICAgICAgICAgaWYgKChtYXhFdmVudFNpemVfID4gMCkgJiYgKG91dEV2ZW50LT5ldmVudFNpemVfID4gbWF4RXZlbnRTaXplXykpIHsKLSAgICAgICAgICBUX0VSUk9SKCJtc2cgc2l6ZSBpcyBncmVhdGVyIHRoYW4gbWF4IGV2ZW50IHNpemU6ICV1ID4gJXVcbiIsIG91dEV2ZW50LT5ldmVudFNpemVfLCBtYXhFdmVudFNpemVfKTsKKyAgICAgICAgICBUX0VSUk9SKCJtc2cgc2l6ZSBpcyBncmVhdGVyIHRoYW4gbWF4IGV2ZW50IHNpemU6ICV1ID4gJXVcbiIsCisgICAgICAgICAgICAgICAgICBvdXRFdmVudC0+ZXZlbnRTaXplXywKKyAgICAgICAgICAgICAgICAgIG1heEV2ZW50U2l6ZV8pOwogICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICB9CiAKQEAgLTM5MywyNSArNDEwLDI4IEBACiAgICAgICAgIGlmICgob3V0RXZlbnQtPmV2ZW50U2l6ZV8gPiAwKSAmJiAoY2h1bmtTaXplXyAhPSAwKSkgewogICAgICAgICAgIC8vIGV2ZW50IHNpemUgbXVzdCBiZSBsZXNzIHRoYW4gY2h1bmsgc2l6ZQogICAgICAgICAgIGlmIChvdXRFdmVudC0+ZXZlbnRTaXplXyA+IGNodW5rU2l6ZV8pIHsKLSAgICAgICAgICAgIFRfRVJST1IoIlRGaWxlVHJhbnNwb3J0OiBldmVudCBzaXplKCV1KSA+IGNodW5rIHNpemUoJXUpOiBza2lwcGluZyBldmVudCIsIG91dEV2ZW50LT5ldmVudFNpemVfLCBjaHVua1NpemVfKTsKKyAgICAgICAgICAgIFRfRVJST1IoIlRGaWxlVHJhbnNwb3J0OiBldmVudCBzaXplKCV1KSA+IGNodW5rIHNpemUoJXUpOiBza2lwcGluZyBldmVudCIsCisgICAgICAgICAgICAgICAgICAgIG91dEV2ZW50LT5ldmVudFNpemVfLAorICAgICAgICAgICAgICAgICAgICBjaHVua1NpemVfKTsKICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgIH0KIAotICAgICAgICAgIGludDY0X3QgY2h1bmsxID0gb2Zmc2V0Xy9jaHVua1NpemVfOwotICAgICAgICAgIGludDY0X3QgY2h1bmsyID0gKG9mZnNldF8gKyBvdXRFdmVudC0+ZXZlbnRTaXplXyAtIDEpL2NodW5rU2l6ZV87CisgICAgICAgICAgaW50NjRfdCBjaHVuazEgPSBvZmZzZXRfIC8gY2h1bmtTaXplXzsKKyAgICAgICAgICBpbnQ2NF90IGNodW5rMiA9IChvZmZzZXRfICsgb3V0RXZlbnQtPmV2ZW50U2l6ZV8gLSAxKSAvIGNodW5rU2l6ZV87CiAKICAgICAgICAgICAvLyBpZiBhZGRpbmcgdGhpcyBldmVudCB3aWxsIGNyb3NzIGEgY2h1bmsgYm91bmRhcnksIHBhZCB0aGUgY2h1bmsgd2l0aCB6ZXJvcwogICAgICAgICAgIGlmIChjaHVuazEgIT0gY2h1bmsyKSB7CiAgICAgICAgICAgICAvLyByZWZldGNoIHRoZSBvZmZzZXQgdG8ga2VlcCBpbiBzeW5jCi0gICAgICAgICAgICBvZmZzZXRfID0gbHNlZWsoZmRfLCAwLCBTRUVLX0NVUik7CisgICAgICAgICAgICBvZmZzZXRfID0gVEhSSUZUX0xTRUVLKGZkXywgMCwgU0VFS19DVVIpOwogICAgICAgICAgICAgaW50MzJfdCBwYWRkaW5nID0gKGludDMyX3QpKChvZmZzZXRfIC8gY2h1bmtTaXplXyArIDEpICogY2h1bmtTaXplXyAtIG9mZnNldF8pOwogCiAgICAgICAgICAgICB1aW50OF90KiB6ZXJvcyA9IG5ldyB1aW50OF90W3BhZGRpbmddOwogICAgICAgICAgICAgbWVtc2V0KHplcm9zLCAnXDAnLCBwYWRkaW5nKTsKICAgICAgICAgICAgIGJvb3N0OjpzY29wZWRfYXJyYXk8dWludDhfdD4gYXJyYXkoemVyb3MpOwogICAgICAgICAgICAgaWYgKC0xID09IDo6d3JpdGUoZmRfLCB6ZXJvcywgcGFkZGluZykpIHsKLSAgICAgICAgICAgICAgaW50IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKLSAgICAgICAgICAgICAgR2xvYmFsT3V0cHV0LnBlcnJvcigiVEZpbGVUcmFuc3BvcnQ6IHdyaXRlclRocmVhZCgpIGVycm9yIHdoaWxlIHBhZGRpbmcgemVyb3MgIiwgZXJybm9fY29weSk7CisgICAgICAgICAgICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0VSUk5POworICAgICAgICAgICAgICBHbG9iYWxPdXRwdXQucGVycm9yKCJURmlsZVRyYW5zcG9ydDogd3JpdGVyVGhyZWFkKCkgZXJyb3Igd2hpbGUgcGFkZGluZyB6ZXJvcyAiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm5vX2NvcHkpOwogICAgICAgICAgICAgICBoYXNJT0Vycm9yID0gdHJ1ZTsKICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9CkBAIC00MjIsOCArNDQyLDggQEAKIAogICAgICAgICAvLyB3cml0ZSB0aGUgZGVxdWV1ZWQgZXZlbnQgdG8gdGhlIGZpbGUKICAgICAgICAgaWYgKG91dEV2ZW50LT5ldmVudFNpemVfID4gMCkgewotICAgICAgICAgIGlmICgtMSA9PSA6OndyaXRlKGZkXywgb3V0RXZlbnQtPmV2ZW50QnVmZl8sIG91dEV2ZW50LT5ldmVudFNpemVfKSkgewotICAgICAgICAgICAgaW50IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKKyAgICAgICAgICBpZiAoLTEgPT0gOjpUSFJJRlRfV1JJVEUoZmRfLCBvdXRFdmVudC0+ZXZlbnRCdWZmXywgb3V0RXZlbnQtPmV2ZW50U2l6ZV8pKSB7CisgICAgICAgICAgICBpbnQgZXJybm9fY29weSA9IFRIUklGVF9FUlJOTzsKICAgICAgICAgICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlRGaWxlVHJhbnNwb3J0OiBlcnJvciB3aGlsZSB3cml0aW5nIGV2ZW50ICIsIGVycm5vX2NvcHkpOwogICAgICAgICAgICAgaGFzSU9FcnJvciA9IHRydWU7CiAgICAgICAgICAgICBjb250aW51ZTsKQEAgLTQ0NiwyNCArNDY2LDI0IEBACiA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9uOjpDT1JSVVBURURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiSGVhZGVyIHRyYW5zcG9ydCBmcmFtZSBpcyB0b28gc21hbGwiKTsKKyAgICAgIH0KKworICAgICAgdHJhbnNwb3J0Xy0+cmVhZEFsbChyQnVmXy5nZXQoKSArIDQsIHN6IC0gNCk7CisKKyAgICAgIC8vIGhlYWRlciBmb3JtYXQKKyAgICAgIGNsaWVudFR5cGUgPSBUSFJJRlRfSEVBREVSX0NMSUVOVF9UWVBFOworICAgICAgLy8gZmxhZ3MKKyAgICAgIGZsYWdzID0gbWFnaWMgJiBGTEFHU19NQVNLOworICAgICAgLy8gc2VxSWQKKyAgICAgIHVpbnQzMl90IHNlcUlkX247CisgICAgICBtZW1jcHkoJnNlcUlkX24sIHJCdWZfLmdldCgpICsgNCwgc2l6ZW9mKHNlcUlkX24pKTsKKyAgICAgIHNlcUlkID0gbnRvaGwoc2VxSWRfbik7CisgICAgICAvLyBoZWFkZXIgc2l6ZQorICAgICAgdWludDE2X3QgaGVhZGVyU2l6ZV9uOworICAgICAgbWVtY3B5KCZoZWFkZXJTaXplX24sIHJCdWZfLmdldCgpICsgOCwgc2l6ZW9mKGhlYWRlclNpemVfbikpOworICAgICAgdWludDE2X3QgaGVhZGVyU2l6ZSA9IG50b2hzKGhlYWRlclNpemVfbik7CisgICAgICBzZXRSZWFkQnVmZmVyKHJCdWZfLmdldCgpLCBzeik7CisgICAgICByZWFkSGVhZGVyRm9ybWF0KGhlYWRlclNpemUsIHN6KTsKKyAgICB9IGVsc2UgeworICAgICAgY2xpZW50VHlwZSA9IFRIUklGVF9VTktOT1dOX0NMSUVOVF9UWVBFOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpCQURfQVJHUywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCBkZXRlY3QgY2xpZW50IHRyYW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2luKCk7IGl0ICE9IHJlYWRUcmFuc18uZW5kKCk7ICsraXQpIHsKKyAgICBjb25zdCB1aW50MTZfdCB0cmFuc0lkID0gKml0OworCisgICAgaWYgKHRyYW5zSWQgPT0gWkxJQl9UUkFOU0ZPUk0pIHsKKyAgICAgIHpfc3RyZWFtIHN0cmVhbTsKKyAgICAgIGludCBlcnI7CisKKyAgICAgIHN0cmVhbS5uZXh0X2luID0gcHRyOworICAgICAgc3RyZWFtLmF2YWlsX2luID0gc3o7CisKKyAgICAgIC8vIFNldHRpbmcgdGhlc2UgdG8gMCBtZWFucyB1c2UgdGhlIGRlZmF1bHQgZnJlZS9hbGxvYyBmdW5jdGlvbnMKKyAgICAgIHN0cmVhbS56YWxsb2MgPSAoYWxsb2NfZnVuYykwOworICAgICAgc3RyZWFtLnpmcmVlID0gKGZyZWVfZnVuYykwOworICAgICAgc3RyZWFtLm9wYXF1ZSA9ICh2b2lkcGYpMDsKKyAgICAgIGVyciA9IGluZmxhdGVJbml0KCZzdHJlYW0pOworICAgICAgaWYgKGVyciAhPSBaX09LKSB7CisgICAgICAgIHRocm93IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbihUQXBwbGljYXRpb25FeGNlcHRpb246Ok1JU1NJTkdfUkVTVUxULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkVycm9yIHdoaWxlIHpsaWIgZGVmbGF0ZUluaXQiKTsKKyAgICAgIH0KKyAgICAgIHN0cmVhbS5uZXh0X291dCA9IHRCdWZfLmdldCgpOworICAgICAgc3RyZWFtLmF2YWlsX291dCA9IHRCdWZTaXplXzsKKyAgICAgIGVyciA9IGluZmxhdGUoJnN0cmVhbSwgWl9GSU5JU0gpOworICAgICAgaWYgKGVyciAhPSBaX1NUUkVBTV9FTkQgfHwgc3RyZWFtLmF2YWlsX291dCA9PSAwKSB7CisgICAgICAgIHRocm93IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbihUQXBwbGljYXRpb25FeGNlcHRpb246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bnNmb3JtcygpKSAqIFRIUklGVF9NQVhfVkFSSU5UMzJfQllURVMgKyA0OworICAgIC8vIGFkZCBhcHByb3hpbWF0ZSBzaXplIG9mIGluZm8gaGVhZGVycworICAgIGhlYWRlclNpemUgKz0gZ2V0TWF4V3JpdGVIZWFkZXJzU2l6ZSgpOworCisgICAgLy8gUGt0IHNpemUKKyAgICB1aW50MzJfdCBtYXhTekhibyA9IGhlYWRlclNpemUgKyBoYXZlQnl0ZXMgLy8gdGhyaWZ0IGhlYWRlciArIHBheWxvYWQKKyAgICAgICAgICAgICAgICAgICAgICAgICsgMTA7ICAgICAgICAgICAgICAgICAgLy8gY29tbW9uIGhlYWRlciBzZWN0aW9uCisgICAgdWludDhfdCogcGt0ID0gdEJ1Zl8uZ2V0KCk7CisgICAgdWludDhfdCogaGVhZGVyU3RhcnQ7CisgICAgdWludDhfdCogaGVhZGVyU2l6ZVB0cjsKKyAgICB1aW50OF90KiBwa3RTdGFydCA9IHBrdDsKKworICAgIGlmIChtYXhTekhibyA+IHRCdWZTaXplXykgeworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpDT1JSVVBURURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkF0dGVtcHRpbmcgdG8gaGVhZGVyIGZyYW1lIHRoYXQgaXMgdG9vIGxhcmdlIik7CisgICAgfQorCisgICAgdWludDMyX3Qgc3pIYm87CisgICAgdWludDMyX3Qgc3pOYm87CisgICAgdWludDE2X3QgaGVhZGVyU2l6ZU47CisKKyAgICAvLyBGaXh1cCBzekhibyBsYXRlcgorICAgIHBrdCArPSBzaXplb2Yoc3pOYm8pOworICAgIHVpbnQxNl90IGhlYWRlck4gPSBodG9ucyhIRUFERVJfTUFHSUMgPj4gMTYpOworICAgIG1lbWNweShwa3QsICZoZWFkZXJOLCBzaXplb2YoaGVhZGVyTikpOworICAgIHBrdCArPSBzaXplb2YoaGVhZG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cnRFeGNlcHRpb246Ok5PVF9PUEVOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCByZXNvbHZlIGhvc3QgZm9yIHNlcnZlciBzb2NrZXQuIik7CisgIH0KKworICAvLyBQaWNrIHRoZSBpcHY2IGFkZHJlc3MgZmlyc3Qgc2luY2UgaXB2NCBhZGRyZXNzZXMgY2FuIGJlIG1hcHBlZAorICAvLyBpbnRvIGlwdjYgc3BhY2UuCisgIGZvciAocmVzID0gaW5mby5yZXMoKTsgcmVzOyByZXMgPSByZXMtPmFpX25leHQpIHsKKyAgICBpZiAocmVzLT5haV9mYW1pbHkgPT0gQUZfSU5FVDYgfHwgcmVzLT5haV9uZXh0ID09IE5VTEwpCisgICAgICBicmVhazsKKyAgfQorCisgIGlmICghcGF0aF8uZW1wdHkoKSkgeworICAgIHNlcnZlclNvY2tldF8gPSBzb2NrZXQoUEZfVU5JWCwgU09DS19TVFJFQU0sIElQUFJPVE9fSVApOworICB9IGVsc2UgaWYgKHJlcyAhPSBOVUxMKSB7CisgICAgc2VydmVyU29ja2V0XyA9IHNvY2tldChyZXMtPmFpX2ZhbWlseSwgcmVzLT5haV9zb2NrdHlwZSwgcmVzLT5haV9wcm90b2NvbCk7CisgIH0KKworICBpZiAoc2VydmVyU29ja2V0XyA9PSBUSFJJRlRfSU5WQUxJRF9TT0NLRVQpIHsKKyAgICBpbnQgZXJybm9fY29weSA9IFRIUklGVF9HRVRfU09DS0VUX0VSUk9SOworICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlROb25ibG9ja2luZ1NlcnZlclNvY2tldDo6bGlzdGVuKCkgc29ja2V0KCkgIiwgZXJybm9fY29weSk7CisgICAgY2xvc2UoKTsKKyAgICB0aHJvdyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCBjcmVhdGUg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gICAgICAgICAgICAgICAgICAgICJDb3VsZCBub3Qgc2V0IFRIUklGVF9OT19TT0NLRVRfQ0FDSElORyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJub19jb3B5KTsKKyNlbmRpZgorICB9CisKKyAgLy8gU2V0IFRDUCBidWZmZXIgc2l6ZXMKKyAgaWYgKHRjcFNlbmRCdWZmZXJfID4gMCkgeworICAgIGlmICgtMSA9PSBzZXRzb2Nrb3B0KHNlcnZlclNvY2tldF8sCisgICAgICAgICAgICAgICAgICAgICAgICAgU09MX1NPQ0tFVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBTT19TTkRCVUYsCisgICAgICAgICAgICAgICAgICAgICAgICAgY2FzdF9zb2Nrb3B0KCZ0Y3BTZW5kQnVmZmVyXyksCisgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHRjcFNlbmRCdWZmZXJfKSkpIHsKKyAgICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICBHbG9iYWxPdXRwdXQucGVycm9yKCJUTm9uYmxvY2tpbmdTZXJ2ZXJTb2NrZXQ6Omxpc3RlbigpIHNldHNvY2tvcHQoKSBTT19TTkRCVUYgIiwgZXJybm9fY29weSk7CisgICAgICBjbG9zZSgpOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCBzZXQgU09fU05EQlVGIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CisgICAgfQorICB9CisKKyAgaWYgKHRjcFJlY3ZCdWZmZXJfID4gMCkgeworICAgIGlmICgtMSA9PSBzZXRzb2Nrb3B0KHNlcnZlclNvY2tldF8sCisgICAgICAgICAgICAgICAgICAgICAgICAgU09MX1NPQ0tFVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBTT19SQ1ZCVUYsCisgICAgICAgICAgICAgICAgICAgICAgICAgY2FzdF9zb2Nrb3B0KCZ0Y3BSZWN2QnVmZmVyXyksCisgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHRjcFJlY3ZCdWZmZXJfKSkpIHsKKyAgICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICBHbG9iYWxPdXRwdXQucGVycm9yKCJUTm9uYmxvY2tpbmdTZXJ2ZXJTb2NrZXQ6Omxpc3RlbigpIHNldHNvY2tvcHQoKSBTT19SQ1ZCVUYgIiwgZXJybm9fY29weSk7CisgICAgICBjbG9zZSgpOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCBzZXQgU09fUkNWQlVGIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CisgICAgfQorICB9CisKKyNpZmRlZiBJUFY2X1Y2T05MWQorICBpZiAocmVzLT5haV9mYW1pbHkgPT0gQUZfSU5FVDYgJiYgcGF0aF8uZW1wdHkoKSkgeworICAgIGludCB6ZXJvID0gMDsKKyAgICBpZiAoLTEgPT0gc2V0c29ja29wdChzZXJ2ZXJTb2NrZXRfLAorICAgICAgICAgICAgICAgICAgICAgICAgIElQUFJPVE9fSVBWNiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBJUFY2X1Y2T05MWSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBjYXN0X3NvY2tvcHQoJnplcm8pLAorICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZih6ZXJvKSkpIHsKKyAgICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlROb25ibG9ja2luZ1NlcnZlclNvY2tldDo6bGlzdGVuKCkg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pYWJsZXMuCisgIGludCByZXRyaWVzID0gMDsKKyAgaW50IGVycm5vX2NvcHkgPSAwOworCisgIGlmICghcGF0aF8uZW1wdHkoKSkgeworCisjaWZuZGVmIF9XSU4zMgorCisgICAgLy8gVW5peCBEb21haW4gU29ja2V0CisgICAgc2l6ZV90IGxlbiA9IHBhdGhfLnNpemUoKSArIDE7CisgICAgaWYgKGxlbiA+IHNpemVvZigoKHNvY2thZGRyX3VuKilOVUxMKS0+c3VuX3BhdGgpKSB7CisgICAgICBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICBHbG9iYWxPdXRwdXQucGVycm9yKCJUU29ja2V0OjpsaXN0ZW4oKSBVbml4IERvbWFpbiBzb2NrZXQgcGF0aCB0b28gbG9uZyIsIGVycm5vX2NvcHkpOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVuaXggRG9tYWluIHNvY2tldCBwYXRoIHRvbyBsb25nIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CisgICAgfQorCisgICAgc3RydWN0IHNvY2thZGRyX3VuIGFkZHJlc3M7CisgICAgYWRkcmVzcy5zdW5fZmFtaWx5ID0gQUZfVU5JWDsKKyAgICBtZW1jcHkoYWRkcmVzcy5zdW5fcGF0aCwgcGF0aF8uY19zdHIoKSwgbGVuKTsKKworICAgIHNvY2tsZW5fdCBzdHJ1Y3RsZW4gPSBzdGF0aWNfY2FzdDxzb2NrbGVuX3Q+KHNpemVvZihhZGRyZXNzKSk7CisKKyAgICBpZiAoIWFkZHJlc3Muc3VuX3BhdGhbMF0pIHsgLy8gYWJzdHJhY3QgbmFtZXNwYWNlIHNvY2tldAorI2lmZGVmIF9fbGludXhfXworICAgICAgLy8gc3VuX3BhdGggaXMgbm90IG51bGw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aHJvdyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBVbml4IERvbWFpbiBzb2NrZXQgcGF0aCBub3Qgc3VwcG9ydGVkIik7CisjZW5kaWYKKyAgfSBlbHNlIHsKKyAgICBkbyB7CisgICAgICBpZiAoMCA9PSA6OmJpbmQoc2VydmVyU29ja2V0XywgcmVzLT5haV9hZGRyLCBzdGF0aWNfY2FzdDxpbnQ+KHJlcy0+YWlfYWRkcmxlbikpKSB7CisgICAgICAgIGJyZWFrOworICAgICAgfQorICAgICAgZXJybm9fY29weSA9IFRIUklGVF9HRVRfU09DS0VUX0VSUk9SOworICAgICAgLy8gdXNlIHNob3J0IGNpcmN1aXQgZXZhbHVhdGlvbiBoZXJlIHRvIG9ubHkgc2xlZXAgaWYgd2UgbmVlZCB0bworICAgIH0gd2hpbGUgKChyZXRyaWVzKysgPCByZXRyeUxpbWl0XykgJiYgKFRIUklGVF9TTEVFUF9TRUMocmV0cnlEZWxheV8pID09IDApKTsKKworICAgIC8vIHJldHJpZXZlIGJpbmQgaW5mbworICAgIGlmIChwb3J0XyA9PSAwICYmIHJldHJpZXMgPD0gcmV0cnlMaW1pdF8pIHsKKyAgICAgIHN0cnVjdCBzb2NrYWRkcl9zdG9yYWdlIHNhOworICAgICAgc29ja2xlbl90IGxlbiA9IHNpemVvZihzYSk7CisgICAgICBzdGQ6Om1lbXNldCgmc2EsIDAsIGxlbik7CisgICAgICBpZiAoOjpnZXRzb2NrbmFtZShzZXJ2ZXJTb2NrZXRfLCByZWludGVycHJldF9jYXN0PHN0cnVjdCBzb2NrYWRkcio+KCZzYSksICZsZW4pIDwgMCkgeworICAgICAgICBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlROb25ibG9ja2luZ1NlcnZlclNvY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llbnRTb2NrZXQpOworICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlROb25ibG9ja2luZ1NlcnZlclNvY2tldDo6YWNjZXB0SW1wbCgpIFRIUklGVF9GQ05UTCgpIFRIUklGVF9GX0dFVEZMICIsIGVycm5vX2NvcHkpOworICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbjo6VU5LTk9XTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJUSFJJRlRfRkNOVEwoVEhSSUZUX0ZfR0VURkwpIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm5vX2NvcHkpOworICB9CisKKyAgaWYgKC0xID09IFRIUklGVF9GQ05UTChjbGllbnRTb2NrZXQsIFRIUklGVF9GX1NFVEZMLCBmbGFncyB8IFRIUklGVF9PX05PTkJMT0NLKSkgeworICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgOjpUSFJJRlRfQ0xPU0VTT0NLRVQoY2xpZW50U29ja2V0KTsKKyAgICBHbG9iYWxPdXRwdXQKKyAgICAgICAgLnBlcnJvcigiVE5vbmJsb2NraW5nU2VydmVyU29ja2V0OjphY2NlcHRJbXBsKCkgVEhSSUZUX0ZDTlRMKCkgVEhSSUZUX0ZfU0VURkwgflRIUklGVF9PX05PTkJMT0NLICIsCisgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CisgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpVTktOT1dOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlRIUklGVF9GQ05UTChUSFJJRlRfRl9TRVRGTCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CisgIH0KKworICBzaGFyZWRfcHRyPFRTb2NrZXQ+IGNsaWVudCA9IGNyZWF0ZVNvY2tldChjbGllbnRT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V0cmllczsgaSsrKQotICB7Ci0gICAgaFBpcGVfID0gQ3JlYXRlRmlsZSgKLSAgICAgICAgICAgICAgcGlwZW5hbWVfLmNfc3RyKCksCi0gICAgICAgICAgICAgIEdFTkVSSUNfUkVBRCB8IEdFTkVSSUNfV1JJVEUsCi0gICAgICAgICAgICAgIDAsICAgICAgICAgICAgICAvLyBubyBzaGFyaW5nCi0gICAgICAgICAgICAgIE5VTEwsICAgICAgICAgICAvLyBkZWZhdWx0IHNlY3VyaXR5IGF0dHJpYnV0ZXMKLSAgICAgICAgICAgICAgT1BFTl9FWElTVElORywgIC8vIG9wZW5zIGV4aXN0aW5nIHBpcGUKLSAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgIC8vIGRlZmF1bHQgYXR0cmlidXRlcwotICAgICAgICAgICAgICBOVUxMKTsgICAgICAgICAgLy8gbm8gdGVtcGxhdGUgZmlsZQorICBUQXV0b0hhbmRsZSBoUGlwZTsKKyAgZG8geworICAgIERXT1JEIGZsYWdzID0gRklMRV9GTEFHX09WRVJMQVBQRUQ7IC8vIGFzeW5jIG1vZGUsIHNvIHdlIGNhbiBkbyByZWFkcyBhdCB0aGUgc2FtZSB0aW1lIGFzIHdyaXRlcworICAgIGhQaXBlLnJlc2V0KENyZWF0ZUZpbGVBKHBpcGVuYW1lXy5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFTkVSSUNfUkVBRCB8IEdFTkVSSUNfV1JJVEUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgICAgICAgLy8gbm8gc2hhcmluZworICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsICAgICAgICAgIC8vIGRlZmF1bHQgc2VjdXJpdHkgYXR0cmlidXRlcworICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9QRU5fRVhJU1RJTkcsIC8vIG9wZW5zIGV4aXN0aW5nIHBpcGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncywKKyAgICA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7Cit9CiAKLSAgRFdPUkQgIGNiUmVhZDsKLSAgaW50IGZTdWNjZXNzID0gUmVhZEZpbGUoCi0gICAgICAgICAgICAgIFBpcGVfLCAvLyBwaXBlIGhhbmRsZQotICAgICAgICAgICAgICBidWYsICAgICAgLy8gYnVmZmVyIHRvIHJlY2VpdmUgcmVwbHkKLSAgICAgICAgICAgICAgbGVuLCAgICAgIC8vIHNpemUgb2YgYnVmZmVyCi0gICAgICAgICAgICAgICZjYlJlYWQsICAvLyBudW1iZXIgb2YgYnl0ZXMgcmVhZAotICAgICAgICAgICAgICBOVUxMKTsgICAgLy8gbm90IG92ZXJsYXBwZWQKK3VpbnQzMl90IHBpcGVfcmVhZChIQU5ETEUgcGlwZSwgdWludDhfdCogYnVmLCB1aW50MzJfdCBsZW4pIHsKKyAgRFdPUkQgY2JSZWFkOworICBpbnQgZlN1Y2Nlc3MgPSBSZWFkRmlsZShwaXBlLCAgICAvLyBwaXBlIGhhbmRsZQorICAgICAgICAgICAgICAgICAgICAgICAgICBidWYsICAgICAvLyBidWZmZXIgdG8gcmVjZWl2ZSByZXBseQorICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4sICAgICAvLyBzaXplIG9mIGJ1ZmZlcgorICAgICAgICAgICAgICAgICAgICAgICAgICAmY2JSZWFkLCAvLyBudW1iZXIgb2YgYnl0ZXMgcmVhZAorICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgICAvLyBub3Qgb3ZlcmxhcHBlZAogCi0gIGlmICggIWZTdWNjZXNzICYmIEdldExhc3RFcnJvcigpICE9IEVSUk9SX01PUkVfREFUQSApCisgIGlmICghZlN1Y2Nlc3MgJiYgR2V0TGFzdEVycm9yKCkgIT0gRVJST1JfTU9SRV9EQVRBKQogICAgIHJldHVybiAwOyAvLyBObyBtb3JlIGRhdGEsIHBvc3NpYmx5IGJlY2F1c2UgY2xpZW50IGRpc2Nvbm5lY3RlZC4KIAogICByZXR1cm4gY2JSZWFkOwpAQCAtMTYwLDE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HNoYXJlZF9wdHI8VFBpcGU+IGNsaWVudDsKKyAgcmV0dXJuIGltcGxfLT5hY2NlcHRJbXBsKCk7Cit9CiAKLSAgc3RvcF8gPSBGQUxTRTsKK3NoYXJlZF9wdHI8VFRyYW5zcG9ydD4gVEFub25QaXBlU2VydmVyOjphY2NlcHRJbXBsKCkgeworICAvLyBUaGlzIDAtYnl0ZSByZWFkIHNlcnZlcyBtZXJlbHkgYXMgYSBibG9ja2luZyBjYWxsLgorICBieXRlIGJ1ZjsKKyAgRFdPUkQgYnI7CisgIGludCBmU3VjY2VzcyA9IFJlYWRGaWxlKFBpcGVSXy5oLCAvLyBwaXBlIGhhbmRsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAmYnVmLCAgICAgLy8gYnVmZmVyIHRvIHJlY2VpdmUgcmVwbHkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgICAgICAgIC8vIHNpemUgb2YgYnVmZmVyCisgICAgICAgICAgICAgICAgICAgICAgICAgICZiciwgICAgICAvLyBudW1iZXIgb2YgYnl0ZXMgcmVhZAorICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsgICAgLy8gbm90IG92ZXJsYXBwZWQKIAotICBpZihpc0Fub255bW91cykKLSAgeyAvL0Fub255bW91cyBQaXBlCi0gICAgLy9UaGlzIDAtYnl0ZSByZWFkIHNlcnZlcyBtZXJlbHkgYXMgYSBibG9ja2luZyBjYWxsLgotICAgIGJ5dGUgYnVmOwotICAgIERXT1JEIGJyOwotICAgIGludCBmU3VjY2VzcyA9IFJlYWRGaWxlKAotICAgICAgICAgIFBpcGVfLCAvLyBwaXBlIGhhbmRsZQotICAgICAgICAgICZidWYsICAgLy8gYnVmZmVyIHRvIHJlY2VpdmUgcmVwbHkKLSAgICAgICAgICAwLCAgICAgIC8vIHNpemUgb2YgYnVmZmVyCi0gICAgICAgICAgJmJyLCAgICAvLyBudW1iZXIgb2YgYnl0ZXMgcmVhZAotICAgICAgICAgIE5VTEwpOyAgLy8g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A9IEdldExhc3RFcnJvcigpOwotICAgICAgICBIQU5ETEUgZXZlbnRzWzJdID0ge292ZXJsYXBwZWQuaEV2ZW50LCB3YWtldXB9OwotICAgICAgICBzd2l0Y2goIGR3RXJyKQotICAgICAgICB7Ci0gICAgICAgIGNhc2UgRVJST1JfUElQRV9DT05ORUNURUQ6Ci0gICAgICAgICAgR2xvYmFsT3V0cHV0LnByaW50ZigiQ2xpZW50IGNvbm5lY3RlZC4iKTsKLSAgICAgICAgICBjbGllbnQucmVzZXQobmV3IFRQaXBlKFBpcGVfKSk7Ci0gICAgICAgICAgcmV0dXJuIGNsaWVudDsKLQotICAgICAgICBjYXNlIEVSUk9SX0lPX1BFTkRJTkc6Ci0gICAgICAgICAgRFdPUkQgZHdXYWl0LCBkd0R1bW15OwotICAgICAgICAgIGR3V2FpdCA9IFdhaXRGb3JNdWx0aXBsZU9iamVjdHMoIDIsIGV2ZW50cywgRkFMU0UsIDMwMDApOwotICAgICAgICAgIHN3aXRjaChkd1dhaXQpCi0gICAgICAgICAgewotICAgICAgICAgIGNhc2UgV0FJVF9PQkpFQ1RfMDoKLSAgICAgICAgICAgIGlmKEdldE92ZXJsYXBwZWRSZXN1bHQoUGlwZV8sICZvdmVybGFwcGVkLCAmZHdEdW1teSwgVFJVRSkpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIEdsb2JhbE91dHB1dC5wcmludGYoIkNsaWVudCBjb25uZWN0ZWQuIik7Ci0gICAgICAgICAgICAgIGNsaWVudC5yZXNldChuZXcgVFBpcGUoUGlwZV8pKTsKLSAgICAgICAgICAgICAgcmV0dXJuIGNsaWVudDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgIGNhc2UgV0FJVF9PQkpFQ1RfMCArIDE6Ci0gICAgICAgICAgICBzdG9wXyA9IFRSVUU7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgYnJlYWs7Ci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fRFVQTEVYIHwgICAgICAvLyByZWFkL3dyaXRlIGFjY2VzcwotICAgICAgICBGSUxFX0ZMQUdfT1ZFUkxBUFBFRCwgICAgIC8vIGFzeW5jIG1vZGUKLSAgICAgICAgUElQRV9UWVBFX01FU1NBR0UgfCAgICAgICAvLyBtZXNzYWdlIHR5cGUgcGlwZQotICAgICAgICBQSVBFX1JFQURNT0RFX01FU1NBR0UsICAgIC8vIG1lc3NhZ2UtcmVhZCBtb2RlCi0gICAgICAgIG1heGNvbm5zXywgICAgICAgICAgICAgICAgLy8gbWF4LiBpbnN0YW5jZXMKLSAgICAgICAgYnVmc2l6ZV8sICAgICAgICAgICAgICAgICAvLyBvdXRwdXQgYnVmZmVyIHNpemUKLSAgICAgICAgYnVmc2l6ZV8sICAgICAgICAgICAgICAgICAvLyBpbnB1dCBidWZmZXIgc2l6ZQotICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNsaWVudCB0aW1lLW91dAotICAgICAgICAmc2EpOyAgICAgICAgICAgICAgICAgICAgIC8vIGRlZmF1bHQgc2VjdXJpdHkgYXR0cmlidXRlCisgIFRBdXRvSGFuZGxlIGhQaXBlKENyZWF0ZU5hbWVkUGlwZUEocGlwZW5hbWVfLmNfc3RyKCksICAgIC8vIHBpcGUgbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBJUEVfQUNDRVNTX0RVUExFWCB8ICAvLyByZWFkL3dyaXRlIGFjY2VzcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PVkVSTEFQUEVELCAvLyBhc3luYyBtb2RlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUElQRV9UWVBFX0JZVEUgfCAgICAgIC8vIGJ5dGUgdHlwZSBwaXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUElQRV9SRUFETU9ERV9CWVRFLCAgIC8vIGJ5dGUgcmVhZCBtb2RlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4Y29ubnNfLCAgICAgICAgICAgIC8vIG1heC4gaW5zdGFuY2VzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmc2l6ZV8sICAgICAgICAgICAgIC8vIG91dHB1dCBidWZmZXIgc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZnNpemVfLCAgICAgICAgICAgICAvLyBpbnB1dCBidWZmZXIgc2l6ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsICAgICAgICAgICAgICAgICAgICAvLyBjbGllbnQgdGltZS1vdXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc2EpKTsgICAgICAgICAgICAgICAgLy8gc2VjdXJpdHkgYXR0cmlidXRlcwogCi0gIGlmKGhQaXBlXyA9PSBJTlZBTElEX0hBTkRMRV9WQUxVRSkKLSAgewotICAgIFBpcGVfID0gSU5WQUxJRF9IQU5ETEVfVkFMVUU7Ci0gICAgR2xvYmFsT3V0cHV0LnBlcnJvcigiVFBpcGVTZXJ2ZXI6OlRDcmVhdGVOYW1lZFBpcGUoKSBHTEU9IiwgR2V0TGFzdEVycm9yKCkpOwotICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbjo6Tk9UX09QRU4sICJUQ3JlYXRlTmFtZWRQaXBlKCkgZmFpbGVkIiwgR2V0TGFzdEVycm9yKCkpOworICBEV09SRCBsYXN0RXJyb3IgPSBHZXRMYXN0RXJyb3IoKTsKKyAgTG9jYWxGcmVlKHNkKTsKKyAgTG9jYWxGcmVlKGFjbCk7CisgIEZyZWVTaWQoZXZlcnlvbmVfc2lkKTsKKworICBpZiAoaFBpcGUuaCA9PSBJTlZBTElEX0hBTkRMRV9WQUxVRSkgeworICAgIFBpcGVfLnJlc2V0KCk7CisgICAgR2xvYmFsT3V0cHV0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XTik7Ci0gIGJvb2wgc2h1dGRvd25TZW50ICAgICA9ICEhKHNodXRkb3duICYgU1NMX1NFTlRfU0hVVERPV04pOworICBib29sIHNodXRkb3duU2VudCA9ICEhKHNodXRkb3duICYgU1NMX1NFTlRfU0hVVERPV04pOwogICBpZiAoc2h1dGRvd25SZWNlaXZlZCAmJiBzaHV0ZG93blNlbnQpIHsKICAgICByZXR1cm4gZmFsc2U7CiAgIH0KICAgcmV0dXJuIHRydWU7CiB9CiAKKy8qCisgKiBOb3RlOiBUaGlzIG1ldGhvZCBpcyBub3QgbGliZXZlbnQgc2FmZS4KKyovCiBib29sIFRTU0xTb2NrZXQ6OnBlZWsoKSB7CiAgIGlmICghaXNPcGVuKCkpIHsKICAgICByZXR1cm4gZmFsc2U7CiAgIH0KLSAgY2hlY2tIYW5kc2hha2UoKTsKKyAgaW5pdGlhbGl6ZUhhbmRzaGFrZSgpOworICBpZiAoIWNoZWNrSGFuZHNoYWtlKCkpCisgICAgdGhyb3cgVFNTTEV4Y2VwdGlvbigiU1NMX3BlZWs6IEhhbmRzaGFrZSBpcyBub3QgY29tcGxldGVkIik7CiAgIGludCByYzsKICAgdWludDhfdCBieXRlOwotICByYyA9IFNTTF9wZWVrKHNzbF8sICZieXRlLCAxKTsKLSAgaWYgKHJjIDwgMCkgewotICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7Ci0gICAgc3RyaW5nIGVycm9yczsKLSAgICBidWlsZEVycm9ycyhlcnJvcnMsIGVycm5vX2NvcHkpOwotICAgIHRocm93IFRTU0xFeGNlcHRpb24oIlNTTF9wZWVrOiAiICsgZXJyb3JzKTsKLSAgfQotICBpZiAocmMgPT0gMCkgewotICAgIEVSUl9jbGVhcl9lcnJvcigpOwotICB9CisgIGRvIHsKKyAgICByYyA9IFNTTF9wZWVrKHNzbF8sICZieXRlLCAxKTsKKyAgICBpZiAocmMgPCAwKSB7CisKKyAgICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICBpbnQgZXJyb3IgPSBTU0xfZ2V0X2Vycm9yKHNzbF8sIHJjKTsKKyAgICAgIHN3aXRjaCAoZXJyb3IpIHsKKyAgICAgICAgY2FzZSBTU0xfRVJST1JfU1lTQ0FMTDoKKyAgICAgICAgICBpZiAoKGVycm5vX2NvcHkgIT0gVEhSSUZUX0VJTlRSKQorICAgICAgICAgICAgICAmJiAoZXJybm9fY29weSAhPSBUSFJJRlRfRUFHQUlOKSkgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgfQorICAgICAgICAvLyBmYWxsdGhyb3VnaAorICAgICAgICBjYXNlIFNTTF9FUlJPUl9XQU5UX1JFQUQ6CisgICAgICAgIGNhc2UgU1NMX0VSUk9SX1dBTlRfV1JJVEU6CisgICAgICAgICAgLy8gaW4gdGhlIGNhc2Ugb2YgU1NMX0VSUk9SX1NZU0NBTEwgd2Ugd2FudCB0byB3YWl0IGZvciBhbiByZWFkIGV2ZW50IGFnYWluCisgICAgICAgICAgd2FpdEZvckV2ZW50KGVycm9yICE9IFNTTF9FUlJPUl9XQU5UX1dSSVRFKTsKKyAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgZGVmYXVsdDo7Ly8gZG8gbm90aGluZworICAgICAgfQorICAgICAgc3RyaW5nIGVycm9yczsKKyAgICAgIGJ1aWxkRXJyb3JzKGVycm9ycywgZXJybm9fY29weSwgZXJyb3IpOworICAgICAgdGhyb3cgVFNTTEV4Y2VwdGlvbigiU1NMX3BlZWs6ICIgKyBlcnJvcnMpOworICAgIH0gZWxzZSBpZiAocmMgPT0gMCkgeworICAgICAgRVJSX2NsZWFyX2Vycm9yKCk7CisgICAgICBicmVhazsKKyAgICB9CisgIH0gd2hpbGUgKHRydWUpOwogICByZXR1cm4gKHJjID4gMCk7CiB9CiAKQEAgLTE0MSw2NyArMzMwLDIzNCBAQAogICBUU29ja2V0OjpvcGVuKCk7CiB9CiAKKy8qCisgKiBOb3RlOiBUaGlzIG1ldGhvZCBpcyBub3QgbGliZXZlbnQgc2FmZS4KKyovCiB2b2lkIFRTU0xTb2NrZXQ6OmNsb3NlKCkgewogICBpZiAoc3NsXyAhPSBOVUxMKSB7Ci0gICAgaW50IHJjID0gU1NMX3NodXRkb3duKHNzbF8pOwotICAgIGlmIChyYyA9PSAwKSB7Ci0gICAgICByYyA9IFNTTF9zaHV0ZG93bihzc2xfKTsKLSAgICB9Ci0gICAgaWYgKHJjIDwgMCkgewotICAgICAgaW50IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKLSAgICAgIHN0cmluZyBlcnJvcnM7Ci0gICAgICBidWlsZEVycm9ycyhlcnJvcnMsIGVycm5vX2NvcHkpOwotICAgICAgR2xvYmFsT3V0cHV0KCgiU1NMX3NodXRkb3duOiAiICsgZXJyb3JzKS5jX3N0cigpKTsKKyAgICB0cnkgeworICAgICAgaW50IHJjOworICAgICAgaW50IGVycm5vX2NvcHkgPSAwOworICAgICAgaW50IGVycm9yID0gMDsKKworICAgICAgZG8geworICAgICAgICByYyA9IFNTTF9zaHV0ZG93bihzc2xfKTsKKyAgICAgICAgaWYgKHJjIDw9IDApIHsKKyAgICAgICAgICBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CisgICAgICAgICAgZXJyb3IgPSBTU0xfZ2V0X2Vycm9yKHNzbF8sIHJjKTsKKyAgICAgICAgICBzd2l0Y2ggKGVycm9yKSB7CisgICAgICAgICAgICBjYXNlIFNTTF9FUlJPUl9TWVNDQUxMOgorICAgICAgICAgICAgICBpZiAoKGVycm5vX2NvcHkgIT0gVEhSSUZUX0VJTlRSKQorICAgICAgICAgICAgICAgICAgJiYgKGVycm5vX2NvcHkgIT0gVEhSSUZUX0VBR0FJTikpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gZmFsbHRocm91Z2gK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pbnQzMl90IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKKyAgICBpbnQzMl90IGVycm9yID0gU1NMX2dldF9lcnJvcihzc2xfLCBieXRlcyk7CisgICAgcmVhZFJldHJ5Q291bnRfKys7CisgICAgaWYgKGVycm9yID09IFNTTF9FUlJPUl9OT05FKSB7CisgICAgICByZWFkUmV0cnlDb3VudF8gPSAwOwogICAgICAgYnJlYWs7Ci0gICAgaW50IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKLSAgICBpZiAoU1NMX2dldF9lcnJvcihzc2xfLCBieXRlcykgPT0gU1NMX0VSUk9SX1NZU0NBTEwpIHsKLSAgICAgIGlmIChFUlJfZ2V0X2Vycm9yKCkgPT0gMCAmJiBlcnJub19jb3B5ID09IFRIUklGVF9FSU5UUikgewotICAgICAgICBjb250aW51ZTsKLSAgICAgIH0KKyAgICB9CisgICAgdW5zaWduZWQgaW50IHdhaXRFdmVudFJldHVybjsKKyAgICBib29sIGJyZWFrb3V0ID0gZmFsc2U7CisgICAgc3dpdGNoIChlcnJvcikgeworICAgICAgY2FzZSBTU0xfRVJST1JfWkVST19SRVRVUk46CisgICAgICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbjo6RU5EX09GX0ZJTEUsICJjbGllbnQgZGlzY29ubmVjdGVkIik7CisKKyAgICAgIGNhc2UgU1NMX0VSUk9SX1NZU0NBTEw6CisgICAgICAgIGlmIChlcnJub19jb3B5ID09IDAgJiYgRVJSX3BlZWtfZXJyb3IoKSA9PSAwKSB7CisgICAgICAgICAgYnJlYWtvdXQgPSB0cnVlOworICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmICgoZXJybm9fY29weSAhPSBUSFJJRlRfRUlOVFIpCisgICAgICAgICAgICAmJiAoZXJybm9fY29weSAhPSBUSFJJRlRfRUFHQUlOKSkgeworIC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FpdEZvckV2ZW50KGVycm9yICE9IFNTTF9FUlJPUl9XQU5UX1dSSVRFKSkgPT0gVFNTTF9FSU5UUiApIHsKKyAgICAgICAgICAvLyByZXBlYXQgb3BlcmF0aW9uCisgICAgICAgICAgaWYgKHJlYWRSZXRyeUNvdW50XyA8IG1heFJlY3ZSZXRyaWVzXykgeworICAgICAgICAgICAgLy8gVEhSSUZUX0VJTlRSIG5lZWRzIHRvIGJlIGhhbmRsZWQgbWFudWFsbHkgYW5kIHdlIGNhbiB0b2xlcmF0ZQorICAgICAgICAgICAgLy8gYSBjZXJ0YWluIG51bWJlcgorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgfQorICAgICAgICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbjo6SU5URVJOQUxfRVJST1IsICJ0b28gbXVjaCByZWN2IHJldHJpZXMiKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICh3YWl0RXZlbnRSZXR1cm4gPT0gVFNTTF9EQVRBKSB7CisgICAgICAgICAgICAvLyBpbiBjYXNlIG9mIFNTTCBhbmQgaHVnZSB0aHJpZnQgcGFja2V0cywgdGhlcmUgbWF5IGJlIGEgbnVtYmVyIG9mCisgICAgICAgICAgICAvLyBzb2NrZXQgb3BlcmF0aW9ucywgYmVmb3JlIGFueSBkYXRhIGJlY29tZXMgYXZhaWxhYmxlIGJ5IFNTTF9yZWFkKCkuCisgICAgICAgICAgICAvLyBUaGVyZWZvcmUgdGhlIG51bWJlciBvZiByZXRyaWVzIHNob3VsZCBub3QgYmUgaW5jcmVhc2VkIGFuZAorICAgICAgICAgICAgLy8gdGhlIG9wZXJhdGlvbiBzaG91bGQgYmUgcmVwZWF0ZWQuCisgICAgICAgICAgICByZWFkUmV0cnlDb3VudF8tLTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyY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BjYXNlIFNTTF9FUlJPUl9TWVNDQUxMOgorICAgICAgICAgIGlmICgoZXJybm9fY29weSAhPSBUSFJJRlRfRUlOVFIpCisgICAgICAgICAgICAgICYmIChlcnJub19jb3B5ICE9IFRIUklGVF9FQUdBSU4pKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICB9CisgICAgICAgIC8vIGZhbGx0aHJvdWdoICAgICAgICAKKyAgICAgICAgY2FzZSBTU0xfRVJST1JfV0FOVF9SRUFEOgorICAgICAgICBjYXNlIFNTTF9FUlJPUl9XQU5UX1dSSVRFOgorICAgICAgICAgIGlmIChpc0xpYmV2ZW50U2FmZSgpKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgLy8gaW4gdGhlIGNhc2Ugb2YgU1NMX0VSUk9SX1NZU0NBTEwgd2Ugd2FudCB0byB3YWl0IGZvciBhbiB3cml0ZSBldmVudCBhZ2FpbgorICAgICAgICAgICAgd2FpdEZvckV2ZW50KGVycm9yID09IFNTTF9FUlJPUl9XQU5UX1JFQUQpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgfQorICAgICAgICBkZWZhdWx0OjsvLyBkbyBub3RoaW5nCisgICAgICB9CiAgICAgICBzdHJpbmcgZXJyb3JzOwotICAgICAgYnVpbGRFcnJvcnMoZXJyb3JzLCBlcnJub19jb3B5KTsKKyAgICAgIGJ1aWxkRXJyb3JzKGVycm9ycywgZXJybm9fY29weSwgZXJyb3IpOwogICAgICAgdGhyb3cgVFNTTEV4Y2VwdGlvbigiU1NMX3dyaXRlOiAiICsgZXJyb3JzKTsKICAgICB9CiAgICAgd3JpdHRlbiArPSBieXRlczsKICAgfQogfQogCisvKgorICogUmV0dXJucyBudW1iZXIgb2YgYnl0ZXMgd3JpdHRlbiBpbiBTU0wgU29ja2V0LgorICogSWYgZXZlbnRTYWZlIGlzIHNldCwgYW5kIGl0IG1heSByZXR1cm5zIDAgYnl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fZmQoc3NsXywgc3RhdGljX2Nhc3Q8aW50Pihzb2NrZXRfKSk7Cit9CisKK2Jvb2wgVFNTTFNvY2tldDo6Y2hlY2tIYW5kc2hha2UoKSB7CisgIHJldHVybiBoYW5kc2hha2VDb21wbGV0ZWRfOworfQorCit2b2lkIFRTU0xTb2NrZXQ6OmluaXRpYWxpemVIYW5kc2hha2UoKSB7CisgIGlmICghVFNvY2tldDo6aXNPcGVuKCkpIHsKKyAgICB0aHJvdyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOKTsKKyAgfQorICBpZiAoY2hlY2tIYW5kc2hha2UoKSkgeworICAgIHJldHVybjsKKyAgfQorCisgIGlmIChzc2xfID09IE5VTEwpIHsKKyAgICBpbml0aWFsaXplSGFuZHNoYWtlUGFyYW1zKCk7CisgIH0KKwogICBpbnQgcmM7CisgIGludCBlcnJub19jb3B5ID0gMDsKKyAgaW50IGVycm9yID0gMDsKICAgaWYgKHNlcnZlcigpKSB7Ci0gICAgcmMgPSBTU0xfYWNjZXB0KHNzbF8pOworICAgIGRvIHsKKyAgICAgIHJjID0gU1NMX2FjY2VwdChzc2xfKTsKKyAgICAgIGlmIChyYyA8PSAwKSB7CisgICAgICAgIGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKKyAgICAgICAgZXJyb3IgPSBTU0xfZ2V0X2Vycm9yKHNzbF8sIHJjKTsKKyAgICAgICAgc3dpdGNoIChlcnJvcikgeworICAgICAgICAgIGNhc2UgU1NMX0VSUk9SX1NZU0NBTEw6CisgICAgICAgICAgICBpZiAoKGVycm5vX2NvcHkgIT0gVEhSSUZUX0VJTlRSKQorICAgICAgICAgICAgICAgICYmIChlcnJub19jb3B5ICE9IFRIUklGVF9FQUdBSU4pKSB7CisgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgIC8vIGZhbGx0aHJvdWdoCisgICAgICAgICAgY2FzZSBTU0xfRVJST1JfV0FOVF9SRUFEOgorICAgICAgICAgIGNhc2UgU1NMX0VSUk9SX1dBTlRfV1JJVEU6CisgICAgICAgICAgICBpZiAoaXNMaWJldmVudFNhZmUoKSkgeworICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgLy8gcmVwZWF0IG9wZXJhdGlvbgorICAgICAgICAgICAgICAvLyBpbiB0aGUgY2FzZSBvZiBTU0xfRVJST1JfU1lTQ0FMTCB3ZSB3YW50IHRvIHdhaXQgZm9yIGFuIHdyaXRlL3JlYWQgZXZlbnQgYWdhaW4KKyAgICAgICAgICAgICAgd2FpdEZvckV2ZW50KGVycm9yID09IFNTTF9FUlJPUl9XQU5UX1JFQUQpOworICAgICAgICAgICAgICByYyA9IDI7CisgICAgICAgICAgICB9CisgICAgICAgICAgZGVmYXVsdDo7Ly8gZG8gbm90aGluZworICAgICAgICB9CisgICAgICB9CisgICAgfSB3aGlsZSAocmMgPT0gMik7CiAgIH0gZWxzZSB7Ci0gICAgcmMgPSBTU0xfY29ubmVjdChzc2xfKTsKKyAgICAvLyBPcGVuU1NMIDwgMC45LjhmIGRvZXMgbm90IGhhdmUgU1NMX3NldF90bHNleHRfaG9zdF9uYW1lKCkKKyAgICAjaWYgZGVmaW5lZChTU0xfc2V0X3Rsc2V4dF9ob3N0X25hbWUpCisgICAgICAvLyBzZXQgdGhlIFNOSSBob3N0bmFtZQorICAgICAgU1NMX3NldF90bHNleHRfaG9zdF9uYW1lKHNzbF8sIGdldEhvc3QoKS5jX3N0cigpKTsKKyAgICAjZW5kaWYKKyAgICBkbyB7CisgICAgICByYyA9IFNTTF9jb25uZWN0KHNzbF8pOworICAgICAgaWYgKHJjIDw9IDApIHsKKyAgICAgICAgZXJybm9fY29weSA9IFRIUklGVF9HRVRfU09DS0VUX0VSUk9SOworICAgICAgICBlcnJvciA9IFNTTF9nZXRfZXJyb3Ioc3NsXywgcmMpOworICAgICAgICBzd2l0Y2ggKGVycm9yKSB7CisgICAgICAgICAgY2FzZSBTU0xfRVJST1JfU1lTQ0FMTDoKKyAgICAgICAgICAgIGlmICgoZXJybm9fY29weSAhPSBUSFJJRlRfRUlOVFIpCisgICAgICAgICAgICAgICAgJiYgKGVycm5vX2NvcHkgIT0gVEhSSUZUX0VBR0FJTikpIHsKKyAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgLy8gZmFsbHRocm91Z2gKKyAgICAgICAgICBjYXNlIFNTTF9FUlJPUl9XQU5UX1JFQUQ6CisgICAgICAgICAgY2FzZSBTU0xfRVJST1JfV0FOVF9XUklURToKKyAgICAgICAgICAgIGlmIChpc0xpYmV2ZW50U2FmZSgpKSB7CisgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAvLyByZXBlYXQgb3BlcmF0aW9uCisgICAgICAgICAgICAgIC8vIGluIHRoZSBjYXNlIG9mIFNTTF9FUlJPUl9TWVNDQUxMIHdlIHdhbnQgdG8gd2FpdCBmb3IgYW4gd3JpdGUvcmVhZCBldmVudCBhZ2FpbgorICAgICAgICAgICAgICB3YWl0Rm9yRXZlbnQoZXJyb3IgPT0gU1NMX0VSUk9SX1dBTlRfUkVBRCk7CisgICAgICAgICAgICAgIHJjID0gMjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBkZWZhdWx0OjsvLyBkbyBub3RoaW5nCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9IHdoaWxlIChyYyA9PSAyKTsKICAgfQogICBpZiAocmMgPD0gMCkgewotICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CiAgICAgc3RyaW5nIGZuYW1lKHNlcnZlcigpID8gIlNTTF9hY2NlcHQiIDogIlNTTF9jb25uZWN0Iik7CiAgICAgc3RyaW5nIGVycm9yczsKL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YWRkcl9zdG9yYWdlJiBzYSkKLSAgdGhyb3coKSB7Ci0gICh2b2lkKSBzYTsKK0RlY2lzaW9uIERlZmF1bHRDbGllbnRBY2Nlc3NNYW5hZ2VyOjp2ZXJpZnkoY29uc3Qgc29ja2FkZHJfc3RvcmFnZSYgc2EpIG5vZXhjZXB0IHsKKyAgKHZvaWQpc2E7CiAgIHJldHVybiBTS0lQOwogfQogCiBEZWNpc2lvbiBEZWZhdWx0Q2xpZW50QWNjZXNzTWFuYWdlcjo6dmVyaWZ5KGNvbnN0IHN0cmluZyYgaG9zdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciogbmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNpemUpIHRocm93KCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc2l6ZSkgbm9leGNlcHQgewogICBpZiAoaG9zdC5lbXB0eSgpIHx8IG5hbWUgPT0gTlVMTCB8fCBzaXplIDw9IDApIHsKICAgICByZXR1cm4gU0tJUDsKICAgfQpAQCAtNjE1LDcgKzEwNjIsNyBAQAogCiBEZWNpc2lvbiBEZWZhdWx0Q2xpZW50QWNjZXNzTWFuYWdlcjo6dmVyaWZ5KGNvbnN0IHNvY2thZGRyX3N0b3JhZ2UmIHNhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyKiBkYXRhLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc2l6ZSkgdGhyb3coKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzaXplKSBub2V4Y2VwdCB7CiAgIGJvb2wgbWF0Y2ggPSBmYWxzZTsKICAgaWYgKHNhLnNzX2ZhbWlseSA9PSBBRl9JTkVUICYmIHNpemUgPT0gc2l6ZW9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mFwcGVyOjpUR2V0QWRkckluZm9XcmFwcGVyKGNvbnN0IGNoYXIqIG5vZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIHNlcnZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBhZGRyaW5mbyogaGludHMpCisgIDogbm9kZV8obm9kZSksIHNlcnZpY2VfKHNlcnZpY2UpLCBoaW50c18oaGludHMpLCByZXNfKE5VTEwpIHt9CisKK1RHZXRBZGRySW5mb1dyYXBwZXI6On5UR2V0QWRkckluZm9XcmFwcGVyKCkgeworICBpZiAodGhpcy0+cmVzXyAhPSBOVUxMKQorICAgIGZyZWVhZGRyaW5mbyh0aGlzLT5yZXNfKTsKK30KKworaW50IFRHZXRBZGRySW5mb1dyYXBwZXI6OmluaXQoKSB7CisgIGlmICh0aGlzLT5yZXNfID09IE5VTEwpCisgICAgcmV0dXJuIGdldGFkZHJpbmZvKHRoaXMtPm5vZGVfLCB0aGlzLT5zZXJ2aWNlXywgdGhpcy0+aGludHNfLCAmKHRoaXMtPnJlc18pKTsKKyAgcmV0dXJuIDA7Cit9CisKK2NvbnN0IHN0cnVjdCBhZGRyaW5mbyogVEdldEFkZHJJbmZvV3JhcHBlcjo6cmVzKCkgeworICByZXR1cm4gdGhpcy0+cmVzXzsKK30KKworVFNlcnZlclNvY2tldDo6VFNlcnZlclNvY2tldChpbnQgcG9ydCkKKyAgOiBpbnRlcnJ1cHRhYmxlQ2hpbGRyZW5fKHRydWUpLAorICAgIHBvcnRfKHBvcnQpLAorICAgIHNlcnZlclNvY2tldF8oVEhSSUZUX0lOVkFMSURfU09DS0VUKSwKKyAgICBhY2NlcHRCYWNrbG9nXyhERUZBVUxUX0JBQ0tMT0cpLAorICAgIHNlbmRUaW1lb3V0XygwKSwKKyAgICByZWN2VGltZW91dF8oMCksCisgICAgYWNjVGltZW91dF8oLTEpLAorICAgIHJ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pKSB7CisgICAgaWYgKC0xID09IHNldHNvY2tvcHQoc2VydmVyU29ja2V0XywKKyAgICAgICAgICAgICAgICAgICAgICAgICBTT0xfU09DS0VULAorICAgICAgICAgICAgICAgICAgICAgICAgIFNPX1NOREJVRiwKKyAgICAgICAgICAgICAgICAgICAgICAgICBjYXN0X3NvY2tvcHQoJnRjcFNlbmRCdWZmZXJfKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YodGNwU2VuZEJ1ZmZlcl8pKSkgewogICAgICAgaW50IGVycm5vX2NvcHkgPSBUSFJJRlRfR0VUX1NPQ0tFVF9FUlJPUjsKICAgICAgIEdsb2JhbE91dHB1dC5wZXJyb3IoIlRTZXJ2ZXJTb2NrZXQ6Omxpc3RlbigpIHNldHNvY2tvcHQoKSBTT19TTkRCVUYgIiwgZXJybm9fY29weSk7CiAgICAgICBjbG9zZSgpOwotICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTiwgIkNvdWxkIG5vdCBzZXQgU09fU05EQlVGIiwgZXJybm9fY29weSk7CisgICAgICB0aHJvdyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ291bGQgbm90IHNldCBTT19TTkRCVUYiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJub19jb3B5KTsKICAgICB9CiAgIH0KIAogICBpZiAodGNwUmVjdkJ1ZmZlcl8gPiAwKSB7Ci0gICAgaWYgKC0xID09IHNldHNvY2tvcHQoc2VydmVyU29ja2V0XywgU09MX1NPQ0tFVCwgU09fUkNWQlVGLAotICAgICAgICAgICAgICAgICAgICAgICAgIGNhc3Rfc29ja29wdCgmdGNwUmVjdkJ1ZmZlcl8pLCBzaXplb2YodGNwUmVjdkJ1ZmZlcl8pKSkgeworICAgIGlmICgtMSA9PSBzZXRzb2Nrb3B0KHNlcnZlclNvY2tldF8sCisgICAgICAgICAgICAgICAgICAgICAgICAgU09MX1NPQ0tFVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBTT19SQ1ZCVUYsCisgICAgICAgICAgICAgICAgICAgICAgICAgY2FzdF9zb2Nrb3B0KCZ0Y3BSZWN2QnVmZmVyXyksCisgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHRjcFJlY3ZCdWZmZXJfKSkpIHsKICAgICAgIGludCBlcnJub19jb3B5ID0gVEhSSUZUX0dFVF9TT0NLRVRfRVJST1I7CiAgICAgICBHbG9iYWxPdXRwdXQucGVycm9yKCJUU2VydmVyU29ja2V0OjpsaXN0ZW4oKSBzZXRzb2Nrb3B0KCkgU09fUkNWQlVGICIsIGVycm5vX2NvcHkpOwogICAgICAgY2xvc2UoKTsKLSAgICAgIHRocm93IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbjo6Tk9UX09QRU4sICJDb3VsZCBub3Qgc2V0IFNPX1JDVkJVRiIsIGVycm5vX2NvcHkpOworICAgICAgdGhyb3cgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkIG5vdCBzZXQgU09fUkNWQlVGIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJybm9fY29weSk7CiAgICAgfQogICB9CiAKLSAgLy8gRGVmZXIgYWNjZXB0Ci0gICNpZmRlZiBUQ1BfREVGRVJfQUNDRVBUCi0gIGlmICgtMSA9PSBzZXRzb2Nrb3B0KHNlcnZlclNvY2tldF8sIFNPTF9TT0NLRVQsIFRDUF9ERUZFUl9BQ0NFUFQsCi0gICAgICAgICAgICAgICAgICAgICAgICZvbmUsIHNpemVvZihvbmUpKSkgewotICAgIGludCBlcnJub19jb3B5ID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gICAgICBpZiAoZ2V0cGVlcm5hbWUoc29ja2V0XywgKHNvY2thZGRyKikmYWRkciwgJmFkZHJMZW4pICE9IDApIHsKICAgICAgICAgcmV0dXJuIHBlZXJIb3N0XzsKICAgICAgIH0KICAgICAgIGFkZHJQdHIgPSAoc29ja2FkZHIqKSZhZGRyOwpAQCAtNzE3LDkgKzg0NywxMyBAQAogICAgIGNoYXIgY2xpZW50aG9zdFtOSV9NQVhIT1NUXTsKICAgICBjaGFyIGNsaWVudHNlcnZpY2VbTklfTUFYU0VSVl07CiAKLSAgICBnZXRuYW1laW5mbygoc29ja2FkZHIqKSBhZGRyUHRyLCBhZGRyTGVuLAotICAgICAgICAgICAgICAgIGNsaWVudGhvc3QsIHNpemVvZihjbGllbnRob3N0KSwKLSAgICAgICAgICAgICAgICBjbGllbnRzZXJ2aWNlLCBzaXplb2YoY2xpZW50c2VydmljZSksIDApOworICAgIGdldG5hbWVpbmZvKChzb2NrYWRkciopYWRkclB0ciwKKyAgICAgICAgICAgICAgICBhZGRyTGVuLAorICAgICAgICAgICAgICAgIGNsaWVudGhvc3QsCisgICAgICAgICAgICAgICAgc2l6ZW9mKGNsaWVudGhvc3QpLAorICAgICAgICAgICAgICAgIGNsaWVudHNlcnZpY2UsCisgICAgICAgICAgICAgICAgc2l6ZW9mKGNsaWVudHNlcnZpY2UpLAorICAgICAgICAgICAgICAgIDApOwogCiAgICAgcGVlckhvc3RfID0gY2xpZW50aG9zdDsKICAgfQpAQCAtNzQwLDcgKzg3NCw3IEBACiAKICAgICBpZiAoYWRkclB0ciA9PSBOVUxMKSB7CiAgICAgICBhZGRyTGVuID0gc2l6ZW9mKGFkZHIpOwotICAgICAgaWYgKGdldHBlZXJuYW1lKHNvY2tldF8sIChzb2NrYWRkciopICZhZGRyLCAmYWRkckxlbikgIT0gMCkgeworICAgICAgaWYgKGdldHBlZXJuYW1lKHNvY2tldF8sIChzb2NrYWRkciopJmFkZHIsICZhZGRyTGVuKSAhPSAwKSB7CiAgICAgICAgIHJldHVybiBwZWVyQWRkcmVzc187CiAgICAgICB9CiAgICAgICBhZGRyUHRyID0gKHNvY2thZGRyKikmYWRkcjsKQEAgLTc1MSwxMCArODg1LDEzIEBACiAgICAgY2hhciBjbGllbnRob3N0W05JX01BWEhPU1RdOwogICAgIGNoYXIgY2xpZW50c2VydmljZVtOSV9NQVhTRVJWXTsKIAotICAgIGdldG5hbWVpbmZvKGFkZHJQdHIsIGFkZHJMZW4sCi0gICAgICAgICAgICAgICAgY2xpZW50aG9zdCwgc2l6ZW9mKGNsaWVudGhvc3QpLAotICAgICAgICAgICAgICAgIGNsaWVudHNlcnZpY2UsIHNpemVvZihjbGllbnRzZXJ2aWNlKSwKLSAgICAgICAgICAgICAgICBOSV9OVU1FUklDSE9TVHxOSV9OVU1FUklDU0VSVik7CisgICAgZ2V0bmFtZWluZm8oYWRkclB0ciwKKyAgICAgICAgICAgICAgICBhZGRyTGVuLAorICAgICAgICAgICAgICAgIGNsaWVudGhvc3QsCisgICAgICAgICAgICAgICAgc2l6ZW9mKGNsaWVudGhvc3QpLAorICAgICAgICAgICAgICAgIGNsaWVudHNlcnZpY2UsCisgICAgICAgICAgICAgICAgc2l6ZW9mKGNsaWVudHNlcnZpY2UpLAorICAgICAgICAgICAgICAgIE5JX05VTUVSSUNIT1NUIHwgTklfTlVNRVJJQ1NFUlYpOwogCiAgICAgcGVlckFkZHJlc3NfID0gY2xpZW50aG9zdDsKICAgICBwZWVyUG9ydF8gPSBzdGQ6OmF0b2koY2xpZW50c2VydmljZSk7CkBAIC03ODUsMTcgKzkyMiwxOSBAQAogICAgIH0KICAgICBicmVhazsKICAgfQorICBwZWVyQWRkcmVzc18uY2xlYXIoKTsKKyAgcGVlckhvc3RfLmNsZWFyKCk7CiB9CiAKIHNvY2thZGRyKiBUU29ja2V0OjpnZXRDYWNoZWRBZGRyZXNzKHNvY2tsZW5fdCogbGVuKSBjb25zdCB7CiAgIHN3aXRjaCAoY2FjaGVkUGVlckFkZHJfLm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HRocmlmdCB7IG5hbWVzcGFjZSB0cmFuc3BvcnQgeworbmFtZXNwYWNlIGFwYWNoZSB7CituYW1lc3BhY2UgdGhyaWZ0IHsKK25hbWVzcGFjZSB0cmFuc3BvcnQgewogCiB1aW50MzJfdCBUUGlwZWRUcmFuc3BvcnQ6OnJlYWQodWludDhfdCogYnVmLCB1aW50MzJfdCBsZW4pIHsKICAgdWludDMyX3QgbmVlZCA9IGxlbjsKIAogICAvLyBXZSBkb24ndCBoYXZlIGVub3VnaCBkYXRhIHlldAotICBpZiAockxlbl8tclBvc18gPCBuZWVkKSB7CisgIGlmIChyTGVuXyAtIHJQb3NfIDwgbmVlZCkgewogICAgIC8vIENvcHkgb3V0IHdoYXRldmVyIHdlIGhhdmUKLSAgICBpZiAockxlbl8tclBvc18gPiAwKSB7Ci0gICAgICBtZW1jcHkoYnVmLCByQnVmXytyUG9zXywgckxlbl8tclBvc18pOwotICAgICAgbmVlZCAtPSByTGVuXy1yUG9zXzsKLSAgICAgIGJ1ZiArPSByTGVuXy1yUG9zXzsKKyAgICBpZiAockxlbl8gLSByUG9zXyA+IDApIHsKKyAgICAgIG1lbWNweShidWYsIHJCdWZfICsgclBvc18sIHJMZW5fIC0gclBvc18pOworICAgICAgbmVlZCAtPSByTGVuXyAtIHJQb3NfOworICAgICAgYnVmICs9IHJMZW5fIC0gclBvc187CiAgICAgICByUG9zXyA9IHJMZW5fOwogICAgIH0KIAogICAgIC8vIERvdWJsZSB0aGUgc2l6ZSBvZiB0aGUgdW5kZXJseWluZyBidWZmZXIgaWYgaXQgaXMgZnVsbAogICAgIGlmIChyTGVuXyA9PSByQnVmU2l6ZV8pIHsKLSAgICAgIHJCdWZTaXplXyAqPTI7Ci0gICAgICByQnVmXyA9ICh1aW50OF90ICopc3RkOjpyZWFsbG9jKHJCdWZfLCBzaXplb2YodWludDhfdCkgKiByQnVmU2l6ZV8pOworICAgICAgckJ1ZlNpemVfICo9IDI7CisgICAgICB1aW50OF90ICp0bXBCdWYg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aWxlVGltZSgmZnQpOwotCi0gICAgICAgIHRtcHJlcyB8PSBmdC5kd0hpZ2hEYXRlVGltZTsKLSAgICAgICAgdG1wcmVzIDw8PSAzMjsKLSAgICAgICAgdG1wcmVzIHw9IGZ0LmR3TG93RGF0ZVRpbWU7Ci0KLSAgICAgICAgLypjb252ZXJ0aW5nIGZpbGUgdGltZSB0byB1bml4IGVwb2NoKi8KLSAgICAgICAgdG1wcmVzIC09IERFTFRBX0VQT0NIX0lOX01JQ1JPU0VDUzsKLSAgICAgICAgdG1wcmVzIC89IDEwOyAgLypjb252ZXJ0IGludG8gbWljcm9zZWNvbmRzKi8KLSAgICAgICAgdHYtPnR2X3NlYyA9IChsb25nKSh0bXByZXMgLyAxMDAwMDAwVUwpOwotICAgICAgICB0di0+dHZfdXNlYyA9IChsb25nKSh0bXByZXMgJSAxMDAwMDAwVUwpOwotICAgIH0KLQotICAgIGlmIChOVUxMICE9IHR6KQotICAgIHsKLSAgICAgICAgaWYgKCF0emZsYWcpCi0gICAgICAgIHsKLSAgICAgICAgICAgIF90enNldCgpOwotICAgICAgICAgICAgdHpmbGFnKys7Ci0gICAgICAgIH0KLQotICAgICAgICBsb25nIHRpbWVfem9uZSgwKTsKLSAgICAgICAgZXJybm9fdCBlcnIoX2dldF90aW1lem9uZSgmdGltZV96b25lKSk7Ci0gICAgICAgIGlmIChlcnIgPT0gTk9fRVJST1IpCi0gICAgICAgIHsKLSAgICAgICAgICAgIHR6LT50el9taW51dGVzd2VzdCA9IHRpbWVfem9uZSAvIDYwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0KLSAgICAgICAgaW50IGRheV9saWdodCgwKTsKLSAgICAgICAgZXJyID0gKF9nZXRfZGF5bGlnaHQoJmRheV9saWdodCkpOwotICAgICAgICBpZiAoZXJyID09IE5PX0VSUk9SKQotICAgICAgICB7Ci0gICAgICAgICAgICB0ei0+dHpfZHN0dGltZSA9IGRheV9saWdodDsKLSAgICAgICAgICAgIHJldHVybiAwOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgcmV0dXJuIC0xOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcmV0dXJuIC0xOworI2lmIGRlZmluZWQoX19NSU5HVzMyX18pCitpbnQgdGhyaWZ0X2dldHRpbWVvZmRheShzdHJ1Y3QgdGltZXZhbCogdHYsIHN0cnVjdCB0aW1lem9uZSogdHopIHsKKyAgcmV0dXJuIGdldHRpbWVvZmRheSh0dix0eik7CiB9CisjZWxzZQoraW50IHRocmlmdF9nZXR0aW1lb2ZkYXkoc3RydWN0IHRpbWV2YWwqIHR2LCBzdHJ1Y3QgdGltZXpvbmUqIHR6KSB7CisgIEZJTEVUSU1FIGZ0OworICB1bnNpZ25lZCBfX2ludDY0IHRtcHJlcygwKTsKKyAgc3RhdGljIGludCB0emZsYWc7CiAKLWludCB0aHJpZnRfc2xlZXAodW5zaWduZWQgaW50IHNlY29uZHMpCi17CisgIGlmIChOVUxMICE9IHR2KSB7CisgICAgR2V0U3lzdGVtVGltZUFzRmlsZVRpbWUoJmZ0KTsKKworICAgIHRtcHJlcyB8PSBmdC5kd0hpZ2hEYXRlVGltZTsKKyAgICB0bXByZXMgPDw9IDMyOworICAgIHRtcHJlcyB8PSBmdC5kd0xvd0RhdGVUaW1lOworCisgICAgLypjb252ZXJ0aW5nIGZpbGUgdGltZSB0byB1bml4IGVwb2NoKi8KKyAgICB0bXByZXMgLT0gREVMVEFfRVBPQ0hfSU5fTUlDUk9TRUNTOworICAgIHRtcHJlcyAvPSAxMDsgLypjb252ZXJ0IGludG8gbWljcm9zZWNvbmRzKi8KKyAgICB0di0+dHZfc2VjID0gKGxvbmcpKHRtcHJlcyAvIDEwMDAwMDBVTCk7CisgICAgdHYtPnR2X3VzZWMgPSAobG9uZykodG1wcmVzICUgMTAwMDAwMFVMKTsKKyAgfQorCisgIGlmIChOVUxMICE9IHR6KSB7CisgICAgaWYgKCF0emZsYWcpIHsKKyAgICAgIF90enNldCgpOworICAgICAgdHpmbGFnKys7CisgICAgfQorCisgICAgbG9uZyB0aW1lX3pvbmUoMCk7CisgICAgZXJybm9fdCBlcnIoX2dldF90aW1lem9uZSgmdGltZV96b25lKSk7CisgICAgaWYgKGVyciA9PSBOT19FUlJPUikgeworICAgICAgdHotPnR6X21pbnV0ZXN3ZXN0ID0gdGltZV96b25lIC8gNjA7CisgICAgfSBlbHNlIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICBpbnQgZGF5X2xpZ2h0KDApOworICAgIGVyciA9IChfZ2V0X2RheWxpZ2h0KCZkYXlfbGlnaHQpKTsKKyAgICBpZiAoZXJyID09IE5PX0VSUk9SKSB7CisgICAgICB0ei0+dHpfZHN0dGltZSA9IGRheV9saWdodDsKKyAgICAgIHJldHVybiAwOworICAgIH0gZWxzZSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICB9CisKKyAgcmV0dXJuIDA7Cit9CisjZW5kaWYKKworaW50IHRocmlmdF9zbGVlcCh1bnNpZ25lZCBpbnQgc2Vjb25kcykgewogICA6OlNsZWVwKHNlY29uZHMgKiAxMDAwKTsKICAgcmV0dXJuIDA7CiB9Ci1pbnQgdGhyaWZ0X3VzbGVlcCh1bnNpZ25lZCBpbnQgbWljcm9zZWNvbmRzKQotewotICB1bnNpZ25lZCBpbnQgbWlsbGlzZWNvbmRzID0gKG1pY3Jvc2Vjb25kcyArIDk5OSkvIDEwMDA7CitpbnQgdGhyaWZ0X3VzbGVlcCh1bnNpZ25lZCBpbnQgbWljcm9zZWNvbmRzKSB7CisgIHVuc2lnbmVkIGludCBtaWxsaXNlY29uZHMgPSAobWljcm9zZWNvbmRzICsgOTk5KSAvIDEwMDA7CiAgIDo6U2xlZXAobWlsbGlzZWNvbmRzKTsKICAgcmV0dXJuIDA7CiB9CiAKLWNoYXIgKnRocmlmdF9jdGltZV9yKGNvbn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c3QgY2hhciogbmFtZTsKICAgICBUTWVzc2FnZVR5cGUgdHlwZTsKICAgICBpbnQzMl90IHNlcWlkOwotICB9IG1lc3NhZ2VzWzRdID0gewotICAgIHsic2hvcnQgbWVzc2FnZSBuYW1lIiwgVF9DQUxMLCAwfSwKLSAgICB7IjEiLCBUX1JFUExZLCAxMjM0NX0sCi0gICAgeyJsb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb25nIiwgVF9FWENFUFRJT04sIDEgPDwgMTZ9LAotICAgIHsiSmFua3kiLCBUX0NBTEwsIDB9Ci0gIH07CisgIH0gbWVzc2FnZXNbXSA9IHt7InNob3J0IG1lc3NhZ2UgbmFtZSIsIFRfQ0FMTCwgMH0sCisgICAgICAgICAgICAgICAgICB7IjEiLCBUX1JFUExZLCAxMjM0NX0sCisgICAgICAgICAgICAgICAgICB7Imxvb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vbmciLCBUX0VYQ0VQVElPTiwgMSA8PCAxNn0sCisgICAgICAgICAgICAgICAgICB7Im9uZSB3YXkgcHVzaCIsIFRfT05FV0FZLCAxMn0sCisgICAgICAgICAgICAgICAgICB7Ikphbmt5IiwgVF9DQUxMLCAwfX07CisgIGNvbnN0IGludCBtZXNzYWdlc19jb3VudCA9IHNpemVvZihtZXNzYWdlcykgLyBzaXplb2YoVE1lc3NhZ2UpOwogCi0gIGZvciAoaW50IGkgPSAwOyBpIDwgNDsgaSsrKSB7CisgIGZvciAoaW50IGkgPSAwOyBpIDwgbWVzc2FnZXNfY291bnQ7IGkrKykgewogICAgIHNoYXJlZF9wdHI8VFRyYW5zcG9ydD4gdHJhbnNwb3J0KG5ldyBUTWVtb3J5QnVmZmVyKCkpOwogICAgIHNoYXJlZF9wdHI8VFByb3RvY29sPiBwcm90b2NvbChuZXcgVFByb3RvKHRyYW5zcG9ydCkpOwogCi0gICAgcHJvdG9jb2wtPndyaXRlTWVzc2FnZUJlZ2luKG1lc3NhZ2VzW2ldLm5hbWUsCi0g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OworICBuLT5teV9vb2Uuc29tZV9jaGFyYWN0ZXJzID0gIjpSIChtZSBnb2luZyBcInJycnJcIikiOworICBuLT5teV9vb2Uuem9tZ191bmljb2RlICAgICA9ICJceGQzXHg4MFx4ZTJceDg1XHhhZVx4Y2VceDlkXHgyMFx4ZDBceDlkXHhjZSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHhiZlx4ZTJceDg1XHhiZlx4ZDBceGJlXHhjOVx4YTFceGQwXHhiM1x4ZDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlx4YjBceGNmXHg4MVx4ZTJceDg0XHg4ZVx4MjBceGNlXHg5MVx4NzRceDc0IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGNlXHhiMVx4ZTJceDg1XHhiZFx4Y2VceGJhXHhjN1x4ODNceGUyXHg4MCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHhiYyI7CisgIG4tPm15X2JvbmsudHlwZSA9IDMxMzM3OworICBuLT5teV9ib25rLm1lc3NhZ2UgPSAiSSBhbSBhIGJvbmsuLi4geG9yISI7Cit9CisKK0JPT1NUX0FVVE9fVEVTVF9DQVNFKHRlc3RfZGVidWdfcHJvdG9fMikgeworICB0ZXN0Q2FzZVNldHVwXzIoKTsKKworICBjb25zdCBzdGQ6OnN0cmluZyBleHBlY3RlZF9yZXN1bHQoCisgICAgIk5lc3Rpbmcge1xuIgorICAgICIgIDAxOiBteV9ib25rIChzdHJ1Y3QpID0gQm9uayB7XG4iCisgICAgIiAgICAwMTogdHlwZSAoaTMyKSA9IDMxMzM3LFxuIgorICAgICIgICAgMDI6IG1lc3NhZ2UgKHN0cmluZykgPSBcIkkgYW0gYSBib25rLi4uIHhvciFcIixcbiIKKyAgICAiICB9LFxuIgorICAgICIgIDAyOiBteV9vb2UgKHN0cnVjdCkgPSBPbmVPZkVhY2gge1xuIgorICAgICIgICAgMDE6IGltX3RydWUgKGJvb2wpID0gdHJ1ZSxcb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6IHdoYXRfd2hvIChib29sKSA9IGZhbHNlLFxuIgorICAgICIgICAgICAxMTogYmFzZTY0IChzdHJpbmcpID0gXCJcIixcbiIKKyAgICAiICAgICAgMTI6IGJ5dGVfbGlzdCAobGlzdCkgPSBsaXN0PGJ5dGU+WzNdIHtcbiIKKyAgICAiICAgICAgICBbMF0gPSAweDAxLFxuIgorICAgICIgICAgICAgIFsxXSA9IDB4MDIsXG4iCisgICAgIiAgICAgICAgWzJdID0gMHgwMyxcbiIKKyAgICAiICAgICAgfSxcbiIKKyAgICAiICAgICAgMTM6IGkxNl9saXN0IChsaXN0KSA9IGxpc3Q8aTE2PlszXSB7XG4iCisgICAgIiAgICAgICAgWzBdID0gMSxcbiIKKyAgICAiICAgICAgICBbMV0gPSAyLFxuIgorICAgICIgICAgICAgIFsyXSA9IDMsXG4iCisgICAgIiAgICAgIH0sXG4iCisgICAgIiAgICAgIDE0OiBpNjRfbGlzdCAobGlzdCkgPSBsaXN0PGk2ND5bM10ge1xuIgorICAgICIgICAgICAgIFswXSA9IDEsXG4iCisgICAgIiAgICAgICAgWzFdID0gMixcbiIKKyAgICAiICAgICAgICBbMl0gPSAzLFxuIgorICAgICIgICAgICB9LFxuIgorICAgICIgICAgfSxcbiIKKyAgICAiICB9LFxuIgorICAgICIgIDAyOiBjb250YWluIChzZXQpID0gc2V0PGxpc3Q+WzNdIHtcbiIKKyAgICAiICAgIGxpc3Q8c3RyaW5nPlswXSB7XG4iCisgICAgIiAgICB9LFxuIgorICAgICIgICAgbGlzdDxzdHJpbmc+WzJdIHtcbiIKKyAgICAiICAgICAgWzBdID0gXCJhbmQgYSBvbmVcIixcbiIKKyAgICAiICAgICAgWzFdID0gXCJhbmQgYSB0d29cIixcbiIKKyAgICAiICAgIH0sXG4iCisgICAgIiAgICBsaXN0PHN0cmluZz5bM10ge1xuIgorICAgICIgICAgICBbMF0gPSBcInRoZW4gYSBvbmUsIHR3b1wiLFxuIgorICAgICIgICAgICBbMV0gPSBcInRocmVlIVwiLFxuIgorICAgICIgICAgICBbMl0gPSBcIkZPVVIhIVwiLFxuIgorICAgICIgICAgfSxcbiIKKyAgICAiICB9LFxuIgorICAgICIgIDAzOiBib25rcyAobWFwKSA9IG1hcDxzdHJpbmcsbGlzdD5bM10ge1xuIgorICAgICIgICAgXCJub3RoaW5nXCIgLT4gbGlzdDxzdHJ1Y3Q+WzBdIHtcbiIKKyAgICAiICAgIH0sXG4iCisgICAgIiAgICBcInBvZVwiIC0+IGxpc3Q8c3RydWN0PlszXSB7XG4iCisgICAgIiAgICAgIFswXSA9IEJvbmsge1xuIgorICAgICIgICAgICAgIDAxOiB0eXBlIChpMzIpID0gMyxcbiIKKyAgICAiICAgICAgICAwMjogbWVzc2FnZSAoc3RyaW5nKSA9IFwicXVvdGhcIixcbiIKKyAgICAiICAgICAgfSxcbiIKKyAgICAiICAgICAgWzFdID0gQm9uayB7XG4iCisgICAgIiAgICAgICAgMDE6IHR5cGUgKGkzMikgPSA0LFxuIgorICAgICIgICAgICAgIDAyOiBtZXNzYWdlIChzdHJpbmcpID0gXCJ0aGUgcmF2ZW5cIixcbiIKKyAgICAiICAgICAgfSxcbiIKKyAgICAiICAgICAgWzJdID0gQm9uayB7XG4iCisgICAgIiAgICAgICAgMDE6IHR5cGUgKGkzMikgPSA1LFxuIgorICAgICIgICAgICAgIDAyOiBtZXNzYWdlIChzdHJpbmcpID0gXCJuZXZlcm1vcmVcIixcbiIKKyAgICAiICAgICAgfSxcbiIKKyAgICAiICAgIH0sXG4iCisgICAgIiAgICBcInNvbWV0aGluZ1wiIC0+IGxpc3Q8c3RydWN0PlsyXSB7XG4iCisgICAgIiAgICAgIFswXSA9IEJvbmsge1xuIgorICAgICIgICAgICAgIDAxOiB0eXBlIChpMzIpID0gMSxcbiIKKyAgICAiICAgICAgICAwMjogbWVzc2FnZSAoc3RyaW5nKSA9IFwiV2FpdC5cIixcbiIKKyAgICAiICAgICAgfSxcbiIKKyAgICAiICAgICAgWzFdID0gQm9uayB7X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m93LmgKIAotaWYgIVdJVEhfQk9PU1RUSFJFQURTCiBVbml0VGVzdHNfU09VUkNFUyArPSBcCi0gICAgICAgIFJXTXV0ZXhTdGFydmVUZXN0LmNwcAotZW5kaWYKKyAgY29uY3VycmVuY3kvTXV0ZXhUZXN0LmNwcCBcCisgIGNvbmN1cnJlbmN5L1JXTXV0ZXhTdGFydmVUZXN0LmNwcAogCiBVbml0VGVzdHNfTERBREQgPSBcCiAgIGxpYnRlc3RnZW5jcHAubGEgXAotICAkKEJPT1NUX1JPT1RfUEFUSCkvbGliL2xpYmJvb3N0X3VuaXRfdGVzdF9mcmFtZXdvcmsuYQorICAkKEJPT1NUX1RFU1RfTERBREQpIFwKKyAgJChCT09TVF9TWVNURU1fTERBREQpIFwKKyAgJChCT09TVF9USFJFQURfTERBREQpCisKK1RJbnRlcnJ1cHRUZXN0X1NPVVJDRVMgPSBcCisJVFNvY2tldEludGVycnVwdFRlc3QuY3BwIFwKKwlUU1NMU29ja2V0SW50ZXJydXB0VGVzdC5jcHAKKworVEludGVycnVwdFRlc3RfTERBREQgPSBcCisgIGxpYnRlc3RnZW5jcHAubGEgXAorICAkKEJPT1NUX1RFU1RfTERBREQpIFwKKyAgJChCT09TVF9GSUxFU1lTVEVNX0xEQUREKSBcCisgICQoQk9PU1RfQ0hST05PX0xEQUREKSBcCisgICQoQk9PU1RfU1lTVEVNX0xEQUREKSBcCisgICQoQk9PU1RfVEhSRUFEX0xEQUREKQorCitUU2VydmVySW50ZWdyYXRpb25UZXN0X1NPVVJDRVMgPSBcCisJVFNlcnZlckludGVncmF0aW9uVGVzdC5jcHAKKworVFNlcnZlckludGVncmF0aW9uVGVzdF9MREFERCA9IFwKKyAgbGlidGVzdGdlbmNwcC5sYSBcCisgIGxpYnByb2Nlc3NvcnRlc3QubGEgXAorICAkKEJPT1NUX1RFU1RfTERBREQpIFwKKyAgJChCT09TVF9TWVNURU1fTERBREQpIFwKKyAgJChCT09TVF9USFJFQURfTERBREQpCisKK1NlY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1NUX1RFU1RfTERBREQpCisKKyMKKyMgVE5vbmJsb2NraW5nU2VydmVyVGVzdAorIworVE5vbmJsb2NraW5nU2VydmVyVGVzdF9TT1VSQ0VTID0gVE5vbmJsb2NraW5nU2VydmVyVGVzdC5jcHAKKworVE5vbmJsb2NraW5nU2VydmVyVGVzdF9MREFERCA9IGxpYnByb2Nlc3NvcnRlc3QubGEgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQodG9wX2J1aWxkZGlyKS9saWIvY3BwL2xpYnRocmlmdC5sYSBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0b3BfYnVpbGRkaXIpL2xpYi9jcHAvbGlidGhyaWZ0bmIubGEgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfVEVTVF9MREFERCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfTERGTEFHUykgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoTElCRVZFTlRfTElCUykKKyMKKyMgVE5vbmJsb2NraW5nU1NMU2VydmVyVGVzdAorIworVE5vbmJsb2NraW5nU1NMU2VydmVyVGVzdF9TT1VSQ0VTID0gVE5vbmJsb2NraW5nU1NMU2VydmVyVGVzdC5jcHAKKworVE5vbmJsb2NraW5nU1NMU2VydmVyVGVzdF9MREFERCA9IGxpYnByb2Nlc3NvcnRlc3QubGEgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQodG9wX2J1aWxkZGlyKS9saWIvY3BwL2xpYnRocmlmdC5sYSBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCh0b3BfYnVpbGRkaXIpL2xpYi9jcHAvbGlidGhyaWZ0bmIubGEgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfVEVTVF9MREFERCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfTERGTEFHUykgXAorICAgICAgICAgICAgICAgICAg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isJJChCT09TVF9URVNUX0xEQUREKQogCiBjb25jdXJyZW5jeV90ZXN0X1NPVVJDRVMgPSBcCiAJY29uY3VycmVuY3kvVGVzdHMuY3BwIFwKQEAgLTE4NCw2ICszNDUsMTEgQEAKIGNvbmN1cnJlbmN5X3Rlc3RfTERBREQgPSBcCiAgICQodG9wX2J1aWxkZGlyKS9saWIvY3BwL2xpYnRocmlmdC5sYQogCitsaW5rX3Rlc3RfU09VUkNFUyA9IFwKKyAgbGluay9MaW5rVGVzdC5jcHAgXAorICBsaW5rL1RlbXBsYXRlZFNlcnZpY2UxLmNwcCBcCisgIGxpbmsvVGVtcGxhdGVkU2VydmljZTIuY3BwCisKIHByb2Nlc3Nvcl90ZXN0X1NPVVJDRVMgPSBcCiAJcHJvY2Vzc29yL1Byb2Nlc3NvclRlc3QuY3BwIFwKIAlwcm9jZXNzb3IvRXZlbnRMb2cuY3BwIFwKQEAgLTE5NSw0MiArMzYxLDY5IEBACiBwcm9jZXNzb3JfdGVzdF9MREFERCA9IGxpYnByb2Nlc3NvcnRlc3QubGEgXAogICAgICAgICAgICAgICAgICAgICAgICAkKHRvcF9idWlsZGRpcikvbGliL2NwcC9saWJ0aHJpZnQubGEgXAogICAgICAgICAgICAgICAgICAgICAgICAkKHRvcF9idWlsZGRpcikvbGliL2NwcC9saWJ0aHJpZnRuYi5sYSBcCisgICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfVEVTVF9MREFERCkgXAogICAgICAgICAgICAgICAgICAgICAgICAkKEJPT1NUX0xERkxBR1MpIFwKLSAgICAgICAgICAgICAgICAgICAgICAgLWxldmVudCBcCi0gICAgICAgICAgICAgICAgICAgICAgICQoQk9PU1RfUk9PVF9QQVRIKS9saWIvbGliYm9vc3RfdW5pdF90ZXN0X2ZyYW1ld29yay5hCisgICAgICAgICAgICAgICAgICAgICAgICQoTElCRVZFTlRfTElCUykKKworT3BlblNTTE1hbnVhbEluaXRUZXN0X1NPVVJDRVMgPSBcCisJT3BlblNTTE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dGlmeV9vbmUoKTsKKyAgICAgICAgICAgICAgICBsb2NrLnVubG9jaygpOworCisgICAgICAgICAgICAgICAgY29ubmVjdGVkQ2xpZW50ID0gcFNlcnZlclNvY2tldC0+YWNjZXB0KCk7CisgICAgICAgICAgICAgICAgdWludDhfdCBidWZbMl07CisgICAgICAgICAgICAgICAgYnVmWzBdID0gJ08nOworICAgICAgICAgICAgICAgIGJ1ZlsxXSA9ICdLJzsKKyAgICAgICAgICAgICAgICBjb25uZWN0ZWRDbGllbnQtPndyaXRlKCZidWZbMF0sIDIpOworICAgICAgICAgICAgICAgIGNvbm5lY3RlZENsaWVudC0+Zmx1c2goKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgY2F0Y2ggKGFwYWNoZTo6dGhyaWZ0Ojp0cmFuc3BvcnQ6OlRUcmFuc3BvcnRFeGNlcHRpb24mIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJvb3N0OjptdXRleDo6c2NvcGVkX2xvY2sgbG9jayhnTXV0ZXgpOworICAgICAgICAgICAgICAgIEJPT1NUX1RFU1RfTUVTU0FHRShib29zdDo6Zm9ybWF0KCJTUlYgJTElIEV4Y2VwdGlvbjogJTIlIikgJSBib29zdDo6dGhpc190aHJlYWQ6OmdldF9pZCgpICUgZXgud2hhdCgpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNvbm5lY3RlZENsaWVudCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0ZWRDbGllbnQtPmNsb3NlKCk7CisgICAgICAgICAgICAgICAgY29ubmVjdGVkQ2xpZW50LnJlc2V0KCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHBTZXJ2ZXJTb2NrZXQtPmNsb3NlKCk7CisgICAgICAgICAgICBwU2VydmVyU29ja2V0LnJlc2V0KCk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKHN0ZDo6ZXhjZXB0aW9uJiBleCkKKyAgICAgICAgeworICAgICAgICAgICAgQk9PU1RfRkFJTChib29zdDo6Zm9ybWF0KCIlMSU6ICUyJSIpICUgdHlwZWlkKGV4KS5uYW1lKCkgJSBleC53aGF0KCkpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBjbGllbnQoYXBhY2hlOjp0aHJpZnQ6OnRyYW5zcG9ydDo6U1NMUHJvdG9jb2wgcHJvdG9jb2wpCisgICAgeworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgc2hhcmVkX3B0cjxUU1NMU29ja2V0RmFjdG9yeT4gcENsaWVudFNvY2tldEZhY3Rvcnk7CisgICAgICAgICAgICBzaGFyZWRfcHRyPFRTU0xTb2NrZXQ+IHBDbGllbnRTb2NrZXQ7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHBDbGllbnRTb2NrZXRGYWN0b3J5LnJlc2V0KG5ldyBUU1NMU29ja2V0RmFjdG9yeShzdGF0aWNfY2FzdDxhcGFjaGU6OnRocmlmdDo6dHJhbnNwb3J0OjpTU0xQcm90b2NvbD4ocHJvdG9jb2wpKSk7CisgICAgICAgICAgICAgICAgcENsaWVudFNvY2tldEZhY3RvcnktPmF1dGhlbnRpY2F0ZSh0cnVlKTsKKyAgICAgICAgICAgICAgICBwQ2xpZW50U29ja2V0RmFjdG9yeS0+bG9hZENlcnRpZmljYXRlKGNlcnRGaWxlKCJjbGllbnQuY3J0Iikuc3RyaW5nKCkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgcENsaWVudFNvY2tldEZhY3RvcnktPmxvYWRQcml2YXRlS2V5KGNlcnRGaWxlKCJjbGllbnQua2V5Iikuc3RyaW5nKCkuY19zdHIoKSk7CisgICAgICAgICAgICAgICAgcENsaWVudFNvY2tldEZhY3RvcnktPmxvYWRUcnVzdGVkQ2VydGlmaWNhdGVzKGNlcnRGaWxlKCJDQS5wZW0iKS5zdHJpbmcoKS5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICBwQ2xpZW50U29ja2V0ID0gcENsaWVudFNvY2tldEZhY3RvcnktPmNyZWF0ZVNvY2tldCgibG9jYWxob3N0IiwgbVBvcnQpOworICAgICAgICAgICAgICAgIHBDbGllbnRTb2NrZXQtPm9wZW4oKTsKKworICAgICAgICAgICAgICAgIHVpbnQ4X3QgYnVmWzNdOworICAgICAgICAgICAgICAgIGJ1ZlswXSA9IDA7CisgICAgICAgICAgICAgICAgYnVmWzFdID0gMDsKKyAgICAgICAgICAgICAgICBCT09TVF9DSEVDS19FUVVBTCgyLCBwQ2xpZW50U29ja2V0LT5yZWFkKCZidWZbMF0sIDIpKTsKKyAgICAgICAgICAgICAgICBCT09TVF9DSEVDS19FUVVBTCgwLCBtZW1jbXAoJmJ1ZlswXSwgIk9LIiwgMikpOworICAgICAgICAgICAgICAgIG1Db25uZWN0ZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKGFwYWNoZTo6dGhyaWZ0Ojp0cmFuc3BvcnQ6OlRUcmFuc3BvcnRFeGNlcHRpb24mIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJvb3N0OjptdXRleDo6c2NvcGVkX2xvY2sgbG9jayhnTXV0ZXgpOworICAgICAgICAgICAgICAgIEJPT1NUX1RFU1RfTUVTU0FHRShib29zdDo6Zm9ybWF0KCJDTEkgJTElIEV4Y2VwdGlvbjogJTIlIikgJSBib29zdDo6dGhpc190aHJlYWQ6OmdldF9pZCgpICUgZXgud2hhdCgpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHBDbGllbnRTb2NrZXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcENsaWVudFNvY2tldC0+Y2xvc2UoKTsKKyAgICAgICAgICAgICAgICBwQ2xpZW50U29ja2V0LnJlc2V0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKHN0ZDo6ZXhjZXB0aW9uJiBleCkKKyAgICAgICAgeworICAgICAgICAgICAgQk9PU1RfRkFJTChib29zdDo6Zm9ybWF0KCIlMSU6ICUyJSIpICUgdHlwZWlkKGV4KS5uYW1lKCkgJSBleC53aGF0KCkpOworICAgICAgICB9CisgICAgfQorCisgICAgc3RhdGljIGNvbnN0IGNoYXIgKnByb3RvY29sMnN0cihzaXplX3QgcHJvdG9jb2wpCisgICAgeworICAgICAgICBzdGF0aWMgY29uc3QgY2hhciAqc3RyaW5nc1thcGFjaGU6OnRocmlmdDo6dHJhbnNwb3J0OjpMQVRFU1QgKyAxXSA9CisgICAgICAgIHsKKyAgICAgICAgICAgICAgICAiU1NMVExTIiwKKyAgICAgICAgICAgICAgICAiU1NMdjIiLAorICAgICAgICAgICAgICAgICJTU0x2MyIsCisgICAgICAgICAgICAgICAgIlRMU3YxXzAiLAorICAgICAgICAgICAgICAgICJUTFN2MV8xIiwKKyAgICAgICAgICAgICAgICAiVExTdjFfMiIKKyAgICAgICAgfTsKKyAgICAgICAgcmV0dXJuIHN0cmluZ3NbcHJvdG9jb2xdOworICAgIH0KKworICAgIGJvb3N0OjptdXRleCBtTXV0ZXg7CisgICAgYm9vc3Q6OmNvbmRpdGlvbl92YXJpYWJsZSBtQ1ZhcjsKKyAgICBpbnQgbVBvcnQ7CisgICAgYm9vbCBtQ29ubmVjdGVkOworfTsKKworQk9PU1RfRklYVFVSRV9URVNUX1NVSVRFKEJPT1NUX1RFU1RfTU9EVUxFLCBTZWN1cml0eUZpeHR1cmUpCisKK0JPT1NUX0FVVE9fVEVTVF9DQVNFKHNzbF9zZWN1cml0eV9tYXRyaXgpCit7CisgICAgdHJ5CisgICAgeworICAgICAgICAvLyBtYXRyaXggb2YgY29ubmVjdGlvbiBzdWNjZXNzIGJldHdlZW4gY2xpZW50IGFuZCBzZXJ2ZXIgd2l0aCBkaWZmZXJlbnQgU1NMUHJvdG9jb2wgc2VsZWN0aW9ucworICAgICAgICBib29sIG1hdHJpeFthcGFjaGU6OnRocmlmdDo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ICAgICAgICAgICAgICBpZiAoc2kgPT0gMSB8fCBjaSA9PSAxKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2tpcCBhbGwgU1NMdjIgY2FzZXMgLSBwcm90b2NvbCBub3Qgc3VwcG9ydGVkCisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKworI2lmZGVmIE9QRU5TU0xfTk9fU1NMMworICAgICAgICAgICAgICAgIGlmIChzaSA9PSAyIHx8IGNpID09IDIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvLyBTa2lwIGFsbCBTU0x2MyBjYXNlcyAtIHByb3RvY29sIG5vdCBzdXBwb3J0ZWQKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorI2VuZGlmCisKKyAgICAgICAgICAgICAgICBib29zdDo6bXV0ZXg6OnNjb3BlZF9sb2NrIGxvY2sobU11dGV4KTsKKworICAgICAgICAgICAgICAgIEJPT1NUX1RFU1RfTUVTU0FHRShib29zdDo6Zm9ybWF0KCJURVNUOiBTZXJ2ZXIgPSAlMSUsIENsaWVudCA9ICUyJSIpCisgICAgICAgICAgICAgICAgICAgICUgcHJvdG9jb2wyc3RyKHNpKSAlIHByb3RvY29sMnN0cihjaSkpOworCisgICAgICAgICAgICAgICAgbUNvbm5lY3RlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIC8vIHRocmVhZF9ncm91cCBtYW5hZ2VzIHRoZSB0aHJlYWQgbGlmZXRpbWUgLSBpZ25vcmUgdGhlIHJldHVybiB2YWx1ZSBvZiBjcmVhdGVfdGhyZWFkCisgICAgICAgICAgICAgICAgYm9vc3Q6OnRocmVhZF9ncm91cCB0aHJlYWRzOworICAgICAgICAgICAgICAgICh2b2lkKXRocmVhZHMuY3JlYXRlX3RocmVhZChiaW5kKCZTZWN1cml0eUZpeHR1cmU6OnNlcnZlciwgdGhpcywgc3RhdGljX2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CJycnJyXCIpIjsKLSAgbi5teV9vb2Uuem9tZ191bmljb2RlICAgICA9ICJceGQzXHg4MFx4ZTJceDg1XHhhZVx4Y2VceDlkXHgyMCIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGQwXHg5ZFx4Y2VceGJmXHhlMlx4ODVceGJmXHhkMFx4YmVceGM5XHhhMVx4ZDBceGIzXHhkMFx4YjBceGNmXHg4MVx4ZTJceDg0XHg4ZSIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceDIwXHhjZVx4OTFceDc0XHg3NFx4Y2VceGIxXHhlMlx4ODVceGJkXHhjZVx4YmFceGM3XHg4M1x4ZTJceDgwXHhiYyI7Ci0gIG4ubXlfYm9uay50eXBlICAgID0gMzEzMzc7CisgIG4ubXlfb29lLmRvdWJsZV9wcmVjaXNpb24gPSAoc3RkOjpzcXJ0KDUuMCkgKyAxKSAvIDI7CisgIG4ubXlfb29lLnNvbWVfY2hhcmFjdGVycyA9ICI6UiAobWUgZ29pbmcgXCJycnJyXCIpIjsKKyAgbi5teV9vb2Uuem9tZ191bmljb2RlICAgICA9ICJceGQzXHg4MFx4ZTJceDg1XHhhZVx4Y2VceDlkXHgyMFx4ZDBceDlkXHhjZSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGJmXHhlMlx4ODVceGJmXHhkMFx4YmVceGM5XHhhMVx4ZDBceGIzXHhkMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGIwXHhjZlx4ODFceGUyXHg4NFx4OGVceDIwXHhjZVx4OTFceDc0XHg3NCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGNlXHhiMVx4ZTJceDg1XHhiZFx4Y2VceGJhXHhjN1x4ODNceGUyXHg4MCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJceGJjIjsKKyAgbi5teV9ib25rLnR5cGUgPSAzMTMzNzsKICAgbi5teV9ib25rLm1lc3NhZ2UgPSAiSSBhbSBh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2b2lkKSBmZDsKKyAgICAodm9pZClmZDsKICAgICBGc3luY0NhbGwgY2FsbDsKLSAgICBnZXR0aW1lb2ZkYXkoJmNhbGwudGltZSwgTlVMTCk7CisgICAgVEhSSUZUX0dFVFRJTUVPRkRBWSgmY2FsbC50aW1lLCBOVUxMKTsKICAgICBjYWxsc18ucHVzaF9iYWNrKGNhbGwpOwogICB9CiAKLSAgY29uc3QgQ2FsbExpc3QqIGdldENhbGxzKCkgY29uc3QgewotICAgIHJldHVybiAmY2FsbHNfOwotICB9CisgIGNvbnN0IENhbGxMaXN0KiBnZXRDYWxscygpIGNvbnN0IHsgcmV0dXJuICZjYWxsc187IH0KIAotIHByaXZhdGU6Citwcml2YXRlOgogICBDYWxsTGlzdCBjYWxsc187CiB9OwogCkBAIC05Miw4ICs4MywyMiBAQAogICogSGVscGVyIGNsYXNzIHRvIGNsZWFuIHVwIHRlbXBvcmFyeSBmaWxlcwogICovCiBjbGFzcyBUZW1wRmlsZSB7Ci0gcHVibGljOgorcHVibGljOgogICBUZW1wRmlsZShjb25zdCBjaGFyKiBkaXJlY3RvcnksIGNvbnN0IGNoYXIqIHByZWZpeCkgeworICAjaWZkZWYgX19NSU5HVzMyX18KKyAgICAoKHZvaWQpZGlyZWN0b3J5KTsKKyAgICBzaXplX3QgcGF0aF9sZW4gPSBzdHJsZW4ocHJlZml4KSArIDg7CisgICAgcGF0aF8gPSBuZXcgY2hhcltwYXRoX2xlbl07CisgICAgc25wcmludGYocGF0aF8sIHBhdGhfbGVuLCAiJXNYWFhYWFgiLCBwcmVmaXgpOworICAgIGlmIChfbWt0ZW1wX3MocGF0aF8scGF0aF9sZW4pID09IDApIHsKKyAgICAgIGZkXyA9IG9wZW4ocGF0aF8sT19DUkVBVCB8IE9fUkRXUiB8IE9fQklOQVJZLFNfSVJFQUQgfCBTX0lXUklURSk7CisgICAgICBpZiAoZmRfIDwgMCkgeworICAgICAgICB0aHJvdyBhcGFjaGU6OnRocmlmdDo6VEV4Y2VwdG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AgICAgICAgICAgICAgICAgICAgICAgICBhdXRvU29ja2V0Q2xvc2VyKTsKKyAgICAgIGhvbGRTb2NrZXRzLnB1c2hfYmFjayhwQ2xpZW50U29jayk7CisgICAgICBzaGFyZWRfcHRyPFRQcm90b2NvbD4gcENsaWVudFByb3RvY29sKG5ldyBUQmluYXJ5UHJvdG9jb2wocENsaWVudFNvY2spKTsKKyAgICAgIFBhcmVudFNlcnZpY2VDbGllbnQgY2xpZW50KHBDbGllbnRQcm90b2NvbCk7CisgICAgICBwQ2xpZW50U29jay0+b3BlbigpOworICAgICAgY2xpZW50LmluY3JlbWVudEdlbmVyYXRpb24oKTsKKyAgICAgIGhvbGRUaHJlYWRzLnB1c2hfYmFjayhzaGFyZWRfcHRyPGJvb3N0Ojp0aHJlYWQ+KAorICAgICAgICAgIG5ldyBib29zdDo6dGhyZWFkKHN0ZDo6YmluZCgmVFNlcnZlckludGVncmF0aW9uVGVzdEZpeHR1cmU6OmRlbGF5Q2xvc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ2xpZW50U29jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWxsaXNlY29uZHMoMTAgKiBudW1Ub01ha2UpKSkpKTsKKyAgICB9CisKKyAgICBCT09TVF9DSEVDS19FUVVBTChleHBlY3RlZEhXTSwgcFNlcnZlci0+Z2V0Q29uY3VycmVudENsaWVudENvdW50SFdNKCkpOworCisgICAgQk9PU1RfRk9SRUFDSCAoc2hhcmVkX3B0cjxib29zdDo6dGhyZWFkPiBwVGhyZWFkLCBob2xkVGhyZWFkcykgeyBwVGhyZWFkLT5qb2luKCk7IH0KKyAgICBob2xkVGhyZWFkcy5jbGVhcigpOworICAgIGhvbGRTb2NrZXRzLmNsZWFyKCk7CisKKyAgICBzdG9wU2VydmVyKCk7CisgIH0KKworICAvKioKKyAgICogSG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k9PU1RfVEVTVF9NRVNTQUdFKCJUZXN0aW5nIHN0b3Agd2l0aCB1bmludGVycnVwdGFibGUgY2xpZW50cyIpOworCisgIGR5bmFtaWNfcG9pbnRlcl9jYXN0PFRTZXJ2ZXJTb2NrZXQ+KHBTZXJ2ZXItPmdldFNlcnZlclRyYW5zcG9ydCgpKQorICAgICAgLT5zZXRJbnRlcnJ1cHRhYmxlQ2hpbGRyZW4oZmFsc2UpOyAvLyByZXR1cm5zIHRvIHByZS1USFJJRlQtMjQ0MSBiZWhhdmlvcgorCisgIHN0YXJ0U2VydmVyKCk7CisKKyAgc2hhcmVkX3B0cjxUU29ja2V0PiBwQ2xpZW50U29jazEobmV3IFRTb2NrZXQoImxvY2FsaG9zdCIsIGdldFNlcnZlclBvcnQoKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvU29ja2V0Q2xvc2VyKTsKKyAgcENsaWVudFNvY2sxLT5vcGVuKCk7CisKKyAgc2hhcmVkX3B0cjxUU29ja2V0PiBwQ2xpZW50U29jazIobmV3IFRTb2NrZXQoImxvY2FsaG9zdCIsIGdldFNlcnZlclBvcnQoKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvU29ja2V0Q2xvc2VyKTsKKyAgcENsaWVudFNvY2syLT5vcGVuKCk7CisKKyAgLy8gRW5zdXJlIHRoZXkgaGF2ZSBiZWVuIGFjY2VwdGVkCisgIGJsb2NrVW50aWxBY2NlcHRlZCgyKTsKKworICBib29zdDo6dGhyZWFkIHQxKHN0ZDo6YmluZCgmVFNlcnZlckludGVncmF0aW9uVGVzdEZpeHR1cmU6OmRlbGF5Q2xvc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwQ2xpZW50U29jazEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlsbGlzZWNvbmRzKDI1MCkpKT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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0b1NvY2tldENsb3Nlcik7CisgIHBDbGllbnRTb2NrMS0+b3BlbigpOworICBibG9ja1VudGlsQWNjZXB0ZWQoMSk7CisgIEJPT1NUX0NIRUNLX0VRVUFMKDEsIHBTZXJ2ZXItPmdldENvbmN1cnJlbnRDbGllbnRDb3VudCgpKTsKKworICBzaGFyZWRfcHRyPFRTb2NrZXQ+IHBDbGllbnRTb2NrMihuZXcgVFNvY2tldCgibG9jYWxob3N0IiwgZ2V0U2VydmVyUG9ydCgpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG9Tb2NrZXRDbG9zZXIpOworICBwQ2xpZW50U29jazItPm9wZW4oKTsKKyAgYmxvY2tVbnRpbEFjY2VwdGVkKDIpOworICBCT09TVF9DSEVDS19FUVVBTCgyLCBwU2VydmVyLT5nZXRDb25jdXJyZW50Q2xpZW50Q291bnQoKSk7CisKKyAgLy8gYSB0aGlyZCBjbGllbnQgY2Fubm90IGNvbm5lY3QgdW50aWwgb25lIG9mIHRoZSBvdGhlciB0d28gY2xvc2VzCisgIGJvb3N0Ojp0aHJlYWQgdDIoc3RkOjpiaW5kKCZUU2VydmVySW50ZWdyYXRpb25UZXN0Rml4dHVyZTo6ZGVsYXlDbG9zZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBDbGllbnRTb2NrMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWxsaXNlY29uZHMoMjUwKSkpOworICBzaGFyZWRfcHRyPFRTb2NrZXQ+IHBDbGllbnRTb2NrMyhuZXcgVFNvY2tldCgibG9jYWxob3N0IiwgZ2V0U2VydmVyUG9ydCgpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG9Tb2NrZXRDbG9zZXIpOworICBwQ2xp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ZQorICogd2l0aCB0aGUgTGljZW5zZS4gWW91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0CisgKgorICogICBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjAKKyAqCisgKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsCisgKiBzb2Z0d2FyZSBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbgorICogIkFTIElTIiBCQVNJUywgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZCisgKiBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZQorICogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucworICogdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI3ByYWdtYSBvbmNlCisKKyNkZWZpbmUgVFRSQU5TUE9SVF9DSEVDS19USFJPVyhfQ0FMTCwgX1RZUEUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBib29sIGNhdWdodCA9IGZhbHNlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0cnkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIChfQ0FMTCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9IGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uICYgZXgpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIEJPT1NUX0NIRUNLX0VRVUFMKGV4LmdldFR5cGUoKSwgX1RZUEUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGNhdWdodCA9IHRydWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBCT09TVF9DSEVDS19NRVNTQUdFKGNhdWdodCwgImV4cGVjdGVkIFRUcmFuc3BvcnRFeGNlcHRpb24gYnV0IG5vdGhpbmcgd2FzIHRocm93biIpOyAgICAgICAgICAgIFwKKyAgfQorCisjZGVmaW5lIFRUUkFOU1BPUlRfUkVRVUlSRV9USFJPVyhfQ0FMTCwgX1RZUEUpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgYm9vbCBjYXVnaHQgPSBmYWxzZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgdHJ5IHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAoX0NBTEwpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiAmIGV4KSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBCT09TVF9SRVFVSVJFX0VRVUFMKGV4LmdldFR5cGUoKSwgX1RZUEUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBjYXVnaHQgPSB0cnVlOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgQk9PU1RfUkVRVUlSRV9NRVNTQUdFKGNhdWdodCwgImV4cGVjdGVkIFRUcmFuc3BvcnRFeGNlcHRpb24gYnV0IG5vdGhpbmcgd2FzIHRocm93biIpOyAgICAgICAgICBcCisgIH0KZGlmZiAtLWdpdCBhL2xpYi9jcHAvdGVzdC9UaHJpZnRUZXN0X2V4dHJhcy5jcHAgYi9saWIvY3BwL3Rlc3QvVGhyaWZ0VGVzdF9leHRyYXMuY3BwCmluZGV4IDMzZjY4MWYuLmFmNTYwNmUgMTAwNjQ0Ci0tLSBhL2xpYi9jcHAvdGVzdC9UaHJpZnRUZXN0X2V4dHJhcy5jcHAKKysrIGIvbGliL2NwcC90ZXN0L1RocmlmdFRlc3RfZXh0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IHRvdGFsU2l6ZSA8PCAiIGJ5dGVzIik7CisgICAgICAgIEJPT1NUX0ZBSUwoInJlYWQocG9zPSIgPDwgdG90YWxfcmVhZCA8PCAiLCBzaXplPSIgPDwgcmVhZF9zaXplIDw8ICIpIHRocmV3IGV4Y2VwdGlvbiBcIiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBlLndoYXQoKSA8PCAiXCI7IHdyaXR0ZW4gc28gZmFyOiAiIDw8IHRvdGFsX3dyaXR0ZW4gPDwgIiAvICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCB0b3RhbFNpemUgPDwgIiBieXRlcyIpOwogICAgICAgfQogCiAgICAgICBCT09TVF9SRVFVSVJFX01FU1NBR0UoYnl0ZXNfcmVhZCA+IDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgInJlYWQocG9zPSIgPDwgdG90YWxfcmVhZCA8PCAiLCBzaXplPSIgPDwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkX3NpemUgPDwgIikgcmV0dXJuZWQgIiA8PCBieXRlc19yZWFkIDw8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIjsgd3JpdHRlbiBzbyBmYXI6ICIgPDwgdG90YWxfd3JpdHRlbiA8PCAiIC8gIiA8PAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvdGFsU2l6ZSA8PCAiIGJ5dGVzIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInJlYWQocG9zPSIgPDwgdG90YWxfcmVhZCA8PCAiLCBzaXplPSIgPDwgcmVhZF9zaXplIDw8ICIpIHJldHVybmVkICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBieXRlc19yZWFkIDw8ICI7IHdyaXR0ZW4gc28gZmFyOiAiIDw8IHRvdGFsX3dyaXR0ZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIC8gIiA8PCB0b3RhbF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B0byB0ZXN0IHRoZSBub24tdmlydHVhbCBmdW5jdGlvbiBjYWxscyAqLyAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBBRERfVEVTVF9SVyhDb3VwbGVkVHJhbnNwb3J0cywgdG90YWxTaXplLCAjI19fVkFfQVJHU19fKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAvKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgKiBBbHNvIHRlc3QgdXNpbmcgdGhlIHRyYW5zcG9ydCBhcyBhIFRUcmFuc3BvcnQqLCB0byB0ZXN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgKiB0aGUgcmVhZF92aXJ0KCkvd3JpdGVfdmlydCgpIGNhbGxzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgKi8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBBRERfVEVTVF9SVyhDb3VwbGVkVFRyYW5zcG9ydHM8Q291cGxlZFRyYW5zcG9ydHM+LCB0b3RhbFNpemUsICMjX19WQV9BUkdTX18pOyAgICAgICAgICAgICAgICAgIFwKKyAgICAvKiBUZXN0IHdyYXBwaW5nIHRoZSB0cmFuc3BvcnQgd2l0aCBUQnVmZmVyZWRUcmFuc3BvcnQgKi8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBBRERfVEVTVF9SVyhDb3VwbGVkQnVmZmVyZWRUcmFuc3BvcnRzVDxDb3VwbGVkVHJhbnNwb3J0cz4sIHRvdGFsU2l6ZSwgIyNfX1ZBX0FSR1NfXyk7ICAgICAgICAgIF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F9CTE9DS0lORyhDb3VwbGVkVFRyYW5zcG9ydHM8Q291cGxlZFRyYW5zcG9ydHM+KTsgXAotICBBRERfVEVTVF9CTE9DS0lORyhDb3VwbGVkQnVmZmVyZWRUcmFuc3BvcnRzVDxDb3VwbGVkVHJhbnNwb3J0cz4pOyBcCi0gIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRGcmFtZWRUcmFuc3BvcnRzVDxDb3VwbGVkVHJhbnNwb3J0cz4pOyBcCisjZGVmaW5lIFRFU1RfQkxPQ0tJTkdfQkVIQVZJT1IoQ291cGxlZFRyYW5zcG9ydHMpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRUcmFuc3BvcnRzKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRUVHJhbnNwb3J0czxDb3VwbGVkVHJhbnNwb3J0cz4pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRCdWZmZXJlZFRyYW5zcG9ydHNUPENvdXBsZWRUcmFuc3BvcnRzPik7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRGcmFtZWRUcmFuc3BvcnRzVDxDb3VwbGVkVHJhbnNwb3J0cz4pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgIEFERF9URVNUX0JMT0NLSU5HKENvdXBsZWRabGliVHJhbnNwb3J0c1Q8Q291cGxlZFRyYW5zcG9ydHM+KTsKIAogY2xhc3MgVHJhbnNwb3J0VGVzdEdlbiB7Ci0gcHVibGljOgotICBUcmFuc3BvcnRUZXN0R2VuKGJvb3N0Ojp1bml0X3Rlc3Q6OnRlc3R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AgIFRFU1RfUlcoQ291cGxlZEZpbGVUcmFuc3BvcnRzLCAxMDI0ICogMiwgMSwgMSwgcmFuZDRrLCByYW5kNGspOwogCiAgICAgVEVTVF9CTE9DS0lOR19CRUhBVklPUihDb3VwbGVkRmlsZVRyYW5zcG9ydHMpOworI2VuZGlmCiAKICAgICAvLyBBZGQgc29tZSB0ZXN0cyB0aGF0IGFjY2VzcyBUQnVmZmVyZWRUcmFuc3BvcnQgYW5kIFRGcmFtZWRUcmFuc3BvcnQKICAgICAvLyB2aWEgVFRyYW5zcG9ydCBwb2ludGVycyBhbmQgVEJ1ZmZlckJhc2UgcG9pbnRlcnMuCiAgICAgQUREX1RFU1RfUlcoQ291cGxlZFRUcmFuc3BvcnRzPENvdXBsZWRCdWZmZXJlZFRyYW5zcG9ydHM+LAotICAgICAgICAgICAgICAgIDEwMjQqMTAyNCwgcmFuZDRrLCByYW5kNGssIHJhbmQ0aywgcmFuZDRrKTsKKyAgICAgICAgICAgICAgICAxMDI0ICogMTAyNCwKKyAgICAgICAgICAgICAgICByYW5kNGssCisgICAgICAgICAgICAgICAgcmFuZDRrLAorICAgICAgICAgICAgICAgIHJhbmQ0aywKKyAgICAgICAgICAgICAgICByYW5kNGspOwogICAgIEFERF9URVNUX1JXKENvdXBsZWRCdWZmZXJCYXNlczxDb3VwbGVkQnVmZmVyZWRUcmFuc3BvcnRzPiwKLSAgICAgICAgICAgICAgICAxMDI0KjEwMjQsIHJhbmQ0aywgcmFuZDRrLCByYW5kNGssIHJhbmQ0ayk7CisgICAgICAgICAgICAgICAgMTAyNCAqIDEwMjQsCisgICAgICAgICAgICAgICAgcmFuZDRrLAorICAgICAgICAgICAgICAgIHJhbmQ0aywKKyAgICAgICAgICAgICAgICByYW5kNGssCisgICAgICAgICAgICAgICAgcmFuZDRrKTsKICAgICBBRERfVEVTVF9SVyhDb3VwbGVkVFRyYW5zcG9ydHM8Q291cGxlZEZyYW1lZFRyYW5zcG9ydHM+LAotICAgICAgICAgICAgICAgIDEwMjQqMTAyNCwgcmFuZDRrLCByYW5kNGssIHJhbmQ0aywgcmFuZDRrKTsKKyAgICAgICAgICAgICAgICAxMDI0ICogMTAyNCwKKyAgICAgICAgICAgICAgICByYW5kNGssCisgICAgICAgICAgICAgICAgcmFuZDRrLAorICAgICAgICAgICAgICAgIHJhbmQ0aywKKyAgICAgICAgICAgICAgICByYW5kNGspOwogICAgIEFERF9URVNUX1JXKENvdXBsZWRCdWZmZXJCYXNlczxDb3VwbGVkRnJhbWVkVHJhbnNwb3J0cz4sCi0gICAgICAgICAgICAgICAgMTAyNCoxMDI0LCByYW5kNGssIHJhbmQ0aywgcmFuZDRrLCByYW5kNGspOworICAgICAgICAgICAgICAgIDEwMjQgKiAxMDI0LAorICAgICAgICAgICAgICAgIHJhbmQ0aywKKyAgICAgICAgICAgICAgICByYW5kNGssCisgICAgICAgICAgICAgICAgcmFuZDRrLAorICAgICAgICAgICAgICAgIHJhbmQ0ayk7CiAKICAgICAvLyBUZXN0IHVzaW5nIFRabGliVHJhbnNwb3J0IHZpYSBhIFRUcmFuc3BvcnQgcG9pbnRlcgogICAgIEFERF9URVNUX1JXKENvdXBsZWRUVHJhbnNwb3J0czxDb3VwbGVkWmxpYlRyYW5zcG9ydHM+LAotICAgICAgICAgICAgICAgIDEwMjQqMTAyNCwgcmFuZDRrLCByYW5kNGssIHJhbmQ0aywgcmFuZDRrKTsKKyAgICAgICAgICAgICAgICAxMDI0ICogMTAyNCwKKyAgICAgICAgICAgICAgICByYW5kNGssCisgICAgICAgICAgICAgICAgcmFuZDRrLAorICAgICAgICAgICAgICAgIHJhbmQ0aywKKyAgICAgICAgICAgICAgICByYW5kNGspOwogICB9CiAKLSBwcml2YXRlOgorI2lmIChCT09TVF9WRVJTSU9OID49IDEwNTkwMCkKKyNkZWZpbmUgTUFLRV9URVNUX0NBU0UoX0ZVTkMsIF9OQU1FKSBib29zdDo6dW5pdF90ZXN0OjptYWtlX3Rlc3RfY2FzZShfRlVOQywgX05BTU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XMpOworI2lmIChCT09TVF9WRVJTSU9OID49IDEwNTkwMCkKKyAgICBzdGQ6OmZ1bmN0aW9uPHZvaWQgKCk+IHRlc3RfZnVuYworI2Vsc2UKKyAgICBib29zdDo6dW5pdF90ZXN0OjpjYWxsYmFjazA8PiB0ZXN0X2Z1bmMKKyNlbmRpZgorICAgICAgICA9IHN0ZDo6YmluZCh0ZXN0X3J3PENvdXBsZWRUcmFuc3BvcnRzPiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvdGFsU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdTaXplR2VuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgclNpemVHZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Q2h1bmtTaXplR2VuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgckNodW5rU2l6ZUdlbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heE91dHN0YW5kaW5nKTsKKyAgICBzdWl0ZV8tPmFkZChNQUtFX1RFU1RfQ0FTRSh0ZXN0X2Z1bmMsIG5hbWUuc3RyKCkpLCBleHBlY3RlZEZhaWx1cmVzKTsKICAgfQogCiAgIHRlbXBsYXRlIDxjbGFzcyBDb3VwbGVkVHJhbnNwb3J0cz4KLSAgdm9pZCBhZGRUZXN0QmxvY2tpbmcoY29uc3QgY2hhciogdHJhbnNwb3J0TmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgZXhwZWN0ZWRGYWlsdXJlcyA9IDApIHsKKyAgdm9pZCBhZGRUZXN0QmxvY2tpbmcoY29uc3QgY2hhciogdHJhbnNwb3J0TmFtZSwgdWludDMyX3QgZXhwZWN0ZWRGYWlsdXJlcyA9IDApIHsKICAgICBjaGFyIG5hbWVbMTAyNF07Ci0gICAgYm9vc3Q6OnVuaXRfdGVz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lmIChlbmRwdHIgPT0gb3B0YXJnIHx8ICplbmRwdHIgIT0gJ1wwJykgewotICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiaW52YWxpZCBzZWVkIHZhbHVlIFwiJXNcIjogbXVzdCBiZSBhbiBpbnRlZ2VyXG4iLAotICAgICAgICAgICAgICAgICAgb3B0YXJnKTsKLSAgICAgICAgICBleGl0KDEpOwotICAgICAgICB9Ci0gICAgICAgIGhhdmVfc2VlZCA9IHRydWU7Ci0gICAgICAgIGJyZWFrOwotICAgICAgfQotICAgICAgY2FzZSAnaCc6Ci0gICAgICAgIHByaW50X3VzYWdlKHN0ZG91dCwgYXJndlswXSk7Ci0gICAgICAgIGV4aXQoMCk7Ci0gICAgICBjYXNlICd4JzogewotICAgICAgICBjaGFyICplbmRwdHI7Ci0gICAgICAgIG9wdGlvbnMtPnNpemVNdWx0aXBsaWVyID0gc3RydG9mKG9wdGFyZywgJmVuZHB0cik7Ci0gICAgICAgIGlmIChlbmRwdHIgPT0gb3B0YXJnIHx8ICplbmRwdHIgIT0gJ1wwJykgewotICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiaW52YWxpZCBzaXplIG11bHRpcGxpZXIgXCIlc1wiOiBtdXN0IGJlIGEgbnVtYmVyXG4iLAotICAgICAgICAgICAgICAgICAgb3B0YXJnKTsKLSAgICAgICAgICBleGl0KDEpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChvcHRpb25zLT5zaXplTXVsdGlwbGllciA8IDApIHsKLSAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImludmFsaWQgc2l6ZSBtdWx0aXBsaWVyIFwiJXNcIjogIgotICAgICAgICAgICAgICAgICAgIm11c3QgYmUgbm9uLW5lZ2F0aXZlXG4iLCBvcHRhcmcpOwotICAgICAgICAgIGV4aXQoMSk7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgICB9Ci0gICAgICBjYXNlICc/JzoKLSAgICAgICAgZXhpdCgxKTsKLSAgICA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PDwgIi0iIDw8IEJPT1NUX1NUUklOR0laRShfRlVOQyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICA6OnN0ZDo6ZnVuY3Rpb248dm9pZCAoKT4gdGVzdF9mdW5jID0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICA6OnN0ZDo6YmluZChfRlVOQywgIyNfX1ZBX0FSR1NfXyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgOjpib29zdDo6dW5pdF90ZXN0Ojp0ZXN0X2Nhc2UqIHRjICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgID0gOjpib29zdDo6dW5pdF90ZXN0OjptYWtlX3Rlc3RfY2FzZSh0ZXN0X2Z1bmMsIG5hbWVfc3Muc3RyKCksIF9fRklMRV9fLCBfX0xJTkVfXyk7ICAgICAgICBcCisgICAgKHN1aXRlKS0+YWRkKHRjKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgIH0gd2hpbGUgKDApCisjZWxzZQorI2RlZmluZSBBRERfVEVTVF9DQVNFKHN1aXRlLCBuYW1lLCBfRlVOQywgLi4uKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBkbyB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIDo6c3RkOjpvc3RyaW5nc3RyZWFtIG5hbWVfc3M7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIG5hbWVfc3MgPDwgbmFtZSA8PCAiLSIgPDwgQk9PU1RfU1RSSU5HSVpFKF9GVU5DKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIDo6Ym9vc3Q6OnVuaXRfdGVzdDo6dGVzdF9jYXNlKiB0YyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICA9IDo6Ym9vc3Q6OnVuaXRfdGVzdDo6bWFrZV90ZXN0X2Nhc2UoOjpzdGQ6OmJpbmQoX0ZVTkMsICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIyNfX1ZBX0FSR1NfXyksICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lX3NzLnN0cigpKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgKHN1aXRlKS0+YWRkKHRjKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gd2hpbGUgKDApCisjZW5kaWYKIAotdm9pZCBhZGRfdGVzdHModW5pdF90ZXN0Ojp0ZXN0X3N1aXRlKiBzdWl0ZSwKLSAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QqIGJ1ZiwKK3ZvaWQgYWRkX3Rlc3RzKGJvb3N0Ojp1bml0X3Rlc3Q6OnRlc3Rfc3VpdGUqIHN1aXRlLAorICAgICAgICAgICAgICAgY29uc3QgYm9vc3Q6OnNoYXJlZF9hcnJheTx1aW50OF90PiYgYnVmLAogICAgICAgICAgICAgICAgdWludDMyX3QgYnVmX2xlbiwKICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIqIG5hbWUpIHsKICAgQUREX1RFU1RfQ0FTRShzdWl0ZSwgbmF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sb2NrKCkpOworICBCT09TVF9DSEVDS19OT19USFJPVyggdXV0LmxvY2soKSk7CisgIEJPT1NUX0NIRUNLX05PX1RIUk9XKCB1dXQudW5sb2NrKCkpOworICBCT09TVF9DSEVDS19OT19USFJPVyggdXV0LmxvY2soKSk7CisgIEJPT1NUX0NIRUNLX05PX1RIUk9XKCB1dXQudW5sb2NrKCkpOworICBCT09TVF9DSEVDS19OT19USFJPVyggdXV0LnVubG9jaygpKTsKKyAgQk9PU1RfQ0hFQ0tfTk9fVEhST1coIHV1dC51bmxvY2soKSk7Cit9CisKK0JPT1NUX0FVVE9fVEVTVF9DQVNFKHRyeWxvY2spCit7CisgIE11dGV4IHV1dChNdXRleDo6QURBUFRJVkVfSU5JVElBTElaRVIpOyAgIC8vIGp1c3QgdXNpbmcgYW5vdGhlciBpbml0aWFsaXplciBmb3IgY292ZXJhZ2UKKworICBCT09TVF9DSEVDSyAgICAgICAgICggdXV0LnRyeWxvY2soKSk7CisgIEJPT1NUX0NIRUNLICAgICAgICAgKCF1dXQudHJ5bG9jaygpKTsKKyAgQk9PU1RfQ0hFQ0tfTk9fVEhST1coIHV1dC51bmxvY2soKSk7Cit9CisKK0JPT1NUX0FVVE9fVEVTVF9DQVNFKHRpbWVkbG9jaykKK3sKKyAgcHRocmVhZF90IHRoOworICBzdHJ1Y3QgTEZBVCBsZmF0OworCisgIEJPT1NUX0NIRUNLICAgICAgICAgKCBsZmF0LnV1dC50aW1lZGxvY2soMTAwKSk7CisgIEJPT1NUX0NIRUNLX1RIUk9XICAgKCBsZmF0LnV1dC50aW1lZGxvY2soMTAwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbVJlc291cmNlRXhjZXB0aW9uKTsgICAgICAgICAgICAgICAgICAgLy8gRURFQURMSyAoY3VycmVudCB0aHJlYWQgb3ducyBtdXRleCAtIGxvZ2ljIGVycm9yKQorICBCT09TVF9DSEVDS19OT19USFJPVyggbGZhdC51dXQudW5sb2NrKCkpOworCisgIEJ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lb3V0KSA6Ci0gICAgICBfbW9uaXRvcihtb25pdG9yKSwKLSAgICAgIF9jb3VudChjb3VudCksCi0gICAgICBfdGltZW91dCh0aW1lb3V0KSwKLSAgICAgIF9kb25lKGZhbHNlKSB7fQorICAgIFRhc2soTW9uaXRvciYgbW9uaXRvciwgc2l6ZV90JiBjb3VudCwgaW50NjRfdCB0aW1lb3V0KQorICAgICAgOiBfbW9uaXRvcihtb25pdG9yKSwgX2NvdW50KGNvdW50KSwgX3RpbWVvdXQodGltZW91dCksIF9zdGFydFRpbWUoMCksIF9lbmRUaW1lKDApLCBfZG9uZShmYWxzZSkge30KIAogICAgIHZvaWQgcnVuKCkgewogCiAgICAgICBfc3RhcnRUaW1lID0gVXRpbDo6Y3VycmVudFRpbWUoKTsKIAotICAgICAgewotICAgICAgICBTeW5jaHJvbml6ZWQgcyhfc2xlZXApOwotCi0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgX3NsZWVwLndhaXQoX3RpbWVvdXQpOwotICAgICAgICB9IGNhdGNoKFRpbWVkT3V0RXhjZXB0aW9uJiBlKSB7Ci0gICAgICAgICAgOwotICAgICAgICB9Y2F0Y2goLi4uKSB7Ci0gICAgICAgICAgYXNzZXJ0KDApOwotICAgICAgICB9Ci0gICAgICB9CisgICAgICBzbGVlcF8oX3RpbWVvdXQpOwogCiAgICAgICBfZW5kVGltZSA9IFV0aWw6OmN1cnJlbnRUaW1lKCk7CiAKQEAgLTgwLDkgKzgwLDcgQEAKICAgICAgICAgLy8gc3RkOjpjb3V0IDw8ICJUaHJlYWQgIiA8PCBfY291bnQgPDwgIiBjb21wbGV0ZWQgIiA8PCBzdGQ6OmVuZGw7CiAKICAgICAgICAgX2NvdW50LS07Ci0KLSAgICAgICAgaWYgKF9jb3VudCA9PSAwKSB7Ci0KKyAgICAgICAgaWYgKF9jb3VudCAlIDEwMDAwID09IDApIHsKICAgICAgICAgICBfbW9uaXRvci5ub3RpZnkoKTsKICAgICAgICAgfQogICAgICAgfQpAQC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KSwgX2Jsb2NrZWQoYmxvY2tlZCksIF9kb25lTW9uaXRvcihkb25lTW9uaXRvciksIF9jb3VudChjb3VudCkge30KIAogICAgIHZvaWQgcnVuKCkgewogICAgICAgewotICAgICAgICBTeW5jaHJvbml6ZWQgcyhfYm1vbml0b3IpOwotCi0gICAgICAgIF9ibW9uaXRvci53YWl0KCk7Ci0KKyAgICAgICAgU3luY2hyb25pemVkIHMoX2VudHJ5TW9uaXRvcik7CisgICAgICAgIF9lbnRlcmVkID0gdHJ1ZTsKKyAgICAgICAgX2VudHJ5TW9uaXRvci5ub3RpZnkoKTsKICAgICAgIH0KIAogICAgICAgewotICAgICAgICBTeW5jaHJvbml6ZWQgcyhfbW9uaXRvcik7CisgICAgICAgIFN5bmNocm9uaXplZCBzKF9ibG9ja01vbml0b3IpOworICAgICAgICB3aGlsZSAoX2Jsb2NrZWQpIHsKKyAgICAgICAgICBfYmxvY2tNb25pdG9yLndhaXQoKTsKKyAgICAgICAgfQorICAgICAgfQogCi0gICAgICAgIF9jb3VudC0tOwotCi0gICAgICAgIGlmIChfY291bnQgPT0gMCkgewotCi0gICAgICAgICAgX21vbml0b3Iubm90aWZ5KCk7CisgICAgICB7CisgICAgICAgIFN5bmNocm9uaXplZCBzKF9kb25lTW9uaXRvcik7CisgICAgICAgIGlmICgtLV9jb3VudCA9PSAwKSB7CisgICAgICAgICAgX2RvbmVNb25pdG9yLm5vdGlmeSgpOwogICAgICAgICB9CiAgICAgICB9CiAgICAgfQogCi0gICAgTW9uaXRvciYgX21vbml0b3I7Ci0gICAgTW9uaXRvciYgX2Jtb25pdG9yOworICAgIE1vbml0b3ImIF9lbnRyeU1vbml0b3I7CisgICAgYm9vbCBfZW50ZXJlZDsKKyAgICBNb25pdG9yJiBfYmxvY2tNb25pdG9yOworICAgIGJvb2wmIF9ibG9ja2VkOworICAgIE1vbml0b3ImIF9kb25lTW9uaXRvcjsKICAgICBzaXplX3QmIF9jb3VudDsKICAgfTsKIApAQCAtMjM1LDE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pb25zIiA8PCBzdGQ6OmVuZGw7CiAgICAgICAgIHRocm93IFRFeGNlcHRpb24oIlVuZXhwZWN0ZWQgdGltZW91dCBhZGRpbmcgdGFzayIpOwogICAgICAgfQogCiAgICAgICAvLyBXYWtlIHVwIHRhc2tzIHRoYXQgd2VyZSBwZW5kaW5nIGJlZm9yZSBhbmQgd2FpdCBmb3IgdGhlbSB0byBjb21wbGV0ZQogCiAgICAgICB7Ci0gICAgICAgIFN5bmNocm9uaXplZCBzKGJtb25pdG9yKTsKLQotICAgICAgICBibW9uaXRvci5ub3RpZnlBbGwoKTsKKyAgICAgICAgU3luY2hyb25pemVkIHMoYmxvY2tNb25pdG9yKTsKKyAgICAgICAgYmxvY2tlZFsxXSA9IGZhbHNlOworICAgICAgICBibG9ja01vbml0b3Iubm90aWZ5QWxsKCk7CiAgICAgICB9CiAKICAgICAgIHsKLSAgICAgICAgU3luY2hyb25pemVkIHMobW9uaXRvcik7Ci0KLSAgICAgICAgd2hpbGUoYWN0aXZlQ291bnRzWzFdICE9IDApIHsKLSAgICAgICAgICBtb25pdG9yLndhaXQoKTsKKyAgICAgICAgU3luY2hyb25pemVkIHMoZG9uZU1vbml0b3IpOworICAgICAgICB3aGlsZSAoYWN0aXZlQ291bnRzWzFdICE9IDApIHsKKyAgICAgICAgICBkb25lTW9uaXRvci53YWl0KCk7CiAgICAgICAgIH0KICAgICAgIH0KIAogICAgICAgLy8gV2FrZSB1cCB0aGUgZXh0cmEgdGFzayBhbmQgd2FpdCBmb3IgaXQgdG8gY29tcGxldGUKIAogICAgICAgewotICAgICAgICBTeW5jaHJvbml6ZWQgcyhibW9uaXRvcik7Ci0KLSAgICAgICAgYm1vbml0b3Iubm90aWZ5QWxsKCk7CisgICAgICAgIFN5bmNocm9uaXplZCBzKGJsb2NrTW9uaXRvcik7CisgICAgICAgIGJsb2NrZWRbMl0gPSBmYWxzZTsKKyAgICAgICAgYmxvY2tNb25pdG9yLm5vdGlmeUFsbCgpOwogICAgICAgfQog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HVhbCB2b2lkIHByZVNlcnZlKCkge30KIAotICB2aXJ0dWFsIHZvaWQqIGNyZWF0ZUNvbnRleHQoYm9vc3Q6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD4gaW5wdXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29zdDo6c2hhcmVkX3B0cjxwcm90b2NvbDo6VFByb3RvY29sPiBvdXRwdXQpIHsKKyAgdmlydHVhbCB2b2lkKiBjcmVhdGVDb250ZXh0KHN0ZDo6c2hhcmVkX3B0cjxwcm90b2NvbDo6VFByb3RvY29sPiBpbnB1dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6c2hhcmVkX3B0cjxwcm90b2NvbDo6VFByb3RvY29sPiBvdXRwdXQpIHsKICAgICBDb25uQ29udGV4dCogY29udGV4dCA9IG5ldyBDb25uQ29udGV4dChpbnB1dCwgb3V0cHV0LCBuZXh0SWRfKTsKICAgICArK25leHRJZF87CiAgICAgbG9nXy0+YXBwZW5kKEV2ZW50TG9nOjpFVF9DT05OX0NSRUFURUQsIGNvbnRleHQtPmlkLCAwKTsKQEAgLTIwOSw4ICsyMDksOCBAQAogICB9CiAKICAgdmlydHVhbCB2b2lkIGRlbGV0ZUNvbnRleHQodm9pZCogc2VydmVyQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vc3Q6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD5pbnB1dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vc3Q6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQcm90b2NvbD5vdXRwdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPHByb3RvY29sOjpUUHJvdG9jb2w+IGlucHV0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8cHJvdG9jb2w6OlRQ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iAgKiBDaGVjayBmb3IgdGhlIGV2ZW50cyB0aGF0IHNob3VsZCBiZSBhZnRlciBhIGhhbmRsZXIgcmV0dXJucy4KICAqLwotdm9pZCBjaGVja0NhbGxQb3N0SGFuZGxlckV2ZW50cyhjb25zdCBzaGFyZWRfcHRyPEV2ZW50TG9nPiYgbG9nLAordm9pZCBjaGVja0NhbGxQb3N0SGFuZGxlckV2ZW50cyhjb25zdCBzdGQ6OnNoYXJlZF9wdHI8RXZlbnRMb2c+JiBsb2csCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IGNvbm5JZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgY2FsbElkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGNhbGxOYW1lKSB7CkBAIC00MjMsNyArNDA5LDcgQEAKICAqCiAgKiBSZXR1cm5zIHRoZSBjYWxsIElEIGFsbG9jYXRlZCBieSB0aGUgc2VydmVyLgogICovCi11aW50MzJfdCBjaGVja0NhbGxFdmVudHMoY29uc3Qgc2hhcmVkX3B0cjxFdmVudExvZz4mIGxvZywKK3VpbnQzMl90IGNoZWNrQ2FsbEV2ZW50cyhjb25zdCBzdGQ6OnNoYXJlZF9wdHI8RXZlbnRMb2c+JiBsb2csCiAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgY29ubklkLAogICAgICAgICAgICAgICAgICAgICAgICAgIEV2ZW50VHlwZSBjYWxsVHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGNhbGxOYW1lKSB7CkBAIC00MzcsOSArNDIzLDkgQEAKICAqIFRlc3QgZnVuY3Rpb25zCiAgKi8KIAotdGVtcGxhdGU8dHlwZW5hbWUgU3RhdGVfPgotdm9pZCB0ZXN0UGFyZW50U2VydmljZShjb25zdCBzaGFyZWRfcHRyPFN0YXRlXz4mIHN0YXRlKSB7Ci0gIHNoYXJlZ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AgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0ZXN0QmFzaWNTZXJ2aWNlPFNlcnZlciMjVHJhaXRzLCBUZW1wbGF0ZSMjVHJhaXRzPigpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgQk9PU1RfQVVUT19URVNUX0NBU0UoU2VydmVyIyNfIyNUZW1wbGF0ZSMjX2luaGVyaXRlZFNlcnZpY2UpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0ZXN0SW5oZXJpdGVkU2VydmljZTxTZXJ2ZXIjI1RyYWl0cywgVGVtcGxhdGUjI1RyYWl0cz4oKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgQk9PU1RfQVVUT19URVNUX0NBU0UoU2VydmVyIyNfIyNUZW1wbGF0ZSMjX29uZXdheSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0ZXN0T25ld2F5Q2FsbDxTZXJ2ZXIjI1RyYWl0cywgVGVtcGxhdGUjI1RyYWl0cz4oKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgQk9PU1RfQVVUT19URVNUX0NBU0UoU2VydmVyIyNfIyNUZW1wbGF0ZSMjX2V4Y2VwdGlvbikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0ZXN0RXhwZWN0ZWRFcnJvcjxTZXJ2ZXIjI1RyYWl0cywgVGVtcGxhdGUjI1RyYWl0cz4oKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgQk9PU1RfQVVUT19URVNUX0NBU0UoU2VydmVyIyNfIyNUZW1wbGF0ZSMjX3VuZXhwZWN0ZWRFeGNlcHRpb24pIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB0ZXN0VW5leHBlY3RlZEVycm9yPFNlcnZlciMjVHJhaXRzLCBUZW1wbGF0ZSMjVHJhaXRzPigpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgfQogCiAvLyBUZXN0cyB0aGF0IHJlcXVpcmUgdGhlIHNlcnZlciB0byBwcm9jZXNzIG11bHRpcGxlIGNvbm5lY3Rpb25zIGNvbmN1cnJlbnRseQogLy8gKGkuZS4sIG5vdCBUU2ltcGxlU2VydmVyKQotI2RlZmluZSBERUZJTkVfQ09OQ1VSUkVOVF9TRVJWRVJfVEVTVFMoU2VydmVyLCBUZW1wbGF0ZSkgXAotICBCT09TVF9BVVRPX1RFU1RfQ0FTRShTZXJ2ZXIjI18jI1RlbXBsYXRlIyNfc2VwYXJhdGVDb25uZWN0aW9ucykgeyBcCi0gICAgdGVzdFNlcGFyYXRlQ29ubmVjdGlvbnM8U2VydmVyIyNUcmFpdHMsIFRlbXBsYXRlIyNUcmFpdHM+KCk7IFwKKyNkZWZpbmUgREVGSU5FX0NPTkNVUlJFTlRfU0VSVkVSX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpICAgICAgICAgICAgICAgICAgICAgICA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MjVHJhaXRzLCBUZW1wbGF0ZSMjVHJhaXRzPigpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgfQogCi0jZGVmaW5lIERFRklORV9UTk9OQkxPQ0tJTkdTRVJWRVJfVEVTVFMoU2VydmVyLCBUZW1wbGF0ZSkgXAotICBERUZJTkVfU0lNUExFX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpIFwKKyNkZWZpbmUgREVGSU5FX1ROT05CTE9DS0lOR1NFUlZFUl9URVNUUyhTZXJ2ZXIsIFRlbXBsYXRlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgREVGSU5FX1NJTVBMRV9URVNUUyhTZXJ2ZXIsIFRlbXBsYXRlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgREVGSU5FX0NPTkNVUlJFTlRfU0VSVkVSX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpCiAKLSNkZWZpbmUgREVGSU5FX0FMTF9TRVJWRVJfVEVTVFMoU2VydmVyLCBUZW1wbGF0ZSkgXAotICBERUZJTkVfU0lNUExFX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpIFwKLSAgREVGSU5FX0NPTkNVUlJFTlRfU0VSVkVSX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpIFwKKyNkZWZpbmUgREVGSU5FX0FMTF9TRVJWRVJfVEVTVFMoU2VydmVyLCBUZW1wbGF0ZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgREVGSU5FX1NJTVBMRV9URVNUUyhTZXJ2ZXIsIFRlbXBsYXRlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgREVGSU5FX0NPTkNVUlJFTlRfU0VSVkVSX1RFU1RTKFNlcnZlciwgVGVtcGxhdGUpIC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9yZWFjaCAoc3RyaW5nIGRpciBpbiBkaXJzKQotCQkJewotCQkJCUZpbmRTb3VyY2VzSGVscGVyKGRpciwgcGF0aHMpOwotCQkJfQotCQl9CisgICAgICAgIC8vcmVjdXJzaXZlbHkgZmluZCAuY3MgZmlsZXMgaW4gc3JjRGlyLCBwYXRocyBzaG91bGQgaW5pdGlhbGx5IGJlIG5vbi1udWxsIGFuZCBlbXB0eQorICAgICAgICBwcml2YXRlIHZvaWQgRmluZFNvdXJjZXNIZWxwZXIoc3RyaW5nIHNyY0RpciwgTGlzdDxzdHJpbmc+IHBhdGhzKQorICAgICAgICB7CisgICAgICAgICAgICBzdHJpbmdbXSBmaWxlcyA9IERpcmVjdG9yeS5HZXRGaWxlcyhzcmNEaXIsICIqLmNzIik7CisgICAgICAgICAgICBmb3JlYWNoIChzdHJpbmcgZiBpbiBmaWxlcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBwYXRocy5BZGQoZik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdHJpbmdbXSBkaXJzID0gRGlyZWN0b3J5LkdldERpcmVjdG9yaWVzKHNyY0Rpcik7CisgICAgICAgICAgICBmb3JlYWNoIChzdHJpbmcgZGlyIGluIGRpcnMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgRmluZFNvdXJjZXNIZWxwZXIoZGlyLCBwYXRocyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQkvLy8gPHN1bW1hcnk+Ci0JCS8vLyBRdW90ZSBwYXRocyB3aXRoIHNwYWNlcwotCQkvLy8gPC9zdW1tYXJ5PgotCQlwcml2YXRlIHN0cmluZyBTYWZlUGF0aChzdHJpbmcgcGF0aCkKLQkJewotCQkJaWYgKHBhdGguQ29udGFpbnMoJyAnKSAmJiAhcGF0aC5TdGFydHNXaXRoKCJcIiIpKQotCQkJewotCQkJCXJldHVybiAiXCIiICsgcGF0aCArICJcIiI7Ci0JCQl9Ci0JCQlyZXR1cm4gcGF0aD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GhyaWZ0RXhlY3V0YWJsZS5JdGVtU3BlYyk7CisgICAgICAgICAgICAgICAgcC5TdGFydEluZm8uQXJndW1lbnRzID0gIi0tZ2VuIGNzaGFycCAtbyAiICsgU2FmZVBhdGgodGhyaWZ0RGlyKSArICIgLXIgIiArIHRocmlmdEZpbGU7CisgICAgICAgICAgICAgICAgcC5TdGFydEluZm8uVXNlU2hlbGxFeGVjdXRlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgcC5TdGFydEluZm8uQ3JlYXRlTm9XaW5kb3cgPSB0cnVlOworICAgICAgICAgICAgICAgIHAuU3RhcnRJbmZvLlJlZGlyZWN0U3RhbmRhcmRPdXRwdXQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBwLlN0YXJ0KCk7CisgICAgICAgICAgICAgICAgcC5XYWl0Rm9yRXhpdCgpOworICAgICAgICAgICAgICAgIGlmIChwLkV4aXRDb2RlICE9IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBMb2dNZXNzYWdlKCJ0aHJpZnQuZXhlIGZhaWxlZCB0byBjb21waWxlICIgKyB0aHJpZnRGaWxlLCBNZXNzYWdlSW1wb3J0YW5jZS5IaWdoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAocC5FeGl0Q29kZSAhPSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nTWVzc2FnZSgidGhyaWZ0LmV4ZSBmYWlsZWQgdG8gY29tcGlsZSAiICsgdGhyaWZ0RmlsZSwgTWVzc2FnZUltcG9ydGFuY2UuSGlnaCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAKLQkJCUNzYyBjc2MgPSBuZXcgQ3NjKCk7Ci0JCQljc2MuVGFyZ2V0VHlwZSA9ICJsaWJyYXJ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JCQkJCWlmICghRXF1YWxzKGZlbnVtLCBzZW51bSkpCi0JCQkJCXsKLQkJCQkJCXJldHVybiBmYWxzZTsKLQkJCQkJfQotCQkJCX0KLQkJCQllbHNlIGlmIChmZW51bSA9PSBudWxsIF4gc2VudW0gPT0gbnVsbCkKLQkJCQl7Ci0JCQkJCXJldHVybiBmYWxzZTsKLQkJCQl9Ci0JCQkJZWxzZSBpZiAoIUVxdWFscyhmaXRlci5DdXJyZW50LCBzaXRlci5DdXJyZW50KSkKLQkJCQl7Ci0JCQkJCXJldHVybiBmYWxzZTsKLQkJCQl9Ci0JCQkJZm5leHQgPSBmaXRlci5Nb3ZlTmV4dCgpOwotCQkJCXNuZXh0ID0gc2l0ZXIuTW92ZU5leHQoKTsKLQkJCX0KKyAgICAgICAgICAgIGJvb2wgZm5leHQgPSBmaXRlci5Nb3ZlTmV4dCAoKTsKKyAgICAgICAgICAgIGJvb2wgc25leHQgPSBzaXRlci5Nb3ZlTmV4dCAoKTsKKyAgICAgICAgICAgIHdoaWxlIChmbmV4dCAmJiBzbmV4dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBJRW51bWVyYWJsZSBmZW51bSA9IGZpdGVyLkN1cnJlbnQgYXMgSUVudW1lcmFibGU7CisgICAgICAgICAgICAgICAgSUVudW1lcmFibGUgc2VudW0gPSBzaXRlci5DdXJyZW50IGFzIElFbnVtZXJhYmxlOworICAgICAgICAgICAgICAgIGlmIChmZW51bSAhPSBudWxsICYmIHNlbnVtICE9IG51bGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoIUVxdWFscyhmZW51bSwgc2VudW0pKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoZmVudW0gPT0gbnVsbCBeIHNlbnVtID09IG51bGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKCFFcXVhbHMoZml0ZXIuQ3VycmVudCwgc2l0ZXIuQ3VycmVudCkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZuZXh0ID0gZml0ZXIuTW92ZU5leHQoKTsKKyAgICAgICAgICAgICAgICBzbmV4dCA9IHNpdGVyLk1vdmVOZXh0KCk7CisgICAgICAgICAgICB9CiAKLQkJCXJldHVybiBmbmV4dCA9PSBzbmV4dDsKLQkJfQorICAgICAgICAgICAgcmV0dXJuIGZuZXh0ID09IHNuZXh0OworICAgICAgICB9CiAKLQkJLy8vIDxzdW1tYXJ5PgotCQkvLy8gVGhpcyByZXR1cm5zIGEgaGFzaGNvZGUgYmFzZWQgb24gdGhlIHZhbHVlIG9mIHRoZSBlbnVtZXJhYmxlLgotCQkvLy8gPC9zdW1tYXJ5PgotCQlwdWJsaWMgc3RhdGljIGludCBHZXRIYXNoQ29kZSAoSUVudW1lcmFibGUgZW51bWVyYWJsZSkKLQkJewotCQkJaWYgKGVudW1lcmFibGUgPT0gbnVsbCkKLQkJCXsKLQkJCQlyZXR1cm4gMDsKLQkJCX0KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gVGhpcyByZXR1cm5zIGEgaGFzaGNvZGUgYmFzZWQgb24gdGhlIHZhbHVlIG9mIHRoZSBlbnVtZXJhYmxlLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgc3RhdGljIGludCBHZXRIYXNoQ29kZSAoSUVudW1lcmFibGUgZW51bWVyYWJsZSkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGVudW1lcmFibGUgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0KIAotCQkJaW50IGhhc2hjb2RlID0gMDsKLQkJCWZvcmVhY2ggKE9iamVjdCBvYmogaW4gZW51bWVyYWJsZSkKLQkJCXsKLQkJCQlJRW51bWVyYWJsZSBlbnVtMiA9IG9iaiBhcyBJRW51bWVyYWJsZTsKLQkJCQlpbnQgb2JqSGFzaCA9IGVudW0yID09IG51bGwgPyBvYmouR2V0SGFzaENvZGUgKCkgOiBHZXRIYXNoQ29kZSAoZW51bTIpOwotCQkJCXVuY2hlY2tlZAotCQkJCXsKLQkJCQkJaGFzaGNvZGUgPSAoaGFzaGNvZGUgKiAzOTcpIF4gKG9iakhhc2gpOwotCQkJCX0KLQkJCX0KLQkJCXJldHVybiBoYXNoY29kZTsKLQkJfQotCX0KLX0KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCisgICAgICAgICAgICBpbnQgaGFzaGNvZGUgPSAwOworICAgICAgICAgICAgZm9yZWFjaCAob2JqZWN0IG9iaiBpbiBlbnVtZXJhYmxlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIElFbnVtZXJhYmxlIGVudW0yID0gb2JqIGFzIElFbnVtZXJhYmxlOworICAgICAgICAgICAgICAgIGludCBvYmpIYXNoID0gZW51bTIgPT0gbnVsbCA/IG9iai5HZXRIYXNoQ29kZSAoKSA6IEdldEhhc2hDb2RlIChlbnVtMik7CisgICAgICAgICAgICAgICAgdW5jaGVja2VkCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBoYXNoY29kZSA9IChoYXNoY29kZSAqIDM5NykgXiAob2JqSGFzaCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGhhc2hjb2RlOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL2NzaGFycC9zcmMvQ29sbGVjdGlvbnMvVEhhc2hTZ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lYWRPbmx5CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldCB7IHJldHVybiBmYWxzZTsgfQorICAgICAgICB9CiAKLQkJcHVibGljIHZvaWQgQWRkKFQgaXRlbSkKLQkJewotCQkJc2V0LkFkZChpdGVtKTsKLQkJfQorICAgICAgICBwdWJsaWMgdm9pZCBBZGQoVCBpdGVtKQorICAgICAgICB7CisgICAgICAgICAgICBzZXQuQWRkKGl0ZW0pOworICAgICAgICB9CiAKLQkJcHVibGljIHZvaWQgQ2xlYXIoKQotCQl7Ci0JCQlzZXQuQ2xlYXIoKTsKLQkJfQorICAgICAgICBwdWJsaWMgdm9pZCBDbGVhcigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHNldC5DbGVhcigpOworICAgICAgICB9CiAKLQkJcHVibGljIGJvb2wgQ29udGFpbnMoVCBpdGVtKQotCQl7Ci0JCQlyZXR1cm4gc2V0LkNvbnRhaW5zKGl0ZW0pOwotCQl9CisgICAgICAgIHB1YmxpYyBib29sIENvbnRhaW5zKFQgaXRlbSkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHNldC5Db250YWlucyhpdGVtKTsKKyAgICAgICAgfQogCi0JCXB1YmxpYyB2b2lkIENvcHlUbyhUW10gYXJyYXksIGludCBhcnJheUluZGV4KQotCQl7Ci0JCQlzZXQuQ29weVRvKGFycmF5LCBhcnJheUluZGV4KTsKLQkJfQorICAgICAgICBwdWJsaWMgdm9pZCBDb3B5VG8oVFtdIGFycmF5LCBpbnQgYXJyYXlJbmRleCkKKyAgICAgICAgeworICAgICAgICAgICAgc2V0LkNvcHlUbyhhcnJheSwgYXJyYXlJbmRleCk7CisgICAgICAgIH0KIAotCQlwdWJsaWMgSUVudW1lcmF0b3IgR2V0RW51bWVyYXRvcigpCi0JCXsKLQkJCXJldHVybiBzZXQuR2V0RW51bWVyYXRvcigpOwotCQl9CisgICAgICAgIHB1YmxpYyBJRW51bWVyYXRvciBHZXRFbnVtZXJhdG9yKCkKKyAgICAgIC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b3VudAotCQkJewotCQkJCWdldCB7IHJldHVybiBkaWN0LkNvdW50OyB9Ci0JCQl9CisgICAgICAgICAgICBwdWJsaWMgaW50IENvdW50CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIGRpY3QuQ291bnQ7IH0KKyAgICAgICAgICAgIH0KIAotCQkJcHVibGljIGJvb2wgSXNSZWFkT25seQotCQkJewotCQkJCWdldCB7IHJldHVybiBmYWxzZTsgfQotCQkJfQorICAgICAgICAgICAgcHVibGljIGJvb2wgSXNSZWFkT25seQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGdldCB7IHJldHVybiBmYWxzZTsgfQorICAgICAgICAgICAgfQogCi0JCQlwdWJsaWMgSUVudW1lcmF0b3IgR2V0RW51bWVyYXRvcigpCi0JCQl7Ci0JCQkJcmV0dXJuICgoSUVudW1lcmFibGUpZGljdC5LZXlzKS5HZXRFbnVtZXJhdG9yKCk7Ci0JCQl9CisgICAgICAgICAgICBwdWJsaWMgSUVudW1lcmF0b3IgR2V0RW51bWVyYXRvcigpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuICgoSUVudW1lcmFibGUpZGljdC5LZXlzKS5HZXRFbnVtZXJhdG9yKCk7CisgICAgICAgICAgICB9CiAKLQkJCUlFbnVtZXJhdG9yPFY+IElFbnVtZXJhYmxlPFY+LkdldEVudW1lcmF0b3IoKQotCQkJewotCQkJCXJldHVybiBkaWN0LktleXMuR2V0RW51bWVyYXRvcigpOwotCQkJfQorICAgICAgICAgICAgSUVudW1lcmF0b3I8Vj4gSUVudW1lcmFibGU8Vj4uR2V0RW51bWVyYXRvcigpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGRpY3QuS2V5cy5HZXRFbnVtZXJhdG9yKCk7CisgICAgICAgICAgICB9CiAKLQkJCXB1YmxpYyBib29sIEFkZChWIGl0ZW0pCi0JCQl7Ci0JCQkJaWYgKCFkaWN0LkNvbnRhaW5zS2V5KGl0ZW0pKQotCQkJCXsKLQkJCQkJZGljdFtpdGVtXSA9IHRoaXM7Ci0JCQkJCXJldHVybiB0cnVlOwotCQkJCX0KKyAgICAgICAgICAgIHB1YmxpYyBib29sIEFkZChWIGl0ZW0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKCFkaWN0LkNvbnRhaW5zS2V5KGl0ZW0pKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZGljdFtpdGVtXSA9IHRoaXM7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KIAotCQkJCXJldHVybiBmYWxzZTsKLQkJCX0KKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CiAKLQkJCXZvaWQgSUNvbGxlY3Rpb248Vj4uQWRkKFYgaXRlbSkKLQkJCXsKLQkJCQlBZGQoaXRlbSk7Ci0JCQl9CisgICAgICAgICAgICB2b2lkIElDb2xsZWN0aW9uPFY+LkFkZChWIGl0ZW0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQWRkKGl0ZW0pOworICAgICAgICAgICAgfQogCi0JCQlwdWJsaWMgdm9pZCBDbGVhcigpCi0JCQl7Ci0JCQkJZGljdC5DbGVhcigpOwotCQkJfQorICAgICAgICAgICAgcHVibGljIHZvaWQgQ2xlYXIoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRpY3QuQ2xlYXIoKTsKKyAgICAgICAgICAgIH0KIAotCQkJcHVibGljIGJvb2wgQ29udGFpbnMoViBpdGVtKQotCQkJewotCQkJCXJldHVybiBkaWN0LkNvbnRhaW5zS2V5KGl0ZW0pOwotCQkJfQorICAgICAgICAgICAgcHVibGljIGJvb2wgQ29udGFpbnMoViBpdGVtKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBkaWN0LkNvbnRhaW5zS2V5KGl0ZW0pOworICAgICAgICAg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iAyKSAmIDB4M0ZdOworICAgICAgICAgICAgaWYgKGxlbiA9PSAzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAxXSA9CisgICAgICAgICAgICAgICAgICAgIChieXRlKUVOQ09ERV9UQUJMRVsKKyAgICAgICAgICAgICAgICAgICAgICAgICgoc3JjW3NyY09mZl0gPDwgNCkgJiAweDMwKSB8ICgoc3JjW3NyY09mZiArIDFdID4+IDQpICYgMHgwRildOworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAyXSA9CisgICAgICAgICAgICAgICAgICAgIChieXRlKUVOQ09ERV9UQUJMRVsKKyAgICAgICAgICAgICAgICAgICAgICAgICgoc3JjW3NyY09mZiArIDFdIDw8IDIpICYgMHgzQykgfCAoKHNyY1tzcmNPZmYgKyAyXSA+PiA2KSAmIDB4MDMpXTsKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgM10gPQorICAgICAgICAgICAgICAgICAgICAoYnl0ZSlFTkNPREVfVEFCTEVbc3JjW3NyY09mZiArIDJdICYgMHgzRl07CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChsZW4gPT0gMikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgMV0gPQorICAgICAgICAgICAgICAgICAgICAoYnl0ZSlFTkNPREVfVEFCTEVbCisgICAgICAgICAgICAgICAgICAgICAgICAoKHNyY1tzcmNPZmZdIDw8IDQpICYgMHgzMCkgfCAoKHNyY1tzcmNPZmYgKyAxXSA+PiA0KSAmIDB4MEYpXTsKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgMl0gPQorICAgICAgICAgICAgICAgICAgICAoYnl0ZSlFTkNPREVfVEFCTEVbKHNyY1tzcmNPZmYgKyAxXSA8PCAyKSAmIDB4M0NdOwogCi0JCQl9Ci0JCQllbHNlCi0JCQl7IC8vIGxlbiA9PSAxKSB7Ci0JCQkJZHN0W2Rz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2ZmICsgMV0gJiAweDBGRl0gPj4gNCkpOwotCQkJaWYgKGxlbiA+IDIpCi0JCQl7Ci0JCQkJZHN0W2RzdE9mZiArIDFdID0gKGJ5dGUpCi0JCQkJCSgoKERFQ09ERV9UQUJMRVtzcmNbc3JjT2ZmICsgMV0gJiAweDBGRl0gPDwgNCkgJiAweEYwKSB8Ci0JCQkJCShERUNPREVfVEFCTEVbc3JjW3NyY09mZiArIDJdICYgMHgwRkZdID4+IDIpKTsKLQkJCQlpZiAobGVuID4gMykKLQkJCQl7Ci0JCQkJCWRzdFtkc3RPZmYgKyAyXSA9IChieXRlKQotCQkJCQkJKCgoREVDT0RFX1RBQkxFW3NyY1tzcmNPZmYgKyAyXSAmIDB4MEZGXSA8PCA2KSAmIDB4QzApIHwKLQkJCQkJCURFQ09ERV9UQUJMRVtzcmNbc3JjT2ZmICsgM10gJiAweDBGRl0pOwotCQkJCX0KLQkJCX0KLQkJfQorICAgICAgICBpbnRlcm5hbCBzdGF0aWMgdm9pZCBkZWNvZGUoYnl0ZVtdIHNyYywgaW50IHNyY09mZiwgaW50IGxlbiwgYnl0ZVtdIGRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkc3RPZmYpCisgICAgICAgIHsKKyAgICAgICAgICAgIGRzdFtkc3RPZmZdID0gKGJ5dGUpCisgICAgICAgICAgICAgICAgKChERUNPREVfVEFCTEVbc3JjW3NyY09mZl0gJiAweDBGRl0gPDwgMikgfAorICAgICAgICAgICAgICAgIChERUNPREVfVEFCTEVbc3JjW3NyY09mZiArIDFdICYgMHgwRkZdID4+IDQpKTsKKyAgICAgICAgICAgIGlmIChsZW4gPiAyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAxXSA9IChieXRlKQorICAgICAgICAgICAgICAgICAgICAoKChERUNPREVfVEFCTEVbc3JjW3NyY09mZiArIDFdICYgMHgwRkZdIDw8IDQpICYgMHhGMCkgfAorICAgICAgICAgIC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AgICAgICAgICAgIHsKKyAgICAgICAgICAgIH0KIAotCQkJICBwdWJsaWMgRmFjdG9yeShib29sIHN0cmljdFJlYWQsIGJvb2wgc3RyaWN0V3JpdGUpCi0JCQkgIHsKLQkJCQkgIHN0cmljdFJlYWRfID0gc3RyaWN0UmVhZDsKLQkJCQkgIHN0cmljdFdyaXRlXyA9IHN0cmljdFdyaXRlOwotCQkJICB9CisgICAgICAgICAgICBwdWJsaWMgRmFjdG9yeShib29sIHN0cmljdFJlYWQsIGJvb2wgc3RyaWN0V3JpdGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3RyaWN0UmVhZF8gPSBzdHJpY3RSZWFkOworICAgICAgICAgICAgICAgIHN0cmljdFdyaXRlXyA9IHN0cmljdFdyaXRlOworICAgICAgICAgICAgfQogCi0JCQlwdWJsaWMgVFByb3RvY29sIEdldFByb3RvY29sKFRUcmFuc3BvcnQgdHJhbnMpIHsKLQkJCSAgcmV0dXJuIG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnMsIHN0cmljdFJlYWRfLCBzdHJpY3RXcml0ZV8pOwotCQkJfQotCQkgIH0KKyAgICAgICAgICAgIHB1YmxpYyBUUHJvdG9jb2wgR2V0UHJvdG9jb2woVFRyYW5zcG9ydCB0cmFucykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRCaW5hcnlQcm90b2NvbCh0cmFucywgc3RyaWN0UmVhZF8sIHN0cmljdFdyaXRlXyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQkjZW5kcmVnaW9uCisgICAgICAgICNlbmRyZWdpb24KIAotCQlwdWJsaWMgVEJpbmFyeVByb3RvY29sKFRUcmFuc3BvcnQgdHJhbnMpCi0JCQk6IHRoaXModHJhbnMsIGZhbHNlLCB0cnVlKQotCQl7Ci0JCX0KKyAgICAgICAgcHVibGljIFRCaW5hcnlQcm90b2NvbChUVHJhbnNwb3J0IHRyYW5zKQorICAgICAgICAgIC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LlR5cGUpOwotCQkJCVdyaXRlSTMyKG1lc3NhZ2UuU2VxSUQpOwotCQkJfQotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlTWVzc2FnZUJlZ2luKFRNZXNzYWdlIG1lc3NhZ2UpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChzdHJpY3RXcml0ZV8pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdWludCB2ZXJzaW9uID0gVkVSU0lPTl8xIHwgKHVpbnQpKG1lc3NhZ2UuVHlwZSk7CisgICAgICAgICAgICAgICAgV3JpdGVJMzIoKGludCl2ZXJzaW9uKTsKKyAgICAgICAgICAgICAgICBXcml0ZVN0cmluZyhtZXNzYWdlLk5hbWUpOworICAgICAgICAgICAgICAgIFdyaXRlSTMyKG1lc3NhZ2UuU2VxSUQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIFdyaXRlU3RyaW5nKG1lc3NhZ2UuTmFtZSk7CisgICAgICAgICAgICAgICAgV3JpdGVCeXRlKChzYnl0ZSltZXNzYWdlLlR5cGUpOworICAgICAgICAgICAgICAgIFdyaXRlSTMyKG1lc3NhZ2UuU2VxSUQpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVNZXNzYWdlRW5kKCkKLQkJewotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlTWVzc2FnZUVuZCgpCisgICAgICAgIHsKKyAgICAgICAgfQogCi0JCXB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU3RydWN0QmVnaW4oVFN0cnVjdCBzdHJ1YykKLQkJewotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU3RydWN0QmVnaW4oVFN0cnVjdCBzdHJ1YykKKyAgICAgICAgeworICAgICAgICB9CiAKLQkJcH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gICAgICAgICAgICAgKChsb25nKShpNjRpblswXSAmIDB4ZmYpIDw8IDU2KSB8Ci0gICAgICAgICAgICAgICAgICAoKGxvbmcpKGk2NGluWzFdICYgMHhmZikgPDwgNDgpIHwKLSAgICAgICAgICAgICAgICAgICgobG9uZykoaTY0aW5bMl0gJiAweGZmKSA8PCA0MCkgfAotICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpblszXSAmIDB4ZmYpIDw8IDMyKSB8Ci0gICAgICAgICAgICAgICAgICAoKGxvbmcpKGk2NGluWzRdICYgMHhmZikgPDwgMjQpIHwKLSAgICAgICAgICAgICAgICAgICgobG9uZykoaTY0aW5bNV0gJiAweGZmKSA8PCAxNikgfAotICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpbls2XSAmIDB4ZmYpIDw8IDgpIHwKLSAgICAgICAgICAgICAgICAgICgobG9uZykoaTY0aW5bN10gJiAweGZmKSkpOworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVE1lc3NhZ2UgUmVhZE1lc3NhZ2VCZWdpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIFRNZXNzYWdlIG1lc3NhZ2UgPSBuZXcgVE1lc3NhZ2UoKTsKKyAgICAgICAgICAgIGludCBzaXplID0gUmVhZEkzMigpOworICAgICAgICAgICAgaWYgKHNpemUgPCAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHVpbnQgdmVyc2lvbiA9ICh1aW50KXNpemUgJiBWRVJTSU9OX01BU0s7CisgICAgICAgICAgICAgICAgaWYgKHZlcnNpb24gIT0gVkVSU0lPTl8xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sICJCYWQgdmVyc2lvbiBpbiBSZWFkTWVzc2FnZUJlZ2luOiAiICsgdmVyc2lvbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1lc3NhZ2UuVHlwZSA9IChUTWVzc2FnZVR5cGUpKHNpemUgJiAweDAwMDAwMGZmKTsKKyAgICAgICAgICAgICAgICBtZXNzYWdlLk5hbWUgPSBSZWFkU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgbWVzc2FnZS5TZXFJRCA9IFJlYWRJMzIoKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfQ0KLQ0KLSNwcmFnbWEgd2FybmluZyByZXN0b3JlIDY3NQ0KLQ0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoc3RyaWN0UmVhZF8pCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5CQURfVkVSU0lPTiwgIk1pc3NpbmcgdmVyc2lvbiBpbiByZWFkTWVzc2FnZUJlZ2luLCBvbGQgY2xpZW50PyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtZXNzYWdlLk5hbWUgPSBSZWFkU3RyaW5nQm9keShzaXplKTsKKyAgICAgICAgICAgICAgICBtZXNzYWdlLlR5cGUgPSAoVE1lc3NhZ2VUeXBlKVJlYWRCeXRlKCk7CisgICAgICAgICAgICAgICAgbWVzc2FnZS5TZXFJRCA9IFJlYWRJMzIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBtZXNzYWdlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgUmVhZE1lc3NhZ2VFbmQoKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVFN0cnVjdCBSZWFkU3RydWN0QmVnaW4oKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gbmV3IFRTdHJ1Y3QoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRTdHJ1Y3RFbmQoKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVEZpZWxkIFJlYWRGaWVsZEJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgVEZpZWxkIGZpZWxkID0gbmV3IFRGaWVsZCgpOworICAgICAgICAgICAgZmllbGQuVHlwZSA9IChUVHlwZSlSZWFkQnl0ZSgpOworCisgICAgICAgICAgICBpZiAoZmllbGQuVHlwZSAhPSBUVHlwZS5TdG9wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZpZWxkLklEID0gUmVhZEkxNigpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gZmllbGQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkRmllbGRFbmQoKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVE1hcCBSZWFkTWFwQmVnaW4oKQorICAgICAgICB7CisgICAgICAgICAgICBUTWFwIG1hcCA9IG5ldyBUTWFwKCk7CisgICAgICAgICAgICBtYXAuS2V5VHlwZSA9IChUVHlwZSlSZWFkQnl0ZSgpOworICAgICAgICAgICAgbWFwLlZhbHVlVHlwZSA9IChUVHlwZSlSZWFkQnl0ZSgpOworICAgICAgICAgICAgbWFwLkNvdW50ID0gUmVhZEkzMigpOworCisgICAgICAgICAgICByZXR1cm4gbWFwOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgUmVhZE1hcEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUTGlzdCBSZWFkTGlzdEJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgVExpc3QgbGlzdCA9IG5ldyBUTGlzdCgpOworICAgICAgICAgICAgbGlzdC5FbGVtZW50VHlwZSA9IChUVHlwZSlSZWFkQnl0ZSgpOworICAgICAgICAgICAgbGlzdC5Db3VudCA9IFJlYWRJMzIoKTsKKworICAgICAgICAgICAgcmV0dXJuIGxpc3Q7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkTGlzdEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUU2V0IFJlYWRTZXRCZWdpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIFRTZXQgc2V0ID0gbmV3IFRTZXQoKTsKKyAgICAgICAgICAgIHNldC5FbGVtZW50VHlwZSA9IChUVHlwZSlSZWFkQnl0ZSgpOworICAgICAgICAgICAgc2V0LkNvdW50ID0gUmVhZEkzMigpOworCisgICAgICAgICAgICByZXR1cm4gc2V0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgUmVhZFNldEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIFJlYWRCb29sKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFJlYWRCeXRlKCkgPT0gMTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYnl0ZVtdIGJpbiA9IG5ldyBieXRlWzFdOworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgc2J5dGUgUmVhZEJ5dGUoKQorICAgICAgICB7CisgICAgICAgICAgICBSZWFkQWxsKGJpbiwgMCwgMSk7CisgICAgICAgICAgICByZXR1cm4gKHNieXRlKWJpblswXTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYnl0ZVtdIGkxNmluID0gbmV3IGJ5dGVbMl07CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBzaG9ydCBSZWFkSTE2KCkKKyAgICAgICAgeworICAgICAgICAgICAgUmVhZEFsbChpMTZpbiwgMCwgMik7CisgICAgICAgICAgICByZXR1cm4gKHNob3J0KSgoKGkxNmluWzBdICYgMHhmZikgPDwgOCkgfCAoKGkxNmluWzFdICYgMHhmZikpKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYnl0ZVtdIGkzMmluID0gbmV3IGJ5dGVbNF07CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBpbnQgUmVhZEkzMigpCisgICAgICAgIHsKKyAgICAgICAgICAgIFJlYWRBbGwoaTMyaW4sIDAsIDQpOworICAgICAgICAgICAgcmV0dXJuIChpbnQpKCgoaTMyaW5bMF0gJiAweGZmKSA8PCAyNCkgfCAoKGkzMmluWzFdICYgMHhmZikgPDwgMTYpIHwgKChpMzJpblsyXSAmIDB4ZmYpIDw8IDgpIHwgKChpMzJpblszXSAmIDB4ZmYpKSk7CisgICAgICAgIH0KKworI3ByYWdtYSB3YXJuaW5nIGRpc2FibGUgNjc1CisKKyAgICAgICAgcHJpdmF0ZSBieXRlW10gaTY0aW4gPSBuZXcgYnl0ZVs4XTsKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGxvbmcgUmVhZEk2NCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFJlYWRBbGwoaTY0aW4sIDAsIDgpOworICAgICAgICAgICAgdW5jaGVja2VkCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIChsb25nKSgKKyAgICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpblswXSAmIDB4ZmYpIDw8IDU2KSB8CisgICAgICAgICAgICAgICAgICAgICgobG9uZykoaTY0aW5bMV0gJiAweGZmKSA8PCA0OCkgfAorICAgICAgICAgICAgICAgICAgICAoKGxvbmcpKGk2NGluWzJdICYgMHhmZikgPDwgNDApIHwKKyAgICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpblszXSAmIDB4ZmYpIDw8IDMyKSB8CisgICAgICAgICAgICAgICAgICAgICgobG9uZykoaTY0aW5bNF0gJiAweGZmKSA8PCAyNCkgfAorICAgICAgICAgICAgICAgICAgICAoKGxvbmcpKGk2NGluWzVdICYgMHhmZikgPDwgMTYpIHwKKyAgICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpbls2XSAmIDB4ZmYpIDw8IDgpIHwKKyAgICAgICAgICAgICAgICAgICAgKChsb25nKShpNjRpbls3XSAmIDB4ZmYpKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworI3ByYWdtYSB3YXJuaW5nIHJlc3RvcmUgNjc1CisKICAgICAgICAgcHVibGljIG92ZXJyaWRlIGRvdWJsZSBSZWFkRG91YmxlKCkKLQkJeworICAgICAgICB7CiAjaWYgIVNJTFZFUkxJR0hUCi0JCQlyZXR1cm4gQml0Q29udmVydGVyLkludDY0Qml0c1RvRG91YmxlKFJlYWRJNjQoKSk7CisgICAgICAgICAgICByZXR1cm4gQml0Q29udmVydGVyLkludDY0Qml0c1RvRG91YmxlKFJlYWRJNjQoKSk7CiAjZWxzZQogICAgICAgICAgICAgdmFyIHZhbHVlID0gUmVhZEk2NCgpOwogICAgICAgICAgICAgdmFyIGJ5dGVzID0gQml0Q29udmVydGVyLkdldEJ5dGVzKHZhbHVlKTsKICAgICAgICAgICAgIHJldHVybiBCaXRDb252ZXJ0ZXIuVG9Eb3VibGUoYnl0ZXMsIDApOwogI2VuZGlmCi0JCX0KKyAgICAgICAgfQogCi0JCXB1YmxpYyBvdmVycmlkZSBieXRlW10gUmVhZEJpbmFyeSgpCi0JCXsKLQkJCWludCBzaXplID0gUmVhZEkzMigpOwotCQkJYnl0ZVtdIGJ1ZiA9IG5ldyBieXRlW3NpemVdOwotCQkJdHJhbnMuUmVhZEFsbChidWYsIDAsIHNpemUpOwotCQkJcmV0dXJuIGJ1ZjsKLQkJfQotCQlwcml2YXRlICBzdHJpbmcgUmVhZFN0cmluZ0JvZHkoaW50IHNpemUpCi0JCXsKLQkJCWJ5dGVbXSBidWYgPSBuZXcgYnl0ZVtzaXplXTsKLQkJCXRyYW5zLlJlYWRBbGwoYnVmLCAwLCBzaXplKTsKLQkJCXJldHVybiBFbmNvZGluZy5VVEY4LkdldFN0cmluZyhidWYsIDAsIGJ1Zi5MZW5ndGgpOwotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBieXRlW10gUmVhZEJpbmFyeSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGludCBzaXplID0gUmVhZEkzMigpOworICAgICAgICAgICAgYnl0ZVtdIGJ1ZiA9IG5ldyBieXRlW3NpemVdOworICAgICAgICAgICAgdHJhbnMuUmVhZEFsbChidWYsIDAsIHNpemUpOworICAgICAgICAgICAgcmV0dXJuIGJ1ZjsKKyAgICAgICAgfQorICAgICAgICBwcml2YXRlIHN0cmluZyBSZWFkU3RyaW5nQm9keShpbnQgc2l6ZSkKKyAgICAgICAgeworICAgICAgICAgICAgYnl0ZVtdIGJ1ZiA9IG5ldyBieXRlW3NpemVdOworICAgICAgICAgICAgdHJhbnMuUmVhZEFsbChidWYsIDAsIHNpemUpOworICAgICAgICAgICAgcmV0dXJuIEVuY29kaW5nLlVURjguR2V0U3RyaW5nKGJ1ZiwgMCwgYnVmLkxlbmd0aCk7CisgICAgICAgIH0KIAotCQlwcml2YXRlIGludCBSZWFkQWxsKGJ5dGVbXSBidWYsIGludCBvZmYsIGludCBsZW4pCi0JCXsKLQkJCXJldHVybiB0cmFucy5SZWFkQWxsKGJ1Ziwgb2ZmLCBsZW4pOwotCQl9CisgICAgICAgIHByaXZhdGUgaW50IFJlYWRBbGwoYnl0ZVtdIGJ1ZiwgaW50IG9mZiwgaW50IGxlbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHRyYW5zLlJlYWRBbGwoYnVmLCBvZmYsIGxlbik7CisgICAgICAgIH0KIAotCQkjZW5kcmVnaW9uCi0JfQorICAgICAgICAjZW5kcmVnaW9uCisgICAgfQogfQpkaWZmIC0tZ2l0IGEvbGliL2NzaGFycC9zcmMvUHJvdG9jb2wvVENvbXBhY3RQcm90b2NvbC5jcyBiL2xpYi9jc2h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KICAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVMaXN0QmVnaW4oVExpc3QgbGlzdCkKICAgICAgICAgewogICAgICAgICAgICAgV3JpdGVDb2xsZWN0aW9uQmVnaW4obGlzdC5FbGVtZW50VHlwZSwgbGlzdC5Db3VudCk7CiAgICAgICAgIH0KIAotICAgICAgICAvKioKLSAgICAgICAgICogV3JpdGUgYSBzZXQgaGVhZGVyLgotICAgICAgICAgKi8KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gV3JpdGUgYSBzZXQgaGVhZGVyLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgogICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZVNldEJlZ2luKFRTZXQgc2V0KQogICAgICAgICB7CiAgICAgICAgICAgICBXcml0ZUNvbGxlY3Rpb25CZWdpbihzZXQuRWxlbWVudFR5cGUsIHNldC5Db3VudCk7CiAgICAgICAgIH0KIAotICAgICAgICAvKioKLSAgICAgICAgICogV3JpdGUgYSBib29sZWFuIHZhbHVlLiBQb3RlbnRpYWxseSwgdGhpcyBjb3VsZCBiZSBhIGJvb2xlYW4gZmllbGQsIGluIAotICAgICAgICAgKiB3aGljaCBjYXNlIHRoZSBmaWVsZCBoZWFkZXIgaW5mbyBpc24ndCB3cml0dGVuIHlldC4gSWYgc28sIGRlY2lkZSB3aGF0IHRoZQotICAgICAgICAgKiByaWdodCB0eXBlIGhlYWRlciBpcyBmb3IgdGhlIHZhbHVlIGFuZCB0aGVuIFdyaXRlIHRoZSBmaWVsZCBoZWFkZXIuIAotICAgICAgICAgKiBPdGhlcndpc2UsIFdyaXRlIGEgc2luZ2xlIGJ5dGUuCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBXcml0ZSBhIGJvb2xlYW4gdmFsdWUuIFBvdGVudGlhbGx5LCB0aGlzIGNvdWxkIGJlIGEgYm9vbGVhbiBmaWVs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AgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlSTE2KHNob3J0IGkxNikKICAgICAgICAgewogICAgICAgICAgICAgV3JpdGVWYXJpbnQzMihpbnRUb1ppZ1phZyhpMTYpKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBXcml0ZSBhbiBpMzIgYXMgYSB6aWd6YWcgdmFyaW50LgotICAgICAgICAgKi8KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gV3JpdGUgYW4gaTMyIGFzIGEgemlnemFnIHZhcmludC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVJMzIoaW50IGkzMikKICAgICAgICAgewogICAgICAgICAgICAgV3JpdGVWYXJpbnQzMihpbnRUb1ppZ1phZyhpMzIpKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBXcml0ZSBhbiBpNjQgYXMgYSB6aWd6YWcgdmFyaW50LgotICAgICAgICAgKi8KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gV3JpdGUgYW4gaTY0IGFzIGEgemlnemFnIHZhcmludC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVJNjQobG9uZyBpNjQpCiAgICAgICAgIHsKICAgICAgICAgICAgIFdyaXRlVmFyaW50NjQobG9uZ1RvWmlnemFnKGk2NCkpOwogICAgICAgICB9CiAKLSAgICAgICAgLyoqCi0gICAgICAgICAqIFdyaXRlIGEgZG91YmxlIHRvIHRoZSB3aXJlIGFzIDggYnl0ZXMuCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBXcml0ZSBhIGRvdWJsZSB0byB0aGUgd2lyZSBhcyA4IGJ5dGVzLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgogICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZURvdWJsZShkb3VibGUgZHViKQogICAgICAgICB7CiAgICAgICAgICAgICBieXRlW10gZGF0YSA9IG5ldyBieXRlW10geyAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwIH07CkBAIC0zNTgsMTggKzM1NywxOCBAQAogICAgICAgICAgICAgdHJhbnMuV3JpdGUoZGF0YSk7CiAgICAgICAgIH0KIAotICAgICAgICAvKioKLSAgICAgICAgICogV3JpdGUgYSBzdHJpbmcgdG8gdGhlIHdpcmUgd2l0aCBhIHZhcmludCBzaXplIHByZWNlZGluZy4KLSAgICAgICAgICovCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU3RyaW5nKFN0cmluZyBzdHIpCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIFdyaXRlIGEgc3RyaW5nIHRvIHRoZSB3aXJlIHdpdGggYSB2YXJpbnQgc2l6ZSBwcmVjZWRpbmcuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU3RyaW5nKHN0cmluZyBzdHIpCiAgICAgICAgIHsKICAgICAgICAgICAgIGJ5dGVbXSBieXRlcyA9IFVURjhFbmNvZGluZy5VVEY4LkdldEJ5dGVzKHN0cik7CiAgICAgICAgICAgICBXcml0ZUJpbmFyeShieXRlcywgMCwgYnl0ZXMuTGVuZ3RoKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBXcml0ZSBhIGJ5dGUgYXJyYXksIHVzaW5nIGEgdmFyaW50IGZvciB0aGUgc2l6ZS4gCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBXcml0ZSBhIGJ5dGUgYXJyYXksIHVzaW5nIGEgdmFyaW50IGZvciB0aGUgc2l6ZS4KKyAgICAgICAgLy8vIDwvc3Vt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nRvIGEgemlnemFnIGxvbmcuIFRoaXMgYWxsb3dzIG5lZ2F0aXZlIG51bWJlcnMgdG8gYmUKKyAgICAgICAgLy8vIHJlcHJlc2VudGVkIGNvbXBhY3RseSBhcyBhIHZhcmludC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHJpdmF0ZSB1bG9uZyBsb25nVG9aaWd6YWcobG9uZyBuKQogICAgICAgICB7CiAgICAgICAgICAgICByZXR1cm4gKHVsb25nKShuIDw8IDEpIF4gKHVsb25nKShuID4+IDYzKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBDb252ZXJ0IG4gaW50byBhIHppZ3phZyBpbnQuIFRoaXMgYWxsb3dzIG5lZ2F0aXZlIG51bWJlcnMgdG8gYmUgCi0gICAgICAgICAqIHJlcHJlc2VudGVkIGNvbXBhY3RseSBhcyBhIHZhcmludC4KLSAgICAgICAgICovCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIENvbnZlcnQgbiBpbnRvIGEgemlnemFnIGludC4gVGhpcyBhbGxvd3MgbmVnYXRpdmUgbnVtYmVycyB0byBiZQorICAgICAgICAvLy8gcmVwcmVzZW50ZWQgY29tcGFjdGx5IGFzIGEgdmFyaW50LgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgogICAgICAgICBwcml2YXRlIHVpbnQgaW50VG9aaWdaYWcoaW50IG4pCiAgICAgICAgIHsKICAgICAgICAgICAgIHJldHVybiAodWludCkobiA8PCAxKSBeICh1aW50KShuID4+IDMxKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBDb252ZXJ0IGEgbG9uZyBpbnRvIGxpdHRsZS1lbmRpYW4gYnl0ZXMgaW4gYnVmIHN0YXJ0aW5nIGF0IG9mZiBhbmQgZ29pbmcgCi0gICAgICAgICAqIHVudGlsIG9mZis3LgotICAgICAgICAgKi8KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgIC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y8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gUmVhZCBhbiBpMTYgZnJvbSB0aGUgd2lyZSBhcyBhIHppZ3phZyB2YXJpbnQuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CiAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBzaG9ydCBSZWFkSTE2KCkKICAgICAgICAgewogICAgICAgICAgICAgcmV0dXJuIChzaG9ydCl6aWd6YWdUb0ludChSZWFkVmFyaW50MzIoKSk7CiAgICAgICAgIH0KIAotICAgICAgICAvKioKLSAgICAgICAgICogUmVhZCBhbiBpMzIgZnJvbSB0aGUgd2lyZSBhcyBhIHppZ3phZyB2YXJpbnQuCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBSZWFkIGFuIGkzMiBmcm9tIHRoZSB3aXJlIGFzIGEgemlnemFnIHZhcmludC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHVibGljIG92ZXJyaWRlIGludCBSZWFkSTMyKCkKICAgICAgICAgewogICAgICAgICAgICAgcmV0dXJuIHppZ3phZ1RvSW50KFJlYWRWYXJpbnQzMigpKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKgotICAgICAgICAgKiBSZWFkIGFuIGk2NCBmcm9tIHRoZSB3aXJlIGFzIGEgemlnemFnIHZhcmludC4KLSAgICAgICAgICovCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIFJlYWQgYW4gaTY0IGZyb20gdGhlIHdpcmUgYXMgYSB6aWd6YWcgdmFyaW50LgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgogICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgbG9uZyBSZWFkSTY0KCkKICAgICAgICAgewogICAgICAgICAgICAgcmV0dXJuIHppZ3phZ1RvTG9uZyhSZWFkVmFyaW50NjQoKSk7CiAgICAgICAgIH0KIAotICAgICAgICAvKioKLSAgICAgICAgICogTm8gbWFnaWMgaGV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EAgLTczMiwyMiArNzMxLDIyIEBACiAgICAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgICB9CiAKLSAgICAgICAgLyoqCi0gICAgICAgICAqIFJlYWQgYW4gaTY0IGZyb20gdGhlIHdpcmUgYXMgYSBwcm9wZXIgdmFyaW50LiBUaGUgTVNCIG9mIGVhY2ggYnl0ZSBpcyBzZXQgCi0gICAgICAgICAqIGlmIHRoZXJlIGlzIGFub3RoZXIgYnl0ZSB0byBmb2xsb3cuIFRoaXMgY2FuIFJlYWQgdXAgdG8gMTAgYnl0ZXMuCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBSZWFkIGFuIGk2NCBmcm9tIHRoZSB3aXJlIGFzIGEgcHJvcGVyIHZhcmludC4gVGhlIE1TQiBvZiBlYWNoIGJ5dGUgaXMgc2V0CisgICAgICAgIC8vLyBpZiB0aGVyZSBpcyBhbm90aGVyIGJ5dGUgdG8gZm9sbG93LiBUaGlzIGNhbiBSZWFkIHVwIHRvIDEwIGJ5dGVzLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgogICAgICAgICBwcml2YXRlIHVsb25nIFJlYWRWYXJpbnQ2NCgpCiAgICAgICAgIHsKICAgICAgICAgICAgIGludCBzaGlmdCA9IDA7CiAgICAgICAgICAgICB1bG9uZyByZXN1bHQgPSAwOwogICAgICAgICAgICAgd2hpbGUgKHRydWUpCi0gICAgICAgICAgICB7DQorICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIGJ5dGUgYiA9IChieXRlKVJlYWRCeXRlKCk7CiAgICAgICAgICAgICAgICAgcmVzdWx0IHw9ICh1bG9uZykoYiAmIDB4N2YpIDw8IHNoaWZ0OwogICAgICAgICAgICAgICAgIGlmICgoYiAmIDB4ODApICE9IDB4ODApIGJyZWFrOwogICAgICAgICAgICAgICAgIHNoaWZ0ICs9IDc7CiAgICAgICAgICAgICB9Ci0JCQkKKwogICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICAgfQogCkBAIC03NTcsMjcgKzc1NiwyNyBAQAogICAgICAgICAvLyBlbmNvZGluZyBoZWxwZXJzCiAgICAgICAgIC8vCiAKLSAgICAgICAgLyoqCi0gICAgICAgICAqIENvbnZlcnQgZnJvbSB6aWd6YWcgaW50IHRvIGludC4KLSAgICAgICAgICovCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIENvbnZlcnQgZnJvbSB6aWd6YWcgaW50IHRvIGludC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHJpdmF0ZSBpbnQgemlnemFnVG9JbnQodWludCBuKQogICAgICAgICB7CiAgICAgICAgICAgICByZXR1cm4gKGludCkobiA+PiAxKSBeICgtKGludCkobiAmIDEpKTsKICAgICAgICAgfQogCi0gICAgICAgIC8qKiAKLSAgICAgICAgICogQ29udmVydCBmcm9tIHppZ3phZyBsb25nIHRvIGxvbmcuCi0gICAgICAgICAqLworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBDb252ZXJ0IGZyb20gemlnemFnIGxvbmcgdG8gbG9uZy4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KICAgICAgICAgcHJpdmF0ZSBsb25nIHppZ3phZ1RvTG9uZyh1bG9uZyBuKQogICAgICAgICB7CiAgICAgICAgICAgICByZXR1cm4gKGxvbmcpKG4gPj4gMSkgXiAoLShsb25nKShuICYgMSkpOwogICAgICAgICB9CiAKLSAgICAgICAgLyoqCi0gICAgICAgICAqIE5vdGUgdGhhdCBpdCdzIGltcG9ydGFudCB0aGF0IHRoZSBtYXNrIGJ5dGVzIGFyZSBsb25nIGxpdGVyYWxzLCAKLSAgICAgICAgICogb3RoZXJ3aXNlIHRoZXknbGwgZGVmYXVsdCB0byBpbnRzLCBhbmQgd2hlbiB5b3Ugc2hpZnQgYW4gaW50IGxlZnQgNTYgYml0cywKLSAgICAgICAgICogeW91IGp1c3QgZ2V0IGEgbWVz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isgICAgeworICAgICAgICBwcml2YXRlIHN0cmluZyBuYW1lOworICAgICAgICBwcml2YXRlIFRUeXBlIHR5cGU7CisgICAgICAgIHByaXZhdGUgc2hvcnQgaWQ7CiAKLQkJcHVibGljIFRGaWVsZChzdHJpbmcgbmFtZSwgVFR5cGUgdHlwZSwgc2hvcnQgaWQpCi0JCQk6dGhpcygpCi0JCXsKLQkJCXRoaXMubmFtZSA9IG5hbWU7Ci0JCQl0aGlzLnR5cGUgPSB0eXBlOwotCQkJdGhpcy5pZCA9IGlkOwotCQl9CisgICAgICAgIHB1YmxpYyBURmllbGQoc3RyaW5nIG5hbWUsIFRUeXBlIHR5cGUsIHNob3J0IGlkKQorICAgICAgICAgICAgOnRoaXMoKQorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLm5hbWUgPSBuYW1lOworICAgICAgICAgICAgdGhpcy50eXBlID0gdHlwZTsKKyAgICAgICAgICAgIHRoaXMuaWQgPSBpZDsKKyAgICAgICAgfQogCi0JCXB1YmxpYyBzdHJpbmcgTmFtZQotCQl7Ci0JCQlnZXQgeyByZXR1cm4gbmFtZTsgfQotCQkJc2V0IHsgbmFtZSA9IHZhbHVlOyB9Ci0JCX0KKyAgICAgICAgcHVibGljIHN0cmluZyBOYW1lCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldCB7IHJldHVybiBuYW1lOyB9CisgICAgICAgICAgICBzZXQgeyBuYW1lID0gdmFsdWU7IH0KKyAgICAgICAgfQogCi0JCXB1YmxpYyBUVHlwZSBUeXBlCi0JCXsKLQkJCWdldCB7IHJldHVybiB0eXBlOyB9Ci0JCQlzZXQgeyB0eXBlID0gdmFsdWU7IH0KLQkJfQorICAgICAgICBwdWJsaWMgVFR5cGUgVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4gdHlwZTsgfQorICAgICAgICAgICAgc2V0IHsgdHlwZSA9IHZhbHVlOyB9CisgICAgICAgIH0KIAotCQlwdWJsaWMgc2hvcnQgSUQKL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TVFJJTkc7Ci0JCQkJY2FzZSBUVHlwZS5TdHJ1Y3Q6Ci0JCQkJCXJldHVybiBOQU1FX1NUUlVDVDsKLQkJCQljYXNlIFRUeXBlLk1hcDoKLQkJCQkJcmV0dXJuIE5BTUVfTUFQOwotCQkJCWNhc2UgVFR5cGUuU2V0OgotCQkJCQlyZXR1cm4gTkFNRV9TRVQ7Ci0JCQkJY2FzZSBUVHlwZS5MaXN0OgotCQkJCQlyZXR1cm4gTkFNRV9MSVNUOwotCQkJCWRlZmF1bHQ6Ci0JCQkJCXRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLk5PVF9JTVBMRU1FTlRFRCwKLQkJCQkJCQkJCQkJCSAiVW5yZWNvZ25pemVkIHR5cGUiKTsKLQkJCX0KLQkJfQorICAgICAgICBwcml2YXRlIHN0YXRpYyBieXRlW10gR2V0VHlwZU5hbWVGb3JUeXBlSUQoVFR5cGUgdHlwZUlEKQorICAgICAgICB7CisgICAgICAgICAgICBzd2l0Y2ggKHR5cGVJRCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkJvb2w6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOQU1FX0JPT0w7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5CeXRlOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTkFNRV9CWVRFOworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuSTE2OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTkFNRV9JMTY7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5JMzI6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOQU1FX0kzMjsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkk2NDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5BTUVfSTY0OworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuRG91YmxlOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTkFNRV9ET1VCTEU7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TdHJpbmc6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOQU1FX1NUUklORzsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLlN0cnVjdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5BTUVfU1RSVUNUOworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuTWFwOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTkFNRV9NQVA7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TZXQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOQU1FX1NFVDsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkxpc3Q6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOQU1FX0xJU1Q7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uTk9UX0lNUExFTUVOVEVELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJVbnJlY29nbml6ZWQgdHlwZSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHJpdmF0ZSBzdGF0aWMgVFR5cGUgR2V0VHlwZUlERm9yVHlwZU5hbWUoYnl0ZVtdIG5hbWUpCi0JCXsKLQkJCVRUeXBlIHJlc3VsdCA9IFRUeXBlLlN0b3A7Ci0JCQlpZiAobmFtZS5MZW5ndGggPiAxKQotCQkJewotCQkJCXN3aXRjaCAobmFtZVswXSkKLQkJCQl7Ci0JCQkJCWNhc2UgKGJ5dGUpJ2QnOgotCQkJCQkJcmVzdWx0ID0gVFR5cGUuRG91YmxlOwotCQkJCQkJYnJlYWs7Ci0JCQkJCWNhc2UgKGJ5dGUpJ2knOgotCQkJ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CX0KLQkJCX0KLQkJCWlmIChyZXN1bHQgPT0gVFR5cGUuU3RvcCkKLQkJCXsKLQkJCQl0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsCi0JCQkJCQkJCQkJCSAiVW5yZWNvZ25pemVkIHR5cGUiKTsKLQkJCX0KLQkJCXJldHVybiByZXN1bHQ7Ci0JCX0KKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgVFR5cGUgR2V0VHlwZUlERm9yVHlwZU5hbWUoYnl0ZVtdIG5hbWUpCisgICAgICAgIHsKKyAgICAgICAgICAgIFRUeXBlIHJlc3VsdCA9IFRUeXBlLlN0b3A7CisgICAgICAgICAgICBpZiAobmFtZS5MZW5ndGggPiAxKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN3aXRjaCAobmFtZVswXSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpJ2QnOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuRG91YmxlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpJ2knOgorICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuYW1lWzFdKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpJzgnOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBUVHlwZS5CeXRlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKScxJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuSTE2OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSczJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuSTMyOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc2JzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuSTY0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSdsJzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkxpc3Q7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknbSc6CisgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBUVHlwZS5NYXA7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkncic6CisgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBUVHlwZS5TdHJ1Y3Q7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkncyc6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobmFtZVsxXSA9PSAoYnl0ZSkndCcpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuU3RyaW5nOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobmFtZVsxXSA9PSAoYnl0ZSknZScpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuU2V0OworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpJ3QnOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuQm9vbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChyZXN1bHQgPT0gVFR5cGUuU3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVW5yZWNvZ25pemVkIHR5cGUiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KIAotCQkvLy88c3VtbWFyeT4KLQkJLy8vIEJhc2UgY2xhc3MgZm9yIHRyYWNraW5nIEpTT04gY29udGV4dHMgdGhhdCBtYXkgcmVxdWlyZQotCQkvLy8gaW5zZXJ0aW5nL1JlYWRpbmcgYWRkaXRpb25hbCBKU09OIHN5bnRheCBjaGFyYWN0ZXJzCi0JCS8vLyBUaGlzIGJhc2UgY29udGV4dCBkb2VzIG5vdGhpbmcuCi0JCS8vLzwvc3VtbWFyeT4KLQkJcHJvdGVjdGVkIGNsYXNzIEpTT05CYXNlQ29udGV4dAotCQl7Ci0JCQlwcm90ZWN0ZWQgVEpTT05Qcm90b2NvbCBwcm90bzsKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gQmFzZSBjbGFzcyBmb3Igd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gIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwcm90by50cmFucy5Xcml0ZShDT01NQSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogCi0JCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkKCkKLQkJCXsKLQkJCQlpZiAoZmlyc3QpCi0JCQkJewotCQkJCQlmaXJzdCA9IGZhbHNlOwotCQkJCX0KLQkJCQllbHNlCi0JCQkJewotCQkJCQlwcm90by5SZWFkSlNPTlN5bnRheENoYXIoQ09NTUEpOwotCQkJCX0KLQkJCX0KLQkJfQorICAgICAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgUmVhZCgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdG8uUmVhZEpTT05TeW50YXhDaGFyKENPTU1BKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQkvLy88c3VtbWFyeT4KLQkJLy8vIENvbnRleHQgZm9yIEpTT04gcmVjb3Jkcy4gV2lsbCBpbnNlcnQvUmVhZCBjb2xvbnMgYmVmb3JlIHRoZSB2YWx1ZSBwb3J0aW9uCi0JCS8vLyBvZiBlYWNoIHJlY29yZCBwYWlyLCBhbmQgY29tbWFzIGJlZm9yZSBlYWN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ICAgIHsKIAotCQkJfQorICAgICAgICAgICAgfQogCi0JCQlwcml2YXRlIGJvb2wgZmlyc3QgPSB0cnVlOwotCQkJcHJpdmF0ZSBib29sIGNvbG9uID0gdHJ1ZTsKKyAgICAgICAgICAgIHByaXZhdGUgYm9vbCBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICBwcml2YXRlIGJvb2wgY29sb24gPSB0cnVlOwogCi0JCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZSgpCi0JCQl7Ci0JCQkJaWYgKGZpcnN0KQotCQkJCXsKLQkJCQkJZmlyc3QgPSBmYWxzZTsKLQkJCQkJY29sb24gPSB0cnVlOwotCQkJCX0KLQkJCQllbHNlCi0JCQkJewotCQkJCQlwcm90by50cmFucy5Xcml0ZShjb2xvbiA/IENPTE9OIDogQ09NTUEpOwotCQkJCQljb2xvbiA9ICFjb2xvbjsKLQkJCQl9Ci0JCQl9CisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZSgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgY29sb24gPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwcm90by50cmFucy5Xcml0ZShjb2xvbiA/IENPTE9OIDogQ09NTUEpOworICAgICAgICAgICAgICAgICAgICBjb2xvbiA9ICFjb2xvbjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAKLQkJCXB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWQoKQotCQkJewotCQkJCWlmIChmaXJzdCkKLQkJCQl7Ci0JCQkJCWZpcnN0ID0gZmFsc2U7Ci0JCQkJCWNvbG9uID0gdHJ1ZTsKLQkJCQl9Ci0JCQkJZWxzZQotCQkJCXsKLQkJCQkJcHJvdG8uUmVhZEpTT05TeW50YXhDaGFyKGNvbG9uID8gQ09MT04gOiBDT01NQSk7Ci0JCQkJCWNvbG9uID0gIWNvbG9uOwotCQkJCX0KLQkJCX0KKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWQoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGNvbG9uID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdG8uUmVhZEpTT05TeW50YXhDaGFyKGNvbG9uID8gQ09MT04gOiBDT01NQSk7CisgICAgICAgICAgICAgICAgICAgIGNvbG9uID0gIWNvbG9uOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KIAotCQkJcHVibGljIG92ZXJyaWRlIGJvb2wgRXNjYXBlTnVtYmVycygpCi0JCQl7Ci0JCQkJcmV0dXJuIGNvbG9uOwotCQkJfQotCQl9CisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBFc2NhcGVOdW1iZXJzKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gY29sb247CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQkvLy88c3VtbWFyeT4KLQkJLy8vIEhvbGRzIHVwIHRvIG9uZSBieXRlIGZyb20gdGhlIHRyYW5zcG9ydAotCQkvLy88L3N1bW1hcnk+Ci0JCXByb3RlY3RlZCBjbGFzcyBMb29rYWhlYWRSZWFkZXIKLQkJewotCQkJcHJvdGVjdGVkIFRKU09OUHJvdG9jb2wgcHJvdG87CisgICAgICAgIC8vLyA8c3VtbWFyeT4K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AgICAgICAgICAgICAgICAgIGlmIChiW2ldID09IEJBQ0tTTEFTSFswXSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoQkFDS1NMQVNIKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zLldyaXRlKEJBQ0tTTEFTSCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFucy5Xcml0ZShiLCBpLCAxKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0ZW1wQnVmZmVyWzBdID0gSlNPTl9DSEFSX1RBQkxFW2JbaV1dOworICAgICAgICAgICAgICAgICAgICBpZiAodGVtcEJ1ZmZlclswXSA9PSAxKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFucy5Xcml0ZShiLCBpLCAxKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0ZW1wQnVmZmVyWzBdID4gMSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoQkFDS1NMQVNIKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zLldyaXRlKHRlbXBCdWZmZXIsIDAsIDEpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoRVNDU0VRKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRlbXBCdWZmZXJbMF0gPSBIZXhDaGFyKChieXRlKShiW2ldID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PSBjb250ZXh0LkVzY2FwZU51bWJlcnMoKTsKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoUVVPVEUpOworCisgICAgICAgICAgICB0cmFucy5Xcml0ZSh1dGY4RW5jb2RpbmcuR2V0Qnl0ZXMoc3RyKSk7CisKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoUVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gV3JpdGUgb3V0IGEgZG91YmxlIGFzIGEgSlNPTiB2YWx1ZS4gSWYgaXQgaXMgTmFOIG9yIGluZmluaXR5IG9yIGlmIHRoZQorICAgICAgICAvLy8gY29udGV4dCBkaWN0YXRlcyBlc2NhcGluZywgV3JpdGUgb3V0IGFzIEpTT04gc3RyaW5nLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIHZvaWQgV3JpdGVKU09ORG91YmxlKGRvdWJsZSBudW0pCisgICAgICAgIHsKKyAgICAgICAgICAgIGNvbnRleHQuV3JpdGUoKTsKKyAgICAgICAgICAgIHN0cmluZyBzdHIgPSBudW0uVG9TdHJpbmcoIkcxNyIsIEN1bHR1cmVJbmZvLkludmFyaWFudEN1bHR1cmUpOworICAgICAgICAgICAgYm9vbCBzcGVjaWFsID0gZmFsc2U7CisKKyAgICAgICAgICAgIHN3aXRjaCAoc3RyWzBdKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhc2UgJ04nOiAvLyBOYU4KKyAgICAgICAgICAgICAgICBjYXNlICdJJzogLy8gSW5maW5pdHkKKyAgICAgICAgICAgICAgICAgICAgc3BlY2lhbCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJy0nOgorICAgICAgICAgICAgICAgICAgICBpZiAoc3RyWzFdID09ICdJJykKKyAgICAgICAgICAgICAgICAgICAgeyAvLyAtSW5maW5pdHkKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWwgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBib29sIGVzY2FwZU51bSA9IHNwZWNpYWwgfHwgY29udGV4dC5Fc2NhcGVOdW1iZXJzKCk7CisKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoUVVPVEUpOworCisgICAgICAgICAgICB0cmFucy5Xcml0ZSh1dGY4RW5jb2RpbmcuR2V0Qnl0ZXMoc3RyKSk7CisKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICAgICAgdHJhbnMuV3JpdGUoUVVPVEUpOworICAgICAgICB9CisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIFdyaXRlIG91dCBjb250ZW50cyBvZiBieXRlIGFycmF5IGIgYXMgYSBKU09OIHN0cmluZyB3aXRoIGJhc2UtNjQgZW5jb2RlZAorICAgICAgICAvLy8gZGF0YQorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIHZvaWQgV3JpdGVKU09OQmFzZTY0KGJ5dGVbXSBiKQorICAgICAgICB7CisgICAgICAgICAgICBjb250ZXh0LldyaXRlKCk7CisgICAgICAgICAgICB0cmFucy5Xcml0ZShRVU9URSk7CiAKLQkJCWJvb2wgZXNjYXBlTnVtID0gY29udGV4dC5Fc2NhcGVOdW1iZXJzKCk7Ci0JCQlpZiAoZXNjYXBlTnVtKQotCQkJCXRyYW5zLldyaXRlKFFVT1RFKTsKKyAgICAgICAgICAgIGludCBsZW4gPSBiLkxlbmd0aDsKKyAgICAgICAgICAgIGludCBvZmYgPSAwOwogCi0JCQl0cmFucy5Xcml0ZSh1dGY4RW5jb2RpbmcuR2V0Qnl0ZXMoc3RyKSk7CisgICAgICAgICAgICB3aGlsZSAobGVuID49IDMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gRW5jb2RlIDMgYnl0ZXMgYXQgYSB0aW1lCisgICAgICAgICAgICAgICAgVEJhc2U2NFV0aWxzLmVuY29kZShiLCBvZmYsIDMsIHRlbXBCdWZmZXIsIDApOworICAgICAgICAgICAgICAgIHRyYW5zLldyaXRlKHRlbXBCdWZmZXIsIDAsIDQpOworICAgICAgICAgICAgICAgIG9mZiArPSAzOworICAgICAgICAgICAgICAgIGxlbiAtPSAzOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGxlbiA+IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gRW5jb2RlIHJlbWFpbmRlcgorICAgICAgICAgICAgICAgIFRCYXNlNjRVdGlscy5lbmNvZGUoYiwgb2ZmLCBsZW4sIHRlbXBCdWZmZXIsIDApOworICAgICAgICAgICAgICAgIHRyYW5zLldyaXRlKHRlbXBCdWZmZXIsIDAsIGxlbiArIDEpOworICAgICAgICAgICAgfQogCi0JCQlpZiAoZXNjYXBlTnVtKQotCQkJCXRyYW5zLldyaXRlKFFVT1RFKTsKLQkJfQorICAgICAgICAgICAgdHJhbnMuV3JpdGUoUVVPVEUpOworICAgICAgICB9CiAKLQkJLy8vPHN1bW1hcnk+Ci0JCS8vLyBXcml0ZSBvdXQgYSBkb3VibGUgYXMgYSBKU09OIHZhbHVlLiBJZiBpdCBpcyBOYU4gb3IgaW5maW5pdHkgb3IgaWYgdGhlCi0JCS8vLyBjb250ZXh0IGRpY3RhdGVzIGVzY2FwaW5nLCBXcml0ZSBvdXQgYXMgSlNPTiBzdHJpbmcuCi0JCS8vLzwvc3VtbWFyeT4KLQkJcHJpdmF0ZSB2b2lkIFdyaXRlSlNPTkRvdWJsZShkb3VibGUgbnVtKQotCQl7Ci0JCQljb250ZXh0LldyaXRlKCk7Ci0JCQlTdHJpbmcgc3RyID0gbnVtLlRvU3RyaW5nKEN1bHR1cmVJbmZvLkludmFyaWFudEN1bHR1cmUpOwotCQkJYm9vbCBzcGVjaWFsID0gZmFsc2U7CisgICAgICAgIHByaXZhdGUgdm9pZCBXcml0ZUpTT05PYmplY3RTdGFydCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNvbnRleHQuV3JpdGUoKTsKKyAgICAgICAgICAgIHRyYW5zLldyaXRlKExCUkFDRSk7CisgICAgICAgICAgICBQdXNoQ29udGV4dChuZXcgSlNPTlBhaXJDb250ZXh0KHRoaXMpKTsKKyAgICAgICAgfQogCi0JCQlzd2l0Y2ggKHN0clswXSkKLQkJCXsKLQkJCQljYXNlICdOJzogLy8gTmFOCi0JCQkJY2FzZSAnSSc6IC8vIEluZmluaXR5Ci0JCQkJCXNwZWNpYWwgPSB0cnVlOwotCQkJCQlicmVhazsKLQkJCQljYXNlICctJzoKLQkJCQkJaWYgKHN0clsxXSA9PSAnSScpCi0JCQkJCXsgLy8gLUluZmluaXR5Ci0JCQkJCQlzcGVjaWFsID0gdHJ1ZTsKLQkJCQkJfQotCQkJCQlicmVhazsKLQkJCX0KKyAgICAgICAgcHJpdmF0ZSB2b2lkIFdyaXRlSlNPTk9iamVjdEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFBvcENvbnRleHQoKTsKKyAgICAgICAgICAgIHRyYW5zLldyaXRlKFJCUkFDRSk7CisgICAgICAgIH0KIAotCQkJYm9vbCBlc2NhcGVOdW0gPSBzcGVjaWFsIHx8IGNvbnRleHQuRXNjYXBlTnVtYmVycygpOworICAgICAgICBwcml2YXRlIHZvaWQgV3JpdGVKU09OQXJyYXlTdGFydCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNvbnRleHQuV3JpdGUoKTsKKyAgICAgICAgICAgIHRyYW5zLldyaXRlKExCUkFDS0VUKTsKKyAgICAgICAgICAgIFB1c2hDb250ZXh0KG5ldyBKU09OTGlzdENvbnRleHQodGhpcykpOworIC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ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgICAgIExpc3Q8Y2hhcj4gY29kZXVuaXRzID0gbmV3IExpc3Q8Y2hhcj4oKTsKIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUJ5dGUoc2J5dGUgYikKLQkJewotCQkJV3JpdGVKU09OSW50ZWdlcigobG9uZyliKTsKLQkJfQogCi0JCXB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlSTE2KHNob3J0IGkxNikKLQkJewotCQkJV3JpdGVKU09OSW50ZWdlcigobG9uZylpMTYpOwotCQl9CisgICAgICAgICAgICBpZiAoIXNraXBDb250ZXh0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNvbnRleHQuUmVhZCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgUmVhZEpTT05TeW50YXhDaGFyKFFVT1RFKTsKKyAgICAgICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJ5dGUgY2ggPSByZWFkZXIuUmVhZCgpOworICAgICAgICAgICAgICAgIGlmIChjaCA9PSBRVU9URVswXSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUkzMihpbnQgaTMyKQotCQl7Ci0JCQlXcml0ZUpTT05JbnRlZ2VyKChsb25nKWkzMik7Ci0JCX0KKyAgICAgICAgICAgICAgICAvLyBlc2NhcGVkPworICAgICAgICAgICAgICAgIGlmIChjaCAhPSBFU0NTRVFbMF0pCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBidWZmZXIuV3JpdGUobmV3IGJ5dGVbXSB7IChieXRlKWNoIH0sIDAsIDEpOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CiAKLQkJcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVJNjQobG9uZyBpNjQpCi0JCXsKLQkJCVdyaXRlSlNPTkludGVnZXIoaTY0KTsKLQkJfQorICAgICAgICAgICAgICAgIC8vIGRpc3Rpbmd1aXNoIGJldHdlZW4gXHVYWFhYIGFuZCBcPworICAgICAgICAgICAgICAgIGNoID0gcmVhZGVyLlJlYWQoKTsKKyAgICAgICAgICAgICAgICBpZiAoY2ggIT0gRVNDU0VRWzFdKSAgLy8gY29udHJvbCBjaGFycyBsaWtlIFxuCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpbnQgb2ZmID0gQXJyYXkuSW5kZXhPZihFU0NBUEVfQ0hBUlMsIChjaGFyKWNoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG9mZiA9PSAtMSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgY29udHJvbCBjaGFyIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgY2ggPSBFU0NBUEVfQ0hBUl9WQUxTW29mZl07CisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5Xcml0ZShuZXcgYnl0ZVtdIHsgKGJ5dGUpY2ggfSwgMCwgMSk7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZURvdWJsZShkb3VibGUgZHViKQotCQl7Ci0JCQlXcml0ZUpTT05Eb3VibGUoZHViKTsKLQkJfQogCi0JCXB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU3RyaW5nKFN0cmluZyBzdHIpCi0JCXsKLQkJCWJ5dGVbXSBiID0gdXRmOEVuY29kaW5nLkdldEJ5dGVzKHN0cik7Ci0JCQlXcml0ZUpTT05TdHJpbmcoYik7Ci0JCX0KKyAgICAgICAgICAgICAgICAvLyBpdCdzIFx1WFhYWAorICAgICAgICAgICAgICAgIHRyYW5zLlJlYWRBbGwodGVtcEJ1ZmZlciwgMCwgNCk7CisgICAgICAgICAgICAgICAgdmFyIHdjaCA9IChzaG9ydCkoKEhleFZhbCgoYnl0ZSl0ZW1wQnVmZmVyWzBdKSA8PCAxMikgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChIZXhWYWwoKGJ5dGUpdGVtcEJ1ZmZlclsxXSkgPDwgOCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChIZXhWYWwoKGJ5dGUpdGVtcEJ1ZmZlclsyXSkgPDwgNCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIZXhWYWwodGVtcEJ1ZmZlclszXSkpOworICAgICAgICAgICAgICAgIGlmIChDaGFyLklzSGlnaFN1cnJvZ2F0ZSgoY2hhcil3Y2gpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGV1bml0cy5Db3VudCA+IDApCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGxvdyBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNvZGV1bml0cy5BZGQoKGNoYXIpd2NoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoQ2hhci5Jc0xvd1N1cnJvZ2F0ZSgoY2hhcil3Y2gpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGV1bml0cy5Db3VudCA9PSAwKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBoaWdoIHN1cnJvZ2F0ZSBjaGFyIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgY29kZXVuaXRzLkFkZCgoY2hhcil3Y2gpOworICAgICAgICAgICAgICAgICAgICB2YXIgdG1wID0gdXRmOEVuY29kaW5nLkdldEJ5dGVzKGNvZGV1bml0cy5Ub0FycmF5KCkpOworICAgICAgICAgICAgICAgICAgICBidWZmZXIuV3JpdGUodG1wLCAwLCB0bXAuTGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgY29kZXVuaXRzLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciB0bXAgPSB1dGY4RW5jb2RpbmcuR2V0Qnl0ZXMobmV3IGNoYXJbXSB7IChjaGFyKXdjaCB9KTsKKyAgICAgICAgICAgICAgICAgICAgYnVmZmVyLldyaXRlKHRtcCwgMCwgdG1wLkxlbmd0aCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogCi0JCXB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlQmluYXJ5KGJ5dGVbXSBiaW4pCi0JCXsKLQkJCVdyaXRlSlNPTkJhc2U2NChiaW4pOwotCQl9CiAKLQkJLyoqCi0JCSAqIFJlYWRpbmcgbWV0aG9kcy4KLQkJICovCisgIC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Y2FzZSAoYnl0ZSknLic6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknMCc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknMSc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknMic6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknMyc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknNCc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknNSc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknNic6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknNyc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknOCc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknOSc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknRSc6CisgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSknZSc6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CiAKLQkJCWlmICghc2tpcENvbnRleHQpCi0JCQl7Ci0JCQkJY29udGV4dC5SZWFkKCk7Ci0JCQl9Ci0JCQlSZWFkSlNPTlN5bnRheENoYXIoUVVPVEUpOwotCQkJd2hpbGUgKHRydWUpCi0JCQl7Ci0JCQkJYnl0ZSBjaCA9IHJlYWRlci5SZWFkKCk7Ci0JCQkJaWYgKGNoID09IFFVT1RFWzBdKQotCQkJCXsKLQkJCQkJYnJlYWs7Ci0JCQkJfQotCQkJCWlmIChjaCA9PSBFU0NTRVFbMF0pCi0JCQkJewotCQkJCQljaCA9IHJlYWRlci5SZWFkKCk7Ci0JCQkJCWlmIChjaCA9PSBFU0NTRVFbMV0pCi0JCQkJCXsKLQkJCQkJCVJlYWRKU09OU3ludGF4Q2hhcihaRVJPKTsKLQkJCQkJCVJlYWRKU09OU3ludGF4Q2hhcihaRVJPKTsKLQkJC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QgaGF2ZSBoYWQgYSBxdW90ZSBpZiBlc2NhcGVOdW0gPT0gdHJ1ZQotCQkJCQlSZWFkSlNPTlN5bnRheENoYXIoUVVPVEUpOwotCQkJCX0KLQkJCQl0cnkKLQkJCQl7Ci0JCQkJCXJldHVybiBEb3VibGUuUGFyc2UoUmVhZEpTT05OdW1lcmljQ2hhcnMoKSk7Ci0JCQkJfQotCQkJCWNhdGNoIChGb3JtYXRFeGNlcHRpb24pCi0JCQkJewotCQkJCQl0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCi0JCQkJCQkJCQkJCQkgIkJhZCBkYXRhIGVuY291bnRlZCBpbiBudW1lcmljIGRhdGEiKTsKLQkJCQl9Ci0JCQl9Ci0JCX0KKyAgICAgICAgICAgICAgICBpZiAoIWNvbnRleHQuRXNjYXBlTnVtYmVycygpICYmICFEb3VibGUuSXNOYU4oZHViKSAmJiAhRG91YmxlLklzSW5maW5pdHkoZHViKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRocm93IGV4Y2VwdGlvbiAtLSB3ZSBzaG91bGQgbm90IGJlIGluIGEgc3RyaW5nIGluIHRoaXMgY2FzZQorICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk51bWVyaWMgZGF0YSB1bmV4cGVjdGVkbHkgcXVvdGVkIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBkdWI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGNvbnRleHQuRXNjYXBlTnVtYmVycygpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyB3aWxsIHRocm93IC0gd2Ugc2hvdWxkIGhhdmUgaGFkIGEgcXVvdGUgaWYgZXNjYXBlTnVtID09IHRydWUKKyAgICAgICAgICAgICAgICAgICAgUmVhZEpTT05TeW50YXhDaGFyKFFVT1RFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gRG91YmxlLlBhcnNlKFJlYWRKU09OTnVtZXJpY0NoYXJzKCksIEN1bHR1cmVJbmZvLkludmFyaWFudEN1bHR1cmUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoRm9ybWF0RXhjZXB0aW9uIGZleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIsIGZleCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJLy88c3VtbWFyeT4KLQkJLy8vIFJlYWQgaW4gYSBKU09OIHN0cmluZyBjb250YWluaW5nIGJhc2UtNjQgZW5jb2RlZCBkYXRhIGFuZCBkZWNvZGUgaXQuCi0JCS8vLzwvc3VtbWFyeT4KLQkJcHJpdmF0ZSBieXRlW10gUmVhZEpTT05CYXNlNjQoKQotCQl7Ci0JCQlieXRlW10gYiA9IFJlYWRKU09OU3RyaW5nKGZhbHNlKTsKLQkJCWludCBsZW4gPSBiLkxlbmd0aDsKLQkJCWludCBvZmYgPSAwOwotCQkJaW50IHNpemUgPSAwOwotCQkJd2hpbGUgKGxlbiA+PSA0KQotCQk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WFkSlNPTlN0cmluZyhmYWxzZSk7CisgICAgICAgICAgICBpbnQgbGVuID0gYi5MZW5ndGg7CisgICAgICAgICAgICBpbnQgb2ZmID0gMDsKKyAgICAgICAgICAgIGludCBzaXplID0gMDsKKyAgICAgICAgICAgIC8vIHJlZHVjZSBsZW4gdG8gaWdub3JlIGZpbGwgYnl0ZXMKKyAgICAgICAgICAgIHdoaWxlICgobGVuID4gMCkgJiYgKGJbbGVuIC0gMV0gPT0gJz0nKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAtLWxlbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIHJlYWQgJiBkZWNvZGUgZnVsbCBieXRlIHRyaXBsZXRzID0gNCBzb3VyY2UgYnl0ZXMKKyAgICAgICAgICAgIHdoaWxlIChsZW4gPiA0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIERlY29kZSA0IGJ5dGVzIGF0IGEgdGltZQorICAgICAgICAgICAgICAgIFRCYXNlNjRVdGlscy5kZWNvZGUoYiwgb2ZmLCA0LCBiLCBzaXplKTsgLy8gTkI6IGRlY29kZWQgaW4gcGxhY2UKKyAgICAgICAgICAgICAgICBvZmYgKz0gNDsKKyAgICAgICAgICAgICAgICBsZW4gLT0gNDsKKyAgICAgICAgICAgICAgICBzaXplICs9IDM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBEb24ndCBkZWNvZGUgaWYgd2UgaGl0IHRoZSBlbmQgb3IgZ290IGEgc2luZ2xlIGxlZnRvdmVyIGJ5dGUgKGludmFsaWQKKyAgICAgICAgICAgIC8vIGJhc2U2NCBidXQgbGVnYWwgZm9yIHNraXAgb2YgcmVndWxhciBzdHJpbmcgdHlwZSkKKyAgICAgICAgICAgIGlmIChsZW4gPiAxKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIERlY29kZSByZW1haW5kZXIKKyAgICAgICAgICAgICAgICBUQmFzZTY0VXRpbHMuZGVjb2RlKGIsIG9mZiwgbGVuLCBiLCBzaXplKTsgLy8gTkI6IGRlY29kZWQgaW4gcGxhY2UKKyAgICAgICAgICAgICAgICBzaXplICs9IGxlbiAtIDE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBTYWRseSB3ZSBtdXN0IGNvcHkgdGhlIGJ5dGVbXSAoYW55IHdheSBhcm91bmQgdGhpcz8pCisgICAgICAgICAgICBieXRlW10gcmVzdWx0ID0gbmV3IGJ5dGVbc2l6ZV07CisgICAgICAgICAgICBBcnJheS5Db3B5KGIsIDAsIHJlc3VsdCwgMCwgc2l6ZSk7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CiAKLQkJcHJpdmF0ZSB2b2lkIFJlYWRKU09OT2JqZWN0U3RhcnQoKQotCQl7Ci0JCQljb250ZXh0LlJlYWQoKTsKLQkJCVJlYWRKU09OU3ludGF4Q2hhcihMQlJBQ0UpOwotCQkJUHVzaENvbnRleHQobmV3IEpTT05QYWlyQ29udGV4dCh0aGlzKSk7Ci0JCX0KKyAgICAgICAgcHJpdmF0ZSB2b2lkIFJlYWRKU09OT2JqZWN0U3RhcnQoKQorICAgICAgICB7CisgICAgICAgICAgICBjb250ZXh0LlJlYWQoKTsKKyAgICAgICAgICAgIFJlYWRKU09OU3ludGF4Q2hhcihMQlJBQ0UpOworICAgICAgICAgICAgUHVzaENvbnRleHQobmV3IEpTT05QYWlyQ29udGV4dCh0aGlzKSk7CisgICAgICAgIH0KIAotCQlwcml2YXRlIHZvaWQgUmVhZEpTT05PYmplY3RFbmQoKQotCQl7Ci0JCQlSZWFkSlNPTlN5bnRheENoYXIoUkJSQUNFKTsKLQkJCVBvcENvbnRleHQoKTsKLQkJfQorICAgICAgICBwcml2YXRlIHZvaWQgUmVhZEpTT05PYmplY3RFbmQoKQorICAgICAgICB7CisgICAgICAgICAgICBSZWFkSlNPTlN5bnRheENoYXIoUkJSQUNFKTsKKyAgICAgICAgICAgIFBvcENvbnRleHQoKTsKKyAg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JCWVsc2UKLQkJCXsKLQkJCQlmaWVsZC5JRCA9IChzaG9ydClSZWFkSlNPTkludGVnZXIoKTsKLQkJCQlSZWFkSlNPTk9iamVjdFN0YXJ0KCk7Ci0JCQkJZmllbGQuVHlwZSA9IEdldFR5cGVJREZvclR5cGVOYW1lKFJlYWRKU09OU3RyaW5nKGZhbHNlKSk7Ci0JCQl9Ci0JCQlyZXR1cm4gZmllbGQ7Ci0JCX0KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIFRGaWVsZCBSZWFkRmllbGRCZWdpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIFRGaWVsZCBmaWVsZCA9IG5ldyBURmllbGQoKTsKKyAgICAgICAgICAgIGJ5dGUgY2ggPSByZWFkZXIuUGVlaygpOworICAgICAgICAgICAgaWYgKGNoID09IFJCUkFDRVswXSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaWVsZC5UeXBlID0gVFR5cGUuU3RvcDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaWVsZC5JRCA9IChzaG9ydClSZWFkSlNPTkludGVnZXIoKTsKKyAgICAgICAgICAgICAgICBSZWFkSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgICAgICAgICAgICAgZmllbGQuVHlwZSA9IEdldFR5cGVJREZvclR5cGVOYW1lKFJlYWRKU09OU3RyaW5nKGZhbHNlKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmllbGQ7CisgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkRmllbGRFbmQoKQotCQl7Ci0JCQlSZWFkSlNPTk9iamVjdEVuZCgpOwotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRGaWVsZEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFJlYWRKU09OT2JqZWN0RW5kKCk7CisgICAg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ZSwgVFR5cGUgdmFsdWVUeXBlLCBpbnQgY291bnQpCisgICAgICAgICAgICA6dGhpcygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRoaXMua2V5VHlwZSA9IGtleVR5cGU7CisgICAgICAgICAgICB0aGlzLnZhbHVlVHlwZSA9IHZhbHVlVHlwZTsKKyAgICAgICAgICAgIHRoaXMuY291bnQgPSBjb3VudDsKKyAgICAgICAgfQogCi0JCXB1YmxpYyBUVHlwZSBLZXlUeXBlCi0JCXsKLQkJCWdldCB7IHJldHVybiBrZXlUeXBlOyB9Ci0JCQlzZXQgeyBrZXlUeXBlID0gdmFsdWU7IH0KLQkJfQorICAgICAgICBwdWJsaWMgVFR5cGUgS2V5VHlwZQorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4ga2V5VHlwZTsgfQorICAgICAgICAgICAgc2V0IHsga2V5VHlwZSA9IHZhbHVlOyB9CisgICAgICAgIH0KIAotCQlwdWJsaWMgVFR5cGUgVmFsdWVUeXBlCi0JCXsKLQkJCWdldCB7IHJldHVybiB2YWx1ZVR5cGU7IH0KLQkJCXNldCB7IHZhbHVlVHlwZSA9IHZhbHVlOyB9Ci0JCX0KKyAgICAgICAgcHVibGljIFRUeXBlIFZhbHVlVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4gdmFsdWVUeXBlOyB9CisgICAgICAgICAgICBzZXQgeyB2YWx1ZVR5cGUgPSB2YWx1ZTsgfQorICAgICAgICB9CiAKLQkJcHVibGljIGludCBDb3VudAotCQl7Ci0JCQlnZXQgeyByZXR1cm4gY291bnQ7IH0KLQkJCXNldCB7IGNvdW50ID0gdmFsdWU7IH0KLQkJfQotCX0KKyAgICAgICAgcHVibGljIGludCBDb3VudAorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4gY291bnQ7IH0KKyAgICAgICAgICAgIHNldCB7IGNvdW50ID0gdmFsdWU7IH0KKyAgICAgICAgfQorICAgIH0KIH0KZ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gICAgICAgIHByb3RlY3RlZCBpbnQgcmVjdXJzaW9uRGVwdGg7CiAKLQkJcHVibGljIFRUcmFuc3BvcnQgVHJhbnNwb3J0Ci0JCXsKLQkJCWdldCB7IHJldHVybiB0cmFuczsgfQotCQl9CisgICAgICAgIHByb3RlY3RlZCBUUHJvdG9jb2woVFRyYW5zcG9ydCB0cmFucykKKyAgICAgICAgeworICAgICAgICAgICAgdGhpcy50cmFucyA9IHRyYW5zOworICAgICAgICAgICAgdGhpcy5yZWN1cnNpb25MaW1pdCA9IERFRkFVTFRfUkVDVVJTSU9OX0RFUFRIOworICAgICAgICAgICAgdGhpcy5yZWN1cnNpb25EZXB0aCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVFRyYW5zcG9ydCBUcmFuc3BvcnQKKyAgICAgICAgeworICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIHRyYW5zOyB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IFJlY3Vyc2lvbkxpbWl0CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldCB7IHJldHVybiByZWN1cnNpb25MaW1pdDsgfQorICAgICAgICAgICAgc2V0IHsgcmVjdXJzaW9uTGltaXQgPSB2YWx1ZTsgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgSW5jcmVtZW50UmVjdXJzaW9uRGVwdGgoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAocmVjdXJzaW9uRGVwdGggPCByZWN1cnNpb25MaW1pdCkKKyAgICAgICAgICAgICAgICArK3JlY3Vyc2lvbkRlcHRoOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLkRFUFRIX0xJTUlULCAiRGVwdGggbGltaXQgZXhjZWVkZWQiKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIERlY3JlbWVudFJlY3Vyc2lvbk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AgICB7DQotICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlU2V0RW5kKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUJvb2woYm9vbCBiKSAgDQotICAgICAgICB7DQotICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlQm9vbChiKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlQnl0ZShzYnl0ZSBiKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUJ5dGUoYik7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUkxNihzaG9ydCBpKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUkxNihpKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlSTMyKGludCBpKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUkzMihpKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlSTY0KGxvbmcgbCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVJNjQobCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZURvdWJsZShkb3VibGUgdikNCi0gICAgICAgIHsNCi0gICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVEb3VibGUodik7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZVN0cmluZyhTdHJpbmcgcykNCi0gICAgICAgIHs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DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkRmllbGRFbmQoKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5SZWFkRmllbGRFbmQoKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSBUTWFwIFJlYWRNYXBCZWdpbigpDQotICAgICAgICB7DQotICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkTWFwQmVnaW4oKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRNYXBFbmQoKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5SZWFkTWFwRW5kKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVExpc3QgUmVhZExpc3RCZWdpbigpDQotICAgICAgICB7DQotICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkTGlzdEJlZ2luKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkTGlzdEVuZCgpDQotICAgICAgICB7DQotICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLlJlYWRMaXN0RW5kKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgVFNldCBSZWFkU2V0QmVnaW4oKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZFNldEJlZ2luKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkU2V0RW5kKCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuUmVhZFNldEVuZCgpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgUmVhZEJvb2woKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZEJvb2woKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSBzYnl0ZSBSZWFkQnl0ZSgpDQotICAgICAgICB7DQotICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkQnl0ZSgpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIG92ZXJyaWRlIHNob3J0IFJlYWRJMTYoKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZEkxNigpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIG92ZXJyaWRlIGludCBSZWFkSTMyKCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICByZXR1cm4gV3JhcHBlZFByb3RvY29sLlJlYWRJMzIoKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSBsb25nIFJlYWRJNjQoKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZEk2NCgpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIG92ZXJyaWRlIGRvdWJsZSBSZWFkRG91YmxlKCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICByZXR1cm4gV3JhcHBlZFByb3RvY29sLlJlYWREb3VibGUoKTsNCi0gICAgICAgIH0NCi0NCi0gICAgICAgIHB1YmxpYyBvdmVycmlkZSBTdHJpbmcgUmVhZFN0cmluZygpDQotICAgICAgICB7DQotICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkU3RyaW5nKCk7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWM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BXcmFwcGVkUHJvdG9jb2wuV3JpdGVNZXNzYWdlRW5kKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZVN0cnVjdEJlZ2luKFRTdHJ1Y3QgdFN0cnVjdCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlU3RydWN0QmVnaW4odFN0cnVjdCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZVN0cnVjdEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZVN0cnVjdEVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVGaWVsZEJlZ2luKFRGaWVsZCB0RmllbGQpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUZpZWxkQmVnaW4odEZpZWxkKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlRmllbGRFbmQoKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVGaWVsZEVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVGaWVsZFN0b3AoKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVGaWVsZFN0b3AoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlTWFwQmVnaW4oVE1hcCB0TWFwKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVNYXBCZWdpbih0TWFwKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlTWFwRW5kKCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlTWFwRW5kKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUxpc3RCZWdpbihUTGlzdCB0TGlzdCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlTGlzdEJlZ2luKHRMaXN0KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlTGlzdEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUxpc3RFbmQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU2V0QmVnaW4oVFNldCB0U2V0KQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVTZXRCZWdpbih0U2V0KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlU2V0RW5kKCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlU2V0RW5kKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUJvb2woYm9vbCBiKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVCb29sKGIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVCeXRlKHNieXRlIGIpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZUJ5dGUoYik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUkxNihzaG9ydCBpKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVJMTYoaSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZUkzMihpbnQgaSkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlSTMyKGkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVJNjQobG9uZyBsKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuV3JpdGVJNjQobCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZURvdWJsZShkb3VibGUgdikKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlRG91YmxlKHYpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGVTdHJpbmcoc3RyaW5nIHMpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5Xcml0ZVN0cmluZyhzKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlQmluYXJ5KGJ5dGVbXSBieXRlcykKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLldyaXRlQmluYXJ5KGJ5dGVzKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUTWVzc2FnZSBSZWFkTWVzc2FnZUJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkTWVzc2FnZUJlZ2luKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkTWVzc2FnZUVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5SZWFkTWVzc2FnZUVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIFRTdHJ1Y3QgUmVhZFN0cnVjdEJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkU3RydWN0QmVnaW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRTdHJ1Y3RFbmQoKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuUmVhZFN0cnVjdEVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIFRGaWVsZCBSZWFkRmllbGRCZWdpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZEZpZWxkQmVnaW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRGaWVsZEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5SZWFkRmllbGRFbmQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUTWFwIFJlYWRNYXBCZWdpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZE1hcEJlZ2luKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkTWFwRW5kKCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JhcHBlZFByb3RvY29sLlJlYWRNYXBFbmQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUTGlzdCBSZWFkTGlzdEJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkTGlzdEJlZ2luKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBSZWFkTGlzdEVuZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyYXBwZWRQcm90b2NvbC5SZWFkTGlzdEVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIFRTZXQgUmVhZFNldEJlZ2luKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkU2V0QmVnaW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFJlYWRTZXRFbmQoKQorICAgICAgICB7CisgICAgICAgICAgICBXcmFwcGVkUHJvdG9jb2wuUmVhZFNldEVuZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgUmVhZEJvb2woKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gV3JhcHBlZFByb3RvY29sLlJlYWRCb29sKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgc2J5dGUgUmVhZEJ5dGUoKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gV3JhcHBlZFByb3RvY29sLlJlYWRCeXRlKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgc2hvcnQgUmVhZEkxNigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBXcmFwcGVkUHJvdG9jb2wuUmVhZEkxNigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGludCBSZWFkSTMyKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdyYXBwZWRQcm90b2NvbC5SZWFkSTMyKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgbG9uZyBSZWFkSTY0KCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIFdy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QVRJVkVfU0laRSA9IDI7Ci0JCXB1YmxpYyBjb25zdCBpbnQgU0laRV9MSU1JVCA9IDM7Ci0JCXB1YmxpYyBjb25zdCBpbnQgQkFEX1ZFUlNJT04gPSA0OwotCQlwdWJsaWMgY29uc3QgaW50IE5PVF9JTVBMRU1FTlRFRD0gNTsKKyAgICBwdWJsaWMgY2xhc3MgVFByb3RvY29sRXhjZXB0aW9uIDogVEV4Y2VwdGlvbgorICAgIHsKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBVTktOT1dOID0gMDsKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBJTlZBTElEX0RBVEEgPSAxOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IE5FR0FUSVZFX1NJWkUgPSAyOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IFNJWkVfTElNSVQgPSAzOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IEJBRF9WRVJTSU9OID0gNDsKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBOT1RfSU1QTEVNRU5URUQgPSA1OworICAgICAgICBwdWJsaWMgY29uc3QgaW50IERFUFRIX0xJTUlUID0gNjsKIAotCQlwcm90ZWN0ZWQgaW50IHR5cGVfID0gVU5LTk9XTjsKKyAgICAgICAgcHJvdGVjdGVkIGludCB0eXBlXyA9IFVOS05PV047CiAKLQkJcHVibGljIFRQcm90b2NvbEV4Y2VwdGlvbigpCi0JCQk6IGJhc2UoKQotCQl7Ci0JCX0KKyAgICAgICAgcHVibGljIFRQcm90b2NvbEV4Y2VwdGlvbigpCisgICAgICAgICAgICA6IGJhc2UoKQorICAgICAgICB7CisgICAgICAgIH0KIAotCQlwdWJsaWMgVFByb3RvY29sRXhjZXB0aW9uKGludCB0eXBlKQotCQkJOiBiYXNlKCkKLQkJewotCQkJdHlwZV8gPSB0eXBlOwotCQl9CisgICAgICAgIHB1YmxpYyBUUHJvdG9jb2xFeGNlcHRpb24oaW50IHR5cGUpCisgICAgICAgICAgICA6IGJhc2UoKQorIC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gICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5CeXRlOgorICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkQnl0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuSTE2OgorICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkSTE2KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5JMzI6CisgICAgICAgICAgICAgICAgICAgICAgICBwcm90LlJlYWRJMzIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkk2NDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3QuUmVhZEk2NCgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuRG91YmxlOgorICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkRG91YmxlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TdHJpbmc6CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCB0cnkgdG8gZGVjb2RlIHRoZSBzdHJpbmcsIGp1c3Qgc2tpcCBpdC4KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3QuUmVhZEJpbmFyeSgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuU3RydWN0OgorICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkU3RydWN0QmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRGaWVsZCBmaWVsZCA9IHByb3QuUmVhZEZpZWxkQmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQuVHlwZSA9PSBUVHlwZS5TdG9wKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNraXAocHJvdCwgZmllbGQuVHlwZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkRmllbGRFbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3QuUmVhZFN0cnVjdEVuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuTWFwOgorICAgICAgICAgICAgICAgICAgICAgICAgVE1hcCBtYXAgPSBwcm90LlJlYWRNYXBCZWdpbigpOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtYXAuQ291bnQ7IGkrKykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa2lwKHByb3QsIG1hcC5LZXlUeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa2lwKHByb3QsIG1hcC5WYWx1ZVR5cGUpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgcHJvdC5SZWFkTWFwRW5kKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TZXQ6CisgICAgICAgICAgICAgICAgICAgICAgICBUU2V0IHNldCA9IHByb3QuUmVhZFNldEJlZ2luKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNldC5Db3VudDsgaSsrKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNraXAocHJvdCwgc2V0LkVsZW1lbnRUeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3QuUmVhZFNldEVuZCgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuTGlzdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIFRMaXN0IGxpc3QgPSBwcm90LlJlYWRMaXN0QmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGlzdC5Db3VudDsgaSsrKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNraXAocHJvdCwgbGlzdC5FbGVtZW50VHlwZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBwcm90LlJlYWRMaXN0RW5kKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIlVua25vd24gZGF0YSB0eXBlICIgKyB0eXBlLlRvU3RyaW5nKCJkIikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZpbmFsbHkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBwcm90LkRlY3JlbWVudFJlY3Vyc2lvbkRlcHRoKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH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UUHJvY2Vzc29yIHByb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgIFRTZXJ2ZXJUcmFuc3BvcnQgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3RvcnkgdHJhbnNwb3J0RmFjdG9yeSkKKyAgICAgICAgICA6IHRoaXMocHJvY2Vzc29yLAorICAgICAgICAgICAgIHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICB0cmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgIHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgbmV3IFRCaW5hcnlQcm90b2NvbC5GYWN0b3J5KCksCisgICAgICAgICAgICAgbmV3IFRCaW5hcnlQcm90b2NvbC5GYWN0b3J5KCksCisgICAgICAgICAgICAgRGVmYXVsdExvZ0RlbGVnYXRlKQorICAgICAgICB7CisgICAgICAgIH0KIAotCQkvKioKLQkJICogRGVmYXVsdCBjb25zdHJ1Y3RvcnMuCi0JCSAqLworICAgICAgICBwdWJsaWMgVFNlcnZlcihUUHJvY2Vzc29yIHByb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgIFRTZXJ2ZXJUcmFuc3BvcnQgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3RvcnkgdHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEZhY3RvcnkgcHJvdG9jb2xGYWN0b3J5KQorICAgICAgICAgIDogdGhpcyhwcm9jZXNzb3IsCisgICAgICAgICAgICAgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgIHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgdHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICBwcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgcHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgRGVmYXVsdExv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AgICAgdXNpbmcoY2xpZW50ID0gc2VydmVyVHJhbnNwb3J0LkFjY2VwdCgpKQotICAgICAgICAgIHsKLSAgICAgICAgICAgIGlmIChjbGllbnQgIT0gbnVsbCkKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgU2VydmUoKQorICAgICAgICB7CisgICAgICAgICAgICB0cnkKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgdXNpbmcoaW5wdXRUcmFuc3BvcnQgPSBpbnB1dFRyYW5zcG9ydEZhY3RvcnkuR2V0VHJhbnNwb3J0KGNsaWVudCkpCi0gICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICB1c2luZyAob3V0cHV0VHJhbnNwb3J0ID0gb3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5HZXRUcmFuc3BvcnQoY2xpZW50KSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sID0gaW5wdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2woaW5wdXRUcmFuc3BvcnQpOwotICAgICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2wgPSBvdXRwdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2wob3V0cHV0VHJhbnNwb3J0KTsKLSAgICAgICAgICAgICAgICAgIHdoaWxlIChwcm9jZXNzb3IuUHJvY2VzcyhpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCkpIHsgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNlcnZlclRyYW5zcG9ydC5MaXN0ZW4oKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24gdHR4KQotICAgICAgICB7Ci0gICAgICAgICAgLy8gQ2xpZW50IGRpZWQsIGp1c3QgbW92ZSBvbgotICAgICAgICAgIGlmICh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KLQkJewotCQkJc3RvcCA9IHRydWU7Ci0JCQlzZXJ2ZXJUcmFuc3BvcnQuQ2xvc2UoKTsKLQkJfQotCX0KKyAgICAgICAgICAgIHdoaWxlICghc3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBUUHJvY2Vzc29yIHByb2Nlc3NvciA9IG51bGw7CisgICAgICAgICAgICAgICAgVFRyYW5zcG9ydCBjbGllbnQgPSBudWxsOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgaW5wdXRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgb3V0cHV0VHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgICAgICAgICBUUHJvdG9jb2wgaW5wdXRQcm90b2NvbCA9IG51bGw7CisgICAgICAgICAgICAgICAgVFByb3RvY29sIG91dHB1dFByb3RvY29sID0gbnVsbDsKKyAgICAgICAgICAgICAgICBvYmplY3QgY29ubmVjdGlvbkNvbnRleHQgPSBudWxsOworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdXNpbmcgKGNsaWVudCA9IHNlcnZlclRyYW5zcG9ydC5BY2NlcHQoKSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc29yID0gcHJvY2Vzc29yRmFjdG9yeS5HZXRQcm9jZXNzb3IoY2xpZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbGllbnQgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2luZyAoaW5wdXRUcmFuc3BvcnQgPSBpbnB1dFRyYW5zcG9ydEZhY3RvcnkuR2V0VHJhbnNwb3J0KGNsaWVudCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2luZyAob3V0cHV0VHJhbnNwb3J0ID0gb3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5HZXRUcmFuc3BvcnQoY2xpZW50KSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbCA9IGlucHV0UHJvdG9jb2xGYWN0b3J5LkdldFByb3RvY29sKGlucHV0VHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sID0gb3V0cHV0UHJvdG9jb2xGYWN0b3J5LkdldFByb3RvY29sKG91dHB1dFRyYW5zcG9ydCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vUmVjb3ZlciBldmVudCBoYW5kbGVyIChpZiBhbnkpIGFuZCBmaXJlIGNyZWF0ZUNvbnRleHQgc2VydmVyIGV2ZW50IHdoZW4gYSBjbGllbnQgY29ubmVjdHMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uQ29udGV4dCA9IHNlcnZlckV2ZW50SGFuZGxlci5jcmVhdGVDb250ZXh0KGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY29sKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9Qcm9jZXNzIGNsaWVudCByZXF1ZXN0cyB1bnRpbCBjbGllbnQgZGlzY29ubmVjdHMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICghc3RvcCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlucHV0VHJhbnNwb3J0LlBlZWsoKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL0ZpcmUgcHJvY2Vzc0NvbnRleHQgc2VydmVyIGV2ZW50CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9OLkIuIFRoaXMgaXMgdGhlIHBhdHRlcm4gaW1wbGVtZW50ZWQgaW4gQysrIGFuZCB0aGUgZXZlbnQgZmlyZXMgcHJvdmlzaW9uYWxseS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL1RoYXQgaXMgdG8gc2F5IGl0IG1heSBiZSBtYW55IG1pbnV0ZXMgYmV0d2VlbiB0aGUgZXZlbnQgZmlyaW5nIGFuZCB0aGUgY2xpZW50IHJlcXVlc3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2FjdHVhbGx5IGFycml2aW5nIG9yIHRoZSBjbGllbnQgbWF5IGhhbmcgdXAgd2l0aG91dCBldmVyIG1ha2VpbmcgYSByZXF1ZXN0LgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyLnByb2Nlc3NDb250ZXh0KGNvbm5lY3Rpb25Db250ZXh0LCBpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9Qcm9jZXNzIGNsaWVudCByZXF1ZXN0IChibG9ja3MgdW50aWwgdHJhbnNwb3J0IGlzIHJlYWRhYmxlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcHJvY2Vzc29yLlByb2Nlc3MoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiB0dHgpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoIXN0b3AgfHwgdHR4LlR5cGUgIT0gVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkludGVycnVwdGVkKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBsb2dEZWxlZ2F0ZSh0dHguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiB4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy9VbmV4cGVjdGVkCisgICAgICAgICAgICAgICAgICAgIGxvZ0RlbGVnYXRlKHguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy9GaXJlIGRlbGV0ZUNvbnRleHQgc2VydmVyIGV2ZW50IGFmdGVyIGNsaWVudCBkaXNjb25uZWN0cworICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyLmRlbGV0ZUNvbnRleHQoY29ubmVjdGlvbkNvbnRleHQsIGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY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RFMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTWluV29ya2VyVGhyZWFkcyA9IG1pbjsKKyAgICAgICAgICAgICAgICBNYXhXb3JrZXJUaHJlYWRzID0gbWF4OworICAgICAgICAgICAgICAgIE1pbklPVGhyZWFkcyA9IG1pbjsKKyAgICAgICAgICAgICAgICBNYXhJT1RocmVhZHMgPSBtYXg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBDb25maWd1cmF0aW9uKGludCBtaW5Xb3JrLCBpbnQgbWF4V29yaywgaW50IG1pbklPLCBpbnQgbWF4SU8pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTWluV29ya2VyVGhyZWFkcyA9IG1pbldvcms7CisgICAgICAgICAgICAgICAgTWF4V29ya2VyVGhyZWFkcyA9IG1heFdvcms7CisgICAgICAgICAgICAgICAgTWluSU9UaHJlYWRzID0gbWluSU87CisgICAgICAgICAgICAgICAgTWF4SU9UaHJlYWRzID0gbWF4SU87CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgaWYgKCFUaHJlYWRQb29sLlNldE1heFRocmVhZHMobWF4VGhyZWFkUG9vbFRocmVhZHMsIG1heFRocmVhZFBvb2xUaHJlYWRzKSkKKworICAgICAgICBwdWJsaWMgVFRocmVhZFBvb2xTZXJ2ZXIoVFByb2Nlc3NvciBwcm9jZXNzb3IsIFRTZXJ2ZXJUcmFuc3BvcnQgc2VydmVyVHJhbnNwb3J0KQorICAgICAgICAgICAgOiB0aGlzKG5ldyBUU2luZ2xldG9uUHJvY2Vzc29yRmFjdG9yeShwcm9jZXNzb3IpLCBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgbmV3IFRUcmFuc3BvcnRGYWN0b3J5KCksIG5ldyBUVHJhbnNwb3J0RmFjdG9yeSgpLAorICAgICAgICAgICAgIG5ldyBUQmluYXJ5UHJvdG9jb2wuRmFjdG9yeSgpLCBuZXcgVEJpbmFyeVByb3RvY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29yRmFjdG9yeShwcm9jZXNzb3IpLCBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgICB0cmFuc3BvcnRGYWN0b3J5LCB0cmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgcHJvdG9jb2xGYWN0b3J5LCBwcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICBuZXcgQ29uZmlndXJhdGlvbigpLCBEZWZhdWx0TG9nRGVsZWdhdGUpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUVGhyZWFkUG9vbFNlcnZlcihUUHJvY2Vzc29yRmFjdG9yeSBwcm9jZXNzb3JGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgVFNlcnZlclRyYW5zcG9ydCBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICBUVHJhbnNwb3J0RmFjdG9yeSB0cmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRmFjdG9yeSBwcm90b2NvbEZhY3RvcnkpCisgICAgICAgICAgICA6IHRoaXMocHJvY2Vzc29yRmFjdG9yeSwgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgIHRyYW5zcG9ydEZhY3RvcnksIHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgcHJvdG9jb2xGYWN0b3J5LCBwcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgbmV3IENvbmZpZ3VyYXRpb24oKSwgRGVmYXVsdExvZ0RlbGVnYXRlKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVFRocmVhZFBvb2xTZXJ2ZXIoVFByb2Nlc3NvckZhY3RvcnkgcHJvY2Vzc29yRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIFRTZXJ2ZXJUcmFuc3BvcnQgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3RvcnkgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3Rvcnkgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEZhY3RvcnkgaW5wdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IG91dHB1dFByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIGludCBtaW5UaHJlYWRQb29sVGhyZWFkcywgaW50IG1heFRocmVhZFBvb2xUaHJlYWRzLCBMb2dEZWxlZ2F0ZSBsb2dEZWwpCisgICAgICAgICAgICA6IHRoaXMocHJvY2Vzc29yRmFjdG9yeSwgc2VydmVyVHJhbnNwb3J0LCBpbnB1dFRyYW5zcG9ydEZhY3RvcnksIG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksIG91dHB1dFByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICBuZXcgQ29uZmlndXJhdGlvbihtaW5UaHJlYWRQb29sVGhyZWFkcywgbWF4VGhyZWFkUG9vbFRocmVhZHMpLAorICAgICAgICAgICAgIGxvZ0RlbCkKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRUaHJlYWRQb29sU2VydmVyKFRQcm9jZXNzb3JGYWN0b3J5IHByb2Nlc3NvckZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUU2VydmVyVHJhbnNwb3J0IHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IGlucHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IGlucHV0UHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRmFjdG9yeSBvdXRwdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBDb25maWd1cmF0aW9uIHRocmVhZENvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgIExvZ0RlbGVnYXRlIGxvZ0RlbCkKKyAgICAgICAgICAgIDogYmFzZShwcm9jZXNzb3JGYWN0b3J5LCBzZXJ2ZXJUcmFuc3BvcnQsIGlucHV0VHJhbnNwb3J0RmFjdG9yeSwgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgIGlucHV0UHJvdG9jb2xGYWN0b3J5LCBvdXRwdXRQcm90b2NvbEZhY3RvcnksIGxvZ0RlbCkKKyAgICAgICAgeworICAgICAgICAgICAgbG9jayAodHlwZW9mKFRUaHJlYWRQb29sU2VydmVyKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoKHRocmVhZENvbmZpZy5NYXhXb3JrZXJUaHJlYWRzID4gMCkgfHwgKHRocmVhZENvbmZpZy5NYXhJT1RocmVhZHMgPiAwKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGludCB3b3JrLCBjb21tOworICAgICAgICAgICAgICAgICAgICBUaHJlYWRQb29sLkdldE1heFRocmVhZHMob3V0IHdvcmssIG91dCBjb21tKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRocmVhZENvbmZpZy5NYXhXb3JrZXJUaHJlYWRzID4gMCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHdvcmsgPSB0aHJlYWRDb25maWcuTWF4V29ya2VyVGhyZWFkczsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRocmVhZENvbmZpZy5NYXhJT1RocmVhZHMgPiAwKQorICAgICAgICAgICAgICAgICAgICAgICAgY29tbSA9IHRocmVhZENvbmZpZy5NYXhJT1RocmVhZHM7CisgICAgICAgICAgICAgICAgICAgIGlmICghVGhyZWFkUG9vbC5TZXRNYXhUaHJlYWRzKHdvcmssIGNvbW0pKQorICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiRXJyb3I6IGNvdWxkIG5vdCBTZXRNYXhUaHJlYWRzIGluIFRocmVhZFBvb2wiKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoKHRocmVhZENvbmZpZy5NaW5Xb3JrZXJUaHJlYWRzID4gMCkgfHwgKHRocmVhZENvbmZpZy5NaW5JT1RocmVhZHMgPiAwKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGludCB3b3JrLCBjb21tOworICAgICAgICAgICAgICAgICAgICBUaHJlYWRQb29sLkdldE1pblRocmVhZHMob3V0IHdvcmssIG91dCBjb21tKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRocmVhZENvbmZpZy5NaW5Xb3JrZXJUaHJlYWRzID4gMCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHdvcmsgPSB0aHJlYWRDb25maWcuTWluV29ya2VyVGhyZWFkczsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRocmVhZENvbmZpZy5NaW5JT1RocmVhZHMgPiAwKQorICAgICAgICAgICAgICAgICAgICAgICAgY29tbSA9IHRocmVhZENvbmZpZy5NaW5JT1RocmVhZHM7CisgICAgICAgICAgICAgICAgICAgIGlmICghVGhyZWFkUG9vbC5TZXRNaW5UaHJlYWRzKHdvcmssIGNvbW0pKQorICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiRXJyb3I6IGNvdWxkIG5vdCBTZXRNaW5UaHJlYWRzIGluIFRocmVhZFBvb2wiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAogCi0JCS8vLyA8c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ICIgKyB4KTsKLQkJCX0KKyAgICAgICAgICAgIGlmIChzdG9wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc2VydmVyVHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uIHR0eCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGxvZ0RlbGVnYXRlKCJUU2VydmVyVHJhbnNwb3J0IGZhaWxlZCBvbiBjbG9zZTogIiArIHR0eC5NZXNzYWdlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3RvcCA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJCWlmIChpbnB1dFRyYW5zcG9ydCAhPSBudWxsKQotCQkJewotCQkJCWlucHV0VHJhbnNwb3J0LkNsb3NlKCk7Ci0JCQl9Ci0JCQlpZiAob3V0cHV0VHJhbnNwb3J0ICE9IG51bGwpCi0JCQl7Ci0JCQkJb3V0cHV0VHJhbnNwb3J0LkNsb3NlKCk7Ci0JCQl9Ci0JCX0KKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gTG9vcHMgb24gcHJvY2Vzc2luZyBhIGNsaWVudCBmb3JldmVyCisgICAgICAgIC8vLyB0aHJlYWRDb250ZXh0IHdpbGwgYmUgYSBUVHJhbnNwb3J0IGluc3RhbmNlCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIC8vLyA8cGFyYW0gbmFtZT0idGhyZWFkQ29udGV4dCI+PC9wYXJhbT4KKyAgICAgICAgcHJpdmF0ZSB2b2lkIEV4ZWN1dGUob2JqZWN0IHRocmVhZENvbnRleHQpCisgICAgICAgIHsKKyAgICAgICAgICAgIHVzaW5nIChUVHJhbnNwb3J0IGNsaWVudCA9IChUVHJhbnNwb3J0KXRocmVhZENvbnRleHQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgVFByb2Nlc3NvciBwcm9jZXNzb3IgPSBwcm9jZXNzb3JGYWN0b3J5LkdldFByb2Nlc3NvcihjbGllbnQsIHRoaXMpOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgaW5wdXRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgb3V0cHV0VHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgICAgICAgICBUUHJvdG9jb2wgaW5wdXRQcm90b2NvbCA9IG51bGw7CisgICAgICAgICAgICAgICAgVFByb3RvY29sIG91dHB1dFByb3RvY29sID0gbnVsbDsKKyAgICAgICAgICAgICAgICBvYmplY3QgY29ubmVjdGlvbkNvbnRleHQgPSBudWxsOworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0VHJhbnNwb3J0ID0gaW5wdXRUcmFuc3BvcnRGYWN0b3J5LkdldFRyYW5zcG9ydChjbGllbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0ID0gb3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5HZXRUcmFuc3BvcnQoY2xpZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2wgPSBpbnB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbCA9IG91dHB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChvdXRwdXRUcmFuc3BvcnQpOwogCi0JCXB1YmxpYyBvdmVycmlkZSB2b2lkIFN0b3AoKQotCQl7Ci0JCQlzdG9wID0gdHJ1ZTsKLQkJCXNlcnZlclRyYW5zcG9ydC5DbG9zZSgpOwotCQl9Ci0JfQorICAgICAgICAgICAgICAgICAgICAgICAgLy9SZWNvdmVyIGV2ZW50IGhhbmRsZXIgKGlmIGFueSkgYW5kIGZpcmUgY3JlYXRlQ29udGV4dCBzZXJ2ZXIgZXZlbnQgd2hlbiBhIGNsaWVudCBjb25uZWN0cworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb25Db250ZXh0ID0gc2VydmVyRXZlbnRIYW5kbGVyLmNyZWF0ZUNvbnRleHQoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvL1Byb2Nlc3MgY2xpZW50IHJlcXVlc3RzIHVudGlsIGNsaWVudCBkaXNjb25uZWN0cworICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKCFzdG9wKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaW5wdXRUcmFuc3BvcnQuUGVlaygpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vRmlyZSBwcm9jZXNzQ29udGV4dCBzZXJ2ZXIgZXZlbnQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL04uQi4gVGhpcyBpcyB0aGUgcGF0dGVybiBpbXBsZW1lbnRlZCBpbiBDKysgYW5kIHRoZSBldmVudCBmaXJlcyBwcm92aXNpb25hbGx5LgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vVGhhdCBpcyB0byBzYXkgaXQgbWF5IGJlIG1hbnkgbWludXRlcyBiZXR3ZWVuIHRoZSBldmVudCBmaXJpbmcgYW5kIHRoZSBjbGllbnQgcmVxdWVzdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vYWN0dWFsbHkgYXJyaXZpbmcgb3IgdGhlIGNsaWVudCBtYXkgaGFuZyB1cCB3aXRob3V0IGV2ZXIgbWFrZWluZyBhIHJlcXVlc3QuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJFdmVudEhhbmRsZXIucHJvY2Vzc0NvbnRleHQoY29ubmVjdGlvbkNvbnRleHQsIGlucHV0VHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL1Byb2Nlc3MgY2xpZW50IHJlcXVlc3QgKGJsb2NrcyB1bnRpbCB0cmFuc3BvcnQgaXMgcmVhZGFibGUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFwcm9jZXNzb3IuUHJvY2VzcyhpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvL1VzdWFsbHkgYSBjbGllbnQgZGlzY29ubmVjdCwgZXhwZWN0ZWQKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIHgpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vVW5leHBlY3RlZAorICAgICAgICAgICAgICAgICAgICAgICAgbG9nRGVsZWdhdGUoIkVycm9yOiAiICsgeCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvL0ZpcmUgZGVsZXRlQ29udGV4dCBzZXJ2ZXIgZXZlbnQgYWZ0ZXIgY2xpZW50IGRpc2Nvbm5lY3RzCisgICAgICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlckV2ZW50SGFuZGxlci5kZWxldGVDb250ZXh0KGNvbm5lY3Rpb25Db250ZXh0LCBpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCk7CisKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy9DbG9zZSB0cmFuc3BvcnRzCisgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dFRyYW5zcG9ydCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRUcmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dFRyYW5zcG9ydCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0LkNsb3NlKCk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gZGlzcG9zYWJsZSBzdHVmZiBzaG91bGQgYmUgZGlzcG9zZWQKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0UHJvdG9jb2wgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2wuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0UHJvdG9jb2wgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0VHJhbnNwb3J0ICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dFRyYW5zcG9ydC5EaXNwb3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vciBwcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICBUU2VydmVyVHJhbnNwb3J0IHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IHByb3RvY29sRmFjdG9yeSkKKyAgICAgICAgICAgIDogdGhpcyhuZXcgVFNpbmdsZXRvblByb2Nlc3NvckZhY3RvcnkocHJvY2Vzc29yKSwgc2VydmVyVHJhbnNwb3J0LAorICAgICAgICAgICAgIHRyYW5zcG9ydEZhY3RvcnksIHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgcHJvdG9jb2xGYWN0b3J5LCBwcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgREVGQVVMVF9NQVhfVEhSRUFEUywgRGVmYXVsdExvZ0RlbGVnYXRlKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVFRocmVhZGVkU2VydmVyKFRQcm9jZXNzb3JGYWN0b3J5IHByb2Nlc3NvckZhY3RvcnksCisgICAgICAgICAgICAgICBUU2VydmVyVHJhbnNwb3J0IHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IHRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IHByb3RvY29sRmFjdG9yeSkKKyAgICAgICAgICAgIDogdGhpcyhwcm9jZXNzb3JGYWN0b3J5LCBzZXJ2ZXJUcmFuc3BvcnQsCisgICAgICAgICAgICAgdHJhbnNwb3J0RmFjdG9yeSwgdHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICBwcm90b2NvbEZhY3RvcnksIHByb3RvY29sRmFjdG9yeSwKKyAgICAgICAgICAgICBERUZBVUxUX01BWF9USFJFQURTLCBEZWZhdWx0TG9nRGVsZWdhdGUpCisgICAgICAgIHsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgVFRocmVhZGVkU2VydmVyKFRQcm9jZXNzb3JGYWN0b3J5IHByb2Nlc3NvckZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUU2VydmVyVHJhbnNwb3J0IHNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IGlucHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRGYWN0b3J5IG91dHB1dFRyYW5zcG9ydEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IGlucHV0UHJvdG9jb2xGYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRmFjdG9yeSBvdXRwdXRQcm90b2NvbEZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgICBpbnQgbWF4VGhyZWFkcywgTG9nRGVsZWdhdGUgbG9nRGVsKQorICAgICAgICAgIDogYmFzZShwcm9jZXNzb3JGYWN0b3J5LCBzZXJ2ZXJUcmFuc3BvcnQsIGlucHV0VHJhbnNwb3J0RmFjdG9yeSwgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSwKKyAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksIG91dHB1dFByb3RvY29sRmFjdG9yeSwgbG9nRGVsKQorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLm1heFRocmVhZHMgPSBtYXhUaHJlYWRzOworICAgICAgICAgICAgY2xpZW50UXVldWUgPSBuZXcgUXVldWU8VFRyYW5zcG9ydD4oKTsKKyAgICAgICAgICAgIGNsaWVudExvY2sgPSBuZXcgb2JqZWN0KCk7CisgICAgICAgICAgICBjbGllbnRUaHJlYWRzID0gbmV3IFRIYXNoU2V0PFRocmVhZD4oKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIFVzZSBuZXcgVGhyZWFkIGZvciBlYWNoIG5ldyBjbGllbnQgY29ubmVjdGlvbi4gYmxvY2sgdW50aWwgbnVtQ29ubmVjdGlvbnMgJmx0OyBtYXhUaHJlYWRzLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBTZXJ2ZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vc3RhcnQgd29ya2VyIHRocmVhZAorICAgICAgICAgICAgICAgIHdvcmtlclRocmVhZCA9IG5ldyBUaHJlYWQobmV3IFRocmVhZFN0YXJ0KEV4ZWN1dGUpKTsKKyAgICAgICAgICAgICAgICB3b3JrZXJUaHJlYWQuU3RhcnQoKTsKKyAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQuTGlzdGVuKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiB0dHgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nRGVsZWdhdGUoIkVycm9yLCBjb3VsZCBub3QgbGlzdGVuIG9uIFNlcnZlclRyYW5zcG9ydDogIiArIHR0eCk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvL0ZpcmUgdGhlIHByZVNlcnZlIHNlcnZlciBldmVudCB3aGVuIHNlcnZlciBpcyB1cCBidXQgYmVmb3JlIGFueSBjbGllbnQgY29ubmVjdGlvbnMKKyAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICBzZXJ2ZXJFdmVudEhhbmRsZXIucHJlU2VydmUoKTsKKworICAgICAgICAgICAgd2hpbGUgKCFzdG9wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGludCBmYWlsdXJlQ291bnQgPSAwOworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgVFRyYW5zcG9ydCBjbGllbnQgPSBzZXJ2ZXJUcmFuc3BvcnQuQWNjZXB0KCk7CisgICAgICAgICAgICAgICAgICAgIGxvY2sgKGNsaWVudExvY2spCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFF1ZXVlLkVucXVldWUoY2xpZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIE1vbml0b3IuUHVsc2UoY2xpZW50TG9jayk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24gdHR4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFzdG9wIHx8IHR0eC5UeXBlICE9IFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5JbnRlcnJ1cHRlZCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgKytmYWlsdXJlQ291bnQ7CisgICAgICAgICAgICAgICAgICAgICAgICBsb2dEZWxlZ2F0ZSh0dHguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHN0b3ApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24gdHR4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgbG9nRGVsZWdhdGUoIlRTZXJ2ZVRyYW5zcG9ydCBmYWlsZWQgb24gY2xvc2U6ICIgKyB0dHguTWVzc2FnZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHN0b3AgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIExvb3BzIG9uIHByb2Nlc3NpbmcgYSBjbGllbnQgZm9yZXZlcgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIHZvaWQgRXhlY3V0ZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIHdoaWxlICghc3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBUVHJhbnNwb3J0IGNsaWVudDsKKyAgICAgICAgICAgICAgICBUaHJlYWQgdDsKKyAgICAgICAgICAgICAgICBsb2NrIChjbGllbnRMb2NrKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy9kb24ndCBkZXF1ZXVlIGlmIHRvbyBtYW55IGNvbm5lY3Rpb25zCisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjbGllbnRUaHJlYWRzLkNvdW50ID49IG1heFRocmVhZHMpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIE1vbml0b3IuV2FpdChjbGllbnRMb2NrKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjbGllbnRRdWV1ZS5Db3VudCA9PSAwKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBNb25pdG9yLldhaXQoY2xpZW50TG9jayk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBjbGllbnQgPSBjbGllbnRRdWV1ZS5EZXF1ZXVlKCk7CisgICAgICAgICAgICAgICAgICAgIHQgPSBuZXcgVGhyZWFkKG5ldyBQYXJhbWV0ZXJpemVkVGhyZWFkU3RhcnQoQ2xpZW50V29ya2VyKSk7CisgICAgICAgICAgICAgICAgICAgIGNsaWVudFRocmVhZHMuQWRkKHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvL3N0YXJ0IHByb2Nlc3NpbmcgcmVxdWVzdHMgZnJvbSBjbGllbnQgb24gbmV3IHRocmVhZAorICAgICAgICAgICAgICAgIHQuU3RhcnQoY2xpZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBDbGllbnRXb3JrZXIob2JqZWN0IGNvbnRleHQpCisgICAgICAgIHsKKyAgICAgICAgICAgIHVzaW5nIChUVHJhbnNwb3J0IGNsaWVudCA9IChUVHJhbnNwb3J0KWNvbnRleHQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgVFByb2Nlc3NvciBwcm9jZXNzb3IgPSBwcm9jZXNzb3JGYWN0b3J5LkdldFByb2Nlc3NvcihjbGllbnQpOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgaW5wdXRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgb3V0cHV0VHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgICAgICAgICBUUHJvdG9jb2wgaW5wdXRQcm90b2NvbCA9IG51bGw7CisgICAgICAgICAgICAgICAgVFByb3RvY29sIG91dHB1dFByb3RvY29sID0gbnVsbDsKKyAgICAgICAgICAgICAgICBvYmplY3QgY29ubmVjdGlvbkNvbnRleHQgPSBudWxsOworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0VHJhbnNwb3J0ID0gaW5wdXRUcmFuc3BvcnRGYWN0b3J5LkdldFRyYW5zcG9ydChjbGllbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0ID0gb3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5HZXRUcmFuc3BvcnQoY2xpZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2wgPSBpbnB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbCA9IG91dHB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChvdXRwdXRUcmFuc3BvcnQpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvL1JlY292ZXIgZXZlbnQgaGFuZGxlciAoaWYgYW55KSBhbmQgZmlyZSBjcmVhdGVDb250ZXh0IHNlcnZlciBldmVudCB3aGVuIGEgY2xpZW50IGNvbm5lY3RzCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VydmVyRXZlbnRIYW5kbGVyICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbkNvbnRleHQgPSBzZXJ2ZXJFdmVudEhhbmRsZXIuY3JlYXRlQ29udGV4dChpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vUHJvY2VzcyBjbGllbnQgcmVxdWVzdHMgdW50aWwgY2xpZW50IGRpc2Nvbm5lY3RzCisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoIXN0b3ApCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpbnB1dFRyYW5zcG9ydC5QZWVrKCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9GaXJlIHByb2Nlc3NDb250ZXh0IHNlcnZlciBldmVudAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vTi5CLiBUaGlzIGlzIHRoZSBwYXR0ZXJuIGltcGxlbWVudGVkIGluIEMrKyBhbmQgdGhlIGV2ZW50IGZpcmVzIHByb3Zpc2lvbmFsbHkuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9UaGF0IGlzIHRvIHNheSBpdCBtYXkgYmUgbWFueSBtaW51dGVzIGJldHdlZW4gdGhlIGV2ZW50IGZpcmluZyBhbmQgdGhlIGNsaWVudCByZXF1ZXN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9hY3R1YWxseSBhcnJpdmluZyBvciB0aGUgY2xpZW50IG1heSBoYW5nIHVwIHdpdGhvdXQgZXZlciBtYWtlaW5nIGEgcmVxdWVzdC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VydmVyRXZlbnRIYW5kbGVyICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlckV2ZW50SGFuZGxlci5wcm9jZXNzQ29udGV4dChjb25uZWN0aW9uQ29udGV4dCwgaW5wdXRUcmFuc3BvcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vUHJvY2VzcyBjbGllbnQgcmVxdWVzdCAoYmxvY2tzIHVudGlsIHRyYW5zcG9ydCBpcyByZWFkYWJsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXByb2Nlc3Nvci5Qcm9jZXNzKGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY29sKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24pCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vVXN1YWxseSBhIGNsaWVudCBkaXNjb25uZWN0LCBleHBlY3RlZAorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24geCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgLy9VbmV4cGVjdGVkCisgICAgICAgICAgICAgICAgICAgICAgICBsb2dEZWxlZ2F0ZSgiRXJyb3I6ICIgKyB4KTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vRmlyZSBkZWxldGVDb250ZXh0IHNlcnZlciBldmVudCBhZnRlciBjbGllbnQgZGlzY29ubmVjdHMKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyLmRlbGV0ZUNvbnRleHQoY29ubmVjdGlvbkNvbnRleHQsIGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY29sKTsKKworICAgICAgICAgICAgICAgICAgICBsb2NrIChjbGllbnRMb2NrKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRUaHJlYWRzLlJlbW92ZShUaHJlYWQuQ3VycmVudFRocmVhZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBNb25pdG9yLlB1bHNlKGNsaWVudExvY2spOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy9DbG9zZSB0cmFuc3BvcnRzCisgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dFRyYW5zcG9ydCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRUcmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dFRyYW5zcG9ydCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0LkNsb3NlKCk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gZGlzcG9zYWJsZSBzdHVmZiBzaG91bGQgYmUgZGlzcG9zZWQKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0UHJvdG9jb2wgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2wuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAob3V0cHV0UHJvdG9jb2wgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBTdG9wKCkKKyAgICAgICAgeworICAgICAgICAgICAgc3RvcCA9IHRydWU7CisgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgICAgIC8vY2xlYW4gdXAgYWxsIHRoZSB0aHJlYWRzIG15c2VsZgorICAgICAgICAgICAgd29ya2VyVGhyZWFkLkFib3J0KCk7CisgICAgICAgICAgICBmb3JlYWNoIChUaHJlYWQgdCBpbiBjbGllbnRUaHJlYWRzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHQuQWJvcnQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KIH0KZGlmZiAtLWdpdCBhL2xpYi9jc2hhcnAvc3JjL1RBcHBsaWNhdGlvbkV4Y2VwdGlvbi5jcyBiL2xpYi9jc2hhcnAvc3JjL1RBcHBsaWNhdGlvbkV4Y2VwdGlvbi5jcwppbmRleCA0YTFiMmQyLi44ZGQ3YWU1IDEwMDY0NAotLS0gYS9saWIvY3NoYXJwL3NyYy9U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R5cGUuU3RvcCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KIAotCQkJCXN3aXRjaCAoZmllbGQuSUQpCi0JCQkJewotCQkJCQljYXNlIDE6Ci0JCQkJCQlpZiAoZmllbGQuVHlwZSA9PSBUVHlwZS5TdHJpbmcpCi0JCQkJCQl7Ci0JCQkJCQkJbWVzc2FnZSA9IGlwcm90LlJlYWRTdHJpbmcoKTsKLQkJCQkJCX0KLQkJCQkJCWVsc2UKLQkJCQkJCXsKLQkJCQkJCQlUUHJvdG9jb2xVdGlsLlNraXAoaXByb3QsIGZpZWxkLlR5cGUpOwotCQkJCQkJfQotCQkJCQkJYnJlYWs7Ci0JCQkJCWNhc2UgMjoKLQkJCQkJCWlmIChmaWVsZC5UeXBlID09IFRUeXBlLkkzMikKLQkJCQkJCXsKLQkJCQkJCQl0eXBlID0gKEV4Y2VwdGlvblR5cGUpaXByb3QuUmVhZEkzMigpOwotCQkJCQkJfQotCQkJCQkJZWxzZQotCQkJCQkJewotCQkJCQkJCVRQcm90b2NvbFV0aWwuU2tpcChpcHJvdCwgZmllbGQuVHlwZSk7Ci0JCQkJCQl9Ci0JCQkJCQlicmVhazsKLQkJCQkJZGVmYXVsdDoKLQkJCQkJCVRQcm90b2NvbFV0aWwuU2tpcChpcHJvdCwgZmllbGQuVHlwZSk7Ci0JCQkJCQlicmVhazsKLQkJCQl9CisgICAgICAgICAgICAgICAgc3dpdGNoIChmaWVsZC5JRCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWVsZC5UeXBlID09IFRUeXBlLlN0cmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlID0gaXByb3QuUmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbFV0aWwuU2tpcChpcHJvdCwgZmllbGQuVHlwZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpZWxkLlR5cGUgPT0gVFR5cGUuSTMyKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAoRXhjZXB0aW9uVHlwZSlpcHJvdC5SZWFkSTMyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sVXRpbC5Ta2lwKGlwcm90LCBmaWVsZC5UeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sVXRpbC5Ta2lwKGlwcm90LCBmaWVsZC5UeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KIAotCQkJCWlwcm90LlJlYWRGaWVsZEVuZCgpOwotCQkJfQorICAgICAgICAgICAgICAgIGlwcm90LlJlYWRGaWVsZEVuZCgpOworICAgICAgICAgICAgfQogCi0JCQlpcHJvdC5SZWFkU3RydWN0RW5kKCk7CisgICAgICAgICAgICBpcHJvdC5SZWFkU3RydWN0RW5kKCk7CiAKLQkJCXJldHVybiBuZXcgVEFwcGxpY2F0aW9uRXhjZXB0aW9uKHR5cGUsIG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G9kTmFtZSwKLQkJCUJhZFNlcXVlbmNlSUQsCi0JCQlNaXNzaW5nUmVzdWx0LAotCQkJSW50ZXJuYWxFcnJvciwKLQkJCVByb3RvY29sRXJyb3IsCi0JCQlJbnZhbGlkVHJhbnNmb3JtLAotCQkJSW52YWxpZFByb3RvY29sLAotCQkJVW5zdXBwb3J0ZWRDbGllbnRUeXBlCi0JCX0KLQl9CisgICAgICAgIHB1YmxpYyBlbnVtIEV4Y2VwdGlvblR5cGUKKyAgICAgICAgeworICAgICAgICAgICAgVW5rbm93biwKKyAgICAgICAgICAgIFVua25vd25NZXRob2QsCisgICAgICAgICAgICBJbnZhbGlkTWVzc2FnZVR5cGUsCisgICAgICAgICAgICBXcm9uZ01ldGhvZE5hbWUsCisgICAgICAgICAgICBCYWRTZXF1ZW5jZUlELAorICAgICAgICAgICAgTWlzc2luZ1Jlc3VsdCwKKyAgICAgICAgICAgIEludGVybmFsRXJyb3IsCisgICAgICAgICAgICBQcm90b2NvbEVycm9yLAorICAgICAgICAgICAgSW52YWxpZFRyYW5zZm9ybSwKKyAgICAgICAgICAgIEludmFsaWRQcm90b2NvbCwKKyAgICAgICAgICAgIFVuc3VwcG9ydGVkQ2xpZW50VHlwZQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEV4Y2VwdGlvblR5cGUgVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4gdHlwZTsgfQorICAgICAgICB9CisgICAgfQogfQpkaWZmIC0tZ2l0IGEvbGliL2NzaGFycC9zcmMvVEFzeW5jUHJvY2Vzc29yLmNzIGIvbGliL2NzaGFycC9zcmMvVEFzeW5jUHJvY2Vzc29yLmNzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmFiNDMyMjUKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvY3NoYXJwL3NyYy9UQXN5bmNQcm9jZXNzb3IuY3MKQEAgLTAsMCArMSwzOCBAQAorLyoqCisgKiBM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eGNlcHRpb24oImJ1ZlNpemUiLCAiQnVmZmVyIHNpemUgbXVzdCBiZSBhIHBvc2l0aXZlIG51bWJlci4iKTsKKyAgICAgICAgICAgIHRoaXMudHJhbnNwb3J0ID0gdHJhbnNwb3J0OworICAgICAgICAgICAgdGhpcy5idWZTaXplID0gYnVmU2l6ZTsKICAgICAgICAgfQotICAgICAgfQotICAgICAgX0lzRGlzcG9zZWQgPSB0cnVlOworCisgICAgICAgIHB1YmxpYyBUVHJhbnNwb3J0IFVuZGVybHlpbmdUcmFuc3BvcnQKKyAgICAgICAgeworICAgICAgICAgICAgZ2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworICAgICAgICAgICAgICAgIHJldHVybiB0cmFuc3BvcnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gV2UgY2FuIGxlZ2l0aW1hdGVseSB0aHJvdyBoZXJlIGJ1dCBiZSBuaWNlIGEgYml0LgorICAgICAgICAgICAgICAgIC8vIENoZWNrTm90RGlzcG9zZWQoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gIV9Jc0Rpc3Bvc2VkICYmIHRyYW5zcG9ydC5Jc09wZW47CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBPcGVuKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworICAgICAgICAgICAgdHJhbnNwb3J0Lk9wZW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworICAgICAgICAgICAgdHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgaW50IFJlYWQoYnl0ZVtdIGJ1ZiwgaW50IG9mZiwgaW50IGxlbikKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworICAgICAgICAgICAgVmFsaWRhdGVCdWZmZXJBcmdzKGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICAgICAgaWYgKCFJc09wZW4pCisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworCisgICAgICAgICAgICBpZiAoaW5wdXRCdWZmZXIuQ2FwYWNpdHkgPCBidWZTaXplKQorICAgICAgICAgICAgICAgIGlucHV0QnVmZmVyLkNhcGFjaXR5ID0gYnVmU2l6ZTsKKworICAgICAgICAgICAgd2hpbGUgKHRydWUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaW50IGdvdCA9IGlucHV0QnVmZmVyLlJlYWQoYnVmLCBvZmYsIGxlbik7CisgICAgICAgICAgICAgICAgaWYgKGdvdCA+IDApCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBnb3Q7CisKKyAgICAgICAgICAgICAgICBpbnB1dEJ1ZmZlci5TZWVrKDAsIFNlZWtPcmlnaW4uQmVnaW4pOworICAgICAgICAgICAgICAgIGlucHV0QnVmZmVyLlNldExlbmd0aChpbnB1dEJ1ZmZlci5DYXBhY2l0eSk7CisgICAgICAgICAgICAgICAgaW50IGZpbGxlZCA9IHRyYW5zcG9ydC5SZWFkKGlucHV0QnVmZmVyLkdldEJ1ZmZlcigpLCAwLCAoaW50KWlucHV0QnVmZmVyLkxlbmd0aCk7CisgICAgICAgICAgICAgICAgaW5wdXRCdWZmZXIuU2V0TGVuZ3RoKGZpbGxlZCk7CisgICAgICAgICAgICAgICAgaWYgKGZpbGxlZCA9PSAwKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlKGJ5dGVbXSBidWYsIGludCBvZmYsIGludCBsZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIENoZWNrTm90RGlzcG9zZWQoKTsKKyAgICAgICAgICAgIFZhbGlkYXRlQnVmZmVyQXJncyhidWYsIG9mZiwgbGVuKTsKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIC8vIFJlbGF0aXZlIG9mZnNldCBmcm9tICJvZmYiIGFyZ3VtZW50CisgICAgICAgICAgICBpbnQgb2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIGlmIChvdXRwdXRCdWZmZXIuTGVuZ3RoID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpbnQgY2FwYSA9IChpbnQpKG91dHB1dEJ1ZmZlci5DYXBhY2l0eSAtIG91dHB1dEJ1ZmZlci5MZW5ndGgpOworICAgICAgICAgICAgICAgIGludCB3cml0ZVNpemUgPSBjYXBhIDw9IGxlbiA/IGNhcGEgOiBsZW47CisgICAgICAgICAgICAgICAgb3V0cHV0QnVmZmVyLldyaXRlKGJ1Ziwgb2ZmLCB3cml0ZVNpemUpOworICAgICAgICAgICAgICAgIG9mZnNldCArPSB3cml0ZVNpemU7CisgICAgICAgICAgICAgICAgaWYgKHdyaXRlU2l6ZSA9PSBjYXBhKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LldyaXRlKG91dHB1dEJ1ZmZlci5HZXRCdWZmZXIoKSwgMCwgKGludClvdXRwdXRCdWZmZXIuTGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0QnVmZmVyLlNldExlbmd0aCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB3aGlsZSAobGVuIC0gb2Zmc2V0ID49IGJ1ZlNpemUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhbnNwb3J0LldyaXRlKGJ1Ziwgb2ZmICsgb2Zmc2V0LCBidWZTaXplKTsKKyAgICAgICAgICAgICAgICBvZmZzZXQgKz0gYnVmU2l6ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCByZW1haW4gPSBsZW4gLSBvZmZzZXQ7CisgICAgICAgICAgICBpZiAocmVtYWluID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAob3V0cHV0QnVmZmVyLkNhcGFjaXR5IDwgYnVmU2l6ZSkKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0QnVmZmVyLkNhcGFjaXR5ID0gYnVmU2l6ZTsKKyAgICAgICAgICAgICAgICBvdXRwdXRCdWZmZXIuV3JpdGUoYnVmLCBvZmYgKyBvZmZzZXQsIHJlbWFpbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgSW50ZXJuYWxGbHVzaCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIGlmIChvdXRwdXRCdWZmZXIuTGVuZ3RoID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnQuV3JpdGUob3V0cHV0QnVmZmVyLkdldEJ1ZmZlcigpLCAwLCAoaW50KW91dHB1dEJ1ZmZlci5MZW5ndGgpOworICAgICAgICAgICAgICAgIG91dHB1dEJ1ZmZlci5TZXRMZW5ndGgoMCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBGbHVzaCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIENoZWNrTm90RGlzcG9zZWQoKTsKKyAgICAgICAgICAgIEludGVybmFsRmx1c2goKTsKKworICAgICAgICAgICAgdHJhbnNwb3J0LkZsdXNoKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgSUFzeW5jUmVzdWx0IEJlZ2luRmx1c2goQXN5bmNDYWxsYmFjayBjYWxsYmFjaywgb2JqZWN0IHN0YXRlKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICBJbnRlcm5hbEZsdXNoKCk7CisKKyAgICAgICAgICAgIHJldHVybiB0cmFuc3BvcnQuQmVnaW5GbHVzaCggY2FsbGJhY2ssIHN0YXRlKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIEVuZEZsdXNoKElBc3luY1Jlc3VsdCBhc3luY1Jlc3VsdCkKKyAgICAgICAgeworICAgICAgICAgICAgdHJhbnNwb3J0LkVuZEZsdXNoKCBhc3luY1Jlc3VsdCk7CisgICAgICAgIH0KKworCisKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgQ2hlY2tOb3REaXNwb3NlZCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChfSXNEaXNwb3NlZCkKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgT2JqZWN0RGlzcG9zZWRFeGNlcHRpb24oIlRCdWZmZXJlZFRyYW5zcG9ydCIpOworICAgICAgICB9CisKKyAgICAgICAgI3JlZ2lvbiAiIElEaXNwb3NhYmxlIFN1cHBvcnQgIgorICAgICAgICBwcm90ZWN0ZWQgYm9vbCBfSXNEaXNwb3NlZCB7IGdldDsgcHJpdmF0ZSBzZXQ7IH0KKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9Jc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXRCdWZmZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0QnVmZmVyLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dEJ1ZmZlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0QnVmZmVyLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRyYW5zcG9ydCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfSXNEaXNwb3NlZCA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgI2VuZHJlZ2lvbgogICAgIH0KLSAgICAjZW5kcmVnaW9uCi0gIH0KIH0KZGlmZiAtLWdpdCBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9URnJhbWVkVHJhbnNwb3J0LmNzIGIvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RGcmFtZWRUcmFuc3BvcnQuY3MKaW5kZXggM2Q0MzExMi4uYTc0NmEzMiAxMDA2NDQKLS0tIGEvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RGcmFtZWRUcmFuc3BvcnQuY3MKKysrIGIvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RGcmFt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mF0ZSBjb25zdCBpbnQgSGVhZGVyU2l6ZSA9IDQ7CisgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgYnl0ZVtdIGhlYWRlckJ1ZiA9IG5ldyBieXRlW0hlYWRlclNpemVdOworCisgICAgICAgIHB1YmxpYyBjbGFzcyBGYWN0b3J5IDogVFRyYW5zcG9ydEZhY3RvcnkKICAgICAgICAgewotICAgICAgICAgIGlmIChyZWFkQnVmZmVyICE9IG51bGwpCi0gICAgICAgICAgICByZWFkQnVmZmVyLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBUVHJhbnNwb3J0IEdldFRyYW5zcG9ydChUVHJhbnNwb3J0IHRyYW5zKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVEZyYW1lZFRyYW5zcG9ydCh0cmFucyk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgIH0KLSAgICAgIF9Jc0Rpc3Bvc2VkID0gdHJ1ZTsKKworICAgICAgICBwdWJsaWMgVEZyYW1lZFRyYW5zcG9ydChUVHJhbnNwb3J0IHRyYW5zcG9ydCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHRyYW5zcG9ydCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24oInRyYW5zcG9ydCIpOworICAgICAgICAgICAgdGhpcy50cmFuc3BvcnQgPSB0cmFuc3BvcnQ7CisgICAgICAgICAgICBJbml0V3JpdGVCdWZmZXIoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIE9wZW4oKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICB0cmFuc3BvcnQuT3BlbigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIFdlIGNhbiBsZWdpdGltYXRlbHkgdGhyb3cgaGVyZSBidXQgYmUgbmljZSBhIGJpdC4KKyAgICAgICAgICAgICAgICAvLyBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuICFfSXNEaXNwb3NlZCAmJiB0cmFuc3BvcnQuSXNPcGVuOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICB0cmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBpbnQgUmVhZChieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICBWYWxpZGF0ZUJ1ZmZlckFyZ3MoYnVmLCBvZmYsIGxlbik7CisgICAgICAgICAgICBpZiAoIUlzT3BlbikKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuTm90T3Blbik7CisgICAgICAgICAgICBpbnQgZ290ID0gcmVhZEJ1ZmZlci5SZWFkKGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICAgICAgaWYgKGdvdCA+IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGdvdDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gUmVhZCBhbm90aGVyIGZyYW1lIG9mIGRhdGEKKyAgICAgICAgICAgIFJlYWRGcmFtZSgpOworCisgICAgICAgICAgICByZXR1cm4gcmVhZEJ1ZmZlci5SZWFkKGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIFJlYWRGcmFtZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYW5zcG9ydC5SZWFkQWxsKGhlYWRlckJ1ZiwgMCwgSGVhZGVyU2l6ZSk7CisgICAgICAgICAgICBpbnQgc2l6ZSA9IERlY29kZUZyYW1lU2l6ZShoZWFkZXJCdWYpOworCisgICAgICAgICAgICByZWFkQnVmZmVyLlNldExlbmd0aChzaXplKTsKKyAgICAgICAgICAgIHJlYWRCdWZmZXIuU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKyAgICAgICAgICAgIGJ5dGVbXSBidWZmID0gcmVhZEJ1ZmZlci5HZXRCdWZmZXIoKTsKKyAgICAgICAgICAgIHRyYW5zcG9ydC5SZWFkQWxsKGJ1ZmYsIDAsIHNpemUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgV3JpdGUoYnl0ZVtdIGJ1ZiwgaW50IG9mZiwgaW50IGxlbikKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworICAgICAgICAgICAgVmFsaWRhdGVCdWZmZXJBcmdzKGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICAgICAgaWYgKCFJc09wZW4pCisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgaWYgKHdyaXRlQnVmZmVyLkxlbmd0aCArIChsb25nKWxlbiA+IChsb25nKWludC5NYXhWYWx1ZSkKKyAgICAgICAgICAgICAgICBGbHVzaCgpOworICAgICAgICAgICAgd3JpdGVCdWZmZXIuV3JpdGUoYnVmLCBvZmYsIGxlbik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgSW50ZXJuYWxGbHVzaCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIENoZWNrTm90RGlzcG9zZWQoKTsKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIGJ5dGVbXSBidWYgPSB3cml0ZUJ1ZmZlci5HZXRCdWZmZXIoKTsKKyAgICAgICAgICAgIGludCBsZW4gPSAoaW50KXdyaXRlQnVmZmVyLkxlbmd0aDsKKyAgICAgICAgICAgIGludCBkYXRhX2xlbiA9IGxlbiAtIEhlYWRlclNpemU7CisgICAgICAgICAgICBpZiAoZGF0YV9sZW4gPCAwKQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBTeXN0ZW0uSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigpOyAvLyBsb2dpYyBlcnJvciBhY3R1YWxseQorCisgICAgICAgICAgICAvLyBJbmplY3QgbWVzc2FnZSBoZWFkZXIgaW50byB0aGUgcmVzZXJ2ZWQgYnVmZmVyIHNwYWNlCisgICAgICAgICAgICBFbmNvZGVGcmFtZVNpemUoZGF0YV9sZW4sIGJ1Zik7CisKKyAgICAgICAgICAgIC8vIFNlbmQgdGhlIGVudGlyZSBtZXNzYWdlIGF0IG9uY2UKKyAgICAgICAgICAgIHRyYW5zcG9ydC5Xcml0ZShidWYsIDAsIGxlbik7CisKKyAgICAgICAgICAgIEluaXRXcml0ZUJ1ZmZlcigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgRmx1c2goKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisgICAgICAgICAgICBJbnRlcm5hbEZsdXNoKCk7CisKKyAgICAgICAgICAgIHRyYW5zcG9ydC5GbHVzaCgpOworICAgICAgICB9CisKKy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ChieXRlKSgweGZmICYgKGZyYW1lU2l6ZSA+PiA4KSk7CisgICAgICAgICAgICBidWZbM10gPSAoYnl0ZSkoMHhmZiAmIChmcmFtZVNpemUpKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIGludCBEZWNvZGVGcmFtZVNpemUoYnl0ZVtdIGJ1ZikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuCisgICAgICAgICAgICAgICAgKChidWZbMF0gJiAweGZmKSA8PCAyNCkgfAorICAgICAgICAgICAgICAgICgoYnVmWzFdICYgMHhmZikgPDwgMTYpIHwKKyAgICAgICAgICAgICAgICAoKGJ1ZlsyXSAmIDB4ZmYpIDw8IDgpIHwKKyAgICAgICAgICAgICAgICAoKGJ1ZlszXSAmIDB4ZmYpKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIENoZWNrTm90RGlzcG9zZWQoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX0lzRGlzcG9zZWQpCisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE9iamVjdERpc3Bvc2VkRXhjZXB0aW9uKCJURnJhbWVkVHJhbnNwb3J0Iik7CisgICAgICAgIH0KKworICAgICAgICAjcmVnaW9uICIgSURpc3Bvc2FibGUgU3VwcG9ydCAiCisgICAgICAgIHByaXZhdGUgYm9vbCBfSXNEaXNwb3NlZDsKKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9Jc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAocmVhZEJ1ZmZlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEJ1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Ci0JCXsKLQkJCXNldAotCQkJewotCQkJICAgY29ubmVjdFRpbWVvdXQgPSB2YWx1ZTsKLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgVEh0dHBDbGllbnQoVXJpIHUsIElFbnVtZXJhYmxlPFg1MDlDZXJ0aWZpY2F0ZT4gY2VydGlmaWNhdGVzKQorICAgICAgICB7CisgICAgICAgICAgICB1cmkgPSB1OworICAgICAgICAgICAgdGhpcy5jZXJ0aWZpY2F0ZXMgPSAoY2VydGlmaWNhdGVzID8/IEVudW1lcmFibGUuRW1wdHk8WDUwOUNlcnRpZmljYXRlPigpKS5Ub0FycmF5KCk7CisgICAgICAgIH0KIAotCQlwdWJsaWMgaW50IFJlYWRUaW1lb3V0Ci0JCXsKLQkJCXNldAotCQkJewotCQkJCXJlYWRUaW1lb3V0ID0gdmFsdWU7Ci0JCQl9Ci0JCX0KKyAgICAgICAgcHVibGljIGludCBDb25uZWN0VGltZW91dAorICAgICAgICB7CisgICAgICAgICAgICBzZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0VGltZW91dCA9IHZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIElEaWN0aW9uYXJ5PFN0cmluZywgU3RyaW5nPiBDdXN0b21IZWFkZXJzCi0JCXsKLQkJCWdldAotCQkJewotCQkJCXJldHVybiBjdXN0b21IZWFkZXJzOwotCQkJfQotCQl9CisgICAgICAgIHB1YmxpYyBpbnQgUmVhZFRpbWVvdXQKKyAgICAgICAgeworICAgICAgICAgICAgc2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmVhZFRpbWVvdXQgPSB2YWx1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBJRGljdGlvbmFyeTxzdHJpbmcsIHN0cmluZz4gQ3VzdG9tSGVhZGVycworICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gY3VzdG9tSGVhZGVyczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogCiAjaWYgIVNJTFZFUkxJR0hUCiAgICAgICAgIHB1YmxpYyBJV2ViUHJveHkgUHJveHkKQEAgLTg1LDE0MCArOTMsMjA3IEBACiAgICAgICAgIH0KICNlbmRpZgogCi0JCXB1YmxpYyBvdmVycmlkZSBib29sIElzT3BlbgotCQl7Ci0JCQlnZXQKLQkJCXsKLQkJCQlyZXR1cm4gdHJ1ZTsKLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBPcGVuKCkKLQkJewotCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIE9wZW4oKQorICAgICAgICB7CisgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCi0JCXsKLQkJCWlmIChpbnB1dFN0cmVhbSAhPSBudWxsKQotCQkJewotCQkJCWlucHV0U3RyZWFtLkNsb3NlKCk7Ci0JCQkJaW5wdXRTdHJlYW0gPSBudWxsOwotCQkJfQotCQkJaWYgKG91dHB1dFN0cmVhbSAhPSBudWxsKQotCQkJewotCQkJCW91dHB1dFN0cmVhbS5DbG9zZSgpOwotCQkJCW91dHB1dFN0cmVhbSA9IG51bGw7Ci0JCQl9Ci0JCX0KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoaW5wdXRTdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpbnB1dFN0cmVhbS5DbG9zZSgpOworICA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SkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RTdHJlYW0uV3JpdGUoZGF0YSwgMCwgZGF0YS5MZW5ndGgpOworCisgICAgICAgICAgICAgICAgICAgIC8vIFJlc29sdmUgSFRUUCBoYW5nIHRoYXQgY2FuIGhhcHBlbnMgYWZ0ZXIgc3VjY2Vzc2l2ZSBjYWxscyBieSBtYWtpbmcgc3VyZQorICAgICAgICAgICAgICAgICAgICAvLyB0aGF0IHdlIHJlbGVhc2UgdGhlIHJlc3BvbnNlIGFuZCByZXNwb25zZSBzdHJlYW0uIFRvIHN1cHBvcnQgdGhpcywgd2UgY29weQorICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcmVzcG9uc2UgdG8gYSBtZW1vcnkgc3RyZWFtLgorICAgICAgICAgICAgICAgICAgICB1c2luZyAodmFyIHJlc3BvbnNlID0gY29ubmVjdGlvbi5HZXRSZXNwb25zZSgpKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB1c2luZyAodmFyIHJlc3BvbnNlU3RyZWFtID0gcmVzcG9uc2UuR2V0UmVzcG9uc2VTdHJlYW0oKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDb3B5IHRoZSByZXNwb25zZSB0byBhIG1lbW9yeSBzdHJlYW0gc28gdGhhdCB3ZSBjYW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjbGVhbmx5IGNsb3NlIHRoZSByZXNwb25zZSBhbmQgcmVzcG9uc2Ugc3RyZWFtLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0U3RyZWFtID0gbmV3IE1lbW9yeVN0cmVhbSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVbXSBidWZmZXIgPSBuZXcgYnl0ZVs4MTkyXTsgIC8vIG11bHRpcGxlIG9mIDQwOTYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYnl0ZXNSZWFkOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgoYnl0ZXNSZWFkID0gcmVzcG9uc2VTdHJlYW0uUmVhZChidWZmZXIsIDAsIGJ1ZmZlci5MZW5ndGgpKSA+IDApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dFN0cmVhbS5Xcml0ZShidWZmZXIsIDAsIGJ5dGVzUmVhZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0U3RyZWFtLlNlZWsoMCwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlbmNvZGluZ3MgPSByZXNwb25zZS5IZWFkZXJzLkdldFZhbHVlcygiQ29udGVudC1FbmNvZGluZyIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVuY29kaW5ncyAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBlbmNvZGluZyBpbiBlbmNvZGluZ3MpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICJnemlwIjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZWNvbXByZXNzR1ppcHBlZChyZWYgaW5wdXRTdHJlYW0pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAiZGVmbGF0ZSI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGVjb21wcmVzc0RlZmxhdGVkKHJlZiBpbnB1dFN0cmVhbSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKElPRXhjZXB0aW9uIGlveCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuVW5rbm93biwgaW94LlRvU3RyaW5nKCksIGlveCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoV2ViRXhjZXB0aW9uIHd4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Vbmtub3duLCAiQ291bGRuJ3QgY29ubmVjdCB0byBzZXJ2ZXI6ICIgKyB3eCwgd3gpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIERlY29tcHJlc3NEZWZsYXRlZChyZWYgU3RyZWFtIGlucHV0U3RyZWFtKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdG1wID0gbmV3IE1lbW9yeVN0cmVhbSgpOworICAgICAgICAgICAgdXNpbmcgKHZhciBkZWNvbXAgPSBuZXcgRGVmbGF0ZVN0cmVhbShpbnB1dFN0cmVhbSwgQ29tcHJlc3Npb25Nb2RlLkRlY29tcHJlc3MpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRlY29tcC5Db3B5VG8odG1wKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlucHV0U3RyZWFtLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgIGlucHV0U3RyZWFtID0gdG1wOworICAgICAgICAgICAgaW5wdXRTdHJlYW0uU2VlaygwLCAwKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBEZWNvbXByZXNzR1ppcHBlZChyZWYgU3RyZWFtIGlucHV0U3RyZWFtKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdG1wID0gbmV3IE1lbW9yeVN0cmVhbSgpOworICAgICAgICAgICAgdXNpbmcgKHZhciBkZWNvbXAgPSBuZXcgR1ppcFN0cmVhbShpbnB1dFN0cmVhbSwgQ29tcHJlc3Npb25Nb2RlLkRlY29tcHJlc3MpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRlY29tcC5Db3B5VG8odG1wKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlucHV0U3RyZWFtLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgIGlucHV0U3RyZWFtID0gdG1wOworICAgICAgICAgICAgaW5wdXRTdHJlYW0uU2VlaygwLCAwKTsKKyAgICAgICAgfQogI2VuZGlmCi0JCQkJcHJpdmF0ZSBIdHRwV2ViUmVxdWVzdCBDcmVhdGVSZXF1ZXN0KCkKLQkJewotCQkJSHR0cFdlYlJlcXVlc3QgY29ubmVjdGlvbiA9IChIdHRwV2ViUmVxdWVzdClXZWJSZXF1ZXN0LkNyZWF0ZSh1cmkpOworICAgICAgICBwcml2YXRlIEh0dHBXZWJSZXF1ZXN0IENyZWF0ZVJlcXVlc3QoKQorICAgICAgICB7CisgICAgICAgICAgICBIdHRwV2ViUmVxdWVzdC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gIGNvbm5lY3Rpb24uSGVhZGVyc1tpdGVtLktleV0gPSBpdGVtLlZhbHVlOwogI2VuZGlmCi0JCQl9CisgICAgICAgICAgICB9CiAKICNpZiAhU0lMVkVSTElHSFQKICAgICAgICAgICAgIGNvbm5lY3Rpb24uUHJveHkgPSBwcm94eTsKICNlbmRpZgogCiAgICAgICAgICAgICByZXR1cm4gY29ubmVjdGlvbjsKLQkJfQorICAgICAgICB9CiAKLSNpZiBTSUxWRVJMSUdIVAogICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgSUFzeW5jUmVzdWx0IEJlZ2luRmx1c2goQXN5bmNDYWxsYmFjayBjYWxsYmFjaywgb2JqZWN0IHN0YXRlKQogICAgICAgICB7CiAgICAgICAgICAgICAvLyBFeHRyYWN0IHJlcXVlc3QgYW5kIHJlc2V0IGJ1ZmZlcgpAQCAtMjQxLDcgKzMxNiw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBjYXRjaCAoSU9FeGNlcHRpb24gaW94KQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKGlveC5Ub1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihpb3guVG9TdHJpbmcoKSwgaW94KTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCkBAIC0yNDksNyArMzI0LDcgQEAKICAgICAgICAgewogICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgdmFyIGZsdXNoQXN5bmNSZXN1bHQgPSAoRmx1c2hBc3luY1Jlc3VsdCkgYXN5bmNSZXN1bHQ7CisgICAgICAgICAgICAgICAgdmFyIGZsdXNoQXN5bmNSZXN1bHQgPSAoRmx1c2hBc3luY1Jlc3VsdClhc3luY1Jlc3VsdDsKIAogICAgICAgICAgICAgICAgIGlmICghZmx1c2hBc3luY1Jlc3VsdC5Jc0NvbXBsZXRlZCkKICAgICAgICAgICAgICAgICB7CkBAIC0yNjIsMTQgKzMzNywxNCBAQAogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZmx1c2hBc3luY1Jlc3VsdC5Bc3luY0V4Y2VwdGlvbjsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGZpbmFsbHkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0gPSBuZXcgTWVtb3J5U3RyZWFtKCk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgfQogCi0KICAgICAgICAgcHJpdmF0ZSB2b2lkIEdldFJlcXVlc3RTdHJlYW1DYWxsYmFjayhJQXN5bmNSZXN1bHQgYXN5bmNocm9ub3VzUmVzdWx0KQogICAgICAgICB7CiAgICAgICAgICAgICB2YXIgZmx1c2hBc3luY1Jlc3VsdCA9IChGbHVzaEFzeW5jUmVzdWx0KWFzeW5jaHJvbm91c1Jlc3VsdC5Bc3luY1N0YXRlOwpAQCAtMjg1LDcgKzM2MCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4Y2VwdGlvbikKICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBmbHVzaEFzeW5jUmVzdWx0LkFzeW5jRXhjZXB0aW9uID0gbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oZXhjZXB0aW9uLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIGZsdXNoQXN5bmNSZXN1bHQuQXN5bmNFeGNlcHRpb24gPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihleGNlcHRpb24uVG9TdHJpbmcoKSwgZXhjZXB0aW9uKTsKICAgICAgICAgICAgICAgICBmbHVzaEFzeW5jUmVzdWx0LlVwZGF0ZVN0YXR1c1RvQ29tcGxldGUoKTsKICA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ZWN0IHN0YXRlKQorICAgICAgICAgICAgcHVibGljIEZsdXNoQXN5bmNSZXN1bHQoQXN5bmNDYWxsYmFjayBjYk1ldGhvZCwgb2JqZWN0IHN0YXRlKQogICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIF9jYk1ldGhvZCA9IGNiTWV0aG9kOwogICAgICAgICAgICAgICAgIF9zdGF0ZSA9IHN0YXRlOwpAQCAtMzQwLDcgKzQxNSw3IEBACiAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIF9pc0NvbXBsZXRlZDsgfQogICAgICAgICAgICAgfQotICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBPYmplY3QgX2xvY2tlciA9IG5ldyBPYmplY3QoKTsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgb2JqZWN0IF9sb2NrZXIgPSBuZXcgb2JqZWN0KCk7CiAgICAgICAgICAgICBwcml2YXRlIE1hbnVhbFJlc2V0RXZlbnQgR2V0RXZ0SGFuZGxlKCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBsb2NrIChfbG9ja2VyKQpAQCAtMzU4LDEyICs0MzMsMTIgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGludGVybmFsIHZvaWQgVXBkYXRlU3RhdHVzVG9Db21wbGV0ZSgpCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgX2lzQ29tcGxldGVkID0gdHJ1ZTsgLy8xLiBzZXQgX2lzY29tcGxldGVkIHRvIHRydWUgCisgICAgICAgICAgICAgICAgX2lzQ29tcGxldGVkID0gdHJ1ZTsgLy8xLiBzZXQgX2lzY29tcGxldGVkIHRvIHRydWUKICAgICAgICAgICAgICAgICBsb2NrIChfbG9ja2VyKQogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKF9ldnQgIT0gbnVsbCkKICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgX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ICAgCisKICAgICAgICAgcHVibGljIFRIdHRwSGFuZGxlcihUUHJvY2Vzc29yIHByb2Nlc3NvciwgVFByb3RvY29sRmFjdG9yeSBwcm90b2NvbEZhY3RvcnkpCiAgICAgICAgICAgICA6IHRoaXMocHJvY2Vzc29yLCBwcm90b2NvbEZhY3RvcnksIHByb3RvY29sRmFjdG9yeSkKICAgICAgICAgewpAQCAtNjMsMzAgKzc1LDIzIEBACiAgICAgICAgIHsKICAgICAgICAgICAgIFRUcmFuc3BvcnQgdHJhbnNwb3J0ID0gbmV3IFRTdHJlYW1UcmFuc3BvcnQoaW5wdXQsb3V0cHV0KTsKIAotICAgICAgICAgICAgVFByb3RvY29sIGlucHV0UHJvdG9jb2wgPSBudWxsOwotICAgICAgICAgICAgVFByb3RvY29sIG91dHB1dFByb3RvY29sID0gbnVsbDsKLQogICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbCA9IGlucHV0UHJvdG9jb2xGYWN0b3J5LkdldFByb3RvY29sKHRyYW5zcG9ydCk7Ci0gICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2wgPSBvdXRwdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICB2YXIgaW5wdXRQcm90b2NvbCA9IGlucHV0UHJvdG9jb2xGYWN0b3J5LkdldFByb3RvY29sKHRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgdmFyIG91dHB1dFByb3RvY29sID0gb3V0cHV0UHJvdG9jb2xGYWN0b3J5LkdldFByb3RvY29sKHRyYW5zcG9ydCk7CiAKLSAgICAgICAgICAgICAgICB3aGlsZSAocHJvY2Vzc29yLlByb2Nlc3MoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wpKSB7IH0KKyAgICAgICAgICAgICAgICB3aGlsZSAocHJvY2Vzc29yLlByb2Nlc3MoaW5wdXRQcm90b2NvbCwgb3V0cHV0UHJvdG9jb2wpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbikKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAvLyBDbGllbnQgZGllZCwganVzdCBtb3ZlIG9uCiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXRjaCAoVEFwcGxpY2F0aW9uRXhjZXB0aW9uIHR4KQorICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvbnNvbGUuRXJyb3IuV3JpdGUodHgpOworICAgICAgICAgICAgICAgIHRyYW5zcG9ydC5DbG9zZSgpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiB4KQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIENvbnNvbGUuRXJyb3IuV3JpdGUoeCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRyYW5zcG9ydC5DbG9zZSgpOwogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIGJvb2wgSXNSZXVzYWJsZQpkaWZmIC0tZ2l0IGEvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RIdHRwVGFza0FzeW5jSGFuZGxlci5jcyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9USHR0cFRhc2tBc3luY0hhbmRsZXIuY3MKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZTQ5MWYzMgotLS0gL2Rldi9udWxsCisrKyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9USHR0cFRhc2tBc3luY0hhbmRsZXIuY3MKQEAgLTAsMCArMSw5NyBAQAor77u/LyoqCisgKiBMaWNlbnNlZCB0byB0aGUgQXBhY2hlIFNvZnR3YXJlIEZvdW5kYXRpb24gKEFTRik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leHQuUmVxdWVzdC5JbnB1dFN0cmVhbSwgY29udGV4dC5SZXNwb25zZS5PdXRwdXRTdHJlYW0pOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgaW5wdXQgPSBfaW5wdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICB2YXIgb3V0cHV0ID0gX291dHB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbCh0cmFuc3BvcnQpOworCisgICAgICAgICAgICAgICAgd2hpbGUgKGF3YWl0IF9wcm9jZXNzb3IuUHJvY2Vzc0FzeW5jKGlucHV0LCBvdXRwdXQpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBDbGllbnQgZGllZCwganVzdCBtb3ZlIG9uCisgICAgICAgICAgICB9CisgICAgICAgICAgICBmaW5hbGx5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9saWIvY3NoYXJwL3NyYy9UcmFuc3BvcnQvVE1lbW9yeUJ1ZmZlci5jcyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UTWVtb3J5QnVmZmVyLmNzCmluZGV4IGNhMzFmZWUuLjMwM2QwODMgMTAwNjQ0Ci0tLSBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UTWVtb3J5QnVmZmVyLmNzCisrKyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UTWVtb3J5QnVmZmVyLmNzCkBAIC0yMiw3OCArMjIsOTYgQEAKIHVzaW5nIFN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W50IENvbm5lY3RUaW1lb3V0OworCisgICAgICAgIHB1YmxpYyBUTmFtZWRQaXBlQ2xpZW50VHJhbnNwb3J0KHN0cmluZyBwaXBlLCBpbnQgdGltZW91dCA9IFRpbWVvdXQuSW5maW5pdGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIFNlcnZlck5hbWUgPSAiLiI7CisgICAgICAgICAgICBQaXBlTmFtZSA9IHBpcGU7CisgICAgICAgICAgICBDb25uZWN0VGltZW91dCA9IHRpbWVvdXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVE5hbWVkUGlwZUNsaWVudFRyYW5zcG9ydChzdHJpbmcgc2VydmVyLCBzdHJpbmcgcGlwZSwgaW50IHRpbWVvdXQgPSBUaW1lb3V0LkluZmluaXRlKQorICAgICAgICB7CisgICAgICAgICAgICBTZXJ2ZXJOYW1lID0gKHNlcnZlciAhPSAiIikgPyBzZXJ2ZXIgOiAiLiI7CisgICAgICAgICAgICBQaXBlTmFtZSA9IHBpcGU7CisgICAgICAgICAgICBDb25uZWN0VGltZW91dCA9IHRpbWVvdXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIGNsaWVudCAhPSBudWxsICYmIGNsaWVudC5Jc0Nvbm5lY3RlZDsgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgT3BlbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChJc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkFscmVhZHlPcGVuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNsaWVudCA9IG5ldyBOYW1lZFBpcGVDbGllbnRTdHJlYW0oU2VydmVyTmFtZSwgUGlwZU5hbWUsIFBpcGVEaXJlY3Rpb24uSW5PdXQsIFBpcGVPcHRpb25zLk5vbmUpOworICAgICAgICAgICAgY2xpZW50LkNvbm5lY3QoQ29ubmVjdFRpbWVvdXQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2xpZW50LkNsb3NlKCk7CisgICAgICAgICAgICAgICAgY2xpZW50ID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBpbnQgUmVhZChieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2xpZW50ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gY2xpZW50LlJlYWQoYnVmLCBvZmYsIGxlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZShieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2xpZW50ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBpZiBuZWNlc3NhcnksIHNlbmQgdGhlIGRhdG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KKyAgICAgICAgeworICAgICAgICAgICAgdGhpcy5waXBlQWRkcmVzcyA9IHBpcGVBZGRyZXNzOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgTGlzdGVuKCkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gbm90aGluZyB0byBkbyBoZXJlCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChzdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbS5DbG9zZSgpOworICAgICAgICAgICAgICAgICAgICBzdHJlYW0uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmaW5hbGx5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBFbnN1cmVQaXBlSW5zdGFuY2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoc3RyZWFtID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGRpcmVjdGlvbiA9IFBpcGVEaXJlY3Rpb24uSW5PdXQ7CisgICAgICAgICAgICAgICAgdmFyIG1heGNvbm4gPSBOYW1lZFBpcGVTZXJ2ZXJTdHJlYW0uTWF4QWxsb3dlZFNlcnZlckluc3RhbmNlczsKKyAgICAgICAgICAgICAgICB2YXIgbW9kZSA9IFBpcGVUcmFuc21pc3Npb25Nb2RlLkJ5dGU7CisgICAgICAgICAgICAgICAgdmFyIG9wdGlvbnMgPSBhc3luY01vZGUgPyBQaXBlT3B0aW9ucy5Bc3luY2hyb25vdXMgOiBQaXBlT3B0aW9ucy5Ob25lOworICAgICAgICAgICAgICAgIGNvbnN0IGludCBJTkJVRl9TSVpFID0gNDA5NjsKKyAgICAgICAgICAgICAgICBjb25zdCBpbnQgT1VUQlVGX1NJWkUgPSA0MDk2OworCisgICAgICAgICAgICAgICAgLy8gc2VjdXJpdHkKKyAgICAgICAgICAgICAgICB2YXIgc2VjdXJpdHkgPSBuZXcgUGlwZVNlY3VyaXR5KCk7CisgICAgICAgICAgICAgICAgc2VjdXJpdHkuQWRkQWNjZXNzUnVsZSgKKyAgICAgICAgICAgICAgICAgICAgbmV3IFBpcGVBY2Nlc3NSdWxlKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFNlY3VyaXR5SWRlbnRpZmllcihXZWxsS25vd25TaWRUeXBlLldvcmxkU2lkLCBudWxsKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFBpcGVBY2Nlc3NSaWdodHMuUmVhZCB8IFBpcGVBY2Nlc3NSaWdodHMuV3JpdGUgfCBQaXBlQWNjZXNzUmlnaHRzLlN5bmNocm9uaXplIHwgUGlwZUFjY2Vzc1JpZ2h0cy5DcmVhdGVOZXdJbnN0YW5jZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5TZWN1cml0eS5BY2Nlc3NDb250cm9sLkFjY2Vzc0NvbnRyb2xUeXBlLkFsbG93CisgICAgICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICAgICApOworCisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPSBuZXcgTmFtZWRQaXBlU2VydmVyU3RyZWFtKHBpcGVBZGRyZXNzLCBkaXJlY3Rpb24sIG1heGNvbm4sIG1vZGUsIG9wdGlvbnMsIElOQlVGX1NJWkUsIE9VVEJVRl9TSVpFLCBzZWN1cml0eSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChOb3RJbXBsZW1lbnRlZEV4Y2VwdGlvbikgIC8vIE1vbm8gc3RpbGwgZG9lcyBub3Qgc3VwcG9ydCBhc3luYywgZmFsbGJhY2sgdG8gc3luYworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFzeW5jTW9kZSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucyAmPSAoflBpcGVPcHRpb25zLkFzeW5jaHJvbm91cyk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0gPSBuZXcgTmFtZWRQaXBlU2VydmVyU3RyZWFtKHBpcGVBZGRyZXNzLCBkaXJlY3Rpb24sIG1heGNvbm4sIG1vZGUsIG9wdGlvbnMsIElOQlVGX1NJWkUsIE9VVEJVRl9TSVpFLCBzZWN1cml0eSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhc3luY01vZGUgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgVFRyYW5zcG9ydCBBY2NlcHRJbXBsKCkKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgRW5zdXJlUGlwZUluc3RhbmNlKCk7CisKKyAgICAgICAgICAgICAgICBpZiAoYXN5bmNNb2RlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGV2dCA9IG5ldyBNYW51YWxSZXNldEV2ZW50KGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgRXhjZXB0aW9uIGVPdXRlciA9IG51bGw7CisKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtLkJlZ2luV2FpdEZvckNvbm5lY3Rpb24oYXN5bmNSZXN1bHQgPT4KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0uRW5kV2FpdEZvckNvbm5lY3Rpb24oYXN5bmNSZXN1bHQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZU91dGVyID0gbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkludGVycnVwdGVkKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RyZWFtICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVPdXRlciA9IGU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlT3V0ZXIgPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuSW50ZXJydXB0ZWQsIGUuTWVzc2FnZSwgZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBldnQuU2V0KCk7CisgICAgICAgICAgICAgICAgICAgIH0sIG51bGwpOworCisgICAgICAgICAgICAgICAgICAgIGV2dC5XYWl0T25lKCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVPdXRlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZU91dGVyOyAvLyByZXRocm93IGV4Y2VwdGlvbgorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW0uV2FpdEZvckNvbm5lY3Rpb24oKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2YXIgdHJhbnMgPSBuZXcgU2VydmVyVHJhbnNwb3J0KHN0cmVhbSxhc3luY01vZGUpOworICAgICAgICAgICAgICAgIHN0cmVhbSA9IG51bGw7ICAvLyBwYXNzIG93bmVyc2hpcCB0byBTZXJ2ZXJUcmFuc3BvcnQKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDbG9zZSgpOworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENsb3NlKCk7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sIGUuTWVzc2FnZSwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGNsYXNzIFNlcnZlclRyYW5zcG9ydCA6IFRUcmFuc3BvcnQKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSBOYW1lZFBpcGVTZXJ2ZXJTdHJlYW0gc3RyZWFtOworICAgICAgICAgICAgcHJpdmF0ZSBib29sIGFzeW5jTW9kZTsKKworICAgICAgICAgICAgcHVibGljIFNlcnZlclRyYW5zcG9ydChOYW1lZFBpcGVTZXJ2ZXJTdHJlYW0gc3RyZWFtLCBib29sIGFzeW5jTW9kZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aGlzLnN0cmVhbSA9IHN0cmVhbTsKKyAgICAgICAgICAgICAgICB0aGlzLmFzeW5jTW9kZSA9IGFzeW5jTW9kZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIHN0cmVhbSAhPSBudWxsICYmIHN0cmVhbS5Jc0Nvbm5lY3RlZDsgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBPcGVuKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtLkNsb3NlKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBpbnQgUmVhZChieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzdHJlYW0gPT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoYXN5bmNNb2RlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgRXhjZXB0aW9uIGVPdXRlciA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIHZhciBldnQgPSBuZXcgTWFudWFsUmVzZXRFdmVudChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIGludCByZXR2YWwgPSAwOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbS5CZWdpblJlYWQoYnVmLCBvZmYsIGxlbiwgYXN5bmNSZXN1bHQgPT4KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR2YWwgPSBzdHJlYW0uRW5kUmVhZChhc3luY1Jlc3VsdCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlT3V0ZXIgPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuSW50ZXJydXB0ZWQpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZU91dGVyID0gZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVPdXRlciA9IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5JbnRlcnJ1cHRlZCwgZS5NZXNzYWdlLCBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGV2dC5TZXQoKTsKKyAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCk7CisKKyAgICAgICAgICAgICAgICAgICAgZXZ0LldhaXRPbmUoKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoZU91dGVyICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlT3V0ZXI7IC8vIHJldGhyb3cgZXhjZXB0aW9uCisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXR2YWw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdHJlYW0uUmVhZChidWYsIG9mZiwgbGVuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFdyaXRlKGJ5dGVbXSBidWYsIGludCBvZmYsIGludCBsZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKHN0cmVhbSA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIGlmIG5lY2Vzc2FyeSwgc2VuZCB0aGUgZGF0YSBpbiBjaHVua3MKKyAgICAgICAgICAgICAgICAvLyB0aGVyZSdzIGEgc3lzdGVtIGxpbWl0IGFyb3VuZCAweDEwMDAwIGJ5dGVzIHRoYXQgd2UgaGl0IG90aGVyd2lzZQorICAgICAgICAgICAgICAgIC8vIE1TRE46ICJQaXBlIHdyaXRlIG9wZXJhdGlvbnMgYWNyb3NzIGEgbmV0d29yayBhcmUgbGltaXRlZCB0byA2NSw1MzUgYnl0ZXMgcGVyIHdyaXRlLiBGb3IgbW9yZSBpbmZvcm1hdGlvbiByZWdhcmRpbmcgcGlwZXMsIHNlZSB0aGUgUmVtYXJrcyBzZWN0aW9uLiIKKyAgICAgICAgICAgICAgICB2YXIgbkJ5dGVzID0gTWF0aC5NaW4obGVuLCAxNSAqIDQwOTYpOyAgLy8gMTYgd291bGQgZXhjZWVkIHRoZSBsaW1pdAorICAgICAgICAgICAgICAgIHdoaWxlIChuQnl0ZXMgPiAwKQorICAgICAgICAgICAgICAgIHsKKworICAgICAgICAgICAgICAgICAgICBpZiAoYXN5bmNNb2RlKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBFeGNlcHRpb24gZU91dGVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhciBldnQgPSBuZXcgTWFudWFsUmVzZXRFdmVudChmYWxzZSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbS5CZWdpbldyaXRlKGJ1Ziwgb2ZmLCBuQnl0ZXMsIGFzeW5jUmVzdWx0ID0+CisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RyZWFtICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW0uRW5kV3JpdGUoYXN5bmNSZXN1bHQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlT3V0ZXIgPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuSW50ZXJydXB0ZWQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RyZWFtICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlT3V0ZXIgPSBlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlT3V0ZXIgPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuSW50ZXJydXB0ZWQsIGUuTWVzc2FnZSwgZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2dC5TZXQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0sIG51bGwpOworCisgICAgICAgICAgICAgICAgICAgICAgICBldnQuV2FpdE9uZSgpOworCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZU91dGVyICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZU91dGVyOyAvLyByZXRocm93IGV4Y2VwdGlvbgorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtLldyaXRlKGJ1Ziwgb2ZmLCBuQnl0ZXMpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgb2ZmICs9IG5CeXRlczsKKyAgICAgICAgICAgICAgICAgICAgbGVuIC09IG5CeXRlczsKKyAgICAgICAgICAgICAgICAgICAgbkJ5dGVzID0gTWF0aC5NaW4obGVuLCBuQnl0ZXMpOworICAgICAg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ZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNlcnZlciA9IG51bGw7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIkNvdWxkIG5vdCBjcmVhdGUgU2VydmVyU29ja2V0IG9uIHBvcnQgIiArIHRoaXMucG9ydCArICIuIiwgZXgpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIG92ZXJyaWRlIHZvaWQgTGlzdGVuKCkKLQkJewotCQkJLy8gTWFrZSBzdXJlIG5vdCB0byBibG9jayBvbiBhY2NlcHQKLQkJCWlmIChzZXJ2ZXIgIT0gbnVsbCkKLQkJCXsKLQkJCQl0cnkKLQkJCQl7Ci0JCQkJCXNlcnZlci5TdGFydCgpOwotCQkJCX0KLQkJCQljYXRjaCAoU29ja2V0RXhjZXB0aW9uIHN4KQotCQkJCXsKLQkJCQkJdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIkNvdWxkIG5vdCBhY2NlcHQgb24gbGlzdGVuaW5nIHNvY2tldDogIiArIHN4Lk1lc3NhZ2UpOwotCQkJCX0KLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBMaXN0ZW4oKQorICAgICAgICB7CisgICAgICAgICAgICAvLyBNYWtlIHN1cmUgbm90IHRvIGJsb2NrIG9uIGFjY2VwdAorICAgICAgICAgICAgaWYgKHNlcnZlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc2VydmVyLlN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChTb2NrZXRFeGNlcHRpb24gc3gpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigiQ291bGQgbm90IGFjY2VwdCBvbiBsaXN0ZW5pbmcgc29ja2V0OiAiICsgc3guTWVzc2FnZSwgc3gpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogCiAgICAgICAgIHByb3RlY3RlZCBvdmVycmlkZSBUVHJhbnNwb3J0IEFjY2VwdEltcGwoKQogICAgICAgICB7CkBAIC0xNDIsNyArMTQyLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgY2F0Y2ggKFN5c3RlbS5FeGNlcHRpb24pCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvLyBJZiBhIFRTb2NrZXQgd2FzIHN1Y2Nlc3NmdWxseSBjcmVhdGVkLCB0aGVuIGxldCAKKyAgICAgICAgICAgICAgICAgICAgLy8gSWYgYSBUU29ja2V0IHdhcyBzdWNjZXNzZnVsbHkgY3JlYXRlZCwgdGhlbiBsZXQKICAgICAgICAgICAgICAgICAgICAgLy8gaXQgZG8gcHJvcGVyIGNsZWFudXAgb2YgdGhlIFRjcENsaWVudCBvYmplY3QuCiAgICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQyICE9IG51bGwpCiAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQyLkRpc3Bvc2UoKTsKQEAgLTE1MywyNCArMTUzLDI0IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQogICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKGV4LlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKGV4LlRvU3RyaW5nKCksIGV4KTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKLQkJewotCQkJaWYgKHNlcnZlciAhPSBudWxsKQotCQkJewotCQkJCXRyeQotCQkJCXsKLQkJCQkJc2VydmVyLlN0b3AoKTsKLQkJCQl9Ci0JCQkJY2F0Y2ggKEV4Y2VwdGlvbiBleCkKLQkJCQl7Ci0JCQkJCXRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJXQVJOSU5HOiBDb3VsZCBub3QgY2xvc2Ugc2VydmVyIHNvY2tldDogIiArIGV4KTsKLQkJCQl9Ci0JCQkJc2VydmVyID0gbnVsbDsKLQkJCX0KLQkJfQotCX0KKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHNlcnZlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc2VydmVyLlN0b3AoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJXQVJOSU5HOiBDb3VsZCBub3QgY2xvc2Ugc2VydmVyIHNvY2tldDogIiArIGV4LCBleCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNlcnZlciA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CiB9CmRpZmYgLS1naXQgYS9saWIvY3NoYXJwL3NyYy9UcmFuc3BvcnQvVFNlcnZlclRyYW5zcG9ydC5jcyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UU2VydmVyVHJhbnNwb3J0LmNzCmluZGV4IGM5OWQwN2YuLmU2Mzg4MGIgMTAwNjQ0Ci0tLSBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UU2VydmVyVHJhbnNwb3J0LmNzCisrKyBiL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UU2VydmVy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eW5jQ29tcGxldGUgPSBuZXcgTWFudWFsUmVzZXRFdmVudChmYWxzZSk7CisgICAgICAgIHB1YmxpYyBldmVudCBFdmVudEhhbmRsZXI8U29ja2V0QXN5bmNFdmVudEFyZ3M+IGNvbm5lY3RIYW5kbGVyID0gbnVsbDsKKworICAgICAgICAvLyBtZW1vcnkgc3RyZWFtIGZvciB3cml0ZSBjYWNoZS4KKyAgICAgICAgcHJpdmF0ZSBNZW1vcnlTdHJlYW0gb3V0cHV0U3RyZWFtID0gbmV3IE1lbW9yeVN0cmVhbSgpOworCisgICAgICAgIHByaXZhdGUgc3RyaW5nIGhvc3QgPSBudWxsOworICAgICAgICBwcml2YXRlIGludCBwb3J0ID0gMDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgdGltZW91dCA9IDA7CisKKyAgICAgICAgLy8gY29uc3RydWN0b3IKKyAgICAgICAgcHVibGljIFRTaWx2ZXJsaWdodFNvY2tldChzdHJpbmcgaG9zdCwgaW50IHBvcnQpCisgICAgICAgICAgICA6IHRoaXMoaG9zdCwgcG9ydCwgMCkKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgLy8gY29uc3RydWN0b3IKKyAgICAgICAgcHVibGljIFRTaWx2ZXJsaWdodFNvY2tldChzdHJpbmcgaG9zdCwgaW50IHBvcnQsIGludCB0aW1lb3V0KQorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLmhvc3QgPSBob3N0OworICAgICAgICAgICAgdGhpcy5wb3J0ID0gcG9ydDsKKyAgICAgICAgICAgIHRoaXMudGltZW91dCA9IHRpbWVvdXQ7CisKKyAgICAgICAgICAgIEluaXRTb2NrZXQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBJbml0U29ja2V0KCkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gQ3JlYXRlIGEgc3RyZWFtLWJhc2VkLCBUQ1Agc29ja2V0IHVzaW5nIHRoZSBJbnRlck5ldHdvcmsgQWRkcmVzcyBGYW1pbHkuCisgICAgICAgICAgICBzb2NrZXQgPSBuZXcgU29ja2V0KEFkZHJlc3NGYW1pbHkuSW50ZXJOZXR3b3JrLCBTb2NrZXRUeXBlLlN0cmVhbSwgUHJvdG9jb2xUeXBlLlRjcCk7CisgICAgICAgICAgICBzb2NrZXQuTm9EZWxheSA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IFRpbWVvdXQKKyAgICAgICAgeworICAgICAgICAgICAgc2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGltZW91dCA9IHZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0cmluZyBIb3N0CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBob3N0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBQb3J0CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBwb3J0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzb2NrZXQgPT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXR1cm4gc29ja2V0LkNvbm5lY3RlZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIE9wZW4oKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5BbHJlYWR5T3BlbiwgIlNvY2tldCBhbHJlYWR5IGNvbm5lY3RlZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoc3RyaW5nLklzTnVsbE9yRW1wdHkoaG9zdCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJDYW5ub3Qgb3BlbiBudWxsIGhvc3QiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHBvcnQgPD0gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuTm90T3BlbiwgIkNhbm5vdCBvcGVuIHdpdGhvdXQgcG9ydCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoc29ja2V0ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgSW5pdFNvY2tldCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAodGltZW91dCA9PSAwKSAgICAgLy8gbm8gdGltZW91dCAtPiBpbmZpbml0ZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRpbWVvdXQgPSAxMDAwMDsgIC8vIHNldCBhIGRlZmF1bHQgdGltZW91dCBmb3IgV1AuCisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBDcmVhdGUgRG5zRW5kUG9pbnQuIFRoZSBob3N0TmFtZSBhbmQgcG9ydCBhcmUgcGFzc2VkIGluIHRvIHRoaXMgbWV0aG9kLgorICAgICAgICAgICAgICAgIERuc0VuZFBvaW50IGhvc3RFbnRyeSA9IG5ldyBEbnNFbmRQb2ludCh0aGlzLmhvc3QsIHRoaXMucG9ydCk7CisKKyAgICAgICAgICAgICAgICAvLyBDcmVhdGUgYSBTb2NrZXRBc3luY0V2ZW50QXJncyBvYmplY3QgdG8gYmUgdXNlZCBpbiB0aGUgY29ubmVjdGlvbiByZXF1ZXN0CisgICAgICAgICAgICAgICAgU29ja2V0QXN5bmNFdmVudEFyZ3Mgc29ja2V0RXZlbnRBcmcgPSBuZXcgU29ja2V0QXN5bmNFdmVudEFyZ3MoKTsKKyAgICAgICAgICAgICAgICBzb2NrZXRFdmVudEFyZy5SZW1vdGVFbmRQb2ludCA9IGhvc3RFbnRyeTsKKworICAgICAgICAgICAgICAgIC8vIElubGluZSBldmVudCBoYW5kbGVyIGZvciB0aGUgQ29tcGxldGVkIGV2ZW50LgorICAgICAgICAgICAgICAgIC8vIE5vdGU6IFRoaXMgZXZlbnQgaGFuZGxlciB3YXMgaW1wbGVtZW50ZWQgaW5saW5lIGluIG9yZGVyIHRvIG1ha2UgdGhpcyBtZXRob2Qgc2VsZi1jb250YWluZWQuCisgICAgICAgICAgICAgICAgc29ja2V0RXZlbnRBcmcuQ29tcGxldGVkICs9IG5ldyBFdmVudEhhbmRsZXI8U29ja2V0QXN5bmNFdmVudEFyZ3M+KGRlbGVnYXRlKG9iamVjdCBzLCBTb2NrZXRBc3luY0V2ZW50QXJncyBlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvbm5lY3RIYW5kbGVyICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3RIYW5kbGVyKHRoaXMsIGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSk7CisKKyAgICAgICAgICAgICAgICAvLyBNYWtlIGFuIGFzeW5jaHJvbm91cyBDb25uZWN0IHJlcXVlc3Qgb3ZlciB0aGUgc29ja2V0CisgICAgICAgICAgICAgICAgc29ja2V0LkNvbm5lY3RBc3luYyhzb2NrZXRFdmVudEFyZyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgaW50IFJlYWQoYnl0ZVtdIGJ1ZiwgaW50IG9mZiwgaW50IGxlbikKKyAgICAgICAgeworICAgICAgICAgICAgYm9vbCBfdGltZW91dCA9IHRydWU7CisgICAgICAgICAgICBzdHJpbmcgX2Vycm9yID0gbnVsbDsKKyAgICAgICAgICAgIGludCBfcmVjdkJ5dGVzID0gLTE7CisKKyAgICAgICAgICAgIGlmIChzb2NrZXQgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuTm90T3BlbiwgIlNvY2tldCBpcyBub3Qgb3BlbiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBDcmVhdGUgU29ja2V0QXN5bmNFdmVudEFyZ3MgY29udGV4dCBvYmplY3QKKyAgICAgICAgICAgIFNvY2tldEFzeW5jRXZlbnRBcmdzIHNvY2tldEV2ZW50QXJnID0gbmV3IFNvY2tldEFzeW5jRXZlbnRBcmdzKCk7CisgICAgICAgICAgICBzb2NrZXRFdmVudEFyZy5SZW1vdGVFbmRQb2ludCA9IHNvY2tldC5SZW1vdGVFbmRQb2ludDsKKworICAgICAgICAgICAgLy8gU2V0dXAgdGhlIGJ1ZmZlciB0byByZWNlaXZlIHRoZSBkYXRhCisgICAgICAgICAgICBzb2NrZXRFdmVudEFyZy5TZXRCdWZmZXIoYnVmLCBvZmYsIGxlbik7CisKKyAgICAgICAgICAgIC8vIElubGluZSBldmVudCBoYW5kbGVyIGZvciB0aGUgQ29tcGxldGVkIGV2ZW50LgorICAgICAgICAgICAgLy8gTm90ZTogVGhpcyBldmVuIGhhbmRsZXIgd2FzIGltcGxlbWVudGVkIGlubGluZSBpbiBvcmRlciB0byBtYWtlCisgICAgICAgICAgICAvLyB0aGlzIG1ldGhvZCBzZWxmLWNvbnRhaW5lZC4KKyAgICAgICAgICAgIHNvY2tldEV2ZW50QXJnLkNvbXBsZXRlZCArPSBuZXcgRXZlbnRIYW5kbGVyPFNvY2tldEFzeW5jRXZlbnRBcmdzPihkZWxlZ2F0ZShvYmplY3QgcywgU29ja2V0QXN5bmNFdmVudEFyZ3MgZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBfdGltZW91dCA9IGZhbHNlOworCisgICAgICAgICAgICAgICAgaWYgKGUuU29ja2V0RXJyb3IgPT0gU29ja2V0RXJyb3IuU3VjY2VzcykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9yZWN2Qnl0ZXMgPSBlLkJ5dGVzVHJhbnNmZXJyZWQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9lcnJvciA9IGUuU29ja2V0RXJyb3IuVG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZWFkQXN5bmNDb21wbGV0ZS5TZXQoKTsKKyAgICAgICAgICAgIH0pOworCisgICAgICAgICAgICAvLyBTZXRzIHRoZSBzdGF0ZSBvZiB0aGUgZXZlbnQgdG8gbm9uc2lnbmFsZWQsIGNhdXNpbmcgdGhyZWFkcyB0byBibG9jaworICAgICAgICAgICAgcmVhZEFzeW5jQ29tcGxldGUuUmVzZXQoKTsKKworICAgICAgICAgICAgLy8gTWFrZSBhbiBhc3luY2hyb25vdXMgUmVjZWl2ZSByZXF1ZXN0IG92ZXIgdGhlIHNvY2tldAorICAgICAgICAgICAgc29ja2V0LlJlY2VpdmVBc3luYyhzb2NrZXRFdmVudEFyZyk7CisKKyAgICAgICAgICAgIC8vIEJsb2NrIHRoZSBVSSB0aHJlYWQgZm9yIGEgbWF4aW11bSBvZiBUSU1FT1VUX01JTExJU0VDT05EUyBtaWxsaXNlY29uZHMuCisgICAgICAgICAgICAvLyBJZiBubyByZXNwb25zZSBjb21lcyBiYWNrIHdpdGhpbiB0aGlzIHRpbWUgdGhlbiBwcm9jZWVkCisgICAgICAgICAgICByZWFkQXN5bmNDb21wbGV0ZS5XYWl0T25lKHRoaXMudGltZW91dCk7CisKKyAgICAgICAgICAgIGlmIChfdGltZW91dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuVGltZWRPdXQsICJTb2NrZXQgcmVjdiB0aW1lb3V0Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfZXJyb3IgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuVW5rbm93biwgX2Vycm9yKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIF9yZWN2Qnl0ZXM7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZShieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBvdXRwdXRTdHJlYW0uV3JpdGUoYnVmLCBvZmYsIGxlbik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgYmVnaW5GbHVzaF9Db21wbGV0ZWQob2JqZWN0IHNlbmRlciwgU29ja2V0QXN5bmNFdmVudEFyZ3MgZSkKKyAgICAgICAgeworICAgICAgICAgICAgRmx1c2hBc3luY1Jlc3VsdCBmbHVzaEFzeW5j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vY2tldEV2ZW50QXJnLlVzZXJUb2tlbiA9IGZsdXNoQXN5bmNSZXN1bHQ7CisKKyAgICAgICAgICAgIHNvY2tldEV2ZW50QXJnLkNvbXBsZXRlZCArPSBiZWdpbkZsdXNoX0NvbXBsZXRlZDsKKyAgICAgICAgICAgIHNvY2tldEV2ZW50QXJnLlNldEJ1ZmZlcihkYXRhLCAwLCBkYXRhLkxlbmd0aCk7CisKKyAgICAgICAgICAgIHNvY2tldC5TZW5kQXN5bmMoc29ja2V0RXZlbnRBcmcpOworCisgICAgICAgICAgICByZXR1cm4gZmx1c2hBc3luY1Jlc3VsdDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIEVuZEZsdXNoKElBc3luY1Jlc3VsdCBhc3luY1Jlc3VsdCkKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGZsdXNoQXN5bmNSZXN1bHQgPSAoRmx1c2hBc3luY1Jlc3VsdClhc3luY1Jlc3VsdDsKKworICAgICAgICAgICAgICAgIGlmICghZmx1c2hBc3luY1Jlc3VsdC5Jc0NvbXBsZXRlZCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciB3YWl0SGFuZGxlID0gZmx1c2hBc3luY1Jlc3VsdC5Bc3luY1dhaXRIYW5kbGU7CisgICAgICAgICAgICAgICAgICAgIHdhaXRIYW5kbGUuV2FpdE9uZSgpOworICAgICAgICAgICAgICAgICAgICB3YWl0SGFuZGxlLkNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKGZsdXNoQXN5bmNSZXN1bHQuQXN5bmNFeGNlcHRpb24gIT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IGZsdXNoQXN5bmNSZXN1bHQuQXN5bmNFeGNlcHRpb247CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbSA9IG5ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIENvcHkgZnJvbSBpbXBsIGZyb20gVEh0dHBDbGllbnQuY3MKKyAgICAgICAgLy8gQmFzZWQgb24gaHR0cDovL21zbXZwcy5jb20vYmxvZ3MvbHVpc2FicmV1L2FyY2hpdmUvMjAwOS8wNi8xNS9tdWx0aXRocmVhZGluZy1pbXBsZW1lbnRpbmctdGhlLWlhc3luY3Jlc3VsdC1pbnRlcmZhY2UuYXNweAorICAgICAgICBjbGFzcyBGbHVzaEFzeW5jUmVzdWx0IDogSUFzeW5jUmVzdWx0CisgICAgICAgIHsKKyAgICAgICAgICAgIHByaXZhdGUgdm9sYXRpbGUgQm9vbGVhbiBfaXNDb21wbGV0ZWQ7CisgICAgICAgICAgICBwcml2YXRlIE1hbnVhbFJlc2V0RXZlbnQgX2V2dDsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgQXN5bmNDYWxsYmFjayBfY2JNZXRob2Q7CisgICAgICAgICAgICBwcml2YXRlIHJlYWRvbmx5IG9iamVjdCBfc3RhdGU7CisKKyAgICAgICAgICAgIHB1YmxpYyBGbHVzaEFzeW5jUmVzdWx0KEFzeW5jQ2FsbGJhY2sgY2JNZXRob2QsIG9iamVjdCBzdGF0ZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBfY2JNZXRob2QgPSBjYk1ldGhvZDsKKyAgICAgICAgICAgICAgICBfc3RhdGUgPSBzdGF0ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50ZXJuYWwgYnl0ZVtdIERhdGEgeyBnZXQ7IHNldDsgfQorICAgICAgICAgICAgaW50ZXJuYWwgU29ja2V0IENvbm5lY3Rpb24geyBnZXQ7IHNldDsgfQorICAgICAgICAgICAgaW50ZXJuYWwgVFRyYW5zcG9ydEV4Y2VwdGlvbiBBc3luY0V4Y2VwdGlvbiB7IGdldDsgc2V0OyB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvYmplY3QgQXN5bmNTdGF0ZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGdldCB7IHJldHVybiBfc3RhdGU7IH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFdhaXRIYW5kbGUgQXN5bmNXYWl0SGFuZGxlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIEdldEV2dEhhbmRsZSgpOyB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBib29sIENvbXBsZXRlZFN5bmNocm9ub3VzbHkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBnZXQgeyByZXR1cm4gZmFsc2U7IH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGJvb2wgSXNDb21wbGV0ZWQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBnZXQgeyByZXR1cm4gX2lzQ29tcGxldGVkOyB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgb2JqZWN0IF9sb2NrZXIgPSBuZXcgb2JqZWN0KCk7CisKKyAgICAgICAgICAgIHByaXZhdGUgTWFudWFsUmVzZXRFdmVudCBHZXRFdnRIYW5kbGUoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvY2sgKF9sb2NrZXIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoX2V2dCA9PSBudWxsKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBfZXZ0ID0gbmV3IE1hbnVhbFJlc2V0RXZlbnQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChfaXNDb21wbGV0ZWQpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIF9ldnQuU2V0KCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIF9ldnQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGludGVybmFsIHZvaWQgVXBkYXRlU3RhdHVzVG9Db21wbGV0ZSgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX2lzQ29tcGxldGVkID0gdHJ1ZTsgLy8xLiBzZXQgX2lzY29tcGxldGVkIHRvIHRydWUKKyAgICAgICAgICAgICAgICBsb2NrIChfbG9ja2VyKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKF9ldnQgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgX2V2dC5TZXQoKTsgLy8yLiBzZXQgdGhlIGV2ZW50LCB3aGVuIGl0IGV4aXN0cworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnRlcm5hbCB2b2lkIE5vdGlmeUNhbGxiYWNrV2hlbkF2YWlsYWJsZSgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKF9jYk1ldGhvZCAhPSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX2NiTWV0aG9kKHRoaXMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHNvY2tldCAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNvY2tldC5DbG9zZSgpOworICAgICAgICAgICAgICAgIHNvY2tldCA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworI3JlZ2lvbiAiIElEaXNwb3NhYmxlIFN1cHBvcnQgIgorICAgICAgICBwcml2YXRlIGJvb2wgX0lzRGlzcG9zZWQ7CisKKyAgICAgICAgLy8gSURpc3Bvc2FibGUKKyAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgRGlzcG9zZShib29sIGRpc3Bvc2luZykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCFfSXNEaXNwb3NlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZGlzcG9zaW5nKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmIChzb2NrZXQgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgKChJRGlzcG9zYWJsZSlzb2NrZXQpLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF9Jc0Rpc3Bvc2VkID0gdHJ1ZTsKKyAgICAgICAgfQorI2VuZHJlZ2lvbgorICAgIH0KK30KKworCisjZW5kaWYKZGlmZiAtLWdpdCBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UU29ja2V0LmNzIGIvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RTb2NrZXQuY3MKaW5kZXggMWQ1MDk2OC4uZDhmYTMzNSAxMDA2NDQKLS0tIGEvbGliL2NzaGFycC9z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AgICAgICAgICAgIHRoaXMuY2xpZW50ID0gVFNvY2tldFZlcnNpb25pemVyLkNyZWF0ZVRjcENsaWVudCgpOworICAgICAgICAgICAgdGhpcy5jbGllbnQuUmVjZWl2ZVRpbWVvdXQgPSBjbGllbnQuU2VuZFRpbWVvdXQgPSB0aW1lb3V0OworICAgICAgICAgICAgdGhpcy5jbGllbnQuQ2xpZW50Lk5vRGVsYXkgPSB0cnVlOworICAgICAgICB9CiAKLQkJcHVibGljIGludCBUaW1lb3V0Ci0JCXsKLQkJCXNldAotCQkJewotCQkJCWNsaWVudC5SZWNlaXZlVGltZW91dCA9IGNsaWVudC5TZW5kVGltZW91dCA9IHRpbWVvdXQgPSB2YWx1ZTsKLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgaW50IFRpbWVvdXQKKyAgICAgICAgeworICAgICAgICAgICAgc2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2xpZW50LlJlY2VpdmVUaW1lb3V0ID0gY2xpZW50LlNlbmRUaW1lb3V0ID0gdGltZW91dCA9IHZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIFRjcENsaWVudCBUY3BDbGllbnQKLQkJewotCQkJZ2V0Ci0JCQl7Ci0JCQkJcmV0dXJuIGNsaWVudDsKLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgVGNwQ2xpZW50IFRjcENsaWVudAorICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gY2xpZW50OworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIHN0cmluZyBIb3N0Ci0JCXsKLQkJCWdldAotCQkJewotCQkJCXJldHVybiBob3N0OwotCQkJfQotCQl9CisgICAgICAgIHB1YmxpYyBzdHJpbmcgSG9zdAorICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaG9zdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogCi0JCXB1YmxpYyBpbnQgUG9ydAotCQl7Ci0JCQlnZXQKLQkJCXsKLQkJCQlyZXR1cm4gcG9ydDsKLQkJCX0KLQkJfQorICAgICAgICBwdWJsaWMgaW50IFBvcnQKKyAgICAgICAgeworICAgICAgICAgICAgZ2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHBvcnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KIAotCQlwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KLQkJewotCQkJZ2V0Ci0JCQl7Ci0JCQkJaWYgKGNsaWVudCA9PSBudWxsKQotCQkJCXsKLQkJCQkJcmV0dXJuIGZhbHNlOwotCQkJCX0KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChjbGllbnQgPT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CiAKLQkJCQlyZXR1cm4gY2xpZW50LkNvbm5lY3RlZDsKLQkJCX0KLQkJfQorICAgICAgICAgICAgICAgIHJldHVybiBjbGllbnQuQ29ubmVjdGVkOworICAgICAgICAgICAgfQorICAgICAgICB9CiAKLQkJcHVibGljIG92ZXJyaWRlIHZvaWQgT3BlbigpCi0JCXsKLQkJCWlmIChJc09wZW4pCi0JCQl7Ci0JCQkJdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkFscmVhZHlPcGVuLCAiU29ja2V0IGFscmVhZHkgY29ubmVjdGVkIik7Ci0JCQl9CisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIE9wZW4oKQorICAgICAgICB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ICAgICAgICAgICB9CiAKLQkJCWlmIChjbGllbnQgPT0gbnVsbCkKLQkJCXsKLQkJCQlJbml0U29ja2V0KCk7Ci0JCQl9CisgICAgICAgICAgICBpZiAoY2xpZW50ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgSW5pdFNvY2tldCgpOworICAgICAgICAgICAgfQogCi0JCQlpZiggdGltZW91dCA9PSAwKQkJCS8vIG5vIHRpbWVvdXQgLT4gaW5maW5pdGUKLQkJCXsKLQkJCQljbGllbnQuQ29ubmVjdChob3N0LCBwb3J0KTsKLQkJCX0KLQkJCWVsc2UgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBoYXZlIGEgdGltZW91dCAtPiB1c2UgaXQKLQkJCXsKKyAgICAgICAgICAgIGlmICh0aW1lb3V0ID09IDApICAgICAgICAgICAgLy8gbm8gdGltZW91dCAtPiBpbmZpbml0ZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudC5Db25uZWN0KGhvc3QsIHBvcnQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIGhhdmUgYSB0aW1lb3V0IC0+IHVzZSBpdAorICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIENvbm5lY3RIZWxwZXIgaGxwID0gbmV3IENvbm5lY3RIZWxwZXIoY2xpZW50KTsKICAgICAgICAgICAgICAgICBJQXN5bmNSZXN1bHQgYXN5bmNyZXMgPSBjbGllbnQuQmVnaW5Db25uZWN0KGhvc3QsIHBvcnQsIG5ldyBBc3luY0NhbGxiYWNrKENvbm5lY3RDYWxsYmFjayksIGhscCk7CiAgICAgICAgICAgICAgICAgYm9vbCBiQ29ubmVjdGVkID0gYXN5bmNyZXMuQXN5bmNXYWl0SGFuZGxlLldhaXRPbmUodGltZW91dCkgJiYgY2xpZW50LkNvbm5lY3RlZDsKQEAgLTE0NCw3ICsxNDUsNyBAQAogICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgbG9jayAoaGxwLk11dGV4KQogICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiggaGxwLkNhbGxiYWNrRG9uZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobHAuQ2FsbGJhY2tEb25lKQogICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFzeW5jcmVzLkFzeW5jV2FpdEhhbmRsZS5DbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudC5DbG9zZSgpOwpAQCAtMTU3LDExICsxNTgsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuVGltZWRPdXQsICJDb25uZWN0IHRpbWVkIG91dCIpOwogICAgICAgICAgICAgICAgIH0KLQkJCX0KKyAgICAgICAgICAgIH0KIAotCQkJaW5wdXRTdHJlYW0gPSBjbGllbnQuR2V0U3RyZWFtKCk7Ci0JCQlvdXRwdXRTdHJlYW0gPSBjbGllbnQuR2V0U3RyZWFtKCk7Ci0JCX0KKyAgICAgICAgICAgIGlucHV0U3RyZWFtID0gY2xpZW50LkdldFN0cmVhbSgpOworICAgICAgICAgICAgb3V0cHV0U3RyZWFtID0gY2xpZW50LkdldFN0cmVhbSgpOworICAgICAgICB9CiAKIAogICAgICAgICBzdGF0aWMgdm9pZCBDb25uZWN0Q2FsbGJhY2soSUFzeW5jUmVzdWx0IGFzeW5jcmVzKQpAQCAtMTcwLDIyICsxNzEsMzEgQEAKICAgICAgICAgICAgIGxvY2sgKGhscC5NdXRleCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBobHAuQ2FsbGJhY2tEb25lID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgCisKICAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGlmKCBobHAuQ2xpZW50LkNsaWVudCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICBpZiAoaGxwLkNsaWVudC5DbGllbnQgIT0gbnVsbCkKICAgICAgICAgICAgICAgICAgICAgICAgIGhscC5DbGllbnQuRW5kQ29ubmVjdChhc3luY3Jlcyk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhdGNoIChTb2NrZXRFeGNlcHRpb24pCisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIC8vIGNhdGNoIHRoYXQgYXdheQogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChobHAuRG9DbGVhbnVwKSAKKyAgICAgICAgICAgICAgICBpZiAoaGxwLkRvQ2xlYW51cCkKICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGFzeW5jcmVzLkFzeW5jV2FpdEhhbmRsZS5DbG9zZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAoaGxwLkNsaWVudCBpcyBJRGlzcG9zYWJsZSkKLSAgICAgICAgICAgICAgICAgICAgICAgICgoSURpc3Bvc2FibGUpaGxwLkNsaWVudCkuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgYXN5bmNyZXMuQXN5bmNXYWl0SGFuZGxlLkNsb3NlKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikgeyB9CisKKyAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobHAuQ2xpZW50IGlzIElEaXNwb3NhYmxlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoSURpc3Bvc2FibGUpaGxwLkNsaWVudCkuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24pIHsgfQogICAgICAgICAgICAgICAgICAgICBobHAuQ2xpZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CkBAIC0yMDMsMzMgKzIxMywzMyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAKLQkJcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQotCQl7Ci0JCQliYXNlLkNsb3NlKCk7Ci0JCQlpZiAoY2xpZW50ICE9IG51bGwpCi0JCQl7Ci0JCQkJY2xpZW50LkNsb3NlKCk7Ci0JCQkJY2xpZW50ID0gbnVsbDsKLQkJCX0KLQkJfQotCi0gICAgI3JlZ2lvbiAiIElEaXNwb3NhYmxlIFN1cHBvcnQgIgotICAgIHByaXZhdGUgYm9vbCBfSXNEaXNwb3NlZDsKLQotICAgIC8vIElEaXNwb3NhYmxlCi0gICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgRGlzcG9zZShib29sIGRpc3Bvc2luZykKLSAgICB7Ci0gICAgICBpZiAoIV9Jc0Rpc3Bvc2VkKQotICAgICAgewotICAgICAgICBpZiAoZGlzcG9zaW5nKQorICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCiAgICAgICAgIHsKLSAgICAgICAgICBpZiAoY2xpZW50ICE9IG51bGwpCi0gICAgICAgICAgICAoKElEaXNwb3NhYmxlKWNsaWVudCkuRGlzcG9zZSgpOwotICAgICAgICAgIGJhc2UuRGlzcG9zZShkaXNwb3NpbmcpOworICAgICAgICAgICAgYmFzZS5DbG9zZSgpOworICAgICAgICAgICAgaWYgKGNsaWVudCAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudC5DbG9zZSgpOworICAgICAgICAgICAgICAgIGNsaWVudCA9IG51bGw7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgIH0KLSAgICAgIF9Jc0Rpc3Bvc2VkID0gdHJ1ZTsKKworICAgICAgICAjcmVnaW9uICIgSURpc3Bvc2FibGUgU3VwcG9ydCAiCisgICAgICAgIHByaXZhdGUgYm9vbCBfSXNEaXNwb3NlZDsKKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9Jc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoY2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAoKElEaXNwb3NhYmxlKWNsaWVudCkuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBiYXNlLkRpc3Bvc2UoZGlzcG9zaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfSXNEaXNwb3NlZCA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgI2VuZHJlZ2lvbgogICAgIH0KLSAgICAjZW5kcmVnaW9uCi0gIH0KIH0KZGlmZiAtLWdpdCBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UU29ja2V0VmVyc2lvbml6ZXIuY3MgYi9saWIvY3NoYXJwL3NyYy9UcmFuc3BvcnQvVFNvY2tldFZlcnNpb25pemVyLmNzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmJmNGMwZTQKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvY3NoYXJwL3NyYy9UcmFuc3Bvc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RoZXIgSVB2NCBvciBJUHY2IGlzIHVzZWQuCisgICAgLy8vIDwvc3VtbWFyeT4KKyAgICBpbnRlcm5hbCBzdGF0aWMgY2xhc3MgVFNvY2tldFZlcnNpb25pemVyCisgICAgeworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBDcmVhdGVzIGEgVGNwQ2xpZW50IGFjY29yZGluZyB0byB0aGUgY2FwYWJpbGl0aXRlcyBvZiB0aGUgdXNlZCBmcmFtZXdvcmsKKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgaW50ZXJuYWwgc3RhdGljIFRjcENsaWVudCBDcmVhdGVUY3BDbGllbnQoKQorICAgICAgICB7CisgICAgICAgICAgICBUY3BDbGllbnQgY2xpZW50ID0gbnVsbDsKKworI2lmIE5FVDQ1CisgICAgICAgICAgICBjbGllbnQgPSBuZXcgVGNwQ2xpZW50KEFkZHJlc3NGYW1pbHkuSW50ZXJOZXR3b3JrVjYpOworICAgICAgICAgICAgY2xpZW50LkNsaWVudC5EdWFsTW9kZSA9IHRydWU7CisjZWxzZQorICAgICAgICAgICAgY2xpZW50ID0gbmV3IFRjcENsaWVudChBZGRyZXNzRmFtaWx5LkludGVyTmV0d29yayk7CisjZW5kaWYKKworICAgICAgICAgICAgcmV0dXJuIGNsaWVudDsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIENyZWF0ZXMgYSBUY3BMaXN0ZW5lciBhY2NvcmRpbmcgdG8gdGhlIGNhcGFiaWxpdGl0ZXMgb2YgdGhlIHVzZWQgZnJhbWV3b3JrLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBpbnRlcm5hbCBzdGF0aWMgVGNwTGlzdGVuZXIgQ3JlYXRlVGNwTGlzdGVuZXIoSW50MzIgcG9ydCkKKyAgICAgICAgeworICAgICAgICAgICAgVGNwTGlzdGVuZXIgbGlzdGVuZXIgPSBudWxsOworCisjaWYgT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wcm90ZWN0ZWQgU3RyZWFtIGlucHV0U3RyZWFtOworICAgICAgICBwcm90ZWN0ZWQgU3RyZWFtIG91dHB1dFN0cmVhbTsKKworICAgICAgICBwcm90ZWN0ZWQgVFN0cmVhbVRyYW5zcG9ydCgpCiAgICAgICAgIHsKLSAgICAgICAgICBpZiAoSW5wdXRTdHJlYW0gIT0gbnVsbCkKLSAgICAgICAgICAgIElucHV0U3RyZWFtLkRpc3Bvc2UoKTsKLSAgICAgICAgICBpZiAoT3V0cHV0U3RyZWFtICE9IG51bGwpCi0gICAgICAgICAgICBPdXRwdXRTdHJlYW0uRGlzcG9zZSgpOwogICAgICAgICB9Ci0gICAgICB9Ci0gICAgICBfSXNEaXNwb3NlZCA9IHRydWU7CisKKyAgICAgICAgcHVibGljIFRTdHJlYW1UcmFuc3BvcnQoU3RyZWFtIGlucHV0U3RyZWFtLCBTdHJlYW0gb3V0cHV0U3RyZWFtKQorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLmlucHV0U3RyZWFtID0gaW5wdXRTdHJlYW07CisgICAgICAgICAgICB0aGlzLm91dHB1dFN0cmVhbSA9IG91dHB1dFN0cmVhbTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBTdHJlYW0gT3V0cHV0U3RyZWFtCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldCB7IHJldHVybiBvdXRwdXRTdHJlYW07IH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBTdHJlYW0gSW5wdXRTdHJlYW0KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIGlucHV0U3RyZWFtOyB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0IHsgcmV0dXJuIHRydWU7IH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIE9wZW4oKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChpbnB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlucHV0U3RyZWFtLkNsb3NlKCk7CisgICAgICAgICAgICAgICAgaW5wdXRTdHJlYW0gPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG91dHB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbS5DbG9zZSgpOworICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbSA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgaW50IFJlYWQoYnl0ZVtdIGJ1ZiwgaW50IG9mZiwgaW50IGxlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGlucHV0U3RyZWFtID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJDYW5ub3QgcmVhZCBmcm9tIG51bGwgaW5wdXRzdHJlYW0iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGlucHV0U3RyZWFtLlJlYWQoYnVmLCBvZmYsIGxlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBXcml0ZShieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAob3V0cHV0U3RyZWFtID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJDYW5ub3Qgd3JpdGUgdG8gbnVsbCBvdXRwdXRzdHJlYW0iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgb3V0cHV0U3RyZWFtLldyaXRlKGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgRmx1c2goKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAob3V0cHV0U3RyZWFtID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJDYW5ub3QgZmx1c2ggbnVsbCBvdXRwdXRzdHJlYW0iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgb3V0cHV0U3RyZWFtLkZsdXNoKCk7CisgICAgICAgIH0KKworCisgICAgICAgICNyZWdpb24gIiBJRGlzcG9zYWJsZSBTdXBwb3J0ICIKKyAgICAgICAgcHJpdmF0ZSBib29sIF9Jc0Rpc3Bvc2VkOworCisgICAgICAgIC8vIElEaXNwb3NhYmxlCisgICAgICAgIHByb3RlY3RlZCBvdmVycmlkZSB2b2lkIERpc3Bvc2UoYm9vbCBkaXNwb3NpbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICghX0lzRGlzcG9zZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGRpc3Bvc2luZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChJbnB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgSW5wdXRTdHJlYW0uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoT3V0cHV0U3RyZWFtICE9IG51bGwpCisgICAgICAgICAgIC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lIHNlcnZlciBzb2NrZXQKKyAgICAgICAgICAgICAgICB0aGlzLnNlcnZlciA9IFRTb2NrZXRWZXJzaW9uaXplci5DcmVhdGVUY3BMaXN0ZW5lcih0aGlzLnBvcnQpOworICAgICAgICAgICAgICAgIHRoaXMuc2VydmVyLlNlcnZlci5Ob0RlbGF5ID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc2VydmVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigiQ291bGQgbm90IGNyZWF0ZSBTZXJ2ZXJTb2NrZXQgb24gcG9ydCAiICsgdGhpcy5wb3J0ICsgIi4iLCBleCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBTdGFydHMgdGhlIHNlcnZlci4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgTGlzdGVuKCkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gTWFrZSBzdXJlIGFjY2VwdCBpcyBub3QgYmxvY2tpbmcKKyAgICAgICAgICAgIGlmICh0aGlzLnNlcnZlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXJ2ZXIuU3RhcnQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKFNvY2tldEV4Y2VwdGlvbiBzeCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJDb3VsZCBub3QgYWNjZXB0IG9uIGxpc3RlbmluZyBzb2NrZXQ6ICIgKyBzeC5NZXNzYWdlLCBzeCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gQ2FsbGJhY2sgZm9yIEFjY2VwdCBJbXBsZW1lbnRhdGlvbgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICAvLy8gPHJldHVybnM+CisgICAgICAgIC8vLyBUVHJhbnNwb3J0LW9iamVjdC4KKyAgICAgICAgLy8vIDwvcmV0dXJucz4KKyAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIFRUcmFuc3BvcnQgQWNjZXB0SW1wbCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICh0aGlzLnNlcnZlciA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiTm8gdW5kZXJseWluZyBzZXJ2ZXIgc29ja2V0LiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBUY3BDbGllbnQgY2xpZW50ID0gdGhpcy5zZXJ2ZXIuQWNjZXB0VGNwQ2xpZW50KCk7CisgICAgICAgICAgICAgICAgY2xpZW50LlNlbmRUaW1lb3V0ID0gY2xpZW50LlJlY2VpdmVUaW1lb3V0ID0gdGhpcy5jbGllbnRUaW1lb3V0OworCisgICAgICAgICAgICAgICAgLy93cmFwIHRoZSBjbGllbnQgaW4gYW4gU1NMIFNvY2tldCBwYXNzaW5nIGluIHRoZSBTU0wgY2VydAorICAgICAgICAgICAgICAgIFRUTFNTb2NrZXQgc29ja2V0ID0gbmV3IFRUTFNTb2NrZXQoCisgICAgICAgICAgICAgICAgICAgIGNsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXJ2ZXJDZXJ0aWZpY2F0ZSwKKyAgICAgICAgICAgICAgICAgICAgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGllbnRDZXJ0VmFsaWRhdG9yLAorICAgICAgICAgICAgICAgICAgICB0aGlzLmxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjaywKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5zc2xQcm90b2NvbHMpOworCisgICAgICAgICAgICAgICAgc29ja2V0LnNldHVwVExTKCk7CisKKyAgICAgICAgICAgICAgICBpZiAodXNlQnVmZmVyZWRTb2NrZXRzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgVEJ1ZmZlcmVkVHJhbnNwb3J0IHRyYW5zID0gbmV3IFRCdWZmZXJlZFRyYW5zcG9ydChzb2NrZXQpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzb2NrZXQ7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKGV4LlRvU3RyaW5nKCksIGV4KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIFN0b3BzIHRoZSBTZXJ2ZXIKKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAodGhpcy5zZXJ2ZXIgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgIC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25DYWxsYmFjayBsb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgPSBudWxsLAorICAgICAgICAgICAgU3NsUHJvdG9jb2xzIHNzbFByb3RvY29scyA9IFNzbFByb3RvY29scy5UbHMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRoaXMuaG9zdCA9IGhvc3Q7CisgICAgICAgICAgICB0aGlzLnBvcnQgPSBwb3J0OworICAgICAgICAgICAgdGhpcy50aW1lb3V0ID0gdGltZW91dDsKKyAgICAgICAgICAgIHRoaXMuY2VydGlmaWNhdGUgPSBjZXJ0aWZpY2F0ZTsKKyAgICAgICAgICAgIHRoaXMuY2VydFZhbGlkYXRvciA9IGNlcnRWYWxpZGF0b3I7CisgICAgICAgICAgICB0aGlzLmxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayA9IGxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjazsKKyAgICAgICAgICAgIHRoaXMuc3NsUHJvdG9jb2xzID0gc3NsUHJvdG9jb2xzOworCisgICAgICAgICAgICBJbml0U29ja2V0KCk7CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBDcmVhdGVzIHRoZSBUY3BDbGllbnQgYW5kIHNldHMgdGhlIHRpbWVvdXRzCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByaXZhdGUgdm9pZCBJbml0U29ja2V0KCkKKyAgICAgICAgeworICAgICAgICAgICAgY2xpZW50ID0gVFNvY2tldFZlcnNpb25pemVyLkNyZWF0ZVRjcENsaWVudCgpOworICAgICAgICAgICAgY2xpZW50LlJlY2VpdmVUaW1lb3V0ID0gY2xpZW50LlNlbmRUaW1lb3V0ID0gdGltZW91dDsKKyAgICAgICAgICAgIGNsaWVudC5DbGllbnQuTm9EZWxheSA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBTZXRzIFNlbmQgLyBSZWN2IFRpbWVvdXQgZm9yIElPCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHB1YmxpYyBpbnQgVGltZW91dAorICAgICAgICB7CisgICAgICAgICAgICBzZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aGlzLmNsaWVudC5SZWNlaXZlVGltZW91dCA9IHRoaXMuY2xpZW50LlNlbmRUaW1lb3V0ID0gdGhpcy50aW1lb3V0ID0gdmFsdWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBHZXRzIHRoZSBUQ1AgY2xpZW50LgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgVGNwQ2xpZW50IFRjcENsaWVudAorICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gY2xpZW50OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gR2V0cyB0aGUgaG9zdC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIHN0cmluZyBIb3N0CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBob3N0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gR2V0cyB0aGUgcG9ydC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIGludCBQb3J0CisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBwb3J0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gR2V0cyBhIHZhbHVlIGluZGljYXRpbmcgd2hldGhlciBUQ1AgQ2xpZW50IGlzIENwZW4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmICh0aGlzLmNsaWVudCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsaWVudC5Db25uZWN0ZWQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBWYWxpZGF0ZXMgdGhlIGNlcnRpZmljYXRlcyE8YnIvPgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICAvLy8gPHBhcmFtIG5hbWU9InNlbmRlciI+VGhlIHNlbmRlci1vYmplY3QuPC9wYXJhbT4KKyAgICAgICAgLy8vIDxwYXJhbSBuYW1lPSJjZXJ0aWZpY2F0ZSI+VGhlIHVzZWQgY2VydGlmaWNhdGUuPC9wYXJhbT4KKyAgICAgICAgLy8vIDxwYXJhbSBuYW1lPSJjaGFpbiI+VGhlIGNlcnRpZmljYXRlIGNoYWluLjwvcGFyYW0+CisgICAgICAgIC8vLyA8cGFyYW0gbmFtZT0ic3NsVmFsaWRhdGlvbkVycm9ycyI+QW4gZW51bSwgd2hpY2ggbGlzdHMgYWxsIHRoZSBlcnJvcnMgZnJvbSB0aGUgLk5FVCBjZXJ0aWZpY2F0ZSBjaGVjay48L3BhcmFtPgorICAgICAgICAvLy8gPHJldHVybnM+PC9yZXR1cm5zPgorICAgICAgICBwcml2YXRlIGJvb2wgRGVmYXVsdENlcnRpZmljYXRlVmFsaWRhdG9yKG9i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i5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJDYW5ub3Qgb3BlbiB3aXRob3V0IHBvcnQiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNsaWVudCA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIEluaXRTb2NrZXQoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgY2xpZW50LkNvbm5lY3QoaG9zdCwgcG9ydCk7CisKKyAgICAgICAgICAgIHNldHVwVExTKCk7CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyBDcmVhdGVzIGEgVExTLXN0cmVhbSBhbmQgbGF5cyBpdCBvdmVyIHRoZSBleGlzdGluZyBzb2NrZXQKKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIHZvaWQgc2V0dXBUTFMoKQorICAgICAgICB7CisgICAgICAgICAgICBSZW1vdGVDZXJ0aWZpY2F0ZVZhbGlkYXRpb25DYWxsYmFjayB2YWxpZGF0b3IgPSB0aGlzLmNlcnRWYWxpZGF0b3IgPz8gRGVmYXVsdENlcnRpZmljYXRlVmFsaWRhdG9yOworCisgICAgICAgICAgICBpZiAodGhpcy5sb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aGlzLnNlY3VyZVN0cmVhbSA9IG5ldyBTc2xTdHJlYW0oCisgICAgICAgICAgICAgICAgICAgIHRoaXMuY2xpZW50LkdldFN0cmVhbSgpLAorICAgICAgICAgICAgICAgICAgICBmYWxzZSwKKyAgICAgICAgICAgICAgICAgICAgdmFsaWRhdG9yLAorICAgICAgICAgICAgICAgICAgICB0aGlzLmxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjaworICAgICAgICAgICAgICAgICk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhpcy5zZWN1cmVTdHJlYW0gPSBuZXcgU3NsU3RyZWFtKAorICAgICAgICAgICAgICAgICAgICB0aGlzLmNsaWVudC5HZXRTdHJlYW0oKSwKKyAgICAgICAgICAgICAgICAgICAgZmFsc2UsCisgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRvcgorICAgICAgICAgICAgICAgICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChpc1NlcnZlcikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8vIFNlcnZlciBhdXRoZW50aWNhdGlvbgorICAgICAgICAgICAgICAgICAgICB0aGlzLnNlY3VyZVN0cmVhbS5BdXRoZW50aWNhdGVBc1NlcnZlcih0aGlzLmNlcnRpZmljYXRlLCB0aGlzLmNlcnRWYWxpZGF0b3IgIT0gbnVsbCwgc3NsUHJvdG9jb2xzLCB0cnVlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ2xpZW50IGF1dGhlbnRpY2F0aW9uCisgICAgICAgICAgICAgICAgICAgIFg1MDlDZXJ0aWZpY2F0ZUNvbGxlY3Rpb24gY2VydHMgPSBjZXJ0aWZpY2F0ZSAhPSBudWxsID8gbmV3IFg1MDlDZXJ0aWZpY2F0ZUNvbGxlY3Rpb24geyBjZXJ0aWZpY2F0ZSB9IDogbmV3IFg1MDlDZXJ0aWZpY2F0ZUNvbGxlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5zZWN1cmVTdHJlYW0uQXV0aGVudGljYXRlQXNDbGllbnQoaG9zdCwgY2VydHMsIHNzbFByb3RvY29scywgdHJ1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aGlzLkNsb3NlKCk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlucHV0U3RyZWFtID0gdGhpcy5zZWN1cmVTdHJlYW07CisgICAgICAgICAgICBvdXRwdXRTdHJlYW0gPSB0aGlzLnNlY3VyZVN0cmVhbTsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vIENsb3NlcyB0aGUgU1NMIFNvY2tldAorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGJhc2UuQ2xvc2UoKTsKKyAgICAgICAgICAgIGlmICh0aGlzLmNsaWVudCAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRoaXMuY2xpZW50LkNsb3NlKCk7CisgICAgICAgICAgICAgICAgdGhpcy5jbGllbnQgPSBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAodGhpcy5zZWN1cmVTdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aGlzLnNlY3VyZVN0cmVhbS5DbG9zZSgpOworICAgICAgICAgICAgICAgIHRoaXMuc2VjdXJlU3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL2xpYi9jc2hhcnAvc3JjL1RyYW5zcG9ydC9UVHJhbnNwb3J0LmNzIGIvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RUcmFuc3BvcnQuY3MKaW5kZXggYzAzZTljMi4uNWU0YWMyMiAxMDA2NDQKLS0tIGEvbGliL2NzaGFycC9zcmMvVHJhbnNwb3J0L1RUcmFuc3BvcnQuY3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pbnQgb2ZmLCBpbnQgbGVuKTsKKyAgICAgICAgcHVibGljIGFic3RyYWN0IGludCBSZWFkKGJ5dGVbXSBidWYsIGludCBvZmYsIGludCBsZW4pOwogCi0JCXB1YmxpYyB2aXJ0dWFsIHZvaWQgRmx1c2goKQotCQl7Ci0JCX0KLSAgICAgICAgCisgICAgICAgIHB1YmxpYyBpbnQgUmVhZEFsbChieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKQorICAgICAgICB7CisgICAgICAgICAgICBWYWxpZGF0ZUJ1ZmZlckFyZ3MoYnVmLCBvZmYsIGxlbik7CisgICAgICAgICAgICBpbnQgZ290ID0gMDsKKworICAgICAgICAgICAgLy9JZiB3ZSBwcmV2aW91c2x5IHBlZWtlZCBhIGJ5dGUsIHdlIG5lZWQgdG8gdXNlIHRoYXQgZmlyc3QuCisgICAgICAgICAgICBpZiAoX2hhc1BlZWtCeXRlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJ1ZltvZmYgKyBnb3QrK10gPSBfcGVla0J1ZmZlclswXTsKKyAgICAgICAgICAgICAgICBfaGFzUGVla0J5dGUgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd2hpbGUgKGdvdCA8IGxlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpbnQgcmV0ID0gUmVhZChidWYsIG9mZiArIGdvdCwgbGVuIC0gZ290KTsKKyAgICAgICAgICAgICAgICBpZiAocmV0IDw9IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5FbmRPZkZpbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAiQ2Fubm90IHJlYWQsIFJlbW90ZSBzaWRlIGhhcyBjbG9zZWQiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZ290ICs9IHJldDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBnb3Q7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdmlydHVhbCB2b2lkIFdyaXRlKGJ5dGVbXSBidWYpCisgICAgICAgIHsKKyAgICAgICAgICAgIFdyaXRlKGJ1ZiwgMCwgYnVmLkxlbmd0aCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBXcml0ZShieXRlW10gYnVmLCBpbnQgb2ZmLCBpbnQgbGVuKTsKKworICAgICAgICBwdWJsaWMgdmlydHVhbCB2b2lkIEZsdXNoKCkKKyAgICAgICAgeworICAgICAgICB9CisKICAgICAgICAgcHVibGljIHZpcnR1YWwgSUFzeW5jUmVzdWx0IEJlZ2luRmx1c2goQXN5bmNDYWxsYmFjayBjYWxsYmFjaywgb2JqZWN0IHN0YXRlKQogICAgICAgICB7Ci0gICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKAorICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Vbmtub3duLAorICAgICAgICAgICAgICAgICJBc3luY2hyb25vdXMgb3BlcmF0aW9ucyBhcmUgbm90IHN1cHBvcnRlZCBieSB0aGlzIHRyYW5zcG9ydC4iKTsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyB2aXJ0dWFsIHZvaWQgRW5kRmx1c2goSUFzeW5jUmVzdWx0IGFzeW5jUmVzdWx0KQogICAgICAgICB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICBUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuVW5rbm93biwKKyAgICAgICAgICAgICAgICAiQXN5bmNoc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jZXB0aW9uKEV4Y2VwdGlvblR5cGUgdHlwZSwgc3RyaW5nIG1lc3NhZ2UpCi0JCQk6IGJhc2UobWVzc2FnZSkKLQkJewotCQkJdGhpcy50eXBlID0gdHlwZTsKLQkJfQorICAgICAgICBwdWJsaWMgVFRyYW5zcG9ydEV4Y2VwdGlvbihFeGNlcHRpb25UeXBlIHR5cGUsIHN0cmluZyBtZXNzYWdlLCBFeGNlcHRpb24gaW5uZXIgPSBudWxsKQorICAgICAgICAgICAgOiBiYXNlKG1lc3NhZ2UsIGlubmVyKQorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLnR5cGUgPSB0eXBlOworICAgICAgICB9CiAKLQkJcHVibGljIFRUcmFuc3BvcnRFeGNlcHRpb24oc3RyaW5nIG1lc3NhZ2UpCi0JCQk6IGJhc2UobWVzc2FnZSkKLQkJewotCQl9CisgICAgICAgIHB1YmxpYyBUVHJhbnNwb3J0RXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlLCBFeGNlcHRpb24gaW5uZXIgPSBudWxsKQorICAgICAgICAgICAgOiBiYXNlKG1lc3NhZ2UsIGlubmVyKQorICAgICAgICB7CisgICAgICAgIH0KIAotCQlwdWJsaWMgRXhjZXB0aW9uVHlwZSBUeXBlCi0JCXsKLQkJCWdldCB7IHJldHVybiB0eXBlOyB9Ci0JCX0KKyAgICAgICAgcHVibGljIEV4Y2VwdGlvblR5cGUgVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBnZXQgeyByZXR1cm4gdHlwZTsgfQorICAgICAgICB9CiAKLQkJcHVibGljIGVudW0gRXhjZXB0aW9uVHlwZQotCQl7Ci0JCQlVbmtub3duLAotCQkJTm90T3BlbiwKLQkJCUFscmVhZHlPcGVuLAotCQkJVGltZWRPdXQsCi0JCQlFbmRPZkZpbGUKLQkJfQotCX0KKyAgICAgICAgcHVibGljIGVudW0gRXhjZXB0aW9uVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBVbmtub3duLAorICAgICAgICAgICAgTm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gc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQorICAgICAgICB7CisgICAgICAgICAgICBUZXN0VGhyaWZ0MjM2NSgpOyAgLy8gSlNPTiBiaW5hcnkgZGVjb2RlcyB0b28gbXVjaCBkYXRhCisgICAgICAgICAgICBUZXN0VGhyaWZ0MjMzNigpOyAgLy8gaGV4IGVuY29kaW5nIHVzaW5nIFx1WFhYWCB3aGVyZSAweFhYWFggPiAweEZGCisgICAgICAgICAgICBUZXN0VGhyaWZ0MzQwMygpOyAvLyBKU09OIGVzY2FwZWQgdW5pY29kZSBzdXJyb2dhdGUgcGFpciBzdXBwb3J0LgorICAgICAgICB9CisKKworICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgVGVzdFRocmlmdDIzNjUoKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgcm5kID0gbmV3IFJhbmRvbSgpOworICAgICAgICAgICAgZm9yICh2YXIgbGVuID0gMDsgbGVuIDwgMTA7ICsrbGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJ5dGVbXSBkYXRhV3JpdHRlbiA9IG5ldyBieXRlW2xlbl07CisgICAgICAgICAgICAgICAgcm5kLk5leHRCeXRlcyhkYXRhV3JpdHRlbik7CisKKyAgICAgICAgICAgICAgICBTdHJlYW0gc3RtID0gbmV3IE1lbW9yeVN0cmVhbSgpOworICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgdHJhbnMgPSBuZXcgVFN0cmVhbVRyYW5zcG9ydChudWxsLCBzdG0pOworICAgICAgICAgICAgICAgIFRQcm90b2NvbCBwcm90ID0gbmV3IFRKU09OUHJvdG9jb2wodHJhbnMpOworICAgICAgICAgICAgICAgIHByb3QuV3JpdGVCaW5hcnkoZGF0YVdyaXR0ZW4pOworCisgICAgICAgICAgICAgICAgc3RtLlBvc2l0aW9uID0gMDsKKyAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUU3RyZWFtVHJhbnNwb3J0KHN0bSwgbnVsbCk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wOCAxMDA2NDQKLS0tIGEvbGliL2NzaGFycC90ZXN0L011bHRpcGxleC9DbGllbnQvTXVsdGlwbGV4LlRlc3QuQ2xpZW50LmNzCisrKyBiL2xpYi9jc2hhcnAvdGVzdC9NdWx0aXBsZXgvQ2xpZW50L011bHRpcGxleC5UZXN0LkNsaWVudC5jcwpAQCAtMjYsMTcgKzI2LDE2IEBACiB1c2luZyBUaHJpZnQ7CiB1c2luZyBUZXN0Lk11bHRpcGxleDsKIAotCiBuYW1lc3BhY2UgVGVzdC5NdWx0aXBsZXguQ2xpZW50CiB7Ci0JcHVibGljIGNsYXNzIFRlc3RDbGllbnQKLQl7Ci0gICAgICAgIHByaXZhdGUgdm9pZCBSdW4oKQorICAgIHB1YmxpYyBjbGFzcyBUZXN0Q2xpZW50CisgICAgeworICAgICAgICBzdGF0aWMgdm9pZCBFeGVjdXRlKGludCBwb3J0KQogICAgICAgICB7CiAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBUVHJhbnNwb3J0IHRyYW5zOwotICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRTb2NrZXQoImxvY2FsaG9zdCIsIDkwOTApOworICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRTb2NrZXQoImxvY2FsaG9zdCIsIHBvcnQpOwogICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRGcmFtZWRUcmFuc3BvcnQodHJhbnMpOwogICAgICAgICAgICAgICAgIHRyYW5zLk9wZW4oKTsKIApAQCAtNDQsNDQgKzQzLDQwIEBACiAKICAgICAgICAgICAgICAgICBUTXVsdGlwbGV4ZWRQcm90b2NvbCBtdWx0aXBsZXg7CiAKLSAgICAgICAgICAgICAgICBtdWx0aXBsZXggPSBuZXcgVE11bHRpcGxleGVkUHJvdG9jb2woIFByb3RvY29sLCBDb25zdGFudHMuTkFNRV9CRU5DSE1BUktTRVJWSUNFKTsKLSAgICAgICAgICAgICAgICBCZW5jaG1hcmtTZXJ2aWNlLklmYWNlIGJlbmNoID0gbmV3IEJlbmNobWFya1NlcnZpY2UuQ2xpZW50KCBtdWx0aXBsZXgpOworICAgICAgICAgICAgICAgIG11bHRpcGxleCA9IG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChQcm90b2NvbCwgQ29uc3RhbnRzLk5BTUVfQkVOQ0hNQVJLU0VSVklDRSk7CisgICAgICAgICAgICAgICAgQmVuY2htYXJrU2VydmljZS5JZmFjZSBiZW5jaCA9IG5ldyBCZW5jaG1hcmtTZXJ2aWNlLkNsaWVudChtdWx0aXBsZXgpOwogCi0gICAgICAgICAgICAgICAgbXVsdGlwbGV4ID0gbmV3IFRNdWx0aXBsZXhlZFByb3RvY29sKCBQcm90b2NvbCwgQ29uc3RhbnRzLk5BTUVfQUdHUik7Ci0gICAgICAgICAgICAgICAgQWdnci5JZmFjZSBhZ2dyID0gbmV3IEFnZ3IuQ2xpZW50KCBtdWx0aXBsZXgpOwotICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIHNieXRlIGk7Ci0gICAgICAgICAgICAgICAgZm9yKCBpID0gMTsgMTAgPj0gaTsgKytpKQorICAgICAgICAgICAgICAgIG11bHRpcGxleCA9IG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChQcm90b2NvbCwgQ29uc3RhbnRzLk5BTUVfQUdHUik7CisgICAgICAgICAgICAgICAgQWdnci5JZmFjZSBhZ2dyID0gbmV3IEFnZ3IuQ2xpZW50KG11bHRpcGxleCk7CisKKyAgICAgICAgICAgICAgICBmb3IgKHNieXRlIGkgPSAxOyAxMCA+PSBpOyArK2kpCiAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICBhZ2dyLmFkZFZhbHVlKCBiZW5jaC5maWJvbmFjY2koaSkpOworICAgICAgICAgICAgICAgICAgICBhZ2dyLmFkZFZhbHVlKGJlbmNoLmZpYm9uYWNjaShpKSk7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgZm9yZWFjaCggaW50IGsgaW4gYWdnci5nZXRWYWx1ZXMoKSkKKyAgICAgICAgICAgICAgICBmb3JlYWNoIChpbnQgayBpbiBhZ2dyLmdldFZhbHVlcygpKQogICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrLlRvU3RyaW5nKCkrIiAiKTsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrLlRvU3RyaW5nKCkgKyAiICIpOwogICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiIik7CiAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRyYW5zLkNsb3NlKCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXRjaCggRXhjZXB0aW9uIGUpCisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCiAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIGUuTWVzc2FnZSk7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZS5NZXNzYWdlKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0KLSAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIEV4ZWN1dGUoKQotICAgICAgICB7Ci0gICAgICAgICAgICBUZXN0Q2xpZW50IGNsaWVudCA9IG5ldyBUZXN0Q2xpZW50KCk7Ci0gICAgICAgICAgICBjbGllbnQuUnVuKCk7Ci0gICAgICAgIH0KLQogICAgICAgICBzdGF0aWMgdm9pZCBNYWluKHN0cmluZ1tdIGFyZ3MpCiAgICAgICAgIHsKLSAgICAgICAgICAgIEV4ZWN1dGUoKTsKKyAgICAgICAgICAgIGludCBwb3J0ID0gOTA5MDsKKyAgICAgICAgICAgIGlmIChhcmdzLkxlbmd0aCA+IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcG9ydCA9IHVzaG9ydC5QYXJzZShhcmdzW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yBjbGFzcyBUZXN0U2VydmVyCi0JewotICAgICAgICBwdWJsaWMgaW50ZXJmYWNlIElUZXN0SGFuZGxlcgotICAgICAgICB7Ci0gICAgICAgICAgICB2b2lkIFNldFNlcnZlciggVFNlcnZlciBhU2VydmVyKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByb3RlY3RlZCBjbGFzcyBUZXN0SGFuZGxlckltcGwgOiBJVGVzdEhhbmRsZXIKLSAgICAgICAgewotICAgICAgICAgICAgcHJpdmF0ZSBUU2VydmVyIFNlcnZlcjsKLSAgICAKLSAgICAgICAgICAgIHB1YmxpYyB2b2lkIFNldFNlcnZlciggVFNlcnZlciBhU2VydmVyKQotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIFNlcnZlciA9IGFTZXJ2ZXI7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotCi0gICAgICAgIHByb3RlY3RlZCBjbGFzcyBCZW5jaG1hcmtTZXJ2aWNlSW1wbCA6IFRlc3RIYW5kbGVySW1wbCwgQmVuY2htYXJrU2VydmljZS5JZmFjZQorICAgIHB1YmxpYyBjbGFzcyBUZXN0U2VydmVyCisgICAgeworICAgICAgICBjbGFzcyBCZW5jaG1hcmtTZXJ2aWNlSW1wbCA6IEJlbmNobWFya1NlcnZpY2UuSWZhY2UKICAgICAgICAgewogICAgICAgICAgICAgcHVibGljIGludCBmaWJvbmFjY2koc2J5dGUgbikKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBpbnQgcHJldiwgbmV4dCwgcmVzdWx0OwogICAgICAgICAgICAgICAgIHByZXYgICA9IDA7CiAgICAgICAgICAgICAgICAgcmVzdWx0ID0gMTsKLSAgICAgICAgICAgICAgICB3aGlsZSggbiA+IDApIAorICAgICAgICAgICAgICAgIHdoaWxlIChuID4gMCkKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIG5leHQgICA9IHJlc3VsdCArIHByZXY7CiAgICAgICAgICAgICAgICAgICAgIHByZXYgICA9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KQotICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSggZS5NZXNzYWdlKTsKLSAgICAgICAgICAgfQotICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSggImRvbmUuIik7Ci0gICAgICAgfQotCi0gICAgICAgIAotICAgICAgIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKLSAgICAgICB7Ci0gICAgICAgICAgIEV4ZWN1dGUoKTsKLSAgICAgICB9CisgICAgICAgIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgaW50IHBvcnQgPSA5MDkwOworICAgICAgICAgICAgaWYgKGFyZ3MuTGVuZ3RoID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBwb3J0ID0gdXNob3J0LlBhcnNlKGFyZ3NbMF0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXhlY3V0ZShwb3J0KTsKKyAgICAgICAgfQogICAgIH0KLQotCi0KIH0KIApkaWZmIC0tZ2l0IGEvbGliL2NzaGFycC90ZXN0L011bHRpcGxleC9TZXJ2ZXIvTXVsdGlwbGV4U2VydmVyLmNzcHJvaiBiL2xpYi9jc2hhcnAvdGVzdC9NdWx0aXBsZXgvU2VydmVyL011bHRpcGxleFNlcnZlci5jc3Byb2oKaW5kZXggZGMxZDEyMy4uYzRhNDM5NCAxMDA2NDQKLS0tIGEvbGliL2NzaGFycC90ZXN0L011bHRpcGxleC9TZXJ2ZXIvTXVsdGlwbGV4U2VydmVyLmNzcHJvagorKysgYi9saWIvY3NoYXJwL3Rlc3QvTXVsdGlwbGV4L1NlcnZlci9NdWx0aXBsZXhTZXJ2ZXIuY3Nwcm9qCkBAIC00Niw3ICs0Niw3IEBACiAgICAgPFVwZGF0ZVJlcXVpcmVkPmZhbHNlPC9VcGRhdGVSZXF1aXJlZD4KICAgICA8TWFwRmlsZUV4dGVuc2lvbnM+dHJ1ZTwvT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J7MH06Ly97MX17Mn0iLCBSZXF1ZXN0LlVybC5TY2hlbWUsIFJlcXVlc3QuVXJsLkF1dGhvcml0eSwKKyAgICAgICAgICAgICAgICBVcmwuQ29udGVudCgifiIpKSk7CisKKyAgICAgICAgICAgIFNlY29uZFNlcnZpY2UuSUFzeW5jIGFzeW5jU2VydmljZSA9CisgICAgICAgICAgICAgICAgbmV3IFNlY29uZFNlcnZpY2UuQ2xpZW50KG5ldyBUQmluYXJ5UHJvdG9jb2wobmV3IFRIdHRwQ2xpZW50KG5ldyBVcmkoYmFzZVVyaSwgIkFzeW5jLnRocmlmdCIpKSkpOworCisgICAgICAgICAgICB2YXIgcmVzdWx0ID0gYXdhaXQgYXN5bmNTZXJ2aWNlLnNlY29uZHRlc3RTdHJpbmdBc3luYygiVGVzdFN0cmluZyIpOworICAgICAgICAgICAgaWYgKHJlc3VsdCAhPSAidGVzdFN0cmluZyhcIlRlc3RTdHJpbmdcIikiKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oIlRoZSB3cm9uZyByZXN1bHQgd2FzIHJldHVybmVkIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBSZWRpcmVjdFRvQWN0aW9uKCJJbmRleCIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEFjdGlvblJlc3VsdCBUZXN0VGhyaWZ0U3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBiYXNlVXJpID0gbmV3IFVyaShzdHJpbmcuRm9ybWF0KCJ7MH06Ly97MX17Mn0iLCBSZXF1ZXN0LlVybC5TY2hlbWUsIFJlcXVlc3QuVXJsLkF1dGhvcml0eSwKKyAgICAgICAgICAgICAgICBVcmwuQ29udGVudCgifiIpKSk7CisKKyAgICAgICAgICAgIFNlY29uZFNlcnZpY2UuSVN5bmMgc2VydmljZSA9CisgICAgICAgICAgICAgICAgbmV3IFNlY29uZFNlcnZpY2UuQ2xpZW50KG5ld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GZpcnN0ID0gdHJ1ZTsNCi0gICAgICAgICAgICAgICAgZm9yZWFjaCAoc3RyaW5nIGtleSBpbiB0aGluZy5LZXlzKQ0KLSAgICAgICAgICAgICAgICB7DQotICAgICAgICAgICAgICAgICAgICBpZiAoZmlyc3QpDQotICAgICAgICAgICAgICAgICAgICB7DQotICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsNCi0gICAgICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICAgICAgICAgIGVsc2UNCi0gICAgICAgICAgICAgICAgICAgIHsNCi0gICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiLCAiKTsNCi0gICAgICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGtleSArICIgPT4gIiArIHRoaW5nW2tleV0pOw0KLSAgICAgICAgICAgICAgICB9DQotICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ9KSIpOw0KLSAgICAgICAgICAgICAgICByZXR1cm4gdGhpbmc7DQotICAgICAgICAgICAgfQotCi0JCQlwdWJsaWMgVEhhc2hTZXQ8aW50PiB0ZXN0U2V0KFRIYXNoU2V0PGludD4gdGhpbmcpCi0JCQl7Ci0JCQkJQ29uc29sZS5Xcml0ZUxpbmUoInRlc3RTZXQoeyIpOwotCQkJCWJvb2wgZmlyc3QgPSB0cnVlOwotCQkJCWZvcmVhY2ggKGludCBlbGVtIGluIHRoaW5nKQotCQkJCXsKLQkJCQkJaWYgKGZpcnN0KQotCQkJCQl7Ci0JCQkJCQlmaXJzdCA9IGZhbHNlOwotCQkJCQl9Ci0JCQkJCWVsc2UKLQkJCQkJewotCQkJCQkJQ29uc29sZS5Xcml0ZUxpbmUoIiwgIik7Ci0JCQkJCX0KLQkJCQkJQ29uc29sZS5Xcml0ZUxpbmUoZWxlbSk7Ci0JCQkJfQotCQkJCUNvbnNvbGUuV3JpdGVMaW5lKC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AgICAgICAgIGlmICh3Y2ggPj0gMHhEODAwICYmIHdjaCA8PSAweERCRkYpIHsKKyAgICAgICAgICAgIHdjaHMgfj0gd2NoOworICAgICAgICAgIH0gZWxzZSBpZiAod2NoID49IDB4REMwMCAmJiB3Y2ggPD0gMHhERkZGICYmIHdjaHMubGVuZ3RoID09IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oIk1pc3NpbmcgVVRGLTE2IGhpZ2ggc3Vycm9nYXRlLiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEV4Y2VwdGlvbi5UeXBlLklOVkFMSURfREFUQSk7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHdjaHMgfj0gd2NoOworICAgICAgICAgICAgYnVmZmVyLnB1dCh3Y2hzLnRvVVRGOCk7CisgICAgICAgICAgICB3Y2hzID0gW107CisgICAgICAgICAgfQorICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgIGF1dG8gcG9zID0gY291bnRVbnRpbChrRXNjYXBlQ2hhcnNbXSwgY2hbMF0pOwogICAgICAgICAgIGlmIChwb3MgPT0gLTEpIHsKQEAgLTUzMSw5ICs1NDgsMTcgQEAKICAgICAgICAgICBjaCA9IGtFc2NhcGVDaGFyVmFsc1twb3NdOwogICAgICAgICB9CiAgICAgICB9CisgICAgICBpZiAod2Nocy5sZW5ndGggIT0gMCkgeworICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCJNaXNzaW5nIFVURi0xNiBsb3cgc3Vycm9nYXRlLiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXhjZXB0aW9uLlR5cGUuSU5WQUxJRF9EQVRBKTsKKyAgICAgIH0KICAgICAgIGJ1ZmZlci5wdXQoY2hbMF0pOwogICAgIH0KIAorICAgIGlmICh3Y2hzLmx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mdldEludDMyKDApOworICB9CisKKyAgZmluYWwgVWludDhMaXN0IF9pNjRJbiA9IG5ldyBVaW50OExpc3QoOCk7CisgIGludCByZWFkSTY0KCkgeworICAgIHRyYW5zcG9ydC5yZWFkQWxsKF9pNjRJbiwgMCwgOCk7CisgICAgdmFyIGkgPSBuZXcgSW50NjQuZnJvbUJ5dGVzQmlnRW5kaWFuKF9pNjRJbik7CisgICAgcmV0dXJuIGkudG9JbnQoKTsKKyAgfQorCisgIGZpbmFsIFVpbnQ4TGlzdCBfZG91YmxlSW4gPSBuZXcgVWludDhMaXN0KDgpOworICBkb3VibGUgcmVhZERvdWJsZSgpIHsKKyAgICB0cmFuc3BvcnQucmVhZEFsbChfZG91YmxlSW4sIDAsIDgpOworICAgIHJldHVybiBfZG91YmxlSW4uYnVmZmVyLmFzQnl0ZURhdGEoKS5nZXRGbG9hdDY0KDApOworICB9CisKKyAgU3RyaW5nIHJlYWRTdHJpbmcoKSB7CisgICAgaW50IHNpemUgPSByZWFkSTMyKCk7CisgICAgcmV0dXJuIF9yZWFkU3RyaW5nKHNpemUpOworICB9CisKKyAgU3RyaW5nIF9yZWFkU3RyaW5nKGludCBzaXplKSB7CisgICAgVWludDhMaXN0IHN0cmluZ0luID0gbmV3IFVpbnQ4TGlzdChzaXplKTsKKyAgICB0cmFuc3BvcnQucmVhZEFsbChzdHJpbmdJbiwgMCwgc2l6ZSk7CisgICAgcmV0dXJuIF91dGY4Q29kZWMuZGVjb2RlKHN0cmluZ0luKTsKKyAgfQorCisgIFVpbnQ4TGlzdCByZWFkQmluYXJ5KCkgeworICAgIGludCBsZW5ndGggPSByZWFkSTMyKCk7CisgICAgVWludDhMaXN0IGJpbmFyeUluID0gbmV3IFVpbnQ4TGlzdChsZW5ndGgpOworICAgIHRyYW5zcG9ydC5yZWFkQWxsKGJpbmFyeUluLCAwLCBsZW5ndGgpOworICAgIHJldHVybiBiaW5hcnlJbjsKKyAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL2Rh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ZXRGbG9hdDY0KDAsIGQsIEVuZGlhbm5lc3MuTElUVExFX0VORElBTik7CisgICAgdHJhbnNwb3J0LndyaXRlKHRlbXBCRC5idWZmZXIuYXNVaW50OExpc3QoKSwgMCwgOCk7CisgIH0KKworICB2b2lkIHdyaXRlU3RyaW5nKFN0cmluZyBzdHIpIHsKKyAgICBVaW50OExpc3QgYnl0ZXMgPQorICAgICAgICBzdHIgIT0gbnVsbCA/IF91dGY4Q29kZWMuZW5jb2RlKHN0cikgOiBuZXcgVWludDhMaXN0LmZyb21MaXN0KFtdKTsKKyAgICB3cml0ZUJpbmFyeShieXRlcyk7CisgIH0KKworICB2b2lkIHdyaXRlQmluYXJ5KFVpbnQ4TGlzdCBieXRlcykgeworICAgIF93cml0ZVZhckludDMyKG5ldyBJbnQzMihieXRlcy5sZW5ndGgpKTsKKyAgICB0cmFuc3BvcnQud3JpdGUoYnl0ZXMsIDAsIGJ5dGVzLmxlbmd0aCk7CisgIH0KKworICB2b2lkIF93cml0ZVZhckludDMyKEludDMyIG4pIHsKKyAgICBpbnQgaWR4ID0gMDsKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgaWYgKChuICYgfjB4N0YpID09IDApIHsKKyAgICAgICAgdGVtcExpc3RbaWR4KytdID0gKG4gJiAweEZGKS50b0ludCgpOworICAgICAgICBicmVhazsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHRlbXBMaXN0W2lkeCsrXSA9ICgoKG4gJiAweDdGKSB8IDB4ODApICYgMHhGRikudG9JbnQoKTsKKyAgICAgICAgbiA9IG4uc2hpZnRSaWdodFVuc2lnbmVkKDcpOworICAgICAgfQorICAgIH0KKyAgICB0cmFuc3BvcnQud3JpdGUodGVtcExpc3QsIDAsIGlkeCk7CisgIH0KKworICB2b2lkIF93cml0ZVZhckludDY0KEludDY0IG4pIHsKKyAgICBpbnQgaWR4ID0gMDsKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgaWYgKChuICYgfjB4N0YpID09IDApIHsKKyAgICAgICAgdGVtcExpc3RbaWR4KytdID0gKG4gJiAweEZGKS50b0ludCgpOworICAgICAgICBicmVhazsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHRlbXBMaXN0W2lkeCsrXSA9ICgoKG4gJiAweDdGKSB8IDB4ODApICYgMHhGRikudG9JbnQoKTsKKyAgICAgICAgbiA9IG4uc2hpZnRSaWdodFVuc2lnbmVkKDcpOworICAgICAgfQorICAgIH0KKyAgICB0cmFuc3BvcnQud3JpdGUodGVtcExpc3QsIDAsIGlkeCk7CisgIH0KKworICB2b2lkIF93cml0ZUNvbGxlY3Rpb25CZWdpbihpbnQgZWxlbVR5cGUsIGludCBsZW5ndGgpIHsKKyAgICBpZiAobGVuZ3RoIDw9IDE0KSB7CisgICAgICB3cml0ZUJ5dGUobGVuZ3RoIDw8IDQgfCBfZ2V0Q29tcGFjdFR5cGUoZWxlbVR5cGUpKTsKKyAgICB9IGVsc2UgeworICAgICAgd3JpdGVCeXRlKDB4RjAgfCBfZ2V0Q29tcGFjdFR5cGUoZWxlbVR5cGUpKTsKKyAgICAgIF93cml0ZVZhckludDMyKG5ldyBJbnQzMihsZW5ndGgpKTsKKyAgICB9CisgIH0KKworICBJbnQzMiBfaW50MzJUb1ppZ1phZyhJbnQzMiBuKSB7CisgICAgcmV0dXJuIChuIDw8IDEpIF4gKG4gPj4gMzEpOworICB9CisKKyAgSW50NjQgX2ludDY0VG9aaWdaYWcoSW50NjQgbikgeworICAgIHJldHVybiAobiA8PCAxKSBeIChuID4+IDYzKTsKKyAgfQorCisgIC8vLyBSZWFkCisgIFRNZXNzYWdlIHJlYWRNZXNzYWdlQmVnaW4oKSB7CisgICAgaW50IHByb3RvY29sSWQgPSByZWFkQnl0ZSgpOworICAgIGlmIChwcm90b2NvbElkICE9IFBST1RPQ09MX0lEKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoVFByb3RvY29sRXJyb3JUeXBlLkJBRF9WRVJTSU9OLAorICAg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DAsIGxlbmd0aCk7CisgICAgcmV0dXJuIGJ1ZmY7CisgIH0KKworICBJbnQzMiBfcmVhZFZhckludDMyKCkgeworICAgIEludDMyIHJlc3VsdCA9IEludDMyLlpFUk87CisgICAgaW50IHNoaWZ0ID0gMDsKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgSW50MzIgYiA9IG5ldyBJbnQzMihyZWFkQnl0ZSgpKTsKKyAgICAgIHJlc3VsdCB8PSAoYiAmIDB4N2YpIDw8IHNoaWZ0OworICAgICAgaWYgKChiICYgMHg4MCkgIT0gMHg4MCkgYnJlYWs7CisgICAgICBzaGlmdCArPSA3OworICAgIH0KKyAgICByZXR1cm4gcmVzdWx0OworICB9CisKKyAgSW50NjQgX3JlYWRWYXJJbnQ2NCgpIHsKKyAgICBJbnQ2NCByZXN1bHQgPSBJbnQ2NC5aRVJPOworICAgIGludCBzaGlmdCA9IDA7CisgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgIEludDY0IGIgPSBuZXcgSW50NjQocmVhZEJ5dGUoKSk7CisgICAgICByZXN1bHQgfD0gKGIgJiAweDdmKSA8PCBzaGlmdDsKKyAgICAgIGlmICgoYiAmIDB4ODApICE9IDB4ODApIGJyZWFrOworICAgICAgc2hpZnQgKz0gNzsKKyAgICB9CisgICAgcmV0dXJuIHJlc3VsdDsKKyAgfQorCisgIEludDMyIF96aWd6YWdUb0ludDMyKEludDMyIG4pIHsKKyAgICByZXR1cm4gKG4uc2hpZnRSaWdodFVuc2lnbmVkKDEpKSBeIC0obiAmIDEpOworICB9CisKKyAgSW50NjQgX3ppZ3phZ1RvSW50NjQoSW50NjQgbikgeworICAgIHJldHVybiAobi5zaGlmdFJpZ2h0VW5zaWduZWQoMSkpIF4gLShuICYgMSk7CisgIH0KKworICB2b2lkIF9jaGVja05lZ1JlYWRMZW5ndGgoaW50IGxlbmd0aCkgeworICAgIGlmIChsZW5ndGggPCAwKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoCisgICAgICAgICAgVFByb3RvY29sRXJyb3JUeXBlLk5FR0FUSVZFX1NJWkUsICdOZWdhdGl2ZSBsZW5ndGg6ICRsZW5ndGgnKTsKKyAgICB9CisgIH0KKworICBpbnQgX2dldENvbXBhY3RUeXBlKGludCB0dHlwZSkgeworICAgIHJldHVybiBfdHlwZU1hcFt0dHlwZV07CisgIH0KKworICBpbnQgX2dldFRUeXBlKGludCB0eXBlKSB7CisgICAgc3dpdGNoICh0eXBlICYgMHgwRikgeworICAgICAgY2FzZSBUVHlwZS5TVE9QOgorICAgICAgICByZXR1cm4gVFR5cGUuU1RPUDsKKyAgICAgIGNhc2UgVFlQRV9CT09MRUFOX0ZBTFNFOgorICAgICAgY2FzZSBUWVBFX0JPT0xFQU5fVFJVRToKKyAgICAgICAgcmV0dXJuIFRUeXBlLkJPT0w7CisgICAgICBjYXNlIFRZUEVfQllURToKKyAgICAgICAgcmV0dXJuIFRUeXBlLkJZVEU7CisgICAgICBjYXNlIFRZUEVfSTE2OgorICAgICAgICByZXR1cm4gVFR5cGUuSTE2OworICAgICAgY2FzZSBUWVBFX0kzMjoKKyAgICAgICAgcmV0dXJuIFRUeXBlLkkzMjsKKyAgICAgIGNhc2UgVFlQRV9JNjQ6CisgICAgICAgIHJldHVybiBUVHlwZS5JNjQ7CisgICAgICBjYXNlIFRZUEVfRE9VQkxFOgorICAgICAgICByZXR1cm4gVFR5cGUuRE9VQkxFOworICAgICAgY2FzZSBUWVBFX0JJTkFSWToKKyAgICAgICAgcmV0dXJuIFRUeXBlLlNUUklORzsKKyAgICAgIGNhc2UgVFlQRV9MSVNUOgorICAgICAgICByZXR1cm4gVFR5cGUuTElTVDsKKyAgICAgIGNhc2UgVFlQRV9TRVQ6CisgICAgICAgIHJldHVybiBUVHlwZS5TRVQ7CisgICAgICBjYXNlIFRZUEVfTUFQOgorICAgICAgICByZXR1cm4gVFR5cGUuTUFQOworICAgICAgY2FzZSBUWVBFX1NUUlVDVDoKKyAgICAgICAgcmV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y5RVU9URV9CWVRFUyk7CisgIH0KKworICB2b2lkIF93cml0ZUpzb25JbnRlZ2VyKGludCBpKSB7CisgICAgaWYgKGkgPT0gbnVsbCkgaSA9IDA7CisKKyAgICBfY29udGV4dC53cml0ZSgpOworICAgIFN0cmluZyBzdHIgPSBpLnRvU3RyaW5nKCk7CisKKyAgICBpZiAoX2NvbnRleHQuZXNjYXBlTnVtYmVycykgeworICAgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuUVVPVEVfQllURVMpOworICAgIH0KKyAgICB0cmFuc3BvcnQud3JpdGVBbGwodXRmOENvZGVjLmVuY29kZShzdHIpKTsKKyAgICBpZiAoX2NvbnRleHQuZXNjYXBlTnVtYmVycykgeworICAgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuUVVPVEVfQllURVMpOworICAgIH0KKyAgfQorCisgIHZvaWQgX3dyaXRlSnNvbkRvdWJsZShkb3VibGUgZCkgeworICAgIGlmIChkID09IG51bGwpIGQgPSAwLjA7CisKKyAgICBfY29udGV4dC53cml0ZSgpOworICAgIFN0cmluZyBzdHIgPSBkLnRvU3RyaW5nKCk7CisgICAgYm9vbCBlc2NhcGVOdW1iZXJzID0gZC5pc05hTiB8fCBkLmlzSW5maW5pdGUgfHwgX2NvbnRleHQuZXNjYXBlTnVtYmVyczsKKworICAgIGlmIChlc2NhcGVOdW1iZXJzKSB7CisgICAgICB0cmFuc3BvcnQud3JpdGVBbGwoX0NvbnN0YW50cy5RVU9URV9CWVRFUyk7CisgICAgfQorICAgIHRyYW5zcG9ydC53cml0ZUFsbCh1dGY4Q29kZWMuZW5jb2RlKHN0cikpOworICAgIGlmIChlc2NhcGVOdW1iZXJzKSB7CisgICAgICB0cmFuc3BvcnQud3JpdGVBbGwoX0NvbnN0YW50cy5RVU9URV9CWVRFUyk7CisgICAgfQorICB9CisKKyAgdm9pZCBfd3JpdGVKc29uQmFzZTY0KFVpbnQ4TGlzdCBieXRlcykgeworICAgIF9jb250ZXh0LndyaXRlKCk7CisgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuUVVPVEVfQllURVMpOworCisgICAgU3RyaW5nIGJhc2U2NCA9IEJBU0U2NC5lbmNvZGUoYnl0ZXMpOworICAgIHRyYW5zcG9ydC53cml0ZUFsbCh1dGY4Q29kZWMuZW5jb2RlKGJhc2U2NCkpOworCisgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuUVVPVEVfQllURVMpOworICB9CisKKyAgdm9pZCBfd3JpdGVKc29uT2JqZWN0U3RhcnQoKSB7CisgICAgX2NvbnRleHQud3JpdGUoKTsKKyAgICB0cmFuc3BvcnQud3JpdGVBbGwoX0NvbnN0YW50cy5MQlJBQ0VfQllURVMpOworICAgIF9wdXNoQ29udGV4dChuZXcgX1BhaXJDb250ZXh0KHRoaXMpKTsKKyAgfQorCisgIHZvaWQgX3dyaXRlSnNvbk9iamVjdEVuZCgpIHsKKyAgICBfcG9wQ29udGV4dCgpOworICAgIHRyYW5zcG9ydC53cml0ZUFsbChfQ29uc3RhbnRzLlJCUkFDRV9CWVRFUyk7CisgIH0KKworICB2b2lkIF93cml0ZUpzb25BcnJheVN0YXJ0KCkgeworICAgIF9jb250ZXh0LndyaXRlKCk7CisgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuTEJSQUNLRVRfQllURVMpOworICAgIF9wdXNoQ29udGV4dChuZXcgX0xpc3RDb250ZXh0KHRoaXMpKTsKKyAgfQorCisgIHZvaWQgX3dyaXRlSnNvbkFycmF5RW5kKCkgeworICAgIF9wb3BDb250ZXh0KCk7CisgICAgdHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuUkJSQUNLRVRfQllURVMpOworICB9CisKKyAgdm9pZCB3cml0ZU1lc3NhZ2VCZWdpbihUTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgX3Jlc2V0Q29udGV4dCgpOworCisgICAgX3dyaXRlSnNvbkFycmF5U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kludGVnZXIoYik7CisgIH0KKworICB2b2lkIHdyaXRlSTE2KGludCBpMTYpIHsKKyAgICBfd3JpdGVKc29uSW50ZWdlcihpMTYpOworICB9CisKKyAgdm9pZCB3cml0ZUkzMihpbnQgaTMyKSB7CisgICAgX3dyaXRlSnNvbkludGVnZXIoaTMyKTsKKyAgfQorCisgIHZvaWQgd3JpdGVJNjQoaW50IGk2NCkgeworICAgIF93cml0ZUpzb25JbnRlZ2VyKGk2NCk7CisgIH0KKworICB2b2lkIHdyaXRlRG91YmxlKGRvdWJsZSBkKSB7CisgICAgX3dyaXRlSnNvbkRvdWJsZShkKTsKKyAgfQorCisgIHZvaWQgd3JpdGVTdHJpbmcoU3RyaW5nIHMpIHsKKyAgICB2YXIgYnl0ZXMgPSBzICE9IG51bGwgPyB1dGY4Q29kZWMuZW5jb2RlKHMpIDogbmV3IFVpbnQ4TGlzdC5mcm9tTGlzdChbXSk7CisgICAgX3dyaXRlSnNvblN0cmluZyhieXRlcyk7CisgIH0KKworICB2b2lkIHdyaXRlQmluYXJ5KFVpbnQ4TGlzdCBieXRlcykgeworICAgIF93cml0ZUpzb25CYXNlNjQoYnl0ZXMpOworICB9CisKKyAgYm9vbCBfaXNIaWdoU3Vycm9nYXRlKGludCBiKSA9PiBiID49IDB4RDgwMCAmJiBiIDw9IDB4REJGRjsKKworICBib29sIF9pc0xvd1N1cnJvZ2F0ZShpbnQgYikgPT4gYiA+PSAweERDMDAgJiYgYiA8PSAweERGRkY7CisKKyAgLy8vIHJlYWQKKworICBVaW50OExpc3QgX3JlYWRKc29uU3RyaW5nKHtib29sIHNraXBDb250ZXh0OiBmYWxzZX0pIHsKKyAgICBMaXN0PGludD4gYnl0ZXMgPSBbXTsKKyAgICBMaXN0PGludD4gY29kZXVuaXRzID0gW107CisKKyAgICBpZiAoIXNraXBDb250ZXh0KSB7CisgICAgICBfY29udGV4dC5yZWFkKCk7CisgICAgfQorCisgICAgX3JlYWRKc29uU3ludGF4Q2hhcihfQ29uc3RhbnRzLlFVT1RFX0JZVEVTWzBdKTsKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgaW50IGJ5dGUgPSBfcmVhZGVyLnJlYWQoKTsKKyAgICAgIGlmIChieXRlID09IF9Db25zdGFudHMuUVVPVEVfQllURVNbMF0pIHsKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisKKyAgICAgIC8vIGVzY2FwZWQ/CisgICAgICBpZiAoYnl0ZSAhPSBfQ29uc3RhbnRzLkVTQ1NFUV9CWVRFU1swXSkgeworICAgICAgICBieXRlcy5hZGQoYnl0ZSk7CisgICAgICAgIGNvbnRpbnVlOworICAgICAgfQorCisgICAgICBieXRlID0gX3JlYWRlci5yZWFkKCk7CisKKyAgICAgIC8vIGRpc3Rpbmd1aXNoIGJldHdlZW4gXHVYWFhYIGFuZCBjb250cm9sIGNoYXJzIGxpa2UgXG4KKyAgICAgIGlmIChieXRlICE9IF9Db25zdGFudHMuRVNDU0VRX0JZVEVTWzFdKSB7CisgICAgICAgIFN0cmluZyBjaGFyID0gbmV3IFN0cmluZy5mcm9tQ2hhckNvZGUoYnl0ZSk7CisgICAgICAgIGludCBvZmZzZXQgPSBfQ29uc3RhbnRzLkVTQ0FQRV9DSEFSUy5pbmRleE9mKGNoYXIpOworICAgICAgICBpZiAob2Zmc2V0ID09IC0xKSB7CisgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKAorICAgICAgICAgICAgICBUUHJvdG9jb2xFcnJvclR5cGUuSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgY29udHJvbCBjaGFyIik7CisgICAgICAgIH0KKyAgICAgICAgYnl0ZSA9IF9Db25zdGFudHMuRVNDQVBFX0NIQVJfVkFMUy5jb2RlVW5pdEF0KG9mZnNldCk7CisgICAgICAgIGJ5dGVzLmFkZChieXRlKTsKKyAgICAgICAgY29udGludWU7CisgICAgICB9CisKKyAgICAgIC8vIGl0J3MgXHVYWFhYCisgICAgICB0cmFuc3BvcnQucmVhZEFsbChfdGVtcEJ1ZmZlciwgMCwgNCk7CisgICAgICBieXRlID0gKF9oZXhWYWwoX3RlbXBCdWZmZXJbMF0pIDw8IDEyKQorICAgICAgICArIChfaGV4VmFsKF90ZW1wQnVmZmVyWzFdKSA8PCA4KQorICAgICAgICArIChfaGV4VmFsKF90ZW1wQnVmZmVyWzJdKSA8PCA0KQorICAgICAgICArIF9oZXhWYWwoX3RlbXBCdWZmZXJbM10pOworICAgICAgaWYgKF9pc0hpZ2hTdXJyb2dhdGUoYnl0ZSkpIHsKKyAgICAgICAgaWYgKGNvZGV1bml0cy5pc05vdEVtcHR5KSB7CisgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKAorICAgICAgICAgICAgICBUUHJvdG9jb2xFcnJvclR5cGUuSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgbG93IHN1cnJvZ2F0ZSIpOworICAgICAgICB9CisgICAgICAgIGNvZGV1bml0cy5hZGQoYnl0ZSk7CisgICAgICB9CisgICAgICBlbHNlIGlmIChfaXNMb3dTdXJyb2dhdGUoYnl0ZSkpIHsKKyAgICAgICAgaWYgKGNvZGV1bml0cy5pc0VtcHR5KSB7CisgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKAorICAgICAgICAgICAgICBUUHJvdG9jb2xFcnJvclR5cGUuSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgaGlnaCBzdXJyb2dhdGUiKTsKKyAgICAgICAgfQorICAgICAgICBjb2RldW5pdHMuYWRkKGJ5dGUpOworICAgICAgICBieXRlcy5hZGRBbGwodXRmOENvZGVjLmVuY29kZShuZXcgU3RyaW5nLmZyb21DaGFyQ29kZXMoY29kZXVuaXRzKSkpOworICAgICAgICBjb2RldW5pdHMuY2xlYXIoKTsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBieXRlcy5hZGRBbGwodXRmOENvZGVjLmVuY29kZShuZXcgU3RyaW5nLmZyb21DaGFyQ29kZShieXRlKSkpOworICAgICAgfQorICAgIH0KKworICAgIGlmIChjb2RldW5pdHMuaXNOb3RFbXB0eSkgeworICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKAorICAgICAgICAgIFRQcm90b2NvbEVycm9yVHlwZS5JTlZBTElEX0RBVEEsICJFeHBlY3RlZCBsb3cgc3Vycm9nYXRlIik7CisgICAgfQorCisgICAgcmV0dXJuIG5ldyBVaW50OExpc3QuZnJvbUxpc3QoYnl0ZXMpOworICB9CisKKyAgU3RyaW5nIF9yZWFkSnNvbk51bWVyaWNDaGFycygpIHsKKyAgICBTdHJpbmdCdWZmZXIgYnVmZmVyID0gbmV3IFN0cmluZ0J1ZmZlcigpOworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICBpZiAoIV9Db25zdGFudHMuaXNKc29uTnVtZXJpYyhfcmVhZGVyLnBlZWsoKSkpIHsKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisgICAgICBidWZmZXIud3JpdGUobmV3IFN0cmluZy5mcm9tQ2hhckNvZGUoX3JlYWRlci5yZWFkKCkpKTsKKyAgICB9CisgICAgcmV0dXJuIGJ1ZmZlci50b1N0cmluZygpOworICB9CisKKyAgaW50IF9yZWFkSnNvbkludGVnZXIoKSB7CisgICAgX2NvbnRleHQucmVhZCgpOworCisgICAgaWYgKF9jb250ZXh0LmVzY2FwZU51bWJlcnMpIHsKKyAgICAgIF9yZWFkSnNvblN5bnRheENoYXIoX0NvbnN0YW50cy5RVU9URV9CWVRFU1swXSk7CisgICAgfQorICAgIFN0cmluZyBzdHIgPSBfcmVhZEpzb25OdW1lcmljQ2hhcnMoKTsKKyAgICBpZiAoX2NvbnRleHQuZXNjYXBlTnVtYmVycykgeworICAgICAgX3JlYWRKc29uU3ludGF4Q2hhcihfQ29uc3RhbnRzLlFVT1RFX0JZVEVTWzBdKTsKKyAgICB9CisKKyAgICB0cnkgeworICAgICAgcmV0dXJuIGludC5wYXJzZShzdHIpOworICAgIH0gb24gRm9ybWF0RXhjZXB0aW9uIGNhdGNoIChfKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoVFByb3RvY29sRXJyb3JUeXBlLklOVkFMSURfREFUQSwKKyAgICAgICAgICAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIpOworICAgIH0KKyAgfQorCisgIGRvdWJsZSBfcmVhZEpzb25Eb3VibGUoKSB7CisgICAgX2NvbnRleHQucmVhZCgpOworCisgICAgaWYgKF9yZWFkZXIucGVlaygpID09IF9Db25zdGFudHMuUVVPVEVfQllURVNbMF0pIHsKKyAgICAgIFVpbnQ4TGlzdCBieXRlcyA9IF9yZWFkSnNvblN0cmluZyhza2lwQ29udGV4dDogdHJ1ZSk7CisgICAgICBkb3VibGUgZCA9IGRvdWJsZS5wYXJzZSh1dGY4Q29kZWMuZGVjb2RlKGJ5dGVzKSwgKF8pIHsKKyAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKFRQcm90b2NvbEVycm9yVHlwZS5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIpOworICAgICAgfSk7CisgICAgICBpZiAoIV9jb250ZXh0LmVzY2FwZU51bWJlcnMgJiYgIWQuaXNOYU4gJiYgIWQuaXNJbmZpbml0ZSkgeworICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoVFByb3RvY29sRXJyb3JUeXBlLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICJOdW1lcmljIGRhdGEgdW5leHBlY3RlZGx5IHF1b3RlZCIpOworICAgICAgfQorICAgICAgcmV0dXJuIGQ7CisgICAgfSBlbHNlIHsKKyAgICAgIGlmIChfY29udGV4dC5lc2NhcGVOdW1iZXJzKSB7CisgICAgICAgIC8vIFRoaXMgd2lsbCB0aHJvdyAtIHdlIHNob3VsZCBoYXZlIGhhZCBhIHF1b3RlIGlmIGVzY2FwZU51bWJlc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QXJyYXlTdGFydCgpIHsKKyAgICBfY29udGV4dC5yZWFkKCk7CisgICAgX3JlYWRKc29uU3ludGF4Q2hhcihfQ29uc3RhbnRzLkxCUkFDS0VUX0JZVEVTWzBdKTsKKyAgICBfcHVzaENvbnRleHQobmV3IF9MaXN0Q29udGV4dCh0aGlzKSk7CisgIH0KKworICB2b2lkIF9yZWFkSnNvbkFycmF5RW5kKCkgeworICAgIF9yZWFkSnNvblN5bnRheENoYXIoX0NvbnN0YW50cy5SQlJBQ0tFVF9CWVRFU1swXSk7CisgICAgX3BvcENvbnRleHQoKTsKKyAgfQorCisgIFRNZXNzYWdlIHJlYWRNZXNzYWdlQmVnaW4oKSB7CisgICAgX3Jlc2V0Q29udGV4dCgpOworCisgICAgX3JlYWRKc29uQXJyYXlTdGFydCgpOworICAgIGlmIChfcmVhZEpzb25JbnRlZ2VyKCkgIT0gVkVSU0lPTl8xKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoCisgICAgICAgICAgVFByb3RvY29sRXJyb3JUeXBlLkJBRF9WRVJTSU9OLCAiTWVzc2FnZSBjb250YWluZWQgYmFkIHZlcnNpb24uIik7CisgICAgfQorCisgICAgVWludDhMaXN0IGJ1ZmZlciA9IF9yZWFkSnNvblN0cmluZygpOworICAgIFN0cmluZyBuYW1lID0gdXRmOENvZGVjLmRlY29kZShidWZmZXIpOworICAgIGludCB0eXBlID0gX3JlYWRKc29uSW50ZWdlcigpOworICAgIGludCBzZXFpZCA9IF9yZWFkSnNvbkludGVnZXIoKTsKKworICAgIHJldHVybiBuZXcgVE1lc3NhZ2UobmFtZSwgdHlwZSwgc2VxaWQpOworICB9CisKKyAgdm9pZCByZWFkTWVzc2FnZUVuZCgpIHsKKyAgICBfcmVhZEpzb25BcnJheUVuZCgpOworICB9CisKKyAgVFN0cnVjdCByZWFkU3RydWN0QmVnaW4oKSB7CisgICAgX3JlYWRKc29uT2JqZWN0U3RhcnQoKTsKKyAgICByZXR1cm4gbmV3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b25PYmplY3RFbmQoKTsKKyAgICBfcmVhZEpzb25BcnJheUVuZCgpOworICB9CisKKyAgVExpc3QgcmVhZExpc3RCZWdpbigpIHsKKyAgICBfcmVhZEpzb25BcnJheVN0YXJ0KCk7CisgICAgaW50IGVsZW1lbnRUeXBlID0gX0NvbnN0YW50cy5nZXRUeXBlSWRGb3JUeXBlTmFtZShfcmVhZEpzb25TdHJpbmcoKSk7CisgICAgaW50IGxlbmd0aCA9IF9yZWFkSnNvbkludGVnZXIoKTsKKworICAgIHJldHVybiBuZXcgVExpc3QoZWxlbWVudFR5cGUsIGxlbmd0aCk7CisgIH0KKworICB2b2lkIHJlYWRMaXN0RW5kKCkgeworICAgIF9yZWFkSnNvbkFycmF5RW5kKCk7CisgIH0KKworICBUU2V0IHJlYWRTZXRCZWdpbigpIHsKKyAgICBfcmVhZEpzb25BcnJheVN0YXJ0KCk7CisgICAgaW50IGVsZW1lbnRUeXBlID0gX0NvbnN0YW50cy5nZXRUeXBlSWRGb3JUeXBlTmFtZShfcmVhZEpzb25TdHJpbmcoKSk7CisgICAgaW50IGxlbmd0aCA9IF9yZWFkSnNvbkludGVnZXIoKTsKKworICAgIHJldHVybiBuZXcgVFNldChlbGVtZW50VHlwZSwgbGVuZ3RoKTsKKyAgfQorCisgIHZvaWQgcmVhZFNldEVuZCgpIHsKKyAgICBfcmVhZEpzb25BcnJheUVuZCgpOworICB9CisKKyAgYm9vbCByZWFkQm9vbCgpIHsKKyAgICByZXR1cm4gX3JlYWRKc29uSW50ZWdlcigpID09IDAgPyBmYWxzZSA6IHRydWU7CisgIH0KKworICBpbnQgcmVhZEJ5dGUoKSB7CisgICAgcmV0dXJuIF9yZWFkSnNvbkludGVnZXIoKTsKKyAgfQorCisgIGludCByZWFkSTE2KCkgeworICAgIHJldHVybiBfcmVhZEpzb25JbnRlZ2VyKCk7CisgIH0KKworICBpbnQgcmVhZEkzMigpIHsKKyAgICByZXR1cm4gX3JlYWRKc29uSW50ZWdlcigpOworICB9Cis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gICBpZiAoIV9UWVBFX0lEX1RPX05BTUVfQllURVMuY29udGFpbnNLZXkodHlwZUlkKSkgeworICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEVycm9yKAorICAgICAgICAgIFRQcm90b2NvbEVycm9yVHlwZS5OT1RfSU1QTEVNRU5URUQsICJVbnJlY29nbml6ZWQgdHlwZSIpOworICAgIH0KKworICAgIHJldHVybiBfVFlQRV9JRF9UT19OQU1FX0JZVEVTW3R5cGVJZF07CisgIH0KKworICBzdGF0aWMgZmluYWwgTWFwPFN0cmluZywgaW50PiBfTkFNRV9UT19UWVBFX0lEID0gbmV3IE1hcC51bm1vZGlmaWFibGUoeworICAgIE5BTUVfQk9PTDogVFR5cGUuQk9PTCwKKyAgICBOQU1FX0JZVEU6IFRUeXBlLkJZVEUsCisgICAgTkFNRV9JMTY6IFRUeXBlLkkxNiwKKyAgICBOQU1FX0kzMjogVFR5cGUuSTMyLAorICAgIE5BTUVfSTY0OiBUVHlwZS5JNjQsCisgICAgTkFNRV9ET1VCTEU6IFRUeXBlLkRPVUJMRSwKKyAgICBOQU1FX1NUUklORzogVFR5cGUuU1RSSU5HLAorICAgIE5BTUVfU1RSVUNUOiBUVHlwZS5TVFJVQ1QsCisgICAgTkFNRV9NQVA6IFRUeXBlLk1BUCwKKyAgICBOQU1FX1NFVDogVFR5cGUuU0VULAorICAgIE5BTUVfTElTVDogVFR5cGUuTElTVAorICB9KTsKKworICBzdGF0aWMgaW50IGdldFR5cGVJZEZvclR5cGVOYW1lKFVpbnQ4TGlzdCBieXRlcykgeworICAgIFN0cmluZyBuYW1lID0gdXRmOGNvZGVjLmRlY29kZShieXRlcyk7CisgICAgaWYgKCFfTkFNRV9UT19UWVBFX0lELmNvbnRhaW5zS2V5KG5hbWUpKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXJyb3IoCisgICAgICAgICAgVFByb3RvY29sRXJyb3JUeXBlLk5PVF9JTVBMRU1FTlRFRCwgIlVucmVjb2duaXplZCB0eXBlIik7CisgICAgfQorCisgICAgcmV0dXJuIF9OQU1FX1RPX1RZUEVfSURbbmFtZV07CisgIH0KKworICBzdGF0aWMgZmluYWwgU2V0PGludD4gX0pTT05fTlVNRVJJQ1MgPSBuZXcgU2V0LmZyb20oWworICAgICcrJy5jb2RlVW5pdEF0KDApLAorICAgICctJy5jb2RlVW5pdEF0KDApLAorICAgICcuJy5jb2RlVW5pdEF0KDApLAorICAgICcwJy5jb2RlVW5pdEF0KDApLAorICAgICcxJy5jb2RlVW5pdEF0KDApLAorICAgICcyJy5jb2RlVW5pdEF0KDApLAorICAgICczJy5jb2RlVW5pdEF0KDApLAorICAgICc0Jy5jb2RlVW5pdEF0KDApLAorICAgICc1Jy5jb2RlVW5pdEF0KDApLAorICAgICc2Jy5jb2RlVW5pdEF0KDApLAorICAgICc3Jy5jb2RlVW5pdEF0KDApLAorICAgICc4Jy5jb2RlVW5pdEF0KDApLAorICAgICc5Jy5jb2RlVW5pdEF0KDApLAorICAgICdFJy5jb2RlVW5pdEF0KDApLAorICAgICdlJy5jb2RlVW5pdEF0KDApCisgIF0pOworCisgIHN0YXRpYyBib29sIGlzSnNvbk51bWVyaWMoaW50IGJ5dGUpIHsKKyAgICByZXR1cm4gX0pTT05fTlVNRVJJQ1MuY29udGFpbnMoYnl0ZSk7CisgIH0KK30KKworY2xhc3MgX0xvb2thaGVhZFJlYWRlciB7CisgIGZpbmFsIFRKc29uUHJvdG9jb2wgcHJvdG9jb2w7CisKKyAgX0xvb2thaGVhZFJlYWRlcih0aGlzLnByb3RvY29sKTsKKworICBib29sIF9oYXNEYXRhID0gZmFsc2U7CisgIGZpbmFsIFVpbnQ4TGlzdCBfZGF0YSA9IG5ldyBVaW50OExpc3QoMSk7CisKKyAgaW50IHJlYWQoKSB7CisgICAgaWYgKF9oYXNEYXRhKSB7CisgICAgICBfaGFzRGF0YSA9IGZhbHNlOworICAgIH0gZWxzZSB7CisgICAgICBwcm90b2NvbC50cmFuc3BvcnQucmVhZEFsbChfZGF0YSwgMCwgMSk7CisgICAgfQorCisgICAgcmV0dXJuIF9kYXRhWzBdOworICB9CisKKyAgaW50IHBlZWsoKSB7CisgICAgaWYgKCFfaGFzRGF0YSkgeworICAgICAgcHJvdG9jb2wudHJhbnNwb3J0LnJlYWRBbGwoX2RhdGEsIDAsIDEpOworICAgIH0KKyAgICBfaGFzRGF0YSA9IHRydWU7CisKKyAgICByZXR1cm4gX2RhdGFbMF07CisgIH0KK30KKworY2xhc3MgX0Jhc2VDb250ZXh0IHsKKyAgZmluYWwgVEpzb25Qcm90b2NvbCBwcm90b2NvbDsKKworICBfQmFzZUNvbnRleHQodGhpcy5wcm90b2NvbCk7CisKKyAgdm9pZCB3cml0ZSgpIHt9CisKKyAgdm9pZCByZWFkKCkge30KKworICBib29sIGdldCBlc2NhcGVOdW1iZXJzID0+IGZhbHNlOworCisgIFN0cmluZyB0b1N0cmluZygpID0+ICdCYXNlQ29udGV4dCc7Cit9CisKK2NsYXNzIF9MaXN0Q29udGV4dCBleHRlbmRzIF9CYXNlQ29udGV4dCB7CisgIF9MaXN0Q29udGV4dChUSnNvblByb3RvY29sIHByb3RvY29sKSA6IHN1cGVyKHByb3RvY29sKTsKKworICBib29sIF9maXJzdCA9IHRydWU7CisKKyAgdm9pZCB3cml0ZSgpIHsKKyAgICBpZiAoX2ZpcnN0KSB7CisgICAgICBfZmlyc3QgPSBmYWxzZTsKKyAgICB9IGVsc2UgeworICAgICAgcHJvdG9jb2wudHJhbnNwb3J0LndyaXRlQWxsKF9Db25zdGFudHMuQ09NTUFfQllURVMpOworICAgIH0KKyAgfQorCisgIHZvaWQgcmVhZCgpIHsKKyAgICBpZiAoX2ZpcnN0KSB7CisgICAgICBfZmlyc3QgPSBmYWxzZTsKKyAgICB9IGVsc2UgeworICAgICAgcHJvdG9jb2wuX3JlYWRKc29uU3ludGF4Q2hhcihfQ29uc3RhbnRzLkNPTU1BX0JZVEVTWzBdKTsKKyAgICB9CisgIH0KKworICBTdHJpbm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bGRFbmQoKSB7CisgICAgX3Byb3RvY29sLndyaXRlRmllbGRFbmQoKTsKKyAgfQorCisgIHZvaWQgd3JpdGVGaWVsZFN0b3AoKSB7CisgICAgX3Byb3RvY29sLndyaXRlRmllbGRTdG9wKCk7CisgIH0KKworICB2b2lkIHdyaXRlTWFwQmVnaW4oVE1hcCBtYXApIHsKKyAgICBfcHJvdG9jb2wud3JpdGVNYXBCZWdpbihtYXApOworICB9CisKKyAgdm9pZCB3cml0ZU1hcEVuZCgpIHsKKyAgICBfcHJvdG9jb2wud3JpdGVNYXBFbmQoKTsKKyAgfQorCisgIHZvaWQgd3JpdGVMaXN0QmVnaW4oVExpc3QgbGlzdCkgeworICAgIF9wcm90b2NvbC53cml0ZUxpc3RCZWdpbihsaXN0KTsKKyAgfQorCisgIHZvaWQgd3JpdGVMaXN0RW5kKCkgeworICAgIF9wcm90b2NvbC53cml0ZUxpc3RFbmQoKTsKKyAgfQorCisgIHZvaWQgd3JpdGVTZXRCZWdpbihUU2V0IHNldCkgeworICAgIF9wcm90b2NvbC53cml0ZVNldEJlZ2luKHNldCk7CisgIH0KKworICB2b2lkIHdyaXRlU2V0RW5kKCkgeworICAgIF9wcm90b2NvbC53cml0ZVNldEVuZCgpOworICB9CisKKyAgdm9pZCB3cml0ZUJvb2woYm9vbCBiKSB7CisgICAgX3Byb3RvY29sLndyaXRlQm9vbChiKTsKKyAgfQorCisgIHZvaWQgd3JpdGVCeXRlKGludCBiKSB7CisgICAgX3Byb3RvY29sLndyaXRlQnl0ZShiKTsKKyAgfQorCisgIHZvaWQgd3JpdGVJMTYoaW50IGkxNikgeworICAgIF9wcm90b2NvbC53cml0ZUkxNihpMTYpOworICB9CisKKyAgdm9pZCB3cml0ZUkzMihpbnQgaTMyKSB7CisgICAgX3Byb3RvY29sLndyaXRlSTMyKGkzMik7CisgIH0KKworICB2b2lkIHdyaXRlSTY0KGludCBpNjQpIHsKKyAgICBfcHJvdG9jb2wud3JpdGVJNjQoaTY0KTsKKy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KyAgICAgIGNhc2UgVFR5cGUuQllURToKKyAgICAgICAgcHJvdC5yZWFkQnl0ZSgpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5JMTY6CisgICAgICAgIHByb3QucmVhZEkxNigpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5JMzI6CisgICAgICAgIHByb3QucmVhZEkzMigpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5JNjQ6CisgICAgICAgIHByb3QucmVhZEk2NCgpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5ET1VCTEU6CisgICAgICAgIHByb3QucmVhZERvdWJsZSgpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5TVFJJTkc6CisgICAgICAgIHByb3QucmVhZEJpbmFyeSgpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBUVHlwZS5TVFJVQ1Q6CisgICAgICAgIHByb3QucmVhZFN0cnVjdEJlZ2luKCk7CisgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgVEZpZWxkIGZpZWxkID0gcHJvdC5yZWFkRmllbGRCZWdpbigpOworICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLlNUT1ApIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIH0KKyAgICAgICAgICBfc2tpcChwcm90LCBmaWVsZC50eXBlLCByZWN1cnNpb25MaW1pdCAtIDEpOworICAgICAgICAgIHByb3QucmVhZEZpZWxkRW5kKCk7CisgICAgICAgIH0KKyAgICAgICAgcHJvdC5yZWFkU3RydWN0RW5kKCk7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIFRUeXBlLk1BUDoKKyAgICAgICAgVE1hcCBtYXAgPSBwcm90LnJlYWRNYXBCZWdpbigpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1hcC5sZW5ndGg7IGkrKykgeworICAgICAgICAgIF9za2lwKHByb3QsIG1hcC5rZXlUeXBlLCByZWN1cnNpb25MaW1pdCAtIDEpOworICAgICAgICAgIF9za2lwKHByb3QsIG1hcC52YWx1ZVR5cGUsIHJlY3Vyc2lvbkxpbWl0IC0gMSk7CisgICAgICAgIH0KKyAgICAgICAgcHJvdC5yZWFkTWFwRW5kKCk7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIFRUeXBlLlNFVDoKKyAgICAgICAgVFNldCBzZXQgPSBwcm90LnJlYWRTZXRCZWdpbigpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNldC5sZW5ndGg7IGkrKykgeworICAgICAgICAgIF9za2lwKHByb3QsIHNldC5lbGVtZW50VHlwZSwgcmVjdXJzaW9uTGltaXQgLSAxKTsKKyAgICAgICAgfQorICAgICAgICBwcm90LnJlYWRTZXRFbmQoKTsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgVFR5cGUuTElTVDoKKyAgICAgICAgVExpc3QgbGlzdCA9IHByb3QucmVhZExpc3RCZWdpbigpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICBfc2tpcChwcm90LCBsaXN0LmVsZW1lbnRUeXBlLCByZWN1cnNpb25MaW1pdCAtIDEpOworICAgICAgICB9CisgICAgICAgIHByb3QucmVhZExpc3RFbmQoKTsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIGJyZWFrOworICAgIH0KKyAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL2RhcnQvbGliL3NyYy9wcm90b2NvbC90X3NldC5kYXJ0IGIvbGliL2RhcnQvbGliL3NyYy9wcm90b2NvbC90X3NldC5kYXJ0Cm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmIzNDI1MzcKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvZGFydC9saWIvc3JjL3Byb3RvY29sL3Rfc2V0LmRhcnQ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AgICAgICAgIGJyZWFrOworCisgICAgICAgIGNhc2UgVFlQRToKKyAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5JMzIpIHsKKyAgICAgICAgICAgIHR5cGUgPSBpcHJvdC5yZWFkSTMyKCk7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIFRQcm90b2NvbFV0aWwuc2tpcChpcHJvdCwgZmllbGQudHlwZSk7CisgICAgICAgICAgfQorICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgVFByb3RvY29sVXRpbC5za2lwKGlwcm90LCBmaWVsZC50eXBlKTsKKyAgICAgICAgICBicmVhazsKKyAgICAgIH0KKyAgICAgIGlwcm90LnJlYWRGaWVsZEVuZCgpOworICAgIH0KKyAgICBpcHJvdC5yZWFkU3RydWN0RW5kKCk7CisKKyAgICByZXR1cm4gbmV3IFRBcHBsaWNhdGlvbkVycm9yKHR5cGUsIG1lc3NhZ2UpOworICB9CisKKyAgd3JpdGUoVFByb3RvY29sIG9wcm90KSB7CisgICAgb3Byb3Qud3JpdGVTdHJ1Y3RCZWdpbihfc3RydWN0KTsKKworICAgIGlmIChtZXNzYWdlICE9IG51bGwgJiYgIW1lc3NhZ2UuaXNFbXB0eSkgeworICAgICAgb3Byb3Qud3JpdGVGaWVsZEJlZ2luKF9tZXNzYWdlRmllbGQpOworICAgICAgb3Byb3Qud3JpdGVTdHJpbmcobWVzc2FnZSk7CisgICAgICBvcHJvdC53cml0ZUZpZWxkRW5kKCk7CisgICAgfQorCisgICAgb3Byb3Qud3JpdGVGaWVsZEJlZ2luKF90eXBlRmllbGQpOworICAgIG9wcm90LndyaXRlSTMyKHR5cGUpOworICAgIG9wcm90LndyaXRlRmllbGRFbmQoKTsKKworICAgIG9wcm90LndyaXRlRmllbGRTdG9wKCk7CisgICAgb3Byb3Qud3JpdGVTdHJ1Y3RFbmQoKTsKKyAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL2R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IH0KKworICB2b2lkIF9yZXNldCh7Ym9vbCBpc09wZW46IGZhbHNlfSkgeworICAgIF9pc09wZW4gPSBpc09wZW47CisgICAgX3dyaXRlQnVmZmVyLmNsZWFyKCk7CisgICAgX3JlYWRJdGVyYXRvciA9IG51bGw7CisgIH0KKworICBib29sIGdldCBoYXNSZWFkRGF0YSA9PiBfcmVhZEl0ZXJhdG9yICE9IG51bGw7CisKKyAgYm9vbCBfaXNPcGVuOworICBib29sIGdldCBpc09wZW4gPT4gX2lzT3BlbjsKKworICBGdXR1cmUgb3BlbigpIGFzeW5jIHsKKyAgICBfcmVzZXQoaXNPcGVuOiB0cnVlKTsKKyAgfQorCisgIEZ1dHVyZSBjbG9zZSgpIGFzeW5jIHsKKyAgICBfcmVzZXQoaXNPcGVuOiBmYWxzZSk7CisgIH0KKworICBpbnQgcmVhZChVaW50OExpc3QgYnVmZmVyLCBpbnQgb2Zmc2V0LCBpbnQgbGVuZ3RoKSB7CisgICAgaWYgKGJ1ZmZlciA9PSBudWxsKSB7CisgICAgICB0aHJvdyBuZXcgQXJndW1lbnRFcnJvci5ub3ROdWxsKCJidWZmZXIiKTsKKyAgICB9CisKKyAgICBpZiAob2Zmc2V0ICsgbGVuZ3RoID4gYnVmZmVyLmxlbmd0aCkgeworICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50RXJyb3IoIlRoZSByYW5nZSBleGNlZWRzIHRoZSBidWZmZXIgbGVuZ3RoIik7CisgICAgfQorCisgICAgaWYgKF9yZWFkSXRlcmF0b3IgPT0gbnVsbCB8fCBsZW5ndGggPD0gMCkgeworICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgaW50IGkgPSAwOworICAgIHdoaWxlIChpIDwgbGVuZ3RoICYmIF9yZWFkSXRlcmF0b3IubW92ZU5leHQoKSkgeworICAgICAgYnVmZmVyW29mZnNldCArIGldID0gX3JlYWRJdGVyYXRvci5jdXJyZW50OworICAgICAgaSsrOworICAgIH0KKworICAgIC8vIGNsZWFudXA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Jvb2wsIHByb3RvY29sLndyaXRlQm9vbCwgZmFsc2UpOworCisgICAgICBjYXNlIFRUeXBlLkJZVEU6CisgICAgICAgIHJldHVybiBuZXcgUHJpbWl0aXZlKHByb3RvY29sLnJlYWRCeXRlLCBwcm90b2NvbC53cml0ZUJ5dGUsIDApOworCisgICAgICBjYXNlIFRUeXBlLkkxNjoKKyAgICAgICAgcmV0dXJuIG5ldyBQcmltaXRpdmUocHJvdG9jb2wucmVhZEkxNiwgcHJvdG9jb2wud3JpdGVJMTYsIDApOworCisgICAgICBjYXNlIFRUeXBlLkkzMjoKKyAgICAgICAgcmV0dXJuIG5ldyBQcmltaXRpdmUocHJvdG9jb2wucmVhZEkzMiwgcHJvdG9jb2wud3JpdGVJMzIsIDApOworCisgICAgICBjYXNlIFRUeXBlLkk2NDoKKyAgICAgICAgcmV0dXJuIG5ldyBQcmltaXRpdmUocHJvdG9jb2wucmVhZEk2NCwgcHJvdG9jb2wud3JpdGVJNjQsIDApOworCisgICAgICBjYXNlIFRUeXBlLkRPVUJMRToKKyAgICAgICAgcmV0dXJuIG5ldyBQcmltaXRpdmUocHJvdG9jb2wucmVhZERvdWJsZSwgcHJvdG9jb2wud3JpdGVEb3VibGUsIDApOworCisgICAgICBjYXNlIFRUeXBlLlNUUklORzoKKyAgICAgICAgcmV0dXJuIG5ldyBQcmltaXRpdmUocHJvdG9jb2wucmVhZFN0cmluZywgcHJvdG9jb2wud3JpdGVTdHJpbmcsICcnKTsKKworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkRXJyb3IoIlVuc3VwcG9ydGVkIFRUeXBlICR0VHlwZSIpOworICAgIH0KKyAgfQorCisgIEZ1dHVyZSBwcmltaXRpdmVUZXN0KFByaW1pdGl2ZSBwcmltaXRpdmUsIGlucHV0KSBhc3luYyB7CisgICAgcHJpbWl0aXZlLndyaXRlKGlucHV0KTsKKyAgICBwcm90b2NvbC53cml0ZU1lc3NhZ2VFbmQ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Byb3RvY29sLndyaXRlTWFwRW5kKCk7CisgICAgICBwcm90b2NvbC53cml0ZU1lc3NhZ2VFbmQoKTsKKworICAgICAgYXdhaXQgcHJvdG9jb2wudHJhbnNwb3J0LmZsdXNoKCk7CisKKyAgICAgIHByb3RvY29sLnJlYWRNZXNzYWdlQmVnaW4oKTsKKyAgICAgIGV4cGVjdChwcm90b2NvbC5yZWFkTWFwQmVnaW4oKS5sZW5ndGgsIDIpOworCisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZEkzMigpLCAxKTsgLy8ga2V5CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZExpc3RCZWdpbigpLmxlbmd0aCwgMSk7CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZE1hcEJlZ2luKCkubGVuZ3RoLCAxKTsKKyAgICAgIGV4cGVjdChwcm90b2NvbC5yZWFkSTMyKCksIDEwKTsgLy8ga2V5CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZEkzMigpLCAyMCk7IC8vIHZhbHVlCisgICAgICBwcm90b2NvbC5yZWFkTWFwRW5kKCk7CisgICAgICBwcm90b2NvbC5yZWFkTGlzdEVuZCgpOworCisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZEkzMigpLCAyKTsgLy8ga2V5CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZExpc3RCZWdpbigpLmxlbmd0aCwgMSk7CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZE1hcEJlZ2luKCkubGVuZ3RoLCAxKTsKKyAgICAgIGV4cGVjdChwcm90b2NvbC5yZWFkSTMyKCksIDMwKTsgLy8ga2V5CisgICAgICBleHBlY3QocHJvdG9jb2wucmVhZEkzMigpLCA0MCk7IC8vIHZhbHVlCisgICAgICBwcm90b2NvbC5yZWFkTWFwRW5kKCk7CisgICAgICBwcm90b2NvbC5yZWFkTGlzdEVuZCgpOworCisgICAgICBwcm90b2NvbC5yZWFkTWFwRW5kKCk7CisgICAgICBwcm90b2NvbC5yZWFkTWVzc2FnZUVuZCgpOworICAgIH0pOworICB9OworCisgIGdyb3VwKCdKU09OJywgKCkgeworICAgIHNldFVwKCgpIHsKKyAgICAgIHByb3RvY29sID0gbmV3IFRKc29uUHJvdG9jb2wobmV3IFRCdWZmZXJlZFRyYW5zcG9ydCgpKTsKKyAgICAgIHByb3RvY29sLndyaXRlTWVzc2FnZUJlZ2luKG1lc3NhZ2UpOworICAgIH0pOworCisgICAgdGVzdCgnVGVzdCBlc2NhcGVkIHVuaWNvZGUnLCAoKSBhc3luYyB7CisgICAgICAvKgorICAgICAgICAgS09SX0tBSQorICAgICAgICAgICBVVEYtODogIDB4RTAgMHhCOCAweDgxCisgICAgICAgICAgIFVURi0xNjogMHgwRTAxCisgICAgICAgICBHIGNsZWY6CisgICAgICAgICAgIFVURi04OiAgMHhGMCAweDlEIDB4ODQgMHg5RQorICAgICAgICAgICBVVEYtMTY6IDB4RDgzNCAweEREMUUKKyAgICAgICAqLworICAgICAgdmFyIGJ1ZmZlciA9IFVURjguZW5jb2RlKHInIlx1MDAwMVx1MGUwMSBcdWQ4MzRcdWRkMWUiJyk7CisgICAgICB2YXIgdHJhbnNwb3J0ID0gbmV3IFRCdWZmZXJlZFRyYW5zcG9ydCgpOworICAgICAgdHJhbnNwb3J0LndyaXRlQWxsKGJ1ZmZlcik7CisKKyAgICAgIHZhciBwcm90b2NvbCA9IG5ldyBUSnNvblByb3RvY29sKHRyYW5zcG9ydCk7CisKKyAgICAgIGF3YWl0IHByb3RvY29sLnRyYW5zcG9ydC5mbHVzaCgpOworCisgICAgICB2YXIgc3ViamVjdCA9IHByb3RvY29sLnJlYWRTdHJpbmcoKTsKKyAgICAgIGV4cGVjdChzdWJqZWN0LAorICAgICAgICAgIFVURjguZGVjb2RlKFsweDAxLCAweEUwLCAweEI4LCAweDgxLCAweDIwLCAweEYwLCAweDlELCAweDg0LCAweDlFXSkpOworICAgIH0pOworCisgICAgZ3JvdXAoJ3NoYXJlZCB0ZXN0cycsIHNoYXJlZFRlc3R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l0YXRpb25zCisgKiB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitsaWJyYXJ5IHRocmlmdC50ZXN0LnNlcmlhbGl6ZXIuc2VyaWFsaXplcl90ZXN0OworCitpbXBvcnQgJ3BhY2thZ2U6dGVzdC90ZXN0LmRhcnQnOworaW1wb3J0ICdwYWNrYWdlOnRocmlmdC90aHJpZnQuZGFydCc7CitpbXBvcnQgJ3NlcmlhbGl6ZXJfdGVzdF9kYXRhLmRhcnQnOworCit2b2lkIG1haW4oKSB7CisgIHZhciBzZXJpYWxpemVyID0gKCkgeworICAgIFREZXNlcmlhbGl6ZXIgZGVzZXJpYWxpemVyOworICAgIFRTZXJpYWxpemVyIHNlcmlhbGl6ZXI7CisgICAgVGVzdFRPYmplY3QgdGVzdFRPYmplY3Q7CisKKyAgICBzZXRVcCgoKSB7CisgICAgICBzZXJpYWxpemVyID0gbmV3IFRTZXJpYWxpemVyKCk7CisgICAgICBkZXNlcmlhbGl6ZXIgPSBuZXcgVERlc2VyaWFsaXplcigpOworICAgICAgCisgICAgICB0ZXN0VE9iamVjdCA9IG5ldyBUZXN0VE9iamVjdCgpOworICAgICAgdGVzdFRPYmplY3QuYiA9IHRydWU7CisgICAgICB0ZXN0VE9iamVjdC5zID0gIlRFU1QiOworICAgICAgdGVzdFRPYmplY3QuZCA9IDE1LjI1OworICAgICAgdGVzdFRPYmplY3QuaSA9IDEwOworICAgICAgCisgICAgICB2YXIgdGVzdExpc3QgPSBuZXcgTGlzdDxTdHJpbmc+KCk7CisgICAgICB0ZXN0TGlzdC5hZGQoIlRFU1QgMSIpOworICAgICAgdGVzdExpc3QuYWRkKCJURVNUIDIiKTsKKyAgICAgIAorICAgICAgdGVzdFRPYmplY3QubCA9IHRlc3RMaXN0OworICAgIH0pOworICAgIAorICAgIGFzc2VydE5ld09iamVjdEVxdWFsc1RPYmplY3QoVGVzdFRPYmplY3QgbmV3T2JqZWN0KSB7CisgICAgICBleHBlY3QobmV3T2JqZWN0LmwsIGVxdWFscyh0ZXN0VE9iamVjdC5sKSk7CisgICAgICBleHBlY3QobmV3T2JqZWN0LmIsIGVxdWFscyh0ZXN0VE9iamVjdC5iKSk7CisgICAgICBleHBlY3QobmV3T2JqZWN0LmksIGVxdWFscyh0ZXN0VE9iamVjdC5pKSk7CisgICAgICBleHBlY3QobmV3T2JqZWN0LmQsIGVxdWFscyh0ZXN0VE9iamVjdC5kKSk7CisgICAgICBleHBlY3QobmV3T2JqZWN0LnMsIGVxdWFscyh0ZXN0VE9iamVjdC5zKSk7CisgICAgfQorICAgIAorICAgIHJ1bldyaXRlU3RyaW5nVGVzdCgpIHsKKyAgICAgIHZhciBzID0gc2VyaWFsaXplci53cml0ZVN0cmluZyh0ZXN0VE9iamVjdCk7CisKKyAgICAgIHZhciBuZXdPYmplY3QgPSBuZXcgVGVzdFRPYmplY3QoKTsKKyAgICAgIGRlc2VyaWFsaXplci5yZWFkU3RyaW5nKG5ld09iamVjdCwgcyk7CisKKyAgICAgIGFzc2VydE5ld09iamVjdEVxdWFsc1RPYmplY3QobmV3T2JqZWN0KTsKKyAgICB9OworCisgICAgcnVuV3JpdGVUZXN0KCkgeworICAgICAgdmFyIHMgPSBzZXJpYWxpemVyLndyaXRlKHRlc3RUT2JqZWN0KTsKKworICAgICAgdmFyIG5ld09iamVjdCA9IG5ldyBUZXN0VE9iamVjdCgpOworICAgICAgZGVzZXJpYWxpemVyLnJlYWQobmV3T2JqZWN0LCBzKTsKKworICAgICAgYXNzZXJ0TmV3T2JqZWN0RXF1YWxzVE9iamVjdChuZXdPYmplY3QpOworICAgIH07CisKKyAgICB0ZXN0KCdKU09OIFByb3RvY29sIFN0cmluZycsICgpIHsKKyAgICAgIHNlcmlhbGl6ZXIucHJvdG9jb2wgPSBuZXcgVEpzb25Qcm90b2NvbChzZXJpYWxpemVyLnRyYW5zcG9ydCk7CisgICAgICBkZXNlcmlhbGl6ZXIucHJvdG9jb2wgPSBuZXcgVEpzb25Qcm90b2NvbChkZXNlcmlh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c2V0X2kgPSB0cnVlOworICB9CisKKyAgYm9vbCBpc1NldEkoKSA9PiB0aGlzLl9faXNzZXRfaTsKKworICB1bnNldEkoKSB7CisgICAgdGhpcy5fX2lzc2V0X2kgPSBmYWxzZTsKKyAgfQorCisgIC8vIGQKKyAgZG91YmxlIGdldCBkID0+IHRoaXMuX2Q7CisKKyAgc2V0IGQoZG91YmxlIGQpIHsKKyAgICB0aGlzLl9kID0gZDsKKyAgICB0aGlzLl9faXNzZXRfZCA9IHRydWU7CisgIH0KKworICBib29sIGlzU2V0RCgpID0+IHRoaXMuX19pc3NldF9kOworCisgIHVuc2V0RCgpIHsKKyAgICB0aGlzLl9faXNzZXRfZCA9IGZhbHNlOworICB9CisKKyAgLy8gcworICBTdHJpbmcgZ2V0IHMgPT4gdGhpcy5fczsKKworICBzZXQgcyhTdHJpbmcgcykgeworICAgIHRoaXMuX3MgPSBzOworICB9CisKKyAgYm9vbCBpc1NldFMoKSA9PiB0aGlzLnMgIT0gbnVsbDsKKworICB1bnNldFMoKSB7CisgICAgdGhpcy5zID0gbnVsbDsKKyAgfQorCisgIC8vIGwKKyAgTGlzdDxTdHJpbmc+IGdldCBsID0+IHRoaXMuX2w7CisKKyAgc2V0IGwoTGlzdDxTdHJpbmc+IGwpIHsKKyAgICB0aGlzLl9sID0gbDsKKyAgfQorCisgIGJvb2wgaXNTZXRMKCkgPT4gdGhpcy5sICE9IG51bGw7CisKKyAgdW5zZXRMKCkgeworICAgIHRoaXMubCA9IG51bGw7CisgIH0KKworICAvLyBiCisgIGJvb2wgZ2V0IGIgPT4gdGhpcy5fYjsKKworICBzZXQgYihib29sIGIpIHsKKyAgICB0aGlzLl9iID0gYjsKKyAgICB0aGlzLl9faXNzZXRfYiA9IHRydWU7CisgIH0KKworICBib29sIGlzU2V0QigpID0+IHRoaXMuX19pc3NldF9iOworCisgIHVuc2V0QigpIHsKKyAgICB0aGlzLl9faXNzZXRfYiA9IGZhbHNlOworICB9CisKKyAgZ2V0RmllbGRWYWx1ZShpbnQgZmllbGRJRCkgeworICAgIHN3aXRjaCAoZmllbGRJRCkgeworICAgICAgY2FzZSBJOgorICAgICAgICByZXR1cm4gdGhpcy5pOworICAgICAgY2FzZSBEOgorICAgICAgICByZXR1cm4gdGhpcy5kOworICAgICAgY2FzZSBTOgorICAgICAgICByZXR1cm4gdGhpcy5zOworICAgICAgY2FzZSBMOgorICAgICAgICByZXR1cm4gdGhpcy5sOworICAgICAgY2FzZSBCOgorICAgICAgICByZXR1cm4gdGhpcy5iOworICAgICAgZGVmYXVsdDoKKyAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50RXJyb3IoIkZpZWxkICRmaWVsZElEIGRvZXNuJ3QgZXhpc3QhIik7CisgICAgfQorICB9CisKKyAgc2V0RmllbGRWYWx1ZShpbnQgZmllbGRJRCwgT2JqZWN0IHZhbHVlKSB7CisgICAgc3dpdGNoIChmaWVsZElEKSB7CisgICAgICBjYXNlIEk6CisgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgdW5zZXRJKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgdGhpcy5pID0gdmFsdWU7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgRDoKKyAgICAgICAgaWYgKHZhbHVlID09IG51bGwpIHsKKyAgICAgICAgICB1bnNldEQoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICB0aGlzLmQgPSB2YWx1ZTsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBTOgorICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgeworICAgICAgICAgIHVuc2V0UygpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHRoaXMucyA9IHZhbHVlOworICAgICAgICB9CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIEw6CisgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgdW5zZXRMKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgdGhpcy5sID0gdmFsdWUgYXMgTGlzdDxTdHJpbmc+OworICAgICAgICB9CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIEI6CisgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgdW5zZXRCKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgdGhpcy5iID0gdmFsdWU7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGRlZmF1bHQ6CisgICAgICAgIHRocm93IG5ldyBBcmd1bWVudEVycm9yKCJGaWVsZCAkZmllbGRJRCBkb2Vzbid0IGV4aXN0ISIpOworICAgIH0KKyAgfQorCisgIC8vIFJldHVybnMgdHJ1ZSBpZiBmaWVsZCBjb3JyZXNwb25kaW5nIHRvIGZpZWxkSUQgaXMgc2V0IChoYXMgYmVlbiBhc3NpZ25lZCBhIHZhbHVlKSBhbmQgZmFsc2Ugb3RoZXJ3aXNlCisgIGJvb2wgaXNTZXQoaW50IGZpZWxkSUQpIHsKKyAgICBzd2l0Y2ggKGZpZWxkSUQpIHsKKyAgICAgIGNhc2UgSToKKyAgICAgICAgcmV0dXJuIGlzU2V0SSgpOworICAgICAgY2FzZSBEOgorICAgICAgICByZXR1cm4gaXNTZXREKCk7CisgICAgICBjYXNlIFM6CisgICAgICAgIHJldHVybiBpc1NldFMoKTsKKyAgICAgIGNhc2UgTDoKKyAgICAgICAgcmV0dXJuIGlzU2V0TCgpOworICAgICAgY2FzZSBCOgorICAgICAgICByZXR1cm4gaXNTZXRCKCk7CisgICAgICBkZWZhdWx0OgorICAgICAgICB0aHJvdyBuZXcgQXJndW1lbnRFcnJvcigiRmllbGQgJGZpZWxkSUQgZG9lc24ndCBleGlzdCEiKTsKKyAgICB9CisgIH0KKworICByZWFkKFRQcm90b2NvbCBpcHJvdCkgeworICAgIFRGaWVsZCBmaWVsZDsKKyAgICBpcHJvdC5yZWFkU3RydWN0QmVnaW4oKTsKKyAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgZmllbGQgPSBpcHJvdC5yZWFkRmllbGRCZWdpbigpOworICAgICAgaWYgKGZpZWxkLnR5cGUgPT0gVFR5cGUuU1RPUCkgeworICAgICAgICBicmVhazsKKyAgICAgIH0KKyAgICAgIHN3aXRjaCAoZmllbGQuaWQpIHsKKyAgICAgICAgY2FzZSBJOgorICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLkkzMikgeworICAgICAgICAgICAgdGhpcy5pID0gaXByb3QucmVhZEkzMigpOworICAgICAgICAgICAgdGhpcy5fX2lzc2V0X2kgPSB0cnVlOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBEOgorICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLkRPVUJMRSkgeworICAgICAgICAgICAgdGhpcy5kID0gaXByb3QucmVhZERvdWJsZSgpOworICAgICAgICAgICAgdGhpcy5fX2lzc2V0X2QgPSB0cnVlOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBTOgorICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLlNUUklORykgeworICAgICAgICAgICAgdGhpcy5zID0gaXByb3QucmVhZFN0cmluZygpOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBMOgorICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLkxJU1QpIHsKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgVExpc3QgX2xpc3Q3NCA9IGlwcm90LnJlYWRMaXN0QmVnaW4oKTsKKyAgICAgICAgICAgICAgdGhpcy5sID0gbmV3IExpc3Q8U3RyaW5nPigpOworICAgICAgICAgICAgICBmb3IgKGludCBfaTc1ID0gMDsgX2k3NSA8IF9saXN0NzQubGVuZ3RoOyArK19pNzUpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgX2VsZW03NjsKKyAgICAgICAgICAgICAgICBfZWxlbTc2ID0gaXByb3QucmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgIHRoaXMubC5hZGQoX2VsZW03Nik7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgaXByb3QucmVhZExpc3RFbmQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgVFByb3RvY29sVXRpbC5za2lwKGlwcm90LCBmaWVsZC50eXBlKTsKKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQjoKKyAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5CT09MKSB7CisgICAgICAgICAgICB0aGlzLmIgPSBpcHJvdC5yZWFkQm9vbCgpOworICAgICAgICAgICAgdGhpcy5fX2lzc2V0X2IgPSB0cnVlOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIGJyZWFrOworICAgICAgfQorICAgICAgaXByb3QucmVhZEZpZWxkRW5kKCk7CisgICAgfQorICAgIGlwcm90LnJlYWRTdHJ1Y3RFbmQoKTsKKworICAg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9wcm90LndyaXRlRmllbGRFbmQoKTsKKyAgICB9CisgICAgb3Byb3Qud3JpdGVGaWVsZEJlZ2luKF9CX0ZJRUxEX0RFU0MpOworICAgIG9wcm90LndyaXRlQm9vbCh0aGlzLmIpOworICAgIG9wcm90LndyaXRlRmllbGRFbmQoKTsKKyAgICBvcHJvdC53cml0ZUZpZWxkU3RvcCgpOworICAgIG9wcm90LndyaXRlU3RydWN0RW5kKCk7CisgIH0KKworICBTdHJpbmcgdG9TdHJpbmcoKSB7CisgICAgU3RyaW5nQnVmZmVyIHJldCA9IG5ldyBTdHJpbmdCdWZmZXIoIlRlc3RUT2JqZWN0KCIpOworCisgICAgcmV0LndyaXRlKCJpOiIpOworICAgIHJldC53cml0ZSh0aGlzLmkpOworCisgICAgcmV0LndyaXRlKCIsICIpOworICAgIHJldC53cml0ZSgiZDoiKTsKKyAgICByZXQud3JpdGUodGhpcy5kKTsKKworICAgIHJldC53cml0ZSgiLCAiKTsKKyAgICByZXQud3JpdGUoInM6Iik7CisgICAgaWYgKHRoaXMucyA9PSBudWxsKSB7CisgICAgICByZXQud3JpdGUoIm51bGwiKTsKKyAgICB9IGVsc2UgeworICAgICAgcmV0LndyaXRlKHRoaXMucyk7CisgICAgfQorCisgICAgcmV0LndyaXRlKCIsICIpOworICAgIHJldC53cml0ZSgibDoiKTsKKyAgICBpZiAodGhpcy5sID09IG51bGwpIHsKKyAgICAgIHJldC53cml0ZSgibnVsbCIpOworICAgIH0gZWxzZSB7CisgICAgICByZXQud3JpdGUodGhpcy5sKTsKKyAgICB9CisKKyAgICByZXQud3JpdGUoIiwgIik7CisgICAgcmV0LndyaXRlKCJiOiIpOworICAgIHJldC53cml0ZSh0aGlzLmIpOworCisgICAgcmV0LndyaXRlKCIpIik7CisKKyAgICByZXR1cm4gcmV0LnRvU3RyaW5nKCk7CisgIH0KKworICB2YWxpZGF0ZSgpIHsKKyAgICAvLyBjaGVjayBmb3IgcmVxdWlyZWQgZmllbGRzCisgICAgLy8gY2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nNwb3J0KTogSVByb3RvY29sOworICAgICAgZW5kOworCisgIHByaXZhdGUgY29uc3QKKworICAgIHsgVE9ETworICAgIHN0YXRpYyBUU3RydWN0IEFOT05ZTU9VU19TVFJVQ1QgPSBuZXcgVFN0cnVjdCgiIik7CisgICAgc3RhdGljIFRGaWVsZCBUU1RPUCA9IG5ldyBURmllbGQoIiIsIFRUeXBlLlN0b3AsIChzaG9ydCkwKTsKKyAgICB9CisKKyAgICBQUk9UT0NPTF9JRCAgICAgICA9IEJ5dGUoICQ4Mik7CisgICAgVkVSU0lPTiAgICAgICAgICAgPSBCeXRlKCAxKTsKKyAgICBWRVJTSU9OX01BU0sgICAgICA9IEJ5dGUoICQxRik7IC8vIDAwMDEgMTExMQorICAgIFRZUEVfTUFTSyAgICAgICAgID0gQnl0ZSggJEUwKTsgLy8gMTExMCAwMDAwCisgICAgVFlQRV9CSVRTICAgICAgICAgPSBCeXRlKCAkMDcpOyAvLyAwMDAwIDAxMTEKKyAgICBUWVBFX1NISUZUX0FNT1VOVCA9IEJ5dGUoIDUpOworCisgIHByaXZhdGUgdHlwZQorICAgIC8vIEFsbCBvZiB0aGUgb24td2lyZSB0eXBlIGNvZGVzLgorICAgIFR5cGVzID0gKAorICAgICAgU1RPUCAgICAgICAgICA9ICQwMCwKKyAgICAgIEJPT0xFQU5fVFJVRSAgPSAkMDEsCisgICAgICBCT09MRUFOX0ZBTFNFID0gJDAyLAorICAgICAgQllURV8gICAgICAgICA9ICQwMywKKyAgICAgIEkxNiAgICAgICAgICAgPSAkMDQsCisgICAgICBJMzIgICAgICAgICAgID0gJDA1LAorICAgICAgSTY0ICAgICAgICAgICA9ICQwNiwKKyAgICAgIERPVUJMRV8gICAgICAgPSAkMDcsCisgICAgICBCSU5BUlkgICAgICAgID0gJDA4LAorICAgICAgTElTVCAgICAgICAgICA9ICQwOSwKKyAgICAgIFNFVF8gICAgICAgICAgPSAkMEEsCisgICAgICBNQVAgICAgICAgICAgID0gJDBCLAorICAgICAgU1RSVUNUICAgICAgICA9ICQwQworICAgICk7CisKKyAgcHJpdmF0ZSBjb25zdAorICAgIHR0eXBlVG9Db21wYWN0VHlwZSA6IGFycmF5W1RUeXBlXSBvZiBUeXBlcyA9ICgKKyAgICAgIFR5cGVzLlNUT1AsICAgICAgICAgICAvLyBTdG9wICAgID0gMCwKKyAgICAgIFR5cGVzKC0xKSwgICAgICAgICAgICAvLyBWb2lkICAgID0gMSwKKyAgICAgIFR5cGVzLkJPT0xFQU5fVFJVRSwgICAvLyBCb29sXyAgID0gMiwKKyAgICAgIFR5cGVzLkJZVEVfLCAgICAgICAgICAvLyBCeXRlXyAgID0gMywKKyAgICAgIFR5cGVzLkRPVUJMRV8sICAgICAgICAvLyBEb3VibGVfID0gNCwKKyAgICAgIFR5cGVzKC01KSwgICAgICAgICAgICAvLyB1bnVzZWQKKyAgICAgIFR5cGVzLkkxNiwgICAgICAgICAgICAvLyBJMTYgICAgID0gNiwKKyAgICAgIFR5cGVzKC03KSwgICAgICAgICAgICAvLyB1bnVzZWQKKyAgICAgIFR5cGVzLkkzMiwgICAgICAgICAgICAvLyBJMzIgICAgID0gOCwKKyAgICAgIFR5cGVzKC05KSwgICAgICAgICAgICAvLyB1bnVzZWQKKyAgICAgIFR5cGVzLkk2NCwgICAgICAgICAgICAvLyBJNjQgICAgID0gMTAsCisgICAgICBUeXBlcy5CSU5BUlksICAgICAgICAgLy8gU3RyaW5nXyA9IDExLAorICAgICAgVHlwZXMuU1RSVUNULCAgICAgICAgIC8vIFN0cnVjdCAgPSAxMiwKKyAgICAgIFR5cGVzLk1BUCwgICAgICAgICAgICAvLyBNYXAgICAgID0gMTMsCisgICAgICBUeXBlcy5TRVRfLCAgICAgICAgICAgLy8gU2V0XyAgICA9IDE0LAorICAgICAgVHlwZXMuTElTVCAgICAgICAgICAgIC8vIExpc3QgICAgPSAxNSwKKyAgICApOworCisgICAgdGNvbXBhY3RUeXBlVG9UeXBlIDogYXJyYXlbVHlwZXNdIG9mIFRUeXBlID0gKAorICAgICAgVFR5cGUuU3RvcCwgICAgICAgLy8gU1RPUAorICAgICAgVFR5cGUuQm9vbF8sICAgICAgLy8gQk9PTEVBTl9UUlVFCisgICAgICBUVHlwZS5Cb29sXywgICAgICAvLyBCT09MRUFOX0ZBTFNFCisgICAgICBUVHlwZS5CeXRlXywgICAgICAvLyBCWVRFXworICAgICAgVFR5cGUuSTE2LCAgICAgICAgLy8gSTE2CisgICAgICBUVHlwZS5JMzIsICAgICAgICAvLyBJMzIKKyAgICAgIFRUeXBlLkk2NCwgICAgICAgIC8vIEk2NAorICAgICAgVFR5cGUuRG91YmxlXywgICAgLy8gRE9VQkxFXworICAgICAgVFR5cGUuU3RyaW5nXywgICAgLy8gQklOQVJZCisgICAgICBUVHlwZS5MaXN0LCAgICAgICAvLyBMSVNUCisgICAgICBUVHlwZS5TZXRfLCAgICAgICAvLyBTRVRfCisgICAgICBUVHlwZS5NYXAsICAgICAgICAvLyBNQVAKKyAgICAgIFRUeXBlLlN0cnVjdCAgICAgIC8vIFNUUlVDVAorICAgICk7CisKKyAgcHJpdmF0ZQorICAgIC8vIFVzZWQgdG8ga2VlcCB0cmFjayBvZiB0aGUgbGFzdCBmaWVsZCBmb3IgdGhlIGN1cnJlbnQgYW5kIHByZXZpb3VzIHN0cnVjdHMsCisgICAgLy8gc28gd2UgY2FuIGRvIHRoZSBkZWx0YSBzdHVmZi4KKyAgICBsYXN0RmllbGRfIDogVFN0YWNrPEludGVnZXI+OworICAgIGxhc3RGaWVsZElkXyA6IEludGVnZXI7CisKKyAgICAvLyBJZiB3ZSBlbmNvdW50ZXIgYSBib29sZWFuIGZpZWxkIGJlZ2luLCBzYXZlIHRoZSBURmllbGQgaGVyZSBzbyBpdCBjYW4KKyAgICAvLyBoYXZlIHRoZSB2YWx1ZSBpbmNvcnBvcmF0ZWQuCisgICAgcHJpdmF0ZSBib29sZWFuRmllbGRfIDogVFRocmlmdEZpZWxkOworCisgICAgLy8gSWYgd2UgUmVhZCBhIG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29kZSB0aGUgc3RyaW5nLCBqdXN0IHNraXAgaXQuCisKKyAgICAvLyBzdHJ1Y3R1cmVkIHR5cGVzCisgICAgVFR5cGUuU3RydWN0IDogIGJlZ2luCisgICAgICBwcm90LlJlYWRTdHJ1Y3RCZWdpbigpOworICAgICAgd2hpbGUgVFJVRSBkbyBiZWdpbgorICAgICAgICBmaWVsZCA6PSBwcm90LlJlYWRGaWVsZEJlZ2luKCk7CisgICAgICAgIGlmIChmaWVsZC5UeXBlXyA9IFRUeXBlLlN0b3ApIHRoZW4gQnJlYWs7CisgICAgICAgIFNraXAocHJvdCwgZmllbGQuVHlwZV8pOworICAgICAgICBwcm90LlJlYWRGaWVsZEVuZCgpOworICAgICAgZW5kOworICAgICAgcHJvdC5SZWFkU3RydWN0RW5kKCk7CisgICAgZW5kOworCisgICAgVFR5cGUuTWFwIDogIGJlZ2luCisgICAgICBtYXAgOj0gcHJvdC5SZWFkTWFwQmVnaW4oKTsKKyAgICAgIGZvciBpIDo9IDAgdG8gbWFwLkNvdW50LTEgZG8gYmVnaW4KKyAgICAgICAgU2tpcChwcm90LCBtYXAuS2V5VHlwZSk7CisgICAgICAgIFNraXAocHJvdCwgbWFwLlZhbHVlVHlwZSk7CisgICAgICBlbmQ7CisgICAgICBwcm90LlJlYWRNYXBFbmQoKTsKKyAgICBlbmQ7CisKKyAgICBUVHlwZS5TZXRfIDogIGJlZ2luCisgICAgICBzZXRfIDo9IHByb3QuUmVhZFNldEJlZ2luKCk7CisgICAgICBmb3IgaSA6PSAwIHRvIHNldF8uQ291bnQtMQorICAgICAgZG8gU2tpcCggcHJvdCwgc2V0Xy5FbGVtZW50VHlwZSk7CisgICAgICBwcm90LlJlYWRTZXRFbmQoKTsKKyAgICBlbmQ7CisKKyAgICBUVHlwZS5MaXN0IDogIGJlZ2luCisgICAgICBsaXN0IDo9IHByb3QuUmVhZExpc3RCZWdpbigpOworICAgICAgZm9yIGkgOj0gMCB0byBsaXN0LkNvdW50LTEKKyAgICAgI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nkKKyAgICAgICAgdHJ5CisgICAgICAgICAgY2xpZW50LkNsb3NlOworICAgICAgICBmaW5hbGx5CisgICAgICAgICAgY2xpZW50IDo9IG5pbDsKKyAgICAgICAgZW5kOworICAgICAgZXhjZXB0CisgICAgICAgIC8vIGNhdGNoIGFsbCwgd2UgY2FuJ3QgZG8gbXVjaCBhYm91dCBpdCBhdCB0aGlzIHBvaW50CisgICAgICBlbmQ7CisKKyAgICAgIGNsaWVudCA6PSBGU2VydmVyVHJhbnNwb3J0LkFjY2VwdCggcHJvY2VkdXJlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZ2luCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgRlNlcnZlckV2ZW50cyA8PiBuaWwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGVuIEZTZXJ2ZXJFdmVudHMuUHJlQWNjZXB0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQpOworCisgICAgICBpZiBjbGllbnQgPSBuaWwgdGhlbiBiZWdpbgorICAgICAgICBpZiBGU3RvcAorICAgICAgICB0aGVuIEFib3J0ICAvLyBzaWxlbnQgZXhjZXB0aW9uCisgICAgICAgIGVsc2UgcmFpc2UgVFRyYW5zcG9ydEV4Y2VwdGlvblVua25vd24uQ3JlYXRlKCdTZXJ2ZXJUcmFuc3BvcnQuQWNjZXB0KCkgbWF5IG5vdCByZXR1cm4gTlVMTCcpOworICAgICAgZW5kOworCiAgICAgICBGTG9nRGVsZWdhdGUoICdDbGllbnQgQ29ubmVjdGVkIScpOwogCiAgICAgICBJbnB1dFRyYW5zcG9ydCA6PSBGSW5wdXRUcmFuc3BvcnRGYWN0b3J5LkdldFRyYW5zcG9ydCggY2xpZW50ICk7CiAgICAgICBPdXRwdXRUcmFuc3BvcnQgOj0gRk91dHB1dFRyYW5zcG9ydEZhY3RvcnkuR2V0VHJhbnNw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5cGU6IEludGVnZXI7CisgICAgYWlfcHJvdG9jb2w6IEludGVnZXI7CisgICAgYWlfYWRkcmxlbjogTmF0aXZlVUludDsKKyAgICBhaV9jYW5vbm5hbWU6IFBBbnNpQ2hhcjsKKyAgICBhaV9hZGRyOiBQU29ja0FkZHI7CisgICAgYWlfbmV4dDogUEFkZHJJbmZvQTsKKyAgZW5kOworCisgIFBBZGRySW5mb1cgPSBeVEFkZHJJbmZvVzsKKyAgVEFkZHJJbmZvVyA9IHJlY29yZAorICAgIGFpX2ZsYWdzOiBJbnRlZ2VyOworICAgIGFpX2ZhbWlseTogSW50ZWdlcjsKKyAgICBhaV9zb2NrdHlwZTogSW50ZWdlcjsKKyAgICBhaV9wcm90b2NvbDogSW50ZWdlcjsKKyAgICBhaV9hZGRybGVuOiBOYXRpdmVVSW50OworICAgIGFpX2Nhbm9ubmFtZTogUENoYXI7CisgICAgYWlfYWRkcjogUFNvY2tBZGRyOworICAgIGFpX25leHQ6IFBBZGRySW5mb1c7CisgIGVuZDsKKworICBUQWRkcmVzc0ZhbWlseSA9IFVTSE9SVDsKKworICBUSW42QWRkciA9IHJlY29yZAorICBjYXNlIEludGVnZXIgb2YKKyAgICAwOiAoX0J5dGU6IGFycmF5WzAuLjE1XSBvZiBVQ0hBUik7CisgICAgMTogKF9Xb3JkOiBhcnJheVswLi43XSBvZiBVU0hPUlQpOworICBlbmQ7CisKKyAgVFNjb3BlSWQgPSByZWNvcmQKKyAgcHVibGljCisgICAgVmFsdWU6IFVMT05HOworICBwcml2YXRlCisgICAgZnVuY3Rpb24gR2V0Qml0RmllbGQoTG9jOiBJbnRlZ2VyKTogSW50ZWdlcjsgaW5saW5lOworICAgIHByb2NlZHVyZSBTZXRCaXRGaWVsZChMb2M6IEludGVnZXI7IGNvbnN0IGFWYWx1ZTogSW50ZWdlcik7IGlubGluZTsKKyAgcHVibGljCisgICAgcHJvcGVydHkgWm9uZTogSW50ZWdlciBpbmRleCAkMDAyOCByZWFkIEdldEJpdE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HVyZShzb2NrOiBXaW5hcGkuV2luc29jazIuVFNvY2tldCk7CisKKyAgVFNlcnZlclNvY2tldCA9IGNsYXNzKFRCYXNlU29ja2V0KQorICBzdHJpY3QgcHJpdmF0ZQorICAgIEZBZGRyZXNzOiBzdHJpbmc7CisgICAgRkFjY2VwdEJhY2tsb2csCisgICAgRlJldHJ5TGltaXQsCisgICAgRlJldHJ5RGVsYXksCisgICAgRlRjcFNlbmRCdWZmZXIsCisgICAgRlRjcFJlY3ZCdWZmZXI6IEludGVnZXI7CisgICAgRkFjY2VwdFRpbWVvdXQ6IExvbmd3b3JkOworICAgIEZMaXN0ZW5pbmcsCisgICAgRkludGVycnVwdGFibGVDaGlsZHJlbjogQm9vbGVhbjsKKyAgICBGSW50ZXJydXB0U29ja1dyaXRlciwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGlzIG5vdGlmaWVkIG9uIEludGVycnVwdCgpCisgICAgRkludGVycnVwdFNvY2tSZWFkZXIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpcyB1c2VkIGluIHNlbGVjdCB3aXRoIEZTb2NrZXQgZm9yIGludGVycnVwdGFiaWxpdHkKKyAgICBGQ2hpbGRJbnRlcnJ1cHRTb2NrV3JpdGVyOiBXaW5hcGkuV2luc29jazIuVFNvY2tldDsgICAgICAgICAgICAgICAgIC8vIGlzIG5vdGlmaWVkIG9uIEludGVycnVwdENoaWxkcmVuKCkKKyAgICBGQ2hpbGRJbnRlcnJ1cHRTb2NrUmVhZGVyOiBJU21hcnRQb2ludGVyPFdpbmFwaS5XaW5zb2NrMi5UU29ja2V0PjsgIC8vIGlmIEZudGVycnVwdGFibGVDaGlsZHJlbiB0aGlzIGlzIHNoYXJlZCB3aXRoIGNoaWxkIFRTb2NrZXRzCisgICAgRkxpc3RlbkNhbGxiYWNrLAorICAgIEZBY2NlcHRDYWxsYmFjazogVFNlcnZlclNvY2tldEZ1b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ZW50LkV4ZWN1dGUoY29uc3QgYXJnczogYXJyYXkgb2Ygc3RyaW5nKTsKK2NsYXNzIHByb2NlZHVyZSBUVGVzdENsaWVudC5QcmludENtZExpbmVIZWxwOworY29uc3QgSEVMUFRFWFQgPSAnIFtvcHRpb25zXScjMTAKKyAgICAgICAgICAgICAgICsgIzEwCisgICAgICAgICAgICAgICArICdBbGxvd2VkIG9wdGlvbnM6JyMxMAorICAgICAgICAgICAgICAgKyAnICAtaCBbIC0taGVscCBdICAgICAgICAgICAgICAgcHJvZHVjZSBoZWxwIG1lc3NhZ2UnIzEwCisgICAgICAgICAgICAgICArICcgIC0taG9zdCBhcmcgKD1sb2NhbGhvc3QpICAgICBIb3N0IHRvIGNvbm5lY3QnIzEwCisgICAgICAgICAgICAgICArICcgIC0tcG9ydCBhcmcgKD05MDkwKSAgICAgICAgICBQb3J0IG51bWJlciB0byBjb25uZWN0JyMxMAorICAgICAgICAgICAgICAgKyAnICAtLWRvbWFpbi1zb2NrZXQgYXJnICAgICAgICAgRG9tYWluIFNvY2tldCAoZS5nLiAvdG1wL1RocmlmdFRlc3QudGhyaWZ0KSwnIzEwCisgICAgICAgICAgICAgICArICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnN0ZWFkIG9mIGhvc3QgYW5kIHBvcnQnIzEwCisgICAgICAgICAgICAgICArICcgIC0tbmFtZWQtcGlwZSBhcmcgICAgICAgICAgICBXaW5kb3dzIE5hbWVkIFBpcGUgKGUuZy4gTXlUaHJpZnRQaXBlKScjMTAKKyAgICAgICAgICAgICAgICsgJyAgLS1hbm9uLXBpcGVzIGhSZWFkIGhXcml0ZSAgIFdpbmRvd3MgQW5vbnltb3VzIFBpcGVzIHBhaXIgKGhhbmRsZXMpJyMxMAorICAgICAgICAgICAgICAgKyAnICAtLXRyYW5zcG9ydCBhcmcgKD1zb2NrZXRzKSAgVHJhbnNwb3J0OiBidWZmZXJlZCwgZnJhbWVkLCBodHRwLCBldmh0dHAnIzEwCisgICAg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m90VHlwZSAgIDo9IHByb3RfQmluYXJ5OworICAgIGVuZHBvaW50ICAgOj0gdHJuc19Tb2NrZXRzOworICAgIGxheWVyZWQgICAgOj0gW107CisgICAgdXNlU1NMICAgICA6PSBGQUxTRTsKKyAgICBob3N0ICAgICAgIDo9ICdsb2NhbGhvc3QnOworICAgIHBvcnQgICAgICAgOj0gOTA5MDsKKyAgICBzUGlwZU5hbWUgIDo9ICcnOworICAgIGhBbm9uUmVhZCAgOj0gSU5WQUxJRF9IQU5ETEVfVkFMVUU7CiAgICAgaEFub25Xcml0ZSA6PSBJTlZBTElEX0hBTkRMRV9WQUxVRTsKKyAgZW5kOworCisgIHRyeQogICAgIGkgOj0gMDsKLSAgICB0cnkKLSAgICAgIHdoaWxlICggaSA8IExlbmd0aChhcmdzKSApIGRvCi0gICAgICBiZWdpbgorICAgIHdoaWxlICggaSA8IExlbmd0aChhcmdzKSApIGRvIGJlZ2luCisgICAgICBzIDo9IGFyZ3NbaV07CisgICAgICBJbmMoIGkpOwogCi0gICAgICAgIHRyeQotICAgICAgICAgIGlmICggYXJnc1tpXSA9ICctaCcpIHRoZW4KLSAgICAgICAgICBiZWdpbgotICAgICAgICAgICAgSW5jKCBpICk7Ci0gICAgICAgICAgICBzIDo9IGFyZ3NbaV07Ci0gICAgICAgICAgICBuIDo9IFBvcyggJzonLCBzKTsKLSAgICAgICAgICAgIGlmICggbiA+IDAgKSB0aGVuCi0gICAgICAgICAgICBiZWdpbgotICAgICAgICAgICAgICBob3N0IDo9IENvcHkoIHMsIDEsIG4gLSAxKTsKLSAgICAgICAgICAgICAgcG9ydCA6PSBTdHJUb0ludCggQ29weSggcywgbiArIDEsIE1heEludCkpOwotICAgICAgICAgICAgZW5kIGVsc2UKLSAgICAgICAgICAgIGJlZ2luCi0gICAgICAgICAgICAgIGhvc3QgOj0gczsKLSAgICAgICAgICAgIGVuZDsKLSAgICAgICAgICBlbmQKLSAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID0gJy11JykgdGhlbgotICAgICAgICAgIGJlZ2luCi0gICAgICAgICAgICBJbmMoIGkgKTsKLSAgICAgICAgICAgIHVybCA6PSBhcmdzW2ldOwotICAgICAgICAgIGVuZAotICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPSAnLW4nKSB0aGVuCi0gICAgICAgICAgYmVnaW4KLSAgICAgICAgICAgIEluYyggaSApOwotICAgICAgICAgICAgRk51bUl0ZXJhdGlvbiA6PSBTdHJUb0ludCggYXJnc1tpXSApOwotICAgICAgICAgIGVuZAotICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPSAnLWInKSB0aGVuCi0gICAgICAgICAgYmVnaW4KLSAgICAgICAgICAgIGJCdWZmZXJlZCA6PSBUcnVlOwotICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoJ0J1ZmZlcmVkIHRyYW5zcG9ydCcpOwotICAgICAgICAgIGVuZAotICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPSAnLWYnICkgb3IgKCBhcmdzW2ldID0gJy1mcmFtZWQnKSB0aGVuCi0gICAgICAgICAgYmVnaW4KLSAgICAgICAgICAgIGJGcmFtZWQgOj0gVHJ1ZTsKLSAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCdGcmFtZWQgdHJhbnNwb3J0Jyk7Ci0gICAgICAgICAgZW5kCi0gICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9ICctcGlwZScpIHRoZW4gIC8vIC1waXBlIDxuYW1lPgotICAgICAgICAgIGJlZ2luCi0gICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgnTmFtZWQgcGlwZXMgdHJhbnNwb3J0Jyk7Ci0gICAgICAgICAgICBJbmMoIGkgKTsKLSAgICAgICAgICAgIHNQaXBlTmFtZSA6PSBhcmdzW2ldOwotICAgICAgICAgIGVuZAotICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPSAnLWFub24nKSB0aGVuICAvLyAtYW5vbiA8aFJlYWRQaXBlPiA8aFdyaXRlUGlwZT4KLSAgICAgICAgICBiZWdpbgotICAgICAgICAgICAgaWYgTGVuZ3RoKGFyZ3MpIDw9IChpKzIpIHRoZW4gYmVnaW4KLSAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoJ0ludmFsaWQgYXJnczogLWFub24gPGhSZWFkPiA8aFdyaXRlPiBvciB1c2UgInNlcnZlci5leGUgLWFub24iJyk7Ci0gICAgICAgICAgICAgIEhhbHQoMSk7Ci0gICAgICAgICAgICBlbmQ7Ci0gICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgnQW5vbnltb3VzIHBpcGVzIHRyYW5zcG9ydCcpOwotICAgICAgICAgICAgSW5jKCBpKTsKLSAgICAgICAgICAgIGhBbm9uUmVhZCA6PSBUSGFuZGxlKCBTdHJUb0ludERlZiggYXJnc1tpXSwgSW50ZWdlcihJTlZBTElEX0hBTkRMRV9WQUxVRSkpKTsKLSAgICAgICAgICAgIEluYyggaSk7Ci0gICAgICAgICAgICBoQW5vbldyaXRlIDo9IFRIYW5kbGUoIFN0clRvSW50RGVmKCBhcmdzW2ldLCBJbnRlZ2VyKElOVkFMSURfSEFORExFX1ZBTFVFKSkpOwotICAgICAgICAgICAgYkFub25QaXBlIDo9IFRSVUU7Ci0gICAgICAgICAgZW5kCi0gICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9ICctdCcpIHRoZW4KLSAgICAgICAgICBiZWdpbgotICAgICAgICAgICAgSW5jKCBpICk7Ci0gICAgICAgICAgICBGTnVtVGhyZWFkIDo9IFN0clRvSW50KCBhcmdzW2ldICk7Ci0gICAgICAgICAgZW5kCi0gICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9ICctcHJvdCcpIHRoZW4gIC8vIC1wcm90IEpTT058YmluYXJ5Ci0gICAgICAgICAgYmVnaW4KLSAgICAgICAgICAgIEluYyggaSApOwotICAgICAgICAgICAgcyA6PSBhcmdzW2ldOwotICAgICAgICAgICAgZm9yIHA6PSBMb3coVEtub3duUHJvdG9jb2wpIHRvIEhpZ2goVEtub3duUHJvdG9jb2wpIGRvIGJlZ2luCi0gICAgICAgICAgICAgIGlmIFNhbWVUZXh0KCBzLCBLTk9XTl9QUk9UT0NPTFNbcF0pIHRoZW4gYmVnaW4KLSAgICAgICAgICAgICAgICBwcm90VHlwZSA6PSBwOwotICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCdVc2luZyAnK0tOT1dOX1BST1RPQ09MU1twcm90VHlwZV0rJyBwcm90b2NvbCcpOwotICAgICAgICAgICAgICAgIEJyZWFrOwotICAgICAgICAgICAgICBlbmQ7Ci0gICAgICAgICAgICBlbmQ7Ci0gICAgICAgICAgZW5kOwotICAgICAgICBmaW5hbGx5Ci0gICAgICAgICAgSW5jKCBpICk7Ci0gICAgICAgIGVuZDsKKyAgICAgIGlmIChzID0gJy1oJykgb3IgKHMgPSAnLS1oZWxwJykgdGhlbiBiZWdpbgorICAgICAgICAvLyAtaCBbIC0taGVscCBdICAgICAgICAgICAgICAgcHJvZHVjZSBoZWxwIG1lc3NhZ2UKKyAgICAgICAgUHJpbnRDbWRMaW5lSGVscDsKKyAgICAgICAgcmVzdWx0IDo9ICRGRjsgICAvLyBhbGwgdGVzdHMgZmFpbGVkCisgICAgICAgIEV4aXQ7CisgICAgICBlbmQKKyAgICAgIGVsc2UgaWYgcyA9ICctLWhvc3QnIHRoZW4gYmVnaW4KKyAgICAgICAgLy8gLS1ob3N0IGFyZyAoPWxvY2FsaG9zdCkgICAgIEhvc3QgdG8gY29ubmVjdAorICAgICAgICBzZXR1cC5ob3N0IDo9IGFyZ3NbaV07CisgICAgICAgIEluYyggaSk7CisgICAgICBlbmQKKyAgICAgIGVsc2UgaWYgcyA9ICctLXBvcnQnIHRoZW4gYmVnaW4KKyAgICAgICAgLy8gLS1wb3J0IGFyZyAoPTkwOTApICAgICAgICAgIFBvcnQgbnVtYmVyIHRvIGNvbm5lY3QKKyAgICAgICAgcyA6PSBhcmdzW2ldOworICAgICAgICBJbmMoIGkpOworICAgICAgICBzZXR1cC5wb3J0IDo9IFN0clRvSW50RGVmKHMsMCk7CisgICAgICAgIGlmIHNldHVwLnBvcnQgPD0gMCB0aGVuIEludmFsaWRBcmdzOworICAgICAgZW5kCisgICAgICBlbHNlIGlmIHMgPSAnLS1kb21haW4tc29ja2V0JyB0aGVuIGJlZ2luCisgICAgICAgIC8vIC0tZG9tYWluLXNvY2tldCBhcmcgICAgICAgICBEb21haW4gU29ja2V0IChlLmcuIC90bXAvVGhyaWZ0VGVzdC50aHJpZnQpLCBpbnN0ZWFkIG9mIGhvc3QgYW5kIHBvcnQKKyAgICAgICAgcmFpc2UgRXhjZXB0aW9uLkNyZWF0ZSgnZG9tYWluLXNvY2tldCBub3Qgc3VwcG9ydGVkJyk7CisgICAgICBlbmQKKyAgICAgIGVsc2UgaWYgcyA9ICctLW5hbWVkLXBpcGUnIHRoZW4gYmVnaW4KKyAgICAgICAgLy8gLS1uYW1lZC1waXBlIGFyZyAgICAgICAgICAgIFdpbmRvd3MgTmFtZWQgUGlwZSAoZS5nLiBNeVRocmlmdFBpcGUpCisgICAgICAgIHNldHVwLmVuZHBvaW50IDo9IHRybnNfTmFtZWRQaXBlczsKKyAgICAgICAgc2V0dXAuc1BpcGVOYW1lIDo9IGFyZ3NbaV07CisgICAgICAgIEluYyggaSk7CisgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCdVc2luZyBuYW1lZCBwaXBlICgnK3NldHVwLnNQaXBlTmFtZSsnKScpOworICAgICAgZW5kCisgICAgICBlbHNlIGlmIHMgPSAnLS1hbm9uLXBpcGVzJyB0aGVuIGJlZ2luCisgICAgICAgIC8vIC0tYW5vbi1waXBlcyBoUmVhZCBoV3JpdGUgICBXaW5kb3dzIEFub255bW91cyBQaXBlcyBwYWlyIChoYW5kbGVzKQorICAgICAgICBzZXR1cC5lbmRwb2ludCA6PSB0cm5zX0Fub25QaXBlczsKKyAgICAgICAgc2V0dXA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dzOworICAgICAgZW5kCisgICAgICBlbHNlIGlmIHMgPSAnLS1wcm90b2NvbCcgdGhlbiBiZWdpbgorICAgICAgICAvLyAtLXByb3RvY29sIGFyZyAoPWJpbmFyeSkgICAgUHJvdG9jb2w6IGJpbmFyeSwgY29tcGFjdCwganNvbgorICAgICAgICBzIDo9IGFyZ3NbaV07CisgICAgICAgIEluYyggaSk7CiAKLSAgICBleGNlcHQKLSAgICAgIG9uIEU6IEV4Y2VwdGlvbiBkbwotICAgICAgYmVnaW4KLSAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIEUuTWVzc2FnZSApOworICAgICAgICBpZiAgICAgIHMgPSAnYmluYXJ5JyAgIHRoZW4gc2V0dXAucHJvdFR5cGUgOj0gcHJvdF9CaW5hcnkKKyAgICAgICAgZWxzZSBpZiBzID0gJ2NvbXBhY3QnICB0aGVuIHNldHVwLnByb3RUeXBlIDo9IHByb3RfQ29tcGFjdAorICAgICAgICBlbHNlIGlmIHMgPSAnanNvbicgICAgIHRoZW4gc2V0dXAucHJvdFR5cGUgOj0gcHJvdF9KU09OCisgICAgICAgIGVsc2UgSW52YWxpZEFyZ3M7CisgICAgICBlbmQKKyAgICAgIGVsc2UgaWYgcyA9ICctLXNzbCcgdGhlbiBiZWdpbgorICAgICAgICAvLyAtLXNzbCAgICAgICAgICAgICAgICAgICAgICAgRW5jcnlwdGVkIFRyYW5zcG9ydCB1c2luZyBTU0wKKyAgICAgICAgc2V0dXAudXNlU1NMIDo9IFRSVUU7CisKKyAgICAgIGVuZAorICAgICAgZWxzZSBpZiAocyA9ICctbicpIG9yIChzID0gJy0tdGVzdGxvb3BzJykgdGhlbiBiZWdpbgorICAgICAgICAvLyAtbiBbIC0tdGVzdGxvb3BzIF0gYXJnICg9MSkgTnVtYmVyIG9mIFRlc3RzCisgICAgICAgIEZOdW1JdGVyYXRpb24gOj0gU3RyVG9JbnREZWYoIGFyZ3NbaV0sIDApOworICAgICAgICBJbmMoIGkpOworICAgICAgICBpZ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W50cy5wYXMKaW5kZXggZjIxYTRiYi4uMzc5NjlkYyAxMDA2NDQKLS0tIGEvbGliL2RlbHBoaS90ZXN0L1Rlc3RDb25zdGFudHMucGFzCisrKyBiL2xpYi9kZWxwaGkvdGVzdC9UZXN0Q29uc3RhbnRzLnBhcwpAQCAtMjEsMTMgKzIxLDQ5IEBACiAKIGludGVyZmFjZQogCit1c2VzIFN5c1V0aWxzOworCiB0eXBlCi0gIFRLbm93blByb3RvY29sID0gKCBwcm90X0JpbmFyeSwgIC8vIGRlZmF1bHQgYmluYXJ5IHByb3RvY29sCi0gICAgICAgICAgICAgICAgICAgICBwcm90X0pTT04gICAgIC8vIEpTT04gcHJvdG9jb2wKLSAgICAgICAgICAgICAgICAgICApOworICBUS25vd25Qcm90b2NvbCA9ICgKKyAgICBwcm90X0JpbmFyeSwgIC8vIGRlZmF1bHQgYmluYXJ5IHByb3RvY29sCisgICAgcHJvdF9KU09OLCAgICAvLyBKU09OIHByb3RvY29sCisgICAgcHJvdF9Db21wYWN0CisgICk7CisKKyAgVFNlcnZlclR5cGUgPSAoCisgICAgc3J2X1NpbXBsZSwKKyAgICBzcnZfTm9uYmxvY2tpbmcsCisgICAgc3J2X1RocmVhZHBvb2wsCisgICAgc3J2X1RocmVhZGVkCisgICk7CisKKyAgVEVuZHBvaW50VHJhbnNwb3J0ID0gKAorICAgIHRybnNfU29ja2V0cywKKyAgICB0cm5zX0h0dHAsCisgICAgdHJuc19OYW1lZFBpcGVzLAorICAgIHRybnNfQW5vblBpcGVzLAorICAgIHRybnNfRXZIdHRwICAvLyBhcyBsaXN0ZWQgb24gaHR0cDovL3RocmlmdC5hcGFjaGUub3JnL3Rlc3QKKyAgKTsKKworICBUTGF5ZXJlZFRyYW5zcG9ydCA9ICgKKyAgICB0cm5zX0J1ZmZlcmVkLAorICAgIHRybnNfRnJhbWVkCisgICk7CisKKyAgVExheWVyZWRUcmFuc3BvcnRzID0gc2V0IG9mIFRMYXllcmVkVHJhbnNwb3J0Owor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nM6JyMxMAorICAgICAgICAgICAgICAgKyAnICAtaCBbIC0taGVscCBdICAgICAgICAgICAgICAgcHJvZHVjZSBoZWxwIG1lc3NhZ2UnIzEwCisgICAgICAgICAgICAgICArICcgIC0tcG9ydCBhcmcgKD05MDkwKSAgICAgICAgICBQb3J0IG51bWJlciB0byBsaXN0ZW4nIzEwCisgICAgICAgICAgICAgICArICcgIC0tZG9tYWluLXNvY2tldCBhcmcgICAgICAgICBVbml4IERvbWFpbiBTb2NrZXQgKGUuZy4gL3RtcC9UaHJpZnRUZXN0LnRocmlmdCknIzEwCisgICAgICAgICAgICAgICArICcgIC0tbmFtZWQtcGlwZSBhcmcgICAgICAgICAgICBXaW5kb3dzIE5hbWVkIFBpcGUgKGUuZy4gTXlUaHJpZnRQaXBlKScjMTAKKyAgICAgICAgICAgICAgICsgJyAgLS1zZXJ2ZXItdHlwZSBhcmcgKD1zaW1wbGUpIHR5cGUgb2Ygc2VydmVyLCAic2ltcGxlIiwgInRocmVhZC1wb29sIiwnIzEwCisgICAgICAgICAgICAgICArICcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhyZWFkZWQiLCBvciAibm9uYmxvY2tpbmciJyMxMAorICAgICAgICAgICAgICAgKyAnICAtLXRyYW5zcG9ydCBhcmcgKD1zb2NrZXQpICAgdHJhbnNwb3J0OiBidWZmZXJlZCwgZnJhbWVkLCBodHRwLCBhbm9ucGlwZScjMTAKKyAgICAgICAgICAgICAgICsgJyAgLS1wcm90b2NvbCBhcmcgKD1iaW5hcnkpICAgIHByb3RvY29sOiBiaW5hcnksIGNvbXBhY3QsIGpzb24nIzEwCisgICAgICAgICAgICAgICArICcgIC0tc3NsICAgICAgICAgICAgICAgICAgICAgICBFbmNyeXB0ZWQgVHJhbnNwb3J0IHVzaW5nIFNTTCcjMTAKKyAgICAgICAgICAgICAgICsgJyAgLS1wcm9jZXNzb3ItZXZlbnRzICAgICAgICAgIHByb2Nlc3Nvci1ldmVudHMnIzEwCisgICAgICAgIC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ICAgIHdoaWxlICggaSA8IExlbmd0aChhcmdzKSApIGRvIGJlZ2luCiAgICAgICBzIDo9IGFyZ3NbaV07CiAgICAgICBJbmMoaSk7CiAKLSAgICAgIGlmIFN0clRvSW50RGVmKCBzLCAtMSkgPiAwIHRoZW4KLSAgICAgIGJlZ2luCi0gICAgICAgIFBvcnQgOj0gIFN0clRvSW50RGVmKCBzLCBQb3J0KTsKKyAgICAgIC8vIEFsbG93ZWQgb3B0aW9uczoKKyAgICAgIGlmIChzID0gJy1oJykgb3IgKHMgPSAnLS1oZWxwJykgdGhlbiBiZWdpbgorICAgICAgICAvLyAtaCBbIC0taGVscCBdICAgICAgICAgICAgICAgcHJvZHVjZSBoZWxwIG1lc3NhZ2UKKyAgICAgICAgUHJpbnRDbWRMaW5lSGVscDsKKyAgICAgICAgRXhpdDsKICAgICAgIGVuZAotICAgICAgZWxzZSBpZiAoIHMgPSAncmF3JyApIHRoZW4KLSAgICAgIGJlZ2luCi0gICAgICAgIC8vIGFzIGRlZmF1bHQKKyAgICAgIGVsc2UgaWYgKHMgPSAnLS1wb3J0JykgdGhlbiBiZWdpbgorICAgICAgICAvLyAtLXBvcnQgYXJnICg9OTA5MCkgICAgICAgICAgUG9ydCBudW1iZXIgdG8gbGlzdGVuCisgICAgICAgIHMgOj0gYXJnc1tpXTsKKyAgICAgICAgSW5jKGkpOworICAgICAgICBQb3J0IDo9IFN0clRvSW50RGVmKCBzLCBQb3J0KTsKICAgICAgIGVuZAotICAgICAgZWxzZSBpZiAoIHMgPSAnYnVmZmVyZWQnICkgdGhlbgotICAgICAgYmVnaW4KLSAgICAgICAgVXNlQnVmZmVyZWRTb2NrZXRzIDo9IFRydWU7CisgICAgICBlbHNlIGlmIChzID0gJy0tZG9tYWluLXNvY2tldCcpIHRoZW4gYmVnaW4KKyAgICAgICAgLy8gLS1kb21haW4tc29ja2V0IGFyZyAgICAgICAgIFVuaXggRG9tYWluIFNvY2tldCAoZS5nLiAvdG1wL1RocmlmdFRlc3Q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b2Nlc3Nvci1ldmVudHMnKSB0aGVuIGJlZ2luCisgICAgICAgICAvLyAtLXByb2Nlc3Nvci1ldmVudHMgICAgICAgICAgcHJvY2Vzc29yLWV2ZW50cworICAgICAgICBTZXJ2ZXJFdmVudHMgOj0gVFJVRTsKKyAgICAgIGVuZAorICAgICAgZWxzZSBpZiAocyA9ICctbicpIG9yIChzID0gJy0td29ya2VycycpIHRoZW4gYmVnaW4KKyAgICAgICAgLy8gLW4gWyAtLXdvcmtlcnMgXSBhcmcgKD00KSAgIE51bWJlciBvZiB0aHJlYWQgcG9vbHMgd29ya2Vycy4KKyAgICAgICAgLy8gT25seSB2YWxpZCBmb3IgdGhyZWFkLXBvb2wgc2VydmVyIHR5cGUKKyAgICAgICAgcyA6PSBhcmdzW2ldOworICAgICAgICBudW1Xb3JrZXIgOj0gU3RyVG9JbnREZWYocywwKTsKKyAgICAgICAgaWYgbnVtV29ya2VyID4gMAorICAgICAgICB0aGVuIEluYyhpKQorICAgICAgICBlbHNlIG51bVdvcmtlciA6PSA0OworICAgICAgZW5kCisgICAgICBlbHNlIGJlZ2luCisgICAgICAgIEludmFsaWRBcmdzOworICAgICAgZW5kOwogICAgIGVuZDsKIAogCkBAIC01NjEsMzQgKzYzMyw0OSBAQAogCiAgICAgLy8gY3JlYXRlIHByb3RvY29sIGZhY3RvcnksIGRlZmF1bHQgdG8gQmluYXJ5UHJvdG9jb2wKICAgICBjYXNlIHByb3RUeXBlIG9mCi0gICAgICBwcm90X0JpbmFyeTogIFByb3RvY29sRmFjdG9yeSA6PSBUQmluYXJ5UHJvdG9jb2xJbXBsLlRGYWN0b3J5LkNyZWF0ZSggQklOQVJZX1NUUklDVF9SRUFELCBCSU5BUllfU1RSSUNUX1dSSVRFKTsKLSAgICAgIHByb3RfSlNPTiAgOiAgUHJvdG9jb2xGYWN0b3J5IDo9IFRKU09OUHJvdG9jb2xJbXBsLlRGYWN0b3J5LkNyZWF0ZTsKKyAgICAgIHByb3RfQmluYXJ5ICA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gU3lzVXRpbHM7CQkJPj4gJVRFU1RBUFAlLmRwcgotZWNoby4gICAgCQkJCQkJCQkJPj4gJVRFU1RBUFAlLmRwcgotZWNobyBiZWdpbiAJCQkJCQkJCQk+PiAlVEVTVEFQUCUuZHByCi1lY2hvICAgV3JpdGVsbignU3VjY2Vzc2Z1bGx5IGNvbXBpbGVkIScpOwk+PiAlVEVTVEFQUCUuZHByCi1lY2hvICAgV3JpdGVsbignTGlzdCBvZiB1bml0czonKTsJPj4gJVRFU1RBUFAlLmRwcgotZm9yICUlYSBpbiAoKi5wYXMpIGRvIGVjaG8gICBXcml0ZSgnJSV+bmEnOjMwLCcnOjEwKTsgID4+ICVURVNUQVBQJS5kcHIKLWVjaG8gICBXcml0ZWxuOwk+PiAlVEVTVEFQUCUuZHByCi1lY2hvIGVuZC4gCQkJCQkJCQkJPj4gJVRFU1RBUFAlLmRwcgotZWNoby4gICAgCQkJCQkJCQkJPj4gJVRFU1RBUFAlLmRwcgorZWNobyBwcm9ncmFtICVURVNUQVBQJTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPiAlVEVTVEFQUCUuZHByCitlY2hvIHskQVBQVFlQRSBDT05TT0xFfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4+ICVURVNUQVBQJS5kcHIKK2VjaG8uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPj4gJVRFU1RBUFAlLmRwcgorZWNobyB1c2VzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+PiAlVEVTVEFQUCUuZHByCitmb3IgJSVhIGluICgqLnBhcykgZG8gZWNobyAgICUlfm5hLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4+ICVURVNUQVBQJS5kcHIKK2VjaG8gICBXaW5kb3dzLCBDbGFzc2VzLCBTeXNVdGlsczsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPj4gJVRFU1RBUFAlLmRwcgorZWNoby4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+PiAlVEVTVEFQUCUuZHByCitlY2hvIGJlZ2luICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4+ICVURVNUQVBQJS5kcHIKK2VjaG8gICBXcml0ZWxuKCdTdWNjZXNzZnVsbHkgY29tcGlsZWQhJyk7ICAgICAgICAgICAgICAgICAgICAgICAgPj4gJVRFU1RBUFAlLmRwcgorZWNobyAgIFdyaXRlbG4oJ0xpc3Qgb2YgdW5pdHM6Jyk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+PiAlVEVTVEFQUCUuZHByCitmb3IgJSVhIGluICgqLnBhcykgZG8gZWNobyAgIFdyaXRlKCclJX5uYSc6MzAsJyc6MTApOyAgICAgICAgICAgID4+ICVURVNUQVBQJS5kcHIKK2VjaG8gICBXcml0ZWxuOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPj4gJVRFU1RBUFAlLmRwcgorZWNobyBlbmQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+PiAlVEVTVEFQUCUuZHByCitlY2hvLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4+ICVURVNUQVBQJS5kcHIKIGNkIC4uXC4uCiAKIHJlbSAqIHRyeSB0byBjb21waWxlIHRoZSBEUFIKIHJlbSAqIHRoaXMgc2hvdWxkIG5vdCB0aHJvdyBhbnkgZXJyb3JzLCB3YXJuaW5ncyBvciBoaW50cwotIiVEQ0MlIiAgLUIgIiVUQVJHRVQlXCVTVUJESVIlXCVURVNUQVBQJSIgLVUiJVVOSVRTRUFSQ0glIiAtSSIlVU5JVFNFQVJDSCUiIC1OIiVPVVRE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gICBGID0gZnVuKCkgLT4KLSAgICAgICAgICAgICAgICB7b2ssIFRyYW5zcG9ydH0gPSBUcmFuc3BvcnRGYWN0b3J5KCksCi0gICAgICAgICAgICAgICAgdGhyaWZ0X2JpbmFyeV9wcm90b2NvbDpuZXcoCi0gICAgICAgICAgICAgICAgICBUcmFuc3BvcnQsCi0gICAgICAgICAgICAgICAgICBbe3N0cmljdF9yZWFkLCAgUGFyc2VkT3B0cyN0YnBfb3B0cy5zdHJpY3RfcmVhZH0sCi0gICAgICAgICAgICAgICAgICAge3N0cmljdF93cml0ZSwgUGFyc2VkT3B0cyN0YnBfb3B0cy5zdHJpY3Rfd3JpdGV9XSkKKyAgICAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0RmFjdG9yeSgpIG9mCisgICAgICAgICAgICAgICAgICAgIHtvaywgVHJhbnNwb3J0fSAtPgorICAgICAgICAgICAgICAgICAgICAgICAgdGhyaWZ0X2JpbmFyeV9wcm90b2NvbDpuZXcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFt7c3RyaWN0X3JlYWQsICBQYXJzZWRPcHRzI3RicF9vcHRzLnN0cmljdF9yZWFkfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3N0cmljdF93cml0ZSwgUGFyc2VkT3B0cyN0YnBfb3B0cy5zdHJpY3Rfd3JpdGV9XSk7CisgICAgICAgICAgICAgICAgICAgIHtlcnJvciwgRXJyb3J9IC0+CisgICAgICAgICAgICAgICAgICAgICAgICB7ZXJyb3IsIEVycm9yfQorICAgICAgICAgICAgICAgIGVuZAogICAgICAgICBlbmQsCiAgICAge29rLCBGfS4KIApkaWZmIC0tZ2l0IGEvbGliL2VybC9zcmMvdGhyaWZ0X2J1ZmZlcmVkX3RyYW5zcG9ydC5lcmwgYi9saWIvZXJsL3NyYy90aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0LmVybAppbmRleCBkNGQ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1bmN0aW9uX2NhbGwoQ2xpZW50ID0gI3RjbGllbnR7cHJvdG9jb2wgPSBQcm90bzAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZSAgPSBTZXJ2aWNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcWlkICAgID0gU2VxSWR9LAotICAgICAgICAgICAgICAgICAgIEZ1bmN0aW9uLAotICAgICAgICAgICAgICAgICAgIEFyZ3MpIC0+Ci0gICAgUGFyYW1zID0gU2VydmljZTpmdW5jdGlvbl9pbmZvKEZ1bmN0aW9uLCBwYXJhbXNfdHlwZSksCi0gICAgY2FzZSBQYXJhbXMgb2YKLSAgICAgICAgbm9fZnVuY3Rpb24gLT4KLSAgICAgICAgICAgIHtDbGllbnQsIHtlcnJvciwge25vX2Z1bmN0aW9uLCBGdW5jdGlvbn19fTsKLSAgICAgICAge3N0cnVjdCwgUExpc3R9IHdoZW4gbGVuZ3RoKFBMaXN0KSA9Lz0gbGVuZ3RoKEFyZ3MpIC0+Ci0gICAgICAgICAgICB7Q2xpZW50LCB7ZXJyb3IsIHtiYWRfYXJncywgRnVuY3Rpb24sIEFyZ3N9fX07Ci0gICAgICAgIHtzdHJ1Y3QsIF9QTGlzdH0gLT4KLSAgICAgICAgICAgIEJlZ2luID0gI3Byb3RvY29sX21lc3NhZ2VfYmVnaW57bmFtZSA9IGF0b21fdG9fbGlzdChGdW5jdGlvbiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSA/dE1lc3NhZ2VUeXBlX0NBTEwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcWlkID0gU2VxSWR9LAotICAgICAgICAgICAge1Byb3RvMSwgb2t9ID0gdGhyaWZ0X3Byb3RvY29sOndyaXRlKFByb3RvMCwgQmVnaW4pLAotICAgICAgICAgICAge1Byb3RvMiwgb2t9ID0gdGhyaWZ0X3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2FnZVR5cGVfUkVQTFl9IC0+Ci0gICAgICAgICAgICBoYW5kbGVfcmVwbHkoTmV3Q2xpZW50LCBGdW5jdGlvbiwgUmVwbHlUeXBlKQorICAgIGNhc2UgdGhyaWZ0X3Byb3RvY29sOnJlYWQoUHJvdG8wLCBtZXNzYWdlX2JlZ2luKSBvZgorICAgICAgICAge1Byb3RvMSwge2Vycm9yLCBSZWFzb259fSAtPgorICAgICAgICAgICAgIE5ld0NsaWVudCA9IENsaWVudCN0Y2xpZW50e3Byb3RvY29sID0gUHJvdG8xfSwKKyAgICAgICAgICAgICB7TmV3Q2xpZW50LCB7ZXJyb3IsIFJlYXNvbn19OworICAgICAgICAge1Byb3RvMSwgTWVzc2FnZUJlZ2lufSAtPgorICAgICAgICAgICAgIE5ld0NsaWVudCA9IENsaWVudCN0Y2xpZW50e3Byb3RvY29sID0gUHJvdG8xfSwKKyAgICAgICAgICAgICBjYXNlIE1lc3NhZ2VCZWdpbiBvZgorICAgICAgICAgICAgICAgICAjcHJvdG9jb2xfbWVzc2FnZV9iZWdpbntzZXFpZCA9IFJldFNlcUlkfSB3aGVuIFJldFNlcUlkID0vPSBTZXFJZCAtPgorICAgICAgICAgICAgICAgICAgICAge05ld0NsaWVudCwge2Vycm9yLCB7YmFkX3NlcV9pZCwgU2VxSWR9fX07CisgICAgICAgICAgICAgICAgICNwcm90b2NvbF9tZXNzYWdlX2JlZ2lue3R5cGUgPSA/dE1lc3NhZ2VUeXBlX0VYQ0VQVElPTn0gLT4KKyAgICAgICAgICAgICAgICAgICAgIGhhbmRsZV9hcHBsaWNhdGlvbl9leGNlcHRpb24oTmV3Q2xpZW50KTsKKyAgICAgICAgICAgICAgICAgI3Byb3RvY29sX21lc3NhZ2VfYmVnaW57dHlwZSA9ID90TWVzc2FnZVR5cGVfUkVQTFl9IC0+CisgICAgICAgICAgICAgICAgICAgICBoYW5kbGVfcmVwbHkoTmV3Q2xpZW50LCBGdW5jdGlvbiwgUmVwbHlUeXBlKQorICAg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ICAgIHt2YWx1ZSwge18sIHRydWV9LCBUcmFuc09wdHMxfSAtPiB7dGhyaWZ0X3NzbHNvY2tldF90cmFuc3BvcnQsIFRyYW5zT3B0czF9OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC0+IHt0aHJpZnRfc29ja2V0X3RyYW5zcG9ydCwgVHJhbnNPcHRzMH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKKworICAgIHtQcm90b2NvbE1vZHVsZSwgUHJvdG9PcHRzMX0gPSBjYXNlIGxpc3RzOmtleXRha2UocHJvdG9jb2wsIDEsIFByb3RvT3B0cykgb2YKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7dmFsdWUsIHtfLCBjb21wYWN0fSwgT3B0c30gLT4ge3RocmlmdF9jb21wYWN0X3Byb3RvY29sLCBPcHRzfTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7dmFsdWUsIHtfLCBqc29ufSwgT3B0c30gLT4ge3RocmlmdF9qc29uX3Byb3RvY29sLCBPcHRzfTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7dmFsdWUsIHtfLCBiaW5hcnl9LCBPcHRzfSAtPiB7dGhyaWZ0X2JpbmFyeV9wcm90b2NvbCwgT3B0c307CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLT4ge3RocmlmdF9iaW5hcnlfcHJvdG9jb2wsIFByb3RvT3B0c30KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kLAogICAgIHtvaywgVHJhbnNwb3J0RmFjdG9yeX0gPQotICAgICAgICB0aHJpZnRfc29ja2V0X3RyYW5zcG9ydDpuZXdfdHJhbnNwb3J0X2ZhY3RvcnkoSG9zdCwgUG9ydCwgVHJhbnNPcHRzKSwKKyAgICAgICAgVHJhbnNwb3J0TW9kdWxlOm5ld190cmFuc3BvcnRfZmFjdG9yeShIb3N0LCBQb3J0LCBUcmFuc09wdHMyKSwKIAotICAgIHtvaywgUHJvdG9jb2xGYWN0b3J5fSA9IHRocmlmdF9iaW5hcnlfcHJvdG9jb2w6bmV3X3Byb3RvY29sX2ZhY3RvcnkoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUcmFuc3BvcnRGYWN0b3J5LCBQcm90b09wdHMpLAorICAgIHtvaywgUHJvdG9jb2xGYWN0b3J5fSA9IFByb3RvY29sTW9kdWxlOm5ld19wcm90b2NvbF9mYWN0b3J5KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVHJhbnNwb3J0RmFjdG9yeSwgUHJvdG9PcHRzMSksCisKKyAgICBjYXNlIFByb3RvY29sRmFjdG9yeSgpIG9mCisgICAgICAgIHtvaywgUHJvdG9jb2x9IC0+CisgICAgICAgICAgICB0aHJpZnRfY2xpZW50Om5ldyhQcm90b2NvbCwgU2VydmljZSk7CisgICAgICAgIHtlcnJvciwgRXJyb3J9IC0+CisgICAgICAgICAgICB7ZXJyb3IsIEVycm9yfQorICAgIGVuZC4KKworLXNwZWMgbmV3X211bHRpcGxleGVkKEhvc3QsIFBvcnQsIFNlcnZpY2VzLCBPcHRpb25zKSAtPiB7b2ssIFNlcnZpY2VUaHJpZnRDbGllbnRMaXN0fSB3aGVuCisgICAgSG9zdCAgICAgICAgOjogbm9uZW1wdHlfc3RyaW5nKCksCisgICAgUG9ydCAgICAgICAgOjogbm9uX25lZ19pbnRlZ2VyKCksCisgICAgU2VydmljZXMgICAgOjogbXVsdGlwbGV4ZWRfc2VydmljZV9tYXAoKSwKKyAgICBPcHRpb25zICAgICA6OiBsaXN0KCksCisgICAgU2VydmljZVRocmlmdENsaWVudExpc3QgOjogW3tTZXJ2aWNlTmFtZTo6bGlzdCgpLCBUaHJpZnRDbGllbnQ6OnRlcm0oKX1dLgorbmV3X211bHRpcGxleGVkKEhvc3QsIFBvcnQsIFNlcnZpY2VzLCBPcHRpb25zKSB3aGVuIGlzX2ludGVnZXIoUG9ydCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfbGlzdChTZXJ2aWNlcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNfbGlzdChPcHRpb25zKSAtPgorICAgIG5ld19tdWx0aXBsZXhlZCh0aHJpZnRfc29ja2V0X3RyYW5zcG9ydDpuZXdfdHJhbnNwb3J0X2ZhY3RvcnkoSG9zdCwgUG9ydCwgT3B0aW9ucyksIFNlcnZpY2VzLCBPcHRpb25zKS4KKworLXNwZWMgbmV3X211bHRpcGxleGVkKFRyYW5zcG9ydEZhY3RvcnlUdXBsZSwgU2VydmljZXMsIE9wdGlvbnMpIC0+IHtvaywgU2VydmljZVRocmlmdENsaWVudExpc3R9IHdoZW4KKyAgICBUcmFuc3BvcnRGYWN0b3J5VHVwbGUgICA6OiB7b2ssIFRyYW5zcG9ydEZhY3Rvcnk6OnRlcm0oKX0sCisgICAgU2VydmljZXMgICAgICAgICAgICAgICAgOjogbXVsdGlwbGV4ZWRfc2VydmljZV9tYXAoKSwKKyAgICBPcHRpb25zICAgICAgICAgICAgICAgICA6OiBsaXN0KCksCisgICAgU2VydmljZVRocmlmdENsaWVudExpc3QgOjogW3tTZXJ2aWNlTmFtZTo6c2VydmljZV9uYW1lKCksIFRocmlmdENsaWVudDo6dGVybSgpfV0uCituZXdfbXVsdGlwbGV4ZWQoVHJhbnNwb3J0RmFjdG9yeVR1cGxlLCBTZXJ2aWNlcywgT3B0aW9ucykgd2hlbiBpc19saXN0KFNlcnZpY2VzKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX2xpc3QoT3B0aW9ucyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc190dXBsZShUcmFuc3BvcnR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ybCIpLgorLWluY2x1ZGUoInRocmlmdF9wcm90b2NvbC5ocmwiKS4KKworLWV4cG9ydChbbmV3LzEsIG5ldy8yLAorICAgICAgICAgcmVhZC8yLAorICAgICAgICAgd3JpdGUvMiwKKyAgICAgICAgIGZsdXNoX3RyYW5zcG9ydC8xLAorICAgICAgICAgY2xvc2VfdHJhbnNwb3J0LzEsCisgICAgICAgICBuZXdfcHJvdG9jb2xfZmFjdG9yeS8yCisgICAgICAgIF0pLgorCistZGVmaW5lKElEX05PTkUsIDE2IzEwMDAwKS4KKy1kZWZpbmUoQ0JPT0xfTk9ORSwgMCkuCistZGVmaW5lKENCT09MX1RSVUUsIDEpLgorLWRlZmluZShDQk9PTF9GQUxTRSwgMikuCisKKy1yZWNvcmQodF9jb21wYWN0LCB7dHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgJSBzdGF0ZSBmb3IgcGVuZGluZyBib29sZWFuIGZpZWxkcworICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZF9zdGFjaz1bXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRfdmFsdWU9P0NCT09MX05PTkUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9zdGFjaz1bXSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlX2lkPT9JRF9OT05FCisgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLgorLXR5cGUgc3RhdGUoKSA6OiAjdF9jb21wYWN0e30uCistaW5jbHVkZSgidGhyaWZ0X3Byb3RvY29sX2JlaGF2aW91ci5ocmwiKS4KKworLWRlZmluZShQUk9UT0NPTF9JRCwgMTYjODIpLgorLWRlZmluZShWRVJTSU9OX01BU0ssIDE2IzFmKS4KKy1kZWZpbmUoVkVSU0lPTl8xLCAxNiMwMSkuCistZGVmaW5lKFRZUEVfTUFTSywgMTYjRTApLgorLWRlZmluZShUWVBFX0JJVFMsIDE2IzA3KS4KKy1kZWZpbmUoVFlQRV9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GFjdFR5cGUgPSA/dFR5cGVfU1RPUCAtPgorICAgICAge1RoaXMxLCAjcHJvdG9jb2xfZmllbGRfYmVnaW57dHlwZSA9IENvbXBhY3RUeXBlfX07CisgICAgQ29tcGFjdFR5cGUgLT4KKyAgICAgIHtUaGlzMiwge29rLCBJZH19ID0gY2FzZSBCeXRlIGJzciA0IG9mCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAtPiByZWFkKFRoaXMxLCBpMTYpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIElkRGlmZiAtPgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1RoaXMxLCB7b2ssIExhc3RJZCArIElkRGlmZn19CisgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKKyAgICAgIGNhc2UgY29tcGFjdF90b190eXBlaWQoQ29tcGFjdFR5cGUpIG9mCisgICAgICAgID90VHlwZV9CT09MIC0+CisgICAgICAgICAge1RoaXMyI3RfY29tcGFjdHtyZWFkX3N0YWNrID0gW0lkfFRdLCByZWFkX3ZhbHVlID0gY2Jvb2xfdG9fYm9vbChDb21wYWN0VHlwZSl9LAorICAgICAgICAgICAjcHJvdG9jb2xfZmllbGRfYmVnaW57dHlwZSA9ID90VHlwZV9CT09MLCBpZCA9IElkfX07CisgICAgICAgIFR5cGUgLT4KKyAgICAgICAgICB7VGhpczIjdF9jb21wYWN0e3JlYWRfc3RhY2sgPSBbSWR8VF19LAorICAgICAgICAgICAjcHJvdG9jb2xfZmllbGRfYmVnaW57dHlwZSA9IFR5cGUsIGlkID0gSWR9fQorICAgICAgZW5kCisgIGVuZDsKKworcmVhZChUaGlzLCBmaWVsZF9lbmQpIC0+IHtUaGlzLCBva307CisKK3JlYWQoVGhpczAsIG1hcF9iZWdpbikgLT4KKyAge1RoaXMxLCB7b2ssIFNpemV9fSAgPSByZWFkKFRoaXMwLCB1aTMyKSwKKyAge1RoaXMyLCB7b2ssIEtWfX0gPSBjYXNlIFNpemUgb2YKKyAgICAgICAgICAgICAgICAgICAgICAgIDAgLT4ge1RoaXMxLCB7b2ssIDB9fTsKKyAgICAgICAgICAgICAgICAgICAgICAgIF8gLT4gcmVhZChUaGlzMSwgdWJ5dGUpCisgICAgICAgICAgICAgICAgICAgICAgZW5kLAorICB7VGhpczIsICNwcm90b2NvbF9tYXBfYmVnaW57a3R5cGUgPSBjb21wYWN0X3RvX3R5cGVpZChLViBic3IgNCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2dHlwZSA9IGNvbXBhY3RfdG9fdHlwZWlkKEtWIGJhbmQgMTYjZiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplID0gU2l6ZX19OworcmVhZChUaGlzLCBtYXBfZW5kKSAtPiB7VGhpcywgb2t9OworCityZWFkKFRoaXMwLCBsaXN0X2JlZ2luKSAtPgorICB7VGhpczEsIHtvaywgU2l6ZUFuZFR5cGV9fSA9IHJlYWQoVGhpczAsIHVieXRlKSwKKyAge1RoaXMyLCB7b2ssIFNpemV9fSA9IGNhc2UgKFNpemVBbmRUeXBlIGJzciA0KSBiYW5kIDE2I2Ygb2YKKyAgICAgICAgICAgICAgICAgICAgICAgICAgMTYjZiAtPiByZWFkKFRoaXMxLCB1aTMyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgRWxzZSAtPiB7VGhpczEsIHtvaywgRWxzZX19CisgICAgICAgICAgICAgICAgICAgICAgICBlbmQsCisgIHtUaGlzMiwgI3Byb3RvY29sX2xpc3RfYmVnaW57ZXR5cGUgPSBjb21wYWN0X3RvX3R5cGVpZChTaXplQW5kVHlwZSBiYW5kIDE2I2YpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgPSBTaXplfX07CisKK3JlYWQoVGhpcywgbGlzdF9lbmQpIC0+IHtUaGlzLCBva307CisKK3JlYWQoVGhpczAsIHNldF9iZWdpbikgLT4KKyAge1RoaXMxLCB7b2ssIFNpemVBbmRUeXBlfX0gPSByZWFkKFRoaXMwLCB1Ynl0ZSksCisgIHtUaGlzMiwge29rLCBTaXplfX0gPSBjYXNlIChTaXplQW5kVHlwZSBic3IgNCkgYmFuZCAxNiNmIG9mCisgICAgICAgICAgICAgICAgICAgICAgICAgIDE2I2YgLT4gcmVhZChUaGlzMSwgdWkzMik7CisgICAgICAgICAgICAgICAgICAgICAgICAgIEVsc2UgLT4ge1RoaXMxLCB7b2ssIEVsc2V9fQorICAgICAgICAgICAgICAgICAgICAgICAgZW5kLAorICB7VGhpczIsICNwcm90b2NvbF9zZXRfYmVnaW57ZXR5cGUgPSBjb21wYWN0X3RvX3R5cGVpZChTaXplQW5kVHlwZSBiYW5kIDE2I2YpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemUgPSBTaXplfX07CisKK3JlYWQoVGhpcywgc2V0X2VuZCkgLT4ge1RoaXMsIG9rfTsKKworcmVhZChUaGlzMCwgZmllbGRfc3RvcCkgLT4KKyAge1RoaXMxLCB7b2ssID90VHlwZV9TVE9QfX0gPSByZWFkKFRoaXMwLCB1Ynl0ZSksCisgIHtUaGlzMSwgb2t9OworCislJQorCityZWFkKFRoaXMwID0gI3RfY29tcGFjdHtyZWFkX3ZhbHVlID0gP0NCT09MX05PTkV9LCBib29sKSAtPgorICB7VGhpczEsIHtvaywgQnl0ZX19ID0gcmVhZChUaGlzMCwgdWJ5dGUpLAorICB7VGhpczEsIHtvaywgY2Jvb2xfdG9fYm9vbChCeXRlKX19OworCityZWFkKFRoaXMwID0gI3RfY29tcGFjdHtyZWFkX3ZhbHVlID0gQm9vbH0sIGJvb2wpIC0+CisgIHtUaGlzMCN0X2NvbXBhY3R7cmVhZF92YWx1ZSA9ID9DQk9PTF9OT05FfSwge29rLCBCb29sfX07CisKK3JlYWQoVGhpczAsIHVieXRlKSAtPgorICB7VGhpczEsIHtvaywgPDxWYWw6OC9pbnRlZ2VyLXVuc2lnbmVkLWJpZywgXy9iaW5hcnk+Pn19ID0gcmVhZF9kYXRhKFRoaXMwLCAxKSwKKyAge1Roa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mFwcGVkMCwgcmVhZF9idWZmZXIgPSBSQnVmfSwKLSAgICAgTGVuKSB3aGVuIGlzX2ludGVnZXIoTGVuKSAtPgotICAgIHtXcmFwcGVkMSwge1JCdWYxLCBSQnVmMVNpemV9fSA9Ci0gICAgICAgICUlIGlmIHRoZSByZWFkIGJ1ZmZlciBpcyBlbXB0eSwgcmVhZCBhbm90aGVyIGZyYW1lCi0gICAgICAgICUlIG90aGVyd2lzZSwganVzdCByZWFkIGZyb20gd2hhdCdzIGxlZnQgaW4gdGhlIGJ1ZmZlcgotICAgICAgICBjYXNlIGlvbGlzdF9zaXplKFJCdWYpIG9mCi0gICAgICAgICAgICAwIC0+Ci0gICAgICAgICAgICAgICAgJSUgcmVhZCB0aGUgZnJhbWUgbGVuZ3RoCi0gICAgICAgICAgICAgICAgY2FzZSB0aHJpZnRfdHJhbnNwb3J0OnJlYWQoV3JhcHBlZDAsIDQpIG9mCi0gICAgICAgICAgICAgICAgICB7V3JhcHBlZFMxLAotICAgICAgICAgICAgICAgICAgICB7b2ssIDw8RnJhbWVMZW46MzIvaW50ZWdlci1zaWduZWQtYmlnLCBfL2JpbmFyeT4+fX0gLT4KLSAgICAgICAgICAgICAgICAgICAgJSUgdGhlbiByZWFkIHRoZSBkYXRhCi0gICAgICAgICAgICAgICAgICAgIGNhc2UgdGhyaWZ0X3RyYW5zcG9ydDpyZWFkKFdyYXBwZWRTMSwgRnJhbWVMZW4pIG9mCi0gICAgICAgICAgICAgICAgICAgICAge1dyYXBwZWRTMiwge29rLCBCaW59fSAtPgotICAgICAgICAgICAgICAgICAgICAgICAge1dyYXBwZWRTMiwge0JpbiwgZXJsYW5nOmJ5dGVfc2l6ZShCaW4pfX07Ci0gICAgICAgICAgICAgICAgICAgICAge1dyYXBwZWRTMiwge2Vycm9yLCBSZWFzb24xfX0gLT4KLSAgICAgICAgICAgICAgICAgICAgICAgIHtXcmFwcGVkUzIsIHtlcnJvciwgUmVhc29uMX19Ci0gICAgICAgICAgICAgICAg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mwiKS4KKworLWV4cG9ydChbbmV3LzIsCisgICAgICAgICByZWFkLzIsCisgICAgICAgICB3cml0ZS8yLAorICAgICAgICAgZmx1c2hfdHJhbnNwb3J0LzEsCisgICAgICAgICBjbG9zZV90cmFuc3BvcnQvMQorICAgICAgICBdKS4KKworLXJlY29yZChwcm90b2NvbCwge21vZHVsZSwgZGF0YX0pLgorLXR5cGUgcHJvdG9jb2woKSA6OiAjcHJvdG9jb2x7fS4KKworLXJlY29yZCAobXVsdGlwbGV4ZWRfcHJvdG9jb2wsIHtwcm90b2NvbF9tb2R1bGVfdG9fZGVjb3JhdGU6OmF0b20oKSwKKwkJCQkJCQkJcHJvdG9jb2xfZGF0YV90b19kZWNvcmF0ZTo6dGVybSgpLAorCQkJCQkJCQlzZXJ2aWNlX25hbWU6Om5vbmVtcHR5X3N0cmluZygpfSkuCisKKy10eXBlIHN0YXRlKCkgOjogI211bHRpcGxleGVkX3Byb3RvY29se30uCisKKy1zcGVjIG5ldyhQcm90b2NvbFRvRGVjb3JhdGU6OnByb3RvY29sKCksIFNlcnZpY2VOYW1lOjpub25lbXB0eV9zdHJpbmcoKSkgLT4ge29rLCBQcm90b2NvbDo6cHJvdG9jb2woKX0uCituZXcoUHJvdG9jb2xUb0RlY29yYXRlLCBTZXJ2aWNlTmFtZSkgd2hlbiBpc19yZWNvcmQoUHJvdG9jb2xUb0RlY29yYXRlLCBwcm90b2NvbCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc19saXN0KFNlcnZpY2VOYW1lKSAtPgorICAgIFN0YXRlID0gI211bHRpcGxleGVkX3Byb3RvY29se3Byb3RvY29sX21vZHVsZV90b19kZWNvcmF0ZSA9IFByb3RvY29sVG9EZWNvcmF0ZSNwcm90b2NvbC5tb2R1bGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm90b2NvbF9kYXRhX3RvX2RlY29yYXRlID0gUHJvdG9jb2xUb0RlY29yYXRlI3Byb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F9wcm90b2NvbHtwcm90b2NvbF9tb2R1bGVfdG9fZGVjb3JhdGUgPSBQcm90b2NvbE1vZHVsZVRvRGVjb3JhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvY29sX2RhdGFfdG9fZGVjb3JhdGUgPSBTdGF0ZTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlX25hbWUgPSBTZXJ2aWNlTmFtZX0sCisgICAgICBNZXNzYWdlID0gI3Byb3RvY29sX21lc3NhZ2VfYmVnaW57bmFtZSA9IE5hbWV9KSAtPgorICAgIHtTdGF0ZTEsIG9rfSA9IFByb3RvY29sTW9kdWxlVG9EZWNvcmF0ZTp3cml0ZShTdGF0ZTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2UjcHJvdG9jb2xfbWVzc2FnZV9iZWdpbntuYW1lPVNlcnZpY2VOYW1lICsrCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID9NVUxUSVBMRVhFRF9TRVJWSUNFX1NFUEFSQVRPUiArKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOYW1lfSksCisgICAge1N0YXRlI211bHRpcGxleGVkX3Byb3RvY29se3Byb3RvY29sX2RhdGFfdG9fZGVjb3JhdGUgPSBTdGF0ZTF9LCBva307CisKK3dyaXRlKFN0YXRlID0gI211bHRpcGxleGVkX3Byb3RvY29se3Byb3RvY29sX21vZHVsZV90b19kZWNvcmF0ZSA9IFByb3RvY29sTW9kdWxlVG9EZWNvcmF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2xfZGF0YV90b19kZWNv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xvb3AoU3RhdGUyKTsKLSAgICAgICAgICAgICAgICB7X1N0YXRlMiwge2Vycm9yLCBSZWFzb259fSAtPgotICAgICAgICAgICAgICAgICAgICBIYW5kbGVyOmhhbmRsZV9lcnJvcihsaXN0X3RvX2F0b20oRnVuY3Rpb24pLCBSZWFzb24pLAotICAgICAgICAgICAgICAgICAgICB0aHJpZnRfcHJvdG9jb2w6Y2xvc2VfdHJhbnNwb3J0KFByb3RvMSksCi0gICAgICAgICAgICAgICAgICAgIG9rCi0gICAgICAgICAgICBlbmQ7Ci0gICAgICAgICNwcm90b2NvbF9tZXNzYWdlX2JlZ2lue25hbWUgPSBGdW5jdGlvbiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9ID90TWVzc2FnZVR5cGVfT05FV0FZLCAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VxaWQgPSBTZXFpZH0gLT4KLSAgICAgICAgICAgIGNhc2UgaGFuZGxlX2Z1bmN0aW9uKFN0YXRlMSwgbGlzdF90b19hdG9tKEZ1bmN0aW9uKSwgU2VxaWQpIG9mCi0gICAgICAgICAgICAgICAge1N0YXRlMiwgb2t9IC0+IGxvb3AoU3RhdGUyKTsKLSAgICAgICAgICAgICAgICB7X1N0YXRlMiwge2Vycm9yLCBSZWFzb259fSAtPgotICAgICAgICAgICAgICAgICAgICBIYW5kbGVyOmhhbmRsZV9lcnJvcihsaXN0X3RvX2F0b20oRnVuY3Rpb24pLCBSZWFzb24pLAotICAgICAgICAgICAgICAgICAgICB0aHJpZnRfcHJvdG9jb2w6Y2xvc2VfdHJhbnNwb3J0KFByb3RvMSksCi0gICAgICAgICAgICAgICAgICAgIG9rCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXFpZCA9IFNlcWlkfSB3aGVuIFR5cGUgPTo9ID90TWVzc2FnZVR5cGVfQ0FMTDsgVHl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ICAgICAgICAgICAgICAgICAgICAgICAgb2sKKyAgICAgICAgICAgICAgICAgICAgZW5kOworICAgICAgICAgICAgICAgIF8gLT4KKyAgICAgICAgICAgICAgICAgICAgY2FzZSBoYW5kbGVfZnVuY3Rpb24oU3RhdGUxLCBsaXN0X3RvX2F0b20oRnVuY3Rpb24pLCBTZXFpZCkgb2YKKyAgICAgICAgICAgICAgICAgICAgICAgIHtTdGF0ZTIsIG9rfSAtPiBsb29wKFN0YXRlMik7CisgICAgICAgICAgICAgICAgICAgICAgICB7X1N0YXRlMiwge2Vycm9yLCBSZWFzb259fSAtPgorCQkJCQkJCWFwcGx5KEVycm9ySGFuZGxlcihIYW5kbGVyKSwgaGFuZGxlX2Vycm9yLCBbbGlzdF90b19hdG9tKEZ1bmN0aW9uKSwgUmVhc29uXSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyaWZ0X3Byb3RvY29sOmNsb3NlX3RyYW5zcG9ydChQcm90bzEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rCisgICAgICAgICAgICAgICAgICAgIGVuZAogICAgICAgICAgICAgZW5kOwogICAgICAgICB7ZXJyb3IsIHRpbWVvdXQgPSBSZWFzb259IC0+Ci0gICAgICAgICAgICBIYW5kbGVyOmhhbmRsZV9lcnJvcih1bmRlZmluZWQsIFJlYXNvbiksCisJCQlhcHBseShFcnJvckhhbmRsZXIoSGFuZGxlciksIGhhbmRsZV9lcnJvciwgW3VuZGVmaW5lZCwgUmVhc29uXSksCiAgICAgICAgICAgICB0aHJpZnRfcHJvdG9jb2w6Y2xvc2VfdHJhbnNwb3J0KFByb3RvMSksCiAgICAgICAgICAgICBvazsKICAgICAgICAge2Vycm9yLCBjbG9zZWQgPSBSZWFzb259IC0+CiAgICAgICAgICAgICAlJSBlcnJvcl9sb2dnZXI6aW5mb19tc2coIkNsaWVudCBkaXNjb25uZWN0ZWR+biIpLAotICAgICAgICAgICAgSGFuZGxlcjpoYW5kbGVfZXJyb3IodW5kZW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7CisgICAgICBfIC0+CisgICAgICAgIHtLVHlwZSwgS1R5cGV9ID0ge3Rlcm1fdG9fdHlwZWlkKEtleVR5cGUpLCBLVHlwZX0sCisgICAgICAgIHtWVHlwZSwgVlR5cGV9ID0ge3Rlcm1fdG9fdHlwZWlkKFZhbFR5cGUpLCBWVHlwZX0KKyAgICBlbmQsCiAgICAge0xpc3QsIElQcm90bzJ9ID0gbGlzdHM6bWFwZm9sZGwoZnVuKF8sIFByb3RvUzApIC0+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7UHJvdG9TMSwge29rLCBLZXl9fSA9IHJlYWQoUHJvdG9TMCwgS2V5VHlwZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7UHJvdG9TMiwge29rLCBWYWx9fSA9IHJlYWQoUHJvdG9TMSwgVmFsVHlwZSksCkBAIC0xOTEsNyArMTk2LDggQEAKICAgICAgICAgdGhyaWZ0X3Byb3RvY29sOnJlYWQoSVByb3RvMCwgZmllbGRfYmVnaW4pLAogICAgIGNhc2Uge0ZUeXBlLCBGaWR9IG9mCiAgICAgICAgIHs/dFR5cGVfU1RPUCwgX30gLT4KLSAgICAgICAgICAgIHtJUHJvdG8xLCBSVHVwbGV9OworICAgICAgICAgICAge0lQcm90bzIsIG9rfSA9IHJlYWQoSVByb3RvMSwgc3RydWN0X2VuZCksCisgICAgICAgICAgICB7SVByb3RvMiwgUlR1cGxlfTsKICAgICAgICAgX0Vsc2UgLT4KICAgICAgICAgICAgIGNhc2UgZGljdDpmaW5kKEZpZCwgU0RpY3QpIG9mCiAgICAgICAgICAgICAgICAge29rLCB7VHlwZSwgSW5kZXh9fSAtPgpAQCAtMjA4LDE4ICsyMTQsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lwX2ZpZWxkKEZUeXBlLCBJUHJvdG8xLCBTRGljdCwgUlR1cGxlKQogICAgICAgICAgICAgICAgICAgICBlbmQ7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8xLCBUeXBlKSwKKyAgICAgICAgICAgIHtQcm90bzIsIG9rfSA9IHNraXAoUHJvdG8xLCB0eXBlaWRfdG9fYXRvbShUeXBlKSksCiAgICAgICAgICAgICB7UHJvdG8zLCBva30gPSByZWFkKFByb3RvMiwgZmllbGRfZW5kKSwKICAgICAgICAgICAgIHNraXBfc3RydWN0X2xvb3AoUHJvdG8zKQogICAgIGVuZC4KQEAgLTI2Niw4ICsyNzAsOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSA9IFNpemV9KSAtPgogICAgIGNhc2UgU2l6ZSBvZgogICAgICAgICBOIHdoZW4gTiA+IDAgLT4KLSAgICAgICAgICAgIHtQcm90bzEsIG9rfSA9IHNraXAoUHJvdG8wLCBLdHlwZSksCi0gICAgICAgICAgICB7UHJvdG8yLCBva30gPSBza2lwKFByb3RvMSwgVnR5cGUpLAorICAgICAgICAgICAge1Byb3RvMSwgb2t9ID0gc2tpcChQcm90bzAsIHR5cGVpZF90b19hdG9tKEt0eXBlKSksCisgICAgICAgICAgICB7UHJvdG8yLCBva30gPSBza2lwKFByb3RvMSwgdHlwZWlkX3RvX2F0b20oVnR5cGUpKSwKICAgICAgICAgICAgIHNraXBfbWFwX2xvb3AoUHJvdG8yLAogICAgICAgICAgICAgICAgICAgICAgICAgICBNYXAjcHJvdG9jb2xfbWFwX2JlZ2lue3NpemUgPSBTaXplIC0gMX0pOwogICAgICAgICAwIC0+IHtQcm90bzAsIG9rfQpAQCAtMjc3LDcgKzI4MSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplID0gU2l6ZX0pIC0+CiAgICAgY2FzZSBTaXplIG9mCiAgICAgICAgIE4gd2hlbiBOID4gMCAtPgotICAgICAgICAgICAge1Byb3RvMSwgb2t9ID0gc2tpcChQcm90bzAsIEV0eXBlKSwKKyAgICAgICAgICAgIHtQcm90bzEsIG9rfSA9IHNraXAoUHJvdG8wLCB0eXBlaWRfdG9fYXRvbShFdHlwZSkpLAogICAgICAgICAgICAgc2tpcF9zZXRfbG9vcChQcm90bzEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcCNwcm90b2NvbF9zZXRfYmVnaW57c2l6ZSA9IFNpemUgLSAxfSk7CiAgICAgICAgIDAgLT4ge1Byb3RvMCwgb2t9CkBAIC0yODcsNyArMjkxLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZSA9IFNpemV9KSAtPgogICAgIGNhc2UgU2l6ZSBvZgogICAgICAgICBOIHdoZW4gTiA+IDAgLT4KLSAgICAgICAgICAgIHtQcm90bzEsIG9rfSA9IHNraXAoUHJvdG8wLCBFdHlwZSksCisgICAgICAgICAgICB7UHJvdG8xLCBva30gPSBza2lwKFByb3RvMCwgdHlwZWlkX3RvX2F0b20oRXR5cGUpKSwKICAgICAgICAgICAgIHNraXBfbGlzdF9sb29wKFByb3RvMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcCNwcm90b2NvbF9saXN0X2JlZ2lue3NpemUgPSBTaXplIC0gMX0pOwogICAgICAgICAwIC0+IHtQcm90bzAsIG9rfQpkaWZmIC0tZ2l0IGEvbGliL2VybC9zcmMvdGhyaWZ0X3JlY29ubmVjdGluZ19jbGllbnQuZXJsIGIvbGliL2VybC9zcmMvdGhyaWZ0X3JlY29ubmVjdGluZ19jbGllbnQuZXJsCmluZGV4IDhmZjE5NDEuLjUzOGZkM2EgMTAwNjQ0Ci0tLSBhL2xpYi9lcmwvc3JjL3RocmlmdF9yZWNvbm5lY3RpbmdfY2xpZW50LmVybAorKysgYi9saWIvZXJsL3NyYy90aHJpZnRfcmVjb25uZWN0aW5nX2NsaWVudC5lcmwKQEAgLTM2LDE0ICszNiwxNCBAQAogICAgICAgICAgIHRlcm1pbmF0ZS8yLAogICAgICAgICAgIGNvZGVfY2hhbmdlLzMgXSkuCiAKLS1yZWNvcmQoIHN0YXRlLCB7IGNsaWVudCA9IG5pbCwgCistcmVjb3JkKCBzdGF0ZSwgeyBjbGllbnQgPSBuaWwsCiAgICAgICAgICAgICAgICAgICBob3N0LAogICAgICAgICAgICAgICAgICAgcG9ydCwKICAgICAgICAgICAgICAgICAgIHRocmlmdF9zdmMsCiAgICAgICAgICAgICAgICAgICB0aHJpZnRfb3B0cywKICAgICAgICAgICAgICAgICAgIHJlY29ubl9taW4sCiAgICAgICAgICAgICAgICAgICByZWNvbm5fbWF4LAotICAgICAgICAgICAgICAgICAgcmVjb25uX3RpbWUsCisgICAgICAgICAgICAgICAgICByZWNvbm5fdGltZSA9IDAsCiAgICAgICAgICAgICAgICAgICBvcF9jbnRfZGljdCwKICAgICAgICAgICAgICAgICAgIG9wX3RpbWVfZGljdCB9ICkuCiAKQEAgLTExNSw5ICsxMTUsOSBAQAogICAgICAgICAgICAgIF9Gcm9tLAogICAgICAgICAgICAgIFN0YXRlPSNzdGF0ZXsgY2xpZW50ID0gQ2xpZW50IH0gKSAtPgogCi0gIFN0YXJ0ID0gbm93KCksCisgIFRpbWVyID0gdGltZXJfZnVuKCksCiAgIFJlc3VsdCA9ICggY2F0Y2ggdGhyaWZ0X2NsaWVudDpjYWxsKCBDbGllbnQsIE9wLCBBcmdzKSApLAotICBUaW1lID0gdGltZXI6bm93X2RpZmYoIG5vdygpLCBTdGFydCApLAorICBUaW1lID0gVGltZXIoKSwKIAogICBjYXNlIFJlc3VsdCBvZgogICAgIHsgQywgeyBvaywgUmVwbHkgfSB9IC0+CkBAIC0xNTYsNiArMTU2LDkgQEAKICUlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge3N0b3AsIFJlYXNvbiwgU3RhdGV9CiAlJSBEZXNjcmlwdGlvbjogSGFuZGxpbmcgYWxsIG5vbiBjYWxsL2Nhc3QgbWVzc2FnZXMKICUlLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0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IFN0YXRlKSB3aGVuIGlzX2xpc3QoU1NMT3B0aW9ucykgLT4KKyAgICBwYXJzZV9vcHRpb25zKFJlc3QsIFN0YXRlI3RocmlmdF9zb2NrZXRfc2VydmVye3NzbG9wdGlvbnM9U1NMT3B0aW9uc30pLgogCiBzdGFydF9zZXJ2ZXIoU3RhdGU9I3RocmlmdF9zb2NrZXRfc2VydmVye25hbWU9TmFtZX0pIC0+CiAgICAgY2FzZSBOYW1lIG9mCkBAIC0xNjgsMjUgKzIyMywzMiBAQAogICAgIFN0YXRlI3RocmlmdF9zb2NrZXRfc2VydmVye2FjY2VwdG9yPW51bGx9OwogbmV3X2FjY2VwdG9yKFN0YXRlPSN0aHJpZnRfc29ja2V0X3NlcnZlcntsaXN0ZW49TGlzdGVuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlPVNlcnZpY2UsIGhhbmRsZXI9SGFuZGxlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc29ja2V0X29wdHM9T3B0cywgZnJhbWVkPUZyYW1lZAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb2NrZXRfb3B0cz1PcHRzLCBmcmFtZWQ9RnJhbWVkLCBwcm90b2NvbD1Qcm90bywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NsdHJhbnNwb3J0PVNzbFRyYW5zcG9ydCwgc3Nsb3B0aW9ucz1Tc2xPcHRpb25zCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgLT4KICAgICBQaWQgPSBwcm9jX2xpYjpzcGF3bl9saW5rKD9NT0RVTEUsIGFjY2VwdG9yX2xvb3AsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbe3NlbGYoKSwgTGlzdGVuLCBTZXJ2aWNlLCBIYW5kbGVyLCBPcHRzLCBGcmFtZWR9XSksCisgICAgICAgICAgICAgICAgIC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mV3KFNvY2tldFRyYW5zcG9ydCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSAtPiB0aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0Om5ldyhTb2NrZXRUcmFuc3BvcnQpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7b2ssIFByb3RvY29sfSAgICAgICAgICA9IHRocmlmdF9iaW5hcnlfcHJvdG9jb2w6bmV3KFRyYW5zcG9ydCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge29rLCBTb2NrZXRUcmFuc3BvcnR9ID0gY2FzZSBTc2xUcmFuc3BvcnQgb2YKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZSAgLT4gdGhyaWZ0X3NzbHNvY2tldF90cmFuc3BvcnQ6bmV3KFNvY2tldCwgU29ja2V0T3B0cywgU3NsT3B0aW9ucyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC0+IHRocmlmdF9zb2NrZXRfdHJhbnNwb3J0Om5ldyhTb2NrZXQsIFNvY2tldE9wdHMpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgVHJhbnNwb3J0fSAgICAgICA9IGNhc2UgRnJhbWVkIG9mCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydWUgIC0+IHRocmlmdF9mcmFtZWRfdHJhbnNwb3J0Om5ldyhTb2NrZXRUcmFuc3BvcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSAtPiB0aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0Om5ldyhTb2NrZXRUcmFuc3BvcnQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgUHJvdG9jb2x9ICAgICAgICA9IGNhc2UgUHJvdG8gb2YKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBhY3QgLT4gdGhyaWZ0X2NvbXBhY3RfcHJvdG9jb2w6bmV3KFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uIC0+IHRocmlmdF9qc29uX3Byb3RvY29sOm5ldyhUcmFuc3BvcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyAtPiB0aHJpZnRfYmluYXJ5X3Byb3RvY29sOm5ldyhUcmFuc3BvcnQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgUHJvdG9jb2x9CiAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKICAgICAgICAgICAgIHRocmlmdF9wcm9jZXNzb3I6aW5pdCh7U2VydmVyLCBQcm90b0dlbiwgU2VydmljZSwgSGFuZGxlcn0pOwpAQCAtMjE0LDggKzI3NiwxMSBAQAogaGFuZGxlX2Nhc3Qoc3RvcCwgU3RhdGUpIC0+CiAgICAge3N0b3AsIG5vcm1hbCwgU3RhdGV9LgogCi10ZXJtaW5hdGUoX1JlYXNvbiwgI3RocmlmdF9zb2NrZXRfc2VydmVye2xpc3Rlbj1MaXN0ZW4sIHBvcnQ9UG9ydH0pIC0+Cit0ZXJtaW5hdGUoUmVhc29uLCAjdGhy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gICAgICAgICAgICAgICAgICAgICAge29rLCBUcmFuc3BvcnR9ID0gdGhyaWZ0X3NvY2tldF90cmFuc3BvcnQ6bmV3KFNvY2spLAotICAgICAgICAgICAgICAgICAgICAgICAge29rLCBCdWZUcmFuc3BvcnR9ID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBhcnNlZE9wdHMjZmFjdG9yeV9vcHRzLmZyYW1lZCBvZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlICAtPiB0aHJpZnRfZnJhbWVkX3RyYW5zcG9ydDpuZXcoVHJhbnNwb3J0KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLT4gdGhyaWZ0X2J1ZmZlcmVkX3RyYW5zcG9ydDpuZXcoVHJhbnNwb3J0KQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgQnVmVHJhbnNwb3J0fTsKLSAgICAgICAgICAgICAgICAgICAgRXJyb3IgIC0+Ci0gICAgICAgICAgICAgICAgICAgICAgICBFcnJvcgotICAgICAgICAgICAgICAgIGVuZAorICB7RmFjdG9yeU9wdHMsIFRyYW5zT3B0c30gPSBwYXJzZV9mYWN0b3J5X29wdGlvbnMoT3B0aW9ucywgI2ZhY3Rvcnlfb3B0c3t9LCBbXSksCisgIHtvaywgZnVuKCkgLT4gU29ja09wdHMgPSBbYmluYXJ5LAorICAgICAge3BhY2tldCwgMH0sCisgICAgICB7YWN0aXZlLCBmYWxzZX0sCisgICAgICB7bm9kZWxheSwgdHJ1ZX18RmFjdG9yeU9wdHMjZmFjdG9yeV9vcHRzLnNvY2tvcHRzCisgICAgXSwKKyAgICBjYXNlIGNhdGNoIGdlbl90Y3A6Y29ubmVjdCgKKyAgICAgIEhvc3QsCisgICAgICBQb3J0LAorICAgICAgU29ja09wdHMsCisgICAgICBGYWN0b3J5T3B0cyNmYWN0b3J5X29wdHMuY29ubmVjdF90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0fSAtPgorICAgICAgICAgICAgbmV3KFNzbFNvY2tldCwgU29ja09wdHMpOworICAgICAgICB7ZXJyb3IsIFJlYXNvbn0gLT4KKyAgICAgICAgICAgIGV4aXQoe2Vycm9yLCBSZWFzb259KTsKKyAgICAgICAgT3RoZXIgLT4KKyAgICAgICAgICAgIGVycm9yX2xvZ2dlcjplcnJvcl9yZXBvcnQoCisgICAgICAgICAgICAgIFt7YXBwbGljYXRpb24sIHRocmlmdH0sCisgICAgICAgICAgICAgICAiU1NMIGFjY2VwdCBmYWlsZWQgZXJyb3IiLAorICAgICAgICAgICAgICAgbGlzdHM6ZmxhdHRlbihpb19saWI6Zm9ybWF0KCJ+cCIsIFtPdGhlcl0pKV0pLAorICAgICAgICAgICAgZXhpdCh7ZXJyb3IsIHNzbF9hY2NlcHRfZmFpbGVkfSkKKyAgICBlbmQuCisKK25ldyhTc2xTb2NrZXQsIFNvY2tPcHRzKSAtPgorICAgIFN0YXRlID0KKyAgICAgICAgY2FzZSBsaXN0czprZXlzZWFyY2gocmVjdl90aW1lb3V0LCAxLCBTb2NrT3B0cykgb2YKKyAgICAgICAgICAgIHt2YWx1ZSwge3JlY3ZfdGltZW91dCwgVGltZW91dH19CisgICAgICAgICAgICAgIHdoZW4gaXNfaW50ZWdlcihUaW1lb3V0KSwgVGltZW91dCA+IDAgLT4KKyAgICAgICAgICAgICAgICAjZGF0YXtzb2NrZXQ9U3NsU29ja2V0LCByZWN2X3RpbWVvdXQ9VGltZW91dH07CisgICAgICAgICAgICBfIC0+CisgICAgICAgICAgICAgICAgI2RhdGF7c29ja2V0PVNzbFNvY2tldH0KKyAgICAgICAgZW5kLAorICAgIHRocmlmdF90cmFuc3BvcnQ6bmV3KD9NT0RVTEUsIFN0YXRlKS4KKworJSUgRGF0YSA6OiBpb2xpc3QoKQord3JpdGUoVGhpcyA9ICNkYXRhe3NvY2tldCA9IFNvY2tldH0sIERhdGEpIC0+CisgICAge1RoaXMsIHNzbDpzZW5kKFNvY2tldCw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JSB0aHJpZnQgc2VydmVyIG92ZXIgYSBzb2NrZXQuCislJQorbmV3X3RyYW5zcG9ydF9mYWN0b3J5KEhvc3QsIFBvcnQsIE9wdGlvbnMpIC0+CisgICAgUGFyc2VkT3B0cyA9IHBhcnNlX2ZhY3Rvcnlfb3B0aW9ucyhPcHRpb25zLCAjZmFjdG9yeV9vcHRze30pLAorCisgICAgRiA9IGZ1bigpIC0+CisgICAgICAgICAgICAgICAgU29ja09wdHMgPSBbYmluYXJ5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtwYWNrZXQsIDB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHthY3RpdmUsIGZhbHNlfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB7bm9kZWxheSwgdHJ1ZX0gfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhcnNlZE9wdHMjZmFjdG9yeV9vcHRzLnNvY2tvcHRzXSwKKyAgICAgICAgICAgICAgICBjYXNlIGNhdGNoIGdlbl90Y3A6Y29ubmVjdChIb3N0LCBQb3J0LCBTb2NrT3B0cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXJzZWRPcHRzI2ZhY3Rvcnlfb3B0cy5jb25uZWN0X3RpbWVvdXQpIG9mCisgICAgICAgICAgICAgICAgICAgIHtvaywgU29ja30gLT4KKyAgICAgICAgICAgICAgICAgICAgICAgIFNzbFNvY2sgPSBjYXNlIGNhdGNoIHNzbDpjb25uZWN0KFNvY2ssIFBhcnNlZE9wdHMjZmFjdG9yeV9vcHRzLnNzbG9wdGlvbnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXJzZWRPcHRzI2ZhY3Rvcnlfb3B0cy5jb25uZWN0X3RpbWVvdXQpIG9mCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgU3NsU29ja2V0fSAtPgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3NsU29ja2V0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPdGhlciAtPgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfbG9nZ2VyOmluZm9fbXNnKCJlcnJvciB3aGlsZSBjb25uZWN0aW5nIG92ZXIgc3NsIC0gcmVhc29uOiB+cH5uIiwgW090aGVyXSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRjaCBnZW5fdGNwOmNsb3NlKFNvY2spLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhpdChlcnJvcikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQsCisgICAgICAgICAgICAgICAgICAgICAgICB7b2ssIFRyYW5zcG9ydH0gPSB0aHJpZnRfc3Nsc29ja2V0X3RyYW5zcG9ydDpuZXcoU3NsU29jaywgU29ja09wdHMpLAorICAgICAgICAgICAgICAgICAgICAgICAge29rLCBCdWZUcmFuc3BvcnR9ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBhcnNlZE9wdHMjZmFjdG9yeV9vcHRzLmZyYW1lZCBvZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlICAtPiB0aHJpZnRfZnJhbWVkX3RyYW5zcG9ydDpuZXcoVHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UgLT4gdGhyaWZ0X2J1ZmZlcmVkX3RyYW5zcG9ydDpuZXcoVHJhbnNwb3J0KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIHtvaywgQnVmVHJhbnNwb3J0fTsKKyAgICAgICAgICAgICAgICAgICAgRXJyb3IgIC0+CisgICAgICAgICAgICAgICAgICAgICAgICBFcnJvcgorICAgICAgICAgICAgICA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5pdC9pbmNsdWRlL2V1bml0LmhybCIpLgorCistaW5jbHVkZSgiZ2VuLWVybC9uYW1lX2NvbmZsaWN0X3Rlc3RfY29uc3RhbnRzLmhybCIpLgorCityZWNvcmRfZ2VuZXJhdGlvbl90ZXN0XygpIC0+CisgIFsKKyAgICB7InVzaW5nIHJlY29yZCIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7dXNpbmcsIF8sIF99LAorICAgICAgI3VzaW5ne3NpbmdsZT1udWxsLGludGVnZXI9bnVsbH0KKyAgICApfSwKKyAgICB7ImRlbGVnYXRlIHJlY29yZCIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7ZGVsZWdhdGUsIF8sIF99LAorICAgICAgI2RlbGVnYXRle3BhcnRpYWw9bnVsbCxkZWxlZ2F0ZT1udWxsfQorICAgICl9LAorICAgIHsiZ2V0IHJlY29yZCIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7Z2V0LCBffSwKKyAgICAgICNnZXR7c2J5dGU9bnVsbH0KKyAgICApfSwKKyAgICB7InBhcnRpYWwgcmVjb3JkIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHtwYXJ0aWFsLCBfLCBfLCBffSwKKyAgICAgICNwYXJ0aWFse3VzaW5nPW51bGx9CisgICAgKX0sCisgICAgeyJDbGFzc0FuZFByb3AgcmVjb3JkIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsnQ2xhc3NBbmRQcm9wJywgXywgXywgXywgX30sCisgICAgICAjJ0NsYXNzQW5kUHJvcCd7CisgICAgICAgICdDbGFzc0FuZFByb3AnPW51bGwsCisgICAgICAgICdDbGFzc0FuZFByb3BfJz1udWxsLAorICAgICAgICAnQ2xhc3NBbmRQcm9wX18nPW51bGwsCisgICAgICAgICdDbGFzc0FuZFByb3Blcic9bnVsbAorICAgICAgfQorICAgICl9LAorICAgIHsic2Vjb25kX2NoYW5jZSByZWNvcmQiLCA/X2Fzc2VydE1hdGNoKAorICAgICAge3NlY29uZF9jaGFuY2UsIF8sIF8sIF8sIF99LAorICAgICAgI3NlY29uZF9jaGFuY2V7CisgICAgICAgICdTRUNPTkRfQ0hBTkNFJz1udWxsLAorICAgICAgICAnU0VDT05EX0NIQU5DRV8nPW51bGwsCisgICAgICAgICdTRUNPTkRfQ0hBTkNFX18nPW51bGwsCisgICAgICAgICdTRUNPTkRfQ0hBTkNFUyc9bnVsbAorICAgICAgfQorICAgICl9LAorICAgIHsiTk9XX0VBVF9USElTIHJlY29yZCIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7J05PV19FQVRfVEhJUycsIF8sIF8sIF8sIF99LAorICAgICAgIydOT1dfRUFUX1RISVMneworICAgICAgICBub3dfZWF0X3RoaXM9bnVsbCwKKyAgICAgICAgbm93X2VhdF90aGlzXz1udWxsLAorICAgICAgICBub3dfZWF0X3RoaXNfXz1udWxsLAorICAgICAgICBub3dfZWF0X3RoaXNfYW5kX3RoaXM9bnVsbAorICAgICAgfQorICAgICl9LAorICAgIHsiVGhlRWRnZUNhc2UgcmVjb3JkIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsnVGhlRWRnZUNhc2UnLCBfLCBfLCBfLCBfLCBfLCBffSwKKyAgICAgICMnVGhlRWRnZUNhc2UneworICAgICAgICB0aGVFZGdlQ2FzZT1udWxsLAorICAgICAgICB0aGVFZGdlQ2FzZV89bnVsbCwKKyAgICAgICAgdGhlRWRnZUNhc2VfXz1udWxsLAorICAgICAgICAnVGhlRWRnZUNhc2UnPW51bGwsCisgICAgICAgICdUaGVFZGdlQ2FzZV8nPW51bGwsCisgICAgICAgICdUaGVFZGdlQ2FzZV9fJz1udWxsCisgICAgICB9CisgICAgKX0sCisgICAgeyJUcmlja3lfIHJlY29yZCIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7J1RyaWNreV8nLCBfLCBffSwKKyAgICAgICMnVHJpY2t5Xyd7dHJpY2t5PW51bGwsJ1RyaWNreSc9bnVsbH0KKyAgICApfSwKKyAgICB7Ik5lc3RlZCBy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sIE9wdHMpIC0+IE9wdHM7Ci1wYXJzZV9hcmdzKFtIZWFkIHwgUmVzdF0sIE9wdHMpIC0+Ci0gICAgTmV3T3B0cyA9Ci0gICAgICAgIGNhc2UgY2F0Y2ggbGlzdF90b19pbnRlZ2VyKEhlYWQpIG9mCi0gICAgICAgICAgICBQb3J0IHdoZW4gaXNfaW50ZWdlcihQb3J0KSAtPgotICAgICAgICAgICAgICAgIE9wdHMjb3B0aW9uc3twb3J0ID0gUG9ydH07Ci0gICAgICAgICAgICBfRWxzZSAtPgotICAgICAgICAgICAgICAgIGNhc2UgSGVhZCBvZgotICAgICAgICAgICAgICAgICAgICAiZnJhbWVkIiAtPgotICAgICAgICAgICAgICAgICAgICAgICAgT3B0cyNvcHRpb25ze2NsaWVudF9vcHRzID0gW3tmcmFtZWQsIHRydWV9IHwgT3B0cyNvcHRpb25zLmNsaWVudF9vcHRzXX07Ci0gICAgICAgICAgICAgICAgICAgICIiIC0+Ci0gICAgICAgICAgICAgICAgICAgICAgICBPcHRzOwotICAgICAgICAgICAgICAgICAgICBfRWxzZSAtPgotICAgICAgICAgICAgICAgICAgICAgICAgZXJsYW5nOmVycm9yKHtiYWRfYXJnLCBIZWFkfSkKLSAgICAgICAgICAgICAgICBlbmQKLSAgICAgICAgZW5kLAotICAgIHBhcnNlX2FyZ3MoUmVzdCwgTmV3T3B0cykuCi0KLQotc3RhcnQoKSAtPiBzdGFydChbXSkuCi1zdGFydChBcmdzKSAtPgotICAjb3B0aW9uc3twb3J0ID0gUG9ydCwgY2xpZW50X29wdHMgPSBDbGllbnRPcHRzfSA9IHBhcnNlX2FyZ3MoQXJncyksCi0gIHtvaywgQ2xpZW50MH0gPSB0aHJpZnRfY2xpZW50X3V0aWw6bmV3KAotICAgICIxMjcuMC4wLjEiLCBQb3J0LCB0aHJpZnRUZXN0X3RocmlmdCwgQ2xpZW50T3B0cyksCi0KLSAgRGVtb1h0cnVjdCA9ICN4dHJ1Y3R7Ci0gICAgc3RyaW5nX3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HJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICAxCisgICAgICApCisgICAgKX0sCisgICAgeyJyZWFkIHplcm8gYnl0ZXMgZnJvbSBub25lbXB0eSBidWZmZXJlZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PCJoYWxsbyB3b3JsZCI+PgorICAgICAgICAgIH19LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDw+Pn0KKyAgICAgIH0sCisgICAgICByZWFkKAorICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PCJoYWxsbyB3b3JsZCI+PgorICAgICAgICAgIH19LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDAKKyAgICAgICkKKyAgICApfSwKKyAgICB7InJlYWQgMSBieXRlIGZyb20gbm9uZW1wdHkgYnVmZmVyZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PCJhbGxvIHdvcmxkIj4+fX0sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAge29rLCA8PCJoIj4+fQorICAgICAgfSwKKyAgICAgIHJlYWQoCisgICAgICAgIHt0X2J1ZmZlcmVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDwiaGFsbG8gd29ybGQiPj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICAxCisgICAgICApCisgICAgKX0sCisgICAgeyJyZWFkIDEgYnl0ZSBmcm9tIG5vbmVtcHR5IGJ1ZmZlciIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7CisgICAgICAgIHt0X2J1ZmZlcmVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDwiYWxsbyB3b3JsZCI+Pn19LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDwiaCI+Pn0KKyAgICAgIH0sCisgICAgICByZWFkKAorICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8ImhhbGxvIHdvcmxkIj4+fX0sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMQorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCBhIHppbGxpb24gYnl0ZXMgZnJvbSBub25lbXB0eSBidWZmZXJlZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICB7b2ssIDw8ImhhbGxvIHdvcmxkIj4+fQorICAgICAgfSwKKyAgICAgIHJlYWQoCisgICAgICAgIHt0X2J1ZmZlcmVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ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idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PCJoYWxsbyB3b3JsZCI+PgorICAgICAgICAgIH19LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDEKKyAgICAgICkKKyAgICApfSwKKyAgICB7InJlYWQgZXhhY3RseSAxIGJ5dGUgZnJvbSBub25lbXB0eSBidWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8ImFsbG8gd29ybGQiPj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICB7b2ssIDw8ImgiPj59CisgICAgICB9LAorICAgICAgcmVhZF9leGFjdCgKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PCJoYWxsbyB3b3JsZCI+Pn19LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDEKKyAgICAgICkKKyAgICApfSwKKyAgICB7InJlYWQgZXhhY3RseSBhIHppbGxpb24gYnl0ZXMgZnJvbSBub25lbXB0eSBidWZmZXJlZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8ImhhbGxvIHdvcmxkIj4+fX0sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAge2Vycm9yLCBlb2Z9CisgICAgICB9LAorICAgICAgcmVhZF9leGFjdCgKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLAorICAgICAgICAgICAgPDwiaGFsbG8gd29ybGQiPj4KKyAgICAgICAgICB9fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICA2NTUzNgorICAgICAgKQorICAgICl9CisgIF0uCisKKword3JpdGUoRnJhbWVkLCBEYXRhKSAtPiB0aHJpZnRfYnVmZmVyZWRfdHJhbnNwb3J0OndyaXRlKEZyYW1lZCwgRGF0YSkuCisKK3dyaXRlX3Rlc3RfKCkgLT4KKyAgWworICAgIHsid3JpdGUgZW1wdHkgbGlzdCB0byBlbXB0eSBidWZmZXJlZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbW10sIFtdXQorICAgICAgICB9LAorICAgICAgICBvaworICAgICAgfSwKKyAgICAgIHdyaXRlKAorICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICBbXQorICAgICAgKQorICAgICl9LAorICAgIHsid3JpdGUgZW1wdHkgbGlzdCB0byBub25lbXB0eSBidWZmZXJlZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbWyJoYWxsbyB3b3JsZCJdLCBbXV0KKyAgICAgICAgfSwKKyAgICAgICAgb2sKKyAgICAgIH0sCisgICAgICB3cml0ZSgKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgWyJoYWxsbyB3b3JsZCJdCisgICAgICAgIH0sCisgICAgICAgIFtdCisgICAgICApCisgICAgKX0sCisgICAgeyJ3cml0ZSBlbXB0eSBiaW5hcnkgdG8gZW1wdHkgYnVmZmVyZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW1tdLCA8PD4+XQorICAgICAgICB9LAorICAgICAgICBvaworICAgICAgfSwKKyAgICAgIHdyaXRlKAorICAgICAgICB7dF9idWZmZXJlZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICA8PD4+CisgICAgICApCisgICAgKX0sCisgICAgeyJ3cml0ZSBlbXB0eSBiaW5hcnkgdG8gbm9uZW1wdHkgYnVmZmVyZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfYnVmZmVyZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW1siaGFsbG8gd29ybGQiXSwgPDw+Pl0KKyAgICAgICAgf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cnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDw+Pn0KKyAgICAgIH0sCisgICAgICByZWFkKAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMAorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCAxIGJ5dGUgZnJvbSBhbiBlbXB0eSBmcmFtZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHtfLCB7ZXJyb3IsIGVvZn19LAorICAgICAgcmVhZCgKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDEKKyAgICAgICkKKyAgICApfSwKKyAgICB7InJlYWQgemVybyBieXRlcyBmcm9tIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLAorICAgICAgICAgICAgPDwwLCAwLCAwLCAxMSwgImhhbGxvIHdvcmxkIj4+CisgICAgICAgICAgfX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAge29rLCA8PD4+fQorICAgICAgfSwKKyAgICAgIHJlYWQoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PDAsIDAsIDAsIDExLCAiaGFsbG8gd29ybGQiPj4KKyAgICAgICAgICB9fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICAwCisgICAgICApCisgICAgKX0sCisgICAgeyJyZWFkIDEgYnl0ZSBmcm9tIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgPDwiYWxsbyB3b3JsZCI+PiwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICB7b2ssIDw8ImgiPj59CisgICAgICB9LAorICAgICAgcmVhZCgKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwKKyAgICAgICAgICAgIDw8MCwgMCwgMCwgMTEsICJoYWxsbyB3b3JsZCI+PgorICAgICAgICAgIH19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDEKKyAgICAgICkKKyAgICApfSwKKyAgICB7InJlYWQgMSBieXRlIGZyb20gbm9uZW1wdHkgYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIDw8ImFsbG8gd29ybGQiPj4sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAge29rLCA8PCJoIj4+fQorICAgICAgfSwKKyAgICAgIHJlYWQoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICA8PCJoYWxsbyB3b3JsZCI+PiwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICAxCisgICAgICApCisgICAgKX0sCisgICAgeyJyZWFkIGEgemlsbGlvbiBieXRlcyBmcm9tIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgPDw+PiwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICB7b2ssIDw8ImhhbGxvIHdvcmxkIj4+fQorICAgICAgfSwKKyAgICAgIHJlYWQoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PDAsIDAsIDAsIDExLCAiaGFsbG8gd29ybGQiPj4KKyAgICAgICAgICB9fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICA2NTUzNgorICAgICAgKQorICAgICl9CisgIF0uCisKKworcmVhZF9leGFjdChGcmFtZSwgQnl0ZXMpIC0+IHRocmlmdF9mcmFtZWRfdHJhbnNwb3J0OnJlYWRfZXhhY3QoRnJhbWUsIEJ5dGVzKS4KKworcmVhZF9leGFjdF90ZXN0XygpIC0+CisgIFsKKyAgICB7InJlYWQgZXhhY3RseSB6ZXJvIGJ5dGVzIGZyb20gYW4gZW1wdHkgZnJhbWVkIG1lbWJ1ZmZlciIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7CisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICA8PD4+LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDw+Pn0KKyAgICAgIH0sCisgICAgICByZWFkX2V4YWN0KAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMAorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCBleGFjdGx5IDEgYnl0ZSBmcm9tIGFuIGVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAge18sIHtlcnJvciwgZW9mfX0sCisgICAgICByZWFkX2V4YWN0KAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMQorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCBleGFjdGx5IHplcm8gYnl0ZXMgZnJvbSBub25lbXB0eSBmcmFtZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwKKyAgICAgICAgICAgIDw8MCwgMCwgMCwgMTEsICJoYWxsbyB3b3JsZCI+PgorICAgICAgICAgIH19LAorICAgICAgICAgIDw8Pj4sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAge29rLCA8PD4+fQorICAgICAgfSwKKyAgICAgIHJlYWRfZXhhY3QoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICA8PDAsIDAsIDAsIDExLCAiaGFsbG8gd29ybGQiPj4KKyAgICAgICAgICB9fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICAwCisgICAgICApCisgICAgKX0sCisgICAgeyJyZWFkIGV4YWN0bHkgMSBieXRlIGZyb20gbm9uZW1wdHkgZnJhbWVkIG1lbWJ1ZmZlciIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7CisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICA8PCJhbGxvIHdvcmxkIj4+LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDwiaCI+Pn0KKyAgICAgIH0sCisgICAgICByZWFkX2V4YWN0KAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLAorICAgICAgICAgICAgPDwwLCAwLCAwLCAxMSwgImhhbGxvIHdvcmxkIj4+CisgICAgICAgICAgfX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMQorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCBleGFjdGx5IDEgYnl0ZSBmcm9tIG5vbmVtcHR5IGJ1ZmZlciIsID9fYXNzZXJ0TWF0Y2goCisgICAgICB7CisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICA8PCJhbGxvIHdvcmxkIj4+LAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIHtvaywgPDwiaCI+Pn0KKyAgICAgIH0sCisgICAgICByZWFkX2V4YWN0KAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgPDwiaGFsbG8gd29ybGQiPj4sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgMQorICAgICAgKQorICAgICl9LAorICAgIHsicmVhZCBleGFjdGx5IGEgemlsbGlvbiBieXRlcyBmcm9tIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW1tdLDw8ImhhbGxvIHdvcmxkIj4+XSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICB7ZXJyb3IsIGVvZn0KKyAgICAgIH0sCisgICAgICByZWFkX2V4YWN0KAorICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLAorICAgICAgICAgICAgPDwwLCAwLCAwLCAxMSwgImhhbGxvIHdvcmxkIj4+CisgICAgICAgICAgfX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW10KKyAgICAgICAgfSwKKyAgICAgICAgNjU1MzYKKyAgICAgICkKKyAgICApfQorICBdLgorCisKK3dyaXRlKEZyYW1lZCwgRGF0YSkgLT4gdGhyaWZ0X2ZyYW1lZF90cmFuc3BvcnQ6d3JpdGUoRnJhbWVkLCBEYXRhKS4KKword3JpdGVfdGVzdF8oKSAtPgorICBbCisgICAgeyJ3cml0ZSBlbXB0eSBsaXN0IHRvIGVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW1tdLCBbXV0KKyAgICAgICAgfSwKKyAgICAgICAgb2sKKyAgICAgIH0sCisgICAgICB3cml0ZSgKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIFtdCisgICAgICApCisgICAgKX0sCisgICAgeyJ3cml0ZSBlbXB0eSBsaXN0IHRvIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAgeworICAgICAgICB7dF9mcmFtZWQsCisgICAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgICAgW10sCisgICAgICAgICAgW1siaGFsbG8gd29ybGQiXSwgW11dCisgICAgICAgIH0sCisgICAgICAgIG9rCisgICAgICB9LAorICAgICAgd3JpdGUoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbImhhbGxvIHdvcmxkIl0KKyAgICAgICAgfSwKKyAgICAgICAgW10KKyAgICAgICkKKyAgICApfSwKKyAgICB7IndyaXRlIGVtcHR5IGJpbmFyeSB0byBlbXB0eSBmcmFtZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtbXSwgPDw+Pl0KKyAgICAgICAgfSwKKyAgICAgICAgb2sKKyAgICAgIH0sCisgICAgICB3cml0ZSgKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIDw8Pj4KKyAgICAgICkKKyAgICApfSwKKyAgICB7IndyaXRlIGVtcHR5IGJpbmFyeSB0byBub25lbXB0eSBmcmFtZWQgbWVtYnVmZmVyIiwgP19hc3NlcnRNYXRjaCgKKyAgICAgIHsKKyAgICAgICAge3RfZnJhbWVkLAorICAgICAgICAgIHt0X3RyYW5zcG9ydCwgdGhyaWZ0X21lbWJ1ZmZlcl90cmFuc3BvcnQsIHt0X21lbWJ1ZmZlciwgPDw+Pn19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtbImhhbGxvIHdvcmxkIl0sIDw8Pj5dCisgICAgICAgIH0sCisgICAgICAgIG9rCisgICAgICB9LAorICAgICAgd3JpdGUoCisgICAgICAgIHt0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbImhhbGxvIHdvcmxkIl0KKyAgICAgICAgfSwKKyAgICAgICAgPDw+PgorICAgICAgKQorICAgICl9CisgIF0uCisKKworZmx1c2goVHJhbnNwb3J0KSAtPiB0aHJpZnRfZnJhbWVkX3RyYW5zcG9ydDpmbHVzaChUcmFuc3BvcnQpLgorCitmbHVzaF90ZXN0XygpIC0+CisgIFsKKyAgICB7ImZsdXNoIGVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAge3t0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgICBbXSwKKyAgICAgICAgICBbXQorICAgICAgICB9LAorICAgICAgICBvaworICAgICAgfSwKKyAgICAgIGZsdXNoKHt0X2ZyYW1lZCwKKyAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgIFtdLAorICAgICAgICBbXQorICAgICAgfSkKKyAgICApfSwKKyAgICB7ImZsdXNoIG5vbmVtcHR5IGZyYW1lZCBtZW1idWZmZXIiLCA/X2Fzc2VydE1hdGNoKAorICAgICAge3t0X2ZyYW1lZCwKKyAgICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsCisgICAgICAgICAgICBbPDw+PiwgWzw8MCwgMCwgMCwgMTE+PiwgPDwiaGFsbG8gd29ybGQiPj5dXQorICAgICAgICAgIH19LAorICAgICAgICAgIFtdLAorICAgICAgICAgIFtdCisgICAgICAgIH0sCisgICAgICAgIG9rCisgICAgICB9LAorICAgICAgZmx1c2goe3RfZnJhbWVkLAorICAgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgICAgW10sCisgICAgICAgIDw8ImhhbGxvIHdvcmxkIj4+CisgICAgICB9KQorICAgICl9CisgIF0uCisKKworY2xvc2UoVHJhbnNwb3J0KSAtPiB0aHJpZnRfZnJhbWVkX3RyYW5zcG9ydDpjbG9zZShUcmFuc3BvcnQpLgorCitjbG9zZV90ZXN0XygpIC0+CisgIHsiY2xvc2UgZnJhbWVkIG1lbWJ1ZmZlciIsID9fYXNzZXJ0TWF0Y2goCisgICAge3t0X2ZyYW1lZCwKKyAgICAgICAge3RfdHJhbnNwb3J0LCB0aHJpZnRfbWVtYnVmZmVyX3RyYW5zcG9ydCwge3RfbWVtYnVmZmVyLCA8PD4+fX0sCisgICAgICAgIFtdLAorICAgICAgICBbXQorICAgICAgfSwKKyAgICAgIG9rCisgICAgfSwKKyAgICBjbG9zZSh7dF9mcmFtZWQsCisgICAgICB7dF90cmFuc3BvcnQsIHRocmlmdF9tZW1idWZmZXJfdHJhbnNwb3J0LCB7dF9tZW1idWZmZXIsIDw8Pj59fSwKKyAgICAgIFtdLAorIC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gICAgICBgdGhyaWZ0OiJiLDIiIGpzb246ImIiYAorCUludDE2ICAgICAgaW50MTYgICAgICAgICAgICAgICBgdGhyaWZ0OiJpbnQxNiwzIiBqc29uOiJpbnQxNiJgCisJSW50MzIgICAgICBpbnQzMiAgICAgICAgICAgICAgIGB0aHJpZnQ6ImludDMyLDQiIGpzb246ImludDMyImAKKwlJbnQ2NCAgICAgIGludDY0ICAgICAgICAgICAgICAgYHRocmlmdDoiaW50NjQsNSIganNvbjoiaW50NjQiYAorCUQgICAgICAgICAgZmxvYXQ2NCAgICAgICAgICAgICBgdGhyaWZ0OiJkLDYiIGpzb246ImQiYAorCVN0ICAgICAgICAgc3RyaW5nICAgICAgICAgICAgICBgdGhyaWZ0OiJzdCw3IiBqc29uOiJzdCJgCisJQmluICAgICAgICBbXWJ5dGUgICAgICAgICAgICAgIGB0aHJpZnQ6ImJpbiw4IiBqc29uOiJiaW4iYAorCVN0cmluZ01hcCAgbWFwW3N0cmluZ11zdHJpbmcgICBgdGhyaWZ0OiJzdHJpbmdNYXAsOSIganNvbjoic3RyaW5nTWFwImAKKwlTdHJpbmdMaXN0IFtdc3RyaW5nICAgICAgICAgICAgYHRocmlmdDoic3RyaW5nTGlzdCwxMCIganNvbjoic3RyaW5nTGlzdCJgCisJU3RyaW5nU2V0ICBtYXBbc3RyaW5nXXN0cnVjdHt9IGB0aHJpZnQ6InN0cmluZ1NldCwxMSIganNvbjoic3RyaW5nU2V0ImAKKwlFICAgICAgICAgIE15VGVzdEVudW0gICAgICAgICAgYHRocmlmdDoiZSwxMiIganNvbjoiZSJgCit9CisKK2Z1bmMgTmV3TXlUZXN0U3RydWN0KCkgKk15VGVzdFN0cnVjdCB7CisJcmV0dXJuICZNeVRlc3RTdHJ1Y3R7fQorfQorCitmdW5jIChwICpNeVRlc3RTdHJ1Y3QpIEdldE9uKCkgYm9vbCB7CisJcmV0dXJuIHAuT24KK30KKworZnVuYyAocCAqTXlUZXN0U3RydWN0KSBHZXRCKCkgaW50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KKyAgICAgIHZhciBtZXNzYWdlIDogU3RyaW5nID0gbnVsbDsKKyAgICAgIHZhciB0eXBlIDogSW50ID0gVU5LTk9XTjsKKworICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgZmllbGQgPSBpcHJvdC5yZWFkRmllbGRCZWdpbigpOworICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5TVE9QKSB7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgc3dpdGNoIChmaWVsZC5pZCkgeworICAgICAgICAgIGNhc2UgMToKKyAgICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLlNUUklORykgeworICAgICAgICAgICAgICBtZXNzYWdlID0gaXByb3QucmVhZFN0cmluZygpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgIFRQcm90b2NvbFV0aWwuc2tpcChpcHJvdCwgZmllbGQudHlwZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgaWYgKGZpZWxkLnR5cGUgPT0gVFR5cGUuSTMyKSB7CisgICAgICAgICAgICAgIHR5cGUgPSBpcHJvdC5yZWFkSTMyKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgVFByb3RvY29sVXRpbC5za2lwKGlwcm90LCBmaWVsZC50eXBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgVFByb3RvY29sVXRpbC5za2lwKGlwcm90LCBmaWVsZC50eXBlKTsKKyAgICAgICAgfQorICAgICAgICBpcHJvdC5yZWFkRmllbGRFbmQoKTsKKyAgICAgIH0KKyAgICAgIGlwcm90LnJlYWRTdHJ1Y3RFbmQoKTsKKyAgICAgIHJldHVybiBuZXcgVEFwcGxpY2F0aW9uRXhjZXB0aW9uKHR5cGUsIG1lc3NhZ2UpOworICAgIH0KKworICAgIHB1Ymxp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cgPSBieXRlc1RvTG9uZyhidWYpOworICAgICAgICBpZiAoIEludDY0LmNvbXBhcmUoIGVyZywgdGVzdCkgIT0gMCkKKyAgICAgICAgICAgIHRocm93ICdCaXRDb252ZXJ0ZXIuYnl0ZXNUb0xvbmdUZXN0KCR0ZXN0KSBmYWlsZWQ6ICRlcmcnOworICAgIH0KKyAgICAjZW5kCisKKworICAgICNpZiBkZWJ1ZworICAgIHByaXZhdGUgc3RhdGljIGZ1bmN0aW9uIFRlc3RQYWlyKCBhIDogRmxvYXQsIGIgOiBJbnQ2NCkgOiBWb2lkIHsKKyAgICAgICAgdmFyIGJ4ID0gRG91YmxlVG9JbnQ2NEJpdHMoYSk7CisgICAgICAgIGlmICggSW50NjQuY29tcGFyZSggYngsIGIpICE9IDApCisgICAgICAgICAgICB0aHJvdyAnQml0Q29udmVydGVyLlRlc3RQYWlyOiBEb3VibGVUb0ludDY0Qml0cygkYSk6IGV4cGVjdGVkICRiLCBnb3QgJGJ4JzsKKyAgICAgICAgdmFyIGF4ID0gSW50NjRCaXRzVG9Eb3VibGUoYik7CisgICAgICAgIGlmKCBheCAhPSBhKQorICAgICAgICAgICAgdGhyb3cgJ0JpdENvbnZlcnRlci5UZXN0UGFpcjogSW50NjRCaXRzVG9Eb3VibGUoJGI6IGV4cGVjdGVkICRhLCBnb3QgICRheCc7CisgICAgfQorICAgICNlbmQKKworCisgICAgI2lmIGRlYnVnCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBVbml0VGVzdCgpIDogVm9pZCB7CisKKyAgICAgICAgLy8gYnl0ZXNUb0xvbmcoKQorICAgICAgICB2YXIgaSA6IEludDsKKyAgICAgICAgVGVzdEJUTCggSW50NjQubWFrZSgwLDApKTsKKyAgICAgICAgZm9yICggaSBpbiAwIC4uLiA2MikgeworICAgICAgICAgICAgVGVzdEJUTCggSW50NjQuc2hsKCBJbnQ2NC5tYWtlKDAsMSksIGkpKTsKKyAgICAgICAgICAgIFRlc3RCVEwoIEludDY0L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50TWFwPCBUPj47ICAvLyBIaSAtPiBMbyAtPiBWYWx1ZQorCisgICAgcHVibGljIGZ1bmN0aW9uIG5ldygpIDogVm9pZCB7CisgICAgICAgIFN1Yk1hcHMgPSBuZXcgSW50TWFwPCBJbnRNYXA8IFQ+PigpOworICAgIH07CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIEdldFN1Yk1hcCggaGkgOiBoYXhlLkludDMyLCBjYW5DcmVhdGUgOiBCb29sKSA6IEludE1hcDwgVD4geworICAgICAgICBpZiggU3ViTWFwcy5leGlzdHMoaGkpKSB7CisgICAgICAgICAgICByZXR1cm4gU3ViTWFwcy5nZXQoaGkpOworICAgICAgICB9CisKKyAgICAgICAgaWYoICEgY2FuQ3JlYXRlKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHZhciBsb21hcCA9IG5ldyBJbnRNYXA8IFQ+KCk7CisgICAgICAgIFN1Yk1hcHMuc2V0KCBoaSwgbG9tYXApOworICAgICAgICByZXR1cm4gbG9tYXA7CisgICAgfQorCisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIEdldExvd01hcCgga2V5IDogaGF4ZS5JbnQ2NCwgY2FuQ3JlYXRlIDogQm9vbCkgOiBJbnRNYXA8IFQ+IHsKKyAgICAgICAgI2lmKCBoYXhlX3ZlciA8IDMuMikKKyAgICAgICAgcmV0dXJuIEdldFN1Yk1hcCggSW50NjQuZ2V0SGlnaChrZXkpLCBjYW5DcmVhdGUpOworICAgICAgICAjZWxzZQorICAgICAgICByZXR1cm4gR2V0U3ViTWFwKCBrZXkuaGlnaCwgY2FuQ3JlYXRlKTsKKyAgICAgICAgI2VuZAorICAgIH0KKworCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBHZXRMb3dJbmRleCgga2V5IDogaGF4ZS5JbnQ2NCkgOiBoYXhlLkludDMyIHsKKyAgICAgICAgI2lmKCBoYXhlX3ZlciA8IDMuMikKKyAgICAgICAgcmV0dXJuIEludDY0LmdldExvdyhrZXkpOworICAgICAgICAjZWxzZQorICAgICAgICByZXR1cm4ga2V5LmxvdzsKKyAgICAgICAgI2VuZAorICAgIH0KKworCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBOdWxsQ2hlY2soIGtleSA6IGhheGUuSW50NjQpIDogQm9vbCB7CisgICAgICAgICNpZiggaGF4ZV92ZXIgPCAzLjIpCisgICAgICAgIHJldHVybiAoa2V5ICE9IG51bGwpOworICAgICAgICAjZWxzZQorICAgICAgICByZXR1cm4gdHJ1ZTsgIC8vIEludDY0IGlzIG5vdCBudWxsYWJsZSBhbnltb3JlIChpdCBuZXZlciByZWFsbHkgd2FzKQorICAgICAgICAjZW5kCisgICAgfTsKKworCisKKyAgICAvKioKKyAgICAgICAgTWFwcyBga2V5YCB0byBgdmFsdWVgLgorICAgICAgICBJZiBga2V5YCBhbHJlYWR5IGhhcyBhIG1hcHBpbmcsIHRoZSBwcmV2aW91cyB2YWx1ZSBkaXNhcHBlYXJzLgorICAgICAgICBJZiBga2V5YCBpcyBudWxsLCB0aGUgcmVzdWx0IGlzIHVuc3BlY2lmaWVkLgorICAgICoqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXQoIGtleSA6IEludDY0LCB2YWx1ZSA6IFQgKSA6IFZvaWQgeworICAgICAgICBpZiggISBOdWxsQ2hlY2soa2V5KSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgdmFyIGxvbWFwID0gR2V0TG93TWFwKCBrZXksIHRydWUpOworICAgICAgICBsb21hcC5zZXQoIEdldExvd0luZGV4KGtleSksIHZhbHVlKTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAgICBSZXR1cm5zIHRoZSBjdXJyZW50IG1hcHBpbmcgb2YgYGtleWAuCisgICAgICAgIElmIG5vIHN1Y2ggbWFwcGluZyBleGlzdHMsIG51bGwgaXMgcmV0dXJuZWQuCisgICAgICAgIElmIGBrZXlgIGlzIG51bGwsIHRoZSByZXN1bHQgaXMgdW5zcGVjaWZpZWQuCisKKyAgICAgICAgTm90ZSB0aGF0IGEgY2hlY2sgbGlrZSBgbWFwLmdldChrZXkpID09IG51bGxgIGNhbiBob2xkIGZvciB0d28gcmVhc29uczoKKworICAgICAgICAgICAgMS4gdGhlIG1hcCBoYXMgbm8gbWFwcGluZyBmb3IgYGtleWAKKyAgICAgICAgICAgIDIuIHRoZSBtYXAgaGFzIGEgbWFwcGluZyB3aXRoIGEgdmFsdWUgb2YgYG51bGxgCisKKyAgICAgICAgSWYgaXQgaXMgaW1wb3J0YW50IHRvIGRpc3Rpbmd1aXNoIHRoZXNlIGNhc2VzLCBgZXhpc3RzKClgIHNob3VsZCBiZQorICAgICAgICB1c2VkLgorCisgICAgKiovCisgICAgcHVibGljIGZ1bmN0aW9uIGdldCgga2V5IDogSW50NjQpIDogTnVsbDxUPiB7CisgICAgICAgIGlmKCAhIE51bGxDaGVjayhrZXkpKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHZhciBsb21hcCA9IEdldExvd01hcCgga2V5LCB0cnVlKTsKKyAgICAgICAgaWYoIGxvbWFwID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGxvbWFwLmdldCggR2V0TG93SW5kZXgoa2V5KSk7CisgICAgfQorCisgICAgLyoqCisgICAgICAgIFJldHVybnMgdHJ1ZSBpZiBga2V5YCBoYXMgYSBtYXBwaW5nLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgIElmIGBrZXlgIGlzIG51bGwsIHRoZSByZXN1bHQgaXMgdW5zcGVjaWZpZWQuCisgICAgKiovCisgICAgcHVibGljIGZ1bmN0aW9uIGV4aXN0cygga2V5IDogSW50NjQpIDogQm9vbCB7CisgICAgICAgIGlmKCAhIE51bGxDaGVjayhrZXkpKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICB2YXIgbG9tYXAgPSBHZXRMb3dNYXAoIGtleSwgdHJ1ZSk7CisgICAgICAgIGlmKCBsb21hcCA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbG9tYXAuZXhpc3RzKCBHZXRMb3dJbmRleChrZXkpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgICAgUmVtb3ZlcyB0aGUgbWFwcGluZyBvZiBga2V5YCBhbmQgcmV0dXJucyB0cnVlIGlmIHN1Y2ggYSBtYXBwaW5nIGV4aXN0ZWQsCisgICAgICAgIGZhbHNlIG90aGVyd2lzZS4gSWYgYGtleWAgaXMgbnVsbCwgdGhlIHJlc3VsdCBpcyB1bnNwZWNpZmllZC4KKyAgICAqKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVtb3ZlKCBrZXkgOiBJbnQ2NCkgOiBCb29sIHsKKyAgICAgICAgaWYoICEgTnVsbENoZWNrKGtleSkpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHZhciBsb21hcCA9IEdldExvd01hcCgga2V5LCB0cnVlKTsKKyAgICAgICAgaWYoIGxvbWFwID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBsb21hcC5yZW1vdmUoIEdldExvd0luZGV4KGtleSkpOworICAgIH0KKworCisgICAgLyoqCisgICAgICAgIFJldHVybnMgYW4gSXRlcmF0b3Igb3ZlciB0aGUga2V5cyBvZiBgdGhpc2AgTWFwLgorICAgICAgICBUaGUgb3JkZXIgb2Yga2V5cyBpcyB1bmRlZmluZWQuCisgICAgKiovCisgICAgcHVibGljIGZ1bmN0aW9uIGtleXMoKSA6IEl0ZXJhdG9yPEludDY0PiB7CisgICAgICAgIHJldHVybiBuZXcgSW50NjRLZXlJdGVyYXRvcjxUPihTdWJNYXBzKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgICAgUmV0dXJucyBhbiBJdGVyYXRvciBvdmVyIHRoZSB2YWx1ZXMgb2YgYHRoaXNgIE1hcC4KKyAgICAgICAgVGhlIG9yZGVyIG9mIHZhbHVlcyBpcyB1bmRlZmluZWQuCisgICAgKiovCisgICAgcHVibGljIGZ1bmN0aW9uIGl0ZXJhdG9yKCkgOiBJdGVyYXRvcjxUPiB7CisgICAgICAgIHJldHVybiBuZXcgSW50NjRWYWx1ZUl0ZXJhdG9yPFQ+KFN1Yk1hcHMpOworICAgIH0KKworICAgIC8qKgorICAgICAgICBSZXR1cm5zIGEgU3RyaW5nIHJlcHJlc2VudGF0aW9uIG9mIGB0aGlzYCBNYXAuCisgICAgICAgIFRoZSBleGFjdCByZXByZXNlbnRhdGlvbiBkZXBlbmRzIG9uIHRoZSBwbGF0Zm9ybSBhbmQga2V5LXR5cGUuCisgICAgKiovCisgICAgcHVibGljIGZ1bmN0aW9uIHRvU3RyaW5nKCkgOiBTdHJpbmcgeworICAgICAgICB2YXIgcmVzdWx0IDogU3RyaW5nID0gInsiOworCisgICAgICAgIHZhciBmaXJzdCA9IHRydWU7CisgICAgICAgIGZvcigga2V5IGluIHRoaXMua2V5cygpKSB7CisgICAgICAgICAgICBpZiggZmlyc3QpIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXN1bHQgKz0gIiwiOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXN1bHQgKz0gIiAiOworICAgICAgICAgICAgdmFyIHZhbHVlID0gdGhpcy5nZXQoa2V5KTsKKyAgICAgICAgICAgIHJlc3VsdCArPSBJbnQ2NC50b1N0cihrZXkpICsgJyA9PiAkdmFsdWUnOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHJlc3VsdCArICJ9IjsKKyAgICB9CisKK30KKworCisvLyBpbnRlcm5hbCBoZWxwZXIgY2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WMgbWF5IGJlIHVzZWQgdG8gZGV0ZXJtaW5lIHRoZSBjb21wbGV0aW9uCisgICAgICAgIHN0YXRlLgorICAgICoqLworICAgIHB1YmxpYyBmdW5jdGlvbiBoYXNOZXh0KCkgOiBCb29sIHsKKworICAgICAgICBpZiggKExvSXRlcmF0b3IgIT0gbnVsbCkgJiYgTG9JdGVyYXRvci5oYXNOZXh0KCkpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgd2hpbGUoIChIaUl0ZXJhdG9yICE9IG51bGwpICYmIEhpSXRlcmF0b3IuaGFzTmV4dCgpKSB7CisgICAgICAgICAgICBDdXJyZW50SGkgPSBIaUl0ZXJhdG9yLm5leHQoKTsKKyAgICAgICAgICAgIExvSXRlcmF0b3IgPSBTdWJNYXBzLmdldChDdXJyZW50SGkpLmtleXMoKTsKKyAgICAgICAgICAgIGlmKCAoTG9JdGVyYXRvciAhPSBudWxsKSAmJiBMb0l0ZXJhdG9yLmhhc05leHQoKSkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgSGlJdGVyYXRvciA9IG51bGw7CisgICAgICAgIExvSXRlcmF0b3IgPSBudWxsOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCit9CisKKworLy8gaW50ZXJuYWwgaGVscGVyIGNsYXNzIGZvciBJbnQ2NE1hcDxUPgorLy8gYWxsIGNsYXNzIHdpdGggbWF0Y2hpbmcgbWV0aG9kcyBjYW4gYmUgdXNlZCBhcyBpdGVyYXRvciAoZHVjayB0eXBpbmcpCitwcml2YXRlIGNsYXNzIEludDY0S2V5SXRlcmF0b3I8VD5leHRlbmRzIEludDY0TWFwSXRlcmF0b3JCYXNlPFQ+IHsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIGRhdGEgOiBJbnRNYXA8IEludE1hcDwgVD4+KSA6IFZvaWQgeworICAgICAgICBzdXBlc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IEludDsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIHZhbHVlcyA6IEFycmF5PEludD4gPSBudWxsKSB7CisgICAgICAgIGlmICggdmFsdWVzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoIHZhbHVlIGluIHZhbHVlcykgeworICAgICAgICAgICAgICAgICBhZGQodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGl0ZXJhdG9yKCk6SXRlcmF0b3I8SW50PiB7CisgICAgICAgIHJldHVybiBfZWxlbWVudHMua2V5cygpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB0cmFjZUFsbCgpIDogVm9pZCB7CisgICAgICAgIHRyYWNlKCckX3NpemUgZW50cmllcycpOworICAgICAgICBmb3IoZW50cnkgaW4gdGhpcykgeworICAgICAgICAgICAgdmFyIHllcyA9IGNvbnRhaW5zKGVudHJ5KTsKKyAgICAgICAgICAgIHRyYWNlKCctICRlbnRyeSwgY29udGFpbnMoKSA9ICR5ZXMnKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBhZGQobyA6IEludCkgOiBCb29sIHsKKyAgICAgICAgaWYoIF9lbGVtZW50cy5leGlzdHMobykpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBfc2l6ZSsrOworICAgICAgICBfZWxlbWVudHMuc2V0KG8sX3NpemUpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gY2xlYXIoKSA6IFZvaWQgeworICAgICAgICB3aGlsZSggX3NpemUgPiAwKSB7CisgICAgICAgICAgICByZW1vdmUoIF9lbGVtZW50cy5rZXlzKCkubmV4dCgpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBjb250YWlucyhvIDogSW50KSA6IEJvb2wgeworICAgICAgICByZXR1cm4gX2VsZW1lbnRzLmV4aXN0cyhvKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gaXNFbXB0eSgpIDogQm9vbCB7CisgICAgICAgIHJldHVybiBfc2l6ZSA9PSAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZW1vdmUobyA6IEludCkgOiBCb29sIHsKKyAgICAgICAgaWYgKGNvbnRhaW5zKG8pKSB7CisgICAgICAgICAgICBfZWxlbWVudHMucmVtb3ZlKG8pOworICAgICAgICAgICAgX3NpemUtLTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHRvQXJyYXkoKSA6IEFycmF5PEludD4geworICAgICAgICB2YXIgcmV0IDogQXJyYXk8SW50PiA9IG5ldyBBcnJheTxJbnQ+KCk7CisgICAgICAgIGZvciAoa2V5IGluIF9lbGVtZW50cy5rZXlzKCkpIHsKKyAgICAgICAgICAgIHJldC5wdXNoKGtleSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJldDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gZ2V0X3NpemUoKSA6IEludCB7CisgICAgICAgIHJldHVybiBfc2l6ZTsKKyAgICB9Cit9CisgICAgClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL2hheGUvc3JjL29yZy9hcGFjaGUvdGhyaWZ0L2hlbHBlci9PYmplY3RTZXQuaHggYi9saWIvaGF4ZS9zcmMvb3JnL2FwYWNoZS90aHJpZnQvaGVscGVyL09iamVjdFNldC5oeApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5iY2Y3MmZiCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2hheGUvc3JjL29yZy9hcGFjaGUv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Bnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kIGxpbWl0YXRpb25zCisgKiB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitwYWNrYWdlIG9yZy5hcGFjaGUudGhyaWZ0LmhlbHBlcjsKKworaW1wb3J0IE1hcDsKKworCitjbGFzcyBPYmplY3RTZXQ8Sz4geworCisgICAgcHJpdmF0ZSB2YXIgX2VsZW1lbnRzID0gbmV3IGhheGUuZHMuT2JqZWN0TWFwPEssSW50PigpOworICAgIHByaXZhdGUgdmFyIF9zaXplIDogSW50ID0gMDsKKyAgICBwdWJsaWMgdmFyIHNpemUoZ2V0LG5ldmVyKSA6IEludDsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIHZhbHVlcyA6IEFycmF5PEs+ID0gbnVsbCkgeworICAgICAgICBpZiAoIHZhbHVlcyAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKCB2YWx1ZSBpbiB2YWx1ZXMpIHsKKyAgICAgICAgICAgICAgICAgYWRkKHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBpdGVyYXRvcigpOkl0ZXJhdG9yPEs+IHsKKyAgICAgICAgcmV0dXJuIF9lbGVtZW50cy5rZXlzKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHRyYWNlQWxsKCkgOiBWb2lkIHsKKyAgICAgICAgdHJhY2UoJyRfc2l6ZSBlbnRyaWVzJyk7CisgICAgICAgIGZvcihlbnRyeSBpbiB0aGlzKSB7CisgICAgICAgICAgICB2YXIgeWVzID0gY29udGFpbnMoZW50cnkpOworICAgICAgICAgICAgdHJhY2UoJy0gJGVudHJ5LCBjb250YWlucygpID0gJHllcycpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGFkZChvIDogSykgOiBCb29sIHsKKyAgICAgICAgaWYoIF9lbGVtZW50cy5leGlzdHMobykpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBfc2l6ZSsrOworICAgICAgICBfZWxlbWVudHMuc2V0KG8sX3NpemUpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gY2xlYXIoKSA6IFZvaWQgeworICAgICAgICB3aGlsZSggX3NpemUgPiAwKSB7CisgICAgICAgICAgICByZW1vdmUoIF9lbGVtZW50cy5rZXlzKCkubmV4dCgpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBjb250YWlucyhvIDogSykgOiBCb29sIHsKKyAgICAgICAgcmV0dXJuIF9lbGVtZW50cy5leGlzdHMobyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGlzRW1wdHkoKSA6IEJvb2wgeworICAgICAgICByZXR1cm4gX3NpemUgPT0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVtb3ZlKG8gOiBLKSA6IEJvb2wgeworICAgICAgICBpZiAoY29udGFpbnMobykpIHsKKyAgICAgICAgICAgIF9lbGVtZW50cy5yZW1vdmUobyk7CisgICAgICAgICAgICBfc2l6ZS0tOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gdG9BcnJheSgpIDogQXJyYXk8Sz4geworICAgICAgICB2YXIgcmV0IDogQXJyYXk8Sz4gPSBuZXcgQXJyYXk8Sz4oKTsKKyAgICAgICAgZm9yIChrZXkgaW4gX2VsZW1lbnRzLmtleXMoKSkgeworICAgICAgICAgICAgcmV0LnB1c2goa2V5KTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmV0OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBnZXRfc2l6ZSgpID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ogVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLAorICogc29mdHdhcmUgZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4KKyAqICJBUyBJUyIgQkFTSVMsIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWQorICogS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUKKyAqIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQgbGltaXRhdGlvbnMKKyAqIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCisKK3BhY2thZ2Ugb3JnLmFwYWNoZS50aHJpZnQuaGVscGVyOworCitpbXBvcnQgTWFwOworCisKK2NsYXNzIFN0cmluZ1NldCB7CisKKyAgICBwcml2YXRlIHZhciBfZWxlbWVudHMgPSBuZXcgaGF4ZS5kcy5TdHJpbmdNYXA8SW50PigpOworICAgIHByaXZhdGUgdmFyIF9zaXplIDogSW50ID0gMDsKKyAgICBwdWJsaWMgdmFyIHNpemUoZ2V0LG5ldmVyKSA6IEludDsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIHZhbHVlcyA6IEFycmF5PFN0cmluZz4gPSBudWxsKSB7CisgICAgICAgIGlmICggdmFsdWVzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoIHZhbHVlIGluIHZhbHVlcykgeworICAgICAgICAgICAgICAgICBhZGQodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGl0ZXJhdG9yKCk6SXRlcmF0b3I8U3RyaW5nPiB7CisgICAgICAgIHJldHVybiBfZWxlbWVudHMua2V5cygpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB0cmFjZUFsbCgpIDogVm9pZCB7CisgICAgICAgIHRyYWNlKCckX3NpemUgZW50cmllcycpOworICAgICAgICBmb3IoZW50cnkgaW4gdGhpcykgeworICAgICAgICAgICAgdmFyIHllcyA9IGNvbnRhaW5zKGVudHJ5KTsKKyAgICAgICAgICAgIHRyYWNlKCctICRlbnRyeSwgY29udGFpbnMoKSA9ICR5ZXMnKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBhZGQobyA6IFN0cmluZykgOiBCb29sIHsKKyAgICAgICAgaWYoIF9lbGVtZW50cy5leGlzdHMobykpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBfc2l6ZSsrOworICAgICAgICBfZWxlbWVudHMuc2V0KG8sX3NpemUpOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gY2xlYXIoKSA6IFZvaWQgeworICAgICAgICB3aGlsZSggX3NpemUgPiAwKSB7CisgICAgICAgICAgICByZW1vdmUoIF9lbGVtZW50cy5rZXlzKCkubmV4dCgpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBjb250YWlucyhvIDogU3RyaW5nKSA6IEJvb2wgeworICAgICAgICByZXR1cm4gX2VsZW1lbnRzLmV4aXN0cyhvKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gaXNFbXB0eSgpIDogQm9vbCB7CisgICAgICAgIHJldHVybiBfc2l6ZSA9PSAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZW1vdmUobyA6IFN0cmluZykgOiBCb29sIHsKKyAgICAgICAgaWYgKGNvbnRhaW5zKG8pKSB7CisgICAgICAgICAgICBfZWxlbWVudHMucmVtb3ZlKG8pOworICAgICAgICAgICAgX3NpemUtLTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAg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bHkgYXMgYSB2YXJpbnQuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBGcm9tSW50KCBuIDogSW50KSA6IFVJbnQgICAgeworICAgICAgICAjaWYgcGhwCisKKyAgICAgICAgcmV0dXJuIGNhc3QoY2FzdChjYXN0KG4sSW50MzIpIDw8IDEsSW50MzIpIF4gY2FzdChjYXN0KG4sSW50MzIpID4+IDMxLEludDMyKSxVSW50KTsKKworICAgICAgICAjZWxzZQorCisgICAgICAgIHJldHVybiBjYXN0KG4gPDwgMSxVSW50KSBeIGNhc3QobiA+PiAzMSxVSW50KTsKKworICAgICAgICAjZW5kCisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiBDb252ZXJ0IGZyb20gemlnemFnIGludCB0byBpbnQuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBUb0ludCggbiA6IFVJbnQpIDogSW50IHsKKyAgICAgICAgI2lmIHBocAorCisgICAgICAgIHZhciBhID0gKDB4N0ZGRkZGRkYgJiBjYXN0KG4gPj4gMSxJbnQpKTsKKyAgICAgICAgdmFyIGIgPSAoY2FzdChuICYgMSxJbnQpKTsKKyAgICAgICAgYiA9IC1iOyAgLy8gd29ya2Fyb3VuZCBmb3IgaHR0cHM6Ly9naXRodWIuY29tL0hheGVGb3VuZGF0aW9uL2hheGUvaXNzdWVzLzUyODgKKyAgICAgICAgcmV0dXJuIGEgXiBiOworCisgICAgICAgICNlbHNlCisKKyAgICAgICAgcmV0dXJuICgweDdGRkZGRkZGICYgY2FzdChuID4+IDEsSW50KSkgXiAoLWNhc3QobiAmIDEsSW50KSk7CisKKyAgICAgICAgI2VuZAorICAgIH0KKworCisgICAgLyoqCisgICAgICogQ29udmVydCBsIGludG8gYSB6aWd6YWcgbG9uZy4gVGhpcyBhbGxvd3MgbmVnYXRpdmUgbnVtYmVycyB0byBiZQorICAgICAqIHJlcHJlc2VudGVkIGNvbXBhY3RseSBhcyBhIHZhcmludC4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIEZyb21Mb25nKCBuIDogSW50NjQpIDogSW50NjQgeworICAgICAgICByZXR1cm4gSW50NjQueG9yKCBJbnQ2NC5zaGwobiwgMSksIEludDY0LnNocihuLCA2MykpOworICAgIH0KKworCisgICAgLyoqCisgICAgICogQ29udmVydCBmcm9tIHppZ3phZyBsb25nIHRvIGxvbmcuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBUb0xvbmcoIG4gOiBJbnQ2NCkgOiBJbnQ2NCB7CisgICAgICAgIHJldHVybiBJbnQ2NC54b3IoCisgICAgICAgICAgICBJbnQ2NC5hbmQoCisgICAgICAgICAgICAgICAgSW50NjQuc2hyKG4sIDEpLAorICAgICAgICAgICAgICAgIEludDY0Lm1ha2UoMHg3RkZGRkZGRiwgMHhGRkZGRkZGRikpLAorICAgICAgICAgICAgSW50NjQuc3ViKAorICAgICAgICAgICAgICAgIEludDY0Lm1ha2UoMCwgMCksCisgICAgICAgICAgICAgICAgSW50NjQuYW5kKG4sIEludDY0Lm1ha2UoMCwxKSkpKTsKKyAgICB9CisKKworICAgICNpZiBkZWJ1ZworICAgIHByaXZhdGUgc3RhdGljIGZ1bmN0aW9uIFRlc3QzMiggdGVzdCA6IEludCkgOiBWb2lkIHsKKyAgICAgICAgdmFyIGEgOiBVSW50ID0gWmlnWmFnLkZyb21JbnQoIHRlc3QpOworICAgICAgICB2YXIgYiA6IEludCA9IFppZ1phZy5Ub0ludChhKTsKKyAgICAgICAgI2lmIHBocAorICAgICAgICB0ZXN0ID0gdGVzdCAmIDB4RkZGRkZGRkY7ICAvLyB3b3JrYXJvdW5kIGZvciBodHRwczovL2dpdGh1Yi5jb20vSGF4ZUZvdW5kYXRpb24vaGF4ZS9pc3N1ZXMvNTI4OQorICAgICAgICAjZW5kCisgICAgICAgIGlmKCB0ZXN0ICE9IGIpCisgICAgICAgICAgICB0aHJvdyAnWmlnWmFnLlRlc3QzMigkd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PSB0cnVlOworICAgICAgICBvdXQud3JpdGVJbnQxNihpMTYpOworICAgICAgICB0cmFuc18ud3JpdGUob3V0LmdldEJ5dGVzKCksIDAsIDIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkzMihpMzIgOiBJbnQpIDogVm9pZCB7CisgICAgICAgIHZhciBvdXQgPSBuZXcgQnl0ZXNPdXRwdXQoKTsKKyAgICAgICAgb3V0LmJpZ0VuZGlhbiA9IHRydWU7CisgICAgICAgIG91dC53cml0ZUludDMyKGkzMik7CisgICAgICAgIHRyYW5zXy53cml0ZShvdXQuZ2V0Qnl0ZXMoKSwgMCwgNCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTY0KGk2NCA6IGhheGUuSW50NjQpIDogVm9pZCB7CisgICAgICAgIHZhciBvdXQgPSBuZXcgQnl0ZXNPdXRwdXQoKTsKKyAgICAgICAgb3V0LmJpZ0VuZGlhbiA9IHRydWU7CisgICAgICAgICNpZiggaGF4ZV92ZXIgPCAzLjIpCisgICAgICAgIHZhciBoaSA9IEludDY0LmdldEhpZ2goaTY0KTsKKyAgICAgICAgdmFyIGxvID0gSW50NjQuZ2V0TG93KGk2NCk7CisgICAgICAgIG91dC53cml0ZUludDMyKGhpKTsKKyAgICAgICAgb3V0LndyaXRlSW50MzIobG8pOworICAgICAgICAjZWxzZQorICAgICAgICBvdXQud3JpdGVJbnQzMihpNjQuaGlnaCk7CisgICAgICAgIG91dC53cml0ZUludDMyKGk2NC5sb3cpOworICAgICAgICAjZW5kCisgICAgICAgIHRyYW5zXy53cml0ZShvdXQuZ2V0Qnl0ZXMoKSwgMCwgOCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRG91YmxlKGR1YjpGbG9hdCkgOiBWb2lkIHsKKyAgICAgICAgdmFyIG91dCA9IG5ldyBCeXRlc091dHB1dCgpOworICAgICAgICBvdXQuYmlnRW5kaWFuID0gdHJ1ZTsKKyAgICAgICAgb3V0LndyaXRlRG91YmxlKGR1Yik7CisgICAgICAgIHRyYW5zXy53cml0ZShvdXQuZ2V0Qnl0ZXMoKSwgMCwgOCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU3RyaW5nKHN0ciA6IFN0cmluZykgOiBWb2lkIHsKKyAgICAgICAgdmFyIG91dCA9IG5ldyBCeXRlc091dHB1dCgpOworICAgICAgICBvdXQuYmlnRW5kaWFuID0gdHJ1ZTsKKyAgICAgICAgb3V0LndyaXRlU3RyaW5nKHN0cik7CisgICAgICAgIHZhciBieXRlcyA9IG91dC5nZXRCeXRlcygpOworICAgICAgICB3cml0ZUkzMiggYnl0ZXMubGVuZ3RoKTsKKyAgICAgICAgdHJhbnNfLndyaXRlKCBieXRlcywgMCwgYnl0ZXMubGVuZ3RoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVCaW5hcnkoYmluOkJ5dGVzKSA6IFZvaWQgeworICAgICAgICB3cml0ZUkzMihiaW4ubGVuZ3RoKTsKKyAgICAgICAgdHJhbnNfLndyaXRlKGJpbiwgMCwgYmluLmxlbmd0aCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZGluZyBtZXRob2RzLgorICAgICAqLworCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRNZXNzYWdlQmVnaW4oKTpUTWVzc2FnZSB7CisgICAgICAgIHZhciBzaXplIDogSW50ID0gcmVhZEkzMigpOworICAgICAgICBpZiAoc2l6ZSA8IDApIHsKKyAgICAgICAgICAgIHZhciB2ZXJzaW9uIDogSW50ID0gc2l6ZSAmIFZFUlNJT05fTUFTSzsKKyAgICAgICAgICAgIGlmICh2ZXJzaW9uICE9IFZFUlNJT05fMSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLkJBRF9WRVJTSU9OLCAiQmFkIHZlcnNpb24gaW4gcmVhZE1lc3NhZ2VCZWdpbiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG5ldyBUTWVzc2FnZShyZWFkU3RyaW5nKCksIHNpemUgJiAweDAwMDAwMGZmLCByZWFkSTMyKCkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKHN0cmljdFJlYWRfKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sICJNaXNzaW5nIHZlcnNpb24gaW4gcmVhZE1lc3NhZ2VCZWdpbiwgb2xkIGNsaWVudD8iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBuZXcgVE1lc3NhZ2UocmVhZFN0cmluZ0JvZHkoc2l6ZSksIHJlYWRCeXRlKCksIHJlYWRJMzIoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1lc3NhZ2VFbmQoKSA6IFZvaWQge30KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU3RydWN0QmVnaW4oKTpUU3RydWN0IHsKKyAgICAgICAgcmV0dXJuIEFOT05ZTU9VU19TVFJVQ1Q7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJ1Y3RFbmQoKSA6IFZvaWQge30KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRmllbGRCZWdpbigpIDogVEZpZWxkIHsKKyAgICAgICAgdmFyIHR5cGUgOiBJbnQgPSByZWFkQnl0ZSgpOworICAgICAgICB2YXIgaWQgOiBJbnQgPSAwOworICAgICAgICBpZiAodHlwZSAhPSBUVHlwZS5TVE9QKQorICAgICAgICB7CisgICAgICAgICAgICBpZCA9IHJlYWRJMTYoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbmV3IFRGaWVsZCgiIiwgdHlwZSwgaWQpOworICAgIH0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lRfQU1PVU5UIDogSW50ID0gNTsKKworCisgICAgcHJpdmF0ZSBzdGF0aWMgdmFyIHR0eXBlVG9Db21wYWN0VHlwZSA9IFsKKyAgICAgICAgVFR5cGUuU1RPUCAgICA9PiBUQ29tcGFjdFR5cGVzLlNUT1AsCisgICAgICAgIFRUeXBlLkJPT0wgICAgPT4gVENvbXBhY3RUeXBlcy5CT09MRUFOX1RSVUUsCisgICAgICAgIFRUeXBlLkJZVEUgICAgPT4gVENvbXBhY3RUeXBlcy5CWVRFLAorICAgICAgICBUVHlwZS5ET1VCTEUgID0+IFRDb21wYWN0VHlwZXMuRE9VQkxFLAorICAgICAgICBUVHlwZS5JMTYgICAgID0+IFRDb21wYWN0VHlwZXMuSTE2LAorICAgICAgICBUVHlwZS5JMzIgICAgID0+IFRDb21wYWN0VHlwZXMuSTMyLAorICAgICAgICBUVHlwZS5JNjQgICAgID0+IFRDb21wYWN0VHlwZXMuSTY0LAorICAgICAgICBUVHlwZS5TVFJJTkcgID0+IFRDb21wYWN0VHlwZXMuQklOQVJZLAorICAgICAgICBUVHlwZS5TVFJVQ1QgID0+IFRDb21wYWN0VHlwZXMuU1RSVUNULAorICAgICAgICBUVHlwZS5NQVAgICAgID0+IFRDb21wYWN0VHlwZXMuTUFQLAorICAgICAgICBUVHlwZS5TRVQgICAgID0+IFRDb21wYWN0VHlwZXMuU0VULAorICAgICAgICBUVHlwZS5MSVNUICAgID0+IFRDb21wYWN0VHlwZXMuTElTVAorICAgIF07CisKKyAgICBwcml2YXRlIHN0YXRpYyB2YXIgdGNvbXBhY3RUeXBlVG9UeXBlID0gWworICAgICAgICBUQ29tcGFjdFR5cGVzLlNUT1AgICAgICAgICAgPT4gVFR5cGUuU1RPUCwKKyAgICAgICAgVENvbXBhY3RUeXBlcy5CT09MRUFOX1RSVUUgID0+IFRUeXBlLkJPT0wsCisgICAgICAgIFRDb21wYWN0VHlwZXMuQk9PTEVBTl9GQUxTRSA9PiBUVHlwZS5CT09MLAorICAgICAg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EZpZWxkXy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIGxhc3RGaWVsZF8ucG9wKCk7CisgICAgICAgIH0KKyAgICAgICAgbGFzdEZpZWxkSWRfID0gMDsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqIFdyaXRlcyBhIGJ5dGUgd2l0aG91dCBhbnkgcG9zc2liaWxpdHkgb2YgYWxsIHRoYXQgZmllbGQgaGVhZGVyIG5vbnNlbnNlLgorICAgICAqIFVzZWQgaW50ZXJuYWxseSBieSBvdGhlciB3cml0aW5nIG1ldGhvZHMgdGhhdCBrbm93IHRoZXkgbmVlZCB0byBXcml0ZSBhIGJ5dGUuCisgICAgICovCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBXcml0ZUJ5dGVEaXJlY3QoIGIgOiBJbnQpIDogVm9pZCB7CisgICAgICAgIHZhciBidWYgPSBCeXRlcy5hbGxvYygxKTsKKyAgICAgICAgYnVmLnNldCggMCwgYik7CisgICAgICAgIHRyYW5zLndyaXRlKCBidWYsIDAsIDEpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlIGFuIGkzMiBhcyBhIHZhcmludC4gUmVzdWx0cyBpbiAxLTUgYnl0ZXMgb24gdGhlIHdpcmUuCisgICAgICovCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBXcml0ZVZhcmludDMyKCBuIDogVUludCkgOiBWb2lkIHsKKyAgICAgICAgdmFyIGkzMmJ1ZiA9IG5ldyBCeXRlc0J1ZmZlcigpOworICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKChuICYgfjB4N0YpID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaTMyYnVmLmFkZEJ5dGUoIG4gJiAweEZGKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpMzJidWYuYWRkQnl0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RlID0gdHlwZU92ZXJyaWRlOworCisgICAgICAgIC8vIGNoZWNrIGlmIHdlIGNhbiB1c2UgZGVsdGEgZW5jb2RpbmcgZm9yIHRoZSBmaWVsZCBpZAorICAgICAgICBpZiAoZmllbGQuaWQgPiBsYXN0RmllbGRJZF8gJiYgZmllbGQuaWQgLSBsYXN0RmllbGRJZF8gPD0gMTUpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIFdyaXRlIHRoZW0gdG9nZXRoZXIKKyAgICAgICAgICAgIFdyaXRlQnl0ZURpcmVjdCgoZmllbGQuaWQgLSBsYXN0RmllbGRJZF8pIDw8IDQgfCB0eXBlVG9Xcml0ZSk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICAvLyBXcml0ZSB0aGVtIHNlcGFyYXRlCisgICAgICAgICAgICBXcml0ZUJ5dGVEaXJlY3QodHlwZVRvV3JpdGUpOworICAgICAgICAgICAgd3JpdGVJMTYoZmllbGQuaWQpOworICAgICAgICB9CisKKyAgICAgICAgbGFzdEZpZWxkSWRfID0gZmllbGQuaWQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogV3JpdGUgdGhlIFNUT1Agc3ltYm9sIHNvIHdlIGtub3cgdGhlcmUgYXJlIG5vIG1vcmUgZmllbGRzIGluIHRoaXMgc3RydWN0LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUZpZWxkU3RvcCgpIDogVm9pZCB7CisgICAgICAgIFdyaXRlQnl0ZURpcmVjdCggY2FzdChUQ29tcGFjdFR5cGVzLlNUT1AsIEludCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlIGEgbWFwIGhlYWRlci4gSWYgdGhlIG1hcCBpcyBlbXB0eSwgb21pdCB0aGUga2V5IGFuZCB2YWx1ZSB0eXBlCisgICAgICogaGVhZGVycywgYXMgd2UgZG9uJ3QgbmVlZCBhbnkgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiB0byBza2lwIGl0LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1hcEJlZ2luKG1hcDpUTWFwKSA6IFZvaWQgeworICAgICAgICBpZiAobWFwLnNpemUgPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgV3JpdGVCeXRlRGlyZWN0KDApOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGt2dHlwZSA9IChnZXRDb21wYWN0VHlwZShtYXAua2V5VHlwZSkgPDwgNCkgfCBnZXRDb21wYWN0VHlwZShtYXAudmFsdWVUeXBlKTsKKyAgICAgICAgICAgIFdyaXRlVmFyaW50MzIoIGNhc3QoIG1hcC5zaXplLCBVSW50KSk7CisgICAgICAgICAgICBXcml0ZUJ5dGVEaXJlY3QoIGt2dHlwZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcml0ZSBhIGxpc3QgaGVhZGVyLgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUxpc3RCZWdpbiggbGlzdCA6IFRMaXN0KSA6IFZvaWQgeworICAgICAgICBXcml0ZUNvbGxlY3Rpb25CZWdpbiggbGlzdC5lbGVtVHlwZSwgbGlzdC5zaXplKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcml0ZSBhIHNldCBoZWFkZXIuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU2V0QmVnaW4oIHNldCA6IFRTZXQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlQ29sbGVjdGlvbkJlZ2luKCBzZXQuZWxlbVR5cGUsIHNldC5zaXplKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcml0ZSBhIGJvb2xlYW4gdmFsdWUuIFBvdGVudGlhbGx5LCB0aGlzIGNvdWxkIGJlIGEgYm9vbGVhbiBmaWVsZCwgaW4KKyAgICAgKiB3aGljaCBjYXNlIHRoZSBmaWVsZCBoZWFk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GFuIEkxNiBhcyBhIHppZ3phZyB2YXJpbnQuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTE2KCBpMTYgOiBJbnQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlVmFyaW50MzIoIFppZ1phZy5Gcm9tSW50KCBpMTYpKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcml0ZSBhbiBpMzIgYXMgYSB6aWd6YWcgdmFyaW50LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkzMiggaTMyIDogSW50KSA6IFZvaWQgeworICAgICAgICBXcml0ZVZhcmludDMyKCBaaWdaYWcuRnJvbUludCggaTMyKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogV3JpdGUgYW4gaTY0IGFzIGEgemlnemFnIHZhcmludC4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJNjQoIGk2NCA6IGhheGUuSW50NjQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlVmFyaW50NjQoICBaaWdaYWcuRnJvbUxvbmcoIGk2NCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlIGEgZG91YmxlIHRvIHRoZSB3aXJlIGFzIDggYnl0ZXMuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRG91YmxlKCBkdWIgOiBGbG9hdCkgOiBWb2lkIHsKKyAgICAgICAgdmFyIGRhdGEgPSBCaXRDb252ZXJ0ZXIuZml4ZWRMb25nVG9CeXRlcyggQml0Q29udmVydGVyLkRvdWJsZVRvSW50NjRCaXRzKGR1YikpOworICAgICAgICB0cmFucy53cml0ZSggZGF0YSwgMCwgZGF0YS5sZW5ndGgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlIGEgc3RyaW5nIHRvIHRoZSB3aXJlIHdpdGggYSB2YXJpbnQgc2l6ZSBwcmVjZWRpbmcuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uI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AgICAgICAgeworICAgICAgICAgICAgaWYoIEludDY0LmlzWmVybyggSW50NjQuYW5kKCBuLCBJbnQ2NC5uZWcoSW50NjQubWFrZSgwLDB4N0YpKSkpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICNpZiggaGF4ZV92ZXIgPCAzLjIpCisgICAgICAgICAgICAgICAgdmFyaW50NjRvdXQuYWRkQnl0ZSggSW50NjQuZ2V0TG93KG4pKTsKKyAgICAgICAgICAgICAgICAjZWxzZQorICAgICAgICAgICAgICAgIHZhcmludDY0b3V0LmFkZEJ5dGUoIG4ubG93KTsKKyAgICAgICAgICAgICAgICAjZW5kCisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgI2lmICggaGF4ZV92ZXIgPCAzLjIpCisgICAgICAgICAgICAgICAgdmFyaW50NjRvdXQuYWRkQnl0ZSggKEludDY0LmdldExvdyhuKSAmIDB4N0YpIHwgMHg4MCk7CisgICAgICAgICAgICAgICAgI2Vsc2UKKyAgICAgICAgICAgICAgICB2YXJpbnQ2NG91dC5hZGRCeXRlKCAobi5sb3cgJiAweDdGKSB8IDB4ODApOworICAgICAgICAgICAgICAgICNlbmQKKyAgICAgICAgICAgICAgICBuID0gSW50NjQuc2hyKCBuLCA3KTsKKyAgICAgICAgICAgICAgICBuID0gSW50NjQuYW5kKCBuLCBJbnQ2NC5tYWtlKDB4MDFGRkZGRkYsMHhGRkZGRkZGRikpOyAgLy8gY2xlYW4gb3V0IHRoZSBzaGlmdGVkIDcgYml0cworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHZhciB0bXAgPSB2YXJpbnQ2NG91dC5nZXRCeXRlcygpOworICAgICAgICB0cmFucy53cml0ZSggdG1wLCAwLCB0bXAubGVuZ3RoKTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqIFJlYWQgYSBtZXNzYWdlIGhlYWRlci4KKyAgICA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xlLgorICAgICAgICAgICAgYm9vbFZhbHVlXyA9ICgodHlwZSAmIDB4MGYpID09IGNhc3QoVENvbXBhY3RUeXBlcy5CT09MRUFOX1RSVUUsSW50KSk7CisgICAgICAgIH0KKworICAgICAgICAvLyBwdXNoIHRoZSBuZXcgZmllbGQgb250byB0aGUgZmllbGQgc3RhY2sgc28gd2UgY2FuIGtlZXAgdGhlIGRlbHRhcyBnb2luZy4KKyAgICAgICAgbGFzdEZpZWxkSWRfID0gZmllbGQuaWQ7CisgICAgICAgIHJldHVybiBmaWVsZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkIGEgbWFwIGhlYWRlciBvZmYgdGhlIHdpcmUuIElmIHRoZSBzaXplIGlzIHplcm8sIHNraXAgUmVhZGluZyB0aGUga2V5CisgICAgICogYW5kIHZhbHVlIHR5cGUuIFRoaXMgbWVhbnMgdGhhdCAwLWxlbmd0aCBtYXBzIHdpbGwgeWllbGQgVE1hcHMgd2l0aG91dCB0aGUKKyAgICAgKiAiY29ycmVjdCIgdHlwZXMuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRNYXBCZWdpbigpIDogVE1hcCB7CisgICAgICAgIHZhciBzaXplIDogSW50ID0gY2FzdCggUmVhZFZhcmludDMyKCksIEludCk7CisgICAgICAgIHZhciBrZXlBbmRWYWx1ZVR5cGUgOiBJbnQgPSAoKHNpemUgPT0gMCkgID8gIDAgIDogIHJlYWRCeXRlKCkpOworICAgICAgICB2YXIga2V5IDogSW50ID0gY2FzdCggZ2V0VFR5cGUoIChrZXlBbmRWYWx1ZVR5cGUgJiAweEYwKSA+PiA0KSwgSW50KTsKKyAgICAgICAgdmFyIHZhbCA6IEludCA9IGNhc3QoIGdldFRUeXBlKCBrZXlBbmRWYWx1ZVR5cGUgJiAweDBGKSwgSW50KTsKKyAgICAgICAgcmV0dXJuIG5ldyBUTWFwKCBrZXksIHZhbCwgc2l6ZSk7CisgICAgfQorCisgICAgLyoqCisgICAgIC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hcmludCB3aWxsIGZvbGxvdyB3aXRoIHRoZQorICAgICAqIHRydWUgc2l6ZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFNldEJlZ2luKCkgOiBUU2V0IHsKKyAgICAgICAgdmFyIHNpemVfYW5kX3R5cGUgOiBJbnQgPSByZWFkQnl0ZSgpOworCisgICAgICAgIHZhciBzaXplIDogSW50ID0gKChzaXplX2FuZF90eXBlICYgMHhGMCkgPj4gNCkgJiAweDBGOworICAgICAgICBpZiAoc2l6ZSA9PSAxNSkgeworICAgICAgICAgICAgc2l6ZSA9IGNhc3QoIFJlYWRWYXJpbnQzMigpLCBJbnQpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHR5cGUgPSBnZXRUVHlwZShzaXplX2FuZF90eXBlKTsKKyAgICAgICAgcmV0dXJuIG5ldyBUU2V0KCB0eXBlLCBzaXplKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkIGEgYm9vbGVhbiBvZmYgdGhlIHdpcmUuIElmIHRoaXMgaXMgYSBib29sZWFuIGZpZWxkLCB0aGUgdmFsdWUgc2hvdWxkCisgICAgICogYWxyZWFkeSBoYXZlIGJlZW4gUmVhZCBkdXJpbmcgUmVhZEZpZWxkQmVnaW4sIHNvIHdlJ2xsIGp1c3QgY29uc3VtZSB0aGUKKyAgICAgKiBwcmUtc3RvcmVkIHZhbHVlLiBPdGhlcndpc2UsIFJlYWQgYSBieXRlLgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkQm9vbCgpIDogQm9vbCB7CisgICAgICAgIGlmIChib29sVmFsdWVfICE9IG51bGwpIHsKKyAgICAgICAgICAgIHZhciByZXN1bHQgOiBCb29sID0gYm9vbFZhbHVlXzsKKyAgICAgICAgICAgIGJvb2xWYWx1ZV8gPSBudWxsOworICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAocmVhZEJ5dGUoKSA9PSBjYXN0KFRDb21wYWN0VHlwZXMuQk9PTEVBTl9UUlVFLEludCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlYWQgYSBzaW5nbGUgYnl0ZSBvZmYgdGhlIHdpcmUuIE5vdGhpbmcgaW50ZXJlc3RpbmcgaGVyZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEJ5dGUoKSA6IEludCB7CisgICAgICAgIHZhciBieXRlUmF3QnVmID0gbmV3IEJ5dGVzQnVmZmVyKCk7CisgICAgICAgIHRyYW5zLnJlYWRBbGwoIGJ5dGVSYXdCdWYsIDAsIDEpOworICAgICAgICByZXR1cm4gYnl0ZVJhd0J1Zi5nZXRCeXRlcygpLmdldCgwKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkIGFuIGkxNiBmcm9tIHRoZSB3aXJlIGFzIGEgemlnemFnIHZhcmludC4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEkxNigpIDogSW50IHsKKyAgICAgICAgcmV0dXJuIFppZ1phZy5Ub0ludCggUmVhZFZhcmludDMyKCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlYWQgYW4gaTMyIGZyb20gdGhlIHdpcmUgYXMgYSB6aWd6YWcgdmFyaW50LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTMyKCkgOiBJbnQgeworICAgICAgICByZXR1cm4gWmlnWmFnLlRvSW50KCBSZWFkVmFyaW50MzIoKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZCBhbiBpNjQgZnJvbSB0aGUgd2lyZSBhcyBhIHppZ3phZyB2YXJpbnQuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJNjQoKSA6IGhheGUuSW50NjQgeworICAgICAgICByZXR1cm4gWmlnWmFnLlRvTG9uZyggUmVhZFZhcmludDY0KCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIE5vIG1hZ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HsKKyAgICAgICAgICAgIHZhciBiIDogSW50ID0gcmVhZEJ5dGUoKTsKKyAgICAgICAgICAgIHJlc3VsdCA9IEludDY0Lm9yKCByZXN1bHQsIEludDY0LnNobCggSW50NjQubWFrZSgwLGIgJiAweDdmKSwgc2hpZnQpKTsKKyAgICAgICAgICAgIGlmICgoYiAmIDB4ODApICE9IDB4ODApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNoaWZ0ICs9IDc7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworCisgICAgLy8KKyAgICAvLyB0eXBlIHRlc3RpbmcgYW5kIGNvbnZlcnRpbmcKKyAgICAvLworCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBpc0Jvb2xUeXBlKCBiIDogSW50KSA6IEJvb2wgeworICAgICAgICB2YXIgbG93ZXJOaWJibGUgOiBJbnQgPSBiICYgMHgwZjsKKyAgICAgICAgc3dpdGNoKGxvd2VyTmliYmxlKQorICAgICAgICB7CisgICAgICAgICAgICBjYXNlIFRDb21wYWN0VHlwZXMuQk9PTEVBTl9UUlVFOiByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIGNhc2UgVENvbXBhY3RUeXBlcy5CT09MRUFOX0ZBTFNFOiByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIGRlZmF1bHQ6IHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogR2l2ZW4gYSBUQ29tcGFjdFByb3RvY29sLlRDb21wYWN0VHlwZXMgY29uc3RhbnQsIGNvbnZlcnQgaXQgdG8gaXRzIGNvcnJlc3BvbmRpbmcKKyAgICAgKiBUVHlwZSB2YWx1ZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIGZ1bmN0aW9uIGdldFRUeXBlKCB0eXBlIDogSW50KSA6IEludCB7CisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgIC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UCAgICAgICAgICA9IDB4MDA7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIEJPT0xFQU5fVFJVRSAgPSAweDAxOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBCT09MRUFOX0ZBTFNFID0gMHgwMjsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgQllURSAgICAgICAgICA9IDB4MDM7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIEkxNiAgICAgICAgICAgPSAweDA0OworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBJMzIgICAgICAgICAgID0gMHgwNTsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgSTY0ICAgICAgICAgICA9IDB4MDY7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIERPVUJMRSAgICAgICAgPSAweDA3OworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBCSU5BUlkgICAgICAgID0gMHgwODsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgTElTVCAgICAgICAgICA9IDB4MDk7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIFNFVCAgICAgICAgICAgPSAweDBBOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBNQVAgICAgICAgICAgID0gMHgwQjsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgU1RSVUNUICAgICAgICA9IDB4MEM7Cit9CisKZGlmZiAtLWdpdCBhL2xpYi9oYXhlL3NyYy9vcmcvYXBhY2hlL3RocmlmdC9wcm90b2NvbC9URmllbGQuaHggYi9saWIvaGF4ZS9zcmMvb3JnL2FwYWNoZS90aHJpZnQvcHJvdG9jb2wvVEZpZWxkLmh4Cm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjNmNTQ5OGQKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvaGF4ZS9zcmMvb3JnL2F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pOworICAgICAgICB0aGlzLnJlYWRlciA9IG5ldyBMb29rYWhlYWRSZWFkZXIodGhpcyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGdldFRyYW5zcG9ydCgpIDogVFRyYW5zcG9ydCB7CisgICAgICByZXR1cm4gdHJhbnM7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWVzc2FnZUJlZ2luKG1lc3NhZ2U6VE1lc3NhZ2UpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkFycmF5U3RhcnQoKTsKKyAgICAgICAgV3JpdGVKU09OSW50ZWdlciggSlNPTkNvbnN0YW50cy5WRVJTSU9OKTsKKyAgICAgICAgV3JpdGVKU09OU3RyaW5nKCBCeXRlc0Zyb21TdHJpbmcobWVzc2FnZS5uYW1lKSk7CisgICAgICAgIFdyaXRlSlNPTkludGVnZXIoIG1lc3NhZ2UudHlwZSk7CisgICAgICAgIFdyaXRlSlNPTkludGVnZXIoIG1lc3NhZ2Uuc2VxaWQpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VFbmQoKSA6IFZvaWQgeworICAgICAgICBXcml0ZUpTT05BcnJheUVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cnVjdEJlZ2luKHN0cnVjdDpUU3RydWN0KSA6IFZvaWQgeworICAgICAgICBXcml0ZUpTT05PYmplY3RTdGFydCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cnVjdEVuZCgpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTk9iamVjdEVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUZpZWxkQmVnaW4oZmllbGQ6VEZpZWxkKSA6IFZvaWQgeworICAgICAgICBXcml0ZUpTT05JbnRlZ2VyKCBmaWVsZC5pZCApOworICAgICAgICBXcml0ZUpTT05PYmplY3R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mcoIEJ5dGVzRnJvbVN0cmluZyggSlNPTkNvbnN0YW50cy5HZXRUeXBlTmFtZUZvclR5cGVJRCggbGlzdC5lbGVtVHlwZSApKSk7CisgICAgICAgIFdyaXRlSlNPTkludGVnZXIoIGxpc3Quc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEVuZCgpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU2V0QmVnaW4oc2V0OlRTZXQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkFycmF5U3RhcnQoKTsKKyAgICAgICAgV3JpdGVKU09OU3RyaW5nKCBCeXRlc0Zyb21TdHJpbmcoIEpTT05Db25zdGFudHMuR2V0VHlwZU5hbWVGb3JUeXBlSUQoIHNldC5lbGVtVHlwZSkpKTsKKyAgICAgICAgV3JpdGVKU09OSW50ZWdlciggc2V0LnNpemUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEVuZCgpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlQm9vbChiIDogQm9vbCkgOiBWb2lkIHsKKyAgICAgICAgaWYoIGIpCisgICAgICAgICAgICBXcml0ZUpTT05JbnRlZ2VyKCAxKTsKKyAgICAgICAgZWxzZQorICAgICAgICAgICAgV3JpdGVKU09OSW50ZWdlciggMCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlQnl0ZShiIDogSW50KSA6IFZvaWQgeworICAgICAgICBXcml0ZUpTT05JbnRlZ2VyKCBiKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJMTYoaTE2IDogSW50KSA6IFZvaWQgeworICAgICAgICBXcml0ZUpTT05JbnRlZ2VyKCBpMTYpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkzMihpMzIgOiBJbnQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkludGVnZXIoIGkzMik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTY0KGk2NCA6IGhheGUuSW50NjQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkludDY0KCBpNjQpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZURvdWJsZShkdWI6RmxvYXQpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkRvdWJsZShkdWIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cmluZyhzdHIgOiBTdHJpbmcpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTlN0cmluZyggQnl0ZXNGcm9tU3RyaW5nKHN0cikpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJpbmFyeShiaW46Qnl0ZXMpIDogVm9pZCB7CisgICAgICAgIFdyaXRlSlNPTkJhc2U2NChiaW4pOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTWVzc2FnZUJlZ2luKCk6VE1lc3NhZ2UgeworICAgICAgICB2YXIgbWVzc2FnZSA6IFRNZXNzYWdlID0gbmV3IFRNZXNzYWdlKCk7CisgICAgICAgIFJlYWRKU09OQXJyYXlTdGFydCgpOworICAgICAgICBpZiAoUmVhZEpTT05JbnRlZ2VyKCkgIT0gSlNPTkNvbnN0YW50cy5WRVJTSU9OKQorICAgICAgICB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5CQURfVkVSU0lPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1lc3NhZ2UgY29udGFpbmVkIGJhZCB2ZXJzaW9uLiIpOworICAgICAgICB9CisKKyAgICAgICAgbWVzc2FnZS5uYW1lID0gUmVhZEpTT05TdHJpbmcoZmFsc2UpOworICAgICAgICBtZXNzYWdlLnR5cGUgPSBSZWFkSlNPTkludGVnZXIoKTsKKyAgICAgICAgbWVzc2FnZS5zZXFpZCA9IFJlYWRKU09OSW50ZWdlcigpOworICAgICAgICByZXR1cm4gbWVzc2FnZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1lc3NhZ2VFbmQoKSA6IFZvaWQgeworICAgICAgICBSZWFkSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJ1Y3RCZWdpbigpOlRTdHJ1Y3QgeworICAgICAgICBSZWFkSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgICAgIHJldHVybiBuZXcgVFN0cnVjdCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU3RydWN0RW5kKCkgOiBWb2lkIHsKKyAgICAgICAgUmVhZEpTT05PYmplY3RFbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEZpZWxkQmVnaW4oKSA6IFRGaWVsZCB7CisgICAgICAgIHZhciBmaWVsZCA6IFRGaWVsZCA9IG5ldyBURmllbGQoKTsKKyAgICAgICAgdmFyIGNoID0gcmVhZGVyLlBlZWsoKTsKKyAgICAgICAgaWYgKFN0cmluZ0Zyb21CeXRlcyhjaCkgPT0gSlNPTkNvbnN0YW50cy5SQlJBQ0UpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZpZWxkLnR5cGUgPSBUVHlwZS5TVE9QOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZmllbGQuaWQgPSBSZWFkSlNPTkludGVnZXIoKTsKKyAgICAgICAgICAgIFJlYWRKU09OT2JqZWN0U3RhcnQoKTsKKyAgICAgICAgICAgIGZpZWxkLnR5cGUgPSBK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HlwZU5hbWUoIFJlYWRKU09OU3RyaW5nKGZhbHNlKSk7CisgICAgICAgIHZhciBDb3VudCA6IEludCA9IFJlYWRKU09OSW50ZWdlcigpOworCisgICAgICAgIHZhciBsaXN0ID0gbmV3IFRMaXN0KCBFbGVtZW50VHlwZSwgQ291bnQpOworICAgICAgICByZXR1cm4gbGlzdDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZExpc3RFbmQoKSA6IFZvaWQgeworICAgICAgICBSZWFkSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTZXRCZWdpbigpIDogVFNldCB7CisgICAgICAgIFJlYWRKU09OQXJyYXlTdGFydCgpOworICAgICAgICB2YXIgRWxlbWVudFR5cGUgPSBKU09OQ29uc3RhbnRzLkdldFR5cGVJREZvclR5cGVOYW1lKCBSZWFkSlNPTlN0cmluZyhmYWxzZSkpOworICAgICAgICB2YXIgQ291bnQgOiBJbnQgPSBSZWFkSlNPTkludGVnZXIoKTsKKworICAgICAgICB2YXIgc2V0ID0gbmV3IFRTZXQoIEVsZW1lbnRUeXBlLCBDb3VudCk7CisgICAgICAgIHJldHVybiBzZXQ7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTZXRFbmQoKSA6IFZvaWQgeworICAgICAgICBSZWFkSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRCb29sKCkgOiBCb29sIHsKKyAgICAgICAgcmV0dXJuIChSZWFkSlNPTkludGVnZXIoKSAhPSAwKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEJ5dGUoKSA6IEludCB7CisgICAgICAgIHJldHVybiBSZWFkSlNPTkludGVnZXIoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEkxNigpIDogSW50IHsKKyAgICAgICAgcmV0dXJuIFJlYWRKU09OSW50ZWdlcigpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTMyKCkgOiBJbnQgeworICAgICAgICByZXR1cm4gUmVhZEpTT05JbnRlZ2VyKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJNjQoKSA6IGhheGUuSW50NjQgeworICAgICAgICByZXR1cm4gUmVhZEpTT05JbnQ2NCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRG91YmxlKCk6RmxvYXQgeworICAgICAgICByZXR1cm4gUmVhZEpTT05Eb3VibGUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFN0cmluZygpIDogU3RyaW5nIHsKKyAgICAgICAgcmV0dXJuIFJlYWRKU09OU3RyaW5nKGZhbHNlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEJpbmFyeSgpIDogQnl0ZXMgeworICAgICAgICByZXR1cm4gUmVhZEpTT05CYXNlNjQoKTsKKyAgICB9CisKKyAgICAvLyBQdXNoIGEgbmV3IEpTT04gY29udGV4dCBvbnRvIHRoZSBzdGFjay4KKyAgICBwcml2YXRlIGZ1bmN0aW9uICBQdXNoQ29udGV4dChjIDogSlNPTkJhc2VDb250ZXh0KSA6IFZvaWQgeworICAgICAgICBjb250ZXh0U3RhY2suYWRkKGNvbnRleHQpOworICAgICAgICBjb250ZXh0ID0gYzsKKyAgICB9CisKKyAgICAvLyBQb3AgdGhlIGxhc3QgSlNPTiBjb250ZXh0IG9mZiB0aGUgc3RhY2sKKyAgICBwcml2YXRlIGZ1bmN0aW9uICBQb3BDb250ZXh0KCkgOiBWb2lkIHsKKyAgICAgICAgY29udGV4dCA9IGNvbnRleHRTdGFjay5wb3AoKTsKKyAgICB9CisKKworICAgIC8vIFdyaXRlIHRoZSBieXRlcyBpbiBhcnJheSBidWYgYXMgYSBKU09OIGNoYXJhY3RlcnMsIGVzY2FwaW5nIGFzIG5lZWRlZAorICAgIHByaXZhdGUgZnVuY3Rpb24gV3JpdGVKU09OU3RyaW5nKCBiIDogQnl0ZXMpIDogVm9pZCB7CisgICAgICAgIGNvbnRleHQuV3JpdGUoKTsKKworICAgICAgICB2YXIgdG1wID0gQnl0ZXNGcm9tU3RyaW5nKCBKU09OQ29uc3RhbnRzLlFVT1RFKTsKKyAgICAgICAgdHJhbnMud3JpdGUoIHRtcCwgMCwgdG1wLmxlbmd0aCk7CisKKyAgICAgICAgZm9yIChpIGluIDAgLi4uIGIubGVuZ3RoKSB7CisgICAgICAgICAgICB2YXIgdmFsdWUgPSBiLmdldChpKTsKKworICAgICAgICAgICAgaWYgKCh2YWx1ZSAmIDB4MDBGRikgPj0gMHgzMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoU3RyaW5nLmZyb21DaGFyQ29kZSh2YWx1ZSkgPT0gSlNPTkNvbnN0YW50cy5CQUNLU0xBU0guY2hhckF0KDApKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdG1wID0gQnl0ZXNGcm9tU3RyaW5nKCBKU09OQ29uc3RhbnRzLkJBQ0tTTEFTSCArIEpTT05Db25zdGFudHMuQkFDS1NMQVNIKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnMud3JpdGUoIHRtcCwgMCwgdG1wLmxlbmd0aCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zLndyaXRlKCBiLCBpLCAxKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIG51bSA9IEpTT05Db25zdGFudHMuSlNPTl9DSEFSX1RBQkxFW3ZhbHVlXTsKKyAgICAgICAgICAgICAgICBpZiAobnVtID09IDEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0cmFucy53cml0ZSggYiwgaSwgMSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKG51bSA+IDEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2YXIgYnVmID0gbmV3IEJ5dGVzQnVmZmVyKCk7CisgICAgICAgICAgICAgICAgICAgIGJ1Zi5hZGRTdHJpbmcoIEpTT05Db25zdGFudHMuQkFDS1NMQVNIKTsKKyAgICAgICAgICAgICAgICAgICAgYnVmLmFkZEJ5dGUoIG51bSk7CisgICAgICAgICAgICAgICAgICAgIHRtcCA9IGJ1Zi5nZXRCeXRlcygpOworICAgICAgICAgICAgICAgICAgICB0cmFucy53cml0ZSggdG1wLCAwLCB0bXAubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGJ1ZiA9IG5ldyBCeXRlc0J1ZmZlcigpOworICAgICAgICAgICAgICAgICAgICBidWYuYWRkU3RyaW5nKCBKU09OQ29uc3RhbnRzLkVTQ1NFUSk7CisgICAgICAgICAgICAgICAgICAgIGJ1Zi5hZGRTdHJpbmcoIEhleENoYXIoICh2YWx1ZSAmIDB4RkYwMDAwMDApID4+IDEyKSk7CisgICAgICAgICAgICAgICAgICAgIGJ1Zi5hZGRTdHJpbmcoIEhleENoYXIoICh2YWx1ZSAmIDB4MDBGRjAwMDApID4+IDgpKTsKKyAgICAgICAgICAgICAgICAgICAgYnVmLmFkZFN0cmluZyggSGV4Q2hhciggKHZhbHVlICYgMHgwMDAwRkYwMCkgPj4gNCkpOworICAgICAgICAgICAgICAgICAgICBidWYuYWRkU3RyaW5nKCBIZXhDaGFyKCB2YWx1ZSAmIDB4MDAwMDAwRkYpKTsKKyAgICAgICAgICAgICAgICAgICAgdG1wID0gYnVmLmdldEJ5dGVzKCk7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zLndyaXRlKCB0bXAsIDAsIHRtcC5sZW5ndGgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHRtcCA9IEJ5dGVzRnJvbVN0cmluZyggSlNPTkNvbnN0YW50cy5RVU9URSk7CisgICAgICAgIHRyYW5zLndyaXRlKCB0bXAsIDAsIHRtcC5sZW5ndGgpOworICAgIH0KKworICAgIC8vIFdyaXRlIG91dCBudW1iZXIgYXMgYSBKU09OIHZhbHVlLiBJZiB0aGUgY29udGV4dCBkaWN0YXRlcyBzbywKKyAgICAvLyBpdCB3aWxsIGJlIHdyYXBwZWQgaW4gcXVvdGVzIHRvIG91dHB1dCBhcyBhIEpTT04gc3RyaW5nLgorICAgIHByaXZhdGUgZnVuY3Rpb24gV3JpdGVKU09OSW50ZWdlciggbnVtIDogSW50KSA6IFZvaWQgeworICAgICAgICBjb250ZXh0LldyaXRlKCk7CisKKyAgICAgICAgdmFyIHN0ciA6IFN0cmluZyA9ICIiOworICAgICAgICB2YXIgZXNjYXBlTnVtIDogQm9vbCA9IGNvbnRleHQuRXNjYXBlTnVtYmVycygpOworCisgICAgICAgIGlmIChlc2NhcGVOdW0pIHsKKyAgICAgICAgICAgIHN0ciArPSBKU09OQ29uc3RhbnRzLlFVT1RFOworICAgICAgICB9CisKKyAgICAgICAgc3RyICs9IFN0ZC5zdHJpbmcobnVtKTsKKworICAgICAgICBpZiAoZXNjYXBlTnVtKSB7CisgICAgICAgICAgICBzdHIgKz0gSlNPTkNvbnN0YW50cy5RVU9URTsKKyAgICAgICAgfQorCisgICAgICAgIHZhciB0bXAgPSBCeXRlc0Zyb21TdHJpbmcoIHN0cik7CisgICAgICAgIHRyYW5zLndyaXRlKCB0bXAsIDAsIHRtcC5sZW5ndGgpOworICAgIH0KKworICAgIC8vIFdyaXRlIG91dCBudW1iZXIgYXMgYSBKU09OIHZhbHVlLiBJZiB0aGUgY29udGV4dCBkaWN0YXRlcyBzbywKKyAgICAvLyBpdCB3aWxsIGJlIHdyYXBwZWQgaW4gcXVvdGVzIHRvIG91dHB1dCBhcyBhIEpTT04gc3RyaW5nLgorICAgIHByaXZhdGUgZnVuY3Rpb24gV3JpdGVKU09OSW50NjQoIG51bSA6IEludDY0KSA6IFZvaWQgeworICAgICAgICBjb250ZXh0LldyaXRlKCk7CisKKyAgICAgICAgdmFyIHN0ciA6IFN0cmluZyA9ICIiOworICAgICAgICB2YXIgZXNjYXBlTnVtIDogQm9vbCA9IGNvbnRleHQuRXNjYXBlTnVtYmVycygpOworCisgICAgICAgIGlmIChlc2NhcGVOdW0pIHsKKyAgICAgICAgICAgIHN0ciArPSBKU09OQ29uc3RhbnRzLlFVT1RFOworICAgICAgICB9CisKKyAgICAgICAgc3RyICs9IFN0ZC5zdHJpbmcobnVtKTsKKworICAgICAgICBpZiAoZXNjYXBlTnVtKSB7CisgICAgICAgICAgICBzdHIgKz0gSlNPTkNvbnN0YW50cy5RVU9URTsKKyAgICAgICAgfQorCisgICAgICAgIHZhciB0bXAgPSBCeXRlc0Zyb21TdHJpbmcoIHN0cik7CisgICAgICAgIHRyYW5zLndyaXRlKCB0bXAsIDAsIHRtcC5sZW5ndGgpOworICAgIH0KKworICAgIC8vIFdyaXRlIG91dCBhIGRvdWJsZSBhcyBhIEpTT04gdmFsdWUuIElmIGl0IGlzIE5hTiBvciBpbmZpbml0eSBvciBpZiB0aGUKKyAgICAvLyBjb250ZXh0IGRpY3RhdGVzIGVzY2FwaW5nLCBXcml0ZSBvdXQgYXMgSlNPTiBzdHJpbmcuCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBXcml0ZUpTT05Eb3VibGUobnVtIDogRmxvYXQpIDogVm9pZCB7CisgICAgICAgIGNvbnRleHQuV3JpdGUoKTsKKworCisgICAgICAgIHZhciBzcGVjaWFsIDogQm9vbCA9IGZhbHNlOworICAgICAgICB2YXIgcmVuZGVyZWQgOiBTdHJpbmcgPSAiIjsKKyAgICAgICAgaWYoIE1hdGguaXNOYU4obnVtKSkgeworICAgICAgICAgICAgc3BlY2lhbCA9IHRydWU7CisgICAgICAgICAgICByZW5kZXJlZCA9IEpTT05Db25zdGFudHMuRkxPQVRfSVNfTkFOOworICAgICAgICB9IGVsc2UgaWYgKCEgTWF0aC5pc0Zpbml0ZShudW0pKSB7CisgICAgICAgICAgICBzcGVjaWFsID0gdHJ1ZTsKKyAgICAgICAgICAgIGlmKCBudW0gPiAwKSB7CisgICAgICAgICAgICAgICAgcmVuZGVyZWQgPSBKU09OQ29uc3RhbnRzLkZMT0FUX0lTX1BPU19JTkY7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJlbmRlcmVkID0gSlNPTkNvbnN0YW50cy5GTE9BVF9JU19ORUdfSU5GOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmVuZGVyZWQgPSBTdGQuc3RyaW5nKG51bSk7ICAvLyBwbGFpbiBhbmQgc2ltcGxlIGZsb2F0IG51bWJlcgorICAgICAgICB9CisKKyAgICAgICAgLy8gY29tcG9zZSBvdXRwdXQKKyAgICAgICAgdmFyIGVzY2FwZU51bSA6IEJvb2wgPSBzcGVjaWFsIHx8IGNvbnRleHQuRXNjYXBlTnVtYmVycygpOworICAgICAgICB2YXIgc3RyIDogU3RyaW5nID0gIiI7CisgICAgICAgIGlmIChlc2NhcGVOdW0pIHsKKyAgICAgICAgICAgIHN0ciArPSBKU09OQ29uc3RhbnRzLlFVT1RFOworICAgICAgICB9CisgICAgICAgIHN0ciArPSByZW5kZXJlZDsKKyAgICAgICAgaWYgKGVzY2FwZU51bSkgeworICAgICAgICAgICAgc3RyICs9IEpTT05Db25zdGFudHMuUVVPVEU7CisgICAgICAgIH0KKworICAgICAgICB2YXIgdG1wID0gQnl0ZXNGcm9tU3RyaW5nKCBzdHIpOworICAgICAgICB0cmFucy53cml0ZSggdG1wLCAwLCB0bXAubGVuZ3RoKTsKKyAgICB9CisKKyAgICAvLyB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KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VuZXhwZWN0ZWQgY2hhcmFjdGVyOiAkY2gnKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIFJlYWQgaW4gYSBKU09OIHN0cmluZywgdW5lc2NhcGluZyBhcyBhcHByb3ByaWF0ZS4KKyAgICAvLyBTa2lwIFJlYWRpbmcgZnJvbSB0aGUgY29udGV4dCBpZiBza2lwQ29udGV4dCBpcyB0cnVlLgorICAgIHByaXZhdGUgZnVuY3Rpb24gUmVhZEpTT05TdHJpbmcoc2tpcENvbnRleHQgOiBCb29sKSA6IFN0cmluZworICAgIHsKKyAgICAgICAgaWYgKCFza2lwQ29udGV4dCkKKyAgICAgICAgeworICAgICAgICAgICAgY29udGV4dC5SZWFkKCk7CisgICAgICAgIH0KKworICAgICAgICB2YXIgYnVmZmVyIDogQnl0ZXNCdWZmZXIgPSBuZXcgQnl0ZXNCdWZmZXIoKTsKKworICAgICAgICBSZWFkSlNPTlN5bnRheENoYXIoIEpTT05Db25zdGFudHMuUVVPVEUpOworICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGNoID0gcmVhZGVyLlJlYWQoKTsKKworICAgICAgICAgICAgLy8gZW5kIG9mIHN0cmluZz8KKyAgICAgICAgICAgIGlmIChTdHJpbmdGcm9tQnl0ZXMoY2gpID09IEpTT05Db25zdGFudHMuUVVPVEUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGVzY2FwZWQ/CisgICAgICAgICAgICBpZiAoU3RyaW5nRnJvbUJ5dGVzKGNoKSAhPSBKU09OQ29uc3RhbnRzLkVTQ1NFUS5jaGFyQXQoMCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYnVmZmVyLmFkZEJ5dGUoIGNoLmdldCgwKSk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGRpc3Rpbmd1aXNoIGJldHdlZW4gXHVYWFhYIChoZXggdW5pY29kZSkgYW5kIFxYIChjb250cm9sIGNoYXJzKQorICAgICAgICAgICAgY2ggPSByZWFkZXIuUmVhZCgpOworICAgICAgICAgICAgaWYgKFN0cmluZ0Zyb21CeXRlcyhjaCkgIT0gSlNPTkNvbnN0YW50cy5FU0NTRVEuY2hhckF0KDEpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9IEpTT05Db25zdGFudHMuRVNDQVBFX0NIQVJTX1RPX1ZBTFVFU1tjaC5nZXQoMCldOworICAgICAgICAgICAgICAgIGlmKCB2YWx1ZSA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbiggVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIkV4cGVjdGVkIGNvbnRyb2wgY2hhciIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBidWZmZXIuYWRkQnl0ZSggdmFsdWUpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisKKyAgICAgICAgICAgIC8vIGl0J3MgXHVYWFhYCisgICAgICAgICAgICB2YXIgaGV4YnVmID0gbmV3IEJ5dGVzQnVmZmVyKCk7CisgICAgICAgICAgICB2YXIgaGV4bGVuID0gdHJhbnMucmVhZEFsbCggaGV4YnVmLCAwLCA0KTsKKyAgICAgICAgICAgIGlmKCBoZXhsZW4gIT0gNCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCBUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiTm90IGVub3VnaCBkYXRhIGZvciBcXHVOTk5OIHNlcXVlbmNlIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBoZXhkaWdpdHMgPSBoZXhidWYuZ2V0Qnl0ZXMoKTsKKyAgICAgICAgICAgIHZhciBjaGFyY29kZSA9IDA7CisgICAgICAgICAgICBjaGFyY29kZSA9IChjaGFyY29kZSA8PCA0KSArIEhleFZhbCggU3RyaW5nLmZyb21DaGFyQ29kZShoZXhkaWdpdHMuZ2V0KDApKSk7CisgICAgICAgICAgICBjaGFyY29kZSA9IChjaGFyY29kZSA8PCA0KSArIEhleFZhbCggU3RyaW5nLmZyb21DaGFyQ29kZShoZXhkaWdpdHMuZ2V0KDEpKSk7CisgICAgICAgICAgICBjaGFyY29kZSA9IChjaGFyY29kZSA8PCA0KSArIEhleFZhbCggU3RyaW5nLmZyb21DaGFyQ29kZShoZXhkaWdpdHMuZ2V0KDIpKSk7CisgICAgICAgICAgICBjaGFyY29kZSA9IChjaGFyY29kZSA8PCA0KSArIEhleFZhbCggU3RyaW5nLmZyb21DaGFyQ29kZShoZXhkaWdpdHMuZ2V0KDMpKSk7CisgICAgICAgICAgICBidWZmZXIuYWRkU3RyaW5nKCBTdHJpbmcuZnJvbUNoYXJDb2RlKGNoYXJjb2RlKSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gU3RyaW5nRnJvbUJ5dGVzKCBidWZmZXIuZ2V0Qnl0ZXMoKSk7CisgICAgfQorCisgICAgLy8gUmV0dXJuIHRydWUgaWYgdGhlIGdpdmVuIGJ5dGUgY291bGQgYmUgYSB2YWxpZCBwYXJ0IG9mIGEgSlNPTiBudW1iZXIuCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBJc0pTT05OdW1lcmljKGIgOiBJbnQpIDogQm9vbCB7CisgICAgICAgIHN3aXRjaCAoYikKKyAgICAgICAgeworICAgICAgICAgICAgY2FzZSAiKyIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiLSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiLiIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiMCIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiMSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiMiIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiMyIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiNCIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiNSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiNiIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiNyIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiOCIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiOSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiRSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSAiZSIuY29kZTogIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvLyBSZWFkIGluIGEgc2VxdWVuY2Ugb2YgY2hhcmFjdGVycyB0aGF0IGFyZSBhbGwgdmFsaWQgaW4gSlNPTiBudW1iZXJzLiBEb2VzCisgICAgLy8gbm90IGRvIGEgY29tcGxldGUgcmVnZXggY2hlY2sgdG8gdmFsaWRhdGUgdGhhdCB0aGlzIGlzIGFjdHVhbGx5IGEgbnVtYmVyLgorICAgIHByaXZhdGUgZnVuY3Rpb24gUmVhZEpTT05OdW1lcmljQ2hhcnMoKSA6IFN0cmluZworICAgIHsKKyAgICAgICAgdmFyIGJ1ZmZlciA6IEJ5dGVzQnVmZmVyID0gbmV3IEJ5dGVzQnVmZmVyKCk7CisgICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgY2ggPSByZWFkZXIuUGVlaygpOworICAgICAgICAgICAgaWYoICEgSXNKU09OTnVtZXJpYyggY2guZ2V0KDApKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJ1ZmZlci5hZGRCeXRlKCByZWFkZXIuUmVhZCgpLmdldCgwKSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIFN0cmluZ0Zyb21CeXRlcyggYnVmZmVyLmdldEJ5dGVzKCkpOworICAgIH0KKworICAgIC8vIFJlYWQgaW4gYSBKU09OIG51bWJlci4gSWYgdGhlIGNvbnRleHQgZGljdGF0ZXMsIFJlYWQgaW4gZW5jbG9zaW5nIHF1b3Rlcy4KKyAgICBwcml2YXRlIGZ1bmN0aW9uIFJlYWRKU09OSW50ZWdlcigpIDogSW50IHsKKyAgICAgICAgY29udGV4dC5SZWFkKCk7CisKKyAgICAgICAgaWYgKGNvbnRleHQuRXNjYXBlTnVtYmVycygpKSB7CisgICAgICAgICAgICBSZWFkSlNPTlN5bnRheENoYXIoIEpTT05Db25zdGFudHMuUVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHN0ciA6IFN0cmluZyA9IFJlYWRKU09OTnVtZXJpY0NoYXJzKCk7CisKKyAgICAgICAgaWYgKGNvbnRleHQuRXNjYXBlTnVtYmVycygpKSB7CisgICAgICAgICAgICBSZWFkSlNPTlN5bnRheENoYXIoIEpTT05Db25zdGFudHMuUVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHZhbHVlID0gU3RkLnBhcnNlSW50KHN0cik7CisgICAgICAgIGlmKCB2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsICdCYWQgbnVtZXJpYyBkYXRhOiAkc3RyJyk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gdmFsdWU7CisgICAgfQorCisgICAgLy8gUmVhZCBpbiBhIEpTT04gbnVtYmVyLiBJZiB0aGUgY29udGV4dCBkaWN0YXRlcywgUmVhZCBpbiBlbmNsb3NpbmcgcXVvdGVzLgorICAgIHByaXZhdGUgZnVuY3Rpb24gUmVhZEpTT05JbnQ2NCgpIDogaGF4ZS5JbnQ2NCB7CisgICAgICAgIGNvbnRleHQuUmVhZCgpOworCisgICAgICAgIGlmIChjb250ZXh0LkVzY2FwZU51bWJlcnMoKSkgeworICAgICAgICAgICAgUmVhZEpTT05TeW50YXhDaGFyKCBKU09OQ29uc3RhbnRzLlFVT1RFKTsKKyAgICAgICAgfQorCisgICAgICAgIHZhciBzdHIgOiBTdHJpbmcgPSBSZWFkSlNPTk51bWVyaWNDaGFycygpOworICAgICAgICBpZiggc3RyLmxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsICdCYWQgbnVtZXJpYyBkYXRhOiAkc3RyJyk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoY29udGV4dC5Fc2NhcGVOdW1iZXJzKCkpIHsKKyAgICAgICAgICAgIFJlYWRKU09OU3ludGF4Q2hhciggSlNPTkNvbnN0YW50cy5RVU9URSk7CisgICAgICAgIH0KKworICAgICAgICAvLyBwcm9jZXNzIHNpZ24KKyAgICAgICAgdmFyIGJNaW51cyA9IGZhbHNlOworICAgICAgICB2YXIgc3RhcnRBdCA9IDA7CisgICAgICAgIGlmKCAoc3RyLmNoYXJBdCgwKSA9PSAiKyIpIHx8IChzdHIuY2hhckF0KDApID09ICItIikpIHsKKyAgICAgICAgICAgIGJNaW51cyA9IChzdHIuY2hhckF0KDApID09ICItIik7CisgICAgICAgICAgICBzdGFydEF0Kys7CisgICAgICAgIH0KKworICAgICAgICAvLyBwcm9jZXNzIGRp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TWludXMgPSBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmKCAhIGJHb3REaWdpdHMpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgJ0JhZCBudW1lcmljIGRhdGE6ICRzdHInKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICAvLyBSZWFkIGluIGEgSlNPTiBkb3VibGUgdmFsdWUuIFRocm93IGlmIHRoZSB2YWx1ZSBpcyBub3Qgd3JhcHBlZCBpbiBxdW90ZXMKKyAgICAvLyB3aGVuIGV4cGVjdGVkIG9yIGlmIHdyYXBwZWQgaW4gcXVvdGVzIHdoZW4gbm90IGV4cGVjdGVkLgorICAgIHByaXZhdGUgZnVuY3Rpb24gUmVhZEpTT05Eb3VibGUoKSA6IEZsb2F0IHsKKyAgICAgICAgY29udGV4dC5SZWFkKCk7CisKKyAgICAgICAgdmFyIHN0ciA6IFN0cmluZyA9ICIiOworICAgICAgICBpZiAoU3RyaW5nRnJvbUJ5dGVzKHJlYWRlci5QZWVrKCkpID09IEpTT05Db25zdGFudHMuUVVPVEUpIHsKKyAgICAgICAgICAgIHN0ciA9IFJlYWRKU09OU3RyaW5nKHRydWUpOworCisgICAgICAgICAgICAvLyBzcGVjaWFsIGNhc2VzCisgICAgICAgICAgICBpZiggc3RyID09IEpTT05Db25zdGFudHMuRkxPQVRfSVNfTkFOKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGguTmFOOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYoIHN0ciA9PSBKU09OQ29uc3RhbnRzLkZMT0FUX0lTX1BPU19JTkYpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5QT1NJVElWRV9JTkZJTklUWTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKCBzdHIgPT0gSlNPTkNvbnN0YW50cy5GTE9BVF9JU19ORUdfSU5GKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGguTkVHQVRJVkVfSU5GSU5JVFk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmKCAhIGNvbnRleHQuRXNjYXBlTnVtYmVycygpKSAgICB7CisgICAgICAgICAgICAgICAgLy8gdGhyb3cgLSB3ZSBzaG91bGQgbm90IGJlIGluIGEgc3RyaW5nIGluIHRoaXMgY2FzZQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIk51bWVyaWMgZGF0YSB1bmV4cGVjdGVkbHkgcXVvdGVkIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBpZiggY29udGV4dC5Fc2NhcGVOdW1iZXJzKCkpICAgIHsKKyAgICAgICAgICAgICAgICAvLyBUaGlzIHdpbGwgdGhyb3cgLSB3ZSBzaG91bGQgaGF2ZSBoYWQgYSBxdW90ZSBpZiBFc2NhcGVOdW1iZXJzKCkgPT0gdHJ1ZQorICAgICAgICAgICAgICAgIFJlYWRKU09OU3ludGF4Q2hhciggSlNPTkNvbnN0YW50cy5RVU9URSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0ciA9IFJlYWRKU09OTnVtZXJpY0NoYXJzKCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBwYXJzZSBhbmQgY2hlY2sgLSB3ZSBzaG91bGQgaGF2ZSBhdCBsZWFzdCBvbmUgdmFsaWQgZGlnaXQKKyAgICAgICAgdmFyIGR1YiA9IFN0ZC5wYXJzZUZsb2F0KCBzdHIpOworICAgICAgICBpZiggKHN0ci5sZW5ndGggPT0gMCkgfHwgTWF0aC5pc05hTihkdWIpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsICdCYWQgbnVtZXJpYyBkYXRhOiAkc3RyJyk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZHViOworICAgIH0KKworICAgIC8vIFJlYWQgaW4gYSBKU09OIHN0cmluZyBjb250YWluaW5nIGJhc2UtNjQgZW5jb2RlZCBkYXRhIGFuZCBkZWNvZGUgaXQuCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBSZWFkSlNPTkJhc2U2NCgpIDogQnl0ZXMKKyAgICB7CisgICAgICAgIHZhciBzdHIgPSBSZWFkSlNPTlN0cmluZyhmYWxzZSk7CisgICAgICAgIHJldHVybiBCYXNlNjQuZGVjb2RlKCBzdHIpOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gUmVhZEpTT05PYmplY3RTdGFydCgpIDogVm9pZCB7CisgICAgICAgIGNvbnRleHQuUmVhZCgpOworICAgICAgICBSZWFkSlNPTlN5bnRheENoYXIoIEpTT05Db25zdGFudHMuTEJSQUNFKTsKKyAgICAgICAgUHVzaENvbnRleHQobmV3IEpTT05QYWlyQ29udGV4dCh0aGlzKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBSZWFkSlNPTk9iamVjdEVuZCgpIDogVm9pZCB7CisgICAgICAgIFJlYWRKU09OU3ludGF4Q2hhciggSlNPTkNvbnN0YW50cy5SQlJBQ0UpOworICAgICAgICBQb3BDb250ZXh0KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBSZWFkSlNPTkFycmF5U3RhcnQoKSA6IFZvaWQgeworICAgICAgICBjb250ZXh0LlJlYWQoKTsKKyAgICAgICAgUmVhZEpTT05TeW50YXhDaGFyKCBKU09OQ29uc3RhbnRzLkxCUkFDS0VUKTsKKyAgICAgICAgUHVzaENvbnRleHQobmV3IEpTT05MaXN0Q29udGV4dCh0aGlzKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5j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MganVzdCBmaW5lCisgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHJldHVybiBVdGY4LmRlY29kZSggc3RyKTsKKyAgICB9CisKKyAgICAvLyBDb252ZXJ0IGEgYnl0ZSBjb250YWluaW5nIGEgaGV4IGNoYXIgKCcwJy0nOScgb3IgJ2EnLSdmJykgaW50byBpdHMgY29ycmVzcG9uZGluZyBoZXggdmFsdWUKKyAgICBwcml2YXRlIHN0YXRpYyBmdW5jdGlvbiBIZXhWYWwoY2hhciA6IFN0cmluZykgOiBJbnQgeworICAgICAgICB2YXIgdmFsdWUgPSBKU09OQ29uc3RhbnRzLkhFWF9ESUdJVFNbY2hhcl07CisgICAgICAgIGlmKCB2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsICdFeHBlY3RlZCBoZXggY2hhcmFjdGVyOiAkY2hhcicpOworICAgICAgICB9CisgICAgICAgIHJldHVybiB2YWx1ZTsKKyAgICB9CisKKyAgICAvLyBDb252ZXJ0IGEgYnl0ZSBjb250YWluaW5nIGEgaGV4IG5pYmJsZSB0byBpdHMgY29ycmVzcG9uZGluZyBoZXggY2hhcmFjdGVyCisgICAgcHJpdmF0ZSBzdGF0aWMgZnVuY3Rpb24gSGV4Q2hhcihuaWJibGUgOiBJbnQpIDogU3RyaW5nCisgICAgeworICAgICAgICByZXR1cm4gIjAxMjM0NTY3ODlhYmNkZWYiLmNoYXJBdChuaWJibGUgJiAweDBGKTsKKyAgICB9CisKKworfQorCisKK0A6YWxsb3coVEpTT05Qcm90b2NvbCkKK2NsYXNzIEpTT05Db25zdGFudHMgeworICAgIHB1YmxpYyBzdGF0aWMgdmFyIENPTU1BID0gIiwiOworICAgIHB1YmxpYyBzdGF0aWMgdmFyIENPTE9OID0gIjoiOworICAgIHB1YmxpYyBzdGF0aWMgdmFyIExCUkFDRSA9ICJ7Ijs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KyAgICBwdWJsaWMgc3RhdGljIHZhciBFU0NBUEVfQ0hBUlNfVE9fVkFMVUVTID0gWworICAgICAgICAiXCIiLmNvZGUgPT4gMHgyMiwKKyAgICAgICAgIlxcIi5jb2RlID0+IDB4NUMsCisgICAgICAgICIvIi5jb2RlICA9PiAweDJGLAorICAgICAgICAiYiIuY29kZSAgPT4gMHgwOCwKKyAgICAgICAgImYiLmNvZGUgID0+IDB4MEMsCisgICAgICAgICJuIi5jb2RlICA9PiAweDBBLAorICAgICAgICAiciIuY29kZSAgPT4gMHgwRCwKKyAgICAgICAgInQiLmNvZGUgID0+IDB4MDkKKyAgICBdOworCisgICAgcHVibGljIHN0YXRpYyB2YXIgREVDSU1BTF9ESUdJVFMgPSBbCisgICAgICAgICIwIiA9PiAwLAorICAgICAgICAiMSIgPT4gMSwKKyAgICAgICAgIjIiID0+IDIsCisgICAgICAgICIzIiA9PiAzLAorICAgICAgICAiNCIgPT4gNCwKKyAgICAgICAgIjUiID0+IDUsCisgICAgICAgICI2IiA9PiA2LAorICAgICAgICAiNyIgPT4gNywKKyAgICAgICAgIjgiID0+IDgsCisgICAgICAgICI5IiA9PiA5CisgICAgXTsKKworICAgIHB1YmxpYyBzdGF0aWMgdmFyIEhFWF9ESUdJVFMgPSBbCisgICAgICAgICIwIiA9PiAwLAorICAgICAgICAiMSIgPT4gMSwKKyAgICAgICAgIjIiID0+IDIsCisgICAgICAgICIzIiA9PiAzLAorICAgICAgICAiNCIgPT4gNCwKKyAgICAgICAgIjUiID0+IDUsCisgICAgICAgICI2IiA9PiA2LAorICAgICAgICAiNyIgPT4gNywKKyAgICAgICAgIjgiID0+IDgsCisgICAgICAgICI5IiA9PiA5LAorICAgICAgICAiQSIgPT4gMTAsCisgICAgICAgICJhIiA9PiAxMCwKKyAgICAgICAgIkIiID0+IDExLAorICAgICAgICAiYiIgPT4gMTEsCisgICAgICAgICJDIiA9PiAxMiwKKyAgICAgICAgImMiID0+IDEyLAorICAgICAgICAiRCIgPT4gMTMsCisgICAgICAgICJkIiA9PiAxMywKKyAgICAgICAgIkUiID0+IDE0LAorICAgICAgICAiZSIgPT4gMTQsCisgICAgICAgICJGIiA9PiAxNSwKKyAgICAgICAgImYiID0+IDE1CisgICAgXTsKKworCisgICAgcHVibGljIHN0YXRpYyB2YXIgREVGX1NUUklOR19TSVpFID0gMTY7CisKKyAgICBwdWJsaWMgc3RhdGljIHZhciBOQU1FX0JPT0wgICA9ICd0Zic7CisgICAgcHVibGljIHN0YXRpYyB2YXIgTkFNRV9CWVRFICAgPSAnaTgnOworICAgIHB1YmxpYyBzdGF0aWMgdmFyIE5BTUVfSTE2ICAgID0gJ2kxNic7CisgICAgcHVibGljIHN0YXRpYyB2YXIgTkFNRV9JMzIgICAgPSAnaTMyJzsKKyAgICBwdWJsaWMgc3RhdGljIHZhciBOQU1FX0k2NCAgICA9ICdpNjQnOworICAgIHB1YmxpYyBzdGF0aWMgdmFyIE5BTUVfRE9VQkxFID0gJ2RibCc7CisgICAgcHVibGljIHN0YXRpYyB2YXIgTkFNRV9TVFJVQ1QgPSAncmVjJzsKKyAgICBwdWJsaWMgc3RhdGljIHZhciBOQU1FX1NUUklORyA9ICdzdHInOworICAgIHB1YmxpYyBzdGF0aWMgdmFyIE5BTUVfTUFQICAgID0gJ21hcCc7CisgICAgcHVibGljIHN0YXRpYyB2YXIgTkFNRV9MSVNUICAgPSAnbHN0JzsKKyAgICBwdWJsaWMgc3RhdGljIHZhciBOQU1FX1NFVCAgICA9ICdzZXQnOworCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBHZXRUeXBlTmFtZUZvclR5cGVJRCh0eXBlSUQgOiBJbnQpIDogU3RyaW5nIHsKKyAgICAgICAgc3dpdGNoICh0eXBlSUQpCisgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgVFR5cGUuQk9PTDogICAgIHJldHVybiBOQU1FX0JPT0w7CisgICAgICAgICAgICBjYXNlIFRUeXBlLkJZVEU6ICAgICByZXR1cm4gTkFNRV9CWVRFOworICAgICAgICAgICAgY2FzZSBUVHlwZS5JMTY6ICAgICAgICAgcmV0dXJuIE5BTUVfSTE2OworICAgICAgICAgICAgY2FzZSBUVHlwZS5JMzI6ICAgICAgICAgcmV0dXJuIE5BTUVfSTMyOworICAgICAgICAgICAgY2FzZSBUVHlwZS5JNjQ6ICAgICAgICAgcmV0dXJuIE5BTUVfSTY0OworICAgICAgICAgICAgY2FzZSBUVHlwZS5ET1VCTEU6ICAgICByZXR1cm4gTkFNRV9ET1VCTEU7CisgICAgICAgICAgICBjYXNlIFRUeXBlLlNUUklORzogICAgIHJldHVybiBOQU1FX1NUUklORzsKKyAgICAgICAgICAgIGNhc2UgVFR5cGUuU1RSVUNUOiAgICAgcmV0dXJuIE5BTUVfU1RSVUNUOworICAgICAgICAgICAgY2FzZSBUVHlwZS5NQVA6ICAgICAgICAgcmV0dXJuIE5BTUVfTUFQOworICAgICAgICAgICAgY2FzZSBUVHlwZS5TRVQ6ICAgICAgICAgcmV0dXJuIE5BTUVfU0VUOworICAgICAgICAgICAgY2FzZSBUVHlwZS5MSVNUOiAgICAgcmV0dXJuIE5BTUVfTElTVDsKKyAgICAgICAgfQorICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsICJVbnJlY29nbml6ZWQgdHlwZSIpOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIHZhciBOQU1FU19UT19UWVBFUyA9IFsKKyAgICAgICAgTkFNRV9CT09MICAgPT4gVFR5cGUuQk9PTCwKKyAgICAgICAgTkFNRV9CWVRFICAgPT4gVFR5cGUuQllURSwKKyAgICAgICAgTkFNRV9JMTYgICAgPT4gVFR5cGUuSTE2LAorICAgICAgICBOQU1FX0kzMiAgICA9PiBUVHlwZS5JMzIsCisgICAgICAgIE5BTUVfSTY0ICAgID0+IFRUeXBlLkk2NCwKKyAgICAgICAgTkFNRV9ET1VCTEUgPT4gVFR5cGUuRE9VQkxFLAorICAgICAgICBOQU1FX1NUUklORyA9PiBUVHlwZS5TVFJJTkcsCisgICAgICAgIE5BTUVfU1RSVUNUID0+IFRUeXBlLlNUUlVDVCwKKyAgICAgICAgTkFNRV9NQVAgICAgPT4gVFR5cGUuTUFQLAorICAgICAgICBOQU1FX1NFVCAgICA9PiBUVHlwZS5TRVQsCisgICAgICAgIE5BTUVfTElTVCAgID0+IFRUeXBlLkxJU1QKKyAgICBdOworCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBHZXRUeXBlSURGb3JUeXBlTmFtZShuYW1lIDogU3RyaW5nKSA6IEludAorICAgIHsKKyAgICAgICAgdmFyIHR5cGUgPSBOQU1FU19UT19UWVBFU1tuYW1lXTsKKyAgICAgICAgaWYoIG51bGwgIT0gdHlwZSkgeworICAgICAgICAgICAgcmV0dXJuIHR5cGU7CisgICAgICAgIH0KKyAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uTk9UX0lNUExFTUVOVEVELCAiVW5yZWNvZ25pemVkIHR5cGUiKTsKKyAgICB9CisKK30KKworCisvLyBCYXNlIGNsYXNzIGZvciB0cmFja2luZyBKU09OIGNvbnRleHRzIHRoYXQgbWF5IHJlcXVpcmUgaW5zZXJ0aW5nL1JlYWRpbmcKKy8vIGFkZGl0aW9uYWwgSlNPTiBzeW50YXggY2hhcmFjdGVycy4gVGhpcyBiYXNlIGNvbnRleHQgZG9lcyBub3RoaW5nLgorQDphbGxvdyhUSlNPTlByb3RvY29sKQorY2xhc3MgSlNPTkJhc2VDb250ZXh0Cit7CisgICAgcHJpdmF0ZSB2YXIgcHJvdG8gOiBUSlNPTlByb3RvY29sOworCisgICAgcHVibGljIGZ1bmN0aW9uIG5ldyhwcm90byA6IFRKU09OUHJvdG9jb2wgKQorICAgIHsKKyAgICAgICAgdGhpcy5wcm90byA9IHByb3RvOworICAgIH0KKworICAgIHB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CisgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgeworICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHByb3RvLlJlYWRKU09OU3ludGF4Q2hhciggSlNPTkNvbnN0YW50cy5DT01NQSk7CisgICAgICAgIH0KKyAgICB9Cit9CisKKworLy8gQ29udGV4dCBmb3IgSlNPTiByZWNvcmRzLgorLy8gV2lsbCBpbnNlcnQvUmVhZCBjb2xvbnMgYmVmb3JlIHRoZSB2YWx1ZSBwb3J0aW9uIG9mIGVhY2ggcmVjb3JkCisvLyBwYWlyLCBhbmQgY29tbWFzIGJlZm9yZSBlYWNoIGtleSBleGNlcHQgdGhlIGZpcnN0LiBJbiBhZGRpdGlvbiwKKy8vIHdpbGwgaW5kaWNhdGUgdGhhdCBudW1iZXJzIGluIHRoZSBrZXkgcG9zaXRpb24gbmVlZCB0byBiZSBlc2NhcGVkCisvLyBpbiBxdW90ZXMgKHNpbmNlIEpTT04ga2V5cyBtdXN0IGJlIHN0cmluZ3MpLgorQDphbGxvdyhUSlNPTlByb3RvY29sKQorY2xhc3MgSlNPTlBhaXJDb250ZXh0IGV4dGVuZHMgSlNPTkJhc2VDb250ZXh0Cit7CisgICAgcHVibGljIGZ1bmN0aW9uIG5ldyggcHJvdG8gOiBUSlNPTlByb3RvY29sICkgeworICAgICAgICBzdXBlciggcHJvdG8pOworICAgIH0KKworICAgIHByaXZhdGUgdmFyIGZpcnN0IDogQm9vbCA9IHRydWU7CisgICAgcHJpdmF0ZSB2YXIgY29sb24gOiBCb29sICA9IHRydWU7CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gV3JpdGUoKSA6IFZvaWQgeworICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICBjb2xvbiA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgYnVmID0gbmV3IEJ5dGVzQnVmZmVyKCk7CisgICAgICAgICAgICBidWYuYWRkU3RyaW5nKCBjb2xvbiA/IEpTT05Db25zdGFudHMuQ09MT04gOiBKU09OQ29uc3RhbnRzLkNPTU1BKTsKKyAgICAgICAgICAgIHZhciB0bXAgPSBidWYuZ2V0Qnl0ZXMoKTsKKyAgICAgICAgICAgIHByb3RvLnRyYW5zLndyaXRlKCB0bXAsIDAsIHRtcC5sZW5ndGgpOworICAgICAgICAgICAgY29sb24gPSAhY29sb247CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gUmVhZCgpIDogVm9pZCB7CisgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgeworICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgIGNvbG9uID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHByb3RvLlJlYWRKU09OU3ludGF4Q2hhciggY29sb24gPyBKU09OQ29uc3RhbnRzLkNPTE9OIDogSlNPTkNvbnN0YW50cy5DT01NQSk7CisgICAgICAgICAgICBjb2xvbiA9ICFjb2xvbjsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBFc2NhcGVOdW1iZXJzKCkgOiBCb29sCisgICAgeworICAgICAgICByZXR1cm4gY29sb247CisgICAgfQorfQorCisvLyBIb2xkcyB1cCB0byBvbmUgYnl0ZSBmcm9tIHRoZSB0cmFuc3BvcnQKK0A6YWxsb3coVEpTT05Qcm90b2NvbCkKK2NsYXNzIExvb2thaGVhZFJlYWRlciB7CisKKyAgICBwcml2YXRlIHZhciBwcm90byA6IFRKU09OUHJvdG9jb2w7CisgICAgcHJpdmF0ZSB2YXIgZGF0YSA6IEJ5dGVzOworCisgIC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oZSBzZXJ2aWNlIG5hbWUKKyAgICAgICAgdmFyIGFjdHVhbFByb2Nlc3NvciA6IFRQcm9jZXNzb3IgPSBudWxsOworICAgICAgICB2YXIgaW5kZXggPSBtZXNzYWdlLm5hbWUuaW5kZXhPZihUTXVsdGlwbGV4ZWRQcm90b2NvbC5TRVBBUkFUT1IpOworICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgICAgICAgICAvLyBmYWxsYmFjayB0byBkZWZhdWx0IHByb2Nlc3NvcgorICAgICAgICAgICAgbWV0aG9kTmFtZSA9IG1lc3NhZ2UubmFtZTsKKyAgICAgICAgICAgIGFjdHVhbFByb2Nlc3NvciA9IGRlZmF1bHRQcm9jZXNzb3I7CisgICAgICAgICAgICBpZiggYWN0dWFsUHJvY2Vzc29yID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBGYWlsKG9wcm90LCBtZXNzYWdlLAorICAgICAgICAgICAgICAgICAgICAgIFRBcHBsaWNhdGlvbkV4Y2VwdGlvbi5JTlZBTElEX1BST1RPQ09MLAorICAgICAgICAgICAgICAgICAgICAgICJTZXJ2aWNlIG5hbWUgbm90IGZvdW5kIGluIG1lc3NhZ2UgbmFtZTogIiArIG1lc3NhZ2UubmFtZSArICIgYW5kIG5vIGRlZmF1bHQgcHJvY2Vzc29yIGRlZmluZWQuICIgKworICAgICAgICAgICAgICAgICAgICAgICJEaWQgeW91IGZvcmdldCB0byB1c2UgYSBUTXVsdGlwbGV4UHJvdG9jb2wgaW4geW91ciBjbGllbnQ/Iik7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorCisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBzZXJ2aWNlIG5hbWUgZ2l2ZW4KKyAgICAgICAgICAgIHZhciBzZXJ2aWNlTmFtZSA9IG1lc3NhZ2UubmFtZS5zdWJzdHJpbmcoMCwgaW5kZXgpOworICAgICAgICAgICAgbWV0aG9kTmFtZSA9IG1lc3Nh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yIHNvIHRoYXQgdGhlIG11bHRpcGxleGluZyBzZXJ2ZXIgY2FuIGJyb2tlcgorICAgICAqIHRoZSBmdW5jdGlvbiBjYWxsIHRvIHRoZSBwcm9wZXIgc2VydmljZS4KKyAgICAgKgorICAgICAqIEFyZ3M6CisgICAgICogIHByb3RvY29sICAgICAgICBZb3VyIGNvbW11bmljYXRpb24gcHJvdG9jb2wgb2YgY2hvaWNlLCBlLmcuIFRCaW5hcnlQcm90b2NvbAorICAgICAqICBzZXJ2aWNlTmFtZSAgICAgVGhlIHNlcnZpY2UgbmFtZSBvZiB0aGUgc2VydmljZSBjb21tdW5pY2F0aW5nIHZpYSB0aGlzIHByb3RvY29sLgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIHByb3RvY29sIDogVFByb3RvY29sLCBzZXJ2aWNlTmFtZSA6IFN0cmluZykgICAgeworICAgICAgICBzdXBlciggcHJvdG9jb2wpOworICAgICAgICBzZXJ2aWNlID0gc2VydmljZU5hbWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogUHJlcGVuZHMgdGhlIHNlcnZpY2UgbmFtZSB0byB0aGUgZnVuY3Rpb24gbmFtZSwgc2VwYXJhdGVkIGJ5IFRNdWx0aXBsZXhlZFByb3RvY29sLlNFUEFSQVRPUi4KKyAgICAgKiBBcmdzOgorICAgICAqICAgdE1lc3NhZ2UgICAgIFRoZSBvcmlnaW5hbCBtZXNzYWdlLgorICAgICAqLworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VCZWdpbiggbWVzc2FnZSA6IFRNZXNzYWdlKSA6IFZvaWQgeworICAgICAgICBzd2l0Y2goIG1lc3NhZ2UudHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgY2FzZSBUTWVzc2FnZVR5cGUuQ0FMTDoKKyAgICAgICAgICAgICAgICBzdXBlci53cml0ZU1lc3NhZ2VCZWdpbihuZXcgVE1lc3NhZ2UoCisgICAgICAgICAgICA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W5jcmVtZW50UmVjdXJzaW9uRGVwdGgoKTsKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuQk9PTDoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkQm9vbCgpOworCisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5CWVRFOgorICAgICAgICAgICAgICAgICAgICBwcm90LnJlYWRCeXRlKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkkxNjoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkSTE2KCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkkzMjoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkSTMyKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkk2NDoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkSTY0KCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkRPVUJMRToKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkRG91YmxlKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLlNUUklORzoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkQmluYXJ5KCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkU3RydWN0QmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmaWVsZDpURmllbGQgPSBwcm90LnJlYWRGaWVsZEJlZ2luKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5TVE9QKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgc2tpcChwcm90LCBmaWVsZC50eXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByb3QucmVhZEZpZWxkRW5kKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkU3RydWN0RW5kKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLk1BUDoKKyAgICAgICAgICAgICAgICAgICAgdmFyIG1hcDpUTWFwID0gcHJvdC5yZWFkTWFwQmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpIGluIDAgLi4uIG1hcC5zaXplKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBza2lwKHByb3QsIG1hcC5rZXlUeXBlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNraXAocHJvdCwgbWFwLnZhbHVlVHlwZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkTWFwRW5kKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLlNFVDoKKyAgICAgICAgICAgICAgICAgICAgdmFyIHNldDpUU2V0ID0gcHJvdC5yZWFkU2V0QmVnaW4oKTsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChqIGluIDAgLi4uIHNldC5zaXplKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBza2lwKHByb3QsIHNldC5lbGVtVHlwZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHJvdC5yZWFkU2V0RW5kKCk7CisKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkxJU1Q6CisgICAgICAgICAgICAgICAgICAgIHZhciBsaXN0OlRMaXN0ID0gcHJvdC5yZWFkTGlzdEJlZ2luKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoayBpbiAwIC4uLiBsaXN0LnNpemUpIHsKKyAgICAgICAgICAgIC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sIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlCisgKiBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kIGxpbWl0YXRpb25zCisgKiB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitwYWNrYWdlIG9yZy5hcGFjaGUudGhyaWZ0LnByb3RvY29sOworCitAOmVudW0KK2Fic3RyYWN0IFRUeXBlKEludCkgIGZyb20gSW50IHRvIEludCAgeworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBTVE9QIDogSW50ICAgPSAwOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBWT0lEIDogSW50ICAgPSAxOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBCT09MIDogSW50ICAgPSAyOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBCWVRFIDogSW50ICAgPSAzOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBET1VCTEUgOiBJbnQgPSA0OworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBJMTYgOiBJbnQgICAgPSA2OworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBJMzIgOiBJbnQgICAgPSA4OworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBJNjQgOiBJbnQgICAgPSAxMDsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgU1RSSU5HIDogSW50ID0gMTE7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIFNUUlVDVCA6IEludCA9IDEyOworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBNQVAgOiBJbnQgICAgPSAxMzsKKyAgICBwdWJsaWMgc3RhdGljIGlubGluZSB2YXIgU0VUIDogSW50ICAgID0gMTQ7CisgICAgcHVibGljIHN0YXRpYyBpbmxpbmUgdmFyIExJU1QgOi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FByb3RvY29sRmFjdG9yeSA6IFRQcm90b2NvbEZhY3RvcnkgPSBudWxsOworCisgICAgLy8gc2VydmVyIGV2ZW50cworICAgIHB1YmxpYyB2YXIgc2VydmVyRXZlbnRIYW5kbGVyIDogVFNlcnZlckV2ZW50SGFuZGxlciA9IG51bGw7CisKKyAgICAvLyBMb2cgZGVsZWdhdGlvbgorICAgIHByaXZhdGUgdmFyIF9sb2dEZWxlZ2F0ZSA6IER5bmFtaWMtPlZvaWQgID0gbnVsbDsKKyAgICBwdWJsaWMgdmFyIGxvZ0RlbGVnYXRlKGdldCxzZXQpIDogRHluYW1pYy0+Vm9pZDsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoIHByb2Nlc3NvciA6IFRQcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyVHJhbnNwb3J0IDogVFNlcnZlclRyYW5zcG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dFRyYW5zcG9ydEZhY3RvcnkgOiBUVHJhbnNwb3J0RmFjdG9yeSA9IG51bGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0RmFjdG9yeSA6IFRUcmFuc3BvcnRGYWN0b3J5ID0gbnVsbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sRmFjdG9yeSA6IFRQcm90b2NvbEZhY3RvcnkgPSBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sRmFjdG9yeSA6IFRQcm90b2NvbEZhY3RvcnkgPSBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ0RlbGVnYXRlIDogRHluYW1pYy0+Vm9pZCA9IG51bGwpCisgICAgeworICAgICAgdGhpcy5wcm9jZXNzb3IgPSBwcm9jZXNzb3I7CisgICAgICB0aGlzLnNlcnZlclRyYW5zcG9ydCA9IHNlcnZlclRyYW5zcG9ydDsKKyAgICAgIHRoaXMuaW5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PSBudWxsKQorICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnkgPSBuZXcgVEJpbmFyeVByb3RvY29sRmFjdG9yeSgpOworICAgICAgICBpZiggb3V0cHV0UHJvdG9jb2xGYWN0b3J5ID09IG51bGwpCisgICAgICAgICAgICBvdXRwdXRQcm90b2NvbEZhY3Rvcnk9IG5ldyBUQmluYXJ5UHJvdG9jb2xGYWN0b3J5KCk7CisgICAgICAgIGlmKCBsb2dEZWxlZ2F0ZSA9PSBudWxsKQorICAgICAgICAgICAgbG9nRGVsZWdhdGUgPSBEZWZhdWx0TG9nRGVsZWdhdGU7CisgICAgfQorCisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHNldF9sb2dEZWxlZ2F0ZSh2YWx1ZSA6IER5bmFtaWMtPlZvaWQpIDogRHluYW1pYy0+Vm9pZCB7CisgICAgICAgIGlmKHZhbHVlICE9IG51bGwpIHsKKyAgICAgICAgICAgIF9sb2dEZWxlZ2F0ZSA9IHZhbHVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgX2xvZ0RlbGVnYXRlID0gRGVmYXVsdExvZ0RlbGVnYXRlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBfbG9nRGVsZWdhdGU7CisgICAgfQorCisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIGdldF9sb2dEZWxlZ2F0ZSgpIDogRHluYW1pYy0+Vm9pZCB7CisgICAgICAgIHJldHVybiBfbG9nRGVsZWdhdGU7CisgICAgfQorCisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIERlZmF1bHRMb2dEZWxlZ2F0ZSh2YWx1ZSA6IER5bmFtaWMpIDogVm9pZCAgeworICAgICAgICB0cmFjZSggdmFsdWUpOworICAgIH0KKworCisKKyAgICBwdWJsaWMgZnVuY3Rpb24gU2VydmUoKSA6IFZvaWQgeworICAgICAgICB0aHJvdyBuZXcgQWJzdHJhY3RNZXRob2RFcnJvcigpOworICAgIH0KKworCisgICAgcHVibGljIGZ1b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ICAgICAgICAgICAgbG9nZ2VyKTsKKyAgICB9CisKKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBTZXJ2ZSgpIDogVm9pZAorICAgIHsKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHNlcnZlclRyYW5zcG9ydC5MaXN0ZW4oKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAodHR4IDogVFRyYW5zcG9ydEV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgbG9nRGVsZWdhdGUodHR4KTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIC8vIEZpcmUgdGhlIHByZVNlcnZlIHNlcnZlciBldmVudCB3aGVuIHNlcnZlciBpcyB1cCwKKyAgICAgICAgLy8gYnV0IGJlZm9yZSBhbnkgY2xpZW50IGNvbm5lY3Rpb25zCisgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyLnByZVNlcnZlKCk7CisgICAgICAgIH0KKworICAgICAgICB3aGlsZSggISBzdG9wKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgY2xpZW50IDogVFRyYW5zcG9ydCA9IG51bGw7CisgICAgICAgICAgICB2YXIgaW5wdXRUcmFuc3BvcnQgOiBUVHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgICAgIHZhciBvdXRwdXRUcmFuc3BvcnQgOiBUVHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgICAgIHZhciBpbnB1dFByb3RvY29sIDogVFByb3RvY29sID0gbnVsbDsKKyAgICAgICAgICAgIHZhciBvdXRwdXRQcm90b2NvbCA6IFRQcm90b2NvbCA9IG51bGw7CisgICAgICAgICAgICB2YXIgY29ubmVjdGlvbkNvbnRleHQgOiBEeW5hbWljID0gbnVsbDsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudCA9IHNlcnZlclRyYW5zcG9ydC5BY2NlcHQoKTsKKyAgICAgICAgICAgICAgICBpZiAoY2xpZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRUcmFuc3BvcnQgPSBpbnB1dFRyYW5zcG9ydEZhY3RvcnkuZ2V0VHJhbnNwb3J0KCBjbGllbnQpOworICAgICAgICAgICAgICAgICAgICBvdXRwdXRUcmFuc3BvcnQgPSBvdXRwdXRUcmFuc3BvcnRGYWN0b3J5LmdldFRyYW5zcG9ydCggY2xpZW50KTsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbCA9IGlucHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKCBpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sID0gb3V0cHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKCBvdXRwdXRUcmFuc3BvcnQpOworCisgICAgICAgICAgICAgICAgICAgIC8vIFJlY292ZXIgZXZlbnQgaGFuZGxlciAoaWYgYW55KSBhbmQgZmlyZSBjcmVhdGVDb250ZXh0CisgICAgICAgICAgICAgICAgICAgIC8vIHNlcnZlciBldmVudCB3aGVuIGEgY2xpZW50IGNvbm5lY3RzCisgICAgICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbkNvbnRleHQgPSBzZXJ2ZXJFdmVudEhhbmRsZXIuY3JlYXRlQ29udGV4dChpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBQcm9jZXNzIGNsaWVudCByZXF1ZXN0cyB1bnRpbCBjbGllbnQgZGlzY29ubmVjdHMKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUoIHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZpcmUgcHJvY2Vzc0NvbnRleHQgc2VydmVyIGV2ZW50CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBOLkIuIFRoaXMgaXMgdGhlIHBhdHRlcm4gaW1wbGVtZW50ZWQgaW4gQysrIGFuZCB0aGUgZXZlbnQgZmlyZXMgcHJvdmlzaW9uYWxseS4KKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoYXQgaXMgdG8gc2F5IGl0IG1heSBiZSBtYW55IG1pbnV0ZXMgYmV0d2VlbiB0aGUgZXZlbnQgZmlyaW5nIGFuZCB0aGUgY2xpZW50IHJlcXVlc3QKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFjdHVhbGx5IGFycml2aW5nIG9yIHRoZSBjbGllbnQgbWF5IGhhbmcgdXAgd2l0aG91dCBldmVyIG1ha2VpbmcgYSByZXF1ZXN0LgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyRXZlbnRIYW5kbGVyLnByb2Nlc3NDb250ZXh0KGNvbm5lY3Rpb25Db250ZXh0LCBpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vUHJvY2VzcyBjbGllbnQgcmVxdWVzdCAoYmxvY2tzIHVudGlsIHRyYW5zcG9ydCBpcyByZWFkYWJsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmKCAhIHByb2Nlc3Nvci5wcm9jZXNzKCBpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoKCB0dHggOiBUVHJhbnNwb3J0RXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIFVzdWFsbHkgYSBjbGllbnQgZGlzY29ubmVjdCwgZXhwZWN0ZWQKKyAgICAgICAgICAgICAgICBpZihydW5PbmNlICYmIHR0eC5lcnJvcklEID09IFRUcmFuc3BvcnRFeGNlcHRpb24uRU5EX09GX0ZJTEUpIHsKKyAgICAgICAgICAgICAgICAgIC8vaW5wdXQgcmV0dXJucyBlb2YsIGV4aXQKKyAgICAgICAgICAgICAgICAgIC8vZm9sbG93cyBsaWIvY3BwL3NyYy90aHJpZnQvc2VydmVyL1RTZXJ2ZXJGcmFtZXdvcmsuY3BwCisgICAgICAgICAgICAgICAgICBTdG9wKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goIHBleCA6IFRQcm90b2NvbEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsb2dEZWxlZ2F0ZSgnJHBleCAke3BleC5lcnJvcklEfSAke3BleC5lcnJvck1zZ30nKTsgLy8gVW5leHBlY3RlZAorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2goIGUgOiBEeW5hbWljKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ0RlbGVnYXRlKGUpOyAvLyBVbmV4cGVjdGVkCisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmKGNsaWVudCAhPSBudWxsICYmICFydW5PbmNlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNsaWVudC5jbG9zZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBGaXJlIGRlbGV0ZUNvbnRleHQgc2VydmVyIGV2ZW50IGFmdGVyIGNsaWVudCBkaXNjb25uZWN0cworICAgICAgICAgICAgaWYgKHNlcnZlckV2ZW50SGFuZGxlciAhPSBudW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KKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1Zi5hZGRCeXRlcyhkYXRhLCAwLCBnb3QpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdvdDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIHRoZXJlIGlzIG5vIHBvaW50IGluIGJ1ZmZlcmluZyB3aGVuZXZlciB0aGUKKyAgICAgICAgICAgICAgICAvLyByZW1haW5pbmcgbGVuZ3RoIGV4Y2VlZHMgdGhlIGJ1ZmZlciBzaXplCisgICAgICAgICAgICAgICAgaWYgKCBsZW4gPj0gYnVmU2l6ZSkgeworICAgICAgICAgICAgICAgICAgICB2YXIgZ290ID0gdHJhbnNwb3J0LnJlYWQoIGJ1Ziwgb2ZmLCBsZW4pOworICAgICAgICAgICAgICAgICAgICBpZiAoZ290ID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnVmLmFkZEJ5dGVzKGRhdGEsIDAsIGdvdCk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ290OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gZmlsbCB0aGUgYnVmZmVyCisgICAgICAgICAgICAgICAgaWYgKCByZWFkQ2h1bmsoKSA8PSAwKQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FTkRfT0ZfRklMRSwgJ0NhblwndCByZWFkICRsZW4gYnl0ZXMhJyk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKGVvZiA6IEVvZikgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FTkRfT0ZfRklMRSwgJ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FyIEZpbGVOYW1lKGRlZmF1bHQsbnVsbCkgOiBTdHJpbmc7CisKKyAgICBwcml2YXRlIHZhciBJbnB1dCAgOiBzeXMuaW8uRmlsZUlucHV0OworICAgIHByaXZhdGUgdmFyIE91dHB1dCA6IHN5cy5pby5GaWxlT3V0cHV0OworCisKKyAgICBwdWJsaWMgZnVuY3Rpb24gbmV3KCBmbmFtZSA6IFN0cmluZywgbW9kZSA6IFRGaWxlTW9kZSkgeworICAgICAgICBGaWxlTmFtZSA9IGZuYW1lOworICAgICAgICBzd2l0Y2ggKCBtb2RlKQorICAgICAgICB7CisgICAgICAgICAgICBjYXNlIFRGaWxlTW9kZS5DcmVhdGVOZXc6CisgICAgICAgICAgICAgICAgT3V0cHV0ID0gc3lzLmlvLkZpbGUud3JpdGUoIGZuYW1lLCB0cnVlKTsKKworICAgICAgICAgICAgY2FzZSBURmlsZU1vZGUuQXBwZW5kOgorICAgICAgICAgICAgICAgIE91dHB1dCA9IHN5cy5pby5GaWxlLmFwcGVuZCggZm5hbWUsIHRydWUpOworCisgICAgICAgICAgICBjYXNlIFRGaWxlTW9kZS5SZWFkOgorICAgICAgICAgICAgICAgIElucHV0ID0gc3lzLmlvLkZpbGUucmVhZCggZm5hbWUsIHRydWUpOworCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCBUVHJhbnNwb3J0RXhjZXB0aW9uLlVOS05PV04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJVbnN1cHBvcnRlZCBtb2RlIik7CisgICAgICAgIH0KKworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBDbG9zZSgpIDogVm9pZCB7CisgICAgICAgIGlmKCBJbnB1dCAhPSBudWxsKSB7CisgICAgICAgICAgICBJbnB1dC5jbG9zZSgpOworICAgICAgICAgICAgSW5wdXQgPSBudWxsOworICAgICAgICB9CisgICAgICAg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ovCitjbGFzcyBURnJhbWVkVHJhbnNwb3J0IGV4dGVuZHMgVFRyYW5zcG9ydAoreworICAgIHB1YmxpYyBzdGF0aWMgaW5saW5lIHZhciBERUZBVUxUX01BWF9MRU5HVEggPSAxNjM4NDAwMDsKKworICAgIHZhciBtYXhMZW5ndGhfIDogIEludDsKKworICAgIC8qKgorICAgICAqIFVuZGVybHlpbmcgdHJhbnNwb3J0CisgICAgICovCisgICAgdmFyIHRyYW5zcG9ydF8gOiAgVFRyYW5zcG9ydCA9IG51bGw7CisKKyAgICAvKioKKyAgICAgKiBCdWZmZXIgZm9yIG91dHB1dAorICAgICAqLworICAgIHZhciB3cml0ZUJ1ZmZlcl8gOiBCeXRlc091dHB1dCA9IG5ldyBCeXRlc091dHB1dCgpOworCisgICAgLyoqCisgICAgICogQnVmZmVyIGZvciBpbnB1dAorICAgICAqLworICAgIHZhciByZWFkQnVmZmVyXyA6IEJ5dGVzSW5wdXQgPSBudWxsOworCisgICAgLyoqCisgICAgICogQ29uc3RydWN0b3Igd3JhcHMgYXJvdW5kIGFub3RoZXIgdHJhbnNwb3J0CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIG5ldyggdHJhbnNwb3J0IDogVFRyYW5zcG9ydCwgbWF4TGVuZ3RoIDogSW50ID0gREVGQVVMVF9NQVhfTEVOR1RIKSB7CisgICAgICAgIHRyYW5zcG9ydF8gPSB0cmFuc3BvcnQ7CisgICAgICAgIG1heExlbmd0aF8gPSBtYXhMZW5ndGg7CisgICAgfQorCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIG9wZW4oKSA6IFZvaWQgeworICAgICAgICB0cmFuc3BvcnRfLm9wZW4oKTsKKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gaXNPcGVuKCkgOiBCb29sIHsKKyAgICAgICAgcmV0dXJuIHRyYW5zcG9ydF8uaXNPcGVuKCk7CisgICAgfQorCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIGNsb3NlKCkgOiBWb2lkIHsKKyAgICAgICAgdHJhbnNwb3J0Xy5jbG9zZSgpOworICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiByZWFkKGJ1ZiA6IEJ5dGVzQnVmZmVyLCBvZmYgOiBJbnQsIGxlbiA6IEludCkgOiBJbnQgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgdmFyIGRhdGEgPSBCeXRlcy5hbGxvYyhsZW4pOworCisgICAgICAgICAgICBpZiAoKHJlYWRCdWZmZXJfICE9IG51bGwpICYmIChyZWFkQnVmZmVyXy5wb3NpdGlvbiA8IHJlYWRCdWZmZXJfLmxlbmd0aCkpIHsKKyAgICAgICAgICAgICAgICB2YXIgZ290IDogSW50ID0gcmVhZEJ1ZmZlcl8ucmVhZEJ5dGVzKGRhdGEsIG9mZiwgbGVuKTsKKyAgICAgICAgICAgICAgICBpZiAoZ290ID4gMCkgeworICAgICAgICAgICAgICAgICAgICBidWYuYWRkQnl0ZXMoZGF0YSwwLGdvdCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBnb3Q7CisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIC8vIFJlYWQgYW5vdGhlciBmcmFtZSBvZiBkYXRhCisgICAgICAgICAgICByZWFkRnJhbWUoKTsKKworICAgICAgICAgICAgdmFyIGdvdCA9IHJlYWRCdWZmZXJfLnJlYWRCeXRlcyhkYXRhLCBvZmYsIGxlbik7CisgICAgICAgICAgICBidWYuYWRkQnl0ZXMoZGF0YSwwLGdvdCk7CisgICAgICAgICAgICByZXR1cm4gZ290OworICAgICAgICB9CisgICAgICAgIGNhdGNoIChlb2YgOiBFb2YpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRU5EX09GX0ZJTEUsICdDYW5cJ3QgcmVhZCAkbGVuIGJ5dGVzIScpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBmdW5jdGlvbiByZWFkRnJhbWVTaXplKCkgOiBJbnQgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgdmFyIGJ1ZmZlciA9IG5ldyBCeXRlc0J1ZmZlcigpOworICAgICAgICAgICAgdmFyIGxlbiA9IHRyYW5zcG9ydF8ucmVhZEFsbCggYnVmZmVyLCAwLCA0KTsKKyAgICAgICAgICAgIHZhciBpbnAgPSBuZXcgQnl0ZXNJbnB1dCggYnVmZmVyLmdldEJ5dGVzKCksIDAsIDQpOworICAgICAgICAgICAgaW5wLmJpZ0VuZGlhbiA9IHRydWU7CisgICAgICAgICAgICByZXR1cm4gaW5wLnJlYWRJbnQzMigpOworICAgICAgICB9CisgICAgICAgIGNhdGNoKGVvZiA6IEVvZikgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FTkRfT0ZfRklMRSwgJ0NhblwndCByZWFkIDQgYnl0ZXMhJyk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIGZ1bmN0aW9uIHJlYWRGcmFtZSgpIDogVm9pZCB7CisgICAgICAgIHZhciBzaXplIDogSW50ID0gcmVhZEZyYW1lU2l6ZSgpOworCisgICAgICAgIGlmIChzaXplIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5VTktOT1dOLCAnUmVhZCBhIG5lZ2F0aXZlIGZyYW1lIHNpemUgKCRzaXplKSEnKTsKKyAgICAgICAgfTsKKyAgICAgICAgaWYgKHNpemUgPiBtYXhMZW5ndGhfKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLlVOS05PV04sICdGcmFtZSBzaXplICgkc2l6ZSkgbGFyZ2VyIH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XRhSW5wdXQ7CisgICAgICAgIHByaXZhdGUgdmFyIG91dHB1dCA6IElEYXRhT3V0cHV0OworICAgICAgICBwcml2YXRlIHZhciBieXRlc0luQ2h1bmsgIDogIEludCA9IDA7CisgICAgICAgIHByaXZhdGUgdmFyIENSTEYgOiBCeXRlcyA9IG5ldyBCeXRlcygpOworICAgICAgICBwcml2YXRlIHZhciBpb0NhbGxiYWNrIDogVEV4Y2VwdGlvbi0+Vm9pZCA9IG51bGw7CisgICAgICAgIHByaXZhdGUgdmFyIGV2ZW50RGlzcGF0Y2hlciA6IEV2ZW50RGlzcGF0Y2hlciA9IG5ldyBFdmVudERpc3BhdGNoZXIoKTsKKworICAgICAgICBwdWJsaWMgZnVuY3Rpb24gbmV3KGhvc3QgIDogIFN0cmluZywgcG9ydCAgOiAgSW50LCByZXNvdXJjZSAgOiAgU3RyaW5nKSAgOiAgVm9pZAorICAgICAgICB7CisgICAgICAgICAgICBDUkxGLndyaXRlQnl0ZSgxMyk7CisgICAgICAgICAgICBDUkxGLndyaXRlQnl0ZSgxMCk7CisgICAgICAgICAgICB0aGlzLmhvc3QgPSBob3N0OworICAgICAgICAgICAgdGhpcy5wb3J0ID0gcG9ydDsKKyAgICAgICAgICAgIHRoaXMucmVzb3VyY2UgPSByZXNvdXJjZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBjbG9zZSgpICA6ICBWb2lkCisgICAgICAgIHsKKyAgICAgICAgICAgIHRoaXMuaW5wdXQgPSBudWxsOworICAgICAgICAgICAgdGhpcy5vdXRwdXQgPSBudWxsOworICAgICAgICAgICAgdGhpcy5zdHJpcHBlZCA9IGZhbHNlOworICAgICAgICAgICAgc29ja2V0LmNsb3NlKCkKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBwZWVrKCkgIDogIEJvb2wKKyAgICAgICAgeworICAgICAgICAgICAgaWYoc29ja2V0LmNvbm5lY3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgiQnl0ZXMgcmVtYWluZWQ6IiArIHNvY2tldC5ieXRlc0F2YWlsYWJsZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHNvY2tldC5ieXRlc0F2YWlsYWJsZT4wOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIHJlYWQoYnVmIDogQnl0ZXMsIG9mZiAgOiAgSW50LCBsZW4gIDogIEludCkgIDogIEludAorICAgICAgICB7CisgICAgICAgICAgICB2YXIgbjEgIDogIEludCA9IDAsIG4yICA6ICBJbnQgPSAwLCBuMyAgOiAgSW50ID0gMCwgbjQgIDogIEludCA9IDAsIGNpZHggIDogIEludCA9IDI7CisgICAgICAgICAgICB2YXIgY2h1bmtTaXplIDogQnl0ZXMgPSBuZXcgQnl0ZXMoKTsKKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgd2hpbGUgKCFzdHJpcHBlZCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG4xID0gbjI7CisgICAgICAgICAgICAgICAgICAgIG4yID0gbjM7CisgICAgICAgICAgICAgICAgICAgIG4zID0gbjQ7CisgICAgICAgICAgICAgICAgICAgIG40ID0gaW5wdXQucmVhZEJ5dGUoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChuMSA9PSAxMykgJiYgKG4yID09IDEwKSAmJiAobjMgPT0gMTMpICYmIChuNCA9PSAxMCkpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmlwcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIHJlYWQgY2h1bmsgc2l6ZQorICAgICAgICAgICAgICAgIGlmIChieXRlc0luQ2h1bmsgPT0gMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIG4xID0gaW5wdXQucmVhZEJ5dGUoKTsKKyAgICAgICAgICAgICAgICAgICAgbjIgPSBpbnB1dC5yZWFkQnl0ZSgpOworCisgICAgICAgICAgICAgICAgICAgIGNodW5rU2l6ZS53cml0ZUJ5dGUobjEpOworICAgICAgICAgICAgICAgICAgICBjaHVua1NpemUud3JpdGVCeXRlKG4yKTsKKworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoISgobjEgPT0gMTMpICYmIChuMiA9PSAxMCkpKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBuMSA9IG4yOworICAgICAgICAgICAgICAgICAgICAgICAgbjIgPSBpbnB1dC5yZWFkQnl0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgY2h1bmtTaXplLndyaXRlQnl0ZShuMik7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBieXRlc0luQ2h1bmsgPSBwYXJzZUludChjaHVua1NpemUudG9TdHJpbmcoKSwgMTYpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlucHV0LnJlYWRCeXRlcyhidWYsIG9mZiwgbGVuKTsKKyAgICAgICAgICAgICAgICBkZWJ1Z0J1ZmZlcihidWYpOworICAgICAgICAgICAgICAgIGJ5dGVzSW5DaHVuayAtPSBsZW47CisKKyAgICAgICAgICAgICAgICBpZiAoYnl0ZXNJbkNodW5rID09IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvLyBhZHZhbmNlIHRoZSAgOiAgIlxyXG4iCisgICAgICAgICAgICAgICAgICAgIGlucHV0LnJlYWRVVEZCeXRlcygyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIGxlbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChlIDogRU9GRXJyb3IpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhY2UoZSk7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5VTktOT1dOLCAiTm8gbW9yZSBkYXRhIGF2YWlsYWJsZS4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChlIDogVEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgnVEV4Y2VwdGlvbiAkZScpOworICAgICAgICAgICAgICAgIHRocm93IGU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoZSA6IEVycm9yKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYWNlKGUpOworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uVU5LTk9XTiwgJ0JhZCBJTyBlcnJvcjogJGUnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChlIDogRHluYW1pYykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZShlKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLlVOS05PV04sICdCYWQgSU8gZXJyb3I6ICRlJyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmdW5jdGlvbiBkZWJ1Z0J1ZmZlcihidWYgOiBCeXRlcykgIDogIFZvaWQKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGRlYnVnICA6ICBTdHJpbmcgPSAiQlVGRkVSID4+IjsKKyAgICAgICAgICAgIHZhciBpICA6ICBJbnQ7CisgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgYnVmLmxlbmd0aDsgaSsrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRlYnVnICs9IGJ1ZltpXSBhcyBpbnQ7CisgICAgICAgICAgICAgICAgZGVidWcgKz0gIiAiOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cmFjZShkZWJ1ZyArICI8PCIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIHdyaXRlKGJ1ZiA6IEJ5dGVzLCBvZmYgIDogIEludCwgbGVuICA6ICBJbnQpICA6ICBWb2lkCisgICAgICAgIHsKKyAgICAgICAgICAgIG9idWZmZXIud3JpdGVCeXRlcyhidWYsIG9mZiwgbGVuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmdW5jdGlvbiBhZGRFdmVudExpc3RlbmVyKHR5cGUgIDogIFN0cmluZywgbGlzdGVuZXIgOiBGdW5jdGlvbiwgdXNlQ2FwdHVyZSAgOiAgQm9vbCA9IGZhbHNlLCBwcmlvcml0eSAgOiAgSW50ID0gMCwgdXNlV2Vha1JlZmVyZW5jZSAgOiAgQm9vbCA9IGZhbHNlKSAgOiAgVm9pZAorICAgICAgICB7CisgICAgICAgICAgICB0aGlzLmV2ZW50RGlzcGF0Y2hlci5hZGRFdmVudExpc3RlbmVyKHR5cGUsIGxpc3RlbmVyLCB1c2VDYXB0dXJlLCBwcmlvcml0eSwgdXNlV2Vha1JlZmVyZW5jZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gb3BlbigpICA6ICBWb2lkCisgICAgICAgIHsKKyAgICAgICAgICAgIHRoaXMuc29ja2V0ID0gbmV3IFNvY2tldCgpOworICAgICAgICAgICAgdGhpcy5zb2NrZXQuYWRkRXZlbnRMaXN0ZW5lcihFdmVudC5DT05ORUNULCBzb2NrZXRDb25uZWN0ZWQpOworICAgICAgICAgICAgdGhpcy5zb2NrZXQuYWRkRXZlbnRMaXN0ZW5lcihJT0Vycm9yRXZlbnQuSU9fRVJST1IsIHNvY2tldEVycm9yKTsKKyAgICAgICAgICAgIHRoaXMuc29ja2V0LmFkZEV2ZW50TGlzdGVuZXIoU2VjdXJpdHlFcnJvckV2ZW50LlNFQ1VSSVRZX0VSUk9SLCBzb2NrZXRTZWN1cml0eUVycm9yKTsKKyAgICAgICAgICAgIHRoaXMuc29ja2V0LmFkZEV2ZW50TGlzdGVuZXIoUHJvZ3Jlc3NFdmVudC5TT0NLRVRfREFUQSwgc29ja2V0RGF0YUhhbmRsZXIpOworICAgICAgICAgICAgdGhpcy5zb2NrZXQuY29ubmVjdChob3N0LCBwb3J0KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmdW5jdGlvbiBzb2NrZXRDb25uZWN0ZWQoZXZlbnQgOiBFdmVudCkgIDogIFZvaWQKKyAgICAgICAgeworICAgICAgICAgICAgdGhpcy5vdXRwdXQgPSB0aGlzLnNvY2tldDsKKyAgICAgICAgICAgIHRoaXMuaW5wdXQgPSB0aGlzLnNvY2tldDsKKyAgICAgICAgICAgIHRoaXMub3V0cHV0LndyaXRlVVRGKCAiQ09OTkVDVCAiICsgcmVzb3VyY2UgKyAiIEhUVFAvMS4xXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIkhvc3QgOiAgIiArIGhvc3QgKyAiOiIgKyBwb3J0ICsgIlxyXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlVzZXItQWdlbnQgOiAgVGhyaWZ0L0hheGVcclxuIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICJUcmFuc2Zlci1FbmNvZGluZyA6ICBjaHVua2VkXHJcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiY29udGVudC10eXBlIDogIGFwcGxpY2F0aW9uL3gtdGhyaWZ0XHJcbiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiQWNjZXB0IDogICovKlxyXG4iCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlxyXG4iKTsKKyAgICAgICAgICAgIHRoaXMuZXZlbnREaXNwYXRjaGVyLmRpc3BhdGNoRXZlbnQoZXZlbnQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGZ1bmN0aW9uIHNvY2tldEVycm9yKGV2ZW50IDogSU9FcnJvckV2ZW50KSAgOiAgVm9pZAorICAgICAgICB7CisgICAgICAgICAgICB0cmFjZSgiRXJyb3IgQ29ubmVjdGluZzoiICsgZXZlbnQpOworICAgICAgICAgICAgdGhpcy5jbG9zZSgpOworICAgICAgICAgICAgaWYgKGlvQ2FsbGJhY2sgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpb0NhbGxiYWNrKG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uVU5LTk9XTiwgIklPRXJyb3IgOiAgIiArIGV2ZW50LnRleHQpKTsKKyAgICAgICAgICAgIHRoaXMuZXZlbnREaXNwYXRjaGVyLmRpc3BhdGNoRXZlbnQoZXZlbnQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGZ1bmN0aW9uIHNvY2tldFNlY3VyaXR5RXJyb3IoZXZlbnQgOiBTZWN1cml0eUVycm9yRXZlbnQpICA6ICBWb2lkCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKCJTZWN1cml0eSBFcnJvciBDb25uZWN0aW5nOiIgKyBldmVudCk7CisgICAgICAgICAgICB0aGlzLmNsb3NlKCk7CisgICAgICAgICAgICB0aGlzLmV2ZW50RGlzcGF0Y2hlci5kaXNwYXRjaEV2ZW50KGV2ZW50KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmdW5jdGlvbiBzb2NrZXREYXRhSGFuZGxlcihldmVudCA6IFByb2dyZXNzRXZlbnQpICA6ICBWb2lkCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKCJHb3QgRGF0YSBjYWxsOiIgK2lvQ2FsbGJhY2spOworICAgICAgICAgICAgaWYgKGlvQ2FsbGJhY2sgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpb0NhbGxiYWNrKG51bGwpOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIHRoaXMuZXZlbnREaXNwYXRjaGVyLmRpc3BhdGNoRXZlbnQoZXZlbnQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIGZsdXNoKGNhbGxiYWNrIDogRXJyb3ItPlZvaWQgPSBudWxsKSAgOiAgVm9pZAorICAgICAgICB7CisgICAgICAgICAgICB0cmFjZSgic2V0IGNhbGxiYWNrOiIgKyBjYWxsYmFjayk7CisgICAgICAgICAgICB0aGlzLmlvQ2FsbGJhY2sgPSBjYWxsYmFjazsKKyAgICAgICAgICAgIHRoaXMub3V0cHV0LndyaXRlVVRGKHRoaXMub2J1ZmZlci5sZW5ndGgudG9TdHJpbmcoMTYpKTsKKyAgICAgICAgICAgIHRoaXMub3V0cHV0LndyaXRlQnl0ZXMoQ1JMRik7CisgICAgICAgICAgICB0aGlzLm91dHB1dC53cml0ZUJ5dGVzKHRoaXMub2J1ZmZlcik7CisgICAgICAgICAgICB0aGlzLm91dHB1dC53cml0ZUJ5dGVzKENSTEYpOworICAgICAgICAgICAgdGhpcy5zb2NrZXQuZmx1c2goKTsKKyAgICAgICAgICAgIC8vIHdhaXRpbmcgZm9yICBuZXcgRmxleCBzZGsgMy41CisgICAgICAgICAgICAvL3RoaXMub2J1ZmZlci5jbGVhcigpOworICAgICAgICAgICAgdGhpcy5vYnVmZmVyID0gbmV3IEJ5dGVzKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gaXNPcGVuKCkg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ICAgICBfc29ja2V0ID0gbnVsbDsKKyAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCBUVHJhbnNwb3J0RXhjZXB0aW9uLlVOS05PV04sICdDb3VsZCBub3QgY3JlYXRlIFNlcnZlclNvY2tldCBvbiBwb3J0ICRwb3J0OiAkZScpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gTGlzdGVuKCkgOiBWb2lkCisgICAgeworICAgICAgICAvLyBNYWtlIHN1cmUgbm90IHRvIGJsb2NrIG9uIGFjY2VwdAorICAgICAgICBpZiAoX3NvY2tldCAhPSBudWxsKSAgICB7CisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAjaWYgIXBocAorICAgICAgICAgICAgICAgIF9zb2NrZXQubGlzdGVuKDEpOworICAgICAgICAgICAgICAgICNlbmQKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChlIDogRHluYW1pYykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgnRXJyb3IgJGUnKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbiggVFRyYW5zcG9ydEV4Y2VwdGlvbi5VTktOT1dOLCAnQ291bGQgbm90IGFjY2VwdCBvbiBsaXN0ZW5pbmcgc29ja2V0OiAkZScpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBvdmVycmlkZSBmdW5jdGlvbiBBY2NlcHRJbXBsKCkgOiBUVHJhbnNwb3J0CisgICAgeworICAgICAgICBpZiAoX3NvY2tldCA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbiggVFRyYW5zcG9ydEV4Y2VwdGlvbi5OT1RfT1BFTiwgIk5vIHVuZGVybHlpbmcgc2VydmVyIHNvY2tldC4iKTsKKyAgICAgICAgfQorCisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgYWNjZXB0ZWQgPSBfc29ja2V0LmFjY2VwdCgpOworICAgICAgICAgICAgdmFyIHJlc3VsdCA9IFRTb2NrZXQuZnJvbVNvY2tldChhY2NlcHRlZCk7CisgICAgICAgICAgICByZXN1bHQuc2V0VGltZW91dCggX2NsaWVudFRpbWVvdXQpOworCisgICAgICAgICAgICBpZiggX3VzZUJ1ZmZlcmVkU29ja2V0cykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyAiYnVmZmVyZWQgdHJhbnNwb3J0IG5vdCB5ZXQgc3VwcG9ydGVkIjsgIC8vIFRPRE8KKyAgICAgICAgICAgICAgICAvL3Jlc3VsdCA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnQocmVzdWx0KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoZSA6IER5bmFtaWMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKCdFcnJvciAkZScpOworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIFRUcmFuc3BvcnRFeGNlcHRpb24uVU5LTk9XTiwgJyRlJyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gQ2xvc2UoKSA6IFZvaWQKKyAgICB7CisgICAgICAgIGlmIChfc29ja2V0ICE9IG51bGwpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9zb2NrZXQuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChlIDogRHluYW1pYykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgnRXJyb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ZSB2YXIgaW5wdXQgOiBJbnB1dCA9IG51bGw7CisgICAgcHJpdmF0ZSB2YXIgb3V0cHV0IDogT3V0cHV0ID0gbnVsbDsKKyAgICAjZW5kCisKKyAgICBwcml2YXRlIHZhciB0aW1lb3V0IDogRmxvYXQgPSAzMDsKKworICAgIHByaXZhdGUgdmFyIG9idWZmZXIgOiBCeXRlc091dHB1dCA9IG5ldyBCeXRlc091dHB1dCgpOworICAgIHByaXZhdGUgdmFyIGlvQ2FsbGJhY2sgOiBURXhjZXB0aW9uLT5Wb2lkID0gbnVsbDsKKyAgICBwcml2YXRlIHZhciByZWFkQ291bnQgOiBJbnQgPSAwOworCisgICAgcHVibGljIGZ1bmN0aW9uIG5ldyhob3N0IDogU3RyaW5nLCBwb3J0ICA6ICBJbnQpICA6ICBWb2lkICB7CisgICAgICAgICNpZiAoZmxhc2ggfHwganMpCisgICAgICAgIHRoaXMuaG9zdCA9IGhvc3Q7CisgICAgICAgICNlbHNlCisgICAgICAgIHRoaXMuaG9zdCA9IG5ldyBIb3N0KGhvc3QpOworICAgICAgICAjZW5kCisKKyAgICAgICAgdGhpcy5wb3J0ID0gcG9ydDsKKyAgICB9CisKKyAgICAjaWYgISAoZmxhc2ggfHwganMpCisgICAgLy8gdXNlZCBieSBUU29ja2V0U2VydmVyCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmcm9tU29ja2V0KCBzb2NrZXQgOiBTb2NrZXQpIDogVFNvY2tldCAgeworICAgICAgICB2YXIgc29ja2V0SG9zdCA9IHNvY2tldC5ob3N0KCk7CisgICAgICAgIHZhciByZXN1bHQgPSBuZXcgVFNvY2tldChzb2NrZXRIb3N0Lmhvc3QudG9TdHJpbmcoKSwgc29ja2V0SG9zdC5wb3J0KTsKKyAgICAgICAgcmVzdWx0LmFzc2lnblNvY2tldChzb2NrZXQpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKyAgICAjZW5kCisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gY2xvc2UoKSAgOiAgVm9pZCAgeworICAgICAgICBpbnB1dCA9IG51bGw7CisgICAgICAgIG91dHB1dCA9IG51bGw7CisgICAgICAgIHNvY2tldC5jbG9zZSgpOworICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBwZWVrKCkgIDogIEJvb2wgIHsKKyAgICAgICAgaWYoIChpbnB1dCA9PSBudWxsKSB8fCAoc29ja2V0ID09IG51bGwpKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAjaWYgZmxhc2gKKyAgICAgICAgICAgIHJldHVybiAoaW5wdXQuYnl0ZXNBdmFpbGFibGUgPiAwKTsKKyAgICAgICAgICAgICNlbHNlaWYganMKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgI2Vsc2UKKyAgICAgICAgICAgIHZhciByZWFkeSA9IFNvY2tldC5zZWxlY3QoIFtzb2NrZXRdLCBudWxsLCBudWxsLCAwKTsKKyAgICAgICAgICAgIHJldHVybiAocmVhZHkucmVhZC5sZW5ndGggPiAwKTsKKyAgICAgICAgICAgICNlbmQKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIFJlYWRzIHVwIHRvIGxlbiBieXRlcyBpbnRvIGJ1ZmZlciBidWYsIHN0YXJ0aW5nIGF0dCBvZmZzZXQgb2ZmLgorICAgIC8vIE1heSByZXR1cm4gbGVzcyBieXRlcyB0aGFuIGxlbiByZXF1aXJlZAorICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiByZWFkKCBidWYgOiBCeXRlc0J1ZmZlciwgb2ZmIDogSW50LCBsZW4gOiBJbnQpIDogSW50ICAgeworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgI2lmIGZsYXNoCisKKyAgICAgICAgICAgIHZhciByZW1haW5pbmcgPSBsZW47CisgICAgICAgICAgICB3aGlsZSggcmVtYWluaW5nID4gMCkgeworICAgICAgICAgICAgICAgIGJ1Zi5hZGRCeXRlKCBpbnB1dC5yZWFkQnl0ZSgpKTsKKyAgICAgICAgICAgICAgICAtLXJlbWFpbmluZzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBsZW47CisKKyAgICAgICAgICAgICNlbHNlaWYganMKKworICAgICAgICAgICAgaWYoIGlucHV0ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLlVOS05PV04sICJTdGlsbCBubyBkYXRhICIpOyAgLy8gZG9uJ3QgYmxvY2sKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZhciBuciA9IGxlbjsKKyAgICAgICAgICAgIHdoaWxlKCBuciA8IGxlbikgeworICAgICAgICAgICAgICAgIGJ1Zi5hZGRCeXRlKCBpbnB1dC5nZXQob2ZmK25yKSk7CisgICAgICAgICAgICAgICAgKytucjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBsZW47CisKKyAgICAgICAgICAgICNlbHNlCisKKyAgICAgICAgICAgIC8vc29ja2V0LndhaXRGb3JSZWFkKCk7ICAtICBubywgdGhpcyBpZ25vcmVzIHRpbWVvdXQgYW5kIGJsb2NrcyBpbmZpbml0ZWx5CisgICAgICAgICAgICBpZihyZWFkQ291bnQgPCBvZmYpIHsKKyAgICAgICAgICAgICAgICBpbnB1dC5yZWFkKG9mZi1yZWFkQ291bnQpOworICAgICAgICAgICAgICAgIHJlYWRDb3VudCA9IG9mZjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGRhdGEgPSBCeXRlcy5hbGxvYyhsZW4pOworICAgICAgICAgICAgdmFyIGdvdCA9IGlucHV0LnJlYWRCeXRlcyhkYXRhLCAwLCBsZW4pOworICAgICAgICAgICAgYnVmLmFkZEJ5dGVzKCBkYXRhLCAwLCBnb3QpOworICAgICAgICAgICAgcmVhZENvdW50ICs9IGdvdDsKKyAgICAgICAgICAgIHJldHVybiBnb3Q7CisKKyAgICAgICAgICAgICNlbmQKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoZSA6IEVvZikKKyAgICAgICAgeworICAgICAgICAgICAgdHJhY2UoJ0VvZiAkZScpOworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FTkRfT0ZfRklMRSwgIk5vIG1vcmUgZGF0YSBhdmFpbGFibGUuIik7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKGUgOiBURXhjZXB0aW9uKQorICAgICAgICB7CisgICAgICAgICAgICB0cmFjZSgnVEV4Y2VwdGlvbiAkZScpOworICAgICAgICAgICAgdGhyb3cgZTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoZSA6IER5bmFtaWMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKCdFcnJvciAkZScpOworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5VTktOT1dOLCAnQmFkIElPIGVycm9yIDogJGUnKTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIHdyaXRlKGJ1ZiA6IEJ5dGVzLCBvZmYgIDogIEludCwgbGVuICA6ICBJbnQpICA6ICBWb2lkCisgICAgeworICAgICAgICBvYnVmZmVyLndyaXRlQnl0ZXMoYnVmLCBvZmYsIGxlbik7CisgICAgfQorCisKKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBmbHVzaChjYWxsYmFjayA6IER5bmFtaWMtPlZvaWQgPSBudWxsKSAgOiAgVm9pZAorICAgIHsKKyAgICAgICAgaWYoICEgaXNPcGVuKCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uTk9UX09QRU4sICJUcmFuc3BvcnQgbm90IG9wZW4iKTsKKyAgICAgICAgfQorCisgICAgICAgICNpZiBmbGFzaAorCisgICAgICAgIHZhciBieXRlcyA9IG5ldyBmbGFzaC51dGlscy5CeXRlQXJyYXkoKTsKKyAgICAgICAgdmFyIGRhdGEgPSBvYnVmZmVyLmdldEJ5dGVzKCk7CisgICAgICAgIHZhciBsZW4gPSAwOworICAgICAgICB3aGlsZSggbGVuIDwgZGF0YS5sZW5ndGgpIHsKKyAgICAgICAgICAgIGJ5dGVzLndyaXRlQnl0ZShkYXRhLmdldChsZW4pKTsKKyAgICAgICAgICAgICsrbGVuOworICAgICAgICB9CisKKyAgICAgICAgI2Vsc2VpZiBqcworCisgICAgICAgIHZhciBkYXRhID0gb2J1ZmZlci5nZXRCeXRlcygpOworICAgICAgICB2YXIgb3V0YnVmID0gbmV3IGpzLmh0bWwuSW50OEFycmF5KGRhdGEubGVuZ3RoKTsKKyAgICAgICAgdmFyIGxlbiA9IDA7CisgICAgICAgIHdoaWxlKCBsZW4gPCBkYXRhLmxlbmd0aCkgeworICAgICAgICAgICAgb3V0YnVmLnNldCggW2RhdGEuZ2V0KGxlbildLCBsZW4pOworICAgICAgICAgICAgKytsZW47CisgICAgICAgIH0KKyAgICAgICAgdmFyIGJ5dGVzID0gb3V0YnVmLmJ1ZmZlcjsKKworICAgICAgICAjZWxzZQorCisgICAgICAgIHZhciBieXRlcyA9IG9idWZmZXIuZ2V0Qnl0ZXMoKTsKKyAgICAgICAgdmFyIGxlbiA9IGJ5dGVzLmxlbmd0aDsKKworICAgICAgICAjZW5kCisKKyAgICAgICAgb2J1ZmZlciA9IG5ldyBCeXRlc091dHB1dCgpOworCisKKyAgICAgICAgaW9DYWxsYmFjayA9IGNhbGxiYWNrOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZENvdW50ID0gMDsKKworICAgICAgICAgICAgI2lmIGpzCisgICAgICAgICAgICBvdXRwdXQuc2VuZCggYnl0ZXMpOworICAgICAgICAgICAgI2Vsc2UKKyAgICAgICAgICAgIG91dHB1dC53cml0ZUJ5dGVzKCBieXRlcywgMCwgYnl0ZXMubGVuZ3RoKTsKKyAgICAgICAgICAgICNlbmQKKworICAgICAgICAgICAgaWYoaW9DYWxsYmFjayAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW9DYWxsYmFjayhudWxsKTsgIC8vIHN1Y2Nlc3MgY2FsbAorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogVEV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgdHJhY2UoJ1RFeGNlcHRpb24gJGUsIG1lc3NhZ2UgOiAke2UuZXJyb3JNc2d9Jyk7CisgICAgICAgICAgICBpZihpb0NhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpb0NhbGxiYWNrKGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogRHluYW1pYykgeworICAgICAgICAgICAgdHJhY2UoZSk7CisgICAgICAgICAgICBpZihpb0NhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpb0NhbGxiYWNrKG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uVU5LTk9XTiwgJ0JhZCBJTyBlcnJvciA6ICRlJykpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIGlzT3BlbigpICA6ICBCb29sCisgICAgeworICAgICAgICByZXR1cm4gKHNvY2tldCAhPSBudWxsKTsKKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gb3BlbigpICA6ICBWb2lkCisgICAgeworICAgICAgICAjaWYganMKKyAgICAgICAgdmFyIHNvY2tldCA9IG5ldyBXZWJTb2NrZXQoKTsKKyAgICAgICAgc29ja2V0Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKCBldmVudCA6IGpzLmh0bWwuTWVzc2FnZUV2ZW50KSB7CisgICAgICAgICAgICB0aGlzLmlucHV0ID0gZXZlbnQuZGF0YTsKKyAgICAgICAgfQorCisgICAgICAgICNlbHNlaWYgZmxhc2gKKyAgICAgICAgdmFyIHNvY2tldCA9IG5ldyBTb2NrZXQoKTsKKyAgICAgICAgc29ja2V0LmNvbm5lY3QoaG9zdCwgcG9ydCk7CisKKyAgICAgICAgI2Vsc2VpZiBwaHAKKyAgICAgICAgdmFyIHNvY2tldCA9IG5ldyBTb2NrZXQoKTsKKyAgICAgICAgc29ja2V0LmNvbm5lY3QoaG9zdCwgcG9ydCk7CisgICAgICAgIHNvY2tldC5zZXRCbG9ja2luZyh0cnVlKTsKKyAgICAgICAgc29ja2V0LnNldFRpbWVvdXQodGltZW91dCk7CisKKyAgICAgICAgI2Vsc2UKKyAgICAgICAgdmFyIHNvY2tldCA9IG5ldyBTb2NrZXQoKTsKKyAgICAgICAgc29ja2V0LnNldEJsb2NraW5nKHRydWUpOworICAgICAgICBzb2NrZXQuc2V0RmFzdFNlbmQodHJ1ZSk7CisgICAgICAgIHNvY2tldC5zZXRUaW1lb3V0KHRpbWVvdXQpOworICAgICAgICBzb2NrZXQuY29ubmVjdChob3N0LCBwb3J0KTsKKworICAgICAgICAjZW5kCisKKyAgICAgICAgYXNzaWduU29ja2V0KCBzb2NrZXQpOworICAgIH0KKworICAgICNpZiBqcworICAgIHByaXZhdGUgZnVuY3Rpb24gYXNzaWduU29ja2V0KCBzb2NrZXQgOiBXZWJTb2NrZXQpICA6ICBWb2lkCisgICAgI2Vsc2UKKyAgICBwcml2YXRlIGZ1bmN0aW9uIGFzc2lnblNvY2tldCggc29ja2V0IDogU29ja2V0KSAgOiAgVm9pZAorICAgICNlbmQKKyAgICB7CisgICAgICAgIHRoaXMuc29ja2V0ID0gc29ja2V0OworCisgICAgICAgICNpZi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3RyZWFtOworCisKKyAgICBwdWJsaWMgZnVuY3Rpb24gbmV3KCBpbnB1dCA6IFRTdHJlYW0sIG91dHB1dCA6IFRTdHJlYW0pIHsKKyAgICAgICAgdGhpcy5JbnB1dFN0cmVhbSA9IGlucHV0OworICAgICAgICB0aGlzLk91dHB1dFN0cmVhbSA9IG91dHB1dDsKKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gaXNPcGVuKCkgOiBCb29sIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIHBlZWsoKSA6IEJvb2wgeworICAgICAgICByZXR1cm4gKElucHV0U3RyZWFtICE9IG51bGwpOworICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBvcGVuKCkgOiBWb2lkIHsKKyAgICB9CisKKyAgICBwdWJsaWMgb3ZlcnJpZGUgZnVuY3Rpb24gY2xvc2UoKSA6IFZvaWQgeworICAgICAgICBpZiAoSW5wdXRTdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgeworICAgICAgICAgICAgSW5wdXRTdHJlYW0uQ2xvc2UoKTsKKyAgICAgICAgICAgIElucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBpZiAoT3V0cHV0U3RyZWFtICE9IG51bGwpCisgICAgICAgIHsKKyAgICAgICAgICAgIE91dHB1dFN0cmVhbS5DbG9zZSgpOworICAgICAgICAgICAgT3V0cHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiByZWFkKCBidWYgOiBCeXRlc0J1ZmZlciwgb2ZmIDogSW50LCBsZW4gOiBJbnQpIDogSW50IHsKKyAgICAgICAgaWYgKElucHV0U3RyZWFtID09IG51bGwpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCBUVHJhbnNwb3J0RXhjZXB0aW9uLk5PVF9PUEVOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNhbm5vdCByZWFkIGZyb20gbnVsbCBJbnB1dFN0cmVhbSIpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIGRhdGEgOiBCeXRlcyA9ICBCeXRlcy5hbGxvYyhsZW4pOworICAgICAgICB2YXIgc2l6ZSA9IElucHV0U3RyZWFtLlJlYWQoIGRhdGEsIG9mZiwgbGVuKTsKKyAgICAgICAgYnVmLmFkZEJ5dGVzKCBkYXRhLCAwLCBzaXplKTsKKyAgICAgICAgcmV0dXJuIHNpemU7CisgICAgfQorCisgICAgcHVibGljIG92ZXJyaWRlIGZ1bmN0aW9uIHdyaXRlKGJ1ZjpCeXRlcywgb2ZmIDogSW50LCBsZW4gOiBJbnQpIDogVm9pZCB7CisgICAgICAgIGlmIChPdXRwdXRTdHJlYW0gPT0gbnVsbCkKKyAgICAgICAgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIFRUcmFuc3BvcnRFeGNlcHRpb24uTk9UX09QRU4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNhbm5vdCB3cml0ZSB0byBudWxsIE91dHB1dFN0cmVhbSIpOworICAgICAgICB9CisKKyAgICAgICAgT3V0cHV0U3RyZWFtLldyaXRlKGJ1Ziwgb2ZmLCBsZW4pOworICAgIH0KKworICAgIHB1YmxpYyBvdmVycmlkZSBmdW5jdGlvbiBmbHVzaChjYWxsYmFjazpEeW5hbWljLT5Wb2lkID1udWxsKSA6IFZvaWQgeworICAgICAgICBpZiAoT3V0cHV0U3RyZWFtID09IG51bGwpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBlcnIgPSBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbiggVFRyYW5zcG9ydEV4Y2VwdGlvbi5OT1RfT1B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8KKyAgICBwdWJsaWMgZnVuY3Rpb24gaXNPcGVuKCkgOiBCb29sIHsKKyAgICAgICAgICB0aHJvdyBuZXcgQWJzdHJhY3RNZXRob2RFcnJvcigpOworICAgIH0KKworICAgIC8qKgorICAgICAqIElzIHRoZXJlIG1vcmUgZGF0YSB0byBiZSByZWFkPworICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSByZW1vdGUgc2lkZSBpcyBzdGlsbCBhbGl2ZSBhbmQgZmVlZGluZyB1cworICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBwZWVrKCkgOiBCb29sIHsKKyAgICAgICAgICByZXR1cm4gaXNPcGVuKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogT3BlbnMgdGhlIHRyYW5zcG9ydCBmb3IgcmVhZGluZy93cml0aW5nLgorICAgICAqCisgICAgICogQHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uIGlmIHRoZSB0cmFuc3BvcnQgY291bGQgbm90IGJlIG9wZW5lZAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBvcGVuKCkgOiBWb2lkIHsKKyAgICAgICAgICB0aHJvdyBuZXcgQWJzdHJhY3RNZXRob2RFcnJvcigpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENsb3NlcyB0aGUgdHJhbnNwb3J0LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBjbG9zZSgpIDogVm9pZCB7CisgICAgICAgICAgdGhyb3cgbmV3IEFic3RyYWN0TWV0aG9kRXJyb3IoKTsKKyAgICB9OworCisgICAgLyoqCisgICAgICogUmVhZHMgdXAgdG8gbGVuIGJ5dGVzIGludG8gYnVmZmVyIGJ1Ziwgc3RhcnRpbmcgYXR0IG9mZnNldCBvZmYuCisgICAgICoKKyAgICAgKiBAcGFyYW0gYnVmIEFycmF5IHRvIHJlYWQgaW50bworICAgICAqIEBwYXJhbSBvZmYgSW5kZXggdG8gc3RhcnQgcmVhZGluZyBhdAorICAgICAqI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hBWEUpICAtLWN3ZCAuICBqYXZhCisjICAgICQoSEFYRSkgIC0tY3dkIC4gIGphdmFzY3JpcHQKKyMgICAgJChIQVhFKSAgLS1jd2QgLiAgbmVrbworIyAgICAkKEhBWEUpICAtLWN3ZCAuICBweXRob24gICMgbmVlZHMgSGF4ZSAzLjIuMAorCisKK2NsZWFuLWxvY2FsOgorCSQoUk0pIC1yIGdlbi1oYXhlIGJpbgorCitjaGVjazogJChCSU5fQ1BQKSAkKEJJTl9QSFApCisJJChCSU5fQ1BQKQorCXBocCAtZiAkKEJJTl9QSFApCisKK0VYVFJBX0RJU1QgPSBcCisgICAgICAgICAgICAgc3JjIFwKKyAgICAgICAgICAgICBjcHAuaHhtbCBcCisgICAgICAgICAgICAgY3NoYXJwLmh4bWwgXAorICAgICAgICAgICAgIGZsYXNoLmh4bWwgXAorICAgICAgICAgICAgIGphdmEuaHhtbCBcCisgICAgICAgICAgICAgamF2YXNjcmlwdC5oeG1sIFwKKyAgICAgICAgICAgICBuZWtvLmh4bWwgXAorICAgICAgICAgICAgIHBocC5oeG1sIFwKKyAgICAgICAgICAgICBweXRob24uaHhtbCBcCisgICAgICAgICAgICAgcHJvamVjdC5oaWRlIFwKKyAgICAgICAgICAgICBIYXhlVGVzdHMuaHhwcm9qIFwKKyAgICAgICAgICAgICBtYWtlX2FsbC5iYXQgXAorICAgICAgICAgICAgIG1ha2VfYWxsLnNoCmRpZmYgLS1naXQgYS9saWIvaGF4ZS90ZXN0L2NwcC5oeG1sIGIvbGliL2hheGUvdGVzdC9jcHAuaHhtbApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi43Mzg0OGE4Ci0tLSAvZGV2L251bGwKKysrIGIvbGliL2hheGUvdGVzdC9jcHAuaHhtbApAQCAtMCwwICsxLDQxIEBACisjCisjIExpY2Vuc2VkIHRvIHRoZSBBcGFjaGUgU29mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSB1bmRlciBvbmUKKyMgb3IgbW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JlbW92ZSBhbGwgdW51c2VkIGNvZGUKKy1kY2UgZnVsbApkaWZmIC0tZ2l0IGEvbGliL2hheGUvdGVzdC9wcm9qZWN0LmhpZGUgYi9saWIvaGF4ZS90ZXN0L3Byb2plY3QuaGlkZQpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xNmVmOThlCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2hheGUvdGVzdC9wcm9qZWN0LmhpZGUKQEAgLTAsMCArMSw2NyBAQAoreworICAgICAidHlwZSIgOiAwCisgICAgLCJ0YXJnZXQiIDogNAorICAgICwibmFtZSIgOiAiVGVzdCIKKyAgICAsIm1haW4iIDogbnVsbAorICAgICwicHJvamVjdFBhY2thZ2UiIDogIiIKKyAgICAsImNvbXBhbnkiIDogIiIKKyAgICAsImxpY2Vuc2UiIDogIiIKKyAgICAsInVybCIgOiAiIgorICAgICwidGFyZ2V0RGF0YSIgOiBbCisgICAgICAgICB7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogImZsYXNoLmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMQorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJiaW4vVGVzdC5zd2YiCisgICAgICAgIH0KKyAgICAgICAgLHsKKyAgICAgICAgICAgICAicGF0aFRvSHhtbCIgOiAiamF2YXNjcmlwdC5oeG1sIgorICAgICAgICAgICAgLCJydW5BY3Rpb25UeXBlIiA6IDEKKyAgICAgICAgICAgICwicnVuQWN0aW9uVGV4dCIgOiAiYmluXFxpbmRleC5odG1sIgorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogIm5la28uaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAyCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogIm5la28gYmluL1Rlc3QubiIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJwaHAuaHhtbCIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJjcHAuaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAyCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogImJpbi9NYWluLWRlYnVnLmV4ZSIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJqYXZhLmh4bWwiCisgICAgICAgIH0KKyAgICAgICAgLHsKKyAgICAgICAgICAgICAicGF0aFRvSHhtbCIgOiAiY3NoYXJwLmh4bWwiCisgICAgICAgIH0KKyAgICAgICAgLHsKKyAgICAgICAgICAgICAicGF0aFRvSHhtbCIgOiAicHl0aG9uLmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMgorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJweXRob24gYmluL1Rlc3QucHkiCisgICAgICAgIH0KKyAgICBdCisgICAgLCJmaWxlcyIgOiBbCisgICAgICAgICB7CisgICAgICAgICAgICAgInBhdGgiIDogInNyY1xcTWFpbi5oeCIKKyAgICAgICAgICAgICwidXNlVGFicyIgOiB0cnVlCisgICAgICAgICAgICAsImluZGVudFNpemUiIDogNAorICAgICAgICAgICAgLCJmb2xkZWRSZWdpb25zIiA6IFsKKworICAgICAgICAgICAgXQorICAgICAgICAgICAgLCJhY3RpdmVMaW5lIiA6IDEzCisgICAgICAgIH0KKyAgICBdCisgICAgLCJhY3RpdmVGaWxlIiA6ICJzcmNcXE1haW4uaHgiCisgICAgLCJvcGVuRkxUYXJnZXQiIDogbnVsbAorICAgICwib3BlbkZMQnVpbGRNb2RlIiA6ICJEZWJ1ZyIKKyAgICAsInJ1bkFjdGlvblR5cGUiIDogbnVsbAorICAgICwicnVuQWN0aW9uVGV4dCIgOiBudWxsCisgICAgLCJidWlsZEFjdGlvbk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geworICAgICAgICAjaWYgc3lzCisKKyAgICAgICAgdmFyIGFyZ3MgPSBTeXMuYXJncygpOworICAgICAgICBpZiAoIGFyZ3MgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yICggYXJnIGluIGFyZ3MpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2goYXJnLnRvTG93ZXJDYXNlKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAiY2xpZW50IjoKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlciA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBjYXNlICJzZXJ2ZXIiIDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlciA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgIm11bHRpcGxleCIgOgorICAgICAgICAgICAgICAgICAgICAgICAgdGVzdHMgPSBNdWx0aXBsZXg7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgJ0ludmFsaWQgYXJndW1lbnQgIiRhcmciXG4nK0NNRExJTkVIRUxQOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgICNlbmQKKyAgICB9CisKKyAgICBzdGF0aWMgcHVibGljIGZ1bmN0aW9uIG1haW4oKQorICAgIHsKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIFBhcnNlQXJncygpOworCisgICAgICAgICAgICBzd2l0Y2goIHRlc3RzKSB7CisgICAgICAgICAgICAgICAgY2FzZSBOb3JtYWw6CisgICAgICAgICAgICAgICAgICAgIFN0cmVhbVRlc3QuUnVuKHNlcnZlcik7CisgICAgICAgICAgICAgICAgY2FzZSBNdWx0aXBsZXg6CisgICAgICAgICAgICAgICAgICAgIE11bHRpcGxleFRlc3QuUnVuKHNlcnZlcik7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cg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b3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVE11bHRpcGxleGVkUHJvdG9jb2w7CitpbXBvcnQgb3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuVE11bHRpcGxleGVkUHJvY2Vzc29yOworCisvLyBnZW5lcmF0ZWQgY29kZSBpbXBvcnRzCitpbXBvcnQgQWdncjsKK2ltcG9ydCBBZ2dySW1wbDsKK2ltcG9ydCBBZ2dyUHJvY2Vzc29yOworaW1wb3J0IEJlbmNobWFya1NlcnZpY2U7CitpbXBvcnQgQmVuY2htYXJrU2VydmljZUltcGw7CitpbXBvcnQgQmVuY2htYXJrU2VydmljZVByb2Nlc3NvcjsKK2ltcG9ydCBFcnJvcjsKKworCitjbGFzcyBCZW5jaG1hcmtTZXJ2aWNlSGFuZGxlciBpbXBsZW1lbnRzIEJlbmNobWFya1NlcnZpY2UKK3sKKyAgICBwdWJsaWMgZnVuY3Rpb24gbmV3KCkgeworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBmaWJvbmFjY2kobiA6IGhheGUuSW50MzIpIDogaGF4ZS5JbnQzMiB7CisgICAgICAgIHRyYWNlKCdCZW5jaG1hcmsuZmlib25hY2NpKCRuKScpOworICAgICAgICB2YXIgbmV4dCA6IEludDsKKyAgICAgICAgdmFyIHByZXYgICA9IDA7CisgICAgICAgIHZhciByZXN1bHQgPSAxOworICAgICAgICB3aGlsZSggbiA+IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5leHQgICA9IHJlc3VsdCArIHByZXY7CisgICAgICAgICAgICBwcmV2ICAgPSByZXN1bHQ7CisgICAgICAgICAgICByZXN1bHQgPSBuZXh0OworICAgICAgICAgICAgLS1uOworICAgICAgICB9CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorfQorCisKK2NsYXNzIEFnZ3JTZXJ2aWNlSGFuZGxlciBpbXBsZW1lbnRzIEFnZ3IKK3sKKyAgICBwcml2YXRlIHZhciB2YWx1ZXMgOiBMaXN0PGhheGUuSW50MzI+ID0gbmV3IExpc3Q8aGF4ZS5JbnQzMj4oKTsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoKSB7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGFkZFZhbHVlKHZhbHVlIDogaGF4ZS5JbnQzMikgOiBWb2lkICAgIHsKKyAgICAgICAgdHJhY2UoJ0FnZ3IuYWRkVmFsdWUoJHZhbHVlKScpOworICAgICAgICB2YWx1ZXMuYWRkKCB2YWx1ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGdldFZhbHVlcygpIDogTGlzdDwgaGF4ZS5JbnQzMj4geworICAgICAgICB0cmFjZSgnQWdnci5nZXRWYWx1ZXMoKScpOworICAgICAgICByZXR1cm4gdmFsdWVzOworICAgIH0KK30KKworCisKK2NsYXNzIE11bHRpcGxleFRlc3QgZXh0ZW5kcyBUZXN0QmFzZSB7CisKKyAgICBwcml2YXRlIGlubGluZSBzdGF0aWMgdmFyIE5BTUVfQkVOQ0hNQVJLU0VSVklDRSA6IFN0cmluZyA9ICJCZW5jaG1hcmtTZXJ2aWNlIjsKKyAgICBwcml2YXRlIGlubGluZSBzdGF0aWMgdmFyIE5BTUVfQUdHUiAgICAgICAgICAgICA6IFN0cmluZyAgPSAiQWdnciI7CisKKworICAgIHB1YmxpYyBzdGF0aWMgb3ZlcnJpZGUgZnVuY3Rpb24gUnVuKHNlcnZlciA6IEJvb2wpIDogVm9pZCB7CisgICAgICAgIGlmICggc2VydmVyKSB7CisgICAgICAgICAgICBSdW5NdWx0aXBsZXhTZXJ2ZXIoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIFJ1bk11bHRpcGxleENsaWVudCgpOworICAgICAgICAgICAgUnVuRGVmYXVsdENsaWVudCgpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAvLyBydW4gdGhlIG11bHRpcGxleCBzZXJ2ZXIKKyAgICBwdWJsaWMgc3RhdGljIG92ZXJyaWR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lclNvY2tldCggOTA5MCwgNSwgZmFsc2UpOworICAgICAgICAgICAgdmFyIHRyYW5zZmFjdCA6IFRUcmFuc3BvcnRGYWN0b3J5ID0gbmV3IFRGcmFtZWRUcmFuc3BvcnRGYWN0b3J5KCk7CisKKyAgICAgICAgICAgIHZhciBzZXJ2ZXIgOiBUU2VydmVyID0gbmV3IFRTaW1wbGVTZXJ2ZXIoIG11bHRpcGxleCwgc2VydmVydHJhbnMsIHRyYW5zZmFjdCwgcHJvdGZhY3QpOworCisgICAgICAgICAgICB0cmFjZSgiU3RhcnRpbmcgdGhlIHNlcnZlciAuLi4iKTsKKyAgICAgICAgICAgIHNlcnZlci5TZXJ2ZSgpOworICAgICAgIH0KKyAgICAgICAgY2F0Y2goIGUgOiBUQXBwbGljYXRpb25FeGNlcHRpb24pCisgICAgICAgIHsKKyAgICAgICAgICAgIFRlc3RCYXNlLkV4cGVjdChmYWxzZSwnJHtlLmVycm9ySUR9ICR7ZS5lcnJvck1zZ30nKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCggZSA6IFRFeGNlcHRpb24pCisgICAgICAgIHsKKyAgICAgICAgICAgIFRlc3RCYXNlLkV4cGVjdChmYWxzZSwnJGUnKTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLy8gcnVuIG11bHRpcGxleCBjbGllbnQgYWdhaW5zdCBtdWx0aXBsZXggc2VydmVyCisgICAgcHVibGljIHN0YXRpYyBvdmVycmlkZSBmdW5jdGlvbiBSdW5NdWx0aXBsZXhDbGllbnQoKSA6IFZvaWQgIHsKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciB0cmFucyA6IFRUcmFuc3BvcnQ7CisgICAgICAgICAgICB0cmFucyA9IG5ldyBUU29ja2V0KCJsb2NhbGhvc3QiLCA5MDkwKTsKKyAgICAgICAgICAgIHRyYW5zID0gbmV3IFRGcmFtZWRUcmFuc3BvcnQodHJhbnMpOworICAgICAgICAgICAgdHJhbnMub3BlbigpOworCisgICAgICAgICAgICB2YXIgcHJvdG9jb2wgOiBUUHJvdG9jb2wgPSBuZXcgVEJpbmFyeVByb3RvY29sKHRyYW5zLHRydWUsdHJ1ZSk7CisgICAgICAgICAgICB2YXIgbXVsdGlwbGV4IDogVE11bHRpcGxleGVkUHJvdG9jb2w7CisKKyAgICAgICAgICAgIG11bHRpcGxleCA9IG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbCggcHJvdG9jb2wsIE5BTUVfQkVOQ0hNQVJLU0VSVklDRSk7CisgICAgICAgICAgICB2YXIgYmVuY2ggPSBuZXcgQmVuY2htYXJrU2VydmljZUltcGwoIG11bHRpcGxleCk7CisKKyAgICAgICAgICAgIG11bHRpcGxleCA9IG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbCggcHJvdG9jb2wsIE5BTUVfQUdHUik7CisgICAgICAgICAgICB2YXIgYWdnciA9IG5ldyBBZ2dySW1wbCggbXVsdGlwbGV4KTsKKworICAgICAgICAgICAgdHJhY2UoJ2NhbGxpbmcgYWdnci5hZGQoIGJlbmNoLmZpYm8oKSkuLi4nKTsKKyAgICAgICAgICAgIGZvciggaSBpbiAxIC4uLiAxMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgnJGknKTsKKyAgICAgICAgICAgICAgICBhZ2dyLmFkZFZhbHVlKCBiZW5jaC5maWJvbmFjY2koaSkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cmFjZSgnY2FsbGluZyBhZ2dyIC4uLicpOworICAgICAgICAgICAgdmFyIGkgPSAxOworICAgICAgICAgICAgdmFyIHZhbHVlcyA9IGFnZ3IuZ2V0VmFsdWVzKCk7CisgICAgICAgICAgICBUZXN0QmFzZS5FeHBlY3QodmFsdWVzICE9IG51bGwsJ2FnZ3IuZ2V0VmFsdWVzKCkgPT0gbnVsbCcpOworICAgICAgICAgICAgZm9yKCBrIGluIHZhbHVlcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgnZmliKCRpKSA9ICRrJyk7CisgICAgICAgICAgICAgICAgKytpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cmFucy5jbG9zZSgpOworICAgICAgICAgICAgdHJhY2UoJ2RvbmUuJyk7CisKKyAgICAgICAgfQorICAgICAgICBjYXRjaCggZSA6IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgVGVzdEJhc2UuRXhwZWN0KGZhbHNlLCcke2UuZXJyb3JJRH0gJHtlLmVycm9yTXNnfScpOworICAgICAgICB9CisgICAgICAgIGNhdGNoKCBlIDogVEV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgVGVzdEJhc2UuRXhwZWN0KGZhbHNlLCckZScpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAvLyBydW4gbm9uLW11bHRpcGxleCBjbGllbnQgYWdhaW5zdCBtdWx0aXBsZXggc2VydmVyIHRvIHRlc3QgZGVmYXVsdCBmYWxsYmFjaworICAgIHB1YmxpYyBzdGF0aWMgb3ZlcnJpZGUgZnVuY3Rpb24gUnVuRGVmYXVsdENsaWVudCgpIDogVm9pZCAgeworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRyYW5zIDogVFRyYW5zcG9ydDsKKyAgICAgICAgICAgIHRyYW5zID0gbmV3IFRTb2NrZXQoImxvY2FsaG9zdCIsIDkwOTApOworICAgICAgICAgICAgdHJhbnMgPSBuZXcgVEZyYW1lZFRyYW5zcG9ydCh0cmFucyk7CisgICAgICAgICAgICB0cmFucy5vcGVuKCk7CisKKyAgICAgICAgICAgIHZhciBwcm90b2NvbCA6IFRQcm90b2NvbCA9IG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnMsdHJ1ZSx0cnVlKTsKKworICAgICAgICAgICAgdmFyIGJlbmNoID0gbmV3IEJlbmNobWFya1NlcnZpY2VJbXBsKCBwcm90b2NvbCk7CisKKyAgICAgICAgICAgI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hKCk7CisgICAgICAgIGRhdGEud3JpdGUocHJvdCk7CisgICAgICAgIHRyYW5zLmNsb3NlKCk7CisKKyAgICAgICAgcmV0dXJuIGRhdGE7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBSZWFkRGF0YSgpIDogWHRydWN0CisgICAgeworICAgICAgICB2YXIgc3RyZWFtIDogVFN0cmVhbSA9IG5ldyBURmlsZVN0cmVhbSggdG1wZmlsZSwgUmVhZCk7CisgICAgICAgIHZhciB0cmFucyA6IFRUcmFuc3BvcnQgPSBuZXcgVFN0cmVhbVRyYW5zcG9ydCggc3RyZWFtLCBudWxsKTsKKyAgICAgICAgdmFyIHByb3QgPSBuZXcgVEpTT05Qcm90b2NvbCggdHJhbnMpOworCisgICAgICAgIHZhciBkYXRhIDogWHRydWN0ID0gbmV3IFh0cnVjdCgpOworICAgICAgICBkYXRhLnJlYWQocHJvdCk7CisgICAgICAgIHRyYW5zLmNsb3NlKCk7CisKKyAgICAgICAgcmV0dXJuIGRhdGE7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBvdmVycmlkZSBmdW5jdGlvbiBSdW4oc2VydmVyIDogQm9vbCkgOiBWb2lkCisgICAgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgdmFyIHdyaXR0ZW4gPSBXcml0ZURhdGEoKTsKKyAgICAgICAgICAgIHZhciByZWFkID0gUmVhZERhdGEoKTsKKyAgICAgICAgICAgIEZpbGVTeXN0ZW0uZGVsZXRlRmlsZSh0bXBmaWxlKTsKKworICAgICAgICAgICAgVGVzdEJhc2UuRXhwZWN0KCByZWFkLnN0cmluZ190aGluZyA9PSB3cml0dGVuLnN0cmluZ190aGluZywgInN0cmluZyBkYXRhIik7CisgICAgICAgICAgICBUZXN0QmFzZS5FeHBlY3QoIHJlYWQuYnl0ZV90aGluZyA9PSB3cml0dGVuLmJ5dGVfdGhpbmcsICJieXRlIGRhdGEiKTsKKyAgICAgICAgICAgIFRlc3RCYXNlLkV4cG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pIDwtIHJlYWRGaWVsZEJlZ2luIHB0Ci0gICAgaWYgZnQgPT0gVF9TVE9QCi0gICAgICAgIHRoZW4gcmV0dXJuIHJlY29yZAotICAgICAgICBlbHNlIGNhc2UgdGFnIG9mCi0gICAgICAgICAgICAgICAgIDEgLT4gaWYgZnQgPT0gVF9TVFJJTkcgdGhlbgotICAgICAgICAgICAgICAgICAgICAgICAgICBkbyBzIDwtIHJlYWRTdHJpbmcgcHQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZEFwcEV4bkZpZWxkcyBwdCByZWNvcmR7YWVfbWVzc2FnZSA9IHVucGFjayBzfQotICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGRvIHNraXAgcHQgZnQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkQXBwRXhuRmllbGRzIHB0IHJlY29yZAotICAgICAgICAgICAgICAgICAyIC0+IGlmIGZ0ID09IFRfSTMyIHRoZW4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gaSA8LSByZWFkSTMyIHB0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRBcHBFeG5GaWVsZHMgcHQgcmVjb3Jke2FlX3R5cGUgPSAodG9FbnVtICQgZnJvbUludGVncmFsIGkpfQotICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGRvIHNraXAgcHQgZnQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkQXBwRXhuRmllbGRzIHB0IHJlY29yZAotICAgICAgICAgICAgICAgICBfIC0+IGRvIHNraXAgcHQgZnQKLSAgICAgICAgICAgICAgICAgICAgICAgICByZWFkRmllbGRFbmQgcHQKLSAgICAgICAgICAgICAgICAgICAgICAgICByZWFkQXBwRXhuRmllbGRzIHB0IHJlY29yZAotCityZWFkQXBwRXhuRmllbGRzIDo6IE1hcC5IYXNoTWFwIEludDE2IChUZXh0LCBUaHJpZnRWYWwpIC0+IEFwcEV4bgorcmVhZEFwc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AgICAgICBsZXQgdHkgPSB0eXBlRnJvbSAodyAuJi4gMHgwRikKKyAgICAgICAgICAgICAgbW9kaWZpZXIgPSAodyAuJi4gMHhGMCkgYHNoaWZ0UmAgNAorICAgICAgICAgIGZpZCA8LSBpZiBtb2RpZmllciAvPSAwCisgICAgICAgICAgICAgICAgIHRoZW4gcmV0dXJuIChsYXN0SWQgKyBmcm9tSW50ZWdyYWwgbW9kaWZpZXIpCisgICAgICAgICAgICAgICAgIGVsc2UgcGFyc2VWYXJpbnQgemlnWmFnVG9JMTYKKyAgICAgICAgICB2YWwgPC0gaWYgdHkgPT0gVF9CT09MCisgICAgICAgICAgICAgICAgIHRoZW4gcmV0dXJuIChUQm9vbCAkICh3IC4mLiAweDBGKSA9PSAweDAxKQorICAgICAgICAgICAgICAgICBlbHNlIGNhc2UgKHR5LCBNYXAubG9va3VwIGZpZCB0bWFwKSBvZgorICAgICAgICAgICAgICAgICAgICAgICAgKFRfU1RSSU5HLCBKdXN0IChfLCBUX0JJTkFSWSkpIC0+IHBhcnNlQ29tcGFjdFZhbHVlIFRfQklOQVJZCisgICAgICAgICAgICAgICAgICAgICAgICBfIC0+IHBhcnNlQ29tcGFjdFZhbHVlIHR5CisgICAgICAgICAgKChmaWQsIChMVC5lbXB0eSwgdmFsKSkgOiApIDwkPiBwYXJzZUZpZWxkcyBmaWQKKworcGFyc2VDb21wYWN0TWFwIDo6IFRocmlmdFR5cGUgLT4gVGhyaWZ0VHlwZSAtPiBJbnQzMiAtPgorICAgICAgICAgICAgICAgICAgIFBhcnNlciBbKFRocmlmdFZhbCwgVGhyaWZ0VmFsKV0KK3BhcnNlQ29tcGFjdE1hcCBrdCB2dCBuIHwgbiA8PSAwID0gcmV0dXJuIFtdCisgICAgICAgICAgICAgICAgICAgICAgICB8IG90aGVyd2lzZSA9IGRvCisgIGsgPC0gcGFyc2VDb21wYWN0VmFsdWUga3QKKyAgdiA8LSBwYXJzZUNvbXBhY3RWYWx1ZSB2dAorICAoKGssdikg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KKyAgICAgICAgICAgICAgICAgIFsgVF9CT09MCisgICAgICAgICAgICAgICAgICAsIFRfSTE2CisgICAgICAgICAgICAgICAgICAsIFRfSTMyCisgICAgICAgICAgICAgICAgICAsIFRfSTY0CisgICAgICAgICAgICAgICAgICAsIFRfRE9VQkxFCisgICAgICAgICAgICAgICAgICAsIFRfU1RSSU5HCisgICAgICAgICAgICAgICAgICAsIFRfQklOQVJZCisgICAgICAgICAgICAgICAgICBdCisgIHdoZXJlCisgICAgc2tpcEJldHdlZW4gOjogQ2hhciAtPiBDaGFyIC0+IFBhcnNlciAoKQorICAgIHNraXBCZXR3ZWVuIGEgYiA9IGJldHdlZW4gYSBiICQgdm9pZCAoUEMuc2F0aXNmeSAoXGMgLT4gYyAvPSBhICYmIGMgLz0gYikpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8fD4gc2tpcEJldHdlZW4gYSBiCisKK3BhcnNlSlNPTlN0cnVjdCA6OiBUeXBlTWFwIC0+IFBhcnNlciAoTWFwLkhhc2hNYXAgSW50MTYgKExULlRleHQsIFRocmlmdFZhbCkpCitwYXJzZUpTT05TdHJ1Y3QgdG1hcCA9IE1hcC5mcm9tTGlzdCAuIGNhdE1heWJlcyA8JD4gcGFyc2VGaWVsZAorICAgICAgICAgICAgICAgICAgICAgICBgc2VwQnlgIGxleGVtZSAoUEMuY2hhcjggJywnKQorICB3aGVyZQorICAgIHBhcnNlRmllbGQgPSBkbworICAgICAgZmlkIDwtIGxleGVtZSAoYmV0d2VlbiAnIicgJyInIGRlY2ltYWwpIDwqIGxleGVtZSAoUEMuY2hhcjggJzonKQorICAgICAgY2FzZSBNYXAubG9va3VwIGZpZCB0bWFwIG9mCisgICAgICAgIEp1c3QgKHN0ciwgZnR5cGUpIC0+IGJldHdlZW4gJ3snICd9JyAkIGRvCisgICAgICAgICAgXyA8LSBsZXhlbWUgKGVzY2FwZWRTdHJpbmcpICo+IGxleGVtZSAoUEMuY2hhcjggJzonKQorIC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oYXIgPHw+IG5vdENoYXI4ICciJykpIDwqCisgICAgICAgICAgICAgICAgUEMuY2hhcjggJyInCisKK2Jhc2U2NFN0cmluZyA6OiBQYXJzZXIgTEJTLkJ5dGVTdHJpbmcKK2Jhc2U2NFN0cmluZyA9IFBDLmNoYXI4ICciJyAqPgorICAgICAgICAgICAgICAgKGRlY29kZUJhc2U2NCAuIExCU0MucGFjayA8JD4gUC5tYW55JyAoUEMubm90Q2hhciAnIicpKSA8KgorICAgICAgICAgICAgICAgUEMuY2hhcjggJyInCisgICAgICAgICAgICAgICB3aGVyZQorICAgICAgICAgICAgICAgICBkZWNvZGVCYXNlNjQgYiA9CisgICAgICAgICAgICAgICAgICAgbGV0IHBhZGRlZCA9IGNhc2UgKExCUy5sZW5ndGggYikgYG1vZGAgNCBvZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgLT4gTEJTLmFwcGVuZCBiICI9PSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzIC0+IExCUy5hcHBlbmQgYiAiPSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfIC0+IGIgaW4KKyAgICAgICAgICAgICAgICAgICBjYXNlIEI2NEMuZGVjb2RlIHBhZGRlZCBvZgorICAgICAgICAgICAgICAgICAgICAgUmlnaHQgcyAtPiBzCisgICAgICAgICAgICAgICAgICAgICBMZWZ0IHggLT4gZXJyb3IgeAorCitlc2NhcGVkQ2hhciA6OiBQYXJzZXIgV29yZDgKK2VzY2FwZWRDaGFyID0gUEMuY2hhcjggJ1xcJyAqPiAoYzJ3IDwkPiBjaG9pY2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyAnXFNPSCcgPCQgUC5zdHJpbmcgInUwMDAxIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcU1RYJyA8JCBQLnN0cmluZyAidTAwMDIiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xFVFgnIDwkIFAuc3RyaW5nICJ1MDAwMyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXEVPVCcgPCQgUC5zdHJpbmcgInUwMDA0IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcRU5RJyA8JCBQLnN0cmluZyAidTAwMDUiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xBQ0snIDwkIFAuc3RyaW5nICJ1MDAwNiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXEJFTCcgPCQgUC5zdHJpbmcgInUwMDA3IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcQlMnICA8JCBQLnN0cmluZyAidTAwMDgiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xWVCcgIDwkIFAuc3RyaW5nICJ1MDAwYiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXEZGJyAgPCQgUC5zdHJpbmcgInUwMDBjIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcQ1InICA8JCBQLnN0cmluZyAidTAwMGQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xTTycgIDwkIFAuc3RyaW5nICJ1MDAwZSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXFNJJyAgPCQgUC5zdHJpbmcgInUwMDBmIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcRExFJyA8JCBQLnN0cmluZyAidTAwMTAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xEQzEnIDwkIFAuc3RyaW5nICJ1MDAxMSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXERDMicgPCQgUC5zdHJpbmcgInUwMDEyIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcREMzJyA8JCBQLnN0cmluZyAidTAwMTMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xEQzQnIDwkIFAuc3RyaW5nICJ1MDAxNCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXE5BSycgPCQgUC5zdHJpbmcgInUwMDE1IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcU1lOJyA8JCBQLnN0cmluZyAidTAwMTYiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xFVEInIDwkIFAuc3RyaW5nICJ1MDAxNyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXENBTicgPCQgUC5zdHJpbmcgInUwMDE4IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcRU0nICA8JCBQLnN0cmluZyAidTAwMTkiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xTVUInIDwkIFAuc3RyaW5nICJ1MDAxYSIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXEVTQycgPCQgUC5zdHJpbmcgInUwMDFiIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcRlMnICA8JCBQLnN0cmluZyAidTAwMWMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xHUycgIDwkIFAuc3RyaW5nICJ1MDAxZCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXFJTJyAgPCQgUC5zdHJpbmcgInUwMDFlIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcVVMnICA8JCBQLnN0cmluZyAidTAwMWYiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xERUwnIDwkIFAuc3RyaW5nICJ1MDA3ZiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXDAnIDwkIFBDLmNoYXIgJzAnCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xhJyA8JCBQQy5jaGFyICdhJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcYicgPCQgUEMuY2hhciAnYicKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXGYnIDwkIFBDLmNoYXIgJ2YnCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1xuJyA8JCBQQy5jaGFyICduJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdccicgPCQgUEMuY2hhciAncicKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXHQnIDwkIFBDLmNoYXIgJ3QnCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJ1x2JyA8JCBQQy5jaGFyICd2JworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcIicgPCQgUEMuY2hhciAnIicKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAnXCcnIDwkIFBDLmNoYXIgJ1wnJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICdcXCcgPCQgUEMuY2hhciAnXFwnCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgJy8nICA8JCBQQy5jaGFyICcvJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKQorCitlc2NhcGUgOjogTEJTLkJ5dGVTdHJpbmcgLT4gQnVpbGRlcgorZXNjYXBlID0gTEJTLmZvbGRsJyBlc2NhcGVDaGFyIG1lbXB0eQorICB3aGVyZQorICAgIGVzY2FwZUNoYXIgYiB3ID0gYiA8PiAoQi5sYXp5Qnl0ZVN0cmluZyAkIGNhc2UgdzJjIHcgb2YKKyAgICAgICdcMCcgLT4gIlxcMCIKKyAgICAgICdcYicgLT4gIlxcYiIKKyAgICAgICdcZicgLT4gIlxcZiIKKyAgICAgICdcbicgLT4gIlxcbiIKKyAgICAgICdccicgLT4gIlxcciIKKyAgICAgICdcdCcgLT4gIlxcdCIKKyAgICAgICdcIicgLT4gIlxcXCIiCisgICAgICAnXFwnIC0+ICJcXFxcIgorICAgICAgJ1xTT0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VncmFsIGxlbgorICAgICAgICAgICAgICBsZXQgYnVmID0gTEJTLnRvU3RyaWN0IGxidWYKKyAgICAgICAgICAgICAgY2FzZSBwYXJzZUJpbmFyeU1hZ2ljIGJ1ZiBvZgorICAgICAgICAgICAgICAgIFJpZ2h0IF8gLT4gZG8KKyAgICAgICAgICAgICAgICAgIHdyaXRlSU9SZWYgY1R5cGUgRnJhbWVkCisgICAgICAgICAgICAgICAgICB3cml0ZUlPUmVmIChwcm90b2NvbFR5cGUgdCkgVEJpbmFyeQorICAgICAgICAgICAgICAgICAgd3JpdGVJT1JlZiByQnVmIGxidWYKKyAgICAgICAgICAgICAgICAgIHJldHVybiBUcnVlCisgICAgICAgICAgICAgICAgTGVmdCBfIC0+IGRvCisgICAgICAgICAgICAgICAgICBjYXNlIHBhcnNlQ29tcGFjdE1hZ2ljIGJ1ZiBvZgorICAgICAgICAgICAgICAgICAgICBSaWdodCBfIC0+IGRvCisgICAgICAgICAgICAgICAgICAgICAgd3JpdGVJT1JlZiBjVHlwZSBGcmFtZWQKKyAgICAgICAgICAgICAgICAgICAgICB3cml0ZUlPUmVmIChwcm90b2NvbFR5cGUgdCkgVENvbXBhY3QKKyAgICAgICAgICAgICAgICAgICAgICB3cml0ZUlPUmVmIHJCdWYgbGJ1ZgorICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUcnVlCisgICAgICAgICAgICAgICAgICAgIExlZnQgXyAtPiBkbworICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcGFyc2VIZWFkZXJNYWdpYyBidWYgb2YKKyAgICAgICAgICAgICAgICAgICAgICAgIFJpZ2h0IGZsYWdzIC0+IGRvCisgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCAoZmxhZ3MsIHNlcU51bSwgaGVhZGVyLCBib2R5KSA9IGV4dHJhY3RIZWFkZXIgYnVmCisgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlSU9SZWYgY1R5cGUgSGVhZGVyQ2xpZW50CisgICAgICAgICAgICAg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VsbCByQnVmCisgICAgICB0aGVuIGRvCisgICAgICAgIGxldCAoY29uc3VtZWQsIHJlbWFpbikgPSBMQlMuc3BsaXRBdCAoZnJvbUludGVncmFsIGxlbikgckJ1ZgorICAgICAgICB3cml0ZUlPUmVmIChyZWFkQnVmZmVyIHQpIHJlbWFpbgorICAgICAgICByZXR1cm4gY29uc3VtZWQKKyAgICAgIGVsc2UgZG8KKyAgICAgICAgZnJhbWVkIDwtIGlzRnJhbWVkIHQKKyAgICAgICAgaWYgbm90IGZyYW1lZAorICAgICAgICAgIHRoZW4gdFJlYWQgKGluVHJhbnMgdCkgbGVuCisgICAgICAgICAgZWxzZSBkbworICAgICAgICAgICAgb2sgPC0gcmVhZEZyYW1lIHQKKyAgICAgICAgICAgIGlmIG9rCisgICAgICAgICAgICAgIHRoZW4gdFJlYWQgdCBsZW4KKyAgICAgICAgICAgICAgZWxzZSByZXR1cm4gTEJTLmVtcHR5CisKKyAgdFBlZWsgdCA9IGRvCisgICAgckJ1ZiA8LSByZWFkSU9SZWYgKHJlYWRCdWZmZXIgdCkKKyAgICBpZiBub3QgJCBMQlMubnVsbCByQnVmCisgICAgICB0aGVuIHJldHVybiAkIEp1c3QgJCBMQlMuaGVhZCByQnVmCisgICAgICBlbHNlIGRvCisgICAgICAgIGZyYW1lZCA8LSBpc0ZyYW1lZCB0CisgICAgICAgIGlmIG5vdCBmcmFtZWQKKyAgICAgICAgICB0aGVuIHRQZWVrIChpblRyYW5zIHQpCisgICAgICAgICAgZWxzZSBkbworICAgICAgICAgICAgb2sgPC0gcmVhZEZyYW1lIHQKKyAgICAgICAgICAgIGlmIG9rCisgICAgICAgICAgICAgIHRoZW4gdFBlZWsgdAorICAgICAgICAgICAgICBlbHNlIHJldHVybiBOb3RoaW5nCisKKyAgdFdyaXRlIHQgYnVmID0gZG8KKyAgICBsZXQgd0J1ZiA9IHdyaXRlQnVmZmVyIHQKKyAgICBmcmFtZWQgPC0gaXNGcmFtZWQgdAorICAgIGlmIGZyY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IGZyb21FbnVtIFRfU1RSSU5HICAgICA9IDExCisgICAgZnJvbUVudW0gVF9CSU5BUlkgICAgID0gMTEKKyAgICBmcm9tRW51bSAoVF9TVFJVQ1QgXykgPSAxMgorICAgIGZyb21FbnVtIChUX01BUCBfIF8pICA9IDEzCisgICAgZnJvbUVudW0gKFRfU0VUIF8pICAgID0gMTQKKyAgICBmcm9tRW51bSAoVF9MSVNUIF8pICAgPSAxNQorCisgICAgdG9FbnVtIDAgID0gVF9TVE9QCisgICAgdG9FbnVtIDEgID0gVF9WT0lECisgICAgdG9FbnVtIDIgID0gVF9CT09MCisgICAgdG9FbnVtIDMgID0gVF9CWVRFCisgICAgdG9FbnVtIDQgID0gVF9ET1VCTEUKKyAgICB0b0VudW0gNiAgPSBUX0kxNgorICAgIHRvRW51bSA4ICA9IFRfSTMyCisgICAgdG9FbnVtIDEwID0gVF9JNjQKKyAgICB0b0VudW0gMTEgPSBUX1NUUklORworICAgIC0tIHRvRW51bSAxMSA9IFRfQklOQVJZCisgICAgdG9FbnVtIDEyID0gVF9TVFJVQ1QgTWFwLmVtcHR5CisgICAgdG9FbnVtIDEzID0gVF9NQVAgVF9WT0lEIFRfVk9JRAorICAgIHRvRW51bSAxNCA9IFRfU0VUIFRfVk9JRAorICAgIHRvRW51bSAxNSA9IFRfTElTVCBUX1ZPSUQKKyAgICB0b0VudW0gdCA9IGVycm9yICQgIkludmFsaWQgVGhyaWZ0VHlwZSAiICsrIHNob3cgdAorCitkYXRhIE1lc3NhZ2VUeXBlCisgICAgPSBNX0NBTEwKKyAgICB8IE1fUkVQTFkKKyAgICB8IE1fRVhDRVBUSU9OCisgICAgfCBNX09ORVdBWQorICAgICAgZGVyaXZpbmcgKCBFcSwgU2hvdyApCisKK2luc3RhbmNlIEVudW0gTWVzc2FnZVR5cGUgd2hlcmUKKyAgICBmcm9tRW51bSBNX0NBTEwgICAgICA9ICAxCisgICAgZnJvbUVudW0gTV9SRVBMWSAgICAgPSAgMgorICAgIGZyb21F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gcHJvdG8gVF9ET1VCTEUKKyAgICAgICAgdmFsMiBgc2hvdWxkQmVgIChURG91YmxlIHZhbCkKKworICAgIGRlc2NyaWJlICJzdHJpbmciICQgZG8KKyAgICAgIGl0ICJ3cml0ZXMiICQgZG8KKyAgICAgICAgbGV0IHZhbCA9IEMucGFjayAiYWFhIgorICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEJpbmFyeVByb3RvY29sIHRyYW5zCisgICAgICAgIHdyaXRlVmFsIHByb3RvIChUU3RyaW5nIHZhbCkKKyAgICAgICAgYmluIDwtIHRSZWFkIHRyYW5zIDcKKyAgICAgICAgKExCUy51bnBhY2sgYmluKSBgc2hvdWxkQmVgIFswLCAwLCAwLCAzLCA5NywgOTcsIDk3XQorCisgICAgZGVzY3JpYmUgImJpbmFyeSIgJCBkbworICAgICAgaXQgIndyaXRlcyIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEJpbmFyeVByb3RvY29sIHRyYW5zCisgICAgICAgIHdyaXRlVmFsIHByb3RvIChUQmluYXJ5ICQgTEJTLnBhY2sgWzQyLCA0MywgNDRdKQorICAgICAgICBiaW4gPC0gdFJlYWQgdHJhbnMgMTAwCisgICAgICAgIChMQlMudW5wYWNrIGJpbikgYHNob3VsZEJlYCBbMCwgMCwgMCwgMywgNDIsIDQzLCA0NF0KKworICAgICAgaXQgInJlYWRzIiAkIGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gQmluYXJ5UHJvdG9jb2wgdHJhbnMKKyAgICAgICAgdFdyaXRlIHRyYW5zICQgTEJTLnBhY2sgWzAsIDAsIDAsIDMsIDQyLCA0MywgNDRdCisgICAgICAgIHZhbCA8LSByZWFkVmFsIHByb3RvIChUX0JJTkFSWSkKKyAgICAgICAgdmFsIGBzaG91b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AoQy51bnBhY2sgYmluKSBgc2hvdWxkQmVgIFsnMSddCisKKyAgICAgIGl0ICJ3cml0ZXMgZmFsc2UgYXMgMCIgJCBkbworICAgICAgICBsZXQgdmFsID0gRmFsc2UKKyAgICAgICAgdHJhbnMgPC0gb3Blbk1lbW9yeUJ1ZmZlcgorICAgICAgICBsZXQgcHJvdG8gPSBKU09OUHJvdG9jb2wgdHJhbnMKKyAgICAgICAgd3JpdGVWYWwgcHJvdG8gKFRCb29sIHZhbCkKKyAgICAgICAgYmluIDwtIHRSZWFkIHRyYW5zIDEwMAorICAgICAgICAoQy51bnBhY2sgYmluKSBgc2hvdWxkQmVgIFsnMCddCisKKyAgICAgIHByb3AgInJvdW5kIHRyaXAiICQgXHZhbCAtPiBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB3cml0ZVZhbCBwcm90byAkIFRCb29sIHZhbAorICAgICAgICB2YWwyIDwtIHJlYWRWYWwgcHJvdG8gVF9CT09MCisgICAgICAgIHZhbDIgYHNob3VsZEJlYCAoVEJvb2wgdmFsKQorCisgICAgZGVzY3JpYmUgInN0cmluZyIgJCBkbworICAgICAgaXQgIndyaXRlcyIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB3cml0ZVZhbCBwcm90byAoVFN0cmluZyAkIEMucGFjayAiXCJhIikKKyAgICAgICAgYmluIDwtIHRSZWFkIHRyYW5zIDEwMAorICAgICAgICAoQy51bnBhY2sgYmluKSBgc2hvdWxkQmVgICJcIlxcXCJhXCIiCisKKyAgICAgIGl0ICJyZWFkcyIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB0V3JpdGUgdHJhbnMgJCBDLnBhY2sgIlwiXFxcImFcIiIKKyAgICAgICAgdmFsIDwtIHJlYWRWYWwgcHJvdG8gKFRfU1RSSU5HKQorICAgICAgICB2YWwgYHNob3VsZEJlYCAoVFN0cmluZyAkIEMucGFjayAiXCJhIikKKworICAgICAgcHJvcCAicm91bmQgdHJpcCIgJCBcdmFsIC0+IGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHdyaXRlVmFsIHByb3RvIChUU3RyaW5nICQgQy5wYWNrIHZhbCkKKyAgICAgICAgdmFsMiA8LSByZWFkVmFsIHByb3RvIChUX1NUUklORykKKyAgICAgICAgdmFsMiBgc2hvdWxkQmVgIChUU3RyaW5nICQgQy5wYWNrIHZhbCkKKworICAgIGRlc2NyaWJlICJiaW5hcnkiICQgZG8KKyAgICAgIGl0ICJ3cml0ZXMgd2l0aCBwYWRkaW5nIiAkIGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHdyaXRlVmFsIHByb3RvIChUQmluYXJ5ICQgTEJTLnBhY2sgWzFdKQorICAgICAgICBiaW4gPC0gdFJlYWQgdHJhbnMgMTAwCisgICAgICAgIChDLnVucGFjayBiaW4pIGBzaG91bGRCZWAgIlwiQVE9PVwiIgorCisgICAgICBpdCAicmVhZHMgd2l0aCBwYWRkaW5nIiAkIGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHRXcml0ZSB0cmFucyAkIEMucGFjayAiXCJBUT09XCIiCisgICAgICAgIHZhbCA8LSByZWFkVmFsIHByb3RvIChUX0JJTkFSWSkKKyAgICAgICAgdmFsIGBzaG91bGRCZWAgKFRCaW5hcnkgJCBMQlMucGFjayBbMV0pCisKKyAgICAgIGl0ICJyZWFkcyB3aXRob3V0IHBhZGRpbmciICQgZG8KKyAgICAgICAgdHJhbnMgPC0gb3Blbk1lbW9yeUJ1ZmZlcgorICAgICAgICBsZXQgcHJvdG8gPSBKU09OUHJvdG9jb2wgdHJhbnMKKyAgICAgICAgdFdyaXRlIHRyYW5zICQgQy5wYWNrICJcIkFRXCIiCisgICAgICAgIHZhbCA8LSByZWFkVmFsIHByb3RvIChUX0JJTkFSWSkKKyAgICAgICAgdmFsIGBzaG91bGRCZWAgKFRCaW5hcnkgJCBMQlMucGFjayBbMV0pCisKKyAgICAgIHByb3AgInJvdW5kIHRyaXAiICQgXHZhbCAtPiBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB3cml0ZVZhbCBwcm90byAoVEJpbmFyeSAkIExCUy5wYWNrIHZhbCkKKyAgICAgICAgdmFsMiA8LSByZWFkVmFsIHByb3RvIChUX0JJTkFSWSkKKyAgICAgICAgdmFsMiBgc2hvdWxkQmVgIChUQmluYXJ5ICQgTEJTLnBhY2sgdmFsKQorCisgICAgZGVzY3JpYmUgImxpc3QiICQgZG8KKyAgICAgIGl0ICJ3cml0ZXMgZW1wdHkgbGlzdCIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB3cml0ZVZhbCBwcm90byAoVExpc3QgVF9CWVRFIFtdKQorICAgICAgICBiaW4gPC0gdFJlYWQgdHJhbnMgMTAwCisgICAgICAgIChDLnVucGFjayBiaW4pIGBzaG91bGRCZWAgIltcImk4XCIsMF0iCisKKyAgICAgIGl0ICJyZWFkcyBlbXB0eSIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB0V3JpdGUgdHJhbnMgKEMucGFjayAiW1wiaThcIiwwXSIpCisgICAgICAgIHZhbCA8LSByZWFkVmFsIHByb3RvIChUX0xJU1QgVF9CWVRFKQorICAgICAgICB2YWwgYHNob3VsZEJlYCAoVExpc3QgVF9CWVRFIFtdKQorCisgICAgICBpdCAid3JpdGVzIHNpbmdsZSBlbGVtZW50IiAkIGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHdyaXRlVmFsIHByb3RvIChUTGlzdCBUX0JZVEUgW1RCeXRlIDBdKQorICAgICAgICBiaW4gPC0gdFJlYWQgdHJhbnMgMTAwCisgICAgICAgIChDLnVucGFjayBiaW4pIGBzaG91bGRCZWAgIltcImk4XCIsMSwwXSIKKworICAgICAgaXQgInJlYWRzIHNpbmdsZSBlbGVtZW50IiAkIGRvCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHRXcml0ZSB0cmFucyAoQy5wYWNrICJbXCJpOFwiLDEsMF0iKQorICAgICAgICB2YWwgPC0gcmVhZFZhbCBwcm90byAoVF9MSVNUIFRfQllURSkKKyAgICAgICAgdmFsIGBzaG91bGRCZWAgKFRMaXN0IFRfQllURSBbVEJ5dGUgMF0pCisKKyAgICAgIGl0ICJyZWFkcyBlbGVtZW50cyIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB0V3JpdGUgdHJhbnMgKEMucGFjayAiW1wiaThcIiwyLDQyLCA0M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HJpbmcgdmFsKQorCisgICAgZGVzY3JpYmUgIm1hcCIgJCBkbworICAgICAgaXQgIndyaXRlcyBlbXB0eSIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB3cml0ZVZhbCBwcm90byAoVE1hcCBUX0JZVEUgVF9CWVRFIFtdKQorICAgICAgICBiaW4gPC0gdFJlYWQgdHJhbnMgMTAwCisgICAgICAgIChDLnVucGFjayBiaW4pIGBzaG91bGRCZWAiW1wiaThcIixcImk4XCIsMCx7fV0iCisKKyAgICAgIGl0ICJyZWFkcyBlbXB0eSIgJCBkbworICAgICAgICB0cmFucyA8LSBvcGVuTWVtb3J5QnVmZmVyCisgICAgICAgIGxldCBwcm90byA9IEpTT05Qcm90b2NvbCB0cmFucworICAgICAgICB0V3JpdGUgdHJhbnMgKEMucGFjayAiW1wiaThcIixcImk4XCIsMCx7fV0iKQorICAgICAgICB2YWwgPC0gcmVhZFZhbCBwcm90byAoVF9NQVAgVF9CWVRFIFRfQllURSkKKyAgICAgICAgdmFsIGBzaG91bGRCZWAgKFRNYXAgVF9CWVRFIFRfQllURSBbXSkKKworICAgICAgaXQgInJlYWRzIHN0cmluZy1zdHJpbmciICQgZG8KKyAgICAgICAgbGV0IGJpbiA9ICJbXCJzdHJcIixcInN0clwiLDIse1wiYVwiOlwiMlwiLFwiYlwiOlwiYmxhaFwifV0iCisgICAgICAgIHRyYW5zIDwtIG9wZW5NZW1vcnlCdWZmZXIKKyAgICAgICAgbGV0IHByb3RvID0gSlNPTlByb3RvY29sIHRyYW5zCisgICAgICAgIHRXcml0ZSB0cmFucyAoQy5wYWNrIGJpbikKKyAgICAgICAgdmFsIDwtIHJlYWRWYWwgcHJvdG8gKFRfTUFQIFRfU1RSSU5HIFRfU1RSSU5HKQorICAgICAgICB2YWxgc2hvdWxkQmVgIChUTWFwIFRfU1RSSU5HIFRfU1R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XMgeworICAgICAgICAgICAgbGljZW5zZSB7CisgICAgICAgICAgICAgICAgbmFtZSAnVGhlIEFwYWNoZSBTb2Z0d2FyZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCcKKyAgICAgICAgICAgICAgICB1cmwgIiR7cHJvamVjdC5saWNlbnNlfSIKKyAgICAgICAgICAgICAgICBkaXN0cmlidXRpb24gJ3JlcG8nCisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBkZXZlbG9wZXJzIHsKKyAgICAgICAgICAgIGRldmVsb3BlciB7CisgICAgICAgICAgICAgICAgaWQgJ2RldicKKyAgICAgICAgICAgICAgICBuYW1lICdBcGFjaGUgVGhyaWZ0IERldmVsb3BlcnMnCisgICAgICAgICAgICAgICAgZW1haWwgJ2RldkB0aHJpZnQuYXBhY2hlLm9yZycKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHBvbS53aGVuQ29uZmlndXJlZCB7CisgICAgICAgIC8vIEZpeHVwIHRoZSBzY29wZSBmb3Igc2VydmxldC1hcGkgdG8gYmUgJ3Byb3ZpZGVkJyBpbnN0ZWFkIG9mICdjb21waWxlJworICAgICAgICBkZXBlbmRlbmNpZXMuZmluZCB7IGRlcCAtPiBkZXAuZ3JvdXBJZCA9PSAnamF2YXguc2VydmxldCcgJiYgZGVwLmFydGlmYWN0SWQgPT0gJ3NlcnZsZXQtYXBpJyB9LndpdGggeworICAgICAgICAgICAgLy8gaXQub3B0aW9uYWwgPSB0cnVlCisgICAgICAgICAgICBpdC5zY29wZSA9ICdwcm92aWRlZCcKKyAgICAgICAgfQorICAgIH0KK30KKworaW5zdGFsbCB7CisgICAgcmVwb3NpdG9yaWVzLm1hdmVuSW5zdGFsbGVyIHsKKyAgICAgICAgY29uZmlndXJlUG9tKHBvbSkKKyAgICB9Cit9CisKK3VwbG9hZEFyY2hpdmVzIHsKKyAgICBkZXBlbmRzT24gdGVzdCAvLyBtYWtlIHN1cmUgd2UgcnVuIHVuaX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nYWxTdGF0ZUV4Y2VwdGlvbiBpZiBjYWxsZWQgb24gYSBOb25lCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IFQgZ2V0KCk7CisKKyAgICAvKioKKyAgICAgKiBHZXQgdGhlIGNvbnRhaW5lZCB2YWx1ZSAoaWYgZGVmaW5lZCkgb3IgZWxzZSByZXR1cm4gYSBkZWZhdWx0IHZhbHVlCisgICAgICogQHBhcmFtIG90aGVyIHdoYXQgdG8gcmV0dXJuIGlmIHRoZSB2YWx1ZSBpcyBub3QgZGVmaW5lZCAoYSBOb25lKQorICAgICAqIEByZXR1cm4gZWl0aGVyIHRoZSB2YWx1ZSwgb3Igb3RoZXIgaWYgdGhlIHZhbHVlIGlzIG5vdCBkZWZpbmVkCisgICAgICovCisgICAgcHVibGljIFQgb3IoVCBvdGhlcikgeworICAgICAgICBpZiAoaXNEZWZpbmVkKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXQoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBvdGhlcjsKKyAgICAgICAgfQorICAgIH0KKyAgICAvKioKKyAgICAgKiBUaGUgTm9uZSB0eXBlLCByZXByZXNlbnRpbmcgYW4gYWJzZW50IHZhbHVlIChpbnN0ZWFkIG9mICJudWxsIikKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIE5vbmU8VD4gZXh0ZW5kcyBPcHRpb248VD4geworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0RlZmluZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVCBnZXQoKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDYW5ub3QgY2FsbCBnZXQoKSBvbiBOb25lIik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAgICAgcmV0dXJuICJOb25lIjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBTb21lIHR5cGUsIHJlcHJlc2VudGluZyBhbiBleGlzdGVuY2Ugb2Ygc29tZSB2YWx1ZQorICAgICAqIEBwYXJhbSA8VD4gVGhlIHR5cGUgb2YgdmFsdWUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFNvbWU8VD4gZXh0ZW5kcyBPcHRpb248VD4geworICAgICAgICBwcml2YXRlIGZpbmFsIFQgdmFsdWU7CisgICAgICAgIHB1YmxpYyBTb21lKFQgdmFsdWUpIHsKKyAgICAgICAgICAgIHRoaXMudmFsdWUgPSB2YWx1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzRGVmaW5lZCgpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFQgZ2V0KCkgeworICAgICAgICAgICAgcmV0dXJuIHZhbHVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKKyAgICAgICAgICAgIHJldHVybiAiU29tZSgiICsgdmFsdWUgKyAiKSI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcmFwcyB2YWx1ZSBpbiBhbiBPcHRpb24gdHlwZSwgZGVwZW5kaW5nIG9uIHdoZXRoZXIgb3Igbm90IHZhbHVlIGlzIG51bGwKKyAgICAgKiBAcGFyYW0gdmFsdWUKKyAgICAgKiBAcGFyYW0gPFQ+IHR5cGUgb2YgdmFsdWUKKyAgICAgKiBAcmV0dXJuIFNvbWUodmFsdWUpIGlmIHZhbHVlIGlzIG5vdCBudWxsLCBOb25lIGlmIHZhbHVlIGlzIG51bGwKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIDxUPiBPcHRpb248VD4gZnJvbU51bGxhYmxlKFQgdmFsdWUpIHsKKyAgICAgICAg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lbHNlIHsKKyAgICAgICAgICAgIFRQcm90b2NvbFV0aWwuc2tpcChpcHJvdCwgZmllbGQudHlwZSk7CisgICAgICAgICAgfQorICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDI6CisgICAgICAgICAgaWYgKGZpZWxkLnR5cGUgPT0gVFR5cGUuSTMyKSB7CisgICAgICAgICAgICB0eXBlID0gaXByb3QucmVhZEkzMigpOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOwotICAgICAgICB9Ci0gICAgICAgIGJyZWFrOwotICAgICAgY2FzZSAyOgotICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5JMzIpIHsKLSAgICAgICAgICB0eXBlID0gaXByb3QucmVhZEkzMigpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgIFRQcm90b2NvbFV0aWwuc2tpcChpcHJvdCwgZmllbGQudHlwZSk7Ci0gICAgICAgIH0KLSAgICAgICAgYnJlYWs7Ci0gICAgICBkZWZhdWx0OgotICAgICAgICBUUHJvdG9jb2xVdGlsLnNraXAoaXByb3QsIGZpZWxkLnR5cGUpOwotICAgICAgICBicmVhazsKKyAgICAgICAgICBicmVhazsKICAgICAgIH0KICAgICAgIGlwcm90LnJlYWRGaWVsZEVuZCgpOwogICAgIH0KICAgICBpcHJvdC5yZWFkU3RydWN0RW5kKCk7Ci0KLSAgICByZXR1cm4gbmV3IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbih0eXBlLCBtZXNzYWdlKTsKKyAgICB0eXBlXyA9IHR5cGU7CisgICAgbWVzc2FnZV8gPSBtZXNzYWdlOwogICB9CiAKLSAgcHVibGljIHZvaWQgd3JpdGUoVFBy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c2FnZShtc2cubmFtZSwgVE1lc3NhZ2VUeXBlLkVYQ0VQVElPTiwgbXNnLnNlcWlkKSk7Ci0gICAgICAgICAgICB4LndyaXRlKG91dCk7Ci0gICAgICAgICAgICBvdXQud3JpdGVNZXNzYWdlRW5kKCk7Ci0gICAgICAgICAgICBvdXQuZ2V0VHJhbnNwb3J0KCkuZmx1c2goKTsKKworICAgICAgICAgICAgVEFwcGxpY2F0aW9uRXhjZXB0aW9uIHggPSBuZXcgVEFwcGxpY2F0aW9uRXhjZXB0aW9uKFRBcHBsaWNhdGlvbkV4Y2VwdGlvbi5QUk9UT0NPTF9FUlJPUiwKKyAgICAgICAgICAgICAgICBlLmdldE1lc3NhZ2UoKSk7CisgICAgICAgICAgICBMT0dHRVIuZGVidWcoIkNvdWxkIG5vdCByZXRyaWV2ZSBmdW5jdGlvbiBhcmd1bWVudHMiLCB4KTsKKworICAgICAgICAgICAgaWYgKCFmbi5pc09uZXdheSgpKSB7CisgICAgICAgICAgICAgIG91dC53cml0ZU1lc3NhZ2VCZWdpbihuZXcgVE1lc3NhZ2UobXNnLm5hbWUsIFRNZXNzYWdlVHlwZS5FWENFUFRJT04sIG1zZy5zZXFpZCkpOworICAgICAgICAgICAgICB4LndyaXRlKG91dCk7CisgICAgICAgICAgICAgIG91dC53cml0ZU1lc3NhZ2VFbmQoKTsKKyAgICAgICAgICAgICAgb3V0LmdldFRyYW5zcG9ydCgpLmZsdXNoKCk7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBmYi5yZXNwb25zZVJlYWR5KCk7CiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfQogICAgICAgICBpbi5yZWFkTWVzc2FnZUVuZCgpOwogCisgICAgICAgIGlmIChmbi5pc09uZXdheSgpKSB7CisgICAgICAgICAgZmIucmVzcG9uc2VSZWFkeSgpOworICAgICAgICB9CiAKICAgICAgICAgLy9zdGFydCBvZmYgcHJvY2Vzc2luZyBmdW5jdGlvbgotICAgICAgICBmb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IHJldHVybiAwOwotICAgIH0KKyAgICByZXR1cm4gU2hvcnQuY29tcGFyZShhLGIpOwogICB9CiAKICAgcHVibGljIHN0YXRpYyBpbnQgY29tcGFyZVRvKGludCBhLCBpbnQgYikgewotICAgIGlmIChhIDwgYikgewotICAgICAgcmV0dXJuIC0xOwotICAgIH0gZWxzZSBpZiAoYiA8IGEpIHsKLSAgICAgIHJldHVybiAxOwotICAgIH0gZWxzZSB7Ci0gICAgICByZXR1cm4gMDsKLSAgICB9CisgICAgcmV0dXJuIEludGVnZXIuY29tcGFyZShhLCBiKTsKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhsb25nIGEsIGxvbmcgYikgewotICAgIGlmIChhIDwgYikgewotICAgICAgcmV0dXJuIC0xOwotICAgIH0gZWxzZSBpZiAoYiA8IGEpIHsKLSAgICAgIHJldHVybiAxOwotICAgIH0gZWxzZSB7Ci0gICAgICByZXR1cm4gMDsKLSAgICB9CisgICAgcmV0dXJuIExvbmcuY29tcGFyZShhLCBiKTsKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhkb3VibGUgYSwgZG91YmxlIGIpIHsKLSAgICBpZiAoYSA8IGIpIHsKLSAgICAgIHJldHVybiAtMTsKLSAgICB9IGVsc2UgaWYgKGIgPCBhKSB7Ci0gICAgICByZXR1cm4gMTsKLSAgICB9IGVsc2UgewotICAgICAgcmV0dXJuIDA7Ci0gICAgfQorICAgIHJldHVybiBEb3VibGUuY29tcGFyZShhLCBiKTsKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhTdHJpbmcgYSwgU3RyaW5nIGIpIHsKQEAgLTEwOSwxNyArODIsMTYgQEAKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhieXRlW10gYSwgYnl0ZVtdIGIpIHsKLSAgICBpbnQgc2l6ZUNvbXBhcmUgPSBjb21wYXJlVG8oYS5sZW5ndGgsIGIubGVuZ3RoKTsKLSAgICBpZiAoc2l6ZUNvbXBhcmUgIT0gMCkgewotICAgICAgcmV0dXJuIHNpemVDb21wYXJlOwotICAgIH0KLSAgICBmb3IgKGludCBpID0gMDsgaSA8IGEubGVuZ3RoOyBpKyspIHsKLSAgICAgIGludCBieXRlQ29tcGFyZSA9IGNvbXBhcmVUbyhhW2ldLCBiW2ldKTsKLSAgICAgIGlmIChieXRlQ29tcGFyZSAhPSAwKSB7Ci0gICAgICAgIHJldHVybiBieXRlQ29tcGFyZTsKKyAgICBpbnQgY29tcGFyZSA9IGNvbXBhcmVUbyhhLmxlbmd0aCwgYi5sZW5ndGgpOworICAgIGlmIChjb21wYXJlID09IDApIHsKKyAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYS5sZW5ndGg7IGkrKykgeworICAgICAgICBjb21wYXJlID0gY29tcGFyZVRvKGFbaV0sIGJbaV0pOworICAgICAgICBpZiAoY29tcGFyZSAhPSAwKSB7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KICAgICAgIH0KICAgICB9Ci0gICAgcmV0dXJuIDA7CisgICAgcmV0dXJuIGNvbXBhcmU7CiAgIH0KIAogICBwdWJsaWMgc3RhdGljIGludCBjb21wYXJlVG8oQ29tcGFyYWJsZSBhLCBDb21wYXJhYmxlIGIpIHsKQEAgLTEyNyw0MSArOTksMzkgQEAKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhMaXN0IGEsIExpc3QgYikgewotICAgIGludCBsYXN0Q29tcGFyaXNvbiA9IGNvbXBhcmVUbyhhLnNpemUoKSwgYi5zaXplKCkpOwotICAgIGlmIChsYXN0Q29tcGFyaXNvbiAhPSAwKSB7Ci0gICAgICByZXR1cm4gbGFzdENvbXBhcmlzb247Ci0gICAgfQotICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYS5zaXplKCk7IGkrKykgewotICAgICAgbGFzdENvbXBhcmlzb24gPSBjb21wYXJhdG9yLmNvbXBhcmUoYS5nZXQoaSksIGIuZ2V0KGkpKTsKLSAgICAgIGlmIChsYXN0Q29tcGFyaXNvbiAhPSAwKSB7Ci0gICAgICAgIHJldHVybiBsYXN0Q29tcGFyaXNvbjsKKyAgICBpbnQgY29tcGFyZSA9IGNvbXBhcmVUbyhhLnNpemUoKSwgYi5zaXplKCkpOworICAgIGlmIChjb21wYXJlID09IDApIHsKKyAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYS5zaXplKCk7IGkrKykgeworICAgICAgICBjb21wYXJlID0gY29tcGFyYXRvci5jb21wYXJlKGEuZ2V0KGkpLCBiLmdldChpKSk7CisgICAgICAgIGlmIChjb21wYXJlICE9IDApIHsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQogICAgICAgfQogICAgIH0KLSAgICByZXR1cm4gMDsKKyAgICByZXR1cm4gY29tcGFyZTsKICAgfQogCiAgIHB1YmxpYyBzdGF0aWMgaW50IGNvbXBhcmVUbyhTZXQgYSwgU2V0IGIpIHsKLSAgICBpbnQgbGFzdENvbXBhcmlzb24gPSBjb21wYXJlVG8oYS5zaXplKCksIGIuc2l6ZSgpKTsKLSAgICBpZiAobGFzdENvbXBhcmlzb24gIT0gMCkgewotICAgICAgcmV0dXJuIGxhc3RDb21wYXJpc29uOwotICAgIH0KLSAgICBTb3J0ZWRTZXQgc29ydGVkQSA9IG5ldyBUcmVlU2V0KGNvbXBhcmF0b3IpOwotICAgIHNvcnRlZEEuYWRkQWxsKGEpOwotICAgIFNvcnRlZFNldCBzb3J0ZWRCID0gbmV3IFRyZWVTZXQoY29tcGFyYXRvcik7Ci0gICAgc29ydGVkQi5hZGRBbGwoYik7CisgICAgaW50IGNvbXBhcmUgPSBjb21wYXJlVG8oYS5zaXplKCksIGIuc2l6ZSgpKTsKKyAgICBpZiAoY29tcGFyZSA9PSAwKSB7CisgICAgICBBcnJheUxpc3Qgc29ydGVkQSA9IG5ldyBBcnJheUxpc3QoYSk7CisgICAgICBBcnJheUx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IHJldHVybiBwcm90b2NvbF8ucmVhZEJvb2woKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkQm9vbCgpOwogICAgICAgICAgIGNhc2UgVFR5cGUuQllURToKLSAgICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLkJZVEUpIHsKLSAgICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkQnl0ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICByZXR1cm4gcHJvdG9jb2xfLnJlYWRCeXRlKCk7CiAgICAgICAgICAgY2FzZSBUVHlwZS5ET1VCTEU6Ci0gICAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5ET1VCTEUpIHsKLSAgICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkRG91YmxlKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZERvdWJsZSgpOwogICAgICAgICAgIGNhc2UgVFR5cGUuSTE2OgotICAgICAgICAgICAgaWYgKGZpZWxkLnR5cGUgPT0gVFR5cGUuSTE2KSB7Ci0gICAgICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZEkxNigpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICByZXR1cm4gcHJvdG9jb2xfLnJlYWRJMTYoKTsKICAgICAgICAgICBjYXNlIFRUeXBlLkkzMjoKLSAgICAgICAgICAgIGlmIChmaWVsZC50eXBlID09IFRUeXBlLkkzMikgewotICAgICAgICAgICAgICByZXR1cm4gcHJvdG9jb2xfLnJlYWRJMzIoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkSTMyKCk7CiAgICAgICAgICAgY2FzZSBUVHlwZS5JNjQ6Ci0gICAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5JNjQpIHsKLSAgICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkSTY0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZEk2NCgpOwogICAgICAgICAgIGNhc2UgVFR5cGUuU1RSSU5HOgotICAgICAgICAgICAgaWYgKGZpZWxkLnR5cGUgPT0gVFR5cGUuU1RSSU5HKSB7Ci0gICAgICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZFN0cmluZygpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgY2FzZSAxMDA6IC8vIGhhY2sgdG8gZGlmZmVyZW50aWF0ZSBiZXR3ZWVuIHN0cmluZyBhbmQgYmluYXJ5Ci0gICAgICAgICAgICBpZiAoZmllbGQudHlwZSA9PSBUVHlwZS5TVFJJTkcpIHsKLSAgICAgICAgICAgICAgcmV0dXJuIHByb3RvY29sXy5yZWFkQmluYXJ5KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZFN0cmluZygpOworICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gaGFjayB0byBkaWZmZXJlbnRpYXRlIGJldHdlZW4gc3RyaW5nIGFuZCBiaW5hcnkKKyAgICAgICAgaWYgKHR0eXBlID09IDEwMCAmJiBmaWVsZC50eXBlID09IFRUeXBlLlNUUklORykgeworICAgICAgICAgIHJldHVybiBwcm90b2NvbF8ucmVhZEJpbmFyeSgpOwogICAgICAgICB9CiAgICAgICB9CiAgICAgICByZXR1cm4gbnVsbDsK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sCiAgICAgICAgICAgICBzZXJ2ZXIudG9TdHJpbmcoKSwgZS50b1N0cmluZygpKTsKLSAgICAgICAgICBMT0cuZXJyb3IoZXJyKTsKKyAgICAgICAgICBMT0dHRVIuZXJyb3IoZXJyKTsKICAgICAgICAgICAvLyBmcmVlIHJlc291cmNlCiAgICAgICAgICAgaWYgKHMgIT0gbnVsbCkgewogICAgICAgICAgICAgdHJ5IHtzLmNsb3NlKCk7fSBjYXRjaCAoRXhjZXB0aW9uIGV4KSB7fQpAQCAtMjYxLDcgKzI2NCw3IEBACiAgICAgICAgIHRyeXsKICAgICAgICAgICBzZWxlY3Rvci5zZWxlY3QoKTsKICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICBMT0cuZXJyb3IoInNlbGVjdG9yIHNlbGVjdHMgZXJyb3I6ICIrZS50b1N0cmluZygpKTsKKyAgICAgICAgICBMT0dHRVIuZXJyb3IoInNlbGVjdG9yIHNlbGVjdHMgZXJyb3I6ICIrZS50b1N0cmluZygpKTsKICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgfQogCkBAIC0yODQsNyArMjg3LDcgQEAKICAgICAgICAgICAgICAgU3RyaW5nIGVyciA9IFN0cmluZy5mb3JtYXQoInNvY2tldCAlZCBjb25uZWN0cyB0byBzZXJ2ZXIgJXMgIiArCiAgICAgICAgICAgICAgICAgImVycm9yOiAlcyIsCiAgICAgICAgICAgICAgICAgaW5kZXgsIHNlcnZlcnMuZ2V0KGluZGV4KS50b1N0cmluZygpLCBlLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICBMT0cuZXJyb3IoZXJyKTsKKyAgICAgICAgICAgICAgTE9HR0VSLmVycm9yKGVycik7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgfQogCkBAIC0yOTksNyArMzAyLDcgQEAKICAgICAgICAgICAgICAgICBTdHJpbmcgZXJyID0gU3RyaW5nLmZvcm1hdCgic29ja2V0ICVkIHdyaXRlcyB0byBzZXJ2ZXIgJXMgIiArCiAgICAgICAgICAgICAgICAgICAiZXJyb3I6ICVzIiwKICAgICAgICAgICAgICAgICAgIGluZGV4LCBzZXJ2ZXJzLmdldChpbmRleCkudG9TdHJpbmcoKSwgZS50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICBMT0cuZXJyb3IoZXJyKTsKKyAgICAgICAgICAgICAgICBMT0dHRVIuZXJyb3IoZXJyKTsKICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgIH0KQEAgLTMyNSw3ICszMjgsNyBAQAogICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZXJyID0gU3RyaW5nLmZvcm1hdCgiUmVhZCBhbiBpbnZhbGlkIGZyYW1lIHNpemUgJWQiCiAgICAgICAgICAgICAgICAgICAgICAgKyAiIGZyb20gJXMuIERvZXMgdGhlIHNlcnZlciB1c2UgVEZyYW1lZFRyYW5zcG9ydD8gIiwKICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVNpemVbaW5kZXhdLCBzZXJ2ZXJzLmdldChpbmRleCkudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgICAgIExPRy5lcnJvcihlcnIpOworICAgICAgICAgICAgICAgICAgICBMT0dHRVIuZXJyb3IoZXJyKTsKICAgICAgICAgICAgICAgICAgICAgc0NoYW5uZWwuY2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICB9CkBAIC0zNDAsNyArMzQzLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICArICIgdG90YWwgYnVmZmVyIHNpemUgd291bGQgZXhjZWVkIGxpbWl0ICVkIiwKICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVNpemVbaW5kZXhdLCBzZXJ2ZXJzLmdldChpbmRleCkudG9TdHJpbmcoKSwKICAgICAgICAgICAgICAgICAgICAgICBtYXhSZWN2QnVmQnl0ZXNQZXJTZXJ2ZXIpOwotICAgICAgICAgICAgICAgICAgICBMT0cuZXJyb3IoZXJyKTsgICAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgIExPR0dFUi5lcnJvcihlcnIpOyAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgc0NoYW5uZWwuY2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICB9CkBAIC0zNjYsNyArMzY5LDcgQEAKICAgICAgICAgICAgICAgU3RyaW5nIGVyciA9IFN0cmluZy5mb3JtYXQoInNvY2tldCAlZCByZWFkcyBmcm9tIHNlcnZlciAlcyAiICsKICAgICAgICAgICAgICAgICAiZXJyb3I6ICVzIiwKICAgICAgICAgICAgICAgICBpbmRleCwgc2VydmVycy5nZXQoaW5kZXgpLnRvU3RyaW5nKCksIGUudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgIExPRy5lcnJvcihlcnIpOworICAgICAgICAgICAgICBMT0dHRVIuZXJyb3IoZXJyKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTM4OSw3ICszOTIsNyBAQAogICAgICAgICAgIHNlbGVjdG9yLmNsb3NlKCk7CiAgICAgICAgIH0KICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgTE9HLmVycm9yKCJmcmVlIHJlc291cmNlIGVycm9yOiAiK2UudG9TdHJpbmcoKSk7CisgICAgICAgIExPR0dFUi5lcnJvcigiZnJlZSByZXNvdXJjZSBlcnJvcjogIitlLnRvU3RyaW5nKCkpOwogICAgICAgfQogICAgIH0KICAgfQpkaWZmIC0tZ2l0IGEvbGliL2phdmEvc3JjL29yZy9hcGFjaGUvdGhyaWZ0L1ROb25ibG9ja2luZ011bHRpRmV0Y2hTdGF0cy5qYXZhIGIvbGliL2phdmEvc3JjL29yZy9hcGFjaGUvdGhyaWZ0L1ROb25ibG9ja2luZ011bHRpRmV0Y2hTdGF0cy5qYXZhCm9sZCB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dKSB7Ci0gICAgICAgICAgcmVhZEpTT05TeW50YXhDaGFyKFpFUk8pOwotICAgICAgICAgIHJlYWRKU09OU3ludGF4Q2hhcihaRVJPKTsKLSAgICAgICAgICB0cmFuc18ucmVhZEFsbCh0bXBidWZfLCAwLCAyKTsKLSAgICAgICAgICBjaCA9IChieXRlKSgoaGV4VmFsKChieXRlKXRtcGJ1Zl9bMF0pIDw8IDQpICsgaGV4VmFsKHRtcGJ1Zl9bMV0pKTsKKyAgICAgICAgICB0cmFuc18ucmVhZEFsbCh0bXBidWZfLCAwLCA0KTsKKyAgICAgICAgICBzaG9ydCBjdSA9IChzaG9ydCkoCisgICAgICAgICAgICAgICgoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bMF0pIDw8IDEyKSArCisgICAgICAgICAgICAgICgoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bMV0pIDw8IDgpICsKKyAgICAgICAgICAgICAgKChzaG9ydCloZXhWYWwodG1wYnVmX1syXSkgPDwgNCkgKworICAgICAgICAgICAgICAoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bM10pKTsKKyAgICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKENoYXJhY3Rlci5pc0hpZ2hTdXJyb2dhdGUoKGNoYXIpY3UpKSB7CisgICAgICAgICAgICAgIGlmIChjb2RldW5pdHMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGxvdyBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIGNvZGV1bml0cy5hZGQoKGNoYXIpY3UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAoQ2hhcmFjdGVyLmlzTG93U3Vycm9nYXRlKChjaGFyKWN1KSkgeworICAgICAgICAgICAgICBpZiAoY29kZXVuaXRzLnNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgaGlnaCBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgY29kZXVuaXRzLmFkZCgoY2hhciljdSk7CisgICAgICAgICAgICAgIGFyci53cml0ZSgKKyAgICAgICAgICAgICAgICAgIChuZXcgU3RyaW5nKG5ldyBpbnRbXSB7IGNvZGV1bml0cy5nZXQoMCksIGNvZGV1bml0cy5nZXQoMSkgfSwKKyAgICAgICAgICAgICAgICAgICAgICAwLCAyKSkuZ2V0Qnl0ZXMoU3RhbmRhcmRDaGFyc2V0cy5VVEZfOCkpOworICAgICAgICAgICAgICBjb2RldW5pdHMuY2xlYXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICBhcnIud3JpdGUoKG5ldyBTdHJpbmcobmV3IGludFtdIHsgY3UgfSwgMCwgMSkpCisgICAgICAgICAgICAgICAgICAuZ2V0Qnl0ZXMoU3RhbmRhcmRDaGFyc2V0cy5VVEZfOCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAiSW52YWxpZCB1bmljb2RlIHNlcXVlbmNlIik7CisgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGVsc2UgewogICAgICAgICAgIGludCBvZmYgPSBFU0NBUEVfQ0hBUlMuaW5kZXhPZihjaCk7CkBAIC03MTIs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ZHMgPSBuOwogICAgICAgcmV0dXJuIHRoaXM7CiAgICAgfQogCisgICAgLyoqCisgICAgICogQHJldHVybiB3aGF0IHRoZSBtaW4gdGhyZWFkcyB3YXMgc2V0IHRvLgorICAgICAqIEBkZXByZWNhdGVkIHVzZSB7QGxpbmsgI2dldE1pbldvcmtlclRocmVhZHMoKX0gYW5kIHtAbGluayAjZ2V0TWF4V29ya2VyVGhyZWFkcygpfSBpbnN0ZWFkLgorICAgICAqLworICAgIEBEZXByZWNhdGVkCiAgICAgcHVibGljIGludCBnZXRXb3JrZXJUaHJlYWRzKCkgewotICAgICAgcmV0dXJuIHdvcmtlclRocmVhZHM7CisgICAgICByZXR1cm4gbWluV29ya2VyVGhyZWFkczsKKyAgICB9CisKKyAgICBwdWJsaWMgQXJncyBtaW5Xb3JrZXJUaHJlYWRzKGludCBuKSB7CisgICAgICBtaW5Xb3JrZXJUaHJlYWRzID0gbjsKKyAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBBcmdzIG1heFdvcmtlclRocmVhZHMoaW50IG4pIHsKKyAgICAgIG1heFdvcmtlclRocmVhZHMgPSBuOworICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRNaW5Xb3JrZXJUaHJlYWRzKCkgeworICAgICAgcmV0dXJuIG1pbldvcmtlclRocmVhZHM7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRNYXhXb3JrZXJUaHJlYWRzKCkgeworICAgICAgcmV0dXJuIG1heFdvcmtlclRocmVhZHM7CiAgICAgfQogCiAgICAgcHVibGljIGludCBnZXRTdG9wVGltZW91dFZhbCgpIHsKQEAgLTk5LDcgKzEzMSw3IEBACiAgIH0KIAogICAvKioKLSAgICogQGluaGVyaXREb2MKKyAgICoge0Bpbmhlcml0RG9jfQogICAgKi8KICAgQE92ZXJyaWRlCiAgIHByb3RlY3RlZCB2b2lkIHdhaXRGb3JTaHV0ZG93bigpIHsKQEAgLTExMSwxN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MpOwogCiAgICAgc3RvcFRpbWVvdXRVbml0ID0gYXJncy5zdG9wVGltZW91dFVuaXQ7CiAgICAgc3RvcFRpbWVvdXRWYWwgPSBhcmdzLnN0b3BUaW1lb3V0VmFsOworICAgIHJlcXVlc3RUaW1lb3V0VW5pdCA9IGFyZ3MucmVxdWVzdFRpbWVvdXRVbml0OworICAgIHJlcXVlc3RUaW1lb3V0ID0gYXJncy5yZXF1ZXN0VGltZW91dDsKKyAgICBiZUJhY2tvZmZTbG90SW5NaWxsaXMgPSBhcmdzLmJlQmFja29mZlNsb3RMZW5ndGhVbml0LnRvTWlsbGlzKGFyZ3MuYmVCYWNrb2ZmU2xvdExlbmd0aCk7CiAKICAgICBleGVjdXRvclNlcnZpY2VfID0gYXJncy5leGVjdXRvclNlcnZpY2UgIT0gbnVsbCA/CiAgICAgICAgIGFyZ3MuZXhlY3V0b3JTZXJ2aWNlIDogY3JlYXRlRGVmYXVsdEV4ZWN1dG9yU2VydmljZShhcmdzKTsKQEAgLTk2LDQ2ICsxNDAsODYgQEAKICAgICAgIG5ldyBTeW5jaHJvbm91c1F1ZXVlPFJ1bm5hYmxlPigpOwogICAgIHJldHVybiBuZXcgVGhyZWFkUG9vbEV4ZWN1dG9yKGFyZ3MubWluV29ya2VyVGhyZWFkcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzLm1heFdvcmtlclRocmVhZHMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGltZVVuaXQuU0VDT05EUywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzLnN0b3BUaW1lb3V0VmFsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3Muc3RvcFRpbWVvdXRVbml0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4ZWN1dG9yUXVldWUpOwogICB9CiAKLQotICBwdWJ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cG9ydF8uYWNjZXB0KCk7CiAgICAgICAgIFdvcmtlclByb2Nlc3Mgd3AgPSBuZXcgV29ya2VyUHJvY2VzcyhjbGllbnQpOworCisgICAgICAgIGludCByZXRyeUNvdW50ID0gMDsKKyAgICAgICAgbG9uZyByZW1haW5UaW1lSW5NaWxsaXMgPSByZXF1ZXN0VGltZW91dFVuaXQudG9NaWxsaXMocmVxdWVzdFRpbWVvdXQpOwogICAgICAgICB3aGlsZSh0cnVlKSB7Ci0gICAgICAgICAgaW50IHJlamVjdGlvbnMgPSAwOwogICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBleGVjdXRvclNlcnZpY2VfLmV4ZWN1dGUod3ApOwogICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgfSBjYXRjaChSZWplY3RlZEV4ZWN1dGlvbkV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgTE9HR0VSLndhcm4oIkV4ZWN1dG9yU2VydmljZSByZWplY3RlZCBjbGllbnQgIiArICgrK3JlamVjdGlvbnMpICsKLSAgICAgICAgICAgICAgICAiIHRpbWVzKHMpIiwgZXgpOwotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgVGltZVVuaXQuU0VDT05EUy5zbGVlcCgxKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgTE9HR0VSLndhcm4oIkludGVycnVwdGVkIHdoaWxlIHdhaXRpbmcgdG8gcGxhY2UgY2xpZW50IG9uIiArCi0gICAgICAgICAgICAgIAkJIiBleGVjdXRvciBxdWV1ZS4iKTsKLSAgICAgICAgICAgICAgVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5pbnRlcnJ1cHQoKTsKKyAgICAgICAgICB9IGNhdGNoKFRocm93YWJsZSB0KSB7CisgICAgICAgICAgICBpZiAodCBpbnN0YW5jZW9mIFJlamVjdGVkRXhlY3V0aW9uRXhjZXB0aW9uKSB7CisgICAgICAgICAgICAgIHJldHJ5Q291bnQrKzsKKyAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBpZiAocmVtYWluVGltZUluTWlsbGlzID4gMCkgeworICAgICAgICAgICAgICAgICAgLy9kbyBhIHRydW5jYXRlZCAyMCBiaW5hcnkgZXhwb25lbnRpYWwgYmFja29mZiBzbGVlcAorICAgICAgICAgICAgICAgICAgbG9uZyBzbGVlcFRpbWVJbk1pbGxpcyA9ICgobG9uZykgKHJhbmRvbS5uZXh0RG91YmxlKCkgKgorICAgICAgICAgICAgICAgICAgICAgICgxTCA8PCBNYXRoLm1pbihyZXRyeUNvdW50LCAyMCkpKSkgKiBiZUJhY2tvZmZTbG90SW5NaWxsaXM7CisgICAgICAgICAgICAgICAgICBzbGVlcFRpbWVJbk1pbGxpcyA9IE1hdGgubWluKHNsZWVwVGltZUluTWlsbGlzLCByZW1haW5UaW1lSW5NaWxsaXMpOworICAgICAgICAgICAgICAgICAgVGltZVVuaXQuTUlMTElTRUNPTkRTLnNsZWVwKHNsZWVwVGltZUluTWlsbGlzKTsKKyAgICAgICAgICAgICAgICAgIHJlbWFpblRpbWVJbk1pbGxpcyA9IHJlbWFpblRpbWVJbk1pbGxpcyAtIHNsZWVwVGltZUluTWlsbGlzOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICBjbGllbnQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgIHdwID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgIExPR0dFUi53YXJuKCJUYXNrIGhhcyBiZWVuIHJlamVjdGVkIGJ5IEV4ZWN1dG9yU2VydmljZSAiICsgcmV0cnlDb3VudAorICAgICAgICAgICAgICAgICAgICAgICsgIiB0aW1lcyB0aWxsIHRpbWVkb3V0LCByZWFzb246ICIgKyB0KTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExPR0dFUi53YXJuKCJJbnRlcnJ1cHRlZCB3aGlsZSB3YWl0aW5nIHRvIHBsYWNlIGNsaWVudCBvbiBleGVjdXRvciBxdWV1ZS4iKTsKKyAgICAgICAgICAgICAgICBUaHJlYWQuY3VycmVudFRocmVhZCgpLmludGVycnVwdCgpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKHQgaW5zdGFuY2VvZiBFcnJvcikgeworICAgICAgICAgICAgICBMT0dHRVIuZXJyb3IoIkV4ZWN1dG9yU2VydmljZSB0aHJldyBlcnJvcjogIiArIHQsIHQpOworICAgICAgICAgICAgICB0aHJvdyAoRXJyb3IpdDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgIC8vZm9yIG90aGVyIHBvc3NpYmxlIHJ1bnRpbWUgZXJyb3JzIGZyb20gRXhlY3V0b3JTZXJ2aWNlLCBzaG91bGQgYWxzbyBub3Qga2lsbCBzZXJ2ZQorICAgICAgICAgICAgICBMT0dHRVIud2FybigiRXhlY3V0b3JTZXJ2aWNlIHRocmV3IGVycm9yOiAiICsgdCwgdCk7CiAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICAgIH0KQEAgLTE0Nyw4ICsyMzEsMTAgQEAKICAgICAgICAgfQogICAgICAgfQogICAgIH0KLQotICAgIGV4ZWN1dG9yU2VydmljZV8uc2h1dGRvd24oKTsKKyAgfQorICAKKyAgcHJvdGVjdGVkIHZvaWQgd2FpdEZvclNodXRkb3duKCkgeworICAJZXhlY3V0b3JTZXJ2aWNlXy5zaHV0ZG93bigpOwogCiAgICAgLy8gTG9vcCB1bnRpbCBhd2FpdFRlcm1pbmF0aW9uIGZpbmFsbHkgZG9lcyByZXR1cm4gd2l0aG91dCBhIGludGVycnVwdGVkCiAgICAgLy8gZXhjZXB0aW9uL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QorICAgICAgU2VsZWN0b3IgbmV3U2VsZWN0b3IgPSBudWxsOworICAgICAgdHJ5IHsKKyAgICAgICAgbmV3U2VsZWN0b3IgPSBTZWxlY3Rvci5vcGVuKCk7CisgICAgICAgIExPR0dFUi53YXJuKCJDcmVhdGVkIG5ldyBTZWxlY3Rvci4iKTsKKyAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgTE9HR0VSLmVycm9yKCJDcmVhdGUgbmV3IFNlbGVjdG9yIGVycm9yLiIsIGUpOworICAgICAgfQorCisgICAgICBmb3IgKFNlbGVjdGlvbktleSBrZXkgOiBvbGRTZWxlY3Rvci5zZWxlY3RlZEtleXMoKSkgeworICAgICAgICBpZiAoIWtleS5pc1ZhbGlkKCkgJiYga2V5LnJlYWR5T3BzKCkgPT0gMCkKKyAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgU2VsZWN0YWJsZUNoYW5uZWwgY2hhbm5lbCA9IGtleS5jaGFubmVsKCk7CisgICAgICAgIE9iamVjdCBhdHRhY2htZW50ID0ga2V5LmF0dGFjaG1lbnQoKTsKKworICAgICAgICB0cnkgeworICAgICAgICAgIGlmIChhdHRhY2htZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIGNoYW5uZWwucmVnaXN0ZXIobmV3U2VsZWN0b3IsIGtleS5yZWFkeU9wcygpKTsKKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY2hhbm5lbC5yZWdpc3RlcihuZXdTZWxlY3Rvciwga2V5LnJlYWR5T3BzKCksIGF0dGFjaG1lbnQpOworICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoQ2xvc2VkQ2hhbm5lbEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgTE9HR0VSLmVycm9yKCJSZWdpc3RlciBuZXcgc2VsZWN0b3Iga2V5IGVycm9yLiIsIGUpOworICAgICAgICB9CisKKyAgICAgIH0KKworICAgICAgc2VsZWN0b3IgPSBuZXdTZWx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SkgeyBjaHVua19zaXplXyA9IGNodW5rX3NpemU7IH0KIAogICAgIHB1YmxpYyB2b2lkIHNraXAoaW50IHNpemUpIHtvZmZzZXRfICs9IHNpemU7IH0KICAgICBwdWJsaWMgdm9pZCBzZWVrKGxvbmcgb2Zmc2V0KSB7b2Zmc2V0XyA9IG9mZnNldDt9CkBAIC0xMDgsNyArMTA2LDcgQEAKICAgICBwdWJsaWMgbG9uZyBnZXRPZmZzZXQoKSB7IHJldHVybiAob2Zmc2V0Xyk7fQogICB9CiAKLSAgcHVibGljIHN0YXRpYyBlbnVtIHRhaWxQb2xpY3kgeworICBwdWJsaWMgc3RhdGljIGVudW0gVGFpbFBvbGljeSB7CiAKICAgICBOT1dBSVQoMCwgMCksCiAgICAgICBXQUlUX0ZPUkVWRVIoNTAwLCAtMSk7CkBAIC0xMzMsNyArMTMxLDcgQEAKICAgICAgKiBAcGFyYW0gcmV0cmllcyBudW1iZXIgb2YgcmV0cmllcwogICAgICAqLwogCi0gICAgdGFpbFBvbGljeShpbnQgdGltZW91dCwgaW50IHJldHJpZXMpIHsKKyAgICBUYWlsUG9saWN5KGludCB0aW1lb3V0LCBpbnQgcmV0cmllcykgewogICAgICAgdGltZW91dF8gPSB0aW1lb3V0OwogICAgICAgcmV0cmllc18gPSByZXRyaWVzOwogICAgIH0KQEAgLTE0Miw3ICsxNDAsNyBAQAogICAvKioKICAgICogQ3VycmVudCB0YWlsaW5nIHBvbGljeQogICAgKi8KLSAgdGFpbFBvbGljeSBjdXJyZW50UG9saWN5XyA9IHRhaWxQb2xpY3kuTk9XQUlUOworICBUYWlsUG9saWN5IGN1cnJlbnRQb2xpY3lfID0gVGFpbFBvbGljeS5OT1dBSVQ7CiAKIAogICAvKiogCkBAIC0xNjksMTIgKzE2Nyw3IEBACiAgIC8qKgogICAgKiBjdXJyZW50IENodW5rIHN0YXRlCiAgICAqLwotICBjaHVua1N0YXRlIGNzID0gbnVsbDsKLQotICAvKioKLSAgICogUmVhZCB0aW1lb3V0Ci0gICAqLwotICBwcml2YXRlIGludCByZWFkVGltZW91dF8gPSAwOworICBDaHVua1N0YXRlIGNzID0gbnVsbDsKIAogICAvKioKICAgICogaXMgcmVhZCBvbmx5PwpAQCAtMTg2LDcgKzE3OSw3IEBACiAgICAqIAogICAgKiBAcmV0dXJuIGN1cnJlbnQgcmVhZCBwb2xpY3kKICAgICovCi0gIHB1YmxpYyB0YWlsUG9saWN5IGdldFRhaWxQb2xpY3koKSB7CisgIHB1YmxpYyBUYWlsUG9saWN5IGdldFRhaWxQb2xpY3koKSB7CiAgICAgcmV0dXJuIChjdXJyZW50UG9saWN5Xyk7CiAgIH0KIApAQCAtMTk2LDggKzE4OSw4IEBACiAgICAqIEBwYXJhbSBwb2xpY3kgTmV3IHBvbGljeSB0byBzZXQKICAgICogQHJldHVybiBPbGQgcG9saWN5CiAgICAqLwotICBwdWJsaWMgdGFpbFBvbGljeSBzZXRUYWlsUG9saWN5KHRhaWxQb2xpY3kgcG9saWN5KSB7Ci0gICAgdGFpbFBvbGljeSBvbGQgPSBjdXJyZW50UG9saWN5XzsKKyAgcHVibGljIFRhaWxQb2xpY3kgc2V0VGFpbFBvbGljeShUYWlsUG9saWN5IHBvbGljeSkgeworICAgIFRhaWxQb2xpY3kgb2xkID0gY3VycmVudFBvbGljeV87CiAgICAgY3VycmVudFBvbGljeV8gPSBwb2xpY3k7CiAgICAgcmV0dXJuIChvbGQpOwogICB9CkBAIC0yMTIsMTAgKzIwNSwxMCBAQAogICAgIElucHV0U3RyZWFtIGlzOwogICAgIHRyeSB7CiAgICAgICBpZihpbnB1dFN0cmVhbV8gIT0gbnVsbCkgewotICAgICAgICAoKHRydW5jYWJsZUJ1ZmZlcmVkSW5wdXRTdHJlYW0paW5wdXRTdHJlYW1fKS50cnVuYygpOworICAgICAgICAoKFRydW5jYWJsZUJ1ZmZlcmVkSW5wdXRTdHJlYW0paW5wdXRTdHJlYW1fKS50cnVuYygpOwogICAgICAgICBpcyA9IGlucHV0U3RyZ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ICB9CisgICAgICAgIHRzLmxvYWQoaW4sCisgICAgICAgICAgICAgICAgKHBhcmFtcy50cnVzdFBhc3MgIT0gbnVsbCA/IHBhcmFtcy50cnVzdFBhc3MudG9DaGFyQXJyYXkoKSA6IG51bGwpKTsKICAgICAgICAgdG1mLmluaXQodHMpOwogICAgICAgfQogCiAgICAgICBpZiAocGFyYW1zLmlzS2V5U3RvcmVTZXQpIHsKICAgICAgICAga21mID0gS2V5TWFuYWdlckZhY3RvcnkuZ2V0SW5zdGFuY2UocGFyYW1zLmtleU1hbmFnZXJUeXBlKTsKICAgICAgICAgS2V5U3RvcmUga3MgPSBLZXlTdG9yZS5nZXRJbnN0YW5jZShwYXJhbXMua2V5U3RvcmVUeXBlKTsKLSAgICAgICAga3MubG9hZChuZXcgRmlsZUlucHV0U3RyZWFtKHBhcmFtcy5rZXlTdG9yZSksIHBhcmFtcy5rZXlQYXNzLnRvQ2hhckFycmF5KCkpOworICAgICAgICBpZiAocGFyYW1zLmtleVN0b3JlU3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgCWlzID0gcGFyYW1zLmtleVN0b3JlU3RyZWFtOworICAgICAgICB9IGVsc2UgeworICAgICAgICAJaXMgPSBnZXRTdG9yZUFzU3RyZWFtKHBhcmFtcy5rZXlTdG9yZSk7CisgICAgICAgIH0KKyAgICAgICAga3MubG9hZChpcywgcGFyYW1zLmtleVBhc3MudG9DaGFyQXJyYXkoKSk7CiAgICAgICAgIGttZi5pbml0KGtzLCBwYXJhbXMua2V5UGFzcy50b0NoYXJBcnJheSgpKTsKICAgICAgIH0KIApAQCAtMTk5LDEwICsyMjAsNTAgQEAKIAogICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigiRXJyb3IgY3JlYXRpbmcgdGhlIHRyYW5zcG9ydCIsIGUpOworICAgIH0gZmluYWxseSB7CisgICAgICBpZiAoaW4gIT0gbnVsbCkgeworICAgICAgICB0cnkgeworICAgICAgICAgIGluLmNsb3NlKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgICB9CisgICAgICBpZiAoaXMgIT0gbnVsbCkgeworICAgICAgICB0cnkgeworICAgICAgICAgIGlzLmNsb3NlKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgICB9CiAgICAgfQorCiAgICAgcmV0dXJuIGN0eDsKICAgfQogCisgIHByaXZhdGUgc3RhdGljIElucHV0U3RyZWFtIGdldFN0b3JlQXNTdHJlYW0oU3RyaW5nIHN0b3JlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgIHRyeSB7CisgICAgICByZXR1cm4gbmV3IEZpbGVJbnB1dFN0cmVhbShzdG9yZSk7CisgICAgfSBjYXRjaChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgIH0KKworICAgIElucHV0U3RyZWFtIHN0b3JlU3RyZWFtID0gbnVsbDsKKyAgICB0cnkgeworICAgICAgc3RvcmVTdHJlYW0gPSBuZXcgVVJMKHN0b3JlKS5vcGVuU3RyZWFtKCk7CisgICAgICBpZiAoc3RvcmVTdHJlYW0gIT0gbnVsbCkgeworICAgICAgICByZXR1cm4gc3RvcmVTdHJlYW07CisgICAgICB9CisgICAgfSBjYXRjaChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgIH0KKworICAgIHN0b3JlU3RyZWFtID0gVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5nZXRDb250ZXh0Q2xhc3NMb2FkZXIoKS5nZXRSZXNvdXJjZUFzU3RyZWFtKHN0b3JlKTsKKworICAgIGlmIChzdG9yZVN0cmVhbSAhPSBudWxsKSB7CisgICAgICByZXR1cm4gc3RvcmVTdHJl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FuZCBwYXNzd29yZAotICAgICAqIAorICAgICAqCiAgICAgICogQHBhcmFtIHRydXN0U3RvcmUgTG9jYXRpb24gb2YgdGhlIFRydXN0c3RvcmUgb24gZGlzawogICAgICAqIEBwYXJhbSB0cnVzdFBhc3MgVHJ1c3RzdG9yZSBwYXNzd29yZAogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldFRydXN0U3RvcmUoU3RyaW5nIHRydXN0U3RvcmUsIFN0cmluZyB0cnVzdFBhc3MpIHsKICAgICAgIHNldFRydXN0U3RvcmUodHJ1c3RTdG9yZSwgdHJ1c3RQYXNzLCBudWxsLCBudWxsKTsKICAgICB9CisgICAgCisgICAgLyoqCisgICAgICogU2V0IHRoZSB0cnVzdHN0b3JlIGFuZCBwYXNzd29yZAorICAgICAqCisgICAgICogQHBhcmFtIHRydXN0U3RvcmVTdHJlYW0gVHJ1c3RzdG9yZSBjb250ZW50IGlucHV0IHN0cmVhbQorICAgICAqIEBwYXJhbSB0cnVzdFBhc3MgVHJ1c3RzdG9yZSBwYXNzd29yZAorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFRydXN0U3RvcmUoSW5wdXRTdHJlYW0gdHJ1c3RTdG9yZVN0cmVhbSwgU3RyaW5nIHRydXN0UGFzcykgeworICAgICAgc2V0VHJ1c3RTdG9yZSh0cnVzdFN0b3JlU3RyZWFtLCB0cnVzdFBhc3MsIG51bGwsIG51bGwpOworICAgIH0KIAogICAgIC8qKgogICAgICAqIFNldCBpZiBjbGllbnQgYXV0aGVudGljYXRpb24gaXMgcmVxdWlyZWQKLSAgICAgKiAKKyAgICAgKgogICAgICAqIEBwYXJhbSBjbGllbnRBdXRoCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgcmVxdWlyZUNsaWVudEF1dGgoYm9vbGVhbiBjbGllbnRBdXRoKSB7CiAgICAgICB0aGlzLmNsaWVudEF1dGggPSBjbGllbnRBdXRoOwotICAgIH0KLSAgfQorCQl9CisJfQogfQpkaWZmIC0tZ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worICAgKi8KKyAgcHVibGljIFRTaW1wbGVGaWxlVHJhbnNwb3J0KFN0cmluZyBwYXRoKSB0aHJvd3MgVFRyYW5zcG9ydEV4Y2VwdGlvbiB7CisgICAgdGhpcyhwYXRoLCB0cnVlLCBmYWxzZSwgdHJ1ZSk7CisgIH0KKworICAvKioKKyAgICogVGVzdCBmaWxlIHN0YXR1cworICAgKgorICAgKiBAcmV0dXJuIHRydWUgaWYgb3Blbiwgb3RoZXJ3aXNlIGZhbHNlCisgICAqLworICBAT3ZlcnJpZGUKKyAgcHVibGljIGJvb2xlYW4gaXNPcGVuKCkgeworICAgIHJldHVybiAoZmlsZSAhPSBudWxsKTsKKyAgfQorCisgIC8qKgorICAgKiBPcGVuIGZpbGUgaWYgbm90IHByZXZpb3VzbHkgb3BlbmVkLiAKKyAgICoKKyAgICogQHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uIGlmIG9wZW4gZmFpbHMKKyAgICovCisgIEBPdmVycmlkZQorICBwdWJsaWMgdm9pZCBvcGVuKCkgdGhyb3dzIFRUcmFuc3BvcnRFeGNlcHRpb24geworICAgIGlmIChmaWxlID09IG51bGwpeworICAgICAgdHJ5IHsKKyAgICAgICAgU3RyaW5nIGFjY2VzcyA9ICJyIjsgICAgICAgLy9SYW5kb21BY2Nlc3NGaWxlIG9iamVjdHMgbXVzdCBiZSByZWFkYWJsZQorICAgICAgICBpZiAod3JpdGFibGUpIHsKKyAgICAgICAgICBhY2Nlc3MgKz0gInciOworICAgICAgICB9CisgICAgICAgIGZpbGUgPSBuZXcgUmFuZG9tQWNjZXNzRmlsZShwYXRoXywgYWNjZXNzKTsKKyAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGlvZSkgeworICAgICAgICBmaWxlID0gbnVsbDsKKyAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oaW9lLmdldE1lc3NhZ2UoKSk7CisgICAgICB9ICAgICAgCisgICAgfQorICB9CisKKyAgLyoq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uKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb3BlbigpIHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uIHsKKyAgICAgICAgdHJhbnNwb3J0Xy5vcGVuKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgY2xvc2UoKSB7CisgICAgICAgIHN1cGVyLmNsb3NlKCk7CisgICAgICAgIGlmICh0cmFuc3BvcnRfLmlzT3BlbigpKSB7CisgICAgICAgICAgICB0cmFuc3BvcnRfLmNsb3NlKCk7CisgICAgICAgIH0KKyAgICB9Cit9CisKK2NsYXNzIFRUcmFuc3BvcnRJbnB1dFN0cmVhbSBleHRlbmRzIElucHV0U3RyZWFtIHsKKworICAgIHByaXZhdGUgVFRyYW5zcG9ydCB0cmFuc3BvcnQgPSBudWxsOworCisgICAgcHVibGljIFRUcmFuc3BvcnRJbnB1dFN0cmVhbShUVHJhbnNwb3J0IHRyYW5zcG9ydCkgeworICAgICAgICB0aGlzLnRyYW5zcG9ydCA9IHRyYW5zcG9ydDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgaW50IHJlYWQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB0cnkgeworICAgICAgICAgICAgYnl0ZVtdIGJ1ZiA9IG5ldyBieXRlWzFdOworICAgICAgICAgICAgdHJhbnNwb3J0LnJlYWQoYnVmLCAwLCAxKTsKKyAgICAgICAgICAgIHJldHVybiBidWZbMF07CisgICAgICAgIH0gY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElPRXhjZXB0aW9uKGUpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCByZWFkKGJ5dGUgYltdLCBpbnQgb2ZmLCBpbnQgbGVuKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB0cnkg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tJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlCisgKiBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kIGxpbWl0YXRpb25zCisgKiB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCitwYWNrYWdlIG9yZy5hcGFjaGUudGhyaWZ0OworCitpbXBvcnQganVuaXQuZnJhbWV3b3JrLlRlc3RDYXNlOworaW1wb3J0IHRocmlmdC50ZXN0LmVudW1jb250YWluZXJzLkVudW1Db250YWluZXJzVGVzdENvbnN0YW50czsKK2ltcG9ydCB0aHJpZnQudGVzdC5lbnVtY29udGFpbmVycy5Hb2RCZWFuOworaW1wb3J0IHRocmlmdC50ZXN0LmVudW1jb250YWluZXJzLkdyZWVrR29kR29kZGVzczsKKworaW1wb3J0IGphdmEudXRpbC5FbnVtTWFwOworaW1wb3J0IGphdmEudXRpbC5FbnVtU2V0OworaW1wb3J0IGphdmEudXRpbC5IYXNoTWFwOworaW1wb3J0IGphdmEudXRpbC5IYXNoU2V0OworCitwdWJsaWMgY2xhc3MgVGVzdEVudW1Db250YWluZXJzIGV4dGVuZHMgVGVzdENhc2UgeworCisgICAgcHVibGljIHZvaWQgdGVzdEVudW1Db250YWluZXJzKCkgdGhyb3dzIEV4Y2VwdGlvbiB7CisgICAgICAgIGZpbmFsIEdvZEJlYW4gYjEgPSBuZXcgR29kQmVhbigpOworICAgICAgICBiMS5hZGRUb0dvZGRlc3MoR3JlZWtHb2RHb2RkZXNzLkhFUkEpOworICAgICAgICBiMS5nZXRHb2RkZXNzKCkuYWRkKEdyZWVrR29kR29kZGVzcy5BUEhST0RJVEUpOworICAgICAgICBiMS5wdXRUb1Bvd2VyKEdyZWVrR29kR29kZGVzcy5aRVVTLCAxMDAwKTsKKyAgICAgICAgYjEuZ2V0UG93ZXIoKS5wdXQoR3JlZWtHb2RHb2RkZXNzLkhFUkEsIDMzM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b25zdGFudHMuRE9VQkxFX0FTU0lHTkVEX1RPX05FR0FUSVZFX0lOVF9DT05TVEFOVF9URVNUKSwKKyAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9JTlRfQ09OU1RBTlQsCisgICAgICAgICAgICBEb3VibGVDb25zdGFudHNUZXN0Q29uc3RhbnRzLkRPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9JTlRfQ09OU1RBTlRfVEVTVCwgRVBTSUxPTik7CisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgIFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgQVNTRVJUSU9OX01FU1NBR0VfRk9SX1JFTkRFUkVEX0RPVUJMRV9DT05TVEFOVFNfVEVTVCwKKyAgICAgICAgICAgICAgICBFWFBFQ1RFRF9ET1VCTEVfQVNTSUdORURfVE9fTEFSR0VTVF9JTlRfQ09OU1RBTlQsCisgICAgICAgICAgICAgICAgRG91YmxlQ29uc3RhbnRzVGVzdENvbnN0YW50cy5ET1VCTEVfQVNTSUdORURfVE9fTEFSR0VTVF9JTlRfQ09OU1RBTlRfVEVTVCksCisgICAgICAgICAgICBFWFBFQ1RFRF9ET1VCTEVfQVNTSUdORURfVE9fTEFSR0VTVF9JTlRfQ09OU1RBTlQsCisgICAgICAgICAgICBEb3VibGVDb25zdGFudHNUZXN0Q29uc3RhbnRzLkRPVUJMRV9BU1NJR05FRF9UT19MQVJHRVNUX0lOVF9DT05TVEFOVF9URVNULCBFUFNJTE9OKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICBBU1NFUlRJT05fTUVTU0FHRV9GT1JfUkVOREVSRURfRE9VQkxFX0NPTlNUQU5UU19URVNULAorICAgICAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19TTUFMTEVTVF9JTlRfQ09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VEVTVCwKKyAgICAgICAgICAgICAgICBFWFBFQ1RFRF9ET1VCTEVfQVNTSUdORURfVE9fRlJBQ1RJT05BTF9ET1VCTEUsCisgICAgICAgICAgICAgICAgRG91YmxlQ29uc3RhbnRzVGVzdENvbnN0YW50cy5ET1VCTEVfQVNTSUdORURfVE9fRlJBQ1RJT05BTF9ET1VCTEVfVEVTVCksCisgICAgICAgICAgICBFWFBFQ1RFRF9ET1VCTEVfQVNTSUdORURfVE9fRlJBQ1RJT05BTF9ET1VCTEUsCisgICAgICAgICAgICBEb3VibGVDb25zdGFudHNUZXN0Q29uc3RhbnRzLkRPVUJMRV9BU1NJR05FRF9UT19GUkFDVElPTkFMX0RPVUJMRV9URVNULCBFUFNJTE9OKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICBBU1NFUlRJT05fTUVTU0FHRV9GT1JfUkVOREVSRURfRE9VQkxFX0NPTlNUQU5UU19URVNULAorICAgICAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9GUkFDVElPTkFMX0RPVUJMRSwKKyAgICAgICAgICAgICAgICBEb3VibGVDb25zdGFudHNUZXN0Q29uc3RhbnRzLkRPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9GUkFDVElPTkFMX0RPVUJMRV9URVNUKSwKKyAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9GUkFDVElPTkFMX0RPVUJMRSwKKyAgICAgICAgICAgIERvdWJsZUNvbnN0YW50c1Rlc3RDb25zdGFudHMuRE9VQkxFX0FTU0lHTkVEX1RPX05FR0FUSVZFX0ZSQUNUSU9OQUxfRE9VQkxFX1RFU1QsIEVQU0lMT04pOworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICBTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICA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bnQgcmVwID0gMDsgcmVwIDwgTlVNX1JFUFM7IHJlcCsrKSB7Ci0gICAgICAgIHMucHVzaCgoc2hvcnQpMSk7Ci0gICAgICAgIHMucHVzaCgoc2hvcnQpMTEpOwotICAgICAgICBzLnB1c2goKHNob3J0KTExMSk7Ci0gICAgICAgIHMucG9wKCk7Ci0gICAgICAgIHMucG9wKCk7Ci0gICAgICAgIHMucHVzaCgoc2hvcnQpMTIpOwotICAgICAgICBzLnB1c2goKHNob3J0KTEyMSk7Ci0gICAgICAgIHMucHVzaCgoc2hvcnQpMTIxMSk7Ci0gICAgICAgIHMucHVzaCgoc2hvcnQpMTIxMTEpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgICBzLnB1c2goKHNob3J0KTUpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgICBzLnBvcCgpOwotICAgICAgfQotICAgICAgbG9uZyBlbmQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiU2hvcnRTdGFjazogIiArIChlbmQtc3RhcnQpKTsKLQotICAgICAgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgIFN0YWNrPFNob3J0PiBzdGRTdGFjayA9IG5ldyBTdGFjazxTaG9ydD4oKTsKLSAgICAgIGZvciAoaW50IHJlcCA9IDA7IHJlcCA8IE5VTV9SRVBTOyByZXArKykgewotICAgICAgICBzdGRTdGFjay5wdXNoKChzaG9ydCkxKTsKLSAgICAgICAgc3RkU3RhY2sucHVzaCgoc2hvcnQpMTEpOwotICAgICAgICBzdGRTdGFjay5wdXNoKChzaG9ydCkxMTEpOwotICAgICAgICBzdGRTdGFjay5wb3AoKTsKLSAgICAgICAgc3RkU3RhY2sucG9wKCk7Ci0gICAgICAgIHN0ZFN0YWNrLnB1c2goKHNob3J0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ICAgICByZXR1cm5lZC5zZXQodHJ1ZSk7CisgICAgICAgIGxhdGNoLmNvdW50RG93bigpOwogICAgICAgfQogICAgIH0pOwogICAgIGxhdGNoLmF3YWl0KDEsIFRpbWVVbml0LlNFQ09ORFMpOwogICAgIGFzc2VydFRydWUocmV0dXJuZWQuZ2V0KCkpOwotICB9IAotICAKKyAgfQorCiAgIHB1YmxpYyB2b2lkIHRlc3RPbmV3YXlDYWxsKCkgdGhyb3dzIEV4Y2VwdGlvbiB7CiAgICAgZmluYWwgQ291bnREb3duTGF0Y2ggbGF0Y2ggPSBuZXcgQ291bnREb3duTGF0Y2goMSk7CiAgICAgZmluYWwgQXRvbWljQm9vbGVhbiByZXR1cm5lZCA9IG5ldyBBdG9taWNCb29sZWFuKGZhbHNlKTsKICAgICBTcnYuQXN5bmNDbGllbnQgY2xpZW50ID0gZ2V0Q2xpZW50KCk7Ci0gICAgY2xpZW50Lm9uZXdheU1ldGhvZChuZXcgRmFpbHVyZUxlc3NDYWxsYmFjazxvbmV3YXlNZXRob2RfY2FsbD4oKSB7CisgICAgY2xpZW50Lm9uZXdheU1ldGhvZChuZXcgRmFpbHVyZUxlc3NDYWxsYmFjazxWb2lkPigpIHsKICAgICAgIEBPdmVycmlkZQotICAgICAgcHVibGljIHZvaWQgb25Db21wbGV0ZShvbmV3YXlNZXRob2RfY2FsbCByZXNwb25zZSkgewotICAgICAgICB0cnkgewotICAgICAgICAgIHJlc3BvbnNlLmdldFJlc3VsdCgpOwotICAgICAgICAgIHJldHVybmVkLnNldCh0cnVlKTsKLSAgICAgICAgfSBjYXRjaCAoVEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgZmFpbChlKTsKLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICBsYXRjaC5jb3VudERvd24oKTsKLSAgICAgICAgfQorICAgICAgcHVibGljIHZvaWQgb25Db21wbGV0ZShWb2lkIHJlc3BvbnNlKSB7CisgICAgICAgIHJldHVybmVkLnNldCh0cnV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SAgICAgICAgICAgIAorICAgICAgICAgIGNsaWVudF8uSmFua3koMSwgbmV3IEFzeW5jTWV0aG9kQ2FsbGJhY2s8SW50ZWdlcj4oKSB7CisKICAgICAgICAgICAgIEBPdmVycmlkZQotICAgICAgICAgICAgcHVibGljIHZvaWQgb25Db21wbGV0ZShKYW5reV9jYWxsIHJlc3BvbnNlKSB7Ci0gICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDMsIHJlc3BvbnNlLmdldFJlc3VsdCgpKTsKLSAgICAgICAgICAgICAgICByZXR1cm5lZC5zZXQodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgbGF0Y2guY291bnREb3duKCk7Ci0gICAgICAgICAgICAgIH0gY2F0Y2ggKFRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIGxhdGNoLmNvdW50RG93bigpOwotICAgICAgICAgICAgICAgIGZhaWwoZSk7Ci0gICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ29tcGxldGUoSW50ZWdlciByZXN1bHQpIHsKKyAgICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDMsIHJlc3VsdC5pbnRWYWx1ZSgpKTsKKyAgICAgICAgICAgICAgcmV0dXJuZWQuc2V0KHRydWUpOworICAgICAgICAgICAgICBsYXRjaC5jb3VudERvd24oKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgQE92ZXJyaWRlCkBAIC0zMjEsNCArMzc1LDQgQEAKICAgICAgIH0KICAgICB9CiAgIH0KLX0KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCit9CmRpZmYgLS1naXQgYS9saWIvamF2YS90ZXN0L29yZy9hcGFjaGUvdGhyaWZ0L3Byb3RvY29sL1Byb3RvY29sVGVzdEJhc2UuamF2YSBiL2xpYi9qYXZhL3Rlc3Qvb3JnL2FwYWNoZS90aHJpZnQvcHJvdG9jb2wvUHJvdG9jb2xUZXN0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0LnByb3RvY29sOworCitpbXBvcnQganVuaXQuZnJhbWV3b3JrLlRlc3RDYXNlOworCitwdWJsaWMgY2xhc3MgVGVzdFNob3J0U3RhY2sgZXh0ZW5kcyBUZXN0Q2FzZSB7CisKKyAgcHVibGljIHZvaWQgdGVzdE9wcygpIHRocm93cyBFeGNlcHRpb24geworICAgIFNob3J0U3RhY2sgcyA9IG5ldyBTaG9ydFN0YWNrKDEpOworICAgIHMucHVzaCgoc2hvcnQpMTApOworICAgIHMucHVzaCgoc2hvcnQpMTEpOworICAgIHMucHVzaCgoc2hvcnQpMTIpOworICAgIGFzc2VydEVxdWFscygoc2hvcnQpMTIsIHMucG9wKCkpOworICAgIGFzc2VydEVxdWFscygoc2hvcnQpMTEsIHMucG9wKCkpOworICAgIHMucHVzaCgoc2hvcnQpNDApOworICAgIGFzc2VydEVxdWFscygoc2hvcnQpNDAsIHMucG9wKCkpOworICAgIGFzc2VydEVxdWFscygoc2hvcnQpMTAsIHMucG9wKCkpOworICAgIHRyeSB7CisgICAgICBzLnBvcCgpOworICAgICAgZmFpbCgic2hvdWxkIGhhdmUgdGhyb3duIGFuIGV4Y2VwdGlvbiEiKTsKKyAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgLy8geWF5CisgICAgfQorICB9Cit9CmRpZmYgLS1naXQgYS9saWIvamF2YS90ZXN0L29yZy9hcGFjaGUvdGhyaWZ0L3Byb3RvY29sL1Rlc3RUSlNPTlByb3RvY29sLmphdmEgYi9saWIvamF2YS90ZXN0L29yZy9hcGFjaGUvdGhyaWZ0L3Byb3RvY29sL1Rlc3RUSlNPTlByb3RvY29sLmphdmEKaW5kZXggZDczNzZhYy4uYzJjYTFmYSAxMDA2NDQKLS0tIGEvbGliL2phdmEvdGVzdC9vcmcvYXBhY2hlL3RocmlmdC9wcm90b2NvbC9UZXN0VEpTT05Qcm90b2NvbC5qYXZhCisrKyBiL2xpYi9qYXZhL3Rlc3Qvb3JnL2FwYWNoZS90aHJpZn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VzdEhhbmRsZXIoKSB7fQotICAKKwogICAgIHB1YmxpYyB2b2lkIHRlc3RWb2lkKCkgewogICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdFZvaWQoKVxuIik7CiAgICAgfQotICAKKwogICAgIHB1YmxpYyBTdHJpbmcgdGVzdFN0cmluZyhTdHJpbmcgdGhpbmcpIHsKICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3RTdHJpbmcoXCIiICsgdGhpbmcgKyAiXCIpXG4iKTsKICAgICAgIHJldHVybiB0aGluZzsKICAgICB9Ci0gIAorCisgICAgcHVibGljIGJvb2xlYW4gdGVzdEJvb2woYm9vbGVhbiB0aGluZykgeworICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEJvb2woIiArIHRoaW5nICsgIilcbiIpOworICAgICAgcmV0dXJuIHRoaW5nOworICAgIH0KKwogICAgIHB1YmxpYyBieXRlIHRlc3RCeXRlKGJ5dGUgdGhpbmcpIHsKICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3RCeXRlKCIgKyB0aGluZyArICIpXG4iKTsKICAgICAgIHJldHVybiB0aGluZzsKICAgICB9Ci0gIAorCiAgICAgcHVibGljIGludCB0ZXN0STMyKGludCB0aGluZykgewogICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEkzMigiICsgdGhpbmcgKyAiKVxuIik7CiAgICAgICByZXR1cm4gdGhpbmc7CiAgICAgfQotICAKKwogICAgIHB1YmxpYyBsb25nIHRlc3RJNjQobG9uZyB0aGluZykgewogICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEk2NCgiICsgdGhpbmcgKyAiKVxuIik7CiAgICAgICByZXR1cm4gdGhpbmc7CiAgICAgfQotICAKKwogICAgIHB1YmxpYyBkb3VibGUgdGVzdERvdWJsZShkb3VibGUgdGhpbmcpIHsKICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3REb3VibGUoIiArIHRoaW5nICsgIilcbiIpOwogICAgICAgcmV0dXJuIHRoaW5nOwogICAgIH0KLSAgCisKKyAgICBwdWJsaWMgQnl0ZUJ1ZmZlciB0ZXN0QmluYXJ5KEJ5dGVCdWZmZXIgdGhpbmcpIHsKKyAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcih0aGluZy5yZW1haW5pbmcoKSAqIDMpOworICAgICAgdGhpbmcubWFyaygpOworICAgICAgd2hpbGUgKHRoaW5nLnJlbWFpbmluZygpID4gMCkgeworICAgICAgICBzYi5hcHBlbmQoU3RyaW5nLmZvcm1hdCgiJTAyWCAiLCB0aGluZy5nZXQoKSkpOworICAgICAgfQorICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEJpbmFyeSgiICsgc2IudG9TdHJpbmcoKSArICIpXG4iKTsKKyAgICAgIHRoaW5nLnJlc2V0KCk7CisgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCiAgICAgcHVibGljIFh0cnVjdCB0ZXN0U3RydWN0KFh0cnVjdCB0aGluZykgewogICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdFN0cnVjdCh7IiArCiAgICAgICAgICAgICAgICAgICAgICAgICJcIiIgKyB0aGluZy5zdHJpbmdfdGhpbmcgKyAiXCIsICIgKwpAQCAtOTIsNyArMTEwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgdGhpbmcuaTY0X3RoaW5nICsgIn0pXG4iKTsKICAgICAgIHJldHVybiB0aGluZzsKICAgICB9Ci0gIAorCiAgICAgcHVibGljIFh0cnVjdDIgdGVzdE5lc3QoWHRydWN0MiBuZXN0KSB7CiAgICAgICBYdHJ1Y3QgdGhpbmcgPSBuZXN0LnN0cnVjdF90aGluZzsKICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3ROZXN0KHsiICsKQEAgLTEwNCw3ICsxMjIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICBuZXN0LmkzMl90aGluZyArICJ9KVxuIik7CiAgICAgICByZXR1cm4gbmVzdDsKICAgICB9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VxdWFscygibXVsdGkiKSkgeworICAgICAgfSBlbHNlIGlmIChwcm90b2NvbF90eXBlLmVxdWFscygibXVsdGljIikpIHsKKyAgICAgIH0gZWxzZSBpZiAocHJvdG9jb2xfdHlwZS5lcXVhbHMoIm11bHRpaiIpKSB7CiAgICAgICB9IGVsc2UgewotICAgICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCJVbmtub3duIHByb3RvY29sIHR5cGUhICIgKyBwcm90b2NvbF90eXBlKTsgCisgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oIlVua25vd24gcHJvdG9jb2wgdHlwZSEgIiArIHByb3RvY29sX3R5cGUpOwogICAgICAgfQogICAgICAgaWYgKHRyYW5zcG9ydF90eXBlLmVxdWFscygiYnVmZmVyZWQiKSkgewogICAgICAgfSBlbHNlIGlmICh0cmFuc3BvcnRfdHlwZS5lcXVhbHMoImZyYW1lZCIpKSB7CkBAIC0xMTksNyArMTM4LDcgQEAKICAgICAgIH0KICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewogICAgICAgU3lzdGVtLmVyci5wcmludGxuKCJFcnJvcjogIiArIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgIFN5c3RlbS5leGl0KDEpOworICAgICAgU3lzdGVtLmV4aXQoRVJSX1VOS05PV04pOwogICAgIH0KIAogICAgIFRUcmFuc3BvcnQgdHJhbnNwb3J0ID0gbnVsbDsKQEAgLTE0NiwyNyArMTY1LDMyIEBACiAgICAgICB9CiAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIHgpIHsKICAgICAgIHgucHJpbnRTdGFja1RyYWNlKCk7Ci0gICAgICBTeXN0ZW0uZXhpdCgxKTsKKyAgICAgIFN5c3RlbS5leGl0KEVSUl9VTktOT1dOKTsKICAgICB9CiAKICAgICBUUHJvdG9jb2wgdFByb3RvY29sID0gbnVsbDsKLSAgICBpZiAocHJvdG9jb2xfdHlwZS5lcXVhbHMoImpzb24iKSkgeworICAgIFRQcm90b2NvbCB0UHJv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RpbWVUb3QgPSAwOwogCi0gICAgaW50IGZhaWxDb3VudCA9IDA7CisgICAgaW50IHJldHVybkNvZGUgPSAwOwogICAgIGZvciAoaW50IHRlc3QgPSAwOyB0ZXN0IDwgbnVtVGVzdHM7ICsrdGVzdCkgewogICAgICAgdHJ5IHsKICAgICAgICAgLyoqCkBAIC0xODAsNyArMjA0LDcgQEAKICAgICAgICAgICB9IGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uIHR0eCkgewogICAgICAgICAgICAgdHR4LnByaW50U3RhY2tUcmFjZSgpOwogICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJDb25uZWN0IGZhaWxlZDogIiArIHR0eC5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgU3lzdGVtLmV4aXQoMSk7CisgICAgICAgICAgICBTeXN0ZW0uZXhpdChFUlJfVU5LTk9XTik7CiAgICAgICAgICAgfQogICAgICAgICB9CiAKQEAgLTE5NSw3ICsyMTksNyBAQAogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiA9IHZvaWRcbiIpOwogICAgICAgICB9IGNhdGNoIChUQXBwbGljYXRpb25FeGNlcHRpb24gdGF4KSB7CiAgICAgICAgICAgdGF4LnByaW50U3RhY2tUcmFjZSgpOwotICAgICAgICAgIGZhaWxDb3VudCsrOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0JBU0VUWVBFUzsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgpAQCAtMjA1LDE5ICsyMjksMzIgQEAKICAgICAgICAgU3RyaW5nIHMgPSB0ZXN0Q2xpZW50LnRlc3RTdHJpbmcoIlRlc3QiKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0gXCIiICsgcyArICJcIlxuIik7CiAgICAgICAgIGlmICghcy5lcXVhbHMoIlRlc3QiKSkgewotICAgICAgICAgIGZhaWxDb3VudCsrOwotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgorICAgICAgICAgKiBNdWx0aXBsZXhlZCB0ZXN0CisgICAgICAgICAqLworICAgICAgICBpZiAocHJvdG9jb2xfdHlwZS5zdGFydHNXaXRoKCJtdWx0aSIpKSB7CisgICAgICAgICAgU2Vjb25kU2VydmljZS5DbGllbnQgc2Vjb25kQ2xpZW50ID0gbmV3IFNlY29uZFNlcnZpY2UuQ2xpZW50KHRQcm90b2NvbDIpOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInNlY29uZHRlc3RTdHJpbmcoXCJUZXN0MlwiKSIpOworICAgICAgICAgIHMgPSBzZWNvbmRDbGllbnQuc2Vjb25kdGVzdFN0cmluZygiVGVzdDIiKTsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSBcIiIgKyBzICsgIlwiXG4iKTsKKyAgICAgICAgICBpZiAoIXMuZXF1YWxzKCJ0ZXN0U3RyaW5nKFwiVGVzdDJcIikiKSkgeworICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfUFJPVE9DT0xTOworICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvKioKICAgICAgICAgICogQllURSBURVNUCiAgICAgICAgICAqLwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ0ZXN0Qnl0ZSgxKSIpOwogICAgICAgICBieXRlIGk4ID0gdGVzdENsaWVudC50ZXN0Qnl0ZSgoYnl0ZSkxKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0gIiArIGk4ICsgIlxuIik7CiAgICAgICAgIGlmIChpOCAhPSAxKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7IAotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgpAQCAtMjI3LDggKzI2NCw4IEBACiAgICAgICAgIGludCBpMzIgPSB0ZXN0Q2xpZW50LnRlc3RJMzIoLTEpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSAiICsgaTMyICsgIlxuIik7CiAgICAgICAgIGlmIChpMzIgIT0gLTEpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsgCi0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9CQVNFVFlQRVM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgLyoqCkBAIC0yMzgsOCArMjc1LDggQEAKICAgICAgICAgbG9uZyBpNjQgPSB0ZXN0Q2xpZW50LnRlc3RJNjQoLTM0MzU5NzM4MzY4TCk7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiA9ICIgKyBpNjQgKyAiXG4iKTsKICAgICAgICAgaWYgKGk2NCAhPSAtMzQzNTk3MzgzNjhMKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7Ci0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9CQVNFVFlQRVM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgLyoqCkBAIC0yNDksOCArMjg2LDM5IEBACiAgICAgICAgIGRvdWJsZSBkdWIgPSB0ZXN0Q2xpZW50LnRlc3REb3VibGUoLTUuMzI1MDk4MjM1KTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0gIiArIGR1YiArICJcbiIpOwogICAgICAgICBpZiAoTWF0aC5hYnMoZHViIC0gKC01LjMyNTA5ODIzNSkpID4gMC4wMDEpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkZBSUxVUkVcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0JBU0VUWVBFUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQklOQVJZIFRFU1QKKyAgICAgICAgICovCisgICAgICAgIHRyeSB7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEJpbmFyeSgtMTI4Li4uMTI3KSA9ICIpOworICAgICAgICAgIGJ5dGVbXSBkYXRhID0gbmV3IGJ5dGVbXSB7LTEyOCwgLTEyNywgLTEyNiwgLTEyNSwgLTEyNCwgLTEyMywgLTEyMiwgLTEyMSwgLTEyMCwgLTExOSwgLTExOCwgLTExNywgLTExNiwgLTExNSwgLTExNCwgLTExMywgLTExMiwgLTExMSwgLTExMCwgLTEwOSwgLTEwOCwgLTEwNywgLTEwNiwgLTEwNSwgLTEwNCwgLTEwMywgLTEwMiwgLTEwMSwgLTEwMCwgLTk5LCAtOTgsIC05NywgLTk2LCAtOTUsIC05NCwgLTkzLCAtOTIsIC05MSwgLTkwLCAtODksIC04OCwgLTg3LCAtODYsIC04NSwgLTg0LCAtODMsIC04MiwgLTgxLCAtODAsIC03OSwgLTc4LCAtNzcsIC03NiwgLTc1LCAtNzQsIC03MywgLTcyLCAtNzEsIC03MCwgLTY5LCAtNjgsIC02NywgLTY2LCAtNjUsIC02NCw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xMTksIDEyMCwgMTIxLCAxMjIsIDEyMywgMTI0LCAxMjUsIDEyNiwgMTI3fTsKKyAgICAgICAgICBCeXRlQnVmZmVyIGJpbiA9IHRlc3RDbGllbnQudGVzdEJpbmFyeShCeXRlQnVmZmVyLndyYXAoZGF0YSkpOworICAgICAgICAgIGJpbi5tYXJrKCk7CisgICAgICAgICAgYnl0ZVtdIGJ5dGVzID0gbmV3IGJ5dGVbYmluLmxpbWl0KCkgLSBiaW4ucG9zaXRpb24oKV07CisgICAgICAgICAgYmluLmdldChieXRlcyk7CisgICAgICAgICAgYmluLnJlc2V0KCk7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgieyIpOworICAgICAgICAgIGJvb2xlYW4gZmlyc3QgPSB0cnVlOworICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoOyArK2kpIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiLCAiKTsKKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoYnl0ZXNbaV0pOworICAgICAgICAgIH0KKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIn0iKTsKKyAgICAgICAgICBpZiAoIUJ5dGVCdWZmZXIud3JhcChkYXRhKS5lcXVhbHMoYmluKSkgeworICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiXG4qKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIGV4LnByaW50U3RhY2tUcmFjZShTeXN0ZW0ub3V0KTsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgpAQCAtMjYzLDE0ICszMzEsMTQgQEAKICAgICAgICAgb3V0LmkzMl90aGluZyA9IC0zOwogICAgICAgICBvdXQuaTY0X3RoaW5nID0gLTU7CiAgICAgICAgIFh0cnVjdCBpbiA9IHRlc3RDbGllbnQudGVzdFN0cnVjdChvdXQpOwotICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSB7IiArICJcIiIgKyAKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbi5zdHJpbmdfdGhpbmcgKyAiXCIsIiArIAotICAgICAgICAgICAgICAgICAgICAgICAgIGluLmJ5dGVfdGhpbmcgKyAiLCAiICsgCi0gICAgICAgICAgICAgICAgICAgICAgICAgaW4uaTMyX3RoaW5nICsgIiwgIiArIAorICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSB7IiArICJcIiIgKworICAgICAgICAgICAgICAgICAgICAgICAgIGluLnN0cmluZ190aGluZyArICJcIiwiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICBpbi5ieXRlX3RoaW5nICsgIiwgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgaW4uaTMyX3RoaW5nICsgIiwgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgaW4uaTY0X3RoaW5nICsgIn1cbiIpOwogICAgICAgICBpZiAoIWluLmVxdWFscyhvdXQpKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7IAotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CiAgICAgICAgIH0KIAogICAgICAgICAvKioKQEAgLTI4MywxNSArMzUxLDE1IEBACiAgICAgICAgIG91dDIuaTMyX3RoaW5nID0gNTsKICAgICAgICAgWHRydWN0MiBpbjIgPSB0ZXN0Q2xpZW50LnRlc3ROZXN0KG91dDIpOwogICAgICAgICBpbiA9IGluMi5zdHJ1Y3RfdGhpbmc7Ci0gICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiA9IHsiICsgaW4yLmJ5dGVfdGhpbmcgKyAiLCB7IiArICJcIiIgKyAKLSAgICAgICAgICAgICAgICAgICAgICAgICBpbi5zdHJpbmdfdGhpbmcgKyAiXCIsICIgKyAKKyAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0geyIgKyBpbjIuYnl0ZV90aGluZyArICIsIHsiICsgIlwiIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgaW4uc3RyaW5nX3RoaW5nICsgIlwiLCAiICsKICAgICAgICAgICAgICAgICAgICAgICAgICBpbi5ieXRlX3RoaW5nICsgIiwgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgaW4uaTMyX3RoaW5nICsgIiwgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgaW4uaTY0X3RoaW5nICsgIn0sICIgKwogICAgICAgICAgICAgICAgICAgICAgICAgIGluMi5pMzJfdGhpbmcgKyAifVxuIik7CiAgICAgICAgIGlmICghaW4yLmVxdWFscyhvdXQyKSkgewotICAgICAgICAgIGZhaWxDb3VudCsrOwotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CiAgICAgICAgIH0KIAogICAgICAgICAvKioKQEAgLTMyNSwxNCArMzkzLDQ4IEBACiAgICAgICAgIH0KICAgICAgICAgU3lzdGVtLm91dC5wcmludCgifVxuIik7CiAgICAgICAgIGlmICghbWFwb3V0LmVxdWFscyhtYXBpbikpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsgCi0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBTVFJJTkcgTUFQIFRFU1QKLSAgICAgICAgICogIG1pc3NpbmcKICAgICAgICAgICovCisgICAgICAgIHRyeSB7CisgICAgICAgICAgTWFwPFN0cmluZywgU3RyaW5nPiBzbWFwb3V0ID0gbmV3IEhhc2hNYXA8U3RyaW5nLCBTdHJpbmc+KCk7CisgICAgICAgICAgc21hcG91dC5wdXQoImEiLCAiMiIpOworICAgICAgICAgIHNtYXBvdXQucHV0KCJiIiwgImJsYWgiKTsKKyAgICAgICAgICBzbWFwb3V0LnB1dCgic29tZSIsICJ0aGluZyIpOworICAgICAgICAgIGZvciAoU3RyaW5nIGtleSA6IHNtYXBvdXQua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiLCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoa2V5ICsgIiA9PiAiICsgc21hcG91dC5nZXQoa2V5KSk7CisgICAgICAgICAgfQorICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIn0pIik7CisgICAgICAgICAgTWFwPFN0cmluZywgU3RyaW5nPiBzbWFwaW4gPSB0ZXN0Q2xpZW50LnRlc3RTdHJpbmdNYXAoc21hcG91dCk7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0geyIpOworICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICBmb3IgKFN0cmluZyBrZXkgOiBzbWFwaW4ua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiLCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoa2V5ICsgIiA9PiAiICsgc21hcG91dC5nZXQoa2V5KSk7CisgICAgICAgICAgfQorICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIn1cbiIpOworICAgICAgICAgIGlmICghc21hcG91dC5lcXVhbHMoc21hcGluKSkgeworICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQ09OVEFJTkVSUzsKKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKKyAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBleCkgeworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0NPTlRBSU5FUlM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIGV4LnByaW50U3RhY2tUcmFjZShTeXN0ZW0ub3V0KTsKKyAgICAgICAgfQogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBTRVQgVEVTVApAQCAtMzY1LDggKzQ2Nyw4IEBACiAgICAgICAgIH0KICAgICAgICAgU3lzdGVtLm91dC5wcmludCgifVxuIik7CiAgICAgICAgIGlmICghc2V0b3V0LmVxdWFscyhzZXRpbikpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsgCi0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKICAgICAgICAgfQogCiAgICAgICAgIC8qKgpAQCAtNDAwLDggKzUwMiw4IEBACiAgICAgICAgIH0KICAgICAgICAgU3lzdGVtLm91dC5wcmludCgifVxuIik7CiAgICAgICAgIGlmICghbGlzdG91dC5lcXVhbHMobGlzdGluKSkgewotICAgICAgICAgIGZhaWxDb3VudCsrOyAKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkZBSUxVUkVcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0NPTlRBSU5FUlM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgLyoqCkBAIC00MTEsNDAgKzUxMyw0MCBAQAogICAgICAgICBOdW1iZXJ6IHJldCA9IHRlc3RDbGllbnQudGVzdEVudW0oTnVtYmVyei5PTkUpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSAiICsgcmV0ICsgIlxuIik7CiAgICAgICAgIGlmIChyZXQgIT0gTnVtYmVyei5PTkUpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkZBSUxVUkVcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX1NUUlVDVFM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEVudW0oVFdPKSIpOwogICAgICAgICByZXQgPSB0ZXN0Q2xpZW50LnRlc3RFbnVtKE51bWJlcnouVFdPKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0gIiArIHJldCArICJcbiIpOwogICAgICAgICBpZiAocmV0ICE9IE51bWJlcnouVFdPKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7IAotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CiAgICAgICAgIH0KIAogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ0ZXN0RW51bShUSFJFRSkiKTsKICAgICAgICAgcmV0ID0gdGVzdENsaWVudC50ZXN0RW51bShOdW1iZXJ6LlRIUkVFKTsKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiID0gIiArIHJldCArICJcbiIpOwogICAgICAgICBpZiAocmV0ICE9IE51bWJlcnouVEhSRUUpIHsKLSAgICAgICAgICBmYWlsQ291bnQrKzsKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkZBSUxVUkVcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX1NUUlVDVFM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEVudW0oRklWRSkiKTsKICAgICAgICAgcmV0ID0gdGVzdENsaWVudC50ZXN0RW51bShOdW1iZXJ6LkZJVkUpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSAiICsgcmV0ICsgIlxuIik7CiAgICAgICAgIGlmIChyZXQgIT0gTnVtYmVyei5GSVZFKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7Ci0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9TVFJVQ1RTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKICAgICAgICAgfQogCiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3RFbnVtKEVJR0hUKSIpOwogICAgICAgICByZXQgPSB0ZXN0Q2xpZW50LnRlc3RFbnVtKE51bWJlcnouRUlHSFQpOwogICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSAiICsgcmV0ICsgIlxuIik7CiAgICAgICAgIGlmIChyZXQgIT0gTnVtYmVyei5FSUdIVCkgewotICAgICAgICAgIGZhaWxDb3VudCsrOwotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRkFJTFVSRVxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CiAgICAgICAgIH0KIAogICAgICAgICAvKioKQEAgLTQ1NCw4ICs1NTYsOCBAQAogICAgICAgICBsb25nIHVpZCA9IHRlc3RDbGllbnQudGVzdFR5cGVkZWYoMzA5ODU4MjM1MDgyNTIzTCk7CiAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiA9ICIgKyB1aWQgKyAiXG4iKTsKICAgICAgICAgaWYgKHVpZCAhPSAzMDk4NTgyMzUwODI1MjNMKSB7Ci0gICAgICAgICAgZmFpbENvdW50Kys7Ci0gICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJGQUlMVVJFXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9CQVNFVFlQRVM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOwogICAgICAgICB9CiAKICAgICAgICAgLyoqCkBAIC00NzQsMTIxICs1NzYsMTc0IEBACiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgifSwgIik7CiAgICAgICAgIH0KICAgICAgICAgU3lzdGVtLm91dC5wcmludCgifVxuIik7CisgICAgICAgIGlmIChtbS5zaXplKCkgIT0gMiB8fCAhbW0uY29udGFpbnNLZXkoNCkgfHwgIW1tLmNvbnRhaW5zS2V5KC00KSkgeworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0NPTlRBSU5FUlM7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIE1hcDxJbnRlZ2VyLCBJbnRlZ2VyPiBtMSA9IG1tLmdldCg0KTsKKyAgICAgICAgICBNYXA8SW50ZWdlciwgSW50ZWdlcj4gbTIgPSBtbS5nZXQoLTQpOworICAgICAgICAgIGlmIChtMS5nZXQoMSkgIT0gMSB8fCBtMS5nZXQoMikgIT0gMiB8fCBtMS5nZXQoMykgIT0gMyB8fCBtMS5nZXQoNCkgIT0gNCB8fAorICAgICAgICAgICAgICBtMi5nZXQoLTEpICE9IC0xIHx8IG0yLmdldCgtMikgIT0gLTIgfHwgbTIuZ2V0KC0zKSAhPSAtMyB8fCBtMi5nZXQoLTQpICE9IC00KSB7CisgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIqKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIH0KKyAgICAgICAgfQogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBJTlNBTklUWSBURVNUCiAgICAgICAgICAqLwotICAgICAgICBpbnNhbmUgPSBuZXcgSW5zYW5pdHkoKTsKLSAgICAgICAgaW5zYW5lLnVzZXJNYXAgPSBuZXcgSGFzaE1hcDxOdW1iZXJ6LCBMb25nPigpOwotICAgICAgICBpbnNhbmUudXNlck1hcC5wdXQoTnVtYmVyei5GSVZFLCAobG9uZyk1MDAwKTsKLSAgICAgICAgWHRydWN0IHRydWNrID0gbmV3IFh0cnVjdCgpOwotICAgICAgICB0cnVjay5zdHJpbmdfdGhpbmcgPSAiVHJ1Y2siOwotICAgICAgICB0cnVjay5ieXRlX3RoaW5nID0gKGJ5dGUpODsKLSAgICAgICAgdHJ1Y2suaTMyX3RoaW5nID0gODsKLSAgICAgICAgdHJ1Y2suaTY0X3RoaW5nID0gODsKLSAgICAgICAgaW5zYW5lLnh0cnVjdHMgPSBuZXcgQXJyYXlMaXN0PFh0cnVjdD4oKTsKLSAgICAgICAgaW5zYW5lLnh0cnVjdHMuYWRkKHRydWNrKTsKLSAgICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdEluc2FuaXR5KCkiKTsKLSAgICAgICAgTWFwPExvbmcsTWFwPE51bWJlcnosSW5zYW5pdHk+PiB3aG9hID0KLSAgICAgICAgICB0ZXN0Q2xpZW50LnRlc3RJbnNhbml0eShpbnNhbmUpOwotICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgPSB7Iik7Ci0gICAgICAgIGZvciAobG9uZyBrZXkgOiB3aG9hLmtleVNldCgpKSB7Ci0gICAgICAgICAgTWFwPE51bWJlcnosSW5zYW5pdHk+IHZhbCA9IHdob2EuZ2V0KGtleSk7Ci0gICAgICAgICAgU3lzdGVtLm91dC5wcmludChrZXkgKyAiID0+IHsiKTsKIAotICAgICAgICAgIGZvciAoTnVtYmVyeiBrMiA6IHZhbC5rZXlTZXQoKSkgewotICAgICAgICAgICAgSW5zYW5pdHkgdjIgPSB2YWwuZ2V0KGsyKTsKLSAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoazIgKyAiID0+IHsiKTsKLSAgICAgICAgICAgIE1hcDxOdW1iZXJ6LCBMb25nPiB1c2VyTWFwID0gdjIudXNlck1hcDsKLSAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInsiKTsKLSAgICAgICAgICAgIGlmICh1c2VyTWFwICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgZm9yIChOdW1iZXJ6IGszIDogdXNlck1hcC5rZXlTZXQoKSkgewotICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoazMgKyAiID0+ICIgKyB1c2VyTWFwLmdldChrMykgKyAiLCAiKTsKKyAgICAgICAgYm9vbGVhbiBpbnNhbml0eUZhaWxlZCA9IHRydWU7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgWHRydWN0IGhlbGxvID0gbmV3IFh0cnVjdCgpOworICAgICAgICAgIGhlbGxvLnN0cmluZ190aGluZyA9ICJIZWxsbzIiOworICAgICAgICAgIGhlbGxvLmJ5dGVfdGhpbmcgPSAyOworICAgICAgICAgIGhlbGxvLmkzMl90aGluZyA9IDI7CisgICAgICAgICAgaGVsbG8uaTY0X3RoaW5nID0gMjsKKworICAgICAgICAgIFh0cnVjdCBnb29kYnllID0gbmV3IFh0cnVjdCgpOworICAgICAgICAgIGdvb2RieWUuc3RyaW5nX3RoaW5nID0gIkdvb2RieWU0IjsKKyAgICAgICAgICBnb29kYnllLmJ5dGVfdGhpbmcgPSAoYnl0ZSk0OworICAgICAgICAgIGdvb2RieWUuaTMyX3RoaW5nID0gNDsKKyAgICAgICAgICBnb29kYnllLmk2NF90aGluZyA9IChsb25nKTQ7CisKKyAgICAgICAgICBpbnNhbmUudXNlck1hcCA9IG5ldyBIYXNoTWFwPE51bWJlcnosIExvbmc+KCk7CisgICAgICAgICAgaW5zYW5lLnVzZXJNYXAucHV0KE51bWJlcnouRUlHSFQsIChsb25nKTgpOworICAgICAgICAgIGluc2FuZS51c2VyTWFwLnB1dChOdW1iZXJ6LkZJVkUsIChsb25nKTUpOworICAgICAgICAgIGluc2FuZS54dHJ1Y3RzID0gbmV3IEFycmF5TGlzdDxYdHJ1Y3Q+KCk7CisgICAgICAgICAgaW5zYW5lLnh0cnVjdHMuYWRkKGdvb2RieWUpOworICAgICAgICAgIGluc2FuZS54dHJ1Y3RzLmFkZChoZWxsbyk7CisKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ0ZXN0SW5zYW5pdHkoKSIpOworICAgICAgICAgIE1hcDxMb25nLE1hcDxOdW1iZXJ6LEluc2FuaXR5Pj4gd2hvYSA9CisgICAgICAgICAgICB0ZXN0Q2xpZW50LnRlc3RJbnNhbml0eShpbnNhbmUpOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiA9IHsiKTsKKyAgICAgICAgICBmb3IgKGxvbmcga2V5IDogd2hvYS5rZXlTZXQoKSkgeworICAgICAgICAgICAgTWFwPE51bWJlcnosSW5zYW5pdHk+IHZhbCA9IHdob2EuZ2V0KGtleSk7CisgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KGtleSArICIgPT4geyIpOworCisgICAgICAgICAgICBmb3IgKE51bWJlcnogazIgOiB2YWwua2V5U2V0KCkpIHsKKyAgICAgICAgICAgICAgSW5zYW5pdHkgdjIgPSB2YWwuZ2V0KGsyKTsKKyAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludChrMiArICIgPT4geyIpOworICAgICAgICAgICAgICBNYXA8TnVtYmVyeiwgTG9uZz4gdXNlck1hcCA9IHYyLnVzZXJNYXA7CisgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInsiKTsKKyAgICAgICAgICAgICAgaWYgKHVzZXJNYXAgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZvciAoTnVtYmVyeiBrMyA6IHVzZXJNYXAua2V5U2V0KCkpIHsKKyAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoazMgKyAiID0+ICIgKyB1c2VyTWFwLmdldChrMykgKyAiLCAiKTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIn0sICIpOworICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9LCAiKTsKIAotICAgICAgICAgICAgTGlzdDxYdHJ1Y3Q+IHh0cnVjdHMgPSB2Mi54dHJ1Y3RzOwotICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgieyIpOwotICAgICAgICAgICAgaWYgKHh0cnVjdHMgIT0gbnVsbCkgewotICAgICAgICAgICAgICBmb3IgKFh0cnVjdCB4IDogeHRydWN0cykgewotICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInsiICsgIlwiIiArIHguc3RyaW5nX3RoaW5nICsgIlwiLCAiICsgeC5ieXRlX3RoaW5nICsgIiwgIiArIHguaTMyX3RoaW5nICsgIiwgIisgeC5pNjRfdGhpbmcgKyAifSwgIik7CisgICAgICAgICAgICAgIExpc3Q8WHRydWN0PiB4dHJ1Y3RzID0gdjIueHRydWN0czsKKyAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgieyIpOworICAgICAgICAgICAgICBpZiAoeHRydWN0cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZm9yIChYdHJ1Y3QgeCA6IHh0cnVjdHMpIHsKKyAgICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInsiICsgIlwiIiArIHguc3RyaW5nX3RoaW5nICsgIlwiLCAiICsgeC5ieXRlX3RoaW5nICsgIiwgIiArIHguaTMyX3RoaW5nICsgIiwgIisgeC5pNjRfdGhpbmcgKyAifSwgIik7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9Iik7CisgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIn0iKTsKIAorICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9LCAiKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIn0sICIpOwogICAgICAgICAgIH0KLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9LCAiKTsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9XG4iKTsKKyAgICAgICAgICBpZiAod2hvYS5zaXplKCkgPT0gMiAmJiB3aG9hLmNvbnRhaW5zS2V5KDFMKSAmJiB3aG9hLmNvbnRhaW5zS2V5KDJMKSkgeworICAgICAgICAgICAgTWFwPE51bWJlcnosIEluc2FuaXR5PiBmaXJzdF9tYXAgPSB3aG9hLmdldCgxTCk7CisgICAgICAgICAgICBNYXA8TnVtYmVyeiwgSW5zYW5pdHk+IHNlY29uZF9tYXAgPSB3aG9hLmdldCgyTCk7CisgICAgICAgICAgICBpZiAoZmlyc3RfbWFwLnNpemUoKSA9PSAyICYmCisgICAgICAgICAgICAgICAgZmlyc3RfbWFwLmNvbnRhaW5zS2V5KE51bWJlcnouVFdPKSAmJgorICAgICAgICAgICAgICAgIGZpcnN0X21hcC5jb250YWluc0tleShOdW1iZXJ6LlRIUkVFKSAmJgorICAgICAgICAgICAgICAgIHNlY29uZF9tYXAuc2l6ZSgpID09IDEgJiYKKyAgICAgICAgICAgICAgICBzZWNvbmRfbWFwLmNvbnRhaW5zS2V5KE51bWJlcnouU0lYKSAmJgorICAgICAgICAgICAgICAgIGluc2FuZS5lcXVhbHMoZmlyc3RfbWFwLmdldChOdW1iZXJ6LlRXTykpICYmCisgICAgICAgICAgICAgICAgaW5zYW5lLmVxdWFscyhmaXJzdF9tYXAuZ2V0KE51bWJlcnouVEhSRUUpKSkgeworICAgICAgICAgICAgICBJbnNhbml0eSBzaXggPXNlY29uZF9tYXAuZ2V0KE51bWJlcnouU0lYKTsKKyAgICAgICAgICAgICAgLy8gQ2Fubm90IHVzZSAibmV3IEluc2FuaXR5KCkuZXF1YWxzKHNpeCkiIGJlY2F1c2UgYXMgb2Ygbm93LCBzdHJ1Y3QvY29udGFpbmVyCisgICAgICAgICAgICAgIC8vIGZpZWxkcyB3aXRoIGRlZmF1bHQgcmVxdWlyZWRuZXNzIGhhdmUgaXNzZXQ9ZmFsc2UgZm9yIGxvY2FsIGluc3RhbmNlcyBhbmQgeWV0CisgICAgICAgICAgICAgIC8vIHJlY2VpdmVkIGVtcHR5IHZhbHVlcyBmcm9tIG90aGVyIGxhbmd1YWdlcyBsaWtlIEMrKyBoYXZlIGlzc2V0PXRydWUgLgorICAgICAgICAgICAgICBpZiAoc2l4LmdldFVzZXJNYXBTaXplKCkgPT0gMCAmJiBzaXguZ2V0WHRydWN0c1NpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgLy8gT0sKKyAgICAgICAgICAgICAgICBpbnNhbml0eUZhaWxlZCA9IGZhbHNlOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9TVFJVQ1RTOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiKioqIEZBSUxVUkUgKioqXG4iKTsKKyAgICAgICAgICBleC5wcmludFN0YWNrVHJhY2UoU3lzdGVtLm91dCk7CisgICAgICAgICAgaW5zYW5pdHlGYWlsZWQgPSBmYWxzZTsKICAgICAgICAgfQotICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ9XG4iKTsKKyAgICAgICAgaWYgKGluc2FuaXR5RmFpbGVkKSB7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIioqKiBGQUlMVVJFICoqKlxuIik7CisgICAgICAgIH0KIAotICAgICAgICAKICAgICAgICAgLyoqCiAgICAgICAgICAqIEVYRUNQVElPTiBURVNUCiAgICAgICAgICAqLwogICAgICAgICB0cnkgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3RDbGllbnQudGVzdEV4Y2VwdGlvbihcIlhjZXB0aW9uXCIpID0+Iik7CiAgICAgICAgICAgdGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKCJYY2VwdGlvbiIpOwotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiAgdm9pZFxuRkFJTFVSRVxuIik7Ci0gICAgICAgICAgZmFpbENvdW50Kys7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiICB2b2lkXG4qKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0VYQ0VQVElPTlM7CiAgICAgICAgIH0gY2F0Y2goWGNlcHRpb24gZSkgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIgIHslZCwgXCIlc1wifVxuIiwgZS5lcnJvckNvZGUsIGUubWVzc2FnZSk7CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgdHJ5IHsKICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJ0ZXN0Q2xpZW50LnRlc3RFeGNlcHRpb24oXCJURXhjZXB0aW9uXCIpID0+Iik7CiAgICAgICAgICAgdGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKCJURXhjZXB0aW9uIik7Ci0gICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiICB2b2lkXG5GQUlMVVJFXG4iKTsKLSAgICAgICAgICBmYWlsQ291bnQrKzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgIHZvaWRcbioqKiBGQUlMVVJFICoqKlxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfRVhDRVBUSU9OUzsKICAgICAgICAgfSBjYXRjaChURXhjZXB0aW9uIGUpIHsKICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50ZigiICB7XCIlc1wifVxuIiwgZS5nZXRNZXNzYWdlKCkpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgidGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKFwic3VjY2Vzc1wiKSA9PiIpOwogICAgICAgICAgIHRlc3RDbGllbnQudGVzdEV4Y2VwdGlvbigic3VjY2VzcyIpOwogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiAgdm9pZFxuIik7CiAgICAgICAgIH1jYXRjaChFeGNlcHRpb24gZSkgewotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIgIGV4Y2VwdGlvblxuRkFJTFVSRVxuIik7Ci0gICAgICAgICAgZmFpbENvdW50Kys7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIiAgZXhjZXB0aW9uXG4qKiogRkFJTFVSRSAqKipcbiIpOworICAgICAgICAgIHJldHVybkNvZGUgfD0gRVJSX0VYQ0VQVElPTlM7CiAgICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIAorCisKICAgICAgICAgLyoqCiAgICAgICAgICAqIE1VTFRJIEVYQ0VQVElPTiBURVNUCiAgICAgICAgICAqLwotICAgICAgICAKKwogICAgICAgICB0cnkgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCJ0ZXN0Q2xpZW50LnRlc3RNdWx0aUV4Y2VwdGlvbihcIlhjZXB0aW9uXCIsIFwidGVzdCAxXCIpID0+Iik7CiAgICAgICAgICAgdGVzdENsaWVudC50ZXN0TXVsdGlFeGNlcHRpb24oIlhjZXB0aW9uIiwgInRlc3QgMSIpOwotICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoIiAgcmVzdWx0XG5GQUlMVVJFXG4iKTsKLSAgICAgICAgICBmYWlsQ291bnQrKzsKKyAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgIHJlc3VsdFxuKioqIEZBSUxVUkUgKioqXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9FWENFUFRJT05TOwogICAgICAgICB9IGNhdGNoKFhjZXB0aW9uIGUpIHsKICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50ZigiICB7JWQsIFwiJXNcIn1cbiIsIGUuZXJyb3JDb2RlLCBlLm1lc3NhZ2UpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoInRlc3RDbGllbnQudGVzdE11bHRpRXhjZXB0aW9uKFwiWGNlcHRpb24yXCIsIFwidGVzdCAyXCIpID0+Iik7CiAgICAgICAgICAgdGVzdENsaWVudC50ZXN0TXVsdGlFeGNlcHRpb24oIlhjZXB0aW9uMiIsICJ0ZXN0IDIiKTsKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCIgIHJlc3VsdFxuRkFJTFVSRVxuIik7Ci0gICAgICAgICAgZmFpbENvdW50Kys7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludCgiICByZXN1bHRcbioqKiBGQUlMVVJFICoqKlxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfRVhDRVBUSU9OUzsKICAgICAgICAgfSBjYXRjaChYY2VwdGlvbjIgZSkgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIgIHslZCwge1wiJXNcIn19XG4iLCBlLmVycm9yQ29kZSwgZS5zdHJ1Y3RfdGhpbmcuc3RyaW5nX3RoaW5nKTsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICB0cnkgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInRlc3RDbGllbnQudGVzdE11bHRpRXhjZXB0aW9uKFwic3VjY2Vzc1wiLCBcInRlc3QgM1wiKSA9PiIpOwogICAgICAgICAgIFh0cnVjdCByZXN1bHQ7CiAgICAgICAgICAgcmVzdWx0ID0gdGVzdENsaWVudC50ZXN0TXVsdGlFeGNlcHRpb24oInN1Y2Nlc3MiLCAidGVzdCAzIik7CiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIiAge3tcIiVzXCJ9fVxuIiwgcmVzdWx0LnN0cmluZ190aGluZyk7CiAgICAgICAgIH0gY2F0Y2goRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50ZigiICBleGNlcHRpb25cbkZBSUxVUkVcbiIpOwotICAgICAgICAgIGZhaWxDb3VudCsrOworICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIgIGV4Y2VwdGlvblxuKioqIEZBSUxVUkUgKioqXG4iKTsKKyAgICAgICAgICByZXR1cm5Db2RlIHw9IEVSUl9FWENFUFRJT05TOwogICAgICAgICB9CiAKIAotICAgICAgICAKKwogICAgICAgICAvKioKICAgICAgICAgICogT05FV0FZIFRFU1QKICAgICAgICAgICovCkBAIC01OTgsOSArNzUzLDEwIEBACiAgICAgICAgIGxvbmcgb25ld2F5RWxhcHNlZE1pbGxpcyA9IChTeXN0ZW0ubmFub1RpbWUoKSAtIHN0YXJ0T25ld2F5KSAvIDEwMDAwMDA7CiAgICAgICAgIGlmIChvbmV3YXlFbGFwc2VkTWlsbGlzID4gMjAwKSB7CiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJPbmV3YXkgdGVzdCBmYWlsZWQ6IHRvb2sgIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb25nLnRvU3RyaW5nKG9uZXdheUVsYXBzZWRNaWxsaXMpICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtcyIpOwotICAgICAgICAgIGZhaWxDb3VudCsrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb25nLnRvU3RyaW5nKG9uZXdheUVsYXBzZWRNaWxsaXMpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm1zIik7CisgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIioqKiBGQUlMVVJFICoqKlxuIik7CisgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFUlJfQkFTRVRZUEVTOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiU3VjY2VzcyAtIHRvb2sgIiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvbmcudG9TdHJpbmcob25ld2F5RWxhcHNlZE1pbGxpcykgKwpAQCAtNjIzLDggKzc3OSw5IEBACiAKICAgICAgICAgdHJhbnNwb3J0LmNsb3NlKCk7CiAgICAgICB9IGNhdGNoIChFeGNlcHRpb24geCkgeworICAgICAgICBTeXN0ZW0ub3V0LnByaW50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iAgICAgICBTdHJpbmcgcHJvdG9jb2xfdHlwZSA9ICJiaW5hcnkiOwogICAgICAgU3RyaW5nIHNlcnZlcl90eXBlID0gInRocmVhZC1wb29sIjsKICAgICAgIFN0cmluZyBkb21haW5fc29ja2V0ID0gIiI7CisgICAgICBpbnQgc3RyaW5nX2xpbWl0ID0gLTE7CisgICAgICBpbnQgY29udGFpbmVyX2xpbWl0ID0gLTE7CiAgICAgICB0cnkgewogICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGFyZ3MubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICBpZiAoYXJnc1tpXS5zdGFydHNXaXRoKCItLXBvcnQiKSkgewpAQCAtMTI0LDE4ICsxNDYsMjQgQEAKICAgICAgICAgICAgIHByb3RvY29sX3R5cGUgPSBhcmdzW2ldLnNwbGl0KCI9IilbMV07CiAgICAgICAgICAgICBwcm90b2NvbF90eXBlLnRyaW0oKTsKICAgICAgICAgICB9IGVsc2UgaWYgKGFyZ3NbaV0uc3RhcnRzV2l0aCgiLS10cmFuc3BvcnQiKSkgewotICAgICAgICAgICAgdHJhbnNwb3J0X3R5cGUgPSBhcmdzW2ldLnNwbGl0KCI9IilbMV07ICAKKyAgICAgICAgICAgIHRyYW5zcG9ydF90eXBlID0gYXJnc1tpXS5zcGxpdCgiPSIpWzFdOwogICAgICAgICAgICAgdHJhbnNwb3J0X3R5cGUudHJpbSgpOwogICAgICAgICAgIH0gZWxzZSBpZiAoYXJnc1tpXS5lcXVhbHMoIi0tc3NsIikpIHsKICAgICAgICAgICAgIHNzbCA9IHRydWU7CisgICAgICAgICAgfSBlbHNlIGlmIChhcmdzW2ldLnN0YXJ0c1dpdGgoIi0tc3RyaW5nLWxpbWl0IikpIHsKKyAgICAgICAgICAgIHN0cmluZ19saW1pdCA9IEludGVnZXIudmFsdWVPZihhcmdzW2ldLnNwbGl0KCI9IilbMV0pOworICAgICAgICAgIH0gZWxzZSBpZiAoYXJnc1tpXS5zdGFydHNXaXRoKCItLWN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JhbnNwb3J0IHVzaW5nIFNTTCIpOwogICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCIgIC0tc2VydmVyLXR5cGU9YXJnICg9IiArIHNlcnZlcl90eXBlICsiKVxuXHRcdFx0XHRUeXBlIG9mIHNlcnZlcjogc2ltcGxlLCB0aHJlYWQtcG9vbCwgbm9uYmxvY2tpbmcsIHRocmVhZGVkLXNlbGVjdG9yIik7CisgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIiAgLS1zdHJpbmctbGltaXQ9YXJnICg9IiArIHN0cmluZ19saW1pdCArICIpXHRTdHJpbmcgcmVhZCBsZW5ndGggbGltaXQiKTsKKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiICAtLWNvbnRhaW5lci1saW1pdD1hcmcgKD0iICsgY29udGFpbmVyX2xpbWl0ICsgIilcdENvbnRhaW5lciByZWFkIGxlbmd0aCBsaW1pdCIpOwogICAgICAgICAgICAgU3lzdGVtLmV4aXQoMCk7CiAgICAgICAgICAgfQogICAgICAgICB9CkBAIC0xNDMsNyArMTcxLDcgQEAKICAgICAgICAgU3lzdGVtLmVyci5wcmludGxuKCJDYW4gbm90IHBhcnNlIGFyZ3VtZW50cyEgU2VlIC0taGVscCIpOwogICAgICAgICBTeXN0ZW0uZXhpdCgxKTsKICAgICAgIH0KLSAgICAgIAorCiAgICAgICB0cnkgewogICAgICAgICBpZiAoc2VydmVyX3R5cGUuZXF1YWxzKCJzaW1wbGUiKSkgewogICAgICAgICB9IGVsc2UgaWYgKHNlcnZlcl90eXBlLmVxdWFscygidGhyZWFkLXBvb2wiKSkgewpAQCAtMTU2LDEzICsxODQsMTYgQEAKICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oIlNTTCBpcyBub3Qgc3VwcG9ydGVkIG92ZXIgbm9uYmxvY2tpbmcgc2VydmVycyEiKTsKICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiVW5rbm93biBzZXJ2ZXIgdHlwZSEgIiArIHNlcnZlcl90eXBlKTsgCisgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiVW5rbm93biBzZXJ2ZXIgdHlwZSEgIiArIHNlcnZlcl90eXBlKTsKICAgICAgICAgfQogICAgICAgICBpZiAocHJvdG9jb2xfdHlwZS5lcXVhbHMoImJpbmFyeSIpKSB7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvdG9jb2xfdHlwZS5lcXVhbHMoImpzb24iKSkgewogICAgICAgICB9IGVsc2UgaWYgKHByb3RvY29sX3R5cGUuZXF1YWxzKCJjb21wYWN0IikpIHsKKyAgICAgICAgfSBlbHNlIGlmIChwcm90b2NvbF90eXBlLmVxdWFscygianNvbiIpKSB7CisgICAgICAgIH0gZWxzZSBpZiAocHJvdG9jb2xfdHlwZS5lcXVhbHMoIm11bHRpIikpIHsKKyAgICAgICAgfSBlbHNlIGlmIChwcm90b2NvbF90eXBlLmVxdWFscygibXVsdGljIikpIHsKKyAgICAgICAgfSBlbHNlIGlmIChwcm90b2NvbF90eXBlLmVxdWFscygibXVsdGlqIikpIHsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCJVbmtub3duIHByb3RvY29sIHR5cGUhICIgKyBwcm90b2NvbF90eXBlKTsgCisgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiVW5rbm93biBwcm90b2NvbCB0eXBlISAiICsgcHJvdG9jb2xfdHlwZSk7CiAgICAgICAgIH0KICAgICAgICAgaWYgKHRyYW5zcG9ydF90eXBlLmVxdWFscygiYnVmZmVyZWQiKSkgewogICAgICAgICB9IGVsc2UgaWYgKHRyYW5zcG9ydF90eXBlLmVxdWFscygiZnJhbWVkIikpIHsKQEAgLTE3MSwyNCArMjAyLDI1IEBACiAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiVW5rbm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lIHN0YXRpYyBmaW5hbCBieXRlW10gIFFVT1RFICAgICAgICAgICAgPSBuZXcgYnl0ZVtdIHsgJyInIH07CisgIHByaXZhdGUgc3RhdGljIGZpbmFsIGJ5dGVbXSAgQkFDS1NMQVNIICAgICAgICA9IG5ldyBieXRlW10geyAnXFwnIH07CisgIHByaXZhdGUgc3RhdGljIGZpbmFsIGJ5dGVbXSAgWkVSTyAgICAgICAgICAgICA9IG5ldyBieXRlW10geyAnMCcgfTsKKworICBwcml2YXRlIHN0YXRpYyBmaW5hbCBieXRlW10gIEVTQ1NFUSAgICAgICAgICAgPSBuZXcgYnl0ZVtdIHsgJ1xcJywgJ3UnLCAnMCcsICcwJyB9OworCisgIHByaXZhdGUgc3RhdGljIGZpbmFsIGxvbmcgICAgVkVSU0lPTiAgICAgICAgICA9IDE7CisKKyAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgYnl0ZVtdICBKU09OX0NIQVJfVEFCTEUgID0geworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogMCAxIDIgMyA0IDUgNiA3IDggOSBBIEIgQyBEIEUgRiAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgJ2InLCAndCcsICduJywgMCwgJ2YnLCAncicsIDAsIDAsIC8vIDAKKyAgICAgIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIDAsIC8vIDEKKyAgICAgIDEsIDEsICciJywgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgLy8gMgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKKworICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgIEVTQ0FQRV9DSEFSUyAgICAgPSAiXCJcXC9iZm5ydCI7CisKKyAgcHJpdm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LlNUUklORzoKKyAgICAgIHJldHVybiBOQU1FX1NUUklORzsKKyAgICBjYXNlIFRUeXBlLlNUUlVDVDoKKyAgICAgIHJldHVybiBOQU1FX1NUUlVDVDsKKyAgICBjYXNlIFRUeXBlLk1BUDoKKyAgICAgIHJldHVybiBOQU1FX01BUDsKKyAgICBjYXNlIFRUeXBlLlNFVDoKKyAgICAgIHJldHVybiBOQU1FX1NFVDsKKyAgICBjYXNlIFRUeXBlLkxJU1Q6CisgICAgICByZXR1cm4gTkFNRV9MSVNUOworICAgIGRlZmF1bHQ6CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsCisgICAgICAgICAgIlVucmVjb2duaXplZCB0eXBlIik7CisgICAgfQorICB9CisKKyAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgYnl0ZSBnZXRUeXBlSURGb3JUeXBlTmFtZShieXRlW10gbmFtZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd3MgVEV4Y2VwdGlvbiB7CisgICAgYnl0ZSByZXN1bHQgPSBUVHlwZS5TVE9QOworICAgIGlmIChuYW1lLmxlbmd0aCA+IDEpIHsKKyAgICAgIHN3aXRjaCAobmFtZVswXSkgeworICAgICAgY2FzZSAnZCc6CisgICAgICAgIHJlc3VsdCA9IFRUeXBlLkRPVUJMRTsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlICdpJzoKKyAgICAgICAgc3dpdGNoIChuYW1lWzFdKSB7CisgICAgICAgIGNhc2UgJzgnOgorICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkJZVEU7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgJzEnOgorICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkkxNjsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSAnMyc6CisgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuSTMyOworICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlICc2JzoKKyAgICAgICAgICByZXN1bHQgPSBUVHlwZS5JNjQ7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlICdsJzoKKyAgICAgICAgcmVzdWx0ID0gVFR5cGUuTElTVDsKKyAgICAgICAgYnJlYWs7CisgICAgICBjYXNlICdtJzoKKyAgICAgICAgcmVzdWx0ID0gVFR5cGUuTUFQOworICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ3InOgorICAgICAgICByZXN1bHQgPSBUVHlwZS5TVFJVQ1Q7CisgICAgICAgIGJyZWFrOworICAgICAgY2FzZSAncyc6CisgICAgICAgIGlmIChuYW1lWzFdID09ICd0JykgeworICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLlNUUklORzsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChuYW1lWzFdID09ICdlJykgeworICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLlNFVDsKKyAgICAgICAgfQorICAgICAgICBicmVhazsKKyAgICAgIGNhc2UgJ3QnOgorICAgICAgICByZXN1bHQgPSBUVHlwZS5CT09MOworICAgICAgICBicmVhazsKKyAgICAgIH0KKyAgICB9CisgICAgaWYgKHJlc3VsdCA9PSBUVHlwZS5TVE9QKSB7CisgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsCisgICAgICAgICAgIlVucmVjb2duaXplZCB0eXBlIik7CisgICAgfQorICAgIHJldHVybiByZXN1bHQ7CisgIH0KKworICAvLyBCYXNlIGNsYXNzIGZvciB0cmFja2luZyBKU09OIGNvbnRleHRzIHRoYXQgbWF5IHJlcXVpcmUgaW5zZXJ0aW5nL3JlYWRpbmcKKyAgLy8gYWRkaXRpb25hbCBKU09OIHN5bnRheCB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gaWYgKCFoYXNEYXRhXykgeworICAgICAgICB0cmFuc18ucmVhZEFsbChkYXRhXywgMCwgMSk7CisgICAgICB9CisgICAgICBoYXNEYXRhXyA9IHRydWU7CisgICAgICByZXR1cm4gZGF0YV9bMF07CisgICAgfQorICB9CisKKyAgLy8gU3RhY2sgb2YgbmVzdGVkIGNvbnRleHRzIG9mIHR5cGUgSlNPTkJhc2VDb250ZXh0IHRoYXQgd2UgbWF5IGJlIGluCisgIHByaXZhdGUgU3RhY2sgICAgICAgICAgIGNvbnRleHRTdGFja18gPSBuZXcgU3RhY2soKTsKKworICAvLyBDdXJyZW50IGNvbnRleHQgdGhhdCB3ZSBhcmUgaW4KKyAgcHJpdmF0ZSBKU09OQmFzZUNvbnRleHQgY29udGV4dF8gICAgICA9IG5ldyBKU09OQmFzZUNvbnRleHQoKTsKKworICAvLyBSZWFkZXIgdGhhdCBtYW5hZ2VzIGEgMS1ieXRlIGJ1ZmZlcgorICBwcml2YXRlIExvb2thaGVhZFJlYWRlciByZWFkZXJfICAgICAgID0gbmV3IExvb2thaGVhZFJlYWRlcigpOworCisgIC8vIFB1c2ggYSBuZXcgSlNPTiBjb250ZXh0IG9udG8gdGhlIHN0YWNrLgorICBwcml2YXRlIHZvaWQgcHVzaENvbnRleHQoSlNPTkJhc2VDb250ZXh0IGMpIHsKKyAgICBjb250ZXh0U3RhY2tfLnB1c2goY29udGV4dF8pOworICAgIGNvbnRleHRfID0gYzsKKyAgfQorCisgIC8vIFBvcCB0aGUgbGFzdCBKU09OIGNvbnRleHQgb2ZmIHRoZSBzdGFjaworICBwcml2YXRlIHZvaWQgcG9wQ29udGV4dCgpIHsKKyAgICBjb250ZXh0XyA9IChKU09OQmFzZUNvbnRleHQpY29udGV4dFN0YWNrXy5wb3AoKTsKKyAgfQorCisgIC8qKgorICAgKiBDb25zdHJ1Y3RvcgorICAgKi8KKyAgcHVibGljIFRKU09OUHJvdG9jb2woVFRyYW5zcG9ydCB0cmFucykgeworICAgIHN1cGV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F0ZSBzdGF0aWMgYnl0ZVtdIHRvVVRGOChpbnQgaGlnaCwgaW50IGxvdykgeworICAgIGludCBjb2RlcG9pbnQgPSAoMSA8PCAxNikgKyAoKGhpZ2ggJiAweDNmZikgPDwgMTApOworICAgIGNvZGVwb2ludCArPSBsb3cgJiAweDNmZjsKKyAgICByZXR1cm4gdG9VVEY4KGNvZGVwb2ludCk7CisgIH0KKworICAvLyBXcml0ZSB0aGUgYnl0ZXMgaW4gYXJyYXkgYnVmIGFzIGEgSlNPTiBjaGFyYWN0ZXJzLCBlc2NhcGluZyBhcyBuZWVkZWQKKyAgcHJpdmF0ZSB2b2lkIHdyaXRlSlNPTlN0cmluZyhieXRlW10gYikgdGhyb3dzIFRFeGNlcHRpb24geworICAgIGNvbnRleHRfLndyaXRlKCk7CisgICAgdHJhbnNfLndyaXRlKFFVT1RFKTsKKyAgICBpbnQgbGVuID0gYi5sZW5ndGg7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgaWYgKChiW2ldICYgMHgwMEZGKSA+PSAweDMwKSB7CisgICAgICAgIGlmIChiW2ldID09IEJBQ0tTTEFTSFswXSkgeworICAgICAgICAgIHRyYW5zXy53cml0ZShCQUNLU0xBU0gpOworICAgICAgICAgIHRyYW5zXy53cml0ZShCQUNLU0xBU0gpOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgIHRyYW5zXy53cml0ZShiLCBpLCAxKTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHRtcGJ1Zl9bMF0gPSBKU09OX0NIQVJfVEFCTEVbYltpXV07CisgICAgICAgIGlmICh0bXBidWZfWzBdID09IDEpIHsKKyAgICAgICAgICB0cmFuc18ud3JpdGUoYiwgaSwgMSk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAodG1wYnVmX1swXSA+IDEpIHsKKyAgICAgICAgICB0cmFuc18ud3JpdGUoQkFDS1NMQVNIKTsKKyAgICAgICAgICB0cmFuc18ud3JpdGUodG1wYnVmXywgMCwgMSk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSB7CisgICAgICAgICAgdHJhbnNfLndyaXRlKEVTQ1NFUSk7CisgICAgICAgICAgdG1wYnVmX1swXSA9IGhleENoYXIoKGJ5dGUpKGJbaV0gPj4gNCkpOworICAgICAgICAgIHRtcGJ1Zl9bMV0gPSBoZXhDaGFyKGJbaV0pOworICAgICAgICAgIHRyYW5zXy53cml0ZSh0bXBidWZfLCAwLCAyKTsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgICB0cmFuc18ud3JpdGUoUVVPVEUpOworICB9CisKKyAgLy8gV3JpdGUgb3V0IG51bWJlciBhcyBhIEpTT04gdmFsdWUuIElmIHRoZSBjb250ZXh0IGRpY3RhdGVzIHNvLCBpdCB3aWxsIGJlCisgIC8vIHdyYXBwZWQgaW4gcXVvdGVzIHRvIG91dHB1dCBhcyBhIEpTT04gc3RyaW5nLgorICBwcml2YXRlIHZvaWQgd3JpdGVKU09OSW50ZWdlcihsb25nIG51bSkgdGhyb3dzIFRFeGNlcHRpb24geworICAgIGNvbnRleHRfLndyaXRlKCk7CisgICAgU3RyaW5nIHN0ciA9IExvbmcudG9TdHJpbmcobnVtKTsKKyAgICBib29sZWFuIGVzY2FwZU51bSA9IGNvbnRleHRfLmVzY2FwZU51bSgpOworICAgIGlmIChlc2NhcGVOdW0pIHsKKyAgICAgIHRyYW5zXy53cml0ZShRVU9URSk7CisgICAgfQorICAgIHRyeSB7CisgICAgICBieXRlW10gYnVmID0gc3RyLmdldEJ5dGVzKCJVVEYtOCIpOworICAgICAgdHJhbnNfLndyaXRlKGJ1Zik7CisgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRFbmNvZGluZ0V4Y2VwdGlvbiB1ZXgpIHsKKyAgICAgIHRocm93IG5ldyBURXhjZXB0aW9uKCJKVk0gRE9FUyBOT1QgU1VQUE9SVCBVVEYtOCIpOworICAgIH0K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gYmluLmxlbmd0aCk7CisgIH0KKworICAvKioKKyAgICogUmVhZGluZyBtZXRob2RzLgorICAgKi8KKworICAvLyBSZWFkIGluIGEgSlNPTiBzdHJpbmcsIHVuZXNjYXBpbmcgYXMgYXBwcm9wcmlhdGUuLiBTa2lwIHJlYWRpbmcgZnJvbSB0aGUKKyAgLy8gY29udGV4dCBpZiBza2lwQ29udGV4dCBpcyB0cnVlLgorICBwcml2YXRlIFRCeXRlQXJyYXlPdXRwdXRTdHJlYW0gcmVhZEpTT05TdHJpbmcoYm9vbGVhbiBza2lwQ29udGV4dCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dzIFRFeGNlcHRpb24geworICAgIFRCeXRlQXJyYXlPdXRwdXRTdHJlYW0gYXJyID0gbmV3IFRCeXRlQXJyYXlPdXRwdXRTdHJlYW0oREVGX1NUUklOR19TSVpFKTsKKyAgICBpbnQgaGlnaFN1cnJvZ2F0ZSA9IDA7CisgICAgaWYgKCFza2lwQ29udGV4dCkgeworICAgICAgY29udGV4dF8ucmVhZCgpOworICAgIH0KKyAgICByZWFkSlNPTlN5bnRheENoYXIoUVVPVEUpOworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICBieXRlIGNoID0gcmVhZGVyXy5yZWFkKCk7CisgICAgICBpZiAoY2ggPT0gUVVPVEVbMF0pIHsKKyAgICAgICAgYnJlYWs7CisgICAgICB9CisgICAgICBpZiAoY2ggPT0gRVNDU0VRWzBdKSB7CisgICAgICAgIGNoID0gcmVhZGVyXy5yZWFkKCk7CisgICAgICAgIGlmIChjaCA9PSBFU0NTRVFbMV0pIHsKKyAgICAgICAgICB0cmFuc18ucmVhZEFsbCh0bXBidWZfLCAwLCA0KTsKKyAgICAgICAgICBzaG9ydCBjdSA9IChzaG9ydCkoCisgICAgICAgICAgICAgICgoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bMF0pIDw8IDEyKSArCisgICAgICAgICAgICAgICgoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bMV0pIDw8IDgpICsKKyAgICAgICAgICAgICAgKChzaG9ydCloZXhWYWwodG1wYnVmX1syXSkgPDwgNCkgKworICAgICAgICAgICAgICAoc2hvcnQpaGV4VmFsKHRtcGJ1Zl9bM10pKTsKKyAgICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKGlzSGlnaFN1cnJvZ2F0ZSgoY2hhciljdSkpIHsKKyAgICAgICAgICAgICAgaWYgKGhpZ2hTdXJyb2dhdGUgIT0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGxvdyBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIGhpZ2hTdXJyb2dhdGUgPSBjdTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKGlzTG93U3Vycm9nYXRlKChjaGFyKWN1KSkgeworICAgICAgICAgICAgICBpZiAoaGlnaFN1cnJvZ2F0ZSA9PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgaGlnaCBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgYXJyLndyaXRlKHRvVVRGOChoaWdoU3Vycm9nYXRlLCBjdSkpOworICAgICAgICAgICAgICBoaWdoU3Vycm9nYXRlID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICBhcnIud3JpdGUodG9VVEY4KGN1KSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICB9CisgICAgICAgICAgY2F0Y2ggKFVuc3VwcG9ydGVkRW5jb2RpbmdFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLk5PVF9JTVBMRU1FTlRFRCwKKyAgICAgICAgICAgICAgICAiSlZNIGRvZXMgbm90IHN1cHBvcnQgVVRGLTgiKTsKKyAgICAgICAgICB9CisgICAgICAgICAgY2F0Y2ggKElPRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgIkludmFsaWQgdW5pY29kZSBzZXF1ZW5jZSIpOworICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICBpbnQgb2ZmID0gRVNDQVBFX0NIQVJTLmluZGV4T2YoY2gpOworICAgICAgICAgIGlmIChvZmYgPT0gLTEpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgY29udHJvbCBjaGFyIik7CisgICAgICAgICAgfQorICAgICAgICAgIGNoID0gRVNDQVBFX0NIQVJfVkFMU1tvZmZdOworICAgICAgICB9CisgICAgICB9CisgICAgICBhcnIud3JpdGUoY2gpOworICAgIH0KKworICAgIGlmIChoaWdoU3Vycm9nYXRlICE9IDApIHsKKyAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAiRXhwZWN0ZWQgbG93IHN1cnJvZ2F0ZSBjaGFyIik7CisgICAgfQorICAg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W50IHNpemUgPSAoaW50KXJlYWRKU09OSW50ZWdlcigpOworICAgIHJldHVybiBuZXcgVFNldChlbGVtVHlwZSwgc2l6ZSk7CisgIH0KKworICBwdWJsaWMgdm9pZCByZWFkU2V0RW5kKCkgdGhyb3dzIFRFeGNlcHRpb24geworICAgIHJlYWRKU09OQXJyYXlFbmQoKTsKKyAgfQorCisgIHB1YmxpYyBib29sZWFuIHJlYWRCb29sKCkgdGhyb3dzIFRFeGNlcHRpb24geworICAgIHJldHVybiAocmVhZEpTT05JbnRlZ2VyKCkgPT0gMCA/IGZhbHNlIDogdHJ1ZSk7CisgIH0KKworICBwdWJsaWMgYnl0ZSByZWFkQnl0ZSgpIHRocm93cyBURXhjZXB0aW9uIHsKKyAgICByZXR1cm4gKGJ5dGUpcmVhZEpTT05JbnRlZ2VyKCk7CisgIH0KKworICBwdWJsaWMgc2hvcnQgcmVhZEkxNigpIHRocm93cyBURXhjZXB0aW9uIHsKKyAgICByZXR1cm4gKHNob3J0KXJlYWRKU09OSW50ZWdlcigpOworICB9CisKKyAgcHVibGljIGludCByZWFkSTMyKCkgdGhyb3dzIFRFeGNlcHRpb24geworICAgIHJldHVybiAoaW50KXJlYWRKU09OSW50ZWdlcigpOworICB9CisKKyAgcHVibGljIGxvbmcgcmVhZEk2NCgpIHRocm93cyBURXhjZXB0aW9uIHsKKyAgICByZXR1cm4gcmVhZEpTT05JbnRlZ2VyKCk7CisgIH0KKworICBwdWJsaWMgZG91YmxlIHJlYWREb3VibGUoKSB0aHJvd3MgVEV4Y2VwdGlvbiB7CisgICAgcmV0dXJuIHJlYWRKU09ORG91YmxlKCk7CisgIH0KKworICBwdWJsaWMgU3RyaW5nIHJlYWRTdHJpbmcoKSB0aHJvd3MgVEV4Y2VwdGlvbiB7CisgICAgdHJ5IHsKKyAgICAgIHJldHVybiByZWFkSlNPTlN0cmluZyhmYWxzZSkudG9TdHJpbmcoIlVURi04Iik7CisgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRF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5vcGVuKHVybF8pOwotICAgIAotICAgICAgICAgICAgLy8gVGltZW91dHMsIG9ubHkgaWYgZXhwbGljaXRseSBzZXQKLSAgICAgICAgICAgIGlmIChjb25uZWN0VGltZW91dF8gPiAwKSB7Ci0gICAgICAgICAgICAvLyAgWFhYOiBub3QgYXZhaWxhYmxlCi0gICAgICAgICAgICAvLyAgY29ubmVjdGlvbi5zZXRDb25uZWN0VGltZW91dChjb25uZWN0VGltZW91dF8pOwotICAgICAgICAgICAgfSAgIAotICAgICAgICAgICAgaWYgKHJlYWRUaW1lb3V0XyA+IDApIHsKLSAgICAgICAgICAgIC8vICBYWFg6IG5vdCBhdmFpbGFibGUKLSAgICAgICAgICAgIC8vICBjb25uZWN0aW9uLnNldFJlYWRUaW1lb3V0KHJlYWRUaW1lb3V0Xyk7Ci0gICAgICAgICAgICB9Ci0gICAgCi0gICAgICAgICAgICAvLyBNYWtlIHRoZSByZXF1ZXN0Ci0gICAgICAgICAgICBjb25uZWN0aW9uLnNldFJlcXVlc3RNZXRob2QoIlBPU1QiKTsKLSAgICAgICAgICAgIGNvbm5lY3Rpb24uc2V0UmVxdWVzdFByb3BlcnR5KCJDb250ZW50LVR5cGUiLCAiYXBwbGljYXRpb24veC10aHJpZnQiKTsKLSAgICAgICAgICAgIGNvbm5lY3Rpb24uc2V0UmVxdWVzdFByb3BlcnR5KCJBY2NlcHQiLCAiYXBwbGljYXRpb24veC10aHJpZnQiKTsKLSAgICAgICAgICAgIGNvbm5lY3Rpb24uc2V0UmVxdWVzdFByb3BlcnR5KCJVc2VyLUFnZW50IiwgIkphdmFNRS9USHR0cENsaWVudCIpOworICAgIHRyeSB7CisgICAgICAvLyBDcmVhdGUgY29ubmVjdGlvbiBvYmplY3QKKyAgICAgIGNvbm5lY3Rpb24gPSAoSHR0cENvbm5lY3Rpb24pQ29ubmVjdG9yLm9wZW4odXJsXyk7CisgIAorICAgICAgLy8gTWFrZSB0aGUgcmVxdWVzdAorICAgICAgY29ubmVjdGlvb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ZiAoY3VzdG9tSGVhZGVyc18gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZvciAoRW51bWVyYXRpb24gZSA9IGN1c3RvbUhlYWRlcnNfLmtleXMoKSA7IGUuaGFzTW9yZUVsZW1lbnRzKCkgOykgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcga2V5ID0gKFN0cmluZyllLm5leHRFbGVtZW50KCk7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IChTdHJpbmcpY3VzdG9tSGVhZGVyc18uZ2V0KGtleSk7Ci0gICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb24uc2V0UmVxdWVzdFByb3BlcnR5KGtleSwgdmFsdWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIGNvbm5lY3Rpb24uc2V0RG9PdXRwdXQodHJ1ZSk7Ci0gICAgICAgICAgICAvLyAgY29ubmVjdGlvbi5jb25uZWN0KCk7Ci0gICAgCi0gICAgICAgICAgICBPdXRwdXRTdHJlYW0gb3MgPSBjb25uZWN0aW9uLm9wZW5PdXRwdXRTdHJlYW0oKTsKLSAgICAgICAgICAgIG9zLndyaXRlKGRhdGEpOwotICAgICAgICAgICAgb3MuY2xvc2UoKTsKLQotICAgICAgICAgICAgaW50IHJlc3BvbnNlQ29kZSA9IGNvbm5lY3Rpb24uZ2V0UmVzcG9uc2VDb2RlKCk7Ci0gICAgICAgICAgICBpZiAocmVzcG9uc2VDb2RlICE9IEh0dHBDb25uZWN0aW9uLkhUVFBfT0spIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigiSFRUUCBSZXNwb25zZSBjb2RlOiAiICsgcmVzcG9uc2VDb2RlKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLy8gUmVhZCB0aGUgcmVzcG9uc2VzCi0gICAgICAgICAgICBpbnB1dFN0cmVhbV8gPSBjb25uZWN0aW9uLm9wZW5JbnB1dFN0cmVhbSgpOwotCi0gICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGlveCkgewotICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGlveC50b1N0cmluZygpKTsKLSAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKGlveCk7CisgICAgICBpZiAoY3VzdG9tSGVhZGVyc18gIT0gbnVsbCkgeworICAgICAgICBmb3IgKEVudW1lcmF0aW9uIGUgPSBjdXN0b21IZWFkZXJzXy5rZXlzKCkgOyBlLmhhc01vcmVFbGVtZW50cygpIDspIHsKKyAgICAgICAgICBTdHJpbmcga2V5ID0gKFN0cmluZyllLm5leHRFbGVtZW50KCk7CisgICAgICAgICAgU3RyaW5nIHZhbHVlID0gKFN0cmluZyljdXN0b21IZWFkZXJzXy5nZXQoa2V5KTsKKyAgICAgICAgICBjb25uZWN0aW9uLnNldFJlcXVlc3RQcm9wZXJ0eShrZXksIHZhbHVlKTsKICAgICAgICAgfQorICAgICAgfQorICAKKyAgICAgIE91dHB1dFN0cmVhbSBvcyA9IGNvbm5lY3Rpb24ub3Blbk91dHB1dFN0cmVhbSgpOworICAgICAgb3Mud3JpdGUoZGF0YSk7CisgICAgICBvcy5jbG9zZSgpOworCisgICAgICBpbnQgcmVzcG9uc2VDb2RlID0gY29ubmVjdGlvbi5nZXRSZXNwb25zZUNvZGUoKTsKKyAgICAgIGlmIChyZXNwb25zZUNvZGUgIT0gSHR0cENvbm5lY3Rpb24uSFRUUF9PSykgeworICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigiSFRUUCBSZXNwb25zZSBjb2RlOiAiICsgcmVzcG9uc2VDb2RlKTsKKyAgICAgIH0KKworICAgICAgLy8gUmVhZCB0aGUgcmVzcG9uc2VzCisgICAgICBpbnB1dFN0cmVhbV8gPSBjb25uZWN0aW9uLm9wZW5JbnB1dFN0cmVhbSgpOworICAgIH0gY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rKyBiL2xpYi9qcy9HcnVudGZpbGUuanMKQEAgLTAsMCArMSwyOTMgQEAKKy8vVG8gYnVpbGQgZGlzdC90aHJpZnQuanMsIGRpc3QvdGhyaWZ0Lm1pbi5qcyBhbmQgZG9jLyoKKy8vcnVuIGdydW50IGF0IHRoZSBjb21tYW5kIGxpbmUgaW4gdGhpcyBkaXJlY3RvcnkuCisvL1ByZXJlcXVpc2l0ZXM6CisvLyBOb2RlIFNldHVwIC0gICBub2RlanMub3JnCisvLyBHcnVudCBTZXR1cCAtICBucG0gaW5zdGFsbCAgLy9yZWFkcyB0aGUgLi9wYWNrYWdlLmpzb24gYW5kIGluc3RhbGxzIHByb2plY3QgZGVwZW5kZW5jaWVzCisvLyBSdW4gZ3J1bnQgLSAgICBucHggZ3J1bnQgIC8vIHVzZXMgcHJvamVjdC1sb2NhbCBpbnN0YWxsZWQgdmVyc2lvbiBvZiBncnVudCAoZnJvbSBwYWNrYWdlLmpzb24pCisKK21vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24oZ3J1bnQpIHsKKyAgJ3VzZSBzdHJpY3QnOworCisgIGdydW50LmluaXRDb25maWcoeworICAgIHBrZzogZ3J1bnQuZmlsZS5yZWFkSlNPTigncGFja2FnZS5qc29uJyksCisgICAgY29uY2F0OiB7CisgICAgICBvcHRpb25zOiB7CisgICAgICAgIHNlcGFyYXRvcjogJzsnCisgICAgICB9LAorICAgICAgZGlzdDogeworICAgICAgICBzcmM6IFsnc3JjLyoqLyouanMnXSwKKyAgICAgICAgZGVzdDogJ2Rpc3QvPCU9IHBrZy5uYW1lICU+LmpzJworICAgICAgfQorICAgIH0sCisgICAganNkb2MgOiB7CisgICAgICAgIGRpc3QgOiB7CisgICAgICAgICAgICBzcmM6IFsnc3JjLyouanMnLCAnLi9SRUFETUUubWQnXSwKKyAgICAgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICAgICAgZGVzdGluYXRpb246ICdkb2MnCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9LAorICAgIHVnbGlmeTogeworICAgICAgb3B0aW9uczogeworICAgICAgICBiYW5uZXI6ICcvKiEgPCU9IHBrZy5uYW1lICU+IDwlPSBncnVudC50ZW1wbGF0ZS50b2RheSgiZGQtbW0teXl5eSIpICU+ICovXG4nCisgICAgICB9LAorICAgICAgZGlzdDogeworICAgICAgICBmaWxlczogeworICAgICAgICAgICdkaXN0LzwlPSBwa2cubmFtZSAlPi5taW4uanMnOiBbJzwlPSBjb25jYXQuZGlzdC5kZXN0ICU+J10KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgc2hlbGw6IHsKKyAgICAgIEluc3RhbGxUaHJpZnRKUzogeworICAgICAgICBjb21tYW5kOiAnbWtkaXIgLXAgdGVzdC9idWlsZC9qcy9saWI7IGNwIHNyYy90aHJpZnQuanMgdGVzdC9idWlsZC9qcy90aHJpZnQuanMnCisgICAgICB9LAorICAgICAgSW5zdGFsbFRocmlmdE5vZGVKU0RlcDogeworICAgICAgICBjb21tYW5kOiAnY2QgLi4vLi47IG5wbSBpbnN0YWxsJworICAgICAgfSwKKyAgICAgIEluc3RhbGxUZXN0TGliczogeworICAgICAgICBjb21tYW5kOiAnY2QgdGVzdDsgYW50IGRvd25sb2FkX2pzbGlicycKKyAgICAgIH0sCisgICAgICBUaHJpZnRHZW46IHsKKyAgICAgICAgY29tbWFuZDogWworICAgICAgICAgICdta2RpciAtcCB0ZXN0L2dlbi1qcycsCisgICAgICAgICAgJy4uLy4uL2NvbXBpbGVyL2NwcC90aHJpZnQgLWdlbiBqcyAtLW91dCB0ZXN0L2dlbi1qcyAuLi8uLi90ZXN0L1RocmlmdFRlc3QudGhyaWZ0JywKKyAgICAgICAgICAnLi4vLi4vY29tcGlsZXIvY3BwL3RocmlmdCAtZ2VuIGpzIC0tb3V0IHRlc3QvZ2VuLWpzIC4uLy4uL3Rlc3QvSnNEZWVwQ29uc3RydWN0b3JUZXN0LnRocmlmdCcsCisgICAgICAgICAgJ21rZGly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3RocmlmdCAtZ2VuIGpzIC1vIHRlc3QgLi4vLi4vdGVzdC9Kc0RlZXBDb25zdHJ1Y3RvclRlc3QudGhyaWZ0JworICAgICAgfSwKKyAgICAgIFRocmlmdEdlbkRvdWJsZUNvbnN0YW50czogeworICAgICAgICBjb21tYW5kOiAnLi4vLi4vY29tcGlsZXIvY3BwL3RocmlmdCAtZ2VuIGpzIC1vIHRlc3QgLi4vLi4vdGVzdC9Eb3VibGVDb25zdGFudHNUZXN0LnRocmlmdCcKKyAgICAgIH0sCisgICAgICBUaHJpZnRUZXN0U2VydmVyOiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICBhc3luYzogdHJ1ZSwKKyAgICAgICAgICBleGVjT3B0aW9uczogeworICAgICAgICAgICAgY3dkOiAiLi90ZXN0IiwKKyAgICAgICAgICAgIGVudjoge05PREVfUEFUSDogIi4uLy4uL25vZGVqcy9saWI6Li4vLi4vLi4vbm9kZV9tb2R1bGVzIn0KKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIGNvbW1hbmQ6ICJub2RlIHNlcnZlcl9odHRwLmpzIiwKKyAgICAgIH0sCisgICAgICBUaHJpZnRUZXN0U2VydmVyRVM2OiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICBhc3luYzogdHJ1ZSwKKyAgICAgICAgICBleGVjT3B0aW9uczogeworICAgICAgICAgICAgY3dkOiAiLi90ZXN0IiwKKyAgICAgICAgICAgIGVudjoge05PREVfUEFUSDogIi4uLy4uL25vZGVqcy9saWI6Li4vLi4vLi4vbm9kZV9tb2R1bGVzIn0KKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIGNvbW1hbmQ6ICJub2RlIHNlcnZlcl9odHRwLmpzIC0tZXM2IiwKKyAgICAgIH0sCisgICAgICBUaHJpZnRUZXN0U2VydmVyX1RMUzogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgYXN5bmM6IHRydWUsCisgICAgICAgICAgZXhlY09wdGlvbnM6IHsKKyAgICAgICAgICAgIGN3ZDogIi4vdGVzdCIsCisgICAgICAgICAgICBlbnY6IHtOT0RFX1BBVEg6ICIuLi8uLi9ub2RlanMvbGliOi4uLy4uLy4uL25vZGVfbW9kdWxlcyJ9CisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICBjb21tYW5kOiAibm9kZSBzZXJ2ZXJfaHR0cHMuanMiLAorICAgICAgfSwKKyAgICAgIFRocmlmdFRlc3RTZXJ2ZXJFUzZfVExTOiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICBhc3luYzogdHJ1ZSwKKyAgICAgICAgICBleGVjT3B0aW9uczogeworICAgICAgICAgICAgY3dkOiAiLi90ZXN0IiwKKyAgICAgICAgICAgIGVudjoge05PREVfUEFUSDogIi4uLy4uL25vZGVqcy9saWI6Li4vLi4vLi4vbm9kZV9tb2R1bGVzIn0KKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIGNvbW1hbmQ6ICJub2RlIHNlcnZlcl9odHRwcy5qcyAtLWVzNiIsCisgICAgICB9LAorICAgIH0sCisgICAgcXVuaXQ6IHsKKyAgICAgIFRocmlmdEpTOiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICB1cmxzOiBbCisgICAgICAgICAgICAnaHR0cDovL2xvY2FsaG9zdDo4MDg5L3Rlc3Qtbm9qcS5odG1sJworICAgICAgICAgIF0sCisgICAgICAgICAgcHVwcGV0ZWVyOiB7CisgICAgICAgICAgICBoZWFkbGVzczogdHJ1ZSwKKyAgICAgICAgICAgIGFyZ3M6IFsnLS1uby1zYW5kYm94J10sCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIFRocmlmdEpTSlE6IHsKKyAgICAgICAgb3B0aW9uczogeworICAgICAgICAgIHVybHM6IFsKKyAgICAgICAgICAgICdodHRwOi8vbG9jYWxob3N0OjgwODkvdGVzdC5odG1sJworICAgICAgICAgIF0sCisgICAgICAgICAgcHVwcGV0ZWVyOiB7CisgICAgICAgICAgICBoZWFkbGVzczogdHJ1ZSwKKyAgICAgICAgICAgIGFyZ3M6IFsnLS1uby1zYW5kYm94J10sCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIFRocmlmdEpTX0RvdWJsZVJlbmRlcmluZzogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgdXJsczogWworICAgICAgICAgICAgJ2h0dHA6Ly9sb2NhbGhvc3Q6ODA4OS90ZXN0LWRvdWJsZS1yZW5kZXJpbmcuaHRtbCcKKyAgICAgICAgICBdLAorICAgICAgICAgIHB1cHBldGVlcjogeworICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsCisgICAgICAgICAgICBhcmdzOiBbJy0tbm8tc2FuZGJveCddLAorICAgICAgICAgICAgaWdub3JlSFRUUFNFcnJvcnM6IHRydWUsCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIFRocmlmdFdTOiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICB1cmxzOiBbCisgICAgICAgICAgICAnaHR0cDovL2xvY2FsaG9zdDo4MDg5L3Rlc3R3cy5odG1sJworICAgICAgICAgIF0sCisgICAgICAgICAgcHVwcGV0ZWVyOiB7CisgICAgICAgICAgICBoZWFkbGVzczogdHJ1ZSwKKyAgICAgICAgICAgIGFyZ3M6IFsnLS1uby1zYW5kYm94J10sCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIFRocmlmdEpTX1RMUzogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgdXJsczogWworICAgICAgICAgICAgJ2h0dHBzOi8vbG9jYWxob3N0OjgwOTEvdGVzdC1ub2pxLmh0bWwnCisgICAgICAgICAgXSwKKyAgICAgICAgICBwdXBwZXRlZXI6IHsKKyAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLAorICAgICAgICAgICAgYXJnczogWyctLW5vLXNhbmRib3gnXSwKKyAgICAgICAgICAgIGlnbm9yZUhUVFBTRXJyb3JzOiB0cnVlLAorICAgICAgICAgIH0sCisgICAgICAgIH0KKyAgICAgIH0sCisgICAgICBUaHJpZnRKU0pRX1RMUzogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgdXJsczogWworICAgICAgICAgICAgJ2h0dHBzOi8vbG9jYWxob3N0OjgwOTEvdGVzdC5odG1sJworICAgICAgICAgIF0sCisgICAgICAgICAgcHVwcGV0ZWVyOiB7CisgICAgICAgICAgICBoZWFkbGVzczogdHJ1ZSwKKyAgICAgICAgICAgIGFyZ3M6IFsnLS1uby1zYW5kYm94J10sCisgICAgICAgICAgICBpZ25vcmVIVFRQU0Vycm9yczogdHJ1ZSwKKyAgICAgICAgICB9LAorICAgICAgICB9CisgICAgICB9LAorICAgICAgVGhyaWZ0V1NfVExTOiB7CisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICB1cmxzOiBbCisgICAgICAgICAgICAnaHR0cHM6Ly9sb2NhbGhvc3Q6ODA5MS90ZXN0d3MuaHRtbCcKKyAgICAgICAgICBdLAorICAgICAgICAgIHB1cHBldGVlcjogeworICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsCisgICAgICAgICAgICBhcmdzOiBbJy0tbm8tc2FuZGJveCddLAorICAgICAgICAgICAgaWdub3JlSFRUUFNFcnJvcnM6IHRydWUsCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIFRocmlmdERlZXBDb25zdHJ1Y3RvcjogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgdXJsczogWworICAgICAgICAgICAgJ2h0dHA6Ly9sb2NhbGhvc3Q6ODA4OS90ZXN0LWRlZXAtY29uc3RydWN0b3IuaHRtbCcKKyAgICAgICAgICBdLAorICAgICAgICAgIHB1cHBldGVlcjogeworICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsCisgICAgICAgICAgICBhcmdzOiBbJy0tbm8tc2FuZGJveCddLAorICAgICAgICAgIH0sCisgICAgICAgIH0KKyAgICAgIH0sCisgICAgICBUaHJpZnRXU0VTNjogeworICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgdXJsczogWworICAgICAgICAgICAgJ2h0dHA6Ly9sb2NhbGhvc3Q6ODA4OC90ZXN0LWVzNi5odG1sJworICAgICAgICAgIF0sCisgICAgICAgICAgcHVwcGV0ZWVyOiB7CisgICAgICAgICAgICBoZWFkbGVzczogdHJ1ZSwKKyAgICAgICAgICAgIGFyZ3M6IFsnLS1uby1zYW5kYm94J10sCisgICAgICAgICAgfSwKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAganNoaW50OiB7CisgICAgICAvLyBUaGUgbWFpbiB0aHJpZnQgbGlicmFyeSBmaWxlLiBub3QgZXM2IHlldCA6KAorICAgICAgbGliOiB7CisgICAgICAgIHNyYzogWydzcmMvKiovKi5qcyddLAorICAgICAgfSwKKyAgICAgIC8vIFRoZSB0ZXN0IGZpbGVzIHVzZSBlczYKKyAgICAgIHRlc3Q6IHsKKyAgICAgICAgc3JjOiBbJ0dydW50ZmlsZS5qcycsICd0ZXN0LyouanMnXSwKKyAgICAgICAgb3B0aW9uczogeworICAgICAgICAgIGVzdmVyc2lvbjogNiwKKyAgICAgICAgfQorICAgICAgfSwKKyAgICAgIGdlbl9qc19jb2RlOiB7CisgICAgICAgIHNyYzogWyd0ZXN0L2dlbi1qcy8qLmpzJywgJ3Rlc3QvZ2VuLWpzLWpxdWVyeS8qLmpzJ10sCisgICAgICB9LAorICAgICAgZ2VuX2VzNl9jb2RlOiB7CisgICAgICAgIHNyYzogWyd0ZXN0L2dlbi1qcy1lczYvKi5qcyddLAorICAgICAgICBvcHRpb25zOiB7CisgICAgICAgICAgZXN2ZXJzaW9uOiA2LAorICAgICAgICB9CisgICAgICB9LAorICAgICAgZ2VuX25vZGVfY29kZTogeworICAgICAgICBzcmM6IFsndGVzdC9nZW4tbm9kZWpzLyouanMnXSwKKyAgICAgICAgb3B0aW9uczogeworICAgICAgICAgIG5vZGU6IHRydWUsCisgICAgICAgIH0KKyAgICAgIH0sCisgICAgICBnZW5fbm9kZV9lczZfY29kZTogeworICAgICAgICBzcmM6IFsndGVzdC9nZW4tbm9kZWpzLWVzNi8qLmpzJ10sCisgICAgICAgIG9wdGlvbnM6IHsKKyAgICAgICAgICBub2RlOiB0cnVlLAorICAgICAgICAgIGVzdmVyc2lvbjogNiwKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgIH0pOworCisgIGdydW50LmxvYWROcG1UYXNrcygnZ3J1bnQtY29udHJpYi11Z2xpZnknKTsKKyAgZ3J1bnQubG9hZE5wbVRhc2tzKCdncnVudC1jb250cmliLWpzaGludCcpOworICBncnVudC5sb2FkTnBtVGFza3MoJ2dydW50LWNvbnRyaWItcXVuaXQnKTsKKyAgZ3J1bnQubG9hZE5wbVRhc2tzKCdncnVudC1jb250cmliLWNvbmNhdCcpOworICBncnVudC5sb2FkTnBtVGFza3MoJ2dydW50LWpzZG9jJyk7CisgIGdydW50LmxvYWROcG1UYXNrcygnZ3J1bnQtc2hlbGwtc3Bhd24nKTsKKworICBncnVudC5yZWdpc3RlclRhc2soJ3dhaXQnLCAnV2FpdCBqdXN0IG9uZSBzZWNvbmQgZm9yIHNlcnZlciB0byBzdGFydCcsIGZ1bmN0aW9uICgpIHsKKyAgICB2YXIgZG9uZSA9IHRoaXMuYXN5bmMoKTsKKyAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkgeworICAgICAgZG9uZSh0cnVlKTsKKyAgICB9LCAxMDAwKTsKKyAgfSk7CisKKyAgZ3J1bnQucmVnaXN0ZXJUYXNrKCdpbnN0YWxsQW5kR2VuZXJhdGUnLCBbCisgICAgJ3NoZWxsOkluc3RhbGxUaHJpZnRKUycsICdzaGVsbDpJbnN0YWxsVGhyaWZ0Tm9kZUpTRGVwJywgJ3NoZWxsOlRocmlmdEdlbicsCisgICAgJ3NoZWxsOlR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ICAgICAgICAgKGZ1bmN0aW9uKCkgeworICAgICAgICAgICAgdmFyIHRyYW5zcG9ydCA9IG5ldyBUaHJpZnQuVFhIUlRyYW5zcG9ydCgiL2hlbGxvIik7CisgICAgICAgICAgICB2YXIgcHJvdG9jb2wgID0gbmV3IFRocmlmdC5USlNPTlByb3RvY29sKHRyYW5zcG9ydCk7CisgICAgICAgICAgICB2YXIgY2xpZW50ICAgID0gbmV3IGhlbGxvX3N2Y0NsaWVudChwcm90b2NvbCk7CisgICAgICAgICAgICB2YXIgbmFtZUVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgibmFtZV9pbiIpOworICAgICAgICAgICAgdmFyIG91dHB1dEVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgib3V0cHV0Iik7CisgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZ2V0X21zZyIpCisgICAgICAgICAgICAgIC5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGZ1bmN0aW9uKCl7CisgICAgICAgICAgICAgICAgY2xpZW50LmdldF9tZXNzYWdlKG5hbWVFbGVtZW50LnZhbHVlLCBmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgICAgICAgICAgICAgIG91dHB1dEVsZW1lbnQuaW5uZXJIVE1MID0gcmVzdWx0OworICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICB9KSgpOworICAgICAgICA8L3NjcmlwdD4KKyAgICAgIDwvYm9keT4KKyAgICA8L2h0bWw+CisKKyMjIyBoZWxsby5qcyAtIE5vZGUgU2VydmVyCisgICAgdmFyIHRocmlmdCA9IHJlcXVpcmUoJ3RocmlmdCcpOworICAgIHZhciBoZWxsb19zdmMgPSByZXF1aXJlKCcuL2dlbi1ub2RlanMvaGVsbG9fc3ZjLmpzJyk7CisgICAgCisgICAgdmFyIGhlbGxvX2hhbmRsZXIgPSB7CisgICAgICBnZXRfbWVzc2FnZT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jogeworICAgICAgICAia2luZC1vZiI6ICJeMy4wLjIiLAorICAgICAgICAibG9uZ2VzdCI6ICJeMS4wLjEiLAorICAgICAgICAicmVwZWF0LXN0cmluZyI6ICJeMS41LjIiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImtpbmQtb2YiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMy4yLjIiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9raW5kLW9mLy0va2luZC1vZi0zLjIuMi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1NZW9ocHpTNnVidXc4eVJtMkpPdXBSNUtQR1E9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtYnVmZmVyIjogIl4xLjEuNSIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJhbnNpLXJlZ2V4IjogeworICAgICAgInZlcnNpb24iOiAiMi4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2Fuc2ktcmVnZXgvLS9hbnNpLXJlZ2V4LTIuMS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtdzdNNnRlNDJEWWJnNWlqd1Jvcm43eWZXVk44PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImFuc2ktc3R5bGVzIjogeworICAgICAgInZlcnNpb24iOiAiMy4yLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2Fuc2ktc3R5bGVzLy0vYW5zaS1zdHlsZXMtMy4yLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVZUMFpJNmtaUmRUaDhZeUp3M1NNYlltL3UrTnFmc0F4RXBXTzBQZjlzcTgvZTk0V3h4T3BQS3g5RlIxRmx5Q3RPVkROT1ErOG50bHFGeGlSYytyNXFBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb2xvci1jb252ZXJ0IjogIl4xLjkuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJhcmdwYXJzZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYXJncGFyc2UvLS9hcmdwYXJzZS0xLjAuMTAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLW81Um95NnRORzRTTC9GT2tDQU42UnpqaWFrWlMyNVJMWUZyY010dEpxYmRkOEJXcm5BK2ZHejU3aU41UGIwNnB2Qkd2bDVnUTBCNDhkSmxzbFh2b1RnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJzcHJpbnRmLWpzIjogIn4xLjAuMiIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAic3ByaW50Zi1qcyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMyIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NwcmludGYtanMvLS9zcHJpbnRmLWpzLTEuMC4zLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUJPYVNiMllvbFRWUFBkQVZJRFl6dUZjcGZpdz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJhcnItZGlmZiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjQuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5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YXJyYXktZmluZC1pbmRleCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9hcnJheS1maW5kLWluZGV4Ly0vYXJyYXktZmluZC1pbmRleC0xLjAuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTN3RUtvU2grRmt1OXB2bHlPd3FXb2V4Qmg2RT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJhcnJheS1zbGljZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9hcnJheS1zbGljZS8tL2FycmF5LXNsaWNlLTEuMS4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1CMXFNRDNSQlA3TzhvMEgyS2JyWER5QjBJY2Nlak1GMTUrODdMdmxvcjEyT05QUkhQNmdUalhNTmt0L2QzWnVPR2JBZTY2aEZtYUNmRUNJMjRVZnA2dz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiYXJyYXktdW5pcXVlIjogeworICAgICAgInZlcnNpb24iOiAiMC4zLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2FycmF5LXVuaXF1ZS8tL2FycmF5LXVuaXF1ZS0wLjMuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXFKUzNYVXZFOXMxbm52TWtTcC9ZOUdyaTFDZz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJhc24xIjogeworICAgICAgInZlcnNpb24iOiAiMC4yLjQiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2FzbjEvLS9hc24xLTAuMi40LnRneiIsCisgICAgICAiaW50ZWd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Vp5bz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJhc3luYy1saW1pdGVyIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2FzeW5jLWxpbWl0ZXIvLS9hc3luYy1saW1pdGVyLTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1qcC91Rm5vb09pTytMMjExZVpPb1N5enBPSVRNWHgxckJJVGF1WXlrRzNCUllQdThoMFVjeHNQTkIwNFJSNXZvNFR5ejMrYXkxN3RSNkpWZjlxellXZz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiYXN5bmNraXQiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjQuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYXN5bmNraXQvLS9hc3luY2tpdC0wLjQuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXg1N1pmMzgweTQ4cm9ieVhrTHpEWmtkTFMzaz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAiYXRvYiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMS4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9hdG9iLy0vYXRvYi0yLjEuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItV202dWtvYU9HSmkvNzNwL2NsMkd2TGpUSTVKTTFrL08xNGlzRDczWU1MOFN0ckgvNy9sUkZnbWc4bklDWmdEM2JaWnZqd0NHeHRNT0Qzd1dOQXU4Y2c9PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImF3cy1zaWduMiI6IHsKKyAgICAgICJ2ZXJzaW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xdE9HUHJzTWh0SkE0ckQ5dGtnQTBGMXFKM2dSRlJYY0hZVmtkZWFQNTBRNXJFL2pMUT09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAia2luZC1vZiI6ICJeNi4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiaXMtZGVzY3JpcHRvciI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLWRlc2NyaXB0b3IvLS9pcy1kZXNjcmlwdG9yLTEuMC4yLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItMmVpczVXcVFHVjdwZW9vRHlMbU5FUFVycHM5K1NYWDVjOXBMM3hFQis0ZTlIbkd1RGE3bUI3a0h4SHc0Q2JxUzlrMVQyaE9IM21pTDhuOFd0aVlWdGc9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWFjY2Vzc29yLWRlc2NyaXB0b3IiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJpcy1kYXRhLWRlc2NyaXB0b3IiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJraW5kLW9mIjogIl42LjAuMiIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJiY3J5cHQtcGJrZGYiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYmNyeXB0LXBia2RmLy0vYmNyeXB0LXBia2RmLTEuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtcERBZE9KdHFRL20yZi9QS0VhUDJZMzQyRHA0PSIsCisgICAgIC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lZ2lzdHJ5Lm5wbWpzLm9yZy9icmFjZXMvLS9icmFjZXMtMi4zLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWFOZGJuajlQOFBqZFhVNHliYVdMSzJJRjNqYy9Fb0RZYkM3QWF6VzZ0bzNUUnNmWHhzY0M5VVhPQjVpRGlFUXJreUliV3AyU0xRZGE0K1FBYTduYzN3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhcnItZmxhdHRlbiI6ICJeMS4xLjAiLAorICAgICAgICAiYXJyYXktdW5pcXVlIjogIl4wLjMuMiIsCisgICAgICAgICJleHRlbmQtc2hhbGxvdyI6ICJeMi4wLjEiLAorICAgICAgICAiZmlsbC1yYW5nZSI6ICJeNC4wLjAiLAorICAgICAgICAiaXNvYmplY3QiOiAiXjMuMC4xIiwKKyAgICAgICAgInJlcGVhdC1lbGVtZW50IjogIl4xLjEuMiIsCisgICAgICAgICJzbmFwZHJhZ29uIjogIl4wLjguMSIsCisgICAgICAgICJzbmFwZHJhZ29uLW5vZGUiOiAiXjIuMC4xIiwKKyAgICAgICAgInNwbGl0LXN0cmluZyI6ICJeMy4wLjIiLAorICAgICAgICAidG8tcmVnZXgiOiAiXjMuMC4xIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJleHRlbmQtc2hhbGxvdyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjAuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2V4dGVuZC1zaGFsbG93Ly0vZXh0ZW5kLXNoYWxsb3ctMi4wLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtVWE5OVlVclpxZllRNmh1dnU1aWRheHhXaVE4PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAg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gICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiYnVpbHRpbi1tb2R1bGVzIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2J1aWx0aW4tbW9kdWxlcy8tL2J1aWx0aW4tbW9kdWxlcy0xLjEuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUp3OEhiRnB5d0M5YlphUjkrVXhmNDZKNGlTOD0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJjYWNoZS1iYXNlIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NhY2hlLWJhc2UvLS9jYWNoZS1iYXNlLTEuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1BS2NkVG5GU1dBVGQ1L0dDUFJ4cjJDaHdJSjg1Q2V5ckV5alJIbEt4UTU2ZDRYSk1HeW0wdUFpS24weGJMT0dPbDMreVJwT1RpNDg0ZFZDRWM1QVV6UT09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiY29sbGVjdGlvbi12aXNpdCI6ICJeMS4wLjAiLAorICAgICAgICAiY29tcG9uZW50LWVtaXR0ZXIiOiAiXjEuMi4xIiwKKyAgICAgICAgImdldC12YWx1ZSI6ICJeMi4wLjYiLAorICAgICAgICAiaGFzLXZhbHVlIjogIl4xLjAuMCIsCisgICAgICAgICJpc29iamVjdCI6ICJeMy4wLjEiLAorICAgICAgICAic2V0LXZhbHVlIjogIl4yLjAuMCIsCisgICAgICAgICJ0by1vYmplY3QtcGF0aCI6ICJeMC4zLjAiLAorICAgICAgICAidW5pb24tdmFsdWUiOiAiXjEuMC4wIiwKKyAgICAgICAgInVuc2V0LXZhbHVlIjogIl4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJjYW1lbGNhc2UiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjEuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2FtZWxjYXNlLy0vY2FtZWxjYXNlLTIuMS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtZkIwVzFubWh1K1djb0N5czdQc0JIaUFmV2g4PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImNhbWVsY2FzZS1rZXlzIjogeworICAgICAgInZlcnNpb24iOiAiMi4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2FtZWxjYXNlLWtleXMvLS9jYW1lbGNhc2Uta2V5cy0yLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLU1JdnVyLzN5Z1JrRkh2b2RreUlUeVJ1UGt1Yz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjYW1lbGNhc2UiOiAiXjIuMC4wIiwKKyAgICAgICAgIm1hcC1vYmoiOiAiXjEuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImNhc2VsZXNzIjogeworICAgICAgInZlcnNpb24iOiAiMC4xMi4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jYXNlbGVzcy8tL2Nhc2VsZXNzLTAuMTIuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUcyZ2NJZitFQXp5Q1pVTUpCb2xDRFJoeFVkdz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAiY2F0aGFyc2lzIjogeworICAgICAgInZlcnNpb24iOiAiMC44LjkiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NhdGhhcnNpcy8tL2NhdGhhcnNpcy0wLjguOS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLW1NeUpES1pTM1M3dzV3czNrbE1RLzU2US9Jcz0iLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAidW5kZXJzY29yZS1jb250cmliIjogIn4wLjMuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJjZW50ZXItYWxpZ24iOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEuMyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2VudGVyLWFsaWduLy0vY2VudGVyLWFsaWduLTAuMS4zLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtcWcweVlwdHU2WElnQkJITDFFWWNrSHZDdDYwPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFsaWduLXRleHQiOiAiXjAuMS4zIiwKKyAgICAgICAgImxhenktY2FjaGUiOiAiXjEuMC4zIgorICAgICAgfQorICAgIH0sCisgICAgImNoYWxrIjogeworICAgICAgInZlcnNpb24iOiAiMi40LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NoYWxrLy0vY2hhbGstMi40LjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU9iTjZoMXYyZlRKU21VWG9TM25NUTkyTGJESzliZTRUVis2RytvbVFsR0pGZGNVWDVoZUtpMUxaMVluUk1JZ3dUTEVqM0UyNGJUNnRZbmk1MHJsQ2ZRPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhbnNpLXN0eWxlcyI6ICJeMy4yLjEiLAorICAgICAgICAiZXNjYXBlLXN0cmluZy1yZWdleHAiOiAiXjEuMC41IiwKKyAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogIl41LjMuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJjbGFzcy11dGlscyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMy42IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jbGFzcy11dGlscy8tL2NsYXNzLXV0aWxzLTAuMy42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1xT2hQYS9GajdzNlRZOEg4ZXNHdTVRTnBNTVF4ejc5aCt1cnpyTllONm1uKzlCbnhsREdmNVFaK1hlQ0RzeFNqUHFzU1I1NlhPWk9KbXBldXJuTE1lZz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXJyLXVuaW9uIjogIl4zLjEuMCIsCisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjAuMi41IiwKKyAgICAgICAgImlzb2JqZWN0IjogIl4zLjAuMCIsCisgICAgICAgICJzdGF0aWMtZXh0ZW5kIjogIl4wLjEuMSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZGVmaW5lLXByb3BlcnR5IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjAuMi41IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVmaW5lLXByb3BlcnR5Ly0vZGVmaW5lLXByb3BlcnR5LTAuMi41LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXcxc2UrUmpzUEprUG1sdkZlK0JLck94Y2dSWT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1kZXNjcmlwdG9yIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJjbGkiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2xpLy0vY2xpLTEuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSW9GMU5QSkwra2xRdzAxVExVanN2R0liakJRPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImV4aXQiOiAiMC4xLjIiLAorICAgICAgICAiZ2xvYiI6ICJeNy4xLjEiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImdsb2IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiNy4xLjMiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9nbG9iLy0vZ2xvYi03LjEuMy50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXZjZnVpSXhvZ0xWNERsR0JISVVPd0kwSWJySjhIV1BjNE1VN0h6dmlHZU5oby9VSkRmaTZCNXAzc0hlV0lRMEtHSVUwSnB4aTVaSHhlbVFmTGtrQXdRPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJmcy5yZWFscGF0aCI6ICJeMS4wLjAiLAorICAgICAgICAgICAgImluZmxpZ2h0IjogIl4xLjAuNCIsCisgICAgICAgICAgICAiaW5oZXJpdHMiOiAiMiIsCisgICAgICAgICAgICAibWluaW1hdGNoIjogIl4zLjAuNCIsCisgICAgICAgICAgICAib25jZSI6ICJeMS4zLjAiLAorICAgICAgICAgICAgInBhdGgtaXMtYWJzb2x1dGUiOiAiXjEuMC4wIgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImNsaXVpIjogeworICAgICAgInZlcnNpb24iOiAiMi4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NsaXVpLy0vY2xpdWktMi4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1TMGRYWVArQUpreDJMRG9YR1FNdWtjZitvTkU9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiY2VudGVyLWFsaWduIjogIl4wLjEuMSIsCisgICAgICAgICJyaWdodC1hbGlnbiI6ICJeMC4xLjEiLAorICAgICAgICAid29yZHdyYXAiOiAiMC4wLjIiCisgICAgICB9CisgICAgfSwKKyAgICAiY28iOiB7CisgICAgICAidmVyc2lvbiI6ICI0LjYuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY28vLS9jby00LjYuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWJxYTk4OWhUcmxUTXVPUjcrZ3Z6K1FNZnNZUT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAiY29mZmVlc2NyaXB0IjogeworICAgICAgInZlcnNpb24iOiAiMS4xMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jb2ZmZWVzY3JpcHQvLS9jb2ZmZWVzY3JpcHQtMS4xMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtNTZxREFaRis5aUd6WFlvNTgwamMzUjIzNHo0PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImNvbGxlY3Rpb24tdmlzaXQiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5uc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4xLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NvbG9ycy8tL2NvbG9ycy0xLjEuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUZvcEhBWFZyYW45Um9Temd5WHY2S01DRTdXTT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJjb21iaW5lZC1zdHJlYW0iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuNyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY29tYmluZWQtc3RyZWFtLy0vY29tYmluZWQtc3RyZWFtLTEuMC43LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1icldsOXk2dk9CMXhZUFpjcFpkZTNOOXpEQnlYVG9zQWVNRG80cDF3em82VU1PWDR2dW1CK1RQMVJaNzZzZkU2TWQ2OFEwTkpTckUvZ2JlemQ0VWwrdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZGVsYXllZC1zdHJlYW0iOiAifjEuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImNvbXBvbmVudC1lbWl0dGVyIjogeworICAgICAgInZlcnNpb24iOiAiMS4yLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NvbXBvbmVudC1lbWl0dGVyLy0vY29tcG9uZW50LWVtaXR0ZXItMS4yLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1FM2tZMXRlQ2cvZmZlbXQ4V21QaFFPYVVKZVk9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiY29uY2F0LW1hcCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jb25jYXQtbWFwLy0vY29uY2F0LW1hcC0wLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTJLbHIxMy9XamZkNU9uTURhanVnMVVCZFIzcz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJjb25jYXQtc3RyZWFtIjogeworICAgICAgInZlcnNpb24iOiAiMS42LjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NvbmNhdC1zdHJlYW0vLS9jb25jYXQtc3RyZWFtLTEuNi4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi0yN0hCZ2hKeGppWnRJazNZY3ZuLzRrYkprLzF1WnVKRmZ1UEVuczZMYUV2cHZHMWYwaFRlYThsaWxyb3V5bzltVmMyR1dkY0VaOE9Mb0dtU0FEbHJDdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYnVmZmVyLWZyb20iOiAiXjEuMC4wIiwKKyAgICAgICAgImluaGVyaXRzIjogIl4yLjAuMyIsCisgICAgICAgICJyZWFkYWJsZS1zdHJlYW0iOiAiXjIuMi4yIiwKKyAgICAgICAgInR5cGVkYXJyYXkiOiAiXjAuMC42IgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJyZWFkYWJsZS1zdHJlYW0iOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4zLjYiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL3JlYWRhYmxlLXN0cmVhbS8tL3JlYWRhYmxlLXN0cmVhbS0yLjMuNi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXRRdEtBOVdJQWhCRjMrVkxBc2V5TXFaZUJqVzBBSEpveE90WXFTVVpOSnhhdUVybUxiVm0yRlcxeStKL1lBOWRVckFDMzlJVGVqbFpXaFZJd2F3a0t3PT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJjb3JlLXV0aWwtaXMiOiAifjEuMC4wIiwKKyAgICAgICAgICAgICJpbmhlcml0cyI6ICJ+Mi4wLjMiLAorICAgICAgICAgICAgImlzYXJyYXkiOiAifjEuMC4wIiwKKyAgICAgICAgICAgICJwcm9jZXNzLW5leHRpY2stYXJncyI6ICJ+Mi4wLjAiLAorICAgICAgICAgICAgInNhZmUtYnVmZmVyIjogIn41LjEuMSIsCisgICAgICAgICAgICAic3RyaW5nX2RlY29kZXIiOiAifjEuMS4xIiwKKyAgICAgICAgICAgICJ1dGlsLWRlcHJlY2F0ZSI6ICJ+MS4wLjEiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAic3RyaW5nX2RlY29kZXIiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4xLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zdHJpbmdfZGVjb2Rlci8tL3N0cmluZ19kZWNvZGVyLTEuMS4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItbi9TaG52RGk2RkhiYlZmdmlybytXb2ppRnp2K3M4TVBNSEJjelZlUGZVcERKTHdvTFQwaHQxbDRZd0JDYmk4cEpBdmVFRWRua0h5UHlUUC9telJmd2c9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgInNhZmUtYnVmZmVyIjogIn41LjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJjb25zb2xlLWJyb3dzZXJpZnkiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjEuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3Ry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VRWTHJCU3Q3ZmpiRHlnejgwNXBNbnN0SXMyVlRCTmtSbTBxeFpkK003QTVYRGR4VlJXTzVNeEdCWFpoalk0Y3FMWUxkdHJHcVJmOG1CUG16d1NwV1E9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgIm5pY2UtdHJ5IjogIl4xLjAuNCIsCisgICAgICAgICJwYXRoLWtleSI6ICJeMi4wLjEiLAorICAgICAgICAic2VtdmVyIjogIl41LjUuMCIsCisgICAgICAgICJzaGViYW5nLWNvbW1hbmQiOiAiXjEuMi4wIiwKKyAgICAgICAgIndoaWNoIjogIl4xLjIuOSIKKyAgICAgIH0KKyAgICB9LAorICAgICJjdXJyZW50bHktdW5oYW5kbGVkIjogeworICAgICAgInZlcnNpb24iOiAiMC40LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2N1cnJlbnRseS11bmhhbmRsZWQvLS9jdXJyZW50bHktdW5oYW5kbGVkLTAuNC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbUkzelArcXhrZTk1bW1FMm5kZHNGNjM1VitvPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFycmF5LWZpbmQtaW5kZXgiOiAiXjEuMC4xIgorICAgICAgfQorICAgIH0sCisgICAgImN5Y2xlIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2N5Y2xlLy0vY3ljbGUtMS4wLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1JZWdMSytoWUQ1aTBhUE41UXdaaXNFYkRTdEk9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgIm9wdGlvbmFsIjogdHJ1ZQorICAgIH0sCisgICAgImRhc2hkYXNoIjogeworICAgICAgInZlcnNpb24iOiAiMS4xNC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kYXNoZGFzaC8tL2Rhc2hkYXNoLTEuMTQuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWhUejZEM3krTCsxZDRnTW11TjFZRURYMjR2QT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXNzZXJ0LXBsdXMiOiAiXjEuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImRhdGUtbm93IjogeworICAgICAgInZlcnNpb24iOiAiMC4xLjQiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2RhdGUtbm93Ly0vZGF0ZS1ub3ctMC4xLjQudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS02dlE1L1UxSVNLMTA1Y3g5dnZJQVp5dWVORnM9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiZGF0ZWZvcm1hdCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGF0ZWZvcm1hdC8tL2RhdGVmb3JtYXQtMS4wLjEyLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbnhKTFoxbE1rMy8zQnBNdVNtUXN5bzI3L3VrPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdldC1zdGRpbiI6ICJeNC4wLjEiLAorICAgICAgICAibWVvdyI6ICJeMy4zLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiZGVidWciOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjYuOSIsCis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F0YS1kZXNjcmlwdG9yLy0vaXMtZGF0YS1kZXNjcmlwdG9yLTEuMC4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItamJSWHkxRm10QW9DalFrVm1JVll3dXVxREZVYmFPZURqbWVkMXRPR1Byc01odEpBNHJEOXRrZ0EwRjFxSjNnUkZSWGNIWVZrZGVhUDUwUTVyRS9qTFE9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImtpbmQtb2YiOiAiXjYuMC4wIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgImlzLWRlc2NyaXB0b3IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4wLjIiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pcy1kZXNjcmlwdG9yLy0vaXMtZGVzY3JpcHRvci0xLjAuMi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLTJlaXM1V3FRR1Y3cGVvb0R5TG1ORVBVcnBzOStTWFg1YzlwTDN4RUIrNGU5SG5HdURhN21CN2tIeEh3NENicVM5azFUMmhPSDNtaUw4bjhXdGlZVnRnPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1hY2Nlc3Nvci1kZXNjcmlwdG9yIjogIl4xLjAuMCIsCisgICAgICAgICAgICAiaXMtZGF0YS1kZXNjcmlwdG9yIjogIl4xLjAuMCIsCisgICAgICAgICAgICAia2luZC1vZiI6ICJeNi4wLjIiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAiZGVsYXllZC1zdHJlYW0iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVsYXllZC1zdHJlYW0vLS9kZWxheWVkLXN0cmVhbS0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTN6cmhtYXl0KzMxRUNxcmdzcDRpY3JKT3hoaz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJkZXRlY3QtZmlsZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kZXRlY3QtZmlsZS8tL2RldGVjdC1maWxlLTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtOE5adEEyY3FnbHl4dHp2YlArWWpFTWpsVXJjPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImRvbS1zZXJpYWxpemVyIjogeworICAgICAgInZlcnNpb24iOiAiMC4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2RvbS1zZXJpYWxpemVyLy0vZG9tLXNlcmlhbGl6ZXItMC4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1CenhwZFViT0I0RE9JNzVLS09LVDVBdkRESUk9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZG9tZWxlbWVudHR5cGUiOiAifjEuMS4xIiwKKyAgICAgICAgImVudGl0aWVzIjogIn4xLjEuMSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZG9tZWxlbWVudHR5cGUiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4xLjMiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kb21lbGVtZW50dHlwZS8tL2RvbWVsZW1lbnR0eXBlLTEuMS4zLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXZTaDNQaVpDaUJyc1VWUkpKQ21jWE5naUdGcz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0sCisgICAgICAgICJlbnRpdGllcyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjEuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2VudGl0aWVzLy0vZW50aXRpZXMtMS4xLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtYmx3dENsWWh0ZHJhN08rQXVRN2Z0YzEzY3ZBPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImRvbWVsZW1lbnR0eXBlIjogeworICAgICAgInZlcnNpb24iOiAiMS4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2RvbWVsZW1lbnR0eXBlLy0vZG9tZWxlbWVudHR5cGUtMS4zLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1zWHJ0Z3VpcldlVXQyY0diRjFiZy9CaHlCTUk9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiZG9taGFuZGxlciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMy4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kb21oYW5kbGVyLy0vZG9taGFuZGxlci0yLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUxlV2FDQ0xWQW4rci8yOERMQ3Nsb3FpcjV6Zz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkb21lbGVtZW50dHlwZSI6ICIxIgorICAgICAgfQorICAgIH0sCisgICAgImRvbXV0aWxzIjogeworICAgICAgInZlcnNpb24iOiAiMS41LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2RvbXV0aWxzLy0vZG9tdXRpbHMtMS41LjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS0zTmhJaWliMVk5WVFlZVNNbjN0K01qYzJnczg9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZG9tLXNlcmlhbGl6ZXIiOiAiMCIsCisgICAgICAgICJkb21lbGVtZW50dHlwZSI6ICIxIgorICAgICAgfQorICAgIH0sCisgICAgImVjYy1qc2JuIjogeworICAgICAgInZlcnNpb24iOiAiMC4xLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2VjYy1qc2JuLy0vZWNjLWpzYm4tMC4xLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1Pb09wQk9WRFV5aDRkTVZrdDFTVGhvU2FtTWs9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgIm9wdGlvbmFsIjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImpzYm4iOiAifjAuMS4wIiwKKyAgICAgICAgInNhZmVyLWJ1ZmZlciI6ICJeMi4xLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiZW50aXRpZXMiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZW50aXRpZXMvLS9lbnRpdGllcy0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXNwaDZvNElUUi96ZVpDc2svZnllVDdjU3Z5WT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJlcnJvci1leCI6IHsKKyAgICAgICJ2ZX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pqNDJIZk1naEI5TUtELzhhRjh1aHpRdz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJleHBhbmQtYnJhY2tldHMiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjEuNCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXhwYW5kLWJyYWNrZXRzLy0vZXhwYW5kLWJyYWNrZXRzLTIuMS40LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtdDNjMTR4WE9NUGEyNy9ENE93UVZHaUpFbGlJPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImRlYnVnIjogIl4yLjMuMyIsCisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjAuMi41IiwKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4yLjAuMSIsCisgICAgICAgICJwb3NpeC1jaGFyYWN0ZXItY2xhc3NlcyI6ICJeMC4xLjAiLAorICAgICAgICAicmVnZXgtbm90IjogIl4xLjAuMCIsCisgICAgICAgICJzbmFwZHJhZ29uIjogIl4wLjguMSIsCisgICAgICAgICJ0by1yZWdleCI6ICJeMy4wLjEiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImRlZmluZS1wcm9wZXJ0eSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjIuNSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2RlZmluZS1wcm9wZXJ0eS8tL2RlZmluZS1wcm9wZXJ0eS0wLjIuNS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS13MXNlK1Jqc1BKa1BtbHZGZStCS3JPeGNnUlk9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtZGVzY3JpcHRvciI6ICJeMC4xLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiZXh0ZW5kLXNoYWxsb3ciOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4wLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9leHRlbmQtc2hhbGxvdy8tL2V4dGVuZC1zaGFsbG93LTIuMC4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLVVhOTlZVXJacWZZUTZodXZ1NWlkYXh4V2lROD0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1leHRlbmRhYmxlIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJleHBhbmQtdGlsZGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXhwYW5kLXRpbGRlLy0vZXhwYW5kLXRpbGRlLTIuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbCtnQnFnVXQ4Q1JVM2thd0svWWhaQ3pjaFFJPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImhvbWVkaXItcG9seWZpbGwiOiAiXjEuMC4xIgorICAgICAgfQorICAgIH0sCisgICAgImV4dGVuZCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuMC4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9leHRlbmQvLS9leHRlbmQtMy4wLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWZqcXVDNTljRDdDeVc2dXJOWEswRkJ1ZmtaY29pR0c4MHdUdVB1alg1OTBjQjVUdGxuMjBFMlVCNFMvV0FSVnFoWGZmWmwyTE5nUytnUWRQSUlpbS9nPT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJleHRlbmQtc2hhbGxvdyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuMC4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9leHRlbmQtc2hhbGxvdy8tL2V4dGVuZC1zaGFsbG93LTMuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSnFjYXJ3YzdPZnNoSnhjblJoTWNKd1FDamJnPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFzc2lnbi1zeW1ib2xzIjogIl4xLjAuMCIsCisgICAgICAgICJpcy1leHRlbmRhYmxlIjogIl4xLjAuMSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiaXMtZXh0ZW5kYWJsZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLWV4dGVuZGFibGUvLS9pcy1leHRlbmRhYmxlLTEuMC4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItYXJuWE14VDFoaG9LbzlrMUxaZG1sTnlKZEREZnkydjBmWGpGbG1vazQraTh1bC82V2xiVmdlOWJoTTc0T3BOUFFQTUdVVG9EdHorS1hhMVBuZUp4T0E9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLXBsYWluLW9iamVjdCI6ICJeMi4wLjQiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAg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IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtZGVzY3JpcHRvciI6ICJeMS4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiZXh0ZW5kLXNoYWxsb3ciOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4wLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9leHRlbmQtc2hhbGxvdy8tL2V4dGVuZC1zaGFsbG93LTIuMC4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLVVhOTlZVXJacWZZUTZodXZ1NWlkYXh4V2lROD0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1leHRlbmRhYmxlIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJpcy1hY2Nlc3Nvci1kZXNjcmlwdG9yIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtYWNjZXNzb3ItZGVzY3JpcHRvci8tL2lzLWFjY2Vzc29yLWRlc2NyaXB0b3ItMS4wLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1tNWhuSFRrY1ZzUGZxeDNBS2x5dHRJUGI3SitYeWtIdkpQMkI5YlpEamxoTElvRXE0WG9LNjRWZzdib1psVldZSzZMVVk5NGRZUEVFN0xoMFprWktjUT09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAia2luZC1vZiI6ICJeNi4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiaXMtZGF0YS1kZXNjcmlwdG9yIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtZGF0YS1kZXNjcmlwdG9yLy0vaXMtZGF0YS1kZXNjcmlwdG9yLTEuMC4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItamJSWHkxRm10QW9DalFrVm1JVll3dXVxREZVYmFPZURqbWVkMXRPR1Byc01odEpBNHJEOXRrZ0EwRjFxSjNnUkZSWGNIWVZrZGVhUDUwUTVyRS9qTFE9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImtpbmQtb2YiOiAiXjYuMC4wIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgImlzLWRlc2NyaXB0b3IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4wLjIiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pcy1kZXNjcmlwdG9yLy0vaXMtZGVzY3JpcHRvci0xLjAuMi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLTJlaXM1V3FRR1Y3cGVvb0R5TG1ORVBVcnBzOStTWFg1YzlwTDN4RUIrNGU5SG5HdURhN21CN2tIeEh3NENicVM5azFUMmhPSDNtaUw4bjhXdGlZVnRnPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1hY2Nlc3Nvci1kZXNjcmlwdG9yIjogIl4xLjAuMCIsCisgICAgICAgICAgICAiaXMtZGF0YS1kZXNjcmlwdG9yIjogIl4xLjAuMCIsCisgICAgICAgICAgICAia2luZC1vZiI6ICJeNi4wLjIiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAiZXh0cmFjdC16aXAiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjYuNyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXh0cmFjdC16aXAvLS9leHRyYWN0LXppcC0xLjYuNy50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXFFQzB1SzlrQXlaTWpiVi9UeHAwTXo3NEgraz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb25jYXQtc3RyZWFtIjogIjEuNi4yIiwKKyAgICAgICAgImRlYnVnIjogIjIuNi45IiwKKyAgICAgICAgIm1rZGlycCI6ICIwLjUuMSIsCisgICAgICAgICJ5YXV6bCI6ICIyLjQuMSIKKyAgICAgIH0KKyAgICB9LAorICAgICJleHRzcHJpbnRmIjogeworICAgICAgInZlcnNpb24iOiAiMS4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2V4dHNwcmludGYvLS9leHRzcHJpbnRmLTEuMy4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbHBHRVFPTUVHbnBCVDR4UzQ4VjA2encrSGdVPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImV5ZXMiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEuOCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXllcy8tL2V5ZXMtMC4xLjgudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1ZczhTQWpUR2czaGRrQ05JcUFEdlBnekNDOEE9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgIm9wdGlvbmFsIjogdHJ1ZQorICAgIH0sCisgICAgImZhc3QtZGVlcC1lcXVhbCI6IHsKKyAgICAgICJ2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gICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9maWd1cmVzLy0vZmlndXJlcy0xLjcuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXkrSGpyL3p4elVTNERLMyswbzNIazZsd0hTND0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJlc2NhcGUtc3RyaW5nLXJlZ2V4cCI6ICJeMS4wLjUiLAorICAgICAgICAib2JqZWN0LWFzc2lnbiI6ICJeNC4xLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiZmlsbC1yYW5nZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjQuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9maWxsLXJhbmdlLy0vZmlsbC1yYW5nZS00LjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTFVU0JIVUtQbU9zR3BqM0VBdEpBUERLTU9QYz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJleHRlbmQtc2hhbGxvdyI6ICJeMi4wLjEiLAorICAgICAgICAiaXMtbnVtYmVyIjogIl4zLjAuMCIsCisgICAgICAgICJyZXBlYXQtc3RyaW5nIjogIl4xLjYuMSIsCisgICAgICAgICJ0by1yZWdleC1yYW5nZSI6ICJeMi4xLjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMC4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXh0ZW5kLXNoYWxsb3cvLS9leHRlbmQtc2hhbGxvdy0yLjAuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1VYTk5WVVyWnFmWVE2aHV2dTVpZGF4eFdpUTg9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtZXh0ZW5kYWJsZSI6ICJeMC4xLjAiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAiZmluZC11cCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9maW5kLXVwLy0vZmluZC11cC0xLjEuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWF5NllJckdpemdwZ3EyVFdFT3pLMVR5eVRROD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJwYXRoLWV4aXN0cyI6ICJeMi4wLjAiLAorICAgICAgICAicGlua2llLXByb21pc2UiOiAiXjIuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImZpbmR1cC1zeW5jIjogeworICAgICAgInZlcnNpb24iOiAiMC4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2ZpbmR1cC1zeW5jLy0vZmluZHVwLXN5bmMtMC4zLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1ONU1LcGRnV3QzZkFORVhobG16R2VRcE1DeFk9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZ2xvYiI6ICJ+NS4wLjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImdsb2IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiNS4wLjE1IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZ2xvYi8tL2dsb2ItNS4wLjE1LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUc4azJ1ZUF2U21BL3pDSXV6M1l6MHd1TGs3RT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpbmZsaWdodCI6ICJeMS4wLjQiLAorICAgICAgICAgICAgImluaGVyaXRzIjogIjIiLAorICAgICAgICAgICAgIm1pbmltYXRjaCI6ICIyIHx8IDMiLAorICAgICAgICAgICAgIm9uY2UiOiAiXjEuMy4wIiwKKyAgICAgICAgICAgICJwYXRoLWlzLWFic29sdXRlIjogIl4xLjAuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJmaW5lZCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9maW5lZC8tL2ZpbmVkLTEuMS4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtczMzSVJMZHFMMTV3Z2VpRTk4Q3VORThWTkhZPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImV4cGFuZC10aWxkZSI6ICJeMi4wLjIiLAorICAgICAgICAiaXMtcGxhaW4tb2JqZWN0IjogIl4yLjAuMyIsCisgICAgICAgICJvYmplY3QuZGVmYXVsdHMiOiAiXjEuMS4wIiwKKyAgICAgICAgIm9iamVjdC5waWNrIjogIl4xLjIuMCIsCisgICAgICAgICJwYXJzZS1maWxlcGF0aCI6ICJeMS4wLjEiCisgICAgICB9CisgICAgfSwKKyAgICAiZmxhZ2dlZC1yZXNwYXduIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2ZsYWdnZWQtcmVzcGF3bi8tL2ZsYWdnZWQtcmVzcGF3bi0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVRubXVteTZ6aS9ock83VnI4K0NsYXFYOHE5Yz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJmb3ItaW4iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZm9yLWluLy0vZm9yLWluLTEuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtZ1FhTktWcUJRdXdLeHliRzRpQU1NUHR0WG9BPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImZvci1vd24iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZm9yLW93bi8tL2Zvci1vd24tMS4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS14ak15OUJYTzNFc0UyLzV3ejROa2xNVTh0RXM9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZm9yLWluIjogIl4xLjAuMSIKKyAgICAgIH0KKyAgICB9LAorICAgICJmb3JldmVyLWFnZW50IjogeworICAgICAgInZlcnNpb24iOiAiMC42LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2ZvcmV2ZXItYWdlbnQvLS9mb3JldmVyLWFnZW50LTAuNi4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtKzhjZkRFR3Q2emY1YkZkNjBlMUMyUDJzeXBFPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUKKyAgICB9LA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S9mcy1leHRyYS0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXpUemw5K2ZMWVVXSVA4cmpHUjZZZC9oWWVWQT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZ3JhY2VmdWwtZnMiOiAiXjQuMS4yIiwKKyAgICAgICAgImpzb25maWxlIjogIl4yLjEuMCIsCisgICAgICAgICJrbGF3IjogIl4xLjAuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAia2xhdyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjMuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2tsYXcvLS9rbGF3LTEuMy4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLVFJaERPMGF6c2JvbG5YaDRYWTZXOXp1Z0pEaz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImdyYWNlZnVsLWZzIjogIl40LjEuOSIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJmcy5yZWFscGF0aCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9mcy5yZWFscGF0aC8tL2ZzLnJlYWxwYXRoLTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtRlFTdEpTTVZqS3BBMjBvbmg4c0JRUm1VNms4PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImdldC1zdGRpbiI6IHsKKyAgICAgICJ2ZXJzaW9uIjog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1aXJlcyI6IHsKKyAgICAgICAgImFzc2VydC1wbHVzIjogIl4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJnbG9iIjogeworICAgICAgInZlcnNpb24iOiAiNy4wLjYiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2dsb2IvLS9nbG9iLTcuMC42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSVJ1dnIwbmxKYmpOa3lZTkZLc1RZVkt6OVhvPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImZzLnJlYWxwYXRoIjogIl4xLjAuMCIsCisgICAgICAgICJpbmZsaWdodCI6ICJeMS4wLjQiLAorICAgICAgICAiaW5oZXJpdHMiOiAiMiIsCisgICAgICAgICJtaW5pbWF0Y2giOiAiXjMuMC4yIiwKKyAgICAgICAgIm9uY2UiOiAiXjEuMy4wIiwKKyAgICAgICAgInBhdGgtaXMtYWJzb2x1dGUiOiAiXjEuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImdsb2JhbC1tb2R1bGVzIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2dsb2JhbC1tb2R1bGVzLy0vZ2xvYmFsLW1vZHVsZXMtMS4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXNLenBFa2YxMUdwT0Z1dzBaemp6bXQ0QjRVWndqT2NHNzU3UFB2cmZoeGNMRmJxMHdwc2dwT3F4cHh0eEZpQ0c0RHRHOTNNNlhSVmJGMm9HZGV2N2JnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJnbG9iYWwtcHJlZml4IjogIl4xLjAuMSIsCisgICAgICAgICJpcy13aW5kb3dzIjogIl4xLjAuMSIsCisg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g0RGtvY0wvMVdsTGxLVkxFOStTZEVJZW1wT0F4RGhXUHlzTGxlNmFmdm4vaGc3Q2syazlnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb2ZmZWVzY3JpcHQiOiAifjEuMTAuMCIsCisgICAgICAgICJkYXRlZm9ybWF0IjogIn4xLjAuMTIiLAorICAgICAgICAiZXZlbnRlbWl0dGVyMiI6ICJ+MC40LjEzIiwKKyAgICAgICAgImV4aXQiOiAifjAuMS4xIiwKKyAgICAgICAgImZpbmR1cC1zeW5jIjogIn4wLjMuMCIsCisgICAgICAgICJnbG9iIjogIn43LjAuMCIsCisgICAgICAgICJncnVudC1jbGkiOiAifjEuMi4wIiwKKyAgICAgICAgImdydW50LWtub3duLW9wdGlvbnMiOiAifjEuMS4wIiwKKyAgICAgICAgImdydW50LWxlZ2FjeS1sb2ciOiAifjIuMC4wIiwKKyAgICAgICAgImdydW50LWxlZ2FjeS11dGlsIjogIn4xLjEuMSIsCisgICAgICAgICJpY29udi1saXRlIjogIn4wLjQuMTMiLAorICAgICAgICAianMteWFtbCI6ICJ+My41LjIiLAorICAgICAgICAibWluaW1hdGNoIjogIn4zLjAuMiIsCisgICAgICAgICJta2RpcnAiOiAifjAuNS4xIiwKKyAgICAgICAgIm5vcHQiOiAifjMuMC42IiwKKyAgICAgICAgInBhdGgtaXMtYWJzb2x1dGUiOiAifjEuMC4wIiwKKyAgICAgICAgInJpbXJhZiI6ICJ+Mi42LjIiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImdydW50LWNsaSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjIuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2dydW50LWNsaS8tL2dydW50LWNsaS0xLjIuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1WaXNSbnJzR25kdEdTczRvUlZBYjZYczF0cWc9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiZmluZHVwLXN5bmMiOiAifjAuMy4wIiwKKyAgICAgICAgICAgICJncnVudC1rbm93bi1vcHRpb25zIjogIn4xLjEuMCIsCisgICAgICAgICAgICAibm9wdCI6ICJ+My4wLjYiLAorICAgICAgICAgICAgInJlc29sdmUiOiAifjEuMS4wIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgIm5vcHQiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMy4wLjYiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ub3B0Ly0vbm9wdC0zLjAuNi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS14a1pkdndpcnpVMnpXVEYvZWF4b3BrYXlqL2s9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiYWJicmV2IjogIjEiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAiZ3J1bnQtY2xpIjogeworICAgICAgInZlcnNpb24iOiAiMS4zLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2dydW50LWNsaS8tL2dydW50LWNsaS0xLjMuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItVXdCUnUvUXBBakRjNTNEUkxFa3lpbEZkTDB6ZW5weHUrZmRkVElsc0YvS0pxZE5jSGFRbXZ5dTFXM2NEZXNaOXJxcVpkS0s1QTgrUURJeUxVRVdvWlE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdydW50LWtub3duLW9wdGlvbnMiOiAifjEuMS4wIiwKKyAgICAgICAgImludGVycHJldCI6ICJ+MS4xLjAiLAorICAgICAgICAibGlmdG9mZiI6ICJ+Mi41LjAiLAorICAgICAgICAibm9wdCI6ICJ+NC4wLjEiLAorICAgICAgICAidjhmbGFncyI6ICJ+My4wLjIiCisgICAgICB9CisgICAgfSwKKyAgICAiZ3J1bnQtY29udHJpYi1jb25jYXQiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZ3J1bnQtY29udHJpYi1jb25jYXQvLS9ncnVudC1jb250cmliLWNvbmNhdC0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVlWQ1lZd2hPaHgxK2h0NUl3QlVsbnRsM1JiMD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjaGFsayI6ICJeMS4wLjAiLAorICAgICAgICAic291cmNlLW1hcCI6ICJeMC41LjMiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImFuc2ktc3R5bGVzIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMi4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYW5zaS1zdHlsZXMvLS9hbnNpLXN0eWxlcy0yLjIuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS10RExkTTFpMk5NOTE0ZVJtUTJna0JUUEIzYjQ9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9LAorICAgICAgICAiY2hhbGsiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4xLjMiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL2NoYWxrLy0vY2hhbGstMS4xLjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtcUJGY1ZlU25BdjVORlFxOU9IS0NLbjRKL0pnPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImFuc2ktc3R5bGVzIjogIl4yLjIuMSIsCisgICAgICAgICAgICAiZXNjYXBlLXN0cmluZy1yZWdleHAiOiAiXjEuMC4yIiwKKyAgICAgICAgICAgICJoYXMtYW5zaSI6ICJeMi4wLjAiLAorICAgICAgICAgICAgInN0cmlwLWFuc2kiOiAiXjMuMC4wIiwKKyAgICAgICAgICAgICJzdXBwb3J0cy1jb2xvciI6ICJeMi4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAic3VwcG9ydHMtY29sb3IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zdXBwb3J0cy1jb2xvci8tL3N1cHBvcnRzLWNvbG9yLTIuMC4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLVUxMEVYT2EyTmora0FSY0lSaW1aWHAzekpNYz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJncnVudC1jb250cmliLWpzaGludCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL2dydW50LWNvbnRyaWItanNoaW50Ly0vZ3J1bnQtY29udHJpYi1qc2hpbnQtMS4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1OcDJRbXlXVHhBNkw1NWxBc2hOQWhReDVPYXc9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiY2hhbGsiOiAiXjEuMS4xIiwKKyAgICAgICAgImhvb2tlciI6ICJeMC4yLjMiLAorICAgICAgICAianNoaW50IjogIn4yLjkuNCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiYW5zaS1zdHlsZXMiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4yLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9hbnNpLXN0eWxlcy8tL2Fuc2ktc3R5bGVzLTIuMi4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXRETGRNMWkyTk05MTRlUm1RMmdrQlRQQjNiND0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0sCisgICAgICAgICJjaGFsayI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjEuMyIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2hhbGsvLS9jaGFsay0xLjEuMy50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1xQkZjVmVTbkF2NU5GUXE5T0hLQ0tuNEovSmc9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiYW5zaS1zdHlsZXMiOiAiXjIuMi4xIiwKKyAgICAgICAgICAgICJlc2NhcGUtc3RyaW5nLXJlZ2V4cCI6ICJeMS4wLjIiLAorICAgICAgICAgICAgImhhcy1hbnNpIjogIl4yLjAuMCIsCisgICAgICAgICAgICAic3RyaXAtYW5zaSI6ICJeMy4wLjAiLAorICAgICAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogIl4yLjAuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJzdXBwb3J0cy1jb2xvciI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjAuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3N1cHBvcnRzLWNvbG9yLy0vc3VwcG9ydHMtY29sb3ItMi4wLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtVTEwRVhPYTJOaitrQVJjSVJpbVpYcDN6Sk1jPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImdydW50LWNvbnRyaWItcXVuaXQiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZ3J1bnQtY29udHJpYi1xdW5pdC8tL2dydW50LWNvbnRyaWItcXVuaXQtMy4wLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXM5OTQraXBLd2Mrb1VVSVdhR0l3MXNveUlENHBFeFNHTWQvY0hRTjVoMHA4S2JJalIxTGUzWkMzZ2lTRERLWHRaRkUwaStPYmYwdUlqTnZqZnRYMkN3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJldmVudGVtaXR0ZXIyIjogIl41LjAuMSIsCisgICAgICAgICJwLWVhY2gtc2VyaWVzIjogIl4xLjAuMCIsCisgICAgICAgICJwdXBwZXRlZXIiOiAiMS43LjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImV2ZW50ZW1pdHRlcjIiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiNS4wLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ldmVudGVtaXR0ZXIyLy0vZXZlbnRlbWl0dGVyMi01LjAuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3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XNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL2NoYWxrLy0vY2hhbGstMS4xLjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtcUJGY1ZlU25BdjVORlFxOU9IS0NLbjRKL0pnPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImFuc2ktc3R5bGVzIjogIl4yLjIuMSIsCisgICAgICAgICAgICAiZXNjYXBlLXN0cmluZy1yZWdleHAiOiAiXjEuMC4yIiwKKyAgICAgICAgICAgICJoYXMtYW5zaSI6ICJeMi4wLjAiLAorICAgICAgICAgICAgInN0cmlwLWFuc2kiOiAiXjMuMC4wIiwKKyAgICAgICAgICAgICJzdXBwb3J0cy1jb2xvciI6ICJeMi4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAic3VwcG9ydHMtY29sb3IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zdXBwb3J0cy1jb2xvci8tL3N1cHBvcnRzLWNvbG9yLTIuMC4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLVUxMEVYT2EyTmora0FSY0lSaW1aWHAzekpNYz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJncnVudC1qc2RvYyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMy4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ncnVudC1qc2RvYy8tL2dydW50LWpzZG9jLTIuMy4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1nQzY2VENSWGVRTWozSEl5cVZTQkptOHpkVXo0M2U1dmFHL1BMTy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Y5ZlppelVxUU1ENXh2cmlCMTQ2VEE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhanYiOiAiXjUuMy4wIiwKKyAgICAgICAgImhhci1zY2hlbWEiOiAiXjIuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImhhcy1hbnNpIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2hhcy1hbnNpLy0vaGFzLWFuc2ktMi4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1OUFVFbk9IczN5c0dTYTgrOGs1RjdUVkJiWkU9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYW5zaS1yZWdleCI6ICJeMi4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiaGFzLWZsYWciOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaGFzLWZsYWcvLS9oYXMtZmxhZy0zLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXRkUlUzQ0dacmlKV21mTkdmbG9IODdsVnV2MD0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJoYXMtdmFsdWUiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaGFzLXZhbHVlLy0vaGFzLXZhbHVlLTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtR0xLQjJsaGJIRnhSM3ZKTWt3N1NtZ3Ztc1hjPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdldC12YWx1ZSI6ICJeMi4wLjYiLAorICAgICAgICAiaGFzLXZhbHVlcyI6ICJeMS4wLjAiLAorICAgICAgICAiaXNvYmplY3QiOiAiXjMuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImhhcy12YWx1ZXMiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaGFzLXZhbHVlcy8tL2hhcy12YWx1ZXMtMS4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1sYkMyUCt3aFJtR2FiK1YvNTFZbzFhT2Uvazg9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaXMtbnVtYmVyIjogIl4zLjAuMCIsCisgICAgICAgICJraW5kLW9mIjogIl40LjAuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAia2luZC1vZiI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICI0LjAuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2tpbmQtb2YvLS9raW5kLW9mLTQuMC4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUlJRTk4OWNTa29zZ2MzaHBHa1VHYjY1eTNWYz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1idWZmZXIiOiAiXjEuMS41IgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImhhc2hhIjogeworICAgICAgInZlcnNpb24iOiAiMi4yLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3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ICAgICAgICAgICAibXMiOiAiXjIuMS4xIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgIm1zIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMS4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbXMvLS9tcy0yLjEuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXRncCtkbDVjR2syOHV0WWt0QnNyRnFBN0hLZ3JoZ1BzZzZaL0VmaFdJNGdsMUh3cThCL0dtWS8wb1haNm5GOGhEVmVzUy9GcG5ZYUQva09XaFlRdnlnPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJpY29udi1saXRlIjogeworICAgICAgInZlcnNpb24iOiAiMC40LjI0IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pY29udi1saXRlLy0vaWNvbnYtbGl0ZS0wLjQuMjQudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXYzTVhuWkFjdm55d2tUVUVab21JQWN0bGU3UlhYZWVkT1IzMXd3bDdWbHlvWE80UWk5YXJ2U2VuTlFXbmUxVGNSd2hDTDFId0xJMjFiRXFkcGo4L3JBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJzYWZlci1idWZmZXIiOiAiPj0gMi4xLjIgPCAzIgorICAgICAgfQorICAgIH0sCisgICAgImluZGVudC1zdHJpbmciOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjEuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaW5kZW50LXN0cmluZy8tL2luZGVudC1zdHJpbmctMi4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1qaTFJTklkQ0VodEtnaGkzb1RmcHBTQkozSUE9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAicmVwZWF0aW5nIjogIl4yLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJpbmZsaWdodCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC42IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pbmZsaWdodC8tL2luZmxpZ2h0LTEuMC42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtU2Ixak1kZlFMUXdKdkpFS0VIVzZnV1cxYmZrPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgIm9uY2UiOiAiXjEuMy4wIiwKKyAgICAgICAgIndyYXBweSI6ICIxIgorICAgICAgfQorICAgIH0sCisgICAgImluaGVyaXRzIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2luaGVyaXRzLy0vaW5oZXJpdHMtMi4wLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1ZendzZytQYVFxVUM5U1JtQWlTQTlDQ0NZZDQ9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiaW5pIjogeworICAgICAgInZlcnNpb24iOiAiMS4zLjUiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2luaS8tL2luaS0xLjMuNS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItUlpZNWh1SUtDTVJXRFVxWmxFaTcyZi9sbVhLTXZ1c3pjTUJkdWxpUTNubldieDlYL1pCUU83RGlqTUVZUzlFaEhCYjJxYWNSVU10Qzdzdkx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NuN3U4NFEvaWdpWHRjbU5ZPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImtpbmQtb2YiOiAiXjMuMC4yIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJraW5kLW9mIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjMuMi4yIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcva2luZC1vZi8tL2tpbmQtb2YtMy4yLjIudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtTWVvaHB6UzZ1YnV3OHlSbTJKT3VwUjVLUEdRPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWJ1ZmZlciI6ICJeMS4xLjUiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAiaXMtYXJyYXlpc2giOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjIuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtYXJyYXlpc2gvLS9pcy1hcnJheWlzaC0wLjIuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWQ4bVlRRko2cU95eHFMcHBlNEJrV25xU2FwMD0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJpcy1idWZmZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjEuNiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtYnVmZmVyLy0vaXMtYnVmZmVyLTEuMS42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1OY2RBTHdwWGtUbTVadnZiazdvd09VU3ZWdkJLRGdLUDUvZXdmWEV6bm1RRmZzNFpSbWFuT2VLQlRqUlZqa2EzUUZvTjZYSis5RjNVU3FmSHFUYVU1dz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiaXMtYnVpbHRpbi1tb2R1bGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pcy1idWlsdGluLW1vZHVsZS8tL2lzLWJ1aWx0aW4tbW9kdWxlLTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtVkFWeTAwOTZ3eEdmajNiRERMd2JIZ042Lzc0PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImJ1aWx0aW4tbW9kdWxlcyI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiaXMtZGF0YS1kZXNjcmlwdG9yIjogeworICAgICAgInZlcnNpb24iOiAiMC4xLjQiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLWRhdGEtZGVzY3JpcHRvci8tL2lzLWRhdGEtZGVzY3JpcHRvci0wLjEuNC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUMxN21TRGlPTElZQ2d1ZVQ4WVZ2N0Q4d0cxWT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJraW5kLW9mIjogIl4zLjAuMiIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAia2luZC1vZiI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIzLjIuMiIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2tpbmQtb2YvLS9raW5kLW9mLTMuMi4yLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLU1lb2hwelM2dWJ1dzh5Um0ySk91cFI1S1BHUT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1idWZmZXIiOiAiXjEuMS41IgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImlzLWRlc2NyaXB0b3IiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEuNiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtZGVzY3JpcHRvci8tL2lzLWRlc2NyaXB0b3ItMC4xLjYudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWF2RFlyMFNCM0R3Tzl6c01vdjBnS0NFU0ZZcUNuRTRocS80ejNUZFVsdWtFeTV0OUMwWVJxN0hMcnNONTJOQWNxWEthZXBlQ0QwbitCMGFyblZHM0hnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJpcy1hY2Nlc3Nvci1kZXNjcmlwdG9yIjogIl4wLjEuNiIsCisgICAgICAgICJpcy1kYXRhLWRlc2NyaXB0b3IiOiAiXjAuMS40IiwKKyAgICAgICAgImtpbmQtb2YiOiAiXjUuMC4wIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJraW5kLW9mIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjUuMS4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcva2luZC1vZi8tL2tpbmQtb2YtNS4xLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1OR0VFcm5INkYydlV1WERoK09sYmNLVzcvd09jZmRSSGFaN1ZXdHFDenRmSHJpLysrWU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uIjogIjMuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pcy1nbG9iLy0vaXMtZ2xvYi0zLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWU2V3VKQ0Y0Qkt4d2NIdVdraVZuU0d6RDZFbz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJpcy1leHRnbG9iIjogIl4yLjEuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJpcy1udW1iZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtbnVtYmVyLy0vaXMtbnVtYmVyLTMuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSlAxaUFhUjRMUFVGWWNnUUoycjhmUkxYRVpVPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImtpbmQtb2YiOiAiXjMuMC4yIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJraW5kLW9mIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjMuMi4yIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcva2luZC1vZi8tL2tpbmQtb2YtMy4yLjIudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtTWVvaHB6UzZ1YnV3OHlSbTJKT3VwUjVLUEdRPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWJ1ZmZlciI6ICJeMS4xLjUiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyA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ludGVncml0eSI6ICJzaGExLVN3MmhSQ0VFMGJNMk5BNkFlWDZHWFBPZmZYST0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJpcy13aW5kb3dzIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLXdpbmRvd3MvLS9pcy13aW5kb3dzLTEuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1lWEsxVUlucTJiUG1qeVg2ZTNWSEl6TUxvYmM0Sjk0aTRBV24rSHBxM09VNUtrclJDOTZPQWNSM1BSSi9wR3U2bThUUm5CSFA5ZGtYUVZzVC9DT1ZJQT09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiaXNhcnJheSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pc2FycmF5Ly0vaXNhcnJheS0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXU1TmRTRmdzdWhhTUJvTkpWNlZLUGdjU1R4RT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJpc2V4ZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pc2V4ZS8tL2lzZXhlLTIuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtNlB2emROeFZiL2lVZWhEY3NGY3RZejhzK2hBPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImlzb2JqZWN0IjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzb2JqZWN0Ly0vaXNvYmplY3QtMy4wLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1Ua01la3JFYWx6RmphcUg1eU5ITXZQMnJlTjg9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiaXNzdHJlYW0iOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXNzdHJlYW0vLS9pc3N0cmVhbS0wLjEuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVIrWS9ldlZhK20rUzRWQU9hUTY0dUZLY0Nabz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJqcy15YW1sIjogeworICAgICAgInZlcnNpb24iOiAiMy41LjUiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2pzLXlhbWwvLS9qcy15YW1sLTMuNS41LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtQTNmRGdCZkt2SE1pc05IN3pTV2trV1FmTDc0PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFyZ3BhcnNlIjogIl4xLjAuMiIsCisgICAgICAgICJlc3ByaW1hIjogIl4yLjYuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJqczJ4bWxwYXJzZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvanMyeG1scGFyc2VyLy0vanMyeG1scGFyc2VyLTMuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtUDdZT3FnaWNWRUQ1TVo5UmRnek5CK0pKbHpNPSIsCisgICAgICAicmVxdWlyZXMiOiB7CisgICA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GFmZnlkYiI6ICIyLjYuMiIsCisgICAgICAgICJ1bmRlcnNjb3JlIjogIn4xLjguMyIKKyAgICAgIH0KKyAgICB9LAorICAgICJqc2hpbnQiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjkuNiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvanNoaW50Ly0vanNoaW50LTIuOS42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1LTzlTSUFLVGxKUU9NNGxFNjRHUVV0R0JScFRPdXZiclJyU1p3M0FoVXhNTkcyNjZuWDloSzJjS0E0U0JoWE9qMGlySkd5TnlHU0xUNjJIR09WREVPQT09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiY2xpIjogIn4xLjAuMCIsCisgICAgICAgICJjb25zb2xlLWJyb3dzZXJpZnkiOiAiMS4xLngiLAorICAgICAgICAiZXhpdCI6ICIwLjEueCIsCisgICAgICAgICJodG1scGFyc2VyMiI6ICIzLjgueCIsCisgICAgICAgICJsb2Rhc2giOiAifjQuMTcuMTAiLAorICAgICAgICAibWluaW1hdGNoIjogIn4zLjAuMiIsCisgICAgICAgICJwaGFudG9tIjogIn40LjAuMSIsCisgICAgICAgICJwaGFudG9tanMtcHJlYnVpbHQiOiAifjIuMS43IiwKKyAgICAgICAgInNoZWxsanMiOiAiMC4zLngiLAorICAgICAgICAic3RyaXAtanNvbi1jb21tZW50cyI6ICIxLjAueCIsCisgICAgICAgICJ1bmljb2RlLTUuMi4wIjogIl4wLjcuNSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAic3RyaXAtanNvbi1jb21tZW50cyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuNCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3N0cmlwLWpzb24tY29tbWVudHMvLS9zdHJpcC1qc29uLWNvbW1lbnRzLTEuMC40LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUhoWDd5c2w5UHVtYjh0YzdUR1ZyQ0N1Nis1RT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJqc2xpbnQiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEyLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2pzbGludC8tL2pzbGludC0wLjEyLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVJvQ3N5SUNjS0ErNlRGc2J5czlEcEtUZlBWYUM3MU1tNVFTanZyV0EwbERWTitMSXZ4NmFwYTQyRkZpc01xbUNUdko4RHhrY29RR0owajdtM2tUVm93PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJleGl0IjogIn4wLjEuMiIsCisgICAgICAgICJnbG9iIjogIn43LjEuMiIsCisgICAgICAgICJub3B0IjogIn4zLjAuMSIsCisgICAgICAgICJyZWFkYWJsZS1zdHJlYW0iOiAifjIuMS41IgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJnbG9iIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjcuMS4zIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZ2xvYi8tL2dsb2ItNy4xLjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi12Y2Z1aUl4b2dMVjREbEdCSElVT3dJMElicko4SFdQYzRNVTdIenZpR2VOaG8vVUpEZmk2QjVwM3NIZVdJUTBLR0lVMEpweGk1Wkh4ZW1RZkxra0F3UT09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiZnMucmVhbHBhdGgiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJpbmZsaWdodCI6ICJeMS4wLjQiLAorICAgICAgICAgICAgImluaGVyaXRzIjogIjIiLAorICAgICAgICAgICAgIm1pbmltYXRjaCI6ICJeMy4wLjQiLAorICAgICAgICAgICAgIm9uY2UiOiAiXjEuMy4wIiwKKyAgICAgICAgICAgICJwYXRoLWlzLWFic29sdXRlIjogIl4xLjAuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJub3B0IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjMuMC42IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbm9wdC8tL25vcHQtMy4wLjYudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEteGtaZHZ3aXJ6VTJ6V1RGL2VheG9wa2F5ai9rPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImFiYnJldiI6ICIxIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgInByb2Nlc3MtbmV4dGljay1hcmdzIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC43IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcHJvY2Vzcy1uZXh0aWNrLWFyZ3MvLS9wcm9jZXNzLW5leHRpY2stYXJncy0xLjAuNy50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1GUTRndDFaWkN0UDVFSlB5V2s4cTJML3pDNk09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9LAorICAgICAgICAicmVhZGFibGUtc3RyZWFtIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMS41IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZWFkYWJsZS1zdHJlYW0vLS9yZWFkYWJsZS1zdHJlYW0tMi4xLjUudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtWnZxTGNnNFVPTE5rYUI4cTBhWThZWVJJeWRBPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImJ1ZmZlci1zaGltcyI6ICJeMS4wLjAiLAorICAgICAgICAgICAgImNvcmUtdXRpbC1pcyI6ICJ+MS4wLjAiLAorICAgICAgICAgICAgImluaGVyaXRzIjogIn4yLjAuMSIsCisgICAgICAgICAgICAiaXNhcnJheSI6ICJ+MS4wLjAiLAorICAgICAgICAgICAgInByb2Nlc3MtbmV4dGljay1hcmdzIjogIn4xLjAuNiIsCisgICAgICAgICAgICAic3RyaW5nX2RlY29kZXIiOiAifjAuMTAueCIsCisgICAgICAgICAgICAidXRpbC1kZXByZWNhdGUiOiAifjEuMC4xIgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImpzb24tc2NoZW1hIjogeworICAgICAgInZlcnNpb24iOiAiMC4yLjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2pzb24tc2NoZW1hLy0vanNvbi1zY2hlbWEtMC4yLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS10SURJa3VXYUx3V1ZUT2NudlQ4cVRvZ3ZuaE09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgIm9wdGlvbmFsIjogdHJ1ZQorICAgIH0sCisgICAgImpzb24tc2NoZW1hLXRyYXZlcnNlIjogeworICAgICAgInZlcnNpb24iOiAiMC4zLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVna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KyAgICAgICAgInJlc29sdmUiOiAiXjEuMS43IgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJmaW5kdXAtc3luYyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjAuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2ZpbmR1cC1zeW5jLy0vZmluZHVwLXN5bmMtMi4wLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEta3lheFNJd2kwYVlJaGxDb2FRR3kyYWtLTEx3PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImRldGVjdC1maWxlIjogIl4xLjAuMCIsCisgICAgICAgICAgICAiaXMtZ2xvYiI6ICJeMy4xLjAiLAorICAgICAgICAgICAgIm1pY3JvbWF0Y2giOiAiXjMuMC40IiwKKyAgICAgICAgICAgICJyZXNvbHZlLWRpciI6ICJeMS4wLjEiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAibG9hZC1qc29uLWZpbGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjEuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9sb2FkLWpzb24tZmlsZS8tL2xvYWQtanNvbi1maWxlLTEuMS4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbFdrRmNJMVl0THEwd2lZYkJQV2ZNY21UZE1BPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdyYWNlZnVsLWZzIjogIl40LjEuMiIsCisgICAgICAgICJwYXJzZS1qc29uIjogIl4yLjIuMCIsCisgICAgICAgICJwaWZ5IjogIl4yLjAuMCIsCisgICAgICAgICJwaW5raWUtcHJvbWlzZSI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gICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbWFwLXZpc2l0Ly0vbWFwLXZpc2l0LTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtN055bzhURkU1bUR4dGIxQjhTODBlZG1OKzQ4PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgIm9iamVjdC12aXNpdCI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAibWFya2VkIjogeworICAgICAgInZlcnNpb24iOiAiMC4zLjE5IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL21hcmtlZC8tL21hcmtlZC0wLjMuMTkudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWVhMmVHV09xTnhQY1h2OGR5RVJkU3IvNkZtenZXd3pqTXhwZkdCL3NiTWNjWG9jdCt4WStZdWtQRCtRVFVad3l2SzdCWndjcjRtMjFXQk9XNDFwQWtnPT0iCisgICAgfSwKKyAgICAibWF4bWluIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL21heG1pbi8tL21heG1pbi0xLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWNUWmVoS21kMlBpejk5WDk0dkFOSG45enZtRT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjaGFsayI6ICJeMS4wLjAiLAorICAgICAgICAiZmlndXJlcyI6ICJeMS4wLjEiLAorICAgICAgICAiZ3ppcC1zaXplIjogIl4xLjAuMCIsCisgICAgICAgICJwcmV0dHktYnl0ZXMiOiAiXjEuMC4wIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJhbnNpLXN0eWxlcyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjIuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2Fuc2ktc3R5bGVzLy0vYW5zaS1zdHlsZXMtMi4yLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtdERMZE0xaTJOTTkxNGVSbVEyZ2tCVFBCM2I0PSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfSwKKyAgICAgICAgImNoYWxrIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMS4zIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jaGFsay8tL2NoYWxrLTEuMS4zLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXFCRmNWZVNuQXY1TkZRcTlPSEtDS240Si9KZz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJhbnNpLXN0eWxlcyI6ICJeMi4yLjEiLAorICAgICAgICAgICAgImVzY2FwZS1zdHJpbmctcmVnZXhwIjogIl4xLjAuMiIsCisgICAgICAgICAgICAiaGFzLWFuc2kiOiAiXjIuMC4wIiwKKyAgICAgICAgICAgICJzdHJpcC1hbnNpIjogIl4zLjAuMCIsCisgICAgICAgICAgICAic3VwcG9ydHMtY29sb3IiOiAiXjIuMC4wIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMC4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3VwcG9ydHMtY29sb3IvLS9zdXBwb3J0cy1jb2xvci0yLjAuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1VMTBFWE9hMk5qK2tBUmNJUmltWlhwM3pKTWM9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAibWVvdyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuNy4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL21lb3cvLS9tZW93LTMuNy4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtY3N0bWkwSlNLQ2tLdS9xRmFKSlljd2lvQWZzPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImNhbWVsY2FzZS1rZXlzIjogIl4yLjAuMCIsCisgICAgICAgICJkZWNhbWVsaXplIjogIl4xLjEuMiIsCisgICAgICAgICJsb3VkLXJlamVjdGlvbiI6ICJeMS4wLjAiLAorICAgICAgICAibWFwLW9iaiI6ICJeMS4wLjEiLAorICAgICAgICAibWluaW1pc3QiOiAiXjEuMS4zIiwKKyAgICAgICAgIm5vcm1hbGl6ZS1wYWNrYWdlLWRhdGEiOiAiXjIuMy40IiwKKyAgICAgICAgIm9iamVjdC1hc3NpZ24iOiAiXjQuMC4xIiwKKyAgICAgICAgInJlYWQtcGtnLXVwIjogIl4xLjAuMSIsCisgICAgICAgICJyZWRlbnQiOiAiXjEuMC4wIiwKKyAgICAgICAgInRyaW0tbmV3bGluZXMiOiAiXjEuMC4wIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJtaW5pbWlzdCI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjIuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbWluaW1pc3QvLS9taW5pbWlzdC0xLjIuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1vMUFJc2c5Qk9EN3NIN2tVOU0xZDk1b21Rb1E9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAibWljcm9tYXRjaCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuMS4xMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbWljcm9tYXRjaC8tL21pY3JvbWF0Y2gtMy4xLjEwLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1NV2lrZ2w5bjlNM3crYnBzWTNIZThMK3c5ZUY5MzM4eFJsOElBTzV2aURpendTenppRkV5VXpvMnhycmxvQjY0QURiVGY4dUE4dlJxcXR0RFRPbWNjZz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXJyLWRpZmYiOiAiXjQuMC4wIiwKKyAgICAgICAgImFycmF5LXVuaXF1ZSI6ICJeMC4zLjIiLAorICAgICAgICAiYnJhY2VzIjogIl4yLjMuMSIsCisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjIuMC4yIiwKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4zLjAuMiIsCisgICAgICAgICJleHRnbG9iIjogIl4yLjAuNCIsCisgICAgICAgICJmcmFnbWVudC1jYWNoZSI6ICJeMC4yLjEiLAorICAgICAgICAia2luZC1vZiI6ICJeNi4wLjIiLAorICAgICAgICAibmFub21hdGNoIjogIl4xLjIuOSIsCisgICAgICAgICJvYmplY3QucGljayI6ICJeMS4zLjAiLAorICAgICAgICAicmVnZXgtbm90IjogIl4xLjAuMCIsCisgICAgICAgICJzbmFwZHJhZ29uIjogIl4wLjguMSIsCisgICAgICAgICJ0by1yZWdleCI6ICJeMy4wLjIiCisgICAgICB9CisgICAgfSwK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sCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJmb3ItaW4iOiAiXjEuMC4yIiwKKyAgICAgICAgImlzLWV4dGVuZGFibGUiOiAiXjEuMC4xIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJpcy1leHRlbmRhYmxlIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtZXh0ZW5kYWJsZS8tL2lzLWV4dGVuZGFibGUtMS4wLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1hcm5YTXhUMWhob0tvOWsxTFpkbWxOeUpkRERmeTJ2MGZYakZsbW9rNCtpOHVsLzZXbGJWZ2U5YmhNNzRPcE5QUVBNR1VUb0R0eitLWGExUG5lSnhPQT09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtcGxhaW4tb2JqZWN0IjogIl4yLjAuNCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJta2RpcnAiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjUuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ta2RpcnAvLS9ta2RpcnAtMC41LjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1NQVYwT09yR3ozK01SMmZ6aGtqV2FYMTF5UU09IiwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgIm1pbmltaXN0IjogIjAuMC44IgorICAgICAgfQorICAgIH0sCisgICAgIm1zIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cn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eSI6ICJzaGExLUlRbXR4NVpZaDgvQVhMdlVRc3JJdjdzMkNHTT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJvYmplY3QtY29weSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9vYmplY3QtY29weS8tL29iamVjdC1jb3B5LTAuMS4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtZm4yRmkzZ2IxOG1ScEJ1cGRlMDRFblZPbVl3PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImNvcHktZGVzY3JpcHRvciI6ICJeMC4xLjAiLAorICAgICAgICAiZGVmaW5lLXByb3BlcnR5IjogIl4wLjIuNSIsCisgICAgICAgICJraW5kLW9mIjogIl4zLjAuMyIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZGVmaW5lLXByb3BlcnR5IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjAuMi41IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVmaW5lLXByb3BlcnR5Ly0vZGVmaW5lLXByb3BlcnR5LTAuMi41LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXcxc2UrUmpzUEprUG1sdkZlK0JLck94Y2dSWT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1kZXNjcmlwdG9yIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJraW5kLW9mIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjMuMi4yIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcva2luZC1vZi8tL2tpbmQtb2YtMy4yLjIudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtTWVvaHB6UzZ1YnV3OHlSbTJKT3VwUjVLUEdRPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWJ1ZmZlciI6ICJeMS4xLjUiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAib2JqZWN0LXZpc2l0IjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL29iamVjdC12aXNpdC8tL29iamVjdC12aXNpdC0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTk1eEVrNjhNVTNlMW4rT2RPVjVCQkMzUVJicz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJpc29iamVjdCI6ICJeMy4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAib2JqZWN0LmRlZmF1bHRzIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL29iamVjdC5kZWZhdWx0cy8tL29iamVjdC5kZWZhdWx0cy0xLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLU9uK0dnelMwQjk2Z2JhRnRpTlhOS2VRMS9zOD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhcnJheS1lYWNoIjogIl4xLjAuMSIsCisgICAgICAgICJhcnJheS1zbGljZSI6ICJeMS4wLjAiLAorICAgICAgICAiZm9yLW93biI6ICJeMS4wLjAiLAorICAgICAgICAiaXNvYmplY3QiOiAiXjMuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgIm9iamVjdC5tYXAiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb2JqZWN0Lm1hcC8tL29iamVjdC5tYXAtMS4wLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS16NFBsbmNqOHdLMWZRbERoOTRzN2diMkFIVGM9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZm9yLW93biI6ICJeMS4wLjAiLAorICAgICAgICAibWFrZS1pdGVyYXRvciI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAib2JqZWN0LnBpY2siOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjMuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb2JqZWN0LnBpY2svLS9vYmplY3QucGljay0xLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWg2RUt4TUZwUzlMaHkvVTFrYVpoUWZ0ZDEwYz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJpc29iamVjdCI6ICJeMy4wLjEiCisgICAgICB9CisgICAgfSwKKyAgICAib25jZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuNC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9vbmNlLy0vb25jZS0xLjQuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVdEc2FwM1dXSFVzUk9zRjluRkM2NzUzWGE5RT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ3cmFwcHkiOiAiMSIKKyAgICAgIH0KKyAgICB9L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WVzLy0vcC1lYWNoLXNlcmllcy0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWt3ODlFdDBmVU9kRFJGZWlMTmJ3U3NhdGYzRT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJwLXJlZHVjZSI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAicC1yZWR1Y2UiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcC1yZWR1Y2UvLS9wLXJlZHVjZS0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUdNS3czWk5xUnBDbEtmZ2pIMWlnL2Jha2Zmbz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJwYWtvIjogeworICAgICAgInZlcnNpb24iOiAiMC4yLjkiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3Bha28vLS9wYWtvLTAuMi45LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtOC9kU0wwNzNnalNOcUJZYnJaN1AxUnY0T25VPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInBhcnNlLWZpbGVwYXRoIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3BhcnNlLWZpbGVwYXRoLy0vcGFyc2UtZmlsZXBhdGgtMS4wLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1waklTZjFPcTg5RllkdldITHovNngyUFd5SkU9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaXMtYWJzb2x1dGUiOiAiXjEuMC4wIiwKKyAgICA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FudG9tanMtcHJlYnVpbHQvLS9waGFudG9tanMtcHJlYnVpbHQtMi4xLjE2LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtNzlJU3BLT1diVFpIYUU2b3VuaUZTYjRxNys4PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJlczYtcHJvbWlzZSI6ICJeNC4wLjMiLAorICAgICAgICAiZXh0cmFjdC16aXAiOiAiXjEuNi41IiwKKyAgICAgICAgImZzLWV4dHJhIjogIl4xLjAuMCIsCisgICAgICAgICJoYXNoYSI6ICJeMi4yLjAiLAorICAgICAgICAia2V3IjogIl4wLjcuMCIsCisgICAgICAgICJwcm9ncmVzcyI6ICJeMS4xLjgiLAorICAgICAgICAicmVxdWVzdCI6ICJeMi44MS4wIiwKKyAgICAgICAgInJlcXVlc3QtcHJvZ3Jlc3MiOiAiXjIuMC4xIiwKKyAgICAgICAgIndoaWNoIjogIl4xLjIuMTAiCisgICAgICB9CisgICAgfSwKKyAgICAicGlmeSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMy4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9waWZ5Ly0vcGlmeS0yLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTdSUWFhc0JEcUVucVdJU1k1OXlvc1ZNdzZRdz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJwaW5raWUiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjAuNCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcGlua2llLy0vcGlua2llLTIuMC40LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtY2xWcmdNK2cxSXFYVG9EbmNram9EdFQzK0hBPSIsCisgICAgICAi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ogIl4xLjYuNiIsCisgICAgICAgICJodHRwcy1wcm94eS1hZ2VudCI6ICJeMi4yLjEiLAorICAgICAgICAibWltZSI6ICJeMi4wLjMiLAorICAgICAgICAicHJvZ3Jlc3MiOiAiXjIuMC4wIiwKKyAgICAgICAgInByb3h5LWZyb20tZW52IjogIl4xLjAuMCIsCisgICAgICAgICJyaW1yYWYiOiAiXjIuNi4xIiwKKyAgICAgICAgIndzIjogIl41LjEuMSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZGVidWciOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMy4yLjYiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kZWJ1Zy8tL2RlYnVnLTMuMi42LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItbWVsK2pmN25ydEVsNVBuMVF4NDZ6QVJYS0RwQmJ2emV6c2U3cDdMcUlObWRvSWs4UFlQNVN5U2F4RW1ZdjZUWjBKeUVLQTFoc0NJZDZESWhnSVR0V1E9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgIm1zIjogIl4yLjEuMSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJtcyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjEuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL21zLy0vbXMtMi4xLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi10Z3ArZGw1Y0drMjh1dFlrdEJzckZxQTdIS2dyaGdQc2c2Wi9FZmhXSTRnbDFId3E4Qi9HbVkvMG9YWjZuRjhoRFZlc1MvRnBuWWFEL2tPV2hZUXZ5Zz09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9LAorICAgICAgICAicHJvZ3Jlc3MiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4wLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9wcm9ncmVzcy8tL3Byb2dyZXNzLTIuMC4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItT0UrYTZ2enFhemMrSzZMeEpyWDVVUHlLRnZHbkw1Q1ltcTJqRkdOSUJXSHBjNFF5RTQ5L1lPdW1jcnBRRkpwZmVqbXZSdGJKemdPMXpQbU1DcWxiQmc9PSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgInFzIjogeworICAgICAgInZlcnNpb24iOiAiNi41LjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3FzLy0vcXMtNi41LjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU41WkFYNC9MeEptRis3d043NHBVRDZxQWg5L3dudmRRY2pxOVRaamV2dlh6U1VvN2JmbXc5MXNhcU1qekdTMnhxOTEvb2ROMmRXL1dPbDdxUUhOREdBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAicmVhZC1wa2ciOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjEuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcmVhZC1wa2cvLS9yZWFkLXBrZy0xLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTlmK3FYczBweXpIQVIwdktmWFZyYTdLZVB5Zz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJsb2FkLWpzb24tZmlsZSI6ICJeMS4wLjAiLAorICAgICAgICAibm9ybWFsaXplLXBhY2thZ2UtZGF0YSI6ICJeMi4zLjIiLAorICAgICAgICAicGF0aC10eXBlIjogIl4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJyZWFkLXBrZy11cCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZWFkLXBrZy11cC8tL3JlYWQtcGtnLXVwLTEuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbldQQk1uYkFaWkdOVi9BQ3BYOUFvYlpEK3dJPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImZpbmQtdXAiOiAiXjEuMC4wIiwKKyAgICAgICAgInJlYWQtcGtnIjogIl4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJyZWFkYWJsZS1zdHJlYW0iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjEuMTQiLAorICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcmVhZGFibGUtc3RyZWFtLy0vcmVhZGFibGUtc3RyZWFtLTEuMS4xNC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWZQVEZUdlpJNDRFd2hNWTIzU0I1NFdiQWdkaz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb3JlLXV0aWwtaXMiOiAifjEuMC4wIiwKKyAgICAgICAgImluaGVyaXRzIjogIn4yLjAuMSIsCisgICAgICAgICJpc2FycmF5IjogIjAuMC4xIiwKKyAgICAgICAgInN0cmluZ19kZWNvZGVyIjogIn4wLjEwLngiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImlzYXJyYXkiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMC4wLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9pc2FycmF5Ly0vaXNhcnJheS0wLjAuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1paGlzL0ttbzlCZCtDYXY4WURpVG13WFI3dDg9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAicmVjaG9pciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuNi4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZWNob2lyLy0vcmVjaG9pci0wLjYuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWhTQkxWTnVvTFZkQzRveVdkVzcwT3ZVT000UT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJyZXNvbHZlIjogIl4xLjEuNiIKKyAgICAgIH0KKyAgICB9LAorICAgICJyZWRlbnQiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcmVkZW50Ly0vcmVkZW50LTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtejVGcXNmMWZIeGJmc2dnaTNXN0g5ekRDcjk0PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImluZGVudC1zdHJpbmciOiAiXjIuMS4wIiwKKyAgICAgICAgInN0cmlwLWluZGVudCI6ICJeMS4wLjEiCisgICAgICB9CisgICAgfSwKKyAgICAicmVnZXgtbm90IjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cn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xLjEiCisgICAgICB9CisgICAgfSwKKyAgICAicmltcmFmIjogeworICAgICAgInZlcnNpb24iOiAiMi42LjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3JpbXJhZi8tL3JpbXJhZi0yLjYuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItbHJlZXdMSy9CbGdobXh0ZkgzNllZVmcxaThJQWNlNFRJN29hbzc1STFnMjQ1KzZCY3RxVFZRaUJQM1lVSjlDNkRRT1hKbWtZUjlYOWZDTHRDT0pjNXc9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdsb2IiOiAiXjcuMC41IgorICAgICAgfQorICAgIH0sCisgICAgInNhZmUtYnVmZmVyIjogeworICAgICAgInZlcnNpb24iOiAiNS4xLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NhZmUtYnVmZmVyLy0vc2FmZS1idWZmZXItNS4xLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLUdkMlVaQkpEa1hsWTdHYkp4ZnNFOC9udktrVUVVMUczOGMxc2lONlFQNmE5UFQ5TW1IQjhHbnBzY1NtTUpTb0Y4TE9JcnQ4dWQvd1B0b2p5czRHNitnPT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJzYWZlLXJlZ2V4IjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NhZmUtcmVnZXgvLS9zYWZlLXJlZ2V4LTEuMS4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtUUtObW56c0hmUjZVUFVSaW5oVjkxSUFqdnk0PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKy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Wc9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4yLjAuMSIsCisgICAgICAgICJpcy1leHRlbmRhYmxlIjogIl4wLjEuMSIsCisgICAgICAgICJpcy1wbGFpbi1vYmplY3QiOiAiXjIuMC4zIiwKKyAgICAgICAgInNwbGl0LXN0cmluZyI6ICJeMy4wLjEiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMC4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXh0ZW5kLXNoYWxsb3cvLS9leHRlbmQtc2hhbGxvdy0yLjAuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1VYTk5WVVyWnFmWVE2aHV2dTVpZGF4eFdpUTg9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtZXh0ZW5kYWJsZSI6ICJeMC4xLjAiCisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAic2hlYmFuZy1jb21tYW5kIjogeworICAgICAgInZlcnNpb24iOiAiMS4yLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NoZWJhbmctY29tbWFuZC8tL3NoZWJhbmctY29tbWFuZC0xLjIuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVJLckdXMmxiQXptSmFNT2ZOai91WGVyOThlbz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJzaGViYW5nLXJlZ2V4IjogIl4xLjAuMCIKKyAgICAgIH0KKy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REQ2em9VSjdMVzh2aCtaQkM4UWRsanZlUlArY3JOcnRCd2lvRVVXeS80ZE10YkJqQTRpb05sZz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYmFzZSI6ICJeMC4xMS4xIiwKKyAgICAgICAgImRlYnVnIjogIl4yLjIuMCIsCisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjAuMi41IiwKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4yLjAuMSIsCisgICAgICAgICJtYXAtY2FjaGUiOiAiXjAuMi4yIiwKKyAgICAgICAgInNvdXJjZS1tYXAiOiAiXjAuNS42IiwKKyAgICAgICAgInNvdXJjZS1tYXAtcmVzb2x2ZSI6ICJeMC41LjAiLAorICAgICAgICAidXNlIjogIl4zLjEuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZGVmaW5lLXByb3BlcnR5IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjAuMi41IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVmaW5lLXByb3BlcnR5Ly0vZGVmaW5lLXByb3BlcnR5LTAuMi41LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXcxc2UrUmpzUEprUG1sdkZlK0JLck94Y2dSWT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1kZXNjcmlwdG9yIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJleHRlbmQtc2hhbGxvdyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIyLjAuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2V4dGVuZC1zaGFsbG93Ly0vZXh0ZW5kLXNoYWxsb3ctMi4wLjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtVWE5OVlVclpxZllRNmh1dnU1aWRheHhXaVE4PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWV4dGVuZGFibGUiOiAiXjAuMS4wIgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgInNuYXBkcmFnb24tbm9kZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMS4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zbmFwZHJhZ29uLW5vZGUvLS9zbmFwZHJhZ29uLW5vZGUtMi4xLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU8yN2w0eGFNWXQvUlNRNVRSM3ZwV0NBQjVLYi9jekljcVVGT00vQzRmWWNMbmJaVWMxUGtqVEFNam9mMnBCV2FTVHdPVWQ2cVVIY0ZHVkdqN2FJd253PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjEuMC4wIiwKKyAgICAgICAgImlzb2JqZWN0IjogIl4zLjAuMCIsCisgICAgICAgICJzbmFwZHJhZ29uLXV0aWwiOiAiXjMuMC4xIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9kZWZpbmUtcHJvcGVydHkvLS9kZWZpbmUtcHJvcGVydHktMS4wLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEt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pMUT09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAia2luZC1vZiI6ICJeNi4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiaXMtZGVzY3JpcHRvciI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLWRlc2NyaXB0b3IvLS9pcy1kZXNjcmlwdG9yLTEuMC4yLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItMmVpczVXcVFHVjdwZW9vRHlMbU5FUFVycHM5K1NYWDVjOXBMM3hFQis0ZTlIbkd1RGE3bUI3a0h4SHc0Q2JxUzlrMVQyaE9IM21pTDhuOFd0aVlWdGc9PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWFjY2Vzc29yLWRlc2NyaXB0b3IiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJpcy1kYXRhLWRlc2NyaXB0b3IiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJraW5kLW9mIjogIl42LjAuMiIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJzbmFwZHJhZ29uLXV0aWwiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc25hcGRyYWdvbi11dGlsLy0vc25hcGRyYWdvbi11dGlsLTMuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1tYktrTWRRS3NqWDRCQUw0YlJZVGoyMWVkT2Y4Y043WEhkWVVKRWUrWm45OWhWRVljTXZLUGN0MUlxTmU3K0FaUGlybjhCQ0RPUUJIUVprbnFtS2xaUT09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAia2luZC1vZiI6ICJeMy4yLjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImtpbmQtb2YiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMy4yLjIiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9raW5kLW9mLy0va2luZC1vZi0zLjIuMi50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1NZW9ocHpTNnVidXc4eVJtMkpPdXBSNUtQR1E9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaXMtYnVmZmVyIjogIl4xLjEuNSIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJzb3VyY2UtbWFwIjogeworICAgICAgInZlcnNpb24iOiAiMC41LjciLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NvdXJjZS1tYXAvLS9zb3VyY2UtbWFwLTAuNS43LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtaWdPZExSQWgwaTBlb1V5QTJPcEdpNkx2UDh3PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInNvdXJjZS1tYXAtcmVzb2x2ZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuNS4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zb3VyY2UtbWFwLXJlc29sdmUvLS9zb3VyY2UtbWFwLXJlc29sdmUtMC41LjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU1qcXN2Tnd5ejFzM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taWRzIjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NwZHgtbGljZW5zZS1pZHMvLS9zcGR4LWxpY2Vuc2UtaWRzLTMuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1UZk9mUGNZR0JCNXNEdVBuM2RlQnl4UGhtZmVnQWhwRFlLU09YWlFOODFPeXJyaWY4WkNvZE9MekszQWVzRUxuQ3gwM2tpa2h5RHdoMHBmdnZRdkY4dz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAic3BsaXQiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3BsaXQvLS9zcGxpdC0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItbVR5T29QYnJpdnRYbnduSXhaUkZZUnJQTnRFRktscEIyZnZqU25DUVVpQUE2cUFaenF3bmE1ZW52SzR1azZPSWVQMTdDc2RGM3JTQkdZVkJzVTBUa2c9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ0aHJvdWdoIjogIjIiCisgICAgICB9CisgICAgfSwKKyAgICAic3BsaXQtc3RyaW5nIjogeworICAgICAgInZlcnNpb24iOiAiMy4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NwbGl0LXN0cmluZy8tL3NwbGl0LXN0cmluZy0zLjEuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItTnpOVmhKRFlwd2NlVlZpaTgvSHU2REtmRDJHK05yUUhsUy9WL3Fndjc2M0VZdWRWd0VjTVFOeGQybGgrMFZyVUJ5WE4vb0prbDVnck9oWVd2UVVZaXc9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4zLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJzcHJpbnRmLWpzIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NwcmludGYtanMvLS9zcHJpbnRmLWpzLTEuMS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtTnI1NE1ncitXQUgyenFQdWVMYmxxcmxBNmd3PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInNzaHBrIjogeworICAgICAgInZlcnNpb24iOiAiMS4xNS4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zc2hway8tL3NzaHBrLTEuMTUuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItbVNkZ05VYWlkaytkUlU1TWhZdE45emViZHpGMmlHMGNOUFd5OEhHK1c4eStmVDFKblNraDBmenpwak9hMEw3UDhpMVJzY3ozOHQwaDRnUGNLejQzeEE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhc24xIjogIn4wLjIuMyIsCisgICAgICAgICJhc3NlcnQtcGx1cyI6ICJeMS4wLjAiLAorICAgICAgICAiYmNyeXB0LXBia2RmIjogIl4xLjAuMCIsCisgICAgICAgICJkYXNoZGFzaCI6ICJeMS4xMi4wIiwKKyAgICAgICAgImVjYy1qc2JuIjogIn4wLjEuMSIsCisgICAgICAgICJnZXRwYXNzIjogIl4wLjEuMSIsCisgICAgICAgICJqc2JuIjogIn4wLjEuMCIsCisgICAgICAgICJzYWZlci1idWZmZXIiOiAiXjIuMC4yIiwKKyAgICAgICAgInR3ZWV0bmFjbCI6ICJ+MC4xNC4wIgorICAgICAgfQorICAgIH0sCisgICAgInN0YWNrLXRyYWNlIjogeworICAgICAgInZlcnNpb24iOiAiMC4wLjEwIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zdGFjay10cmFjZS8tL3N0YWNrLXRyYWNlLTAuMC4xMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVZIeHdzMGZvMHl0T0VJNmhvcUZaNWYzZUdjQT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAic3RhdGljLWV4dGVuZCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMS4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zdGF0aWMtZXh0ZW5kLy0vc3RhdGljLWV4dGVuZC0wLjEuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVlJQ2NPY3YvVlROeUp2MWVDMUlQTkI4ZnRjWT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjAuMi41IiwKKyAgICAgICAgIm9iamVjdC1jb3B5IjogIl4wLjEuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiZGVmaW5lLXByb3BlcnR5IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjAuMi41IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVmaW5lLXByb3BlcnR5Ly0vZGVmaW5lLXByb3BlcnR5LTAuMi41LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLXcxc2UrUmpzUEprUG1sdkZlK0JLck94Y2dSWT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1kZXNjcmlwdG9yIjogIl4wLjEuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJzdHJpbmdfZGVjb2RlciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMTAuMzEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3N0cmluZ19kZWNvZGVyLy0vc3RyaW5nX2RlY29kZXItMC4xMC4zMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVl1SUR2RUYyYkd3b3lmeUVNQjJySEZNUStwUT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJzdHJpcC1hbnNpIjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3RyaXAtYW5zaS8tL3N0cmlwLWFuc2ktMy4wLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1hamhmdUlVOWxTMWY4RjBPaXErVUo0M0dQYzg9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYW5zaS1yZWdleCI6ICJeMi4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAic3RyaXAtYm9tIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3N0cmlwLWJvbS8tL3N0cmlwLWJvbS0yLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVlobW9WaFpTQkpIelY0aTl2eFJIcVp4K2F3ND0iLAorICAgICAgImRldiI6IHR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WdoLy0vdGhyb3VnaC0yLjMuOC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLURkVEovNnE4TlhsZ3NiY2tFVjErRG9haTRmVT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgfSwKKyAgICAidG8tb2JqZWN0LXBhdGgiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjMuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvdG8tb2JqZWN0LXBhdGgvLS90by1vYmplY3QtcGF0aC0wLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUtYV0l0N0RuNEt3STRFNW5MNFhCOUptZUY2OD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJraW5kLW9mIjogIl4zLjAuMiIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAia2luZC1vZiI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIzLjIuMiIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2tpbmQtb2YvLS9raW5kLW9mLTMuMi4yLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLU1lb2hwelM2dWJ1dzh5Um0ySk91cFI1S1BHUT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpcy1idWZmZXIiOiAiXjEuMS41IgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgInRvLXJlZ2V4IjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RvLXJlZ2V4Ly0vdG8tcmVnZXgtMy4wLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLUZXdGxlTkF0Wi9LaTJxdHFlajJDWFRPYXlPSDliSERRRitRNDhWcFd5RFhqYll4QTRZejhpREIzMXpYT0JVbE9ISEtpZERicUdWclRVdlFNUG1CR0J3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkZWZpbmUtcHJvcGVydHkiOiAiXjIuMC4yIiwKKyAgICAgICAgImV4dGVuZC1zaGFsbG93IjogIl4zLjAuMiIsCisgICAgICAgICJyZWdleC1ub3QiOiAiXjEuMC4yIiwKKyAgICAgICAgInNhZmUtcmVnZXgiOiAiXjEuMS4wIgorICAgICAgfQorICAgIH0sCisgICAgInRvLXJlZ2V4LXJhbmdlIjogeworICAgICAgInZlcnNpb24iOiAiMi4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RvLXJlZ2V4LXJhbmdlLy0vdG8tcmVnZXgtcmFuZ2UtMi4xLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1mSURCZTUzK3ZsbWVKelorRFUzVldRRkIyemc9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaXMtbnVtYmVyIjogIl4zLjAuMCIsCisgICAgICAgICJyZXBlYXQtc3RyaW5nIjogIl4xLjYuMSIKKyAgICAgIH0KKyAgICB9LAorICAgICJ0b3VnaC1jb29raWUiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjQuMyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvdG91Z2gtY29va2llLy0vdG91Z2gtY29va2llLTIuNC4zLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1RNXNyay80dkRNNTRXSnNKaW8zWE5uNksyc0NHK0NROEc1V3o2YlpoUl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bC0wLjE0LjUudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1XdWFCZC9HUzFFVmlhZEVJcjZrLytIUS9UMlE9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAidHlwZWRhcnJheSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMC42IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90eXBlZGFycmF5Ly0vdHlwZWRhcnJheS0wLjAuNi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWhuckhUamhrR0hzZFBVZlpscWVPeGNpREIzYz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJ1Z2xpZnktanMiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjYuNCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy91Z2xpZnktanMvLS91Z2xpZnktanMtMi42LjQudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1aZW92c3dXY2s1UnBMeFgrMkh3ck5zRnJtdDg9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXN5bmMiOiAifjAuMi42IiwKKyAgICAgICAgInNvdXJjZS1tYXAiOiAifjAuNS4xIiwKKyAgICAgICAgInVnbGlmeS10by1icm93c2VyaWZ5IjogIn4xLjAuMCIsCisgICAgICAgICJ5YXJncyI6ICJ+My4xMC4wIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJhc3luYyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjIuMTAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL2FzeW5jLy0vYXN5bmMtMC4yLjEwLnRneiIsCisgICAgICAgICAgImludGVncml0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vcmVnaXN0cnkubnBtanMub3JnL3VuZGVyc2NvcmUtY29udHJpYi8tL3VuZGVyc2NvcmUtY29udHJpYi0wLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVpsdG13a2VEK1BvckdNbjR5N0RpeDlTTUpzYz0iLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAidW5kZXJzY29yZSI6ICIxLjYuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAidW5kZXJzY29yZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjYuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3VuZGVyc2NvcmUvLS91bmRlcnNjb3JlLTEuNi4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLWl6aXhES3plOWpNM3VMSk9UL2h0UmE2bEthZz0iCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJ1bmRlcnNjb3JlLnN0cmluZyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuMy41IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy91bmRlcnNjb3JlLnN0cmluZy8tL3VuZGVyc2NvcmUuc3RyaW5nLTMuMy41LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1nK2RwbWduK1hCbmVMbVhYbytzR2xXNXhRRXQ0RXJrUzNtZ2VOMkdGYnJlbVllTUJTSktyOVdmMktKcGxRVmFpUFkvZjdGTjZhdG9zV1lObTlvdnJZZz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAic3ByaW50Zi1qcyI6ICJeMS4wLjMiLAorICAgICAgICAidXRpbC1kZXByZWNhdGUiOiAiXjEuMC4yIgorICAgICAgfQorICAgIH0sCisgICAgInVuaWNvZGUtNS4y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W50ZWdyaXR5IjogInNoYTEtVWE5OVlVclpxZllRNmh1dnU1aWRheHhXaVE4PSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgImlzLWV4dGVuZGFibGUiOiAiXjAuMS4wIgorICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgInNldC12YWx1ZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjQuMyIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NldC12YWx1ZS8tL3NldC12YWx1ZS0wLjQuMy50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1mYkNQblQwaTNIOTQ1VHJ6dzc5R1p1emZ6UEU9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiZXh0ZW5kLXNoYWxsb3ciOiAiXjIuMC4xIiwKKyAgICAgICAgICAgICJpcy1leHRlbmRhYmxlIjogIl4wLjEuMSIsCisgICAgICAgICAgICAiaXMtcGxhaW4tb2JqZWN0IjogIl4yLjAuMSIsCisgICAgICAgICAgICAidG8tb2JqZWN0LXBhdGgiOiAiXjAuMy4wIgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgInVuc2V0LXZhbHVlIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3Vuc2V0LXZhbHVlLy0vdW5zZXQtdmFsdWUtMS4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1nM2FIUDMwak5SZWYreDV2dzZqdERmeUt0Vms9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaGFzLXZhbHVlIjogIl4wLjMuMSIsCisgICAgICAgICJpc29iamVjdCI6ICJeMy4wLjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImhhcy12YWx1ZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjMuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2hhcy12YWx1ZS8tL2hhcy12YWx1ZS0wLjMuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1leDlZdXRwaXlvSit3S0lIZ0NWbFNFV1pYaDg9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiZ2V0LXZhbHVlIjogIl4yLjAuMyIsCisgICAgICAgICAgICAiaGFzLXZhbHVlcyI6ICJeMC4xLjQiLAorICAgICAgICAgICAgImlzb2JqZWN0IjogIl4yLjAuMCIKKyAgICAgICAgICB9LAorICAgICAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICAgICAiaXNvYmplY3QiOiB7CisgICAgICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMS4wIiwKKyAgICAgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzb2JqZWN0Ly0vaXNvYmplY3QtMi4xLjAudGd6IiwKKyAgICAgICAgICAgICAgImludGVncml0eSI6ICJzaGExLThHVldFSmFqOGRvdTlHSnkrQlhJUU5oK0RJaz0iLAorICAgICAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAgICAgICAgICJpc2FycmF5IjogIjEuMC4wIgorICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAiaGFzLXZhbHVlcyI6IHsKKyAgICAgICAgICAidmVyc2l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OiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXN5bmMiOiAifjEuMC4wIiwKKyAgICAgICAgImNvbG9ycyI6ICIxLjAueCIsCisgICAgICAgICJjeWNsZSI6ICIxLjAueCIsCisgICAgICAgICJleWVzIjogIjAuMS54IiwKKyAgICAgICAgImlzc3RyZWFtIjogIjAuMS54IiwKKyAgICAgICAgInN0YWNrLXRyYWNlIjogIjAuMC54IgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJhc3luYyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYXN5bmMvLS9hc3luYy0xLjAuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS0rUHdFeWpvVGVFcmVuaFpCcjVoWGpQdldSNms9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgICAgIH0sCisgICAgICAgICJjb2xvcnMiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4wLjMiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jb2xvcnMvLS9jb2xvcnMtMS4wLjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtQkRQMFRZQ1dnUDNyWU8wbUR4c01KaTZDcEFzPSIsCisgICAgICAgICAgImRldiI6IHRydWUsCisgICAgICAgICAgIm9wdGlvbmFsIjogdHJ1ZQorICAgICAgICB9CisgICAgICB9CisgICAgfSwKKyAgICAid29yZHdyYXAiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvd29yZHdyYXAvLS93b3Jkd3JhcC0wLjAuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLXQ1WnB1MExzdEFuNFBWZzhyVkxLRitxaFpEOD0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJ3cmFwcHkiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvd3JhcHB5Ly0vd3JhcHB5LTEuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtdFNROWp6N0Jxalh4TmtZRnZBMFFOdU1LdHA4PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgIndzIjogeworICAgICAgInZlcnNpb24iOiAiNS4yLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3dzLy0vd3MtNS4yLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWphSEZENlBGdjZVZ29JVmRhNnFabGxwdFFzTWxERUprVFFjeWJ6elhEWU0xWE85WThlbTY5MUZHTVBtTTQ2V0d5TFU0ejlLTWdRTitxcnV4L25obEhBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhc3luYy1saW1pdGVyIjogIn4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJ4bWxjcmVhdGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcveG1sY3JlYXRlLy0veG1sY3JlYXRlLTEuMC4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtK212M1lxWUtRVCt6M1k5TEE4V3lhU09OTUk4PSIKKyAgICB9LAorICAgICJ5YXJncyI6IHsKKyAgICAgICJ2ZXJzaW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AgQk9PTDogMiwKKyAgICAgICAgQllURTogMywKKyAgICAgICAgSTA4OiAzLAorICAgICAgICBET1VCTEU6IDQsCisgICAgICAgIEkxNjogNiwKKyAgICAgICAgSTMyOiA4LAorICAgICAgICBJNjQ6IDEwLAorICAgICAgICBTVFJJTkc6IDExLAorICAgICAgICBVVEY3OiAxMSwKKyAgICAgICAgU1RSVUNUOiAxMiwKKyAgICAgICAgTUFQOiAxMywKKyAgICAgICAgU0VUOiAxNCwKKyAgICAgICAgTElTVDogMTUsCisgICAgICAgIFVURjg6IDE2LAorICAgICAgICBVVEYxNjogMTcKKyAgICB9LAorCisgICAgLyoqCisgICAgICogVGhyaWZ0IFJQQyBtZXNzYWdlIHR5cGUgc3RyaW5nIHRvIElkIG1hcHBpbmcuCisgICAgICogQHJlYWRvbmx5CisgICAgICogQHByb3BlcnR5IHtudW1iZXJ9ICBDQUxMICAgICAgLSBSUEMgY2FsbCBzZW50IGZyb20gY2xpZW50IHRvIHNlcnZlci4KKyAgICAgKiBAcHJvcGVydHkge251bWJlcn0gIFJFUExZICAgICAtIFJQQyBjYWxsIG5vcm1hbCByZXNwb25zZSBmcm9tIHNlcnZlciB0byBjbGllbnQuCisgICAgICogQHByb3BlcnR5IHtudW1iZXJ9ICBFWENFUFRJT04gLSBSUEMgY2FsbCBleGNlcHRpb24gcmVzcG9uc2UgZnJvbSBzZXJ2ZXIgdG8gY2xpZW50LgorICAgICAqIEBwcm9wZXJ0eSB7bnVtYmVyfSAgT05FV0FZICAgIC0gT25ld2F5IFJQQyBjYWxsIGZyb20gY2xpZW50IHRvIHNlcnZlciB3aXRoIG5vIHJlc3BvbnNlLgorICAgICAqLworICAgIE1lc3NhZ2VUeXBlOiB7CisgICAgICAgIENBTEw6IDEsCisgICAgICAgIFJFUExZOiAyLAorICAgICAgICBFWENFUFRJT046IDMsCisgICAgICAgIE9ORVdBWTogNAorICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBVdGlsaXR5IGZ1bmN0aW9uIHJldHVybmluZyB0aGUgY291bnQgb2YgYW4gb2JqZWN0J3Mgb3duIHByb3BlcnRpZXMuCisgICAgICogQHBhcmFtIHtvYmplY3R9IG9iaiAtIE9iamVjdCB0byB0ZXN0LgorICAgICAqIEByZXR1cm5zIHtudW1iZXJ9IG51bWJlciBvZiBvYmplY3QncyBvd24gcHJvcGVydGllcworICAgICAqLworICAgIG9iamVjdExlbmd0aDogZnVuY3Rpb24ob2JqKSB7CisgICAgICAgIHZhciBsZW5ndGggPSAwOworICAgICAgICBmb3IgKHZhciBrIGluIG9iaikgeworICAgICAgICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShrKSkgeworICAgICAgICAgICAgICAgIGxlbmd0aCsrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBsZW5ndGg7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFV0aWxpdHkgZnVuY3Rpb24gdG8gZXN0YWJsaXNoIHByb3RvdHlwZSBpbmhlcml0YW5jZS4KKyAgICAgKiBAc2VlIHtAbGluayBodHRwOi8vamF2YXNjcmlwdC5jcm9ja2ZvcmQuY29tL3Byb3RvdHlwYWwuaHRtbHxQcm90b3R5cGFsIEluaGVyaXRhbmNlfQorICAgICAqIEBwYXJhbSB7ZnVuY3Rpb259IGNvbnN0cnVjdG9yIC0gQ29udHN0cnVjdG9yIGZ1bmN0aW9uIHRvIHNldCBhcyBkZXJpdmVkLgorICAgICAqIEBwYXJhbSB7ZnVuY3Rpb259IHN1cGVyQ29uc3RydWN0b3IgLSBDb250c3RydWN0b3IgZnVuY3Rpb24gdG8gc2V0IGFzIGJhc2UuCisgICAgICogQHBhcmFtIHtzdHJpbmd9IFtuYW1lXSAtIFR5cGUgbmFtZSB0byBzZXQgYXMgbmFtZSBwcm9wZXJ0eSBpbiBkZXJpdmVkIHByb3RvdHlwZS4KKyAgICAgKi8KKyAgICBpbmhlcml0czogZnVuY3Rpb24oY29uc3RydWN0b3IsIHN1cGVyQ29uc3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HlwZSA9PSBUaHJpZnQuVHlwZS5TVFJJTkcpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQucmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSByZXQudmFsdWU7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQuc2tpcChyZXQuZnR5cGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgICAgICBpZiAocmV0LmZ0eXBlID09IFRocmlmdC5UeXBlLkkzMikgeworICAgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5yZWFkSTMyKCk7CisgICAgICAgICAgICAgICAgICAgIHRoaXMuY29kZSA9IHJldC52YWx1ZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5za2lwKHJldC5mdHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHJldCA9IGlucHV0LnNraXAocmV0LmZ0eXBlKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIGlucHV0LnJlYWRGaWVsZEVuZCgpOworICAgIH0KKworICAgIGlucHV0LnJlYWRTdHJ1Y3RFbmQoKTsKK307CisKKy8qKgorICogV2l0ZSBhIFRBcHBsaWNhdGlvbkV4Y2VwdGlvbiB0byB0aGUgc3VwcGxpZWQgcHJvdG9jb2wuCisgKiBAcGFyYW0ge29iamVjdH0gb3V0cHV0IC0gVGhlIG91dHB1dCBwcm90b2NvbCB0byB3cml0ZSB0by4KKyAqLworVGhyaWZ0LlRBcHBsaWNhdGlvbkV4Y2VwdGlvbi5wcm90b3R5cGUud3JpdGUgPSBmdW5jdGlvbihvdXRwdXQpIHsKKyAgICBvdXRwdXQud3JpdGVTdHJ1Y3RCZWdpbignVEFwcGxpY2F0aW9uRXhjZXB0aW9uJyk7CisKKyAgICBpZiAodGhpcy5tZXNzYWdlKSB7CisgICAgICAgIG91dHB1dC53cml0ZUZpZWxkQmVnaW4oJ21lc3NhZ2UnLCBUaHJpZnQuVHlwZS5TVFJJTkcsIDEpOworICAgICAgICBvdXRwdXQud3JpdGVTdHJpbmcodGhpcy5nZXRNZXNzYWdlKCkpOworICAgICAgICBvdXRwdXQud3JpdGVGaWVsZEVuZCgpOworICAgIH0KKworICAgIGlmICh0aGlzLmNvZGUpIHsKKyAgICAgICAgb3V0cHV0LndyaXRlRmllbGRCZWdpbigndHlwZScsIFRocmlmdC5UeXBlLkkzMiwgMik7CisgICAgICAgIG91dHB1dC53cml0ZUkzMih0aGlzLmNvZGUpOworICAgICAgICBvdXRwdXQud3JpdGVGaWVsZEVuZCgpOworICAgIH0KKworICAgIG91dHB1dC53cml0ZUZpZWxkU3RvcCgpOworICAgIG91dHB1dC53cml0ZVN0cnVjdEVuZCgpOworfTsKKworLyoqCisgKiBSZXR1cm5zIHRoZSBhcHBsaWNhdGlvbiBleGNlcHRpb24gY29kZSBzZXQgb24gdGhlIGV4Y2VwdGlvbi4KKyAqIEByZWFkb25seQorICogQHJldHVybnMge1RocmlmdC5UQXBwbGljYXRpb25FeGNlcHRpb25UeXBlfSBleGNlcHRpb24gY29kZQorICovCitUaHJpZnQuVEFwcGxpY2F0aW9uRXhjZXB0aW9uLnByb3RvdHlwZS5nZXRDb2RlID0gZnVuY3Rpb24oKSB7CisgICAgcmV0dXJuIHRoaXMuY29kZTsKK307CisKK1RocmlmdC5UUHJvdG9jb2xFeGNlcHRpb25UeXBlID0geworICAgIFVOS05PV046IDAsCisgICAgSU5WQUxJRF9EQVRBOiAxLAorICAgIE5FR0FUSVZFX1NJWkU6IDIsCisgICAgU0laRV9MSU1JVDogMywKKyAgICBCQURfVkVSU0lP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ICAgICAqLworICAgIGZsdXNoOiBmdW5jdGlvbihhc3luYywgY2FsbGJhY2spIHsKKyAgICAgICAgdmFyIHNlbGYgPSB0aGlzOworICAgICAgICBpZiAoKGFzeW5jICYmICFjYWxsYmFjaykgfHwgdGhpcy51cmwgPT09IHVuZGVmaW5lZCB8fCB0aGlzLnVybCA9PT0gJycpIHsKKyAgICAgICAgICAgIHJldHVybiB0aGlzLnNlbmRfYnVmOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHhyZXEgPSB0aGlzLmdldFhtbEh0dHBSZXF1ZXN0T2JqZWN0KCk7CisKKyAgICAgICAgaWYgKHhyZXEub3ZlcnJpZGVNaW1lVHlwZSkgeworICAgICAgICAgICAgeHJlcS5vdmVycmlkZU1pbWVUeXBlKCdhcHBsaWNhdGlvbi92bmQuYXBhY2hlLnRocmlmdC5qc29uOyBjaGFyc2V0PXV0Zi04Jyk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoY2FsbGJhY2spIHsKKyAgICAgICAgICAgIC8vSWdub3JlIFhIUiBjYWxsYmFja3MgdW50aWwgdGhlIGRhdGEgYXJyaXZlcywgdGhlbiBjYWxsIHRoZQorICAgICAgICAgICAgLy8gIGNsaWVudCdzIGNhbGxiYWNrCisgICAgICAgICAgICB4cmVxLm9ucmVhZHlzdGF0ZWNoYW5nZSA9CisgICAgICAgICAgICAgIChmdW5jdGlvbigpIHsKKyAgICAgICAgICAgICAgICB2YXIgY2xpZW50Q2FsbGJhY2sgPSBjYWxsYmFjazsKKyAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7CisgICAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWFkeVN0YXRlID09IDQgJiYgdGhpcy5zdGF0dXMgPT0gMjAwKSB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0UmVjdkJ1ZmZlcih0aGlzLnJlc3BvbnNlVGV4dCk7CisgICAgICAgICAgICAgICAgICAgIGNsaWVudENhbGxiYWNrKCk7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgfSgpKTsKKworICAgICAgICAgICAgLy8gZGV0ZWN0IG5ldDo6RVJSX0NPTk5FQ1RJT05fUkVGVVNFRCBhbmQgY2FsbCB0aGUgY2FsbGJhY2suCisgICAgICAgICAgICB4cmVxLm9uZXJyb3IgPQorICAgICAgICAgICAgICAgIChmdW5jdGlvbigpIHsKKyAgICAgICAgICAgICAgICAgIHZhciBjbGllbnRDYWxsYmFjayA9IGNhbGxiYWNrOworICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkgeworICAgICAgICAgICAgICAgICAgICAgIGNsaWVudENhbGxiYWNrKCk7CisgICAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIH0oKSk7CisKKyAgICAgICAgfQorCisgICAgICAgIHhyZXEub3BlbignUE9TVCcsIHRoaXMudXJsLCAhIWFzeW5jKTsKKworICAgICAgICAvLyBhZGQgY3VzdG9tIGhlYWRlcnMKKyAgICAgICAgT2JqZWN0LmtleXMoc2VsZi5jdXN0b21IZWFkZXJzKS5mb3JFYWNoKGZ1bmN0aW9uKHByb3ApIHsKKyAgICAgICAgICAgIHhyZXEuc2V0UmVxdWVzdEhlYWRlcihwcm9wLCBzZWxmLmN1c3RvbUhlYWRlcnNbcHJvcF0pOworICAgICAgICB9KTsKKworICAgICAgICBpZiAoeHJlcS5zZXRSZXF1ZXN0SGVhZGVyKSB7CisgICAgICAgICAgICB4cmVxLnNldFJlcXVlc3RIZWFkZXIoJ0FjY2VwdCcsICdhcHBsaWNhdGlvbi92bmQuYXBhY2hlLnRocmlmdC5qc29uOyBjaGFyc2V0PXV0Zi04Jyk7CisgICAgICAgICAgICB4cmVxLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi92bmQuYXBhY2hlLnRocmlmdC5qc29uOyBjaGFyc2V0PXV0Zi04Jyk7CisgICAgICAgIH0KKworICAgICAgICB4cmVxLnNlbmQodGhpcy5zZW5kX2J1Zik7CisgICAgICAgIGlmIChhc3luYyAmJiBjYWxsYmFjaykgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHhyZXEucmVhZHlTdGF0ZSAhPSA0KSB7CisgICAgICAgICAgICB0aHJvdyAnZW5jb3VudGVyZWQgYW4gdW5rbm93biBhamF4IHJlYWR5IHN0YXRlOiAnICsgeHJlcS5yZWFkeVN0YXRlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHhyZXEuc3RhdHVzICE9IDIwMCkgeworICAgICAgICAgICAgdGhyb3cgJ2VuY291bnRlcmVkIGEgdW5rbm93biByZXF1ZXN0IHN0YXR1czogJyArIHhyZXEuc3RhdHVzOworICAgICAgICB9CisKKyAgICAgICAgdGhpcy5yZWN2X2J1ZiA9IHhyZXEucmVzcG9uc2VUZXh0OworICAgICAgICB0aGlzLnJlY3ZfYnVmX3N6ID0gdGhpcy5yZWN2X2J1Zi5sZW5ndGg7CisgICAgICAgIHRoaXMud3BvcyA9IHRoaXMucmVjdl9idWYubGVuZ3RoOworICAgICAgICB0aGlzLnJwb3MgPSAwOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEgalF1ZXJ5IFhIUiBvYmplY3QgdG8gYmUgdXNlZCBmb3IgYSBUaHJpZnQgc2VydmVyIGNhbGwuCisgICAgICogQHBhcmFtIHtvYmplY3R9IGNsaWVudCAtIFRoZSBUaHJpZnQgU2VydmljZSBjbGllbnQgb2JqZWN0IGdlbmVyYXRlZCBieSB0aGUgSURMIGNvbXBpbGVyLgorICAgICAqIEBwYXJhbSB7b2JqZWN0fSBwb3N0RGF0YSAtIFRoZSBtZXNzYWdlIHRvIHNlbmQgdG8gdGhlIHNlcnZlci4KKyAgICAgKiBAcGFyYW0ge2Z1bmN0aW9ufSBhcmdzIC0gVGhlIG9yaWdpbmFsIGNhbGwgYXJndW1lbnRzIHdpdG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U6ICd0ZXh0IHRocmlmdCcsCisgICAgICAgICAgICBjb252ZXJ0ZXJzOiB7CisgICAgICAgICAgICAgICAgJ3RleHQgdGhyaWZ0JyA6IGZ1bmN0aW9uKHJlc3BvbnNlRGF0YSkgeworICAgICAgICAgICAgICAgICAgICB0aHJpZnRUcmFuc3BvcnQuc2V0UmVjdkJ1ZmZlcihyZXNwb25zZURhdGEpOworICAgICAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSByZWN2X21ldGhvZC5jYWxsKGNsaWVudCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgY29udGV4dDogY2xpZW50LAorICAgICAgICAgICAgc3VjY2VzczogalF1ZXJ5Lm1ha2VBcnJheShhcmdzKS5wb3AoKQorICAgICAgICB9KTsKKworICAgICAgICByZXR1cm4ganFYSFI7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIGJ1ZmZlciB0byBwcm92aWRlIHRoZSBwcm90b2NvbCB3aGVuIGRlc2VyaWFsaXppbmcuCisgICAgICogQHBhcmFtIHtzdHJpbmd9IGJ1ZiAtIFRoZSBidWZmZXIgdG8gc3VwcGx5IHRoZSBwcm90b2NvbC4KKyAgICAgKi8KKyAgICBzZXRSZWN2QnVmZmVyOiBmdW5jdGlvbihidWYpIHsKKyAgICAgICAgdGhpcy5yZWN2X2J1ZiA9IGJ1ZjsKKyAgICAgICAgdGhpcy5yZWN2X2J1Zl9zeiA9IHRoaXMucmVjdl9idWYubGVuZ3RoOworICAgICAgICB0aGlzLndwb3MgPSB0aGlzLnJlY3ZfYnVmLmxlbmd0aDsKKyAgICAgICAgdGhpcy5ycG9zID0gMDsKKyAgICB9LAorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSB0cmFuc3BvcnQgaXMgb3BlbiwgWEhSIGFsd2F5cyByZXR1cm5zIHRydWUuCisgICAgICogQHJlYWRvbmx5CisgICAgICogQHJldHVybnMge2Jvb2xlYW59IEFsd2F5cyBUcnVlLgorICAgICAqLworICAgIGlzT3BlbjogZnVuY3Rpb24oKSB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBPcGVucyB0aGUgdHJhbnNwb3J0IGNvbm5lY3Rpb24sIHdpdGggWEhSIHRoaXMgaXMgYSBub3AuCisgICAgICovCisgICAgb3BlbjogZnVuY3Rpb24oKSB7fSwKKworICAgIC8qKgorICAgICAqIENsb3NlcyB0aGUgdHJhbnNwb3J0IGNvbm5lY3Rpb24sIHdpdGggWEhSIHRoaXMgaXMgYSBub3AuCisgICAgICovCisgICAgY2xvc2U6IGZ1bmN0aW9uKCkge30sCisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBzcGVjaWZpZWQgbnVtYmVyIG9mIGNoYXJhY3RlcnMgZnJvbSB0aGUgcmVzcG9uc2UKKyAgICAgKiBidWZmZXIuCisgICAgICogQHBhcmFtIHtudW1iZXJ9IGxlbiAtIFRoZSBudW1iZXIgb2YgY2hhcmFjdGVycyB0byByZXR1cm4uCisgICAgICogQHJldHVybnMge3N0cmluZ30gQ2hhcmFjdGVycyBzZW50IGJ5IHRoZSBzZXJ2ZXIuCisgICAgICovCisgICAgcmVhZDogZnVuY3Rpb24obGVuKSB7CisgICAgICAgIHZhciBhdmFpbCA9IHRoaXMud3BvcyAtIHRoaXMucnBvczsKKworICAgICAgICBpZiAoYXZhaWwgPT09IDApIHsKKyAgICAgICAgICAgIHJldHVybiAnJzsKKyAgICAgICAgfQorCisgICAgICAgIHZhciBnaXZlID0gbGVuOworCisgICAgICAgIGlmIChhdmFpbCA8IGxlbikgeworICAgICAgICAgICAgZ2l2ZSA9IGF2YWlsOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHJldCA9IHRoaXMucmVhZF9idWYuc3Vic3RyKHRoaXMucnBvcywgZ2l2ZSk7CisgICAgICAgIHRoaXMucnBvcyArPSBnaXZlOworCisgICAgICAgIC8vY2xlYXIgYnVmIHdoZW4gY29tcGxldGU/CisgICAgICAgIHJldHVybiByZXQ7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGVudGlyZSByZXNwb25zZSBidWZmZXIuCisgICAgICogQHJldHVybnMge3N0cmluZ30gQ2hhcmFjdGVycyBzZW50IGJ5IHRoZSBzZXJ2ZXIuCisgICAgICovCisgICAgcmVhZEFsbDogZnVuY3Rpb24oKSB7CisgICAgICAgIHJldHVybiB0aGlzLnJlY3ZfYnVmOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBzZW5kIGJ1ZmZlciB0byBidWYuCisgICAgICogQHBhcmFtIHtzdHJpbmd9IGJ1ZiAtIFRoZSBidWZmZXIgdG8gc2VuZC4KKyAgICAgKi8KKyAgICB3cml0ZTogZnVuY3Rpb24oYnVmKSB7CisgICAgICAgIHRoaXMuc2VuZF9idWYgPSBidWY7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHNlbmQgYnVmZmVyLgorICAgICAqIEByZWFkb25seQorICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IFRoZSBzZW5kIGJ1ZmZlci4KKyAgICAgKi8KKyAgICBnZXRTZW5kQnVmZmVyOiBmdW5jdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIHRoaXMuc2VuZF9idWY7CisgICAgfQorCit9OworCisKKy8qKgorICogQ29uc3RydWN0b3IgRnVuY3Rpb24gZm9yIHRoZSBXZWJTb2NrZXQgdHJhbnNwb3J0LgorICogQGNvbnN0cnVjdG9yCisgKiBAcGFyYW0ge3N0cmluZ30gW3VybF0gLSBUaGUgVVJMIHRvIGNvbm5lY3QgdG8uCisgKiBAY2xhc3NkZXNjIFRoZSBBcGFjaGUgVGhyaWZ0IFRyYW5zcG9ydCBsYXllciBwZXJmb3JtcyBieXRlIGxldmVsIEkvTworICogYmV0d2VlbiBS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AgICAgc2VsZi5zZXRSZWN2QnVmZmVyKG1zZyk7CisgICAgICAgICAgICBpZiAoY2xpZW50Q2FsbGJhY2spIHsKKyAgICAgICAgICAgICAgICBjbGllbnRDYWxsYmFjaygpOworICAgICAgICAgICAgfQorICAgICAgICAgIH07CisgICAgICAgIH0oKSkpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgLy9RdWV1ZSB0aGUgc2VuZCB0byBnbyBvdXQgX19vbk9wZW4KKyAgICAgICAgdGhpcy5zZW5kX3BlbmRpbmcucHVzaCh7CisgICAgICAgICAgYnVmOiB0aGlzLnNlbmRfYnVmLAorICAgICAgICAgIGNiOiBjYWxsYmFjaworICAgICAgICB9KTsKKyAgICAgIH0KKyAgICB9LAorCisgICAgX19vbk9wZW46IGZ1bmN0aW9uKCkgeworICAgICAgIHZhciBzZWxmID0gdGhpczsKKyAgICAgICBpZiAodGhpcy5zZW5kX3BlbmRpbmcubGVuZ3RoID4gMCkgeworICAgICAgICAgIC8vSWYgdGhlIHVzZXIgbWFkZSBjYWxscyBiZWZvcmUgdGhlIGNvbm5lY3Rpb24gd2FzIGZ1bGx5CisgICAgICAgICAgLy9vcGVuLCBzZW5kIHRoZW0gbm93CisgICAgICAgICAgdGhpcy5zZW5kX3BlbmRpbmcuZm9yRWFjaChmdW5jdGlvbihlbGVtKSB7CisgICAgICAgICAgICAgc2VsZi5zb2NrZXQuc2VuZChlbGVtLmJ1Zik7CisgICAgICAgICAgICAgc2VsZi5jYWxsYmFja3MucHVzaCgoZnVuY3Rpb24oKSB7CisgICAgICAgICAgICAgICB2YXIgY2xpZW50Q2FsbGJhY2sgPSBlbGVtLmNiOworICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKG1zZykgeworICAgICAgICAgICAgICAgICAgc2VsZi5zZXRSZWN2QnVmZmVyKG1zZyk7CisgICAgICAgICAgICAgICAgICBjbGllbnRDYWxsYmFjaygpOworICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICB9KCkpKTsKKyAgICAgICAgICB9KTsKKyAgICAgICAgICB0aGlzLnNlbmRfcGVuZGluZyA9IFtdOworICAgICAgIH0KKyAgICB9LAorCisgICAgX19vbkNsb3NlOiBmdW5jdGlvbihldnQpIHsKKyAgICAgIHRoaXMuX19yZXNldCh0aGlzLnVybCk7CisgICAgfSwKKworICAgIF9fb25NZXNzYWdlOiBmdW5jdGlvbihldnQpIHsKKyAgICAgIGlmICh0aGlzLmNhbGxiYWNrcy5sZW5ndGgpIHsKKyAgICAgICAgdGhpcy5jYWxsYmFja3Muc2hpZnQoKShldnQuZGF0YSk7CisgICAgICB9CisgICAgfSwKKworICAgIF9fb25FcnJvcjogZnVuY3Rpb24oZXZ0KSB7CisgICAgICBjb25zb2xlLmxvZygnVGhyaWZ0IFdlYlNvY2tldCBFcnJvcjogJyArIGV2dC50b1N0cmluZygpKTsKKyAgICAgIHRoaXMuc29ja2V0LmNsb3NlKCk7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIGJ1ZmZlciB0byB1c2Ugd2hlbiByZWNlaXZpbmcgc2VydmVyIHJlc3BvbnNlcy4KKyAgICAgKiBAcGFyYW0ge3N0cmluZ30gYnVmIC0gVGhlIGJ1ZmZlciB0byByZWNlaXZlIHNlcnZlciByZXNwb25zZXMuCisgICAgICovCisgICAgc2V0UmVjdkJ1ZmZlcjogZnVuY3Rpb24oYnVmKSB7CisgICAgICAgIHRoaXMucmVjdl9idWYgPSBidWY7CisgICAgICAgIHRoaXMucmVjdl9idWZfc3ogPSB0aGlzLnJlY3ZfYnVmLmxlbmd0aDsKKyAgICAgICAgdGhpcy53cG9zID0gdGhpcy5yZWN2X2J1Zi5sZW5ndGg7CisgICAgICAgIHRoaXMucnBvcyA9IDA7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGUgdHJhbnNwb3J0IGlzIG9wZW4KKyAgICAgKiBAcmVhZG9ubHkKKyAgICAgKiBAcmV0dXJucy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yoqCisgICAgICogUmV0dXJucyB0aGUgc3BlY2lmaWVkIG51bWJlciBvZiBjaGFyYWN0ZXJzIGZyb20gdGhlIHJlc3BvbnNlCisgICAgICogYnVmZmVyLgorICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsZW4gLSBUaGUgbnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gcmV0dXJuLgorICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IENoYXJhY3RlcnMgc2VudCBieSB0aGUgc2VydmVyLgorICAgICAqLworICAgIHJlYWQ6IGZ1bmN0aW9uKGxlbikgeworICAgICAgICB2YXIgYXZhaWwgPSB0aGlzLndwb3MgLSB0aGlzLnJwb3M7CisKKyAgICAgICAgaWYgKGF2YWlsID09PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gJyc7CisgICAgICAgIH0KKworICAgICAgICB2YXIgZ2l2ZSA9IGxlbjsKKworICAgICAgICBpZiAoYXZhaWwgPCBsZW4pIHsKKyAgICAgICAgICAgIGdpdmUgPSBhdmFpbDsKKyAgICAgICAgfQorCisgICAgICAgIHZhciByZXQgPSB0aGlzLnJlYWRfYnVmLnN1YnN0cih0aGlzLnJwb3MsIGdpdmUpOworICAgICAgICB0aGlzLnJwb3MgKz0gZ2l2ZTsKKworICAgICAgICAvL2NsZWFyIGJ1ZiB3aGVuIGNvbXBsZXRlPworICAgICAgICByZXR1cm4gcmV0OworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBlbnRpcmUgcmVzcG9uc2UgYnVmZmVyLgorICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IENoYXJhY3RlcnMgc2VudCBieSB0aGUgc2VydmVyLgorICAgICAqLworICAgIHJlYWRBbGw6IGZ1bmN0aW9uKCkgeworICAgICAgICByZXR1cm4gdGhpcy5yZWN2X2J1ZjsKKyAgICB9LAorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgc2VuZCBidWZmZXIgdG8gYnVmLgorICAgICAqIEBwYXJhb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oaXMudHN0YWNrLnBvcCgpOworICAgICAgICB0aGlzLndvYmoucHVzaChvYmopOworCisgICAgICAgIHRoaXMud2J1ZiA9ICdbJyArIHRoaXMud29iai5qb2luKCcsJykgKyAnXSc7CisKKyAgICAgICAgdGhpcy50cmFuc3BvcnQud3JpdGUodGhpcy53YnVmKTsKKyAgICAgfSwKKworCisgICAgLyoqCisgICAgICogU2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mIGEgc3RydWN0LgorICAgICAqIEBwYXJhbSB7c3RyaW5nfSBuYW1lIC0gVGhlIG5hbWUgb2YgdGhlIHN0cnVjdC4KKyAgICAgKi8KKyAgICB3cml0ZVN0cnVjdEJlZ2luOiBmdW5jdGlvbihuYW1lKSB7CisgICAgICAgIHRoaXMudHBvcy5wdXNoKHRoaXMudHN0YWNrLmxlbmd0aCk7CisgICAgICAgIHRoaXMudHN0YWNrLnB1c2goe30pOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBTZXJpYWxpemVzIHRoZSBlbmQgb2YgYSBzdHJ1Y3QuCisgICAgICovCisgICAgd3JpdGVTdHJ1Y3RFbmQ6IGZ1bmN0aW9uKCkgeworCisgICAgICAgIHZhciBwID0gdGhpcy50cG9zLnBvcCgpOworICAgICAgICB2YXIgc3RydWN0ID0gdGhpcy50c3RhY2tbcF07CisgICAgICAgIHZhciBzdHIgPSAneyc7CisgICAgICAgIHZhciBmaXJzdCA9IHRydWU7CisgICAgICAgIGZvciAodmFyIGtleSBpbiBzdHJ1Y3QpIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN0ciArPSAnLCc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN0ciArPSBrZXkgKyAnOicgKyBzdHJ1Y3Rba2V5XTsKKyAgICAgICAgfQorCisgICAgICAgIHN0ciArPSAnfSc7CisgICAgICAg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RoKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAoKHRoaXMudHN0YWNrLmxlbmd0aCAtIHAgLSAxKSAlIDIgIT09IDApIHsKKyAgICAgICAgICAgIHRoaXMudHN0YWNrLnB1c2goJycpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHNpemUgPSAodGhpcy50c3RhY2subGVuZ3RoIC0gcCAtIDEpIC8gMjsKKworICAgICAgICB0aGlzLnRzdGFja1twXVt0aGlzLnRzdGFja1twXS5sZW5ndGggLSAxXSA9IHNpemU7CisKKyAgICAgICAgdmFyIG1hcCA9ICd9JzsKKyAgICAgICAgdmFyIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgd2hpbGUgKHRoaXMudHN0YWNrLmxlbmd0aCA+IHAgKyAxKSB7CisgICAgICAgICAgICB2YXIgdiA9IHRoaXMudHN0YWNrLnBvcCgpOworICAgICAgICAgICAgdmFyIGsgPSB0aGlzLnRzdGFjay5wb3AoKTsKKyAgICAgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1hcCA9ICcsJyArIG1hcDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCEgaXNOYU4oaykpIHsgayA9ICciJyArIGsgKyAnIic7IH0gLy9qc29uICJrZXlzIiBuZWVkIHRvIGJlIHN0cmluZ3MKKyAgICAgICAgICAgIG1hcCA9IGsgKyAnOicgKyB2ICsgbWFwOworICAgICAgICB9CisgICAgICAgIG1hcCA9ICd7JyArIG1hcDsKKworICAgICAgICB0aGlzLnRzdGFja1twXS5wdXNoKG1hcCk7CisgICAgICAgIHRoaXMudHN0YWNrW3BdID0gJ1snICsgdGhpcy50c3RhY2tbcF0uam9pbignLCcpICsgJ10nOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBTZXJpYWxpemVzIHRoZSBiZWdpbm5pbmcgb2YgYSBsaXN0IGNvbGxlY3Rpb24uCisgICAgICogQHBhcmFtIHtUaHJpZnQuVHlwZX0gZWxlbVR5cGUgLSBUaGUgZGF0YSB0eXBlIG9mIHRoZSBlbGVtZW50cy4KKyAgICAgKiBAcGFyYW0ge251bWJlcn0gc2l6ZSAtIFRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhlIGxpc3QuCisgICAgICovCisgICAgd3JpdGVMaXN0QmVnaW46IGZ1bmN0aW9uKGVsZW1UeXBlLCBzaXplKSB7CisgICAgICAgIHRoaXMudHBvcy5wdXNoKHRoaXMudHN0YWNrLmxlbmd0aCk7CisgICAgICAgIHRoaXMudHN0YWNrLnB1c2goW1RocmlmdC5Qcm90b2NvbC5UeXBlW2VsZW1UeXBlXSwgc2l6ZV0pOworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBTZXJpYWxpemVzIHRoZSBlbmQgb2YgYSBsaXN0LgorICAgICAqLworICAgIHdyaXRlTGlzdEVuZDogZnVuY3Rpb24oKSB7CisgICAgICAgIHZhciBwID0gdGhpcy50cG9zLnBvcCgpOworCisgICAgICAgIHdoaWxlICh0aGlzLnRzdGFjay5sZW5ndGggPiBwICsgMSkgeworICAgICAgICAgICAgdmFyIHRtcFZhbCA9IHRoaXMudHN0YWNrW3AgKyAxXTsKKyAgICAgICAgICAgIHRoaXMudHN0YWNrLnNwbGljZShwICsgMSwgMSk7CisgICAgICAgICAgICB0aGlzLnRzdGFja1twXS5wdXNoKHRtcFZhbCk7CisgICAgICAgIH0KKworICAgICAgICB0aGlzLnRzdGFja1twXSA9ICdbJyArIHRoaXMudHN0YWNrW3BdLmpvaW4oJywnKSArICddJzsKKyAgICB9LAorCisgICAgLyoqCisgICAgICogU2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mIGEgc2V0IGNvbGxlY3Rpb24uCisgICAgICogQHBhcmFtIHtUaHJpZnQuVHlwZX0gZWxlbVR5cGUgLSBUaGUgZGF0YSB0eXBlIG9mIHRoZSBlbGVtZW50cy4KKyAgICAgKiBAcGFyYW0ge251bWJlcn0gc2l6ZSAtIFRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhlIGxpc3QuCisgICAgICovCisgICAgd3JpdGVTZXRCZWdpbjogZnVuY3Rpb24oZWxlbVR5cGUsIHNpemUpIHsKKyAgICAgICAgdGhpcy50cG9zLnB1c2godGhpcy50c3RhY2subGVuZ3RoKTsKKyAgICAgICAgdGhpcy50c3RhY2sucHVzaChbVGhyaWZ0LlByb3RvY29sLlR5cGVbZWxlbVR5cGVdLCBzaXplXSk7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIFNlcmlhbGl6ZXMgdGhlIGVuZCBvZiBhIHNldC4KKyAgICAgKi8KKyAgICB3cml0ZVNldEVuZDogZnVuY3Rpb24oKSB7CisgICAgICAgIHZhciBwID0gdGhpcy50cG9zLnBvcCgpOworCisgICAgICAgIHdoaWxlICh0aGlzLnRzdGFjay5sZW5ndGggPiBwICsgMSkgeworICAgICAgICAgICAgdmFyIHRtcFZhbCA9IHRoaXMudHN0YWNrW3AgKyAxXTsKKyAgICAgICAgICAgIHRoaXMudHN0YWNrLnNwbGljZShwICsgMSwgMSk7CisgICAgICAgICAgICB0aGlzLnRzdGFja1twXS5wdXNoKHRtcFZhbCk7CisgICAgICAgIH0KKworICAgICAgICB0aGlzLnRzdGFja1twXSA9ICdbJyArIHRoaXMudHN0YWNrW3BdLmpvaW4oJywnKSArICddJzsKKyAgICB9LAorCisgICAgLyoqIFNlcmlhbGl6ZXMgYSBib29sZWFuICovCisgICAgd3JpdGVCb29sOiBmdW5jdGlvbih2YWx1ZSkgeworICAgICAgICB0aGlzLnRzdGFjay5wdXNoKHZhbHVlID8gMSA6IDApOworICAgIH0sCisKKyAgICAvKiogU2VyaWFsaXplcyBhIG51bWJlciAqLworICAgIHdyaXRlQnl0ZTogZnVuY3Rpb24oaTgpIHsKKyAgICAgICAgdGhpcy50c3RhY2sucHVzaChpOCk7CisgICAgfSwKKworICAgIC8qKiBTZXJpYWxpemVzIGEgbnVtYmVyICovCisgICAgd3JpdGVJMTY6IGZ1bmN0aW9uKGkxNikgeworICAgICAgICB0aGlzLnRzdGFjay5wdXNoKGkxNik7CisgICAgfSwKKworICAgIC8qKiBTZXJpYWxpemVzIGEgbnVtYmVyICovCisgICAgd3JpdGVJMzI6IGZ1bmN0aW9uKGkzMikgeworICAgICAgICB0aGlzLnRzdGFjay5wdXNoKGkzMik7CisgICAgfSwKKworICAgIC8qKiBTZXJpYWxpemVzIGEgbnVtYmVyICovCisgICAgd3JpdGVJNjQ6IGZ1bmN0aW9uKGk2NCkgeworICAgICAgICB0aGlzLnRzdGFjay5wdXNoKGk2NCk7CisgICAgfSwKKworICAgIC8qKiBTZXJpYWxpemVzIGEgbnVtYmVyICovCisgICAgd3JpdGVEb3VibGU6IGZ1bmN0aW9uKGRibCkgeworICAgICAgICB0aGlzLnRzdGFjay5wdXNoKGRibCk7CisgICAgfSwKKworICAgIC8qKiBTZXJpYWxpemVzIGEgc3RyaW5nICovCisgICAgd3JpdGVTdHJpbmc6IGZ1bmN0aW9uKHN0cikgeworICAgICAgICAvLyBXZSBkbyBub3QgZW5jb2RlIHVyaSBjb21wb25lbnRzIGZvciB3aXJlIHRyYW5zZmVyOgorICAgICAgICBpZiAoc3RyID09PSBudWxsKSB7CisgICAgICAgICAgICB0aGlzLnRzdGFjay5wdXNoKG51bGwpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gY29uY2F0IG1heSBiZSBzbG93ZXIgdGhhbiBidWlsZGluZyBhIGJ5dGUgYnVmZmVyCisgICAgICAgICAgICB2YXIgZXNjYXBlZFN0cmluZyA9ICcnOworICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICB2YXIgY2ggPSBzdHIuY2hhckF0KGkpOyAgICAgIC8vIGEgc2luZ2xlIGRvdWJsZSBxdW90ZTogIgorICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1wiJykgeworICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9ICdcXFwiJzsgLy8gd3JpdGUgb3V0IGFzOiBcIgorICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcXCcpIHsgICAgLy8gYSBzaW5nbGUgYmFja3NsYXNoCisgICAgICAgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gJ1xcXFwnOyAvLyB3cml0ZSBvdXQgYXMgZG91YmxlIGJhY2tzbGFzaAorICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcYicpIHsgICAgLy8gYSBzaW5nbGUgYmFja3NwYWNlOiBpbnZpc2libGUKKyAgICAgICAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxiJzsgIC8vIHdyaXRlIG91dCBhczogXGIiCisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xmJykgeyAgICAvLyBhIHNpbmdsZSBmb3JtZmVlZDogaW52aXNpYmxlCisgICAgICAgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gJ1xcZic7ICAvLyB3cml0ZSBvdXQgYXM6IFxmIgorICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcbicpIHsgICAgLy8gYSBzaW5nbGUgbmV3bGluZTogaW52aXNpYmxlCisgICAgICAgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gJ1xcbic7ICAvLyB3cml0ZSBvdXQgYXM6IFxuIgorICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdccicpIHsgICAgLy8gYSBzaW5nbGUgcmV0dXJuOiBpbnZpc2libGUKKyAgICAgICAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxyJzsgIC8vIHdyaXRlIG91dCBhczogXHIiCisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1x0JykgeyAgICAvLyBhIHNpbmdsZSB0YWI6IGludmlzaWJsZQorICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9ICdcXHQnOyAgLy8gd3JpdGUgb3V0IGFzOiBcdCIKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9IGNoOyAgICAgLy8gRWxzZSBpdCBuZWVkIG5vdCBiZSBlc2NhcGVkCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdGhpcy50c3RhY2sucHVzaCgnIicgKyBlc2NhcGVkU3RyaW5nICsgJyInKTsKKyAgICAgICAgfQorICAgIH0sCisKKyAgICAvKiogU2VyaWFsaXplcyBhIHN0cmluZyAqLworICAgIHdyaXRlQmluYXJ5OiBmdW5jdGlvbihiaW5hcnkpIHsKKyAgICAgICAgdmFyIHN0ciA9ICcnOworICAgICAgICBpZiAodHlwZW9mIGJpbmFyeSA9PSAnc3RyaW5nJykgeworICAgICAgICAgICAgc3RyID0gYmluYXJ5OworICAgICAgICB9IGVsc2UgaWYgKGJpbmFyeSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkpIHsKKyAgICAgICAgICAgIHZhciBhcnIgPSBiaW5hcnk7CisgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyci5sZW5ndGg7ICsraSkgeworICAgICAgICAgICAgICAgIHN0ciArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGFycltpXSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCd3cml0ZUJpbmFyeSBvbmx5IGFjY2VwdHMgU3RyaW5nIG9yIFVpbnQ4QXJyYXkuJyk7CisgICAgICAgIH0KKyAgICAgICAgdGhpcy50c3RhY2sucHVzaCgnIicgKyBidG9hKHN0cikgKyAnIicpOworICAgIH0sCisKKyAgIC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nJlYWRBbGwoKSk7CisgICAgICAgIH0KKworICAgICAgICB2YXIgciA9IHt9OworICAgICAgICB2YXIgdmVyc2lvbiA9IHRoaXMucm9iai5zaGlmdCgpOworCisgICAgICAgIGlmICh2ZXJzaW9uICE9IFRocmlmdC5Qcm90b2NvbC5WZXJzaW9uKSB7CisgICAgICAgICAgICB0aHJvdyAnV3JvbmcgdGhyaWZ0IHByb3RvY29sIHZlcnNpb246ICcgKyB2ZXJzaW9uOworICAgICAgICB9CisKKyAgICAgICAgci5mbmFtZSA9IHRoaXMucm9iai5zaGlmdCgpOworICAgICAgICByLm10eXBlID0gdGhpcy5yb2JqLnNoaWZ0KCk7CisgICAgICAgIHIucnNlcWlkID0gdGhpcy5yb2JqLnNoaWZ0KCk7CisKKworICAgICAgICAvL2dldCB0byB0aGUgbWFpbiBvYmoKKyAgICAgICAgdGhpcy5yc3RhY2sucHVzaCh0aGlzLnJvYmouc2hpZnQoKSk7CisKKyAgICAgICAgcmV0dXJuIHI7CisgICAgfSwKKworICAgIC8qKiBEZXNlcmlhbGl6ZXMgdGhlIGVuZCBvZiBhIG1lc3NhZ2UuICovCisgICAgcmVhZE1lc3NhZ2VFbmQ6IGZ1bmN0aW9uKCkgeworICAgIH0sCisKKyAgICAvKioKKyAgICAgKiBEZXNlcmlhbGl6ZXMgdGhlIGJlZ2lubmluZyBvZiBhIHN0cnVjdC4KKyAgICAgKiBAcGFyYW0ge3N0cmluZ30gW25hbWVdIC0gVGhlIG5hbWUgb2YgdGhlIHN0cnVjdCAoaWdub3JlZCkKKyAgICAgKiBAcmV0dXJucyB7b2JqZWN0fSAtIEFuIG9iamVjdCB3aXRoIGFuIGVtcHR5IHN0cmluZyBmbmFtZSBwcm9wZXJ0eQorICAgICAqLworICAgIHJlYWRTdHJ1Y3RCZWdpbjogZnVuY3Rpb24obmFtZSkgeworICAgICAgICB2YXIgciA9IHt9OworICAgICAgICByLmZuYW1lID0gJyc7CisKKyAgICAgICAgLy9pbmNhc2UgdGhpcyBpcyBhbiBhcnJheSBvZiBzdHJ1Y3RzCisgICAgICAgIGlmICh0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXSBpbnN0YW5jZW9mIEFycmF5KSB7CisgICAgICAgICAgICB0aGlzLnJzdGFjay5wdXNoKHRoaXMucnN0YWNrW3RoaXMucnN0YWNrLmxlbmd0aCAtIDFdLnNoaWZ0KCkpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHI7CisgICAgfSwKKworICAgIC8qKiBEZXNlcmlhbGl6ZXMgdGhlIGVuZCBvZiBhIHN0cnVjdC4gKi8KKyAgICByZWFkU3RydWN0RW5kOiBmdW5jdGlvbigpIHsKKyAgICAgICAgaWYgKHRoaXMucnN0YWNrW3RoaXMucnN0YWNrLmxlbmd0aCAtIDJdIGluc3RhbmNlb2YgQXJyYXkpIHsKKyAgICAgICAgICAgIHRoaXMucnN0YWNrLnBvcCgpOworICAgICAgICB9CisgICAgfSwKKworICAgIC8qKgorICAgICAgIEBjbGFzcworICAgICAgIEBuYW1lIEFub25SZWFkRmllbGRCZWdpblJldHVybgorICAgICAgIEBwcm9wZXJ0eSB7c3RyaW5nfSBmbmFtZSAtIFRoZSBuYW1lIG9mIHRoZSBmaWVsZCAoYWx3YXlzICcnKS4KKyAgICAgICBAcHJvcGVydHkge1RocmlmdC5UeXBlfSBmdHlwZSAtIFRoZSBkYXRhIHR5cGUgb2YgdGhlIGZpZWxkLgorICAgICAgIEBwcm9wZXJ0eSB7bnVtYmVyfSBmaWQgLSBUaGUgdW5pcXVlIGlkZW50aWZpZXIgb2YgdGhlIGZpZWxkLgorICAgICAqLworICAgIC8qKgorICAgICAqIERlc2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mIGEgZmllbGQuCisgICAgICogQHJldHVybnMge0Fub25SZWFkRmllbGRCZWdpblJldHVybn0KKyAgICAgKi8KKyAgICByZWFkRmllbGRCZWdpbjogZnVuY3Rpb24oKSB7CisgICAgICAgIHZhciByID0ge307CisKKyAgICAgICAgdmFyIGZpZCA9IC0xOworICAgICAgICB2YXIgZnR5cGUgPSBUaHJpZnQuVHlwZS5TVE9QOworCisgICAgICAgIC8vZ2V0IGEgZmllbGRJZAorICAgICAgICBmb3IgKHZhciBmIGluICh0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXSkpIHsKKyAgICAgICAgICAgIGlmIChmID09PSBudWxsKSB7CisgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaWQgPSBwYXJzZUludChmLCAxMCk7CisgICAgICAgICAgICB0aGlzLnJwb3MucHVzaCh0aGlzLnJzdGFjay5sZW5ndGgpOworCisgICAgICAgICAgICB2YXIgZmllbGQgPSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXVtmaWRdOworCisgICAgICAgICAgICAvL3JlbW92ZSBzbyB3ZSBkb24ndCBzZWUgaXQgYWdhaW4KKyAgICAgICAgICAgIGRlbGV0ZSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXVtmaWRdOworCisgICAgICAgICAgICB0aGlzLnJzdGFjay5wdXNoKGZpZWxkKTsKKworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZmlkICE9IC0xKSB7CisKKyAgICAgICAgICAgIC8vc2hvdWxkIG9ubHkgYmUgMSBvZiB0aGVzZSBidXQgdGhpcyBpcyB0aGUgb25seQorICAgICAgICAgICAgLy93YXkgdG8gbWF0Y2ggYSBrZXkKKyAgICAgICAgICAgIGZvciAodmFyIGkgaW4gKHRoaXMucnN0YWNrW3RoaXMucnN0YWNrLmxlbmd0aCAtIDFdKSkgeworICAgICAgICAgICAgICAgIGlmIChUaHJpZnQuUHJvdG9jb2wuUlR5cGVbaV0gPT09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZnR5cGUgPSBUaHJpZnQuUHJvdG9jb2wuUlR5cGVbaV07CisgICAgICAgICAgICAgICAgdGhpcy5yc3RhY2tbdGhpcy5yc3RhY2subGVuZ3RoIC0gMV0gPQorICAgICAgICAgICAgICAgICAgICB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXVtpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHIuZm5hbWUgPSAnJzsKKyAgICAgICAgci5mdHlwZSA9IGZ0eXBlOworICAgICAgICByLmZpZCA9IGZpZDsKKworICAgICAgICByZXR1cm4gcjsKKyAgICB9LAorCisgICAgLyoqIERlc2VyaWFsaXplcyB0aGUgZW5kIG9mIGEgZmllbGQuICovCisgICAgcmVhZEZpZWxkRW5kOiBmdW5jdGlvbigpIHsKKyAgICAgICAgdmFyIHBvcyA9IHRoaXMucnBvcy5wb3AoKTsKKworICAgICAgICAvL2dldCBiYWNrIHRvIHRoZSByaWdodCBwbGFjZSBpbiB0aGUgc3RhY2sKKyAgICAgICAgd2hpbGUgKHRoaXMucnN0YWNrLmxlbmd0aCA+IHBvcykgeworICAgICAgICAgICAgdGhpcy5yc3RhY2sucG9wKCk7CisgICAgICAgIH0KKworICAgIH0sCisKKyAgICAvKioKKyAgICAgICBAY2xhc3MKKyAgICAgICBAbmFtZSBBbm9uUmVhZE1hcEJlZ2luUmV0dXJuCisgICAgICAgQHByb3BlcnR5IHtUaHJpZnQuVHlwZX0ga3R5cGUgLSBUaGUgZGF0YSB0eXBlIG9mIHRoZSBrZXkuCisgICAgICAgQHByb3BlcnR5IHtUaHJpZnQuVHlwZX0gdnR5cGUgLSBUaGUgZGF0YSB0eXBlIG9mIHRoZSB2YWx1ZS4KKyAgICAgICBAcHJvcGVydHkge251bWJlcn0gc2l6ZSAtIFRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhlIG1hcC4KKyAgICAgKi8KKyAgICAvKioKKyAgICAgKiBEZXNlcmlhbGl6ZXMgdGhlIGJlZ2lubmluZyBvZiBhIG1hcC4KKyAgICAgKiBAcmV0dXJucyB7QW5vblJlYWRNYXBCZWdpblJldHVybn0KKyAgICAgKi8KKyAgICByZWFkTWFwQmVnaW46IGZ1bmN0aW9uKCkgeworICAgICAgICB2YXIgbWFwID0gdGhpcy5yc3RhY2sucG9wKCk7CisgICAgICAgIHZhciBmaXJzdCA9IG1hcC5zaGlmdCgpOworICAgICAgICBpZiAoZmlyc3QgaW5zdGFuY2VvZiBBcnJheSkgeworICAgICAgICAgIHRoaXMucnN0YWNrLnB1c2gobWFwKTsKKyAgICAgICAgICBtYXAgPSBmaXJzdDsKKyAgICAgICAgICBmaXJzdCA9IG1hcC5zaGlmdCgpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHIgPSB7fTsKKyAgICAgICAgci5rdHlwZSA9IFRocmlmdC5Qcm90b2NvbC5SVHlwZVtmaXJzdF07CisgICAgICAgIHIudnR5cGUgPSBUaHJpZnQuUHJvdG9jb2wuUlR5cGVbbWFwLnNoaWZ0KCldOworICAgICAgICByLnNpemUgPSBtYXAuc2hpZnQoKTsKKworCisgICAgICAgIHRoaXMucnBvcy5wdXNoKHRoaXMucnN0YWNrLmxlbmd0aCk7CisgICAgICAgIHRoaXMucnN0YWNrLnB1c2gobWFwLnNoaWZ0KCkpOworCisgICAgICAgIHJldHVybiByOworICAgIH0sCisKKyAgICAvKiogRGVzZXJpYWxpemVzIHRoZSBlbmQgb2YgYSBtYXAuICovCisgICAgcmVhZE1hcEVuZDogZnVuY3Rpb24oKSB7CisgICAgICAgIHRoaXMucmVhZEZpZWxkRW5kKCk7CisgICAgfSwKKworICAgIC8qKgorICAgICAgIEBjbGFzcworICAgICAgIEBuYW1lIEFub25SZWFkQ29sQmVnaW5SZXR1cm4KKyAgICAgICBAcHJvcGVydHkge1RocmlmdC5UeXBlfSBldHlwZSAtIFRoZSBkYXRhIHR5cGUgb2YgdGhlIGVsZW1lbnQuCisgICAgICAgQHByb3BlcnR5IHtudW1iZXJ9IHNpemUgLSBUaGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoZSBjb2xsZWN0aW9uLgorICAgICAqLworICAgIC8qKgorICAgICAqIERlc2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mIGEgbGlzdC4KKyAgICAgKiBAcmV0dXJucyB7QW5vblJlYWRDb2xCZWdpblJldHVybn0KKyAgICAgKi8KKyAgICByZWFkTGlzdEJlZ2luOiBmdW5jdGlvbigpIHsKKyAgICAgICAgdmFyIGxpc3QgPSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXTsKKworICAgICAgICB2YXIgciA9IHt9OworICAgICAgICByLmV0eXBlID0gVGhyaWZ0LlByb3RvY29sLlJUeXBlW2xpc3Quc2hpZnQoKV07CisgICAgICAgIHIuc2l6ZSA9IGxpc3Quc2hpZnQoKTsKKworICAgICAgICB0aGlzLnJwb3MucHVzaCh0aGlzLnJzdGFjay5sZW5ndGgpOworICAgICAgICB0aGlzLnJzdGFjay5wdXNoKGxpc3Quc2hpZnQoKSk7CisKKyAgICAgICAgcmV0dXJuIHI7CisgICAgfSwKKworICAgIC8qKiBEZXNlcmlhbGl6ZXMgdGhlIGVuZCBvZiBhIGxpc3QuICovCisgICAgcmVhZExpc3RFbmQ6IGZ1bmN0aW9uKCkgeworICAgICAgICB2YXIgcG9zID0gdGhpcy5ycG9zLnBvcCgpIC0gMjsKKyAgICAgICAgdmFyIHN0ID0gdGhpcy5yc3RhY2s7CisgICAgICAgIHN0LnBvcCgpOworICAgICAgICBpZiAoc3QgaW5zdGFuY2VvZiBBcnJheSAmJiBzdC5sZW5ndGggPiBwb3MgJiYgc3RbcG9zXS5sZW5ndGggPiAwKSB7CisgICAgICAgICAgc3QucHVzaChzdFtwb3NdLnNoaWZ0KCkpOworICAgICAgICB9CisgICAgfSwKKworICAgIC8qKgorICAgICAqIERlc2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mI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1cm4gdGhpcy5yZWFkSTMyKCk7CisgICAgfSwKKworICAgIC8qKiBSZXR1cm5zIHRoZSBhbiBvYmplY3Qgd2l0aCBhIHZhbHVlIHByb3BlcnR5IHNldCB0byB0aGUKKyAgICAgICAgbmV4dCB2YWx1ZSBmb3VuZCBpbiB0aGUgcHJvdG9jb2wgYnVmZmVyICovCisgICAgcmVhZEkxNjogZnVuY3Rpb24oKSB7CisgICAgICAgIHJldHVybiB0aGlzLnJlYWRJMzIoKTsKKyAgICB9LAorCisgICAgLyoqIFJldHVybnMgdGhlIGFuIG9iamVjdCB3aXRoIGEgdmFsdWUgcHJvcGVydHkgc2V0IHRvIHRoZQorICAgICAgICBuZXh0IHZhbHVlIGZvdW5kIGluIHRoZSBwcm90b2NvbCBidWZmZXIgKi8KKyAgICByZWFkSTMyOiBmdW5jdGlvbihmKSB7CisgICAgICAgIGlmIChmID09PSB1bmRlZmluZWQpIHsKKyAgICAgICAgICAgIGYgPSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXTsKKyAgICAgICAgfQorCisgICAgICAgIHZhciByID0ge307CisKKyAgICAgICAgaWYgKGYgaW5zdGFuY2VvZiBBcnJheSkgeworICAgICAgICAgICAgaWYgKGYubGVuZ3RoID09PSAwKSB7CisgICAgICAgICAgICAgICAgci52YWx1ZSA9IHVuZGVmaW5lZDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKCFmLmlzUmV2ZXJzZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgZi5yZXZlcnNlKCk7CisgICAgICAgICAgICAgICAgICAgIGYuaXNSZXZlcnNlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHIudmFsdWUgPSBmLnBvcCgpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKGYgaW5zdGFuY2VvZiBPYmplY3QpIHsKKyAgICAgICAgICAgZm9yICh2YXIgaSBpbiBmKSB7CisgICAgICAgICAgICAgICAgaWYgKGkgPT09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0aGlzLnJzdGFjay5wdXNoKGZbaV0pOworICAgICAgICAgICAgICAgIGRlbGV0ZSBmW2ldOworCisgICAgICAgICAgICAgICAgci52YWx1ZSA9IGk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHIudmFsdWUgPSBmOworICAgICAgICAgICAgdGhpcy5yc3RhY2sucG9wKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gcjsKKyAgICB9LAorCisgICAgLyoqIFJldHVybnMgdGhlIGFuIG9iamVjdCB3aXRoIGEgdmFsdWUgcHJvcGVydHkgc2V0IHRvIHRoZQorICAgICAgICBuZXh0IHZhbHVlIGZvdW5kIGluIHRoZSBwcm90b2NvbCBidWZmZXIgKi8KKyAgICByZWFkSTY0OiBmdW5jdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIHRoaXMucmVhZEkzMigpOworICAgIH0sCisKKyAgICAvKiogUmV0dXJucyB0aGUgYW4gb2JqZWN0IHdpdGggYSB2YWx1ZSBwcm9wZXJ0eSBzZXQgdG8gdGhlCisgICAgICAgIG5leHQgdmFsdWUgZm91bmQgaW4gdGhlIHByb3RvY29sIGJ1ZmZlciAqLworICAgIHJlYWREb3VibGU6IGZ1bmN0aW9uKCkgeworICAgICAgICByZXR1cm4gdGhpcy5yZWFkSTMyKCk7CisgICAgfSwKKworICAgIC8qKiBSZXR1cm5zIHRoZSBhbiBvYmplY3Qgd2l0aCBhIHZhbHVlIHByb3BlcnR5IHNldCB0byB0aGUKKyAgICAgICAgbmV4dCB2YWx1ZSBmb3VuZCBpbiB0aGUgcHJvdG9jb2wgYnVmZmVyICovCisgICAgcmVhZFN0cmluZzogZnVuY3Rpb24oKSB7CisgICAgICAgIHZhciByID0gdGhpcy5yZWFkSTMyKCk7CisgICAgICAgIHJldHVybiByOworICAgIH0sCisKKyAgICAvKiogUmV0dXJucyB0aGUgYW4gb2JqZWN0IHdpdGggYSB2YWx1ZSBwcm9wZXJ0eSBzZXQgdG8gdGhlCisgICAgICAgIG5leHQgdmFsdWUgZm91bmQgaW4gdGhlIHByb3RvY29sIGJ1ZmZlciAqLworICAgIHJlYWRCaW5hcnk6IGZ1bmN0aW9uKCkgeworICAgICAgICB2YXIgciA9IHRoaXMucmVhZEkzMigpOworICAgICAgICByLnZhbHVlID0gYXRvYihyLnZhbHVlKTsKKyAgICAgICAgcmV0dXJuIHI7CisgICAgfSwKKworICAgIC8qKgorICAgICAqIE1ldGhvZCB0byBhcmJpdHJhcmlseSBza2lwIG92ZXIgZGF0YSAqLworICAgIHNraXA6IGZ1bmN0aW9uKHR5cGUpIHsKKyAgICAgICAgdmFyIHJldCwgaTsKKyAgICAgICAgc3dpdGNoICh0eXBlKSB7CisgICAgICAgICAgICBjYXNlIFRocmlmdC5UeXBlLlNUT1A6CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisKKyAgICAgICAgICAgIGNhc2UgVGhyaWZ0LlR5cGUuQk9PTDoKKyAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZWFkQm9vbCgpOworCisgICAgICAgICAgICBjYXNlIFRocmlmdC5UeXBlLkJZVEU6CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVhZEJ5dGUoKTsKKworICAgICAgICAgICAgY2FzZSBUaHJpZnQuVHlwZS5JMTY6CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVhZEkxNigpOworCisgICAgICAgICAgICBjYXNlIFRocmlmdC5UeXBlLkkzMjoKKyAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZWFkSTMyKCk7CisKKyAgICAgICAgICAgIGNhc2UgVGhyaWZ0LlR5cGUuSTY0OgorICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlYWRJNjQoKTsKKworICAgICAgICAgICAgY2FzZSBUaHJpZnQuVHlwZS5ET1VCTEU6CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVhZERvdWJsZSgpOworCisgICAgICAgICAgICBjYXNlIFRocmlmdC5UeXBlLlNUUklORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZWFkU3RyaW5nKCk7CisKKyAgICAgICAgICAgIGNhc2UgVGhyaWZ0LlR5cGUuU1RSVUNUOgorICAgICAgICAgICAgICAgIHRoaXMucmVhZFN0cnVjdEJlZ2luKCk7CisgICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gdGhpcy5yZWFkRmllbGRCZWdpbigpOworICAgICAgICAgICAgICAgICAgICBpZiAocmV0LmZ0eXBlID09IFRocmlmdC5UeXBlLlNUT1ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRoaXMuc2tpcChyZXQuZnR5cGUpOworICAgICAgICAgICAgICAgICAgICB0aGlzLnJlYWRGaWVsZEVuZCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0aGlzLnJlYWRTdHJ1Y3RFbmQoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKworICAgICAgICAgICAgY2FzZSBUaHJpZnQuVHlwZS5NQVA6CisgICAgICAgICAgICAgICAgcmV0ID0gdGhpcy5yZWFkTWFwQmVnaW4oKTsKKyAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgcmV0LnNpemU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnJzdGFjay5sZW5ndGggPiB0aGlzLnJwb3NbdGhpcy5ycG9zLmxlbmd0aCAtIDFdICsgMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucnN0YWNrLnBvcCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRoaXMuc2tpcChyZXQua3R5cGUpOworICAgICAgICAgICAgICAgICAgICB0aGlzLnNraXAocmV0LnZ0eXBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdGhpcy5yZWFkTWFwRW5kKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisKKyAgICAgICAgICAgIGNhc2UgVGhyaWZ0LlR5cGUuU0VUOgorICAgICAgICAgICAgICAgIHJldCA9IHRoaXMucmVhZFNldEJlZ2luKCk7CisgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHJldC5zaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5za2lwKHJldC5ldHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRoaXMucmVhZFNldEVuZCgpOworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworCisgICAgICAgICAgICBjYXNlIFRocmlmdC5UeXBlLkxJU1Q6CisgICAgICAgICAgICAgICAgcmV0ID0gdGhpcy5yZWFkTGlzdEJlZ2luKCk7CisgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHJldC5zaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5za2lwKHJldC5ldHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRoaXMucmVhZExpc3RFbmQoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVGhyaWZ0LlRQcm90b2NvbEV4Y2VwdGlvbihUaHJpZnQuVFByb3RvY29sRXhjZXB0aW9uVHlwZS5JTlZBTElEX0RBVEEp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2wuQ2xpZW50OworICAgIH0KKyAgICB2YXIgc2VsZiA9IHRoaXM7CisgICAgU0NsLnByb3RvdHlwZS5uZXdfc2VxaWQgPSBmdW5jdGlvbigpIHsKKyAgICAgICAgc2VsZi5zZXFpZCArPSAxOworICAgICAgICByZXR1cm4gc2VsZi5zZXFpZDsKKyAgICB9OworICAgIHZhciBjbGllbnQgPSBuZXcgU0NsKG5ldyBUaHJpZnQuTXVsdGlwbGV4UHJvdG9jb2woc2VydmljZU5hbWUsIHRyYW5zcG9ydCkpOworCisgICAgcmV0dXJuIGNsaWVudDsKK307CisKKworCit2YXIgY29weUxpc3QsIGNvcHlNYXA7CisKK2NvcHlMaXN0ID0gZnVuY3Rpb24obHN0LCB0eXBlcykgeworCisgIGlmICghbHN0KSB7cmV0dXJuIGxzdDsgfQorCisgIHZhciB0eXBlOworCisgIGlmICh0eXBlcy5zaGlmdCA9PT0gdW5kZWZpbmVkKSB7CisgICAgdHlwZSA9IHR5cGVzOworICB9CisgIGVsc2UgeworICAgIHR5cGUgPSB0eXBlc1swXTsKKyAgfQorICB2YXIgVHlwZSA9IHR5cGU7CisKKyAgdmFyIGxlbiA9IGxzdC5sZW5ndGgsIHJlc3VsdCA9IFtdLCBpLCB2YWw7CisgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgIHZhbCA9IGxzdFtpXTsKKyAgICBpZiAodHlwZSA9PT0gbnVsbCkgeworICAgICAgcmVzdWx0LnB1c2godmFsKTsKKyAgICB9CisgICAgZWxzZSBpZiAodHlwZSA9PT0gY29weU1hcCB8fCB0eXBlID09PSBjb3B5TGlzdCkgeworICAgICAgcmVzdWx0LnB1c2godHlwZSh2YWwsIHR5cGVzLnNsaWNlKDEpKSk7CisgICAgfQorICAgIGVsc2UgeworICAgICAgcmVzdWx0LnB1c2gobmV3IFR5cGUodmFsKSk7CisgICAgfQorICB9CisgIHJldHVybiByZXN1bHQ7Cit9OworCitjb3B5TWFwID0gZnVuY3Rpb24ob2JqLCB0eXBlcykgeworCisgIGlmICghb2JqKSB7cmV0dXJuIG9iajsgfQorCisgIHZhciB0eXBlOworCisgIGlmICh0eXBlcy5zaGlmdCA9PT0gdW5kZWZpbmVkKSB7CisgICAgdHlwZSA9IHR5cGVzOworICB9CisgIGVsc2UgeworICAgIHR5cGUgPSB0eXBlc1swXTsKKyAgfQorICB2YXIgVHlwZSA9IHR5cGU7CisKKyAgdmFyIHJlc3VsdCA9IHt9LCB2YWw7CisgIGZvciAodmFyIHByb3AgaW4gb2JqKSB7CisgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShwcm9wKSkgeworICAgICAgdmFsID0gb2JqW3Byb3BdOworICAgICAgaWYgKHR5cGUgPT09IG51bGwpIHsKKyAgICAgICAgcmVzdWx0W3Byb3BdID0gdmFsOworICAgICAgfQorICAgICAgZWxzZSBpZiAodHlwZSA9PT0gY29weU1hcCB8fCB0eXBlID09PSBjb3B5TGlzdCkgeworICAgICAgICByZXN1bHRbcHJvcF0gPSB0eXBlKHZhbCwgdHlwZXMuc2xpY2UoMSkpOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHJlc3VsdFtwcm9wXSA9IG5ldyBUeXBlKHZhbCk7CisgICAgICB9CisgICAgfQorICB9CisgIHJldHVybiByZXN1bHQ7Cit9OworCitUaHJpZnQuY29weU1hcCA9IGNvcHlNYXA7CitUaHJpZnQuY29weUxpc3QgPSBjb3B5TGlzdDsKZGlmZiAtLWdpdCBhL2xpYi9qcy90ZXN0L1JFQURNRS5tZCBiL2xpYi9qcy90ZXN0L1JFQURNRS5tZApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi45YWQxNDBlCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2pzL3Rlc3QvUkVBRE1FLm1kCkBAIC0wLDAgKzEsNjggQEAKK1RocmlmdCBKYXZhc2NyaXB0IExpYnJhcnkKKz09PT09PT09PT09PT09PT09PT09PT09PT0KK1RoaXMgYnJvd3N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J2InfSksCisgICAgICBuZXcgU2ltcGxlKHt2YWx1ZTogJ2MnfSkKKyAgICBdLAorCisgICAgc3RydWN0X3NldF9maWVsZDogWworICAgICAgbmV3IFNpbXBsZSh7dmFsdWU6ICdkJ30pLAorICAgICAgbmV3IFNpbXBsZSh7dmFsdWU6ICdlJ30pCisgICAgXSwKKworICAgIHN0cnVjdF9tYXBfZmllbGQ6IHsKKyAgICAgIEE6IG5ldyBTaW1wbGUoe3ZhbHVlOiAnZid9KSwKKyAgICAgIEI6IG5ldyBTaW1wbGUoe3ZhbHVlOiAnZyd9KQorICAgIH0sCisKKyAgICBzdHJ1Y3RfbmVzdGVkX2NvbnRhaW5lcnNfZmllbGQ6IFsKKyAgICAgIFsKKyAgICAgICAgeworICAgICAgICAgIEM6IFsKKyAgICAgICAgICAgIG5ldyBTaW1wbGUoe3ZhbHVlOiAnaCd9KSwKKyAgICAgICAgICAgIG5ldyBTaW1wbGUoe3ZhbHVlOiAnaSd9KQorICAgICAgICAgIF0KKyAgICAgICAgfQorICAgICAgXQorICAgIF0sCisKKworICAgIHN0cnVjdF9uZXN0ZWRfY29udGFpbmVyc19maWVsZDI6IHsKKyAgICAgIEQ6IFsKKyAgICAgICAgeworICAgICAgICAgIERBOiBuZXcgU2ltcGxlKHt2YWx1ZTogJ2onfSkKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgIERCOiBuZXcgU2ltcGxlKHt2YWx1ZTogJ2snfSkKKyAgICAgICAgfQorICAgICAgXQorICAgIH0sCisKKyAgICBsaXN0X29mX2xpc3RfZmllbGQ6IFsKKyAgICAgICBbJ29uZScsICd0d28nXSwKKyAgICAgICBbJ3RocmVlJywgJ2ZvdXInXSwKKyAgICAgICBbJ2ZpdmUnLCAnc2l4J10KKyAgICBdCisgIH0KKyAgKTsKK30KKworCitmdW5jdGlvbiBjcmVhdGVKc09iaigpIHsKKworICByZXR1cm4geworCisgICAgc3RydWN0X2ZpZWxkOiB7dmFsdWU6ICdhJ30sCisKKyAgICBzdHJ1Y3RfbGlzdF9maWVsZDogWworICAgICAge3ZhbHVlOiAnYid9LAorICAgICAge3ZhbHVlOiAnYyd9CisgICAgXSwKKworICAgIHN0cnVjdF9zZXRfZmllbGQ6IFsKKyAgICAgIHt2YWx1ZTogJ2QnfSwKKyAgICAgIHt2YWx1ZTogJ2UnfQorICAgIF0sCisKKyAgICBzdHJ1Y3RfbWFwX2ZpZWxkOiB7CisgICAgICBBOiB7dmFsdWU6ICdmJ30sCisgICAgICBCOiB7dmFsdWU6ICdnJ30KKyAgICB9LAorCisgICAgc3RydWN0X25lc3RlZF9jb250YWluZXJzX2ZpZWxkOiBbCisgICAgICBbCisgICAgICAgIHsKKyAgICAgICAgICBDOiBbCisgICAgICAgICAgICB7dmFsdWU6ICdoJ30sCisgICAgICAgICAgICB7dmFsdWU6ICdpJ30KKyAgICAgICAgICBdCisgICAgICAgIH0KKyAgICAgIF0KKyAgICBdLAorCisgICAgc3RydWN0X25lc3RlZF9jb250YWluZXJzX2ZpZWxkMjogeworICAgICAgRDogWworICAgICAgICB7CisgICAgICAgICAgREE6IHt2YWx1ZTogJ2onfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgREI6IHt2YWx1ZTogJ2snfQorICAgICAgICB9CisgICAgICBdCisgICAgfSwKKworICAgIGxpc3Rfb2ZfbGlzdF9maWVsZDogWworICAgICAgWydvbmUnLCAndHdvJ10sCisgICAgICBbJ3RocmVlJywgJ2ZvdXInXSwKKyAgICAgIFsnZml2ZScsICdzaXgnXQorICAgXQorICB9OworfQorCisKK2Z1bmN0aW9uIGFzc2VydFZhbHVlcyhvYmosIGFzc2VydCkgeworICAgIGFzc2VydC5lcXVhbChvYmouc3RydWN0X2ZpZWxkLnZhbHVlLCAnYScpOworICAgIGFzc2VydC5lcXVhbChvYmouc3RydWN0X2xpc3RfZmllbGRbMF0udmFsdWUsICdiJyk7CisgICAgYXNzZXJ0LmVxdWFsKG9iai5zdHJ1Y3RfbGlzdF9maW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SwgYikgeworICAgIGlmIChhICE9PSBiKSB7CisgICAgICBjb25zb2xlLmxvZygnKioqIEZBSUxFRCAqKionKTsKKyAgICAgIHRocm93IG5ldyBFcnJvcigpOworICAgIH0KKyAgfTsKKyAgdmFyIHRlc3QgPSBmdW5jdGlvbihuYW1lLCBmKSB7CisgICAgY29uc29sZS5sb2coJ1RFU1QgOiAnICsgbmFtZSk7CisgICAgZigpOworICAgIGNvbnNvbGUubG9nKCdPS1xuJyk7CisgIH07CisKKyAgdmFyIHBhcnNlQXJncyA9IGZ1bmN0aW9uKGFyZ3MpIHsKKyAgICB2YXIgc2tpcHMgPSBbCisgICAgICAnLS10cmFuc3BvcnQ9aHR0cCcsCisgICAgICAnLS1wcm90b2NvbD1qc29uJworICAgIF07CisgICAgdmFyIG9wdHMgPSB7CisgICAgICBwb3J0OiAnOTA5MCcKKyAgICAgIC8vIHByb3RvY29sOiAnanNvbicsCisgICAgfTsKKyAgICB2YXIga2V5cyA9IHt9OworICAgIGZvciAodmFyIGtleSBpbiBvcHRzKSB7CisgICAgICBrZXlzWyctLScgKyBrZXkgKyAnPSddID0ga2V5OworICAgIH0KKyAgICBmb3IgKHZhciBpIGluIGFyZ3MpIHsKKyAgICAgIHZhciBhcmcgPSBhcmdzW2ldOworICAgICAgaWYgKHNraXBzLmluZGV4T2YoYXJnKSAhPSAtMSkgeworICAgICAgICBjb250aW51ZTsKKyAgICAgIH0KKyAgICAgIHZhciBoaXQgPSBmYWxzZTsKKyAgICAgIGZvciAodmFyIGsgaW4ga2V5cykgeworICAgICAgICBpZiAoYXJnLnNsaWNlKDAsIGsubGVuZ3RoKSA9PT0gaykgeworICAgICAgICAgIG9wdHNba2V5c1trXV0gPSBhcmcuc2xpY2Uoay5sZW5ndGgpOworICAgICAgICAgIGhpdCA9IHRydWU7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGlmICghaGl0KSB7CisgICAgICAgIHRocm93IG5ldyBFcnJvcignV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AgICAgICAgIGNoZWNrUmVjdXJzaXZlbHkobWFwMVtrZXldLCBtYXAyW2tleV0pOworICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKworICAgIHRlc3QoJ1ZvaWQnLCBmdW5jdGlvbigpIHsKKyAgICAgIGVxdWFsKGNsaWVudC50ZXN0Vm9pZCgpLCB1bmRlZmluZWQpOworICAgIH0pOworICAgIHRlc3QoJ0JpbmFyeSAoU3RyaW5nKScsIGZ1bmN0aW9uKCkgeworICAgICAgdmFyIGJpbmFyeSA9ICcnOworICAgICAgZm9yICh2YXIgdiA9IDI1NTsgdiA+PSAwOyAtLXYpIHsKKyAgICAgICAgYmluYXJ5ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUodik7CisgICAgICB9CisgICAgICBlcXVhbChjbGllbnQudGVzdEJpbmFyeShiaW5hcnkpLCBiaW5hcnkpOworICAgIH0pOworICAgIHRlc3QoJ0JpbmFyeSAoVWludDhBcnJheSknLCBmdW5jdGlvbigpIHsKKyAgICAgIHZhciBiaW5hcnkgPSAnJzsKKyAgICAgIGZvciAodmFyIHYgPSAyNTU7IHYgPj0gMDsgLS12KSB7CisgICAgICAgIGJpbmFyeSArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHYpOworICAgICAgfQorICAgICAgdmFyIGFyciA9IG5ldyBVaW50OEFycmF5KGJpbmFyeS5sZW5ndGgpOworICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBiaW5hcnkubGVuZ3RoOyArK2kpIHsKKyAgICAgICAgYXJyW2ldID0gYmluYXJ5W2ldLmNoYXJDb2RlQXQoKTsKKyAgICAgIH0KKyAgICAgIGVxdWFsKGNsaWVudC50ZXN0QmluYXJ5KGFyciksIGJpbmFyeSk7CisgICAgfSk7CisgICAgdGVzdCgnU3RyaW5nJywgZnVuY3Rpb24oKSB7CisgICAgICBlcXVhbChjbGllbnQudGVzdFN0cmluZygnJyksICcnKTsKKyAgICAgIGVxdWFsKGNsaWVudC50Z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dC5pNjRfdGhpbmcsIHN0cnVjdFRlc3RJbnB1dC5pNjRfdGhpbmcpOworICAgIH0pOworCisgICAgdGVzdCgnTWFwTWFwJywgZnVuY3Rpb24oKSB7CisgICAgICB2YXIgbWFwTWFwVGVzdEV4cGVjdGVkUmVzdWx0ID0geworICAgICAgICAnNCc6IHsnMSc6IDEsICcyJzogMiwgJzMnOiAzLCAnNCc6IDR9LAorICAgICAgICAnLTQnOiB7Jy00JzogLTQsICctMyc6IC0zLCAnLTInOiAtMiwgJy0xJzogLTF9CisgICAgICB9OworCisgICAgICB2YXIgbWFwTWFwVGVzdE91dHB1dCA9IGNsaWVudC50ZXN0TWFwTWFwKDEpOworCisKKyAgICAgIGZvciAodmFyIGtleSBpbiBtYXBNYXBUZXN0T3V0cHV0KSB7CisgICAgICAgIGZvciAodmFyIGtleTIgaW4gbWFwTWFwVGVzdE91dHB1dFtrZXldKSB7CisgICAgICAgICAgZXF1YWwobWFwTWFwVGVzdE91dHB1dFtrZXldW2tleTJdLCBtYXBNYXBUZXN0RXhwZWN0ZWRSZXN1bHRba2V5XVtrZXkyXSk7CisgICAgICAgIH0KKyAgICAgIH0KKworICAgICAgY2hlY2tSZWN1cnNpdmVseShtYXBNYXBUZXN0T3V0cHV0LCBtYXBNYXBUZXN0RXhwZWN0ZWRSZXN1bHQpOworICAgIH0pOworCisgICAgdGVzdCgnWGNlcHRpb24nLCBmdW5jdGlvbigpIHsKKyAgICAgIHRyeSB7CisgICAgICAgIGNsaWVudC50ZXN0RXhjZXB0aW9uKCdYY2VwdGlvbicpOworICAgICAgICBvayhmYWxzZSk7CisgICAgICB9IGNhdGNoIChlKSB7CisgICAgICAgIGVxdWFsKGUuZXJyb3JDb2RlLCAxMDAxKTsKKyAgICAgICAgZXF1YWwoZS5tZXNzYWdlLCAnWGNlcHRpb24nKTsKKyAgICAgIH0KKyAgICB9KTsKKworICAgIHRlc3QoJ25vIEV4Y2VwdGlvbicsIGZ1bmN0aW9uKCkgeworICAgICAgdHJ5IHsKKyAgICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oJ25vIEV4Y2VwdGlvbicpOworICAgICAgfSBjYXRjaCAoZSkgeworICAgICAgICBvayhmYWxzZSk7CisgICAgICB9CisgICAgfSk7CisKKyAgICB0ZXN0KCdURXhjZXB0aW9uJywgZnVuY3Rpb24oKSB7CisgICAgICB0cnkgeworICAgICAgICBjbGllbnQudGVzdEV4Y2VwdGlvbignVEV4Y2VwdGlvbicpOworICAgICAgICBvayhmYWxzZSk7CisgICAgICB9IGNhdGNoIChlKSB7CisgICAgICAgIG9rKG9rKTsKKyAgICAgIH0KKyAgICB9KTsKKworICAgIHZhciBjcmF6eSA9IHsKKyAgICAgICd1c2VyTWFwJzogeyAnNSc6IDUsICc4JzogOCB9LAorICAgICAgJ3h0cnVjdHMnOiBbeworICAgICAgICAnc3RyaW5nX3RoaW5nJzogJ0dvb2RieWU0JywKKyAgICAgICAgJ2J5dGVfdGhpbmcnOiA0LAorICAgICAgICAnaTMyX3RoaW5nJzogNCwKKyAgICAgICAgJ2k2NF90aGluZyc6IDQKKyAgICAgIH0sCisgICAgICB7CisgICAgICAgICdzdHJpbmdfdGhpbmcnOiAnSGVsbG8yJywKKyAgICAgICAgJ2J5dGVfdGhpbmcnOiAyLAorICAgICAgICAnaTMyX3RoaW5nJzogMiwKKyAgICAgICAgJ2k2NF90aGluZyc6IDIKKyAgICAgIH1dCisgICAgfTsKKyAgICB0ZXN0KCdJbnNhbml0eScsIGZ1bmN0aW9uKCkgeworICAgICAgdmFyIGluc2FuaXR5ID0geworICAgICAgICAnMSc6IHsKKyAgICAgICAgICAnMic6IGNyYXp5LAorICAgICAgICAgICczJzogY3JhenkKKyAgICAgICAgfSwKKyAgICAgICAgJzInOiB7ICc2JzogeyAndXNlck1hcCc6IG51bGwsICd4dHJ1Y3RzJzogbnVsbCB9IH0KKyAgICAgIH07CisgICAgICB2YXIgcmVzID0gY2xpZW50LnRlc3RJbnNhbml0eShuZXcgVGhyaW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CBkZWZlbnNpdmUgY29kZQogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZighY29uZGl0aW9uKSB7CisgICAgICAgICAgICAgICAgaWYgKCFjb25kaXRpb24pIHsKICAgICAgICAgICAgICAgICAgICAgLy8gSWYgY29uZGl0aW9uIHN0aWxsIG5vdCBmdWxmaWxsZWQgKHRpbWVvdXQgYnV0IGNvbmRpdGlvbiBpcyAnZmFsc2UnKQogICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiJ3dhaXRGb3IoKScgdGltZW91dCIpOwogICAgICAgICAgICAgICAgICAgICBwaGFudG9tLmV4aXQoMSk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgLy8gQ29uZGl0aW9uIGZ1bGZpbGxlZCAodGltZW91dCBhbmQvb3IgY29uZGl0aW9uIGlzICd0cnVlJykKLSAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIid3YWl0Rm9yKCknIGZpbmlzaGVkIGluICIgKyAobmV3IERhdGUoKS5nZXRUaW1lKCkgLSBzdGFydCkgKyAibXMuIik7Ci0gICAgICAgICAgICAgICAgICAgIHR5cGVvZihvblJlYWR5KSA9PT0gInN0cmluZyIgPyBldmFsKG9uUmVhZHkpIDogb25SZWFkeSgpOyAvLzwgRG8gd2hhdCBpdCdzIHN1cHBvc2VkIHRvIGRvIG9uY2UgdGhlIGNvbmRpdGlvbiBpcyBmdWxmaWxsZWQKKyAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coIid3YWl0Rm9yKCknIGZpbmlzaGVkIGluICIgKyAobmV3IERhdGUoKS5nZXRUaW1lKCkgLSBzdGFydCkgKyAnbXMuJyk7CisgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yob25SZWFkeSkgPT09ICdzdHJpbmcnKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBldmFsKG9uUmVhZHkpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgb25SZWFkeSgpOyAvLzwgRG8gd2hhdCBpdCdzIHN1cHBvc2VkIHRvIGRvIG9uY2UgdGhlIGNvbmRpdGlvbiBpcyBmdWxmaWxsZWQKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBjbGVhckludGVydmFsKGludGVydmFsKTsgLy88IFN0b3AgdGhpcyBpbnRlcnZhbAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfSwgMTAwKTsgLy88IHJlcGVhdCBjaGVjayBldmVyeSAyNTBtcwotfTsKK30KIAogCi1pZiAocGhhbnRvbS5hcmdzLmxlbmd0aCA9PT0gMCB8fCBwaGFudG9tLmFyZ3MubGVuZ3RoID4gMikgeworaWYgKHN5c3RlbS5hcmdzLmxlbmd0aCA9PT0gMSB8fCBzeXN0ZW0uYXJncy5sZW5ndGggPiAzKSB7CiAgICAgY29uc29sZS5sb2coJ1VzYWdlOiBwaGFudG9tanMgcGhhbnRvbWpzLXF1bml0LmpzIFVSTCcpOwogICAgIHBoYW50b20uZXhpdCgxKTsKIH0KQEAgLTU1LDIxICs2MywyMSBAQAogICAgIGNvbnNvbGUubG9nKG1zZyk7CiB9OwogCi1wYWdlLm9wZW4ocGhhbnRvbS5hcmdzWzBdLCBmdW5jdGlvbihzdGF0dXMpewotICAgIGlmIChzdGF0dXMgIT09ICJzdWNjZXNzIikgewotICAgICAgICBjb25zb2xlLmxvZygiVW5hYmxlIHRvIGFjY2VzcyBuZXR3b3JrIik7CitwYWdlLm9wZW4oc3lzdGVtLmFyZ3NbMV0sIGZ1bmN0aW9uKHN0YXR1cykgeworICAgIGlmIChzdGF0dXMgIT09ICdzdWNjZXNzJykgeworICAgICAgICBjb25zb2xlLmxvZygnVW5hYmxlIHRvIGFjY2VzcyBuZXR3b3JrJyk7CiAgICAgICAgIHBoYW50b20uZXhpdCgxKTsKICAgICB9IGVsc2UgewotICAgICAgICB3YWl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bml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1pbWVVdGlsLnJlZ2lzdGVyTWltZURldGVjdG9yKEV4dGVuc2lvbk1pbWVEZXRlY3Rvci5jbGFzcy5nZXROYW1lKCkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIENvbGxlY3Rpb248TWltZVR5cGU+IGNvbGxlY3Rpb24gPSBtaW1lVXRpbC5nZXRNaW1lVHlwZXMoZmlsZSk7CisgICAgICAgICAgICAgICAgICAgIEl0ZXJhdG9yPE1pbWVUeXBlPiBpdGVyYXRvciA9IGNvbGxlY3Rpb24uaXRlcmF0b3IoKTsKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUoaXRlcmF0b3IuaGFzTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBNaW1lVHlwZSBtdCA9IGl0ZXJhdG9yLm5leHQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1pbWVUeXBlID0gIG10LmdldE1lZGlhVHlwZSgpICsgIi8iICsgbXQuZ2V0U3ViVHlwZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICByZXNwb25zZS5zZXRTdGF0dXNDb2RlKEh0dHBTdGF0dXMuU0NfT0spOwogICAgICAgICAgICAgICAgICAgICBGaWxlRW50aXR5IGJvZHkgPSBuZXcgRmlsZUVudGl0eShmaWxlLCBtaW1lVHlwZSk7CmRpZmYgLS1naXQgYS9saWIvanMvdGVzdC90ZXN0LWFzeW5jLmpzIGIvbGliL2pzL3Rlc3QvdGVzdC1hc3luYy5qcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi44YzZiMTNlCi0tLSAvZGV2L251bGwKKysrIGIvbGliL2pzL3Rlc3QvdGVzdC1hc3luYy5qcwpAQCAtMCwwICsxLDM3MCBAQAorLyoKKyAqIExpY2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9uKGFzc2VydCkgeworICAgIGFzc2VydC5leHBlY3QoMSk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIGNsaWVudC50ZXN0RW51bShUaHJpZnRUZXN0Lk51bWJlcnouT05FLCBmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIFRocmlmdFRlc3QuTnVtYmVyei5PTkUpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdUeXBlRGVmJywgZnVuY3Rpb24oYXNzZXJ0KSB7CisgICAgYXNzZXJ0LmV4cGVjdCgxKTsKKyAgICBjb25zdCBkb25lID0gYXNzZXJ0LmFzeW5jKCk7CisgICAgY2xpZW50LnRlc3RUeXBlZGVmKDY5LCBmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIDY5KTsKKyAgICAgIGRvbmUoKTsKKyAgICB9KTsKKyAgfSk7CisKKworUVVuaXQubW9kdWxlKCdkZWVwZXIhJyk7CisKKyAgUVVuaXQudGVzdCgnTWFwTWFwJywgZnVuY3Rpb24oYXNzZXJ0KSB7CisgICAgYXNzZXJ0LmV4cGVjdCgxNik7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIGNvbnN0IG1hcE1hcFRlc3RFeHBlY3RlZFJlc3VsdCA9IHsKKyAgICAgICc0JzogeycxJzogMSwgJzInOiAyLCAnMyc6IDMsICc0JzogNH0sCisgICAgICAnLTQnOiB7Jy00JzogLTQsICctMyc6IC0zLCAnLTInOiAtMiwgJy0xJzogLTF9CisgICAgfTsKKworICAgIGNsaWVudC50ZXN0TWFwTWFwKDEsIGZ1bmN0aW9uKHJlc3VsdCkgeworICAgICAgZm9yIChsZXQga2V5IGluIHJlc3VsdCkgeworICAgICAgICBmb3IgKGxldCBrZXkyIGluIHJlc3VsdFtrZXldKSB7CisgICAgICAgICAgYXNzZXJ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yAgICBjb25zdCBpbnNhbml0eSA9IHsKKyAgICAgICcxJzogeworICAgICAgICAnMic6IHsKKyAgICAgICAgICAndXNlck1hcCc6IHsgJzUnOiA1LCAnOCc6IDggfSwKKyAgICAgICAgICAneHRydWN0cyc6IFt7CisgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnOiAnR29vZGJ5ZTQnLAorICAgICAgICAgICAgICAnYnl0ZV90aGluZyc6IDQsCisgICAgICAgICAgICAgICdpMzJfdGhpbmcnOiA0LAorICAgICAgICAgICAgICAnaTY0X3RoaW5nJzogNAorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgJ3N0cmluZ190aGluZyc6ICdIZWxsbzInLAorICAgICAgICAgICAgICAnYnl0ZV90aGluZyc6IDIsCisgICAgICAgICAgICAgICdpMzJfdGhpbmcnOiAyLAorICAgICAgICAgICAgICAnaTY0X3RoaW5nJzogMgorICAgICAgICAgICAgfQorICAgICAgICAgIF0KKyAgICAgICAgfSwKKyAgICAgICAgJzMnOiB7CisgICAgICAgICAgJ3VzZXJNYXAnOiB7ICc1JzogNSwgJzgnOiA4IH0sCisgICAgICAgICAgJ3h0cnVjdHMnOiBbeworICAgICAgICAgICAgICAnc3RyaW5nX3RoaW5nJzogJ0dvb2RieWU0JywKKyAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnOiA0LAorICAgICAgICAgICAgICAnaTMyX3RoaW5nJzogNCwKKyAgICAgICAgICAgICAgJ2k2NF90aGluZyc6IDQKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnOiAnSGVsbG8yJywKKyAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnOiAyLAorICAgICAgICAgICAgICAnaTMyX3RoaW5nJzogMiwKKyAgICAgICAgICAgICAgJ2k2NF90aGluZyc6IDIKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBdCisgICAgICAgIH0KKyAgICAgIH0s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gYXNzZXJ0Lm9rKAorICAgICAgICBNYXRoLmFicygKKyAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19GUkFDVElPTkFMX0RPVUJMRSAtCisgICAgICAgICAgICBET1VCTEVfQVNTSUdORURfVE9fRlJBQ1RJT05BTF9ET1VCTEVfVEVTVCkgPD0gRVBTSUxPTik7CisgICAgYXNzZXJ0Lm9rKAorICAgICAgICBNYXRoLmFicygKKyAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19ORUdBVElWRV9GUkFDVElPTkFMX0RPVUJMRSAtCisgICAgICAgICAgICBET1VCTEVfQVNTSUdORURfVE9fTkVHQVRJVkVfRlJBQ1RJT05BTF9ET1VCTEVfVEVTVCkgPD0gRVBTSUxPTik7CisgICAgYXNzZXJ0Lm9rKAorICAgICAgICBNYXRoLmFicygKKyAgICAgICAgICAgIEVYUEVDVEVEX0RPVUJMRV9BU1NJR05FRF9UT19MQVJHRV9ET1VCTEUgLQorICAgICAgICAgICAgRE9VQkxFX0FTU0lHTkVEX1RPX0xBUkdFX0RPVUJMRV9URVNUKSA8PSBFUFNJTE9OKTsKKyAgICBhc3NlcnQub2soCisgICAgICAgIE1hdGguYWJzKAorICAgICAgICAgICAgRVhQRUNURURfRE9VQkxFX0FTU0lHTkVEX1RPX0xBUkdFX0ZSQUNUSU9OQUxfRE9VQkxFIC0KKyAgICAgICAgICAgIERPVUJMRV9BU1NJR05FRF9UT19MQVJHRV9GUkFDVElPTkFMX0RPVUJMRV9URVNUKSA8PSBFUFNJTE9OKTsKKyAgICBhc3NlcnQub2soCisgICAgICAgIE1hdGguYWJzKAorICAgICAgICAgICAgRVhQRUNURURfRE9VQkxFX0FTU0lHTkVEX1RPX1NNQUxMX0RPVUJMRSAtCisgICAgICAgICAgICBET1VCTEVfQVNTSUdORURfVE9fU01BTExfRE9VQkxFX1RFU1QpIDw9IEVQU0lMT04pOworICAgIGFzc2VydC5vaygKKyAg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b24nICYmIHR5cGVvZiBtYXAyICE9PSAnZnVuY3Rpb24nKSB7CisgICAgaWYgKCFtYXAxIHx8IHR5cGVvZiBtYXAxICE9PSAnb2JqZWN0JykgeworICAgICAgICBhc3NlcnQuZXF1YWwobWFwMSwgbWFwMik7CisgICAgfSBlbHNlIHsKKyAgICAgIGZvciAodmFyIGtleSBpbiBtYXAxKSB7CisgICAgICAgIGNoZWNrUmVjdXJzaXZlbHkoYXNzZXJ0LCBtYXAxW2tleV0sIG1hcDJba2V5XSk7CisgICAgICB9CisgICAgfQorICB9Cit9CisKK1FVbml0Lm1vZHVsZSgnQmFzZSBUeXBlcycpOworCisgIFFVbml0LnRlc3QoJ1ZvaWQnLCBmdW5jdGlvbiggYXNzZXJ0ICkgeworICAgIGFzc2VydC5leHBlY3QoMSk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIGNsaWVudC50ZXN0Vm9pZCgpLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCB1bmRlZmluZWQpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdTdHJpbmcnLCBmdW5jdGlvbiggYXNzZXJ0ICkgeworICAgIGFzc2VydC5leHBlY3QoMyk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygzKTsKKyAgICBjbGllbnQudGVzdFN0cmluZygnJykudGhlbihmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCAnJyk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICAgIGNsaWVudC50ZXN0U3RyaW5nKHN0cmluZ1Rlc3QpLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICAgYXNzZXJ0LmVxdWFsKHJlc3VsdCwgc3RyaW5nVGVzdCk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICAgIHZhciBzcGVjaWFsQ2hhcmFjdGVycyA9ICdxdW90ZTogXCIgYmFja3NsYXNoOicgKworICAgICAgICAgICcgZm9yd2FyZHNsYXNoLWVzY2FwZWQ6IFwvICcgKworICAgICAgICAgICcgYmFja3NwYWNlOiBcYiBmb3JtZmVlZDogXGYgbmV3bGluZTogXG4gcmV0dXJuOiBcciB0YWI6ICcgKworICAgICAgICAgICcgbm93LWFsbC1vZi10aGVtLXRvZ2V0aGVyOiAiXFxcL1xiXG5cclx0JyArCisgICAgICAgICAgJyBub3ctYS1idW5jaC1vZi1qdW5rOiAhQCMkJSYoKSgmJSQje317fTw+PD48JzsKKyAgICBjbGllbnQudGVzdFN0cmluZyhzcGVjaWFsQ2hhcmFjdGVycykudGhlbihmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCBzcGVjaWFsQ2hhcmFjdGVycyk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdEb3VibGUnLCBmdW5jdGlvbiggYXNzZXJ0ICkgeworICAgIGFzc2VydC5leHBlY3QoNCk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYyg0KTsKKyAgICBjbGllbnQudGVzdERvdWJsZSgwKS50aGVuKGZ1bmN0aW9uKHJlc3VsdCkgeworICAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIDApOworICAgICAgIGRvbmUoKTsKKyAgICB9KTsKKyAgICBjbGllbnQudGVzdERvdWJsZSgtMSkudGhlbihmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCAtMSk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICAgIGNsaWVudC50ZXN0RG91YmxlKDMuMTQpLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICAgYXNzZXJ0LmVxdWFsKHJlc3VsdCwgMy4xNCk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICAgIGNs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Rlc3RJMzIoLU1hdGgucG93KDIsIDMwKSkudGhlbihmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCAtTWF0aC5wb3coMiwgMzApKTsKKyAgICAgICBkb25lKCk7CisgICAgfSk7CisgIH0pOworICBRVW5pdC50ZXN0KCdJNjQnLCBmdW5jdGlvbiggYXNzZXJ0ICkgeworICAgIGFzc2VydC5leHBlY3QoMyk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygzKTsKKyAgICBjbGllbnQudGVzdEk2NCgwKS50aGVuKGZ1bmN0aW9uKHJlc3VsdCkgeworICAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIDApOworICAgICAgIGRvbmUoKTsKKyAgICB9KTsKKyAgICAvL1RoaXMgaXMgdXN1YWxseSAyXjYwIGJ1dCBKUyBjYW5ub3QgcmVwcmVzZW50IGFueXRoaW5nIG92ZXIgMl41MiBhY2N1cmF0ZWx5CisgICAgY2xpZW50LnRlc3RJNjQoTWF0aC5wb3coMiwgNTIpKS50aGVuKGZ1bmN0aW9uKHJlc3VsdCkgeworICAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIE1hdGgucG93KDIsIDUyKSk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICAgIGNsaWVudC50ZXN0STY0KC1NYXRoLnBvdygyLCA1MikpLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICAgYXNzZXJ0LmVxdWFsKHJlc3VsdCwgLU1hdGgucG93KDIsIDUyKSk7CisgICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworCitRVW5pdC5tb2R1bGUoJ1N0cnVjdHVyZWQgVHlwZXMnKTsKKworICBRVW5pdC50ZXN0KCdTdHJ1Y3QnLCBmdW5jdGlvbiggYXNzZXJ0ICkgeworICAgIGFzc2VydC5leHBlY3QoNSk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIHZhciBzdH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KyAgICAgIGFzc2VydC5vayhyZXN1bHQsIGxpc3RUZXN0SW5wdXQpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdFbnVtJywgZnVuY3Rpb24oIGFzc2VydCApIHsKKyAgICBhc3NlcnQuZXhwZWN0KDEpOworICAgIGNvbnN0IGRvbmUgPSBhc3NlcnQuYXN5bmMoKTsKKyAgICBjbGllbnQudGVzdEVudW0oVGhyaWZ0VGVzdC5OdW1iZXJ6Lk9ORSkudGhlbihmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIFRocmlmdFRlc3QuTnVtYmVyei5PTkUpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdUeXBlRGVmJywgZnVuY3Rpb24oIGFzc2VydCApIHsKKyAgICBhc3NlcnQuZXhwZWN0KDEpOworICAgIGNvbnN0IGRvbmUgPSBhc3NlcnQuYXN5bmMoKTsKKyAgICBjbGllbnQudGVzdFR5cGVkZWYoNjkpLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICBhc3NlcnQuZXF1YWwocmVzdWx0LCA2OSk7CisgICAgICBkb25lKCk7CisgICAgfSk7CisgIH0pOworCisKK1FVbml0Lm1vZHVsZSgnZGVlcGVyIScpOworCisgIFFVbml0LnRlc3QoJ01hcE1hcCcsIGZ1bmN0aW9uKCBhc3NlcnQgKSB7CisgICAgYXNzZXJ0LmV4cGVjdCgxNik7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIHZhciBtYXBNYXBUZXN0RXhwZWN0ZWRSZXN1bHQgPSB7CisgICAgICAnNCc6IHsnMSc6IDEsICcyJzogMiwgJzMnOiAzLCAnNCc6IDR9LAorICAgICAgJy00JzogeyctNCc6IC00LCAnLTMnOiAtMywgJy0yJzogLTIsICctMSc6IC0xfQorICAgIH07CisKKyAgICBjbGllbnQudGVzdE1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KyAgICBhc3NlcnQuZXhwZWN0KDEpOworICAgIGNvbnN0IGRvbmUgPSBhc3NlcnQuYXN5bmMoKTsKKyAgICBjbGllbnQudGVzdEV4Y2VwdGlvbignbm8gRXhjZXB0aW9uJykudGhlbihmdW5jdGlvbihlKSB7CisgICAgICBhc3NlcnQub2soIWUpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworUVVuaXQubW9kdWxlKCdJbnNhbml0eScpOworCisgIFFVbml0LnRlc3QoJ3Rlc3RJbnNhbml0eScsIGZ1bmN0aW9uKCBhc3NlcnQgKSB7CisgICAgYXNzZXJ0LmV4cGVjdCgyNCk7CisgICAgY29uc3QgZG9uZSA9IGFzc2VydC5hc3luYygpOworICAgIHZhciBpbnNhbml0eSA9IHsKKyAgICAgICcxJzogeworICAgICAgICAnMic6IHsKKyAgICAgICAgICAndXNlck1hcCc6IHsgJzUnOiA1LCAnOCc6IDggfSwKKyAgICAgICAgICAneHRydWN0cyc6IFt7CisgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnOiAnR29vZGJ5ZTQnLAorICAgICAgICAgICAgICAnYnl0ZV90aGluZyc6IDQsCisgICAgICAgICAgICAgICdpMzJfdGhpbmcnOiA0LAorICAgICAgICAgICAgICAnaTY0X3RoaW5nJzogNAorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgJ3N0cmluZ190aGluZyc6ICdIZWxsbzInLAorICAgICAgICAgICAgICAnYnl0ZV90aGluZyc6IDIsCisgICAgICAgICAgICAgICdpMzJfdGhpbmcnOiAyLAorICAgICAgICAgICAgICAnaTY0X3RoaW5nJzogMgorICAgICAgICAgICAgfQorICAgICAgICAgIF0KKyAgICAgICAgfSwKKyAgICAgICAgJzMnOiB7CisgICAgICAgICAgJ3VzZXJNYXAnOiB7ICc1JzogNSwgJzgnOiA4IH0sCisgICAgICAgICAgJ3h0cnVjdHMnOiBbeworICAgICAgICAgICAgICAnc3RyaW5nX3RoaW5nJzogJ0dvb2RieWU0JywKKyAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnOiA0LAorICAgICAgICAgICAgICAnaTMyX3RoaW5nJzogNCwKKyAgICAgICAgICAgICAgJ2k2NF90aGluZyc6IDQKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnOiAnSGVsbG8yJywKKyAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnOiAyLAorICAgICAgICAgICAgICAnaTMyX3RoaW5nJzogMiwKKyAgICAgICAgICAgICAgJ2k2NF90aGluZyc6IDIKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBdCisgICAgICAgIH0KKyAgICAgIH0sCisgICAgICAnMic6IHsgJzYnOiB7ICd1c2VyTWFwJzogbnVsbCwgJ3h0cnVjdHMnOiBudWxsIH0gfQorICAgIH07CisgICAgY2xpZW50LnRlc3RJbnNhbml0eShuZXcgVGhyaWZ0VGVzdC5JbnNhbml0eSgpKS50aGVuKGZ1bmN0aW9uKHJlcykgeworICAgICAgYXNzZXJ0Lm9rKHJlcywgSlNPTi5zdHJpbmdpZnkocmVzKSk7CisgICAgICBhc3NlcnQub2soaW5zYW5pdHksIEpTT04uc3RyaW5naWZ5KGluc2FuaXR5KSk7CisgICAgICBjaGVja1JlY3Vyc2l2ZWx5KGFzc2VydCwgcmVzLCBpbnNhbml0eSk7CisgICAgICBkb25lKCk7CisgICAgfSk7CisgIH0pOworCitRVW5pdC5tb2R1bGUoJ09uZXdheScpOworICBRVW5pdC50ZXN0KCd0ZXN0T25ld2F5JywgZnVuY3Rpb24oIGFzc2VydCApIHsKKyAgICBhc3NlcnQuZXhwZWN0KDEpOworICAgIGNvbnN0IGRvbmUgPSBhc3NlcnQuYXN5bmMoKTsKKyAgICBjbGllbnQudGVzdE9uZXdheSgxKS50aGVuKGZ1bmN0aW9uKHJlc3VsdCkgeworICAgICAgYXNzZXJ0LmVxdWFsKHJlc3VsdCwgdW5kZWZpbm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wgNTIpLCBmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIE1hdGgucG93KC0yLCA1MikpOworICAgICAgZG9uZSgpOworICAgIH0pCisgICAgLmVycm9yKGZ1bmN0aW9uKHhociwgc3RhdHVzLCBlKSB7IGFzc2VydC5vayhmYWxzZSwgZS5tZXNzYWdlKTsgfSkKKyAgICAuc3VjY2VzcyhmdW5jdGlvbihyZXN1bHQpIHsKKyAgICAgIC8vVGhpcyBpcyB1c3VhbGx5IDJeNjAgYnV0IEpTIGNhbm5vdCByZXByZXNlbnQgYW55dGhpbmcgb3ZlciAyXjUyIGFjY3VyYXRlbHkKKyAgICAgIGFzc2VydC5lcXVhbChyZXN1bHQsIE1hdGgucG93KC0yLCA1MikpOworICAgICAgZG9uZSgpOworICAgIH0pCisgICAgLmNvbXBsZXRlKGZ1bmN0aW9uKCkgeworICAgICAgYXNzZXJ0Lm9rKHRydWUpOworICAgICAgZG9uZSgpOworICAgIH0pOworICB9KTsKKworICBRVW5pdC50ZXN0KCdYY2VwdGlvbicsIGZ1bmN0aW9uKGFzc2VydCkgeworICAgIGFzc2VydC5leHBlY3QoMik7CisKKyAgICBjb25zdCBkb25lID0gYXNzZXJ0LmFzeW5jKDIpOworCisgICAgY29uc3QgZGZkID0gY2xpZW50LnRlc3RFeGNlcHRpb24oJ1hjZXB0aW9uJywgZnVuY3Rpb24ocmVzdWx0KSB7CisgICAgICBhc3NlcnQub2soZmFsc2UpOworICAgICAgZG9uZSgpOworICAgIH0pCisgICAgLmVycm9yKGZ1bmN0aW9uKHhociwgc3RhdHVzLCBlKSB7CisgICAgICBhc3NlcnQuZXF1YWwoZS5lcnJvckNvZGUsIDEwMDEpOworICAgICAgYXNzZXJ0LmVxdWFsKGUubWVzc2FnZSwgJ1hjZXB0aW9uJyk7CisgICAgICBkb25lKCk7CisgICAgICAkKGRvY3VtZW50KS5hamF4RXJyb3IoIGZ1bmN0aW9uKCkgeyBkb25lK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iIKKyAgICBhc3NlcnQuZXhwZWN0KDEpOworICAgIHRyeSB7CisgICAgICBjbGllbnQudGVzdEV4Y2VwdGlvbignVEV4Y2VwdGlvbicpOworICAgIH0gY2F0Y2ggKGUpIHsKKyAgICAgIC8vYXNzZXJ0Lm9rKGZhbHNlKTsKICAgICB9CisgICAgYXNzZXJ0Lm9rKHRydWUpOwogICB9KTsKIAogCi1tb2R1bGUoIkluc2FuaXR5Iik7CitRVW5pdC5tb2R1bGUoJ0luc2FuaXR5Jyk7CiAKLSAgdGVzdCgidGVzdEluc2FuaXR5IiwgZnVuY3Rpb24oKSB7Ci0gICAgdmFyIGluc2FuaXR5ID0gewotICAgICAgIjEiOnsKLSAgICAgICAgIjIiOnsKLSAgICAgICAgICAidXNlck1hcCI6eyAiNSI6NSwgIjgiOjggfSwKLSAgICAgICAgICAieHRydWN0cyI6W3sKLSAgICAgICAgICAgICAgInN0cmluZ190aGluZyI6Ikdvb2RieWU0IiwKLSAgICAgICAgICAgICAgImJ5dGVfdGhpbmciOjQsCi0gICAgICAgICAgICAgICJpMzJfdGhpbmciOjQsCi0gICAgICAgICAgICAgICJpNjRfdGhpbmciOjQKLSAgICAgICAgICAgIH0sCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciOiJIZWxsbzIiLAotICAgICAgICAgICAgICAiYnl0ZV90aGluZyI6MiwKLSAgICAgICAgICAgICAgImkzMl90aGluZyI6MiwKLSAgICAgICAgICAgICAgImk2NF90aGluZyI6MgotICAgICAgICAgICAgfQotICAgICAgICAgIF0KLSAgICAgICAgfSwKLSAgICAgICAgIjMiOnsKLSAgICAgICAgICAidXNlck1hcCI6eyAiNSI6NSwgIjgiOjggfSwKLSAgICAgICAgICAieHRydWN0cyI6W3sKLSAgICAgICAgICAgICAgInN0cmluZ190aGluZyI6Ikdvb2RieWU0IiwKLSAgICAgICAgICAgICAgImJ5dGVfdGhpbmciOjQsCi0gICAgICAgICAgICAgICJpMzJfdGhpbmciOjQsCi0gICAgICAgICAgICAgICJpNjRfdGhpbmciOjQKLSAgICAgICAgICAgIH0sCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciOiJIZWxsbzIiLAotICAgICAgICAgICAgICAiYnl0ZV90aGluZyI6MiwKLSAgICAgICAgICAgICAgImkzMl90aGluZyI6MiwKLSAgICAgICAgICAgICAgImk2NF90aGluZyI6MgotICAgICAgICAgICAgfQotICAgICAgICAgIF0KLSAgICAgICAgfQorICBjb25zdCBjcmF6eSA9IHsKKyAgICAndXNlck1hcCc6IHsgJzUnOiA1LCAnOCc6IDggfSwKKyAgICAneHRydWN0cyc6IFt7CisgICAgICAnc3RyaW5nX3RoaW5nJzogJ0dvb2RieWU0JywKKyAgICAgICdieXRlX3RoaW5nJzogNCwKKyAgICAgICdpMzJfdGhpbmcnOiA0LAorICAgICAgJ2k2NF90aGluZyc6IDQKKyAgICB9LAorICAgIHsKKyAgICAgICdzdHJpbmdfdGhpbmcnOiAnSGVsbG8yJywKKyAgICAgICdieXRlX3RoaW5nJzogMiwKKyAgICAgICdpMzJfdGhpbmcnOiAyLAorICAgICAgJ2k2NF90aGluZyc6IDIKKyAgICB9XQorICB9OworICBRVW5pdC50ZXN0KCd0ZXN0SW5zYW5pdHknLCBmdW5jdGlvbihhc3NlcnQpIHsKKyAgICBjb25zdCBpbnNhbml0eSA9IHsKKyAgICAgICcxJzogeworICAgICAgICAnMic6IGNyYXp5LAorICAgICAgICAnMyc6IGNyYXp5CiAgICAgICB9LAotICAgICAgIjIiOnsgIjYiOnsgInVzZXJNYXAiOm51bGwsICJ4dHJ1Y3RzIjpudWxsIH0gfQorICAgICAgJzInOiB7ICc2JzogeyAndXNlck1hcCc6IG51bGwsICd4dHJ1Y3RzJzogbnVsbCB9IH0KICAgICB9OwotICAgIHZhciByZXMgPSBjbGllbnQudGVzdEluc2FuaXR5KG5ldyBUaHJpZnRUZXN0Lkluc2FuaXR5KCkpOwotICAgIG9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Bjb25zb2xlLmxvZygndGVzdEk2NCgnICsgdGhpbmcgKyAnKScpOworICAgIHJlc3VsdChudWxsLCB0aGluZyk7CisgIH0sCisgIHRlc3REb3VibGU6IGZ1bmN0aW9uKHRoaW5nLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdERvdWJsZSgnICsgdGhpbmcgKyAnKScpOworICAgIHJlc3VsdChudWxsLCB0aGluZyk7CisgIH0sCisgIHRlc3RCaW5hcnk6IGZ1bmN0aW9uKHRoaW5nLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdEJpbmFyeShcJycgKyB0aGluZyArICdcJyknKTsKKyAgICByZXN1bHQobnVsbCwgdGhpbmcpOworICB9LAorICB0ZXN0U3RydWN0OiBmdW5jdGlvbih0aGluZywgcmVzdWx0KSB7CisgICAgY29uc29sZS5sb2coJ3Rlc3RTdHJ1Y3QoJyk7CisgICAgY29uc29sZS5sb2codGhpbmcpOworICAgIGNvbnNvbGUubG9nKCcpJyk7CisgICAgcmVzdWx0KG51bGwsIHRoaW5nKTsKKyAgfSwKKyAgdGVzdE5lc3Q6IGZ1bmN0aW9uKG5lc3QsIHJlc3VsdCkgeworICAgIGNvbnNvbGUubG9nKCd0ZXN0TmVzdCgnKTsKKyAgICBjb25zb2xlLmxvZyhuZXN0KTsKKyAgICBjb25zb2xlLmxvZygnKScpOworICAgIHJlc3VsdChudWxsLCBuZXN0KTsKKyAgfSwKKyAgdGVzdE1hcDogZnVuY3Rpb24odGhpbmcsIHJlc3VsdCkgeworICAgIGNvbnNvbGUubG9nKCd0ZXN0TWFwKCcpOworICAgIGNvbnNvbGUubG9nKHRoaW5nKTsKKyAgICBjb25zb2xlLmxvZygnKScpOworICAgIHJlc3VsdChudWxsLCB0aGluZyk7CisgIH0sCisgIHRlc3RTdHJpbmdNYXA6IGZ1bmN0aW9uKHRoaW5nLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdFN0cmluZ01hcCgnKTsKKyAgICBjb25zb2xlLmxvZyh0aGluZyk7CisgICAgY29uc29sZS5sb2coJyknKTsKKyAgICByZXN1bHQobnVsbCwgdGhpbmcpOworICB9LAorICB0ZXN0U2V0OiBmdW5jdGlvbih0aGluZywgcmVzdWx0KSB7CisgICAgY29uc29sZS5sb2coJ3Rlc3RTZXQoJyk7CisgICAgY29uc29sZS5sb2codGhpbmcpOworICAgIGNvbnNvbGUubG9nKCcpJyk7CisgICAgcmVzdWx0KG51bGwsIHRoaW5nKTsKKyAgfSwKKyAgdGVzdExpc3Q6IGZ1bmN0aW9uKHRoaW5nLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdExpc3QoJyk7CisgICAgY29uc29sZS5sb2codGhpbmcpOworICAgIGNvbnNvbGUubG9nKCcpJyk7CisgICAgcmVzdWx0KG51bGwsIHRoaW5nKTsKKyAgfSwKKyAgdGVzdEVudW06IGZ1bmN0aW9uKHRoaW5nLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdEVudW0oJyArIHRoaW5nICsgJyknKTsKKyAgICByZXN1bHQobnVsbCwgdGhpbmcpOworICB9LAorICB0ZXN0VHlwZWRlZjogZnVuY3Rpb24odGhpbmcsIHJlc3VsdCkgeworICAgIGNvbnNvbGUubG9nKCd0ZXN0VHlwZWRlZignICsgdGhpbmcgKyAnKScpOworICAgIHJlc3VsdChudWxsLCB0aGluZyk7CisgIH0sCisgIHRlc3RNYXBNYXA6IGZ1bmN0aW9uKGhlbGxvLCByZXN1bHQpIHsKKyAgICBjb25zb2xlLmxvZygndGVzdE1hcE1hcCgnICsgaGVsbG8gKyAnKScpOworCisgICAgY29uc3QgbWFwbWFwID0gW107CisgICAgY29uc3QgcG9zID0gW107CisgICAgY29uc3QgbmVnID0gW107CisgICAgZm9yIChsZXQgaSA9IDE7IGkgPCA1OyBpKyspIHsKKyAgICAgIHBvc1tpXSA9IGk7CisgICAgICBuZWdbLWldID0gLWk7CisgICAgfQorICAgIG1hcG1h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ciBmaWQgPSByZXQuZmlkOwotCi0gICAgICAgIHN3aXRjaCAoZmlkKSB7Ci0gICAgICAgICAgICBjYXNlIDE6Ci0gICAgICAgICAgICAgICAgaWYgKHJldC5mdHlwZSA9PSBUaHJpZnQuVHlwZS5TVFJJTkcpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQucmVhZFN0cmluZygpOwotICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSByZXQudmFsdWU7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQuc2tpcChyZXQuZnR5cGUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgMjoKLSAgICAgICAgICAgICAgICBpZiAocmV0LmZ0eXBlID09IFRocmlmdC5UeXBlLkkzMikgewotICAgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5yZWFkSTMyKCk7Ci0gICAgICAgICAgICAgICAgICAgIHRoaXMuY29kZSA9IHJldC52YWx1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5za2lwKHJldC5mdHlwZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIHJldCA9IGlucHV0LnNraXAocmV0LmZ0eXBlKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotCi0gICAgICAgIGlucHV0LnJlYWRGaWVsZEVuZCgpOwotICAgIH0KLQotICAgIGlucHV0LnJlYWRTdHJ1Y3RFbmQoKTsKLX07Ci0KLVRocmlmdC5UQXBwbGljYXRpb25FeGNlcHRpb24ucHJvdG90eXBlLndyaXRlID0gZnVuY3Rpb24ob3V0cHV0KSB7Ci0gICAgdmFyIHhmZXIgPSAwOwotC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eW5jaHJvbm91cyByZXF1ZXN0cyc7Ci0gICAgICAgIH0KLQotICAgICAgICB2YXIgdGhyaWZ0VHJhbnNwb3J0ID0gdGhpczsKLQotICAgICAgICB2YXIganFYSFIgPSBqUXVlcnkuYWpheCh7Ci0gICAgICAgICAgICB1cmw6IHRoaXMudXJsLAotICAgICAgICAgICAgZGF0YTogcG9zdERhdGEsCi0gICAgICAgICAgICB0eXBlOiAnUE9TVCcsCi0gICAgICAgICAgICBjYWNoZTogZmFsc2UsCi0gICAgICAgICAgICBjb250ZW50VHlwZTogJ2FwcGxpY2F0aW9uL2pzb24nLAotICAgICAgICAgICAgZGF0YVR5cGU6ICd0ZXh0IHRocmlmdCcsCi0gICAgICAgICAgICBjb252ZXJ0ZXJzOiB7Ci0gICAgICAgICAgICAgICAgJ3RleHQgdGhyaWZ0JyA6IGZ1bmN0aW9uKHJlc3BvbnNlRGF0YSkgewotICAgICAgICAgICAgICAgICAgICB0aHJpZnRUcmFuc3BvcnQuc2V0UmVjdkJ1ZmZlcihyZXNwb25zZURhdGEpOwotICAgICAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSByZWN2X21ldGhvZC5jYWxsKGNsaWVudCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9LAotICAgICAgICAgICAgY29udGV4dDogY2xpZW50LAotICAgICAgICAgICAgc3VjY2VzczogalF1ZXJ5Lm1ha2VBcnJheShhcmdzKS5wb3AoKQotICAgICAgICB9KTsKLQotICAgICAgICByZXR1cm4ganFYSFI7Ci0gICAgfSwKLQotICAgIHNldFJlY3ZCdWZmZXI6IGZ1bmN0aW9uKGJ1ZikgewotICAgICAgICB0aGlzLnJlY3ZfYnVmID0gYnVmOwotICAgICAgICB0aGlzLnJlY3ZfYnVmX3N6ID0gdGhpcy5yZWN2X2J1Zi5sZW5ndGg7Ci0gICAgICAgIHRoaXMud3BvcyA9IHRoaXMucmVjd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oKTsKLQotICAgICAgICB0aGlzLndvYmogPSB0aGlzLnRzdGFjay5wb3AoKTsKLSAgICAgICAgdGhpcy53b2JqLnB1c2gob2JqKTsKLQotICAgICAgICB0aGlzLndidWYgPSAnWycgKyB0aGlzLndvYmouam9pbignLCcpICsgJ10nOwotCi0gICAgICAgIHRoaXMudHJhbnNwb3J0LndyaXRlKHRoaXMud2J1Zik7Ci0gICAgIH0sCi0KLQotICAgIHdyaXRlU3RydWN0QmVnaW46IGZ1bmN0aW9uKG5hbWUpIHsKLSAgICAgICAgdGhpcy50cG9zLnB1c2godGhpcy50c3RhY2subGVuZ3RoKTsKLSAgICAgICAgdGhpcy50c3RhY2sucHVzaCh7fSk7Ci0gICAgfSwKLQotICAgIHdyaXRlU3RydWN0RW5kOiBmdW5jdGlvbigpIHsKLQotICAgICAgICB2YXIgcCA9IHRoaXMudHBvcy5wb3AoKTsKLSAgICAgICAgdmFyIHN0cnVjdCA9IHRoaXMudHN0YWNrW3BdOwotICAgICAgICB2YXIgc3RyID0gJ3snOwotICAgICAgICB2YXIgZmlyc3QgPSB0cnVlOwotICAgICAgICBmb3IgKHZhciBrZXkgaW4gc3RydWN0KSB7Ci0gICAgICAgICAgICBpZiAoZmlyc3QpIHsKLSAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzdHIgKz0gJywnOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBzdHIgKz0ga2V5ICsgJzonICsgc3RydWN0W2tleV07Ci0gICAgICAgIH0KLQotICAgICAgICBzdHIgKz0gJ30nOwotICAgICAgICB0aGlzLnRzdGFja1twXSA9IHN0cjsKLSAgICB9LAotCi0gICAgd3JpdGVGaWVsZEJlZ2luOiBmdW5jdGlvbihuYW1lLCBmaWVsZFR5cGUsIGZpZWxkSWQpIHsKLSAgICAgICAgdGhpcy50cG9zLnB1c2godGhpcy50c3RhY2subGVuZ3RoKTsKLSAgICA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GFjay5sZW5ndGgpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICgodGhpcy50c3RhY2subGVuZ3RoIC0gcCAtIDEpICUgMiAhPT0gMCkgewotICAgICAgICAgICAgdGhpcy50c3RhY2sucHVzaCgnJyk7Ci0gICAgICAgIH0KLQotICAgICAgICB2YXIgc2l6ZSA9ICh0aGlzLnRzdGFjay5sZW5ndGggLSBwIC0gMSkgLyAyOwotCi0gICAgICAgIHRoaXMudHN0YWNrW3BdW3RoaXMudHN0YWNrW3BdLmxlbmd0aCAtIDFdID0gc2l6ZTsKLQotICAgICAgICB2YXIgbWFwID0gJ30nOwotICAgICAgICB2YXIgZmlyc3QgPSB0cnVlOwotICAgICAgICB3aGlsZSAodGhpcy50c3RhY2subGVuZ3RoID4gcCArIDEpIHsKLSAgICAgICAgICAgIHZhciB2ID0gdGhpcy50c3RhY2sucG9wKCk7Ci0gICAgICAgICAgICB2YXIgayA9IHRoaXMudHN0YWNrLnBvcCgpOwotICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbWFwID0gJywnICsgbWFwOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoISBpc05hTihrKSkgeyBrID0gJyInICsgayArICciJzsgfSAvL2pzb24gImtleXMiIG5lZWQgdG8gYmUgc3RyaW5ncwotICAgICAgICAgICAgbWFwID0gayArICc6JyArIHYgKyBtYXA7Ci0gICAgICAgIH0KLSAgICAgICAgbWFwID0gJ3snICsgbWFwOwotCi0gICAgICAgIHRoaXMudHN0YWNrW3BdLnB1c2gobWFwKTsKLSAgICAgICAgdGhpcy50c3RhY2tbcF0gPSAnWycgKyB0aGlzLnRzdGFja1twXS5qb2luKCcsJykgKyAnXSc7Ci0gICAgfSwKLQotICAgIHdyaXRlTGlzdEJlZ2luOiBmd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gICAgICAgdmFyIGVzY2FwZWRTdHJpbmcgPSAnJzsKLSAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgdmFyIGNoID0gc3RyLmNoYXJBdChpKTsgICAgICAvLyBhIHNpbmdsZSBkb3VibGUgcXVvdGU6ICIKLSAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICdcIicpIHsKLSAgICAgICAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxcIic7IC8vIHdyaXRlIG91dCBhczogXCIKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7ICAgIC8vIGEgc2luZ2xlIGJhY2tzbGFzaDogXAotICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9ICdcXFxcJzsgLy8gd3JpdGUgb3V0IGFzOiBcXAotICAgICAgICAgICAgICAgIC8qIEN1cnJlbnRseSBlc2NhcGVkIGZvcndhcmQgc2xhc2hlcyBicmVhayBUSlNPTlByb3RvY29sLgotICAgICAgICAgICAgICAgICAqIEFzIGl0IHN0YW5kcywgd2UgY2FuIHNpbXBseSBwYXNzIGZvcndhcmQgc2xhc2hlcyBpbnRvCi0gICAgICAgICAgICAgICAgICogb3VyIHN0cmluZ3MgYWNyb3NzIHRoZSB3aXJlIHdpdGhvdXQgYmVpbmcgZXNjYXBlZC4KLSAgICAgICAgICAgICAgICAgKiBJIHRoaW5rIHRoaXMgaXMgdGhlIHByb3RvY29sJ3MgYnVnLCBub3QgdGhyaWZ0LmpzCi0gICAgICAgICAgICAgICAgICogfSBlbHNlIGlmKGNoID09PSAnLycpIHsgICAvLyBhIHNpbmdsZSBmb3J3YXJkIHNsYXNoOiAvCi0gICAgICAgICAgICAgICAgICogIGVzY2FwZWRTdHJpbmcgKz0gJ1xcLyc7ICAvLyB3cml0ZSBvdXQgYXMgXC8KLSAgICAgICAgICAgICAgICAgKiB9Ci0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xiJykgeyAgICAvLyBhIHNpbmdsZSBiYWNrc3BhY2U6IGludmlzaWJsZQotICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9ICdcXGInOyAgLy8gd3JpdGUgb3V0IGFzOiBcYiIKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXGYnKSB7ICAgIC8vIGEgc2luZ2xlIGZvcm1mZWVkOiBpbnZpc2libGUKLSAgICAgICAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxmJzsgIC8vIHdyaXRlIG91dCBhczogXGYiCi0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xuJykgeyAgICAvLyBhIHNpbmdsZSBuZXdsaW5lOiBpbnZpc2libGUKLSAgICAgICAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxuJzsgIC8vIHdyaXRlIG91dCBhczogXG4iCi0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xyJykgeyAgICAvLyBhIHNpbmdsZSByZXR1cm46IGludmlzaWJsZQotICAgICAgICAgICAgICAgICAgICBlc2NhcGVkU3RyaW5nICs9ICdcXHInOyAgLy8gd3JpdGUgb3V0IGFzOiBcciIKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXHQnKSB7ICAgIC8vIGEgc2luZ2xlIHRhYjogaW52aXNpYmxlCi0gICAgICAgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gJ1xcdCc7ICAvLyB3cml0ZSBvdXQgYXM6IFx0IgotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gY2g7ICAgICAvLyBFbHNlIGl0IG5lZWQgbm90IGJlIGVzY2FwZWQKLSAgICAgICAgICAgICAgICB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gIGlmIChmID09PSBudWxsKSB7Ci0gICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmaWQgPSBwYXJzZUludChmLCAxMCk7Ci0gICAgICAgICAgICB0aGlzLnJwb3MucHVzaCh0aGlzLnJzdGFjay5sZW5ndGgpOwotCi0gICAgICAgICAgICB2YXIgZmllbGQgPSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXVtmaWRdOwotCi0gICAgICAgICAgICAvL3JlbW92ZSBzbyB3ZSBkb24ndCBzZWUgaXQgYWdhaW4KLSAgICAgICAgICAgIGRlbGV0ZSB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGggLSAxXVtmaWRdOwotCi0gICAgICAgICAgICB0aGlzLnJzdGFjay5wdXNoKGZpZWxkKTsKLQotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoZmlkICE9IC0xKSB7Ci0KLSAgICAgICAgICAgIC8vc2hvdWxkIG9ubHkgYmUgMSBvZiB0aGVzZSBidXQgdGhpcyBpcyB0aGUgb25seQotICAgICAgICAgICAgLy93YXkgdG8gbWF0Y2ggYSBrZXkKLSAgICAgICAgICAgIGZvciAodmFyIGkgaW4gKHRoaXMucnN0YWNrW3RoaXMucnN0YWNrLmxlbmd0aCAtIDFdKSkgewotICAgICAgICAgICAgICAgIGlmIChUaHJpZnQuUHJvdG9jb2wuUlR5cGVbaV0gPT09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgZnR5cGUgPSBUaHJpZnQuUHJvdG9jb2wuUlR5cGVbaV07Ci0gICAgICAgICAgICAgICAgdGhpcy5yc3RhY2tbdGhpcy5yc3RhY2subGVuZ3RoIC0gMV0gPQotICAgICAgICAgICAgICAgICAgICB0aGlzLnJzdGFja1t0aGlzLnJzdGFjay5sZW5ndGgg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Ci0gICAgcmVhZEkxNjogZnVuY3Rpb24oKSB7Ci0gICAgICAgIHJldHVybiB0aGlzLnJlYWRJMzIoKTsKLSAgICB9LAotCi0gICAgcmVhZEkzMjogZnVuY3Rpb24oZikgewotICAgICAgICBpZiAoZiA9PT0gdW5kZWZpbmVkKSB7Ci0gICAgICAgICAgICBmID0gdGhpcy5yc3RhY2tbdGhpcy5yc3RhY2subGVuZ3RoIC0gMV07Ci0gICAgICAgIH0KLQotICAgICAgICB2YXIgciA9IHt9OwotCi0gICAgICAgIGlmIChmIGluc3RhbmNlb2YgQXJyYXkpIHsKLSAgICAgICAgICAgIGlmIChmLmxlbmd0aCA9PT0gMCkgewotICAgICAgICAgICAgICAgIHIudmFsdWUgPSB1bmRlZmluZWQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHIudmFsdWUgPSBmLnNoaWZ0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAoZiBpbnN0YW5jZW9mIE9iamVjdCkgewotICAgICAgICAgICBmb3IgKHZhciBpIGluIGYpIHsKLSAgICAgICAgICAgICAgICBpZiAoaSA9PT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHRoaXMucnN0YWNrLnB1c2goZltpXSk7Ci0gICAgICAgICAgICAgICAgZGVsZXRlIGZbaV07Ci0KLSAgICAgICAgICAgICAgICByLnZhbHVlID0gaTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgci52YWx1ZSA9IGY7Ci0gICAgICAgICAgICB0aGlzLnJzdGFjay5wb3AoKTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiByOwotICAgIH0sCi0KLSAgICByZWFkSTY0OiBmdW5jdGlvbigpIHsKLSAgICAgICAgcmV0dXJuIHRoaXMucmVhZEkzMigpOwotICAg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wLDAgKzEsMzQ0IEBACit7CisgICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCisKKyAgImlkIjogImh0dHA6Ly90aHJpZnQuYXBhY2hlLm9yZy9zY2hlbWEuanNvbiMiLAorICAiZGVzY3JpcHRpb24iOiAiU2NoZW1hIGZvciBBcGFjaGUgVGhyaWZ0IHByb3RvY29sIGRlc2NyaXB0b3JzIiwKKworICAiZGVmaW5pdGlvbnMiOiB7CisgICAgInR5cGUtaWQiOiB7CisgICAgICAidGl0bGUiOiAiQW55IHR5cGUgaWQgKG5hbWUpIiwKKyAgICAgICJlbnVtIjogWworICAgICAgICAidm9pZCIsCisgICAgICAgICJzdHJpbmciLAorICAgICAgICAiYm9vbCIsCisgICAgICAgICJieXRlIiwKKyAgICAgICAgImk4IiwKKyAgICAgICAgImkxNiIsCisgICAgICAgICJpMzIiLAorICAgICAgICAiaTY0IiwKKyAgICAgICAgImRvdWJsZSIsCisgICAgICAgICJsaXN0IiwKKyAgICAgICAgInNldCIsCisgICAgICAgICJtYXAiLAorICAgICAgICAidW5pb24iLAorICAgICAgICAic3RydWN0IiwKKyAgICAgICAgImJpbmFyeSIKKyAgICAgIF0KKyAgICB9LAorICAgICJiYXNlLXR5cGUiOiB7CisgICAgICAidGl0bGUiOiAiQmFzZSB0eXBlIHNjaGVtYSIsCisgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgInByb3BlcnRpZXMiOiB7CisgICAgICAgICJ0eXBlSWQiOiB7CisgICAgICAgICAgImVudW0iOiBbInZvaWQiLCAic3RyaW5nIiwgImJvb2wiLCAiYnl0ZSIsICJpOCIsICJpMTYiLCAiaTMyIiwgImk2NCIsICJkb3VibGUiLCAiYmluYXJ5IiBdCisgICAgICAgIH0KKyAgICAgIH0sCisgICAgICAicmVxdWlyZWQiOiBbICJ0eXBlSWQiIF0KKyAgICB9LAorICAgICJsaXN0LXR5cGUiOiB7CisgICAgICAidGl0bGUiOiAiTGlzdCBhbmQgc2V0IHNjaGVtYSIsCisgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgInByb3BlcnRpZXMiOiB7CisgICAgICAgICJ0eXBlSWQiOiB7CisgICAgICAgICAgImVudW0iOiBbICJsaXN0IiwgInNldCIgXQorICAgICAgICB9LAorICAgICAgICAiZWxlbVR5cGVJZCI6ICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvdHlwZS1pZCIgfSwKKyAgICAgICAgImVsZW1UeXBlIjogICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3R5cGUtZGVzYyIgfQorICAgICAgfSwKKyAgICAgICJyZXF1aXJlZCI6IFsgInR5cGVJZCIsICJlbGVtVHlwZUlkIiBdCisgICAgfSwKKyAgICAibWFwLXR5cGUiOiB7CisgICAgICAidGl0bGUiOiAiTWFwIHNjaGVtYSIsCisgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgInByb3BlcnRpZXMiOiB7CisgICAgICAgICJ0eXBlSWQiOiB7CisgICAgICAgICAgImVudW0iOiBbICJtYXAiIF0KKyAgICAgICAgfSwKKyAgICAgICAgImtleVR5cGVJZCI6ICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3R5cGUtaWQiIH0sCisgICAgICAgICJrZXlUeXBlIjogICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy90eXBlLWRlc2MiIH0sCisgICAgICAgICJ2YWx1ZVR5cGVJZCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy90eXBlLWlkIiB9LAorICAgICAgICAidmFsdWVUeXBlIjogICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvdHlwZS1kZXNjIiB9CisgICAgICB9LAorICAgICAgInJlcXVpcmVkIjogWyAidHlwZUlkIiwgImtleVR5cGVJZCIsICJ2YWx1ZVR5cGVJZCIgXQorICAgIH0sCisgICAgInN0cnVjdC10eXBlIjogeworICAgICAgInRpdGxlIjogIlN0cnVjdCwgdW5pb24gYW5kIGV4Y2VwdGlvbiBzY2hlbWEiLAorICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJwcm9wZXJ0aWVzIjogeworICAgICAgICAidHlwZUlkIjogeworICAgICAgICAgICJlbnVtIjogWyAidW5pb24iLCAic3RydWN0IiwgImV4Y2VwdGlvbiIgXQorICAgICAgICB9CisgICAgICB9LAorICAgICAgInJlcXVpcmVkIjogWyAidHlwZUlkIiwgImNsYXNzIiBdCisgICAgfSwKKyAgICAidHlwZS1kZXNjIjogeworICAgICAgInRpdGxlIjogIlR5cGUgZGVzY3JpcHRvciBzY2hlbWEiLAorICAgICAgImFsbE9mIjogWworICAgICAgICB7CisgICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgICAgICAgInByb3BlcnRpZXMiOiB7CisgICAgICAgICAgICAgICAgInR5cGVJZCI6ICAgICAgeyAidHlwZSI6ICJzdHJpbmciIH0sCisgICAgICAgICAgICAgICAgImNsYXNzIjogICAgICAgeyAidHlwZSI6ICJzdHJpbmciIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgICJvbmVPZiI6CisgICAgICAgICAgWworICAgICAgICAgICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL2Jhc2UtdHlwZSIgfSwKKyAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9saXN0LXR5cGUiIH0sCisgICAgICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvbWFwLXR5cGUiIH0sCisgICAgICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RydWN0LXR5cGUiIH0KKyAgICAgICAgICBdCisgICAgICAgIH0KKyAgICAgIF0KKyAgICB9LAorICAgICJuYW1lLWFuZC1kb2MiOiB7CisgICAgICAidGl0bGUiOiAiTmFtZSBhbmQgZG9jdW1lbnRhdGlvbiBzdWItc2NoZW1hIiwKKyAgICAgICJ0eXBlIjogIm9iamVjdCIsCisgICAgICAicHJvcGVydGllcyI6IHsKKyAgICAgICAgIm5hbWUiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKKyAgICAgICAgImRvYyI6IHsgInR5cGUiOiAic3RyaW5nIiB9CisgICAgICB9LAorICAgICAgInJlcXVpcmVkIjogWyAibmFtZSIgXQorICAgIH0sCisgICAgImVudW0iOiB7CisgICAgICAidGl0bGUiOiAiVGhyaWZ0ICdlbnVtJyBkZWZpbml0aW9uIHNjaGVtYSIsCisgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgImFsbE9mIjogWworICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvbmFtZS1hbmQtZG9jIiB9LAorICAgICAgICB7CisgICAgICAgICAgInJlcXVpcmVkIjogWyAibWVtYmVycyIgXSwKKyAgICAgICAgICAicHJvcGVydGllcyI6IHsKKyAgICAgICAgICAgICJtZW1iZXJzIjogeworICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIsCisgICAgICAgICAgICAgICJpdGVtcyI6IHsKKyAgICAgICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgICAgICAgICAgICJwcm9wZXJ0aWVzIjogeworICAgICAgICAgICAgICAgICAgIm5hbWUiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKKyAgICAgICAgICAgICAgICAgICJ2YWx1ZSI6IHsgInR5cGUiOiAiaW50ZWdlciIgfQorICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgInJlcXVpcmVkIjogWyAibmFtZSIsICJ2YWx1ZSIgXQorICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICBdCisgICAgfSwKKyAgICAidHlwZWRlZiI6IHsKKyAgICAgICJ0aXRsZSI6ICJUaHJpZnQgdHlwZWRlZiBkZWZpbml0aW9uIHNjaGVtYSIsCisgICAgICAidHlwZSI6ICJvYmplY3QiLAorICAgICAgImFsbE9mIjogWworICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvbmFtZS1hbmQtZG9jIiB9LAorICAgICAgICB7CisgICAgICAgICAgInByb3BlcnRpZXMiOiB7CisgICAgICAgICAgICAidHlwZUlkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3R5cGUtaWQiIH0sCisgICAgICAgICAgICAidHlwZSI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy90eXBlLWRlc2MiIH0KKyAgICAgICAgICB9LAorICAgICAgICAgICJyZXF1aXJlZCI6IFsgInR5cGVJZCIgXQorICAgICAgICB9CisgICAgICBdCisgICAgfSwKKyAgICAiY29uc3RhbnQiOiB7CisgICAgICAidGl0bGUiOiAiVGhyaWZ0IGNvbnN0YW50IGRlZmluaXRpb24gc2NoZW1hIiwKKyAgICAgICJ0eXBlIjogIm9iamVjdCIsCisgICAgICAiYWxsT2YiOiBbCisgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9uYW1lLWFuZC1kb2MiIH0sCisgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy90eXBlLWRlc2MiIH0sCisgICAgICAgIHsKKyAgICAgICAgICAicHJvcGVydGllcyI6IHsKKyAgICAgICAgICAgICJ2YWx1ZSI6IHsKKyAgICAgICAgICAgICAgIm9uZU9mIjogWworICAgICAgICAgICAgICAgIHsgInR5cGUiOiAic3RyaW5nIiB9LAorICAgICAgICAgICAgICAgIHsgInR5cGUiOiAibnVtYmVyIiB9LAorICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYXJyYXkiIH0sCisgICAgICAgICAgICAgICAgeyAidHlwZSI6ICJvYmplY3QiIH0KKyAgICAgICAgICAgICAgXQorICAgICAgICAgICAgfQorICAgICAgICAgIH0sCisgICAgICAgICAgInJlcXVpcmVkIjogWyAidmFsdWUiIF0KKyAgICAgICAgfQorICAgICAgXQorICAgIH0sCisgICAgImZpZWxkIjogeworICAgICAgInRpdGxlIjogIlRocmlmdCBzdHJ1Y3QgZmllbGQgZGVmaW5pdGlvbiBzY2hlbWEiLAorICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJhbGxPZiI6IFsKKyAgICAgICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL25hbWUtYW5kLWRvYyIgfSwKKyAgICAgICAgeworICAgICAgICAgICJwcm9wZXJ0aWVzIjogeworICAgICAgICAgICAgImtleSI6IHsKKyAgICAgICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIsCisgICAgICAgICAgICAgICJtaW5pbXVtIjogMSwKKyAgICAgICAgICAgICAgIm1heGltdW0iOiA2NTUzNQorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICJyZXF1aXJlZCI6IHsKKyAgICAgICAgICAgICAgImVudW0iOiBbICJyZXF1aXJlZCIsICJvcHRpb25hbCIsICJyZXFfb3V0IiBdCisgICAgICAgICAgICB9LAorICAgICAgICAgICAgInR5cGVJZCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy90eXBlLWlkIiB9LAorICAgICAgICAgICAgInR5cGUiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvdHlwZS1kZXNjIiB9LAorICAgICAgICAgICAgImRlZmF1bHQiOiB7CisgICAgICAgICAgICAgICJvbmVPZiI6IFsKKyAgICAgICAgICAgICAgICB7ICJ0eXBlIjogInN0cmluZyIgfSwKKyAgICAgICAgICAgICAgICB7ICJ0eXBlIjogIm51bWJlciIgfSwKKyAgICAgICAgICAgICAgICB7ICJ0eXBlIjogImFycmF5IiB9LAorICAgICAgICAgICAgICAgIHsgInR5cGUiOiAib2JqZWN0IiB9CisgICAgICAgICAgICAgIF0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9LAorICAgICAgICAgICJyZXF1aXJlZCI6IFsgImtleSIsICJyZXF1aXJlZCIgXQorICAgICAgICB9CisgICAgICBdCisgICAgfSwKKyAgICAic3RydWN0IjogeworICAgICAgInRpdGxlIjogIlRocmlmdCBzdHJ1Y3QgZGVmaW5pdGlvbiBzY2hlbWEiLAorICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJhbGxPZiI6IFsKKyAgICAgICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL25hbWUtYW5kLWRvYyIgfSwKKyAgICAgICAgeworICAgICAgICAgICJwcm9wZXJ0aWVzIjogeworICAgICAgICAgICAgImlzRXhjZXB0aW9uIjogeyAidHlwZSI6ICJib29sZWFuIiB9LAorICAgICAgICAgICAgImlzVW5pb24iOiB7ICJ0eXBlIjogImJvb2xlYW4iIH0sCisgICAgICAgICAgICAiZmllbGRzIjogeworICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIsCisgICAgICAgICAgICAgICJpdGVtcyI6IHsKKyAgICAgICAgICAgICAgICAiJHJlZiI6ICIjL2RlZmluaXRpb25zL2ZpZWxkIgorICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgfSwKKyAgICAgICAgICAicmVxdWlyZWQiOiBbICJpc0V4Y2VwdGlvbiIsICJpc1VuaW9uIiwgImZpZWxkcyIgXQorICAgICAgICB9CisgICAgICBdCisgICAgfSwKKyAgICAidW5pb24iOiB7CisgICAgICAidGl0bGUiOiAiVGhyaWZ0IHVuaW9uIGRlZmluaXRpb24gc2NoZW1hIiwKKyAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RydWN0IgorICAgIH0sCisgICAgImV4Y2VwdGlvbiI6IHsKKyAgICAgICJ0aXRsZSI6ICJUaHJpZnQgZXhjZXB0aW9uIGRlZmluaXRpb24gc2NoZW1hIiwKKyAgICAgICJ0eXBlIjogIm9iamVjdCIsCisgICAgICAicHJvcGVydGllcyI6IHsKKyAgICAgICAgImtleSI6IHsKKyAgICAgICAgICAidHlwZSI6ICJpbnRlZ2VyIiwKKyAgICAgICAgICAibWluaW11bSI6IDEsCisgICAgICAgICAgIm1heGltdW0iOiA2NTUzNQorICAgICAgICB9LAorICAgICAgICAibmFtZSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAorICAgICAgICAidHlwZUlkIjogeyAiZW51bSI6IFsgImV4Y2VwdGlvbiIgXSB9LAorICAgICAgICAidHlwZSI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zdHJ1Y3QtdHlwZSIgfQorICAgICAgfSwKKyAgICAgICJyZXF1aXJlZCI6IFsgImtleSIsICJuYW1lIiwgInR5cGVJZCIgXQorICAgIH0sCisgICAgImZ1bmN0aW9uIjogeworICAgICAgInRpdGxlIjogIlRocmlmdCBzZXJ2aWNlIGZ1bmN0aW9uIGRlZmluaXRpb24gc2NoZW1hIiwKKyAgICAgICJ0eXBlIjogIm9iamVjdCIsCisgICAgICAiYWxsT2YiOiBbCisgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9uYW1lLWFuZC1kb2MiIH0sCisgICAgICAgIHsKKyAgICAgICAgICAicHJvcGVydGllcyI6IHsKKyAgICAgICAgICAgICJvbmV3YXkiOiB7CisgICAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iCisgICAgICAgICAgICB9LAorICAgICAgICAgICAgInJldHVyblR5cGUiOiB7CisgICAgICAgICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvdHlwZS1kZXNjIgorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICJhcmd1bWVudHMiOiB7CisgICAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKKyAgICAgICAgICAgICAgIml0ZW1zIjogeworICAgICAgICAgICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvZmllbGQiCisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICAiZXhjZXB0aW9ucyI6IHsKKyAgICAgICAgICAgICAgInR5cGUiOiAiYXJyYXkiLAorICAgICAgICAgICAgICAiaXRlbXMiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvZXhjZXB0aW9uIiB9CisgICAgICAgICAgICB9CisgICAgICAgICAgfSwKKyAgICAgICAgICAicmVxdWlyZWQiOiBbICJvbmV3YXkiLCAiYXJndW1lbnRzIiwgImV4Y2VwdGlvbnMiIF0KKyAgICAgICAgfQorICAgICAgXQorICAgIH0sCisgICAgInNlcnZpY2UiOiB7CisgICAgICAidGl0bGUiOiAiVGhyaWZ0IHNlcnZpY2UgZGVmaW5pdGlvbiBzY2hlbWEiLAorICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJhbGxPZiI6IFsKKyAgICAgICAgeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL25hbWUtYW5kLWRvYyIgfSwKKyAgICAgICAgeworICAgICAgICAgICJwcm9wZXJ0aWVzIjogeworICAgICAgICAgICAgImZ1bmN0aW9ucyI6IHsKKyAgICAgICAgICAgICAgInR5cGUiOiAiYXJyYXkiLAorICAgICAgICAgICAgICAiaXRlbXMiOiB7CisgICAgICAgICAgICAgICAgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9mdW5jdGlvbiIKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgIH0sCisgICAgICAgICAgInJlcXVpcmVkIjogWyAiZnVuY3Rpb25zIiBdCisgICAgICAgIH0KKyAgICAgIF0KKyAgICB9LAorICAgICJhbm5vdGF0aW9ucyI6IHsKKyAgICAgICJ0aXRsZSI6ICJNYXAgb2YgYW5ub3RhdGlvbiBuYW1lcyB0byB2YWx1ZXMiLAorICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJhZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKKyAgICAgICAgInR5cGUiOiAic3RyaW5nIgorICAgICAgfQorICAgIH0KKyAgfSwKKworICAidHlwZSI6ICJvYmplY3QiLAorICAicmVxdWlyZWQiOiBbCisgICAgIm5hbWUiLAorICAgICJlbnVtcyIsCisgICAgInR5cGVkZWZzIiwKKyAgICAic3RydWN0cyIsCisgICAgImNvbnN0YW50cyIsCisgICAgInNlcnZpY2VzIgorICBdLAorICAicHJvcGVydGllcyI6IHsKKyAgICAibmFtZSI6IHsKKyAgICAgICJ0eXBlIjogInN0cmluZyIKKyAgICB9LAorICAgICJpbmNsdWRlcyI6IHsKKyAgICAgICJ0eXBlIjogImFycmF5IiwKKyAgICAgICJpdGVtcyI6IHsKKyAgICAgICAgInR5cGUiOiAic3RyaW5nIgorICAgICAgfSwKKyAgICAgICJ1bmlxdWVJdGVtcyI6IHRydWUKKyAgICB9LAorICAgICJuYW1lc3BhY2VzIjogeworICAgICAgInR5cGUiOiAib2JqZWN0IiwKKyAgICAgICJhZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKKyAgICAgICAgInR5cGUiOiAic3RyaW5nIgorICAgICAgfQorICAgIH0sCisgICAgImVudW1zIjogeworICAgICAgInR5cGUiOiAiYXJyYXkiLAorICAgICAgIml0ZW1zIjogeworICAgICAgICAiJHJlZiI6ICIjL2RlZmluaXRpb25zL2VudW0iCisgICAgICB9CisgICAgfSwKKyAgICAidHlwZWRlZnMiOiB7CisgICAgICAidHlwZSI6ICJhcnJheSIsCisgICAgICAiaXRlbXMiOiB7CisgICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvdHlwZWRlZiIKKyAgICAgIH0KKyAgICB9LAorICAgICJzdHJ1Y3RzIjogeworICAgICAgInR5cGUiOiAiYXJyYXkiLAorICAgICAgIml0ZW1zIjogeworICAgICAgICAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cnVjdCIKKyAgICAgIH0KKyAgICB9LAorICAgICJjb25zdGFudHMiOiB7CisgICAgICAidHlwZSI6ICJhcnJheSIsCisgICAgICAiaXRlbXMiOiB7CisgICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvY29uc3RhbnQiCisgICAgICB9CisgICAgfSwKKyAgICAic2VydmljZXMiOiB7CisgICAgICAidHlwZSI6ICJhcnJheSIsCisgICAgICAiaXRlbXMiOiB7CisgICAgICAgICIkcmVmI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maXggPSAiXFx1MDAiCit9CisKK0VzY2FwZUNoYXJWYWxzID0geworICAnIicsICdcXCcsICdcYicsICdcZicsICdcbicsICdccicsICdcdCcKK30KKworSlNPTkNoYXJUYWJsZSA9IHsKKyAgLS0wICAgMSAgIDIgICAzICAgNCAgIDUgICA2ICAgNyAgIDggICA5ICAgQSAgIEIgICBDICAgRCAgIEUgICBGCisgICAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsIDk4LDExNiwxMTAsICAwLDEwMiwxMTQsICAwLCAgMCwKKyAgICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLCAgMCwgIDAsICAwLAorICAgIDEsICAxLDM0LCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAgMSwgIDEsICAxLCAgMSwKK30KKworLS0gY2hhcmFjdGVyIHRhYmxlIHN0cmluZworbG9jYWwgYj0nQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLycKKworLS0gZW5jb2RpbmcKK2Z1bmN0aW9uIGJhc2U2NF9lbmNvZGUoZGF0YSkKKyAgICByZXR1cm4gKChkYXRhOmdzdWIoJy4nLCBmdW5jdGlvbih4KSAKKyAgICAgICAgbG9jYWwgcixiPScnLHg6Ynl0ZSgpCisgICAgICAgIGZvciBpPTgsMSwtMSBkbyByPXIuLihiJTJeaS1iJTJeKGktMSk+MCBhbmQgJzEnIG9yICcwJykgZW5kCisgICAgICAgIHJldHVybiByOworICAgIGVuZCkuLicwMDAwJyk6Z3N1YignJWQlZCVkPyVkPyVkPyVkPycsIGZ1bmN0aW9uKHgpCisgICAgICAgIGlmICgjeCA8IDYpIHRoZW4gcmV0dXJuICcnIGVuZAorICAgICAgICBsb2NhbCBjPTAKKyAgICAgICAgZm9yIGk9MSw2IGRvIGM9YysoeDpzdWIoaSxpKT09Jz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dFB1c2goY29udGV4dCkKKyAgc2VsZi5qc29uQ29udGV4dEluZGV4ID0gc2VsZi5qc29uQ29udGV4dEluZGV4ICsgMQorICBzZWxmLmpzb25Db250ZXh0W3NlbGYuanNvbkNvbnRleHRJbmRleF0gPSBzZWxmLmpzb25Db250ZXh0VmFsCisgIHNlbGYuanNvbkNvbnRleHRWYWwgPSBjb250ZXh0CitlbmQKKworZnVuY3Rpb24gVEpTT05Qcm90b2NvbDpjb250ZXh0UG9wKCkKKyAgc2VsZi5qc29uQ29udGV4dFZhbCA9IHNlbGYuanNvbkNvbnRleHRbc2VsZi5qc29uQ29udGV4dEluZGV4XQorICBzZWxmLmpzb25Db250ZXh0SW5kZXggPSBzZWxmLmpzb25Db250ZXh0SW5kZXggLSAxCitlbmQKKworZnVuY3Rpb24gVEpTT05Qcm90b2NvbDplc2NhcGVOdW0oKQorICBpZiBzZWxmLmpzb25Db250ZXh0VmFsLnR0eXBlID09IDEgdGhlbgorICAgIHJldHVybiBzZWxmLmpzb25Db250ZXh0VmFsLmNvbG9uCisgIGVsc2UKKyAgICByZXR1cm4gZmFsc2UKKyAgZW5kCitlbmQKKworZnVuY3Rpb24gVEpTT05Qcm90b2NvbDp3cml0ZUVsZW1TZXBhcmF0b3IoKQorICBpZiBzZWxmLmpzb25Db250ZXh0VmFsLm51bGwgdGhlbgorICAgIHJldHVybgorICBlbmQKKyAgaWYgc2VsZi5qc29uQ29udGV4dFZhbC5maXJzdCB0aGVuCisgICAgc2VsZi5qc29uQ29udGV4dFZhbC5maXJzdCA9IGZhbHNlCisgIGVsc2UKKyAgICBpZiBzZWxmLmpzb25Db250ZXh0VmFsLnR0eXBlID09IDEgdGhlbgorICAgICAgaWYgc2VsZi5qc29uQ29udGV4dFZhbC5jb2xvbiB0aGVuCisgICAgICAgIHNlbGYudHJhbnM6d3JpdGUoSlNPTk5vZGUuUGFpclNlcGFyYXRvcikKKyAgICAgICAgc2VsZi5qc29uQ29udGV4dFZhbC5jb2xvbiA9IG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TaWduZWQgTG9uZworICogIGQgLSBEb3VibGUKKyAqLworc3RhdGljIGludCBsX2JwYWNrKGx1YV9TdGF0ZSAqTCkgeworICBjb25zdCBjaGFyICpjb2RlID0gbHVhTF9jaGVja3N0cmluZyhMLCAxKTsKKyAgbHVhTF9hcmdjaGVjayhMLCBjb2RlWzFdID09ICdcMCcsIDAsICJGb3JtYXQgY29kZSBtdXN0IGJlIG9uZSBjaGFyYWN0ZXIuIik7CisgIGx1YUxfQnVmZmVyIGJ1ZjsKKyAgbHVhTF9idWZmaW5pdChMLCAmYnVmKTsKKworICBzd2l0Y2ggKGNvZGVbMF0pIHsKKyAgICBjYXNlICdjJzogeworICAgICAgaW50OF90IGRhdGEgPSBsdWFMX2NoZWNrbnVtYmVyKEwsIDIpOworICAgICAgbHVhTF9hZGRsc3RyaW5nKCZidWYsICh2b2lkKikmZGF0YSwgc2l6ZW9mKGRhdGEpKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlICdzJzogeworICAgICAgaW50MTZfdCBkYXRhID0gbHVhTF9jaGVja251bWJlcihMLCAyKTsKKyAgICAgIGRhdGEgPSAoaW50MTZfdClodG9ucyhkYXRhKTsKKyAgICAgIGx1YUxfYWRkbHN0cmluZygmYnVmLCAodm9pZCopJmRhdGEsIHNpemVvZihkYXRhKSk7CisgICAgICBicmVhazsKKyAgICB9CisgICAgY2FzZSAnaSc6IHsKKyAgICAgIGludDMyX3QgZGF0YSA9IGx1YUxfY2hlY2tpbnRlZ2VyKEwsIDIpOworICAgICAgZGF0YSA9IChpbnQzMl90KWh0b25sKGRhdGEpOworICAgICAgbHVhTF9hZGRsc3RyaW5nKCZidWYsICh2b2lkKikmZGF0YSwgc2l6ZW9mKGRhdGEpKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlICdsJzogeworICAgICAgaW50NjRfdCBkYXRhID0gbHVhbG9uZ251bWJlcl9jaGVja2xvbmcoTCwgMik7CisgICAgICBkYXRhID0gKGludDY0X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KyNlbmRpZgorCisgIHN3aXRjaCAoY29kZVswXSkgeworICAgIGNhc2UgJ2MnOiB7CisgICAgICBpbnQ4X3QgdmFsOworICAgICAgbHVhTF9hcmdjaGVjayhMLCBsZW4gPT0gc2l6ZW9mKHZhbCksIDEsICJJbnZhbGlkIGlucHV0IHN0cmluZyBzaXplLiIpOworICAgICAgbWVtY3B5KCZ2YWwsIGRhdGEsIHNpemVvZih2YWwpKTsKKyAgICAgIGx1YV9wdXNobnVtYmVyKEwsIHZhbCk7CisgICAgICBicmVhazsKKyAgICB9CisgICAgLyoqCisgICAgICogdW5wYWNrIHVuc2lnbmVkIEJ5dGUuCisgICAgICovCisgICAgY2FzZSAnQyc6IHsKKyAgICAgIHVpbnQ4X3QgdmFsOworICAgICAgbHVhTF9hcmdjaGVjayhMLCBsZW4gPT0gc2l6ZW9mKHZhbCksIDEsICJJbnZhbGlkIGlucHV0IHN0cmluZyBzaXplLiIpOworICAgICAgbWVtY3B5KCZ2YWwsIGRhdGEsIHNpemVvZih2YWwpKTsKKyAgICAgIGx1YV9wdXNobnVtYmVyKEwsIHZhbCk7CisgICAgICBicmVhazsKKyAgICB9CisgICAgY2FzZSAncyc6IHsKKyAgICAgIGludDE2X3QgdmFsOworICAgICAgbHVhTF9hcmdjaGVjayhMLCBsZW4gPT0gc2l6ZW9mKHZhbCksIDEsICJJbnZhbGlkIGlucHV0IHN0cmluZyBzaXplLiIpOworICAgICAgbWVtY3B5KCZ2YWwsIGRhdGEsIHNpemVvZih2YWwpKTsKKyAgICAgIHZhbCA9IChpbnQxNl90KW50b2hzKHZhbCk7CisgICAgICBsdWFfcHVzaG51bWJlcihMLCB2YWwpOworICAgICAgYnJlYWs7CisgICAgfQorICAgIGNhc2UgJ2knOiB7CisgICAgICBpbnQzMl90IHZhbDsKKyAgICAgIGx1YUxfYXJnY2hlY2soTCwgbGVuID09IHNpemVvZih2YWwpLCAxLCAiSW52YWxpZCBpbnB1dCBzdHJpbmcgc2l6ZS4iKTsKKyAgICAgIG1lbWNweSgmdmFsLCBkYXRhLCBzaXplb2YodmFsKSk7CisgICAgICB2YWwgPSAoaW50MzJfdCludG9obCh2YWwpOworICAgICAgbHVhX3B1c2hudW1iZXIoTCwgdmFsKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBjYXNlICdsJzogeworICAgICAgaW50NjRfdCB2YWw7CisgICAgICBsdWFMX2FyZ2NoZWNrKEwsIGxlbiA9PSBzaXplb2YodmFsKSwgMSwgIkludmFsaWQgaW5wdXQgc3RyaW5nIHNpemUuIik7CisgICAgICBtZW1jcHkoJnZhbCwgZGF0YSwgc2l6ZW9mKHZhbCkpOworICAgICAgdmFsID0gKGludDY0X3QpVF9udG9obGwodmFsKTsKKyAgICAgIGx1YWxvbmdudW1iZXJfcHVzaGxvbmcoTCwgJnZhbCk7CisgICAgICBicmVhazsKKyAgICB9CisgICAgY2FzZSAnZCc6IHsKKyAgICAgIGRvdWJsZSB2YWw7CisgICAgICBsdWFMX2FyZ2NoZWNrKEwsIGxlbiA9PSBzaXplb2YodmFsKSwgMSwgIkludmFsaWQgaW5wdXQgc3RyaW5nIHNpemUuIik7CisgICAgICBtZW1jcHkoJnZhbCwgZGF0YSwgc2l6ZW9mKHZhbCkpOworICAgICAgbHVhX3B1c2hudW1iZXIoTCwgdmFsKTsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBkZWZhdWx0OgorICAgICAgbHVhTF9hcmdjaGVjayhMLCAwLCAwLCAiSW52YWxpZCBmb3JtYXQgY29kZS4iKTsKKyAgfQorICByZXR1cm4gMTsKK30KKworLyoqCisgKiBDb252ZXJ0IGwgaW50byBhIHppZ3phZyBsb25nLiBUaGlzIGFsbG93cyBuZWdhdGl2ZSBudW1iZXJzIHRvIGJlCisgKiByZXByZXNlbnRlZCBjb21wYWN0bHkgYXMgYSB2YXJpbnQuCisgKi8KK3N0YXRpYyBpbnQgbF9pNjRUb1ppZ3phZyhsdWFfU3RhdGUgKkwpIHsKKyAgaW50NjRfdCBuID0gbHVhbG9uZ251bWJlcl9jaGVja2xvbmcoTCwgMSk7CisgIGludDY0X3QgcmVzdWx0ID0gKG4gPDwgMSkgXiAobiA+PiA2Myk7CisgIGx1YWxvbmdudW1iZXJfcHVzaGxvbmcoTCwgJnJlc3VsdCk7CisgIHJldHVybiAxOworfQorLyoqCisgKiBDb252ZXJ0IG4gaW50byBhIHppZ3phZyBpbnQuIFRoaXMgYWxsb3dzIG5lZ2F0aXZlIG51bWJlcnMgdG8gYmUKKyAqIHJlcHJlc2VudGVkIGNvbXBhY3RseSBhcyBhIHZhcmludC4KKyAqLworc3RhdGljIGludCBsX2kzMlRvWmlnemFnKGx1YV9TdGF0ZSAqTCkgeworICBpbnQzMl90IG4gPSBsdWFMX2NoZWNraW50ZWdlcihMLCAxKTsKKyAgdWludDMyX3QgcmVzdWx0ID0gKHVpbnQzMl90KShuIDw8IDEpIF4gKG4gPj4gMzEpOworICBsdWFfcHVzaG51bWJlcihMLCByZXN1bHQpOworICByZXR1cm4gMTsKK30KKworLyoqCisgKiBDb252ZXJ0IGZyb20gemlnemFnIGludCB0byBpbnQuCisgKi8KK3N0YXRpYyBpbnQgbF96aWd6YWdUb0kzMihsdWFfU3RhdGUgKkwpIHsKKyAgdWludDMyX3QgbiA9IGx1YUxfY2hlY2tpbnRlZ2VyKEwsIDEpOworICBpbnQzMl90IHJlc3VsdCA9IChpbnQzMl90KShuID4+IDEpIF4gKHVpbnQzMl90KSgtKGludDMyX3QpKG4gJiAxKSk7CisgIGx1YV9wdXNobnVtYmVyKEwsIHJlc3VsdCk7CisgIHJldHVybiAxOworfQorCisvKioKKyAqIENvbnZlcnQgZnJvbSB6aWd6YWcgbG9uZyB0byBsb25nLgorICovCitzdGF0aWMgaW50IGxfemlnemFnVG9JNjQobHVhX1N0YXRlICpMKSB7CisgIGludDY0X3QgbiA9IGx1YWxvbmdudW1iZXJfY2hlY2tsb25nKEwsIDEpOworICBpbnQ2NF90IHJlc3VsdCA9IChpbnQ2NF90K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DApIHsKKyAgICAgIGRhdGFbd3NpemUrK10gPSAoaW50OF90KW47CisgICAgICBicmVhazsKKyAgICB9IGVsc2UgeworICAgICAgZGF0YVt3c2l6ZSsrXSA9IChpbnQ4X3QpKChuICYgMHg3RikgfCAweDgwKTsKKyAgICAgIG4gPj49IDc7CisgICAgfQorICB9CisKKyAgbHVhTF9hZGRsc3RyaW5nKCZidWYsICh2b2lkKikmZGF0YSwgd3NpemUpOworICBsdWFMX3B1c2hyZXN1bHQoJmJ1Zik7CisgIHJldHVybiAxOworfQorCisvKioKKyAqIENvbnZlcnQgYSB2YXJpbnQgdG8gaTY0LgorICovCitzdGF0aWMgaW50IGxfZnJvbVZhcmludDY0KGx1YV9TdGF0ZSAqTCkgeworICBpbnQ2NF90IHJlc3VsdDsKKyAgdWludDhfdCBieXRlID0gbHVhTF9jaGVja251bWJlcihMLCAxKTsKKyAgaW50MzJfdCBzaGlmdCA9IGx1YUxfY2hlY2tudW1iZXIoTCwgMik7CisgIHVpbnQ2NF90IG4gPSAodWludDY0X3QpbHVhbG9uZ251bWJlcl9jaGVja2xvbmcoTCwgMyk7CisgIG4gfD0gKHVpbnQ2NF90KShieXRlICYgMHg3ZikgPDwgc2hpZnQ7CisKKyAgaWYgKCEoYnl0ZSAmIDB4ODApKSB7CisgICAgcmVzdWx0ID0gKGludDY0X3QpKG4gPj4gMSkgXiAodWludDY0X3QpKC0oaW50NjRfdCkobiAmIDEpKTsKKyAgICBsdWFfcHVzaG51bWJlcihMLCAwKTsKKyAgfSBlbHNlIHsKKyAgICByZXN1bHQgPSBuOworICAgIGx1YV9wdXNobnVtYmVyKEwsIDEpOworICB9CisgIGx1YWxvbmdudW1iZXJfcHVzaGxvbmcoTCwgJnJlc3VsdCk7CisgIHJldHVybiAyOworfQorCisvKioKKyAqIFRvIHBhY2sgbWVzc2FnZSB0eXBlIG9mIGNvbXBhY3QgcHJvdG9jb2wuCisgKi8KK3N0YXRpYyBpbnQgbF9wYWNrTWVzZ1R5cGUob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HNvY2ssIGNoYXIgKmRhdGEsIHNpemVfdCBsZW4sIGludCB0aW1lb3V0LAorICAgICAgICAgICAgICAgICAgICAgIGludCAqcmVjZWl2ZWQpOworCitUX0VSUkNPREUgc29ja2V0X3NldGJsb2NraW5nKHBfc29ja2V0IHNvY2spOworVF9FUlJDT0RFIHNvY2tldF9zZXRub25ibG9ja2luZyhwX3NvY2tldCBzb2NrKTsKKworVF9FUlJDT0RFIHNvY2tldF9hY2NlcHQocF9zb2NrZXQgc29jaywgcF9zb2NrZXQgc2libGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgIHBfc2EgYWRkciwgc29ja2xlbl90ICphZGRyX2xlbiwgaW50IHRpbWVvdXQpOworVF9FUlJDT0RFIHNvY2tldF9saXN0ZW4ocF9zb2NrZXQgc29jaywgaW50IGJhY2tsb2cpOworCitUX0VSUkNPREUgc29ja2V0X2Nvbm5lY3QocF9zb2NrZXQgc29jaywgcF9zYSBhZGRyLCBpbnQgYWRkcl9sZW4sIGludCB0aW1lb3V0KTsKKworY29uc3QgY2hhciAqIHRjcF9jcmVhdGUocF9zb2NrZXQgc29jayk7Citjb25zdCBjaGFyICogdGNwX2Rlc3Ryb3kocF9zb2NrZXQgc29jayk7Citjb25zdCBjaGFyICogdGNwX2JpbmQocF9zb2NrZXQgc29jaywgY29uc3QgY2hhciAqaG9zdCwgdW5zaWduZWQgc2hvcnQgcG9ydCk7Citjb25zdCBjaGFyICogdGNwX3NlbmQocF9zb2NrZXQgc29jaywgY29uc3QgY2hhciAqZGF0YSwgc2l6ZV90IHdfbGVuLAorICAgICAgICAgICAgICAgICAgICAgIGludCB0aW1lb3V0KTsKK2NvbnN0IGNoYXIgKiB0Y3BfcmVjZWl2ZShwX3NvY2tldCBzb2NrLCBjaGFyICpkYXRhLCBzaXplX3Qgcl9sZW4sIGludCB0aW1lb3V0KTsKK2NvbnN0IGNoYXIgKiB0Y3BfcmF3X3JlY2VpdmUocF9zb2NrZXQgc29jaywgY2hhciAqIGRhd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RVNTOworICAgIH0KKyAgfSB3aGlsZSAoKGVyciA9IGVycm5vKSA9PSBFSU5UUik7CisKKyAgaWYgKGVyciA9PSBFQUdBSU4gfHwgZXJyID09IEVDT05OQUJPUlRFRCkgeworICAgIHJldHVybiBzb2NrZXRfd2FpdChzb2NrLCBXQUlUX01PREVfUiwgdGltZW91dCk7CisgIH0KKworICByZXR1cm4gZXJyOworfQorCitUX0VSUkNPREUgc29ja2V0X2xpc3RlbihwX3NvY2tldCBzb2NrLCBpbnQgYmFja2xvZykgeworICBpbnQgcmV0ID0gc29ja2V0X3NldGJsb2NraW5nKHNvY2spOworICBpZiAocmV0ICE9IFNVQ0NFU1MpIHsKKyAgICByZXR1cm4gcmV0OworICB9CisgIGlmIChsaXN0ZW4oKnNvY2ssIGJhY2tsb2cpKSB7CisgICAgcmV0ID0gZXJybm87CisgIH0KKyAgaW50IHJldDIgPSBzb2NrZXRfc2V0bm9uYmxvY2tpbmcoc29jayk7CisgIHJldHVybiByZXQgPT0gU1VDQ0VTUyA/IHJldDIgOiByZXQ7Cit9CisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisvLyBDbGllbnQKKworVF9FUlJDT0RFIHNvY2tldF9jb25uZWN0KHBfc29ja2V0IHNvY2ssIHBfc2EgYWRkciwgaW50IGFkZHJfbGVuLCBpbnQgdGltZW91dCkgeworICBpbnQgZXJyOworICBpZiAoKnNvY2sgPCAwKSB7CisgICAgcmV0dXJuIENMT1NFRDsKKyAgfQorCisgIGRvIHsKKyAgICBpZiAoY29ubmVjdCgqc29jaywgYWRkciwgYWRkcl9sZW4pID09IDApIHsKKyAgICAgIHJldHVybiBTVUNDRVNTOworICAgIH0KKyAgfSB3aGlsZSAoKGVyciA9IGVycm5vKSA9PSBFSU5UUik7CisgIGlmIChlcnIgIT0gRUlOUFJPR1JFU1MgJiYgZXJyICE9IEVBR0FJTikgeworICAgIHJldHVybiBlcnI7CisgIH0KKyAgcmV0dXJuIHNvY2tldF93YWl0KHNvY2ssIFdBSVRfTU9ERV9DLCB0aW1lb3V0KTsKK30KKworVF9FUlJDT0RFIHNvY2tldF9zZW5kKAorICBwX3NvY2tldCBzb2NrLCBjb25zdCBjaGFyICpkYXRhLCBzaXplX3QgbGVuLCBpbnQgdGltZW91dCkgeworICBpbnQgZXJyLCBwdXQgPSAwOworICBpZiAoKnNvY2sgPCAwKSB7CisgICAgcmV0dXJuIENMT1NFRDsKKyAgfQorICBkbyB7CisgICAgcHV0ID0gc2VuZCgqc29jaywgZGF0YSwgbGVuLCAwKTsKKyAgICBpZiAocHV0ID4gMCkgeworICAgICAgcmV0dXJuIFNVQ0NFU1M7CisgICAgfQorICB9IHdoaWxlICgoZXJyID0gZXJybm8pID09IEVJTlRSKTsKKworICBpZiAoZXJyID09IEVBR0FJTikgeworICAgIHJldHVybiBzb2NrZXRfd2FpdChzb2NrLCBXQUlUX01PREVfVywgdGltZW91dCk7CisgIH0KKworICByZXR1cm4gZXJyOworfQorCitUX0VSUkNPREUgc29ja2V0X3JlY3YoCisgIHBfc29ja2V0IHNvY2ssIGNoYXIgKmRhdGEsIHNpemVfdCBsZW4sIGludCB0aW1lb3V0LCBpbnQgKnJlY2VpdmVkKSB7CisgIGludCBlcnIsIGdvdCA9IDA7CisgIGlmICgqc29jayA8IDApIHsKKyAgICByZXR1cm4gQ0xPU0VEOworICB9CisgICpyZWNlaXZlZCA9IDA7CisKKyAgZG8geworICAgIGdvdCA9IHJlY3YoKnNvY2ssIGRhdGEsIGxlbiwgMCk7CisgICAgaWYgKGdvdCA+IDApIHsKKyAgICAgICpyZWNlaXZlZCA9IGdvdDsKKyAgICAgIHJldHVybiBTVUNDRVNTOworICAgIH0KKyAgICBlcnIgPSBlcnJubzsKKworICAgIC8vIENvbm5lY3Rpb24gaGFzIGJlZW4gY2xvc2VkIGJ5IHBlZXIKKyAgICB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kZHIsCisgICAgICAgICAgIChzdHJ1Y3QgaW5fYWRkciAqKWgtPmhfYWRkcl9saXN0WzBdLAorICAgICAgICAgICBzaXplb2Yoc3RydWN0IGluX2FkZHIpKTsKKyAgfQorICBlcnIgPSBzb2NrZXRfYmluZChzb2NrLCAocF9zYSkgJmxvY2FsLCBzaXplb2YobG9jYWwpKTsKKyAgRVJST1JTVFJfUkVUVVJOKGVycik7Cit9CisKK2NvbnN0IGNoYXIgKiB0Y3BfbGlzdGVuKHBfc29ja2V0IHNvY2ssIGludCBiYWNrbG9nKSB7CisgIGludCBlcnIgPSBzb2NrZXRfbGlzdGVuKHNvY2ssIGJhY2tsb2cpOworICBFUlJPUlNUUl9SRVRVUk4oZXJyKTsKK30KKworY29uc3QgY2hhciAqIHRjcF9hY2NlcHQocF9zb2NrZXQgc29jaywgcF9zb2NrZXQgY2xpZW50LCBpbnQgdGltZW91dCkgeworICBpbnQgZXJyID0gc29ja2V0X2FjY2VwdChzb2NrLCBjbGllbnQsIE5VTEwsIE5VTEwsIHRpbWVvdXQpOworICBFUlJPUlNUUl9SRVRVUk4oZXJyKTsKK30KKworY29uc3QgY2hhciAqIHRjcF9jb25uZWN0KHBfc29ja2V0IHNvY2ssCisgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqaG9zdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBzaG9ydCBwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0aW1lb3V0KSB7CisgIGludCBlcnI7CisgIHN0cnVjdCBob3N0ZW50ICpoOworICBzdHJ1Y3Qgc29ja2FkZHJfaW4gcmVtb3RlOworICBtZW1zZXQoJnJlbW90ZSwgMCwgc2l6ZW9mKHJlbW90ZSkpOworICByZW1vdGUuc2luX2ZhbWlseSA9IEFGX0lORVQ7CisgIHJlbW90ZS5zaW5fcG9ydCA9IGh0b25zKHBvcnQpOworICBpZiAoc3RyY21wKGhvc3QsICIqIikgJiYgIWluZX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UeXBlLk9uZXdheSldCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQ29tcGFjdFByb3RvY29sKSwgVE1lc3NhZ2VUeXBlLlJlcGx5KV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpLCBUTWVzc2FnZVR5cGUuQ2FsbCldCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUSnNvblByb3RvY29sKSwgVE1lc3NhZ2VUeXBlLkV4Y2VwdGlvbildCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUSnNvblByb3RvY29sKSwgVE1lc3NhZ2VUeXBlLk9uZXdheSldCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUSnNvblByb3RvY29sKSwgVE1lc3NhZ2VUeXBlLlJlcGx5KV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkTWVzc2FnZV9UZXN0KFR5cGUgcHJvdG9jb2xUeXBlLCBUTWVzc2FnZVR5cGUgbWVzc2FnZVR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IG5ldyBUTWVzc2FnZShuYW1lb2YoVE1lc3NhZ2UpLCBtZXNzYWdlVHlwZSwgMSk7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB0dXBsZSA9IEdldFByb3RvY29sSW5zdGFuY2UocHJvdG9jb2xUeXBlKTsKKyAgICAgICAgICAgICAgICB1c2luZyAodmFyIHN0cmVhbSA9IHR1cGxlLkl0ZW0xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gdHVwbGUuSXRlbTI7CisKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVNZXNzYWdlQmVnaW5Bc3luYyhleHBlY3RlZCk7CisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlTWVzc2FnZUVuZEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtLlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbE1lc3NhZ2UgPSBhd2FpdCBwcm90b2NvbC5SZWFkTWVzc2FnZUJlZ2luQXN5bmMoKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuUmVhZE1lc3NhZ2VFbmRBc3luYygpOworCisgICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBfY29tcGFyZUxvZ2ljLkNvbXBhcmUoZXhwZWN0ZWQsIGFjdHVhbE1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBbRXhwZWN0ZWRFeGNlcHRpb24odHlwZW9mKEV4Y2VwdGlvbikpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWRTdHJ1Y3RfVGVzdChUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGV4cGVjdGVkID0gbmV3IFRTdHJ1Y3QobmFtZW9mKFRTdHJ1Y3QpKTsKKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHR1cGxlID0gR2V0UHJvdG9jb2xJbnN0YW5jZShwcm90b2NvbFR5cGUpOworICAgICAgICAgICAgICAgIHVzaW5nICh2YXIgc3RyZWFtID0gdHVwbGUuSXRlbTEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2YXIgcHJvdG9jb2wgPSB0dXBsZS5JdGVtMjsKKworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5Xcml0ZVN0cnVjdEJlZ2luQXN5bmMoZXhwZWN0ZWQpOworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5Xcml0ZVN0cnVjdEVuZEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtPy5TZWVrKDAsIFNlZWtPcmlnaW4uQmVnaW4pOworCisgICAgICAgICAgICAgICAgICAgIHZhciBhY3R1YWwgPSBhd2FpdCBwcm90b2NvbC5SZWFkU3RydWN0QmVnaW5Bc3luYygpOworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkU3RydWN0RW5kQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCQiRXhjZXB0aW9uIGR1cmluZyB0ZXN0aW5nIG9mIHByb3RvY29sOiB7cHJvdG9jb2xUeXBlLkZ1bGxOYW1lfSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgW0RhdGFUZXN0TWV0aG9kXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEJpbmFyeVByb3RvY29sKSldCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQ29tcGFjdFByb3RvY29sKSldCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUSnNvblByb3RvY29sKSldCisgICAgICAgIFtFeHBlY3RlZEV4Y2VwdGlvbih0eXBlb2YoRXhjZXB0aW9uKSldCisgICAgICAgIHB1YmxpYyBhc3luYyBUYXNrIFdyaXRlUmVhZEZpZWxkX1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IG5ldyBURmllbGQobmFtZW9mKFRGaWVsZCksIFRUeXBlLlN0cmluZywgMSk7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB0dXBsZSA9IEdldFByb3RvY29sSW5zdGFuY2UocHJvdG9jb2xUeXBlKTsKKyAgICAgICAgICAgICAgICB1c2luZyAodmFyIHN0cmVhbSA9IHR1cGxlLkl0ZW0xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gdHVwbGUuSXRlbTI7CisKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVGaWVsZEJlZ2luQXN5bmMoZXhwZWN0ZWQpOworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5Xcml0ZUZpZWxkRW5kQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICBzdHJlYW0/LlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbCA9IGF3YWl0IHByb3RvY29sLlJlYWRGaWVsZEJlZ2luQXN5bmMoKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuUmVhZEZpZWxkRW5kQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWRNYXBfVGVzdChUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGV4cGVjdGVkID0gbmV3IFRNYXAoVFR5cGUuU3RyaW5nLCBUVHlwZS5TdHJpbmcsIDEpOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlTWFwQmVnaW5Bc3luYyhleHBlY3RlZCk7CisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlTWFwRW5kQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICBzdHJlYW0/LlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbCA9IGF3YWl0IHByb3RvY29sLlJlYWRNYXBCZWdpbkFzeW5jKCk7CisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRNYXBFbmRBc3luYygpOworCisgICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBfY29tcGFyZUxvZ2ljLkNvbXBhcmUoZXhwZWN0ZWQsIGFjdHVhbCk7CisgICAgICAgICAgICAgICAgICAgIEFzc2VydC5Jc1RydWUocmVzdWx0LkFyZUVxdWFsLCByZXN1bHQuRGlmZmVyZW5jZXNTdHJpbmcpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXhjZXB0aW9uKCQiRXhjZXB0aW9uIGR1cmluZyB0ZXN0aW5nIG9mIHByb3RvY29sOiB7cHJvdG9jb2xUeXBlLkZ1bGxOYW1lfSIsIGUpOworICAgICAgICAgICAgfQorCisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkTGlzdF9UZXN0KFR5cGUgcHJvdG9jb2xUeXBlKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgZXhwZWN0ZWQgPSBuZXcgVExpc3QoVFR5cGUuU3RyaW5nLCAxKTsKKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHR1cGxlID0gR2V0UHJvdG9jb2xJbnN0YW5jZShwcm90b2NvbFR5cGUpOworICAgICAgICAgICAgICAgIHVzaW5nICh2YXIgc3RyZWFtID0gdHVwbGUuSXRlbTEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2YXIgcHJvdG9jb2wgPSB0dXBsZS5JdGVtMjsKKworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5Xcml0ZUxpc3RCZWdpbkFzeW5jKGV4cGVjdGVkKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVMaXN0RW5kQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICBzdHJlYW0/LlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbCA9IGF3YWl0IHByb3RvY29sLlJlYWRMaXN0QmVnaW5Bc3luYygpOworICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkTGlzdEVuZEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkU2V0X1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IG5ldyBUU2V0KFRUeXBlLlN0cmluZywgMSk7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB0dXBsZSA9IEdldFByb3RvY29sSW5zdGFuY2UocHJvdG9jb2xUeXBlKTsKKyAgICAgICAgICAgICAgICB1c2luZyAodmFyIHN0cmVhbSA9IHR1cGxlLkl0ZW0xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gdHVwbGUuSXRlbTI7CisKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVTZXRCZWdpbkFzeW5jKGV4cGVjdGVkKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVTZXRFbmRBc3luYygpOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbT8uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgYWN0dWFsID0gYXdhaXQgcHJvdG9jb2wuUmVhZFNldEJlZ2luQXN5bmMoKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuUmVhZFNldEVuZEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkQm9vbF9UZXN0KFR5cGUgcHJvdG9jb2xUeXBlKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgZXhwZWN0ZWQgPSB0cnVlOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlQm9vbEFzeW5jKGV4cGVjdGVkKTsKKworICAgICAgICAgICAgICAgICAgICBzdHJlYW0/LlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbCA9IGF3YWl0IHByb3RvY29sLlJlYWRCb29sQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWRCeXRlX1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IHNieXRlLk1heFZhbHVlOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlQnl0ZUFzeW5jKGV4cGVjdGVkKTsKKworICAgICAgICAgICAgICAgICAgICBzdHJlYW0/LlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIGFjdHVhbCA9IGF3YWl0IHByb3RvY29sLlJlYWRCeXRlQXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWRJMTZfVGVzdChUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGV4cGVjdGVkID0gc2hvcnQuTWF4VmFsdWU7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB0dXBsZSA9IEdldFByb3RvY29sSW5zdGFuY2UocHJvdG9jb2xUeXBlKTsKKyAgICAgICAgICAgICAgICB1c2luZyAodmFyIHN0cmVhbSA9IHR1cGxlLkl0ZW0xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gdHVwbGUuSXRlbTI7CisKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVJMTZBc3luYyhleHBlY3RlZCk7CisKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtPy5TZWVrKDAsIFNlZWtPcmlnaW4uQmVnaW4pOworCisgICAgICAgICAgICAgICAgICAgIHZhciBhY3R1YWwgPSBhd2FpdCBwcm90b2NvbC5SZWFkSTE2QXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWRJMzJfVGVzdChUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGV4cGVjdGVkID0gaW50Lk1heFZhbHVlOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlSTMyQXN5bmMoZXhwZWN0ZWQpOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbT8uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgYWN0dWFsID0gYXdhaXQgcHJvdG9jb2wuUmVhZEkzMkFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkSTY0X1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IGxvbmcuTWF4VmFsdWU7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB0dXBsZSA9IEdldFByb3RvY29sSW5zdGFuY2UocHJvdG9jb2xUeXBlKTsKKyAgICAgICAgICAgICAgICB1c2luZyAodmFyIHN0cmVhbSA9IHR1cGxlLkl0ZW0xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gdHVwbGUuSXRlbTI7CisKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuV3JpdGVJNjRBc3luYyhleHBlY3RlZCk7CisKKyAgICAgICAgICAgICAgICAgICAgc3RyZWFtPy5TZWVrKDAsIFNlZWtPcmlnaW4uQmVnaW4pOworCisgICAgICAgICAgICAgICAgICAgIHZhciBhY3R1YWwgPSBhd2FpdCBwcm90b2NvbC5SZWFkSTY0QXN5bmMoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gX2NvbXBhcmVMb2dpYy5Db21wYXJlKGV4cGVjdGVkLCBhY3R1YWwpOworICAgICAgICAgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKHJlc3VsdC5BcmVFcXVhbCwgcmVzdWx0LkRpZmZlcmVuY2VzU3RyaW5nKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigkIkV4Y2VwdGlvbiBkdXJpbmcgdGVzdGluZyBvZiBwcm90b2NvbDoge3Byb3RvY29sVHlwZS5GdWxsTmFtZX0iLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIFtEYXRhVGVzdE1ldGhvZF0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRCaW5hcnlQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVENvbXBhY3RQcm90b2NvbCkpXQorICAgICAgICBbRGF0YVJvdyh0eXBlb2YoVEpzb25Qcm90b2NvbCkpXQorICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBXcml0ZVJlYWREb3VibGVfVGVzdChUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGV4cGVjdGVkID0gZG91YmxlLk1heFZhbHVlOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlRG91YmxlQXN5bmMoZXhwZWN0ZWQpOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbT8uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgYWN0dWFsID0gYXdhaXQgcHJvdG9jb2wuUmVhZERvdWJsZUFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkU3RyaW5nX1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IG5hbWVvZihTdHJpbmcpOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlU3RyaW5nQXN5bmMoZXhwZWN0ZWQpOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbT8uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgYWN0dWFsID0gYXdhaXQgcHJvdG9jb2wuUmVhZFN0cmluZ0FzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBbRGF0YVRlc3RNZXRob2RdCisgICAgICAgIFtEYXRhUm93KHR5cGVvZihUQmluYXJ5UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRDb21wYWN0UHJvdG9jb2wpKV0KKyAgICAgICAgW0RhdGFSb3codHlwZW9mKFRKc29uUHJvdG9jb2wpKV0KKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgV3JpdGVSZWFkQmluYXJ5X1Rlc3QoVHlwZSBwcm90b2NvbFR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBleHBlY3RlZCA9IEVuY29kaW5nLlVURjguR2V0Qnl0ZXMobmFtZW9mKFN0cmluZykpOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdHVwbGUgPSBHZXRQcm90b2NvbEluc3RhbmNlKHByb3RvY29sVHlwZSk7CisgICAgICAgICAgICAgICAgdXNpbmcgKHZhciBzdHJlYW0gPSB0dXBsZS5JdGVtMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9IHR1cGxlLkl0ZW0yOworCisgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLldyaXRlQmluYXJ5QXN5bmMoZXhwZWN0ZWQpOworCisgICAgICAgICAgICAgICAgICAgIHN0cmVhbT8uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgYWN0dWFsID0gYXdhaXQgcHJvdG9jb2wuUmVhZEJpbmFyeUFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IF9jb21wYXJlTG9naWMuQ29tcGFyZShleHBlY3RlZCwgYWN0dWFsKTsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShyZXN1bHQuQXJlRXF1YWwsIHJlc3VsdC5EaWZmZXJlbmNlc1N0cmluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oJCJFeGNlcHRpb24gZHVyaW5nIHRlc3Rpbmcgb2YgcHJvdG9jb2w6IHtwcm90b2NvbFR5cGUuRnVsbE5hbWV9IiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBUdXBsZTxTdHJlYW0sIFRQcm90b2NvbD4gR2V0UHJvdG9jb2xJbnN0YW5jZShUeXBlIHByb3RvY29sVHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIG1lbW9yeVN0cmVhbSA9IG5ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgICAgIHZhciBzdHJlYW1DbGllbnRUcmFuc3BvcnQgPSBuZXcgVFN0cmVhbUNsaWVudFRyYW5zcG9ydChtZW1vcnlTdHJlYW0sIG1lbW9yeVN0cmVhbSk7CisgICAgICAgICAgICB2YXIgcHJvdG9jb2wgPSAoVFByb3RvY29sKSBBY3RpdmF0b3IuQ3JlYXRlSW5zdGFuY2UocHJvdG9jb2xUeXBlLCBzdHJlYW1DbGllbnRUcmFuc3BvcnQpOworICAgICAgICAgICAgcmV0dXJuIG5ldyBUdXBsZTxTdHJlYW0sIFRQcm90b2NvbD4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AgICAgICAKKyAgICAgICAgICAgIEFzc2VydC5Jc1RydWUoaGFzaFNldC5Db250YWlucyh2YWx1ZSkpOworCisgICAgICAgICAgICBoYXNoU2V0LlJlbW92ZSh2YWx1ZSk7CisKKyAgICAgICAgICAgIEFzc2VydC5Jc1RydWUoaGFzaFNldC5Db3VudCA9PSAwKTsKKworICAgICAgICAgICAgaGFzaFNldC5BZGQodmFsdWUpOworCisgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKGhhc2hTZXQuQ29udGFpbnModmFsdWUpKTsKKworICAgICAgICAgICAgaGFzaFNldC5DbGVhcigpOworCisgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKGhhc2hTZXQuQ291bnQgPT0gMCk7CisKKyAgICAgICAgICAgIHZhciBuZXdBcnIgPSBuZXcgaW50WzFdOworICAgICAgICAgICAgaGFzaFNldC5BZGQodmFsdWUpOworICAgICAgICAgICAgaGFzaFNldC5Db3B5VG8obmV3QXJyLCAwKTsKKworICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShuZXdBcnIuQ29udGFpbnModmFsdWUpKTsKKworICAgICAgICAgICAgdmFyIGVuID0gaGFzaFNldC5HZXRFbnVtZXJhdG9yKCk7CisgICAgICAgICAgICBlbi5Nb3ZlTmV4dCgpOworCisgICAgICAgICAgICBBc3NlcnQuSXNUcnVlKChpbnQpZW4uQ3VycmVudCA9PSB2YWx1ZSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHVzaW5nICh2YXIgaWVuID0gKChJRW51bWVyYWJsZTxpbnQ+KWhhc2hTZXQpLkdldEVudW1lcmF0b3IoKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZW4uTW92ZU5leHQoKTsKKworICAgICAgICAgICAgICAgIEFzc2VydC5Jc1RydWUoaWVuLkN1cnJlbnQgPT0gdmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGVzdHM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eXBlTmFtZXMuTmFtZU1hcCksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLlNldCwgVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVNldCksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLkxpc3QsIFRKU09OUHJvdG9jb2xDb25zdGFudHMuVHlwZU5hbWVzLk5hbWVMaXN0KSwKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciB0IGluIHNldHMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVOYW1lRm9yVHlwZUlkKHQuSXRlbTEpID09IHQuSXRlbTIsICQiV3JvbmcgbWFwcGluZyBvZiBUeXBlTmFtZSB7dC5JdGVtMn0gdG8gVFR5cGU6IHt0Lkl0ZW0xfSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgW1Rlc3RNZXRob2RdCisgICAgICAgIFtFeHBlY3RlZEV4Y2VwdGlvbih0eXBlb2YoVFByb3RvY29sRXhjZXB0aW9uKSldCisgICAgICAgIHB1YmxpYyB2b2lkIEdldFR5cGVOYW1lRm9yVHlwZUlkX1RTdG9wX1Rlc3QoKQorICAgICAgICB7CisgICAgICAgICAgICBUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVOYW1lRm9yVHlwZUlkKFRUeXBlLlN0b3ApOworICAgICAgICB9CisKKyAgICAgICAgW1Rlc3RNZXRob2RdCisgICAgICAgIFtFeHBlY3RlZEV4Y2VwdGlvbih0eXBlb2YoVFByb3RvY29sRXhjZXB0aW9uKSldCisgICAgICAgIHB1YmxpYyB2b2lkIEdldFR5cGVOYW1lRm9yVHlwZUlkX05vbkV4aXN0aW5nVFR5cGVfVGVzdCgpCisgICAgICAgIHsKKyAgICA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ksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLlN0cmluZywgVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVN0cmluZyksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLlN0cnVjdCwgVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVN0cnVjdCksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLk1hcCwgVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZU1hcCksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLlNldCwgVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVNldCksCisgICAgICAgICAgICAgICAgbmV3IFR1cGxlPFRUeXBlLCBieXRlW10+KFRUeXBlLkxpc3QsIFRKU09OUHJvdG9jb2xDb25zdGFudHMuVHlwZU5hbWVzLk5hbWVMaXN0KSwKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciB0IGluIHNldHMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQXNzZXJ0LklzVHJ1ZShUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVJZEZvclR5cGVOYW1lKHQuSXRlbTIpID09IHQuSXRlbTEsICQiV3JvbmcgbWFwcGluZyBvZiBUeXBlTmFtZSB7dC5JdGVtMn0gdG8gVFR5cGU6IHt0Lkl0ZW0xfSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgW1Rlc3RNZXRob2RdCisgICAgICAgIFtFeHBlY3RlZEV4Y2VwdGlvbih0eXBlb2YoVFByb3RvY29sRXhjZXB0aW9uKSldCisgICAgICAgIHB1YmxpYyB2b2lkIEdldFR5cGVJZEZvclR5cGVOYW1lX1RTdG9wVHlwZU5hbWVfVGVzdCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFRKU09OUHJvdG9jb2xIZWxwZXIuR2V0VHlwZUlkRm9yVHlwZU5hbWUobmV3IFtdeyhieXRlKVRUeXBlLlN0b3AsIChieXRlKVRUeXBlLlN0b3B9KTsKKyAgICAgICAgfQorCisgICAgICAgIFtUZXN0TWV0aG9kXQorICAgICAgICBbRXhwZWN0ZWRFeGNlcHRpb24odHlwZW9mKFRQcm90b2NvbEV4Y2VwdGlvbikpXQorICAgICAgICBwdWJsaWMgdm9pZCBHZXRUeXBlSWRGb3JUeXBlTmFtZV9Ob25FeGlzdGluZ1R5cGVOYW1lX1Rlc3QoKQorICAgICAgICB7CisgICAgICAgICAgICBUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVJZEZvclR5cGVOYW1lKG5ldyBieXRlW117MTAwfSk7CisgICAgICAgIH0KKworICAgICAgICBbVGVzdE1ldGhvZF0KKyAgICAgICAgW0V4cGVjdGVkRXhjZXB0aW9uKHR5cGVvZihUUHJvdG9jb2xFeGNlcHRpb24pKV0KKyAgICAgICAgcHVibGljIHZvaWQgR2V0VHlwZUlkRm9yVHlwZU5hbWVfRW1wdHlOYW1lX1Rlc3QoKQorICAgICAgICB7CisgICAgICAgICAgICBUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVJZEZvclR5cGVOYW1lKG5ldyBieXRlW10ge30pOworICAgICAgICB9CisKKyAgICAgICAgW1Rlc3RNZXRob2RdCisgICAgICAgIHB1YmxpYyB2b2lkIElzSnNvbk51bWVyaWNfVGVzdCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIGlucHV0L291dHB1dAorICAgICAgICAgICAgdmFyIGNvcnJlY3RKc29uTnVtZXJpYyA9ICIrLS4wMTIzNDU2Nzg5RWUiOworICAgICAgICAgICAgdmFyIGluY29ycmVjdEpzb25OdW1lcmljID0gIkFhQmNEZC8qXFwiOworCisgICAg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worICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGZpdGVyID0gZmlyc3QuR2V0RW51bWVyYXRvcigpOworICAgICAgICAgICAgdmFyIHNpdGVyID0gc2Vjb25kLkdldEVudW1lcmF0b3IoKTsKKworICAgICAgICAgICAgdmFyIGZuZXh0ID0gZml0ZXIuTW92ZU5leHQoKTsKKyAgICAgICAgICAgIHZhciBzbmV4dCA9IHNpdGVyLk1vdmVOZXh0KCk7CisKKyAgICAgICAgICAgIHdoaWxlIChmbmV4dCAmJiBzbmV4dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgZmVudW0gPSBmaXRlci5DdXJyZW50IGFzIElFbnVtZXJhYmxlOworICAgICAgICAgICAgICAgIHZhciBzZW51bSA9IHNpdGVyLkN1cnJlbnQgYXMgSUVudW1lcmFibGU7CisKKyAgICAgICAgICAgICAgICBpZiAoZmVudW0gIT0gbnVsbCAmJiBzZW51bSAhPSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFFcXVhbHMoZmVudW0sIHNlbnVtKSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZlbnVtID09IG51bGwgXiBzZW51bSA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIGlmICghRXF1YWxzKGZpdGVyLkN1cnJlbnQsIHNpdGVyLkN1cnJlbnQpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZuZXh0ID0gZml0ZXIuTW92ZU5leHQoKTsKKyAgICAgICAgICAgICAgICBzbmV4dCA9IHNpdGVyLk1vdmVOZXh0KCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBmbmV4dCA9PSBzbmV4dDsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vICAgICBUaGlzIHJldHVybnMgYSBoYXNoY29kZSBiYXNlZCBvbiB0aGUgdmFsdWUgb2YgdGhlIGVudW1lcmFibGUuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IEdldEhhc2hDb2RlKElFbnVtZXJhYmxlIGVudW1lcmFibGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChlbnVtZXJhYmxlID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBoYXNoY29kZSA9IDA7CisKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciBvYmogaW4gZW51bWVyYWJsZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgZW51bTIgPSBvYmogYXMgSUVudW1lcmFibGU7CisgICAgICAgICAgICAgICAgdmFyIG9iakhhc2ggPSBlbnVtMiA9PSBudWxsID8gb2JqLkdldEhhc2hDb2RlKCkgOiBHZXRIYXNoQ29kZShlbnVtMik7CisKKyAgICAgICAgICAgICAgICB1bmNoZWNrZWQKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGhhc2hjb2RlID0gKGhhc2hjb2RlKjM5NykgXiAob2JqSGFzaCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gaGFzaGNvZGU7CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBh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mV0dXJuIF9zZXQuQ29udGFpbnMoaXRlbSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBDb3B5VG8oVFtdIGFycmF5LCBpbnQgYXJyYXlJbmRleCkKKyAgICAgICAgeworICAgICAgICAgICAgX3NldC5Db3B5VG8oYXJyYXksIGFycmF5SW5kZXgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIElFbnVtZXJhdG9yIEdldEVudW1lcmF0b3IoKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gX3NldC5HZXRFbnVtZXJhdG9yKCk7CisgICAgICAgIH0KKworICAgICAgICBJRW51bWVyYXRvcjxUPiBJRW51bWVyYWJsZTxUPi5HZXRFbnVtZXJhdG9yKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuICgoSUVudW1lcmFibGU8VD4pIF9zZXQpLkdldEVudW1lcmF0b3IoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sIFJlbW92ZShUIGl0ZW0pCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBfc2V0LlJlbW92ZShpdGVtKTsKKyAgICAgICAgfQorICAgIH0KK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9saWIvbmV0Y29yZS9UaHJpZnQvSVRBc3luY1Byb2Nlc3Nvci5jcyBiL2xpYi9uZXRjb3JlL1RocmlmdC9JVEFzeW5jUHJvY2Vzc29yLmNzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmRiOGU0MGEKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvbmV0Y29yZS9UaHJpZnQvSVRBc3luY1Byb2Nlc3Nvci5jcwpAQCAtMCwwICsxLDI5IEBACisvLyBMaWNlbnNlZCB0byB0aGUgQXBhY2hlIFNvZnR3YXJlIEZvdW5kYXRpb24oQVNGKSB1bmRlciBvbmUKKy8vIG9yIG1vcmUgY29udHJpYnV0b3I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nMgYW5kIGxpbWl0YXRpb25zCisvLyB1bmRlciB0aGUgTGljZW5zZS4KKwordXNpbmcgU3lzdGVtOwordXNpbmcgU3lzdGVtLlRleHQ7Cit1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwordXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKK3VzaW5nIFRocmlmdC5Qcm90b2NvbHMuRW50aXRpZXM7Cit1c2luZyBUaHJpZnQuVHJhbnNwb3J0czsKKworbmFtZXNwYWNlIFRocmlmdC5Qcm90b2NvbHMKK3sKKyAgICAvLyBSZVNoYXJwZXIgZGlzYWJsZSBvbmNlIEluY29uc2lzdGVudE5hbWluZworICAgIHB1YmxpYyBjbGFzcyBUQmluYXJ5UHJvdG9jb2wgOiBUUHJvdG9jb2wKKyAgICB7CisgICAgICAgIC8vVE9ETzogVW5pdCB0ZXN0cworICAgICAgICAvL1RPRE86IExvY2FsaXphdGlvbgorICAgICAgICAvL1RPRE86IHByYWdtYQorCisgICAgICAgIHByb3RlY3RlZCBjb25zdCB1aW50IFZlcnNpb25NYXNrID0gMHhmZmZmMDAwMDsKKyAgICAgICAgcHJvdGVjdGVkIGNvbnN0IHVpbnQgVmVyc2lvbjEgPSAweDgwMDEwMDAwOworCisgICAgICAgIHByb3RlY3RlZCBib29sIFN0cmljdFJlYWQ7CisgICAgICAgIHByb3RlY3RlZCBib29sIFN0cmljdFdyaXRlOworCisgICAgICAgIHB1YmxpYyBUQmluYXJ5UHJvdG9jb2woVENsaWVudFRyYW5zcG9ydCB0cmFucykKKyAgICAgICAgICAgIDogdGhpcyh0cmFucywgZmFsc2UsIHRydWUpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUQmluYXJ5UHJvdG9jb2woVENsaWVudFRyYW5zcG9ydCB0cmFucywgYm9vbCBzdHJpY3RSZWFkLCBib29sIHN0cmljdFdyaXRlKQorICAgICAgICAgICAgOiBiYXNlKHRyYW5zKQorICAgICAgICB7CisgICAgICAgICAgICBTdHJpY3RSZWFkID0gc3RyaWN0UmVhZDsKKyAgICAgICAgICAgIFN0cmljdFdyaXRlID0gc3RyaWN0V3JpdGU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1lc3NhZ2VCZWdpbkFzeW5jKFRNZXNzYWdlIG1lc3NhZ2UsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoU3RyaWN0V3JpdGUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHZlcnNpb24gPSBWZXJzaW9uMSB8ICh1aW50KSBtZXNzYWdlLlR5cGU7CisgICAgICAgICAgICAgICAgYXdhaXQgV3JpdGVJMzJBc3luYygoaW50KSB2ZXJzaW9uLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgYXdhaXQgV3JpdGVTdHJpbmdBc3luYyhtZXNzYWdlLk5hbWUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBXcml0ZUkzMkFzeW5jKG1lc3NhZ2UuU2VxSUQsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBXcml0ZVN0cmluZ0FzeW5jKG1lc3NhZ2UuTmFtZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIGF3YWl0IFdyaXRlQnl0ZUFzeW5jKChzYnl0ZSkgbWVzc2FnZS5UeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgYXdhaXQgV3JpdGVJMzJBc3luYyhtZXNzYWdlLlNlcUlELCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1lc3NhZ2VFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlU3RydWN0QmVnaW5Bc3luYyhUU3RydWN0IEBzdHJ1Y3QsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVTdHJ1Y3RFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlRmllbGRCZWdpbkFzeW5jKFRGaWVsZCBmaWVsZCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlQnl0ZUFzeW5jKChzYnl0ZSkgZmllbGQuVHlwZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgV3JpdGVJMTZBc3luYyhmaWVsZC5JRCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVGaWVsZFN0b3BBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgV3JpdGVCeXRlQXN5bmMoKHNieXRlKSBUVHlwZS5TdG9wLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1hcEJlZ2luQXN5bmMoVE1hcCBtYXAsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBXcml0ZUJ5dGVBc3luYygoc2J5dGUpIG1hcC5LZXlUeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUJ5dGVBc3luYygoc2J5dGUpIG1hcC5WYWx1ZVR5cGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlSTMyQXN5bmMobWFwLkNvdW50LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1hcEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVMaXN0QmVnaW5Bc3luYyhUTGlzdCBsaXN0LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgV3JpdGVCeXRlQXN5bmMoKHNieXRlKSBsaXN0LkVsZW1lbnRUeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUkzMkFzeW5jKGxpc3QuQ291bnQsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlTGlzdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVTZXRCZWdpbkFzeW5jKFRTZXQgc2V0LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgV3JpdGVCeXRlQXN5bmMoKHNieXRlKSBzZXQuRWxlbWVudFR5cGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlSTMyQXN5bmMoc2V0LkNvdW50LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZVNldEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVCb29sQXN5bmMoYm9vbCBiLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgV3JpdGVCeXRlQXN5bmMoYiA/IChzYnl0ZSkgMSA6IChzYnl0ZSkgMCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIGludGVybmFsIHN0YXRpYyBieXRlW10gQ3JlYXRlV3JpdGVCeXRlKHNieXRlIGIpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBib3V0ID0gbmV3IGJ5dGVbMV07CisKKyAgICAgICAgICAgIGJvdXRbMF0gPSAoYnl0ZSkgYjsKKworICAgICAgICAgICAgcmV0dXJuIGJvdXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUJ5dGVBc3luYyhzYnl0ZSBiLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGJvdXQgPSBDcmVhdGVXcml0ZUJ5dGUoYik7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJvdXQsIDAsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBpbnRlcm5hbCBzdGF0aWMgYnl0ZVtdIENyZWF0ZVdyaXRlSTE2KHNob3J0IHMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBpMTZPdXQgPSBuZXcgYnl0ZVsyXTsKKworICAgICAgICAgICAgaTE2T3V0WzBdID0gKGJ5dGUpICgweGZmICYgKHMgPj4gOCkpOworICAgICAgICAgICAgaTE2T3V0WzFdID0gKGJ5dGUpICgweGZmICYgcyk7CisKKyAgICAgICAgICAgIHJldHVybiBpMTZPdXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUkxNkFzeW5jKHNob3J0IGkxNiwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBpMTZPdXQgPSBDcmVhdGVXcml0ZUkxNihpMTYpOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhpMTZPdXQsIDAsIDIsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBpbnRlcm5hbCBzdGF0aWMgYnl0ZVtdIENyZWF0ZVdyaXRlSTMyKGludCBpMzIpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBpMzJPdXQgPSBuZXcgYnl0ZVs0XTsKKworICAgICAgICAgICAgaTMyT3V0WzBdID0gKGJ5dGUpICgweGZmICYgKGkzMiA+PiAyNCkpOworICAgICAgICAgICAgaTMyT3V0WzFdID0gKGJ5dGUpICgweGZmICYgKGkzMiA+PiAxNikpOworICAgICAgICAgICAgaTMyT3V0WzJdID0gKGJ5dGUpICgweGZmICYgKGkzMiA+PiA4KSk7CisgICAgICAgICAgICBpMzJPdXRbM10gPSAoYnl0ZSkgKDB4ZmYgJiBpMzIpOworCisgICAgICAgICAgICByZXR1cm4gaTMyT3V0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVJMzJBc3luYyhpbnQgaTMyLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGkzMk91dCA9IENyZWF0ZVdyaXRlSTMyKGkzMik7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGkzMk91dCwgMCwgNCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIGludGVybmFsIHN0YXRpYyBieXRlW10gQ3JlYXRlV3JpdGVJNjQobG9uZyBpNjQpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBpNjRPdXQgPSBuZXcgYnl0ZVs4XTsKKworICAgICAgICAgICAgaTY0T3V0WzBdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiA1NikpOworICAgICAgICAgICAgaTY0T3V0WzFdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiA0OCkpOworICAgICAgICAgICAgaTY0T3V0WzJdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiA0MCkpOworICAgICAgICAgICAgaTY0T3V0WzNdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiAzMikpOworICAgICAgICAgICAgaTY0T3V0WzRdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiAyNCkpOworICAgICAgICAgICAgaTY0T3V0WzVdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiAxNikpOworICAgICAgICAgICAgaTY0T3V0WzZdID0gKGJ5dGUpICgweGZmICYgKGk2NCA+PiA4KSk7CisgICAgICAgICAgICBpNjRPdXRbN10gPSAoYnl0ZSkgKDB4ZmYgJiBpNjQpOworCisgICAgICAgICAgICByZXR1cm4gaTY0T3V0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVJNjRBc3luYyhsb25nIGk2NCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBpNjRPdXQgPSBDcmVhdGVXcml0ZUk2NChpNjQpOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhpNjRPdXQsIDAsIDgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlRG91YmxlQXN5bmMoZG91YmxlIGQsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBXcml0ZUk2NEFzeW5jKEJpdENvbnZlcnRlci5Eb3VibGVUb0ludDY0Qml0cyhkKSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVCaW5hcnlBc3luYyhieXRlW10gYnl0ZXMsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBXcml0ZUkzMkFzeW5jKGJ5dGVzLkxlbmd0aCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhieXRlcywgMCwgYnl0ZXMuTGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUTWVzc2FnZT4gUmVhZE1lc3NhZ2VCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPFRNZXNzYWdlPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBtZXNzYWdlID0gbmV3IFRNZXNzYWdlKCk7CisgICAgICAgICAgICB2YXIgc2l6ZSA9IGF3YWl0IFJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoc2l6ZSA8IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHZlcnNpb24gPSAodWludCkgc2l6ZSAmIFZlcnNpb25NYXNrOworICAgICAgICAgICAgICAgIGlmICh2ZXJzaW9uICE9IFZlcnNpb24xKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAkIkJhZCB2ZXJzaW9uIGluIFJlYWRNZXNzYWdlQmVnaW46IHt2ZXJzaW9ufSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtZXNzYWdlLlR5cGUgPSAoVE1lc3NhZ2VUeXBlKSAoc2l6ZSAmIDB4MDAwMDAwZmYpOworICAgICAgICAgICAgICAgIG1lc3NhZ2UuTmFtZSA9IGF3YWl0IFJlYWRTdHJpbmdBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgbWVzc2FnZS5TZXFJRCA9IGF3YWl0IFJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKFN0cmljdFJlYWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5CQURfVkVSU0lPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICJNaXNzaW5nIHZlcnNpb24gaW4gUmVhZE1lc3NhZ2VCZWdpbiwgb2xkIGNsaWVudD8iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbWVzc2FnZS5OYW1lID0gYXdhaXQgUmVhZFN0cmluZ0JvZHlBc3luYyhzaXplLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgbWVzc2FnZS5UeXBlID0gKFRNZXNzYWdlVHlwZSkgYXdhaXQgUmVhZEJ5dGVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgbWVzc2FnZS5TZXFJRCA9IGF3YWl0IFJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRNZXNzYWdlRW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUU3RydWN0PiBSZWFkU3RydWN0QmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy9UT0RPOiBubyByZWFkIGZyb20gaW50ZXJuYWwgdHJhbnNwb3J0PworICAgICAgICAgICAgcmV0dXJuIG5ldyBUU3RydWN0KCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBSZWFkU3RydWN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxURmllbGQ+IFJlYWRGaWVsZEJlZ2luQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8VEZpZWxkPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBmaWVsZCA9IG5ldyBURmllbGQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBUeXBlID0gKFRUeXBlKSBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgaWYgKGZpZWxkLlR5cGUgIT0gVFR5cGUuU3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaWVsZC5JRCA9IGF3YWl0IFJlYWRJMTZBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBmaWVsZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8VE1hcD4gUmVhZE1hcEJlZ2luQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8VE1hcD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgbWFwID0gbmV3IFRNYXAKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBLZXlUeXBlID0gKFRUeXBlKSBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKSwKKyAgICAgICAgICAgICAgICBWYWx1ZVR5cGUgPSAoVFR5cGUpIGF3YWl0IFJlYWRCeXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pLAorICAgICAgICAgICAgICAgIENvdW50ID0gYXdhaXQgUmVhZEkzMkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgcmV0dXJuIG1hcDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRNYXBFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPFRMaXN0PiBSZWFkTGlzdEJlZ2luQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8VExpc3Q+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGxpc3QgPSBuZXcgVExpc3QKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBFbGVtZW50VHlwZSA9IChUVHlwZSkgYXdhaXQgUmVhZEJ5dGVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbiksCisgICAgICAgICAgICAgICAgQ291bnQgPSBhd2FpdCBSZWFkSTMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB9OworCisgICAgICAgICAgICByZXR1cm4gbGlzdDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRMaXN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUU2V0PiBSZWFkU2V0QmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxUU2V0PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBzZXQgPSBuZXcgVFNldAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIEVsZW1lbnRUeXBlID0gKFRUeXBlKSBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKSwKKyAgICAgICAgICAgICAgICBDb3VudCA9IGF3YWl0IFJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIHJldHVybiBzZXQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBSZWFkU2V0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxib29sPiBSZWFkQm9vbEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGJvb2w+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFJlYWRCeXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pID09IDE7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxzYnl0ZT4gUmVhZEJ5dGVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxzYnl0ZT4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgYmluID0gbmV3IGJ5dGVbMV07CisgICAgICAgICAgICBhd2FpdCBUcmFucy5SZWFkQWxsQXN5bmMoYmluLCAwLCAxLCBjYW5jZWxsYXRpb25Ub2tlbik7IC8vVE9ETzogd2h5IHJlYWRhbGwgPworICAgICAgICAgICAgcmV0dXJuIChzYnl0ZSkgYmluWzBdOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8c2hvcnQ+IFJlYWRJMTZBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxzaG9ydD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgaTE2SW4gPSBuZXcgYnl0ZVsyXTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLlJlYWRBbGxBc3luYyhpMTZJbiwgMCwgMiwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgdmFyIHJlc3VsdCA9IChzaG9ydCkgKCgoaTE2SW5bMF0gJiAweGZmKSA8PCA4KSB8IGkxNkluWzFdICYgMHhmZik7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8aW50PiBSZWFkSTMyQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8aW50PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBpMzJJbiA9IG5ldyBieXRlWzRdOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuUmVhZEFsbEFzeW5jKGkzMkluLCAwLCA0LCBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgIHZhciByZXN1bHQgPSAKKyAgICAgICAgICAgICAgICAoKGkzMkluWzBdICYgMHhmZikgPDwgMjQpIHwgCisgICAgICAgICAgICAgICAgKChpMzJJblsxXSAmIDB4ZmYpIDw8IDE2KSB8IAorICAgICAgICAgICAgICAgICgoaTMySW5bMl0gJiAweGZmKSA8PCA4KSB8CisgICAgICAgICAgICAgICAgaTMySW5bM10gJiAweGZmOworCisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisKKyNwcmFnbWEgd2FybmluZyBkaXNhYmxlIDY3NQorCisgICAgICAgIHByb3RlY3RlZCBpbnRlcm5hbCBsb25nIENyZWF0ZVJlYWRJNjQoYnl0ZVtdIGJ1ZikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHJlc3VsdCA9CisgICAgICAgICAgICAgICAgKChsb25nKSAoYnVmWzBdICYgMHhmZikgPDwgNTYpIHwKKyAgICAgICAgICAgICAgICAoKGxvbmcpIChidWZbMV0gJiAweGZmKSA8PCA0OCkgfAorICAgICAgICAgICAgICAgICgobG9uZykgKGJ1ZlsyXSAmIDB4ZmYpIDw8IDQwKSB8CisgICAgICAgICAgICAgICAgKChsb25nKSAoYnVmWzNdICYgMHhmZikgPDwgMzIpIHwKKyAgICAgICAgICAgICAgICAoKGxvbmcpIChidWZbNF0gJiAweGZmKSA8PCAyNCkgfAorICAgICAgICAgICAgICAgICgobG9uZykgKGJ1Zls1XSAmIDB4ZmYpIDw8IDE2KSB8CisgICAgICAgICAgICAgICAgKChsb25nKSAoYnVmWzZdICYgMHhmZikgPDwgOCkgfAorICAgICAgICAgICAgICAgIGJ1Zls3XSAmIDB4ZmY7CisKKyAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgIH0KKworI3ByYWdtYSB3YXJuaW5nIHJlc3RvcmUgNjc1CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8bG9uZz4gUmVhZEk2NEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGxvbmc+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGk2NEluID0gbmV3IGJ5dGVbOF07CisgICAgICAgICAgICBhd2FpdCBUcmFucy5SZWFkQWxsQXN5bmMoaTY0SW4sIDAsIDgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHJldHVybiBDcmVhdGVSZWFkSTY0KGk2NEluKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGRvdWJsZT4gUmVhZERvdWJsZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGRvdWJsZT4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgZCA9IGF3YWl0IFJlYWRJNjRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICByZXR1cm4gQml0Q29udmVydGVyLkludDY0Qml0c1RvRG91YmxlKGQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8Ynl0ZVtdPiBSZWFkQmluYXJ5QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8Ynl0ZVtdPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBzaXplID0gYXdhaXQgUmVhZEkzMkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHZhciBidWYgPSBuZXcgYnl0ZVtzaXplXTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLlJlYWRBbGxBc3luYyhidWYsIDAsIHNpemUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHJldHVybiBidWY7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2s8c3RyaW5nPiBSZWFkU3RyaW5nQm9keUFzeW5jKGludCBzaXplLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPHN0cmluZz4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgYnVmID0gbmV3IGJ5dGVbc2l6ZV07CisgICAgICAgICAgICBhd2FpdCBUcmFucy5SZWFkQWxsQXN5bmMoYnVmLCAwLCBzaXplLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICByZXR1cm4gRW5jb2RpbmcuVVRGOC5HZXRTdHJpbmcoYnVmLCAwLCBidWYuTGVuZ3RoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBjbGFzcyBGYWN0b3J5IDogSVRQcm90b2NvbEZhY3RvcnkKKyAgICAgICAgeworICAgICAgICAgICAgcHJvdGVjdGVkIGJvb2wgU3RyaWN0UmVhZDsKKyAgICAgICAgICAgIHByb3RlY3RlZCBib29sIFN0cmljdFdyaXRlOworCisgICAgICAgICAgICBwdWJsaWMgRmFjdG9yeSgpCisgICAgICAgICAgICAgICAgOiB0aGlzKGZhbHNlLCB0c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jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIF9sYXN0RmllbGQuUHVzaChfbGFzdEZpZWxkSWQpOworICAgICAgICAgICAgX2xhc3RGaWVsZElkID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlU3RydWN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIF9sYXN0RmllbGRJZCA9IF9sYXN0RmllbGQuUG9wKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVGaWVsZEJlZ2luSW50ZXJuYWxBc3luYyhURmllbGQgZmllbGQsIGJ5dGUgdHlwZU92ZXJyaWRlLAorICAgICAgICAgICAgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIGlmIHRoZXJlJ3MgYSBleFR5cGUgb3ZlcnJpZGUsIHVzZSB0aGF0LgorICAgICAgICAgICAgdmFyIHR5cGVUb1dyaXRlID0gdHlwZU92ZXJyaWRlID09IDB4RkYgPyBHZXRDb21wYWN0VHlwZShmaWVsZC5UeXBlKSA6IHR5cGVPdmVycmlkZTsKKworICAgICAgICAgICAgLy8gY2hlY2sgaWYgd2UgY2FuIHVzZSBkZWx0YSBlbmNvZGluZyBmb3IgdGhlIGZpZWxkIGlkCisgICAgICAgICAgICBpZiAoKGZpZWxkLklEID4gX2xhc3RGaWVsZElkKSAmJiAoZmllbGQuSUQgLSBfbGFzdEZpZWxkSWQgPD0gMTUpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBiID0gKGJ5dGUpICgoKGZpZWxkLklEIC0gX2xhc3RGaWVsZElkKSA8PCA0KSB8IHR5cGVUb1dyaXRlKTsKKyAgICAgICAgICAgICAgICAvLyBXcml0ZSB0aGVtIHRvZ2V0aGVyCisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhuZXdbXSB7Yn0sIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBXcml0ZSB0aGVtIHNlcGFyYXRlCisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhuZXdbXSB7dHlwZVRvV3JpdGV9LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgYXdhaXQgV3JpdGVJMTZBc3luYyhmaWVsZC5JRCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBfbGFzdEZpZWxkSWQgPSBmaWVsZC5JRDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlRmllbGRCZWdpbkFzeW5jKFRGaWVsZCBmaWVsZCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChmaWVsZC5UeXBlID09IFRUeXBlLkJvb2wpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX2Jvb2xlYW5GaWVsZCA9IGZpZWxkOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFdyaXRlRmllbGRCZWdp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rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlQ29sbGVjdGlvbkJlZ2luQXN5bmMobGlzdC5FbGVtZW50VHlwZSwgbGlzdC5Db3VudCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVMaXN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZVNldEJlZ2luQXN5bmMoVFNldCBzZXQsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBXcml0ZUNvbGxlY3Rpb25CZWdpbkFzeW5jKHNldC5FbGVtZW50VHlwZSwgc2V0LkNvdW50LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZVNldEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVCb29sQXN5bmMoYm9vbCBiLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgIFdyaXRlIGEgYm9vbGVhbiB2YWx1ZS4gUG90ZW50aWFsbHksIHRoaXMgY291bGQgYmUgYSBib29sZWFuIGZpZWxkLCBpbgorICAgICAgICAgICAgd2hpY2ggY2FzZSB0aGUgZmllbGQgaGVhZGVyIGluZm8gaXNuJ3Qgd3JpdHRlbiB5ZXQuIElmIHNvLCBkZWNpZGUgd2hhdCB0aGUKKyAgICAgICAgICAgIHJpZ2h0IGV4VHlwZSBoZWFkZXIgaXMgZm9yIHRoZSB2YWx1ZSBhbmQgdGhlbiBXcml0ZSB0aGUgZmllbGQgaGVhZGVyLgorICAgICAgICAgICAgT3RoZXJ3aXNlLCBXcml0ZSBhIHNpbmdsZSBieXRlLgorICAgICAgICAgICAgKi8KKworICAgICAgICAgICAgaWYgKF9ib29sZWFuRmllbGQgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyB3ZSBoYXZlbid0IHdyaXR0ZW4gdGhlIGZpZWxkIGhlYWRlciB5ZXQKKyAgICAgICAgICAgICAgICBhd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GF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBidWZmZXJUdXBsZSA9IENyZWF0ZVdyaXRlVmFySW50MzIoSW50VG9aaWd6YWcoaTE2KSk7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJ1ZmZlclR1cGxlLkl0ZW0xLCAwLCBidWZmZXJUdXBsZS5JdGVtMiwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIGludGVybmFsIFR1cGxlPGJ5dGVbXSwgaW50PiBDcmVhdGVXcml0ZVZhckludDMyKHVpbnQgbikKKyAgICAgICAgeworICAgICAgICAgICAgLy8gV3JpdGUgYW4gaTMyIGFzIGEgdmFyaW50LlJlc3VsdHMgaW4gMSAtIDUgYnl0ZXMgb24gdGhlIHdpcmUuCisgICAgICAgICAgICB2YXIgaTMyQnVmID0gbmV3IGJ5dGVbNV07CisgICAgICAgICAgICB2YXIgaWR4ID0gMDsKKworICAgICAgICAgICAgd2hpbGUgKHRydWUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKChuICYgfjB4N0YpID09IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpMzJCdWZbaWR4KytdID0gKGJ5dGUpIG47CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGkzMkJ1ZltpZHgrK10gPSAoYnl0ZSkgKChuICYgMHg3RikgfCAweDgwKTsKKyAgICAgICAgICAgICAgICBuID4+PSA3OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gbmV3IFR1cGxlPGJ5dGVbXSwgaW50PihpMzJCdWYsIGlkeCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUkzMkFzeW5jKGludCBpMzIsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgYnVmZmVyVHVwbGUgPSBDcmVhdGVXcml0ZVZhckludDMyKEludFRvWmlnemFnKGkzMikpOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhidWZmZXJUdXBsZS5JdGVtMSwgMCwgYnVmZmVyVHVwbGUuSXRlbTIsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBpbnRlcm5hbCBUdXBsZTxieXRlW10sIGludD4gQ3JlYXRlV3JpdGVWYXJJbnQ2NCh1bG9uZyBuKQorICAgICAgICB7CisgICAgICAgICAgICAvLyBXcml0ZSBhbiBpNjQgYXMgYSB2YXJpbnQuIFJlc3VsdHMgaW4gMS0xMCBieXRlcyBvbiB0aGUgd2lyZS4KKyAgICAgICAgICAgIHZhciBidWYgPSBuZXcgYnl0ZVsxMF07CisgICAgICAgICAgICB2YXIgaWR4ID0gMDsKKworICAgICAgICAgICAgd2hpbGUgKHRydWUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKChuICYgfih1bG9uZykgMHg3RkwpID09IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBidWZbaWR4KytdID0gKGJ5dGUpIG47CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBidWZbaWR4KytdID0gKGJ5dGUpICgobiAmIDB4N0YpIHwgMHg4MCk7CisgICAgICAgICAgICAgICAgbiA+Pj0gNzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIG5ldyBUdXBsZTxieXRlW10sIGludD4oYnVmLCBpZHgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVJNjRBc3luYyhsb25nIGk2NCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBidWZmZXJUdXBsZSA9IENyZWF0ZVdyaXRlVmFySW50NjQoTG9uZ1RvWmlnemFnKGk2NCkpOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhidWZmZXJUdXBsZS5JdGVtMSwgMCwgYnVmZmVyVHVwbGUuSXRlbTIsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlRG91YmxlQXN5bmMoZG91YmxlIGQsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgZGF0YSA9IG5ldyBieXRlWzhdOworICAgICAgICAgICAgRml4ZWRMb25n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bGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBidWZmZXJUdXBsZSA9IENyZWF0ZVdyaXRlVmFySW50MzIoKHVpbnQpIGJ5dGVzLkxlbmd0aCk7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJ1ZmZlclR1cGxlLkl0ZW0xLCAwLCBidWZmZXJUdXBsZS5JdGVtMiwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhieXRlcywgMCwgYnl0ZXMuTGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1hcEJlZ2luQXN5bmMoVE1hcCBtYXAsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobWFwLkNvdW50ID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhuZXdbXSB7KGJ5dGUpIDB9LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGJ1ZmZlclR1cGxlID0gQ3JlYXRlV3JpdGVWYXJJbnQzMigodWludCkgbWFwLkNvdW50KTsKKyAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJ1ZmZlclR1cGxlLkl0ZW0xLCAwLCBidWZmZXJUdXBsZS5JdGVtMiwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIGF3YWl0CisgICAgICAgICAgICAgICAgICAgIFRyYW5zLldyaXRlQXN5bmMoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXdbXSB7KGJ5dGUpICgoR2V0Q29tcGFjdFR5cGUobWFwLktleVR5cGUpIDw8IDQpIHwgR2V0Q29tcGFjdFR5cGUobWFwLlZhbHVlVHlwZSkpfSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlTWFwRW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUTWVzc2FnZT4gUmVhZE1lc3NhZ2VCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPFRNZXNzYWdlPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9C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2UobWVzc2FnZU5hbWUsIChUTWVzc2FnZVR5cGUpIHR5cGUsIHNlcWlkKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRNZXNzYWdlRW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUU3RydWN0PiBSZWFkU3RydWN0QmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxUU3RydWN0PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHNvbWUgbWFnaWMgaXMgaGVyZSApCisKKyAgICAgICAgICAgIF9sYXN0RmllbGQuUHVzaChfbGFzdEZpZWxkSWQpOworICAgICAgICAgICAgX2xhc3RGaWVsZElkID0gMDsKKworICAgICAgICAgICAgcmV0dXJuIEFub255bW91c1N0cnVjdDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRTdHJ1Y3RFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgIERvZXNuJ3QgYWN0dWFsbHkgY29uc3VtZSBhbnkgd2lyZSBkYXRhLCBqdXN0IHJlbW92ZXMgdGhlIGxhc3QgZmllbGQgZm9yCisgICAgICAgICAgICB0aGlzIHN0cnVjdCBmcm9tIHRoZSBmaWVsZCBzdGFjay4KKyAgICAgICAgICAgICovCisKKyAgICAgICAgICAgIC8vIGNvbnN1bWUgdGhlIGxhc3QgZmllbGQgd2UgUmVhZCBvZmYgdGhlIHdpcmUuCisgICAgICAgICAgICBfbGFzdEZpZWxkSWQgPSBfbGFzdEZpZWxkLlBvcCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8VEZpZWxkPiBSZWFkRmllbGRCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICAvLyBSZWFkIGEgZmllbGQgaGVhZGVyIG9mZiB0aGUgd2lyZS4KKyAgICAgICAgICAgIHZhciB0eXBlID0gKGJ5dGUpIGF3YWl0IFJlYWRCeXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgLy8gaWYgaXQncyBhIHN0b3AsIHRoZW4gd2UgY2FuIHJldHVybiBpbW1lZGlhdGVseSwgYXMgdGhlIHN0cnVjdCBpcyBvdmVyLgorICAgICAgICAgICAgaWYgKHR5cGUgPT0gVHlwZXMuU3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gVHN0b3A7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHNob3J0IGZpZWxkSWQ7CisgICAgICAgICAgICAvLyBtYXNrIG9mZiB0aGUgNCBNU0Igb2YgdGhlIGV4VHlwZSBoZWFkZXIuIGl0IGNvdWxkIGNvbnRhaW4gYSBmaWVsZCBpZCBkZWx0YS4KKyAgICAgICAgICAgIHZhciBtb2RpZmllciA9IChzaG9ydCkgKCh0eXBlICYgMHhmMCkgPj4gNCk7CisgICAgICAgICAgICBpZiAobW9kaWZpZXIgPT0gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaWVsZElkID0gYXdhaXQgUmVhZEkxNkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaWVsZElkID0gKHNob3J0KSAoX2xhc3RGaWVsZElkICsgbW9kaWZpZXIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgZmllbGQgPSBuZXcgVEZpZWxkKHN0cmluZy5FbXB0eSwgR2V0VFR5cGUoKGJ5dGUpICh0eXBlICYgMHgwZikpLCBmaWVsZElkKTsKKyAgICAgICAgICAgIC8vIGlmIHRoaXMgaGFwcGVucyB0byBiZSBhIGJvb2xlYW4gZmllbGQsIHRoZSB2YWx1ZSBpcyBlbmNvZGVkIGluIHRoZSBleFR5cGUKKyAgICAgICAgICAgIGlmIChJc0Jvb2xUeXBlKHR5cGUpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9ib29sVmFsdWUgPSAoYnl0ZSkgKHR5cGUgJiAweDBmKSA9PSBUeXBlcy5Cb29sZWFuVHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcHVzaCB0aGUgbmV3IGZpZWxkIG9udG8gdGhlIGZpZWxkIHN0YWNrIHNvIHdlIGNhbiBrZWVwIHRoZSBkZWx0YXMgZ29pbmcuCisgICAgICAgICAgICBfbGFzdEZpZWxkSWQgPSBmaWVsZC5JRDsKKyAgICAgICAgICAgIHJldHVybiBmaWVsZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8VE1hcD4gUmVhZE1hcEJlZ2luQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxUTWFwPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICBSZWFkIGEgbWFwIGhlYWRlciBvZmYgdGhlIHdpcmUuIElmIHRoZSBzaXplIGlzIHplcm8sIHNraXAgUmVhZGluZyB0aGUga2V5CisgICAgICAgICAgICBhbmQgdmFsdWUgZXhUeXBlLiBUaGlzIG1lYW5zIHRoYXQgMC1sZW5ndGggbWFwcyB3aWxsIHlpZWxkIFRNYXBzIHdpdGhvdXQgdGhlCisgICAgICAgICAgICAiY29ycmVjdCIgdHlwZXMuCisgICA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ICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSBfYm9vbFZhbHVlLlZhbHVlOworICAgICAgICAgICAgICAgIF9ib29sVmFsdWUgPSBudWxsOworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKSA9PSBUeXBlcy5Cb29sZWFuVHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPHNieXRlPiBSZWFkQnl0ZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPHNieXRlPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIFJlYWQgYSBzaW5nbGUgYnl0ZSBvZmYgdGhlIHdpcmUuIE5vdGhpbmcgaW50ZXJlc3RpbmcgaGVyZS4KKyAgICAgICAgICAgIHZhciBidWYgPSBuZXcgYnl0ZVsxXTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLlJlYWRBbGxBc3luYyhidWYsIDAsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHJldHVybiAoc2J5dGUpIGJ1ZlswXTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPHNob3J0PiBSZWFkSTE2QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8c2hvcnQ+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIChzaG9ydCkgWmlnemFnVG9JbnQoYXdhaXQgUmVhZFZhckludDMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGludD4gUmVhZEkzMkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGludD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gWmlnemFnVG9JbnQoYXdhaXQgUmVhZFZhckludDMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGxvbmc+IFJlYWRJNjRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxsb25nPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBaaWd6YWdUb0xvbmcoYXdhaXQgUmVhZFZhckludDY0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGRvdWJsZT4gUmVhZERvdWJsZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGRvdWJsZT4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgbG9uZ0JpdHMgPSBuZXcgYnl0ZVs4XTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLlJlYWRBbGxBc3luYyhsb25nQml0cywgMCwgOCwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICByZXR1cm4gQml0Q29udmVydGVyLkludDY0Qml0c1RvRG91YmxlKEJ5dGVzVG9Mb25nKGxvbmdCaXRzKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxzdHJpbmc+IFJlYWRTdHJpbmdBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPHN0cmluZz4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBSZWFkcyBhIGJ5dGVbXSAodmlhIFJlYWRCaW5hcnkpLCBhbmQgdGhlbiBVVEYtOCBkZWNvZGVzIGl0LgorICAgICAgICAgICAgdmFyIGxlbmd0aCA9IChpbnQpIGF3YWl0IFJlYWRWYXJJbnQzMkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICAgICAgaWYgKGxlbmd0aCA9PSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBzdHJpbmcuRW1wdHk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBidWYgPSBuZXcgYnl0ZVtsZW5ndGhdOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuUmVhZEFsbEFzeW5jKGJ1ZiwgMCwgbGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgIHJldHVybiBFbmNvZGluZy5VVEY4LkdldFN0cmluZyhidWYpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8Ynl0ZVtdPiBSZWFkQmluYXJ5QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8Ynl0ZVtdPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIFJlYWQgYSBieXRlW10gZnJvbSB0aGUgd2lyZS4KKyAgICAgICAgICAgIHZhciBsZW5ndGggPSAoaW50KSBhd2FpdCBSZWFkVmFySW50MzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAobGVuZ3RoID09IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBieXRlWzBdOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgYnVmID0gbmV3IGJ5dGVbbGVuZ3RoXTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLlJlYWRBbGxBc3luYyhidWYsIDAsIGxlbmd0aCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgcmV0dXJuIGJ1ZjsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPFRMaXN0PiBSZWFkTGlzdEJlZ2luQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxUTGlzdD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKgorICAgICAgICAgICAgUmVhZCBhIGxpc3QgaGVhZGVyIG9mZiB0aGUgd2lyZS4gSWYgdGhlIGxpc3Qgc2l6ZSBpcyAwLTE0LCB0aGUgc2l6ZSB3aWxsCisgICAgICAgICAgICBiZSBwYWNrZWQgaW50byB0aGUgZWxlbWVudCBleFR5cGUgaGVhZGVyLiBJZiBpdCdzIGEgbG9uZ2VyIGxpc3QsIHRoZSA0IE1TQgorICAgICAgICAgICAgb2YgdGhlIGVsZW1lbnQgZXhUeXBlIGhlYWRlciB3aWxsIGJlIDB4RiwgYW5kIGEgdmFyaW50IHdpbGwgZm9sbG93IHdpdGggdGhlCisgICAgICAgICAgICB0cnVlIHNpemUuCisgICAgICAgICAgICAqLworCisgICAgICAgICAgICB2YXIgc2l6ZUFuZFR5cGUgPSAoYnl0ZSkgYXdhaXQgUmVhZEJ5dGVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB2YXIgc2l6ZSA9IChzaXplQW5kVHlwZSA+PiA0KSAmIDB4MGY7CisgICAgICAgICAgICBpZiAoc2l6ZSA9PSAxNSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzaXplID0gKGludCkgYXdhaXQgUmVhZFZhckludDMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgdHlwZSA9IEdldFRUeXBlKHNpemVBbmRUeXBlKTsKKyAgICAgICAgICAgIHJldHVybiBuZXcgVExpc3QodHlwZSwgc2l6ZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBSZWFkTGlzdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgUmVhZFNldEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgYnl0ZSBHZXRDb21wYWN0VHlwZShUVHlwZSB0dHlwZSkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gR2l2ZW4gYSBUVHlwZSB2YWx1ZSwgZmluZCB0aGUgYXBwcm9wcmlhdGUgVENvbXBhY3RQcm90b2NvbC5UeXBlcyBjb25zdGFudC4KKyAgICAgICAgICAgIHJldHVybiBUVHlwZVRvQ29tcGFjdFR5cGVbKGludCkgdHR5cGVdOworICAgICAgICB9CisKKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2s8dWludD4gUmVhZFZhckludDMyQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8dWludD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKgorICAgICAgICAgICAgUmVhZCBhbiBpMzIgZnJvbSB0aGUgd2lyZSBhcyBhIHZhcmludC4gVGhlIE1TQiBvZiBlYWNoIGJ5dGUgaXMgc2V0CisgICAgICAgICAgICBpZiB0aGVyZSBpcyBhbm90aGVyIGJ5dGUgdG8gZm9sbG93LiBUaGlzIGNhbiBSZWFkIHVwIHRvIDUgYnl0ZXMuCisgICAgICAgICAgICAqLworCisgICAgICAgICAgICB1aW50IHJlc3VsdCA9IDA7CisgICAgICAgICAgICB2YXIgc2hpZnQgPSAwOworCisgICAgICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgYiA9IChieXRlKSBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICByZXN1bHQgfD0gKHVpbnQpIChiICYgMHg3ZikgPDwgc2hpZnQ7CisgICAgICAgICAgICAgICAgaWYgKChiICYgMHg4MCkgIT0gMHg4MCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzaGlmdCArPSA3OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrPHVsb25nPiBSZWFkVmFySW50NjRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDx1aW50PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICBSZWFkIGFuIGk2NCBmcm9tIHRoZSB3aXJlIGFzIGEgcHJvcGVyIHZhcmludC4gVGhlIE1TQiBvZiBlYWNoIGJ5dGUgaXMgc2V0CisgICAgICAgICAgICBpZiB0aGVyZSBpcyBhbm90aGVyIGJ5dGUgdG8gZm9sbG93LiBUaGlzIGNhbiBSZWFkIHVwIHRvIDEwIGJ5dGVzLgorICAgICAgICAgICAgKi8KKworICAgICAgICAgICAgdmFyIHNoaWZ0ID0gMDsKKyAgICAgICAgICAgIHVsb25nIHJlc3VsdCA9IDA7CisgICAgICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgYiA9IChieXRlKSBhd2FpdCBSZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICByZXN1bHQgfD0gKHVsb25nKSAoYiAmIDB4N2YpIDw8IHNoaWZ0OworICAgICAgICAgICAgICAgIGlmICgoYiAmIDB4ODApICE9IDB4ODApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2hpZnQgKz0gNzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIGludCBaaWd6YWdUb0ludCh1aW50IG4pCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiAoaW50KSAobiA+PiAxKSBeIC0oaW50KSAobiAmIDEpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgbG9uZyBaaWd6YWdUb0xvbmcodWxvbmcgbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIChsb25nKSAobiA+PiAxKSBeIC0obG9uZykgKG4gJiAxKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIGxvbmcgQnl0ZXNUb0xvbmcoYnl0ZVtdIGJ5dGVzKQorICAgICAgICB7CisgICAgICAgICAgICAvKgorICAgICAgICAgICAgTm90ZSB0aGF0IGl0J3MgaW1wb3J0YW50IHRoYXQgdGhlIG1hc2sgYnl0ZXMgYXJlIGxvbmcgbGl0ZXJhbHMsCisgICAgICAgICAgICBvdGhlcndpc2UgdGhleSdsbCBkZWZhdWx0IHRvIGludHMsIGFuZCB3aGVuIHlvdSBzaGlmdCBhbiBpbnQgbGVmdCA1NiBiaXRzLAorICAgICAgICAgICAgeW91IGp1c3QgZ2V0IGEgbWVzc2VkIHVwIGludC4KKyAgICAgICAgICAgICovCisKKyAgICAgICAgICAgIHJldHVybgorICAgICAgICAgICAgICAgICgoYnl0ZXNbN10gJiAweGZmTCkgPDwgNTYpIHwKKyAgICAgICAgICAgICAgICAoKGJ5dGVzWzZdICYgMHhmZkwpIDw8IDQ4KSB8CisgICAgICAgICAgICAgICAgKChieXRlc1s1XSAmIDB4ZmZMKSA8PCA0MCkgfAorICAgICAgICAgICAgICAgICgoYnl0ZXNbNF0gJiAweGZmTCkgPDwgMzIpIHwKKyAgICAgICAgICAgICAgICAoKGJ5dGVzWzNdICYgMHhmZkwpIDw8IDI0KSB8CisgICAgICAgICAgICAgICAgKChieXRlc1syXSAmIDB4ZmZMKSA8PCAxNikgfAorICAgICAgICAgICAgICAgICgoYnl0ZXNbMV0gJiAweGZmTCkgPDwgOCkgfAorICAgICAgICAgICAgICAgIChieXRlc1swXSAmIDB4ZmZMKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIGJvb2wgSXNCb29sVHlwZShieXRlIGIpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBsb3dlck5pYmJsZSA9IGIgJiAweDBmOworICAgICAgICAgICAgcmV0dXJuIChsb3dlck5pYmJsZSA9PSBUeXBlcy5Cb29sZWFuVHJ1ZSkgfHwgKGxvd2VyTmliYmxlID09IFR5cGVzLkJvb2xlYW5GYWxzZSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBUVHlwZSBHZXRUVHlwZShieXRlIHR5cGUpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIEdpdmVuIGEgVENvbXBhY3RQcm90b2NvbC5UeXBlcyBjb25zdGFudCwgY29udmVydCBpdCB0byBpdHMgY29ycmVzcG9uZGluZyBUVHlwZSB2YWx1ZS4KKyAgICAgICAgICAgIHN3aXRjaCAoKGJ5dGUpICh0eXBlICYgMHgwZikpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2FzZSBUeXBlcy5TdG9wOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuU3RvcDsKKyAgICAgICAgICAgICAgICBjYXNlIFR5cGVzLkJvb2xlYW5GYWxzZToKKyAgICAgICAgICAgICAgICBjYXNlIFR5cGVzLkJvb2xlYW5UcnVlOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuQm9vbDsKKyAgICAgICAgICAgICAgICBjYXNlIFR5cGVzLkJ5dGU6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUVHlwZS5CeXRlOworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuSTE2OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuSTE2OworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuSTMyOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuSTMyOworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuSTY0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuSTY0OworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuRG91YmxlOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuRG91YmxlOworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuQmluYXJ5OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVFR5cGUuU3RyaW5nOworICAgICAgICAgICAgICAgIGNhc2UgVHlwZXMuTGlzdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRUeXBlLkxpc3Q7CisgICAgICAgICAgICAgICAgY2FzZSBUeXBlcy5TZXQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUVHlwZS5TZXQ7CisgICAgICAgICAgICAgICAgY2FzZSBUeXBlcy5NYXA6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUVHlwZS5NYXA7CisgICAgICAgICAgICAgICAgY2FzZSBUeXBlcy5TdHJ1Y3Q6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUVHlwZS5TdHJ1Y3Q7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigkIkRvbid0IGtub3cgd2hhdCBleFR5cGU6IHsoYnl0ZSkgKHR5cGUgJiAweDBmKX0iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIHVsb25nIExvbmdUb1ppZ3phZyhsb25nIG4pCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIENvbnZlcnQgbCBpbnRvIGEgemlnemFnIGxvbmcuIFRoaXMgYWxsb3dzIG5lZ2F0aXZlIG51bWJlcnMgdG8gYmUgcmVwcmVzZW50ZWQgY29tcGFjdGx5IGFzIGEgdmFyaW50CisgICAgICAgICAgICByZXR1cm4gKHVsb25nKSAobiA8PCAxKSBeICh1bG9uZykgKG4gPj4gNjMpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBJbnRUb1ppZ3phZyhpbnQgbikKKyAgICAgICAgeworICAgICAgICAgICAgLy8gQ29udmVydCBuIGludG8gYSB6aWd6YWcgaW50LiBUaGlzIGFsbG93cyBuZWdhdGl2ZSBudW1iZXJzIHRvIGJlIHJlcHJlc2VudGVkIGNvbXBhY3RseSBhcyBhIHZhcmludAorICAgICAgICAgICAgcmV0dXJuICh1aW50KSAobiA8PCAxKSBeICh1aW50KSAobiA+PiAzMSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyB2b2lkIEZpeGVkTG9uZ1RvQnl0ZXMobG9uZyBuLCBieXRlW10gYnVmLCBpbnQgb2ZmKQorICAgICAgICB7CisgICAgICAgICAgICAvLyBDb252ZXJ0IGEgbG9uZyBpbnRvIGxpdHRsZS1lbmRpYW4gYnl0ZXMgaW4gYnVmIHN0YXJ0aW5nIGF0IG9mZiBhbmQgZ29pbmcgdW50aWwgb2ZmKzcuCisgICAgICAgICAgICBidWZbb2ZmICsgMF0gPSAoYnl0ZSkgKG4gJiAweGZmKTsKKyAgICAgICAgICAgIGJ1ZltvZmYgKyAxXSA9IChieXRlKSAoKG4gPj4gOCkgJiAweGZmKTsKKyAgICAgICAgICAgIGJ1ZltvZmYgKyAyXSA9IChieXRlKSAoKG4gPj4gMTYpICYgMHhmZik7CisgICAgICAgICAgICBidWZbb2ZmICsgM10gPSAoYnl0ZSkgKChuID4+IDI0KSAmIDB4ZmYpOworICAgICAgICAgICAgYnVmW29mZiArIDRdID0gKGJ5dGUpICgobiA+PiAzMikgJiAweGZmKTsKKyAgICAgICAgICAgIGJ1ZltvZmYgKyA1XSA9IChieXRlKSAoKG4gPj4gNDApICYgMHhmZik7CisgICAgICAgICAgICBidWZbb2ZmICsgNl0gPSAoYnl0ZSkgKChuID4+IDQ4KSAmIDB4ZmYpOworICAgICAgICAgICAgYnVmW29mZiArIDddID0gKGJ5dGUpICgobiA+PiA1NikgJiAweGZmKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBjbGFzcyBGYWN0b3J5IDogSVRQcm90b2NvbEZhY3RvcnkKKyAgICAgICAgeworICAgICAgICAgICAgcHVibGljIFRQcm90b2NvbCBHZXRQcm90b2NvbChUQ2xpZW50VHJhbnNwb3J0IHRyYW5zKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVENvbXBhY3RQcm90b2NvbCh0cmFucyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgQWxsIG9mIHRoZSBvbi13aXJlIGV4VHlwZSBjb2Rlcy4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgVHlwZXMKKyAgICAgICAgeworICAgICAgICAgICAgcHVibGljIGNvbnN0IGJ5dGUgU3RvcCA9IDB4MDA7CisgICAgICAgICAgICBwdWJsaWMgY29uc3QgYnl0ZSBCb29sZWFuVHJ1ZSA9ID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WRvbmx5IGJ5dGVbXSBfdGVtcEJ1ZmZlciA9IG5ldyBieXRlWzRdOworCisgICAgICAgIC8vIEN1cnJlbnQgY29udGV4dCB0aGF0IHdlIGFyZSBpbgorICAgICAgICBwcm90ZWN0ZWQgSlNPTkJhc2VDb250ZXh0IENvbnRleHQ7CisKKyAgICAgICAgLy8gU3RhY2sgb2YgbmVzdGVkIGNvbnRleHRzIHRoYXQgd2UgbWF5IGJlIGluCisgICAgICAgIHByb3RlY3RlZCBTdGFjazxKU09OQmFzZUNvbnRleHQ+IENvbnRleHRTdGFjayA9IG5ldyBTdGFjazxKU09OQmFzZUNvbnRleHQ+KCk7CisKKyAgICAgICAgLy8gUmVhZGVyIHRoYXQgbWFuYWdlcyBhIDEtYnl0ZSBidWZmZXIKKyAgICAgICAgcHJvdGVjdGVkIExvb2thaGVhZFJlYWRlciBSZWFkZXI7CisKKyAgICAgICAgLy8gRGVmYXVsdCBlbmNvZGluZworICAgICAgICBwcm90ZWN0ZWQgRW5jb2RpbmcgVXRmOEVuY29kaW5nID0gRW5jb2RpbmcuVVRGODsKKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgVEpzb25Qcm90b2NvbCBDb25zdHJ1Y3RvcgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgVEpzb25Qcm90b2NvbChUQ2xpZW50VHJhbnNwb3J0IHRyYW5zKQorICAgICAgICAgICAgOiBiYXNlKHRyYW5zKQorICAgICAgICB7CisgICAgICAgICAgICBDb250ZXh0ID0gbmV3IEpTT05CYXNlQ29udGV4dCh0aGlzKTsKKyAgICAgICAgICAgIFJlYWRlciA9IG5ldyBMb29rYWhlYWRSZWFkZXIodGhpcyk7CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgUHVzaCBhIG5ldyBKU09OIGNvbnRleHQgb250byB0aGUgc3RhY2suCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByb3RlY3RlZCB2b2lkIFB1c2hDb250ZXh0KEpTT05CYXNlQ29udGV4dCBjKQorICAgICAgICB7CisgICAgICAgICAgICBDb250ZXh0U3RhY2suUHVzaChDb250ZXh0KTsKKyAgICAgICAgICAgIENvbnRleHQgPSBjOworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFBvcCB0aGUgbGFzdCBKU09OIGNvbnRleHQgb2ZmIHRoZSBzdGFjaworICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBQb3BDb250ZXh0KCkKKyAgICAgICAgeworICAgICAgICAgICAgQ29udGV4dCA9IENvbnRleHRTdGFjay5Qb3AoKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vICAgICBSZWFkIGEgYnl0ZSB0aGF0IG11c3QgbWF0Y2ggYlswXTsgb3RoZXJ3aXNlIGFuIGV4Y2VwdGlvbiBpcyB0aHJvd24uCisgICAgICAgIC8vLyAgICAgTWFya2VkIHByb3RlY3RlZCB0byBhdm9pZCBzeW50aGV0aWMgYWNjZXNzb3IgaW4gSlNPTkxpc3RDb250ZXh0LlJlYWQKKyAgICAgICAgLy8vICAgICBhbmQgSlNPTlBhaXJDb250ZXh0LlJlYWQKKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJvdGVjdGVkIGFzeW5jIFRhc2sgUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoYnl0ZVtdIGJ5dGVzLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGNoID0gYXdhaXQgUmVhZGVyLlJlYWRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoY2ggIT0gYnl0ZXNbMF0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAkIlVuZXhwZWN0ZWQgY2hhcmFjdGVyOiB7KGNoYXIpIGNofSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFdyaXRlIHRoZSBieXRlcyBpbiBhcnJheSBidWYgYXMgYSBKU09OIGNoYXJhY3RlcnMsIGVzY2FwaW5nIGFzIG5lZWRlZAorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVKc29uU3RyaW5nQXN5bmMoYnl0ZVtdIGJ5dGVzLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5Xcml0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICB2YXIgbGVuID0gYnl0ZXMuTGVuZ3RoOworICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoKGJ5dGVzW2ldICYgMHgwMEZGKSA+PSAweDMwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJ5dGVzW2ldID09IFRKU09OUHJvdG9jb2xDb25zdGFudHMuQmFja3NsYXNoWzBdKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuQmFja3NsYXNoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuQmFja3NsYXNoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJ5dGVzLlRvQXJyYXkoKSwgaSwgMSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF90ZW1wQnVmZmVyWzBdID0gVEpTT05Qcm90b2NvbENvbnN0YW50cy5Kc29uQ2hhclRhYmxlW2J5dGVzW2ldXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKF90ZW1wQnVmZmVyWzBdID09IDEpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoYnl0ZXMsIGksIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChfdGVtcEJ1ZmZlclswXSA+IDEpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5CYWNrc2xhc2gsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoX3RlbXBCdWZmZXIsIDAsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5Fc2NTZXF1ZW5jZXMsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIF90ZW1wQnVmZmVyWzBdID0gVEpTT05Qcm90b2NvbEhlbHBlci5Ub0hleENoYXIoKGJ5dGUpIChieXRlc1tpXSA+PiA0KSk7CisgICAgICAgICAgICAgICAgICAgICAgICBfdGVtcEJ1ZmZlclsxXSA9IFRKU09OUHJvdG9jb2xIZWxwZXIuVG9IZXhDaGFyKGJ5dGVzW2ldKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoX3RlbXBCdWZmZXIsIDAsIDIsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFdyaXRlIG91dCBudW1iZXIgYXMgYSBKU09OIHZhbHVlLiBJZiB0aGUgY29udGV4dCBkaWN0YXRlcyBzbywgaXQgd2lsbCBiZQorICAgICAgICAvLy8gICAgIHdyYXBwZWQgaW4gcXVvdGVzIHRvIG91dHB1dCBhcyBhIEpTT04gc3RyaW5nLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVKc29uSW50ZWdlckFzeW5jKGxvbmcgbnVtLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5Xcml0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHZhciBzdHIgPSBudW0uVG9TdHJpbmcoKTsKKworICAgICAgICAgICAgdmFyIGVzY2FwZU51bSA9IENvbnRleHQuRXNjYXBlTnVtYmVycygpOworICAgICAgICAgICAgaWYgKGVzY2FwZU51bSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuUXVvdGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGJ5dGVzID0gVXRmOEVuY29kaW5nLkdldEJ5dGVzKHN0cik7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKGJ5dGVzLCBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLlF1b3RlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgV3JpdGUgb3V0IGEgZG91YmxlIGFzIGEgSlNPTiB2YWx1ZS4gSWYgaXQgaXMgTmFOIG9yIGluZmluaXR5IG9yIGlmIHRoZQorICAgICAgICAvLy8gICAgIGNvbnRleHQgZGljdGF0ZXMgZXNjYXBpbmcsIFdyaXRlIG91dCBhcyBKU09OIHN0cmluZy4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrIFdyaXRlSnNvbkRvdWJsZUFzeW5jKGRvdWJsZSBudW0sIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBDb250ZXh0LldyaXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgdmFyIHN0ciA9IG51bS5Ub1N0cmluZygiRzE3IiwgQ3VsdHVyZUluZm8uSW52YXJpYW50Q3VsdHVyZSk7CisgICAgICAgICAgICB2YXIgc3BlY2lhbCA9IGZhbHNlOworCisgICAgICAgICAgICBzd2l0Y2ggKHN0clswXSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlICdOJzogLy8gTmFOCisgICAgICAgICAgICAgICAgY2FzZSAnSSc6IC8vIEluZmluaXR5CisgICAgICAgICAgICAgICAgICAgIHNwZWNpYWwgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlICctJzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKHN0clsxXSA9PSAnSScpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIC1JbmZpbml0eQorICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBlc2NhcGVOdW0gPSBzcGVjaWFsIHx8IENvbnRleHQuRXNjYXBlTnVtYmVycygpOworCisgICAgICAgICAgICBpZiAoZXNjYXBlTnVtKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFV0ZjhFbmNvZGluZy5HZXRCeXRlcyhzdHIpLCBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgIGlmIChlc2NhcGVOdW0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLlF1b3RlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgV3JpdGUgb3V0IGNvbnRlbnRzIG9mIGJ5dGUgYXJyYXkgYiBhcyBhIEpTT04gc3RyaW5nIHdpdGggYmFzZS02NCBlbmNvZGVkCisgICAgICAgIC8vLyAgICAgZGF0YQorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVKc29uQmFzZTY0QXN5bmMoYnl0ZVtdIGJ5dGVzLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5Xcml0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICB2YXIgbGVuID0gYnl0ZXMuTGVuZ3RoOworICAgICAgICAgICAgdmFyIG9mZiA9IDA7CisKKyAgICAgICAgICAgIHdoaWxlIChsZW4gPj0gMykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBFbmNvZGUgMyBieXRlcyBhdCBhIHRpbWUKKyAgICAgICAgICAgICAgICBUQmFzZTY0SGVscGVyLkVuY29kZShieXRlcywgb2ZmLCAzLCBfdGVtcEJ1ZmZlciwgMCk7CisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhfdGVtcEJ1ZmZlciwgMCwgNCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIG9mZiArPSAzOworICAgICAgICAgICAgICAgIGxlbiAtPSAzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobGVuID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBFbmNvZGUgcmVtYWluZGVyCisgICAgICAgICAgICAgICAgVEJhc2U2NEhlbHBlci5FbmNvZGUoYnl0ZXMsIG9mZiwgbGVuLCBfdGVtcEJ1ZmZlciwgMCk7CisgICAgICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhfdGVtcEJ1ZmZlciwgMCwgbGVuICsgMSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuUXVvdGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBXcml0ZUpzb25PYmplY3RTdGFydEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBDb250ZXh0LldyaXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLkxlZnRCcmFjZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgUHVzaENvbnRleHQobmV3IEpTT05QYWlyQ29udGV4dCh0aGlzKSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVKc29uT2JqZWN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIFBvcENvbnRleHQoKTsKKyAgICAgICAgICAgIGF3YWl0IFRyYW5zLldyaXRlQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5SaWdodEJyYWNlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgV3JpdGVKc29uQXJyYXlTdGFydEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBDb250ZXh0LldyaXRlQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgVHJhbnMuV3JpdGVBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLkxlZnRCcmFja2V0LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBQdXNoQ29udGV4dChuZXcgSlNPTkxpc3RDb250ZXh0KHRoaXMpKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBXcml0ZUpzb25BcnJheUVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBQb3BDb250ZXh0KCk7CisgICAgICAgICAgICBhd2FpdCBUcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuUmlnaHRCcmFja2V0LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZU1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dGVKc29uT2JqZWN0U3RhcnRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZVN0cnVjdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25PYmplY3RFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUZpZWxkQmVnaW5Bc3luYyhURmllbGQgZmllbGQsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25JbnRlZ2VyQXN5bmMoZmllbGQuSUQsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlSnNvbk9iamVjdFN0YXJ0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgV3JpdGVKc29uU3RyaW5nQXN5bmMoVEpTT05Qcm90b2NvbEhlbHBlci5HZXRUeXBlTmFtZUZvclR5cGVJZChmaWVsZC5UeXBlKSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25PYmplY3RFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUZpZWxkU3RvcEF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2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25BcnJheVN0YXJ0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgV3JpdGVKc29uU3RyaW5nQXN5bmMoVEpTT05Qcm90b2NvbEhlbHBlci5HZXRUeXBlTmFtZUZvclR5cGVJZChzZXQuRWxlbWVudFR5cGUpLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25JbnRlZ2VyQXN5bmMoc2V0LkNvdW50LCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZVNldEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25BcnJheUVuZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlQm9vbEFzeW5jKGJvb2wgYiwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlSnNvbkludGVnZXJBc3luYyhiID8gMSA6IDAsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlQnl0ZUFzeW5jKHNieXRlIGIsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZUpzb25JbnRlZ2VyQXN5bmMoYiwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHV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ICAgICB7CisgICAgICAgICAgICB2YXIgYiA9IFV0ZjhFbmNvZGluZy5HZXRCeXRlcyhzKTsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlSnNvblN0cmluZ0FzeW5jKGIsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlQmluYXJ5QXN5bmMoYnl0ZVtdIGJ5dGVzLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgV3JpdGVKc29uQmFzZTY0QXN5bmMoYnl0ZXMsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vICAgICBSZWFkIGluIGEgSlNPTiBzdHJpbmcsIHVuZXNjYXBpbmcgYXMgYXBwcm9wcmlhdGUuLiBTa2lwIFJlYWRpbmcgZnJvbSB0aGUKKyAgICAgICAgLy8vICAgICBjb250ZXh0IGlmIHNraXBDb250ZXh0IGlzIHRydWUuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzazxieXRlW10+IFJlYWRKc29uU3RyaW5nQXN5bmMoYm9vbCBza2lwQ29udGV4dCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIHVzaW5nICh2YXIgYnVmZmVyID0gbmV3IE1lbW9yeVN0cmVhbSgpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBjb2RldW5pdHMgPSBuZXcgTGlzdDxjaGFyPigpOworCisKKyAgICAgICAgICAgICAgICBpZiAoIXNraXBDb250ZXh0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5SZWFkQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGF3YWl0IFJlYWRKc29uU3ludGF4Q2hhckFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuUXVvdGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGNoID0gYXdhaXQgUmVhZGVyLlJlYWRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PSBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlF1b3RlWzBdKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIGVzY2FwZWQ/CisgICAgICAgICAgICAgICAgICAgIGlmIChjaCAhPSBUSlNPTlByb3RvY29sQ29uc3RhbnRzLkVzY1NlcXVlbmNlc1swXSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgYnVmZmVyLldyaXRlQXN5bmMobmV3W10ge2NofSwgMCwgMSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBkaXN0aW5ndWlzaCBiZXR3ZWVuIFx1WFhYWCBhbmQgXD8KKyAgICAgICAgICAgICAgICAgICAgY2ggPSBhd2FpdCBSZWFkZXIuUmVhZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNoICE9IFRKU09OUHJvdG9jb2xDb25zdGFudHMuRXNjU2VxdWVuY2VzWzFdKSAvLyBjb250cm9sIGNoYXJzIGxpa2UgXG4KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG9mZiA9IEFycmF5LkluZGV4T2YoVEpTT05Qcm90b2NvbENvbnN0YW50cy5Fc2NhcGVDaGFycywgKGNoYXIpIGNoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvZmYgPT0gLTEpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgY29udHJvbCBjaGFyIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBjaCA9IFRKU09OUHJvdG9jb2xDb25zdGFudHMuRXNjYXBlQ2hhclZhbHVlc1tvZmZdOworICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgYnVmZmVyLldyaXRlQXN5bmMobmV3W10ge2NofSwgMCwgMSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBpdCdzIFx1WFhYWAorICAgICAgICAgICAgICAgICAgICBhd2FpdCBUcmFucy5SZWFkQWxsQXN5bmMoX3RlbXBCdWZmZXIsIDAsIDQsIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgd2NoID0gKHNob3J0KSAoKFRKU09OUHJvdG9jb2xIZWxwZXIuVG9IZXhWYWwoX3RlbXBCdWZmZXJbMF0pIDw8IDEyKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoVEpTT05Qcm90b2NvbEhlbHBlci5Ub0hleFZhbChfdGVtcEJ1ZmZlclsxXSkgPDwgOCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFRKU09OUHJvdG9jb2xIZWxwZXIuVG9IZXhWYWwoX3RlbXBCdWZmZXJbMl0pIDw8IDQpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRKU09OUHJvdG9jb2xIZWxwZXIuVG9IZXhWYWwoX3RlbXBCdWZmZXJbM10pKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY2hhci5Jc0hpZ2hTdXJyb2dhdGUoKGNoYXIpIHdjaCkpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb2RldW5pdHMuQ291bnQgPiAwKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIkV4cGVjdGVkIGxvdyBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgY29kZXVuaXRzLkFkZCgoY2hhcikgd2NoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChjaGFyLklzTG93U3Vycm9nYXRlKChjaGFyKSB3Y2gpKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXVuaXRzLkNvdW50ID09IDApCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgaGlnaCBzdXJyb2dhdGUgY2hhciIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICBjb2RldW5pdHMuQWRkKChjaGFyKSB3Y2gpOworICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRtcCA9IFV0ZjhFbmNvZGluZy5HZXRCeXRlcyhjb2RldW5pdHMuVG9BcnJheSgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IGJ1ZmZlci5Xcml0ZUFzeW5jKHRtcCwgMCwgdG1wLkxlbmd0aCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgY29kZXVuaXRzLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdG1wID0gVXRmOEVuY29kaW5nLkdldEJ5dGVzKG5ld1tdIHsoY2hhcikgd2NofSk7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBidWZmZXIuV3JpdGVBc3luYyh0bXAsIDAsIHRtcC5MZW5ndGgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChjb2RldW5pdHMuQ291bnQgPiAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiRXhwZWN0ZWQgbG93IHN1cnJvZ2F0ZSBjaGFyIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlci5Ub0FycmF5KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgUmVhZCBpbiBhIHNlcXVlbmNlIG9mIGNoYXJhY3RlcnMgdGhhdCBhcmUgYWxsIHZhbGlkIGluIEpTT04gbnVtYmVycy4gRG9lcworICAgICAgICAvLy8gICAgIG5vdCBkbyBhIGNvbXBsZXRlIHJlZ2V4IGNoZWNrIHRvIHZhbGlkYXRlIHRoYXQgdGhpcyBpcyBhY3R1YWxseSBhIG51bWJlci4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrPHN0cmluZz4gUmVhZEpzb25OdW1lcmljQ2hhcnNBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHN0cmJsZCA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvL1RPRE86IHdvcmthcm91bmQgZm9yIHByaW1pdGl2ZSB0eXBlcyB3aXRoIFRKc29uUHJvdG9jb2wsIHRoaW5rIC0gaG93IHRvIHJld3JpdGUgaW50byBtb3JlIGVhc3kgZm9ybSB3aXRob3V0IGV4Y2VwdGlvbnMKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBjaCA9IGF3YWl0IFJlYWRlci5QZWVrQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICBpZiAoIVRKU09OUHJvdG9jb2xIZWxwZXIuSXNKc29uTnVtZXJpYyhjaCkpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHZhciBjID0gKGNoYXIpYXdhaXQgUmVhZGVyLlJlYWRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgIHN0cmJsZC5BcHBlbmQoYyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHN0cmJsZC5Ub1N0cmluZygpOworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFJlYWQgaW4gYSBKU09OIG51bWJlci4gSWYgdGhlIGNvbnRleHQgZGljdGF0ZXMsIFJlYWQgaW4gZW5jbG9zaW5nIHF1b3Rlcy4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrPGxvbmc+IFJlYWRKc29uSW50ZWdlckFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBDb250ZXh0LlJlYWRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoQ29udGV4dC5Fc2NhcGVOdW1iZXJzKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgc3RyID0gYXdhaXQgUmVhZEpzb25OdW1lcmljQ2hhcnNBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoQ29udGV4dC5Fc2NhcGVOdW1iZXJzKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbG9uZy5QYXJzZShzdHIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEZvcm1hdEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsICJCYWQgZGF0YSBlbmNvdW50ZWQgaW4gbnVtZXJpYyBkYXRhIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgUmVhZCBpbiBhIEpTT04gZG91YmxlIHZhbHVlLiBUaHJvdyBpZiB0aGUgdmFsdWUgaXMgbm90IHdyYXBwZWQgaW4gcXVvdGVzCisgICAgICAgIC8vLyAgICAgd2hlbiBleHBlY3RlZCBvciBpZiB3cmFwcGVkIGluIHF1b3RlcyB3aGVuIG5vdCBleHBlY3RlZC4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrPGRvdWJsZT4gUmVhZEpzb25Eb3VibGVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5SZWFkQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgaWYgKGF3YWl0IFJlYWRlci5QZWVrQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pID09IFRKU09OUHJvdG9jb2xDb25zdGFudHMuUXVvdGVbMF0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGFyciA9IGF3YWl0IFJlYWRKc29uU3RyaW5nQXN5bmModHJ1ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIHZhciBkdWIgPSBkb3VibGUuUGFyc2UoVXRmOEVuY29kaW5nLkdldFN0cmluZyhhcnIsIDAsIGFyci5MZW5ndGgpLCBDdWx0dXJlSW5mby5JbnZhcmlhbnRDdWx0dXJlKTsKKworICAgICAgICAgICAgICAgIGlmICghQ29udGV4dC5Fc2NhcGVOdW1iZXJzKCkgJiYgIWRvdWJsZS5Jc05hTihkdWIpICYmICFkb3VibGUuSXNJbmZpbml0eShkdWIpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhyb3cgZXhjZXB0aW9uIC0tIHdlIHNob3VsZCBub3QgYmUgaW4gYSBzdHJpbmcgaW4gdGhpcyBjYXNlCisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIk51bWVyaWMgZGF0YSB1bmV4cGVjdGVkbHkgcXVvdGVkIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIGR1YjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKENvbnRleHQuRXNjYXBlTnVtYmVycygpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIFRoaXMgd2lsbCB0aHJvdyAtIHdlIHNob3VsZCBoYXZlIGhhZCBhIHF1b3RlIGlmIGVzY2FwZU51bSA9PSB0cnVlCisgICAgICAgICAgICAgICAgYXdhaXQgUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5RdW90ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZG91YmxlLlBhcnNlKGF3YWl0IFJlYWRKc29uTnVtZXJpY0NoYXJzQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pLCBDdWx0dXJlSW5mby5JbnZhcmlhbnRDdWx0dXJlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChGb3JtYXRFeGNlcHRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFJlYWQgaW4gYSBKU09OIHN0cmluZyBjb250YWluaW5nIGJhc2UtNjQgZW5jb2RlZCBkYXRhIGFuZCBkZWNvZGUgaXQuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzazxieXRlW10+IFJlYWRKc29uQmFzZTY0QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBiID0gYXdhaXQgUmVhZEpzb25TdHJpbmdBc3luYyhmYWxzZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgdmFyIGxlbiA9IGIuTGVuZ3RoOworICAgICAgICAgICAgdmFyIG9mZiA9IDA7CisgICAgICAgICAgICB2YXIgc2l6ZSA9IDA7CisKKyAgICAgICAgICAgIC8vIHJlZHVjZSBsZW4gdG8gaWdub3JlIGZpbGwgYnl0ZXMKKyAgICAgICAgICAgIHdoaWxlICgobGVuID4gMCkgJiYgKGJbbGVuIC0gMV0gPT0gJz0nKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAtLWxlbjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcmVhZCAmIGRlY29kZSBmdWxsIGJ5dGUgdHJpcGxldHMgPSA0IHNvdXJjZSBieXRlcworICAgICAgICAgICAgd2hpbGUgKGxlbiA+IDQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gRGVjb2RlIDQgYnl0ZXMgYXQgYSB0aW1lCisgICAgICAgICAgICAgICAgVEJhc2U2NEhlbHBlci5EZWNvZGUoYiwgb2ZmLCA0LCBiLCBzaXplKTsgLy8gTkI6IGRlY29kZWQgaW4gcGxhY2UKKyAgICAgICAgICAgICAgICBvZmYgKz0gNDsKKyAgICAgICAgICAgICAgICBsZW4gLT0gNDsKKyAgICAgICAgICAgICAgICBzaXplICs9IDM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIERvbid0IGRlY29kZSBpZiB3ZSBoaXQgdGhlIGVuZCBvciBnb3QgYSBzaW5nbGUgbGVmdG92ZXIgYnl0ZSAoaW52YWxpZAorICAgICAgICAgICAgLy8gYmFzZTY0IGJ1dCBsZWdhbCBmb3Igc2tpcCBvZiByZWd1bGFyIHN0cmluZyBleFR5cGUpCisgICAgICAgICAgICBpZiAobGVuID4gMSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBEZWNvZGUgcmVtYWluZGVyCisgICAgICAgICAgICAgICAgVEJhc2U2NEhlbHBlci5EZWNvZGUoYiwgb2ZmLCBsZW4sIGIsIHNpemUpOyAvLyBOQjogZGVjb2RlZCBpbiBwbGFjZQorICAgICAgICAgICAgICAgIHNpemUgKz0gbGVuIC0gMTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gU2FkbHkgd2UgbXVzdCBjb3B5IHRoZSBieXRlW10gKGFueSB3YXkgYXJvdW5kIHRoaXM/KQorICAgICAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBieXRlW3NpemVdOworICAgICAgICAgICAgQXJyYXkuQ29weShiLCAwLCByZXN1bHQsIDAsIHNpemUpOworICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBSZWFkSnNvbk9iamVjdFN0YXJ0QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IENvbnRleHQuUmVhZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGF3YWl0IFJlYWRKc29uU3ludGF4Q2hhckFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuTGVmdEJyYWNlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBQdXNoQ29udGV4dChuZXcgSlNPTlBhaXJDb250ZXh0KHRoaXMpKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBSZWFkSnNvbk9iamVjdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBSZWFkSnNvblN5bnRheENoYXJBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLlJpZ2h0QnJhY2UsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIFBvcENvbnRleHQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBSZWFkSnNvbkFycmF5U3RhcnRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgQ29udGV4dC5SZWFkQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgYXdhaXQgUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoVEpTT05Qcm90b2NvbENvbnN0YW50cy5MZWZ0QnJhY2tldCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgUHVzaENvbnRleHQobmV3IEpTT05MaXN0Q29udGV4dCh0aGlzKSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgUmVhZEpzb25BcnJheUVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBSZWFkSnNvblN5bnRheENoYXJBc3luYyhUSlNPTlByb3RvY29sQ29uc3RhbnRzLlJpZ2h0QnJhY2tldCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgUG9wQ29udGV4dCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8VE1lc3NhZ2U+IFJlYWRNZXNzYWdlQmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIG1lc3NhZ2UgPSBuZXcgVE1lc3NhZ2UoKTsKKyAgICAgICAgICAgIGF3YWl0IFJlYWRKc29uQXJyYXlTdGFydEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGlmIChhd2FpdCBSZWFkSnNvbkludGVnZXJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbikgIT0gVmVyc2lvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5CQURfVkVSU0lPTiwgIk1lc3NhZ2UgY29udGFpbmVkIGJhZCB2ZXJzaW9uLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgYnVmID0gYXdhaXQgUmVhZEpzb25TdHJpbmdBc3luYyhmYWxzZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgbWVzc2FnZS5OYW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AgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8VEZpZWxkPiBSZWFkRmllbGRCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgZmllbGQgPSBuZXcgVEZpZWxkKCk7CisgICAgICAgICAgICB2YXIgY2ggPSBhd2FpdCBSZWFkZXIuUGVla0FzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIGlmIChjaCA9PSBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlJpZ2h0QnJhY2VbMF0pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZmllbGQuVHlwZSA9IFRUeXBlLlN0b3A7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZmllbGQuSUQgPSAoc2hvcnQpIGF3YWl0IFJlYWRKc29uSW50ZWdlckFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBSZWFkSnNvbk9iamVjdFN0YXJ0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIGZpZWxkLlR5cGUgPSBUSlNPTlByb3RvY29sSGVscGVyLkdldFR5cGVJZEZvclR5cGVOYW1lKGF3YWl0IFJlYWRKc29uU3RyaW5nQXN5bmMoZmFsc2UsIGNhbmNlbGxhdGlvblRva2VuKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmllbGQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBSZWFkRmllbGRFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgUmVhZEpzb25PYmplY3RFbmRBc3lu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isgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxzaG9ydD4gUmVhZEkxNkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gKHNob3J0KSBhd2FpdCBSZWFkSnNvbkludGVnZXJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxpbnQ+IFJlYWRJMzJBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIChpbnQpIGF3YWl0IFJlYWRKc29uSW50ZWdlckFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGxvbmc+IFJlYWRJNjRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFJlYWRKc29uSW50ZWdlckFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGRvdWJsZT4gUmVhZERvdWJsZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gYXdhaXQgUmVhZEpzb25Eb3VibGVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxzdHJpbmc+IFJlYWRTdHJpbmdBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGJ1ZiA9IGF3YWl0IFJlYWRKc29uU3RyaW5nQXN5bmMoZmFsc2UsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHJldHVybiBVdGY4RW5jb2RpbmcuR2V0U3RyaW5nKGJ1ZiwgMCwgYnVmLkxlbmd0aCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxieXRlW10+IFJlYWRCaW5hcnlBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFJlYWRKc29uQmFzZTY0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIEZhY3RvcnkgZm9yIEpTT04gcHJvdG9jb2wgb2JqZWN0cworICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgY2xhc3MgRmFjdG9yeSA6IElUUHJvdG9jb2xGYWN0b3J5CisgICAgICAgIHsKKyAgICAgICAgICAgIHB1YmxpYyBUUHJvdG9jb2wgR2V0UHJvdG9jb2woVENsaWVudFRyYW5zcG9ydCB0cmFucykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRKc29uUHJvdG9jb2wodHJhbnMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIEJhc2UgY2xhc3MgZm9yIHRyYWNraW5nIEpTT04gY29udGV4dHMgdGhhdCBtYXkgcmVxdWlyZQorICAgICAgICAvLy8gICAgIGluc2VydGluZy9SZWFkaW5nIGFkZGl0aW9uYWwgSlNPTiBzeW50YXggY2hhcmFjdGVycworICAgICAgICAvLy8gICAgIFRoaXMgYmFzZSBjb250ZXh0IGRvZXMgbm90aGluZy4KKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHJvdGVjdGVkIGNsYXNzIEpTT05CYXNlQ29udGV4dAorICAgICAgICB7CisgICAgICAgICAgICBwcm90ZWN0ZWQgVEpzb25Qcm90b2NvbCBQcm90bzsKKworICAgICAgICAgICAgcHVibGljIEpTT05CYXNlQ29udGV4dChUSnNvblByb3RvY29sIHByb3RvKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIFByb3RvID0gcHJvdG87CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyB2aXJ0dWFsIGFzeW5jIFRhc2sgV3JpdGVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIFJlYWRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgdmlydHVhbCBib29sIEVzY2FwZU51bWJlcnMoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vICAgICBDb250ZXh0IGZvciBKU09OIGxpc3RzLiBXaWxsIGluc2VydC9SZWFkIGNvbW1hcyBiZWZvcmUgZWFjaCBpdGVtIGV4Y2VwdAorICAgICAgICAvLy8gICAgIGZvciB0aGUgZmlyc3Qgb25lCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByb3RlY3RlZCBjbGFzcyBKU09OTGlzdENvbnRleHQgOiBKU09OQmFzZUNvbnRleHQKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSBib29sIF9maXJzdCA9IHRydWU7CisKKyAgICAgICAgICAgIHB1YmxpYyBKU09OTGlzdENvbnRleHQoVEpzb25Qcm90b2NvbCBwcm90b2NvbCkKKyAgICAgICAgICAgICAgICA6IGJhc2UocHJvdG9jb2wpCisgICAgICAgICAgICB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKF9maXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9maXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBhd2FpdCBQcm90by5UcmFucy5Xcml0ZUFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuQ29tbWEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoX2ZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX2ZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGF3YWl0IFByb3RvLlJlYWRKc29uU3ludGF4Q2hhckFzeW5jKFRKU09OUHJvdG9jb2xDb25zdGFudHMuQ29tbWEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgQ29udGV4dCBmb3IgSlNPTiByZWNvcmRzLiBXaWxsIGluc2VydC9SZWFkIGNvbG9ucyBiZWZvcmUgdGhlIHZhbHVlIHBvcnRpb24KKyAgICAgICAgLy8vICAgICBvZiBlYWNoIHJlY29yZCBwYWlyLCBhbmQgY29tbWFzIGJlZm9yZSBlYWNoIGtleSBleGNlcHQgdGhlIGZpcnN0LiBJbgorICAgICAgICAvLy8gICAgIGFkZGl0aW9uLCB3aWxsIGluZGljYXRlIHRoYXQgbnVtYmVycyBpbiB0aGUga2V5IHBvc2l0aW9uIG5lZWQgdG8gYmUKKyAgICAgICAgLy8vICAgICBlc2NhcGVkIGluIHF1b3RlcyAoc2luY2UgSlNPTiBrZXlzIG11c3QgYmUgc3RyaW5ncykuCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIC8vIFJlU2hhcnBlciBkaXNhYmxlIG9uY2UgSW5jb25zaXN0ZW50TmFtaW5nCisgICAgICAgIHByb3RlY3RlZCBjbGFzcyBKU09OUGFpckNvbnRleHQgOiBKU09OQmFzZUNvbnRleHQKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSBib29sIF9jb2xvbiA9IHRydWU7CisKKyAgICAgICAgICAgIHByaXZhdGUgYm9vbCBfZmlyc3QgPSB0cnVlOworCisgICAgICAgICAgICBwdWJsaWMgSlNPTlBhaXJDb250ZXh0KFRKc29uUHJvdG9jb2wgcHJvdG8pCisgICAgICAgICAgICAgICAgOiBiYXNlKHByb3RvKQorICAgICAgICAgICAgeworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgX2NvbG9uID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgUHJvdG8uVHJhbnMuV3JpdGVBc3luYyhfY29sb24gPyBUSlNPTlByb3RvY29sQ29uc3RhbnRzLkNvbG9uIDogVEpTT05Qcm90b2NvbENvbnN0YW50cy5Db21tYSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICBfY29sb24gPSAhX2NvbG9uOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgUmVhZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgX2NvbG9uID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgUHJvdG8uUmVhZEpzb25TeW50YXhDaGFyQXN5bmMoX2NvbG9uID8gVEpTT05Qcm90b2NvbENvbnN0YW50cy5Db2xvbiA6IFRKU09OUHJvdG9jb2xDb25zdGFudHMuQ29tbWEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgX2NvbG9uID0gIV9jb2xvbjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIEVzY2FwZU51bWJlcnMoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBfY29sb247CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgIC8vLyAgICAgSG9sZHMgdXAgdG8gb25lIGJ5dGUgZnJvbSB0aGUgdHJhbnNwb3J0CisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHByb3RlY3RlZCBjbGFzcyBMb29rYWhlYWRSZWFkZXIKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBieXRlW10gX2RhdGEgPSBuZXcgYnl0ZVsxXTsKKworICAgICAgICAgICAgcHJpdmF0ZSBib29sIF9oYXNEYXRhOworICAgICAgICAgICAgcHJvdGVjdGVkIFRKc29uUHJvdG9jb2wgUHJvdG87CisKKyAgICAgICAgICAgIHB1YmxpYyBMb29rYWhlYWRSZWFkZXIoVEpzb25Qcm90b2NvbCBwcm90bykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBQcm90byA9IHByb3RvOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgICAgICAvLy8gICAgIFJldHVybiBhbmQgY29uc3VtZSB0aGUgbmV4dCBieXRlIHRvIGJlIFJlYWQsIGVpdGhlciB0YWtpbmcgaXQgZnJvbSB0aGUKKyAgICAgICAgICAgIC8vLyAgICAgZGF0YSBidWZmZXIgaWYgcHJlc2VudCBvciBnZXR0aW5nIGl0IGZyb20gdGhlIHRyYW5zcG9ydCBvdGhlcndpc2UuCisgICAgICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8Ynl0ZT4gUmVhZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxieXRlPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKF9oYXNEYXRhKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX2hhc0RhdGEgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gZmluZCBtb3JlIGVhc3kgd2F5IHRvIGF2b2lkIGV4Y2VwdGlvbiBvbiByZWFkaW5nIHByaW1pdGl2ZSB0eXBlcworICAgICAgICAgICAgICAgICAgICBhd2FpdCBQcm90by5UcmFucy5SZWFkQWxsQXN5bmMoX2RhdGEsIDAsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIF9kYXRhWzBdOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLy8gPHN1bW1hcnk+CisgICAgICAgICAgICAvLy8gICAgIFJldHVybiB0aGUgbmV4dCBieXRlIHRvIGJlIFJlYWQgd2l0aG91dCBjb25zdW1pbmcsIGZpbGxpbmcgdGhlIGRhdGEKKyAgICAgICAgICAgIC8vLyAgICAgYnVmZmVyIGlmIGl0IGhhcyBub3QgYmVlbiBmaWxsZWQgYWxSZWFkeS4KKyAgICAgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgICAgICBwdWJsaWMgYXN5bmMgVGFzazxieXRlPiBQZWVrQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGJ5dGU+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoIV9oYXNEYXRhKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gZmluZCBtb3JlIGVhc3kgd2F5IHRvIGF2b2lkIGV4Y2VwdGlvbiBvbiByZWFkaW5nIHByaW1pdGl2ZSB0eXBlcworICAgICAgICAgICAgICAgICAgICBhd2FpdCBQcm90by5UcmFucy5SZWFkQWxsQXN5bmMoX2RhdGEsIDAsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgX2hhc0RhdGEgPSB0cnVlOworICAgICAgICAgICAgICAgIHJldHVybiBfZGF0YVswXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgf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FRyYW5zcG9ydCA9PiBUcmFuczsKKworICAgICAgICBwcm90ZWN0ZWQgaW50IFJlY3Vyc2lvbkxpbWl0IHsgZ2V0OyBzZXQ7IH0KKworICAgICAgICBwdWJsaWMgdm9pZCBEaXNwb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgRGlzcG9zZSh0cnVlKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIEluY3JlbWVudFJlY3Vyc2lvbkRlcHRoKCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKFJlY3Vyc2lvbkRlcHRoIDwgUmVjdXJzaW9uTGltaXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgKytSZWN1cnNpb25EZXB0aDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5ERVBUSF9MSU1JVCwgIkRlcHRoIGxpbWl0IGV4Y2VlZGVkIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBEZWNyZW1lbnRSZWN1cnNpb25EZXB0aCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIC0tUmVjdXJzaW9uRGVwdGg7CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgdmlydHVhbCB2b2lkIERpc3Bvc2UoYm9vbCBkaXNwb3NpbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICghX2lzRGlzcG9zZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGRpc3Bvc2luZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIChUcmFucyBhcyBJRGlzcG9zYWJsZSk/LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfaXNEa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hdGlvblRva2VuKTsKKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIFdyaXRlU3RydWN0RW5kQXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZVN0cnVjdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuLk5vbmUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFic3RyYWN0IFRhc2sgV3JpdGVTdHJ1Y3RFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzayBXcml0ZUZpZWxkQmVnaW5Bc3luYyhURmllbGQgZmllbGQpCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IFdyaXRlRmllbGRCZWdpbkFzeW5jKGZpZWxkLCBDYW5jZWxsYXRpb25Ub2tlbi5Ob25lKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBUYXNrIFdyaXRlRmllbGRCZWdpbkFzeW5jKFRGaWVsZCBmaWVsZCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgIHB1YmxpYyB2aXJ0dWFsIGFzeW5jIFRhc2sgV3JpdGVGaWVsZEVuZEFzeW5jKCkKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgV3JpdGVGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuLk5vbmUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFic3RyYWN0IFRhc2sgV3JpdGVGaWVsZEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIFdyaXRlRmllbGRTdG9wQXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBXcml0ZU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UmVhZExpc3RCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIFJlYWRMaXN0RW5kQXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBSZWFkTGlzdEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuLk5vbmUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFic3RyYWN0IFRhc2sgUmVhZExpc3RFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzazxUU2V0PiBSZWFkU2V0QmVnaW5Bc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBhd2FpdCBSZWFkU2V0QmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbi5Ob25lKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBUYXNrPFRTZXQ+IFJlYWRTZXRCZWdpbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIFJlYWRTZXRFbmRBc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IFJlYWRTZXRFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbi5Ob25lKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBUYXNrIFJlYWRTZXRFbmRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzazxib29sPiBSZWFkQm9vbEFzeW5jKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3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GF0aW9uVG9rZW4pOworCisgICAgICAgIHB1YmxpYyB2aXJ0dWFsIGFzeW5jIFRhc2s8bG9uZz4gUmVhZEk2NEFzeW5jKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFJlYWRJNjRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbi5Ob25lKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBUYXNrPGxvbmc+IFJlYWRJNjRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzazxkb3VibGU+IFJlYWREb3VibGVBc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBhd2FpdCBSZWFkRG91YmxlQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYWJzdHJhY3QgVGFzazxkb3VibGU+IFJlYWREb3VibGVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzazxzdHJpbmc+IFJlYWRTdHJpbmdBc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBhd2FpdCBSZWFkU3RyaW5nQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrPHN0cmluZz4gUmVhZFN0cmluZ0FzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgYnVmID0gYXdhaXQgUmVhZEJpbmFyeUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHJldHVybiBFbmNvZGlu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ZExpc3RCZWdpbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFJlYWRMaXN0RW5kQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGF3YWl0IF93cmFwcGVkUHJvdG9jb2wuUmVhZExpc3RFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxUU2V0PiBSZWFkU2V0QmVnaW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IF93cmFwcGVkUHJvdG9jb2wuUmVhZFNldEJlZ2luQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgUmVhZFNldEVuZEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBfd3JhcHBlZFByb3RvY29sLlJlYWRTZXRFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxib29sPiBSZWFkQm9vbEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gYXdhaXQgX3dyYXBwZWRQcm90b2NvbC5SZWFkQm9vbEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3lu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JsZSBJbmNvbnNpc3RlbnROYW1pbmcKK25hbWVzcGFjZSBUaHJpZnQuUHJvdG9jb2xzCit7CisgICAgcHVibGljIGNsYXNzIFRQcm90b2NvbEV4Y2VwdGlvbiA6IFRFeGNlcHRpb24KKyAgICB7CisgICAgICAgIC8vIGRvIG5vdCByZW5hbWUgcHVibGljIGNvbnN0YW50cyAtIHRoZXkgdXNlZCBpbiBnZW5lcmF0ZWQgZmlsZXMKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBVTktOT1dOID0gMDsKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBJTlZBTElEX0RBVEEgPSAxOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IE5FR0FUSVZFX1NJWkUgPSAyOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IFNJWkVfTElNSVQgPSAzOworICAgICAgICBwdWJsaWMgY29uc3QgaW50IEJBRF9WRVJTSU9OID0gNDsKKyAgICAgICAgcHVibGljIGNvbnN0IGludCBOT1RfSU1QTEVNRU5URUQgPSA1OworICAgICAgICBwdWJsaWMgY29uc3QgaW50IERFUFRIX0xJTUlUID0gNjsKKworICAgICAgICBwcm90ZWN0ZWQgaW50IFR5cGUgPSBVTktOT1dOOworCisgICAgICAgIHB1YmxpYyBUUHJvdG9jb2xFeGNlcHRpb24oKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVFByb3RvY29sRXhjZXB0aW9uKGludCB0eXBlKQorICAgICAgICB7CisgICAgICAgICAgICBUeXBlID0gdHlwZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUUHJvdG9jb2xFeGNlcHRpb24oaW50IHR5cGUsIHN0cmluZyBtZXNzYWdlKQorICAgICAgICAgICAgOiBiYXNlKG1lc3NhZ2UpCisgICAgICAgIHsKKyAgICAgICAgICAgIFR5cGUgPSB0eXBlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRQcm90b2NvbEV4Y2VwdGlvbihzdHJpbmcgbWV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gICAgICBkc3RbZHN0T2ZmICsgMV0gPSAoYnl0ZSkgRW5jb2RlVGFibGVbKChzcmNbc3JjT2ZmXSA8PCA0KSAmIDB4MzApIHwgKChzcmNbc3JjT2ZmICsgMV0gPj4gNCkgJiAweDBGKV07CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDJdID0gKGJ5dGUpIEVuY29kZVRhYmxlWygoc3JjW3NyY09mZiArIDFdIDw8IDIpICYgMHgzQykgfCAoKHNyY1tzcmNPZmYgKyAyXSA+PiA2KSAmIDB4MDMpXTsKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgM10gPSAoYnl0ZSkgRW5jb2RlVGFibGVbc3JjW3NyY09mZiArIDJdICYgMHgzRl07CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChsZW4gPT0gMikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgMV0gPSAoYnl0ZSkgRW5jb2RlVGFibGVbKChzcmNbc3JjT2ZmXSA8PCA0KSAmIDB4MzApIHwgKChzcmNbc3JjT2ZmICsgMV0gPj4gNCkgJiAweDBGKV07CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDJdID0gKGJ5dGUpIEVuY29kZVRhYmxlWyhzcmNbc3JjT2ZmICsgMV0gPDwgMikgJiAweDNDXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBsZW4gPT0gMQorICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAxXSA9IChieXRlKSBFbmNvZGVUYWJsZVsoc3JjW3NyY09mZl0gPDwgNCkgJiAweDMwXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGludGVybmFsIHN0YXRpYyB2b2lkIERlY29kZShieXRlW10gc3JjLCBpbnQgc3JjT2ZmLCBpbnQgbGVuLCBieXRlW10gZHN0LCBpbnQgZHN0T2ZmKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoc3JjID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2Yoc3JjKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRzdFtkc3RPZmZdID0gKGJ5dGUpICgoRGVjb2RlVGFibGVbc3JjW3NyY09mZl0gJiAweDBGRl0gPDwgMikgfCAoRGVjb2RlVGFibGVbc3JjW3NyY09mZiArIDFdICYgMHgwRkZdID4+IDQpKTsKKworICAgICAgICAgICAgaWYgKGxlbiA+IDIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDFdID0KKyAgICAgICAgICAgICAgICAgICAgKGJ5dGUpCisgICAgICAgICAgICAgICAgICAgICgoKERlY29kZVRhYmxlW3NyY1tzcmNPZmYgKyAxXSAmIDB4MEZGXSA8PCA0KSAmIDB4RjApIHwgKERlY29kZVRhYmxlW3NyY1tzcmNPZmYgKyAyXSAmIDB4MEZGXSA+PiAyKSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbiA+IDMpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgMl0gPQorICAgICAgICAgICAgICAgICAgICAgICAgKGJ5dGUpCisgICAgICAgICAgICAgICAgICAgICAgICAoKChEZWNvZGVUYWJsZVtzcmNbc3JjT2ZmICsgMl0gJiAweDBGRl0gPDwgNikgJiAweEMwKSB8IERlY29kZVRhYmxlW3NyY1tzcmNPZmYgKyAzXSAmIDB4MEZGXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2xpYi9uZXRjb3JlL1RocmlmdC9Qcm90b2NvbHMvVXRpbGl0aWVzL1RC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AgICAgICAgICAgIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLAorICAgICAgICAgICAgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsCisgICAgICAgICAgICAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMSwgLTEsIC0xLCAtMQorICAgICAgICB9OworCisgICAgICAgIGludGVybmFsIHN0YXRpYyB2b2lkIEVuY29kZShieXRlW10gc3JjLCBpbnQgc3JjT2ZmLCBpbnQgbGVuLCBieXRlW10gZHN0LCBpbnQgZHN0T2ZmKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoc3JjID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2Yoc3JjKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRzdFtkc3RPZmZdID0gKGJ5dGUpIEVuY29kZVRhYmxlWyhzcmNbc3JjT2ZmXSA+PiAyKSAmIDB4M0ZdOworCisgICAgICAgICAgICBpZiAobGVuID09IDMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDFdID0gKGJ5dGUpIEVuY29kZVRhYmxlWygoc3JjW3NyY09mZl0gPDwgNCkgJiAweDMwKSB8ICgoc3JjW3NyY09mZiArIDFdID4+IDQpICYgMHgwRildOworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAyXSA9IChieXRlKSBFbmNvZGVUYWJsZVsoKHNyY1tzcmNPZmYgKyAxXSA8PCAyKSAmIDB4M0MpIHwgKChzcmNbc3JjT2ZmICsgMl0gPj4gNikgJiAweDAzKV07CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDNdID0gKGJ5dGUpIEVuY29kZVRhYmxlW3NyY1tzcmNPZmYgKyAyXSAmIDB4M0ZdOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAobGVuID09IDIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDFdID0gKGJ5dGUpIEVuY29kZVRhYmxlWygoc3JjW3NyY09mZl0gPDwgNCkgJiAweDMwKSB8ICgoc3JjW3NyY09mZiArIDFdID4+IDQpICYgMHgwRildOworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAyXSA9IChieXRlKSBFbmNvZGVUYWJsZVsoc3JjW3NyY09mZiArIDFdIDw8IDIpICYgMHgzQ107CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gbGVuID09IDEKKyAgICAgICAgICAgICAgICBkc3RbZHN0T2ZmICsgMV0gPSAoYnl0ZSkgRW5jb2RlVGFibGVbKHNyY1tzcmNPZmZdIDw8IDQpICYgMHgzMF07CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpbnRlcm5hbCBzdGF0aWMgdm9pZCBEZWNvZGUoYnl0ZVtdIHNyYywgaW50IHNyY09mZiwgaW50IGxlbiwgYnl0ZVtdIGRzdCwgaW50IGRzdE9mZikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKHNyYyA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24obmFtZW9mKHNyYykpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBkc3RbZHN0T2ZmXSA9IChieXRlKSAoKERlY29kZVRhYmxlW3NyY1tzcmNPZmZdICYgMHgwRkZdIDw8IDIpIHwgKERlY29kZVRhYmxlW3NyY1tzcmNPZmYgKyAxXSAmIDB4MEZGXSA+PiA0KSk7CisKKyAgICAgICAgICAgIGlmIChsZW4gPiAyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGRzdFtkc3RPZmYgKyAxXSA9CisgICAgICAgICAgICAgICAgICAgIChieXRlKQorICAgICAgICAgICAgICAgICAgICAoKChEZWNvZGVUYWJsZVtzcmNbc3JjT2ZmICsgMV0gJiAweDBGRl0gPDwgNCkgJiAweEYwKSB8IChEZWNvZGVUYWJsZVtzcmNbc3JjT2ZmICsgMl0gJiAweDBGRl0gPj4gMikpOworICAgICAgICAgICAgICAgIGlmIChsZW4gPiAzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZHN0W2RzdE9mZiArIDJdID0KKyAgICAgICAgICAgICAgICAgICAgICAgIChieXRlKQorICAgICAgICAgICAgICAgICAgICAgICAgKCgoRGVjb2RlVGFibGVbc3JjW3NyY09mZiArIDJdICYgMHgwRkZdIDw8IDYpICYgMHhDMCkgfCBEZWNvZGVUYWJsZVtzcmNbc3JjT2ZmICsgM10gJiAweDBGRl0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9saWIvbmV0Y29yZS9UaHJpZnQvUHJvdG9jb2xzL1V0aWxpdGllcy9USnNvblByb3RvY29sQ29uc3RhbnRzLmNzIGIvbGliL25ldGNvcmUvVGhyaWZ0L1Byb3RvY29scy9VdGlsaXRpZXMvVEpzb25Qcm90b2NvbENvbnN0YW50cy5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi45M2VmZjc4Ci0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVGhyaWZ0L1Byb3RvY29scy9VdGlsaXRpZXMvVEpzb25Qcm90b2NvbENvbnN0YW50cy5jcwpAQCAtMCwwICsxLDYxIEBACivvu78vLyBMaWNlbnNlZCB0byB0aGUgQXBhY2hlIFNvZnR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GJ5dGUpJ3QnLCAoYnl0ZSknZicgfTsKKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgcmVhZG9ubHkgYnl0ZVtdIE5hbWVCeXRlID0geyAoYnl0ZSknaScsIChieXRlKSc4JyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZUkxNiA9IHsgKGJ5dGUpJ2knLCAoYnl0ZSknMScsIChieXRlKSc2JyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZUkzMiA9IHsgKGJ5dGUpJ2knLCAoYnl0ZSknMycsIChieXRlKScyJyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZUk2NCA9IHsgKGJ5dGUpJ2knLCAoYnl0ZSknNicsIChieXRlKSc0JyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZURvdWJsZSA9IHsgKGJ5dGUpJ2QnLCAoYnl0ZSknYicsIChieXRlKSdsJyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZVN0cnVjdCA9IHsgKGJ5dGUpJ3InLCAoYnl0ZSknZScsIChieXRlKSdjJyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZVN0cmluZyA9IHsgKGJ5dGUpJ3MnLCAoYnl0ZSkndCcsIChieXRlKSdyJyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZU1hcCA9IHsgKGJ5dGUpJ20nLCAoYnl0ZSknYScsIChieXRlKSdwJyB9OworICAgICAgICAgICAgcHVibGljIHN0YXRpYyByZWFkb25seSBieXRlW10gTmFtZUxpc3QgPSB7IChieXRlKSdsJywgKGJ5dGUpJ3MnLCAoYnl0ZSkndCcgfTsKKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgcmVhZ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UVHlwZS5CeXRlOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZUJ5dGU7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5JMTY6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlR5cGVOYW1lcy5OYW1lSTE2OworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuSTMyOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZUkzMjsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkk2NDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRKU09OUHJvdG9jb2xDb25zdGFudHMuVHlwZU5hbWVzLk5hbWVJNjQ7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5Eb3VibGU6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlR5cGVOYW1lcy5OYW1lRG91YmxlOworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuU3RyaW5nOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVN0cmluZzsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLlN0cnVjdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRKU09OUHJvdG9jb2xDb25zdGFudHMuVHlwZU5hbWVzLk5hbWVTdHJ1Y3Q7CisgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5NYXA6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlR5cGVOYW1lcy5OYW1lTWFwOworICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuU2V0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVEpTT05Qcm90b2NvbENvbnN0YW50cy5UeXBlTmFtZXMuTmFtZVNldDsKKyAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkxpc3Q6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBUSlNPTlByb3RvY29sQ29uc3RhbnRzLlR5cGVOYW1lcy5OYW1lTGlzdDsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsICJVbnJlY29nbml6ZWQgZXhUeXBlIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIFRUeXBlIEdldFR5cGVJZEZvclR5cGVOYW1lKGJ5dGVbXSBuYW1lKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgcmVzdWx0ID0gVFR5cGUuU3RvcDsKKyAgICAgICAgICAgIGlmIChuYW1lLkxlbmd0aCA+IDEpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChuYW1lWzBdKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkgJ2QnOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuRG91YmxlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpICdpJzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobmFtZVsxXSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSAnOCc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkJ5dGU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpICcxJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuSTE2OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSAnMyc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkkzMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkgJzYnOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBUVHlwZS5JNjQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpICdsJzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLkxpc3Q7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkgJ20nOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuTWFwOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgKGJ5dGUpICdyJzoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLlN0cnVjdDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIChieXRlKSAncyc6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobmFtZVsxXSA9PSAoYnl0ZSkgJ3QnKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFRUeXBlLlN0cmluZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKG5hbWVbMV0gPT0gKGJ5dGUpICdlJykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBUVHlwZS5TZXQ7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAoYnl0ZSkgJ3QnOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gVFR5cGUuQm9vbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChyZXN1bHQgPT0gVFR5cGUuU3RvcCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5OT1RfSU1QTEVNRU5URUQsICJVbnJlY29nbml6ZWQgZXhUeXBlIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIFJldHVybiB0cnVlIGlmIHRoZSBnaXZlbiBieXRlIGNvdWxkIGJlIGEgdmFsaWQgcGFydCBvZiBhIEpTT04gbnVtYmVyLgorICAgICAgICAvLy8gPC9zdW1tYXJ5PgorICAgICAgICBwdWJsaWMgc3RhdGljIGJvb2wgSXNKc29uTnVtZXJpYyhieXRlIGIpCisgICAgICAgIHsKKyAgICAgICAgICAgIHN3aXRjaCAoYikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKScrJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSctJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKScuJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKScwJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKScxJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKScyJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSczJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc0JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc1JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc2JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc3JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc4JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSc5JzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSdFJzoKKyAgICAgICAgICAgICAgICBjYXNlIChieXRlKSdlJzoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8vIDxzdW1tYXJ5PgorICAgICAgICAvLy8gICAgIENvbnZlcnQgYSBieXRlIGNvbnRhaW5pbmcgYSBoZXggY2hhciAoJzAnLSc5JyBvciAnYSctJ2YnKSBpbnRvIGl0cworICAgICAgICAvLy8gICAgIGNvcnJlc3BvbmRpbmcgaGV4IHZhbHVlCisgICAgICAgIC8vLyA8L3N1bW1hcnk+CisgICAgICAgIHB1YmxpYyBzdGF0aWMgYnl0ZSBUb0hleFZhbChieXRlIGNoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2ggPj0gJzAnICYmIGNoIDw9ICc5JykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gKGJ5dGUpKChjaGFyKWNoIC0gJzAnKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNoID49ICdhJyAmJiBjaCA8PSAnZicpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2ggKz0gMTA7CisgICAgICAgICAgICAgICAgcmV0dXJuIChieXRlKSgoY2hhciljaCAtICdhJyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwgIkV4cGVjdGVkIGhleCBjaGFyYWN0ZXIiKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vLyA8c3VtbWFyeT4KKyAgICAgICAgLy8vICAgICBDb252ZXJ0IGEgYnl0ZSBjb250YWluaW5nIGEgaGV4IHZhbHVlIHRvIGl0cyBjb3JyZXNwb25kaW5nIGhleCBjaGFyYWN0ZXIKKyAgICAgICAgLy8vIDwvc3VtbWFyeT4KKyAgICAgICAgcHVibGljIHN0YXRpYyBieXRlIFRvSGV4Q2hhcihieXRlIHZhbCkKKyAgICAgICAgeworICAgICAgICAgICAgdmFsICY9IDB4MEY7CisgICAgICAgICAgICBpZiAodmFsIDwgMTApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIChieXRlKSgoY2hhcil2YWwgKyAnMCcpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmFsIC09IDEwOworICAgICAgICAgICAgcmV0dXJuIChieXRlKSgoY2hhcil2YWwgKyAnYScpOworICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2xpYi9uZXRjb3JlL1RocmlmdC9Qcm90b2NvbHMvVXRpbGl0aWVzL1RQcm90b2NvbFV0aWwuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvUHJvdG9jb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YXNlIFRUeXBlLkJvb2w6CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkQm9vbEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkJ5dGU6CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkQnl0ZUFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkkxNjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRJMTZBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5JMzI6CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkSTMyQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuSTY0OgorICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvdG9jb2wuUmVhZEk2NEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlLkRvdWJsZToKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWREb3VibGVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TdHJpbmc6CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCB0cnkgdG8gZGVjb2RlIHRoZSBzdHJpbmcsIGp1c3Qgc2tpcCBpdC4KKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRCaW5hcnlBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5TdHJ1Y3Q6CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkU3RydWN0QmVnaW5Bc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmllbGQgPSBhd2FpdCBwcm90b2NvbC5SZWFkRmllbGRCZWdpbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQuVHlwZSA9PSBUVHlwZS5TdG9wKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFNraXBBc3luYyhwcm90b2NvbCwgZmllbGQuVHlwZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRGaWVsZEVuZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRTdHJ1Y3RFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5NYXA6CisgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbWFwID0gYXdhaXQgcHJvdG9jb2wuUmVhZE1hcEJlZ2luQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBtYXAuQ291bnQ7IGkrKykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBTa2lwQXN5bmMocHJvdG9jb2wsIG1hcC5LZXlUeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgU2tpcEFzeW5jKHByb3RvY29sLCBtYXAuVmFsdWVUeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkTWFwRW5kQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGUuU2V0OgorICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHNldCA9IGF3YWl0IHByb3RvY29sLlJlYWRTZXRCZWdpbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc2V0LkNvdW50OyBpKyspCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgU2tpcEFzeW5jKHByb3RvY29sLCBzZXQuRWxlbWVudFR5cGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb3RvY29sLlJlYWRTZXRFbmRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZS5MaXN0OgorICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxpc3QgPSBhd2FpdCBwcm90b2NvbC5SZWFkTGlzdEJlZ2luQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsaXN0LkNvdW50OyBpKyspCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgU2tpcEFzeW5jKHByb3RvY29sLCBsaXN0LkVsZW1lbnRUeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm90b2NvbC5SZWFkTGlzdEVuZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLCAiVW5rbm93biBkYXRhIHR5cGUgIiArIHR5cGUuVG9TdHJpbmcoImQiKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHByb3RvY29sLkRlY3JlbWVudFJlY3Vyc2lvbkRlcHRoKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9saWIvbmV0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W5zcG9ydCwgaW5wdXRUcmFuc3BvcnRGYWN0b3J5LCBvdXRwdXRUcmFuc3BvcnRGYWN0b3J5LAorICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2xGYWN0b3J5LCBvdXRwdXRQcm90b2NvbEZhY3RvcnksIGxvZ2dlcikKKyAgICAgICAgeworICAgICAgICAgICAgX2NsaWVudFdhaXRpbmdEZWxheSA9IGNsaWVudFdhaXRpbmdEZWxheTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFNlcnZlQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIGNhbmNlbGF0aW9uIHRva2VuCisgICAgICAgICAgICAgICAgX3NlcnZlclRhc2sgPSBUYXNrLkZhY3RvcnkuU3RhcnROZXcoKCkgPT4gU3RhcnRMaXN0ZW5pbmcoY2FuY2VsbGF0aW9uVG9rZW4pLCBUYXNrQ3JlYXRpb25PcHRpb25zLkxvbmdSdW5uaW5nKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBfc2VydmVyVGFzazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0Vycm9yKGV4LlRvU3RyaW5nKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBhc3luYyBUYXNrIFN0YXJ0TGlzdGVuaW5nKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBTZXJ2ZXJUcmFuc3BvcnQuTGlzdGVuKCk7CisKKyAgICAgICAgICAgIExvZ2dlci5Mb2dUcmFjZSgiU3RhcnRlZCBsaXN0ZW5pbmcgYXQgc2VydmVyIik7CisKKyAgICAgICAgICAgIGlmIChTZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBTZXJ2ZXJFdmVudEhhbmRsZXIuUHJlU2VydmVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHdoaWxlICghY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKFNlcnZlclRyYW5zcG9ydC5Jc0NsaWVudFBlbmRpbmcoKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dUcmFjZSgiV2FpdGluZyBmb3IgY2xpZW50IGNvbm5lY3Rpb24iKTsKKworICAgICAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNsaWVudCA9IGF3YWl0IFNlcnZlclRyYW5zcG9ydC5BY2NlcHRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZhY3RvcnkuU3RhcnROZXcoKCkgPT4gRXhlY3V0ZShjbGllbnQsIGNhbmNlbGxhdGlvblRva2VuKSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uIHR0eCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ1RyYWNlKCQiVHJhbnNwb3J0IGV4Y2VwdGlvbjoge3R0eH0iKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR0eC5UeXBlICE9IFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5JbnRlcnJ1cHRlZCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2dnZXIuTG9nRXJyb3IodHR4LlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkRlbGF5KFRpbWVTcGFuLkZyb21NaWxsaXNlY29uZHMoX2NsaWVudFdhaXRpbmdEZWxheSksIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjYXRjaChUYXNrQ2FuY2VsZWRFeGNlcHRpb24pIHsgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU2VydmVyVHJhbnNwb3J0LkNsb3NlKCk7CisKKyAgICAgICAgICAgIExvZ2dlci5Mb2dUcmFjZSgiQ29tcGxldGVkIGxpc3RlbmluZyBhdCBzZXJ2ZXIiKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIFN0b3AoKQorICAgICAgICB7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGFzeW5jIFRhc2sgRXhlY3V0ZShUQ2xpZW50VHJhbnNwb3J0IGNsaWVudCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIExvZ2dlci5Mb2dUcmFjZSgiU3RhcnRlZCBjbGllbnQgcmVxdWVzdCBwcm9jZXNzaW5nIik7CisKKyAgICAgICAgICAgIHZhciBwcm9jZXNzb3IgPSBJdFByb2Nlc3NvckZhY3RvcnkuR2V0QXN5bmNQcm9jZXNzb3IoY2xpZW50LCB0aGlzKTsKKworICAgICAgICAgICAgVENsaWVudFRyYW5zcG9ydCBpbnB1dFRyYW5zcG9ydCA9IG51bGw7CisgICAgICAgICAgICBUQ2xpZW50VHJhbnNwb3J0IG91dHB1dFRyYW5zcG9ydCA9IG51bGw7CisgICAgICAgICAgICBUUHJvdG9jb2wgaW5wdXRQcm90b2NvbCA9IG51bGw7CisgICAgICAgICAgICBUUHJvdG9jb2wgb3V0cHV0UHJvdG9jb2wgPSBudWxsOworICAgICAgICAgICAgb2JqZWN0IGNvbm5lY3Rpb25Db250ZXh0ID0gbnVsbDsKKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaW5wdXRUcmFuc3BvcnQgPSBJbnB1dFRyYW5zcG9ydEZhY3RvcnkuR2V0VHJhbnNwb3J0KGNsaWVudCk7CisgICAgICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0ID0gT3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5HZXRUcmFuc3BvcnQoY2xpZW50KTsKKworICAgICAgICAgICAgICAgIGlucHV0UHJvdG9jb2wgPSBJbnB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbChpbnB1dFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2wgPSBPdXRwdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2wob3V0cHV0VHJhbnNwb3J0KTsKKworICAgICAgICAgICAgICAgIGlmIChTZXJ2ZXJFdmVudEhhbmRsZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGNvbm5lY3Rpb25Db250ZXh0ID0gYXdhaXQgU2VydmVyRXZlbnRIYW5kbGVyLkNyZWF0ZUNvbnRleHRBc3luYyhpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHdoaWxlICghY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoIWF3YWl0IGlucHV0VHJhbnNwb3J0LlBlZWtBc3luYyhjYW5jZWxsYXRpb25Ub2tlbikpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKFNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBTZXJ2ZXJFdmVudEhhbmRsZXIuUHJvY2Vzc0NvbnRleHRBc3luYyhjb25uZWN0aW9uQ29udGV4dCwgaW5wdXRUcmFuc3BvcnQsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmICghYXdhaXQgcHJvY2Vzc29yLlByb2Nlc3NBc3luYyhpbnB1dFByb3RvY29sLCBvdXRwdXRQcm90b2NvbCwgY2FuY2VsbGF0aW9uVG9rZW4pKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uIHR0eCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBMb2dnZXIuTG9nVHJhY2UoJCJUcmFuc3BvcnQgZXhjZXB0aW9uOiB7dHR4fSIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiB4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dFcnJvcigkIkVycm9yOiB7eH0iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKFNlcnZlckV2ZW50SGFuZGxlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFNlcnZlckV2ZW50SGFuZGxlci5EZWxldGVDb250ZXh0QXN5bmMoY29ubmVjdGlvbkNvbnRleHQsIGlucHV0UHJvdG9jb2wsIG91dHB1dFByb3RvY29sLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlucHV0VHJhbnNwb3J0Py5DbG9zZSgpOworICAgICAgICAgICAgb3V0cHV0VHJhbnNwb3J0Py5DbG9zZSgpOworCisgICAgICAgICAgICBMb2dnZXIuTG9nVHJhY2UoIkNvbXBsZXRlZCBjbGllbnQgcmVxdWVzdCBwcm9jZXNzaW5nIik7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9saWIvbmV0Y29yZS9UaHJpZnQvU2VydmVyL1RCYXNlU2VydmVyLmNzIGIvbGliL25ldGNvcmUvVGhyaWZ0L1NlcnZlci9UQmFzZVNlcnZlci5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi43NDFkZDVjCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVGhyaWZ0L1NlcnZlci9UQmFzZVNlcnZlci5jcwpAQCAtMCwwICsxLDc5IEBACisvLyBMaWNlbnNlZCB0byB0aGUgQXBhY2hlIFNvZnR3YXJlIEZvdW5kYXRpb24oQVNGKSB1bmRlciBvbmUKKy8vIG9yIG1vcmUgY29udHJpYnV0b3IgbGljZW5zZSBhZ3JlZW1lbnRzLlNlZSB0aGUgTk9USUNFIGZpbGUKKy8vIGRpc3RyaW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gICAgICAgICAgICBMb2dnZXIgPSBsb2dnZXIgPz8gdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2YobG9nZ2VyKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBTZXRFdmVudEhhbmRsZXIoVFNlcnZlckV2ZW50SGFuZGxlciBzZWgpCisgICAgICAgIHsKKyAgICAgICAgICAgIFNlcnZlckV2ZW50SGFuZGxlciA9IHNlaDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUU2VydmVyRXZlbnRIYW5kbGVyIEdldEV2ZW50SGFuZGxlcigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBTZXJ2ZXJFdmVudEhhbmRsZXI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBTdG9wKCk7CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgdm9pZCBTdGFydCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIGRvIG5vdGhpbmcKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2aXJ0dWFsIGFzeW5jIFRhc2sgU2VydmVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9saWIvbmV0Y29yZS9UaHJpZnQvU2VydmVyL1RTZXJ2ZXJFdmVudEhhbmRsZXIuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvU2VydmV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UyBJUyIgQkFTSVMsIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWQorLy8gS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUKKy8vIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQgbGltaXRhdGlvbnMKKy8vIHVuZGVyIHRoZSBMaWNlbnNlLgorCit1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwordXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKK3VzaW5nIFRocmlmdC5Qcm90b2NvbHM7Cit1c2luZyBUaHJpZnQuUHJvdG9jb2xzLkVudGl0aWVzOwordXNpbmcgVGhyaWZ0LlByb3RvY29scy5VdGlsaXRpZXM7CisKK25hbWVzcGFjZSBUaHJpZnQKK3sKKyAgICAvLyBSZVNoYXJwZXIgZGlzYWJsZSBvbmNlIEluY29uc2lzdGVudE5hbWluZworICAgIHB1YmxpYyBjbGFzcyBUQXBwbGljYXRpb25FeGNlcHRpb24gOiBURXhjZXB0aW9uCisgICAgeworICAgICAgICBwdWJsaWMgZW51bSBFeGNlcHRpb25UeXBlCisgICAgICAgIHsKKyAgICAgICAgICAgIFVua25vd24sCisgICAgICAgICAgICBVbmtub3duTWV0aG9kLAorICAgICAgICAgICAgSW52YWxpZE1lc3NhZ2VUeXBlLAorICAgICAgICAgICAgV3JvbmdNZXRob2ROYW1lLAorICAgICAgICAgICAgQmFkU2VxdWVuY2VJZCwKKyAgICAgICAgICAgIE1pc3NpbmdSZXN1bHQsCisgICAgICAgICAgICBJbnRlcm5hbEVycm9yLAorICAgICAgICAgICAgUHJvdG9jb2xFcnJvciwKKyAgICAgICAgICAgIEludmFsaWRUcmFuc2Zvcm0sCisgICAgICAgICAgICBJbnZhbGlkUHJvdG9jb2wsCisgICAgICAgICAgICBVbnN1cHBvcnRlZENsaWVudFR5cGUKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IE1lc3NhZ2VUeXBlRmllbGRJZCA9IDE7CisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IEV4VHlwZUZpZWxkSWQgPSAyOworCisgICAgICAgIHByb3RlY3RlZCBFeGNlcHRpb25UeXBlIFR5cGU7CisKKyAgICAgICAgcHVibGljIFRBcHBsaWNhdGlvbkV4Y2VwdGlvbigpCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUQXBwbGljYXRpb25FeGNlcHRpb24oRXhjZXB0aW9uVHlwZSB0eXBlKQorICAgICAgICB7CisgICAgICAgICAgICBUeXBlID0gdHlwZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUQXBwbGljYXRpb25FeGNlcHRpb24oRXhjZXB0aW9uVHlwZSB0eXBlLCBzdHJpbmcgbWVzc2FnZSkKKyAgICAgICAgICAgIDogYmFzZShtZXNzYWdlKQorICAgICAgICB7CisgICAgICAgICAgICBUeXBlID0gdHlwZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgYXN5bmMgVGFzazxUQXBwbGljYXRpb25FeGNlcHRpb24+IFJlYWRBc3luYyhUUHJvdG9jb2wgaW5wdXRQcm90b2NvbCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIHN0cmluZyBtZXNzYWdlID0gbnVsbDsKKyAgICAgICAgICAgIHZhciB0eXBlID0gRXhjZXB0aW9uVHlwZS5Vbmtub3duOworCisgICAgICAgICAgICBhd2FpdCBpbnB1dFByb3RvY29sLlJlYWRTdHJ1Y3RCZWdpbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIHdoaWxlICh0cnVlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBmaWVsZCA9IGF3YWl0IGlucHV0UHJvdG9jb2wuUmVhZEZpZWxkQmVnaW5Bc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgaWYgKGZpZWxkLlR5cGUgPT0gVFR5cGUuU3RvcCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHN3aXRjaCAoZmllbGQuSUQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBjYXNlIE1lc3NhZ2VUeXBlRmllbGRJZDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWVsZC5UeXBlID09IFRUeXBlLlN0cmluZykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlID0gYXdhaXQgaW5wdXRQcm90b2NvbC5SZWFkU3RyaW5nQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IFRQcm90b2NvbFV0aWwuU2tpcEFzeW5jKGlucHV0UHJvdG9jb2wsIGZpZWxkLlR5cGUsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIEV4VHlwZUZpZWxkSWQ6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQuVHlwZSA9PSBUVHlwZS5JMzIpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IChFeGNlcHRpb25UeXBlKSBhd2FpdCBpbnB1dFByb3RvY29sLlJlYWRJMzJBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgVFByb3RvY29sVXRpbC5Ta2lwQXN5bmMoaW5wdXRQcm90b2NvbCwgZmllbGQuVHlwZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBUUHJvdG9jb2xVdGlsLlNraXBBc3luYyhpbnB1dFByb3RvY29sLCBmaWVsZC5UeXBlLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBhd2FpdCBpbnB1dFByb3RvY29sLlJlYWRGaWVsZEVuZEFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgaW5wdXRQcm90b2NvbC5SZWFkU3RydWN0RW5kQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICByZXR1cm4gbmV3IFRBcHBsaWNhdGlvbkV4Y2VwdGlvbih0eXBlLCBtZXNzYWdlKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBhc3luYyBUYXNrIFdyaXRlQXN5bmMoVFByb3RvY29sIG91dHB1dFByb3RvY29sLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAg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uYW1lb2YoaW5wdXRQcm90b2NvbCkpOworICAgICAgICAgICAgX291dHB1dFByb3RvY29sID0gb3V0cHV0UHJvdG9jb2wgPz8gdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2Yob3V0cHV0UHJvdG9jb2wpKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUUHJvdG9jb2wgSW5wdXRQcm90b2NvbCA9PiBfaW5wdXRQcm90b2NvbDsKKworICAgICAgICBwdWJsaWMgVFByb3RvY29sIE91dHB1dFByb3RvY29sID0+IF9vdXRwdXRQcm90b2NvbDsKKworICAgICAgICBwdWJsaWMgaW50IFNlcUlkCisgICAgICAgIHsKKyAgICAgICAgICAgIGdldCB7IHJldHVybiArK19zZXFJZDsgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzayBPcGVuVHJhbnNwb3J0QXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBPcGVuVHJhbnNwb3J0QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdmlydHVhbCBhc3luYyBUYXNrIE9wZW5UcmFuc3BvcnRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCFfaW5wdXRQcm90b2NvbC5UcmFuc3BvcnQuSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IF9pbnB1dFByb3RvY29sLlRyYW5zcG9ydC5PcGVuQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoIV9pbnB1dFByb3RvY29sLlRyYW5zcG9ydC5Jc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgX291dHB1dFByb3RvY29sLlRyYW5zcG9ydC5PcGVuQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgRGlzcG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIERpc3Bvc2UodHJ1ZSk7CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgdmlydHVhbCB2b2lkIERpc3Bvc2UoYm9vbCBkaXNwb3NpbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmICghX2lzRGlzcG9zZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGRpc3Bvc2luZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9pbnB1dFByb3RvY29sPy5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgICAgIF9vdXRwdXRQcm90b2NvbD8uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgX2lzRGlzcG9zZWQgPSB0cnVlOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RFeGNlcHRpb24uY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVEV4Y2VwdGlvbi5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi42YWE1ODhkCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVGhyaWZ0L1RFeGNlcHRpb24uY3MKQEAgLTAsMCArMSwzNCBAQAorLy8gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uKEFTRikgdW5kZXIgb25lCisvLyBvciBtb3JlIGNvbnRyaWJ1dG9yIGxpY2Vuc2UgYWdyZWVtZW50cy5TZWUgdGhlIE5PVElDRSBmaWxlCisvLyBkaXN0cmlidXRlZCB3aXRoIHRoaXMgd29yayB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3luY1Byb2Nlc3Nvcj4gX3NlcnZpY2VQcm9jZXNzb3JNYXAgPQorICAgICAgICAgICAgbmV3IERpY3Rpb25hcnk8c3RyaW5nLCBJVEFzeW5jUHJvY2Vzc29yPigpOworCisgICAgICAgIHB1YmxpYyBhc3luYyBUYXNrPGJvb2w+IFByb2Nlc3NBc3luYyhUUHJvdG9jb2wgaXByb3QsIFRQcm90b2NvbCBvcHJvdCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFByb2Nlc3NBc3luYyhpcHJvdCwgb3Byb3QsIENhbmNlbGxhdGlvblRva2VuLk5vbmUpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8Ym9vbD4gUHJvY2Vzc0FzeW5jKFRQcm90b2NvbCBpcHJvdCwgVFByb3RvY29sIG9wcm90LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxib29sPihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBtZXNzYWdlID0gYXdhaXQgaXByb3QuUmVhZE1lc3NhZ2VCZWdpbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICAgICAgICAgIGlmICgobWVzc2FnZS5UeXBlICE9IFRNZXNzYWdlVHlwZS5DYWxsKSAmJiAobWVzc2FnZS5UeXBlICE9IFRNZXNzYWdlVHlwZS5PbmV3YXkpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgRmFpbEFzeW5jKG9wcm90LCBtZXNzYWdlLCBUQXBwbGljYXRpb25FeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5JbnZhbGlkTWVzc2FnZVR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAiTWVzc2FnZSBleFR5cGUgQ0FMTCBvciBPTkVXQVkgZXhwZWN0ZWQiLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBFeHRyYWN0IHRoZSBzZXJ2aWNlIG5hbWUKKyAgICAgICAgICAgICAgICB2YXIgaW5kZXggPSBtZXNzYWdlLk5hbWUuSW5kZXhPZihUTXVsdGlwbGV4ZWRQcm90b2NvbC5TZXBhcmF0b3IsIFN0cmluZ0NvbXBhcmlzb24uT3JkaW5hbCk7CisgICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGF3YWl0IEZhaWxBc3luYyhvcHJvdCwgbWVzc2FnZSwgVEFwcGxpY2F0aW9uRXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuSW52YWxpZFByb3RvY29sLAorICAgICAgICAgICAgICAgICAgICAgICAgJCJTZXJ2aWNlIG5hbWUgbm90IGZvdW5kIGluIG1lc3NhZ2UgbmFtZToge21lc3NhZ2UuTmFtZX0uIERpZCB5b3UgZm9yZ2V0IHRvIHVzZSBhIFRNdWx0aXBsZXhQcm90b2NvbCBpbiB5b3VyIGNsaWVudD8iLAorICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIGEgbmV3IFRNZXNzYWdlLCBzb21ldGhpbmcgdGhhdCBjYW4gYmUgY29uc3VtZWQgYnkgYW55IFRQcm90b2NvbAorICAgICAgICAgICAgICAgIHZhciBzZXJ2aWNlTmFtZSA9IG1lc3NhZ2UuTmFtZS5TdWJzdHJpbmcoMCwgaW5kZXgpOworICAgICAgICAgICAgICAgIElUQXN5bmNQcm9jZXNzb3IgYWN0dWFsUHJvY2Vzc29yOworICAgICAgICAgICAgICAgIGlmICghX3NlcnZpY2VQcm9jZXNzb3JNYXAuVHJ5R2V0VmFsdWUoc2VydmljZU5hbWUsIG91dCBhY3R1YWxQcm9jZXNzb3IpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgRmFpbEFzeW5jKG9wcm90LCBtZXNzYWdlLCBUQXBwbGljYXRpb25FeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5JbnRlcm5hbEVycm9yLAorICAgICAgICAgICAgICAgICAgICAgICAgJCJTZXJ2aWNlIG5hbWUgbm90IGZvdW5kOiB7c2VydmljZU5hbWV9LiBEaWQgeW91IGZvcmdldCB0byBjYWxsIFJlZ2lzdGVyUHJvY2Vzc29yKCk/IiwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIENyZWF0ZSBhIG5ldyBUTWVzc2FnZSwgcmVtb3ZpbmcgdGhlIHNlcnZpY2UgbmFtZQorICAgICAgICAgICAgICAgIHZhciBuZXdNZXNzYWdlID0gbmV3IFRNZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLk5hbWUuU3Vic3RyaW5nKHNlcnZpY2VOYW1lLkxlbmd0aCArIFRNdWx0aXBsZXhlZFByb3RvY29sLlNlcGFyYXRvci5MZW5ndGgpLAorICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLlR5cGUsCisgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuU2VxSUQpOworCisgICAgICAgICAgICAgICAgLy8gRGlzcGF0Y2ggcHJvY2Vzc2luZyB0byB0aGUgc3RvcmVkIHByb2Nlc3NvcgorICAgICAgICAgICAgICAgIHJldHVybgorICAgICAgICAgICAgICAgICAgICBhd2FpdAorICAgICAgICAgICAgICAgICAgICAgICAgYWN0dWFsUHJvY2Vzc29yLlByb2Nlc3NBc3luYyhuZXcgU3RvcmVkTWVzc2FnZVByb3RvY29sKGlwcm90LCBuZXdNZXNzYWdlKSwgb3Byb3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKElPRXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsgLy8gc2ltaWxhciB0byBhbGwgb3RoZXIgcHJvY2Vzc29ycworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgUmVnaXN0ZXJQcm9jZXNzb3Ioc3RyaW5nIHNlcnZpY2VOYW1lLCBJVEFzeW5jUHJvY2Vzc29yIHByb2Nlc3NvcikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKF9zZXJ2aWNlUHJvY2Vzc29yTWFwLkNvbnRhaW5zS2V5KHNlcnZpY2VOYW1lKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgJCJQcm9jZXNzb3IgbWFwIGFscmVhZHkgY29udGFpbnMgcHJvY2Vzc29yIHdpdGggbmFtZTogJ3tzZXJ2aWNlTmFtZX0nIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIF9zZXJ2aWNlUHJvY2Vzc29yTWFwLkFkZChzZXJ2aWNlTmFtZSwgcHJvY2Vzc29yKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBGYWlsQ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9vdXRwdXRCdWZmZXIgPSBuZXcgTWVtb3J5U3RyZWFtKDApOworICAgICAgICBwcml2YXRlIHJlYWRvbmx5IFRDbGllbnRUcmFuc3BvcnQgX3RyYW5zcG9ydDsKKyAgICAgICAgcHJpdmF0ZSBib29sIF9pc0Rpc3Bvc2VkOworCisgICAgICAgIC8vVE9ETzogc2hvdWxkIHN1cHBvcnQgb25seSBzcGVjaWZpZWQgaW5wdXQgdHJhbnNwb3J0PworICAgICAgICBwdWJsaWMgVEJ1ZmZlcmVkQ2xpZW50VHJhbnNwb3J0KFRDbGllbnRUcmFuc3BvcnQgdHJhbnNwb3J0LCBpbnQgYnVmU2l6ZSA9IDEwMjQpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChidWZTaXplIDw9IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50T3V0T2ZSYW5nZUV4Y2VwdGlvbihuYW1lb2YoYnVmU2l6ZSksICJCdWZmZXIgc2l6ZSBtdXN0IGJlIGEgcG9zaXRpdmUgbnVtYmVyLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBfdHJhbnNwb3J0ID0gdHJhbnNwb3J0ID8/IHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24obmFtZW9mKHRyYW5zcG9ydCkpOworICAgICAgICAgICAgX2J1ZlNpemUgPSBidWZTaXplOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRDbGllbnRUcmFuc3BvcnQgVW5kZXJseWluZ1RyYW5zcG9ydAorICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgICAgICByZXR1cm4gX3RyYW5zcG9ydDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIElzT3BlbiA9PiAhX2lzRGlzcG9zZWQgJiYgX3RyYW5zcG9ydC5Jc09wZW47CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgT3BlbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgIGF3YWl0IF90cmFuc3BvcnQuT3BlbkFzeW5jKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworCisgICAgICAgICAgICBfdHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxpbnQ+IFJlYWRBc3luYyhieXRlW10gYnVmZmVyLCBpbnQgb2Zmc2V0LCBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vVE9ETzogaW52ZXN0aWdhdGUgaG93IGl0IHNob3VsZCB3b3JrIGNvcnJlY3RseQorICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworCisgICAgICAgICAgICBWYWxpZGF0ZUJ1ZmZlckFyZ3MoYnVmZmVyLCBvZmZzZXQsIGxlbmd0aCk7CisKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKF9pbnB1dEJ1ZmZlci5DYXBhY2l0eSA8IF9idWZTaXplKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9pbnB1dEJ1ZmZlci5DYXBhY2l0eSA9IF9idWZTaXplOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgZ290ID0gYXdhaXQgX2lucHV0QnVmZmVyLlJlYWRBc3luYyhidWZmZXIsIG9mZnNldCwgbGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoZ290ID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZ290OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBfaW5wdXRCdWZmZXIuU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKyAgICAgICAgICAgIF9pbnB1dEJ1ZmZlci5TZXRMZW5ndGgoX2lucHV0QnVmZmVyLkNhcGFjaXR5KTsKKworICAgICAgICAgICAgQXJyYXlTZWdtZW50PGJ5dGU+IGJ1ZlNlZ21lbnQ7CisgICAgICAgICAgICBfaW5wdXRCdWZmZXIuVHJ5R2V0QnVmZmVyKG91dCBidWZTZWdtZW50KTsKKworICAgICAgICAgICAgLy8gaW52ZXN0aWdhdGUKKyAgICAgICAgICAgIHZhciBmaWxsZWQgPSBhd2FpdCBfdHJhbnNwb3J0LlJlYWRBc3luYyhidWZTZWdtZW50LkFycmF5LCAwLCAoaW50KSBfaW5wdXRCdWZmZXIuTGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBfaW5wdXRCdWZmZXIuU2V0TGVuZ3RoKGZpbGxlZCk7CisKKyAgICAgICAgICAgIGlmIChmaWxsZWQgPT0gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFJlYWRBc3luYyhidWZmZXIsIG9mZnNldCwgbGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUFzeW5jKGJ5dGVbXSBidWZmZXIsIGludCBvZmZzZXQsIGludCBsZW5ndGgsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgIFZhbGlkYXRlQnVmZmVyQXJncyhidWZmZXIsIG9mZnNldCwgbGVuZ3RoKTsKKworICAgICAgICAgICAgaWYgKCFJc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBSZWxhdGl2ZSBvZmZzZXQgZnJvbSAib2ZmIiBhcmd1bWVudAorICAgICAgICAgICAgdmFyIHdyaXR0ZW5Db3VudCA9IDA7CisgICAgICAgICAgICBpZiAoX291dHB1dEJ1ZmZlci5MZW5ndGggPiAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBjYXBhID0gKGludCkgKF9vdXRwdXRCdWZmZXIuQ2FwYWNpdHkgLSBfb3V0cHV0QnVmZmVyLkxlbmd0aCk7CisgICAgICAgICAgICAgICAgdmFyIHdyaXRlU2l6ZSA9IGNhcGEgPD0gbGVuZ3RoID8gY2FwYSA6IGxlbmd0aDsKKyAgICAgICAgICAgICAgICBhd2FpdCBfb3V0cHV0QnVmZmVyLldyaXRlQXN5bmMoYnVmZmVyLCBvZmZzZXQsIHdyaXRlU2l6ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICAgICAgd3JpdHRlbkNvdW50ICs9IHdyaXRlU2l6ZTsKKyAgICAgICAgICAgICAgICBpZiAod3JpdGVTaXplID09IGNhcGEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvL0FycmF5U2VnbWVudDxieXRlPiBidWZTZWdtZW50OworICAgICAgICAgICAgICAgICAgICAvL19vdXRwdXRCdWZmZXIuVHJ5R2V0QnVmZmVyKG91dCBidWZTZWdtZW50KTsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGEgPSBfb3V0cHV0QnVmZmVyLlRvQXJyYXkoKTsKKyAgICAgICAgICAgICAgICAgICAgLy9hd2FpdCBfdHJhbnNwb3J0LldyaXRlQXN5bmMoYnVmU2VnbWVudC5BcnJheSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICBhd2FpdCBfdHJhbnNwb3J0LldyaXRlQXN5bmMoZGF0YSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgICAgICBfb3V0cHV0QnVmZmVyLlNldExlbmd0aCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHdoaWxlIChsZW5ndGggLSB3cml0dGVuQ291bnQgPj0gX2J1ZlNpemUpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgX3RyYW5zcG9ydC5Xcml0ZUFzeW5jKGJ1ZmZlciwgb2Zmc2V0ICsgd3JpdHRlbkNvdW50LCBfYnVmU2l6ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIHdyaXR0ZW5Db3VudCArPSBfYnVmU2l6ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIHJlbWFpbiA9IGxlbmd0aCAtIHdyaXR0ZW5Db3VudDsKKyAgICAgICAgICAgIGlmIChyZW1haW4gPiAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfb3V0cHV0QnVmZmVyLkNhcGFjaXR5IDwgX2J1ZlNpemUpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfb3V0cHV0QnVmZmVyLkNhcGFjaXR5ID0gX2J1ZlNpemU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGF3YWl0IF9vdXRwdXRCdWZmZXIuV3JpdGVBc3luYyhidWZmZXIsIG9mZnNldCArIHdyaXR0ZW5Db3VudCwgcmVtYWluLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBGbHVzaEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKF9vdXRwdXRCdWZmZXIuTGVuZ3RoID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvL0FycmF5U2VnbWVudDxieXRlPiBidWZTZWdtZW50OworICAgICAgICAgICAgICAgIHZhciBkYXRhID0gX291dHB1dEJ1ZmZlci5Ub0FycmF5KCk7IC8vIFRyeUdldEJ1ZmZlcihvdXQgYnVmU2VnbWVudCk7CisKKyAgICAgICAgICAgICAgICBhd2FpdCBfdHJhbnNwb3J0LldyaXRlQXN5bmMoZGF0YSAvKmJ1ZlNlZ21lbnQuQXJyYXkqLywgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIF9vdXRwdXRCdWZmZXIuU2V0TGVuZ3RoKDApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBfdHJhbnNwb3J0LkZsdXNoQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIENoZWNrTm90RGlzcG9zZWQoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX2lzRGlzcG9zZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE9iamVjdERpc3Bvc2VkRXhjZXB0aW9uKG5hbWVvZihfdHJhbnNwb3J0KSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9pc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfaW5wdXRCdWZmZXI/LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgX291dHB1dEJ1ZmZlcj8uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBfdHJhbnNwb3J0Py5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgX2lzRGlzcG9zZWQgPSB0cnVlOworICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2xpYi9uZXRjb3JlL1RocmlmdC9UcmFuc3BvcnRzL0NsaWVudC9URnJhbWVkQ2xpZW50VHJhbnNwb3J0LmNzIGIvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvQ2xpZW50L1RGcmFtZWRDbGllbnRUcmFuc3BvcnQuY3MKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZDExYmI5NQ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cG9ydCB0cmFuc3BvcnQpCisgICAgICAgIHsKKyAgICAgICAgICAgIF90cmFuc3BvcnQgPSB0cmFuc3BvcnQgPz8gdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2YodHJhbnNwb3J0KSk7CisKKyAgICAgICAgICAgIEluaXRXcml0ZUJ1ZmZlcigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuID0+ICFfaXNEaXNwb3NlZCAmJiBfdHJhbnNwb3J0LklzT3BlbjsKKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBPcGVuQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIENoZWNrTm90RGlzcG9zZWQoKTsKKworICAgICAgICAgICAgYXdhaXQgX3RyYW5zcG9ydC5PcGVuQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgIF90cmFuc3BvcnQuQ2xvc2UoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGludD4gUmVhZEFzeW5jKGJ5dGVbXSBidWZmZXIsIGludCBvZmZzZXQsIGludCBsZW5ndGgsCisgICAgICAgICAgICBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgQ2hlY2tOb3REaXNwb3NlZCgpOworCisgICAgICAgICAgICBWYWxpZGF0ZUJ1ZmZlckFyZ3MoYnVmZmVyLCBvZmZzZXQsIGxlbmd0aCk7CisKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdmFyIGdvdCA9IGF3YWl0IF9yZWFkQnVmZmVyLlJlYWRBc3luYyhidWZmZXIsIG9mZnNldCwgbGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICBpZiAoZ290ID4gMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZ290OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBSZWFkIGFub3RoZXIgZnJhbWUgb2YgZGF0YQorICAgICAgICAgICAgYXdhaXQgUmVhZEZyYW1lQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICByZXR1cm4gYXdhaXQgX3JlYWRCdWZmZXIuUmVhZEFzeW5jKGJ1ZmZlciwgb2Zmc2V0LCBsZW5ndGgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYXN5bmMgVGFzayBSZWFkRnJhbWVBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgX3RyYW5zcG9ydC5SZWFkQWxsQXN5bmMoX2hlYWRlckJ1ZiwgMCwgSGVhZGVyU2l6ZSwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICB2YXIgc2l6ZSA9IERlY29kZUZyYW1lU2l6ZShfaGVhZGVyQnVmKTsKKworICAgICAgICAgICAgX3JlYWRCdWZmZXIuU2V0TGVuZ3RoKHNpemUpOworICAgICAgICAgICAgX3JlYWRCdWZmZXIuU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKworICAgICAgIC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2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBGbHVzaEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBDaGVja05vdERpc3Bvc2VkKCk7CisKKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy9BcnJheVNlZ21lbnQ8Ynl0ZT4gYnVmU2VnbWVudDsKKyAgICAgICAgICAgIC8vX3dyaXRlQnVmZmVyLlRyeUdldEJ1ZmZlcihvdXQgYnVmU2VnbWVudCk7CisgICAgICAgICAgICAvL3ZhciBidWYgPSBidWZTZWdtZW50LkFycmF5OworICAgICAgICAgICAgdmFyIGJ1ZiA9IF93cml0ZUJ1ZmZlci5Ub0FycmF5KCk7CisKKyAgICAgICAgICAgIC8vdmFyIGxlbiA9IChpbnQpX3dyaXRlQnVmZmVyLkxlbmd0aDsKKyAgICAgICAgICAgIHZhciBkYXRhTGVuID0gKGludCkgX3dyaXRlQnVmZmVyLkxlbmd0aCAtIEhlYWRlclNpemU7CisgICAgICAgICAgICBpZiAoZGF0YUxlbiA8IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEludmFsaWRPcGVyYXRpb25FeGNlcHRpb24oKTsgLy8gbG9naWMgZXJyb3IgYWN0dWFsbHkKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gSW5qZWN0IG1lc3NhZ2UgaGVhZGVyIGludG8gdGhlIHJlc2VydmVkIGJ1ZmZlciBzcGFjZQorICAgICAgICAgICAgRW5jb2RlRnJhbWVTaXplKGRhdGFMZW4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ZShieXRlW10gYnVmKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICAgICAoKGJ1ZlswXSAmIDB4ZmYpIDw8IDI0KSB8CisgICAgICAgICAgICAgICAgKChidWZbMV0gJiAweGZmKSA8PCAxNikgfAorICAgICAgICAgICAgICAgICgoYnVmWzJdICYgMHhmZikgPDwgOCkgfAorICAgICAgICAgICAgICAgIChidWZbM10gJiAweGZmKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIENoZWNrTm90RGlzcG9zZWQoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX2lzRGlzcG9zZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE9iamVjdERpc3Bvc2VkRXhjZXB0aW9uKCJURnJhbWVkQ2xpZW50VHJhbnNwb3J0Iik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9pc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfcmVhZEJ1ZmZlcj8uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBfd3JpdGVCdWZmZXI/LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgX3RyYW5zcG9ydD8uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF9pc0Rpc3Bvc2VkID0gdHJ1ZTsKKyAgICAgICAgfQorICAgIH0KK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9saWIvb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Y29tL2RvdG5ldC9jb3JlZngvaXNzdWVzLzg4MDkKKyAgICAgICAgICAgIC8vIHRoaXMgY2FuIGJlIHN3aXRjaGVkIHRvIGRlZmF1bHQgd2F5IChjcmVhdGUgY2xpZW50LT51c2UtPmRpc3Bvc2UgcGVyIGZsdXNoKSBsYXRlcgorICAgICAgICAgICAgX2h0dHBDbGllbnQgPSBDcmVhdGVDbGllbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBJRGljdGlvbmFyeTxzdHJpbmcsIHN0cmluZz4gQ3VzdG9tSGVhZGVycyB7IGdldDsgfQorCisgICAgICAgIHB1YmxpYyBpbnQgQ29ubmVjdFRpbWVvdXQKKyAgICAgICAgeworICAgICAgICAgICAgc2V0IHsgX2Nvbm5lY3RUaW1lb3V0ID0gdmFsdWU7IH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIElzT3BlbiA9PiB0cnVlOworCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIE9wZW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKF9pbnB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9pbnB1dFN0cmVhbS5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgX2lucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKF9vdXRwdXRTdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBfb3V0cHV0U3RyZWFtLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICBfb3V0cHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKF9odHRwQ2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX2h0dHBDbGllbnQuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgIF9odHRwQ2xpZW50ID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrPGludD4gUmVhZEFzeW5jKGJ5dGVbXSBidWZmZXIsIGludCBvZmZzZXQsIGludCBsZW5ndGgsCisgICAgICAgICAgICBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxpbnQ+KGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKF9pbnB1dFN0cmVhbSA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiTm8gcmVxdWVzdCBoYXMgYmVlbiBzZW50Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciByZXQgPSBhd2FpdCBfaW5wdXRTdHJlYW0uUmVhZEFzeW5jKGJ1ZmZlciwgb2Zmc2V0LCBsZW5ndGgsIGNhbmNlbGxhdGlvblRva2VuKTsKKworICAgICAgICAgICAgICAgIGlmIChyZXQgPT0gLTEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuRW5kT2ZGaWxlLCAiTm8gbW9yZSBkYXRhIGF2YWlsYWJsZSIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiByZXQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoSU9FeGNlcHRpb24gaW94KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Vbmtub3duLCBpb3guVG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBXcml0ZUFzeW5jKGJ5dGVbXSBidWZmZXIsIGludCBvZmZzZXQsIGludCBsZW5ndGgsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBfb3V0cHV0U3RyZWFtLldyaXRlQXN5bmMoYnVmZmVyLCBvZmZzZXQsIGxlbmd0aCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBIdHRwQ2xpZW50IENyZWF0ZUNsaWVudCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciBoYW5kbGVyID0gbmV3IEh0dHBDbGllbnRIYW5kbGVyKCk7CisgICAgICAgICAgICBoYW5kbGVyLkNsaWVudENlcnRpZmljYXRlcy5BZGRSYW5nZShfY2VydGlmaWNhdGVzKTsKKworICAgICAgICAgICAgdmFyIGh0dHBDbGllbnQgPSBuZXcgSHR0cENsaWVudChoYW5kbGVyKTsKKworICAgICAgICAgICAgaWYgKF9jb25uZWN0VGltZW91dCA+IDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaHR0cENsaWVudC5UaW1lb3V0ID0gVGltZVNwYW4uRnJvbVNlY29uZHMoX2Nvbm5lY3RUaW1lb3V0KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaHR0cENsaWVudC5EZWZhdWx0UmVxdWVzdEhlYWRlcnMuQWNjZXB0LkFkZChuZXcgTWVkaWFUeXBlV2l0aFF1YWxpdHlIZWFkZXJWYWx1ZSgiYXBwbGljYXRpb24veC10aHJpZnQiKSk7CisgICAgICAgICAgICBodHRwQ2xpZW50LkRlZmF1bHRSZXF1ZXN0SGVhZGVycy5Vc2VyQWdlbnQuQWRkKG5ldyBQcm9kdWN0SW5mb0hlYWRlclZhbHVlKCJUSHR0cENsaWVudFRyYW5zcG9ydCIsICIxLjAuMCIpKTsKKworICAgICAgICAgICAgaWYgKEN1c3RvbUhlYWRlcnMgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIgaXRlbSBpbiBDdXN0b21IZWFkZXJzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaHR0cENsaWVudC5EZWZhdWx0UmVxdWVzdEhlYWRlcnMuQWRkKGl0ZW0uS2V5LCBpdGVtLlZhbHVlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBodHRwQ2xpZW50OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgRmx1c2hBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoX291dHB1dFN0cmVhbS5DYW5TZWVrKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBfb3V0cHV0U3RyZWFtLlNlZWsoMCwgU2Vla09yaWdpbi5CZWdpbik7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICB1c2luZyAodmFyIG91dFN0cmVhbSA9IG5ldyBTdHJlYW1Db250ZW50KF9vdXRwdXRTdHJlYW0pKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXNnID0gYXdhaXQgX2h0dHBDbGllbnQuUG9zdEFzeW5jKF91cmksIG91dFN0cmVhbSwgY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICAgICAgICAgICAgICBtc2cuRW5zdXJlU3VjY2Vzc1N0YXR1c0NvZGUoKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF9pbnB1dFN0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9pbnB1dFN0cmVhbS5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2lucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgX2lucHV0U3RyZWFtID0gYXdhaXQgbXNnLkNvbnRlbnQuUmVhZEFzU3RyZWFtQXN5bmMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfaW5wdXRTdHJlYW0uQ2FuU2VlaykKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBfaW5wdXRTdHJlYW0uU2VlaygwLCBTZWVrT3JpZ2luLkJlZ2luKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoSU9FeGNlcHRpb24gaW94KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLlVua25vd24sIGlveC5Ub1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEh0dHBSZXF1ZXN0RXhjZXB0aW9uIHd4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLlVua25vd24sCisgICAgICAgICAgICAgICAgICAgICAgICAiQ291bGRuJ3QgY29ubmVjdCB0byBzZXJ2ZXI6ICIgKyB3eCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9vdXRwdXRTdHJlYW0gPSBuZXcgTWVtb3J5U3RyZWFtKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3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gb25jZSBJbmNvbnNpc3RlbnROYW1pbmcKKyAgICBwdWJsaWMgY2xhc3MgVE1lbW9yeUJ1ZmZlckNsaWVudFRyYW5zcG9ydCA6IFRDbGllbnRUcmFuc3BvcnQKKyAgICB7CisgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgTWVtb3J5U3RyZWFtIF9ieXRlU3RyZWFtOworICAgICAgICBwcml2YXRlIGJvb2wgX2lzRGlzcG9zZWQ7CisKKyAgICAgICAgcHVibGljIFRNZW1vcnlCdWZmZXJDbGllbnRUcmFuc3BvcnQoKQorICAgICAgICB7CisgICAgICAgICAgICBfYnl0ZVN0cmVhbSA9IG5ldyBNZW1vcnlTdHJlYW0oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUTWVtb3J5QnVmZmVyQ2xpZW50VHJhbnNwb3J0KGJ5dGVbXSBidWYpCisgICAgICAgIHsKKyAgICAgICAgICAgIF9ieXRlU3RyZWFtID0gbmV3IE1lbW9yeVN0cmVhbShidWYpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuID0+IHRydWU7CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgT3BlbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICAvKiogZG8gbm90aGluZyAqKi8KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdm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QpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJ5dGVbXSBHZXRCdWZmZXIoKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gX2J5dGVTdHJlYW0uVG9BcnJheSgpOworICAgICAgICB9CisKKyAgICAgICAgLy8gSURpc3Bvc2FibGUKKyAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgRGlzcG9zZShib29sIGRpc3Bvc2luZykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCFfaXNEaXNwb3NlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZGlzcG9zaW5nKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX2J5dGVTdHJlYW0/LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfaXNEaXNwb3NlZCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvQ2xpZW50L1ROYW1lZFBpcGVDbGllbnRUcmFuc3BvcnQuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVHJhbnNwb3J0cy9DbGllbnQvVE5hbWVkUGlwZUNsaWVudFRyYW5zcG9ydC5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mNWU0YmFmCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvQ2xpZW50L1ROYW1lZFBpcGVDbGllbnRUcmFuc3BvcnQuY3MKQEAgLTAsMCArMSw5NSBA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9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChJc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkFscmVhZHlPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYXdhaXQgX2NsaWVudC5Db25uZWN0QXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX2NsaWVudCAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9jbGllbnQuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgIF9jbGllbnQgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2s8aW50PiBSZWFkQXN5bmMoYnl0ZVtdIGJ1ZmZlciwgaW50IG9mZnNldCwgaW50IGxlbmd0aCwKKyAgICAgICAgICAgIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX2NsaWVudCA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGF3YWl0IF9jbGllbnQuUmVhZEFzeW5jKGJ1ZmZlciwgb2Zmc2V0LCBsZW5ndGgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIFdyaXRlQXN5bmMoYnl0ZVtdIGJ1ZmZlciwgaW50IG9mZnNldCwgaW50IGxlbmd0aCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChfY2xpZW50ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBfY2xpZW50LldyaXRlQXN5bmMoYnVmZmVyLCBvZmZzZXQsIGxlbmd0aCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgRmx1c2hBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBvdmVycmlkZSB2b2lkIERpc3Bvc2UoYm9vbCBkaXNwb3NpbmcpCisgICAgICAgIHsKKyAgICAgICAgICAgIF9jbGllbnQuRGlzcG9zZSgpOworICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2xpYi9uZXRjb3JlL1RocmlmdC9UcmFuc3BvcnRzL0NsaWVudC9UU29ja2V0Q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HJlYW0gPSBjbGllbnQuR2V0U3RyZWFtKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVFNvY2tldENsaWVudFRyYW5zcG9ydChJUEFkZHJlc3MgaG9zdCwgaW50IHBvcnQpCisgICAgICAgICAgICA6IHRoaXMoaG9zdCwgcG9ydCwgMCkKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzIGhvc3QsIGludCBwb3J0LCBpbnQgdGltZW91dCkKKyAgICAgICAgeworICAgICAgICAgICAgSG9zdCA9IGhvc3Q7CisgICAgICAgICAgICBQb3J0ID0gcG9ydDsKKworICAgICAgICAgICAgVGNwQ2xpZW50ID0gbmV3IFRjcENsaWVudCgpOworICAgICAgICAgICAgVGNwQ2xpZW50LlJlY2VpdmVUaW1lb3V0ID0gVGNwQ2xpZW50LlNlbmRUaW1lb3V0ID0gdGltZW91dDsKKyAgICAgICAgICAgIFRjcENsaWVudC5DbGllbnQuTm9EZWxheSA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVGNwQ2xpZW50IFRjcENsaWVudCB7IGdldDsgcHJpdmF0ZSBzZXQ7IH0KKyAgICAgICAgcHVibGljIElQQWRkcmVzcyBIb3N0IHsgZ2V0OyB9CisgICAgICAgIHB1YmxpYyBpbnQgUG9ydCB7IGdldDsgfQorCisgICAgICAgIHB1YmxpYyBpbnQgVGltZW91dAorICAgICAgICB7CisgICAgICAgICAgICBzZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoVGNwQ2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBUY3BDbGllbnQuUmVjZWl2ZVRpbWVvdXQgPSBUY3BDbGllbnQuU2VuZFRpbWVvdXQgPSB2YWx1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4KKyAgICAgICAgeworICAgICAgICAgICAgZ2V0CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKFRjcENsaWVudCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiBUY3BDbGllbnQuQ29ubmVjdGVkOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgT3BlbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5BbHJlYWR5T3BlbiwgIlNvY2tldCBhbHJlYWR5IGNvbm5lY3RlZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoUG9ydCA8PSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiQ2Fubm90IG9wZW4gd2l0aG91dCBwb3J0Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChUY3BDbGllbnQgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigiSW52YWxpZCBvciBub3QgaW5pdGlhbGl6ZWQgdGNwIGNsaWVudCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhd2FpdCBUY3BDbGllbnQuQ29ubmVjdEFzeW5jKEhvc3QsIFBvcnQpOworCisgICAgICAgICAgICBJbnB1dFN0cmVhbSA9IFRjcENsaWVudC5HZXRTdHJlYW0oKTsKKyAgICAgICAgICAgIE91dHB1dFN0cmVhbSA9IFRjcENsaWVudC5HZXRTdHJlYW0oKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgYmFzZS5DbG9zZSgpOworCisgICAgICAgICAgICBpZiAoVGNwQ2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgVGNwQ2xpZW50LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICBUY3BDbGllbnQgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gSURpc3Bvc2FibGUKKyAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgRGlzcG9zZShib29sIGRpc3Bvc2luZykKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKCFfaXNEaXNwb3NlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZGlzcG9zaW5nKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgVGNwQ2xpZW50Py5EaXNwb3NlKCk7CisKKyAgICAgICAgICAgICAgICAgICAgYmFzZS5EaXNwb3NlKGRpc3Bvc2luZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAg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ID0gaW5wdXRTdHJlYW07CisgICAgICAgICAgICBPdXRwdXRTdHJlYW0gPSBvdXRwdXRTdHJlYW07CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgU3RyZWFtIE91dHB1dFN0cmVhbSB7IGdldDsgc2V0OyB9CisKKyAgICAgICAgcHJvdGVjdGVkIFN0cmVhbSBJbnB1dFN0cmVhbSB7IGdldDsgc2V0OyB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNPcGVuID0+IHRydWU7CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgT3BlbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQoY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoSW5wdXRTdHJlYW0gIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBJbnB1dFN0cmVhbS5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgSW5wdXRTdHJlYW0gPSBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoT3V0cHV0U3RyZWFtICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgT3V0cHV0U3RyZWFtLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICBPdXRwdXRTdHJlYW0gPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5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c3luYyhidWZmZXIsIG9mZnNldCwgbGVuZ3RoLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBGbHVzaEFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBPdXRwdXRTdHJlYW0uRmx1c2hBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgIH0KKworICAgICAgICAvLyBJRGlzcG9zYWJsZQorICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBEaXNwb3NlKGJvb2wgZGlzcG9zaW5nKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIV9pc0Rpc3Bvc2VkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChkaXNwb3NpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBJbnB1dFN0cmVhbT8uRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICBPdXRwdXRTdHJlYW0/LkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfaXNEaXNwb3NlZCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvQ2xpZW50L1RUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVHJhbnNwb3J0cy9DbGllbnQvVFRsc1NvY2tldENsaWVudFRyYW5zcG9ydC5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jOGJlNGVkCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVG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AgICAgICAgIF9pc1NlcnZlciA9IGlzU2VydmVyOworCisgICAgICAgICAgICBpZiAoaXNTZXJ2ZXIgJiYgY2VydGlmaWNhdGUgPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJndW1lbnRFeGNlcHRpb24oIlRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQgbmVlZHMgY2VydGlmaWNhdGUgdG8gYmUgdXNlZCBmb3Igc2VydmVyIiwKKyAgICAgICAgICAgICAgICAgICAgbmFtZW9mKGNlcnRpZmljYXRlKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChJc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgSW5wdXRTdHJlYW0gPSBjbGllbnQuR2V0U3RyZWFtKCk7CisgICAgICAgICAgICAgICAgT3V0cHV0U3RyZWFtID0gY2xpZW50LkdldFN0cmVhbSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzIGhvc3QsIGludCBwb3J0LCBzdHJpbmcgY2VydGlmaWNhdGVQYXRoLAorICAgICAgICAgICAgUmVtb3RlQ2VydGlmaWNhdGVWYWxpZGF0aW9uQ2FsbGJhY2sgY2VydFZhbGlkYXRvciA9IG51bGwsCisgICAgICAgICAgICBMb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrID0gbnVsbCwKKyAgICAgICAgICAgIFNzbFByb3RvY29scyBzc2xQcm90b2NvbHMgPSBTc2xQcm90b2NvbHMuVGxzMTIpCisgICAgICAgICAgICA6IHRoaXMoaG9zdCwgcG9ydCwgMCwKKyAgICAgICAgICAgICAgICBuZXcgWDUwOUNlcnRpZmljYXRlMihjZXJ0aWZpY2F0ZVBhdGgpLAorICAgICAgICAgICAgICAgIGNlcnRWYWxpZGF0b3IsCisgICAgICAgICAgICAgICAgbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrLAorICAgICAgICAgICAgICAgIHNzbFByb3RvY29scykKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzIGhvc3QsIGludCBwb3J0LAorICAgICAgICAgICAgWDUwOUNlcnRpZmljYXRlMiBjZXJ0aWZpY2F0ZSA9IG51bGwsCisgICAgICAgICAgICBSZW1vdGVDZXJ0aWZpY2F0ZVZhbGlkYXRpb25DYWxsYmFjayBjZXJ0VmFsaWRhdG9yID0gbnVsbCwKKyAgICAgICAgICAgIExvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayBsb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgPSBudWxsLAorICAgICAgICAgICAgU3NsUHJvdG9jb2xzIHNzbFByb3RvY29scyA9IFNzbFByb3RvY29scy5UbHMxMikKKyAgICAgICAgICAgIDogdGhpcyhob3N0LCBwb3J0LCAwLAorICAgICAgICAgICAgICAgIGNlcnRpZmljYXRlLAorICAgICAgICAgICAgICAgIGNlcnRWYWxpZGF0b3IsCisgICAgICAgICAgICAgICAgbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrLAorICAgICAgICAgICAgICAgIHNzbFByb3RvY29scykKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzIGhvc3QsIGludCBwb3J0LCBpbnQgdGltZW91dCwKKyAgICAgICAgICAgIFg1MDlDZXJ0aWZpY2F0ZTIgY2VydGlmaWNhdGUsCisgICAgICAgICAgICBSZW1vdGVDZXJ0aWZpY2F0ZVZhbGlkYXRpb25DYWxsYmFjayBjZXJ0VmFsaWRhdG9yID0gbnVsbCwKKyAgICAgICAgICAgIExvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayBsb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgPSBudWxsLAorICAgICAgICAgICAgU3NsUHJvdG9jb2xzIHNzbFByb3RvY29scyA9IFNzbFByb3RvY29scy5UbHMxMikKKyAgICAgICAgeworICAgICAgICAgICAgX2hvc3QgPSBob3N0OworICAgICAgICAgICAgX3BvcnQgPSBwb3J0OworICAgICAgICAgICAgX3RpbWVvdXQgPSB0aW1lb3V0OworICAgICAgICAgICAgX2NlcnRpZmljYXRlID0gY2VydGlmaWNhdGU7CisgICAgICAgICAgICBfY2VydFZhbGlkYXRvciA9IGNlcnRWYWxpZGF0b3I7CisgICAgICAgICAgICBfbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrID0gbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrOworICAgICAgICAgICAgX3NzbFByb3RvY29scyA9IHNzbFByb3RvY29sczsKKworICAgICAgICAgICAgSW5pdFNvY2tldCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBUaW1lb3V0CisgICAgICAgIHsKKyAgICAgICAgICAgIHNldCB7IF9jbGllbnQuUmVjZWl2ZVRpbWVvdXQgPSBfY2xpZW50LlNlbmRUaW1lb3V0ID0gX3RpbWVvdXQgPSB2YWx1ZTsgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRjcENsaWVudCBUY3BDbGllbnQgPT4gX2NsaWVudDsKKworICAgICAgICBwdWJsaWMgSVBBZGRyZXNzIEhvc3QgPT4gX2hvc3Q7CisKKyAgICAgICAgcHVibGljIGludCBQb3J0ID0+IF9wb3J0OworCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIElzT3BlbgorICAgICAgICB7CisgICAgICAgICAgICBnZXQKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoX2NsaWVudCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiBfY2xpZW50LkNvbm5lY3RlZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBJbml0U29ja2V0KCkKKyAgICAgICAgeworICAgICAgICAgICAgX2NsaWVudCA9IG5ldyBUY3BDbGllbnQoKTsKKyAgICAgICAgICAgIF9jbGllbnQuUmVjZWl2ZVRpbWVvdXQgPSBfY2xpZW50LlNlbmRUaW1lb3V0ID0gX3RpbWVvdXQ7CisgICAgICAgICAgICBfY2xpZW50LkNsaWVudC5Ob0RlbGF5ID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgYm9vbCBEZWZhdWx0Q2VydGlmaWNhdGVWYWxpZGF0b3Iob2JqZWN0IHNlbmRlciwgWDUwOUNlcnRpZmljYXRlIGNlcnRpZmljYXRlLCBYNTA5Q2hhaW4gY2hhaW4sCisgICAgICAgICAgICBTc2xQb2xpY3lFcnJvcnMgc3NsVmFsaWRhdGlvbkVycm9ycykKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHNzbFZhbGlkYXRpb25FcnJvcnMgPT0gU3NsUG9saWN5RXJyb3JzLk5vbmU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzayBPcGVuQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChJc09wZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLkFscmVhZHlPcGVuLCAiU29ja2V0IGFscmVhZHkgY29ubmVjdGVkIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfaG9zdCA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiQ2Fubm90IG9wZW4gbnVsbCBob3N0Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfcG9ydCA8PSAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiQ2Fubm90IG9wZW4gd2l0aG91dCBwb3J0Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfY2xpZW50ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgSW5pdFNvY2tldCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoX2NsaWVudCAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGF3YWl0IF9jbGllbnQuQ29ubmVjdEFzeW5jKF9ob3N0LCBfcG9ydCk7CisgICAgICAgICAgICAgICAgYXdhaXQgU2V0dXBUbHNBc3luYygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgU2V0dXBUbHNBc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHZhciB2YWxpZGF0b3IgPSBfY2VydFZhbGlkYXRvciA/PyBEZWZhdWx0Q2VydGlmaWNhdGVWYWxpZGF0b3I7CisKKyAgICAgICAgICAgIGlmIChfbG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX3NlY3VyZVN0cmVhbSA9IG5ldyBTc2xTdHJlYW0oX2NsaWVudC5HZXRTdHJlYW0oKSwgZmFsc2UsIHZhbGlkYXRvciwgX2xvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX3NlY3VyZVN0cmVhbSA9IG5ldyBTc2xTdHJlYW0oX2NsaWVudC5HZXRTdHJlYW0oKSwgZmFsc2UsIHZhbGlkYXRvcik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfaXNTZXJ2ZXIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvLyBTZXJ2ZXIgYXV0aGVudGljYXRpb24KKyAgICAgICAgICAgICAgICAgICAgYXdhaXQKKyAgICAgICAgICAgICAgICAgICAgICAgIF9zZWN1cmVTdHJlYW0uQXV0aGVudGljYXRlQXNTZXJ2ZXJBc3luYyhfY2VydGlmaWNhdGUsIF9jZXJ0VmFsaWRhdG9yICE9IG51bGwsIF9zc2xQcm90b2NvbHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8vIENsaWVudCBhdXRoZW50aWNhdGlvbgorICAgICAgICAgICAgICAgICAgICB2YXIgY2VydHMgPSBfY2VydGlmaWNhdGUgIT0gbnVsbAorICAgICAgICAgICAgICAgICAgICAgICAgPyBuZXcgWDUwOUNlcnRpZmljYXRlQ29sbGVjdGlvbiB7X2NlcnRpZmljYXRlfQorICAgICAgICAgICAgICAgICAgICAgICAgOiBuZXcgWDUwOUNlcnRpZmljYXRlQ29sbGVjdGlvbigpOworCisgICAgICAgICAgICAgICAgICAgIHZhciB0YXJnZXRIb3N0ID0gX2hvc3QuVG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgYXdhaXQgX3NlY3VyZVN0cmVhbS5BdXRoZW50aWNhdGVBc0NsaWVudEFzeW5jKHRhcmdldEhvc3QsIGNlcnRzLCBfc3NsUHJvdG9jb2xzLCB0cnVlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENsb3NlKCk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIElucHV0U3RyZWFtID0gX3NlY3VyZVN0cmVhbTsKKyAgICAgICAgICAgIE91dHB1dFN0cmVhbSA9IF9zZWN1cmVTdHJlYW07CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGJhc2UuQ2xvc2UoKTsKKyAgICAgICAgICAgIGlmIChfY2xpZW50ICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX2NsaWVudC5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgX2NsaWVudCA9IG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfc2VjdXJlU3RyZWFtICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX3NlY3VyZVN0cmVhbS5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgX3NlY3VyZVN0cmVhbSA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvU2Vyd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90b2NvbEZhY3RvcnksIFJlcXVlc3REZWxlZ2F0ZSBuZXh0LCBJTG9nZ2VyRmFjdG9yeSBsb2dnZXJGYWN0b3J5KQorICAgICAgICB7CisgICAgICAgICAgICBpZiAobG9nZ2VyRmFjdG9yeSA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24obmFtZW9mKGxvZ2dlckZhY3RvcnkpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgUHJvY2Vzc29yID0gcHJvY2Vzc29yID8/IHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24obmFtZW9mKHByb2Nlc3NvcikpOworICAgICAgICAgICAgSW5wdXRQcm90b2NvbEZhY3RvcnkgPSBpbnB1dFByb3RvY29sRmFjdG9yeSA/PyB0aHJvdyBuZXcgQXJndW1lbnROdWxsRXhjZXB0aW9uKG5hbWVvZihpbnB1dFByb3RvY29sRmFjdG9yeSkpOworICAgICAgICAgICAgT3V0cHV0UHJvdG9jb2xGYWN0b3J5ID0gb3V0cHV0UHJvdG9jb2xGYWN0b3J5ID8/IHRocm93IG5ldyBBcmd1bWVudE51bGxFeGNlcHRpb24obmFtZW9mKG91dHB1dFByb3RvY29sRmFjdG9yeSkpOworCisgICAgICAgICAgICBfbmV4dCA9IG5leHQ7CisgICAgICAgICAgICBfbG9nZ2VyID0gbG9nZ2VyRmFjdG9yeS5DcmVhdGVMb2dnZXI8VEh0dHBTZXJ2ZXJUcmFuc3BvcnQ+KCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBJbnZva2UoSHR0cENvbnRleHQgY29udGV4dCkKKyAgICAgICAgeworICAgICAgICAgICAgY29udGV4dC5SZXNwb25zZS5Db250ZW50VHlwZSA9IENvbnRlbnRUeXBlOworICAgICAgICAgICAgYXdhaXQgUHJvY2Vzc1JlcXVlc3RBc3luYyhjb250ZXh0LCBjb250ZXh0LlJlcXVlc3RBYm9ydGVkKTsgLy9UT0RPOiBjaGVjayBmb3IgY29ycmVjdCBsb2dpYworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2sgUHJvY2Vzc1JlcXVlc3RBc3luYyhIdHRwQ29udGV4dCBjb250ZXh0LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRyYW5zcG9ydCA9IG5ldyBUU3RyZWFtQ2xpZW50VHJhbnNwb3J0KGNvbnRleHQuUmVxdWVzdC5Cb2R5LCBjb250ZXh0LlJlc3BvbnNlLkJvZHkpOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgaW5wdXQgPSBJbnB1dFByb3RvY29sRmFjdG9yeS5HZXRQcm90b2NvbCh0cmFuc3BvcnQpOworICAgICAgICAgICAgICAgIHZhciBvdXRwdXQgPSBPdXRwdXRQcm90b2NvbEZhY3RvcnkuR2V0UHJvdG9jb2wodHJhbnNwb3J0KTsKKworICAgICAgICAgICAgICAgIHdoaWxlIChhd2FpdCBQcm9jZXNzb3IuUHJvY2Vzc0FzeW5jKGlucHV0LCBvdXRwdXQsIGNhbmNlbGxhdGlvblRva2VuKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gQ2xpZW50IGRpZWQsIGp1c3QgbW92ZSBvbgorICAgICAgICAgICAgfQorICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYW5zcG9ydC5DbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAt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AgICAgICAgcHJpdmF0ZSBOYW1lZFBpcGVTZXJ2ZXJTdHJlYW0gX3N0cmVhbSA9IG51bGw7CisKKyAgICAgICAgcHVibGljIFROYW1lZFBpcGVTZXJ2ZXJUcmFuc3BvcnQoc3RyaW5nIHBpcGVBZGRyZXNzKQorICAgICAgICB7CisgICAgICAgICAgICBfcGlwZUFkZHJlc3MgPSBwaXBlQWRkcmVzczsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIExpc3RlbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIG5vdGhpbmcgdG8gZG8gaGVyZQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgQ2xvc2UoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoX3N0cmVhbSAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy9UT0RPOiBjaGVjayBmb3IgZGlzY29uZWN0aW9uIAorICAgICAgICAgICAgICAgICAgICBfc3RyZWFtLkRpc2Nvbm5lY3QoKTsKKyAgICAgICAgICAgICAgICAgICAgX3N0cmVhbS5EaXNwb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZpbmFsbHkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9zdHJlYW0gPSBudWxsOworICAgICAgICAgICAgICAgICAgICBfaXNQZW5kaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNDbGllbnRQZW5kaW5nKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIF9pc1BlbmRpbmc7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgRW5zdXJlUGlwZUluc3RhbmNlKCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKF9zdHJlYW0gPT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgZGlyZWN0aW9uID0gUGlwZURpcmVjdGlvbi5Jbk91dDsKKyAgICAgICAgICAgICAgICB2YXIgbWF4Y29ubiA9IDI1NDsKKyAgICAgICAgICAgICAgICB2YXIgbW9kZSA9IFBpcGVUcmFuc21pc3Npb25Nb2RlLkJ5dGU7CisgICAgICAgICAgICAgICAgdmFyIG9wdGlvbnMgPSBfYXN5bmNNb2RlID8gUGlwZU9wdGlvbnMuQXN5bmNocm9ub3VzIDogUGlwZU9wdGlvbnMuTm9uZTsKKyAgICAgICAgICAgICAgICB2YXIgaW5idWYgPSA0MDk2OworICAgICAgICAgICAgICAgIHZhciBvdXRidWYgPSA0MDk2OworICAgICAgICAgICAgICAgIC8vIFRPRE86IHNlY3VyaXR5CisKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9zdHJlYW0gPSBuZXcgTmFtZWRQaXBlU2VydmVyU3RyZWFtKF9waXBlQWRkcmVzcywgZGlyZWN0aW9uLCBtYXhjb25uLCBtb2RlLCBvcHRpb25zLCBpbmJ1Ziwgb3V0YnVmKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKE5vdEltcGxlbWVudGVkRXhjZXB0aW9uKSAvLyBNb25vIHN0aWxsIGRvZXMgbm90IHN1cHBvcnQgYXN5bmMsIGZhbGxiYWNrIHRvIHN5bmMKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChfYXN5bmNNb2RlKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zICY9ICh+UGlwZU9wdGlvbnMuQXN5bmNocm9ub3VzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIF9zdHJlYW0gPSBuZXcgTmFtZWRQaXBlU2VydmVyU3RyZWFtKF9waXBlQWRkcmVzcywgZGlyZWN0aW9uLCBtYXhjb25uLCBtb2RlLCBvcHRpb25zLCBpbmJ1ZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRidWYpOworICAgICAgICAgICAgICAgICAgICAgICAgX2FzeW5jTW9kZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgYXN5bmMgVGFzazxUQ2xpZW50VHJhbnNwb3J0PiBBY2NlcHRJbXBsZW1lbnRhdGlvbkFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICB7CisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBFbnN1cmVQaXBlSW5zdGFuY2UoKTsKKworICAgICAgICAgICAgICAgIGF3YWl0IF9zdHJlYW0uV2FpdEZvckNvbm5lY3Rpb25Bc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgICAgICB2YXIgdHJhbnMgPSBuZXcgU2VydmVyVHJhbnNwb3J0KF9zdHJlYW0pOworICAgICAgICAgICAgICAgIF9zdHJlYW0gPSBudWxsOyAvLyBwYXNzIG93bmVyc2hpcCB0byBTZXJ2ZXJUcmFuc3BvcnQKKworICAgICAgICAgICAgICAgIC8vX2lzUGVuZGluZyA9IGZhbHNlOworCisgICAgICAgICAgICAgICAgcmV0dXJuIHRyYW5zOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ2xvc2UoKTsKKyAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDbG9zZSgpOworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCBlLk1lc3NhZ2UpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBjbGFzcyBTZXJ2ZXJUcmFuc3BvcnQgOiBUQ2xpZW50VHJhbnNwb3J0CisgICAgICAgIHsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgTmFtZWRQaXBlU2VydmVyU3RyZWFtIF9zdHJlYW07CisKKyAgICAgICAgICAgIHB1YmxpYyBTZXJ2ZXJUcmFuc3BvcnQoTmFtZWRQaXBlU2VydmVyU3RyZWFtIHN0cmVhbSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBfc3RyZWFtID0gc3RyZWFtOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYm9vbCBJc09wZW4gPT4gX3N0cmVhbSAhPSBudWxsICYmIF9zdHJlYW0uSXNDb25uZWN0ZWQ7CisKKyAgICAgICAgICAgIHB1YmxpYyBvdmVycmlkZSBhc3luYyBUYXNrIE9wZW5Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZChjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX3N0cmVhbT8uRGlzcG9zZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgYXN5bmMgVGFzazxpbnQ+IFJlYWRBc3luYyhieXRlW10gYnVmZmVyLCBpbnQgb2Zmc2V0LCBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgICAgIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfc3RyZWFtID09IG51bGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdGlvblR5cGUuTm90T3Blbik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IF9zdHJlYW0uUmVhZEFzeW5jKGJ1ZmZlciwgb2Zmc2V0LCBsZW5ndGgsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIG92ZXJyaWRlIGFzeW5jIFRhc2sgV3JpdGVBc3luYyhieXRlW10gYnVmZmVyLCBpbnQgb2Zmc2V0LCBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgICAgIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChfc3RyZWFtID09IG51bGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2Vwd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gICAgfQorCisgICAgICAgIHB1YmxpYyBUU2VydmVyRnJhbWVkVHJhbnNwb3J0KGludCBwb3J0KQorICAgICAgICAgICAgOiB0aGlzKHBvcnQsIDApCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUU2VydmVyRnJhbWVkVHJhbnNwb3J0KGludCBwb3J0LCBpbnQgY2xpZW50VGltZW91dCkKKyAgICAgICAgeworICAgICAgICAgICAgX3BvcnQgPSBwb3J0OworICAgICAgICAgICAgX2NsaWVudFRpbWVvdXQgPSBjbGllbnRUaW1lb3V0OworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gTWFrZSBzZXJ2ZXIgc29ja2V0CisgICAgICAgICAgICAgICAgX3NlcnZlciA9IG5ldyBUY3BMaXN0ZW5lcihJUEFkZHJlc3MuQW55LCBfcG9ydCk7CisgICAgICAgICAgICAgICAgX3NlcnZlci5TZXJ2ZXIuTm9EZWxheSA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9zZXJ2ZXIgPSBudWxsOworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJDb3VsZCBub3QgY3JlYXRlIFNlcnZlclNvY2tldCBvbiBwb3J0ICIgKyBwb3J0ICsgIi4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIExpc3RlbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIE1ha2Ugc3VyZSBub3QgdG8gYmxvY2sgb24gYWNjZXB0CisgICAgICAgICAgICBpZiAoX3NlcnZlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX3NlcnZlci5TdGFydCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoU29ja2V0RXhjZXB0aW9uIHN4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIkNvdWxkIG5vdCBhY2NlcHQgb24gbGlzdGVuaW5nIHNvY2tldDogIiArIHN4Lk1lc3NhZ2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIElzQ2xpZW50UGVuZGluZygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBfc2VydmVyLlBlbmRpbmcoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBvdmVycmlkZSBhc3luYyBUYXNrPFRDbGllbnRUcmFuc3BvcnQ+IEFjY2VwdEltcGxlbWVudGF0aW9uQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8VENsaWVudFRyYW5zcG9ydD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoX3NlcnZlciA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiTm8gdW5kZXJseWluZyBzZXJ2ZXIgc29ja2V0LiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBURnJhbWVkQ2xpZW50VHJhbnNwb3J0IHRTb2NrZXRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICAgICAgICAgIHZhciB0Y3BDbGllbnQgPSBhd2FpdCBfc2VydmVyLkFjY2VwdFRjcENsaWVudEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRTb2NrZXRUcmFuc3BvcnQgPSBuZXcgVEZyYW1lZENsaWVudFRyYW5zcG9ydChuZXcgVFNvY2tldENsaWVudFRyYW5zcG9ydCh0Y3BDbGllbnQpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFRpbWVvdXQgPSBfY2xpZW50VGltZW91dAorICAgICAgICAgICAgICAgICAgICB9KTsKKworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFNvY2tldFRyYW5zcG9ydDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICh0U29ja2V0VHJhbnNwb3J0ICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRTb2NrZXRUcmFuc3BvcnQuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgLy8gIE90aGVyd2lzZSwgY2xlYW4gaXQgdXAgb3Vyc2VsdmVzLgorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAoKElEaXNwb3NhYmxlKSB0Y3BDbGllbnQpLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oZXguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChfc2VydmVyICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfc2VydmVyLlN0b3AoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJXQVJOSU5HOiBDb3VsZCBub3QgY2xvc2Ugc2VydmVyIHNvY2tldDogIiArIGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgX3NlcnZlciA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvU2VydmVyL1RTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVHJhbnNwb3J0cy9TZXJ2ZXIvVFNlcnZlclNvY2tldFRyYW5zcG9ydC5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4zYTlkOGExCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvU2VydmVyL1RTZ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XN0ZW5lcjsKKyAgICAgICAgICAgIF9jbGllbnRUaW1lb3V0ID0gY2xpZW50VGltZW91dDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUU2VydmVyU29ja2V0VHJhbnNwb3J0KGludCBwb3J0KQorICAgICAgICAgICAgOiB0aGlzKHBvcnQsIDApCisgICAgICAgIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUU2VydmVyU29ja2V0VHJhbnNwb3J0KGludCBwb3J0LCBpbnQgY2xpZW50VGltZW91dCkKKyAgICAgICAgICAgIDogdGhpcyhwb3J0LCBjbGllbnRUaW1lb3V0LCBmYWxzZSkKKyAgICAgICAgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQoaW50IHBvcnQsIGludCBjbGllbnRUaW1lb3V0LCBib29sIHVzZUJ1ZmZlcmVkU29ja2V0cyk6CisgICAgICAgICAgICB0aGlzKHBvcnQsIGNsaWVudFRpbWVvdXQsIHVzZUJ1ZmZlcmVkU29ja2V0cywgZmFsc2UpCisgICAgICAgIHsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIFRTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQoaW50IHBvcnQsIGludCBjbGllbnRUaW1lb3V0LCBib29sIHVzZUJ1ZmZlcmVkU29ja2V0cywgYm9vbCB1c2VGcmFtZWRUcmFuc3BvcnQpCisgICAgICAgIHsKKyAgICAgICAgICAgIF9wb3J0ID0gcG9ydDsKKyAgICAgICAgICAgIF9jbGllbnRUaW1lb3V0ID0gY2xpZW50VGltZW91dDsKKyAgICAgICAgICAgIF91c2VCdWZmZXJlZFNvY2tldHMgPSB1c2VCdWZmZXJlZFNvY2tldHM7CisgICAgICAgICAgICBfdXNlRnJhbWVkVHJhbnNwb3J0ID0gdXNlRnJhbWVkVHJhbnNwb3J0OworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gTWFrZSBzZXJ2ZXIgc29ja2V0CisgICAgICAgICAgICAgICAgX3NlcnZlciA9IG5ldyBUY3BMaXN0ZW5lcihJUEFkZHJlc3MuQW55LCBfcG9ydCk7CisgICAgICAgICAgICAgICAgX3NlcnZlci5TZXJ2ZXIuTm9EZWxheSA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIF9zZXJ2ZXIgPSBudWxsOworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJDb3VsZCBub3QgY3JlYXRlIFNlcnZlclNvY2tldCBvbiBwb3J0ICIgKyBwb3J0ICsgIi4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIExpc3RlbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIC8vIE1ha2Ugc3VyZSBub3QgdG8gYmxvY2sgb24gYWNjZXB0CisgICAgICAgICAgICBpZiAoX3NlcnZlciAhPSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgX3NlcnZlci5TdGFydCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoU29ja2V0RXhjZXB0aW9uIHN4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oIkNvdWxkIG5vdCBhY2NlcHQgb24gbGlzdGVuaW5nIHNvY2tldDogIiArIHN4Lk1lc3NhZ2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSBib29sIElzQ2xpZW50UGVuZGluZygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBfc2VydmVyLlBlbmRpbmcoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCBvdmVycmlkZSBhc3luYyBUYXNrPFRDbGllbnRUcmFuc3BvcnQ+IEFjY2VwdEltcGxlbWVudGF0aW9uQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChjYW5jZWxsYXRpb25Ub2tlbi5Jc0NhbmNlbGxhdGlvblJlcXVlc3RlZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8VENsaWVudFRyYW5zcG9ydD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoX3NlcnZlciA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uRXhjZXB0aW9uVHlwZS5Ob3RPcGVuLCAiTm8gdW5kZXJseWluZyBzZXJ2ZXIgc29ja2V0LiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBUQ2xpZW50VHJhbnNwb3J0IHRTb2NrZXRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICAgICAgICAgIHZhciB0Y3BDbGllbnQgPSBhd2FpdCBfc2VydmVyLkFjY2VwdFRjcENsaWVudEFzeW5jKCk7CisKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRTb2NrZXRUcmFuc3BvcnQgPSBuZXcgVFNvY2tldENsaWVudFRyYW5zcG9ydCh0Y3BDbGllbnQpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFRpbWVvdXQgPSBfY2xpZW50VGltZW91dAorICAgICAgICAgICAgICAgICAgICB9OworCisgICAgICAgICAgICAgICAgICAgIGlmIChfdXNlQnVmZmVyZWRTb2NrZXRzKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0U29ja2V0VHJhbnNwb3J0ID0gbmV3IFRCdWZmZXJlZENsaWVudFRyYW5zcG9ydCh0U29ja2V0VHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChfdXNlRnJhbWVkVHJhbnNwb3J0KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0U29ja2V0VHJhbnNwb3J0ID0gbmV3IFRGcmFtZWRDbGllbnRUcmFuc3BvcnQodFNvY2tldFRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFNvY2tldFRyYW5zcG9ydDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmICh0U29ja2V0VHJhbnNwb3J0ICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRTb2NrZXRUcmFuc3BvcnQuRGlzcG9zZSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgLy8gIE90aGVyd2lzZSwgY2xlYW4gaXQgdXAgb3Vyc2VsdmVzLgorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAoKElEaXNwb3NhYmxlKSB0Y3BDbGllbnQpLkRpc3Bvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oZXguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgb3ZlcnJpZGUgdm9pZCBDbG9zZSgpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChfc2VydmVyICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfc2VydmVyLlN0b3AoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKCJXQVJOSU5HOiBDb3VsZCBub3QgY2xvc2Ugc2VydmVyIHNvY2tldDogIiArIGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgX3NlcnZlciA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQpkaWZmIC0tZ2l0IGEvbGliL25ldGNvcmUvVGhyaWZ0L1RyYW5zcG9ydHMvU2VydmVyL1RUbHNTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVHJhbnNwb3J0cy9TZXJ2ZXIvVFRsc1NlcnZlclNvY2tldFRyYW5zcG9ydC5jcwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi43NTlmZWVkCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25ldGNvcmUvV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LAorICAgICAgICAgICAgICAgIGNsaWVudENlcnRWYWxpZGF0b3IsIGxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjaywgc3NsUHJvdG9jb2xzKQorICAgICAgICB7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBUVGxzU2VydmVyU29ja2V0VHJhbnNwb3J0KAorICAgICAgICAgICAgaW50IHBvcnQsCisgICAgICAgICAgICBib29sIHVzZUJ1ZmZlcmVkU29ja2V0cywKKyAgICAgICAgICAgIGJvb2wgdXNlRnJhbWVkVHJhbnNwb3J0LAorICAgICAgICAgICAgWDUwOUNlcnRpZmljYXRlMiBjZXJ0aWZpY2F0ZSwKKyAgICAgICAgICAgIFJlbW90ZUNlcnRpZmljYXRlVmFsaWRhdGlvbkNhbGxiYWNrIGNsaWVudENlcnRWYWxpZGF0b3IgPSBudWxsLAorICAgICAgICAgICAgTG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrIGxvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayA9IG51bGwsCisgICAgICAgICAgICBTc2xQcm90b2NvbHMgc3NsUHJvdG9jb2xzID0gU3NsUHJvdG9jb2xzLlRsczEyKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIWNlcnRpZmljYXRlLkhhc1ByaXZhdGVLZXkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLlVua25vd24sCisgICAgICAgICAgICAgICAgICAgICJZb3VyIHNlcnZlci1jZXJ0aWZpY2F0ZSBuZWVkcyB0byBoYXZlIGEgcHJpdmF0ZSBrZXkiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgX3BvcnQgPSBwb3J0OworICAgICAgICAgICAgX3NlcnZlckNlcnRpZmljYXRlID0gY2VydGlmaWNhdGU7CisgICAgICAgICAgICBfdXNlQnVmZmVyZWRTb2NrZXRzID0gdXNlQnVmZmVyZWRTb2NrZXRzOworICAgICAgICAgICAgX3VzZUZyYW1lZFRyYW5zcG9ydCA9IHVzZUZyYW1lZFRyYW5zcG9ydDsKKyAgICAgICAgICAgIF9jbGllbnRDZXJ0VmFsaWRhdG9yID0gY2xpZW50Q2VydFZhbGlkYXRvcjsKKyAgICAgICAgICAgIF9sb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2sgPSBsb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2s7CisgICAgICAgICAgICBfc3NsUHJvdG9jb2xzID0gc3NsUHJvdG9jb2xzOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyBDcmVhdGUgc2VydmVyIHNvY2tldAorICAgICAgICAgICAgICAgIF9zZXJ2ZXIgPSBuZXcgVGNwTGlzdGVuZXIoSVBBZGRyZXNzLkFueSwgX3BvcnQpOworICAgICAgICAgICAgICAgIF9zZXJ2ZXIuU2VydmVyLk5vRGVsYXkgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBfc2VydmVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigkIkNvdWxkIG5vdCBjcmVhdGUgU2VydmVyU29ja2V0IG9uIHBvcnQge3BvcnR9LiIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIHZvaWQgTGlzdGVuKCkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gTWFrZSBzdXJlIGFjY2VwdCBpcyBub3QgYmxvY2tpbmcKKyAgICAgICAgICAgIGlmIChfc2VydmVyICE9IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBfc2VydmVyLlN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChTb2NrZXRFeGNlcHRpb24gc3gpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigkIkNvdWxkIG5vdCBhY2NlcHQgb24gbGlzdGVuaW5nIHNvY2tldDoge3N4Lk1lc3NhZ2V9Iik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIG92ZXJyaWRlIGJvb2wgSXNDbGllbnRQZW5kaW5nKCkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIF9zZXJ2ZXIuUGVuZGluZygpOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIGFzeW5jIFRhc2s8VENsaWVudFRyYW5zcG9ydD4gQWNjZXB0SW1wbGVtZW50YXRpb25Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGNhbmNlbGxhdGlvblRva2VuLklzQ2FuY2VsbGF0aW9uUmVxdWVzdGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBUYXNrLkZyb21DYW5jZWxlZDxUQ2xpZW50VHJhbnNwb3J0PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChfc2VydmVyID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oVFRyYW5zcG9ydEV4Y2VwdGlvbi5FeGNlcHRpb25UeXBlLk5vdE9wZW4sICJObyB1bmRlcmx5aW5nIHNlcnZlciBzb2NrZXQuIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBjbGllbnQgPSBhd2FpdCBfc2VydmVyLkFjY2VwdFRjcENsaWVudEFzeW5jKCk7CisgICAgICAgICAgICAgICAgY2xpZW50LlNlbmRUaW1lb3V0ID0gY2xpZW50LlJlY2VpdmVUaW1lb3V0ID0gX2NsaWVudFRpbWVvdXQ7CisKKyAgICAgICAgICAgICAgICAvL3dyYXAgdGhlIGNsaWVudCBpbiBhbiBTU0wgU29ja2V0IHBhc3NpbmcgaW4gdGhlIFNTTCBjZXJ0CisgICAgICAgICAgICAgICAgdmFyIHRUbHNTb2NrZXQgPSBuZXcgVFRsc1NvY2tldENsaWVudFRyYW5zcG9ydChjbGllbnQsIF9zZXJ2ZXJDZXJ0aWZpY2F0ZSwgdHJ1ZSwgX2NsaWVudENlcnRWYWxpZGF0b3IsCisgICAgICAgICAgICAgICAgICAgIF9sb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2ssIF9zc2xQcm90b2NvbHMpOworCisgICAgICAgICAgICAgICAgYXdhaXQgdFRsc1NvY2tldC5TZXR1cFRsc0FzeW5jKCk7CisKKyAgICAgICAgICAgICAgICBUQ2xpZW50VHJhbnNwb3J0IHRyYW5zID0gdFRsc1NvY2tldDsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBpZiAoX3VzZUJ1ZmZlcmVkU29ja2V0cykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRCdWZmZXJlZENsaWVudFRyYW5zcG9ydCh0cmFucyk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKF91c2VGcmFtZWRUcmFuc3BvcnQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBURnJhbWVkQ2xpZW50VHJhbnNwb3J0KHRyYW5zKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgcmV0dXJuIHRyYW5zOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihleC5Ub1N0cmluZygpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBvdmVycmlkZSB2b2lkIENsb3NlKCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKF9zZXJ2ZXIgIT0gbnVsbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIF9zZXJ2ZXIuU3RvcCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJCJXQVJOSU5HOiBDb3VsZCBub3QgY2xvc2Ugc2VydmVyIHNvY2tldDoge2V4fSIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIF9zZXJ2ZXIgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2xpYi9uZXRjb3JlL1RocmlmdC9UcmFuc3BvcnRzL1RDbGllbnRUcmFuc3BvcnQuY3MgYi9saWIvbmV0Y29yZS9UaHJpZnQvVHJhbnNwb3J0cy9UQ2xpZW50VHJhbnNwb3J0LmNzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDA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l0ZSByZWFkIGJ1dCBub3QgY29uc3VtZWQsIGRvIG5vdGhpbmcuCisgICAgICAgICAgICBpZiAoX2hhc1BlZWtCeXRlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvL0lmIHRyYW5zcG9ydCBjbG9zZWQgd2UgY2FuJ3QgcGVlay4KKyAgICAgICAgICAgIGlmICghSXNPcGVuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy9UcnkgdG8gcmVhZCBvbmUgYnl0ZS4gSWYgc3VjY2VlZHMgd2Ugd2lsbCBuZWVkIHRvIHN0b3JlIGl0IGZvciB0aGUgbmV4dCByZWFkLgorICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGJ5dGVzID0gYXdhaXQgUmVhZEFzeW5jKF9wZWVrQnVmZmVyLCAwLCAxLCBjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgaWYgKGJ5dGVzID09IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKElPRXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgX2hhc1BlZWtCeXRlID0gdHJ1ZTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZpcnR1YWwgYXN5bmMgVGFzayBPcGVuQXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICBhd2FpdCBPcGVuQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYWJzdHJhY3QgVGFzayBPcGVuQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIENsb3NlKCk7CisKKyAgICAgICAgcHJvdGVjdGVkIHN0YXRpYyB2b2lkIFZhbGlkYXRlQnVmZmVyQXJncyhieXRlW10gYnVmZmVyLCBpbnQgb2Zmc2V0LCBpbnQgbGVuZ3RoKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoYnVmZmVyID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50TnVsbEV4Y2VwdGlvbihuYW1lb2YoYnVmZmVyKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmd1bWVudE91dE9mUmFuZ2VFeGNlcHRpb24obmFtZW9mKG9mZnNldCksICJCdWZmZXIgb2Zmc2V0IGlzIHNtYWxsZXIgdGhhbiB6ZXJvLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobGVuZ3RoIDwgMCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJndW1lbnRPdXRPZlJhbmdlRXhjZXB0aW9uKG5hbWVvZihsZW5ndGgpLCAiQnVmZmVyIGxlbmd0aCBpcyBzbWFsbGVyIHRoYW4gemVyby4iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG9mZnNldCArIGxlbmd0aCA+IGJ1ZmZlci5MZW5ndGgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyZ3VtZW50T3V0T2ZSYW5nZUV4Y2VwdGlvbihuYW1lb2YoYnVmZmVyKSwgIk5vdCBlbm91Z2ggZGF0Y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gICAgICB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbUNhbmNlbGVkPGludD4oY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2YXIgcmV0cmlldmVkID0gMDsKKworICAgICAgICAgICAgLy9JZiB3ZSBwcmV2aW91c2x5IHBlZWtlZCBhIGJ5dGUsIHdlIG5lZWQgdG8gdXNlIHRoYXQgZmlyc3QuCisgICAgICAgICAgICBpZiAoX2hhc1BlZWtCeXRlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQgKyByZXRyaWV2ZWQrK10gPSBfcGVla0J1ZmZlclswXTsKKyAgICAgICAgICAgICAgICBfaGFzUGVla0J5dGUgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd2hpbGUgKHJldHJpZXZlZCA8IGxlbmd0aCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoY2FuY2VsbGF0aW9uVG9rZW4uSXNDYW5jZWxsYXRpb25SZXF1ZXN0ZWQpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgVGFzay5Gcm9tQ2FuY2VsZWQ8aW50PihjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdmFyIHJldHVybmVkQ291bnQgPSBhd2FpdCBSZWFkQXN5bmMoYnVmZmVyLCBvZmZzZXQgKyByZXRyaWV2ZWQsIGxlbmd0aCAtIHJldHJpZXZlZCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIGlmIChyZXR1cm5lZENvdW50IDw9IDApCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLkV4Y2VwdG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ICAgICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIENsb3NlKCk7CisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBib29sIElzQ2xpZW50UGVuZGluZygpOworCisgICAgICAgIHByb3RlY3RlZCB2aXJ0dWFsIGFzeW5jIFRhc2s8VENsaWVudFRyYW5zcG9ydD4gQWNjZXB0SW1wbGVtZW50YXRpb25Bc3luYygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBhd2FpdCBBY2NlcHRJbXBsZW1lbnRhdGlvbkFzeW5jKENhbmNlbGxhdGlvblRva2VuLk5vbmUpOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIGFic3RyYWN0IFRhc2s8VENsaWVudFRyYW5zcG9ydD4gQWNjZXB0SW1wbGVtZW50YXRpb25Bc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8VENsaWVudFRyYW5zcG9ydD4gQWNjZXB0QXN5bmMoKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gYXdhaXQgQWNjZXB0QXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYXN5bmMgVGFzazxUQ2xpZW50VHJhbnNwb3J0PiBBY2NlcHRBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRyYW5zcG9ydCA9IGF3YWl0IEFjY2VwdEltcGxlbWVudGF0aW9uQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICBpZiAodHJhbnNwb3J0ID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJCJ7bmFtZW9mKEFjY2VwdEltcGxlbWVudG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ICAgICAgICAgICAgICAgICAJCisgICAgcHJvY2Vzc29yOiBoZWxsb1N2YywgICAgICAgICAgICAgICAgICAgICAgICAgCQorICAgIHByb3RvY29sOiB0aHJpZnQuVEpTT05Qcm90b2NvbCwgICAgICAgICAgICAgICAgIAorICAgIHRyYW5zcG9ydDogdGhyaWZ0LlRCdWZmZXJlZFRyYW5zcG9ydCAJCQorfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCisKKy8vU2VydmVyT3B0aW9uczogRGVmaW5lIHNlcnZlciBmZWF0dXJlcwordmFyIHNlcnZlck9wdCA9IHsgICAgICAgICAgICAgICAgICAgICAgICAgIAkKKyAgIHNlcnZpY2VzOiB7ICAgICAgICAgICAgICAgICAgICAgICAgIAorICAgICAgIi9oZWxsbyI6IGhlbGxvU3ZjT3B0ICAgICAgICAgICAgICAgICAKKyAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCit9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKKworLy9DcmVhdGUgYW5kIHN0YXJ0IHRoZSB3ZWIgc2VydmVyIAordmFyIHBvcnQgPSA5MDkwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAJCQordGhyaWZ0LmNyZWF0ZVdlYlNlcnZlcihzZXJ2ZXJPcHQpLmxpc3Rlbihwb3J0KTsgICAgICAgICAgICAgICAgICAgICAgICAJCQorY29uc29sZS5sb2coIkh0dHAvVGhyaWZ0IFNlcnZlciBydW5uaW5nIG9uIHBvcnQ6ICIgKyBwb3J0KTsKKwpkaWZmIC0tZ2l0IGEvbGliL25vZGVqcy9leGFtcGxlcy9odHRwU2VydmVyLnB5IGIvbGliL25vZGVqcy9leGFtcGxlcy9odHRwU2VydmVyLnB5Cm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmI3MTJmY2QKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvbm9kZWpzL2V4YW1wbGVzL2h0dHBTZXJ2ZXIucH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SB7CisgIHN3aXRjaCAodHlwZSkgeworICAgIGNhc2UgVHlwZS5TVE9QOgorICAgICAgcmV0dXJuOworICAgIGNhc2UgVHlwZS5CT09MOgorICAgICAgdGhpcy5yZWFkQm9vbCgpOworICAgICAgYnJlYWs7CisgICAgY2FzZSBUeXBlLkJZVEU6CisgICAgICB0aGlzLnJlYWRCeXRlKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuSTE2OgorICAgICAgdGhpcy5yZWFkSTE2KCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuSTMyOgorICAgICAgdGhpcy5yZWFkSTMyKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuSTY0OgorICAgICAgdGhpcy5yZWFkSTY0KCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuRE9VQkxFOgorICAgICAgdGhpcy5yZWFkRG91YmxlKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuU1RSSU5HOgorICAgICAgdGhpcy5yZWFkU3RyaW5nKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuU1RSVUNUOgorICAgICAgdGhpcy5yZWFkU3RydWN0QmVnaW4oKTsKKyAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIHZhciByID0gdGhpcy5yZWFkRmllbGRCZWdpbigpOworICAgICAgICBpZiAoci5mdHlwZSA9PT0gVHlwZS5TVE9QKSB7CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgdGhpcy5za2lwKHIuZnR5cGUpOworICAgICAgICB0aGlzLnJlYWRGaWVsZEVuZCgpOworICAgICAgfQorICAgICAgdGhpcy5yZWFkU3RydWN0RW5kKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuTUFQOgorICAgICAgdmFyIG1hcEJlZ2luID0gdGhpcy5yZWFkTWFwQmVnaW4oKTsKKyAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbWFwQmVnaW4uc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lzLmxhc3RGaWVsZF8gPSBbXTsKKyAgdGhpcy5sYXN0RmllbGRJZF8gPSAwOworICB0aGlzLnN0cmluZ19saW1pdF8gPSAwOworICB0aGlzLnN0cmluZ19idWZfID0gbnVsbDsKKyAgdGhpcy5zdHJpbmdfYnVmX3NpemVfID0gMDsKKyAgdGhpcy5jb250YWluZXJfbGltaXRfID0gMDsKKyAgdGhpcy5ib29sZWFuRmllbGRfID0geworICAgIG5hbWU6IG51bGwsCisgICAgaGFzQm9vbFZhbHVlOiBmYWxzZQorICB9OworICB0aGlzLmJvb2xWYWx1ZV8gPSB7CisgICAgaGFzQm9vbFZhbHVlOiBmYWxzZSwKKyAgICBib29sVmFsdWU6IGZhbHNlCisgIH07Cit9OworCisKKy8vCisvLyBDb21wYWN0IFByb3RvY29sIENvbnN0YW50cworLy8KKworLyoqCisgICogQ29tcGFjdCBQcm90b2NvbCBJRCBudW1iZXIuCisgICogQHJlYWRvbmx5CisgICogQGNvbnN0IHtudW1iZXJ9IFBST1RPQ09MX0lECisgICovCitUQ29tcGFjdFByb3RvY29sLlBST1RPQ09MX0lEID0gLTEyNjsgIC8vMTAwMCAwMDEwCisKKy8qKgorICAqIENvbXBhY3QgUHJvdG9jb2wgdmVyc2lvbiBudW1iZXIuCisgICogQHJlYWRvbmx5CisgICogQGNvbnN0IHtudW1iZXJ9IFZFUlNJT05fTgorICAqLworVENvbXBhY3RQcm90b2NvbC5WRVJTSU9OX04gPSAxOworCisvKioKKyAgKiBDb21wYWN0IFByb3RvY29sIHZlcnNpb24gbWFzayBmb3IgY29tYmluaW5nIHByb3RvY29sIHZlcnNpb24gYW5kIG1lc3NhZ2UgdHlwZSBpbiBvbmUgYnl0ZS4KKyAgKiBAcmVhZG9ubHkKKyAgKiBAY29uc3Qge251bWJlcn0gVkVSU0lPTl9NQVNLCisgICovCitUQ29tcGFjdFByb3RvY29sLlZFUlNJT05fTUFTSyA9IDB4MWY7IC8vMDAwMSAxMTExCisKKy8qKgorICAqIENvbX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dmUtYXJyYXkvZGljdGlvbmFyeSkuCisgKiBAcHJvcGVydHkge251bWJlcn0gIENUX1NUUlVDVCAgICAgICAgLSBBIG11bHRpZmllbGQgdHlwZS4KKyAqLworVENvbXBhY3RQcm90b2NvbC5UeXBlcyA9IHsKKyAgQ1RfU1RPUDogICAgICAgICAgIDB4MDAsCisgIENUX0JPT0xFQU5fVFJVRTogICAweDAxLAorICBDVF9CT09MRUFOX0ZBTFNFOiAgMHgwMiwKKyAgQ1RfQllURTogICAgICAgICAgIDB4MDMsCisgIENUX0kxNjogICAgICAgICAgICAweDA0LAorICBDVF9JMzI6ICAgICAgICAgICAgMHgwNSwKKyAgQ1RfSTY0OiAgICAgICAgICAgIDB4MDYsCisgIENUX0RPVUJMRTogICAgICAgICAweDA3LAorICBDVF9CSU5BUlk6ICAgICAgICAgMHgwOCwKKyAgQ1RfTElTVDogICAgICAgICAgIDB4MDksCisgIENUX1NFVDogICAgICAgICAgICAweDBBLAorICBDVF9NQVA6ICAgICAgICAgICAgMHgwQiwKKyAgQ1RfU1RSVUNUOiAgICAgICAgIDB4MEMKK307CisKKy8qKgorICogQXJyYXkgbWFwcGluZyBDb21wYWN0IHR5cGUgSURzIHRvIHN0YW5kYXJkIFRocmlmdCB0eXBlIElEcy4KKyAqIEByZWFkb25seQorICovCitUQ29tcGFjdFByb3RvY29sLlRUeXBlVG9DVHlwZSA9IFsKKyAgVENvbXBhY3RQcm90b2NvbC5UeXBlcy5DVF9TVE9QLCAgICAgICAgIC8vIFRfU1RPUAorICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdW51c2VkCisgIFRDb21wYWN0UHJvdG9jb2wuVHlwZXMuQ1RfQk9PTEVBTl9UUlVFLCAvLyBUX0JPT0wKKyAgVENvbXBhY3RQcm90b2NvbC5UeXBlcy5DVF9CWVRFLCAgICAgICAgIC8vIFRfQllURQorICBUQ29tcGFjdFByb3RvY29sLlR5cGVzLkNUX0RPVUJMRSwgICAgICAgLy8gVF9ET1VCTEUKKyAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVudXNlZAorICBUQ29tcGFjdFByb3RvY29sLlR5cGVzLkNUX0kxNiwgICAgICAgICAgLy8gVF9JMTYKKyAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVudXNlZAorICBUQ29tcGFjdFByb3RvY29sLlR5cGVzLkNUX0kzMiwgICAgICAgICAgLy8gVF9JMzIKKyAgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHVudXNlZAorICBUQ29tcGFjdFByb3RvY29sLlR5cGVzLkNUX0k2NCwgICAgICAgICAgLy8gVF9JNjQKKyAgVENvbXBhY3RQcm90b2NvbC5UeXBlcy5DVF9CSU5BUlksICAgICAgIC8vIFRfU1RSSU5HCisgIFRDb21wYWN0UHJvdG9jb2wuVHlwZXMuQ1RfU1RSVUNULCAgICAgICAvLyBUX1NUUlVDVAorICBUQ29tcGFjdFByb3RvY29sLlR5cGVzLkNUX01BUCwgICAgICAgICAgLy8gVF9NQVAKKyAgVENvbXBhY3RQcm90b2NvbC5UeXBlcy5DVF9TRVQsICAgICAgICAgIC8vIFRfU0VUCisgIFRDb21wYWN0UHJvdG9jb2wuVHlwZXMuQ1RfTElTVCwgICAgICAgICAvLyBUX0xJU1QKK107CisKKworLy8KKy8vIENvbXBhY3QgUHJvdG9jb2wgVXRpbGl0aWVzCisvLworCisvKioKKyAqIFJldHVybnMgdGhlIHVuZGVybHlpbmcgdHJhbnNwb3J0IGxheWVyLgorICogQHJldHVybiB7b2JqZWN0fSBUaGUgdW5kZXJseWluZyB0cmFuc3BvcnQgbGF5ZXIuCisgKi9UQ29tcGFjdFByb3RvY29sLnByb3RvdHlwZS5nZXRUcmFuc3BvcnQgPSBmdW5jdGlvbigpIHsKKyAgcmV0dXJuIHRoaXMudHJhbnM7Cit9OworCisvKioKKyAqIExvb2t1cCBhIENvbXBhY3Q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aGlzLndyaXRlU3RyaW5nT3JCaW5hcnkoJ3dyaXRlQmluYXJ5JywgJ2JpbmFyeScsIGFyZyk7Cit9OworCisKKy8vCisvLyBDb21wYWN0IFByb3RvY29sIGludGVybmFsIHdyaXRlIG1ldGhvZHMKKy8vCisKK1RDb21wYWN0UHJvdG9jb2wucHJvdG90eXBlLndyaXRlRmllbGRCZWdpbkludGVybmFsID0gZnVuY3Rpb24obmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlT3ZlcnJpZGUpIHsKKyAgLy9JZiB0aGVyZSdzIGEgdHlwZSBvdmVycmlkZSwgdXNlIHRoYXQuCisgIHZhciB0eXBlVG9Xcml0ZSA9ICh0eXBlT3ZlcnJpZGUgPT0gLTEgPyB0aGlzLmdldENvbXBhY3RUeXBlKGZpZWxkVHlwZSkgOiB0eXBlT3ZlcnJpZGUpOworICAvL0NoZWNrIGlmIHdlIGNhbiBkZWx0YSBlbmNvZGUgdGhlIGZpZWxkIGlkCisgIGlmIChmaWVsZElkID4gdGhpcy5sYXN0RmllbGRJZF8gJiYgZmllbGRJZCAtIHRoaXMubGFzdEZpZWxkSWRfIDw9IDE1KSB7CisgICAgLy9JbmNsdWRlIHRoZSB0eXBlIGRlbHRhIHdpdGggdGhlIGZpZWxkIElECisgICAgdGhpcy53cml0ZUJ5dGUoKGZpZWxkSWQgLSB0aGlzLmxhc3RGaWVsZElkXykgPDwgNCB8IHR5cGVUb1dyaXRlKTsKKyAgfSBlbHNlIHsKKyAgICAvL1dyaXRlIHNlcGFyYXRlIHR5cGUgYW5kIElEIHZhbHVlcworICAgIHRoaXMud3JpdG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A7CisgIHZhciBoaSA9IDA7CisgIHZhciBzaGlmdCA9IDA7CisgIHdoaWxlICh0cnVlKSB7CisgICAgdmFyIGIgPSB0aGlzLnRyYW5zLnJlYWRCeXRlKCk7CisgICAgcnNpemUgKys7CisgICAgaWYgKHNoaWZ0IDw9IDI1KSB7CisgICAgICBsbyA9IGxvIHwgKChiICYgMHg3ZikgPDwgc2hpZnQpOworICAgIH0gZWxzZSBpZiAoMjUgPCBzaGlmdCAmJiBzaGlmdCA8IDMyKSB7CisgICAgICBsbyA9IGxvIHwgKChiICYgMHg3ZikgPDwgc2hpZnQpOworICAgICAgaGkgPSBoaSB8ICgoYiAmIDB4N2YpID4+PiAoMzItc2hpZnQpKTsKKyAgICB9IGVsc2UgeworICAgICAgaGkgPSBoaSB8ICgoYiAmIDB4N2YpIDw8IChzaGlmdC0zMikpOworICAgIH0KKyAgICBzaGlmdCArPSA3OworICAgIGlmICghKGIgJiAweDgwKSkgeworICAgICAgYnJlYWs7CisgICAgfQorICAgIGlmIChyc2l6ZSA+PSAxMCkgeworICAgICAgdGhyb3cgbmV3IFRocmlmdC5UUHJvdG9jb2xFeGNlcHRpb24oVGhyaWZ0LlRQcm90b2NvbEV4Y2VwdGlvblR5cGUuSU5WQUxJRF9EQVRBLCAiVmFyaWFibGUtbGVuZ3RoIGludCBvdmVyIDEwIGJ5dGVzLiIpOworICAgIH0KKyAgfQorICByZXR1cm4gbmV3IEludDY0KGhpLCBsbyk7Cit9OworCisvKioKKyAqIENvbnZlcnQgZnJvbSB6aWd6YWcgaW50IHRvIGludC4KKyAqLworVENvbXBhY3RQcm90b2NvbC5wcm90b3R5cGUuemlnemFnVG9JMzIgPSBmdW5jdGlvbihuKSB7CisgIHJldHVybiAobiA+Pj4gMSkgXiAoLTEgKiAobiAmIDEpKTsKK307CisKKy8qKgorICogQ29udmVydCBmcm9tIHppZ3phZyBsb25nIHRvIGxvbmcuCisgKi8KK1RDb21wYWN0UHJvdG9jb2wucHJvdG90eXBlLnppZ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ICAgICB0aGlzLnJlYWREb3VibGUoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVHlwZS5TVFJJTkc6CisgICAgICB0aGlzLnJlYWRTdHJpbmcoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVHlwZS5TVFJVQ1Q6CisgICAgICB0aGlzLnJlYWRTdHJ1Y3RCZWdpbigpOworICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgdmFyIHIgPSB0aGlzLnJlYWRGaWVsZEJlZ2luKCk7CisgICAgICAgIGlmIChyLmZ0eXBlID09PSBUeXBlLlNUT1ApIHsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICB0aGlzLnNraXAoci5mdHlwZSk7CisgICAgICAgIHRoaXMucmVhZEZpZWxkRW5kKCk7CisgICAgICB9CisgICAgICB0aGlzLnJlYWRTdHJ1Y3RFbmQoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVHlwZS5NQVA6CisgICAgICB2YXIgbWFwQmVnaW4gPSB0aGlzLnJlYWRNYXBCZWdpbigpOworICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBtYXBCZWdpbi5zaXplOyArK2kpIHsKKyAgICAgICAgdGhpcy5za2lwKG1hcEJlZ2luLmt0eXBlKTsKKyAgICAgICAgdGhpcy5za2lwKG1hcEJlZ2luLnZ0eXBlKTsKKyAgICAgIH0KKyAgICAgIHRoaXMucmVhZE1hcEVuZCgpOworICAgICAgYnJlYWs7CisgICAgY2FzZSBUeXBlLlNFVDoKKyAgICAgIHZhciBzZXRCZWdpbiA9IHRoaXMucmVhZFNldEJlZ2luKCk7CisgICAgICBmb3IgKHZhciBpMiA9IDA7IGkyIDwgc2V0QmVnaW4uc2l6ZTsgKytpMikgeworICAgICAgICB0aGlzLnNraXAoc2V0QmVnaW4uZXR5cGUpOworICAgICAgfQorICAgICAgdGhpcy5yZWFkU2V0RW5kKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuTElTVD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ga2V5ZWQKKyAgICAgICAgLy8gIGhhc2ggb2YgY2xpZW50IG9iamVjdHMuCisgICAgICAgIC8vTk9URTogVGhlIDIgd2F5IGludGVyZGVwZW5kZW5jaWVzIGJldHdlZW4gcHJvdG9jb2xzLCB0cmFuc3BvcnRzLAorICAgICAgICAvLyAgY29ubmVjdGlvbnMgYW5kIGNsaWVudHMgaW4gdGhlIE5vZGUuanMgaW1wbGVtZW50YXRpb24gYXJlIGlycmVndWxhcgorICAgICAgICAvLyAgYW5kIG1ha2UgdGhlIGltcGxlbWVudGF0aW9uIGRpZmZpY3VsdCB0byBleHRlbmQgYW5kIG1haW50YWluLiBXZQorICAgICAgICAvLyAgc2hvdWxkIGJyaW5nIHRoaXMgc3R1ZmYgaW5saW5lIHdpdGggdHlwaWNhbCB0aHJpZnQgSS9PIHN0YWNrCisgICAgICAgIC8vICBvcGVyYXRpb24gc29vbi4KKyAgICAgICAgLy8gIC0tcmEKKyAgICAgICAgdmFyIHNlcnZpY2VfbmFtZSA9IHNlbGYuc2VxSWQyU2VydmljZVtoZWFkZXIucnNlcWlkXTsKKyAgICAgICAgaWYgKHNlcnZpY2VfbmFtZSkgeworICAgICAgICAgIGNsaWVudCA9IHNlbGYuY2xpZW50W3NlcnZpY2VfbmFtZV07CiAgICAgICAgIH0KLSAgICAgIH07Ci0gICAgICBjbGllbnRbJ3JlY3ZfJyArIGhlYWRlci5mbmFtZV0obWVzc2FnZSwgaGVhZGVyLm10eXBlLCBkdW1teV9zZXFpZCk7CisgICAgICAgIC8qanNoaW50IC1XMDgzICovCisgICAgICAgIGNsaWVudC5fcmVxc1tkdW1teV9zZXFpZF0gPSBmdW5jdGlvbihlcnIsIHN1Y2Nlc3MpeworICAgICAgICAgIHRyYW5zcG9ydF93aXRoX2RhdGEuY29tbWl0UG9zaXRpb24oKTsKKworICAgICAgICAgIHZhciBjYWxsYmFjayA9IGNsaWVudC5fcmVxc1toZWFkZXIucnNlcWlkXTsKKyAgICAgICAgICBkZWxldGUgY2xpZW50Ll9yZXFzW2hlYWRlci5yc2VxaWRdOworICAgICAgICAgIGlmIChzZXJ2aWNlX25hbWUpIHsKKyAgICAgICAgICAgIGRlbGV0ZSBzZWxmLnNlcUlkMlNlcnZpY2VbaGVhZGVyLnJzZXFpZF07CisgICAgICAgICAgfQorICAgICAgICAgIGlmIChjYWxsYmFjaykgeworICAgICAgICAgICAgY2FsbGJhY2soZXJyLCBzdWNjZXNzKTsKKyAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIC8qanNoaW50ICtXMDgzICovCisKKyAgICAgICAgaWYoY2xpZW50WydyZWN2XycgKyBoZWFkZXIuZm5hbWVdKSB7CisgICAgICAgICAgY2xpZW50WydyZWN2XycgKyBoZWFkZXIuZm5hbWVdKG1lc3NhZ2UsIGhlYWRlci5tdHlwZSwgZHVtbXlfc2VxaWQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIGRlbGV0ZSBjbGllbnQuX3JlcXNbZHVtbXlfc2VxaWRdOworICAgICAgICAgIHNlbGYuZW1pdCgiZXJyb3IiLAorICAgICAgICAgICAgICAgICAgICBuZXcgdGhyaWZ0LlRBcHBsaWNhdGlvbkV4Y2VwdGlvbih0aHJpZnQuVEFwcGxpY2F0aW9uRXhjZXB0aW9uVHlwZS5XUk9OR19NRVRIT0RfTkFNRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlJlY2VpdmVkIGEgcmVzcG9uc2UgdG8gYW4gdW5rbm93biBSUEMgZnVuY3Rpb24iKSk7CisgICAgICAgIH0KKyAgICAgIH0KICAgICB9CiAgICAgY2F0Y2ggKGUpIHsKLSAgICAgIGlmIChlIGluc3RhbmNlb2YgdHRyYW5zcG9ydC5JbnB1dEJ1ZmZlclVuZGVycnVuRXJyb3IpIHsKKyAgICAgIGlmIChlIGluc3RhbmNlb2YgSW5wdXRCdWZmZXJVbmRlcnJ1bkVycm9yKSB7CiAgICAgICAgIHRyYW5zcG9ydF93aXRoX2RhdGEucm9sbGJ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VhZGVyLnJzZXFpZF07CisgICAgICAgIGlmIChzZXJ2aWNlX25hbWUpIHsKKyAgICAgICAgICBjbGllbnQgPSBzZWxmLmNsaWVudFtzZXJ2aWNlX25hbWVdOworICAgICAgICAgIGRlbGV0ZSBzZWxmLnNlcUlkMlNlcnZpY2VbaGVhZGVyLnJzZXFpZF07CisgICAgICAgIH0KKyAgICAgICAgLypqc2hpbnQgLVcwODMgKi8KKyAgICAgICAgY2xpZW50Ll9yZXFzW2R1bW15X3NlcWlkXSA9IGZ1bmN0aW9uKGVyciwgc3VjY2Vzcyl7CisgICAgICAgICAgdHJhbnNwb3J0X3dpdGhfZGF0YS5jb21taXRQb3NpdGlvbigpOworICAgICAgICAgIHZhciBjbGllbnRDYWxsYmFjayA9IGNsaWVudC5fcmVxc1toZWFkZXIucnNlcWlkXTsKKyAgICAgICAgICBkZWxldGUgY2xpZW50Ll9yZXFzW2hlYWRlci5yc2VxaWRdOworICAgICAgICAgIGlmIChjbGllbnRDYWxsYmFjaykgeworICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhmdW5jdGlvbigpIHsKKyAgICAgICAgICAgICAgY2xpZW50Q2FsbGJhY2soZXJyLCBzdWNjZXNzKTsKKyAgICAgICAgICAgIH0pOworICAgICAgICAgIH0KKyAgICAgICAgfTsKKyAgICAgICAgLypqc2hpbnQgK1cwODMgKi8KKyAgICAgICAgaWYoY2xpZW50WydyZWN2XycgKyBoZWFkZXIuZm5hbWVdKSB7CisgICAgICAgICAgY2xpZW50WydyZWN2XycgKyBoZWFkZXIuZm5hbWVdKHByb3RvLCBoZWFkZXIubXR5cGUsIGR1bW15X3NlcWlkKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICBkZWxldGUgY2xpZW50Ll9yZXFzW2R1bW15X3NlcWlkXTsKKyAgICAgICAgICBzZWxmLmVtaXQoImVycm9yIiwKKyAgICAgICAgICAgICAgICAgICAgbmV3IHRocmlmdC5UQXBwbGljYXRpb25FeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgIHRocmlmdC5UQXBwbGljYXRpb25FeGNlcHRpb25UeXBlLldST05HX01FVEhPRF9OQU1FLAorICAgICAgICAgICAgICAgICAgICAgICAiUmVjZWl2ZWQgYSByZXNwb25zZSB0byBhbiB1bmtub3duIFJQQyBmdW5jdGlvbiIpKTsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgICBjYXRjaCAoZSkgeworICAgICAgaWYgKGUgaW5zdGFuY2VvZiBJbnB1dEJ1ZmZlclVuZGVycnVuRXJyb3IpIHsKKyAgICAgICAgdHJhbnNwb3J0X3dpdGhfZGF0YS5yb2xsYmFja1Bvc2l0aW9uKCk7CisgICAgICB9IGVsc2UgeworICAgICAgICBzZWxmLmVtaXQoJ2Vycm9yJywgZSk7CisgICAgICB9CisgICAgfQorICB9CisKKworICAvL1Jlc3BvbnNlIGhhbmRsZXIKKyAgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKyAgdGhpcy5yZXNwb25zZUNhbGxiYWNrID0gZnVuY3Rpb24ocmVzcG9uc2UpIHsKKyAgICB2YXIgZGF0YSA9IFtdOworICAgIHZhciBkYXRhTGVuID0gMDsKKworICAgIGlmIChyZXNwb25zZS5zdGF0dXNDb2RlICE9PSAyMDApIHsKKyAgICAgIHRoaXMuZW1pdCgiZXJyb3IiLCBuZXcgVEhUVFBFeGNlcHRpb24ocmVzcG9uc2UpKTsKKyAgICB9CisKKyAgICByZXNwb25zZS5vbignZXJyb3InLCBmdW5jdGlvbiAoZSkgeworICAgICAgc2VsZi5lbWl0KCJlcnJvciIsIGUpOworICAgIH0pOworCisgICAgLy8gV2hlbiBydW5uaW5nIGRpcmVjdGx5IHVuZGVyIG5vZGUsIGNodW5rIHdpbGwgYmUgYSBidWZmZXIsCisgICAgLy8gaG93ZXZlciwgd2hlbiBydW5uaW5nIGluIGEgQnJvd3NlciAoZS5nLiBCcm93c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gICAgICByOiAnXHInLAorICAgICAgICAgICAgdDogJ1x0JworICAgICAgICB9LAorICAgICAgICB0ZXh0LAorCisgICAgICAgIGVycm9yID0gZnVuY3Rpb24gKG0pIHsKKworLy8gQ2FsbCBlcnJvciB3aGVuIHNvbWV0aGluZyBpcyB3cm9uZy4KKworICAgICAgICAgICAgdGhyb3cgbmV3IFN5bnRheEVycm9yKG0pOworICAgICAgICB9LAorCisgICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgeworCisvLyBJZiBhIGMgcGFyYW1ldGVyIGlzIHByb3ZpZGVkLCB2ZXJpZnkgdGhhdCBpdCBtYXRjaGVzIHRoZSBjdXJyZW50IGNoYXJhY3Rlci4KKworICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKKyAgICAgICAgICAgICAgICBlcnJvcigiRXhwZWN0ZWQgJyIgKyBjICsgIicgaW5zdGVhZCBvZiAnIiArIGNoICsgIiciKTsKKyAgICAgICAgICAgIH0KKworLy8gR2V0IHRoZSBuZXh0IGNoYXJhY3Rlci4gV2hlbiB0aGVyZSBhcmUgbm8gbW9yZSBjaGFyYWN0ZXJzLAorLy8gcmV0dXJuIHRoZSBlbXB0eSBzdHJpbmcuCisKKyAgICAgICAgICAgIGNoID0gdGV4dC5jaGFyQXQoYXQpOworICAgICAgICAgICAgYXQgKz0gMTsKKyAgICAgICAgICAgIHJldHVybiBjaDsKKyAgICAgICAgfSwKKworICAgICAgICBudW1iZXIgPSBmdW5jdGlvbiAoKSB7CisKKy8vIFBhcnNlIGEgbnVtYmVyIHZhbHVlLgorCisgICAgICAgICAgICB2YXIgbnVtYmVyLAorICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnOworCisgICAgICAgICAgICBpZiAoY2ggPT09ICctJykgeworICAgICAgICAgICAgICAgIHN0cmluZyA9ICctJzsKKyAgICAgICAgICAgICAgICBuZXh0KCctJyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB3aGlsZSAoY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgeworICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKKyAgICAgICAgICAgICAgICBuZXh0KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgeworICAgICAgICAgICAgICAgIHN0cmluZyArPSAnLic7CisgICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSAmJiBjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CisgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOworICAgICAgICAgICAgICAgIG5leHQoKTsKKyAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CisgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKKyAgICAgICAgICAgICAgICAgICAgbmV4dCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB3aGlsZSAoY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgeworICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CisgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOworICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZShudW1iZXIpKSB7CisgICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobnVtYmVyID49IEludDY0Lk1BWF9JTlQgfHwgbnVtYmVyIDw9IEludDY0Lk1JTl9JTlQpIHsKKyAgICAgICAgICAgICAgICAvLyBSZXR1cm4gcmF3IHN0cmluZyBmb3IgZnVydGhlciBwcm9jZXNzIGluIFRKU09OUHJvdG9jb2wKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RyaW5nOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVtYmVyOworICAgICAgICAgICAgfQorICAgICAgICB9LAorCisgICAgICAgIHN0cmluZyA9IGZ1bmN0aW9uICgpIHsKKworLy8gUGFyc2UgYSBzdHJpbmcgdmFsdWUuCisKKyAgICAgICAgICAgIHZhciBoZXgsCisgICAgICAgICAgICAgICAgaSwKKyAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJywKKyAgICAgICAgICAgICAgICB1ZmZmZjsKKworLy8gV2hlbiBwYXJzaW5nIGZvciBzdHJpbmcgdmFsdWVzLCB3ZSBtdXN0IGxvb2sgZm9yICIgYW5kIFwgY2hhcmFjdGVycy4KKworICAgICAgICAgICAgaWYgKGNoID09PSAnIicpIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAobmV4dCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXh0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RyaW5nOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xcJykgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV4dCgpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZmZmZiA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDQ7IGkgKz0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZShoZXgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZmZmZiA9IHVmZmZmICogMTYgKyBoZXg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGVzY2FwZWVbY2hdID09PSAnc3RyaW5nJykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBlc2NhcGVlW2NoXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlcnJvcigiQmFkIHN0cmluZyIpOworICAgICAgICB9LAorCisgICAgICAgIHdoaXRlID0gZnVuY3Rpb24gKCkgeworCisvLyBTa2lwIHdoaXRlc3BhY2UuCisKKyAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKKyAgICAgICAgICAgICAgICBuZXh0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0sCisKKyAgICAgICAgd29yZCA9IGZ1bmN0aW9uICgpIHsKKworLy8gdHJ1ZSwgZmFsc2UsIG9yIG51bGwuCisKKyAgICAgICAgICAgIHN3aXRjaCAoY2gpIHsKKyAgICAgICAgICAgIGNhc2UgJ3QnOgorICAgICAgICAgICAgICAgIG5leHQoJ3QnKTsKKyAgICAgICAgICAgICAgICBuZXh0KCdyJyk7CisgICAgICAgICAgICAgICAgbmV4dCgndScpOworICAgICAgICAgICAgICAgIG5leHQoJ2UnKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIGNhc2UgJ2YnOgorICAgICAgICAgICAgICAgIG5leHQoJ2YnKTsKKyAgICAgICAgICAgICAgICBuZXh0KCdhJyk7CisgICAgICAgICAgICAgICAgbmV4dCgnbCcpOworICAgICAgICAgICAgICAgIG5leHQoJ3MnKTsKKyAgICAgICAgICAgICAgICBuZXh0KCdlJyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgY2FzZSAnbic6CisgICAgICAgICAgICAgICAgbmV4dCgnbicpOworICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKKyAgICAgICAgICAgICAgICBuZXh0KCdsJyk7CisgICAgICAgICAgICAgICAgbmV4dCgnbCcpOworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZXJyb3IoIlVuZXhwZWN0ZWQgJyIgKyBjaCArICInIik7CisgICAgICAgIH0sCisKKyAgICAgICAgdmFsdWUsICAvLyBQbGFjZSBob2xkZXIgZm9yIHRoZSB2YWx1ZSBmdW5jdGlvbi4KKworICAgICAgICBhcnJheSA9IGZ1bmN0aW9uICgpIHsKKworLy8gUGFyc2UgYW4gYXJyYXkgdmFsdWUuCisKKyAgICAgICAgICAgIHZhciBhcnJheSA9IFtdOworCisgICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgeworICAgICAgICAgICAgICAgIG5leHQoJ1snKTsKKyAgICAgICAgICAgICAgICB3aGl0ZSgpOworICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CisgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OyAgIC8vIGVtcHR5IGFycmF5CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHdoaWxlIChjaCkgeworICAgICAgICAgICAgICAgICAgICBhcnJheS5wdXNoKHZhbHVlKCkpOworICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOworICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICddJykgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG5leHQoJywnKTsKKyAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CisgICAgICAgIH0sCisKKyAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgeworCisvLyBQYXJzZSBhbiBvYmplY3QgdmFsdWUuCisKKyAgICAgICAgICAgIHZhciBrZXksCisgICAgICAgICAgICAgICAgb2JqZWN0ID0ge307CisKKyAgICAgICAgICAgIGlmIChjaCA9PT0gJ3snKSB7CisgICAgICAgICAgICAgICAgbmV4dCgneycpOworICAgICAgICAgICAgICAgIHdoaXRlKCk7CisgICAgICAgICAgICAgICAgaWYgKGNoID09PSAnfScpIHsKKyAgICAgICAgICAgICAgICAgICAgbmV4dCgnfScpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB3aGlsZSAoY2gpIHsKKyAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CisgICAgICAgICAgICAgICAgICAgIG5leHQoJzonKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IoJ0R1cGxpY2F0ZSBrZXkgIicgKyBrZXkgKyAnIicpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKKyAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAnfScpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3Q7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOworICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVycm9yKCJCYWQgb2JqZWN0Iik7CisgICAgICAgIH07CisKKyAgICB2YWx1ZSA9IGZ1bmN0aW9uICgpIHsKKworLy8gUGFyc2UgYSBKU09OIHZhbHVlLiBJdCBjb3VsZCBiZSBhbiBvYmplY3QsIGFuIGFycmF5LCBhIHN0cmluZywgYSBudW1iZXIsCisvLyBvciBhIHdvcmQuCisKKyAgICAgICAgd2hpdGUoKTsKKyAgICAgICAgc3dpdGNoIChjaCkgeworICAgICAgICBjYXNlICd7JzoKKyAgICAgICAgICAgIHJldHVybiBvYmplY3QoKTsKKyAgICAgICAgY2FzZSAnWyc6CisgICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKKyAgICAgICAgY2FzZSAnIic6CisgICAgICAgICAgICByZXR1cm4gc3RyaW5nKCk7CisgICAgICAgIGNhc2UgJy0nOgorICAgICAgICAgICAgcmV0dXJuIG51bWJlcigpOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScKKyAgICAgICAgICAgICAgICA/IG51bWJlcigpCisgICAgICAgICAgICAgICAgOiB3b3JkKCk7Cisg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cm90b3R5cGUud3JpdGVMaXN0RW5kID0gZnVuY3Rpb24oKSB7CisgIHZhciBwID0gdGhpcy50cG9zLnBvcCgpOworCisgIHdoaWxlICh0aGlzLnRzdGFjay5sZW5ndGggPiBwICsgMSkgeworICAgIHZhciB0bXBWYWwgPSB0aGlzLnRzdGFja1twICsgMV07CisgICAgdGhpcy50c3RhY2suc3BsaWNlKHAgKyAxLCAxKTsKKyAgICB0aGlzLnRzdGFja1twXS5wdXNoKHRtcFZhbCk7CisgIH0KKworICB0aGlzLnRzdGFja1twXSA9ICdbJyArIHRoaXMudHN0YWNrW3BdLmpvaW4oJywnKSArICddJzsKKworICB0aGlzLndyaXRlVG9UcmFuc3BvcnRJZlN0YWNrSXNGbHVzaGFibGUoKTsKK307CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgYmVnaW5uaW5nIG9mIGEgc2V0IGNvbGxlY3Rpb24uCisgKiBAcGFyYW0ge1RocmlmdC5UeXBlfSBlbGVtVHlwZSAtIFRoZSBkYXRhIHR5cGUgb2YgdGhlIGVsZW1lbnRzLgorICogQHBhcmFtIHtudW1iZXJ9IHNpemUgLSBUaGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoZSBsaXN0LgorICovCitUSlNPTlByb3RvY29sLnByb3RvdHlwZS53cml0ZVNldEJlZ2luID0gZnVuY3Rpb24oZWxlbVR5cGUsIHNpemUpIHsKKyAgICB0aGlzLnRwb3MucHVzaCh0aGlzLnRzdGFjay5sZW5ndGgpOworICAgIHRoaXMudHN0YWNrLnB1c2goW1RKU09OUHJvdG9jb2wuVHlwZVtlbGVtVHlwZV0sIHNpemVdKTsKK307CisKKy8qKgorICogU2VyaWFsaXplcyB0aGUgZW5kIG9mIGEgc2V0LgorICovCitUSlNPTlByb3RvY29sLnByb3RvdHlwZS53cml0ZVNldEVuZCA9IGZ1bmN0aW9uKCkgeworICB2YXIgcCA9IHRoaXMudHBvcy5wb3AoKTsKKworICB3aGlsZSAodGhpcy50c3RhY2subGV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BzaW5nbGUgZG91YmxlIHF1b3RlOiAiCisgICAgICAgICAgaWYgKGNoID09PSAnXCInKSB7CisgICAgICAgICAgICAgIGVzY2FwZWRTdHJpbmcgKz0gJ1xcXCInOyAvLyB3cml0ZSBvdXQgYXM6IFwiCisgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xcJykgeyAgICAvLyBhIHNpbmdsZSBiYWNrc2xhc2g6IFwKKyAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxcXCc7IC8vIHdyaXRlIG91dCBhczogXFwKKyAgICAgICAgICAvKiBDdXJyZW50bHkgZXNjYXBlZCBmb3J3YXJkIHNsYXNoZXMgYnJlYWsgVEpTT05Qcm90b2NvbC4KKyAgICAgICAgICAgKiBBcyBpdCBzdGFuZHMsIHdlIGNhbiBzaW1wbHkgcGFzcyBmb3J3YXJkIHNsYXNoZXMgaW50bworICAgICAgICAgICAqIG91ciBzdHJpbmdzIGFjcm9zcyB0aGUgd2lyZSB3aXRob3V0IGJlaW5nIGVzY2FwZWQuCisgICAgICAgICAgICogSSB0aGluayB0aGlzIGlzIHRoZSBwcm90b2NvbCdzIGJ1Zywgbm90IHRocmlmdC5qcworICAgICAgICAgICAqIH0gZWxzZSBpZihjaCA9PT0gJy8nKSB7ICAgLy8gYSBzaW5nbGUgZm9yd2FyZCBzbGFzaDogLworICAgICAgICAgICAqICBlc2NhcGVkU3RyaW5nICs9ICdcXC8nOyAgLy8gd3JpdGUgb3V0IGFzIFwvCisgICAgICAgICAgICogfQorICAgICAgICAgICAqLworICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcYicpIHsgICAgLy8gYSBzaW5nbGUgYmFja3NwYWNlOiBpbnZpc2libGUKKyAgICAgICAgICAgICAgZXNjYXBlZFN0cmluZyArPSAnXFxiJzsgIC8vIHdyaXRlIG91dCBhczogXGIiCisgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1xmJykgeyAgICAvLyBhIHNpbmdsZS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oqIFJldHVybnMgdGhlIG5leHQgdmFsdWUgZm91bmQgaW4gdGhlIHByb3RvY29sIGJ1ZmZlciAqLworVEpTT05Qcm90b2NvbC5wcm90b3R5cGUucmVhZFZhbHVlID0gZnVuY3Rpb24oZikgeworICBpZiAoZiA9PT0gdW5kZWZpbmVkKSB7CisgICAgZiA9IHRoaXMucnN0YWNrW3RoaXMucnN0YWNrLmxlbmd0aCAtIDFdOworICB9CisKKyAgdmFyIHIgPSB7fTsKKworICBpZiAoZiBpbnN0YW5jZW9mIEFycmF5KSB7CisgICAgaWYgKGYubGVuZ3RoID09PSAwKSB7CisgICAgICByLnZhbHVlID0gdW5kZWZpbmVkOworICAgIH0gZWxzZSB7CisgICAgICByLnZhbHVlID0gZi5zaGlmdCgpOworICAgIH0KKyAgfSBlbHNlIGlmICghKGYgaW5zdGFuY2VvZiBJbnQ2NCkgJiYgZiBpbnN0YW5jZW9mIE9iamVjdCkgeworICAgIGZvciAodmFyIGkgaW4gZikgeworICAgICAgaWYgKGkgPT09IG51bGwpIHsKKyAgICAgICAgY29udGludWU7CisgICAgICB9CisgICAgICB0aGlzLnJzdGFjay5wdXNoKGZbaV0pOworICAgICAgZGVsZXRlIGZbaV07CisKKyAgICAgIHIudmFsdWUgPSBpOworICAgICAgYnJlYWs7CisgICAgfQorICB9IGVsc2UgeworICAgIHIudmFsdWUgPSBmOworICAgIHRoaXMucnN0YWNrLnBvcCgpOworICB9CisKKyAgcmV0dXJuIHIudmFsdWU7Cit9OworCitUSlNPTlByb3RvY29sLnByb3RvdHlwZS5yZWFkSTY0ID0gZnVuY3Rpb24oKSB7CisgIHZhciBuID0gdGhpcy5yZWFkVmFsdWUoKQorICBpZiAodHlwZW9mIG4gPT09ICdzdHJpbmcnKSB7CisgICAgLy8gQXNzdW1pbmcgbm8gb25lIGlzIHNlbmRpbmcgaW4gMS4xMTExMWUrMzMgZm9ybWF0CisgICAgcmV0dXJuIEludDY0VXRpbC5mcm9tRGVjaW1hbFN0cmluZyhuKTsKKyAgfSBlbHNlIHsKKyAgICByZXR1cm4gbmV3IEludDY0KG4pOworICB9Cit9OworCitUSlNPTlByb3RvY29sLnByb3RvdHlwZS5yZWFkRG91YmxlID0gZnVuY3Rpb24oKSB7CisgIHJldHVybiB0aGlzLnJlYWRJMzIoKTsKK307CisKK1RKU09OUHJvdG9jb2wucHJvdG90eXBlLnJlYWRCaW5hcnkgPSBmdW5jdGlvbigpIHsKKyAgcmV0dXJuIG5ldyBCdWZmZXIodGhpcy5yZWFkVmFsdWUoKSwgJ2Jhc2U2NCcpOworfTsKKworVEpTT05Qcm90b2NvbC5wcm90b3R5cGUucmVhZFN0cmluZyA9IGZ1bmN0aW9uKCkgeworICByZXR1cm4gdGhpcy5yZWFkVmFsdWUoKTsKK307CisKKy8qKgorICogUmV0dXJucyB0aGUgdW5kZXJseWluZyB0cmFuc3BvcnQuCisgKiBAcmVhZG9ubHkKKyAqIEByZXR1cm5zIHtUaHJpZnQuVHJhbnNwb3J0fSBUaGUgdW5kZXJseWluZyB0cmFuc3BvcnQuCisgKi8KK1RKU09OUHJvdG9jb2wucHJvdG90eXBlLmdldFRyYW5zcG9ydCA9IGZ1bmN0aW9uKCkgeworICByZXR1cm4gdGhpcy50cmFuczsKK307CisKKy8qKgorICogTWV0aG9kIHRvIGFyYml0cmFyaWx5IHNraXAgb3ZlciBkYXRhCisgKi8KK1RKU09OUHJvdG9jb2wucHJvdG90eXBlLnNraXAgPSBmdW5jdGlvbih0eXBlKSB7CisgICAgc3dpdGNoICh0eXBlKSB7CisgICAgY2FzZSBUeXBlLlNUT1A6CisgICAgICByZXR1cm47CisgICAgY2FzZSBUeXBlLkJPT0w6CisgICAgICB0aGlzLnJlYWRCb29sKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFR5cGUuQllURToKKyAgICAgIHRoaXMucmVhZEJ5dGUoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVHlwZS5JMTY6CisgICAgICB0aGlzLnJlYWRJMTYoKTsK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ZXhQcm90b2NvbC5wcm90b3R5cGUud3JpdGVNZXNzYWdlQmVnaW4gPSBmdW5jdGlvbihuYW1lLCB0eXBlLCBzZXFpZCkgeworICAgIGlmICh0eXBlID09IFRocmlmdC5NZXNzYWdlVHlwZS5DQUxMIHx8IHR5cGUgPT0gVGhyaWZ0Lk1lc3NhZ2VUeXBlLk9ORVdBWSkgeworICAgICAgY29ubmVjdGlvbi5zZXFJZDJTZXJ2aWNlW3NlcWlkXSA9IHNlcnZpY2VOYW1lOworICAgICAgTXVsdGlwbGV4UHJvdG9jb2wuc3VwZXJfLnByb3RvdHlwZS53cml0ZU1lc3NhZ2VCZWdpbi5jYWxsKHRoaXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZU5hbWUgKyAiOiIgKyBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VxaWQpOworICAgIH0gZWxzZSB7CisgICAgICBNdWx0aXBsZXhQcm90b2NvbC5zdXBlcl8ucHJvdG90eXBlLndyaXRlTWVzc2FnZUJlZ2luLmNhbGwodGhpcywgbmFtZSwgdHlwZSwgc2VxaWQpOworICAgIH0KKyAgfTsKKworICByZXR1cm4gTXVsdGlwbGV4UHJvdG9jb2w7Cit9OworCitmdW5jdGlvbiBNdWx0aXBsZXhlcigpIHsKKyAgdGhpcy5zZXFpZCA9IDA7Cit9OworCitNdWx0aXBsZXhlci5wcm90b3R5cGUuY3JlYXRlQ2xpZW50ID0gZnVuY3Rpb24oc2VydmljZU5hbWUsIFNlcnZpY2VDbGllbnQsIGNvbm5lY3Rpb24pIHsKKyAgaWYgKFNlcnZpY2VDbGllbnQuQ2xpZW50KSB7CisgICAgU2VydmljZUNsaWVudCA9I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2luKCkKLQorICAgICAgcmV0ID0gaW5wdXQucmVhZEZpZWxkQmVnaW4oKTsKICAgICAgIGlmKHJldC5mdHlwZSA9PSBUeXBlLlNUT1ApCi0gICAgICAgICAgYnJlYWsKKyAgICAgICAgICBicmVhazsKIAotICAgICAgdmFyIGZpZCA9IHJldC5maWQKLQotICAgICAgc3dpdGNoKGZpZCl7CisgICAgICBzd2l0Y2gocmV0LmZpZCl7CiAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICBpZiggcmV0LmZ0eXBlID09IFR5cGUuU1RSSU5HICl7Ci0gICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5yZWFkU3RyaW5nKCkKLSAgICAgICAgICAgICAgICAgIHRoaXMubWVzc2FnZSA9IHJldAorICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQucmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgICAgdGhpcy5tZXNzYWdlID0gcmV0OwogICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgcmV0ID0gaW5wdXQuc2tpcChyZXQuZnR5cGUpCisgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5za2lwKHJldC5mdHlwZSk7CiAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICBicmVhaworICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgIGlmKCByZXQuZnR5cGUgPT0gVHlwZS5JMzIgKXsKLSAgICAgICAgICAgICAgICAgIHJldCA9IGlucHV0LnJlYWRJMzIoKQotICAgICAgICAgICAgICAgICAgdGhpcy50eXBlID0gcmV0CisgICAgICAgICAgICAgICAgICByZXQgPSBpbnB1dC5yZWFkSTMyKCk7CisgICAgICAgICAgICAgICAgICB0aGlzLnR5cGUgPSByZXQ7CiAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICByZXQgICA9IGlucHV0LnNraXAocmV0LmZ0eXBlKQorICAgICAgICAgICAgICAgICAgcmV0ICAgPSBpbnB1dC5za2lwKHJldC5mdHlwZSk7CiAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgYnJlYWsKLQorICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICByZXQgPSBpbnB1dC5za2lwKHJldC5mdHlwZSkKLSAgICAgICAgICAgICAgYnJlYWsKKyAgICAgICAgICAgICAgcmV0ID0gaW5wdXQuc2tpcChyZXQuZnR5cGUpOworICAgICAgICAgICAgICBicmVhazsKICAgICAgIH0KLSAgICAgIGlucHV0LnJlYWRGaWVsZEVuZCgpCisgICAgICBpbnB1dC5yZWFkRmllbGRFbmQoKTsKICAgfQotCi0gIGlucHV0LnJlYWRTdHJ1Y3RFbmQoKQotfQorICBpbnB1dC5yZWFkU3RydWN0RW5kKCk7Cit9OwogCiBUQXBwbGljYXRpb25FeGNlcHRpb24ucHJvdG90eXBlLndyaXRlID0gZnVuY3Rpb24ob3V0cHV0KXsKICAgb3V0cHV0LndyaXRlU3RydWN0QmVnaW4oJ1RBcHBsaWNhdGlvbkV4Y2VwdGlvbicpOwogCiAgIGlmICh0aGlzLm1lc3NhZ2UpIHsKLSAgICAgIG91dHB1dC53cml0ZUZpZWxkQmVnaW4oJ21lc3NhZ2UnLCBUeXBlLlNUUklORywgMSkKLSAgICAgIG91dHB1dC53cml0ZVN0cmluZyh0aGlzLm1lc3NhZ2UpCi0gICAgICBvdXRwdXQud3JpdGVGaWVsZEVuZCgpCisgICAgICBvdXRwdXQud3JpdGVGaWVsZEJlZ2luKCdtZXNzYWdlJywgVHlwZS5TVFJJTkcsIDEpOworICAgICAgb3V0cHV0LndyaXRlU3RyaW5nKHRoaXMubWVzc2FnZSk7CisgICAgICBvdXRwdXQud3JpdGVGaWVsZEVuZCgpOwogICB9CiAKICAgaWYgKHRoaXMuY29kZSkgewotICAgICAgb3V0cHV0LndyaXRlRmllbGRCZWdpbigndHlwZScsIFR5cGUuSTM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isKKyAgdmFyIHR5cGU7CisKKyAgaWYgKHR5cGVzLnNoaWZ0ID09PSB1bmRlZmluZWQpIHsKKyAgICB0eXBlID0gdHlwZXM7CisgIH0KKyAgZWxzZSB7CisgICAgdHlwZSA9IHR5cGVzWzBdOworICB9CisgIHZhciBUeXBlID0gdHlwZTsKKworICB2YXIgcmVzdWx0ID0ge30sIHZhbDsKKyAgZm9yKHZhciBwcm9wIGluIG9iaikgeworICAgIGlmKG9iai5oYXNPd25Qcm9wZXJ0eShwcm9wKSkgeworICAgICAgdmFsID0gb2JqW3Byb3BdOworICAgICAgaWYgKHR5cGUgPT09IG51bGwpIHsKKyAgICAgICAgcmVzdWx0W3Byb3BdID0gdmFsOworICAgICAgfQorICAgICAgZWxzZSBpZiAodHlwZSA9PT0gY29weU1hcCB8fCB0eXBlID09PSBjb3B5TGlzdCkgeworICAgICAgICByZXN1bHRbcHJvcF0gPSB0eXBlKHZhbCwgdHlwZXMuc2xpY2UoMSkpOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHJlc3VsdFtwcm9wXSA9IG5ldyBUeXBlKHZhbCk7CisgICAgICB9CisgICAgfQorICB9CisgIHJldHVybiByZXN1bHQ7Cit9OworCittb2R1bGUuZXhwb3J0cy5jb3B5TWFwID0gY29weU1hcDsKK21vZHVsZS5leHBvcnRzLmNvcHlMaXN0ID0gY29weUxpc3Q7CmRpZmYgLS1naXQgYS9saWIvbm9kZWpzL2xpYi90aHJpZnQvdHJhbnNwb3J0LmpzIGIvbGliL25vZGVqcy9saWIvdGhyaWZ0L3RyYW5zcG9ydC5qcwppbmRleCBlOTE4MzM1Li41OWRhYTk4IDEwMDY0NAotLS0gYS9saWIvbm9kZWpzL2xpYi90aHJpZnQvdHJhbnNwb3J0LmpzCisrKyBiL2xpYi9ub2RlanMvbGliL3RocmlmdC90cmFuc3BvcnQuanMKQEAgLTE2LDI5MCArMTYsNyBAQAogICogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5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ICAgbGVuZ3RoIGFzIGFuIHVuc2lnbmVkIDY0IGJpdCBpbnRlZ2VyCisgKiAgLSBNYXNraW5nIGtleSBpcyBhIDMyIGJpdCBrZXkgb25seSBwcmVzZW50IHdoZW4gc2VuZGluZyB0byB0aGUgc2VydmVyCisgKiAgLSBQYXlsb2FkIGZvbGxvd3MgdGhlIG1hc2tpbmcga2V5IG9yIGxlbmd0aAorICoKKyAqICAgICAwICAgICAgICAgICAgICAgICAgIDEgICAgICAgICAgICAgICAgICAgMiAgICAgICAgICAgICAgICAgICAzCisgKiAgICAgMCAxIDIgMyA0IDUgNiA3IDggOSAwIDEgMiAzIDQgNSA2IDcgOCA5IDAgMSAyIDMgNCA1IDYgNyA4IDkgMCAxCisgKiAgICArLSstKy0rLSstLS0tLS0tKy0rLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworICogICAgfEZ8UnxSfFJ8IG9wY29kZXxNfCBQYXlsb2FkIGxlbiB8ICAgIEV4dGVuZGVkIHBheWxvYWQgbGVuZ3RoICAgIHwKKyAqICAgIHxJfFN8U3xTfCAgKDQpICB8QXwgICAgICg3KSAgICAgfCAgICAgICAgICAgICAoMTYvNjQpICAgICAgICAgICB8CisgKiAgICB8TnxWfFZ8VnwgICAgICAgfFN8ICAgICAgICAgICAgIHwgICAoaWYgcGF5bG9hZCBsZW49PTEyNi8xMjcpICAgfAorICogICAgfCB8MXwyfDN8ICAgICAgIHxLfCAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwKKyAqICAgICstKy0rLSstKy0tLS0tLS0rLSstLS0tLS0tLS0tLS0tKyAtIC0gLSAtIC0gLSAtIC0gLSAtIC0gLSAtIC0gLSArCisgKiAgICB8ICAgICBFeHRlbmRlZCBwYXlsb2FkIGxlbmd0aCBjb250aW51ZWQsIGlmIHBheWxvYWQgbGVuID09IDEyNyAgfAorICogICAgKyAtIC0gLSAtIC0gLSAtIC0g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gICAgICAgICAgICAgICAgICAgIEZhbHNlIGlmIHRleHQgKFRKU09OUHJvdG9jb2wpCisgICAqIEBwcm9wZXJ0eSB7QnVmZmVyfSBuZXh0RnJhbWUgLSBNdWx0aXBsZSBBVFJQQyBtZXNzYWdlcyBtYXkgYmUgc2VudCBpbiBhCisgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5nbGUgV2ViU29ja2V0IGZyYW1lLCB0aGlzIEJ1ZmZlciBjb250YWlucworICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW55IGJ5dGVzIHJlbWFpbmluZyB0byBiZSBkZWNvZGVkCisgICAqIEBwcm9wZXJ0eSB7Qm9vbGVhbn0gRklOIC0gVHJ1ZSBpcyB0aGUgbWVzc2FnZSBpcyBjb21wbGV0ZQorICAgKi8KKworICAgLyoqIERlY29kZXMgYSBXZWJTb2NrZXQgZnJhbWUKKyAgICoKKyAgICogQHBhcmFtIHtCdWZmZXJ9IGZyYW1lIC0gVGhlIHJhdyBpbmJvdW5kIGZyYW1lLCBpZiB0aGlzIGlzIGEgY29udGludWF0aW9uCisgICAqICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lIGl0IG11c3QgaGF2ZSBhIG1hc2sgcHJvcGVydHkgd2l0aCB0aGUgbWFzay4KKyAgICogQHJldHVybnMge1dTRGVjb2RlUmVzdWx0fSAtIFRoZSBkZWNvZGVkIHBheWxvYWQKKyAgICoKKyAgICogQHNlZSB7QGxpbmsgV1NEZWNvZGVSZXN1bHR9CisgICAqLworICBkZWNvZGU6IGZ1bmN0aW9uKGZyYW1lKSB7CisgICAgICB2YXIgcmVzdWx0ID0geworICAgICAgICBkYXRhOiBudWxsLAorICAgICAgICBtYXNrOiBudWxsLAorICAgICAgICBiaW5FbmNvZGluZzogZmFsc2UsCisgICAgICAgIG5leHRGcmFtZTogbnVsbCwKKyAgICAgICAgRklOOiB0cnVlCisgICAgICB9OworCisgICAgICAvL0J5dGUgMCAtIEZJTi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Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCisvKioKKyAqIEBjbGFzcworICogQG5hbWUgU2VydmVyT3B0aW9ucworICogQHByb3BlcnR5IHthcnJheX0gY29ycyAtIEFycmF5IG9mIENPUlMgb3JpZ2luIHN0cmluZ3MgdG8gcGVybWl0IHJlcXVlc3RzIGZyb20uCisgKiBAcHJvcGVydHkge3N0cmluZ30gZmlsZXMgLSBQYXRoIHRvIHNlcnZlIHN0YXRpYyBmaWxlcyBmcm9tLCBpZiBhYnNlbnQgb3IgIiIKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpYyBmaWxlIHNlcnZpY2UgaXMgZGlzYWJsZWQuCisgKiBAcHJvcGVydHkge29iamVjdH0gaGVhZGVycyAtIEFuIG9iamVjdCBoYXNoIG1hcHBpbmcgaGVhZGVyIHN0cmluZ3MgdG8gaGVhZGVyIHZhbHVlCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZ3MsIHRoZXNlIGhlYWRlcnMgYXJlIHRyYW5zbWl0dGVkIGluIHJlc3BvbnNlIHRvCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpYyBmaWxlIEdFVCBvcGVyYXRpb25zLgorICogQHByb3BlcnR5IHtvYmplY3R9IHNlcnZpY2VzIC0gQW4gb2JqZWN0IGhhc2ggbWFwcGluZyBzZXJ2aWNlIFVSSSBzdHJpbmdzCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBTZXJ2aWNlT3B0aW9ucyBvYmplY3RzCisgKiBAcHJvcGVydHkge29iamVjdH0gdGxzIC0gTm9kZS5qcyBUTFMgb3B0aW9ucyAoc2VlOiBub2RlanMub3JnL2FwaS90bHMuaHRtbCksCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgbm90IHByZXNlbnQgb3IgbnVsbCByZWd1bGFyIGh0dHAgaXMgdXNlZCwKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICBhdCBsZWFzdCBhIGtleSBhbmQgYSBjZXJ0IG11c3QgYmUgZGVmaW5lZCB0byB1c2UgU1NML1RMUworICogQHNlZSB7QGxpbmsgU2VydmljZU9wdGlvbnN9CisgKi8KKworLyoqCisgKiBAY2xhc3MKKyAqIEBuYW1lIFNlcnZpY2VPcHRpb25zCisgKiBAcHJvcGVydHkge29iamVjdH0gdHJhbnNwb3J0IC0gVGhlIGxheWVyZWQgdHJhbnNwb3J0IHRvIHVzZSAoZGVmYXVsdHMKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBUQnVmZmVyZWRUcmFuc3BvcnQpLgorICogQHByb3BlcnR5IHtvYmplY3R9IHByb3RvY29sIC0gVGhlIHNlcmlhbGl6YXRpb24gUHJvdG9jb2wgdG8gdXNlIChkZWZhdWx0cyB0bworICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEJpbmFyeVByb3RvY29sKS4KKyAqIEBwcm9wZXJ0eSB7b2JqZWN0fSBwcm9jZXNzb3IgLSBUaGUgVGhyaWZ0IFNlcnZpY2UgY2xhc3MvcHJvY2Vzc29yIGdlbmVyYXRlZAorICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5IHRoZSBJREwgQ29tcGlsZXIgZm9yIHRoZSBzZXJ2aWNlICh0aGUgImNscyIKKyAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXkgY2FuIGFsc28gYmUgdXNlZCBmb3IgdGhpcyBhdHRyaWJ1dGUpLgorICogQHByb3BlcnR5IHtvYmplY3R9IGhhbmRsZXIgLSBUaGUgaGFuZGxlciBtZXRob2RzIGZvciB0aGUgVGhyaWZ0IFNlcnZpY2UuCisgKi8KKworLyoqCisgKiBDcmVhdGUgYSBUaHJpZnQgc2VydmVyIHdoaWNoIGNhbiBzZXJ2ZSBzdGF0aWMgZmlsZXMgYW5kL29yIG9uZSBvcgorICogbW9yZSBUaHJpZnQgU2V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uIik7CisgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHZhciBoZWFkZXJzID0ge307CisgICAgICAgIHZhciBjb250ZW50VHlwZSA9IGNvbnRlbnRUeXBlc0J5RXh0ZW5zaW9uW3BhdGguZXh0bmFtZShmaWxlbmFtZSldOworICAgICAgICBpZiAoY29udGVudFR5cGUpIHsKKyAgICAgICAgICBoZWFkZXJzWyJDb250ZW50LVR5cGUiXSA9IGNvbnRlbnRUeXBlOworICAgICAgICB9CisgICAgICAgIGZvciAodmFyIGsgaW4gb3B0aW9ucy5oZWFkZXJzKSB7CisgICAgICAgICAgaGVhZGVyc1trXSA9IG9wdGlvbnMuaGVhZGVyc1trXTsKKyAgICAgICAgfQorICAgICAgICByZXNwb25zZS53cml0ZUhlYWQoMjAwLCBoZWFkZXJzKTsKKyAgICAgICAgcmVzcG9uc2Uud3JpdGUoZmlsZSwgImJpbmFyeSIpOworICAgICAgICByZXNwb25zZS5lbmQoKTsKKyAgICAgIH0pOworICAgIH0pOworICB9CisKKworICAvL0hhbmRsZSBXZWJTb2NrZXQgY2FsbHMgKFRXZWJTb2NrZXRUcmFuc3BvcnQpCisgIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworICBmdW5jdGlvbiBwcm9jZXNzV1MoZGF0YSwgc29ja2V0LCBzdmMsIGJpbkVuY29kaW5nKSB7CisgICAgc3ZjLnRyYW5zcG9ydC5yZWNlaXZlcihmdW5jdGlvbih0cmFuc3BvcnRXaXRoRGF0YSkgeworICAgICAgdmFyIGlucHV0ID0gbmV3IHN2Yy5wcm90b2NvbCh0cmFuc3BvcnRXaXRoRGF0YSk7CisgICAgICB2YXIgb3V0cHV0ID0gbmV3IHN2Yy5wcm90b2NvbChuZXcgc3ZjLnRyYW5zcG9ydCh1bmRlZmluZWQsIGZ1bmN0aW9uKGJ1ZikgeworICAgICAgICB0cnkgeworICAgICAgICAgIHZhciBmcmFtZSA9IHdzRnJhbWUuZW5jb2RlKGJ1ZiwgbnVsbCwgYmluRW5jb2RpbmcpOworICAgICAgICAgIHNvY2tldC53cml0ZShmcmFtZSk7CisgICAgICAgIH0gY2F0Y2ggKGVycikgeworICAgICAgICAgIC8vVE9ETzogQWRkIGJldHRlciBlcnJvciBwcm9jZXNzaW5nCisgICAgICAgIH0KKyAgICAgIH0pKTsKKworICAgICAgdHJ5IHsKKyAgICAgICAgc3ZjLnByb2Nlc3Nvci5wcm9jZXNzKGlucHV0LCBvdXRwdXQpOworICAgICAgICB0cmFuc3BvcnRXaXRoRGF0YS5jb21taXRQb3NpdGlvbigpOworICAgICAgfQorICAgICAgY2F0Y2ggKGVycikgeworICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgSW5wdXRCdWZmZXJVbmRlcnJ1bkVycm9yKSB7CisgICAgICAgICAgdHJhbnNwb3J0V2l0aERhdGEucm9sbGJhY2tQb3NpdGlvbigpOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgIC8vVE9ETzogQWRkIGJldHRlciBlcnJvciBwcm9jZXNzaW5nCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9KShkYXRhKTsKKyAgfQorCisgIC8vQ3JlYXRlIHRoZSBzZXJ2ZXIgKEhUVFAgb3IgSFRUUFMpCisgIHZhciBzZXJ2ZXIgPSBudWxsOworICBpZiAob3B0aW9ucy50bHMpIHsKKyAgICBzZXJ2ZXIgPSBodHRwcy5jcmVhdGVTZXJ2ZXIob3B0aW9ucy50bHMpOworICB9IGVsc2UgeworICAgIHNlcnZlciA9IGh0dHAuY3JlYXRlU2VydmVyKCk7CisgIH0KKworICAvL1dpcmUgdXAgbGlzdGVuZXJzIGZvciB1cGdyYWRlKHRvIFdlYlNvY2tldCkgJiByZXF1ZXN0IG1ldGhvZHMgZm9yOgorICAvLyAgIC0gR0VUIHN0YXRpYyBmaWxlcywKKyAgLy8gICAtIFBPU1QgWEhSIFRocmlmdCBzZXJ2aW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CMERDODVCMTEiKTsKKyAgICBzb2NrZXQud3JpdGUoIkhUVFAvMS4xIDEwMSBTd2l0Y2hpbmcgUHJvdG9jb2xzXHJcbiIgKworICAgICAgICAgICAgICAgICAgICJVcGdyYWRlOiB3ZWJzb2NrZXRcclxuIiArCisgICAgICAgICAgICAgICAgICAgIkNvbm5lY3Rpb246IFVwZ3JhZGVcclxuIiArCisgICAgICAgICAgICAgICAgICAgIlNlYy1XZWJTb2NrZXQtQWNjZXB0OiAiICsgaGFzaC5kaWdlc3QoImJhc2U2NCIpICsgIlxyXG4iICsKKyAgICAgICAgICAgICAgICAgICAiU2VjLVdlYlNvY2tldC1PcmlnaW46ICIgKyByZXF1ZXN0LmhlYWRlcnMub3JpZ2luICsgIlxyXG4iICsKKyAgICAgICAgICAgICAgICAgICAiU2VjLVdlYlNvY2tldC1Mb2NhdGlvbjogd3M6Ly8iICsgcmVxdWVzdC5oZWFkZXJzLmhvc3QgKyByZXF1ZXN0LnVybCArICJcclxuIiArCisgICAgICAgICAgICAgICAgICAgIlxyXG4iKTsKKyAgICAvL0hhbmRsZSBXZWJTb2NrZXQgdHJhZmZpYworICAgIHZhciBkYXRhID0gbnVsbDsKKyAgICBzb2NrZXQub24oJ2RhdGEnLCBmdW5jdGlvbihmcmFtZSkgeworICAgICAgdHJ5IHsKKyAgICAgICAgd2hpbGUgKGZyYW1lKSB7CisgICAgICAgICAgdmFyIHJlc3VsdCA9IHdzRnJhbWUuZGVjb2RlKGZyYW1lKTsKKyAgICAgICAgICAvL1ByZXBlbmQgYW55IGV4aXN0aW5nIGRlY29kZWQgZGF0YQorICAgICAgICAgIGlmIChkYXRhKSB7CisgICAgICAgICAgICBpZiAocmVzdWx0LmRhdGEpIHsKKyAgICAgICAgICAgICAgdmFyIG5ld0RhdGEgPSBuZXcgQnVmZmVyKGRhdGEubGVuZ3RoICsgcmVzdWx0LmRhdGEubGVuZ3RoKTsKKyAgICAgICAgICAgICAgZGF0YS5jb3B5KG5ld0RhdGEpOworICAgICAgICAgICAgICByZXN1bHQuZGF0YS5jb3B5KG5ld0RhdGEsIGRhdGEubGVuZ3RoKTsKKyAgICAgICAgICAgICAgcmVzdWx0LmRhdGEgPSBuZXdEYXRhOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgcmVzdWx0LmRhdGEgPSBkYXRhOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGF0YSA9IG51bGw7CisgICAgICAgICAgfQorICAgICAgICAgIC8vSWYgdGhpcyBjb21wbGV0ZXMgYSBtZXNzYWdlIHByb2Nlc3MgaXQKKyAgICAgICAgICBpZiAocmVzdWx0LkZJTikgeworICAgICAgICAgICAgcHJvY2Vzc1dTKHJlc3VsdC5kYXRhLCBzb2NrZXQsIHN2YywgcmVzdWx0LmJpbkVuY29kaW5nKTsKKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGF0YSA9IHJlc3VsdC5kYXRhOworICAgICAgICAgIH0KKyAgICAgICAgICAvL1ByZXBhcmUgbmV4dCBmcmFtZSBmb3IgZGVjb2RpbmcgKGlmIGFueSkKKyAgICAgICAgICBmcmFtZSA9IHJlc3VsdC5uZXh0RnJhbWU7CisgICAgICAgIH0KKyAgICAgIH0gY2F0Y2goZSkgeworICAgICAgICBsb2cuZXJyb3IoJ1RXZWJTb2NrZXRUcmFuc3BvcnQgRXhjZXB0aW9uOiAnICsgZSk7CisgICAgICAgIHNvY2tldC5kZXN0cm95KCk7CisgICAgICB9CisgICAgfSk7CisgIH0pOworCisgIC8vUmV0dXJuIHRoZSBzZXJ2ZXIKKyAgcmV0dXJuIHNlcnZlcjsKK307CmRpZmYgLS1naXQgYS9saWIvbm9kZWpzL2xpYi90aHJpZnQvd3NfY29ubmVjdGlvbi5qcyBiL2xpYi9ub2RlanMvbGliL3RocmlmdC93c19jb25uZWN0aW9uLmpzCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjA1MmNiZDQKLS0tIC9kZXYvb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SB7CisgICAgICAgIHRyYW5zcG9ydF93aXRoX2RhdGEuY29tbWl0UG9zaXRpb24oKTsKKyAgICAgICAgdmFyIGNsaWVudENhbGxiYWNrID0gY2xpZW50Ll9yZXFzW2hlYWRlci5yc2VxaWRdOworICAgICAgICBkZWxldGUgY2xpZW50Ll9yZXFzW2hlYWRlci5yc2VxaWRdOworICAgICAgICBpZiAoY2xpZW50Q2FsbGJhY2spIHsKKyAgICAgICAgICBjbGllbnRDYWxsYmFjayhlcnIsIHN1Y2Nlc3MpOworICAgICAgICB9CisgICAgICB9OworICAgICAgLypqc2hpbnQgK1cwODMgKi8KKyAgICAgIGlmIChjbGllbnRbJ3JlY3ZfJyArIGhlYWRlci5mbmFtZV0pIHsKKyAgICAgICAgY2xpZW50WydyZWN2XycgKyBoZWFkZXIuZm5hbWVdKHByb3RvLCBoZWFkZXIubXR5cGUsIGR1bW15X3NlcWlkKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGRlbGV0ZSBjbGllbnQuX3JlcXNbZHVtbXlfc2VxaWRdOworICAgICAgICB0aGlzLmVtaXQoImVycm9yIiwKKyAgICAgICAgICBuZXcgdGhyaWZ0LlRBcHBsaWNhdGlvbkV4Y2VwdGlvbigKKyAgICAgICAgICAgIHRocmlmdC5UQXBwbGljYXRpb25FeGNlcHRpb25UeXBlLldST05HX01FVEhPRF9OQU1FLAorICAgICAgICAgICAgIlJlY2VpdmVkIGEgcmVzcG9uc2UgdG8gYW4gdW5rbm93biBSUEMgZnVuY3Rpb24iKSk7CisgICAgICB9CisgICAgfQorICB9IGNhdGNoIChlKSB7CisgICAgaWYgKGUgaW5zdGFuY2VvZiBJbnB1dEJ1ZmZlclVuZGVycnVuRXJyb3IpIHsKKyAgICAgIHRyYW5zcG9ydF93aXRoX2RhdGEucm9sbGJhY2tQb3NpdGlvbigpOworICAgIH0gZWxzZSB7CisgICAgICB0aHJvdyBlOworICAgIH0KKyAgfQorfTsKKworV1NDb25uZWN0aW9uLnByb3Rvd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Agc3RydWN0X2xpc3RfZmllbGQ6IFsKKyAgICAgIG5ldyB0dHlwZXMuU2ltcGxlKHsgdmFsdWU6ICJiIiB9KSwKKyAgICAgIG5ldyB0dHlwZXMuU2ltcGxlKHsgdmFsdWU6ICJjIiB9KQorICAgIF0sCisKKyAgICBzdHJ1Y3Rfc2V0X2ZpZWxkOiBbCisgICAgICBuZXcgdHR5cGVzLlNpbXBsZSh7IHZhbHVlOiAiZCIgfSksCisgICAgICBuZXcgdHR5cGVzLlNpbXBsZSh7IHZhbHVlOiAiZSIgfSkKKyAgICBdLAorCisgICAgc3RydWN0X21hcF9maWVsZDogeworICAgICAgQTogbmV3IHR0eXBlcy5TaW1wbGUoeyB2YWx1ZTogImYiIH0pLAorICAgICAgQjogbmV3IHR0eXBlcy5TaW1wbGUoeyB2YWx1ZTogImciIH0pCisgICAgfSwKKworICAgIHN0cnVjdF9uZXN0ZWRfY29udGFpbmVyc19maWVsZDogWworICAgICAgWworICAgICAgICB7CisgICAgICAgICAgQzogWworICAgICAgICAgICAgbmV3IHR0eXBlcy5TaW1wbGUoeyB2YWx1ZTogImgiIH0pLAorICAgICAgICAgICAgbmV3IHR0eXBlcy5TaW1wbGUoeyB2YWx1ZTogImkiIH0pCisgICAgICAgICAgXQorICAgICAgICB9CisgICAgICBdCisgICAgXSwKKworICAgIHN0cnVjdF9uZXN0ZWRfY29udGFpbmVyc19maWVsZDI6IHsKKyAgICAgIEQ6IFsKKyAgICAgICAgeworICAgICAgICAgIERBOiBuZXcgdHR5cGVzLlNpbXBsZSh7IHZhbHVlOiAiaiIgfSkKKyAgICAgICAgfSwKKyAgICAgICAgeworICAgICAgICAgIERCOiBuZXcgdHR5cGVzLlNpbXBsZSh7IHZhbHVlOiAiayIgfSkKKyAgICAgICAgfQorICAgICAgXQorICAgIH0sCisKKyAgICBsaXN0X29mX2xpc3RfZmllbGQ6IFsKKyAgICAgIFsibDAwIiwgImwwMSIsICJsMDIiXSwKKyAgICAgIFsibDEwIiwgImwxMSIsICJsMTIiXSwKKyAgICAgIFsibDIwIiwgImwyMSIsICJsMjIiXQorICAgIF0sCisKKyAgICBsaXN0X29mX2xpc3Rfb2ZfbGlzdF9maWVsZDogWworICAgICAgWworICAgICAgICBbIm0wMDAiLCAibTAwMSIsICJtMDAyIl0sCisgICAgICAgIFsibTAxMCIsICJtMDExIiwgIm0wMTIiXSwKKyAgICAgICAgWyJtMDIwIiwgIm0wMjEiLCAibTAyMiJdCisgICAgICBdLAorICAgICAgWworICAgICAgICBbIm0xMDAiLCAibTEwMSIsICJtMTAyIl0sCisgICAgICAgIFsibTExMCIsICJtMTExIiwgIm0xMTIiXSwKKyAgICAgICAgWyJtMTIwIiwgIm0xMjEiLCAibTEyMiJdCisgICAgICBdLAorICAgICAgWworICAgICAgICBbIm0yMDAiLCAibTIwMSIsICJtMjAyIl0sCisgICAgICAgIFsibTIxMCIsICJtMjExIiwgIm0yMTIiXSwKKyAgICAgICAgWyJtMjIwIiwgIm0yMjEiLCAibTIyMiJdCisgICAgICBdCisgICAgXQorICB9KTsKK30KKworZnVuY3Rpb24gY3JlYXRlSnNPYmooKSB7CisgIHJldHVybiB7CisgICAgc3RydWN0X2ZpZWxkOiB7IHZhbHVlOiAiYSIgfSwKKworICAgIHN0cnVjdF9saXN0X2ZpZWxkOiBbeyB2YWx1ZTogImIiIH0sIHsgdmFsdWU6ICJjIiB9XSwKKworICAgIHN0cnVjdF9zZXRfZmllbGQ6IFt7IHZhbHVlOiAiZCIgfSwgeyB2YWx1ZTogImUiIH1dLAorCisgICAgc3RydWN0X21hcF9maWVsZDogeworICAgICAgQTogeyB2YWx1ZTogImYiIH0sCisgICAgICBCOiB7IHZhbHVlOiAiZyIgfQorICAgIH0sCisKKyAgICBzdHJ1Y3RfbmVzdGVkX2NvbnRhaW5lcnNfZmllbGQ6IFsKKyAgICAgIFsKKyAgICAgICAgeworICAgICAgICAgIEM6IFt7IHZhbHVlOiAiaCIgfSwgeyB2YWx1ZTogImkiIH1dCisgICAgICAgIH0KKyAgICAgIF0KKyAgICBdLAorCisgICAgc3RydWN0X25lc3RlZF9jb250YWluZXJzX2ZpZWxkMjogeworICAgICAgRDogWworICAgICAgICB7CisgICAgICAgICAgREE6IHsgdmFsdWU6ICJqIiB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICBEQjogeyB2YWx1ZTogImsiIH0KKyAgICAgICAgfQorICAgICAgXQorICAgIH0sCisKKyAgICBsaXN0X29mX2xpc3RfZmllbGQ6IFsKKyAgICAgIFsibDAwIiwgImwwMSIsICJsMDIiXSwKKyAgICAgIFsibDEwIiwgImwxMSIsICJsMTIiXSwKKyAgICAgIFsibDIwIiwgImwyMSIsICJsMjIiXQorICAgIF0sCisKKyAgICBsaXN0X29mX2xpc3Rfb2ZfbGlzdF9maWVsZDogWworICAgICAgWworICAgICAgICBbIm0wMDAiLCAibTAwMSIsICJtMDAyIl0sCisgICAgICAgIFsibTAxMCIsICJtMDExIiwgIm0wMTIiXSwKKyAgICAgICAgWyJtMDIwIiwgIm0wMjEiLCAibTAyMiJdCisgICAgICBdLAorICAgICAgWworICAgICAgICBbIm0xMDAiLCAibTEwMSIsICJtMTAyIl0sCisgICAgICAgIFsibTExMCIsICJtMTExIiwgIm0xMTIiXSwKKyAgICAgICAgWyJtMTIwIiwgIm0xMjEiLCAibTEyMiJdCisgICAgICBdLAorICAgICAgWworICAgICAgICBbIm0yMDAiLCAibTIwMSIsICJtMjAyIl0sCisgICAgICAgIFsibTIxMCIsICJtMjExIiwgIm0yMTIiXSwKKyAgICAgICAgWyJtMjIwIiwgIm0yMjEiLCAibTIyMiJdCisgICAgICBdCisgICAgXQorICB9OworfQorCitmdW5jdGlvbiBhc3NlcnRWYWx1ZXMob2JqLCBhc3NlcnQpIHsKKyAgYXNzZXJ0LmVxdWFscyhvYmouc3RydWN0X2ZpZWxkLnZhbHVlLCAiYSIpOworICBhc3NlcnQuZXF1YWxzKG9iai5zdHJ1Y3RfbGlzdF9maWVsZFswXS52Y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KKworICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oIlhjZXB0aW9uIiwgZnVuY3Rpb24oZXJyLCByZXNwb25zZSkgeworICAgICAgICBhc3NlcnQub2soCisgICAgICAgICAgZXJyIGluc3RhbmNlb2YgdHR5cGVzLlhjZXB0aW9uLAorICAgICAgICAgICJ0ZXN0RXhjZXB0aW9uOiBjb3JyZWN0IGVycm9yIHR5cGUiCisgICAgICAgICk7CisgICAgICAgIGFzc2VydC5vayghcmVzcG9uc2UsICJ0ZXN0RXhjZXB0aW9uOiBubyByZXNwb25zZSIpOworICAgICAgICBhc3NlcnQuZXF1YWwoZXJyLmVycm9yQ29kZSwgMTAwMSwgInRlc3RFeGNlcHRpb246IGNvcnJlY3QgZXJyb3IgY29kZSIpOworICAgICAgICBhc3NlcnQuZXF1YWwoCisgICAgICAgICAgIlhjZXB0aW9uIiwKKyAgICAgICAgICBlcnIubWVzc2FnZSwKKyAgICAgICAgICAidGVzdEV4Y2VwdGlvbjogY29ycmVjdCBlcnJvciBtZXNzYWdlIgorICAgICAgICApOworICAgICAgfSk7CisKKyAgICAgIGNsaWVudC50ZXN0RXhjZXB0aW9uKCJubyBFeGNlcHRpb24iLCBmdW5jdGlvbihlcnIsIHJlc3BvbnNlKSB7CisgICAgICAgIGFzc2VydC5lcnJvcihlcnIsICJ0ZXN0RXhjZXB0aW9uOiBubyBjYWxsYmFjayBlcnJvciIpOworICAgICAgICBhc3NlcnQub2soIXJlc3BvbnNlLCAidGVzdEV4Y2VwdGlvbjogbm8gcmVzcG9uc2UiKTsKKyAgICAgIH0pOworCisgICAgICBjbGllbnQudGVzdE9uZXdheSgwLCBmdW5jdGlvbihlcnIsIHJlc3BvbnNlKSB7CisgICAgICAgIGFzc2VydC5lcnJvcihlcnIsICJ0ZXN0T25ld2F5OiBubyBjYWxsYmFjayBlcnJvciIpOworICAgICAgICBhc3NlcnQuc3RyaWN0RXF1YWwocmVzcG9uc2UsIHVuZGVmaW5lZCwgInRlc3RPbmV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bmN0aW9uKHJlc3BvbnNlKSB7CisgICAgICAgICAgYXNzZXJ0LmVxdWFsKC0xLCByZXNwb25zZSk7CisgICAgICAgICAgYXNzZXJ0LmVuZCgpOworICAgICAgICAgIGRvbmUoKTsKKyAgICAgICAgfSkKKyAgICAgICAgLmNhdGNoKCgpID0+IGFzc2VydC5mYWlsKCJjaGVja09mZkJ5T25lIikpOworICAgIH0sIGNhbGxiYWNrKTsKKyAgfSk7Cit9OworCisvLyBIZWxwZXIgRnVuY3Rpb25zCisvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKworZnVuY3Rpb24gbWFrZVJlY3Vyc2l2ZUNoZWNrKGFzc2VydCkgeworICByZXR1cm4gZnVuY3Rpb24obWFwMSwgbWFwMiwgbXNnKSB7CisgICAgY29uc3QgZXF1YWwgPSBjaGVja1JlY3Vyc2l2ZWx5KG1hcDEsIG1hcDIpOworCisgICAgYXNzZXJ0Lm9rKGVxdWFsLCBtc2cpOworCisgICAgLy8gZGVlcEVxdWFsIGRvZXNuJ3Qgd29yayB3aXRoIGZpZWxkcyB1c2luZyBub2RlLWludDY0CisgICAgZnVuY3Rpb24gY2hlY2tSZWN1cnNpdmVseShtYXAxLCBtYXAyKSB7CisgICAgICBpZiAodHlwZW9mIG1hcDEgIT09ICJmdW5jdGlvbiIgJiYgdHlwZW9mIG1hcDIgIT09ICJmdW5jdGlvbiIpIHsKKyAgICAgICAgaWYgKCFtYXAxIHx8IHR5cGVvZiBtYXAxICE9PSAib2JqZWN0IikgeworICAgICAgICAgIC8vSGFuZGxlIGludDY0IHR5cGVzICh3aGljaCB1c2Ugbm9kZS1pbnQ2NCBpbiBOb2RlLmpzIEphdmFTY3JpcHQpCisgICAgICAgICAgaWYgKAorICAgICAgICAgICAgdHlwZW9mIG1hcDEgPT09ICJudW1iZXIiICYmCisgICAgICAgICAgICB0eXBlb2YgbWFwMiA9PT0gIm9iamVjdCIgJiYKKyAgICAgICAgICAgIG1hcDIuYnVmZmVyICYmCisgICAgICAgICAgICBtYXAyLmJ1ZmZlciBpbnN0YW5jZW9mIEJ1ZmZlciAmJgorICAgICAgICAgICAgbWFwMi5idWZmZXIubGVuZ3RoID09PSA4CisgICAgICAgICAgKSB7CisgICAgICAgICAgICBjb25zdCBuID0gbmV3IEludDY0KG1hcDIuYnVmZmVyKTsKKyAgICAgICAgICAgIHJldHVybiBtYXAxID09PSBuLnRvTnVtYmVyKCk7CisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBtYXAxID09IG1hcDI7CisgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhtYXAxKS5ldmVyeShmdW5jdGlvbihrZXkpIHsKKyAgICAgICAgICAgIHJldHVybiBjaGVja1JlY3Vyc2l2ZWx5KG1hcDFba2V5XSwgbWFwMltrZXldKTsKKyAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgfTsKK30KKworZnVuY3Rpb24gY2hlY2tPZmZCeU9uZShkb25lLCBjYWxsYmFjaykgeworICBjb25zdCByZXRyeV9saW1pdCA9IDMwOworICBjb25zdCByZXRyeV9pbnRlcnZhbCA9IDEwMDsKKyAgbGV0IHRlc3RfY29tcGxldGUgPSBmYWxzZTsKKyAgbGV0IHJldHJ5cyA9IDA7CisKKyAgLyoqCisgICAqIHJlZG8gYSBzaW1wbGUgdGVzdCBhZnRlciB0aGUgb25ld2F5IHRvIG1ha2Ugc3VyZSB3ZSBhcmVuJ3QgIm9mZiBieSBvbmUiIC0tCisgICAqIGlmIHRoZSBzZXJ2ZXIgdHJlYXRlZCBvbmV3YXkgdm9pZCBsaWtlIG5vcm1hbCB2b2lkLCB0aGlzIG5leHQgdGVzdCB3aWxsCisgICAqIGZhaWwgc2luY2UgaXQgd2lsbCBnZXQgdGhlIHZvaWQgY29uZmlybWF0aW9uIHJhdGhlciB0aGFuIHRo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LggLyBTcnBza2ksIFNlZWx0ZXJzaywgIiArCisgICAgIlN2ZW5za2EsIEtpc3dhaGlsaSwg4K6k4K6u4K6/4K604K+NLCDgsKTgsYbgsLLgsYHgsJfgsYEsINCi0L7St9C40LrToywg4LmE4LiX4LiiLCBUw7xya21lbsOnZSwgVGFnYWxvZywgIiArCisgICAgIlTDvHJrw6dlLCDQotCw0YLQsNGA0YfQsC9UYXRhcsOnYSwg0KPQutGA0LDRl9C90YHRjNC60LAsINin2LHYr9mILCBUaeG6v25nIFZp4buHdCwgVm9sYXDDvGssICIgKworICAgICJXYWxvbiwgV2luYXJheSwg5ZC06K+tLCBpc2lYaG9zYSwg15nXmda015PXmdepLCBZb3LDuWLDoSwgWmXDqnV3cywg5Lit5paHLCAiICsKKyAgICAiQsOibi1sw6JtLWfDuiwg57K16KqeIjsKKy8qanNoaW50ICtXMTAwICovCisKK2V4cG9ydCB2YXIgc3BlY2lhbENoYXJhY3RlcnMgPSAncXVvdGU6IFwiIGJhY2tzbGFzaDonICsKKyAgICAnIGZvcndhcmRzbGFzaC1lc2NhcGVkOiBcLyAnICsKKyAgICAnIGJhY2tzcGFjZTogXGIgZm9ybWZlZWQ6IFxmIG5ld2xpbmU6IFxuIHJldHVybjogXHIgdGFiOiAnICsKKyAgICAnIG5vdy1hbGwtb2YtdGhlbS10b2dldGhlcjogIlxcXC9cYlxuXHJcdCcgKworICAgICcgbm93LWEtYnVuY2gtb2YtanVuazogIUAjJCUmKCkoJiUkI3t9e308Pjw+PCcgKworICAgICcgY2hhci10by10ZXN0LWpzb24tcGFyc2luZzogXV0gXCJdXSBcXCIgfX19eyBbW1sgJzsKKworZXhwb3J0IHZhciBtYXBUZXN0SW5wdXQgPSB7CisgICJhIjoiMTIzIiwgImEgYiI6IndpdGggc3BhY2VzICIsICJzYW1lIjoic2FtZSIsICIwIjoibnVtZXJpYyBrZXkiLAorICAibG9uZ1ZhbHVlIjpzdHJpbmdUZXN0LCBzdHJpbmdUZXN0OiJsb25n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tPZmZCeU9uZTogbm8gY2FsbGJhY2sgZXJyb3IiKTsKKyAgICAgICAgYXNzZXJ0LmVxdWFsKC0xLCByZXNwb25zZSk7CisgICAgICAgIGFzc2VydC5lbmQoKTsKKyAgICAgICAgZG9uZSgpOworICAgICAgfSk7CisgICAgfSwgY2FsbGJhY2spOworCisgIH0pOworfTsKKworZXhwb3J0IGZ1bmN0aW9uIFRocmlmdFRlc3REcml2ZXJQcm9taXNlKGNsaWVudDogVGhyaWZ0VGVzdC5DbGllbnQsIGNhbGxiYWNrOiAoc3RhdHVzOiBzdHJpbmcpID0+IHZvaWQpIHsKKworICB0ZXN0KCJRIFByb21pc2UgQ2xpZW50IFRlc3RzIiwgZnVuY3Rpb24oYXNzZXJ0KSB7CisKKyAgICB2YXIgY2hlY2tSZWN1cnNpdmVseSA9IG1ha2VSZWN1cnNpdmVDaGVjayhhc3NlcnQpOworCisgICAgZnVuY3Rpb24gZmFpbChtc2c6IHN0cmluZykgeworICAgICAgcmV0dXJuIGZ1bmN0aW9uKGVycm9yLCByZXNwb25zZSkgeworICAgICAgICBpZiAoZXJyb3IgIT09IG51bGwpIHsKKyAgICAgICAgICBhc3NlcnQuZmFpbChtc2cpOworICAgICAgICB9CisgICAgICB9CisgICAgfQorCisgICAgZnVuY3Rpb24gbWFrZUFzc2VydGVyKGFzc2VydGlvbkZuOiAoYTogYW55LCBiOiBhbnksIG1zZz86IHN0cmluZykgPT4gdm9pZCkgeworICAgICAgcmV0dXJuIGZ1bmN0aW9uKGM6IChzdHJpbmcgfCBhbnkpW10pIHsKKyAgICAgICAgdmFyIGZuTmFtZSA9IGNbMF07CisgICAgICAgIHZhciBleHBlY3RlZCA9IGNbMV07CisgICAgICAgICg8YW55PmNsaWVudClbZm5OYW1lXShleHBlY3RlZCkKKyAgICAgICAgICAudGhlbihmdW5jdGlvbihhY3R1YWw6IGFueSkgeworICAgICAgICAgICAgYXNzZXJ0aW9uRm4oYWN0dWFsLCBleHBlY3RlZCwgZm5OYW1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RPbmV3YXk6IHNob3VsZCBub3QgYW5zd2VyIikpOworCisgICAgY2hlY2tPZmZCeU9uZShmdW5jdGlvbihkb25lKSB7CisgICAgICBRLnJlc29sdmUoY2xpZW50LnRlc3RJMzIoLTEpKQorICAgICAgICAudGhlbihmdW5jdGlvbihyZXNwb25zZSkgeworICAgICAgICAgICAgYXNzZXJ0LmVxdWFsKC0xLCByZXNwb25zZSk7CisgICAgICAgICAgICBhc3NlcnQuZW5kKCk7CisgICAgICAgICAgICBkb25lKCk7CisgICAgICAgIH0pCisgICAgICAgIC5mYWlsKGZhaWwoImNoZWNrT2ZmQnlPbmUiKSk7CisgICAgfSwgY2FsbGJhY2spOworICB9KTsKK307CisKKworLy8gSGVscGVyIEZ1bmN0aW9ucworLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CisKK2Z1bmN0aW9uIG1ha2VSZWN1cnNpdmVDaGVjayhhc3NlcnQ6IHRlc3QuVGVzdCkgeworCisgIHJldHVybiBmdW5jdGlvbiAobWFwMTogYW55LCBtYXAyOiBhbnksIG1zZzogc3RyaW5nKSB7CisgICAgdmFyIGVxdWFsID0gdHJ1ZTsKKworICAgIHZhciBlcXVhbCA9IGNoZWNrUmVjdXJzaXZlbHkobWFwMSwgbWFwMik7CisKKyAgICBhc3NlcnQub2soZXF1YWwsIG1zZyk7CisKKyAgICAvLyBkZWVwRXF1YWwgZG9lc24ndCB3b3JrIHdpdGggZmllbGRzIHVzaW5nIG5vZGUtaW50NjQKKyAgICBmdW5jdGlvbiBjaGVja1JlY3Vyc2l2ZWx5KG1hcDE6IGFueSwgbWFwMjogYW55KSA6IGJvb2xlYW4geworICAgICAgaWYgKCEodHlwZW9mIG1hcDEgIT09ICJmdW5jdGlvbiIgJiYgdHlwZW9mIG1hcDIgIT09ICJmdW5jdGlvbiIpKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKyAgICAgIGlmICghbWFwMSB8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mVzb2x2ZTx2b2lkPih1bmRlZmluZWQpOworICB9CisgIHRlc3RNYXBNYXAoaGVsbG86IG51bWJlcikgeworICAgIC8vY29uc29sZS5sb2coJ3Rlc3RNYXBNYXAoJyArIGhlbGxvICsgJyknKTsKKworICAgIHZhciBtYXBtYXA6IHtba2V5OiBudW1iZXJdOiB7W2tleTogbnVtYmVyXTogbnVtYmVyOyB9fSA9IFtdOworICAgIHZhciBwb3M6IHtba2V5OiBudW1iZXJdOiBudW1iZXI7IH0gPSBbXTsKKyAgICB2YXIgbmVnOiB7W2tleTogbnVtYmVyXTogbnVtYmVyOyB9ID0gW107CisgICAgZm9yICh2YXIgaSA9IDE7IGkgPCA1OyBpKyspIHsKKyAgICAgIHBvc1tpXSA9IGk7CisgICAgICBuZWdbLWldID0gLWk7CisgICAgfQorICAgIG1hcG1hcFs0XSA9IHBvczsKKyAgICBtYXBtYXBbLTRdID0gbmVnOworCisgICAgcmV0dXJuIFEucmVzb2x2ZShtYXBtYXApOworICB9CisgIHRlc3RJbnNhbml0eShhcmd1bWVudDogdHR5cGVzLkluc2FuaXR5KTogUS5JUHJvbWlzZTx7IFtrOiBudW1iZXJdOiBhbnk7IH0+IHsKKyAgICBjb25zdCBmaXJzdF9tYXA6IHsgW2s6IG51bWJlcl06IGFueTsgfSA9IFtdOworICAgIGNvbnN0IHNlY29uZF9tYXA6IHsgW2s6IG51bWJlcl06IGFueTsgfSA9IFtdOworICAKKyAgICBmaXJzdF9tYXBbdHR5cGVzLk51bWJlcnouVFdPXSA9IGFyZ3VtZW50OworICAgIGZpcnN0X21hcFt0dHlwZXMuTnVtYmVyei5USFJFRV0gPSBhcmd1bWVudDsKKyAgCisgICAgY29uc3QgbG9vbmV5ID0gbmV3IHR0eXBlcy5JbnNhbml0eSgpOworICAgIHNlY29uZF9tYXBbdHR5cGVzLk51bWJlcnouU0lYXSA9IGxvb25leTsKKyAgCisgICAgY29uc3QgaW5zYW5lOiB7IFtrOiBudW1iZXJdOiBhbnk7I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AgICB2YXIgeCA9IG5ldyB0dHlwZXMuWGNlcHRpb24oKTsKKyAgICAgIHguZXJyb3JDb2RlID0gMTAwMTsKKyAgICAgIHgubWVzc2FnZSA9ICdUaGlzIGlzIGFuIFhjZXB0aW9uJzsKKyAgICAgIHRocm93IHg7CisgICAgfSBlbHNlIGlmIChhcmcwID09PSAoJ1hjZXB0aW9uMicpKSB7CisgICAgICB2YXIgeDIgPSBuZXcgdHR5cGVzLlhjZXB0aW9uMigpOworICAgICAgeDIuZXJyb3JDb2RlID0gMjAwMjsKKyAgICAgIHgyLnN0cnVjdF90aGluZyA9IG5ldyB0dHlwZXMuWHRydWN0KCk7CisgICAgICB4Mi5zdHJ1Y3RfdGhpbmcuc3RyaW5nX3RoaW5nID0gJ1RoaXMgaXMgYW4gWGNlcHRpb24yJzsKKyAgICAgIHRocm93IHgyOworICAgIH0KKworICAgIHZhciByZXMgPSBuZXcgdHR5cGVzLlh0cnVjdCgpOworICAgIHJlcy5zdHJpbmdfdGhpbmcgPSBhcmcxOworICAgIHJldHVybiBRLnJlc29sdmUocmVzKTsKKyAgfQorICB0ZXN0T25ld2F5KHNsZWVwRm9yOiBudW1iZXIpIHsKKyAgfQorCisgIHRlc3RTdHJpbmcodGhpbmc6IHN0cmluZykgeworICAgIHJldHVybiBRLnJlc29sdmUodGhpbmcpOworICB9CisgIHRlc3RCb29sKHRoaW5nOiBib29sZWFuKSB7CisgICAgcmV0dXJuIFEucmVzb2x2ZSh0aGluZyk7CisgIH0KKyAgdGVzdEJ5dGUodGhpbmc6IG51bWJlcikgeworICAgIHJldHVybiBRLnJlc29sdmUodGhpbmcpOworICB9CisgIHRlc3RJMzIodGhpbmc6IG51bWJlcikgeworICAgIHJldHVybiBRLnJlc29sdmUodGhpbmcpOworICB9CisgIHRlc3RJNjQodGhpbmc6IG51bWJlcikgeworICAgIHJldHVybiBRLnJlc29sdmUodGhpbmcpOworICB9CisgIHRlc3REb3VibGUodGhpbmc6IG51bWJlcikgeworICAgIHJ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VzLk51bWJlcnopID0+IHZvaWQpOiBRLklQcm9taXNlPHR0eXBlcy5OdW1iZXJ6PiB7CisgICAgY2FsbGJhY2sobnVsbCwgdGhpbmcpOworICAgIHJldHVybiBRLnJlc29sdmUoKTsKKyAgfQorICB0ZXN0VHlwZWRlZih0aGluZzogbnVtYmVyLCBjYWxsYmFjazogKGVycjogYW55LCByZXN1bHQ6IG51bWJlcikgPT4gdm9pZCk6IFEuSVByb21pc2U8bnVtYmVyPiB7CisgICAgY2FsbGJhY2sobnVsbCwgdGhpbmcpOworICAgIHJldHVybiBRLnJlc29sdmUoKTsKKyAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL25vZGV0cy90ZXN0L3RzY29uZmlnLmpzb24gYi9saWIvbm9kZXRzL3Rlc3QvdHNjb25maWcuanNvbgpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4wMjlkMDZkCi0tLSAvZGV2L251bGwKKysrIGIvbGliL25vZGV0cy90ZXN0L3RzY29uZmlnLmpzb24KQEAgLTAsMCArMSwyMiBAQAoreworICAgICJjb21waWxlck9wdGlvbnMiOiB7CisgICAgICAgICJhbGxvd0pzIjogZmFsc2UsCisgICAgICAgICJhbHdheXNTdHJpY3QiOiB0cnVlLAorICAgICAgICAiYmFzZVVybCI6ICIuIiwKKyAgICAgICAgImRlY2xhcmF0aW9uIjogdHJ1ZSwKKyAgICAgICAgImVtaXREZWNvcmF0b3JNZXRhZGF0YSI6IHRydWUsCisgICAgICAgICJleHBlcmltZW50YWxEZWNvcmF0b3JzIjogdHJ1ZSwKKyAgICAgICAgIm1vZHVsZSI6ICJjb21tb25qcyIsCisgICAgICAgICJtb2R1bGVSZXNvbHV0aW9uIjogIm5vZGUiLAorICAgICAgICAibm9JbXBsaWNpdFRoaXMiOiB0cnVlLAorICAgICAgICAibm9VbnVzZWRMb2NhbHMiOiB0cnVlLAorICAgICAgICAicHJlc2VydmVDb25zdEVudW1zIjogdHJ1ZSwKKyAgICAgIC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kbD0lX3N0dWJzLiQoRVhUX09CSikpCi1BVVRPX0lETCAgICAgOj0gJChGSUxURVJFRF9JREw6LmlkbD0ubWxpKSAkKEZJTFRFUkVEX0lETDouaWRsPS5tbCkgJChDX0lETCkKLQotRklMVEVSRURfT1hSSURMIDo9ICQoZmlsdGVyICUub3hyaWRsLCAkKEZJTFRFUkVEKSkKLURFUF9PWFJJREwgICAgICA6PSAkKEZJTFRFUkVEX09YUklETDolLm94cmlkbD0kKE1MREVQRElSKS8lLmQpICQoRklMVEVSRURfT1hSSURMOi5veHJpZGw9LmRpKQotQVVUT19PWFJJREwgICAgIDo9ICQoRklMVEVSRURfT1hSSURMOi5veHJpZGw9Lm1saSkgJChGSUxURVJFRF9PWFJJREw6Lm94cmlkbD0ubWwpICQoQ19PWFJJREwpCi0KLUZJTFRFUkVEX0NfQ1hYIDo9ICQoZmlsdGVyICUuYyAlLm0gJS4kKEVYVF9DWFgpLCAkKEZJTFRFUkVEKSkKLU9CSl9DX0NYWCAgICAgIDo9ICQoRklMVEVSRURfQ19DWFg6LmM9LiQoRVhUX09CSikpCi1PQkpfQ19DWFggICAgICA6PSAkKE9CSl9DX0NYWDoubT0uJChFWFRfT0JKKSkKLU9CSl9DX0NYWCAgICAgIDo9ICQoT0JKX0NfQ1hYOi4kKEVYVF9DWFgpPS4kKEVYVF9PQkopKQotCi1QUkVfVEFSR0VUUyAgKz0gJChBVVRPX01MTCkgJChBVVRPX01MWSkgJChBVVRPX0lETCkgJChBVVRPX09YUklETCkgJChBVVRPX1pPRykgJChBVVRPX1JFUCkgJChBVVRPX0dMQURFKQotCi1BTExfREVQUyAgICAgOj0gJChERVBfTUwpICQoREVQX01MSSkgJChERVBfTUxMKSAkKERFUF9NTFkpICQoREVQX0lETCkgJChERVBfT1hSSURMKSAkKERFUF9aT0cpICQoREVQX1JFUCkgJChERVBfR0xBREUpCi0KLU1MREVQUyAgICAgICA6PSAkKGZpbHRlciAlLmQsICQoQUxMX0RFUFMpKQotTUxJREVQUyAgICAgIDo9ICQoZmlsdGVyICUuZGksICQoQUxMX0RFUFMpKQotQkNERVBJUyAgICAgIDo9ICQoTUxJREVQUzolLmRpPSQoQkNESURJUikvJS5kaSkKLU5DREVQSVMgICAgICA6PSAkKE1MSURFUFM6JS5kaT0kKE5DRElESVIpLyUuZGkpCi0KLUFMTE1MICAgICAgICA6PSAkKGZpbHRlciAlLm1saSAlLm1sICUubWxsICUubWx5ICUuaWRsICUub3hyaWRsICUucmVwICUuem9nICUuZ2xhZGUsICQoRklMVEVSRUQpKQotCi1JTVBMT19JTlRGICAgOj0gJChBTExNTDolLm1saT0lLm1saS5fXykKLUlNUExPX0lOVEYgICA6PSAkKGZvcmVhY2ggZmlsZSwgJChJTVBMT19JTlRGKSwgXAotICAgICAgICAgICAgICAgICAgJChiYXNlbmFtZSAkKGZpbGUpKS5jbWkgJChiYXNlbmFtZSAkKGZpbGUpKS5jbW8pCi1JTVBMT19JTlRGICAgOj0gJChmaWx0ZXItb3V0ICUubWxpLmNtbywgJChJTVBMT19JTlRGKSkKLUlNUExPX0lOVEYgICA6PSAkKElNUExPX0lOVEY6JS5tbGkuY21pPSUuY21pKQotCi1JTVBMWF9JTlRGICAgOj0gJChJTVBMT19JTlRGOi5jbW89LmNteCkKLQotSU5URiAgICAgICAgIDo9ICQoZmlsdGVyICUuY21pLCAkKElNUExPX0lOVEYpKQotSU1QTF9DTU8gICAgIDo9ICQoZmlsdGVyICUuY21vLCAkKElNUExPX0lOVEYpKQotSU1QTF9DTVggICAgIDo9ICQoSU1QTF9DTU86LmNtbz0uY214KQotSU1QTF9BU00gICAgIDo9ICQoSU1QTF9DTU86LmNtbz0uYXNtKQotSU1QTF9TICAgICAgIDo9ICQoSU1QTF9DTU86LmNtbz0ucykKLQotT0JKX0xJTksgICAgIDo9ICQoT0JKX0NfSURMKSAkKE9CSl9DX0NYWCkKLU9CSl9GSUxFUyAgICA6PSAkKElNUExfQ01POi5jbW89LiQoRVhUX09CSikpICQoT0JKX0xJ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LSAgKiBFWFRMSUJESVJTICAgIC0gU2FtZSBhcyAiTElCRElSUyIsIGJ1dCBwYXRocyBpbiB0aGlzIHZhcmlhYmxlIGFyZQotICAgICAgICAgICAgICAgICAgICBhbHNvIGFkZGVkIHRvIHRoZSBiaW5hcnkgdmlhIHRoZSAiLVIiLWZsYWcgc28gdGhhdAotICAgICAgICAgICAgICAgICAgICBkeW5hbWljIGxpYnJhcmllcyBpbiBub24tc3RhbmRhcmQgcGxhY2VzIGNhbiBiZSBmb3VuZC4KLSAgKiBSRVNVTFRERVBTICAgIC0gVGFyZ2V0cyBvbiB3aGljaCByZXN1bHRzIChleGVjdXRhYmxlcyBvciBsaWJyYXJpZXMpCi0gICAgICAgICAgICAgICAgICAgIHNob3VsZCBhZGRpdGlvbmFsbHkgZGVwZW5kLgotCi0gICogUEFDS1MgICAgICAgICAtIGFkZHMgcGFja2FnZXMgdW5kZXIgY29udHJvbCBvZiAiZmluZGxpYiIuCi0KLSAgKiBQUkVEUyAgICAgICAgIC0gc3BlY2lmaWVzICJmaW5kbGliIi1wcmVkaWNhdGVzLgotCi0gICogTElCUyAgICAgICAgICAtIE9DYW1sLWxpYnJhcmllcyB0aGF0IHNob3VsZCBiZSBsaW5rZWQgKGp1c3QgcGxhaW4gbmFtZXMpLgotICAgICAgICAgICAgICAgICAgICBFLmcuIGlmIHlvdSB3YW50IHRvIGxpbmsgdGhlIFN0ci1saWJyYXJ5LCBqdXN0IHdyaXRlCi0gICAgICAgICAgICAgICAgICAgICJzdHIiICh3aXRob3V0IHF1b3RlcykuCi0gICAgICAgICAgICAgICAgICAgIFRoZSBuZXcgT0NhbWwtY29tcGlsZXIgaGFuZGxlcyBsaWJyYXJpZXMgaW4gc3VjaAotICAgICAgICAgICAgICAgICAgICBhIHdheSB0aGF0IHRoZXkgInJlbWVtYmVyIiB3aGV0aGVyIHRoZXkgaGF2ZSB0bwotICAgICAgICAgICAgICAgICAgICBiZSBsaW5rZWQgYWdhaW5zdCBhIEMtbGlic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ICAgICAgICAgICAgICAgICAgICBiZWZvcmUgb3RoZXIgbW9kdWxlcyBjYW4gYmUgcGFyc2VkIGF0IGFsbC4KLQotICAgICAgICAgICAgICAgICAgICAqKiBXQVJOSU5HICoqOiB0aGUgZmlsZXMgbWVudGlvbmVkIGluIHRoaXMgdmFyaWFibGUKLSAgICAgICAgICAgICAgICAgICAgd2lsbCBiZSByZW1vdmVkIHdoZW4gIm1ha2UgY2xlYW4iIGlzIGV4ZWN1dGVkIQotCi0gICogTElCSU5TVEFMTF9GSUxFUyAtIHRoZSBmaWxlcyBvZiBhIGxpYnJhcnkgdGhhdCBzaG91bGQgYmUgaW5zdGFsbGVkCi0gICAgICAgICAgICAgICAgICAgICAgIHVzaW5nICJmaW5kbGliIi4gRGVmYXVsdDoKLQotICAgICAgICAgICAgICAgICAgICAgICAgICQoUkVTVUxUKS5tbGkgJChSRVNVTFQpLmNtaSAkKFJFU1VMVCkuY21hCi0gICAgICAgICAgICAgICAgICAgICAgICAgJChSRVNVTFQpLmNteGEgJChSRVNVTFQpLmEgbGliJChSRVNVTFQpLmEKLQotICAqIE9DQU1MX0xJQl9JTlNUQUxMIC0gdGFyZ2V0IGRpcmVjdG9yeSBmb3IgInJhd2luc3RhbGwvcmF3dW5pbnN0YWxsIi4KLSAgICAgICAgICAgICAgICAgICAgICAgIChkZWZhdWx0OiAkKE9DQU1MTElCUEFUSCkvY29udHJpYikKLQotICAqIERPQ19GSUxFUyAgICAgLSBuYW1lcyBvZiBmaWxlcyBmcm9tIHdoaWNoIGRvY3VtZW50YXRpb24gaXMgZ2VuZXJhdGVkLgotICAgICAgICAgICAgICAgICAgICAoZGVmYXVsdDogYWxsIC5tbGktZmlsZXMgaW4geW91ciAkKFNPVVJDRVMpKS4KLQotICAqIERPQ19ESVIgICAgICAgLSBuYW1lIG9mIGRpcmVjdG9yeSB3aGVyZSBkb2N1bWVudGF0aW9uIHNob3VsZCBiZSBzdG9yZWQuCi0KLSAgKiBPQ0FNTEZMQUdTICA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QotICAqIE9DQU1MRklORF9JTlNURkxBR1MgLSBmbGFncyBwYXNzZWQgdG8gIm9jYW1sZmluZCIgZHVyaW5nIGluc3RhbGxhdGlvbgotICAgICAgICAgICAgICAgICAgICAgICAgICAoZGVmYXVsdDogbm9uZSkKLQotICAqIERWSVBTRkxBR1MgICAgLSBmbGFncyBwYXNzZWQgdG8gZHZpcHMKLSAgICAgICAgICAgICAgICAgICAgKHdoZW4gZ2VuZXJhdGluZyBkb2N1bWVudGF0aW9uIGluIFBvc3RTY3JpcHQpLgotCi0gICogU1RBVElDICAgICAgICAtIHNldCB0aGlzIHZhcmlhYmxlIGlmIHlvdSB3YW50IHRvIGZvcmNlIGNyZWF0aW9uCi0gICAgICAgICAgICAgICAgICAgIG9mIHN0YXRpYyBsaWJyYXJpZXMKLQotICAqIENDICAgICAgICAgICAgLSB0aGUgQy1jb21waWxlciB0byBiZSB1c2VkCi0gICogQ1hYICAgICAgICAgICAtIHRoZSBDKystY29tcGlsZXIgdG8gYmUgdXNlZAotCi0gICogQ0ZMQUdTICAgICAgICAtIGFkZGl0aW9uYWwgZmxhZ3MgcGFzc2VkIHRvIHRoZSBDLWNvbXBpbGVyLgotICAgICAgICAgICAgICAgICAgICBUaGUgZmxhZyAiLUROQVRJVkVfQ09ERSIgd2lsbCBiZSBwYXNzZWQgYXV0b21hdGljYWxseQotICAgICAgICAgICAgICAgICAgICBpZiB5b3UgY2hvb3NlIHRvIGJ1aWxkIG5hdGl2ZSBjb2RlLiBUaGlzIGFsbG93cyB5b3UKLSAgICAgICAgICAgICAgICAgICAgdG8gY29tcGlsZSB5b3VyIEMtZmlsZXMgY29uZGl0aW9uYWxseS4gQnV0IHBsZWFzZQotICAgICAgICAgICAgICAgICAgICBub3RlOiBZb3Ugc2hvdWxkIGRvIGEgIm1ha2UgY2xlYW4iIG9yIHJlbW92ZSB0aGUKLSAgICAgICAgICAgICAgICAgICAgb2JqZWN0IGZpbGVzIG1hbnVhbGx5IG9yIHRvdWNoIHRo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sIGNvbXBpbGVyICAgICAgICAgICAoZGVmYXVsdDogIm9jYW1sbWt0b3AiKQotICAqIE9DQU1MQ1AgICAgICAgLSBwcm9maWxpbmcgYnl0ZS1jb2RlIGNvbXBpbGVyIChkZWZhdWx0OiAib2NhbWxjcCIpCi0gICogT0NBTUxERVAgICAgICAtIGRlcGVuZGVuY3kgZ2VuZXJhdG9yICAgICAgICAgKGRlZmF1bHQ6ICJvY2FtbGRlcCIpCi0gICogT0NBTUxMRVggICAgICAtIHNjYW5uZXIgZ2VuZXJhdG9yICAgICAgICAgICAgKGRlZmF1bHQ6ICJvY2FtbGxleCIpCi0gICogT0NBTUxZQUNDICAgICAtIHBhcnNlciBnZW5lcmF0b3IgICAgICAgICAgICAgKGRlZmF1bHQ6ICJvY2FtbHlhY2MiKQotICAqIE9DQU1MTUtMSUIgICAgLSB0b29sIHRvIGNyZWF0ZSBsaWJyYXJpZXMgICAgIChkZWZhdWx0OiAib2NhbWxta2xpYiIpCi0gICogQ0FNTElETCAgICAgICAtIElETC1jb2RlIGdlbmVyYXRvciAgICAgICAgICAgKGRlZmF1bHQ6ICJjYW1saWRsIikKLSAgKiBDQU1MSURMRExMICAgIC0gSURMLXV0aWxpdHkgICAgICAgICAgICAgICAgICAoZGVmYXVsdDogImNhbWxpZGxkbGwiKQotICAqIENBTUxQNCAgICAgICAgLSBjYW1scDQgcHJlcHJvY2Vzc29yICAgICAgICAgIChkZWZhdWx0OiAiY2FtbHA0IikKLSAgKiBPQ0FNTERPQyAgICAgIC0gT0NhbWxkb2MtY29tbWFuZCAgICAgICAgICAgICAoZGVmYXVsdDogIm9jYW1sZG9jIikKLQotICAqIExBVEVYICAgICAgICAgLSBMYXRleC1wcm9jZXNzb3IgICAgICAgICAgICAgIChkZWZhdWx0OiAibGF0ZXgiKQotICAqIERWSVBTICAgICAgICAgLSBkdmlwcy1jb21tYW5kICAgICAgICAgICAgICAgIChkZWZhdWx0OiAiZHZpcHMiKQotICAqIFBTMlBERiAgICAgICA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wogCit1c2UgNS4xMC4wOwordXNlIHN0cmljdDsKK3VzZSB3YXJuaW5nczsKKwogdXNlIEV4dFV0aWxzOjpNYWtlTWFrZXI7Ci1Xcml0ZU1ha2VmaWxlKCAnTkFNRScgPT4gJ1RocmlmdCcsCi0gICAgICAgICAgICAgICAnVkVSU0lPTl9GUk9NJyA9PiAnbGliL1RocmlmdC5wbScsCi0gICAgICAgICAgICAgICAnUFJFUkVRX1BNJyAgICAgICAgICAgICAgPT4gewotICAgICAgICAgICAgICAgICAgICdCaXQ6OlZlY3RvcicgPT4gMCwKKworV3JpdGVNYWtlZmlsZSggQUJTVFJBQ1QgPT4gJ0FwYWNoZSBUaHJpZnQgaXMgYSBzb2Z0d2FyZSBmcmFtZXdvcmsgZm9yIHNjYWxhYmxlIGNyb3NzLWxhbmd1YWdlIHNlcnZpY2VzIGRldmVsb3BtZW50LicsCisgICAgICAgICAgICAgICBBVVRIT1IgPT4gJ0FwYWNoZSBUaHJpZnQgPGRldkB0aHJpZnQuYXBhY2hlLm9yZz4nLAorICAgICAgICAgICAgICAgTElDRU5TRSA9PiAnYXBhY2hlXzJfMCcsCisgICAgICAgICAgICAgICBNSU5fUEVSTF9WRVJTSU9OID0+ICc1LjAxMDAwMCcsCisgICAgICAgICAgICAgICBOQU1FID0+ICdUaHJpZnQnLAorICAgICAgICAgICAgICAgTkVFRFNfTElOS0lORyA9PiAwLAorICAgICAgICAgICAgICAgUFJFUkVRX1BNID0+IHsKKyAgICAgICAgICAgICAgICAgICAnQml0OjpWZWN0b3InICAgICA9PiAwLAogICAgICAgICAgICAgICAgICAgICdDbGFzczo6QWNjZXNzb3InID0+IDAKICAgICAgICAgICAgICAgIH0sCi0gICAgICAgICAgICAgICAoJF0gPj0gNS4wMDUgPwotICggICAgICAgICAgICAgICAgQVVUSE9SICAgICA9PiAnQXBhY2hlIFRocmlmdCA8ZGV2QHRocmlmdC5hcGFjaGUub3JnPicpIDogKCkpLAotICAgICAgICAgICAgICAgKTsKKyAgIC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sIFwkZnR5cGUsIFwkZmlkKTsKLSAgICAgICAgaWYgKCRmdHlwZSA9PSBUVHlwZTo6U1RPUCkgewotICAgICAgICAgICAgbGFzdDsgbmV4dDsKLSAgICAgICAgfQotCi0gICAgICBTV0lUQ0g6IGZvcigkZmlkKQotICAgICAgewotICAgICAgICAgIC8xLyAmJiBkb3sKLQotICAgICAgICAgICAgICBpZiAoJGZ0eXBlID09IFRUeXBlOjpTVFJJTkcpIHsKLSAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFN0cmluZyhcJHNlbGYtPnttZXNzYWdlfSk7Ci0gICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnNraXAoJGZ0eXBlKTsKLSAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgIGxhc3Q7Ci0gICAgICAgICAgfTsKLQotICAgICAgICAgIC8yLyAmJiBkb3sKLSAgICAgICAgICAgICAgaWYgKCRmdHlwZSA9PSBUVHlwZTo6STMyKSB7Ci0gICAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRJMzIoXCRzZWxmLT57Y29kZX0pOwotICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5za2lwKCRmdHlwZSk7Ci0gICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgbGFzdDsKLSAgICAgICAgICB9OwotCi0gICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5za2lwKCRmdHlwZSk7Ci0gICAgICB9Ci0KLSAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZEZpZWxkRW5kKCk7Ci0gICAgfQotICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFN0cnVjdEVuZCgpOwotCi0gICAgcmV0dXJuICR4ZmVyOwotfQotCi1zdWIgd3JpdGUgewotICAgIG15ICRzZWxmICAgPSBzaGlmdDsKLSAgICB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ZiwkY2xhc3NuYW1lKTsKK30KKworc3ViIHJlYWQgeworICAgIG15ICRzZWxmICA9IHNoaWZ0OworICAgIG15ICRpbnB1dCA9IHNoaWZ0OworCisgICAgbXkgJHhmZXIgID0gMDsKKyAgICBteSAkZm5hbWUgPSB1bmRlZjsKKyAgICBteSAkZnR5cGUgPSAwOworICAgIG15ICRmaWQgICA9IDA7CisKKyAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRTdHJ1Y3RCZWdpbihcJGZuYW1lKTsKKworICAgIHdoaWxlICgxKQorICAgIHsKKyAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkRmllbGRCZWdpbihcJGZuYW1lLCBcJGZ0eXBlLCBcJGZpZCk7CisgICAgICAgIGlmICgkZnR5cGUgPT0gVGhyaWZ0OjpUVHlwZTo6U1RPUCkgeworICAgICAgICAgICAgbGFzdDsgbmV4dDsKKyAgICAgICAgfQorCisgICAgICBTV0lUQ0g6IGZvcigkZmlkKQorICAgICAgeworICAgICAgICAgIC8xLyAmJiBkb3sKKworICAgICAgICAgICAgICBpZiAoJGZ0eXBlID09IFRocmlmdDo6VFR5cGU6OlNUUklORykgeworICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkU3RyaW5nKFwkc2VsZi0+e21lc3NhZ2V9KTsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+c2tpcCgkZnR5cGUpOworICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgbGFzdDsKKyAgICAgICAgICB9OworCisgICAgICAgICAgLzIvICYmIGRveworICAgICAgICAgICAgICBpZiAoJGZ0eXBlID09IFRocmlmdDo6VFR5cGU6OkkzMikgeworICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkSTMyKFwkc2VsZi0+e2NvZGV9KTsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+c2tpcCgkZnR5cGUpOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIGxhc3Q7CisgICAgICAgICAgfTsKKworICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+c2tpcCgkZnR5cGUpOworICAgICAgfQorCisgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRGaWVsZEVuZCgpOworICAgIH0KKyAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRTdHJ1Y3RFbmQoKTsKKworICAgIHJldHVybiAkeGZlcjsKK30KKworc3ViIHdyaXRlIHsKKyAgICBteSAkc2VsZiAgID0gc2hpZnQ7CisgICAgbXkgJG91dHB1dCA9IHNoaWZ0OworCisgICAgbXkgJHhmZXIgICA9IDA7CisKKyAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZVN0cnVjdEJlZ2luKCdUQXBwbGljYXRpb25FeGNlcHRpb24nKTsKKworICAgIGlmICgkc2VsZi0+Z2V0TWVzc2FnZSgpKSB7CisgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlRmllbGRCZWdpbignbWVzc2FnZScsIFRocmlmdDo6VFR5cGU6OlNUUklORywgMSk7CisgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlU3RyaW5nKCRzZWxmLT5nZXRNZXNzYWdlKCkpOworICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZUZpZWxkRW5kKCk7CisgICAgfQorCisgICAgaWYgKCRzZWxmLT5nZXRDb2RlKCkpIHsKKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVGaWVsZEJlZ2luKCd0eXBlJywgVGhyaWZ0OjpUVHlwZTo6STMyLCAyKTsKKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVJMzIoJHNlbGYtPmdldENvZGUoKSk7CisgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlRmll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R5cGUgPSAwOwotICAgICAgICAgIG15ICRmaWQgPSAwOwotICAgICAgICAgIG15ICRkYXRhID0gJGl0cmFucy0+cmVhZEFsbCgxKTsKLSAgICAgICAgICBteSBAYXJyID0gdW5wYWNrKCdjJywgJGRhdGEpOwotICAgICAgICAgICRmdHlwZSA9ICRhcnJbMF07Ci0gICAgICAgICAgaWYgKCRmdHlwZSA9PSBUVHlwZTo6U1RPUCkgewotICAgICAgICAgICAgbGFzdDsKLSAgICAgICAgICB9Ci0gICAgICAgICAgIyBJMTYgZmllbGQgaWQKLSAgICAgICAgICAkcmVzdWx0ICs9ICRpdHJhbnMtPnJlYWRBbGwoMik7Ci0gICAgICAgICAgJHJlc3VsdCArPSAkc2VsZi0+c2tpcEJpbmFyeSgkaXRyYW5zLCAkZnR5cGUpOworICAgICAgICAgICAgbXkgJGZ0eXBlID0gMDsKKyAgICAgICAgICAgIG15ICRmaWQgPSAwOworICAgICAgICAgICAgbXkgJGRhdGEgPSAkaXRyYW5zLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgbXkgQGFyciA9IHVucGFjaygnYycsICRkYXRhKTsKKyAgICAgICAgICAgICRmdHlwZSA9ICRhcnJbMF07CisgICAgICAgICAgICBpZiAoJGZ0eXBlID09IFRocmlmdDo6VFR5cGU6OlNUT1ApIHsKKyAgICAgICAgICAgICAgICBsYXN0OworICAgICAgICAgICAgfQorICAgICAgICAgICAgIyBJMTYgZmllbGQgaWQKKyAgICAgICAgICAgICRyZXN1bHQgKz0gJGl0cmFucy0+cmVhZEFsbCgyKTsKKyAgICAgICAgICAgICRyZXN1bHQgKz0gJHNlbGYtPnNraXBCaW5hcnkoJGl0cmFucywgJGZ0eXBlKTsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gJHJlc3VsdDsKICAgICB9Ci0gICAgZWxzaWYoJHR5cGUgPT0gVFR5cGU6Ok1BUCkKKyAgICBlbHNpZigkdHlwZSA9PSBUaHJpZnQ6OlRUeXBlOjpNQVApCiAgICAgewog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BzaGlmdDsKKyAgICBteSAkYm9vbCA9IHNoaWZ0OworCisgICAgcmV0dXJuICRzZWxmLT57Y29uY3JldGVQcm90b2NvbH0tPndyaXRlQm9vbCgkYm9vbCk7Cit9CisKK3N1YiB3cml0ZUJ5dGUgeworICAgIG15ICRzZWxmID0gc2hpZnQ7CisgICAgbXkgJGJ5dGUgPSBzaGlmdDsKKworICAgIHJldHVybiAkc2VsZi0+e2NvbmNyZXRlUHJvdG9jb2x9LT53cml0ZUJ5dGUoJGJ5dGUpOworfQorCitzdWIgd3JpdGVJMTYgeworICAgIG15ICRzZWxmID0gc2hpZnQ7CisgICAgbXkgJGkxNiA9IHNoaWZ0OworCisgICAgcmV0dXJuICRzZWxmLT57Y29uY3JldGVQcm90b2NvbH0tPndyaXRlSTE2KCRpMTYpOworfQorCitzdWIgd3JpdGVJMzIgeworICAgIG15ICRzZWxmID0gc2hpZnQ7CisgICAgbXkgKCRpMzIpID0gQF87CisKKyAgICByZXR1cm4gJHNlbGYtPntjb25jcmV0ZVByb3RvY29sfS0+d3JpdGVJMzIoJGkzMik7CisKK30KKworc3ViIHdyaXRlSTY0IHsKKyAgICBteSAkc2VsZiA9IHNoaWZ0OworICAgIG15ICRpNjQgPSBzaGlmdDsKKworICAgIHJldHVybiAkc2VsZi0+e2NvbmNyZXRlUHJvdG9jb2x9LT53cml0ZUk2NCgkaTY0KTsKK30KKworc3ViIHdyaXRlRG91YmxlIHsKKyAgICBteSAkc2VsZiA9IHNoaWZ0OworICAgIG15ICRkdWIgPSBzaGlmdDsKKworICAgIHJldHVybiAkc2VsZi0+e2NvbmNyZXRlUHJvdG9jb2x9LT53cml0ZURvdWJsZSgkZHViKTsKK30KKworc3ViIHdyaXRlU3RyaW5nIHsKKyAgICBteSAkc2VsZiA9IHNoaWZ0OworICAgIG15ICRzdHIgPSBzaGlmdDsKKworICAgIHJldHVybiAkc2VsZi0+e2NvbmNyZXRlUHJvdG9jb2x9LT53cml0ZVN0cmluZygkc3RyKTsKK30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cmFuc3BvcnRGYWN0b3J5fS0+Z2V0VHJhbnNwb3J0KCRjbGllbnQpOworICAgICAgICAgICAgbXkgJGlwcm90ICA9ICRzZWxmLT57aW5wdXRQcm90b2NvbEZhY3Rvcnl9LT5nZXRQcm90b2NvbCgkaXRyYW5zKTsKKyAgICAgICAgICAgIG15ICRvcHJvdCAgPSAkc2VsZi0+e291dHB1dFByb3RvY29sRmFjdG9yeX0tPmdldFByb3RvY29sKCRvdHJhbnMpOworICAgICAgICAgICAgZXZhbCB7CisgICAgICAgICAgICAgICAgJHNlbGYtPl9jbGllbnRCZWdpbigkaXByb3QsICRvcHJvdCk7CisgICAgICAgICAgICAgICAgd2hpbGUgKDEpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAkc2VsZi0+e3Byb2Nlc3Nvcn0tPnByb2Nlc3MoJGlwcm90LCAkb3Byb3QpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBpZigkQCkgeworICAgICAgICAgICAgICAgICRzZWxmLT5faGFuZGxlRXhjZXB0aW9uKCRAKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfTsgaWYoJEApIHsKLSAgICAgICAgICAgICRzZWxmLT5faGFuZGxlRXhjZXB0aW9uKCRAKTsKKyAgICAgICAgICAgICRpdHJhbnMtPmNsb3NlKCk7CisgICAgICAgICAgICAkb3RyYW5zLT5jbG9zZSgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHN0b3AgPSAxOwogICAgICAgICB9Ci0KLSAgICAgICAgJGl0cmFucy0+Y2xvc2UoKTsKLSAgICAgICAgJG90cmFucy0+Y2xvc2UoKTsKICAgICB9CiB9CiAKQEAgLTE3Myw5ICsxODUsOSBAQAogIyBGb3JraW5nU2VydmVyIHRoYXQgZm9ya3MgYSBuZXcgcHJvY2VzcyBmb3IgZWFjaCByZXF1ZXN0CiAjCiBwYWNrYWdlIFRocmlmdDo6Rm9ya2luZ1NlcnZlcjsK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3RzICRALT57bWVzc2FnZX0pIHsKKyAgICB9OworICAgIGlmKCRAKSB7CisgICAgICAgIGlmICgkQC0+aXNhKCdUaHJpZnQ6OlRFeGNlcHRpb24nKSBhbmQgZXhpc3RzICRALT57bWVzc2FnZX0pIHsKICAgICAgICAgICAgIG15ICRtZXNzYWdlID0gJEAtPnttZXNzYWdlfTsKICAgICAgICAgICAgIG15ICRjb2RlICAgID0gJEAtPntjb2RlfTsKICAgICAgICAgICAgIG15ICRvdXQgICAgID0gJGNvZGUgLiAnOicgLiAkbWVzc2FnZTsKIAogICAgICAgICAgICAgd2FybiAkb3V0OwotICAgICAgICB9IGVsc2UgeworICAgICAgICB9CisgICAgICAgIGVsc2UgewogICAgICAgICAgICAgd2FybiAkQDsKICAgICAgICAgfQogICAgIH0KIH0KIAotc3ViIF9jb2xsZWN0Q2hpbGRyZW4KLXsKLSAgICBteSAkc2VsZiA9IHNoaWZ0OwotCi0gICAgd2hpbGUgKHNjYWxhciBrZXlzICV7JHNlbGYtPntjaGlsZHJlbn19KQotICAgIHsKLSAgICAgICAgbXkgJHBpZCAgICA9IHdhaXRwaWQoLTEsIFdOT0hBTkcpOwotCi0gICAgICAgIGlmICgkcGlkPjApCi0gICAgICAgIHsKLSAgICAgICAgICAgIGRlbGV0ZSAkc2VsZi0+e2NoaWxkcmVufS0+eyRwaWR9OwotICAgICAgICB9Ci0gICAgICAgIGVsc2UKLSAgICAgICAgewotICAgICAgICAgICAgbGFzdDsKLSAgICAgICAgfQotICAgIH0KLX0KLQotCiAxOwpkaWZmIC0tZ2l0IGEvbGliL3BlcmwvbGliL1RocmlmdC9TZXJ2ZXJTb2NrZXQucG0gYi9saWIvcGVybC9saWIvVGhyaWZ0L1NlcnZlclNvY2tldC5wbQpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4zOTcyNjQzCi0tLSAvZGV2L251bGwKKysrIGIvbGliL3BlcmwvbGliL1RocmlmdC9TZXJ2ZXJTb2NrZXQ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GlmdDsKKyAgICBteSAkc2VsZjsKKworICAgICMgU3VwcG9ydCBib3RoIG9sZC1zdHlsZSAicG9ydCBudW1iZXIiIGNvbnN0cnVjdGlvbiBhbmQgbmV3ZXIuLi4KKyAgICBpZiAocmVmKCRhcmdzKSBlcSAnSEFTSCcpIHsKKyAgICAgICAgJHNlbGYgPSAkYXJnczsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICAgICRzZWxmID0geyBwb3J0ID0+ICRhcmdzIH07CisgICAgfQorCisgICAgaWYgKG5vdCBkZWZpbmVkICRzZWxmLT57cXVldWV9KSB7CisgICAgICAgICRzZWxmLT57cXVldWV9ID0gMTI4OworICAgIH0KKworICAgIHJldHVybiBibGVzcygkc2VsZiwgJGNsYXNzbmFtZSk7Cit9CisKK3N1YiBsaXN0ZW4KK3sKKyAgICBteSAkc2VsZiA9IHNoaWZ0OworCisgICAgbXkgJHNvY2sgPSAkc2VsZi0+X19saXN0ZW4oKSB8fCBkbyB7CisgICAgICAgIG15ICRlcnJvciA9IHJlZigkc2VsZikgLiAnOiBDb3VsZCBub3QgYmluZCB0byAnIC4gJyo6JyAuICRzZWxmLT57cG9ydH0gLiAnICgnIC4gJCEgLiAnKSc7CisKKyAgICAgICAgaWYgKCRzZWxmLT57ZGVidWd9KSB7CisgICAgICAgICAgICAkc2VsZi0+e2RlYnVnSGFuZGxlcn0tPigkZXJyb3IpOworICAgICAgICB9CisKKyAgICAgICAgZGllIFRocmlmdDo6VFRyYW5zcG9ydEV4Y2VwdGlvbi0+bmV3KCRlcnJvciwgVGhyaWZ0OjpUVHJhbnNwb3J0RXhjZXB0aW9uOjpOT1RfT1BFTik7CisgICAgfTsKKworICAgICRzZWxmLT57aGFuZGxlfSA9ICRzb2NrOworfQorCitzdWIgYWNjZXB0Cit7CisgICAgbXkgJHNlbGYgPSBzaGlmdDsKKworICAgIGlmICggZXhpc3RzICRzZWxmLT57aGFuZGxlfSBhbmQgZGVmaW5lZCAkc2VsZi0+e2hhbmRsZX0gKSB7CisgICAgICAgIG15ICRjbGllbnQgICAgICAgID0gJHNlbGYtPntoYW5kbGV9LT5hY2NlcHQoKTsKKyAgICAgICAgbXkgJHJlc3VsdCAgICAgICAgPSAkc2VsZi0+X19jbGllbnQoKTsKKyAgICAgICAgJHJlc3VsdC0+e2hhbmRsZX0gPSBJTzo6U2VsZWN0LT5uZXcoJGNsaWVudCk7CisgICAgICAgIHJldHVybiAkcmVzdWx0OworICAgIH0KKworICAgIHJldHVybiB1bmRlZjsKK30KKworc3ViIGNsb3NlCit7CisgICAgbXkgJHNlbGYgPSBzaGlmdDsKKworICAgIGlmICggZXhpc3RzICRzZWxmLT57aGFuZGxlfSBhbmQgZGVmaW5lZCAkc2VsZi0+e2hhbmRsZX0gKQorICAgIHsKKyAgICAgICAgJHNlbGYtPntoYW5kbGV9LT5jbG9zZSgpOworICAgIH0KK30KKworIyMjCisjIyMgT3ZlcnJpZGFibGUgbWV0aG9kcworIyMjCisKK3N1YiBfX2NsaWVudAoreworICByZXR1cm4gVGhyaWZ0OjpTb2NrZXQtPm5ldygpOworfQorCitzdWIgX19saXN0ZW4KK3sKKyAgICBteSAkc2VsZiA9IHNoaWZ0OworICAgIHJldHVybiBJTzo6U29ja2V0OjpJTkVULT5uZXcoTG9jYWxBZGRyID0+ICRzZWxmLT57aG9zdH0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2NhbFBvcnQgPT4gJHNlbGYtPntwb3J0fSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3RvICAgICA9PiAndGNwJywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExpc3RlbiAgICA9PiAkc2VsZi0+e3F1ZXVlfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJldXNlQWRkciA9PiAxKTsKK30KKworCisxOwpkaWZmIC0tZ2l0IGEvbGliL3BlcmwvbGliL1RocmlmdC9Tb2NrZXQucG0gYi9saWIvcGVybC9saWIvVGh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teSAkY2xhc3NuYW1lICAgID0gc2hpZnQ7Ci0gICAgbXkgJGhvc3QgICAgICAgICA9IHNoaWZ0IHx8ICJsb2NhbGhvc3QiOwotICAgIG15ICRwb3J0ICAgICAgICAgPSBzaGlmdCB8fCA5MDkwOwotICAgIG15ICRkZWJ1Z0hhbmRsZXIgPSBzaGlmdDsKKyAgICBteSAkY2xhc3NuYW1lID0gc2hpZnQ7CisgICAgbXkgJG9wdHMgICAgICA9IHNoaWZ0OwogCisgICAgIyBkZWZhdWx0IHNldHRpbmdzOgogICAgIG15ICRzZWxmID0gewotICAgICAgICBob3N0ICAgICAgICAgPT4gJGhvc3QsCi0gICAgICAgIHBvcnQgICAgICAgICA9PiAkcG9ydCwKLSAgICAgICAgZGVidWdIYW5kbGVyID0+ICRkZWJ1Z0hhbmRsZXIsCi0gICAgICAgIGRlYnVnICAgICAgICA9PiAwLAotICAgICAgICBzZW5kVGltZW91dCAgPT4gMTAwMDAsCisgICAgICAgIGhvc3QgICAgICAgICA9PiAnbG9jYWxob3N0JywKKyAgICAgICAgcG9ydCAgICAgICAgID0+IDkwOTAsCiAgICAgICAgIHJlY3ZUaW1lb3V0ICA9PiAxMDAwMCwKLSAgICAgICAgaGFuZGxlICAgICAgID0+IHVuZGVmLAorICAgICAgICBzZW5kVGltZW91dCAgPT4gMTAwMDAsCisKKyAgICAgICAgaGFuZGxlICAgICAgID0+IHVuZGVmCiAgICAgfTsKIAorICAgIGlmIChkZWZpbmVkICRvcHRzIGFuZCByZWYgJG9wdHMgZXEgcmVmIHt9KSB7CisKKyAgICAgICMgYXJndW1lbnQgaXMgYSBoYXNoIG9mIG9wdGlvbnMgc28gb3ZlcnJpZGUgdGhlIGRlZmF1bHRzCisgICAgICAkc2VsZi0+eyRffSA9ICRvcHRzLT57JF99IGZvciBrZXlzICUkb3B0czsKKworICAgIH0gZWxzZSB7CisKKyAgICAgICMgb2xkZXIgc3R5bGUgY29uc3RydWN0b3IgdGFrZXMgMyBhcmd1bWVudHMsIG5vbmUgb2Ygd2hpY2ggYXJlIHJlcXVpcmVkCisgICAgICAkc2VsZi0+e2hvc3R9ID0gJG9wdHMgfHwgJ2xvY2FsaG9zdCc7CisgICAgICAkc2VsZi0+e3BvcnR9ID0gc2hpZnQgfHwgOTA5MDsKKworICAgIH0KKwogICAgIHJldHVybiBibGVzcygkc2VsZiwkY2xhc3NuYW1lKTsKIH0KIApAQCAtNzAsMTkgKzk2LDYgQEAKIAogCiAjCi0jU2V0cyBkZWJ1Z2dpbmcgb3V0cHV0IG9uIG9yIG9mZgotIwotIyBAcGFyYW0gYm9vbCAkZGVidWcKLSMKLXN1YiBzZXREZWJ1ZwotewotICAgIG15ICRzZWxmICA9IHNoaWZ0OwotICAgIG15ICRkZWJ1ZyA9IHNoaWZ0OwotCi0gICAgJHNlbGYtPntkZWJ1Z30gPSAkZGVidWc7Ci19Ci0KLSMKICMgVGVzdHMgd2hldGhlciB0aGlzIGlzIG9wZW4KICMKICMgQHJldHVybiBib29sIHRydWUgaWYgdGhlIHNvY2tldCBpcyBvcGVuCkBAIC0xMDUsMjMgKzExOCwxMiBAQAogewogICAgIG15ICRzZWxmID0gc2hpZnQ7CiAKLSAgICBteSAkc29jayA9IElPOjpTb2NrZXQ6OklORVQtPm5ldyhQZWVyQWRkciA9PiAkc2VsZi0+e2hvc3R9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQZWVyUG9ydCA9PiAkc2VsZi0+e3BvcnR9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQcm90byAgICA9PiAndGNwJywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGltZW91dCAgPT4gJHNlbGYtPntzZW5kVGltZW91dH0vMTAwMCkKLSAgICAgICAgfHwgZG8gewotICAgICAgICAgICAgbXkgJGVycm9yID0gJ1RTb2NrZXQ6IENvdWxkIG5vdCBjb25uZWN0IHRvICcuJHNlbGYtPntob3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iAKLSAgICAgICAgI2NoZWNrIGZvciB0aW1lb3V0Ci0gICAgICAgIG15IEBzb2NrZXRzID0gJHNlbGYtPntoYW5kbGV9LT5jYW5fcmVhZCggJHNlbGYtPntyZWN2VGltZW91dH0gLyAxMDAwICk7Ci0KLSAgICAgICAgaWYoQHNvY2tldHMgPT0gMCl7Ci0gICAgICAgICAgICBkaWUgbmV3IFRocmlmdDo6VEV4Y2VwdGlvbignVFNvY2tldDogdGltZWQgb3V0IHJlYWRpbmcgJy4kbGVuLicgYnl0ZXMgZnJvbSAnLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNlbGYtPntob3N0fS4nOicuJHNlbGYtPntwb3J0fSk7Ci0gICAgICAgIH0KLQotICAgICAgICBteSAkc29jayA9ICRzb2NrZXRzWzBdOwotCi0gICAgICAgIG15ICgkYnVmLCRzeik7Ci0gICAgICAgICRzb2NrLT5yZWN2KCRidWYsICRsZW4pOworICAgICAgICBteSAkc29jayA9ICRzZWxmLT5fX3dhaXQoKTsKKyAgICAgICAgbXkgJGJ1ZiA9ICRzZWxmLT5fX3JlY3YoJHNvY2ssICRsZW4pOwogCiAgICAgICAgIGlmICghZGVmaW5lZCAkYnVmIHx8ICRidWYgZXEgJycpIHsKIAotICAgICAgICAgICAgZGllIG5ldyBUaHJpZnQ6OlRFeGNlcHRpb24oJ1RTb2NrZXQ6IENvdWxkIG5vdCByZWFkICcuJGxlbi4nIGJ5dGVzIGZyb20gJy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2VsZi0+e2hvc3R9Lic6Jy4kc2VsZi0+e3BvcnR9KTsKKyAgICAgICAgICAgIGRpZSBUaHJpZnQ6OlRUcmFuc3BvcnRFeGNlcHRpb24tPm5ldyhyZWYoJHNlbGYpLic6IENvdWxkIG5vdCByZWFkICcuJGxlbi4nIGJ5dGVzIGZyb20gJy4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2VsZi0+e2hvc3R9Lic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IAogICAgIGlmICghZGVmaW5lZCAkYnVmIHx8ICRidWYgZXEgJycpIHsKIAotICAgICAgICBkaWUgbmV3IFRFeGNlcHRpb24oJ1RTb2NrZXQ6IENvdWxkIG5vdCByZWFkICcuJGxlbi4nIGJ5dGVzIGZyb20gJy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICRzZWxmLT57aG9zdH0uJzonLiRzZWxmLT57cG9ydH0pOworICAgICAgICBkaWUgVGhyaWZ0OjpUVHJhbnNwb3J0RXhjZXB0aW9uLT5uZXcocmVmKCRzZWxmKS4nOiBDb3VsZCBub3QgcmVhZCAnLiRsZW4uJyBieXRlcyBmcm9tICcuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAkc2VsZi0+e2hvc3R9Lic6Jy4kc2VsZi0+e3BvcnR9LCBUaHJpZnQ6OlRUcmFuc3BvcnRFeGNlcHRpb246OkVORF9PRl9GSUxFKTsKIAogICAgIH0KIApAQCAtMjI5LDMwICsyMTIsMjcgQEAKICAgICBteSAkc2VsZiA9IHNoaWZ0OwogICAgIG15ICRidWYgID0gc2hpZnQ7CiAKLQogICAgIHJldHVybiB1bmxlc3MgZGVmaW5lZCAkc2VsZi0+e2hhbmRsZX07CiAKICAgICB3aGlsZSAobGVuZ3RoKCRidWYpID4gMCkgewotCi0KICAgICAgICAgI2NoZWNrIGZvciB0aW1lb3V0CiAgICAgICAgIG15IEBzb2NrZXRzID0gJHNlbGYtPntoYW5kbGV9LT5jYW5fd3JpdGUoICRzZWxmLT57c2VuZFRpbWVvdXR9IC8gMTAwMCApOwogCiAgICAgICAgIGlmKEBzb2NrZXRzID09IDApewotICAgICAgICAgICAgZGllIG5ldyBUaHJpZnQ6OlRFeGNlcHRpb24oJ1RTb2NrZXQ6IHRpbWVkIG91dCB3cml0aW5nIHRvIGJ5dGVzIGZyb20gJy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzZWxmLT57aG9zdH0uJzonLiRzZWxmLT57cG9ydH0pOworICAgICAgICAgICAgZGllIFRocmlmdDo6VFRyYW5zcG9ydEV4Y2VwdGlvbi0+bmV3KHJlZigkc2VsZikuJzogdGltZWQgb3V0IHdyaXRpbmcgdG8gYnl0ZXMgZnJvbSAnLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNlbGYtPntob3N0fS4nOicuJHNlbGYtPntwb3J0fSwgVGhyaWZ0OjpUVHJhbnNwb3J0RXhjZXB0aW9uOjpUSU1FRF9PVVQpOwogICAgICAgICB9CiAKLSAgICAgICAgbXkgJHNvY2sgPSAkc29ja2V0c1swXTsKKyAgICAgICAgbXkgJHNlbnQgPSAkc2VsZi0+X19zZW5kKCRzb2NrZXRzWzBdLCAkYnVmKTsKIAotICAgICAgICBteSAkZ290ID0gJHNvY2stPnNlbmQoJGJ1Zik7CisgICAgICAgIGlmICghZGVmaW5lZCAkc2VudCB8fCAkc2VudCA9PSAwICkgewogCi0gICAgICAgIGlmICghZGVmaW5lZCAkZ290IHx8ICRnb3QgPT0gMCApIHsKLSAgICAgICAgICAgIGRpZSBuZXcgVGhyaWZ0OjpURXhjZXB0aW9uKCdUU29ja2V0OiBDb3VsZCBub3Qgd3JpdGUgJy5sZW5ndGgoJGJ1ZikuJyBieXRlcyAnLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNlbGYtPntob3N0fS4nOicuJHNlbGYtPntob3N0fSk7CisgICAgICAgICAgICBkaWUgVGhyaWZ0OjpUVHJhbnNwb3J0RXhjZXB0aW9uLT5uZXcocmVmKCRzZWxmKS4nOiBDb3VsZCBub3Qgd3JpdGUgJy5sZW5ndGgoJGJ1ZikuJyBieXRlcyAnLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNlbGYtPntob3N0fS4nOicuJHNlbGYtPntob3N0fSwgVGhyaWZ0OjpUVHJhbnNwb3J0RXhjZXB0aW9uOjpFTkRfT0ZfRklMRSk7CisKICAgICAgICAgfQogCi0gICAgICAgICRidWYg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OlNvY2tldDo6SU5FVC0+bmV3KExvY2FsQWRkciA9PiB1bmRlZiwgIyBhbnkgYWRkcgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvY2FsUG9ydCA9PiAkc2VsZi0+e3BvcnR9LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3RvICAgICA9PiAndGNwJywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMaXN0ZW4gICAgPT4gTElTVEVOX1FVRVVFX1NJWkUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmV1c2VBZGRyID0+IDEpCi0gICAgICAgIHx8IGRvIHsKLSAgICAgICAgICAgIG15ICRlcnJvciA9ICdUU2VydmVyU29ja2V0OiBDb3VsZCBub3QgYmluZCB0byAnIC4KLSAgICAgICAgICAgICAgICAgICAgICAgICRzZWxmLT57aG9zdH0gLiAnOicgLiAkc2VsZi0+e3BvcnR9IC4gJyAoJyAuICQhIC4gJyknOwotCi0gICAgICAgICAgICBpZiAoJHNlbGYtPntkZWJ1Z30pIHsKLSAgICAgICAgICAgICAgICAkc2VsZi0+e2RlYnVnSGFuZGxlcn0tPigkZXJyb3IpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBkaWUgbmV3IFRocmlmdDo6VEV4Y2VwdGlvbigkZXJyb3IpOwotICAgICAgICB9OwotCi0gICAgJHNlbGYtPntoYW5kbGV9ID0gJHNvY2s7CisgICAgcmV0dXJuIElPOjpTb2NrZXQ6OklORVQtPm5ldyhQZWVyQWRkciA9PiAkc2VsZi0+e2hvc3R9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGVlclBvcnQgPT4gJHNlbGYtPntwb3J0fSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3RvICAgID0+ICd0Y3AnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGltZW91dCAgPT4gJHNlbGYtPntzZW5k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gcHVibGljIGZ1bmN0aW9uIHJlYWQoJGlucHV0KTsKKworICAgIGFic3RyYWN0IHB1YmxpYyBmdW5jdGlvbiB3cml0ZSgkb3V0cHV0KTsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkc3BlYyA9IG51bGwsICR2YWxzID0gbnVsbCkKKyAgICB7CisgICAgICAgIGlmIChpc19hcnJheSgkc3BlYykgJiYgaXNfYXJyYXkoJHZhbHMpKSB7CisgICAgICAgICAgICBmb3JlYWNoICgkc3BlYyBhcyAkZmlkID0+ICRmc3BlYykgeworICAgICAgICAgICAgICAgICR2YXIgPSAkZnNwZWNbJ3ZhciddOworICAgICAgICAgICAgICAgIGlmIChpc3NldCgkdmFsc1skdmFyXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgJHRoaXMtPiR2YXIgPSAkdmFsc1skdmFyXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gX193YWtldXAoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPl9fY29uc3RydWN0KGdldF9vYmplY3RfdmFycygkdGhpcykpOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gX3JlYWRNYXAoJiR2YXIsICRzcGVjLCAkaW5wdXQpCisgICAgeworICAgICAgICAkeGZlciA9IDA7CisgICAgICAgICRrdHlwZSA9ICRzcGVjWydrdHlwZSddOworICAgICAgICAkdnR5cGUgPSAkc3BlY1sndnR5cGUnXTsKKyAgICAgICAgJGtyZWFkID0gJHZyZWFkID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFska3R5cGVdKSkgeworICAgICAgICAgICAgJGtyZWFkID0gJ3JlYWQnIC4gVEJhc2U6OiR0bWV0aG9kWyRrdHlwZV07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAka3NwZWMgPSAkc3BlY1sna2V5J107CisgICAgICAgIH0KKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskdnR5cGVdKSkgeworICAgICAgICAgICAgJHZyZWFkID0gJ3JlYWQnIC4gVEJhc2U6OiR0bWV0aG9kWyR2dHlwZV07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkdnNwZWMgPSAkc3BlY1sndmFsJ107CisgICAgICAgIH0KKyAgICAgICAgJHZhciA9IGFycmF5KCk7CisgICAgICAgICRfa3R5cGUgPSAkX3Z0eXBlID0gJHNpemUgPSAwOworICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRNYXBCZWdpbigkX2t0eXBlLCAkX3Z0eXBlLCAkc2l6ZSk7CisgICAgICAgIGZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyArKyRpKSB7CisgICAgICAgICAgICAka2V5ID0gJHZhbCA9IG51bGw7CisgICAgICAgICAgICBpZiAoJGtyZWFkICE9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT4ka3JlYWQoJGtleSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJGt0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICRrc3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICRrZXkgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAka2V5LT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCRrZXksICRrc3BlYywgJGlucHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCRrZXksICRrc3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgka2V5LCAka3NwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoJHZyZWFkICE9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT4kdnJlYWQoJHZhbCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJHZ0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICR2c3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICR2YWwgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdmFsLT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCR2YWwsICR2c3BlYywgJGlucHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR2YWwsICR2c3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkdmFsLCAkdnNwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAkdmFyWyRrZXldID0gJHZhbDsKKyAgICAgICAgfQorICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRNYXBFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBfcmVhZExpc3QoJiR2YXIsICRzcGVjLCAkaW5wdXQsICRzZXQgPSBmYWxzZSkKKyAgICB7CisgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgJGV0eXBlID0gJHNwZWNbJ2V0eXBlJ107CisgICAgICAgICRlcmVhZCA9ICR2cmVhZCA9IG51bGw7CisgICAgICAgIGlmIChpc3NldChUQmFzZTo6JHRtZXRob2RbJGV0eXBlXSkpIHsKKyAgICAgICAgICAgICRlcmVhZCA9ICdyZWFkJyAuIFRCYXNlOjokdG1ldGhvZFskZXR5cGVdOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJGVzcGVjID0gJHNwZWNbJ2VsZW0nXTsKKyAgICAgICAgfQorICAgICAgICAkdmFyID0gYXJyYXkoKTsKKyAgICAgICAgJF9ldHlwZSA9ICRzaXplID0gMDsKKyAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFNldEJlZ2luKCRfZXR5cGUsICRzaXplKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZExpc3RCZWdpbigkX2V0eXBlLCAkc2l6ZSk7CisgICAgICAgIH0KKyAgICAgICAgZm9yICgkaSA9IDA7ICRpIDwgJHNpemU7ICsrJGkpIHsKKyAgICAgICAgICAgICRlbGVtID0gbnVsbDsKKyAgICAgICAgICAgIGlmICgkZXJlYWQgIT09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPiRlcmVhZCgkZWxlbSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICRlc3BlYyA9ICRzcGVjWydlbGVtJ107CisgICAgICAgICAgICAgICAgc3dpdGNoICgkZXR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJGNsYXNzID0gJGVzcGVjWydjbGFzcyddOworICAgICAgICAgICAgICAgICAgICAgICAgJGVsZW0gPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkZWxlbS0+cmVhZCgkaW5wdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fcmVhZE1hcCgkZWxlbSwgJGVzcGVjLCAkaW5wdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fcmVhZExpc3QoJGVsZW0sICRlc3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkZWxlbSwgJGVzcGVjLCAkaW5wdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICAgICAkdmFyWyRlbGVtXSA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICR2YXIgW10gPSAkZWxlbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoJHNldCkgeworICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkU2V0RW5kKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRMaXN0RW5kKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIF9yZWFkKCRjbGFzcywgJHNwZWMsICRpbnB1dCkKKyAgICB7CisgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgJGZuYW1lID0gbnVsbDsKKyAgICAgICAgJGZ0eXBlID0gMDsKKyAgICAgICAgJGZpZCA9IDA7CisgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFN0cnVjdEJlZ2luKCRmbmFtZSk7CisgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRGaWVsZEJlZ2luKCRmbmFtZSwgJGZ0eXBlLCAkZmlkKTsKKyAgICAgICAgICAgIGlmICgkZnR5cGUgPT0gVFR5cGU6OlNUT1ApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpc3NldCgkc3BlY1skZmlkXSkpIHsKKyAgICAgICAgICAgICAgICAkZnNwZWMgPSAkc3BlY1skZmlkXTsKKyAgICAgICAgICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKKyAgICAgICAgICAgICAgICBpZiAoJGZ0eXBlID09ICRmc3BlY1sndHlwZSddKSB7CisgICAgICAgICAgICAgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskZnR5cGVdKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgJGZ1bmMgPSAncmVhZCcgLiBUQmFzZTo6JHRtZXRob2RbJGZ0eXBlXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+JGZ1bmMoJHRoaXMtPiR2YXIpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICgkZnR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpTVFJVQ1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICRmc3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRoaXMtPiR2YXIgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT4kdmFyLT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkdGhpcy0+JHZhciwgJGZzcGVjLCAkaW5wdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5za2lwKCRmdHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnNraXAoJGZ0eXBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZEZpZWxkRW5kKCk7CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkU3RydWN0RW5kKCk7CisKKyAgICAgICAgcmV0dXJuICR4ZmVyOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gX3dyaXRlTWFwKCR2YXIsICRzcGVjLCAkb3V0cHV0KQorICAgIHsKKyAgICAgICAgJHhmZXIgPSAwOworICAgICAgICAka3R5cGUgPSAkc3BlY1sna3R5cGUnXTsKKyAgICAgICAgJHZ0eXBlID0gJHNwZWNbJ3Z0eXBlJ107CisgICAgICAgICRrd3JpdGUgPSAkdndyaXRlID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFska3R5cGVdKSkgeworICAgICAgICAgICAgJGt3cml0ZSA9ICd3cml0ZScgLiBUQmFzZTo6JHRtZXRob2RbJGt0eXBlXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICRrc3BlYyA9ICRzcGVjWydrZXknXTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaXNzZXQoVEJhc2U6OiR0bWV0aG9kWyR2dHlwZV0pKSB7CisgICAgICAgICAgICAkdndyaXRlID0gJ3dyaXRlJyAuIFRCYXNlOjokdG1ldGhvZFskdnR5cGVdOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHZzcGVjID0gJHNwZWNbJ3ZhbCddOworICAgICAgICB9CisgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlTWFwQmVnaW4oJGt0eXBlLCAkdnR5cGUsIGNvdW50KCR2YXIpKTsKKyAgICAgICAgZm9yZWFjaCAoJHZhciBhcyAka2V5ID0+ICR2YWwpIHsKKyAgICAgICAgICAgIGlmIChpc3NldCgka3dyaXRlKSkgeworICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPiRrd3JpdGUoJGtleSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJGt0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRrZXktPndyaXRlKCRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVNYXAoJGtleSwgJGtzcGVjLCAkb3V0cHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgka2V5LCAka3NwZWMsICRvdXRwdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpTRVQ6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgka2V5LCAka3NwZWMsICRvdXRwdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGlzc2V0KCR2d3JpdGUpKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+JHZ3cml0ZSgkdmFsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3dpdGNoICgkdnR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHZhbC0+d3JpdGUoJG91dHB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl93cml0ZU1hcCgkdmFsLCAkdnNwZWMsICRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR2YWwsICR2c3BlYywgJG91dHB1dCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR2YWwsICR2c3BlYywgJG91dHB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVNYXBFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBfd3JpdGVMaXN0KCR2YXIsICRzcGVjLCAkb3V0cHV0LCAkc2V0ID0gZmFsc2UpCisgICAgeworICAgICAgICAkeGZlciA9IDA7CisgICAgICAgICRldHlwZSA9ICRzcGVjWydldHlwZSddOworICAgICAgICAkZXdyaXRlID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskZXR5cGVdKSkgeworICAgICAgICAgICAgJGV3cml0ZSA9ICd3cml0ZScgLiBUQmFzZTo6JHRtZXRob2RbJGV0eXBlXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICRlc3BlYyA9ICRzcGVjWydlbGVtJ107CisgICAgICAgIH0KKyAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlU2V0QmVnaW4oJGV0eXBlLCBjb3VudCgkdmFyKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZUxpc3RCZWdpbigkZXR5cGUsIGNvdW50KCR2YXIpKTsKKyAgICAgICAgfQorICAgICAgICBmb3JlYWNoICgkdmFyIGFzICRrZXkgPT4gJHZhbCkgeworICAgICAgICAgICAgJGVsZW0gPSAkc2V0ID8gJGtleSA6ICR2YWw7CisgICAgICAgICAgICBpZiAoaXNzZXQoJGV3cml0ZSkpIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT4kZXdyaXRlKCRlbGVtKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3dpdGNoICgkZXR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGVsZW0tPndyaXRlKCRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVNYXAoJGVsZW0sICRlc3BlYywgJG91dHB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl93cml0ZUxpc3QoJGVsZW0sICRlc3BlYywgJG91dHB1dCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCRlbGVtLCAkZXNwZWMsICRvdXRwdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgkc2V0KSB7CisgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZVNldEVuZCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVMaXN0RW5kKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIF93cml0ZSgkY2xhc3MsICRzcGVjLCAkb3V0cHV0KQorICAgIHsKKyAgICAgICAgJHhmZXIgPSAwOworICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZVN0cnVjdEJlZ2luKCRjbGFzcyk7CisgICAgICAgIGZvcmVhY2ggKCRzcGVjIGFzICRmaWQgPT4gJGZzcGVjKSB7CisgICAgICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+JHZhciAhPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICRmdHlwZSA9ICRmc3BlY1sndHlwZSddOworICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlRmllbGRCZWdpbigkdmFyLCAkZnR5cGUsICRmaWQpOworICAgICAgICAgICAgICAgIGlmIChpc3NldChUQmFzZTo6JHRtZXRob2RbJGZ0eXBlXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgJGZ1bmMgPSAnd3JpdGUnIC4gVEJhc2U6OiR0bWV0aG9kWyRmdHlwZV07CisgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPiRmdW5jKCR0aGlzLT4kdmFyKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKCRmdHlwZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT4kdmFyLT53cml0ZSgkb3V0cHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTWFwKCR0aGlzLT4kdmFyLCAkZnNwZWMsICRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR0aGlzLT4kdmFyLCAkZnNwZWMsICRvdXRwdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgkdGhpcy0+JHZhciwgJGZzcGVjLCAkb3V0cHV0LCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZUZpZWxkRW5kKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVGaWVsZFN0b3AoKTsKKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVTdHJ1Y3RFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL3BocC9saWIvQ2xhc3NMb2FkZXIvVGhyaWZ0Q2xhc3NMb2FkZXIucGhwIGIvbGliL3BocC9saWIvQ2xhc3NMb2FkZXIvVGhyaWZ0Q2xhc3NMb2FkZXIucGhwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjQzNjFiZDgKLS0tIC9kZXY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GUKKyAqIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQgbGltaXRhdGlvbnMKKyAqIHVuZGVyIHRoZSBMaWNlbnNlLgorICoKKyAqIENsYXNzTG9hZGVyIHRvIGxvYWQgVGhyaWZ0IGxpYnJhcnkgYW5kIGRlZmluaXRpb25zCisgKiBJbnNwaXJlZCBmcm9tIFVuaXZlcnNhbENsYXNzTG9hZGVyIGZyb20gU3ltZm9ueSAyCisgKgorICogQHBhY2thZ2UgdGhyaWZ0LmNsYXNzbG9hZGVyCisgKi8KKworbmFtZXNwYWNlIFRocmlmdFxDbGFzc0xvYWRlcjsKKworY2xhc3MgVGhyaWZ0Q2xhc3NMb2FkZXIKK3sKKyAgICAvKioKKyAgICAgKiBOYW1lc3BhY2VzIHBhdGgKKyAgICAgKiBAdmFyIGFycmF5CisgICAgICovCisgICAgcHJvdGVjdGVkICRuYW1lc3BhY2VzID0gYXJyYXkoKTsKKworICAgIC8qKgorICAgICAqIFRocmlmdCBkZWZpbml0aW9uIHBhdGhzCisgICAgICogQHZhciB0eXBlCisgICAgICovCisgICAgcHJvdGVjdGVkICRkZWZpbml0aW9ucyA9IGFycmF5KCk7CisKKyAgICAvKioKKyAgICAgKiBEbyB3ZSB1c2UgQVBDIGNhY2hlID8KKyAgICAgKiBAdmFyIGJvb2xlYW4KKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJGFwYyA9IGZhbHNlOworCisgICAgLyoqCisgICAgICogQVBDIENhY2hlIHByZWZpeAorICAgICAqIEB2YXIgc3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkICRhcGNfcHJlZml4OworCisgICAgLyoqCisgICAgICogU2V0IGF1dG9sb2FkZXIgdG8gdXNlIEFQQyBjYWNoZQorICAgICAqIEBwYXJhbSBib29sZWFuICRhcGMKKyAgICAgKiBAcGFyYW0gc3RyaW5nICRhcGNfcHJlZml4CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uI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ICAgKgorICAgICAqIEBwYXJhbSBCb29sZWFuICRwcmVwZW5kIFdoZXRoZXIgdG8gcHJlcGVuZCB0aGUgYXV0b2xvYWRlciBvciBub3QKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVnaXN0ZXIoJHByZXBlbmQgPSBmYWxzZSkKKyAgICB7CisgICAgICAgIHNwbF9hdXRvbG9hZF9yZWdpc3RlcihhcnJheSgkdGhpcywgJ2xvYWRDbGFzcycpLCB0cnVlLCAkcHJlcGVuZCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogTG9hZHMgdGhlIGdpdmVuIGNsYXNzLCBkZWZpbml0aW9uIG9yIGludGVyZmFjZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgJGNsYXNzIFRoZSBuYW1lIG9mIHRoZSBjbGFzcworICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBsb2FkQ2xhc3MoJGNsYXNzKQorICAgIHsKKyAgICAgICAgaWYgKCh0cnVlID09PSAkdGhpcy0+YXBjICYmICgkZmlsZSA9ICR0aGlzLT5maW5kRmlsZUluQXBjKCRjbGFzcykpKSBvcgorICAgICAgICAgICAgKCRmaWxlID0gJHRoaXMtPmZpbmRGaWxlKCRjbGFzcykpCisgICAgICAgICkgeworICAgICAgICAgICAgcmVxdWlyZV9vbmNlICRmaWxlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogTG9hZHMgdGhlIGdpdmVuIGNsYXNzIG9yIGludGVyZmFjZSBpbiBBUEMuCisgICAgICogQHBhcmFtICBzdHJpbmcgJGNsYXNzIFRoZSBuYW1lIG9mIHRoZSBjbGFzcworICAgICAqIEByZXR1cm4gc3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIGZpbmRGaWxlSW5BcGMoJGNsYXNzKQorICAgIHsKKyAgICAgICAgaWYgKGZhbHNlID09PSAkZmlsZSA9IGFwY19mZXRjaCgkdGhpcy0+YXBjX3ByZWZpeCAuICRjbGFzcykpIHsKKyAgICAgICAgICAgIGFwY19zdG9yZSgkdGhpcy0+YXBjX3ByZWZpeCAuICRjbGFzcywgJGZpbGUgPSAkdGhpcy0+ZmluZEZpbGUoJGNsYXNzKSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJGZpbGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogRmluZCBjbGFzcyBpbiBuYW1lc3BhY2VzIG9yIGRlZmluaXRpb25zIGRpcmVjdG9yaWVzCisgICAgICogQHBhcmFtICBzdHJpbmcgJGNsYXNzCisgICAgICogQHJldHVybiBzdHJpbmcKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gZmluZEZpbGUoJGNsYXNzKQorICAgIHsKKyAgICAgICAgLy8gUmVtb3ZlIGZpcnN0IGJhY2tzbGFzaAorICAgICAgICBpZiAoJ1xcJyA9PSAkY2xhc3NbMF0pIHsKKyAgICAgICAgICAgICRjbGFzcyA9IHN1YnN0cigkY2xhc3MsIDEpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGZhbHNlICE9PSAkcG9zID0gc3RycnBvcygkY2xhc3MsICdcXCcpKSB7CisgICAgICAgICAgICAvLyBOYW1lc3BhY2VkIGNsYXNzIG5hbWUKKyAgICAgICAgICAgICRuYW1lc3BhY2UgPSBzdWJzdHIoJGNsYXNzLCAwLCAkcG9zKTsKKworICAgICAgICAgICAgLy8gSXRlcmF0ZSBpbiBub3JtYWwgbmFtZXNwYWNlcworICAgICAgICAgICAgZm9yZWFjaCAoJHRoaXMtPm5hbWVzcGFjZXMgYXMgJG5zID0+ICRkaXJzKSB7CisgICAgICAgICAgICAgICAgLy9Eb24ndCBpbnRlcmZlcmUgd2l0aCBvdGhlciBhdXRvbG9hZGVycworICAgICAgICAgICAgICAgIGlmICgwICE9PSBzdHJwb3MoJG5hbWVzcGFjZSwgJG5zKSkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBmb3JlYWNoICgkZGlycyBhcyAkZGlyKSB7CisgICAgICAgICAgICAgICAgICAgICRjbGFzc05hbWUgPSBzdWJzdHIoJGNsYXNzLCAkcG9zICsgMSk7CisKKyAgICAgICAgICAgICAgICAgICAgJGZpbGUgPSAkZGlyIC4gRElSRUNUT1JZX1NFUEFSQVRPUiAuCisgICAgICAgICAgICAgICAgICAgICAgICBzdHJfcmVwbGFjZSgnXFwnLCBESVJFQ1RPUllfU0VQQVJBVE9SLCAkbmFtZXNwYWNlKSAuCisgICAgICAgICAgICAgICAgICAgICAgICBESVJFQ1RPUllfU0VQQVJBVE9SIC4KKyAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzc05hbWUgLiAnLnBocCc7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVfZXhpc3RzKCRmaWxlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRmaWxlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBJdGVyYXRlIGluIFRocmlmdCBuYW1lc3BhY2VzCisKKyAgICAgICAgICAgIC8vIFJlbW92ZSBmaXJzdCBwYXJ0IG9mIG5hbWVzcGFjZQorICAgICAgICAgICAgJG0gPSBleHBsb2RlKCdcXCcsICRjbGFzcyk7CisKKyAgICAgICAgICAgIC8vIElnbm9yZSB3cm9uZyBjYWxsCisgICAgICAgICAgICBpZiAoY291bnQoJG0pIDw9IDEpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICRjbGFzcyA9IGFycmF5X3BvcCgkbSk7CisgICAgICAgICAgICAkbmFtZXNwYWNlID0gaW1wbG9kZSgnXFwnLCAkbSk7CisKKyAgICAgICAgICAgIGZvcmVhY2ggKCR0aGlzLT5kZWZpbml0aW9ucyBhcyAkbnMgPT4gJGRpcnMpIHsKKyAgICAgICAgICAgICAgICAvL0Rvbid0IGludGVyZmVyZSB3aXRoIG90aGVyIGF1dG9sb2FkZXJzCisgICAgICAgICAgICAgICAgaWYgKDAgIT09IHN0cnBvcygkbmFtZXNwYWNlLCAkbnMpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRkaXJzIGFzICRkaXIpIHsKKyAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAqIEF2YWlsYWJsZSBpbiBzZXJ2aWNlOiBJbnRlcmZhY2UsIENsaWVudCwgUHJvY2Vzc29yLCBSZXN0CisgICAgICAgICAgICAgICAgICAgICAqIEFuZCBldmVyeSBzZXJ2aWNlIG1ldGhvZHMgKF8uKykKKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBwcmVnX21hdGNoKCcjKC4rKShpZnxjbGllbnR8cHJvY2Vzc29yfHJlc3QpJCNpJywgJGNsYXNzLCAkbikgYW5kCisgICAgICAgICAgICAgICAgICAgICAgICAwID09PSBwcmVnX21hdGNoKCcjKC4rKV9bYS16MC05XStfKGFyZ3N8cmVzdWx0KSQjaScsICRjbGFzcywgJG4pCisgICAgICAgICAgICAgICAgICAgICkgeworICAgICAgICAgICAgICAgICAgICAgICAgJGNsYXNzTmFtZSA9ICdUeXBlcyc7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAkY2xhc3NOYW1lID0gJG5bMV07CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAkZmlsZSA9ICRkaXIgLiBESVJFQ1RPUllfU0VQQVJBVE9SIC4KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cl9yZXBsYWNlKCdcXCcsIERJUkVDVE9SWV9TRVBBUkFUT1IsICRuYW1lc3BhY2UpIC4KKyAgICAgICAgICAgIC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A9PiAkZnNwZWMpIHsKKyAgICAgICAgICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKKyAgICAgICAgICAgICAgICBpZiAoaXNzZXQoJHZhbHNbJHZhcl0pKSB7CisgICAgICAgICAgICAgICAgICAgICR0aGlzLT4kdmFyID0gJHZhbHNbJHZhcl07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcGFyZW50OjpfX2NvbnN0cnVjdCgkcDEsICRwMik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljICR0bWV0aG9kID0gYXJyYXkoCisgICAgICAgIFRUeXBlOjpCT09MID0+ICdCb29sJywKKyAgICAgICAgVFR5cGU6OkJZVEUgPT4gJ0J5dGUnLAorICAgICAgICBUVHlwZTo6STE2ID0+ICdJMTYnLAorICAgICAgICBUVHlwZTo6STMyID0+ICdJMzInLAorICAgICAgICBUVHlwZTo6STY0ID0+ICdJNjQnLAorICAgICAgICBUVHlwZTo6RE9VQkxFID0+ICdEb3VibGUnLAorICAgICAgICBUVHlwZTo6U1RSSU5HID0+ICdTdHJpbmcnCisgICAgKTsKKworICAgIHByaXZhdGUgZnVuY3Rpb24gX3JlYWRNYXAoJiR2YXIsICRzcGVjLCAkaW5wdXQpCisgICAgeworICAgICAgICAkeGZlciA9IDA7CisgICAgICAgICRrdHlwZSA9ICRzcGVjWydrdHlwZSddOworICAgICAgICAkdnR5cGUgPSAkc3BlY1sndnR5cGUnXTsKKyAgICAgICAgJGtyZWFkID0gJHZyZWFkID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFska3R5cGVdKSkgeworICAgICAgICAgICAgJGtyZWFkID0gJ3JlYWQnIC4gVEJhc2U6OiR0bWV0aG9kWyRrdHlwZV07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAka3NwZWMgPSAkc3BlY1sna2V5J107CisgICAgICAgIH0KKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskdnR5cGVdKSkgeworICAgICAgICAgICAgJHZyZWFkID0gJ3JlYWQnIC4gVEJhc2U6OiR0bWV0aG9kWyR2dHlwZV07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkdnNwZWMgPSAkc3BlY1sndmFsJ107CisgICAgICAgIH0KKyAgICAgICAgJHZhciA9IGFycmF5KCk7CisgICAgICAgICRfa3R5cGUgPSAkX3Z0eXBlID0gJHNpemUgPSAwOworICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRNYXBCZWdpbigkX2t0eXBlLCAkX3Z0eXBlLCAkc2l6ZSk7CisgICAgICAgIGZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyArKyRpKSB7CisgICAgICAgICAgICAka2V5ID0gJHZhbCA9IG51bGw7CisgICAgICAgICAgICBpZiAoJGtyZWFkICE9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT4ka3JlYWQoJGtleSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJGt0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICRrc3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICRrZXkgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAka2V5LT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCRrZXksICRrc3BlYywgJGlucHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCRrZXksICRrc3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgka2V5LCAka3NwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoJHZyZWFkICE9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT4kdnJlYWQoJHZhbCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJHZ0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICR2c3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICR2YWwgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdmFsLT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCR2YWwsICR2c3BlYywgJGlucHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR2YWwsICR2c3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkdmFsLCAkdnNwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAkdmFyWyRrZXldID0gJHZhbDsKKyAgICAgICAgfQorICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRNYXBFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBfcmVhZExpc3QoJiR2YXIsICRzcGVjLCAkaW5wdXQsICRzZXQgPSBmYWxzZSkKKyAgICB7CisgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgJGV0eXBlID0gJHNwZWNbJ2V0eXBlJ107CisgICAgICAgICRlcmVhZCA9ICR2cmVhZCA9IG51bGw7CisgICAgICAgIGlmIChpc3NldChUQmFzZTo6JHRtZXRob2RbJGV0eXBlXSkpIHsKKyAgICAgICAgICAgICRlcmVhZCA9ICdyZWFkJyAuIFRCYXNlOjokdG1ldGhvZFskZXR5cGVdOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJGVzcGVjID0gJHNwZWNbJ2VsZW0nXTsKKyAgICAgICAgfQorICAgICAgICAkdmFyID0gYXJyYXkoKTsKKyAgICAgICAgJF9ldHlwZSA9ICRzaXplID0gMDsKKyAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFNldEJlZ2luKCRfZXR5cGUsICRzaXplKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZExpc3RCZWdpbigkX2V0eXBlLCAkc2l6ZSk7CisgICAgICAgIH0KKyAgICAgICAgZm9yICgkaSA9IDA7ICRpIDwgJHNpemU7ICsrJGkpIHsKKyAgICAgICAgICAgICRlbGVtID0gbnVsbDsKKyAgICAgICAgICAgIGlmICgkZXJlYWQgIT09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPiRlcmVhZCgkZWxlbSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICRlc3BlYyA9ICRzcGVjWydlbGVtJ107CisgICAgICAgICAgICAgICAgc3dpdGNoICgkZXR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJGNsYXNzID0gJGVzcGVjWydjbGFzcyddOworICAgICAgICAgICAgICAgICAgICAgICAgJGVsZW0gPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkZWxlbS0+cmVhZCgkaW5wdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fcmVhZE1hcCgkZWxlbSwgJGVzcGVjLCAkaW5wdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fcmVhZExpc3QoJGVsZW0sICRlc3BlYywgJGlucHV0LCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkZWxlbSwgJGVzcGVjLCAkaW5wdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICAgICAkdmFyWyRlbGVtXSA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICR2YXIgW10gPSAkZWxlbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoJHNldCkgeworICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkU2V0RW5kKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRMaXN0RW5kKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIF9yZWFkKCRjbGFzcywgJHNwZWMsICRpbnB1dCkKKyAgICB7CisgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgJGZuYW1lID0gbnVsbDsKKyAgICAgICAgJGZ0eXBlID0gMDsKKyAgICAgICAgJGZpZCA9IDA7CisgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZFN0cnVjdEJlZ2luKCRmbmFtZSk7CisgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnJlYWRGaWVsZEJlZ2luKCRmbmFtZSwgJGZ0eXBlLCAkZmlkKTsKKyAgICAgICAgICAgIGlmICgkZnR5cGUgPT0gVFR5cGU6OlNUT1ApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpc3NldCgkc3BlY1skZmlkXSkpIHsKKyAgICAgICAgICAgICAgICAkZnNwZWMgPSAkc3BlY1skZmlkXTsKKyAgICAgICAgICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKKyAgICAgICAgICAgICAgICBpZiAoJGZ0eXBlID09ICRmc3BlY1sndHlwZSddKSB7CisgICAgICAgICAgICAgICAgICAgICR4ZmVyID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskZnR5cGVdKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgJGZ1bmMgPSAncmVhZCcgLiBUQmFzZTo6JHRtZXRob2RbJGZ0eXBlXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+JGZ1bmMoJHRoaXMtPiR2YXIpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICgkZnR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpTVFJVQ1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzcyA9ICRmc3BlY1snY2xhc3MnXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRoaXMtPiR2YXIgPSBuZXcgJGNsYXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT4kdmFyLT5yZWFkKCRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkdGhpcy0+JHZhciwgJGZzcGVjLCAkaW5wdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5za2lwKCRmdHlwZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkaW5wdXQtPnNraXAoJGZ0eXBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZEZpZWxkRW5kKCk7CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJGlucHV0LT5yZWFkU3RydWN0RW5kKCk7CisKKyAgICAgICAgcmV0dXJuICR4ZmVyOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gX3dyaXRlTWFwKCR2YXIsICRzcGVjLCAkb3V0cHV0KQorICAgIHsKKyAgICAgICAgJHhmZXIgPSAwOworICAgICAgICAka3R5cGUgPSAkc3BlY1sna3R5cGUnXTsKKyAgICAgICAgJHZ0eXBlID0gJHNwZWNbJ3Z0eXBlJ107CisgICAgICAgICRrd3JpdGUgPSAkdndyaXRlID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFska3R5cGVdKSkgeworICAgICAgICAgICAgJGt3cml0ZSA9ICd3cml0ZScgLiBUQmFzZTo6JHRtZXRob2RbJGt0eXBlXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICRrc3BlYyA9ICRzcGVjWydrZXknXTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaXNzZXQoVEJhc2U6OiR0bWV0aG9kWyR2dHlwZV0pKSB7CisgICAgICAgICAgICAkdndyaXRlID0gJ3dyaXRlJyAuIFRCYXNlOjokdG1ldGhvZFskdnR5cGVdOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHZzcGVjID0gJHNwZWNbJ3ZhbCddOworICAgICAgICB9CisgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlTWFwQmVnaW4oJGt0eXBlLCAkdnR5cGUsIGNvdW50KCR2YXIpKTsKKyAgICAgICAgZm9yZWFjaCAoJHZhciBhcyAka2V5ID0+ICR2YWwpIHsKKyAgICAgICAgICAgIGlmIChpc3NldCgka3dyaXRlKSkgeworICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPiRrd3JpdGUoJGtleSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHN3aXRjaCAoJGt0eXBlKSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRrZXktPndyaXRlKCRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVNYXAoJGtleSwgJGtzcGVjLCAkb3V0cHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgka2V5LCAka3NwZWMsICRvdXRwdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRUeXBlOjpTRVQ6CisgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgka2V5LCAka3NwZWMsICRvdXRwdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGlzc2V0KCR2d3JpdGUpKSB7CisgICAgICAgICAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+JHZ3cml0ZSgkdmFsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3dpdGNoICgkdnR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHZhbC0+d3JpdGUoJG91dHB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl93cml0ZU1hcCgkdmFsLCAkdnNwZWMsICRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR2YWwsICR2c3BlYywgJG91dHB1dCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR2YWwsICR2c3BlYywgJG91dHB1dCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVNYXBFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBfd3JpdGVMaXN0KCR2YXIsICRzcGVjLCAkb3V0cHV0LCAkc2V0ID0gZmFsc2UpCisgICAgeworICAgICAgICAkeGZlciA9IDA7CisgICAgICAgICRldHlwZSA9ICRzcGVjWydldHlwZSddOworICAgICAgICAkZXdyaXRlID0gbnVsbDsKKyAgICAgICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFskZXR5cGVdKSkgeworICAgICAgICAgICAgJGV3cml0ZSA9ICd3cml0ZScgLiBUQmFzZTo6JHRtZXRob2RbJGV0eXBlXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICRlc3BlYyA9ICRzcGVjWydlbGVtJ107CisgICAgICAgIH0KKyAgICAgICAgaWYgKCRzZXQpIHsKKyAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlU2V0QmVnaW4oJGV0eXBlLCBjb3VudCgkdmFyKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZUxpc3RCZWdpbigkZXR5cGUsIGNvdW50KCR2YXIpKTsKKyAgICAgICAgfQorICAgICAgICBmb3JlYWNoICgkdmFyIGFzICRrZXkgPT4gJHZhbCkgeworICAgICAgICAgICAgJGVsZW0gPSAkc2V0ID8gJGtleSA6ICR2YWw7CisgICAgICAgICAgICBpZiAoaXNzZXQoJGV3cml0ZSkpIHsKKyAgICAgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT4kZXdyaXRlKCRlbGVtKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3dpdGNoICgkZXR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJGVsZW0tPndyaXRlKCRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVNYXAoJGVsZW0sICRlc3BlYywgJG91dHB1dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgorICAgICAgICAgICAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl93cml0ZUxpc3QoJGVsZW0sICRlc3BlYywgJG91dHB1dCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCRlbGVtLCAkZXNwZWMsICRvdXRwdXQsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgkc2V0KSB7CisgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZVNldEVuZCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVMaXN0RW5kKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIF93cml0ZSgkY2xhc3MsICRzcGVjLCAkb3V0cHV0KQorICAgIHsKKyAgICAgICAgJHhmZXIgPSAwOworICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZVN0cnVjdEJlZ2luKCRjbGFzcyk7CisgICAgICAgIGZvcmVhY2ggKCRzcGVjIGFzICRmaWQgPT4gJGZzcGVjKSB7CisgICAgICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+JHZhciAhPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICRmdHlwZSA9ICRmc3BlY1sndHlwZSddOworICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPndyaXRlRmllbGRCZWdpbigkdmFyLCAkZnR5cGUsICRmaWQpOworICAgICAgICAgICAgICAgIGlmIChpc3NldChUQmFzZTo6JHRtZXRob2RbJGZ0eXBlXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgJGZ1bmMgPSAnd3JpdGUnIC4gVEJhc2U6OiR0bWV0aG9kWyRmdHlwZV07CisgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICRvdXRwdXQtPiRmdW5jKCR0aGlzLT4kdmFyKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKCRmdHlwZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT4kdmFyLT53cml0ZSgkb3V0cHV0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTWFwKCR0aGlzLT4kdmFyLCAkZnNwZWMsICRvdXRwdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fd3JpdGVMaXN0KCR0aGlzLT4kdmFyLCAkZnNwZWMsICRvdXRwdXQsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3dyaXRlTGlzdCgkdGhpcy0+JHZhciwgJGZzcGVjLCAkb3V0cHV0LCB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAkeGZlciArPSAkb3V0cHV0LT53cml0ZUZpZWxkRW5kKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVGaWVsZFN0b3AoKTsKKyAgICAgICAgJHhmZXIgKz0gJG91dHB1dC0+d3JpdGVTdHJ1Y3RFbmQoKTsKKworICAgICAgICByZXR1cm4gJHhmZXI7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL3BocC9saWIvRXhjZXB0aW9uL1RQcm90b2NvbEV4Y2VwdGlvbi5waHAgYi9saWIvcGhwL2xpYi9FeGNlcHRpb24vVFByb3RvY29sRXhjZXB0aW9uLnBocApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4zYTU1ZDQ1Ci0tLSAvZGV2L251bGwKKysrIGIvbGliL3Boc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BJUyIgQkFTSVMsIFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWQorICogS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUKKyAqIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQgbGltaXRhdGlvbnMKKyAqIHVuZGVyIHRoZSBMaWNlbnNlLgorICoKKyAqIEBwYWNrYWdlIHRocmlmdC5wcm90b2NvbAorICovCisKK25hbWVzcGFjZSBUaHJpZnRcUHJvdG9jb2xcSlNPTjsKKwordXNlIFRocmlmdFxQcm90b2NvbFxUSlNPTlByb3RvY29sOworCitjbGFzcyBMaXN0Q29udGV4dCBleHRlbmRzIEJhc2VDb250ZXh0Cit7CisgICAgcHJpdmF0ZSAkZmlyc3RfID0gdHJ1ZTsKKyAgICBwcml2YXRlICRwXzsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkcCkKKyAgICB7CisgICAgICAgICR0aGlzLT5wXyA9ICRwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZSgpCisgICAgeworICAgICAgICBpZiAoJHRoaXMtPmZpcnN0XykgeworICAgICAgICAgICAgJHRoaXMtPmZpcnN0XyA9IGZhbHNlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHRoaXMtPnBfLT5nZXRUcmFuc3BvcnQoKS0+d3JpdGUoVEpTT05Qcm90b2NvbDo6Q09NTUEpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWQoKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT5maXJzdF8pIHsKKyAgICAgICAgICAgICR0aGlzLT5maXJzdF8gPSBmYWxzZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICR0aGlzLT5wXy0+cmVhZEpTT05TeW50YXhDaGF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AgICAgICAgICAgICR0aGlzLT5maXJzdF8gPSBmYWxzZTsKKyAgICAgICAgICAgICR0aGlzLT5jb2xvbl8gPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHRoaXMtPnBfLT5nZXRUcmFuc3BvcnQoKS0+d3JpdGUoJHRoaXMtPmNvbG9uXyA/IFRKU09OUHJvdG9jb2w6OkNPTE9OIDogVEpTT05Qcm90b2NvbDo6Q09NTUEpOworICAgICAgICAgICAgJHRoaXMtPmNvbG9uXyA9ICEkdGhpcy0+Y29sb25fOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWQoKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT5maXJzdF8pIHsKKyAgICAgICAgICAgICR0aGlzLT5maXJzdF8gPSBmYWxzZTsKKyAgICAgICAgICAgICR0aGlzLT5jb2xvbl8gPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHRoaXMtPnBfLT5yZWFkSlNPTlN5bnRheENoYXIoJHRoaXMtPmNvbG9uXyA/IFRKU09OUHJvdG9jb2w6OkNPTE9OIDogVEpTT05Qcm90b2NvbDo6Q09NTUEpOworICAgICAgICAgICAgJHRoaXMtPmNvbG9uXyA9ICEkdGhpcy0+Y29sb25fOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIGVzY2FwZU51bSgpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbG9uXzsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9saWIvcGhwL2xpYi9Qcm90b2NvbC9TaW1wbGVKU09OL0NvbGxlY3Rpb25NYXBLZXlFeGNlcHRpb24ucGhwIGIvbGliL3BocC9saWIvUHJvdG9jb2wvU2ltcGxlSlNPTi9Db2xsZWN0aW9uTWFwS2V5RXhjZXB0aW9uLnBocApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi41MjJiODVhCi0tLS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0YgQU5ZCisgKiBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZQorICogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucworICogdW5kZXIgdGhlIExpY2Vuc2UuCisgKgorICogQHBhY2thZ2UgdGhyaWZ0LnByb3RvY29sCisgKi8KKworbmFtZXNwYWNlIFRocmlmdFxQcm90b2NvbFxTaW1wbGVKU09OOworCit1c2UgVGhyaWZ0XFByb3RvY29sXFRTaW1wbGVKU09OUHJvdG9jb2w7CisKK2NsYXNzIFN0cnVjdENvbnRleHQgZXh0ZW5kcyBDb250ZXh0Cit7CisgICAgcHJvdGVjdGVkICRmaXJzdF8gPSB0cnVlOworICAgIHByb3RlY3RlZCAkY29sb25fID0gdHJ1ZTsKKyAgICBwcml2YXRlICRwXzsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkcCkKKyAgICB7CisgICAgICAgICR0aGlzLT5wXyA9ICRwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZSgpCisgICAgeworICAgICAgICBpZiAoJHRoaXMtPmZpcnN0XykgeworICAgICAgICAgICAgJHRoaXMtPmZpcnN0XyA9IGZhbHNlOworICAgICAgICAgICAgJHRoaXMtPmNvbG9uXyA9IHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkdGhpcy0+cF8tPmdldFRyYW5zcG9ydCgpLT53cml0ZSgKKyAgICAgICAgICAgICAgICAkdGhpcy0+Y29sb25fID8KKyAgICAgICAgICAgICAgICAgICAgVFNpbXBsZUpTT05Qcm90b2NvbDo6Q09MT04gOgorICAgICAgICAgICAgICAgICAgICBUU2ltcGxlSlNPTlByb3RvY29sOjpDT01NQQorICAgICAgICAgICAgKTsKKyAgICAgICAgICAgICR0aGlzLT5jb2xvbl8gPSAhJH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Ol9fY29uc3RydWN0KCR0cmFucyk7CisgICAgICAgICR0aGlzLT5zdHJpY3RSZWFkXyA9ICRzdHJpY3RSZWFkOworICAgICAgICAkdGhpcy0+c3RyaWN0V3JpdGVfID0gJHN0cmljdFdyaXRlOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VCZWdpbigkbmFtZSwgJHR5cGUsICRzZXFpZCkKKyAgICB7CisgICAgICAgIGlmICgkdGhpcy0+c3RyaWN0V3JpdGVfKSB7CisgICAgICAgICAgICAkdmVyc2lvbiA9IHNlbGY6OlZFUlNJT05fMSB8ICR0eXBlOworCisgICAgICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMzIoJHZlcnNpb24pICsKKyAgICAgICAgICAgICAgICAkdGhpcy0+d3JpdGVTdHJpbmcoJG5hbWUpICsKKyAgICAgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMzIoJHNlcWlkKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybgorICAgICAgICAgICAgICAgICR0aGlzLT53cml0ZVN0cmluZygkbmFtZSkgKworICAgICAgICAgICAgICAgICR0aGlzLT53cml0ZUJ5dGUoJHR5cGUpICsKKyAgICAgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMzIoJHNlcWlkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VFbmQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU3RydWN0QmVnaW4oJG5hbWUpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVTdHJ1Y3RFbmQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRCZWdpbigkZmllbGROYW1lLCAkZmllbGRUeXBlLCAkZmllbGRJZCkKKyAgICB7CisgICAgICAgIHJldHVybgorICAgICAgICAgICAgJHRoaXMtPndyaXRlQnl0ZSgkZmllbGRUeXBlKSArCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMTYoJGZpZWxkSWQpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUZpZWxkRW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUZpZWxkU3RvcCgpCisgICAgeworICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICR0aGlzLT53cml0ZUJ5dGUoVFR5cGU6OlNUT1ApOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1hcEJlZ2luKCRrZXlUeXBlLCAkdmFsVHlwZSwgJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICR0aGlzLT53cml0ZUJ5dGUoJGtleVR5cGUpICsKKyAgICAgICAgICAgICR0aGlzLT53cml0ZUJ5dGUoJHZhbFR5cGUpICsKKyAgICAgICAgICAgICR0aGlzLT53cml0ZUkzMigkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwRW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUxpc3RCZWdpbigkZWxlbVR5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgcmV0dXJuCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVCeXRlKCRlbGVtVHlwZSkgKworICAgICAgICAgICAgJHRoaXMtPndyaXRlSTMyKCRzaXplKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVMaXN0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICR0aGlzLT53cml0ZUJ5dGUoJGVsZW1UeXBlKSArCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMzIoJHNpemUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVCb29sKCR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gcGFjaygnYycsICR2YWx1ZSA/IDEgOiAwKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoJGRhdGEsIDEpOworCisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJ5dGUoJHZhbHVlKQorICAgIHsKKyAgICAgICAgJGRhdGEgPSBwYWNrKCdjJywgJHZhbHVlKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoJGRhdGEsIDEpOworCisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkxNigkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9IHBhY2soJ24nLCAkdmFsdWUpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZSgkZGF0YSwgMik7CisKKyAgICAgICAgcmV0dXJuIDI7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTMyKCR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gcGFjaygnTicsICR2YWx1ZSk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKCRkYXRhLCA0KTsKKworICAgICAgICByZXR1cm4gNDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJNjQoJHZhbHVlKQorICAgIHsKKyAgICAgICAgLy8gSWYgd2UgYXJlIG9uIGEgMzJiaXQgYXJjaGl0ZWN0dXJlIHdlIGhhdmUgdG8gZXhwbGljaXRseSBkZWFsIHdpdGgKKyAgICAgICAgLy8gNjQtYml0IHR3b3MtY29tcGxlbWVudCBhcml0aG1ldGljIHNpbmNlIFBIUCB3YW50cyB0byB0cmVhdCBhbGwgaW50cworICAgICAgICAvLyBhcyBzaWduZWQgYW5kIGFueSBpbnQgb3ZlciAyXjMxIC0gMSBhcyBhIGZsb2F0CisgICAgICAgIGlmIChQSFBfSU5UX1NJWkUgPT0gNCkgeworICAgICAgICAgICAgJG5lZyA9ICR2YWx1ZSA8IDA7CisKKyAgICAgICAgICAgIGlmICgkbmVnKSB7CisgICAgICAgICAgICAgICAgJHZhbHVlICo9IC0xOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAkaGkgPSAoaW50KSgkdmFsdWUgLyA0Mjk0OTY3Mjk2KTsKKyAgICAgICAgICAgICRsbyA9IChpbnQpJHZhbHVlOworCisgICAgICAgICAgICBpZiAoJG5lZykgeworICAgICAgICAgICAgICAgICRoaSA9IH4kaGk7CisgICAgICAgICAgICAgICAgJGxvID0gfiRsbzsKKyAgICAgICAgICAgICAgICBpZiAoKCRsbyAmIChpbnQpMHhmZmZmZmZmZikgPT0gKGludCkweGZmZmZmZmZmKSB7CisgICAgICAgICAgICAgICAgICAgICRsbyA9IDA7CisgICAgICAgICAgICAgICAgICAgICRoaSsrOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICRsbysrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICRkYXRhID0gcGFjaygnTjInLCAkaGksICRsbyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkaGkgPSAkdmFsdWUgPj4gMzI7CisgICAgICAgICAgICAkbG8gPSAkdmFsdWUgJiAweEZGRkZGRkZGOworICAgICAgICAgICAgJGRhdGEgPSBwYWNrKCdOMicsICRoaSwgJGxvKTsKKyAgICAgICAgfQorCisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKCRkYXRhLCA4KTsKKworICAgICAgICByZXR1cm4gODsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVEb3VibGUoJHZhbHVlKQorICAgIHsKKyAgICAgICAgJGRhdGEgPSBwYWNrKCdkJywgJHZhbHVlKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc3RycmV2KCRkYXRhKSwgOCk7CisKKyAgICAgICAgcmV0dXJuIDg7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU3RyaW5nKCR2YWx1ZSkKKyAgICB7CisgICAgICAgICRsZW4gPSBUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJHZhbHVlKTsKKyAgICAgICAgJHJlc3VsdCA9ICR0aGlzLT53cml0ZUkzMigkbGVuKTsKKyAgICAgICAgaWYgKCRsZW4pIHsKKyAgICAgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKCR2YWx1ZSwgJGxlbik7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHJlc3VsdCArICRsZW47CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRNZXNzYWdlQmVnaW4oJiRuYW1lLCAmJHR5cGUsICYkc2VxaWQpCisgICAgeworICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPnJlYWRJMzIoJHN6KTsKKyAgICAgICAgaWYgKCRzeiA8IDApIHsKKyAgICAgICAgICAgICR2ZXJzaW9uID0gKGludCkoJHN6ICYgc2VsZjo6VkVSU0lPTl9NQVNLKTsKKyAgICAgICAgICAgIGlmICgkdmVyc2lvbiAhPSAoaW50KXNlbGY6OlZFUlNJT05fMSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oJ0JhZCB2ZXJzaW9uIGlkZW50aWZpZXI6ICcgLiAkc3osIFRQcm90b2NvbEV4Y2VwdGlvbjo6QkFEX1ZFUlNJT04pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgJHR5cGUgPSAkc3ogJiAweDAwMDAwMGZmOworICAgICAgICAgICAgJHJlc3VsdCArPQorICAgICAgICAgICAgICAgICR0aGlzLT5yZWFkU3RyaW5nKCRuYW1lKSArCisgICAgICAgICAgICAgICAgJHRoaXMtPnJlYWRJMzIoJHNlcWlkKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+c3RyaWN0UmVhZF8pIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAnTm8gdmVyc2lvbiBpZGVudGlmaWVyLCBvbGQgcHJvdG9jb2wgY2xpZW50PycsCisgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEV4Y2VwdGlvbjo6QkFEX1ZFUlNJT04KKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBIYW5kbGUgcHJlLXZlcnNpb25lZCBpbnB1dAorICAgICAgICAgICAgICAgICRuYW1lID0gJHRoaXMtPnRyYW5zXy0+cmVhZEFsbCgkc3opOworICAgICAgICAgICAgICAgICRyZXN1bHQgKz0KKyAgICAgICAgICAgICAgICAgICAgJHN6ICsKKyAgICAgICAgICAgICAgICAgICAgJHRoaXMtPnJlYWRCeXRlKCR0eXBlKSArCisgICAgICAgICAgICAgICAgICAgICR0aGlzLT5yZWFkSTMyKCRzZXFpZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHJlc3VsdDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1lc3NhZ2VFbmQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJ1Y3RCZWdpbigmJG5hbWUpCisgICAgeworICAgICAgICAkbmFtZSA9ICcnOworCisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU3RydWN0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRmllbGRCZWdpbigmJG5hbWUsICYkZmllbGRUeXBlLCAmJGZpZWxkSWQpCisgICAgeworICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPnJlYWRCeXRlKCRmaWVsZFR5cGUpOworICAgICAgICBpZiAoJGZpZWxkVHlwZSA9PSBUVHlwZTo6U1RPUCkgeworICAgICAgICAgICAgJGZpZWxkSWQgPSAwOworCisgICAgICAgICAgICByZXR1cm4gJHJlc3VsdDsKKyAgICAgICAgfQorICAgICAgICAkcmVzdWx0ICs9ICR0aGlzLT5yZWFkSTE2KCRmaWVsZElkKTsKKworICAgICAgICByZXR1cm4gJHJlc3VsdDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEZpZWxkRW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTWFwQmVnaW4oJiRrZXlUeXBlLCAmJHZhbFR5cGUsICYkc2l6ZSkKKyAgICB7CisgICAgICAgIHJldHVybgorICAgICAgICAgICAgJHRoaXMtPnJlYWRCeXRlKCRrZXlUeXBlKSArCisgICAgICAgICAgICAkdGhpcy0+cmVhZEJ5dGUoJHZhbFR5cGUpICsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSTMyKCRzaXplKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1hcEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZExpc3RCZWdpbigmJGVsZW1UeXBlLCAmJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICR0aGlzLT5yZWFkQnl0ZSgkZWxlbVR5cGUpICsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSTMyKCRzaXplKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZExpc3RFbmQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTZXRCZWdpbigmJGVsZW1UeXBlLCAmJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4KKyAgICAgICAgICAgICR0aGlzLT5yZWFkQnl0ZSgkZWxlbVR5cGUpICsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSTMyKCRzaXplKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFNldEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEJvb2woJiR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gJHRoaXMtPnRyYW5zXy0+cmVhZEFsbCgxKTsKKyAgICAgICAgJGFyciA9IHVucGFjaygnYycsICRkYXRhKTsKKyAgICAgICAgJHZhbHVlID0gJGFyclsxXSA9PSAxOworCisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkQnl0ZSgmJHZhbHVlKQorICAgIHsKKyAgICAgICAgJGRhdGEgPSAkdGhpcy0+dHJhbnNfLT5yZWFkQWxsKDEpOworICAgICAgICAkYXJyID0gdW5wYWNrKCdjJywgJGRhdGEpOworICAgICAgICAkdmFsdWUgPSAkYXJyWzFdOworCisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTE2KCYkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoMik7CisgICAgICAgICRhcnIgPSB1bnBhY2soJ24nLCAkZGF0YSk7CisgICAgICAgICR2YWx1ZSA9ICRhcnJbMV07CisgICAgICAgIGlmICgkdmFsdWUgPiAweDdmZmYpIHsKKyAgICAgICAgICAgICR2YWx1ZSA9IDAgLSAoKCR2YWx1ZSAtIDEpIF4gMHhmZmZmKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAyOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTMyKCYkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoNCk7CisgICAgICAgICRhcnIgPSB1bnBhY2soJ04nLCAkZGF0YSk7CisgICAgICAgICR2YWx1ZSA9ICRhcnJbMV07CisgICAgICAgIGlmICgkdmFsdWUgPiAweDdmZmZmZmZmKSB7CisgICAgICAgICAgICAkdmFsdWUgPSAwIC0gKCgkdmFsdWUgLSAxKSBeIDB4ZmZmZmZmZmYpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIDQ7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJNjQoJiR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gJHRoaXMtPnRyYW5zXy0+cmVhZEFsbCg4KTsKKworICAgICAgICAkYXJyID0gdW5wYWNrKCdOMicsICRkYXRhKTsKKworICAgICAgICAvLyBJZiB3ZSBhcmUgb24gYSAzMmJpdCBhcmNoaXRlY3R1cmUgd2UgaGF2ZSB0byBleHBsaWNpdGx5IGRlYWwgd2l0aAorICAgICAgICAvLyA2NC1iaXQgdHdvcy1jb21wbGVtZW50IGFyaXRobWV0aWMgc2luY2UgUEhQIHdhbnRzIHRvIHRyZWF0IGFsbCBpbnRzCisgICAgICAgIC8vIGFzIHNpZ25lZCBhbmQgYW55IGludCBvdmVyIDJeMzEgLSAxIGFzIGEgZmxvYXQKKyAgICAgICAgaWYgKFBIUF9JTlRfU0laRSA9PSA0KSB7CisgICAgICAgICAgICAkaGkgPSAkYXJyWzFdOworICAgICAgICAgICAgJGxvID0gJGFyclsyXTsKKyAgICAgICAgICAgICRpc05lZyA9ICRoaSA8IDA7CisKKyAgICAgICAgICAgIC8vIENoZWNrIGZvciBhIG5lZ2F0aXZlCisgICAgICAgICAgICBpZiAoJGlzTmVnKSB7CisgICAgICAgICAgICAgICAgJGhpID0gfiRoaSAmIChpbnQpMHhmZmZmZmZmZjsKKyAgICAgICAgICAgICAgICAkbG8gPSB+JGxvICYgKGludCkweGZmZmZmZmZmOworCisgICAgICAgICAgICAgICAgaWYgKCRsbyA9PSAoaW50KTB4ZmZmZmZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgJGhpKys7CisgICAgICAgICAgICAgICAgICAgICRsbyA9IDA7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgJGxvKys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBGb3JjZSAzMmJpdCB3b3JkcyBpbiBleGNlc3Mgb2YgMkcgdG8gcGUgcG9zaXRpdmUgLSB3ZSBkZWFsIHdpZ2ggc2lnbgorICAgICAgICAgICAgLy8gZXhwbGljaXRseSBiZWxvdworCisgICAgICAgICAgICBpZiAoJGhpICYgKGludCkweDgwMDAwMDAwKSB7CisgICAgICAgICAgICAgICAgJGhpICY9IChpbnQpMHg3ZmZmZmZmZjsKKyAgICAgICAgICAgICAgICAkaGkgKz0gMHg4MDAwMDAwMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCRsbyAmIChpbnQpMHg4MDAwMDAwMCkgeworICAgICAgICAgICAgICAgICRsbyAmPSAoaW50KTB4N2ZmZmZmZmY7CisgICAgICAgICAgICAgICAgJGxvICs9IDB4ODAwMDAwMDA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICR2YWx1ZSA9ICRoaSAqIDQyOTQ5NjcyOTYgKyAkbG87CisKKyAgICAgICAgICAgIGlmICgkaXNOZWcpIHsKKyAgICAgICAgICAgICAgICAkdmFsdWUgPSAwIC0gJHZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gVXBjYXN0IG5lZ2F0aXZlcyBpbiBMU0IgYml0CisgICAgICAgICAgICBpZiAoJGFyclsyXSAmIDB4ODAwMDAwMDApIHsKKyAgICAgICAgICAgICAgICAkYXJyWzJdID0gJGFyclsyXSAmIDB4ZmZmZmZmZmY7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIENoZWNrIGZvciBhIG5lZ2F0aXZlCisgICAgICAgICAgICBpZiAoJGFyclsxXSAmIDB4ODAwMDAwMDApIHsKKyAgICAgICAgICAgICAgICAkYXJyWzFdID0gJGFyclsxXSAmIDB4ZmZmZmZmZmY7CisgICAgICAgICAgICAgICAgJGFyclsxXSA9ICRhcnJbMV0gXiAweGZmZmZmZmZmOworICAgICAgICAgICAgICAgICRhcnJbMl0gPSAkYXJyWzJdIF4gMHhmZmZmZmZmZjsKKyAgICAgICAgICAgICAgICAkdmFsdWUgPSAwIC0gJGFyclsxXSAqIDQyOTQ5NjcyOTYgLSAkYXJyWzJdIC0gMTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgJHZhbHVlID0gJGFyclsxXSAqIDQyOTQ5NjcyOTYgKyAkYXJyWzJdOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIDg7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWREb3VibGUoJiR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gc3RycmV2KCR0aGlzLT50cmFuc18tPnJlYWRBbGwoOCkpOworICAgICAgICAkYXJyID0gdW5wYWNrKCd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iaXRzIC0gMSkpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBmcm9tWmlnWmFnKCRuKQorICAgIHsKKyAgICAgICAgcmV0dXJuICgkbiA+PiAxKSBeIC0oJG4gJiAxKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gZ2V0VmFyaW50KCRkYXRhKQorICAgIHsKKyAgICAgICAgJG91dCA9ICIiOworICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgaWYgKCgkZGF0YSAmIH4weDdmKSA9PT0gMCkgeworICAgICAgICAgICAgICAgICRvdXQgLj0gY2hyKCRkYXRhKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgJG91dCAuPSBjaHIoKCRkYXRhICYgMHhmZikgfCAweDgwKTsKKyAgICAgICAgICAgICAgICAkZGF0YSA9ICRkYXRhID4+IDc7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJG91dDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVWYXJpbnQoJGRhdGEpCisgICAgeworICAgICAgICAkb3V0ID0gJHRoaXMtPmdldFZhcmludCgkZGF0YSk7CisgICAgICAgICRyZXN1bHQgPSBUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJG91dCk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKCRvdXQsICRyZXN1bHQpOworCisgICAgICAgIHJldHVybiAkcmVzdWx0OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkVmFyaW50KCYkcmVzdWx0KQorICAgIHsKKyAgICAgICAgJGlkeCA9IDA7CisgICAgICAgICRzaGlmdCA9IDA7CisgICAgICAgICRyZXN1bHQgPSAwOworICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgJHggPSAkdGhpcy0+dHJhbnNfLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgJGFyciA9IHVucGFjaygnQycsICR4KTsKKyAgICAgICAgICAgICRieXRlID0gJGFyclsxXTsKKyAgICAgICAgICAgICRpZHggKz0gMTsKKyAgICAgICAgICAgICRyZXN1bHQgfD0gKCRieXRlICYgMHg3ZikgPDwgJHNoaWZ0OworICAgICAgICAgICAgaWYgKCgkYnl0ZSA+PiA3KSA9PT0gMCkgeworICAgICAgICAgICAgICAgIHJldHVybiAkaWR4OworICAgICAgICAgICAgfQorICAgICAgICAgICAgJHNoaWZ0ICs9IDc7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJGlkeDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoJHRyYW5zKQorICAgIHsKKyAgICAgICAgcGFyZW50OjpfX2NvbnN0cnVjdCgkdHJhbnMpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VCZWdpbigkbmFtZSwgJHR5cGUsICRzZXFpZCkKKyAgICB7CisgICAgICAgICR3cml0dGVuID0KKyAgICAgICAgICAgICR0aGlzLT53cml0ZVVCeXRlKFRDb21wYWN0UHJvdG9jb2w6OlBST1RPQ09MX0lEKSArCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVVQnl0ZShUQ29tcGFjdFByb3RvY29sOjpWRVJTSU9OIHwKKyAgICAgICAgICAgICAgICAoJHR5cGUgPDwgVENvbXBhY3RQcm90b2NvbDo6VFlQRV9TSElGVF9BTU9VTlQpKSArCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVWYXJpbnQoJHNlcWlkKSArCisgICAgICAgICAgICAkdGhpcy0+d3JpdGVTdHJpbmcoJG5hbWUpOworICAgICAgICAkdGhpcy0+c3RhdGUgPSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9WQUxVRV9XUklURTsKKworICAgICAgICByZXR1cm4gJHdyaXR0ZW47CisgICAgfQorCisgICAgcHVibGlj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HRlbiA9ICR0aGlzLT53cml0ZVVCeXRlKCgkZGVsdGEgPDwgNCkgfCAkdHlwZSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkd3JpdHRlbiA9ICR0aGlzLT53cml0ZUJ5dGUoJHR5cGUpICsKKyAgICAgICAgICAgICAgICAkdGhpcy0+d3JpdGVJMTYoJGZpZCk7CisgICAgICAgIH0KKyAgICAgICAgJHRoaXMtPmxhc3RGaWQgPSAkZmlkOworCisgICAgICAgIHJldHVybiAkd3JpdHRlbjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVGaWVsZEJlZ2luKCRmaWVsZF9uYW1lLCAkZmllbGRfdHlwZSwgJGZpZWxkX2lkKQorICAgIHsKKyAgICAgICAgaWYgKCRmaWVsZF90eXBlID09IFRUWVBFOjpCT09MKSB7CisgICAgICAgICAgICAkdGhpcy0+c3RhdGUgPSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9CT09MX1dSSVRFOworICAgICAgICAgICAgJHRoaXMtPmJvb2xGaWQgPSAkZmllbGRfaWQ7CisKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHRoaXMtPnN0YXRlID0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfVkFMVUVfV1JJVEU7CisKKyAgICAgICAgICAgIHJldHVybiAkdGhpcy0+d3JpdGVGaWVsZEhlYWRlcihzZWxmOjokY3R5cGVzWyRmaWVsZF90eXBlXSwgJGZpZWxkX2lkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUZpZWxkRW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5zdGF0ZSA9IFRDb21wYWN0UHJvdG9jb2w6OlNUQVRFX0ZJRUxEX1dSSVRFOworCisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUNvbGxlY3Rpb25CZWdpbigkZXR5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgJHdyaXR0ZW4gPSAwOworICAgICAgICBpZiAoJHNpemUgPD0gMTQpIHsKKyAgICAgICAgICAgICR3cml0dGVuID0gJHRoaXMtPndyaXRlVUJ5dGUoJHNpemUgPDwgNCB8CisgICAgICAgICAgICAgICAgc2VsZjo6JGN0eXBlc1skZXR5cGVdKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICR3cml0dGVuID0gJHRoaXMtPndyaXRlVUJ5dGUoMHhmMCB8CisgICAgICAgICAgICAgICAgICAgIHNlbGY6OiRjdHlwZXNbJGV0eXBlXSkgKworICAgICAgICAgICAgICAgICR0aGlzLT53cml0ZVZhcmludCgkc2l6ZSk7CisgICAgICAgIH0KKyAgICAgICAgJHRoaXMtPmNvbnRhaW5lcnNbXSA9ICR0aGlzLT5zdGF0ZTsKKyAgICAgICAgJHRoaXMtPnN0YXRlID0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfQ09OVEFJTkVSX1dSSVRFOworCisgICAgICAgIHJldHVybiAkd3JpdHRlbjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVNYXBCZWdpbigka2V5X3R5cGUsICR2YWxfdHlwZSwgJHNpemUpCisgICAgeworICAgICAgICAkd3JpdHRlbiA9IDA7CisgICAgICAgIGlmICgkc2l6ZSA9PSAwKSB7CisgICAgICAgICAgICAkd3JpdHRlbiA9ICR0aGlzLT53cml0ZUJ5dGUoMCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkd3JpdHRlbiA9ICR0aGlzLT53cml0ZVZhcmludCgkc2l6ZSkgKworICAgICAgICAgICAgICAgICR0aGlzLT53cml0ZVVCeXRlKHNlbGY6OiRjdHlwZXNbJGtleV90eXBlXSA8PCA0IHwKKyAgICAgICAgICAgICAgICAgICAgc2VsZjo6JGN0eXBlc1skdmFsX3R5cGVdKTsKKyAgICAgICAgfQorICAgICAgICAkdGhpcy0+Y29udGFpbmVyc1tdID0gJHRoaXMtPnN0YXRlOworCisgICAgICAgIHJldHVybiAkd3JpdHRlbjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVDb2xsZWN0aW9uRW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5zdGF0ZSA9IGFycmF5X3BvcCgkdGhpcy0+Y29udGFpbmVycyk7CisKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwRW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+d3JpdGVDb2xsZWN0aW9uRW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEJlZ2luKCRlbGVtX3R5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT53cml0ZUNvbGxlY3Rpb25CZWdpbigkZWxlbV90eXBlLCAkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlQ29sbGVjdGlvbkVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEJlZ2luKCRlbGVtX3R5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT53cml0ZUNvbGxlY3Rpb25CZWdpbigkZWxlbV90eXBlLCAkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU2V0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+d3JpdGVDb2xsZWN0aW9uRW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlQm9vbCgkdmFsdWUpCisgICAgeworICAgICAgICBpZiAoJHRoaXMtPnN0YXRlID09IFRDb21wYWN0UHJvdG9jb2w6OlNUQVRFX0JPT0xfV1JJVEUpIHsKKyAgICAgICAgICAgICRjdHlwZSA9IFRDb21wYWN0UHJvdG9jb2w6OkNPTVBBQ1RfRkFMU0U7CisgICAgICAgICAgICBpZiAoJHZhbHVlKSB7CisgICAgICAgICAgICAgICAgJGN0eXBlID0gVENvbXBhY3RQcm90b2NvbDo6Q09NUEFDVF9UUlVFOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlRmllbGRIZWFkZXIoJGN0eXBlLCAkdGhpcy0+Ym9vbEZpZCk7CisgICAgICAgIH0gZWxzZWlmICgkdGhpcy0+c3RhdGUgPT0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfQ09OVEFJTkVSX1dSSVRFKSB7CisgICAgICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlQnl0ZSgkdmFsdWUgPyAxIDogMCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCdJbnZhbGlkIHN0YXRlIGluIGNvbXBhY3QgcHJvdG9jb2wnKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJ5dGUoJHZhbHVlKQorICAgIHsKKyAgICAgICAgJGRhdGEgPSBwYWNrKCdjJywgJHZhbHVlKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoJGRhdGEsIDEpOworCisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVVCeXRlKCRieXRlKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUocGFjaygnQycsICRieXRlKSwgMSk7CisKKyAgICAgICAgcmV0dXJuIDE7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTE2KCR2YWx1ZSkKKyAgICB7CisgICAgICAgICR0aGluZyA9ICR0aGlzLT50b1ppZ1phZygkdmFsdWUsIDE2KTsKKworICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlVmFyaW50KCR0aGluZyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTMyKCR2YWx1ZSkKKyAgICB7CisgICAgICAgICR0aGluZyA9ICR0aGlzLT50b1ppZ1phZygkdmFsdWUsIDMyKTsKKworICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlVmFyaW50KCR0aGluZyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRG91YmxlKCR2YWx1ZSkKKyAgICB7CisgICAgICAgICRkYXRhID0gcGFjaygnZCcsICR2YWx1ZSk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKCRkYXRhLCA4KTsKKworICAgICAgICByZXR1cm4gODsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVTdHJpbmcoJHZhbHVlKQorICAgIHsKKyAgICAgICAgJGxlbiA9IFRTdHJpbmdGdW5jRmFjdG9yeTo6Y3JlYXRlKCktPnN0cmxlbigkdmFsdWUpOworICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPndyaXRlVmFyaW50KCRsZW4pOworICAgICAgICBpZiAoJGxlbikgeworICAgICAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoJHZhbHVlLCAkbGVuKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkcmVzdWx0ICsgJGxlbjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEZpZWxkQmVnaW4oJiRuYW1lLCAmJGZpZWxkX3R5cGUsICYkZmllbGRfaWQpCisgICAgeworICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPnJlYWRVQnl0ZSgkY29tcGFjdF90eXBlX2FuZF9kZWx0YSk7CisKKyAgICAgICAgJGNvbXBhY3RfdHlwZSA9ICRjb21wYWN0X3R5cGVfYW5kX2RlbHRhICYgMHgwZjsKKworICAgICAgICBpZiAoJGNvbXBhY3RfdHlwZSA9PSBUVHlwZTo6U1RPUCkgeworICAgICAgICAgICAgJGZpZWxkX3R5cGUgPSAkY29tcGFjdF90eXBlOworICAgICAgICAgICAgJGZpZWxkX2lkID0gMDsKKworICAgICAgICAgICAgcmV0dXJuICRyZXN1bHQ7CisgICAgICAgIH0KKyAgICAgICAgJGRlbHRhID0gJGNvbXBhY3RfdHlwZV9hbmRfZGVsdGEgPj4gNDsKKyAgICAgICAgaWYgKCRkZWx0YSA9PSAwKSB7CisgICAgICAgICAgICAkcmVzdWx0ICs9ICR0aGlzLT5yZWFkSTE2KCRmaWVsZF9pZCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkZmllbGRfaWQgPSAkdGhpcy0+bGFzdEZpZCArICRkZWx0YTsKKyAgICAgICAgfQorICAgICAgICAkdGhpcy0+bGFzdEZpZCA9ICRmaWVsZF9pZDsKKyAgICAgICAgJGZpZWxkX3R5cGUgPSAkdGhpcy0+Z2V0VFR5cGUoJGNvbXBhY3RfdHlwZSk7CisKKyAgICAgICAgaWYgKCRjb21wYWN0X3R5cGUgPT0gVENvbXBhY3RQcm90b2NvbDo6Q09NUEFDVF9UUlVFKSB7CisgICAgICAgICAgICAkdGhpcy0+c3RhdGUgPSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9CT09MX1JFQUQ7CisgICAgICAgICAgICAkdGhpcy0+Ym9vbFZhbHVlID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlaWYgKCRjb21wYWN0X3R5cGUgPT0gVENvbXBhY3RQcm90b2NvbDo6Q09NUEFDVF9GQUxTRSkgeworICAgICAgICAgICAgJHRoaXMtPnN0YXRlID0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfQk9PTF9SRUFEOworICAgICAgICAgICAgJHRoaXMtPmJvb2xWYWx1ZSA9IGZhbHNlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJHRoaXMtPnN0YXRlID0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfVkFMVUVfUkVBRDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkcmVzdWx0OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRmllbGRFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnN0YXRlID0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfRklFTERfUkVBRDsKKworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFVCeXRlKCYkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoMSk7CisgICAgICAgICRhcnIgPSB1bnBhY2soJ0MnLCAkZGF0YSk7CisgICAgICAgICR2YWx1ZSA9ICRhcnJbMV07CisKKyAgICAgICAgcmV0dXJuIDE7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRCeXRlKCYkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoMSk7CisgICAgICAgICRhcnIgPSB1bnBhY2soJ2MnLCAkZGF0YSk7CisgICAgICAgICR2YWx1ZSA9ICRhcnJbMV07CisKKyAgICAgICAgcmV0dXJuIDE7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRaaWdaYWcoJiR2YWx1ZSkKKyAgICB7CisgICAgICAgICRyZXN1bHQgPSAkdGhpcy0+cmVhZFZhcmludCgkdmFsdWUpOworICAgICAgICAkdmFsdWUgPSAkdGhpcy0+ZnJvbVppZ1phZygkdmFsdWUpOworCisgICAgICAgIHJldHVybiAkcmVzdWx0OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTWVzc2FnZUJlZ2luKCYkbmFtZSwgJiR0eXBlLCAmJHNlcWlkKQorICAgIHsKKyAgICAgICAgJHByb3RvSWQgPS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AgICRuYW1lID0gJyc7IC8vIHVudXNlZAorICAgICAgICAkdGhpcy0+c3RydWN0c1tdID0gYXJyYXkoJHRoaXMtPnN0YXRlLCAkdGhpcy0+bGFzdEZpZCk7CisgICAgICAgICR0aGlzLT5zdGF0ZSA9IFRDb21wYWN0UHJvdG9jb2w6OlNUQVRFX0ZJRUxEX1JFQUQ7CisgICAgICAgICR0aGlzLT5sYXN0RmlkID0gMDsKKworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFN0cnVjdEVuZCgpCisgICAgeworICAgICAgICAkbGFzdCA9IGFycmF5X3BvcCgkdGhpcy0+c3RydWN0cyk7CisgICAgICAgICR0aGlzLT5zdGF0ZSA9ICRsYXN0WzBdOworICAgICAgICAkdGhpcy0+bGFzdEZpZCA9ICRsYXN0WzFdOworCisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkQ29sbGVjdGlvbkJlZ2luKCYkdHlwZSwgJiRzaXplKQorICAgIHsKKyAgICAgICAgJHNpemVUeXBlID0gMDsKKyAgICAgICAgJHJlc3VsdCA9ICR0aGlzLT5yZWFkVUJ5dGUoJHNpemVUeXBlKTsKKyAgICAgICAgJHNpemUgPSAkc2l6ZVR5cGUgPj4gNDsKKyAgICAgICAgJHR5cGUgPSAkdGhpcy0+Z2V0VFR5cGUoJHNpemVUeXBlKTsKKyAgICAgICAgaWYgKCRzaXplID09IDE1KSB7CisgICAgICAgICAgICAkcmVzdWx0ICs9ICR0aGlzLT5yZWFkVmFyaW50KCRzaXplKTsKKyAgICAgICAgfQorICAgICAgICAkdGhpcy0+Y29udGFpbmVyc1tdID0gJHRoaXMtPnN0YXRlOworICAgICAgICAkdGhpcy0+c3RhdGUgPSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9DT05UQUlORVJfUkVBRDsKKworICAgICAgICByZXR1cm4gJHJlc3VsdDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1hcEJlZ2luKCYka2V5X3R5cGUsICYkdmFsX3R5cGUsICYkc2l6ZSkKKyAgICB7CisgICAgICAgICRyZXN1bHQgPSAkdGhpcy0+cmVhZFZhcmludCgkc2l6ZSk7CisgICAgICAgICR0eXBlcyA9IDA7CisgICAgICAgIGlmICgkc2l6ZSA+IDApIHsKKyAgICAgICAgICAgICRyZXN1bHQgKz0gJHRoaXMtPnJlYWRVQnl0ZSgkdHlwZXMpOworICAgICAgICB9CisgICAgICAgICR2YWxfdHlwZSA9ICR0aGlzLT5nZXRUVHlwZSgkdHlwZXMpOworICAgICAgICAka2V5X3R5cGUgPSAkdGhpcy0+Z2V0VFR5cGUoJHR5cGVzID4+IDQpOworICAgICAgICAkdGhpcy0+Y29udGFpbmVyc1tdID0gJHRoaXMtPnN0YXRlOworICAgICAgICAkdGhpcy0+c3RhdGUgPSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9DT05UQUlORVJfUkVBRDsKKworICAgICAgICByZXR1cm4gJHJlc3VsdDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZENvbGxlY3Rpb25FbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnN0YXRlID0gYXJyYXlfcG9wKCR0aGlzLT5jb250YWluZXJzKTsKKworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1hcEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPnJlYWRDb2xsZWN0aW9uRW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRMaXN0QmVnaW4oJiRlbGVtX3R5cGUsICYkc2l6ZSkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZENvbGxlY3Rpb25CZWdpbigkZWxlbV90eXBlLCAkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRMaXN0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZENvbGxlY3Rpb25FbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFNldEJlZ2luKCYkZWxlbV90eXBlLCAmJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPnJlYWRDb2xsZWN0aW9uQmVnaW4oJGVsZW1fdHlwZSwgJHNpemUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU2V0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZENvbGxlY3Rpb25FbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEJvb2woJiR2YWx1ZSkKKyAgICB7CisgICAgICAgIGlmICgkdGhpcy0+c3RhdGUgPT0gVENvbXBhY3RQcm90b2NvbDo6U1RBVEVfQk9PTF9SRUFEKSB7CisgICAgICAgICAgICAkdmFsdWUgPSAkdGhpcy0+Ym9vbFZhbHVlOworCisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfSBlbHNlaWYgKCR0aGlzLT5zdGF0ZSA9PSBUQ29tcGFjdFByb3RvY29sOjpTVEFURV9DT05UQUlORVJfUkVBRCkgeworICAgICAgICAgICAgcmV0dXJuICR0aGlzLT5yZWFkQnl0ZSgkdmFsdWUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbignSW52YWxpZCBzdGF0ZSBpbiBjb21wYWN0IHByb3RvY29sJyk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEkxNigmJHZhbHVlKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT5yZWFkWmlnWmFnKCR2YWx1ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJMzIoJiR2YWx1ZSkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZFppZ1phZygkdmFsdWUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRG91YmxlKCYkdmFsdWUpCisgICAgeworICAgICAgICAkZGF0YSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoOCk7CisgICAgICAgICRhcnIgPSB1bnBhY2soJ2QnLCAkZGF0YSk7CisgICAgICAgICR2YWx1ZSA9ICRhcnJbMV07CisKKyAgICAgICAgcmV0dXJuIDg7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJpbmcoJiR2YWx1ZSkKKyAgICB7CisgICAgICAgICRyZXN1bHQgPSAkdGhpcy0+cmVhZFZhcmludCgkbGVuKTsKKyAgICAgICAgaWYgKCRsZW4pIHsKKyAgICAgICAgICAgICR2YWx1ZSA9ICR0aGlzLT50cmFuc18tPnJlYWRBbGwoJGxlbik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkdmFsdWUgPSAnJzsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkcmVzdWx0ICsgJGxlbjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gZ2V0VFR5cGUoJGJ5dGUpCisgICAgeworICAgICAgICByZXR1cm4gc2VsZjo6JHR0eXBlc1skYnl0ZSAmIDB4MGZdOworICAgIH0KKworICAgIC8vIElmIHdlIGFyZSBvbiBhIDMyYml0IGFyY2hpdGVjdHVyZSB3ZSBoYXZlIHRvIGV4cGxpY2l0bHkgZGVhbCB3aXRoCisgICAgLy8gNjQtYml0IHR3b3MtY29tcGxlbWVudCBhcml0aG1ldGljIHNpbmNlIFBIUCB3YW50cyB0byB0cmVhdCBhbGwgaW50cworICAgIC8vIGFzIHNpZ25lZCBhbmQgYW55IGludCBvdmVyIDJeMzEgLSAxIGFzIGEgZmxvYXQKKworICAgIC8vIFJlYWQgYW5kIHdyaXRlIEk2NCBhcyB0d28gMzIgYml0IG51bWJlcnMgJGhpIGFuZCAkbG8KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTY0KCYkdmFsdWUpCisgICAgeworICAgICAgICAvLyBSZWFkIHZhcmludCBmcm9tIHdpcmUKKyAgICAgICAgJGhpID0gMDsKKyAgICAgICAgJGxvID0gMDsKKworICAgICAgICAkaWR4ID0gMDsKKyAgICAgICAgJHNoaWZ0ID0gMDsKKworICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgJHggPSAkdGhpcy0+dHJhbnNfLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgJGFyciA9IHVucGFjaygnQycsICR4KTsKKyAgICAgICAgICAgICRieXRlID0gJGFyclsxXTsKKyAgICAgICAgICAgICRpZHggKz0gMTsKKyAgICAgICAgICAgIC8vIFNoaWZ0IGhpIGFuZCBsbyB0b2dldGhlci4KKyAgICAgICAgICAgIGlmICgkc2hpZnQgPCAyOCkgeworICAgICAgICAgICAgICAgICRsbyB8PSAoKCRieXRlICYgMHg3ZikgPDwgJHNoaWZ0KTsKKyAgICAgICAgICAgIH0gZWxzZWlmICgkc2hpZnQgPT0gMjgpIHsKKyAgICAgICAgICAgICAgICAkbG8gfD0gKCgkYnl0ZSAmIDB4MGYpIDw8IDI4KTsKKyAgICAgICAgICAgICAgICAkaGkgfD0gKCgkYnl0ZSAmIDB4NzApID4+IDQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAkaGkgfD0gKCgkYnl0ZSAmIDB4N2YpIDw8ICgkc2hpZnQgLSAzMikpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCgkYnl0ZSA+PiA3KSA9PT0gMCkgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgJHNoaWZ0ICs9IDc7CisgICAgICAgIH0KKworICAgICAgICAvLyBOb3csIHVuemlnIGl0LgorICAgICAgICAkeG9yZXIgPSAwOworICAgICAgICBpZiAoJGxvICYgMSkgeworICAgICAgICAgICAgJHhvcmVyID0gMHhmZmZmZmZmZjsKKyAgICAgICAgfQorICAgICAgICAkbG8gPSAoJGxvID4+IDEpICYgMHg3ZmZmZmZmZjsKKyAgICAgICAgJGxvID0gJGxvIHwgKCgkaGkgJiAxKSA8PCAzMSk7CisgICAgICAgICRoaSA9ICgkaGkgPj4gMSkgXiAkeG9yZXI7CisgICAgICAgICRsbyA9ICRsbyBeICR4b3JlcjsKKworICAgICAgICAvLyBOb3cgcHV0ICRoaSBhbmQgJGxvIGJhY2sgdG9nZXRoZXIKKyAgICAgICAgJGlzTmVnID0gJGhpIDwgMCB8fCAkaGkgJiAweDgwMDAwMDAwOworCisgICAgICAgIC8vIENoZWNrIGZvciBhIG5lZ2F0aXZlCisgICAgICAgIGlmICgkaXNOZWcpIHsKKyAgICAgICAgICAgICRoaSA9IH4kaGkgJiAoaW50KTB4ZmZmZmZmZmY7CisgICAgICAgICAgICAkbG8gPSB+JGxvICYgKGludCkweGZmZmZmZmZmOworCisgICAgICAgICAgICBpZiAoJGxvID09IChpbnQpMHhmZmZmZmZmZikgeworICAgICAgICAgICAgICAgICRoaSsrOworICAgICAgICAgICAgICAgICRsbyA9IDA7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICRsbysrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gRm9yY2UgMzJiaXQgd29yZHMgaW4gZXhjZXNzIG9mIDJHIHRvIGJlIHBvc2l0aXZlIC0gd2UgZGVhbCB3aXRoIHNpZ24KKyAgICAgICAgLy8gZXhwbGljaXRseSBiZWxvdworCisgICAgICAgIGlmICgkaGkgJiAoaW50KTB4ODAwMDAwMDApIHsKKyAgICAgICAgICAgICRoaSAmPSAoaW50KTB4N2ZmZmZmZmY7CisgICAgICAgICAgICAkaGkgKz0gMHg4MDAwMDAwMDsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgkbG8gJiAoaW50KTB4ODAwMDAwMDApIHsKKyAgICAgICAgICAgICRsbyAmPSAoaW50KTB4N2ZmZmZmZmY7CisgICAgICAgICAgICAkbG8gKz0gMHg4MDAwMDAwMDsKKyAgICAgICAgfQorCisgICAgICAgIC8vIENyZWF0ZSBhcyBuZWdhdGl2ZSB2YWx1ZSBmaXJzdCwgc2luY2Ugd2UgY2FuIHN0b3JlIC0yXjYzIGJ1dCBub3QgMl42MworICAgICAgICAkdmFsdWUgPSAtJGhpICogNDI5NDk2NzI5NiAtICRsbzsKKworICAgICAgICBpZiAoISRpc05lZykgeworICAgICAgICAgICAgJHZhbHVlID0gLSR2YWx1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkaWR4OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUk2NCgkdmFsdWUpCisgICAgeworICAgICAgICAvLyBJZiB3ZSBhcmUgaW4gYW4gSTMyIHJhbmdlLCB1c2UgdGhlIGVhc3kgbWV0aG9kIGJlbG93LgorICAgICAgICBpZiAoKCR2YWx1ZSA+IDQyOTQ5NjcyOTYpIHx8ICgkdmFsdWUgPCAtNDI5NDk2NzI5NikpIHsKKyAgICAgICAgICAgIC8vIENvbnZlcnQgJHZhbHVlIHRvICRoaSBhbmQgJGxvCisgICAgICAgICAgICAkbmVnID0gJHZhbHVlIDwgMDsKKworICAgICAgICAgICAgaWYgKCRuZWcpIHsKKyAgICAgICAgICAgICAgICAkdmFsdWUgKj0gLTE7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICRoaSA9IChpbnQpJHZhbHVlID4+IDMyOworICAgICAgICAgICAgJGxvID0gKGludCkkdmFsdWUgJiAweGZmZmZmZmZmOworCisgICAgICAgICAgICBpZiAoJG5lZykgeworICAgICAgICAgICAgICAgICRoaSA9IH4kaGk7CisgICAgICAgICAgICAgICAgJGxvID0gfiRsbzsKKyAgICAgICAgICAgICAgICBpZiAoKCRsbyAmIChpbnQpMHhmZmZmZmZmZikgPT0gKGludCkweGZmZmZmZmZmKSB7CisgICAgICAgICAgICAgICAgICAgICRsbyA9IDA7CisgICAgICAgICAgICAgICAgICAgICRoaSsrOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICRsbysrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gTm93IGRvIHRoZSB6aWdnaW5nIGFuZCB6YWdnaW5nLgorICAgICAgICAgICAgJHhvcmVyID0gMDsKKyAgICAgICAgICAgIGlmICgkbmVnKSB7CisgICAgICAgICAgICAgICAgJHhvcmVyID0gMHhmZmZmZmZmZjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICRsb3diaXQgPSAoJGxvID4+IDMxKSAmIDE7CisgICAgICAgICAgICAkaGkgPSAoJGhpIDw8IDEpIHwgJGxvd2JpdDsKKyAgICAgICAgICAgICRsbyA9ICgkbG8gPDwgMSk7CisgICAgICAgICAgICAkbG8gPSAoJGxvIF4gJHhvcmVyKSAmIDB4ZmZmZmZmZmY7CisgICAgICAgICAgICAkaGkgPSAoJGhpIF4gJHhvcmVyKSAmIDB4ZmZmZmZmZmY7CisKKyAgICAgICAgICAgIC8vIG5vdyB3cml0ZSBvdXQgdGhlIHZhcmludCwgZW5zdXJpbmcgd2Ugc2hpZnQgYm90aCBoaSBhbmQgbG8KKyAgICAgICAgICAgICRvdXQgPSAiIjsKKyAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAgICAgaWYgKCgkbG8gJiB+MHg3ZikgPT09IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgJGhpID09PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICRvdXQgLj0gY2hyKCRsbyk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICRvdXQgLj0gY2hyKCgkbG8gJiAweGZmKSB8IDB4ODApOworICAgICAgICAgICAgICAgICAgICAkbG8gPSAkbG8gPj4gNzsKKyAgICAgICAgICAgICAgICAgICAgJGxvID0gJGxvIHwgKCRoaSA8PCAyNSk7CisgICAgICAgICAgICAgICAgICAgICRoaSA9ICRoaSA+PiA3OworICAgICAgICAgICAgICAgICAgICAvLyBSaWdodCBzaGlmdCBjYXJyaWVzIHNpZ24sIGJ1dCB3ZSBkb24ndCB3YW50IGl0IHRvLgorICAgICAgICAgICAgICAgICAgICAkaGkgPSAkaGkgJiAoMTI3IDw8IDI1KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICRyZXQgPSBUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJG91dCk7CisgICAgICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZSgkb3V0LCAkcmV0KTsKKworICAgICAgICAgICAgcmV0dXJuICRyZXQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gJHRoaXMtPndyaXRlVmFyaW50KCR0aGlzLT50b1ppZ1phZygkdmFsdWUsIDY0KSk7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9saWIvcGhwL2xpYi9Qcm90b2NvbC9USlNPTlByb3RvY29sLnBocCBiL2xpYi9waHAvbGliL1Byb3RvY29sL1RKU09OUHJvdG9jb2wucGhwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjkxNDQ4ODQKLS0tIC9kZXYvbnVsbAorKysgYi9saWIvcGhwL2xpYi9Qcm90b2NvbC9USlNPTlByb3RvY29sLnBocApAQCAtMCwwICsxLDgxNSBAQAorPD9waHAKKworLyoKKyAqIExpY2Vuc2VkIHRvIHRoZSBBcGFjaGUgU29mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSB1bmRlciBvbmUKKyAqIG9yIG1vcmUgY29udHJpYnV0b3IgbGljZW5zZSBhZ3JlZW1lbnRzLiBTZWUgd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ICAgICAgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgLy8gMQorICAgICAgICAxLCAxLCAnIicsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIC8vIDIKKyAgICApOworCisgICAgcHVibGljIHN0YXRpYyAkRVNDQVBFX0NIQVJTID0gYXJyYXkoJyInLCAnXFwnLCAnLycsICJiIiwgImYiLCAibiIsICJyIiwgInQiKTsKKworICAgIHB1YmxpYyBzdGF0aWMgJEVTQ0FQRV9DSEFSX1ZBTFMgPSBhcnJheSgKKyAgICAgICAgJyInLCAnXFwnLCAnLycsICJceDA4IiwgIlxmIiwgIlxuIiwgIlxyIiwgIlx0IiwKKyAgICApOworCisgICAgY29uc3QgTkFNRV9CT09MID0gInRmIjsKKyAgICBjb25zdCBOQU1FX0JZVEUgPSAiaTgiOworICAgIGNvbnN0IE5BTUVfSTE2ID0gImkxNiI7CisgICAgY29uc3QgTkFNRV9JMzIgPSAiaTMyIjsKKyAgICBjb25zdCBOQU1FX0k2NCA9ICJpNjQiOworICAgIGNvbnN0IE5BTUVfRE9VQkxFID0gImRibCI7CisgICAgY29uc3QgTkFNRV9TVFJVQ1QgPSAicmVjIjsKKyAgICBjb25zdCBOQU1FX1NUUklORyA9ICJzdHIiOworICAgIGNvbnN0IE5BTUVfTUFQID0gIm1hcCI7CisgICAgY29uc3QgTkFNRV9MSVNUID0gImxzdCI7CisgICAgY29uc3QgTkFNRV9TRVQgPSAic2V0IjsKKworICAgIHByaXZhdGUgZnVuY3Rpb24gZ2V0VHlwZU5hbWVGb3JUeXBlSUQoJHR5cGVJRCkKKyAgICB7CisgICAgICAgIHN3aXRjaCAoJHR5cGVJRCkgeworICAgICAgICAgICAgY2FzZSBUVHlwZTo6Qk9PTDoKKyAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9CT09MOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6QllURToKKyAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9CWVRFOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6STE2OgorICAgICAgICAgICAgICAgIHJldHVybiBzZWxmOjpOQU1FX0kxNjsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OkkzMjoKKyAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9JMzI7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpJNjQ6CisgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGY6Ok5BTUVfSTY0OworICAgICAgICAgICAgY2FzZSBUVHlwZTo6RE9VQkxFOgorICAgICAgICAgICAgICAgIHJldHVybiBzZWxmOjpOQU1FX0RPVUJMRTsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUklORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9TVFJJTkc7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpTVFJVQ1Q6CisgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGY6Ok5BTUVfU1RSVUNUOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgorICAgICAgICAgICAgICAgIHJldHVybiBzZWxmOjpOQU1FX01BUDsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKKyAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9TRVQ7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpMU1Q6CisgICAgICAgICAgICAgICAgcmV0dXJuIHNlbGY6Ok5BTUVfTElTVDsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigiVW5yZWNvZ25pemVkIHR5cGUiLCBUUHJvdG9jb2xFeGNlcHRpb246OlVOS05PV04pOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBnZXRUeXBlSURGb3JUeXBlTmFtZSgkbmFtZSkKKyAgICB7CisgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6U1RPUDsKKworICAgICAgICBpZiAoc3RybGVuKCRuYW1lKSA+IDEpIHsKKyAgICAgICAgICAgIHN3aXRjaCAoc3Vic3RyKCRuYW1lLCAwLCAxKSkgeworICAgICAgICAgICAgICAgIGNhc2UgJ2QnOgorICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OkRPVUJMRTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSAnaSc6CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3Vic3RyKCRuYW1lLCAxLCAxKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnOCc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpCWVRFOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMSc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpJMTY7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICczJzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OkkzMjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzYnOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6STY0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJ2wnOgorICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OkxTVDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSAnbSc6CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6TUFQOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlICdyJzoKKyAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpTVFJVQ1Q7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJ3MnOgorICAgICAgICAgICAgICAgICAgICBpZiAoc3Vic3RyKCRuYW1lLCAxLCAxKSA9PSAndCcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6U1RSSU5HOworICAgICAgICAgICAgICAgICAgICB9IGVsc2VpZiAoc3Vic3RyKCRuYW1lLCAxLCAxKSA9PSAnZScpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6U0VUOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgJ3QnOgorICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OkJPT0w7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgkcmVzdWx0ID09IFRUeXBlOjpTVE9QKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCJVbnJlY29nbml6ZWQgdHlwZSIsIFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkcmVzdWx0OworICAgIH0KKworICAgIHB1YmxpYyAkY29udGV4dFN0YWNrXyA9IGFycmF5KCk7CisgICAgcHVibGljICRjb250ZXh0XzsKKyAgICBwdWJsaWMgJHJlYWRlcl87CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHB1c2hDb250ZXh0KCRjKQorICAgIHsKKyAgICAgICAgYXJyYXlfcHVzaCgkdGhpcy0+Y29udGV4dFN0YWNrXywgJHRoaXMtPmNvbnRleHRfKTsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfID0gJGM7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBwb3BDb250ZXh0KCkKKyAgICB7CisgICAgICAgICR0aGlzLT5jb250ZXh0XyA9IGFycmF5X3BvcCgkdGhpcy0+Y29udGV4dFN0YWNrXyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCR0cmFucykKKyAgICB7CisgICAgICAgIHBhcmVudDo6X19jb25zdHJ1Y3QoJHRyYW5zKTsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfID0gbmV3IEJhc2VDb250ZXh0KCk7CisgICAgICAgICR0aGlzLT5yZWFkZXJfID0gbmV3IExvb2thaGVhZFJlYWRlcigkdGhpcyk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlc2V0KCkKKyAgICB7CisgICAgICAgICR0aGlzLT5jb250ZXh0U3RhY2tfID0gYXJyYXkoKTsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfID0gbmV3IEJhc2VDb250ZXh0KCk7CisgICAgICAgICR0aGlzLT5yZWFkZXJfID0gbmV3IExvb2thaGVhZFJlYWRlcigkdGhpcyk7CisgICAgfQorCisgICAgcHJpdmF0ZSAkdG1wYnVmXyA9IGFycmF5KDQpOworCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRKU09OU3ludGF4Q2hhcigkYikKKyAgICB7CisgICAgICAgICRjaCA9ICR0aGlzLT5yZWFkZXJfLT5yZWFkKCk7CisKKyAgICAgICAgaWYgKHN1YnN0cigkY2gsIDAsIDEpICE9ICRiKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCJVbmV4cGVjdGVkIGNoYXJhY3RlcjogIiAuICRjaCwgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBoZXhWYWwoJHMpCisgICAgeworICAgICAgICBmb3IgKCRpID0gMDsgJGkgPCBzdHJsZW4oJHMpOyAkaSsrKSB7CisgICAgICAgICAgICAkY2ggPSBzdWJzdHIoJHMsICRpLCAxKTsKKworICAgICAgICAgICAgaWYgKCEoJGNoID49ICJhIiAmJiAkY2ggPD0gImYiKSAmJiAhKCRjaCA+PSAiMCIgJiYgJGNoIDw9ICI5IikpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCJFeHBlY3RlZCBoZXggY2hhcmFjdGVyICIgLiAkY2gsIFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBoZXhkZWMoJHMpOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gaGV4Q2hhcigkdmFsKQorICAgIHsKKyAgICAgICAgcmV0dXJuIGRlY2hleCgkdmFsKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIGhhc0pTT05VbmVzY2FwZWRVbmljb2RlKCkKKyAgICB7CisgICAgICAgIGlmIChQSFBfTUFKT1JfVkVSU0lPTiA+IDUgfHwgKFBIUF9NQUpPUl9WRVJTSU9OID09IDUgJiYgUEhQX01JTk9SX1ZFUlNJT04gPj0gNCkpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gdW5lc2NhcGVkVW5pY29kZSgkc3RyKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT5oYXNKU09OVW5lc2NhcGVkVW5pY29kZSgpKSB7CisgICAgICAgICAgICByZXR1cm4ganNvbl9lbmNvZGUoJHN0ciwgSlNPTl9VTkVTQ0FQRURfVU5JQ09ERSk7CisgICAgICAgIH0KKworICAgICAgICAkanNvbiA9IGpzb25fZW5jb2RlKCRzdHIpOworCisgICAgICAgIC8qCisgICAgICAgICAqIFVuZXNjYXBlZCBjaGFyYWN0ZXIgb3V0c2lkZSB0aGUgQmFzaWMgTXVsdGlsaW5ndWFsIFBsYW5lCisgICAgICAgICAqIEhpZ2ggc3Vycm9nYXRlOiAweEQ4MDAgLSAweERCRkYKKyAgICAgICAgICogTG93IHN1cnJvZ2F0ZTogMHhEQzAwIC0gMHhERkZGCisgICAgICAgICAqLworICAgICAgICAkanNvbiA9IHByZWdfcmVwbGFjZV9jYWxsYmFjaygKKyAgICAgICAgICAgICcvXFxcXHUoZFs4OWFiXVswLTlhLWZdezJ9KVxcXFx1KGRbY2RlZl1bMC05YS1mXXsyfSkvaScsCisgICAgICAgICAgICBmdW5jdGlvbiAoJG1hdGNoZXMpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbWJfY29udmVydF9lbmNvZGluZyhwYWNrKCdIKicsICRtYXRjaGVzWzFdIC4gJG1hdGNoZXNbMl0pLCAnVVRGLTgnLCAnVVRGLTE2QkUnKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICAkanNvbgorICAgICAgICApOworCisgICAgICAgIC8qCisgICAgICAgICAqIFVuZXNjYXBlZCBjaGFyYWN0ZXJzIHdpdGhpbiB0aGUgQmFzaWMgTXVsdGlsaW5ndWFsIFBsYW5lCisgICAgICAgICAqLworICAgICAgICAkanNvbiA9IHByZWdfcmVwbGFjZV9jYWxsYmFjaygKKyAgICAgICAgICAgICcvXFxcXHUoWzAtOWEtZl17NH0pL2knLAorICAgICAgICAgICAgZnVuY3Rpb24gKCRtYXRjaGVzKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1iX2NvbnZlcnRfZW5jb2RpbmcocGFjaygnSConLCAkbWF0Y2hlc1sxXSksICdVVEYtOCcsICdVVEYtMTZCRScpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICRqc29uCisgICAgICAgICk7CisKKyAgICAgICAgcmV0dXJuICRqc29uOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gd3JpdGVKU09OU3RyaW5nKCRiKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfLT53cml0ZSgpOworCisgICAgICAgIGlmIChpc19udW1lcmljKCRiKSAmJiAkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7CisgICAgICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpRVU9URSk7CisgICAgICAgIH0KKworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZSgkdGhpcy0+dW5lc2NhcGVkVW5pY29kZSgkYikpOworCisgICAgICAgIGlmIChpc19udW1lcmljKCRiKSAmJiAkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7CisgICAgICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpRVU9URSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHdyaXRlSlNPTkludGVnZXIoJG51bSkKKyAgICB7CisgICAgICAgICR0aGlzLT5jb250ZXh0Xy0+d3JpdGUoKTsKKworICAgICAgICBpZiAoJHRoaXMtPmNvbnRleHRfLT5lc2NhcGVOdW0oKSkgeworICAgICAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoJG51bSk7CisKKyAgICAgICAgaWYgKCR0aGlzLT5jb250ZXh0Xy0+ZXNjYXBlTnVtKCkpIHsKKyAgICAgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gd3JpdGVKU09ORG91YmxlKCRudW0pCisgICAgeworICAgICAgICAkdGhpcy0+Y29udGV4dF8tPndyaXRlKCk7CisKKyAgICAgICAgaWYgKCR0aGlzLT5jb250ZXh0Xy0+ZXNjYXBlTnVtKCkpIHsKKyAgICAgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgfQorCisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKGpzb25fZW5jb2RlKCRudW0pKTsKKworICAgICAgICBpZiAoJHRoaXMtPmNvbnRleHRfLT5lc2NhcGVOdW0oKSkgeworICAgICAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiB3cml0ZUpTT05CYXNlNjQoJGRhdGEpCisgICAgeworICAgICAgICAkdGhpcy0+Y29udGV4dF8tPndyaXRlKCk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoanNvbl9lbmNvZGUoYmFzZTY0X2VuY29kZSgkZGF0YSkpKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UVVPVEUpOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gd3JpdGVKU09OT2JqZWN0U3RhcnQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfLT53cml0ZSgpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpMQlJBQ0UpOworICAgICAgICAkdGhpcy0+cHVzaENvbnRleHQobmV3IFBhaXJDb250ZXh0KCR0aGlzKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiB3cml0ZUpTT05PYmplY3RFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnBvcENvbnRleHQoKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UkJSQUNFKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHdyaXRlSlNPTkFycmF5U3RhcnQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfLT53cml0ZSgpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpMQlJBQ0tFVCk7CisgICAgICAgICR0aGlzLT5wdXNoQ29udGV4dChuZXcgTGlzdENvbnRleHQoJHRoaXMpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHdyaXRlSlNPTkFycmF5RW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5wb3BDb250ZXh0KCk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlJCUkFDS0VUKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09OU3RyaW5nKCRza2lwQ29udGV4dCkKKyAgICB7CisgICAgICAgIGlmICghJHNraXBDb250ZXh0KSB7CisgICAgICAgICAgICAkdGhpcy0+Y29udGV4dF8tPnJlYWQoKTsKKyAgICAgICAgfQorCisgICAgICAgICRqc29uU3RyaW5nID0gJyc7CisgICAgICAgICRsYXN0Q2hhciA9IG51bGw7CisgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAkY2ggPSAkdGhpcy0+cmVhZGVyXy0+cmVhZCgpOworICAgICAgICAgICAgJGpzb25TdHJpbmcgLj0gJGNoOworICAgICAgICAgICAgaWYgKCRjaCA9PSBzZWxmOjpRVU9URSAmJgorICAgICAgICAgICAgICAgICRsYXN0Q2hhciAhPT0gbnVsbCAmJgorICAgICAgICAgICAgICAgICRsYXN0Q2hhciAhPT0gc2VsZjo6RVNDU0VRKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoJGNoID09IHNlbGY6OkVTQ1NFUSAmJiAkbGFzdENoYXIgPT0gc2VsZjo6RVNDU0VRKSB7CisgICAgICAgICAgICAgICAgJGxhc3RDaGFyID0gc2VsZjo6RE9VQkxFRVNDOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAkbGFzdENoYXIgPSAkY2g7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4ganNvbl9kZWNvZGUoJGpzb25TdHJpbmcpOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gaXNKU09OTnVtZXJpYygkYikKKyAgICB7CisgICAgICAgIHN3aXRjaCAoJGIpIHsKKyAgICAgICAgICAgIGNhc2UgJysnOgorICAgICAgICAgICAgY2FzZSAnLSc6CisgICAgICAgICAgICBjYXNlICcuJzoKKyAgICAgICAgICAgIGNhc2UgJzAnOgorICAgICAgICAgICAgY2FzZSAnMSc6CisgICAgICAgICAgICBjYXNlICcyJzoKKyAgICAgICAgICAgIGNhc2UgJzMnOgorICAgICAgICAgICAgY2FzZSAnNCc6CisgICAgICAgICAgICBjYXNlICc1JzoKKyAgICAgICAgICAgIGNhc2UgJzYnOgorICAgICAgICAgICAgY2FzZSAnNyc6CisgICAgICAgICAgICBjYXNlICc4JzoKKyAgICAgICAgICAgIGNhc2UgJzknOgorICAgICAgICAgICAgY2FzZSAnRSc6CisgICAgICAgICAgICBjYXNlICdlJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09OTnVtZXJpY0NoYXJzKCkKKyAgICB7CisgICAgICAgICRzdHJibGQgPSBhcnJheSgpOworCisgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAkY2ggPSAkdGhpcy0+cmVhZGVyXy0+cGVlaygpOworCisgICAgICAgICAgICBpZiAoISR0aGlzLT5pc0pTT05OdW1lcmljKCRjaCkpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgJHN0cmJsZFtdID0gJHRoaXMtPnJlYWRlcl8tPnJlYWQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBpbXBsb2RlKCIiLCAkc3RyYmxkKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09OSW50ZWdlcigpCisgICAgeworICAgICAgICAkdGhpcy0+Y29udGV4dF8tPnJlYWQoKTsKKworICAgICAgICBpZiAoJHRoaXMtPmNvbnRleHRfLT5lc2NhcGVOdW0oKSkgeworICAgICAgICAgICAgJHRoaXMtPnJlYWRKU09OU3ludGF4Q2hhcihzZWxmOjpRVU9URSk7CisgICAgICAgIH0KKworICAgICAgICAkc3RyID0gJHRoaXMtPnJlYWRKU09OTnVtZXJpY0NoYXJzKCk7CisKKyAgICAgICAgaWYgKCR0aGlzLT5jb250ZXh0Xy0+ZXNjYXBlTnVtKCkpIHsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSlNPTlN5bnRheENoYXIoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFpc19udW1lcmljKCRzdHIpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFByb3RvY29sRXhjZXB0aW9uKCJJbnZhbGlkIGRhdGEgaW4gbnVtZXJpYzogIiAuICRzdHIsIFRQcm90b2NvbEV4Y2VwdGlvbjo6SU5WQUxJRF9EQVRBKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBpbnR2YWwoJHN0cik7CisgICAgfQorCisgICAgLyoqCisgICAgICogSWRlbnRpY2FsIHRvIHJlYWRKU09OSW50ZWdlciBidXQgd2l0aG91dCB0aGUgZmluYWwgY2FzdC4KKyAgICAgKiBOZWVkZWQgZm9yIHByb3BlciBoYW5kbGluZyBvZiBpNjQgb24gMzIgYml0IG1hY2hpbmVzLiAgV2h5IGEKKyAgICAgKiBzZXBhcmF0ZSBmdW5jdGlvbj8gIFNvIHdlIGRvbid0IGhhdmUgdG8gZm9yY2UgdGhlIHJlc3Qgb2YgdGhlCisgICAgICogdXNlIGNhc2VzIHRocm91Z2ggdGhlIGV4dHJhIGNvbmRpdGlvbmFsLgorICAgICAqLworICAgIHByaXZhdGUgZnVuY3Rpb24gcmVhZEpTT05JbnRlZ2VyQXNTdHJpbmcoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfLT5yZWFkKCk7CisKKyAgICAgICAgaWYgKCR0aGlzLT5jb250ZXh0Xy0+ZXNjYXBlTnVtKCkpIHsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSlNPTlN5bnRheENoYXIoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisKKyAgICAgICAgJHN0ciA9ICR0aGlzLT5yZWFkSlNPTk51bWVyaWNDaGFycygpOworCisgICAgICAgIGlmICgkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7CisgICAgICAgICAgICAkdGhpcy0+cmVhZEpTT05TeW50YXhDaGFyKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghaXNfbnVtZXJpYygkc3RyKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigiSW52YWxpZCBkYXRhIGluIG51bWVyaWM6ICIgLiAkc3RyLCBUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJHN0cjsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09ORG91YmxlKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5jb250ZXh0Xy0+cmVhZCgpOworCisgICAgICAgIGlmIChzdWJzdHIoJHRoaXMtPnJlYWRlcl8tPnBlZWsoKSwgMCwgMSkgPT0gc2VsZjo6UVVPVEUpIHsKKyAgICAgICAgICAgICRhcnIgPSAkdGhpcy0+cmVhZEpTT05TdHJpbmcodHJ1ZSk7CisKKyAgICAgICAgICAgIGlmICgkYXJyID09ICJOYU4iKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE5BTjsKKyAgICAgICAgICAgIH0gZWxzZWlmICgkYXJyID09ICJJbmZpbml0eSIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gSU5GOworICAgICAgICAgICAgfSBlbHNlaWYgKCEkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIk51bWVyaWMgZGF0YSB1bmV4cGVjdGVkbHkgcXVvdGVkICIgLiAkYXJyLAorICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQQorICAgICAgICAgICAgICAgICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBmbG9hdHZhbCgkYXJyKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7CisgICAgICAgICAgICAgICAgJHRoaXMtPnJlYWRKU09OU3ludGF4Q2hhcihzZWxmOjpRVU9URSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBmbG9hdHZhbCgkdGhpcy0+cmVhZEpTT05OdW1lcmljQ2hhcnMoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09OQmFzZTY0KCkKKyAgICB7CisgICAgICAgICRhcnIgPSAkdGhpcy0+cmVhZEpTT05TdHJpbmcoZmFsc2UpOworICAgICAgICAkZGF0YSA9IGJhc2U2NF9kZWNvZGUoJGFyciwgdHJ1ZSk7CisKKyAgICAgICAgaWYgKCRkYXRhID09PSBmYWxzZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigiSW52YWxpZCBiYXNlNjQgZGF0YSAiIC4gJGFyciwgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuICRkYXRhOworICAgIH0KKworICAgIHByaXZhdGUgZnVuY3Rpb24gcmVhZEpTT05PYmplY3RTdGFydCgpCisgICAgeworICAgICAgICAkdGhpcy0+Y29udGV4dF8tPnJlYWQoKTsKKyAgICAgICAgJHRoaXMtPnJlYWRKU09OU3ludGF4Q2hhcihzZWxmOjpMQlJBQ0UpOworICAgICAgICAkdGhpcy0+cHVzaENvbnRleHQobmV3IFBhaXJDb250ZXh0KCR0aGlzKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiByZWFkSlNPTk9iamVjdEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+cmVhZEpTT05TeW50YXhDaGFyKHNlbGY6OlJCUkFDRSk7CisgICAgICAgICR0aGlzLT5wb3BDb250ZXh0KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiByZWFkSlNPTkFycmF5U3RhcnQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmNvbnRleHRfLT5yZWFkKCk7CisgICAgICAgICR0aGlzLT5yZWFkSlNPTlN5bnRheENoYXIoc2VsZjo6TEJSQUNLRVQpOworICAgICAgICAkdGhpcy0+cHVzaENvbnRleHQobmV3IExpc3RDb250ZXh0KCR0aGlzKSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiByZWFkSlNPTkFycmF5RW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5yZWFkSlNPTlN5bnRheENoYXIoc2VsZjo6UkJSQUNLRVQpOworICAgICAgICAkdGhpcy0+cG9wQ29udGV4dCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlcyB0aGUgbWVzc2FnZSBoZWFkZXIKKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgJG5hbWUgRnVuY3Rpb24gbmFtZQorICAgICAqIEBwYXJhbSBpbnQgJHR5cGUgbWVzc2FnZSB0eXBlIFRNZXNzYWdlVHlwZTo6Q0FMTCBvciBUTWVzc2FnZVR5cGU6OlJFUExZCisgICAgICogQHBhcmFtIGludCAkc2VxaWQgVGhlIHNlcXVlbmNlIGlkIG9mIHRoaXMgbWVzc2FnZQorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1lc3NhZ2VCZWdpbigkbmFtZSwgJHR5cGUsICRzZXFpZCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05BcnJheVN0YXJ0KCk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKHNlbGY6OlZFUlNJT04pOworICAgICAgICAkdGhpcy0+d3JpdGVKU09OU3RyaW5nKCRuYW1lKTsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkludGVnZXIoJHR5cGUpOworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkc2VxaWQpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENsb3NlIHRoZSBtZXNzYWdlCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWVzc2FnZUVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OQXJyYXlFbmQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXcml0ZXMgYSBzdHJ1Y3QgaGVhZGVyLgorICAgICAqCisgICAgICogQHBhcmFtICBzdHJpbmcgJG5hbWUgU3RydWN0IG5hbWUKKyAgICAgKiBAdGhyb3dzIFRFeGNlcHRpb24gb24gd3JpdGUgZXJyb3IKKyAgICAgKiBAcmV0dXJuIGludCAgICAgICAgSG93IG1hbnkgYnl0ZXMgd3JpdHRlbgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cnVjdEJlZ2luKCRuYW1lKQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2xvc2UgYSBzdHJ1Y3QuCisgICAgICoKKyAgICAgKiBAdGhyb3dzIFRFeGNlcHRpb24gb24gd3JpdGUgZXJyb3IKKyAgICAgKiBAcmV0dXJuIGludCAgICAgICAgSG93IG1hbnkgYnl0ZXMgd3JpdHRlbgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cnVjdEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OT2JqZWN0RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRCZWdpbigkZmllbGROYW1lLCAkZmllbGRUeXBlLCAkZmllbGRJZCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKCRmaWVsZElkKTsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05TdHJpbmcoJHRoaXMtPmdldFR5cGVOYW1lRm9yVHlwZUlEKCRmaWVsZFR5cGUpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVGaWVsZEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKc29uT2JqZWN0RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRTdG9wKCkKKyAgICB7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwQmVnaW4oJGtleVR5cGUsICR2YWxUeXBlLCAkc2l6ZSkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05BcnJheVN0YXJ0KCk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05TdHJpbmcoJHRoaXMtPmdldFR5cGVOYW1lRm9yVHlwZUlEKCRrZXlUeXBlKSk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05TdHJpbmcoJHRoaXMtPmdldFR5cGVOYW1lRm9yVHlwZUlEKCR2YWxUeXBlKSk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKCRzaXplKTsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwRW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05PYmplY3RFbmQoKTsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OQXJyYXlTdGFydCgpOworICAgICAgICAkdGhpcy0+d3JpdGVKU09OU3RyaW5nKCR0aGlzLT5nZXRUeXBlTmFtZUZvclR5cGVJRCgkZWxlbVR5cGUpKTsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkludGVnZXIoJHNpemUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUxpc3RFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU2V0QmVnaW4oJGVsZW1UeXBlLCAkc2l6ZSkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05BcnJheVN0YXJ0KCk7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05TdHJpbmcoJHRoaXMtPmdldFR5cGVOYW1lRm9yVHlwZUlEKCRlbGVtVHlwZSkpOworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlU2V0RW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05BcnJheUVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJvb2woJGJvb2wpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkYm9vbCA/IDEgOiAwKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVCeXRlKCRieXRlKQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkludGVnZXIoJGJ5dGUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkxNigkaTE2KQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkludGVnZXIoJGkxNik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTMyKCRpMzIpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkaTMyKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJNjQoJGk2NCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKCRpNjQpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZURvdWJsZSgkZHViKQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkRvdWJsZSgkZHViKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVTdHJpbmcoJHN0cikKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05TdHJpbmcoJHN0cik7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZHMgdGhlIG1lc3NhZ2U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mVnaW4oJiRuYW1lKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnJlYWRKU09OT2JqZWN0U3RhcnQoKTsKKworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZFN0cnVjdEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+cmVhZEpTT05PYmplY3RFbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEZpZWxkQmVnaW4oJiRuYW1lLCAmJGZpZWxkVHlwZSwgJiRmaWVsZElkKQorICAgIHsKKyAgICAgICAgJGNoID0gJHRoaXMtPnJlYWRlcl8tPnBlZWsoKTsKKyAgICAgICAgJG5hbWUgPSAiIjsKKworICAgICAgICBpZiAoc3Vic3RyKCRjaCwgMCwgMSkgPT0gc2VsZjo6UkJSQUNFKSB7CisgICAgICAgICAgICAkZmllbGRUeXBlID0gVFR5cGU6OlNUT1A7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkZmllbGRJZCA9ICR0aGlzLT5yZWFkSlNPTkludGVnZXIoKTsKKyAgICAgICAgICAgICR0aGlzLT5yZWFkSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgICAgICAgICAkZmllbGRUeXBlID0gJHRoaXMtPmdldFR5cGVJREZvclR5cGVOYW1lKCR0aGlzLT5yZWFkSlNPTlN0cmluZyhmYWxzZSkpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRGaWVsZEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+cmVhZEpTT05PYmplY3RFbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZE1hcEJlZ2luKCYka2V5VHlwZSwgJiR2YWxUeXBlLCAmJHNpemUpCisgICAgeworICAgICAgICAkdGhpcy0+cmVhZEpTT05BcnJheVN0YXJ0KCk7CisgICAgICAgICRrZXlUeXBlID0gJHRoaXMtPmdldFR5cGVJREZvclR5cGVOYW1lKCR0aGlzLT5yZWFkSlNPTlN0cmluZyhmYWxzZSkpOworICAgICAgICAkdmFsVHlwZSA9ICR0aGlzLT5nZXRUeXBlSURGb3JUeXBlTmFtZSgkdGhpcy0+cmVhZEpTT05TdHJpbmcoZmFsc2UpKTsKKyAgICAgICAgJHNpemUgPSAkdGhpcy0+cmVhZEpTT05JbnRlZ2VyKCk7CisgICAgICAgICR0aGlzLT5yZWFkSlNPTk9iamVjdFN0YXJ0KCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRNYXBFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnJlYWRKU09OT2JqZWN0RW5kKCk7CisgICAgICAgICR0aGlzLT5yZWFkSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRMaXN0QmVnaW4oJiRlbGVtVHlwZSwgJiRzaXplKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnJlYWRKU09OQXJyYXlTdGFydCgpOworICAgICAgICAkZWxlbVR5cGUgPSAkdGhpcy0+Z2V0VHlwZUlERm9yVHlwZU5hbWUoJHRoaXMtPnJlYWRKU09OU3RyaW5nKGZhbHNlKSk7CisgICAgICAgICRzaXplID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlcigpOworCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTGlzdEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+cmVhZEpTT05BcnJheUVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU2V0QmVnaW4oJiRlbGVtVHlwZSwgJiRzaXplKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnJlYWRKU09OQXJyYXlTdGFydCgpOworICAgICAgICAkZWxlbVR5cGUgPSAkdGhpcy0+Z2V0VHlwZUlERm9yVHlwZU5hbWUoJHRoaXMtPnJlYWRKU09OU3RyaW5nKGZhbHNlKSk7CisgICAgICAgICRzaXplID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlcigpOworCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkU2V0RW5kKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5yZWFkSlNPTkFycmF5RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRCb29sKCYkYm9vbCkKKyAgICB7CisgICAgICAgICRib29sID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlcigpID09IDAgPyBmYWxzZSA6IHRydWU7CisKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRCeXRlKCYkYnl0ZSkKKyAgICB7CisgICAgICAgICRieXRlID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlcigpOworCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTE2KCYkaTE2KQorICAgIHsKKyAgICAgICAgJGkxNiA9ICR0aGlzLT5yZWFkSlNPTkludGVnZXIoKTsKKworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEkzMigmJGkzMikKKyAgICB7CisgICAgICAgICRpMzIgPSAkdGhpcy0+cmVhZEpTT05JbnRlZ2VyKCk7CisKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJNjQoJiRpNjQpCisgICAgeworICAgICAgICBpZiAoUEhQX0lOVF9TSVpFID09PSA0KSB7CisgICAgICAgICAgICAkaTY0ID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlckFzU3RyaW5nKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkaTY0ID0gJHRoaXMtPnJlYWRKU09OSW50ZWdlcig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RydWN0LgorICAgICAqCisgICAgICogQHRocm93cyBURXhjZXB0aW9uIG9uIHdyaXRlIGVycm9yCisgICAgICogQHJldHVybiBpbnQgSG93IG1hbnkgYnl0ZXMgd3JpdHRlbgorICAgICAqLworICAgIGFic3RyYWN0IHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cnVjdEVuZCgpOworCisgICAgLyoKKyAgICAgKiBTdGFydHMgYSBmaWVsZC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgICAgICRuYW1lIEZpZWxkIG5hbWUKKyAgICAgKiBAcGFyYW0gaW50ICAgICAgICAkdHlwZSBGaWVsZCB0eXBlCisgICAgICogQHBhcmFtIGludCAgICAgICAgJGZpZCAgRmllbGQgaWQKKyAgICAgKiBAdGhyb3dzIFRFeGNlcHRpb24gb24gd3JpdGUgZXJyb3IKKyAgICAgKiBAcmV0dXJuIGludCBIb3cgbWFueSBieXRlcyB3cml0dGVuCisgICAgICovCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRCZWdpbigkZmllbGROYW1lLCAkZmllbGRUeXBlLCAkZmllbGRJZCk7CisKKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gd3JpdGVGaWVsZEVuZCgpOworCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRTdG9wKCk7CisKKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gd3JpdGVNYXBCZWdpbigka2V5VHlwZSwgJHZhbFR5cGUsICRzaXplKTsKKworICAgIGFic3RyYWN0IHB1YmxpYyBmdW5jdGlvbiB3cml0ZU1hcEVuZCgpOworCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpOworCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEVuZCgpOworCisgICAgYWJzdHJ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EkzMigmJGkzMik7CisKKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gcmVhZEk2NCgmJGk2NCk7CisKKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gcmVhZERvdWJsZSgmJGR1Yik7CisKKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gcmVhZFN0cmluZygmJHN0cik7CisKKyAgICAvKioKKyAgICAgKiBUaGUgc2tpcCBmdW5jdGlvbiBpcyBhIHV0aWxpdHkgdG8gcGFyc2Ugb3ZlciB1bnJlY29nbml6ZWQgZGF0ZSB3aXRob3V0CisgICAgICogY2F1c2luZyBjb3JydXB0aW9uLgorICAgICAqCisgICAgICogQHBhcmFtIFRUeXBlICR0eXBlIFdoYXQgdHlwZSBpcyBpdAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBza2lwKCR0eXBlKQorICAgIHsKKyAgICAgICAgc3dpdGNoICgkdHlwZSkgeworICAgICAgICAgICAgY2FzZSBUVHlwZTo6Qk9PTDoKKyAgICAgICAgICAgICAgICByZXR1cm4gJHRoaXMtPnJlYWRCb29sKCRib29sKTsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OkJZVEU6CisgICAgICAgICAgICAgICAgcmV0dXJuICR0aGlzLT5yZWFkQnl0ZSgkYnl0ZSk7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpJMTY6CisgICAgICAgICAgICAgICAgcmV0dXJuICR0aGlzLT5yZWFkSTE2KCRpMTYpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6STMyOgorICAgICAgICAgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZEkzMigkaTMyKTsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6Okk2NDoKKyAgICAgICAgICAgICAgICByZXR1cm4gJHRoaXMtPnJlYWRJNjQoJGk2NCk7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpET1VCTEU6CisgICAgICAgICAgICAgICAgcmV0dXJuICR0aGlzLT5yZWFkRG91YmxlKCRkdWIpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiAkdGhpcy0+cmVhZFN0cmluZygkc3RyKTsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNUUlVDVDoKKyAgICAgICAgICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPnJlYWRTdHJ1Y3RCZWdpbigkbmFtZSk7CisgICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCArPSAkdGhpcy0+cmVhZEZpZWxkQmVnaW4oJG5hbWUsICRmdHlwZSwgJGZpZCk7CisgICAgICAgICAgICAgICAgICAgIGlmICgkZnR5cGUgPT0gVFR5cGU6OlNUT1ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gJHRoaXMtPnNraXAoJGZ0eXBlKTsKKyAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCArPSAkdGhpcy0+cmVhZEZpZWxkRW5kKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gJHRoaXMtPnJlYWRTdHJ1Y3RFbmQoKTsKKworICAgICAgICAgICAgICAgIHJldHVybiAkcmVzdWx0OworCisgICAgICAgICAgICBjYXNlIFRUeXBlOjpNQVA6CisgICAgICAgICAgICAgICAgJHJlc3VsdCA9ICR0aGlzLT5yZWFkTWFwQmVnaW4oJGtleVR5cGUsICR2YWxUeXBlLCAkc2l6ZSk7CisgICAgICAgICAgICAgICAgZm9yICgkaSA9IDA7ICRpIDwgJHNpemU7ICRpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCArPSAkdGhpcy0+c2tpcCgka2V5VHlwZSk7CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gJHRoaXMtPnNraXAoJHZhbFR5cGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAkcmVzdWx0ICs9ICR0aGlzLT5yZWFkTWFwRW5kKCk7CisKKyAgICAgICAgICAgICAgICByZXR1cm4gJHJlc3VsdDsKKworICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgICAgICRyZXN1bHQgPSAkdGhpcy0+cmVhZFNldEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpOworICAgICAgICAgICAgICAgIGZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyAkaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gJHRoaXMtPnNraXAoJGVsZW1UeXBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgJHJlc3VsdCArPSAkdGhpcy0+cmVhZFNldEVuZCgpOworCisgICAgICAgICAgICAgICAgcmV0dXJuICRyZXN1bHQ7CisKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKKyAgICAgICAgICAgICAgICAkcmVzdWx0ID0gJHRoaXMtPnJlYWRMaXN0QmVnaW4oJGVsZW1UeXBlLCAkc2l6ZSk7CisgICAgICAgICAgICAgICAgZm9yICgkaSA9IDA7ICRpIDwgJHNpemU7ICRpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCArPSAkdGhpcy0+c2tpcCgkZWxlbVR5cGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAkcmVzdWx0ICs9ICR0aGlzLT5yZWFkTGlzdEVuZCgpOworCisgICAgICAgICAgICAgICAgcmV0dXJuICRyZXN1bHQ7CisKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgJ1Vua25vd24gZmllbGQgdHlwZTogJyAuICR0eXBlLAorICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xFeGNlcHRpb246OklOVkFMSURfREFUQQorICAgICAgICAgICAgICAgICk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVdGlsaXR5IGZvciBza2lwcGluZyBiaW5hcnkgZGF0YQorICAgICAqCisgICAgICogQHBhcmFtIFRUcmFuc3BvcnQgJGl0cmFucyBUVHJhbnNwb3J0IG9iamVjdAorICAgICAqIEBwYXJhbSBpbnQgJHR5cGUgRmllbGQgdHlwZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gc2tpcEJpbmFyeSgkaXRyYW5zLCAkdHlwZSkKKyAgICB7CisgICAgICAgIHN3aXRjaCAoJHR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgVFR5cGU6OkJPT0w6CisgICAgICAgICAgICAgICAgcmV0dXJuICRpdHJhbnMtPnJlYWRBbGwoMSk7CisgICAgICAgICAgICBjYXNlIFRUeXBlOjpCWVRFOgorICAgICAgICAgICAgICAgIHJldHVybiAkaXRyYW5zLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6STE2OgorICAgICAgICAgICAgICAgIHJldHVybiAkaXRyYW5zLT5yZWFkQWxsKDIpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6STMyOgorICAgICAgICAgICAgICAgIHJldHVybiAkaXRyYW5zLT5yZWFkQWxsKDQpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6STY0OgorICAgICAgICAgICAgICAgIHJldHVybiAkaXRyYW5zLT5yZWFkQWxsKDgpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6RE9VQkxFOgorICAgICAgICAgICAgICAgIHJldHVybiAkaXRyYW5zLT5yZWFkQWxsKDgpOworICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSSU5HOgorICAgICAgICAgICAgICAgICRsZW4gPSB1bnBhY2soJ04nLCAkaXRyYW5zLT5yZWFkQWxsKDQpKTsKKyAgICAgICAgICAgICAgICAkbGVuID0gJGxlblsxXTsKKyAgICAgICAgICAgICAgICBpZiAoJGxlbiA+IDB4N2ZmZmZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgJGxlbiA9IDAgLSAoKCRsZW4gLSAxKSBeIDB4ZmZmZmZmZmYpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiA0ICsgJGl0cmFucy0+cmVhZEFsbCgkbGVuKTsKKworICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgorICAgICAgICAgICAgICAgICRyZXN1bHQgPSAwOworICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgICRmdHlwZSA9IDA7CisgICAgICAgICAgICAgICAgICAgICRmaWQgPSAwOworICAgICAgICAgICAgICAgICAgICAkZGF0YSA9ICRpdHJhbnMtPnJlYWRBbGwoMSk7CisgICAgICAgICAgICAgICAgICAgICRhcnIgPSB1bnBhY2soJ2MnLCAkZGF0YSk7CisgICAgICAgICAgICAgICAgICAgICRmdHlwZSA9ICRhcnJbMV07CisgICAgICAgICAgICAgICAgICAgIGlmICgkZnR5cGUgPT0gVFR5cGU6OlNUT1ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIEkxNiBmaWVsZCBpZAorICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ICs9ICRpdHJhbnMtPnJlYWRBbGwoMik7CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gc2VsZjo6c2tpcEJpbmFyeSgkaXRyYW5zLCAkZnR5cGUpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiAkcmVzdWx0OworCisgICAgICAgICAgICBjYXNlIFRUeXBlOjpNQVA6CisgICAgICAgICAgICAgICAgLy8gS3R5cGUKKyAgICAgICAgICAgICAgICAkZGF0YSA9ICRpdHJhbnMtPnJlYWRBbGwoMSk7CisgICAgICAgICAgICAgICAgJGFyciA9IHVucGFjaygnYycsICRkYXRhKTsKKyAgICAgICAgICAgICAgICAka3R5cGUgPSAkYXJyWzFdOworICAgICAgICAgICAgICAgIC8vIFZ0eXBlCisgICAgICAgICAgICAgICAgJGRhdGEgPSAkaXRyYW5zLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgICAgICRhcnIgPSB1bnBhY2soJ2MnLCAkZGF0YSk7CisgICAgICAgICAgICAgICAgJHZ0eXBlID0gJGFyclsxXTsKKyAgICAgICAgICAgICAgICAvLyBTaXplCisgICAgICAgICAgICAgICAgJGRhdGEgPSAkaXRyYW5zLT5yZWFkQWxsKDQpOworICAgICAgICAgICAgICAgICRhcnIgPSB1bnBhY2soJ04nLCAkZGF0YSk7CisgICAgICAgICAgICAgICAgJHNpemUgPSAkYXJyWzFdOworICAgICAgICAgICAgICAgIGlmICgkc2l6ZSA+IDB4N2ZmZmZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgJHNpemUgPSAwIC0gKCgkc2l6ZSAtIDEpIF4gMHhmZmZmZmZmZik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICRyZXN1bHQgPSA2OworICAgICAgICAgICAgICAgIGZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyAkaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gc2VsZjo6c2tpcEJpbmFyeSgkaXRyYW5zLCAka3R5cGUpOworICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ICs9IHNlbGY6OnNraXBCaW5hcnkoJGl0cmFucywgJHZ0eXBlKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXR1cm4gJHJlc3VsdDsKKworICAgICAgICAgICAgY2FzZSBUVHlwZTo6U0VUOgorICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgorICAgICAgICAgICAgICAgIC8vIFZ0eXBlCisgICAgICAgICAgICAgICAgJGRhdGEgPSAkaXRyYW5zLT5yZWFkQWxsKDEpOworICAgICAgICAgICAgICAgICRhcnIgPSB1bnBhY2soJ2MnLCAkZGF0YSk7CisgICAgICAgICAgICAgICAgJHZ0eXBlID0gJGFyclsxXTsKKyAgICAgICAgICAgICAgICAvLyBTaXplCisgICAgICAgICAgICAgICAgJGRhdGEgPSAkaXRyYW5zLT5yZWFkQWxsKDQpOworICAgICAgICAgICAgICAgICRhcnIgPSB1bnBhY2soJ04nLCAkZGF0YSk7CisgICAgICAgICAgICAgICAgJHNpemUgPSAkYXJyWzFdOworICAgICAgICAgICAgICAgIGlmICgkc2l6ZSA+IDB4N2ZmZmZmZmYpIHsKKyAgICAgICAgICAgICAgICAgICAgJHNpemUgPSAwIC0gKCgkc2l6ZSAtIDEpIF4gMHhmZmZmZmZmZik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICRyZXN1bHQgPSA1OworICAgICAgICAgICAgICAgIGZvciAoJGkgPSAwOyAkaSA8ICRzaXplOyAkaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgKz0gc2VsZjo6c2tpcEJpbmFyeSgkaXRyYW5zLCAkdnR5cGUpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiAkcmVzdWx0OworCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICdVbmtub3duIGZpZWxkIHR5cGU6ICcgLiAkdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEKKyAgICAgICAgICAgICAgICApOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL3BocC9saWIvUHJvdG9jb2wvVFByb3RvY29sRGVjb3JhdG9yLnBocCBiL2xpYi9waHAvbGliL1Byb3RvY29sL1RQcm90b2N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GlzLT5jb25jcmV0ZVByb3RvY29sXy0+d3JpdGVGaWVsZEJlZ2luKCRmaWVsZE5hbWUsICRmaWVsZFR5cGUsICRmaWVsZElkKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVGaWVsZEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZUZpZWxkRW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRmllbGRTdG9wKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPndyaXRlRmllbGRTdG9wKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwQmVnaW4oJGtleVR5cGUsICR2YWxUeXBlLCAkc2l6ZSkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPndyaXRlTWFwQmVnaW4oJGtleVR5cGUsICR2YWxUeXBlLCAkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTWFwRW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPndyaXRlTWFwRW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZUxpc3RCZWdpbigkZWxlbVR5cGUsICRzaXplKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVMaXN0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPndyaXRlTGlzdEVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZVNldEJlZ2luKCRlbGVtVHlwZSwgJHNpemUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVNldEVuZCgpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZVNldEVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJvb2woJGJvb2wpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZUJvb2woJGJvb2wpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJ5dGUoJGJ5dGUpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZUJ5dGUoJGJ5dGUpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUkxNigkaTE2KQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT5jb25jcmV0ZVByb3RvY29sXy0+d3JpdGVJMTYoJGkxNik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTMyKCRpMzIpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT53cml0ZUkzMigkaTMyKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJNjQoJGk2NCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPndyaXRlSTY0KCRpNjQpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZURvdWJsZSgkZHViKQorICAgIHsKKyAgICAg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Sk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRMaXN0RW5kKCkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPnJlYWRMaXN0RW5kKCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTZXRCZWdpbigmJGVsZW1UeXBlLCAmJHNpemUpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT5yZWFkU2V0QmVnaW4oJGVsZW1UeXBlLCAkc2l6ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTZXRFbmQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT5jb25jcmV0ZVByb3RvY29sXy0+cmVhZFNldEVuZCgpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkQm9vbCgmJGJvb2wpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT5yZWFkQm9vbCgkYm9vbCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRCeXRlKCYkYnl0ZSkKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPnJlYWRCeXRlKCRieXRlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZEkxNigmJGkxNikKKyAgICB7CisgICAgICAgIHJldHVybiAkdGhpcy0+Y29uY3JldGVQcm90b2NvbF8tPnJlYWRJMTYoJGkxNik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRJMzIoJiRpMzIpCisgICAgeworICAgICAgICByZXR1cm4gJHRoaXMtPmNvbmNyZXRlUHJvdG9jb2xfLT5yZWFkSTMyKCRpMzIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkSTY0KCYkaTY0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h0OwordXNlIFRocmlmdFxQcm90b2NvbFxTaW1wbGVKU09OXE1hcENvbnRleHQ7Cit1c2UgVGhyaWZ0XFByb3RvY29sXFNpbXBsZUpTT05cQ29sbGVjdGlvbk1hcEtleUV4Y2VwdGlvbjsKKworLyoqCisgKiBTaW1wbGVKU09OIGltcGxlbWVudGF0aW9uIG9mIHRocmlmdCBwcm90b2NvbCwgcG9ydGVkIGZyb20gSmF2YS4KKyAqLworY2xhc3MgVFNpbXBsZUpTT05Qcm90b2NvbCBleHRlbmRzIFRQcm90b2NvbAoreworICAgIGNvbnN0IENPTU1BID0gJywnOworICAgIGNvbnN0IENPTE9OID0gJzonOworICAgIGNvbnN0IExCUkFDRSA9ICd7JzsKKyAgICBjb25zdCBSQlJBQ0UgPSAnfSc7CisgICAgY29uc3QgTEJSQUNLRVQgPSAnWyc7CisgICAgY29uc3QgUkJSQUNLRVQgPSAnXSc7CisgICAgY29uc3QgUVVPVEUgPSAnIic7CisKKyAgICBjb25zdCBOQU1FX01BUCA9ICJtYXAiOworICAgIGNvbnN0IE5BTUVfTElTVCA9ICJsc3QiOworICAgIGNvbnN0IE5BTUVfU0VUID0gInNldCI7CisKKyAgICBwcm90ZWN0ZWQgJHdyaXRlQ29udGV4dF8gPSBudWxsOworICAgIHByb3RlY3RlZCAkd3JpdGVDb250ZXh0U3RhY2tfID0gW107CisKKyAgICAvKioKKyAgICAgKiBQdXNoIGEgbmV3IHdyaXRlIGNvbnRleHQgb250byB0aGUgc3RhY2suCisgICAgICovCisgICAgcHJvdGVjdGVkIGZ1bmN0aW9uIHB1c2hXcml0ZUNvbnRleHQoQ29udGV4dCAkYykKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRTdGFja19bXSA9ICR0aGlzLT53cml0ZUNvbnRleHRfOworICAgICAgICAkdGhpcy0+d3JpdGVDb250ZXh0XyA9ICRjOworICAgIH0KKworICAgIC8qKgorICAgICAqIFBvcCB0aGUgbGFzdCB3cml0ZSBjb250ZXh0IG9mZiB0aGUgc3RhY2sKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgZnVuY3Rpb24gcG9wV3JpdGVDb250ZXh0KCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRfID0gYXJyYXlfcG9wKCR0aGlzLT53cml0ZUNvbnRleHRTdGFja18pOworICAgIH0KKworICAgIC8qKgorICAgICAqIFVzZWQgdG8gbWFrZSBzdXJlIHRoYXQgd2UgYXJlIG5vdCBlbmNvdW50ZXJpbmcgYSBtYXAgd2hvc2Uga2V5cyBhcmUgY29udGFpbmVycworICAgICAqLworICAgIHByb3RlY3RlZCBmdW5jdGlvbiBhc3NlcnRDb250ZXh0SXNOb3RNYXBLZXkoJGludmFsaWRLZXlUeXBlKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT53cml0ZUNvbnRleHRfLT5pc01hcEtleSgpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgQ29sbGVjdGlvbk1hcEtleUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAiQ2Fubm90IHNlcmlhbGl6ZSBhIG1hcCB3aXRoIGtleXMgdGhhdCBhcmUgb2YgdHlwZSAiIC4KKyAgICAgICAgICAgICAgICAkaW52YWxpZEtleVR5cGUKKyAgICAgICAgICAgICk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHdyaXRlSlNPTlN0cmluZygkYikKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRfLT53cml0ZSgpOworCisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKGpzb25fZW5jb2RlKChzdHJpbmcpJGIpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIHdyaXRlSlNPTkludGVnZXIoJG51bSkKKyAgICB7CisgICAgICAgICRpc01hcEtleSA9ICR0aGlzLT53cml0ZUNvbnRleHRfLT5pc01hcEtleSgpOworCisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRfLT53cml0ZSgpOworCisgICAgICAgIGlmICgkaXNNYXBLZXkpIHsKKyAgICAgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgfQorCisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKChpbnQpJG51bSk7CisKKyAgICAgICAgaWYgKCRpc01hcEtleSkgeworICAgICAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBmdW5jdGlvbiB3cml0ZUpTT05Eb3VibGUoJG51bSkKKyAgICB7CisgICAgICAgICRpc01hcEtleSA9ICR0aGlzLT53cml0ZUNvbnRleHRfLT5pc01hcEtleSgpOworCisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRfLT53cml0ZSgpOworCisgICAgICAgIGlmICgkaXNNYXBLZXkpIHsKKyAgICAgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlFVT1RFKTsKKyAgICAgICAgfQorCisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKGpzb25fZW5jb2RlKChmbG9hdCkkbnVtKSk7CisKKyAgICAgICAgaWYgKCRpc01hcEtleSkgeworICAgICAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6UVVPVEUpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29uc3RydWN0b3IKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoJHRyYW5zKQorICAgIHsKKyAgICAgICAgcGFyZW50OjpfX2NvbnN0cnVjdCgkdHJhbnMpOworICAgICAgICAkdGhpcy0+d3JpdGVDb250ZXh0XyA9IG5ldyBDb250ZXh0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogV3JpdGVzIHRoZSBtZXNzYWdlIGhlYWRlcgorICAgICAqCisgICAgICogQHBhcm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yAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVNYXBFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnBvcFdyaXRlQ29udGV4dCgpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpSQlJBQ0UpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUxpc3RCZWdpbigkZWxlbVR5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmFzc2VydENvbnRleHRJc05vdE1hcEtleShzZWxmOjpOQU1FX0xJU1QpOworICAgICAgICAkdGhpcy0+d3JpdGVDb250ZXh0Xy0+d3JpdGUoKTsKKyAgICAgICAgJHRoaXMtPnRyYW5zXy0+d3JpdGUoc2VsZjo6TEJSQUNLRVQpOworICAgICAgICAkdGhpcy0+cHVzaFdyaXRlQ29udGV4dChuZXcgTGlzdENvbnRleHQoJHRoaXMpKTsKKyAgICAgICAgLy8gTm8gbWV0YWRhdGEhCisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlTGlzdEVuZCgpCisgICAgeworICAgICAgICAkdGhpcy0+cG9wV3JpdGVDb250ZXh0KCk7CisgICAgICAgICR0aGlzLT50cmFuc18tPndyaXRlKHNlbGY6OlJCUkFDS0VUKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVTZXRCZWdpbigkZWxlbVR5cGUsICRzaXplKQorICAgIHsKKyAgICAgICAgJHRoaXMtPmFzc2VydENvbnRleHRJc05vdE1hcEtleShzZWxmOjpOQU1FX1NFVCk7CisgICAgICAgICR0aGlzLT53cml0ZUNvbnRleHRfLT53cml0ZSgpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpMQlJBQ0tFVCk7CisgICAgICAgICR0aGlzLT5wdXNoV3JpdGVDb250ZXh0KG5ldyBMaXN0Q29udGV4dCgkdGhpcykpOworICAgICAgICAvLyBObyBtZXRhZGF0YSEKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVTZXRFbmQoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnBvcFdyaXRlQ29udGV4dCgpOworICAgICAgICAkdGhpcy0+dHJhbnNfLT53cml0ZShzZWxmOjpSQlJBQ0tFVCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlQm9vbCgkYm9vbCkKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKCRib29sID8gMSA6IDApOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUJ5dGUoJGJ5dGUpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkYnl0ZSk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlSTE2KCRpMTYpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09OSW50ZWdlcigkaTE2KTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGVJMzIoJGkzMikKKyAgICB7CisgICAgICAgICR0aGlzLT53cml0ZUpTT05JbnRlZ2VyKCRpMzIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZUk2NCgkaTY0KQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTkludGVnZXIoJGk2NCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlRG91YmxlKCRkdWIpCisgICAgeworICAgICAgICAkdGhpcy0+d3JpdGVKU09ORG91YmxlKCRkdWIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB3cml0ZVN0cmluZygkc3RyKQorICAgIHsKKyAgICAgICAgJHRoaXMtPndyaXRlSlNPTlN0cmluZygkc3RyKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkaW5nIG1ldGhvZHMuCisgICAgICoKKyAgICAgKiBzaW1wbGVqc29uIGlzIG5vdCBtZWFudCB0byBiZSByZWFkIGJhY2sgaW50byB0aHJpZnQKKyAgICAgKiAtIHNlZSBodHRwOi8vd2lraS5hcGFjaGUub3JnL3RocmlmdC9UaHJpZnRVc2FnZUphdmEKKyAgICAgKiAtIHVzZSBKU09OIGluc3RlYWQKKyAgICAgKi8KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTWVzc2FnZUJlZ2luKCYkbmFtZSwgJiR0eXBlLCAmJHNlcWlkKQorICAgIHsKKyAgICAgICAgdGhyb3cgbmV3IFRFeGNlcHRpb24oIk5vdCBpbXBsZW1lbnRlZCIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkTWVzc2FnZUVuZCgpCisgICAgeworICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigiTm90IGltcGxlbWVudGVkIik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJ1Y3RCZWdpbigmJG5hbWUpCisgICAgeworICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigiTm90IGltcGxlbWVudGVkIik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRTdHJ1Y3RFbmQoKQorICAgIHsKKyAgICAgICAgdGhyb3cgbmV3IFRFeGNlcHRpb24oIk5vdCBpbXBsZW1lbnRlZCIpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkRmllbGRCZWdpbigmJG5hbWUsICYkZmllbGRUeXBlLCAmJGZpZWxkSWQpCisgICAgeworICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigiTm90IGltcGxlbWVudGVkIik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWRGaWVsZEVuZCgpCisgICAgeworICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigiTm90IGltcGxlbWVudGVkIik7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYW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AgICAgICAgICAgdGhyaWZ0X3Byb3RvY29sX3dyaXRlX2JpbmFyeSgKKyAgICAgICAgICAgICAgICAkcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgJG9iamVjdC0+Z2V0TmFtZSgpLAorICAgICAgICAgICAgICAgIFRNZXNzYWdlVHlwZTo6UkVQTFksCisgICAgICAgICAgICAgICAgJG9iamVjdCwKKyAgICAgICAgICAgICAgICAwLAorICAgICAgICAgICAgICAgICRwcm90b2NvbC0+aXNTdHJpY3RXcml0ZSgpCisgICAgICAgICAgICApOworCisgICAgICAgICAgICAkcHJvdG9jb2wtPnJlYWRNZXNzYWdlQmVnaW4oJHVudXNlZF9uYW1lLCAkdW51c2VkX3R5cGUsICR1bnVzZWRfc2VxaWQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgJG9iamVjdC0+d3JpdGUoJHByb3RvY29sKTsKKyAgICAgICAgfQorICAgICAgICAkcHJvdG9jb2wtPmdldFRyYW5zcG9ydCgpLT5mbHVzaCgpOworCisgICAgICAgIHJldHVybiAkdHJhbnNwb3J0LT5nZXRCdWZmZXIoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGRlc2VyaWFsaXplKCRzdHJpbmdfb2JqZWN0LCAkY2xhc3NfbmFtZSwgJGJ1ZmZlcl9zaXplID0gODE5MikKKyAgICB7CisgICAgICAgICR0cmFuc3BvcnQgPSBuZXcgVE1lbW9yeUJ1ZmZlcigpOworICAgICAgICAkcHJvdG9jb2wgPSBuZXcgVEJpbmFyeVByb3RvY29sQWNjZWxlcmF0ZWQoJHRyYW5zcG9ydCk7CisgICAgICAgIGlmIChmdW5jdGlvbl9leGlzdHMoJ3RocmlmdF9wcm90b2NvbF9yZWFkX2JpbmFyeScpKSB7CisgICAgICAgICAgICAvLyBOT1RFICh0LmhlaW50eikgVEJpbmFyeVByb3RvY29sQWNjZWxlcmF0ZWQgaW50ZXJuYWxseSB3cmFwcyBvdXIgVE1lbW9y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bmN0aW9uIHNlcnZlKCkKKyAgICB7CisgICAgICAgICR0aGlzLT50cmFuc3BvcnRfLT5saXN0ZW4oKTsKKworICAgICAgICB3aGlsZSAoISR0aGlzLT5zdG9wXykgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAkdHJhbnNwb3J0ID0gJHRoaXMtPnRyYW5zcG9ydF8tPmFjY2VwdCgpOworCisgICAgICAgICAgICAgICAgaWYgKCR0cmFuc3BvcnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAkcGlkID0gcGNudGxfZm9yaygpOworCisgICAgICAgICAgICAgICAgICAgIGlmICgkcGlkID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmhhbmRsZVBhcmVudCgkdHJhbnNwb3J0LCAkcGlkKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlaWYgKCRwaWQgPT09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICR0aGlzLT5oYW5kbGVDaGlsZCgkdHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBURXhjZXB0aW9uKCdGYWlsZWQgdG8gZm9yaycpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiAkZSkgeworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAkdGhpcy0+Y29sbGVjdENoaWxkcmVuKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb2RlIHJ1biBieSB0aGUgcGFyZW50CisgICAgICoKKyAgICAgKiBAcGFyYW0gVFRyYW5zcG9ydCAkdHJhbnNwb3J0CisgICAgICogQHBhcmFtIGludCAkcGlkCisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBoY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ICRlKSB7CisgICAgICAgIH0KKworICAgICAgICBleGl0KDApOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbGxlY3RzIGFueSBjaGlsZHJlbiB3ZSBtYXkgaGF2ZQorICAgICAqCisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBjb2xsZWN0Q2hpbGRyZW4oKQorICAgIHsKKyAgICAgICAgZm9yZWFjaCAoJHRoaXMtPmNoaWxkcmVuXyBhcyAkcGlkID0+ICR0cmFuc3BvcnQpIHsKKyAgICAgICAgICAgIGlmIChwY250bF93YWl0cGlkKCRwaWQsICRzdGF0dXMsIFdOT0hBTkcpID4gMCkgeworICAgICAgICAgICAgICAgIHVuc2V0KCR0aGlzLT5jaGlsZHJlbl9bJHBpZF0pOworICAgICAgICAgICAgICAgIGlmICgkdHJhbnNwb3J0KSB7CisgICAgICAgICAgICAgICAgICAgIEAkdHJhbnNwb3J0LT5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFN0b3BzIHRoZSBzZXJ2ZXIgcnVubmluZy4gS2lsbHMgdGhlIHRyYW5zcG9ydAorICAgICAqIGFuZCB0aGVuIHN0b3BzIHRoZSBtYWluIHNlcnZpbmcgbG9vcAorICAgICAqCisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHN0b3AoKQorICAgIHsKKyAgICAgICAgJHRoaXMtPnRyYW5zcG9ydF8tPmNsb3NlKCk7CisgICAgICAgICR0aGlzLT5zdG9wXyA9IHRydWU7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvbGliL3BocC9saWIvU2VydmVyL1RTU0xTZXJ2ZXJTb2NrZXQucGhwIGIvbGliL3BocC9saWIvU2VydmVyL1RTU0xTZXJ2ZXJTb2NrZXQucGhwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZG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k7CisgICAgICAgICR0aGlzLT5jb250ZXh0XyA9ICRjb250ZXh0OworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBnZXRTU0xIb3N0KCRob3N0KQorICAgIHsKKyAgICAgICAgJHRyYW5zcG9ydF9wcm90b2NvbF9sb2MgPSBzdHJwb3MoJGhvc3QsICI6Ly8iKTsKKyAgICAgICAgaWYgKCR0cmFuc3BvcnRfcHJvdG9jb2xfbG9jID09PSBmYWxzZSkgeworICAgICAgICAgICAgJGhvc3QgPSAnc3NsOi8vJyAuICRob3N0OworICAgICAgICB9CisgICAgICAgIHJldHVybiAkaG9zdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBPcGVucyBhIG5ldyBzb2NrZXQgc2VydmVyIGhhbmRsZQorICAgICAqCisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGxpc3RlbigpCisgICAgeworICAgICAgICAkdGhpcy0+bGlzdGVuZXJfID0gQHN0cmVhbV9zb2NrZXRfc2VydmVyKAorICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfLAorICAgICAgICAgICAgJGVycm5vLAorICAgICAgICAgICAgJGVycnN0ciwKKyAgICAgICAgICAgIFNUUkVBTV9TRVJWRVJfQklORCB8IFNUUkVBTV9TRVJWRVJfTElTVEVOLAorICAgICAgICAgICAgJHRoaXMtPmNvbnRleHRfCisgICAgICAgICk7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW1wbGVtZW50YXRpb24gb2YgYWNjZXB0LiBJZiBub3QgY2xpZW50IGlzIGFjY2VwdGVkIGluIHRoZSBnaXZlbiB0aW1lCisgICAgICoKKyAgICAgKiBAcmV0dXJuIFRTb2NrZXQKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgZnVuY3Rpb24gYWNjZXB0SW1wbCgpCisgICAgeworICAgICAgICAkaGFuZGxlID0gQHN0cmVhbV9zb2NrZXRfYWNjZXB0KCR0aGlzLT5saXN0ZW5lcl8sICR0aGlzLT5hY2NlcHRUaW1lb3V0XyAvIDEwMDAuMCk7CisgICAgICAgIGlmICghJGhhbmRsZSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICAkc29ja2V0ID0gbmV3IFRTU0xTb2NrZXQoKTsKKyAgICAgICAgJHNvY2tldC0+c2V0SGFuZGxlKCRoYW5kbGUpOworCisgICAgICAgIHJldHVybiAkc29ja2V0OworICAgIH0KK30KZGlmZiAtLWdpdCBhL2xpYi9waHAvbGliL1NlcnZlci9UU2VydmVyLnBocCBiL2xpYi9waHAvbGliL1NlcnZlci9UU2VydmVyLnBocApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4yNjhjMzc4Ci0tLSAvZGV2L251bGwKKysrIGIvbGliL3BocC9saWIvU2VydmVyL1RTZXJ2ZXIucGhwCkBAIC0wLDAgKzEsMTAyIEBACis8P3BocAorCituYW1lc3BhY2UgVGhyaWZ0XFNlcnZlcjsKKwordXNlIFRocmlmdFxGYWN0b3J5XFRUcmFuc3BvcnRGYWN0b3J5OwordXNlIFRocmlmdFxGYWN0b3J5XFRQcm90b2NvbEZhY3Rvcnk7CisKKy8qKgorICogR2VuZXJpYyBjbGFzcyBmb3IgYSBUaHJpZnQgc2VydmVyLgorICoKKyAqIEBwYWNrYWdlIHRocmlmdC5zZXJ2ZXIKKyAqLworYWJzdHJhY3QgY2xhc3MgVFNlcnZlcgoreworICAgIC8qKgorICAgICAqIFByb2Nlc3NvciB0byBoYW5kbGUgbmV3IGNsaWVudHMKKyAgICAgKgorICAgICAqIEB2YXIgVFByb2Nlc3NvcgorICAgICAqLworICAgIHByb3RlY3RlZCAkcHJvY2Vzc29yXzsKKworICAgIC8qKgorICAgICAqIFNlcnZlciB0cmFuc3BvcnQgdG8gYmUgdXNlZCBmb3IgbGlzdGVuaW5nCisgICAgICogYW5kIGFjY2VwdGluZyBuZXcgY2xpZW50cworICAgICAqCisgICAgICogQHZhciBUU2VydmVyVHJhbnNwb3J0CisgICAgICovCisgICAgcHJvdGVjdGVkICR0cmFuc3BvcnRfOworCisgICAgLyoqCisgICAgICogSW5wdXQgdHJhbnNwb3J0IGZhY3RvcnkKKyAgICAgKgorICAgICAqIEB2YXIgVFRyYW5zcG9ydEZhY3RvcnkKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJGlucHV0VHJhbnNwb3J0RmFjdG9yeV87CisKKyAgICAvKioKKyAgICAgKiBPdXRwdXQgdHJhbnNwb3J0IGZhY3RvcnkKKyAgICAgKgorICAgICAqIEB2YXIgVFRyYW5zcG9ydEZhY3RvcnkKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJG91dHB1dFRyYW5zcG9ydEZhY3RvcnlfOworCisgICAgLyoqCisgICAgICogSW5wdXQgcHJvdG9jb2wgZmFjdG9yeQorICAgICAqCisgICAgICogQHZhciBUUHJvdG9jb2xGYWN0b3J5CisgICAgICovCisgICAgcHJvdGVjdGVkICRpbnB1dFByb3RvY29sRmFjdG9yeV87CisKKyAgICAvKioKKyAgICAgKiBPdXRwdXQgcHJvdG9jb2wgZmFjdG9yeQorICAgICAqCisgICAgICogQHZhciBUUHJvdG9jb2xGYWN0b3J5CisgICAgICovCisgICAgcHJvdGVjdGVkICRvdXRwdXRQcm90b2NvbEZhY3RvcnlfOworCisgICAgLyoqCisgICAgICogU2V0cyB1cCBhbGwgdGhlIGZhY3RvcmllcywgZXRjCisgICAgICoKKyAgICAgKiBAcGFyYW0gb2JqZWN0ICRwcm9jZXNzb3IKKyAgICAgKiBAcGFyYW0gVFNlcnZlclRyYW5zcG9ydCAkdHJhbnNwb3J0CisgICAgICogQHBhcmFtIFRUcmFuc3BvcnRGYWN0b3J5ICRpbnB1dFRyYW5zcG9ydEZhY3RvcnkKKyAgICAgKiBAcGFyYW0gVFRyYW5zcG9ydEZhY3RvcnkgJG91dHB1dFRyYW5zcG9ydEZhY3RvcnkKKy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Gxpc3RlbmVyIHNvY2tldAorICAgICAqCisgICAgICogQHZhciByZXNvdXJjZQorICAgICAqLworICAgIHByb3RlY3RlZCAkbGlzdGVuZXJfOworCisgICAgLyoqCisgICAgICogUG9ydCBmb3IgdGhlIGxpc3RlbmVyIHRvIGxpc3RlbiBvbgorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJHBvcnRfOworCisgICAgLyoqCisgICAgICogVGltZW91dCB3aGVuIGxpc3RlbmluZyBmb3IgYSBuZXcgY2xpZW50CisgICAgICoKKyAgICAgKiBAdmFyIGludAorICAgICAqLworICAgIHByb3RlY3RlZCAkYWNjZXB0VGltZW91dF8gPSAzMDAwMDsKKworICAgIC8qKgorICAgICAqIEhvc3QgdG8gbGlzdGVuIG9uCisgICAgICoKKyAgICAgKiBAdmFyIHN0cmluZworICAgICAqLworICAgIHByb3RlY3RlZCAkaG9zdF87CisKKyAgICAvKioKKyAgICAgKiBTZXJ2ZXJTb2NrZXQgY29uc3RydWN0b3IKKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgJGhvc3QgSG9zdCB0byBsaXN0ZW4gb24KKyAgICAgKiBAcGFyYW0gaW50ICRwb3J0IFBvcnQgdG8gbGlzdGVuIG9uCisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRob3N0ID0gJ2xvY2FsaG9zdCcsICRwb3J0ID0gOTA5MCkKKyAgICB7CisgICAgICAgICR0aGlzLT5ob3N0XyA9ICRob3N0OworICAgICAgICAkdGhpcy0+cG9ydF8gPSAkcG9ydDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBhY2NlcHQgdGltZW91dAorICAgICAqCisgICAgICogQHBhcmFtIGludCAkYWNjZXB0VGltZW91dAorICAgICAqIEByZXR1cm4gdm9pZAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRB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XJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICAkc29ja2V0ID0gbmV3IFRTb2NrZXQoKTsKKyAgICAgICAgJHNvY2tldC0+c2V0SGFuZGxlKCRoYW5kbGUpOworCisgICAgICAgIHJldHVybiAkc29ja2V0OworICAgIH0KK30KZGlmZiAtLWdpdCBhL2xpYi9waHAvbGliL1NlcnZlci9UU2VydmVyVHJhbnNwb3J0LnBocCBiL2xpYi9waHAvbGliL1NlcnZlci9UU2VydmVyVHJhbnNwb3J0LnBocApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4xNWEyN2FmCi0tLSAvZGV2L251bGwKKysrIGIvbGliL3BocC9saWIvU2VydmVyL1RTZXJ2ZXJUcmFuc3BvcnQucGhwCkBAIC0wLDAgKzEsNTYgQEAKKzw/cGhwCisKK25hbWVzcGFjZSBUaHJpZnRcU2VydmVyOworCit1c2UgVGhyaWZ0XEV4Y2VwdGlvblxUVHJhbnNwb3J0RXhjZXB0aW9uOworCisvKioKKyAqIEdlbmVyaWMgY2xhc3MgZm9yIFNlcnZlciBhZ2VudC4KKyAqCisgKiBAcGFja2FnZSB0aHJpZnQudHJhbnNwb3J0CisgKi8KK2Fic3RyYWN0IGNsYXNzIFRTZXJ2ZXJUcmFuc3BvcnQKK3sKKyAgICAvKioKKyAgICAgKiBMaXN0IGZvciBuZXcgY2xpZW50cworICAgICAqCisgICAgICogQGFic3RyYWN0CisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIGxpc3RlbigpOworCisgICAgLyoqCisgICAgICogQ2xvc2UgdGhlIHNlcnZlcgorICAgICAqCisgICAgICogQGFic3RyYWN0CisgICAgICogQHJldHVybiB2b2lkCisgICAgICovCisgICAgYWJzdHJhY3QgcHVibGljIGZ1bmN0aW9uIGNsb3NlKCk7CisKKyAgICAvKioKKyAgICAgKiBTdWJjbGFzc2VzIHNob3VsZCB1c2UgdGhpcy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Fuc3BvcnRFeGNlcHRpb247CisKKy8qKgorICogU2ltcGxlIGltcGxlbXRhdGlvbiBvZiBhIFRocmlmdCBzZXJ2ZXIuCisgKgorICogQHBhY2thZ2UgdGhyaWZ0LnNlcnZlcgorICovCitjbGFzcyBUU2ltcGxlU2VydmVyIGV4dGVuZHMgVFNlcnZlcgoreworICAgIC8qKgorICAgICAqIEZsYWcgZm9yIHRoZSBtYWluIHNlcnZpbmcgbG9vcAorICAgICAqCisgICAgICogQHZhciBib29sCisgICAgICovCisgICAgcHJpdmF0ZSAkc3RvcF8gPSBmYWxzZTsKKworICAgIC8qKgorICAgICAqIExpc3RlbnMgZm9yIG5ldyBjbGllbnQgdXNpbmcgdGhlIHN1cHBsaWVkCisgICAgICogdHJhbnNwb3J0LiBJdCBoYW5kbGVzIFRUcmFuc3BvcnRFeGNlcHRpb25zCisgICAgICogdG8gYXZvaWQgdGltZW91dHMgZXRjIGtpbGxpbmcgaXQKKyAgICAgKgorICAgICAqIEByZXR1cm4gdm9pZAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXJ2ZSgpCisgICAgeworICAgICAgICAkdGhpcy0+dHJhbnNwb3J0Xy0+bGlzdGVuKCk7CisKKyAgICAgICAgd2hpbGUgKCEkdGhpcy0+c3RvcF8pIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgJHRyYW5zcG9ydCA9ICR0aGlzLT50cmFuc3BvcnRfLT5hY2NlcHQoKTsKKworICAgICAgICAgICAgICAgIGlmICgkdHJhbnNwb3J0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgJGlucHV0VHJhbnNwb3J0ID0gJHRoaXMtPmlucHV0VHJhbnNwb3J0RmFjdG9yeV8tPmdldFRyYW5zcG9ydCgkdHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgJG91dHB1dFRyYW5zcG9ydCA9ICR0aGlzLT5vdXRwdXRUcmFuc3BvcnRGYWN0b3J5Xy0+Z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mFyID0gJGZzcGVjWyd2YXInXTsKLSAgICAgICAgaWYgKCRmdHlwZSA9PSAkZnNwZWNbJ3R5cGUnXSkgewotICAgICAgICAgICR4ZmVyID0gMDsKLSAgICAgICAgICBpZiAoaXNzZXQoVEJhc2U6OiR0bWV0aG9kWyRmdHlwZV0pKSB7Ci0gICAgICAgICAgICAkZnVuYyA9ICdyZWFkJy5UQmFzZTo6JHRtZXRob2RbJGZ0eXBlXTsKLSAgICAgICAgICAgICR4ZmVyICs9ICRpbnB1dC0+JGZ1bmMoJHRoaXMtPiR2YXIpOwotICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBzd2l0Y2ggKCRmdHlwZSkgewotICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgotICAgICAgICAgICAgICAkY2xhc3MgPSAkZnNwZWNbJ2NsYXNzJ107Ci0gICAgICAgICAgICAgICR0aGlzLT4kdmFyID0gbmV3ICRjbGFzcygpOwotICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+JHZhci0+cmVhZCgkaW5wdXQpOwotICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKLSAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTWFwKCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCk7Ci0gICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgotICAgICAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR0aGlzLT4kdmFyLCAkZnNwZWMsICRpbnB1dCwgZmFsc2UpOwotICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKLSAgICAgICAgICAgICAgJHhmZXIgKz0gJHRoaXMtPl9yZWFkTGlzdCgkdGhpcy0+JHZhciwgJGZzcGVjLCAkaW5wdXQsIHRydWUpOwotICAgICAgICAgIC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LSAgICAgKiBAcmV0dXJuIHN0cmluZwotICAgICAqLwotICAgIHB1YmxpYyBmdW5jdGlvbiBmaW5kRmlsZSgkY2xhc3MpCi0gICAgewotICAgICAgICAvLyBSZW1vdmUgZmlyc3QgYmFja3NsYXNoCi0gICAgICAgIGlmICgnXFwnID09ICRjbGFzc1swXSkKLSAgICAgICAgewotICAgICAgICAgICAgJGNsYXNzID0gc3Vic3RyKCRjbGFzcywgMSk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoZmFsc2UgIT09ICRwb3MgPSBzdHJycG9zKCRjbGFzcywgJ1xcJykpCi0gICAgICAgIHsKLSAgICAgICAgICAgIC8vIE5hbWVzcGFjZWQgY2xhc3MgbmFtZQotICAgICAgICAgICAgJG5hbWVzcGFjZSA9IHN1YnN0cigkY2xhc3MsIDAsICRwb3MpOwotCi0gICAgICAgICAgICAvLyBJdGVyYXRlIGluIG5vcm1hbCBuYW1lc3BhY2VzCi0gICAgICAgICAgICBmb3JlYWNoICgkdGhpcy0+bmFtZXNwYWNlcyBhcyAkbnMgPT4gJGRpcnMpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLy9Eb24ndCBpbnRlcmZlcmUgd2l0aCBvdGhlciBhdXRvbG9hZGVycwotICAgICAgICAgICAgICAgIGlmICgwICE9PSBzdHJwb3MoJG5hbWVzcGFjZSwgJG5zKSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRkaXJzIGFzICRkaXIpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAkY2xhc3NOYW1lID0gc3Vic3RyKCRjbGFzcywgJHBvcyArIDEpOwotCi0gICAgICAgICAgICAgICAgICAgICRmaWxlID0gJGRpci5ESVJFQ1RPUllfU0VQQVJBVE9SLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyX3JlcGxhY2UoJ1xcJywgRElSRUNUT1JZX1NFUEFSQVRPUiwgJG5hbWVzcGFjZSkuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVJFQ1RPUllfU0VQQVJBVE9SLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGNsYXNzTmFtZS4nLnBocCc7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVfZXhpc3RzKCRmaWxlKSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRmaWxlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBJdGVyYXRlIGluIFRocmlmdCBuYW1lc3BhY2VzCi0KLSAgICAgICAgICAgIC8vIFJlbW92ZSBmaXJzdCBwYXJ0IG9mIG5hbWVzcGFjZQotICAgICAgICAgICAgJG0gPSBleHBsb2RlKCdcXCcsICRjbGFzcyk7Ci0KLSAgICAgICAgICAgIC8vIElnbm9yZSB3cm9uZyBjYWxsCi0gICAgICAgICAgICBpZihjb3VudCgkbSkgPD0gMSkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICRjbGFzcyA9IGFycmF5X3BvcCgkbSk7Ci0gICAgICAgICAgICAkbmFtZXNwYWNlID0gaW1wbG9kZSgnXFwnLCAkbSk7Ci0KLSAgICAgICAgICAgIGZvcmVhY2ggKCR0aGlzLT5kZWZpbml0aW9ucyBhcyAkbnMgPT4gJGRpcnMpCi0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgLy9Eb24ndCBpbnRlcmZlcmUgd2l0aCBvdGhlciBhdXRvbG9hZGVycwotICAgICAgICAgICAgICAgIGlmICgwICE9PSBzdHJwb3MoJG5hbWVzcGFjZSwgJG5zKSkKLSAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRkaXJzIGFzICRkaXIpCi0gICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICogQXZhaWxhYmxlIGluIHNlcnZpY2U6IEludGVyZmFjZSwgQ2xpZW50LCBQcm9jZXNzb3IsIFJlc3QKLSAgICAgICAgICAgICAgICAgICAgICogQW5kIGV2ZXJ5IHNlcnZpY2UgbWV0aG9kcyAoXy4rKQotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYoCi0gICAgICAgICAgICAgICAgICAgICAgICAwID09PSBwcmVnX21hdGNoKCcjKC4rKShpZnxjbGllbnR8cHJvY2Vzc29yfHJlc3QpJCNpJywgJGNsYXNzLCAkbikgYW5kCi0gICAgICAgICAgICAgICAgICAgICAgICAwID09PSBwcmVnX21hdGNoKCcjKC4rKV9bYS16MC05XStfKGFyZ3N8cmVzdWx0KSQjaScsICRjbGFzcywgJG4pCi0gICAgICAgICAgICAgICAgICAgICkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgJGNsYXNzTmFtZSA9ICdUeXBlcyc7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAkY2xhc3NOYW1lID0gJG5bMV07Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAkZmlsZSA9ICRkaXIuRElSRUNUT1JZX1NFUEFSQVRPUiAuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJfcmVwbGFjZSgnXFwnLCBESVJFQ1RPUllfU0VQQVJBVE9SLCAkbmFtZXNwYWNlKSAuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBESVJFQ1RPUllfU0VQQVJBVE9SIC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRjbGFzc05hbWUgLiAnLnBocCc7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVfZXhpc3RzKCRmaWxlKSkKLSAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRmaWxlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotfQpkaWZmIC0tZ2l0IGEvbGliL3BocC9saWIvVGhyaWZ0L0V4Y2VwdGlvbi9UQXBwbGljYXRpb25FeGNlcHRpb24ucGhwIGIvbGliL3BocC9saWIvVGhyaWZ0L0V4Y2VwdGlvbi9UQXBwbGljYXRpb25FeGNlcHRpb24ucGhwCmRlbGV0ZWQgZmlsZSBtb2RlIDEwMDY0NAppbmRleCA5MDgxOTczLi4wMDAwMDAwCi0tLSBhL2xpYi9waHAvbGliL1RocmlmdC9FeGNlcHRpb24vVEFwcGxpY2F0aW9uRXhjZXB0aW9uLnBocAorKysgL2Rldi9udWxsCkBAIC0xLDcyICswLDAgQEAKLTw/cGhwCi0vKgotICogTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQotICogb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuIFNlZSB0aGUgTk9USUNFIGZpbGUKLSAqIGRpc3RyaWJ1dGVkIHdpdGggdGhpcyB3b3JrIGZvciBhZGRpdGlvbmFsIGluZm9ybWF0aW9uCi0gKiByZWdhcmRpbmcgY29weXJpZ2h0IG93bmVyc2hpcC4gVGhlIEFTRiBsaWNlbnNlcyB0aGlzIGZpbGUKLSAqIHRvIHlvdSB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2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c3BlYykgewotICAgICAgICAkdmFyID0gJGZzcGVjWyd2YXInXTsKLSAgICAgICAgaWYgKGlzc2V0KCR2YWxzWyR2YXJdKSkgewotICAgICAgICAgICR0aGlzLT4kdmFyID0gJHZhbHNbJHZhcl07Ci0gICAgICAgIH0KLSAgICAgIH0KLSAgICB9IGVsc2UgewotICAgICAgcGFyZW50OjpfX2NvbnN0cnVjdCgkcDEsICRwMik7Ci0gICAgfQotICB9Ci0KLSAgc3RhdGljICR0bWV0aG9kID0gYXJyYXkoVFR5cGU6OkJPT0wgICA9PiAnQm9vbCcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIFRUeXBlOjpCWVRFICAgPT4gJ0J5dGUnLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZTo6STE2ICAgID0+ICdJMTYnLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZTo6STMyICAgID0+ICdJMzInLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZTo6STY0ICAgID0+ICdJNjQnLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZTo6RE9VQkxFID0+ICdEb3VibGUnLAotICAgICAgICAgICAgICAgICAgICAgICAgICBUVHlwZTo6U1RSSU5HID0+ICdTdHJpbmcnKTsKLQotICBwcml2YXRlIGZ1bmN0aW9uIF9yZWFkTWFwKCYkdmFyLCAkc3BlYywgJGlucHV0KSB7Ci0gICAgJHhmZXIgPSAwOwotICAgICRrdHlwZSA9ICRzcGVjWydrdHlwZSddOwotICAgICR2dHlwZSA9ICRzcGVjWyd2dHlwZSddOwotICAgICRrcmVhZCA9ICR2cmVhZCA9IG51bGw7Ci0gICAgaWYgKGlzc2V0KFRCYXNlOjokdG1ldGhvZFska3R5cGVdKSkgewotICAgICAgJGtyZWFkID0gJ3JlYWQnLlRCYXNlOjokdG1ldGhvZFska3R5cGVdOwotICAgIH0gZWxzZSB7Ci0gICAgICAka3NwZWMgPSAkc3BlY1sna2V5J107Ci0gICAgfQotICAgIG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R4ZmVyICs9ICR0aGlzLT5fcmVhZExpc3QoJGtleSwgJGtzcGVjLCAkaW5wdXQsIHRydWUpOwotICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICB9Ci0gICAgICBpZiAoJHZyZWFkICE9PSBudWxsKSB7Ci0gICAgICAgICR4ZmVyICs9ICRpbnB1dC0+JHZyZWFkKCR2YWwpOwotICAgICAgfSBlbHNlIHsKLSAgICAgICAgc3dpdGNoICgkdnR5cGUpIHsKLSAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgotICAgICAgICAgICRjbGFzcyA9ICR2c3BlY1snY2xhc3MnXTsKLSAgICAgICAgICAkdmFsID0gbmV3ICRjbGFzcygpOwotICAgICAgICAgICR4ZmVyICs9ICR2YWwtPnJlYWQoJGlucHV0KTsKLSAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBUVHlwZTo6TUFQOgotICAgICAgICAgICR4ZmVyICs9ICR0aGlzLT5fcmVhZE1hcCgkdmFsLCAkdnNwZWMsICRpbnB1dCk7Ci0gICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgVFR5cGU6OkxTVDoKLSAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR2YWwsICR2c3BlYywgJGlucHV0LCBmYWxzZSk7Ci0gICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgVFR5cGU6OlNFVDoKLSAgICAgICAgICAkeGZlciArPSAkdGhpcy0+X3JlYWRMaXN0KCR2YWwsICR2c3BlYywgJGlucHV0LCB0cnVlKTsKLSAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotICAgICAgfQotICAgICAgJHZhclska2V5XSA9ICR2YWw7Ci0gICAgfQotICAgICR4ZmVyICs9ICRpbnB1dC0+cmVhZE1hcEVuZCgpOwotICAgIHJldHVybiAkeGZlcjsKLSAgfQotCi0gIHByaXZhdGUgZnVuY3Rpb24gX3JlYWRMaXN0KCYkdmFyLCAkc3BlYywgJ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KLQotICAgICAgaWYgKCRoaSAmIChpbnQpMHg4MDAwMDAwMCkgewotICAgICAgICAkaGkgJj0gKGludCkweDdmZmZmZmZmOwotICAgICAgICAkaGkgKz0gMHg4MDAwMDAwMDsKLSAgICAgIH0KLQotICAgICAgaWYgKCRsbyAmIChpbnQpMHg4MDAwMDAwMCkgewotICAgICAgICAkbG8gJj0gKGludCkweDdmZmZmZmZmOwotICAgICAgICAkbG8gKz0gMHg4MDAwMDAwMDsKLSAgICAgIH0KLQotICAgICAgJHZhbHVlID0gJGhpICogNDI5NDk2NzI5NiArICRsbzsKLQotICAgICAgaWYgKCRpc05lZykgewotICAgICAgICAkdmFsdWUgPSAwIC0gJHZhbHVlOwotICAgICAgfQotICAgIH0gZWxzZSB7Ci0KLSAgICAgIC8vIFVwY2FzdCBuZWdhdGl2ZXMgaW4gTFNCIGJpdAotICAgICAgaWYgKCRhcnJbMl0gJiAweDgwMDAwMDAwKSB7Ci0gICAgICAgICRhcnJbMl0gPSAkYXJyWzJdICYgMHhmZmZmZmZmZjsKLSAgICAgIH0KLQotICAgICAgLy8gQ2hlY2sgZm9yIGEgbmVnYXRpdmUKLSAgICAgIGlmICgkYXJyWzFdICYgMHg4MDAwMDAwMCkgewotICAgICAgICAkYXJyWzFdID0gJGFyclsxXSAmIDB4ZmZmZmZmZmY7Ci0gICAgICAgICRhcnJbMV0gPSAkYXJyWzFdIF4gMHhmZmZmZmZmZjsKLSAgICAgICAgJGFyclsyXSA9ICRhcnJbMl0gXiAweGZmZmZmZmZmOwotICAgICAgICAkdmFsdWUgPSAwIC0gJGFyclsxXSo0Mjk0OTY3Mjk2IC0gJGFyclsyXSAtIDE7Ci0gICAgICB9IGVsc2UgewotICAgICAgICAkdmFsdWUgPSAkYXJyWzFdKjQyOTQ5NjcyOTYgKyAkYXJyWzJdOwotICAgICAgfQotICAgIH0KLQotICAgIHJldHVybiA4OwotICB9Ci0KLSAgcHVibGljIGZ1bmN0aW9uIHJlYWREb3VibGUoJiR2YW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FJJTkc6Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHNlbGY6Ok5BTUVfU1RSSU5HOwotICAgICAgICAgICAgY2FzZSBUVHlwZTo6U1RSVUNUOgotICAgICAgICAgICAgICAgIHJldHVybiBzZWxmOjpOQU1FX1NUUlVDVDsKLSAgICAgICAgICAgIGNhc2UgVFR5cGU6Ok1BUDoKLSAgICAgICAgICAgICAgICByZXR1cm4gc2VsZjo6TkFNRV9NQVA7Ci0gICAgICAgICAgICBjYXNlIFRUeXBlOjpTRVQ6Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHNlbGY6Ok5BTUVfU0VUOwotICAgICAgICAgICAgY2FzZSBUVHlwZTo6TFNUOgotICAgICAgICAgICAgICAgIHJldHVybiBzZWxmOjpOQU1FX0xJU1Q7Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oIlVucmVjb2duaXplZCB0eXBlIiwgVFByb3RvY29sRXhjZXB0aW9uOjpVTktOT1dOKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgZnVuY3Rpb24gZ2V0VHlwZUlERm9yVHlwZU5hbWUoJG5hbWUpCi0gICAgewotICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OlNUT1A7Ci0KLSAgICAgICAgaWYgKHN0cmxlbigkbmFtZSkgPiAxKSB7Ci0gICAgICAgICAgICBzd2l0Y2ggKHN1YnN0cigkbmFtZSwgMCwgMSkpIHsKLSAgICAgICAgICAgICAgICBjYXNlICdkJzoKLSAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpET1VCTEU7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgJ2knOgotICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHN1YnN0cigkbmFtZSwgMSwgMSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzgnOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6QllURTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzEnOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6STE2OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnMyc6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpJMzI7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc2JzoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6Okk2NDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlICdsJzoKLSAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpMU1Q7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgJ20nOgotICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6Ok1BUDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSAncic6Ci0gICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6U1RSVUNUOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlICdzJzoKLSAgICAgICAgICAgICAgICAgICAgaWYgKHN1YnN0cigkbmFtZSwgMSwgMSkgPT0gJ3QnKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAkcmVzdWx0ID0gVFR5cGU6OlNUUklORzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJzdHIoJG5hbWUsIDEsIDEpID09ICdlJykgewotICAgICAgICAgICAgICAgICAgICAgICAgJHJlc3VsdCA9IFRUeXBlOjpTRVQ7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSAndCc6Ci0gICAgICAgICAgICAgICAgICAgICRyZXN1bHQgPSBUVHlwZTo6Qk9PTDsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKCRyZXN1bHQgPT0gVFR5cGU6OlNUT1ApIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oIlVucmVjb2duaXplZCB0eXBlIiwgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEpOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiAkcmVzdWx0OwotICAgIH0KLQotICAgIHB1YmxpYyAkY29udGV4dFN0YWNrXyA9IGFycmF5KCk7Ci0gICAgcHVibGljICRjb250ZXh0XzsKLSAgICBwdWJsaWMgJHJlYWRlcl87Ci0KLSAgICBwcml2YXRlIGZ1bmN0aW9uIHB1c2hDb250ZXh0KCRjKSB7Ci0gICAgICAgIGFycmF5X3B1c2goJHRoaXMtPmNvbnRleHRTdGFja18sICR0aGlzLT5jb250ZXh0Xyk7Ci0gICAgICAgICR0aGlzLT5jb250ZXh0XyA9ICRjOwotICAgIH0KLQotICAgIHByaXZhdGUgZnVuY3Rpb24gcG9wQ29udGV4dCgpIHsKLSAgICAgICAgJHRoaXMtPmNvbnRleHRfID0gYXJyYXlfcG9wKCR0aGlzLT5jb250ZXh0U3RhY2tfKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgZnVu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0gc2VsZjo6UVVPVEUgJiYKLSAgICAgICAgICAkbGFzdENoYXIgIT09IE5VTEwgJiYKLSAgICAgICAgICAgICRsYXN0Q2hhciAhPT0gc2VsZjo6RVNDU0VRKSB7Ci0gICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKCRjaCA9PSBzZWxmOjpFU0NTRVEgJiYgJGxhc3RDaGFyID09IHNlbGY6OkVTQ1NFUSkgewotICAgICAgICAgICRsYXN0Q2hhciA9IHNlbGY6OkRPVUJMRUVTQzsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAkbGFzdENoYXIgPSAkY2g7Ci0gICAgICAgIH0KLSAgICAgIH0KLSAgICAgIHJldHVybiBqc29uX2RlY29kZSgkanNvblN0cmluZyk7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBmdW5jdGlvbiBpc0pTT05OdW1lcmljKCRiKSB7Ci0gICAgICAgIHN3aXRjaCAoJGIpIHsKLSAgICAgICAgICAgIGNhc2UgJysnOgotICAgICAgICAgICAgY2FzZSAnLSc6Ci0gICAgICAgICAgICBjYXNlICcuJzoKLSAgICAgICAgICAgIGNhc2UgJzAnOgotICAgICAgICAgICAgY2FzZSAnMSc6Ci0gICAgICAgICAgICBjYXNlICcyJzoKLSAgICAgICAgICAgIGNhc2UgJzMnOgotICAgICAgICAgICAgY2FzZSAnNCc6Ci0gICAgICAgICAgICBjYXNlICc1JzoKLSAgICAgICAgICAgIGNhc2UgJzYnOgotICAgICAgICAgICAgY2FzZSAnNyc6Ci0gICAgICAgICAgICBjYXNlICc4JzoKLSAgICAgICAgICAgIGNhc2UgJzknOgotICAgICAgICAgICAgY2FzZSAnRSc6Ci0gICAgICAgICAgICBjYXNlICdlJzoKLSAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIHJldHVybiBmYWxzZTsKLSAgICB9Ci0KLSAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09OTnVtZXJpY0NoYXJzKCkgewotICAgICAgICAkc3RyYmxkID0gYXJyYXkoKTsKLQotICAgICAgICB3aGlsZSAodHJ1ZSkgewotICAgICAgICAgICAgJGNoID0gJHRoaXMtPnJlYWRlcl8tPnBlZWsoKTsKLQotICAgICAgICAgICAgaWYgKCEkdGhpcy0+aXNKU09OTnVtZXJpYygkY2gpKSB7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICRzdHJibGRbXSA9ICR0aGlzLT5yZWFkZXJfLT5yZWFkKCk7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gaW1wbG9kZSgiIiwgJHN0cmJsZCk7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBmdW5jdGlvbiByZWFkSlNPTkludGVnZXIoKSB7Ci0gICAgICAgICR0aGlzLT5jb250ZXh0Xy0+cmVhZCgpOwotCi0gICAgICAgIGlmICgkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7Ci0gICAgICAgICAgICAkdGhpcy0+cmVhZEpTT05TeW50YXhDaGFyKHNlbGY6OlFVT1RFKTsKLSAgICAgICAgfQotCi0gICAgICAgICRzdHIgPSAkdGhpcy0+cmVhZEpTT05OdW1lcmljQ2hhcnMoKTsKLQotICAgICAgICBpZiAoJHRoaXMtPmNvbnRleHRfLT5lc2NhcGVOdW0oKSkgewotICAgICAgICAgICAgJHRoaXMtPnJlYWRKU09OU3ludGF4Q2hhcihzZWxmOjpRVU9URSk7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoIWlzX251bWVyaWMoJHN0cikpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBUUHJvdG9jb2xFeGNlcHRpb24oIkludmFsaWQgZGF0YSBpbiBudW1lcmljOiAiIC4gJHN0ciwgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEpOwotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGludHZhbCgk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gICB9Ci0KLSAgICBwcml2YXRlIGZ1bmN0aW9uIHJlYWRKU09ORG91YmxlKCkgewotICAgICAgICAkdGhpcy0+Y29udGV4dF8tPnJlYWQoKTsKLQotICAgICAgICBpZiAoc3Vic3RyKCR0aGlzLT5yZWFkZXJfLT5wZWVrKCksIDAsIDEpID09IHNlbGY6OlFVT1RFKSB7Ci0gICAgICAgICAgICAkYXJyID0gJHRoaXMtPnJlYWRKU09OU3RyaW5nKHRydWUpOwotCi0gICAgICAgICAgICBpZiAoJGFyciA9PSAiTmFOIikgewotICAgICAgICAgICAgICAgIHJldHVybiBOQU47Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKCRhcnIgPT0gIkluZmluaXR5IikgewotICAgICAgICAgICAgICAgIHJldHVybiBJTkY7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKCEkdGhpcy0+Y29udGV4dF8tPmVzY2FwZU51bSgpKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRQcm90b2NvbEV4Y2VwdGlvbigiTnVtZXJpYyBkYXRhIHVuZXhwZWN0ZWRseSBxdW90ZWQgIiAuICRhcnIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXhjZXB0aW9uOjpJTlZBTElEX0RBVEEpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZXR1cm4gZmxvYXR2YWwoJGFycik7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoJHRoaXMtPmNvbnRleHRfLT5lc2NhcGVOdW0oKSkgewotICAgICAgICAgICAgICAgICR0aGlzLT5yZWFkSlNPTlN5bnRheENoYXIoc2VsZjo6UVVPVEUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZXR1cm4gZmxvYXR2YWwoJHRoaXMtPnJlYWRKU09OTnVtZXJpY0NoYXJzKCkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBmdW5jdGl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G9nZ2luZwotICAgKi8KLSAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRob3N0cz1hcnJheSgnbG9jYWxob3N0JyksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcG9ydHM9YXJyYXkoOTA5MCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkcGVyc2lzdD1GQUxTRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRkZWJ1Z0hhbmRsZXI9bnVsbCkgewotICAgIHBhcmVudDo6X19jb25zdHJ1Y3QobnVsbCwgMCwgJHBlcnNpc3QsICRkZWJ1Z0hhbmRsZXIpOwotCi0gICAgaWYgKCFpc19hcnJheSgkcG9ydHMpKSB7Ci0gICAgICAkcG9ydCA9ICRwb3J0czsKLSAgICAgICRwb3J0cyA9IGFycmF5KCk7Ci0gICAgICBmb3JlYWNoICgkaG9zdHMgYXMgJGtleSA9PiAkdmFsKSB7Ci0gICAgICAgICRwb3J0c1ska2V5XSA9ICRwb3J0OwotICAgICAgfQotICAgIH0KLQotICAgIGZvcmVhY2ggKCRob3N0cyBhcyAka2V5ID0+ICRob3N0KSB7Ci0gICAgICAkdGhpcy0+c2VydmVyc18gW109IGFycmF5KCdob3N0JyA9PiAkaG9zdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BvcnQnID0+ICRwb3J0c1ska2V5XSk7Ci0gICAgfQotICB9Ci0KLSAgLyoqCi0gICAqIEFkZCBhIHNlcnZlciB0byB0aGUgcG9vbAotICAgKgotICAgKiBUaGlzIGZ1bmN0aW9uIGRvZXMgbm90IHByZXZlbnQgeW91IGZyb20gYWRkaW5nIGEgZHVwbGljYXRlIHNlcnZlciBlbnRyeS4KLSAgICoKLSAgICogQHBhcmFtIHN0cmluZyAkaG9zdCBob3N0bmFtZSBvciBJUAotICAgKiBAcGFyYW0gaW50ICRwb3J0IHBvcnQKLSAgICovCi0gIHB1YmxpYyBmdW5jdGlvbiBhZGRTZXJ2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nIHRyYW5zcG9ydAorICAgICAqCisgICAgICogQHZhciBUVHJhbnNwb3J0CisgICAgICovCisgICAgcHJvdGVjdGVkICR0cmFuc3BvcnRfOworCisgICAgLyoqCisgICAgICogVGhlIHJlY2VpdmUgYnVmZmVyIHNpemUKKyAgICAgKgorICAgICAqIEB2YXIgaW50CisgICAgICovCisgICAgcHJvdGVjdGVkICRyQnVmU2l6ZV8gPSA1MTI7CisKKyAgICAvKioKKyAgICAgKiBUaGUgd3JpdGUgYnVmZmVyIHNpemUKKyAgICAgKgorICAgICAqIEB2YXIgaW50CisgICAgICovCisgICAgcHJvdGVjdGVkICR3QnVmU2l6ZV8gPSA1MTI7CisKKyAgICAvKioKKyAgICAgKiBUaGUgd3JpdGUgYnVmZmVyLgorICAgICAqCisgICAgICogQHZhciBzdHJpbmcKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJHdCdWZfID0gJyc7CisKKyAgICAvKioKKyAgICAgKiBUaGUgcmVhZCBidWZmZXIuCisgICAgICoKKyAgICAgKiBAdmFyIHN0cmluZworICAgICAqLworICAgIHByb3RlY3RlZCAkckJ1Zl8gPSAnJzsKKworICAgIC8qKgorICAgICAqIENvbnN0cnVjdG9yLiBDcmVhdGVzIGEgYnVmZmVyZWQgdHJhbnNwb3J0IGFyb3VuZCBhbiB1bmRlcmx5aW5nIHRyYW5zcG9ydAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkdHJhbnNwb3J0LCAkckJ1ZlNpemUgPSA1MTIsICR3QnVmU2l6ZSA9IDUxMikKKyAgICB7CisgICAgICAgICR0aGlzLT50cmFuc3BvcnRfID0gJHRyYW5zcG9ydDsKKyAgICAgICAgJHRoaXMtPnJCdWZTaXplXyA9ICRyQnVmU2l6ZTsKKyAgICAgICAgJHRoaXMtPndCdWZTaXplXyA9ICR3QnVmU2l6ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gaXNPcGVuKCkKKyAgICB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0aGlzLT5yQnVmXywgJGxlbik7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gJGRhdGE7CisgICAgfQorCisgICAgLyoqCisgICAgICogQGluaGVyaXRkb2MKKyAgICAgKgorICAgICAqIEBwYXJhbSBpbnQgJGxlbgorICAgICAqIEByZXR1cm4gc3RyaW5nCisgICAgICogQHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWQoJGxlbikKKyAgICB7CisgICAgICAgIGlmIChUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJHRoaXMtPnJCdWZfKSA9PT0gMCkgeworICAgICAgICAgICAgJHRoaXMtPnJCdWZfID0gJHRoaXMtPnRyYW5zcG9ydF8tPnJlYWQoJHRoaXMtPnJCdWZTaXplXyk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCR0aGlzLT5yQnVmXykgPD0gJGxlbikgeworICAgICAgICAgICAgJHJldCA9ICR0aGlzLT5yQnVmXzsKKyAgICAgICAgICAgICR0aGlzLT5yQnVmXyA9ICcnOworCisgICAgICAgICAgICByZXR1cm4gJHJldDsKKyAgICAgICAgfQorCisgICAgICAgICRyZXQgPSBUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdWJzdHIoJHRoaXMtPnJCdWZfLCAwLCAkbGVuKTsKKyAgICAgICAgJHRoaXMtPnJCdWZfID0gVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3Vic3RyKCR0aGlzLT5yQnVmXywgJGxlbik7CisKKyAgICAgICAgcmV0dXJuICRyZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQGluaGVyaXRkb2MKKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgJGJ1ZgorICAgICAqIEB0aHJvd3MgVFRyYW5z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qIFRoZSBob3N0IHRvIGNvbm5lY3QgdG8KKyAgICAgKgorICAgICAqIEB2YXIgc3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkICRob3N0XzsKKworICAgIC8qKgorICAgICAqIFRoZSBwb3J0IHRvIGNvbm5lY3Qgb24KKyAgICAgKgorICAgICAqIEB2YXIgaW50CisgICAgICovCisgICAgcHJvdGVjdGVkICRwb3J0XzsKKworICAgIC8qKgorICAgICAqIFRoZSBVUkkgdG8gcmVxdWVzdAorICAgICAqCisgICAgICogQHZhciBzdHJpbmcKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJHVyaV87CisKKyAgICAvKioKKyAgICAgKiBUaGUgc2NoZW1lIHRvIHVzZSBmb3IgdGhlIHJlcXVlc3QsIGkuZS4gaHR0cCwgaHR0cHMKKyAgICAgKgorICAgICAqIEB2YXIgc3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkICRzY2hlbWVfOworCisgICAgLyoqCisgICAgICogQnVmZmVyIGZvciB0aGUgSFRUUCByZXF1ZXN0IGRhdGEKKyAgICAgKgorICAgICAqIEB2YXIgc3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkICRyZXF1ZXN0XzsKKworICAgIC8qKgorICAgICAqIEJ1ZmZlciBmb3IgdGhlIEhUVFAgcmVzcG9uc2UgZGF0YS4KKyAgICAgKgorICAgICAqIEB2YXIgYmluYXJ5IHN0cmluZworICAgICAqLworICAgIHByb3RlY3RlZCAkcmVzcG9uc2VfOworCisgICAgLyoqCisgICAgICogUmVhZCB0aW1lb3V0CisgICAgICoKKyAgICAgKiBAdmFyIGZsb2F0CisgICAgICovCisgICAgcHJvdGVjdGVkICR0aW1lb3V0XzsKKworICAgIC8qKgorICAgICAqIGh0dHAgaGVhZGVycworICAgICAqCisgICAgICogQHZhciBhcnJheQorICAgICAqLworICAgIHByb3RlY3RlZCAkaGVhZGVyc187CisKKyAgICAvKioKKyAgICAgKiBNYWtlIGEgbmV3IEhUVFAgY2xpZW50LgorICAgICAqCisgICAgICogQHBhcmFtIHN0cmluZyAkaG9zdAorICAgICAqIEBwYXJhbSBpbnQgJHBvcnQKKyAgICAgKiBAcGFyYW0gc3RyaW5nICR1cmkKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoJGhvc3QsICRwb3J0ID0gODAsICR1cmkgPSAnJywgJHNjaGVtZSA9ICdodHRwJykKKyAgICB7CisgICAgICAgIGlmICgoVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCR1cmkpID4gMCkgJiYgKCR1cml7MH0gIT0gJy8nKSkgeworICAgICAgICAgICAgJHVyaSA9ICcvJyAuICR1cmk7CisgICAgICAgIH0KKyAgICAgICAgJHRoaXMtPnNjaGVtZV8gPSAkc2NoZW1lOworICAgICAgICAkdGhpcy0+aG9zdF8gPSAkaG9zdDsKKyAgICAgICAgJHRoaXMtPnBvcnRfID0gJHBvcnQ7CisgICAgICAgICR0aGlzLT51cmlfID0gJHVyaTsKKyAgICAgICAgJHRoaXMtPnJlcXVlc3RfID0gJyc7CisgICAgICAgICR0aGlzLT5yZXNwb25zZV8gPSBudWxsOworICAgICAgICAkdGhpcy0+dGltZW91dF8gPSBudWxsOworICAgICAgICAkdGhpcy0+aGVhZGVyc18gPSBhcnJheSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCByZWFkIHRpbWVvdXQKKyAgICAgKgorICAgICAqIEBwYXJhbSBmbG9hdCAkdGltZW91dAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRUaW1lb3V0U2VjcygkdGltZW91dCkKKyAgICB7CisgICAgICAgICR0aGlzLT50aW1lb3V0XyA9ICR0aW1lb3V0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFdoZXRoZXIgdGhpcyB0cmFuc3BvcnQgaXMgb3Blbi4KKyAgICAgKgorICAgICAqIEByZXR1cm4gYm9vbGVhbiB0cnVlIGlmIG9wZW4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gaXNPcGVuKCkKKyAgICB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIE9wZW4gdGhlIHRyYW5zcG9ydCBmb3IgcmVhZGluZy93cml0aW5nCisgICAgICoKKyAgICAgKiBAdGhyb3dzIFRUcmFuc3BvcnRFeGNlcHRpb24gaWYgY2Fubm90IG9wZW4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gb3BlbigpCisgICAgeworICAgIH0KKworICAgIC8qKgorICAgICAqIENsb3NlIHRoZSB0cmFuc3BvcnQuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGNsb3NlKCkKKyAgICB7CisgICAgICAgICR0aGlzLT5yZXF1ZXN0XyA9ICcnOworICAgICAgICAkdGhpcy0+cmVzcG9uc2VfID0gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZWFkIHNvbWUgZGF0YSBpbnRvIHRoZSBhcnJheS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBpbnQgJGxlbiBIb3cgbXVjaCB0byByZWFkCisgICAgICogQHJldHVybiBzdHJpbmcgVGhlIGRhdGEgdGhhdCBoYXMgYmVlbiByZWFkCisgICAgICogQHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uIGlmIGNhbm5vdCByZWFkIGFueSBtb3JlIGRhdGEKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZCgkbGVuKQorICAgIHsKKyAgICAgICAgaWYgKCRsZW4gPj0gc3RybGVuKCR0aGlzLT5yZXNwb25zZV8pKSB7CisgICAgICAgICAgICByZXR1cm4gJHRoaXMtPnJlc3BvbnNlXzsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICRyZXQgPSBzdWJzdHIoJHRoaXMtPnJlc3BvbnNlXywgMCwgJGxlbik7CisgICAgICAgICAgICAkdGhpcy0+cmVzcG9uc2V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AkdGhpcy0+dGltZW91dF8pOworICAgICAgICB9CisgICAgICAgIGN1cmxfc2V0b3B0KHNlbGY6OiRjdXJsSGFuZGxlLCBDVVJMT1BUX1BPU1RGSUVMRFMsICR0aGlzLT5yZXF1ZXN0Xyk7CisgICAgICAgICR0aGlzLT5yZXF1ZXN0XyA9ICcnOworCisgICAgICAgIGN1cmxfc2V0b3B0KHNlbGY6OiRjdXJsSGFuZGxlLCBDVVJMT1BUX1VSTCwgJGZ1bGxVcmwpOworICAgICAgICAkdGhpcy0+cmVzcG9uc2VfID0gY3VybF9leGVjKHNlbGY6OiRjdXJsSGFuZGxlKTsKKyAgICAgICAgJHJlc3BvbnNlRXJyb3IgPSBjdXJsX2Vycm9yKHNlbGY6OiRjdXJsSGFuZGxlKTsKKworICAgICAgICAkY29kZSA9IGN1cmxfZ2V0aW5mbyhzZWxmOjokY3VybEhhbmRsZSwgQ1VSTElORk9fSFRUUF9DT0RFKTsKKworICAgICAgICAvLyBIYW5kbGUgbm9uIDIwMCBzdGF0dXMgY29kZSAvIGNvbm5lY3QgZmFpbHVyZQorICAgICAgICBpZiAoJHRoaXMtPnJlc3BvbnNlXyA9PT0gZmFsc2UgfHwgJGNvZGUgIT09IDIwMCkgeworICAgICAgICAgICAgY3VybF9jbG9zZShzZWxmOjokY3VybEhhbmRsZSk7CisgICAgICAgICAgICBzZWxmOjokY3VybEhhbmRsZSA9IG51bGw7CisgICAgICAgICAgICAkdGhpcy0+cmVzcG9uc2VfID0gbnVsbDsKKyAgICAgICAgICAgICRlcnJvciA9ICdUQ3VybENsaWVudDogQ291bGQgbm90IGNvbm5lY3QgdG8gJyAuICRmdWxsVXJsOworICAgICAgICAgICAgaWYgKCRyZXNwb25zZUVycm9yKSB7CisgICAgICAgICAgICAgICAgJGVycm9yIC49ICcsICcgLiAkcmVzcG9uc2VFcnJvcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgkY29kZSkgeworICAgICAgICAgICAgICAgICRlcnJvciAu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3RyaW5nCisgICAgICovCisgICAgcHJvdGVjdGVkICR1cmlfOworCisgICAgLyoqCisgICAgICogVGhlIHNjaGVtZSB0byB1c2UgZm9yIHRoZSByZXF1ZXN0LCBpLmUuIGh0dHAsIGh0dHBzCisgICAgICoKKyAgICAgKiBAdmFyIHN0cmluZworICAgICAqLworICAgIHByb3RlY3RlZCAkc2NoZW1lXzsKKworICAgIC8qKgorICAgICAqIEJ1ZmZlciBmb3IgdGhlIEhUVFAgcmVxdWVzdCBkYXRhCisgICAgICoKKyAgICAgKiBAdmFyIHN0cmluZworICAgICAqLworICAgIHByb3RlY3RlZCAkYnVmXzsKKworICAgIC8qKgorICAgICAqIElucHV0IHNvY2tldCBzdHJlYW0uCisgICAgICoKKyAgICAgKiBAdmFyIHJlc291cmNlCisgICAgICovCisgICAgcHJvdGVjdGVkICRoYW5kbGVfOworCisgICAgLyoqCisgICAgICogUmVhZCB0aW1lb3V0CisgICAgICoKKyAgICAgKiBAdmFyIGZsb2F0CisgICAgICovCisgICAgcHJvdGVjdGVkICR0aW1lb3V0XzsKKworICAgIC8qKgorICAgICAqIGh0dHAgaGVhZGVycworICAgICAqCisgICAgICogQHZhciBhcnJheQorICAgICAqLworICAgIHByb3RlY3RlZCAkaGVhZGVyc187CisKKyAgICAvKioKKyAgICAgKiBDb250ZXh0IGFkZGl0aW9uYWwgb3B0aW9ucworICAgICAqCisgICAgICogQHZhciBhcnJheQorICAgICAqLworICAgIHByb3RlY3RlZCAkY29udGV4dF87CisKKyAgICAvKioKKyAgICAgKiBNYWtlIGEgbmV3IEhUVFAgY2xpZW50LgorICAgICAqCisgICAgICogQHBhcmFtIHN0cmluZyAkaG9zdAorICAgICAqIEBwYXJhbSBpbnQgICAgJHBvcnQKKyAgICAgKiBAcGFyYW0gc3RyaW5nICR1cmkKKyAgICAgKiBAcGFyYW0gc3RyaW5nICRzY2hlbWUKKyAgICAgKiBAcGFyYW0gYXJyYXkgICRjb250ZXh0CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRob3N0LCAkcG9ydCA9IDgwLCAkdXJpID0gJycsICRzY2hlbWUgPSAnaHR0cCcsIGFycmF5ICRjb250ZXh0ID0gYXJyYXkoKSkKKyAgICB7CisgICAgICAgIGlmICgoVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCR1cmkpID4gMCkgJiYgKCR1cml7MH0gIT0gJy8nKSkgeworICAgICAgICAgICAgJHVyaSA9ICcvJyAuICR1cmk7CisgICAgICAgIH0KKyAgICAgICAgJHRoaXMtPnNjaGVtZV8gPSAkc2NoZW1lOworICAgICAgICAkdGhpcy0+aG9zdF8gPSAkaG9zdDsKKyAgICAgICAgJHRoaXMtPnBvcnRfID0gJHBvcnQ7CisgICAgICAgICR0aGlzLT51cmlfID0gJHVyaTsKKyAgICAgICAgJHRoaXMtPmJ1Zl8gPSAnJzsKKyAgICAgICAgJHRoaXMtPmhhbmRsZV8gPSBudWxsOworICAgICAgICAkdGhpcy0+dGltZW91dF8gPSBudWxsOworICAgICAgICAkdGhpcy0+aGVhZGVyc18gPSBhcnJheSgpOworICAgICAgICAkdGhpcy0+Y29udGV4dF8gPSAkY29udGV4dDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgcmVhZCB0aW1lb3V0CisgICAgICoKKyAgICAgKiBAcGFyYW0gZmxvYXQgJHRpbWVvdXQKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gc2V0VGltZW91dFNlY3MoJHRpbWVvdXQpCisgICAgeworICAgICAgICAkdGhpcy0+dGltZW91dF8gPSAkdGltZW91dDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBXaGV0aGVyIHRoaXMgdHJhbnNwb3J0IGlzIG9wZW4uCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGJvb2xlYW4gdHJ1ZSBpZiBvcGVuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGlzT3BlbigpCisgICAgeworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBPcGVuIHRoZSB0cmFuc3BvcnQgZm9yIHJlYWRpbmcvd3JpdGluZworICAgICAqCisgICAgICogQHRocm93cyBUVHJhbnNwb3J0RXhjZXB0aW9uIGlmIGNhbm5vdCBvcGVuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIG9wZW4oKQorICAgIHsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDbG9zZSB0aGUgdHJhbnNwb3J0LgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBjbG9zZSgpCisgICAgeworICAgICAgICBpZiAoJHRoaXMtPmhhbmRsZV8pIHsKKyAgICAgICAgICAgIEBmY2xvc2UoJHRoaXMtPmhhbmRsZV8pOworICAgICAgICAgICAgJHRoaXMtPmhhbmRsZV8gPSBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZCBzb21lIGRhdGEgaW50byB0aGUgYXJyYXkuCisgICAgICoKKyAgICAgKiBAcGFyYW0gaW50ICRsZW4gSG93IG11Y2ggdG8gcmVhZAorICAgICAqIEByZXR1cm4gc3RyaW5nIFRoZSBkYXRhIHRoYXQgaGFzIGJlZW4gcmVhZAorICAgICAqIEB0aHJvd3MgVFRyYW5zcG9ydEV4Y2VwdGlvbiBpZiBjYW5ub3QgcmVhZCBhbnkgbW9yZSBkYXRhCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHJlYWQoJGxlbikKKyAgICB7CisgICAgICAgICRkYXRhID0gQGZyZWFkKCR0aGlzLT5oYW5kbGVfLCAkbGVuKTsKKyAgICAgICAgaWYgKCRkYXRhID09PSBmYWxzZSB8fCAkZGF0YSA9PT0gJycpIHsKKyAgICAgICAgICAgICRtZCA9IHN0cmVhbV9nZXRfbWV0YV9kYXRhKCR0aGlzLT5oYW5kbGVfKTsKKyAgICAgICAgICAgIGlmICgkbWRbJ3RpbWVkX291dCddKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICdUSHR0cENsaWVudDogdGltZWQgb3V0IHJlYWRpbmcgJyAuICRsZW4gLiAnIGJ5dGVzIGZyb20gJyAuCisgICAgICAgICAgICAgICAgICAgICR0aGlzLT5ob3N0XyAuICc6JyAuICR0aGlzLT5wb3J0XyAuICR0aGlzLT51cmlfLAorICAgICAgICAgICAgICAgICAgICBUVHJhbnNwb3J0RXhjZXB0aW9uOjpUSU1FRF9PVVQKKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgJ1RIdHRwQ2xpZW50OiBDb3VsZCBub3QgcmVhZCAnIC4gJGxlbiAuICcgYnl0ZXMgZnJvbSAnIC4KKyAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfIC4gJHRoaXMtPnVyaV8sCisgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb246OlVOS05PV04KKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuICRkYXRhOworICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlcyBzb21lIGRhdGEgaW50byB0aGUgcGVuZGluZyBidWZmZXIKKyAgICAgKgorICAgICAqIEBwYXJhbSBzdHJpbmcgJGJ1ZiBUaGUgZGF0YSB0byB3cml0ZQorICAgICAqIEB0aHJvd3MgVFRyYW5zcG9ydEV4Y2VwdGlvbiBpZiB3cml0aW5nIGZhaWxzCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHdyaXRlKCRidWYpCisgICAgeworICAgICAgICAkdGhpcy0+YnVmXyAuPSAkYnVmOworICAg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GV4dF87CisKKyAgICAgICAgJGJhc2VIdHRwT3B0aW9ucyA9IGlzc2V0KCRvcHRpb25zWyJodHRwIl0pID8gJG9wdGlvbnNbImh0dHAiXSA6IGFycmF5KCk7CisKKyAgICAgICAgJGh0dHBPcHRpb25zID0gJGJhc2VIdHRwT3B0aW9ucyArIGFycmF5KCdtZXRob2QnID0+ICdQT1NUJywKKyAgICAgICAgICAgICdoZWFkZXInID0+IGltcGxvZGUoIlxyXG4iLCAkaGVhZGVycyksCisgICAgICAgICAgICAnbWF4X3JlZGlyZWN0cycgPT4gMSwKKyAgICAgICAgICAgICdjb250ZW50JyA9PiAkdGhpcy0+YnVmXyk7CisgICAgICAgIGlmICgkdGhpcy0+dGltZW91dF8gPiAwKSB7CisgICAgICAgICAgICAkaHR0cE9wdGlvbnNbJ3RpbWVvdXQnXSA9ICR0aGlzLT50aW1lb3V0XzsKKyAgICAgICAgfQorICAgICAgICAkdGhpcy0+YnVmXyA9ICcnOworCisgICAgICAgICRvcHRpb25zWyJodHRwIl0gPSAkaHR0cE9wdGlvbnM7CisgICAgICAgICRjb250ZXh0aWQgPSBzdHJlYW1fY29udGV4dF9jcmVhdGUoJG9wdGlvbnMpOworICAgICAgICAkdGhpcy0+aGFuZGxlXyA9IEBmb3BlbigKKyAgICAgICAgICAgICR0aGlzLT5zY2hlbWVfIC4gJzovLycgLiAkaG9zdCAuICR0aGlzLT51cmlfLAorICAgICAgICAgICAgJ3InLAorICAgICAgICAgICAgZmFsc2UsCisgICAgICAgICAgICAkY29udGV4dGlkCisgICAgICAgICk7CisKKyAgICAgICAgLy8gQ29ubmVjdCBmYWlsZWQ/CisgICAgICAgIGlmICgkdGhpcy0+aGFuZGxlXyA9PT0gZmFsc2UpIHsKKyAgICAgICAgICAgICR0aGlzLT5oYW5kbGVfID0gbnVsbDsKKyAgICAgICAgICAgICRlcnJvciA9ICdUSHR0cENsaWVudDogQ291bGQgbm90IGNvbm5lY3QgdG8gJyAuICRob3N0IC4gJHRoaXM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ERV9XOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBvcGVuKCkKKyAgICB7CisgICAgICAgIGlmICgkdGhpcy0+cmVhZF8pIHsKKyAgICAgICAgICAgICR0aGlzLT5pblN0cmVhbV8gPSBAZm9wZW4oc2VsZjo6aW5TdHJlYW1OYW1lKCksICdyJyk7CisgICAgICAgICAgICBpZiAoIWlzX3Jlc291cmNlKCR0aGlzLT5pblN0cmVhbV8pKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRFeGNlcHRpb24oJ1RQaHBTdHJlYW06IENvdWxkIG5vdCBvcGVuIHBocDovL2lucHV0Jyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKCR0aGlzLT53cml0ZV8pIHsKKyAgICAgICAgICAgICR0aGlzLT5vdXRTdHJlYW1fID0gQGZvcGVuKCdwaHA6Ly9vdXRwdXQnLCAndycpOworICAgICAgICAgICAgaWYgKCFpc19yZXNvdXJjZSgkdGhpcy0+b3V0U3RyZWFtXykpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbignVFBocFN0cmVhbTogQ291bGQgbm90IG9wZW4gcGhwOi8vb3V0cHV0Jyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gY2xvc2UoKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT5yZWFkXykgeworICAgICAgICAgICAgQGZjbG9zZSgkdGhpcy0+aW5TdHJlYW1fKTsKKyAgICAgICAgICAgICR0aGlzLT5pblN0cmVhbV8gPSBudWxsOworICAgICAgICB9CisgICAgICAgIGlmICgkdGhpcy0+d3JpdGVfKSB7CisgICAgICAgICAgICBAZmNsb3NlKCR0aGlzLT5vdXRTdHJlYW1fKTsKKyAgICAgICAgICAgICR0aGlzLT5vdXRTdHJlYW1fID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBpc09wZW4oKQorICAgIHsKKyAgICAgICAgcmV0dXJuCisgICAgICAgICAgICAoISR0aGlzLT5yZWFkXyB8fCBpc19yZXNvdXJjZSgkdGhpcy0+aW5TdHJlYW1fKSkgJiYKKyAgICAgICAgICAgICghJHRoaXMtPndyaXRlXyB8fCBpc19yZXNvdXJjZSgkdGhpcy0+b3V0U3RyZWFtXykpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiByZWFkKCRsZW4pCisgICAgeworICAgICAgICAkZGF0YSA9IEBmcmVhZCgkdGhpcy0+aW5TdHJlYW1fLCAkbGVuKTsKKyAgICAgICAgaWYgKCRkYXRhID09PSBmYWxzZSB8fCAkZGF0YSA9PT0gJycpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBURXhjZXB0aW9uKCdUUGhwU3RyZWFtOiBDb3VsZCBub3QgcmVhZCAnIC4gJGxlbiAuICcgYnl0ZXMnKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAkZGF0YTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGUoJGJ1ZikKKyAgICB7CisgICAgICAgIHdoaWxlIChUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJGJ1ZikgPiAwKSB7CisgICAgICAgICAgICAkZ290ID0gQGZ3cml0ZSgkdGhpcy0+b3V0U3RyZWFtXywgJGJ1Zik7CisgICAgICAgICAgICBpZiAoJGdvdCA9PT0gMCB8fCAkZ290ID09PSBmYWxzZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBURXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAnVFBocFN0cmVhbTogQ291bGQgbm90IHdyaXRlICcgLiBUU3RyaW5nRnVuY0ZhY3Rvcnk6OmNyZWF0ZSgpLT5zdHJsZW4oJGJ1ZikgLiAnIGJ5dGVzJworICAgICAgICAgICAgICAgICk7CisgICAgICAgICAgICB9CisgICAgICAgICA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RFeGNlcHRpb246Ok5PVF9PUEVOKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgkdGhpcy0+cG9ydF8gPD0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ0Nhbm5vdCBvcGVuIHdpdGhvdXQgcG9ydCcsIFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOKTsKKyAgICAgICAgfQorCisgICAgICAgICR0aGlzLT5oYW5kbGVfID0gQHN0cmVhbV9zb2NrZXRfY2xpZW50KAorICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfLAorICAgICAgICAgICAgJGVycm5vLAorICAgICAgICAgICAgJGVycnN0ciwKKyAgICAgICAgICAgICR0aGlzLT5zZW5kVGltZW91dFNlY18gKyAoJHRoaXMtPnNlbmRUaW1lb3V0VXNlY18gLyAxMDAwMDAwKSwKKyAgICAgICAgICAgIFNUUkVBTV9DTElFTlRfQ09OTkVDVCwKKyAgICAgICAgICAgICR0aGlzLT5jb250ZXh0XworICAgICAgICApOworCisgICAgICAgIC8vIENvbm5lY3QgZmFpbGVkPworICAgICAgICBpZiAoJHRoaXMtPmhhbmRsZV8gPT09IGZhbHNlKSB7CisgICAgICAgICAgICAkZXJyb3IgPSAnVFNvY2tldDogQ291bGQgbm90IGNvbm5lY3QgdG8gJyAuCisgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfIC4gJyAoJyAuICRlcnJzdHIgLiAnIFsnIC4gJGVycm5vIC4gJ10pJzsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+ZGVidWdfKSB7CisgICAgICAgICAgICAgICAgY2FsbF91c2VyX2Z1bmMoJHRoaXMtPmRlYnVnSGFuZGxlcl8sICRlcnJvcik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigkZXJyb3IpOworICAgIC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gcHJvdGVjdGVkICRwb3J0XyA9ICc5MDkwJzsKKworICAgIC8qKgorICAgICAqIFNlbmQgdGltZW91dCBpbiBzZWNvbmRzLgorICAgICAqCisgICAgICogQ29tYmluZWQgd2l0aCBzZW5kVGltZW91dFVzZWMgdGhpcyBpcyB1c2VkIGZvciBzZW5kIHRpbWVvdXRzLgorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJHNlbmRUaW1lb3V0U2VjXyA9IDA7CisKKyAgICAvKioKKyAgICAgKiBTZW5kIHRpbWVvdXQgaW4gbWljcm9zZWNvbmRzLgorICAgICAqCisgICAgICogQ29tYmluZWQgd2l0aCBzZW5kVGltZW91dFNlYyB0aGlzIGlzIHVzZWQgZm9yIHNlbmQgdGltZW91dHMuCisgICAgICoKKyAgICAgKiBAdmFyIGludAorICAgICAqLworICAgIHByb3RlY3RlZCAkc2VuZFRpbWVvdXRVc2VjXyA9IDEwMDAwMDsKKworICAgIC8qKgorICAgICAqIFJlY3YgdGltZW91dCBpbiBzZWNvbmRzCisgICAgICoKKyAgICAgKiBDb21iaW5lZCB3aXRoIHJlY3ZUaW1lb3V0VXNlYyB0aGlzIGlzIHVzZWQgZm9yIHJlY3YgdGltZW91dHMuCisgICAgICoKKyAgICAgKiBAdmFyIGludAorICAgICAqLworICAgIHByb3RlY3RlZCAkcmVjdlRpbWVvdXRTZWNfID0gMDsKKworICAgIC8qKgorICAgICAqIFJlY3YgdGltZW91dCBpbiBtaWNyb3NlY29uZHMKKyAgICAgKgorICAgICAqIENvbWJpbmVkIHdpdGggcmVjdlRpbWVvdXRTZWMgdGhpcyBpcyB1c2VkIGZvciByZWN2IHRpbWVvdXRzLgorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgJHJlY3ZUaW1lb3V0VXNlY18gPSA3NTAwMDA7CisKKyAgICAvKioKKyAgICAgKiBQZXJzaXN0ZW50IHNvY2tldCBvciBwbGFpbj8KKyAgICAgKgorICAgICAqIEB2YXIgYm9vbAorICAgICAqLworICAgIHByb3RlY3RlZCAkcGVyc2lzdF8gPSBmYWxzZTsKKworICAgIC8qKgorICAgICAqIERlYnVnZ2luZyBvbj8KKyAgICAgKgorICAgICAqIEB2YXIgYm9vbAorICAgICAqLworICAgIHByb3RlY3RlZCAkZGVidWdfID0gZmFsc2U7CisKKyAgICAvKioKKyAgICAgKiBEZWJ1ZyBoYW5kbGVyCisgICAgICoKKyAgICAgKiBAdmFyIG1peGVkCisgICAgICovCisgICAgcHJvdGVjdGVkICRkZWJ1Z0hhbmRsZXJfID0gbnVsbDsKKworICAgIC8qKgorICAgICAqIFNvY2tldCBjb25zdHJ1Y3RvcgorICAgICAqCisgICAgICogQHBhcmFtIHN0cmluZyAkaG9zdCBSZW1vdGUgaG9zdG5hbWUKKyAgICAgKiBAcGFyYW0gaW50ICRwb3J0IFJlbW90ZSBwb3J0CisgICAgICogQHBhcmFtIGJvb2wgJHBlcnNpc3QgV2hldGhlciB0byB1c2UgYSBwZXJzaXN0ZW50IHNvY2tldAorICAgICAqIEBwYXJhbSBzdHJpbmcgJGRlYnVnSGFuZGxlciBGdW5jdGlvbiB0byBjYWxsIGZvciBlcnJvciBsb2dnaW5nCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KAorICAgICAgICAkaG9zdCA9ICdsb2NhbGhvc3QnLAorICAgICAgICAkcG9ydCA9IDkwOTAsCisgICAgICAgICRwZXJzaXN0ID0gZmFsc2UsCisgICAgICAgICRkZWJ1Z0hhbmRsZXIgPSBudWxsCisgICAgKSB7CisgICAgICAgICR0aGlzLT5ob3N0XyA9ICRob3N0OworICAgICAgICAkdGhpcy0+cG9ydF8gPSAkcG9ydDsKKyAgICAgICAgJHRoaXMtPnBlcnNpc3RfID0gJHBlcnNpc3Q7CisgICAgICAgICR0aGlzLT5kZWJ1Z0hhbmRsZXJfID0gJGRlYnVnSGFuZGxlciA/ICRkZWJ1Z0hhbmRsZXIgOiAnZXJyb3JfbG9nJzsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcGFyYW0gcmVzb3VyY2UgJGhhbmRsZQorICAgICAqIEByZXR1cm4gdm9pZAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRIYW5kbGUoJGhhbmRsZSkKKyAgICB7CisgICAgICAgICR0aGlzLT5oYW5kbGVfID0gJGhhbmRsZTsKKyAgICAgICAgc3RyZWFtX3NldF9ibG9ja2luZygkdGhpcy0+aGFuZGxlXywgZmFsc2UpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIHNlbmQgdGltZW91dC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBpbnQgJHRpbWVvdXQgVGltZW91dCBpbiBtaWxsaXNlY29uZHMuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHNldFNlbmRUaW1lb3V0KCR0aW1lb3V0KQorICAgIHsKKyAgICAgICAgJHRoaXMtPnNlbmRUaW1lb3V0U2VjXyA9IGZsb29yKCR0aW1lb3V0IC8gMTAwMCk7CisgICAgICAgICR0aGlzLT5zZW5kVGltZW91dFVzZWNfID0KKyAgICAgICAgICAgICgkdGltZW91dCAtICgkdGhpcy0+c2VuZFRpbWVvdXRTZWNfICogMTAwMCkpICogMTAwMDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSByZWNlaXZlIHRpbWVvdXQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gaW50ICR0aW1lb3V0IFRpbWVvdXQgaW4gbWlsbGlzZWNvbmRzLgorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRSZWN2VGltZW91dCgkdGltZW91dCkKKyAgICB7CisgICAgICAgICR0aGlzLT5yZWN2VGltZW91dFNlY18gPSBmbG9vcigkdGltZW91dCAvIDEwMDApOworICAgICAgICAkdGhpcy0+cmVjdlRpbWVvdXRVc2VjXyA9CisgICAgICAgICAgICAoJHRpbWVvdXQgLSAoJHRoaXMtPnJlY3ZUaW1lb3V0U2VjXyAqIDEwMDApKSAqIDEwMDA7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyBkZWJ1Z2dpbmcgb3V0cHV0IG9uIG9yIG9mZgorICAgICAqCisgICAgICogQHBhcmFtIGJvb2wgJGRlYnVnCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHNldERlYnVnKCRkZWJ1ZykKKyAgICB7CisgICAgICAgICR0aGlzLT5kZWJ1Z18gPSAkZGVidWc7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHRoZSBob3N0IHRoYXQgdGhpcyBzb2NrZXQgaXMgY29ubmVjdGVkIHRvCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHN0cmluZyBob3N0CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGdldEhvc3QoKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT5ob3N0XzsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHZXQgdGhlIHJlbW90ZSBwb3J0IHRoYXQgdGhpcyBzb2NrZXQgaXMgY29ubmVjdGVkIHRvCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGludCBwb3J0CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGdldFBvcnQoKQorICAgIHsKKyAgICAgICAgcmV0dXJuICR0aGlzLT5wb3J0XzsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUZXN0cyB3aGV0aGVyIHRoaXMgaXMgb3BlbgorICAgICAqCisgICAgICogQHJldHVybiBib29sIHRydWUgaWYgdGhlIHNvY2tldCBpcyBvcGVuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGlzT3BlbigpCisgICAgeworICAgICAgICByZXR1cm4gaXNfcmVzb3VyY2UoJHRoaXMtPmhhbmRsZV8pOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbm5lY3RzIHRoZSBzb2NrZXQuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIG9wZW4oKQorICAgIHsKKyAgICAgICAgaWYgKCR0aGlzLT5pc09wZW4oKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ1NvY2tldCBhbHJlYWR5IGNvbm5lY3RlZCcsIFRUcmFuc3BvcnRFeGNlcHRpb246OkFMUkVBRFlfT1BFTik7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZW1wdHkoJHRoaXMtPmhvc3RfKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ0Nhbm5vdCBvcGVuIG51bGwgaG9zdCcsIFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgkdGhpcy0+cG9ydF8gPD0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ0Nhbm5vdCBvcGVuIHdpdGhvdXQgcG9ydCcsIFRUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICgkdGhpcy0+cGVyc2lzdF8pIHsKKyAgICAgICAgICAgICR0aGlzLT5oYW5kbGVfID0gQHBmc29ja29wZW4oCisgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfLAorICAgICAgICAgICAgICAgICR0aGlzLT5wb3J0XywKKyAgICAgICAgICAgICAgICAkZXJybm8sCisgICAgICAgICAgICAgICAgJGVycnN0ciwKKyAgICAgICAgICAgICAgICAkdGhpcy0+c2VuZFRpbWVvdXRTZWNfICsgKCR0aGlzLT5zZW5kVGltZW91dFVzZWNfIC8gMTAwMDAwMCkKKyAgICAgICAgICAgICk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAkdGhpcy0+aGFuZGxlXyA9IEBmc29ja29wZW4oCisgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfLAorICAgICAgICAgICAgICAgICR0aGlzLT5wb3J0XywKKyAgICAgICAgICAgICAgICAkZXJybm8sCisgICAgICAgICAgICAgICAgJGVycnN0ciwKKyAgICAgICAgICAgICAgICAkdGhpcy0+c2VuZFRpbWVvdXRTZWNfICsgKCR0aGlzLT5zZW5kVGltZW91dFVzZWNfIC8gMTAwMDAwMCkKKyAgICAgICAgICAgICk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDb25uZWN0IGZhaWxlZD8KKyAgICAgICAgaWYgKCR0aGlzLT5oYW5kbGVfID09PSBmYWxzZSkgeworICAgICAgICAgICAgJGVycm9yID0gJ1RTb2NrZXQ6IENvdWxkIG5vdCBjb25uZWN0IHRvICcgLgorICAgICAgICAgICAgICAgICR0aGlzLT5ob3N0XyAuICc6JyAuICR0aGlzLT5wb3J0XyAuICcgKCcgLiAkZXJyc3RyIC4gJyBbJyAuICRlcnJubyAuICddKSc7CisgICAgICAgICAgICBpZiAoJHRoaXMtPmRlYnVnXykgeworICAgICAgICAgICAgICAgIGNhbGxfdXNlcl9mdW5jKCR0aGlzLT5kZWJ1Z0hhbmRsZXJfLCAkZXJyb3IpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGhyb3cgbmV3IFRFeGNlcHRpb24oJGVycm9yKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChmdW5jdGlvbl9leGlzdHMoJ3NvY2tldF9pbXBvcnRfc3RyZWFtJykgJiYgZnVuY3Rpb25fZXhpc3RzKCdzb2NrZXRfc2V0X29wdGlvbicpKSB7CisgICAgICAgICAgICAkc29ja2V0ID0gc29ja2V0X2ltcG9ydF9zdHJlYW0oJHRoaXMtPmhhbmRsZV8pOworICAgICAgICAgICAgc29ja2V0X3NldF9vcHRpb24oJHNvY2tldCwgU09MX1RDUCwgVENQX05PREVMQVksIDEpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2xvc2VzIHRoZSBzb2NrZXQuCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIGNsb3NlKCkKKyAgICB7CisgICAgICAgIEBmY2xvc2UoJHRoaXMtPmhhbmRsZV8pOworICAgICAgICAkdGhpcy0+aGFuZGxlXyA9IG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZCBmcm9tIHRoZSBzb2NrZXQgYXQgbW9zdCAkbGVuIGJ5dGVzLgorICAgICAqCisgICAgICogVGhpcyBtZXRob2Qgd2lsbCBub3Qgd2FpdCBmb3IgYWxsIHRoZSByZXF1ZXN0ZWQgZGF0YSwgaXQgd2lsbCByZXR1cm4gYXMKKyAgICAgKiBzb29uIGFzIGFueSBkYXRhIGlzIHJlY2VpdmVkLgorICAgICAqCisgICAgICogQHBhcmFtIGludCAkbGVuIE1heGltdW0gbnVtYmVyIG9mIGJ5dGVzIHRvIHJlYWQuCisgICAgICogQHJldHVybiBzdHJpbmcgQmluYXJ5IGRhdGEKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gcmVhZCgkbGVuKQorICAgIHsKKyAgICAgICAgJG51bGwgPSBudWxsOworICAgICAgICAkcmVhZCA9IGFycmF5KCR0aGlzLT5oYW5kbGVfKTsKKyAgICAgICAgJHJlYWRhYmxlID0gQHN0cmVhbV9zZWxlY3QoCisgICAgICAgICAgICAkcmVhZCwKKyAgICAgICAgICAgICRudWxsLAorICAgICAgICAgICAgJG51bGwsCisgICAgICAgICAgICAkdGhpcy0+cmVjdlRpbWVvdXRTZWNfLAorICAgICAgICAgICAgJHRoaXMtPnJlY3ZUaW1lb3V0VXNlY18KKyAgICAgICAgKTsKKworICAgICAgICBpZiAoJHJlYWRhYmxlID4gMCkgeworICAgICAgICAgICAgJGRhdGEgPSBmcmVhZCgkdGhpcy0+aGFuZGxlXywgJGxlbik7CisgICAgICAgICAgICBpZiAoJGRhdGEgPT09IGZhbHNlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ1RTb2NrZXQ6IENvdWxkIG5vdCByZWFkICcgLiAkbGVuIC4gJyBieXRlcyBmcm9tICcgLgorICAgICAgICAgICAgICAgICAgICAkdGhpcy0+aG9zdF8gLiAnOicgLiAkdGhpcy0+cG9ydF8pOworICAgICAgICAgICAgfSBlbHNlaWYgKCRkYXRhID09ICcnICYmIGZlb2YoJHRoaXMtPmhhbmRsZV8pKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ1RTb2NrZXQgcmVhZCAwIGJ5dGVzJyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiAkZGF0YTsKKyAgICAgICAgfSBlbHNlaWYgKCRyZWFkYWJsZSA9PT0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oJ1RTb2NrZXQ6IHRpbWVkIG91dCByZWFkaW5nICcgLiAkbGVuIC4gJyBieXRlcyBmcm9tICcgLgorICAgICAgICAgICAgICAgICR0aGlzLT5ob3N0XyAuICc6JyAuICR0aGlzLT5wb3J0Xyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbignVFNvY2tldDogQ291bGQgbm90IHJlYWQgJyAuICRsZW4gLiAnIGJ5dGVzIGZyb20gJyAuCisgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFdyaXRlIHRvIHRoZSBzb2NrZXQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gc3RyaW5nICRidWYgVGhlIGRhdGEgdG8gd3JpdGUKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gd3JpdGUoJGJ1ZikKKyAgICB7CisgICAgICAgICRudWxsID0gbnVsbDsKKyAgICAgICAgJHdyaXRlID0gYXJyYXkoJHRoaXMtPmhhbmRsZV8pOworCisgICAgICAgIC8vIGtlZXAgd3JpdGluZyB1bnRpbCBhbGwgdGhlIGRhdGEgaGFzIGJlZW4gd3JpdHRlbgorICAgICAgICB3aGlsZSAoVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCRidWYpID4gMCkgeworICAgICAgICAgICAgLy8gd2FpdCBmb3Igc3RyZWFtIHRvIGJlY29tZSBhdmFpbGFibGUgZm9yIHdyaXRpbmcKKyAgICAgICAgICAgICR3cml0YWJsZSA9IEBzdHJlYW1fc2VsZWN0KAorICAgICAgICAgICAgICAgICRudWxsLAorICAgICAgICAgICAgICAgICR3cml0ZSwKKyAgICAgICAgICAgICAgICAkbnVsbCwKKyAgICAgICAgICAgICAgICAkdGhpcy0+c2VuZFRpbWVvdXRTZWNfLAorICAgICAgICAgICAgICAgICR0aGlzLT5zZW5kVGltZW91dFVzZWNfCisgICAgICAgICAgICApOworICAgICAgICAgICAgaWYgKCR3cml0YWJsZSA+IDApIHsKKyAgICAgICAgICAgICAgICAvLyB3cml0ZSBidWZmZXIgdG8gc3RyZWFtCisgICAgICAgICAgICAgICAgJHdyaXR0ZW4gPSBmd3JpdGUoJHRoaXMtPmhhbmRsZV8sICRidWYpOworICAgICAgICAgICAgICAgIGlmICgkd3JpdHRlbiA9PT0gLTEgfHwgJHdyaXR0ZW4gPT09IGZhbHNlKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUVHJhbnNwb3J0RXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgJ1RTb2NrZXQ6IENvdWxkIG5vdCB3cml0ZSAnIC4gVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCRidWYpIC4gJyBieXRlcyAnIC4KKyAgICAgICAgICAgICAgICAgICAgICAgICR0aGlzLT5ob3N0XyAuICc6JyAuICR0aGlzLT5wb3J0XworICAgICAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyBkZXRlcm1pbmUgaG93IG11Y2ggb2YgdGhlIGJ1ZmZlciBpcyBsZWZ0IHRvIHdyaXRlCisgICAgICAgICAgICAgICAgJGJ1ZiA9IFRTdHJpbmdGdW5jRmFjdG9yeTo6Y3JlYXRlKCktPnN1YnN0cigkYnVmLCAkd3JpdHRlbik7CisgICAgICAgICAgICB9IGVsc2VpZiAoJHdyaXRhYmxlID09PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFRUcmFuc3BvcnRFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICdUU29ja2V0OiB0aW1lZCBvdXQgd3JpdGluZyAnIC4gVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCRidWYpIC4gJyBieXRlcyBmcm9tICcgLgorICAgICAgICAgICAgICAgICAgICAkdGhpcy0+aG9zdF8gLiAnOicgLiAkdGhpcy0+cG9ydF8KKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgJ1RTb2NrZXQ6IENvdWxkIG5vdCB3cml0ZSAnIC4gVFN0cmluZ0Z1bmNGYWN0b3J5OjpjcmVhdGUoKS0+c3RybGVuKCRidWYpIC4gJyBieXRlcyAnIC4KKyAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmhvc3RfIC4gJzonIC4gJHRoaXMtPnBvcnRfCisgICAgICAgICAgICAgICAgKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEZsdXNoIG91dHB1dCB0byB0aGUgc29ja2V0LgorICAgICAqCisgICAgICogU2luY2UgcmVhZCgpLCByZWFkQWxsKCkgYW5kIHdyaXRlKCkgb3BlcmF0ZSBvbiB0aGUgc29ja2V0cyBkaXJlY3RseSwKKy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NoJykpIHsKKyAgICBmdW5jdGlvbiBhcGNfZmV0Y2goJGtleSkKKyAgICB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBmdW5jdGlvbiBhcGNfc3RvcmUoJGtleSwgJHZhciwgJHR0bCA9IDApCisgICAgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorfQorCisvKioKKyAqIFNvY2tldHMgaW1wbGVtZW50YXRpb24gb2YgdGhlIFRUcmFuc3BvcnQgaW50ZXJmYWNlIHRoYXQgYWxsb3dzIGNvbm5lY3Rpb24KKyAqIHRvIGEgcG9vbCBvZiBzZXJ2ZXJzLgorICoKKyAqIEBwYWNrYWdlIHRocmlmdC50cmFuc3BvcnQKKyAqLworY2xhc3MgVFNvY2tldFBvb2wgZXh0ZW5kcyBUU29ja2V0Cit7CisgICAgLyoqCisgICAgICogUmVtb3RlIHNlcnZlcnMuIEFycmF5IG9mIGFzc29jaWF0aXZlIGFycmF5cyB3aXRoICdob3N0JyBhbmQgJ3BvcnQnIGtleXMKKyAgICAgKi8KKyAgICBwcml2YXRlICRzZXJ2ZXJzXyA9IGFycmF5KCk7CisKKyAgICAvKioKKyAgICAgKiBIb3cgbWFueSB0aW1lcyB0byByZXRyeSBlYWNoIGhvc3QgaW4gY29ubmVjdAorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcml2YXRlICRudW1SZXRyaWVzXyA9IDE7CisKKyAgICAvKioKKyAgICAgKiBSZXRyeSBpbnRlcnZhbCBpbiBzZWNvbmRzLCBob3cgbG9uZyB0byBub3QgdHJ5IGEgaG9zdCBpZiBpdCBoYXMgYmVlbgorICAgICAqIG1hcmtlZCBhcyBkb3duLgorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcml2YXRlICRyZXRyeUludGVydmFsXyA9IDYwOworCisgICAgLyoqCisgICAgICogTWF4IGNvbnNlY3V0aXZlIGZhaWx1cmVzIGJlZm9yZSBtYXJraW5nIGEgaG9zdCBkb3duLgorICAgICAqCisgICAgICogQHZhciBpbnQKKyAgICAgKi8KKyAgICBwcml2YXRlICRtYXhDb25zZWN1dGl2ZUZhaWx1cmVzXyA9IDE7CisKKyAgICAvKioKKyAgICAgKiBUcnkgaG9zdHMgaW4gb3JkZXI/IG9yIFJhbmRvbWl6ZWQ/CisgICAgICoKKyAgICAgKiBAdmFyIGJvb2wKKyAgICAgKi8KKyAgICBwcml2YXRlICRyYW5kb21pemVfID0gdHJ1ZTsKKworICAgIC8qKgorICAgICAqIEFsd2F5cyB0cnkgbGFzdCBob3N0LCBldmVuIGlmIG1hcmtlZCBkb3duPworICAgICAqCisgICAgICogQHZhciBib29sCisgICAgICovCisgICAgcHJpdmF0ZSAkYWx3YXlzVHJ5TGFzdF8gPSB0cnVlOworCisgICAgLyoqCisgICAgICogU29ja2V0IHBvb2wgY29uc3RydWN0b3IKKyAgICAgKgorICAgICAqIEBwYXJhbSBhcnJheSAkaG9zdHMgTGlzdCBvZiByZW1vdGUgaG9zdG5hbWVzCisgICAgICogQHBhcmFtIG1peGVkICRwb3J0cyBBcnJheSBvZiByZW1vdGUgcG9ydHMsIG9yIGEgc2luZ2xlIGNvbW1vbiBwb3J0CisgICAgICogQHBhcmFtIGJvb2wgJHBlcnNpc3QgV2hldGhlciB0byB1c2UgYSBwZXJzaXN0ZW50IHNvY2tldAorICAgICAqIEBwYXJhbSBtaXhlZCAkZGVidWdIYW5kbGVyIEZ1bmN0aW9uIGZvciBlcnJvciBsb2dnaW5nCisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KAorICAgICAgICAkaG9zdHMgPSBhcnJheSgnbG9jYWxob3N0JyksCisgICAgICAgICRwb3J0cyA9IGFycmF5KDkwOTApLAorICAgICAgICAkcGVyc2lzdCA9IGZhbHNlLAorICAgICAgICAkZGVidWdIYW5kbGVyID0gbnVsbAorICAgICkgeworICAgICAgICBwYXJlbnQ6Ol9fY29uc3RydWN0KG51bGwsIDAsICRwZXJzaXN0LCAkZGVidWdIYW5kbGVyKTsKKworICAgICAgICBpZiAoIWlzX2FycmF5KCRwb3J0cykpIHsKKyAgICAgICAgICAgICRwb3J0ID0gJHBvcnRzOworICAgICAgICAgICAgJHBvcnRzID0gYXJyYXkoKTsKKyAgICAgICAgICAgIGZvcmVhY2ggKCRob3N0cyBhcyAka2V5ID0+ICR2YWwpIHsKKyAgICAgICAgICAgICAgICAkcG9ydHNbJGtleV0gPSAkcG9ydDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZvcmVhY2ggKCRob3N0cyBhcyAka2V5ID0+ICRob3N0KSB7CisgICAgICAgICAgICAkdGhpcy0+c2VydmVyc18gW10gPSBhcnJheSgnaG9zdCcgPT4gJGhvc3QsCisgICAgICAgICAgICAgICAgJ3BvcnQnID0+ICRwb3J0c1ska2V5XSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBZGQgYSBzZXJ2ZXIgdG8gdGhlIHBvb2wKKyAgICAgKgorICAgICAqIFRoaXMgZnVuY3Rpb24gZG9lcyBub3QgcHJldmVudCB5b3UgZnJvbSBhZGRpbmcgYSBkdXBsaWNhdGUgc2VydmVyIGVudHJ5LgorICAgICAqCisgICAgICogQHBhcmFtIHN0cmluZyAkaG9zdCBob3N0bmFtZSBvciBJUAorICAgICAqIEBwYXJhbSBpbnQgJHBvcnQgcG9ydAorICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBhZGRTZXJ2ZXIoJGhvc3QsICRwb3J0KQorICAgIHsKKyAgICAgICAgJHRoaXMtPnNlcnZlcnNfW10gPSBhcnJheSgnaG9zdCcgPT4gJGhvc3QsICdwb3J0JyA9PiAkcG9ydCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyBob3cgbWFueSB0aW1lIHRvIGtlZXAgcmV0cnlpbmcgYSBob3N0IGluIHRoZSBjb25uZWN0IGZ1bmN0aW9uLgorICAgICAqCisgICAgICogQHBhcmFtIGludCAkbnVtUmV0cmllcworICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXROdW1SZXRyaWVzKCRudW1SZXRyaWVzKQorICAgIHsKKyAgICAgICAgJHRoaXMtPm51bVJldHJpZXNfID0gJG51bVJldHJpZXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyBob3cgbG9uZyB0byB3YWl0IHVudGlsIHJldHJ5aW5nIGEgaG9zdCBpZiBpdCB3YXMgbWFya2VkIGRvd24KKyAgICAgKgorICAgICAqIEBwYXJhbSBpbnQgJG51bVJldHJpZXMKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gc2V0UmV0cnlJbnRlcnZhbCgkcmV0cnlJbnRlcnZhbCkKKyAgICB7CisgICAgICAgICR0aGlzLT5yZXRyeUludGVydmFsXyA9ICRyZXRyeUludGVydmFsOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgaG93IG1hbnkgdGltZSB0byBrZWVwIHJldHJ5aW5nIGEgaG9zdCBiZWZvcmUgbWFya2luZyBpdCBhcyBkb3duLgorICAgICAqCisgICAgICogQHBhcmFtIGludCAkbnVtUmV0cmllcworICAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRNYXhDb25zZWN1dGl2ZUZhaWx1cmVzKCRtYXhDb25zZWN1dGl2ZUZhaWx1cmVzKQorICAgIHsKKyAgICAgICAgJHRoaXMtPm1heENvbnNlY3V0aXZlRmFpbHVyZXNfID0gJG1heENvbnNlY3V0aXZlRmFpbHVyZXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogVHVybnMgcmFuZG9taXphdGlvbiBpbiBjb25uZWN0IG9yZGVyIG9uIG9yIG9mZi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBib29sICRyYW5kb21pemUKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gc2V0UmFuZG9taXplKCRyYW5kb21pemUpCisgICAgeworICAgICAgICAkdGhpcy0+cmFuZG9taXplXyA9ICRyYW5kb21pemU7CisgICAgfQorCisgICAgLyoqCisgICAgICogV2hldGhlciB0byBhbHdheXMgdHJ5IHRoZSBsYXN0IHNlcnZlci4KKyAgICAgKgorICAgICAqIEBwYXJhbSBib29sICRhbHdheXNUcnlMYXN0CisgICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHNldEFsd2F5c1RyeUxhc3QoJGFsd2F5c1RyeUxhc3QpCisgICAgeworICAgICAgICAkdGhpcy0+YWx3YXlzVHJ5TGFzdF8gPSAkYWx3YXlzVHJ5TGFzdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb25uZWN0cyB0aGUgc29ja2V0IGJ5IGl0ZXJhdGluZyB0aHJvdWdoIGFsbCB0aGUgc2VydmVycyBpbiB0aGUgcG9vbAorICAgICAqIGFuZCB0cnlpbmcgdG8gZmluZCBvbmUgdGhhdCB3b3Jrcy4KKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gb3BlbigpCisgICAgeworICAgICAgICAvLyBDaGVjayBpZiB3ZSB3YW50IG9yZGVyIHJhbmRvbWl6YXRpb24KKyAgICAgICAgaWYgKCR0aGlzLT5yYW5kb21pemVfKSB7CisgICAgICAgICAgICBzaHVmZmxlKCR0aGlzLT5zZXJ2ZXJzXyk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDb3VudCBzZXJ2ZXJzIHRvIGlkZW50aWZ5IHRoZSAibGFzdCIgb25lCisgICAgICAgICRudW1TZXJ2ZXJzID0gY291bnQoJHRoaXMtPnNlcnZlcnNfKTsKKworICAgICAgICBmb3IgKCRpID0gMDsgJGkgPCAkbnVtU2VydmVyczsgKyskaSkgeworICAgICAgICAgICAgLy8gVGhpcyBleHRyYWN0cyB0aGUgJGhvc3QgYW5kICRwb3J0IHZhcmlhYmxlcworICAgICAgICAgICAgZXh0cmFjdCgkdGhpcy0+c2VydmVyc19bJGldKTsKKworICAgICAgICAgICAgLy8gQ2hlY2sgQVBDIGNhY2hlIGZvciBhIHJlY29yZCBvZiB0aGlzIHNlcnZlciBiZWluZyBkb3duCisgICAgICAgICAgICAkZmFpbHRpbWVLZXkgPSAndGhyaWZ0X2ZhaWx0aW1lOicgLiAkaG9zdCAuICc6JyAuICRwb3J0IC4gJ34nOworCisgICAgICAgICAgICAvLyBDYWNoZSBtaXNzPyBBc3N1bWUgaXQncyBPSworICAgICAgICAgICAgJGxhc3RGYWlsdGltZSA9IGFwY19mZXRjaCgkZmFpbHRpbWVLZXkpOworICAgICAgICAgICAgaWYgKCRsYXN0RmFpbHRpbWUgPT09IGZhbHNlKSB7CisgICAgICAgICAgICAgICAgJGxhc3RGYWlsdGltZSA9IDA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICRyZXRyeUludGVydmFsUGFzc2VkID0gZmFsc2U7CisKKyAgICAgICAgICAgIC8vIENhY2hlIGhpdC4uLm1ha2Ugc3VyZSBlbm91Z2ggdGhlIHJldHJ5IGludGVydmFsIGhhcyBlbGFwc2VkCisgICAgICAgICAgICBpZiAoJGxhc3RGYWlsdGltZSA+IDApIHsKKyAgICAgICAgICAgICAgICAkZWxhcHNlZCA9IHRpbWUoKSAtICRsYXN0RmFpbHRpbWU7CisgICAgICAgICAgICAgICAgaWYgKCRlbGFwc2VkID4gJHRoaXMtPnJldHJ5SW50ZXJ2YWxfKSB7CisgICAgICAgICAgICAgICAgICAgICRyZXRyeUludGVydmFsUGFzc2VkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCR0aGlzLT5kZWJ1Z18pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxfdXNlcl9mdW5jKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aGlzLT5kZWJ1Z0hhbmRsZXJfLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUU29ja2V0UG9vbDogcmV0cnlJbnRlcnZhbCAnIC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAnKCcgLiAkdGhpcy0+cmV0cnlJbnRlcnZhbF8gLiAnKSAnIC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGFzIHBhc3NlZCBmb3IgaG9zdCAnIC4gJGhvc3QgLiAnOicgLiAkcG9ydAorICAgICAgICAgICAgICAgICAgICAgICAgKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gT25seSBjb25uZWN0IGlmIG5vdCBpbiB0aGUgbWlkZGxlIG9mIGEgZmFpbCBpbnRlcnZhbCwgT1IgaWYgdGhpcworICAgICAgICAgICAgLy8gaXMgdGhlIExBU1Qgc2VydmVyIHdlIGFyZSB0cnlpbmcsIGp1c3QgaGFtbWVyIGF3YXkgb24gaXQKKyAgICAgICAgICAgICRpc0xhc3RTZXJ2ZXIgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmICgkdGhpcy0+YWx3YXlzVHJ5TGFzdF8pIHsKKyAgICAgICAgICAgICAgICAkaXNMYXN0U2VydmVyID0gKCRpID09ICgkbnVtU2VydmVycyAtIDEpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCgkbGFzdEZhaWx0aW1lID09PSAwKSB8fAorICAgICAgICAgICAgICAgICgkaXNMYXN0U2VydmVyKSB8fAorICAgICAgICAgICAgICAgICgkbGFzdEZhaWx0aW1lID4gMCAmJiAkcmV0cnlJbnRlcnZhbFBhc3NlZCkpIHsKKyAgICAgICAgICAgICAgICAvLyBTZXQgdW5kZXJseWluZyBUU29ja2V0IHBhcmFtcyB0byB0aGlzIG9uZQorICAgICAgICAgICAgICAgICR0aGlzLT5ob3N0XyA9ICRob3N0OworICAgICAgICAgICAgICAgICR0aGlzLT5wb3J0XyA9ICRwb3J0OworCisgICAgICAgICAgICAgICAgLy8gVHJ5IHVwIHRvIG51bVJldHJpZXNfIGNvbm5lY3Rpb25zIHBlciBzZXJ2ZXIKKyAgICAgICAgICAgICAgICBmb3IgKCRhdHRlbXB0ID0gMDsgJGF0dGVtcHQgPCAkdGhpcy0+bnVtUmV0cmllc187ICRhdHRlbXB0KyspIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFVzZSB0aGUgdW5kZXJseWluZyBUU29ja2V0IG9wZW4gZnVuY3Rpb24KKyAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudDo6b3BlbigpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBPbmx5IGNsZWFyIHRoZSBmYWlsdXJlIGNvdW50cyBpZiByZXF1aXJlZCB0byBkbyBzbworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRsYXN0RmFpbHRpbWUgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBjX3N0b3JlKCRmYWlsdGltZUtleSwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFN1Y2Nlc3NmdWwgY29ubmVjdGlvbiwgcmV0dXJuIG5vdworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChURXhjZXB0aW9uICR0eCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ29ubmVjdGlvbiBmYWlsZWQKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIE1hcmsgZmFpbHVyZSBvZiB0aGlzIGhvc3QgaW4gdGhlIGNhY2hlCisgICAgICAgICAgICAgICAgJGNvbnNlY2ZhaWxzS2V5ID0gJ3RocmlmdF9jb25zZWNmYWlsczonIC4gJGhvc3QgLiAnOicgLiAkcG9ydCAuICd+JzsKKworICAgICAgICAgICAgICAgIC8vIElnbm9yZSBjYWNoZSBtaXNzZXMKKyAgICAgICAgICAgICAgICAkY29uc2VjZmFpbHMgPSBhcGNfZmV0Y2goJGNvbnNlY2ZhaWxzS2V5KTsKKyAgICAgICAgICAgICAgICBpZiAoJGNvbnNlY2ZhaWxzID09PSBmYWxzZSkgeworICAgICAgICAgICAgICAgICAgICAkY29uc2VjZmFpbHMgPSAwOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIEluY3JlbWVudCBieSBvbmUKKyAgICAgICAgICAgICAgICAkY29uc2VjZmFpbHMrKzsKKworICAgICAgICAgICAgICAgIC8vIExvZyBhbmQgY2FjaGUgdGhpcyBmYWlsdXJlCisgICAgICAgICAgICAgICAgaWYgKCRjb25zZWNmYWlscyA+PSAkdGhpcy0+bWF4Q29uc2VjdXRpdmVGYWlsdXJlc18pIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCR0aGlzLT5kZWJ1Z18pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxfdXNlcl9mdW5jKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0aGlzLT5kZWJ1Z0hhbmRsZXJfLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUU29ja2V0UG9vbDogbWFya2luZyAnIC4gJGhvc3QgLiAnOicgLiAkcG9ydCAuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJyBhcyBkb3duIGZvciAnIC4gJHRoaXMtPnJldHJ5SW50ZXJ2YWxfIC4gJyBzZWNzICcgLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZnRlciAnIC4gJGNvbnNlY2ZhaWxzIC4gJyBmYWlsZWQgYXR0ZW1wdHMuJworICAgICAgICAgICAgICAgICAgICAgICAgKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBTdG9yZSB0aGUgZmFpbHVyZSB0aW1lCisgICAgICAgICAgICAgICAgICAgIGFwY19zdG9yZSgkZmFpbHRpbWVLZXksIHRpbWUoKSk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gQ2xlYXIgdGhlIGNvdW50IG9mIGNvbnNlY3V0aXZlIGZhaW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RoZQorICogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucworICogdW5kZXIgdGhlIExpY2Vuc2UuCisgKgorICogQHBhY2thZ2UgdGhyaWZ0LnRyYW5zcG9ydAorICovCisKK25hbWVzcGFjZSBUaHJpZnRcVHJhbnNwb3J0OworCit1c2UgVGhyaWZ0XEV4Y2VwdGlvblxUVHJhbnNwb3J0RXhjZXB0aW9uOwordXNlIFRocmlmdFxGYWN0b3J5XFRTdHJpbmdGdW5jRmFjdG9yeTsKKworLyoqCisgKiBCYXNlIGludGVyZmFjZSBmb3IgYSB0cmFuc3BvcnQgYWdlbnQuCisgKgorICogQHBhY2thZ2UgdGhyaWZ0LnRyYW5zcG9ydAorICovCithYnN0cmFjdCBjbGFzcyBUVHJhbnNwb3J0Cit7CisgICAgLyoqCisgICAgICogV2hldGhlciB0aGlzIHRyYW5zcG9ydCBpcyBvcGVuLgorICAgICAqCisgICAgICogQHJldHVybiBib29sZWFuIHRydWUgaWYgb3BlbgorICAgICAqLworICAgIGFic3RyYWN0IHB1YmxpYyBmdW5jdGlvbiBpc09wZW4oKTsKKworICAgIC8qKgorICAgICAqIE9wZW4gdGhlIHRyYW5zcG9ydCBmb3IgcmVhZGluZy93cml0aW5nCisgICAgICoKKyAgICAgKiBAdGhyb3dzIFRUcmFuc3BvcnRFeGNlcHRpb24gaWYgY2Fubm90IG9wZW4KKyAgICAgKi8KKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gb3BlbigpOworCisgICAgLyoqCisgICAgICogQ2xvc2UgdGhlIHRyYW5zcG9ydC4KKyAgICAgKi8KKyAgICBhYnN0cmFjdCBwdWJsaWMgZnVuY3Rpb24gY2xvc2UoKTsKKworICAgIC8qKgorICAgICAqIFJlYWQgc29tZSBkYXRhIGludG8gdGhlIGFycmF5LgorICAgICAqCisgICAgICogQHBhcmFtIGludCAkbGVuIEhvdyBtdWNoIHRv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X3N0cl9maW5kKGZpZWxkc3BlYywgImNsYXNzIiwgc2l6ZW9mKCJjbGFzcyIpLTEpOworICAgICAgaWYgKHZhbF9wdHIgPT0gbnVsbHB0cikgeworICAgICAgICB0aHJvd190cHJvdG9jb2xleGNlcHRpb24oIm5vIGNsYXNzIHR5cGUgaW4gc3BlYyIsIElOVkFMSURfREFUQSk7CisgICAgICAgIHNraXBfZWxlbWVudChUX1NUUlVDVCwgdHJhbnNwb3J0KTsKKyAgICAgICAgUkVUVVJOX05VTEwoKTsKKyAgICAgIH0KKworICAgICAgY2hhciogc3RydWN0VHlwZSA9IFpfU1RSVkFMX1AodmFsX3B0cik7CisgICAgICAvLyBDcmVhdGUgYW4gb2JqZWN0IGluIFBIUCB1c2VybGFuZCBiYXNlZCBvbiBvdXIgc3BlYworICAgICAgY3JlYXRlT2JqZWN0KHN0cnVjdFR5cGUsIHJldHVybl92YWx1ZSk7CisgICAgICBpZiAoWl9UWVBFX1AocmV0dXJuX3ZhbHVlKSA9PSBJU19OVUxMKSB7CisgICAgICAgIC8vIHVuYWJsZSB0byBjcmVhdGUgY2xhc3MgZW50cnkKKyAgICAgICAgc2tpcF9lbGVtZW50KFRfU1RSVUNULCB0cmFuc3BvcnQpOworICAgICAgICBSRVRVUk5fTlVMTCgpOworICAgICAgfQorCisgICAgICB6dmFsKiBzcGVjID0gemVuZF9yZWFkX3N0YXRpY19wcm9wZXJ0eShaX09CSkNFX1AocmV0dXJuX3ZhbHVlKSwgIl9UU1BFQyIsIHNpemVvZigiX1RTUEVDIiktMSwgZmFsc2UpOworICAgICAgWlZBTF9ERVJFRihzcGVjKTsKKyAgICAgIGlmIChFRyhleGNlcHRpb24pKSB7CisgICAgICAgIHplbmRfb2JqZWN0ICpleCA9IEVHKGV4Y2VwdGlvbik7CisgICAgICAgIEVHKGV4Y2VwdGlvbikgPSBudWxscHRyOworICAgICAgICB0aHJvdyBQSFBFeGNlcHRpb25XcmFwcGVyKGV4KTsKKyAgICAgIH0KKyAgICAgIGlmIChaX1RZUEVfUChzcGVjKSAhPSBJU19BUlJBWSkgeworICAgICAgICBjaGFyIGVycmJ1ZlsxMjhdOworICAgICAgICBzbnByaW50ZihlcnJidWYsIDEyOCwgInNwZWMgZm9yICVzIGlzIHdyb25nIHR5cGU6ICVkXG4iLCBzdHJ1Y3RUeXBlLCBaX1RZUEVfUChzcGVjKSk7CisgICAgICAgIHRocm93X3Rwcm90b2NvbGV4Y2VwdGlvbihlcnJidWYsIElOVkFMSURfREFUQSk7CisgICAgICAgIFJFVFVSTl9OVUxMKCk7CisgICAgICB9CisgICAgICBiaW5hcnlfZGVzZXJpYWxpemVfc3BlYyhyZXR1cm5fdmFsdWUsIHRyYW5zcG9ydCwgWl9BUlJWQUxfUChzcGVjKSk7CisgICAgICByZXR1cm47CisgICAgfSBicmVhazsKKyAgICBjYXNlIFRfQk9PTDogeworICAgICAgdWludDhfdCBjOworICAgICAgdHJhbnNwb3J0LnJlYWRCeXRlcygmYywgMSk7CisgICAgICBSRVRVUk5fQk9PTChjICE9IDApOworICAgIH0KKyAgLy9jYXNlIFRfSTA4OiAvLyBzYW1lIG51bWVyaWMgdmFsdWUgYXMgVF9CWVRFCisgICAgY2FzZSBUX0JZVEU6IHsKKyAgICAgIHVpbnQ4X3QgYzsKKyAgICAgIHRyYW5zcG9ydC5yZWFkQnl0ZXMoJmMsIDEpOworICAgICAgUkVUVVJOX0xPTkcoKGludDhfdCljKTsKKyAgICB9CisgICAgY2FzZSBUX0kxNjogeworICAgICAgdWludDE2X3QgYzsKKyAgICAgIHRyYW5zcG9ydC5yZWFkQnl0ZXMoJmMsIDIpOworICAgICAgUkVUVVJOX0xPTkcoKGludDE2X3QpbnRvaHMoYykpOworICAgIH0KKyAgICBjYXNlIFRfSTMyOiB7CisgICAgICB1aW50MzJfdCBjOworICAgICAgdHJhbnNwb3J0LnJlYWRCeXRlcygmYywgNCk7CisgICAgICBSRVRVUk5fTE9ORygoaW50MzJfdCludG9obChjKSk7CisgICAgfQorICAgIGNhc2UgVF9VNjQ6CisgICAgY2FzZSBUX0k2NDogeworICAgICAgdWludDY0X3QgYzsKKyAgICAgIHRyYW5zcG9ydC5yZWFkQnl0ZXMoJmMsIDgpOworICAgICAgUkVUVVJOX0xPTkcoKGludDY0X3QpbnRvaGxsKGMpKTsKKyAgICB9CisgICAgY2FzZSBUX0RPVUJMRTogeworICAgICAgdW5pb24geworICAgICAgICB1aW50NjRfdCBjOworICAgICAgICBkb3VibGUgZDsKKyAgICAgIH0gYTsKKyAgICAgIHRyYW5zcG9ydC5yZWFkQnl0ZXMoJihhLmMpLCA4KTsKKyAgICAgIGEuYyA9IG50b2hsbChhLmMpOworICAgICAgUkVUVVJOX0RPVUJMRShhLmQpOworICAgIH0KKyAgICAvL2Nhc2UgVF9VVEY3OiAvLyBhbGlhc2VzIFRfU1RSSU5HCisgICAgY2FzZSBUX1VURjg6CisgICAgY2FzZSBUX1VURjE2OgorICAgIGNhc2UgVF9TVFJJTkc6IHsKKyAgICAgIHVpbnQzMl90IHNpemUgPSB0cmFuc3BvcnQucmVhZFUzMigpOworICAgICAgaWYgKHNpemUpIHsKKyAgICAgICAgY2hhciBzdHJidWZbc2l6ZSsxXTsKKyAgICAgICAgdHJhbnNwb3J0LnJlYWRCeXRlcyhzdHJidWYsIHNpemUpOworICAgICAgICBzdHJidWZbc2l6ZV0gPSAnXDAnOworICAgICAgICBaVkFMX1NUUklOR0wocmV0dXJuX3ZhbHVlLCBzdHJidWYsIHNpemUpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgWlZBTF9FTVBUWV9TVFJJTkcocmV0dXJuX3ZhbHVlKTsKKyAgICAgIH0KKyAgICAgIHJldHVybjsKKyAgICB9CisgICAgY2FzZSBUX01BUDogeyAvLyBhcnJheSBvZiBrZXkgLT4gdmFsdWUKKyAgICAgIHVpbnQ4X3QgdHlwZXNbMl07CisgICAgICB0cmFuc3BvcnQucmVhZEJ5dGVzKHR5cGVzLCAyKTsKKyAgICAgIHVpbnQz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3N0cl9maW5kKGZpZWxkc3BlYywgImVsZW0iLCBzaXplb2YoImVsZW0iKS0xKTsKKyAgICAgIEhhc2hUYWJsZSogZWxlbXNwZWMgPSBaX0FSUlZBTF9QKHZhbF9wdHIpOworCisgICAgICBhcnJheV9pbml0KHJldHVybl92YWx1ZSk7CisKKyAgICAgIGZvciAodWludDMyX3QgcyA9IDA7IHMgPCBzaXplOyArK3MpIHsKKyAgICAgICAgenZhbCBrZXksIHZhbHVlOworICAgICAgICBaVkFMX1RSVUUoJnZhbHVlKTsKKworICAgICAgICBiaW5hcnlfZGVzZXJpYWxpemUodHlwZSwgdHJhbnNwb3J0LCAma2V5LCBlbGVtc3BlYyk7CisKKyAgICAgICAgaWYgKFpfVFlQRShrZXkpID09IElTX0xPTkcpIHsKKyAgICAgICAgICB6ZW5kX2hhc2hfaW5kZXhfdXBkYXRlKFpfQVJSX1AocmV0dXJuX3ZhbHVlKSwgWl9MVkFMKGtleSksICZ2YWx1ZSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgaWYgKFpfVFlQRShrZXkpICE9IElTX1NUUklORykgY29udmVydF90b19zdHJpbmcoJmtleSk7CisgICAgICAgICAgemVuZF9zeW10YWJsZV91cGRhdGUoWl9BUlJfUChyZXR1cm5fdmFsdWUpLCBaX1NUUihrZXkpLCAmdmFsdWUpOworICAgICAgICB9CisgICAgICAgIHp2YWxfZHRvcigma2V5KTsKKyAgICAgIH0KKyAgICAgIHJldHVybjsKKyAgICB9CisgIH07CisKKyAgY2hhciBlcnJidWZbMTI4XTsKKyAgc3ByaW50ZihlcnJidWYsICJVbmtub3duIHRocmlmdCB0eXBlSUQgJWQiLCB0aHJpZnRfdHlwZUlEKTsKKyAgdGhyb3dfdHByb3RvY29sZXhjZXB0aW9uKGVycmJ1ZiwgSU5WQUxJRF9EQVRBKTsKK30KKworc3RhdGljCit2b2lkIGJpbmFyeV9zZXJpYWxpemVfaGFzaHRhYmxlX2tleShpbnQ4X3Qga2V5dHlwZS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AoWl9UWVBFX1AodmFsdWUpICE9IElTX0xPTkcpIGNvbnZlcnRfdG9fbG9uZyh2YWx1ZSk7CisgICAgICB0cmFuc3BvcnQud3JpdGVJMTYoWl9MVkFMX1AodmFsdWUpKTsKKyAgICAgIHJldHVybjsKKyAgICBjYXNlIFRfSTMyOgorICAgICAgaWYgKFpfVFlQRV9QKHZhbHVlKSAhPSBJU19MT05HKSBjb252ZXJ0X3RvX2xvbmcodmFsdWUpOworICAgICAgdHJhbnNwb3J0LndyaXRlSTMyKFpfTFZBTF9QKHZhbHVlKSk7CisgICAgICByZXR1cm47CisgICAgY2FzZSBUX0k2NDoKKyAgICBjYXNlIFRfVTY0OiB7CisgICAgICBpbnQ2NF90IGxfZGF0YTsKKyNpZiBkZWZpbmVkKF9MUDY0KSB8fCBkZWZpbmVkKF9XSU42NCkKKyAgICAgIGlmIChaX1RZUEVfUCh2YWx1ZSkgIT0gSVNfTE9ORykgY29udmVydF90b19sb25nKHZhbHVlKTsKKyAgICAgIGxfZGF0YSA9IFpfTFZBTF9QKHZhbHVlKTsKKyNlbHNlCisgICAgICBpZiAoWl9UWVBFX1AodmFsdWUpICE9IElTX0RPVUJMRSkgY29udmVydF90b19kb3VibGUodmFsdWUpOworICAgICAgbF9kYXRhID0gKGludDY0X3QpWl9EVkFMX1AodmFsdWUpOworI2VuZGlmCisgICAgICB0cmFuc3BvcnQud3JpdGVJNjQobF9kYXRhKTsKKyAgICB9IHJldHVybjsKKyAgICBjYXNlIFRfRE9VQkxFOiB7CisgICAgICB1bmlvbiB7CisgICAgICAgIGludDY0X3QgYzsKKyAgICAgICAgZG91YmxlIGQ7CisgICAgICB9IGE7CisgICAgICBpZiAoWl9UWVBFX1AodmFsdWUpICE9IElTX0RPVUJMRSkgY29udmVydF90b19kb3VibGUodmFsdWUpOworICAgICAgYS5kID0gWl9EVkFMX1AodmFsdWUpOworICAgICAgdHJhbnNwb3J0LndyaXRlSTY0KGEuYyk7CisgICAgfSByZXR1cm47CisgICAgY2FzZSBUX1VURjg6CisgICAgY2FzZSBUX1VURjE2OgorICAgIGNhc2UgVF9TVFJJTkc6CisgICAgICBpZiAoWl9UWVBFX1AodmFsdWUpICE9IElTX1NUUklORykgY29udmVydF90b19zdHJpbmcodmFsdWUpOworICAgICAgdHJhbnNwb3J0LndyaXRlU3RyaW5nKFpfU1RSVkFMX1AodmFsdWUpLCBaX1NUUkxFTl9QKHZhbHVlKSk7CisgICAgICByZXR1cm47CisgICAgY2FzZSBUX01BUDogeworICAgICAgaWYgKFpfVFlQRV9QKHZhbHVlKSAhPSBJU19BUlJBWSkgY29udmVydF90b19hcnJheSh2YWx1ZSk7CisgICAgICBpZiAoWl9UWVBFX1AodmFsdWUpICE9IElTX0FSUkFZKSB7CisgICAgICAgIHRocm93X3Rwcm90b2NvbGV4Y2VwdGlvbigiQXR0ZW1wdCB0byBzZW5kIGFuIGluY29tcGF0aWJsZSB0eXBlIGFzIGFuIGFycmF5IChUX01BUCkiLCBJTlZBTElEX0RBVEEpOworICAgICAgfQorICAgICAgSGFzaFRhYmxlKiBodCA9IFpfQVJSVkFMX1AodmFsdWUpOworICAgICAgenZhbCogdmFsX3B0cjsKKworICAgICAgdmFsX3B0ciA9IHplbmRfaGFzaF9zdHJfZmluZChmaWVsZHNwZWMsICJrdHlwZSIsIHNpemVvZigia3R5cGUiKS0xKTsKKyAgICAgIGlmIChaX1RZUEVfUCh2YWxfcHRyKSAhPSBJU19MT05HKSBjb252ZXJ0X3RvX2xvbmcodmFsX3B0cik7CisgICAgICB1aW50OF90IGtleXR5cGUgPSBaX0xWQUxfUCh2YWxfcHRyKTsKKyAgICAgIHRyYW5zcG9ydC53cml0ZUk4KGtleXR5cGUpOworICAgICAgdmFsX3B0ciA9IHplbmRfaGFzaF9zdHJfZmluZChmaWVsZHNwZWMsICJ2dHlwZSIsIHNpemVvZigidnR5cGUiKS0xKTsKKyAgICAgIGlmIChaX1RZUEVfUCh2YWxfcHRyKSAhPSBJU19MT05HKSBjb252ZXJ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ICAgICAgICAgIHplbmRfaGFzaF9tb3ZlX2ZvcndhcmRfZXgoaHQsICZrZXlfcHRyKSkgeworICAgICAgICBiaW5hcnlfc2VyaWFsaXplKHZhbHR5cGUsIHRyYW5zcG9ydCwgdmFsX3B0ciwgdmFsc3BlYyk7CisgICAgICB9CisgICAgfSByZXR1cm47CisgICAgY2FzZSBUX1NFVDogeworICAgICAgaWYgKFpfVFlQRV9QKHZhbHVlKSAhPSBJU19BUlJBWSkgY29udmVydF90b19hcnJheSh2YWx1ZSk7CisgICAgICBpZiAoWl9UWVBFX1AodmFsdWUpICE9IElTX0FSUkFZKSB7CisgICAgICAgIHRocm93X3Rwcm90b2NvbGV4Y2VwdGlvbigiQXR0ZW1wdCB0byBzZW5kIGFuIGluY29tcGF0aWJsZSB0eXBlIGFzIGFuIGFycmF5IChUX1NFVCkiLCBJTlZBTElEX0RBVEEpOworICAgICAgfQorICAgICAgSGFzaFRhYmxlKiBodCA9IFpfQVJSVkFMX1AodmFsdWUpOworICAgICAgenZhbCogdmFsX3B0cjsKKworICAgICAgdmFsX3B0ciA9IHplbmRfaGFzaF9zdHJfZmluZChmaWVsZHNwZWMsICJldHlwZSIsIHNpemVvZigiZXR5cGUiKS0xKTsKKyAgICAgIEhhc2hUYWJsZSogc3BlYyA9IFpfQVJSVkFMX1AoemVuZF9oYXNoX3N0cl9maW5kKGZpZWxkc3BlYywgImVsZW0iLCBzaXplb2YoImVsZW0iKS0xKSk7CisgICAgICBpZiAoWl9UWVBFX1AodmFsX3B0cikgIT0gSVNfTE9ORykgY29udmVydF90b19sb25nKHZhbF9wdHIpOworICAgICAgdWludDhfdCBrZXl0eXBlID0gWl9MVkFMX1AodmFsX3B0cik7CisgICAgICB0cmFuc3BvcnQud3JpdGVJOChrZXl0eXBlKTsKKworICAgICAgdHJhbnNwb3J0LndyaXRlSTMyKHplbmRfaGFzaF9udW1fZWxlbWVudHMoaHQpKTsKKyAgICAgIEhhc2hQb3NpdGlvbiBrZXlfcHRyOworICAgICAgaWYodHR5cGVfaXNfc2NhbGFyKGtleXR5cGUpKXsKKyAgICAgICAgZm9yICh6ZW5kX2hhc2hfaW50ZXJuYWxfcG9pbnRlcl9yZXNldF9leChodCwgJmtleV9wdHIpOworICAgICAgICAgICAgICh2YWxfcHRyID0gemVuZF9oYXNoX2dldF9jdXJyZW50X2RhdGFfZXgoaHQsICZrZXlfcHRyKSkgIT0gbnVsbHB0cjsKKyAgICAgICAgICAgICB6ZW5kX2hhc2hfbW92ZV9mb3J3YXJkX2V4KGh0LCAma2V5X3B0cikpIHsKKyAgICAgICAgICBiaW5hcnlfc2VyaWFsaXplX2hhc2h0YWJsZV9rZXkoa2V5dHlwZSwgdHJhbnNwb3J0LCBodCwga2V5X3B0ciwgc3BlYyk7CisgICAgICAgIH0KKyAgICAgIH0gZWxzZSB7CisgICAgICAgIGZvciAoemVuZF9oYXNoX2ludGVybmFsX3BvaW50ZXJfcmVzZXRfZXgoaHQsICZrZXlfcHRyKTsKKyAgICAgICAgICAgICAodmFsX3B0ciA9IHplbmRfaGFzaF9nZXRfY3VycmVudF9kYXRhX2V4KGh0LCAma2V5X3B0cikpICE9IG51bGxwdHI7CisgICAgICAgICAgICAgemVuZF9oYXNoX21vdmVfZm9yd2FyZF9leChodCwgJmtleV9wdHIpKSB7CisgICAgICAgICAgYmluYXJ5X3NlcmlhbGl6ZShrZXl0eXBlLCB0cmFuc3BvcnQsIHZhbF9wdHIsIHNwZWMpOworICAgICAgICB9CisgICAgICB9CisgICAgfSByZXR1cm47CisgIH07CisKKyAgY2hhciBlcnJidWZbMTI4XTsKKyAgc25wcmludGYoZXJyYnVmLCAxMjgsICJVbmtub3duIHRocmlmdCB0eXBlSUQgJWQiLCB0aHJpZnRfdHlwZUlEKTsKKyAgdGhyb3dfdHByb3RvY29sZXhjZXB0aW9uKGVycmJ1ZiwgSU5WQUxJRF9EQVRBKTsKK30KKworc3RhdGljCit2b2lkIHByb3RvY29sX3dyaXRlTWVzc2FnZUJlZ2luKH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pOworCisgICAgICAgICAgICAvLyBmaWVsZCBuYW1lCisgICAgICAgICAgICB6dmFsKiB6dmFybmFtZSA9IHplbmRfaGFzaF9zdHJfZmluZChmaWVsZHNwZWMsICJ2YXIiLCBzaXplb2YoInZhciIpLTEpOworICAgICAgICAgICAgY2hhciogdmFybmFtZSA9IFpfU1RSVkFMX1AoenZhcm5hbWUpOworCisgICAgICAgICAgICB6dmFsKiBpc19yZXF1aXJlZCA9IHplbmRfaGFzaF9zdHJfZmluZChmaWVsZHNwZWMsICJpc1JlcXVpcmVkIiwgc2l6ZW9mKCJpc1JlcXVpcmVkIiktMSk7CisgICAgICAgICAgICB6dmFsIHJ2OworICAgICAgICAgICAgenZhbCogcHJvcCA9IHplbmRfcmVhZF9wcm9wZXJ0eShvYmplY3RfY2xhc3NfZW50cnksIG9iamVjdCwgdmFybmFtZSwgc3RybGVuKHZhcm5hbWUpLCBmYWxzZSwgJnJ2KTsKKworICAgICAgICAgICAgaWYgKFpfVFlQRV9JTkZPX1AoaXNfcmVxdWlyZWQpID09IElTX1RSVUUgJiYgWl9UWVBFX1AocHJvcCkgPT0gSVNfTlVMTCkgeworICAgICAgICAgICAgICAgIGNoYXIgZXJyYnVmWzEyOF07CisgICAgICAgICAgICAgICAgc25wcmludGYoZXJyYnVmLCAxMjgsICJSZXF1aXJlZCBmaWVsZCAlcy4lcyBpcyB1bnNldCEiLCBaU1RSX1ZBTChvYmplY3RfY2xhc3NfZW50cnktPm5hbWUpLCB2YXJuYW1lKTsKKyAgICAgICAgICAgICAgICB0aHJvd190cHJvdG9jb2xleGNlcHRpb24oZXJyYnVmLCBJTlZBTElEX0RBVEEpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCitzdGF0aWMKIHZvaWQgYmluYXJ5X2Rlc2VyaWFsaXplX3NwZWMoenZhbCogenRoaXMsIFBIUElucHV0VHJhbnNwb3J0JiB0cmFuc3BvcnQsIEhhc2hUYWJsZSogc3BlYykgewogICAvLyBTRVQgY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jokdGVzdEFyZ3NbJ3Rlc3REb3VibGUnXSA9IDMuMTQxNTkyNjUzNTg5ODsKKworICAgICAgICAvLyBUT0RPOiBhZGQgdGVzdEJpbmFyeSgpIGNhbGwKKworICAgICAgICBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RCeXRlJ10gPSAweDAxOworCisgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdEkzMiddID0gcG93KDIsIDMwKTsKKworICAgICAgICBpZiAoUEhQX0lOVF9TSVpFID09IDgpIHsKKyAgICAgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdEk2NCddID0gcG93KDIsIDYwKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdEk2NCddID0gIjExNTI5MjE1MDQ2MDY4NDcwMDAiOworICAgICAgICB9CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0U3RydWN0J10gPQorICAgICAgICAgICAgbmV3IFh0cnVjdCgKKyAgICAgICAgICAgICAgICBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgJ3N0cmluZ190aGluZycgPT4gJ3dvcmtlZCcsCisgICAgICAgICAgICAgICAgICAgICdieXRlX3RoaW5nJyA9PiAweDAxLAorICAgICAgICAgICAgICAgICAgICAnaTMyX3RoaW5nJyA9PiBwb3coMiwgMzApLAorICAgICAgICAgICAgICAgICAgICAnaTY0X3RoaW5nJyA9PiBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RJNjQnXQorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0TmVzdE5lc3RlZCddID0KKyAgICAgICAgICAgIG5ldyBYdHJ1Y3QoCisgICAgICAgICAgICAgICAgYXJyYXkoCisgICAgICAgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnID0+ICd3b3JrZWQnLAorICAgICAgICAgICAgICAgICAgICAnYnl0ZV90aGluZycgPT4gMHgwMSwKKyAgICAgICAgICAgICAgICAgICAgJ2kzMl90aGluZycgPT4gcG93KDIsIDMwKSwKKyAgICAgICAgICAgICAgICAgICAgJ2k2NF90aGluZycgPT4gc2VsZjo6JHRlc3RBcmdzWyd0ZXN0STY0J10KKyAgICAgICAgICAgICAgICApCisgICAgICAgICAgICApOworCisgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdE5lc3QnXSA9CisgICAgICAgICAgICBuZXcgWHRydWN0MigKKyAgICAgICAgICAgICAgICBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnID0+IDB4MDEsCisgICAgICAgICAgICAgICAgICAgICdzdHJ1Y3RfdGhpbmcnID0+IHNlbGY6OiR0ZXN0QXJnc1sndGVzdE5lc3ROZXN0ZWQnXSwKKyAgICAgICAgICAgICAgICAgICAgJ2kzMl90aGluZycgPT4gcG93KDIsIDE1KQorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0TWFwJ10gPQorICAgICAgICAgICAgYXJyYXkoCisgICAgICAgICAgICAgICAgNyA9PiA3NywKKyAgICAgICAgICAgICAgICA4ID0+IDg4LAorICAgICAgICAgICAgICAgIDkgPT4gOTkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0U3RyaW5nTWFwJ10gPQorICAgICAgICAgICAgYXJyYXkoCisgICAgICAgICAgICAgICAgImEiID0+ICIxMjMiLAorICAgICAgICAgICAgICAgICJhIGIiID0+ICJ3aXRoIHNwYWNlcyAiLAorICAgICAgICAgICAgICAgICJzYW1lIiA9PiAic2FtZSIsCisgICAgICAgICAgICAgICAgIjAiID0+ICJudW1lcmljIGtleSIsCisgICAgICAgICAgICAgICAgImxvbmdWYWx1ZSIgPT4gc2VsZjo6JHRlc3RBcmdzWyd0ZXN0U3RyaW5nMSddLAorICAgICAgICAgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdFN0cmluZzEnXSA9PiAibG9uZyBrZXkiCisgICAgICAgICAgICApOworCisgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdFNldCddID0gYXJyYXkoMSA9PiB0cnVlLCA1ID0+IHRydWUsIDYgPT4gdHJ1ZSk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0TGlzdCddID0gYXJyYXkoMSwgMiwgMyk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0RW51bSddID0gTnVtYmVyejo6T05FOworCisgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdFR5cGVkZWYnXSA9IDY5OworCisgICAgICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdE1hcE1hcEV4cGVjdGVkUmVzdWx0J10gPQorICAgICAgICAgICAgYXJyYXkoCisgICAgICAgICAgICAgICAgNCA9PiBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgMSA9PiAxLAorICAgICAgICAgICAgICAgICAgICAyID0+IDIsCisgICAgICAgICAgICAgICAgICAgIDMgPT4gMywKKyAgICAgICAgICAgICAgICAgICAgNCA9PiA0LAorICAgICAgICAgICAgICAgICksCisgICAgICAgICAgICAgICAgLTQgPT4gYXJyYXkoCisgICAgICAgICAgICAgICAgICAgIC00ID0+IC00LAorICAgICAgICAgICAgICAgICAgICAtMyA9PiAtMywKKyAgICAgICAgICAgICAgICAgICAgLTIgPT4gLTIsCisgICAgICAgICAgICAgICAgICAgIC0xID0+IC0xCisgICAgICAgICAgICAgICAgKQorICAgICAgICAgICAgKTsKKworICAgICAgICAvLyB0ZXN0SW5zYW5pdHkgLi4uIHRha2VzIGEgZmV3IHN0ZXBzIHRvIHNldCB1cCEKKworICAgICAgICAkeHRydWN0MSA9CisgICAgICAgICAgICBuZXcgWHRydWN0KAorICAgICAgICAgICAgICAgIGFycmF5KAorICAgICAgICAgICAgICAgICAgICAnc3RyaW5nX3RoaW5nJyA9PiAnR29vZGJ5ZTQnLAorICAgICAgICAgICAgICAgICAgICAnYnl0ZV90aGluZycgPT4gNCwKKyAgICAgICAgICAgICAgICAgICAgJ2kzMl90aGluZycgPT4gNCwKKyAgICAgICAgICAgICAgICAgICAgJ2k2NF90aGluZycgPT4gNAorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgJHh0cnVjdDIgPQorICAgICAgICAgICAgbmV3IFh0cnVjdCgKKyAgICAgICAgICAgICAgICBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgJ3N0cmluZ190aGluZycgPT4gJ0hlbGxvMicsCisgICAgICAgICAgICAgICAgICAgICdieXRlX3RoaW5nJyA9PiAyLAorICAgICAgICAgICAgICAgICAgICAnaTMyX3RoaW5nJyA9PiAyLAorICAgICAgICAgICAgICAgICAgICAnaTY0X3RoaW5nJyA9PiAyCisgICAgICAgICAgICAgICAgKQorICAgICAgICAgICAgKTsKKworICAgICAgICAkdXNlck1hcCA9CisgICAgICAgICAgICBhcnJheSgKKyAgICAgICAgICAgICAgICBOdW1iZXJ6OjpGSVZFID0+IDUsCisgICAgICAgICAgICAgICAgTnVtYmVyejo6RUlHSFQgPT4gOAorICAgICAgICAgICAgKTsKKworICAgICAgICAkaW5zYW5pdHkyID0KKyAgICAgICAgICAgIG5ldyBJbnNhbml0eSgKKyAgICAgICAgICAgICAgICBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgJ3VzZXJNYXAnID0+ICR1c2VyTWFwLAorICAgICAgICAgICAgICAgICAgICAneHRydWN0cycgPT4gYXJyYXkoJHh0cnVjdDEsICR4dHJ1Y3QyKQorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgJGluc2FuaXR5MyA9ICRpbnNhbml0eTI7CisKKyAgICAgICAgJGluc2FuaXR5NiA9CisgICAgICAgICAgICBuZXcgSW5zYW5pdHkoCisgICAgICAgICAgICAgICAgYXJyYXkoCisgICAgICAgICAgICAgICAgICAgICd1c2VyTWFwJyA9PiBudWxsLAorICAgICAgICAgICAgICAgICAgICAneHRydWN0cycgPT4gbnVsbAorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICk7CisKKyAgICAgICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0SW5zYW5pdHlFeHBlY3RlZFJlc3VsdCddID0KKyAgICAgICAgICAgIGFycmF5KAorICAgICAgICAgICAgICAgICIxIiA9PiBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgTnVtYmVyejo6VFdPID0+ICRpbnNhbml0eTIsCisgICAgICAgICAgICAgICAgICAgIE51bWJlcno6OlRIUkVFID0+ICRpbnNhbml0eTMKKyAgICAgICAgICAgICAgICApLAorICAgICAgICAgICAgICAgICIyIiA9PiBhcnJheSgKKyAgICAgICAgICAgICAgICAgICAgTnVtYmVyejo6U0lYID0+ICRpbnNhbml0eTYKKyAgICAgICAgICAgICAgICApCisgICAgICAgICAgICApOworICAgIH0KK30KZGlmZiAtLWdpdCBhL2xpYi9waHAvdGVzdC9Kc29uU2VyaWFsaXplL0pzb25TZXJpYWxpemVUZXN0LnBocCBiL2xpYi9waHAvdGVzdC9Kc29uU2VyaWFsaXplL0pzb25TZXJpYWxpemVUZXN0LnBocApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jNjY4NjUyCi0tLSAvZGV2L251bGwKKysrIGIvbGliL3BocC90ZXN0L0pzb25TZXJpYWxpemUvSnNvblNlcmlhbGl6ZVRlc3QucGhwCkBAIC0wLDAgKzEsMTE2IEBACis8P3BocAorLyoKKyAqIExpY2Vuc2VkIHRvIHRoZSBBcGFjaGUgU29mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSB1bmRlciBvbmUKKyAqIG9yIG1vcmUgY29udHJpYnV0b3IgbGljZW5zZSBhZ3JlZW1lbnRzLiBTZWUgdGhlIE5PVElDRSBmaWxlCisgKiBkaXN0cmlidXRlZCB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yA9PiAxMjM0NTY3ODkwLAorICAgICAgICApOworICAgICAgICAkeHRydWN0ID0gbmV3IFxUaHJpZnRUZXN0XFh0cnVjdCgkaW5wdXQpOworCisgICAgICAgIC8vIFh0cnVjdCdzICdpMzJfdGhpbmcnIGFuZCAnYnl0ZV90aGluZycgZmllbGRzIHNob3VsZCBub3QgYmUgcHJlc2VudCBoZXJlIQorICAgICAgICAkZXhwZWN0ZWQgPSBuZXcgc3RkQ2xhc3MoKTsKKyAgICAgICAgJGV4cGVjdGVkLT5zdHJpbmdfdGhpbmcgPSAkaW5wdXRbJ3N0cmluZ190aGluZyddOworICAgICAgICAkZXhwZWN0ZWQtPmk2NF90aGluZyA9ICRpbnB1dFsnaTY0X3RoaW5nJ107CisgICAgICAgICR0aGlzLT5hc3NlcnRFcXVhbHMoJGV4cGVjdGVkLCBqc29uX2RlY29kZShqc29uX2VuY29kZSgkeHRydWN0KSkpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0TmVzdGVkU3RydWN0cygpCisgICAgeworICAgICAgICAkeHRydWN0MiA9IG5ldyBcVGhyaWZ0VGVzdFxYdHJ1Y3QyKGFycmF5KAorICAgICAgICAgICAgJ2J5dGVfdGhpbmcnID0+IDQyLAorICAgICAgICAgICAgJ3N0cnVjdF90aGluZycgPT4gbmV3IFxUaHJpZnRUZXN0XFh0cnVjdChhcnJheSgKKyAgICAgICAgICAgICAgICAnaTMyX3RoaW5nJyA9PiAxMjM0NTYsCisgICAgICAgICAgICApKSwKKyAgICAgICAgKSk7CisKKyAgICAgICAgJGV4cGVjdGVkID0gbmV3IHN0ZENsYXNzKCk7CisgICAgICAgICRleHBlY3RlZC0+Ynl0ZV90aGluZyA9ICR4dHJ1Y3QyLT5ieXRlX3RoaW5nOworICAgICAgICAkZXhwZWN0ZWQtPnN0cnVjdF90aGluZyA9IG5ldyBzdGRDbGFzcygpOworICAgICAgICAkZXhwZWN0ZWQtPnN0cnVjdF90aGluZy0+aTMyX3Ro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PnByb3RvY29sKTsKKworICAgICAgICAkYWN0dWFsID0gJHRoaXMtPnRyYW5zcG9ydC0+cmVhZChGaXh0dXJlczo6JGJ1ZnNpemUpOworICAgICAgICAkZXhwZWN0ZWQgPSBUSlNPTlByb3RvY29sRml4dHVyZXM6OiR0ZXN0QXJnc0pTT05bJ3Rlc3RTdHJpbmcxJ107CisKKyAgICAgICAgJHRoaXMtPmFzc2VydEVxdWFscygkZXhwZWN0ZWQsICRhY3R1YWwpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0U3RyaW5nMldyaXRlKCkKKyAgICB7CisgICAgICAgICRhcmdzID0gbmV3IFxUaHJpZnRUZXN0XFRocmlmdFRlc3RfdGVzdFN0cmluZ19hcmdzKCk7CisgICAgICAgICRhcmdzLT50aGluZyA9IEZpeHR1cmVzOjokdGVzdEFyZ3NbJ3Rlc3RTdHJpbmcyJ107CisgICAgICAgICRhcmdzLT53cml0ZSgkdGhpcy0+cHJvdG9jb2wpOworCisgICAgICAgICRhY3R1YWwgPSAkdGhpcy0+dHJhbnNwb3J0LT5yZWFkKEZpeHR1cmVzOjokYnVmc2l6ZSk7CisgICAgICAgICRleHBlY3RlZCA9IFRKU09OUHJvdG9jb2xGaXh0dXJlczo6JHRlc3RBcmdzSlNPTlsndGVzdFN0cmluZzInXTsKKworICAgICAgICAkdGhpcy0+YXNzZXJ0RXF1YWxzKCRleHBlY3RlZCwgJGFjdHVhbCk7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3REb3VibGVXcml0ZSgpCisgICAgeworICAgICAgICAkYXJncyA9IG5ldyBcVGhyaWZ0VGVzdFxUaHJpZnRUZXN0X3Rlc3REb3VibGVfYXJncygpOworICAgICAgICAkYXJncy0+dGhpbmcgPSBGaXh0dXJlczo6JHRlc3RBcmdzWyd0ZXN0RG91YmxlJ107CisgICAgICAgICRhcmdzLT53cml0ZSgkdGhpcy0+cHJvdG9jb2wpOworCisgICAgICAgICRhY3R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EVxdWFscygkZXhwZWN0ZWQsICRhY3R1YWwpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0U2V0UmVhZCgpCisgICAgeworICAgICAgICAkdGhpcy0+dHJhbnNwb3J0LT53cml0ZSgKKyAgICAgICAgICAgIFRKU09OUHJvdG9jb2xGaXh0dXJlczo6JHRlc3RBcmdzSlNPTlsndGVzdFNldCddCisgICAgICAgICk7CisgICAgICAgICRhcmdzID0gbmV3IFxUaHJpZnRUZXN0XFRocmlmdFRlc3RfdGVzdFNldF9hcmdzKCk7CisgICAgICAgICRhcmdzLT5yZWFkKCR0aGlzLT5wcm90b2NvbCk7CisKKyAgICAgICAgJGFjdHVhbCA9ICRhcmdzLT50aGluZzsKKyAgICAgICAgJGV4cGVjdGVkID0gRml4dHVyZXM6OiR0ZXN0QXJnc1sndGVzdFNldCddOworCisgICAgICAgICR0aGlzLT5hc3NlcnRFcXVhbHMoJGV4cGVjdGVkLCAkYWN0dWFsKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdExpc3RSZWFkKCkKKyAgICB7CisgICAgICAgICR0aGlzLT50cmFuc3BvcnQtPndyaXRlKAorICAgICAgICAgICAgVEpTT05Qcm90b2NvbEZpeHR1cmVzOjokdGVzdEFyZ3NKU09OWyd0ZXN0TGlzdCddCisgICAgICAgICk7CisgICAgICAgICRhcmdzID0gbmV3IFxUaHJpZnRUZXN0XFRocmlmdFRlc3RfdGVzdExpc3RfYXJncygpOworICAgICAgICAkYXJncy0+cmVhZCgkdGhpcy0+cHJvdG9jb2wpOworCisgICAgICAgICRhY3R1YWwgPSAkYXJncy0+dGhpbmc7CisgICAgICAgICRleHBlY3RlZCA9IEZpeHR1cmVzOjokdGVzdEFyZ3NbJ3Rlc3RMaXN0J107CisKKyAgICAgICAgJHRoaXMtPmFzc2VydEVxdWFscygkZXhwZWN0ZWQsICRhY3R1YWwpOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbi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ZWQnXSA9Ci0gICAgICBuZXcgWHRydWN0KAotICAgICAgICAgICAgYXJyYXkoCi0gICAgICAgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnID0+ICd3b3JrZWQnLAotICAgICAgICAgICAgICAgICAgICAnYnl0ZV90aGluZycgPT4gMHgwMSwKLSAgICAgICAgICAgICAgICAgICAgJ2kzMl90aGluZycgPT4gcG93KCAyLCAzMCApLAotICAgICAgICAgICAgICAgICAgICAnaTY0X3RoaW5nJyA9PiBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RJNjQnXQotICAgICAgICAgICAgICAgICAgICApCi0gICAgICAgICAgICApOwotCi0gICAgc2VsZjo6JHRlc3RBcmdzWyd0ZXN0TmVzdCddID0KLSAgICAgIG5ldyBYdHJ1Y3QyKAotICAgICAgICAgICAgYXJyYXkoCi0gICAgICAgICAgICAgICAgJ2J5dGVfdGhpbmcnID0+IDB4MDEsCi0gICAgICAgICAgICAgICAgJ3N0cnVjdF90aGluZycgPT4gc2VsZjo6JHRlc3RBcmdzWyd0ZXN0TmVzdE5lc3RlZCddLAotICAgICAgICAgICAgICAgICdpMzJfdGhpbmcnID0+IHBvdyggMiwgMTUgKQotICAgICAgICAgICAgICAgICkKLSAgICAgICAgICAgICk7Ci0KLSAgICBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RNYXAnXSA9Ci0gICAgICBhcnJheSgKLSAgICAgICAgICAgIDcgPT4gNzcsCi0gICAgICAgICAgICA4ID0+IDg4LAotICAgICAgICAgICAgOSA9PiA5OQotICAgICAgICAgICAgKTsKLQotICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdFN0cmluZ01hcCddID0KLSAgICAgIGFycmF5KAotICAgICAgICAgICAgImEiID0+ICIxMjMiLAotICAgICAgICAgICAgImEgYiIgPT4gIndpdGggc3BhY2VzICIsCi0gICAgICAgICAgICAic2FtZSIgPT4gInNhbWUiLAotICAgICAgICAgICAgIjAiID0+ICJudW1lcmljIGtleSIsCi0gICAgICAgICAgICAibG9uZ1ZhbHVlIiA9PiBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RTdHJpbmcxJ10sCi0gICAgICAgICAgICBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RTdHJpbmcxJ10gPT4gImxvbmcga2V5IgotICAgICAgICAgICAgKTsKLQotICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdFNldCddID0gYXJyYXkoIDEgPT4gdHJ1ZSwgNSA9PiB0cnVlLCA2ID0+IHRydWUgKTsKLQotICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdExpc3QnXSA9IGFycmF5KCAxLCAyLCAzICk7Ci0KLSAgICBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RFbnVtJ10gPSBOdW1iZXJ6OjpPTkU7Ci0KLSAgICBzZWxmOjokdGVzdEFyZ3NbJ3Rlc3RUeXBlZGVmJ10gPSA2OTsKLQotICAgIHNlbGY6OiR0ZXN0QXJnc1sndGVzdE1hcE1hcEV4cGVjdGVkUmVzdWx0J10gPQotICAgICAgYXJyYXkoCi0gICAgICAgICAgICA0ID0+IGFycmF5KAotICAgICAgICAgICAgICAgICAgICAgICAxID0+IDEsCi0gICAgICAgICAgICAgICAgICAgICAgIDIgPT4gMiwKLSAgICAgICAgICAgICAgICAgICAgICAgMyA9PiAzLAotICAgICAgICAgICAgICAgICAgICAgICA0ID0+IDQsCi0gICAgICAgICAgICAgICAgICAgICAgICksCi0gICAgICAgICAgICAtNCA9PiBhcnJheSgKLSAgICAgICAgICAgICAgICAgICAgICAgIC00ID0+IC00LAotICAgICAgICAgICAgICAgICAgICAgICAgLTMgPT4gLTMsCi0gICAgICAgICAgICAgICAgICAgICAgICAtMiA9PiAtMiwKLSAgICAgICAgICAgICAgICAgICAgICAgIC0xID0+IC0xCi0gICAgICAgICAgICAgICAgICAgICAgICApCi0gICAgICAgICAgICApOwotCi0gICAgLy8gdGVzdEluc2FuaXR5IC4uLiB0YWtlcyBhIGZldyBzdGVwcyB0byBzZXQgdXAhCi0KLSAgICAkeHRydWN0MSA9Ci0gICAgICBuZXcgWHRydWN0KAotICAgICAgICAgICAgYXJyYXkoCi0gICAgICAgICAgICAgICAgJ3N0cmluZ190aGluZycgPT4gJ0dvb2RieWU0JywKLSAgICAgICAgICAgICAgICAnYnl0ZV90aGluZycgPT4gNCwKLSAgICAgICAgICAgICAgICAnaTMyX3RoaW5nJyA9PiA0LAotICAgICAgICAgICAgICAgICdpNjRfdGhpbmcnID0+IDQKLSAgICAgICAgICAgICAgICApCi0gICAgICAgICAgICApOwotCi0gICAgJHh0cnVjdDIgPQotICAgICAgbmV3IFh0cnVjdCgKLSAgICAgICAgICAgIGFycmF5KAotICAgICAgICAgICAgICAgICdzdHJpbmdfdGhpbmcnID0+ICdIZWxsbzInLAotICAgICAgICAgICAgICAgICdieXRlX3RoaW5nJyA9PjIsCi0gICAgICAgICAgICAgICAgJ2kzMl90aGluZycgPT4gMiwKLSAgICAgICAgICAgICAgICAnaTY0X3RoaW5nJyA9PiAyCi0gICAgICAgICAgICAgICAgKQotICAgICAgICAgICAgKTsKLQotICAgICR1c2VyTWFwID0KLSAgICAgIGFycmF5KAotICAgICAgICAgICAgTnVtYmVyejo6RklWRSA9PiA1LAotICAgICAgICAgICAgTnVtYmVyejo6RUlHSFQgPT4gOAotICAgICAgICAgICAgKTsKLQotICAgICRpbnNhbml0eTIgPQotICAgICAgbmV3IEluc2FuaXR5KAotICAgICAgICAgICAgYXJyYXkoCi0gICAgICAgICAgICAgICAgJ3VzZXJNYXAnID0+ICR1c2VyTWFwLAotICAgICAgICAgICAgICAgICd4dHJ1Y3RzJyA9PiBhcnJheSgkeHRydWN0MSwkeHRydWN0MikKLSAgICAgICAgICAgICAgICApCi0gICAgICAgICAgICApOwotCi0gICAgJGluc2FuaXR5MyA9ICRpbnNhbml0eTI7Ci0KLSAgICAkaW5zYW5pdHk2ID0KLSAgICAgIG5ldyBJbnNhbml0eSgKLSAgICAgICAgICAgIGFycmF5KAotICAgICAgICA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9lcnJvcnM6CiAgICAgICAgICAgICByYWlzZSBCdWlsZEZhaWxlZCgpCiAKKwogZGVmIHJ1bl9zZXR1cCh3aXRoX2JpbmFyeSk6CiAgICAgaWYgd2l0aF9iaW5hcnk6CiAgICAgICAgIGV4dGVuc2lvbnMgPSBkaWN0KAotICAgICAgICAgICAgZXh0X21vZHVsZXMgPSBbCi0gICAgICAgICAgICAgICAgIEV4dGVuc2lvbigndGhyaWZ0LnByb3RvY29sLmZhc3RiaW5hcnknLAotICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VzID0gWydzcmMvcHJvdG9jb2wvZmFzdGJpbmFyeS5jJ10sCi0gICAgICAgICAgICAgICAgICAgIGluY2x1ZGVfZGlycyA9IGluY2x1ZGVfZGlycywKLSAgICAgICAgICAgICAgICApCisgICAgICAgICAgICBleHRfbW9kdWxlcz1bCisgICAgICAgICAgICAgICAgRXh0ZW5zaW9uKCd0aHJpZnQucHJvdG9jb2wuZmFzdGJpbmFyeScsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZXM9WworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NyYy9leHQvbW9kdWxlLmNwcCcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3JjL2V4dC90eXBlcy5jcHAnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NyYy9leHQvYmluYXJ5LmNwcCcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3JjL2V4dC9jb21wYWN0LmNwcCcsCisgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCisgICAgICAgICAgICAgICAgICAgICAgICAgIGluY2x1ZGVfZGlycz1pbmNsdWRlX2RpcnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICBjbWRjbGFzcz1kaWN0KGJ1aWxkX2V4dD12ZV9idWlsZF9leHQpCiAgICAgICAgICkKICAgICBlbHNlOgogICAgICAgICBleHRl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XN0ZWQnOiB0d2lzdGVkX2RlcHMsCisgICAgICAgICAgICAgICdhbGwnOiBzc2xfZGVwcyArIHRvcm5hZG9fZGVwcyArIHR3aXN0ZWRfZGVwcywKKyAgICAgICAgICB9LAorICAgICAgICAgIHBhY2thZ2VzPVsKKyAgICAgICAgICAgICAgJ3RocmlmdCcsCisgICAgICAgICAgICAgICd0aHJpZnQucHJvdG9jb2wnLAorICAgICAgICAgICAgICAndGhyaWZ0LnRyYW5zcG9ydCcsCisgICAgICAgICAgICAgICd0aHJpZnQuc2VydmVyJywKKyAgICAgICAgICBdLAorICAgICAgICAgIHBhY2thZ2VfZGlyPXsndGhyaWZ0JzogJ3NyYyd9LAorICAgICAgICAgIGNsYXNzaWZpZXJzPVsKKyAgICAgICAgICAgICAgJ0RldmVsb3BtZW50IFN0YXR1cyA6OiA1IC0gUHJvZHVjdGlvbi9TdGFibGUnLAorICAgICAgICAgICAgICAnRW52aXJvbm1lbnQgOjogQ29uc29sZScsCisgICAgICAgICAgICAgICdJbnRlbmRlZCBBdWRpZW5jZSA6OiBEZXZlbG9wZXJzJywKKyAgICAgICAgICAgICAgJ1Byb2dyYW1taW5nIExhbmd1YWdlIDo6IFB5dGhvbicsCisgICAgICAgICAgICAgICdQcm9ncmFtbWluZyBMYW5ndWFnZSA6OiBQeXRob24gOjogMicsCisgICAgICAgICAgICAgICdQcm9ncmFtbWluZyBMYW5ndWFnZSA6OiBQeXRob24gOjogMycsCisgICAgICAgICAgICAgICdUb3BpYyA6OiBTb2Z0d2FyZSBEZXZlbG9wbWVudCA6OiBMaWJyYXJpZXMnLAorICAgICAgICAgICAgICAnVG9waWMgOjogU3lzdGVtIDo6IE5ldHdvcmtpbmcnCisgICAgICAgICAgXSwKKyAgICAgICAgICB6aXBfc2FmZT1GYWxzZSwKKyAgICAgICAgICAqKmV4dGVuc2lvbnMKKyAgICAgICAgICApCisKIAogdHJ5OgotICAgIHJ1bl9zZXR1cChUcnVlKQorICAgIHdpdGhfYmluYXJ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G9zZWQoKToKLSAgICAgICAgICAgICAgICAgICAgc2VsZi5fcHJvY2Vzc29yLnByb2Nlc3ModHJhbnMsIHNlbGYuX2lwcm90X2ZhY3RvcnksIG9wcm90LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjaz1uZXh0X3Bhc3MpCi0KLSAgICAgICAgICAgIG5leHRfcGFzcygpCi0KKyAgICAgICAgICAgIHdoaWxlIG5vdCB0cmFucy5zdHJlYW0uY2xvc2VkKCk6CisgICAgICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICAgICAgICBmcmFtZSA9IHlpZWxkIHRyYW5zLnJlYWRGcmFtZSgpCisgICAgICAgICAgICAgICAgZXhjZXB0IFRUcmFuc3BvcnRFeGNlcHRpb24gYXMgZToKKyAgICAgICAgICAgICAgICAgICAgaWYgZS50eXBlID09IFRUcmFuc3BvcnRFeGNlcHRpb24uRU5EX09GX0ZJTEU6CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhaworICAgICAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UKKyAgICAgICAgICAgICAgICB0ciA9IFRNZW1vcnlCdWZmZXIoZnJhbWUpCisgICAgICAgICAgICAgICAgaXByb3QgPSBzZWxmLl9pcHJvdF9mYWN0b3J5LmdldFByb3RvY29sKHRyKQorICAgICAgICAgICAgICAgIHlpZWxkIHNlbGYuX3Byb2Nlc3Nvci5wcm9jZXNzKGlwcm90LCBvcHJvdCkKICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbjoKLSAgICAgICAgICAgIGxvZ2dpbmcuZXhjZXB0aW9uKCd0aHJpZnQgZXhjZXB0aW9uIGluIGhhbmRsZV9zdHJlYW0nKQorICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbigndGhyaWZ0IGV4Y2VwdGlvbiBpbiBoYW5kbGVfc3RyZWFtJykKICAgICAgICAgICAgIHRyYW5zLmNsb3NlKCkK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i0gICAgICAgICAgICAgICAgICAgICAgJ0JPT0wnLAotICAgICAgICAgICAgICAgICAgICAgICdCWVRFJywKLSAgICAgICAgICAgICAgICAgICAgICAnRE9VQkxFJywKLSAgICAgICAgICAgICAgICAgICAgICBOb25lLAotICAgICAgICAgICAgICAgICAgICAgICdJMTYnLAotICAgICAgICAgICAgICAgICAgICAgIE5vbmUsCi0gICAgICAgICAgICAgICAgICAgICAgJ0kzMicsCi0gICAgICAgICAgICAgICAgICAgICAgTm9uZSwKLSAgICAgICAgICAgICAgICAgICAgICdJNjQnLAotICAgICAgICAgICAgICAgICAgICAgJ1NUUklORycsCi0gICAgICAgICAgICAgICAgICAgICAnU1RSVUNUJywKLSAgICAgICAgICAgICAgICAgICAgICdNQVAnLAotICAgICAgICAgICAgICAgICAgICAgJ1NFVCcsCi0gICAgICAgICAgICAgICAgICAgICAnTElTVCcsCi0gICAgICAgICAgICAgICAgICAgICAnVVRGOCcsCi0gICAgICAgICAgICAgICAgICAgICAnVVRGMTYnKQorICAgIF9WQUxVRVNfVE9fTkFNRVMgPSAoCisgICAgICAgICdTVE9QJywKKyAgICAgICAgJ1ZPSUQnLAorICAgICAgICAnQk9PTCcsCisgICAgICAgICdCWVRFJywKKyAgICAgICAgJ0RPVUJMRScsCisgICAgICAgIE5vbmUsCisgICAgICAgICdJMTYnLAorICAgICAgICBOb25lLAorICAgICAgICAnSTMyJywKKyAgICAgICAgTm9uZSwKKyAgICAgICAgJ0k2NCcsCisgICAgICAgICdTVFJJTkcnLAorICAgICAgICAnU1RSVUNUJywKKyAgICAgICAgJ01BUCcsCisgICAgICAgICdTRVQnLAorICAgICAgICAnTElTVCcsCisgICAgICAgICdVVEY4JywKKyAgICAgICAgJ1VURjE2JywKKyAgICApCiAKIAotY2xhc3MgVE1lc3NhZ2VUeXBlOgotICBDQUxMID0gMQotICBSRVBMWSA9IDIKLSAgRVhDRVBUSU9OID0gMwotICBPTkVXQVkgPSA0CitjbGFzcyBUTWVzc2FnZVR5cG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pbigpCi0gICAgICBpZiBmdHlwZSA9PSBUVHlwZS5TVE9QOgotICAgICAgICBicmVhawotICAgICAgaWYgZmlkID09IDE6Ci0gICAgICAgIGlmIGZ0eXBlID09IFRUeXBlLlNUUklORzoKLSAgICAgICAgICBzZWxmLm1lc3NhZ2UgPSBpcHJvdC5yZWFkU3RyaW5nKCkKKyAgICBkZWYgX19zdHJfXyhzZWxmKToKKyAgICAgICAgaWYgc2VsZi5tZXNzYWdlOgorICAgICAgICAgICAgcmV0dXJuIHNlbGYubWVzc2FnZQorICAgICAgICBlbGlmIHNlbGYudHlwZSA9PSBzZWxmLlVOS05PV05fTUVUSE9EOgorICAgICAgICAgICAgcmV0dXJuICdVbmtub3duIG1ldGhvZCcKKyAgICAgICAgZWxpZiBzZWxmLnR5cGUgPT0gc2VsZi5JTlZBTElEX01FU1NBR0VfVFlQRToKKyAgICAgICAgICAgIHJldHVybiAnSW52YWxpZCBtZXNzYWdlIHR5cGUnCisgICAgICAgIGVsaWYgc2VsZi50eXBlID09IHNlbGYuV1JPTkdfTUVUSE9EX05BTUU6CisgICAgICAgICAgICByZXR1cm4gJ1dyb25nIG1ldGhvZCBuYW1lJworICAgICAgICBlbGlmIHNlbGYudHlwZSA9PSBzZWxmLkJBRF9TRVFVRU5DRV9JRDoKKyAgICAgICAgICAgIHJldHVybiAnQmFkIHNlcXVlbmNlIElEJworICAgICAgICBlbGlmIHNlbGYudHlwZSA9PSBzZWxmLk1JU1NJTkdfUkVTVUxUOgorICAgICAgICAgICAgcmV0dXJuICdNaXNzaW5nIHJlc3VsdCcKKyAgICAgICAgZWxpZiBzZWxmLnR5cGUgPT0gc2VsZi5JTlRFUk5BTF9FUlJPUjoKKyAgICAgICAgICAgIHJldHVybiAnSW50ZXJuYWwgZXJyb3InCisgICAgICAgIGVsaWYgc2VsZi50eXBlID09IHNlbGYuUFJPVE9DT0xfRVJST1I6CisgICAgICAgICAgICByZXR1cm4gJ1Byb3RvY29sIGVycm9yJworICAgICAgICBl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ZUZpZWxkRW5kKCkKLSAgICBpZiBzZWxmLnR5cGUgaXMgbm90IE5vbmU6Ci0gICAgICBvcHJvdC53cml0ZUZpZWxkQmVnaW4oJ3R5cGUnLCBUVHlwZS5JMzIsIDIpCi0gICAgICBvcHJvdC53cml0ZUkzMihzZWxmLnR5cGUpCi0gICAgICBvcHJvdC53cml0ZUZpZWxkRW5kKCkKLSAgICBvcHJvdC53cml0ZUZpZWxkU3RvcCgpCi0gICAgb3Byb3Qud3JpdGVTdHJ1Y3RFbmQoKQorICAgIGRlZiByZWFkKHNlbGYsIGlwcm90KToKKyAgICAgICAgaXByb3QucmVhZFN0cnVjdEJlZ2luKCkKKyAgICAgICAgd2hpbGUgVHJ1ZToKKyAgICAgICAgICAgIChmbmFtZSwgZnR5cGUsIGZpZCkgPSBpcHJvdC5yZWFkRmllbGRCZWdpbigpCisgICAgICAgICAgICBpZiBmdHlwZSA9PSBUVHlwZS5TVE9QOgorICAgICAgICAgICAgICAgIGJyZWFrCisgICAgICAgICAgICBpZiBmaWQgPT0gMToKKyAgICAgICAgICAgICAgICBpZiBmdHlwZSA9PSBUVHlwZS5TVFJJTkc6CisgICAgICAgICAgICAgICAgICAgIHNlbGYubWVzc2FnZSA9IGlwcm90LnJlYWRTdHJpbmcoKQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIGlwcm90LnNraXAoZnR5cGUpCisgICAgICAgICAgICBlbGlmIGZpZCA9PSAyOgorICAgICAgICAgICAgICAgIGlmIGZ0eXBlID09IFRUeXBlLkkzMjoKKyAgICAgICAgICAgICAgICAgICAgc2VsZi50eXBlID0gaXByb3QucmVhZEkzMigpCisgICAgICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgaXByb3Quc2tpcChmdHlwZSkKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgaXByb3Quc2tpcChmdHlwZSkKKyAgICAgICAgICAgIGlwcm90LnJlYWRGaWVsZEVuZC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sKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorCisgIGJvb2wgcmVhZEkxNihpbnQxNl90JiB2YWwpIHsKKyAgICBjaGFyKiBidWY7CisgICAgaWYgKCFyZWFkQnl0ZXMoJmJ1Ziwgc2l6ZW9mKGludDE2X3QpKSkgeworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBtZW1jcHkoJnZhbCwgYnVmLCBzaXplb2YoaW50MTZfdCkpOworICAgIHZhbCA9IG50b2hzKHZhbCk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKworICBib29sIHJlYWRJMzIoaW50MzJfdCYgdmFsKSB7CisgICAgY2hhciogYnVmOworICAgIGlmICghcmVhZEJ5dGVzKCZidWYsIHNpemVvZihpbnQzMl90KSkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgbWVtY3B5KCZ2YWwsIGJ1Ziwgc2l6ZW9mKGludDMyX3QpKTsKKyAgICB2YWwgPSBudG9obCh2YWwpOworICAgIHJldHVybiB0cnVlOworICB9CisKKyAgYm9vbCByZWFkSTY0KGludDY0X3QmIHZhbCkgeworICAgIGNoYXIqIGJ1ZjsKKyAgICBpZiAoIXJlYWRCeXRlcygmYnVmLCBzaXplb2YoaW50NjRfdCkpKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIG1lbWNweSgmdmFsLCBidWYsIHNpemVvZihpbnQ2NF90KSk7CisgICAgdmFsID0gbnRvaGxsKHZhbCk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKworICBib29sIHJlYWREb3VibGUoZG91YmxlJiB2YWwpIHsKKyAgICB1bmlvbiB7CisgICAgICBpbnQ2NF90IGY7CisgICAgICBkb3VibGUgdDsKKyAgICB9IHRyYW5zZmVyOworCisgICAgaWYgKCFyZWFkSTY0KHRyYW5zZmVyLmYpKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHZhbCA9IHRyYW5zZmVyLnQ7CisgICAgcmV0d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kgeyByZXR1cm4gdHJ1ZTsgfQorCisgIGJvb2wgcmVhZEZpZWxkQmVnaW4oVFR5cGUmIHR5cGUsIGludDE2X3QmIHRhZyk7CisKKyNkZWZpbmUgU0tJUEJZVEVTKG4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoIXJlYWRCeXRlcygmZHVtbXlfYnVmXywgKG4pKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHJldHVybiBmYWxzZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZXR1cm4gdHJ1ZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKKworICBib29sIHNraXBCb29sKCkgeyBTS0lQQllURVMoMSk7IH0KKyAgYm9vbCBza2lwQnl0ZSgpIHsgU0tJUEJZVEVTKDEpOyB9CisgIGJvb2wgc2tpcEkxNigpIHsgU0tJUEJZVEVTKDIpOyB9CisgIGJvb2wgc2tpcEkzMigpIHsgU0tJUEJZVEVTKDQpOyB9CisgIGJvb2wgc2tpcEk2NCgpIHsgU0tJUEJZVEVTKDgpOyB9CisgIGJvb2wgc2tpcERvdWJsZSgpIHsg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KKyAgICB9CisgICAgY2hhciogYnVmOworICAgIGlmICghcmVhZEJ5dGVzKCZidWYsIDEpKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHZhbCA9IGJ1ZlswXSA9PSBDVF9CT09MRUFOX1RSVUU7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKyAgYm9vbCByZWFkSTgoaW50OF90JiB2YWwpIHsKKyAgICBjaGFyKiBidWY7CisgICAgaWYgKCFyZWFkQnl0ZXMoJmJ1ZiwgMSkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgdmFsID0gYnVmWzBdOworICAgIHJldHVybiB0cnVlOworICB9CisKKyAgYm9vbCByZWFkSTE2KGludDE2X3QmIHZhbCkgeworICAgIHVpbnQxNl90IHV2YWw7CisgICAgaWYgKHJlYWRWYXJpbnQ8dWludDE2X3QsIDM+KHV2YWwpKSB7CisgICAgICB2YWwgPSBmcm9tWmlnWmFnPGludDE2X3QsIHVpbnQxNl90Pih1dmFsKTsKKyAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICByZXR1cm4gZmFsc2U7CisgIH0KKworICBib29sIHJlYWRJMzIoaW50MzJfdCYgdmFsKSB7CisgICAgdWludDMyX3QgdXZhbDsKKyAgICBpZiAocmVhZFZhcmludDx1aW50MzJfdCwgNT4odXZhbCkpIHsKKyAgICAgIHZhbCA9IGZyb21aaWdaYWc8aW50MzJfdCwgdWludDMyX3Q+KHV2YWwpOworICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKKyAgfQorCisgIGJvb2wgcmVhZEk2NChpbnQ2NF90JiB2YWwpIHsKKyAgICB1aW50NjRfdCB1dmFsOworICAgIGlmIChyZWFkVmFyaW50PHVpbnQ2NF90LCAxMD4odXZhbCkpIHsKKyAgICAgIHZhbCA9IGZyb21aaWdaYWc8aW50NjRfdCwgdWludDY0X3Q+KHV2YWwpOworICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKKyAgfQorCisgIGJvb2wgcmVhZERvdWJsZShkb3VibGUmIHZhbCkgeworICAgIHVuaW9uIHsKKyAgICAgIGludDY0X3QgZjsKKyAgICAgIGRvdWJsZSB0OworICAgIH0gdHJhbnNmZXI7CisKKyAgICBjaGFyKiBidWY7CisgICAgaWYgKCFyZWFkQnl0ZXMoJmJ1ZiwgOCkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgbWVtY3B5KCZ0cmFuc2Zlci5mLCBidWYsIHNpemVvZihpbnQ2NF90KSk7CisgICAgdHJhbnNmZXIuZiA9IGxldG9obGwodHJhbnNmZXIuZik7CisgICAgdmFsID0gdHJhbnNmZXIudDsKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorCisgIGludDMyX3QgcmVhZFN0cmluZyhjaGFyKiogYnVmKSB7CisgICAgdWludDMyX3QgbGVuOworICAgIGlmICghcmVhZFZhcmludDx1aW50MzJfdCwgNT4obGVuKSB8fCAhY2hlY2tMZW5ndGhMaW1pdChsZW4sIHN0cmluZ0xpbWl0KCkpKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGlmIChsZW4gPT0gMCkgeworICAgICAgcmV0dXJuIDA7CisgICAgfQorICAgIGlmICghcmVhZEJ5dGVzKGJ1ZiwgbGVuKSkgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICByZXR1cm4gbGVuOworICB9CisKKyAgaW50MzJfdCByZWFkTGlzdEJlZ2luKFRUeXBlJiBldHlwZSkgeworICAgIHVpbnQ4X3QgYjsKKyAgICBpZiAoIXJlYWRCeXRlKGIpKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGV0eXBlID0gZ2V0VFR5cGUoYiAmIDB4Zik7CisgICAgaWYgKGV0eXBlID09IC0xKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHVpbnQzMl90IGxlbiA9IChiID4+IDQpICYgMHhmOworICAgIGlmIChsZW4gPT0gMTUgJiYgIXJlYWRWYXJpbnQ8dWludDMyX3QsIDU+KGxlbikpIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgaWYgKCFjaGVja0xlbmd0aExpbWl0KGxlbiwgY29udGFpbmVyTGltaXQoKSkpIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgcmV0dXJuIGxlbjsKKyAgfQorCisgIGludDMyX3QgcmVhZE1hcEJlZ2luKFRUeXBlJiBrdHlwZSwgVFR5cGUmIHZ0eXBlKSB7CisgICAgdWludDMyX3QgbGVuOworICAgIGlmICghcmVhZFZhcmludDx1aW50MzJfdCwgNT4obGVuKSB8fCAhY2hlY2tMZW5ndGhMaW1pdChsZW4sIGNvbnRhaW5lckxpbWl0KCkpKSB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGlmIChsZW4gIT0gMCkgeworICAgICAgdWludDhfdCBrdlR5cGU7CisgICAgICBpZiAoIXJlYWRCeXRlKGt2VHlwZSkpIHsKKyAgICAgICAgcmV0dXJuIC0xOworICAgICAgfQorICAgICAga3R5cGUgPSBnZXRUVHlwZShrdlR5cGUgPj4gNCk7CisgICAgICB2dHlwZSA9IGdldFRUeXBlKGt2VHlwZSAmIDB4Zik7CisgICAgICBpZiAoa3R5cGUgPT0gLTEgfHwgdnR5cGUgPT0gLTEpIHsKKyAgICAgICAgcmV0dXJuIC0xOworICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gbGVuOworICB9CisKKyAgYm9vbCByZWFkU3RydWN0QmVnaW4oKSB7CisgICAgcmVhZFRhZ3NfLnB1c2goMCk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKyAgYm9vbCByZWFkU3RydWN0RW5kKCkgeworICAgIHJlYWRUYWdzXy5wb3AoKTsKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorICBib29sIHJlYWRGaWVsZEJlZ2luKFRUeXBlJiB0eXBlLCBpbnQxNl90JiB0YWcpOworCisgIGJvb2wgc2tpcEJvb2woKSB7CisgICAgYm9vbCB2YWw7CisgICAgcmV0dXJuIHJlYWRCb29sKHZhbCk7CisgIH0KKyNkZWZpbmUgU0tJUEJZVEVTKG4pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgZG8geyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpZiAoIXJlYWRCeXRlcygmZHVtbXlfYnVmXywgKG4pKSkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHJldHVybiBmYWxzZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZXR1cm4gdHJ1ZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfSB3aGlsZSAoMCkKKyAgYm9vbCBza2lwQnl0ZSgpIHsgU0tJUEJZVEVTKDEpOyB9CisgIGJvb2wgc2tpcERvdWJsZSgpIHsgU0tJUEJZVEVTKDgpOyB9CisgIGJvb2wgc2tpcEkxNigpIHsKKyAgICBpbnQxNl90IHZhbDsKKyAgICByZXR1cm4gcmVhZEkxNih2YWwpOworICB9CisgIGJvb2wgc2tpcEkzMigpIHsKKyAgICBpbnQzMl90IHZhbDsKKyAgICByZXR1cm4gcmVhZEkzMih2YWwpOworICB9CisgIGJvb2wgc2tpc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mFsKSB7IHJldHVybiAodmFsID4+IDYzKSBeICh2YWwgPDwgMSk7IH0KKworICBpbnQgd3JpdGVWYXJpbnQodWludDMyX3QgdmFsKSB7CisgICAgaW50IGNudCA9IDE7CisgICAgd2hpbGUgKHZhbCAmIH4weDdmVSkgeworICAgICAgd3JpdGVCeXRlKHN0YXRpY19jYXN0PGNoYXI+KCh2YWwgJiAweDdmVSkgfCAweDgwVSkpOworICAgICAgdmFsID4+PSA3OworICAgICAgKytjbnQ7CisgICAgfQorICAgIHdyaXRlQnl0ZShzdGF0aWNfY2FzdDxjaGFyPih2YWwpKTsKKyAgICByZXR1cm4gY250OworICB9CisKKyAgaW50IHdyaXRlVmFyaW50NjQodWludDY0X3QgdmFsKSB7CisgICAgaW50IGNudCA9IDE7CisgICAgd2hpbGUgKHZhbCAmIH4weDdmVUxMKSB7CisgICAgICB3cml0ZUJ5dGUoc3RhdGljX2Nhc3Q8Y2hhcj4oKHZhbCAmIDB4N2ZVTEwpIHwgMHg4MFVMTCkpOworICAgICAgdmFsID4+PSA3OworICAgICAgKytjbnQ7CisgICAgfQorICAgIHdyaXRlQnl0ZShzdGF0aWNfY2FzdDxjaGFyPih2YWwpKTsKKyAgICByZXR1cm4gY250OworICB9CisKKyAgdGVtcGxhdGUgPHR5cGVuYW1lIFQsIGludCBNYXg+CisgIGJvb2wgcmVhZFZhcmludChUJiByZXN1bHQpIHsKKyAgICB1aW50OF90IGI7CisgICAgVCB2YWwgPSAwOworICAgIGludCBzaGlmdCA9IDA7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBNYXg7ICsraSkgeworICAgICAgaWYgKCFyZWFkQnl0ZShiKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICB9CisgICAgICBpZiAoYiAmIDB4ODApIHsKKyAgICAgICAgdmFsIHw9IHN0YXRpY19jYXN0PFQ+KGIgJiAweDdmKSA8PCBzaGlmdDsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHZhbCB8PSBzdG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lmdEZhc3RCaW5hcnlNZXRob2RzW10gPSB7CisgICAgeyJlbmNvZGVfYmluYXJ5IiwgZW5jb2RlX2JpbmFyeSwgTUVUSF9WQVJBUkdTLCAiIn0sCisgICAgeyJkZWNvZGVfYmluYXJ5IiwgZGVjb2RlX2JpbmFyeSwgTUVUSF9WQVJBUkdTLCAiIn0sCisgICAgeyJlbmNvZGVfY29tcGFjdCIsIGVuY29kZV9jb21wYWN0LCBNRVRIX1ZBUkFSR1MsICIifSwKKyAgICB7ImRlY29kZV9jb21wYWN0IiwgZGVjb2RlX2NvbXBhY3QsIE1FVEhfVkFSQVJHUywgIiJ9LAorICAgIHtOVUxMLCBOVUxMLCAwLCBOVUxMfSAvKiBTZW50aW5lbCAqLworfTsKKworI2lmIFBZX01BSk9SX1ZFUlNJT04gPj0gMworCitzdGF0aWMgc3RydWN0IFB5TW9kdWxlRGVmIFRocmlmdEZhc3RCaW5hcnlEZWYgPSB7UHlNb2R1bGVEZWZfSEVBRF9JTklULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aHJpZnQucHJvdG9jb2wuZmFzdGJpbmFyeSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdEZhc3RCaW5hcnlNZXRob2RzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEx9OworCisjZGVmaW5lIElOSVRFUlJPUiByZXR1cm4gTlVMTDsKKworUHlPYmplY3QqIFB5SW5pdF9mYXN0YmluYXJ5KCkgeworCisjZWxzZQorCisjZGVmaW5lIElOSVRFUlJPUiByZXR1cm47CisKK3ZvaWQgaW5pdGZhc3RiaW5hcnkoKSB7CisKKyAgUHljU3RyaW5nX0lNUE9SVDsKKyAgaWYgKFB5Y1N0cmluZ0lPID09IE5VTEwpCisgICAgSU5JVEVSUk9SCisKKyNlbmRpZgorCisjZGVmaW5lIElOSVRfSU5URVJOX1NUUklORyh2YWx1ZSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgSU5URVJOX1NUUklORyh2YWx1ZSkgPSBQeVN0cmluZ19JbnRlcm5Gcm9tU3RyaW5nKCN2YWx1ZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaWYgKCFJTlRFUk5fU1RSSU5HKHZhbHVlKSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBJTklURVJST1IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIH0gd2hpbGUgKDApCisKKyAgSU5JVF9JTlRFUk5fU1RSSU5HKFRGcm96ZW5EaWN0KTsKKyAgSU5JVF9JTlRFUk5fU1RSSU5HKGNzdHJpbmdpb19idWYpOworICBJTklUX0lOVEVSTl9TVFJJTkcoY3N0cmluZ2lvX3JlZmlsbCk7CisgIElOSVRfSU5URVJOX1NUUklORyhzdHJpbmdfbGVuZ3RoX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RkOjpjb3B5KGRhdGEsIGRhdGEgKyBzaXplLCBzdGQ6OmJhY2tfaW5zZXJ0ZXIob3V0cHV0Xy0+YnVmKSk7CisgIHJldHVybiB0cnVlOworfQorCisjZW5kaWYKKworbmFtZXNwYWNlIGRldGFpbCB7CisKKyNkZWZpbmUgREVDTEFSRV9PUF9TQ09QRShuYW1lLCBvcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPHR5cGVuYW1lIEltcGw+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgc3RydWN0IG5hbWUjI1Njb3BlIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBJbXBsKiBpbXBsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBib29sIHZhbGlkOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBuYW1lIyNTY29wZShJbXBsKiB0aGl6KSA6IGltcGwodGhpeiksIHZhbGlkKGltcGwtPm9wIyNCZWdpbigpKSB7fSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB+bmFtZSMjU2NvcGUoKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGlmICh2YWxpZCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgaW1wbC0+b3AjI0VuZCgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBvcGVyYXRvciBib29sKCkgeyByZXR1cm4gdmFsaWQ7IH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGUgPHR5cGVuYW1lIEltcGwsIHRlbXBsYXRlIDx0eXBlbmFtZT4gY2xhc3MgVD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgbmFtZSMjU2NvcGU8SW1wbD4gb3AjI1Njb3BlKFQ8SW1wbD4qIHRoaXopIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZXR1cm4gbmFtZSMjU2NvcGU8SW1wbD4oc3RhdGljX2Nhc3Q8SW1wbCo+KHRoaXopKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgfQorREVDTEFSRV9PUF9TQ09QRShXcml0ZVN0cnVjdCwgd3JpdGVTdHJ1Y3QpCitERUNMQVJFX09QX1NDT1BFKFJlYWRTdHJ1Y3QsIHJlYWRTdHJ1Y3QpCisjdW5kZWYgREVDTEFSRV9PUF9TQ09QRQorCitpbmxpbmUgYm9vbCBjaGVja19zc2l6ZV90XzMyKFB5X3NzaXplX3QgbGVuKSB7CisgIC8vIGVycm9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VlIGFzc3VtZXMgdGhhdCBhIHJlZmVyZW5jZSBpcyBhbHJlYWR5IGhlbGQuIFRoZSAqY2FsbGVyKiBpcworICAgKiByZXNwb25zaWJsZSBmb3IgaGFuZGxpbmcgcmVmZXJlbmNlcworICAgKi8KKworICBzd2l0Y2ggKHR5cGUpIHsKKworICBjYXNlIFRfQk9PTDogeworICAgIGludCB2ID0gUHlPYmplY3RfSXNUcnVlKHZhbHVlKTsKKyAgICBpZiAodiA9PSAtMSkgeworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpbXBsKCktPndyaXRlQm9vbCh2KTsKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorICBjYXNlIFRfSTA4OiB7CisgICAgaW50OF90IHZhbDsKKworICAgIGlmICghcGFyc2VfcHlpbnQodmFsdWUsICZ2YWwsIChzdGQ6Om51bWVyaWNfbGltaXRzPGludDhfdD46Om1pbikoKSwKKyAgICAgICAgICAgICAgICAgICAgIChzdGQ6Om51bWVyaWNfbGltaXRzPGludDhfdD46Om1heCkoKSkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpbXBsKCktPndyaXRlSTgodmFsKTsKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorICBjYXNlIFRfSTE2OiB7CisgICAgaW50MTZfdCB2YWw7CisKKyAgICBpZiAoIXBhcnNlX3B5aW50KHZhbHVlLCAmdmFsLCAoc3RkOjpudW1lcmljX2xpbWl0czxpbnQxNl90Pjo6bWluKSgpLAorICAgICAgICAgICAgICAgICAgICAgKHN0ZDo6bnVtZXJpY19saW1pdHM8aW50MTZfdD46Om1heCkoKSkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpbXBsKCktPndyaXRlSTE2KHZhbCk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKyAgY2FzZSBUX0kzMjogeworICAgIGludDMyX3QgdmFsOworCisgICAgaWYgKCFwYXJzZV9weWludCh2YWx1ZSwgJnZhbCwgKHN0ZDo6bnVtZXJpY19saW1pdHM8aW50MzJfdD46Om1pbikoKSwKKyAgICAgICAgICAgICAgICAgICAgIChzdGQ6Om51bWVyaWNfbGltaXRzPGludDMyX3Q+OjptYXgpKCkpKSB7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgaW1wbCgpLT53cml0ZUkzMih2YWwpOworICAgIHJldHVybiB0cnVlOworICB9CisgIGNhc2UgVF9JNjQ6IHsKKyAgICBpbnQ2NF90IG52YWwgPSBQeUxvbmdfQXNMb25nTG9uZyh2YWx1ZSk7CisKKyAgICBpZiAoSU5UX0NPTlZfRVJST1JfT0NDVVJSRUQobnZhbCkpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpZiAoIUNIRUNLX1JBTkdFKG52YWwsIChzdGQ6Om51bWVyaWNfbGltaXRzPGludDY0X3Q+OjptaW4pKCksCisgICAgICAgICAgICAgICAgICAgICAoc3RkOjpudW1lcmljX2xpbWl0czxpbnQ2NF90Pjo6bWF4KSgpKSkgeworICAgICAgUHlFcnJfU2V0U3RyaW5nKFB5RXhjX092ZXJmbG93RXJyb3IsICJpbnQgb3V0IG9mIHJhbmdlIik7CisgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgaW1wbCgpLT53cml0ZUk2NChudmFsKTsKKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorCisgIGNhc2UgVF9ET1VCTEU6IHsKKyAgICBkb3VibGUgbnZhbCA9IFB5RmxvYXRfQXNEb3VibGUodmFsdWUpOworICAgIGlmIChudmFsID09IC0xLjAgJiYgUHlFcnJfT2NjdXJyZWQoKSkgeworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGltcGwoKS0+d3JpdGVEb3VibGUobnZhbCk7CisgICAgcmV0dXJuIHRydWU7CisgIH0KKworICBjYXNlIFRfU1RSSU5HOiB7CisgICAgU2NvcGVkUHlPYmplY3QgbnZhbDsKKworICAgI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XBsZSA9PSBQeV9Ob25lKSB7CisgICAgICAgIGNvbnRpbnVlOworICAgICAgfQorCisgICAgICBTdHJ1Y3RJdGVtU3BlYyBwYXJzZWRzcGVjOworICAgICAgaWYgKCFwYXJzZV9zdHJ1Y3RfaXRlbV9zcGVjKCZwYXJzZWRzcGVjLCBzcGVjX3R1cGxlKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICB9CisKKyAgICAgIFNjb3BlZFB5T2JqZWN0IGluc3R2YWwoUHlPYmplY3RfR2V0QXR0cih2YWx1ZSwgcGFyc2Vkc3BlYy5hdHRybmFtZSkpOworCisgICAgICBpZiAoIWluc3R2YWwpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgfQorCisgICAgICBpZiAoaW5zdHZhbC5nZXQoKSA9PSBQeV9Ob25lKSB7CisgICAgICAgIGNvbnRpbnVlOworICAgICAgfQorCisgICAgICBib29sIHJlcyA9IGltcGwoKS0+d3JpdGVGaWVsZChpbnN0dmFsLmdldCgpLCBwYXJzZWRzcGVjKTsKKyAgICAgIGlmICghcmVzKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKyAgICB9CisgICAgaW1wbCgpLT53cml0ZUZpZWxkU3RvcCgpOworICAgIHJldHVybiB0cnVlOworICB9CisKKyAgY2FzZSBUX1NUT1A6CisgIGNhc2UgVF9WT0lEOgorICBjYXNlIFRfVVRGMTY6CisgIGNhc2UgVF9VVEY4OgorICBjYXNlIFRfVTY0OgorICBkZWZhdWx0OgorICAgIFB5RXJyX0Zvcm1hdChQeUV4Y19UeXBlRXJyb3IsICJVbmV4cGVjdGVkIFRUeXBlIGZvciBlbmNvZGVWYWx1ZTogJWQiLCB0eXBlKTsKKyAgICByZXR1cm4gZmFsc2U7CisgIH0KKworICByZXR1cm4gdHJ1ZTsKK30KKwordGVtcGxhdGUgPHR5cGVuYW1lIEltcGw+Citib29sIFByb3RvY29sQmFzZTxJbXBsPjo6c2tpcChUVHlwZSB0eXBlKSB7CisgIHN3aXRjaCAodHlwZSkgeworICBjYXNlIFRfQk9PTDoKKyAgICByZXR1cm4gaW1wbCgpLT5za2lwQm9vbCgpOworICBjYXNlIFRfSTA4OgorICAgIHJldHVybiBpbXBsKCktPnNraXBCeXRlKCk7CisgIGNhc2UgVF9JMTY6CisgICAgcmV0dXJuIGltcGwoKS0+c2tpcEkxNigpOworICBjYXNlIFRfSTMyOgorICAgIHJldHVybiBpbXBsKCktPnNraXBJMzIoKTsKKyAgY2FzZSBUX0k2NDoKKyAgICByZXR1cm4gaW1wbCgpLT5za2lwSTY0KCk7CisgIGNhc2UgVF9ET1VCTEU6CisgICAgcmV0dXJuIGltcGwoKS0+c2tpcERvdWJsZSgpOworCisgIGNhc2UgVF9TVFJJTkc6IHsKKyAgICByZXR1cm4gaW1wbCgpLT5za2lwU3RyaW5nKCk7CisgIH0KKworICBjYXNlIFRfTElTVDoKKyAgY2FzZSBUX1NFVDogeworICAgIFRUeXBlIGV0eXBlID0gVF9TVE9QOworICAgIGludDMyX3QgbGVuID0gaW1wbCgpLT5yZWFkTGlzdEJlZ2luKGV0eXBlKTsKKyAgICBpZiAobGVuIDwgMCkgeworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBmb3IgKGludDMyX3QgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgaWYgKCFza2lwKGV0eXBlKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICB9CisgICAgfQorICAgIHJldHVybiB0cnVlOworICB9CisKKyAgY2FzZSBUX01BUDogeworICAgIFRUeXBlIGt0eXBlID0gVF9TVE9QOworICAgIFRUeXBlIHZ0eXBlID0gVF9TVE9QOworICAgIGludDMyX3QgbGVuID0gaW1wbCgpLT5yZWFkTWFwQmVnaW4oa3R5cGUsIHZ0eXBlKTsKKyAgICBpZiAobGVuIDwgMCkgeworICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBmb3IgKGludDMyX3QgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgaWYgKCFza2lwKGt0eXBlKSB8fCAhc2tpcCh2dHlwZSkpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gdHJ1ZTsKKyAgfQorCisgIGNhc2UgVF9TVFJVQ1Q6IHsKKyAgICBkZXRhaWw6OlJlYWRTdHJ1Y3RTY29wZTxJbXBsPiBzY29wZSA9IGRldGFpbDo6cmVhZFN0cnVjdFNjb3BlKHRoaXMpOworICAgIGlmICghc2NvcGUpIHsKKyAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgIFRUeXBlIHR5cGUgPSBUX1NUT1A7CisgICAgICBpbnQxNl90IHRhZzsKKyAgICAgIGlmICghaW1wbCgpLT5yZWFkRmllbGRCZWdpbih0eXBlLCB0YWcpKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKyAgICAgIGlmICh0eXBlID09IFRfU1RPUCkgeworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgIH0KKyAgICAgIGlmICghc2tpcCh0eXBlKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICB9CisgICAgfQorICAgIHJldHVybiB0cnVlOworICB9CisKKyAgY2FzZSBUX1NUT1A6CisgIGNhc2UgVF9WT0lEOgorICBjYXNlIFRfVVRGMTY6CisgIGNhc2UgVF9VVEY4OgorICBjYXNlIFRfVTY0OgorICBkZWZhdWx0OgorICAgIFB5RXJyX0Zvcm1hdChQeUV4Y19UeXBlRXJyb3IsICJVbmV4cGVjdGVkIFRUeXBlIGZvciBza2lwOiAlZCIsIHR5cGUpOworICAgIHJldHVybiBmYWxzZTsKKyAgfQorCisgIHJldHVybiB0cnVlOworfQorCisvLyBSZXR1cm5zIGEgbmV3IHJlZmVyZW5jZS4KK3RlbXBsYXRlIDx0eXBlbmFtZSBJbXBsPgorUHlPYmplY3QqIFByb3RvY29sQmFzZTxJbXBsPjo6ZGVjb2RlVmFsdWUoVFR5cGUgdHlwZSwgUHlPYmplY3QqIHR5cGVhcmdzKSB7CisgIHN3aXRjaCAodHlwZSkgeworCisgIGNhc2UgVF9CT09MOiB7CisgICAgYm9vbCB2ID0gMDsKKyAgICBpZiAoIWltcGwoKS0+cmVhZEJvb2wodikpIHsKKyAgICAgIHJldHVybiBOVUxMOworICAgIH0KKyAgICBpZiAodikgeworICAgICAgUHlfUkVUVVJOX1RSVUU7CisgICAgfSBlbHNlIHsKKyAgICAgIFB5X1JFVFVSTl9GQUxTRTsKKyAgICB9CisgIH0KKyAgY2FzZSBUX0kwODogeworICAgIGludDhfdCB2ID0gMDsKKyAgICBpZiAoIWltcGwoKS0+cmVhZEk4KHYpKSB7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgcmV0dXJuIFB5SW50X0Zyb21Mb25nKHYpOworICB9CisgIGNhc2UgVF9JMTY6IHsKKyAgICBpbnQxNl90IHYgPSAwOworICAgIGlmICghaW1wbCgpLT5yZWFkSTE2KHYpKSB7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgcmV0dXJuIFB5SW50X0Zyb21Mb25nKHYpOworICB9CisgIGNhc2UgVF9JMzI6IHsKKyAgICBpbnQzMl90IHYgPSAwOworICAgIGlmICghaW1wbCgpLT5yZWFkSTMyKHYpKSB7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgcmV0dXJuIFB5SW50X0Zyb21Mb25nKHYpOworICB9CisKKyAgY2FzZSBUX0k2NDogeworICAgIGludDY0X3QgdiA9IDA7CisgICAgaWYgKCFpbXBsKCktPnJlYWRJNjQodikpIHsKKyAgICAgIHJldHVybiBOVUxMOworICAgIH0KKyAgICAvLyBUT0RPKGRyZWlzcyk6IEZpbmQgb3V0IGlmIHdlIGNhbiB0YWtlIHRoaXMgZmFzdHBhdGggYWx3YXlzIHdoZW4KKyAgICAvLyAgICAgICAgICAgICAgIHNpemVvZihsb25nKSA9PSBzaXplb2YobG9uZyBsb25nKS4KKyAgICBpZiAoQ0hFQ0tfUkFOR0UodiwgTE9OR19NSU4sIExPTkdfTUFYKSkgeworICAgICAgcmV0dXJuIFB5SW50X0Zyb21Mb25nKChsb25nKXYpOworICAgIH0KKyAgICByZXR1cm4gUHlMb25nX0Zyb21Mb25nTG9uZyh2KTsKKyAgfQorCisgIGNhc2UgVF9ET1VCTEU6IHsKKyAgICBkb3VibGUgdiA9IDAuMDsKKyAgICBpZiAoIWltcGwoKS0+cmVhZERvdWJsZSh2KSkgeworICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorICAgIHJldHVybiBQeUZsb2F0X0Zyb21Eb3VibGUodik7CisgIH0KKworICBjYXNlIFRfU1RSSU5HOiB7CisgICAgY2hhciogYnVmID0gTlVMTDsKKyAgICBpbnQgbGVuID0gaW1wbCgpLT5yZWFkU3RyaW5nKCZidWYpOworICAgIGlmIChsZW4gPCAwKSB7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisgICAgaWYgKGlzVXRmOCh0eXBlYXJncykpIHsKKyAgICAgIHJldHVybiBQeVVuaWNvZGVfRGVjb2RlVVRGOChidWYsIGxlbiwgMCk7CisgICAgfSBlbHNlIHsKKyAgICAgIHJldHVybiBQeUJ5dGVzX0Zyb21TdHJpbmdBbmRTaXplKGJ1ZiwgbGVuKTsKKyAgICB9CisgIH0KKworICBjYXNlIFRfTElTVDoKKyAgY2FzZSBUX1NFVDogeworICAgIFNldExpc3RUeXBlQXJncyBwYXJzZWRhcmdzOworICAgIGlmICghcGFyc2Vfc2V0X2xpc3RfYXJncygmcGFyc2VkYXJncywgdHlwZWFyZ3MpKSB7CisgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICBUVHlwZSBldHlwZSA9IFRfU1RPUDsKKyAgICBpbnQzMl90IGxlbiA9IGltcGwoKS0+cmVhZExpc3RCZWdpbihldHlwZSk7CisgICAgaWYgKGxlbiA8IDApIHsK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worICAgIFRUeXBlIHR5cGUgPSBUX1NUT1A7CisgICAgaW50MTZfdCB0YWc7CisgICAgaWYgKCFpbXBsKCktPnJlYWRGaWVsZEJlZ2luKHR5cGUsIHRhZykpIHsKKyAgICAgIHJldHVybiBOVUxMOworICAgIH0KKyAgICBpZiAodHlwZSA9PSBUX1NUT1ApIHsKKyAgICAgIGJyZWFrOworICAgIH0KKyAgICBpZiAodGFnIDwgMCB8fCB0YWcgPj0gc3BlY19zZXFfbGVuKSB7CisgICAgICBpZiAoIXNraXAodHlwZSkpIHsKKyAgICAgICAgUHlFcnJfU2V0U3RyaW5nKFB5RXhjX1R5cGVFcnJvciwgIkVycm9yIHdoaWxlIHNraXBwaW5nIHVua25vd24gZmllbGQiKTsKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICB9CisgICAgICBjb250aW51ZTsKKyAgICB9CisKKyAgICBQeU9iamVjdCogaXRlbV9zcGVjID0gUHlUdXBsZV9HRVRfSVRFTShzcGVjX3NlcSwgdGFnKTsKKyAgICBpZiAoaXRlbV9zcGVjID09IFB5X05vbmUpIHsKKyAgICAgIGlmICghc2tpcCh0eXBlKSkgeworICAgICAgICBQeUVycl9TZXRTdHJpbmcoUHlFeGNfVHlwZUVycm9yLCAiRXJyb3Igd2hpbGUgc2tpcHBpbmcgdW5rbm93biBmaWVsZCIpOworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICAgIH0KKyAgICAgIGNvbnRpbnVlOworICAgIH0KKyAgICBTdHJ1Y3RJdGVtU3BlYyBwYXJzZWRzcGVjOworICAgIGlmICghcGFyc2Vfc3RydWN0X2l0ZW1fc3BlYygmcGFyc2Vkc3BlYywgaXRlbV9zcGVjKSkgeworICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorICAgIGlmIChwYXJzZWRzcGVjLnR5cGUgIT0gdHlwZSkgeworICAgICAgaWYgKCFza2lwKHR5cGUpKSB7CisgICAgICAgIFB5RXJyX0Zvcm1hdChQeUV4Y19UeXBlRXJyb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c3NfXy5fX25hbWVfXywgJywgJy5qb2luKEwpKQorICAgIGRlZiBfX3JlcHJfXyhzZWxmKToKKyAgICAgICAgTCA9IFsnJXM9JXInICUgKGtleSwgZ2V0YXR0cihzZWxmLCBrZXkpKSBmb3Iga2V5IGluIHNlbGYuX19zbG90c19fXQorICAgICAgICByZXR1cm4gJyVzKCVzKScgJSAoc2VsZi5fX2NsYXNzX18uX19uYW1lX18sICcsICcuam9pbihMKSkKIAotICBkZWYgX19lcV9fKHNlbGYsIG90aGVyKToKLSAgICBpZiBub3QgaXNpbnN0YW5jZShvdGhlciwgc2VsZi5fX2NsYXNzX18pOgotICAgICAgcmV0dXJuIEZhbHNlCi0gICAgZm9yIGF0dHIgaW4gc2VsZi5fX3Nsb3RzX186Ci0gICAgICBteV92YWwgPSBnZXRhdHRyKHNlbGYsIGF0dHIpCi0gICAgICBvdGhlcl92YWwgPSBnZXRhdHRyKG90aGVyLCBhdHRyKQotICAgICAgaWYgbXlfdmFsICE9IG90aGVyX3ZhbDoKLSAgICAgICAgcmV0dXJuIEZhbHNlCi0gICAgcmV0dXJuIFRydWUKKyAgICBkZWYgX19lcV9fKHNlbGYsIG90aGVyKToKKyAgICAgICAgaWYgbm90IGlzaW5zdGFuY2Uob3RoZXIsIHNlbGYuX19jbGFzc19fKToKKyAgICAgICAgICAgIHJldHVybiBGYWxzZQorICAgICAgICBmb3IgYXR0ciBpbiBzZWxmLl9fc2xvdHNfXzoKKyAgICAgICAgICAgIG15X3ZhbCA9IGdldGF0dHIoc2VsZiwgYXR0cikKKyAgICAgICAgICAgIG90aGVyX3ZhbCA9IGdldGF0dHIob3RoZXIsIGF0dHIpCisgICAgICAgICAgICBpZiBteV92YWwgIT0gb3RoZXJfdmFsOgorICAgICAgICAgICAgICAgIHJldHVybiBGYWxzZQorICAgICAgICByZXR1cm4gVHJ1ZQogCi0gIGRlZiBfX25lX18oc2VsZiwgb3RoZXIpOgotICAgIHJldHVybiBub3QgKHNlbGYgPT0gb3RoZXIpCisgICAgZGVmIF9fbmVfXyhzZWxmLCBvdGhlcik6CisgICAgICAgIHJldHVybiBub3QgKHNlbGYgPT0gb3RoZXIpCiAKLSAgZGVmIHJlYWQoc2VsZiwgaXByb3QpOgotICAgIGlmIChpcHJvdC5fX2NsYXNzX18gPT0gVEJpbmFyeVByb3RvY29sLlRCaW5hcnlQcm90b2NvbEFjY2VsZXJhdGVkIGFuZAotICAgICAgICBpc2luc3RhbmNlKGlwcm90LnRyYW5zLCBUVHJhbnNwb3J0LkNSZWFkYWJsZVRyYW5zcG9ydCkgYW5kCi0gICAgICAgIHNlbGYudGhyaWZ0X3NwZWMgaXMgbm90IE5vbmUgYW5kCi0gICAgICAgIGZhc3RiaW5hcnkgaXMgbm90IE5vbmUpOgotICAgICAgZmFzdGJpbmFyeS5kZWNvZGVfYmluYXJ5KHNlbGYsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXByb3QudHJhbnMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNlbGYuX19jbGFzc19fLCBzZWxmLnRocmlmdF9zcGVjKSkKLSAgICAgIHJldHVybgotICAgIGlwcm90LnJlYWRTdHJ1Y3Qoc2VsZiwgc2VsZi50aHJpZnRfc3BlYykKKyAgICBkZWYgcmVhZChzZWxmLCBpcHJvdCk6CisgICAgICAgIGlmIChpcHJvdC5fZmFzdF9kZWNvZGUgaXMgbm90IE5vbmUgYW5kCisgICAgICAgICAgICAgICAgaXNpbnN0YW5jZShpcHJvdC50cmFucywgVFRyYW5zcG9ydC5DUmVhZGFibGVUcmFuc3BvcnQpIGFuZAorICAgICAgICAgICAgICAgIHNlbGYudGhyaWZ0X3NwZWMgaXMgbm90IE5vbmUpOgorICAgICAgICAgICAgaXByb3QuX2Zhc3RfZGVjb2RlKHNlbGYsIGlwcm90LCBbc2VsZi5fX2NsYXNzX18sIHNlbGYudGhyaWZ0X3NwZWNdKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgaXByb3QucmVhZFN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ICBzZWxmLndyaXRlSTMyKHNpemUpCiAKLSAgZGVmIHdyaXRlU2V0RW5kKHNlbGYpOgotICAgIHBhc3MKKyAgICBkZWYgd3JpdGVMaXN0RW5kKHNlbGYpOgorICAgICAgICBwYXNzCiAKLSAgZGVmIHdyaXRlQm9vbChzZWxmLCBib29sKToKLSAgICBpZiBib29sOgotICAgICAgc2VsZi53cml0ZUJ5dGUoMSkKLSAgICBlbHNlOgotICAgICAgc2VsZi53cml0ZUJ5dGUoMCkKKyAgICBkZWYgd3JpdGVTZXRCZWdpbihzZWxmLCBldHlwZSwgc2l6ZSk6CisgICAgICAgIHNlbGYud3JpdGVCeXRlKGV0eXBlKQorICAgICAgICBzZWxmLndyaXRlSTMyKHNpemUpCiAKLSAgZGVmIHdyaXRlQnl0ZShzZWxmLCBieXRlKToKLSAgICBidWZmID0gcGFjaygiIWIiLCBieXRlKQotICAgIHNlbGYudHJhbnMud3JpdGUoYnVmZikKKyAgICBkZWYgd3JpdGVTZXRFbmQoc2VsZik6CisgICAgICAgIHBhc3MKIAotICBkZWYgd3JpdGVJMTYoc2VsZiwgaTE2KToKLSAgICBidWZmID0gcGFjaygiIWgiLCBpMTYpCi0gICAgc2VsZi50cmFucy53cml0ZShidWZmKQorICAgIGRlZiB3cml0ZUJvb2woc2VsZiwgYm9vbCk6CisgICAgICAgIGlmIGJvb2w6CisgICAgICAgICAgICBzZWxmLndyaXRlQnl0ZSgxKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi53cml0ZUJ5dGUoMCkKIAotICBkZWYgd3JpdGVJMzIoc2VsZiwgaTMyKToKLSAgICBidWZmID0gcGFjaygiIWkiLCBpMzIpCi0gICAgc2VsZi50cmFucy53cml0ZShidWZmKQorICAgIGRlZiB3cml0ZUJ5dGUoc2VsZiwgYnl0ZSk6CisgICAgICAgIGJ1ZmYgPSBwYWNrKCIhYiIsIGJ5dGUpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoYnVmZikKIAotICBkZWYgd3JpdGVJNjQoc2VsZiwgaTY0KToKLSAgICBidWZmID0gcGFjaygiIXEiLCBpNjQpCi0gICAgc2VsZi50cmFucy53cml0ZShidWZmKQorICAgIGRlZiB3cml0ZUkxNihzZWxmLCBpMTYpOgorICAgICAgICBidWZmID0gcGFjaygiIWgiLCBpMTYpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoYnVmZikKIAotICBkZWYgd3JpdGVEb3VibGUoc2VsZiwgZHViKToKLSAgICBidWZmID0gcGFjaygiIWQiLCBkdWIpCi0gICAgc2VsZi50cmFucy53cml0ZShidWZmKQorICAgIGRlZiB3cml0ZUkzMihzZWxmLCBpMzIpOgorICAgICAgICBidWZmID0gcGFjaygiIWkiLCBpMzIpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoYnVmZikKIAotICBkZWYgd3JpdGVTdHJpbmcoc2VsZiwgc3RyKToKLSAgICBzZWxmLndyaXRlSTMyKGxlbihzdHIpKQotICAgIHNlbGYudHJhbnMud3JpdGUoc3RyKQorICAgIGRlZiB3cml0ZUk2NChzZWxmLCBpNjQpOgorICAgICAgICBidWZmID0gcGFjaygiIXEiLCBpNjQpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoYnVmZikKIAotICBkZWYgcmVhZE1lc3NhZ2VCZWdpbihzZWxmKToKLSAgICBzeiA9IHNlbGYucmVhZEkzMigpCi0gICAgaWYgc3ogPCAwOgotICAgICAgdmVyc2lvbiA9IHN6ICYgVEJpbmFyeVByb3RvY29sLlZFUlNJT05fTUFTSwotICAgICAgaWYgdmVyc2lvbiAhPSBUQmluYXJ5UHJvdG9jb2wuVkVSU0lPTl8xOgotICAgICAgICByYWlzZSBUUHJvdG9jb2xFeGNlcHRpb24oCi0gICAgICAgICAgdHlwZT1UUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sCi0gICAgICAgICAgbWVzc2FnZT0nQmFkIHZlcnNpb24gaW4gcmVhZE1lc3NhZ2VCZWdpbjogJWQnICUgKH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UlNJT05fTUFTSworICAgICAgICAgICAgaWYgdmVyc2lvbiAhPSBUQmluYXJ5UHJvdG9jb2wuVkVSU0lPTl8xOgorICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgdHlwZT1UUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sCisgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U9J0JhZCB2ZXJzaW9uIGluIHJlYWRNZXNzYWdlQmVnaW46ICVkJyAlIChzeikpCisgICAgICAgICAgICB0eXBlID0gc3ogJiBUQmluYXJ5UHJvdG9jb2wuVFlQRV9NQVNLCisgICAgICAgICAgICBuYW1lID0gc2VsZi5yZWFkU3RyaW5nKCkKKyAgICAgICAgICAgIHNlcWlkID0gc2VsZi5yZWFkSTMyKCkKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIGlmIHNlbGYuc3RyaWN0UmVhZDoKKyAgICAgICAgICAgICAgICByYWlzZSBUUHJvdG9jb2xFeGNlcHRpb24odHlwZT1UUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U9J05vIHByb3RvY29sIHZlcnNpb24gaGVhZGVyJykKKyAgICAgICAgICAgIG5hbWUgPSBzZWxmLnRyYW5zLnJlYWRBbGwoc3opCisgICAgICAgICAgICB0eXBlID0gc2VsZi5yZWFkQnl0ZSgpCisgICAgICAgICAgICBzZXFpZCA9IHNlbGYucmVhZEkzMigpCisgICAgICAgIHJldHVybiAobmFtZSwgdHlwZSwgc2VxaWQpCiAKLSAgZGVmIHJlYWRTdHJ1Y3RFbmQoc2VsZik6Ci0gICAgcGFzcworICAgIGRlZiByZWFkTWVzc2FnZUVuZChzZWxmKToKKyAgICAgICAgcGFzcwogCi0gIGRlZiByZWFkRmllbGRCZWdpbihzZWxmKToKLSAgICB0eXBlID0gc2V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ucmVhZEJ5dGUoKQorICAgICAgICB2dHlwZSA9IHNlbGYucmVhZEJ5dGUoKQorICAgICAgICBzaXplID0gc2VsZi5yZWFkSTMyKCkKKyAgICAgICAgc2VsZi5fY2hlY2tfY29udGFpbmVyX2xlbmd0aChzaXplKQorICAgICAgICByZXR1cm4gKGt0eXBlLCB2dHlwZSwgc2l6ZSkKIAotICBkZWYgcmVhZExpc3RFbmQoc2VsZik6Ci0gICAgcGFzcworICAgIGRlZiByZWFkTWFwRW5kKHNlbGYpOgorICAgICAgICBwYXNzCiAKLSAgZGVmIHJlYWRTZXRCZWdpbihzZWxmKToKLSAgICBldHlwZSA9IHNlbGYucmVhZEJ5dGUoKQotICAgIHNpemUgPSBzZWxmLnJlYWRJMzIoKQotICAgIHJldHVybiAoZXR5cGUsIHNpemUpCisgICAgZGVmIHJlYWRMaXN0QmVnaW4oc2VsZik6CisgICAgICAgIGV0eXBlID0gc2VsZi5yZWFkQnl0ZSgpCisgICAgICAgIHNpemUgPSBzZWxmLnJlYWRJMzIoKQorICAgICAgICBzZWxmLl9jaGVja19jb250YWluZXJfbGVuZ3RoKHNpemUpCisgICAgICAgIHJldHVybiAoZXR5cGUsIHNpemUpCiAKLSAgZGVmIHJlYWRTZXRFbmQoc2VsZik6Ci0gICAgcGFzcworICAgIGRlZiByZWFkTGlzdEVuZChzZWxmKToKKyAgICAgICAgcGFzcwogCi0gIGRlZiByZWFkQm9vbChzZWxmKToKLSAgICBieXRlID0gc2VsZi5yZWFkQnl0ZSgpCi0gICAgaWYgYnl0ZSA9PSAwOgotICAgICAgcmV0dXJuIEZhbHNlCi0gICAgcmV0dXJuIFRydWUKKyAgICBkZWYgcmVhZFNldEJlZ2luKHNlbGYpOgorICAgICAgICBldHlwZSA9IHNlbGYucmVhZEJ5dGUoKQorICAgICAgICBzaXplID0gc2VsZi5yZWFkSTMyKCkKKyAgICAgICAgc2VsZi5fY2hlY2tfY29udGFpbmVyX2xlbmd0aChzaXplKQorICAgICAgICByZXR1cm4gKGV0eXBlLCBzaXplKQogCi0gIGRlZiByZWFkQnl0ZShzZWxmKToKLSAgICBidWZmID0gc2VsZi50cmFucy5yZWFkQWxsKDEpCi0gICAgdmFsLCA9IHVucGFjaygnIWInLCBidWZmKQotICAgIHJldHVybiB2YWwKKyAgICBkZWYgcmVhZFNldEVuZChzZWxmKToKKyAgICAgICAgcGFzcwogCi0gIGRlZiByZWFkSTE2KHNlbGYpOgotICAgIGJ1ZmYgPSBzZWxmLnRyYW5zLnJlYWRBbGwoMikKLSAgICB2YWwsID0gdW5wYWNrKCchaCcsIGJ1ZmYpCi0gICAgcmV0dXJuIHZhbAorICAgIGRlZiByZWFkQm9vbChzZWxmKToKKyAgICAgICAgYnl0ZSA9IHNlbGYucmVhZEJ5dGUoKQorICAgICAgICBpZiBieXRlID09IDA6CisgICAgICAgICAgICByZXR1cm4gRmFsc2UKKyAgICAgICAgcmV0dXJuIFRydWUKIAotICBkZWYgcmVhZEkzMihzZWxmKToKLSAgICBidWZmID0gc2VsZi50cmFucy5yZWFkQWxsKDQpCi0gICAgdmFsLCA9IHVucGFjaygnIWknLCBidWZmKQotICAgIHJldHVybiB2YWwKKyAgICBkZWYgcmVhZEJ5dGUoc2VsZik6CisgICAgICAgIGJ1ZmYgPSBzZWxmLnRyYW5zLnJlYWRBbGwoMSkKKyAgICAgICAgdmFsLCA9IHVucGFjaygnIWInLCBidWZmKQorICAgICAgICByZXR1cm4gdmFsCiAKLSAgZGVmIHJlYWRJNjQoc2VsZik6Ci0gICAgYnVmZiA9IHNlbGYudHJhbnMucmVhZEFsbCg4KQotICAgIHZhbCwgPSB1bnBhY2soJyFxJywgYnVmZikKLSAgICByZXR1cm4gdmFsCisgICAgZGVmIHJlYWRJMTYoc2VsZik6CisgICAgICAgIGJ1ZmYgPSBzZWxmLnRyYW5zLnJlYWRBbGwoMikKKyAgICAgICAgdmFsLCA9IHVucGFjaygnIWgnLCBidWZmKQorICAgICAgICByZXR1cm4gdmFsCiAKLSAgZGV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BuZXN0ZWQKKyAgICByZXR1cm4gaGVscGVyCisKKwogd3JpdGVyID0gbWFrZV9oZWxwZXIoVkFMVUVfV1JJVEUsIENPTlRBSU5FUl9XUklURSkKIHJlYWRlciA9IG1ha2VfaGVscGVyKFZBTFVFX1JFQUQsIENPTlRBSU5FUl9SRUFEKQogCiAKIGRlZiBtYWtlWmlnWmFnKG4sIGJpdHMpOgotICByZXR1cm4gKG4gPDwgMSkgXiAobiA+PiAoYml0cyAtIDEpKQorICAgIGNoZWNrSW50ZWdlckxpbWl0cyhuLCBiaXRzKQorICAgIHJldHVybiAobiA8PCAxKSBeIChuID4+IChiaXRzIC0gMSkpCiAKIAogZGVmIGZyb21aaWdaYWcobik6Ci0gIHJldHVybiAobiA+PiAxKSBeIC0obiAmIDEpCisgICAgcmV0dXJuIChuID4+IDEpIF4gLShuICYgMSkKIAogCiBkZWYgd3JpdGVWYXJpbnQodHJhbnMsIG4pOgotICBvdXQgPSBbXQotICB3aGlsZSBUcnVlOgotICAgIGlmIG4gJiB+MHg3ZiA9PSAwOgotICAgICAgb3V0LmFwcGVuZChuKQotICAgICAgYnJlYWsKLSAgICBlbHNlOgotICAgICAgb3V0LmFwcGVuZCgobiAmIDB4ZmYpIHwgMHg4MCkKLSAgICAgIG4gPSBuID4+IDcKLSAgdHJhbnMud3JpdGUoJycuam9pbihtYXAoY2hyLCBvdXQpKSkKKyAgICBvdXQgPSBieXRlYXJyYXkoKQorICAgIHdoaWxlIFRydWU6CisgICAgICAgIGlmIG4gJiB+MHg3ZiA9PSAwOgorICAgICAgICAgICAgb3V0LmFwcGVuZChuKQorICAgICAgICAgICAgYnJlYWsKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIG91dC5hcHBlbmQoKG4gJiAweGZmKSB8IDB4ODApCisgICAgICAgICAgICBuID0gbiA+PiA3CisgICAgdHJhbnMud3JpdGUoYnl0ZXMob3V0KSkKIAogCiBkZWYgcmVhZFZhcmludCh0cmFucyk6Ci0gIHJlc3VsdC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lbGVyYXRlZCwgc2VsZikuX19pbml0X18oKmFyZ3MsICoqa3dhcmdzKQorICAgICAgICB0cnk6CisgICAgICAgICAgICBmcm9tIHRocmlmdC5wcm90b2NvbCBpbXBvcnQgZmFzdGJpbmFyeQorICAgICAgICBleGNlcHQgSW1wb3J0RXJyb3I6CisgICAgICAgICAgICBpZiBub3QgZmFsbGJhY2s6CisgICAgICAgICAgICAgICAgcmFpc2UKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHNlbGYuX2Zhc3RfZGVjb2RlID0gZmFzdGJpbmFyeS5kZWNvZGVfY29tcGFjdAorICAgICAgICAgICAgc2VsZi5fZmFzdF9lbmNvZGUgPSBmYXN0YmluYXJ5LmVuY29kZV9jb21wYWN0CisKKworY2xhc3MgVENvbXBhY3RQcm90b2NvbEFjY2VsZXJhdGVkRmFjdG9yeShvYmplY3QpOgorICAgIGRlZiBfX2luaXRfXyhzZWxmLAorICAgICAgICAgICAgICAgICBzdHJpbmdfbGVuZ3RoX2xpbWl0PU5vbmUsCisgICAgICAgICAgICAgICAgIGNvbnRhaW5lcl9sZW5ndGhfbGltaXQ9Tm9uZSwKKyAgICAgICAgICAgICAgICAgZmFsbGJhY2s9VHJ1ZSk6CisgICAgICAgIHNlbGYuc3RyaW5nX2xlbmd0aF9saW1pdCA9IHN0cmluZ19sZW5ndGhfbGltaXQKKyAgICAgICAgc2VsZi5jb250YWluZXJfbGVuZ3RoX2xpbWl0ID0gY29udGFpbmVyX2xlbmd0aF9saW1pdAorICAgICAgICBzZWxmLl9mYWxsYmFjayA9IGZhbGxiYWNrCisKKyAgICBkZWYgZ2V0UHJvdG9jb2woc2VsZiwgdHJhbnMpOgorICAgICAgICByZXR1cm4gVENvbXBhY3RQcm90b2NvbEFjY2VsZXJhdGVkKAorICAgICAgICAgICAgdHJhbnMsCisgICAgICAgICAgICBzdHJpbmdfbGVuZ3RoX2xpbWl0PXNlbGYuc3RyaW5nX2xlbmd0aF9saW1pdCwKKyAgICAgICAg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woYm9vbF92YWwpCisKKyAgICBkZWYgd3JpdGVCeXRlKHNlbGYsIGJ5dGUpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wud3JpdGVCeXRlKGJ5dGUpCisKKyAgICBkZWYgd3JpdGVJMTYoc2VsZiwgaTE2KToKKyAgICAgICAgcmV0dXJuIHNlbGYuX3Byb3RvY29sLndyaXRlSTE2KGkxNikKKworICAgIGRlZiB3cml0ZUkzMihzZWxmLCBpMzIpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wud3JpdGVJMzIoaTMyKQorCisgICAgZGVmIHdyaXRlSTY0KHNlbGYsIGk2NCk6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC53cml0ZUk2NChpNjQpCisKKyAgICBkZWYgd3JpdGVEb3VibGUoc2VsZiwgZHViKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX3Byb3RvY29sLndyaXRlRG91YmxlKGR1YikKKworICAgIGRlZiB3cml0ZUJpbmFyeShzZWxmLCBzdHJfdmFsKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX3Byb3RvY29sLndyaXRlQmluYXJ5KHN0cl92YWwpCisKKyAgICBkZWYgX3NldF9wcm90b2NvbChzZWxmKToKKyAgICAgICAgdHJ5OgorICAgICAgICAgICAgcHJvdG9jb2xfY2xzID0gUFJPVE9DT0xTX0JZX0lEW3NlbGYudHJhbnMucHJvdG9jb2xfaWRdCisgICAgICAgIGV4Y2VwdCBLZXlFcnJvcjoKKyAgICAgICAgICAgIHJhaXNlIFRBcHBsaWNhdGlvbkV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICBUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9QUk9UT0NPTCwKKyAgICAgICAgICAgICAgICAiVW5rbm93biBwcm90b2NvbCByZXF1ZXN0ZWQuIiwKKyAgICAgICAgICAgICkKKworICAgICAgICBzZWxmLl9wcm90b2NvbCA9IHByb3RvY29sX2NscyhzZWxmLnRyYW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bGRCZWdpbigpCisKKyAgICBkZWYgcmVhZEZpZWxkRW5kKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wucmVhZEZpZWxkRW5kKCkKKworICAgIGRlZiByZWFkTWFwQmVnaW4oc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkTWFwQmVnaW4oKQorCisgICAgZGVmIHJlYWRNYXBFbmQoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkTWFwRW5kKCkKKworICAgIGRlZiByZWFkTGlzdEJlZ2luKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wucmVhZExpc3RCZWdpbigpCisKKyAgICBkZWYgcmVhZExpc3RFbmQoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkTGlzdEVuZCgpCisKKyAgICBkZWYgcmVhZFNldEJlZ2luKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wucmVhZFNldEJlZ2luKCkKKworICAgIGRlZiByZWFkU2V0RW5kKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5fcHJvdG9jb2wucmVhZFNldEVuZCgpCisKKyAgICBkZWYgcmVhZEJvb2woc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkQm9vbCgpCisKKyAgICBkZWYgcmVhZEJ5dGUoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkQnl0ZSgpCisKKyAgICBkZWYgcmVhZEkxNihzZWxmKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX3Byb3RvY29sLnJlYWRJMTYoKQorCisgICAgZGVmIHJlYWRJMzIoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbC5yZWFkSTMyKCkKKworICAgIGRlZiByZWFkSTY0KHNlbGYpOgorICAgICAgICByZXR1cm4g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wdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrSW50ZWdlckxpbWl0cykKIGltcG9ydCBiYXNlNjQKLWltcG9ydCBqc29uCiBpbXBvcnQgbWF0aAoraW1wb3J0IHN5cworCitmcm9tIC4uY29tcGF0IGltcG9ydCBzdHJfdG9fYmluYXJ5CisKIAogX19hbGxfXyA9IFsnVEpTT05Qcm90b2NvbCcsCiAgICAgICAgICAgICdUSlNPTlByb3RvY29sRmFjdG9yeScsCkBAIC0yOSw0OTQgKzMzLDYwOCBAQAogCiBWRVJTSU9OID0gMQogCi1DT01NQSA9ICcsJwotQ09MT04gPSAnOicKLUxCUkFDRSA9ICd7JwotUkJSQUNFID0gJ30nCi1MQlJBQ0tFVCA9ICdbJwotUkJSQUNLRVQgPSAnXScKLVFVT1RFID0gJyInCi1CQUNLU0xBU0ggPSAnXFwnCi1aRVJPID0gJzAnCitDT01NQSA9IGInLCcKK0NPTE9OID0gYic6JworTEJSQUNFID0gYid7JworUkJSQUNFID0gYid9JworTEJSQUNLRVQgPSBiJ1snCitSQlJBQ0tFVCA9IGInXScKK1FVT1RFID0gYiciJworQkFDS1NMQVNIID0gYidcXCcKK1pFUk8gPSBiJzAnCiAKLUVTQ1NFUSA9ICdcXHUwMCcKLUVTQ0FQRV9DSEFSID0gJyJcXGJmbnJ0JwotRVNDQVBFX0NIQVJfVkFMUyA9IFsnIicsICdcXCcsICdcYicsICdcZicsICdcbicsICdccicsICdcdCddCi1OVU1FUklDX0NIQVIgPSAnKy0uMDEyMzQ1Njc4OUVlJworRVNDU0VRMCA9IG9yZCgnXFwnKQorRVNDU0VRMSA9IG9yZCgndScpCitFU0NBUEVfQ0hBUl9WQUxTID0geworICAgICciJzogJ1xcIicsCisgICAgJ1xcJzogJ1xcXFwnLAorICAgICdcYic6ICdcXGInLAorICAgICdcZic6ICdcXGYnLAorICAgICdcbic6ICdcXG4nLAorICAgICdccic6ICdcXHInLAorICAgICdcdCc6ICdcXHQnLAorICAgICMgJy8nOiAnXFwvJywKK30KK0VTQ0FQRV9DSEFSUyA9IHsKKyAgICBiJyInOiAnIicsCisgICAgYidcXCc6ICdcXCcsCisgICAgYidiJzogJ1xiJywKKyAgICBiJ2YnOiAnXGYnLAorICAgIGInbic6ICdcbicsCisgICAgYidyJzogJ1xyJywKKyAgICBiJ3QnOiAnXHQnLAorICAgIGInLyc6ICcvJywKK30KK05VTUVSSUNfQ0hBUiA9IGInKy0uMDEyMzQ1Njc4OUVlJwogCi1DVFlQRVMgPSB7VFR5cGUuQk9PTDogICAgICAgJ3RmJywKLSAgICAgICAgICBUVHlwZS5CWVRFOiAgICAgICAnaTgnLAotICAgICAgICAgIFRUeXBlLkkxNjogICAgICAgICdpMTYnLAotICAgICAgICAgIFRUeXBlLkkzMjogICAgICAgICdpMzInLAotICAgICAgICAgIFRUeXBlLkk2NDogICAgICAgICdpNjQnLAotICAgICAgICAgIFRUeXBlLkRPVUJMRTogICAgICdkYmwnLAotICAgICAgICAgIFRUeXBlLlNUUklORzogICAgICdzdHInLAotICAgICAgICAgIFRUeXBlLlNUUlVDVDogICAgICdyZWMnLAotICAgICAgICAgIFRUeXBlLkxJU1Q6ICAgICAgICdsc3QnLAotICAgICAgICAgIFRUeXBlLlNFVDogICAgICAgICdzZXQnLAotICAgICAgICAgIFRUeXBlLk1BUDogICAgICAgICdtYXAnfQorQ1RZUEVTID0geworICAgIFRUeXBlLkJPT0w6ICd0ZicsCisgICAgVFR5cGUuQllURTogJ2k4JywKKyAgICBUVHlwZS5JMTY6ICdpMTYnLAorICAgIFRUeXBlLkkzMjogJ2kzMicsCisgICAgVFR5cGUuSTY0OiAnaTY0JywKKyAgICBUVHlwZS5ET1VCTEU6ICdkYmwnLAorICAgIFRUeXBlLlNUUklORzogJ3N0cicsCisgICAgVFR5cGUuU1RSVUNUOiAncmVjJywKKyAgICBUVHlwZS5MSVNUOiAnbHN0JywKKyAgICBUVHlwZS5TRVQ6ICdzZXQnLAorICAgIFRUeXBlLk1BUD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NlIENPTU1BKQotICAgICAgc2VsZi5jb2xvbiA9IG5vdCBzZWxmLmNvbG9uCisgICAgZGVmIF9faW5pdF9fKHNlbGYsIHByb3RvY29sKToKKyAgICAgICAgc3VwZXIoSlNPTlBhaXJDb250ZXh0LCBzZWxmKS5fX2luaXRfXyhwcm90b2NvbCkKKyAgICAgICAgc2VsZi5jb2xvbiA9IFRydWUKIAotICBkZWYgd3JpdGUoc2VsZik6Ci0gICAgc2VsZi5kb0lPKHNlbGYucHJvdG9jb2wudHJhbnMud3JpdGUpCisgICAgZGVmIGRvSU8oc2VsZiwgZnVuY3Rpb24pOgorICAgICAgICBpZiBzZWxmLmZpcnN0OgorICAgICAgICAgICAgc2VsZi5maXJzdCA9IEZhbHNlCisgICAgICAgICAgICBzZWxmLmNvbG9uID0gVHJ1ZQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgZnVuY3Rpb24oQ09MT04gaWYgc2VsZi5jb2xvbiBlbHNlIENPTU1BKQorICAgICAgICAgICAgc2VsZi5jb2xvbiA9IG5vdCBzZWxmLmNvbG9uCiAKLSAgZGVmIHJlYWQoc2VsZik6Ci0gICAgc2VsZi5kb0lPKHNlbGYucHJvdG9jb2wucmVhZEpTT05TeW50YXhDaGFyKQorICAgIGRlZiB3cml0ZShzZWxmKToKKyAgICAgICAgc2VsZi5kb0lPKHNlbGYucHJvdG9jb2wudHJhbnMud3JpdGUpCiAKLSAgZGVmIGVzY2FwZU51bShzZWxmKToKLSAgICByZXR1cm4gc2VsZi5jb2xvbgorICAgIGRlZiByZWFkKHNlbGYpOgorICAgICAgICBzZWxmLmRvSU8oc2VsZi5wcm90b2NvbC5yZWFkSlNPTlN5bnRheENoYXIpCiAKLSAgZGVmIF9fc3RyX18oc2VsZik6Ci0gICAgcmV0dXJuICclcywgY29sb249JXMnICUgKHNlbGYuX19jbGFzc19fLl9fbmFtZV9fLCBzZWxmLmNvbG9uKQorICAgIGRlZiBlc2NhcGVOdW0oc2VsZik6CisgICAgICAgIHJld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YWNrWy0xXQogICAgICAgICBlbHNlOgotICAgICAgICAgIG9mZiA9IEVTQ0FQRV9DSEFSLmZpbmQoY2hhcmFjdGVyKQotICAgICAgICAgIGlmIG9mZiA9PSAtMToKKyAgICAgICAgICAgIHNlbGYuY29udGV4dCA9IEpTT05CYXNlQ29udGV4dChzZWxmKQorCisgICAgZGVmIHdyaXRlSlNPTlN0cmluZyhzZWxmLCBzdHJpbmcpOgorICAgICAgICBzZWxmLmNvbnRleHQud3JpdGUoKQorICAgICAgICBqc29uX3N0ciA9IFsnIiddCisgICAgICAgIGZvciBzIGluIHN0cmluZzoKKyAgICAgICAgICAgIGVzY2FwZWQgPSBFU0NBUEVfQ0hBUl9WQUxTLmdldChzLCBzKQorICAgICAgICAgICAganNvbl9zdHIuYXBwZW5kKGVzY2FwZWQpCisgICAgICAgIGpzb25fc3RyLmFwcGVuZCgnIicpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoc3RyX3RvX2JpbmFyeSgnJy5qb2luKGpzb25fc3RyKSkpCisKKyAgICBkZWYgd3JpdGVKU09OTnVtYmVyKHNlbGYsIG51bWJlciwgZm9ybWF0dGVyPSd7MH0nKToKKyAgICAgICAgc2VsZi5jb250ZXh0LndyaXRlKCkKKyAgICAgICAganNOdW1iZXIgPSBzdHIoZm9ybWF0dGVyLmZvcm1hdChudW1iZXIpKS5lbmNvZGUoJ2FzY2lpJykKKyAgICAgICAgaWYgc2VsZi5jb250ZXh0LmVzY2FwZU51bSgpOgorICAgICAgICAgICAgc2VsZi50cmFucy53cml0ZShRVU9URSkKKyAgICAgICAgICAgIHNlbGYudHJhbnMud3JpdGUoanNOdW1iZXIpCisgICAgICAgICAgICBzZWxmLnRyYW5zLndyaXRlKFFVT1RFKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi50cmFucy53cml0ZShqc051bWJlcikKKworICAgIGRlZiB3cml0ZUpTT05CYXNlNjQoc2VsZiwgYmluYXJ5KToKKyAgICAgICAgc2VsZi5jb250ZXh0LndyaXRlKCkKKyAgICAgICAgc2VsZi50cmFucy53cml0ZShRVU9URSkKKyAgICAgICAgc2VsZi50cmFucy53cml0ZShiYXNlNjQuYjY0ZW5jb2RlKGJpbmFyeSkpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoUVVPVEUpCisKKyAgICBkZWYgd3JpdGVKU09OT2JqZWN0U3RhcnQoc2VsZik6CisgICAgICAgIHNlbGYuY29udGV4dC53cml0ZSgpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoTEJSQUNFKQorICAgICAgICBzZWxmLnB1c2hDb250ZXh0KEpTT05QYWlyQ29udGV4dChzZWxmKSkKKworICAgIGRlZiB3cml0ZUpTT05PYmplY3RFbmQoc2VsZik6CisgICAgICAgIHNlbGYucG9wQ29udGV4dCgpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoUkJSQUNFKQorCisgICAgZGVmIHdyaXRlSlNPTkFycmF5U3RhcnQoc2VsZik6CisgICAgICAgIHNlbGYuY29udGV4dC53cml0ZSgpCisgICAgICAgIHNlbGYudHJhbnMud3JpdGUoTEJSQUNLRVQpCisgICAgICAgIHNlbGYucHVzaENvbnRleHQoSlNPTkxpc3RDb250ZXh0KHNlbGYpKQorCisgICAgZGVmIHdyaXRlSlNPTkFycmF5RW5kKHNlbGYpOgorICAgICAgICBzZWxmLnBvcENvbnRleHQoKQorICAgICAgICBzZWxmLnRyYW5zLndyaXRlKFJCUkFDS0VUKQorCisgICAgZGVmIHJlYWRKU09OU3ludGF4Q2hhcihzZWxmLCBjaGFyYWN0ZXIpOgorICAgICAgICBjdXJyZW50ID0gc2VsZi5yZWFkZXIucmVhZCgpCisgICAgICAgIGlmIGNoYXJhY3RlciAhPSBjdXJyZW50OgogICAgICAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4c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ucmVhZCgpKQotICAgIHJldHVybiAnJy5qb2luKG51bWVyaWMpCisgICAgZGVmIF90b0NoYXIoc2VsZiwgaGlnaCwgbG93PU5vbmUpOgorICAgICAgICBpZiBub3QgbG93OgorICAgICAgICAgICAgaWYgc3lzLnZlcnNpb25faW5mb1swXSA9PSAyOgorICAgICAgICAgICAgICAgIHJldHVybiAoIlxcdSUwNHgiICUgaGlnaCkuZGVjb2RlKCd1bmljb2RlLWVzY2FwZScpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmVuY29kZSgndXRmLTgnKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICByZXR1cm4gY2hyKGhpZ2gpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBjb2RlcG9pbnQgPSAoMSA8PCAxNikgKyAoKGhpZ2ggJiAweDNmZikgPDwgMTApCisgICAgICAgICAgICBjb2RlcG9pbnQgKz0gbG93ICYgMHgzZmYKKyAgICAgICAgICAgIGlmIHN5cy52ZXJzaW9uX2luZm9bMF0gPT0gMjoKKyAgICAgICAgICAgICAgICBzID0gIlxcVSUwOHgiICUgY29kZXBvaW50CisgICAgICAgICAgICAgICAgcmV0dXJuIHMuZGVjb2RlKCd1bmljb2RlLWVzY2FwZScpLmVuY29kZSgndXRmLTgnKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICByZXR1cm4gY2hyKGNvZGVwb2ludCkKIAotICBkZWYgcmVhZEpTT05JbnRlZ2VyKHNlbGYpOgotICAgIHNlbGYuY29udGV4dC5yZWFkKCkKLSAgICBzZWxmLnJlYWRKU09OUXVvdGVzKCkKLSAgICBudW1lcmljID0gc2VsZi5yZWFkSlNPTk51bWVyaWNDaGFycygpCi0gICAgc2VsZi5yZWFkSlNPTlF1b3RlcygpCi0gICAgdHJ5OgotICAgICAgcmV0dXJuIGludChudW1lcmljKQotICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgotICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkJhZCBkYXRhIGVuY291bnRlZCBpbiBudW1lcmljIGRhdGEiKQotCi0gIGRlZiByZWFkSlNPTkRvdWJsZShzZWxmKToKLSAgICBzZWxmLmNvbnRleHQucmVhZCgpCi0gICAgaWYgc2VsZi5yZWFkZXIucGVlaygpID09IFFVT1RFOgotICAgICAgc3RyaW5nICA9IHNlbGYucmVhZEpTT05TdHJpbmcoVHJ1ZSkKLSAgICAgIHRyeToKLSAgICAgICAgZG91YmxlID0gZmxvYXQoc3RyaW5nKQotICAgICAgICBpZiAoc2VsZi5jb250ZXh0LmVzY2FwZU51bSBpcyBGYWxzZSBhbmQKLSAgICAgICAgICAgIG5vdCBtYXRoLmlzaW5mKGRvdWJsZSkgYW5kCi0gICAgICAgICAgICBub3QgbWF0aC5pc25hbihkb3VibGUpKToKLSAgICAgICAgICByYWlzZSBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk51bWVyaWMgZGF0YSB1bmV4cGVjdGVkbHkgcXVvdGVkIikKLSAgICAgICAgcmV0dXJuIGRvdWJsZQotICAgICAgZXhjZXB0IFZhbHVlRXJyb3I6Ci0gICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkJhZCBkYXRhIGVuY291bnRlZCBpbiBudW1lcmljIGRhdGEiKQotICAgIGVsc2U6Ci0gICAgICBpZiBzZWxmLmNvbnRleHQuZXNjYXBlTnVtKCkgaXMgVHJ1ZToKKyAgICBkZWYgcmVhZEpTT05TdHJpbmcoc2VsZiwgc2tpcENvbnRleHQpOgorICAgICAgICBoaWdoU3Vycm9nYXRlID0gTm9uZQorICAgICAgICBzdHJpbmcgPSBbXQorICAgICAgICBpZiBza2lwQ29udGV4dCBpcyBGYWxzZToKKyAgICAgICAgICAgIHNlbGYuY29udGV4dC5yZWFkKCkKICAgICAgICAgc2VsZi5yZWFkSlNPTlN5bnRheENoYXIoUVVPVEUpCi0gICAgICB0cnk6Ci0gICAgICAgIHJldHVybiBmbG9hdChzZWxmLnJlYWRKU09OTnVtZXJpY0NoYXJzKCkpCi0gICAgICBleGNlcHQgVmFsdWVFcnJvcjoKLSAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIpCisgICAgICAgIHdoaWxlIFRydWU6CisgICAgICAgICAgICBjaGFyYWN0ZXIgPSBzZWxmLnJlYWRlci5yZWFkKCkKKyAgICAgICAgICAgIGlmIGNoYXJhY3RlciA9PSBRVU9URToKKyAgICAgICAgICAgICAgICBicmVhaworICAgICAgICAgICAgaWYgb3JkKGNoYXJhY3RlcikgPT0gRVNDU0VRMDoKKyAgICAgICAgICAgICAgICBjaGFyYWN0ZXIgPSBzZWxmLnJlYWRlci5yZWFkKCkKKyAgICAgICAgICAgICAgICBpZiBvcmQoY2hhcmFjdGVyKSA9PSBFU0NTRVExOgorICAgICAgICAgICAgICAgICAgICBjaGFyYWN0ZXIgPSBzZWxmLnRyYW5zLnJlYWQoNCkuZGVjb2RlKCdhc2NpaScpCisgICAgICAgICAgICAgICAgICAgIGNvZGV1bml0ID0gaW50KGNoYXJhY3RlciwgMTYpCisgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYuX2lzSGlnaFN1cnJvZ2F0ZShjb2RldW5pdCk6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiBoaWdoU3Vycm9nYXRlOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFByb3RvY29sRXhjZXB0aW9uLklOVkFMSURfREFUQSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGxvdyBzdXJyb2dhdGUgY2hhciIpCisgICAgICAgICAgICAgICAgICAgICAgICBoaWdoU3Vycm9nYXRlID0gY29kZXVuaXQKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlCisgICAgICAgICAgICAgICAgICAgIGVsaWYgc2VsZi5faXNMb3dTdXJyb2dhdGUoY29kZXVuaXQpOgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgbm90IGhpZ2hTdXJyb2dhdGU6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRXhwZWN0ZWQgaGlnaCBzdXJyb2dhdGUgY2hhciIpCisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyYWN0ZXIgPSBzZWxmLl90b0NoYXIoaGlnaFN1cnJvZ2F0ZSwgY29kZXVuaXQpCisgICAgICAgICAgICAgICAgICAgICAgICBoaWdoU3Vycm9nYXRlID0gTm9uZQorICAgICAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgICAgICAgICAgY2hhcmFjdGVyID0gc2VsZi5fdG9DaGFyKGNvZGV1bml0KQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIGlmIGNoYXJhY3RlciBub3QgaW4gRVNDQVBFX0NIQVJTOgorICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkIGNvbnRyb2wgY2hhciIpCisgICAgICAgICAgICAgICAgICAgIGNoYXJhY3RlciA9IEVTQ0FQRV9DSEFSU1tjaGFyYWN0ZXJdCisgICAgICAgICAgICBlbGlmIGNoYXJhY3RlciBpbiBFU0NBUEVfQ0hBUl9WQUxTOgorICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVW5lc2NhcGVkIGNvbnRyb2wgY2hhciIpCisgICAgICAgICAgICBlbGlmIHN5cy52ZXJzaW9uX2luZm9bMF0gPiAyOgorICAgICAgICAgICAgICAgIHV0ZjhfYnl0ZXMgPSBieXRlYXJyYXkoW29yZChjaGFyYWN0ZXIpXSkKKyAgICAgICAgICAgICAgICB3aGlsZSBvcmQoc2VsZi5yZWFkZXIucGVlaygpKSA+PSAweDgwOgorICAgICAgICAgICAgICAgICAgICB1dGY4X2J5dGVzLmFwcGVuZChvcmQoc2VsZi5yZWFkZXIucmVhZCgpKSkKKyAgICAgICAgICAgICAgICBjaGFyYWN0ZXIgPSB1dGY4X2J5dGVzLmRlY29kZSgndXRmOCcpCisgICAgICAgICAgICBzdHJpbmcuYXBwZW5kKGNoYXJhY3RlcikKIAotICBkZWYgcmVhZEpTT05CYXNlNjQoc2VsZik6Ci0gICAgc3RyaW5nID0gc2VsZi5yZWFkSlNPTlN0cmluZyhGYWxzZSkKLSAgICByZXR1cm4gYmFzZTY0LmI2NGRlY29kZShzdHJpbmcpCisgICAgICAgICAgICBpZiBoaWdoU3Vycm9nYXRlOgorICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4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ICAgICAgICAgICAgY2hhcmFjdGVyID0gc2VsZi5yZWFkZXIucGVlaygpCisgICAgICAgICAgICBpZiBzZWxmLmlzSlNPTk51bWVyaWMoY2hhcmFjdGVyKSBpcyBGYWxzZToKKyAgICAgICAgICAgICAgICBicmVhaworICAgICAgICAgICAgbnVtZXJpYy5hcHBlbmQoc2VsZi5yZWFkZXIucmVhZCgpKQorICAgICAgICByZXR1cm4gYicnLmpvaW4obnVtZXJpYykuZGVjb2RlKCdhc2NpaScpCiAKLSAgZGVmIHJlYWRKU09OQXJyYXlFbmQoc2VsZik6Ci0gICAgc2VsZi5yZWFkSlNPTlN5bnRheENoYXIoUkJSQUNLRVQpCi0gICAgc2VsZi5wb3BDb250ZXh0KCkKKyAgICBkZWYgcmVhZEpTT05JbnRlZ2VyKHNlbGYpOgorICAgICAgICBzZWxmLmNvbnRleHQucmVhZCgpCisgICAgICAgIHNlbGYucmVhZEpTT05RdW90ZXMoKQorICAgICAgICBudW1lcmljID0gc2VsZi5yZWFkSlNPTk51bWVyaWNDaGFycygpCisgICAgICAgIHNlbGYucmVhZEpTT05RdW90ZXMoKQorICAgICAgICB0cnk6CisgICAgICAgICAgICByZXR1cm4gaW50KG51bWVyaWMpCisgICAgICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgorICAgICAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkJhZCBkYXRhIGVuY291bnRlZCBpbiBudW1lcmljIGRhdGEiKQorCisgICAgZGVmIHJlYWRKU09ORG91YmxlKHNlbGYpOgorICAgICAgICBzZWxmLmNvbnRleHQucmVhZCgpCisgICAgICAgIGlmIHNlbGYucmVhZGVyLnBlZWsoKSA9PSBRVU9URToKKyAgICAgICAgICAgIHN0cmluZyA9IHNlbGYucmVhZEpTT05TdHJpbmcoVHJ1ZSkKKyAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICBkb3VibGUgPSBmbG9hdChzdHJpbmcpCisgICAgICAgICAgICAgICAgaWYgKHNlbGYuY29udGV4dC5lc2NhcGVOdW0gaXMgRmFsc2UgYW5kCisgICAgICAgICAgICAgICAgICAgICAgICBub3QgbWF0aC5pc2luZihkb3VibGUpIGFuZAorICAgICAgICAgICAgICAgICAgICAgICAgbm90IG1hdGguaXNuYW4oZG91YmxlKSk6CisgICAgICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAiTnVtZXJpYyBkYXRhIHVuZXhwZWN0ZWRseSBxdW90ZWQiKQorICAgICAgICAgICAgICAgIHJldHVybiBkb3VibGUKKyAgICAgICAgICAgIGV4Y2VwdCBWYWx1ZUVycm9yOgorICAgICAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uSU5WQUxJRF9EQVRBLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQmFkIGRhdGEgZW5jb3VudGVkIGluIG51bWVyaWMgZGF0YSIpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBpZiBzZWxmLmNvbnRleHQuZXNjYXBlTnVtKCkgaXMgVHJ1ZToKKyAgICAgICAgICAgICAgICBzZWxmLnJlYWRKU09OU3ludGF4Q2hhcihRVU9URSkKKyAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICByZXR1cm4gZmxvYXQoc2VsZi5yZWFkSlNPTk51bWVyaWNDaGFycygpKQorICAgICAgICAgICAgZXhjZXB0IFZhbHVlRXJyb3I6CisgICAgICAgICAgICAgICAgcmFpc2UgVFByb3RvY29sRXhjZXB0aW9uKFRQcm90b2NvbEV4Y2VwdGlvbi5JTlZBTElEX0RBVEEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJCYWQgZGF0YSBlbmNvdW50ZWQgaW4gbnVtZXJpYyBkYXRhIikKKworICAgIGRlZiByZWFkSlNPTkJhc2U2NChzZWxmKToKKyAgICAgICAgc3RyaW5nID0gc2VsZi5yZWFkSlNPTlN0cmluZyhGYWxzZSkKKyAgICAgICAgc2l6ZSA9IGxlbihzdHJpbmcpCisgICAgICAgIG0gPSBzaXplICUgNAorICAgICAgICAjIEZvcmNlIHBhZGRpbmcgc2luY2UgYjY0ZW5jb2RlIG1ldGhvZCBkb2VzIG5vdCBhbGxvdyBpdAorICAgICAgICBpZiBtICE9IDA6CisgICAgICAgICAgICBmb3IgaSBpbiByYW5nZSg0IC0gbSk6CisgICAgICAgICAgICAgICAgc3RyaW5nICs9ICc9JworICAgICAgICByZXR1cm4gYmFzZTY0LmI2NGRlY29kZShzdHJpbmcpCisKKyAgICBkZWYgcmVhZEpTT05PYmplY3RTdGFydChzZWxmKToKKyAgICAgICAgc2VsZi5jb250ZXh0LnJlYWQoKQorICAgICAgICBzZWxmLnJlYWRKU09OU3ludGF4Q2hhcihMQlJBQ0UpCisgICAgICAgIHNlbGYucHVzaENvbnRleHQoSlNPTlBhaXJDb250ZXh0KHNlbGYpKQorCisgICAgZGVmIHJlYWRKU09OT2JqZWN0RW5kKHNlbGYpOgorICAgICAgICBzZWxmLnJlYWRKU09OU3ludGF4Q2hhcihSQlJBQ0UpCisgICAgICAgIHNlbGYucG9wQ29udGV4dCgpCisKKyAgICBkZWYgcmVhZEpTT05BcnJheVN0YXJ0KHNlbGYpOgorICAgICAgICBzZWxmLmNvbnRleHQucmVhZCgpCisgICAgICAgIHNlbGYucmVhZEpTT05TeW50YXhDaGFyKExCUkFDS0VUKQorICAgICAgICBzZWxmLnB1c2hDb250ZXh0KEpTT05MaXN0Q29udGV4dChzZWxmKSkKKworICAgIGRlZiByZWFkSlNPTkFycmF5RW5kKHNlbGYpOgorICAgICAgICBzZWxmLnJlYWRKU09OU3ludGF4Q2hhcihSQlJBQ0tFVCkKKyAgICAgICAgc2VsZi5wb3BDb250ZXh0KCkKIAogCiBjbGFzcyBUSlNPTlByb3RvY29sKFRKU09OUHJvdG9jb2xCYXNlKToKIAotICBkZWYgcmVhZE1lc3NhZ2VCZWdpbihzZWxmKToKLSAgICBzZWxmLnJlc2V0UmVhZENvbnRleHQoKQotICAgIHNlbGYucmVhZEpTT05BcnJheVN0YXJ0KCkKLSAgICBpZiBzZWxmLnJlYWRKU09OSW50ZWdlcigpICE9IFZFUlNJT046Ci0gICAgICByYWlzZSBUUHJvdG9jb2xFeGNlcHRpb24oVFByb3RvY29sRXhjZXB0aW9uLkJBRF9WRVJTSU9OLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJNZXNzYWdlIGNvbnRhaW5lZCBiYWQgdmVyc2lvbi4iKQotICAgIG5hbWUgPSBzZWxmLnJlYWRKU09OU3RyaW5nKEZhbHNlKQotICAgIHR5cGVuID0gc2VsZi5yZWFkSlNPTkludGVnZXIoKQotICAgIHNlcWlkID0gc2VsZi5yZWFkSlNPTkludGVnZXIoKQotICAgIHJldHVybiAobmFtZSwgdHlwZW4sIHNlcWlkKQorICAgIGRlZiByZWFkTWVzc2FnZUJlZ2luKHNlbGYpOgorICAgICAgICBzZWxmLnJlc2V0UmVhZENvbnRleHQoKQorICAgICAgICBzZWxmLnJlYWRKU09OQXJyYXlTdGFydCgpCisgICAgICAgIGlmIHNlbGYucmVhZEpTT05JbnRlZ2VyKCkgIT0gVkVSU0lPTjoKKyAgICAgICAgICAgIHJhaXNlIFRQcm90b2NvbEV4Y2VwdGlvbihUUHJvdG9jb2xFeGNlcHRpb24uQkFEX1ZFUlNJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk1lc3NhZ2UgY29udGFpbmVkIGJhZCB2ZXJzaW9uLiIpCisgICAgICAgIG5hbWUgPSBzZWxmLnJlYWRKU09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Y2hlY2tJbnRlZ2VyTGltaXRzKGkxNiwgMTYpCisgICAgICAgIHNlbGYud3JpdGVKU09OTnVtYmVyKGkxNikKKworICAgIGRlZiB3cml0ZUkzMihzZWxmLCBpMzIpOgorICAgICAgICBjaGVja0ludGVnZXJMaW1pdHMoaTMyLCAzMikKKyAgICAgICAgc2VsZi53cml0ZUpTT05OdW1iZXIoaTMyKQorCisgICAgZGVmIHdyaXRlSTY0KHNlbGYsIGk2NCk6CisgICAgICAgIGNoZWNrSW50ZWdlckxpbWl0cyhpNjQsIDY0KQorICAgICAgICBzZWxmLndyaXRlSlNPTk51bWJlcihpNjQpCisKKyAgICBkZWYgd3JpdGVEb3VibGUoc2VsZiwgZGJsKToKKyAgICAgICAgIyAxNyBzaWduaWZpY2FudCBkaWdpdHMgc2hvdWxkIGJlIGp1c3QgZW5vdWdoIGZvciBhbnkgZG91YmxlIHByZWNpc2lvbgorICAgICAgICAjIHZhbHVlLgorICAgICAgICBzZWxmLndyaXRlSlNPTk51bWJlcihkYmwsICd7MDouMTdnfScpCisKKyAgICBkZWYgd3JpdGVTdHJpbmcoc2VsZiwgc3RyaW5nKToKKyAgICAgICAgc2VsZi53cml0ZUpTT05TdHJpbmcoc3RyaW5nKQorCisgICAgZGVmIHdyaXRlQmluYXJ5KHNlbGYsIGJpbmFyeSk6CisgICAgICAgIHNlbGYud3JpdGVKU09OQmFzZTY0KGJpbmFyeSkKIAogCi1jbGFzcyBUSlNPTlByb3RvY29sRmFjdG9yeToKK2NsYXNzIFRKU09OUHJvdG9jb2xGYWN0b3J5KG9iamVjdCk6CisgICAgZGVmIGdldFByb3RvY29sKHNlbGYsIHRyYW5zKToKKyAgICAgICAgcmV0dXJuIFRKU09OUHJvdG9jb2wodHJhbnMpCiAKLSAgZGVmIGdldFByb3RvY29sKHNlbGYsIHRyYW5zKToKLSAgICByZXR1cm4gVEpTT05Qcm90b2NvbCh0cmFucykKKyAgICBAcHJvcGVydHkKKyAgICBkZWYgc3RyaW5nX2x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ID0gd3JpdGVJbnRlZ2VyCi0gICAgd3JpdGVJMzIgPSB3cml0ZUludGVnZXIKLSAgICB3cml0ZUk2NCA9IHdyaXRlSW50ZWdlcgotICAgIAorICAgIGRlZiB3cml0ZUJ5dGUoc2VsZiwgYnl0ZSk6CisgICAgICAgIGNoZWNrSW50ZWdlckxpbWl0cyhieXRlLCA4KQorICAgICAgICBzZWxmLndyaXRlSlNPTk51bWJlcihieXRlKQorCisgICAgZGVmIHdyaXRlSTE2KHNlbGYsIGkxNik6CisgICAgICAgIGNoZWNrSW50ZWdlckxpbWl0cyhpMTYsIDE2KQorICAgICAgICBzZWxmLndyaXRlSlNPTk51bWJlcihpMTYpCisKKyAgICBkZWYgd3JpdGVJMzIoc2VsZiwgaTMyKToKKyAgICAgICAgY2hlY2tJbnRlZ2VyTGltaXRzKGkzMiwgMzIpCisgICAgICAgIHNlbGYud3JpdGVKU09OTnVtYmVyKGkzMikKKworICAgIGRlZiB3cml0ZUk2NChzZWxmLCBpNjQpOgorICAgICAgICBjaGVja0ludGVnZXJMaW1pdHMoaTY0LCA2NCkKKyAgICAgICAgc2VsZi53cml0ZUpTT05OdW1iZXIoaTY0KQorCiAgICAgZGVmIHdyaXRlQm9vbChzZWxmLCBib29sZWFuKToKICAgICAgICAgc2VsZi53cml0ZUpTT05OdW1iZXIoMSBpZiBib29sZWFuIGlzIFRydWUgZWxzZSAwKQogCiAgICAgZGVmIHdyaXRlRG91YmxlKHNlbGYsIGRibCk6CiAgICAgICAgIHNlbGYud3JpdGVKU09OTnVtYmVyKGRibCkKLSAgICAKKwogICAgIGRlZiB3cml0ZVN0cmluZyhzZWxmLCBzdHJpbmcpOgogICAgICAgICBzZWxmLndyaXRlSlNPTlN0cmluZyhzdHJpbmcpCi0gICAgICAKKwogICAgIGRlZiB3cml0ZUJpbmFyeShzZWxmLCBiaW5hcnkpOgogICAgICAgICBzZWxmLndyaXRlSlNPTkJhc2U2NChiaW5hcnkpCiAKZGlmZiAtLWdpdCBhL2x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gICAgICAgIHNlbGYuc2tpcChrdHlwZSkKLSAgICAgICAgc2VsZi5za2lwKHZ0eXBlKQotICAgICAgc2VsZi5yZWFkTWFwRW5kKCkKLSAgICBlbGlmIHR0eXBlID09IFRUeXBlLlNFVDoKLSAgICAgIChldHlwZSwgc2l6ZSkgPSBzZWxmLnJlYWRTZXRCZWdpbigpCi0gICAgICBmb3IgaSBpbiB4cmFuZ2Uoc2l6ZSk6Ci0gICAgICAgIHNlbGYuc2tpcChldHlwZSkKLSAgICAgIHNlbGYucmVhZFNldEVuZCgpCi0gICAgZWxpZiB0dHlwZSA9PSBUVHlwZS5MSVNUOgotICAgICAgKGV0eXBlLCBzaXplKSA9IHNlbGYucmVhZExpc3RCZWdpbigpCi0gICAgICBmb3IgaSBpbiB4cmFuZ2Uoc2l6ZSk6Ci0gICAgICAgIHNlbGYuc2tpcChldHlwZSkKLSAgICAgIHNlbGYucmVhZExpc3RFbmQoKQorICAgICAgICAgICAgcmV0dXJuCisgICAgICAgIGVsaWYgdHR5cGUgPT0gVFR5cGUuQk9PTDoKKyAgICAgICAgICAgIHNlbGYucmVhZEJvb2woKQorICAgICAgICBlbGlmIHR0eXBlID09IFRUeXBlLkJZVEU6CisgICAgICAgICAgICBzZWxmLnJlYWRCeXRlKCkKKyAgICAgICAgZWxpZiB0dHlwZSA9PSBUVHlwZS5JMTY6CisgICAgICAgICAgICBzZWxmLnJlYWRJMTYoKQorICAgICAgICBlbGlmIHR0eXBlID09IFRUeXBlLkkzMjoKKyAgICAgICAgICAgIHNlbGYucmVhZEkzMigpCisgICAgICAgIGVsaWYgdHR5cGUgPT0gVFR5cGUuSTY0OgorICAgICAgICAgICAgc2VsZi5yZWFkSTY0KCkKKyAgICAgICAgZWxpZiB0dHlwZSA9PSBUVHlwZS5ET1VCTEU6CisgICAgICAgICAgICBzZWxmLnJlYWREb3VibGUoKQorICAgICAgICBlbGlmIHR0eXBlID09IFRUeXBlLlNUUklORzoKKyAgICAgICAgICAgIHNlbGYucmVhZFN0cmluZygpCisgICAgICAgIGVsaWYgdHR5cGUgPT0gVFR5cGUuU1RSVUNUOgorICAgICAgICAgICAgbmFtZSA9IHNlbGYucmVhZFN0cnVjdEJlZ2luKCkKKyAgICAgICAgICAgIHdoaWxlIFRydWU6CisgICAgICAgICAgICAgICAgKG5hbWUsIHR0eXBlLCBpZCkgPSBzZWxmLnJlYWRGaWVsZEJlZ2luKCkKKyAgICAgICAgICAgICAgICBpZiB0dHlwZSA9PSBUVHlwZS5TVE9QOgorICAgICAgICAgICAgICAgICAgICBicmVhaworICAgICAgICAgICAgICAgIHNlbGYuc2tpcCh0dHlwZSkKKyAgICAgICAgICAgICAgICBzZWxmLnJlYWRGaWVsZEVuZCgpCisgICAgICAgICAgICBzZWxmLnJlYWRTdHJ1Y3RFbmQoKQorICAgICAgICBlbGlmIHR0eXBlID09IFRUeXBlLk1BUDoKKyAgICAgICAgICAgIChrdHlwZSwgdnR5cGUsIHNpemUpID0gc2VsZi5yZWFkTWFwQmVnaW4oKQorICAgICAgICAgICAgZm9yIGkgaW4gcmFuZ2Uoc2l6ZSk6CisgICAgICAgICAgICAgICAgc2VsZi5za2lwKGt0eXBlKQorICAgICAgICAgICAgICAgIHNlbGYuc2tpcCh2dHlwZSkKKyAgICAgICAgICAgIHNlbGYucmVhZE1hcEVuZCgpCisgICAgICAgIGVsaWYgdHR5cGUgPT0gVFR5cGUuU0VUOgorICAgICAgICAgICAgKGV0eXBlLCBzaXplKSA9IHNlbGYucmVhZFNldEJlZ2luKCkKKyAgICAgICAgICAgIGZvciBpIGluIHJhbmdlKHNpemUpOgorICAgICAgICAgICAgICAgIHNlbGYuc2tpcChldHlwZSkKKyAgICAgICAgICAgIHNlbGYucmVhZFNldEVuZCgpCisgICAgICAgIGVsaWYgdHR5cGUgPT0gVFR5cGUuTElTVDoKKyAgICAgICAgICAgIChldHlwZSwgc2l6ZSkgPSBzZWxmLnJlYWRMaXN0QmVnaW4oKQorICAgICAgICAgICAgZm9yIGkgaW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gICgncmVhZERvdWJsZScsICd3cml0ZURvdWJsZScsIEZhbHNlKSwgICMgNCBUVHlwZS5ET1VCTEUKKyAgICAgICAgKE5vbmUsIE5vbmUsIEZhbHNlKSwgICMgNSB1bmRlZmluZWQKKyAgICAgICAgKCdyZWFkSTE2JywgJ3dyaXRlSTE2JywgRmFsc2UpLCAgIyA2IFRUeXBlLkkxNgorICAgICAgICAoTm9uZSwgTm9uZSwgRmFsc2UpLCAgIyA3IHVuZGVmaW5lZAorICAgICAgICAoJ3JlYWRJMzInLCAnd3JpdGVJMzInLCBGYWxzZSksICAjIDggVFR5cGUuSTMyCisgICAgICAgIChOb25lLCBOb25lLCBGYWxzZSksICAjIDkgdW5kZWZpbmVkCisgICAgICAgICgncmVhZEk2NCcsICd3cml0ZUk2NCcsIEZhbHNlKSwgICMgMTAgVFR5cGUuSTY0CisgICAgICAgICgncmVhZFN0cmluZycsICd3cml0ZVN0cmluZycsIEZhbHNlKSwgICMgMTEgVFR5cGUuU1RSSU5HIGFuZCBVVEY3CisgICAgICAgICgncmVhZENvbnRhaW5lclN0cnVjdCcsICd3cml0ZUNvbnRhaW5lclN0cnVjdCcsIFRydWUpLCAgIyAxMiAqLlNUUlVDVAorICAgICAgICAoJ3JlYWRDb250YWluZXJNYXAnLCAnd3JpdGVDb250YWluZXJNYXAnLCBUcnVlKSwgICMgMTMgVFR5cGUuTUFQCisgICAgICAgICgncmVhZENvbnRhaW5lclNldCcsICd3cml0ZUNvbnRhaW5lclNldCcsIFRydWUpLCAgIyAxNCBUVHlwZS5TRVQKKyAgICAgICAgKCdyZWFkQ29udGFpbmVyTGlzdCcsICd3cml0ZUNvbnRhaW5lckxpc3QnLCBUcnVlKSwgICMgMTUgVFR5cGUuTElTVAorICAgICAgICAoTm9uZSwgTm9uZSwgRmFsc2UpLCAgIyAxNiBUVHlwZS5VVEY4ICMgVE9ETzogaGFuZGxlIHV0ZjggdHlwZXM/CisgICAgICAgIChOb25lLCBOb25lLCBGYWxzZSkgICM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jWzBdXQotICAgIGVfd3JpdGVyID0gZ2V0YXR0cihzZWxmLCB3X2hhbmRsZXIpCi0gICAgaWYgbm90IGlzX2NvbnRhaW5lcjoKLSAgICAgIGZvciBlbGVtIGluIHZhbDoKLSAgICAgICAgZV93cml0ZXIoZWxlbSkKLSAgICBlbHNlOgotICAgICAgZm9yIGVsZW0gaW4gdmFsOgotICAgICAgICBlX3dyaXRlcihlbGVtLCBzcGVjWzFdKQotICAgIHNlbGYud3JpdGVMaXN0RW5kKCkKKyAgICBkZWYgcmVhZFN0cnVjdChzZWxmLCBvYmosIHRocmlmdF9zcGVjLCBpc19pbW11dGFibGU9RmFsc2UpOgorICAgICAgICBpZiBpc19pbW11dGFibGU6CisgICAgICAgICAgICBmaWVsZHMgPSB7fQorICAgICAgICBzZWxmLnJlYWRTdHJ1Y3RCZWdpbigpCisgICAgICAgIHdoaWxlIFRydWU6CisgICAgICAgICAgICAoZm5hbWUsIGZ0eXBlLCBmaWQpID0gc2VsZi5yZWFkRmllbGRCZWdpbigpCisgICAgICAgICAgICBpZiBmdHlwZSA9PSBUVHlwZS5TVE9QOgorICAgICAgICAgICAgICAgIGJyZWFrCisgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgZmllbGQgPSB0aHJpZnRfc3BlY1tmaWRdCisgICAgICAgICAgICBleGNlcHQgSW5kZXhFcnJvcjoKKyAgICAgICAgICAgICAgICBzZWxmLnNraXAoZnR5cGUpCisgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgIGlmIGZpZWxkIGlzIG5vdCBOb25lIGFuZCBmdHlwZSA9PSBmaWVsZFsxXToKKyAgICAgICAgICAgICAgICAgICAgZm5hbWUgPSBmaWVsZFsyXQorICAgICAgICAgICAgICAgICAgICBmc3BlYyA9IGZpZWxkWzNdCisgICAgICAgICAgICAgICAgICAgIHZhbCA9IHNlbGYucmVhZEZpZWxkQnlUVHlwZShmdHlwZSwgZnNwZWMpCisgICAgICAgICAgICAgICAgICAgIGlmI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BlYyk6Ci0gICAgcl9oYW5kbGVyLCB3X2hhbmRsZXIsIGlzX2NvbnRhaW5lciA9IHNlbGYuX1RUWVBFX0hBTkRMRVJTW3R0eXBlXQotICAgIHdyaXRlciA9IGdldGF0dHIoc2VsZiwgd19oYW5kbGVyKQotICAgIGlmIGlzX2NvbnRhaW5lcjoKLSAgICAgIHdyaXRlcih2YWwsIHNwZWMpCi0gICAgZWxzZToKLSAgICAgIHdyaXRlcih2YWwpCisgICAgZGVmIHdyaXRlQ29udGFpbmVyTWFwKHNlbGYsIHZhbCwgc3BlYyk6CisgICAgICAgIGt0eXBlLCBrc3BlYywgdnR5cGUsIHZzcGVjLCBfID0gc3BlYworICAgICAgICBzZWxmLndyaXRlTWFwQmVnaW4oa3R5cGUsIHZ0eXBlLCBsZW4odmFsKSkKKyAgICAgICAgZm9yIF8gaW4gemlwKHNlbGYuX3dyaXRlX2J5X3R0eXBlKGt0eXBlLCBzaXguaXRlcmtleXModmFsKSwgc3BlYywga3NwZWMpLAorICAgICAgICAgICAgICAgICAgICAgc2VsZi5fd3JpdGVfYnlfdHR5cGUodnR5cGUsIHNpeC5pdGVydmFsdWVzKHZhbCksIHNwZWMsIHZzcGVjKSk6CisgICAgICAgICAgICBwYXNzCisgICAgICAgIHNlbGYud3JpdGVNYXBFbmQoKQorCisgICAgZGVmIHdyaXRlU3RydWN0KHNlbGYsIG9iaiwgdGhyaWZ0X3NwZWMpOgorICAgICAgICBzZWxmLndyaXRlU3RydWN0QmVnaW4ob2JqLl9fY2xhc3NfXy5fX25hbWVfXykKKyAgICAgICAgZm9yIGZpZWxkIGluIHRocmlmdF9zcGVjOgorICAgICAgICAgICAgaWYgZmllbGQgaXMgTm9uZToKKyAgICAgICAgICAgICAgICBjb250aW51ZQorICAgICAgICAgICAgZm5hbWUgPSBmaWVsZFsyXQorICAgICAgICAgICAgdmFsID0gZ2V0YXR0cihvYmosIGZuYW1lKQorICAgICAgICAgICAgaWYgdmFsIGlzIE5vbmU6CisgICAgICAgICAgICAgICAgIyBza2lwIHdyaXRpbmcgb3V0IHVuc2V0IGZpZWxkcworICAgICAgICAgICAgICAgIGNvbnRpbnVlCisgICAgICAgICAgICBmaWQgPSBmaWVsZFswXQorICAgICAgICAgICAgZnR5cGUgPSBmaWVsZFsxXQorICAgICAgICAgICAgZnNwZWMgPSBmaWVsZFszXQorICAgICAgICAgICAgc2VsZi53cml0ZUZpZWxkQmVnaW4oZm5hbWUsIGZ0eXBlLCBmaWQpCisgICAgICAgICAgICBzZWxmLndyaXRlRmllbGRCeVRUeXBlKGZ0eXBlLCB2YWwsIGZzcGVjKQorICAgICAgICAgICAgc2VsZi53cml0ZUZpZWxkRW5kKCkKKyAgICAgICAgc2VsZi53cml0ZUZpZWxkU3RvcCgpCisgICAgICAgIHNlbGYud3JpdGVTdHJ1Y3RFbmQoKQorCisgICAgZGVmIF93cml0ZV9ieV90dHlwZShzZWxmLCB0dHlwZSwgdmFscywgc3BlYywgZXNwZWMpOgorICAgICAgICBfLCB3cml0ZXJfbmFtZSwgaXNfY29udGFpbmVyID0gc2VsZi5fdHR5cGVfaGFuZGxlcnModHR5cGUsIGVzcGVjKQorICAgICAgICB3cml0ZXJfZnVuYyA9IGdldGF0dHIoc2VsZiwgd3JpdGVyX25hbWUpCisgICAgICAgIHdyaXRlID0gKGxhbWJkYSB2OiB3cml0ZXJfZnVuYyh2LCBlc3BlYykpIGlmIGlzX2NvbnRhaW5lciBlbHNlIHdyaXRlcl9mdW5jCisgICAgICAgIGZvciB2IGluIHZhbHM6CisgICAgICAgICAgICB5aWVsZCB3cml0ZSh2KQorCisgICAgZGVmIHdyaXRlRmllbGRCeVRUeXBlKHNlbGYsIHR0eXBlLCB2YWwsIHNwZWMpOgorICAgICAgICBuZXh0KHNlbGYuX3dyaXRlX2J5X3R0eXBlKHR0eXBlLCBbdmFsXSwgc3BlYywgc3BlYykpCiAKIAotY2xhc3MgVFByb3RvY29sRmFjdG9yeToKLSAgZGVmIGdldFByb3RvY29sKHN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AgICAgICAgIHNlbGYuc2VuZF9yZXNwb25zZSgyMDApCi0gICAgICAgICAgc2VsZi5zZW5kX2hlYWRlcigiY29udGVudC10eXBlIiwgImFwcGxpY2F0aW9uL3gtdGhyaWZ0IikKLSAgICAgICAgICBzZWxmLmVuZF9oZWFkZXJzKCkKLSAgICAgICAgICBzZWxmLndmaWxlLndyaXRlKG90cmFucy5nZXR2YWx1ZSgpKQorICAgICAgICBUU2VydmVyLlRTZXJ2ZXIuX19pbml0X18oc2VsZiwgcHJvY2Vzc29yLCBOb25lLCBOb25lLCBOb25lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnksIG91dHB1dFByb3RvY29sRmFjdG9yeSkKIAotICAgIHNlbGYuaHR0cGQgPSBzZXJ2ZXJfY2xhc3Moc2VydmVyX2FkZHJlc3MsIFJlcXVlc3RIYW5kZXIpCisgICAgICAgIHRodHRwc2VydmVyID0gc2VsZgogCi0gIGRlZiBzZXJ2ZShzZWxmKToKLSAgICBzZWxmLmh0dHBkLnNlcnZlX2ZvcmV2ZXIoKQorICAgICAgICBjbGFzcyBSZXF1ZXN0SGFuZGVyKEJhc2VIVFRQU2VydmVyLkJhc2VIVFRQUmVxdWVzdEhhbmRsZXIpOgorICAgICAgICAgICAgZGVmIGRvX1BPU1Qoc2VsZik6CisgICAgICAgICAgICAgICAgIyBEb24ndCBjYXJlIGFib3V0IHRoZSByZXF1ZXN0IHBhdGguCisgICAgICAgICAgICAgICAgaXRyYW5zID0gVFRyYW5zcG9ydC5URmlsZU9iamVjdFRyYW5zcG9ydChzZWxmLnJmaWxlKQorICAgICAgICAgICAgICAgIG90cmFucyA9IFRUcmFuc3BvcnQuVEZpbGVPYmplY3RUcmFuc3BvcnQoc2VsZi53ZmlsZSkKKyAgICAgICAgICAgICAgICBpdHJhbnMgPSBUVHJhbnNwb3J0LlRCdWZmZXJlZFRyYW5zcG9ydCgKKyAgICAgICAgICAgICAgICAgICAgaXRyYW5zLCBpbnQoc2VsZi5oZWFkZXJzWydDb250ZW50LUxlbmd0aCddKSkKKyAgICAgICAgICAgICAgICBvdHJhbnMgPSBUVHJhbnNwb3J0LlRNZW1vcnlCdWZmZXIoKQorICAgICAgICAgICAgICAgIGlwcm90ID0gdGh0dHBzZXJ2ZXIuaW5wdXRQcm90b2NvbEZhY3RvcnkuZ2V0UHJvdG9jb2woaXRyYW5zKQorICAgICAgICAgICAgICAgIG9wcm90ID0gdGh0dHBzZXJ2ZXIub3V0cHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKG90cmFucykKKyAgICAgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgICAgIHRodHRwc2VydmVyLnByb2Nlc3Nvci5wcm9jZXNzKGlwcm90LCBvcHJvdCkKKyAgICAgICAgICAgICAgICBleGNlcHQgUmVzcG9uc2VFeGNlcHRpb24gYXMgZXhuOgorICAgICAgICAgICAgICAgICAgICBleG4uaGFuZGxlcihzZWxmKQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2VuZF9yZXNwb25zZSgyMDApCisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2VuZF9oZWFkZXIoImNvbnRlbnQtdHlwZSIsICJhcHBsaWNhdGlvbi94LXRocmlmdCIpCisgICAgICAgICAgICAgICAgICAgIHNlbGYuZW5kX2hlYWRlcnMoKQorICAgICAgICAgICAgICAgICAgICBzZWxmLndmaWxlLndyaXRlKG90cmFucy5nZXR2YWx1ZSgpKQorCisgICAgICAgIHNlbGYuaHR0cGQgPSBzZXJ2ZXJfY2xhc3Moc2VydmVyX2FkZHJlc3MsIFJlcXVlc3RIYW5kZXIpCisKKyAgICAgICAgaWYgKGt3YXJncy5nZXQoJ2NhZmlsZScpIG9yIGt3YXJncy5nZXQoJ2NlcnRfZmlsZScpIG9yIGt3YXJncy5nZXQoJ2tleV9maWxlJykpOgorICAgICAgICAgICAgY29udGV4dCA9IHNzbC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HNlbGYuc29ja2V0LnNldGJsb2NraW5nKEZhbHNlKQogICAgICAgICBzZWxmLnN0YXR1cyA9IFdBSVRfTEVOCiAgICAgICAgIHNlbGYubGVuID0gMAotICAgICAgICBzZWxmLm1lc3NhZ2UgPSAnJworICAgICAgICBzZWxmLnJlY2VpdmVkID0gZGVxdWUoKQorICAgICAgICBzZWxmLl9yZWFkaW5nID0gTWVzc2FnZSgwLCA0LCBUcnVlKQorICAgICAgICBzZWxmLl9yYnVmID0gYicnCisgICAgICAgIHNlbGYuX3didWYgPSBiJycKICAgICAgICAgc2VsZi5sb2NrID0gdGhyZWFkaW5nLkxvY2soKQogICAgICAgICBzZWxmLndha2VfdXAgPSB3YWtlX3VwCi0KLSAgICBkZWYgX3JlYWRfbGVuKHNlbGYpOgotICAgICAgICAiIiJSZWFkcyBsZW5ndGggb2YgcmVxdWVzdC4KLQotICAgICAgICBJdCdzIGEgc2FmZXIgYWx0ZXJuYXRpdmUgdG8gc2VsZi5zb2NrZXQucmVjdig0KQotICAgICAgICAiIiIKLSAgICAgICAgcmVhZCA9IHNlbGYuc29ja2V0LnJlY3YoNCAtIGxlbihzZWxmLm1lc3NhZ2UpKQotICAgICAgICBpZiBsZW4ocmVhZCkgPT0gMDoKLSAgICAgICAgICAgICMgaWYgd2UgcmVhZCAwIGJ5dGVzIGFuZCBzZWxmLm1lc3NhZ2UgaXMgZW1wdHksIHRoZW4KLSAgICAgICAgICAgICMgdGhlIGNsaWVudCBjbG9zZWQgdGhlIGNvbm5lY3Rpb24KLSAgICAgICAgICAgIGlmIGxlbihzZWxmLm1lc3NhZ2UpICE9IDA6Ci0gICAgICAgICAgICAgICAgbG9nZ2luZy5lcnJvcigiY2FuJ3QgcmVhZCBmcmFtZSBzaXplIGZyb20gc29ja2V0IikKLSAgICAgICAgICAgIHNlbGYuY2xvc2UoKQotICAgICAgICAgICAgcmV0dXJuCi0gICAgICAgIHNlbGYubWVzc2FnZSArPSByZWFkCi0gICAgICAgIGlmIGxlbih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YWxsaW5nIHRocm91Z2gsIGV2ZW4gdGhvdWdoIHRoZXJlIGlzIGEgZ29vZCBjaGFuY2UgdGhhdAotICAgICAgICAgICAgIyB0aGUgbWVzc2FnZSBpcyBhbHJlYWR5IGF2YWlsYWJsZQotICAgICAgICBlbGlmIHNlbGYuc3RhdHVzID09IFdBSVRfTUVTU0FHRToKLSAgICAgICAgICAgIHJlYWQgPSBzZWxmLnNvY2tldC5yZWN2KHNlbGYubGVuIC0gbGVuKHNlbGYubWVzc2FnZSkpCi0gICAgICAgICAgICBpZiBsZW4ocmVhZCkgPT0gMDoKLSAgICAgICAgICAgICAgICBsb2dnaW5nLmVycm9yKCJjYW4ndCByZWFkIGZyYW1lIGZyb20gc29ja2V0IChnZXQgJWQgb2YgIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiVkIGJ5dGVzKSIgJSAobGVuKHNlbGYubWVzc2FnZSksIHNlbGYubGVuKSkKKyAgICAgICAgYXNzZXJ0IG5vdCBzZWxmLnJlY2VpdmVkCisgICAgICAgIGJ1Zl9zaXplID0gODE5MgorICAgICAgICBmaXJzdCA9IFRydWUKKyAgICAgICAgZG9uZSA9IEZhbHNlCisgICAgICAgIHdoaWxlIG5vdCBkb25lOgorICAgICAgICAgICAgcmVhZCA9IHNlbGYuc29ja2V0LnJlY3YoYnVmX3NpemUpCisgICAgICAgICAgICBybGVuID0gbGVuKHJlYWQpCisgICAgICAgICAgICBkb25lID0gcmxlbiA8IGJ1Zl9zaXplCisgICAgICAgICAgICBzZWxmLl9yYnVmICs9IHJlYWQKKyAgICAgICAgICAgIGlmIGZpcnN0IGFuZCBybGVuID09IDA6CisgICAgICAgICAgICAgICAgaWYgc2VsZi5zdGF0dXMgIT0gV0FJVF9MRU4gb3Igc2VsZi5fcmJ1ZjoKKyAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKCdjb3VsZCBub3QgcmVhZCBmcmFtZSBmcm9tIHNvY2tldCcpCisgICAgICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdyZWFkIHplcm8gbGVuZ3RoLiBjbGllbnQgbWlnaHQgaGF2ZSBkaXNjb25uZWN0ZWQnKQogICAgICAgICAgICAgICAgIHNlbGYuY2xvc2UoKQotICAgICAgICAgICAgICAgIHJldHVybgotICAgICAgICAgICAgc2VsZi5tZXNzYWdlICs9IHJlYWQKLSAgICAgICAgICAgIGlmIGxlbihzZWxmLm1lc3NhZ2UpID09IHNlbGYubGVuOgorICAgICAgICAgICAgd2hpbGUgbGVuKHNlbGYuX3JidWYpID49IHNlbGYuX3JlYWRpbmcuZW5kOgorICAgICAgICAgICAgICAgIGlmIHNlbGYuX3JlYWRpbmcuaXNfaGVhZGVyOgorICAgICAgICAgICAgICAgICAgICBtbGVuLCA9IHN0cnVjdC51bnBhY2soJyFpJywgc2VsZi5fcmJ1Zls6NF0pCisgICAgICAgICAgICAgICAgICAgIHNlbGYuX3JlYWRpbmcgPSBNZXNzYWdlKHNlbGYuX3JlYWRpbmcuZW5kLCBtbGVuLCBGYWxzZSkKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5zdGF0dXMgPSBXQUlUX01FU1NBR0UKKyAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZWFkaW5nLmJ1ZmZlciA9IHNlbGYuX3JidWYKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5yZWNlaXZlZC5hcHBlbmQoc2VsZi5fcmVhZGluZykKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5fcmJ1ZiA9IHNlbGYuX3JidWZbc2VsZi5fcmVhZGluZy5lbmQ6XQorICAgICAgICAgICAgICAgICAgICBzZWxmLl9yZWFkaW5nID0gTWVzc2FnZSgwLCA0LCBUcnVlKQorICAgICAgICAgICAgZmlyc3QgPSBGYWxzZQorICAgICAgICAgICAgaWYgc2VsZi5yZWNlaXZlZDoKICAgICAgICAgICAgICAgICBzZWxmLnN0YXR1cyA9IFdBSVRfUFJPQ0VTUworICAgICAgICAgICAgICAgIGJyZWFrCisgICAgICAgIHNlbGYucmVtYWluaW5nID0gbm90IGRvbmUKIAogICAgIEBzb2NrZXRfZXhjZXB0aW9uCiAgICAgZGVmIHdyaXRlKHNlbGYpOgogICAgICAgICAiIiJXcml0ZXMgZGF0YSBmcm9tIHNvY2tldCBhbmQgc3dpdGNoIHN0YXRlLiIiIgogICAgICAgICBhc3NlcnQgc2VsZi5zdGF0dXMgPT0gU0VORF9BTlNXRVIKLSAgICAgICAgc2VudCA9IHNlbGYuc29ja2V0LnNlbmQoc2VsZi5tZXNzYWdlKQotICAgICAgICBpZiBzZW50ID09IGxlbihzZWxmLm1lc3NhZ2UpOgorICAgICAgICBzZW50ID0gc2VsZi5zb2NrZXQuc2VuZChzZWxmLl93YnVmKQorICAgICAgICBpZiBzZW50ID09IGxlbihzZWxmLl93YnVmKToKICAgICAgICAgICAgIHNlbGYuc3RhdHVzID0gV0FJVF9MRU4KLSAgICAgICAgICAgIHNlbGYubWVzc2FnZSA9ICcnCisgICAgICAgICAgICBzZWxmLl93YnVmID0gYicnCiAgICAgICAgICAgICBzZWxmLmxlbiA9IDAKICAgICAgICAgZWxzZToKLSAgICAgICAgICAgIHNlbGYubWVzc2FnZSA9IHNlbGYubWVzc2FnZVtzZW50Ol0KKyAgICAgICAgICAgIHNlbGYuX3didWYgPSBzZWxmLl93YnVmW3NlbnQ6XQogCiAgICAgQGxvY2tlZAogICAgIGRlZiByZWFkeShzZWxmLCBhbGxfb2ssIG1lc3NhZ2UpOgpAQCAtMTgzLDEzICsxOTQsMTMgQEAKICAgICAgICAgICAgIHNlbGYuY2xvc2UoKQogICAgICAgICAgICAgc2VsZi53YWtlX3VwKCkKICAgICAgICAgICAgIHJldHVybgotICAgICAgICBzZWxmLmxlbiA9ICcnCisgICAgICAgIHNlbGYubGVuID0gMAogICAgICAgICBpZiBsZW4obWVzc2FnZSkgPT0gMDoKICAgICAgICAgICAgICMga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QoJzEnKQorICAgICAgICBzZWxmLl93cml0ZS5zZW5kKGInMScpCiAKICAgICBkZWYgc3RvcChzZWxmKToKICAgICAgICAgIiIiU3RvcCB0aGUgc2VydmVyLgpAQCAtMjg4LDE0ICsyOTksMjAgQEAKICAgICAgICAgIiIiRG9lcyBzZWxlY3Qgb24gb3BlbiBjb25uZWN0aW9ucy4iIiIKICAgICAgICAgcmVhZGFibGUgPSBbc2VsZi5zb2NrZXQuaGFuZGxlLmZpbGVubygpLCBzZWxmLl9yZWFkLmZpbGVubygpXQogICAgICAgICB3cml0YWJsZSA9IFtdCi0gICAgICAgIGZvciBpLCBjb25uZWN0aW9uIGluIHNlbGYuY2xpZW50cy5pdGVtcygpOgorICAgICAgICByZW1haW5pbmcgPSBbXQorICAgICAgICBmb3IgaSwgY29ubmVjdGlvbiBpbiBsaXN0KHNlbGYuY2xpZW50cy5pdGVtcygpKToKICAgICAgICAgICAgIGlmIGNvbm5lY3Rpb24uaXNfcmVhZGFibGUoKToKICAgICAgICAgICAgICAgICByZWFkYWJsZS5hcHBlbmQoY29ubmVjdGlvbi5maWxlbm8oKSkKKyAgICAgICAgICAgICAgICBpZiBjb25uZWN0aW9uLnJlbWFpbmluZyBvciBjb25uZWN0aW9uLnJlY2VpdmVkOgorICAgICAgICAgICAgICAgICAgICByZW1haW5pbmcuYXBwZW5kKGNvbm5lY3Rpb24uZmlsZW5vKCkpCiAgICAgICAgICAgICBpZiBjb25uZWN0aW9uLmlzX3dyaXRlYWJsZSgpOgogICAgICAgICAgICAgICAgIHdyaXRhYmxlLmFwcGVuZChjb25uZWN0aW9uLmZpbGVubygpKQogICAgICAgICAgICAgaWYgY29ubmVjdGlvbi5pc19jbG9zZWQoKToKICAgICAgICAgICAgICAgICBkZWwgc2VsZi5jbGllbnRzW2ldCi0gICAgICAgIHJldHVybiBzZWxlY3Quc2VsZWN0KHJlYWRhYmxlLCB3cml0YWJsZSwgcmVhZGFibGUpCisgICAgICAgIGlmIHJlbWFpbmluZzoKKyAgICAgICAgICAgIHJldHVybiByZW1haW5pbmcsIFtdLCBbXSwgRmFsc2UKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHJldHVybiBzZWxlY3Quc2VsZWN0KHJlYWRhYmxlLCB3cml0YWJsZSwgcmVhZGFibGUpICsgKFRydWUsKQogCiAgICAgZGVmIGhhbmRsZShzZWxmKToKICAgICAgICAgIiIiSGFuZGxlIHJlcXVlc3RzLgpAQCAtMzAzLDIwICszMjAsMjcgQEAKICAgICAgICAgV0FSTklORyEgWW91IG11c3QgY2FsbCBwcmVwYXJlKCkgQkVGT1JFIGNhbGxpbmcgaGFuZGxlKCkKICAgICAgICAgIiIiCiAgICAgICAgIGFzc2VydCBzZWxmLnByZXBhcmVkLCAiWW91IGhhdmUgdG8gY2FsbCBwcmVwYXJlIGJlZm9yZSBoYW5kbGUiCi0gICAgICAgIHJzZXQsIHdzZXQsIHhzZXQgPSBzZWxmLl9zZWxlY3QoKQorICAgICAgICByc2V0LCB3c2V0LCB4c2V0LCBzZWxlY3RlZCA9IHNlbGYuX3NlbGVjdCgpCiAgICAgICAgIGZvciByZWFkYWJsZSBpbiByc2V0OgogICAgICAgICAgICAgaWYgcmVhZGFibGUgPT0gc2VsZi5fcmVhZC5maWxlbm8oKToKICAgICAgICAgICAgICAgICAjIGRvbid0IGNhcmUgaSBqdXN0IG5lZWQgdG8gY2xlYW4gcmVhZGFibGUgZmxhZwogICAgICAgICAgICAgICAgIHNlbGYuX3JlYWQucmVjdigxMDI0KQogICAgICAgICAgICAgZWxpZiByZWFkYWJsZSA9PSBzZWxmLnNvY2tldC5oYW5kbGUuZmlsZW5vKCk6Ci0gICAgICAgICAgICAgICAgY2xpZW50ID0gc2VsZi5zb2NrZXQuYWNjZXB0KCkuaGFuZGxlCi0gICAgICAgICAgICAgICAgc2VsZi5jbGllbnRzW2NsaWVudC5maWxlbm8oKV0gPSBDb25uZWN0aW9uKGNsaWVudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi53YWtlX3VwKQorICAgICAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICAgICAgY2xpZW50ID0gc2VsZi5zb2NrZXQuYWNjZXB0KCkKKyAgICAgICAgICAgICAgICAgICAgaWYgY2xpZW50OgorICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5jbGllbnRzW2NsaWVudC5oYW5kbGUuZmlsZW5vKCldID0gQ29ubmVjdGlvbihjbGllbnQuaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLndha2VfdXApCisgICAgICAgICAgICAgICAgZXhjZXB0IHNvY2tldC5lcnJvcjoKKyAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdlcnJvciB3aGlsZSBhY2NlcHRpbmcnLCBleGNfaW5mbz1UcnVlKQogICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICBjb25uZWN0aW9uID0gc2VsZi5jbGllbnRzW3JlYWRhYmxlXQotICAgICAgICAgICAgICAgIGNvbm5lY3Rpb24ucmVhZCgpCi0gICAgICAgICAgICAgICAgaWYgY29ubmVjdGlvbi5zdGF0dXMgPT0gV0FJVF9QUk9DRVNTOgotICAgICAgICAgICAgICAgICAgICBpdHJhbnNwb3J0ID0gVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKGNvbm5lY3Rpb24ubWVzc2FnZSkKKyAgICAgICAgICAgICAgICBpZiBzZWxlY3RlZDoKKyAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlvbi5yZWFkKCkKKyAgICAgICAgICAgICAgICBpZiBjb25uZWN0aW9uLnJlY2VpdmVkOgorICAgICAgICAgICAgICAgICAgICBjb25uZWN0aW9uLnN0YXR1cyA9IFdBSVRfUFJPQ0VTUworICAgICAgICAgICAgICAgICAgICBtc2cgPSBjb25uZWN0aW9uLnJlY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gICAgICAgICAgICAgICBsb2dnZXIuZXhjZXB0aW9uKHgpCiAKICAgICBkZWYgc2VydmVDbGllbnQoc2VsZiwgY2xpZW50KToKICAgICAgICAgIiIiUHJvY2VzcyBpbnB1dC9vdXRwdXQgZnJvbSBhIGNsaWVudCBmb3IgYXMgbG9uZyBhcyBwb3NzaWJsZSIiIgpAQCAtNzIsMTAgKzc3LDEwIEBACiAgICAgICAgIHRyeToKICAgICAgICAgICAgIHdoaWxlIFRydWU6CiAgICAgICAgICAgICAgICAgc2VsZi5wcm9jZXNzb3IucHJvY2VzcyhpcHJvdCwgb3Byb3QpCi0gICAgICAgIGV4Y2VwdCBUVHJhbnNwb3J0RXhjZXB0aW9uLCB0eDoKKyAgICAgICAgZXhjZXB0IFRUcmFuc3BvcnRFeGNlcHRpb246CiAgICAgICAgICAgICBwYXNzCi0gICAgICAgIGV4Y2VwdCBFeGNlcHRpb24sIHg6Ci0gICAgICAgICAgICBsb2dnaW5nLmV4Y2VwdGlvbih4KQorICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIHg6CisgICAgICAgICAgICBsb2dnZXIuZXhjZXB0aW9uKHgpCiAKICAgICAgICAgaXRyYW5zLmNsb3NlKCkKICAgICAgICAgb3RyYW5zLmNsb3NlKCkKQEAgLTk1LDggKzEwMCw4IEBACiAgICAgICAgICAgICAgICAgdy5kYWVtb24gPSBUcnVlCiAgICAgICAgICAgICAgICAgdy5zdGFydCgpCiAgICAgICAgICAgICAgICAgc2VsZi53b3JrZXJzLmFwcGVuZCh3KQotICAgICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiwgeDoKLSAgICAgICAgICAgICAgICBsb2dnaW5nLmV4Y2VwdGlvbih4KQorICAgICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBhcyB4OgorICAgICAgICAgICAgICAgIGxvZ2dlci5leGNlcHRpb24oeCkKIAogICAgICAgICAjIHdhaXQgdW50aWwgdGhlIGNvbmRpdGlvbiBpcyBzZXQgYnkgc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c2UgaXMgaW4gdGhlIHNhbWUgZGlhbGVjdCB0aGF0CisgICAgICAgICAgICAjIHRoZSBzZXJ2ZXIgZGV0ZWN0ZWQgdGhlIHJlcXVlc3Qgd2FzIGluLgorICAgICAgICAgICAgaWYgaXNpbnN0YW5jZShzZWxmLmlucHV0UHJvdG9jb2xGYWN0b3J5LCBUSGVhZGVyUHJvdG9jb2xGYWN0b3J5KToKKyAgICAgICAgICAgICAgICBvdHJhbnMgPSBOb25lCisgICAgICAgICAgICAgICAgb3Byb3QgPSBpcHJvdAorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICBvdHJhbnMgPSBzZWxmLm91dHB1dFRyYW5zcG9ydEZhY3RvcnkuZ2V0VHJhbnNwb3J0KGNsaWVudCkKKyAgICAgICAgICAgICAgICBvcHJvdCA9IHNlbGYub3V0cHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKG90cmFucykKKworICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICAgIHdoaWxlIFRydWU6CisgICAgICAgICAgICAgICAgICAgIHNlbGYucHJvY2Vzc29yLnByb2Nlc3MoaXByb3QsIG9wcm90KQorICAgICAgICAgICAgZXhjZXB0IFRUcmFuc3BvcnQuVFRyYW5zcG9ydEV4Y2VwdGlvbjoKKyAgICAgICAgICAgICAgICBwYXNzCisgICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIHg6CisgICAgICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbih4KQorCisgICAgICAgICAgICBpdHJhbnMuY2xvc2UoKQorICAgICAgICAgICAgaWYgb3RyYW5zOgorICAgICAgICAgICAgICAgIG90cmFucy5jbG9zZSgpCiAKIAogY2xhc3MgVFRocmVhZGVkU2VydmVyKFRTZXJ2ZXIpOgotICAiIiJUaHJlYWRlZCBzZXJ2ZXIgdGhhdCBzcGF3bnMgYSBuZXcgdGhyZWFkIHBlciBlYWNoIGNvbm5lY3Rpb24uIiIiCisgICAgIiIiVG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wgY2xpZW50KToKKyAgICAgICAgaXRyYW5zID0gc2VsZi5pbnB1dFRyYW5zcG9ydEZhY3RvcnkuZ2V0VHJhbnNwb3J0KGNsaWVudCkKKyAgICAgICAgaXByb3QgPSBzZWxmLmlucHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKGl0cmFucykKIAotICAgIGl0cmFucy5jbG9zZSgpCi0gICAgb3RyYW5zLmNsb3NlKCkKKyAgICAgICAgIyBmb3IgVEhlYWRlclByb3RvY29sLCB3ZSBtdXN0IHVzZSB0aGUgc2FtZSBwcm90b2NvbCBpbnN0YW5jZSBmb3IgaW5wdXQKKyAgICAgICAgIyBhbmQgb3V0cHV0IHNvIHRoYXQgdGhlIHJlc3BvbnNlIGlzIGluIHRoZSBzYW1lIGRpYWxlY3QgdGhhdCB0aGUKKyAgICAgICAgIyBzZXJ2ZXIgZGV0ZWN0ZWQgdGhlIHJlcXVlc3Qgd2FzIGluLgorICAgICAgICBpZiBpc2luc3RhbmNlKHNlbGYuaW5wdXRQcm90b2NvbEZhY3RvcnksIFRIZWFkZXJQcm90b2NvbEZhY3RvcnkpOgorICAgICAgICAgICAgb3RyYW5zID0gTm9uZQorICAgICAgICAgICAgb3Byb3QgPSBpcHJvdAorICAgICAgICBlbHNlOgorICAgICAgICAgICAgb3RyYW5zID0gc2VsZi5vdXRwdXRUcmFuc3BvcnRGYWN0b3J5LmdldFRyYW5zcG9ydChjbGllbnQpCisgICAgICAgICAgICBvcHJvdCA9IHNlbGYub3V0cHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKG90cmFucykKKworICAgICAgICB0cnk6CisgICAgICAgICAgICB3aGlsZSBUcnVlOgorICAgICAgICAgICAgICAgIHNlbGYucHJvY2Vzc29yLnByb2Nlc3MoaXByb3QsIG9wcm90KQorICAgICAgICBleGNlcHQgVFRyYW5zcG9ydC5UVHJhbnNwb3J0RXhjZXB0aW9uOgorICAgICAgICAgICAgcGFzcworICAgICAgICBleGNlcHQgR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gICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBhcyB4OgorICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbih4KQogCi0gICAgIyBQdW1wIHRoZSBzb2NrZXQgZm9yIGNsaWVudHMKLSAgICBzZWxmLnNlcnZlclRyYW5zcG9ydC5saXN0ZW4oKQotICAgIHdoaWxlIFRydWU6Ci0gICAgICB0cnk6Ci0gICAgICAgIGNsaWVudCA9IHNlbGYuc2VydmVyVHJhbnNwb3J0LmFjY2VwdCgpCi0gICAgICAgIHNlbGYuY2xpZW50cy5wdXQoY2xpZW50KQotICAgICAgZXhjZXB0IEV4Y2VwdGlvbiwgeDoKLSAgICAgICAgbG9nZ2luZy5leGNlcHRpb24oeCkKKyAgICAgICAgaXRyYW5zLmNsb3NlKCkKKyAgICAgICAgaWYgb3RyYW5zOgorICAgICAgICAgICAgb3RyYW5zLmNsb3NlKCkKKworICAgIGRlZiBzZXJ2ZShzZWxmKToKKyAgICAgICAgIiIiU3RhcnQgYSBmaXhlZCBudW1iZXIgb2Ygd29ya2VyIHRocmVhZHMgYW5kIHB1dCBjbGllbnQgaW50byBhIHF1ZXVlIiIiCisgICAgICAgIGZvciBpIGluIHJhbmdlKHNlbGYudGhyZWFkcyk6CisgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgdCA9IHRocmVhZGluZy5UaHJlYWQodGFyZ2V0PXNlbGYuc2VydmVUaHJlYWQpCisgICAgICAgICAgICAgICAgdC5zZXREYWVtb24oc2VsZi5kYWVtb24pCisgICAgICAgICAgICAgICAgdC5zdGFydCgpCisgICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIHg6CisgICAgICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbih4KQorCisgICAgICAgICMgUHVtcCB0aGUgc29ja2V0IGZvciBjbGllbnRzCisgICAgICAgIHNlbGYuc2VydmVyVHJhbnNwb3J0Lmxpc3RlbigpCisgICAgICAgIHdoaWxlIFRydWU6CisgICAgIC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ZToKLSAgICAgICAgICAgICAgICBzZWxmLnByb2Nlc3Nvci5wcm9jZXNzKGlwcm90LCBvcHJvdCkKLSAgICAgICAgICAgIGV4Y2VwdCBUVHJhbnNwb3J0LlRUcmFuc3BvcnRFeGNlcHRpb24sIHR4OgotICAgICAgICAgICAgICBwYXNzCi0gICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uLCBlOgotICAgICAgICAgICAgICBsb2dnaW5nLmV4Y2VwdGlvbihlKQotICAgICAgICAgICAgICBlY29kZSA9IDEKLSAgICAgICAgICBmaW5hbGx5OgotICAgICAgICAgICAgdHJ5X2Nsb3NlKGl0cmFucykKLSAgICAgICAgICAgIHRyeV9jbG9zZShvdHJhbnMpCisgICAgICAgICAgICAgICAgZmlsZS5jbG9zZSgpCisgICAgICAgICAgICBleGNlcHQgSU9FcnJvciBhcyBlOgorICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuaW5nKGUsIGV4Y19pbmZvPVRydWUpCiAKLSAgICAgICAgICBvcy5fZXhpdChlY29kZSkKKyAgICAgICAgc2VsZi5zZXJ2ZXJUcmFuc3BvcnQubGlzdGVuKCkKKyAgICAgICAgd2hpbGUgVHJ1ZToKKyAgICAgICAgICAgIGNsaWVudCA9IHNlbGYuc2VydmVyVHJhbnNwb3J0LmFjY2VwdCgpCisgICAgICAgICAgICBpZiBub3QgY2xpZW50OgorICAgICAgICAgICAgICAgIGNvbnRpbnVlCisgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgcGlkID0gb3MuZm9yaygpCiAKLSAgICAgIGV4Y2VwdCBUVHJhbnNwb3J0LlRUcmFuc3BvcnRFeGNlcHRpb24sIHR4OgotICAgICAgICBwYXNzCi0gICAgICBleGNlcHQgRXhjZXB0aW9uLCB4OgotICAgICAgICBsb2dnaW5nLmV4Y2VwdGlvbih4KQorICAgICAgICAgICAgICAgIGlmIHBpZDogICMgcGFyZW50CisgICAgICAgICAgICAgICAgICAgICMgYWRkIGJlZm9yZSBjb2xsZWN0LCBvdGhlcndpc2UgeW91IHJhY2Ugdy8gd2FpdHBpZAorICAgICAgICAgICAgICAgICAgICBzZWxmLmNoaWxkcmVuLmFwcGVuZChwaWQpCisgICAgICAgICAgICAgICAgICAgIHNlbGYuY29sbGVjdF9jaGlsZHJlbigpCiAKLSAgZGVmIGNvbGxlY3RfY2hpbGRyZW4oc2VsZik6Ci0gICAgd2hpbGUgc2VsZi5jaGlsZHJlbjoKLSAgICAgIHRyeToKLSAgICAgICAgcGlkLCBzdGF0dXMgPSBvcy53YWl0cGlkKDAsIG9zLldOT0hBTkcpCi0gICAgICBleGNlcHQgb3MuZXJyb3I6Ci0gICAgICAgIHBpZCA9IE5vbmUKKyAgICAgICAgICAgICAgICAgICAgIyBQYXJlbnQgbXVzdCBjbG9zZSBzb2NrZXQgb3IgdGhlIGNvbm5lY3Rpb24gbWF5IG5vdCBnZXQKKyAgICAgICAgICAgICAgICAgICAgIyBjbG9zZWQgcHJvbXB0bHkKKyAgICAgICAgICAgICAgICAgICAgaXRyYW5zID0gc2VsZi5pbnB1dFRyYW5zcG9ydEZhY3RvcnkuZ2V0VHJhbnNwb3J0KGNsaWVudCkKKyAgICAgICAgICAgICAgICAgICAgb3RyYW5zID0gc2VsZi5vdXRwdXRUcmFuc3BvcnRGYWN0b3J5LmdldFRyYW5zcG9ydChjbGllbnQpCisgICAgICAgICAgICAgICAgICAgIHRyeV9jbG9zZShpdHJhbnMpCisgICAgICAgICAgICAgICAgICAgIHRyeV9jbG9zZShvdHJhbnMpCisgICAgICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgaXRyYW5zID0gc2VsZi5pbnB1dFRyYW5zcG9ydEZhY3RvcnkuZ2V0VHJhbnNwb3J0KGNsaWVudCkKKyAgICAgICAgICAgICAgICAgICAgaXByb3QgPSBzZWxmLmlucHV0UHJvdG9jb2xGYWN0b3J5LmdldFByb3RvY29sKGl0cmFucykKIAotICAgICAgaWYgcGlkOgotICAgICAgICBzZWxmLmNoaWxkcmVuLnJlbW92ZShwaWQpCi0gICAgICBlbHNlOgotICAgICAgICBicmVhaworICAgICAgICAgICAgICAgICAgICAjIGZvciBUSGVhZGVyUHJvdG9jb2wsIHdlIG11c3QgdXNlIHRoZSBzYW1lIHByb3RvY29sCisgICAgICAgICAgICAgICAgICAgICMgaW5zdGFuY2UgZm9yIGlucHV0IGFuZCBvdXRwdXQgc28gdGhhdCB0aGUgcmVzcG9uc2UgaXMgaW4KKyAgICAgICAgICAgICAgICAgICAgIyB0aGUgc2FtZSBkaWFsZWN0IHRoYXQgdGhlIHNlcnZlciBkZXRlY3RlZCB0aGUgcmVxdWVzdCB3YXMKKyAgICAgICAgICAgICAgICAgICAgIyBpbi4KKyAgICAgICAgICAgICAgICAgICAgaWYgaXNpbnN0YW5jZShzZWxmLmlucHV0UHJvdG9jb2xGYWN0b3J5LCBUSGVhZGVyUHJvdG9jb2xGYWN0b3J5KToKKyAgICAgICAgICAgICAgICAgICAgICAgIG90cmFucyA9IE5vbmUKKyAgICAgICAgICAgICAgICAgICAgICAgIG9wcm90ID0gaXByb3QKKyAgICAgICAgICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgICAgIG90cmFucyA9IHNlbGYub3V0cHV0VHJhbnNwb3J0RmFjdG9yeS5nZXRUcmFuc3BvcnQoY2xpZW50KQorICAgICAgICAgICAgICAgICAgICAgICAgb3Byb3QgPSBzZWxmLm91dHB1dFByb3RvY29sRmFjdG9yeS5nZXRQcm90b2NvbChvdHJhbnMpCisKKyAgICAgICAgICAgICAgICAgICAgZWNvZGUgPSAwCisgICAgICAgICAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSBUcnVlOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnByb2Nlc3Nvci5wcm9jZXNzKGlwcm90LCBvcHJvdCkKKyAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2VwdCBUVHJhbnNwb3J0LlRUcmFuc3BvcnRFeGNlcHRpb246CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFzcworICAgICAgICAgICAgICAgICAgICAgICAgZXhjZXB0IEV4Y2VwdGlvbiBhcyBlOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5leGNlcHRpb24oZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBlY29kZSA9IDEKKyAgICAgICAgICAgICAgICAgICAgZmluYWxseToKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeV9jbG9zZShpdHJhbnMpCisgICAgICAgICAgICAgICAgICAgICAgICBpZiBvdHJhbnM6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5X2Nsb3NlKG90cmFucykKKworICAgICAgICAgICAgICAgICAgICBvcy5fZXhpdChlY29kZSkKKworICAgICAgICAgICAgZXhjZXB0IFRUcmFuc3BvcnQuVFRyYW5zcG9ydEV4Y2VwdGlvbjoKKyAgICAgICAgICAgICAgICBwYXNzCisgICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIHg6CisgICAgICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbih4KQorCisgICAgZGVmIGNvbGxlY3RfY2hpbGRyZW4oc2VsZik6CisgICAgICAgIHdoaWxlIHNlbGYuY2hpbGRyZW46CisgICAgICAgICAgICB0cnk6CisgICAgICAgICAgICAgICAgcGlkLCBzdGF0dXMgPSBvcy53YWl0cGlkKDAsIG9zLldOT0hBTkcpCisgICAgICAgICAgICBleGNlcHQgb3MuZXJyb3I6CisgICAgICAgICAgICAgICAgcGlkID0gTm9uZQorCisgICAgICAgICAgICBpZiBwaWQ6CisgICAgICAgICAgICAgICAgc2VsZi5jaGlsZHJlbi5yZW1vdmUocGlkKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICBicmVhawpkaWZmIC0tZ2l0IGEvbGliL3B5L3NyYy90cmFuc3Bv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gPT0gVEhlYWRlckNsaWVudFR5cGUuSEVBREVSUzoKKyAgICAgICAgICAgIHJldHVybiBzZWxmLl9wcm90b2NvbF9pZAorICAgICAgICBlbGlmIHNlbGYuX2NsaWVudF90eXBlIGluIChUSGVhZGVyQ2xpZW50VHlwZS5GUkFNRURfQklOQVJZLCBUSGVhZGVyQ2xpZW50VHlwZS5VTkZSQU1FRF9CSU5BUlkpOgorICAgICAgICAgICAgcmV0dXJuIFRIZWFkZXJTdWJwcm90b2NvbElELkJJTkFSWQorICAgICAgICBlbGlmIHNlbGYuX2NsaWVudF90eXBlIGluIChUSGVhZGVyQ2xpZW50VHlwZS5GUkFNRURfQ09NUEFDVCwgVEhlYWRlckNsaWVudFR5cGUuVU5GUkFNRURfQ09NUEFDVCk6CisgICAgICAgICAgICByZXR1cm4gVEhlYWRlclN1YnByb3RvY29sSUQuQ09NUEFDVAorICAgICAgICBlbHNlOgorICAgICAgICAgICAgcmFpc2UgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICBUVHJhbnNwb3J0RXhjZXB0aW9uLklOVkFMSURfQ0xJRU5UX1RZUEUsCisgICAgICAgICAgICAgICAgIlByb3RvY29sIElEIG5vdCBrbm93IGZvciBjbGllbnQgdHlwZSAlZCIgJSBzZWxmLl9jbGllbnRfdHlwZSwKKyAgICAgICAgICAgICkKKworICAgIGRlZiByZWFkKHNlbGYsIHN6KToKKyAgICAgICAgIyBpZiB0aGVyZSBhcmUgYnl0ZXMgbGVmdCBpbiB0aGUgYnVmZmVyLCBwcm9kdWNlIHRob3NlIGZpcnN0LgorICAgICAgICBieXRlc19yZWFkID0gc2VsZi5fcmVhZF9idWZmZXIucmVhZChzeikKKyAgICAgICAgYnl0ZXNfbGVmdF90b19yZWFkID0gc3ogLSBsZW4oYnl0ZXNfcmVhZCkKKyAgICAgICAgaWYgYnl0ZXNfbGVmdF90b19yZWFkID09IDA6CisgICAgICAgICAgICByZXR1cm4gYnl0ZXNfcmVhZA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5nZShjb3VudCk6CisgICAgICAgICAgICAgICAgICAgIGtleSA9IF9yZWFkU3RyaW5nKGJ1ZmZlcl90cmFuc3BvcnQpCisgICAgICAgICAgICAgICAgICAgIHZhbHVlID0gX3JlYWRTdHJpbmcoYnVmZmVyX3RyYW5zcG9ydCkKKyAgICAgICAgICAgICAgICAgICAgaGVhZGVyc1trZXldID0gdmFsdWUKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgYnJlYWsgICMgaWdub3JlIHVua25vd24gaGVhZGVycworICAgICAgICBzZWxmLl9yZWFkX2hlYWRlcnMgPSBoZWFkZXJzCisKKyAgICAgICAgIyBza2lwIHBhZGRpbmcgLyBhbnl0aGluZyB3ZSBkaWRuJ3QgdW5kZXJzdGFuZAorICAgICAgICBidWZmZXIuc2VlayhlbmRfb2ZfaGVhZGVycykKKworICAgICAgICBwYXlsb2FkID0gYnVmZmVyLnJlYWQoKQorICAgICAgICBmb3IgdHJhbnNmb3JtX2lkIGluIHRyYW5zZm9ybXM6CisgICAgICAgICAgICB0cmFuc2Zvcm1fZm4gPSBSRUFEX1RSQU5TRk9STVNfQllfSURbdHJhbnNmb3JtX2lkXQorICAgICAgICAgICAgcGF5bG9hZCA9IHRyYW5zZm9ybV9mbihwYXlsb2FkKQorICAgICAgICByZXR1cm4gQnVmZmVySU8ocGF5bG9hZCkKKworICAgIGRlZiB3cml0ZShzZWxmLCBidWYpOgorICAgICAgICBzZWxmLl93cml0ZV9idWZmZXIud3JpdGUoYnVmKQorCisgICAgZGVmIGZsdXNoKHNlbGYpOgorICAgICAgICBwYXlsb2FkID0gc2VsZi5fd3JpdGVfYnVmZmVyLmdldHZhbHVlKCkKKyAgICAgICAgc2VsZi5fd3JpdGVfYnVmZmVyID0gQnVmZmVySU8oKQorCisgICAgICAgIGJ1ZmZlciA9IEJ1ZmZlcklPKCkKKyAgICAgICAgaWYgc2VsZi5fY2xpZW50X3R5cGUgPT0gVEhlYWRlckNsaWVudFR5cGUuSEVBREVSUzoKKyAgICAgICAgICAgIGZvciB0cmFuc2Zvcm1faWQgaW4gc2VsZi5fd3JpdGVfdHJhbnNmb3JtczoKKyAgICAgICAgICAgICAgICB0cmFuc2Zvcm1fZm4gPSBXUklURV9UUkFOU0ZPUk1TX0JZX0lEW3RyYW5zZm9ybV9pZF0KKyAgICAgICAgICAgICAgICBwYXlsb2FkID0gdHJhbnNmb3JtX2ZuKHBheWxvYWQpCisKKyAgICAgICAgICAgIGhlYWRlcnMgPSBCdWZmZXJJTygpCisgICAgICAgICAgICB3cml0ZVZhcmludChoZWFkZXJzLCBzZWxmLl9wcm90b2NvbF9pZCkKKyAgICAgICAgICAgIHdyaXRlVmFyaW50KGhlYWRlcnMsIGxlbihzZWxmLl93cml0ZV90cmFuc2Zvcm1zKSkKKyAgICAgICAgICAgIGZvciB0cmFuc2Zvcm1faWQgaW4gc2VsZi5fd3JpdGVfdHJhbnNmb3JtczoKKyAgICAgICAgICAgICAgICB3cml0ZVZhcmludChoZWFkZXJzLCB0cmFuc2Zvcm1faWQpCisgICAgICAgICAgICBpZiBzZWxmLl93cml0ZV9oZWFkZXJzOgorICAgICAgICAgICAgICAgIHdyaXRlVmFyaW50KGhlYWRlcnMsIFRJbmZvSGVhZGVyVHlwZS5LRVlfVkFMVUUpCisgICAgICAgICAgICAgICAgd3JpdGVWYXJpbnQoaGVhZGVycywgbGVuKHNlbGYuX3dyaXRlX2hlYWRlcnMpKQorICAgICAgICAgICAgICAgIGZvciBrZXksIHZhbHVlIGluIHNlbGYuX3dyaXRlX2hlYWRlcnMuaXRlbXMoKToKKyAgICAgICAgICAgICAgICAgICAgX3dyaXRlU3RyaW5nKGhlYWRlcnMsIGtleSkKKyAgICAgICAgICAgICAgICAgICAgX3dyaXRlU3RyaW5nKGhlYWRlcnMsIHZhbHVlKQorICAgICAgICAgICAgICAgIHNlbGYuX3dyaXRlX2hlYWRlcnMgPSB7fQorICAgICAgICAgICAgcGFkZGluZ19uZWVkZWQgPSAoNCAtICh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6CisgICAgICAgICAgICByYWlzZSBUVHJhbnNwb3J0RXhjZXB0aW9uKAorICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb24uSU5WQUxJRF9DTElFTlRfVFlQRSwKKyAgICAgICAgICAgICAgICAiVW5rbm93biBjbGllbnQgdHlwZS4iLAorICAgICAgICAgICAgKQorCisgICAgICAgICMgdGhlIGZyYW1lIGxlbmd0aCBmaWVsZCBkb2Vzbid0IGNvdW50IHRvd2FyZHMgdGhlIGZyYW1lIHBheWxvYWQgc2l6ZQorICAgICAgICBmcmFtZV9ieXRlcyA9IGJ1ZmZlci5nZXR2YWx1ZSgpCisgICAgICAgIGZyYW1lX3BheWxvYWRfc2l6ZSA9IGxlbihmcmFtZV9ieXRlcykgLSA0CisgICAgICAgIGlmIGZyYW1lX3BheWxvYWRfc2l6ZSA+IHNlbGYuX21heF9mcmFtZV9zaXplOgorICAgICAgICAgICAgcmFpc2UgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICBUVHJhbnNwb3J0RXhjZXB0aW9uLlNJWkVfTElNSVQsCisgICAgICAgICAgICAgICAgIkF0dGVtcHRpbmcgdG8gc2VuZCBmcmFtZSB0aGF0IGlzIHRvbyBsYXJnZS4iLAorICAgICAgICAgICAgKQorCisgICAgICAgIHNlbGYuX3RyYW5zcG9ydC53cml0ZShmcmFtZV9ieXRlcykKKyAgICAgICAgc2VsZi5fdHJhbnNwb3J0LmZsdXNoKCkKKworICAgIEBwcm9wZXJ0eQorICAgIGRlZiBjc3RyaW5naW9fYnVmKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5fcmVhZF9idWZmZXIKKworICAgIGRlZiBjc3RyaW5naW9fcmVmaWxsKHNlbGYsIHBhcnRpYWxyZWFkLCByZXFsZW4pOgorICAgICAgICByZXN1bHQgPSBieXRlYXJyYXkocGFydGlhbHJlYWQpCisgICAgICAgIHdoaWxlIGxlbihyZXN1bHQpIDwgcmVxbGVuOgorIC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dGhlIGNsaWVudCdzIGlkZW50aXR5IGJ5IHNwZWNpZnlpbmcgY2VydF9maWxlIGFuZCBrZXlfZmlsZS4gIFRvIHByb3Blcmx5CisgICAgICAgIGF1dGhlbnRpY2F0ZSB0aGUgc2VydmVyLCBzcGVjaWZ5IGVpdGhlciBjYWZpbGUgb3Igc3NsX2NvbnRleHQgd2l0aCBhIENBIGRlZmluZWQuCisgICAgICAgIE5PVEU6IGlmIGJvdGggY2FmaWxlIGFuZCBzc2xfY29udGV4dCBhcmUgZGVmaW5lZCwgc3NsX2NvbnRleHQgd2lsbCBvdmVycmlkZSBjYWZpbGUuCisgICAgICAgICIiIgorICAgICAgICBpZiBwb3J0IGlzIG5vdCBOb25lOgorICAgICAgICAgICAgd2FybmluZ3Mud2FybigKKyAgICAgICAgICAgICAgICAiUGxlYXNlIHVzZSB0aGUgVEh0dHBDbGllbnQoJ2h0dHB7c306Ly9ob3N0OnBvcnQvcGF0aCcpIGNvbnN0cnVjdG9yIiwKKyAgICAgICAgICAgICAgICBEZXByZWNhdGlvbldhcm5pbmcsCisgICAgICAgICAgICAgICAgc3RhY2tsZXZlbD0yKQorICAgICAgICAgICAgc2VsZi5ob3N0ID0gdXJpX29yX2hvc3QKKyAgICAgICAgICAgIHNlbGYucG9ydCA9IHBvcnQKKyAgICAgICAgICAgIGFzc2VydCBwYXRoCisgICAgICAgICAgICBzZWxmLnBhdGggPSBwYXRoCisgICAgICAgICAgICBzZWxmLnNjaGVtZSA9ICdodHRwJworICAgICAgICBlbHNlOgorICAgICAgICAgICAgcGFyc2VkID0gdXJsbGliLnBhcnNlLnVybHBhcnNlKHVyaV9vcl9ob3N0KQorICAgICAgICAgICAgc2VsZi5zY2hlbWUgPSBwYXJzZWQuc2NoZW1lCisgICAgICAgICAgICBhc3NlcnQgc2VsZi5zY2hlbWUgaW4gKCdodHRwJywgJ2h0dHBzJykKKyAgICAgICAgICAgIGlmIHNlbGYuc2NoZW1lID09ICdodHRwJzoKKyAgICAgICAgICAgICAgICBzZWxmLnBvcnQgPSBwYXJzZWQucG9ydCBvciBodHRwX2NsaWVudC5IVFRQX1BPUlQKKyAgICAgICAgICAgIGVsaWYgc2VsZi5zY2hlbWUgPT0gJ2h0dHBzJzoKKyAgICAgICAgICAgICAgICBzZWxmLnBvcnQgPSBwYXJzZWQucG9ydCBvciBodHRwX2NsaWVudC5IVFRQU19QT1JUCisgICAgICAgICAgICAgICAgc2VsZi5jZXJ0ZmlsZSA9IGNlcnRfZmlsZQorICAgICAgICAgICAgICAgIHNlbGYua2V5ZmlsZSA9IGtleV9maWxlCisgICAgICAgICAgICAgICAgc2VsZi5jb250ZXh0ID0gc3NsLmNyZWF0ZV9kZWZhdWx0X2NvbnRleHQoY2FmaWxlPWNhZmlsZSkgaWYgKGNhZmlsZSBhbmQgbm90IHNzbF9jb250ZXh0KSBlbHNlIHNzbF9jb250ZXh0CisgICAgICAgICAgICBzZWxmLmhvc3QgPSBwYXJzZWQuaG9zdG5hbWUKKyAgICAgICAgICAgIHNlbGYucGF0aCA9IHBhcnNlZC5wYXRoCisgICAgICAgICAgICBpZiBwYXJzZWQucXVlcnk6CisgICAgICAgICAgICAgICAgc2VsZi5wYXRoICs9ICc/JXMnICUgcGFyc2VkLnF1ZXJ5CisgICAgICAgIHRyeToKKyAgICAgICAgICAgIHByb3h5ID0gdXJsbGliLnJlcXVlc3QuZ2V0cHJveGllcygpW3NlbGYuc2NoZW1lXQorICAgICAgICBleGNlcHQgS2V5RXJyb3I6CisgICAgICAgICAgICBwcm94eSA9IE5vbmUKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIGlmIHVybGxpYi5yZXF1ZXN0LnByb3h5X2J5cGFzcyhzZWxmLmhvc3QpOgorICAgICAgICAgICAgICAgIHByb3h5ID0gTm9uZQorICAgICAgICBpZiBwcm94eToKKyAgICAgICAgICAgIHBhcnNlZCA9IHVybGxpYi5wYXJzZS51cmxwYXJzZShwcm94eSkKKyAgICAgICAgICAgIHNlbGYucmVhbGhvc3QgPSBzZWxmLmhvc3QKKyAgICAgICAgICAgIHNlbGYucmVhbHBvcnQgPSBzZWxmLnBvcnQKKyAgICAgICAgICAgIHNlbGYuaG9zdCA9IHBhcnNlZC5ob3N0bmFtZQorICAgICAgICAgICAgc2VsZi5wb3J0ID0gcGFyc2VkLnBvcnQKKyAgICAgICAgICAgIHNlbGYucHJveHlfYXV0aCA9IHNlbGYuYmFzaWNfcHJveHlfYXV0aF9oZWFkZXIocGFyc2VkKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi5yZWFsaG9zdCA9IHNlbGYucmVhbHBvcnQgPSBzZWxmLnByb3h5X2F1dGggPSBOb25lCisgICAgICAgIHNlbGYuX193YnVmID0gQnl0ZXNJTygpCisgICAgICAgIHNlbGYuX19odHRwID0gTm9uZQorICAgICAgICBzZWxmLl9faHR0cF9yZXNwb25zZSA9IE5vbmUKKyAgICAgICAgc2VsZi5fX3RpbWVvdXQgPSBOb25lCisgICAgICAgIHNlbGYuX19jdXN0b21faGVhZGVycyA9IE5vbmUKIAotICBkZWYgb3BlbihzZWxmKToKLSAgICBpZiBzZWxmLnNjaGVtZSA9PSAnaHR0cCc6Ci0gICAgICBzZWxmLl9faHR0cCA9IGh0dHBsaWIuSFRUUChzZWxmLmhvc3QsIHNlbGYucG9ydCkKLSAgICBlbHNlOgotICAgICAgc2VsZi5fX2h0dHAgPSBodHRwbGliLkhUVFBTKHNlbGYuaG9zdCwgc2VsZi5wb3J0KQorICAgIEBzdGF0aWNtZXRob2QKKyAgICBkZWYgYmFzaWNfcHJveHlfYXV0aF9oZWFkZXIocHJveHkpOgorICAgICAgICBpZiBwcm94eSBpcyBOb25lIG9yIG5vdCBwcm94eS51c2VybmFtZToKKyAgICAgICAgICAgIHJldHVybiBOb25lCisgICAgICAgIGFwID0gIiVzOiVzIiAlICh1cmxsaWIucGFyc2UudW5xdW90ZShwcm94eS51c2VybmFtZSksCisgICAgICAgICAgICAgICAgICAgICAgICB1cmxsaWIucGFyc2UudW5xdW90ZShwcm94eS5wYXNzd29yZCkpCisgICAgICAgIGNyID0gYmFzZTY0LmI2NGVuY29kZShhcCkuc3RyaXAoKQorICAgICAgICByZXR1cm4gIkJhc2ljICIgKyBjcgogCi0gIGRlZiBjbG9zZShzZWxmKToKLSAgICBzZWxmLl9faHR0cC5jbG9zZSgpCi0gICAgc2VsZi5fX2h0dHAgPSBOb25lCisgICAgZGVmIHVzaW5nX3Byb3h5KHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5yZWFsaG9zdCBpcyBub3QgTm9uZQogCi0gIGRlZiBpc09wZW4oc2VsZik6Ci0gICAgcmV0dXJuIHNlbGYuX19odHRwIGlzIG5vdCBOb25lCisgICAgZGVmIG9wZW4oc2VsZik6CisgICAgICAgIGlmIHNlbGYuc2NoZW1lID09ICdodHRwJzoKKyAgICAgICAgICAgIHNlbGYuX19odHRwID0gaHR0cF9jbGllbnQuSFRUUENvbm5lY3Rpb24oc2VsZi5ob3N0LCBzZWxmLnBvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQ9c2VsZi5fX3RpbWVvdXQpCisgICAgICAgIGVsaWYgc2VsZi5zY2hlbWUgPT0gJ2h0dHBzJzoKKyAgICAgICAgICAgIHNlbGYuX19odHRwID0gaHR0cF9jbGllbnQuSFRUUFNDb25uZWN0aW9uKHNlbGYuaG9zdCwgc2VsZi5wb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5X2ZpbGU9c2VsZi5rZXlmaWxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VydF9maWxlPXNlbGYuY2VydGZpbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0PXNlbGYuX190aW1lb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dD1zZWxmLmNvbnRleHQpCisgICAgICAgIGlmIHNlbGYudXNpbmdfcHJveHkoKToKKyAgICAgICAgICAgIHNlbGYuX19odHRwLnNldF90dW5uZWwoc2VsZi5yZWFsaG9zdCwgc2VsZi5yZWFscG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJQcm94eS1BdXRob3JpemF0aW9uIjogc2VsZi5wcm94eV9hdXRofSkKIAotICBkZWYgc2V0VGltZW91dChzZWxmLCBtcyk6Ci0gICAgaWYgbm90IGhhc2F0dHIoc29ja2V0LCAnZ2V0ZGVmYXVsdHRpbWVvdXQnKToKLSAgICAgIHJhaXNlIE5vdEltcGxlbWVudGVkRXJyb3IKKyAgICBkZWYgY2xvc2Uoc2VsZik6CisgICAgICAgIHNlbGYuX19odHRwLmNsb3NlKCkKKyAgICAgICAgc2VsZi5fX2h0dHAgPSBOb25lCisgICAgICAgIHNlbGYuX19odHRwX3Jlc3BvbnNlID0gTm9uZQogCi0gICAgaWYgbXMgaXMgTm9uZToKLSAgICAgIHNlbGYuX190aW1lb3V0ID0gTm9uZQotICAgIGVsc2U6Ci0gICAgICBzZWxmLl9fdGltZW91dCA9IG1zIC8gMTAwMC4wCisgICAgZGVmIGlzT3BlbihzZWxmKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX19odHRwIGlzIG5vdCBOb25lCiAKLSAgZGVmIHNldEN1c3RvbUhlYWRlcnMoc2VsZiwgaGVhZGVycyk6Ci0gICAgc2VsZi5fX2N1c3RvbV9oZWFkZXJzID0gaGVhZGVycworICAgIGRlZiBzZXRUaW1lb3V0KHNlbGYsIG1zKToKKyAgICAgICAgaWYgbXMgaXMgTm9uZToKKyAgICAgICAgICAgIHNlbGYuX190aW1lb3V0ID0gTm9uZQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi5fX3RpbWVvdXQgPSBtcyAvIDEwMDAuMAogC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GF0ZSBTU0wgJwotICAgICAgICAgICAgICAgICAgICAgICdjZXJ0aWZpY2F0ZXMuJyAlIChjYV9jZXJ0cykpCi0gICAgVFNvY2tldC5UU29ja2V0Ll9faW5pdF9fKHNlbGYsIGhvc3QsIHBvcnQsIHVuaXhfc29ja2V0KQorICBEZWZhdWx0IFNTTCB2ZXJzaW9uLgorICBGb3IgYmFja3dvcmQgY29tcGF0aWJpbGl0eSwgaXQgY2FuIGJlIG1vZGlmaWVkLgorICBVc2UgX19pbml0X18ga2V5d29hcmQgYXJndW1lbnQgInNzbF92ZXJzaW9uIiBpbnN0ZWFkLgorICAiIiIKIAotICBkZWYgb3BlbihzZWxmKToKLSAgICB0cnk6Ci0gICAgICByZXMwID0gc2VsZi5fcmVzb2x2ZUFkZHIoKQotICAgICAgZm9yIHJlcyBpbiByZXMwOgotICAgICAgICBzb2NrX2ZhbWlseSwgc29ja190eXBlID0gcmVzWzA6Ml0KLSAgICAgICAgaXBfcG9ydCA9IHJlc1s0XQotICAgICAgICBwbGFpbl9zb2NrID0gc29ja2V0LnNvY2tldChzb2NrX2ZhbWlseSwgc29ja190eXBlKQotICAgICAgICBzZWxmLmhhbmRsZSA9IHNzbC53cmFwX3NvY2tldChwbGFpbl9zb2NrLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2xfdmVyc2lvbj1zZWxmLlNTTF9WRVJTSU9OLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb19oYW5kc2hha2Vfb25fY29ubmVjdD1UcnVlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYV9jZXJ0cz1zZWxmLmNhX2NlcnRzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlmaWxlPXNlbGYua2V5ZmlsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VydGZpbGU9c2VsZi5jZXJ0ZmlsZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VydF9yZXFzPXNlbGYuY2VydF9yZXFzKQotICAgICAgICBzZWxmLmhhbmRsZS5zZXR0aW1lb3V0KHNlbGYuX3RpbWVvdXQpCisgICAgZGVmIF9kZXByZWNhdGVkX2FyZyhzZWxmLCBhcmdzLCBrd2FyZ3MsIHBvcywga2V5KToKKyAgICAgICAgaWYgbGVuKGFyZ3MpIDw9IHBvczoKKyAgICAgICAgICAgIHJldHVybgorICAgICAgICByZWFsX3BvcyA9IHBvcyArIDMKKyAgICAgICAgd2FybmluZ3Mud2FybigKKyAgICAgICAgICAgICclZHRoIHBvc2l0aW9uYWwgYXJndW1lbnQgaXMgZGVwcmVjYXRlZC4nCisgICAgICAgICAgICAncGxlYXNlIHVzZSBrZXl3YXJkIGFyZ3VtZW50IGluc3RlYW5kLicKKyAgICAgICAgICAgICUgcmVhbF9wb3MsIERlcHJlY2F0aW9uV2FybmluZywgc3RhY2tsZXZlbD0zKQorCisgICAgICAgIGlmIGtleSBpbiBrd2FyZ3M6CisgICAgICAgICAgICByYWlzZSBUeXBlRXJyb3IoCisgICAgICAgICAgICAgICAgJ0R1cGxpY2F0ZSBhcmd1bWVudDogJWR0aCBhcmd1bWVudCBhbmQgJXMga2V5d2FyZCBhcmd1bWVudC4nCisgICAgICAgICAgICAgICAgJSAocmVhbF9wb3MsIGtleSkpCisgICAgICAgIGt3YXJnc1trZXldID0gYXJnc1twb3NdCisKKyAgICBkZWYgX3VuaXhfc29ja2V0X2FyZyhzZWxmLCBob3N0LCBwb3J0LCBhcmdzLCBrd2FyZ3MpOgorICAgICAgICBrZXkgPSAndW5peF9zb2NrZXQnCisgICAgICAgIGlmIGhvc3QgaXMgTm9uZSBhbmQgcG9ydCBpcyBOb25lIGFuZCBsZW4oYXJncykgPT0gMSBhbmQga2V5IG5vdCBpbiBrd2FyZ3M6CisgICAgICAgICAgICBrd2FyZ3Nba2V5XSA9IGFyZ3NbMF0KKyAgICAgICAgICAgIHJldHVybiBUcnVlCisgICAgICAgIHJldHVybiBGYWxzZQorCisgICAgZGVmIF9fZ2V0YXR0cl9fKHNlbGYsIGtleSk6CisgICAgICAgIGlmIGtleSA9PSAnU1NMX1ZFUlNJT04nOgorICAgICAgICAgICAgd2FybmluZ3Mud2FybigKKyAgICAgICAgICAgICAgICAnU1NMX1ZFUlNJT04gaXMgZGVwcmVjYXRlZC4nCisgICAgICAgICAgICAgICAgJ3BsZWFzZSB1c2Ugc3NsX3ZlcnNpb24gYXR0cmlidXRlIGluc3RlYWQuJywKKyAgICAgICAgICAgICAgICBEZXByZWNhdGlvbldhcm5pbmcsIHN0YWNrbGV2ZWw9MikKKyAgICAgICAgICAgIHJldHVybiBzZWxmLnNzbF92ZXJzaW9uCisKKyAgICBkZWYgX19pbml0X18oc2VsZiwgc2VydmVyX3NpZGUsIGhvc3QsIHNzbF9vcHRzKToKKyAgICAgICAgc2VsZi5fc2VydmVyX3NpZGUgPSBzZXJ2ZXJfc2lkZQorICAgICAgICBpZiBUU1NMQmFzZS5TU0xfVkVSU0lPTiAhPSBzZWxmLl9kZWZhdWx0X3Byb3RvY29sOgorICAgICAgICAgICAgd2FybmluZ3Mud2FybigKKyAgICAgICAgICAgICAgICAnU1NMX1ZFUlNJT04gaXMgZGVwcmVjYXRlZC4nCisgICAgICAgICAgICAgICAgJ3BsZWFzZSB1c2Ugc3NsX3ZlcnNpb24ga2V5d2FyZCBhcmd1bWVudCBpbnN0ZWFkLicsCisgICAgICAgICAgICAgICAgRGVwcmVjYXRpb25XYXJuaW5nLCBzdGFja2xldmVsPTIpCisgICAgICAgIHNlbGYuX2NvbnRleHQgPSBzc2xfb3B0cy5wb3AoJ3NzbF9jb250ZXh0JywgTm9uZSkKKyAgICAgICAgc2VsZi5fc2VydmVyX2hvc3RuYW1lID0gTm9uZQorICAgICAgICBpZiBub3Qgc2VsZi5fc2VydmVyX3NpZGU6CisgICAgICAgICAgICBzZWxmLl9zZXJ2ZXJfaG9zdG5hbWUgPSBzc2xfb3B0cy5wb3AoJ3NlcnZlcl9ob3N0bmFtZScsIGhvc3QpCisgICAgICAgIGlmIHNlbGYuX2NvbnRleHQ6CisgICAgICAgICAgICBzZWxmLl9jdXN0b21fY29udGV4dCA9IFRydWUKKyAgICAgICAgICAgIGlmIHNzbF9vcHRzOgorICAgICAgICAgICAgICAgIHJhaXNlIFZhbHVlRXJyb3IoCisgICAgICAgICAgICAgICAgICAgICdJbmNvbXBhdGlibGUgYXJndW1lbnRzOiBzc2xfY29udGV4dCBhbmQgJXMnCisgICAgICAgICAgICAgICAgICAgICUgJyAnLmpvaW4oc3NsX29wdHMua2V5cygpKSkKKyAgICAgICAgICAgIGlmIG5vdCBzZWxmLl9oYXNfc3NsX2NvbnRleHQ6CisgICAgICAgICAgICAgICAgcmFpc2UgVmFsdWVFcnJvcigKKyAgICAgICAgICAgICAgICAgICAgJ3NzbF9jb250ZXh0IGlzIG5vdCBhdmFpbGFibGUgZm9yIHRoaXMgdmVyc2lvbiBvZiBQeXRob24nKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi5fY3VzdG9tX2NvbnRleHQgPSBGYWxzZQorICAgICAgICAgICAgc3NsX3ZlcnNpb24gPSBzc2xfb3B0cy5wb3AoJ3NzbF92ZXJzaW9uJywgVFNTTEJhc2UuU1NMX1ZFUlNJT04pCisgICAgICAgICAgICBzZWxmLl9pbml0X2NvbnRleHQoc3NsX3ZlcnNpb24pCisgICAgICAgICAgICBzZWxmLmNlcnRfcmVxcyA9IHNzbF9vcHRzLnBvcCgnY2VydF9yZXFzJywgc3NsLkNFUlRfUkVRVUlSRUQpCisgICAgICAgICAgICBzZWxmLmNhX2NlcnRzID0gc3NsX29wdHMucG9wKCdjYV9jZXJ0cycsIE5vbmUpCisgICAgICAgICAgICBzZWxmLmtleWZpbGUgPSBzc2xfb3B0cy5wb3AoJ2tleWZpbGUnLCBOb25lKQorICAgICAgICAgICAgc2VsZi5jZXJ0ZmlsZSA9IHNzbF9vcHRzLnBvcCgnY2VydGZpbGUnLCBOb25lKQorICAgICAgICAgICAgc2VsZi5jaXBoZXJzID0gc3NsX29wdHMucG9wKCdjaXBoZXJzJywgTm9uZSkKKworICAgICAgICAgICAgaWYgc3NsX29wdHM6CisgICAgICAgICAgICAgICAgcmFpc2UgVmFsdWVFcnJvcigKKyAgICAgICAgICAgICAgICAgICAgJ1Vua25vd24ga2V5d29yZCBhcmd1bWVudHM6ICcsICcgJy5qb2luKHNzbF9vcHRzLmtleXMoKSkpCisKKyAgICAgICAgICAgIGlmIHNlbGYuX3Nob3VsZF92ZXJpZnk6CisgICAgICAgICAgICAgICAgaWYgbm90IHNlbGYuY2FfY2VydHM6CisgICAgICAgICAgICAgICAgICAgIHJhaXNlIFZhbHVlRXJyb3IoCisgICAgICAgICAgICAgICAgICAgICAgICAnY2FfY2VydHMgaXMgbmVlZGVkIHdoZW4gY2VydF9yZXFzIGlzIG5vdCBzc2wuQ0VSVF9OT05FJykKKyAgICAgICAgICAgICAgICBpZiBub3Qgb3MuYWNjZXNzKHNlbGYuY2FfY2VydHMsIG9zLlJfT0spOgorICAgICAgICAgICAgICAgICAgICByYWlzZSBJT0Vycm9yKCdDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgY2FfY2VydHMgZmlsZSAiJXMiICcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaXMgbm90IHJlYWRhYmxlLCBjYW5ub3QgdmFsaWRhdGUgU1NMICcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2VydGlmaWNhdGVzLicgJSAoc2VsZi5jYV9jZXJ0cykpCisKKyAgICBAcHJvcGVydHkKKyAgICBkZWYgY2VydGZpbGUoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9jZXJ0ZmlsZQorCisgICAgQGNlcnRmaWxlLnNldHRlcgorICAgIGRlZiBjZXJ0ZmlsZShzZWxmLCBjZXJ0ZmlsZSk6CisgICAgICAgIGlmIHNlbGYuX3NlcnZlcl9zaWRlIGFuZCBub3QgY2VydGZpbGU6CisgICAgICAgICAgICByYWlzZSBWYWx1ZUVycm9yKCdjZXJ0ZmlsZSBpcyBuZWVkZWQgZm9yIHNlcnZlci1zaWRlJykKKyAgICAgICAgaWYgY2VydGZpbGUgYW5kIG5vdCBvcy5hY2Nlc3MoY2VydGZpbGUsIG9zLlJfT0spOgorICAgICAgICAgICAgcmFpc2UgSU9FcnJvcignTm8gc3VjaCBjZXJ0ZmlsZSBmb3VuZDogJXMnICUgKGNlcnRmaWxlKSkKKyAgICAgICAgc2VsZi5fY2VydGZpbGUgPSBjZXJ0ZmlsZQorCisgICAgZGVmIF93cmFwX3NvY2tldChzZWxmLCBzb2NrKToKKyAgICAgICAgaWYgc2VsZi5faGFzX3NzbF9jb250ZXh0OgorICAgICAgICAgICAgaWYgbm90IHNlbGYuX2N1c3RvbV9jb250ZXh0OgorICAgICAgICAgICAgICAgIHNlbGYuc3NsX2NvbnRleHQudmVyaWZ5X21vZGUgPSBzZWxmLmNlcnRfcmVxcworICAgICAgICAgICAgICAgIGlmIHNlbGYuY2VydGZpbGU6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc3NsX2NvbnRleHQubG9hZF9jZXJ0X2NoYWluKHNlbGYuY2VydGZpbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYua2V5ZmlsZSkKKyAgICAgICAgICAgICAgICBpZiBzZWxmLmNpcGhlcnM6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc3NsX2NvbnRleHQuc2V0X2NpcGhlcnMoc2VsZi5jaXBoZXJzKQorICAgICAgICAgICAgICAgIGlmIHNlbGYuY2FfY2VydHM6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc3NsX2NvbnRleHQubG9hZF92ZXJpZnlfbG9jYXRpb25zKHNlbGYuY2FfY2VydHMpCisgICAgICAgICAgICByZXR1cm4gc2VsZi5zc2xfY29udGV4dC53cmFwX3NvY2tldCgKKyAgICAgICAgICAgICAgICBzb2NrLCBzZXJ2ZXJfc2lkZT1zZWxmLl9zZXJ2ZXJfc2lkZSwKKyAgICAgICAgICAgICAgICBzZXJ2ZXJfaG9zdG5hbWU9c2VsZi5fc2VydmVyX2hvc3RuYW1lKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc3NsX29wdHMgPSB7CisgICAgICAgICAgICAgICAgJ3NzbF92ZXJzaW9uJzogc2VsZi5fc3NsX3ZlcnNpb24sCisgICAgICAgICAgICAgICAgJ3NlcnZlcl9zaWRlJzogc2VsZi5fc2VydmVyX3NpZGUsCisgICAgICAgICAgICAgICAgJ2NhX2NlcnRzJzogc2VsZi5jYV9jZXJ0cywKKyAgICAgICAgICAgICAgICAna2V5ZmlsZSc6IHNlbGYua2V5ZmlsZSwKKyAgICAgICAgICAgICAgICAnY2VydGZpbGUnOiBzZWxmLmNlcnRmaWxlLAorICAgICAgICAgICAgICAgICdjZXJ0X3JlcXMnOiBzZWxmLmNlcnRfcmVxcywKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIHNlbGYuY2lwaGVyczoKKyAgICAgICAgICAgICAgICBpZiBzZWxmLl9oYXNfY2lwaGVyczoKKyAgICAgICAgICAgICAgICAgICAgc3NsX29wdHNbJ2NpcGhlcnMnXSA9IHNlbGYuY2lwaGVycworICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuaW5nKAorICAgICAgICAgICAgICAgICAgICAgICAgJ2NpcGhlcnMgaXMgc3BlY2lmaWVkIGJ1dCBpZ25vcmVkIGR1ZSB0byBvbGQgUHl0aG9uIHZlcnNpb24nKQorICAgICAgICAgICAgcmV0dXJuIHNzbC53cmFwX3NvY2tldChzb2NrLCAqKnNzbF9vcHRzKQorCisKK2NsYXNzIFRTU0xTb2NrZXQoVFNvY2tldC5UU29ja2V0LCBUU1NMQmFzZSk6CisgICAgIiIiCisgICAgU1NMIGltcGxlbWVudGF0aW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ICAgICAgICAgICAgICAgICAgICAgIGBgc2VydmVyX2hvc3RuYW1lYGAgKFB5dGhvbiAyLjcuOSBvciBsYXRlcikKKyAgICAgICAgUGFzc2VkIHRvIHNzbC53cmFwX3NvY2tldC4gU2VlIHNzbC53cmFwX3NvY2tldCBkb2N1bWVudGF0aW9uLgorCisgICAgICAgIEFsdGVybmF0aXZlIGtleXdvcmQgYXJndW1lbnRzOiAoUHl0aG9uIDIuNy45IG9yIGxhdGVyKQorICAgICAgICAgIGBgc3NsX2NvbnRleHRgYDogc3NsLlNTTENvbnRleHQgdG8gYmUgdXNlZCBmb3IgU1NMQ29udGV4dC53cmFwX3NvY2tldAorICAgICAgICAgIGBgc2VydmVyX2hvc3RuYW1lYGA6IFBhc3NlZCB0byBTU0xDb250ZXh0LndyYXBfc29ja2V0CisKKyAgICAgICAgQ29tbW9uIGtleXdvcmQgYXJndW1lbnQ6CisgICAgICAgICAgYGB2YWxpZGF0ZV9jYWxsYmFja2BgIChjZXJ0LCBob3N0bmFtZSkgLT4gTm9uZToKKyAgICAgICAgICAgICAgQ2FsbGVkIGFmdGVyIFNTTCBoYW5kc2hha2UuIENhbiByYWlzZSB3aGVuIGhvc3RuYW1lIGRvZXMgbm90CisgICAgICAgICAgICAgIG1hdGNoIHRoZSBjZXJ0LgorICAgICAgICAiIiIKKyAgICAgICAgc2VsZi5pc192YWxpZCA9IEZhbHNlCisgICAgICAgIHNlbGYucGVlcmNlcnQgPSBOb25lCisKKyAgICAgICAgaWYgYXJnczoKKyAgICAgICAgICAgIGlmIGxlbihhcmdzKSA+IDY6CisgICAgICAgICAgICAgICAgcmFpc2UgVHlwZUVycm9yKCdUb28gbWFueSBwb3NpdGlvbmFsIGFyZ3VtZW50JykKKyAgICAgICAgICAgIGlmIG5vdCBzZWxmLl91bml4X3NvY2tldF9hcmcoaG9zdCwgcG9ydCwgYXJncywga3dhcmdzKToKKyAgICAgICAgICAgICAgICBzZWxmLl9kZXByZWNhdGVkX2FyZyhhcmdzL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F9kb19vcGVuKHNlbGYsIGZhbWlseSwgc29ja3R5cGUpOgorICAgICAgICBwbGFpbl9zb2NrID0gc29ja2V0LnNvY2tldChmYW1pbHksIHNvY2t0eXBlKQogICAgICAgICB0cnk6Ci0gICAgICAgICAgc2VsZi5oYW5kbGUuY29ubmVjdChpcF9wb3J0KQotICAgICAgICBleGNlcHQgc29ja2V0LmVycm9yLCBlOgotICAgICAgICAgIGlmIHJlcyBpcyBub3QgcmVzMFstMV06Ci0gICAgICAgICAgICBjb250aW51ZQotICAgICAgICAgIGVsc2U6Ci0gICAgICAgICAgICByYWlzZSBlCi0gICAgICAgIGJyZWFrCi0gICAgZXhjZXB0IHNvY2tldC5lcnJvciwgZToKLSAgICAgIGlmIHNlbGYuX3VuaXhfc29ja2V0OgotICAgICAgICBtZXNzYWdlID0gJ0NvdWxkIG5vdCBjb25uZWN0IHRvIHNlY3VyZSBzb2NrZXQgJXM6ICVzJyBcCi0gICAgICAgICAgICAgICAgJSAoc2VsZi5fdW5peF9zb2NrZXQsIGUpCi0gICAgICBlbHNlOgotICAgICAgICBtZXNzYWdlID0gJ0NvdWxkIG5vdCBjb25uZWN0IHRvICVzOiVkOiAlcycgJSAoc2VsZi5ob3N0LCBzZWxmLnBvcnQsIGUpCi0gICAgICByYWlzZSBUVHJhbnNwb3J0RXhjZXB0aW9uKHR5cGU9VFRyYW5zcG9ydEV4Y2VwdGlvbi5OT1RfT1BFTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZT1tZXNzYWdlKQotICAgIGlmIHNlbGYudmFsaWRhdGU6Ci0gICAgICBzZWxmLl92YWxpZGF0ZV9jZXJ0KCkKKyAgICAgICAgICAgIHJldHVybiBzZWxmLl93cmFwX3NvY2tldChwbGFpbl9zb2NrKQorICAgICAgICBleGNlcHQgRXhjZXB0aW9uOgorICAgICAgICAgICAgcGxhaW5fc29jay5jbG9zZSgpCisgICAgICAgICAgICBtc2cgPSAnZmFpbGVkIHRvIGlua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yLjcuOSBvciBsYXRlcikKKyAgICAgICAgICBgYHNzbF9jb250ZXh0YGA6IHNzbC5TU0xDb250ZXh0IHRvIGJlIHVzZWQgZm9yIFNTTENvbnRleHQud3JhcF9zb2NrZXQKKyAgICAgICAgICBgYHNlcnZlcl9ob3N0bmFtZWBgOiBQYXNzZWQgdG8gU1NMQ29udGV4dC53cmFwX3NvY2tldAogCi0gIGRlZiBfX2luaXRfXyhzZWxmLAotICAgICAgICAgICAgICAgaG9zdD1Ob25lLAotICAgICAgICAgICAgICAgcG9ydD05MDkwLAotICAgICAgICAgICAgICAgY2VydGZpbGU9J2NlcnQucGVtJywKLSAgICAgICAgICAgICAgIHVuaXhfc29ja2V0PU5vbmUpOgotICAgICIiIkluaXRpYWxpemUgYSBUU1NMU2VydmVyU29ja2V0CisgICAgICAgIENvbW1vbiBrZXl3b3JkIGFyZ3VtZW50OgorICAgICAgICAgIGBgdmFsaWRhdGVfY2FsbGJhY2tgYCAoY2VydCwgaG9zdG5hbWUpIC0+IE5vbmU6CisgICAgICAgICAgICAgIENhbGxlZCBhZnRlciBTU0wgaGFuZHNoYWtlLiBDYW4gcmFpc2Ugd2hlbiBob3N0bmFtZSBkb2VzIG5vdAorICAgICAgICAgICAgICBtYXRjaCB0aGUgY2VydC4KKyAgICAgICAgIiIiCisgICAgICAgIGlmIGFyZ3M6CisgICAgICAgICAgICBpZiBsZW4oYXJncykgPiAzOgorICAgICAgICAgICAgICAgIHJhaXNlIFR5cGVFcnJvcignVG9vIG1hbnkgcG9zaXRpb25hbCBhcmd1bWVudCcpCisgICAgICAgICAgICBpZiBub3Qgc2VsZi5fdW5peF9zb2NrZXRfYXJnKGhvc3QsIHBvcnQsIGFyZ3MsIGt3YXJncyk6CisgICAgICAgICAgICAgICAgc2VsZi5fZGVwcmVjYXRlZF9hcmcoYXJncywga3dhcmdzLCAwLCAnY2VydGZpbGUnKQorICAgICAgICAgICAgc2VsZi5fZGVwcmVjYXRlZF9hcmcoYXJncywga3dhcmd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Vycm9yLCBPU0Vycm9yKToKKyAgICAgICAgICAgIGxvZ2dlci5leGNlcHRpb24oJ0Vycm9yIHdoaWxlIGFjY2VwdGluZyBmcm9tICVzJywgYWRkcikKKyAgICAgICAgICAgICMgZmFpbGVkIGhhbmRzaGFrZS9zc2wgd3JhcCwgY2xvc2Ugc29ja2V0IHRvIGNsaWVudAorICAgICAgICAgICAgcGxhaW5fY2xpZW50LmNsb3NlKCkKKyAgICAgICAgICAgICMgcmFpc2UKKyAgICAgICAgICAgICMgV2UgY2FuJ3QgcmFpc2UgdGhlIGV4Y2VwdGlvbiwgYmVjYXVzZSBpdCBraWxscyBtb3N0IFRTZXJ2ZXIgZGVyaXZlZAorICAgICAgICAgICAgIyBzZXJ2ZSgpIG1ldGhvZHMuCisgICAgICAgICAgICAjIEluc3RlYWQsIHJldHVybiBOb25lLCBhbmQgbGV0IHRoZSBUU2VydmVyIGluc3RhbmNlIGRlYWwgd2l0aCBpdCBpbgorICAgICAgICAgICAgIyBvdGhlciBleGNlcHRpb24gaGFuZGxpbmcuICAoYnV0IFRTaW1wbGVTZXJ2ZXIgZGllcyBhbnl3YXkpCisgICAgICAgICAgICByZXR1cm4gTm9uZQorCisgICAgICAgIGlmIHNlbGYuX3Nob3VsZF92ZXJpZnk6CisgICAgICAgICAgICBjbGllbnQucGVlcmNlcnQgPSBjbGllbnQuZ2V0cGVlcmNlcnQoKQorICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICAgIHNlbGYuX3ZhbGlkYXRlX2NhbGxiYWNrKGNsaWVudC5wZWVyY2VydCwgYWRkclswXSkKKyAgICAgICAgICAgICAgICBjbGllbnQuaXNfdmFsaWQgPSBUcnVlCisgICAgICAgICAgICBleGNlcHQgRXhjZXB0aW9uOgorICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuKCdGYWlsZWQgdG8gdmFsaWRhdGUgY2xpZW50IGNlcnRpZmljYXRlIGFkZHJlc3M6ICVzJywKKyAgICAgICAgICAgICAgICAgICAgIC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SAgICAgICAgICAgICAgIHNlbGYuX3VuaXhfc29ja2V0KV0KLSAgICBlbHNlOgotICAgICAgcmV0dXJuIHNvY2tldC5nZXRhZGRyaW5mbyhzZWxmLmhvc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucG9ydCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc29ja2V0LkFGX1VOU1BFQywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc29ja2V0LlNPQ0tfU1RSRUFNLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb2NrZXQuQUlfUEFTU0lWRSB8IHNvY2tldC5BSV9BRERSQ09ORklHKQorICAgIGRlZiBfcmVzb2x2ZUFkZHIoc2VsZik6CisgICAgICAgIGlmIHNlbGYuX3VuaXhfc29ja2V0IGlzIG5vdCBOb25lOgorICAgICAgICAgICAgcmV0dXJuIFsoc29ja2V0LkFGX1VOSVgsIHNvY2tldC5TT0NLX1NUUkVBTSwgTm9uZSwgTm9uZSwKKyAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3VuaXhfc29ja2V0KV0KKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHJldHVybiBzb2NrZXQuZ2V0YWRkcmluZm8oc2VsZi5ob3N0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnBvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX3NvY2tldF9mYW1pbHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvY2tldC5TT0NLX1NUUkVBTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc29ja2V0LkFJX1BBU1NJVkUgfCBzb2NrZXQuQUlfQUREUkNPTkZJRykKIAotICBk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ICBkZWYgaXNPcGVuKHNlbGYpOgorICAgICAgICByZXR1cm4gc2VsZi5oYW5kbGUgaXMgbm90IE5vbmUKIAotICBkZWYgc2V0VGltZW91dChzZWxmLCBtcyk6Ci0gICAgaWYgbXMgaXMgTm9uZToKLSAgICAgIHNlbGYuX3RpbWVvdXQgPSBOb25lCi0gICAgZWxzZToKLSAgICAgIHNlbGYuX3RpbWVvdXQgPSBtcyAvIDEwMDAuMAorICAgIGRlZiBzZXRUaW1lb3V0KHNlbGYsIG1zKToKKyAgICAgICAgaWYgbXMgaXMgTm9uZToKKyAgICAgICAgICAgIHNlbGYuX3RpbWVvdXQgPSBOb25lCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBzZWxmLl90aW1lb3V0ID0gbXMgLyAxMDAwLjAKIAotICAgIGlmIHNlbGYuaGFuZGxlIGlzIG5vdCBOb25lOgotICAgICAgc2VsZi5oYW5kbGUuc2V0dGltZW91dChzZWxmLl90aW1lb3V0KQorICAgICAgICBpZiBzZWxmLmhhbmRsZSBpcyBub3QgTm9uZToKKyAgICAgICAgICAgIHNlbGYuaGFuZGxlLnNldHRpbWVvdXQoc2VsZi5fdGltZW91dCkKIAotICBkZWYgb3BlbihzZWxmKToKLSAgICB0cnk6Ci0gICAgICByZXMwID0gc2VsZi5fcmVzb2x2ZUFkZHIoKQotICAgICAgZm9yIHJlcyBpbiByZXMwOgotICAgICAgICBzZWxmLmhhbmRsZSA9IHNvY2tldC5zb2NrZXQocmVzWzBdLCByZXNbMV0pCi0gICAgICAgIHNlbGYuaGFuZGxlLnNldHRpbWVvdXQoc2VsZi5fdGltZW91dCkKKyAgICBkZWYgX2RvX29wZW4oc2VsZiwgZmFtaWx5LCBzb2NrdHlwZSk6CisgICAgICAgIHJldHVybiBzb2NrZXQuc29ja2V0KGZhbWlseSwgc29ja3R5cGUpCisKKyAgICBAcHJvcGVydHkKKyAgICBkZWYgX2FkZHJlc3Moc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl91bml4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ciBmb3IgJyArIHN0cihzZWxmLl9hZGRyZXNzKQorICAgICAgICAgICAgbG9nZ2VyLmV4Y2VwdGlvbihtc2cpCisgICAgICAgICAgICByYWlzZSBUVHJhbnNwb3J0RXhjZXB0aW9uKFRUcmFuc3BvcnRFeGNlcHRpb24uTk9UX09QRU4sIG1zZykKKyAgICAgICAgZm9yIGZhbWlseSwgc29ja3R5cGUsIF8sIF8sIHNvY2thZGRyIGluIGFkZHJzOgorICAgICAgICAgICAgaGFuZGxlID0gc2VsZi5fZG9fb3BlbihmYW1pbHksIHNvY2t0eXBlKQorICAgICAgICAgICAgaGFuZGxlLnNldHRpbWVvdXQoc2VsZi5fdGltZW91dCkKKyAgICAgICAgICAgIHRyeToKKyAgICAgICAgICAgICAgICBoYW5kbGUuY29ubmVjdChzb2NrYWRkcikKKyAgICAgICAgICAgICAgICBzZWxmLmhhbmRsZSA9IGhhbmRsZQorICAgICAgICAgICAgICAgIHJldHVybgorICAgICAgICAgICAgZXhjZXB0IHNvY2tldC5lcnJvcjoKKyAgICAgICAgICAgICAgICBoYW5kbGUuY2xvc2UoKQorICAgICAgICAgICAgICAgIGxvZ2dlci5pbmZvKCdDb3VsZCBub3QgY29ubmVjdCB0byAlcycsIHNvY2thZGRyLCBleGNfaW5mbz1UcnVlKQorICAgICAgICBtc2cgPSAnQ291bGQgbm90IGNvbm5lY3QgdG8gYW55IG9mICVzJyAlIGxpc3QobWFwKGxhbWJkYSBhOiBhWzRdLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZHJzKSkKKyAgICAgICAgbG9nZ2VyLmVycm9yKG1zZykKKyAgICAgICAgcmFpc2UgVFRyYW5zcG9ydEV4Y2VwdGlvbihUVHJhbnNwb3J0RXhjZXB0aW9uLk5PVF9PUEVOLCBtc2cpCiAKLSAgZGVmIHJlYWQoc2VsZiwgc3opOgotICAgIHRyeToKLSAgICAgIGJ1ZmYgPSBzZWxmLmhhbmR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XJyb3IgYXMgZToKKyAgICAgICAgICAgIGlmIChlLmFyZ3NbMF0gPT0gZXJybm8uRUNPTk5SRVNFVCBhbmQKKyAgICAgICAgICAgICAgICAgICAgKHN5cy5wbGF0Zm9ybSA9PSAnZGFyd2luJyBvciBzeXMucGxhdGZvcm0uc3RhcnRzd2l0aCgnZnJlZWJzZCcpKSk6CisgICAgICAgICAgICAgICAgIyBmcmVlYnNkIGFuZCBNYWNoIGRvbid0IGZvbGxvdyBQT1NJWCBzZW1hbnRpYyBvZiByZWN2CisgICAgICAgICAgICAgICAgIyBhbmQgZmFpbCB3aXRoIEVDT05OUkVTRVQgaWYgcGVlciBwZXJmb3JtZWQgc2h1dGRvd24uCisgICAgICAgICAgICAgICAgIyBTZWUgY29ycmVzcG9uZGluZyBjb21tZW50IGFuZCBjb2RlIGluIFRTb2NrZXQ6OnJlYWQoKQorICAgICAgICAgICAgICAgICMgaW4gbGliL2NwcC9zcmMvdHJhbnNwb3J0L1RTb2NrZXQuY3BwLgorICAgICAgICAgICAgICAgIHNlbGYuY2xvc2UoKQorICAgICAgICAgICAgICAgICMgVHJpZ2dlciB0aGUgY2hlY2sgdG8gcmFpc2UgdGhlIEVORF9PRl9GSUxFIGV4Y2VwdGlvbiBiZWxvdy4KKyAgICAgICAgICAgICAgICBidWZmID0gJycKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgcmFpc2UKKyAgICAgICAgaWYgbGVuKGJ1ZmYpID09IDA6CisgICAgICAgICAgICByYWlzZSBUVHJhbnNwb3J0RXhjZXB0aW9uKHR5cGU9VFRyYW5zcG9ydEV4Y2VwdGlvbi5FTkRfT0ZfRklMRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZT0nVFNvY2tldCByZWFkIDAgYnl0ZXMnKQorICAgICAgICByZXR1cm4gYnVmZgogCi0gIGRlZiB3cml0ZShzZWxmLCBidWZmKToKLSAgICBpZiBub3Qgc2VsZi5oYW5kb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Ci0gICAgaWYgbGVuKHJldCkgIT0gMDoKLSAgICAgIHJldHVybiByZXQKKyAgICBkZWYgcmVhZChzZWxmLCBzeik6CisgICAgICAgIHJldCA9IHNlbGYuX19yYnVmLnJlYWQoc3opCisgICAgICAgIGlmIGxlbihyZXQpICE9IDA6CisgICAgICAgICAgICByZXR1cm4gcmV0CisgICAgICAgIHNlbGYuX19yYnVmID0gQnVmZmVySU8oc2VsZi5fX3RyYW5zLnJlYWQobWF4KHN6LCBzZWxmLl9fcmJ1Zl9zaXplKSkpCisgICAgICAgIHJldHVybiBzZWxmLl9fcmJ1Zi5yZWFkKHN6KQogCi0gICAgc2VsZi5fX3JidWYgPSBTdHJpbmdJTyhzZWxmLl9fdHJhbnMucmVhZChtYXgoc3osIHNlbGYuX19yYnVmX3NpemUpKSkKLSAgICByZXR1cm4gc2VsZi5fX3JidWYucmVhZChzeikKKyAgICBkZWYgd3JpdGUoc2VsZiwgYnVmKToKKyAgICAgICAgdHJ5OgorICAgICAgICAgICAgc2VsZi5fX3didWYud3JpdGUoYnVmKQorICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIGU6CisgICAgICAgICAgICAjIG9uIGV4Y2VwdGlvbiByZXNldCB3YnVmIHNvIGl0IGRvZXNuJ3QgY29udGFpbiBhIHBhcnRpYWwgZnVuY3Rpb24gY2FsbAorICAgICAgICAgICAgc2VsZi5fX3didWYgPSBCdWZmZXJJTygpCisgICAgICAgICAgICByYWlzZSBlCiAKLSAgZGVmIHdyaXRlKHNlbGYsIGJ1Zik6Ci0gICAgc2VsZi5fX3didWYud3JpdGUoYnVmKQorICAgIGRlZiBmbHVzaChzZWxmKToKKyAgICAgICAgb3V0ID0gc2VsZi5fX3didWYuZ2V0dmFsdWUoKQorICAgICAgICAjIHJlc2V0IHdidWYgYmVmb3JlIHdyaXRlL2ZsdXNoIHRvIHByZXNlcnZlIHN0YXRlIG9uIHVuZGVybHlpbmcgZmFpbHVyZQorICAgICAgICBzZWxmLl9fd2J1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3RyYW5zLmlzT3BlbigpCisgICAgZGVmIGlzT3BlbihzZWxmKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX190cmFucy5pc09wZW4oKQogCi0gIGRlZiBvcGVuKHNlbGYpOgotICAgIHJldHVybiBzZWxmLl9fdHJhbnMub3BlbigpCisgICAgZGVmIG9wZW4oc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9fdHJhbnMub3BlbigpCiAKLSAgZGVmIGNsb3NlKHNlbGYpOgotICAgIHJldHVybiBzZWxmLl9fdHJhbnMuY2xvc2UoKQorICAgIGRlZiBjbG9zZShzZWxmKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX190cmFucy5jbG9zZSgpCiAKLSAgZGVmIHJlYWQoc2VsZiwgc3opOgotICAgIHJldCA9IHNlbGYuX19yYnVmLnJlYWQoc3opCi0gICAgaWYgbGVuKHJldCkgIT0gMDoKLSAgICAgIHJldHVybiByZXQKKyAgICBkZWYgcmVhZChzZWxmLCBzeik6CisgICAgICAgIHJldCA9IHNlbGYuX19yYnVmLnJlYWQoc3opCisgICAgICAgIGlmIGxlbihyZXQpICE9IDA6CisgICAgICAgICAgICByZXR1cm4gcmV0CiAKLSAgICBzZWxmLnJlYWRGcmFtZSgpCi0gICAgcmV0dXJuIHNlbGYuX19yYnVmLnJlYWQoc3opCisgICAgICAgIHNlbGYucmVhZEZyYW1lKCkKKyAgICAgICAgcmV0dXJuIHNlbGYuX19yYnVmLnJlYWQoc3opCiAKLSAgZGVmIHJlYWRGcmFtZShzZWxmKToKLSAgICBidWZmID0gc2VsZi5fX3RyYW5zLnJlYWRBbGwoNCkKLSAgICBzeiwgPSB1bnBhY2soJyFpJywgYnVmZikKLSAgICBzZWxmLl9fcmJ1ZiA9IFN0cmluZ0lPKHNlbGYuX190cmFucy5yZWFkQWxsKHN6KSkKKyAgICBkZWYgcmVhZEZyYW1lKHNlbGYpOgorICAgICAgICBidWZmID0gc2VsZi5fX3RyYW5zLnJlYWRBbGwoNCkKKyAg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50KGhvc3QsIHNlcnZpY2UsIG1lY2hhbmlzbSwgKipzYXNsX2t3YXJncykKKworICAgICAgICBzZWxmLl9fd2J1ZiA9IEJ1ZmZlcklPKCkKKyAgICAgICAgc2VsZi5fX3JidWYgPSBCdWZmZXJJTyhiJycpCisKKyAgICBkZWYgb3BlbihzZWxmKToKKyAgICAgICAgaWYgbm90IHNlbGYudHJhbnNwb3J0LmlzT3BlbigpOgorICAgICAgICAgICAgc2VsZi50cmFuc3BvcnQub3BlbigpCisKKyAgICAgICAgc2VsZi5zZW5kX3Nhc2xfbXNnKHNlbGYuU1RBUlQsIHNlbGYuc2FzbC5tZWNoYW5pc20pCisgICAgICAgIHNlbGYuc2VuZF9zYXNsX21zZyhzZWxmLk9LLCBzZWxmLnNhc2wucHJvY2VzcygpKQorCisgICAgICAgIHdoaWxlIFRydWU6CisgICAgICAgICAgICBzdGF0dXMsIGNoYWxsZW5nZSA9IHNlbGYucmVjdl9zYXNsX21zZygpCisgICAgICAgICAgICBpZiBzdGF0dXMgPT0gc2VsZi5PSzoKKyAgICAgICAgICAgICAgICBzZWxmLnNlbmRfc2FzbF9tc2coc2VsZi5PSywgc2VsZi5zYXNsLnByb2Nlc3MoY2hhbGxlbmdlKSkKKyAgICAgICAgICAgIGVsaWYgc3RhdHVzID09IHNlbGYuQ09NUExFVEU6CisgICAgICAgICAgICAgICAgaWYgbm90IHNlbGYuc2FzbC5jb21wbGV0ZToKKyAgICAgICAgICAgICAgICAgICAgcmFpc2UgVFRyYW5zcG9ydEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb24uTk9UX09QRU4sCisgICAgICAgICAgICAgICAgICAgICAgICAiVGhlIHNlcnZlciBlcnJvbmVvdXNseSBpbmRpY2F0ZWQgIgorICAgICAgICAgICAgICAgICAgICAgICAgInRoYXQgU0FTTCBuZWdvdGlhdGlvbiB3YXMgY29tcGxldGUiKQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrCisgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgIHJhaXNlIFRUcmFuc3BvcnRFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnRFeGNlcHRpb24uTk9UX09QRU4sCisgICAgICAgICAgICAgICAgICAgICJCYWQgU0FTTCBuZWdvdGlhdGlvbiBzdGF0dXM6ICVkICglcykiCisgICAgICAgICAgICAgICAgICAgICUgKHN0YXR1cywgY2hhbGxlbmdlKSkKKworICAgIGRlZiBzZW5kX3Nhc2xfbXNnKHNlbGYsIHN0YXR1cywgYm9keSk6CisgICAgICAgIGhlYWRlciA9IHBhY2soIj5CSSIsIHN0YXR1cywgbGVuKGJvZHkpKQorICAgICAgICBzZWxmLnRyYW5zcG9ydC53cml0ZShoZWFkZXIgKyBib2R5KQorICAgICAgICBzZWxmLnRyYW5zcG9ydC5mbHVzaCgpCisKKyAgICBkZWYgcmVjdl9zYXNsX21zZyhzZWxmKToKKyAgICAgICAgaGVhZGVyID0gc2VsZi50cmFuc3BvcnQucmVhZEFsbCg1KQorICAgICAgICBzdGF0dXMsIGxlbmd0aCA9IHVucGFjaygiPkJJIiwgaGVhZGVyKQorICAgICAgICBpZiBsZW5ndGggPiAwOgorICAgICAgICAgICAgcGF5bG9hZCA9IHNlbGYudHJhbnNwb3J0LnJlYWRBbGwobGVuZ3RoKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgcGF5bG9hZCA9ICIiCisgICAgICAgIHJldHVybiBzdGF0dXMsIHBheWxvYWQKKworICAgIGRlZiB3cml0ZShzZWxmLCBkYXRhKToKKyAgICAgICAgc2VsZi5fX3didWYud3JpdGUoZGF0YSkKKworICAgIGRlZiBmbHVzaChzZWxmKToKKyAgICAgICAgZGF0YSA9IHNlbGYuX193YnVmLmdldHZhbHVlKCkKKyAgICAgICAgZW5jb2RlZCA9IHNlbGYuc2FzbC53cmFwKGRhdGEpCisgICAgICAgIHNlbGYudHJhbnNwb3J0LndyaXRlKCcnLmpvaW4oKHBhY2soIiFpIiwgbGVuKGVuY29kZWQpKSwgZW5jb2RlZCkpKQorICAgICAgICBzZWxmLnRyYW5zcG9ydC5mbHVzaCgpCisgICAgICAgIHNlbGYuX193YnVmID0gQnVmZmVySU8oKQorCisgICAgZGVmIHJlYWQoc2VsZiwgc3opOgorICAgICAgICByZXQgPSBzZWxmLl9fcmJ1Zi5yZWFkKHN6KQorICAgICAgICBpZiBsZW4ocmV0KSAhPSAwOgorICAgICAgICAgICAgcmV0dXJuIHJldAorCisgICAgICAgIHNlbGYuX3JlYWRfZnJhbWUoKQorICAgICAgICByZXR1cm4gc2VsZi5fX3JidWYucmVhZChzeikKKworICAgIGRlZiBfcmVhZF9mcmFtZShzZWxmKToKKyAgICAgICAgaGVhZGVyID0gc2VsZi50cmFuc3BvcnQucmVhZEFsbCg0KQorICAgICAgICBsZW5ndGgsID0gdW5wYWNrKCchaScsIGhlYWRlcikKKyAgICAgICAgZW5jb2RlZCA9IHNlbGYudHJhbnNwb3J0LnJlYWRBbGwobGVuZ3RoKQorICAgICAgICBzZWxmLl9fcmJ1ZiA9IEJ1ZmZlcklPKHNlbGYuc2FzbC51bndyYXAoZW5jb2RlZCkpCisKKyAgICBkZWYgY2xvc2Uoc2VsZik6CisgICAgICAgIHNlbGYuc2FzbC5kaXNwb3NlKCkKKyAgICAgICAgc2VsZi50cmFuc3BvcnQuY2xvc2UoKQorCisgICAgIyBiYXNlZCBvbiBURnJhbWVkVHJhbnNwb3J0CisgICAgQHByb3BlcnR5CisgICAgZGVmIGNzdHJpbmdpb19idWYoc2VsZik6CisgICAgICAgIHJldHVybiBzZWxmLl9fcmJ1ZgorCisgICAgZGVmIGNzdHJpbmdpb19yZWZpbGwoc2VsZiwgcHJlZml4LCByZXFsZW4pOgorICAgICAgICAjIHNlbGYuX19yYnVmIHdpbGwgYWxyZWFkeSBiZSBlbXB0eSBoZXJlIGJlY2F1c2UgZmFzdGJp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aW9uIGxldmVsLCByYW5naW5nCisgICAgICAgIGZyb20gMCAobm8gY29tcHJlc3Npb24pIHRvIDkgKGJlc3QgY29tcHJlc3Npb24pLiAgRGVmYXVsdCBpcyA5LgorICAgICAgICBAdHlwZSBjb21wcmVzc2xldmVsOiBpbnQKKyAgICAgICAgIiIiCisgICAgICAgIHNlbGYuX190cmFucyA9IHRyYW5zCisgICAgICAgIHNlbGYuY29tcHJlc3NsZXZlbCA9IGNvbXByZXNzbGV2ZWwKKyAgICAgICAgc2VsZi5fX3JidWYgPSBCdWZmZXJJTygpCisgICAgICAgIHNlbGYuX193YnVmID0gQnVmZmVySU8oKQorICAgICAgICBzZWxmLl9pbml0X3psaWIoKQorICAgICAgICBzZWxmLl9pbml0X3N0YXRzKCkKIAotICBkZWYgX2luaXRfemxpYihzZWxmKToKLSAgICAiIiJJbnRlcm5hbCBtZXRob2QgZm9yIHNldHRpbmcgdXAgdGhlIHpsaWIgY29tcHJlc3Npb24gYW5kCi0gICAgZGVjb21wcmVzc2lvbiBvYmplY3RzLgotICAgICIiIgotICAgIHNlbGYuX3pjb21wX3JlYWQgPSB6bGliLmRlY29tcHJlc3NvYmooKQotICAgIHNlbGYuX3pjb21wX3dyaXRlID0gemxpYi5jb21wcmVzc29iaihzZWxmLmNvbXByZXNzbGV2ZWwpCisgICAgZGVmIF9yZWluaXRfYnVmZmVycyhzZWxmKToKKyAgICAgICAgIiIiSW50ZXJuYWwgbWV0aG9kIHRvIGluaXRpYWxpemUvcmVzZXQgdGhlIGludGVybmFsIFN0cmluZ0lPIG9iamVjdHMKKyAgICAgICAgZm9yIHJlYWQgYW5kIHdyaXRlIGJ1ZmZlcnMuCisgICAgICAgICIiIgorICAgICAgICBzZWxmLl9fcmJ1ZiA9IEJ1ZmZlcklPKCkKKyAgICAgICAgc2VsZi5fX3didWYgPSBCdWZmZXJJTygpCiAKLSAgZGVmIGdldENvbXBSYXRpbyhzZWxmKToKLSAgICAiIiJHZXQgdGhlIGN1cnJlbn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aWx1cmU9RmFsc2UpOgorICAgICAgICBzdXBlcihTZXJ2ZXJBY2NlcHRvciwgc2VsZikuX19pbml0X18oKQorICAgICAgICBzZWxmLmRhZW1vbiA9IFRydWUKKyAgICAgICAgc2VsZi5fc2VydmVyID0gc2VydmVyCisgICAgICAgIHNlbGYuX2xpc3RlbmluZyA9IHRocmVhZGluZy5FdmVudCgpCisgICAgICAgIHNlbGYuX3BvcnQgPSBOb25lCisgICAgICAgIHNlbGYuX3BvcnRfYm91bmQgPSB0aHJlYWRpbmcuRXZlbnQoKQorICAgICAgICBzZWxmLl9jbGllbnQgPSBOb25lCisgICAgICAgIHNlbGYuX2NsaWVudF9hY2NlcHRlZCA9IHRocmVhZGluZy5FdmVudCgpCisgICAgICAgIHNlbGYuX2V4cGVjdF9mYWlsdXJlID0gZXhwZWN0X2ZhaWx1cmUKKyAgICAgICAgZnJhbWUgPSBpbnNwZWN0LnN0YWNrKDMpWzJdCisgICAgICAgIHNlbGYubmFtZSA9IGZyYW1lWzNdCisgICAgICAgIGRlbCBmcmFtZQorCisgICAgZGVmIHJ1bihzZWxmKToKKyAgICAgICAgc2VsZi5fc2VydmVyLmxpc3RlbigpCisgICAgICAgIHNlbGYuX2xpc3RlbmluZy5zZXQoKQorCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIGFkZHJlc3MgPSBzZWxmLl9zZXJ2ZXIuaGFuZGxlLmdldHNvY2tuYW1lKCkKKyAgICAgICAgICAgIGlmIGxlbihhZGRyZXNzKSA+IDE6CisgICAgICAgICAgICAgICAgIyBBRl9JTkVUIGFkZHJlc3NlcyBhcmUgMi10dXBsZXMgKGhvc3QsIHBvcnQpIGFuZCBBRl9JTkVUNiBhcmUKKyAgICAgICAgICAgICAgICAjIDQtdHVwbGVzIChob3N0LCBwb3J0LCAuLi4pLCBidXQgaW4gZWFjaCBjYXNlIHBvcnQgaXMgaW4gdGhlIHNlY29uZCBzbG90LgorICAgICAgICAgICAgICAgIHNlbGYuX3BvcnQgPSBhZGRyZXNzWzFdCisgICAgICAgIGZpbmFsbHk6CisgICAgICAgICAgICBzZWxmLl9wb3J0X2JvdW5kLnNldCgpCisKKyAgICAgICAgdHJ5OgorICAgICAgICAgICAgc2VsZi5fY2xpZW50ID0gc2VsZi5fc2VydmVyLmFjY2VwdCgpCisgICAgICAgIGV4Y2VwdCBFeGNlcHRpb246CisgICAgICAgICAgICBsb2dnaW5nLmV4Y2VwdGlvbignZXJyb3Igb24gc2VydmVyIHNpZGUgKCVzKTonICUgc2VsZi5uYW1lKQorICAgICAgICAgICAgaWYgbm90IHNlbGYuX2V4cGVjdF9mYWlsdXJlOgorICAgICAgICAgICAgICAgIHJhaXNlCisgICAgICAgIGZpbmFsbHk6CisgICAgICAgICAgICBzZWxmLl9jbGllbnRfYWNjZXB0ZWQuc2V0KCkKKworICAgIGRlZiBhd2FpdF9saXN0ZW5pbmcoc2VsZik6CisgICAgICAgIHNlbGYuX2xpc3RlbmluZy53YWl0KCkKKworICAgIEBwcm9wZXJ0eQorICAgIGRlZiBwb3J0KHNlbGYpOgorICAgICAgICBzZWxmLl9wb3J0X2JvdW5kLndhaXQoKQorICAgICAgICByZXR1cm4gc2VsZi5fcG9ydAorCisgICAgQHByb3BlcnR5CisgICAgZGVmIGNsaWVudChzZWxmKToKKyAgICAgICAgc2VsZi5fY2xpZW50X2FjY2VwdGVkLndhaXQoKQorICAgICAgICByZXR1cm4gc2VsZi5fY2xpZW50CisKKyAgICBkZWYgY2xvc2Uoc2VsZik6CisgICAgICAgIGlmIHNlbGYuX2NsaWVudDoKKyAgICAgICAgICAgIHNlbGYuX2NsaWVudC5jbG9zZSgpCisgICAgICAgIHNlbGYuX3NlcnZlci5jbG9zZSgpCisKKworIyBQeXRob24gMi42IGNvbXBhdAorY2xhc3MgQXNzZXJ0UmFpc2VzKG9iamVjdCk6CisgICAgZGVmIF9faW5pdF9fKHNlbGYsIGV4cGVjdGVkKToKKyAgICAgICAgc2VsZi5fZXhwZWN0ZWQgPSBleHBlY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gICAgICBhY2MuY2xvc2UoKQorCisgICAgZGVmIF9hc3NlcnRfY29ubmVjdGlvbl9mYWlsdXJlKHNlbGYsIHNlcnZlciwgcGF0aD1Ob25lLCAqKmNsaWVudF9hcmdzKToKKyAgICAgICAgbG9nZ2luZy5kaXNhYmxlKGxvZ2dpbmcuQ1JJVElDQUwpCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIHdpdGggc2VsZi5fY29ubmVjdGFibGVfY2xpZW50KHNlcnZlciwgVHJ1ZSwgcGF0aD1wYXRoLCAqKmNsaWVudF9hcmdzKSBhcyAoYWNjLCBjbGllbnQpOgorICAgICAgICAgICAgICAgICMgV2UgbmVlZCB0byB3YWl0IGZvciBhIGNvbm5lY3Rpb24gZmFpbHVyZSwgYnV0IG5vdCB0b28gbG9uZy4gIDIwbXMgaXMgYSB0dW5hYmxlCisgICAgICAgICAgICAgICAgIyBjb21wcm9taXNlIGJldHdlZW4gdGVzdCBzcGVlZCBhbmQgc3RhYmlsaXR5CisgICAgICAgICAgICAgICAgY2xpZW50LnNldFRpbWVvdXQoMjApCisgICAgICAgICAgICAgICAgd2l0aCBzZWxmLl9hc3NlcnRfcmFpc2VzKFRUcmFuc3BvcnRFeGNlcHRpb24pOgorICAgICAgICAgICAgICAgICAgICBjbGllbnQub3BlbigpCisgICAgICAgICAgICAgICAgc2VsZi5hc3NlcnRUcnVlKGFjYy5jbGllbnQgaXMgTm9uZSkKKyAgICAgICAgZmluYWxseToKKyAgICAgICAgICAgIGxvZ2dpbmcuZGlzYWJsZShsb2dnaW5nLk5PVFNFVCkKKworICAgIGRlZiBfYXNzZXJ0X3JhaXNlcyhzZWxmLCBleGMpOgorICAgICAgICBpZiBzeXMuaGV4dmVyc2lvbiA+PSAweDAyMDcwMEYwOgorICAgICAgICAgICAgcmV0dXJuIHNlbGYuYXNzZXJ0UmFpc2VzKGV4YykKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHJldHVybiBBc3NlcnRSYWlzZXMoZXhjKQor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9IExvZ2dlci5uZXcoU1RERVJSKQorICAgICAgICBAbG9nZ2VyLmxldmVsID0gTG9nZ2VyOjpXQVJOCisgICAgICBlbHNlCisgICAgICAgIEBsb2dnZXIgPSBsb2dnZXIKKyAgICAgIGVuZAogICAgIGVuZAogCiAgICAgZGVmIHByb2Nlc3MoaXByb3QsIG9wcm90KQogICAgICAgbmFtZSwgdHlwZSwgc2VxaWQgID0gaXByb3QucmVhZF9tZXNzYWdlX2JlZ2luCiAgICAgICBpZiByZXNwb25kX3RvPygicHJvY2Vzc18je25hbWV9IikKLSAgICAgICAgc2VuZCgicHJvY2Vzc18je25hbWV9Iiwgc2VxaWQsIGlwcm90LCBvcHJvdCkKKyAgICAgICAgYmVnaW4KKyAgICAgICAgICBzZW5kKCJwcm9jZXNzXyN7bmFtZX0iLCBzZXFpZCwgaXByb3QsIG9wcm90KQorICAgICAgICByZXNjdWUgPT4gZQorICAgICAgICAgIHggPSBBcHBsaWNhdGlvbkV4Y2VwdGlvbi5uZXcoQXBwbGljYXRpb25FeGNlcHRpb246OklOVEVSTkFMX0VSUk9SLCAnSW50ZXJuYWwgZXJyb3InKQorICAgICAgICAgIEBsb2dnZXIuZGVidWcgIkludGVybmFsIGVycm9yIDogI3tlLm1lc3NhZ2V9XG4je2UuYmFja3RyYWNlLmpvaW4oIlxuIil9IgorICAgICAgICAgIHdyaXRlX2Vycm9yKHgsIG9wcm90LCBuYW1lLCBzZXFpZCkKKyAgICAgICAgZW5kCiAgICAgICAgIHRydWUKICAgICAgIGVsc2UKICAgICAgICAgaXByb3Quc2tpcChUeXBlczo6U1RSVUNUKQogICAgICAgICBpcHJvdC5yZWFkX21lc3NhZ2VfZW5kCiAgICAgICAgIHggPSBBcHBsaWNhdGlvbkV4Y2VwdGlvbi5uZXcoQXBwbGljYXRpb25FeGNlcHRpb246OlVOS05PV05fTUVUSE9ELCAnVW5rbm93biBmdW5jdGlvbiAnK25hbWUpCi0gICAgICAgIG9wcm90LndyaXRlX21lc3NhZ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FTUVOVEVEID0gNQorICAgIERFUFRIX0xJTUlUID0gNgogCiAgICAgYXR0cl9yZWFkZXIgOnR5cGUKIApAQCAtMzY3LDExICszNjksMTkgQEAKICAgICAgICAgcmVhZF9saXN0X2VuZAogICAgICAgZW5kCiAgICAgZW5kCisgICAgCisgICAgZGVmIHRvX3MKKyAgICAgICIje3RyYW5zLnRvX3N9IgorICAgIGVuZAogICBlbmQKIAogICBjbGFzcyBCYXNlUHJvdG9jb2xGYWN0b3J5CiAgICAgZGVmIGdldF9wcm90b2NvbCh0cmFucykKICAgICAgIHJhaXNlIE5vdEltcGxlbWVudGVkRXJyb3IKICAgICBlbmQKKyAgICAKKyAgICBkZWYgdG9fcworICAgICAgImJhc2UiCisgICAgZW5kCiAgIGVuZAotZW5kClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQorZW5kCmRpZmYgLS1naXQgYS9saWIvcmIvbGliL3RocmlmdC9wcm90b2NvbC9iaW5hcnlfcHJvdG9jb2wucmIgYi9saWIvcmIvbGliL3RocmlmdC9wcm90b2NvbC9iaW5hcnlfcHJvdG9jb2wucmIKaW5kZXggZTcwYjFlMy4uZDgyNzlkYiAxMDA2NDQKLS0tIGEvbGliL3JiL2xpYi90aHJpZnQvcHJvdG9jb2wvYmluYXJ5X3Byb3RvY29sLnJiCisrKyBiL2xpYi9yYi9saWIvdGhyaWZ0L3Byb3RvY29sL2JpbmFyeV9wcm90b2NvbC5yYgpAQCAtMjI2LDEyICsyMjYsMTkgQEAKICAgICAgIHNpemUgPSByZWFkX2kzMgogICAgICAgdHJhbnMucmVhZF9hbGwoc2l6ZSkKICAgICBlbmQKLQorICAgIAorICAgIGRlZiB0b19zCisgICAgICAiYmluYXJ5KCN7c3VwZXIudG9fc30pIgorICAgIGVuZAogICBlbmQKIAogICBjbGFzcyBCaW5hcnlQcm90b2NvbEZhY3RvcnkgPCBCYXNlUHJvdG9jb2xGYWN0b3J5CiAgICAgZGVmIGdldF9wcm90b2NvbCh0cmFuc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leHQKQEAgLTU0Niw3ICs1NDcsMTUgQEAKIAogICAgICMgUmVhZHMgYSBibG9jayBvZiBiYXNlNjQgY2hhcmFjdGVycywgZGVjb2RpbmcgaXQsIGFuZCByZXR1cm5zIHZpYSBzdHIKICAgICBkZWYgcmVhZF9qc29uX2Jhc2U2NAotICAgICAgcmVhZF9qc29uX3N0cmluZy51bnBhY2soIm0iKVswXQorICAgICAgc3RyID0gcmVhZF9qc29uX3N0cmluZworICAgICAgbSA9IHN0ci5sZW5ndGggJSA0CisgICAgICBpZiBtICE9IDAKKyAgICAgICAgIyBBZGQgbWlzc2luZyBwYWRkaW5nCisgICAgICAgICg0IC0gbSkudGltZXMgZG8KKyAgICAgICAgICBzdHIgKz0gJz0nCisgICAgICAgIGVuZAorICAgICAgZW5kCisgICAgICBCYXNlNjQuc3RyaWN0X2RlY29kZTY0KHN0cikKICAgICBlbmQKIAogICAgICMgUmVhZHMgYSBzZXF1ZW5jZSBvZiBjaGFyYWN0ZXJzLCBzdG9wcGluZyBhdCB0aGUgZmlyc3Qgb25lIHRoYXQgaXMgbm90CkBAIC03NTksMTEgKzc2OCwxOSBAQAogICAgIGRlZiByZWFkX2JpbmFyeQogICAgICAgcmVhZF9qc29uX2Jhc2U2NAogICAgIGVuZAorCisgICAgZGVmIHRvX3MKKyAgICAgICJqc29uKCN7c3VwZXIudG9fc30pIgorICAgIGVuZAogICBlbmQKIAogICBjbGFzcyBKc29uUHJvdG9jb2xGYWN0b3J5IDwgQmFzZVByb3RvY29sRmFjdG9yeQogICAgIGRlZiBnZXRfcHJvdG9jb2wodHJhbnMpCiAgICAgICByZXR1cm4gVGhyaWZ0OjpKc29uUHJvdG9jb2wubmV3KHRyYW5zKQogICAgIGVuZAorCisgICAgZGVmIHRvX3MKKyAgICAgICJqc29uIgorICAgIGVuZAogICBlbmQKIGVuZApkaWZmIC0tZ2l0IGEvbGliL3JiL2xpYi90aHJpZnQvcHJvdG9jb2wvbXVsdGlwbGV4ZWRfcHJvdG9j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4KKyAgICBlbmQKKworICAgIGRlZiByZWFkX21hcF9lbmQKKyAgICAgIEBwcm90b2NvbC5yZWFkX21hcF9lbmQKKyAgICBlbmQKKworICAgIGRlZiByZWFkX2xpc3RfYmVnaW4KKyAgICAgIEBwcm90b2NvbC5yZWFkX2xpc3RfYmVnaW4KKyAgICBlbmQKKworICAgIGRlZiByZWFkX2xpc3RfZW5kCisgICAgICBAcHJvdG9jb2wucmVhZF9saXN0X2VuZAorICAgIGVuZAorCisgICAgZGVmIHJlYWRfc2V0X2JlZ2luCisgICAgICBAcHJvdG9jb2wucmVhZF9zZXRfYmVnaW4KKyAgICBlbmQKKworICAgIGRlZiByZWFkX3NldF9lbmQKKyAgICAgIEBwcm90b2NvbC5yZWFkX3NldF9lbmQKKyAgICBlbmQKKworICAgIGRlZiByZWFkX2Jvb2wKKyAgICAgIEBwcm90b2NvbC5yZWFkX2Jvb2wKKyAgICBlbmQKKworICAgIGRlZiByZWFkX2J5dGUKKyAgICAgIEBwcm90b2NvbC5yZWFkX2J5dGUKKyAgICBlbmQKKworICAgIGRlZiByZWFkX2kxNgorICAgICAgQHByb3RvY29sLnJlYWRfaTE2CisgICAgZW5kCisKKyAgICBkZWYgcmVhZF9pMzIKKyAgICAgIEBwcm90b2NvbC5yZWFkX2kzMgorICAgIGVuZAorCisgICAgZGVmIHJlYWRfaTY0CisgICAgICBAcHJvdG9jb2wucmVhZF9pNjQKKyAgICBlbmQKKworICAgIGRlZiByZWFkX2RvdWJsZQorICAgICAgQHByb3RvY29sLnJlYWRfZG91YmxlCisgICAgZW5kCisKKyAgICBkZWYgcmVhZF9zdHJpbmcKKyAgICAgIEBwcm90b2NvbC5yZWFkX3N0cmluZworICAgIGVuZAorCisgICAgZGVmIHJlYWRfYmluYXJ5CisgICAgICBAcHJvdG9jb2wucmVhZF9iaW5hcnkKKyAgICBlbmQKKyAgZW5kCitlbmQKXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9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gICAgICAgIGJlZ2luCi0gICAgICAgICAgQGhhbmRsZS5jb25uZWN0X25vbmJsb2NrKHNvY2thZGRyKQotICAgICAgICByZXNjdWUgRXJybm86OkVJTlBST0dSRVNTCi0gICAgICAgICAgdW5sZXNzIElPLnNlbGVjdChuaWwsIFsgQGhhbmRsZSBdLCBuaWwsIEB0aW1lb3V0KQotICAgICAgICAgICAgcmFpc2UgVHJhbnNwb3J0RXhjZXB0aW9uLm5ldyhUcmFuc3BvcnRFeGNlcHRpb246Ok5PVF9PUEVOLCAiQ29ubmVjdGlvbiB0aW1lb3V0IHRvICN7QGRlc2N9IikKLSAgICAgICAgICBlbmQKKyAgICAgICAgICBzb2NrZXQgPSA6OlNvY2tldC5uZXcoYWRkcmluZm9bNF0sIDo6U29ja2V0OjpTT0NLX1NUUkVBTSwgMCkKKyAgICAgICAgICBzb2NrZXQuc2V0c29ja29wdCg6OlNvY2tldDo6SVBQUk9UT19UQ1AsIDo6U29ja2V0OjpUQ1BfTk9ERUxBWSwgMSkKKyAgICAgICAgICBzb2NrYWRkciA9IDo6U29ja2V0LnNvY2thZGRyX2luKGFkZHJpbmZvWzFdLCBhZGRyaW5mb1szXSkKICAgICAgICAgICBiZWdpbgotICAgICAgICAgICAgQGhhbmRsZS5jb25uZWN0X25vbmJsb2NrKHNvY2thZGRyKQotICAgICAgICAgIHJlc2N1ZSBFcnJubzo6RUlTQ09OTgorICAgICAgICAgICAgc29ja2V0LmNvbm5lY3Rfbm9uYmxvY2soc29ja2FkZHIpCisgICAgICAgICAgcmVzY3VlIEVycm5vOjpFSU5QUk9HUkVTUworICAgICAgICAgICAgdW5sZXNzIElPLnNlbGVjdChuaWwsIFsgc29ja2V0IF0sIG5pbCwgQHRpbWVvdXQpCisgICAgICAgICAgICAgIG5leHQKKyAgICAgICAgICAgIGVuZAorICAgICAgICAgICAgYmVnaW4KKyAgICAgICAgICAgICAgc29ja2V0LmNvbm5lY3Rfbm9uYmxvY2soc29ja2FkZHIpCisgICAgICA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XJlZAorICAgICAgZXhwZWN0KHRyYW5zKS50byByZWNlaXZlKDp3cml0ZSkud2l0aCgib25lL3R3by90aHJlZS8iKS5vcmRlcmVkCisgICAgICBleHBlY3QodHJhbnMpLnRvIHJlY2VpdmUoOmZsdXNoKS5vcmRlcmVkCiAgICAgICBidHJhbnMuZmx1c2gKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgb25seSBzZW5kIGJ1ZmZlcmVkIGRhdGEgb25jZSIgZG8KLSAgICAgIHRyYW5zID0gbW9jaygiVHJhbnNwb3J0IikKKyAgICAgIHRyYW5zID0gZG91YmxlKCJUcmFuc3BvcnQiKQogICAgICAgYnRyYW5zID0gVGhyaWZ0OjpCdWZmZXJlZFRyYW5zcG9ydC5uZXcodHJhbnMpCiAgICAgICBidHJhbnMud3JpdGUoIm9uZS8iKQogICAgICAgYnRyYW5zLndyaXRlKCJ0d28vIikKICAgICAgIGJ0cmFucy53cml0ZSgidGhyZWUvIikKLSAgICAgIHRyYW5zLnNob3VsZF9yZWNlaXZlKDp3cml0ZSkud2l0aCgib25lL3R3by90aHJlZS8iKQotICAgICAgdHJhbnMuc3R1YiEoOmZsdXNoKQorICAgICAgZXhwZWN0KHRyYW5zKS50byByZWNlaXZlKDp3cml0ZSkud2l0aCgib25lL3R3by90aHJlZS8iKQorICAgICAgYWxsb3codHJhbnMpLnRvIHJlY2VpdmUoOmZsdXNoKQogICAgICAgYnRyYW5zLmZsdXNoCiAgICAgICAjIE5vdGhpbmcgdG8gZmx1c2ggd2l0aCBubyBkYXRhCiAgICAgICBidHJhbnMuZmx1c2gKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgZmx1c2ggb24gY2xvc2UiIGRvCi0gICAgICB0cmFucyA9IG1vY2soIlRyYW5zcG9ydCIpCi0gICAgICB0cmFucy5zaG91bGRfcmVjZWl2ZSg6Y2xvc2UpCisgICAgICB0cmFucyA9IGRvdWJsZSgiVHJhbnNwb3J0IikKKyAgICAgIGV4cGVjdCh0cmFuc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ZT9wYXJhbT12YWx1ZSIpCiAgICAgZW5kCisgICAgCisgICAgaXQgInNob3VsZCBwcm92aWRlIGEgcmVhc29uYWJsZSB0b19zIiBkbworICAgICAgQGNsaWVudC50b19zID09ICJodHRwOi8vbXkuZG9tYWluLmNvbS9wYXRoL3RvL3NlcnZpY2U/cGFyYW09dmFsdWUiCisgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIGFsd2F5cyBiZSBvcGVuIiBkbwotICAgICAgQGNsaWVudC5zaG91bGQgYmVfb3BlbgorICAgICAgZXhwZWN0KEBjbGllbnQpLnRvIGJlX29wZW4KICAgICAgIEBjbGllbnQuY2xvc2UKLSAgICAgIEBjbGllbnQuc2hvdWxkIGJlX29wZW4KKyAgICAgIGV4cGVjdChAY2xpZW50KS50byBiZV9vcGVuCiAgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIHBvc3QgdmlhIEhUVFAgYW5kIHJldHVybiB0aGUgcmVzdWx0cyIgZG8KICAgICAgIEBjbGllbnQud3JpdGUgImEgdGVzdCIKICAgICAgIEBjbGllbnQud3JpdGUgIiBmcmFtZSIKLSAgICAgIE5ldDo6SFRUUC5zaG91bGRfcmVjZWl2ZSg6bmV3KS53aXRoKCJteS5kb21haW4uY29tIiwgODApLmFuZF9yZXR1cm4gZG8KLSAgICAgICAgbW9jaygiTmV0OjpIVFRQIikudGFwIGRvIHxodHRwfAotICAgICAgICAgIGh0dHAuc2hvdWxkX3JlY2VpdmUoOnVzZV9zc2w9KS53aXRoKGZhbHNlKQotICAgICAgICAgIGh0dHAuc2hvdWxkX3JlY2VpdmUoOnBvc3QpLndpdGgoIi9wYXRoL3RvL3NlcnZpY2U/cGFyYW09dmFsdWUiLCAiYSB0ZXN0IGZyYW1lIiwgeyJDb250ZW50LVR5cGUiPT4iYXBwbGljYXRpb24veC10aHJpZnQifSkuYW5kX3JldHVybiBkbwotICAgICAgICAgICAgbW9jaygiTmV0OjpIVFRQT0siKS50YXAgZG8gfHJlc3BvbnNlfAotICAgICAgICAgICAgICByZXNwb25zZS5zaG91bGRfcmVjZWl2ZSg6Ym9keSkuYW5kX3JldHVybiAiZGF0YSIKKyAgICAgIGV4cGVjdChOZXQ6OkhUVFApLnRvIHJlY2VpdmUoOm5ldykud2l0aCgibXkuZG9tYWluLmNvbSIsIDgwKSBkbworICAgICAgICBkb3VibGUoIk5ldDo6SFRUUCIpLnRhcCBkbyB8aHR0cHwKKyAgICAgICAgICBleHBlY3QoaHR0cCkudG8gcmVjZWl2ZSg6dXNlX3NzbD0pLndpdGgoZmFsc2UpCisgICAgICAgICAgZXhwZWN0KGh0dHApLnRvIHJlY2VpdmUoOnBvc3QpLndpdGgoIi9wYXRoL3RvL3NlcnZpY2U/cGFyYW09dmFsdWUiLCAiYSB0ZXN0IGZyYW1lIiwgeyJDb250ZW50LVR5cGUiPT4iYXBwbGljYXRpb24veC10aHJpZnQifSkgZG8KKyAgICAgICAgICAgIGRvdWJsZSgiTmV0OjpIVFRQT0siKS50YXAgZG8gfHJlc3BvbnNlfAorICAgICAgICAgICAgICBleHBlY3QocmVzcG9uc2UpLnRvIHJlY2VpdmUoOmJvZHkpLmFuZF9yZXR1cm4gImRhdGEiCiAgICAgICAgICAgICBlbmQKICAgICAgICAgICBlbmQKICAgICAgICAgZW5kCiAgICAgICBlbmQKICAgICAgIEBjbGllbnQuZmx1c2gKLSAgICAgIEBjbGllbnQucmVhZCgxMCkuc2hvdWxkID09ICJkYXRhIgorICAgICAgZXhwZWN0KEBjbGllbnQucmVhZCgxMCkpLnRvIGVxKCJkYXRhIikKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgc2VuZCBjdXN0b20gaGVhZGVycyBpZiBkZWZpbmVkIiBkbwpAQCAtNTUsMTggKzU5LDMzIEBACiAgICAgICBoZWFkZXJzID0geyJDb250ZW50LVR5cGUiPT4iYXBwbGljYXRpb24veC10aHJpZnQifS5tZXJnZShjdXN0b21faGVhZGVycykKIAogICAgICAgQGNsaWVudC5hZGRfaGVhZGVycyh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AgIGh0dHAuc2hvdWxkX3JlY2VpdmUoOnVzZV9zc2w9KS53aXRoKHRydWUpCi0gICAgICAgICAgaHR0cC5zaG91bGRfcmVjZWl2ZSg6dmVyaWZ5X21vZGU9KS53aXRoKE9wZW5TU0w6OlNTTDo6VkVSSUZZX1BFRVIpCi0gICAgICAgICAgaHR0cC5zaG91bGRfcmVjZWl2ZSg6cG9zdCkud2l0aChAc2VydmljZV9wYXRoLCAidGVzdCIsCi0gICAgICAgICAgICAgICJDb250ZW50LVR5cGUiID0+ICJhcHBsaWNhdGlvbi94LXRocmlmdCIpLmFuZF9yZXR1cm4gZG8KLSAgICAgICAgICAgIG1vY2soIk5ldDo6SFRUUE9LIikudGFwIGRvIHxyZXNwb25zZXwKLSAgICAgICAgICAgICAgcmVzcG9uc2Uuc2hvdWxkX3JlY2VpdmUoOmJvZHkpLmFuZF9yZXR1cm4gImRhdGEiCisgICAgICBleHBlY3QoTmV0OjpIVFRQKS50byByZWNlaXZlKDpuZXcpLndpdGgoIm15LmRvbWFpbi5jb20iLCA0NDMpIGRvCisgICAgICAgIGRvdWJsZSgiTmV0OjpIVFRQIikudGFwIGRvIHxodHRwfAorICAgICAgICAgIGV4cGVjdChodHRwKS50byByZWNlaXZlKDp1c2Vfc3NsPSkud2l0aCh0cnVlKQorICAgICAgICAgIGV4cGVjdChodHRwKS50byByZWNlaXZlKDp2ZXJpZnlfbW9kZT0pLndpdGgoT3BlblNTTDo6U1NMOjpWRVJJRllfUEVFUikKKyAgICAgICAgICBleHBlY3QoaHR0cCkudG8gcmVjZWl2ZSg6cG9zdCkud2l0aChAc2VydmljZV9wYXRoLCAidGVzdCIsCisgICAgICAgICAgICAgICJDb250ZW50LVR5cGUiID0+ICJhcHBsaWNhdGlvbi94LXRocmlmdCIpIGRvCisgICAgICAgICAgICBkb3VibGUoIk5ldDo6SFRUUE9LIikudGFwIGRvIHxyZXNwb25zZXwKKyAgICAgICAgICAgICAgZXhwZWN0KHJlc3BvbnNlKS50byByZW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LnNob3VsZCA9PSAieyIKKyAgICAgIGV4cGVjdChAdHJhbnMucmVhZChAdHJhbnMuYXZhaWxhYmxlKSkudG8gZXEoInsiKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCB3cml0ZSBqc29uIG9iamVjdCBlbmQiIGRvCiAgICAgICBAcHJvdC53cml0ZV9qc29uX29iamVjdF9lbmQKLSAgICAgIEB0cmFucy5yZWFkKEB0cmFucy5hdmFpbGFibGUpLnNob3VsZCA9PSAifSIKKyAgICAgIGV4cGVjdChAdHJhbnMucmVhZChAdHJhbnMuYXZhaWxhYmxlKSkudG8gZXEoIn0iKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCB3cml0ZSBqc29uIGFycmF5IHN0YXJ0IiBkbwogICAgICAgQHByb3Qud3JpdGVfanNvbl9hcnJheV9zdGFydAotICAgICAgQHRyYW5zLnJlYWQoQHRyYW5zLmF2YWlsYWJsZSkuc2hvdWxkID09ICJbIgorICAgICAgZXhwZWN0KEB0cmFucy5yZWFkKEB0cmFucy5hdmFpbGFibGUpKS50byBlcSgiWyIpCiAgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIHdyaXRlIGpzb24gYXJyYXkgZW5kIiBkbwogICAgICAgQHByb3Qud3JpdGVfanNvbl9hcnJheV9lbmQKLSAgICAgIEB0cmFucy5yZWFkKEB0cmFucy5hdmFpbGFibGUpLnNob3VsZCA9PSAiXSIKKyAgICAgIGV4cGVjdChAdHJhbnMucmVhZChAdHJhbnMuYXZhaWxhYmxlKSkudG8gZXEoIl0iKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCB3cml0ZSBtZXNzYWdlIGJlZ2luIiBkbwogICAgICAgQHByb3Qud3JpdGVfbWVzc2FnZV9iZWdpbigibmFtZSIsIDEyLCAzMikKLSAgICAgIEB0cmFucy5yZWFkKEB0cmFucy5hdmFpbGFibGUpLnNob3VsZCA9PSAiWzEsXCJuYW1lXCIsMTIsMzIiCisgICAgICBleHBlY3QoQHRyYW5zLnJ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ZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXFwiKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFwvXCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXC8iKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFxiXCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXGIiKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFxmXCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXGYiKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFxuXCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXG4iKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFxyXCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXHIiKQorCisgICAgICBAdHJhbnMud3JpdGUoIlwiXFx0XCIiKQorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpKS50byBlcSgiXHQiKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCByZWFkIGpzb24gc3RyaW5nIiBkbwogICAgICAgQHRyYW5zLndyaXRlKCJcIlxcUCIpCiAgICAgICBleHBlY3Qge0Bwcm90LnJlYWRfanNvbl9zdHJpbmcoZmFsc2UpfS50byByYWlzZV9lcnJvcihUaHJpZnQ6OlByb3RvY29sRXhjZXB0aW9uKQogCi0gICAgICBAdHJhbnMud3JpdGUoIlwiXFxuXCIiKQotICAgICAgQHByb3QucmVhZF9qc29uX3N0cmluZyhmYWxzZSkuc2hvdWxkID09ICJcXG4iCi0KICAgICAgIEB0cmFuc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9PSB0cnVlCi0gICAgICBAcHJvdC5pc19qc29uX251bWVyaWMoIjQiKS5zaG91bGQgPT0gdHJ1ZQotICAgICAgQHByb3QuaXNfanNvbl9udW1lcmljKCI1Iikuc2hvdWxkID09IHRydWUKLSAgICAgIEBwcm90LmlzX2pzb25fbnVtZXJpYygiNiIpLnNob3VsZCA9PSB0cnVlCi0gICAgICBAcHJvdC5pc19qc29uX251bWVyaWMoIjciKS5zaG91bGQgPT0gdHJ1ZQotICAgICAgQHByb3QuaXNfanNvbl9udW1lcmljKCI4Iikuc2hvdWxkID09IHRydWUKLSAgICAgIEBwcm90LmlzX2pzb25fbnVtZXJpYygiOSIpLnNob3VsZCA9PSB0cnVlCi0gICAgICBAcHJvdC5pc19qc29uX251bWVyaWMoIkUiKS5zaG91bGQgPT0gdHJ1ZQotICAgICAgQHByb3QuaXNfanNvbl9udW1lcmljKCJlIikuc2hvdWxkID09IHRydWUKKyAgICAgIGV4cGVjdChAcHJvdC5pc19qc29uX251bWVyaWMoIkEiKSkudG8gZXEoZmFsc2UpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIrIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCItIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIuIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIwIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIxIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIyIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCIzIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI0IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI1IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI2IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI3IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI4IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCI5IikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCJFIikpLnRvIGVxKHRydWUpCisgICAgICBleHBlY3QoQHByb3QuaXNfanNvbl9udW1lcmljKCJlIikpLnRvIGVxKHRydWUpCiAgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIHJlYWQganNvbiBudW1lcmljIGNoYXJzIiBkbwogICAgICAgQHRyYW5zLndyaXRlKCIxLjQ1M0U0NVQiKQotICAgICAgQHByb3QucmVhZF9qc29uX251bWVyaWNfY2hhcnMuc2hvdWxkID09ICIxLjQ1M0U0NSIKKyAgICAgIGV4cGVjdChAcHJvdC5yZWFkX2pzb25fbnVtZXJpY19jaGFycykudG8gZXEoIjEuNDUzRTQ1IikKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgcmVhZCBqc29uIGludGVnZXIiIGRvCkBAIC0zMzYsNyArMzYyLDcgQEAKICAgICAgIEBwcm90LnJlYWRfc3RyaW5nCiAKICAgICAgIEB0cmFucy53cml0ZSgiMTQ1M1QiKQotICAgICAgQHByb3QucmVhZF9qc29uX2ludGVnZXIuc2hvdWxkID09IDE0NTMKKyAgICAgIGV4cGVjdChAcHJvdC5yZWFkX2pzb25faW50ZWdlcikudG8gZXEoMTQ1MykKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgcmVhZCBqc29uIGRvdWJsZSIgZG8KQEAgLTM0OCwzNyArMzc0LDM3IEBACiAgICAgICBleHBlY3Qge0Bwcm90LnJlYWRfanNvbl9kb3VibGV9LnRvIHJhaXNlX2Vycm9yKFRocmlmdDo6UHJvdG9jb2xFeGNlcHRpb24pCiAKICAgICAgIEB0cmFucy53cml0ZSgiMS40NTNlMDFcIlwiIikKLSAgICAgIEBwcm90LnJlYWRfanNvbl9kb3VibGUuc2hvdWxkID09IDE0LjUzCisgICAgICBleHBlY3QoQHByb3QucmVhZF9qc29uX2RvdWJsZSkudG8gZXEoMTQuNTMpCiAgICAgICBAcHJvdC5yZWFkX3N0cmluZwogCiAgICAgICBAdHJhbnMud3JpdGUoIlwiTmFOXCIiKQotICAgICAgQHByb3QucmVhZF9qc29uX2RvdWJsZS5uYW4/LnNob3VsZCA9PSB0cnVlCisgICAgICBleHBlY3QoQHByb3QucmVhZF9qc29uX2RvdWJsZS5uYW4/KS50byBlcSh0cnVlKQogCiAgICAgICBAdHJhbnMud3JpdGUoIlwiSW5maW5pdHlcIiIpCi0gICAgICBAcHJvdC5yZWFkX2pzb25fZG91YmxlLnNob3VsZCA9PSArMS4wLzAuMAorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfanNvbl9kb3VibGUpLnRvIGVxKCsxLjAvMC4wKQogCiAgICAgICBAdHJhbnMud3JpdGUoIlwiLUluZmluaXR5XCIiKQotICAgICAgQHByb3QucmVhZF9qc29uX2RvdWJsZS5zaG91bGQgPT0gLTEuMC8wLjAKKyAgICAgIGV4cGVjdChAcHJvdC5yZWFkX2pzb25fZG91YmxlKS50byBlcSgtMS4wLzAuMCkKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgcmVhZCBqc29uIG9iamVjdCBzdGFydCIgZG8KICAgICAgIEB0cmFucy53cml0ZSgieyIpCi0gICAgICBAcHJvdC5yZWFkX2pzb25fb2JqZWN0X3N0YXJ0LnNob3VsZCA9PSBuaWwKKyAgICAgIGV4cGVjdChAcHJvdC5yZWFkX2pzb25fb2JqZWN0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LnNob3VsZCA9PSBuaWwKKyAgICAgIGV4cGVjdChAcHJvdC5yZWFkX2ZpZWxkX2VuZCkudG8gZXEobmlsKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCByZWFkIG1hcCBiZWdpbiIgZG8KICAgICAgIEB0cmFucy53cml0ZSgiW1wicmVjXCIsXCJsc3RcIiwyLHsiKQotICAgICAgQHByb3QucmVhZF9tYXBfYmVnaW4uc2hvdWxkID09IFsxMiwgMTUsIDJdCisgICAgICBleHBlY3QoQHByb3QucmVhZF9tYXBfYmVnaW4pLnRvIGVxKFsxMiwgMTUsIDJdKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCByZWFkIG1hcCBlbmQiIGRvCiAgICAgICBAdHJhbnMud3JpdGUoIn1dIikKLSAgICAgIEBwcm90LnJlYWRfbWFwX2VuZC5zaG91bGQgPT0gbmlsCisgICAgICBleHBlY3QoQHByb3QucmVhZF9tYXBfZW5kKS50byBlcShuaWwpCiAgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIHJlYWQgbGlzdCBiZWdpbiIgZG8KICAgICAgIEB0cmFucy53cml0ZSgiW1wicmVjXCIsMlwiXCIiKQotICAgICAgQHByb3QucmVhZF9saXN0X2JlZ2luLnNob3VsZCA9PSBbMTIsIDJdCisgICAgICBleHBlY3QoQHByb3QucmVhZF9saXN0X2JlZ2luKS50byBlcShbMTIsIDJdKQogICAgIGVuZAogCiAgICAgaXQgInNob3VsZCByZWFkIGxpc3QgZW5kIiBkbwogICAgICAgQHRyYW5zLndyaXRlKCJdIikKLSAgICAgIEBwcm90LnJlYWRfbGlzdF9lbmQuc2hvdWxkID09IG5pbAorICAgICAgZXhwZWN0KEBwcm90LnJlYWRfbGlzdF9lbmQpLnRvIGVxKG5pbCkKICAgICBlbmQKIAogICAgIGl0ICJzaG91bGQgcmVhZCBzZXQgYmVnaW4iIGRvCiAgICAgICBAdHJhbnMud3JpdGUoIltcInJlY1wiLDJcIlwiIikKLSAgICAgIEBwcm90LnJ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YSkudG8gZXEoYikKICAgICAgICAgYi52YWx1ZS5wdXNoIFszLCA0LCA1XQotICAgICAgICBhLnNob3VsZF9ub3QgPT0gYgorICAgICAgICBleHBlY3QoYSkubm90X3RvIGVxKGIpCiAgICAgICBlbmQKICAgICBlbmQKIApAQCAtNTIsOSArNTIsOSBAQAogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsdWUgPSBbIFsxLCAyLCAzXSwgWzIsIDMsIDRdIF0udG9fc2V0CiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWxpZGF0ZQogICAgICAgICBlbmQKLSAgICAgICAgYS5zaG91bGQgPT0gYgorICAgICAgICBleHBlY3QoYSkudG8gZXEoYikKICAgICAgICAgYi52YWx1ZS5hZGQgWzMsIDQsIDVdCi0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC02NSw5ICs2NSw5IEBACiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWx1ZSA9IHsgWzEsIDIsIDNdID0+IDEsIFsyLCAzLCA0XSA9PiAyIH0KICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbGlkYXRlCiAgICAgICAgIGVuZAotICAgICAgICBhLnNob3VsZCA9PSBiCisgICAgICAgIGV4cGVjdChhKS50byBlcShiKQogICAgICAgICBiLnZhbHVlW1szLCA0LCA1XV0gPSAzCi0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC03OCw5ICs3OCw5IEBACiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWx1ZSA9IHsgMSA9PiBbMSwgMiwgM10sIDIgPT4gWzIsIDMsIDRdIH0KICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbGlkYXRlCiAgICAgICAgIGVuZAotICAgICAgICBhLnNob3VsZCA9PSBiCisgICAgICAgIGV4cGVjdChhKS50byBlcShiKQogICAgICAgICBiLnZhbHVlWzNdID0gWzMsIDQsIDVdCi0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC05MSw5ICs5MSw5IEBACiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWx1ZSA9IFsgWzEsIDIsIDNdLnRvX3NldCwgWzIsIDMsIDRdLnRvX3NldCBdCiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWxpZGF0ZQogICAgICAgICBlbmQKLSAgICAgICAgYS5zaG91bGQgPT0gYgorICAgICAgICBleHBlY3QoYSkudG8gZXEoYikKICAgICAgICAgYi52YWx1ZS5wdXNoKFszLCA0LCA1XS50b19zZXQpCi0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC0xMDQsOSArMTA0LDkgQEAKICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbHVlID0gWyBbMSwgMiwgM10udG9fc2V0LCBbMiwgMywgNF0udG9fc2V0IF0udG9fc2V0CiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWxpZGF0ZQogICAgICAgICBlbmQKLSAgICAgICAgYS5zaG91bGQgPT0gYgorICAgICAgICBleHBlY3QoYSkudG8gZXEoYikKICAgICAgICAgYi52YWx1ZS5hZGQoWzMsIDQsIDVdLnRvX3NldCkKLSAgICAgICAgYS5zaG91bGRfbm90ID09IGIKKyAgICAgICAgZXhwZWN0KGEpLm5vdF90byBlcShiKQogICAgICAgZW5kCiAgICAgZW5kCiAKQEAgLTExNyw5ICsxMTcsOSBAQAogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsdWUgPSB7IFsxLCAyLCAzXS50b19zZXQgPT4gMSwgWzIsIDMsIDRdLnRvX3NldCA9PiAyIH0KICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbGlkYXRlCiAgICAgICAgIGVuZAotICAgICAgICBhLnNob3VsZCA9PSBiCisgICAgICAgIGV4cGVjdChhKS50byBlcShiKQogICAgICAgICBiLnZhbHVlW1szLCA0LCA1XS50b19zZXRdID0gMwotICAgICAgICBhLnNob3VsZF9ub3QgPT0gYgorICAgICAgICBleHBlY3QoYSkubm90X3RvIGVxKGIpCiAgICAgICBlbmQKICAgICBlbmQKIApAQCAtMTMwLDkgKzEzMCw5IEBACiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWx1ZSA9IHsgMSA9PiBbMSwgMiwgM10udG9fc2V0LCAyID0+IFsyLCAzLCA0XS50b19zZXQgfQogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsaWRhdGUKICAgICAgICAgZW5kCi0gICAgICAgIGEuc2hvdWxkID09IGIKKyAgICAgICAgZXhwZWN0KGEpLnRvIGVxKGIpCiAgICAgICAgIGIudmFsdWVbM10gPSBbMywgNCwgNV0udG9fc2V0Ci0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC0xNDMsOSArMTQzLDkgQEAKICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbHVlID0gWyB7MSA9PiAyLCAzID0+IDR9LCB7MiA9PiAzLCA0ID0+IDV9IF0KICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbGlkYXRlCiAgICAgICAgIGVuZAotICAgICAgICBhLnNob3VsZCA9PSBiCisgICAgICAgIGV4cGVjdChhKS50byBlcShiKQogICAgICAgICBiLnZhbHVlLnB1c2goeyAzID0+IDQsIDUgPT4gNiB9KQotICAgICAgICBhLnNob3VsZF9ub3QgPT0gYgorICAgICAgICBleHBlY3QoYSkubm90X3RvIGVxKGIpCiAgICAgICBlbmQKICAgICBlbmQKIApAQCAtMTU2LDkgKzE1Niw5IEBACiAgICAgICAgICAgdGhyaWZ0X3N0cnVjdC52YWx1ZSA9IFsgezEgPT4gMiwgMyA9PiA0fSwgezIgPT4gMywgNCA9PiA1fSBdLnRvX3NldAogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsaWRhdGUKICAgICAgICAgZW5kCi0gICAgICAgIGEuc2hvdWxkID09IGIKKyAgICAgICAgZXhwZWN0KGEpLnRvIGVxKGIpCiAgICAgICAgIGIudmFsdWUuYWRkKHsgMyA9PiA0LCA1ID0+IDYgfSkKLSAgICAgICAgYS5zaG91bGRfbm90ID09IGIKKyAgICAgICAgZXhwZWN0KGEpLm5vdF90byBlcShiKQogICAgICAgZW5kCiAgICAgZW5kCiAKQEAgLTE2OSw5ICsxNjksOSBAQAogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsdWUgPSB7IHsgMSA9PiAyLCAzID0+IDR9ID0+IDEsIHsyID0+IDMsIDQgPT4gNX0gID0+IDIgfQogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsaWRhdGUKICAgICAgICAgZW5kCi0gICAgICAgIGEuc2hvdWxkID09IGIKKyAgICAgICAgZXhwZWN0KGEpLnRvIGVxKGIpCiAgICAgICAgIGIudmFsdWVbezMgPT4gNCwgNSA9PiA2fV0gPSAzCi0gICAgICAgIGEuc2hvdWxkX25vdCA9PSBiCisgICAgICAgIGV4cGVjdChhKS5ub3RfdG8gZXEoYikKICAgICAgIGVuZAogICAgIGVuZAogCkBAIC0xODIsOSArMTgyLDkgQEAKICAgICAgICAgICB0aHJpZnRfc3RydWN0LnZhbHVlID0geyAxID0+IHsgMSA9PiAyLCAzID0+IDR9LCAyID0+IHsyID0+IDMsIDQgPT4gNX0gfQogICAgICAgICAgIHRocmlmdF9zdHJ1Y3QudmFsaWRhdGUKICAgICAgICAgZW5kCi0gICAgICAgIGEuc2hvdWxkID09IGIKKyAgICAgICAgZXhwZWN0KGEpLnRvIG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S53aXRoKCdjb2RlJywgVGhyaWZ0OjpUeXBlczo6STMyLCAyKSMsIDEpCi0gICAgICAgIHByb3Quc2hvdWxkX3JlY2VpdmUoOndyaXRlX2kzMikud2l0aCgxKQotICAgICAgICBwcm90LnNob3VsZF9yZWNlaXZlKDp3cml0ZV9maWVsZF9zdG9wKQotICAgICAgICBwcm90LnNob3VsZF9yZWNlaXZlKDp3cml0ZV9maWVsZF9lbmQpLnR3aWNlCisgICAgICAgIHByb3QgPSBUaHJpZnQ6OkJhc2VQcm90b2NvbC5uZXcoZG91YmxlKCJ0cmFucyIpKQorICAgICAgICBleHBlY3QocHJvdCkudG8gcmVjZWl2ZSg6d3JpdGVfc3RydWN0X2JlZ2luKS53aXRoKCJTcGVjTmFtZXNwYWNlOjpYY2VwdGlvbiIpCisgICAgICAgIGV4cGVjdChwcm90KS50byByZWNlaXZlKDp3cml0ZV9zdHJ1Y3RfZW5kKQorICAgICAgICBleHBlY3QocHJvdCkudG8gcmVjZWl2ZSg6d3JpdGVfZmllbGRfYmVnaW4pLndpdGgoJ21lc3NhZ2UnLCBUaHJpZnQ6OlR5cGVzOjpTVFJJTkcsIDEpIywgInNvbWV0aGluZyBoYXBwZW5lZCIpCisgICAgICAgIGV4cGVjdChwcm90KS50byByZWNlaXZlKDp3cml0ZV9zdHJpbmcpLndpdGgoInNvbWV0aGluZyBoYXBwZW5lZCIpCisgICAgICAgIGV4cGVjdChwcm90KS50byByZWNlaXZlKDp3cml0ZV9maWVsZF9iZWdpbikud2l0aCgnY29kZScsIFRocmlmdDo6VHlwZXM6OkkzMiwgMikjLCAxKQorICAgICAgICBleHBlY3QocHJvdCkudG8gcmVjZWl2ZSg6d3JpdGVfaTMyKS53aXRoKDEpCisgICAgICAgIGV4cGVjdChwcm90KS50byByZWNlaXZlKDp3cml0ZV9maWVsZF9zdG9wKQorICAgICAgICBleHBlY3QocHJvdCkudG8gcmVjZWl2ZSg6d3JpdGVfZmllbGRfZW5kKS50d2ljZQogCiAgICAg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BmaWVsZCA9IHs6dHlwZSA9PiBUaHJpZnQ6OlR5cGVzOjpMSVNULCA6ZWxlbWVudCA9PiB7OnR5cGUgPT4gVGhyaWZ0OjpUeXBlczo6STMyfX0KKyAgICAgIGV4cGVjdCB7IFRocmlmdC5jaGVja190eXBlKFsxXSwgICAgICAgICAgICBmaWVsZCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmZvbykgfS5ub3RfdG8gcmFpc2VfZXJyb3IKKyAgICAgIGV4cGVjdCB7IFRocmlmdC5jaGVja190eXBlKHs6Zm9vID0+IDF9LCAgICBmaWVsZCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmZvbykgfS50byByYWlzZV9lcnJvcihUaHJpZnQ6OlR5cGVFcnJvcikKKyAgICAgIGZpZWxkID0gezp0eXBlID0+IFRocmlmdDo6VHlwZXM6OlNFVCwgOmVsZW1lbnQgPT4gezp0eXBlID0+IFRocmlmdDo6VHlwZXM6OkkzMn19CisgICAgICBleHBlY3QgeyBUaHJpZnQuY2hlY2tfdHlwZShTZXQubmV3KFsxLDJdKSwgZmllbGQsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpmb28pIH0ubm90X3RvIHJhaXNlX2Vycm9yCisgICAgICBleHBlY3QgeyBUaHJpZnQuY2hlY2tfdHlwZShbMSwyXSwgICAgICAgICAgZmllbGQsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpmb28pIH0udG8gcmFpc2VfZXJyb3IoVGhyaWZ0OjpUeXBlRXJyb3IpCisgICAgICBleHBlY3QgeyBUaHJpZnQuY2hlY2tfdHlwZSh7OmZvbyA9PiB0cnVlfSwgZmllbGQsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpmb28pIH0udG8gcmFpc2VfZXJyb3IoVGhyaWZ0OjpUeXBlRXJyb3IpCiAgICAgZW5kCiAKICAgICBpdCAic2hvdWxkIGVycm9yIG91dCBpZiBuaWwgaXMgcGFzc2VkIGFuZCBza2lwX3R5cGVzIGlzIGZhbHNlIi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BSdXN0IG5hbWluZyBjb252ZW50aW9ucworCisgICAgUHJldmlvdXNseSwgZW51bSB2YXJpYW50cyB3ZXJlIHVwcGVyY2FzZWQgaW4gdGhlIGF1dG8tZ2VuZXJhdGVkIGNvZGUuCisgICAgRm9yIGV4YW1wbGUsIHRoZSBmb2xsb3dpbmcgdGhyaWZ0IGVudW06CisKKyAgICBgYGB0aHJpZnQKKyAgICAvLyBUSFJJRlQKKyAgICBlbnVtIE9wZXJhdGlvbiB7CisgICAgICBBREQsCisgICAgICBTVUJUUkFDVCwKKyAgICAgIE1VTFRJUExZLAorICAgICAgRElWSURFLAorICAgIH0KKyAgICBgYGAKKyAgICAKKyAgICB1c2VkIHRvIGdlbmVyYXRlOgorICAgIAorICAgIGBgYHJ1c3QKKyAgICAvLyBPTEQgQVVUTy1HRU5FUkFURUQgUlVTVAorICAgIHB1YiBlbnVtIE9wZXJhdGlvbiB7CisgICAgICAgQURELAorICAgICAgIFNVQlRSQUNULAorICAgICAgIE1VTFRJUExZLAorICAgICAgIERJVklERSwKKyAgICAgfQorICAgIGBgYAorICAgIEl0ICpub3cqIGdlbmVyYXRlczoKKyAgICBgYGBydXN0CisgICAgLy8gTkVXIEFVVE8tR0VORVJBVEVEIFJVU1QKKyAgICBwdWIgZW51bSBPcGVyYXRpb24geworICAgICAgIEFkZCwKKyAgICAgICBTdWJ0cmFjdCwKKyAgICAgICBNdWx0aXBseSwKKyAgICAgICBEaXZpZGUsCisgICAgIH0KKyAgICBgYGAKKyAgICAKKyAgICBZb3Ugd2lsbCBoYXZlIHRvIGNoYW5nZSBhbGwgZW51bSB2YXJpYW50cyBpbiB5b3VyIGNvZGUgdG8gdXNlIGNhbWVsLWNhc2VkIG5hbWVzLgorICAgIFRoaXMgc2hvdWxkIGJlIGEgc2VhcmNoIGFuZCByZXBsYWNlLgorCisjIyBDb250cmlidXRpbmcKKworQnVnIHJlcG9ydHMgYW5kIFBScyBhcmUgYWx3YXlzIHdlbGNvbWUhIFBsZWFzZS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wdWIgZm4gcmVhZF9hcHBsaWNhdGlvbl9lcnJvcl9mcm9tX2luX3Byb3RvY29sKAorICAgICAgICBpOiAmbXV0IFRJbnB1dFByb3RvY29sLAorICAgICkgLT4gOjpSZXN1bHQ8QXBwbGljYXRpb25FcnJvcj4geworICAgICAgICBsZXQgbXV0IG1lc3NhZ2UgPSAiZ2VuZXJhbCByZW1vdGUgZXJyb3IiLnRvX293bmVkKCk7CisgICAgICAgIGxldCBtdXQga2luZCA9IEFwcGxpY2F0aW9uRXJyb3JLaW5kOjpVbmtub3duOworCisgICAgICAgIGkucmVhZF9zdHJ1Y3RfYmVnaW4oKT87CisKKyAgICAgICAgbG9vcCB7CisgICAgICAgICAgICBsZXQgZmllbGRfaWRlbnQgPSBpLnJlYWRfZmllbGRfYmVnaW4oKT87CisKKyAgICAgICAgICAgIGlmIGZpZWxkX2lkZW50LmZpZWxkX3R5cGUgPT0gVFR5cGU6OlN0b3AgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBsZXQgaWQgPSBmaWVsZF9pZGVudAorICAgICAgICAgICAgICAgIC5pZAorICAgICAgICAgICAgICAgIC5leHBlY3QoInNlbmRlciBzaG91bGQgYWx3YXlzIHNwZWNpZnkgaWQgZm9yIG5vbi1TVE9QIGZpZWxkIik7CisKKyAgICAgICAgICAgIG1hdGNoIGlkIHsKKyAgICAgICAgICAgICAgICAxID0+IHsKKyAgICAgICAgICAgICAgICAgICAgbGV0IHJlbW90ZV9tZXNzYWdlID0gaS5yZWFkX3N0cmluZygpPzsKKyAgICAgICAgICAgICAgICAgICAgaS5yZWFkX2ZpZWxkX2VuZCgpPzsKKyAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSA9IHJlbW90ZV9tZXNzYWdlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAyID0+IHsKKyAgICAgICAgICAgICAgICAgICAgbGV0IHJlbW90ZV90eXBlX2FzX2ludCA9IGkucmVhZF9pMzIoKT87CisgICAgICAgICAgICAgICAgICAgIGxldCByZW1vdGVfa2luZDogQXBwbGljYXRpb25FcnJvcktpbmQgPSBUcnlGcm9tOjp0cnlfZnJvbShyZW1vdGVfdHlwZV9hc19pbnQpCisgICAgICAgICAgICAgICAgICAgICAgICAudW53cmFwX29yKEFwcGxpY2F0aW9uRXJyb3JLaW5kOjpVbmtub3duKTsKKyAgICAgICAgICAgICAgICAgICAgaS5yZWFkX2ZpZWxkX2VuZCgpPzsKKyAgICAgICAgICAgICAgICAgICAga2luZCA9IHJlbW90ZV9raW5kOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBfID0+IHsKKyAgICAgICAgICAgICAgICAgICAgaS5za2lwKGZpZWxkX2lkZW50LmZpZWxkX3R5cGUpPzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpLnJlYWRfc3RydWN0X2VuZCgpPzsKKworICAgICAgICBPayhBcHBsaWNhdGlvbkVycm9yIHsKKyAgICAgICAgICAgIGtpbmQ6IGtpbmQsCisgICAgICAgICAgICBtZXNzYWdlOiBtZXNzYWdlLAorICAgICAgICB9KQorICAgIH0KKworICAgIC8vLyBDb252ZXJ0IGFuIGBBcHBsaWNhdGlvbkVycm9yYCBpbnRvIGl0cyB3aXJlIHJlcHJlc2VudGF0aW9uIGFuZCB3cml0ZQorICAgIC8vLyBpdCB0byB0aGUgcmVtb3RlLgorICAgIC8vLworICAgIC8vLyBBcHBsaWNhdGlvbiBjb2RlICoqc2hvdWxkIG5ldmVyKiogY2FsbCB0aGlzIG1ldGhvZCBkaXJlY3RseS4KKyAgICBwdWIgZm4gd3JpdGVfYXBwbGljYXRpb25fZXJyb3JfdG9fb3V0X3Byb3RvY29sKAorICAgICAgICBlOiAmQXBwbGljYXRpb25FcnJvciwKKyAgICAgICAgbzogJm11dCBUT3V0cHV0UHJvdG9jb2wsCisgICAgKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBvLndyaXRlX3N0cnVjdF9iZWdpbigmVFN0cnVjdElkZW50aWZpZXIgeworICAgICAgICAgICAgbmFtZTogIlRBcHBsaWNhdGlvbkV4Y2VwdGlvbiIudG9fb3duZWQoKSwKKyAgICAgICAgfSk/OworCisgICAgICAgIGxldCBtZXNzYWdlX2ZpZWxkID0gVEZpZWxkSWRlbnRpZmllcjo6bmV3KCJtZXNzYWdlIiwgVFR5cGU6OlN0cmluZywgMSk7CisgICAgICAgIGxldCB0eXBlX2ZpZWxkID0gVEZpZWxkSWRlbnRpZmllcjo6bmV3KCJ0eXBlIiwgVFR5cGU6OkkzMiwgMik7CisKKyAgICAgICAgby53cml0ZV9maWVsZF9iZWdpbigmbWVzc2FnZV9maWVsZCk/OworICAgICAgICBvLndyaXRlX3N0cmluZygmZS5tZXNzYWdlKT87CisgICAgICAgIG8ud3JpdGVfZmllbGRfZW5kKCk/OworCisgICAgICAgIG8ud3JpdGVfZmllbGRfYmVnaW4oJnR5cGVfZmllbGQpPzsKKyAgICAgICAgby53cml0ZV9pMzIoZS5raW5kIGFzIGkzMik/OworICAgICAgICBvLndyaXRlX2ZpZWxkX2VuZCgpPzsKKworICAgICAgICBvLndyaXRlX2ZpZWxkX3N0b3AoKT87CisgICAgICAgIG8ud3JpdGVfc3RydWN0X2VuZCgpPzsKKworICAgICAgICBvLmZsdXNoKCkKKyAgICB9Cit9CisKK2ltcGwgZXJyb3I6OkVycm9yIGZvciBFcnJvciB7CisgICAgZm4gZGVzY3JpcHRpb24oJnNlbGYpIC0+ICZzdHIgeworICAgICAgICBtYXRjaCAqc2VsZiB7CisgICAgICAgICAgICBFcnJvcjo6VHJhbnNwb3J0KHJlZiBlKSA9PiBUcmFuc3BvcnRFcnJvcjo6ZGVzY3JpcHRpb24oZSksCisgICAgICAgICAgICBFcnJvcjo6UHJvdG9jb2wocmVmIGUpID0+IFByb3RvY29sRXJyb3I6OmRlc2NyaXB0aW9uKGUpLAorICAgICAgICAgICAgRXJyb3I6OkFwcGxpY2F0aW9uKHJlZiBlKSA9PiBBcHBsaWNhdGlvbkVycm9yOjpkZXNjcmlwdGlvbihlKSwKKyAgICAgICAgICAgIEVycm9yOjpVc2VyKHJlZiBlKSA9PiBlLmRlc2NyaXB0aW9uKCksCisgICAgICAgIH0KKyAgICB9Cit9CisKK2ltcGwgRGVidWcgZm9yIEVycm9yIHsKKyAgICBmbiBmbXQoJnNlbGYsIGY6ICZtdXQgRm9ybWF0dGVyKSAtPiBmbXQ6OlJlc3VsdCB7CisgICAgICAgIG1hdGNoICpzZWxmIHsKKyAgICAgICAgICAgIEVycm9yOjpUcmFuc3BvcnQocmVmIGUpID0+IERlYnVnOjpmbXQoZSwgZiksCisgICAgICAgICAgICBFcnJvcjo6UHJvdG9jb2wocmVmIGUpID0+IERlYnVnOjpmbXQoZSwgZiksCisgICAgICAgICAgICBFcnJvcjo6QXBwbGljYXRpb24ocmVmIGUpID0+IERlYnVnOjpmbXQoZSwgZiksCisgICAgICAgICAgICBFcnJvcjo6VXNlcihyZWYgZSkgPT4gRGVidWc6OmZtdChlLCBmKSwKKyAgICAgICAgfQorICAgIH0KK30KKworaW1wbCBEaXNwbGF5IGZvciBFcnJvciB7CisgICAgZm4gZm10KCZzZWxmLCBmOiAmbXV0IEZvcm1hdHRlcikgLT4gZm10OjpSZXN1bHQgeworICAgICAgICBtYXRjaCAqc2VsZiB7CisgICAgICAgICAgICBFcnJvcjo6VHJhbnNwb3J0KHJlZiBlKSA9PiBEaXNwbGF5OjpmbXQoZSwgZiksCisgICAgICAgICAgICBFcnJvcjo6UHJvdG9jb2wocmVmIGUpID0+IERpc3BsYXk6OmZtdChlLCBmKSwKKyAgICAgICAgICAgIEVycm9yOjpBcHBsaWNhdGlvbihyZWYgZSkgPT4gRGlzcGxheTo6Zm10KGUsIGYpLAorICAgICAgICAgICAgRXJyb3I6OlVzZXIocmVmIGUpID0+IERpc3BsYXk6OmZtdChlLCBmKSwKKyAgICAgICAgfQorICAgIH0KK30KKworaW1wbCBGcm9tPFN0cmluZz4gZm9yIEVycm9yIHsKKyAgICBmbiBmcm9tKHM6IFN0cmluZykgLT4gU2VsZiB7CisgICAgICAgIEVycm9yOjpBcHBsaWNhdGlvbihBcHBsaWNhdGlvbkVycm9yIHsKKyAgICAgICAgICAgIGtpbmQ6IEFwcGxpY2F0aW9uRXJyb3JLaW5kOjpVbmtub3duLAorICAgICAgICAgICAgbWVzc2FnZTogcywKKyAgICAgICAgfSkKKyAgICB9Cit9CisKK2ltcGw8J2E+IEZyb208JidhIHN0cj4gZm9yIEVycm9yIHsKKyAgICBmbiBmcm9tKHM6ICYnYSBzdHIpIC0+IFNlbGYgeworICAgICAgICBFcnJvcjo6QXBwbGljYXRpb24oQXBwbGljYXRpb25FcnJvciB7CisgICAgICAgICAgICBraW5kOiBBcHBsaWNhdGlvbkVycm9yS2luZDo6VW5rbm93biwKKyAgICAgICAgICAgIG1lc3NhZ2U6IFN0cmluZzo6ZnJvbShzKSwKKyAgICAgICAgfSkKKyAgICB9Cit9CisKK2ltcGwgRnJvbTxUcmFuc3BvcnRFcnJvcj4gZm9yIEVycm9yIHsKKyAgICBmbiBmcm9tKGU6IFRyYW5zcG9ydEVycm9yKSAtPiBTZWxmIHsKKyAgICAgICAgRXJyb3I6OlRyYW5zcG9ydChlKQorICAgIH0KK30KKworaW1wbCBGcm9tPFByb3RvY29sRXJyb3I+IGZvciBFcnJvciB7CisgICAgZm4gZnJvbShlOiBQcm90b2NvbEVycm9yKSAtPiBTZWxmIHsKKyAgICAgICAgRXJyb3I6OlByb3RvY29sKGUpCisgICAgfQorfQorCitpbXBsIEZyb208QXBwbGljYXRpb25FcnJvcj4gZm9yIEVycm9yIHsKKyAgICBmbiBmcm9tKGU6IEFwcGxpY2F0aW9uRXJyb3IpIC0+IFNlbGYgeworICAgICAgICBFcnJvcjo6QXBwbGljYXRpb24oZSkKKyAgICB9Cit9CisKKy8vLyBDcmVhdGUgYSBuZXcgYEVycm9yYCBpbnN0YW5jZSB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bmQ6OlVua25vd24pLAorICAgICAgICAgICAgMSA9PiBPayhUcmFuc3BvcnRFcnJvcktpbmQ6Ok5vdE9wZW4pLAorICAgICAgICAgICAgMiA9PiBPayhUcmFuc3BvcnRFcnJvcktpbmQ6OkFscmVhZHlPcGVuKSwKKyAgICAgICAgICAgIDMgPT4gT2soVHJhbnNwb3J0RXJyb3JLaW5kOjpUaW1lZE91dCksCisgICAgICAgICAgICA0ID0+IE9rKFRyYW5zcG9ydEVycm9yS2luZDo6RW5kT2ZGaWxlKSwKKyAgICAgICAgICAgIDUgPT4gT2soVHJhbnNwb3J0RXJyb3JLaW5kOjpOZWdhdGl2ZVNpemUpLAorICAgICAgICAgICAgNiA9PiBPayhUcmFuc3BvcnRFcnJvcktpbmQ6OlNpemVMaW1pdCksCisgICAgICAgICAgICBfID0+IEVycihFcnJvcjo6UHJvdG9jb2woUHJvdG9jb2xFcnJvciB7CisgICAgICAgICAgICAgICAga2luZDogUHJvdG9jb2xFcnJvcktpbmQ6OlVua25vd24sCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgiY2Fubm90IGNvbnZlcnQge30gdG8gVHJhbnNwb3J0RXJyb3JLaW5kIiwgZnJvbSksCisgICAgICAgICAgICB9KSksCisgICAgICAgIH0KKyAgICB9Cit9CisKK2ltcGwgRnJvbTxpbzo6RXJyb3I+IGZvciBFcnJvciB7CisgICAgZm4gZnJvbShlcnI6IGlvOjpFcnJvcikgLT4gU2VsZiB7CisgICAgICAgIG1hdGNoIGVyci5raW5kKCkgeworICAgICAgICAgICAgaW86OkVycm9yS2luZDo6Q29ubmVjdGlvblJlc2V0CisgICAgICAgICAgICB8IGlvOjpFcnJvcktpbmQ6OkNvbm5lY3Rpb25SZWZ1c2VkCisgICAgICAgICAgICB8IGlvOjpFcnJvcktpbmQ6Ok5vdENvbm5lY3RlZCA9PiBFcnJvcjo6VHJhbnNwb3J0KFRyYW5zcG9ydEVycm9yIHsKKyAgICAgICAgICAgICAgICBraW5kOiBUcmFuc3BvcnRFcnJvcktpbmQ6Ok5vdE9wZW4sCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZXJyLmRlc2NyaXB0aW9uKCkudG9fb3duZWQoKSwKKyAgICAgICAgICAgIH0pLAorICAgICAgICAgICAgaW86OkVycm9yS2luZDo6QWxyZWFkeUV4aXN0cyA9PiBFcnJvcjo6VHJhbnNwb3J0KFRyYW5zcG9ydEVycm9yIHsKKyAgICAgICAgICAgICAgICBraW5kOiBUcmFuc3BvcnRFcnJvcktpbmQ6OkFscmVhZHlPcGVuLAorICAgICAgICAgICAgICAgIG1lc3NhZ2U6IGVyci5kZXNjcmlwdGlvbigpLnRvX293bmVkKCksCisgICAgICAgICAgICB9KSwKKyAgICAgICAgICAgIGlvOjpFcnJvcktpbmQ6OlRpbWVkT3V0ID0+IEVycm9yOjpUcmFuc3BvcnQoVHJhbnNwb3J0RXJyb3IgeworICAgICAgICAgICAgICAgIGtpbmQ6IFRyYW5zcG9ydEVycm9yS2luZDo6VGltZWRPdXQsCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZXJyLmRlc2NyaXB0aW9uKCkudG9fb3duZWQoKSwKKyAgICAgICAgICAgIH0pLAorICAgICAgICAgICAgaW86OkVycm9yS2luZDo6VW5leHBlY3RlZEVvZiA9PiBFcnJvcjo6VHJhbnNwb3J0KFRyYW5zcG9ydEVycm9yIHsKKyAgICAgICAgICAgICAgICBraW5kOiBUcmFuc3BvcnRFcnJvcktpbmQ6OkVuZE9mRmlsZSwKKyAgICAgICAgICAgICAgICBtZXNzYWdlOiBlcnIuZGVzY3JpcHRpb24oKS50b19vd25lZCgpLAorICAgICAgICAgICAgfSksCisgICAgICAgICAgICBfID0+IHsKKyAgICAgICAgICAgICAgICBFcnJvcjo6VHJhbnNwb3J0KFRyYW5zcG9ydEVycm9yIHsKKyAgICAgICAgICAgICAgICAgICAga2luZDogVHJhbnNwb3J0RXJyb3JLaW5kOjpVbmtub3duLAorICAgICAgICAgICAgICAgICA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EVycm9yS2luZDo6QmFkVmVyc2lvbiA9PiAiaW52YWxpZCB0aHJpZnQgdmVyc2lvbiIsCisgICAgICAgICAgICBQcm90b2NvbEVycm9yS2luZDo6Tm90SW1wbGVtZW50ZWQgPT4gIm5vdCBpbXBsZW1lbnRlZCIsCisgICAgICAgICAgICBQcm90b2NvbEVycm9yS2luZDo6RGVwdGhMaW1pdCA9PiAibWF4aW11bSBza2lwIGRlcHRoIHJlYWNoZWQiLAorICAgICAgICB9CisgICAgfQorfQorCitpbXBsIERpc3BsYXkgZm9yIFByb3RvY29sRXJyb3IgeworICAgIGZuIGZtdCgmc2VsZiwgZjogJm11dCBGb3JtYXR0ZXIpIC0+IGZtdDo6UmVzdWx0IHsKKyAgICAgICAgd3JpdGUhKGYsICJ7fSIsIHNlbGYuZGVzY3JpcHRpb24oKSkKKyAgICB9Cit9CisKK2ltcGwgVHJ5RnJvbTxpMzI+IGZvciBQcm90b2NvbEVycm9yS2luZCB7CisgICAgdHlwZSBFcnIgPSBFcnJvcjsKKyAgICBmbiB0cnlfZnJvbShmcm9tOiBpMzIpIC0+IFJlc3VsdDxTZWxmLCBTZWxmOjpFcnI+IHsKKyAgICAgICAgbWF0Y2ggZnJvbSB7CisgICAgICAgICAgICAwID0+IE9rKFByb3RvY29sRXJyb3JLaW5kOjpVbmtub3duKSwKKyAgICAgICAgICAgIDEgPT4gT2soUHJvdG9jb2xFcnJvcktpbmQ6OkludmFsaWREYXRhKSwKKyAgICAgICAgICAgIDIgPT4gT2soUHJvdG9jb2xFcnJvcktpbmQ6Ok5lZ2F0aXZlU2l6ZSksCisgICAgICAgICAgICAzID0+IE9rKFByb3RvY29sRXJyb3JLaW5kOjpTaXplTGltaXQpLAorICAgICAgICAgICAgNCA9PiBPayhQcm90b2NvbEVycm9yS2luZDo6QmFkVmVyc2lvbiksCisgICAgICAgICAgICA1ID0+IE9rKFByb3RvY29sRXJyb3JLaW5kOjpOb3RJbXBsZW1lbnRlZCksCisgICAgICAgICAgICA2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gICAgICAgICAgICBzZWxmLndyaXRlX3N0cmluZygmaWRlbnRpZmllci5uYW1lKT87CisgICAgICAgICAgICBzZWxmLndyaXRlX2J5dGUoaWRlbnRpZmllci5tZXNzYWdlX3R5cGUuaW50bygpKT87CisgICAgICAgICAgICBzZWxmLndyaXRlX2kzMihpZGVudGlmaWVyLnNlcXVlbmNlX251bWJlcikKKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIHdyaXRlX21lc3NhZ2VfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgZm4gd3JpdGVfc3RydWN0X2JlZ2luKCZtdXQgc2VsZiwgXzogJlRTdHJ1Y3RJZGVudGlmaWVyKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBPaygoKSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9zdHJ1Y3RfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgZm4gd3JpdGVfZmllbGRfYmVnaW4oJm11dCBzZWxmLCBpZGVudGlmaWVyOiAmVEZpZWxkSWRlbnRpZmllcikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgaWYgaWRlbnRpZmllci5pZC5pc19ub25lKCkgJiYgaWRlbnRpZmllci5maWVsZF90eXBlICE9IFRUeXBlOjpTdG9wIHsKKyAgICAgICAgICAgIHJldHVybiBFcnIoOjpFcnJvcjo6UHJvdG9jb2woUHJvdG9jb2xFcnJvciB7CisgICAgICAgICAgICAgICAga2luZDogUHJvdG9jb2xFcnJvcktpbmQ6OlVua25vd24sCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgKKyAgICAgICAgICAgICAgICAgICAgImNhbm5vdCB3cml0ZSBpZGVudGlmaWVyIHs6P30gd2l0aG91dCBzZXF1ZW5jZSBudW1iZXIiLAorICAgICAgICAgICAgICAgICAgICAmaWRlbnRpZmllcgorICAgICAgICAgICAgICAgICksCisgICAgICAgICAgICB9KSk7CisgICAgICAgIH0KKworICAgICAgICBzZWxmLndyaXRlX2J5dGUoZmllbGRfdHlwZV90b191OChpZGVudGlmaWVyLmZpZWxkX3R5cGUpKT87CisgICAgICAgIGlmIGxldCBTb21lKGlkKSA9IGlkZW50aWZpZXIuaWQgeworICAgICAgICAgICAgc2VsZi53cml0ZV9pMTYoaWQpCisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBPaygoKSkKKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIHdyaXRlX2ZpZWxkX2VuZCgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIE9rKCgpKQorICAgIH0KKworICAgIGZuIHdyaXRlX2ZpZWxkX3N0b3AoJm11dCBzZWxmKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBzZWxmLndyaXRlX2J5dGUoZmllbGRfdHlwZV90b191OChUVHlwZTo6U3RvcCkpCisgICAgfQorCisgICAgZm4gd3JpdGVfYnl0ZXMoJm11dCBzZWxmLCBiOiAmW3U4XSkgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgc2VsZi53cml0ZV9pMzIoYi5sZW4oKSBhcyBpMzIpPzsKKyAgICAgICAgc2VsZi50cmFuc3BvcnQud3JpdGVfYWxsKGIpLm1hcF9lcnIoRnJvbTo6ZnJvbSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9ib29sKCZtdXQgc2VsZiwgYjogYm9vbCkgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgaWYgYiB7CisgICAgICAgICAgICBzZWxmLndyaXRlX2k4KDEpCisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzZWxmLndyaXRlX2k4KDApCisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbiB3cml0ZV9pOCgmbXV0IHNlbGYsIGk6IGk4KSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBz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fdG9fdTgoaWRlbnRpZmllci5lbGVtZW50X3R5cGUpKT87CisgICAgICAgIHNlbGYud3JpdGVfaTMyKGlkZW50aWZpZXIuc2l6ZSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9saXN0X2VuZCgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIE9rKCgpKQorICAgIH0KKworICAgIGZuIHdyaXRlX3NldF9iZWdpbigmbXV0IHNlbGYsIGlkZW50aWZpZXI6ICZUU2V0SWRlbnRpZmllcikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgc2VsZi53cml0ZV9ieXRlKGZpZWxkX3R5cGVfdG9fdTgoaWRlbnRpZmllci5lbGVtZW50X3R5cGUpKT87CisgICAgICAgIHNlbGYud3JpdGVfaTMyKGlkZW50aWZpZXIuc2l6ZSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9zZXRfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgZm4gd3JpdGVfbWFwX2JlZ2luKCZtdXQgc2VsZiwgaWRlbnRpZmllcjogJlRNYXBJZGVudGlmaWVyKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBsZXQga2V5X3R5cGUgPSBpZGVudGlmaWVyCisgICAgICAgICAgICAua2V5X3R5cGUKKyAgICAgICAgICAgIC5leHBlY3QoIm1hcCBpZGVudGlmaWVyIHRvIHdyaXRlIHNob3VsZCBjb250YWluIGtleSB0eXBlIik7CisgICAgICAgIHNlbGYud3JpdGVfYnl0ZShmaWVsZF90eXBlX3RvX3U4KGtleV90eXBlKSk/OworICAgICAgICBsZXQgdmFsX3R5cGUgPSBpZGVudGlmaWVyCisgICAgICAgICAgICAudmFsdWVfdHlwZQorICAgICAgICAgICAgLmV4cGVjdCgibWFwIGlkZW50aWZpZXIgdG8gd3JpdGUgc2hvdWxkIGNvbnRhaW4gdmFsdWUgdHlwZSIpOworIC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gICAgICAgMHgwMSA9PiBPayhUVHlwZTo6Vm9pZCksCisgICAgICAgIDB4MDIgPT4gT2soVFR5cGU6OkJvb2wpLAorICAgICAgICAweDAzID0+IE9rKFRUeXBlOjpJMDgpLCAvLyBFcXVpdmFsZW50IHRvIFRUeXBlOjpCeXRlCisgICAgICAgIDB4MDQgPT4gT2soVFR5cGU6OkRvdWJsZSksCisgICAgICAgIDB4MDYgPT4gT2soVFR5cGU6OkkxNiksCisgICAgICAgIDB4MDggPT4gT2soVFR5cGU6OkkzMiksCisgICAgICAgIDB4MEEgPT4gT2soVFR5cGU6Okk2NCksCisgICAgICAgIDB4MEIgPT4gT2soVFR5cGU6OlN0cmluZyksIC8vIHRlY2huaWNhbGx5LCBhbHNvIGEgVVRGNywgYnV0IHdlJ2xsIHRyZWF0IGl0IGFzIHN0cmluZworICAgICAgICAweDBDID0+IE9rKFRUeXBlOjpTdHJ1Y3QpLAorICAgICAgICAweDBEID0+IE9rKFRUeXBlOjpNYXApLAorICAgICAgICAweDBFID0+IE9rKFRUeXBlOjpTZXQpLAorICAgICAgICAweDBGID0+IE9rKFRUeXBlOjpMaXN0KSwKKyAgICAgICAgMHgxMCA9PiBPayhUVHlwZTo6VXRmOCksCisgICAgICAgIDB4MTEgPT4gT2soVFR5cGU6OlV0ZjE2KSwKKyAgICAgICAgdW5rbiA9PiBFcnIoOjpFcnJvcjo6UHJvdG9jb2woUHJvdG9jb2xFcnJvciB7CisgICAgICAgICAgICBraW5kOiBQcm90b2NvbEVycm9yS2luZDo6SW52YWxpZERhdGEsCisgICAgICAgICAgICBtZXNzYWdlOiBmb3JtYXQhKCJjYW5ub3QgY29udmVydCB7fSB0byBUVHlwZSIsIHVua24pLAorICAgICAgICB9KSksCisgICAgfQorfQorCisjW2NmZyh0ZXN0KV0KK21vZCB0ZXN0cyB7CisKKyAgICB1c2UgcHJvdG9jb2w6OnsKKyAgICAgICAgVEZpZWxkSWRlbnRpZmllciwgVElucHV0UHJvdG9jb2wsIFRMaXN0SWRlbnRpZmllciwgVE1hcElkZW50aWZpZXIsIFRNZXNzYWdlSWRlbnRpZmllciwKKyAgICAgICAgVE1lc3NhZ2VUeXBlLCBUT3V0cHV0UHJvdG9jb2wsIFRTZXRJZGVudGlmaWVyLCBUU3RydWN0SWRlbnRpZmllciwgVFR5cGUsCisgICAgfTsKKyAgICB1c2UgdHJhbnNwb3J0Ojp7UmVhZEhhbGYsIFRCdWZmZXJDaGFubmVsLCBUSW9DaGFubmVsLCBXcml0ZUhhbGZ9OworCisgICAgdXNlIHN1cGVyOjoqOworCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfc3RyaWN0X21lc3NhZ2VfY2FsbF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBsZXQgaWRlbnQgPSBUTWVzc2FnZUlkZW50aWZpZXI6Om5ldygidGVzdCIsIFRNZXNzYWdlVHlwZTo6Q2FsbCwgMSk7CisgICAgICAgIGFzc2VydCEob19wcm90LndyaXRlX21lc3NhZ2VfYmVnaW4oJmlkZW50KS5pc19vaygpKTsKKworICAgICAgICAjW2NmZ19hdHRyKHJ1c3RmbXQsIHJ1c3RmbXQ6OnNraXApXQorICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgMTZdID0gWworICAgICAgICAgICAgMHg4MCwKKyAgICAgICAgICAgIDB4MDEsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMSwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDQsCisgICAgICAgICAgICAweDc0LAorICAgICAgICAgICAgMHg2NSwKKyAgICAgICAgICAgIDB4NzMsCisgICAgICAgICAgICAweDc0LAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMSwKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfbm9uX3N0cmljdF9tZXNzYWdlX2NhbGxfYmVnaW4oKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoZmFsc2UpOworCisgICAgICAgIGxldCBpZGVudCA9IFRNZXNzYWdlSWRlbnRpZmllcjo6bmV3KCJ0ZXN0IiwgVE1lc3NhZ2VUeXBlOjpDYWxsLCAxKTsKKyAgICAgICAgYXNzZXJ0IShvX3Byb3Qud3JpdGVfbWVzc2FnZV9iZWdpbigmaWRlbnQpLmlzX29rKCkpOworCisgICAgICAgICNbY2ZnX2F0dHIocnVzdGZtdCwgcnVzdGZtdDo6c2tpcCldCisgICAgICAgIGxldCBleHBlY3RlZDogW3U4OyAxM10gPSBbCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDA0LAorICAgICAgICAgICAgMHg3NCwKKyAgICAgICAgICAgIDB4NjUsCisgICAgICAgICAgICAweDczLAorICAgICAgICAgICAgMHg3NCwKKyAgICAgICAgICAgIDB4MDEsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAxLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9zdHJpY3RfbWVzc2FnZV9yZXBseV9iZWdpbigpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBsZXQgaWRlbnQgPSBUTWVzc2FnZUlkZW50aWZpZXI6Om5ldygidGVzdCIsIFRNZXNzYWdlVHlwZTo6UmVwbHksIDEwKTsKKyAgICAgICAgYXNzZXJ0IShvX3Byb3Qud3JpdGVfbWVzc2FnZV9iZWdpbigmaWRlbnQpLmlzX29rKCkpOworCisgICAgICAgICNbY2ZnX2F0dHIocnVzdGZtdCwgcnVzdGZtdDo6c2tpcCldCisgICAgICAgIGxldCBleHBlY3RlZDogW3U4OyAxNl0gPSBbCisgICAgICAgICAgICAweDgwLAorICAgICAgICAgICAgMHgwMSwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAyLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwNCwKKyAgICAgICAgICAgIDB4NzQsCisgICAgICAgICAgICAweDY1LAorICAgICAgICAgICAgMHg3MywKKyAgICAgICAgICAgIDB4NzQsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDBBLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9ub25fc3RyaWN0X21lc3NhZ2VfcmVwbHlfYmVnaW4oKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoZmFsc2UpOworCisgICAgICAgIGxldCBpZGVudCA9IFRNZXNzYWdlSWRlbnRpZmllcjo6bmV3KCJ0ZXN0IiwgVE1lc3NhZ2VUeXBlOjpSZXBseSwgMTApOworICAgICAgICBhc3NlcnQhKG9fcHJvdC53cml0ZV9tZXNzYWdlX2JlZ2luKCZpZGVudCkuaXNfb2soKSk7CisKKyAgICAgICAgI1tjZmdfYXR0cihydXN0Zm10LCBydXN0Zm10Ojpza2lwKV0KKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDEzXSA9IFsKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDQsCisgICAgICAgICAgICAweDc0LAorICAgICAgICAgICAgMHg2NSwKKyAgICAgICAgICAgIDB4NzMsCisgICAgICAgICAgICAweDc0LAorICAgICAgICAgICAgMHgwMiwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MEEsCisgICAgICAgIF07CisKKyAgICAgICAgYXNzZXJ0X2VxX3dyaXR0ZW5fYnl0ZXMhKG9fcHJvdCwgZXhwZWN0ZWQpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3JvdW5kX3RyaXBfc3RyaWN0X21lc3NhZ2VfYmVnaW4oKSB7CisgICAgICAgIGxldCAobXV0IGlfcHJvdCwgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHModHJ1ZSk7CisKKyAgICAgICAgbGV0IHNlbnRfaWRlbnQgPSBUTWVzc2FnZUlkZW50aWZpZXI6Om5ldygidGVzdCIsIFRNZXNzYWdlVHlwZTo6Q2FsbCwgMSk7CisgICAgICAgIGFzc2VydCEob19wcm90LndyaXRlX21lc3NhZ2VfYmVnaW4oJnNlbnRfaWRlbnQpLmlzX29rKCkpOworCisgICAgICAgIGNvcHlfd3JpdGVfYnVmZmVyX3RvX3JlYWRfYnVmZmVyIShvX3Byb3QpOworCisgICAgICAgIGxldCByZWNlaXZlZF9pZGVudCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9tZXNzYWdlX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKCZyZWNlaXZlZF9pZGVudCwgJnNlbnRfaWRlbnQpOworICAgIH0KKwor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nRfbm9fd3JpdGUofG98IG8ud3JpdGVfc3RydWN0X2VuZCgpLCB0cnVlKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9maWVsZF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBhc3NlcnQhKG9fcHJvdAorICAgICAgICAgICAgLndyaXRlX2ZpZWxkX2JlZ2luKCZURmllbGRJZGVudGlmaWVyOjpuZXcoInNvbWVfZmllbGQiLCBUVHlwZTo6U3RyaW5nLCAyMikpCisgICAgICAgICAgICAuaXNfb2soKSk7CisKKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDNdID0gWzB4MEIsIDB4MDAsIDB4MTZdOworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfcm91bmRfdHJpcF9maWVsZF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBsZXQgc2VudF9maWVsZF9pZGVudCA9IFRGaWVsZElkZW50aWZpZXI6Om5ldygiZm9vIiwgVFR5cGU6Okk2NCwgMjApOworICAgICAgICBhc3NlcnQhKG9fcHJvdC53cml0ZV9maWVsZF9iZWdpbigmc2VudF9maWVsZF9pZGVudCkuaXNfb2soKSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgbGV0IGV4cGVjdGVkX2lkZW50ID0gVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgZmllbGRfdHlwZTogVFR5cGU6Okk2NCwKKyAgICAgICAgICAgIGlkOi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3JlYWRfYnVmZmVyIShvX3Byb3QpOworCisgICAgICAgIGxldCByZWNlaXZlZF9pZGVudCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9saXN0X2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKCZyZWNlaXZlZF9pZGVudCwgJmlkZW50KTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9saXN0X2VuZCgpIHsKKyAgICAgICAgYXNzZXJ0X25vX3dyaXRlKHxvfCBvLndyaXRlX2xpc3RfZW5kKCksIHRydWUpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX3NldF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBhc3NlcnQhKG9fcHJvdAorICAgICAgICAgICAgLndyaXRlX3NldF9iZWdpbigmVFNldElkZW50aWZpZXI6Om5ldyhUVHlwZTo6STE2LCA3KSkKKyAgICAgICAgICAgIC5pc19vaygpKTsKKworICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgNV0gPSBbMHgwNiwgMHgwMCwgMHgwMCwgMHgwMCwgMHgwN107CisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX3NldF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBsZXQgaWRlbnQgPSBUU2V0SWRlbnRpZmllcjo6bmV3KFRUeXBlOjpJNjQsIDIwMDApOworICAgICAgICBhc3NlcnQhKG9fcHJvdC53cml0ZV9zZXRfYmVnaW4oJmlkZW50KS5pc19vaygpKTsKKworICAgICAgICBjb3B5X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mllcjo6bmV3KFRUeXBlOjpNYXAsIFRUeXBlOjpTZXQsIDEwMCk7CisgICAgICAgIGFzc2VydCEob19wcm90LndyaXRlX21hcF9iZWdpbigmaWRlbnQpLmlzX29rKCkpOworCisgICAgICAgIGNvcHlfd3JpdGVfYnVmZmVyX3RvX3JlYWRfYnVmZmVyIShvX3Byb3QpOworCisgICAgICAgIGxldCByZWNlaXZlZF9pZGVudCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9tYXBfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoJnJlY2VpdmVkX2lkZW50LCAmaWRlbnQpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX21hcF9lbmQoKSB7CisgICAgICAgIGFzc2VydF9ub193cml0ZSh8b3wgby53cml0ZV9tYXBfZW5kKCksIHRydWUpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX2Jvb2xfdHJ1ZSgpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBhc3NlcnQhKG9fcHJvdC53cml0ZV9ib29sKHRydWUpLmlzX29rKCkpOworCisgICAgICAgIGxldCBleHBlY3RlZDogW3U4OyAxXSA9IFsweDAxXTsKKyAgICAgICAgYXNzZXJ0X2VxX3dyaXR0ZW5fYnl0ZXMhKG9fcHJvdCwgZXhwZWN0ZWQpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX2Jvb2xfZmFsc2UoKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHModHJ1ZSk7CisKKyAgICAgICAgYXNzZXJ0IShvX3Byb3Qud3JpdGVfYm9vbChmYWxzZSkuaXNfb2soKSk7CisKKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDFdID0gWzB4MDBdOworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3RfcmVhZF9ib29sX3RydWUoKSB7CisgICAgICAgIGxldCAobXV0IGlfcHJvdCwgXykgPSB0ZXN0X29iamVjdHModHJ1ZSk7CisKKyAgICAgICAgc2V0X3JlYWRhYmxlX2J5dGVzIShpX3Byb3QsICZbMHgwMV0pOworCisgICAgICAgIGxldCByZWFkX2Jvb2wgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfYm9vbCgpKTsKKyAgICAgICAgYXNzZXJ0X2VxIShyZWFkX2Jvb2wsIHRydWUpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3JlYWRfYm9vbF9mYWxzZSgpIHsKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBfKSA9IHRlc3Rfb2JqZWN0cyh0cnVlKTsKKworICAgICAgICBzZXRfcmVhZGFibGVfYnl0ZXMhKGlfcHJvdCwgJlsweDAwXSk7CisKKyAgICAgICAgbGV0IHJlYWRfYm9vbCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9ib29sKCkpOworICAgICAgICBhc3NlcnRfZXEhKHJlYWRfYm9vbCwgZmFsc2UpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X2FsbG93X2FueV9ub25femVyb192YWx1ZV90b19iZV9pbnRlcnByZXRlZF9hc19ib29sX3RydWUoKSB7CisgICAgICAgIGxldCAobXV0IGlfcHJvdCwgXykgPSB0ZXN0X29iamVjdHModHJ1ZSk7CisKKyAgICAgICAgc2V0X3JlYWRhYmxlX2J5dGVzIShpX3Byb3QsICZbMHhBQ10pOworCisgICAgICAgIGxldCByZWFkX2Jvb2wgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfYm9vbCgpKTsKKyAgICAgICAgYXNzZXJ0X2VxIShyZWFkX2Jvb2wsIHRydWUpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX2J5dGVzKCkgeworICAgICAgICBsZXQgKF8sIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKHRydWUpOworCisgICAgICAgIGxldCBieXRlczogW3U4OyAxMF0gPSBbMHgwQSwgMHhDQywgMHhEMSwgMHg4NCwgMHg5OSwgMHgxMiwgMHhBQiwgMHhCQiwgMHg0NSwgMHhERl07CisKKyAgICAgICAgYXNzZXJ0IShvX3Byb3Qud3JpdGVfYnl0ZXMoJmJ5dGVzKS5pc19vaygpKTsKKworICAgICAgICBsZXQgYnVmID0gb19wcm90LnRyYW5zcG9ydC53cml0ZV9ieXRlcygpOworICAgICAgICBhc3NlcnRfZXEhKCZidWZbMC4uNF0sIFsweDAwLCAweDAwLCAweDAwLCAweDBBXSk7IC8vIGxlbmd0aAorICAgICAgICBhc3NlcnRfZXEhKCZidWZbNC4uXSwgYnl0ZXMpOyAvLyBhY3R1YWwgYnl0ZXMKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX2J5dGVzKCkgeworICAgICAgICBsZXQgKG11dCBpX3Byb3QsIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKHRydWUpOworCisgICAgICAgICNbY2ZnX2F0dHIocnVzdGZtdCwgcnVzdGZtdDo6c2tpcCldCisgICAgICAgIGxldCBieXRlczogW3U4OyAyNV0gPSBbCisgICAgICAgICAgICAweDIwLAorICAgICAgICAgICAgMHhGRCwKKyAgICAgICAgICAgIDB4MTgsCisgICAgICAgICAgICAweDg0LAorICAgICAgICAgICAgMHg5OSwKKyAgICAgICAgICAgIDB4MTIsCisgICAgICAgICAgICAweEFCLAorICAgICAgICAgICAgMHhCQiwKKyAgICAgICAgICAgIDB4NDUsCisgICAgICAgICAgICAweERGLAorICAgICAgICAgICAgMHgzNCwKKyAgICAgICAgICAgIDB4REMsCisgICAgICAgICAgICAweDk4LAorICAgICAgICAgICAgMHhBNCwKKyAgICAgICAgICAgIDB4NkQsCisgICAgICAgICAgICAweEYzLAorICAgICAgICAgICAgMHg5OSwKKyAgICAgICAgICAgIDB4QjQsCisgICAgICAgICAgICAweEI3LAorICAgICAgICAgICAgMHhENCwKKyAgICAgICAgICAgIDB4OUMsCisgICAgICAgICAgICAweEE1LAorICAgICAgICAgICAgMHhCMywKKyAgICAgICAgICAgIDB4QzksCisgICAgICAgICAgICAweDg4LAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydCEob19wcm90LndyaXRlX2J5dGVzKCZieXRlcykuaXNfb2soKSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgbGV0IHJlY2VpdmVkX2J5dGVzID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2J5dGVzKCkpOworICAgICAgICBhc3NlcnRfZXEhKCZyZWNlaXZlZF9ieXRlcywgJmJ5dGVzKTsKKyAgICB9CisKKyAgICBmbiB0ZXN0X29iamVjdHMoCisgICAgICAgIHN0cmljdDogYm9vbCwKKyAgICApIC0+ICgKKyAgICAgICAgVEJpbmFyeUlucHV0UHJvdG9jb2w8UmVhZEhhbGY8VEJ1ZmZlckNoYW5uZWw+PiwKKyAgICAgICAgVEJpbmFyeU91dHB1dFByb3RvY29sPFdyaXRlSGFsZjxUQnVmZmVyQ2hhbm5lbD4+LAorICAgICkgeworICAgICAgICBsZXQgbWVtID0gVEJ1ZmZlckNoYW5uZWw6OndpdGhfY2FwYWNpdHkoNDAsIDQwKTsKKworICAgICAgICBsZXQgKHJfbWVtLCB3X21lbSkgPSBtZW0uc3BsaXQoKS51bndyYXAoKTsKKworICAgICAgICBsZXQgaV9wcm90ID0gVEJpbmFyeUlucHV0UHJvdG9jb2w6Om5ldyhyX21lbSwgc3RyaWN0KTsKKyAgICAgICAgbGV0IG9fcHJvdCA9IFRCaW5hcnlP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CisgICAgICAgICAgICBlbGVtZW50X2NvdW50ID0gc2VsZi50cmFuc3BvcnQucmVhZF92YXJpbnQ6Ojx1MzI+KCk/IGFzIGkzMjsKKyAgICAgICAgfQorCisgICAgICAgIE9rKChlbGVtZW50X3R5cGUsIGVsZW1lbnRfY291bnQpKQorICAgIH0KK30KKworaW1wbDxUPiBUSW5wdXRQcm90b2NvbCBmb3IgVENvbXBhY3RJbnB1dFByb3RvY29sPFQ+Cit3aGVyZQorICAgIFQ6IFRSZWFkVHJhbnNwb3J0LAoreworICAgIGZuIHJlYWRfbWVzc2FnZV9iZWdpbigmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PFRNZXNzYWdlSWRlbnRpZmllcj4geworICAgICAgICBsZXQgY29tcGFjdF9pZCA9IHNlbGYucmVhZF9ieXRlKCk/OworICAgICAgICBpZiBjb21wYWN0X2lkICE9IENPTVBBQ1RfUFJPVE9DT0xfSUQgeworICAgICAgICAgICAgRXJyKDo6RXJyb3I6OlByb3RvY29sKDo6UHJvdG9jb2xFcnJvciB7CisgICAgICAgICAgICAgICAga2luZDogOjpQcm90b2NvbEVycm9yS2luZDo6QmFkVmVyc2lvbiwKKyAgICAgICAgICAgICAgICBtZXNzYWdlOiBmb3JtYXQhKCJpbnZhbGlkIGNvbXBhY3QgcHJvdG9jb2wgaGVhZGVyIHs6P30iLCBjb21wYWN0X2lkKSwKKyAgICAgICAgICAgIH0pKQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgT2soKCkpCisgICAgICAgIH0/OworCisgICAgICAgIGxldCB0eXBlX2FuZF9ieXRlID0gc2VsZi5yZWFkX2J5dGUoKT87CisgICAgICAgIGxldCByZWNlaXZlZF92ZXJzaW9uID0gdHlwZV9hbmRfYnl0ZSAmIENPTVBBQ1RfVkVSU0lPTl9NQVNLOworICAgICAgICBpZiByZWNlaXZlZF92ZXJzaW9uICE9IENPTVBBQ1RfVkVSU0lPTiB7CisgICAgICAgICAgICBFcnIoOjpFcnJvcjo6UHJvdG9jb2woOjpQcm90b2NvbEVycm9yIHsKKyAgICAgICAgICAgICAgICBraW5kOiA6OlByb3RvY29sRXJyb3JLaW5kOjpCYWRWZXJzaW9uLAorICAgICAgICAgICAgICAgIG1lc3NhZ2U6IGZvcm1hdCEoCisgICAgICAgICAgICAgICAgICAgICJjYW5ub3QgcHJvY2VzcyBjb21wYWN0IHByb3RvY29sIHZlcnNpb24gezo/fSIsCisgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkX3ZlcnNpb24KKyAgICAgICAgICAgICAgICApLAorICAgICAgICAgICAgfSkpCisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBPaygoKSkKKyAgICAgICAgfT87CisKKyAgICAgICAgLy8gTk9URTogdW5zaWduZWQgcmlnaHQgc2hpZnQgd2lsbCBwYWQgd2l0aCAwcworICAgICAgICBsZXQgbWVzc2FnZV90eXBlOiBUTWVzc2FnZVR5cGUgPSBUTWVzc2FnZVR5cGU6OnRyeV9mcm9tKHR5cGVfYW5kX2J5dGUgPj4gNSk/OworICAgICAgICBsZXQgc2VxdWVuY2VfbnVtYmVyID0gc2VsZi5yZWFkX2kzMigpPzsKKyAgICAgICAgbGV0IHNlcnZpY2VfY2FsbF9uYW1lID0gc2VsZi5yZWFkX3N0cmluZygpPzsKKworICAgICAgICBzZWxmLmxhc3RfcmVhZF9maWVsZF9pZCA9IDA7CisKKyAgICAgICAgT2soVE1lc3NhZ2VJZGVudGlmaWVyOjpuZXcoCisgICAgICAgICAgICBzZXJ2aWNlX2NhbGxfbmFtZSwKKyAgICAgICAgICAgIG1lc3NhZ2VfdHlwZSwKKyAgICAgICAgICAgIHNlcXVlbmNlX251bWJlciwKKyAgICAgICAgKSkKKyAgICB9CisKKyAgICBmbiByZWFkX21lc3NhZ2VfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgZm4gcmVhZF9zdHJ1Y3RfYmVnaW4oJm11dCBzZWxmKSAtPiA6OlJlc3VsdDxPcHRpb248VFN0cnVjdElkZW50aWZpZXI+PiB7CisgICAgICAgIHNlbGYucmVhZF9maWVsZF9pZF9zdGFjay5wdXNoKHNlbGYubGFzdF9yZWFkX2ZpZWxkX2lkKTsKKyAgICAgICAgc2VsZi5sYXN0X3JlYWRfZmllbGRfaWQgPSAwOworICAgICAgICBPayhOb25lKQorICAgIH0KKworICAgIGZuIHJlYWRfc3RydWN0X2VuZCgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYubGFzdF9yZWFkX2ZpZWxkX2lkID0gc2VsZgorICAgICAgICAgICAgLnJlYWRfZmllbGRfaWRfc3RhY2sKKyAgICAgICAgICAgIC5wb3AoKQorICAgICAgICAgICAgLmV4cGVjdCgic2hvdWxkIGhhdmUgcHJldmlvdXMgZmllbGQgaWRzIik7CisgICAgICAgIE9rKCgpKQorICAgIH0KKworICAgIGZuIHJlYWRfZmllbGRfYmVnaW4oJm11dCBzZWxmKSAtPiA6OlJlc3VsdDxURmllbGRJZGVudGlmaWVyPiB7CisgICAgICAgIC8vIHdlIGNhbiByZWFkIGF0IGxlYXN0IG9uZSBieXRlLCB3aGljaCBpczoKKyAgICAgICAgLy8gLSB0aGUgdHlwZQorICAgICAgICAvLyAtIHRoZSBmaWVsZCBkZWx0YSBhbmQgdGhlIHR5cGUKKyAgICAgICAgbGV0IGZpZWxkX3R5cGUgPSBzZWxmLnJlYWRfYnl0ZSgpPzsKKyAgICAgICAgbGV0IGZpZWxkX2RlbHRhID0gKGZpZWxkX3R5cGUgJiAweEYwKSA+PiA0OworICAgICAgICBsZXQgZmllbGRfdHlwZSA9IG1hdGNoIGZpZWxkX3R5cGUgJiAweDBGIHsKKyAgICAgICAgICAgIDB4MDEgPT4geworICAgICAgICAgICAgICAgIHNlbGYucGVuZGluZ19yZWFkX2Jvb2xfdmFsdWUgPSBTb21lKHRydWUpOworICAgICAgICAgICAgICAgIE9rKFRUeXBlOjpCb29sKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgMHgwMiA9PiB7CisgICAgICAgICAgICAgICAgc2VsZi5wZW5kaW5nX3JlYWRfYm9vbF92YWx1ZSA9IFNvbWUoZmFsc2UpOworICAgICAgICAgICAgICAgIE9rKFRUeXBlOjpCb29sKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdHR1OCA9PiB1OF90b190eXBlKHR0dTgpLAorICAgICAgICB9PzsKKworICAgICAgICBtYXRjaCBmaWVsZF90eXBlIHsKKyAgICAgICAgICAgIFRUeXBlOjpTdG9wID0+IE9rKAorICAgICAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXI6Om5ldzo6PE9wdGlvbjxTdHJpbmc+LCBTdHJpbmcsIE9wdGlvbjxpMTY+PigKKyAgICAgICAgICAgICAgICAgICAgTm9uZSwKKyAgICAgICAgICAgICAgICAgICAgVFR5cGU6OlN0b3AsCisgICAgICAgICAgICAgICAgICAgIE5vbmUsCisgICAgICAgICAgICAgICAgKSwKKyAgICAgICAgICAgICksCisgICAgICAgICAgICBfID0+IHsKKyAgICAgICAgICAgICAgICBpZiBmaWVsZF9kZWx0YSAhPSAwIHsKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5sYXN0X3JlYWRfZmllbGRfaWQgKz0gZmllbGRfZGVsdGEgYXMgaTE2OworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYubGFzdF9yZWFkX2ZpZWxkX2lkID0gc2VsZi5yZWFkX2kxNigpPzsKKyAgICAgICAgICAgICAgICB9OworCisgICAgICAgICAgICAgICAgT2soVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgICAgIGZpZWxkX3R5cGU6IGZpZWxkX3R5cGUsCisgICAgICAgICAgICAgICAgICAgIGlkOiBTb21lKHNlbGYubGFzdF9yZWFkX2ZpZWxkX2lkKSwKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgZm4gcmVhZF9maWVsZF9lbmQoJm11dCBzZWxmKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBPaygoKSkKKyAgICB9CisKKyAgICBmbiByZWFkX2Jvb2woJm11dCBzZWxmKSAtPiA6OlJlc3VsdDxib29sPiB7CisgICAgICAgIG1hdGNoIHNlbGYucGVuZGluZ19yZWFkX2Jvb2xfdmFsdWUudGFrZSgpIHsKKyAgICAgICAgICAgIFNvbWUoYikgPT4gT2soYiksCisgICAgICAgICAgICBOb25lID0+IHsKKyAgICAgICAgICAgICAgICBsZXQgYiA9IHNlbGYucmVhZF9ieXRlKCk/OworICAgICAgICAgICAgICAgIG1hdGNoIGIgeworICAgICAgICAgICAgICAgICAgICAweDAxID0+IE9rKHRydWUpLAorICAgICAgICAgICAgICAgICAgICAweDAyID0+IE9rKGZhbHNlKSwKKyAgICAgICAgICAgICAgICAgICAgdW5rbiA9PiBFcnIoOjpFcnJvcjo6UHJvdG9jb2woOjpQcm90b2NvbEVycm9yIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IDo6UHJvdG9jb2xFcnJvcktpbmQ6OkludmFsaWREYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgiY2Fubm90IGNvbnZlcnQge30gaW50byBib29sIiwgdW5rbiksCisgICAgICAgICAgICAgICAgICAgIH0pKSwKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbiByZWFkX2J5dGVzKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8VmVjPHU4Pj4geworICAgICAgICBsZXQgbGVuID0gc2VsZi50cmFuc3BvcnQucmVhZF92YXJpbnQ6Ojx1MzI+KCk/OworICAgICAgICBsZXQgbXV0IGJ1ZiA9IHZlYyFbMHU4OyBsZW4gYXMgdXNpemVdOwor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ICAgICAgICAgICAgbGV0IHR5cGVfaGVhZGVyID0gc2VsZi5yZWFkX2J5dGUoKT87CisgICAgICAgICAgICBsZXQga2V5X3R5cGUgPSBjb2xsZWN0aW9uX3U4X3RvX3R5cGUoKHR5cGVfaGVhZGVyICYgMHhGMCkgPj4gNCk/OworICAgICAgICAgICAgbGV0IHZhbF90eXBlID0gY29sbGVjdGlvbl91OF90b190eXBlKHR5cGVfaGVhZGVyICYgMHgwRik/OworICAgICAgICAgICAgT2soVE1hcElkZW50aWZpZXI6Om5ldyhrZXlfdHlwZSwgdmFsX3R5cGUsIGVsZW1lbnRfY291bnQpKQorICAgICAgICB9CisgICAgfQorCisgICAgZm4gcmVhZF9tYXBfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgLy8gdXRpbGl0eQorICAgIC8vCisKKyAgICBmbiByZWFkX2J5dGUoJm11dCBzZWxmKSAtPiA6OlJlc3VsdDx1OD4geworICAgICAgICBsZXQgbXV0IGJ1ZiA9IFswdTg7IDFdOworICAgICAgICBzZWxmLnRyYW5zcG9ydAorICAgICAgICAgICAgLnJlYWRfZXhhY3QoJm11dCBidWYpCisgICAgICAgICAgICAubWFwX2VycihGcm9tOjpmcm9tKQorICAgICAgICAgICAgLm1hcCh8X3wgYnVmWzBdKQorICAgIH0KK30KKworaW1wbDxUPiBpbzo6U2VlayBmb3IgVENvbXBhY3RJbnB1dFByb3RvY29sPFQ+Cit3aGVyZQorICAgIFQ6IGlvOjpTZWVrICsgVFJlYWRUcmFuc3BvcnQsCit7CisgICAgZm4gc2VlaygmbXV0IHNlbGYsIHBvczogaW86OlNlZWtGcm9tKSAtPiBpbzo6UmVzdWx0PHU2ND4geworICAgICAgICBzZWxmLnRyYW5zcG9ydC5zZWVrKHBvcykKKyAgICB9Cit9CisKKy8vLyBGYWN0b3J5IGZvciBjcmVhdGluZyBpbnN0YW5jZXMgb2YgYFRDb21wYWN0S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pPzsKKyAgICAgICAgICAgIHNlbGYud3JpdGVfaTE2KGZpZWxkX2lkKT87CisgICAgICAgIH0KKyAgICAgICAgc2VsZi5sYXN0X3dyaXRlX2ZpZWxkX2lkID0gZmllbGRfaWQ7CisgICAgICAgIE9rKCgpKQorICAgIH0KKworICAgIGZuIHdyaXRlX2xpc3Rfc2V0X2JlZ2luKCZtdXQgc2VsZiwgZWxlbWVudF90eXBlOiBUVHlwZSwgZWxlbWVudF9jb3VudDogaTMyKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBsZXQgZWxlbV9pZGVudGlmaWVyID0gY29sbGVjdGlvbl90eXBlX3RvX3U4KGVsZW1lbnRfdHlwZSk7CisgICAgICAgIGlmIGVsZW1lbnRfY291bnQgPD0gMTQgeworICAgICAgICAgICAgbGV0IGhlYWRlciA9IChlbGVtZW50X2NvdW50IGFzIHU4KSA8PCA0IHwgZWxlbV9pZGVudGlmaWVyOworICAgICAgICAgICAgc2VsZi53cml0ZV9ieXRlKGhlYWRlcikKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGxldCBoZWFkZXIgPSAweEYwIHwgZWxlbV9pZGVudGlmaWVyOworICAgICAgICAgICAgc2VsZi53cml0ZV9ieXRlKGhlYWRlcik/OworICAgICAgICAgICAgc2VsZi50cmFuc3BvcnQKKyAgICAgICAgICAgICAgICAud3JpdGVfdmFyaW50KGVsZW1lbnRfY291bnQgYXMgdTMyKQorICAgICAgICAgICAgICAgIC5tYXBfZXJyKEZyb206OmZyb20pCisgICAgICAgICAgICAgICAgLm1hcCh8X3wgKCkpCisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbiBhc3NlcnRfbm9fcGVuZGluZ19ib29sX3dyaXRlKCZzZWxmKSB7CisgICAgICAgIGlmIGxldCBTb21lKHJlZiBmKSA9IHNlbGYucGVuZGluZ193cml0ZV9ib29sX2ZpZWxkX2lkZW50aWZpZXIgeworICAgICAgICAgICAgcGFuaWMhKCJwZW5kaW5nIGJvb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B9CisKKyAgICBmbiB3cml0ZV9zdHJ1Y3RfZW5kKCZtdXQgc2VsZikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgc2VsZi5hc3NlcnRfbm9fcGVuZGluZ19ib29sX3dyaXRlKCk7CisgICAgICAgIHNlbGYubGFzdF93cml0ZV9maWVsZF9pZCA9IHNlbGYKKyAgICAgICAgICAgIC53cml0ZV9maWVsZF9pZF9zdGFjaworICAgICAgICAgICAgLnBvcCgpCisgICAgICAgICAgICAuZXhwZWN0KCJzaG91bGQgaGF2ZSBwcmV2aW91cyBmaWVsZCBpZHMiKTsKKyAgICAgICAgT2soKCkpCisgICAgfQorCisgICAgZm4gd3JpdGVfZmllbGRfYmVnaW4oJm11dCBzZWxmLCBpZGVudGlmaWVyOiAmVEZpZWxkSWRlbnRpZmllcikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgbWF0Y2ggaWRlbnRpZmllci5maWVsZF90eXBlIHsKKyAgICAgICAgICAgIFRUeXBlOjpCb29sID0+IHsKKyAgICAgICAgICAgICAgICBpZiBzZWxmLnBlbmRpbmdfd3JpdGVfYm9vbF9maWVsZF9pZGVudGlmaWVyLmlzX3NvbWUoKSB7CisgICAgICAgICAgICAgICAgICAgIHBhbmljISgKKyAgICAgICAgICAgICAgICAgICAgICAgICJzaG91bGQgbm90IGhhdmUgYSBwZW5kaW5nIGJvb2wgd2hpbGUgd3JpdGluZyBhbm90aGVyIGJvb2wgd2l0aCBpZDogXAorICAgICAgICAgICAgICAgICAgICAgICAgIHs6P30iLAorICAgICAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllcgorICAgICAgICAgICAgICAgICAgICApCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNlbGYucGVuZGluZ193cml0ZV9ib29sX2ZpZWxkX2lkZW50aWZpZXIgPSBTb21lKGlkZW50aWZpZXIuY2xvbmUoKSk7CisgICAgICAgICAgICAgICAgT2soKCkpCisgICAgICAgICAgICB9Cisg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0gaWYgYiB7IDB4MDEgfSBlbHNlIHsgMHgwMiB9OworICAgICAgICAgICAgICAgIHNlbGYud3JpdGVfZmllbGRfaGVhZGVyKGZpZWxkX3R5cGVfYXNfdTgsIGZpZWxkX2lkKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgTm9uZSA9PiB7CisgICAgICAgICAgICAgICAgaWYgYiB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYud3JpdGVfYnl0ZSgweDAxKQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYud3JpdGVfYnl0ZSgweDAyKQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIHdyaXRlX2J5dGVzKCZtdXQgc2VsZiwgYjogJlt1OF0pIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYudHJhbnNwb3J0LndyaXRlX3ZhcmludChiLmxlbigpIGFzIHUzMik/OworICAgICAgICBzZWxmLnRyYW5zcG9ydC53cml0ZV9hbGwoYikubWFwX2VycihGcm9tOjpmcm9tKQorICAgIH0KKworICAgIGZuIHdyaXRlX2k4KCZtdXQgc2VsZiwgaTogaTgpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYud3JpdGVfYnl0ZShpIGFzIHU4KQorICAgIH0KKworICAgIGZuIHdyaXRlX2kxNigmbXV0IHNlbGYsIGk6IGkxNikgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgc2VsZi50cmFuc3BvcnQKKyAgICAgICAgICAgIC53cml0ZV92YXJpbnQoaSkKKyAgICAgICAgICAgIC5tYXBfZXJyKEZyb206OmZyb20pCisgICAgICAgICAgICAubWFwKHxffCAoKSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9pMzIoJm11dCBzZWxmLCBpOiBpMzIpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYudHJhbnNwb3J0CisgICAg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+IHsKKyAgICAgICAgc2VsZi53cml0ZV9saXN0X3NldF9iZWdpbihpZGVudGlmaWVyLmVsZW1lbnRfdHlwZSwgaWRlbnRpZmllci5zaXplKQorICAgIH0KKworICAgIGZuIHdyaXRlX3NldF9lbmQoJm11dCBzZWxmKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBPaygoKSkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9tYXBfYmVnaW4oJm11dCBzZWxmLCBpZGVudGlmaWVyOiAmVE1hcElkZW50aWZpZXIpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIGlmIGlkZW50aWZpZXIuc2l6ZSA9PSAwIHsKKyAgICAgICAgICAgIHNlbGYud3JpdGVfYnl0ZSgwKQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc2VsZi50cmFuc3BvcnQud3JpdGVfdmFyaW50KGlkZW50aWZpZXIuc2l6ZSBhcyB1MzIpPzsKKworICAgICAgICAgICAgbGV0IGtleV90eXBlID0gaWRlbnRpZmllcgorICAgICAgICAgICAgICAgIC5rZXlfdHlwZQorICAgICAgICAgICAgICAgIC5leHBlY3QoIm1hcCBpZGVudGlmaWVyIHRvIHdyaXRlIHNob3VsZCBjb250YWluIGtleSB0eXBlIik7CisgICAgICAgICAgICBsZXQga2V5X3R5cGVfYnl0ZSA9IGNvbGxlY3Rpb25fdHlwZV90b191OChrZXlfdHlwZSkgPDwgNDsKKworICAgICAgICAgICAgbGV0IHZhbF90eXBlID0gaWRlbnRpZmllcgorICAgICAgICAgICAgICAgIC52YWx1ZV90eXBlCisgICAgICAgICAgICAgICAgLmV4cGVjdCgibWFwIGlkZW50aWZpZXIgdG8gd3JpdGUgc2hvdWxkIGNvbnRhaW4gdmFsdWUgdHlwZSIpOworICAgICAgICAgICAgbGV0IHZhbF90eXBlX2J5dGUgPSBjb2xsZWN0aW9uX3R5cGVfdG9fdTgodmFsX3R5cGUpOworCisgICAgICAgICAgICBsZXQgbWFwX3R5cGVfaGVhZGV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AgICAgICAgIGZpZWxkX3R5cGUKKyAgICAgICAgKSksCisgICAgfQorfQorCitmbiBjb2xsZWN0aW9uX3U4X3RvX3R5cGUoYjogdTgpIC0+IDo6UmVzdWx0PFRUeXBlPiB7CisgICAgbWF0Y2ggYiB7CisgICAgICAgIDB4MDEgPT4gT2soVFR5cGU6OkJvb2wpLAorICAgICAgICBvID0+IHU4X3RvX3R5cGUobyksCisgICAgfQorfQorCitmbiB1OF90b190eXBlKGI6IHU4KSAtPiA6OlJlc3VsdDxUVHlwZT4geworICAgIG1hdGNoIGIgeworICAgICAgICAweDAwID0+IE9rKFRUeXBlOjpTdG9wKSwKKyAgICAgICAgMHgwMyA9PiBPayhUVHlwZTo6STA4KSwgLy8gZXF1aXZhbGVudCB0byBUVHlwZTo6Qnl0ZQorICAgICAgICAweDA0ID0+IE9rKFRUeXBlOjpJMTYpLAorICAgICAgICAweDA1ID0+IE9rKFRUeXBlOjpJMzIpLAorICAgICAgICAweDA2ID0+IE9rKFRUeXBlOjpJNjQpLAorICAgICAgICAweDA3ID0+IE9rKFRUeXBlOjpEb3VibGUpLAorICAgICAgICAweDA4ID0+IE9rKFRUeXBlOjpTdHJpbmcpLAorICAgICAgICAweDA5ID0+IE9rKFRUeXBlOjpMaXN0KSwKKyAgICAgICAgMHgwQSA9PiBPayhUVHlwZTo6U2V0KSwKKyAgICAgICAgMHgwQiA9PiBPayhUVHlwZTo6TWFwKSwKKyAgICAgICAgMHgwQyA9PiBPayhUVHlwZTo6U3RydWN0KSwKKyAgICAgICAgdW5rbiA9PiBFcnIoOjpFcnJvcjo6UHJvdG9jb2woOjpQcm90b2NvbEVycm9yIHsKKyAgICAgICAgICAgIGtpbmQ6IDo6UHJvdG9jb2xFcnJvcktpbmQ6OkludmFsaWREYXRhLAorICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgiY2Fubm90IGNvbnZlcnQge30gaW50byBUVHlwZSIsIHVua24pLAorICAgICAgICB9KSksCisgICAgfQorfQorCisjW2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LworICAgICAgICAgICAgMHgwMywgLyogbWVzc2FnZS1uYW1lIGxlbmd0aCAqLworICAgICAgICAgICAgMHg2NiwKKyAgICAgICAgICAgIDB4NkYsCisgICAgICAgICAgICAweDZGIC8qICJmb28iICovLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9tZXNzYWdlX2JlZ2luXzEoKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX21lc3NhZ2VfYmVnaW4oJlRNZXNzYWdlSWRlbnRpZmllcjo6bmV3KAorICAgICAgICAgICAgImJhciIsCisgICAgICAgICAgICBUTWVzc2FnZVR5cGU6OlJlcGx5LAorICAgICAgICAgICAgOTkxODI4CisgICAgICAgICkpKTsKKworICAgICAgICAjW2NmZ19hdHRyKHJ1c3RmbXQsIHJ1c3RmbXQ6OnNraXApXQorICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgOV0gPSBbCisgICAgICAgICAgICAweDgyLCAvKiBwcm90b2NvbCBJRCAqLworICAgICAgICAgICAgMHg0MSwgLyogbWVzc2FnZSB0eXBlIHwgcHJvdG9jb2wgdmVyc2lvbiAqLworICAgICAgICAgICAgMHhBOCwKKyAgICAgICAgICAgIDB4ODksCisgICAgICAgICAgICAweDc5LCAvKiB6aWctemFnIHZhcmludCBzZXF1ZW5jZSBudW1iZXIgKi8KKyAgICAgICAgICAgIDB4MDMsIC8qIG1lc3NhZ2UtbmFtZSBsZW5ndGggKi8KKyAgICAgICAgICAgIDB4NjIsCisgICAgICAgICAgICAweDYxLAorICAgICAgICAgICAgMHg3MiAvKiAiYmFyIiAqLywKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd3Jp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eworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMywKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8zCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNCwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgZmllbGRfdHlwZTogVFR5cGU6OlN0b3AsCisgICAgICAgICAgICAgICAgaWQ6IE5vbmUsCisgICAgICAgICAgICB9CisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9lbmQoKSk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfc3RydWN0X3dpdGhfbm9uX3plcm9faW5pdGlhbF9maWVsZF9hbmRfZGVsdGFfZmllbGRzKCkgeworICAgICAgICBs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worICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMywKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8zCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNCwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgZmllbGRfdHlwZTogVFR5cGU6OlN0b3AsCisgICAgICAgICAgICAgICAgaWQ6IE5vbmUsCisgICAgICAgICAgICB9CisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9lbmQoKSk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfc3RydWN0X3dpdGhfbG9uZ19maWVsZHMoKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X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uZXcoImZvbyIsIFRUeXBlOjpTZXQsIDk5KSkpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICAvLyBub3csIGZpbmlzaCB0aGUgc3RydWN0IG9mZgorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX3N0b3AoKSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfc3RydWN0X2VuZCgpKTsKKworICAgICAgICAjW2NmZ19hdHRyKHJ1c3RmbXQsIHJ1c3RmbXQ6OnNraXApXQorICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgOF0gPSBbCisgICAgICAgICAgICAweDA1LCAvKiBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDAwLCAvKiBmaXJzdCBmaWVsZCBpZCAqLworICAgICAgICAgICAgMHgwNiwgLyogZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgyMCwgLyogemlnLXphZyB2YXJpbnQgZmllbGQgaWQgKi8KKyAgICAgICAgICAgIDB4MEEsIC8qIGZpZWxkIHR5cGUgKi8KKyAgICAgICAgICAgIDB4QzYsCisgICAgICAgICAgICAweDAxLCAvKiB6aWctemFnIHZhcmludCBmaWVsZCBpZCAqLworICAgICAgICAgICAgMHgwMCAvKiBmaWVsZCBzdG9wICovLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX3N0cnVjdF93aXRoX2xvbmdfZmllbGRzKCkgeworICAgICAgICBsZXQgKG11dCBpX3Byb3QsIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKCk7CisKKyAgICAgICAgLy8gbm8gYnl0ZXMgc2hvdWxkIGJlIHdyaXR0ZW4gaG93ZXZlcgorICA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ICAgICAgICAgICAgcmVhZF9pZGVudF8yLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzIKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8zID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8zLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzMKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF80ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF80LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICBmaWVsZF90eXBlOiBUVHlwZTo6U3RvcCwKKyAgICAgICAgICAgICAgICBpZDogTm9uZSwKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF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ogW3U4OyAxMF0gPSBbCisgICAgICAgICAgICAweDE2LCAvKiBmaWVsZCBkZWx0YSAoMSkgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDg1LCAvKiBmaWVsZCBkZWx0YSAoOCkgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDBBLCAvKiBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweEQwLAorICAgICAgICAgICAgMHgwRiwgLyogemlnLXphZyB2YXJpbnQgZmllbGQgaWQgKi8KKyAgICAgICAgICAgIDB4MEEsIC8qIGZpZWxkIHR5cGUgKi8KKyAgICAgICAgICAgIDB4QTIsCisgICAgICAgICAgICAweDFGLCAvKiB6aWctemFnIHZhcmludCBmaWVsZCBpZCAqLworICAgICAgICAgICAgMHgzQSwgLyogZmllbGQgZGVsdGEgKDMpIHwgZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgwMCAvKiBmaWVsZCBzdG9wICovLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX3N0cnVjdF93aXRoX21peF9vZl9sb25nX2FuZF9kZWx0YV9maWVsZHMoKSB7CisgICAgICAgIGxldCAobXV0IGlfcHJvdCwgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICAvLyBubyBieXRlcyBzaG91bGQgYmUgd3JpdHRlbiBob3dldmVyCisgICAgICAgIGxldCBzdHJ1Y3RfaWRlbnQgPSBUU3RydWN0SWRlbnRpZmllcjo6bmV3KCJmb28iKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zdHJ1Y3RfYmVnaW4oJnN0cnVjdF9pZGVudCkpOworCisgICAgICAgIC8vIHdyaXRlIHRocmVlIGZpZWxkcyB3aXRoIGZpZWxkIGlkcyB0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7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMSA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMSwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8xCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMiA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMywKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8zCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNCwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF80CisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNSA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNSwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF81CisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNiA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgZmllbGRfdHlwZTogVFR5cGU6OlN0b3AsCisgICAgICAgICAgICAgICAgaWQ6IE5vbmUsCisgICAgICAgICAgICB9CisgICAgICAgICk7CisKKyAgICAg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8vIGVuZCBjb250YWluaW5nIHN0cnVjdAorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX3N0b3AoKSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfc3RydWN0X2VuZCgpKTsKKworICAgICAgICAjW2NmZ19hdHRyKHJ1c3RmbXQsIHJ1c3RmbXQ6OnNraXApXQorICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgN10gPSBbCisgICAgICAgICAgICAweDE2LCAvKiBmaWVsZCBkZWx0YSAoMSkgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDg1LCAvKiBmaWVsZCBkZWx0YSAoOCkgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDczLCAvKiBmaWVsZCBkZWx0YSAoNykgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDA3LCAvKiBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDMwLCAvKiB6aWctemFnIHZhcmludCBmaWVsZCBpZCAqLworICAgICAgICAgICAgMHgwMCwgLyogZmllbGQgc3RvcCAtIGNvbnRhaW5lZCAqLworICAgICAgICAgICAgMHgwMCAvKiBmaWVsZCBzdG9wIC0gY29udGFpbmluZyAqLywKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfcm91bmRfdHJpcF9uZXN0ZWRfc3RydWN0c18wKCkgeworICAgICAgICAvLyBsYXN0IGZpZWxkIG9mIHRoZSBjb250YWluaW5nIHN0cnVjdCBpcyBhIGRlbHRhCisgICAgICAgIC8vIGZpcnN0IGZpZWxkIG9mIHRoZSB0aGUgY29udGFpbmVkIHN0cnVjdCBpcyBhIGRlbHRhCisKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBtdXQgb19wcm90KSA9IHRlc3Rfb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c3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgLy8gcmVhZCBjb250YWluaW5nIHN0cnVjdCBiYWNrCisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9zdHJ1Y3RfYmVnaW4oKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMSA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMSwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8xCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMiA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgLy8gcmVhZCBjb250YWluZWQgc3RydWN0IGJhY2sKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9iZWdpbigpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8zID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8zLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzMKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF80ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF80LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzQKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmVkIHN0cnVjdAorICAgICAgICBsZXQgcmVhZF9pZGVudF82ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF82LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICBmaWVsZF90eXBlOiBUVHlwZTo6U3RvcCwKKyAgICAgICAgICAgICAgICBpZDogTm9uZSwKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgLy8gZW5kIGNvbnRhaW5pbmcgc3RydWN0CisgICAgICAgIGxldCByZWFkX2lkZW50XzcgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzcsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIGZpZWxkX3R5cGU6IFRUeXBlOjpTdG9wLAorICAgICAgICAgICAgICAgIGlkOiBOb25lLAorICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9uZXN0ZWRfc3RydWN0c18xKCkgeworICAgICAgICAvLyBsYXN0IGZpZWxkIG9mIHRoZSBjb250YWluaW5nIHN0cnVjdCBpcyBhIGRlbHRhCisgICAgICAgIC8vIGZpcnN0IGZpZWxkIG9mIHRoZSB0aGUgY29udGFpbmVkIHN0cnVjdCBpcyBhIGZ1bGwgd3JpdGUKKworICAgICAgICBsZXQgKF8sIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKCk7CisKKyAgICAgICAgLy8gc3RhcnQgY29udGFpbmluZyBzdHJ1Y3QKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zdHJ1Y3RfYmVnaW4oJlRTdHJ1Y3RJZGVudGlmaWVyOjpuZXcoImZvbyIpKSk7CisKKyAgICAgICAgLy8gY29udGFpb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ICAgICAweDMzLCAvKiBmaWVsZCBkZWx0YSAoMykgfCBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDAwLCAvKiBmaWVsZCBzdG9wIC0gY29udGFpbmVkICovCisgICAgICAgICAgICAweDAwIC8qIGZpZWxkIHN0b3AgLSBjb250YWluaW5nICovLAorICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX25lc3RlZF9zdHJ1Y3RzXzEoKSB7CisgICAgICAgIC8vIGxhc3QgZmllbGQgb2YgdGhlIGNvbnRhaW5pbmcgc3RydWN0IGlzIGEgZGVsdGEKKyAgICAgICAgLy8gZmlyc3QgZmllbGQgb2YgdGhlIHRoZSBjb250YWluZWQgc3RydWN0IGlzIGEgZnVsbCB3cml0ZQorCisgICAgICAgIGxldCAobXV0IGlfcHJvdCwgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICAvLyBzdGFydCBjb250YWluaW5nIHN0cnVjdAorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9iZWdpbigmVFN0cnVjdElkZW50aWZpZXI6Om5ldygiZm9vIikpKTsKKworICAgICAgICAvLyBjb250YWluaW5nIHN0cnVjdAorICAgICAgICAvLyBzaW5jZSB0aGUgZGVsdGEgaXMgPiAwIGFuZCA8IDE1IGl0IGdldHMgYSBkZWx0YSB3cml0ZQorICAgICAgICBsZXQgZmllbGRfaWRlbnRfMSA9IFRGaWVsZElkZW50aWZpZXI6Om5ldygiZm9vIiwgVFR5cGU6Okk2NCwgMSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfZmllbGRfYmVnaW4oJmZpZWxkX2lkZW50XzEpKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9f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llbGRfaWRlbnRfNCA9IFRGaWVsZElkZW50aWZpZXI6Om5ldygiZm9vIiwgVFR5cGU6OkkwOCwgMjcpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX2JlZ2luKCZmaWVsZF9pZGVudF80KSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfZmllbGRfZW5kKCkpOworCisgICAgICAgIC8vIGVuZCBjb250YWluZWQgc3RydWN0CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfZmllbGRfc3RvcCgpKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zdHJ1Y3RfZW5kKCkpOworCisgICAgICAgIC8vIGVuZCBjb250YWluaW5nIHN0cnVjdAorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX3N0b3AoKSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfc3RydWN0X2VuZCgpKTsKKworICAgICAgICBjb3B5X3dyaXRlX2J1ZmZlcl90b19yZWFkX2J1ZmZlciEob19wcm90KTsKKworICAgICAgICAvLyByZWFkIGNvbnRhaW5pbmcgc3RydWN0IGJhY2sKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9iZWdpbigpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8xID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8xLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzEKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8yID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8yLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzIKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICAvLyByZWFkIGNvbnRhaW5lZCBzdHJ1Y3QgYmFjaworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2JlZ2luKCkpOworCisgICAgICAgIGxldCByZWFkX2lkZW50XzMgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzMsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIC4uZmllbGRfaWRlbnRfMworICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfZW5kKCkpOworCisgICAgICAgIGxldCByZWFkX2lkZW50XzQgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzQsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIC4uZmllbGRfaWRlbnRfNAorICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfZW5kKCkpOworCisgICAgICAgIC8vIGVuZCBjb250YWluZWQgc3RydWN0CisgICAgICAgIGxldCByZWFkX2lkZW50XzYgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzYsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIGZpZWxkX3R5cGU6IFRUeXBlOjpTdG9wLAorICAgICAgICAgICAgICAgIGlkOiBOb25lLAorICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmluZyBzdHJ1Y3QKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNywKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgZmllbGRfdHlwZTogVFR5cGU6OlN0b3AsCisgICAgICAgICAgICAgICAgaWQ6IE5vbmUsCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9zdHJ1Y3RfZ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lc3MhKG9fcHJvdC53cml0ZV9maWVsZF9zdG9wKCkpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgI1tjZmdfYXR0cihydXN0Zm10LCBydXN0Zm10Ojpza2lwKV0KKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDddID0gWworICAgICAgICAgICAgMHgxNiwgLyogZmllbGQgZGVsdGEgKDEpIHwgZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgwOCwgLyogZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgyQSwgLyogemlnLXphZyB2YXJpbnQgZmllbGQgaWQgKi8KKyAgICAgICAgICAgIDB4NzcsIC8qIGZpZWxkIGRlbHRhKDcpIHwgZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgzMywgLyogZmllbGQgZGVsdGEgKDMpIHwgZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgwMCwgLyogZmllbGQgc3RvcCAtIGNvbnRhaW5lZCAqLworICAgICAgICAgICAgMHgwMCAvKiBmaWVsZCBzdG9wIC0gY29udGFpbmluZyAqLywKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfcm91bmRfdHJpcF9uZXN0ZWRfc3RydWN0c18yKCkgeworICAgICAgICBsZXQgKG11dCBpX3Byb3QsIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKCk7CisKKyAgICAgICAgLy8gc3RhcnQgY29udGFpbmluZyBzdHJ1Y3QKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zdHJ1Y3RfYmVnaW4oJlRTdHJ1Y3RJZGVudGlmaWVyOjpuZXcoImZvbyIpKSk7CisKKyAgICAgICAgLy8gY29udGFpbmluZyBzdHJ1Y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hZF9zdHJ1Y3RfYmVnaW4oKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMSA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMSwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8xCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMiA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgLy8gcmVhZCBjb250YWluZWQgc3RydWN0IGJhY2sKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9iZWdpbigpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8zID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8zLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzMKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF80ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF80LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzQKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmVkIHN0cnVjdAorICAgICAgICBsZXQgcmVhZF9pZGVudF82ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF82LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICBmaWVsZF90eXBlOiBUVHlwZTo6U3RvcCwKKyAgICAgICAgICAgICAgICBpZDogTm9uZSwKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgLy8gZW5kIGNvbnRhaW5pbmcgc3RydWN0CisgICAgICAgIGxldCByZWFkX2lkZW50XzcgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzcsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIGZpZWxkX3R5cGU6IFRUeXBlOjpTdG9wLAorICAgICAgICAgICAgICAgIGlkOiBOb25lLAorICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9uZXN0ZWRfc3RydWN0c18zKCkgeworICAgICAgICAvLyBsYXN0IGZpZWxkIG9mIHRoZSBjb250YWluaW5nIHN0cnVjdCBpcyBhIGZ1bGwgd3JpdGUKKyAgICAgICAgLy8gZmlyc3QgZmllbGQgb2YgdGhlIHRoZSBjb250YWluZWQgc3RydWN0IGlzIGEgZnVsbCB3cml0ZQorCisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICAvLyBzdGFydCBjb250YWluaW5nIHN0cnVjdAorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9iZWdpbigmVFN0cnVjdElkZW50aWZpZXI6Om5ldygiZm9vIikpKTsKKworICAgICAgICAvLyBjb250YWluaW5nIHN0cnVjdAorICAgICAgICAvLyBzaW5jZSB0aGUgZGVsdGEgaXMgPiAwIGFuZCA8IDE1IGl0IGdldHMgYSBkZWx0YSB3cml0ZQorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX2JlZ2luKCZURmllbGRJZGVudGlmaWVyOjpuZXcoImZvbyIsIFRUeXBlOjpJNjQsIDEpKSk7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BUVHlwZTo6STA4LCAyNykpKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgLy8gZW5kIGNvbnRhaW5lZCBzdHJ1Y3QKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9maWVsZF9zdG9wKCkpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgLy8gZW5kIGNvbnRhaW5pbmcgc3RydWN0CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfZmllbGRfc3RvcCgpKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zdHJ1Y3RfZW5kKCkpOworCisgICAgICAgICNbY2ZnX2F0dHIocnVzdGZtdCwgcnVzdGZtdDo6c2tpcCldCisgICAgICAgIGxldCBleHBlY3RlZDogW3U4OyA4XSA9IFsKKyAgICAgICAgICAgIDB4MTYsIC8qIGZpZWxkIGRlbHRhICgxKSB8IGZpZWxkIHR5cGUgKi8KKyAgICAgICAgICAgIDB4MDgsIC8qIGZpZWxkIHR5cGUgKi8KKyAgICAgICAgICAgIDB4MkEsIC8qIHppZy16YWcgdmFyaW50IGZpZWxkIGlkICovCisgICAgICAgICAgICAweDA3LCAvKiBmaWVsZCB0eXBlICovCisgICAgICAgICAgICAweDJBLCAvKiB6aWctemFnIHZhcmludCBmaWVsZCBpZCAqLworICAgICAgICAgICAgMHg2MywgLyogZmllbGQgZGVsdGEgKDYpIHwgZmllbGQgdHlwZSAqLworICAgICAgICAgICAgMHgwMCwgLyogZmllbGQgc3RvcCAtIGNvbnRhaW5lZCAqLworICAgICAgICAgICAgMHgwMCAvKiBmaWVsZCBzdG9wIC0gY29udGFpbmluZyAqLywKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd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pZWxkX2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmVkIHN0cnVjdAorICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2ZpZWxkX3N0b3AoKSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShvX3Byb3Qud3JpdGVfc3RydWN0X2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmluZyBzdHJ1Y3QKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9maWVsZF9zdG9wKCkpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgLy8gcmVhZCBjb250YWluaW5nIHN0cnVjdCBiYWNrCisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9zdHJ1Y3RfYmVnaW4oKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMSA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMSwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8xCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfMiA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfMiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgLy8gcmVhZCBjb250YWluZWQgc3RydWN0IGJhY2sKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9iZWdpbigpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8zID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8zLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzMKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF80ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF80LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzQKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICAvLyBlbmQgY29udGFpbmVkIHN0cnVjdAorICAgICAgICBsZXQgcmVhZF9pZGVudF82ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF82LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICBmaWVsZF90eXBlOiBUVHlwZTo6U3RvcCwKKyAgICAgICAgICAgICAgICBpZDogTm9uZSwKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX3N0cnVjdF9lbmQoKSk7CisKKyAgICAgICAgLy8gZW5kIGNvbnRhaW5pbmcgc3RydWN0CisgICAgICAgIGxldCByZWFkX2lkZW50XzcgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfZmllbGRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICByZWFkX2lkZW50XzcsCisgICAgICAgICAgICBURmllbGRJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBuYW1lOiBOb25lLAorICAgICAgICAgICAgICAgIGZpZWxkX3R5cGU6IFRUeXBlOjpTdG9wLAorICAgICAgICAgICAgICAgIGlkOiBOb25lLAorICAgICAgICAgICAgfQorICAgICAgICApOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9ib29sX2ZpZWxkKCkgeworICAgICAgICBsZXQgKF8sIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKCk7CisKKyAgICAgICAgLy8gbm8gYnl0ZXMgc2hvdWxkIG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WRlbnRfMiwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF8yCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGxldCByZWFkX3ZhbHVlXzIgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfYm9vbCgpKTsKKyAgICAgICAgYXNzZXJ0X2VxIShyZWFkX3ZhbHVlXzIsIGZhbHNlKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF8zID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF8zLAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICAuLmZpZWxkX2lkZW50XzMKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKyAgICAgICAgbGV0IHJlYWRfdmFsdWVfMyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9ib29sKCkpOworICAgICAgICBhc3NlcnRfZXEhKHJlYWRfdmFsdWVfMywgdHJ1ZSk7CisgICAgICAgIGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9lbmQoKSk7CisKKyAgICAgICAgbGV0IHJlYWRfaWRlbnRfNCA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9maWVsZF9iZWdpbigpKTsKKyAgICAgICAgYXNzZXJ0X2VxISgKKyAgICAgICAgICAgIHJlYWRfaWRlbnRfNCwKKyAgICAgICAgICAgIFRGaWVsZElkZW50aWZpZXIgeworICAgICAgICAgICAgICAgIG5hbWU6IE5vbmUsCisgICAgICAgICAgICAgICAgLi5maWVsZF9pZGVudF80CisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgICAgIGxldCByZWFkX3ZhbHVlXzQgPSBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfYm9vbCgpKTsKKyAgICAgICAgYXNzZXJ0X2VxIShyZWFkX3ZhbHVlXzQsIGZhbHNlKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2VuZCgpKTsKKworICAgICAgICBsZXQgcmVhZF9pZGVudF81ID0gYXNzZXJ0X3N1Y2Nlc3MhKGlfcHJvdC5yZWFkX2ZpZWxkX2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKAorICAgICAgICAgICAgcmVhZF9pZGVudF81LAorICAgICAgICAgICAgVEZpZWxkSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgbmFtZTogTm9uZSwKKyAgICAgICAgICAgICAgICBmaWVsZF90eXBlOiBUVHlwZTo6U3RvcCwKKyAgICAgICAgICAgICAgICBpZDogTm9uZSwKKyAgICAgICAgICAgIH0KKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEoaV9wcm90LnJlYWRfc3RydWN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgI1tzaG91bGRfcGFuaWNdCisgICAgZm4gbXVzdF9mYWlsX2lmX3dyaXRlX2ZpZWxkX2VuZF93aXRob3V0X3dyaXRpbmdfYm9vbF92YWx1ZSgpIHsKKyAgICAgICAgbGV0IChfLCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cygpOworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3N0cnVjdF9iZWdpbigmVFN0cnVjdElkZW50aWZpZXI6Om5ldygiZm9vIikpKTsKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53c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IFRMaXN0SWRlbnRpZmllcjo6bmV3KFRUeXBlOjpTZXQsIDQ3MzgxKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX2xpc3RfYmVnaW4oJmlkZW50KSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgbGV0IHJlcyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9saXN0X2JlZ2luKCkpOworICAgICAgICBhc3NlcnRfZXEhKCZyZXMsICZpZGVudCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfbGlzdF9lbmQoKSB7CisgICAgICAgIGFzc2VydF9ub193cml0ZSh8b3wgby53cml0ZV9saXN0X2VuZCgpKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9zbWFsbF9zaXplZF9zZXRfYmVnaW4oKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3NldF9iZWdpbigmVFNldElkZW50aWZpZXI6Om5ldyhUVHlwZTo6U3RydWN0LCAyKSkpOworCisgICAgICAgIGxldCBleHBlY3RlZDogW3U4OyAxXSA9IFsweDJDIC8qIHNpemUgfCBlbGVtX3R5cGUgKi9dOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX3NtYWxsX3NpemVkX3NldF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cygpOworCisgICAgICAgIGxldCBpZGVudCA9IFRTZXRJZGVudGlmaWVyOjpuZXcoVFR5cGU6OkkxNiwgNyk7CisKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9zZXRfYmVnaW4oJmlkZW50KSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgbGV0IHJlcyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9zZXRfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoJnJlcywgJmlkZW50KTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF93cml0ZV9sYXJnZV9zaXplZF9zZXRfYmVnaW4oKSB7CisgICAgICAgIGxldCAoXywgbXV0IG9fcHJvdCkgPSB0ZXN0X29iamVjdHMoKTsKKworICAgICAgICBhc3NlcnRfc3VjY2VzcyEob19wcm90LndyaXRlX3NldF9iZWdpbigmVFNldElkZW50aWZpZXI6Om5ldyhUVHlwZTo6RG91YmxlLCAyMzg5MSkpKTsKKworICAgICAgICBsZXQgZXhwZWN0ZWQ6IFt1ODsgNF0gPSBbCisgICAgICAgICAgICAweEY3LCAvKiAweEYwIHwgZWxlbV90eXBlICovCisgICAgICAgICAgICAweEQzLCAweEJBLCAweDAxLCAvKiBzaXplIGFzIHZhcmludCAqLworICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV93cml0dGVuX2J5dGVzIShvX3Byb3QsIGV4cGVjdGVkKTsKKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gbXVzdF9yb3VuZF90cmlwX2xhcmdlX3NpemVkX3NldF9iZWdpbigpIHsKKyAgICAgICAgbGV0IChtdXQgaV9wcm90LCBtdXQgb19wcm90KSA9IHRlc3Rfb2JqZWN0cygpOworCisgICAgICAgIGxldCBpZGVudCA9IFRTZXRJZGVudGlmaWVyOjpuZXcoVFR5cGU6Ok1hcCwgMzkyODQyOSk7CisKKyAgICAgICAgYXNzZXJ0X3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nRpZmllcjo6bmV3KFRUeXBlOjpEb3VibGUsIFRUeXBlOjpJMzIsIDApKSk7CisKKyAgICAgICAgY29weV93cml0ZV9idWZmZXJfdG9fcmVhZF9idWZmZXIhKG9fcHJvdCk7CisKKyAgICAgICAgbGV0IHJlcyA9IGFzc2VydF9zdWNjZXNzIShpX3Byb3QucmVhZF9tYXBfYmVnaW4oKSk7CisgICAgICAgIGFzc2VydF9lcSEoCisgICAgICAgICAgICAmcmVzLAorICAgICAgICAgICAgJlRNYXBJZGVudGlmaWVyIHsKKyAgICAgICAgICAgICAgICBrZXlfdHlwZTogTm9uZSwKKyAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOiBOb25lLAorICAgICAgICAgICAgICAgIHNpemU6IDAsCisgICAgICAgICAgICB9CisgICAgICAgICk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfd3JpdGVfbWFwX2JlZ2luKCkgeworICAgICAgICBsZXQgKF8sIG11dCBvX3Byb3QpID0gdGVzdF9vYmplY3RzKCk7CisKKyAgICAgICAgYXNzZXJ0X3N1Y2Nlc3MhKG9fcHJvdC53cml0ZV9tYXBfYmVnaW4oJlRNYXBJZGVudGlmaWVyOjpuZXcoCisgICAgICAgICAgICBUVHlwZTo6RG91YmxlLAorICAgICAgICAgICAgVFR5cGU6OlN0cmluZywKKyAgICAgICAgICAgIDIzOAorICAgICAgICApKSk7CisKKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDNdID0gWworICAgICAgICAgICAgMHhFRSwgMHgwMSwgLyogc2l6ZSBhcyB2YXJpbnQgKi8KKyAgICAgICAgICAgIDB4NzgsIC8qIGtleSB0eXBlIHwgdmFsIHR5cGUgKi8KKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXFfd3JpdHRlbl9ieXRlcyEob19wcm90LCBleHBlY3RlZCk7CisgICAgfQorCisgICAgI1t0ZXN0XQorICAgIGZuIG11c3Rfcm91bmRfdHJpcF9tYXBfYmVnaW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ltaXQsCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgiY2Fubm90IHBhcnNlIHBhc3Qgezo/fSIsIGZpZWxkX3R5cGUpLAorICAgICAgICAgICAgfSkpOworICAgICAgICB9CisKKyAgICAgICAgbWF0Y2ggZmllbGRfdHlwZSB7CisgICAgICAgICAgICBUVHlwZTo6Qm9vbCA9PiBzZWxmLnJlYWRfYm9vbCgpLm1hcCh8X3wgKCkpLAorICAgICAgICAgICAgVFR5cGU6OkkwOCA9PiBzZWxmLnJlYWRfaTgoKS5tYXAofF98ICgpKSwKKyAgICAgICAgICAgIFRUeXBlOjpJMTYgPT4gc2VsZi5yZWFkX2kxNigpLm1hcCh8X3wgKCkpLAorICAgICAgICAgICAgVFR5cGU6OkkzMiA9PiBzZWxmLnJlYWRfaTMyKCkubWFwKHxffCAoKSksCisgICAgICAgICAgICBUVHlwZTo6STY0ID0+IHNlbGYucmVhZF9pNjQoKS5tYXAofF98ICgpKSwKKyAgICAgICAgICAgIFRUeXBlOjpEb3VibGUgPT4gc2VsZi5yZWFkX2RvdWJsZSgpLm1hcCh8X3wgKCkpLAorICAgICAgICAgICAgVFR5cGU6OlN0cmluZyA9PiBzZWxmLnJlYWRfc3RyaW5nKCkubWFwKHxffCAoKSksCisgICAgICAgICAgICBUVHlwZTo6U3RydWN0ID0+IHsKKyAgICAgICAgICAgICAgICBzZWxmLnJlYWRfc3RydWN0X2JlZ2luKCk/OworICAgICAgICAgICAgICAgIGxvb3AgeworICAgICAgICAgICAgICAgICAgICBsZXQgZmllbGRfaWRlbnQgPSBzZWxmLnJlYWRfZmllbGRfYmVnaW4oKT87CisgICAgICAgICAgICAgICAgICAgIGlmIGZpZWxkX2lkZW50LmZpZWxkX3R5cGUgPT0gVFR5cGU6OlN0b3AgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2VsZi5za2lwX3RpbGxfZGVwdGgoZmllbGRfaWRlbnQuZmllbGRfdHlwZSwgZGVwdGggLSAxKT87CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNlbGYucmVhZF9zdHJ1Y3RfZW5kKCkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFRUeXBlOjpMaXN0ID0+IHsKKyAgICAgICAgICAgICAgICBsZXQgbGlzdF9pZGVudCA9IHNlbGYucmVhZF9saXN0X2JlZ2luKCk/OworICAgICAgICAgICAgICAgIGZvciBfIGluIDAuLmxpc3RfaWRlbnQuc2l6ZSB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2tpcF90aWxsX2RlcHRoKGxpc3RfaWRlbnQuZWxlbWVudF90eXBlLCBkZXB0aCAtIDEpPzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2VsZi5yZWFkX2xpc3RfZW5kKCkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFRUeXBlOjpTZXQgPT4geworICAgICAgICAgICAgICAgIGxldCBzZXRfaWRlbnQgPSBzZWxmLnJlYWRfc2V0X2JlZ2luKCk/OworICAgICAgICAgICAgICAgIGZvciBfIGluIDAuLnNldF9pZGVudC5zaXplIHsKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5za2lwX3RpbGxfZGVwdGgoc2V0X2lkZW50LmVsZW1lbnRfdHlwZSwgZGVwdGggLSAxKT87CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNlbGYucmVhZF9zZXRfZW5kKCkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFRUeXBlOjpNYXAgPT4geworICAgICAgICAgICAgICAgIGxldCBtYXBfaWRlbnQgPSBzZWxmLnJlYWRfbWFwX2JlZ2luKCk/OworICAgICAgICAgICAgICAgIGZvciBfIGluIDAuLm1hcF9pZGVudC5zaXplIHsKKyAgICAgICAgICAgICAgICAgICAgbGV0IGtleV90eXBlID0gbWFwX2lkZW50CisgICAgICAgICAgICAgICAgICAgICAgICAua2V5X3R5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgIC5leHBlY3QoIm5vbi16ZXJvIHNpemVkIG1hcCBzaG91bGQgY29udGFpbiBrZXkgdHlwZSIpOworICAgICAgICAgICAgICAgICAgICBsZXQgdmFsX3R5cGUgPSBtYXBfaWRlbnQKKyAgICAgICAgICAgICAgICAgICAgICAgIC52YWx1ZV90eXBlCisgICAgICAgICAgICAgICAgICAgICAgICAuZXhwZWN0KCJub24temVybyBzaXplZCBtYXAgc2hvdWxkIGNvbnRhaW4gdmFsdWUgdHlwZSIpOworICAgICAgICAgICAgICAgICAgICBzZWxmLnNraXBfdGlsbF9kZXB0aChrZXlfdHlwZSwgZGVwdGggLSAxKT87CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2tpcF90aWxsX2RlcHRoKHZhbF90eXBlLCBkZXB0aCAtIDEpPzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2VsZi5yZWFkX21hcF9lbmQoKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdSA9PiBFcnIoOjpFcnJvcjo6UHJvdG9jb2woUHJvdG9jb2xFcnJvciB7CisgICAgICAgICAgICAgICAga2luZDogUHJvdG9jb2xFcnJvcktpbmQ6OlVua25vd24sCisgICAgICAgICAgICAgICAgbWVzc2FnZTogZm9ybWF0ISgiY2Fubm90IHNraXAgZmllbGQgdHlwZSB7Oj99IiwgJnUpLAorICAgICAgICAgICAgfSkpLAorICAgICAgICB9CisgICAgfQorCisgICAgLy8gdXRpbGl0eSAoRE8gTk9UIFVTRSBJTiBHRU5FUkFURUQgQ09ERSEhISEpCisgICAgLy8KKworICAgIC8vLyBSZWFkIGFuIHVuc2lnbmVkIGJ5dGUuCisgICAgLy8vCisgICAgLy8vIFRoaXMgbWV0aG9kIHNob3VsZCAqKm5ldmVyKiogYmUgdXNlZCBpbiBnZW5lcmF0ZWQgY29kZS4KKyAgICBmbiByZWFkX2J5dGUoJm11dCBzZWxmKSAtPiA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2VfdHlwZSB7CisgICAgICAgICAgICAvLyBGSVhNRTogaXMgdGhlcmUgYSBiZXR0ZXIgd2F5IHRvIG92ZXJyaWRlIGlkZW50aWZpZXIgaGVyZT8KKyAgICAgICAgICAgIFRNZXNzYWdlVHlwZTo6Q2FsbCB8IFRNZXNzYWdlVHlwZTo6T25lV2F5ID0+IHsKKyAgICAgICAgICAgICAgICBsZXQgaWRlbnRpZmllciA9IFRNZXNzYWdlSWRlbnRpZmllciB7CisgICAgICAgICAgICAgICAgICAgIG5hbWU6IGZvcm1hdCEoInt9Ont9Iiwgc2VsZi5zZXJ2aWNlX25hbWUsIGlkZW50aWZpZXIubmFtZSksCisgICAgICAgICAgICAgICAgICAgIC4uKmlkZW50aWZpZXIKKyAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIHNlbGYuaW5uZXIud3JpdGVfbWVzc2FnZV9iZWdpbigmaWRlbnRpZmllcikKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF8gPT4gc2VsZi5pbm5lci53cml0ZV9tZXNzYWdlX2JlZ2luKGlkZW50aWZpZXIpLAorICAgICAgICB9CisgICAgfQorCisgICAgZm4gd3JpdGVfbWVzc2FnZV9lbmQoJm11dCBzZWxmKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBzZWxmLmlubmVyLndyaXRlX21lc3NhZ2VfZW5kKCkKKyAgICB9CisKKyAgICBmbiB3cml0ZV9zdHJ1Y3RfYmVnaW4oJm11dCBzZWxmLCBpZGVudGlmaWVyOiAmVFN0cnVjdElkZW50aWZpZXIpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYuaW5uZXIud3JpdGVfc3RydWN0X2JlZ2luKGlkZW50aWZpZXIpCisgICAgfQorCisgICAgZm4gd3JpdGVfc3RydWN0X2VuZCgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYuaW5uZXIud3JpdGVfc3RydWN0X2VuZCgpCisgICAgfQor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fYmVnaW4oJmlkZW50KSk7CisKKyAgICAgICAgI1tjZmdfYXR0cihydXN0Zm10LCBydXN0Zm10Ojpza2lwKV0KKyAgICAgICAgbGV0IGV4cGVjdGVkOiBbdTg7IDE5XSA9IFsKKyAgICAgICAgICAgIDB4ODAsCisgICAgICAgICAgICAweDAxLCAvKiBwcm90b2NvbCBpZGVudGlmaWVyICovCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMSwgLyogbWVzc2FnZSB0eXBlICovCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDA3LAorICAgICAgICAgICAgMHg2NiwKKyAgICAgICAgICAgIDB4NkYsCisgICAgICAgICAgICAweDZGLCAvKiAiZm9vIiAqLworICAgICAgICAgICAgMHgzQSwgLyogIjoiICovCisgICAgICAgICAgICAweDYyLAorICAgICAgICAgICAgMHg2MSwKKyAgICAgICAgICAgIDB4NzIsIC8qICJiYXIiICovCisgICAgICAgICAgICAweDAwLAorICAgICAgICAgICAgMHgwMCwKKyAgICAgICAgICAgIDB4MDAsCisgICAgICAgICAgICAweDAyIC8qIHNlcXVlbmNlIG51bWJlciAqLywKKyAgICAgICAgXTsKKworICAgICAgICBhc3NlcnRfZXEhKG9fcHJvdC5pbm5lci50cmFuc3BvcnQud3JpdGVfYnl0ZXMoKSwgZXhwZWN0ZWQpOworICAgIH0KKworICAgIGZuIHRlc3Rfb2JqZWN0cygpIC0+IFRNdWx0aXBsZXhlZE91dHB1dFByb3RvY29sPFRCaW5hcnlPdXRwdXRQcm90b2NvbDxXcml0ZUhhbGY8VEJ1ZmZlckNoYW5uZWw+Pj4KKyAgICB7CisgICAgICAgIGxldCBjID0gVEJ1ZmZlckNoYW5uZWw6OndpdGhfY2FwYWNpdHkoNDAsIDQwKTsKKyAgICAgICAgbGV0IChfLCB3X2NoYW4pID0gYy5zcGxpdCgpLnVud3JhcCgpOworICAgICAgICBsZXQgcH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AvLy8gd2l0aCBzZXJ2aWNlIG5hbWUgc3RyaXBwZWQgLSB0aGF0IHdpbGwgYmUgcGFzc2VkIHRvCisgICAgLy8vIGB3cmFwcGVkLnJlYWRfbWVzc2FnZV9iZWdpbiguLi4pYC4KKyAgICBwdWIgZm4gbmV3KAorICAgICAgICB3cmFwcGVkOiAmbXV0IFRJbnB1dFByb3RvY29sLAorICAgICAgICBtZXNzYWdlX2lkZW50OiBUTWVzc2FnZUlkZW50aWZpZXIsCisgICAgKSAtPiBUU3RvcmVkSW5wdXRQcm90b2NvbCB7CisgICAgICAgIFRTdG9yZWRJbnB1dFByb3RvY29sIHsKKyAgICAgICAgICAgIGlubmVyOiB3cmFwcGVkLAorICAgICAgICAgICAgbWVzc2FnZV9pZGVudDogbWVzc2FnZV9pZGVudC5pbnRvKCksCisgICAgICAgIH0KKyAgICB9Cit9CisKK2ltcGw8J2E+IFRJbnB1dFByb3RvY29sIGZvciBUU3RvcmVkSW5wdXRQcm90b2NvbDwnYT4geworICAgIGZuIHJlYWRfbWVzc2FnZV9iZWdpbigmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PFRNZXNzYWdlSWRlbnRpZmllcj4geworICAgICAgICBzZWxmLm1lc3NhZ2VfaWRlbnQudGFrZSgpLm9rX29yX2Vsc2UofHwgeworICAgICAgICAgICAgOjplcnJvcnM6Om5ld19wcm90b2NvbF9lcnJvcigKKyAgICAgICAgICAgICAgICBQcm90b2NvbEVycm9yS2luZDo6VW5rbm93biwKKyAgICAgICAgICAgICAgICAibWVzc2FnZSBpZGVudGlmaWVyIGFscmVhZHkgcmVhZCIsCisgICAgICAgICAgICApCisgICAgICAgIH0pCisgICAgfQorCisgICAgZm4gcmVhZF9tZXNzYWdlX2VuZCgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYuaW5uZXIucmVhZF9tZXNzYWdlX2VuZCgpCisgICAgfQorCisgICAgZm4gcmVhZF9zdHJ1Y3RfYmVna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NlcnZpY2VfbmFtZS5pbnRvKCk7CisgICAgICAgIGlmICFzdG9yZWQucHJvY2Vzc29ycy5jb250YWluc19rZXkoJm5hbWUpIHsKKyAgICAgICAgICAgIGxldCBwcm9jZXNzb3IgPSBBcmM6Om5ldyhwcm9jZXNzb3IpOworCisgICAgICAgICAgICBpZiBhc19kZWZhdWx0IHsKKyAgICAgICAgICAgICAgICBpZiBzdG9yZWQuZGVmYXVsdF9wcm9jZXNzb3IuaXNfbm9uZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgc3RvcmVkLnByb2Nlc3NvcnMuaW5zZXJ0KG5hbWUsIHByb2Nlc3Nvci5jbG9uZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgc3RvcmVkLmRlZmF1bHRfcHJvY2Vzc29yID0gU29tZShwcm9jZXNzb3IuY2xvbmUoKSk7CisgICAgICAgICAgICAgICAgICAgIE9rKCgpKQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIEVycigiY2Fubm90IHJlc2V0IGRlZmF1bHQgcHJvY2Vzc29yIi5pbnRvKCkpCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBzdG9yZWQucHJvY2Vzc29ycy5pbnNlcnQobmFtZSwgcHJvY2Vzc29yKTsKKyAgICAgICAgICAgICAgICBPaygoKSkKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEVycihmb3JtYXQhKCJjYW5ub3Qgb3ZlcndyaXRlIGV4aXN0aW5nIHByb2Nlc3NvciBmb3Igc2VydmljZSB7fSIsIG5hbWUpLmludG8oKSkKKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIHByb2Nlc3NfbWVzc2FnZSgKKyAgICAgICAgJnNlbGYsCisgICAgICAgIG1zZ19pZGVudDogJlRNZXNzYWdlSWRlbnRpZmllciwKKyAgICAgICAgaV9wcm90OiAmbXV0IFRJbnB1dFByb3RvY29sLAorICAgICAgICBvX3Byb3Q6ICZtdXQgVE91dHB1dFByb3RvY29sLAorICAgICkgLT4gOjpSZXN1bHQ8KCk+IHsKKyAgICAgICAgbGV0IChzdmNfbmFtZSwgc3ZjX2NhbGwpID0gc3BsaXRfaWRlbnRfbmFtZSgmbXNnX2lkZW50Lm5hbWUpOworICAgICAgICBkZWJ1ZyEoInJvdXRpbmcgc3ZjX25hbWUgezo/fSBzdmNfY2FsbCB7fSIsICZzdmNfbmFtZSwgJnN2Y19jYWxsKTsKKworICAgICAgICBsZXQgcHJvY2Vzc29yOiBPcHRpb248QXJjPFRocmVhZFNhZmVQcm9jZXNzb3I+PiA9IHsKKyAgICAgICAgICAgIGxldCBzdG9yZWQgPSBzZWxmLnN0b3JlZC5sb2NrKCkudW53cmFwKCk7CisgICAgICAgICAgICBpZiBsZXQgU29tZShuYW1lKSA9IHN2Y19uYW1lIHsKKyAgICAgICAgICAgICAgICBzdG9yZWQucHJvY2Vzc29ycy5nZXQobmFtZSkuY2xvbmVkKCkKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3RvcmVkLmRlZmF1bHRfcHJvY2Vzc29yLmNsb25lKCkKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworICAgICAgICBtYXRjaCBwcm9jZXNzb3IgeworICAgICAgICAgICAgU29tZShhcmMpID0+IHsKKyAgICAgICAgICAgICAgICBsZXQgbmV3X21zZ19pZGVudCA9IFRNZXNzYWdlSWRlbnRpZmllcjo6bmV3KAorICAgICAgICAgICAgICAgICAgICBzdmNfY2FsbCwKKyAgICAgICAgICAgICAgICAgICAgbXNnX2lkZW50Lm1lc3NhZ2VfdHlwZSwKKyAgICAgICAgICAgICAgICAgICAgbXNnX2lkZW50LnNlcXVlbmNlX251bWJlciwKKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgICAgIGxldCBtdXQgcHJveHlfaV9wcm90ID0gVFN0b3JlZElucHV0UHJvdG9jb2w6Om5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XVsdDogezo/fSB9fSIsCisgICAgICAgICAgICBzdG9yZWQucHJvY2Vzc29ycy5rZXlzKCkubGVuKCksCisgICAgICAgICAgICBzdG9yZWQuZGVmYXVsdF9wcm9jZXNzb3IuaXNfc29tZSgpCisgICAgICAgICkKKyAgICB9Cit9CisKK2ZuIHNwbGl0X2lkZW50X25hbWUoaWRlbnRfbmFtZTogJnN0cikgLT4gKE9wdGlvbjwmc3RyPiwgJnN0cikgeworICAgIGlkZW50X25hbWUKKyAgICAgICAgLmZpbmQoJzonKQorICAgICAgICAubWFwKHxwb3N8IHsKKyAgICAgICAgICAgIGxldCAoc3ZjX25hbWUsIHN2Y19jYWxsKSA9IGlkZW50X25hbWUuc3BsaXRfYXQocG9zKTsKKyAgICAgICAgICAgIGxldCAoXywgc3ZjX2NhbGwpID0gc3ZjX2NhbGwuc3BsaXRfYXQoMSk7IC8vIHJlbW92ZSBjb2xvbiBmcm9tIHNlcnZpY2UgY2FsbCBuYW1lCisgICAgICAgICAgICAoU29tZShzdmNfbmFtZSksIHN2Y19jYWxsKQorICAgICAgICB9KQorICAgICAgICAub3JfZWxzZSh8fCBTb21lKChOb25lLCBpZGVudF9uYW1lKSkpCisgICAgICAgIC51bndyYXAoKQorfQorCitmbiBtaXNzaW5nX3Byb2Nlc3Nvcl9tZXNzYWdlKHN2Y19uYW1lOiBPcHRpb248JnN0cj4pIC0+IFN0cmluZyB7CisgICAgbWF0Y2ggc3ZjX25hbWUgeworICAgICAgICBTb21lKG5hbWUpID0+IGZvcm1hdCEoIm5vIHByb2Nlc3NvciBmb3VuZCBmb3Igc2VydmljZSB7fSIsIG5hbWUpLAorICAgICAgICBOb25lID0+IE1JU1NJTkdfU0VQQVJBVE9SX0FORF9OT19ERUZBVUxULnRvX293bmVkKCksCisgICAgfQorfQorCisjW2NmZyh0ZXN0KV0KK21vZCB0ZXN0cyB7CisgICAgdXNlIHN0ZDo6Y29udmVydDo6SW50bzsKKyAgICB1c2Ugc3RkOjpzeW5jOjphd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KyAgICAgICAgaS50cmFuc3BvcnQuc2V0X3JlYWRhYmxlX2J5dGVzKCZvLnRyYW5zcG9ydC53cml0ZV9ieXRlcygpKTsKKyAgICAgICAgbGV0IHJjdmRfaWRlbnQgPSBpLnJlYWRfbWVzc2FnZV9iZWdpbigpLnVud3JhcCgpOworICAgICAgICBsZXQgZXhwZWN0ZWRfaWRlbnQgPSBUTWVzc2FnZUlkZW50aWZpZXI6Om5ldygibWlzc2luZzpjYWxsIiwgVE1lc3NhZ2VUeXBlOjpFeGNlcHRpb24sIDEwKTsKKyAgICAgICAgYXNzZXJ0X2VxIShyY3ZkX2lkZW50LCBleHBlY3RlZF9pZGVudCk7CisgICAgICAgIGxldCByY3ZkX2VyciA9IDo6RXJyb3I6OnJlYWRfYXBwbGljYXRpb25fZXJyb3JfZnJvbV9pbl9wcm90b2NvbCgmbXV0IGkpLnVud3JhcCgpOworICAgICAgICBsZXQgZXhwZWN0ZWRfZXJyID0gQXBwbGljYXRpb25FcnJvcjo6bmV3KAorICAgICAgICAgICAgQXBwbGljYXRpb25FcnJvcktpbmQ6OlVua25vd24sCisgICAgICAgICAgICBtaXNzaW5nX3Byb2Nlc3Nvcl9tZXNzYWdlKFNvbWUoIm1pc3NpbmciKSksCisgICAgICAgICk7CisgICAgICAgIGFzc2VydF9lcSEocmN2ZF9lcnIsIGV4cGVjdGVkX2Vycik7CisgICAgfQorCisgICAgI1tkZXJpdmUoRGVmYXVsdCldCisgICAgc3RydWN0IFNlcnZpY2UgeworICAgICAgICBwdWIgaW52b2tlZDogQXJjPEF0b21pY0Jvb2w+LAorICAgIH0KKworICAgIGltcGwgVFByb2Nlc3NvciBmb3IgU2VydmljZSB7CisgICAgICAgIGZuIHByb2Nlc3MoJnNlbGYsIF86ICZtdXQgVElucHV0UHJvdG9jb2wsIF86ICZtdXQgVE91dHB1dFByb3RvY29sKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICAgICAgbGV0IHJlcyA9IHNlbGYKKyAgICAgICAgICAgICAgICAuaW52b2tlZAorICAgICAgICAgICAgICAgIC5jb21wYXJlX2FuZF9zd2FwKGZhbHNlLCB0cnVlLCBPcmRlcmluZzo6UmVsYXhlZCk7CisgICAgICAgICAgICBpZiByZXMgeworICAgICAgICAgICAgICAgIE9rKCgpKQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBFcnIoImZhaWxlZCBzd2FwIi5pbnRvKCkpCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAjW3Rlc3RdCisgICAgZm4gc2hvdWxkX3JvdXRlX2NhbGxfdG9fY29ycmVjdF9wcm9jZXNzb3IoKSB7CisgICAgICAgIGxldCAobXV0IGksIG11dCBvKSA9IGJ1aWxkX29iamVjdHMoKTsKKworICAgICAgICAvLyBidWlsZCB0aGUgc2VydmljZXMKKyAgICAgICAgbGV0IHN2Y18xID0gU2VydmljZSB7CisgICAgICAgICAgICBpbnZva2VkOiBBcmM6Om5ldyhBdG9taWNCb29sOjpuZXcoZmFsc2UpKSwKKyAgICAgICAgfTsKKyAgICAgICAgbGV0IGF0bV8xID0gc3ZjXzEuaW52b2tlZC5jbG9uZSgpOworICAgICAgICBsZXQgc3ZjXzIgPSBTZXJ2aWNlIHsKKyAgICAgICAgICAgIGludm9rZWQ6IEFyYzo6bmV3KEF0b21pY0Jvb2w6Om5ldyhmYWxzZSkpLAorICAgICAgICB9OworICAgICAgICBsZXQgYXRtXzIgPSBzdmNfMi5pbnZva2VkLmNsb25lKCk7CisKKyAgICAgICAgLy8gcmVnaXN0ZXIgdGhlbQorICAgICAgICBsZXQgbXV0IHAgPSBUTXVsdGlwbGV4ZWRQcm9jZXNzb3I6Om5ldygpOworICAgICAgICBwLnJlZ2lzdGVyKCJzZXJ2aWNlXzEiLCBCb3g6Om5ldyhzdmNfMSksIGZhbHNlKS51bndyYXAoKTsKKyAgICAgICAgcC5yZWdpc3Rlcigic2VydmljZV8yIiwgQm94OjpuZXcoc3ZjXzIpLCB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90cmFuc3BvcnRfZmFjdG9yeTogUlRGLAorICAgICAgICBpbnB1dF9wcm90b2NvbF9mYWN0b3J5OiBJUEYsCisgICAgICAgIHdyaXRlX3RyYW5zcG9ydF9mYWN0b3J5OiBXVEYsCisgICAgICAgIG91dHB1dF9wcm90b2NvbF9mYWN0b3J5OiBPUEYsCisgICAgICAgIHByb2Nlc3NvcjogUFJDLAorICAgICAgICBudW1fd29ya2VyczogdXNpemUsCisgICAgKSAtPiBUU2VydmVyPFBSQywgUlRGLCBJUEYsIFdURiwgT1BGPiB7CisgICAgICAgIFRTZXJ2ZXIgeworICAgICAgICAgICAgcl90cmFuc19mYWN0b3J5OiByZWFkX3RyYW5zcG9ydF9mYWN0b3J5LAorICAgICAgICAgICAgaV9wcm90b19mYWN0b3J5OiBpbnB1dF9wcm90b2NvbF9mYWN0b3J5LAorICAgICAgICAgICAgd190cmFuc19mYWN0b3J5OiB3cml0ZV90cmFuc3BvcnRfZmFjdG9yeSwKKyAgICAgICAgICAgIG9fcHJvdG9fZmFjdG9yeTogb3V0cHV0X3Byb3RvY29sX2ZhY3RvcnksCisgICAgICAgICAgICBwcm9jZXNzb3I6IEFyYzo6bmV3KHByb2Nlc3NvciksCisgICAgICAgICAgICB3b3JrZXJfcG9vbDogVGhyZWFkUG9vbDo6d2l0aF9uYW1lKCJUaHJpZnQgc2VydmljZSBwcm9jZXNzb3IiLnRvX293bmVkKCksIG51bV93b3JrZXJzKSwKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vLyBMaXN0ZW4gZm9yIGluY29taW5nIGNvbm5lY3Rpb25zIG9uIGBsaXN0ZW5fYWRkcmVzc2AuCisgICAgLy8vCisgICAgLy8vIGBsaXN0ZW5fYWRkcmVzc2Agc2hvdWxkIGJlIGluIHRoZSBmb3JtIGBob3N0OnBvcnRgLAorICAgIC8vLyBmb3IgZXhhbXBsZTogYDEyNy4wLjAuMTo4MDgwYC4KKyAgICAvLy8KKyAgICAvLy8gUmV0dXJuIGAoKWAgaWYgc3VjY2Vzc2Z1bC4KKyAgICAvLy8KKyAgICAvLy8gUmV0dXJuIGBFcnJgIHdoZW4gdGhlIHNlcnZlciBjYW5ub3QgYmluZCB0byBgbGlzdGVuX2FkZHJlc3NgIG9yIHRoZXJlCisgICAgLy8vIGlzIGFuIHVucmVjb3ZlcmFibGUgZXJyb3IuCisgICAgcHViIGZuIGxpc3RlbigmbXV0IHNlbGYsIGxpc3Rlbl9hZGRyZXNzOiAmc3RyKSAtPiA6OlJlc3VsdDwoKT4geworICAgICAgICBsZXQgbGlzdGVuZXIgPSBUY3BMaXN0ZW5lcjo6YmluZChsaXN0ZW5fYWRkcmVzcyk/OworICAgICAgICBmb3Igc3RyZWFtIGluIGxpc3RlbmVyLmluY29taW5nKCkgeworICAgICAgICAgICAgbWF0Y2ggc3RyZWFtIHsKKyAgICAgICAgICAgICAgICBPayhzKSA9PiB7CisgICAgICAgICAgICAgICAgICAgIGxldCAoaV9wcm90LCBvX3Byb3QpID0gc2VsZi5uZXdfcHJvdG9jb2xzX2Zvcl9jb25uZWN0aW9uKHMpPzsKKyAgICAgICAgICAgICAgICAgICAgbGV0IHByb2Nlc3NvciA9IHNlbGYucHJvY2Vzc29yLmNsb25lKCk7CisgICAgICAgICAgICAgICAgICAgIHNlbGYud29ya2VyX3Bvb2wKKyAgICAgICAgICAgICAgICAgICAgICAgIC5leGVjdXRlKG1vdmUgfHwgaGFuZGxlX2luY29taW5nX2Nvbm5lY3Rpb24ocHJvY2Vzc29yLCBpX3Byb3QsIG9fcHJvdCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBFcnIoZSkgPT4geworICAgICAgICAgICAgICAgICAgICB3YXJuISgiZmFpbGVkIHRvIGFjY2VwdCByZW1vdGUgY29ubmVjdGlvbiB3aXRoIGVycm9yIHs6P30iLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBFcnIoOjpFcnJvcjo6QXBwbG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W4oc2VsZi5jYXAsIHNlbGYucG9zICsgY29uc3VtZWQpOworICAgIH0KK30KKworaW1wbDxDPiBSZWFkIGZvciBUQnVmZmVyZWRSZWFkVHJhbnNwb3J0PEM+Cit3aGVyZQorICAgIEM6IFJlYWQsCit7CisgICAgZm4gcmVhZCgmbXV0IHNlbGYsIGJ1ZjogJm11dCBbdThdKSAtPiBpbzo6UmVzdWx0PHVzaXplPiB7CisgICAgICAgIGxldCBtdXQgYnl0ZXNfcmVhZCA9IDA7CisKKyAgICAgICAgbG9vcCB7CisgICAgICAgICAgICBsZXQgbnJlYWQgPSB7CisgICAgICAgICAgICAgICAgbGV0IGF2YWlsX2J5dGVzID0gc2VsZi5nZXRfYnl0ZXMoKT87CisgICAgICAgICAgICAgICAgbGV0IGF2YWlsX3NwYWNlID0gYnVmLmxlbigpIC0gYnl0ZXNfcmVhZDsKKyAgICAgICAgICAgICAgICBsZXQgbnJlYWQgPSBjbXA6Om1pbihhdmFpbF9zcGFjZSwgYXZhaWxfYnl0ZXMubGVuKCkpOworICAgICAgICAgICAgICAgIGJ1ZltieXRlc19yZWFkLi4oYnl0ZXNfcmVhZCArIG5yZWFkKV0uY29weV9mcm9tX3NsaWNlKCZhdmFpbF9ieXRlc1suLm5yZWFkXSk7CisgICAgICAgICAgICAgICAgbnJlYWQKKyAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgIHNlbGYuY29uc3VtZShucmVhZCk7CisgICAgICAgICAgICBieXRlc19yZWFkICs9IG5yZWFkOworCisgICAgICAgICAgICBpZiBieXRlc19yZWFkID09IGJ1Zi5sZW4oKSB8fCBucmVhZCA9PSAwIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIE9rKGJ5dGVzX3JlYWQpCisgICAgfQorfQorCisvLy8gRmFjdG9yeSBmb3IgY3JlYXRpbmcgaW5zdGFuY2VzIG9mIGBUQnVmZmVyZWRSZWFkVHJhbnNwb3J0YC4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it7CisgICAgZm4gd3JpdGUoJm11dCBzZWxmLCBidWY6ICZbdThdKSAtPiBpbzo6UmVzdWx0PHVzaXplPiB7CisgICAgICAgIGlmICFidWYuaXNfZW1wdHkoKSB7CisgICAgICAgICAgICBsZXQgbXV0IGF2YWlsX2J5dGVzOworCisgICAgICAgICAgICBsb29wIHsKKyAgICAgICAgICAgICAgICBhdmFpbF9ieXRlcyA9IGNtcDo6bWluKGJ1Zi5sZW4oKSwgc2VsZi5jYXAgLSBzZWxmLmJ1Zi5sZW4oKSk7CisKKyAgICAgICAgICAgICAgICBpZiBhdmFpbF9ieXRlcyA9PSAwIHsKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5mbHVzaCgpPzsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGxldCBhdmFpbF9ieXRlcyA9IGF2YWlsX2J5dGVzOworCisgICAgICAgICAgICBzZWxmLmJ1Zi5leHRlbmRfZnJvbV9zbGljZSgmYnVmWy4uYXZhaWxfYnl0ZXNdKTsKKyAgICAgICAgICAgIGFzc2VydCEoc2VsZi5idWYubGVuKCkgPD0gc2VsZi5jYXAsICJjb3B5IG92ZXJmbG93ZWQgYnVmZmVyIik7CisKKyAgICAgICAgICAgIE9rKGF2YWlsX2J5dGVzKQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgT2soMCkKKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIGZsdXNoKCZtdXQgc2VsZikgLT4gaW86OlJlc3VsdDwoKT4geworICAgICAgICBzZWxmLmNoYW5uZWwud3JpdGVfYWxsKCZzZWxmLmJ1Zik/OworICAgICAgICBzZWxmLmNoYW5uZWwuZmx1c2goKT87CisgICAgICAgIHNlbGYuYnVmLmNsZWFyKCk7CisgICAgICAgIE9rKCgpKQorICAgIH0KK30KKworLy8vIEZhY3RvcnkgZm9yIGNyZWF0a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ICAgdC5jaGFuLnNldF9yZWFkYWJsZV9ieXRlcygmWworICAgICAgICAgICAgMHgwMCwgMHgwMCwgMHgwMCwgMHgwNCwgLyogbWVzc2FnZSBzaXplICovCisgICAgICAgICAgICAweDAwLCAweDAxLCAweDAyLCAweDAzLCAvKiBtZXNzYWdlIGJvZHkgKi8KKyAgICAgICAgXSk7CisKKyAgICAgICAgbGV0IG11dCBidWYgPSB2ZWMhWzA7IDhdOworCisgICAgICAgIC8vIHdlJ3ZlIHJlYWQgZXhhY3RseSA0IGJ5dGVzCisgICAgICAgIGFzc2VydF9lcSEodC5yZWFkKCZtdXQgYnVmKS51bndyYXAoKSwgNCk7CisgICAgICAgIGFzc2VydF9lcSEoJmJ1ZiwgJlsweDAwLCAweDAxLCAweDAyLCAweDAzLCAweDAwLCAweDAwLCAweDAwLCAweDAwXSk7CisKKyAgICAgICAgLy8KKyAgICAgICAgLy8gMm5kIG1lc3NhZ2UKKyAgICAgICAgLy8KKworICAgICAgICB0LmNoYW4uc2V0X3JlYWRhYmxlX2J5dGVzKCZbCisgICAgICAgICAgICAweDAwLCAweDAwLCAweDAwLCAweDAxLCAvKiBtZXNzYWdlIHNpemUgKi8KKyAgICAgICAgICAgIDB4MDQsIC8qIG1lc3NhZ2UgYm9keSAqLworICAgICAgICBdKTsKKworICAgICAgICBsZXQgbXV0IGJ1ZiA9IHZlYyFbMDsgOF07CisKKyAgICAgICAgLy8gd2UndmUgcmVhZCBleGFjdGx5IDEgYnl0ZQorICAgICAgICBhc3NlcnRfZXEhKHQucmVhZCgmbXV0IGJ1ZikudW53cmFwKCksIDEpOworICAgICAgICBhc3NlcnRfZXEhKCZidWYsICZbMHgwNCwgMHgwMCwgMHgwMCwgMHgwMCwgMHgwMCwgMHgwMCwgMHgwMCwgMHgwMF0pOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3dyaXRlX21lc3NhZ2Vfc21hbGxlcl90aGFuX2J1ZmZlcl9zaXplKCkgeworICAgICAg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IGNob2ljZSB0aGFuCisgICAgICAgIC8vIHNpbXBseSByZXNpemluZyB0aGUgYnVmZmVyIHRvIGIubGVuKCkKKworICAgICAgICBsZXQgbXV0IHQgPSBURnJhbWVkV3JpdGVUcmFuc3BvcnQ6OndpdGhfY2FwYWNpdHkoMiwgbWVtKTsKKyAgICAgICAgbGV0IGIgPSBbMHgwMCwgMHgwMSwgMHgwMl07CisKKyAgICAgICAgLy8gc2hvdWxkIGhhdmUgd3JpdHRlbiAzIGJ5dGVzCisgICAgICAgIGFzc2VydF9lcSEodC53cml0ZSgmYikudW53cmFwKCksIDMpOworICAgICAgICBhc3NlcnRfZXFfdHJhbnNwb3J0X251bV93cml0dGVuX2J5dGVzISh0LCAwKTsKKworICAgICAgICBhc3NlcnQhKHQuZmx1c2goKS5pc19vaygpKTsKKworICAgICAgICBsZXQgZXhwZWN0ZWRfYnl0ZXMgPSBbCisgICAgICAgICAgICAweDAwLCAweDAwLCAweDAwLCAweDAzLCAvKiBtZXNzYWdlIHNpemUgKi8KKyAgICAgICAgICAgIDB4MDAsIDB4MDEsIDB4MDIsIC8qIG1lc3NhZ2UgYm9keSAqLworICAgICAgICBdOworCisgICAgICAgIGFzc2VydF9lcV90cmFuc3BvcnRfd3JpdHRlbl9ieXRlcyEodCwgZXhwZWN0ZWRfYnl0ZXMpOworICAgIH0KKworICAgICNbdGVzdF0KKyAgICBmbiBtdXN0X3JldHVybl9lcnJvcl9pZl9ub3RoaW5nX2Nhbl9iZV93cml0dGVuX3RvX2lubmVyX3RyYW5zcG9ydF9vbl9mbHVzaCgpIHsKKyAgICAgICAgbGV0IG1lbSA9IFRCdWZmZXJDaGFubmVsOjp3aXRoX2NhcGFjaXR5KDAsIDApOworICAgICAgICBsZXQgbXV0IHQgPSBURnJhbWVkV3JpdGVUcmFuc3BvcnQ6OndpdGhfY2FwYWNpdHkoMSwgbWVtKTsKKworICAgICAgICBsZXQgYiA9IHZlYyFbMDsgMTBdOworCisgICAgICAgIC8vIHNob3Vs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2RhdGEuYnVmWy4ud2RhdGEucG9zXTsKKyAgICAgICAgICAgIGxldCBtdXQgYl9yZXQgPSB2ZWMhWzA7IGIubGVuKCldOworICAgICAgICAgICAgYl9yZXQuY29weV9mcm9tX3NsaWNlKGIpOworICAgICAgICAgICAgYl9yZXQKKyAgICAgICAgfTsKKworICAgICAgICBsZXQgYnl0ZXNfY29waWVkID0gc2VsZi5zZXRfcmVhZGFibGVfYnl0ZXMoJmJ1Zik7CisgICAgICAgIGFzc2VydF9lcSEoYnl0ZXNfY29waWVkLCBidWYubGVuKCkpOworCisgICAgICAgIHNlbGYuZW1wdHlfd3JpdGVfYnVmZmVyKCk7CisgICAgfQorfQorCitpbXBsIFRJb0NoYW5uZWwgZm9yIFRCdWZmZXJDaGFubmVsIHsKKyAgICBmbiBzcGxpdChzZWxmKSAtPiA6OlJlc3VsdDwoUmVhZEhhbGY8U2VsZj4sIFdyaXRlSGFsZjxTZWxmPik+CisgICAgd2hlcmUKKyAgICAgICAgU2VsZjogU2l6ZWQsCisgICAgeworICAgICAgICBPaygoCisgICAgICAgICAgICBSZWFkSGFsZiB7CisgICAgICAgICAgICAgICAgaGFuZGxlOiBUQnVmZmVyQ2hhbm5lbCB7CisgICAgICAgICAgICAgICAgICAgIHJlYWQ6IHNlbGYucmVhZC5jbG9uZSgpLAorICAgICAgICAgICAgICAgICAgICB3cml0ZTogc2VsZi53cml0ZS5jbG9uZSgpLAorICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICB9LAorICAgICAgICAgICAgV3JpdGVIYWxmIHsKKyAgICAgICAgICAgICAgICBoYW5kbGU6IFRCdWZmZXJDaGFubmVsIHsKKyAgICAgICAgICAgICAgICAgICAgcmVhZDogc2VsZi5yZWFkLmNsb25lKCksCisgICAgICAgICAgICAgICAgICAgIHdyaXRlOiBzZWxmLndyaXRlLmNsb25lKCksCisgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIH0sCisgICAgICAgICkpCisgICAgfQorfQorCitpbXBs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X3VudGlsX2FsbF9ieXRlc19yZWFkKCkgeworICAgICAgICBsZXQgbXV0IHQgPSBUQnVmZmVyQ2hhbm5lbDo6d2l0aF9jYXBhY2l0eSgxMCwgMCk7CisKKyAgICAgICAgbGV0IHJlYWRhYmxlX2J5dGVzOiBbdTg7IDEwXSA9IFsweEZGLCAweEVFLCAweERELCAweENDLCAweEJCLCAweDAwLCAweDFBLCAweDJCLCAweDNDLCAweDREXTsKKworICAgICAgICAvLyBjaGVjayB0aGF0IHdlJ3JlIGFibGUgdG8gc2V0IHRoZSBieXRlcyB0byBiZSByZWFkCisgICAgICAgIGxldCByZXN1bHQgPSB0LnNldF9yZWFkYWJsZV9ieXRlcygmcmVhZGFibGVfYnl0ZXMpOworICAgICAgICBhc3NlcnRfZXEhKHJlc3VsdCwgMTApOworICAgICAgICBhc3NlcnRfZXEhKHQucmVhZF9ieXRlcygpLCAmcmVhZGFibGVfYnl0ZXMpOworCisgICAgICAgIC8vIGZpcnN0IHJlYWQKKyAgICAgICAgbGV0IG11dCByZWFkX2J1Zl8wID0gdmVjIVswOyA1XTsKKyAgICAgICAgbGV0IHJlYWRfcmVzdWx0ID0gdC5yZWFkKCZtdXQgcmVhZF9idWZfMCk7CisgICAgICAgIGFzc2VydF9lcSEocmVhZF9yZXN1bHQudW53cmFwKCksIDUpOworICAgICAgICBhc3NlcnRfZXEhKHJlYWRfYnVmXzAuYXNfc2xpY2UoKSwgJihyZWFkYWJsZV9ieXRlc1swLi41XSkpOworCisgICAgICAgIC8vIHNlY29uZCByZWFkCisgICAgICAgIGxldCBtdXQgcmVhZF9idWZfMSA9IHZlYyFbMDsgNF07CisgICAgICAgIGxldCByZWFkX3Jlc3VsdCA9IHQucmVhZCgmbXV0IHJlYWRfYnVmXzEpOworICAgICAgICBhc3NlcnRfZXEhKHJlYWRfcmVzdWx0LnVud3JhcCgpLCA0KTsKKyAgICAgICAgYXNzZXJ0X2VxIShyZWFkX2J1Zl8xLmFzX3NsaWNlKCksICYocmVhZ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ICAgICAgICAgICAidGNwIGNvbm5lY3Rpb24gcHJldmlvdXNseSBvcGVuZWQiLAorICAgICAgICAgICAgKSkKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1hdGNoIFRjcFN0cmVhbTo6Y29ubmVjdCgmcmVtb3RlX2FkZHJlc3MpIHsKKyAgICAgICAgICAgICAgICBPayhzKSA9PiB7CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc3RyZWFtID0gU29tZShzKTsKKyAgICAgICAgICAgICAgICAgICAgT2soKCkpCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIEVycihlKSA9PiBFcnIoRnJvbTo6ZnJvbShlKSksCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLy8gU2h1dCBkb3duIHRoaXMgY2hhbm5lbC4KKyAgICAvLy8KKyAgICAvLy8gQm90aCBzZW5kIGFuZCByZWNlaXZlIGhhbHZlcyBhcmUgY2xvc2VkLCBhbmQgdGhpcyBpbnN0YW5jZSBjYW4gbm8KKyAgICAvLy8gbG9uZ2VyIGJlIHVzZWQgdG8gY29tbXVuaWNhdGUgd2l0aCBhbm90aGVyIGVuZHBvaW50LgorICAgIHB1YiBmbiBjbG9zZSgmbXV0IHNlbGYpIC0+IDo6UmVzdWx0PCgpPiB7CisgICAgICAgIHNlbGYuaWZfc2V0KHxzfCBzLnNodXRkb3duKFNodXRkb3duOjpCb3RoKSkKKyAgICAgICAgICAgIC5tYXBfZXJyKEZyb206OmZyb20pCisgICAgfQorCisgICAgZm4gaWZfc2V0PEYsIFQ+KCZtdXQgc2VsZiwgbXV0IHN0cmVhbV9vcGVyYXRpb246IEYpIC0+IGlvOjpSZXN1bHQ8VD4KKyAgICB3aGVyZQorICAgICAgICBGOiBGbk11dCgmbXV0IFRjcFN0cmVhbSkgLT4gaW86OlJlc3VsdDxUPiwKKyAgICB7CisgICAgICAgIGlmIGxldCBTb21lKHJlZiBtdXQgcykgPSBzZWxmLnN0cmVhbSB7CisgICAgICAgICAgICBzdHJlYW1fb3BlcmF0aW9uKHMpCisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBFcnIoaW86OkVycm9yOjpuZXcoCisgICAgICAgICAgICAgICAgRXJyb3JLaW5kOjpOb3RDb25uZWN0ZWQsCisgICAgICAgICAgICAgICAgInRjcCBlbmRwb2ludCBub3QgY29ubmVjdGVkIiwKKyAgICAgICAgICAgICkpCisgICAgICAgIH0KKyAgICB9Cit9CisKK2ltcGwgVElvQ2hhbm5lbCBmb3IgVFRjcENoYW5uZWwgeworICAgIGZuIHNwbGl0KHNlbGYpIC0+IDo6UmVzdWx0PChSZWFkSGFsZjxTZWxmPiwgV3JpdGVIYWxmPFNlbGY+KT4KKyAgICB3aGVyZQorICAgICAgICBTZWxmOiBTaXplZCwKKyAgICB7CisgICAgICAgIGxldCBtdXQgcyA9IHNlbGY7CisKKyAgICAgICAgcy5zdHJlYW0KKyAgICAgICAgICAgIC5hc19tdXQoKQorICAgICAgICAgICAgLmFuZF90aGVuKHxzfCBzLnRyeV9jbG9uZSgpLm9rKCkpCisgICAgICAgICAgICAubWFwKHxjbG9uZWR8IHsKKyAgICAgICAgICAgICAgICBsZXQgcmVhZF9oYWxmID0gUmVhZEhhbGY6Om5ldyhUVGNwQ2hhbm5lbCB7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbTogcy5zdHJlYW0udGFrZSgpLAorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgICAgIGxldCB3cml0ZV9oYWxmID0gV3JpdGVIYWxmOjpuZXcoVFRjcENoYW5uZWwgeworICAgICAgICAgICAgICAgICAgICBzdHJlYW06IFNvbWUoY2xvbmVkKSwKKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICAocmVhZF9oYWxmLCB3cml0ZV9oYWxmKQorICAgICAgICAgICAgfSkKKyAgICAgICAgICAgIC5va19vcl9lbHNlKHx8IHsKKyAgICAgICAgICAgICAgICBuZXdfdHJhbnNwb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IikKKyAgICAgICAgKEBhcmcgc2VydmljZTogLS1zZXJ2aWNlICt0YWtlc192YWx1ZSAiU2VydmljZSB0eXBlIHRvIGNvbnRhY3QgKFwicGFydFwiLCBcImZ1bGxcIiwgXCJyZWN1cnNpdmVcIikiKQorICAgICkKKyAgICAgICAgICAgIC5nZXRfbWF0Y2hlcygpOworCisgICAgbGV0IGhvc3QgPSBtYXRjaGVzLnZhbHVlX29mKCJob3N0IikudW53cmFwX29yKCIxMjcuMC4wLjEiKTsKKyAgICBsZXQgcG9ydCA9IHZhbHVlX3QhKG1hdGNoZXMsICJwb3J0IiwgdTE2KS51bndyYXBfb3IoOTA5MCk7CisgICAgbGV0IHByb3RvY29sID0gbWF0Y2hlcy52YWx1ZV9vZigicHJvdG9jb2wiKS51bndyYXBfb3IoImNvbXBhY3QiKTsKKyAgICBsZXQgc2VydmljZSA9IG1hdGNoZXMudmFsdWVfb2YoInNlcnZpY2UiKS51bndyYXBfb3IoInBhcnQiKTsKKworICAgIGxldCAoaV9jaGFuLCBvX2NoYW4pID0gdGNwX2NoYW5uZWwoaG9zdCwgcG9ydCk/OworICAgIGxldCAoaV90cmFuLCBvX3RyYW4pID0gKAorICAgICAgICBURnJhbWVkUmVhZFRyYW5zcG9ydDo6bmV3KGlfY2hhbiksCisgICAgICAgIFRGcmFtZWRXcml0ZVRyYW5zcG9ydDo6bmV3KG9fY2hhbiksCisgICAgKTsKKworICAgIGxldCAoaV9wcm90LCBvX3Byb3QpOiAoQm94PFRJbnB1dFByb3RvY29sPiwgQm94PFRPdXRwdXRQcm90b2NvbD4pID0gbWF0Y2ggcHJvdG9jb2wgeworICAgICAgICAiYmluYXJ5IiA9PiAoCisgICAgICAgICAgICBCb3g6Om5ldyhUQmluYXJ5SW5wdXRQcm90b2NvbDo6bmV3KGlfdHJhbiwgdHJ1ZSkpLAorICAgICAgICAgICAgQm94OjpuZXcoVEJpbmFyeU91dHB1dFByb3RvY29sOjpuZXcob190cmFuLCB0cnVlKSksCisgICAgICAgICksCisgICAgICAgICJjb21wYWN0IiA9PiAoCisgICAgICAgICAgICBCb3g6Om5ldyhUQ29tcGFjdElucHV0UHJvdG9jb2w6Om5ldyhpX3RyYW4pKSwKKyAgICAgICAgICAgIEJveDo6bmV3KFRDb21wYWN0T3V0cHV0UHJvdG9jb2w6Om5ldyhvX3RyYW4pKSwKKyAgICAgICAgKSwKKyAgICAgICAgdW5tYXRjaGVkID0+IHJldHVybiBFcnIoZm9ybWF0ISgidW5zdXBwb3J0ZWQgcHJvdG9jb2wge30iLCB1bm1hdGNoZWQpLmludG8oKSksCisgICAgfTsKKworICAgIHJ1bl9jbGllbnQoc2VydmljZSwgaV9wcm90LCBvX3Byb3QpCit9CisKK2ZuIHJ1bl9jbGllbnQoCisgICAgc2VydmljZTogJnN0ciwKKyAgICBpX3Byb3Q6IEJveDxUSW5wdXRQcm90b2NvbD4sCisgICAgb19wcm90OiBCb3g8VE91dHB1dFByb3RvY29sPiwKKykgLT4gdGhyaWZ0OjpSZXN1bHQ8KCk+IHsKKyAgICBtYXRjaCBzZXJ2aWNlIHsKKyAgICAgICAgImZ1bGwiID0+IGV4ZWNfZnVsbF9tZWFsX2NsaWVudChpX3Byb3QsIG9fcHJvdCksCisgICAgICAgICJwYXJ0IiA9PiBleGVjX21lYWxfY2xpZW50KGlfcHJvdCwgb19wcm90KSwKKyAgICAgICAgInJlY3Vyc2l2ZSIgPT4gZXhlY19yZWN1cnNpdmVfY2xpZW50KGlfcHJvdCwgb19wcm90KSwKKyAgICAgICAgXyA9PiBFcnIodGhyaWZ0OjpFcnJvcjo6ZnJvbShmb3JtYXQhKAorICAgICAgICAgICAgInVua25vd24gc2VydmljZSB0eXBlIHt9IiwKKyAgICAgICAgICAgIHNlcnZpY2UKKyAgICAgICAgKSkpLAorICAgIH0KK30KKworZm4gdGNwX2NoYW5uZWwoCisgICAgaG9zdDogJnN0ciwKKyAgICBwb3J0OiB1MTYsCispIC0+IHRocmlmdDo6UmVzdWx0PChSZWFkS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pbGRyZW46IE5vbmUsCisgICAgICAgICAgICAgICAgICAgIGl0ZW06IFNvbWUoMyksCisgICAgICAgICAgICAgICAgfSksCisgICAgICAgICAgICAgICAgQm94OjpuZXcoUmVjVHJlZSB7CisgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBOb25lLAorICAgICAgICAgICAgICAgICAgICBpdGVtOiBTb21lKDQpLAorICAgICAgICAgICAgICAgIH0pLAorICAgICAgICAgICAgXSksCisgICAgICAgICAgICBpdGVtOiBTb21lKDIpLAorICAgICAgICB9KV0pLAorICAgICAgICBpdGVtOiBTb21lKDEpLAorICAgIH07CisKKyAgICBsZXQgZXhwZWN0ZWRfdHJlZSA9IFJlY1RyZWUgeworICAgICAgICBjaGlsZHJlbjogU29tZSh2ZWMhW0JveDo6bmV3KFJlY1RyZWUgeworICAgICAgICAgICAgY2hpbGRyZW46IFNvbWUodmVjIVsKKyAgICAgICAgICAgICAgICBCb3g6Om5ldyhSZWNUcmVlIHsKKyAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46IFNvbWUoVmVjOjpuZXcoKSksIC8vIHJlbW90ZSByZXR1cm5zIGFuIGVtcHR5IGxpc3QKKyAgICAgICAgICAgICAgICAgICAgaXRlbTogU29tZSgzKSwKKyAgICAgICAgICAgICAgICB9KSwKKyAgICAgICAgICAgICAgICBCb3g6Om5ldyhSZWNUcmVlIHsKKyAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46IFNvbWUoVmVjOjpuZXcoKSksIC8vIHJlbW90ZSByZXR1cm5zIGFuIGVtcHR5IGxpc3QKKyAgICAgICAgICAgICAgICAgICAgaXRlbTogU29tZSg0KSwKKyAgICAgICAgICAgICAgICB9KSwKKyAgICAgICAgICAgIF0pLAorICAgICAgICAgICAgaXRlbTogU29tZSgyKSwKKyAgICAgICAgfSldKSwKKyAgICAgICAgaXRlbTogU29tZSgxKSwKKyAgICB9OworCisgICAgbGV0IHJldHVybmVkX3RyZWUgPSBleGVjdXRlX2NhbGwoInJlY3Vyc2l2ZSIsICJlY2hvX3RyZWUiLCB8fCBjbGllbnQuZWNob190cmVlKHRyZWUuY2xvbmUoKSkpPzsKKyAgICBpZiByZXR1cm5lZF90cmVlICE9IGV4cGVjdGVkX3RyZWUgeworICAgICAgICByZXR1cm4gRXJyKGZvcm1hdCEoCisgICAgICAgICAgICAibWlzbWF0Y2hlZCByZWN1cnNpdmUgdHJlZSB7Oj99IHs6P30iLAorICAgICAgICAgICAgZXhwZWN0ZWRfdHJlZSwgcmV0dXJuZWRfdHJlZQorICAgICAgICApCisgICAgICAgIC5pbnRvKCkpOworICAgIH0KKworICAgIGxldCBsaXN0ID0gUmVjTGlzdCB7CisgICAgICAgIG5leHRpdGVtOiBTb21lKEJveDo6bmV3KFJlY0xpc3QgeworICAgICAgICAgICAgbmV4dGl0ZW06IFNvbWUoQm94OjpuZXcoUmVjTGlzdCB7CisgICAgICAgICAgICAgICAgbmV4dGl0ZW06IE5vbmUsCisgICAgICAgICAgICAgICAgaXRlbTogU29tZSgzKSwKKyAgICAgICAgICAgIH0pKSwKKyAgICAgICAgICAgIGl0ZW06IFNvbWUoMiksCisgICAgICAgIH0pKSwKKyAgICAgICAgaXRlbTogU29tZSgxKSwKKyAgICB9OworICAgIGxldCByZXR1cm5lZF9saXN0ID0gZXhlY3V0ZV9jYWxsKCJyZWN1cnNpdmUiLCAiZWNob19saXN0IiwgfHwgY2xpZW50LmVjaG9fbGlzdChsaXN0LmNsb25lKCkpKT87CisgICAgaWYgcmV0dXJuZWRfbGlzdCAhPSBsaXN0IHsKKyAgICAgICAgcmV0dXJuIEVycihmb3JtYXQhKCJtaXNtYXRjaGVkIHJlY3Vyc2l2ZSBsaXN0IHs6P30gezo/fSIsIGxpc3QsIHJldHVybmVkX2xpc3QpLmludG8oKSk7CisgICAgfQorCisgICAgbGV0IGNvX3JlYyA9IENvUmVjIHsKKyAgICAgICAgb3RoZXI6IFNvbWUoQm94OjpuZXcoQ29SZWMyIHsKKyAgICAgICAgICAgIG90aGVyOiBTb21lKENvUmVjIHsKKyAgICAgICAgICAgICAgICBvdGhlcjogU29tZShCb3g6Om5ldyhDb1JlYzIgeyBvdGhlcjogTm9uZSB9KSksCisgICAgICAgICAgICB9KSwKKyAgICAgICAgfSkpLAorICAgIH07CisgICAgbGV0IHJldHVybmVkX2NvX3JlYyA9IGV4ZWN1dGVfY2FsbCgicmVjdXJzaXZlIiwgImVjaG9fY29fcmVjIiwgfHwgeworICAgICAgICBjbGllbnQuZWNob19jb19yZWMoY29fcmVjLmNsb25lKCkpCisgICAgfSk/OworICAgIGlmIHJldHVybmVkX2NvX3JlYyAhPSBjb19yZWMgeworICAgICAgICByZXR1cm4gRXJyKGZvcm1hdCEoIm1pc21hdGNoZWQgY29fcmVjIHs6P30gezo/fSIsIGNvX3JlYywgcmV0dXJuZWRfY29fcmVjKS5pbnRvKCkpOworICAgIH0KKworICAgIE9rKCgpKQorfQorCitmbiBleGVjdXRlX2NhbGw8RiwgUj4oc2VydmljZV90eXBlOiAmc3RyLCBjYWxsX25hbWU6ICZzdHIsIG11dCBmOiBGKSAtPiB0aHJpZnQ6OlJlc3VsdDxSPgord2hlcmUKKyAgICBGOiBGbk11dCgpIC0+IHRocmlmdDo6UmVzdWx0PFI+LAoreworICAgIGxldCByZXMgPSBmKCk7CisKKyAgICBtYXRjaCByZXMgeworICAgICAgICBPayhfKSA9PiBwcmludGxuISgie306IGNvbXBsZXRlZCB7fSBjYWxsIiwgc2VydmljZV90eXBlLCBjYWxsX25hbWUpLAorICAgICAgICBFcnIocmVmIGUpID0+IHByaW50bG4hKAorICAgICAgICAgICAgInt9OiBmYWlsZWQge30gY2FsbCB3aXRoIGVycm9yIHs6P30iLAorICAgICAgICAgICAgc2VydmljZV90eXBlLCBjYWxsX25hbWUsIGUKKyAgICAgICAgKSwKKyAgICB9CisKKyAgICByZXMKK30KZGlmZiAtLWdpdCBhL2xpYi9ycy90ZXN0L3NyYy9iaW4va2l0Y2hlbl9zaW5rX3NlcnZlci5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ygpOworCisgICAgbGV0IChpX3Byb3RvY29sX2ZhY3RvcnksIG9fcHJvdG9jb2xfZmFjdG9yeSk6ICgKKyAgICAgICAgQm94PFRJbnB1dFByb3RvY29sRmFjdG9yeT4sCisgICAgICAgIEJveDxUT3V0cHV0UHJvdG9jb2xGYWN0b3J5PiwKKyAgICApID0gbWF0Y2ggJipwcm90b2NvbCB7CisgICAgICAgICJiaW5hcnkiID0+ICgKKyAgICAgICAgICAgIEJveDo6bmV3KFRCaW5hcnlJbnB1dFByb3RvY29sRmFjdG9yeTo6bmV3KCkpLAorICAgICAgICAgICAgQm94OjpuZXcoVEJpbmFyeU91dHB1dFByb3RvY29sRmFjdG9yeTo6bmV3KCkpLAorICAgICAgICApLAorICAgICAgICAiY29tcGFjdCIgPT4gKAorICAgICAgICAgICAgQm94OjpuZXcoVENvbXBhY3RJbnB1dFByb3RvY29sRmFjdG9yeTo6bmV3KCkpLAorICAgICAgICAgICAgQm94OjpuZXcoVENvbXBhY3RPdXRwdXRQcm90b2NvbEZhY3Rvcnk6Om5ldygpKSwKKyAgICAgICAgKSwKKyAgICAgICAgdW5rbm93biA9PiB7CisgICAgICAgICAgICByZXR1cm4gRXJyKGZvcm1hdCEoInVuc3VwcG9ydGVkIHRyYW5zcG9ydCB0eXBlIHt9IiwgdW5rbm93bikuaW50bygpKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICAvLyBGSVhNRTogc2hvdWxkIHByb2Nlc3NvciBiZSBib3hlZCBhcyB3ZWxsPworICAgIC8vCisgICAgLy8gW3NpZ2hdIEkgaGF0ZSBSdXN0IGdlbmVyaWNzIGltcGxlbWVudGF0aW9uCisgICAgLy8KKyAgICAvLyBJIHdvdWxkIGhhdmUgcHJlZmVycmVkIHRvIGJ1aWxkIGEgc2VydmVyIGhlcmUsIHJldHVybiBpdCwgYW5kIHRoZW4gZG8KKyAgICAvLyB0aGUgY29tbW9uIGxpc3Rlbi1hbmQtaGFuZGxlIHN0dWZmLCBidXQgc2luY2Ug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IC5wb3N0LCB1cmk6IHVyaSkgeyByZXF1ZXN0LCByZXNwb25zZSBpbgorICAgICBwUXVldWUuYXN5bmMgeworICAgICAgIHJlc3BvbnNlLnNldEhlYWRlciguY29udGVudFR5cGUsIHZhbHVlOiAiYXBwbGljYXRpb24veC10aHJpZnQiKQorCisgICAgICAgbGV0IGl0cmFucyA9IFRNZW1vcnlCdWZmZXJUcmFuc3BvcnQoKQorICAgICAgIGlmIGxldCBieXRlcyA9IHJlcXVlc3QucG9zdEJvZHlCeXRlcyB7CisgICAgICAgICBsZXQgZGF0YSA9IERhdGEoYnl0ZXM6IGJ5dGVzKQorICAgICAgICAgaXRyYW5zLnJlc2V0KHJlYWRCdWZmZXI6IGRhdGEpCisgICAgICAgfQorCisgICAgICAgbGV0IG90cmFucyA9IFRNZW1vcnlCdWZmZXJUcmFuc3BvcnQoZmx1c2hIYW5kbGVyOiB7IHRyYW5zLCBidWZmIGluCisgICAgICAgICBsZXQgYXJyYXkgPSBidWZmLndpdGhVbnNhZmVCeXRlcyB7CisgICAgICAgICAgIEFycmF5PFVJbnQ4PihVbnNhZmVCdWZmZXJQb2ludGVyKHN0YXJ0OiAkMCwgY291bnQ6IGJ1ZmYuY291bnQpKQorICAgICAgICAgfQorICAgICAgICAgcmVzcG9uc2Uuc3RhdHVzID0gLm9rCisgICAgICAgICByZXNwb25zZS5zZXRCb2R5KGJ5dGVzOiBhcnJheSkKKyAgICAgICAgIHJlc3BvbnNlLmNvbXBsZXRlZCgpCisgICAgICAgfSkKKworICAgICAgIGxldCBpbnByb3RvID0gSW5Qcm90b2NvbChvbjogaXRyYW5zKQorICAgICAgIGxldCBvdXRwcm90byA9IE91dFByb3RvY29sKG9uOiBvdHJhbnMpCisKKyAgICAgICBkbyB7CisgICAgICAgICB0cnkgcHJvY2Vzc29yLnByb2Nlc3Mob246IGlucHJvdG8sIG91dFByb3RvY29sOiBvdXRwcm90bykKKyAgICAgICAgIHRyeSBvdHJhbnMuZmx1c2goKQorICAgICA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yAgICAgIGRlZmF1bHQ6IHNlbGYgPSAudW5rbm93bgorICAgICAgfQorICAgIH0KKyAgICBwdWJsaWMgdmFyIHRocmlmdEVycm9yQ29kZTogSW50IHsKKyAgICAgIHN3aXRjaCBzZWxmIHsKKyAgICAgIGNhc2UgLnVua25vd246ICAgICAgICAgICAgICAgIHJldHVybiAwCisgICAgICBjYXNlIC51bmtub3duTWV0aG9kOiAgICAgICAgICByZXR1cm4gMQorICAgICAgY2FzZSAuaW52YWxpZE1lc3NhZ2VUeXBlOiAgICAgcmV0dXJuIDIKKyAgICAgIGNhc2UgLndyb25nTWV0aG9kTmFtZTogICAgICAgIHJldHVybiAzCisgICAgICBjYXNlIC5iYWRTZXF1ZW5jZUlkOiAgICAgICAgICByZXR1cm4gNAorICAgICAgY2FzZSAubWlzc2luZ1Jlc3VsdDogICAgICAgICAgcmV0dXJuIDUKKyAgICAgIGNhc2UgLmludGVybmFsRXJyb3I6ICAgICAgICAgIHJldHVybiA2CisgICAgICBjYXNlIC5wcm90b2NvbEVycm9yOiAgICAgICAgICByZXR1cm4gNworICAgICAgY2FzZSAuaW52YWxpZFByb3RvY29sOiAgICAgICAgcmV0dXJuIDgKKyAgICAgIGNhc2UgLmludmFsaWRUcmFuc2Zvcm06ICAgICAgIHJldHVybiA5CisgICAgICBjYXNlIC51bnN1cHBvcnRlZENsaWVudFR5cGU6ICByZXR1cm4gMTAKKyAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHZhciBkZXNjcmlwdGlvbjogU3RyaW5nIHsKKyAgICAgIC8vLyBPdXRwdXQgImZvciAjbWV0aG9kTmFtZSIgaWYgbWV0aG9kIGlzIG5vdCBuaWwgZWxzZSBlbXB0eQorICAgICAgbGV0IG1ldGhvZFVud3JhcDogKFN0cmluZz8pIC0+IFN0cmluZyA9ICB7IG1ldGhvZCBpbgorICAgICAgICByZXR1cm4gIlwobWV0aG9kID09IG5pbCA/ICIiIDogIiBmb3IgXChtZXRob2QgPz8gIiIpIikiCisgICAgICB9CisgICAgICBzd2l0Y2ggc2VsZiB7CisgICAgICBjYXNlIC51bmtub3duOiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIlVua25vd24gVEFwcGxpY2F0aW9uRXJyb3IiCisgICAgICBjYXNlIC51bmtub3duTWV0aG9kKGxldCBtZXRob2QpOiAgICByZXR1cm4gIlVua25vd24gTWV0aG9kXChtZXRob2RVbndyYXAobWV0aG9kKSkiCisgICAgICBjYXNlIC5pbnZhbGlkTWVzc2FnZVR5cGU6ICAgICAgICAgICByZXR1cm4gIkludmFsaWQgTWVzc2FnZSBUeXBlIgorICAgICAgY2FzZSAud3JvbmdNZXRob2ROYW1lKGxldCBtZXRob2QpOiAgcmV0dXJuICJXcm9uZyBNZXRob2QgTmFtZVwobWV0aG9kVW53cmFwKG1ldGhvZCkpIgorICAgICAgY2FzZSAuYmFkU2VxdWVuY2VJZDogICAgICAgICAgICAgICAgcmV0dXJuICJCYWQgU2VxdWVuY2UgSUQiCisgICAgICBjYXNlIC5taXNzaW5nUmVzdWx0KGxldCBtZXRob2QpOiAgICByZXR1cm4gIk1pc3NpbmcgUmVzdWx0XChtZXRob2RVbndyYXAobWV0aG9kKSkiCisgICAgICBjYXNlIC5pbnRlcm5hbEVycm9yOiAgICAgICAgICAgICAgICByZXR1cm4gIkludGVybmFsIEVycm9yIgorICAgICAgY2FzZSAucHJvdG9jb2xFcnJvcjogICAgICAgICAgICAgICAgcmV0dXJuICJQcm90b2NvbCBFcnJvciIKKyAgICAgIGNhc2UgLmludmFsaWRQcm90b2NvbDogICAgICAgICAgICAgIHJldHVybiAiSW52YWxpZCBQcm90b2NvbCIKKyAgICAgIGNhc2UgLmludmFsaWRUcmFuc2Zvcm06ICAgICAgICAgICAgIHJldHVybiAiSW52YWxpZCBUcmFuc2Zvcm0iCisgICAgICBjYXNlIC51bnN1cHBvcnRlZENsaWVudFR5cGU6ICAgICAgICByZXR1cm4gIlVuc3VwcG9ydGVkIENsaWVudCBUeXBlIgor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isgICAgICB9CisgICAgICBpZiBtZXNzYWdlU2l6ZUxpbWl0ID4gMCAmJiBzaXplID4gSW50MzIobWVzc2FnZVNpemVMaW1pdCkgeworICAgICAgICB0aHJvdyBUUHJvdG9jb2xFcnJvcihlcnJvcjogLnNpemVMaW1pdChsaW1pdDogSW50KG1lc3NhZ2VTaXplTGltaXQpLCBnb3Q6IEludChzaXplKSkpCisgICAgICB9CisgICAgICAKKyAgICAgIG1lc3NhZ2VOYW1lID0gdHJ5IHJlYWRTdHJpbmdCb2R5KEludChzaXplKSkKKyAgICAgIHR5cGUgPSBUTWVzc2FnZVR5cGUocmF3VmFsdWU6IEludDMyKHRyeSByZWFkKCkgYXMgVUludDgpKSA/PyB0eXBlCisgICAgfQorICAgIAorICAgIGxldCBzZXFJRDogSW50MzIgPSB0cnkgcmVhZCgpCisgICAgcmV0dXJuIChtZXNzYWdlTmFtZSwgdHlwZSwgc2VxSUQpCisgIH0KKyAgCisgIHB1YmxpYyBmdW5jIHJlYWRNZXNzYWdlRW5kKCkgdGhyb3dzIHsKKyAgICByZXR1cm4KKyAgfQorICAKKyAgcHVibGljIGZ1bmMgcmVhZFN0cnVjdEJlZ2luKCkgdGhyb3dzIC0+IFN0cmluZyB7CisgICAgcmV0dXJuICIiCisgIH0KKyAgCisgIHB1YmxpYyBmdW5jIHJlYWRTdHJ1Y3RFbmQoKSB0aHJvd3MgeworICAgIHJldHVybgorICB9CisgIAorICBwdWJsaWMgZnVuYyByZWFkRmllbGRCZWdpbigpIHRocm93cyAtPiAoU3RyaW5nLCBUVHlwZSwgSW50MzIpIHsKKyAgICAKKyAgICBsZXQgZmllbGRUeXBlID0gVFR5cGUocmF3VmFsdWU6IEludDMyKHRyeSByZWFkKCkgYXMgVUludDgpKSA/PyBUVHlwZS5zdG9wCisgICAgdmFyIGZpZWxkSUQ6IEludDMyID0gMAorICAgIAorICAgIGlmIGZpZWxkVHlwZSAhPSAuc3RvcCB7CisgICAgICBmaWVsZElEID0gSW50MzIodHJ5IHJlYWQoKSBhcyBJbnQxNikKKyAgICB9CisgICAgCisgICAgcmV0dXJuICgiIiwgZmllbGRUeXBlLCBmaWVsZElEKQorICB9CisgIAorICBwdWJsaWMgZnVuYyByZWFkRmllbGRFbmQoKSB0aHJvd3MgeworICAgIHJldHVybgorICB9CisgIAorICBwdWJsaWMgZnVuYyByZWFkTWFwQmVnaW4oKSB0aHJvd3MgLT4gKFRUeXBlLCBUVHlwZSwgSW50MzIpIHsKKyAgICB2YXIgcmF3ID0gSW50MzIodHJ5IHJlYWQoKSBhcyBVSW50OCkKKyAgICBndWFyZCBsZXQga2V5VHlwZSA9IFRUeXBlKHJhd1ZhbHVlOiByYXcpIGVsc2UgeworICAgICAgdGhyb3cgVFByb3RvY29sRXJyb3IobWVzc2FnZTogIlVua25vd24gdmFsdWUgZm9yIGtleVR5cGUgVFR5cGU6IFwocmF3KSIpCisgICAgfQorICAgIAorICAgIHJhdyA9IEludDMyKHRyeSByZWFkKCkgYXMgVUludDgpCisgICAgZ3VhcmQgbGV0IHZhbHVlVHlwZSA9IFRUeXBlKHJhd1ZhbHVlOiByYXcpIGVsc2UgeworICAgICAgdGhyb3cgVFByb3RvY29sRXJyb3IobWVzc2FnZTogIlVua25vd24gdmFsdWUgZm9yIHZhbHVlVHlwZSBUVHlwZTogXChyYXcpIikKKyAgICB9CisgICAgbGV0IHNpemU6IEludDMyID0gdHJ5IHJlYWQoKQorICAgIAorICAgIHJldHVybiAoa2V5VHlwZSwgdmFsdWVUeXBlLCBzaXplKQorICB9CisgIAorICBwdWJsaWMgZnVuYyByZWFkTWFwRW5kKCkgdGhyb3dzIHsKKyAgICByZXR1cm4KKyAgfQorICAKKyAgcHVibGljIGZ1bmMgcmVhZFNldEJlZ2luKCkgdGhyb3dzIC0+IChUVHlwZSwgSW50MzIpIHsKKyAgICBsZXQgcmF3ID0gSW50MzIodHJ5IHJlYWQoKSBhcyBVSW50OCkKKyAgICBndWFyZCBsZXQgZWxlbWVudFR5cGUgPSBU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nMKKyogdW5kZXIgdGhlIExpY2Vuc2UuCisqLworCitpbXBvcnQgRm91bmRhdGlvbgoraW1wb3J0IENvcmVGb3VuZGF0aW9uCisKK3B1YmxpYyBlbnVtIFRDVHlwZTogVUludDggeworICBjYXNlIHN0b3AgICAgICAgICAgPSAweDAwCisgIGNhc2UgYm9vbGVhbl9UUlVFICA9IDB4MDEKKyAgY2FzZSBib29sZWFuX0ZBTFNFID0gMHgwMgorICBjYXNlIGk4ICAgICAgICAgICAgPSAweDAzCisgIGNhc2UgaTE2ICAgICAgICAgICA9IDB4MDQKKyAgY2FzZSBpMzIgICAgICAgICAgID0gMHgwNQorICBjYXNlIGk2NCAgICAgICAgICAgPSAweDA2CisgIGNhc2UgZG91YmxlICAgICAgICA9IDB4MDcKKyAgY2FzZSBiaW5hcnkgICAgICAgID0gMHgwOAorICBjYXNlIGxpc3QgICAgICAgICAgPSAweDA5CisgIGNhc2Ugc2V0ICAgICAgICAgICA9IDB4MEEKKyAgY2FzZSBtYXAgICAgICAgICAgID0gMHgwQgorICBjYXNlIGBzdHJ1Y3RgICAgICAgPSAweDBDCisgIAorICBwdWJsaWMgc3RhdGljIGxldCB0eXBlTWFzazogVUludDggPSAweEUwIC8vIDExMTAgMDAwMAorICBwdWJsaWMgc3RhdGljIGxldCB0eXBlQml0czogVUludDggPSAweDA3IC8vIDAwMDAgMDExMQorICBwdWJsaWMgc3RhdGljIGxldCB0eXBlU2hpZnRBbW91bnQgPSA1CisgCit9CisKKworcHVibGljIGNsYXNzIFRDb21wYWN0UHJvdG9jb2w6IFRQcm90b2NvbCB7CisgIHB1YmxpYyBzdGF0aWMgbGV0IHByb3RvY29sSUQ6IFVJbnQ4ICA9IDB4ODIKKyAgcHVibGljIHN0YXRpYyBsZXQgdmVyc2lvbjogVUludDggICAgID0gMQorICBwdWJsaWMgc3RhdGljIGxldCB2ZXJzaW9uTWFzazogVUludDggPSAweDFGIC8vIDAwMDEgMTExMQorICAKKyAgcHVibGljIHZhciB0cmF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OiBVSW50NjQpIC0+IEludDY0IHsKKyAgICByZXR1cm4gSW50NjQobiA+PiAxKSBeICgtSW50NjQobiAmIDEpKQorICB9CisgIAorICAKKyAgCisgIC8vLyBNYXJrOiAtIFRQcm90b2NvbCAgCisgIAorICBwdWJsaWMgZnVuYyByZWFkTWVzc2FnZUJlZ2luKCkgdGhyb3dzIC0+IChTdHJpbmcsIFRNZXNzYWdlVHlwZSwgSW50MzIpIHsKKyAgICBsZXQgcHJvdG9jb2xJZDogVUludDggPSB0cnkgcmVhZCgpCisgICAgCisgICAgaWYgcHJvdG9jb2xJZCAhPSBUQ29tcGFjdFByb3RvY29sLnByb3RvY29sSUQgeworICAgICAgbGV0IGV4cGVjdGVkID0gU3RyaW5nKGZvcm1hdDoiJTJYIiwgVENvbXBhY3RQcm90b2NvbC5wcm90b2NvbElEKQorICAgICAgbGV0IGdvdCAgICAgID0gU3RyaW5nKGZvcm1hdDoiJTJYIiwgcHJvdG9jb2xJZCkKKyAgICAgIHRocm93IFRQcm90b2NvbEVycm9yKG1lc3NhZ2U6ICJXcm9uZyBQcm90b2NvbCBJRCBcKGdvdCkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0ZW5kZWRFcnJvcjogLm1pc21hdGNoZWRQcm90b2NvbChleHBlY3RlZDogZXhwZWN0ZWQsIGdvdDogZ290KSkKKworICAgIH0KKworICAgIGxldCB2ZXJzaW9uQW5kVHlwZTogVUludDggPSB0cnkgcmVhZCgpCisgICAgbGV0IHZlcnNpb246IFVJbnQ4ID0gdmVyc2lvbkFuZFR5cGUgJiBUQ29tcGFjdFByb3RvY29sLnZlcnNpb25NYXNrCisgICAgaWYgdmVyc2lvbiAhPSBUQ29tcGFjdFByb3RvY29sLnZlcnNpb24geworICAgICAgdGhyb3cgVFByb3RvY29sRXJyb3IoZXJyb3I6IC5iYWRWZXJzaW9uKGV4cGVjdGVkOiAiXChUQ29tcGFjdFByb3RvY29sLnZlcnNpb24pIiwKKyAgICAgICAgICAgICA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GaWVsZFR5cGUgPSBmaWVsZFR5cGUKKyAgICAgIGJvb2xGaWVsZElkID0gZmllbGRJRAorICAgICAgcmV0dXJuCisgICAgfSBlbHNlIHsKKyAgICAgIHRyeSB3cml0ZUZpZWxkQmVnaW5JbnRlcm5hbChuYW1lOiBuYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGZpZWxkVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOiBmaWVsZElELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVPdmVycmlkZTogMHhGRikKKyAgICB9CisgIH0KKyAgCisgIGZ1bmMgd3JpdGVGaWVsZEJlZ2luSW50ZXJuYWwobmFtZTogU3RyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgZmllbGRUeXBlOiBUVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWVsZElEOiBJbnQzMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlT3ZlcnJpZGU6IFVJbnQ4KSB0aHJvd3MgeworICAgIAorICAgIGxldCB0eXBlVG9Xcml0ZSA9IHR5cGVPdmVycmlkZSA9PSAweEZGID8gY29tcGFjdFR5cGUoZmllbGRUeXBlKS5yYXdWYWx1ZSA6IHR5cGVPdmVycmlkZQorICAgIAorICAgIC8vIGNoZWNrIGlmIHdlIGNhbiB1c2UgZGVsdGEgZW5jb2RpbmcgZm9yIHRoZSBmaWVsZCBpZAorICAgIGxldCBkaWZmID0gVUludDgoZmllbGRJRCkgLSBsYXN0RmllbGRJZAorICAgIGlmIChVSW50OChmaWVsZElEKSA+IGxhc3RGaWVsZElkKSAmJiAoZGlmZiA8PSAxNSkgeworICAgICAgLy8gV3JpdGUgdGhlbSB0b2dldGhlcgorICAgICAgdHJ5IHdyaXRlYnl0ZURpcmVjdCgoVUludDgoZmllbGRJRCkgLSBsYXN0RmllbG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GhyaWZ0Q29udGVudFR5cGUgPSAiYXBwbGljYXRpb24veC10aHJpZnQiCisgICAgICAKKyAgICAgIGlmIGxldCBwcm90b2NvbE5hbWUgPSBwcm90b2NvbE5hbWUgeworICAgICAgICB0aHJpZnRDb250ZW50VHlwZSArPSAiOyBwPVwocHJvdG9jb2xOYW1lKSIKKyAgICAgIH0KKyAgICAgIAorICAgICAgY29uZmlnLnJlcXVlc3RDYWNoZVBvbGljeSA9IC5yZWxvYWRJZ25vcmluZ0xvY2FsQ2FjaGVEYXRhCisgICAgICBjb25maWcudXJsQ2FjaGUgPSBuaWwKKyAgICAgIAorICAgICAgY29uZmlnLmh0dHBTaG91bGRVc2VQaXBlbGluaW5nICA9IHRydWUKKyAgICAgIGNvbmZpZy5odHRwU2hvdWxkU2V0Q29va2llcyAgICAgPSB0cnVlCisgICAgICBjb25maWcuaHR0cEFkZGl0aW9uYWxIZWFkZXJzICAgID0gWyJDb250ZW50LVR5cGUiOiB0aHJpZnRDb250ZW50VHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkFjY2VwdCI6IHRocmlmdENvbnRlbnRUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVXNlci1BZ2VudCI6ICJUaHJpZnQvU3dpZnQgKFNlc3Npb24pIl0KKyAgICAgIAorICAgICAgCisgICAgfQorICAgIAorICAgIHB1YmxpYyBpbml0KHNlc3Npb246IFVSTFNlc3Npb24sIHVybDogVVJMKSB7CisgICAgICBzZWxmLnNlc3Npb24gPSBzZXNzaW9uCisgICAgICBzZWxmLnVybCA9IHVybAorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgZnVuYyBuZXdUcmFuc3BvcnQoKSAtPiBUSFRUUFNlc3Npb25UcmFuc3BvcnQgeworICAgICAgcmV0dXJuIFRIVFRQU2Vzc2lvblRyYW5zcG9ydChmYWN0b3J5OiBzZWxmKQorICAgIH0KKyAgICAKKyAgICBmdW5jI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dGEoKQorCisgICAgZG8geworICAgICAgdGFzayA9IHRyeSBmYWN0b3J5LnRhc2tXaXRoUmVxdWVzdChyZXF1ZXN0LCBjb21wbGV0aW9uSGFuZGxlcjogeyAoZGF0YSwgcmVzcG9uc2UsIHRhc2tFcnJvcikgaW4KKworICAgICAgICAvLyBDaGVjayBpZiB0aGVyZSB3YXMgYW4gZXJyb3Igd2l0aCB0aGUgbmV0d29yaworICAgICAgICBpZiB0YXNrRXJyb3IgIT0gbmlsIHsKKyAgICAgICAgICAgIGVycm9yID0gVFRyYW5zcG9ydEVycm9yKGVycm9yOiAudGltZWRPdXQpCisgICAgICAgICAgICBjb21wbGV0ZWQoc2VsZiwgZXJyb3IpCisgICAgICAgICAgICByZXR1cm4KKyAgICAgICAgfQorCisgICAgICAgIC8vIENoZWNrIHJlc3BvbnNlIHR5cGUKKyAgICAgICAgaWYgdGFza0Vycm9yID09IG5pbCAmJiAhKHJlc3BvbnNlIGlzIEhUVFBVUkxSZXNwb25zZSkgeworICAgICAgICAgICAgZXJyb3IgPSBUSFRUUFRyYW5zcG9ydEVycm9yKGVycm9yOiAuaW52YWxpZFJlc3BvbnNlKQorICAgICAgICAgICAgY29tcGxldGVkKHNlbGYsIGVycm9yKQorICAgICAgICAgICAgcmV0dXJuCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIENoZWNrIHN0YXR1cyBjb2RlCisgICAgICAgIGlmIGxldCBodHRwUmVzcG9uc2UgPSByZXNwb25zZSBhcz8gSFRUUFVSTFJlc3BvbnNlIHsKKyAgICAgICAgICBpZiB0YXNrRXJyb3IgPT0gbmlsICYmIGh0dHBSZXNwb25zZS5zdGF0dXNDb2RlICE9IDIwMCB7CisgICAgICAgICAgICBpZiBodHRwUmVzcG9uc2Uuc3RhdHVzQ29kZSA9PSA0MDEgeworICAgICAgICAgICAgICBlcnJvciA9IFRIVFRQVHJhbnNwb3J0RXJyb3IoZXJyb3I6IC5hdXRoZW50aWNhdGlvbikKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgIGVycm9yID0gVEhUVFBUcmFuc3BvcnRFcnJvcihlcnJvcjogLmludmFsaWRTdGF0dXMoc3RhdHVzQ29kZTogaHR0cFJlc3BvbnNlLnN0YXR1c0NvZGUpKQorICAgICAgICAgICAgfQorICAgICAgICAgIH0KKyAgICAgICAgICAKKyAgICAgICAgICAvLyBBbGxvdyBmYWN0b3J5IHRvIGNoZWNrCisgICAgICAgICAgaWYgZXJyb3IgIT0gbmlsIHsKKyAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgdHJ5IHNlbGYuZmFjdG9yeS52YWxpZGF0ZVJlc3BvbnNlKGh0dHBSZXNwb25zZSwgZGF0YTogZGF0YSkKKyAgICAgICAgICAgIH0gY2F0Y2ggbGV0IHZhbGlkYXRlRXJyb3IgeworICAgICAgICAgICAgICBlcnJvciA9IHZhbGlkYXRlRXJyb3IKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgICAgCisgICAgICAgICAgc2VsZi5yZXNwb25zZURhdGFPZmZzZXQgPSAwCisgICAgICAgICAgaWYgZXJyb3IgIT0gbmlsIHsKKyAgICAgICAgICAgIHNlbGYucmVzcG9uc2VEYXRhID0gRGF0YSgpCisgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNlbGYucmVzcG9uc2VEYXRhID0gZGF0YSA/PyBEYXRhKCkKKyAgICAgICAgICB9CisgICAgICAgICAgY29tcGxldGVkKHNlbGYsIGVycm9yKQorICAgICAgICB9CisgICAgICB9KQorICAgICAgCisgICAgfSBjYXRjaCBsZXQgdGFza0Vycm9yIHsKKyAgICAgIGVycm9yID0gdGFza0Vycm9yCisgICAgfQorICAgIAorICAgIGlmIGxldCBlcnJvciA9IGVycm9yLCB0YXNrID09IG5pbCB7CisgICAgICBjb21wbGV0ZWQoc2VsZiwgZXJyb3IpCisgICAgfQorICAgIHRhc2s/LnJlc3VtZSgpCisgIH0KKworICBwdWJsaWM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AgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRlbmRlZEVycm9yOiAudW5leHBlY3RlZFR5cGUodHlwZToga2V5VHlwZSkpCisgICAgICB9CisgICAgICBpZiB2YWx1ZVR5cGUgIT0gVmFsdWUudGhyaWZ0VHlwZSB7CisgICAgICAgIHRocm93IFRQcm90b2NvbEVycm9yKGVycm9yOiAuaW52YWxpZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICJVbmV4cGVjdGVkIFRNYXAgVmFsdWUgVHlwZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dGVuZGVkRXJyb3I6IC51bmV4cGVjdGVkVHlwZSh0eXBlOiB2YWx1ZVR5cGUpKQorICAgICAgfQorICAgIH0KKworICAgIHZhciBtYXAgPSBUTWFwKCkKKyAgICBmb3IgXyBpbiAwLi48c2l6ZSB7CisgICAgICBsZXQga2V5ID0gdHJ5IEtleS5yZWFkKGZyb206IHByb3RvKQorICAgICAgbGV0IHZhbHVlID0gdHJ5IFZhbHVlLnJlYWQoZnJvbTogcHJvdG8pCisgICAgICBtYXAuc3RvcmFnZVtrZXldID0gdmFsdWUKKyAgICB9CisgICAgdHJ5IHByb3RvLnJlYWRNYXBFbmQoKQorICAgIHJldHVybiBtYXAKKyAgfQorICAKKyAgcHVibGljIGZ1bmMgd3JpdGUodG8gcHJvdG86IFRQcm90b2NvbCkgdGhyb3dzIHsKKyAgICB0cnkgcHJvdG8ud3JpdGVNYXBCZWdpbihrZXlUeXBlOiBLZXkudGhyaWZ0VHlwZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZVR5cGU6IFZhbHVlLnRocmlmdFR5cGUsIHNpemU6IEludDMyKHNlbGYuY291bnQpKQorICAgIGZvciAoa2V5LCB2YWx1ZSkgaW4gc2VsZi5zdG9yYWdlIHsKKyAgICAgIHRyeSBLZXkud3JpdGUoa2V5LCB0bzogcHJvdG8pCisgICAgICB0cnkgVmFsdWU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WdpbigpCisgICAgICB3aGlsZSB0cnVlIHsKKyAgICAgICAgbGV0IChfLCBmaWVsZFR5cGUsIF8pID0gdHJ5IHJlYWRGaWVsZEJlZ2luKCkKKyAgICAgICAgaWYgZmllbGRUeXBlID09IC5zdG9wIHsKKyAgICAgICAgICBicmVhaworICAgICAgICB9CisgICAgICAgIHRyeSBza2lwKHR5cGU6IGZpZWxkVHlwZSkKKyAgICAgICAgdHJ5IHJlYWRGaWVsZEVuZCgpCisgICAgICB9CisgICAgICB0cnkgcmVhZFN0cnVjdEVuZCgpCisgICAgICAKKyAgICAgIAorICAgIGNhc2UgLm1hcDoKKyAgICAgIGxldCAoa2V5VHlwZSwgdmFsdWVUeXBlLCBzaXplKSA9IHRyeSByZWFkTWFwQmVnaW4oKQorICAgICAgZm9yIF8gaW4gMC4uPHNpemUgeworICAgICAgICB0cnkgc2tpcCh0eXBlOiBrZXlUeXBlKQorICAgICAgICB0cnkgc2tpcCh0eXBlOiB2YWx1ZVR5cGUpCisgICAgICB9CisgICAgICB0cnkgcmVhZE1hcEVuZCgpCisgICAgICAKKyAgICAgIAorICAgIGNhc2UgLnNldDoKKyAgICAgIGxldCAoZWxlbVR5cGUsIHNpemUpID0gdHJ5IHJlYWRTZXRCZWdpbigpCisgICAgICBmb3IgXyBpbiAwLi48c2l6ZSB7CisgICAgICAgIHRyeSBza2lwKHR5cGU6IGVsZW1UeXBlKQorICAgICAgfQorICAgICAgdHJ5IHJlYWRTZXRFbmQoKQorICAgICAgCisgICAgY2FzZSAubGlzdDoKKyAgICAgIGxldCAoZWxlbVR5cGUsIHNpemUpID0gdHJ5IHJlYWRMaXN0QmVnaW4oKQorICAgICAgZm9yIF8gaW4gMC4uPHNpemUgeworICAgICAgICB0cnkgc2tpcCh0eXBlOiBlbGVtVHlwZSkKKyAgICAgIH0KKyAgICAgIHRyeSByZWFkTGlzdEVuZCgpCisgICAgZGVmYXVsdDoKKyAgICAgIHJldHVybgorICAgIH0KKyAgfQorfQpkaWZmI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KyAgICBwdWJsaWMgdmFyIHRocmlmdEVycm9yQ29kZTogSW50IHsKKyAgICAgIHN3aXRjaCBzZWxmIHsKKyAgICAgIGNhc2UgLnVua25vd246ICAgICAgICAgICAgICByZXR1cm4gMTAwMAorICAgICAgY2FzZSAubWlzc2luZ1JlcXVpcmVkRmllbGQ6IHJldHVybiAxMDAxCisgICAgICBjYXNlIC51bmV4cGVjdGVkVHlwZTogICAgICAgcmV0dXJuIDEwMDIKKyAgICAgIGNhc2UgLm1pc21hdGNoZWRQcm90b2NvbDogICByZXR1cm4gMTAwMworICAgICAgfQorICAgIH0KKyAgICBwdWJsaWMgdmFyIGRlc2NyaXB0aW9uOiBTdHJpbmcgeworICAgICAgc3dpdGNoIHNlbGYgeworICAgICAgY2FzZSAudW5rbm93bjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIlVua25vd24gVFByb3RvY29sRXh0ZW5kZWRFcnJvciIKKyAgICAgIGNhc2UgLm1pc3NpbmdSZXF1aXJlZEZpZWxkKGxldCBmaWVsZE5hbWUpOiAgICAgICAgcmV0dXJuICJNaXNzaW5nIFJlcXVpcmVkIEZpZWxkOiBcKGZpZWxkTmFtZSkiCisgICAgICBjYXNlIC51bmV4cGVjdGVkVHlwZShsZXQgdHlwZSk6ICAgICAgICAgICAgICAgICAgIHJldHVybiAiVW5leHBlY3RlZCBUeXBlIFwodHlwZS5zZWxmKSIKKyAgICAgIGNhc2UgLm1pc21hdGNoZWRQcm90b2NvbChsZXQgZXhwZWN0ZWQsIGxldCBnb3QpOiAgcmV0dXJuICJNaXNtYXRjaGVkIFByb3RvY29sLiAgKEV4cGVjdGVkOiBcKGV4cGVjdGVkKSwgZ290IFwoZ290KSkiCisgICAgICB9CisgICAgfQorICB9CisKKyAgcHVibGljIHZhciBleHRlbmRlZEVycm9yOiBFeHRlbmRlZEVycm9yQ29kZT8gPSBuaWwKKworICBwdWJsaWMgaW5pdChlcnJvcjogQ29kZSA9IC51bmtub3duL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Bmb3IgcG9pbnRlcgorICAgICAgICBsZXQgcG9saWNpZXM6IFVuc2FmZU11dGFibGVQb2ludGVyPENGQXJyYXk/Pj8gPSBuaWwKKyAgICAgICAgaWYgU2VjVHJ1c3RDb3B5UG9saWNpZXModHJ1c3QsIHBvbGljaWVzISkgIT0gZXJyU2VjU3VjY2VzcyB7CisgICAgICAgICAgYnJlYWsKKyAgICAgICAgfQorICAgICAgICB3aXRoVW5zYWZlTXV0YWJsZVBvaW50ZXIodG86ICZwcG9saWN5KSB7IHB0ciBpbgorICAgICAgICAgIG5ld1BvbGljaWVzID0gQ0ZBcnJheUNyZWF0ZU11dGFibGVDb3B5KG5pbCwgMCwgcG9saWNpZXM/LnBvaW50ZWUpCisgICAgICAgICAgQ0ZBcnJheUFwcGVuZFZhbHVlKG5ld1BvbGljaWVzLCBwdHIpCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIHVwZGF0ZSB0cnVzdCBwb2xpY2llcworICAgICAgICBpZiBTZWNUcnVzdFNldFBvbGljaWVzKHRydXN0LCBuZXdQb2xpY2llcyEpICE9IGVyclNlY1N1Y2Nlc3MgeworICAgICAgICAgIGJyZWFrCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIEV2YWx1YXRlIHRoZSB0cnVzdCBjaGFpbgorICAgICAgICBsZXQgc3VjY2VzcyA9IHdpdGhVbnNhZmVNdXRhYmxlUG9pbnRlcih0bzogJnRydXN0UmVzdWx0KSB7IHRydXN0UHRyIC0+IEJvb2wgaW4KKyAgICAgICAgICBpZiBTZWNUcnVzdEV2YWx1YXRlKHRydXN0LCB0cnVzdFB0cikgIT0gZXJyU2VjU3VjY2VzcyB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2UKKyAgICAgICAgICB9CisgICAgICAgICAgcmV0dXJuIHRydWUKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgIXN1Y2Nlc3MgeworICAgICAgICAgIGJyZWFrCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIAorICAgICAgICBzd2l0Y2ggdHJ1c3RSZXN1bHQgeworICAgICAgICBjYXNlIC5wcm9jZWVkOiAgICAgIHByb2NlZWQgPSB0cnVlCisgICAgICAgIGNhc2UgLnVuc3BlY2lmaWVkOiAgcHJvY2VlZCA9IHRydWUKKyAgICAgICAgY2FzZSAucmVjb3ZlcmFibGVUcnVzdEZhaWx1cmU6CisgICAgICAgICAgcHJvY2VlZCA9IHNlbGYucmVjb3ZlckZyb21UcnVzdEZhaWx1cmUodHJ1c3QsIGxhc3RUcnVzdFJlc3VsdDogdHJ1c3RSZXN1bHQpCisgICAgICAgICAgCisgICAgICAgIGNhc2UgLmRlbnk6ICAgICAgICAgYnJlYWsKKyAgICAgICAgY2FzZSAuZmF0YWxUcnVzdEZhaWx1cmU6IGJyZWFrCisgICAgICAgIGNhc2UgLm90aGVyRXJyb3I6ICAgYnJlYWsKKyAgICAgICAgY2FzZSAuaW52YWxpZDogICAgICBicmVhaworICAgICAgICBkZWZhdWx0OiBicmVhaworICAgICAgICB9CisgICAgICB9IHdoaWxlIGZhbHNlCisgIAorICAgICAgaWYgIXByb2NlZWQgeworICAgICAgICBwcmludCgiVFNTTFNvY2tldFRyYW5zcG9ydDogQ2Fubm90IHRydXN0IGNlcnRpZmljYXRlLiAgUmVzdWx0OiBcKHRydXN0UmVzdWx0KSIpCisgICAgICAgIGFTdHJlYW0uY2xvc2UoKQorICAgICAgfQorICAgICAgCisgICAgY2FzZSBTdHJlYW0uRXZlbnQuZXJyb3JPY2N1cnJlZDogYnJlYWsKKyAgICBjYXNlIFN0cmVhbS5FdmVudC5lbmRFbmNvdW50ZXJlZDogYnJlYWsKKyAgICBkZWZhdWx0OiBicmVhaworICAgIH0KKyAgfQorfQorI2VuZGlmCmRpZmYgLS1naXQgYS9saWIvc3dpZnQvU291cmNlcy9UU1NMU29ja2V0VHJhbnNwb3J0RXJyb3Iuc3dpZnQgYi9saWIvc3dpZnQvU291cmNlcy9UU1NMU29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lwZSB7IHJldHVybiAuaTggfQorCisgIHB1YmxpYyBzdGF0aWMgZnVuYyByZWFkKGZyb20gcHJvdG86IFRQcm90b2NvbCkgdGhyb3dzIC0+IEludDggeworICAgIHJldHVybiBJbnQ4KHRyeSBwcm90by5yZWFkKCkgYXMgVUludDgpCisgIH0KKworICBwdWJsaWMgZnVuYyB3cml0ZSh0byBwcm90bzogVFByb3RvY29sKSB0aHJvd3MgeworICAgIHRyeSBwcm90by53cml0ZShVSW50OChzZWxmKSkKKyAgfQorfQorCitleHRlbnNpb24gSW50MTYgOiBUU2VyaWFsaXphYmxlIHsKKyAgcHVibGljIHN0YXRpYyB2YXIgdGhyaWZ0VHlwZTogVFR5cGUgeyByZXR1cm4gLmkxNiB9CisKKyAgcHVibGljIHN0YXRpYyBmdW5jIHJlYWQoZnJvbSBwcm90bzogVFByb3RvY29sKSB0aHJvd3MgLT4gSW50MTYgeworICAgIHJldHVybiB0cnkgcHJvdG8ucmVhZCgpCisgIH0KKworICBwdWJsaWMgZnVuYyB3cml0ZSh0byBwcm90bzogVFByb3RvY29sKSB0aHJvd3MgeworICAgIHRyeSBwcm90by53cml0ZShzZWxmKQorICB9Cit9CisKK2V4dGVuc2lvbiBJbnQzMiA6IFRTZXJpYWxpemFibGUgeworICBwdWJsaWMgc3RhdGljIHZhciB0aHJpZnRUeXBlOiBUVHlwZSB7IHJldHVybiAuaTMyIH0KKworICBwdWJsaWMgc3RhdGljIGZ1bmMgcmVhZChmcm9tIHByb3RvOiBUUHJvdG9jb2wpIHRocm93cyAtPiBJbnQzMiB7CisgICAgcmV0dXJuIHRyeSBwcm90by5yZWFkKCkKKyAgfQorCisgIHB1YmxpYyBmdW5jIHdyaXRlKHRvIHByb3RvOiBUUHJvdG9jb2wpIHRocm93cyB7CisgICAgdHJ5IHByb3RvLndyaXRlKHNlbGYpCisgIH0KK30KKworCitleHRlbnNpb24gSW50NjQgOiBUU2VyaWFsaXphYmxlIHsKKyAgcHVibGljIHN0YXRpYyB2Y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yByZWFkKGZyb20gcHJvdG86IFRQcm90b2NvbCkgdGhyb3dzIC0+IFRTZXQgeworICAgIGxldCAoZWxlbWVudFR5cGUsIHNpemUpID0gdHJ5IHByb3RvLnJlYWRTZXRCZWdpbigpCisgICAgaWYgZWxlbWVudFR5cGUgIT0gRWxlbWVudC50aHJpZnRUeXBlIHsKKyAgICAgIHRocm93IFRQcm90b2NvbEVycm9yKGVycm9yOiAuaW52YWxpZERhdGEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRlbmRlZEVycm9yOiAudW5leHBlY3RlZFR5cGUodHlwZTogZWxlbWVudFR5cGUpKQorICAgIH0KKyAgICB2YXIgc2V0ID0gVFNldCgpCisgICAgZm9yIF8gaW4gMC4uPHNpemUgeworICAgICAgbGV0IGVsZW1lbnQgPSB0cnkgRWxlbWVudC5yZWFkKGZyb206IHByb3RvKQorICAgICAgc2V0LnN0b3JhZ2UuaW5zZXJ0KGVsZW1lbnQpCisgICAgfQorICAgIHRyeSBwcm90by5yZWFkU2V0RW5kKCkKKyAgICByZXR1cm4gc2V0CisgIH0KKyAgCisgIHB1YmxpYyBmdW5jIHdyaXRlKHRvIHByb3RvOiBUUHJvdG9jb2wpIHRocm93cyB7CisgICAgdHJ5IHByb3RvLndyaXRlU2V0QmVnaW4oZWxlbWVudFR5cGU6IEVsZW1lbnQudGhyaWZ0VHlwZSwgc2l6ZTogSW50MzIoc2VsZi5jb3VudCkpCisgICAgZm9yIGVsZW1lbnQgaW4gc2VsZi5zdG9yYWdlIHsKKyAgICAgIHRyeSBFbGVtZW50LndyaXRlKGVsZW1lbnQsIHRvOiBwcm90bykKKyAgICB9CisgICAgdHJ5IHByb3RvLndyaXRlU2V0RW5kKCkKKyAgfQorfQorCitleHRlbnNpb24gVFNldDogQ3VzdG9tU3RyaW5nQ29udmVydGlibGUsIEN1c3RvbURlYnVnU3RyaW5nQ29udmVydGlibGUgeworICBwdWJsaWMgdmFyIGRlc2NyaXB0aW9uIDogU3RyaW5nIH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JUU29ja2V0U2VydmVyUHJvY2Vzc29yIgorcHVibGljIGxldCBUU29ja2V0U2VydmVyVHJhbnNwb3J0S2V5ID0gIlRTb2NrZXRTZXJ2ZXJUcmFuc3BvcnQiCisKK2NsYXNzIFRTb2NrZXRTZXJ2ZXI8SW5Qcm90b2NvbDogVFByb3RvY29sLCBPdXRQcm90b2NvbDogVFByb3RvY29sLCBQcm9jZXNzb3I6IFRQcm9jZXNzb3IsIFNlcnZpY2U+IHdoZXJlIFByb2Nlc3Nvci5TZXJ2aWNlID09IFNlcnZpY2UgeworICB2YXIgc29ja2V0RmlsZUhhbmRsZTogRmlsZUhhbmRsZQorICB2YXIgcHJvY2Vzc2luZ1F1ZXVlID0gIERpc3BhdGNoUXVldWUobGFiZWw6ICJUU29ja2V0U2VydmVyLnByb2Nlc3NpbmciLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcW9zOiAuYmFja2dyb3VuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZXM6IC5jb25jdXJyZW50KQorICB2YXIgc2VydmljZUhhbmRsZXI6IFNlcnZpY2UKKworICBwdWJsaWMgaW5pdChwb3J0OiBJbnQsCisgICAgICAgICAgICAgIHNlcnZpY2U6IFNlcnZpY2UsCisgICAgICAgICAgICAgIGluUHJvdG9jb2w6IEluUHJvdG9jb2wuVHlwZSwKKyAgICAgICAgICAgICAgb3V0UHJvdG9jb2w6IE91dFByb3RvY29sLlR5cGUsCisgICAgICAgICAgICAgIHByb2Nlc3NvcjogUHJvY2Vzc29yLlR5cGUpIHRocm93cyB7CisgICAgLy8gc2V0IHNlcnZpY2UgaGFuZGxlcgorICAgIHNlbGYuc2VydmljZUhhbmRsZXIgPSBzZXJ2aWNlCisKKyAgICAvLyBjcmVhdGUgYSBzb2NrZXQKKyAgICB2YXIgZmQ6IEludDMyID0gLTEKKyAgICAjaWYgb3MoTGludXgpCisgICAgICBsZXQgc29jayA9IENGU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46IFVJbnQ4KE1lbW9yeUxheW91dDxzb2NrYWRkcl9pbj4uc2l6ZSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX2ZhbWlseTogc2FfZmFtaWx5X3QoQUZfSU5FVCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX3BvcnQ6IGluX3BvcnRfdChwb3J0LmJpZ0VuZGlhbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX2FkZHI6IGluX2FkZHIoc19hZGRyOiBpbl9hZGRyX3QoMCkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpbl96ZXJvOiAoMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCkpCisgICAgICAjZW5kaWYKKworICAgICAgbGV0IHB0ciA9IHdpdGhVbnNhZmVQb2ludGVyKHRvOiAmYWRkcikgeworICAgICAgICByZXR1cm4gVW5zYWZlUG9pbnRlcjxVSW50OD4oT3BhcXVlUG9pbnRlcigkMCkpCisgICAgICB9CisKKyAgICAgIGxldCBhZGRyZXNzID0gRGF0YShieXRlczogcHRyLCBjb3VudDogTWVtb3J5TGF5b3V0PHNvY2thZGRyX2luPi5zaXplKQorCisgICAgICBsZXQgY2ZhZGRyID0gYWRkcmVzcy53aXRoVW5zYWZlQnl0ZXMgeworICAgICAgICBDRkRhdGFDcmVhdGVXaXRoQnl0ZXNOb0NvcHkoa0NGQWxsb2NhdG9yRGVmYXVsdCwgJDAsIGFkZHJlc3MuY291bnQsIG5pbCkKKyAgICAgIH0KKyAgICAgIGlmIENGU29ja2V0U2V0QWRkcmVzcyhzb2NrLCBjZmFkZHIpICE9IENGU29ja2V0RXJyb3Iuc3VjY2VzcyB7IC8va0NGU29ja2V0U3VjY2VzcyB7CisgICAgICAgIENGU29ja2V0SW52YWxpZGF0ZShzb2NrKQorICAgICAgICBwcmludCgiVFNvY2tldFNlcnZlcjogQ291bGQgbm90IGJpbmQgdG8gYWRkcmVzcyIpCisgICAgICAgIHRocm93IFRUcmFuc3BvcnRFcnJvcihlcnJvcjogLm5vdE9wZW4sIG1lc3NhZ2U6ICJDb3VsZCBub3QgYmluZCB0byBhZGRyZXNzIikKKyAgICAgIH0KKworICAgIH0gZWxzZSB7CisgICAgICBwcmludCgiVFNvY2tldFNlcnZlcjogTm8gc2VydmVyIHNvY2tldCIpCisgICAgICB0aHJvdyBUVHJhbnNwb3J0RXJyb3IoZXJyb3I6IC5ub3RPcGVuLCBtZXNzYWdlOiAiQ291bGQgbm90IGNyZWF0ZSBzb2NrZXQiKQorICAgIH0KKworICAgIC8vIHdyYXAgaXQgaW4gYSBmaWxlIGhhbmRsZSBzbyB3ZSBjYW4gZ2V0IG1lc3NhZ2VzIGZyb20gaXQKKyAgICBzb2NrZXRGaWxlSGFuZGxlID0gRmlsZUhhbmRsZShmaWxlRGVzY3JpcHRvcjogZmQsIGNsb3NlT25EZWFsbG9jOiB0cnVlKQorCisgICAgLy8gdGhyb3cgYXdheSBvdXIgc29ja2V0CisgICAgQ0ZTb2NrZXRJbnZhbGlkYXRlKHNvY2spCisKKyAgICAvLyByZWdpc3RlciBmb3Igbm90aWZpY2F0aW9ucyBvZiBhY2NlcHRlZCBpbmNvbWluZyBjb25uZWN0aW9ucworICAgIF8gPSBOb3RpZmljYXRpb25DZW50ZXIuZGVmYXVsdC5hZGRPYnNlcnZlcihmb3JOYW1lOiAuTlNGaWxlSGFuZGxlQ29ubmVjdGlvbkFjY2VwdGVkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IG5pbCwgcXVldWU6IG5pbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW3dlYWsgc2VsZl0gbm90aWZpY2F0aW9uIGluCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWFyZCBsZXQgc3Ryb25nU2VsZiA9IHNlbGYgZWxzZSB7IHJldHVybiB9CisgICAgIC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XhwZWN0cyBzb2NrZXQgdGhhdHMgYWxyZWFkeSBib3VuZC9jb25uZWN0ZWQgKGkuZS4gZnJvbSBsaXN0ZW5pbmcpCisgIC8vLworICAvLy8gLSBwYXJhbWV0ZXIgc29ja2V0RGVzY3JpcHRvcjogcG9zaXggc29ja2V0IGRlc2NyaXB0b3IgKEludDMyKQorICBwdWJsaWMgaW5pdChzb2NrZXREZXNjcmlwdG9yOiBJbnQzMikgeworICAgIHNlbGYuc29ja2V0RGVzY3JpcHRvciA9IHNvY2tldERlc2NyaXB0b3IKKyAgfQorICAKKyAgCisgIHB1YmxpYyBjb252ZW5pZW5jZSBpbml0KGhvc3RuYW1lOiBTdHJpbmcsIHBvcnQ6IEludCkgdGhyb3dzIHsKKyAgICBndWFyZCBsZXQgaHAgPSBnZXRob3N0YnluYW1lKGhvc3RuYW1lLmNTdHJpbmcodXNpbmc6IC51dGY4KSEpPy5wb2ludGVlLAorICAgICAgbGV0IGhvc3RBZGRyID0gaW5fYWRkcihob3N0ZW50OiBocCkgZWxzZSB7CisgICAgICAgIHRocm93IFRUcmFuc3BvcnRFcnJvcihlcnJvcjogLnVua25vd24sIG1lc3NhZ2U6ICJJbnZhbGlkIGFkZHJlc3M6IFwoaG9zdG5hbWUpIikKKyAgICB9CisgICAgCisgICAgCisgICAgCisgICAgI2lmIG9zKExpbnV4KQorICAgICAgbGV0IHNvY2sgPSBzb2NrZXQoQUZfSU5FVCwgSW50MzIoU09DS19TVFJFQU0ucmF3VmFsdWUpLCAwKQorICAgICAgdmFyIGFkZHIgPSBzb2NrYWRkcl9pbihzaW5fZmFtaWx5OiBzYV9mYW1pbHlfdChBRl9JTkVUKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX3BvcnQ6IGluX3BvcnRfdChodG9ucyhVSW50MTYocG9ydCkpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX2FkZHI6IGhvc3RBZGRyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5femVybzogKDAsIDAsIDAsIDAsIDAsIDAsIDAsIDApKQorICAgICNlbHNlCisgICAgICBsZXQgc29jayA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgMCkKKyAgICAgIAorICAgICAgdmFyIGFkZHIgPSBzb2NrYWRkcl9pbihzaW5fbGVuOiBVSW50OChNZW1vcnlMYXlvdXQ8c29ja2FkZHJfaW4+LnNpemUpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5fZmFtaWx5OiBzYV9mYW1pbHlfdChBRl9JTkVUKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX3BvcnQ6IGluX3BvcnRfdChodG9ucyhVSW50MTYocG9ydCkpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luX2FkZHI6IGluX2FkZHIoc19hZGRyOiBpbl9hZGRyX3QoMCkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5femVybzogKDAsIDAsIDAsIDAsIDAsIDAsIDAsIDApKQorICAgICAgCisgICAgI2VuZGlmCisgICAgCisgICAgbGV0IGFkZHJQdHIgPSB3aXRoVW5zYWZlUG9pbnRlcih0bzogJmFkZHIpeyBVbnNhZmVQb2ludGVyPHNvY2thZGRyPihPcGFxdWVQb2ludGVyKCQwKSkgfQorICAgIAorICAgIGxldCBjb25uZWN0ZWQgPSBjb25uZWN0KHNvY2ssIGFkZHJQdHIsIFVJbnQzMihNZW1vcnlMYXlvdXQ8c29ja2FkZHJfaW4+LnNpemUpKQorICAgIGlmIGNvbm5lY3RlZCAhPSAwIHsKKyAgICAgIHRocm93IFRUcmFuc3BvcnRFcnJvcihlcnJvcjogLm5vdE9wZW4sIG1lc3NhZ2U6ICJFcnJvciBiaW5kaW5nIHRvIGhvc3Q6IFwoaG9zdG5hbWUpIFwocG9ydCkiKQorICAgIH0KKyAgICAKKyAgICBzZWxmLmluaXQoc29ja2V0RGVzY3JpcHRvcjogc29jaykKKyAgfQorICAKKyA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nB1dFN0cmVhbT8gPSBuaWwKKyAgICBwdWJsaWMgdmFyIG91dHB1dDogT3V0cHV0U3RyZWFtPyA9IG5pbAorICAgIAorICAgIHB1YmxpYyBpbml0KGlucHV0U3RyZWFtOiBJbnB1dFN0cmVhbT8sIG91dHB1dFN0cmVhbTogT3V0cHV0U3RyZWFtPykgeworICAgICAgaW5wdXQgICA9IGlucHV0U3RyZWFtCisgICAgICBvdXRwdXQgID0gb3V0cHV0U3RyZWFtCisgICAgfQorICAgIAorICAgIHB1YmxpYyBjb252ZW5pZW5jZSBpbml0KGlucHV0U3RyZWFtOiBJbnB1dFN0cmVhbT8pIHsKKyAgICAgIHNlbGYuaW5pdChpbnB1dFN0cmVhbTogaW5wdXRTdHJlYW0sIG91dHB1dFN0cmVhbTogbmlsKQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgY29udmVuaWVuY2UgaW5pdChvdXRwdXRTdHJlYW06IE91dHB1dFN0cmVhbT8pIHsKKyAgICAgIHNlbGYuaW5pdChpbnB1dFN0cmVhbTogbmlsLCBvdXRwdXRTdHJlYW06IG91dHB1dFN0cmVhbSkKKyAgICB9CisgICAgCisgICAgZGVpbml0IHsKKyAgICAgIGNsb3NlKCkKKyAgICB9CisgICAgCisgICAgcHVibGljIGZ1bmMgcmVhZEFsbChzaXplOiBJbnQpIHRocm93cyAtPiBEYXRhIHsKKyAgICAgIGd1YXJkIGxldCBpbnB1dCA9IGlucHV0IGVsc2UgeworICAgICAgICB0aHJvdyBUVHJhbnNwb3J0RXJyb3IoZXJyb3I6IC51bmtub3duKQorICAgICAgfQorICAgICAgCisgICAgICB2YXIgcmVhZCA9IERhdGEoKQorICAgICAgd2hpbGUgcmVhZC5jb3VudCA8IHNpemUgeworICAgICAgICB2YXIgYnVmZmVyID0gQXJyYXk8VUludDg+KHJlcGVhdGluZzogMCwgY291bnQ6IHNpemUgLSByZWFkLmNvdW50KQorICAgICAgICAKKyAgICAgICAgbGV0IGJ5dGVzUmVhZCA9IGJ1ZmZlci53aXRoVW5zYWZlTXV0YWJsZUJ1ZmZlclBvaW50ZXIgeyBidWZmZXJQdHIgaW4KKyAgICAgICAgICByZXR1cm4gaW5wdXQucmVhZChidWZmZXJQdHIuYmFzZUFkZHJlc3MhLCBtYXhMZW5ndGg6IHNpemUgLSByZWFkLmNvdW50KQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiBieXRlc1JlYWQgPD0gMCB7CisgICAgICAgICAgdGhyb3cgVFRyYW5zcG9ydEVycm9yKGVycm9yOiAubm90T3BlbikKKyAgICAgICAgfQorICAgICAgICByZWFkLmFwcGVuZChEYXRhKGJ5dGVzOiBidWZmZXIpKQorICAgICAgfQorICAgICAgcmV0dXJuIHJlYWQKKyAgICB9CisgICAgCisgICAgcHVibGljIGZ1bmMgcmVhZChzaXplOiBJbnQpIHRocm93cyAtPiBEYXRhIHsKKyAgICAgIGd1YXJkIGxldCBpbnB1dCA9IGlucHV0IGVsc2UgeworICAgICAgICB0aHJvdyBUVHJhbnNwb3J0RXJyb3IoZXJyb3I6IC51bmtub3duKQorICAgICAgfQorICAgICAgCisgICAgICB2YXIgcmVhZCA9IERhdGEoKQorICAgICAgd2hpbGUgcmVhZC5jb3VudCA8IHNpemUgeworICAgICAgICB2YXIgYnVmZmVyID0gQXJyYXk8VUludDg+KHJlcGVhdGluZzogMCwgY291bnQ6IHNpemUgLSByZWFkLmNvdW50KQorICAgICAgICBsZXQgYnl0ZXNSZWFkID0gYnVmZmVyLndpdGhVbnNhZmVNdXRhYmxlQnVmZmVyUG9pbnRlciB7CisgICAgICAgICAgaW5wdXQucmVhZCgkMC5iYXNlQWRkcmVzcyEsIG1heExlbmd0aDogc2l6ZSAtIHJlYWQuY291bnQpCisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIGJ5dGVzUmVhZCA8PSAwIHsKKyAgICAgICAgICBicmVhaworICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZWFkLmFwcGVuZChEYXRhKGJ5dGVzOiBidWZmZXIpKQorICAgICAgfQorICAgICAgcmV0dXJuIHJlYWQKKyAgICB9CisgICAgCisgICAgcHVibGljIGZ1bmMgd3JpdGUoZGF0YTogRGF0YSkgdGhyb3dzIHsKKyAgICAgIGd1YXJkIGxldCBvdXRwdXQgPSBvdXRwdXQgZWxzZSB7CisgICAgICAgIHRocm93IFRUcmFuc3BvcnRFcnJvcihlcnJvcjogLnVua25vd24pCisgICAgICB9CisgICAgICAKKyAgICAgIHZhciBieXRlc1dyaXR0ZW4gPSAwCisgICAgICB3aGlsZSBieXRlc1dyaXR0ZW4gPCBkYXRhLmNvdW50IHsKKyAgICAgICAgYnl0ZXNXcml0dGVuID0gZGF0YS53aXRoVW5zYWZlQnl0ZXMgeworICAgICAgICAgIHJldHVybiBvdXRwdXQud3JpdGUoJDAsIG1heExlbmd0aDogZGF0YS5jb3VudCkKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgYnl0ZXNXcml0dGVuID09IC0xIHsKKyAgICAgICAgICB0aHJvdyBUVHJhbnNwb3J0RXJyb3IoZXJyb3I6IC5ub3RPcGVuKQorICAgICAgICB9IGVsc2UgaWYgYnl0ZXNXcml0dGVuID09IDAgeworICAgICAgICAgIHRocm93IFRUcmFuc3BvcnRFcnJvcihlcnJvcjogLmVuZE9mRmlsZSkKKyAgICAgICAgfQorICAgICAgfQorICAgIH0KKyAgICAKKyAgICAKKyAgICBwdWJsaWMgZnVuYyBmbHVzaCgpIHRocm93cyB7CisgICAgICByZXR1cm4KKyAgICB9CisgICAgCisgICAgcHVibGljIGZ1bmMgY2xvc2UoKSB7CisgICAgICAKKyAgICAgIGlmIGlucHV0ICE9IG5pbCB7CisgICAgICAgIC8vIENsb3NlIGFuZCByZXNldCBpbnB1dHN0cmVhbQorICAgICAgICBpZiBsZXQgY2Y6IENGUmVhZFN0cmVhbSA9IGlucHV0IHsKKyAgICAgICAgICBDRlJlYWRTdHJlYW1TZXRQcm9wZXJ0eShjZiwgLnNob3VsZENsb3N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9uIFwodHdvKSIpCisKKyAgICBsZXQgdU1heE1pbnVzT25lOiBVSW50MzIgPSBVSW50MzIubWF4IC0gMQorICAgIFhDVEFzc2VydEVxdWFsKHByb3RvLmkzMlRvWmlnWmFnKG1heCksIHVNYXhNaW51c09uZSwgIkVycm9yIDMyYml0IHppZ3phZyBvbiBcKG1heCkiKQorICAgIFhDVEFzc2VydEVxdWFsKHByb3RvLnppZ1phZ1RvaTMyKHVNYXhNaW51c09uZSksIG1heCwgIkVycm9yIDMyYml0IHppZ3phZyBvbiBcKG1heCkiKQorCisgICAgWENUQXNzZXJ0RXF1YWwocHJvdG8uaTMyVG9aaWdaYWcobWluKSwgVUludDMyLm1heCwgIkVycm9yIDMyYml0IHppZ3phZyBvbiBcKG1pbikiKQorICAgIFhDVEFzc2VydEVxdWFsKHByb3RvLnppZ1phZ1RvaTMyKFVJbnQzMi5tYXgpLCBtaW4sICJFcnJvciAzMmJpdCB6aWd6YWcgb24gXChtaW4pIikKKyAgfQorCisgIGZ1bmMgdGVzdEludDY0WmlnWmFnKCkgeworICAgIGxldCB6ZXJvOiBJbnQ2NCA9IDAKKyAgICBsZXQgb25lOiBJbnQ2NCA9IDEKKyAgICBsZXQgbk9uZTogSW50NjQgPSAtMQorICAgIGxldCB0d286IEludDY0ID0gMgorICAgIGxldCBuVHdvOiBJbnQ2NCA9IC0yCisgICAgbGV0IG1heCA9IEludDY0Lm1heAorICAgIGxldCBtaW4gPSBJbnQ2NC5taW4KKworICAgIFhDVEFzc2VydEVxdWFsKHByb3RvLmk2NFRvWmlnWmFnKHplcm8pLCBVSW50NjQoMCksICJFcnJvciA2NGJpdCB6aWd6YWcgb24gXCh6ZXJvKSIpCisgICAgWENUQXNzZXJ0RXF1YWwocHJvdG8uemlnWmFnVG9pNjQoMCksIHplcm8sICJFcnJvciA2NGJpdCB6aWd6YWcgb24gXCh6ZXJvKSIpCisKKyAgICBYQ1RBc3NlcnRFcXVhbChwcm90by5pNjRUb1ppZ1phZyhuT25lK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WNlIFR5cGUgeworICAgICdTVE9QJzogbnVtYmVyOworICAgICdWT0lEJzogbnVtYmVyOworICAgICdCT09MJzogbnVtYmVyOworICAgICdCWVRFJzogbnVtYmVyOworICAgICdJMDgnOiBudW1iZXI7CisgICAgJ0RPVUJMRSc6IG51bWJlcjsKKyAgICAnSTE2JzogbnVtYmVyOworICAgICdJMzInOiBudW1iZXI7CisgICAgJ0k2NCc6IG51bWJlcjsKKyAgICAnU1RSSU5HJzogbnVtYmVyOworICAgICdVVEY3JzogbnVtYmVyOworICAgICdTVFJVQ1QnOiBudW1iZXI7CisgICAgJ01BUCc6IG51bWJlcjsKKyAgICAnU0VUJzogbnVtYmVyOworICAgICdMSVNUJzogbnVtYmVyOworICAgICdVVEY4JzogbnVtYmVyOworICAgICdVVEYxNic6IG51bWJlcjsKKyAgfQorICB2YXIgVHlwZTogVHlwZTsKKworICAvKioKKyAgICogVGhyaWZ0IFJQQyBtZXNzYWdlIHR5cGUgc3RyaW5nIHRvIElkIG1hcHBpbmcuCisgICAqIEBwcm9wZXJ0eSB7bnVtYmVyfSAgQ0FMTCAgICAgIC0gUlBDIGNhbGwgc2VudCBmcm9tIGNsaWVudCB0byBzZXJ2ZXIuCisgICAqIEBwcm9wZXJ0eSB7bnVtYmVyfSAgUkVQTFkgICAgIC0gUlBDIGNhbGwgbm9ybWFsIHJlc3BvbnNlIGZyb20gc2VydmVyIHRvIGNsaWVudC4KKyAgICogQHByb3BlcnR5IHtudW1iZXJ9ICBFWENFUFRJT04gLSBSUEMgY2FsbCBleGNlcHRpb24gcmVzcG9uc2UgZnJvbSBzZXJ2ZXIgdG8gY2xpZW50LgorICAgKiBAcHJvcGVydHkge251bWJlcn0gIE9ORVdBWSAgICAtIE9uZXdheSBSUEMgY2FsbCBmcm9tIGNsaWVudCB0byBzZXJ2ZXIgd2l0aCBubyByZXNwb25zZS4KKyAgICovCisgIGludGVyZmFjZSBNZXNzYWdlVHlwZSB7CisgICAgJ0NBTEwnOiBudW1iZXI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uCisgICAgICogQHBhcmFtIHtzdHJpbmd9IGJ1ZiAtIFRoZSBidWZmZXIgdG8gcmVjZWl2ZSBzZXJ2ZXIgcmVzcG9uc2VzLgorICAgICAqLworICAgIHNldFJlY3ZCdWZmZXIoYnVmOiBzdHJpbmcpOiB2b2lkOworCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSB0cmFuc3BvcnQgaXMgb3BlbgorICAgICAqIEByZXR1cm5zIHtib29sZWFufSAKKyAgICAgKi8KKyAgICBpc09wZW4oKTogYm9vbGVhbjsKKworICAgIC8qKgorICAgICAqIE9wZW5zIHRoZSB0cmFuc3BvcnQgY29ubmVjdGlvbgorICAgICAqLworICAgIG9wZW4oKTogdm9pZDsKKworICAgIC8qKgorICAgICAqIENsb3NlcyB0aGUgdHJhbnNwb3J0IGNvbm5lY3Rpb24KKyAgICAgKi8KKyAgICBjbG9zZSgpOiB2b2lkOworCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgc3BlY2lmaWVkIG51bWJlciBvZiBjaGFyYWN0ZXJzIGZyb20gdGhlIHJlc3BvbnNlCisgICAgICogYnVmZmVyLgorICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsZW4gLSBUaGUgbnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gcmV0dXJuLgorICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IENoYXJhY3RlcnMgc2VudCBieSB0aGUgc2VydmVyLgorICAgICAqLworICAgIHJlYWQobGVuOiBudW1iZXIpOiBzdHJpbmc7CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBlbnRpcmUgcmVzcG9uc2UgYnVmZmVyLgorICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IENoYXJhY3RlcnMgc2VudCBieSB0aGUgc2VydmVyLgorICAgICAqLworICAgIHJlYWRBbGwoKTogc3RyaW5nOworCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgc2VuZCBidWZmZXIgdG8gYnVmLgorICAg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AorICAgICAqICJkYmwiIC0+IFRocmlmdC5UeXBlLkRPVUJMRQorICAgICAqICJyZWMiIC0+IFRocmlmdC5UeXBlLlNUUlVDVAorICAgICAqICJzdHIiIC0+IFRocmlmdC5UeXBlLlNUUklORworICAgICAqICJtYXAiIC0+IFRocmlmdC5UeXBlLk1BUCAgIAorICAgICAqICJsc3QiIC0+IFRocmlmdC5UeXBlLkxJU1QgIAorICAgICAqICJzZXQiIC0+IFRocmlmdC5UeXBlLlNFVCAgIAorICAgICAqLworICAgIFJUeXBlOiB7IFtrOiBzdHJpbmddOiBudW1iZXIgfTsKKworICAgIC8qKgorICAgICAqIFRoZSBUSlNPTlByb3RvY29sIHZlcnNpb24gbnVtYmVyLgorICAgICAqLworICAgIFZlcnNpb246IG51bWJlcjsKKworICAgIC8qKgorICAgICAqIEluaXRpYWxpemVzIGEgVGhyaWZ0IEpTT04gcHJvdG9jb2wgaW5zdGFuY2UuCisgICAgICogQHBhcmFtIHtUaHJpZnQuVHJhbnNwb3J0fSB0cmFuc3BvcnQgLSBUaGUgdHJhbnNwb3J0IHRvIHNlcmlhbGl6ZSB0by9mcm9tLgorICAgICAqLworICAgIGNvbnN0cnVjdG9yKHRyYW5zcG9ydDogT2JqZWN0KTsKKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHVuZGVybHlpbmcgdHJhbnNwb3J0LgorICAgICAqIEByZXR1cm5zIHtUaHJpZnQuVHJhbnNwb3J0fSBUaGUgdW5kZXJseWluZyB0cmFuc3BvcnQuCisgICAgICovCisgICAgZ2V0VHJhbnNwb3J0KCk6IE9iamVjdDsKKworICAgIC8qKgorICAgICAqIFNlcmlhbGl6ZXMgdGhlIGJlZ2lubmluZyBvZiBhIFRocmlmdCBSUEMgbWVzc2FnZS4KKyAgICAgKiBAcGFyYW0ge3N0cmluZ30gbmFtZSAtIFRoZSBzZXJ2aWNlIG1ldGhvZCB0byBjYWxsLgorICAgICAqIEBwYXJhbSB7VGhyaWZ0Lk1lc3NhZ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CisKKyAgPGNvbXBsZXhUeXBlIG5hbWU9IkNvbnN0TGlzdCI+CisgICAgPHNlcXVlbmNlPgorICAgICAgPGVsZW1lbnQgbmFtZT0iZW50cnkiIG1pbk9jY3Vycz0iMCIgbWF4T2NjdXJzPSJ1bmJvdW5kZWQiPgorICAgICAgICA8Y29tcGxleFR5cGU+CisgICAgICAgICAgPGdyb3VwIHJlZj0idG5zOkNvbnN0VmFsdWUiIC8+CisgICAgICAgIDwvY29tcGxleFR5cGU+CisgICAgICA8L2VsZW1lbnQ+CisgICAgPC9zZXF1ZW5jZT4KKyAgPC9jb21wbGV4VHlwZT4KKworICA8Y29tcGxleFR5cGUgbmFtZT0iQ29uc3RNYXAiPgorICAgIDxzZXF1ZW5jZT4KKyAgICAgIDxlbGVtZW50IG5hbWU9ImVudHJ5IiBtaW5PY2N1cnM9IjAiIG1heE9jY3Vycz0idW5ib3VuZGVkIj4KKyAgICAgICAgPGNvbXBsZXhUeXBlPgorICAgICAgICAgIDxzZXF1ZW5jZT4KKyAgICAgICAgICAgIDxlbGVtZW50IG5hbWU9ImtleSI+CisgICAgICAgICAgICAgIDxjb21wbGV4VHlwZT4KKyAgICAgICAgICAgICAgICA8Z3JvdXAgcmVmPSJ0bnM6Q29uc3RWYWx1ZSIgLz4KKyAgICAgICAgICAgICAgPC9jb21wbGV4VHlwZT4KKyAgICAgICAgICAgIDwvZWxlbWVudD4KKyAgICAgICAgICAgIDxlbGVtZW50IG5hbWU9InZhbHVlIj4KKyAgICAgICAgICAgICAgPGNvbXBsZXhUeXBlPgorICAgICAgICAgICAgICAgIDxncm91cCByZWY9InRuczpDb25zdFZhbHVlIiAvPgorICAgICAgICAgICAgICA8L2NvbXBsZXhUeXBlPgorICAgICAgICAgICAgPC9lbGVtZW50PgorICAgICAgICAgIDwvc2VxdWVuY2U+CisgICAgICAgIDwvY29tcGxleFR5cGU+CisgICAgICA8L2VsZW1lbnQ+CisgICAgPC9zZXF1ZW5jZT4KKyAgPC9jb21wbGV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AorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjaGFsayI6ICJeMi4wLjAiLAorICAgICAgICAiZXN1dGlscyI6ICJeMi4wLjIiLAorICAgICAgICAianMtdG9rZW5zIjogIl40LjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJAdHlwZXMvbm9kZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEwLjEyLjYiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL0B0eXBlcy9ub2RlLy0vbm9kZS0xMC4xMi42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi0rWldCNUVjMWlraTk5eFFGekJsaXZsS3hTWlErZnVVS0JvdHQ4U3RCT25MTjRkV2JSSGxnZGcxWGtucFc2ZzB0d2VuaU41RGNPcUE2NENKeU9VUFNBdz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiQHR5cGVzL3EiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjUuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvQHR5cGVzL3EvLS9xLTEuNS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1lcXo4Yy8wa3dOaS9PRUhRZnZJdUpWTFRzdDNpbjBlN3VUS2V1WStXTC96ZktuMHhWdWpPVHA0MmJTL3ZVVW9raEs1UDJCcHBMZDlKWE1PTUhjZ2JqQT09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiYWJicmV2IjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjkiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2FiYnJldi8tL2FiYnJldi0xLjAuOS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWtiUjVKWWluYzR3bDgxM1c5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yAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9jYWxsc2l0ZXMvLS9jYWxsc2l0ZXMtMC4yLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1yNnVXSmlrUXAvTThHYVYzV0NYR256VGpVTW89IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiY2F0aGFyc2lzIjogeworICAgICAgInZlcnNpb24iOiAiMC44LjkiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NhdGhhcnNpcy8tL2NhdGhhcnNpcy0wLjguOS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLW1NeUpES1pTM1M3dzV3czNrbE1RLzU2US9Jcz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ1bmRlcnNjb3JlLWNvbnRyaWIiOiAifjAuMy4wIgorICAgICAgfQorICAgIH0sCisgICAgImNoYWxrIjogeworICAgICAgInZlcnNpb24iOiAiMi40LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NoYWxrLy0vY2hhbGstMi40LjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU9iTjZoMXYyZlRKU21VWG9TM25NUTkyTGJESzliZTRUVis2RytvbVFsR0pGZGNVWDVoZUtpMUxaMVluUk1JZ3dUTEVqM0UyNGJUNnRZbmk1MHJsQ2ZRPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhbnNpLXN0eWxlcyI6ICJeMy4yLjEiLAorICAgICAgICAiZXNjYXBlLXN0cmluZy1yZWdleHAiOiAiXjEuMC41IiwKKyAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogIl41LjMuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJjaGFyZGV0IjogeworICAgICAgInZlcnNpb24iOiAiMC43LjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NoYXJkZXQvLS9jaGFyZGV0LTAuNy4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1tVDhpRGNyaDAzcURHUlJtb0EyaG1CSm54cGxsTVIrMC8wcWx6anFaRVM2TmRpV0RjWmtDTkFrNHJQRlo5UTg1cjI3dW5raU5OZzhaT2l3WlhCSHdjQT09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiY2hvd25yIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2Nob3duci8tL2Nob3duci0xLjEuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItajM4RXZPNStMSFg4NGpsbzZoNFV6bU93aTBVZ1c2MVdSeVB0Sno0cWFhZEs1ZVkzQlRTNVRZL1MxU3RjM1VrMmxJTTZUUGV2QWxVTGlFSndpZTg2MGc9PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImNpcmN1bGFyLWpzb24iOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjMuMyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvY2lyY3VsYXItanNvbi8tL2NpcmN1bGFyLWpzb24tMC4zLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVVaSzNOQngyTWNhK2I1THNHN2JZMTgzcEhXdDVZMXh0czRQM1B6N0VOVHdHVm5KT1VXYlJiM29janZYN2h4OXRxL3lUQWRjbFhtOXNaMzhnTnVlbTRBPT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJjbGktY3Vyc29yIjogeworICAgICAgInZlcnNpb24iOi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8tcHJpbWl0aXZlLy0vZXMtdG8tcHJpbWl0aXZlLTEuMi4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1xWnJ5Qk9KalYvL0xheExUVjZVQy8vV2V3bmVCM0xjWE9MOU5QKytvektWWHNJSUlwbS8yYzEzVURpRDlKcDJlVGhzZWN3OW0zalBxRHdUeW9iY2RiZz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaXMtY2FsbGFibGUiOiAiXjEuMS40IiwKKyAgICAgICAgImlzLWRhdGUtb2JqZWN0IjogIl4xLjAuMSIsCisgICAgICAgICJpcy1zeW1ib2wiOiAiXjEuMC4yIgorICAgICAgfQorICAgIH0sCisgICAgImVzY2FwZS1odG1sIjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2VzY2FwZS1odG1sLy0vZXNjYXBlLWh0bWwtMS4wLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1BbGpxNU5QUXdKZE40Y0ZwR0k3d0JSMGRHWWc9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiZXNjYXBlLXN0cmluZy1yZWdleHAiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuNSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXNjYXBlLXN0cmluZy1yZWdleHAvLS9lc2NhcGUtc3RyaW5nLXJlZ2V4cC0xLjAuNS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUcySEFWaUdRcU4vMnJqdXl6d0lBeWhNTGh0UT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJlc2NvZGVnZW4iOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjguMSIsCisgICAgICAicmVzb2x2ZWQi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AgfSwKKyAgICAiZXNsaW50IjogeworICAgICAgInZlcnNpb24iOiAiNS43LjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2VzbGludC8tL2VzbGludC01LjcuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItellDZUZRYWhzeGZmR2w4N1UyYUo3RFB5SDhDYldneEJDMjEzWTgrVENhbmhVVGYyZ0V2ZnEzRUtwSG1FY296VEx5UG1HZTlMWmRNQXdDL0NwSkJNNUE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgIkBiYWJlbC9jb2RlLWZyYW1lIjogIl43LjAuMCIsCisgICAgICAgICJhanYiOiAiXjYuNS4zIiwKKyAgICAgICAgImNoYWxrIjogIl4yLjEuMCIsCisgICAgICAgICJjcm9zcy1zcGF3biI6ICJeNi4wLjUiLAorICAgICAgICAiZGVidWciOiAiXjQuMC4xIiwKKyAgICAgICAgImRvY3RyaW5lIjogIl4yLjEuMCIsCisgICAgICAgICJlc2xpbnQtc2NvcGUiOiAiXjQuMC4wIiwKKyAgICAgICAgImVzbGludC11dGlscyI6ICJeMS4zLjEiLAorICAgICAgICAiZXNsaW50LXZpc2l0b3Ita2V5cyI6ICJeMS4wLjAiLAorICAgICAgICAiZXNwcmVlIjogIl40LjAuMCIsCisgICAgICAgICJlc3F1ZXJ5IjogIl4xLjAuMSIsCisgICAgICAgICJlc3V0aWxzIjogIl4yLjAuMiIsCisgICAgICAgICJmaWxlLWVudHJ5LWNhY2hlIjogIl4yLjAuMCIsCisgICAgICAgICJmdW5jdGlvbmFsLXJlZC1ibGFjay10cmVlIjogIl4xLjAuMSIsCisgICAgICAgICJnbG9iIjogIl43LjEuMiIsCisgICAgICAgICJnbG9iYWxzIjogIl4xMS43LjAiLAorICAgICAgICAiaWdub3JlIjogIl40LjAuNiIsCisgICAgICAgICJpbXVybXVyaGFzaCI6ICJeMC4xLjQiLAorICAgICAgICAiaW5xdWlyZXIiOiAiXjYuMS4wIiwKKyAgICAgICAgImlzLXJlc29sdmFibGUiOiAiXjEuMS4wIiwKKyAgICAgICAgImpzLXlhbWwiOiAiXjMuMTIuMCIsCisgICAgICAgICJqc29uLXN0YWJsZS1zdHJpbmdpZnktd2l0aG91dC1qc29uaWZ5IjogIl4xLjAuMSIsCisgICAgICAgICJsZXZuIjogIl4wLjMuMCIsCisgICAgICAgICJsb2Rhc2giOiAiXjQuMTcuNSIsCisgICAgICAgICJtaW5pbWF0Y2giOiAiXjMuMC40IiwKKyAgICAgICAgIm1rZGlycCI6ICJeMC41LjEiLAorICAgICAgICAibmF0dXJhbC1jb21wYXJlIjogIl4xLjQuMCIsCisgICAgICAgICJvcHRpb25hdG9yIjogIl4wLjguMiIsCisgICAgICAgICJwYXRoLWlzLWluc2lkZSI6ICJeMS4wLjIiLAorICAgICAgICAicGx1cmFsaXplIjogIl43LjAuMCIsCisgICAgICAgICJwcm9ncmVzcyI6ICJeMi4wLjAiLAorICAgICAgICAicmVnZXhwcCI6ICJeMi4wLjEiLAorICAgICAgICAicmVxdWlyZS11bmNhY2hlZCI6ICJeMS4wLjMiLAorICAgICAgICAic2VtdmVyIjogIl41LjUuMSIsCisgICAgICAgICJzdHJpcC1hbnNpIjogIl40LjAuMCIsCisgICAgICAgICJzdHJpcC1qc29uLWNvbW1lbnRzIjogIl4yLjAuMSIsCisgICAgICAgICJ0YWJsZSI6ICJeNS4wLjIiLAorICAgICAgICAidGV4dC10YWJsZSI6ICJeMC4yLjAiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImRlYnVnIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjQuMS4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZGVidWcvLS9kZWJ1Zy00LjEuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWhlTlBKVUpJcUMreEI2YXlMQU1IYUlybU45SEthN2FRTzhNR3FLcHZDQSt1SllWY3ZSNmw1a2dkcmhSdXdQRkhVN1A1L0ExdzBCakJ5UEh3cGZUREtnPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJtcyI6ICJeMi4xLjEiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAibXMiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMi4xLjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9tcy8tL21zLTIuMS4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItdGdwK2RsNWNHazI4dXRZa3RCc3JGcUE3SEtncmhnUHNnNlovRWZoV0k0Z2wxSHdxOEIvR21ZLzBvWFo2bkY4aERWZXNTL0ZwbllhRC9rT1doWVF2eWc9PSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImVzbGludC1jb25maWctcHJldHRpZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjEuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXNsaW50LWNvbmZpZy1wcmV0dGllci8tL2VzbGludC1jb25maWctcHJldHRpZXItMy4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVFZR2ZtenVjNHE0SjZYSWhscDh2UktkSS9mSTB0UWZRUHkxZE1FM1VPTHByRSt2NHNzSC8zVzlMTTJRN2g1cUJjeTVtMGVoQ3JCRFUyWUY4cTZPWTh3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJnZXQtc3RkaW4iOiAiXjYuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImVzbGludC1wbHVnaW4tcHJldHRpZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIzLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXNsaW50LXBsdWdpbi1wcmV0dGllci8tL2VzbGludC1wbHVnaW4tcHJldHRpZXItMy4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLTRnMTFvcHpocXEvOCtBTW1vNVZjMkduN3o5YWxaNEpxcmJaK0Q0aThLbFN5eGVRaFpIbG1Jclk4VTlBa2Y1MTRNb0Vob2dQYTg3SmdrcTg3YVoyT2h3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJwcmV0dGllci1saW50ZXItaGVscGVycyI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAiZXNsaW50LXNjb3BlIjogeworICAgICAgInZlcnNpb24iOiAiNC4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2VzbGludC1zY29wZS8tL2VzbGludC1zY29wZS00LjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItMUc2VVREaTdKYzFFTEZ3blI1OEhWNGZLOU9RSzRTNk45ODVmMTY2eHFYeHBqVTZwbHhGSVNKYTJCYTlLQ1F1RmE4UkNuai9sU0ZKYkhvN1VGREJuVUE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImVzcmVjdXJzZSI6ICJeNC4xLjAiLAorICAgICAgICAiZXN0cmF2ZXJzZSI6ICJeNC4xLjEiCisgICAgICB9CisgICAgfSwKKyAgICAiZXNsaW50LXV0aWxzIjogeworICAgICAgInZlcnNpb24iOiAiMS4zLjEiLAorICAgICAgInJlc29sdmVkIjog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AiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImVzY2FwZS1zdHJpbmctcmVnZXhwIjogIl4xLjAuNSIKKyAgICAgIH0KKyAgICB9LAorICAgICJmaWxlLWVudHJ5LWNhY2hlIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2ZpbGUtZW50cnktY2FjaGUvLS9maWxlLWVudHJ5LWNhY2hlLTIuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtdzVLWkRENW9SNFBZT0xqSVNrWFlvRWhGZzJFPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImZsYXQtY2FjaGUiOiAiXjEuMi4xIiwKKyAgICAgICAgIm9iamVjdC1hc3NpZ24iOiAiXjQuMC4xIgorICAgICAgfQorICAgIH0sCisgICAgImZpbmFsaGFuZGxlciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9maW5hbGhhbmRsZXIvLS9maW5hbGhhbmRsZXItMS4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS16Z3RvVmJSWVUrZVJzdnpHZ0FSdGlDVTkxL1U9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZGVidWciOiAiMi42LjkiLAorICAgICAgICAiZW5jb2RldXJsIjogIn4xLjAuMSIsCisgICAgICAgICJlc2NhcGUtaHRtbCI6ICJ+MS4wLjMiLAorICAgICAgICAib24tZmluaXNoZWQiOiAifjIuMy4wIiwKKyAgICAgICAgInBhcnNldXJsIjogIn4xLjMuMiIsCisgICAgICAgICJzdGF0dXNlcyI6ICJ+MS4zLj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WWJnNWlqd1Jvcm43eWZXVk44PSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfSwKKyAgICAgICAgImlzLWZ1bGx3aWR0aC1jb2RlLXBvaW50IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaXMtZnVsbHdpZHRoLWNvZGUtcG9pbnQvLS9pcy1mdWxsd2lkdGgtY29kZS1wb2ludC0xLjAuMC50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS03NTR4T0c4REduOE5aRHI0TDk1UXhGZnZBTXM9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAibnVtYmVyLWlzLW5hbiI6ICJeMS4wLjAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAic3RyaW5nLXdpZHRoIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMC4yIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3RyaW5nLXdpZHRoLy0vc3RyaW5nLXdpZHRoLTEuMC4yLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUVZdmZXNHpjVWFLbjV3MGhIZ2Zpc0xteEI5TT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJjb2RlLXBvaW50LWF0IjogIl4xLjAuMCIsCisgICAgICAgICAgICAiaXMtZnVsbHdpZHRoLWNvZGUtcG9pbnQiOiAiXjEuMC4wIiwKKyAgICAgICAgICAgICJzdHJpcC1hbnNpIjogIl4zLjAuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJzdHJpcC1hbnNpIjogeworICAgICA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Gd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS02OWhHWjhvTnV6TUxtYno4YU9yQ3ZGUTNEZzA9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiYXJyYXktdW5pb24iOiAiXjEuMC4xIiwKKyAgICAgICAgImFycmlmeSI6ICJeMS4wLjAiLAorICAgICAgICAiZ2xvYiI6ICJeNy4wLjMiLAorICAgICAgICAib2JqZWN0LWFzc2lnbiI6ICJeNC4wLjEiLAorICAgICAgICAicGlmeSI6ICJeMi4wLjAiLAorICAgICAgICAicGlua2llLXByb21pc2UiOiAiXjIuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgImdyYWNlZnVsLWZzIjogeworICAgICAgInZlcnNpb24iOiAiNC4xLjExIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ncmFjZWZ1bC1mcy8tL2dyYWNlZnVsLWZzLTQuMS4xMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLURvdmY1TkhkdUlWTlpPQk9wOEFPS2dKdVZsZz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJoYW5kbGViYXJzIjogeworICAgICAgInZlcnNpb24iOiAiNC4wLjEyIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9oYW5kbGViYXJzLy0vaGFuZGxlYmFycy00LjAuMTIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVJobVRla1ArRlpMK1hOaHdTMVdmK2JUVFpwZExvdWd3dDVwY2dBMXR1ejZKY3gwZnBILzd6MHFkNzFSS25aSEJDeElSQkhmQk9uaW80Z1ZpUGVtTnpBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhc3luYyI6ICJeMi41LjAiLAorICAgICAgICAib3B0aW1pc3QiOiAiXjAuNi4xIiwKKyAgICAgICAgInNvdXJjZS1tYXAiOiAiXjAuNi4xIiwKKyAgICAgICAgInVnbGlmeS1qcyI6ICJeMy4xLjQiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgImFzeW5jIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuNi4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvYXN5bmMvLS9hc3luYy0yLjYuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWZORWlMMitBWnQ2QWxBdy8yOUNyMFVEZTRzUkFIQ3BFSGg1NFdNeitCYjdRZk5jRnc0aDNsb29meUpwTGVRczRZeDd5dXF1LzJkTGdNNWhLT3M2SGxRPT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJsb2Rhc2giOiAiXjQuMTcuMTAiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICAic291cmNlLW1hcCI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjYuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NvdXJjZS1tYXAvLS9zb3VyY2UtbWFwLTAuNi4xLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGE1MTItVWpnYXB1bVdsYk1oa0JnelQ3WWtjNVlYVVQ0NkYwaUt1OFNHWHEwYmN3UDVkei9oMFBsajZlbkpxanoxWmJxMmw1V2FxWW5yVmJ3V09XTXlGM0Y0N2c9PSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImhhcyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4zIiwKKyAgICAgICJyZXNvb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nRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEta2hpNXNya29vaml4UGNUN2EyMVhieU1VVStvPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgImluZmxpZ2h0IjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjYiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2luZmxpZ2h0Ly0vaW5mbGlnaHQtMS4wLjYudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1TYjFqTWRmUUxRd0p2SkVLRUhXNmdXVzFiZms9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAib25jZSI6ICJeMS4zLjAiLAorICAgICAgICAid3JhcHB5IjogIjEiCisgICAgICB9CisgICAgfSwKKyAgICAiaW5oZXJpdHMiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjAuMyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaW5oZXJpdHMvLS9pbmhlcml0cy0yLjAuMy50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVl6d3NnK1BhUXFVQzlTUm1BaVNBOUNDQ1lkND0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJpbmkiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjMuNSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaW5pLy0vaW5pLTEuMy41LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1SWlk1aHVJS0NNUldEVXFabEVpNzJmL2xtWEtNdnVzemNNQmR1bGlRM25uV2J4OVgvWkJRTzdEaWpNRVlTOUVoSEJiMnFhY1JVTXRDN3N2THdlMGxjdz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAiaW5xdWlyZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICI2LjIuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvaW5xdWlyZXIvLS9pbnF1aXJlci02LjIuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItUUlFUUc0WXlRMlVZWkdEQzRzck1aN0JqSE9tTmsxbFIySlFqNVVrbkJhcGtsbTZXSEErVlZIN04rc1VkWDNBN05lQ2ZHRjhvNFgxUzNBbzduQWNJZWc9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFuc2ktZXNjYXBlcyI6ICJeMy4wLjAiLAorICAgICAgICAiY2hhbGsiOiAiXjIuMC4wIiwKKyAgICAgICAgImNsaS1jdXJzb3IiOiAiXjIuMS4wIiwKKyAgICAgICAgImNsaS13aWR0aCI6ICJeMi4wLjAiLAorICAgICAgICAiZXh0ZXJuYWwtZWRpdG9yIjogIl4zLjAuMCIsCisgICAgICAgICJmaWd1cmVzIjogIl4yLjAuMCIsCisgICAgICAgICJsb2Rhc2giOiAiXjQuMTcuMTAiLAorICAgICAgICAibXV0ZS1zdHJlYW0iOiAiMC4wLjciLAorICAgICAgICAicnVuLWFzeW5jIjogIl4yLjIuMCIsCisgICAgICAgICJyeGpzIjogIl42LjEuMCIsCisgICAgICAgICJzdHJpbmctd2lkdGgiOiAiXjIuMS4wIiwKKyAgICAgICAgInN0cmlwLWFuc2kiOiAiXjQuMC4wIiwKKyAgICAgICAgInRocm91Z2giOiAiXjIuMy42IgorICAgICAgfQorICAgIH0sCisgICAgImlzLWNhbGxhYmxlIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjQiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2lzLWNhbGxhYmxlLy0vaXMtY2FsbGFibGUtMS4xLjQudGd6IiwKKyAgICAgICJp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ICJeNS4wLjE1IiwKKyAgICAgICAgImhhbmRsZWJhcnMiOiAiXjQuMC4xIiwKKyAgICAgICAgImpzLXlhbWwiOiAiMy54IiwKKyAgICAgICAgIm1rZGlycCI6ICIwLjUueCIsCisgICAgICAgICJub3B0IjogIjMueCIsCisgICAgICAgICJvbmNlIjogIjEueCIsCisgICAgICAgICJyZXNvbHZlIjogIjEuMS54IiwKKyAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogIl4zLjEuMCIsCisgICAgICAgICJ3aGljaCI6ICJeMS4xLjEiLAorICAgICAgICAid29yZHdyYXAiOiAiXjEuMC4wIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJlc3ByaW1hIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuNy4zIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZXNwcmltYS8tL2VzcHJpbWEtMi43LjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbHVPM0RWZDU5cTFKelFNbWM5SERFblo3cFlFPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfSwKKyAgICAgICAgImdsb2IiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiNS4wLjE1IiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvZ2xvYi8tL2dsb2ItNS4wLjE1LnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLUc4azJ1ZUF2U21BL3pDSXV6M1l6MHd1TGs3RT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJpbmZsaWdodCI6ICJeMS4wLjQiLAorICAgICAgICAgICAgImluaGVyaXRzIjogIjIiLAorICAgICAgICAgICAgIm1pbmltYXRjaCI6ICIyIHx8IDMiLAorICAgICAgICAgICAgIm9uY2UiOiAiXjEuMy4wIiwKKyAgICAgICAgICAgICJwYXRoLWlzLWFic29sdXRlIjogIl4xLjAuMCIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgICJoYXMtZmxhZyI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2hhcy1mbGFnLy0vaGFzLWZsYWctMS4wLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtblo1NU1XWE9BWG9BOEFRWXhEK1VLbnNkRWZvPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfSwKKyAgICAgICAgInN1cHBvcnRzLWNvbG9yIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjMuMi4zIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3VwcG9ydHMtY29sb3IvLS9zdXBwb3J0cy1jb2xvci0zLjIuMy50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1aYXdGQkxPVlFYSFlwa2xHc3E0OHU0cGZWUFk9IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICAgICAiaGFzLWZsYWciOiAiXjEuMC4wIgorICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgImpzLXRva2VucyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjQuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9qcy10b2tlbnMvLS9qcy10b2tlbnMtNC4wLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVJkSlVmbGNFM2NVektpTXFRZ3NDdTA2RlB1OVVkSUpPMGJlWWJQaEhONGs2YXBnSnRpZmNvQ3RUOWJjeE9wWUJ0cEQya0NNNlNiemc0Q2F1c1cvUEtRPT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJqcy15YW1sIjogeworICAgICAgInZlcnNpb24iOiAiMy4xMi4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9qcy15YW1sLy0vanMteWFtbC0zLjEyLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLVBJdDJjbndtUGZMNGhLTndxZWl1ejRiS2ZuekhUQnY2SHlWZ2phaEE2bVBMd1BEempEV3JwbEpCTWpIVUZ4a3UvTjNGbG1yYnlQY2xhZCtJKzRtSjNBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhcmdwYXJzZSI6ICJeMS4wLjciLAorICAgICAgICAiZXNwcmltYSI6ICJeNC4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAianMyeG1scGFyc2VyIjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2pzMnhtbHBhcnNlci8tL2pzMnhtbHBhcnNlci0zLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVA3WU9xZ2ljVkVENU1aOVJkZ3pOQitKSmx6TT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ4bWxjcmVhdGUiOiAiXjEuMC4xIgorICAgICAgfQorICAgIH0sCisgICAgImpzZG9jIjogeworICAgICAgInZlcnNpb24iOiAiMy41LjUiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2pzZG9jLy0vanNkb2MtMy41LjUudGd6IiwK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d01QKzg0NVJQZTNWZz09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAianNvbi1zdGFibGUtc3RyaW5naWZ5LXdpdGhvdXQtanNvbmlmeSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9qc29uLXN0YWJsZS1zdHJpbmdpZnktd2l0aG91dC1qc29uaWZ5Ly0vanNvbi1zdGFibGUtc3RyaW5naWZ5LXdpdGhvdXQtanNvbmlmeS0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLW5iZTFsSmF0UHp6Kzh3cDFGQzB0a3dyWEpsRT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJrbGF3IjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2tsYXcvLS9rbGF3LTIuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtV2NFbzROeGM1QkFnRVZFWlR1dWN2NFdHVVBZPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImdyYWNlZnVsLWZzIjogIl40LjEuOSIKKyAgICAgIH0KKyAgICB9LAorICAgICJsZXZuIjogeworICAgICAgInZlcnNpb24iOiAiMC4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2xldm4vLS9sZXZuLTAuMy4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtT3dtU1R0K2ZDRHdFa1AzVXdMeEVJZUJIWk80PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgInByZWx1ZGUtbHMiOiAifjEuMS4yIiwKKyA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VlCisgICAgfSwKKyAgICAibWltaWMtcmVzcG9uc2UiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbWltaWMtcmVzcG9uc2UvLS9taW1pYy1yZXNwb25zZS0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItajVFY3Rua0g3YW1mVi9xNUhnbW9hbDFnMlFIRkpScmFPdG14MEpwSXFreGhCaEkvbEpTbDFuTXBRNDVoVmFyd05FVE9vV0VpbW5kWjRRSzBSSHh1eFE9PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgIm1pbmltYXRjaCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjMuMC40IiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9taW5pbWF0Y2gvLS9taW5pbWF0Y2gtMy4wLjQudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXlKSFZRRWh5cVBMVVRndDlCODNQWHU2VzNyeDRNdnZIdlNVdlRvb2dwd29HRE9VUSt5RHJSMEhSb3QreU9DZENPN3U0aFgzcFdmdDZrV0JCY3FoMFVBPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJicmFjZS1leHBhbnNpb24iOiAiXjEuMS43IgorICAgICAgfQorICAgIH0sCisgICAgIm1pbmltaXN0IjogeworICAgICAgInZlcnNpb24iOiAiMC4wLjgiLAorICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbWluaW1pc3QvLS9taW5pbWlzdC0wLjAuOC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWhYL0t2OE01ZlNZbHVDS0NZdWhxcDZBUnNGMD0iLAorICAgICAgImRldiI6IHRydWUKKyAgIC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CisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgInNlbXZlciI6ICJeNS40LjEiCisgICAgICB9CisgICAgfSwKKyAgICAibm9kZS1pbnQ2NCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuNC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ub2RlLWludDY0Ly0vbm9kZS1pbnQ2NC0wLjQuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWg2a0dYTnMxWFRHQzJQbE00UkdJdUNYR2lqcz0iCisgICAgfSwKKyAgICAibm9vcC1sb2dnZXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjEuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvbm9vcC1sb2dnZXIvLS9ub29wLWxvZ2dlci0wLjEuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWxLS3hZenhQRXhkVk1BZllsbS9RNkVHMnBNST0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJub3B0IjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjYiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL25vcHQvLS9ub3B0LTMuMC42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEteGtaZHZ3aXJ6VTJ6V1RGL2VheG9wa2F5ai9rPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImFiYnJldiI6ICIxIgorICAgICAgfQorICAgIH0sCisgICAgIm5wbWxvZyI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjQuMS4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9ucG1sb2cvLS9ucG1sb2ctNC4xLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLTJ1VXFhenVLbFRhU0kvZEM4QXppY1VjazcrSXJFYU9uTi9lMGpkM1h0dDFLY0dwd3gzMHY1MG1MN29QeXIvaDliTDNFNGFaY2NWd3B3UCs1VzlWamtnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhcmUtd2UtdGhlcmUteWV0IjogIn4xLjEuMiIsCisgICAgICAgICJjb25zb2xlLWNvbnRyb2wtc3RyaW5ncyI6ICJ+MS4xLjAiLAorICAgICAgICAiZ2F1Z2UiOiAifjIuNy4zIiwKKyAgICAgICAgInNldC1ibG9ja2luZyI6ICJ+Mi4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAibnVtYmVyLWlzLW5hbiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9udW1iZXItaXMtbmFuLy0vbnVtYmVyLWlzLW5hbi0xLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUNYdGdLMU5DS2xJc0d2dUhrREdETnBRYUFSMD0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJvYmplY3QtYXNzaWduIjogeworICAgICAgInZlcnNpb24iOiAiNC4xLjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL29iamVjdC1hc3NpZ24vLS9vYmplY3QtYXNzaWduLTQuMS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSVFtdHg1WlloOC9BWEx2VVFzckl2N3MyQ0dNPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgIm9iamVjdC1pbnNwZWN0IjogeworICAgICAgInZlcnNpb24iOiAiMS42LjAiLAorICAgICA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gICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb25jZS8tL29uY2UtMS40LjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1XRHNhcDNXV0hVc1JPc0Y5bkZDNjc1M1hhOUU9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAid3JhcHB5IjogIjEiCisgICAgICB9CisgICAgfSwKKyAgICAib25ldGltZSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9vbmV0aW1lLy0vb25ldGltZS0yLjAuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUJuUW9Jdy9XZEVPeWVVc2l1NlVvdG9aNVl0UT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJtaW1pYy1mbiI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAib3B0aW1pc3QiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjYuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb3B0aW1pc3QvLS9vcHRpbWlzdC0wLjYuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLTJqNm5Sb2I2SWFHYUVSd3licERyRmFBWlpvWT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJtaW5pbWlzdCI6ICJ+MC4wLjEiLAorICAgICAgICAid29yZHdyYXAiOiAifjAuMC4yIgorICAgICAgfSwKKyAgICAgICJkZXBlbmRlbmNpZXMiOiB7CisgICAgICAgICJ3b3Jkd3JhcCI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIwLjAuMyIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3dvcmR3cmFwLy0vd29yZHdyYXAtMC4wLjMudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbzlYYWJOWEF2QUFJMDNJMHU2OGI3V01Ga1FjPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgIm9wdGlvbmF0b3IiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjguMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb3B0aW9uYXRvci8tL29wdGlvbmF0b3ItMC44LjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1Oa3hlUUowL1RXTUIxc0Mwd0Z1NlVCZ0s2MlE9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZGVlcC1pcyI6ICJ+MC4xLjMiLAorICAgICAgICAiZmFzdC1sZXZlbnNodGVpbiI6ICJ+Mi4wLjQiLAorICAgICAgICAibGV2biI6ICJ+MC4zLjAiLAorICAgICAgICAicHJlbHVkZS1scyI6ICJ+MS4xLjIiLAorICAgICAgICAidHlwZS1jaGVjayI6ICJ+MC4zLjIiLAorICAgICAgICAid29yZHdyYXAiOiAifjEuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgIm9zLWhvbWVkaXIiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvb3MtaG9tZWRpci8tL29zLWhvbWVkaXItMS4wLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS0vN3hKaUROdURvTTk0TUZveCs4VklTR3FmN009IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAib3Mt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TOS9GTT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJwYXRoLWtleSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9wYXRoLWtleS8tL3BhdGgta2V5LTIuMC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtUVJ5dHRYVEZvVURUcExHUkRVRFlETW4wQzBBPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInBhdGgtcGFyc2UiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuNiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcGF0aC1wYXJzZS8tL3BhdGgtcGFyc2UtMS4wLjYudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLUdTbU9UMkViSHJJTkJmOVNSN0NERUx3bEo4QUVOazNRbjdPaWtLNG5GWUF1M090ZTIrSllOVnZrcEFFUW0zL1RMTkVKRkQveFpKanp5eGczS0JXT3p3PT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJwaWZ5IjogeworICAgICAgInZlcnNpb24iOiAiMi4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHA6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcGlmeS8tL3BpZnktMi4zLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS03UlFhYXNCRHFFbnFXSVNZNTl5b3NWTXc2UXc9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAicGlua2llIjogeworICAgICAgInZlcnNpb24iOiAiMi4wLjQiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3BpbmtpZS8tL3BpbmtpZS0yLjAuNC50Z3oiLAorICAgICAgImlud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ldyNnFmQ2xFWERoT2tYanVhT0tDdzJxOGFpdUZoT05SWVZzRy9jemlhN0tocHlrSWxJMlMyVmFQdW5BPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkZXRlY3QtbGliYyI6ICJeMS4wLjMiLAorICAgICAgICAiZXhwYW5kLXRlbXBsYXRlIjogIl4xLjAuMiIsCisgICAgICAgICJnaXRodWItZnJvbS1wYWNrYWdlIjogIjAuMC4wIiwKKyAgICAgICAgIm1pbmltaXN0IjogIl4xLjIuMCIsCisgICAgICAgICJta2RpcnAiOiAiXjAuNS4xIiwKKyAgICAgICAgIm5vZGUtYWJpIjogIl4yLjIuMCIsCisgICAgICAgICJub29wLWxvZ2dlciI6ICJeMC4xLjEiLAorICAgICAgICAibnBtbG9nIjogIl40LjAuMSIsCisgICAgICAgICJvcy1ob21lZGlyIjogIl4xLjAuMSIsCisgICAgICAgICJwdW1wIjogIl4yLjAuMSIsCisgICAgICAgICJyYyI6ICJeMS4xLjYiLAorICAgICAgICAic2ltcGxlLWdldCI6ICJeMi43LjAiLAorICAgICAgICAidGFyLWZzIjogIl4xLjEzLjAiLAorICAgICAgICAidHVubmVsLWFnZW50IjogIl4wLjYuMCIsCisgICAgICAgICJ3aGljaC1wbS1ydW5zIjogIl4xLjAuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAibWluaW1pc3QiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4yLjAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL21pbmltaXN0Ly0vbWluaW1pc3QtMS4yLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbzFBSXNnOUJPRDdzSDdrVTlNMWQ5NW9tUW9RPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfQorICAgICAgfQorICAgIH0sCisgICAgIn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JkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZW5kLW9mLXN0cmVhbSI6ICJeMS4xLjAiLAorICAgICAgICAib25jZSI6ICJeMS4zLjEiCisgICAgICB9CisgICAgfSwKKyAgICAicHVueWNvZGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjEuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcHVueWNvZGUvLS9wdW55Y29kZS0yLjEuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItWFJzUmpkZitqNW1sK3kvNkdLSFBaYnJGLzhwMllnYTBKUHRkcVRJWTJYZTVvaEpQRDlzYURKSkxQdnA5K05TQnByVnZldmRYWnlibmoyY3Y4T0VkMEE9PSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInEiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjUuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcS8tL3EtMS41LjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1makwzVzBFNEVwSFFSaEh4dnhRUW1zQUdVZGM9IgorICAgIH0sCisgICAgInJjIjogeworICAgICAgInZlcnNpb24iOiAiMS4yLjgiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3JjLy0vcmMtMS4yLjgudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXkzYkdncUtqM1FCZHhMYkxrb21sb2hrdnNBOGdkQWlVUWxTQkpuQmhmbitCUHhnNGJjNjJkOFRjQlcxNXdhdkRmZ2V4Q2djY2NraGNadnl3eVFZUE93PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJkZWVwLWV4dGVuZCI6ICJeMC42LjAiLAorICAgICAgICAiaW5pIjogIn4xLjMuMCIsCisgICAgICAgICJtaW5pbWlzdCI6ICJeMS4yLjAiLAorICAgICAgICAic3RyaXAtanNvbi1jb21tZW50cyI6ICJ+Mi4wLjEiCisgICAgICB9LAorICAgICAgImRlcGVuZGVuY2llcyI6IHsKKyAgICAgICAgIm1pbmltaXN0IjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjEuMi4wIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9taW5pbWlzdC8tL21pbmltaXN0LTEuMi4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLW8xQUlzZzlCT0Q3c0g3a1U5TTFkOTVvbVFvUT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJyZWFkYWJsZS1zdHJlYW0iOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjMuNiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZWFkYWJsZS1zdHJlYW0vLS9yZWFkYWJsZS1zdHJlYW0tMi4zLjYudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLXRRdEtBOVdJQWhCRjMrVkxBc2V5TXFaZUJqVzBBSEpveE90WXFTVVpOSnhhdUVybUxiVm0yRlcxeStKL1lBOWRVckFDMzlJVGVqbFpXaFZJd2F3a0t3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb3JlLXV0aWwtaXMiOiAifjEuMC4wIiwKKyAgICAgICAgImluaGVyaXRzIjogIn4yLjAuMyIsCisgICAgICAgICJpc2FycmF5IjogIn4xLjAuMCIsCisgICAgICAgICJwcm9jZXNzLW5leHRpY2stYXJncyI6ICJ+Mi4wLjAiLAorICAgICAgICAic2FmZS1idWZmZXIiOi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Vncml0eSI6ICJzaGExLWFVUERVd3hObW41RzhjM2RVY0ZZL0djTTI5ND0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ1bmRlcnNjb3JlIjogIn4xLjYuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAidW5kZXJzY29yZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjYuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3VuZGVyc2NvcmUvLS91bmRlcnNjb3JlLTEuNi4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLWl6aXhES3plOWpNM3VMSk9UL2h0UmE2bEthZz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJyZXNvbHZlIjogeworICAgICAgInZlcnNpb24iOiAiMS4xLjciLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3Jlc29sdmUvLS9yZXNvbHZlLTEuMS43LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtSURFVTJDclN4ZTJlamdRUnM1TW9kZWlKNlhzPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInJlc29sdmUtZnJvbSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZXNvbHZlLWZyb20vLS9yZXNvbHZlLWZyb20tMS4wLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1Kc3YrazEwYTd1cTdLYncvNWE2d0hwUFVRaVk9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAicmVzdG9yZS1jdXJzb3IiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcmVzdG9yZS1jdXJzb3IvLS9yZXN0b3JlLWN1cnNvci0yLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLW4zN2loL2d2MHliVS9SWXBJOVloS2U3ZzM2OD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJvbmV0aW1lIjogIl4yLjAuMCIsCisgICAgICAgICJzaWduYWwtZXhpdCI6ICJeMy4wLjIiCisgICAgICB9CisgICAgfSwKKyAgICAicmVzdW1lciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZXN1bWVyLy0vcmVzdW1lci0wLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLThlajBZZVFHUzZPZWdxODgzQ3FNaVQwSFoxaz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJ0aHJvdWdoIjogIn4yLjMuNCIKKyAgICAgIH0KKyAgICB9LAorICAgICJyaW1yYWYiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjYuMiIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvcmltcmFmLy0vcmltcmFmLTIuNi4yLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1scmVld0xLL0JsZ2hteHRmSDM2WVlWZzFpOElBY2U0VEk3b2FvNzVJMWcyNDUrNkJjdHFUVlFpQlAzWVVKOUM2RFFPWEpta1lSOVg5ZkNMdENPSmM1dz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZ2xvYiI6ICJeNy4wLjUiCisgICAgICB9CisgICAgfSwKKyAgICAicnVuLWFzeW5jIjogeworICAgICAgInZlcnNpb24iOiAiMi4zLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3J1bi1hc3luYy8tL3J1bi1hc3luYy0yLjMuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUEzR3JTdUM5MXlEVUZtMTkvYVpQOTZSRnBzQT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJpcy1wcm9taXNlIjogIl4yLjEuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJyeGpzIjogeworICAgICAgInZlcnNpb24iOiAiNi4zLjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3J4anMvLS9yeGpzLTYuMy4zLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1KVFdtb1k5dFdDczd6dklrL0N2UmpoakdhT2QrT1ZCTTk4N214Rm8rT1c2NmNHcGRLalpjcG1jNzRFUzFzQi8vN0tsL1BBZTgrd0Vha3VoRzRwY2dPdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAidHNsaWIiOiAiXjEuOS4wIgorICAgICAgfQorICAgIH0sCisgICAgInNhZmUtYnVmZmVyIjogeworICAgICAgInZlcnNpb24iOiAiNS4xLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NhZmUtYnVmZmVyLy0vc2FmZS1idWZmZXItNS4xLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLUdkMlVaQkpEa1hsWTdHYkp4ZnNFOC9udktrVUVVMUczOGMxc2lONlFQNmE5UFQ5TW1IQjhHbnBzY1NtTUpTb0Y4TE9JcnQ4dWQvd1B0b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ICAgInZlcnNpb24iOiAiMS4yLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NoZWJhbmctY29tbWFuZC8tL3NoZWJhbmctY29tbWFuZC0xLjIuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVJLckdXMmxiQXptSmFNT2ZOai91WGVyOThlbz0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJzaGViYW5nLXJlZ2V4IjogIl4xLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJzaGViYW5nLXJlZ2V4IjogeworICAgICAgInZlcnNpb24iOiAiMS4wLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NoZWJhbmctcmVnZXgvLS9zaGViYW5nLXJlZ2V4LTEuMC4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtMmtMMGwwREF0QzJ5eXBjb1Z4eXhrTW1PL3FNPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInNpZ25hbC1leGl0IjogeworICAgICAgInZlcnNpb24iOiAiMy4wLjIiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NpZ25hbC1leGl0Ly0vc2lnbmFsLWV4aXQtMy4wLjIudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS10ZjNBanhLSDZoRjRZbzVCWGlVVEszTmtiRzA9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAic2ltcGxlLWNvbmNhdCI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zaW1wbGUtY29uY2F0Ly0vc2ltcGxlLWNvbmNhdC0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWMwVEx1TGJpYjdKOVpyTDhodm4yMVpsMUljWT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJzaW1wbGUtZ2V0IjogeworICAgICAgInZlcnNpb24iOiAiMi44LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NpbXBsZS1nZXQvLS9zaW1wbGUtZ2V0LTIuOC4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1sU1NIUlN3M21RTlVHUEFZUnFvN3h5OWRoS214RlhJakxqcDRLSHBmOTlHRUgyVkg3QzNBTStRZng2ZHU2amhmVWk2Vm03WG5iRVZFZjdXYjZOOGpSdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZGVjb21wcmVzcy1yZXNwb25zZSI6ICJeMy4zLjAiLAorICAgICAgICAib25jZSI6ICJeMS4zLjEiLAorICAgICAgICAic2ltcGxlLWNvbmNhdCI6ICJeMS4wLjAiCisgICAgICB9CisgICAgfSwKKyAgICAic2xpY2UtYW5zaSI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9zbGljZS1hbnNpLy0vc2xpY2UtYW5zaS0xLjAuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItUE9xeEJLNkxiM3E2czA0N0QvWHNEVk5QbkY5RGw4SlNhcWU5aDlsVVJsME9kTnF5L3VqRHJPaUlIdHNxWE1HYldXVElvbVJ6QU1hVHlhd0FVLy9SZWc9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgImlzLWZ1bGx3aWR0aC1jb2RlLXBvaW50IjogIl4yLjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJzb3VyY2UtbWFwIjogeworICAgICAgInZlcnNpb24iOiAiMC4yLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3NvdXJjZS1tYXAvLS9zb3VyY2UtbWFwLTAuMi4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtMnJjL3ZQd3JxQm0wM2dPOWIyNnFTQlpMUDUwPSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhbWRlZmluZSI6ICI+PTAuMC40IgorICAgICAgfQorICAgIH0sCisgICAgInNwcmludGYtanMiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMyIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3ByaW50Zi1qcy8tL3NwcmludGYtanMtMS4wLjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1CT2FTYjJZb2xUVlBQZEFWSURZenVGY3BmaXc9IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAic3RhdHVzZXMiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjMuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3RhdHVzZXMvLS9zdGF0dXNlcy0xLjMuMS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLSt2VWJucmRLcnZPenJQU3RYMkdyOGt5M3VUND0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJzdHJpbmctd2lkdGgiOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjEuMSIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc3RyaW5nLXdpZHRoLy0vc3RyaW5nLXdpZHRoLTI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gICAiaW50ZWdyaXR5IjogInNoYTUxMi1RalZqd2RYSXQ0MDhNSWlBcUNYNG9VS3NnVTJFcUFHenMyUHBrbTRhUVliam0rWkVXRWNXNFNmRk5UcjR1TU5abWEwZXk0ZjVsZ0xya0IwYVgwUU1vdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiaGFzLWZsYWciOiAiXjMuMC4wIgorICAgICAgfQorICAgIH0sCisgICAgInRhYmxlIjogeworICAgICAgInZlcnNpb24iOiAiNS4xLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RhYmxlLy0vdGFibGUtNS4xLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWU1NDJpbjIyWkxoRC9mT0l1WHMvOHlEWjlXNjFsdEY4ZGFNODhya1JOdGdUSWN0K3ZJMmZUbkF5dS9EYjJUQ2ZFY0k4aTdtalp6Nm1lTHEwblc3VFlnPT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJhanYiOiAiXjYuNS4zIiwKKyAgICAgICAgImxvZGFzaCI6ICJeNC4xNy4xMCIsCisgICAgICAgICJzbGljZS1hbnNpIjogIjEuMC4wIiwKKyAgICAgICAgInN0cmluZy13aWR0aCI6ICJeMi4xLjEiCisgICAgICB9CisgICAgfSwKKyAgICAidGFmZnlkYiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjIuNi4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90YWZmeWRiLy0vdGFmZnlkYi0yLjYuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLWZMeTJTMW9VRzJvdS9DeGRMR2UwNFZDeW9tZz0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJ0YXBlIjogeworICAgICAgInZlcnNpb24iOiAiNC45LjEiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RhcGUvLS90YXBlLTQuOS4xLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi02ZktJWGtuTHBvZS9KcDRyekhLRlBwSlVIREhEcW44anVzOTlJZlBuSElqeXo3OEhZbGVmVEdEM2I1RWtiUXp1TGZhRXZtZlBLM0lvbExncTJ4VDNrdz09IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAiZGVlcC1lcXVhbCI6ICJ+MS4wLjEiLAorICAgICAgICAiZGVmaW5lZCI6ICJ+MS4wLjAiLAorICAgICAgICAiZm9yLWVhY2giOiAifjAuMy4zIiwKKyAgICAgICAgImZ1bmN0aW9uLWJpbmQiOiAifjEuMS4xIiwKKyAgICAgICAgImdsb2IiOiAifjcuMS4yIiwKKyAgICAgICAgImhhcyI6ICJ+MS4wLjMiLAorICAgICAgICAiaW5oZXJpdHMiOiAifjIuMC4zIiwKKyAgICAgICAgIm1pbmltaXN0IjogIn4xLjIuMCIsCisgICAgICAgICJvYmplY3QtaW5zcGVjdCI6ICJ+MS42LjAiLAorICAgICAgICAicmVzb2x2ZSI6ICJ+MS43LjEiLAorICAgICAgICAicmVzdW1lciI6ICJ+MC4wLjAiLAorICAgICAgICAic3RyaW5nLnByb3RvdHlwZS50cmltIjogIn4xLjEuMiIsCisgICAgICAgICJ0aHJvdWdoIjogIn4yLjMuOCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAibWluaW1pc3QiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS4yLjAiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwOi8vcmVnaXN0cnkubnBtanMub3JnL21pbmltaXN0Ly0vbWluaW1pc3QtMS4yLjAudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTEtbzFBSXNnOUJPRDdzSDdrVTlNMWQ5NW9tUW9RPSIsCisgICAgICAgICAgImRldiI6IHRydWUKKyAgICAgICAgfSwKKyAgICAgICAgInJlc29sdmUiOiB7CisgICAgICAgICAgInZlcnNpb24iOiAiMS43LjEiLAorICAgICAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy9yZXNvbHZlLy0vcmVzb2x2ZS0xLjcuMS50Z3oiLAorICAgICAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWM3cndMb2ZwOGcxVStoMUtOeUhML2ppY3JLZzFFazRxK0xyMzNBTDY1dVpUaW5VWkhlMzBENUhseU41VjlOVzBKWDFENWRYUTRqcVc1bDdTeS9rR2Z3PT0iLAorICAgICAgICAgICJkZXYiOiB0cnVlLAorICAgICAgICAgICJyZXF1aXJlcyI6IHsKKyAgICAgICAgICAgICJwYXRoLXBhcnNlIjogIl4xLjAuNSIKKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJ0YXItZnMiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjE2LjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3Rhci1mcy8tL3Rhci1mcy0xLjE2LjMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLU52Q2VYcFl4N09zbU9oOHpJT1AvZWJHNTV6Wm14TEUwZXRmV1JiV29rK3EyUW84eC92T1IvSUpUMXRhQURYUGUranNpdTlheERiM1g0QitpSWdObEt3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjaG93bnIiOiAiXjEuMC4xIiwKKyAgICAgICAgIm1rZGlycCI6ICJeMC41LjEiLAorICAgICAgICAicHVtcCI6ICJeMS4wLjAiLAorICAgICAgICAidGFyLXN0cmVhbSI6ICJeMS4xLjIiCisgICAgICB9LAorICAg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W50cyI6ICJeMS4wLjAiLAorICAgICAgICAicmVhZGFibGUtc3RyZWFtIjogIl4yLjMuMCIsCisgICAgICAgICJ0by1idWZmZXIiOiAiXjEuMS4xIiwKKyAgICAgICAgInh0ZW5kIjogIl40LjAuMCIKKyAgICAgIH0KKyAgICB9LAorICAgICJ0ZXh0LXRhYmxlIjogeworICAgICAgInZlcnNpb24iOiAiMC4yLjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RleHQtdGFibGUvLS90ZXh0LXRhYmxlLTAuMi4wLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtZjE3b0k2NkFVZ2ZBQ3ZMZlNvVHNQOCtsY0xRPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInRocm91Z2giOiB7CisgICAgICAidmVyc2lvbiI6ICIyLjMuOCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cDovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90aHJvdWdoLy0vdGhyb3VnaC0yLjMuOC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLURkVEovNnE4TlhsZ3NiY2tFVjErRG9haTRmVT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJ0bXAiOiB7CisgICAgICAidmVyc2lvbiI6ICIwLjAuMzMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3RtcC8tL3RtcC0wLjAuMzMudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWpSQ0psb2pLblozYWRkdFRPamRJcW9SdVBFS0J2TlhjR1lxek82eldaWDhLZktFcG5HWTVqZmdnSlEzRWpLdXU4RDRiSlJyMHkrY1lKRm1ZYkltWEd3PT0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJvcy10bXBkaXIiOiAifjEuMC4yIgorICAgICAgfQorICAgIH0sCisgICAgInRvLWJ1ZmZlciI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuMS4xIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90by1idWZmZXIvLS90by1idWZmZXItMS4xLjEudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhNTEyLWx4OUI1aXY3bXN1RllFM2R5dFQrS0U1dGFwK3JOWXcrSzRqVmtiOVIvYXNBYitwYkJTTTE3anR1bkhwbGhCZTZSUkpkWngzUG4ySnBoMjRPMzJtT1ZnPT0iLAorICAgICAgImRldiI6IHRydWUKKyAgICB9LAorICAgICJ0c2xpYiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjEuOS4zIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90c2xpYi8tL3RzbGliLTEuOS4zLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi00a3JGOHNjcGVqaGFPZ3F6QkVjR003eURJRWZpMC84Kzh6RFJaaE5aWjJram1ISjRodjN6Q2JRV3hvSkd6MWl3NVUwSmwwbm1hMTN4ekhYY25jTWF2UT09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAidHVubmVsLWFnZW50IjogeworICAgICAgInZlcnNpb24iOiAiMC42LjAiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3R1bm5lbC1hZ2VudC8tL3R1bm5lbC1hZ2VudC0wLjYuMC50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLUo2WGVvR3Myc0VvS21XWjNTeWtJYVBEOFFQMD0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJzYWZlLWJ1ZmZlciI6ICJeNS4wLjEiCisgICAgICB9CisgICAgfSwKKyAgICAidHlwZS1jaGVjayI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMy4yIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy90eXBlLWNoZWNrLy0vdHlwZS1jaGVjay0wLjMuMi50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGExLVdJVEt0UkxQSFRWZVA3ZUU4d2dFc3JVZzIzST0iLAorICAgICAgImRldiI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJwcmVsdWRlLWxzIjogIn4xLjEuMiIKKyAgICAgIH0KKyAgICB9LAorICAgICJ0eXBlc2NyaXB0IjogeworICAgICAgInZlcnNpb24iOiAiMy4xLjYiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3R5cGVzY3JpcHQvLS90eXBlc2NyaXB0LTMuMS42LnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi10RE1ZZlZ0dnBiOTZtc1MxbERYOU1FZEhyVzR5T3VaNEtkYzRIaW05b1U3OTZYbGRQWUYvdDIrdUtvWDBCQmEwaFhYd0RscVlRYlhZNVJ6anpjNWhCQT09IiwKKyAgICAgICJkZXYiOiB0cnVlCisgICAgfSwKKyAgICAidWdsaWZ5LWpzIjogeworICAgICAgInZlcnNpb24iOiAiMy40LjkiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3VnbGlmeS1qcy8tL3VnbGlmeS1qcy0zLjQuOS50Z3oiLAorICAgICAgImludGVncml0eSI6ICJzaGE1MTItOENKc2JLT3RFYm5Kc1R5djZMRTZtNlpLbmlxTWlGV21tOXNSYm9wYmtHczNnTVBQZmQzRmg4aUlBNFlrdjVNZ2FUYnFIcjRCYW9HTEpMWk5oc3JXMVE9PSIsCisgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICJvcHRpb25hbCI6IHRydWUsCisgICAgICAicmVxdWlyZXMiOiB7CisgICAgICAgICJjb21tYW5kZXIiOiAifjIuMTcuMSIsCisgICAgICAgICJzb3VyY2UtbWFwIjogIn4wLjYuMSIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAiY29tbWFuZGVyIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjIuMTcuMSIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL2NvbW1hbmRlci8tL2NvbW1hbmRlci0yLjE3LjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi13UE1VdDZGbkgyeXpHOTVTQTZtempRT0VLVVUzYUxhREVtenMxdGkrMUU5aCtDc3JaZ2hSbHFFTS9FSjRLc2NzUVZHOHVOTjR1VnJlVWVUOCtkcmxnZz09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgICAgIH0sCisgICAgICAgICJzb3VyY2UtbWFwIjogeworICAgICAgICAgICJ2ZXJzaW9uIjogIjAuNi4xIiwKKyAgICAgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvc291cmNlLW1hcC8tL3NvdXJjZS1tYXAtMC42LjEudGd6IiwKKyAgICAgICAgICAiaW50ZWdyaXR5IjogInNoYTUxMi1VamdhcHVtV2xiTWhrQmd6VDdZa2M1WVhVVDQ2RjBpS3U4U0dYcTBiY3dQNWR6L2gwUGxqNmVuSnFqejFaYnEybDVXYXFZbnJWYndXT1dNeUYzRjQ3Zz09IiwKKyAgICAgICAgICAiZGV2IjogdHJ1ZSwKKyAgICAgICAgICAib3B0aW9uYWwiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJ1bmRlcnNjb3JlIjogeworICAgICAgInZlcnNpb24iOiAiMS44LjMiLAorICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3VuZGVyc2NvcmUvLS91bmRlcnNjb3JlLTEuOC4zLnRneiIsCisgICAgICAiaW50ZWdyaXR5IjogInNoYTEtVHorMU94QnVZSmY4K2N0QkNmS2w2YjM2VUNJPSIsCisgICAgICAiZGV2IjogdHJ1ZQorICAgIH0sCisgICAgInVuZGVyc2NvcmUtY29udHJpYiI6IHsKKyAgICAgICJ2ZXJzaW9uIjogIjAuMy4wIiwKKyAgICAgICJyZXNvbHZlZCI6ICJodHRwczovL3JlZ2lzdHJ5Lm5wbWpzLm9yZy91bmRlcnNjb3JlLWNvbnRyaWIvLS91bmRlcnNjb3JlLWNvbnRyaWItMC4zLjAudGd6IiwKKyAgICAgICJpbnRlZ3JpdHkiOiAic2hhMS1abHRtd2tlRCtQb3JHTW40eTdEaXg5U01Kc2M9IiwKKyAgICAgICJkZXYiOiB0cnVlLAorICAgICAgInJlcXVpcmVzIjogeworICAgICAgICAidW5kZXJzY29yZSI6ICIxLjYuMCIKKyAgICAgIH0sCisgICAgICAiZGVwZW5kZW5jaWVzIjogeworICAgICAgICAidW5kZXJzY29yZSI6IHsKKyAgICAgICAgICAidmVyc2lvbiI6ICIxLjYuMCIsCisgICAgICAgICAgInJlc29sdmVkIjogImh0dHBzOi8vcmVnaXN0cnkubnBtanMub3JnL3VuZGVyc2NvcmUvLS91bmRlcnNjb3JlLTEuNi4wLnRneiIsCisgICAgICAgICAgImludGVncml0eSI6ICJzaGExLWl6aXhES3plOWpNM3VMSk9UL2h0UmE2bEthZz0iLAorICAgICAgICAgICJkZXYiOiB0cnVlCisgICAgICAgIH0KKyAgICAgIH0KKyAgICB9LAorICAgICJ1bnBpcGUiOiB7CisgICAgICAidmVyc2lvbiI6ICIxLjAuMCIsCisgICAgICAicmVzb2x2ZWQiOiAiaHR0cHM6Ly9yZWdpc3RyeS5ucG1qcy5vcmcvdW5waXBlLy0vdW5waXBlLTEuMC4wLnRneiIsCisgICAgICAiaW50ZW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ZXMvTElDRU5TRS0yLjAiCisgICAgfQorICBdLAorICAiYnVncyI6IHsKKyAgICAibWFpbCI6ICJkZXZAdGhyaWZ0LmFwYWNoZS5vcmciLAorICAgICJ1cmwiOiAiaHR0cHM6Ly9pc3N1ZXMuYXBhY2hlLm9yZy9qaXJhL2Jyb3dzZS9USFJJRlQiCisgIH0sCisgICJmaWxlcyI6IFsKKyAgICAibGliL25vZGVqcy9saWIvdGhyaWZ0IiwKKyAgICAibGliL25vZGVqcy9SRUFETUUubWQiCisgIF0sCisgICJkaXJlY3RvcmllcyI6IHsKKyAgICAibGliIjogIi4vbGliL25vZGVqcy9saWIvdGhyaWZ0IgorICB9LAorICAibWFpbiI6ICIuL2xpYi9ub2RlanMvbGliL3RocmlmdCIsCisgICJlbmdpbmVzIjogeworICAgICJub2RlIjogIj49IDQuMS4wIgorICB9LAorICAiZGVwZW5kZW5jaWVzIjogeworICAgICJub2RlLWludDY0IjogIl4wLjQuMCIsCisgICAgInEiOiAiXjEuNS4wIiwKKyAgICAid3MiOiAiXjUuMC4wIgorICB9LAorICAiZGV2RGVwZW5kZW5jaWVzIjogeworICAgICJidWZmZXItZXF1YWxzIjogIl4xLjAuNCIsCisgICAgImNvbW1hbmRlciI6ICJeMi4xNC4xIiwKKyAgICAiY29ubmVjdCI6ICJeMy42LjYiLAorICAgICJlc2xpbnQiOiAiXjUuNy4wIiwKKyAgICAiZXNsaW50LWNvbmZpZy1wcmV0dGllciI6ICJeMy4xLjAiLAorICAgICJlc2xpbnQtcGx1Z2luLXByZXR0aWVyIjogIl4zLjAuMCIsCisgICAgImlzdGFuYnVsIjogIl4wLjQuNSIsCisgICAgImpzZG9jIjogIl4zLjUuNSIsCisgICAgInByZXR0aWVyIjogIl4xLjE0LjMiLAorICAgICJ0YXBlIjogIl40LjkuMCIsCisgICAgInV0Zi04LXZhbGlkYXRlIjogIl40LjAuMCIsCisgICAgInR5cGVzY3JpcHQiOiAiXjMuMS42IiwKKyAgICAiQHR5cGVzL25v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bmFyeVByb3RvY29sQWNjZWxlcmF0ZWQoCi0gICAgICAgICAgIFRUcmFuc3BvcnQuVE1lbW9yeUJ1ZmZlcihzbG93X3ZlcnNpb25fYmluYXJ5KSkKLSAgYyA9IG8uX19jbGFzc19fKCkKLSAgYy5yZWFkKHByb3QpCi0gIGlmIGMgIT0gbzoKLSAgICBwcmludCAiY29weTogIgotICAgIHBwcmludChldmFsKHJlcHIoYykpKQotICAgIHByaW50ICJvcmlnOiAiCi0gICAgcHByaW50KGV2YWwocmVwcihvKSkpCi0KLSAgcHJvdCA9IFRCaW5hcnlQcm90b2NvbC5UQmluYXJ5UHJvdG9jb2xBY2NlbGVyYXRlZCgKLSAgICAgICAgICAgVFRyYW5zcG9ydC5UQnVmZmVyZWRUcmFuc3BvcnQoCi0gICAgICAgICAgICAgVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKHNsb3dfdmVyc2lvbl9iaW5hcnkpKSkKLSAgYyA9IG8uX19jbGFzc19fKCkKLSAgYy5yZWFkKHByb3QpCi0gIGlmIGMgIT0gbzoKLSAgICBwcmludCAiY29weTogIgotICAgIHBwcmludChldmFsKHJlcHIoYykpKQotICAgIHByaW50ICJvcmlnOiAiCi0gICAgcHByaW50KGV2YWwocmVwcihvKSkpCi0KLQotZGVmIGRvVGVzdCgpOgotICBjaGVja1dyaXRlKGhtKQotICBub19zZXQgPSBkZWVwY29weShobSkKLSAgbm9fc2V0LmNvbnRhaW4gPSBzZXQoKQotICBjaGVja1JlYWQobm9fc2V0KQotICBjaGVja1dyaXRlKHJzKQotICBjaGVja1JlYWQocnMpCi0gIGNoZWNrV3JpdGUocnNodWdlKQotICBjaGVja1JlYWQocnNodWdlKQotICBjaGVja1dyaXRlKG15X3plcm8pCi0gIGNoZWNrUmVhZChteV96ZXJvKQotICBjaGVja1JlYWQoQmFja3dhcmRzKHsiZmlyc3RfdGFnMiI6NCwgInNlY29uZF90YWcxIjoyfSkpCi0KLSAgIyBPbmUgY2FzZSB3aGVyZS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WwKK30KKworc3RydWN0IEJ5dGUgeworICAxOiBieXRlIHZhbAorfQorCitzdHJ1Y3QgRmxvYXQgeworICAxOiBkb3VibGUgdmFsCit9CisKK3N0cnVjdCBMaXN0IHsKKyAgMTogbGlzdDxzdHJpbmc+IHZhbHMKK30KKworc3RydWN0IEFycmF5TGlzdCB7CisgIDE6IGxpc3Q8c3RyaW5nPiB2YWxzCit9CisKK3N0cnVjdCBTb3J0ZWRNYXAgeworICAxOiBtYXA8c3RyaW5nLCBzdHJpbmc+IHZhbHMKK30KKworc3RydWN0IFRyZWVNYXAgeworICAxOiBtYXA8c3RyaW5nLCBzdHJpbmc+IHZhbHMKK30KKworc3RydWN0IEhhc2hNYXAgeworICAxOiBtYXA8c3RyaW5nLCBTdHJpbmc+IHZhbHMKK30KKworc3RydWN0IE1hcCB7CisgIDE6IG1hcDxkb3VibGUsIERvdWJsZT4gdmFscworfQorCitzdHJ1Y3QgT2JqZWN0IHsKKyAgMTogSW50ZWdlciBpbnRlZ2VyLAorICAyOiBTdHJpbmcgc3RyLAorICAzOiBCb29sZWFuIGJvb2xlYW5fZmllbGQsCisgIDQ6IERvdWJsZSBkYmwsCisgIDU6IEJ5dGUgYml0ZSwKKyAgNjogbWFwPGkzMiwgSW50ZWdlcj4gaW50bWFwLAorICA3OiBNYXAgc29tZW1hcCwKK30KKworZXhjZXB0aW9uIEV4Y2VwdGlvbiB7CisgIDE6IHN0cmluZyBtc2cKK30KKworc2VydmljZSBBc3luY05vbmJsb2NraW5nU2VydmljZSB7CisgIE9iamVjdCBteW1ldGhvZCgKKyAgICAxOiBJbnRlZ2VyIGludGVnZXIsCisgICAgMjogU3RyaW5nIHN0ciwKKyAgICAzOiBCb29sZWFuIGJvb2xlYW5fZmllbGQsCisgICAgNDogRG91YmxlIGRibCwKKyAgICA1OiBCeXRlIGJpdGUsCisgICAgNjogbWFwPGkzMiwgSW50ZWdlcj4gaW50bWFwLAorICAgIDc6IE1hcCBzb21lbWFwLAorICApIHRocm93c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luaXRpb24gZmlsZQorCitUaGUgY3Jvc3MgdGVzdCBjYXNlcyBhcmUgZGVmaW5lZCBpbiBbdGVzdHMuanNvbl0odGVzdHMuanNvbikuCitUaGUgcm9vdCBlbGVtZW50IGlzIGNvbGxlY3Rpb24gb2YgdGVzdCB0YXJnZXQgZGVmaW5pdGlvbnMuCitFYWNoIHRlc3QgdGFyZ2V0IGRlZmluaXRpb24gbG9va3MgbGlrZSB0aGlzOgorCisgICAgeworICAgICAgIm5hbWUiOiAic29tZWxpYiIsCisKKyAgICAgICJjbGllbnQiOiB7CisgICAgICAgICJjb21tYW5kIjogWyJzb21lbGliX2NsaWVudF9leGVjdXRhYmxlIl0sCisgICAgICAgICJ3b3JrZGlyIjogInNvbWVsaWIvYmluIiwKKyAgICAgICAgInByb3RvY29scyI6IFsiYmluYXJ5Il0sCisgICAgICAgICJ0cmFuc3BvcnRzIjogWyJidWZmZXJlZCJdLAorICAgICAgICAic29ja2V0cyI6IFsiaXAiXSwKKyAgICAgIH0sCisgICAgICAic2VydmVyIjogeworICAgICAgICAiY29tbWFuZCI6IFsic29tZWxpYl9zZXJ2ZXJfZXhlY3V0YWJsZSJdLAorICAgICAgICAid29ya2RpciI6ICJzb21lbGliL2JpbiIsCisgICAgICAgICJwcm90b2NvbHMiOiBbImJpbmFyeSJdLAorICAgICAgICAidHJhbnNwb3J0cyI6IFsiYnVmZmVyZWQiXSwKKyAgICAgICAgInNvY2tldHMiOiBbImlwIiwgImlwLXNzbCJdLAorICAgICAgfQorICAgIH0KKworRWl0aGVyIGNsaWVudCBvciBzZXJ2ZXIgZGVmaW5pdGlvbiBvciBib3RoIHNob3VsZCBiZSBwcmVzZW50LgorCitQYXJhbWV0ZXJzIHRoYXQgYXJlIGNvbW1vbiB0byBib3RoIGBjbGllbnRgIGFuZCBgc2VydmVyYCBjYW4gYmUgcHV0IHRvIHRhcmdldAorZGVmaW5pdGlvbiByb290OgorCisgICAgeworICAgICAgIm5hbWUiOiAic29tZWxpYiIsC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0aDsgICAgICAgICAgICAjIHByZXZpb3VzIHRocmlmdCBwYXRoCitteSAkZ0N1cnJlbnRUaHJpZnRQYXRoOyAgICAgICAgICAgICAjIGN1cnJlbnQgdGhyaWZ0IHBhdGgKK215ICRnVGhyaWZ0RmlsZUZvbGRlcjsKK215ICRnQnJlYWtpbmdGaWxlc0NvdW50ID0zNDsgCisKK215ICRnVmVyYm9zZSA9IDA7CisjZnVuY3Rpb25zCitzdWIgYXVkaXRCcmVha2luZ0NoYW5nZXM7CitzdWIgYXVkaXROb25CcmVha2luZ0NoYW5nZXM7CisKK21haW4oKTsKKworc3ViIG1haW4KK3sKKyAgICBwYXJzZU9wdGlvbnMoKTsKKyAgICBhdWRpdEJyZWFraW5nQ2hhbmdlcygpOworICAgIGF1ZGl0Tm9uQnJlYWtpbmdDaGFuZ2VzKCk7Cit9CisKK3N1YiBwYXJzZU9wdGlvbnMKK3sKKyAgICBteSAlb3B0aW9ucyA9ICgpOworICAgIGlmICggZ2V0b3B0cyAoJ3ZmOm86dDonLFwlb3B0aW9ucykgKQorICAgIHsKKyAgICAgICAgIyBjdXJyZW50IChuZXcpIHRocmlmdCBmb2xkZXIKKyAgICAgICAgaWYgKCRvcHRpb25zeydmJ30pCisgICAgICAgIHsKKyAgICAgICAgICAgICRnVGhyaWZ0RmlsZUZvbGRlciA9ICRvcHRpb25zeydmJ307CisgICAgICAgICAgICAkZ1ByZXZpb3VzVGhyaWZ0UGF0aCA9ICRnVGhyaWZ0RmlsZUZvbGRlci4iL3Rlc3QudGhyaWZ0IjsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpZSAiTWlzc2luZyBGb2xkZXIgY29udGFpbmluZyB0aHJpZnQgZmlsZXNcbiI7CisgICAgICAgIH0KKworICAgICAgICBpZigkb3B0aW9uc3sndCd9KQorICAgICAgICB7CisgICAgICAgICAgICAkZ0F1ZGl0VG9vbFBhdGggPSAkb3B0aW9uc3sndCd9OworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZGllICJBdWRpdCBUb29sIFBhdGggcmVxdWlyZWQgXG4iOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCRvcHRpb25zeyd2J30pCisgICAgICAgIHsKKyAgICAgICAgICAgICRnVmVyYm9zZSA9IDE7CisgICAgICAgIH0KKworICAgIH0KK30KKworc3ViIGF1ZGl0QnJlYWtpbmdDaGFuZ2VzCit7CisgICAgbXkgJGJyZWFraW5nRmlsZUJhc2VOYW1lID0gJGdUaHJpZnRGaWxlRm9sZGVyLiIvYnJlYWsiOworICAgIG15ICRuZXdUaHJpZnRGaWxlOworICAgIGZvcihteSAkaT0xOyAkaSA8PSAkZ0JyZWFraW5nRmlsZXNDb3VudDsgJGkrKykKKyAgICB7CisgICAgICAgICRuZXdUaHJpZnRGaWxlID0gJGJyZWFraW5nRmlsZUJhc2VOYW1lLiIkaS50aHJpZnQiOworICAgICAgICBteSAkYXJndW1lbnRzID0gICRnUHJldmlvdXNUaHJpZnRQYXRoLiIgIi4kbmV3VGhyaWZ0RmlsZTsKKyAgICAgICAgbXkgKCRleGl0Q29kZSwgJG91dHB1dCkgPSBjYWxsVGhyaWZ0QXVkaXRUb29sKCRhcmd1bWVudHMpOworICAgICAgICBwcmludCAkb3V0cHV0IGlmICRnVmVyYm9zZSBlcSAxOworCisgICAgICAgIGlmKCRleGl0Q29kZSA9PSAxKQorICAgICAgICB7CisgICAgICAgICAgICAjIHRocmlmdF9hdWRpdCByZXR1cm5zIDEgd2hlbiBpdCBpcyBub3QgYWJsZSB0byBmaW5kIGZpbGVzIG9yIG90aGVyIG5vbi1hdWRpdCBmYWlsdXJlcworICAgICAgICAgICAgcHJpbnQgImV4aXRpbmcgd2l0aCBleGl0IGNvZGUgPTEgaSA9ICIuJGkuIlxuIjsKKyAgICAgICAgICAgIHByaW50ICRvdXRwdXQ7CisgICAgICAgICAgICBleGl0ICRleGl0Q29kZTsKKyAgICAgICAgf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JlYWs2IiAgPT4gInRlc3Rfc3RydWN0MiIsCisgICAgICAgICJicmVhazciICA9PiAidGVzdF9zdHJ1Y3Q2IiwKKyAgICAgICAgImJyZWFrOCIgID0+ICJ0ZXN0X3N0cnVjdDUiLAorICAgICAgICAiYnJlYWs5IiAgPT4gInRlc3Rfc3RydWN0MSIsCisgICAgICAgICJicmVhazEwIiA9PiAidGVzdF9zdHJ1Y3QyIiwKKyAgICAgICAgImJyZWFrMTEiID0+ICJ0ZXN0X3N0cnVjdDMiLAorICAgICAgICAiYnJlYWsxMiIgPT4gImRlcml2ZWQxX2Z1bmN0aW9uMSIsCisgICAgICAgICJicmVhazEzIiA9PiAiZGVyaXZlZDFfZnVuY3Rpb242IiwKKyAgICAgICAgImJyZWFrMTQiID0+ICJkZXJpdmVkMV9mdW5jdGlvbjQiLAorICAgICAgICAiYnJlYWsxNSIgPT4gImRlcml2ZWQyX2Z1bmN0aW9uMSIsCisgICAgICAgICJicmVhazE2IiA9PiAiZGVyaXZlZDJfZnVuY3Rpb241IiwKKyAgICAgICAgImJyZWFrMTciID0+ICJkZXJpdmVkMl9mdW5jdGlvbjYiLAorICAgICAgICAiYnJlYWsxOCIgPT4gImJhc2Vfb25ld2F5IiwKKyAgICAgICAgImJyZWFrMTkiID0+ICJiYXNlX2Z1bmN0aW9uMSIsCisgICAgICAgICJicmVhazIwIiA9PiAidGVzdF9lbnVtMSIsCisgICAgICAgICJicmVhazIxIiA9PiAidGVzdF9lbnVtMiIsCisgICAgICAgICJicmVhazIyIiA9PiAidGVzdF9lbnVtMSIsCisgICAgICAgICJicmVhazIzIiA9PiAidGVzdF9zdHJ1Y3Q0IiwKKyAgICAgICAgImJyZWFrMjQiID0+ICJkZXJpdmVkMSIsCisgICAgICAgICJicmVhazI1IiA9PiAiZGVyaXZlZDIiLAorICAgICAgICAiYnJlYWsyNiIgPT4gImJhc2VfZnVuY3Rpb24xIiwKKyAgICAgICAgImJyZWFrMjciID0+ICJiYXNlX2Z1bmN0aW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bWVfYXZnX3VzZWM7CisKKyAgR09wdGlvbkNvbnRleHQgKm9wdGlvbl9jb250ZXh0OworICBnYm9vbGVhbiBvcHRpb25zX3ZhbGlkID0gVFJVRTsKKyAgaW50IHRlc3RfbnVtID0gMDsKKyAgaW50IGZhaWxfY291bnQgPSAwOworICBHRXJyb3IgKmVycm9yID0gTlVMTDsKKworI2lmICghR0xJQl9DSEVDS19WRVJTSU9OICgyLCAzNiwgMCkpCisgIGdfdHlwZV9pbml0ICgpOworI2VuZGlmCisKKyAgLyogQ29uZmlndXJlIGFuZCBwYXJzZSBvdXIgY29tbWFuZC1saW5lIG9wdGlvbnMgKi8KKyAgb3B0aW9uX2NvbnRleHQgPSBnX29wdGlvbl9jb250ZXh0X25ldyAoTlVMTCk7CisgIGdfb3B0aW9uX2NvbnRleHRfYWRkX21haW5fZW50cmllcyAob3B0aW9uX2NvbnRleHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uX2VudHJpZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIGlmICghZ19vcHRpb25fY29udGV4dF9wYXJzZSAob3B0aW9uX2NvbnRleHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmFyZ2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmFyZ3YsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSkgeworICAgIGZwcmludGYgKHN0ZGVyciwgIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgcmV0dXJuIDI1NTsKKyAgfQorICBnX29wdGlvbl9jb250ZXh0X2ZyZWUgKG9wdGlvbl9jb250ZXh0KTsKKworICAvKiBTZXQgcmVtYWluaW5nIGRlZmF1bHQgdmFsdWVzIGZvciB1bnNwZWNpZmllZCBvcHRpb25zICovCisgIGlmIChob3N0ID09IE5VTEwpCisgICAgaG9zdCA9IGdfc3RyZHVwICgibG9jYWxob3N0Iik7CisKKyAgLyogVmFsaWRhdGUgdGhlIHBhcnNlZCBvcHRpb25zICovCisgIGlmIChwcm90b2NvbF9vcHRpb24gIT0gTlVMTCkgeworICAgIGlmIChzdHJuY21wIChwcm90b2NvbF9vcHRpb24sICJjb21wYWN0IiwgOCkgPT0gMCkgeworICAgICAgcHJvdG9jb2xfdHlwZSA9IFRIUklGVF9UWVBFX0NPTVBBQ1RfUFJPVE9DT0w7CisgICAgICBwcm90b2NvbF9uYW1lID0gImNvbXBhY3QiOworICAgIH0KKyAgICBlbHNlIGlmIChzdHJuY21wIChwcm90b2NvbF9vcHRpb24sICJtdWx0aSIsIDYpID09IDApIHsKKyAgICAgIHByb3RvY29sX3R5cGUgPSBUSFJJRlRfVFlQRV9NVUxUSVBMRVhFRF9QUk9UT0NPTDsKKyAgICAgIHByb3RvY29sX25hbWUgPSAiYmluYXJ5Om11bHRpIjsKKyAgICB9CisgICAgZWxzZSBpZiAoc3RybmNtcCAocHJvdG9jb2xfb3B0aW9uLCAibXVsdGljIiwgNykgPT0gMCkgeworICAgICAgcHJvdG9jb2xfdHlwZSA9IFRIUklGVF9UWVBFX01VTFRJUExFWEVEX1BST1RPQ09MOworICAgICAgcHJvdG9jb2xfbmFtZSA9ICJjb21wYWN0Om11bHRpYyI7CisgICAgfQorICAgIGVsc2UgaWYgKHN0cm5jbXAgKHByb3RvY29sX29wdGlvbiwgImJpbmFyeSIsIDcpID09IDApIHsKKyAgICAgIHByaW50ZigiV2UgYXJlIGdvaW5nIHdpdGggZGVmYXVsdCBwcm90b2NvbFxuIik7CisgICAgfQorICAgIGVsc2UgeworICAgICAgZnByaW50ZiAoc3RkZXJyLCAiVW5rbm93biBwcm90b2NvbCB0eXBlICVzXG4iLCBwcm90b2NvbF9vcHRpb24pOworICAgICAgb3B0aW9uc192YWxpZCA9IEZBTFNFOworICAgIH0KKyAgfQorCisgIGlmICh0cmFuc3BvcnRfb3B0aW9uICE9IE5VTEwpIHsKKyAgICBpZiAoc3RybmNtcCAodHJhbnNwb3J0X29wdGlvbiwgImZyYW1lZCIsIDcpID09IDApIHsKKyAgICAgIHRyYW5zcG9ydF90eXBlID0gVEhSSUZUX1RZUEVfRlJBTUVEX1RSQU5TUE9SVDsKKyAgICAgIHRyYW5zcG9ydF9uYW1lID0gImZyYW1lZCI7CisgICAgfQorICAgIGVsc2UgaWYgKHN0cm5jbXAgKHRyYW5zcG9ydF9vcHRpb24sICJidWZmZXJlZCIsIDkpICE9IDApIHsKKyAgICAgIGZwcmludGYgKHN0ZGVyciwgIlVua25vd24gdHJhbnNwb3J0IHR5cGUgJXNcbiIsIHRyYW5zcG9ydF9vcHRpb24pOworICAgICAgb3B0aW9uc192YWxpZCA9IEZBTFNFOworICAgIH0KKyAgfQorCisgIGlmIChzc2wpIHsKKyAgICBzb2NrZXRfdHlwZSA9IFRIUklGVF9UWVBFX1NTTF9TT0NLRVQ7CisgICAgc29ja2V0X25hbWUgPSAiaXAtc3NsIjsKKyAgICBwcmludGYoIlR5cGUgbmFtZSAlc1xuIiwgZ190eXBlX25hbWUgKHNvY2tldF90eXBlKSk7CisgIH0KKworICBpZiAoIW9wdGlvbnNfdmFsaWQpCisgICAgcmV0dXJuIDI1NDsKKworICBwcmludGYgKCJDb25uZWN0aW5nICglcy8lcykgdG86ICVzLyVzOiVkXG4iLAorICAgICAgICAgIHRyYW5zcG9ydF9uYW1lLAorICAgICAgICAgIHByb3RvY29sX25hbWUsCisgICAgICAgICAgc29ja2V0X25hbWUsCisgICAgICAgICAgaG9zdCwKKyAgICAgICAgICBwb3J0KTsKKworICAvKiBJbnN0YWxsIG91ciBTSUdQSVBFIGhhbmRsZXIsIHdoaWNoIG91dHB1dHMgYW4gZXJyb3IgbWVzc2FnZSB0bworICAgICBzdGFuZGFyZCBlcnJvciBiZWZvcmUgZXhpdGluZyBzbyB0ZXN0ZXJzIGNhbiBrbm93IHdoYXQKKyAgICAgaGFwcGVuZWQgKi8KKyAgbWVtc2V0ICgmc2lncGlwZV9hY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AgICAgICJvdXRwdXRfcHJvdG9jb2wiLCBwcm90b2NvbDIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworCisgIH1lbHNleworICAgIHByb3RvY29sID0gZ19vYmplY3RfbmV3IChwcm90b2NvbF90eXBlLAorICAgICAgICAgICAidHJhbnNwb3J0IiwgdHJhbnNwb3J0LAorICAgICAgICAgICBOVUxMKTsKKyAgfQorCisgIHRlc3RfY2xpZW50ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9USFJJRlRfVEVTVF9DTElFTlQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5wdXRfcHJvdG9jb2wiLCAgcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAib3V0cHV0X3Byb3RvY29sIiwgcHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAvKiBFeGVjdXRlIHRoZSBhY3R1YWwgdGVzdHMgKi8KKyAgZm9yICh0ZXN0X251bSA9IDA7IHRlc3RfbnVtIDwgbnVtX3Rlc3RzOyArK3Rlc3RfbnVtKSB7CisgICAgaWYgKHRocmlmdF90cmFuc3BvcnRfb3BlbiAodHJhbnNwb3J0LCAmZXJyb3IpKSB7CisgICAgICBnY2hhciAgICpzdHJpbmcgID0gTlVMTDsKKyAgICAgIGdib29sZWFuIGJvb2xlYW4gPSAwOworICAgICAgZ2ludDggICAgYnl0ZSAgICA9IDA7CisgICAgICBnaW50MzIgICBpbnQzMiAgID0gMDsKKyAgICAgIGdpbnQ2NCAgIGludDY0ICAgPSAwOworICAgICAgZ2RvdWJsZSAgZHViICAgICA9IDA7CisKKyAgICAgIGdpbnQgYnl0ZV90aGluZywgaTMyX3RoaW5nLCBpbm5lcl9ieXRlX3RoaW5nLCBpbm5lcl9pMzJfdGhpbmc7CisgICAgICBnaW50NjQgaTY0X3RoaW5nLCBpbm5lcl9pNjRfdGhpbmc7CisKKyAgICAgIFR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AtIFZlcmlmeSB0aGUgcmV0dXJuZWQgZGF0YSBtYXRjaGVzIHdoYXQgd2FzIGV4cGVjdGVkLgorCisgICAgICAgICAtIERlYWxsb2NhdGUgYW55IGNyZWF0ZWQgZGF0YSBzdHJ1Y3R1cmVzLgorCisgICAgICAgICBOb3RlIHRoZSByZWNvZ25pemVkIHZhbHVlcyBhbmQgZXhwZWN0ZWQgYmVoYXZpb3VyIG9mIGVhY2gKKyAgICAgICAgIHJlbW90ZSBtZXRob2QgYXJlIGRlc2NyaWJlZCBpbiBUaHJpZnRUZXN0LnRocmlmdCwgd2hpY2gKKyAgICAgICAgIHlvdSdsbCBmaW5kIGluIHRoZSB0b3AtbGV2ZWwgInRlc3QiIGZvbGRlci4gKi8KKworICAgICAgLyoqCisgICAgICAgKiBWT0lEIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgidGVzdFZvaWQoKSIpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X3ZvaWQgKHRlc3RfY2xpZW50LCAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9IHZvaWRcbiIpOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIGlmKGVycm9yIT1OVUxMKXsKKyAgICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgICAgfQorICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogU1RSSU5HIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgidGVzdFN0cmluZyhcIlRlc3RcIikiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9zdHJpbmcgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnN0cmluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJUZXN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0gXCIlc1wiXG4iLCBzdHJpbmcpOworICAgICAgICBpZiAoc3RybmNtcCAoc3RyaW5nLCAiVGVzdCIsIDUpICE9IDApCisgICAgICAgICAgZmFpbF9jb3VudCsrOworCisgICAgICAgIGdfZnJlZSAoc3RyaW5nKTsKKyAgICAgICAgc3RyaW5nID0gTlVMTDsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBNdWx0aXBsZXhlZCBUZXN0IC0gZG8gdGhpcyByaWdodCBpbiB0aGUgbWlkZGxlIG9mIHRoZSBub3JtYWwgVGVzdCBDbGllbnQgcnVuCisgICAgICAgKi8KKyAgICAgIGlmIChzZWNvbmRfc2VydmljZSkgeworICAgICAgICBwcmludGYgKCJ0ZXN0U2Vjb25kU2VydmljZU11bHRpcGxleFNlY29uZFRlc3RTdHJpbmcoXCIybmRcIikiKTsKKyAgICAgICAgaWYgKHRfdGVzdF9zZWNvbmRfc2VydmljZV9pZl9zZWNvbmR0ZXN0X3N0cmluZyAoc2Vjb25kX3NlcnZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIybmQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgICAgcHJpbnRmICgiID0gXCIlc1wiXG4iLCBzdHJpbmcpOworICAgICAgICAgIGlmIChzdHJjbXAgKHN0cmluZywgInRlc3RTdHJpbmcoXCIybmRcIikiKSAhPSAwKSB7CisgICAgICAgICAgICArK2ZhaWxfY291bnQ7CisgICAgICAgICAgfQorCisgICAgICAgICAgZ19mcmVlIChzdHJpbmcpOworICAgICAgICAgIHN0cmluZyA9IE5VTEw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgICArK2ZhaWxfY291bnQ7CisgICAgICAgIH0KKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBCT09MIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgidGVzdEJ5dGUodHJ1ZSkiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9ib29sICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmYm9vbGVhbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0gJXNcbiIsIGJvb2xlYW4gPyAidHJ1ZSIgOiAiZmFsc2UiKTsKKyAgICAgICAgaWYgKGJvb2xlYW4gIT0gMSkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBwcmludGYgKCJ0ZXN0Qnl0ZShmYWxzZSkiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9ib29sICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmYm9vbGVhbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0gJXNcbiIsIGJvb2xlYW4gPyAidHJ1ZSIgOiAiZmFsc2UiKTsKKyAgICAgICAgaWYgKGJvb2xlYW4gIT0gMCkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQllURSBURVNUCisgICAgICAgKi8KKyAgICAgIHByaW50ZiAoInRlc3RCeXRlKDEpIik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfYnl0ZSAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmJ5dGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9ICVkXG4iLCBieXRlKTsKKyAgICAgICAgaWYgKGJ5dGUgIT0gMSkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBwcmludGYgKCJ0ZXN0Qnl0ZSgtMSkiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9ieXRlICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmYnl0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9ICVkXG4iLCBieXRlKTsKKyAgICAgICAgaWYgKGJ5dGUgIT0gLTEpCisgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEkzMiBURVNUCisgICAgICAgKi8KKyAgICAgIHByaW50ZiAoInRlc3RJMzIoLTEpIik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfaTMyICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZpbnQzMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSkgeworICAgICAgICBwcmludGYgKCIgPSAlZFxuIiwgaW50MzIpOworICAgICAgICBpZiAoaW50MzIgIT0gLTEpCisgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEk2NCBURVNUCisgICAgICAgKi8KKyAgICAgIHByaW50ZiAoInRlc3RJNjQoLTM0MzU5NzM4MzY4KSIpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2k2NCAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW50NjQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2ludDY0KS0zNDM1OTczODM2OCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0gJSIgUFJJZDY0ICJcbiIsIGludDY0KTsKKyAgICAgICAgaWYgKGludDY0ICE9IChnaW50NjQpLTM0MzU5NzM4MzY4KQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBET1VCTEUgVEVTVAorICAgICAgICovCisgICAgICBwcmludGYoInRlc3REb3VibGUoLTUuMjA5ODUyMykiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9kb3VibGUgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmR1YiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC01LjIwOTg1MjMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9ICVmXG4iLCBkdWIpOworICAgICAgICBpZiAoKGR1YiAtICgtNS4yMDk4NTIzKSkgPiAwLjAwMSkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQklOQVJZIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgidGVzdEJpbmFyeShlbXB0eSkiKTsKKyAgICAgIEdCeXRlQXJyYXkgKmVtcHR5QXJyYXkgPSBnX2J5dGVfYXJyYXlfbmV3KCk7CisgICAgICBHQnl0ZUFycmF5ICpyZXN1bHQgPSBOVUxMOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2JpbmFyeSAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHlBcnJheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgR0J5dGVzICpyZXNwb25zZSA9IGdfYnl0ZV9hcnJheV9mcmVlX3RvX2J5dGVzKHJlc3VsdCk7ICAvLyBmcmVlcyByZXN1bHQKKyAgICAgICAgcmVzdWx0ID0gTlVMTDsKKyAgICAgICAgZ3NpemUgc2l6ID0gZ19ieXRlc19nZXRfc2l6ZShyZXNwb25zZSk7CisgICAgICAgIGlmIChzaXogPT0gMCkgeworICAgICAgICAgIHByaW50ZigiID0gZW1wdHlcbiIpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgIHByaW50ZigiID0gbm90IGVtcHR5ICglbGQgYnl0ZXMpXG4iLCAobG9uZylzaXopOworICAgICAgICAgICsrZmFpbF9jb3VudDsKKyAgICAgICAgfQorICAgICAgICBnX2J5dGVzX3VucmVmKHJlc3BvbnNlKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorICAgICAgZ19ieXRlX2FycmF5X3VucmVmKGVtcHR5QXJyYXkpOworICAgICAgZW1wdHlBcnJheSA9IE5VTEw7CisKKyAgICAgIC8vIFRPRE86IGFkZCB0ZXN0QmluYXJ5KCkgd2l0aCBkYXRhCisgICAgICBwcmludGYgKCJ0ZXN0QmluYXJ5KFstMTI4Li4xMjddKSA9IHsiKTsKKyAgICAgIGNvbnN0IHNpZ25lZCBjaGFyIGJpbl9kYXRhWzI1Nl0KKyAgICAgICAgPSB7LTEyOCwgLTEyNywgLTEyNiwgLTEyNSwgLTEyNCwgLTEyMywgLTEyMiwgLTEyMSwgLTEyMCwgLTExOSwgLTExOCwgLTExNywgLTExNiwgLTExNSwgLTExNCwKKyAgICAgICAgICAgLTExMywgLTExMiwgLTExMSwgLTExMCwgLTEwOSwgLTEwOCwgLTEwNywgLTEwNiwgLTEwNSwgLTEwNCwgLTEwMywgLTEwMiwgLTEwMSwgLTEwMCwgLTk5LAorICAgICAgICAgICAtOTgsICAtOTcsICAtOTYsICAtOTUsICAtOTQsICAtOTMsICAtOTIsICAtOTEsICAtOTAsICAtODksICAtODgsICAtODcsICAtODYsICAtODUsICAtODQsCisgICAgICAgICAgIC04MywgIC04MiwgIC04MSwgIC04MCwgIC03OSwgIC03OCwgIC03NywgIC03NiwgIC03NSwgIC03NCwgIC03MywgIC03MiwgIC03MSwgIC03MCwgIC02OSwKKyAgICAgICAgICAgLTY4LCAgLTY3LCAgLTY2LCAgLTY1LCAgLTY0LCAgLTYzLCAgLTYyLCAgLTYxLCAgLTYwLCAgLTU5LCAgLTU4LCAgLTU3LCAgLTU2LCAgLTU1LCAgLTU0LAorICAgICAgICAgICAtNTMsICAtNTIsICAtNTEsICAtNTAsICAtNDksICAtNDgsICAtNDcsICAtNDYsICAtNDUsICAtNDQsICAtNDMsICAtNDIsICAtNDEsICAtNDAsICAtMzksCisgICAgICAgICAgIC0zOCwgIC0zNywgIC0zNiwgIC0zNSwgIC0zNCwgIC0zMywgIC0zMiwgIC0zMSwgIC0zMCwgIC0yOSwgIC0yOCwgIC0yNywgIC0yNiwgIC0yNSwgIC0yNCwKKyAgICAgICAgICAgLTIzLCAgLTIyLCAgLTIxLCAgLTIwLCAgLTE5LCAgLTE4LCAgLTE3LCAgLTE2LCAgLTE1LCAgLTE0LCAgLTEzLCAgLTEyLCAgLTExLCAgLTEwLCAgLTksCisgICAgICAgICAgIC04LCAgIC03LCAgIC02LCAgIC01LCAgIC00LCAgIC0zLCAgIC0yLCAgIC0xLCAgIDAsICAgIDEsICAgIDIsICAgIDMsICAgIDQsICAgIDUsICAgIDYsCisgICAgICAgICAgIDcsICAgIDgsICAgIDksICAgIDEwLCAgIDExLCAgIDEyLCAgIDEzLCAgIDE0LCAgIDE1LCAgIDE2LCAgIDE3LCAgIDE4LCAgIDE5LCAgIDIwLCAgIDIxLAorICAgICAgICAgICAyMiwgICAyMywgICAyNCwgICAyNSwgICAyNiwgICAyNywgICAyOCwgICAyOSwgICAzMCwgICAzMSwgICAzMiwgICAzMywgICAzNCwgICAzNSwgICAzNiwKKyAgICAgICAgICAgMzcsICAgMzgsICAgMzksICAgNDAsICAgNDEsICAgNDIsICAgNDMsICAgNDQsICAgNDUsICAgNDYsICAgNDcsICAgNDgsICAgNDksICAgNTAsICAgNTEsCisgICAgICAgICAgIDUyLCAgIDUzLCAgIDU0LCAgIDU1LCAgIDU2LCAgIDU3LCAgIDU4LCAgIDU5LCAgIDYwLCAgIDYxLCAgIDYyLCAgIDYzLCAgIDY0LCAgIDY1LCAgIDY2LAorICAgICAgICAgICA2NywgICA2OCwgICA2OSwgICA3MCwgICA3MSwgICA3MiwgICA3MywgICA3NCwgICA3NSwgICA3NiwgICA3NywgICA3OCwgICA3OSwgICA4MCwgICA4MSwKKyAgICAgICAgICAgODIsICAgODMsICAgODQsICAgODUsICAgODYsICAgODcsICAgODgsICAgODksICAgOTAsICAgOTEsICAgOTIsICAgOTMsICAgOTQsICAgOTUsICAgOTYsCisgICAgICAgICAgIDk3LCAgIDk4LCAgIDk5LCAgIDEwMCwgIDEwMSwgIDEwMiwgIDEwMywgIDEwNCwgIDEwNSwgIDEwNiwgIDEwNywgIDEwOCwgIDEwOSwgIDExMCwgIDExMSwKKyAgICAgICAgICAgMTEyLCAgMTEzLCAgMTE0LCAgMTE1LCAgMTE2LCAgMTE3LCAgMTE4LCAgMTE5LCAgMTIwLCAgMTIxLCAgMTIyLCAgMTIzLCAgMTI0LCAgMTI1LCAgMTI2LAorICAgICAgICAgICAxMjd9OworICAgICAgR0J5dGVBcnJheSAqZnVsbEFycmF5ID0gZ19ieXRlX2FycmF5X25ldygpOworICAgICAgZ19ieXRlX2FycmF5X2FwcGVuZChmdWxsQXJyYXksIChndWludDggKikoJmJpbl9kYXRhWzBdKSwgMjU2KTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9iaW5hcnkgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bGxBcnJheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgR0J5dGVzICpyZXNwb25zZSA9IGdfYnl0ZV9hcnJheV9mcmVlX3RvX2J5dGVzKHJlc3VsdCk7ICAvLyBmcmVlcyByZXN1bHQKKyAgICAgICAgcmVzdWx0ID0gTlVMTDsKKyAgICAgICAgZ3NpemUgc2l6ID0gZ19ieXRlc19nZXRfc2l6ZShyZXNwb25zZSk7CisgICAgICAgIGdjb25zdHBvaW50ZXIgcHRyID0gZ19ieXRlc19nZXRfZGF0YShyZXNwb25zZSwgJnNpeik7CisgICAgICAgIGlmIChzaXogPT0gMjU2KSB7CisgICAgICAgICAgZ2Jvb2xlYW4gZmlyc3QgPSAxOworICAgICAgICAgIGdib29sZWFuIGZhaWxlZCA9IDA7CisgICAgICAgICAgaW50IGk7CisKKyAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgMjU2OyArK2kpIHsKKyAgICAgICAgICAgIGlmICghZmlyc3QpCisgICAgICAgICAgICAgIHByaW50ZigiLCIpOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICBmaXJzdCA9IDA7CisgICAgICAgICAgICBpbnQgdmFsID0gKChzaWduZWQgY2hhciAqKXB0cilbaV07CisgICAgICAgICAgICBwcmludGYoIiVkIiwgdmFsKTsKKyAgICAgICAgICAgIGlmICghZmFpbGVkICYmIHZhbCAhPSBpIC0gMTI4KSB7CisgICAgICAgICAgICAgIGZhaWxlZCA9IDE7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICAgIHByaW50ZigifSAiKTsKKyAgICAgICAgICBpZiAoZmFpbGVkKSB7CisgICAgICAgICAgICBwcmludGYoIkZBSUwgKGJhZCBjb250ZW50KSBzaXplICVsZCBPS1xuIiwgKGxvbmcpc2l6KTsKKyAgICAgICAgICAgICsrZmFpbF9jb3VudDsKKyAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcHJpbnRmKCJPSyBzaXplICVsZCBPS1xuIiwgKGxvbmcpc2l6KTsKKyAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgcHJpbnRmKCIgPSBiYWQgc2l6ZSAlbGRcbiIsIChsb25nKXNpeik7CisgICAgICAgICAgKytmYWlsX2NvdW50OworICAgICAgICB9CisgICAgICAgIGdfYnl0ZXNfdW5yZWYocmVzcG9uc2UpOworICAgICAgfSBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBnX2J5dGVfYXJyYXlfdW5yZWYoZnVsbEFycmF5KTsKKyAgICAgIGZ1bGxBcnJheSA9IE5VTEw7CisKKyAgICAgIC8qKgorICAgICAgICogU1RSVUNUIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgidGVzdFN0cnVjdCh7XCJaZXJvXCIsIDEsIC0zLCAtNX0pIik7CisgICAgICB4dHJ1Y3Rfb3V0ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YVFJVQ1QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgIlplcm8iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJ5dGVfdGhpbmciLCAgICAgICAgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICAgICAgLTMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgICAtNUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICB4dHJ1Y3RfaW4gPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1hUUlVDVCwgTlVMTCk7CisKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9zdHJ1Y3QgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnh0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHh0cnVjdF9vdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIGdfb2JqZWN0X2dldCAoeHRydWN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAmc3RyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICAmYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAiaTMyX3RoaW5nIiwgICAgJmkzMl90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgJmk2NF90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgICAgICBwcmludGYgKCIgPSB7XCIlc1wiLCAlZCwgJWQsICUiIFBSSWQ2NCAifVxuIiwKKyAgICAgICAgICAgICAgICBzdHJpbmcsCisgICAgICAgICAgICAgICAgYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICBpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgaTY0X3RoaW5nKTsKKyAgICAgICAgaWYgKChzdHJpbmcgPT0gTlVMTCB8fCBzdHJuY21wIChzdHJpbmcsICJaZXJvIiwgNSkgIT0gMCkgfHwKKyAgICAgICAgICAgIGJ5dGVfdGhpbmcgIT0gMSB8fAorICAgICAgICAgICAgaTMyX3RoaW5nICE9IC0zIHx8CisgICAgICAgICAgICBpNjRfdGhpbmcgIT0gKGdpbnQ2NCktNSkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisKKyAgICAgICAgaWYgKHN0cmluZykgeworICAgICAgICAgIGdfZnJlZSAoc3RyaW5nKTsKKyAgICAgICAgICBzdHJpbmcgPSBOVUxMOworICAgICAgICB9CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICAvLyBnX2NsZWFyX29iamVjdCgmeHRydWN0X291dCk7IHVzZWQgYmVsb3cKKyAgICAgIGdfY2xlYXJfb2JqZWN0KCZ4dHJ1Y3RfaW4pOworCisgICAgICAvKioKKyAgICAgICAqIE5FU1RFRCBTVFJVQ1QgVEVTVAorICAgICAgICovCisgICAgICBwcmludGYgKCJ0ZXN0TmVzdCh7MSwge1wiWmVyb1wiLCAxLCAtMywgLTV9KSwgNX0iKTsKKyAgICAgIHh0cnVjdDJfb3V0ID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YVFJVQ1QyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICAgICAgICAgICAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJ1Y3RfdGhpbmciLCB4dHJ1Y3Rfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICAgICAgICAgICA1LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgICAgeHRydWN0Ml9pbiA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfWFRSVUNUMiwgTlVMTCk7CisKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9uZXN0ICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeHRydWN0Ml9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4dHJ1Y3QyX291dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIGdfb2JqZWN0X2dldCAoeHRydWN0Ml9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgJmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgInN0cnVjdF90aGluZyIsICZ4dHJ1Y3RfaW4sCisgICAgICAgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgICZpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICAgIGdfb2JqZWN0X2dldCAoeHRydWN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAmc3RyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICAmaW5uZXJfYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAiaTMyX3RoaW5nIiwgICAgJmlubmVyX2kzMl90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgJmlubmVyX2k2NF90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgICAgICBwcmludGYgKCIgPSB7JWQsIHtcIiVzXCIsICVkLCAlZCwgJSIgUFJJZDY0ICJ9LCAlZH1cbiIsCisgICAgICAgICAgICAgICAgYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICBzdHJpbmcsCisgICAgICAgICAgICAgICAgaW5uZXJfYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICBpbm5lcl9pMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgaW5uZXJfaTY0X3RoaW5nLAorICAgICAgICAgICAgICAgIGkzMl90aGluZyk7CisgICAgICAgIGlmIChieXRlX3RoaW5nICE9IDEgfHwKKyAgICAgICAgICAgIChzdHJpbmcgPT0gTlVMTCB8fCBzdHJuY21wIChzdHJpbmcsICJaZXJvIiwgNSkgIT0gMCkgfHwKKyAgICAgICAgICAgIGlubmVyX2J5dGVfdGhpbmcgIT0gMSB8fAorICAgICAgICAgICAgaW5uZXJfaTMyX3RoaW5nICE9IC0zIHx8CisgICAgICAgICAgICBpbm5lcl9pNjRfdGhpbmcgIT0gKGdpbnQ2NCktNSB8fAorICAgICAgICAgICAgaTMyX3RoaW5nICE9IDUpCisgICAgICAgICAgZmFpbF9jb3VudCsrOworCisgICAgICAgIGlmIChzdHJpbmcpIHsKKyAgICAgICAgICBnX2ZyZWUoc3RyaW5nKTsKKyAgICAgICAgICBzdHJpbmcgPSBOVUxMOworICAgICAgICB9CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIGdfY2xlYXJfb2JqZWN0KCZ4dHJ1Y3RfaW4pOworICAgICAgZ19jbGVhcl9vYmplY3QoJnh0cnVjdDJfaW4pOworICAgICAgZ19jbGVhcl9vYmplY3QoJnh0cnVjdDJfb3V0KTsKKyAgICAgIGdfY2xlYXJfb2JqZWN0KCZ4dHJ1Y3Rfb3V0KTsKKworICAgICAgLyoqCisgICAgICAgKiBNQVAgVEVTVAorICAgICAgICovCisgICAgICBtYXBfb3V0ID0gZ19oYXNoX3RhYmxlX25ld19mdWxsIChnX2ludF9oYXNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19pbnRfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUpOworICAgICAgZm9yIChpID0gMDsgaSA8IDU7ICsraSkgeworICAgICAgICBpMzJfa2V5X3B0ciAgID0gZ19tYWxsb2MgKHNpemVvZiAqaTMyX2tleV9wdHIpOworICAgICAgICBpMzJfdmFsdWVfcHRyID0gZ19tYWxsb2MgKHNpemVvZiAqaTMyX3ZhbHVlX3B0cik7CisKKyAgICAgICAgKmkzMl9rZXlfcHRyICAgPSBpOworICAgICAgICAqaTMyX3ZhbHVlX3B0ciA9IGkgLSAxMDsKKworICAgICAgICBnX2hhc2hfdGFibGVfaW5zZXJ0IChtYXBfb3V0LCBpMzJfa2V5X3B0ciwgaTMyX3ZhbHVlX3B0cik7CisgICAgICB9CisgICAgICBwcmludGYgKCJ0ZXN0TWFwKHsiKTsKKyAgICAgIGZpcnN0ID0gVFJVRTsKKyAgICAgIGdfaGFzaF90YWJsZV9pdGVyX2luaXQgKCZoYXNoX3RhYmxlX2l0ZXIsIG1hcF9vdXQpOworICAgICAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZoYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWUpKSB7CisgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICBmaXJzdCA9IEZBTFNFOworICAgICAgICBlbHNlCisgICAgICAgICAgcHJpbnRmICgiLCAiKTsKKworICAgICAgICBwcmludGYgKCIlZCA9PiAlZCIsICooZ2ludDMyICopa2V5LCAqKGdpbnQzMiAqKXZhbHVlKTsKKyAgICAgIH0KKyAgICAgIHByaW50ZiAoIn0pIik7CisKKyAgICAgIG1hcF9pbiA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19pbnRfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19pbnRfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19mcmVlKTsKKworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X21hcCAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbWFwX2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwX291dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0geyIpOworICAgICAgICBmaXJzdCA9IFRSVUU7CisgICAgICAgIGdfaGFzaF90YWJsZV9pdGVyX2luaXQgKCZoYXNoX3RhYmxlX2l0ZXIsIG1hcF9pbik7CisgICAgICAgIHdoaWxlIChnX2hhc2hfdGFibGVfaXRlcl9uZXh0ICgmaGFzaF90YWJsZV9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICBmaXJzdCA9IEZBTFNFOworICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHByaW50ZiAoIiwgIik7CisKKyAgICAgICAgICBwcmludGYgKCIlZCA9PiAlZCIsICooZ2ludDMyICopa2V5LCAqKGdpbnQzMiAqKXZhbHVlKTsKKyAgICAgICAgfQorICAgICAgICBwcmludGYgKCJ9XG4iKTsKKworICAgICAgICBpZiAoZ19oYXNoX3RhYmxlX3NpemUgKG1hcF9pbikgIT0gZ19oYXNoX3RhYmxlX3NpemUgKG1hcF9vdXQpKQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgZWxzZSB7CisgICAgICAgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgbWFwX291dCk7CisgICAgICAgICAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZoYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICAgICAgICAgIGdwb2ludGVyIGluX3ZhbHVlID0gZ19oYXNoX3RhYmxlX2xvb2t1cCAobWFwX2luLCBrZXkpOworICAgICAgICAgICAgaWYgKGluX3ZhbHVlID09IE5VTEwgfHwKKyAgICAgICAgICAgICAgICAqKGdpbnQzMiAqKWluX3ZhbHVlICE9ICooZ2ludDMyICopdmFsdWUpIHsKKyAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgZ19oYXNoX3RhYmxlX3VucmVmIChtYXBfaW4pOworICAgICAgZ19oYXNoX3RhYmxlX3VucmVmIChtYXBfb3V0KTsKKworICAgICAgLyoqCisgICAgICAgKiBTVFJJTkcgTUFQIFRFU1QKKyAgICAgICAqLworICAgICAgbWFwX291dCA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19zdHJfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfc3RyX2VxdWFsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgICAgZ19oYXNoX3RhYmxlX2luc2VydCAobWFwX291dCwgImEiLCAgICAiMiIpOworICAgICAgZ19oYXNoX3RhYmxlX2luc2VydCAobWFwX291dCwgImIiLCAgICAiYmxhaCIpOworICAgICAgZ19oYXNoX3RhYmxlX2luc2VydCAobWFwX291dCwgInNvbWUiLCAidGhpbmciKTsKKyAgICAgIHByaW50ZiAoInRlc3RTdHJpbmdNYXAoeyIpOworICAgICAgZmlyc3QgPSBUUlVFOworICAgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgbWFwX291dCk7CisgICAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmhhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAma2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgIGZpcnN0ID0gRkFMU0U7CisgICAgICAgIGVsc2UKKyAgICAgICAgICBwcmludGYgKCIsICIpOworCisgICAgICAgIHByaW50ZiAoIlwiJXNcIiA9PiBcIiVzXCIiLCAoZ2NoYXIgKilrZXksIChnY2hhciAqKXZhbHVlKTsKKyAgICAgIH0KKyAgICAgIHByaW50ZiAoIil9Iik7CisKKyAgICAgIG1hcF9pbiA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19zdHJfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19zdHJfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19mcmVlKTsKKworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X3N0cmluZ19tYXAgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZtYXBfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwX291dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9IHsiKTsKKyAgICAgICAgZmlyc3QgPSBUUlVFOworICAgICAgICBnX2hhc2hfdGFibGVfaXRlcl9pbml0ICgmaGFzaF90YWJsZV9pdGVyLCBtYXBfaW4pOworICAgICAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmhhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWUpKSB7CisgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgZmlyc3QgPSBGQUxTRTsKKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICBwcmludGYgKCIsICIpOworCisgICAgICAgICAgcHJpbnRmICgiXCIlc1wiID0+IFwiJXNcIiIsIChnY2hhciAqKWtleSwgKGdjaGFyICopdmFsdWUpOworICAgICAgICB9CisgICAgICAgIHByaW50ZiAoIn1cbiIpOworCisgICAgICAgIGlmIChnX2hhc2hfdGFibGVfc2l6ZSAobWFwX2luKSAhPSBnX2hhc2hfdGFibGVfc2l6ZSAobWFwX291dCkpCisgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICBlbHNlIHsKKyAgICAgICAgICBnX2hhc2hfdGFibGVfaXRlcl9pbml0ICgmaGFzaF90YWJsZV9pdGVyLCBtYXBfb3V0KTsKKyAgICAgICAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmhhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlKSkgeworICAgICAgICAgICAgZ3BvaW50ZXIgaW5fdmFsdWUgPSBnX2hhc2hfdGFibGVfbG9va3VwIChtYXBfaW4sIGtleSk7CisgICAgICAgICAgICBpZiAoaW5fdmFsdWUgPT0gTlVMTCB8fAorICAgICAgICAgICAgICAgIHN0cmNtcCAoKGdjaGFyICopaW5fdmFsdWUsIChnY2hhciAqKXZhbHVlKSAhPSAwKSB7CisgICAgICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorICAgICAgICB9CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIGdfaGFzaF90YWJsZV91bnJlZiAobWFwX2luKTsKKyAgICAgIGdfaGFzaF90YWJsZV91bnJlZiAobWFwX291dCk7CisKKyAgICAgIC8qKgorICAgICAgICogU0VUIFRFU1QKKyAgICAgICAqLworICAgICAgc2V0X291dCA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19pbnRfaGFzaCwgZ19pbnRfZXF1YWwsIGdfZnJlZSwgTlVMTCk7CisgICAgICBmb3IgKGkgPSAtMjsgaSA8IDM7ICsraSkgeworICAgICAgICBpMzJfa2V5X3B0ciA9IGdfbWFsbG9jIChzaXplb2YgKmkzMl9rZXlfcHRyKTsKKyAgICAgICAgKmkzMl9rZXlfcHRyID0gaTsKKworICAgICAgICBnX2hhc2hfdGFibGVfaW5zZXJ0IChzZXRfb3V0LCBpMzJfa2V5X3B0ciwgTlVMTCk7CisgICAgICB9CisgICAgICBwcmludGYgKCJ0ZXN0U2V0KHsiKTsKKyAgICAgIGZpcnN0ID0gVFJVRTsKKyAgICAgIGtleXNfb3V0ID0gZ19oYXNoX3RhYmxlX2dldF9rZXlzIChzZXRfb3V0KTsKKyAgICAgIGtleXNfZWxlbSA9IGtleXNfb3V0OworICAgICAgd2hpbGUgKGtleXNfZWxlbSAhPSBOVUxMKSB7CisgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICBmaXJzdCA9IEZBTFNFOworICAgICAgICBlbHNlCisgICAgICAgICAgcHJpbnRmICgiLCAiKTsKKworICAgICAgICBwcmludGYgKCIlZCIsICooZ2ludDMyICopa2V5c19lbGVtLT5kYXRhKTsKKworICAgICAgICBrZXlzX2VsZW0gPSBrZXlzX2VsZW0tPm5leHQ7CisgICAgICB9CisgICAgICBwcmludGYgKCJ9KSIpOworCisgICAgICBzZXRfaW4gPSBnX2hhc2hfdGFibGVfbmV3X2Z1bGwgKGdfaW50X2hhc2gsIGdfaW50X2VxdWFsLCBnX2ZyZWUsIE5VTEwpOworCisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3Rfc2V0ICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzZXRfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSkgeworICAgICAgICBwcmludGYoIiA9IHsiKTsKKyAgICAgICAgZmlyc3QgPSBUUlVFOworICAgICAgICBrZXlzX2luID0gZ19oYXNoX3RhYmxlX2dldF9rZXlzIChzZXRfaW4pOworICAgICAgICBrZXlzX2VsZW0gPSBrZXlzX2luOworICAgICAgICB3aGlsZSAoa2V5c19lbGVtICE9IE5VTEwpIHsKKyAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICBmaXJzdCA9IEZBTFNFOworICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHByaW50ZiAoIiwgIik7CisKKyAgICAgICAgICBwcmludGYgKCIlZCIsICooZ2ludDMyICopa2V5c19lbGVtLT5kYXRhKTsKKworICAgICAgICAgIGtleXNfZWxlbSA9IGtleXNfZWxlbS0+bmV4dDsKKyAgICAgICAgfQorICAgICAgICBwcmludGYgKCJ9XG4iKTsKKworICAgICAgICBpZiAoZ19saXN0X2xlbmd0aCAoa2V5c19pbikgIT0gZ19saXN0X2xlbmd0aCAoa2V5c19vdXQpKQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgZWxzZSB7CisgICAgICAgICAga2V5c19lbGVtID0ga2V5c19vdXQ7CisgICAgICAgICAgd2hpbGUgKGtleXNfZWxlbSAhPSBOVUxMKSB7CisgICAgICAgICAgICBpZiAoZ19saXN0X2ZpbmRfY3VzdG9tIChrZXlzX2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5c19lbGVtLT5kYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDMyX2NvbXBhcmUpID09IE5VTEwpIHsKKyAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAga2V5c19lbGVtID0ga2V5c19lbGVtLT5uZXh0OworICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGdfbGlzdF9mcmVlIChrZXlzX2luKTsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgZ19oYXNoX3RhYmxlX3VucmVmIChzZXRfaW4pOworICAgICAgZ19saXN0X2ZyZWUgKGtleXNfb3V0KTsKKyAgICAgIGdfaGFzaF90YWJsZV91bnJlZiAoc2V0X291dCk7CisKKyAgICAgIC8qKgorICAgICAgICogTElTVCBURVNUCisgICAgICAgKi8KKyAgICAgIGxpc3Rfb3V0ID0gZ19hcnJheV9uZXcgKEZBTFNFLCBUUlVFLCBzaXplb2YgKGdpbnQzMikpOworICAgICAgZm9yIChpID0gLTI7IGkgPCAzOyArK2kpIHsKKyAgICAgICAgZ19hcnJheV9hcHBlbmRfdmFsIChsaXN0X291dCwgaSk7CisgICAgICB9CisgICAgICBwcmludGYgKCJ0ZXN0TGlzdCh7Iik7CisgICAgICBmaXJzdCA9IFRSVUU7CisgICAgICBmb3IgKGkgPSAwOyBpIDwgKGdpbnQzMilsaXN0X291dC0+bGVuOyArK2kpIHsKKyAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgIGZpcnN0ID0gRkFMU0U7CisgICAgICAgIGVsc2UKKyAgICAgICAgICBwcmludGYgKCIsICIpOworCisgICAgICAgIHByaW50ZiAoIiVkIiwgZ19hcnJheV9pbmRleCAobGlzdF9vdXQsIGdpbnQzMiwgaSkpOworICAgICAgfQorICAgICAgcHJpbnRmICgifSkiKTsKKworICAgICAgbGlzdF9pbiA9IGdfYXJyYXlfbmV3IChGQUxTRSwgVFJVRSwgc2l6ZW9mIChnaW50MzIpKTsKKworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2xpc3QgKHRlc3RfY2xpZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZsaXN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Rfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0geyIpOworICAgICAgICBmaXJzdCA9IFRSVUU7CisgICAgICAgIGZvciAoaSA9IDA7IGkgPCAoZ2ludDMyKWxpc3RfaW4tPmxlbjsgKytpKSB7CisgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgZmlyc3QgPSBGQUxTRTsKKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICBwcmludGYgKCIsICIpOworCisgICAgICAgICAgcHJpbnRmICgiJWQiLCBnX2FycmF5X2luZGV4IChsaXN0X2luLCBnaW50MzIsIGkpKTsKKyAgICAgICAgfQorICAgICAgICBwcmludGYgKCJ9XG4iKTsKKworICAgICAgICBpZiAobGlzdF9pbi0+bGVuICE9IGxpc3Rfb3V0LT5sZW4gfHwKKyAgICAgICAgICAgIG1lbWNtcCAobGlzdF9pbi0+ZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgbGlzdF9vdXQtPmRhdGEsCisgICAgICAgICAgICAgICAgICAgIGxpc3RfaW4tPmxlbiAqIHNpemVvZiAoZ2ludDMyKSkgIT0gMCkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIGdfYXJyYXlfdW5yZWYgKGxpc3RfaW4pOworICAgICAgZ19hcnJheV91bnJlZiAobGlzdF9vdXQpOworCisgICAgICAvKioKKyAgICAgICAqIEVOVU0gVEVTVAorICAgICAgICovCisgICAgICBwcmludGYoInRlc3RFbnVtKE9ORSkiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9lbnVtICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbnVtYmVyeiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX1RFU1RfTlVNQkVSWl9PTkUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSkgeworICAgICAgICBwcmludGYoIiA9ICVkXG4iLCBudW1iZXJ6KTsKKyAgICAgICAgaWYgKG51bWJlcnogIT0gVF9URVNUX05VTUJFUlpfT05FKQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgcHJpbnRmKCJ0ZXN0RW51bShUV08pIik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfZW51bSAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm51bWJlcnosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9URVNUX05VTUJFUlpfVFdPLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmKCIgPSAlZFxuIiwgbnVtYmVyeik7CisgICAgICAgIGlmIChudW1iZXJ6ICE9IFRfVEVTVF9OVU1CRVJaX1RXTykKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIHByaW50ZigidGVzdEVudW0oVEhSRUUpIik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfZW51bSAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm51bWJlcnosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9URVNUX05VTUJFUlpfVEhSRUUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSkgeworICAgICAgICBwcmludGYoIiA9ICVkXG4iLCBudW1iZXJ6KTsKKyAgICAgICAgaWYgKG51bWJlcnogIT0gVF9URVNUX05VTUJFUlpfVEhSRUUpCisgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorCisgICAgICBwcmludGYoInRlc3RFbnVtKEZJVkUpIik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfZW51bSAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm51bWJlcnosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVF9URVNUX05VTUJFUlpfRklWRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZigiID0gJWRcbiIsIG51bWJlcnopOworICAgICAgICBpZiAobnVtYmVyeiAhPSBUX1RFU1RfTlVNQkVSWl9GSVZFKQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgcHJpbnRmKCJ0ZXN0RW51bShFSUdIVCkiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF9lbnVtICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbnVtYmVyeiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUX1RFU1RfTlVNQkVSWl9FSUdIVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZigiID0gJWRcbiIsIG51bWJlcnopOworICAgICAgICBpZiAobnVtYmVyeiAhPSBUX1RFU1RfTlVNQkVSWl9FSUdIVCkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogVFlQRURFRiBURVNUCisgICAgICAgKi8KKyAgICAgIHByaW50ZiAoInRlc3RUeXBlZGVmKDMwOTg1ODIzNTA4MjUyMykiKTsKKyAgICAgIGlmICh0X3Rlc3RfdGhyaWZ0X3Rlc3RfaWZfdGVzdF90eXBlZGVmICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdXNlcl9pZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMDk4NTgyMzUwODI1MjNMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZigiID0gJSIgUFJJZDY0ICJcbiIsIHVzZXJfaWQpOworICAgICAgICBpZiAodXNlcl9pZCAhPSAzMDk4NTgyMzUwODI1MjNMTCkKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiJXNcbiIsIGVycm9yLT5tZXNzYWdlKTsKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKworICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogTkVTVEVEIE1BUCBURVNUCisgICAgICAgKi8KKyAgICAgIHByaW50ZiAoInRlc3RNYXBNYXAoMSkiKTsKKyAgICAgIG1hcF9pbiA9IGdfaGFzaF90YWJsZV9uZXdfZnVsbCAoZ19pbnRfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19pbnRfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEdEZXN0cm95Tm90aWZ5KWdfaGFzaF90YWJsZV91bnJlZik7CisgICAgICBpZiAodF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfbWFwX21hcCAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1hcF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgbWFwX2luKTsKKworICAgICAgICBwcmludGYgKCIgPSB7Iik7CisgICAgICAgIHdoaWxlIChnX2hhc2hfdGFibGVfaXRlcl9uZXh0ICgmaGFzaF90YWJsZV9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICAgICAgICBwcmludGYgKCIlZCA9PiB7IiwgKihnaW50MzIgKilrZXkpOworCisgICAgICAgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmlubmVyX2hhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoR0hhc2hUYWJsZSAqKXZhbHVlKTsKKyAgICAgICAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmlubmVyX2hhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlKSkgeworICAgICAgICAgICAgcHJpbnRmICgiJWQgPT4gJWQsICIsICooZ2ludDMyICopa2V5LCAqKGdpbnQzMiAqKXZhbHVlKTsKKyAgICAgICAgICB9CisKKyAgICAgICAgICBwcmludGYgKCJ9LCAiKTsKKyAgICAgICAgfQorICAgICAgICBwcmludGYgKCJ9XG4iKTsKKworICAgICAgICBpZiAoZ19oYXNoX3RhYmxlX3NpemUgKG1hcF9pbikgIT0gMikKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgIGVsc2UgeworICAgICAgICAgIGdpbnQzMiBpbm5lcl9rZXlzW10gPSB7MSwgMiwgMywgNH07CisgICAgICAgICAgZ2ludDMyIGkzMl9rZXk7CisKKyAgICAgICAgICBpMzJfa2V5ID0gLTQ7CisgICAgICAgICAgaW5uZXJfbWFwX2luID0gZ19oYXNoX3RhYmxlX2xvb2t1cCAobWFwX2luLCAmaTMyX2tleSk7CisgICAgICAgICAgaWYgKGlubmVyX21hcF9pbiA9PSBOVUxMIHx8CisgICAgICAgICAgICAgIGdfaGFzaF90YWJsZV9zaXplIChpbm5lcl9tYXBfaW4pICE9IDQpCisgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBrZXlzX2luID0gZ19oYXNoX3RhYmxlX2dldF9rZXlzIChpbm5lcl9tYXBfaW4pOworICAgICAgICAgICAga2V5c19pbiA9IGdfbGlzdF9zb3J0IChrZXlzX2luLCBnaW50MzJfY29tcGFyZSk7CisKKyAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpKyspIHsKKyAgICAgICAgICAgICAga2V5c19lbGVtID0gZ19saXN0X250aCAoa2V5c19pbiwgMyAtIGkpOworCisgICAgICAgICAgICAgIGlmICgqKGdpbnQzMiAqKWtleXNfZWxlbS0+ZGF0YSAhPSAoLTEgKiBpbm5lcl9rZXlzW2ldKSB8fAorICAgICAgICAgICAgICAgICAgKihnaW50MzIgKilnX2hhc2hfdGFibGVfbG9va3VwIChpbm5lcl9tYXBfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleXNfZWxlbS0+ZGF0YSkgIT0KKyAgICAgICAgICAgICAgICAgICgtMSAqIGlubmVyX2tleXNbaV0pKSB7CisgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGdfbGlzdF9mcmVlIChrZXlzX2luKTsKKyAgICAgICAgICB9CisKKyAgICAgICAgICBpMzJfa2V5ID0gNDsKKyAgICAgICAgICBpbm5lcl9tYXBfaW4gPSBnX2hhc2hfdGFibGVfbG9va3VwIChtYXBfaW4sICZpMzJfa2V5KTsKKyAgICAgICAgICBpZiAoaW5uZXJfbWFwX2luID09IE5VTEwgfHwKKyAgICAgICAgICAgICAgZ19oYXNoX3RhYmxlX3NpemUgKGlubmVyX21hcF9pbikgIT0gNCkKKyAgICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIGtleXNfaW4gPSBnX2hhc2hfdGFibGVfZ2V0X2tleXMgKGlubmVyX21hcF9pbik7CisgICAgICAgICAgICBrZXlzX2luID0gZ19saXN0X3NvcnQgKGtleXNfaW4sIGdpbnQzMl9jb21wYXJlKTsKKworICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IDQ7IGkrKykgeworICAgICAgICAgICAgICBrZXlzX2VsZW0gPSBnX2xpc3RfbnRoIChrZXlzX2luLCBpKTsKKworICAgICAgICAgICAgICBpZiAoKihnaW50MzIgKilrZXlzX2VsZW0tPmRhdGEgIT0gaW5uZXJfa2V5c1tpXSB8fAorICAgICAgICAgICAgICAgICAgKihnaW50MzIgKilnX2hhc2hfdGFibGVfbG9va3VwIChpbm5lcl9tYXBfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleXNfZWxlbS0+ZGF0YSkgIT0KKyAgICAgICAgICAgICAgICAgIGlubmVyX2tleXNbaV0pIHsKKyAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZ19saXN0X2ZyZWUgKGtleXNfaW4pOworICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgfQorICAgICAgZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiVzXG4iLCBlcnJvci0+bWVzc2FnZSk7CisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisKKyAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgfQorCisgICAgICBnX2hhc2hfdGFibGVfdW5yZWYgKG1hcF9pbik7CisKKyAgICAgIC8qKgorICAgICAgICogSU5TQU5JVFkgVEVTVAorICAgICAgICovCisgICAgICBpbnNhbml0eV9vdXQgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX0lOU0FOSVRZLCBOVUxMKTsKKyAgICAgIGdfb2JqZWN0X2dldCAoaW5zYW5pdHlfb3V0LAorICAgICAgICAgICAgICAgICAgICAidXNlck1hcCIsICZ1c2VyX21hcCwKKyAgICAgICAgICAgICAgICAgICAgInh0cnVjdHMiLCAmeHRydWN0cywKKyAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICAgIG51bWJlcnogPSBUX1RFU1RfTlVNQkVSWl9GSVZFOworICAgICAgbnVtYmVyejIgPSBUX1RFU1RfTlVNQkVSWl9FSUdIVDsKKyAgICAgIHVzZXJfaWRfcHRyID0gZ19tYWxsb2MgKHNpemVvZiAqdXNlcl9pZF9wdHIpOworICAgICAgKnVzZXJfaWRfcHRyID0gNTsKKyAgICAgIHVzZXJfaWRfcHRyMiA9IGdfbWFsbG9jIChzaXplb2YgKnVzZXJfaWRfcHRyKTsKKyAgICAgICp1c2VyX2lkX3B0cjIgPSA4OworICAgICAgZ19oYXNoX3RhYmxlX2luc2VydCAodXNlcl9tYXAsIChncG9pbnRlciludW1iZXJ6LCB1c2VyX2lkX3B0cik7CisgICAgICBnX2hhc2hfdGFibGVfaW5zZXJ0ICh1c2VyX21hcCwgKGdwb2ludGVyKW51bWJlcnoyLCB1c2VyX2lkX3B0cjIpOworICAgICAgZ19oYXNoX3RhYmxlX3VucmVmICh1c2VyX21hcCk7CisKKyAgICAgIHh0cnVjdF9vdXQgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1hUUlVDVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAiSGVsbG8yIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICAyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgIDIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgMkxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICB4dHJ1Y3Rfb3V0MiA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfWFRSVUNULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN0cmluZ190aGluZyIsICJHb29kYnllNCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgNCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICA0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgIDRMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgICAgZ19wdHJfYXJyYXlfYWRkICh4dHJ1Y3RzLCB4dHJ1Y3Rfb3V0Mik7CisgICAgICBnX3B0cl9hcnJheV9hZGQgKHh0cnVjdHMsIHh0cnVjdF9vdXQpOworICAgICAgZ19wdHJfYXJyYXlfdW5yZWYgKHh0cnVjdHMpOworCisgICAgICBtYXBfaW4gPSBnX2hhc2hfdGFibGVfbmV3X2Z1bGwgKGdfaW50NjRfaGFzaCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19pbnQ2NF9lcXVhbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19mcmVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoR0Rlc3Ryb3lOb3RpZnkpZ19oYXNoX3RhYmxlX3VucmVmKTsKKworICAgICAgcHJpbnRmKCJ0ZXN0SW5zYW5pdHkoKSIpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2luc2FuaXR5ICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1hcF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zYW5pdHlfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICAgIHByaW50ZiAoIiA9IHsiKTsKKyAgICAgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgbWFwX2luKTsKKyAgICAgICAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZoYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAma2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlKSkgeworICAgICAgICAgIHByaW50ZiAoIiUiIFBSSWQ2NCAiID0+IHsiLCAqKFRUZXN0VXNlcklkICopa2V5KTsKKworICAgICAgICAgIGdfaGFzaF90YWJsZV9pdGVyX2luaXQgKCZpbm5lcl9oYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEdIYXNoVGFibGUgKil2YWx1ZSk7CisgICAgICAgICAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZpbm5lcl9oYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICAgICAgICAgIHByaW50ZiAoIiVkID0+IHsiLCAoVFRlc3ROdW1iZXJ6KWtleSk7CisKKyAgICAgICAgICAgIGdfb2JqZWN0X2dldCAoKFRUZXN0SW5zYW5pdHkgKil2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgInVzZXJNYXAiLCAmdXNlcl9tYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJ4dHJ1Y3RzIiwgJnh0cnVjdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworCisgICAgICAgICAgICBwcmludGYgKCJ7Iik7CisgICAgICAgICAgICBnX2hhc2hfdGFibGVfaXRlcl9pbml0ICgmdXNlcl9tYXBfaXRlciwgdXNlcl9tYXApOworICAgICAgICAgICAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZ1c2VyX21hcF9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlKSkgeworICAgICAgICAgICAgICBwcmludGYgKCIlZCA9PiAlIiBQUklkNjQgIiwgIiwKKyAgICAgICAgICAgICAgICAgICAgICAoVFRlc3ROdW1iZXJ6KWtleSwKKyAgICAgICAgICAgICAgICAgICAgICAqKFRUZXN0VXNlcklkICopdmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcHJpbnRmICgifSwgIik7CisgICAgICAgICAgICBnX2hhc2hfdGFibGVfdW5yZWYgKHVzZXJfbWFwKTsKKworICAgICAgICAgICAgcHJpbnRmKCJ7Iik7CisgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgKGdpbnQzMil4dHJ1Y3RzLT5sZW47ICsraSkgeworICAgICAgICAgICAgICB4dHJ1Y3RfaW4gPSBnX3B0cl9hcnJheV9pbmRleCAoeHRydWN0cywgaSk7CisgICAgICAgICAgICAgIGdfb2JqZWN0X2dldCAoeHRydWN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCAmc3RyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICAmYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaTMyX3RoaW5nIiwgICAgJmkzMl90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaTY0X3RoaW5nIiwgICAgJmk2NF90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgICAgICAgICAgICBwcmludGYgKCJ7XCIlc1wiLCAlZCwgJWQsICUiIFBSSWQ2NCAifSwgIiwKKyAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHByaW50ZiAoIn0iKTsKKyAgICAgICAgICAgIGdfcHRyX2FycmF5X3VucmVmICh4dHJ1Y3RzKTsKKworICAgICAgICAgICAgcHJpbnRmICgifSwgIik7CisgICAgICAgICAgfQorICAgICAgICAgIHByaW50ZigifSwgIik7CisgICAgICAgIH0KKyAgICAgICAgcHJpbnRmKCJ9XG4iKTsKKworICAgICAgICBpZiAoZ19oYXNoX3RhYmxlX3NpemUgKG1hcF9pbikgIT0gMikKKyAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgIGVsc2UgeworICAgICAgICAgIFRUZXN0TnVtYmVyeiBudW1iZXJ6X2tleV92YWx1ZXNbXSA9IHsKKyAgICAgICAgICAgIFRfVEVTVF9OVU1CRVJaX1RXTywgVF9URVNUX05VTUJFUlpfVEhSRUUKKyAgICAgICAgICB9OworICAgICAgICAgIGdpbnQgdXNlcl9tYXBfdmFsdWVzW10gPSB7IDUsIDggfTsKKyAgICAgICAgICBUVGVzdFVzZXJJZCB1c2VyX2lkX2tleTsKKworICAgICAgICAgIHVzZXJfaWRfa2V5ID0gMTsKKyAgICAgICAgICBpbm5lcl9tYXBfaW4gPSBnX2hhc2hfdGFibGVfbG9va3VwIChtYXBfaW4sICZ1c2VyX2lkX2tleSk7CisgICAgICAgICAgaWYgKGlubmVyX21hcF9pbiA9PSBOVUxMIHx8CisgICAgICAgICAgICAgIGdfaGFzaF90YWJsZV9zaXplIChpbm5lcl9tYXBfaW4pICE9IDIpCisgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBUVGVzdE51bWJlcnogbnVtYmVyel9rZXk7CisKKyAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCAyOyArK2kpIHsKKyAgICAgICAgICAgICAgbnVtYmVyel9rZXkgPSBudW1iZXJ6X2tleV92YWx1ZXNbaV07CisgICAgICAgICAgICAgIGluc2FuaXR5X2luID0KKyAgICAgICAgICAgICAgICBnX2hhc2hfdGFibGVfbG9va3VwIChpbm5lcl9tYXBfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdjb25zdHBvaW50ZXIpbnVtYmVyel9rZXkpOworICAgICAgICAgICAgICBpZiAoaW5zYW5pdHlfaW4gPT0gTlVMTCkKKyAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIGdfb2JqZWN0X2dldCAoaW5zYW5pdHlfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidXNlck1hcCIsICZ1c2VyX21hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ4dHJ1Y3RzIiwgJnh0cnVjdHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgICAgICAgICAgICAgIGlmICh1c2VyX21hcCA9PSBOVUxMKQorICAgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgICAgaWYgKGdfaGFzaF90YWJsZV9zaXplICh1c2VyX21hcCkgIT0gMikKKyAgICAgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCAyOyArK2opIHsKKyAgICAgICAgICAgICAgICAgICAgICBudW1iZXJ6X2tleSA9IChUVGVzdE51bWJlcnopdXNlcl9tYXBfdmFsdWVzW2pdOworCisgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgPQorICAgICAgICAgICAgICAgICAgICAgICAgZ19oYXNoX3RhYmxlX2xvb2t1cCAodXNlcl9tYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2NvbnN0cG9pbnRlciludW1iZXJ6X2tleSk7CisgICAgICAgICAgICAgICAgICAgICAgaWYgKHZhbHVlID09IE5VTEwgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKihUVGVzdFVzZXJJZCAqKXZhbHVlICE9IChUVGVzdFVzZXJJZCl1c2VyX21hcF92YWx1ZXNbal0pCisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgZ19oYXNoX3RhYmxlX3VucmVmICh1c2VyX21hcCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKHh0cnVjdHMgPT0gTlVMTCkKKyAgICAgICAgICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgIGlmICh4dHJ1Y3RzLT5sZW4gIT0gMikKKyAgICAgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHh0cnVjdF9pbiA9IGdfcHRyX2FycmF5X2luZGV4ICh4dHJ1Y3RzLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgZ19vYmplY3RfZ2V0ICh4dHJ1Y3RfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN0cmluZ190aGluZyIsICZzdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJ5dGVfdGhpbmciLCAgICZieXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICAmaTMyX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpNjRfdGhpbmciLCAgICAmaTY0X3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgICAgICAgICAgICAgICAgICBpZiAoKHN0cmluZyA9PSBOVUxMIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgc3RybmNtcCAoc3RyaW5nLCAiR29vZGJ5ZTQiLCA5KSAhPSAwKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZyAhPSA0IHx8CisgICAgICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmcgIT0gNCB8fAorICAgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nICE9IDQpCisgICAgICAgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworCisgICAgICAgICAgICAgICAgICAgIGlmIChzdHJpbmcgIT0gTlVMTCkKKyAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUgKHN0cmluZyk7CisKKyAgICAgICAgICAgICAgICAgICAgeHRydWN0X2luID0gZ19wdHJfYXJyYXlfaW5kZXggKHh0cnVjdHMsIDEpOworICAgICAgICAgICAgICAgICAgICBnX29iamVjdF9nZXQgKHh0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgJnN0cmluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgJmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgICZpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgICZpNjRfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICAgICAgICAgICAgICAgIGlmICgoc3RyaW5nID09IE5VTEwgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICBzdHJuY21wIChzdHJpbmcsICJIZWxsbzIiLCA3KSAhPSAwKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZyAhPSAyIHx8CisgICAgICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmcgIT0gMiB8fAorICAgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nICE9IDIpCisgICAgICAgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworCisgICAgICAgICAgICAgICAgICAgIGlmIChzdHJpbmcgIT0gTlVMTCkKKyAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUgKHN0cmluZyk7CisgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgIGdfcHRyX2FycmF5X3VucmVmICh4dHJ1Y3RzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisKKyAgICAgICAgICB1c2VyX2lkX2tleSA9IDI7CisgICAgICAgICAgaW5uZXJfbWFwX2luID0gZ19oYXNoX3RhYmxlX2xvb2t1cCAobWFwX2luLCAmdXNlcl9pZF9rZXkpOworICAgICAgICAgIGlmIChpbm5lcl9tYXBfaW4gPT0gTlVMTCB8fAorICAgICAgICAgICAgICBnX2hhc2hfdGFibGVfc2l6ZSAoaW5uZXJfbWFwX2luKSAhPSAxKQorICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgaW5zYW5pdHlfaW4gPQorICAgICAgICAgICAgICBnX2hhc2hfdGFibGVfbG9va3VwIChpbm5lcl9tYXBfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChnY29uc3Rwb2ludGVyKVRfVEVTVF9OVU1CRVJaX1NJWCk7CisgICAgICAgICAgICBpZiAoaW5zYW5pdHlfaW4gPT0gTlVMTCkKKyAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgIGdfb2JqZWN0X2dldCAoaW5zYW5pdHlfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInVzZXJNYXAiLCAmdXNlcl9tYXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInh0cnVjdHMiLCAmeHRydWN0cywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgICAgICAgICAgICBpZiAodXNlcl9tYXAgPT0gTlVMTCkKKyAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisgICAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChnX2hhc2hfdGFibGVfc2l6ZSAodXNlcl9tYXApICE9IDApCisgICAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisKKyAgICAgICAgICAgICAgICBnX2hhc2hfdGFibGVfdW5yZWYgKHVzZXJfbWFwKTsKKyAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgIGlmICh4dHJ1Y3RzID09IE5VTEwpCisgICAgICAgICAgICAgICAgZmFpbF9jb3VudCsrOworICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoeHRydWN0cy0+bGVuICE9IDApCisgICAgICAgICAgICAgICAgICBmYWlsX2NvdW50Kys7CisKKyAgICAgICAgICAgICAgICBnX3B0cl9hcnJheV91bnJlZiAoeHRydWN0cyk7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgZ19oYXNoX3RhYmxlX3VucmVmIChtYXBfaW4pOworICAgICAgZ19jbGVhcl9vYmplY3QgKCZpbnNhbml0eV9vdXQpOworCisgICAgICAvKiB0ZXN0IGV4Y2VwdGlvbiAqLworICAgICAgcHJpbnRmICgidGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKFwiWGNlcHRpb25cIikgPT4iKTsKKyAgICAgIGlmICghdF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfZXhjZXB0aW9uICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiWGNlcHRpb24iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpICYmCisgICAgICAgICAgeGNlcHRpb24gIT0gTlVMTCkgeworICAgICAgICBnX29iamVjdF9nZXQgKHhjZXB0aW9uLAorICAgICAgICAgICAgICAgICAgICAgICJlcnJvckNvZGUiLCAmaW50MzIsCisgICAgICAgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCAgICZzdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICAgIHByaW50ZiAoIiAgeyV1LCBcIiVzXCJ9XG4iLCBpbnQzMiwgc3RyaW5nKTsKKyAgICAgICAgZ19mcmVlIChzdHJpbmcpOworCisgICAgICAgIGdfY2xlYXJfb2JqZWN0ICgmeGNlcHRpb24pOworCisgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICBlcnJvciA9IE5VTEw7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiICB2b2lkXG5GQUlMVVJFXG4iKTsKKyAgICAgICAgZmFpbF9jb3VudCsrOworCisgICAgICAgIGlmICh4Y2VwdGlvbiAhPSBOVUxMKSB7CisgICAgICAgICAgZ19vYmplY3RfdW5yZWYgKHhjZXB0aW9uKTsKKyAgICAgICAgICB4Y2VwdGlvbiA9IE5VTEw7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZXJyb3IgIT0gTlVMTCkgeworICAgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgICAgfQorICAgICAgfQorCisgICAgICBwcmludGYgKCJ0ZXN0Q2xpZW50LnRlc3RFeGNlcHRpb24oXCJURXhjZXB0aW9uXCIpID0+Iik7CisgICAgICBpZiAoIXRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2V4Y2VwdGlvbiAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlRFeGNlcHRpb24iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpICYmCisgICAgICAgICAgeGNlcHRpb24gPT0gTlVMTCAmJgorICAgICAgICAgIGVycm9yICE9IE5VTEwpIHsKKyAgICAgICAgcHJpbnRmICgiICBDYXVnaHQgVEV4Y2VwdGlvblxuIik7CisKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIgIHZvaWRcbkZBSUxVUkVcbiIpOworICAgICAgICBmYWlsX2NvdW50Kys7CisKKyAgICAgICAgZ19jbGVhcl9vYmplY3QgKCZ4Y2VwdGlvbik7CisKKyAgICAgICAgaWYgKGVycm9yICE9IE5VTEwpIHsKKyAgICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgICBlcnJvciA9IE5VTEw7CisgICAgICAgIH0KKyAgICAgIH0KKworICAgICAgcHJpbnRmICgidGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKFwic3VjY2Vzc1wiKSA9PiIpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2V4Y2VwdGlvbiAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3VjY2VzcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKQorICAgICAgICBwcmludGYgKCIgIHZvaWRcbiIpOworICAgICAgZWxzZSB7CisgICAgICAgIHByaW50ZiAoIiAgdm9pZFxuRkFJTFVSRVxuIik7CisgICAgICAgIGZhaWxfY291bnQrKzsKKworICAgICAgICBnX2NsZWFyX29iamVjdCAoJnhjZXB0aW9uKTsKKworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworICAgICAgfQorCisgICAgICBnX2Fzc2VydCAoZXJyb3IgPT0gTlVMTCk7CisKKyAgICAgIC8qIHRlc3QgbXVsdGkgZXhjZXB0aW9uICovCisgICAgICBwcmludGYgKCJ0ZXN0Q2xpZW50LnRlc3RNdWx0aUV4Y2VwdGlvbihcIlhjZXB0aW9uXCIsIFwidGVzdCAxXCIpID0+Iik7CisgICAgICB4dHJ1Y3RfaW4gPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1hUUlVDVCwgTlVMTCk7CisgICAgICBpZiAoIXRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X211bHRpX2V4Y2VwdGlvbiAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnh0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiWGNlcHRpb24iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0ZXN0IDEiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeGNlcHRpb24yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikgJiYKKyAgICAgICAgICB4Y2VwdGlvbiAhPSBOVUxMICYmCisgICAgICAgICAgeGNlcHRpb24yID09IE5VTEwpIHsKKyAgICAgICAgZ19vYmplY3RfZ2V0ICh4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAiZXJyb3JDb2RlIiwgJmludDMyLAorICAgICAgICAgICAgICAgICAgICAgICJtZXNzYWdlIiwgICAmc3RyaW5nLAorICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgICAgICBwcmludGYgKCIgIHsldSwgXCIlc1wifVxuIiwgaW50MzIsIHN0cmluZyk7CisgICAgICAgIGdfZnJlZSAoc3RyaW5nKTsKKworICAgICAgICBnX29iamVjdF91bnJlZiAoeGNlcHRpb24pOworICAgICAgICB4Y2VwdGlvbiA9IE5VTEw7CisKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIgIHJlc3VsdFxuRkFJTFVSRVxuIik7CisgICAgICAgIGZhaWxfY291bnQrKzsKKworICAgICAgICBnX2NsZWFyX29iamVjdCAoJnhjZXB0aW9uKTsKKyAgICAgICAgZ19jbGVhcl9vYmplY3QgKCZ4Y2VwdGlvbjIpOworCisgICAgICAgIGlmIChlcnJvciAhPSBOVUxMKSB7CisgICAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgICAgZXJyb3IgPSBOVUxMOworICAgICAgICB9CisgICAgICB9CisgICAgICBnX29iamVjdF91bnJlZiAoeHRydWN0X2luKTsKKworICAgICAgcHJpbnRmICgidGVzdENsaWVudC50ZXN0TXVsdGlFeGNlcHRpb24oXCJYY2VwdGlvbjJcIiwgXCJ0ZXN0IDJcIikgPT4iKTsKKyAgICAgIHh0cnVjdF9pbiA9IGdfb2JqZWN0X25ldyAoVF9URVNUX1RZUEVfWFRSVUNULCBOVUxMKTsKKyAgICAgIGlmICghdF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfbXVsdGlfZXhjZXB0aW9uICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeHRydWN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJYY2VwdGlvbjIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0ZXN0IDIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ4Y2VwdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeGNlcHRpb24yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikgJiYKKyAgICAgICAgICB4Y2VwdGlvbiA9PSBOVUxMICYmCisgICAgICAgICAgeGNlcHRpb24yICE9IE5VTEwpIHsKKyAgICAgICAgZ19vYmplY3RfZ2V0ICh4Y2VwdGlvbjIsCisgICAgICAgICAgICAgICAgICAgICAgImVycm9yQ29kZSIsICAgICZpbnQzMiwKKyAgICAgICAgICAgICAgICAgICAgICAic3RydWN0X3RoaW5nIiwgJmlubmVyX3h0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgICAgICAgZ19vYmplY3RfZ2V0IChpbm5lcl94dHJ1Y3RfaW4sCisgICAgICAgICAgICAgICAgICAgICAgInN0cmluZ190aGluZyIsICZzdHJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgICAgIHByaW50ZiAoIiAgeyV1LCB7XCIlc1wifX1cbiIsIGludDMyLCBzdHJpbmcpOworICAgICAgICBnX2ZyZWUgKHN0cmluZyk7CisKKyAgICAgICAgZ19jbGVhcl9vYmplY3QgKCZpbm5lcl94dHJ1Y3RfaW4pOworICAgICAgICBnX2NsZWFyX29iamVjdCAoJnhjZXB0aW9uMik7CisKKyAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIgIHJlc3VsdFxuRkFJTFVSRVxuIik7CisgICAgICAgIGZhaWxfY291bnQrKzsKKworICAgICAgICBnX2NsZWFyX29iamVjdCAoJnhjZXB0aW9uKTsKKyAgICAgICAgZ19jbGVhcl9vYmplY3QgKCZ4Y2VwdGlvbjIpOworCisgICAgICAgIGlmIChlcnJvciAhPSBOVUxMKSB7CisgICAgICAgICAgZ19lcnJvcl9mcmVlIChlcnJvcik7CisgICAgICAgICAgZXJyb3IgPSBOVUxMOworICAgICAgICB9CisgICAgICB9CisgICAgICBnX2NsZWFyX29iamVjdCAoJnh0cnVjdF9pbik7CisKKyAgICAgIHByaW50ZiAoInRlc3RDbGllbnQudGVzdE11bHRpRXhjZXB0aW9uKFwic3VjY2Vzc1wiLCBcInRlc3QgM1wiKSA9PiIpOworICAgICAgeHRydWN0X2luID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YVFJVQ1QsIE5VTEwpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X211bHRpX2V4Y2VwdGlvbiAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeHRydWN0X2luLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN1Y2Nlc3MiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRlc3QgMyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeGNlcHRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmeGNlcHRpb24yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmVycm9yKSAmJgorICAgICAgICAgIHhjZXB0aW9uID09IE5VTEwgJiYKKyAgICAgICAgICB4Y2VwdGlvbjIgPT0gTlVMTCkgeworICAgICAgICBnX29iamVjdF9nZXQgKHh0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgJnN0cmluZywKKyAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgICAgICAgcHJpbnRmICgiICB7e1wiJXNcIn19XG4iLCBzdHJpbmcpOworICAgICAgICBnX2ZyZWUgKHN0cmluZyk7CisgICAgICB9CisgICAgICBlbHNlIHsKKyAgICAgICAgcHJpbnRmICgiICByZXN1bHRcbkZBSUxVUkVcbiIpOworICAgICAgICBmYWlsX2NvdW50Kys7CisKKyAgICAgICAgZ19jbGVhcl9vYmplY3QgKCZ4Y2VwdGlvbik7CisgICAgICAgIGdfY2xlYXJfb2JqZWN0ICgmeGNlcHRpb24yKTsKKworICAgICAgICBpZiAoZXJyb3IgIT0gTlVMTCkgeworICAgICAgICAgIGdfZXJyb3JfZnJlZSAoZXJyb3IpOworICAgICAgICAgIGVycm9yID0gTlVMTDsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgZ19jbGVhcl9vYmplY3QgKCZ4dHJ1Y3RfaW4pOworCisgICAgICAvKiB0ZXN0IG9uZXdheSB2b2lkICovCisgICAgICBwcmludGYgKCJ0ZXN0Q2xpZW50LnRlc3RPbmV3YXkoMSkgPT4iKTsKKyAgICAgIGdldHRpbWVvZmRheSAoJm9uZXdheV9zdGFydCwgTlVMTCk7CisgICAgICBvbmV3YXlfcmVzdWx0ID0gdF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3Rfb25ld2F5ICh0ZXN0X2NsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpOworICAgICAgZ2V0dGltZW9mZGF5ICgmb25ld2F5X2VuZCwgTlVMTCk7CisgICAgICB0aW1lcnN1YiAoJm9uZXdheV9lbmQsICZvbmV3YXlfc3RhcnQsICZvbmV3YXlfZWxhcHNlZCk7CisgICAgICBvbmV3YXlfZWxhcHNlZF91c2VjID0KKyAgICAgICAgb25ld2F5X2VsYXBzZWQudHZfc2VjICogMTAwMCAqIDEwMDAgKyBvbmV3YXlfZWxhcHNlZC50dl91c2VjOworCisgICAgICBpZiAob25ld2F5X3Jlc3VsdCkgeworICAgICAgICBpZiAob25ld2F5X2VsYXBzZWRfdXNlYyA+IDIwMCAqIDEwMDApIHsKKyAgICAgICAgICBwcmludGYgKCIgIEZBSUxVUkUgLSB0b29rICUuMmYgbXNcbiIsCisgICAgICAgICAgICAgICAgICAoZG91YmxlKW9uZXdheV9lbGFwc2VkX3VzZWMgLyAxMDAwLjApOworICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgICAgcHJpbnRmICgiICBzdWNjZXNzIC0gdG9vayAlLjJmIG1zXG4iLAorICAgICAgICAgICAgICAgICAgKGRvdWJsZSlvbmV3YXlfZWxhcHNlZF91c2VjIC8gMTAwMC4wKTsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiByZWRvIGEgc2ltcGxlIHRlc3QgYWZ0ZXIgdGhlIG9uZXdheSB0byBtYWtlIHN1cmUgd2UgYXJlbid0ICJvZmYgYnkKKyAgICAgICAqIG9uZSIgLS0gaWYgdGhlIHNlcnZlciB0cmVhdGVkIG9uZXdheSB2b2lkIGxpa2Ugbm9ybWFsIHZvaWQsIHRoaXMgbmV4dAorICAgICAgICogdGVzdCB3aWxsIGZhaWwgc2luY2UgaXQgd2lsbCBnZXQgdGhlIHZvaWQgY29uZmlybWF0aW9uIHJhdGhlciB0aGFuCisgICAgICAgKiB0aGUgY29ycmVjdCByZXN1bHQuIEluIHRoaXMgY2lyY3Vtc3RhbmNlLCB0aGUgY2xpZW50IHdpbGwgcmVjZWl2ZSB0aGUKKyAgICAgICAqIGVycm9yOgorICAgICAgICoKKyAgICAgICAqICAgYXBwbGljYXRpb24gZXJyb3I6IFdyb25nIG1ldGhvZCBuYW1lCisgICAgICAgKi8KKyAgICAgIC8qKgorICAgICAgICogSTMyIFRFU1QKKyAgICAgICAqLworICAgICAgcHJpbnRmICgicmUtdGVzdCB0ZXN0STMyKC0xKSIpOworICAgICAgaWYgKHRfdGVzdF90aHJpZnRfdGVzdF9pZl90ZXN0X2kzMiAodGVzdF9jbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW50MzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikpIHsKKyAgICAgICAgcHJpbnRmICgiID0gJWRcbiIsIGludDMyKTsKKyAgICAgICAgaWYgKGludDMyICE9IC0xKQorICAgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKyAgICAgIGVsc2UgeworICAgICAgICBwcmludGYgKCIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgICAgICBnX2Vycm9yX2ZyZWUgKGVycm9yKTsKKyAgICAgICAgZXJyb3IgPSBOVUxMOworCisgICAgICAgIGZhaWxfY291bnQrKzsKKyAgICAgIH0KKworICAgICAgZ2V0dGltZW9mZGF5ICgmdGltZV9zdG9wLCBOVUxMKTsKKyAgICAgIHRpbWVyc3ViICgmdGltZV9zdG9wLCAmdGltZV9zdGFydCwgJnRpbWVfZWxhcHNlZCk7C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J0X2ZhY3Rvcnk7CisgIFRocmlmdFByb3RvY29sRmFjdG9yeSAgKnByb3RvY29sX2ZhY3Rvcnk7CisKKyAgc3RydWN0IHNpZ2FjdGlvbiBzaWdpbnRfYWN0aW9uOworCisgIEdPcHRpb25Db250ZXh0ICpvcHRpb25fY29udGV4dDsKKyAgZ2Jvb2xlYW4gICAgICAgIG9wdGlvbnNfdmFsaWQgPSBUUlVFOworCisgIEdFcnJvciAqZXJyb3IgPSBOVUxMOworCisjaWYgKCFHTElCX0NIRUNLX1ZFUlNJT04gKDIsIDM2LCAwKSkKKyAgZ190eXBlX2luaXQgKCk7CisjZW5kaWYKKworICAvKiBDb25maWd1cmUgYW5kIHBhcnNlIG91ciBjb21tYW5kLWxpbmUgb3B0aW9ucyAqLworICBvcHRpb25fY29udGV4dCA9IGdfb3B0aW9uX2NvbnRleHRfbmV3IChOVUxMKTsKKyAgZ19vcHRpb25fY29udGV4dF9hZGRfbWFpbl9lbnRyaWVzIChvcHRpb25fY29udGV4dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25fZW50cmllcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgaWYgKGdfb3B0aW9uX2NvbnRleHRfcGFyc2UgKG9wdGlvbl9jb250ZXh0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmFyZ2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmYXJndiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZlcnJvcikgPT0gRkFMU0UpIHsKKyAgICBmcHJpbnRmIChzdGRlcnIsICIlc1xuIiwgZXJyb3ItPm1lc3NhZ2UpOworICAgIHJldHVybiAyNTU7CisgIH0KKyAgZ19vcHRpb25fY29udGV4dF9mcmVlIChvcHRpb25fY29udGV4dCk7CisKKyAgLyogVmFsaWRhdGUgdGhlIHBhcnNlZCBvcHRpb25zICovCisgIGlmIChzZXJ2ZXJfdHlwZV9vcHRpb24gIT0gTlVMTCAmJgorICAgICAgc3RybmNtcCAoc2VydmVyX3R5cGVfb3B0aW9uLCAic2ltcGxlIiwgNykgIT0gMCkgeworICAgIGZwcmludGYgKHN0ZGVyciwgIlVua25vd24gc2VydmVyIHR5cGUgJXNcbiIsIHByb3RvY29sX29wdGlvbik7CisgICAgb3B0aW9uc192YWxpZCA9IEZBTFNFOworICB9CisKKyAgaWYgKHByb3RvY29sX29wdGlvbiAhPSBOVUxMKSB7CisgICAgaWYgKHN0cm5jbXAgKHByb3RvY29sX29wdGlvbiwgImNvbXBhY3QiLCA4KSA9PSAwKSB7CisgICAgICBwcm90b2NvbF9mYWN0b3J5X3R5cGUgPSBUSFJJRlRfVFlQRV9DT01QQUNUX1BST1RPQ09MX0ZBQ1RPUlk7CisgICAgICBwcm90b2NvbF9uYW1lID0gImNvbXBhY3QiOworICAgIH0KKyAgICBlbHNlIGlmIChzdHJuY21wIChwcm90b2NvbF9vcHRpb24sICJtdWx0aSIsIDYpID09IDApIHsKKwlwcm90b2NvbF9uYW1lID0gImJpbmFyeTptdWx0aSI7CisgICAgfQorICAgIGVsc2UgaWYgKHN0cm5jbXAgKHByb3RvY29sX29wdGlvbiwgIm11bHRpYyIsIDcpID09IDApIHsKKwlwcm90b2NvbF9mYWN0b3J5X3R5cGUgPSBUSFJJRlRfVFlQRV9DT01QQUNUX1BST1RPQ09MX0ZBQ1RPUlk7CisJcHJvdG9jb2xfbmFtZSA9ICJjb21wYWN0Om11bHRpYyI7CisgICAgfQorICAgIGVsc2UgaWYgKHN0cm5jbXAgKHByb3RvY29sX29wdGlvbiwgImJpbmFyeSIsIDcpICE9IDApIHsKKyAgICAgIGZwcmludGYgKHN0ZGVyciwgIlVua25vd24gcHJvdG9jb2wgdHlwZSAlc1xuIiwgcHJvdG9jb2xfb3B0aW9uKTsKKyAgICAgIG9wdGlvbnNfdmFsaWQgPSBGQUxTRTsKKyAgICB9CisgIH0KKworICBpZiAodHJhbnNwb3J0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xMID8gZXJyb3ItPm1lc3NhZ2UgOiAiKG51bGwpIik7CisJICAgIGdfY2xlYXJfZXJyb3IgKCZlcnJvcik7CisgICAgICB9CisgICAgICAvKiBXZSByZWdpc3RlciBhIHNlY29uZCB0ZXN0IHByb2Nlc3NvciB3aXRoIE11bHRpcGxleGVkIG5hbWUgU2Vjb25kU2VydmljZQorICAgICAgICogd2UgYXJlIHJlc3BvbnNpYmxlIG9mIGZyZWVpbmcgdGhlIHByb2Nlc3NvciB3aGVuIGl0J3Mgbm90IHVzZWQgYW55bW9yZSAqLworICAgICAgaWYoIXRocmlmdF9tdWx0aXBsZXhlZF9wcm9jZXNzb3JfcmVnaXN0ZXJfcHJvY2Vzc29yKHByb2Nlc3NvciwKKwkJCQkJCSAgICAgICJTZWNvbmRTZXJ2aWNlIiwgcHJvY2Vzc29yX3NlY29uZF9zZXJ2aWNlLAorCQkJCQkJICAgICAgJmVycm9yKSl7CisJICAgIGdfbWVzc2FnZSAoInRocmlmdF9zZXJ2ZXJfc2VydmU6ICVzIiwKKwkgICAgICAgICAgICAgICBlcnJvciAhPSBOVUxMID8gZXJyb3ItPm1lc3NhZ2UgOiAiKG51bGwpIik7CisJICAgIGdfY2xlYXJfZXJyb3IgKCZlcnJvcik7CisgICAgICB9CisKKyAgfWVsc2V7CisgICAgICBwcm9jZXNzb3IgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1RIUklGVF9URVNUX1BST0NFU1NPUiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaGFuZGxlciIsIGhhbmRsZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIH0KKyAgc2VydmVyX3RyYW5zcG9ydCAgPSBnX29iamVjdF9uZXcgKFRIUklGVF9UWVBFX1NFUlZFUl9TT0NLRVQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAicG9ydCIsIHBvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgdHJhbnNwb3J0X2ZhY3RvcnkgPSBnX29iamVjdF9uZXcgKHRyYW5zcG9ydF9mYWN0b3J5X3R5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICBpZiAoc3Ryc3RyIChwcm90b2NvbF9uYW1lLCAiY29tcGFjdCIpICE9IE5VTEwpIHsKKyAgICBwcm90b2NvbF9mYWN0b3J5ICA9IGdfb2JqZWN0X25ldyAocHJvdG9jb2xfZmFjdG9yeV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3RyaW5nX2xpbWl0Iiwgc3RyaW5nX2xpbWl0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiY29udGFpbmVyX2xpbWl0IiwgY29udGFpbmVyX2xpbWl0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgfSBlbHNlIHsKKyAgICBwcm90b2NvbF9mYWN0b3J5ICA9IGdfb2JqZWN0X25ldyAocHJvdG9jb2xfZmFjdG9yeV90eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgfQorCisgIHNlcnZlciA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfU0lNUExFX1NFUlZFUiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAicHJvY2Vzc29yIiwgICAgICAgICAgICAgICAgcHJvY2Vzc29yLAorICAgICAgICAgICAgICAgICAgICAgICAgICJzZXJ2ZXJfdHJhbnNwb3J0IiwgICAgICAgICBzZXJ2ZXJfdHJhbnNwb3J0LAorICAgICAgICAgICAgICAgICAgICAgICAgICJpbnB1dF90cmFuc3BvcnRfZmFjdG9yeSIsICB0cmFuc3BvcnRfZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAib3V0cHV0X3RyYW5zcG9ydF9mYW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QorICogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucworICogdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBfU0VDT05EX1NFUlZJQ0VfSEFORExFUl9ICisjZGVmaW5lIF9TRUNPTkRfU0VSVklDRV9IQU5ETEVSX0gKKworI2luY2x1ZGUgPGdsaWItb2JqZWN0Lmg+CisjaW5jbHVkZSA8c3RkaW8uaD4KKworI2luY2x1ZGUgIi4uL2dlbi1jX2dsaWIvdF90ZXN0X3NlY29uZF9zZXJ2aWNlLmgiCisKK0dfQkVHSU5fREVDTFMKKworLyogQSBoYW5kbGVyIHRoYXQgaW1wbGVtZW50cyB0aGUgVFRlc3RTZWNvbmRTZXJ2aWNlSWYgaW50ZXJmYWNlICovCisKKyNkZWZpbmUgVFlQRV9TRUNPTkRfU0VSVklDRV9IQU5ETEVSIChzZWNvbmRfc2VydmljZV9oYW5kbGVyX2dldF90eXBlICgpKQorCisjZGVmaW5lIFNFQ09ORF9TRVJWSUNFX0hBTkRMRVIob2JqKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0lOU1RBTkNFX0NBU1QgKChvYmopLCAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1NFQ09ORF9TRVJWSUNFX0hBTkRMRVIsICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2Vjb25kU2VydmljZUhhbmRsZXIpKQorI2RlZmluZSBJU19TRUNPTkRfU0VSVklDRV9IQU5ETEVSKG9iaikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19JTlNUQU5DRV9UWVBFICgob2JqKSwgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9TRUNPTkRfU0VSVklDRV9IQU5ETEVSKSkKKyNkZWZpbmUgU0VDT05EX1NFUlZJQ0VfSEFORExFUl9DTEFTUyhjKSAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0NMQVNTX0NBU1QgKChjKSwgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9TRUNPTkRfU0VSVklDRV9IQU5ETEVSLCAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZWNvbmRTZXJ2aWNlSGFuZGxlckNsYXNzKSkKKyNkZWZpbmUgSVNfU0VDT05EX1NFUlZJQ0VfSEFORExFUl9DTEFTUyhjKSAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0NMQVNTX1RZUEUgKChjKSwgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9TRUNPTkRfU0VSVklDRV9IQU5ETEVSKSkKKyNkZWZpbmUgU0VDT05EX1NFUlZJQ0VfSEFORExFUl9HRVRfQ0xBU1Mob2JqKSAgICAgICAgICAgICAgXAorICAoR19UWVBFX0lOU1RBTkNFX0dFVF9DTEFTUyAoKG9iaiksICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1NFQ09ORF9TRVJWSUNFX0hBTkRMRVIsIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlY29uZFNlcnZpY2VIYW5kbGVyQ2xhc3MpKQorCit0eXBlZGVmIHN0cnVjdCBfU2Vjb25kU2VydmljZUhhbmRsZXIgU2Vjb25kU2VydmljZUhhbmRsZXI7Cit0eXBlZGVmIHN0cnVjdCBfU2Vjb25kU2VydmljZUhhbmRsZXJDbGFzcyBTZWNvbmRTZXJ2aWNlSGFuZGxlckNsYXNzOworCitzdHJ1Y3QgX1NlY29uZFNlcnZpY2VIYW5kbGVyIHsK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N0ZC5oPgorCisjaW5jbHVkZSA8dGhyaWZ0L2NfZ2xpYi90aHJpZnQuaD4KKyNpbmNsdWRlIDx0aHJpZnQvY19nbGliL3RocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb24uaD4KKworI2luY2x1ZGUgInRocmlmdF90ZXN0X2hhbmRsZXIuaCIKKworLyogQSBoYW5kbGVyIHRoYXQgaW1wbGVtZW50cyB0aGUgVFRlc3RUaHJpZnRUZXN0SWYgaW50ZXJmYWNlICovCisKK0dfREVGSU5FX1RZUEUgKFRocmlmdFRlc3RIYW5kbGVyLAorICAgICAgICAgICAgICAgdGhyaWZ0X3Rlc3RfaGFuZGxlciwKKyAgICAgICAgICAgICAgIFRfVEVTVF9UWVBFX1RIUklGVF9URVNUX0hBTkRMRVIpOworCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X3ZvaWQgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0Vm9pZCgpXG4iKTsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zdHJpbmcgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnY2hhciAgICAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAgICAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0U3RyaW5nKFwiJXNcIilcbiIsIHRoaW5nKTsKKyAgKl9yZXR1cm4gPSBnX3N0cmR1cCAodGhpbmcpOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2Jvb2wgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2Jvb2xlYW4gICAgICAgICAgICpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdib29sZWFuICAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0Qm9vbCglcylcbiIsIHRoaW5nID8gInRydWUiIDogImZhbHNlIik7CisgICpfcmV0dXJuID0gdGhpbmc7CisKKyAgcmV0dXJuIFRSVUU7Cit9CisKK2dib29sZWFuCit0aHJpZnRfdGVzdF9oYW5kbGVyX3Rlc3RfYnl0ZSAoVFRlc3RUaHJpZnRUZXN0SWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaW50OCAgICAgICAgICAgICAgKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDggICAgICAgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RCeXRlKCVkKVxuIiwgKGdpbnQpdGhpbmcpOworICAqX3JldHVybiA9IHRoaW5nOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2kzMiAoVFRlc3RUaHJpZnRUZXN0SWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQzMiAgICAgICAgICAgICAqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RJMzIoJWQpXG4iLCB0aGluZyk7CisgICpfcmV0dXJuID0gdGhpbmc7CisKKyAgcmV0dXJuIFRSVUU7Cit9CisKK2dib29sZWFuCit0aHJpZnRfdGVzdF9oYW5kbGVyX3Rlc3RfaTY0IChUVGVzdFRocmlmdFRlc3RJZiAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDY0ICAgICAgICAgICAgICpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDY0ICAgICAgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChpZmFjZSk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgcHJpbnRmICgidGVzdEk2NCglIiBQUklkNjQgIilcbiIsIHRoaW5nKTsKKyAgKl9yZXR1cm4gPSB0aGluZzsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9kb3VibGUgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZG91YmxlICAgICAgICAgICAgKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnZG91YmxlICAgICAgIHRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0RG91YmxlKCVmKVxuIiwgdGhpbmcpOworICAqX3JldHVybiA9IHRoaW5nOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbiAKK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9iaW5hcnkgKFRUZXN0VGhyaWZ0VGVzdElmICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdCeXRlQXJyYXkgKiogX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEdCeXRlQXJyYXkgKiB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RCaW5hcnkoKVxuIik7ICAvLyBUT0RPOiBoZXggb3V0cHV0CisgIGdfYnl0ZV9hcnJheV9yZWYoKEdCeXRlQXJyYXkgKil0aGluZyk7CisgICpfcmV0dXJuID0gKEdCeXRlQXJyYXkgKil0aGluZzsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zdHJ1Y3QgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUVGVzdFh0cnVjdCAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdFh0cnVjdCAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgZ2NoYXIgKnN0cmluZ190aGluZyA9IE5VTEw7CisgIGdpbnQgICBieXRlX3RoaW5nOworICBnaW50ICAgaTMyX3RoaW5nOworICBnaW50NjQgaTY0X3RoaW5nOworCisgIFRIUklGVF9VTlVTRURfVkFSIChpZmFjZSk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgZ19vYmplY3RfZ2V0ICgoVFRlc3RYdHJ1Y3QgKil0aGluZywKKyAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgJnN0cmluZ190aGluZywKKyAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgJmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgICZpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgICZpNjRfdGhpbmcsCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgcHJpbnRmICgidGVzdFN0cnVjdCh7XCIlc1wiLCAlZCwgJWQsICUiIFBSSWQ2NCAifSlcbiIsCisgICAgICAgICAgc3RyaW5nX3RoaW5nLAorICAgICAgICAgIChnaW50KWJ5dGVfdGhpbmcsCisgICAgICAgICAgaTMyX3RoaW5nLAorICAgICAgICAgIGk2NF90aGluZyk7CisKKyAgZ19vYmplY3Rfc2V0ICgqX3JldHVybiwKKyAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgc3RyaW5nX3RoaW5nLAorICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICBieXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICBpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgIGk2NF90aGluZywKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBpZiAoc3RyaW5nX3RoaW5nICE9IE5VTEwpCisgICAgZ19mcmVlIChzdHJpbmdfdGhpbmcpOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X25lc3QgKFRUZXN0VGhyaWZ0VGVzdElmICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WHRydWN0MiAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RYdHJ1Y3QyICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICoqZXJyb3IpCit7CisgIGdjaGFyICppbm5lcl9zdHJpbmdfdGhpbmcgPSBOVUxMOworICBnaW50ICAgYnl0ZV90aGluZywgaW5uZXJfYnl0ZV90aGluZzsKKyAgZ2ludCAgIGkzMl90aGluZywgaW5uZXJfaTMyX3RoaW5nOworICBnaW50NjQgaW5uZXJfaTY0X3RoaW5nOworICBUVGVzdFh0cnVjdCAqc3RydWN0X3RoaW5nOworCisgIFRIUklGVF9VTlVTRURfVkFSIChpZmFjZSk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgZ19vYmplY3RfZ2V0ICgoVFRlc3RYdHJ1Y3QyICopdGhpbmcsCisgICAgICAgICAgICAgICAgImJ5dGVfdGhpbmciLCAgICZieXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICJzdHJ1Y3RfdGhpbmciLCAmc3RydWN0X3RoaW5nLAorICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICAmaTMyX3RoaW5nLAorICAgICAgICAgICAgICAgIE5VTEwpOworICBnX29iamVjdF9nZXQgKHN0cnVjdF90aGluZywKKyAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgJmlubmVyX3N0cmluZ190aGluZywKKyAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgJmlubmVyX2J5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgICZpbm5lcl9pMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgICZpbm5lcl9pNjRfdGhpbmcsCisgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgcHJpbnRmICgidGVzdE5lc3QoeyVkLCB7XCIlc1wiLCAlZCwgJWQsICUiIFBSSWQ2NCAifSwgJWR9KVxuIiwKKyAgICAgICAgICBieXRlX3RoaW5nLAorICAgICAgICAgIGlubmVyX3N0cmluZ190aGluZywKKyAgICAgICAgICBpbm5lcl9ieXRlX3RoaW5nLAorICAgICAgICAgIGlubmVyX2kzMl90aGluZywKKyAgICAgICAgICBpbm5lcl9pNjRfdGhpbmcsCisgICAgICAgICAgaTMyX3RoaW5nKTsKKworICBnX29iamVjdF9zZXQgKCpfcmV0dXJuLAorICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICBieXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICJzdHJ1Y3RfdGhpbmciLCBzdHJ1Y3RfdGhpbmcsCisgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgIGkzMl90aGluZywKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBpZiAoaW5uZXJfc3RyaW5nX3RoaW5nICE9IE5VTEwpCisgICAgZ19mcmVlIChpbm5lcl9zdHJpbmdfdGhpbmcpOworICBnX29iamVjdF91bnJlZiAoc3RydWN0X3RoaW5nKTsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9tYXAgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHSGFzaFRhYmxlICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgR0hhc2hUYWJsZUl0ZXIgaGFzaF90YWJsZV9pdGVyOworICBncG9pbnRlciBrZXk7CisgIGdwb2ludGVyIHZhbHVlOworICBnYm9vbGVhbiBmaXJzdCA9IFRSVUU7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0TWFwKHsiKTsKKyAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgKEdIYXNoVGFibGUgKil0aGluZyk7CisgIHdoaWxlIChnX2hhc2hfdGFibGVfaXRlcl9uZXh0ICgmaGFzaF90YWJsZV9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICBnaW50MzIgKm5ld19rZXk7CisgICAgZ2ludDMyICpuZXdfdmFsdWU7CisKKyAgICBpZiAoZmlyc3QpCisgICAgICBmaXJzdCA9IEZBTFNFOworICAgIGVsc2UKKyAgICAgIHByaW50ZiAoIiwgIik7CisKKyAgICBwcmludGYgKCIlZCA9PiAlZCIsICooZ2ludDMyICopa2V5LCAqKGdpbnQzMiAqKXZhbHVlKTsKKworICAgIG5ld19rZXkgPSBnX21hbGxvYyAoc2l6ZW9mICpuZXdfa2V5KTsKKyAgICAqbmV3X2tleSA9ICooZ2ludDMyICopa2V5OworICAgIG5ld192YWx1ZSA9IGdfbWFsbG9jIChzaXplb2YgKm5ld192YWx1ZSk7CisgICAgKm5ld192YWx1ZSA9ICooZ2ludDMyICopdmFsdWU7CisgICAgZ19oYXNoX3RhYmxlX2luc2VydCAoKl9yZXR1cm4sIG5ld19rZXksIG5ld192YWx1ZSk7CisgIH0KKyAgcHJpbnRmICgifSlcbiIpOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X3N0cmluZ19tYXAgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEdIYXNoVGFibGUgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgR0hhc2hUYWJsZUl0ZXIgaGFzaF90YWJsZV9pdGVyOworICBncG9pbnRlciBrZXk7CisgIGdwb2ludGVyIHZhbHVlOworICBnYm9vbGVhbiBmaXJzdCA9IFRSVUU7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0U3RyaW5nTWFwKHsiKTsKKyAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmhhc2hfdGFibGVfaXRlciwgKEdIYXNoVGFibGUgKil0aGluZyk7CisgIHdoaWxlIChnX2hhc2hfdGFibGVfaXRlcl9uZXh0ICgmaGFzaF90YWJsZV9pdGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZ2YWx1ZSkpIHsKKyAgICBnY2hhciAqbmV3X2tleTsKKyAgICBnY2hhciAqbmV3X3ZhbHVlOworCisgICAgaWYgKGZpcnN0KQorICAgICAgZmlyc3QgPSBGQUxTRTsKKyAgICBlbHNlCisgICAgICBwcmludGYgKCIsICIpOworCisgICAgcHJpbnRmICgiJXMgPT4gJXMiLCAoZ2NoYXIgKilrZXksIChnY2hhciAqKXZhbHVlKTsKKworICAgIG5ld19rZXkgPSBnX3N0cmR1cCAoKGdjaGFyICopa2V5KTsKKyAgICBuZXdfdmFsdWUgPSBnX3N0cmR1cCAoKGdjaGFyICopdmFsdWUpOworICAgIGdfaGFzaF90YWJsZV9pbnNlcnQgKCpfcmV0dXJuLCBuZXdfa2V5LCBuZXdfdmFsdWUpOworICB9CisgIHByaW50ZiAoIn0pXG4iKTsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zZXQgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHSGFzaFRhYmxlICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgR0hhc2hUYWJsZUl0ZXIgaGFzaF90YWJsZV9pdGVyOworICBncG9pbnRlciBrZXk7CisgIGdib29sZWFuIGZpcnN0ID0gVFJVRTsKKworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RTZXQoeyIpOworICBnX2hhc2hfdGFibGVfaXRlcl9pbml0ICgmaGFzaF90YWJsZV9pdGVyLCAoR0hhc2hUYWJsZSAqKXRoaW5nKTsKKyAgd2hpbGUgKGdfaGFzaF90YWJsZV9pdGVyX25leHQgKCZoYXNoX3RhYmxlX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAma2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCkpIHsKKyAgICBnaW50MzIgKm5ld19rZXk7CisKKyAgICBpZiAoZmlyc3QpCisgICAgICBmaXJzdCA9IEZBTFNFOworICAgIGVsc2UKKyAgICAgIHByaW50ZiAoIiwgIik7CisKKyAgICBwcmludGYgKCIlZCIsICooZ2ludDMyICopa2V5KTsKKworICAgIG5ld19rZXkgPSBnX21hbGxvYyAoc2l6ZW9mICpuZXdfa2V5KTsKKyAgICAqbmV3X2tleSA9ICooZ2ludDMyICopa2V5OworICAgIGdfaGFzaF90YWJsZV9pbnNlcnQgKCpfcmV0dXJuLCBuZXdfa2V5LCBOVUxMKTsKKyAgfQorICBwcmludGYgKCJ9KVxuIik7CisKKyAgcmV0dXJuIFRSVUU7Cit9CisKK2dib29sZWFuCit0aHJpZnRfdGVzdF9oYW5kbGVyX3Rlc3RfbGlzdCAoVFRlc3RUaHJpZnRUZXN0SWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHQXJyYXkgICAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR0FycmF5ICAgICAgICp0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAqKmVycm9yKQoreworICBndWludCBpOworICBnYm9vbGVhbiBmaXJzdCA9IFRSVUU7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0TGlzdCh7Iik7CisgIGZvciAoaSA9IDA7IGkgPCB0aGluZy0+bGVuOyBpICs9IDEpIHsKKyAgICBnaW50MzIgdmFsdWU7CisgICAgZ2ludDMyICpuZXdfdmFsdWU7CisKKyAgICBpZiAoZmlyc3QpCisgICAgICBmaXJzdCA9IEZBTFNFOworICAgIGVsc2UKKyAgICAgIHByaW50ZiAoIiwgIik7CisKKyAgICB2YWx1ZSA9IGdfYXJyYXlfaW5kZXggKHRoaW5nLCBnaW50MzIsIGkpOworICAgIHByaW50ZiAoIiVkIiwgdmFsdWUpOworCisgICAgbmV3X3ZhbHVlID0gZ19tYWxsb2MgKHNpemVvZiAqbmV3X3ZhbHVlKTsKKyAgICAqbmV3X3ZhbHVlID0gdmFsdWU7CisgICAgZ19hcnJheV9hcHBlbmRfdmFsICgqX3JldHVybiwgKm5ld192YWx1ZSk7CisgIH0KKyAgcHJpbnRmICgifSlcbiIpOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2VudW0gKFRUZXN0VGhyaWZ0VGVzdElmICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0TnVtYmVyeiAgICAgICAgKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3ROdW1iZXJ6ICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICoqZXJyb3IpCit7CisgIFRIUklGVF9VTlVTRURfVkFSIChpZmFjZSk7CisgIFRIUklGVF9VTlVTRURfVkFSIChlcnJvcik7CisKKyAgcHJpbnRmICgidGVzdEVudW0oJWQpXG4iLCB0aGluZyk7CisgICpfcmV0dXJuID0gdGhpbmc7CisKKyAgcmV0dXJuIFRSVUU7Cit9CisKK2dib29sZWFuCit0aHJpZnRfdGVzdF9oYW5kbGVyX3Rlc3RfdHlwZWRlZiAoVFRlc3RUaHJpZnRUZXN0SWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUVGVzdFVzZXJJZCAgICAgICAgKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RVc2VySWQgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RUeXBlZGVmKCUiIFBSSWQ2NCAiKVxuIiwgdGhpbmcpOworICAqX3JldHVybiA9IHRoaW5nOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X21hcF9tYXAgKFRUZXN0VGhyaWZ0VGVzdElmICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICAgaGVsbG8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgR0hhc2hUYWJsZSAqcG9zaXRpdmU7CisgIEdIYXNoVGFibGUgKm5lZ2F0aXZlOworICBnaW50MzIgKmtleTsKKyAgZ2ludDMyICp2YWx1ZTsKKyAgZ3VpbnQgaTsKKworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworCisgIHByaW50ZiAoInRlc3RNYXBNYXAoJWQpXG4iLCBoZWxsbyk7CisKKyAgcG9zaXRpdmUgPSBnX2hhc2hfdGFibGVfbmV3X2Z1bGwgKGdfaW50X2hhc2gsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2ludF9lcXVhbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZnJlZSk7CisgIG5lZ2F0aXZlID0gZ19oYXNoX3RhYmxlX25ld19mdWxsIChnX2ludF9oYXNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19pbnRfZXF1YWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2ZyZWUpOworCisgIGZvciAoaSA9IDE7IGkgPCA1OyBpICs9IDEpIHsKKyAgICBrZXkgPSBnX21hbGxvYyAoc2l6ZW9mICprZXkpOworICAgIHZhbHVlID0gZ19tYWxsb2MgKHNpemVvZiAqdmFsdWUpOworICAgICprZXkgPSBpOworICAgICp2YWx1ZSA9IGk7CisgICAgZ19oYXNoX3RhYmxlX2luc2VydCAocG9zaXRpdmUsIGtleSwgdmFsdWUpOworCisgICAga2V5ID0gZ19tYWxsb2MgKHNpemVvZiAqa2V5KTsKKyAgICB2YWx1ZSA9IGdfbWFsbG9jIChzaXplb2YgKnZhbHVlKTsKKyAgICAqa2V5ID0gLWk7CisgICAgKnZhbHVlID0gLWk7CisgICAgZ19oYXNoX3RhYmxlX2luc2VydCAobmVnYXRpdmUsIGtleSwgdmFsdWUpOworICB9CisKKyAga2V5ID0gZ19tYWxsb2MgKHNpemVvZiAqa2V5KTsKKyAgKmtleSA9IDQ7CisgIGdfaGFzaF90YWJsZV9pbnNlcnQgKCpfcmV0dXJuLCBrZXksIHBvc2l0aXZlKTsKKworICBrZXkgPSBnX21hbGxvYyAoc2l6ZW9mICprZXkpOworICAqa2V5ID0gLTQ7CisgIGdfaGFzaF90YWJsZV9pbnNlcnQgKCpfcmV0dXJuLCBrZXksIG5lZ2F0aXZlKTsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9pbnNhbml0eSAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHSGFzaFRhYmxlICAgICAgICAgICoqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RJbnNhbml0eSAgKmFyZ3VtZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpCit7CisgIFRUZXN0WHRydWN0ICp4dHJ1Y3RfaW47CisKKyAgZ2NoYXIgKnN0cmluZ190aGluZyA9IE5VTEw7CisgIGdpbnQgICBieXRlX3RoaW5nOworICBnaW50ICAgaTMyX3RoaW5nOworICBnaW50NjQgaTY0X3RoaW5nOworCisgIEdQdHJBcnJheSAqeHRydWN0czsKKworICBUVGVzdEluc2FuaXR5ICpsb29uZXk7CisKKyAgR0hhc2hUYWJsZSAqdXNlcl9tYXA7CisgIEdIYXNoVGFibGUgKmZpcnN0X21hcDsKKyAgR0hhc2hUYWJsZSAqc2Vjb25kX21hcDsKKworICBHSGFzaFRhYmxlSXRlciBoYXNoX3RhYmxlX2l0ZXI7CisgIEdIYXNoVGFibGVJdGVyIGlubmVyX2hhc2hfdGFibGVfaXRlcjsKKyAgR0hhc2hUYWJsZUl0ZXIgdXNlcl9tYXBfaXRlcjsKKworICBncG9pbnRlciBrZXk7CisgIGdwb2ludGVyIHZhbHVlOworCisgIFRUZXN0VXNlcklkICp1c2VyX2lkOworCisgIGd1aW50IGk7CisKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBwcmludGYgKCJ0ZXN0SW5zYW5pdHkoKVxuIik7CisKKyAgZmlyc3RfbWFwID0gZ19oYXNoX3RhYmxlX25ld19mdWxsIChnX2RpcmVjdF9oYXNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdfZGlyZWN0X2VxdWFsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19vYmplY3RfdW5yZWYpOworICBzZWNvbmRfbWFwID0gZ19oYXNoX3RhYmxlX25ld19mdWxsIChnX2RpcmVjdF9oYXNoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnX2RpcmVjdF9lcXVhbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ19vYmplY3RfdW5yZWYpOworCisgIGdfaGFzaF90YWJsZV9pbnNlcnQgKGZpcnN0X21hcCwKKyAgICAgICAgICAgICAgICAgICAgICAgR0lOVF9UT19QT0lOVEVSIChUX1RFU1RfTlVNQkVSWl9UV08pLAorICAgICAgICAgICAgICAgICAgICAgICAoZ3BvaW50ZXIpYXJndW1lbnQpOworICBnX2hhc2hfdGFibGVfaW5zZXJ0IChmaXJzdF9tYXAsCisgICAgICAgICAgICAgICAgICAgICAgIEdJTlRfVE9fUE9JTlRFUiAoVF9URVNUX05VTUJFUlpfVEhSRUUpLAorICAgICAgICAgICAgICAgICAgICAgICAoZ3BvaW50ZXIpYXJndW1lbnQpOworCisgIC8qIEluY3JlbWVudCBhcmd1bWVudCdzIHJlZiBjb3VudCBieSB0d28gYmVjYXVzZSBmaXJzdF9tYXAgbm93IGhvbGRzCisgICAgIHR3byByZWZlcmVuY2VzIHRvIGl0IGFuZCB0aGUgY2FsbGVyIGlzIG5vdCBhd2FyZSB3ZSBoYXZlIG1hZGUgYW55CisgICAgIGFkZGl0aW9uYWwgcmVmZXJlbmNlcyB0byBhcmd1bWVudC4gIChUaGF0IGlzLCBjYWxsZXIgb3ducyBhcmd1bWVudAorICAgICBhbmQgd2lsb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AoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmhhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZrZXksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWUpKSB7CisgICAgcHJpbnRmICgiJSIgUFJJZDY0ICIgPT4geyIsICooVFRlc3RVc2VySWQgKilrZXkpOworCisgICAgZ19oYXNoX3RhYmxlX2l0ZXJfaW5pdCAoJmlubmVyX2hhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoR0hhc2hUYWJsZSAqKXZhbHVlKTsKKyAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJmlubmVyX2hhc2hfdGFibGVfaXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnZhbHVlKSkgeworICAgICAgcHJpbnRmICgiJWQgPT4geyIsIChUVGVzdE51bWJlcnopa2V5KTsKKworICAgICAgZ19vYmplY3RfZ2V0ICgoVFRlc3RJbnNhbml0eSAqKXZhbHVlLAorICAgICAgICAgICAgICAgICAgICAidXNlck1hcCIsICZ1c2VyX21hcCwKKyAgICAgICAgICAgICAgICAgICAgInh0cnVjdHMiLCAmeHRydWN0cywKKyAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICAgIHByaW50ZiAoInsiKTsKKyAgICAgIGdfaGFzaF90YWJsZV9pdGVyX2luaXQgKCZ1c2VyX21hcF9pdGVyLCB1c2VyX21hcCk7CisgICAgICB3aGlsZSAoZ19oYXNoX3RhYmxlX2l0ZXJfbmV4dCAoJnVzZXJfbWFwX2l0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmtleSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmdmFsdWUpKSB7CisgICAgICAgIHByaW50ZiAoIiVkID0+ICUiIFBSSWQ2NCAiLCAiLAorICAgICAgICAgICAgICAgIChUVGVzdE51bWJlcnopa2V5LAorICAgICAgICAgICAgICAgICooVFRlc3RVc2VySWQgKil2YWx1ZSk7CisgICAgICB9CisgICAgICBwcmludGYgKCJ9LCAiKTsKKyAgICAgIGdfaGFzaF90YWJsZV91bnJlZiAodXNlcl9tYXApOworCisgICAgICBwcmludGYgKCJ7Iik7CisgICAgICBmb3IgKGkgPSAwOyBpIDwgeHRydWN0cy0+bGVuOyArK2kpIHsKKyAgICAgICAgeHRydWN0X2luID0gZ19wdHJfYXJyYXlfaW5kZXggKHh0cnVjdHMsIGkpOworICAgICAgICBnX29iamVjdF9nZXQgKHh0cnVjdF9pbiwKKyAgICAgICAgICAgICAgICAgICAgICAic3RyaW5nX3RoaW5nIiwgJnN0cmluZ190aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAiYnl0ZV90aGluZyIsICAgJmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgImkzMl90aGluZyIsICAgICZpMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgImk2NF90aGluZyIsICAgICZpNjRfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICAgICAgcHJpbnRmICgie1wiJXNcIiwgJWQsICVkLCAlIiBQUklkNjQgIn0sICIsCisgICAgICAgICAgICAgICAgc3RyaW5nX3RoaW5nLAorICAgICAgICAgICAgICAgIGJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgaTMyX3RoaW5nLAorICAgICAgICAgICAgICAgIGk2NF90aGluZyk7CisgICAgICB9CisgICAgICBwcmludGYgKCJ9Iik7CisgICAgICBnX3B0cl9hcnJheV91bnJlZiAoeHRydWN0cyk7CisKKyAgICAgIHByaW50ZiAoIn0sICIpOworICAgIH0KKyAgICBwcmludGYgKCJ9LCAiKTsKKyAgfQorICBwcmludGYgKCJ9XG4iKTsKKworICByZXR1cm4gVFJVRTsKK30KKworZ2Jvb2xlYW4KK3RocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9tdWx0aSAoVFRlc3RUaHJpZnRUZXN0SWYgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WHRydWN0ICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQ4ICAgICAgICAgIGFyZzAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICAgIGFyZzEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQ2NCAgICAgICAgIGFyZzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEdIYXNoVGFibGUgICAgKmFyZzMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUZXN0TnVtYmVyeiAgIGFyZzQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUZXN0VXNlcklkICAgIGFyZzUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAqKmVycm9yKQoreworICBUSFJJRlRfVU5VU0VEX1ZBUiAoaWZhY2UpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoZXJyb3IpOworICBUSFJJRlRfVU5VU0VEX1ZBUiAoYXJnMyk7CisgIFRIUklGVF9VTlVTRURfVkFSIChhcmc0KTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGFyZzUpOworCisgIHByaW50ZiAoInRlc3RNdWx0aSgpXG4iKTsKKworICBnX29iamVjdF9zZXQgKCpfcmV0dXJuLAorICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCBnX3N0cmR1cCAoIkhlbGxvMiIpLAorICAgICAgICAgICAgICAgICJieXRlX3RoaW5nIiwgICBhcmcwLAorICAgICAgICAgICAgICAgICJpMzJfdGhpbmciLCAgICBhcmcxLAorICAgICAgICAgICAgICAgICJpNjRfdGhpbmciLCAgICBhcmcyLAorICAgICAgICAgICAgICAgIE5VTEwpOworCisgIHJldHVybiBUUlVFOworfQorCitnYm9vbGVhbgordGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2V4Y2VwdGlvbiAoVFRlc3RUaHJpZnRUZXN0SWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdjaGFyICAgICAgICAqYXJnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbiAgICAgKiplcnIxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKworICBUVGVzdFh0cnVjdCAqeHRydWN0OworICBnYm9vbGVhbiByZXN1bHQ7CisKKyAgcHJpbnRmICgidGVzdEV4Y2VwdGlvbiglcylcbiIsIGFyZyk7CisKKyAgLyogVW5saWtlIGFyZ3VtZW50IG9iamVjdHMsIGV4Y2VwdGlvbiBvYmplY3RzIGFyZSBub3QgcHJlLWNyZWF0ZWQgKi8KKyAgZ19hc3NlcnQgKCplcnIxID09IE5VTEwpOworCisgIGlmIChzdHJuY21wIChhcmcsICJYY2VwdGlvbiIsIDkpID09IDApIHsKKyAgICAvKiAiVGhyb3ciIGEgY3VzdG9tIGV4Y2VwdGlvbjogU2V0IHRoZSBjb3JyZXNwb25kaW5nIGV4Y2VwdGlvbgorICAgICAgIGFyZ3VtZW50LCBzZXQgKmVycm9yIHRvIE5VTEwgYW5kIHJldHVybiBGQUxTRSAqLworICAgICplcnIxID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YQ0VQVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgImVycm9yQ29kZSIsIDEwMDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJtZXNzYWdlIiwgICBnX3N0cmR1cCAoYXJnKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgKmVycm9yID0gTlVMTDsKKyAgICByZXN1bHQgPSBGQUxTRTsKKyAgfQorICBlbHNlIGlmIChzdHJuY21wIChhcmcsICJURXhjZXB0aW9uIiwgMTEpID09IDApIHsKKyAgICAvKiAiVGhyb3ciIGEgZ2VuZXJpYyBURXhjZXB0aW9uIChUaHJpZnRBcHBsaWNhdGlvbkV4Y2VwdGlvbik6IFNldAorICAgICAgIGFsbCBleGNlcHRpb24gYXJndW1lbnRzIHRvIE5VTEwsIHNldCAqZXJyb3IgYW5kIHJldHVybiBGQUxTRSAqLworICAgICplcnIxID0gTlVMTDsKKyAgICBnX3NldF9lcnJvciAoZXJyb3IsCisgICAgICAgICAgICAgICAgIHRocmlmdF9hcHBsaWNhdGlvbl9leGNlcHRpb25fZXJyb3JfcXVhcmsgKCksCisgICAgICAgICAgICAgICAgIFRIUklGVF9BUFBMSUNBVElPTl9FWENFUFRJT05fRVJST1JfVU5LTk9XTiwKKyAgICAgICAgICAgICAgICAgIkRlZmF1bHQgVEV4Y2VwdGlvbi4iKTsKKyAgICByZXN1bHQgPSBGQUxTRTsKKyAgfQorICBlbHNlIHsKKyAgICAqZXJyMSA9IE5VTEw7CisgICAgKmVycm9yID0gTlVMTDsKKworICAgIC8qIFRoaXMgY29kZSBpcyBkdXBsaWNhdGVkIGZyb20gdGhlIEMrKyB0ZXN0IHN1aXRlLCB0aG91Z2ggaXQKKyAgICAgICBhcHBlYXJzIHRvIHNlcnZlIG5vIHB1cnBvc2UgKi8KKyAgICB4dHJ1Y3QgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1hUUlVDVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICJzdHJpbmdfdGhpbmciLCBnX3N0cmR1cCAoYXJnKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgIGdfb2JqZWN0X3VucmVmICh4dHJ1Y3QpOworCisgICAgcmVzdWx0ID0gVFJVRTsKKyAgfQorCisgIHJldHVybiByZXN1bHQ7Cit9CisKK2dib29sZWFuCit0aHJpZnRfdGVzdF9oYW5kbGVyX3Rlc3RfbXVsdGlfZXhjZXB0aW9uIChUVGVzdFRocmlmdFRlc3RJZiAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYdHJ1Y3QgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgICAgICAgICphcmcwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgICAgICAgICphcmcxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbiAgICAgKiplcnIxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbjIgICAgKiplcnIyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgKiplcnJvcikKK3sKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGlmYWNlKTsKKyAgVEhSSUZUX1VOVVNFRF9WQVIgKGVycm9yKTsKKworICBUVGVzdFh0cnVjdCAqc3RydWN0X3RoaW5nOworICBnYm9vbGVhbiByZXN1bHQ7CisKKyAgcHJpbnRmICgidGVzdE11bHRpRXhjZXB0aW9uKCVzLCAlcylcbiIsIGFyZzAsIGFyZzEpOworCisgIGdfYXNzZXJ0ICgqZXJyMSA9PSBOVUxMKTsKKyAgZ19hc3NlcnQgKCplcnIyID09IE5VTEwpOworCisgIGlmIChzdHJuY21wIChhcmcwLCAiWGNlcHRpb24iLCA4KSA9PSAwICYmIHN0cmxlbihhcmcwKSA9PSA4KSB7CisgICAgKmVycjEgPSBnX29iamVjdF9uZXcgKFRfVEVTVF9UWVBFX1hDRVBUSU9OLAorICAgICAgICAgICAgICAgICAgICAgICAgICAiZXJyb3JDb2RlIiwgMTAwMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIm1lc3NhZ2UiLCAgIGdfc3RyZHVwICgiVGhpcyBpcyBhbiBYY2VwdGlvbiIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgICByZXN1bHQgPSBGQUxTRTsKKyAgfQorICBlbHNlIGlmIChzdHJuY21wIChhcmcwLCAiWGNlcHRpb24yIiwgOSkgPT0gMCkgeworICAgICplcnIyID0gZ19vYmplY3RfbmV3IChUX1RFU1RfVFlQRV9YQ0VQVElPTjIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICJlcnJvckNvZGUiLCAyMDAyLAorICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKworICAgIGdfb2JqZWN0X2dldCAoKmVycjIsCisgICAgICAgICAgICAgICAgICAic3RydWN0X3RoaW5nIiwgJnN0cnVjdF90aGluZywKKyAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgIGdfb2JqZWN0X3NldCAoc3RydWN0X3RoaW5nLAorICAgICAgICAgICAgICAgICAgInN0cmluZ190aGluZyIsIGdfc3RyZHVwICgiVGhpcyBpcyBhbiBYY2VwdGlvbjIiKSwKKyAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgIGdfb2JqZWN0X3NldCAoKmVycjIsCisgICAgICAgICAgICAgICAgICAic3RydWN0X3RoaW5nIiwgc3RydWN0X3RoaW5nLAorICAgICAgICAgICAgICAgICAgTlVMTCk7CisgICAgZ19vYmplY3RfdW5yZWYgKHN0cnVjdF90aGluZyk7CisKKyAgICByZXN1bHQgPSBGQUxTRTsKKyAgfQorICBlbHNlIHsKKyAgICBnX29iamVjdF9zZXQgKCpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgInN0cmluZ190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RUaHJpZnRUZXN0SWYgaW50ZXJmYWNlICovCisKKyNkZWZpbmUgVFlQRV9USFJJRlRfVEVTVF9IQU5ETEVSICh0aHJpZnRfdGVzdF9oYW5kbGVyX2dldF90eXBlICgpKQorCisjZGVmaW5lIFRIUklGVF9URVNUX0hBTkRMRVIob2JqKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0lOU1RBTkNFX0NBU1QgKChvYmopLCAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1RIUklGVF9URVNUX0hBTkRMRVIsICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VGVzdEhhbmRsZXIpKQorI2RlZmluZSBJU19USFJJRlRfVEVTVF9IQU5ETEVSKG9iaikgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19JTlNUQU5DRV9UWVBFICgob2JqKSwgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9USFJJRlRfVEVTVF9IQU5ETEVSKSkKKyNkZWZpbmUgVEhSSUZUX1RFU1RfSEFORExFUl9DTEFTUyhjKSAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0NMQVNTX0NBU1QgKChjKSwgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9USFJJRlRfVEVTVF9IQU5ETEVSLCAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJpZnRUZXN0SGFuZGxlckNsYXNzKSkKKyNkZWZpbmUgSVNfVEhSSUZUX1RFU1RfSEFORExFUl9DTEFTUyhjKSAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0NMQVNTX1RZUEUgKChjKSwgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRV9USFJJRlRfVEVTVF9IQU5ETEVSKSkKKyNkZWZpbmUgVEhSSUZUX1RFU1RfSEFORExFUl9HRVRfQ0xBU1Mob2JqKSAgICAgICAgICAgICAgXAorICAoR19UWVBFX0lOU1RBTkNFX0dFVF9DTEFTUyAoKG9iaiksICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1RIUklGVF9URVNUX0hBTkRMRVIsIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRocmlmdFRlc3RIYW5kbGVyQ2xhc3MpKQorCit0eXBlZGVmIHN0cnVjdCBfVGhyaWZ0VGVzdEhhbmRsZXIgVGhyaWZ0VGVzdEhhbmRsZXI7Cit0eXBlZGVmIHN0cnVjdCBfVGhyaWZ0VGVzdEhhbmRsZXJDbGFzcyBUaHJpZnRUZXN0SGFuZGxlckNsYXNzOworCitzdHJ1Y3QgX1RocmlmdFRlc3RIYW5kbGVyIHsKKyAgVFRlc3RUaHJpZnRUZXN0SGFuZGxlciBwYXJlbnQ7Cit9OworCitzdHJ1Y3QgX1RocmlmdFRlc3RIYW5kbGVyQ2xhc3MgeworICBUVGVzdFRocmlmdFRlc3RIYW5kbGVyQ2xhc3MgcGFyZW50OworCisgIGdib29sZWFuICgqdGVzdF92b2lkKSAgICAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3Rfc3RyaW5nKSAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2NoYXIgICAgICAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAgICAgICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfYm9vbCkgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2Jvb2xlYW4qX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdib29sZWFuICAgICAgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9ieXRlKSAgICAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaW50OCpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDggICAgICAgICAgIHRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKKyAgZ2Jvb2xlYW4gKCp0ZXN0X2kzMikgICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQzMipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDMyICAgICAgICAgIHRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKKyAgZ2Jvb2xlYW4gKCp0ZXN0X2k2NCkgICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQ2NCpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDY0ICAgICAgICAgIHRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKKyAgZ2Jvb2xlYW4gKCp0ZXN0X2RvdWJsZSkgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkb3VibGUqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdkb3VibGUgICAgICAgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9iaW5hcnkpICAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHQnl0ZUFycmF5ICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHQnl0ZUFycmF5ICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3Rfc3RydWN0KSAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYdHJ1Y3QgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdFh0cnVjdCAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfbmVzdCkgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYdHJ1Y3QyICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdFh0cnVjdDIgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfbWFwKSAgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3Rfc3RyaW5nX21hcCkgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3Rfc2V0KSAgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfbGlzdCkgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0FycmF5ICAgICAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHQXJyYXkgICAgICAgICAqdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfZW51bSkgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3ROdW1iZXJ6Kl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdE51bWJlcnogICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfdHlwZWRlZikgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RVc2VySWQqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUZXN0VXNlcklkICAgICB0aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9tYXBfbWFwKSAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHSGFzaFRhYmxlICAgICAgICAgICoqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICAgICBoZWxsbywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9pbnNhbml0eSkgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHSGFzaFRhYmxlICAgICAgICAgICoqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUZXN0SW5zYW5pdHkgICphcmd1bWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9tdWx0aSkgICAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUVGVzdFh0cnVjdCAgICAgICAgICoqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQ4ICAgICAgICAgICBhcmcwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDMyICAgICAgICAgIGFyZzEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50NjQgICAgICAgICAgYXJnMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEdIYXNoVGFibGUgICAgICphcmczLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3ROdW1iZXJ6ICAgIGFyZzQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdFVzZXJJZCAgICAgYXJnNSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9leGNlcHRpb24pICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAgICAgICAgICAqYXJnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbiAgICAgICAqKmVycjEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworICBnYm9vbGVhbiAoKnRlc3RfbXVsdGlfZXhjZXB0aW9uKSAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYdHJ1Y3QgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAgICAgICAgICAqYXJnMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdjaGFyICAgICAgICAgICphcmcxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbiAgICAgICAqKmVycjEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUVGVzdFhjZXB0aW9uMiAgICAgICoqZXJyMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICAgICAgICAgKiplcnJvcik7CisgIGdib29sZWFuICgqdGVzdF9vbmV3YXkpICAgICAgICAgIChUVGVzdFRocmlmdFRlc3RJZiAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50MzIgICAgICAgICAgc2Vjb25kc1RvU2xlZXAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworfTsKKworLyogVXNlZCBieSBUSFJJRlRfVEVTVF9IQU5ETEVSX0dFVF9UWVBFICovCitHVHlwZSB0aHJpZnRfdGVzdF9oYW5kbGVyX2dldF90eXBlICh2b2lkKTsKKworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X3ZvaWQgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zdHJpbmcgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdjaGFyICAgICAgICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgICAgICAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9ieXRlICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdpbnQ4Kl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50OCAgICAgICAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdF90ZXN0X3RocmlmdF90ZXN0X2lmX3Rlc3RfaTMyICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDMyKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50MzIgICAgICAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2k2NCAgICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2ludDY0Kl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50NjQgICAgICAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2RvdWJsZSAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RvdWJsZSpfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2RvdWJsZSAgICAgICAgIHRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zdHJ1Y3QgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WHRydWN0ICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RYdHJ1Y3QgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9uZXN0ICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WHRydWN0MiAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RYdHJ1Y3QyICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9tYXAgICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdIYXNoVGFibGUgICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR0hhc2hUYWJsZSAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zdHJpbmdfbWFwICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdIYXNoVGFibGUgICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR0hhc2hUYWJsZSAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9zZXQgICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdIYXNoVGFibGUgICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR0hhc2hUYWJsZSAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9saXN0ICAgICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdBcnJheSAgICAgICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgR0FycmF5ICAgICAgICAgKnRoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF90eXBlZGVmICAgICAgICAgKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0VXNlcklkKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdFVzZXJJZCAgICAgdGhpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X21hcF9tYXAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50MzIgICAgICAgICAgaGVsbG8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2luc2FuaXR5ICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0hhc2hUYWJsZSAgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBUVGVzdEluc2FuaXR5ICAqYXJndW1lbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X211bHRpICAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYdHJ1Y3QgICAgICAgICAqKl9yZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnaW50OCAgICAgICAgICAgYXJnMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICAgICBhcmcxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDY0ICAgICAgICAgIGFyZzIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBHSGFzaFRhYmxlICAgICAqYXJnMywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFRUZXN0TnVtYmVyeiAgICBhcmc0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgVFRlc3RVc2VySWQgICAgIGFyZzUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X2V4Y2VwdGlvbiAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgICAgICAgICAgKmFyZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WGNlcHRpb24gICAgICAgKiplcnIxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKK2dib29sZWFuIHRocmlmdF90ZXN0X2hhbmRsZXJfdGVzdF9tdWx0aV9leGNlcHRpb24gKFRUZXN0VGhyaWZ0VGVzdElmICAgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WHRydWN0ICAgICAgICAgKipfcmV0dXJuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2NoYXIgICAgICAgICAgKmFyZzAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBnY2hhciAgICAgICAgICAqYXJnMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRUZXN0WGNlcHRpb24gICAgICAgKiplcnIxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFRlc3RYY2VwdGlvbjIgICAgICAqKmVycjIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgICAgICAgICAgICoqZXJyb3IpOworZ2Jvb2xlYW4gdGhyaWZ0X3Rlc3RfaGFuZGxlcl90ZXN0X29uZXdheSAgICAgICAgICAoVFRlc3RUaHJpZnRUZXN0SWYgICAgKmlmYWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZ2ludDMyICAgICAgICAgIHNlY29uZHNUb1NsZWVwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0Vycm9yICAgICAgICAgICAgICAqKmVycm9yKTsKKworR19FTkRfREVDTFMKKworI2VuZGlmIC8qIF9USFJJRlRfVEVTVF9IQU5ETEVSX0ggKi8KZGlmZiAtLWdpdCBhL3Rlc3QvY2wvTWFrZWZpbGUuYW0gYi90ZXN0L2NsL01ha2VmaWxlLmFtCm5ldyBmaWxlIG1vZGUgMTAwNzU1CmluZGV4IDAwMDAwMDAuLmI1ZTcyYmMKLS0tIC9kZXYvbnVsbAorKysgYi90ZXN0L2NsL01ha2VmaWxlLmFtCkBAIC0wLDAgKzEsNDIgQEAKKyMKKyMgTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQorIyBvciBtb3JlIGNvbnRyaWJ1dG9yIGxpY2Vuc2UgYWdyZWVtZW50cy4gU2VlIHRoZSBOT1RJQ0UgZmlsZQorIyBkaXN0cmlidXRlZCB3aXRoIHRoaXMgd29yayBmb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W50YXRpb246dGVzdC1pbnNhbml0eSAoYXJndW1lbnQpCisgIChsZXQgKChyZXN1bHQgYCgoMSAuICgoMiAuICxhcmd1bWVudCkgKDMgLiAsYXJndW1lbnQpKSkKKyAgICAgICAgICAgICAgICAgICgyIC4gKCg2IC4gLCh0aHJpZnQudGVzdDo6bWFrZS1pbnNhbml0eSA6dXNlci1tYXAgbmlsIDp4dHJ1Y3RzIG5pbCkpKSkpKSkKKyAgICAoZm9ybWF0IHQgIn5hfiUiIHJlc3VsdCkKKyAgICByZXN1bHQpKQorCisoZGVmdW4gdGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3QtaW1wbGVtZW50YXRpb246dGVzdC1tdWx0aSAoYXJnMCBhcmcxIGFyZzIgYXJnMyBhcmc0IGFyZzUpCisgIChkZWNsYXJlIChpZ25vcmFibGUgYXJnMyBhcmc0IGFyZzUpKQorICAoZm9ybWF0IHQgInRlc3RNdWx0aSgpfiUiKQorICAodGhyaWZ0LnRlc3Q6bWFrZS14dHJ1Y3QgOnN0cmluZy10aGluZyAiSGVsbG8yIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgOmJ5dGUtdGhpbmcgYXJnMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgOmkzMi10aGluZyBhcmcxCisgICAgICAgICAgICAgICAgICAgICAgICAgICA6aTY0LXRoaW5nIGFyZzIpKQorCisoZGVmdW4gdGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3QtaW1wbGVtZW50YXRpb246dGVzdC1leGNlcHRpb24gKGFyZykKKyAgKGZvcm1hdCB0ICJ0ZXN0RXhjZXB0aW9uKH5hKX4lIiBhcmcpCisgIChjb25kCisgICAgKChzdHJpbmc9IGFyZyAiWGNlcHRpb24iKSAoZXJyb3IgJ3RocmlmdC50ZXN0OnhjZXB0aW9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmVycm9yLWNvZGUgMTAwMQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDptZXNzYWdlIGFyZykpCisgICAgKChzdHJpbmc9IGFyZyAiVEV4Y2VwdGlvbiIpIChlcnJvciAndGhyaWZ0LnRlc3Q6eGNlcHRpb24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDplcnJvci1jb2RlIDAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDptZXNzYWdlICJTdHVmZiEiKSkpKQorCisoZGVmdW4gdGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3QtaW1wbGVtZW50YXRpb246dGVzdC1tdWx0aS1leGNlcHRpb24gKGFyZzAgYXJnMSkKKyAgKGZvcm1hdCB0ICJ0ZXN0TXVsdGlFeGNlcHRpb24ofmEsIH5hKX4lIiBhcmcwIGFyZzEpCisgIChjb25kCisgICAgKChzdHJpbmc9IGFyZzAgIlhjZXB0aW9uIikgKGVycm9yICd0aHJpZnQudGVzdDp4Y2VwdGlvbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDplcnJvci1jb2RlIDEwMDEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6bWVzc2FnZSAiVGhpcyBpcyBhbiBYY2VwdGlvbiIpKQorICAgICgoc3RyaW5nPSBhcmcwICJYY2VwdGlvbjIiKSAoZXJyb3IgJ3RocmlmdC50ZXN0OnhjZXB0aW9uMgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDplcnJvci1jb2RlIDIwMDIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6c3RydWN0LXRoaW5nICh0aHJpZnQudGVzdDptYWtlLXh0cnVjdCA6c3RyaW5nLXRoaW5nICJUaGlzIGlzIGFuIFhjZXB0aW9uMiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6Ynl0ZS10aGluZyAwCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmkzMi10aGluZyAwCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmk2NC10aGluZyAwKSkpKQorICAodGhyaWZ0LnRlc3Q6bWFrZS14dHJ1Y3QgOnN0cmluZy10aGluZyBhcmcxCisgICAgICAgICAgICAgICAgICAgICAgICAgICA6Ynl0ZS10aGluZyAwCisgICAgICAgICAgICAgICAgICAgICAgICAgICA6aTMyLXRoaW5nIDAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDppNjQtdGhpbmcgMCkpCisKKyhkZWZ1biB0aHJpZnQudGVzdC50aHJpZnQtdGVzdC1pbXBsZW1lbnRhdGlvbjp0ZXN0LW9uZXdheSAoc2Vjb25kcykKKyAgKGZvcm1hdCB0ICJ0ZXN0T25ld2F5KH5hKTogU2xlZXBpbmcuLi5+JSIgc2Vjb25kcykKKyAgKHNsZWVwIHNlY29uZHMpCisgIChmb3JtYXQgdCAidGVzdE9uZXdheSh+YSk6IGRvbmUgc2xlZXBpbmchfiUiIHNlY29uZHMpKQorCis7OzsgUmVtb3ZlZCBmcm9tIHRoZSBJREwgZGVmaW5pdGlvbi4KKyMrKG9yKQorKGRlZnVuIHRocmlmdC50ZXN0LnNlY29uZC1zZXJ2aWNlLWltcGxlbWVudGF0aW9uOmJsYWgtYmxhaCAoKQorICAoZm9ybWF0IHQgImJsYWhCbGFoKCl+JSIpKQorCisoZGVmdW4gdGhyaWZ0LnRlc3Quc2Vjb25kLXNlcnZpY2UtaW1wbGVtZW50YXRpb246c2Vjb25kdGVzdC1zdHJpbmcgKHRoaW5nKQorICAoZm9ybWF0IHQgInNlY29uZHRlc3RTdHJpbmcofmEpfiUiIHRoaW5nKQorICAoY29uY2F0ZW5hdGUgJ3N0cmluZyAidGVzdFN0cmluZyhcIiIgdGhpbmcgIlwiKSIpKQorCm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dGUuIikKKyAgKGdyb3VwICg6aGVhZGVyICJBbGxvd2VkIG9wdGlvbnM6IikKKyAgICAoZmxhZyA6c2hvcnQtbmFtZSAiaCIgOmxvbmctbmFtZSAiaGVscCIKKyAgICAgICAgICA6ZGVzY3JpcHRpb24gIlByaW50IHRoaXMgaGVscCBhbmQgZXhpdC4iKQorICAgIChzdHJvcHQgOmxvbmctbmFtZSAiaG9zdCIKKyAgICAgICAgICAgIDpkZXNjcmlwdGlvbiAiVGhlIGhvc3QgdG8gY29ubmVjdCB0by4iCisgICAgICAgICAgICA6ZGVmYXVsdC12YWx1ZSAibG9jYWxob3N0IgorICAgICAgICAgICAgOmFyZ3VtZW50LW5hbWUgIkFSRyIpCisgICAgKHN0cm9wdCA6bG9uZy1uYW1lICJwb3J0IgorICAgICAgICAgICAgOmRlc2NyaXB0aW9uICJOdW1iZXIgb2YgdGhlIHBvcnQgdG8gbGlzdGVuIGZvciBjb25uZWN0aW9ucyBvbi4iCisgICAgICAgICAgICA6ZGVmYXVsdC12YWx1ZSAiOTA5MCIKKyAgICAgICAgICAgIDphcmd1bWVudC1uYW1lICJBUkciCisgICAgICAgICAgICA6YXJndW1lbnQtdHlwZSA6b3B0aW9uYWwpCisgICAgKHN0cm9wdCA6bG9uZy1uYW1lICJ0cmFuc3BvcnQiCisgICAgICAgICAgICA6ZGVzY3JpcHRpb24gIlRyYW5zcG9ydDogdHJhbnNwb3J0IHRvIHVzZSAoXCJidWZmZXJlZFwiLCBcImZyYW1lZFwiKSIKKyAgICAgICAgICAgIDpkZWZhdWx0LXZhbHVlICJidWZmZXJlZCIKKyAgICAgICAgICAgIDphcmd1bWVudC1uYW1lICJBUkciKQorICAgIChzdHJvcHQgOmxvbmctbmFtZSAicHJvdG9jb2wiCisgICAgICAgICAgICA6ZGVzY3JpcHRpb24gIlByb3RvY29sOiBwcm90b2NvbCB0byB1c2UgKFwiYmluYXJ5XCIsIFwibXVsdGlcIikiCisgICAgICAgICAgICA6ZGVmYXVsdC12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iKQorICAgICAgICAgIChjb25kICgoc3RyaW5nPSB2YWx1ZSAiYnVmZmVyZWQiKSAoc2V0ZiBmcmFtZWQgbmlsKSkKKyAgICAgICAgICAgICAgICAoKHN0cmluZz0gdmFsdWUgImZyYW1lZCIpIChzZXRmIGZyYW1lZCB0KSkKKyAgICAgICAgICAgICAgICAodCAoZXJyb3IgIlVuc3VwcG9ydGVkIHRyYW5zcG9ydC4iKSkpKQorICAgICAgKGlmIChzdHJpbmc9IG5hbWUgInByb3RvY29sIikKKyAgICAgICAgICAoY29uZCAoKHN0cmluZz0gdmFsdWUgImJpbmFyeSIpIChzZXRmIG11bHRpcGxleGVkIG5pbCkpCisgICAgICAgICAgICAgICAgKChzdHJpbmc9IHZhbHVlICJtdWx0aSIpIChzZXRmIG11bHRpcGxleGVkIHQpKQorICAgICAgICAgICAgICAgICh0IChlcnJvciAiVW5zdXBwb3J0ZWQgcHJvdG9jb2wuIikpKSkpCisgICAgKHRlcnByaSkKKyAgICAobGV0ICgoc2VydmljZXMgKGlmIG11bHRpcGxleGVkCisgICAgICAgICAgICAgICAgICAgICAgICAobGlzdCB0aHJpZnQudGVzdDp0aHJpZnQtdGVzdCB0aHJpZnQudGVzdDpzZWNvbmQtc2VydmljZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocmlmdC50ZXN0OnRocmlmdC10ZXN0KSkpCisgICAgICAodGhyaWZ0OnNlcnZlIChwdXJpOnBhcnNlLXVyaSAoY29uY2F0ZW5hdGUgJ3N0cmluZworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0aHJpZnQ6Ly8xMjcuMC4wLjE6IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQpKQorICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlcworICAgICAgICAgICAgICAgICAgICA6ZnJhbWVkIGZyYW1lZAorICAgICAgICAgICAgICAgICAgICA6bXVsdGlwbGV4ZW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W5sZXNzIChydW4tcGFja2FnZS10ZXN0cyA6cGFja2FnZSA6c3RydWN0cykKKyAgICAgICAgICAgIChwdXNobmV3ICp0ZXN0X3N0cnVjdHMqIHJlc3VsdCkpCisgICAgICAgICAgKHVubGVzcyAocnVuLXBhY2thZ2UtdGVzdHMgOnBhY2thZ2UgOmNvbnRhaW5lcnMpCisgICAgICAgICAgICAocHVzaG5ldyAqdGVzdF9jb250YWluZXJzKiByZXN1bHQpKQorICAgICAgICAgICh1bmxlc3MgKHJ1bi1wYWNrYWdlLXRlc3RzIDpwYWNrYWdlIDpleGNlcHRpb25zKQorICAgICAgICAgICAgKHB1c2huZXcgKnRlc3RfZXhjZXB0aW9ucyogcmVzdWx0KSkKKyAgICAgICAgICAodW5sZXNzIChydW4tcGFja2FnZS10ZXN0cyA6cGFja2FnZSA6bWlzYykKKyAgICAgICAgICAgIChwdXNobmV3ICp0ZXN0X3Vua25vd24qIHJlc3VsdCkpCisKKyAgICAgICAgICA7OyBJdCBkb2Vzbid0IHNlZW0gbGlrZSBhbnlvbmUgYWN0dWFsbHkgdXNlcworICAgICAgICAgIDs7IHRoZSBzZWNvbmQgdGVzdCBzZXJ2aWNlIHdoZW4gdGVzdGluZyBtdWx0aXBsZXhpbmcsCisgICAgICAgICAgOzsgc28gdGhpcyB3b3VsZCBmYWlsIGFnYWluc3Qgc2VydmVycyBpbiBvdGhlcgorICAgICAgICAgIDs7IGxhbmd1YWdlcy4gRm9yIG5vdywgYW55d2F5LgorICAgICAgICAgICMrKG9yKQorICAgICAgICAgICh3aGVuIG11bHRpcGxleGVkCisgICAgICAgICAgICAodW5sZXNzIChydW4tcGFja2FnZS10ZXN0cyA6cGFja2FnZSA6bXVsdGlwbGV4KQorICAgICAgICAgICAgICAocHVzaG5ldyAqdGVzdF91bmtub3duKiByZXN1bHQpKSkpCisgICAgICAoZXJyb3IgKGUpIChwdXNobmV3ICp0ZXN0X3Vua25vd24qIHJlc3VsdCkpKQorICAgIChhcHBseSAjJysgc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IgZWwxKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNhciBlbDIpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmNhbGwgY2RyLXByZWRpY2F0ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNkciBlbDEpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY2RyIGVsMikpKSkpKSkKKworKGRlZnRlc3QgbWFwLXRlc3QgKCkKKyAgKGlzIChudWxsICh0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW1hcCB0aHJpZnQtY3Jvc3M6Oipwcm90KiBuaWwpKSkKKyAgKGlzIChtYXA9ICh0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW1hcCB0aHJpZnQtY3Jvc3M6Oipwcm90KiAnKCgwIC4gMSkgKDQyIC4gLTQyKSAoNSAuIDUpKSkKKyAgICAgICAgICAgICcoKDAgLiAxKSAoNDIgLiAtNDIpICg1IC4gNSkpKSkKKyAgKGlzIChtYXA9ICh0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW1hcC1tYXAgdGhyaWZ0LWNyb3NzOjoqcHJvdCogNDIpCisgICAgICAgICAgICAnKCgtNCAuICgoLTQgLiAtNCkgKC0zIC4gLTMpICgtMiAuIC0yKSAoLTEgLiAtMSkpKQorICAgICAgICAgICAgICAoNCAuICgoMSAuIDEpICgyIC4gMikgKDMgLiAzKSAoNCAuIDQpKSkpCisgICAgICAgICAgICA6Y2RyLXByZWRpY2F0ZSAjJ21hcD0pKSkKKworKGZpYXNjbzpkZWZpbmUtdGVzdC1wYWNrYWdlICM6ZXhjZXB0aW9ucykKKworKGluLXBhY2thZ2UgIzpleGNlcHRpb25zKQorCisoZGVmdW4gdGVzdC14Y2VwdG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AgICAgICAgICAgICAgICAgICAgICAgICAgIChzdHJpbmc9ICh0aHJpZnQudGVzdDo6eHRydWN0LXN0cmluZy10aGluZworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodGhyaWZ0LnRlc3Q6OnhjZXB0aW9uMi1zdHJ1Y3QtdGhpbmcgZXgpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkLW1lc3NhZ2UpKSkpKQorCisoZGVmdGVzdCBleGNlcHRpb24tdGVzdCAoKQorICAoaXMgKHRlc3QteGNlcHRpb24gMTAwMSAiWGNlcHRpb24iICMndGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3Q6dGVzdC1leGNlcHRpb24gdGhyaWZ0LWNyb3NzOjoqcHJvdCogIlhjZXB0aW9uIikpCisgIChzaWduYWxzIHRocmlmdDphcHBsaWNhdGlvbi1lcnJvciAodGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3Q6dGVzdC1leGNlcHRpb24gdGhyaWZ0LWNyb3NzOjoqcHJvdCogIlRFeGNlcHRpb24iKSkKKyAgKGZpbmlzaGVzICh0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LWV4Y2VwdGlvbiB0aHJpZnQtY3Jvc3M6Oipwcm90KiAic3VjY2VzcyIpKSkKKworKGRlZnRlc3QgbXVsdGktZXhjZXB0aW9uLXRlc3QgKCkKKyAgKGlzICh0ZXN0LXhjZXB0aW9uIDEwMDEKKyAgICAgICAgICAgICAgICAgICAgICJUaGlzIGlzIGFuIFhjZXB0aW9uIgorICAgICAgICAgICAgICAgICAgICAgIyd0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW11bHRpLWV4Y2VwdGlvbgorICAgICAgICAgICAgICAgICAgICAgdGhyaWZ0LWNyb3NzOjoqcHJvdCoKKyAgICAgICAgICAgICAgICAgICAgICJYY2VwdGlvbiIKKyAgICAgICAgICAgICAgICAgICAgICJtZWFuaW5nbGVzcyIpKQorICAoaXMgKHRlc3QteGNlcHRpb24yIDIwMDIKKyAgICAgICAgICAgICAgICAgICAgICAiVGhpcyBpcyBhbiBYY2VwdGlvbjIiCisgICAgICAgICAgICAgICAgICAgICAgIyd0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW11bHRpLWV4Y2VwdGlvbgorICAgICAgICAgICAgICAgICAgICAgIHRocmlmdC1jcm9zczo6KnByb3QqCisgICAgICAgICAgICAgICAgICAgICAgIlhjZXB0aW9uMiIKKyAgICAgICAgICAgICAgICAgICAgICAibWVhbmluZ2xlc3MgdG9vISIpKQorICAoaXMgKHN0cmluZz0gImZvb2JhciIgKHRocmlmdC50ZXN0Onh0cnVjdC1zdHJpbmctdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAodGhyaWZ0LnRlc3QudGhyaWZ0LXRlc3Q6dGVzdC1tdWx0aS1leGNlcHRpb24gdGhyaWZ0LWNyb3NzOjoqcHJvdCoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInN1Y2Nlc3MhIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZm9vYmFyIikpKSkpCisKKyhmaWFzY286ZGVmaW5lLXRlc3QtcGFja2FnZSAjOm1pc2MpCisKKyhpbi1wYWNrYWdlICM6bWlzYykKKworKGRlZnRlc3Qgb25ld2F5LXRlc3QgKCkKKyAgKGlzIChudWxsICh0aHJpZnQudGVzdC50aHJpZnQtdGVzdDp0ZXN0LW9uZXdheSB0aHJpZnQtY3Jvc3M6Oipwcm90KiAxKSkpKQorCisoZmlhc2NvOmRlZmluZS10ZXN0LXBhY2thZ2UgIzptdWx0aXBsZXgpCisKKyhpbi1wYWNrYWdlICM6bXVsdGlwbGV4KQorCisoZGVmdGVzdCBtdWx0aXBsZXgtdGVzdCAoKQorICA7OyBSZW1vdmVkIGZyb20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KLSAge30KKyAgQ2xpZW50VGhyZWFkKHN0ZDo6c2hhcmVkX3B0cjxUVHJhbnNwb3J0PiB0cmFuc3BvcnQsCisgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8U2VydmljZUlmPiBjbGllbnQsCisgICAgICAgICAgICAgICBNb25pdG9yJiBtb25pdG9yLAorICAgICAgICAgICAgICAgc2l6ZV90JiB3b3JrZXJDb3VudCwKKyAgICAgICAgICAgICAgIHNpemVfdCBsb29wQ291bnQsCisgICAgICAgICAgICAgICBUVHlwZSBsb29wVHlwZSwKKyAgICAgICAgICAgICAgIFRyYW5zcG9ydE9wZW5DbG9zZUJlaGF2aW9yIGJlaGF2aW9yKQorICAgIDogX3RyYW5zcG9ydCh0cmFuc3BvcnQpLAorICAgICAgX2NsaWVudChjbGllbnQpLAorICAgICAgX21vbml0b3IobW9uaXRvciksCisgICAgICBfd29ya2VyQ291bnQod29ya2VyQ291bnQpLAorICAgICAgX2xvb3BDb3VudChsb29wQ291bnQpLAorICAgICAgX2xvb3BUeXBlKGxvb3BUeXBlKSwKKyAgICAgIF9iZWhhdmlvcihiZWhhdmlvcikge30KIAogICB2b2lkIHJ1bigpIHsKIAogICAgIC8vIFdhaXQgZm9yIGFsbCB3b3JrZXIgdGhyZWFkcyB0byBzdGFydAogCi0gICAge1N5bmNocm9uaXplZCBzKF9tb25pdG9yKTsKLSAgICAgIHdoaWxlKF93b3JrZXJDb3VudCA9PSAwKSB7CisgICAgeworICAgICAgU3luY2hyb25pemVkIHMoX21vbml0b3IpOworICAgICAgd2hpbGUgKF93b3JrZXJDb3VudCA9PSAwKSB7CiAgICAgICAgIF9tb25pdG9yLndhaXQoKTsKICAgICAgIH0KICAgICB9CiAKICAgICBfc3RhcnRUaW1lID0gVXRpbDo6Y3VycmVudFRpbWUoKTsKKyAgICBpZihfYmVoYXZpb3IgPT0gT3BlbkFuZENsb3NlVHJhbnNwb3J0SW5UaHJlYWQpIHsKKyAgICAgIF90cmFuc3Bvcn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iZWhhdmlvciA9PSBPcGVuQW5kQ2xvc2VUcmFuc3BvcnRJblRocmVhZCkgeworICAgICAgX3RyYW5zcG9ydC0+Y2xvc2UoKTsKKyAgICB9CiAKICAgICBfZG9uZSA9IHRydWU7CiAKLSAgICB7U3luY2hyb25pemVkIHMoX21vbml0b3IpOworICAgIHsKKyAgICAgIFN5bmNocm9uaXplZCBzKF9tb25pdG9yKTsKIAogICAgICAgX3dvcmtlckNvdW50LS07CiAKQEAgLTE2OCw3ICsxODksOCBAQAogICAgIGZvciAoc2l6ZV90IGl4ID0gMDsgaXggPCBfbG9vcENvdW50OyBpeCsrKSB7CiAgICAgICBpbnQ4X3QgYXJnID0gMTsKICAgICAgIGludDhfdCByZXN1bHQ7Ci0gICAgICByZXN1bHQgPV9jbGllbnQtPmVjaG9CeXRlKGFyZyk7CisgICAgICByZXN1bHQgPSBfY2xpZW50LT5lY2hvQnl0ZShhcmcpOworICAgICAgKHZvaWQpcmVzdWx0OwogICAgICAgYXNzZXJ0KHJlc3VsdCA9PSBhcmcpOwogICAgIH0KICAgfQpAQCAtMTc3LDcgKzE5OSw4IEBACiAgICAgZm9yIChzaXplX3QgaXggPSAwOyBpeCA8IF9sb29wQ291bnQ7IGl4KyspIHsKICAgICAgIGludDMyX3QgYXJnID0gMTsKICAgICAgIGludDMyX3QgcmVzdWx0OwotICAgICAgcmVzdWx0ID1fY2xpZW50LT5lY2hvSTMyKGFyZyk7CisgICAgICByZXN1bHQgPSBfY2xpZW50LT5lY2hvSTMyKGFyZyk7CisgICAgICAodm9pZClyZXN1bHQ7CiAgICAgICBhc3NlcnQocmVzdWx0ID09IGFyZyk7CiAgICAgfQogICB9CkBAIC0xODYsNyArMjA5LDggQEAKICAgICBmb3IgKHNpemVfdCBpeCA9IDA7IGl4IDwgX2xvb3BDb3VudDsgaXgrKykgewogICAgICAgaW50NjRfdCBhcmcgPSAxOwogICAgICAgaW50NjRfdCByZXN1bHQ7Ci0gICAgICByZXN1bHQgPV9jbGllbn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eworICAgIGlmIChhcmcuY29tcGFyZSgwLCAyLCAiLS0iKSA9PSAwKSB7CiAKICAgICAgIHNpemVfdCBlbmQgPSBhcmcuZmluZF9maXJzdF9vZigiPSIsIDIpOwogCkBAIC0yNjMsNyArMzE2LDcgQEAKICAgICAgICAgYXJnc1trZXldID0gInRydWUiOwogICAgICAgfQogICAgIH0gZWxzZSB7Ci0gICAgICB0aHJvdyBpbnZhbGlkX2FyZ3VtZW50KCJVbmV4Y2VwdGVkIGNvbW1hbmQgbGluZSB0b2tlbjogIithcmcpOworICAgICAgdGhyb3cgaW52YWxpZF9hcmd1bWVudCgiVW5leGNlcHRlZCBjb21tYW5kIGxpbmUgdG9rZW46ICIgKyBhcmcpOwogICAgIH0KICAgfQogCkBAIC0zMTMsMTQ1ICszNjYsMTg5IEBACiAKICAgICAgIH0gZWxzZSB7CiAKLSAgICAgICAgdGhyb3cgaW52YWxpZF9hcmd1bWVudCgiVW5rbm93biBzZXJ2ZXIgdHlwZSAiK3NlcnZlclR5cGUpOworICAgICAgICB0aHJvdyBpbnZhbGlkX2FyZ3VtZW50KCJVbmtub3duIHNlcnZlciB0eXBlICIgKyBzZXJ2ZXJUeXBlKTsKICAgICAgIH0KICAgICB9CisgICAgaWYgKCFhcmdzWyJjbGllbnQtdHlwZSJdLmVtcHR5KCkpIHsKKyAgICAgIGNsaWVudFR5cGUgPSBhcmdzWyJjbGllbnQtdHlwZSJdOwogCisgICAgICBpZiAoY2xpZW50VHlwZSA9PSAicmVndWxhciIpIHsKKworICAgICAgfSBlbHNlIGlmIChjbGllbnRUeXBlID09ICJjb25jdXJyZW50IikgeworCisgICAgICB9IGVsc2UgeworCisgICAgICAgIHRocm93IGludmFsaWRfYXJndW1lbnQoIlVua25vd24gY2xpZW50IHR5cGUgIiArIGNsaWVudFR5cGUpOworICAgICAgfQorICAgIH0KICAgICBpZiAoIWFyZ3NbIndvcmtlcnMiXS5lbXB0eSgpKSB7CiAgICAgICB3b3JrZXJDb3VudCA9IGF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pZW50PiBjbGllbnQsCisgICAgICAgICAgICAgICBNb25pdG9yJiBtb25pdG9yLAorICAgICAgICAgICAgICAgc2l6ZV90JiB3b3JrZXJDb3VudCwKKyAgICAgICAgICAgICAgIHNpemVfdCBsb29wQ291bnQsCisgICAgICAgICAgICAgICBUVHlwZSBsb29wVHlwZSkKKyAgICA6IF90cmFuc3BvcnQodHJhbnNwb3J0KSwKKyAgICAgIF9jbGllbnQoY2xpZW50KSwKKyAgICAgIF9tb25pdG9yKG1vbml0b3IpLAorICAgICAgX3dvcmtlckNvdW50KHdvcmtlckNvdW50KSwKKyAgICAgIF9sb29wQ291bnQobG9vcENvdW50KSwKKyAgICAgIF9sb29wVHlwZShsb29wVHlwZSkge30KIAogICB2b2lkIHJ1bigpIHsKIAogICAgIC8vIFdhaXQgZm9yIGFsbCB3b3JrZXIgdGhyZWFkcyB0byBzdGFydAogCi0gICAge1N5bmNocm9uaXplZCBzKF9tb25pdG9yKTsKLSAgICAgICAgd2hpbGUoX3dvcmtlckNvdW50ID09IDApIHsKLSAgICAgICAgICBfbW9uaXRvci53YWl0KCk7Ci0gICAgICAgIH0KKyAgICB7CisgICAgICBTeW5jaHJvbml6ZWQgcyhfbW9uaXRvcik7CisgICAgICB3aGlsZSAoX3dvcmtlckNvdW50ID09IDApIHsKKyAgICAgICAgX21vbml0b3Iud2FpdCgpOworICAgICAgfQogICAgIH0KIAogICAgIF9zdGFydFRpbWUgPSBVdGlsOjpjdXJyZW50VGltZSgpOwogCiAgICAgX3RyYW5zcG9ydC0+b3BlbigpOwogCi0gICAgc3dpdGNoKF9sb29wVHlwZSkgewotICAgIGNhc2UgVF9WT0lEOiBsb29wRWNob1ZvaWQoKTsgYnJlYWs7Ci0gICAgY2FzZSBUX0JZVEU6IGxvb3BFY2hvQnl0ZSgpOyBicmVhazsKLSAgICBjYXNlIFRfSTMyOiBsb29wRWNob0kzMigpOyBicmVhazsKLSAgICBjYXNlIFRfSTY0OiBsb29wRWNob0k2NCgpOyBicmVhazsKLSAgICBjYXNlIFRfU1RSSU5HOiBsb29wRWNob1N0cmluZygpOyBicmVhazsKLSAgICBkZWZhdWx0OiBjZXJyIDw8ICJVbmV4cGVjdGVkIGxvb3AgdHlwZSIgPDwgX2xvb3BUeXBlIDw8IGVuZGw7IGJyZWFrOworICAgIHN3aXRjaCAoX2xvb3BUeXBlKSB7CisgICAgY2FzZSBUX1ZPSUQ6CisgICAgICBsb29wRWNob1ZvaWQoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVF9CWVRFOgorICAgICAgbG9vcEVjaG9CeXRlKCk7CisgICAgICBicmVhazsKKyAgICBjYXNlIFRfSTMyOgorICAgICAgbG9vcEVjaG9JMzIoKTsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgVF9JNjQ6CisgICAgICBsb29wRWNob0k2NCgpOworICAgICAgYnJlYWs7CisgICAgY2FzZSBUX1NUUklORzoKKyAgICAgIGxvb3BFY2hvU3RyaW5nKCk7CisgICAgICBicmVhazsKKyAgICBkZWZhdWx0OgorICAgICAgY2VyciA8PCAiVW5leHBlY3RlZCBsb29wIHR5cGUiIDw8IF9sb29wVHlwZSA8PCBlbmRsOworICAgICAgYnJlYWs7CiAgICAgfQogCiAgICAgX2VuZFRpbWUgPSBVdGlsOjpjdXJyZW50VGltZSgpOwpAQCAtMTUzLDcgKzE2Myw4IEBACiAKICAgICBfZG9uZSA9IHRydWU7CiAKLSAgICB7U3luY2hyb25pemVkIHMoX21vbml0b3IpOworICAgIHsKKyAgICAgIFN5bmNocm9uaXplZCBzKF9tb25pdG9yKTsKIAogICAgICAgX3dvcmtlckNvdW50LS07CiAKQEAgLTE3NCw3ICsxODUsOCBAQAogICAgIGZvciAoc2l6ZV90IGl4ID0gMDsgaXggPCBfbG9vcENvdW50OyBpeCsrKSB7CiAgICAgICBpbnQ4X3QgYXJnID0gMTsKICAgICAgIGludDhfdCByZXN1bHQ7Ci0gICAgICByZXN1bHQgPV9jbGllbnQtPmVjaG9CeXRlKGFy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zOworICAgICAgb3MgPDwgInRlc3QiIDw8IHRlc3ROcjsKKyAgICAgIGNsaWVudC0+dGVzdFN0cmluZyhzdGQ6OmJpbmQodGVzdFN0cmluZ19jbGllbnRSZXR1cm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVzdE5yLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpwbGFjZWhvbGRlcnM6Ol8xKSwKKyAgICAgICAgICAgICAgICAgICAgICAgb3Muc3RyKCkpOworICAgIH0KICAgfSBjYXRjaCAoVEV4Y2VwdGlvbiYgZXhuKSB7Ci0gICAgY291dCA8PCAiRXJyb3I6ICIgPDwgZXhuLndoYXQoKSA8PCBlbmRsOyAgICAKKyAgICBjb3V0IDw8ICJFcnJvcjogIiA8PCBleG4ud2hhdCgpIDw8IGVuZGw7CiAgIH0KIH0KIAorLy8gV29ya2Fyb3VuZCBmb3IgYWJzZW5zZSBvZiBDKysxMSAiYXV0byIga2V5d29yZC4KK3RlbXBsYXRlIDx0eXBlbmFtZSBUPgorYm9vbCBwcmludF9lcShUIGV4cGVjdGVkLCBUIGFjdHVhbCkgeworICBjb3V0IDw8ICIoIiA8PCBhY3R1YWwgPDwgIikiIDw8IGVuZGw7CisgIGlmIChleHBlY3RlZCAhPSBhY3R1YWwpIHsKKyAgICBjb3V0IDw8ICIqKiogRkFJTEVEICoqKiIgPDwgZW5kbCA8PCAiRXhwZWN0ZWQ6ICIgPDwgZXhwZWN0ZWQgPDwgIiBidXQgZ290OiAiIDw8IGFjdHVhbCA8PCBlbmRsOworICAgIHJldHVybiBmYWxzZTsKKyAgfQorICByZXR1cm4gdHJ1ZTsKK30KKworI2RlZmluZSBCQVNFVFlQRV9JREVOVElUWV9URVNUKGZ1bmMsIHZhbHVlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBjb3V0IDw8ICNmdW5jICIoIiA8PCB2YWx1ZSA8PCAiKSA9ICI7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB0cnkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmICghcHJpbnRfZXEodmFsdWUsIHRlc3RDbGllbnQuZnVuYyh2YWx1ZSkpKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX0JBU0VUWVBFUzsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9IGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uJikgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHRocm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9IGNhdGNoIChleGNlcHRpb24gJiBleCkgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsIDw8IGV4LndoYXQoKSA8PCBlbmRsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHJldHVybl9jb2RlIHw9IEVSUl9CQVNFVFlQRVM7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9CisKK2ludCBiaW5hcnlfdGVz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AgICAgdGVzdENsaWVudC50ZXN0Vm9pZCgpOwotICAgICAgcHJpbnRmKCIgPSB2b2lkXG4iKTsKLSAgICB9IGNhdGNoIChUQXBwbGljYXRpb25FeGNlcHRpb24mIHRheCkgewotICAgICAgcHJpbnRmKCIlc1xuIiwgdGF4LndoYXQoKSk7Ci0gICAgICBmYWlsQ291bnQrKzsKKyAgICAgIGNvdXQgPDwgIiA9IHZvaWQiIDw8IGVuZGw7CisgICAgfSBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiYpIHsKKyAgICAgIC8vIFN0b3AgaGVyZSBpZiB0cmFuc3BvcnQgZ290IGJyb2tlbgorICAgICAgdGhyb3c7CisgICAgfSBjYXRjaCAoZXhjZXB0aW9uJiBleCkgeworICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGwgPDwgZXgud2hhdCgpIDw8IGVuZGw7CisgICAgICByZXR1cm5fY29kZSB8PSBFUlJfQkFTRVRZUEVTOwogICAgIH0KIAogICAgIC8qKgogICAgICAqIFNUUklORyBURVNUCiAgICAgICovCi0gICAgcHJpbnRmKCJ0ZXN0U3RyaW5nKFwiVGVzdFwiKSIpOworICAgIGNvdXQgPDwgInRlc3RTdHJpbmcoXCJUZXN0XCIpIiA8PCBmbHVzaDsKICAgICBzdHJpbmcgczsKICAgICB0ZXN0Q2xpZW50LnRlc3RTdHJpbmcocywgIlRlc3QiKTsKLSAgICBwcmludGYoIiA9IFwiJXNcIlxuIiwgcy5jX3N0cigpKTsKLSAgICBpZiAocyAhPSAiVGVzdCIpCi0gICAgICAgIGZhaWxDb3VudCsrOworICAgIGNvdXQgPDwgIiA9ICIgPDwgcyA8PCBlbmRsOworICAgIGlmIChzICE9ICJUZXN0IikgeworICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGw7CisgICAgICByZXR1cm5fY29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgIH0KKworICAgIC8vCisgICAgLy8gTXVsd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KyAgICAgICAgY291dC5pbWJ1ZShsb2NhbGUoImVuX1VTLlVURjgiKSk7CisgICAgICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsCisgICAgICAgICAgICAgPDwgIkV4cGVjdGVkIHN0cmluZzogIiA8PCBzdHIgPDwgIiBidXQgZ290OiAiIDw8IHMgPDwgZW5kbAorICAgICAgICAgICAgIDw8ICJDTEVBUiI7CisgICAgICAgIDsKKyAgICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX0JBU0VUWVBFUzsKKyAgICAgIH0KKyAgICB9IGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uJikgeworICAgICAgdGhyb3c7CisgICAgfSBjYXRjaCAoZXhjZXB0aW9uJiBleCkgeworICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGwgPDwgZXgud2hhdCgpIDw8IGVuZGw7CisgICAgICByZXR1cm5fY29kZSB8PSBFUlJfQkFTRVRZUEVTOworICAgICAgcmV0dXJuIHJldHVybl9jb2RlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEJPT0wgVEVTVAorICAgICAqLworICAgIGNvdXQgPDwgYm9vbGFscGhhOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEJvb2wsIHRydWUpOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEJvb2wsIGZhbHNlKTsKIAogICAgIC8qKgogICAgICAqIEJZVEUgVEVTVAogICAgICAqLwotICAgIHByaW50ZigidGVzdEJ5dGUoMSkiKTsKLSAgICB1aW50OF90IHU4ID0gdGVzdENsaWVudC50ZXN0Qnl0ZSgxKTsKLSAgICBwcmludGYoIiA9ICVkXG4iLCAoaW50KXU4KTsKLSAgICBpZiAodTggIT0gMSkKLSAgICAgICAgZmFpbENvdW50Kys7CisgICAgQkFTRVRZUEVfSURFTlRJVFlfVEVTVCh0ZXN0Qnl0ZSwgKGludDhfdCkwKTsKKyAgICBCQVNFVFlQRV9JREVOVElUWV9URVNUKHRlc3RCeXRlLCAoaW50OF90KS0xKTsKKyAgICBCQVNFVFlQRV9JREVOVElUWV9URVNUKHRlc3RCeXRlLCAoaW50OF90KTQyKTsKKyAgICBCQVNFVFlQRV9JREVOVElUWV9URVNUKHRlc3RCeXRlLCAoaW50OF90KS00Mik7CisgICAgQkFTRVRZUEVfSURFTlRJVFlfVEVTVCh0ZXN0Qnl0ZSwgKGludDhfdCkxMjcpOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEJ5dGUsIChpbnQ4X3QpLTEyOCk7CiAKICAgICAvKioKICAgICAgKiBJMzIgVEVTVAogICAgICAqLwotICAgIHByaW50ZigidGVzdEkzMigtMSkiKTsKLSAgICBpbnQzMl90IGkzMiA9IHRlc3RDbGllbnQudGVzdEkzMigtMSk7Ci0gICAgcHJpbnRmKCIgPSAlZFxuIiwgaTMyKTsKLSAgICBpZiAoaTMyICE9IC0xKQotICAgICAgICBmYWlsQ291bnQrKzsKKyAgICBCQVNFVFlQRV9JREVOVElUWV9URVNUKHRlc3RJMzIsIDApOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEkzMiwgLTEpOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEkzMiwgMTkwMDAwMDEzKTsKKyAgICBCQVNFVFlQRV9JREVOVElUWV9URVNUKHRlc3RJMzIsIC0xOTAwMDAwMTMpOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEkzMiwgKG51bWVyaWNfbGltaXRzPGludDMyX3Q+OjptYXgpKCkpOworICAgIEJBU0VUWVBFX0lERU5USVRZX1RFU1QodGVzdEkzMiwgKG51bWVyaWNfbGltaXRzPGludDMyX3Q+OjptaW4pKCkpOwogCiAgICAgLyoqCiAgICAgICogSTY0IFRFU1QKICAgICAgKi8KLSAgICBwcmludGYoInRlc3RJNjQoLTM0MzU5NzM4MzY4KSIpOwotICAgIGludDY0X3QgaTY0ID0gdGVzd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mi5ieXRlX3RoaW5nID0gMTsKICAgICBvdXQyLnN0cnVjdF90aGluZyA9IG91dDsKQEAgLTMyNyw1NSArNjIwLDg1IEBACiAgICAgWHRydWN0MiBpbjI7CiAgICAgdGVzdENsaWVudC50ZXN0TmVzdChpbjIsIG91dDIpOwogICAgIGluID0gaW4yLnN0cnVjdF90aGluZzsKLSAgICBwcmludGYoIiA9IHslZCwge1wiJXNcIiwgJWQsICVkLCAlIlBSSWQ2NCJ9LCAlZH1cbiIsCisgICAgcHJpbnRmKCIgPSB7JWQsIHtcIiVzXCIsICVkLCAlZCwgJSIgUFJJZDY0ICJ9LCAlZH1cbiIsCiAgICAgICAgICAgIGluMi5ieXRlX3RoaW5nLAogICAgICAgICAgICBpbi5zdHJpbmdfdGhpbmcuY19zdHIoKSwKICAgICAgICAgICAgKGludClpbi5ieXRlX3RoaW5nLAogICAgICAgICAgICBpbi5pMzJfdGhpbmcsCiAgICAgICAgICAgIGluLmk2NF90aGluZywKICAgICAgICAgICAgaW4yLmkzMl90aGluZyk7Ci0gICAgaWYgKGluMiAhPSBvdXQyKQotICAgIAlmYWlsQ291bnQrKzsKKyAgICBpZiAoaW4yICE9IG91dDIpIHsKKyAgICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsOworICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX1NUUlVDVFM7CisgICAgfQogCiAgICAgLyoqCiAgICAgICogTUFQIFRFU1QKICAgICAgKi8KLSAgICBtYXA8aW50MzJfdCxpbnQzMl90PiBtYXBvdXQ7CisgICAgbWFwPGludDMyX3QsIGludDMyX3Q+IG1hcG91dDsKICAgICBmb3IgKGludDMyX3QgaSA9IDA7IGkgPCA1OyArK2kpIHsKLSAgICAgIG1hcG91dC5pbnNlcnQobWFrZV9wYWlyKGksIGktMTApKTsKKyAgICAgIG1hcG91dC5pbnNlcnQobWFrZV9wYWlyKGksIGkgLSAxMCkpOwogICAgIH0KLSAgICBwcmludGYoInRlc3RNYXAoeyIpOworICAgIGNvdXQgPDwgInRlc3RNYXAoeyIgPDwgZmx1c2g7CiAgICAgbWFwPGludDMyX3QsIGludDMyX3Q+Ojpjb25zdF9pdGVyYXRvciBtX2l0ZXI7CiAgICAgYm9vbCBmaXJzdCA9IHRydWU7CiAgICAgZm9yIChtX2l0ZXIgPSBtYXBvdXQuYmVnaW4oKTsgbV9pdGVyICE9IG1hcG91dC5lbmQoKTsgKyttX2l0ZXIpIHsKICAgICAgIGlmIChmaXJzdCkgewogICAgICAgICBmaXJzdCA9IGZhbHNlOwogICAgICAgfSBlbHNlIHsKLSAgICAgICAgcHJpbnRmKCIsICIpOworICAgICAgICBjb3V0IDw8ICIsIjsKICAgICAgIH0KLSAgICAgIHByaW50ZigiJWQgPT4gJWQiLCBtX2l0ZXItPmZpcnN0LCBtX2l0ZXItPnNlY29uZCk7CisgICAgICBjb3V0IDw8IG1faXRlci0+Zmlyc3QgPDwgIiA9PiAiIDw8IG1faXRlci0+c2Vjb25kOwogICAgIH0KLSAgICBwcmludGYoIn0pIik7Ci0gICAgbWFwPGludDMyX3QsaW50MzJfdD4gbWFwaW47CisgICAgY291dCA8PCAifSkiOworICAgIG1hcDxpbnQzMl90LCBpbnQzMl90PiBtYXBpbjsKICAgICB0ZXN0Q2xpZW50LnRlc3RNYXAobWFwaW4sIG1hcG91dCk7Ci0gICAgcHJpbnRmKCIgPSB7Iik7CisgICAgY291dCA8PCAiID0geyI7CiAgICAgZmlyc3QgPSB0cnVlOwogICAgIGZvciAobV9pdGVyID0gbWFwaW4uYmVnaW4oKTsgbV9pdGVyICE9IG1hcGluLmVuZCgpOyArK21faXRlcikgewogICAgICAgaWYgKGZpcnN0KSB7CiAgICAgICAgIGZpcnN0ID0gZmFsc2U7CiAgICAgICB9IGVsc2UgewotICAgICAgICBwcmludGYoIiwgIik7CisgICAgICAgIGNvdXQgPDwgIiwiOwogICAgICAgfQotICAgICAgcHJpbnRmKCIlZCA9PiAlZCIsIG1faXRlci0+Zmlyc3QsIG1faXRlci0+c2Vjb25kKTsKKyAgICAgIGNvdXQgPDwgbV9pdGVyLT5maXJzdCA8PCAiID0+ICIgPDwgbV9pdGVyLT5zZWNvbmQ7CiAgICAgfQotICAgIHByaW50ZigifVxuIik7Ci0gICAgaWYgKG1hcGluICE9IG1hcG91dCkKLSAgICAJZmFpbENvdW50Kys7CisgICAgY291dCA8PCAifSIgPDwgZW5kbDsKKyAgICBpZiAobWFwaW4gIT0gbWFwb3V0KSB7CisgICAgICBjb3V0IDw8ICIqKiogRkFJTEVEICoqKiIgPDwgZW5kbDsKKyAgICAgIHJldHVybl9jb2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgIH0KIAogICAgIC8qKgogICAgICAqIFNUUklORyBNQVAgVEVTVAotICAgICAqICBtaXNzaW5nCiAgICAgICovCisgICAgY291dCA8PCAidGVzdFN0cmluZ01hcCh7YSA9PiAyLCBiID0+IGJsYWgsIHNvbWUgPT4gdGhpbmd9KSA9IHsiIDw8IGZsdXNoOworICAgIG1hcDxzdHJpbmcsIHN0cmluZz4gc21hcGluOworICAgIG1hcDxzdHJpbmcsIHN0cmluZz4gc21hcG91dDsKKyAgICBzbWFwaW5bImEiXSA9ICIyIjsKKyAgICBzbWFwaW5bImIiXSA9ICJibGFoIjsKKyAgICBzbWFwaW5bInNvbWUiXSA9ICJ0aGluZyI7CisgICAgdHJ5IHsKKyAgICAgIHRlc3RDbGllbnQudGVzdFN0cmluZ01hcChzbWFwb3V0LCBzbWFwaW4pOworICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgZm9yIChtYXA8c3RyaW5nLCBzdHJpbmc+Ojpjb25zdF9pdGVyYXRvciBpdCA9IHNtYXBvdXQuYmVnaW4oKTsgaXQgIT0gc21hcG91dC5lbmQoKTsgKytpdCkgeworICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgY291dCA8PCAiLCI7CisgICAgICAgIGVsc2UKKyAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICBjb3V0IDw8IGl0LT5maXJzdCA8PCAiID0+ICIgPDwgaXQtPnNlY29uZDsKKyAgICAgIH0KKyAgICAgIGNvdXQgPDwgIn0iIDw8IGVuZGw7CisgICAgICBpZiAoc21hcGluICE9IHNtYXBvdXQpIHsKKyAgICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGw7CisgICAgICAgIHJldHVybl9jb2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgICAgfQorICAgIH0gY2F0Y2ggKFRUcmFuc3BvcnRFeGNlcHRpb24mKSB7CisgICAgICB0aHJvdzsKKyAgICB9IGNhdGNoIChleGNlcHRpb24mIGV4KSB7CisgICAgICBjb3V0IDw8ICIqKiogRkFJTEVEICoqKiIgPDwgZW5kbCA8PCBleC53aGF0KCkgPDwgZW5kbDsKKyAgICAgIHJldHVybl9jb2RlIHw9IEVSUl9DT05UQUlORVJTOworICAgIH0KIAogICAgIC8qKgogICAgICAqIFNFVCBURVNUCkBAIC0zODQsMjU0ICs3MDcsMzY3IEBACiAgICAgZm9yIChpbnQzMl90IGkgPSAtMjsgaSA8IDM7ICsraSkgewogICAgICAgc2V0b3V0Lmluc2VydChpKTsKICAgICB9Ci0gICAgcHJpbnRmKCJ0ZXN0U2V0KHsiKTsKKyAgICBjb3V0IDw8ICJ0ZXN0U2V0KHsiIDw8IGZsdXNoOwogICAgIHNldDxpbnQzMl90Pjo6Y29uc3RfaXRlcmF0b3Igc19pdGVyOwogICAgIGZpcnN0ID0gdHJ1ZTsKICAgICBmb3IgKHNfaXRlciA9IHNldG91dC5iZWdpbigpOyBzX2l0ZXIgIT0gc2V0b3V0LmVuZCgpOyArK3NfaXRlcikgewogICAgICAgaWYgKGZpcnN0KSB7CiAgICAgICAgIGZpcnN0ID0gZmFsc2U7CiAgICAgICB9IGVsc2UgewotICAgICAgICBwcmludGYoIiwgIik7CisgICAgICAgIGNvdXQgPDwgIiwiOwogICAgICAgfQotICAgICAgcHJpbnRmKCIlZCIsICpzX2l0ZXIpOworICAgICAgY291dCA8PCAqc19pdGVyOwogICAgIH0KLSAgICBwcmludGYoIn0pIik7CisgICAgY291dCA8PCAifSkiOwogICAgIHNldDxpbnQzMl90PiBzZXRpbjsKICAgICB0ZXN0Q2xpZW50LnRlc3RTZXQoc2V0aW4sIHNldG91dCk7Ci0gICAgcHJpbnRmKCIgPSB7Iik7CisgICAgY291dCA8PCAiID0geyI7CiAgICAgZmlyc3QgPSB0cnVlOwogICAgIGZvciAoc19pdGVyID0gc2V0aW4uYmVnaW4oKTsgc19pdGVyICE9IHNldGluLmVuZCgpOyArK3NfaXRlcikgewogICAgICAgaWYgKGZpcnN0KSB7CiAgICAgICAgIGZpcnN0ID0gZmFsc2U7CiAgICAgICB9IGVsc2UgewotICAgICAgICBwcmludGYoIiwgIik7CisgICAgICAgIGNvdXQgPDwgIiwiOwogICAgICAgfQotICAgICAgcHJpbnRmKCIlZCIsICpzX2l0ZXIpOworICAgICAgY291dCA8PCAqc19pdGVyOwogICAgIH0KLSAgICBwcmludGYoIn1cbiIpOwotICAgIGlmIChzZXRpbiAhPSBzZXRvdXQpCi0gICAgCWZhaWxDb3VudCsrOworICAgIGNvdXQgPDwgIn0iIDw8IGVuZGw7CisgICAgaWYgKHNldGluICE9IHNldG91dCkgeworICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGw7CisgICAgICByZXR1cm5fY29kZSB8PSBFUlJfQ09OVEFJTkVSUzsKKyAgICB9CiAKICAgICAvKioKICAgICAgKiBMSVNUIFRFU1QKICAgICAgKi8KLSAgICB2ZWN0b3I8aW50MzJfdD4gbGlzdG91dDsKLSAgICBmb3IgKGludDMyX3QgaSA9IC0yOyBpIDwgMzsgKytpKSB7Ci0gICAgICBsaXN0b3V0LnB1c2hfYmFjayhpKTsKLSAgICB9Ci0gICAgcHJpbnRmKCJ0ZXN0TGlzdCh7Iik7Ci0gICAgdmVjdG9yPGludDMyX3Q+Ojpjb25zdF9pdGVyYXRvciBsX2l0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N0aW4uZW5kKCk7ICsrbF9pdGVyKSB7CisgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgY291dCA8PCAiLCI7CisgICAgICAgIH0KKyAgICAgICAgY291dCA8PCAqbF9pdGVyOworICAgICAgfQorICAgICAgY291dCA8PCAifSIgPDwgZW5kbDsKKyAgICAgIGlmIChsaXN0aW4gIT0gbGlzdG91dCkgeworICAgICAgICBjb3V0IDw8ICIqKiogRkFJTEVEICoqKiIgPDwgZW5kbDsKKyAgICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX0NPTlRBSU5FUlM7CisgICAgICB9CisgICAgfSBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiYpIHsKKyAgICAgIHRocm93OworICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbiYgZXgpIHsKKyAgICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsIDw8IGV4LndoYXQoKSA8PCBlbmRsOworICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX0NPTlRBSU5FUlM7CiAgICAgfQotICAgIHByaW50ZigifVxuIik7Ci0gICAgaWYgKGxpc3RpbiAhPSBsaXN0b3V0KQotICAgIAlmYWlsQ291bnQrKzsKIAogICAgIC8qKgogICAgICAqIEVOVU0gVEVTVAogICAgICAqLwotICAgIHByaW50ZigidGVzdEVudW0oT05FKSIpOworICAgIGNvdXQgPDwgInRlc3RFbnVtKE9ORSkiIDw8IGZsdXNoOwogICAgIE51bWJlcno6OnR5cGUgcmV0ID0gdGVzdENsaWVudC50ZXN0RW51bShOdW1iZXJ6OjpPTkUpOwotICAgIHByaW50ZigiID0gJWRcbiIsIHJldCk7Ci0gICAgaWYgKHJldCAhPSBOdW1iZXJ6OjpPTkUpCi0gICAgCWZhaWxDb3VudCsrOworICAgIGNvdXQgPDwgIiA9ICIgPDwgcmV0IDw8IGVuZGw7CisgIC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JJZDY0In0sICIsCi0gICAgICAgICAgICAgICAgIHgtPnN0cmluZ190aGluZy5jX3N0cigpLAotICAgICAgICAgICAgICAgICAoaW50KXgtPmJ5dGVfdGhpbmcsCi0gICAgICAgICAgICAgICAgIHgtPmkzMl90aGluZywKLSAgICAgICAgICAgICAgICAgeC0+aTY0X3RoaW5nKTsKLSAgICAgICAgfQotICAgICAgICBwcmludGYoIn0iKTsKKyAgICAgICAgICB2ZWN0b3I8WHRydWN0PiB4dHJ1Y3RzID0gaTJfaXRlci0+c2Vjb25kLnh0cnVjdHM7CisgICAgICAgICAgdmVjdG9yPFh0cnVjdD46OmNvbnN0X2l0ZXJhdG9yIHg7CisgICAgICAgICAgY291dCA8PCAieyI7CisgICAgICAgICAgZm9yICh4ID0geHRydWN0cy5iZWdpbigpOyB4ICE9IHh0cnVjdHMuZW5kKCk7ICsreCkgeworICAgICAgICAgICAgcHJpbnRmKCJ7XCIlc1wiLCAlZCwgJWQsICUiIFBSSWQ2NCAifSwgIiwKKyAgICAgICAgICAgICAgICAgICB4LT5zdHJpbmdfdGhpbmcuY19zdHIoKSwKKyAgICAgICAgICAgICAgICAgICAoaW50KXgtPmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgeC0+aTMyX3RoaW5nLAorICAgICAgICAgICAgICAgICAgIHgtPmk2NF90aGluZyk7CisgICAgICAgICAgfQorICAgICAgICAgIGNvdXQgPDwgIn0iOwogCi0gICAgICAgIHByaW50ZigifSwgIik7CisgICAgICAgICAgY291dCA8PCAifSwgIjsKKyAgICAgICAgfQorICAgICAgICBjb3V0IDw8ICJ9LCAiOwogICAgICAgfQotICAgICAgcHJpbnRmKCJ9LCAiKTsKKyAgICAgIGNvdXQgPDwgIn0iIDw8IGVuZGw7CisgICAgICBib29sIGZhaWxlZCA9IGZhbHNlOworICAgICAgbWFwPFVzZXJJZCwgbWFwPE51bWJlcno6OnR5cGUsIEluc2FuaXR5PiA+Ojpjb25zdF9pdGVyYXRvciBpdDEgP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AgICAgIGlmIChpdDI2ID09IGl0Mi0+c2Vjb25kLmVuZCgpIHx8IGl0MjYtPnNlY29uZCAhPSBJbnNhbml0eSgpKSB7CisgICAgICAgICAgZmFpbGVkID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgfQorICAgICAgaWYgKGZhaWxlZCkgeworICAgICAgICBjb3V0IDw8ICIqKiogRkFJTEVEICoqKiIgPDwgZW5kbDsKKyAgICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX1NUUlVDVFM7CisgICAgICB9CiAgICAgfQotICAgIHByaW50ZigifVxuIik7CisKKyAgICAvKioKKyAgICAgKiBNVUxUSSBURVNUCisgICAgICovCisgICAgY291dCA8PCAidGVzdE11bHRpKCkiIDw8IGVuZGw7CisgICAgdHJ5IHsKKyAgICAgIG1hcDxpbnQxNl90LCBzdHJpbmc+IG11bF9tYXA7CisgICAgICBYdHJ1Y3QgbXVsX3Jlc3VsdDsKKyAgICAgIG11bF9tYXBbMV0gPSAiYmxhaCI7CisgICAgICBtdWxfbWFwWzJdID0gInRoaW5nIjsKKyAgICAgIHRlc3RDbGllbnQudGVzdE11bHRpKG11bF9yZXN1bHQsIDQyLCA0MjQyLCA0MjQyNDIsIG11bF9tYXAsIE51bWJlcno6OkVJR0hULCBVc2VySWQoMjQpKTsKKyAgICAgIFh0cnVjdCB4eHM7CisgICAgICB4eHMuc3RyaW5nX3RoaW5nID0gIkhlbGxvMiI7CisgICAgICB4eHMuYnl0ZV90aGluZyA9IDQyOworICAgICAgeHhzLmkzMl90aGluZyA9IDQyNDI7CisgICAgICB4eHMuaTY0X3RoaW5nID0gNDI0MjQyOworICAgICAgaWYgKG11bF9yZXN1bHQgIT0geHhzKSB7CisgICAgICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsOworICAgICAgICByZXR1cm5fY29kZSB8PSBFUlJfU1RSVUNUUzsKKyAgICAgIH0KKyAgICB9IGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9u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NvdXQgPDwgInRlc3RDbGllbnQudGVzdEV4Y2VwdGlvbihcIlRFeGNlcHRpb25cIikgPT4iIDw8IGZsdXNoOworICAgICAgdGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKCJURXhjZXB0aW9uIik7CisgICAgICBjb3V0IDw8ICIgIHZvaWRcbioqKiBGQUlMRUQgKioqIiA8PCBlbmRsOworICAgICAgcmV0dXJuX2NvZGUgfD0gRVJSX0VYQ0VQVElPTlM7CiAKLSAgICAgIH0gY2F0Y2goVEV4Y2VwdGlvbiYgZSkgewotICAgICAgICBwcmludGYoIiAgQ2F1Z2h0IFRFeGNlcHRpb25cbiIpOwotICAgICAgfQorICAgIH0gY2F0Y2ggKGNvbnN0IFRFeGNlcHRpb24mKSB7CisgICAgICBjb3V0IDw8ICIgIENhdWdodCBURXhjZXB0aW9uIiA8PCBlbmRsOworICAgIH0KIAogICAgIHRyeSB7Ci0gICAgICBwcmludGYoInRlc3RDbGllbnQudGVzdEV4Y2VwdGlvbihcInN1Y2Nlc3NcIikgPT4iKTsKKyAgICAgIGNvdXQgPDwgInRlc3RDbGllbnQudGVzdEV4Y2VwdGlvbihcInN1Y2Nlc3NcIikgPT4iIDw8IGZsdXNoOwogICAgICAgdGVzdENsaWVudC50ZXN0RXhjZXB0aW9uKCJzdWNjZXNzIik7Ci0gICAgICBwcmludGYoIiAgdm9pZFxuIik7Ci0gICAgfSBjYXRjaCguLi4pIHsKLSAgICAgIHByaW50ZigiICBleGNlcHRpb25cbkZBSUxVUkVcbiIpOwotICAgICAgZmFpbENvdW50Kys7CisgICAgICBjb3V0IDw8ICIgIHZvaWQiIDw8IGVuZGw7CisgICAgfSBjYXRjaCAoZXhjZXB0aW9uICYgZXgpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIGNvdXQgPDwgIioqKiBGQUlMRUQgKioqIiA8PCBlbmRsIDw8IGV4LndoYXQ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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgY291dCA8PCAiKioqIEZBSUxFRCAqKioiIDw8IGVuZGwgPDwgZXgud2hhdCgpIDw8IGVuZGw7CisgICAgICByZXR1cm5fY29kZSB8PSBFUlJfRVhDRVBUSU9OUzsKICAgICB9CiAKICAgICAvKiB0ZXN0IG9uZXdheSB2b2lkICovCiAgICAgewotICAgICAgICBwcmludGYoInRlc3RDbGllbnQudGVzdE9uZXdheSgzKSA9PiIpOwotICAgICAgICB1aW50NjRfdCBzdGFydE9uZXdheSA9IG5vdygpOwotICAgICAgICB0ZXN0Q2xpZW50LnRlc3RPbmV3YXkoMyk7Ci0gICAgICAgIHVpbnQ2NF90IGVsYXBzZWQgPSBub3coKSAtIHN0YXJ0T25ld2F5OwotICAgICAgICBpZiAoZWxhcHNlZCA+IDIwMCAqIDEwMDApIHsgLy8gMC4yIHNlY29uZHMKLSAgICAgICAgICAgIHByaW50ZigiICBGQUlMVVJFIC0gdG9vayAlLjJmIG1zXG4iLCAoZG91YmxlKWVsYXBzZWQvMTAwMC4wKTsKLSAgICAgICAgICAgIGZhaWxDb3VudCsrOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcHJpbnRmKCIgIHN1Y2Nlc3MgLSB0b29rICUuMmYgbXNcbiIsIChkb3VibGUpZWxhcHNlZC8xMDAwLjApOwotICAgICAgICB9CisgICAgICBjb3V0IDw8ICJ0ZXN0Q2xpZW50LnRlc3RPbmV3YXkoMSkgPT4iIDw8IGZsdXNoOworICAgICAgdWludDY0X3Qgc3RhcnRPbmV3YXkgPSBub3coKTsKKyAgICAgIHRlc3RDbGllbnQudGVzdE9uZXdheSgxKTsKKyAgICAgIHVpbnQ2NF90IGVsYXBzZWQgPSBub3coKSAtIHN0YXJ0T25ld2F5OworICAgICAgaWYgKGVsYXBzZWQgPiAyMDAgKiAxMDAwKSB7IC8vIDAuMiBzZWNvbmRzCisgICAgICAgIH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iwgLTEyNSwgLTEyNCwgLTEyMywgLTEyMiwgLTEyMSwgLTEyMCwgLTExOSwgLTExOCwgLTExNywgLTExNiwgLTExNSwgLTExNCwKKyAgICAgICAgICAgLTExMywgLTExMiwgLTExMSwgLTExMCwgLTEwOSwgLTEwOCwgLTEwNywgLTEwNiwgLTEwNSwgLTEwNCwgLTEwMywgLTEwMiwgLTEwMSwgLTEwMCwgLTk5LAorICAgICAgICAgICAtOTgsICAtOTcsICAtOTYsICAtOTUsICAtOTQsICAtOTMsICAtOTIsICAtOTEsICAtOTAsICAtODksICAtODgsICAtODcsICAtODYsICAtODUsICAtODQsCisgICAgICAgICAgIC04MywgIC04MiwgIC04MSwgIC04MCwgIC03OSwgIC03OCwgIC03NywgIC03NiwgIC03NSwgIC03NCwgIC03MywgIC03MiwgIC03MSwgIC03MCwgIC02OSwKKyAgICAgICAgICAgLTY4LCAgLTY3LCAgLTY2LCAgLTY1LCAgLTY0LCAgLTYzLCAgLTYyLCAgLTYxLCAgLTYwLCAgLTU5LCAgLTU4LCAgLTU3LCAgLTU2LCAgLTU1LCAgLTU0LAorICAgICAgICAgICAtNTMsICAtNTIsICAtNTEsICAtNTAsICAtNDksICAtNDgsICAtNDcsICAtNDYsICAtNDUsICAtNDQsICAtNDMsICAtNDIsICAtNDEsICAtNDAsICAtMzksCisgICAgICAgICAgIC0zOCwgIC0zNywgIC0zNiwgIC0zNSwgIC0zNCwgIC0zMywgIC0zMiwgIC0zMSwgIC0zMCwgIC0yOSwgIC0yOCwgIC0yNywgIC0yNiwgIC0yNSwgIC0yNCwKKyAgICAgICAgICAgLTIzLCAgLTIyLCAgLTIxLCAgLTIwLCAgLTE5LCAgLTE4LCAgLTE3LCAgLTE2LCAgLTE1LCAgLTE0LCAgLTEzLCAgLTEyLCAgLTExLCAgLTEwLCAgLTksCisgICAgICAgICAgIC04LCAgIC03LCAgIC02LCAgIC01LCAgIC00LCAgIC0zLCAgIC0yLCAgIC0xLCAgIDAsICAgIDEsICAgIDIsICAgIDMsICAgIDQsICAgIDUsICAgIDYsCisgICAgICAgICAgIDcsICAgIDgsICAgIDksICAgIDEwLCAgIDExLCAgIDEyLCAgIDEzLCAgIDE0LCAgIDE1LCAgIDE2LCAgIDE3LCAgIDE4LCAgIDE5LCAgIDIwLCAgIDIxLAorICAgICAgICAgICAyMiwgICAyMywgICAyNCwgICAyNSwgICAyNiwgICAyNywgICAyOCwgICAyOSwgICAzMCwgICAzMSwgICAzMiwgICAzMywgICAzNCwgICAzNSwgICAzNiwKKyAgICAgICAgICAgMzcsICAgMzgsICAgMzksICAgNDAsICAgNDEsICAgNDIsICAgNDMsICAgNDQsICAgNDUsICAgNDYsICAgNDcsICAgNDgsICAgNDksICAgNTAsICAgNTEsCisgICAgICAgICAgIDUyLCAgIDUzLCAgIDU0LCAgIDU1LCAgIDU2LCAgIDU3LCAgIDU4LCAgIDU5LCAgIDYwLCAgIDYxLCAgIDYyLCAgIDYzLCAgIDY0LCAgIDY1LCAgIDY2LAorICAgICAgICAgICA2NywgICA2OCwgICA2OSwgICA3MCwgICA3MSwgICA3MiwgICA3MywgICA3NCwgICA3NSwgICA3NiwgICA3NywgICA3OCwgICA3OSwgICA4MCwgICA4MSwKKyAgICAgICAgICAgODIsICAgODMsICAgODQsICAgODUsICAgODYsICAgODcsICAgODgsICAgODksICAgOTAsICAgOTEsICAgOTIsICAgOTMsICAgOTQsICAgOTUsICAgOTYsCisgICAgICAgICAgIDk3LCAgIDk4LCAgIDk5LCAgIDEwMCwgIDEwMSwgIDEwMiwgIDEwMywgIDEwNCwgIDEwNSwgIDEwNiwgIDEwNywgIDEwOCwgIDEwOSwgIDExMCwgIDExMSwKKyAgICAgICAgICAgMTEyLCAgMTEzLCAgMTE0LCAgMTE1LCAgMTE2LCAgMTE3LCAgMTE4LCAgMTE5LCAgMTIwLCAgMTIxLCAgMTIyLCAgMTIzLCAgMTI0LCAgMTI1LCAgMTI2LAorICAgICAgICAgICAxMjd9OworCisgICAgc3RyLnJlc2l6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hcC5lbmQoKTsgKyt1bSkgewotICAgICAgICAgIHByaW50ZigiJWQgPT4gJSJQUklkNjQiLCAiLCB1bS0+Zmlyc3QsIHVtLT5zZWNvbmQpOworICAgICAgICAgIHByaW50ZigiJWQgPT4gJSIgUFJJZDY0ICIsICIsIHVtLT5maXJzdCwgdW0tPnNlY29uZCk7CiAgICAgICAgIH0KICAgICAgICAgcHJpbnRmKCJ9LCAiKTsKIApAQCAtMjQ5LDcgKzI3NiwxMSBAQAogICAgICAgICB2ZWN0b3I8WHRydWN0Pjo6Y29uc3RfaXRlcmF0b3IgeDsKICAgICAgICAgcHJpbnRmKCJ7Iik7CiAgICAgICAgIGZvciAoeCA9IHh0cnVjdHMuYmVnaW4oKTsgeCAhPSB4dHJ1Y3RzLmVuZCgpOyArK3gpIHsKLSAgICAgICAgICBwcmludGYoIntcIiVzXCIsICVkLCAlZCwgJSJQUklkNjQifSwgIiwgeC0+c3RyaW5nX3RoaW5nLmNfc3RyKCksIChpbnQpeC0+Ynl0ZV90aGluZywgeC0+aTMyX3RoaW5nLCB4LT5pNjRfdGhpbmcpOworICAgICAgICAgIHByaW50Zigie1wiJXNcIiwgJWQsICVkLCAlIiBQUklkNjQgIn0sICIsCisgICAgICAgICAgICAgICAgIHgtPnN0cmluZ190aGluZy5jX3N0cigpLAorICAgICAgICAgICAgICAgICAoaW50KXgtPmJ5dGVfdGhpbmcsCisgICAgICAgICAgICAgICAgIHgtPmkzMl90aGluZywKKyAgICAgICAgICAgICAgICAgeC0+aTY0X3RoaW5nKTsKICAgICAgICAgfQogICAgICAgICBwcmludGYoIn0iKTsKIApAQCAtMjU4LDE1ICsyODksMTkgQEAKICAgICAgIHByaW50ZigifSwgIik7CiAgICAgfQogICAgIHByaW50ZigifVxuIik7Ci0KLQogICB9CiAKLSAgdm9pZCB0ZXN0TXVsdGkoWHRydWN0ICZoZWxsbywgY29uc3QgaW50OF90IGFyZzAsIGNvbnN0IGludDMyX3QgYXJnMSwgY29uc3QgaW50NjR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LCB2bSk7CisgIHBvOjpub3RpZnkodm0pOwogCiAgIGlmICh2bS5jb3VudCgiaGVscCIpKSB7Ci0gICAgICBjb3V0IDw8IGRlc2MgPDwgIlxuIjsKLSAgICAgIHJldHVybiAxOworICAgIGNvdXQgPDwgZGVzYyA8PCAiXG4iOworICAgIHJldHVybiAxOwogICB9Ci0gIAorCiAgIHRyeSB7CiAgICAgaWYgKCFzZXJ2ZXJfdHlwZS5lbXB0eSgpKSB7CiAgICAgICBpZiAoc2VydmVyX3R5cGUgPT0gInNpbXBsZSIpIHsKQEAgLTUzMywyNCArNjEzLDMyIEBACiAgICAgICB9IGVsc2UgaWYgKHNlcnZlcl90eXBlID09ICJ0aHJlYWRlZCIpIHsKICAgICAgIH0gZWxzZSBpZiAoc2VydmVyX3R5cGUgPT0gIm5vbmJsb2NraW5nIikgewogICAgICAgfSBlbHNlIHsKLSAgICAgICAgICB0aHJvdyBpbnZhbGlkX2FyZ3VtZW50KCJVbmtub3duIHNlcnZlciB0eXBlICIrc2VydmVyX3R5cGUpOwotICAgICAgfQotICAgIH0KLSAgICAKLSAgICBpZiAoIXByb3RvY29sX3R5cGUuZW1wdHkoKSkgewotICAgICAgaWYgKHByb3RvY29sX3R5cGUgPT0gImJpbmFyeSIpIHsKLSAgICAgIH0gZWxzZSBpZiAocHJvdG9jb2xfdHlwZSA9PSAianNvbiIpIHsKLSAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgdGhyb3cgaW52YWxpZF9hcmd1bWVudCgiVW5rbm93biBwcm90b2NvbCB0eXBlICIrcHJvdG9jb2xfdHlwZSk7CisgICAgICAgIHRocm93IGludmFsaWRfYXJndW1lbnQoIlVua25vd24gc2VydmVyIHR5cGUgIiArIHNlcnZlcl90eXBlKTsKICAgICAgIH0KICAgICB9CiAKLQlpZiAoIXRyYW5zcG9ydF90eXBlLmVtcHR5KCkpIHsKKyAgICBpZiAoIXByb3RvY29sX3R5cGUuZW1wdHkoKSkgeworICAgICAgaWYgKHByb3Rv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CBlbnZpcm9ubWVudGFsIHZhcmlhYmxlCitdCisKK0RFRkFVTFRfTUFYX0RFTEFZID0gNQorREVGQVVMVF9TSUdOQUwgPSAxCitERUZBVUxUX1RJTUVPVVQgPSA1CisKKworZGVmIF9jb2xsZWN0X3Rlc3RsaWJzKGNvbmZpZywgc2VydmVyX21hdGNoLCBjbGllbnRfbWF0Y2g9W05vbmVdKToKKyAgICAiIiJDb2xsZWN0cyBzZXJ2ZXIvY2xpZW50IGNvbmZpZ3VyYXRpb25zIGZyb20gbGlicmFyeSBjb25maWd1cmF0aW9ucyIiIgorICAgIGRlZiBleHBhbmRfbGlicyhjb25maWcpOgorICAgICAgICBmb3IgbGliIGluIGNvbmZpZzoKKyAgICAgICAgICAgIHN2ID0gbGliLnBvcCgnc2VydmVyJywgTm9uZSkKKyAgICAgICAgICAgIGNsID0gbGliLnBvcCgnY2xpZW50JywgTm9uZSkKKyAgICAgICAgICAgIHlpZWxkIGxpYiwgc3YsIGNsCisKKyAgICBkZWYgeWllbGRfdGVzdGxpYnMoYmFzZV9jb25maWdzLCBjb25maWdzLCBtYXRjaCk6CisgICAgICAgIGZvciBiYXNlLCBjb25mIGluIHppcChiYXNlX2NvbmZpZ3MsIGNvbmZpZ3MpOgorICAgICAgICAgICAgaWYgY29uZjoKKyAgICAgICAgICAgICAgICBpZiBub3QgbWF0Y2ggb3IgYmFzZVsnbmFtZSddIGluIG1hdGNoOgorICAgICAgICAgICAgICAgICAgICBwbGF0Zm9ybXMgPSBjb25mLmdldCgncGxhdGZvcm1zJykgb3IgYmFzZS5nZXQoJ3BsYXRmb3JtcycpCisgICAgICAgICAgICAgICAgICAgIGlmIG5vdCBwbGF0Zm9ybXMgb3IgcGxhdGZvcm0uc3lzdGVtKCkgaW4gcGxhdGZvcm1zOgorICAgICAgICAgICAgICAgICAgICAgICAgeWllbGQgbWVyZ2VfZGljdChiYXNlLCBjb25mKQorCisgICAgbGlicywgc3ZzLCBjbHMgPSB6aXAoKmV4cGFuZF9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KSB0dXBsZQorICAgICAgICBkZWYgY2FjaGVkX3NldChvKToKKyAgICAgICAgICAgIGRlZiB0b19zcGVjX2ltcGxfdHVwbGVzKHZhbHVlcyk6CisgICAgICAgICAgICAgICAgZm9yIHYgaW4gdmFsdWVzOgorICAgICAgICAgICAgICAgICAgICBzcGVjLCBfLCBpbXBsID0gdi5wYXJ0aXRpb24oJzonKQorICAgICAgICAgICAgICAgICAgICB5aWVsZCBzcGVjLCBpbXBsIG9yIHNwZWMKKyAgICAgICAgICAgIHYgPSBvW2tleV0KKyAgICAgICAgICAgIGlmIG5vdCBpc2luc3RhbmNlKHYsIHNldCk6CisgICAgICAgICAgICAgICAgdiA9IHNldCh0b19zcGVjX2ltcGxfdHVwbGVzKHNldCh2KSkpCisgICAgICAgICAgICAgICAgb1trZXldID0gdgorICAgICAgICAgICAgcmV0dXJuIHYKKyAgICAgICAgZm9yIHNwZWMxLCBpbXBsMSBpbiBjYWNoZWRfc2V0KG8xKToKKyAgICAgICAgICAgIGZvciBzcGVjMiwgaW1wbDIgaW4gY2FjaGVkX3NldChvMik6CisgICAgICAgICAgICAgICAgaWYgc3BlYzEgPT0gc3BlYzI6CisgICAgICAgICAgICAgICAgICAgIG5hbWUgPSBpbXBsMSBpZiBpbXBsMSA9PSBpbXBsMiBlbHNlICclcy0lcycgJSAoaW1wbDEsIGltcGwyKQorICAgICAgICAgICAgICAgICAgICB5aWVsZCBuYW1lLCBpbXBsMSwgaW1wbDIKKworICAgIGRlZiBtYXliZV9tYXgoa2V5LCBvMSwgbzIsIGRlZmF1bHQpOgorICAgICAgICAiIiJtYXhpbXVtIG9mIHR3byBpZiBwcmVzZW50LCBvdGhlcndpc2UgZGVmYXVsdCB2YWx1ZSIiIgorICAgICAgICB2MSA9IG8xLmdldChrZXkpCisgICAgICAgIHYyID0gbzIuZ2V0KGtleSkKKyAgICAgICAgcmV0dXJuIG1heCh2MSwgdjIpIGlmIHYxIGFuZCB2MiBlbHNlIHYxIG9yIHYyIG9yIGRlZmF1bHQKKworICAgIGRlZiBmaWx0ZXJfd2l0aF92YWxpZGtleXMobyk6CisgICAgICAgIHJldCA9IHt9CisgICAgICAgIGZvciBrZXkgaW4gVkFMSURfSlNPTl9LRVlTOgorICAgICAgICAgICAgaWYga2V5IGluIG86CisgICAgICAgICAgICAgICAgcmV0W2tleV0gPSBvW2tleV0KKyAgICAgICAgcmV0dXJuIHJldAorCisgICAgZGVmIG1lcmdlX21ldGFkYXRhKG8sICoqcmV0KToKKyAgICAgICAgZm9yIGtleSBpbiBWQUxJRF9KU09OX0tFWVM6CisgICAgICAgICAgICBpZiBrZXkgaW4gbzoKKyAgICAgICAgICAgICAgICByZXRba2V5XSA9IG9ba2V5XQorICAgICAgICByZXR1cm4gcmV0CisKKyAgICBmb3Igc3YsIGNsIGluIHByb2R1Y3Qoc2VydmVycywgY2xpZW50cyk6CisgICAgICAgIGZvciBwcm90bywgcHJvdG8xLCBwcm90bzIgaW4gaW50ZXJzZWN0X3dpdGhfc3BlYygncHJvdG9jb2xzJywgc3YsIGNsKToKKyAgICAgICAgICAgIGZvciB0cmFucywgdHJhbnMxLCB0cmFuczIgaW4gaW50ZXJzZWN0X3dpdGhfc3BlYygndHJhbnNwb3J0cycsIHN2LCBjbCk6CisgICAgICAgICAgICAgICAgZm9yIHNvY2sgaW4gaW50ZXJzZWN0aW9uKCdzb2NrZXRzJywgc3YsIGNsKToKKyAgICAgICAgICAgICAgICAgICAgeWllbGQgeworICAgICAgICAgICAgICAgICAgICAgICAgJ3NlcnZlcic6IG1lcmdlX21ldGFkYXRhKHN2LCAqKnsncHJvdG9jb2wnOiBwcm90bzEsICd0cmFuc3BvcnQnOiB0cmFuczF9KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICdjbGllbnQnOiBtZXJnZV9tZXRhZGF0YShjbCwgKip7J3Byb3RvY29sJzogcHJvdG8yLCAndHJhbnNwb3J0JzogdHJhbnMyfSksCisgICAgICAgICAgICAgICAgICAgICAgICAnZGVsYXknOiBtYXliZV9tYXgoJ2RlbGF5Jywgc3YsIGNsLCBERUZBVUxUX01BWF9ERUxBWSksCisgICAgICAgICAgICAgICAgICAgICAgICAnc3RvcF9zaWduYWwnOiBtYXliZV9tYXgoJ3N0b3Bfc2lnbmFsJywgc3YsIGNsLCBERUZBVUxUX1NJR05BTCksCisgICAgICAgICAgICAgICAgICAgICAgICAndGltZW91dCc6IG1heWJlX21heCgndGltZW91dCcsIHN2LCBjbCwgREVGQVVMVF9USU1FT1VUKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICdwcm90b2NvbCc6IHByb3RvLAorICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zcG9ydCc6IHRyYW5zLAorICAgICAgICAgICAgICAgICAgICAgICAgJ3NvY2tldCc6IHNvY2sKKyAgICAgICAgICAgICAgICAgICAgfQorCisKK2RlZiBfZmlsdGVyX2VudHJpZXModGVzdHMsIHJlZ2V4KToKKyAgICBpZiByZWdleDoKKyAgICAgICAgcmV0dXJuIGZpbHRlcihsYW1iZGEgdDogcmUuc2VhcmNoKHJlZ2V4LCBUZXN0RW50cnkuZ2V0X25hbWUoKip0KSksIHRlc3RzKQorICAgIHJldHVybiB0ZXN0cworCisKK2RlZiBjb2xsZWN0X2Nyb3NzX3Rlc3RzKHRlc3RzX2RpY3QsIHNlcnZlcl9tYXRjaCwgY2xpZW50X21hdGNoLCByZWdleCk6CisgICAgc3YsIGNsID0gX2NvbGxlY3RfdGVzdGxpYnModGVzdHNfZGljdCwgc2VydmVyX21hdGNoLCBjbGllbnRfbWF0Y2gpCisgICAgcmV0dXJuIGxpc3QoX2ZpbHRlcl9lbnRyaWVzKF9kb19jb2xsZWN0X3Rlc3RzKHN2LCBjbCksIHJlZ2V4KSkKKworCitkZWYgY29sbGVjdF9mZWF0dXJlX3Rlc3RzKHRlc3RzX2RpY3QsIGZlYXR1cmVzX2RpY3QsIHNlcnZlcl9tYXRjaCwgZmVhdHVyZV9tYXRjaCwgcmVnZXgpOgorICAgIHN2L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AgICAgIGZvciByIGluIHJlc3VsdHM6CisgICAgICAgICAgICBpZiBub3QgcltzdWNjZXNzX2luZGV4XToKKyAgICAgICAgICAgICAgICB5aWVsZCBUZXN0RW50cnkuZ2V0X25hbWUoKnIpCisgICAgdHJ5OgorICAgICAgICB3aXRoIGxvZ2ZpbGVfb3BlbihwYXRoX2pvaW4odGVzdGRpciwgUkVTVUxUX0pTT04pLCAncicpIGFzIGZwOgorICAgICAgICAgICAgcmVzdWx0cyA9IGpzb24ubG9hZChmcCkKKyAgICBleGNlcHQgSU9FcnJvcjoKKyAgICAgICAgc3lzLnN0ZGVyci53cml0ZSgnVW5hYmxlIHRvIGxvYWQgbGFzdCByZXN1bHQuIERpZCB5b3UgcnVuIHRlc3RzID9cbicpCisgICAgICAgIHJldHVybiBGYWxzZQorICAgIGZhaWxzID0gY29sbGVjdF9mYWlsdXJlcyhyZXN1bHRzWydyZXN1bHRzJ10pCisgICAgaWYgbm90IG92ZXJ3cml0ZToKKyAgICAgICAga25vd24gPSBsb2FkX2tub3duX2ZhaWx1cmVzKHRlc3RkaXIpCisgICAgICAgIGtub3duLmV4dGVuZChmYWlscykKKyAgICAgICAgZmFpbHMgPSBrbm93bgorICAgIGZhaWxzX2pzb24gPSBqc29uLmR1bXBzKHNvcnRlZChzZXQoZmFpbHMpKSwgaW5kZW50PTIsIHNlcGFyYXRvcnM9KCcsJywgJzogJykpCisgICAgaWYgc2F2ZToKKyAgICAgICAgd2l0aCBsb2dmaWxlX29wZW4ob3MucGF0aC5qb2luKHRlc3RkaXIsIEZBSUxfSlNPTiAlIHBsYXRmb3JtLnN5c3RlbSgpKSwgJ3crJykgYXMgZnA6CisgICAgICAgICAgICBmcC53cml0ZShmYWlsc19qc29uKQorICAgICAgICBzeXMuc3Rkb3V0LndyaXRlKCdTdWNjZXNzZnVsbHkgdXBkYXRlZCBrbm93biBmYWlsdXJlcy5cbicpCisgICAgaWYgb3V0OgorICAgICAgICBzeXMuc3Rkb3V0LndyaXRlKGZ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c3RhcnQoc2VsZik6CisgICAgICAgIHNlbGYuX3N0YXJ0X3RpbWUgPSB0aW1lLnRpbWUoKQorCisgICAgQHByb3BlcnR5CisgICAgZGVmIF9lbGFwc2VkKHNlbGYpOgorICAgICAgICByZXR1cm4gdGltZS50aW1lKCkgLSBzZWxmLl9zdGFydF90aW1lCisKKyAgICBAY2xhc3NtZXRob2QKKyAgICBkZWYgX2Zvcm1hdF9kYXRlKGNscyk6CisgICAgICAgIHJldHVybiAnJXMnICUgZGF0ZXRpbWUuZGF0ZXRpbWUubm93KCkuc3RyZnRpbWUoY2xzLkRBVEVUSU1FX0ZPUk1BVCkKKworICAgIGRlZiBfcHJpbnRfZGF0ZShzZWxmKToKKyAgICAgICAgcHJpbnQoc2VsZi5fZm9ybWF0X2RhdGUoKSwgZmlsZT1zZWxmLm91dCkKKworICAgIGRlZiBfcHJpbnRfYmFyKHNlbGYsIG91dD1Ob25lKToKKyAgICAgICAgcHJpbnQoCisgICAgICAgICAgICAnPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PScsCisgICAgICAgICAgICBmaWxlPShvdXQgb3Igc2VsZi5vdXQpKQorCisgICAgZGVmIF9wcmludF9leGVjX3RpbWUoc2VsZik6CisgICAgICAgIHByaW50KCdUZXN0IGV4ZWN1dGlvbiB0b29rIHs6LjFmfSBzZWNvbmRzLicuZm9ybWF0KHNlbGYuX2VsYXBzZWQpLCBmaWxlPXNlbGYub3V0KQorCisKK2NsYXNzIEV4ZWNSZXBvcnRlcihUZXN0UmVwb3J0ZXIpOgorICAgIGRlZiBfX2luaXRfXyhzZWxmLCB0ZXN0ZGlyLCB0ZXN0LCBwcm9nKToKKyAgICAgICAgc3VwZXIoRXhlY1JlcG9ydGVyLCBzZWxmKS5fX2luaXRfXygpCisgICAgICAgIHNlbGYuX3Rlc3QgPSB0ZXN0CisgICAgICAgIHNlbGYuX3Byb2cgPSBwcm9nCisgICAgICAgIHNlbGYubG9ncGF0aCA9IHNlbGYudGVzdF9sb2dmaWxlKHRlc3QubmFtZSwgcHJvZy5raW5kLCB0ZXN0ZGlyKQorICAgICAgICBzZWxmLm91dCA9IE5vbmUKKworICAgIGRlZiBiZWdpbihzZWxmKToKKyAgICAgICAgc2VsZi5fc3RhcnQoKQorICAgICAgICBzZWxmLl9vcGVuKCkKKyAgICAgICAgaWYgc2VsZi5vdXQgYW5kIG5vdCBzZWxmLm91dC5jbG9zZWQ6CisgICAgICAgICAgICBzZWxmLl9wcmludF9oZWFkZXIoKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgc2VsZi5fbG9nLmRlYnVnKCdPdXRwdXQgc3RyZWFtIGlzIG5vdCBhdmFpbGFibGUuJykKKworICAgIGRlZiBlbmQoc2VsZiwgcmV0dXJuY29kZSk6CisgICAgICAgIHNlbGYuX2xvY2suYWNxdWlyZSgpCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIGlmIHNlbGYub3V0IGFuZCBub3Qgc2VsZi5vdXQuY2xvc2VkOgorICAgICAgICAgICAgICAgIHNlbGYuX3ByaW50X2Zvb3RlcihyZXR1cm5jb2RlKQorICAgICAgICAgICAgICAgIHNlbGYuX2Nsb3NlKCkKKyAgICAgICAgICAgICAgICBzZWxmLm91dCA9IE5vbmUKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgc2VsZi5fbG9nLmRlYnVnKCdPdXRwdXQgc3RyZWFtIGlzIG5vdCBhdmFpbGFibGUuJykKKyAgICAgICAgZmluYWxseToKKyAgICAgICAgICAgIHNlbGYuX2xvY2sucmVsZWFzZSgpCisKKyAgICBkZWYga2lsbGVkKHNlbGYpOgorICAgICAgICBwcmludChmaWxlPXNlbGYub3V0KQorICAgICAgICBwcmludCgnU2VydmVyIHByb2Nlc3MgaXMgc3VjY2Vzc2Z1bGx5IGtpbGxlZC4nLCBmaWxlPXNlbGYub3V0KQorICAgICAgICBzZWxmLmVuZChOb25lKQorCisgICAgZGVmIGRpZWQoc2VsZik6CisgICAgICAgIHByaW50KGZpbGU9c2VsZi5vdXQpCisgICAgICAgIHByaW50KCcqKiogU2VydmVyIHByb2Nlc3MgaGFzIGRpZWQgdW5leHBlY3RlZGx5ICoqKicsIGZpbGU9c2VsZi5vdXQpCisgICAgICAgIHNlbGYuZW5kKE5vbmUpCisKKyAgICBfaW5pdF9mYWlsdXJlX2V4cHJzID0geworICAgICAgICAnc2VydmVyJzogbGlzdChtYXAocmUuY29tcGlsZSwgWworICAgICAgICAgICAgJ1tBYV1kZHJlc3MgYWxyZWFkeSBpbiB1c2UnLAorICAgICAgICAgICAgJ0NvdWxkIG5vdCBiaW5kJywKKyAgICAgICAgICAgICdFQUREUklOVVNFJywKKyAgICAgICAgXSkpLAorICAgICAgICAnY2xpZW50JzogbGlzdChtYXAocmUuY29tcGlsZSwgWworICAgICAgICAgICAgJ1tDY11vbm5lY3Rpb24gcmVmdXNlZCcsCisgICAgICAgICAgICAnQ291bGQgbm90IGNvbm5lY3QgdG8nLAorICAgICAgICAgICAgJ0NvdWxkIG5vdCBvcGVuIFVOSVggJywgICAgICAgIyBkb21haW4gc29ja2V0IChyYikKKyAgICAgICAgICAgICdFQ09OTlJFRlVTRUQnLAorICAgICAgICAgICAgJ2Vjb25ucmVmdXNlZCcsICAgICAgICAgICAgICAgIyBlcmwKKyAgICAgICAgICAgICdDT05ORUNUSU9OLVJFRlVTRUQtRVJST1InLCAgICMgY2wKKyAgICAgICAgICAgICdjb25uZWN0IEVOT0VOVCcsICAgICAgICAgICAgICMgbm9kZWpzIGRvbWFpbiBzb2NrZXQKKyAgICAgICAgICAgICdObyBzdWNoIGZpbGUgb3IgZGlyZWN0b3J5JywgICMgZG9tYWluIHNvY2tldAorICAgICAgICAgICAgJ1NvY2tldHMuVGNwQ2xpZW50LkNvbm5lY3QnLCAgIyBjc2hhcnAKKyAgICAgICAgXSkpLAorICAgIH0KKworICAgIGRlZiBtYXliZV9mYWxzZV9wb3NpdGl2ZShzZWxmKToKKyAgICAgICAgIiIiU2VhcmNoZXMgdGhyb3VnaCBsb2cgZmlsZSBmb3Igc29ja2V0IGJpbmQgZXJyb3IuCisgICAgICAgIFJldHVybnMgVHJ1ZSBpZiBzdXNwaWNpb3VzIGV4cHJlc3Npb24gaXMgZm91bmQsIG90aGVyd2lzZSBGYWxzZSIiIgorICAgICAgICB0cnk6CisgICAgICAgICAgICBpZiBzZWxmLm91dCBhbmQgbm90IHNlbGYub3V0LmNsb3NlZDoKKyAgICAgICAgICAgICAgICBzZWxmLm91dC5mbHVzaCgpCisgICAgICAgICAgICBleHBycyA9IHNlbGYuX2luaXRfZmFpbHVyZV9leHByc1tzZWxmLl9wcm9nLmtpbmRdCisKKyAgICAgICAgICAgIGRlZiBtYXRjaChsaW5lKToKKyAgICAgICAgICAgICAgICBmb3IgZXhwciBpbiBleHByczoKKyAgICAgICAgICAgICAgICAgICAgaWYgZXhwci5zZWFyY2gobGluZSk6CisgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLl9sb2cuaW5mbygibWF5YmUgZmFsc2UgcG9zaXRpdmU6ICVzIiAlIGxpbmUpCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVHJ1ZQorCisgICAgICAgICAgICB3aXRoIGxvZ2ZpbGVfb3BlbihzZWxmLmxvZ3BhdGgsICdyJykgYXMgZnA6CisgICAgICAgICAgICAgICAgaWYgYW55KG1hcChtYXRjaCwgZnApKToKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRydWUKKyAgICAgICAgZXhjZXB0IChLZXlib2FyZEludGVycnVwdCwgU3lzdGVtRXhpdCk6CisgICAgICAgICAgICByYWlzZQorICAgICAgICBleGNlcHQgRXhjZXB0aW9uIGFzIGV4OgorICAgICAgICAgICAgc2VsZi5fbG9nLndhcm4oJ1slc106IEVycm9yIHdoaWxlIGRldGVjdGluZyBmYWxzZSBwb3NpdGl2ZTogJXMnICUgKHNlbGYuX3Rlc3QubmFtZSwgc3RyK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GVkX3N1Y2Nlc3MgPSBbXQorICAgICAgICBzZWxmLl9mbGFreV9zdWNjZXNzID0gW10KKyAgICAgICAgc2VsZi5fdW5leHBlY3RlZF9mYWlsdXJlID0gW10KKyAgICAgICAgc2VsZi5fZXhwZWN0ZWRfZmFpbHVyZSA9IFtdCisgICAgICAgIHNlbGYuX3ByaW50X2hlYWRlcigpCisKKyAgICBAcHJvcGVydHkKKyAgICBkZWYgdGVzdGRpcihzZWxmKToKKyAgICAgICAgcmV0dXJuIHBhdGhfam9pbihzZWxmLl9iYXNlZGlyLCBzZWxmLl90ZXN0ZGlyX3JlbCkKKworICAgIGRlZiBfcmVzdWx0X3N0cmluZyhzZWxmLCB0ZXN0KToKKyAgICAgICAgaWYgdGVzdC5zdWNjZXNzOgorICAgICAgICAgICAgaWYgdGVzdC5yZXRyeV9jb3VudCA9PSAwOgorICAgICAgICAgICAgICAgIHJldHVybiAnc3VjY2VzcycKKyAgICAgICAgICAgIGVsaWYgdGVzdC5yZXRyeV9jb3VudCA9PSAxOgorICAgICAgICAgICAgICAgIHJldHVybiAnZmxha3koMSByZXRyeSknCisgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgIHJldHVybiAnZmxha3koJWQgcmV0cmllcyknICUgdGVzdC5yZXRyeV9jb3VudAorICAgICAgICBlbGlmIHRlc3QuZXhwaXJlZDoKKyAgICAgICAgICAgIHJldHVybiAnZmFpbHVyZSh0aW1lb3V0KScKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHJldHVybiAnZmFpbHVyZSglZCknICUgdGVzdC5yZXR1cm5jb2RlCisKKyAgICBkZWYgX2dldF9yZXZpc2lvbihzZWxmKToKKyAgICAgICAgcCA9IHN1YnByb2Nlc3MuUG9wZW4oWydnaXQnLCAncmV2LXBhcnNlJywgJy0tc2hvcnQnLCAnSEVBRCddLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjd2Q9c2VsZi50ZXN0ZGlyLCBzdGRvdXQ9c3VicHJvY2Vzcy5QSVBFKQorICAgICAgICBvdXQsIF8gPSBwLmNvbW11bmljYXRlKCkKKyAgICAgICAgcmV0dXJuIG91dC5zdHJpcCgpCisKKyAgICBkZWYgX2Zvcm1hdF90ZXN0KHNlbGYsIHRlc3QsIHdpdGhfcmVzdWx0PVRydWUpOgorICAgICAgICBuYW1lID0gJyVzLSVzJyAlICh0ZXN0LnNlcnZlci5uYW1lLCB0ZXN0LmNsaWVudC5uYW1lKQorICAgICAgICB0cmFucyA9ICclcy0lcycgJSAodGVzdC50cmFuc3BvcnQsIHRlc3Quc29ja2V0KQorICAgICAgICBpZiBub3Qgd2l0aF9yZXN1bHQ6CisgICAgICAgICAgICByZXR1cm4gJ3s6MjRzfXs6MThzfXs6MjVzfScuZm9ybWF0KG5hbWVbOjIzXSwgdGVzdC5wcm90b2NvbFs6MTddLCB0cmFuc1s6MjRdKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgcmV0dXJuICd7OjI0c317OjE4c317OjI1c317OnN9XG4nLmZvcm1hdChuYW1lWzoyM10sIHRlc3QucHJvdG9jb2xbOjE3XSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNbOjI0XSwgc2VsZi5fcmVzdWx0X3N0cmluZyh0ZXN0KSkKKworICAgIGRlZiBfcHJpbnRfdGVzdF9oZWFkZXIoc2VsZik6CisgICAgICAgIHNlbGYuX3ByaW50X2JhcigpCisgICAgICAgIHByaW50KAorICAgICAgICAgICAgJ3s6MjRzfXs6MThzfXs6MjVzfXs6c30nLmZvcm1hdCgnc2VydmVyLWNsaWVudDonLCAncHJvdG9jb2w6JywgJ3RyYW5zcG9ydDonLCAncmVzdWx0OicpLAorICAgICAgICAgICAgZmlsZT1zZWxmLm91dCkKKworICAgIGRlZiBfcHJpbnRfaGVhZGVyKHNlbGYpOgorICAgICAgICBzZWxmLl9zdGFydCgpCisgICAgICAgIHByaW50KCdBcGFjaGUgVGhyaWZ0IC0gSW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gICAgIGlmIGxlbihzZWxmLl9mbGFreV9zdWNjZXNzKSA+IDA6CisgICAgICAgICAgICBwcmludCgKKyAgICAgICAgICAgICAgICAnRm9sbG93aW5nICVkIHRlc3RzIHdlcmUgZXhwZWN0ZWQgdG8gY2xlYW5seSBzdWNjZWVkIGJ1dCBuZWVkZWQgcmV0cnk6JyAlIGxlbihzZWxmLl9mbGFreV9zdWNjZXNzKSwKKyAgICAgICAgICAgICAgICBmaWxlPXNlbGYub3V0KQorICAgICAgICAgICAgc2VsZi5fcHJpbnRfdGVzdF9oZWFkZXIoKQorICAgICAgICAgICAgZm9yIGkgaW4gc2VsZi5fZmxha3lfc3VjY2VzczoKKyAgICAgICAgICAgICAgICBzZWxmLm91dC53cml0ZShzZWxmLl9mb3JtYXRfdGVzdChzZWxmLl90ZXN0c1tpXSkpCisgICAgICAgICAgICBzZWxmLl9wcmludF9iYXIoKQorCisgICAgZGVmIF9wcmludF91bmV4cGVjdGVkX3N1Y2Nlc3Moc2VsZik6CisgICAgICAgIGlmIGxlbihzZWxmLl91bmV4cGVjdGVkX3N1Y2Nlc3MpID4gMDoKKyAgICAgICAgICAgIHByaW50KAorICAgICAgICAgICAgICAgICdGb2xsb3dpbmcgJWQgdGVzdHMgd2VyZSBrbm93biB0byBmYWlsIGJ1dCBzdWNjZWVkZWQgKG1heWJlIGZsYWt5KTonICUgbGVuKHNlbGYuX3VuZXhwZWN0ZWRfc3VjY2VzcyksCisgICAgICAgICAgICAgICAgZmlsZT1zZWxmLm91dCkKKyAgICAgICAgICAgIHNlbGYuX3ByaW50X3Rlc3RfaGVhZGVyKCkKKyAgICAgICAgICAgIGZvciBpIGluIHNlbGYuX3VuZXhwZWN0ZWRfc3VjY2VzczoKKyAgICAgICAgICAgICAgICBzZWxmLm91dC53cml0ZShzZWxmLl9mb3JtYXRfdGVzdChzZWxmLl90ZXN0c1tpXSkpCisgICAgICAgICAgICBzZWxmLl9wcmludF9iYXIoKQorCisgICAgZGVmIF9odHRwX3Nl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iNcdCVzXG4nICUgKHNlbGYuX2Jhc2VkaXIsIHNlbGYuX2h0dHBfc2VydmVyX2NvbW1hbmQoODAwMSkpLAorICAgICAgICAgICAgJyMgdGhlbiBicm93c2U6XG4nLAorICAgICAgICAgICAgJyMgXHRodHRwOi8vbG9jYWxob3N0OiVkLyVzL1xuJyAlICg4MDAxLCBzZWxmLl90ZXN0ZGlyX3JlbCksCisgICAgICAgICAgICAnRnVsbCBsb2cgZm9yIGVhY2ggdGVzdCBpcyBoZXJlOlxuJywKKyAgICAgICAgICAgICdcdHRlc3QvbG9nL3NlcnZlcl9jbGllbnRfcHJvdG9jb2xfdHJhbnNwb3J0X2NsaWVudC5sb2dcbicsCisgICAgICAgICAgICAnXHR0ZXN0L2xvZy9zZXJ2ZXJfY2xpZW50X3Byb3RvY29sX3RyYW5zcG9ydF9zZXJ2ZXIubG9nXG4nLAorICAgICAgICAgICAgJyVkIGZhaWxlZCBvZiAlZCB0ZXN0cyBpbiB0b3RhbC5cbicgJSAoZmFpbF9jb3VudCwgbGVuKHNlbGYuX3Rlc3RzKSksCisgICAgICAgIF0pCisgICAgICAgIHNlbGYuX3ByaW50X2V4ZWNfdGltZSgpCisgICAgICAgIHNlbGYuX3ByaW50X2RhdGUoKQorCisgICAgZGVmIF9yZW5kZXJfcmVzdWx0KHNlbGYsIHRlc3QpOgorICAgICAgICByZXR1cm4gWworICAgICAgICAgICAgdGVzdC5zZXJ2ZXIubmFtZSwKKyAgICAgICAgICAgIHRlc3QuY2xpZW50Lm5hbWUsCisgICAgICAgICAgICB0ZXN0LnByb3RvY29sLAorICAgICAgICAgICAgdGVzdC50cmFuc3BvcnQsCisgICAgICAgICAgICB0ZXN0LnNvY2tldCwKKyAgICAgICAgICAgIHRlc3Quc3VjY2VzcywKKyAgICAgICAgICAgIHRlc3QuYXNfZXhwZWN0ZWQsCisgICAgICAgICAgICB0ZXN0LnJldHVybmNvZGUsCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgJ3NlcnZlcic6IHNlbGYudGVzdF9sb2dmaWxlKHRlc3QubmFtZSwgdGVzdC5zZXJ2ZXIua2luZCksCisgICAgICAgICAgICAgICAgJ2NsaWVudCc6IHNlbGYudGVzdF9sb2dmaWxlKHRlc3QubmFtZSwgdGVzdC5jbGllbnQua2luZCksCisgICAgICAgICAgICB9LAorICAgICAgICBdCisKKyAgICBkZWYgX3dyaXRlX2h0bWxfZGF0YShzZWxmKToKKyAgICAgICAgIiIiV3JpdGVzIEpTT04gZGF0YSB0byBiZSByZWFkIGJ5IHJlc3VsdCBodG1sIiIiCisgICAgICAgIHJlc3VsdHMgPSBbc2VsZi5fcmVuZGVyX3Jlc3VsdChyKSBmb3IgciBpbiBzZWxmLl90ZXN0c10KKyAgICAgICAgd2l0aCBsb2dmaWxlX29wZW4oc2VsZi5vdXRfcGF0aCwgJ3crJykgYXMgZnA6CisgICAgICAgICAgICBmcC53cml0ZShqc29uLmR1bXBzKHsKKyAgICAgICAgICAgICAgICAnZGF0ZSc6IHNlbGYuX2Zvcm1hdF9kYXRlKCksCisgICAgICAgICAgICAgICAgJ3JldmlzaW9uJzogc3RyKHNlbGYuX3JldmlzaW9uKSwKKyAgICAgICAgICAgICAgICAncGxhdGZvcm0nOiBzZWxmLl9wbGF0Zm9ybSwKKyAgICAgICAgICAgICAgICAnZHVyYXRpb24nOiAnezouMWZ9Jy5mb3JtYXQoc2VsZi5fZWxhcHNlZCksCisgICAgICAgICAgICAgICAgJ3Jlc3VsdHMnOiByZXN1bHRzLAorICAgICAgICAgICAgfSwgaW5kZW50PTIpKQorCisgICAgZGVmIF9hc3NlbWJsZV9sb2coc2VsZiwgdGl0bGUsIGluZGV4ZXMpOgorICAgICAgICBpZiBsZW4oaW5kZXhlcykgPiAwOgorICAgICAgICAgICAgZGVmIGFkZF9wcm9nX2xvZyhmcCwgdGVzdCwgcHJvZ19raW5kKToKKyAgICAgICAgICAgICAgICBwcmludCgnKioqKioqKioqKioqKioqKioqKioqKioqKioqICVzIG1lc3NhZ2UgKioqKioqKioqKioqKioqKioqKioqKioqKioqJyAlIHByb2dfa2luZCwKKyAgICAgICAgICAgICAgICAgICAgICBmaWxlPWZwKQorICAgICAgICAgICAgICAgIHBhdGggPSBzZWxmLnRlc3RfbG9nZmlsZSh0ZXN0Lm5hbWUsIHByb2dfa2luZCwgc2VsZi50ZXN0ZGlyKQorICAgICAgICAgICAgICAgIGlmIG9zLnBhdGguZXhpc3RzKHBhdGgpOgorICAgICAgICAgICAgICAgICAgICB3aXRoIGxvZ2ZpbGVfb3BlbihwYXRoLCAncicpIGFzIHByb2dfZnA6CisgICAgICAgICAgICAgICAgICAgICAgICBwcmludChwcm9nX2ZwLnJlYWQoKSwgZmlsZT1mcCkKKyAgICAgICAgICAgIGZpbGVuYW1lID0gdGl0bGUucmVwbGFjZSgnICcsICdfJykgKyAnLmxvZycKKyAgICAgICAgICAgIHdpdGggbG9nZmlsZV9vcGVuKG9zLnBhdGguam9pbihzZWxmLmxvZ2RpciwgZmlsZW5hbWUpLCAndysnKSBhcyBmcDoKKyAgICAgICAgICAgICAgICBmb3IgdGVzdCBpbiBtYXAoc2VsZi5fdGVzdHMuX19nZXRpdGVtX18sIGluZGV4ZXMpOgorICAgICAgICAgICAgICAgICAgICBmcC53cml0ZSgnVEVTVDogWyVzXVxuJyAlIHRlc3QubmFtZSkKKyAgICAgICAgICAgICAgICAgICAgYWRkX3Byb2dfbG9nKGZwLCB0ZXN0LCB0ZXN0LnNlcnZlci5raW5kKQorICAgICAgICAgICAgICAgICAgICBhZGRfcHJvZ19sb2coZnAsIHRlc3QsIHRlc3QuY2xpZW50LmtpbmQpCisgICAgICAgICAgICAgICAgICAgIGZwLndyaXRlKCcqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG5cbicpCisgICAgICAgICAgICBwcmludCgnJXMgYXJlIGxvZ2dlZCB0byAlcy8lcy8lcycgJSAodGl0bGUuY2FwaXRhb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mFtZSBpbiBzZWxmLl9rbm93bl9mYWlsdXJlcworICAgICAgICAgICAgaWYgZmFpbGVkOgorICAgICAgICAgICAgICAgIGlmIGtub3duOgorICAgICAgICAgICAgICAgICAgICBzZWxmLl9sb2cuZGVidWcoJyVzIGZhaWxlZCBhcyBleHBlY3RlZCcgJSB0ZXN0Lm5hbWUpCisgICAgICAgICAgICAgICAgICAgIHNlbGYuX2V4cGVjdGVkX2ZhaWx1cmUuYXBwZW5kKGluZGV4KQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuX2xvZy5pbmZvKCd1bmV4cGVjdGVkIGZhaWx1cmU6ICVzJyAlIHRlc3QubmFtZSkKKyAgICAgICAgICAgICAgICAgICAgc2VsZi5fdW5leHBlY3RlZF9mYWlsdXJlLmFwcGVuZChpbmRleCkKKyAgICAgICAgICAgIGVsaWYgZmxha3kgYW5kIG5vdCBrbm93bjoKKyAgICAgICAgICAgICAgICBzZWxmLl9sb2cuaW5mbygndW5leHBlY3RlZCBmbGFreSBzdWNjZXNzOiAlcycgJSB0ZXN0Lm5hbWUpCisgICAgICAgICAgICAgICAgc2VsZi5fZmxha3lfc3VjY2Vzcy5hcHBlbmQoaW5kZXgpCisgICAgICAgICAgICBlbGlmIG5vdCBmbGFreSBhbmQga25vd246CisgICAgICAgICAgICAgICAgc2VsZi5fbG9nLmluZm8oJ3VuZXhwZWN0ZWQgc3VjY2VzczogJXMnICUgdGVzdC5uYW1lKQorICAgICAgICAgICAgICAgIHNlbGYuX3VuZXhwZWN0ZWRfc3VjY2Vzcy5hcHBlbmQoaW5kZXgpCisgICAgICAgICAgICB0ZXN0LnN1Y2Nlc3MgPSBub3QgZmFpbGVkCisgICAgICAgICAgICB0ZXN0LnJldHVybmNvZGUgPSByZXR1cm5jb2RlCisgICAgICAgICAgICB0ZXN0LnJldHJ5X2NvdW50ID0gcmV0cnlfY291bnQKKyAgICAgICAgICAgIHRlc3QuZXhwaXJlZCA9IGV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0gMTI4CitTSUdOT05FID0gMAorU0lHS0lMTCA9IDE1CisKKyMgZ2xvYmFscworcG9ydHMgPSBOb25lCitzdG9wID0gTm9uZQorCisKK2NsYXNzIEV4ZWN1dGlvbkNvbnRleHQob2JqZWN0KToKKyAgICBkZWYgX19pbml0X18oc2VsZiwgY21kLCBjd2QsIGVudiwgc3RvcF9zaWduYWwsIGlzX3NlcnZlciwgcmVwb3J0KToKKyAgICAgICAgc2VsZi5fbG9nID0gbXVsdGlwcm9jZXNzaW5nLmdldF9sb2dnZXIoKQorICAgICAgICBzZWxmLmNtZCA9IGNtZAorICAgICAgICBzZWxmLmN3ZCA9IGN3ZAorICAgICAgICBzZWxmLmVudiA9IGVudgorICAgICAgICBzZWxmLnN0b3Bfc2lnbmFsID0gc3RvcF9zaWduYWwKKyAgICAgICAgc2VsZi5pc19zZXJ2ZXIgPSBpc19zZXJ2ZXIKKyAgICAgICAgc2VsZi5yZXBvcnQgPSByZXBvcnQKKyAgICAgICAgc2VsZi5leHBpcmVkID0gRmFsc2UKKyAgICAgICAgc2VsZi5raWxsZWQgPSBGYWxzZQorICAgICAgICBzZWxmLnByb2MgPSBOb25lCisKKyAgICBkZWYgX3BvcGVuX2FyZ3Moc2VsZik6CisgICAgICAgIGFyZ3MgPSB7CisgICAgICAgICAgICAnY3dkJzogc2VsZi5jd2QsCisgICAgICAgICAgICAnZW52Jzogc2VsZi5lbnYsCisgICAgICAgICAgICAnc3Rkb3V0Jzogc2VsZi5yZXBvcnQub3V0LAorICAgICAgICAgICAgJ3N0ZGVycic6IHN1YnByb2Nlc3MuU1RET1VULAorICAgICAgICB9CisgICAgICAgICMgbWFrZSBzdXJlIGNoaWxkIHByb2Nlc3NlcyBkb2Vzbid0IHJlbWFpbiBhZnRlciBraWxsaW5nCisgICAgICAgIGlmIHBsYXRmb3JtLnN5c3RlbSgpID09ICdXaW5kb3dzJzoKKyAgICAgICAgICAgIERFVEFDSEVEX1BST0NFU1MgPSAweDAwMDAwMDA4CisgICAgICAgICAgICBhcmdzLnVwZGF0ZShjcmVhdGlvbmZsYWdzPURFVEFDSEVEX1BST0NFU1MgfCBzdWJwcm9jZXNzLkNSRUFURV9ORVdfUFJPQ0VTU19HUk9VUCkKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIGFyZ3MudXBkYXRlKHByZWV4ZWNfZm49b3Muc2V0c2lkKQorICAgICAgICByZXR1cm4gYXJncworCisgICAgZGVmIHN0YXJ0KHNlbGYpOgorICAgICAgICBqb2luZWQgPSBzdHJfam9pbignICcsIHNlbGYuY21kKQorICAgICAgICBzZWxmLl9sb2cuZGVidWcoJ0NPTU1BTkQ6ICVzJywgam9pbmVkKQorICAgICAgICBzZWxmLl9sb2cuZGVidWcoJ1dPUktESVI6ICVzJywgc2VsZi5jd2QpCisgICAgICAgIHNlbGYuX2xvZy5kZWJ1ZygnTE9HRklMRTogJXMnLCBzZWxmLnJlcG9ydC5sb2dwYXRoKQorICAgICAgICBzZWxmLnJlcG9ydC5iZWdpbigpCisgICAgICAgIHNlbGYucHJvYyA9IHN1YnByb2Nlc3MuUG9wZW4oc2VsZi5jbWQsICoqc2VsZi5fcG9wZW5fYXJncygpKQorICAgICAgICBzZWxmLl9sb2cuZGVidWcoJyAgICBQSUQ6ICVkJywgc2VsZi5wcm9jLnBpZCkKKyAgICAgICAgc2VsZi5fbG9nLmRlYnVnKCcgICBQR0lEOiAlZCcsIG9zLmdldHBnaWQoc2VsZi5wcm9jLnBpZCkpCisgICAgICAgIHJldHVybiBzZWxmLl9zY29wZWQoKQorCisgICAgQGNvbnRleHRsaWIuY29udGV4dG1hbmFnZXIKKyAgICBkZWYgX3Njb3BlZChzZWxmKToKKyAgICAgICAgeWllbGQgc2VsZgorICAgICAgICBpZiBzZWxmLmlzX3NlcnZlcjoKKyAgICAgICAgICAgICMgdGhlIHNlcnZlciBpcyBzdXBwb3NlZCB0byBydW4gdW50aWwgd2Ugc3RvcCBpdAorICAgICAgICAgICAgaWYgc2VsZi5yZXR1cm5jb2RlIGlzIG5vdCBOb25lOgorICAgICAgICAgICAgICAgIHNlbGYucmVwb3J0LmRpZWQoKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICBpZiBzZWxmLnN0b3Bfc2lnbmFsICE9IFNJR05PTkU6CisgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYuc2lnd2FpdChzZWxmLnN0b3Bfc2lnbmFsKToKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYucmVwb3J0LmVuZChzZWxmLnJldHVybmNvZGUpCisgICAgICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJlcG9ydC5raWxsZWQoKQorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIHNlbGYuc2lnd2FpdChTSUdLSUxMKQorICAgICAgICBlbHNlOgorICAgICAgICAgICAgIyB0aGUgY2xpZW50IGlzIHN1cHBvc2VkIHRvIGV4aXQgbm9ybWFsbHkKKyAgICAgICAgICAgIGlmIHNlbGYucmV0dXJuY29kZSBpcyBub3QgTm9uZToKKyAgICAgICAgICAgICAgICBzZWxmLnJlcG9ydC5lbmQoc2VsZi5yZXR1cm5jb2RlKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICBzZWxmLnNpZ3dhaXQoU0lHS0lMTCkKKyAgICAgICAgICAgICAgICBzZWxmLnJlcG9ydC5raWxsZWQoKQorICAgICAgICBzZWxmLl9sb2cuZGVidWcoJ1t7MH1dIGV4aXRlZCB3aXRoIHJldHVybiBjb2RlIHsxfScuZm9ybWF0KHNlbGYucHJvYy5waWQsIHNlbGYucmV0dXJuY29kZSkpCisKKyAgICAjIFNlbmQgYSBzaWduYWwgdG8gdGhlIHByb2Nlc3MgYW5kIHRoZW4gd2FpdCBmb3IgaXQgdG8gZW5kCisgICAgIyBJZiB0aGUgc2lnbmFsIHJlcXVlc3RlZCBpcyBTSUdOT05FLCBubyBzaWduYWwgaXMgc2Vud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CisgICAgICAgICAgICBpZiB0ZXN0LnNvY2tldCA9PSAnZG9tYWluJzoKKyAgICAgICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5leGlzdHMoZG9tYWluX3NvY2tldF9wYXRoKHBvcnQpKToKKyAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdbezB9XSBkb21haW4odW5peCkgc29ja2V0IG5vdCBhdmFpbGFibGUgeWV0LiBzbGVwdCBmb3IgezF9IHNlY29uZHMgc28gZmFyJy5mb3JtYXQoc3YucHJvYy5waWQsIHNsZXB0KSkKKyAgICAgICAgICAgICAgICAgICAgdGltZS5zbGVlcChzbGVlcF9zdGVwKQorICAgICAgICAgICAgICAgICAgICBzbGVwdCArPSBzbGVlcF9zdGVwCisgICAgICAgICAgICBlbGlmIHRlc3Quc29ja2V0ID09ICdhYnN0cmFjdCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIFRydWUKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgIyBDcmVhdGUgc29ja2V0cyBldmVyeSBpdGVyYXRpb24gYmVjYXVzZSByZWZ1c2VkIHNvY2tldHMgY2Fubm90IGJlCisgICAgICAgICAgICAgICAgIyByZXVzZWQgb24gc29tZSBzeXN0ZW1zLgorICAgICAgICAgICAgICAgIHNvY2s0ID0gc29ja2V0LnNvY2tldCgpCisgICAgICAgICAgICAgICAgc29jazYgPSBzb2NrZXQuc29ja2V0KGZhbWlseT1zb2NrZXQuQUZfSU5FVDYpCisgICAgICAgICAgICAgICAgdHJ5OgorICAgICAgICAgICAgICAgICAgICBpZiBzb2NrNC5jb25uZWN0X2V4KCgnMTI3LjAuMC4xJywgcG9ydCkpID09IDAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yIHNvY2s2LmNvbm5lY3RfZXgoKCc6OjEnLCBwb3J0KSkgPT0gMDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUcnVlCisgICAgICAgICAgICAgICAgICAgIGlmIHN2LnByb2MucG9sbCgpIGlzIG5vdCBOb25lOgorICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oJ1t7MH1dIHNlcnZlciBwcm9jZXNzIGlzIGV4aXRlZCcuZm9ybWF0KHN2LnByb2MucGlkKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGYWxzZQorICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoJ1t7MH1dIHNvY2tldCBub3QgYXZhaWxhYmxlIHlldC4gc2xlcHQgZm9yIHsxfSBzZWNvbmRzIHNvIGZhcicuZm9ybWF0KHN2LnByb2MucGlkLCBzbGVwdCkpCisgICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoc2xlZXBfc3RlcCkKKyAgICAgICAgICAgICAgICAgICAgc2xlcHQgKz0gc2xlZXBfc3RlcAorICAgICAgICAgICAgICAgIGZpbmFsbHk6CisgICAgICAgICAgICAgICAgICAgIHNvY2s0LmNsb3NlKCkKKyAgICAgICAgICAgICAgICAgICAgc29jazYuY2xvc2UoKQorICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdbezB9XSBzZXJ2ZXIgcmVhZHkgLSB3YWl0ZWQgZm9yIHsxfSBzZWNvbmRzJy5mb3JtYXQoc3YucHJvYy5waWQsIHNsZXB0KSkKKyAgICAgICAgICAgIHJldHVybiBUcnVlCisKKyAgICB0cnk6CisgICAgICAgIG1heF9iaW5kX3JldHJ5ID0gMworICAgICAgICByZXRyeV9jb3VudCA9IDAKKyAgICAgICAgYmluZF9yZXRyeV9jb3VudCA9IDAKKyAgICAgICAgdGVzdCA9IFRlc3RFbnRyeSh0ZXN0ZGlyLCAqKnRlc3RfZGljdCkKKyAgICAgICAgd2hpbGUgVHJ1ZToKKyAgICAgICAgICAgIGlmIHN0b3AuaXNfc2V0KCk6CisgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdTa2lwcGluZyBiZWNhdXNlIHNodXR0aW5nIGRvd24nKQorICAgICAgICAgICAgICAgIHJldHVybiAocmV0cnlfY291bnQsIE5vbmUpCisgICAgICAgICAgICBsb2dnZXIuZGVidWcoJ1N0YXJ0JykKKyAgICAgICAgICAgIHdpdGggUG9ydEFsbG9jYXRvci5hbGxvY19wb3J0X3Njb3BlZChwb3J0cywgdGVzdC5zb2NrZXQpIGFzIHBvcnQ6CisgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdTdGFydCB3aXRoIHBvcnQgJWQnICUgcG9ydCkKKyAgICAgICAgICAgICAgICBzdiA9IGV4ZWNfY29udGV4dChwb3J0LCBsb2dkaXIsIHRlc3QsIHRlc3Quc2VydmVyLCBUcnVlKQorICAgICAgICAgICAgICAgIGNsID0gZXhlY19jb250ZXh0KHBvcnQsIGxvZ2RpciwgdGVzdCwgdGVzdC5jbGllbnQsIEZhbHNlKQorCisgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdTdGFydGluZyBzZXJ2ZXInKQorICAgICAgICAgICAgICAgIHdpdGggc3Yuc3RhcnQoKToKKyAgICAgICAgICAgICAgICAgICAgcG9ydF9vayA9IGVuc3VyZV9zb2NrZXRfb3BlbihzdiwgcG9ydCwgdGVzdCkKKyAgICAgICAgICAgICAgICAgICAgaWYgcG9ydF9vazoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbm5lY3RfcmV0cnlfY291bnQgPSAwCisgICAgICAgICAgICAgICAgICAgICAgICBtYXhfY29ubmVjdF9yZXRyeSA9IDEyCisgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0X3JldHJ5X3dhaXQgPSAwLjI1CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSBUcnVlOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIHN2LnByb2MucG9sbCgpIGlzIG5vdCBOb25lOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuaW5mbygnbm90IHN0YXJ0aW5nIGNsaWVudCBiZWNhdXNlIHNlcnZlciBwcm9jZXNzIGlzIGFic2VudCcpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKCdTdGFydGluZyBjbGllbnQnKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsLnN0YXJ0KCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoJ1dhaXRpbmcgY2xpZW50ICh1cCB0byAlZCBzZWNzKScgJSB0ZXN0LnRpbWVvdXQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2wud2FpdCh0ZXN0LnRpbWVvdXQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgbm90IGNsLnJlcG9ydC5tYXliZV9mYWxzZV9wb3NpdGl2ZSgpIG9yIGNvbm5lY3RfcmV0cnlfY291bnQgPj0gbWF4X2Nvbm5lY3RfcmV0cnk6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIGNvbm5lY3RfcmV0cnlfY291bnQgPiAwIGFuZCBjb25uZWN0X3JldHJ5X2NvdW50IDwgbWF4X2Nvbm5lY3RfcmV0cnk6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuaW5mbygnWyVzXTogQ29ubmVjdGVkIGFmdGVyICVkIHJldHJ5ICglLjJmIHNlYyBlYWNoKScgJSAodGVzdC5zZXJ2ZXIubmFtZSwgY29ubmVjdF9yZXRyeV9jb3VudCwgY29ubmVjdF9yZXRyeV93YWl0KSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIyBXYWl0IGZvciA1MG1zIHRvIHNlZSBpZiBzZXJ2ZXIgZG9lcyBub3QgZGllIGF0IHRoZSBlbmQuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWUuc2xlZXAoMC4wNSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoJ1NlcnZlciBtYXkgbm90IGJlIHJlYWR5LCB3YWl0aW5nICUuMmYgc2Vjb25kLi4uJyAlIGNvbm5lY3RfcmV0cnlfd2FpdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lLnNsZWVwKGNvbm5lY3RfcmV0cnlfd2FpdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0X3JldHJ5X2NvdW50ICs9IDEKKworICAgICAgICAgICAgaWYgc3YucmVwb3J0Lm1heWJlX2ZhbHNlX3Bvc2l0aXZlKCkgYW5kIGJpbmRfcmV0cnlfY291bnQgPCBtYXhfYmluZF9yZXRyeToKKyAgICAgICAgICAgICAgICBsb2dnZXIud2FybignWyVzXTogRGV0ZWN0ZWQgc29ja2V0IGJpbmQgZmFpbHVyZSwgcmV0cnlpbmcuLi4nLCB0ZXN0LnNlcnZlci5uYW1lKQorICAgICAgICAgICAgICAgIGJpbmRfcmV0cnlfY291bnQgKz0gMQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBSRVNVTFRfVElNRU9VVCBpZiBjbC5leHBpcmVkIGVsc2UgY2wucmV0dXJuY29kZSBpZiAoY2wucHJvYyBhbmQgY2wucHJvYy5wb2xsKCkpIGlzIG5vdCBOb25lIGVsc2UgUkVTVUxUX0VSUk9SCisKKyAgICAgICAgICAgICAgICAjIEZvciBzZXJ2ZXJzIHRoYXQgaGFuZGxlIGEgY29udHJvbGxlZCBzaHV0ZG93biBieSBzaWduYWwKKyAgICAgICAgICAgICAgICAjIGlmIHRoZXkgYXJlIGtpbGxlZCwgb3IgcmV0dXJuIGFuIGVycm9yIGNvZGUsIHRoYXQgaXMgYQorICAgICAgICAgICAgICAgICMgcHJvYmxlbS4gIEZvciBzZXJ2ZXJzIHRoYXQgYXJlIG5vdCBzaWduYWwtYXdhcmUsIHdlIHNpbXBseQorICAgICAgICAgICAgICAgICMga2lsbCB0aGVtIG9mZjsgaWYgd2UgZGlkbid0IGtpbGwgdGhlbSBvZmYsIHNvbWV0aGluZyBlbHNlCisgICAgICAgICAgICAgICAgIyBoYXBwZW5lZCAoY3Jhc2hlZD8pCisgICAgICAgICAgICAgICAgaWYgdGVzdC5zZXJ2ZXIuc3RvcF9zaWduYWwgIT0gMDoKKyAgICAgICAgICAgICAgICAgICAgaWYgc3Yua2lsbGVkIG9yIHN2LnJldHVybmNvZGUgPiAwOgorICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0IHw9IFJFU1VMVF9FUlJPUgorICAgICAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgICAgIGlmIG5vdCBzdi5raWxsZWQ6CisgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgfD0gUkVTVUxUX0VSUk9SCisKKyAgICAgICAgICAgICAgICBpZiByZXN1bHQgPT0gMCBvciByZXRyeV9jb3VudCA+PSBtYXhfcmV0cnk6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAocmV0cnlfY291bnQsIHJlc3VsdCkKKyAgICAgICAgICAgICAgICBlbHNlOgorICAgICAgICAgICAgICAgICAgICBsb2dnZXIuaW5mbygnWyVzLSVzXTogdGVzdCBmYWlsZWQsIHJldHJ5aW5nLi4uJywgdGVzdC5zZXJ2ZXIubmFtZSwgdGVzdC5jbGllbnQubmFtZSkKKyAgICAgICAgICAgICAgICAgICAgcmV0cnlfY291bnQgKz0gMQorICAgIGV4Y2VwdCBFeGNlcHRpb246CisgICAgICAgIGlmIG5vdCBhc3luY19tb2RlOgorICAgICAgICAgICAgcmFpc2UKKyAgICAgICAgbG9nZ2VyLndhcm4oJ0Vycm9yIGV4ZWN1dGluZyBbJXNdJywgdGVzdC5uYW1lLCBleGNfaW5mbz1UcnVlKQorICAgICAgICByZXR1cm4gKHJldHJ5X2NvdW50LCBSRVNVTFRfRVJST1IpCisgICAgZXhjZXB0OgorICAgICAgICBsb2dnZXIuaW5mbygnSW50ZXJydXB0ZWQgZXhlY3V0aW9uJywgZXhjX2luZm89VHJ1ZSkKKyAgICAgICAgaWYgbm90IGFzeW5jX21vZGU6CisgICAgICAgICAgICByYWlzZQorICAgICAgICBzdG9wLnNldCgpCisgICAgICAgIHJldHVybiAocmV0cnlfY291bnQsIFJFU1VMVF9FUlJPUikKKworCitjbGFzcyBQb3J0QWxsb2NhdG9yKG9iamVjdCk6CisgICAgZGVmIF9faW5pdF9fKHNlbGYpOgorICAgICAgICBzZWxmLl9sb2cgPSBtdWx0aXByb2Nlc3NpbmcuZ2V0X2xvZ2dlcigpCisgICAgICAgIHNlbGYuX2xvY2sgPSBtdWx0aXByb2Nlc3NpbmcuTG9jaygpCisgICAgICAgIHNlbGYuX3BvcnRzID0gc2V0KCkKKyAgICAgICAgc2VsZi5fZG9tX3BvcnRzID0gc2V0KCkKKyAgICAgICAgc2VsZi5fbGFzdF9hbGxvYyA9IDAKKworICAgIGRlZiBfZ2V0X3RjcF9wb3J0KHNlbGYpOgorICAgICAgICBzb2NrID0gc29ja2V0LnNvY2tldChzb2NrZXQuQUZfSU5FVCwgc29ja2V0LlNPQ0tfU1RSRUFNKQorICAgICAgICBzb2NrLnNldHNvY2tvcHQoc29ja2V0LlNPTF9TT0NLRVQsIHNvY2tldC5TT19SRVVTRUFERFIsIDEpCisgICAgICAgIHNvY2suYmluZCgoJycsIDApKQorICAgICAgICBwb3J0ID0gc29jay5nZXRzb2NrbmFtZSgpWzFdCisgICAgICAgIHNlbGYuX2xvY2suYWNxdWlyZSgpCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIG9rID0gcG9ydCBub3QgaW4gc2VsZi5fcG9ydHMKKyAgICAgICAgICAgIGlmIG9rOgorICAgICAgICAgICAgICAgIHNlbGYuX3BvcnRzLmFkZChwb3J0KQorICAgICAgICAgICAgICAgIHNlbGYuX2xhc3RfYWxsb2MgPSB0aW1lLnRpbWUoKQorICAgICAgICBmaW5hbGx5OgorICAgICAgICAgICAgc2VsZi5fbG9jay5yZWxlYXNlKCkKKyAgICAgICAgICAgIHNvY2suY2xvc2UoKQorICAgICAgICByZXR1cm4gcG9ydCBpZiBvayBlbHNlIHNlbGYuX2dldF90Y3BfcG9ydCgpCisKKyAgICBkZWYgX2dldF9kb21haW5fcG9ydChzZWxmKToKKyAgICAgICAgcG9ydCA9IHJhbmRvbS5yYW5kaW50KDEwMjQsIDY1NTM2KQorICAgICAgICBzZWxmLl9sb2NrLmFjcXVpcmUoKQorICAgICAgICB0cnk6CisgICAgICAgICAgICBvayA9IHBvcnQgbm90IGluIHNlbGYuX2RvbV9wb3J0cworICAgICAgICAgICAgaWYgb2s6CisgICAgICAgICAgICAgICAgc2VsZi5fZG9tX3BvcnRzLmFkZChwb3J0KQorICAgICAgICBmaW5hbGx5OgorICAgICAgICAgICAgc2VsZi5fbG9jay5yZWxlYXNlKCkKKyAgICAgICAgcmV0dXJuIHBvcnQgaWYgb2sgZWxzZSBzZWxmLl9nZXRfZG9tYWluX3BvcnQoKQorCisgICAgZGVmIGFsbG9jX3BvcnQoc2VsZiwgc29ja2V0X3R5cGUpOgorICAgICAgICBpZiBzb2NrZXRfdHlwZSBpbiAoJ2RvbWFpbicsICdhYnN0cmFjdCcpOgorICAgICAgICAgICAgcmV0dXJuIHNlbGYuX2dldF9kb21haW5fcG9ydCgpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICByZXR1cm4gc2VsZi5fZ2V0X3RjcF9wb3J0KCkKKworICAgICMgc3RhdGljIG1ldGhvZCBmb3IgaW50ZXItcHJvY2VzcyBpbnZva2F0aW9uCisgICAgQHN0YXRpY21ldGhvZAorICAgIEBjb250ZXh0bGliLmNvbnRleHRtYW5hZ2VyCisgICAgZGVmIGFsbG9jX3BvcnRfc2NvcGVkKGFsbG9jYXRvciwgc29ja2V0X3R5cGUpOgorICAgICAgICBwb3J0ID0gYWxsb2NhdG9yLmFsbG9jX3BvcnQoc29ja2V0X3R5cGUpCisgICAgICAgIHlpZWxkIHBvcnQKKyAgICAgICAgYWxsb2NhdG9yLmZyZWVfcG9ydChzb2NrZXRfdHlwZSwgcG9ydCkKKworICAgIGRlZiBmcmVlX3BvcnQoc2VsZiwgc29ja2V0X3R5cGUsIHBvcnQpOgorICAgICAgICBzZWxmLl9sb2cuZGVidWcoJ2ZyZWVfcG9ydCcpCisgICAgICAgIHNlbGYuX2xvY2suYWNxdWlyZSgpCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIGlmIHNvY2tldF90eXBlID09ICdkb21haW4nOgorICAgICAgICAgICAgICAgIHNlbGYuX2RvbV9wb3J0cy5yZW1vdmUocG9ydCkKKyAgICAgICAgICAgICAgICBwYXRoID0gZG9tYWluX3NvY2tldF9wYXRoKHBvcnQpCisgICAgICAgICAgICAgICAgaWYgb3MucGF0aC5leGlzdHMocGF0aCk6CisgICAgICAgICAgICAgICAgICAgIG9zLnJlbW92ZShwYXRoKQorICAgICAgICAgICAgZWxpZiBzb2NrZXRfdHlwZSA9PSAnYWJzdHJhY3QnOgorICAgICAgICAgICAgICAgIHNlbGYuX2RvbV9wb3J0cy5yZW1vdmUocG9ydCkKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgc2VsZi5fcG9ydHMucmVtb3ZlKHBvcnQpCisgICAgICAgIGV4Y2VwdCBJT0Vycm9yOgorICAgICAgICAgICAgc2VsZi5fbG9nLmluZm8oJ0Vycm9yIHdoaWxlIGZyZWVpbmcgcG9ydCcsIGV4Y19pbmZvPXN5cy5leGNfaW5mbygpKQorICAgICAgICBmaW5hbGx5OgorICAgICAgICAgICAgc2VsZi5fbG9jay5yZWxlYXNlKCkKKworCitjbGFzcyBOb25Bc3luY1Jlc3VsdChvYmplY3QpOgorICAgIGRlZiBfX2luaXRfXyhzZWxmLCB2YWx1ZSk6CisgICAgICAgIHNlbGYuX3ZhbHVlID0gdmFsdWUKKworICAgIGRlZiBnZXQoc2VsZiwgdGltZW91dD1Ob25lKToKKyAgICAgICAgcmV0dXJuIHNlbGYuX3ZhbHVlCis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2FzeW5jJykKKyAgICAgICAgcmV0dXJuIHNlbGYuX3Bvb2wuYXBwbHlfYXN5bmMoZnVuYz1ydW5fdGVzdCwgYXJncz0oc2VsZi50ZXN0ZGlyLCBzZWxmLmxvZ2RpciwgdGVzdCwgbWF4X3JldHJ5KSwgY2FsbGJhY2s9Y29udCkKKworICAgIGRlZiBkaXNwYXRjaChzZWxmLCB0ZXN0LCBtYXhfcmV0cnkpOgorICAgICAgICBpbmRleCA9IHNlbGYuX3JlcG9ydC5hZGRfdGVzdCh0ZXN0KQorCisgICAgICAgIGRlZiBjb250KHJlc3VsdCk6CisgICAgICAgICAgICBpZiBub3Qgc2VsZi5fc3RvcC5pc19zZXQoKToKKyAgICAgICAgICAgICAgICBpZiByZXN1bHQgYW5kIGxlbihyZXN1bHQpID09IDI6CisgICAgICAgICAgICAgICAgICAgIHJldHJ5X2NvdW50LCByZXR1cm5jb2RlID0gcmVzdWx0CisgICAgICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICAgICAgcmV0cnlfY291bnQgPSAwCisgICAgICAgICAgICAgICAgICAgIHJldHVybmNvZGUgPSBSRVNVTFRfRVJST1IKKyAgICAgICAgICAgICAgICBzZWxmLl9sb2cuZGVidWcoJ2ZyZWVpbmcgcG9ydCcpCisgICAgICAgICAgICAgICAgc2VsZi5fbG9nLmRlYnVnKCdhZGRpbmcgcmVzdWx0JykKKyAgICAgICAgICAgICAgICBzZWxmLl9yZXBvcnQuYWRkX3Jlc3VsdChpbmRleCwgcmV0dXJuY29kZSwgcmV0dXJuY29kZSA9PSBSRVNVTFRfVElNRU9VVCwgcmV0cnlfY291bnQpCisgICAgICAgICAgICAgICAgc2VsZi5fbG9nLmRlYnVnKCdmaW5pc2ggY29udGludWF0aW9uJykKKyAgICAgICAgZm4gPSBzZWxmLl9kaXNwYXRjaF9hc3luYyBpZiBzZWxmLl9hc3luYyBlbHNlIHNlbGYuX2Rpc3BhdGNoX3N5bmMKKyAgICAgICAgcmV0dXJuIG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20gLmNvbXBhdCBpbXBvcnQgcGF0aF9qb2luCitmcm9tIC51dGlsIGltcG9ydCBtZXJnZV9kaWN0LCBkb21haW5fc29ja2V0X3BhdGgKKworCitjbGFzcyBUZXN0UHJvZ3JhbShvYmplY3QpOgorICAgIGRlZiBfX2luaXRfXyhzZWxmLCBraW5kLCBuYW1lLCBwcm90b2NvbCwgdHJhbnNwb3J0LCBzb2NrZXQsIHdvcmtkaXIsIHN0b3Bfc2lnbmFsLCBjb21tYW5kLCBlbnY9Tm9uZSwKKyAgICAgICAgICAgICAgICAgZXh0cmFfYXJncz1bXSwgZXh0cmFfYXJnczI9W10sIGpvaW5fYXJncz1GYWxzZSwgKiprd2FyZ3MpOgorCisgICAgICAgIHNlbGYua2luZCA9IGtpbmQKKyAgICAgICAgc2VsZi5uYW1lID0gbmFtZQorICAgICAgICBzZWxmLnByb3RvY29sID0gcHJvdG9jb2wKKyAgICAgICAgc2VsZi50cmFuc3BvcnQgPSB0cmFuc3BvcnQKKyAgICAgICAgc2VsZi5zb2NrZXQgPSBzb2NrZXQKKyAgICAgICAgc2VsZi53b3JrZGlyID0gd29ya2RpcgorICAgICAgICBzZWxmLnN0b3Bfc2lnbmFsID0gc3RvcF9zaWduYWwKKyAgICAgICAgc2VsZi5jb21tYW5kID0gTm9uZQorICAgICAgICBzZWxmLl9iYXNlX2NvbW1hbmQgPSBzZWxmLl9maXhfY21kX3BhdGgoY29tbWFuZCkKKyAgICAgICAgaWYgZW52OgorICAgICAgICAgICAgc2VsZi5lbnYgPSBjb3B5LmNvcHkob3MuZW52aXJvbikKKyAgICAgICAgICAgIHNlbGYuZW52LnVwZGF0ZShlbnYpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBzZWxmLmVudiA9IG9zLmVudmlyb24KKyAgICAgICAgc2VsZi5fZXh0cmFfYXJncyA9IGV4dHJhX2FyZ3MKKyAgICAgICAgc2VsZi5fZXh0cmFfYXJnczIgPSBleHRyYV9hcmdzMgorICAgICAgICBzZWxmLl9qb2luX2FyZ3MgPSBqb2luX2FyZ3MKKworICAgIGRlZiBfZml4X2NtZF9wYXRoKHNlbGYsIGNtZCk6CisgICAgICAgICMgaWYgdGhlIGFyZyBpcyBhIGZpbGUgaW4gdGhlIGN1cnJlbnQgZGlyZWN0b3J5LCBtYWtlIGl0IHBhdGgKKyAgICAgICAgZGVmIGFic19pZl9leGlzdHMoYXJnKToKKyAgICAgICAgICAgIHAgPSBwYXRoX2pvaW4oc2VsZi53b3JrZGlyLCBhcmcpCisgICAgICAgICAgICByZXR1cm4gcCBpZiBvcy5wYXRoLmV4aXN0cyhwKSBlbHNlIGFyZworCisgICAgICAgIGlmIGNtZFswXSA9PSAncHl0aG9uJzoKKyAgICAgICAgICAgIGNtZFswXSA9IHN5cy5leGVjdXRhYmxlCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBjbWRbMF0gPSBhYnNfaWZfZXhpc3RzKGNtZFswXSkKKyAgICAgICAgcmV0dXJuIGNtZAorCisgICAgZGVmIF9zb2NrZXRfYXJncyhzZWxmLCBzb2NrZXQsIHBvcnQpOgorICAgICAgICByZXR1cm4geworICAgICAgICAgICAgJ2lwLXNzbCc6IFsnLS1zc2wnXSwKKyAgICAgICAgICAgICdkb21haW4nOiBbJy0tZG9tYWluLXNvY2tldD0lcycgJSBkb21haW5fc29ja2V0X3BhdGgocG9ydCldLAorICAgICAgICAgICAgJ2Fic3RyYWN0JzogWyctLWFic3RyYWN0LW5hbWVzcGFjZScsICctLWRvbWFpbi1zb2NrZXQ9JXMnICUgZG9tYWluX3NvY2tldF9wYXRoKHBvcnQpXSwKKyAgICAgICAgfS5nZXQoc29ja2V0LCBOb25lKQorCisgICAgZGVmIF90cmFuc3BvcnRfYXJncyhzZWxmLCB0cmFuc3BvcnQpOgorICAgICAgICByZXR1cm4geworICAgICAgICAgICAgJ3psaWInOiBbJy0temxpYiddLAorICAgICAgICB9LmdldCh0cmFuc3BvcnQsIE5vbmUpCisKKyAgICBkZWYgYnVpbGRfY29tbWFuZChzZWxmLCBwb3J0KToKKyAgICAgICAgY21kID0gY29weS5jb3B5KHNlbGYuX2Jhc2VfY29tbWFuZCkKKyAgICAgICAgYXJncyA9IGNvcHkuY29weShzZWxmLl9leHRyYV9hcmdzMikKKyAgICAgICAgYXJncy5hcHBlbmQoJy0tcHJvdG9jb2w9JyArIHNlbGYucHJvdG9jb2wpCisgICAgICAgIGFyZ3MuYXBwZW5kKCctLXRyYW5zcG9ydD0nICsgc2VsZi50cmFuc3BvcnQpCisgICAgICAgIHRyYW5zcG9ydF9hcmdzID0gc2VsZi5fdHJhbnNwb3J0X2FyZ3Moc2VsZi50cmFuc3BvcnQpCisgICAgICAgIGlmIHRyYW5zcG9ydF9hcmdzOgorICAgICAgICAgICAgYXJncyArPSB0cmFuc3BvcnRfYXJncworICAgICAgICBzb2NrZXRfYXJncyA9IHNlbGYuX3NvY2tldF9hcmdzKHNlbGYuc29ja2V0LCBwb3J0KQorICAgICAgICBpZiBzb2NrZXRfYXJnczoKKyAgICAgICAgICAgIGFyZ3MgKz0gc29ja2V0X2FyZ3MKKyAgICAgICAgYXJncy5hcHBlbmQoJy0tcG9ydD0lZCcgJSBwb3J0KQorICAgICAgICBpZiBzZWxmLl9qb2luX2FyZ3M6CisgICAgICAgICAgICBjbWQuYXBwZW5kKCclcycgJSAiICIuam9pbihhcmdzKSkKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIGNtZC5leHRlbmQoYXJncykKKyAgICAgICAgaWYgc2VsZi5fZXh0cmFfYXJnczoKKyAgICAgICAgICAgIGNtZC5leHRlbmQoc2VsZi5fZXh0cmFfYXJncykKKyAgICAgICAgc2VsZi5jb21tYW5kID0gY21kCisgICAgICAgIHJldHVybiBzZWxmLmNvbW1hbmQKKworCitjbGFzcyBUZXN0RW50cnkob2JqZWN0KToKKyAgICBkZWYgX19pbml0X18oc2VsZiwgdGVzdGRpciwgc2VydmVyLCBjbGllbnQsIGRlbGF5LCB0aW1lb3V0LCAqKmt3YXJ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ICAgICAgICBzZWxmLmV4cGlyZWQgPSBGYWxzZQorICAgICAgICBzZWxmLnJldHJ5X2NvdW50ID0gMAorCisgICAgZGVmIF9maXhfd29ya2RpcihzZWxmLCBjb25maWcpOgorICAgICAgICBrZXkgPSAnd29ya2RpcicKKyAgICAgICAgcGF0aCA9IGNvbmZpZy5nZXQoa2V5LCBOb25lKQorICAgICAgICBpZiBub3QgcGF0aDoKKyAgICAgICAgICAgIHBhdGggPSBzZWxmLnRlc3RkaXIKKyAgICAgICAgaWYgb3MucGF0aC5pc2FicyhwYXRoKToKKyAgICAgICAgICAgIHBhdGggPSBvcy5wYXRoLnJlYWxwYXRoKHBhdGgpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBwYXRoID0gb3MucGF0aC5yZWFscGF0aChwYXRoX2pvaW4oc2VsZi50ZXN0ZGlyLCBwYXRoKSkKKyAgICAgICAgY29uZmlnLnVwZGF0ZSh7a2V5OiBwYXRofSkKKyAgICAgICAgcmV0dXJuIGNvbmZpZworCisgICAgQGNsYXNzbWV0aG9kCisgICAgZGVmIGdldF9uYW1lKGNscywgc2VydmVyLCBjbGllbnQsIHByb3RvY29sLCB0cmFuc3BvcnQsIHNvY2tldCwgKmFyZ3MsICoqa3dhcmdzKToKKyAgICAgICAgcmV0dXJuICclcy0lc18lc18lcy0lcycgJSAoc2VydmVyLCBjbGllbnQsIHByb3RvY29sLCB0cmFuc3BvcnQsIHNvY2tldCkKKworICAgIEBwcm9wZXJ0eQorICAgIGRlZiBuYW1lKHNlbGYpOgorICAgICAgICBpZiBub3Qgc2VsZi5fbmFtZToKKyAgICAgICAgICAgIHNlbGYuX25hbWUgPSBzZWxmLmdldF9uYW1lKAorICAgICAgICAgICAgICAgIHNlbGYuc2VydmVyLm5hbWUsIHNlbGYuY2xpZW50Lm5hbWUsIHNlbGYucHJvdG9jb2wsIHNlbGYudHJhbnNwb3J0LCBzZWxmLnNvY2tldCkKKyAgICAgICAgcmV0dXJuIHNlbGYuX25hbWUKK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XR1cm4gLTE7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuU2V0QnVmZmVyU2l6ZShDb25zb2xlLkJ1ZmZlcldpZHRoLCA0MDk2KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkZhaWxlZCB0byBncm93IHNjcm9sbC1iYWNrIGJ1ZmZlciIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzdHJpbmdbXSBzdWJBcmdzID0gbmV3IHN0cmluZ1thcmdzLkxlbmd0aCAtIDFdOworICAgICAgICAgICAgZm9yKGludCBpID0gMTsgaSA8IGFyZ3MuTGVuZ3RoOyBpKyspCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3ViQXJnc1tpLTFdID0gYXJnc1tpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChhcmdzWzBdID09ICJjbGllbnQiKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBUZXN0Q2xpZW50LkV4ZWN1dGUoc3ViQXJncyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChhcmdzWzBdID09ICJzZXJ2ZXIiKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldHVybiBUZXN0U2VydmVyLkV4ZWN1dGUoc3ViQXJncykgPyAwIDogMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiZmlyc3QgYXJndW1lbnQgbXVzdCBiZSAnc2VydmVyJyBvciAnY2xpZW50JyIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZm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mcgdXJsOworICAgICAgICAgICAgcHVibGljIHN0cmluZyBwaXBlOworICAgICAgICAgICAgcHVibGljIGJvb2wgYnVmZmVyZWQ7CisgICAgICAgICAgICBwdWJsaWMgYm9vbCBmcmFtZWQ7CisgICAgICAgICAgICBwdWJsaWMgc3RyaW5nIHByb3RvY29sOworICAgICAgICAgICAgcHVibGljIGJvb2wgZW5jcnlwdGVkID0gZmFsc2U7CisgICAgICAgICAgICBwdWJsaWMgYm9vbCBtdWx0aXBsZXhlZCA9IGZhbHNlOworICAgICAgICAgICAgcHJvdGVjdGVkIGJvb2wgX2lzRmlyc3RUcmFuc3BvcnQgPSB0cnVlOworCisKKyAgICAgICAgICAgIHB1YmxpYyBUVHJhbnNwb3J0IENyZWF0ZVRyYW5zcG9ydCgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKHVybCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gZW5kcG9pbnQgdHJhbnNwb3J0CisgICAgICAgICAgICAgICAgICAgIFRUcmFuc3BvcnQgdHJhbnMgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBpZiAocGlwZSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVE5hbWVkUGlwZUNsaWVudFRyYW5zcG9ydChwaXBlKTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW5jcnlwdGVkKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjZXJ0UGF0aCA9ICIuLi9rZXlzL2NsaWVudC5wMTIiOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFg1MDlDZXJ0aWZpY2F0ZSBjZXJ0ID0gbmV3IFg1MDlDZXJ0aWZpY2F0ZTIoY2VydFBhdGgsICJ0aHJpZnQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUVExTU29ja2V0KGhvc3QsIHBvcnQsIDAsIGNlcnQsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobywgYywgY2hhaW4sIGVycm9ycykgPT4gdHJ1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIFNzbFByb3RvY29scy5UbHMpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRTb2NrZXQoaG9zdCwgcG9ydCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBsYXllcmVkIHRyYW5zcG9ydAorICAgICAgICAgICAgICAgICAgICBpZiAoYnVmZmVyZWQpCisgICAgICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnQodHJhbnMpOworICAgICAgICAgICAgICAgICAgICBpZiAoZnJhbWVkKQorICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVEZyYW1lZFRyYW5zcG9ydCh0cmFucyk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKF9pc0ZpcnN0VHJhbnNwb3J0KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvL2Vuc3VyZSBwcm9wZXIgb3Blbi9jbG9zZSBvZiB0cmFuc3BvcnQKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zLk9wZW4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zLkNsb3NlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBfaXNGaXJzdFRyYW5zcG9ydCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cmFuczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUSHR0cENsaWVudChuZXcgVXJpKHVybCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRQcm90b2NvbCBDcmVhdGVQcm90b2NvbChUVHJhbnNwb3J0IHRyYW5zcG9ydCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAocHJvdG9jb2wgPT0gImNvbXBhY3QiKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRDb21wYWN0UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICBlbHNlIGlmIChwcm90b2NvbCA9PSAianNvbiIpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVEpTT05Qcm90b2NvbCh0cmFuc3BvcnQpOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworICAgICAgICBwcml2YXRlIGNvbnN0IGludCBFcnJvckJhc2VUeXBlcyA9IDE7CisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IEVycm9yU3RydWN0cyA9IDI7CisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IEVycm9yQ29udGFpbmVycyA9IDQ7CisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IEVycm9yRXhjZXB0aW9ucyA9IDg7CisgICAgICAgIHByaXZhdGUgY29uc3QgaW50IEVycm9yUHJvdG9jb2wgPSAxNjsKKyAgICAgICAgcHJpdmF0ZSBjb25zdCBpbnQgRXJyb3JVbmtub3duID0gNjQ7CisKKyAgICAgICAgcHJpdmF0ZSBjbGFzcyBDbGllbnRUZXN0CisgICAgICAgIHsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgVGVzdFBhcmFtcyBwYXJhbTsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgVFRyYW5zcG9ydCB0cmFuc3BvcnQ7CisgICAgICAgICAgICBwcml2YXRlIHJlYWRvbmx5IFNlY29uZFNlcnZpY2UuQ2xpZW50IHNlY29uZDsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgVGhyaWZ0VGVzdC5DbGllbnQgY2xpZW50OworICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBpbnQgbnVtSXRlcmF0aW9uczsKKyAgICAgICAgICAgIHByaXZhdGUgYm9vbCBkb25lOworCisgICAgICAgICAgICBwdWJsaWMgaW50IFJldHVybkNvZGUgeyBnZXQ7IHNldDsgfQorCisgICAgICAgICAgICBwdWJsaWMgQ2xpZW50VGVzdChUZXN0UGFyYW1zIHBhcmFtaW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcGFyYW0gPSBwYXJhbWluOworICAgICAgICAgICAgICAgIHRyYW5zcG9ydCA9IHBhcmFtLkNyZWF0ZVRyYW5zcG9ydCgpOworICAgICAgICAgICAgICAgIFRQcm90b2NvbCBwcm90b2NvbCA9IHBhcmFtLkNyZWF0ZVByb3RvY29sKHRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgaWYgKHBhcmFtLm11bHRpcGxleGVkKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgc2Vjb25kID0gbmV3IFNlY29uZFNlcnZpY2UuQ2xpZW50KG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChwcm90b2NvbCwgIlNlY29uZFNlcnZpY2UiKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNsaWVudCA9IG5ldyBUaHJpZnRUZXN0LkNsaWVudChwcm90b2NvbCk7CisgICAgICAgICAgICAgICAgbnVtSXRlcmF0aW9ucyA9IHBhcmFtLm51bUl0ZXJhdGlvbnM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBFeGVjdXRlKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZG9uZSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJFeGVjdXRlIGNhbGxlZCBtb3JlIHRoYW4gb25jZSIpOworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtSXRlcmF0aW9uczsgaSsrKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdHJhbnNwb3J0LklzT3BlbikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc3BvcnQuT3BlbigpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChUVHJhbnNwb3J0RXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJDb25uZWN0IGZhaWxlZDogIiArIGV4Lk1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICAgICAgUmV0dXJuQ29kZSB8PSBFcnJvclVua25vd247CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgUmV0dXJuQ29kZSB8PSBFeGVjdXRlQ2xpZW50VGVzdChjbGllbnQsIHNlY29uZCwgcGFyYW0pOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFJldHVybkNvZGUgfD0gRXJyb3JVbmtub3duOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJFcnJvciB3aGlsZSBjbG9zaW5nIHRyYW5zcG9ydCIpOworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IEV4ZWN1dGUoc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgVGVzdFBhcmFtcyBwYXJhbSA9IG5ldyBUZXN0UGFyYW1zKCk7CisgICAgICAgICAgICAgICAgaW50IG51bVRocmVhZHMgPSAxOworICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBhcmdzLkxlbmd0aDsgaSsrKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJnc1tpXSA9PSAiLXUiKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLnVybCA9IGFyZ3NbKytpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi1uIikKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbS5udW1JdGVyYXRpb25zID0gQ29udmVydC5Ub0ludDMyKGFyZ3NbKytpXSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItcGlwZSIpICAvLyAtcGlwZSA8bmFtZT4KKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbS5waXBlID0gYXJnc1srK2ldOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBuYW1lZCBwaXBlcyB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0uQ29udGFpbnMoIi0taG9zdD0iKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbS5ob3N0ID0gYXJnc1tpXS5TdWJzdHJpbmcoYXJnc1tpXS5JbmRleE9mKCI9IikgKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0uQ29udGFpbnMoIi0tcG9ydD0iKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbS5wb3J0ID0gaW50LlBhcnNlKGFyZ3NbaV0uU3Vic3RyaW5nKGFyZ3NbaV0uSW5kZXhPZigiPSIpKzEpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi1iIiB8fCBhcmdzW2ldID09ICItLWJ1ZmZlcmVkIiB8fCBhcmdzW2ldID09ICItLXRyYW5zcG9ydD1idWZmZXJlZCIpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uYnVmZmVyZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBidWZmZXJlZCBzb2NrZXRzIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItZiIgfHwgYXJnc1tpXSA9PSAiLS1mcmFtZWQiICB8fCBhcmdzW2ldID09ICItLXRyYW5zcG9ydD1mcmFtZWQiKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLmZyYW1lZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlVzaW5nIGZyYW1lZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi10IikKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1UaHJlYWRzID0gQ29udmVydC5Ub0ludDMyKGFyZ3NbKytpXSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLWNvbXBhY3QiIHx8IGFyZ3NbaV0gPT0gIi0tcHJvdG9jb2w9Y29tcGFjdCIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1tdWx0aWMiKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLnByb3RvY29sID0gImNvbXBhY3QiOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBjb21wYWN0IHByb3RvY29sIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLWpzb24iIHx8IGFyZ3NbaV0gPT0gIi0tcHJvdG9jb2w9anNvbiIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1tdWx0aWoiKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLnByb3RvY29sID0gImpzb24iOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBKU09OIHByb3RvY29sIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLXNzbCIpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uZW5jcnlwdGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNpbmcgZW5jcnlwdGVkIHRyYW5zcG9ydCIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJnc1tpXS5TdGFydHNXaXRoKCItLXByb3RvY29sPW11bHRpIikpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0ubXVsdGlwbGV4ZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkVycm9yIHdoaWxlICBwYXJzaW5nIGFyZ3VtZW50cyIpOworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gRXJyb3JVbmtub3duOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHZhciB0ZXN0cyA9IEVudW1lcmFibGUuUmFuZ2UoMCwgbnVtVGhyZWFkcykuU2VsZWN0KF8gPT4gbmV3IENsaWVudFRlc3QocGFyYW0pKS5Ub0FycmF5KCk7CisgICAgICAgICAgICAgICAgLy9pc3N1ZSB0ZXN0cyBvbiBzZXBhcmF0ZSB0aHJlYWRzIHNpbXVsdGFuZW91c2x5CisgICAgICAgICAgICAgICAgdmFyIHRocmVhZHMgPSB0ZXN0cy5TZWxlY3QodGVzdCA9PiBuZXcgVGhyZWFkKHRlc3QuRXhlY3V0ZSkpLlRvQXJyYXkoKTsKKyAgICAgICAgICAgICAgICBEYXRlVGltZSBzdGFydCA9IERhdGVUaW1lLk5vdzsKKyAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIgdCBpbiB0aHJlYWRzKQorICAgICAgICAgICAgICAgICAgICB0LlN0YXJ0KCk7CisgICAgICAgICAgICAgICAgZm9yZWFjaCAodmFyIHQgaW4gdGhyZWFkcykKKyAgICAgICAgICAgICAgICAgICAgdC5Kb2luKCk7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlRvdGFsIHRpbWU6ICIgKyAoRGF0ZVRpbWUuTm93IC0gc3RhcnQpKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgpOworICAgICAgICAgICAgICAgIHJldHVybiB0ZXN0cy5TZWxlY3QodCA9PiB0LlJldHVybkNvZGUpLkFnZ3JlZ2F0ZSgocjEsIHIyKSA9PiByMSB8IHIyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gb3V0ZXJFeCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVW5leHBlY3RlZCBlcnJvciIpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKG91dGVyRXguTWVzc2FnZSArICIgU1Q6ICIgKyBvdXRlckV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgIHJldHVybiBFcnJvclVua25vd247CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIHN0cmluZyBCeXRlc1RvSGV4KGJ5dGVbXSBkYXRhKSB7CisgICAgICAgICAgICByZXR1cm4gQml0Q29udmVydGVyLlRvU3RyaW5nKGRhdGEpLlJlcGxhY2UoIi0iLCBzdHJpbmcuRW1wdHkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBieXRlW10gUHJlcGFyZVRlc3REYXRhKGJvb2wgcmFuZG9tRGlzdCwgYm9vbCBodWdlKQorICAgICAgICB7CisgICAgICAgICAgICAvLyBodWdlID0gdHJ1ZSB0ZXN0cyBmb3IgVEhSSUZULTQzNzIKKyAgICAgICAgICAgIGJ5dGVbXSByZXR2YWwgPSBuZXcgYnl0ZVtodWdlID8gMHgxMjM0NSA6IDB4MTAwXTsKKyAgICAgICAgICAgIGludCBpbml0TGVuID0gcmV0dmFsLkxlbmd0aDsKKworICAgICAgICAgICAgLy8gbGluZWFyIGRpc3RyaWJ1dGlvbiwgdW5sZXNzIHJhbmRvbSBpcyByZXF1ZXN0ZWQKKyAgICAgICAgICAgIGlmICghcmFuZG9tRGlzdCkgeworICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdExlbjsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHZhbFtpXSA9IChieXRlKWk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiByZXR2YWw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHJhbmRvbSBkaXN0cmlidXRpb24KKyAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdExlbjsgKytpKSB7CisgICAgICAgICAgICAgICAgcmV0dmFsW2ldID0gKGJ5dGUpMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZhciBybmQgPSBuZXcgUmFuZG9tKCk7CisgICAgICAgICAgICBmb3IgKHZhciBpID0gMTsgaSA8IGluaXRMZW47ICsraSkgeworICAgICAgICAgICAgICAgIHdoaWxlKCB0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXh0UG9zID0gcm5kLk5leHQoKSAlIGluaXRMZW47CisgICAgICAgICAgICAgICAgICAgIGlmIChyZXR2YWxbbmV4dFBvc10gPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dmFsW25leHRQb3NdID0gKGJ5dGUpaTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHJldHZhbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IEV4ZWN1dGVDbGllbnRUZXN0KFRocmlmdFRlc3QuQ2xpZW50IGNsaWVudCwgU2Vjb25kU2VydmljZS5DbGllbnQgc2Vjb25kLCBUZXN0UGFyYW1zIHBhcmFtKQorICAgICAgICB7CisgICAgICAgICAgICBpbnQgcmV0dXJuQ29kZSA9IDA7CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RWb2lkKCkiKTsKKyAgICAgICAgICAgIGNsaWVudC50ZXN0Vm9pZCgpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9IHZvaWQiKTsKKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdFN0cmluZyhcIlRlc3RcIikiKTsKKyAgICAgICAgICAgIHN0cmluZyBzID0gY2xpZW50LnRlc3RTdHJpbmcoIlRlc3QiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSBcIiIgKyBzICsgIlwiIik7CisgICAgICAgICAgICBpZiAoIlRlc3QiICE9IHMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHBhcmFtLm11bHRpcGxleGVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJzZWNvbmRUZXN0U3RyaW5nKFwiVGVzdDJcIikiKTsKKyAgICAgICAgICAgICAgICBzID0gc2Vjb25kLnNlY29uZHRlc3RTdHJpbmcoIlRlc3QyIik7CisgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSBcIiIgKyBzICsgIlwiIik7CisgICAgICAgICAgICAgIGlmICgidGVzdFN0cmluZyhcIlRlc3QyXCIpIiAhPSBzKQorICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JQcm90b2NvbDsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0Qm9vbCh0cnVlKSIpOworICAgICAgICAgICAgYm9vbCB0ID0gY2xpZW50LnRlc3RCb29sKChib29sKXRydWUpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyB0KTsKKyAgICAgICAgICAgIGlmICghdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEJvb2woZmFsc2UpIik7CisgICAgICAgICAgICBib29sIGYgPSBjbGllbnQudGVzdEJvb2woKGJvb2wpZmFsc2UpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyBmKTsKKyAgICAgICAgICAgIGlmIChmKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RCeXRlKDEpIik7CisgICAgICAgICAgICBzYnl0ZSBpOCA9IGNsaWVudC50ZXN0Qnl0ZSgoc2J5dGUpMSk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIGk4KTsKKyAgICAgICAgICAgIGlmICgxICE9IGk4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RJMzIoLTEpIik7CisgICAgICAgICAgICBpbnQgaTMyID0gY2xpZW50LnRlc3RJMzIoLTEpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyBpMzIpOworICAgICAgICAgICAgaWYgKC0xICE9IGkzMikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0STY0KC0zNDM1OTczODM2OCkiKTsKKyAgICAgICAgICAgIGxvbmcgaTY0ID0gY2xpZW50LnRlc3RJNjQoLTM0MzU5NzM4MzY4KTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgaTY0KTsKKyAgICAgICAgICAgIGlmICgtMzQzNTk3MzgzNjggIT0gaTY0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3REb3VibGUoNS4zMjUwOTgyMzUpIik7CisgICAgICAgICAgICBkb3VibGUgZHViID0gY2xpZW50LnRlc3REb3VibGUoNS4zMjUwOTgyMzUpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyBkdWIpOworICAgICAgICAgICAgaWYgKDUuMzI1MDk4MjM1ICE9IGR1YikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdERvdWJsZSgtMC4wMDAzNDEwMTI0Mzk2Mzg1OTgyNzkpIik7CisgICAgICAgICAgICBkdWIgPSBjbGllbnQudGVzdERvdWJsZSgtMC4wMDAzNDEwMTI0Mzk2Mzg1OTgyNzkpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyBkdWIpOworICAgICAgICAgICAgaWYgKC0wLjAwMDM0MTAxMjQzOTYzODU5ODI3OSAhPSBkdWIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZm9yIChpMzIgPSAwOyBpMzIgPCAyOyArK2kzMikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgaHVnZSA9IChpMzIgPiAwKTsKKyAgICAgICAgICAgICAgICBieXRlW10gYmluT3V0ID0gUHJlcGFyZVRlc3REYXRhKGZhbHNlLGh1Z2UpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RCaW5hcnkoIiArIEJ5dGVzVG9IZXgoYmluT3V0KSArICIpIik7CisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBieXRlW10gYmluSW4gPSBjbGllbnQudGVzdEJpbmFyeShiaW5PdXQpOworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIEJ5dGVzVG9IZXgoYmluSW4pKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJpbkluLkxlbmd0aCAhPSBiaW5PdXQuTGVuZ3RoKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgb2ZzID0gMDsgb2ZzIDwgTWF0aC5NaW4oYmluSW4uTGVuZ3RoLCBiaW5PdXQuTGVuZ3RoKTsgKytvZnMpCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmluSW5bb2ZzXSAhPSBiaW5PdXRbb2ZzXSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoVGhyaWZ0LlRBcHBsaWNhdGlvbkV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gYmluYXJ5IGVxdWFscz8gb25seSB3aXRoIGhhc2hjb2RlIG9wdGlvbiBlbmFibGVkIC4uLgorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlRlc3QgQ3JhenlOZXN0aW5nIik7CisgICAgICAgICAgICBpZiggdHlwZW9mKENyYXp5TmVzdGluZykuR2V0TWV0aG9kKCJFcXVhbHMiKS5EZWNsYXJpbmdUeXBlID09IHR5cGVvZihDcmF6eU5lc3RpbmcpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENyYXp5TmVzdGluZyBvbmUgPSBuZXcgQ3JhenlOZXN0aW5nKCk7CisgICAgICAgICAgICAgICAgQ3JhenlOZXN0aW5nIHR3byA9IG5ldyBDcmF6eU5lc3RpbmcoKTsKKyAgICAgICAgICAgICAgICBvbmUuU3RyaW5nX2ZpZWxkID0gImNyYXp5IjsKKyAgICAgICAgICAgICAgICB0d28uU3RyaW5nX2ZpZWxkID0gImNyYXp5IjsKKyAgICAgICAgICAgICAgICBvbmUuQmluYXJ5X2ZpZWxkID0gbmV3IGJ5dGVbMTBdIHsgMHgwMCwgMHgwMSwgMHgwMiwgMHgwNCwgMHgwOCwgMHgxMCwgMHgyMCwgMHg0MCwgMHg4MCwgMHhGRiB9OworICAgICAgICAgICAgICAgIHR3by5CaW5hcnlfZmllbGQgPSBuZXcgYnl0ZVsxMF0geyAweDAwLCAweDAxLCAweDAyLCAweDA0LCAweDA4LCAweDEwLCAweDIwLCAweDQwLCAweDgwLCAweEZGIH07CisgICAgICAgICAgICAgICAgaWYgKCFvbmUuRXF1YWxzKHR3bykpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckNvbnRhaW5lcnM7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oIkNyYXp5TmVzdGluZy5FcXVhbHMgZmFpbGVkIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBUT0RPOiBWYWxpZGF0ZSByZWNlaXZlZCBtZXNzYWdlCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0U3RydWN0KHtcIlplcm9cIiwgMSwgLTMsIC01fSkiKTsKKyAgICAgICAgICAgIFh0cnVjdCBvID0gbmV3IFh0cnVjdCgpOworICAgICAgICAgICAgby5TdHJpbmdfdGhpbmcgPSAiWmVybyI7CisgICAgICAgICAgICBvLkJ5dGVfdGhpbmcgPSAoc2J5dGUpMTsKKyAgICAgICAgICAgIG8uSTMyX3RoaW5nID0gLTM7CisgICAgICAgICAgICBvLkk2NF90aGluZyA9IC01OworICAgICAgICAgICAgWHRydWN0IGkgPSBjbGllbnQudGVzdFN0cnVjdChvKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSB7XCIiICsgaS5TdHJpbmdfdGhpbmcgKyAiXCIsICIgKyBpLkJ5dGVfdGhpbmcgKyAiLCAiICsgaS5JMzJfdGhpbmcgKyAiLCAiICsgaS5JNjRfdGhpbmcgKyAifSIpOworCisgICAgICAgICAgICAvLyBUT0RPOiBWYWxpZGF0ZSByZWNlaXZlZCBtZXNzYWdlCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0TmVzdCh7MSwge1wiWmVyb1wiLCAxLCAtMywgLTV9LCA1fSkiKTsKKyAgICAgICAgICAgIFh0cnVjdDIgbzIgPSBuZXcgWHRydWN0MigpOworICAgICAgICAgICAgbzIuQnl0ZV90aGluZyA9IChzYnl0ZSkxOworICAgICAgICAgICAgbzIuU3RydWN0X3RoaW5nID0gbzsKKyAgICAgICAgICAgIG8yLkkzMl90aGluZyA9IDU7CisgICAgICAgICAgICBYdHJ1Y3QyIGkyID0gY2xpZW50LnRlc3ROZXN0KG8yKTsKKyAgICAgICAgICAgIGkgPSBpMi5TdHJ1Y3RfdGhpbmc7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0geyIgKyBpMi5CeXRlX3RoaW5nICsgIiwge1wiIiArIGkuU3RyaW5nX3RoaW5nICsgIlwiLCAiICsgaS5CeXRlX3RoaW5nICsgIiwgIiArIGkuSTMyX3RoaW5nICsgIiwgIiArIGkuSTY0X3RoaW5nICsgIn0sICIgKyBpMi5JMzJfdGhpbmcgKyAifSIpOworCisgICAgICAgICAgICBEaWN0aW9uYXJ5PGludCwgaW50PiBtYXBvdXQgPSBuZXcgRGljdGlvbmFyeTxpbnQsIGludD4oKTsKKyAgICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgNTsgaisrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG1hcG91dFtqXSA9IGogLSAxMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RNYXAoeyIpOworICAgICAgICAgICAgYm9vbCBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICBmb3JlYWNoIChpbnQga2V5IGluIG1hcG91dC5LZXlzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiwgIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoa2V5ICsgIiA9PiAiICsgbWFwb3V0W2tleV0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSkiKTsKKworICAgICAgICAgICAgRGljdGlvbmFyeTxpbnQsIGludD4gbWFwaW4gPSBjbGllbnQudGVzdE1hcChtYXBvdXQpOworCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIgPSB7Iik7CisgICAgICAgICAgICBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICBmb3JlYWNoIChpbnQga2V5IGluIG1hcGluLktleXMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiLCAiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrZXkgKyAiID0+ICIgKyBtYXBpbltrZXldKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ9Iik7CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIExpc3Q8aW50PiBsaXN0b3V0ID0gbmV3IExpc3Q8aW50PigpOworICAgICAgICAgICAgZm9yIChpbnQgaiA9IC0yOyBqIDwgMzsgaisrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxpc3RvdXQuQWRkKGopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdExpc3QoeyIpOworICAgICAgICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgZm9yZWFjaCAoaW50IGogaW4gbGlzdG91dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKGopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSkiKTsKKworICAgICAgICAgICAgTGlzdDxpbnQ+IGxpc3RpbiA9IGNsaWVudC50ZXN0TGlzdChsaXN0b3V0KTsKKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiID0geyIpOworICAgICAgICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgZm9yZWFjaCAoaW50IGogaW4gbGlzdGluKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiwgIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoaik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgifSIpOworCisgICAgICAgICAgICAvL3NldAorICAgICAgICAgICAgLy8gVE9ETzogVmFsaWRhdGUgcmVjZWl2ZWQgbWVzc2FnZQorICAgICAgICAgICAgVEhhc2hTZXQ8aW50PiBzZXRvdXQgPSBuZXcgVEhhc2hTZXQ8aW50PigpOworICAgICAgICAgICAgZm9yIChpbnQgaiA9IC0yOyBqIDwgMzsgaisrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNldG91dC5BZGQoaik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0U2V0KHsiKTsKKyAgICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvcmVhY2ggKGludCBqIGluIHNldG91dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKGopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSkiKTsKKworICAgICAgICAgICAgVEhhc2hTZXQ8aW50PiBzZXRpbiA9IGNsaWVudC50ZXN0U2V0KHNldG91dCk7CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiA9IHsiKTsKKyAgICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvcmVhY2ggKGludCBqIGluIHNldGluKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiwgIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoaik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgifSIpOworCisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RFbnVtKE9ORSkiKTsKKyAgICAgICAgICAgIE51bWJlcnogcmV0ID0gY2xpZW50LnRlc3RFbnVtKE51bWJlcnouT05FKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgcmV0KTsKKyAgICAgICAgICAgIGlmIChOdW1iZXJ6Lk9ORSAhPSByZXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvclN0cnVjdHM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RFbnVtKFRXTykiKTsKKyAgICAgICAgICAgIHJldCA9IGNsaWVudC50ZXN0RW51bShOdW1iZXJ6LlRXTyk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIHJldCk7CisgICAgICAgICAgICBpZiAoTnVtYmVyei5UV08gIT0gcmV0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JTdHJ1Y3RzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0RW51bShUSFJFRSkiKTsKKyAgICAgICAgICAgIHJldCA9IGNsaWVudC50ZXN0RW51bShOdW1iZXJ6LlRIUkVFKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgcmV0KTsKKyAgICAgICAgICAgIGlmIChOdW1iZXJ6LlRIUkVFICE9IHJldCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yU3RydWN0czsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEVudW0oRklWRSkiKTsKKyAgICAgICAgICAgIHJldCA9IGNsaWVudC50ZXN0RW51bShOdW1iZXJ6LkZJVkUpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyByZXQpOworICAgICAgICAgICAgaWYgKE51bWJlcnouRklWRSAhPSByZXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvclN0cnVjdHM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RFbnVtKEVJR0hUKSIpOworICAgICAgICAgICAgcmV0ID0gY2xpZW50LnRlc3RFbnVtKE51bWJlcnouRUlHSFQpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyByZXQpOworICAgICAgICAgICAgaWYgKE51bWJlcnouRUlHSFQgIT0gcmV0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JTdHJ1Y3RzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0VHlwZWRlZigzMDk4NTgyMzUwODI1MjMpIik7CisgICAgICAgICAgICBsb25nIHVpZCA9IGNsaWVudC50ZXN0VHlwZWRlZigzMDk4NTgyMzUwODI1MjNMKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgdWlkKTsKKyAgICAgICAgICAgIGlmICgzMDk4NTgyMzUwODI1MjNMICE9IHVpZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yU3RydWN0czsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gVE9ETzogVmFsaWRhdGUgcmVjZWl2ZWQgbWVzc2FnZQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdE1hcE1hcCgxKSIpOworICAgICAgICAgICAgRGljdGlvbmFyeTxpbnQsIERpY3Rpb25hcnk8aW50LCBpbnQ+PiBtbSA9IGNsaWVudC50ZXN0TWFwTWFwKDEpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiID0geyIpOworICAgICAgICAgICAgZm9yZWFjaCAoaW50IGtleSBpbiBtbS5LZXlzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoa2V5ICsgIiA9PiB7Iik7CisgICAgICAgICAgICAgICAgRGljdGlvbmFyeTxpbnQsIGludD4gbTIgPSBtbVtrZXldOworICAgICAgICAgICAgICAgIGZvcmVhY2ggKGludCBrMiBpbiBtMi5LZXlzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrMiArICIgPT4gIiArIG0yW2syXSArICIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ9LCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ9Iik7CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIEluc2FuaXR5IGluc2FuZSA9IG5ldyBJbnNhbml0eSgpOworICAgICAgICAgICAgaW5zYW5lLlVzZXJNYXAgPSBuZXcgRGljdGlvbmFyeTxOdW1iZXJ6LCBsb25nPigpOworICAgICAgICAgICAgaW5zYW5lLlVzZXJNYXBbTnVtYmVyei5GSVZFXSA9IDUwMDBMOworICAgICAgICAgICAgWHRydWN0IHRydWNrID0gbmV3IFh0cnVjdCgpOworICAgICAgICAgICAgdHJ1Y2suU3RyaW5nX3RoaW5nID0gIlRydWNrIjsKKyAgICAgICAgICAgIHRydWNrLkJ5dGVfdGhpbmcgPSAoc2J5dGUpODsKKyAgICAgICAgICAgIHRydWNrLkkzMl90aGluZyA9IDg7CisgICAgICAgICAgICB0cnVjay5JNjRfdGhpbmcgPSA4OworICAgICAgICAgICAgaW5zYW5lLlh0cnVjdHMgPSBuZXcgTGlzdDxYdHJ1Y3Q+KCk7CisgICAgICAgICAgICBpbnNhbmUuWHRydWN0cy5BZGQodHJ1Y2spOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEluc2FuaXR5KCkiKTsKKyAgICAgICAgICAgIERpY3Rpb25hcnk8bG9uZywgRGljdGlvbmFyeTxOdW1iZXJ6LCBJbnNhbml0eT4+IHdob2EgPSBjbGllbnQudGVzdEluc2FuaXR5KGluc2FuZSk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIgPSB7Iik7CisgICAgICAgICAgICBmb3JlYWNoIChsb25nIGtleSBpbiB3aG9hLktleXMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgRGljdGlvbmFyeTxOdW1iZXJ6LCBJbnNhbml0eT4gdmFsID0gd2hvYVtrZXldOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoa2V5ICsgIiA9PiB7Iik7CisKKyAgICAgICAgICAgICAgICBmb3JlYWNoIChOdW1iZXJ6IGsyIGluIHZhbC5LZXlzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgSW5zYW5pdHkgdjIgPSB2YWxbazJdOworCisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoazIgKyAiID0+IHsiKTsKKyAgICAgICAgICAgICAgICAgICAgRGljdGlvbmFyeTxOdW1iZXJ6LCBsb25nPiB1c2VyTWFwID0gdjIuVXNlck1hcDsKKworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ7Iik7CisgICAgICAgICAgICAgICAgICAgIGlmICh1c2VyTWFwICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKE51bWJlcnogazMgaW4gdXNlck1hcC5LZXlzKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoazMgKyAiID0+ICIgKyB1c2VyTWFwW2szXSArICIsICIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgibnVsbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIn0sICIpOworCisgICAgICAgICAgICAgICAgICAgIExpc3Q8WHRydWN0PiB4dHJ1Y3RzID0gdjIuWHRydWN0czsKKworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ7Iik7CisgICAgICAgICAgICAgICAgICAgIGlmICh4dHJ1Y3RzICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKFh0cnVjdCB4IGluIHh0cnVjdHMpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgie1wiIiArIHguU3RyaW5nX3RoaW5nICsgIlwiLCAiICsgeC5CeXRlX3RoaW5nICsgIiwgIiArIHguSTMyX3RoaW5nICsgIiwgIiArIHguSTMyX3RoaW5nICsgIn0sICIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgibnVsbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIn0iKTsKKworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ9LCAiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSwgIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgifSIpOworCisgICAgICAgICAgICBzYnl0ZSBhcmcwID0gMTsKKyAgICAgICAgICAgIGludCBhcmcxID0gMjsKKyAgICAgICAgICAgIGxvbmcgYXJnMiA9IGxvbmcuTWF4VmFsdWU7CisgICAgICAgICAgICBEaWN0aW9uYXJ5PHNob3J0LCBzdHJpbmc+IG11bHRpRGljdCA9IG5ldyBEaWN0aW9uYXJ5PHNob3J0LCBzdHJpbmc+KCk7CisgICAgICAgICAgICBtdWx0aURpY3RbMV0gPSAib25lIjsKKyAgICAgICAgICAgIE51bWJlcnogYXJnNCA9IE51bWJlcnouRklWRTsKKyAgICAgICAgICAgIGxvbmcgYXJnNSA9IDUwMDAwMDA7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJUZXN0IE11bHRpKCIgKyBhcmcwICsgIiwiICsgYXJnMSArICIsIiArIGFyZzIgKyAiLCIgKyBtdWx0aURpY3QgKyAiLCIgKyBhcmc0ICsgIiwiICsgYXJnNSArICIpIik7CisgICAgICAgICAgICBYdHJ1Y3QgbXVsdGlSZXNwb25zZSA9IGNsaWVudC50ZXN0TXVsdGkoYXJnMCwgYXJnMSwgYXJnMiwgbXVsdGlEaWN0LCBhcmc0LCBhcmc1KTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiA9IFh0cnVjdChieXRlX3RoaW5nOiIgKyBtdWx0aVJlc3BvbnNlLkJ5dGVfdGhpbmcgKyAiLFN0cmluZ190aGluZzoiICsgbXVsdGlSZXNwb25zZS5TdHJpbmdfdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIixpMzJfdGhpbmc6IiArIG11bHRpUmVzcG9uc2UuSTMyX3RoaW5nICsgIixpNjRfdGhpbmc6IiArIG11bHRpUmVzcG9uc2UuSTY0X3RoaW5nICsgIilcbiIpOworCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgidGVzdEV4Y2VwdGlvbihcIlhjZXB0aW9uXCIpIik7CisgICAgICAgICAgICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oIlhjZXB0aW9uIik7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoWGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGV4LkVycm9yQ29kZSAhPSAxMDAxIHx8IGV4Lk1lc3NhZ2UgIT0gIlhjZXB0aW9uIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgidGVzdEV4Y2VwdGlvbihcIlRFeGNlcHRpb25cIikiKTsKKyAgICAgICAgICAgICAgICBjbGllbnQudGVzdEV4Y2VwdGlvbigiVEV4Y2VwdGlvbiIpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFRocmlmdC5URXhjZXB0aW9uKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vIE9LCisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgidGVzdEV4Y2VwdGlvbihcIm9rXCIpIik7CisgICAgICAgICAgICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oIm9rIik7CisgICAgICAgICAgICAgICAgLy8gT0sKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInRlc3RNdWx0aUV4Y2VwdGlvbihcIlhjZXB0aW9uXCIsIC4uLikiKTsKKyAgICAgICAgICAgICAgICBjbGllbnQudGVzdE11bHRpRXhjZXB0aW9uKCJYY2VwdGlvbiIsICJpZ25vcmUiKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChYY2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZXguRXJyb3JDb2RlICE9IDEwMDEgfHwgZXguTWVzc2FnZSAhPSAiVGhpcyBpcyBhbiBYY2VwdGlvbiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInRlc3RNdWx0aUV4Y2VwdGlvbihcIlhjZXB0aW9uMlwiLCAuLi4pIik7CisgICAgICAgICAgICAgICAgY2xpZW50LnRlc3RNdWx0aUV4Y2VwdGlvbigiWGNlcHRpb24yIiwgImlnbm9yZSIpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFhjZXB0aW9uMiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZXguRXJyb3JDb2RlICE9IDIwMDIgfHwgZXguU3RydWN0X3RoaW5nLlN0cmluZ190aGluZyAhPSAiVGhpcyBpcyBhbiBYY2VwdGlvbjIiKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ0ZXN0TXVsdGlFeGNlcHRpb24oXCJzdWNjZXNzXCIsIFwiT0tcIikiKTsKKyAgICAgICAgICAgICAgICBpZiAoIk9LIiAhPSBjbGllbnQudGVzdE11bHRpRXhjZXB0aW9uKCJzdWNjZXNzIiwgIk9LIikuU3RyaW5nX3RoaW5nKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RvcHdhdGNoIHN3ID0gbmV3IFN0b3B3YXRjaCgpOworICAgICAgICAgICAgc3cuU3RhcnQoKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJUZXN0IE9uZXdheSgxKSIpOworICAgICAgICAgICAgY2xpZW50LnRlc3RPbmV3YXkoMSk7CisgICAgICAgICAgICBzdy5TdG9wKCk7CisgICAgICAgICAgICBpZiAoc3cuRWxhcHNlZE1pbGxpc2Vjb25kcyA+IDEwMDApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiVGVzdCBDYWxsdGltZSgpIik7CisgICAgICAgICAgICB2YXIgdGltZXMgPSA1MDsKKyAgICAgICAgICAgIHN3LlJlc2V0KCk7CisgICAgICAgICAgICBzdy5TdGFydCgpOworICAgICAgICAgICAgZm9yIChpbnQgayA9IDA7IGsgPCB0aW1lczsgKytrKQorICAgICAgICAgICAgICAgIGNsaWVudC50ZXN0Vm9pZCgpOworICAgICAgICAgICAgc3cuU3RvcCgpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9IHswfSBtcyBhIHRlc3RWb2lkKCkgY2FsbCIsIHN3LkVsYXBzZWRNaWxsaXNlY29uZHMgLyB0aW1lcyk7Cis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ICAgcHVibGljIHN0YXRpYyBpbnQgX2NsaWVudElEID0gLTE7CisgICAgICAgIHB1YmxpYyBkZWxlZ2F0ZSB2b2lkIFRlc3RMb2dEZWxlZ2F0ZShzdHJpbmcgbXNnLCBwYXJhbXMgb2JqZWN0W10gdmFsdWVzKTsKKworICAgICAgICBwdWJsaWMgY2xhc3MgVHJhZGVTZXJ2ZXJFdmVudEhhbmRsZXIgOiBUU2VydmVyRXZlbnRIYW5kbGVyCisgICAgICAgIHsKKyAgICAgICAgICAgIHB1YmxpYyBpbnQgY2FsbENvdW50ID0gMDsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHByZVNlcnZlKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYWxsQ291bnQrKzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHB1YmxpYyBPYmplY3QgY3JlYXRlQ29udGV4dChUaHJpZnQuUHJvdG9jb2wuVFByb3RvY29sIGlucHV0LCBUaHJpZnQuUHJvdG9jb2wuVFByb3RvY29sIG91dHB1dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYWxsQ291bnQrKzsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGRlbGV0ZUNvbnRleHQoT2JqZWN0IHNlcnZlckNvbnRleHQsIFRocmlmdC5Qcm90b2NvbC5UUHJvdG9jb2wgaW5wdXQsIFRocmlmdC5Qcm90b2NvbC5UUHJvdG9jb2wgb3V0cHV0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhbGxDb3VudCsrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcHVibGljIHZvaWQgcHJvY2Vzc0NvbnRleHQoT2JqZWN0IHNlcnZlckNvbnRleHQsIFRocmlmdC5UcmFuc3BvcnQuVFRyYW5zcG9ydCB0cmFuc3BvcnQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2FsbENvdW50Kys7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisKKworICAgICAgICBwdWJsaWMgY2xhc3MgVGVzdEhhbmRsZXIgOiBUaHJpZnRUZXN0LklmYWNlLCBUaHJpZnQuVENvbnRyb2xsaW5nSGFuZGxlcgorICAgICAgICB7CisgICAgICAgICAgICBwdWJsaWMgVFNlcnZlciBzZXJ2ZXIgeyBnZXQ7IHNldDsgfQorICAgICAgICAgICAgcHJpdmF0ZSBpbnQgaGFuZGxlcklEOworICAgICAgICAgICAgcHJpdmF0ZSBTdHJpbmdCdWlsZGVyIHJldXNhYmxlU3RyaW5nQnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICBwcml2YXRlIFRlc3RMb2dEZWxlZ2F0ZSB0ZXN0TG9nRGVsZWdhdGU7CisKKyAgICAgICAgICAgIHB1YmxpYyBUZXN0SGFuZGxlcigpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaGFuZGxlcklEID0gSW50ZXJsb2NrZWQuSW5jcmVtZW50KHJlZiBfY2xpZW50SUQpOworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZSArPSB0ZXN0Q29uc29sZUxvZ2dlcjsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJOZXcgVGVzdEhhbmRsZXIgaW5zdGFuY2UgY3JlYXRlZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgdm9pZCB0ZXN0Q29uc29sZUxvZ2dlcihzdHJpbmcgbXNnLCBwYXJhbXMgb2JqZWN0W10gdmFsdWVzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5DbGVhcigpOworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmRGb3JtYXQoImhhbmRsZXJ7MDpEM306IixoYW5kbGVySUQpOworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmRGb3JtYXQobXNnLCB2YWx1ZXMpOworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmRMaW5lKCk7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSggcmV1c2FibGVTdHJpbmdCdWlsZGVyLlRvU3RyaW5nKCkgKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHZvaWQgdGVzdFZvaWQoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RWb2lkKCkiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHN0cmluZyB0ZXN0U3RyaW5nKHN0cmluZyB0aGluZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJ0ZXN0U3RyaW5nKHswfSkiLCB0aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaW5nOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgYm9vbCB0ZXN0Qm9vbChib29sIHRoaW5nKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RCb29sKHswfSkiLCB0aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaW5nOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgc2J5dGUgdGVzdEJ5dGUoc2J5dGUgdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdEJ5dGUoezB9KSIsIHRoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBpbnQgdGVzdEkzMihpbnQgdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdEkzMih7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGxvbmcgdGVzdEk2NChsb25nIHRoaW5nKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RJNjQoezB9KSIsIHRoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBkb3VibGUgdGVzdERvdWJsZShkb3VibGUgdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdERvdWJsZSh7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGJ5dGVbXSB0ZXN0QmluYXJ5KGJ5dGVbXSB0aGluZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzdHJpbmcgaGV4ID0gQml0Q29udmVydGVyLlRvU3RyaW5nKHRoaW5nKS5SZXBsYWNlKCItIiwgc3RyaW5nLkVtcHR5KTsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJ0ZXN0QmluYXJ5KHswOlh9KSIsIGhleCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaW5nOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgWHRydWN0IHRlc3RTdHJ1Y3QoWHRydWN0IHRoaW5nKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RTdHJ1Y3Qoe3tcInswfVwiLCB7MX0sIHsyfSwgezN9fX0pIiwgdGhpbmcuU3RyaW5nX3RoaW5nLCB0aGluZy5CeXRlX3RoaW5nLCB0aGluZy5JMzJfdGhpbmcsIHRoaW5nLkk2NF90aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRoaW5nOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgWHRydWN0MiB0ZXN0TmVzdChYdHJ1Y3QyIG5lc3QpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgWHRydWN0IHRoaW5nID0gbmVzdC5TdHJ1Y3RfdGhpbmc7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdE5lc3Qoe3t7MH0sIHt7XCJ7MX1cIiwgezJ9LCB7M30sIHs0fSwgezV9fX19fSkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVzdC5CeXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpbmcuU3RyaW5nX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpbmcuQnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaW5nLkkzMl90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaW5nLkk2NF90aGluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lc3QuSTMyX3RoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmVzdDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIERpY3Rpb25hcnk8aW50LCBpbnQ+IHRlc3RNYXAoRGljdGlvbmFyeTxpbnQsIGludD4gdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZCgidGVzdE1hcCh7eyIpOworICAgICAgICAgICAgICAgIGJvb2wgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgICAgIGZvcmVhY2ggKGludCBrZXkgaW4gdGhpbmcuS2V5cykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZEZvcm1hdCgiezB9ID0+IHsxfSIsIGtleSwgdGhpbmdba2V5XSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIn19KSIpOworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UocmV1c2FibGVTdHJpbmdCdWlsZGVyLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIERpY3Rpb25hcnk8c3RyaW5nLCBzdHJpbmc+IHRlc3RTdHJpbmdNYXAoRGljdGlvbmFyeTxzdHJpbmcsIHN0cmluZz4gdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZCgidGVzdFN0cmluZ01hcCh7eyIpOworICAgICAgICAgICAgICAgIGJvb2wgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgICAgIGZvcmVhY2ggKHN0cmluZyBrZXkgaW4gdGhpbmcuS2V5cykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZEZvcm1hdCgiezB9ID0+IHsxfSIsIGtleSwgdGhpbmdba2V5XSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIn19KSIpOworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UocmV1c2FibGVTdHJpbmdCdWlsZGVyLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRIYXNoU2V0PGludD4gdGVzdFNldChUSGFzaFNldDxpbnQ+IHRoaW5nKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5DbGVhcigpOworICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoInRlc3RTZXQoe3siKTsKKyAgICAgICAgICAgICAgICBib29sIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb3JlYWNoIChpbnQgZWxlbSBpbiB0aGluZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZEZvcm1hdCgiezB9IiwgZWxlbSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIn19KSIpOworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UocmV1c2FibGVTdHJpbmdCdWlsZGVyLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIExpc3Q8aW50PiB0ZXN0TGlzdChMaXN0PGludD4gdGhpbmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZCgidGVzdExpc3Qoe3siKTsKKyAgICAgICAgICAgICAgICBib29sIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb3JlYWNoIChpbnQgZWxlbSBpbiB0aGluZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV1c2FibGVTdHJpbmdCdWlsZGVyLkFwcGVuZEZvcm1hdCgiezB9IiwgZWxlbSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldXNhYmxlU3RyaW5nQnVpbGRlci5BcHBlbmQoIn19KSIpOworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UocmV1c2FibGVTdHJpbmdCdWlsZGVyLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIE51bWJlcnogdGVzdEVudW0oTnVtYmVyeiB0aGluZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJ0ZXN0RW51bSh7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGxvbmcgdGVzdFR5cGVkZWYobG9uZyB0aGluZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJ0ZXN0VHlwZWRlZih7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiB0aGluZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIERpY3Rpb25hcnk8aW50LCBEaWN0aW9uYXJ5PGludCwgaW50Pj4gdGVzdE1hcE1hcChpbnQgaGVsbG8pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdE1hcE1hcCh7MH0pIiwgaGVsbG8pOworICAgICAgICAgICAgICAgIERpY3Rpb25hcnk8aW50LCBEaWN0aW9uYXJ5PGludCwgaW50Pj4gbWFwbWFwID0KKyAgICAgICAgICAgICAgICAgIG5ldyBEaWN0aW9uYXJ5PGludCwgRGljdGlvbmFyeTxpbnQsIGludD4+KCk7CisKKyAgICAgICAgICAgICAgICBEaWN0aW9uYXJ5PGludCwgaW50PiBwb3MgPSBuZXcgRGljdGlvbmFyeTxpbnQsIGludD4oKTsKKyAgICAgICAgICAgICAgICBEaWN0aW9uYXJ5PGludCwgaW50PiBuZWcgPSBuZXcgRGljdGlvbmFyeTxpbnQsIGludD4oKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8IDU7IGkrKykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHBvc1tpXSA9IGk7CisgICAgICAgICAgICAgICAgICAgIG5lZ1staV0gPSAtaTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBtYXBtYXBbNF0gPSBwb3M7CisgICAgICAgICAgICAgICAgbWFwbWFwWy00XSA9IG5lZzsKKworICAgICAgICAgICAgICAgIHJldHVybiBtYXBtYXA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEluc2FuaXR5CisgICAgICAgICAgICAvLyByZXR1cm5zOgorICAgICAgICAgICAgLy8geyAxID0+IHsgMiA9PiBhcmd1bWVudCwKKyAgICAgICAgICAgIC8vICAgICAgICAgIDMgPT4gYXJndW1lbnQsCisgICAgICAgICAgICAvLyAgICAgICAgfSwKKyAgICAgICAgICAgIC8vICAgMiA9PiB7IDYgPT4gPGVtcHR5IEluc2FuaXR5IHN0cnVjdD4sIH0sCisgICAgICAgICAgICAvLyB9CisgICAgICAgICAgICBwdWJsaWMgRGljdGlvbmFyeTxsb25nLCBEaWN0aW9uYXJ5PE51bWJlcnosIEluc2FuaXR5Pj4gdGVzdEluc2FuaXR5KEluc2FuaXR5IGFyZ3VtZW50KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RJbnNhbml0eSgpIik7CisKKyAgICAgICAgICAgICAgICBEaWN0aW9uYXJ5PE51bWJlcnosIEluc2FuaXR5PiBmaXJzdF9tYXAgPSBuZXcgRGljdGlvbmFyeTxOdW1iZXJ6LCBJbnNhbml0eT4oKTsKKyAgICAgICAgICAgICAgICBEaWN0aW9uYXJ5PE51bWJlcnosIEluc2FuaXR5PiBzZWNvbmRfbWFwID0gbmV3IERpY3Rpb25hcnk8TnVtYmVyeiwgSW5zYW5pdHk+KCk7IDsKKworICAgICAgICAgICAgICAgIGZpcnN0X21hcFtOdW1iZXJ6LlRXT10gPSBhcmd1bWVudDsKKyAgICAgICAgICAgICAgICBmaXJzdF9tYXBbTnVtYmVyei5USFJFRV0gPSBhcmd1bWVudDsKKworICAgICAgICAgICAgICAgIHNlY29uZF9tYXBbTnVtYmVyei5TSVhdID0gbmV3IEluc2FuaXR5KCk7CisKKyAgICAgICAgICAgICAgICBEaWN0aW9uYXJ5PGxvbmcsIERpY3Rpb25hcnk8TnVtYmVyeiwgSW5zYW5pdHk+PiBpbnNhbmUgPQorICAgICAgICAgICAgICAgICAgbmV3IERpY3Rpb25hcnk8bG9uZywgRGljdGlvbmFyeTxOdW1iZXJ6LCBJbnNhbml0eT4+KCk7CisgICAgICAgICAgICAgICAgaW5zYW5lWyhsb25nKTFdID0gZmlyc3RfbWFwOworICAgICAgICAgICAgICAgIGluc2FuZVsobG9uZykyXSA9IHNlY29uZF9tYXA7CisKKyAgICAgICAgICAgICAgICByZXR1cm4gaW5zYW5lOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgWHRydWN0IHRlc3RNdWx0aShzYnl0ZSBhcmcwLCBpbnQgYXJnMSwgbG9uZyBhcmcyLCBEaWN0aW9uYXJ5PHNob3J0LCBzdHJpbmc+IGFyZzMsIE51bWJlcnogYXJnNCwgbG9uZyBhcmc1KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRlc3RMb2dEZWxlZ2F0ZS5JbnZva2UoInRlc3RNdWx0aSgpIik7CisKKyAgICAgICAgICAgICAgICBYdHJ1Y3QgaGVsbG8gPSBuZXcgWHRydWN0KCk7IDsKKyAgICAgICAgICAgICAgICBoZWxsby5TdHJpbmdfdGhpbmcgPSAiSGVsbG8yIjsKKyAgICAgICAgICAgICAgICBoZWxsby5CeXRlX3RoaW5nID0gYXJnMDsKKyAgICAgICAgICAgICAgICBoZWxsby5JMzJfdGhpbmcgPSBhcmcxOworICAgICAgICAgICAgICAgIGhlbGxvLkk2NF90aGluZyA9IGFyZzI7CisgICAgICAgICAgICAgICAgcmV0dXJuIGhlbGxvOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIFByaW50ICd0ZXN0RXhjZXB0aW9uKCVzKScgd2l0aCBhcmcgYXMgJyVzJworICAgICAgICAgICAgICogQHBhcmFtIHN0cmluZyBhcmcgLSBhIHN0cmluZyBpbmRpY2F0aW9uIHdoYXQgdHlwZSBvZiBleGNlcHRpb24gdG8gdGhyb3cKKyAgICAgICAgICAgICAqIGlmIGFyZyA9PSAiWGNlcHRpb24iIHRocm93IFhjZXB0aW9uIHdpdGggZXJyb3JDb2RlID0gMTAwMSBhbmQgbWVzc2FnZSA9IGFyZworICAgICAgICAgICAgICogZWxzZW4gaWYgYXJnID09ICJURXhjZXB0aW9uIiB0aHJvdyBURXhjZXB0aW9uCisgICAgICAgICAgICAgKiBlbHNlIGRvIG5vdCB0aHJvdyBhbnl0aGluZworICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgdm9pZCB0ZXN0RXhjZXB0aW9uKHN0cmluZyBhcmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdEV4Y2VwdGlvbih7MH0pIiwgYXJnKTsKKyAgICAgICAgICAgICAgICBpZiAoYXJnID09ICJYY2VwdGlvbiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBYY2VwdGlvbiB4ID0gbmV3IFhjZXB0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgIHguRXJyb3JDb2RlID0gMTAwMTsKKyAgICAgICAgICAgICAgICAgICAgeC5NZXNzYWdlID0gYXJnOworICAgICAgICAgICAgICAgICAgICB0aHJvdyB4OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoYXJnID09ICJURXhjZXB0aW9uIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUaHJpZnQuVEV4Y2VwdGlvbigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBYdHJ1Y3QgdGVzdE11bHRpRXhjZXB0aW9uKHN0cmluZyBhcmcwLCBzdHJpbmcgYXJnMSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0ZXN0TG9nRGVsZWdhdGUuSW52b2tlKCJ0ZXN0TXVsdGlFeGNlcHRpb24oezB9LCB7MX0pIiwgYXJnMCxhcmcxKTsKKyAgICAgICAgICAgICAgICBpZiAoYXJnMCA9PSAiWGNlcHRpb24iKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgWGNlcHRpb24geCA9IG5ldyBYY2VwdGlvbigpOworICAgICAgICAgICAgICAgICAgICB4LkVycm9yQ29kZSA9IDEwMDE7CisgICAgICAgICAgICAgICAgICAgIHguTWVzc2FnZSA9ICJUaGlzIGlzIGFuIFhjZXB0aW9uIjsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgeDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnMCA9PSAiWGNlcHRpb24yIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIFhjZXB0aW9uMiB4ID0gbmV3IFhjZXB0aW9uMigpOworICAgICAgICAgICAgICAgICAgICB4LkVycm9yQ29kZSA9IDIwMDI7CisgICAgICAgICAgICAgICAgICAgIHguU3RydWN0X3RoaW5nID0gbmV3IFh0cnVjdCgpOworICAgICAgICAgICAgICAgICAgICB4LlN0cnVjdF90aGluZy5TdHJpbmdfdGhpbmcgPSAiVGhpcyBpcyBhbiBYY2VwdGlvbjIiOworICAgICAgICAgICAgICAgICAgICB0aHJvdyB4OworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIFh0cnVjdCByZXN1bHQgPSBuZXcgWHRydWN0KCk7CisgICAgICAgICAgICAgICAgcmVzdWx0LlN0cmluZ190aGluZyA9IGFyZzE7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHZvaWQgdGVzdFN0b3AoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChzZXJ2ZXIgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHNlcnZlci5TdG9wKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgdm9pZCB0ZXN0T25ld2F5KGludCBhcmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdE9uZXdheSh7MH0pLCBzbGVlcGluZy4uLiIsIGFyZyk7CisgICAgICAgICAgICAgICAgU3lzdGVtLlRocmVhZGluZy5UaHJlYWQuU2xlZXAoYXJnICogMTAwMCk7CisgICAgICAgICAgICAgICAgdGVzdExvZ0RlbGVnYXRlLkludm9rZSgidGVzdE9uZXdheSBmaW5pc2hlZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgIH0gLy8gY2xhc3MgVGVzdEhhbmRsZXIKKworICAgICAgICBwcml2YXRlIGVudW0gU2VydmVyVHlwZQorICAgICAgICB7CisgICAgICAgICAgICBUU2ltcGxlU2VydmVyLAorICAgICAgICAgICAgVFRocmVhZGVkU2VydmVyLAorICAgICAgICAgICAgVFRocmVhZFBvb2xTZXJ2ZXIsCisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGVudW0gUHJvY2Vzc29yRmFjdG9yeVR5cGUKKyAgICAgICAgeworICAgICAgICAgICAgVFNpbmdsZXRvblByb2Nlc3NvckZhY3RvcnksCisgICAgICAgICAgICBUUHJvdG90eXBlUHJvY2Vzc29yRmFjdG9yeSwKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgYm9vbCBFeGVjdXRlKHN0cmluZ1tdIGFyZ3MpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGJvb2wgdXNlQnVmZmVyZWRTb2NrZXRzID0gZmFsc2UsIHVzZUZyYW1lZCA9IGZhbHNlLCB1c2VFbmNyeXB0aW9uID0gZmFsc2UsIGNvbXBhY3QgPSBmYWxzZSwganNvbiA9IGZhbHNlOworICAgICAgICAgICAgICAgIFNlcnZlclR5cGUgc2VydmVyVHlwZSA9IFNlcnZlclR5cGUuVFNpbXBsZVNlcnZlcjsKKyAgICAgICAgICAgICAgICBQcm9jZXNzb3JGYWN0b3J5VHlwZSBwcm9jZXNzb3JGYWN0b3J5VHlwZSA9IFByb2Nlc3NvckZhY3RvcnlUeXBlLlRTaW5nbGV0b25Qcm9jZXNzb3JGYWN0b3J5OworICAgICAgICAgICAgICAgIGludCBwb3J0ID0gOTA5MDsKKyAgICAgICAgICAgICAgICBzdHJpbmcgcGlwZSA9IG51bGw7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBhcmdzLkxlbmd0aDsgaSsrKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFyZ3NbaV0gPT0gIi1waXBlIikgIC8vIC1waXBlIG5hbWUKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcGlwZSA9IGFyZ3NbKytpXTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldLkNvbnRhaW5zKCItLXBvcnQ9IikpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQgPSBpbnQuUGFyc2UoYXJnc1tpXS5TdWJzdHJpbmcoYXJnc1tpXS5JbmRleE9mKCI9IikgKyAxKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLWIiIHx8IGFyZ3NbaV0gPT0gIi0tYnVmZmVyZWQiIHx8IGFyZ3NbaV0gPT0gIi0tdHJhbnNwb3J0PWJ1ZmZlcmVkIikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdXNlQnVmZmVyZWRTb2NrZXRzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItZiIgfHwgYXJnc1tpXSA9PSAiLS1mcmFtZWQiIHx8IGFyZ3NbaV0gPT0gIi0tdHJhbnNwb3J0PWZyYW1lZCIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVzZUZyYW1lZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLS1jb21wYWN0IiB8fCBhcmdzW2ldID09ICItLXByb3RvY29sPWNvbXBhY3QiKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb21wYWN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLWpzb24iIHx8IGFyZ3NbaV0gPT0gIi0tcHJvdG9jb2w9anNvbiIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tdGhyZWFkZWQiIHx8IGFyZ3NbaV0gPT0gIi0tc2VydmVyLXR5cGU9dGhyZWFkZWQiKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUeXBlID0gU2VydmVyVHlwZS5UVGhyZWFkZWRTZXJ2ZXI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLS10aHJlYWRwb29sIiB8fCBhcmdzW2ldID09ICItLXNlcnZlci10eXBlPXRocmVhZHBvb2wiKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUeXBlID0gU2VydmVyVHlwZS5UVGhyZWFkUG9vbFNlcnZlcjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLXByb3RvdHlwZSIgfHwgYXJnc1tpXSA9PSAiLS1wcm9jZXNzb3I9cHJvdG90eXBlIikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc29yRmFjdG9yeVR5cGUgPSBQcm9jZXNzb3JGYWN0b3J5VHlwZS5UUHJvdG90eXBlUHJvY2Vzc29yRmFjdG9yeTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLXNzbCIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVzZUVuY3J5cHRpb24gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gVHJhbnNwb3J0CisgICAgICAgICAgICAgICAgVFNlcnZlclRyYW5zcG9ydCB0cmFuczsKKyAgICAgICAgICAgICAgICBpZiAocGlwZSAhPSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVE5hbWVkUGlwZVNlcnZlclRyYW5zcG9ydChwaXBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHVzZUVuY3J5cHRpb24pCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBjZXJ0UGF0aCA9ICIuLi9rZXlzL3NlcnZlci5wMTIiOworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVFRMU1NlcnZlclNvY2tldChwb3J0LCAwLCB1c2VCdWZmZXJlZFNvY2tldHMsIG5ldyBYNTA5Q2VydGlmaWNhdGUyKGNlcnRQYXRoLCAidGhyaWZ0IiksIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgU3NsUHJvdG9jb2xzLlRscyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUU2VydmVyU29ja2V0KHBvcnQsIDAsIHVzZUJ1ZmZlcmVkU29ja2V0cyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBUUHJvdG9jb2xGYWN0b3J5IHByb3RvOworICAgICAgICAgICAgICAgIGlmIChjb21wYWN0KQorICAgICAgICAgICAgICAgICAgICBwcm90byA9IG5ldyBUQ29tcGFjdFByb3RvY29sLkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICBlbHNlIGlmIChqc29uKQorICAgICAgICAgICAgICAgICAgICBwcm90byA9IG5ldyBUSlNPTlByb3RvY29sLkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHByb3RvID0gbmV3IFRCaW5hcnlQcm90b2NvbC5GYWN0b3J5KCk7CisKKyAgICAgICAgICAgICAgICBUUHJvY2Vzc29yRmFjdG9yeSBwcm9jZXNzb3JGYWN0b3J5OworICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzb3JGYWN0b3J5VHlwZSA9PSBQcm9jZXNzb3JGYWN0b3J5VHlwZS5UUHJvdG90eXBlUHJvY2Vzc29yRmFjdG9yeSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NvckZhY3RvcnkgPSBuZXcgVFByb3RvdHlwZVByb2Nlc3NvckZhY3Rvcnk8VGhyaWZ0VGVzdC5Qcm9jZXNzb3IsIFRlc3RIYW5kbGVyPigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvLyBQcm9jZXNzb3IKKyAgICAgICAgICAgICAgICAgICAgVGVzdEhhbmRsZXIgdGVzdEhhbmRsZXIgPSBuZXcgVGVzdEhhbmRsZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgVGhyaWZ0VGVzdC5Qcm9jZXNzb3IgdGVzdFByb2Nlc3NvciA9IG5ldyBUaHJpZnRUZXN0LlByb2Nlc3Nvcih0ZXN0SGFuZGxlcik7CisgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NvckZhY3RvcnkgPSBuZXcgVFNpbmdsZXRvblByb2Nlc3NvckZhY3RvcnkodGVzdFByb2Nlc3Nvcik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3RvcnkgdHJhbnNGYWN0b3J5OworICAgICAgICAgICAgICAgIGlmICh1c2VGcmFtZWQpCisgICAgICAgICAgICAgICAgICAgIHRyYW5zRmFjdG9yeSA9IG5ldyBURnJhbWVkVHJhbnNwb3J0LkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHRyYW5zRmFjdG9yeSA9IG5ldyBUVHJhbnNwb3J0RmFjdG9yeSgpOworCisgICAgICAgICAgICAgICAgVFNlcnZlciBzZXJ2ZXJFbmdpbmU7CisgICAgICAgICAgICAgICAgc3dpdGNoIChzZXJ2ZXJUeXBlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBTZXJ2ZXJUeXBlLlRUaHJlYWRQb29sU2VydmVyOgorICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyRW5naW5lID0gbmV3IFRUaHJlYWRQb29sU2VydmVyKHByb2Nlc3NvckZhY3RvcnksIHRyYW5zLCB0cmFuc0ZhY3RvcnksIHByb3RvKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIFNlcnZlclR5cGUuVFRocmVhZGVkU2VydmVyOgorICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyRW5naW5lID0gbmV3IFRUaHJlYWRlZFNlcnZlcihwcm9jZXNzb3JGYWN0b3J5LCB0cmFucywgdHJhbnNGYWN0b3J5LCBwcm90byk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlckVuZ2luZSA9IG5ldyBUU2ltcGxlU2VydmVyKHByb2Nlc3NvckZhY3RvcnksIHRyYW5zLCB0cmFuc0ZhY3RvcnksIHByb3RvKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vU2VydmVyIGV2ZW50IGhhbmRsZXIKKyAgICAgICAgICAgICAgICBUcmFkZVNlcnZlckV2ZW50SGFuZGxlciBzZXJ2ZXJFdmVudHMgPSBuZXcgVHJhZGVTZXJ2ZXJFdmVudEhhbmRsZXIoKTsKKyAgICAgICAgICAgICAgICBzZXJ2ZXJFbmdpbmUuc2V0RXZlbnRIYW5kbGVyKHNlcnZlckV2ZW50cyk7CisKKyAgICAgICAgICAgICAgICAvLyBSdW4gaXQKKyAgICAgICAgICAgICAgICBzdHJpbmcgd2hlcmUgPSAocGlwZSAhPSBudWxsID8gIm9uIHBpcGUgIiArIHBpcGUgOiAib24gcG9ydCAiICsgcG9ydCk7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlN0YXJ0aW5nIHRoZSAiICsgc2VydmVyVHlwZS5Ub1N0cmluZygpICsgIiAiICsgd2hlcmUgKworICAgICAgICAgICAgICAgICAgICAocHJvY2Vzc29yRmFjdG9yeVR5cGUgPT0gUHJvY2Vzc29yRmFjdG9yeVR5cGUuVFByb3RvdHlwZVByb2Nlc3NvckZhY3RvcnkgPyAiIHdpdGggcHJvY2Vzc29yIHByb3RvdHlwZSBmYWN0b3J5ICIgOiAiIikgKworICAgICAgICAgICAgICAgICAgICAodXNlQnVmZmVyZWRTb2NrZXRzID8gIiB3aXRoIGJ1ZmZlcmVkIHNvY2tldCIgOiAiIikgKworICAgICAgICAgICAgICAgICAgICAodXNlRnJhbWVkID8gIiB3aXRoIGZyYW1lZCB0cmFuc3BvcnQiIDogIiIpICsKKyAgICAgICAgICAgICAgICAgICAgKHVzZUVuY3J5cHRpb24gPyAiIHdpdGggZW5jcnlwdGlvbiIgOiAiIikgKworICAgICAgICAgICAgICAgICAgICAoY29tcGFjdCA/ICIgd2l0aCBjb21wYWN0IHByb3RvY29sIiA6ICIiKSArCisgICAgICAgICAgICAgICAgICAgIChqc29uID8gIiB3aXRoIGpzb24gcHJvdG9jb2wiIDogIiIpICsKKyAgICAgICAgICAgICAgICAgICAgIi4uLiIpOworICAgICAgICAgICAgICAgIHNlcnZlckVuZ2luZS5TZXJ2ZSgpOworCisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIHgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5FcnJvci5Xcml0ZSh4KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiZG9uZS4iKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvdGVzdC9jc2hhcnAvVGhyaWZ0VGVzdC5jc3Byb2ogYi90ZXN0L2NzaGFycC9UaHJpZnRUZXN0LmNzcHJvagpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi42MzYyOWViCi0tLSAvZGV2L251bGwKKysrIGIvdGVzdC9jc2hhcnAvVGhyaWZ0VGVzdC5jc3Byb2oKQEAgLTAsMCArMSwxNDEgQEAKK++7vzw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8+Cis8IS0tCisgIExpY2Vuc2VkIHRvIHRoZSBBcGFjaGUgU29mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSB1bmRlciBvbmUKKyAgb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuIFNlZSB0aGUgTk9USUNFIGZpbGUKKyAg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cmcsIEhlYWR9KQorICAgICAgICAgICAgICAgIGVuZDsKKyAgICAgICAgICAgICItLXRyYW5zcG9ydD0iICsrIFRyYW5zIC0+CisgICAgICAgICAgICAgICAgJSBUT0RPOiBFbmFibGUgQnVmZmVyZWQgYW5kIEhUVFAgdHJhbnNwb3J0CisgICAgICAgICAgICAgICAgY2FzZSBUcmFucyBvZgorICAgICAgICAgICAgICAgICAgICAiZnJhbWVkIiAtPgorICAgICAgICAgICAgICAgICAgICAgICAgT3B0cyNvcHRpb25ze2NsaWVudF9vcHRzID0gW3tmcmFtZWQsIHRydWV9IHwgT3B0cyNvcHRpb25zLmNsaWVudF9vcHRzXX07CisgICAgICAgICAgICAgICAgICAgIF9FbHNlIC0+CisgICAgICAgICAgICAgICAgICAgICAgICBPcHRzCisgICAgICAgICAgICAgICAgZW5kOworICAgICAgICAgICAgIi0tc3NsIiAtPgorICAgICAgICAgICAgICAgIHNzbDpzdGFydCgpLAorICAgICAgICAgICAgICAgIFNzbE9wdGlvbnMgPQorICAgICAgICAgICAgICAgICAgICB7c3Nsb3B0aW9ucywgWworICAgICAgICAgICAgICAgICAgICAgICAge2NhY2VydGZpbGUsICIuLi9rZXlzL0NBLnBlbSJ9LAorICAgICAgICAgICAgICAgICAgICAgICAge2NlcnRmaWxlLCAiLi4va2V5cy9jbGllbnQucGVtIn0sCisgICAgICAgICAgICAgICAgICAgICAgICB7a2V5ZmlsZSwgIi4uL2tleXMvY2xpZW50LmtleSJ9CisgICAgICAgICAgICAgICAgICAgIF19LAorICAgICAgICAgICAgICAgIE9wdHMjb3B0aW9uc3tjbGllbnRfb3B0cyA9IFt7c3NsdHJhbnNwb3J0LCB0cnVlfSB8IFtTc2xPcHRpb25zIHwgT3B0cyNvcHRpb25zLmNsaWVudF9vcHRzXV19OworICAgICAgICAgICAgIi0tcHJvdG9jb2w9IiArKyBQcm90byAtPgorICAgICAgICAgICAgICAgIE9wdHMjb3B0aW9uc3tjbGllbnRfb3B0cyA9IFt7cHJvd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isgIE9wdHM7CitwYXJzZV9hcmdzKFtIZWFkIHwgUmVzdF0sIE9wdHMpIC0+CisgICAgTmV3T3B0cyA9CisgICAgICAgIGNhc2UgSGVhZCBvZgorICAgICAgICAgICAgIi0tcG9ydD0iICsrIFBvcnQgLT4KKyAgICAgICAgICAgICAgICBjYXNlIHN0cmluZzp0b19pbnRlZ2VyKFBvcnQpIG9mCisgICAgICAgICAgICAgICAgICB7SW50UG9ydCxffSB3aGVuIGlzX2ludGVnZXIoSW50UG9ydCkgLT4KKyAgICAgICAgICAgICAgICAgICAgT3B0cyNvcHRpb25ze3BvcnQgPSBJbnRQb3J0fTsKKyAgICAgICAgICAgICAgICAgIF9FbHNlIC0+CisgICAgICAgICAgICAgICAgICAgIGVybGFuZzplcnJvcih7YmFkX2FyZywgSGVhZH0pCisgICAgICAgICAgICAgICAgZW5kOworICAgICAgICAgICAgIi0tdHJhbnNwb3J0PSIgKysgVHJhbnMgLT4KKyAgICAgICAgICAgICAgICBjYXNlIFRyYW5zIG9mCisgICAgICAgICAgICAgICAgICAgICJmcmFtZWQiIC0+CisgICAgICAgICAgICAgICAgICAgICAgICBPcHRzI29wdGlvbnN7c2VydmVyX29wdHMgPSBbe2ZyYW1lZCwgdHJ1ZX0gfCBPcHRzI29wdGlvbnMuc2VydmVyX29wdHNdfTsKKyAgICAgICAgICAgICAgICAgICAgX0Vsc2UgLT4KKyAgICAgICAgICAgICAgICAgICAgICAgIE9wdHMKKyAgICAgICAgICAgICAgICBlbmQ7CisgICAgICAgICAgICAiLS1zc2wiIC0+CisgICAgICAgICAgICAgICAgc3NsOnN0YXJ0KCksCisgICAgICAgICAgICAgICAgU3NsT3B0aW9ucyA9CisgICAgICAgICAgICAgICAgICAgIHtzc2xvcHRpb25zLCBbCisgICAgICAgICAgICAgICAgICAgICAgICAge2NlcnRmaWxlLCAiLi4va2V5cy9zZXJ2ZXIucGVtIn0KKyAgICAgICAgICAgICAgICAgICAgICAgICx7a2V5ZmlsZSwgICIuLi9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ZX07CisKK2hhbmRsZV9mdW5jdGlvbih0ZXN0QmluYXJ5LCB7U30pIHdoZW4gaXNfYmluYXJ5KFMpIC0+CisgICAgaW86Zm9ybWF0KCJ0ZXN0QmluYXJ5OiB+cH5uIiwgW1NdKSwKKyAgICB7cmVwbHksIFN9OworCitoYW5kbGVfZnVuY3Rpb24odGVzdFN0cnVjdCwKKyAgICAgICAgICAgICAgICB7U3RydWN0ID0gIyd0aHJpZnQudGVzdC5YdHJ1Y3Qne3N0cmluZ190aGluZyA9IFN0cmluZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVfdGhpbmcgPSBCeXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTMyX3RoaW5nID0gSTMyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nID0gSTY0fX0pCit3aGVuIGlzX2JpbmFyeShTdHJpbmcpLAorICAgICBpc19pbnRlZ2VyKEJ5dGUpLAorICAgICBpc19pbnRlZ2VyKEkzMiksCisgICAgIGlzX2ludGVnZXIoSTY0KSAtPgorICAgIGlvOmZvcm1hdCgidGVzdFN0cnVjdDogfnB+biIsIFtTdHJ1Y3RdKSwKKyAgICB7cmVwbHksIFN0cnVjdH07CisKK2hhbmRsZV9mdW5jdGlvbih0ZXN0TmVzdCwKKyAgICAgICAgICAgICAgICB7TmVzdH0pIHdoZW4gaXNfcmVjb3JkKE5lc3QsICd0aHJpZnQudGVzdC5YdHJ1Y3QyJyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzX3JlY29yZChOZXN0Iyd0aHJpZnQudGVzdC5YdHJ1Y3QyJy5zdHJ1Y3RfdGhpbmcsICd0aHJpZnQudGVzdC5YdHJ1Y3QnKSAtPgorICAgIGlvOmZvcm1hdCgidGVzdE5lc3Q6IH5wfm4iLCBbTmVzdF0pLAorICAgIHtyZXBseS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ybWF0KCJ0ZXN0TWFwTWFwOiB+cH5uIiwgW0hlbGxvXSksCisKKyAgICBQb3NMaXN0ID0gW3tJLCBJfSAgIHx8IEkgPC0gbGlzdHM6c2VxKDEsIDQpXSwKKyAgICBOZWdMaXN0ID0gW3stSSwgLUl9IHx8IEkgPC0gbGlzdHM6c2VxKDEsIDQpXSwKKworICAgIE1hcE1hcCA9IGRpY3Q6ZnJvbV9saXN0KFt7NCwgIGRpY3Q6ZnJvbV9saXN0KFBvc0xpc3QpfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgey00LCBkaWN0OmZyb21fbGlzdChOZWdMaXN0KX1dKSwKKyAgICB7cmVwbHksIE1hcE1hcH07CisKK2hhbmRsZV9mdW5jdGlvbih0ZXN0SW5zYW5pdHksIHtJbnNhbml0eX0pIHdoZW4gaXNfcmVjb3JkKEluc2FuaXR5LCAndGhyaWZ0LnRlc3QuSW5zYW5pdHknKSAtPgorICAgIEhlbGxvID0gIyd0aHJpZnQudGVzdC5YdHJ1Y3Qne3N0cmluZ190aGluZyA9IDw8IkhlbGxvMiI+PiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBieXRlX3RoaW5nID0gMiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmcgPSAyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGk2NF90aGluZyA9IDJ9LAorCisgICAgR29vZGJ5ZSA9ICMndGhyaWZ0LnRlc3QuWHRydWN0J3tzdHJpbmdfdGhpbmcgPSA8PCJHb29kYnllNCI+PiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZyA9IDQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmcgPSA0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nID0gNH0sCisgICAgQ3JhenkgPSAjJ3RocmlmdC50ZXN0Lkluc2FuaXR5J3sKKyAgICAgICAgICAgICAgIHVzZXJNYXAgPSBkaWN0OmZyb21fbGlzdChbez9USFJJRlRfVEVTVF9OVU1CRVJaX0VJR0hULCA4fV0pLAorICAgICAgICAgICAgICAgeHRydWN0cyA9IFtHb29kYnllXQorICAgICAgICAgICAgICB9LAorCisgICAgTG9vbmV5ID0gIyd0aHJpZnQudGVzdC5JbnNhbml0eSd7fSwKKworICAgIEZpcnN0TWFwID0gZGljdDpmcm9tX2xpc3QoW3s/VEhSSUZUX1RFU1RfTlVNQkVSWl9UV08sIEluc2FuaXR5fSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7P1RIUklGVF9URVNUX05VTUJFUlpfVEhSRUUsIEluc2FuaXR5fV0pLAorCisgICAgU2Vjb25kTWFwID0gZGljdDpmcm9tX2xpc3QoW3s/VEhSSUZUX1RFU1RfTlVNQkVSWl9TSVgsIExvb25leX1dKSwKKworICAgIEluc2FuZSA9IGRpY3Q6ZnJvbV9saXN0KFt7MSwgRmlyc3RNYXB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7MiwgU2Vjb25kTWFwfV0pLAorCisgICAgaW86Zm9ybWF0KCJSZXR1cm4gPSB+cH5uIiwgW0luc2FuZV0pLAorCisgICAge3JlcGx5LCBJbnNhbmV9OworCitoYW5kbGVfZnVuY3Rpb24odGVzdE11bHRpLCBBcmdzID0ge0FyZzAsIEFyZzEsIEFyZzIsIF9BcmczLCBBcmc0LCBBcmc1fSkKKyAgd2hlbiBpc19pbnRlZ2VyKEFyZzApLAorICAgICAgIGlzX2ludGVnZXIoQXJnMSksCisgICAgICAgaXNfaW50ZWdlcihBcmcyKSwKKyAgICAgICBpc19pbnRlZ2VyKEFyZzQpLAorICAgICAgIGlzX2ludGVnZXIoQXJnNSkgLT4KKworICAgIGlvOmZvcm1hdCgidGVzdE11bHRpKH5wKX5uIiwgW0FyZ3NdKSwKKyAgICB7cmVwbHksICMndGhyaWZ0LnRlc3QuWHRydWN0J3tzdHJpbmdfdGhpbmcgPSA8PCJIZWxsbzIiPj4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZyA9IEFyZzAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTMyX3RoaW5nID0gQXJnMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpNjRfdGhpbmcgPSBBcmcyfX07CisKK2hhbmRsZV9mdW5jdGlvbih0ZXN0RXhjZXB0aW9uLCB7U3RyaW5nfSkgd2hlbiBpc19iaW5hcnkoU3RyaW5nKSAtPgorICAgIGlvOmZvcm1hdCgidGVzdEV4Y2VwdGlvbih+cCl+biIsIFtTdHJpbmddKSwKKyAgICBjYXNlIFN0cmluZyBvZgorICAgICAgICA8PCJYY2VwdGlvbiI+PiAtPgorICAgICAgICAgICAgdGhyb3coIyd0aHJpZnQudGVzdC5YY2VwdGlvbid7ZXJyb3JDb2RlID0gMTAwMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlID0gU3RyaW5nfSk7CisgICAgICAgIDw8IlRFeGNlcHRpb24iPj4gLT4KKyAgICAgICAgICAgIHRocm93KHs/VEFwcGxpY2F0aW9uRXhjZXB0aW9uX1N0cnVjdHVyZX0pOworICAgICAgICBfIC0+CisgICAgICAgICAgICBvaworICAgIGVuZDsKKworaGFuZGxlX2Z1bmN0aW9uKHRlc3RNdWx0aUV4Y2VwdGlvbiwge0FyZzAsIEFyZzF9KSAtPgorICAgIGlvOmZvcm1hdCgidGVzdE11bHRpRXhjZXB0aW9uKH5wLCB+cCl+biIsIFtBcmcwLCBBcmcxXSksCisgICAgY2FzZSBBcmcwIG9mCisgICAgICAgIDw8IlhjZXB0aW9uIj4+IC0+CisgICAgICAgICAgICB0aHJvdygjJ3RocmlmdC50ZXN0LlhjZXB0aW9uJ3tlcnJvckNvZGUgPSAxMDAxLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZ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ICogKGFyZ3MubGltaXQgLSAxKSkKKyAgICBwcmludCgnW09LXTogbGltaXQgLSAxJykKKyAgICB0ZXN0X3N0cmluZyhwcm90bywgJ2EnICogYXJncy5saW1pdCkKKyAgICB0ZXN0X3N0cmluZyhwcm90bywgJ2EnICogYXJncy5saW1pdCkKKyAgICBwcmludCgnW09LXToganVzdCBsaW1pdCcpCisgICAgdHJ5OgorICAgICAgICB0ZXN0X3N0cmluZyhwcm90bywgJ2EnICogKGFyZ3MubGltaXQgKyAxKSkKKyAgICBleGNlcHQgRXhjZXB0aW9uOgorICAgICAgICBwcmludCgnW09LXTogbGltaXQgKyAxJykKKyAgICBlbHNlOgorICAgICAgICBwcmludCgnW0VSUk9SXTogbGltaXQgKyAxJykKKyAgICAgICAgYXNzZXJ0IEZhbHNlCisKKworaWYgX19uYW1lX18gPT0gJ19fbWFpbl9fJzoKKyAgICBtYWluKHN5cy5hcmd2WzE6XSkKZGlmZiAtLWdpdCBhL3Rlc3QvZmVhdHVyZXMvdGVzdHMuanNvbiBiL3Rlc3QvZmVhdHVyZXMvdGVzdHMuanNvbgpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi40MWUwN2Q3Ci0tLSAvZGV2L251bGwKKysrIGIvdGVzdC9mZWF0dXJlcy90ZXN0cy5qc29uCkBAIC0wLDAgKzEsMTE0IEBACitbCisgIHsKKyAgICAiZGVzY3JpcHRpb24iOiAiVEhlYWRlciBkZXRlY3RzIHVuZnJhbWVkIGJpbmFyeSB3aXJlIGZvcm1hdCIsCisgICAgIm5hbWUiOiAidGhlYWRlcl91bmZyYW1lZF9iaW5hcnkiLAorICAgICJjb21tYW5kIjogWworICAgICAgInB5dGhvbiIsCisgICAgICAidGhlYWRlcl9iaW5hcnkucHkiLAorICAgICAgIi0tb3ZlcnJpZGUtcHJvdG9jb2w9YmluYXJ5IiwKKyAgICAgICItLW92ZXJyaWRlLXRyYW5zcG9ydD1idWZmZXJlZCIKKyAgICBdLAorICA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IndvcmtkaXIiOiAiZmVhdHVyZXMiCisgIH0sCisgIHsKKyAgICAiZGVzY3JpcHRpb24iOiAiVEhlYWRlciBkZXRlY3RzIGZyYW1lZCBjb21wYWN0IHdpcmUgZm9ybWF0IiwKKyAgICAibmFtZSI6ICJ0aGVhZGVyX2ZyYW1lZF9jb21wYWN0IiwKKyAgICAiY29tbWFuZCI6IFsKKyAgICAgICJweXRob24iLAorICAgICAgInRoZWFkZXJfYmluYXJ5LnB5IiwKKyAgICAgICItLW92ZXJyaWRlLXByb3RvY29sPWNvbXBhY3QiLAorICAgICAgIi0tb3ZlcnJpZGUtdHJhbnNwb3J0PWZyYW1lZCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbImhlYWRlciJdLAorICAgICJ0cmFuc3BvcnRzIjogWyJidWZmZXJlZCJdLAorICAgICJzb2NrZXRzIjogWyJpcCJdLAorICAgICJ3b3JrZGlyIjogImZlYXR1cmVzIgorICB9LAorICB7CisgICAgIm5hbWUiOiAibGltaXRfc3RyaW5nX2xlbmd0aCIsCisgICAgImNvbW1hbmQiOiBbCisgICAgICAicHl0aG9uIiwKKyAgICAgICJzdHJpbmdfbGltaXQucHkiLAorICAgICAgIi0tbGltaXQ9NTAiCisgICAgXSwKKyAgICAicmVtb3RlX2FyZ3MiOiBbCisgICAgICAiLS1zdHJpbmctbGltaXQ9NTAiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImNvbXBhY3QiCisgICAgXSwKKyAgICAidHJhbnNwb3J0cyI6IFsiYnVmZmVyZWQiXSwKKyAgICAic29ja2V0cyI6IFsiaXAiXSwKKyAgICAid29ya2RpciI6ICJmZWF0dXJlcyIKKyAgfSwKKyAgeworICAgICJuYW1lIjogImxpbWl0X2NvbnRhaW5lcl9sZW5ndGgiLAorICAgICJjb21tYW5kIjogWworICAgICAgInB5dGhvbiIsCisgICAgICAiY29udGFpbmVyX2xpbWl0LnB5IiwKKyAgICAgICItLWxpbWl0PTUwIgorICAgI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ZXh0LkNvbnRleHQsIHRoaW5nIGludDMyKSAociBpbnQzMiwgZXJyIGVycm9yKSB7CisJZm10LlByaW50ZigidGVzdEkzMiglZClcbiIsIHRoaW5nKQorCXJldHVybiB0aGluZywgbmlsCit9CisKKy8vIFByaW50cyAndGVzdEk2NCgiJWQiKScgd2l0aCB0aGluZyBhcyAnJWQnCisvLyBAcGFyYW0gaTY0IHRoaW5nIC0gdGhlIGk2NCB0byBwcmludAorLy8gQHJldHVybiBpNjQgLSByZXR1cm5zIHRoZSBpNjQgJ3RoaW5nJworLy8KKy8vIFBhcmFtZXRlcnM6CisvLyAgLSBUaGluZworZnVuYyAocCAqcHJpbnRpbmdIYW5kbGVyKSBUZXN0STY0KGN0eCBjb250ZXh0LkNvbnRleHQsIHRoaW5nIGludDY0KSAociBpbnQ2NCwgZXJyIGVycm9yKSB7CisJZm10LlByaW50ZigidGVzdEk2NCglZClcbiIsIHRoaW5nKQorCXJldHVybiB0aGluZywgbmlsCit9CisKKy8vIFByaW50cyAndGVzdERvdWJsZSgiJWYiKScgd2l0aCB0aGluZyBhcyAnJWYnCisvLyBAcGFyYW0gZG91YmxlIHRoaW5nIC0gdGhlIGRvdWJsZSB0byBwcmludAorLy8gQHJldHVybiBkb3VibGUgLSByZXR1cm5zIHRoZSBkb3VibGUgJ3RoaW5nJworLy8KKy8vIFBhcmFtZXRlcnM6CisvLyAgLSBUaGluZworZnVuYyAocCAqcHJpbnRpbmdIYW5kbGVyKSBUZXN0RG91YmxlKGN0eCBjb250ZXh0LkNvbnRleHQsIHRoaW5nIGZsb2F0NjQpIChyIGZsb2F0NjQsIGVyciBlcnJvcikgeworCWZtdC5QcmludGYoInRlc3REb3VibGUoJWYpXG4iLCB0aGluZykKKwlyZXR1cm4gdGhpbmcsIG5pbAorfQorCisvLyBQcmludHMgJ3Rlc3RCaW5hcnkoIiVzIiknIHdoZXJlICclcycgaXMgYSBoZXgtZm9ybWF0dGVkIHN0cmluZyBvZiB0aGluZydzIGRhdGE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mdHdhcmUgRm91bmRhdGlvbiAoQVNGKSIKKyAgICAsImxpY2Vuc2UiIDogIkFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCIKKyAgICAsInVybCIgOiAiaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wIgorICAgICwidGFyZ2V0RGF0YSIgOiBbCisgICAgICAgICB7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogImZsYXNoLmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMQorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJiaW4vVHV0b3JpYWwuc3dmIgorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogImphdmFzY3JpcHQuaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAxCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogImJpblxcaW5kZXguaHRtbCIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJuZWtvLmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMgorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJuZWtvIGJpbi9UdXRvcmlhbC5uIgorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogInBocC5oeG1sIgorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogImNwcC5oeG1sIgorICAgICAgICAgICAgLCJydW5BY3Rpb25UeXBlIiA6IDIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVGV4dCIgOiAiYmluL01haW4tZGVidWcuZXhlICBjbGllbnQgLS1wcm90b2NvbCBqc29uIgorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGhUb0h4bWwiIDogImphdmEuaHhtbCIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJjc2hhcnAuaHhtbCIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJweXRob24uaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAyCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogInB5dGhvbiBiaW4vVHV0b3JpYWwucHkiCisgICAgICAgIH0KKyAgICBdCisgICAgLCJmaWxlcyIgOiBbCisgICAgICAgICB7CisgICAgICAgICAgICAgInBhdGgiIDogInNyY1xcVGVzdENsaWVudC5oeCIKKyAgICAgICAgICAgICwidXNlVGFicyIgOiB0cnVlCisgICAgICAgICAgICAsImluZGVudFNpemUiIDogNAorICAgICAgICAgICAgLCJmb2xkZWRSZWdpb25zIiA6IFsKKworICAgICAgICAgICAgXQorICAgICAgICAgICAgLCJhY3RpdmVMaW5lIiA6IDE4OAorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGgiIDogInNyY1xcVGVzdFNlcnZlci5oeCIKKyAgICAgICAgICAgICwidXNlVGFicyIgOiB0cnVlCisgICAgICAgICAgICAsImluZGVudFNpemUiIDogNAorICAgICAgICAgICAgLCJmb2xkZWRSZWdpb25zIiA6IFsKKworICAgICAgICAgICAgXQorICAgICAgICAgICAgLCJhY3RpdmVMaW5lIiA6IDg4CisgICAgICAgIH0KKyAgICBdCisgICAgLCJhY3RpdmVGaWxlIiA6ICJzcmNcXFRlc3RDbGllbnQuaHgiCisgICAgLCJvcGVuRkxUYXJnZXQiIDogbnVsbAorICAgICwib3BlbkZMQnVpbGRNb2RlIiA6ICJEZWJ1ZyIKKyAgICAsInJ1bkFjdGlvblR5cGUiIDogbnVsbAorICAgICwicnVuQWN0aW9uVGV4dCIgOiBudWxsCisgICAgLCJidWlsZEFjdGlvbkNvbW1hbmQiIDogbnVsbAor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2ZXJUeXBlIHsKKyAgICBzaW1wbGU7CisgICAgLyoKKyAgICB0aHJlYWRwb29sOworICAgIHRocmVhZGVkOworICAgIG5vbmJsb2NraW5nOworICAgICovCit9CisKKworY2xhc3MgQXJndW1lbnRzCit7CisgICAgcHVibGljIHZhciBwcmludEhlbHBPbmx5KGRlZmF1bHQsbnVsbCkgOiBCb29sID0gZmFsc2U7CisKKyAgICBwdWJsaWMgdmFyIHNlcnZlcihkZWZhdWx0LG51bGwpIDogQm9vbCA9IGZhbHNlOworICAgIHB1YmxpYyB2YXIgc2VydmVydHlwZShkZWZhdWx0LG51bGwpIDogU2VydmVyVHlwZSA9IHNpbXBsZTsKKworICAgIHB1YmxpYyB2YXIgaG9zdChkZWZhdWx0LG51bGwpIDogU3RyaW5nID0gImxvY2FsaG9zdCI7CisgICAgcHVibGljIHZhciBwb3J0KGRlZmF1bHQsbnVsbCkgOiBJbnQgPSA5MDkwOworCisgICAgcHVibGljIHZhciBwcm90b2NvbChkZWZhdWx0LG51bGwpIDogUHJvdG9jb2xUeXBlID0gYmluYXJ5OworICAgIHB1YmxpYyB2YXIgdHJhbnNwb3J0KGRlZmF1bHQsbnVsbCkgOiBFbmRwb2ludFRyYW5zcG9ydCA9IHNvY2tldDsKKyAgICBwdWJsaWMgdmFyIGZyYW1lZChkZWZhdWx0LG51bGwpIDogQm9vbCA9IGZhbHNlOworICAgIHB1YmxpYyB2YXIgYnVmZmVyZWQoZGVmYXVsdCxudWxsKSA6IEJvb2wgPSBmYWxzZTsKKworICAgIHB1YmxpYyB2YXIgbnVtSXRlcmF0aW9ucyhkZWZhdWx0LG51bGwpIDogSW50ID0gMTsKKyAgICBwdWJsaWMgdmFyIG51bVRocmVhZHMoZGVmYXVsdCxudWxsKSA6IEludCA9IDE7CisgICAgcHVibGljIHZhciBza2lwU3BlZWRUZXN0KGRlZmF1bHQsbnVsbCkgOiBCb29sID0gZmFsc2U7CisKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoKSB7CisgICAgICAgICNpZiBzeXMKKyAgICAgICAgICAjaWYgIXBocHdlYnNlcnZlcgorICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgIFBhcnNlQXJncygpOworICAgICAgICAgIH0gY2F0Y2ggKGUgOiBTdHJpbmcpIHsKKyAgICAgICAgICAgIHRyYWNlKEdldEhlbHAoKSk7CisgICAgICAgICAgICB0aHJvdyBlOworICAgICAgICAgIH0KKyAgICAgICAgICAjZWxzZQorICAgICAgICAgICAgLy9mb3JjaW5nIHNlcnZlcgorICAgICAgICAgICAgc2VydmVyID0gdHJ1ZTsKKyAgICAgICAgICAgIHRyYW5zcG9ydCA9IGh0dHA7CisgICAgICAgICAgI2VuZAorICAgICAgICAjZWxzZQorICAgICAgICB0cmFjZSgiV046IFBsYXRmb3JtIGRvZXMgbm90IHN1cHBvcnQgcHJvZ3JhbSBhcmd1bWVudHMsIHVzaW5nIGRlZmF1bHRzLiIpOworICAgICAgICAjZW5kCisgICAgfQorCisgICAgI2lmIHN5cworCisgICAgcHJpdmF0ZSBzdGF0aWMgZnVuY3Rpb24gR2V0SGVscCgpIDogU3RyaW5nIHsKKyAgICAgICAgdmFyIHNQcm9nID0gUGF0aC53aXRob3V0RGlyZWN0b3J5KCBTeXMuZXhlY3V0YWJsZVBhdGgoKSk7CisgICAgICAgIHJldHVybiAiXG4iCisgICAgICAgICAgICArc1Byb2crIiAgW2NsaWVudHxzZXJ2ZXJdICBbb3B0aW9uc11cbiIKKyAgICAgICAgICAgICsiXG4iCisgICAgICAgICAgICArIk1vZHVzOiBFaXRoZXIgY2xpZW50IG9yIHNlcnZlciwgdGhlIGRlZmF1bHQgaXMgY2xpZW50LlxuIgorICAgICAgICAgICAgKyJcbiIKKyAgICAgICAgICAgICsiQ29tbW9uIG9wdGlvbnM6XG4iCisgICAgICAgICAgICArIiAgLWggWyAtLWhlbHAgXSAgICAgICAgICAgICAgIHByb2R1Y2UgaGVscCBtZXNzYWdlXG4iCisgICAgICAgICAgICArIiAgLS1wb3J0IGFyZyAoPTkwOTApICAgICAgICAgIFBvcnQgbnVtYmVyIHRvIGxpc3RlbiAvIGNvbm5lY3QgdG9cbiIKKyAgICAgICAgICAgIC8qIG5vdCBzdXBwb3J0ZWQgeWV0CisgICAgICAgICAgICArIiAgLS1kb21haW4tc29ja2V0IGFyZyAgICAgICAgIFVuaXggRG9tYWluIFNvY2tldCAoZS5nLiAvdG1wL1RocmlmdFRlc3QudGhyaWZ0KVxuIgorICAgICAgICAgICAgKyIgIC0tbmFtZWQtcGlwZSBhcmcgICAgICAgICAgICBXaW5kb3dzIE5hbWVkIFBpcGUgKGUuZy4gTXlUaHJpZnRQaXBlKVxuIgorICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICsiICAtLXByb3RvY29sIGFyZyAoPWJpbmFyeSkgICAgcHJvdG9jb2w6IGJpbmFyeSwgY29tcGFjdCwganNvblxuIgorICAgICAgICAgICAgLyogbm90IHN1cHBvcnRlZCB5ZXQKKyAgICAgICAgICAgICsiICAtLXNzbCAgICAgICAgICAgICAgICAgICAgICAgRW5jcnlwdGVkIFRyYW5zcG9ydCB1c2luZyBTU0xcbiIKKyAgICAgICAgICAgICovCisgICAgICAgICAgICArIlxuIgorICAgICAgICAgICAgKyJTZXJ2ZXIgb25seSBvcHRpb25zOlxuIgorICAgICAgICAgICAgKyIgIC0tdHJhbnNwb3J0IGFyZyAoPXNvY2tldHMpICBUcmFuc3BvcnQ6IGJ1ZmZlcmVkLCBmcmFtZWQsIGh0dHAsIGFub25waXBlXG4iCisgICAgICAgICAgICAvKiBub3Qgc3VwcG9ydGVkIHlldAorICAgICAgICAgICAgKyIgIC0tcHJvY2Vzc29yLWV2ZW50cyAgICAgICAgICBwcm9jZXNzb3ItZXZlbnRzXG4iCisgICAgICAgICAgICArIiAgLS1zZXJ2ZXItdHlwZSBhcmcgKD1zaW1wbGUpIHR5cGUgb2Ygc2VydmVyLCBcInNpbXBsZVwiLCBcInRocmVhZC1wb29sXCIsIFxuIgorICAgICAgICAgICAgKyIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInRocmVhZGVkXCIsIG9yIFwibm9uYmxvY2tpbmdcIlxuIgorICAgICAgICAgICAgKyIgIC1uIFsgLS13b3JrZXJzIF0gYXJnICg9NCkgICBOdW1iZXIgb2YgdGhyZWFkIHBvb2xzIHdvcmtlcnMuIE9ubHkgdmFsaWQgZm9yIFxuIgorICAgICAgICAgICAgKyIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJlYWQtcG9vbCBzZXJ2ZXIgdHlwZVxuIgorICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICsiXG4iCisgICAgICAgICAgICArIkNsaWVudCBvbmx5IG9wdGlvbnM6XG4iCisgICAgICAgICAgICArIiAgLS1ob3N0IGFyZyAoPWxvY2FsaG9zdCkgICAgIEhvc3QgdG8gY29ubmVjdFxuIgorICAgICAgICAgICAgKyIgIC0tdHJhbnNwb3J0IGFyZyAoPXNvY2tldHMpICBUcmFuc3BvcnQ6IGJ1ZmZlcmVkLCBmcmFtZWQsIGh0dHAsIGV2aHR0cFxuIgorICAgICAgICAgICAgLyogbm90IHN1cHBvcnRlZCB5ZXQKKyAgICAgICAgICAgICsiICAtLWFub24tcGlwZXMgaFJlYWQgaFdyaXRlICAgV2luZG93cyBBbm9ueW1vdXMgUGlwZXMgcGFpciAoaGFuZGxlcylcbiIKKyAgICAgICAgICAgICovCisgICAgICAgICAgICArIiAgLW4gWyAtLXRlc3Rsb29wcyBdIGFyZyAoPTEpIE51bWJlciBvZiBUZXN0c1xuIgorICAgICAgICAgICAgKyIgIC10IFsgLS10aHJlYWRzIF0gYXJnICg9MSkgICBOdW1iZXIgb2YgVGVzdCB0aHJlYWRzXG4iCisgICAgICAgICAgICArIiAgLS1za2lwLXNwZWVkLXRlc3QgICAgICAgICAgIFNraXAgdGhlIHNwZWVkIHRlc3RcbiIKKyAgICAgICAgICAgICsiXG4iCisgICAgICAgICAgICArIkFsbCBhcmd1bWVudHMgYXJlIG9wdGlvbmFsLlxuIgorICAgICAgICAgICAgOworICAgIH0KKworCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBQYXJzZUFyZ3MoKSA6IFZvaWQgeworCisgICAgICAgIHZhciBhcmdzID0gU3lzLmFyZ3MoKS5jb3B5KCk7CisgICAgICAgIGlmKCAoYXJncyA9PSBudWxsKSB8fCAoYXJncy5sZW5ndGggPD0gMCkpIHsKKyAgICAgICAgICAgIHNlcnZlciA9IGZhbHNlOworICAgICAgICAgICAgbnVtVGhyZWFkcyA9IDE7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICB2YXIgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICBpZiAoIGFyZyA9PSAiY2xpZW50IikgeworICAgICAgICAgICAgc2VydmVyID0gZmFsc2U7CisgICAgICAgICAgICBudW1UaHJlYWRzID0gMTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICggYXJnID09ICJzZXJ2ZXIiKSB7CisgICAgICAgICAgICBzZXJ2ZXIgPSB0cnVlOworICAgICAgICAgICAgbnVtVGhyZWFkcyA9IDQ7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoIChhcmcgPT0gIi1oIikgfHwgKGFyZyA9PSAiLS1oZWxwIikpIHsKKyAgICAgICAgICAgIC8vIC1oIFsgLS1oZWxwIF0gICAgICAgICAgICAgICBwcm9kdWNlIGhlbHAgbWVzc2FnZQorICAgICAgICAgICAgU3lzLnByaW50bG4oIEdldEhlbHAoKSk7CisgICAgICAgICAgICBwcmludEhlbHBPbmx5ID0gdHJ1ZTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIHRocm93ICJGaXJzdCBhcmd1bWVudCBtdXN0IGJlICdzZXJ2ZXInIG9yICdjbGllbnQnIjsKKyAgICAgICAgfQorCisKKyAgICAgICAgd2hpbGUoIGFyZ3MubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworCisgICAgICAgICAgICBpZiAoIChhcmcgPT0gIi1oIikgfHwgKGFyZyA9PSAiLS1oZWxwIikpIHsKKyAgICAgICAgICAgICAgICAvLyAtaCBbIC0taGVscCBdICAgICAgICAgICAgICAgcHJvZHVjZSBoZWxwIG1lc3NhZ2UKKyAgICAgICAgICAgICAgICBTeXMucHJpbnRsbiggR2V0SGVscCgpKTsKKyAgICAgICAgICAgICAgICBwcmludEhlbHBPbmx5ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChhcmcgPT0gIi0tcG9ydCIpIHsKKyAgICAgICAgICAgICAgICAvLyAtLXBvcnQgYXJnICg9OTA5MCkgICAgICAgICAgUG9ydCBudW1iZXIgdG8gbGlzdGVuCisgICAgICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgICAgIHZhciB0bXAgPSBTdGQucGFyc2VJbnQoYXJnKTsKKyAgICAgICAgICAgICAgICBpZiggdG1wICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcG9ydCA9IHRtcDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyAiSW52YWxpZCBwb3J0IG51bWJlciAiK2FyZzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChhcmcgPT0gIi0tZG9tYWluLXNvY2tldCIpIHsKKyAgICAgICAgICAgICAgICAvLyAgIC0tZG9tYWluLXNvY2tldCBhcmcgICAgICAgICBVbml4IERvbWFpbiBTb2NrZXQgKGUuZy4gL3RtcC9UaHJpZnRUZXN0LnRocmlmdCkKKyAgICAgICAgICAgICAgICB0aHJvdyAiZG9tYWluIHNvY2tldHMgbm90IHN1cHBvcnRlZCB5ZXQiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAoYXJnID09ICItLW5hbWVkLXBpcGUiKSB7CisgICAgICAgICAgICAgICAgLy8gICAtLW5hbWVkLXBpcGUgYXJnICAgICAgICAgICAgV2luZG93cyBOYW1lZCBQaXBlIChlLmcuIE15VGhyaWZ0UGlwZSkKKyAgICAgICAgICAgICAgICB0aHJvdyAibmFtZWQgcGlwZXMgbm90IHN1cHBvcnRlZCB5ZXQiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZiAoYXJnID09ICItLXByb3RvY29sIikgeworICAgICAgICAgICAgICAgIC8vIC0tcHJvdG9jb2wgYXJnICg9YmluYXJ5KSAgICBwcm90b2NvbDogYmluYXJ5LCBjb21wYWN0LCBqc29uCisgICAgICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgICAgIGlmKCBhcmcgPT0gImJpbmFyeSIpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2wgPSBiaW5hcnk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmKCBhcmcgPT0gImNvbXBhY3QiKSB7CisgICAgICAgICAgICAgICAgICAgIHByb3RvY29sID0gY29tcGFjdDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYoIGFyZyA9PSAianNvbiIpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2wgPSBqc29uOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIEludmFsaWRBcmcoYXJnKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChhcmcgPT0gIi0tc3NsIikgeworICAgICAgICAgICAgICAgIC8vIC0tc3NsICAgICAgICAgICAgICAgICAgICAgICBFbmNyeXB0ZWQgVHJhbnNwb3J0IHVzaW5nIFNTTAorICAgICAgICAgICAgICAgIHRocm93ICJTU0wgbm90IHN1cHBvcnRlZCB5ZXQiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgLy9TZXJ2ZXIgb25seSBvcHRpb25zOgorICAgICAgICAgICAgICAgIGlmKCBzZXJ2ZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgUGFyc2VTZXJ2ZXJBcmd1bWVudCggYXJnLCBhcmdzKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBQYXJzZUNsaWVudEFyZ3VtZW50KCBhcmcsIGFyZ3MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworCisgICAgcHJpdmF0ZSBmdW5jdGlvbiBQYXJzZVNlcnZlckFyZ3VtZW50KCBhcmcgOiBTdHJpbmcsIGFyZ3MgOiBBcnJheTxTdHJpbmc+KSA6IFZvaWQgeworICAgICAgICBpZiAoYXJnID09ICItLXRyYW5zcG9ydCIpIHsKKyAgICAgICAgICAgIC8vICAtLXRyYW5zcG9ydCBhcmcgKD1zb2NrZXRzKSAgVHJhbnNwb3J0OiBidWZmZXJlZCwgZnJhbWVkLCBodHRwLCBhbm9ucGlwZQorICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgaWYoIGFyZyA9PSAiYnVmZmVyZWQiKSB7CisgICAgICAgICAgICAgICAgYnVmZmVyZWQgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIGlmKCBhcmcgPT0gImZyYW1lZCIpIHsKKyAgICAgICAgICAgICAgICBmcmFtZWQgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIGlmKCBhcmcgPT0gImh0dHAiKSB7CisgICAgICAgICAgICAgICAgdHJhbnNwb3J0ID0gaHR0cDsKKyAgICAgICAgICAgIH0gZWxzZSBpZiggYXJnID09ICJhbm9ucGlwZSIpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyAiQW5vbiBwaXBlcyB0cmFuc3BvcnQgbm90IHN1cHBvcnRlZCB5ZXQiOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBJbnZhbGlkQXJnKGFyZyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoYXJnID09ICItLXByb2Nlc3Nvci1ldmVudHMiKSB7CisgICAgICAgICAgICB0aHJvdyAiUHJvY2Vzc29yIGV2ZW50cyBub3Qgc3VwcG9ydGVkIHlldCI7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoYXJnID09ICItLXNlcnZlci10eXBlIikgeworICAgICAgICAgICAgLy8gIC0tc2VydmVyLXR5cGUgYXJnICg9c2ltcGxlKSB0eXBlIG9mIHNlcnZlciwKKyAgICAgICAgICAgIC8vIG9uZSBvZiAic2ltcGxlIiwgInRocmVhZC1wb29sIiwgInRocmVhZGVkIiwgIm5vbmJsb2NraW5nIgorICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgaWYoIGFyZyA9PSAic2ltcGxlIikgeworICAgICAgICAgICAgICAgIHNlcnZlcnR5cGUgPSBzaW1wbGU7CisgICAgICAgICAgICB9IGVsc2UgaWYoIGFyZyA9PSAidGhyZWFkLXBvb2wiKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgYXJnKyIgc2VydmVyIG5vdCBzdXBwb3J0ZWQgeWV0IjsKKyAgICAgICAgICAgIH0gZWxzZSBpZiggYXJnID09ICJ0aHJlYWRlZCIpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBhcmcrIiBzZXJ2ZXIgbm90IHN1cHBvcnRlZCB5ZXQiOworICAgICAgICAgICAgfSBlbHNlIGlmKCBhcmcgPT0gIm5vbmJsb2NraW5nIikgeworICAgICAgICAgICAgICAgIHRocm93IGFyZysiIHNlcnZlciBub3Qgc3VwcG9ydGVkIHlldCI7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIEludmFsaWRBcmcoYXJnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmICgoYXJnID09ICItbiIpIHx8IChhcmcgPT0gIi0td29ya2VycyIpKSB7CisgICAgICAgICAgICAvLyAgLW4gWyAtLXdvcmtlcnMgXSBhcmcgKD00KSAgIE51bWJlciBvZiB0aHJlYWQgcG9vbHMgd29ya2Vycy4gT25seSB2YWxpZCBmb3IKKyAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyZWFkLXBvb2wgc2VydmVyIHR5cGUKKyAgICAgICAgICAgIGFyZyA9IGFyZ3Muc2hpZnQoKTsKKyAgICAgICAgICAgIHZhciB0bXAgPSBTdGQucGFyc2VJbnQoYXJnKTsKKyAgICAgICAgICAgIGlmKCB0bXAgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG51bVRocmVhZHMgPSB0bXA7CisgICAgICAgICAgICB9IGVsc2V7CisgICAgICAgICAgICAgICAgdGhyb3cgIkludmFsaWQgbnVtYmVyICIrYXJnOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgSW52YWxpZEFyZyhhcmcpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBwcml2YXRlIGZ1bmN0aW9uIFBhcnNlQ2xpZW50QXJndW1lbnQoIGFyZyA6IFN0cmluZywgYXJncyA6IEFycmF5PFN0cmluZz4pIDogVm9pZCB7CisgICAgICAgIGlmIChhcmcgPT0gIi0taG9zdCIpIHsKKyAgICAgICAgICAgIC8vICAtLWhvc3QgYXJnICg9bG9jYWxob3N0KSAgICAgSG9zdCB0byBjb25uZWN0CisgICAgICAgICAgICBob3N0ID0gYXJncy5zaGlmdCgpOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGFyZyA9PSAiLS10cmFuc3BvcnQiKSB7CisgICAgICAgICAgICAvLyAgLS10cmFuc3BvcnQgYXJnICg9c29ja2V0cykgIFRyYW5zcG9ydDogYnVmZmVyZWQsIGZyYW1lZCwgaHR0cCwgZXZodHRwCisgICAgICAgICAgICBhcmcgPSBhcmdzLnNoaWZ0KCk7CisgICAgICAgICAgICBpZiggYXJnID09ICJidWZmZXJlZCIpIHsKKyAgICAgICAgICAgICAgICBidWZmZXJlZCA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgaWYoIGFyZyA9PSAiZnJhbWVkIikgeworICAgICAgICAgICAgICAgIGZyYW1lZCA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgaWYoIGFyZyA9PSAiaHR0cCIpIHsKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnQgPSBodHRwOworICAgICAgICAgICAgfSBlbHNlIGlmKCBhcmcgPT0gImV2aHR0cCIpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyAiZXZodHRwIHRyYW5zcG9ydCBub3Qgc3VwcG9ydGVkIHlldCI7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIEludmFsaWRBcmcoYXJnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChhcmcgPT0gIi0tYW5vbi1waXBlcyIpIHsKKyAgICAgICAgICAgIC8vICAtLWFub24tcGlwZXMgaFJlYWQgaFdyaXRlICAgV2luZG93cyBBbm9ueW1vdXMgUGlwZXMgcGFpciAoaGFuZGxlcykKKyAgICAgICAgICAgIHRocm93ICJBbm9uIHBpcGVzIHRyYW5zcG9ydCBub3Qgc3VwcG9ydGVkIHlldCI7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSBpZiAoKGFyZyA9PSAiLW4iKSB8fCAoYXJnID09ICItLXRlc3Rsb29wcyIpKSB7CisgICAgICAgICAgICAvLyAgLW4gWyAtLXRlc3Rsb29wcyBdIGFyZyAoPTEpIE51bWJlciBvZiBUZXN0cworICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgdmFyIHRtcCA9IFN0ZC5wYXJzZUludChhcmcpOworICAgICAgICAgICAgaWYoIHRtcCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbnVtSXRlcmF0aW9ucyA9IHRtcDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdGhyb3cgIkludmFsaWQgbnVtYmVyICIrYXJnOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKChhcmcgPT0gIi10IikgfHwgKGFyZyA9PSAiLS10aHJlYWRzIikpIHsKKyAgICAgICAgICAgIC8vICAtdCBbIC0tdGhyZWFkcyBdIGFyZyAoPTEpICAgTnVtYmVyIG9mIFRlc3QgdGhyZWFkcworICAgICAgICAgICAgYXJnID0gYXJncy5zaGlmdCgpOworICAgICAgICAgICAgdmFyIHRtcCA9IFN0ZC5wYXJzZUludChhcmcpOworICAgICAgICAgICAgaWYoIHRtcCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbnVtVGhyZWFkcyA9IHRtcDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdGhyb3cgIkludmFsaWQgbnVtYmVyICIrYXJnOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGVsc2UgaWYgKGFyZyA9PSAiLS1za2lwLXNwZWVkLXRlc3QiKSB7CisgICAgICAgICAgICAvLyAgLS1za2lwLXNwZWVkLXRlc3QgICAgICAgICAgICAgIFNraXAgdGhlIHNwZWVkIHRlc3QKKyAgICAgICAgICAgIHNraXBTcGVlZFRlc3QgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgSW52YWxpZEFyZyhhcmcpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAjZW5kCisKKworICAgIHByaXZhdGUgZnVuY3Rpb24gSW52YWxpZEFyZyggYXJnIDogU3RyaW5nKSA6IFZvaWQgeworICAgICAgICB0aHJvdyAnSW52YWxpZCBhcmd1bWVudCAkYXJnJzsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS90ZXN0L2hheGUvc3JjL01haW4uaHggYi90ZXN0L2hheGUvc3JjL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1wbGllZC4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUKKyAqIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQgbGltaXRhdGlvbnMKKyAqIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCisKKworcGFja2FnZTsKKworaW1wb3J0IG9yZy5hcGFjaGUudGhyaWZ0Lio7CitpbXBvcnQgb3JnLmFwYWNoZS50aHJpZnQucHJvdG9jb2wuKjsKK2ltcG9ydCBvcmcuYXBhY2hlLnRocmlmdC50cmFuc3BvcnQuKjsKK2ltcG9ydCBvcmcuYXBhY2hlLnRocmlmdC5zZXJ2ZXIuKjsKK2ltcG9ydCBvcmcuYXBhY2hlLnRocmlmdC5tZXRhX2RhdGEuKjsKKworaW1wb3J0IHRocmlmdC50ZXN0Lio7ICAvLyBnZW5lcmF0ZWQgY29kZQorCitjbGFzcyBNYWluCit7CisgICAgc3RhdGljIGZ1bmN0aW9uIG1haW4oKSB7CisgICAgICAgICNpZiBwaHB3ZWJzZXJ2ZXIKKyAgICAgICAgaW5pdFBocFdlYlNlcnZlcigpOworICAgICAgICAvL2NoZWNrIG1ldGhvZAorICAgICAgICBpZihwaHAuV2ViLmdldE1ldGhvZCgpICE9ICdQT1NUJykgeworICAgICAgICAgIFN5cy5wcmludGxuKCdodHRwIGVuZHBvaW50IGZvciB0aHJpZnQgdGVzdCBzZXJ2ZXInKTsKKyAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgI2VuZAorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB2YXIgYXJncyA9IG5ldyBBcmd1bWVudHMoKTsKKworICAgICAgICAgICAgaWYoIGFyZ3MucHJpbnRIZWxwT25seSkKKyAgICAgICAgICAgICAgICByZXR1cm47CisKKyAgICAgICAgICAgIGlmIChhcmdzLnNlcnZlcikKKyAgICAgICAgICAgICAgICBUZXN0U2VydmVyLkV4ZWN1dGUoYXJncyk7CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgVGVzdENsaWVudC5FeGVjdXRlKGFyZ3MpOworCisgICAgICAgICAgICB0cmFjZSgiQ29tcGxldGVkLiIpOworICAgICAgICB9IGNhdGNoIChlIDogU3RyaW5nKSB7CisgICAgICAgICAgICB0cmFjZShlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgICNpZiBwaHB3ZWJzZXJ2ZXIKKyAgICBwcml2YXRlIHN0YXRpYyBmdW5jdGlvbiBpbml0UGhwV2ViU2VydmVyKCkKKyAgICB7CisgICAgICAgIC8vcmVtYXAgdHJhY2UgdG8gZXJyb3IgbG9nCisgICAgICAgIGhheGUuTG9nLnRyYWNlID0gZnVuY3Rpb24odjpEeW5hbWljLCA/aW5mb3M6aGF4ZS5Qb3NJbmZvcykKKyAgICAgICAgeworICAgICAgICAgIC8vIGhhbmRsZSB0cmFjZQorICAgICAgICAgIHZhciBuZXdWYWx1ZSA6IER5bmFtaWM7CisgICAgICAgICAgaWYgKGluZm9zICE9IG51bGwgJiYgaW5mb3MuY3VzdG9tUGFyYW1zIT1udWxsKSB7CisgICAgICAgICAgICB2YXIgZXh0cmE6U3RyaW5nID0gIiI7CisgICAgICAgICAgICBmb3IoIHYgaW4gaW5mb3MuY3VzdG9tUGFyYW1zICkKKyAgICAgICAgICAgICAgZXh0cmEgKz0gIiwiICsgdjsKKyAgICAgICAgICAgIG5ld1ZhbHVlID0gdiArIGV4dHJhOworICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIG5ld1ZhbHVlID0gdjsKKyAgICAgICAgICB9CisgICAgICAgICAgdmFyIG1zZyA9IGluZm9zICE9IG51bGwgPyBpbmZvcy5maWxlTmFtZSArICc6JyArIGluZm9zLmxpbmVOdW1iZXIgKyAnOiAnIDogJyc7CisgICAgICAgICAgU3lzLnN0ZGVycigpLndyaXRlU3RyaW5nKCcke21zZ30ke25ld1ZhbHVlfVxuJyk7CisgICAgICAgIH0KKyAgICB9CisgICAgI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XBCaXQ7CisgICAgICAgIHRlc3RzRXhlY3V0ZWQgfD0gZ3JvdXBCaXQ7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIEV4cGVjdCggZXhwciA6IEJvb2wsIG1zZyA6IFN0cmluZykgOiBWb2lkIHsKKyAgICAgICAgaWYgKCBleHByKSB7CisgICAgICAgICAgICArK3N1Y2Nlc3NDbnQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICArK2Vycm9yQ250OworICAgICAgICAgICAgdGVzdHNGYWlsZWQgfD0gY3VycmVudFRlc3Q7CisgICAgICAgICAgICBmYWlsZWRUZXN0cyArPSAiXG4gICIgKyBtc2c7CisgICAgICAgICAgICBpZiggcHJpbnRfZGlyZWN0KSB7CisgICAgICAgICAgICAgICAgdHJhY2UoJ0ZBSUw6ICRtc2cnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBDYWxjdWxhdGVFeGl0Q29kZSgpIDogSW50IHsKKyAgICAgICAgdmFyIG5vdEV4ZWN1dGVkIDogSW50ID0gRVhJVENPREVfQUxMX0ZBSUxCSVRTICYgKH50ZXN0c0V4ZWN1dGVkKTsKKyAgICAgICAgcmV0dXJuIHRlc3RzRmFpbGVkIHwgbm90RXhlY3V0ZWQ7CisgICAgfQorCisgICAgcHVibGljIGZ1bmN0aW9uIFByaW50U3VtbWFyeSgpIDogVm9pZCB7CisgICAgICAgIHZhciB0b3RhbCA9IHN1Y2Nlc3NDbnQgKyBlcnJvckNudDsKKyAgICAgICAgdmFyIHNwID0gTWF0aC5yb3VuZCgoMTAwMCAqIHN1Y2Nlc3NDbnQpIC8gdG90YWwpIC8gMTA7CisgICAgICAgIHZhciBlcCA9IE1hdGgucm91bmQoKDEwMDAgKiBlcnJvckNudCkgLyB0b3RhbCkgLyAxMDsKKworICAgICAgICB0cmFjZSgnPT09PT09PT09PT09PT09PT09PT09PT09PT09Jyk7CisgICAgICAgIHRyYWNlKCdUZXN0cyBleGVjdXRlZCAgICAkdG90YWwnKTsKKyAgICAgICAgdHJhY2UoJ1Rlc3RzIHN1Y2NlZWRlZCAgICRzdWNjZXNzQ250ICgkc3AlKScpOworICAgICAgICB0cmFjZSgnVGVzdHMgZmFpbGVkICAgICAgJGVycm9yQ250ICgkZXAlKScpOworICAgICAgICBpZiAoIGVycm9yQ250ID4gMCkKKyAgICAgICAgeworICAgICAgICAgICAgdHJhY2UoJz09PT09PT09PT09PT09PT09PT09PT09PT09PScpOworICAgICAgICAgICAgdHJhY2UoJ0ZBSUxFRCBURVNUUzogJGZhaWxlZFRlc3RzJyk7CisgICAgICAgIH0KKyAgICAgICAgdHJhY2UoJz09PT09PT09PT09PT09PT09PT09PT09PT09PScpOworICAgIH0KK30KKworCitjbGFzcyBUZXN0Q2xpZW50IHsKKworICAgIHB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gRXhlY3V0ZShhcmdzIDogQXJndW1lbnRzKSA6ICBWb2lkCisgICAgeworICAgICAgICB2YXIgZXhpdENvZGUgPSAweEZGOworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGRpZmZ0ID0gVGltZXIuc3RhbXAoKTsKKworICAgICAgICAgICAgaWYgKCBhcmdzLm51bVRocmVhZHMgPiAxKSB7CisgICAgICAgICAgICAgICAgI2lmIGNwcAorICAgICAgICAgICAgICAgIGV4aXRDb2RlID0gTXVsdGlUaHJlYWRDbGllbnQoYXJncyk7CisgICAgICAgICAgICAgICAgI2Vsc2UKKyAgICAgICAgICAgICAgICB0cmFjZSgnVGhyZWFkcyBub3Qgc3VwcG9ydGVkL2ltcGxlbWVudGVkIGZvciB0aGlzIHBsYXRmb3JtLicpOworICAgICAgICAgICAgICAgIGV4aXRDb2RlID0gU2luZ2xlVGhyZWFkQ2xpZW50KGFyZ3MpOworICAgICAgICAgICAgICAgICNlbmQKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZXhpdENvZGUgPSBTaW5nbGVUaHJlYWRDbGllbnQoYXJncyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRpZmZ0ID0gTWF0aC5yb3VuZCggMTAwMCAqIChUaW1lci5zdGFtcCgpIC0gZGlmZnQpKSAvIDEwMDA7CisgICAgICAgICAgICB0cmFjZSgndG90YWwgdGVzdCB0aW1lOiAkZGlmZnQgc2Vjb25kcycpOworICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogVEV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgdHJhY2UoJ1RFeGNlcHRpb246ICRlJyk7CisgICAgICAgICAgICBleGl0Q29kZSA9IDB4RkY7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKGUgOiBEeW5hbWljKQorICAgICAgICB7CisgICAgICAgICAgICB0cmFjZSgnRXhjZXB0aW9uOiAkZScpOworICAgICAgICAgICAgZXhpdENvZGUgPSAweEZGOworICAgICAgICB9CisKKyAgICAgICAgI2lmIHN5cworICAgICAgICBTeXMuZXhpdCggZXhpdENvZGUpOworICAgICAgICAjZW5kCisgICAgfQorCisKKyAgICBwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIFNpbmdsZVRocmVhZENsaWVudChhcmdzIDogQXJndW1lbnRzKSA6ICBJbnQKKyAgICB7CisgICAgICAgIHZhciByc2x0ID0gbmV3IFRlc3RSZXN1bHRzKHRydWUpOworICAgICAgICBSdW5DbGllbnQoYXJncyxyc2x0KTsKKyAgICAgICAgcnNsdC5QcmludFN1bW1hcnkoKTsKKyAgICAgICAgcmV0dXJuIHJzbHQuQ2FsY3VsYXRlRXhpdENvZGUoKTsKKyAgICB9CisKKworICAgICNpZiBjcHAKKyAgICBwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIE11bHRpVGhyZWFkQ2xpZW50KGFyZ3MgOiBBcmd1bWVudHMpIDogIEludAorICAgIHsKKyAgICAgICAgdmFyIHRocmVhZHMgPSBuZXcgTGlzdDxUaHJlYWQ+KCk7CisgICAgICAgIGZvciggdGVzdCBpbiAwIC4uLiBhcmdzLm51bVRocmVhZHMpIHsKKyAgICAgICAgICAgIHRocmVhZHMuYWRkKCBTdGFydFRocmVhZCggYXJncykpOworICAgICAgICB9CisgICAgICAgIHZhciBleGl0Q29kZSA6IEludCA9IDA7CisgICAgICAgIGZvciggdGhyZWFkIGluIHRocmVhZHMpIHsKKyAgICAgICAgICAgIGV4aXRDb2RlIHw9IFRocmVhZC5yZWFkTWVzc2FnZSh0cnVlKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZXhpdENvZGU7CisgICAgfQorICAgICNlbmQKKworICAgICNpZiBjcHAKKyAgICBwcml2YXRlIHN0YXRpYyBmdW5jdGlvbiBTdGFydFRocmVhZChhcmdzIDogQXJndW1lbnRzKSA6IFRocmVhZCB7CisgICAgICAgIHZhciB0aHJlYWQgPSBUaHJlYWQuY3JlYXRlKAorICAgICAgICAgICAgZnVuY3Rpb24oKSA6IFZvaWQgeworICAgICAgICAgICAgICAgIHZhciByc2x0ID0gbmV3IFRlc3RSZXN1bHRzKGZhbHNlKTsKKyAgICAgICAgICAgICAgICB2YXIgbWFpbiA6IFRocmVhZCA9IFRocmVhZC5yZWFkTWVzc2FnZSh0cnVlKTsKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIFJ1bkNsaWVudChhcmdzLHJzbHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoZSA6IFRFeGNlcHRpb24pCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByc2x0LkV4cGVjdCggZmFsc2UsICckZScpOworICAgICAgICAgICAgICAgICAgICB0cmFjZSgnJGUnKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKGUgOiBEeW5hbWljKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcnNsdC5FeHBlY3QoIGZhbHNlLCAnJGUnKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhY2UoJyRlJyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1haW4uc2VuZE1lc3NhZ2UoIHJzbHQuQ2FsY3VsYXRlRXhpdENvZGUoKSk7CisgICAgICAgICAgICB9KTsKKworICAgICAgICB0aHJlYWQuc2VuZE1lc3NhZ2UoVGhyZWFkLmN1cnJlbnQoKSk7CisgICAgICAgIHJldHVybiB0aHJlYWQ7CisgICAgfQorICAgICNlbmQKKworCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBSdW5DbGllbnQoYXJncyA6IEFyZ3VtZW50cywgcnNsdCA6IFRlc3RSZXN1bHRzKQorICAgIHsKKyAgICAgICAgdmFyIHRyYW5zcG9ydCA6IFRUcmFuc3BvcnQgPSBudWxsOworICAgICAgICBzd2l0Y2ggKGFyZ3MudHJhbnNwb3J0KQorICAgICAgICB7CisgICAgICAgICAgICBjYXNlIHNvY2tldDoKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnQgPSBuZXcgVFNvY2tldChhcmdzLmhvc3QsIGFyZ3MucG9ydCk7CisgICAgICAgICAgICBjYXNlIGh0dHA6CisgICAgICAgICAgICAgICAgdmFyIHVyaSA9ICdodHRwOi8vJHthcmdzLmhvc3R9OiR7YXJncy5wb3J0fSc7CisgICAgICAgICAgICAgICAgdHJhY2UoJy0gaHR0cCBjbGllbnQgOiAke3VyaX0nKTsKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnQgPSBuZXcgVEh0dHBDbGllbnQodXJpKTsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgIlVuaGFuZGxlZCB0cmFuc3BvcnQiOworICAgICAgICB9CisKKyAgICAgICAgLy8gb3B0aW9uYWw6IGxheWVyZWQgdHJhbnNwb3J0CisgICAgICAgIGlmICggYXJncy5mcmFtZWQpIHsKKyAgICAgICAgICAgIHRyYWNlKCItIGZyYW1lZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgIHRyYW5zcG9ydCA9IG5ldyBURnJhbWVkVHJhbnNwb3J0KHRyYW5zcG9ydCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCBhcmdzLmJ1ZmZlcmVkKSB7CisgICAgICAgICAgICB0cmFjZSgiLSBidWZmZXJlZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgIHRyYW5zcG9ydCA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnQodHJhbnNwb3J0KTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIHByb3RvY29sCisgICAgICAgIHZhciBwcm90b2NvbCA6IFRQcm90b2NvbCA9IG51bGw7CisgICAgICAgIHN3aXRjaCggYXJncy5wcm90b2NvbCkKKyAgICAgICAgeworICAgICAgICBjYXNlIGJpbmFyeToKKyAgICAgICAgICAgIHRyYWNlKCItIGJpbmFyeSBwcm90b2NvbCIpOworICAgICAgICAgICAgcHJvdG9jb2wgPSBuZXcgVEJpbmFyeVByb3RvY29sKHRyYW5zcG9ydCk7CisgICAgICAgIGNhc2UganNvbjoKKyAgICAgICAgICAgIHRyYWNlKCItIGpzb24gcHJvdG9jb2wiKTsKKyAgICAgICAgICAgIHByb3RvY29sID0gbmV3IFRKU09OUHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgY2FzZSBjb21wYWN0OgorICAgICAgICAgICAgdHJhY2UoIi0gY29tcGFjdCBwcm90b2NvbCIpOworICAgICAgICAgICAgcHJvdG9jb2wgPSBuZXcgVENvbXBhY3RQcm90b2NvbCh0cmFuc3BvcnQpOworICAgICAgICB9CisKKyAgICAgICAgLy8gc29tZSBxdWljayBhbmQgYmFzaWMgdW5pdCB0ZXN0cworICAgICAgICBIYXhlQmFzaWNzVGVzdCggYXJncywgcnNsdCk7CisgICAgICAgIE1vZHVsZVVuaXRUZXN0cyggYXJncywgcnNsdCk7CisKKyAgICAgICAgLy8gbm93IHJ1biB0aGUg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0LmdldCggSW50NjQubWFrZSgwLDApKSwgIkludDY0TWFwPEludDMyPiBUZXN0ICMyOCIpOworCisgICAgICAgIG1hcDMyLnNldCggNDIsIDEpOworICAgICAgICBtYXA2NC5zZXQoIEludDY0Lm1ha2UoMCw0MiksIDEpOworICAgICAgICBtYXAzMi5zZXQoIC01MTcsIC0yKTsKKyAgICAgICAgbWFwNjQuc2V0KCBJbnQ2NC5uZWcoSW50NjQubWFrZSgwLDUxNykpLCAtMik7CisgICAgICAgIG1hcDMyLnNldCggMCwgMyk7CisgICAgICAgIG1hcDY0LnNldCggSW50NjQubWFrZSgwLDApLCAzKTsKKworICAgICAgICB2YXIgYzMyID0gMDsKKyAgICAgICAgdmFyIGtzdW0zMiA9IDA7CisgICAgICAgIGZvciAoa2V5IGluIG1hcDMyLmtleXMoKSkgeworICAgICAgICAgICAgKytjMzI7CisgICAgICAgICAgICBrc3VtMzIgKz0ga2V5OworICAgICAgICB9CisgICAgICAgIHZhciBjNjQgPSAwOworICAgICAgICB2YXIga3N1bTY0ID0gSW50NjQubWFrZSgwLDApOworICAgICAgICBmb3IgKGtleSBpbiBtYXA2NC5rZXlzKCkpIHsKKyAgICAgICAgICAgICsrYzY0OworICAgICAgICAgICAga3N1bTY0ID0gSW50NjQuYWRkKCBrc3VtNjQsIGtleSk7CisgICAgICAgIH0KKyAgICAgICAgcnNsdC5FeHBlY3QoIGMzMiA9PSBjNjQsICJJbnQ2NE1hcDxJbnQzMj4gVGVzdCAjMzAiKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoICcka3N1bTY0JyA9PSAnJGtzdW0zMicsICcka3N1bTY0ID09ICRrc3VtMzIgICBUZXN0ICMzMScpOworCisgICAgICAgIC8vY29tcGFyZSB3aXRob3V0IHNwYWNlcyBiZWNhdXNlIGRpZmZlciBpbiBwaHAgYW5kIGNwcAorICAgICAgICB2YXIgczMyID0gbWFwMzIudG9TdHJpbmcoKS5yZXBsYWNlKCcgJywgJycpOworICAgICAgICB2YXIgczY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SwgJ0JpdENvbnZlcnRlci5Vbml0VGVzdDogJGUgIFRlc3QgIzEwMCcpOworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFppZ1phZy5Vbml0VGVzdCgpOworICAgICAgICAgICAgcnNsdC5FeHBlY3QoIHRydWUsICdaaWdaYWcuVW5pdFRlc3QgIFRlc3QgIzEwMScpOworICAgICAgICB9CisgICAgICAgIGNhdGNoKCBlIDogRHluYW1pYykgeworICAgICAgICAgICAgcnNsdC5FeHBlY3QoIGZhbHNlLCAnWmlnWmFnLlVuaXRUZXN0OiAkZSAgVGVzdCAjMTAxJyk7CisgICAgICAgIH0KKworICAgICAgICAjZW5kCisgICAgfQorCisKKyAgICBwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIEJ5dGVzVG9IZXgoZGF0YSA6IEJ5dGVzKSA6IFN0cmluZyB7CisgICAgICAgIHZhciBoZXggPSAiIjsKKyAgICAgICAgZm9yICggaSBpbiAwIC4uLiBkYXRhLmxlbmd0aCkgeworICAgICAgICAgICAgaGV4ICs9IFN0cmluZ1Rvb2xzLmhleCggZGF0YS5nZXQoaSksIDIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBoZXg7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBmdW5jdGlvbiBQcmVwYXJlVGVzdERhdGEocmFuZG9tRGlzdCA6IEJvb2wpIDogQnl0ZXMgICAgeworICAgICAgICB2YXIgcmV0dmFsID0gQnl0ZXMuYWxsb2MoMHgxMDApOworICAgICAgICB2YXIgaW5pdExlbiA6IEludCA9IChyZXR2YWwubGVuZ3RoID4gMHgxMDAgPyAweDEwMCA6IHJldHZhbC5sZW5ndGgpOworCisgICAgICAgIC8vIGxpbmVhciBkaXN0cmlidXRpb24sIHVubGVzcyByYW5kb20gaXMgcmVxdWVzdGVkCisgICAgICAgIGlmICghcmFuZG9tRGlzdCkgeworICAgICAgICAgICAgZm9yIChpIGluIDAgLi4uIGluaXRMZW4pIHsKKyAgICAgICAgICAgICAgICByZXR2YWwuc2V0KGksIGkgJSAweDEwMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gcmV0dmFsOworICAgICAgICB9CisKKyAgICAgICAgLy8gcmFuZG9tIGRpc3RyaWJ1dGlvbgorICAgICAgICBmb3IgKGkgaW4gMCAuLi4gaW5pdExlbikgeworICAgICAgICAgICAgcmV0dmFsLnNldChpLCAwKTsKKyAgICAgICAgfQorICAgICAgICBmb3IgKGkgaW4gMSAuLi4gaW5pdExlbikgeworICAgICAgICAgICAgd2hpbGUoIHRydWUpIHsKKyAgICAgICAgICAgICAgICB2YXIgbmV4dFBvcyA9IFN0ZC5yYW5kb20oaW5pdExlbik7CisgICAgICAgICAgICAgICAgaWYgKHJldHZhbC5nZXQobmV4dFBvcykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICByZXR2YWwuc2V0KCBuZXh0UG9zLCBpICUgMHgxMDApOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJldHZhbDsKKyAgICB9CisKKworICAgIHB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gQ2xpZW50VGVzdCggdHJhbnNwb3J0IDogVFRyYW5zcG9ydCwgcHJvdG9jb2wgOiBUUHJvdG9jb2wsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzIDogQXJndW1lbnRzLCByc2x0IDogVGVzdFJlc3VsdHMpIDogVm9pZAorICAgIHsKKyAgICAgICAgdmFyIGNsaWVudCA9IG5ldyBUaHJpZnRUZXN0SW1wbChwcm90b2NvbCxwcm90b2NvbCk7CisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoIXRyYW5zcG9ydC5pc09wZW4oKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnQub3BlbigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogVEV4Y2VwdGlvbikKKyAgICAgICAgeworICAgICAgICAgICAgcnNsdC5FeHBlY3QoIGZhbHNlLCAndW5hYmxlIHRvIG9wZW4gdHJhbnNwb3J0OiAkZScpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogRHluYW1pYykKKyAgICAgICAgeworICAgICAgICAgICAgcnNsdC5FeHBlY3QoIGZhbHNlLCAndW5hYmxlIHRvIG9wZW4gdHJhbnNwb3J0OiAkZScpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgdmFyIHN0YXJ0ID0gRGF0ZS5ub3coKTsKKworICAgICAgICByc2x0LlN0YXJ0VGVzdEdyb3VwKCBUZXN0UmVzdWx0cy5FWElUQ09ERV9GQUlMQklUX0VYQ0VQVElPTlMpOworCisgICAgICAgIC8vIGlmIGFyZyA9PSAiWGNlcHRpb24iIHRocm93IFhjZXB0aW9uIHdpdGggZXJyb3JDb2RlID0gMTAwMSBhbmQgbWVzc2FnZSA9IGFyZworICAgICAgICB0cmFjZSgndGVzdEV4Y2VwdGlvbigiWGNlcHRpb24iKScpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oIlhjZXB0aW9uIik7CisgICAgICAgICAgICByc2x0LkV4cGVjdCggZmFsc2UsICd0ZXN0RXhjZXB0aW9uKCJYY2VwdGlvbiIpIHNob3VsZCB0aHJvdycpOworICAgICAgICB9CisgICAgICAgIGNhdGNoIChlIDogWGNlcHRpb24pCisgICAgICAgIHsKKyAgICAgICAgICAgIHJzbHQuRXhwZWN0KCBlLm1lc3NhZ2UgPT0gIlhjZXB0aW9uIiwgJ3Rlc3RFeGNlcHRpb24oIlhjZXB0aW9uIikgIC0gIGUubWVzc2FnZSA9PSAiWGNlcHRpb24iJyk7CisgICAgICAgICAgICByc2x0LkV4cGVjdCggZS5lcnJvckN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lJyk7CisgICAgICAgIH0KKworICAgICAgICAvLyByZW9wZW4gdGhlIHRyYW5zcG9ydCwganVzdCBpbiBjYXNlIHRoZSBzZXJ2ZXIgY2xvc2VkIGhpcyBlbmQKKyAgICAgICAgaWYgKHRyYW5zcG9ydC5pc09wZW4oKSkKKyAgICAgICAgICAgIHRyYW5zcG9ydC5jbG9zZSgpOworICAgICAgICB0cmFuc3BvcnQub3BlbigpOworCisgICAgICAgIC8vIGVsc2UgZG8gbm90IHRocm93IGFueXRoaW5nCisgICAgICAgIHRyYWNlKCd0ZXN0RXhjZXB0aW9uKCJibGEiKScpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgY2xpZW50LnRlc3RFeGNlcHRpb24oImJsYSIpOworICAgICAgICAgICAgcnNsdC5FeHBlY3QoIHRydWUsICd0ZXN0RXhjZXB0aW9uKCJibGEiKSBzaG91bGQgbm90IHRocm93Jyk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKGUgOiBURXhjZXB0aW9uKQorICAgICAgICB7CisgICAgICAgICAgICByc2x0LkV4cGVjdCggZmFsc2UsICd0ZXN0RXhjZXB0aW9uKCJibGEiKSAgLSAgJHtlfSA6ICR7ZS5lcnJvck1zZ30nKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoZSA6IER5bmFtaWMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJzbHQuRXhwZWN0KCBmYWxzZSwgJ3Rlc3RFeGNlcHRpb24oImJsYSIpICAtICAkZScpOworICAgICAgICB9CisKKyAgICAgICAgcnNsdC5TdGFydFRlc3RHcm91cCggVGVzdFJlc3VsdHMuRVhJVENPREVfRkFJTEJJVF9CQVNFVFlQRVMpOworCisgICAgICAgIHRyYWNlKCd0ZXN0Vm9pZCgpJyk7CisgICAgICAgIGNsaWVudC50ZXN0Vm9pZCgpOworICAgICAgICB0cmFjZSgnID0gdm9pZCcpOworICAgICAgICByc2x0LkV4cGVjdCh0cnVlLCJ0ZXN0Vm9pZCgpIik7ICAvLyBidW1wIGNvdW50ZXIKKworICAgICAgICB0cmFjZSgndGVzdEJvb2woJHt0cnVlfSknKTsKKyAgICAgICAgdmFyIGIgPSBjbGllbnQudGVzdEJvb2wodHJ1ZSk7CisgICAgICAgIHRyYWNlKCcgPSAkYicpOworICAgICAgICByc2x0LkV4cGVjdChiLCAnJGIgPT0gIiR7dHJ1ZX0iJyk7CisgICAgICAgIHRyYWNlKCd0ZXN0Qm9vbCgke2ZhbHNlfSknKTsKKyAgICAgICAgYiA9IGNsaWVudC50ZXN0Qm9vbChmYWxzZSk7CisgICAgICAgIHRyYWNlKCcgPSAkYicpOworICAgICAgICByc2x0LkV4cGVjdCggISBiLCAnJGIgPT0gIiR7ZmFsc2V9IicpOworCisgICAgICAgIHRyYWNlKCd0ZXN0U3RyaW5nKCJUZXN0IiknKTsKKyAgICAgICAgdmFyIHMgPSBjbGllbnQudGVzdFN0cmluZygiVGVzdCIpOworICAgICAgICB0cmFjZSgnID0gIiRzIicpOworICAgICAgICByc2x0LkV4cGVjdChzID09ICJUZXN0IiwgJyRzID09ICJUZXN0IicpOworCisgICAgICAgIHRyYWNlKCd0ZXN0Qnl0ZSgxKScpOworICAgICAgICB2YXIgaTggPSBjbGllbnQudGVzdEJ5dGUoMSk7CisgICAgICAgIHRyYWNlKCcgPSAkaTgnKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoaTggPT0gMSwgJyRpOCA9PSAxJyk7CisKKyAgICAgICAgdHJhY2UoJ3Rlc3RJMzIoLTEpJyk7CisgICAgICAgIHZhciBpMzIgPSBjbGllbnQudGVzdEkzMigtMSk7CisgICAgICAgIHRyYWNlKCcgPSAkaTMyJyk7CisgICAgICAgIHJzbHQuRXhwZWN0KGkzMiA9PSAtMSwgJyRpMzIgPT0gLTEnKTsKKworICAgICAgICB0cmFjZSgndGVzdEk2NCgtMzQzNTk3MzgzNjgpJyk7CisgICAgICAgIHZhciBpNjQgPSBjbGllbnQudGVzdEk2NCggSW50NjQubWFrZSggMHhGRkZGRkZGOCwgMHgwMDAwMDAwMCkpOyAvLyAtMzQzNTk3MzgzNjgKKyAgICAgICAgdHJhY2UoJyA9ICRpNjQnKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoIEludDY0LmNvbXBhcmUoIGk2NCwgSW50NjQubWFrZSggMHhGRkZGRkZGOCwgMHgwMDAwMDAwMCkpID09IDAsCisgICAgICAgICAgICAgICAgICAgICBJbnQ2NC50b1N0cihpNjQpICsiID09ICIrSW50NjQudG9TdHIoSW50NjQubWFrZSggMHhGRkZGRkZGOCwgMHgwMDAwMDAwMCkpKTsKKworICAgICAgICAvLyBlZGdlIGNhc2U6IHRoZSBsYXJnZXN0IG5lZ2F0aXZlIEludDY0IGhhcyBubyBwb3NpdGl2ZSBJbnQ2NCBlcXVpdmFsZW50CisgICAgICAgIHRyYWNlKCd0ZXN0STY0KC05MjIzMzcyMDM2ODU0Nzc1ODA4KScpOworICAgICAgICBpNjQgPSBjbGllbnQudGVzdEk2NCggSW50NjQubWFrZSggMHg4MDAwMDAwMCwgMHgwMDAwMDAwMCkpOyAvLyAtOTIyMzM3MjAzNjg1NDc3NTgwOAorICAgICAgICB0cmFjZSgnID0gJGk2NCcpOworICAgICAgICByc2x0LkV4cGVjdCggSW50NjQuY29tcGFyZSggaTY0LCBJbnQ2NC5tYWtlKCAweDgwMDAwMDAwLCAweDAwMDAwMDAwKSkgPT0gMCwKKyAgICAgICAgICAgICAgICAgICAgIEludDY0LnRvU3RyKGk2NCkgKyIgPT0gIitJbnQ2NC50b1N0cihJbnQ2NC5tYWtlKCAweDgwMDAwMDAwLCAweDAwMDAwMDAwKSkpOworCisgICAgICAgIHRyYWNlKCd0ZXN0RG91YmxlKDUuMzI1MDk4MjM1KScpOworICAgICAgICB2YXIgZHViID0gY2xpZW50LnRlc3REb3VibGUoNS4zMjUwOTgyMzUpOworICAgICAgICB0cmFjZSgnID0gJGR1YicpOworICAgICAgICByc2x0LkV4cGVjdChkdWIgPT0gNS4zMjUwOTgyM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ydmVyCisgICAgICAgIH0KKworCisgICAgICAgIHJzbHQuU3RhcnRUZXN0R3JvdXAoIFRlc3RSZXN1bHRzLkVYSVRDT0RFX0ZBSUxCSVRfU1RSVUNUUyk7CisKKyAgICAgICAgdHJhY2UoJ3Rlc3RTdHJ1Y3QoeyJaZXJvIiwgMSwgLTMsIC01fSknKTsKKyAgICAgICAgdmFyIG8gPSBuZXcgWHRydWN0KCk7CisgICAgICAgIG8uc3RyaW5nX3RoaW5nID0gIlplcm8iOworICAgICAgICBvLmJ5dGVfdGhpbmcgPSAxOworICAgICAgICBvLmkzMl90aGluZyA9IC0zOworICAgICAgICBvLmk2NF90aGluZyA9IEludDY0Lm1ha2UoMCwtNSk7CisgICAgICAgIHZhciBpID0gY2xpZW50LnRlc3RTdHJ1Y3Qobyk7CisgICAgICAgIHRyYWNlKCcgPSB7IicgKyBpLnN0cmluZ190aGluZyArICciLCAnICsgaS5ieXRlX3RoaW5nICsnLCAnCisgICAgICAgICAgICAgICAgICAgICAgKyBpLmkzMl90aGluZyArJywgJysgSW50NjQudG9TdHIoaS5pNjRfdGhpbmcpICsgJ30nKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoIGkuc3RyaW5nX3RoaW5nID09IG8uc3RyaW5nX3RoaW5nLCAiaS5zdHJpbmdfdGhpbmcgPT0gby5zdHJpbmdfdGhpbmciKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoIGkuYnl0ZV90aGluZyA9PSBvLmJ5dGVfdGhpbmcsICJpLmJ5dGVfdGhpbmcgPT0gby5ieXRlX3RoaW5nIik7CisgICAgICAgIHJzbHQuRXhwZWN0KCBpLmkzMl90aGluZyA9PSBvLmkzMl90aGluZywgImkuaTY0X3RoaW5nID09IG8uaTY0X3RoaW5nIik7CisgICAgICAgIHJzbHQuRXhwZWN0KCBpLmkzMl90aGluZyA9PSBvLmkzMl90aGluZywgImkuaTY0X3RoaW5nID09IG8uaTY0X3RoaW5nIik7CisKKyAgICAgICAgdHJhY2UoJ3Rlc3ROZXN0KHsxLCB7XCJaZXJvXCIsIDEsIC0zLCAtNX0sIDV9KScpOworICAgICAgICB2YXIgbzIgPSBuZXcgWHRydWN0MigpOworICAgICAgICBvMi5ieXRlX3RoaW5nID0gMTsKKyAgICAgICAgbzIuc3RydWN0X3RoaW5nID0gbzsKKyAgICAgICAgbzIuaTMyX3RoaW5nID0gNTsKKyAgICAgICAgdmFyIGkyID0gY2xpZW50LnRlc3ROZXN0KG8yKTsKKyAgICAgICAgaSA9IGkyLnN0cnVjdF90aGluZzsKKyAgICAgICAgdHJhY2UoIiA9IHsiICsgaTIuYnl0ZV90aGluZyArICIsIHtcIiIgKyBpLnN0cmluZ190aGluZyArICJcIiwgIgorICAgICAgICAgICAgICArIGkuYnl0ZV90aGluZyArICIsICIgKyBpLmkzMl90aGluZyArICIsICIgKyBJbnQ2NC50b1N0cihpLmk2NF90aGluZykgKyAifSwgIgorICAgICAgICAgICAgICArIGkyLmkzMl90aGluZyArICJ9Iik7CisgICAgICAgIHJzbHQuRXhwZWN0KCBpMi5ieXRlX3RoaW5nID09IG8yLmJ5dGVfdGhpbmcsICJpMi5ieXRlX3RoaW5nID09IG8yLmJ5dGVfdGhpbmciKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoIGkyLmkzMl90aGluZyA9PSBvMi5pMzJfdGhpbmcsICJpMi5pMzJfdGhpbmcgPT0gbzIuaTMyX3RoaW5nIik7CisgICAgICAgIHJzbHQuRXhwZWN0KCBpLnN0cmluZ190aGluZyA9PSBvLnN0cmluZ190aGluZywgImkuc3RyaW5nX3RoaW5nID09IG8uc3RyaW5nX3RoaW5nIik7CisgICAgICAgIHJzbHQuRXhwZWN0KCBpLmJ5dGVfdGhpbmcgPT0gby5ieXRlX3RoaW5nLCAiaS5ieXRlX3RoaW5nID09IG8uYnl0ZV90aGluZyIpOworICAgICAgICByc2x0LkV4cGVjdCggaS5pMzJfdGhpbmcgPT0gby5pMzJfdGhpbmcsICJpLmkzMl90aGluZyA9PSBvLmkzMl90aGluZyIpOworICAgICAgICByc2x0LkV4cGVjdCggSW50NjQuY29tcGFyZSggaS5pNjRfdGhpbmcsIG8uaTY0X3RoaW5nKSA9PSAwLCAiaS5pNjRfdGhpbmcgPT0gby5pNjRfdGhpbmciKTsKKworCisgICAgICAgIHJzbHQuU3RhcnRUZXN0R3JvdXAoIFRlc3RSZXN1bHRzLkVYSVRDT0RFX0ZBSUxCSVRfQ09OVEFJTkVSUyk7CisKKyAgICAgICAgdmFyIG1hcG91dCA9IG5ldyBJbnRNYXA8IGhheGUuSW50MzI+KCk7CisgICAgICAgIGZvciAoIGogaW4gMCAuLi4gNSkKKyAgICAgICAgeworICAgICAgICAgICAgbWFwb3V0LnNldChqLCBqIC0gMTApOworICAgICAgICB9CisgICAgICAgIHRyYWNlKCJ0ZXN0TWFwKHsiKTsKKyAgICAgICAgdmFyIGZpcnN0IDogQm9vbCA9IHRydWU7CisgICAgICAgIGZvcigga2V5IGluIG1hcG91dC5rZXlzKCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYWNlKCIsICIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJhY2Uoa2V5ICsgIiA9PiAiICsgbWFwb3V0LmdldChrZXkpKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSkiKTsKKworICAgICAgICB2YXIgbWFwaW4gPSBjbGllbnQudGVzdE1hcChtYXBvdXQpOworCisgICAgICAgIHRyYWNlKCIgPSB7Iik7CisgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgZm9yKCBrZXkgaW4gbWFwaW4ua2V5cygpKQorICAgICAgICB7CisgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgiLCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRyYWNlKGtleSArICIgPT4gIiArIG1hcGluLmdldChrZXkpKTsKKyAgICAgICAgICAgIHJzbHQuRXhwZWN0KCBtYXBpbi5nZXQoa2V5KSA9PSBtYXBvdXQuZ2V0KGtleSksICcgbWFwaW4uZ2V0KCRrZXkpID09IG1hcG91dC5nZXQoJGtleSknKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSIpOworICAgICAgICBmb3IoIGtleSBpbiBtYXBvdXQua2V5cygpKQorICAgICAgICB7CisgICAgICAgICAgICByc2x0LkV4cGVjdChtYXBpbi5leGlzdHMoa2V5KSwgJ21hcGluLmV4aXN0cygka2V5KScpOworICAgICAgICB9CisKKyAgICAgICAgdmFyIGxpc3RvdXQgPSBuZXcgTGlzdDxJbnQ+KCk7CisgICAgICAgIGZvciAoaiBpbiAtMiAuLi4gMykKKyAgICAgICAgeworICAgICAgICAgICAgbGlzdG91dC5hZGQoaik7CisgICAgICAgIH0KKyAgICAgICAgdHJhY2UoInRlc3RMaXN0KHsiKTsKKyAgICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgICBmb3IoIGogaW4gbGlzdG91dCkKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhY2UoIiwgIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cmFjZShqKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSkiKTsKKworICAgICAgICB2YXIgbGlzdGluID0gY2xpZW50LnRlc3RMaXN0KGxpc3RvdXQpOworCisgICAgICAgIHRyYWNlKCIgPSB7Iik7CisgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgZm9yKCBqIGluIGxpc3RpbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhY2UoIiwgIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cmFjZShqKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSIpOworCisgICAgICAgIHJzbHQuRXhwZWN0KGxpc3Rpbi5sZW5ndGggPT0gbGlzdG91dC5sZW5ndGgsICJsaXN0aW4ubGVuZ3RoID09IGxpc3RvdXQubGVuZ3RoIik7CisgICAgICAgIHZhciBsaXRlcm91dCA9IGxpc3RvdXQuaXRlcmF0b3IoKTsKKyAgICAgICAgdmFyIGxpdGVyaW4gPSBsaXN0aW4uaXRlcmF0b3IoKTsKKyAgICAgICAgd2hpbGUoIGxpdGVyaW4uaGFzTmV4dCgpKSB7CisgICAgICAgICAgICByc2x0LkV4cGVjdChsaXRlcmluLm5leHQoKSA9PSBsaXRlcm91dC5uZXh0KCksICJsaXRlcmluW2ldID09IGxpdGVyb3V0W2ldIik7CisgICAgICAgIH0KKworICAgICAgICAvL3NldAorICAgICAgICB2YXIgc2V0b3V0ID0gbmV3IEludFNldCgpOworICAgICAgICBmb3IgKGogaW4gLTIgLi4uIDMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHNldG91dC5hZGQoaik7CisgICAgICAgIH0KKyAgICAgICAgdHJhY2UoInRlc3RTZXQoeyIpOworICAgICAgICBmaXJzdCA9IHRydWU7CisgICAgICAgIGZvciggaiBpbiBzZXRvdXQpCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYWNlKCIsICIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJhY2Uoaik7CisgICAgICAgIH0KKyAgICAgICAgdHJhY2UoIn0pIik7CisKKyAgICAgICAgdmFyIHNldGluID0gY2xpZW50LnRlc3RTZXQoc2V0b3V0KTsKKworICAgICAgICB0cmFjZSgiID0geyIpOworICAgICAgICBmaXJzdCA9IHRydWU7CisgICAgICAgIGZvciggaiBpbiBzZXRpbikKKyAgICAgICAgeworICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdHJhY2UoIiwgIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cmFjZShqKTsKKyAgICAgICAgICAgIHJzbHQuRXhwZWN0KHNldG91dC5jb250YWlucyhqKSwgJ3NldG91dC5jb250YWlucygkaiknKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSIpOworICAgICAgICByc2x0LkV4cGVjdChzZXRpbi5zaXplID09IHNldG91dC5zaXplLCAic2V0aW4ubGVuZ3RoID09IHNldG91dC5sZW5ndGgiKTsKKworCisgICAgICAgIHJzbHQuU3RhcnRUZXN0R3JvdXAoIFRlc3RSZXN1bHRzLkVYSVRDT0RFX0ZBSUxCSVRfQkFTRVRZUEVTKTsKKworICAgICAgICB0cmFjZSgidGVzdEVudW0oT05FKSIpOworICAgICAgICB2YXIgcmV0ID0gY2xpZW50LnRlc3RFbnVtKE51bWJlcnouT05FKTsKKyAgICAgICAgdHJhY2UoIiA9ICIgKyByZXQpOworICAgICAgICByc2x0LkV4cGVjdChyZXQgPT0gTnVtYmVyei5PTkUsICckcmV0ID09IE51bWJlcnouT05FJyk7CisKKyAgICAgICAgdHJhY2UoInRlc3RFbnVtKFRXTykiKTsKKyAgICAgICAgcmV0ID0gY2xpZW50LnRlc3RFbnVtKE51bWJlcnouVFdPKTsKKyAgICAgICAgdHJhY2UoIiA9ICIgKyByZXQpOworICAgICAgICByc2x0LkV4cGVjdChyZXQgPT0gTnVtYmVyei5UV08sICckcmV0ID09IE51bWJlcnouVFdPJyk7CisKKyAgICAgICAgdHJhY2UoInRlc3RFbnVtKFRIUkVFKSIpOworICAgICAgICByZXQgPSBjbGllbnQudGVzdEVudW0oTnVtYmVyei5USFJFRSk7CisgICAgICAgIHRyYWNlKCIgPSAiICsgcmV0KTsKKyAgICAgICAgcnNsdC5FeHBlY3QocmV0ID09IE51bWJlcnouVEhSRUUsICckcmV0ID09IE51bWJlcnouVEhSRUUnKTsKKworICAgICAgICB0cmFjZSgidGVzdEVudW0oRklWRSkiKTsKKyAgICAgICAgcmV0ID0gY2xpZW50LnRlc3RFbnVtKE51bWJlcnouRklWRSk7CisgICAgICAgIHRyYWNlKCIgPSAiICsgcmV0KTsKKyAgICAgICAgcnNsdC5FeHBlY3QocmV0ID09IE51bWJlcnouRklWRSwgJyRyZXQgPT0gTnVtYmVyei5GSVZFJyk7CisKKyAgICAgICAgdHJhY2UoInRlc3RFbnVtKEVJR0hUKSIpOworICAgICAgICByZXQgPSBjbGllbnQudGVzdEVudW0oTnVtYmVyei5FSUdIVCk7CisgICAgICAgIHRyYWNlKCIgPSAiICsgcmV0KTsKKyAgICAgICAgcnNsdC5FeHBlY3QocmV0ID09IE51bWJlcnouRUlHSFQsICckcmV0ID09IE51bWJlcnouRUlHSFQnKTsKKworICAgICAgICB0cmFjZSgidGVzdFR5cGVkZWYoMzA5ODU4MjM1MDgyNTIzKSIpOworICAgICAgICB2YXIgdWlkID0gY2xpZW50LnRlc3RUeXBlZGVmKCBJbnQ2NC5tYWtlKCAweDExOUQwLCAweDdFMDg2NzFCKSk7ICAvLyAzMDk4NTgyMzUwODI1MjMKKyAgICAgICAgdHJhY2UoIiA9ICIgKyB1aWQpOworICAgICAgICByc2x0LkV4cGVjdCggSW50NjQuY29tcGFyZSggdWlkLCBJbnQ2NC5tYWtlKCAweDExOUQwLCAweDdFMDg2NzFCKSkgPT0gMCwKKyAgICAgICAgICAgICAgICAgICAgIEludDY0LnRvU3RyKHVpZCkrIiA9PSAiK0ludDY0LnRvU3RyKEludDY0Lm1ha2UoIDB4MTE5RDAsIDB4N0UwODY3MUIpKSk7CisKKworICAgICAgICByc2x0LlN0YXJ0VGVzdEdyb3VwKCBUZXN0UmVzdWx0cy5FWElUQ09ERV9GQUlMQklUX0NPTlRBSU5FUlMpOworCisgICAgICAgIHRyYWNlKCJ0ZXN0TWFwTWFwKDEpIik7CisgICAgICAgIHZhciBtbSA9IGNsaWVudC50ZXN0TWFwTWFwKDEpOworICAgICAgICB0cmFjZSgiID0geyIpOworICAgICAgICBmb3IoIGtleSBpbiBtbS5rZXlzKCkpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKGtleSArICIgPT4geyIpOworICAgICAgICAgICAgdmFyIG0yID0gbW0uZ2V0KGtleSk7CisgICAgICAgICAgICBmb3IoIGsyIGluIG0yLmtleXMoKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB0cmFjZShrMiArICIgPT4gIiArIG0yLmdldChrMikgKyAiLCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRyYWNlKCJ9LCAiKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgifSIpOworCisgICAgICAgIHZhciBwb3MgPSBtbS5nZXQoNCk7CisgICAgICAgIHZhciBuZWcgPSBtbS5nZXQoLTQpOworICAgICAgICByc2x0LkV4cGVjdCggKHBvcyAhPSBudWxsKSAmJiAobmVnICE9IG51bGwpLCAiKHBvcyAhPSBudWxsKSAmJiAobmVnICE9IG51bGwpIik7CisgICAgICAgIGZvciAoaSBpbiAxIC4uLiA1KSB7CisgICAgICAgICAgICByc2x0LkV4cGVjdCggcG9zLmdldChpKSA9PSBpLCAncG9zLmdldCgkaSkgPT0gJGknKTsKKyAgICAgICAgICAgIHJzbHQuRXhwZWN0KCBuZWcuZ2V0KC1pKSA9PSAtaSwgJ25lZy5nZXQoLSRpKSA9PSAtJGknKTsKKyAgICAgICAgfQorICAgICAgICByc2x0LkV4cGVjdCggISBwb3MuZXhpc3RzKDApLCAnIXBvcy5leGlzdHMoMCknKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoICEgbmVnLmV4aXN0cygtMCksICchbmVnLmV4aXN0cygtMCknKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoICEgcG9zLmV4aXN0cyg0MiksICchcG9zLmV4aXN0cyg0MiknKTsKKyAgICAgICAgcnNsdC5FeHBlY3QoICEgbmVnLmV4aXN0cygtNDIpLCAnIW5lZy5leGlzdHMoLTQyKScpOworCisKKyAgICAgICAgcnNsdC5TdGFydFRlc3RHcm91cCggVGVzdFJlc3VsdHMuRVhJVENPREVfRkFJTEJJVF9TVFJVQ1RTKTsKKworICAgICAgICB2YXIgaW5zYW5lID0gbmV3IEluc2FuaXR5KCk7CisgICAgICAgIGluc2FuZS51c2VyTWFwID0gbmV3IEludE1hcDwgSW50NjQ+KCk7CisgICAgICAgIGluc2FuZS51c2VyTWFwLnNldCggTnVtYmVyei5GSVZFLCBJbnQ2NC5tYWtlKDAsNTAwMCkpOworICAgICAgICB2YXIgdHJ1Y2sgPSBuZXcgWHRydWN0KCk7CisgICAgICAgIHRydWNrLnN0cmluZ190aGluZyA9ICJUcnVjayI7CisgICAgICAgIHRydWNrLmJ5dGVfdGhpbmcgPSA4OworICAgICAgICB0cnVjay5pMzJfdGhpbmcgPSA4OworICAgICAgICB0cnVjay5pNjRfdGhpbmcgPSBJbnQ2NC5tYWtlKDAsOCk7CisgICAgICAgIGluc2FuZS54dHJ1Y3RzID0gbmV3IExpc3Q8WHRydWN0PigpOworICAgICAgICBpbnNhbmUueHRydWN0cy5hZGQodHJ1Y2spOworICAgICAgICB0cmFjZSgidGVzdEluc2FuaXR5KCkiKTsKKyAgICAgICAgdmFyIHdob2EgPSBjbGllbnQudGVzdEluc2FuaXR5KGluc2FuZSk7CisgICAgICAgIHRyYWNlKCIgPSB7Iik7CisgICAgICAgIGZvcigga2V5IGluIHdob2Eua2V5cygpKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdmFsID0gd2hvYS5nZXQoa2V5KTsKKyAgICAgICAgICAgIHRyYWNlKGtleSArICIgPT4geyIpOworCisgICAgICAgICAgICBmb3IoIGsyIGluIHZhbC5rZXlzKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHYyID0gdmFsLmdldChrMik7CisKKyAgICAgICAgICAgICAgICB0cmFjZShrMiArICIgPT4geyIpOworICAgICAgICAgICAgICAgIHZhciB1c2VyTWFwID0gdjIudXNlck1hcDsKKworICAgICAgICAgICAgICAgIHRyYWNlKCJ7Iik7CisgICAgICAgICAgICAgICAgaWYgKHVzZXJNYXAgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZvciggazMgaW4gdXNlck1hcC5rZXlzKCkpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNlKGszICsgIiA9PiAiICsgdXNlck1hcC5nZXQoazMpICsgIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhY2UoIm51bGwiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdHJhY2UoIn0sICIpOworCisgICAgICAgICAgICAgICAgdmFyIHh0cnVjdHMgPSB2Mi54dHJ1Y3RzOworCisgICAgICAgICAgICAgICAgdHJhY2UoInsiKTsKKyAgICAgICAgICAgICAgICBpZiAoeHRydWN0cyAhPSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yKCB4IGluIHh0cnVjdHMpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNlKCJ7XCIiICsgeC5zdHJpbmdfdGhpbmcgKyAiXCIsICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgeC5ieXRlX3RoaW5nICsgIiwgIiArIHguaTMyX3RoaW5nICsgIiwgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB4LmkzMl90aGluZyArICJ9LCAiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0cmFjZSgibnVsbCIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cmFjZSgifSIpOworCisgICAgICAgICAgICAgICAgdHJhY2UoIn0sICIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJhY2UoIn0sICIpOworICAgICAgICB9CisgICAgICAgIHRyYWNlKCJ9Iik7CisKKworCQkvKioKKwkJKiBTbyB5b3UgdGhpbmsgeW91J3ZlIGdvdCB0aGlzIGFsbCB3b3JrZWQsIG91dCBlaD8KKwkJKgorCQkqIENyZWF0ZXMgYSB0aGUgcmV0dXJuZWQgbWFwIHdpdGggdGhlc2UgdmFsdWVzIGFuZCBwcmludHMgaXQgb3V0OgorCQkqICAgeyAxID0+IHsgMiA9PiBhcmd1bWVudCwKKwkJKiAgICAgICAgICAgIDMgPT4gYXJndW1lbnQsCisJCSogICAgICAgICAgfSwKKwkJKiAgICAgMiA9PiB7IDYgPT4gPGVtcHR5IEluc2FuaXR5IHN0cnVjdD4sIH0sCisJCSogICB9CisJCSogQHJldHVybiBtYXA8VXNlcklkLCBtYXA8TnVtYmVyeixJbnNhbml0eT4+IC0gYSBtYXAgd2l0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ICBuZXcgVFdyYXBwaW5nU2VydmVyVHJhbnNwb3J0KAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFRTdHJlYW1UcmFuc3BvcnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBURmlsZVN0cmVhbSgicGhwOi8vaW5wdXQiLCBSZWFkKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFRGaWxlU3RyZWFtKCJwaHA6Ly9vdXRwdXQiLCBBcHBlbmQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgICAgICAgICAgICAgICk7CisKKyAgICAgICAgICAgICAgICAjZW5kCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93ICJVbmhhbmRsZWQgdHJhbnNwb3J0IjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gb3B0aW9uYWw6IGxheWVyZWQgdHJhbnNwb3J0CisgICAgICAgICAgICB2YXIgdHJhbnNmYWN0b3J5IDogVFRyYW5zcG9ydEZhY3RvcnkgPSBudWxsOworICAgICAgICAgICAgaWYgKCBhcmdzLmZyYW1lZCkgeworICAgICAgICAgICAgICAgIHRyYWNlKCItIGZyYW1lZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgICB0cmFuc2ZhY3RvcnkgPSBuZXcgVEZyYW1lZFRyYW5zcG9ydEZhY3RvcnkoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICggYXJncy5idWZmZXJlZCkgeworICAgICAgICAgICAgICAgIHRyYWNlKCItIGJ1ZmZlcmVkIHRyYW5zcG9ydCIpOworICAgICAgICAgICAgICAgIHRyYW5zZmFjdG9yeSA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnRGYWN0b3J5KCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHByb3RvY29sCisgICAgICAgICAgICB2YXIgcHJvdGZhY3RvcnkgOiBUUHJvdG9jb2xGYWN0b3J5ID0gbnVsbDsKKyAgICAgICAgICAgIHN3aXRjaCggYXJncy5wcm90b2NvbCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgYmluYXJ5OgorICAgICAgICAgICAgICAgIHRyYWNlKCItIGJpbmFyeSBwcm90b2NvbCIpOworICAgICAgICAgICAgICAgIHByb3RmYWN0b3J5ID0gbmV3IFRCaW5hcnlQcm90b2NvbEZhY3RvcnkoKTsKKyAgICAgICAgICAgIGNhc2UganNvbjoKKyAgICAgICAgICAgICAgICB0cmFjZSgiLSBqc29uIHByb3RvY29sIik7CisgICAgICAgICAgICAgICAgcHJvdGZhY3RvcnkgPSBuZXcgVEpTT05Qcm90b2NvbEZhY3RvcnkoKTsKKyAgICAgICAgICAgIGNhc2UgY29tcGFjdDoKKyAgICAgICAgICAgICAgICB0cmFjZSgiLSBjb21wYWN0IHByb3RvY29sIik7CisgICAgICAgICAgICAgICAgcHJvdGZhY3RvcnkgPSBuZXcgVENvbXBhY3RQcm90b2NvbEZhY3RvcnkoKTsKKyAgICAgICAgICAgIH0KKworCisgICAgICAgICAgICAvLyBQcm9jZXNzb3IKKyAgICAgICAgICAgIHZhciBoYW5kbGVyID0gbmV3IFRlc3RTZXJ2ZXJIYW5kbGVyKCk7CisgICAgICAgICAgICB2YXIgcHJvY2Vzc29yID0gbmV3IFRocmlmdFRlc3RQcm9jZXNzb3IoaGFuZGxlcik7CisKKyAgICAgICAgICAgIC8vIFNpbXBsZSBTZXJ2ZXIKKyAgICAgICAgICAgIHZhciBzZXJ2ZXIgOiBUU2VydmVyID0gbnVsbDsKKyAgICAgICAgICAgIHN3aXRjaCggYXJncy5zZXJ2ZXJ0eXBlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgY2FzZSBzaW1wbGU6CisgICAgICAgICAgICAgICAgdmFyIHNpbXBsZVNlcnZlciA9IG5ldyBUU2ltcGxlU2VydmVyKCBwcm9jZXNzb3IsIHRyYW5zcG9ydCwgdHJhbnNmYWN0b3J5LCBwcm90ZmFjdG9yeSk7CisgICAgICAgICAgICAgICAgI2lmIHBocHdlYnNlcnZlcgorICAgICAgICAgICAgICAgIHNpbXBsZVNlcnZlci5ydW5PbmNlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAjZW5kCisgICAgICAgICAgICAgICAgc2VydmVyID0gc2ltcGxlU2VydmVyOworCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHRocm93ICJVbmhhbmRsZWQgc2VydmVyIHR5cGUiOworICAgICAgICAgICAgfQorCisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAvLyBTZXJ2ZXIgZXZlbnQgaGFuZGxlcgorICAgICAgICAgICAgaWYoIGFyZ3Muc2VydmVyRXZlbnRzKSB7CisgICAgICAgICAgICAgICAgdmFyIGV2ZW50cyA9IG5ldyBUZXN0U2VydmVyRXZlbnRIYW5kbGVyKCk7CisgICAgICAgICAgICAgICAgc2VydmVyLnNldEV2ZW50SGFuZGxlcihzZXJ2ZXJFdmVudHMpOworICAgICAgICAgICAgICAgIGhhbmRsZXIuc2VydmVyID0gc2VydmVyRW5naW5lOworICAgICAgICAgICAgfQorICAgICAgICAgICAgKi8KKworICAgICAgICAgICAgLy8gUnVuIGl0CisgICAgICAgICAgICBzZXJ2ZXIuU2VydmUoKTsKKyAgICAgICAgICAgIHRyYWNlKCJkb25lLiIpOworCisgICAgICAgIH0KKyAgICAgICAgY2F0Y2ggKHggOiBURXhjZXB0aW9uKQorICAgICAgICB7CisgICAgICAgICAgICB0cmFjZSgnJHggJHt4LmVycm9ySUR9ICR7eC5lcnJvck1zZ30nKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCAoeCA6IER5bmFtaWMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyYWNlKCckeCcpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvdGVzdC9oYXhlL3NyYy9UZXN0U2VydmVyRXZlbnRIYW5kbGVyLmh4IGIvdGVzdC9oYX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3RNYXA7CisKK2ltcG9ydCB0aHJpZnQudGVzdC4qOyAgLy8gZ2VuZXJhdGVkIGNvZGUKKworCitjbGFzcyBUZXN0U2VydmVySGFuZGxlciBpbXBsZW1lbnRzIFRocmlmdFRlc3QgeworCisgICAgcHVibGljIHZhciBzZXJ2ZXI6VFNlcnZlcjsKKworICAgIHB1YmxpYyBmdW5jdGlvbiBuZXcoKSB7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgInRlc3RWb2lkKCkiIGFuZCByZXR1cm5zIG5vdGhpbmcuCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdFZvaWQoKTpWb2lkCisgICAgeworICAgICAgICB0cmFjZSgidGVzdFZvaWQoKSIpOworICAgIH0KKworICAgIC8qKgorICAgICogUHJpbnRzICd0ZXN0Qm9vbCgiJXMiKScgd2hlcmUgJyVzJyB3aXRoIHRoaW5nIGFzICd0cnVlJyBvciAnZmFsc2UnCisgICAgKiBAcGFyYW0gYm9vbCAgdGhpbmcgLSB0aGUgYm9vbCBkYXRhIHRvIHByaW50CisgICAgKiBAcmV0dXJuIGJvb2wgIC0gcmV0dXJucyB0aGUgYm9vbCAndGhpbmcnCisgICAgKgorICAgICogQHBhcmFtIHRoaW5nCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdEJvb2wodGhpbmcgOiBCb29sKSA6IEJvb2wKKyAgICB7CisgICAgICAgIHRyYWNlKCd0ZXN0Qm9vbCgkdGhpbmcpJyk7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdFN0cmluZygiJXMiKScgd2l0aCB0aGluZyBhcyAnJXMnCisgICAgKiBAcGFyYW0gc3RyaW5nIHRoaW5nIC0gdGhlIHN0cmluZyB0byBwcmludAorICAgICogQHJldHVybiBzdHJpbmcgLSByZXR1cm5zIHRoZSBzdHJpbmcgJ3RoaW5nJworICAgICoKKyAgICAqIEBwYXJhbSB0aGluZworICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RTdHJpbmcodGhpbmc6U3RyaW5nKTpTdHJpbmcKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0c3RyaW5nKFwiIiArIHRoaW5nICsgIlwiKSIpOworICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RCeXRlKCIlZCIpJyB3aXRoIHRoaW5nIGFzICclZCcKKyAgICAqIEBwYXJhbSBieXRlIHRoaW5nIC0gdGhlIGJ5dGUgdG8gcHJpbnQKKyAgICAqIEByZXR1cm4gYnl0ZSAtIHJldHVybnMgdGhlIGJ5dGUgJ3RoaW5nJworICAgICoKKyAgICAqIEBwYXJhbSB0aGluZworICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RCeXRlKHRoaW5nOmhheGUuSW50MzIpOmhheGUuSW50MzIKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0Qnl0ZSgiICsgdGhpbmcgKyAiKSIpOworICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RJMzIoIiVkIiknIHdpdGggdGhpbmcgYXMgJyVkJworICAgICogQHBhcmFtIGkzMiB0aGluZyAtIHRoZSBpMzIgdG8gcHJpbnQKKyAgICAqIEByZXR1cm4gaTMyIC0gcmV0dXJucyB0aGUgaTMyICd0aGluZycKKyAgICAqCisgICAgKiBAcGFyYW0gdGhpbmcKKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0STMyKHRoaW5nOmhheGUuSW50MzIpOmhheGUuSW50MzIKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0STMyKCIgKyB0aGluZyArICIpIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdEk2NCgiJWQiKScgd2l0aCB0aGluZyBhcyAnJWQnCisgICAgKiBAcGFyYW0gaTY0IHRoaW5nIC0gdGhlIGk2NCB0byBwcmludAorICAgICogQHJldHVybiBpNjQgLSByZXR1cm5zIHRoZSBpNjQgJ3RoaW5nJworICAgICoKKyAgICAqIEBwYXJhbSB0aGluZworICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RJNjQodGhpbmc6aGF4ZS5JbnQ2NCk6aGF4ZS5JbnQ2NAorICAgIHsKKyAgICAgICAgdHJhY2UoInRlc3RJNjQoIiArIHRoaW5nICsgIikiKTsKKyAgICAgICAgcmV0dXJuIHRoaW5nOworICAgIH0KKworICAgIC8qKgorICAgICogUHJpbnRzICd0ZXN0RG91YmxlKCIlZiIpJyB3aXRoIHRoaW5nIGFzICclZicKKyAgICAqIEBwYXJhbSBkb3VibGUgdGhpbmcgLSB0aGUgZG91YmxlIHRvIHByaW50CisgICAgKiBAcmV0dXJuIGRvdWJsZSAtIHJldHVybnMgdGhlIGRvdWJsZSAndGhpbmcnCisgICAgKgorICAgICogQHBhcmFtIHRoaW5nCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdERvdWJsZSh0aGluZzpGbG9hdCk6RmxvYXQKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0RG91YmxlKCIgKyB0aGluZyArICIpIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBQcmludHMgJ3Rlc3RCaW5hcnkoIiVzIiknIHdoZXJlICclcycgaXMgYSBoZXgtZm9ybWF0dGVkIHN0cmluZyBvZiB0aGluZydzIGRhdGEKKyAgICAgKiBAcGFyYW0gYmluYXJ5ICB0aGluZyAtIHRoZSBiaW5hcnkgZGF0YSB0byBwcmludAorICAgICAqIEByZXR1cm4gYmluYXJ5ICAtIHJldHVybnMgdGhlIGJpbmFyeSAndGhpbmcnCisgICAgICoKKyAgICAgKiBAcGFyYW0gdGhpbmcKKyAgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdEJpbmFyeSh0aGluZyA6IGhheGUuaW8uQnl0ZXMpIDogaGF4ZS5pby5CeXRlcworICAgIHsKKyAgICAgICAgdmFyIGhleCA9ICIiOworICAgICAgICBmb3IgKCBpIGluIDAgLi4uIHRoaW5nLmxlbmd0aCkgeworICAgICAgICAgICAgaGV4ICs9IFN0cmluZ1Rvb2xzLmhleCggdGhpbmcuZ2V0KGkpLCAyKTsKKyAgICAgICAgfQorICAgICAgICB0cmFjZSgndGVzdEJpbmFyeSgkaGV4KScpOworICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RTdHJ1Y3QoInslc30iKScgd2hlcmUgdGhpbmcgaGFzIGJlZW4gZm9ybWF0dGVkCisgICAgKiAgaW50byBhIHN0cmluZyBvZiBjb21tYSBzZXBhcmF0ZWQgdmFsdWVzCisgICAgKiBAcGFyYW0gWHRydWN0IHRoaW5nIC0gdGhlIFh0cnVjdCB0byBwcmludAorICAgICogQHJldHVybiBYdHJ1Y3QgLSByZXR1cm5zIHRoZSBYdHJ1Y3QgJ3RoaW5nJworICAgICoKKyAgICAqIEBwYXJhbSB0aGluZworICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RTdHJ1Y3QodGhpbmc6WHRydWN0KTpYdHJ1Y3QKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0U3RydWN0KHsiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIlwiIiArIHRoaW5nLnN0cmluZ190aGluZyArICJcIiwgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaW5nLmJ5dGVfdGhpbmcgKyAiLCAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpbmcuaTMyX3RoaW5nICsgIiwgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIEludDY0LnRvU3RyKHRoaW5nLmk2NF90aGluZykgKyAifSkiKTsKKyAgICAgICAgcmV0dXJuIHRoaW5nOworICAgIH0KKworICAgIC8qKgorICAgICogUHJpbnRzICd0ZXN0TmVzdCgieyVzfSIpJyB3aGVyZSB0aGluZyBoYXMgYmVlbiBmb3JtYXR0ZWQKKyAgICAqICBpbnRvIGEgc3RyaW5nIG9mIHRoZSBuZXN0ZWQgc3RydWN0CisgICAgKiBAcGFyYW0gWHRydWN0MiB0aGluZyAtIHRoZSBYdHJ1Y3QyIHRvIHByaW50CisgICAgKiBAcmV0dXJuIFh0cnVjdDIgLSByZXR1cm5zIHRoZSBYdHJ1Y3QyICd0aGluZycKKyAgICAqCisgICAgKiBAcGFyYW0gdGhpbmcKKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0TmVzdChuZXN0Olh0cnVjdDIpOlh0cnVjdDIKKyAgICB7CisgICAgICAgIHZhciB0aGluZzpYdHJ1Y3QgPSBuZXN0LnN0cnVjdF90aGluZzsKKyAgICAgICAgdHJhY2UoInRlc3ROZXN0KHsiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbmVzdC5ieXRlX3RoaW5nICsgIiwgeyIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAiXCIiICsgdGhpbmcuc3RyaW5nX3RoaW5nICsgIlwiLCAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpbmcuYnl0ZV90aGluZyArICIsICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICB0aGluZy5pMzJfdGhpbmcgKyAiLCAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgSW50NjQudG9TdHIodGhpbmcuaTY0X3RoaW5nKSArICJ9LCAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgbmVzdC5pMzJfdGhpbmcgKyAifSkiKTsKKyAgICAgICAgcmV0dXJuIG5lc3Q7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RNYXAoInslcyIpJyB3aGVyZSB0aGluZyBoYXMgYmVlbiBmb3JtYXR0ZWQKKyAgICAqICBpbnRvIGEgc3RyaW5nIG9mICAna2V5ID0+IHZhbHVlJyBwYWlycworICAgICogIHNlcGFyYXRlZCBieSBjb21tYXMgYW5kIG5ldyBsaW5lcworICAgICogQHBhcmFtIG1hcDxpMzIsaTMyPiB0aGluZyAtIHRoZSBtYXA8aTMyLGkzMj4gdG8gcHJpbnQKKyAgICAqIEByZXR1cm4gbWFwPGkzMixpMzI+IC0gcmV0dXJucyB0aGUgbWFwPGkzMixpMzI+ICd0aGluZycKKyAgICAqCisgICAgKiBAcGFyYW0gdGhpbmcKKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0TWFwKHRoaW5nOkludE1hcDxoYXhlLkludDMyPik6SW50TWFwPGhheGUuSW50MzI+CisgICAgeworICAgICAgICB0cmFjZSgidGVzdE1hcCh7Iik7CisgICAgICAgIHZhciBmaXJzdDpCb29sID0gdHJ1ZTsKKyAgICAgICAgZm9yIChrZXkgaW4gdGhpbmcua2V5cygpKSB7CisgICAgICAgICAgICBpZiAoZmlyc3QpIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgiLCAiKTsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICB0cmFjZShrZXkgKyAiID0+ICIgKyB0aGluZy5nZXQoa2V5KSk7CisgICAgICAgIH07CisgICAgICAgIHRyYWNlKCJ9KSIpOworICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RTdHJpbmdNYXAoInslc30iKScgd2hlcmUgdGhpbmcgaGFzIGJlZW4gZm9ybWF0dGVkCisgICAgKiAgaW50byBhIHN0cmluZyBvZiAgJ2tleSA9PiB2YWx1ZScgcGFpcnMKKyAgICAqICBzZXBhcmF0ZWQgYnkgY29tbWFzIGFuZCBuZXcgbGluZXMKKyAgICAqIEBwYXJhbSBtYXA8c3RyaW5nLHN0cmluZz4gdGhpbmcgLSB0aGUgbWFwPHN0cmluZyxzdHJpbmc+IHRvIHByaW50CisgICAgKiBAcmV0dXJuIG1hcDxzdHJpbmcsc3RyaW5nPiAtIHJldHVybnMgdGhlIG1hcDxzdHJpbmcsc3RyaW5nPiAndGhpbmcnCisgICAgKgorICAgICogQHBhcmFtIHRoaW5nCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdFN0cmluZ01hcCh0aGluZzpTdHJpbmdNYXA8U3RyaW5nPik6U3RyaW5nTWFwPFN0cmluZz4KKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0U3RyaW5nTWFwKHsiKTsKKyAgICAgICAgdmFyIGZpcnN0OkJvb2wgPSB0cnVlOworICAgICAgICBmb3IgKGtleSBpbiB0aGluZy5rZXlzKCkpIHsKKyAgICAgICAgICAgIGlmIChmaXJzdCkgeworICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRyYWNlKCIsICIpOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIHRyYWNlKGtleSArICIgPT4gIiArIHRoaW5nLmdldChrZXkpKTsKKyAgICAgICAgfTsKKyAgICAgICAgdHJhY2UoIn0pIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdFNldCgieyVzfSIpJyB3aGVyZSB0aGluZyBoYXMgYmVlbiBmb3JtYXR0ZWQKKyAgICAqICBpbnRvIGEgc3RyaW5nIG9mICB2YWx1ZXMKKyAgICAqICBzZXBhcmF0ZWQgYnkgY29tbWFzIGFuZCBuZXcgbGluZXMKKyAgICAqIEBwYXJhbSBzZXQ8aTMyPiB0aGluZyAtIHRoZSBzZXQ8aTMyPiB0byBwcmludAorICAgICogQHJldHVybiBzZXQ8aTMyPiAtIHJldHVybnMgdGhlIHNldDxpMzI+ICd0aGluZycKKyAgICAqCisgICAgKiBAcGFyYW0gdGhpbmcKKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0U2V0KHRoaW5nOkludFNldCk6SW50U2V0CisgICAgeworICAgICAgICB0cmFjZSgidGVzdFNldCh7Iik7CisgICAgICAgIHZhciBmaXJzdDpCb29sID0gdHJ1ZTsKKyAgICAgICAgZm9yIChlbGVtIGluIHRoaW5nKSB7CisgICAgICAgICAgICBpZiAoZmlyc3QpIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgiLCAiKTsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICB0cmFjZShlbGVtKTsKKyAgICAgICAgfTsKKyAgICAgICAgdHJhY2UoIn0pIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdExpc3QoInslc30iKScgd2hlcmUgdGhpbmcgaGFzIGJlZW4gZm9ybWF0dGVkCisgICAgKiAgaW50byBhIHN0cmluZyBvZiAgdmFsdWVzCisgICAgKiAgc2VwYXJhdGVkIGJ5IGNvbW1hcyBhbmQgbmV3IGxpbmVzCisgICAgKiBAcGFyYW0gbGlzdDxpMzI+IHRoaW5nIC0gdGhlIGxpc3Q8aTMyPiB0byBwcmludAorICAgICogQHJldHVybiBsaXN0PGkzMj4gLSByZXR1cm5zIHRoZSBsaXN0PGkzMj4gJ3RoaW5nJworICAgICoKKyAgICAqIEBwYXJhbSB0aGluZworICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RMaXN0KHRoaW5nOkxpc3Q8aGF4ZS5JbnQzMj4pOkxpc3Q8aGF4ZS5JbnQzMj4KKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0TGlzdCh7Iik7CisgICAgICAgIHZhciBmaXJzdDpCb29sID0gdHJ1ZTsKKyAgICAgICAgZm9yIChlbGVtIGluIHRoaW5nKSB7CisgICAgICAgICAgICBpZiAoZmlyc3QpIHsKKyAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0cmFjZSgiLCAiKTsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICB0cmFjZShlbGVtKTsKKyAgICAgICAgfTsKKyAgICAgICAgdHJhY2UoIn0pIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdEVudW0oIiVkIiknIHdoZXJlIHRoaW5nIGhhcyBiZWVuIGZvcm1hdHRlZCBpbnRvIGl0J3MgbnVtZXJpYyB2YWx1ZQorICAgICogQHBhcmFtIE51bWJlcnogdGhpbmcgLSB0aGUgTnVtYmVyeiB0byBwcmludAorICAgICogQHJldHVybiBOdW1iZXJ6IC0gcmV0dXJucyB0aGUgTnVtYmVyeiAndGhpbmcnCisgICAgKgorICAgICogQHBhcmFtIHRoaW5nCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdEVudW0odGhpbmc6SW50KTpJbnQKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0RW51bSgiICsgdGhpbmcgKyAiKSIpOworICAgICAgICByZXR1cm4gdGhpbmc7CisgICAgfQorCisgICAgLyoqCisgICAgKiBQcmludHMgJ3Rlc3RUeXBlZGVmKCIlZCIpJyB3aXRoIHRoaW5nIGFzICclZCcKKyAgICAqIEBwYXJhbSBVc2VySWQgdGhpbmcgLSB0aGUgVXNlcklkIHRvIHByaW50CisgICAgKiBAcmV0dXJuIFVzZXJJZCAtIHJldHVybnMgdGhlIFVzZXJJZCAndGhpbmcnCisgICAgKgorICAgICogQHBhcmFtIHRoaW5nCisgICAgKi8KKyAgICBwdWJsaWMgZnVuY3Rpb24gdGVzdFR5cGVkZWYodGhpbmc6aGF4ZS5JbnQ2NCk6aGF4ZS5JbnQ2NAorICAgIHsKKyAgICAgICAgdHJhY2UoInRlc3RUeXBlZGVmKCIgKyB0aGluZyArICIpIik7CisgICAgICAgIHJldHVybiB0aGluZzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50cyAndGVzdE1hcE1hcCgiJWQiKScgd2l0aCBoZWxsbyBhcyAnJWQnCisgICAgKiBAcGFyYW0gaTMyIGhlbGxvIC0gdGhlIGkzMiB0byBwcmludAorICAgICogQHJldHVybiBtYXA8aTMyLG1hcDxpMzIsaTMyPj4gLSByZXR1cm5zIGEgZGljdGlvbmFyeSB3aXRoIHRoZXNlIHZhbHVlczoKKyAgICAqICAgey00ID0+IHstNCA9PiAtNCwgLTMgPT4gLTMsIC0yID0+IC0yLCAtMSA9PiAtMSwgfSwKKyAgICAqICAgICA0ID0+IHsxID0+IDEsIDIgPT4gMiwgMyA9PiAzLCA0ID0+IDQsIH0sIH0KKyAgICAqCisgICAgKiBAcGFyYW0gaGVsbG8KKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0TWFwTWFwKGhlbGxvOmhheGUuSW50MzIpOkludE1hcDxJbnRNYXA8aGF4ZS5JbnQzMj4+CisgICAgeworICAgICAgICB0cmFjZSgidGVzdE1hcE1hcCgiICsgaGVsbG8gKyAiKSIpOworICAgICAgICB2YXIgbWFwbWFwID0gbmV3IEludE1hcDxJbnRNYXA8SW50Pj4oKTsKKyAgICAgICAgdmFyIHBvcyA9IG5ldyBJbnRNYXA8SW50PigpOworICAgICAgICB2YXIgbmVnID0gbmV3IEludE1hcDxJbnQ+KCk7CisgICAgICAgIGZvciAoaSBpbiAxIC4uLiA1KSB7CisgICAgICAgICAgICBwb3Muc2V0KGksIGkpOworICAgICAgICAgICAgbmVnLnNldCgtaSwgLWkpOworICAgICAgICB9OworICAgICAgICBtYXBtYXAuc2V0KDQsIHBvcyk7CisgICAgICAgIG1hcG1hcC5zZXQoLTQsIG5lZyk7CisgICAgICAgIHJldHVybiBtYXBtYXA7CisgICAgfQorCisgICAgLyoqCisgICAgKiBTbyB5b3UgdGhpbmsgeW91J3ZlIGdvdCB0aGlzIGFsbCB3b3JrZWQsIG91dCBlaD8KKyAgICAqCisgICAgKiBDcmVhdGVzIGEgdGhlIHJldHVybmVkIG1hcCB3aXRoIHRoZXNlIHZhbHVlcyBhbmQgcHJpbnRzIGl0IG91dDoKKyAgICAqICAgeyAxID0+IHsgMiA9PiBhcmd1bWVudCwKKyAgICAqICAgICAgICAgICAgMyA9PiBhcmd1bWVudCwKKyAgICAqICAgICAgICAgIH0sCisgICAgKiAgICAgMiA9PiB7IDYgPT4gPGVtcHR5IEluc2FuaXR5IHN0cnVjdD4sIH0sCisgICAgKiAgIH0KKyAgICAqIEByZXR1cm4gbWFwPFVzZXJJZCwgbWFwPE51bWJlcnosSW5zYW5pdHk+PiAtIGEgbWFwIHdpdGggdGhlIGFib3ZlIHZhbHVlcworICAgICoKKyAgICAqIEBwYXJhbSBhcmd1bWVudAorICAgICovCisgICAgcHVibGljIGZ1bmN0aW9uIHRlc3RJbnNhbml0eShhcmd1bWVudCA6IEluc2FuaXR5KSA6IEludDY0TWFwPCBJbnRNYXA8IEluc2FuaXR5Pj4KKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0SW5zYW5pdHkoKSIpOworCisgICAgICAgIHZhciBmaXJzdF9tYXAgPSBuZXcgSW50TWFwPCBJbnNhbml0eT4oKTsKKyAgICAgICAgZmlyc3RfbWFwLnNldChOdW1iZXJ6LlRXTywgYXJndW1lbnQpOworICAgICAgICBmaXJzdF9tYXAuc2V0KE51bWJlcnouVEhSRUUsIGFyZ3VtZW50KTsKKworICAgICAgICB2YXIgc2Vjb25kX21hcCA9IG5ldyBJbnRNYXA8IEluc2FuaXR5PigpOworICAgICAgICB2YXIgbG9vbmV5ID0gbmV3IEluc2FuaXR5KCk7CisgICAgICAgIHNlY29uZF9tYXAuc2V0KE51bWJlcnouU0lYLCBsb29uZXkpOworCisgICAgICAgIHZhciBpbnNhbmUgPSBu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kiKTsKKyAgICAgICAgdmFyIGhlbGxvID0gbmV3IFh0cnVjdCgpOworICAgICAgICBoZWxsby5zdHJpbmdfdGhpbmcgPSAiSGVsbG8yIjsKKyAgICAgICAgaGVsbG8uYnl0ZV90aGluZyA9IGFyZzA7CisgICAgICAgIGhlbGxvLmkzMl90aGluZyA9IGFyZzE7CisgICAgICAgIGhlbGxvLmk2NF90aGluZyA9IGFyZzI7CisgICAgICAgIHJldHVybiBoZWxsbzsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIFByaW50ICd0ZXN0RXhjZXB0aW9uKCVzKScgd2l0aCBhcmcgYXMgJyVzJworICAgICogQHBhcmFtIHN0cmluZyBhcmcgLSBhIHN0cmluZyBpbmRpY2F0aW9uIHdoYXQgdHlwZSBvZiBleGNlcHRpb24gdG8gdGhyb3cKKyAgICAqIGlmIGFyZyA9PSAiWGNlcHRpb24iIHRocm93IFhjZXB0aW9uIHdpdGggZXJyb3JDb2RlID0gMTAwMSBhbmQgbWVzc2FnZSA9IGFyZworICAgICogZWxzZW4gaWYgYXJnID09ICJURXhjZXB0aW9uIiB0aHJvdyBURXhjZXB0aW9uCisgICAgKiBlbHNlIGRvIG5vdCB0aHJvdyBhbnl0aGluZworICAgICoKKyAgICAqIEBwYXJhbSBhcmcKKyAgICAqLworICAgIHB1YmxpYyBmdW5jdGlvbiB0ZXN0RXhjZXB0aW9uKGFyZzpTdHJpbmcpOlZvaWQKKyAgICB7CisgICAgICAgIHRyYWNlKCJ0ZXN0RXhjZXB0aW9uKCIgKyBhcmcgKyAiKSIpOworICAgICAgICBpZiAoYXJnID09ICJYY2VwdGlvbiIpIHsKKyAgICAgICAgICAgIHZhciB4ID0gbmV3IFhjZXB0aW9uKCk7CisgICAgICAgICAgICB4LmVycm9yQ29kZSA9IDEwMDE7CisgICAgICAgICAgICB4Lm1lc3NhZ2UgPSBhcmc7CisgICAgICAgICAgICB0aHJvdyB4OworICAgICAgICB9OworICAgICAgICBpZiAoYXJnID09ICJURXh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AgICAgICAgICAgICAgICAgICAgICAgICAgICBOb3RoaW5nIC0+IGRvIHJldHVybiAoTm9UcmFuc3BvcnQgJCAiRmFpbGVkIHRvIHBhcnNlIFVSSTogIiArKyB1cmlTdHIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSnVzdCh1cmkpIC0+IGRvCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IDwtIG9wZW5IdHRwQ2xpZW50IHVyaQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQgSHR0cCB0CitnZXRUcmFuc3BvcnQgdCBob3N0IHBvcnQgPSBkbyByZXR1cm4gKE5vVHJhbnNwb3J0ICQgIlVuc3VwcG9ydGVkIHRyYW5zcG9ydDogIiArKyB0KQorCitkYXRhIFByb3RvY29sVHlwZSA9IEJpbmFyeQorICAgICAgICAgICAgICAgICAgfCBDb21wYWN0CisgICAgICAgICAgICAgICAgICB8IEpTT04KKyAgICAgICAgICAgICAgICAgIHwgSGVhZGVyCisgICAgICAgICAgICAgICAgICBkZXJpdmluZyAoU2hvdywgRXEpCisKK2dldFByb3RvY29sIDo6IFN0cmluZyAtPiBQcm90b2NvbFR5cGUKK2dldFByb3RvY29sICJiaW5hcnkiICA9IEJpbmFyeQorZ2V0UHJvdG9jb2wgImNvbXBhY3QiID0gQ29tcGFjdAorZ2V0UHJvdG9jb2wgImpzb24iICAgID0gSlNPTgorZ2V0UHJvdG9jb2wgImhlYWRlciIgPSBIZWFkZXIKK2dldFByb3RvY29sIHAgPSBlcnJvciAkICJVbnN1cHBvcnRlZCBQcm90b2NvbDogIiArKyBwCisKK2RlZmF1bHRPcHRpb25zIDo6IE9wdGlvbnMKK2RlZmF1bHRPcHRpb25zID0gT3B0aW9ucworICB7IHBvcnQgICAgICAgICA9IDkwOTAKKyAgLCBkb21haW5Tb2NrZXQgPSAiIgorICAsIGhvc3QgICAgICAgICA9ICJsb2NhbGhvc3QiCisgICwgdHJhbnNwb3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YWRlcgoraW1wb3J0IFRocmlmdC5Qcm90b2NvbC5KU09OCisKK2RhdGEgT3B0aW9ucyA9IE9wdGlvbnMKKyAgeyBwb3J0ICAgICAgICAgOjogSW50CisgICwgZG9tYWluU29ja2V0IDo6IFN0cmluZworICAsIHNlcnZlclR5cGUgICA6OiBTZXJ2ZXJUeXBlCisgICwgdHJhbnNwb3J0ICAgIDo6IFN0cmluZworICAsIHByb3RvY29sICAgICA6OiBQcm90b2NvbFR5cGUKKyAgLCBzc2wgICAgICAgICAgOjogQm9vbAorICAsIHdvcmtlcnMgICAgICA6OiBJbnQKKyAgfQorCitkYXRhIFNlcnZlclR5cGUgPSBTaW1wbGUKKyAgICAgICAgICAgICAgICB8IFRocmVhZFBvb2wKKyAgICAgICAgICAgICAgICB8IFRocmVhZGVkCisgICAgICAgICAgICAgICAgfCBOb25CbG9ja2luZworICAgICAgICAgICAgICAgIGRlcml2aW5nIChTaG93LCBFcSkKKworaW5zdGFuY2UgSXNTdHJpbmcgU2VydmVyVHlwZSB3aGVyZQorICBmcm9tU3RyaW5nICJzaW1wbGUiICAgICAgPSBTaW1wbGUKKyAgZnJvbVN0cmluZyAidGhyZWFkLXBvb2wiID0gVGhyZWFkUG9vbAorICBmcm9tU3RyaW5nICJ0aHJlYWRlZCIgICAgPSBUaHJlYWRlZAorICBmcm9tU3RyaW5nICJub25ibG9ja2luZyIgPSBOb25CbG9ja2luZworICBmcm9tU3RyaW5nIF8gPSBlcnJvciAibm90IGEgdmFsaWQgc2VydmVyIHR5cGUiCisKK2RhdGEgVHJhbnNwb3J0VHlwZSA9IEJ1ZmZlcmVkIChTb2NrZXQgLT4gKElPIElPLkhhbmRsZSkpCisgICAgICAgICAgICAgICAgICAgfCBGcmFtZWQgKFNvY2tldCAtPiAoSU8gKEZyYW1lZFRyYW5zcG9ydCBJTy5IYW5kbGUpKSkKKyAgICAgICAgICAgICAgICAgICB8IE5vVHJhbnNwb3J0IFN0cmluZworCitnZXRUcmFuc3BvcnQgO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HggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0Qm9vbCgiICsrIHNob3cgeCArKyAiKSIKKyAgICByZXR1cm4geAorCisgIHRlc3RCeXRlIF8geCA9IGRvCisgICAgU3lzdGVtLklPLnB1dFN0ckxuICQgInRlc3RCeXRlKCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdEkzMiBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0STMyKCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdEk2NCBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0STY0KCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdERvdWJsZSBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0RG91YmxlKCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdEJpbmFyeSBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0QmluYXJ5KCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdFN0cnVjdCBfIHN0cnVjdEBYdHJ1Y3R7Li59ID0gZG8KKyAgICBTeXN0ZW0uSU8ucHV0U3RyTG4gJCAidGVzdFN0cnVjdCh7IiArKyBzaG93IHh0cnVjdF9zdHJpbmdfdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICArKyAiLCAiICsrIHNob3cgeHRydWN0X2J5dGVfdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICArKyAiLCAiICsrIHNob3cgeHRydWN0X2kzMl90aGluZworICAgICAgICAgICAgICAgICAgICAgICsrICIsICIgKysgc2hvdyB4dHJ1Y3RfaTY0X3RoaW5nCisgICAgICAgICAgICAgICAgICAgICAgKysgIn0pIgorICAg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2lmeUxpc3QgeCArKyAifSkiCisgICAgcmV0dXJuIHgKKworICB0ZXN0RW51bSBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0RW51bSgiICsrIHNob3cgeCArKyAiKSIKKyAgICByZXR1cm4geAorCisgIHRlc3RUeXBlZGVmIF8geCA9IGRvCisgICAgU3lzdGVtLklPLnB1dFN0ckxuICQgInRlc3RUeXBlZGVmKCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiB4CisKKyAgdGVzdE1hcE1hcCBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAkICJ0ZXN0TWFwTWFwKCIgKysgc2hvdyB4ICsrICIpIgorICAgIHJldHVybiAkIE1hcC5mcm9tTGlzdCBbICgtNCwgTWFwLmZyb21MaXN0IFsgKC00LCAtNCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICgtMywgLTMpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAoLTIsIC0yKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgKC0xLCAtMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKQorICAgICAgICAgICAgICAgICAgICAgICAgICAsICg0LCAgTWFwLmZyb21MaXN0IFsgKDEsIDEpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLCAoMiwgMikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsICgzLCAzKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgKDQsIDQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgXQorCisgIHRlc3RJbnNhbml0eSBfIHggPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAidGVzdEluc2FuaXR5KCkiCisgICAgcmV0dXJuICQgTWFwLmZyb21MaXN0IFsgKDEsIE1hcC5mcm9tTGlzdCBbIChUV08gICwgeCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwgKFRIUkVFLCB4KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgLCAoMiwgTWFwLmZyb21MaXN0IFsgKFNJWCwgZGVmYXVsdF9JbnNhbml0eSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pCisgICAgICAgICAgICAgICAgICAgICAgICAgIF0KKworICB0ZXN0TXVsdGkgXyBieXRlIGkzMiBpNjQgXyBfIF8gPSBkbworICAgIFN5c3RlbS5JTy5wdXRTdHJMbiAidGVzdE11bHRpKCkiCisgICAgcmV0dXJuIFh0cnVjdHsgeHRydWN0X3N0cmluZ190aGluZyA9IFRleHQucGFjayAiSGVsbG8yIgorICAgICAgICAgICAgICAgICAsIHh0cnVjdF9ieXRlX3RoaW5nICAgPSBieXRlCisgICAgICAgICAgICAgICAgICwgeHRydWN0X2kzMl90aGluZyAgICA9IGkzMgorICAgICAgICAgICAgICAgICAsIHh0cnVjdF9pNjRfdGhpbmcgICAgPSBpNjQKKyAgICAgICAgICAgICAgICAgfQorCisgIHRlc3RFeGNlcHRpb24gXyBzID0gZG8KKyAgICBTeXN0ZW0uSU8ucHV0U3RyTG4gJCAidGVzdEV4Y2VwdGlvbigiICsrIHNob3cgcyArKyAiKSIKKyAgICBjYXNlIHMgb2YKKyAgICAgICJYY2VwdGlvbiIgICAtPiB0aHJvdyAkIFhjZXB0aW9uIDEwMDEgcworICAgICAgIlRFeGNlcHRpb24iIC0+IHRocm93IFRocmlmdEV4Y2VwdGlvbgorICAgICAgXyAtPiByZXR1cm4gKCkKKworICB0ZXN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cnVuU2VydmVyIHByb3RvY29sIGYgcG9ydAorICAgICAgICBGcmFtZWQgICBmIC0+IHJ1blNlcnZlciBwcm90b2NvbCBmIHBvcnQKKyAgICAgICAgTm9UcmFuc3BvcnQgZXJyIC0+IHB1dFN0ckxuIGVycgorICAgICAgU3lzdGVtLklPLnB1dFN0ckxuICQgIlN0YXJ0aW5nIFwiIiArKyBzaG93IHNlcnZlclR5cGUgKysgIlwiIHNlcnZlciAoIiArKworICAgICAgICBzaG93IHRyYW5zcG9ydCArKyAiKSBsaXN0ZW4gb246ICIgKysgZG9tYWluU29ja2V0ICsrIHNob3cgcG9ydAorICAgICAgd2hlcmUKKyAgICAgICAgYWNjZXB0b3IgcCBmIHNvY2tldCA9IGRvCisgICAgICAgICAgdCA8LSBmIHNvY2tldAorICAgICAgICAgIHJldHVybiAocCB0LCBwIHQpCisKKyAgICAgICAgaGVhZGVyQWNjZXB0b3IgZiBzb2NrZXQgPSBkbworICAgICAgICAgIHQgPC0gZiBzb2NrZXQKKyAgICAgICAgICBwIDwtIGNyZWF0ZUhlYWRlclByb3RvY29sMSB0CisgICAgICAgICAgcmV0dXJuIChwLCBwKQorCisgICAgICAgIGRvUnVuU2VydmVyIHAgZiA9IGRvCisgICAgICAgICAgcnVuVGhyZWFkZWRTZXJ2ZXIgKGFjY2VwdG9yIHAgZikgVGVzdEhhbmRsZXIgVGhyaWZ0VGVzdC5wcm9jZXNzIC4gUG9ydE51bWJlciAuIGZyb21JbnRlZ3JhbAorCisgICAgICAgIHJ1blNlcnZlciBwIGYgcG9ydCA9IGNhc2UgcCBvZgorICAgICAgICAgIEJpbmFyeSAgLT4gZG9SdW5TZXJ2ZXIgQmluYXJ5UHJvdG9jb2wgZiBwb3J0CisgICAgICAgICAgQ29tcGFjdCAtPiBkb1J1blNlcnZlciBDb21wYWN0UHJvdG9jb2wgZiBwb3J0CisgICAgICAgICAgSlNPTiAgICAtPiBkb1J1blNlcnZlciBKU09OUHJvdG9jb2wgZiBwb3J0Cis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YmluYXJ5X2h0dHAtaXAiLAorICAicHktZF9hY2NlbC1iaW5hcnlfaHR0cC1pcC1zc2wiLAorICAicHktZF9hY2NlbGMtY29tcGFjdF9odHRwLWlwIiwKKyAgInB5LWRfYWNjZWxjLWNvbXBhY3RfaHR0cC1pcC1zc2wiLAorICAicHktZF9iaW5hcnlfaHR0cC1pcCIsCisgICJweS1kX2JpbmFyeV9odHRwLWlwLXNzbCIsCisgICJweS1kX2NvbXBhY3RfaHR0cC1pcCIsCisgICJweS1kX2NvbXBhY3RfaHR0cC1pcC1zc2wiLAorICAicHktZF9qc29uX2h0dHAtaXAiLAorICAicHktZF9qc29uX2h0dHAtaXAtc3NsIiwKKyAgInB5LWRhcnRfYWNjZWwtYmluYXJ5X2h0dHAtaXAiLAorICAicHktZGFydF9hY2NlbGMtY29tcGFjdF9odHRwLWlwIiwKKyAgInB5LWRhcnRfYmluYXJ5X2h0dHAtaXAiLAorICAicHktZGFydF9jb21wYWN0X2h0dHAtaXAiLAorICAicHktZGFydF9qc29uX2h0dHAtaXAiLAorICAicHktaHNfYWNjZWwtYmluYXJ5X2h0dHAtaXAiLAorICAicHktaHNfYWNjZWxjLWNvbXBhY3RfaHR0cC1pcCIsCisgICJweS1oc19iaW5hcnlfaHR0cC1pcCIsCisgICJweS1oc19jb21wYWN0X2h0dHAtaXAiLAorICAicHktaHNfaGVhZGVyX2h0dHAtaXAiLAorICAicHktaHNfanNvbl9odHRwLWlwIiwKKyAgInB5LWphdmFfYWNjZWwtYmluYXJ5X2h0dHAtaXAiLAorICAicHktamF2YV9hY2NlbC1iaW5hcnlfaHR0cC1pcC1zc2wiLAorICAicHktamF2YV9hY2NlbGMtY29tcGFjdF9odHRwLWlwIiwKKyAgInB5LWphdmFfYWNjZWxjLWNvbXBhY3RfaHR0cC1pcC1zc2wiLAorICAicHktamF2YV9iaW5hcnlfaHR0cC1pcCIsCisgICJweS1qYXZhX2JpbmFyeV9odHRwLWlwLXNzbCIsCisgICJweS1qYXZhX2N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3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7Cit1c2luZyBUaHJpZnRUZXN0OworCituYW1lc3BhY2UgQ2xpZW50Cit7CisgICAgcHVibGljIGNsYXNzIFByb2dyYW0KKyAgICB7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IE1haW4oc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5TZXRCdWZmZXJTaXplKENvbnNvbGUuQnVmZmVyV2lkdGgsIDQwOTYpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiRmFpbGVkIHRvIGdyb3cgc2Nyb2xsLWJhY2sgYnVmZmVyIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHNwbGl0IG1vZGUgYW5kIG9wdGlvbnMKKyAgICAgICAgICAgIHZhciBzdWJBcmdzID0gbmV3IExpc3Q8c3RyaW5nPihhcmdzKTsKKyAgICAgICAgICAgIHZhciBmaXJzdEFyZyA9IHN0cmluZy5FbXB0eTsKKyAgICAgICAgICAgIGlmIChzdWJBcmdzLkNvdW50ID4gMCkKKyAgICAgICAgICAgIHsgCisgICAgICAgICAgICAgICAgZmlyc3RBcmcgPSBzdWJBcmdzWzBdOworICAgICAgICAgICAgICAgIHN1YkFyZ3MuUmVtb3ZlQXQoMCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHJ1biB3aGF0ZXZlciBtb2RlIGlzIGNob29zZW4KKyAgICAgICAgICAgIHN3aXRjaChmaXJzdEFyZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlICJjbGllbnQiOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGVzdENsaWVudC5FeGVjdXRlKHN1YkFyZ3MpOworICAgICAgICAgICAgICAgIGNhc2UgIi0taGVscCI6CisgICAgICAgICAgICAgICAgICAgIFByaW50SGVscCgpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBQcmludEhlbHAoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBQcmludEhlbHAoKQorICAgICAgICB7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNhZ2U6Iik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICBDbGllbnQgIGNsaWVudCAgW29wdGlvbnNdJyIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgQ2xpZW50ICAtLWhlbHAiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIiKTsKKworICAgICAgICAgICAgVGVzdENsaWVudC5QcmludE9wdGlvbnNIZWxwKCk7CisgICAgICAgIH0KKyAgICB9Cit9CisKKwpkaWZmIC0tZ2l0IGEvdGVzdC9uZXRjb3JlL0NsaWVudC9Qcm9wZXJ0aWVzL0Fzc2VtYmx5SW5mby5jcyBiL3Rlc3QvbmV0Y29yZS9DbGllbnQvUHJvcGVydGllcy9Bc3NlbWJseUluZm8uY3MKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMTU3MTUyYgotLS0gL2Rldi9udWxsCisrKyBiL3Rlc3QvbmV0Y29yZS9DbGllbnQvUHJvcGVydGllcy9Bc3NlbWJseUluZm8uY3MKQEAgLTAsMCArMSw0MyBAQAor77u/Ly8gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uKEFTRikgdW5kZXIgb25lCisvLyBvciBtb3JlIGNvbnRyaWJ1dG9yIGxpY2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VzaW5nIFRocmlmdC5UcmFuc3BvcnRzLkNsaWVudDsKKworbmFtZXNwYWNlIFRocmlmdFRlc3QKK3sKKyAgICBwdWJsaWMgY2xhc3MgVGVzdENsaWVudAorICAgIHsKKyAgICAgICAgcHJpdmF0ZSBjbGFzcyBUZXN0UGFyYW1zCisgICAgICAgIHsKKyAgICAgICAgICAgIHB1YmxpYyBpbnQgbnVtSXRlcmF0aW9ucyA9IDE7CisgICAgICAgICAgICBwdWJsaWMgSVBBZGRyZXNzIGhvc3QgPSBJUEFkZHJlc3MuQW55OworICAgICAgICAgICAgcHVibGljIGludCBwb3J0ID0gOTA5MDsKKyAgICAgICAgICAgIHB1YmxpYyBpbnQgbnVtVGhyZWFkcyA9IDE7CisgICAgICAgICAgICBwdWJsaWMgc3RyaW5nIHVybDsKKyAgICAgICAgICAgIHB1YmxpYyBzdHJpbmcgcGlwZTsKKyAgICAgICAgICAgIHB1YmxpYyBib29sIGJ1ZmZlcmVkOworICAgICAgICAgICAgcHVibGljIGJvb2wgZnJhbWVkOworICAgICAgICAgICAgcHVibGljIHN0cmluZyBwcm90b2NvbDsKKyAgICAgICAgICAgIHB1YmxpYyBib29sIGVuY3J5cHRlZCA9IGZhbHNlOworCisgICAgICAgICAgICBpbnRlcm5hbCB2b2lkIFBhcnNlKCBMaXN0PHN0cmluZz4gYXJncykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyZ3MuQ291bnQ7ICsraSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChhcmdzW2ldID09ICItdSIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IGFyZ3NbKytpXTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItbiIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bUl0ZXJhdGlvbnMgPSBDb252ZXJ0LlRvSW50MzIoYXJnc1srK2ldKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldLlN0YXJ0c1dpdGgoIi0tcGlwZT0iKSkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcGlwZSA9IGFyZ3NbaV0uU3Vic3RyaW5nKGFyZ3NbaV0uSW5kZXhPZigiPSIpICsgMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNpbmcgbmFtZWQgcGlwZXMgdHJhbnNwb3J0Iik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXS5TdGFydHNXaXRoKCItLWhvc3Q9IikpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIHRoZXJlIGZvciBpcGFkZHJlc3MKKyAgICAgICAgICAgICAgICAgICAgICAgIGhvc3QgPSBuZXcgSVBBZGRyZXNzKEVuY29kaW5nLlVuaWNvZGUuR2V0Qnl0ZXMoYXJnc1tpXS5TdWJzdHJpbmcoYXJnc1tpXS5JbmRleE9mKCI9IikgKyAxKSkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0uU3RhcnRzV2l0aCgiLS1wb3J0PSIpKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBwb3J0ID0gaW50LlBhcnNlKGFyZ3NbaV0uU3Vic3RyaW5nKGFyZ3NbaV0uSW5kZXhPZigiPSIpICsgMSkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi1iIiB8fCBhcmdzW2ldID09ICItLWJ1ZmZlcmVkIiB8fCBhcmdzW2ldID09ICItLXRyYW5zcG9ydD1idWZmZXJlZCIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcmVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBidWZmZXJlZCBzb2NrZXRzIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLWYiIHx8IGFyZ3NbaV0gPT0gIi0tZnJhbWVkIiB8fCBhcmdzW2ldID09ICItLXRyYW5zcG9ydD1mcmFtZWQiKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlVzaW5nIGZyYW1lZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItdCIpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bVRocmVhZHMgPSBDb252ZXJ0LlRvSW50MzIoYXJnc1srK2ldKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLWJpbmFyeSIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1iaW5hcnkiKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBwcm90b2NvbCA9ICJiaW5hcnkiOworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlVzaW5nIGJpbmFyeSBwcm90b2NvbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tY29tcGFjdCIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1jb21wYWN0IikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2wgPSAiY29tcGFjdCI7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNpbmcgY29tcGFjdCBwcm90b2NvbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tanNvbiIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1qc29uIikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2wgPSAianNvbiI7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNpbmcgSlNPTiBwcm90b2NvbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tc3NsIikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZW5jcnlwdGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJVc2luZyBlbmNyeXB0ZWQgdHJhbnNwb3J0Iik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvL3Rocm93IG5ldyBBcmd1bWVudEV4Y2VwdGlvbihhcmdzW2ldKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgWDUwOUNlcnRpZmljYXRlMiBHZXRDbGllbnRDZXJ0KCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgY2xpZW50Q2VydE5hbWUgPSAiY2xpZW50LnAxMiI7CisgICAgICAgICAgICAgICAgdmFyIHBvc3NpYmxlUGF0aHMgPSBuZXcgTGlzdDxzdHJpbmc+CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAiLi4vLi4vLi4va2V5cy8iLAorICAgICAgICAgICAgICAgICAgICAiLi4vLi4va2V5cy8iLAorICAgICAgICAgICAgICAgICAgICAiLi4va2V5cy8iLAorICAgICAgICAgICAgICAgICAgICAia2V5cy8iLAorICAgICAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgICAgICBzdHJpbmcgZXhpc3RpbmdQYXRoID0gbnVsbDsKKyAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIgcG9zc2libGVQYXRoIGluIHBvc3NpYmxlUGF0aHMpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2YXIgcGF0aCA9IFBhdGguR2V0RnVsbFBhdGgocG9zc2libGVQYXRoICsgY2xpZW50Q2VydE5hbWUpOworICAgICAgICAgICAgICAgICAgICBpZiAoRmlsZS5FeGlzdHMocGF0aCkpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChzdHJpbmcuSXNOdWxsT3JFbXB0eShleGlzdGluZ1BhdGgpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigkIkNhbm5vdCBmaW5kIGZpbGU6IHtjbGllbnRDZXJ0TmFtZX0iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICB2YXIgY2VydCA9IG5ldyBYNTA5Q2VydGlmaWNhdGUyKGV4aXN0aW5nUGF0aCwgInRocmlmdCIpOworCisgICAgICAgICAgICAgICAgcmV0dXJuIGNlcnQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHB1YmxpYyBUQ2xpZW50VHJhbnNwb3J0IENyZWF0ZVRyYW5zcG9ydCgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKHVybCA9PSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gZW5kcG9pbnQgdHJhbnNwb3J0CisgICAgICAgICAgICAgICAgICAgIFRDbGllbnRUcmFuc3BvcnQgdHJhbnMgPSBudWxsOworCisgICAgICAgICAgICAgICAgICAgIGlmIChwaXBlICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFROYW1lZFBpcGVDbGllbnRUcmFuc3BvcnQocGlwZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW5jcnlwdGVkKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNlcnQgPSBHZXRDbGllbnRDZXJ0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2VydCA9PSBudWxsIHx8ICFjZXJ0Lkhhc1ByaXZhdGVLZXkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigiQ2VydGlmaWNhdGUgZG9lc24ndCBjb250YWluIHByaXZhdGUga2V5Iik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQoaG9zdCwgcG9ydCwgMCwgY2VydCwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzZW5kZXIsIGNlcnRpZmljYXRlLCBjaGFpbiwgZXJyb3JzKSA9PiB0cnVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBTc2xQcm90b2NvbHMuVGxzIHwgU3NsUHJvdG9jb2xzLlRsczExIHwgU3NsUHJvdG9jb2xzLlRsczEyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUU29ja2V0Q2xpZW50VHJhbnNwb3J0KGhvc3QsIHBvcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gbGF5ZXJlZCB0cmFuc3BvcnQKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJ1ZmZlcmVkKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFucyA9IG5ldyBUQnVmZmVyZWRDbGllbnRUcmFuc3BvcnQodHJhbnMpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZyYW1lZCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVEZyYW1lZENsaWVudFRyYW5zcG9ydCh0cmFucyk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnM7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUSHR0cENsaWVudFRyYW5zcG9ydChuZXcgVXJpKHVybCksIG51bGwpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVFByb3RvY29sIENyZWF0ZVByb3RvY29sKFRDbGllbnRUcmFuc3BvcnQgdHJhbnNwb3J0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChwcm90b2NvbCA9PSAiY29tcGFjdCIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRDb21wYWN0UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAocHJvdG9jb2wgPT0gImpzb24iKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUSnNvblByb3RvY29sKHRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnNwb3J0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisKKyAgICAgICAgcHJpdmF0ZSBjb25zdCBpbnQgRXJyb3JCYXNlVHlwZXMgPSAxOworICAgICAgICBwcml2YXRlIGNvbnN0IGludCBFcnJvclN0cnVjdHMgPSAyOworICAgICAgICBwcml2YXRlIGNvbnN0IGludCBFcnJvckNvbnRhaW5lcnMgPSA0OworICAgICAgICBwcml2YXRlIGNvbnN0IGludCBFcnJvckV4Y2VwdGlvbnMgPSA4OworICAgICAgICBwcml2YXRlIGNvbnN0IGludCBFcnJvclVua25vd24gPSA2NDsKKworICAgICAgICBwcml2YXRlIGNsYXNzIENsaWVudFRlc3QKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBUQ2xpZW50VHJhbnNwb3J0IHRyYW5zcG9ydDsKKyAgICAgICAgICAgIHByaXZhdGUgcmVhZG9ubHkgVGhyaWZ0VGVzdC5DbGllbnQgY2xpZW50OworICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBpbnQgbnVtSXRlcmF0aW9uczsKKyAgICAgICAgICAgIHByaXZhdGUgYm9vbCBkb25lOworCisgICAgICAgICAgICBwdWJsaWMgaW50IFJldHVybkNvZGUgeyBnZXQ7IHNldDsgfQorCisgICAgICAgICAgICBwdWJsaWMgQ2xpZW50VGVzdChUZXN0UGFyYW1zIHBhcmFtKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYW5zcG9ydCA9IHBhcmFtLkNyZWF0ZVRyYW5zcG9ydCgpOworICAgICAgICAgICAgICAgIGNsaWVudCA9IG5ldyBUaHJpZnRUZXN0LkNsaWVudChwYXJhbS5DcmVhdGVQcm90b2NvbCh0cmFuc3BvcnQpKTsKKyAgICAgICAgICAgICAgICBudW1JdGVyYXRpb25zID0gcGFyYW0ubnVtSXRlcmF0aW9uczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHZvaWQgRXhlY3V0ZSgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHRva2VuID0gQ2FuY2VsbGF0aW9uVG9rZW4uTm9uZTsKKworICAgICAgICAgICAgICAgIGlmIChkb25lKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkV4ZWN1dGUgY2FsbGVkIG1vcmUgdGhhbiBvbmNlIik7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbnZhbGlkT3BlcmF0aW9uRXhjZXB0aW9uKCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBudW1JdGVyYXRpb25zOyBpKyspCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0cmFuc3BvcnQuSXNPcGVuKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zcG9ydC5PcGVuQXN5bmModG9rZW4pLkdldEF3YWl0ZXIoKS5HZXRSZXN1bHQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjYXRjaCAoVFRyYW5zcG9ydEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiQ29ubmVjdCBmYWlsZWQ6ICIgKyBleC5NZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFJldHVybkNvZGUgfD0gRXJyb3JVbmtub3duOworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkNvbm5lY3QgZmFpbGVkOiAiICsgZXguTWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBSZXR1cm5Db2RlIHw9IEVycm9yVW5rbm93bjsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBSZXR1cm5Db2RlIHw9IEV4ZWN1dGVDbGllbnRUZXN0QXN5bmMoY2xpZW50KS5HZXRBd2FpdGVyKCkuR2V0UmVzdWx0KCk7IDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBSZXR1cm5Db2RlIHw9IEVycm9yVW5rbm93bjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zcG9ydC5DbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkVycm9yIHdoaWxlIGNsb3NpbmcgdHJhbnNwb3J0Iik7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGRvbmUgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaW50ZXJuYWwgc3RhdGljIHZvaWQgUHJpbnRPcHRpb25zSGVscCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJDbGllbnQgb3B0aW9uczoiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgIC11IDxVUkw+Iik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtdCA8IyBvZiB0aHJlYWRzIHRvIHJ1bj4gICAgICAgIGRlZmF1bHQgPSAxIik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtbiA8IyBvZiBpdGVyYXRpb25zPiAgICAgICAgICAgIHBlciB0aHJlYWQiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgIC0tcGlwZT08cGlwZSBuYW1lPiIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgLS1ob3N0PTxJUCBhZGRyZXNzPiIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgLS1wb3J0PTxwb3J0IG51bWJlcj4iKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgIC0tdHJhbnNwb3J0PTx0cmFuc3BvcnQgbmFtZT4gICAgb25lIG9mIGJ1ZmZlcmVkLGZyYW1lZCAgKGRlZmF1bHRzIHRvIG5vbmUpIik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtLXByb3RvY29sPTxwcm90b2NvbCBuYW1lPiAgICAgIG9uZSBvZiBjb21wYWN0LGpzb24gIChkZWZhdWx0cyB0byBiaW5hcnkpIik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtLXNzbCIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IEV4ZWN1dGUoTGlzdDxzdHJpbmc+IGFyZ3MpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBwYXJhbSA9IG5ldyBUZXN0UGFyYW1zKCk7CisKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHBhcmFtLlBhcnNlKGFyZ3MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJFcnJvciB3aGlsZSAgcGFyc2luZyBhcmd1bWVudHMiKTsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVycm9yVW5rbm93bjsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2YXIgdGVzdHMgPSBFbnVtZXJhYmxlLlJhbmdlKDAsIHBhcmFtLm51bVRocmVhZHMpLlNlbGVjdChfID0+IG5ldyBDbGllbnRUZXN0KHBhcmFtKSkuVG9BcnJheSgpOworCisgICAgICAgICAgICAgICAgLy9pc3N1ZSB0ZXN0cyBvbiBzZXBhcmF0ZSB0aHJlYWRzIHNpbXVsdGFuZW91c2x5CisgICAgICAgICAgICAgICAgdmFyIHRocmVhZHMgPSB0ZXN0cy5TZWxlY3QodGVzdCA9PiBuZXcgVGFzayh0ZXN0LkV4ZWN1dGUpKS5Ub0FycmF5KCk7CisgICAgICAgICAgICAgICAgdmFyIHN0YXJ0ID0gRGF0ZVRpbWUuTm93OworICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciB0IGluIHRocmVhZHMpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0LlN0YXJ0KCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgVGFzay5XYWl0QWxsKHRocmVhZHMpOworCisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlRvdGFsIHRpbWU6ICIgKyAoRGF0ZVRpbWUuTm93IC0gc3RhcnQpKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgpOworICAgICAgICAgICAgICAgIHJldHVybiB0ZXN0cy5TZWxlY3QodCA9PiB0LlJldHVybkNvZGUpLkFnZ3JlZ2F0ZSgocjEsIHIyKSA9PiByMSB8IHIyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gb3V0ZXJFeCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVW5leHBlY3RlZCBlcnJvciIpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKG91dGVyRXguTWVzc2FnZSArICIgU1Q6ICIgKyBvdXRlckV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgICAgIHJldHVybiBFcnJvclVua25vd247CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIHN0cmluZyBCeXRlc1RvSGV4KGJ5dGVbXSBkYXRhKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gQml0Q29udmVydGVyLlRvU3RyaW5nKGRhdGEpLlJlcGxhY2UoIi0iLCBzdHJpbmcuRW1wdHkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBieXRlW10gUHJlcGFyZVRlc3REYXRhKGJvb2wgcmFuZG9tRGlzdCkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHJldHZhbCA9IG5ldyBieXRlWzB4MTAwXTsKKyAgICAgICAgICAgIHZhciBpbml0TGVuID0gTWF0aC5NaW4oMHgxMDAsIHJldHZhbC5MZW5ndGgpOworCisgICAgICAgICAgICAvLyBsaW5lYXIgZGlzdHJpYnV0aW9uLCB1bmxlc3MgcmFuZG9tIGlzIHJlcXVlc3RlZAorICAgICAgICAgICAgaWYgKCFyYW5kb21EaXN0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgaW5pdExlbjsgKytpKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dmFsW2ldID0gKGJ5dGUpaTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldHZhbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcmFuZG9tIGRpc3RyaWJ1dGlvbgorICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBpbml0TGVuOyArK2kpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgcmV0dmFsW2ldID0gKGJ5dGUpMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZhciBybmQgPSBuZXcgUmFuZG9tKCk7CisgICAgICAgICAgICBmb3IgKHZhciBpID0gMTsgaSA8IGluaXRMZW47ICsraSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciBuZXh0UG9zID0gcm5kLk5leHQoKSAlIGluaXRMZW47CisgICAgICAgICAgICAgICAgICAgIGlmIChyZXR2YWxbbmV4dFBvc10gPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dmFsW25leHRQb3NdID0gKGJ5dGUpaTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHJldHZhbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBzdGF0aWMgYXN5bmMgVGFzazxpbnQ+IEV4ZWN1dGVDbGllbnRUZXN0QXN5bmMoVGhyaWZ0VGVzdC5DbGllbnQgY2xpZW50KQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdG9rZW4gPSBDYW5jZWxsYXRpb25Ub2tlbi5Ob25lOworICAgICAgICAgICAgdmFyIHJldHVybkNvZGUgPSAwOworCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0Vm9pZCgpIik7CisgICAgICAgICAgICBhd2FpdCBjbGllbnQudGVzdFZvaWRBc3luYyh0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gdm9pZCIpOworCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0U3RyaW5nKFwiVGVzdFwiKSIpOworICAgICAgICAgICAgdmFyIHMgPSBhd2FpdCBjbGllbnQudGVzdFN0cmluZ0FzeW5jKCJUZXN0IiwgdG9rZW4pOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9IFwiIiArIHMgKyAiXCIiKTsKKyAgICAgICAgICAgIGlmICgiVGVzdCIgIT0gcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0Qm9vbCh0cnVlKSIpOworICAgICAgICAgICAgdmFyIHQgPSBhd2FpdCBjbGllbnQudGVzdEJvb2xBc3luYygoYm9vbCl0cnVlLCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIHQpOworICAgICAgICAgICAgaWYgKCF0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0Qm9vbChmYWxzZSkiKTsKKyAgICAgICAgICAgIHZhciBmID0gYXdhaXQgY2xpZW50LnRlc3RCb29sQXN5bmMoKGJvb2wpZmFsc2UsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgZik7CisgICAgICAgICAgICBpZiAoZikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0Qnl0ZSgxKSIpOworICAgICAgICAgICAgdmFyIGk4ID0gYXdhaXQgY2xpZW50LnRlc3RCeXRlQXN5bmMoKHNieXRlKTEsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgaTgpOworICAgICAgICAgICAgaWYgKDEgIT0gaTgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEkzMigtMSkiKTsKKyAgICAgICAgICAgIHZhciBpMzIgPSBhd2FpdCBjbGllbnQudGVzdEkzMkFzeW5jKC0xLCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIGkzMik7CisgICAgICAgICAgICBpZiAoLTEgIT0gaTMyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RJNjQoLTM0MzU5NzM4MzY4KSIpOworICAgICAgICAgICAgdmFyIGk2NCA9IGF3YWl0IGNsaWVudC50ZXN0STY0QXN5bmMoLTM0MzU5NzM4MzY4LCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIGk2NCk7CisgICAgICAgICAgICBpZiAoLTM0MzU5NzM4MzY4ICE9IGk2NCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQmFzZVR5cGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBUT0RPOiBWYWxpZGF0ZSByZWNlaXZlZCBtZXNzYWdlCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0RG91YmxlKDUuMzI1MDk4MjM1KSIpOworICAgICAgICAgICAgdmFyIGR1YiA9IGF3YWl0IGNsaWVudC50ZXN0RG91YmxlQXN5bmMoNS4zMjUwOTgyMzUsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgZHViKTsKKyAgICAgICAgICAgIGlmICg1LjMyNTA5ODIzNSAhPSBkdWIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3REb3VibGUoLTAuMDAwMzQxMDEyNDM5NjM4NTk4Mjc5KSIpOworICAgICAgICAgICAgZHViID0gYXdhaXQgY2xpZW50LnRlc3REb3VibGVBc3luYygtMC4wMDAzNDEwMTI0Mzk2Mzg1OTgyNzksIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgZHViKTsKKyAgICAgICAgICAgIGlmICgtMC4wMDAzNDEwMTI0Mzk2Mzg1OTgyNzkgIT0gZHViKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBiaW5PdXQgPSBQcmVwYXJlVGVzdERhdGEodHJ1ZSk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0QmluYXJ5KCIgKyBCeXRlc1RvSGV4KGJpbk91dCkgKyAiKSIpOworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGJpbkluID0gYXdhaXQgY2xpZW50LnRlc3RCaW5hcnlBc3luYyhiaW5PdXQsIHRva2VuKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIEJ5dGVzVG9IZXgoYmluSW4pKTsKKyAgICAgICAgICAgICAgICBpZiAoYmluSW4uTGVuZ3RoICE9IGJpbk91dC5MZW5ndGgpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckJhc2VUeXBlczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZm9yICh2YXIgb2ZzID0gMDsgb2ZzIDwgTWF0aC5NaW4oYmluSW4uTGVuZ3RoLCBiaW5PdXQuTGVuZ3RoKTsgKytvZnMpCisgICAgICAgICAgICAgICAgICAgIGlmIChiaW5JbltvZnNdICE9IGJpbk91dFtvZnNdKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChUaHJpZnQuVEFwcGxpY2F0aW9uRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gYmluYXJ5IGVxdWFscz8gb25seSB3aXRoIGhhc2hjb2RlIG9wdGlvbiBlbmFibGVkIC4uLgorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlRlc3QgQ3JhenlOZXN0aW5nIik7CisgICAgICAgICAgICB2YXIgb25lID0gbmV3IENyYXp5TmVzdGluZygpOworICAgICAgICAgICAgdmFyIHR3byA9IG5ldyBDcmF6eU5lc3RpbmcoKTsKKyAgICAgICAgICAgIG9uZS5TdHJpbmdfZmllbGQgPSAiY3JhenkiOworICAgICAgICAgICAgdHdvLlN0cmluZ19maWVsZCA9ICJjcmF6eSI7CisgICAgICAgICAgICBvbmUuQmluYXJ5X2ZpZWxkID0gbmV3IGJ5dGVbXSB7IDB4MDAsIDB4MDEsIDB4MDIsIDB4MDQsIDB4MDgsIDB4MTAsIDB4MjAsIDB4NDAsIDB4ODAsIDB4RkYgfTsKKyAgICAgICAgICAgIHR3by5CaW5hcnlfZmllbGQgPSBuZXcgYnl0ZVsxMF0geyAweDAwLCAweDAxLCAweDAyLCAweDA0LCAweDA4LCAweDEwLCAweDIwLCAweDQwLCAweDgwLCAweEZGIH07CisgICAgICAgICAgICBpZiAodHlwZW9mKENyYXp5TmVzdGluZykuR2V0TWV0aG9kKCJFcXVhbHMiKT8uRGVjbGFyaW5nVHlwZSA9PSB0eXBlb2YoQ3JhenlOZXN0aW5nKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoIW9uZS5FcXVhbHModHdvKSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yQ29udGFpbmVyczsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbigiQ3JhenlOZXN0aW5nLkVxdWFscyBmYWlsZWQiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RTdHJ1Y3Qoe1wiWmVyb1wiLCAxLCAtMywgLTV9KSIpOworICAgICAgICAgICAgdmFyIG8gPSBuZXcgWHRydWN0KCk7CisgICAgICAgICAgICBvLlN0cmluZ190aGluZyA9ICJaZXJvIjsKKyAgICAgICAgICAgIG8uQnl0ZV90aGluZyA9IChzYnl0ZSkxOworICAgICAgICAgICAgby5JMzJfdGhpbmcgPSAtMzsKKyAgICAgICAgICAgIG8uSTY0X3RoaW5nID0gLTU7CisgICAgICAgICAgICB2YXIgaSA9IGF3YWl0IGNsaWVudC50ZXN0U3RydWN0QXN5bmMobywgdG9rZW4pOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9IHtcIiIgKyBpLlN0cmluZ190aGluZyArICJcIiwgIiArIGkuQnl0ZV90aGluZyArICIsICIgKyBpLkkzMl90aGluZyArICIsICIgKyBpLkk2NF90aGluZyArICJ9Iik7CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3ROZXN0KHsxLCB7XCJaZXJvXCIsIDEsIC0zLCAtNX0sIDV9KSIpOworICAgICAgICAgICAgdmFyIG8yID0gbmV3IFh0cnVjdDIoKTsKKyAgICAgICAgICAgIG8yLkJ5dGVfdGhpbmcgPSAoc2J5dGUpMTsKKyAgICAgICAgICAgIG8yLlN0cnVjdF90aGluZyA9IG87CisgICAgICAgICAgICBvMi5JMzJfdGhpbmcgPSA1OworICAgICAgICAgICAgdmFyIGkyID0gYXdhaXQgY2xpZW50LnRlc3ROZXN0QXN5bmMobzIsIHRva2VuKTsKKyAgICAgICAgICAgIGkgPSBpMi5TdHJ1Y3RfdGhpbmc7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0geyIgKyBpMi5CeXRlX3RoaW5nICsgIiwge1wiIiArIGkuU3RyaW5nX3RoaW5nICsgIlwiLCAiICsgaS5CeXRlX3RoaW5nICsgIiwgIiArIGkuSTMyX3RoaW5nICsgIiwgIiArIGkuSTY0X3RoaW5nICsgIn0sICIgKyBpMi5JMzJfdGhpbmcgKyAifSIpOworCisgICAgICAgICAgICB2YXIgbWFwb3V0ID0gbmV3IERpY3Rpb25hcnk8aW50LCBpbnQ+KCk7CisgICAgICAgICAgICBmb3IgKHZhciBqID0gMDsgaiA8IDU7IGorKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBtYXBvdXRbal0gPSBqIC0gMTA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0TWFwKHsiKTsKKyAgICAgICAgICAgIHZhciBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICBmb3JlYWNoICh2YXIga2V5IGluIG1hcG91dC5LZXlzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiwgIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoa2V5ICsgIiA9PiAiICsgbWFwb3V0W2tleV0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSkiKTsKKworICAgICAgICAgICAgdmFyIG1hcGluID0gYXdhaXQgY2xpZW50LnRlc3RNYXBBc3luYyhtYXBvdXQsIHRva2VuKTsKKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiID0geyIpOworICAgICAgICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgZm9yZWFjaCAodmFyIGtleSBpbiBtYXBpbi5LZXlzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiwgIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoa2V5ICsgIiA9PiAiICsgbWFwaW5ba2V5XSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgifSIpOworCisgICAgICAgICAgICAvLyBUT0RPOiBWYWxpZGF0ZSByZWNlaXZlZCBtZXNzYWdlCisgICAgICAgICAgICB2YXIgbGlzdG91dCA9IG5ldyBMaXN0PGludD4oKTsKKyAgICAgICAgICAgIGZvciAodmFyIGogPSAtMjsgaiA8IDM7IGorKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsaXN0b3V0LkFkZChqKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RMaXN0KHsiKTsKKyAgICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciBqIGluIGxpc3RvdXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiLCAiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShqKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIn0pIik7CisKKyAgICAgICAgICAgIHZhciBsaXN0aW4gPSBhd2FpdCBjbGllbnQudGVzdExpc3RBc3luYyhsaXN0b3V0LCB0b2tlbik7CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiA9IHsiKTsKKyAgICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciBqIGluIGxpc3RpbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKGopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIn0iKTsKKworICAgICAgICAgICAgLy9zZXQKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIHZhciBzZXRvdXQgPSBuZXcgVEhhc2hTZXQ8aW50PigpOworICAgICAgICAgICAgZm9yICh2YXIgaiA9IC0yOyBqIDwgMzsgaisrKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNldG91dC5BZGQoaik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0U2V0KHsiKTsKKyAgICAgICAgICAgIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvcmVhY2ggKGludCBqIGluIHNldG91dCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKGopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSkiKTsKKworICAgICAgICAgICAgdmFyIHNldGluID0gYXdhaXQgY2xpZW50LnRlc3RTZXRBc3luYyhzZXRvdXQsIHRva2VuKTsKKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiID0geyIpOworICAgICAgICAgICAgZmlyc3QgPSB0cnVlOworICAgICAgICAgICAgZm9yZWFjaCAoaW50IGogaW4gc2V0aW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiLCAiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShqKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ9Iik7CisKKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEVudW0oT05FKSIpOworICAgICAgICAgICAgdmFyIHJldCA9IGF3YWl0IGNsaWVudC50ZXN0RW51bUFzeW5jKE51bWJlcnouT05FLCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIHJldCk7CisgICAgICAgICAgICBpZiAoTnVtYmVyei5PTkUgIT0gcmV0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JTdHJ1Y3RzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0RW51bShUV08pIik7CisgICAgICAgICAgICByZXQgPSBhd2FpdCBjbGllbnQudGVzdEVudW1Bc3luYyhOdW1iZXJ6LlRXTywgdG9rZW4pOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiA9ICIgKyByZXQpOworICAgICAgICAgICAgaWYgKE51bWJlcnouVFdPICE9IHJldCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yU3RydWN0czsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdEVudW0oVEhSRUUpIik7CisgICAgICAgICAgICByZXQgPSBhd2FpdCBjbGllbnQudGVzdEVudW1Bc3luYyhOdW1iZXJ6LlRIUkVFLCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gIiArIHJldCk7CisgICAgICAgICAgICBpZiAoTnVtYmVyei5USFJFRSAhPSByZXQpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvclN0cnVjdHM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RFbnVtKEZJVkUpIik7CisgICAgICAgICAgICByZXQgPSBhd2FpdCBjbGllbnQudGVzdEVudW1Bc3luYyhOdW1iZXJ6LkZJVkUsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgcmV0KTsKKyAgICAgICAgICAgIGlmIChOdW1iZXJ6LkZJVkUgIT0gcmV0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JTdHJ1Y3RzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ0ZXN0RW51bShFSUdIVCkiKTsKKyAgICAgICAgICAgIHJldCA9IGF3YWl0IGNsaWVudC50ZXN0RW51bUFzeW5jKE51bWJlcnouRUlHSFQsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgcmV0KTsKKyAgICAgICAgICAgIGlmIChOdW1iZXJ6LkVJR0hUICE9IHJldCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yU3RydWN0czsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdFR5cGVkZWYoMzA5ODU4MjM1MDgyNTIzKSIpOworICAgICAgICAgICAgdmFyIHVpZCA9IGF3YWl0IGNsaWVudC50ZXN0VHlwZWRlZkFzeW5jKDMwOTg1ODIzNTA4MjUyM0wsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgPSAiICsgdWlkKTsKKyAgICAgICAgICAgIGlmICgzMDk4NTgyMzUwODI1MjNMICE9IHVpZCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yU3RydWN0czsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gVE9ETzogVmFsaWRhdGUgcmVjZWl2ZWQgbWVzc2FnZQorICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgidGVzdE1hcE1hcCgxKSIpOworICAgICAgICAgICAgdmFyIG1tID0gYXdhaXQgY2xpZW50LnRlc3RNYXBNYXBBc3luYygxLCB0b2tlbik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlKCIgPSB7Iik7CisgICAgICAgICAgICBmb3JlYWNoICh2YXIga2V5IGluIG1tLktleXMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrZXkgKyAiID0+IHsiKTsKKyAgICAgICAgICAgICAgICB2YXIgbTIgPSBtbVtrZXldOworICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBrMiBpbiBtMi5LZXlzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrMiArICIgPT4gIiArIG0yW2syXSArICIsICIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ9LCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ9Iik7CisKKyAgICAgICAgICAgIC8vIFRPRE86IFZhbGlkYXRlIHJlY2VpdmVkIG1lc3NhZ2UKKyAgICAgICAgICAgIHZhciBpbnNhbmUgPSBuZXcgSW5zYW5pdHkoKTsKKyAgICAgICAgICAgIGluc2FuZS5Vc2VyTWFwID0gbmV3IERpY3Rpb25hcnk8TnVtYmVyeiwgbG9uZz4oKTsKKyAgICAgICAgICAgIGluc2FuZS5Vc2VyTWFwW051bWJlcnouRklWRV0gPSA1MDAwTDsKKyAgICAgICAgICAgIHZhciB0cnVjayA9IG5ldyBYdHJ1Y3QoKTsKKyAgICAgICAgICAgIHRydWNrLlN0cmluZ190aGluZyA9ICJUcnVjayI7CisgICAgICAgICAgICB0cnVjay5CeXRlX3RoaW5nID0gKHNieXRlKTg7CisgICAgICAgICAgICB0cnVjay5JMzJfdGhpbmcgPSA4OworICAgICAgICAgICAgdHJ1Y2suSTY0X3RoaW5nID0gODsKKyAgICAgICAgICAgIGluc2FuZS5YdHJ1Y3RzID0gbmV3IExpc3Q8WHRydWN0PigpOworICAgICAgICAgICAgaW5zYW5lLlh0cnVjdHMuQWRkKHRydWNrKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoInRlc3RJbnNhbml0eSgpIik7CisgICAgICAgICAgICB2YXIgd2hvYSA9IGF3YWl0IGNsaWVudC50ZXN0SW5zYW5pdHlBc3luYyhpbnNhbmUsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiA9IHsiKTsKKyAgICAgICAgICAgIGZvcmVhY2ggKHZhciBrZXkgaW4gd2hvYS5LZXlzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciB2YWwgPSB3aG9hW2tleV07CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrZXkgKyAiID0+IHsiKTsKKworICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciBrMiBpbiB2YWwuS2V5cykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHZhciB2MiA9IHZhbFtrMl07CisKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZShrMiArICIgPT4geyIpOworICAgICAgICAgICAgICAgICAgICB2YXIgdXNlck1hcCA9IHYyLlVzZXJNYXA7CisKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgieyIpOworICAgICAgICAgICAgICAgICAgICBpZiAodXNlck1hcCAhPSBudWxsKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIgazMgaW4gdXNlck1hcC5LZXlzKQorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoazMgKyAiID0+ICIgKyB1c2VyTWFwW2szXSArICIsICIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgibnVsbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIn0sICIpOworCisgICAgICAgICAgICAgICAgICAgIHZhciB4dHJ1Y3RzID0gdjIuWHRydWN0czsKKworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ7Iik7CisgICAgICAgICAgICAgICAgICAgIGlmICh4dHJ1Y3RzICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKHZhciB4IGluIHh0cnVjdHMpCisgICAgICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgie1wiIiArIHguU3RyaW5nX3RoaW5nICsgIlwiLCAiICsgeC5CeXRlX3RoaW5nICsgIiwgIiArIHguSTMyX3RoaW5nICsgIiwgIiArIHguSTMyX3RoaW5nICsgIn0sICIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgibnVsbCIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIn0iKTsKKworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlKCJ9LCAiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgifSwgIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgifSIpOworCisgICAgICAgICAgICBzYnl0ZSBhcmcwID0gMTsKKyAgICAgICAgICAgIHZhciBhcmcxID0gMjsKKyAgICAgICAgICAgIHZhciBhcmcyID0gbG9uZy5NYXhWYWx1ZTsKKyAgICAgICAgICAgIHZhciBtdWx0aURpY3QgPSBuZXcgRGljdGlvbmFyeTxzaG9ydCwgc3RyaW5nPigpOworICAgICAgICAgICAgbXVsdGlEaWN0WzFdID0gIm9uZSI7CisKKyAgICAgICAgICAgIHZhciB0bXBNdWx0aURpY3QgPSBuZXcgTGlzdDxzdHJpbmc+KCk7CisgICAgICAgICAgICBmb3JlYWNoICh2YXIgcGFpciBpbiBtdWx0aURpY3QpCisgICAgICAgICAgICAgICAgdG1wTXVsdGlEaWN0LkFkZChwYWlyLktleSArIiA9PiAiKyBwYWlyLlZhbHVlKTsKKworICAgICAgICAgICAgdmFyIGFyZzQgPSBOdW1iZXJ6LkZJVkU7CisgICAgICAgICAgICBsb25nIGFyZzUgPSA1MDAwMDAwOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZSgiVGVzdCBNdWx0aSgiICsgYXJnMCArICIsIiArIGFyZzEgKyAiLCIgKyBhcmcyICsgIix7IiArIHN0cmluZy5Kb2luKCIsIiwgdG1wTXVsdGlEaWN0KSArICJ9LCIgKyBhcmc0ICsgIiwiICsgYXJnNSArICIpIik7CisgICAgICAgICAgICB2YXIgbXVsdGlSZXNwb25zZSA9IGF3YWl0IGNsaWVudC50ZXN0TXVsdGlBc3luYyhhcmcwLCBhcmcxLCBhcmcyLCBtdWx0aURpY3QsIGFyZzQsIGFyZzUsIHRva2VuKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIiA9IFh0cnVjdChieXRlX3RoaW5nOiIgKyBtdWx0aVJlc3BvbnNlLkJ5dGVfdGhpbmcgKyAiLFN0cmluZ190aGluZzoiICsgbXVsdGlSZXNwb25zZS5TdHJpbmdfdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiLGkzMl90aGluZzoiICsgbXVsdGlSZXNwb25zZS5JMzJfdGhpbmcgKyAiLGk2NF90aGluZzoiICsgbXVsdGlSZXNwb25zZS5JNjRfdGhpbmcgKyAiKVxuIik7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ0ZXN0RXhjZXB0aW9uKFwiWGNlcHRpb25cIikiKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQudGVzdEV4Y2VwdGlvbkFzeW5jKCJYY2VwdGlvbiIsIHRva2VuKTsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChYY2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoZXguRXJyb3JDb2RlICE9IDEwMDEgfHwgZXguTWVzc2FnZSAhPSAiWGNlcHRpb24iKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ0ZXN0RXhjZXB0aW9uKFwiVEV4Y2VwdGlvblwiKSIpOworICAgICAgICAgICAgICAgIGF3YWl0IGNsaWVudC50ZXN0RXhjZXB0aW9uQXN5bmMoIlRFeGNlcHRpb24iLCB0b2tlbik7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoVGhyaWZ0LlRFeGNlcHRpb24pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgLy8gT0sKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoZXguTWVzc2FnZSArICIgU1Q6ICIgKyBleC5TdGFja1RyYWNlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJ0ZXN0RXhjZXB0aW9uKFwib2tcIikiKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQudGVzdEV4Y2VwdGlvbkFzeW5jKCJvayIsIHRva2VuKTsKKyAgICAgICAgICAgICAgICAvLyBPSworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgidGVzdE11bHRpRXhjZXB0aW9uKFwiWGNlcHRpb25cIiwgLi4uKSIpOworICAgICAgICAgICAgICAgIGF3YWl0IGNsaWVudC50ZXN0TXVsdGlFeGNlcHRpb25Bc3luYygiWGNlcHRpb24iLCAiaWdub3JlIiwgdG9rZW4pOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChleC5FcnJvckNvZGUgIT0gMTAwMSB8fCBleC5NZXNzYWdlICE9ICJUaGlzIGlzIGFuIFhjZXB0aW9uIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgidGVzdE11bHRpRXhjZXB0aW9uKFwiWGNlcHRpb24yXCIsIC4uLikiKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQudGVzdE11bHRpRXhjZXB0aW9uQXN5bmMoIlhjZXB0aW9uMiIsICJpZ25vcmUiLCB0b2tlbik7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIioqKiBGQUlMRUQgKioqIik7CisgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoWGNlcHRpb24yIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChleC5FcnJvckNvZGUgIT0gMjAwMiB8fCBleC5TdHJ1Y3RfdGhpbmcuU3RyaW5nX3RoaW5nICE9ICJUaGlzIGlzIGFuIFhjZXB0aW9uMiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuQ29kZSB8PSBFcnJvckV4Y2VwdGlvbnM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiKioqIEZBSUxFRCAqKioiKTsKKyAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShleC5NZXNzYWdlICsgIiBTVDogIiArIGV4LlN0YWNrVHJhY2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInRlc3RNdWx0aUV4Y2VwdGlvbihcInN1Y2Nlc3NcIiwgXCJPS1wiKSIpOworICAgICAgICAgICAgICAgIGlmICgiT0siICE9IChhd2FpdCBjbGllbnQudGVzdE11bHRpRXhjZXB0aW9uQXN5bmMoInN1Y2Nlc3MiLCAiT0siLCB0b2tlbikpLlN0cmluZ190aGluZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICByZXR1cm5Db2RlIHw9IEVycm9yRXhjZXB0aW9uczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIGV4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JFeGNlcHRpb25zOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHZhciBzdyA9IG5ldyBTdG9wd2F0Y2goKTsKKyAgICAgICAgICAgIHN3LlN0YXJ0KCk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVGVzdCBPbmV3YXkoMSkiKTsKKyAgICAgICAgICAgIGF3YWl0IGNsaWVudC50ZXN0T25ld2F5QXN5bmMoMSwgdG9rZW4pOworICAgICAgICAgICAgc3cuU3RvcCgpOworICAgICAgICAgICAgaWYgKHN3LkVsYXBzZWRNaWxsaXNlY29uZHMgPiAxMDAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIHJldHVybkNvZGUgfD0gRXJyb3JCYXNlVHlwZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoIlRlc3QgQ2FsbHRpbWUoKSIpOworICAgICAgICAgICAgdmFyIHRpbWVzID0gNTA7CisgICAgICAgICAgICBzdy5SZXNldCgpOworICAgICAgICAgICAgc3cuU3RhcnQoKTsKKyAgICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgdGltZXM7ICsraykKKyAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQudGVzdFZvaWRBc3luYyh0b2tlbik7CisgICAgICAgICAgICBzdy5TdG9wKCk7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiID0gezB9IG1zIGEgdGVzdFZvaWQoKSBjYWxsIiwgc3cuRWxhcHNlZE1pbGxpc2Vjb25kcyAvIHRpbWVzKTsKKyAgICAgICAgICAgIHJldHVybiByZXR1cm5Db2RlOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvdGVzdC9uZXRjb3JlL01ha2VmaWxlLmFtIGIvdGVzdC9uZXRjb3JlL01ha2VmaWxlLmFtCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjM3NmZmYjcKLS0tIC9kZXYvbnV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bmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7Cit1c2luZyBUaHJpZnRUZXN0OworCituYW1lc3BhY2UgU2VydmVyCit7CisgICAgcHVibGljIGNsYXNzIFByb2dyYW0KKyAgICB7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgaW50IE1haW4oc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgQ29uc29sZS5TZXRCdWZmZXJTaXplKENvbnNvbGUuQnVmZmVyV2lkdGgsIDQwOTYpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiRmFpbGVkIHRvIGdyb3cgc2Nyb2xsLWJhY2sgYnVmZmVyIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHNwbGl0IG1vZGUgYW5kIG9wdGlvbnMKKyAgICAgICAgICAgIHZhciBzdWJBcmdzID0gbmV3IExpc3Q8c3RyaW5nPihhcmdzKTsKKyAgICAgICAgICAgIHZhciBmaXJzdEFyZyA9IHN0cmluZy5FbXB0eTsKKyAgICAgICAgICAgIGlmIChzdWJBcmdzLkNvdW50ID4gMCkKKyAgICAgICAgICAgIHsgCisgICAgICAgICAgICAgICAgZmlyc3RBcmcgPSBzdWJBcmdzWzBdOworICAgICAgICAgICAgICAgIHN1YkFyZ3MuUmVtb3ZlQXQoMCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHJ1biB3aGF0ZXZlciBtb2RlIGlzIGNob29zZW4KKyAgICAgICAgICAgIHN3aXRjaChmaXJzdEFyZykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBjYXNlICJzZXJ2ZXIiOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGVzdFNlcnZlci5FeGVjdXRlKHN1YkFyZ3MpOworICAgICAgICAgICAgICAgIGNhc2UgIi0taGVscCI6CisgICAgICAgICAgICAgICAgICAgIFByaW50SGVscCgpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBQcmludEhlbHAoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBQcmludEhlbHAoKQorICAgICAgICB7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiVXNhZ2U6Iik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICBTZXJ2ZXIgIHNlcnZlciAgW29wdGlvbnNdJyIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgU2VydmVyICAtLWhlbHAiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIiKTsKKworICAgICAgICAgICAgVGVzdFNlcnZlci5QcmludE9wdGlvbnNIZWxwKCk7CisgICAgICAgIH0KKyAgICB9Cit9CisKKwpkaWZmIC0tZ2l0IGEvdGVzdC9uZXRjb3JlL1NlcnZlci9Qcm9wZXJ0aWVzL0Fzc2VtYmx5SW5mby5jcyBiL3Rlc3QvbmV0Y29yZS9TZXJ2ZXIvUHJvcGVydGllcy9Bc3NlbWJseUluZm8uY3MKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMjY1NDk1YwotLS0gL2Rldi9udWxsCisrKyBiL3Rlc3QvbmV0Y29yZS9TZXJ2ZXIvUHJvcGVydGllcy9Bc3NlbWJseUluZm8uY3MKQEAgLTAsMCArMSw0MyBAQAor77u/Ly8gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uKEFTRikgdW5kZXIgb25lCisvLyBvciBtb3JlIGNvbnRy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29ja2V0cyA9IGZhbHNlOworICAgICAgICBpbnRlcm5hbCBib29sIHVzZUZyYW1lZCA9IGZhbHNlOworICAgICAgICBpbnRlcm5hbCBib29sIHVzZUVuY3J5cHRpb24gPSBmYWxzZTsKKyAgICAgICAgaW50ZXJuYWwgYm9vbCBjb21wYWN0ID0gZmFsc2U7CisgICAgICAgIGludGVybmFsIGJvb2wganNvbiA9IGZhbHNlOworICAgICAgICBpbnRlcm5hbCBpbnQgcG9ydCA9IDkwOTA7CisgICAgICAgIGludGVybmFsIHN0cmluZyBwaXBlID0gbnVsbDsKKworICAgICAgICBpbnRlcm5hbCB2b2lkIFBhcnNlKExpc3Q8c3RyaW5nPiBhcmdzKQorICAgICAgICB7CisgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyZ3MuQ291bnQ7IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZiAoYXJnc1tpXS5TdGFydHNXaXRoKCItLXBpcGU9IikpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwaXBlID0gYXJnc1tpXS5TdWJzdHJpbmcoYXJnc1tpXS5JbmRleE9mKCI9IikgKyAxKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXS5TdGFydHNXaXRoKCItLXBvcnQ9IikpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwb3J0ID0gaW50LlBhcnNlKGFyZ3NbaV0uU3Vic3RyaW5nKGFyZ3NbaV0uSW5kZXhPZigiPSIpICsgMSkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItYiIgfHwgYXJnc1tpXSA9PSAiLS1idWZmZXJlZCIgfHwgYXJnc1tpXSA9PSAiLS10cmFuc3BvcnQ9YnVmZmVyZWQiKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdXNlQnVmZmVyZWRTb2NrZXRzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLWYiIHx8IGFyZ3NbaV0gPT0gIi0tZnJhbWVkIiB8fCBhcmdzW2ldID09ICItLXRyYW5zcG9ydD1mcmFtZWQiKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdXNlRnJhbWVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLS1iaW5hcnkiIHx8IGFyZ3NbaV0gPT0gIi0tcHJvdG9jb2w9YmluYXJ5IikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIC8vIG5vdGhpbmcgbmVlZGVkCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tY29tcGFjdCIgfHwgYXJnc1tpXSA9PSAiLS1wcm90b2NvbD1jb21wYWN0IikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGNvbXBhY3QgPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIGlmIChhcmdzW2ldID09ICItLWpzb24iIHx8IGFyZ3NbaV0gPT0gIi0tcHJvdG9jb2w9anNvbiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBqc29uID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLS10aHJlYWRlZCIgfHwgYXJnc1tpXSA9PSAiLS1zZXJ2ZXItdHlwZT10aHJlYWRlZCIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTm90SW1wbGVtZW50ZWRFeGNlcHRpb24oYXJnc1tpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tdGhyZWFkcG9vbCIgfHwgYXJnc1tpXSA9PSAiLS1zZXJ2ZXItdHlwZT10aHJlYWRwb29sIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBOb3RJbXBsZW1lbnRlZEV4Y2VwdGlvbihhcmdzW2ldKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJnc1tpXSA9PSAiLS1wcm90b3R5cGUiIHx8IGFyZ3NbaV0gPT0gIi0tcHJvY2Vzc29yPXByb3RvdHlwZSIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTm90SW1wbGVtZW50ZWRFeGNlcHRpb24oYXJnc1tpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3NbaV0gPT0gIi0tc3NsIikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHVzZUVuY3J5cHRpb24gPSB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvL3Rocm93IG5ldyBBcmd1bWVudEV4Y2VwdGlvbihhcmdzW2ldKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBjbGFzcyBUZXN0U2VydmVyCisgICAgeworICAgICAgICBwdWJsaWMgc3RhdGljIGludCBfY2xpZW50SUQgPSAtMTsKKyAgICAgICAgcHVibGljIGRlbGVnYXRlIHZvaWQgVGVzdExvZ0RlbGVnYXRlKHN0cmluZyBtc2csIHBhcmFtcyBvYmplY3RbXSB2YWx1ZXMpOworCisgICAgICAgIHB1YmxpYyBjbGFzcyBNeVNlcnZlckV2ZW50SGFuZGxlciA6IFRTZXJ2ZXJFdmVudEhhbmRsZXIKKyAgICAgICAgeworICAgICAgICAgICAgcHVibGljIGludCBjYWxsQ291bnQgPSAwOworCisgICAgICAgICAgICBwdWJsaWMgVGFzayBQcmVTZXJ2ZUFzeW5jKENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhbGxDb3VudCsrOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkNvbXBsZXRlZFRhc2s7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPG9iamVjdD4gQ3JlYXRlQ29udGV4dEFzeW5jKFRQcm90b2NvbCBpbnB1dCwgVFByb3RvY29sIG91dHB1dCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2FsbENvdW50Kys7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdDxvYmplY3Q+KG51bGwpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzayBEZWxldGVDb250ZXh0QXN5bmMob2JqZWN0IHNlcnZlckNvbnRleHQsIFRQcm90b2NvbCBpbnB1dCwgVFByb3RvY29sIG91dHB1dCwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgY2FsbENvdW50Kys7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suQ29tcGxldGVkVGFzazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2sgUHJvY2Vzc0NvbnRleHRBc3luYyhvYmplY3Qgc2VydmVyQ29udGV4dCwgVENsaWVudFRyYW5zcG9ydCB0cmFuc3BvcnQsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhbGxDb3VudCsrOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkNvbXBsZXRlZFRhc2s7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgY2xhc3MgVGVzdEhhbmRsZXJBc3luYyA6IFRocmlmdFRlc3QuSUFzeW5jCisgICAgICAgIHsKKyAgICAgICAgICAgIHB1YmxpYyBUQmFzZVNlcnZlciBzZXJ2ZXIgeyBnZXQ7IHNldDsgfQorICAgICAgICAgICAgcHJpdmF0ZSBpbnQgaGFuZGxlcklEOworICAgICAgICAgICAgcHJpdmF0ZSBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgICAgIHByaXZhdGUgVGVzdExvZ0RlbGVnYXRlIGxvZ2dlcjsKKworICAgICAgICAgICAgcHVibGljIFRlc3RIYW5kbGVyQXN5bmMoKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGhhbmRsZXJJRCA9IEludGVybG9ja2VkLkluY3JlbWVudChyZWYgX2NsaWVudElEKTsKKyAgICAgICAgICAgICAgICBsb2dnZXIgKz0gdGVzdENvbnNvbGVMb2dnZXI7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgiTmV3IFRlc3RIYW5kbGVyIGluc3RhbmNlIGNyZWF0ZWQiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHZvaWQgdGVzdENvbnNvbGVMb2dnZXIoc3RyaW5nIG1zZywgcGFyYW1zIG9iamVjdFtdIHZhbHVlcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzYi5DbGVhcigpOworICAgICAgICAgICAgICAgIHNiLkFwcGVuZEZvcm1hdCgiaGFuZGxlcnswOkQzfToiLCBoYW5kbGVySUQpOworICAgICAgICAgICAgICAgIHNiLkFwcGVuZEZvcm1hdChtc2csIHZhbHVlcyk7CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kTGluZSgpOworICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGUoc2IuVG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrIHRlc3RWb2lkQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdFZvaWQoKSIpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkNvbXBsZXRlZFRhc2s7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPHN0cmluZz4gdGVzdFN0cmluZ0FzeW5jKHN0cmluZyB0aGluZywgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdFN0cmluZyh7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQodGhpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxib29sPiB0ZXN0Qm9vbEFzeW5jKGJvb2wgdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RCb29sKHswfSkiLCB0aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdCh0aGluZyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPHNieXRlPiB0ZXN0Qnl0ZUFzeW5jKHNieXRlIHRoaW5nLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKCJ0ZXN0Qnl0ZSh7MH0pIiwgdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQodGhpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxpbnQ+IHRlc3RJMzJBc3luYyhpbnQgdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RJMzIoezB9KSIsIHRoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KHRoaW5nKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2s8bG9uZz4gdGVzdEk2NEFzeW5jKGxvbmcgdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RJNjQoezB9KSIsIHRoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KHRoaW5nKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2s8ZG91YmxlPiB0ZXN0RG91YmxlQXN5bmMoZG91YmxlIHRoaW5nLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKCJ0ZXN0RG91YmxlKHswfSkiLCB0aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdCh0aGluZyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPGJ5dGVbXT4gdGVzdEJpbmFyeUFzeW5jKGJ5dGVbXSB0aGluZywgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGhleCA9IEJpdENvbnZlcnRlci5Ub1N0cmluZyh0aGluZykuUmVwbGFjZSgiLSIsIHN0cmluZy5FbXB0eSk7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdEJpbmFyeSh7MDpYfSkiLCBoZXgpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQodGhpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxYdHJ1Y3Q+IHRlc3RTdHJ1Y3RBc3luYyhYdHJ1Y3QgdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RTdHJ1Y3Qoe3tcInswfVwiLCB7MX0sIHsyfSwgezN9fX0pIiwgdGhpbmcuU3RyaW5nX3RoaW5nLCB0aGluZy5CeXRlX3RoaW5nLCB0aGluZy5JMzJfdGhpbmcsIHRoaW5nLkk2NF90aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdCh0aGluZyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPFh0cnVjdDI+IHRlc3ROZXN0QXN5bmMoWHRydWN0MiBuZXN0LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdGhpbmcgPSBuZXN0LlN0cnVjdF90aGluZzsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKCJ0ZXN0TmVzdCh7e3swfSwge3tcInsxfVwiLCB7Mn0sIHszfSwgezR9LCB7NX19fX19KSIsCisgICAgICAgICAgICAgICAgICAgIG5lc3QuQnl0ZV90aGluZywKKyAgICAgICAgICAgICAgICAgICAgdGhpbmcuU3RyaW5nX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICB0aGluZy5CeXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICB0aGluZy5JMzJfdGhpbmcsCisgICAgICAgICAgICAgICAgICAgIHRoaW5nLkk2NF90aGluZywKKyAgICAgICAgICAgICAgICAgICAgbmVzdC5JMzJfdGhpbmcpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQobmVzdCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPERpY3Rpb25hcnk8aW50LCBpbnQ+PiB0ZXN0TWFwQXN5bmMoRGljdGlvbmFyeTxpbnQsIGludD4gdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNiLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCJ0ZXN0TWFwKHt7Iik7CisgICAgICAgICAgICAgICAgdmFyIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIga2V5IGluIHRoaW5nLktleXMpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzYi5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2IuQXBwZW5kRm9ybWF0KCJ7MH0gPT4gezF9Iiwga2V5LCB0aGluZ1trZXldKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCJ9fSkiKTsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKHNiLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQodGhpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxEaWN0aW9uYXJ5PHN0cmluZywgc3RyaW5nPj4gdGVzdFN0cmluZ01hcEFzeW5jKERpY3Rpb25hcnk8c3RyaW5nLCBzdHJpbmc+IHRoaW5nLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzYi5DbGVhcigpOworICAgICAgICAgICAgICAgIHNiLkFwcGVuZCgidGVzdFN0cmluZ01hcCh7eyIpOworICAgICAgICAgICAgICAgIHZhciBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICAgICAgZm9yZWFjaCAodmFyIGtleSBpbiB0aGluZy5LZXlzKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0KQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCIsICIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHNiLkFwcGVuZEZvcm1hdCgiezB9ID0+IHsxfSIsIGtleSwgdGhpbmdba2V5XSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNiLkFwcGVuZCgifX0pIik7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZShzYi5Ub1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KHRoaW5nKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2s8VEhhc2hTZXQ8aW50Pj4gdGVzdFNldEFzeW5jKFRIYXNoU2V0PGludD4gdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNiLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCJ0ZXN0U2V0KHt7Iik7CisgICAgICAgICAgICAgICAgdmFyIGZpcnN0ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBmb3JlYWNoIChpbnQgZWxlbSBpbiB0aGluZykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNiLkFwcGVuZCgiLCAiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzYi5BcHBlbmRGb3JtYXQoInswfSIsIGVsZW0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzYi5BcHBlbmQoIn19KSIpOworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2Uoc2IuVG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdCh0aGluZyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPExpc3Q8aW50Pj4gdGVzdExpc3RBc3luYyhMaXN0PGludD4gdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHNiLkNsZWFyKCk7CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCJ0ZXN0TGlzdCh7eyIpOworICAgICAgICAgICAgICAgIHZhciBmaXJzdCA9IHRydWU7CisgICAgICAgICAgICAgICAgZm9yZWFjaCAodmFyIGVsZW0gaW4gdGhpbmcpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoZmlyc3QpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBzYi5BcHBlbmQoIiwgIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2IuQXBwZW5kRm9ybWF0KCJ7MH0iLCBlbGVtKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc2IuQXBwZW5kKCJ9fSkiKTsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKHNiLlRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQodGhpbmcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxOdW1iZXJ6PiB0ZXN0RW51bUFzeW5jKE51bWJlcnogdGhpbmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RFbnVtKHswfSkiLCB0aGluZyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdCh0aGluZyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBUYXNrPGxvbmc+IHRlc3RUeXBlZGVmQXN5bmMobG9uZyB0aGluZywgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdFR5cGVkZWYoezB9KSIsIHRoaW5nKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KHRoaW5nKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2s8RGljdGlvbmFyeTxpbnQsIERpY3Rpb25hcnk8aW50LCBpbnQ+Pj4gdGVzdE1hcE1hcEFzeW5jKGludCBoZWxsbywgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdE1hcE1hcCh7MH0pIiwgaGVsbG8pOworICAgICAgICAgICAgICAgIHZhciBtYXBtYXAgPSBuZXcgRGljdGlvbmFyeTxpbnQsIERpY3Rpb25hcnk8aW50LCBpbnQ+PigpOworCisgICAgICAgICAgICAgICAgdmFyIHBvcyA9IG5ldyBEaWN0aW9uYXJ5PGludCwgaW50PigpOworICAgICAgICAgICAgICAgIHZhciBuZWcgPSBuZXcgRGljdGlvbmFyeTxpbnQsIGludD4oKTsKKyAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMTsgaSA8IDU7IGkrKykKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHBvc1tpXSA9IGk7CisgICAgICAgICAgICAgICAgICAgIG5lZ1staV0gPSAtaTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBtYXBtYXBbNF0gPSBwb3M7CisgICAgICAgICAgICAgICAgbWFwbWFwWy00XSA9IG5lZzsKKworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkZyb21SZXN1bHQobWFwbWFwKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2s8RGljdGlvbmFyeTxsb25nLCBEaWN0aW9uYXJ5PE51bWJlcnosIEluc2FuaXR5Pj4+IHRlc3RJbnNhbml0eUFzeW5jKEluc2FuaXR5IGFyZ3VtZW50LCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKCJ0ZXN0SW5zYW5pdHkoKSIpOworCisgICAgICAgICAgICAgICAgLyoqIGZyb20gVGhyaWZ0VGVzdC50aHJpZnQ6CisgICAgICAgICAgICAgICAgICogU28geW91IHRoaW5rIHlvdSd2ZSBnb3QgdGhpcyBhbGwgd29ya2VkLCBvdXQgZWg/CisgICAgICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAgICAgKiBDcmVhdGVzIGEgdGhlIHJldHVybmVkIG1hcCB3aXRoIHRoZXNlIHZhbHVlcyBhbmQgcHJpbnRzIGl0IG91dDoKKyAgICAgICAgICAgICAgICAgKiAgIHsgMSA9PiB7IDIgPT4gYXJndW1lbnQsCisgICAgICAgICAgICAgICAgICogICAgICAgICAgICAzID0+IGFyZ3VtZW50LAorICAgICAgICAgICAgICAgICAqICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICogICAgIDIgPT4geyA2ID0+IDxlbXB0eSBJbnNhbml0eSBzdHJ1Y3Q+LCB9LAorICAgICAgICAgICAgICAgICAqICAgfQorICAgICAgICAgICAgICAgICAqIEByZXR1cm4gbWFwPFVzZXJJZCwgbWFwPE51bWJlcnosSW5zYW5pdHk+PiAtIGEgbWFwIHdpdGggdGhlIGFib3ZlIHZhbHVlcworICAgICAgICAgICAgICAgICAqLworCisgICAgICAgICAgICAgICAgdmFyIGZpcnN0X21hcCA9IG5ldyBEaWN0aW9uYXJ5PE51bWJlcnosIEluc2FuaXR5PigpOworICAgICAgICAgICAgICAgIHZhciBzZWNvbmRfbWFwID0gbmV3IERpY3Rpb25hcnk8TnVtYmVyeiwgSW5zYW5pdHk+KCk7IDsKKworICAgICAgICAgICAgICAgIGZpcnN0X21hcFtOdW1iZXJ6LlRXT10gPSBhcmd1bWVudDsKKyAgICAgICAgICAgICAgICBmaXJzdF9tYXBbTnVtYmVyei5USFJFRV0gPSBhcmd1bWVudDsKKworICAgICAgICAgICAgICAgIHNlY29uZF9tYXBbTnVtYmVyei5TSVhdID0gbmV3IEluc2FuaXR5KCk7CisKKyAgICAgICAgICAgICAgICB2YXIgaW5zYW5lID0gbmV3IERpY3Rpb25hcnk8bG9uZywgRGljdGlvbmFyeTxOdW1iZXJ6LCBJbnNhbml0eT4+CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBbMV0gPSBmaXJzdF9tYXAsCisgICAgICAgICAgICAgICAgICAgIFsyXSA9IHNlY29uZF9tYXAKKyAgICAgICAgICAgICAgICB9OworCisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdChpbnNhbmUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxYdHJ1Y3Q+IHRlc3RNdWx0aUFzeW5jKHNieXRlIGFyZzAsIGludCBhcmcxLCBsb25nIGFyZzIsIERpY3Rpb25hcnk8c2hvcnQsIHN0cmluZz4gYXJnMywgTnVtYmVyeiBhcmc0LCBsb25nIGFyZzUsCisgICAgICAgICAgICAgICAgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdE11bHRpKCkiKTsKKworICAgICAgICAgICAgICAgIHZhciBoZWxsbyA9IG5ldyBYdHJ1Y3QoKTsgOworICAgICAgICAgICAgICAgIGhlbGxvLlN0cmluZ190aGluZyA9ICJIZWxsbzIiOworICAgICAgICAgICAgICAgIGhlbGxvLkJ5dGVfdGhpbmcgPSBhcmcwOworICAgICAgICAgICAgICAgIGhlbGxvLkkzMl90aGluZyA9IGFyZzE7CisgICAgICAgICAgICAgICAgaGVsbG8uSTY0X3RoaW5nID0gYXJnMjsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KGhlbGxvKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIFRhc2sgdGVzdEV4Y2VwdGlvbkFzeW5jKHN0cmluZyBhcmcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RFeGNlcHRpb24oezB9KSIsIGFyZyk7CisgICAgICAgICAgICAgICAgaWYgKGFyZyA9PSAiWGNlcHRpb24iKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBuZXcgWGNlcHRpb24KKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgRXJyb3JDb2RlID0gMTAwMSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2UgPSBhcmcKKyAgICAgICAgICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgeDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGFyZyA9PSAiVEV4Y2VwdGlvbiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVEV4Y2VwdGlvbigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gVGFzay5Db21wbGV0ZWRUYXNrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzazxYdHJ1Y3Q+IHRlc3RNdWx0aUV4Y2VwdGlvbkFzeW5jKHN0cmluZyBhcmcwLCBzdHJpbmcgYXJnMSwgQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgbG9nZ2VyLkludm9rZSgidGVzdE11bHRpRXhjZXB0aW9uKHswfSwgezF9KSIsIGFyZzAsIGFyZzEpOworICAgICAgICAgICAgICAgIGlmIChhcmcwID09ICJYY2VwdGlvbiIpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IG5ldyBYY2VwdGlvbgorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBFcnJvckNvZGUgPSAxMDAxLAorICAgICAgICAgICAgICAgICAgICAgICAgTWVzc2FnZSA9ICJUaGlzIGlzIGFuIFhjZXB0aW9uIgorICAgICAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgICAgICB0aHJvdyB4OworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChhcmcwID09ICJYY2VwdGlvbjIiKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBuZXcgWGNlcHRpb24yCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEVycm9yQ29kZSA9IDIwMDIsCisgICAgICAgICAgICAgICAgICAgICAgICBTdHJ1Y3RfdGhpbmcgPSBuZXcgWHRydWN0IHsgU3RyaW5nX3RoaW5nID0gIlRoaXMgaXMgYW4gWGNlcHRpb24yIiB9CisgICAgICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgICAgIHRocm93IHg7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IG5ldyBYdHJ1Y3QgeyBTdHJpbmdfdGhpbmcgPSBhcmcxIH07CisgICAgICAgICAgICAgICAgcmV0dXJuIFRhc2suRnJvbVJlc3VsdChyZXN1bHQpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgVGFzayB0ZXN0T25ld2F5QXN5bmMoaW50IHNlY29uZHNUb1NsZWVwLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBsb2dnZXIuSW52b2tlKCJ0ZXN0T25ld2F5KHswfSksIHNsZWVwaW5nLi4uIiwgc2Vjb25kc1RvU2xlZXApOworICAgICAgICAgICAgICAgIFRhc2suRGVsYXkoc2Vjb25kc1RvU2xlZXAgKiAxMDAwLCBjYW5jZWxsYXRpb25Ub2tlbikuR2V0QXdhaXRlcigpLkdldFJlc3VsdCgpOworICAgICAgICAgICAgICAgIGxvZ2dlci5JbnZva2UoInRlc3RPbmV3YXkgZmluaXNoZWQiKTsKKworICAgICAgICAgICAgICAgIHJldHVybiBUYXNrLkNvbXBsZXRlZFRhc2s7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpbnRlcm5hbCBzdGF0aWMgdm9pZCBQcmludE9wdGlvbnNIZWxwKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlNlcnZlciBvcHRpb25zOiIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgLS1waXBlPTxwaXBlIG5hbWU+Iik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtLXBvcnQ9PHBvcnQgbnVtYmVyPiIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgLS10cmFuc3BvcnQ9PHRyYW5zcG9ydCBuYW1lPiAgICBvbmUgb2YgYnVmZmVyZWQsZnJhbWVkICAoZGVmYXVsdHMgdG8gbm9uZSkiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgIC0tcHJvdG9jb2w9PHByb3RvY29sIG5hbWU+ICAgICAgb25lIG9mIGNvbXBhY3QsanNvbiAgKGRlZmF1bHRzIHRvIGJpbmFyeSkiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIgIC0tc2VydmVyLXR5cGU9PHR5cGU+ICAgICAgICAgICAgb25lIG9mIHRocmVhZGVkLHRocmVhZHBvb2wgIChkZWZhdWx0cyB0byBzaW1wbGUpIik7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiICAtLXByb2Nlc3Nvcj08cHJvdG90eXBlPiIpOworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiAgLS1zc2wiKTsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBYNTA5Q2VydGlmaWNhdGUyIEdldFNlcnZlckNlcnQoKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgc2VydmVyQ2VydE5hbWUgPSAic2VydmVyLnAxMiI7CisgICAgICAgICAgICB2YXIgcG9zc2libGVQYXRocyA9IG5ldyBMaXN0PHN0cmluZz4KKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAiLi4vLi4vLi4va2V5cy8iLAorICAgICAgICAgICAgICAgICIuLi8uLi9rZXlzLyIsCisgICAgICAgICAgICAgICAgIi4uL2tleXMvIiwKKyAgICAgICAgICAgICAgICAia2V5cy8iLAorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgc3RyaW5nIGV4aXN0aW5nUGF0aCA9IG51bGw7CisgICAgICAgICAgICBmb3JlYWNoICh2YXIgcG9zc2libGVQYXRoIGluIHBvc3NpYmxlUGF0aHMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHBhdGggPSBQYXRoLkdldEZ1bGxQYXRoKHBvc3NpYmxlUGF0aCArIHNlcnZlckNlcnROYW1lKTsKKyAgICAgICAgICAgICAgICBpZiAoRmlsZS5FeGlzdHMocGF0aCkpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBleGlzdGluZ1BhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmIChzdHJpbmcuSXNOdWxsT3JFbXB0eShleGlzdGluZ1BhdGgpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oJCJDYW5ub3QgZmluZCBmaWxlOiB7c2VydmVyQ2VydE5hbWV9Iik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgIHZhciBjZXJ0ID0gbmV3IFg1MDlDZXJ0aWZpY2F0ZTIoZXhpc3RpbmdQYXRoLCAidGhyaWZ0Iik7CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgIHJldHVybiBjZXJ0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBpbnQgRXhlY3V0ZShMaXN0PHN0cmluZz4gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGxvZ2dlckZhY3RvcnkgPSBuZXcgTG9nZ2VyRmFjdG9yeSgpOy8vLkFkZENvbnNvbGUoKS5BZGREZWJ1ZygpOworICAgICAgICAgICAgdmFyIGxvZ2dlciA9IG5ldyBMb2dnZXJGYWN0b3J5KCkuQ3JlYXRlTG9nZ2VyKCJUZXN0Iik7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHZhciBwYXJhbSA9IG5ldyBTZXJ2ZXJQYXJhbSgpOworCisgICAgICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwYXJhbS5QYXJzZShhcmdzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBleCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiRXJyb3Igd2hpbGUgIHBhcnNpbmcgYXJndW1lbnRzIik7CisgICAgICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKGV4Lk1lc3NhZ2UgKyAiIFNUOiAiICsgZXguU3RhY2tUcmFjZSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAxOworICAgICAgICAgICAgICAgIH0KKworCisgICAgICAgICAgICAgICAgLy8gVHJhbnNwb3J0CisgICAgICAgICAgICAgICAgVFNlcnZlclRyYW5zcG9ydCB0cmFuczsKKyAgICAgICAgICAgICAgICBpZiAocGFyYW0ucGlwZSAhPSBudWxsKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVE5hbWVkUGlwZVNlcnZlclRyYW5zcG9ydChwYXJhbS5waXBlKTsKKyAgICAgICAgICAgICAgICB9CisvLyAgICAgICAgICAgICAgICBlbHNlIGlmIChwYXJhbS51c2VGcmFtZWQpCisvLyAgICAgICAgICAgICAgICB7CisvLyAgICAgICAgICAgICAgICAgICAgdHJhbnMgPSBuZXcgVFNlcnZlckZyYW1lZFRyYW5zcG9ydChwYXJhbS5wb3J0KTsKKy8vICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW0udXNlRW5jcnlwdGlvbikKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNlcnQgPSBHZXRTZXJ2ZXJDZXJ0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjZXJ0ID09IG51bGwgfHwgIWNlcnQuSGFzUHJpdmF0ZUtleSkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSW52YWxpZE9wZXJhdGlvbkV4Y2VwdGlvbigiQ2VydGlmaWNhdGUgZG9lc24ndCBjb250YWluIHByaXZhdGUga2V5Iik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRUbHNTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQocGFyYW0ucG9ydCwgcGFyYW0udXNlQnVmZmVyZWRTb2NrZXRzLCBwYXJhbS51c2VGcmFtZWQsIGNlcnQsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzZW5kZXIsIGNlcnRpZmljYXRlLCBjaGFpbiwgZXJyb3JzKSA9PiB0cnVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBTc2xQcm90b2NvbHMuVGxzIHwgU3NsUHJvdG9jb2xzLlRsczExIHwgU3NsUHJvdG9jb2xzLlRsczEyKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zID0gbmV3IFRTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQocGFyYW0ucG9ydCwgMCwgcGFyYW0udXNlQnVmZmVyZWRTb2NrZXRzLCBwYXJhbS51c2VGcmFtZWQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgSVRQcm90b2NvbEZhY3RvcnkgcHJvdG87CisgICAgICAgICAgICAgICAgaWYgKHBhcmFtLmNvbXBhY3QpCisgICAgICAgICAgICAgICAgICAgIHByb3RvID0gbmV3IFRDb21wYWN0UHJvdG9jb2wuRmFjdG9yeSgpOworICAgICAgICAgICAgICAgIGVsc2UgaWYgKHBhcmFtLmpzb24pCisgICAgICAgICAgICAgICAgICAgIHByb3RvID0gbmV3IFRKc29uUHJvdG9jb2wuRmFjdG9yeSgpOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgcHJvdG8gPSBuZXcgVEJpbmFyeVByb3RvY29sLkZhY3RvcnkoKTsKKworICAgICAgICAgICAgICAgIElUUHJvY2Vzc29yRmFjdG9yeSBwcm9jZXNzb3JGYWN0b3J5OworCisgICAgICAgICAgICAgICAgLy8gUHJvY2Vzc29yCisgICAgICAgICAgICAgICAgdmFyIHRlc3RIYW5kbGVyID0gbmV3IFRlc3RIYW5kbGVyQXN5bmMoKTsKKyAgICAgICAgICAgICAgICB2YXIgdGVzdFByb2Nlc3NvciA9IG5ldyBUaHJpZnRUZXN0LkFzeW5jUHJvY2Vzc29yKHRlc3RIYW5kbGVyKTsKKyAgICAgICAgICAgICAgICBwcm9jZXNzb3JGYWN0b3J5ID0gbmV3IFNpbmdsZXRvblRQcm9jZXNzb3JGYWN0b3J5KHRlc3RQcm9jZXNzb3IpOworCisgICAgICAgICAgICAgICAgVFRyYW5zcG9ydEZhY3RvcnkgdHJhbnNGYWN0b3J5ID0gbmV3IFRUcmFuc3BvcnRGYWN0b3J5KCk7IAorCisgICAgICAgICAgICAgICAgVEJhc2VTZXJ2ZXIgc2VydmVyRW5naW5lID0gbmV3IEFzeW5jQmFzZVNlcnZlcihwcm9jZXNzb3JGYWN0b3J5LCB0cmFucywgdHJhbnNGYWN0b3J5LCB0cmFuc0ZhY3RvcnksIHByb3RvLCBwcm90bywgbG9nZ2VyKTsKKworICAgICAgICAgICAgICAgIC8vU2VydmVyIGV2ZW50IGhhbmRsZXIKKyAgICAgICAgICAgICAgICB2YXIgc2VydmVyRXZlbnRzID0gbmV3IE15U2VydmVyRXZlbnRIYW5kbGVyKCk7CisgICAgICAgICAgICAgICAgc2VydmVyRW5naW5lLlNldEV2ZW50SGFuZGxlcihzZXJ2ZXJFdmVudHMpOworCisgICAgICAgICAgICAgICAgLy8gUnVuIGl0CisgICAgICAgICAgICAgICAgdmFyIHdoZXJlID0gKCEgc3RyaW5nLklzTnVsbE9yRW1wdHkocGFyYW0ucGlwZSkpID8gIm9uIHBpcGUgIiArIHBhcmFtLnBpcGUgOiAib24gcG9ydCAiICsgcGFyYW0ucG9ydDsKKyAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiU3RhcnRpbmcgdGhlIEFzeW5jQmFzZVNlcnZlciAiICsgd2hlcmUgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgd2l0aCBwcm9jZXNzb3IgVFByb3RvdHlwZVByb2Nlc3NvckZhY3RvcnkgcHJvdG90eXBlIGZhY3RvcnkgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBhcmFtLnVzZUJ1ZmZlcmVkU29ja2V0cyA/ICIgd2l0aCBidWZmZXJlZCBzb2NrZXQiIDogIiIpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocGFyYW0udXNlRnJhbWVkID8gIiB3aXRoIGZyYW1lZCB0cmFuc3BvcnQiIDogIiIpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocGFyYW0udXNlRW5jcnlwdGlvbiA/ICIgd2l0aCBlbmNyeXB0aW9uIiA6ICIiKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBhcmFtLmNvbXBhY3QgPyAiIHdpdGggY29tcGFjdCBwcm90b2NvbCIgOiAiIikgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwYXJhbS5qc29uID8gIiB3aXRoIGpzb24gcHJvdG9jb2wiIDogIiIpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLi4uIik7CisgICAgICAgICAgICAgICAgc2VydmVyRW5naW5lLlNlcnZlQXN5bmMoQ2FuY2VsbG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ogCiAkfCsrOwogCi1teSAkaG9zdCA9ICdsb2NhbGhvc3QnOwotbXkgJHBvcnQgPSA5MDkwOworc3ViIHVzYWdlIHsKKyAgICBwcmludCA8PCJFT0YiOworVXNhZ2U6ICQwIFtPUFRJT05TXQogCitPcHRpb25zOiAgICAgICAgICAgICAgICAgICAgICAgICAgKGRlZmF1bHQpCisgIC0tY2EgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENBIHRvIHZhbGlkYXRlIHNlcnZlciB3aXRoLgorICAtLWNlcnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDZXJ0aWZpY2F0ZSB0byB1c2UuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlcXVpcmVkIGlmIHVzaW5nIC0tc3NsLgorICAtLWNpcGhlcnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBY2NlcHRhYmxlIGNpcGhlciBsaXN0LgorICAtLWRvbWFpbi1zb2NrZXQgPGZpbGU+ICAgICAgICAgICAgICAgICAgICAgICBVc2UgYSB1bml4IGRvbWFpbiBzb2NrZXQuCisgIC0taGVscCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNob3cgdXNhZ2UuCisgIC0ta2V5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENlcnRpZmljYXRlIGtleS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVxdWlyZWQgaWYgdXNpbmcgLS1zc2wuCisgIC0tcG9ydCA8cG9ydG51bT4gICAgICAgICAgICAgICAgOTA5MCAgICAgICAgIFBvcnQgdG8gdXNlLgorICAtLXByb3RvY29sIHtiaW5hcnl9ICAgICAgICAgICAgIGJpbmFyeSAgICAgICBQcm90b2NvbCB0byB1c2UuCisgIC0tc3NsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElmIHByZXNlb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yIsICcuCisgICAgICAkaW4tPmJ5dGVfdGhpbmcuJywgJy4KKyAgICAgICRpbi0+aTMyX3RoaW5nLicsICcuCisgICAgICAkaW4tPmk2NF90aGluZy4nfSwgJy4KICAgICAgICRpbjItPmkzMl90aGluZy4ifVxuIik7CiAKICMKQEAgLTEzNywyOCArMjYxLDMwIEBACiBmb3IgKG15ICRpID0gMDsgJGkgPCA1OyArKyRpKSB7CiAgICRtYXBvdXQtPnskaX0gPSAkaS0xMDsKIH0KLXByaW50KCJ0ZXN0TWFwKHsiKTsKK3ByaW50KCd0ZXN0TWFwKHsnKTsKIG15ICRmaXJzdCA9IDE7CiB3aGlsZSggbXkoJGtleSwkdmFsKSA9IGVhY2ggJSRtYXBvdXQpIHsKICAgICBpZiAoJGZpcnN0KSB7CiAgICAgICAgICRmaXJzdCA9IDA7Ci0gICAgfSBlbHNlIHsKLSAgICAgICAgcHJpbnQoIiwgIik7CisgICAgfQorICAgIGVsc2UgeworICAgICAgICBwcmludCgnLCAnKTsKICAgICB9CiAgICAgcHJpbnQoIiRrZXkgPT4gJHZhbCIpOwogfQotcHJpbnQoIn0pIik7CitwcmludCgnfSknKTsKIAogCiBteSAkbWFwaW4gPSAkdGVzdENsaWVudC0+dGVzdE1hcCgkbWFwb3V0KTsKLXByaW50KCIgPSB7Iik7CitwcmludCgnID0geycpOwogCiAkZmlyc3QgPSAxOwogd2hpbGUoIG15KCRrZXksJHZhbCkgPSBlYWNoICUkbWFwaW4pewogICAgIGlmICgkZmlyc3QpIHsKICAgICAgICAgJGZpcnN0ID0gMDsKLSAgICB9IGVsc2UgewotICAgICAgICBwcmludCgiLCAiKTsKKyAgICB9CisgICAgZWxzZSB7CisgICAgICAgIHByaW50KCcsICcpOwogICAgIH0KICAgICBwcmludCgiJGtleSA9PiAkdmFsIik7CiB9CkBAIC0xNzIsMTEgKzI5OCwxMSBAQAogICAgIHB1c2goQCRzZXRvdXQsICRpKTsKIH0KIAotcHJpbnQoInRlc3RTZXQoeyIuam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c2FuaXR5KCRpbnNhbmUpOwotcHJpbnQoIiA9IHsiKTsKK3ByaW50KCcgPSB7Jyk7CiB3aGlsZSggbXkgKCRrZXksJHZhbCkgPSBlYWNoICUkd2hvYSkgewogICAgIHByaW50KCIka2V5ID0+IHsiKTsKICAgICB3aGlsZSggbXkoJGsyLCR2MikgPSBlYWNoICUkdmFsKSB7CiAgICAgICAgIHByaW50KCIkazIgPT4geyIpOwogICAgICAgICBteSAkdXNlck1hcCA9ICR2Mi0+e3VzZXJNYXB9OwotICAgICAgICBwcmludCgieyIpOwotICAgICAgICBpZiAocmVmKCR1c2VyTWFwKSBlcSAiSEFTSCIpIHsKKyAgICAgICAgcHJpbnQoJ3snKTsKKyAgICAgICAgaWYgKHJlZigkdXNlck1hcCkgZXEgJ0hBU0gnKSB7CiAgICAgICAgICAgICB3aGlsZSggbXkoJGszLCR2MykgPSBlYWNoICUkdXNlck1hcCkgewogICAgICAgICAgICAgICAgIHByaW50KCIkazMgPT4gJHYzLCAiKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgICAgICBwcmludCgifSwgIik7CisgICAgICAgIHByaW50KCd9LCAnKTsKIAogICAgICAgICBteSAkeHRydWN0cyA9ICR2Mi0+e3h0cnVjdHN9OwotICAgICAgICBwcmludCgieyIpOwotICAgICAgICBpZiAocmVmKCR4dHJ1Y3RzKSBlcSAiQVJSQVkiKSB7CisgICAgICAgIHByaW50KCd7Jyk7CisgICAgICAgIGlmIChyZWYoJHh0cnVjdHMpIGVxICdBUlJBWScpIHsKICAgICAgICAgICAgIGZvcmVhY2ggbXkgJHggKEAkeHRydWN0cykgewotICAgICAgICAgICAgICAgIHByaW50KCJ7XCIiLiR4LT57c3RyaW5nX3RoaW5nfS4iXCIsICIuCi0gICAgICAgICAgICAgICAgICAgICAgJHgtPntieXRlX3RoaW5nfS4iLCAiLiR4LT57aTMyX3RoaW5nfS4iLCAiLiR4LT57aTY0X3RoaW5nfS4ifSwgIik7CisgICAgICAgICAgICAgIC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9wdGlvbmFsKS4KKyAgLS1jZXJ0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2VydGlmaWNhdGUgZmlsZS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVxdWlyZWQgaWYgdXNpbmcgLS1zc2wuCisgIC0tY2lwaGVycyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFjY2VwdGFibGUgY2lwaGVyIGxpc3QuCisgIC0tZG9tYWluLXNvY2tldCA8ZmlsZT4gICAgICAgICAgICAgICAgICAgICAgIFVzZSBhIHVuaXggZG9tYWluIHNvY2tldC4KKyAgLS1oZWxwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2hvdyB1c2FnZS4KKyAgLS1rZXkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHJpdmF0ZSBrZXkgZmlsZSBmb3IgY2VydGlmaWNhdGUuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlcXVpcmVkIGlmIHVzaW5nIC0tc3NsIGFuZCBwcml2YXRlIGtleSBpcworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3QgaW4gdGhlIGNlcnRpZmljYXRlIGZpbGUuCisgIC0tcG9ydCA8cG9ydG51bT4gICAgICAgICAgICAgICAgOTA5MCAgICAgICAgIFBvcnQgdG8gdXNlLgorICAtLXByb3RvY29sIHtiaW5hcnl9ICAgICAgICAgICAgIGJpbmFyeSAgICAgICBQcm90b2NvbCB0byB1c2UuCisgIC0tc3NsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElmIHByZXNlbnQsIHVzZSBTU0wvVExTLgorICAtLXRyYW5zcG9ydCB7YnVmZmVyZWR8ZnJhbWVkfSAgIGJ1ZmZlcmVkICAgICBUcmFuc3BvcnQgdG8gdXNlLgorCitFT0YKK30KKworbXkgJ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2lkKClcbiIpOworfQorCitzdWIgdGVzdFN0cmluZyB7CisgIG15ICRzZWxmID0gc2hpZnQ7CisgIG15ICR0aGluZyA9IHNoaWZ0OworICBwcmludCgidGVzdFN0cmluZygkdGhpbmcpXG4iKTsKKyAgcmV0dXJuICR0aGluZzsKK30KKworc3ViIHRlc3RCb29sIHsKKyAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgbXkgJHRoaW5nID0gc2hpZnQ7CisgIG15ICRzdHIgPSAkdGhpbmcgPyAndHJ1ZScgOiAnZmFsc2UnOworICBwcmludCgidGVzdEJvb2woJHN0cilcbiIpOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdEJ5dGUgeworICBteSAkc2VsZiA9IHNoaWZ0OworICBteSAkdGhpbmcgPSBzaGlmdDsKKyAgcHJpbnQoInRlc3RCeXRlKCR0aGluZylcbiIpOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdEkzMiB7CisgIG15ICRzZWxmID0gc2hpZnQ7CisgIG15ICR0aGluZyA9IHNoaWZ0OworICBwcmludCgidGVzdEkzMigkdGhpbmcpXG4iKTsKKyAgcmV0dXJuICR0aGluZzsKK30KKworc3ViIHRlc3RJNjQgeworICBteSAkc2VsZiA9IHNoaWZ0OworICBteSAkdGhpbmcgPSBzaGlmdDsKKyAgcHJpbnQoInRlc3RJNjQoJHRoaW5nKVxuIik7CisgIHJldHVybiAkdGhpbmc7Cit9CisKK3N1YiB0ZXN0RG91YmxlIHsKKyAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgbXkgJHRoaW5nID0gc2hpZnQ7CisgIHByaW50KCJ0ZXN0RG91YmxlKCR0aGluZylcbiIpOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdEJpbmFyeSB7CisgICAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgICBteSAkdGhpbmcgPSBzaGlmdDsKKyAgICBteSBAYnl0ZXMgPSBzcGxpdCAvLywgJHRoaW5nOworICAgIHByaW50ICd0ZXN0QmluYXJ5KCc7CisgICAgcHJpbnRmKCAnJTAybHgnLCBvcmQgJF8gKSBmb3JlYWNoIChAYnl0ZXMpOworICAgIHByaW50ICIpXG4iOworICAgIHJldHVybiAkdGhpbmc7Cit9CisKK3N1YiB0ZXN0U3RydWN0IHsKKyAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgbXkgJHRoaW5nID0gc2hpZnQ7CisgIHByaW50ZihxcXx0ZXN0U3RydWN0KHsiJXMiLCAlZCwgJWQsICVsbGR9KVxufCwKKyAgICAgICAgICAgJHRoaW5nLT57c3RyaW5nX3RoaW5nfSwKKyAgICAgICAgICAgJHRoaW5nLT57Ynl0ZV90aGluZ30sCisgICAgICAgICAgICR0aGluZy0+e2kzMl90aGluZ30sCisgICAgICAgICAgICR0aGluZy0+e2k2NF90aGluZ30pOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdE5lc3QgeworICBteSAkc2VsZiA9IHNoaWZ0OworICBteSAkbmVzdCA9IHNoaWZ0OworICBteSAkdGhpbmcgPSAkbmVzdC0+e3N0cnVjdF90aGluZ307CisgIHByaW50ZihxcXx0ZXN0TmVzdCh7JWQsIHsiJXMiLCAlZCwgJWQsICVsbGR9LCAlZH0pXG58LAorICAgICAgICAgICAkbmVzdC0+e2J5dGVfdGhpbmd9LAorICAgICAgICAgICAkdGhpbmctPntzdHJpbmdfdGhpbmd9LAorICAgICAgICAgICAkdGhpbmctPntieXRlX3RoaW5nfSwKKyAgICAgICAgICAgJHRoaW5nLT57aTMyX3RoaW5nfSwKKyAgICAgICAgICAgJHRoaW5nLT57aTY0X3RoaW5nfSwKKyAgICAgICAgICAgJG5lc3QtPntpMzJfdGhpbmd9KTsKKyAgcmV0dXJuICRuZXN0OworfQorCitzdWIgdGVzdE1hcCB7CisgIG15ICRzZWxmID0gc2hpZnQ7CisgIG15ICR0aGluZyA9IHNoaWZ0OworICBwcmludGYgInRlc3RNYXAoeyVzfSlcbiIsCisgICAgam9pbiggJywgJywKKyAgICAgICAgICBtYXAgeyAkXyAuICcgPT4gJyAuICR0aGluZy0+eyRffSB9CisgICAgICAgICAgc29ydCBrZXlzICUkdGhpbmcKKyAgICApOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdFN0cmluZ01hcCB7CisgIG15ICRzZWxmID0gc2hpZnQ7CisgIG15ICR0aGluZyA9IHNoaWZ0OworICBwcmludGYgInRlc3RTdHJpbmdNYXAoeyVzfSlcbiIsCisgICAgam9pbiggJywgJywKKyAgICAgICAgICBtYXAgeyAkXyAuICcgPT4gJyAuICR0aGluZy0+eyRffSB9CisgICAgICAgICAgc29ydCBrZXlzICUkdGhpbmcKKyAgICApOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdFNldCB7CisgIG15ICRzZWxmID0gc2hpZnQ7CisgIG15ICR0aGluZyA9IHNoaWZ0OworICBteSBAcmVzdWx0ID0gc29ydCBrZXlzICUkdGhpbmc7CisgIHByaW50ZiAidGVzdFNldCh7JXN9KVxuIiwgam9pbignLCAnLCBAcmVzdWx0ICk7CisgIHJldHVybiBcQHJlc3VsdDsKK30KKworc3ViIHRlc3RMaXN0IHsKKyAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgbXkgJHRoaW5nID0gc2hpZnQ7CisgIHByaW50ICJ0ZXN0TGlzdCh7JXN9KVxuIiwgam9pbignLCAnLCBAJHRoaW5nKTsKKyAgcmV0dXJuICR0aGluZzsKK30KKworc3ViIHRlc3RFbnVtIHsKKyAgbXkgJHNlbGYgPSBzaGlmdDsKKyAgbXkgJHRoaW5nID0gc2hpZnQ7CisgIHByaW50ICJ0ZXN0RW51bSgkdGhpbmcpXG4iOworICByZXR1cm4gJHRoaW5nOworfQorCitzdWIgdGVzdFR5cGVkZWYgeworICBteSAkc2VsZiA9IHNoaWZ0OworICBteSAkdGhpbmcgPSBzaGlmdDsKKyAgcHJpbnQoInRlc3RUeXBlZGVmKCR0aGluZylcbiIpOworICByZXR1cm4gJHRoaW5n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CBURVNUCiAgKi8KQEAgLTE1OSw2ICsyMjUsMTEgQEAKICAgICAgICAgJGluLT5pNjRfdGhpbmcuIn0sICIuCiAgICAgICAgICRpbjItPmkzMl90aGluZy4ifVxuIik7CiAKK2lmICgkaW4yICE9ICRvdXQyKSB7CisgICAgZWNobyAiKipGQUlMRUQqKlxuIjsKKyAgICAkZXhpdGNvZGUgfD0gRVJSX1NUUlVDVFM7Cit9CisKIC8qKgogICogTUFQIFRFU1QKICAqLwpAQCAtMTkxLDM2ICsyNjIsNjkgQEAKIH0KIHByaW50X3IoIn1cbiIpOwogCitpZiAoJG1hcGluICE9ICRtYXBvdXQpIHsKKyAgICBlY2hvICIqKkZBSUxFRCoqXG4iOworICAgICRleGl0Y29kZSB8PSBFUlJfQ09OVEFJTkVSUzsKK30KKworJG1hcG91dCA9IGFycmF5KCk7Citmb3IgKCRpID0gMDsgJGkgPCAxMDsgJGkrKykgeworICAgICRtYXBvdXRbImtleSRpIl0gPSAidmFsJGkiOworfQorcHJpbnRfcigndGVzdFN0cmluZ01hcCh7Jyk7CiskZmlyc3QgPSB0cnVlOworZm9yZWFjaCAoJG1hcG91dCBhcyAka2V5ID0+ICR2YWwpIHsKKyAgaWYgKCRmaXJzdCkgeworICAgICRmaXJzdCA9IGZhbHNlOworICB9IGVsc2UgeworICAgIHByaW50X3IoIiwgIik7CisgIH0KKyAgcHJpbnRfcigiXCIka2V5XCIgPT4gXCIkdmFsXCIiKTsKK30KK3ByaW50X3IoIn0pIik7CiskbWFwaW4gPSAkdGVzdENsaWVudC0+dGVzdFN0cmluZ01hcCgkbWFwb3V0KTsKK3ByaW50X3IoIiA9IHsiKTsKKyRmaXJzdCA9IHRydWU7Citmb3JlYWNoICgkbWFwaW4gYXMgJGtleSA9PiAkdmFsKSB7CisgIGlmICgkZmlyc3QpIHsKKyAgICAkZmlyc3QgPSBmYWxzZTsKKyAgfSBlbHNlIHsKKyAgICBwcmludF9yKCIsICIpOworICB9CisgIHByaW50X3IoIlwiJ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NlIEV4Y2VwdGlvbigndGVzdGluZyBleGNlcHRpb24gaW4gb25ld2F5IG1ldGhvZCcpCiAKLSAgICAgICAgaWYgY2FsbGJhY2s6Ci0gICAgICAgICAgICBjYWxsYmFjaygpCisgICAgZGVmIHRlc3ROZXN0KHNlbGYsIHRoaW5nKToKKyAgICAgICAgcmV0dXJuIHRoaW5nCiAKLSAgICBkZWYgdGVzdE5lc3Qoc2VsZiwgdGhpbmcsIGNhbGxiYWNrKToKLSAgICAgICAgY2FsbGJhY2sodGhpbmcpCisgICAgQGdlbi5jb3JvdXRpbmUKKyAgICBkZWYgdGVzdE1hcChzZWxmLCB0aGluZyk6CisgICAgICAgIHlpZWxkIGdlbi5tb21lbnQKKyAgICAgICAgcmFpc2UgZ2VuLlJldHVybih0aGluZykKIAotICAgIGRlZiB0ZXN0TWFwKHNlbGYsIHRoaW5nLCBjYWxsYmFjayk6Ci0gICAgICAgIGNhbGxiYWNrKHRoaW5nKQorICAgIGRlZiB0ZXN0U2V0KHNlbGYsIHRoaW5nKToKKyAgICAgICAgcmV0dXJuIHRoaW5nCiAKLSAgICBkZWYgdGVzdFNldChzZWxmLCB0aGluZywgY2FsbGJhY2spOgotICAgICAgICBjYWxsYmFjayh0aGluZykKKyAgICBkZWYgdGVzdExpc3Qoc2VsZiwgdGhpbmcpOgorICAgICAgICByZXR1cm4gdGhpbmcKIAotICAgIGRlZiB0ZXN0TGlzdChzZWxmLCB0aGluZywgY2FsbGJhY2spOgotICAgICAgICBjYWxsYmFjayh0aGluZykKKyAgICBkZWYgdGVzdEVudW0oc2VsZiwgdGhpbmcpOgorICAgICAgICByZXR1cm4gdGhpbmcKIAotICAgIGRlZiB0ZXN0RW51bShzZWxmLCB0aGluZywgY2FsbGJhY2spOgotICAgICAgICBjYWxsYmFjayh0aGluZykKLQotICAgIGRlZiB0ZXN0VHlwZWRlZihzZWxmLCB0aGluZywgY2FsbGJhY2spOgotICAgICAgICBjYWxsYmFjayh0aGluZykKKyAgICBkZWYg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b24oJ1NhZmUnLCBjYWxsYmFjaz1zZWxmLnN0b3ApCi0gICAgICAgIHYgPSBzZWxmLndhaXQodGltZW91dD0xKQotCi0gICAgICAgIHNlbGYuY2xpZW50LnRlc3RFeGNlcHRpb24oJ1hjZXB0aW9uJywgY2FsbGJhY2s9c2VsZi5zdG9wKQotICAgICAgICBleCA9IHNlbGYud2FpdCh0aW1lb3V0PTEpCi0gICAgICAgIGlmIHR5cGUoZXgpID09IFhjZXB0aW9uOgotICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbHMoZXguZXJyb3JDb2RlLCAxMDAxKQotICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbHMoZXgubWVzc2FnZSwgJ1hjZXB0aW9uJykKKyAgICAgICAgdHJ5OgorICAgICAgICAgICAgeWllbGQgc2VsZi5jbGllbnQudGVzdEV4Y2VwdGlvbignWGNlcHRpb24nKQorICAgICAgICBleGNlcHQgWGNlcHRpb24gYXMgZXg6CisgICAgICAgICAgICBzZWxmLmFzc2VydEVxdWFsKGV4LmVycm9yQ29kZSwgMTAwMSkKKyAgICAgICAgICAgIHNlbGYuYXNzZXJ0RXF1YWwoZXgubWVzc2FnZSwgJ1hjZXB0aW9uJykKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHNlbGYuZmFpbCgic2hvdWxkIGhhdmUgZ290dGVuIGV4Y2VwdGlvbiIpCisgICAgICAgIHRyeToKKyAgICAgICAgICAgIHlpZWxkIHNlbGYuY2xpZW50LnRlc3RFeGNlcHRpb24oJ3Rocm93X3VuZGVjbGFyZWQnKQorICAgICAgICBleGNlcHQgVEFwcGxpY2F0aW9uRXhjZXB0aW9uOgorICAgICAgICAgICAgcGFzcwogICAgICAgICBlbHNlOgogICAgICAgICAgICAgc2VsZi5mYWlsKCJzaG91bGQgaGF2ZSBnb3R0ZW4gZXhjZXB0aW9uIikKIAotICAgIGRlZiB0ZXN0X29uZXdheShzZWxmKToKLSAgICAgICAgZGVmIHJldHVybl9mcm9t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ZXN0LklmYWNlKQogY2xhc3MgVGVzdEhhbmRsZXI6Ci0gICAgaW1wbGVtZW50cyhUaHJpZnRUZXN0LklmYWNlKQotCiAgICAgZGVmIF9faW5pdF9fKHNlbGYpOgogICAgICAgICBzZWxmLm9uZXdheXNRdWV1ZSA9IGRlZmVyLkRlZmVycmVkUXVldWUoKQogCiAgICAgZGVmIHRlc3RWb2lkKHNlbGYpOgogICAgICAgICBwYXNzCi0gCisKICAgICBkZWYgdGVzdFN0cmluZyhzZWxmLCBzKToKICAgICAgICAgcmV0dXJuIHMKLSAKKwogICAgIGRlZiB0ZXN0Qnl0ZShzZWxmLCBiKToKICAgICAgICAgcmV0dXJuIGIKLSAKKwogICAgIGRlZiB0ZXN0STE2KHNlbGYsIGkxNik6CiAgICAgICAgIHJldHVybiBpMTYKLSAKKwogICAgIGRlZiB0ZXN0STMyKHNlbGYsIGkzMik6CiAgICAgICAgIHJldHVybiBpMzIKLSAKKwogICAgIGRlZiB0ZXN0STY0KHNlbGYsIGk2NCk6CiAgICAgICAgIHJldHVybiBpNjQKLSAKKwogICAgIGRlZiB0ZXN0RG91YmxlKHNlbGYsIGR1Yik6CiAgICAgICAgIHJldHVybiBkdWIKLSAKKworICAgIGRlZiB0ZXN0QmluYXJ5KHNlbGYsIHRoaW5nKToKKyAgICAgICAgcmV0dXJuIHRoaW5nCisKICAgICBkZWYgdGVzdFN0cnVjdChzZWxmLCB0aGluZyk6CiAgICAgICAgIHJldHVybiB0aGluZwotIAorCiAgICAgZGVmIHRlc3RFeGNlcHRpb24oc2VsZiwgcyk6CiAgICAgICAgIGlmIHMgPT0gJ1hjZXB0aW9uJzoKICAgICAgICAgICAgIHggPSBYY2VwdGlvbigpCkBAIC03MiwzMSArODIsMzIgQEAKICAgICAgICAgICAgIHJhaXNlIHgKICAgICAgICAgZWxpZiBzID09ICJ0aHJvd191bmRlY2xhcmVkIjoKICAgICAgICAgICAgIHJhaXNlIFZhbHVlRXJyb3IoImZvbyIpCi0gCisKICA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mVPZkVhY2goKQorb29lMi5pbnRlZ2VyMTYgPSAxNgorb29lMi5pbnRlZ2VyMzIgPSAzMgorb29lMi5pbnRlZ2VyNjQgPSA2NAorb29lMi5kb3VibGVfcHJlY2lzaW9uID0gKG1hdGguc3FydCg1KSArIDEpIC8gMgorb29lMi5zb21lX2NoYXJhY3RlcnMgPSAiOlIgKG1lIGdvaW5nIFwicnJyclwiKSIKK29vZTIuem9tZ191bmljb2RlID0gdSJceGQzXHg4MFx4ZTJceDg1XHhhZVx4Y2VceDlkXHgyMCJcCisgICAgICAgICAgICAgICAgICAgIHUiXHhkMFx4OWRceGNlXHhiZlx4ZTJceDg1XHhiZlx4ZDBceGJlIlwKKyAgICAgICAgICAgICAgICAgICAgdSJceGM5XHhhMVx4ZDBceGIzXHhkMFx4YjBceGNmXHg4MVx4ZTJceDg0XHg4ZSJcCisgICAgICAgICAgICAgICAgICAgIHUiXHgyMFx4Y2VceDkxXHg3NFx4NzRceGNlXHhiMVx4ZTJceDg1XHhiZFx4Y2VceGJhIlwKKyAgICAgICAgICAgICAgICAgICAgdSJceGM3XHg4M1x4ZTJceDgwXHhiYyIKKworaWYgc3lzLnZlcnNpb25faW5mb1swXSA9PSAyIGFuZCBvcy5lbnZpcm9uLmdldCgnVEhSSUZUX1RFU1RfUFlfTk9fVVRGOFNUUklOR1MnKToKKyAgICBvb2UxLnpvbWdfdW5pY29kZSA9IG9vZTEuem9tZ191bmljb2RlLmVuY29kZSgndXRmOCcpCisgICAgb29lMi56b21nX3VuaWNvZGUgPSBvb2UyLnpvbWdfdW5pY29kZS5lbmNvZGUoJ3V0ZjgnKQorCitobSA9IEhvbHlNb2xleSgqKnsiYmlnIjogW10sICJjb250YWluIjogc2V0KCksICJib25rcyI6IHt9fSkKK2htLmJpZy5hcHBlbmQob29lMSkKK2htLmJpZy5hcHBlbmQob29lMikKK2htLmJpZ1swXS5hX2JpdGUgPSAweDIyCitobS5iaWdbMV0uYV9iaXRlID0gMHgyMgorCitobS5jb250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ICAgIHByb3QgPSBzZWxmLl9zbG93KFRUcmFuc3BvcnQuVE1lbW9yeUJ1ZmZlcigpKQorICAgICAgICBvLndyaXRlKHByb3QpCisKKyAgICAgICAgc2xvd192ZXJzaW9uX2JpbmFyeSA9IHByb3QudHJhbnMuZ2V0dmFsdWUoKQorCisgICAgICAgIHByb3QgPSBzZWxmLl9mYXN0KAorICAgICAgICAgICAgVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKHNsb3dfdmVyc2lvbl9iaW5hcnkpLCBmYWxsYmFjaz1GYWxzZSkKKyAgICAgICAgYyA9IG8uX19jbGFzc19fKCkKKyAgICAgICAgYy5yZWFkKHByb3QpCisgICAgICAgIGlmIGMgIT0gbzoKKyAgICAgICAgICAgIHByaW50KCJhY3R1YWwgIDogIikKKyAgICAgICAgICAgIHBwcmludChyZXByKGMpKQorICAgICAgICAgICAgcHJpbnQoImV4cGVjdGVkOiAiKQorICAgICAgICAgICAgcHByaW50KHJlcHIobykpCisgICAgICAgICAgICByYWlzZSBFeGNlcHRpb24oJ3JlYWQgdmFsdWUgbWlzbWF0Y2gnKQorCisgICAgICAgIHByb3QgPSBzZWxmLl9mYXN0KAorICAgICAgICAgICAgVFRyYW5zcG9ydC5UQnVmZmVyZWRUcmFuc3BvcnQoCisgICAgICAgICAgICAgICAgVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKHNsb3dfdmVyc2lvbl9iaW5hcnkpKSwgZmFsbGJhY2s9RmFsc2UpCisgICAgICAgIGMgPSBvLl9fY2xhc3NfXygpCisgICAgICAgIGMucmVhZChwcm90KQorICAgICAgICBpZiBjICE9IG86CisgICAgICAgICAgICBwcmludCgiYWN0dWFsICA6ICIpCisgICAgICAgICAgICBwcHJpbnQocmVwcihjKSkKKyAgICAgICAgICAgIHByaW50KCJleHBlY3RlZDogIikKKyAgICAgICAgICAgIHBwcmludChyZXByKG8pKQorICAgICAgICAgICAgcmFpc2UgRXhjZXB0aW9uKCdyZWFkIHZhbHVlIG1pc21hdGNoJykKKworICAgIGRlZiBkb190ZXN0KHNlbGYpOgorICAgICAgICBzZWxmLl9jaGVja193cml0ZShIb2x5TW9sZXkoKSkKKyAgICAgICAgc2VsZi5fY2hlY2tfcmVhZChIb2x5TW9sZXkoKSkKKworICAgICAgICBzZWxmLl9jaGVja193cml0ZShobSkKKyAgICAgICAgbm9fc2V0ID0gZGVlcGNvcHkoaG0pCisgICAgICAgIG5vX3NldC5jb250YWluID0gc2V0KCkKKyAgICAgICAgc2VsZi5fY2hlY2tfcmVhZChub19zZXQpCisgICAgICAgIHNlbGYuX2NoZWNrX3JlYWQoaG0pCisKKyAgICAgICAgc2VsZi5fY2hlY2tfd3JpdGUocnMpCisgICAgICAgIHNlbGYuX2NoZWNrX3JlYWQocnMpCisKKyAgICAgICAgc2VsZi5fY2hlY2tfd3JpdGUocnNodWdlKQorICAgICAgICBzZWxmLl9jaGVja19yZWFkKHJzaHVnZSkKKworICAgICAgICBzZWxmLl9jaGVja193cml0ZShteV96ZXJvKQorICAgICAgICBzZWxmLl9jaGVja19yZWFkKG15X3plcm8pCisKKyAgICAgICAgc2VsZi5fY2hlY2tfcmVhZChCYWNrd2FyZHMoKip7ImZpcnN0X3RhZzIiOiA0LCAic2Vjb25kX3RhZzEiOiAyfSkpCisKKyAgICAgICAgIyBPbmUgY2FzZSB3aGVyZSB0aGUgc2VyaWFsaXplZCBmb3JtIGNoYW5nZXMsIGJ1dCBvbmx5IHN1cGVyZmljaWFsbHkuCisgICAgICAgIG8gPSBCYWNrd2FyZHMoKip7ImZpcnN0X3RhZzIiOiA0LCAic2Vjb25kX3RhZzEiOiAyfSkKKyAgICAgICAgdHJhbnNfZmFzdCA9IFRUcmFuc3BvcnQuVE1lbW9yeUJ1ZmZlcigpCisgICAgICAgIHRyYW5zX3Nsb3cgPSBUVHJhbnNwb3J0LlRNZW1vcnlCdWZmZXIoKQorICAgICAgICBwcm90X2Zhc3QgPSBzZWxmLl9mYXN0KHRyYW5zX2Zhc3QsIGZhbGxiYWNrPUZhbHNlKQorICAgICAgICBwcm90X3Nsb3cgPSBzZWxmLl9zbG93KHRyYW5zX3Nsb3cpCisKKyAgICAgICAgby53cml0ZShwcm90X2Zhc3QpCisgICAgICAgIG8ud3JpdGUocHJvdF9zbG93KQorICAgICAgICBPUklHID0gdHJhbnNfc2xvdy5nZXR2YWx1ZSgpCisgICAgICAgIE1JTkUgPSB0cmFuc19mYXN0LmdldHZhbHVlKCkKKyAgICAgICAgYXNzZXJ0IGlkKE9SSUcpICE9IGlkKE1JTkUpCisKKyAgICAgICAgcHJvdCA9IHNlbGYuX2Zhc3QoVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKCksIGZhbGxiYWNrPUZhbHNlKQorICAgICAgICBvLndyaXRlKHByb3QpCisgICAgICAgIHByb3QgPSBzZWxmLl9zbG93KAorICAgICAgICAgICAgVFRyYW5zcG9ydC5UTWVtb3J5QnVmZmVyKHByb3QudHJhbnMuZ2V0dmFsdWUoKSkpCisgICAgICAgIGMgPSBvLl9fY2xhc3NfXygpCisgICAgICAgIGMucmVhZChwcm90KQorICAgICAgICBpZiBjICE9IG86CisgICAgICAgICAgICBwcmludCgiY29weTogIikKKyAgICAgICAgICAgIHBwcmludChyZXByKGMpKQorICAgICAgICAgICAgcHJpbnQoIm9yaWc6ICIpCisgICAgICAgICAgICBwcHJpbnQocmVwcihvKSkKKworCitkZWYgZG9fdGVzdChmYXN0LCBzbG93KToKKyAgICBUZXN0KGZhc3QsIHNsb3cpLmRvX3Rlc3QoKQorCisKK2RlZiBkb19iZW5jaG1hcmsocHJvdG9jb2wsIGl0ZXJzPTUwMDAsIHNraXBfc2xvdz1GYWxzZSk6CisgICAgc2V0dXAgPSAiIiIKK2Zyb20gX19tYWluX18gaW1wb3J0IGhtLCBycywgVERldk51bGxUcmFuc3BvcnQKK2Zyb20gdGhyaWZ0LnByb3RvY29sLnswfSBpbXBvcnQgezB9ezF9Cit0cmFucyA9IFREZXZOdWxsVHJhbnNwb3J0KCkKK3Byb3QgPSB7MH17MX0odHJhbnN7Mn0pCisiIiIKKworICAgIHNldHVwX2Zhc3QgPSBzZXR1cC5mb3JtYXQocHJvdG9jb2wsICdBY2NlbGVyYXRlZCcsICcsIGZhbGxiYWNrPUZhbHNlJykKKyAgICBpZiBub3Qgc2tpcF9zbG93OgorICAgICAgICBzZXR1cF9zbG93ID0gc2V0dXAuZm9ybWF0KHByb3RvY29sLCAnJywgJycpCisKKyAgICBwcmludCgiU3RhcnRpbmcgQmVuY2htYXJrcyIpCisKKyAgICBpZiBub3Qgc2tpcF9zbG93OgorICAgICAgICBwcmludCgiSG9seU1vbGV5IFN0YW5kYXJkID0gJWYiICUKKyAgICAgICAgICAgICAgdGltZWl0LlRpbWVyKCdobS53cml0ZShwcm90KScsIHNldHVwX3Nsb3cpLnRpbWVpdChudW1iZXI9aXRlcnMpKQorCisgICAgcHJpbnQoIkhvbHlNb2xleSBBY2NlbGVyLiA9ICVmIiAlCisgICAgICAgICAgdGltZWl0LlRpbWVyKCdobS53cml0ZShwcm90KScsIHNldHVwX2Zhc3QpLnRpbWVpdChudW1iZXI9aXRlcnMpKQorCisgICAgaWYgbm90IHNraXBfc2xvdzoKKyAgICAgICAgcHJpbnQoIkZhc3RTdHJ1Y3QgU3RhbmRhcmQgPSAlZiIgJQorICAgICAgICAgICAgICB0aW1laXQuVGltZXIoJ3JzLndyaXRlKHByb3QpJywgc2V0dXBfc2xvdykudGltZWl0KG51bWJlcj1pdGVycykpCisKKyAgICBwcmludCgiRmFzdFN0cnVjdCBBY2NlbGVyLiA9ICVmIiAlCisgICAgICAgICAgdGltZWl0LlRpbWVyKCdycy53cml0ZShwcm90KScsIHNldHVwX2Zhc3QpLnRpbWVpdChudW1iZXI9aXRlcnMpKQorCisKK2lmIF9fbmFtZV9fID09ICdfX21haW5fXyc6CisgICAgcHJpbnQoJ1Rlc3RpbmcgVEJpbmFyeUFjY2VsZXJhdGVkJykKKyAgICBkb190ZXN0KFRCaW5hcnlQcm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jdXJzaXZlL19faW5pdF9fLnB5IFwKICAgICAgICAgZ2VuLXB5LWRlZmF1bHQvVGhyaWZ0VGVzdC9fX2luaXRfXy5weSAgICAgICAgICAgXAogICAgICAgICBnZW4tcHktZGVmYXVsdC9EZWJ1Z1Byb3RvVGVzdC9fX2luaXRfXy5weSBcCisgICAgICAgIGdlbi1weS1kZWZhdWx0L0RvdWJsZUNvbnN0YW50c1Rlc3QvX19pbml0X18ucHkgXAorICAgICAgICBnZW4tcHktZGVmYXVsdC9SZWN1cnNpdmUvX19pbml0X18ucHkgXAogICAgICAgICBnZW4tcHktc2xvdHMvVGhyaWZ0VGVzdC9fX2luaXRfXy5weSAgICAgICAgICAgXAogICAgICAgICBnZW4tcHktc2xvdHMvRGVidWdQcm90b1Rlc3QvX19pbml0X18ucHkgXAotICAgICAgICBnZW4tcHktbmV3c3R5bGUvVGhyaWZ0VGVzdC9fX2luaXRfXy5weSAgICAgICAgICAgXAotICAgICAgICBnZW4tcHktbmV3c3R5bGUvRGVidWdQcm90b1Rlc3QvX19pbml0X18ucHkgXAotICAgICAgICBnZW4tcHktbmV3c3R5bGVzbG90cy9UaHJpZnRUZXN0L19faW5pdF9fLnB5ICAgICAgICAgICBcCi0gICAgICAgIGdlbi1weS1uZXdzdHlsZXNsb3RzL0RlYnVnUHJvdG9UZXN0L19faW5pdF9fLnB5IFwKKyAgICAgICAgZ2VuLXB5LXNsb3RzL0RvdWJsZUNvbnN0YW50c1Rlc3QvX19pbml0X18ucHkgXAorICAgICAgICBnZW4tcHktc2xvdHMvUmVjdXJzaXZlL19faW5pdF9fLnB5IFwKKyAgICAgICAgZ2VuLXB5LW9sZHN0eWxlL1RocmlmdFRlc3QvX19pbml0X18ucHkgXAorICAgICAgICBnZW4tcHktb2xkc3R5bGUvRGVidWdQcm90b1Rlc3QvX19pbml0X18ucHkgXAorICAgICAgICBnZW4tcHktb2xkc3R5bGUvRG91YmxlQ29uc3RhbnRzVGVzdC9fX2luaXRfXy5weSBcCisgIC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VycHJvYy5wb2xsKCkgaXMgbm90IE5vbmU6CisgICAgICAgICAgICBwcmludCgoJ0ZBSUw6IFNlcnZlciBwcm9jZXNzICglcykgZmFpbGVkIHdpdGggcmV0Y29kZSAlZCcpCisgICAgICAgICAgICAgICAgICAlICgnICcuam9pbihzZXJ2ZXJfYXJncyksIHNlcnZlcnByb2MucmV0dXJuY29kZSkpCisgICAgICAgICAgICByYWlzZSBFeGNlcHRpb24oJ1NlcnZlciBzdWJwcm9jZXNzICVzIGRpZWQsIGFyZ3M6ICVzJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICUgKHNlcnZlcl9jbGFzcywgJyAnLmpvaW4oc2VydmVyX2FyZ3MpKSkKKworICAgICMgV2FpdCBmb3IgdGhlIHNlcnZlciB0byBzdGFydCBhY2NlcHRpbmcgY29ubmVjdGlvbnMgb24gdGhlIGdpdmVuIHBvcnQuCisgICAgc2xlZXBfdGltZSA9IDAuMSAgIyBTZWNvbmRzCisgICAgbWF4X2F0dGVtcHRzID0gMTAwCisgICAgYXR0ZW1wdCA9IDAKKyAgICB3aGlsZSBUcnVlOgorICAgICAgICBzb2NrNCA9IHNvY2tldC5zb2NrZXQoKQorICAgICAgICBzb2NrNiA9IHNvY2tldC5zb2NrZXQoc29ja2V0LkFGX0lORVQ2KQorICAgICAgICB0cnk6CisgICAgICAgICAgICBpZiBzb2NrNC5jb25uZWN0X2V4KCgnMTI3LjAuMC4xJywgcG9ydCkpID09IDAgXAorICAgICAgICAgICAgICAgICAgICBvciBzb2NrNi5jb25uZWN0X2V4KCgnOjoxJywgcG9ydCkpID09IDA6CisgICAgICAgICAgICAgICAgYnJlYWsKKyAgICAgICAgICAgIGF0dGVtcHQgKz0gMQorICAgICAgICAgICAgaWYgYXR0ZW1wdCA+PSBtYXhfYXR0ZW1wdHM6CisgICAgICAgICAgICAgICAgcmFpc2UgRXhjZXB0aW9uKCJUZXN0U2VydmVyIG5vdCByZWFkeSBvbiBwb3J0ICVkIGFmdGVyICUuMmYgc2Vjb25kcyIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAocG9ydCwgc2xlZXBfdGltZSAqIGF0dGVtcHQpKQorICAgICAgICAgICAgZW5zdXJlU2VydmVyQWxpdmUoKQorICAgICAgICAgICAgdGltZS5zbGVlcChzbGVlcF90aW1lKQorICAgICAgICBmaW5hbGx5OgorICAgICAgICAgICAgc29jazQuY2xvc2UoKQorICAgICAgICAgICAgc29jazYuY2xvc2UoKQorCisgICAgdHJ5OgorICAgICAgICBpZiB2ZXJib3NlID4gMDoKKyAgICAgICAgICAgIHByaW50KCdUZXN0aW5nIGNsaWVudDogJXMnICUgKCcgJy5qb2luKGNsaV9hcmdzKSkpCisgICAgICAgIHJldCA9IHN1YnByb2Nlc3MuY2FsbChjbGlfYXJncywgZW52PWVudikKKyAgICAgICAgaWYgcmV0ICE9IDA6CisgICAgICAgICAgICBwcmludCgnKioqIEZBSUxFRCAqKionLCBmaWxlPXN5cy5zdGRlcnIpCisgICAgICAgICAgICBwcmludCgnTElCRElSOiAlcycgJSBsaWJkaXIsIGZpbGU9c3lzLnN0ZGVycikKKyAgICAgICAgICAgIHByaW50KCdQWV9HRU46ICVzJyAlIGdlbnB5ZGlyLCBmaWxlPXN5cy5zdGRlcnIpCisgICAgICAgICAgICByYWlzZSBFeGNlcHRpb24oIkNsaWVudCBzdWJwcm9jZXNzIGZhaWxlZCwgcmV0Y29kZT0lZCwgYXJnczogJXMiICUgKHJldCwgJyAnLmpvaW4oY2xpX2FyZ3MpKSkKKyAgICBmaW5hbGx5OgorICAgICAgICAjIGNoZWNrIHRoYXQgc2VydmVyIGRpZG4ndCBkaWUKKyAgICAgICAgZW5zdXJlU2VydmVyQWxpdmUoKQorICAgICAgICBleHRyYV9zbGVlcCA9IEVYVFJBX0RFTEFZLmdldChzZXJ2ZXJfY2xhc3MsIDApCisgICAgICAgIGlmIGV4dHJhX3NsZWVwID4gMCBhbmQgdmVyYm9zZSA+IDA6CisgICAgICAgICAgICBw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AgICAgICAgICAgICd6bGliJzogRmFsc2UsCisgICAgICAgICAgICAnc3NsJzogRmFsc2UsCisgICAgICAgIH0KKworICAgIGRlZiBydW4oc2VsZiwgY29uZiwgdGVzdF9jb3VudCk6CisgICAgICAgIHdpdGhfemxpYiA9IGNvbmZbJ3psaWInXQorICAgICAgICB3aXRoX3NzbCA9IGNvbmZbJ3NzbCddCisgICAgICAgIHRyeV9zZXJ2ZXIgPSBjb25mWydzZXJ2ZXInXQorICAgICAgICB0cnlfcHJvdG8gPSBjb25mWydwcm90byddCisgICAgICAgIGdlbnB5ZGlyID0gY29uZlsnZ2VuZGlyJ10KICAgICAgICAgIyBza2lwIGFueSBzZXJ2ZXJzIHRoYXQgZG9uJ3Qgd29yayB3aXRoIHRoZSBabGliIHRyYW5zcG9ydAogICAgICAgICBpZiB3aXRoX3psaWIgYW5kIHRyeV9zZXJ2ZXIgaW4gU0tJUF9aTElCOgotICAgICAgICAgIGNvbnRpbnVlCi0gICAgICAgIGZvciB3aXRoX3NzbCBpbiAoRmFsc2UsIFRydWUpOgotICAgICAgICAgICMgc2tpcCBhbnkgc2VydmVycyB0aGF0IGRvbid0IHdvcmsgd2l0aCBTU0wKLSAgICAgICAgICBpZiB3aXRoX3NzbCBhbmQgdHJ5X3NlcnZlciBpbiBTS0lQX1NTTDoKLSAgICAgICAgICAgIGNvbnRpbnVlCi0gICAgICAgICAgdGVzdF9jb3VudCArPSAxCi0gICAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMDoKLSAgICAgICAgICAgIHByaW50ICdcblRlc3QgcnVuICMlZDogIChpbmNsdWRlcyAlcykgU2VydmVyPSVzLCAgUHJvdG89JXMsICB6bGliPSVzLCAgU1NMPSVzJyAlICh0ZXN0X2NvdW50LCBnZW5weWRpciwgdHJ5X3NlcnZlciwgdHJ5X3Byb3RvLCB3aXRoX3psaWIsIHdpdGhfc3NsKQotICAgICAgICAgIHJ1blNlcnZpY2VUZXN0KGdlbnB5ZGlyLCB0cnl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VzKSAgJXMgLyAlcyBwcm90byAvIHpsaWI9JXMgLyBTU0w9JXMuICAgJWQgY29tYmluYXRpb25zIHRlc3RlZC4nCisgICAgICAgICAgICAgICAgICAlIChnZW5weWRpciwgdHJ5X3NlcnZlciwgdHJ5X3Byb3RvLCB3aXRoX3psaWIsIHdpdGhfc3NsLCB0ZXN0X2NvdW50KSkKKyAgICAgICAgcmV0dXJuIFRydWUKKworICAgIGRlZiB0ZXN0X2ZlYXR1cmUoc2VsZiwgbmFtZSwgdmFsdWVzKToKKyAgICAgICAgdGVzdF9jb3VudCA9IDAKKyAgICAgICAgY29uZiA9IHNlbGYuZGVmYXVsdF9jb25mKCkKKyAgICAgICAgZm9yIHRyeV9zZXJ2ZXIgaW4gdmFsdWVzOgorICAgICAgICAgICAgY29uZltuYW1lXSA9IHRyeV9zZXJ2ZXIKKyAgICAgICAgICAgIGlmIHNlbGYucnVuKGNvbmYsIHRlc3RfY291bnQpOgorICAgICAgICAgICAgICAgIHRlc3RfY291bnQgKz0gMQorICAgICAgICByZXR1cm4gdGVzdF9jb3VudAorCisgICAgZGVmIHJ1bl9hbGxfdGVzdHMoc2VsZik6CisgICAgICAgIHRlc3RfY291bnQgPSAwCisgICAgICAgIGZvciB0cnlfc2VydmVyIGluIHNlbGYuc2VydmVyczoKKyAgICAgICAgICAgIGZvciBnZW5weWRpciBpbiBzZWxmLmdlbmRpcnM6CisgICAgICAgICAgICAgICAgZm9yIHRyeV9wcm90byBpbiBQUk9UT1M6CisgICAgICAgICAgICAgICAgICAgIGZvciB3aXRoX3psaWIgaW4gKEZhbHNlLCBUcnVlKToKKyAgICAgICAgICAgICAgICAgICAgICAgICMgc2tpcCBhbnkgc2VydmVycyB0aGF0IGRvbid0IHdvcmsgd2l0aCB0aGUgWmxpYiB0cmFuc3BvcnQKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIHdpdGhfemxpYiBhbmQgdHJ5X3NlcnZlciBpbiBTS0lQX1pMSUI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciB3aXRoX3NzbCBpbiAoRmFsc2UsIFRydWUpOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICMgc2tpcCBhbnkgc2VydmVycyB0aGF0IGRvbid0IHdvcmsgd2l0aCBTU0wKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiB3aXRoX3NzbCBhbmQgdHJ5X3NlcnZlciBpbiBTS0lQX1NTTDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXN0X2NvdW50ICs9IDEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiBzZWxmLnZlcmJvc2UgPiAwOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludCgnXG5UZXN0IHJ1biAjJWQ6ICAoaW5jbHVkZXMgJXMpIFNlcnZlcj0lcywgIFByb3RvPSVzLCAgemxpYj0lcywgIFNTTD0lcycKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAodGVzdF9jb3VudCwgZ2VucHlkaXIsIHRyeV9zZXJ2ZXIsIHRyeV9wcm90bywgd2l0aF96bGliLCB3aXRoX3NzbCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVuU2VydmljZVRlc3Qoc2VsZi5saWJkaXIsIHNlbGYuZ2VuYmFzZSwgZ2VucHlkaXIsIHRyeV9zZXJ2ZXIsIHRyeV9wcm90bywgc2VsZi5wb3J0LCB3aXRoX3psaWIsIHdpdGhfc3NsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYudmVyYm9zZSA+IDA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KCdPSzogRmluaXNoZWQgKGluY2x1ZGVzICVzKSAgJXMgLyAlcyBwcm90byAvIHpsaWI9JXMgLyBTU0w9JXMuICAgJWQgY29tYmluYXRpb25zIHRlc3RlZC4nCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICUgKGdlbnB5ZGlyLCB0cnlfc2VydmVyLCB0cnlfcHJvdG8sIHdpdGhfemxpYiwgd2l0aF9zc2wsIHRlc3RfY291bnQpKQorICAgICAgICByZXR1cm4gdGVzdF9jb3VudAorCisKK2RlZiBtYWluKCk6CisgICAgcGFyc2VyID0gT3B0aW9uUGFyc2VyKCkKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLS1hbGwnLCBhY3Rpb249InN0b3JlX3RydWUiLCBkZXN0PSdhbGwnKQorICAgIHBhcnNlci5hZGRfb3B0aW9uKCctLWdlbnB5ZGlycycsIHR5cGU9J3N0cmluZycsIGRlc3Q9J2dlbnB5ZGlycycsCisgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdD0nZGVmYXVsdCxzbG90cyxvbGRzdHlsZSxub191dGY4c3RyaW5ncyxkeW5hbWljLGR5bmFtaWNzbG90cycsCisgICAgICAgICAgICAgICAgICAgICAgaGVscD0nZGlyZWN0b3J5IGV4dGVuc2lvbnMgZm9yIGdlbmVyYXRlZCBjb2RlLCB1c2VkIGFzIHN1ZmZpeGVzIGZvciBcImdlbi1weS0qXCIgYWRkZWQgc3lzLnBhdGggZm9yIGluZGl2aWR1YWwgdGVzdHMnKQorICAgIHBhcnNlci5hZGRfb3B0aW9uKCItLXBvcnQiLCB0eXBlPSJpbnQiLCBkZXN0PSJwb3J0IiwgZGVmYXVsdD05MDkwLAorICAgICAgICAgICAgICAgICAgICAgIGhlbHA9InBvcnQgbnVtYmVyIGZvciBzZXJ2ZXIgdG8gbGlzdGVuIG9uIikKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLXYnLCAnLS12ZXJib3NlJywgYWN0aW9uPSJzdG9yZV9jb25zdCIsCisgICAgICAgICAgICAgICAgICAgICAgZGVzdD0idmVyYm9zZSIsIGNvbnN0PTIsCisgICAgICAgICAgICAgICAgICAgICAgaGVscD0idmVyYm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dHJpbmc9J2FhYScsCisgICAgICAgICAgICBlbmRfaW5fYm90aD01NDMyMSwKKyAgICAgICAgKQogCi0gICAgICBzZWxmLnYyb2JqID0gVmVyc2lvbmluZ1Rlc3RWMigKLSAgICAgICAgICBiZWdpbl9pbl9ib3RoPTEyMzQ1LAotICAgICAgICAgIG5ld2ludD0xLAotICAgICAgICAgIG5ld2J5dGU9MiwKLSAgICAgICAgICBuZXdzaG9ydD0zLAotICAgICAgICAgIG5ld2xvbmc9NCwKLSAgICAgICAgICBuZXdkb3VibGU9NS4wLAotICAgICAgICAgIG5ld3N0cnVjdD1Cb25rKG1lc3NhZ2U9IkhlbGxvISIsIHR5cGU9MTIzKSwKLSAgICAgICAgICBuZXdsaXN0PVs3LDgsOV0sCi0gICAgICAgICAgbmV3c2V0PXNldChbNDIsMSw4XSksCi0gICAgICAgICAgbmV3bWFwPXsxOjIsMjozfSwKLSAgICAgICAgICBuZXdzdHJpbmc9IkhvbGEhIiwKLSAgICAgICAgICBlbmRfaW5fYm90aD01NDMyMSwKLSAgICAgICAgICApCisgICAgICAgIHNlbGYudjJvYmogPSBWZXJzaW9uaW5nVGVzdFYyKAorICAgICAgICAgICAgYmVnaW5faW5fYm90aD0xMjM0NSwKKyAgICAgICAgICAgIG5ld2ludD0xLAorICAgICAgICAgICAgbmV3Ynl0ZT0yLAorICAgICAgICAgICAgbmV3c2hvcnQ9MywKKyAgICAgICAgICAgIG5ld2xvbmc9NCwKKyAgICAgICAgICAgIG5ld2RvdWJsZT01LjAsCisgICAgICAgICAgICBuZXdzdHJ1Y3Q9Qm9uayhtZXNzYWdlPSJIZWxsbyEiLCB0eXBlPTEyMyksCisgICAgICAgICAgICBuZXdsaXN0PVs3LCA4LCA5XSwKKyAgICAgICAgICAgIG5ld3NldD1zZXQoWzQyLCAxLCA4XSksCisgICAgICAgICAgICBuZXdtYXA9ezE6IDIsIDI6IDN9LAorICAgICAgICAgICAgbmV3c3RyaW5nPSJIb2xhISIsCisgICAgICAgICAg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gICAgICAgYjE9c2VsZi5ib29scywKKyAgICAgICAgICAgIGIxMD1zZWxmLmJvb2xzX2ZsaXBwZWQsCisgICAgICAgICAgICBiMTAwPXNlbGYuYm9vbHMsCisgICAgICAgICAgICBjaGVja190cnVlPVRydWUsCisgICAgICAgICAgICBiMTAwMD1zZWxmLmJvb2xzX2ZsaXBwZWQsCisgICAgICAgICAgICBjaGVja19mYWxzZT1GYWxzZSwKKyAgICAgICAgICAgIHZlcnR3bzIwMDA9VmVyc2lvbmluZ1Rlc3RWMihuZXdzdHJ1Y3Q9Qm9uayhtZXNzYWdlPSdXb3JsZCEnLCB0eXBlPTMxNCkpLAorICAgICAgICAgICAgYV9zZXQyNTAwPXNldChbJ2xhenknLCAnYnJvd24nLCAnY293J10pLAorICAgICAgICAgICAgdmVydHdvMzAwMD1WZXJzaW9uaW5nVGVzdFYyKG5ld3NldD1zZXQoWzIsIDMsIDUsIDcsIDExXSkpLAorICAgICAgICAgICAgYmlnX251bWJlcnM9WzIgKiogOCwgMiAqKiAxNiwgMiAqKiAzMSAtIDEsIC0oMiAqKiAzMSAtIDEpXQorICAgICAgICApCiAKLSAgICAgIHNlbGYuY29tcGFjdF9zdHJ1Y3QgPSBDb21wYWN0UHJvdG9UZXN0U3RydWN0KAotICAgICAgICAgIGFfYnl0ZSA9IDEyNywKLSAgICAgICAgICBhX2kxNj0zMjAwMCwKLSAgICAgICAgICBhX2kzMj0xMDAwMDAwMDAwLAotICAgICAgICAgIGFfaTY0PTB4ZmZmZmZmZmZmZiwKLSAgICAgICAgICBhX2RvdWJsZT01LjY3ODksCi0gICAgICAgICAgYV9zdHJpbmc9Im15IHN0cmluZyIsCi0gICAgICAgICAgdHJ1ZV9maWVsZD1UcnVlLAotICAgICAgICAgIGZhbHNlX2ZpZWxkPUZhbHNlLAotICAgICAgICAgIGVtcHR5X3N0cnVjdF9maWVsZD1FbXB0eSgpLAotICAgICAgICAgIGJ5dGVfbGlzdD1bLTEyNywgLTEsIDAsIDEsIDE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yB1bmhhc2hhYmxlCisgICAgICAgICAgICAjIHNldF9ieXRlX21hcD17c2V0KFsxLCAyLCAzXSkgOiAxLCBzZXQoWzAsIDFdKSA6IDIsIHNldChbXSkgOiAwfSwgIyB1bmhhc2hhYmxlCisgICAgICAgICAgICAjIG1hcF9ieXRlX21hcCAjIHVuaGFzaGFibGUKKyAgICAgICAgICAgIGJ5dGVfbWFwX21hcD17MDoge30sIDE6IHsxOiAxfSwgMjogezE6IDEsIDI6IDJ9fSwKKyAgICAgICAgICAgIGJ5dGVfc2V0X21hcD17MDogc2V0KFtdKSwgMTogc2V0KFsxXSksIDI6IHNldChbMSwgMl0pfSwKKyAgICAgICAgICAgIGJ5dGVfbGlzdF9tYXA9ezA6IFtdLCAxOiBbMV0sIDI6IFsxLCAyXX0sCisgICAgICAgICkKIAotICAgICAgc2VsZi5uZXN0ZWRfbGlzdHNfaTMyeDIgPSBOZXN0ZWRMaXN0c0kzMngyKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsgMSwgMSwgMiBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyAyLCA3LCA5IF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbIDMsIDUsIDggXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKQorICAgICAgICBzZWxmLm5lc3RlZF9saXN0c19pMzJ4MiA9IE5lc3RlZExpc3RzSTMyeDIoCisgICAgICAgICAgICBbCisgICAgICAgICAgICAgICAgWzEsIDEsIDJdLAorICAgICAgICAgICAgICAgIFsyLCA3LCA5XSwKKyAgICAgICAgICAgICAgICBbMywgNSwgOF0KKyAgICAgICAgICAgIF0KKyAgICAgICAgKQogCi0gICAgICBzZWxmLm5lc3RlZF9saXN0c19pMzJ4MyA9IE5lc3RlZExpc3RzSTMyeDMoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbIDIsIDcsIDkgXSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyAzLCA1LCA4IF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsgMSwgMSwgMiBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbIDEsIDQsIDkgXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKQorICAgICAgICBzZWxmLm5lc3RlZF9saXN0c19pMzJ4MyA9IE5lc3RlZExpc3RzSTMyeDMoCisgICAgICAgICAgICBbCisgICAgICAgICAgICAgICAgWworICAgICAgICAgICAgICAgICAgICBbMiwgNywgOV0sCisgICAgICAgICAgICAgICAgICAgIFszLCA1LCA4XQorICAgICAgICAgICAgICAgIF0sCisgICAgICAgICAgICAgICAgWworICAgICAgICAgICAgICAgICAgICBbMSwgMSwgMl0sCisgICAgICAgICAgICAgICAgICAgIFsxLCA0LCA5XQorICAgICAgICAgICAgICAgIF0KKyAgICAgICAgICAgIF0KKyAgICAgICAgKQogCi0gICAgICBzZWxmLm5lc3RlZF9taXhlZHgyID0gTmVzdGVkTWl4ZWR4MiggaW50X3NldF9saXN0PVsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0KFsxLDIsM10pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQoWzEsNCw5XSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldChbMSwyLDMsNSw4LDEzLDIxXSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldChbLTEsIDAsIDFdKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIG5vdGUsIHRoZSBzZXRzIGJlbG93IGFyZSBzZXRzIG9mIGNoYXJzLCBzaW5jZSB0aGUgc3RyaW5ncyBhcmUgaXRlcmF0ZWQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwX2ludF9zdHJzZXQ9eyAxMDpzZXQoJ2FiYycpLCAyMDpzZXQoJ2RlZicpLCAzMDpzZXQoJ0dISScpIH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcF9pbnRfc3Ryc2V0X2xpc3Q9WwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IDEwOnNldCgnYWJjJyksIDIwOnNldCgnZGVmJyksIDMwOnNldCgnR0hJJykgfSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyAxMDA6c2V0KCdsbW4nKSwgMjAwOnNldCgnb3BxJyksIDMwMDpzZXQoJ1JTVCcpIH0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgMTAwMDpzZXQoJ3V2dycpLCAyMDAwOnNldCgnd3h5JyksIDMwMDA6c2V0KCdYWVonKSB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICkKKyAgICAgICAgc2VsZi5uZXN0ZWRfbWl4ZWR4MiA9IE5lc3RlZE1peGVkeDIoaW50X3NldF9saXN0PVsKKyAgICAgICAgICAgIHNldChbMSwgMiwgM10pLAorICAgICAgICAgICAgc2V0KFsxLCA0LCA5XSksCisgICAgICAgICAgICBzZXQoWzEsIDIsIDMsIDUsIDgsIDEzLCAyMV0pLAorICAgICAgICAgICAgc2V0KFstMSwgMCwgMV0pCisgICAgICAgIF0sCisgICAgICAgICAgICAjIG5vdGUsIHRoZSBzZXRzIGJlbG93IGFyZSBzZXRzIG9mIGNoYXJzLCBzaW5jZSB0aGUgc3RyaW5ncyBhcmUgaXRlcmF0ZWQKKyAgICAgICAgICAgIG1hcF9pbnRfc3Ryc2V0PXsxMDogc2V0KCdhYmMnKSwgMjA6IHNldCgnZGVmJyksIDMwOiBzZXQoJ0dISScpfSwKKyAgICAgICAgICAgIG1hcF9pbnRfc3Ryc2V0X2xpc3Q9WworICAgICAgICAgICAgICAgIHsxMDogc2V0KCdhYmMnKSwgMjA6IHNldCgnZGVmJyksIDMwOiBzZXQoJ0dISScpfSwKKyAgICAgICAgICAgICAgICB7MTAwOiBzZXQoJ2xtbicpLCAyMDA6IHNldCgnb3BxJyksIDMwMDogc2V0KCdSU1QnKX0sCisgICAgICAgICAgICAgICAgezEwMDA6IHNldCgndXZ3JyksIDIwMDA6IHNldCgnd3h5JyksIDMwMDA6IHNldCgnWFlaJyl9XQorICAgICAgICApCiAKLSAgICAgIHNlbGYubmVzdGVkX2xpc3RzX2JvbmsgPSBOZXN0ZWRMaXN0c0JvbmsoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQm9uayhtZXNzYWdlPSdpbm5lciBBIGZpcnN0JywgdHlwZT0xKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCb25rKG1lc3NhZ2U9J2lubmVyIEEgc2Vjb25kJywgdHlwZT0xKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQiBmaXJzdCcsIHR5cGU9MiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQiBzZWNvbmQnLCB0eXBlPTIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICkKKyAgICAgICAgc2VsZi5uZXN0ZWRfbGlzdHNfYm9uayA9IE5lc3RlZExpc3RzQm9uaygKKyAgICAgICAgICAgIFsKKyAgICAgICAgICAgICAgICBbCisgICAgICAgICAgICAgICAgICAgIFsKKyAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQSBmaXJzdCcsIHR5cGU9MSksCisgICAgICAgICAgICAgICAgICAgICAgICBCb25rKG1lc3NhZ2U9J2lubmVyIEEgc2Vjb25kJywgdHlwZT0xKQorICAgICAgICAgICAgICAgICAgICBdLAorICAgICAgICAgICAgICAgICAgICBbCisgICAgICAgICAgICAgICAgICAgICAgICBCb25rKG1lc3NhZ2U9J2lubmVyIEIgZmlyc3QnLCB0eXBlPTIpLAorICAgICAgICAgICAgICAgICAgICAgICAgQm9uayhtZXNzYWdlPSdpbm5lciBCIHNlY29uZCcsIHR5cGU9MikKKyAgICAgICAgICAgICAgICAgICAgXQorICAgICAgICAgICAgICAgIF0KKyAgICAgICAgICAgIF0KKyAgICAgICAgKQogCi0gICAgICBzZWxmLmxpc3RfYm9ua3MgPSBMaXN0Qm9ua3MoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQScsIHR5cGU9MSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQicsIHR5cGU9MiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQycsIHR5cGU9MCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApCisgICAgICAgIHNlbGYubGlzdF9ib25rcyA9IExpc3RCb25rcygKKyAgICAgICAgICAgIFsKKyAgICAgICAgICAgICAgICBCb25rKG1lc3NhZ2U9J2lubmVyIEEnLCB0eXBlPTEpLAorICAgICAgICAgICAgICAgIEJvbmsobWVzc2FnZT0naW5uZXIgQicsIHR5cGU9MiksCisgICAgICAgICAgICAgICAgQm9uayhtZ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saXplKG9iamNvcHksIHNlcmlhbGl6ZShvYmopKQotICAgIHNlbGYuYXNzZXJ0RXF1YWxzKG9iaiwgb2JqY29weSkKLSAgICAKLSAgICAjIHRlc3QgZW51bXMKLSAgICBmb3IgbnVtLCBuYW1lIGluIE51bWJlcnouX1ZBTFVFU19UT19OQU1FUy5pdGVyaXRlbXMoKToKLSAgICAgIG9iaiA9IEJvbmsobWVzc2FnZT0nZW51bSBOdW1iZXJ6IHZhbHVlICVkIGlzIHN0cmluZyAlcycgJSAobnVtLCBuYW1lKSwgdHlwZT1udW0pCi0gICAgICBvYmpjb3B5ID0gQm9uaygpCi0gICAgICBkZXNlcmlhbGl6ZShvYmpjb3B5LCBzZXJpYWxpemUob2JqKSkKLSAgICAgIHNlbGYuYXNzZXJ0RXF1YWxzKG9iaiwgb2JqY29weSkKLSAgCisgICAgICAgICMgdGVzdCBib29sZWFucworICAgICAgICBvYmogPSBCb29scyhpbV90cnVlPVRydWUsIGltX2ZhbHNlPUZhbHNlKQorICAgICAgICBvYmpjb3B5ID0gQm9vbHMoKQorICAgICAgICBkZXNlcmlhbGl6ZShvYmpjb3B5LCBzZXJpYWxpemUob2JqKSkKKyAgICAgICAgc2VsZi5hc3NlcnRFcXVhbHMob2JqLCBvYmpjb3B5KQorCisgICAgICAgICMgdGVzdCBlbnVtcworICAgICAgICBmb3IgbnVtLCBuYW1lIGluIE51bWJlcnouX1ZBTFVFU19UT19OQU1FUy5pdGVtcygpOgorICAgICAgICAgICAgb2JqID0gQm9uayhtZXNzYWdlPSdlbnVtIE51bWJlcnogdmFsdWUgJWQgaXMgc3RyaW5nICVzJyAlIChudW0sIG5hbWUpLCB0eXBlPW51bSkKKyAgICAgICAgICAgIG9iamNvcHkgPSBCb25rKCkKKyAgICAgICAgICAgIGRlc2VyaWFsaXplKG9iamNvcHksIHNlcmlhbGl6ZShvYmopKQorICAgICAgICAgICAgc2VsZi5hc3NlcnRFcXVhbHMob2JqLCBvYmpjb3B5KQorCiAKIGRl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NzYWdlPSJIZWxsbyEiLCB0eXBlPTEyMyksCi0gICAgICAgICAgbmV3bGlzdD1bNyw4LDldLAotICAgICAgICAgIG5ld3NldD1zZXQoWzQyLDEsOF0pLAotICAgICAgICAgIG5ld21hcD17MToyLDI6M30sCi0gICAgICAgICAgbmV3c3RyaW5nPSJIb2xhISIsCi0gICAgICAgICAgZW5kX2luX2JvdGg9NTQzMjEpCi0gICAgICBleHBlY3RlZCA9IGRpY3QoYmVnaW5faW5fYm90aD12Mm9iai5iZWdpbl9pbl9ib3RoLAotICAgICAgICAgICAgICAgICAgICAgIG5ld2ludD12Mm9iai5uZXdpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgbmV3Ynl0ZT12Mm9iai5uZXdieXRlLAotICAgICAgICAgICAgICAgICAgICAgIG5ld3Nob3J0PXYyb2JqLm5ld3Nob3J0LAotICAgICAgICAgICAgICAgICAgICAgIG5ld2xvbmc9djJvYmoubmV3bG9uZywKLSAgICAgICAgICAgICAgICAgICAgICBuZXdkb3VibGU9djJvYmoubmV3ZG91YmxlLAotICAgICAgICAgICAgICAgICAgICAgIG5ld3N0cnVjdD1kaWN0KG1lc3NhZ2U9djJvYmoubmV3c3RydWN0Lm1lc3NhZ2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZT12Mm9iai5uZXdzdHJ1Y3QudHlwZSksCi0gICAgICAgICAgICAgICAgICAgICAgbmV3bGlzdD12Mm9iai5uZXdsaXN0LAotICAgICAgICAgICAgICAgICAgICAgIG5ld3NldD1saXN0KHYyb2JqLm5ld3NldCksCi0gICAgICAgICAgICAgICAgICAgICAgbmV3bWFwPXYyb2JqLm5ld21hcCwKLSAgICAgICAgICAgICAgICAgICAgICBuZXdzdHJpbmc9djJvYmoubmV3c3RyaW5nLAotICAgICAgICAgICAgICAgICAgICAgIGVuZF9pbl9ib3RoPXYyb2JqLmVuZF9pbl9ib3RoKQotICAgICAgCi0gICAgICAjIE5lZWQgdG8gbG9hZC9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AgICAgICAgICBuZXdkb3VibGU9NS4wLAorICAgICAgICAgICAgbmV3c3RydWN0PUJvbmsobWVzc2FnZT0iSGVsbG8hIiwgdHlwZT0xMjMpLAorICAgICAgICAgICAgbmV3bGlzdD1bNywgOCwgOV0sCisgICAgICAgICAgICBuZXdzZXQ9c2V0KFs0MiwgMSwgOF0pLAorICAgICAgICAgICAgbmV3bWFwPXsxOiAyLCAyOiAzfSwKKyAgICAgICAgICAgIG5ld3N0cmluZz0iSG9sYSEiLAorICAgICAgICAgICAgZW5kX2luX2JvdGg9NTQzMjEpCisgICAgICAgIGV4cGVjdGVkID0gZGljdChiZWdpbl9pbl9ib3RoPXYyb2JqLmJlZ2luX2luX2JvdGgsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXdpbnQ9djJvYmoubmV3aW50LAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3Ynl0ZT12Mm9iai5uZXdieXRlLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3c2hvcnQ9djJvYmoubmV3c2hvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXdsb25nPXYyb2JqLm5ld2xvbmcsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXdkb3VibGU9djJvYmoubmV3ZG91YmxlLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3c3RydWN0PWRpY3QobWVzc2FnZT12Mm9iai5uZXdzdHJ1Y3QubWVzc2FnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU9djJvYmoubmV3c3RydWN0LnR5cGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3bGlzdD12Mm9iai5uZXdsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3c2V0PWxpc3QodjJvYmoubmV3c2V0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ld21hcD12Mm9iai5uZXdtYXAsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXdzdHJpbmc9djJvYmoubmV3c3RyaW5n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FtZSBvciBidWZmZXIgZGVwZW5kaW5nIHVwb24gYXJncwotICAgICAgaWYgb3B0aW9ucy5mcmFtZWQ6Ci0gICAgICAgIHNlbGYudHJhbnNwb3J0ID0gVFRyYW5zcG9ydC5URnJhbWVkVHJhbnNwb3J0KHNvY2tldCkKLSAgICAgIGVsc2U6Ci0gICAgICAgIHNlbGYudHJhbnNwb3J0ID0gVFRyYW5zcG9ydC5UQnVmZmVyZWRUcmFuc3BvcnQoc29ja2V0KQotICAgICAgaWYgb3B0aW9ucy56bGliOgotICAgICAgICBzZWxmLnRyYW5zcG9ydCA9IFRabGliVHJhbnNwb3J0LlRabGliVHJhbnNwb3J0KHNlbGYudHJhbnNwb3J0LCA5KQotICAgIHNlbGYudHJhbnNwb3J0Lm9wZW4oKQotICAgIHByb3RvY29sID0gc2VsZi5wcm90b2NvbF9mYWN0b3J5LmdldFByb3RvY29sKHNlbGYudHJhbnNwb3J0KQotICAgIHNlbGYuY2xpZW50ID0gVGhyaWZ0VGVzdC5DbGllbnQocHJvdG9jb2wpCisgICAgZGVmIHNldFVwKHNlbGYpOgorICAgICAgICBpZiBvcHRpb25zLnRyYW5zID09ICdodHRwJzoKKyAgICAgICAgICAgIHVyaSA9ICd7MH06Ly97MX06ezJ9ezN9Jy5mb3JtYXQoKCdodHRwcycgaWYgb3B0aW9ucy5zc2wgZWxzZSAnaHR0cCcpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmhvc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucG9ydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG9wdGlvbnMuaHR0cF9wYXRoIGlmIG9wdGlvbnMuaHR0cF9wYXRoIGVsc2UgJy8nKSkKKyAgICAgICAgICAgIGlmIG9wdGlvbnMuc3NsOgorICAgICAgICAgICAgICAgIF9fY2FmaWxlID0gb3MucGF0aC5qb2luKG9zLnBhdGguZGlybmFtZShTQ1JJUFRfRElSKSwgImtleXMiLCAiQ0EucGVtIikKKyAgICAgICAgICAgICAgICBfX2NlcnRmaWxlID0gb3MucGF0aC5qb2luKG9zLnBhdGguZGlybmFtZShTQ1JJUFRfRElSKSwgImtleXMiLCAiY2xpZW50LmNydCIpCisgICAgICAgICAgICAgICAgX19rZXlmaWxlID0gb3MucGF0aC5qb2luKG9zLnBhdGguZGlybmFtZShTQ1JJUFRfRElSKSwgImtleXMiLCAiY2xpZW50LmtleSIpCisgICAgICAgICAgICAgICAgc2VsZi50cmFuc3BvcnQgPSBUSHR0cENsaWVudC5USHR0cENsaWVudCh1cmksIGNhZmlsZT1fX2NhZmlsZSwgY2VydF9maWxlPV9fY2VydGZpbGUsIGtleV9maWxlPV9fa2V5ZmlsZSkKKyAgICAgICAgICAgIGVsc2U6CisgICAgICAgICAgICAgICAgc2VsZi50cmFuc3BvcnQgPSBUSHR0cENsaWVudC5USHR0cENsaWVudCh1cmkpCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICBpZiBvcHRpb25zLnNzbDoKKyAgICAgICAgICAgICAgICBmcm9tIHRocmlmdC50cmFuc3BvcnQgaW1wb3J0IFRTU0xTb2NrZXQKKyAgICAgICAgICAgICAgICBzb2NrZXQgPSBUU1NMU29ja2V0LlRTU0xTb2NrZXQob3B0aW9ucy5ob3N0LCBvcHRpb25zLnBvcnQsIHZhbGlkYXRlPUZhbHNlKQorICAgICAgICAgICAgZWxzZToKKyAgICAgICAgICAgICAgICBzb2NrZXQgPSBUU29ja2V0LlRTb2NrZXQob3B0aW9ucy5ob3N0LCBvcHRpb25zLnBvcnQpCisgICAgICAgICAgICAjIGZyYW1lIG9yIGJ1ZmZlciBkZXBlbmRpbmcgdXBvbiBhcmdzCisgICAgICAgICAgICBzZWxmLnRyYW5zcG9ydCA9IFRUcmFuc3BvcnQuVEJ1ZmZlcmVkVHJhbnNwb3J0KHNvY2tldCkKKyAgICAgICAgICAg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heShzZWxmKToKLSAgICBzdGFydCA9IHRpbWUudGltZSgpCi0gICAgc2VsZi5jbGllbnQudGVzdE9uZXdheSgxKSAjIHR5cGUgaXMgaW50LCBub3QgZmxvYXQKLSAgICBlbmQgPSB0aW1lLnRpbWUoKQotICAgIHNlbGYuYXNzZXJ0VHJ1ZShlbmQgLSBzdGFydCA8IDMsCi0gICAgICAgICAgICAgICAgICAgICJvbmV3YXkgc2xlZXAgdG9vayAlZiBzZWMiICUgKGVuZCAtIHN0YXJ0KSkKLSAgCi0gIGRlZiB0ZXN0T25ld2F5VGhlbk5vcm1hbChzZWxmKToKLSAgICBzZWxmLmNsaWVudC50ZXN0T25ld2F5KDEpICMgdHlwZSBpcyBpbnQsIG5vdCBmbG9hdAotICAgIHNlbGYuYXNzZXJ0RXF1YWwoc2VsZi5jbGllbnQudGVzdFN0cmluZygnUHl0aG9uJyksICdQeXRob24nKQorICAgIGRlZiB0ZXN0TXVsdGkoc2VsZik6CisgICAgICAgIHByaW50KCd0ZXN0TXVsdGknKQorICAgICAgICB4cGVjdGVkID0gWHRydWN0KHN0cmluZ190aGluZz0nSGVsbG8yJywgYnl0ZV90aGluZz03NCwgaTMyX3RoaW5nPTB4ZmYwMGZmLCBpNjRfdGhpbmc9MHhmZmZmZmZmZmQwZDApCisgICAgICAgIHkgPSBzZWxmLmNsaWVudC50ZXN0TXVsdGkoeHBlY3RlZC5ieXRlX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhwZWN0ZWQuaTMyX3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhwZWN0ZWQuaTY0X3RoaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHswOiAnYWJjJ30sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnVtYmVyei5GSVZFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4ZjBmMGYwKQorICAgICAgICBzZWxmLmF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ZXJ2ZXIuc2V0TnVtV29ya2Vycyg1KQotICBkZWYgc2V0X2FsYXJtKCk6Ci0gICAgZGVmIGNsZWFuX3NodXRkb3duKHNpZ251bSwgZnJhbWUpOgotICAgICAgZm9yIHdvcmtlciBpbiBzZXJ2ZXIud29ya2VyczoKLSAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMDoKLSAgICAgICAgICBwcmludCAnVGVybWluYXRpbmcgd29ya2VyOiAlcycgJSB3b3JrZXIKLSAgICAgICAgd29ya2VyLnRlcm1pbmF0ZSgpCi0gICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAwOgotICAgICAgICBwcmludCAnUmVxdWVzdGluZyBzZXJ2ZXIgdG8gc3RvcCgpJwotICAgICAgdHJ5OgotICAgICAgICBzZXJ2ZXIuc3RvcCgpCi0gICAgICBleGNlcHQ6CisgICAgZGVmIHRlc3RJNjQoc2VsZiwgaTY0KToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdEk2NCglZCknICUgaTY0KQorICAgICAgICByZXR1cm4gaTY0CisKKyAgICBkZWYgdGVzdERvdWJsZShzZWxmLCBkdWIpOgorICAgICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCd0ZXN0RG91YmxlKCVmKScgJSBkdWIpCisgICAgICAgIHJldHVybiBkdWIKKworICAgIGRlZiB0ZXN0QmluYXJ5KHNlbGYsIHRoaW5nKToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdEJpbmFyeSgpJykgICMgVE9ETzogaGV4IG91dHB1dAorICAgICAgICByZXR1cm4gdGhpbmcKKworICAgIGRlZiB0ZXN0U3RydWN0KHNlbGYsIHRoaW5nKToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdFN0cnVjdCh7JXMsICVzLCAlcywgJXN9KScgJSAodGhpbmcuc3RyaW5nX3RoaW5nLCB0aGluZy5ieXRlX3RoaW5nLCB0aGluZy5pMzJfdGhpbmcsIHRoaW5nLmk2NF90aGluZykpCisgICAgICAgIHJldHVybiB0aGluZworCisgICAgZGVmIHRlc3RFeGNlcHRpb24oc2VsZiwgYXJnKToKKyAgICAgICAgIyBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3RFeGNlcHRpb24oJXMpJyAlIGFyZykKKyAgICAgICAgaWYgYXJnID09ICdYY2VwdGlvbic6CisgICAgICAgICAgICByYWlzZSBYY2VwdGlvbihlcnJvckNvZGU9MTAwMSwgbWVzc2FnZT1hcmcpCisgICAgICAgIGVsaWYgYXJnID09ICdURXhjZXB0aW9uJzoKKyAgICAgICAgICAgIHJhaXNlIFRFeGNlcHRpb24obWVzc2FnZT0nVGhpcyBpcyBhIFRFeGNlcHRpb24nKQorCisgICAgZGVmIHRlc3RNdWx0aUV4Y2VwdGlvbihzZWxmLCBhcmcwLCBhcmcxKToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdE11bHRpRXhjZXB0aW9uKCVzLCAlcyknICUgKGFyZzAsIGFyZzEpKQorICAgICAgICBpZiBhcmcwID09ICdYY2VwdGlvbic6CisgICAgICAgICAgICByYWlzZSBYY2VwdGlvbihlcnJvckNvZGU9MTAwMSwgbWVzc2FnZT0nVGhpcyBpcyBhbiBYY2VwdGlvbicpCisgICAgICAgIGVsaWYgYXJnMCA9PSAnWGNlcHRpb24yJzoKKyAgICAgICAgICAgIHJhaXNlIFhjZXB0aW9uMigKKyAgICAgICAgICAgICAgICBlcnJvckNvZGU9MjAwMiwKKyAgICAgICAgICAgICAgICBzdHJ1Y3RfdGhpbmc9WHRydWN0KHN0cmluZ190aGluZz0nVGhpcyBpcyBhbiBYY2VwdGlvbjInKSkKKyAgICAgICAgcmV0dXJuIFh0cnVjdChzdHJpbmdfdGhpbmc9YXJnMSkKKworICAgIGRlZiB0ZXN0T25ld2F5KHNlbGYsIHNlY29uZHMpOgorICAgICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCd0ZXN0T25ld2F5KCVkKSA9PiBzbGVlcGluZy4uLicgJSBzZWNvbmRzKQorICAgICAgICB0aW1lLnNsZWVwKHNlY29uZHMgLyAzKSAgIyBiZSBxdWljaworICAgICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCdkb25lIHNsZWVwaW5nJykKKworICAgIGRlZiB0ZXN0TmVzdChzZWxmLCB0aGluZyk6CisgICAgICAgIGlmIG9wdGlvbnMudmVyYm9zZSA+IDE6CisgICAgICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3ROZXN0KCVzKScgJSB0aGluZykKKyAgICAgICAgcmV0dXJuIHRoaW5nCisKKyAgICBkZWYgdGVzdE1hcChzZWxmLCB0aGluZyk6CisgICAgICAgIGlmIG9wdGlvbnMudmVyYm9zZSA+IDE6CisgICAgICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3RNYXAoJXMpJyAlIHRoaW5nKQorICAgICAgICByZXR1cm4gdGhpbmcKKworICAgIGRlZiB0ZXN0U3RyaW5nTWFwKHNlbGYsIHRoaW5nKToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdFN0cmluZ01hcCglcyknICUgdGhpbmcpCisgICAgICAgIHJldHVybiB0aGluZworCisgICAgZGVmIHRlc3RTZXQoc2VsZiwgdGhpbmcpOgorICAgICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCd0ZXN0U2V0KCVzKScgJSB0aGluZykKKyAgICAgICAgcmV0dXJuIHRoaW5nCisKKyAgICBkZWYgdGVzdExpc3Qoc2VsZiwgdGhpbmcpOgorICAgICAgICBpZiBvcHRpb25zLnZlcmJvc2UgPiAxOgorICAgICAgICAgICAgbG9nZ2luZy5pbmZvKCd0ZXN0TGlzdCglcyknICUgdGhpbmcpCisgICAgICAgIHJldHVybiB0aGluZworCisgICAgZGVmIHRlc3RFbnVtKHNlbGYsIHRoaW5nKToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdEVudW0oJXMpJyAlIHRoaW5nKQorICAgICAgICByZXR1cm4gdGhpbmcKKworICAgIGRlZiB0ZXN0VHlwZWRlZihzZWxmLCB0aGluZyk6CisgICAgICAgIGlmIG9wdGlvbnMudmVyYm9zZSA+IDE6CisgICAgICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3RUeXBlZGVmKCVzKScgJSB0aGluZykKKyAgICAgICAgcmV0dXJuIHRoaW5nCisKKyAgICBkZWYgdGVzdE1hcE1hcChzZWxmLCB0aGluZyk6CisgICAgICAgIGlmIG9wdGlvbnMudmVyYm9zZSA+IDE6CisgICAgICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3RNYXBNYXAoJXMpJyAlIHRoaW5nKQorICAgICAgICByZXR1cm4geworICAgICAgICAgICAgLTQ6IHsKKyAgICAgICAgICAgICAgICAtNDogLTQsCisgICAgICAgICAgICAgICAgLTM6IC0zLAorICAgICAgICAgICAgICAgIC0yOiAtMiwKKyAgICAgICAgICAgICAgICAtMTogLTEsCisgICAgICAgICAgICB9LAorICAgICAgICAgICAgNDogeworICAgICAgICAgICAgICAgIDQ6IDQsCisgICAgICAgICAgICAgICAgMzogMywKKyAgICAgICAgICAgICAgICAyOiAyLAorICAgICAgICAgICAgICAgIDE6IDEsCisgICAgICAgICAgICB9LAorICAgICAgICB9CisKKyAgICBkZWYgdGVzdEluc2FuaXR5KHNlbGYsIGFyZ3VtZW50KToKKyAgICAgICAgaWYgb3B0aW9ucy52ZXJib3NlID4gMToKKyAgICAgICAgICAgIGxvZ2dpbmcuaW5mbygndGVzdEluc2FuaXR5KCVzKScgJSBhcmd1bWVudCkKKyAgICAgICAgcmV0dXJuIHsKKyAgICAgICAgICAgIDE6IHsKKyAgICAgICAgICAgICAgICAyOiBhcmd1bWVudCwKKyAgICAgICAgICAgICAgICAzOiBhcmd1bWVudCwKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICAyOiB7NjogSW5zYW5pdHkoKX0sCisgICAgICAgIH0KKworICAgIGRlZiB0ZXN0TXVsdGkoc2VsZiwgYXJnMCwgYXJnMSwgYXJnMiwgYXJnMywgYXJnNCwgYXJnNSk6CisgICAgICAgIGlmIG9wdGlvbnMudmVyYm9zZSA+IDE6CisgICAgICAgICAgICBsb2dnaW5nLmluZm8oJ3Rlc3RNdWx0aSglcyknICUgW2FyZzAsIGFyZzEsIGFyZzIsIGFyZzMsIGFyZzQsIGFyZzVdKQorICAgICAgICByZXR1cm4gWHRydWN0KHN0cmluZ190aGluZz0nSGVsbG8yJywKKyAgICAgICAgICAgICAgICAgICAgICBieXRlX3RoaW5nPWFyZzAsIGkzMl90aGluZz1hcmcxLCBpNjRfdGhpbmc9YXJnMikKKworCitkZWYgbWFpbihvcHRpb25zKToKKyAgICAjIHNldCB1cCB0aGUgcHJvdG9jb2wgZmFjdG9yeSBmb3JtIHRoZSAtLXByb3RvY29sIG9wdGlvbgorICAgIHByb3RfZmFjdG9yaWVzID0geworICAgICAgICAnYWNjZWwnOiBUQmluYXJ5UHJvdG9jb2wuVEJpbmFyeVByb3RvY29sQWNjZWxlcmF0ZWRGYWN0b3J5KCksCisgICAgICAgICdhY2NlbGMnOiBUQ29tcGFjdFByb3RvY29sLlRDb21wYWN0UHJvdG9jb2xBY2NlbGVyYXRlZEZhY3RvcnkoKSwKKyAgICA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LAorICAgICAgICAgICAgICAgICAgICAgIGhlbHA9InZlcmJvc2Ugb3V0cHV0IikKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLXEnLCAnLS1xdWlldCcsIGFjdGlvbj0ic3RvcmVfY29uc3QiLAorICAgICAgICAgICAgICAgICAgICAgIGRlc3Q9InZlcmJvc2UiLCBjb25zdD0wLAorICAgICAgICAgICAgICAgICAgICAgIGhlbHA9Im1pbmltYWwgb3V0cHV0IikKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLS1wcm90b2NvbCcsIGRlc3Q9InByb3RvIiwgdHlwZT0ic3RyaW5nIiwKKyAgICAgICAgICAgICAgICAgICAgICBoZWxwPSJwcm90b2NvbCB0byB1c2UsIG9uZSBvZjogYWNjZWwsIGFjY2VsYywgYmluYXJ5LCBjb21wYWN0LCBqc29uIikKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLS10cmFuc3BvcnQnLCBkZXN0PSJ0cmFucyIsIHR5cGU9InN0cmluZyIsCisgICAgICAgICAgICAgICAgICAgICAgaGVscD0idHJhbnNwb3J0IHRvIHVzZSwgb25lIG9mOiBidWZmZXJlZCwgZnJhbWVkLCBodHRwIikKKyAgICBwYXJzZXIuYWRkX29wdGlvbignLS1jb250YWluZXItbGltaXQnLCBkZXN0PSdjb250YWluZXJfbGltaXQnLCB0eXBlPSdpbnQnLCBkZWZhdWx0PU5vbmUpCisgICAgcGFyc2VyLmFkZF9vcHRpb24oJy0tc3RyaW5nLWxpbWl0JywgZGVzdD0nc3RyaW5nX2xpbWl0JywgdHlwZT0naW50JywgZGVmYXVsdD1Ob25lKQorICAgIHBhcnNlci5zZXRfZGVmYXVsdHMocG9ydD05MDkwLCB2ZXJib3NlPTEsIHByb3RvPSdiaW5hcnknLCB0cmFuc3BvcnQ9J2J1ZmZlcmVkJykKKyAgICBvcHRpb25zLCBhcmdzID0gcGFyc2VyLnBhcnNlX2FyZ3MoKQorCisgICAgIyBQcmludCBUU2VydmVyIGxvZyB0byBzdGR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dHRlc3QKIGltcG9ydCB0aW1lCiBpbXBvcnQgc29ja2V0CiBpbXBvcnQgcmFuZG9tCi1mcm9tIG9wdHBhcnNlIGltcG9ydCBPcHRpb25QYXJzZXIKKwogCiBjbGFzcyBUaW1lb3V0VGVzdCh1bml0dGVzdC5UZXN0Q2FzZSk6CiAgICAgZGVmIHNldFVwKHNlbGYpOgotICAgICAgICBmb3IgaSBpbiB4cmFuZ2UoNTApOgorICAgICAgICBmb3IgaSBpbiByYW5nZSg1MCk6CiAgICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICAgIyBmaW5kIGEgcG9ydCB3ZSBjYW4gdXNlCiAgICAgICAgICAgICAgICAgc2VsZi5saXN0ZW5fc29jayA9IHNvY2tldC5zb2NrZXQoc29ja2V0LkFGX0lORVQsIHNvY2tldC5TT0NLX1NUUkVBTSkKQEAgLTQ5LDcgKzM2LDcgQEAKICAgICAgICAgICAgICAgICBzZWxmLmxpc3Rlbl9zb2NrLmJpbmQoKCdsb2NhbGhvc3QnLCBzZWxmLnBvcnQpKQogICAgICAgICAgICAgICAgIHNlbGYubGlzdGVuX3NvY2subGlzdGVuKDUpCiAgICAgICAgICAgICAgICAgYnJlYWsKLSAgICAgICAgICAgIGV4Y2VwdDoKKyAgICAgICAgICAgIGV4Y2VwdCBFeGNlcHRpb246CiAgICAgICAgICAgICAgICAgaWYgaSA9PSA0OToKICAgICAgICAgICAgICAgICAgICAgcmFpc2UKIApAQCAtNTgsMTIgKzQ1LDEyIEBACiAKICAgICAgICAgdHJ5OgogICAgICAgICAgICAgbGVha3kgPSBbXQotICAgICAgICAgICAgZm9yIGkgaW4geHJhbmdlKDEwMCk6CisgICAgICAgICAgICBmb3IgaSBpbiByYW5nZSgxMDApOgogICAgICAgICAgICAgICAgIHNvY2tldCA9IFRTb2NrZXQuVFNvY2tldCgnbG9jYWxob3N0Jywgc2VsZi5wb3J0KQogICAgICAgICAgICAgICAgIHNvY2tldC5zZXRUaW1lb3V0KDEwKQogICAg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dF9pbnNhbml0eQorICAgIHAgJ3Rlc3RfaW5zYW5pdHknCisgICAgaW5zYW5lID0gVGhyaWZ0OjpUZXN0OjpJbnNhbml0eS5uZXcoeworICAgICAgJ3VzZXJNYXAnID0+IHsKKyAgICAgICAgVGhyaWZ0OjpUZXN0OjpOdW1iZXJ6OjpGSVZFID0+IDUsCisgICAgICAgIFRocmlmdDo6VGVzdDo6TnVtYmVyejo6RUlHSFQgPT4gOCwKKyAgICAgIH0sCisgICAgICAneHRydWN0cycgPT4gWworICAgICAgICBUaHJpZnQ6OlRlc3Q6Olh0cnVjdC5uZXcoeworICAgICAgICAgICdzdHJpbmdfdGhpbmcnID0+ICdHb29kYnllNCcsCisgICAgICAgICAgJ2J5dGVfdGhpbmcnID0+IDQsCisgICAgICAgICAgJ2kzMl90aGluZycgPT4gNCwKKyAgICAgICAgICAnaTY0X3RoaW5nJyA9PiA0LAorICAgICAgICB9KSwKKyAgICAgICAgVGhyaWZ0OjpUZXN0OjpYdHJ1Y3QubmV3KHsKKyAgICAgICAgICAnc3RyaW5nX3RoaW5nJyA9PiAnSGVsbG8yJywKKyAgICAgICAgICAnYnl0ZV90aGluZycgPT4gMiwKKyAgICAgICAgICAnaTMyX3RoaW5nJyA9PiAyLAorICAgICAgICAgICdpNjRfdGhpbmcnID0+IDIsCisgICAgICAgIH0pCisgICAgICBdCisgICAgfSkKKworICAgIHJldCA9IEBjbGllbnQudGVzdEluc2FuaXR5KGluc2FuZSkKKworICAgIGFzc2VydF9lcXVhbChpbnNhbmUsIHJldFsxXVsyXSkKKyAgICBhc3NlcnRfZXF1YWwoaW5zYW5lLCByZXRbMV1bM10pCisKKyAgICBhc3NlcnQocmV0WzJdWzZdLnVzZXJNYXAgPT0gbmlsIHx8IHJldFsyXVs2XS51c2VyTWFwLmxlbmd0aCA9PSAwKQorICAgIGFzc2VydChyZXRbMl1bNl0ueHRydWN0cyA9PSBuaWwgfHwgcmV0WzJdWzZdLnh0cnVjdHMubGVuZ3RoID09ID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xID0+IHsKKyAgICAgICAgMiA9PiB0aGluZywKKyAgICAgICAgMyA9PiB0aGluZworICAgICAgfSwKKyAgICAgIDIgPT4geworICAgICAgICA2ID0+IFRocmlmdDo6VGVzdDo6SW5zYW5pdHk6Om5ldygpCisgICAgICB9CisgICAgfQorICBlbmQKKworICBkZWYgdGVzdE1hcE1hcCh0aGluZykKKyAgICByZXR1cm4geworICAgICAgLTQgPT4geworICAgICAgICAtNCA9PiAtNCwKKyAgICAgICAgLTMgPT4gLTMsCisgICAgICAgIC0yID0+IC0yLAorICAgICAgICAtMSA9PiAtMSwKKyAgICAgIH0sCisgICAgICA0ID0+IHsKKyAgICAgICAgNCA9PiA0LAorICAgICAgICAzID0+IDMsCisgICAgICAgIDIgPT4gMiwKKyAgICAgICAgMSA9PiAxLAorICAgICAgfQorICAgIH0KKyAgZW5kCisKKyAgZGVmIHRlc3RNdWx0aShhcmcwLCBhcmcxLCBhcmcyLCBhcmczLCBhcmc0LCBhcmc1KQorICAgIHJldHVybiBUaHJpZnQ6OlRlc3Q6Olh0cnVjdC5uZXcoeworICAgICAgJ3N0cmluZ190aGluZycgPT4gJ0hlbGxvMicsCisgICAgICAnYnl0ZV90aGluZycgPT4gYXJnMCwKKyAgICAgICdpMzJfdGhpbmcnID0+IGFyZzEsCisgICAgICAnaTY0X3RoaW5nJyA9PiBhcmcyLAorICAgIH0pCisgIGVuZAorCisgIGRlZiB0ZXN0RXhjZXB0aW9uKHRoaW5nKQorICAgIGlmIHRoaW5nID09ICJYY2VwdGlvbiIKKyAgICAgIHJhaXNlIFRocmlmdDo6VGVzdDo6WGNlcHRpb24sIDplcnJvckNvZGUgPT4gMTAwMSwgOm1lc3NhZ2UgPT4gdGhpbmcKKyAgICBlbHNpZiB0aGluZyA9PSAiVEV4Y2VwdGlvbiIKKyAgICAgIHJhaXNlIFRocmlmdDo6RXhjZXB0aW9uLCA6bWVzc2FnZSA9PiB0aGluZworICAgIGVsc2UKKyAgICAgICMgbm8tb3AKKyAg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yBPUiBDT05ESVRJT05TIE9GIEFOWQorIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlCisgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucworIHVuZGVyIHRoZSBMaWNlbnNlLgorCisqLworCiskLmdldEpTT04oJ3Jlc3VsdHMuanNvbicsIGZ1bmN0aW9uKHJlc3VsdHMpIHsKKyAgICAkKGRvY3VtZW50KS5yZWFkeShmdW5jdGlvbigpIHsKKyAgICAgICAgdmFyIHRyYW5zcG9ydCA9IDM7CisgICAgICAgIHZhciBzb2NrZXQgPSA0OworICAgICAgICB2YXIgc3VjY2VzcyA9IDU7CisgICAgICAgIHZhciBleHBlY3RlZCA9IDY7CisgICAgICAgIHZhciByZXR1cm5Db2RlID0gNzsKKyAgICAgICAgdmFyIGxvZ0ZpbGUgPSA4OworICAgICAgICB0ZXN0VGFibGUgPSAkKCcjdGVzdF9yZXN1bHRzJykuRGF0YVRhYmxlKHsKKyAgICAgICAgICAgIGRhdGE6IHJlc3VsdHNbJ3Jlc3VsdHMnXSwKKyAgICAgICAgICAgIGNvbHVtbkRlZnM6IFsKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIHRhcmdldHM6IDMsCisgICAgICAgICAgICAgICAgICAgIHJlbmRlcjogZnVuY3Rpb24oZGF0YSwgdHlwZSwgcm93KSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcm93W3RyYW5zcG9ydF0gKyAnLScgKyByb3dbc29ja2V0XTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdGFyZ2V0czogNCwKKyAgICAgICAgICAgICAgICAgICAgcmVuZGVyOiBmdW5jdGlvbihkYXRhLCB0eXBlLCByb3cpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAocm93W3N1Y2Nlc3NdID8gJ3N1Y2Nlc3MnIDogJ2ZhaWx1cmUnKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICcoJyArIChyb3dbcmV0dXJuQ29kZV0gPT0gMTI4ID8gJ3RpbWVvdXQnIDogcm93W3JldHVybkNvZGVdKSArICcpJworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICcoPGEgaHJlZj0iJyArIHJvd1tsb2dGaWxlXS5zZXJ2ZXIgKyAnIj5TZXJ2ZXI8L2E+LCAnCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgJzxhIGhyZWY9IicgKyByb3dbbG9nRmlsZV0uY2xpZW50ICsgJyI+Q2xpZW50PC9hPiknOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICB0YXJnZXRzOiA1LAorICAgICAgICAgICAgICAgICAgICByZW5kZXI6IGZ1bmN0aW9uKGRhdGEsIHR5cGUsIHJvdykgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gJ3llcycgcmF0aGVyIHRoYW4gJ2V4cGVjdGVkJyB0byBlYXNlIHNlYXJjaAorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJvd1tleHBlY3RlZF0gPyAneWVzJyA6ICd1bmV4cGVjdGVkJzsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBdLAorICAgICAgICB9KTsKKyAgICAgICAgJCgnI3Rlc3RfcmVzdWx0c19maWx0ZXIgbGFiZWwgaW5wdXQnKS5mb2N1cygpLnZhbCgndW5leHBlY3RlZCBmYWlsdXJlJyk7CisgICAgICAgICQoJyN0ZXN0X2luZm8nKS50ZXh0KAorICAgICAgICAgICAgIlRlc3QgRGF0ZTogICAgICIgKyByZXN1bHRzWydkYXRlJ10gKyA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fcHJvdCwgb19wcm90KQorICAgIH07CisKKyAgICBsZXQgbXV0IHNlY29uZF9zZXJ2aWNlX2NsaWVudCA9IGlmIHByb3RvY29sLnN0YXJ0c193aXRoKCJtdWx0aSIpIHsKKyAgICAgICAgbGV0IChpX3Byb3QsIG9fcHJvdCkgPSBidWlsZF9wcm90b2NvbHMoaG9zdCwgcG9ydCwgdHJhbnNwb3J0LCBwcm90b2NvbCwgIlNlY29uZFNlcnZpY2UiKT87CisgICAgICAgIFNvbWUoU2Vjb25kU2VydmljZVN5bmNDbGllbnQ6Om5ldyhpX3Byb3QsIG9fcHJvdCkpCisgICAgfSBlbHNlIHsKKyAgICAgICAgTm9uZQorICAgIH07CisKKyAgICBpbmZvISgKKyAgICAgICAgImNvbm5lY3RpbmcgdG8ge306e30gd2l0aCB7fSt7fSBzdGFjayIsCisgICAgICAgIGhvc3QsCisgICAgICAgIHBvcnQsCisgICAgICAgIHByb3RvY29sLAorICAgICAgICB0cmFuc3BvcnQKKyAgICApOworCisgICAgZm9yIF8gaW4gMC4udGVzdGxvb3BzIHsKKyAgICAgICAgbWFrZV90aHJpZnRfY2FsbHMoJm11dCB0aHJpZnRfdGVzdF9jbGllbnQsICZtdXQgc2Vjb25kX3NlcnZpY2VfY2xpZW50KT8KKyAgICB9CisKKyAgICBPaygoKSkKK30KKworZm4gYnVpbGRfcHJvdG9jb2xzKAorICAgIGhvc3Q6ICZzdHIsCisgICAgcG9ydDogdTE2LAorICAgIHRyYW5zcG9ydDogJnN0ciwKKyAgICBwcm90b2NvbDogJnN0ciwKKyAgICBzZXJ2aWNlX25hbWU6ICZzdHIsCispIC0+IHRocmlmdDo6UmVzdWx0PChCb3g8VElucHV0UHJvdG9jb2w+LCBCb3g8VE91dHB1dFByb3RvY29sPik+IHsKKyAgICBsZXQgKGlfY2hhbiwgb19jaGFuKSA9IHRjcF9jaGFubmVsKGhvc3QsIHBvcnQpPzsKKworICAgIGxldCAoaV90cmFuLCBvX3RyYW4pOiAoQm94PFRSZWFkVHJhbnNwb3J0PiwgQm94PFRXcml0ZVRyYW5zcG9ydD4pID0gbWF0Y2ggdHJhbnNwb3J0IHsKKyAgICAgICAgImJ1ZmZlcmVkIiA9PiB7CisgICAgICAgICAgICAoQm94OjpuZXcoVEJ1ZmZlcmVkUmVhZFRyYW5zcG9ydDo6bmV3KGlfY2hhbikpLAorICAgICAgICAgICAgIEJveDo6bmV3KFRCdWZmZXJlZFdyaXRlVHJhbnNwb3J0OjpuZXcob19jaGFuKSkpCisgICAgICAgIH0KKyAgICAgICAgImZyYW1lZCIgPT4geworICAgICAgICAgICAgKEJveDo6bmV3KFRGcmFtZWRSZWFkVHJhbnNwb3J0OjpuZXcoaV9jaGFuKSksCisgICAgICAgICAgICAgQm94OjpuZXcoVEZyYW1lZFdyaXRlVHJhbnNwb3J0OjpuZXcob19jaGFuKSkpCisgICAgICAgIH0KKyAgICAgICAgdW5tYXRjaGVkID0+IHJldHVybiBFcnIoZm9ybWF0ISgidW5zdXBwb3J0ZWQgdHJhbnNwb3J0IHt9IiwgdW5tYXRjaGVkKS5pbnRvKCkpLAorICAgIH07CisKKyAgICBsZXQgKGlfcHJvdCwgb19wcm90KTogKEJveDxUSW5wdXRQcm90b2NvbD4sIEJveDxUT3V0cHV0UHJvdG9jb2w+KSA9IG1hdGNoIHByb3RvY29sIHsKKyAgICAgICAgImJpbmFyeSIgPT4geworICAgICAgICAgICAgKEJveDo6bmV3KFRCaW5hcnlJbnB1dFByb3RvY29sOjpuZXcoaV90cmFuLCB0cnVlKSksCisgICAgICAgICAgICAgQm94OjpuZXcoVEJpbmFyeU91dHB1dFByb3RvY29sOjpuZXcob190cmFuLCB0cnVlKSkpCisgICAgICAgIH0KKyAgICAgICAgIm11bHRpIiA9PiB7CisgICAgICAgICAgICAoQm94OjpuZXcoVEJpbmFyeUlucHV0UHJvdG9jb2w6Om5ldyhpX3RyYW4sIHRydWUpKSwKKyAgICAgICAgICAgICBCb3g6Om5ldygKKyAgICAgICAgICAgICAgICBUTXVsdGlwbGV4ZWRPdXRwdXRQcm90b2NvbDo6bmV3KAorICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlX25hbWUsCisgICAgICAgICAgICAgICAgICAgIFRCaW5hcnlPdXRwdXRQcm90b2NvbDo6bmV3KG9fdHJhbiwgdHJ1ZSksCisgICAgICAgICAgICAgICAgKSwKKyAgICAgICAgICAgICkpCisgICAgICAgIH0KKyAgICAgICAgImNvbXBhY3QiID0+IHsKKyAgICAgICAgICAgIChCb3g6Om5ldyhUQ29tcGFjdElucHV0UHJvdG9jb2w6Om5ldyhpX3RyYW4pKSwKKyAgICAgICAgICAgICBCb3g6Om5ldyhUQ29tcGFjdE91dHB1dFByb3RvY29sOjpuZXcob190cmFuKSkpCisgICAgICAgIH0KKyAgICAgICAgIm11bHRpYyIgPT4geworICAgICAgICAgICAgKEJveDo6bmV3KFRDb21wYWN0SW5wdXRQcm90b2NvbDo6bmV3KGlfdHJhbikpLAorICAgICAgICAgICAgIEJveDo6bmV3KFRNdWx0aXBsZXhlZE91dHB1dFByb3RvY29sOjpuZXcoc2VydmljZV9uYW1lLCBUQ29tcGFjdE91dHB1dFByb3RvY29sOjpuZXcob190cmFuKSksKSkKKyAgICAgICAgfQorICAgICAgICB1bm1hdGNoZWQgPT4gcmV0dXJuIEVycihmb3JtYXQhKCJ1bnN1cHBvcnRlZCBwcm90b2NvbCB7fSIsIHVubWF0Y2hlZCkuaW50bygpKSwKKyAgICB9OworCisgICAgT2soKGlfcHJvdCwgb19wcm90KSkKK30KKworLy8gRklYTUU6IGV4cG9zZSAib3BlbiIgdGhyb3VnaCB0aGUgY2xpZW50IGludGVyZmFjZSBzbyBJIGRvbid0IGhhdmUgdG8gZWFybHkKKy8vIG9wZW4KK2ZuIHRjcF9jaGFubmVsKAorICAgIGhvc3Q6ICZzdHIsCisgICAgcG9ydDogdTE2LAorKSAtPiB0aHJpZnQ6OlJlc3VsdDwoUmVhZEhhbGY8VFRjcENoYW5uZWw+LCBXcml0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7CisgICAgeworICAgICAgICBsZXQgdV9zbmQ6IFVzZXJJZCA9IDIzNDg7CisgICAgICAgIGxldCB1X2NtcDogVXNlcklkID0gMjM0ODsKKyAgICAgICAgdmVyaWZ5X2V4cGVjdGVkX3Jlc3VsdCh0aHJpZnRfdGVzdF9jbGllbnQudGVzdF90eXBlZGVmKHVfc25kKSwgdV9jbXApPzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdEVudW0iKTsKKyAgICB7CisgICAgICAgIHZlcmlmeV9leHBlY3RlZF9yZXN1bHQodGhyaWZ0X3Rlc3RfY2xpZW50LnRlc3RfZW51bShOdW1iZXJ6OjpUd28pLCBOdW1iZXJ6OjpUd28pPzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdEJpbmFyeSIpOworICAgIHsKKyAgICAgICAgbGV0IGJfc25kID0gdmVjIVsweDc3LCAweDMwLCAweDMwLCAweDc0LCAweDIxLCAweDIwLCAweDUyLCAweDc1LCAweDczLCAweDc0XTsKKyAgICAgICAgbGV0IGJfY21wID0gdmVjIVsweDc3LCAweDMwLCAweDMwLCAweDc0LCAweDIxLCAweDIwLCAweDUyLCAweDc1LCAweDczLCAweDc0XTsKKyAgICAgICAgdmVyaWZ5X2V4cGVjdGVkX3Jlc3VsdCh0aHJpZnRfdGVzdF9jbGllbnQudGVzdF9iaW5hcnkoYl9zbmQpLCBiX2NtcCk/OworICAgIH0KKworICAgIGluZm8hKCJ0ZXN0U3RydWN0Iik7CisgICAgeworICAgICAgICBsZXQgeF9zbmQgPSBYdHJ1Y3QgeworICAgICAgICAgICAgc3RyaW5nX3RoaW5nOiBTb21lKCJmb28iLnRvX293bmVkKCkpLAorICAgICAgICAgICAgYnl0ZV90aGluZzogU29tZSgxMiksCisgICAgICAgICAgICBpMzJfdGhpbmc6IFNvbWUoMjE5MTI5KSwKKyAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgxMjkzODQ5MjgxOCksCisgICAgICAgIH07CisgICAgICAgIGxldCB4X2NtcCA9I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yZXN1bHQodGhyaWZ0X3Rlc3RfY2xpZW50LnRlc3Rfc3RydWN0KHhfc25kKSwgeF9jbXApKTsKKyAgICAvLyB9CisgICAgLy8KKworICAgIGluZm8hKCJ0ZXN0TmVzdCIpOyAvLyAoRklYTUU6IHRyeSBYdHJ1Y3QyIHdpdGggb3B0aW9uYWwgdmFsdWVzKQorICAgIHsKKyAgICAgICAgbGV0IHhfc25kID0gWHRydWN0MiB7CisgICAgICAgICAgICBieXRlX3RoaW5nOiBTb21lKDMyKSwKKyAgICAgICAgICAgIHN0cnVjdF90aGluZzogU29tZSgKKyAgICAgICAgICAgICAgICBYdHJ1Y3QgeworICAgICAgICAgICAgICAgICAgICBzdHJpbmdfdGhpbmc6IFNvbWUoImZvbyIudG9fb3duZWQoKSksCisgICAgICAgICAgICAgICAgICAgIGJ5dGVfdGhpbmc6IFNvbWUoMSksCisgICAgICAgICAgICAgICAgICAgIGkzMl90aGluZzogU29tZSgzMjQzODIwOTgpLAorICAgICAgICAgICAgICAgICAgICBpNjRfdGhpbmc6IFNvbWUoMTI5Mzg0OTI4MTgpLAorICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICApLAorICAgICAgICAgICAgaTMyX3RoaW5nOiBTb21lKDI5MzQ4MTA5OCksCisgICAgICAgIH07CisgICAgICAgIGxldCB4X2NtcCA9IFh0cnVjdDIgeworICAgICAgICAgICAgYnl0ZV90aGluZzogU29tZSgzMiksCisgICAgICAgICAgICBzdHJ1Y3RfdGhpbmc6IFNvbWUoCisgICAgICAgICAgICAgICAgWHRydWN0IHsKKyAgICAgICAgICAgICAgICAgICAgc3RyaW5nX3RoaW5nOiBTb21lKCJmb28iLnRvX293bmVkKCkpLAorICAgICAgICAgICAgICAgICAgICBieXRlX3RoaW5nOiBTb21lKDEpLAorICAgICAgICAgICAgICAgICAgICBpMzJfdGhpbmc6IFNvbWUoMzI0MzgyMDk4KSwKKyAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nOiBTb21lKDEyOTM4NDkyODE4KSwKKyAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgKSwKKyAgICAgICAgICAgIGkzMl90aGluZzogU29tZSgyOTM0ODEwOTgpLAorICAgICAgICB9OworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X25lc3QoeF9zbmQpLCB4X2NtcCk/OworICAgIH0KKworICAgIC8vIGRvIHRoZSBtdWx0aXBsZXhlZCBjYWxscyB3aGlsZSBtYWtpbmcgdGhlIG1haW4gVGhyaWZ0VGVzdCBjYWxscworICAgIGlmIGxldCBTb21lKHJlZiBtdXQgY2xpZW50KSA9IHNlY29uZF9zZXJ2aWNlX2NsaWVudC5hc19tdXQoKSB7CisgICAgICAgIGluZm8hKCJTZWNvbmRTZXJ2aWNlIHNlY29uZHRlc3RTdHJpbmciKTsKKyAgICAgICAgeworICAgICAgICAgICAgdmVyaWZ5X2V4cGVjdGVkX3Jlc3VsdCgKKyAgICAgICAgICAgICAgICBjbGllbnQuc2Vjb25kdGVzdF9zdHJpbmcoInRlc3Rfc3RyaW5nIi50b19vd25lZCgpKSwKKyAgICAgICAgICAgICAgICAidGVzdFN0cmluZyhcInRlc3Rfc3RyaW5nXCIpIi50b19vd25lZCgpLAorICAgICAgICAgICAgKT87CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpbmZvISgidGVzdExpc3QiKTsKKyAgICB7CisgICAgICAgIGxldCBtdXQgdl9zbmQ6IFZlYzxpMzI+ID0gVmVjOjpuZXcoKTsKKyAgICAgICAgdl9zbmQucHVzaCgyOTM4NCk7CisgICAgICAgIHZfc25kLnB1c2goMjM4KTsKKyAgICAgICAgdl9zbmQucHVzaCgzMjQ5OCk7CisKKyAgICAgICAgbGV0IG11dCB2X2NtcDogVmVjPGkzMj4gPSBWZWM6Om5ldygpOworICAgICAgICB2X2NtcC5wdXNoKDI5Mzg0KTsKKyAgICAgICAgdl9jbXAucHVzaCgyMzgpOworICAgIC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sIDcpOworCisgICAgICAgIHZlcmlmeV9leHBlY3RlZF9yZXN1bHQodGhyaWZ0X3Rlc3RfY2xpZW50LnRlc3RfbWFwKG1fc25kKSwgbV9jbXApPzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdFN0cmluZ01hcCIpOworICAgIHsKKyAgICAgICAgbGV0IG11dCBtX3NuZDogQlRyZWVNYXA8U3RyaW5nLCBTdHJpbmc+ID0gQlRyZWVNYXA6Om5ldygpOworICAgICAgICBtX3NuZC5pbnNlcnQoIjIiLnRvX293bmVkKCksICI0X3N0cmluZyIudG9fb3duZWQoKSk7CisgICAgICAgIG1fc25kLmluc2VydCgiNCIudG9fb3duZWQoKSwgIjZfc3RyaW5nIi50b19vd25lZCgpKTsKKyAgICAgICAgbV9zbmQuaW5zZXJ0KCI4Ii50b19vd25lZCgpLCAiN19zdHJpbmciLnRvX293bmVkKCkpOworCisgICAgICAgIGxldCBtdXQgbV9yY3Y6IEJUcmVlTWFwPFN0cmluZywgU3RyaW5nPiA9IEJUcmVlTWFwOjpuZXcoKTsKKyAgICAgICAgbV9yY3YuaW5zZXJ0KCIyIi50b19vd25lZCgpLCAiNF9zdHJpbmciLnRvX293bmVkKCkpOworICAgICAgICBtX3Jjdi5pbnNlcnQoIjQiLnRvX293bmVkKCksICI2X3N0cmluZyIudG9fb3duZWQoKSk7CisgICAgICAgIG1fcmN2Lmluc2VydCgiOCIudG9fb3duZWQoKSwgIjdfc3RyaW5nIi50b19vd25lZCgpKTsKKworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X3N0cmluZ19tYXAobV9zbmQpLCBtX3Jjdik/OworICAgIH0KKworICAgIC8vIG5lc3RlZCBtYXAKKyAgICAvLyBleHBlY3QgOiB7LTQgPT4gey00ID0+IC00LCAtMyA9PiAtMywgLTIgPT4gLTIsIC0xID0+IC0xLCB9LCA0ID0+IHsxID0+IDEsIDIKKyAgICAvLyA9PiA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3QgeworICAgICAgICAgICAgc3RyaW5nX3RoaW5nOiBTb21lKCJIZWxsbzIiLnRvX293bmVkKCkpLAorICAgICAgICAgICAgYnl0ZV90aGluZzogU29tZSgxKSwKKyAgICAgICAgICAgIGkzMl90aGluZzogU29tZSgtMTIzOTQ4KSwKKyAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgtMTkyMzQxMjM5ODEpLAorICAgICAgICB9OworCisgICAgICAgIHZlcmlmeV9leHBlY3RlZF9yZXN1bHQoCisgICAgICAgICAgICB0aHJpZnRfdGVzdF9jbGllbnQudGVzdF9tdWx0aSgxLCAtMTIzOTQ4LCAtMTkyMzQxMjM5ODEsIG1fc25kLCBOdW1iZXJ6OjpFaWdodCwgODEpLAorICAgICAgICAgICAgc19jbXAsCisgICAgICAgICk/OworICAgIH0KKworICAgIC8vIEluc2FuaXR5CisgICAgLy8gcmV0dXJuczoKKyAgICAvLyB7IDEgPT4geyAyID0+IGFyZ3VtZW50LAorICAgIC8vICAgICAgICAgIDMgPT4gYXJndW1lbnQsCisgICAgLy8gICAgICAgIH0sCisgICAgLy8gICAyID0+IHsgNiA9PiA8ZW1wdHkgSW5zYW5pdHkgc3RydWN0PiwgfSwKKyAgICAvLyB9CisgICAgeworICAgICAgICBsZXQgbXV0IGFyZ19tYXBfdXNlcm1hcDogQlRyZWVNYXA8TnVtYmVyeiwgaTY0PiA9IEJUcmVlTWFwOjpuZXcoKTsKKyAgICAgICAgYXJnX21hcF91c2VybWFwLmluc2VydChOdW1iZXJ6OjpPbmUsIDQyODkpOworICAgICAgICBhcmdfbWFwX3VzZXJtYXAuaW5zZXJ0KE51bWJlcno6OkVpZ2h0LCAxOSk7CisKKyAgICAgICAgbGV0IG11dCBhcmdfdmVjX3h0cnVjdHM6IFZlYzxYdHJ1Y3Q+ID0gVmVjOjpuZXcoKTsKKyAgICAgICAgYXJnX3ZlY194dHJ1Y3RzLnB1c2goCisgICAgICAgICAgICBYdHJ1Y3QgeworICAgICAgICAgICAgICAgIHN0cmluZ190aGluZzogU29tZSgiZm9vIi50b19vd25lZCgpKSwKKyAgICAgICAgICAgICAgICBieXRlX3RoaW5nOiBTb21lKDgpLAorICAgICAgICAgICAgICAgIGkzMl90aGluZzogU29tZSgyOSksCisgICAgICAgICAgICAgICAgaTY0X3RoaW5nOiBTb21lKDkyMzg0KSwKKyAgICAgICAgICAgIH0sCisgICAgICAgICk7CisgICAgICAgIGFyZ192ZWNfeHRydWN0cy5wdXNoKAorICAgICAgICAgICAgWHRydWN0IHsKKyAgICAgICAgICAgICAgICBzdHJpbmdfdGhpbmc6IFNvbWUoImJhciIudG9fb3duZWQoKSksCisgICAgICAgICAgICAgICAgYnl0ZV90aGluZzogU29tZSgyOCksCisgICAgICAgICAgICAgICAgaTMyX3RoaW5nOiBTb21lKDIpLAorICAgICAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgtMTI4MSksCisgICAgICAgICAgICB9LAorICAgICAgICApOworICAgICAgICBhcmdfdmVjX3h0cnVjdHMucHVzaCgKKyAgICAgICAgICAgIFh0cnVjdCB7CisgICAgICAgICAgICAgICAgc3RyaW5nX3RoaW5nOiBTb21lKCJiYXoiLnRvX293bmVkKCkpLAorICAgICAgICAgICAgICAgIGJ5dGVfdGhpbmc6IFNvbWUoMCksCisgICAgICAgICAgICAgICAgaTMyX3RoaW5nOiBTb21lKDM5NDg1MzkpLAorICAgICAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgtMTI5Mzg0OTIpLAorICAgICAgICAgICAgfSwKKyAgICAgICAgKTsKKworICAgICAgICBsZXQgbXV0IHNfY21wX25lc3RlZF8xOiBCVHJlZU1hcDxOdW1iZXJ6LCBJbnNhbml0eT4gPSBCVHJlZU1hcDo6bmV3KCk7CisgICAgICAgIGxldCBpbnNhbml0eSA9IEluc2FuaXR5IHsKKyAgICAgICAgICAgIHVzZXJfbWFwOiBTb21lKGFyZ19tYXBfdXNlcm1hcCksCisgICAgICAgICAgICB4dHJ1Y3RzOiBTb21lKGFyZ192ZWNfeHRydWN0cyksCisgICAgICAgIH07CisgICAgICAgIHNfY21wX25lc3RlZF8xLmluc2VydChOdW1iZXJ6OjpUd28sIGluc2FuaXR5LmNsb25lKCkpOworICAgICAgICBzX2NtcF9uZXN0ZWRfMS5pbnNlcnQoTnVtYmVyejo6VGhyZWUsIGluc2FuaXR5LmNsb25lKCkpOworCisgICAgICAgIGxldCBtdXQgc19jbXBfbmVzdGVkXzI6IEJUcmVlTWFwPE51bWJlcnosIEluc2FuaXR5PiA9IEJUcmVlTWFwOjpuZXcoKTsKKyAgICAgICAgbGV0IGVtcHR5X2luc2FuaXR5ID0gSW5zYW5pdHkgeworICAgICAgICAgICAgdXNlcl9tYXA6IFNvbWUoQlRyZWVNYXA6Om5ldygpKSwKKyAgICAgICAgICAgIHh0cnVjdHM6IFNvbWUoVmVjOjpuZXcoKSksCisgICAgICAgIH07CisgICAgICAgIHNfY21wX25lc3RlZF8yLmluc2VydChOdW1iZXJ6OjpTaXgsIGVtcHR5X2luc2FuaXR5KTsKKworICAgICAgICBsZXQgbXV0IHNfY21wOiBCVHJlZU1hcDxVc2VySWQsIEJUcmVlTWFwPE51bWJlcnosIEluc2FuaXR5Pj4gPSBCVHJlZU1hcDo6bmV3KCk7CisgICAgICAgIHNfY21wLmluc2VydCgxIGFzIFVzZXJJZCwgc19jbXBfbmVzdGVkXzEpOworICAgICAgICBzX2NtcC5pbnNlcnQoMiBhcyBVc2VySWQsIHNfY21wX25lc3RlZF8yKTsKKworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X2luc2FuaXR5KGluc2FuaXR5LmNsb25lKCkpLCBzX2NtcCk/OworICAgIH0KKworICAgIGluZm8hKCJ0ZXN0RXhjZXB0aW9uIC0gcmVtb3RlIHRocm93cyBYY2VwdGlvbiIpOworICAgIHsKKyAgICAgICAgbGV0IHIgPSB0aHJpZnRfdGVzdF9jbGllbnQudGVzdF9leGNlcHRpb24oIlhjZXB0aW9uIi50b19vd25lZCgpKTsKKyAgICAgICAgbGV0IHggPSBtYXRjaCByIHsKKyAgICAgICAgICAgIEVycih0aHJpZnQ6OkVycm9yOjpVc2VyKHJlZiBlKSkgPT4geworICAgICAgICAgICAgICAgIG1hdGNoIGUuZG93bmNhc3RfcmVmOjo8WGNlcHRpb24+KCkgeworICAgICAgICAgICAgICAgICAgICBTb21lKHgpID0+IE9rKHgpLAorICAgICAgICAgICAgICAgICAgICBOb25lID0+IEVycih0aHJpZnQ6OkVycm9yOjpVc2VyKCJkaWQgbm90IGdldCBleHBlY3RlZCBYY2VwdGlvbiBzdHJ1Y3QiLmludG8oKSksKSwKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBfID0+IEVycih0aHJpZnQ6OkVycm9yOjpVc2VyKCJkaWQgbm90IGdldCBleGNlcHRpb24iLmludG8oKSkpLAorICAgICAgICB9PzsKKworICAgICAgICBsZXQgeF9jbXAgPSBYY2VwdGlvbiB7CisgICAgICAgICAgICBlcnJvcl9jb2RlOiBTb21lKDEwMDEpLAorICAgICAgICAgICAgbWVzc2FnZTogU29tZSgiWGNlcHRpb24iLnRvX293bmVkKCkpLAorICAgICAgICB9OworCisgICAgICAgIHZlcmlmeV9leHBlY3RlZF9yZXN1bHQoT2soeCksICZ4X2NtcCk/OworICAgIH0KKworICAgIGluZm8hKCJ0ZXN0RXhjZXB0aW9uIC0gcmVtb3RlIHRocm93cyBUQXBwbGljYXRpb25FeGNlcHRpb24iKTsKKyAgICB7CisgICAgICAgIGxldCByID0gdGhyaWZ0X3Rlc3RfY2xpZW50LnRlc3RfZXhjZXB0aW9uKCJURXhjZXB0aW9uIi50b19vd25lZCgpKTsKKyAgICAgICAgbWF0Y2ggciB7CisgICAgICAgICAgICBFcnIodGhyaWZ0OjpFcnJvcjo6QXBwbGljYXRpb24ocmVmIGUpKSA9PiB7CisgICAgICAgICAgICAgICAgaW5mbyEoInJlY2VpdmVkIGFuIHs6P30iLCBlKTsKKyAgICAgICAgICAgICAgICBPaygoKSkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF8gPT4gRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIoImRpZCBub3QgZ2V0IGV4Y2VwdGlvbiIuaW50bygpKSksCisgICAgICAgIH0/OworICAgIH0KKworICAgIGluZm8hKCJ0ZXN0RXhjZXB0aW9uIC0gcmVtb3RlIHN1Y2NlZWRzIik7CisgICAgeworICAgICAgICBsZXQgciA9IHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X2V4Y2VwdGlvbigiZm9vIi50b19vd25lZCgpKTsKKyAgICAgICAgbWF0Y2ggciB7CisgICAgICAgICAgICBPayhfKSA9PiBPaygoKSksCisgICAgICAgICAgICBfID0+IEVycih0aHJpZnQ6OkVycm9yOjpVc2VyKCJyZWNlaXZlZCBhbiBleGNlcHRpb24iLmludG8oKSkpLAorICAgICAgICB9PzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdE11bHRpRXhjZXB0aW9uIC0gcmVtb3RlIHRocm93cyBYY2VwdGlvbiIpOworICAgIHsKKyAgICAgICAgbGV0IHIgPQorICAgICAgICAgICAgdGhyaWZ0X3Rlc3RfY2xpZW50LnRlc3RfbXVsdGlfZXhjZXB0aW9uKCJYY2VwdGlvbiIudG9fb3duZWQoKSwgImlnbm9yZWQiLnRvX293bmVkKCkpOworICAgICAgICBsZXQgeCA9IG1hdGNoIHIgeworICAgICAgICAgICAgRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIocmVmIGUpKSA9PiB7CisgICAgICAgICAgICAgICAgbWF0Y2ggZS5kb3duY2FzdF9yZWY6OjxYY2VwdGlvbj4oKSB7CisgICAgICAgICAgICAgICAgICAgIFNvbWUoeCkgPT4gT2soeCksCisgICAgICAgICAgICAgICAgICAgIE5vbmUgPT4gRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIoImRpZCBub3QgZ2V0IGV4cGVjdGVkIFhjZXB0aW9uIHN0cnVjdCIuaW50bygpKSwpLAorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF8gPT4gRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIoImRpZCBub3QgZ2V0IGV4Y2VwdGlvbiIuaW50bygpKSksCisgICAgICAgIH0/OworCisgICAgICAgIGxldCB4X2NtcCA9IFhjZXB0aW9uIHsKKyAgICAgICAgICAgIGVycm9yX2NvZGU6IFNvbWUoMTAwMSksCisgICAgICAgICAgICBtZXNzYWdlOiBTb21lKCJUaGlzIGlzIGFuIFhjZXB0aW9uIi50b19vd25lZCgpKSwKKyAgICAgICAgfTsKKworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KE9rKHgpLCAmeF9jbXApPzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdE11bHRpRXhjZXB0aW9uIC0gcmVtb3RlIHRocm93cyBYY2VwdGlvbjIiKTsKKyAgICB7CisgICAgICAgIGxldCByID0KKyAgICAgICAgICAgIHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X211bHRpX2V4Y2VwdGlvbigiWGNlcHRpb24yIi50b19vd25lZCgpLCAiaWdub3JlZCIudG9fb3duZWQoKSk7CisgICAgICAgIGxldCB4ID0gbWF0Y2ggciB7CisgICAgICAgICAgICBFcnIodGhyaWZ0OjpFcnJvcjo6VXNlcihyZWYgZSkpID0+IHsKKyAgICAgICAgICAgICAgICBtYXRjaCBlLmRvd25jYXN0X3JlZjo6PFhjZXB0aW9uMj4oKSB7CisgICAgICAgICAgICAgICAgICAgIFNvbWUoeCkgPT4gT2soeCksCisgICAgICAgICAgICAgICAgICAgIE5vbmUgPT4gRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIoImRpZCBub3QgZ2V0IGV4cGVjdGVkIFhjZXB0aW9uIHN0cnVjdCIuaW50bygpKSwpLAorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF8gPT4gRXJyKHRocmlmdDo6RXJyb3I6OlVzZXIoImRpZCBub3QgZ2V0IGV4Y2VwdGlvbiIuaW50bygpKSksCisgICAgICAgIH0/OworCisgICAgICAgIGxldCB4X2NtcCA9IFhjZXB0aW9uMiB7CisgICAgICAgICAgICBlcnJvcl9jb2RlOiBTb21lKDIwMDIpLAorICAgICAgICAgICAgc3RydWN0X3RoaW5nOiBTb21lKAorICAgICAgICAgICAgICAgIFh0cnVjdCB7CisgICAgICAgICAgICAgICAgICAgIHN0cmluZ190aGluZzogU29tZSgiVGhpcyBpcyBhbiBYY2VwdGlvbjIiLnRvX293bmVkKCkpLAorICAgICAgICAgICAgICAgICAgICAvLyBzaW5jZSB0aGlzIGlzIGFuIE9QVF9JTl9SRVFfT1VUIGZpZWxkIHRoZSBzZW5kZXIgc2V0cyBhIGRlZmF1bHQKKyAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZzogU29tZSgwKSwKKyAgICAgICAgICAgICAgICAgICAgLy8gc2luY2UgdGhpcyBpcyBhbiBPUFRfSU5fUkVRX09VVCBmaWVsZCB0aGUgc2VuZGVyIHNldHMgYSBkZWZhdWx0CisgICAgICAgICAgICAgICAgICAgIGkzMl90aGluZzogU29tZSgwKSwKKyAgICAgICAgICAgICAgICAgICAgLy8gc2luY2UgdGhpcyBpcyBhbiBPUFRfSU5fUkVRX09VVCBmaWVsZCB0aGUgc2VuZGVyIHNldHMgYSBkZWZhdWx0CisgICAgICAgICAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgwKSwKKyAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgKSwKKyAgICAgICAgfTsKKworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KE9rKHgpLCAmeF9jbXApPzsKKyAgICB9CisKKyAgICBpbmZvISgidGVzdE11bHRpRXhjZXB0aW9uIC0gcmVtb3RlIHN1Y2NlZWRzIik7CisgICAgeworICAgICAgICBsZXQgciA9IHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X211bHRpX2V4Y2VwdGlvbigiaGFoYSIudG9fb3duZWQoKSwgIlJFVFVSTkVEIi50b19vd25lZCgpKTsKKyAgICAgICAgbGV0IHggPSBtYXRjaCByIHsKKyAgICAgICAgICAgIEVycihlKSA9PiBFcnIodGhyaWZ0OjpFcnJvcjo6VXNlcihmb3JtYXQhKCJyZWNlaXZlZCBhbiB1bmV4cGVjdGVkIGV4Y2VwdGlvbiB7Oj99IiwgZSkuaW50bygpLCksKSwKKyAgICAgICAgICAgIF8gPT4gciwKKyAgICAgICAgfT87CisKKyAgICAgICAgbGV0IHhfY21wID0gWHRydWN0IHsKKyAgICAgICAgICAgIHN0cmluZ190aGluZzogU29tZSgiUkVUVVJORUQiLnRvX293bmVkKCkpLAorICAgICAgICAgICAgLy8gc2luY2UgdGhpcyBpcyBhbiBPUFRfSU5fUkVRX09VVCBmaWVsZCB0aGUgc2VuZGVyIHNldHMgYSBkZWZhdWx0CisgICAgICAgICAgICBieXRlX3RoaW5nOiBTb21lKDApLAorICAgICAgICAgICAgLy8gc2luY2UgdGhpcyBpcyBhbiBPUFRfSU5fUkVRX09VVCBmaWVsZCB0aGUgc2VuZGVyIHNldHMgYSBkZWZhdWx0CisgICAgICAgICAgICBpMzJfdGhpbmc6IFNvbWUoMCksCisgICAgICAgICAgICAvLyBzaW5jZSB0aGlzIGlzIGFuIE9QVF9JTl9SRVFfT1VUIGZpZWxkIHRoZSBzZW5kZXIgc2V0cyBhIGRlZmF1bHQKKyAgICAgICAgICAgIGk2NF90aGluZzogU29tZSgwKSwKKyAgICAgICAgfTsKKworICAgICAgICB2ZXJpZnlfZXhwZWN0ZWRfcmVzdWx0KE9rKHgpLCB4X2NtcCk/OworICAgIH0KKworICAgIGluZm8hKCJ0ZXN0T25lV2F5IC0gcmVtb3RlIHNsZWVwcyBmb3IgMSBzZWNvbmQiKTsKKyAgICB7CisgICAgICAgIHRocmlmdF90ZXN0X2NsaWVudC50ZXN0X29uZXdheSgxKT87CisgICAgfQorCisgICAgLy8gZmluYWwgdGVzdCB0byB2ZXJpZnkgdGhhdCB0aGUgY29ubmVjdGlvbiBpcyBzdGlsbCB3cml0YWJsZSBhZnRlciB0aGUgb25lLXdheQorICAgIC8vIGNhbGwKKyAgICB0aHJpZnRfdGVzdF9jbGllbnQudGVzdF92b2lkKCkKK30KKworI1tjZmdfYXR0cihmZWF0dXJlID0gImNhcmdvLWNsaXBweSIsIGFsbG93KG5lZWRsZXNzX3Bhc3NfYnlfdmFsdWUpKV0KK2ZuIHZlcmlmeV9leHBlY3RlZF9yZXN1bHQ8VDogRGVidWcgKyBQYXJ0aWFsRXEgKyBTaXplZD4oCisgICAgYWN0dWFsOiBSZXN1bHQ8VCwgdGhyaWZ0OjpFcnJvcj4sCisgICAgZXhwZWN0ZWQ6IFQsCispIC0+IFJlc3VsdDwoKSwgdGhyaWZ0OjpFcnJvcj4geworICAgIGluZm8hKCIqKiogRVhQRUNURUQ6IE9rKHs6P30pIiwgZXhwZWN0ZWQpOworICAgIGluZm8hKCIqKiogQUNUVUFMICA6IHs6P30iLCBhY3R1YWwpOworICAgIG1hdGNoIGFjdHVhbCB7CisgICAgICAgIE9rKHYpID0+IHsKKyAgICAgICAgICAgIGlmIHYgPT0gZXhwZWN0ZWQgeworICAgICAgICAgICAgICAgIGluZm8hKCIqKiogT0sgKioqIik7CisgICAgICAgICAgICAgICAgT2soKCkpCisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGluZm8hKCIqKiogRkFJTEVEICoqKiIpOworICAgICAgICAgICAgICAgIEVycih0aHJpZnQ6OkVycm9yOjpVc2VyKGZvcm1hdCEoImV4cGVjdGVkIHs6P30gYnV0IGdvdCB7Oj99IiwgJmV4cGVjdGVkLCAmdikuaW50bygpKSwpCisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgRXJyKGUpID0+IEVycihlKSwKKyAgICB9Cit9CmRpZmYgLS1naXQgYS90ZXN0L3JzL3NyYy9iaW4vdGVzdF9zZXJ2ZXIucn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ICBsZXQgc2VydmVyX3R5cGUgPSBtYXRjaGVzLnZhbHVlX29mKCJzZXJ2ZXJfdHlwZSIpLnVud3JhcF9vcigidGhyZWFkLXBvb2wiKTsKKyAgICBsZXQgd29ya2VycyA9IHZhbHVlX3QhKG1hdGNoZXMsICJ3b3JrZXJzIiwgdXNpemUpLnVud3JhcF9vcig0KTsKKyAgICBsZXQgbGlzdGVuX2FkZHJlc3MgPSBmb3JtYXQhKCIxMjcuMC4wLjE6e30iLCBwb3J0KTsKKworICAgIGluZm8hKCJiaW5kaW5nIHRvIHt9IiwgbGlzdGVuX2FkZHJlc3MpOworCisgICAgbGV0IChpX3RyYW5zcG9ydF9mYWN0b3J5LCBvX3RyYW5zcG9ydF9mYWN0b3J5KTogKEJveDxUUmVhZFRyYW5zcG9ydEZhY3Rvcnk+LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCb3g8VFdyaXRlVHJhbnNwb3J0RmFjdG9yeT4pID0KKyAgICAgICAgbWF0Y2ggJip0cmFuc3BvcnQgeworICAgICAgICAgICAgImJ1ZmZlcmVkIiA9PiB7CisgICAgICAgICAgICAgICAgKEJveDo6bmV3KFRCdWZmZXJlZFJlYWRUcmFuc3BvcnRGYWN0b3J5OjpuZXcoKSksCisgICAgICAgICAgICAgICAgIEJveDo6bmV3KFRCdWZmZXJlZFdyaXRlVHJhbnNwb3J0RmFjdG9yeTo6bmV3KCkpKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgImZyYW1lZCIgPT4geworICAgICAgICAgICAgICAgIChCb3g6Om5ldyhURnJhbWVkUmVhZFRyYW5zcG9ydEZhY3Rvcnk6Om5ldygpKSwKKyAgICAgICAgICAgICAgICAgQm94OjpuZXcoVEZyYW1lZFdyaXRlVHJhbnNwb3J0RmFjdG9yeTo6bmV3KCkpKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdW5rbm93biA9PiB7CisgICAgICAgICAgICAgICAgcmV0dXJuIEVycihmb3JtYXQhKCJ1bnN1cHBvcnRlZCB0cmFuc3BvcnQgdHlwZSB7fSIsIHVua25vd24pLmludG8oKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisKKyAgICBsZXQgKGlfcHJvdG9jb2xfZmFjdG9yeSwgb19wcm90b2NvbF9mYWN0b3J5KTogKEJveDxUSW5wdXRQcm90b2NvbEZhY3Rvcnk+LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQm94PFRPdXRwdXRQcm90b2NvbEZhY3Rvcnk+KSA9CisgICAgICAgIG1hdGNoICYqcHJvdG9jb2wgeworICAgICAgICAgICAgImJpbmFyeSIgfCAibXVsdGkiIHwgIm11bHRpOmJpbmFyeSIgPT4geworICAgICAgICAgICAgICAgIChCb3g6Om5ldyhUQmluYXJ5SW5wdXRQcm90b2NvbEZhY3Rvcnk6Om5ldygpKSwKKyAgICAgICAgICAgICAgICAgQm94OjpuZXcoVEJpbmFyeU91dHB1dFByb3RvY29sRmFjdG9yeTo6bmV3KCkpKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgImNvbXBhY3QiIHwgIm11bHRpYyIgfCAibXVsdGk6Y29tcGFjdCIgPT4geworICAgICAgICAgICAgICAgIChCb3g6Om5ldyhUQ29tcGFjdElucHV0UHJvdG9jb2xGYWN0b3J5OjpuZXcoKSksCisgICAgICAgICAgICAgICAgIEJveDo6bmV3KFRDb21wYWN0T3V0cHV0UHJvdG9jb2xGYWN0b3J5OjpuZXcoKSkpCisgICAgICAgICAgICB9CisgICAgICAgICAgICB1bmtub3duID0+IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gRXJyKGZvcm1hdCEoInVuc3VwcG9ydGVkIHRyYW5zcG9ydCB0eXBlIHt9IiwgdW5rbm93bikuaW50bygpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworICAgIGxldCB0ZXN0X3Byb2Nlc3NvciA9IFRocmlmdFRlc3RTeW5jUHJvY2Vzc29yOjpuZXcoVGhyaWZ0VGVzdFN5bmNIYW5kbGVySW1wbCB7fSk7CisKKyAgICBtYXRjaCAmKnNlcnZlcl90eXBlIHsKKyAgICAgICAgInNpbXBsZSIgfCAidGhyZWFkLXBvb2wiID0+IHsKKyAgICAgICAgICAgIGlmIHByb3RvY29sID09ICJtdWx0aSIgfHwgcHJvdG9jb2wgPT0gIm11bHRpYyIgeworICAgICAgICAgICAgICAgIGxldCBzZWNvbmRfc2VydmljZV9wcm9jZXNzb3IgPSBTZWNvbmRTZXJ2aWNlU3luY1Byb2Nlc3Nvcjo6bmV3KFNlY29uZFNlcnZpY2VTeW5jSGFuZGxlckltcGwge30sKTsKKworICAgICAgICAgICAgICAgIGxldCBtdXQgbXVsdGlwbGV4ZWRfcHJvY2Vzc29yID0gVE11bHRpcGxleGVkUHJvY2Vzc29yOjpuZXcoKTsKKyAgICAgICAgICAgICAgICBtdWx0aXBsZXhlZF9wcm9jZXNzb3IKKyAgICAgICAgICAgICAgICAgICAgLnJlZ2lzdGVyKCJUaHJpZnRUZXN0IiwgQm94OjpuZXcodGVzdF9wcm9jZXNzb3IpLCB0cnVlKT87CisgICAgICAgICAgICAgICAgbXVsdGlwbGV4ZWRfcHJvY2Vzc29yCisgICAgICAgICAgICAgICAgICAgIC5yZWdpc3RlcigiU2Vjb25kU2VydmljZSIsIEJveDo6bmV3KHNlY29uZF9zZXJ2aWNlX3Byb2Nlc3NvciksIGZhbHNlKT87CisKKyAgICAgICAgICAgICAgICBsZXQgbXV0IHNlcnZlciA9IFRTZXJ2ZXI6Om5ldygKKyAgICAgICAgICAgICAgICAgICAgaV90cmFuc3BvcnRfZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgaV9wcm90b2NvbF9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICBvX3RyYW5zcG9ydF9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICBvX3Byb3RvY29sX2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgIG11bHRpcGxleGVkX3Byb2Nlc3NvciwKKyAgICAgICAgICAgICAgICAgICAgd29ya2VycywKKyAgICAgICAgICAgICAgICApOworCisgICAgICAgICAgICAgICAgc2VydmVyLmxpc3RlbigmbGlzdGVuX2FkZHJlc3MpCisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGxldCBtdXQgc2VydmVyID0gVFNlcnZlcjo6bmV3KAorICAgICAgICAgICAgICAgICAgICBpX3RyYW5zcG9ydF9mYWN0b3J5LAorICAgICAgICAgICAgICAgICAgICBpX3Byb3RvY29sX2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgIG9fdHJhbnNwb3J0X2ZhY3RvcnksCisgICAgICAgICAgICAgICAgICAgIG9fcHJvdG9jb2xfZmFjdG9yeSwKKyAgICAgICAgICAgICAgICAgICAgdGVzdF9wcm9jZXNzb3IsCisgICAgICAgICAgICAgICAgICAgIHdvcmtlcnMsCisgICAgICAgICAgICAgICAgKTsKKworICAgICAgICAgICAgICAgIHNlcnZlci5saXN0ZW4oJmxpc3Rlbl9hZGRyZXNzKQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHVua25vd24gPT4gRXJyKGZvcm1hdCEoInVuc3VwcG9ydGVkIHNlcnZlciB0eXBlIHt9IiwgdW5rbm93bikuaW50bygpKSwKKyAgICB9Cit9CisKK3N0cnVjdCBUaHJpZnRUZXN0U3luY0hhbmRsZXJJbXBsOworaW1wbCBUaHJpZnRUZXN0U3luY0hhbmRsZXIgZm9yIFRocmlmdFRlc3RTeW5jSGFuZGxlckltcGwgeworICAgIGZuIGhhbmRsZV90ZXN0X3ZvaWQoJnNlbGYpIC0+IHRocmlmdDo6UmVzdWx0PCgpPiB7CisgICAgICAgIGluZm8hKCJ0ZXN0Vm9pZCgpIik7CisgICAgICAgIE9rKCgpKQorICAgIH0KKworICAgIGZuIGhhbmRsZV90ZXN0X3N0cmluZygmc2VsZiwgdGhpbmc6IFN0cmluZykgLT4gdGhyaWZ0Oj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xCVHJlZU1hcDxpMzIsIEJUcmVlTWFwPGkzMiwgaTMyPj4+IHsKKyAgICAgICAgaW5mbyEoInRlc3RNYXBNYXAoe30pIiwgaGVsbG8pOworCisgICAgICAgIGxldCBtdXQgaW5uZXJfbWFwXzA6IEJUcmVlTWFwPGkzMiwgaTMyPiA9IEJUcmVlTWFwOjpuZXcoKTsKKyAgICAgICAgZm9yIGkgaW4gLTQuLigwIGFzIGkzMikgeworICAgICAgICAgICAgaW5uZXJfbWFwXzAuaW5zZXJ0KGksIGkpOworICAgICAgICB9CisKKyAgICAgICAgbGV0IG11dCBpbm5lcl9tYXBfMTogQlRyZWVNYXA8aTMyLCBpMzI+ID0gQlRyZWVNYXA6Om5ldygpOworICAgICAgICBmb3IgaSBpbiAxLi41IHsKKyAgICAgICAgICAgIGlubmVyX21hcF8xLmluc2VydChpLCBpKTsKKyAgICAgICAgfQorCisgICAgICAgIGxldCBtdXQgcmV0X21hcDogQlRyZWVNYXA8aTMyLCBCVHJlZU1hcDxpMzIsIGkzMj4+ID0gQlRyZWVNYXA6Om5ldygpOworICAgICAgICByZXRfbWFwLmluc2VydCgtNCwgaW5uZXJfbWFwXzApOworICAgICAgICByZXRfbWFwLmluc2VydCg0LCBpbm5lcl9tYXBfMSk7CisKKyAgICAgICAgT2socmV0X21hcCkKKyAgICB9CisKKyAgICAvLy8gQ3JlYXRlcyBhIHRoZSByZXR1cm5lZCBtYXAgd2l0aCB0aGVzZSB2YWx1ZXMgYW5kIHByaW50cyBpdCBvdXQ6CisgICAgLy8vICAgICB7IDEgPT4geyAyID0+IGFyZ3VtZW50LAorICAgIC8vLyAgICAgICAgICAgICAgMyA9PiBhcmd1bWVudCwKKyAgICAvLy8gICAgICAgICAgICB9LAorICAgIC8vLyAgICAgICAyID0+IHsgNiA9PiA8ZW1wdHkgSW5zYW5pdHkgc3RydWN0PiwgfSwKKyAgICAvLy8gICAgIH0KKyAgICAvLy8gcmV0dXJuIG1hcDxVc2VySWQsIG1hcDxOdW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ICBpbmZvISgidGVzdEV4Y2VwdGlvbih7fSkiLCBhcmcpOworCisgICAgICAgIG1hdGNoICYqYXJnIHsKKyAgICAgICAgICAgICJYY2VwdGlvbiIgPT4geworICAgICAgICAgICAgICAgIEVycigKKyAgICAgICAgICAgICAgICAgICAgKFhjZXB0aW9uIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfY29kZTogU29tZSgxMDAxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogU29tZShhcmcpLAorICAgICAgICAgICAgICAgICAgICAgICAgIH0pCisgICAgICAgICAgICAgICAgICAgICAgICAuaW50bygpLAorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICJURXhjZXB0aW9uIiA9PiBFcnIoInRoaXMgaXMgYSByYW5kb20gZXJyb3IiLmludG8oKSksCisgICAgICAgICAgICBfID0+IE9rKCgpKSwKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vLyBpZiBhcmcwID09ICJYY2VwdGlvbiI6CisgICAgLy8vIHRocm93IFhjZXB0aW9uIHdpdGggZXJyb3JDb2RlID0gMTAwMSBhbmQgbWVzc2FnZSA9ICJUaGlzIGlzIGFuCisgICAgLy8vIFhjZXB0aW9uIgorICAgIC8vLyBlbHNlIGlmIGFyZzAgPT0gIlhjZXB0aW9uMiI6CisgICAgLy8vIHRocm93IFhjZXB0aW9uMiB3aXRoIGVycm9yQ29kZSA9IDIwMDIgYW5kIHN0cnVjdF90aGluZy5zdHJpbmdfdGhpbmcgPQorICAgIC8vLyAiVGhpcyBpcyBhbiBYY2VwdGlvbjIiCisgICAgLy8gZWxzZToKKyAgICAvLyAgIGRvIG5vdCB0aHJvdyBhbnl0aGluZyBhbmQgcmV0dXJuIFh0cnVjdCB3aXRoIHN0cmluZ190aGluZyA9IGFyZzEKKyAgICBmbiBoYW5kbGVfdGVzdF9tdWx0aV9leGNlcHRpb24oJnNlbGYsIGFyZzA6IFN0cmluZywgYXJnMTogU3RyaW5nKSAtPiB0aHJpZnQ6OlJlc3VsdDxYdHJ1Y3Q+IHsKKyAgICAgICAgbWF0Y2ggJiphcmcwIHsKKyAgICAgICAgICAgICJYY2VwdGlvbiIgPT4geworICAgICAgICAgICAgICAgIEVycigKKyAgICAgICAgICAgICAgICAgICAgKFhjZXB0aW9uIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfY29kZTogU29tZSgxMDAxKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogU29tZSgiVGhpcyBpcyBhbiBYY2VwdGlvbiIudG9fb3duZWQoKSksCisgICAgICAgICAgICAgICAgICAgICAgICAgfSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5pbnRvKCksCisgICAgICAgICAgICAgICAgKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgIlhjZXB0aW9uMiIgPT4geworICAgICAgICAgICAgICAgIEVycigKKyAgICAgICAgICAgICAgICAgICAgKFhjZXB0aW9uMiB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yX2NvZGU6IFNvbWUoMjAwMiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdF90aGluZzogU29tZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBYdHJ1Y3QgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmdfdGhpbmc6IFNvbWUoIlRoaXMgaXMgYW4gWGNlcHRpb24yIi50b19vd25lZCgpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnl0ZV90aGluZzogTm9uZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTMyX3RoaW5nOiBOb25lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpNjRfdGhpbmc6IE5vbmUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICksCisgICAgICAgICAgICAgICAgICAgICAgICAgfSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5pbnRvKCksCisgICAgICAgICAgICAgICAgKQorICAgICAgICAgICAgfQorICAgICAgICAgICAgXyA9PiB7CisgICAgICAgICAgICAgICAgT2soCisgICAgICAgICAgICAgICAgICAgIFh0cnVjdCB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmdfdGhpbmc6IFNvbWUoYXJnMSksCisgICAgICAgICAgICAgICAgICAgICAgICBieXRlX3RoaW5nOiBOb25lLAorICAgICAgICAgICAgICAgICAgICAgICAgaTMyX3RoaW5nOiBOb25lLAorICAgICAgICAgICAgICAgICAgICAgICAgaTY0X3RoaW5nOiBOb25lLAorICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICkKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGZuIGhhbmRsZV90ZXN0X29uZXdheSgmc2VsZiwgc2Vjb25kc190b19zbGVlcDogaTMyKSAtPiB0aHJpZnQ6OlJlc3VsdDwoKT4geworICAgICAgICB0aHJlYWQ6OnNsZWVwKER1cmF0aW9uOjpmcm9tX3NlY3Moc2Vjb25kc190b19zbGVlcCBhcyB1NjQpKTsKKyAgICAgICAgT2soKCkpCisgICAgfQorfQorCitzdHJ1Y3QgU2Vjb25kU2VydmljZVN5bmNIYW5kbGVySW1wbDsKK2ltcGwgU2Vjb25kU2VydmljZVN5bmNIYW5kbGVyIGZvciBTZWNvbmRTZXJ2aWNlU3luY0hhbmRsZXJJbXBsIHsKKyAgICBmbiBoYW5kbGVfc2Vjb25kdGVzdF9zdHJpbmcoJnNlbGYsIHRoaW5nOiBTdHJpbmcpIC0+IHRocmlmdDo6UmVzdWx0PFN0cmluZz4geworICAgICAgICBpbmZvISgiKHNlY29uZCl0ZXN0U3RyaW5nKHt9KSIsICZ0aGluZyk7CisgICAgICAgIGxldCByZXQgPSBmb3JtYXQhKCJ0ZXN0U3RyaW5nKFwie31cIikiLCAmdGh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S4yNSkgKyAxCisKKworZGVmIG1haW4oYXJndik6CisgICAgcGFyc2VyID0gYXJncGFyc2UuQXJndW1lbnRQYXJzZXIoKQorICAgIHBhcnNlci5hZGRfYXJndW1lbnQoJy0tc2VydmVyJywgZGVmYXVsdD0nJywgbmFyZ3M9JyonLAorICAgICAgICAgICAgICAgICAgICAgICAgaGVscD0nbGlzdCBvZiBzZXJ2ZXJzIHRvIHRlc3QnKQorICAgIHBhcnNlci5hZGRfYXJndW1lbnQoJy0tY2xpZW50JywgZGVmYXVsdD0nJywgbmFyZ3M9JyonLAorICAgICAgICAgICAgICAgICAgICAgICAgaGVscD0nbGlzdCBvZiBjbGllbnRzIHRvIHRlc3QnKQorICAgIHBhcnNlci5hZGRfYXJndW1lbnQoJy1GJywgJy0tZmVhdHVyZXMnLCBuYXJncz0nKicsIGRlZmF1bHQ9Tm9uZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGhlbHA9J3J1biBzZXJ2ZXIgZmVhdHVyZSB0ZXN0cyBpbnN0ZWFkIG9mIGNyb3NzIGxhbmd1YWdlIHRlc3RzJykKKyAgICBwYXJzZXIuYWRkX2FyZ3VtZW50KCctUicsICctLXJlZ2V4JywgaGVscD0ndGVzdCBuYW1lIHBhdHRlcm4gdG8gcnVuJykKKyAgICBwYXJzZXIuYWRkX2FyZ3VtZW50KCctbycsICctLW9ubHkta25vd25fZmFpbHVyZXMnLCBhY3Rpb249J3N0b3JlX3RydWUnLCBkZXN0PSdvbmx5X2tub3duX2ZhaWx1cmVzJywKKyAgICAgICAgICAgICAgICAgICAgICAgIGhlbHA9J29ubHkgZXhlY3V0ZSB0ZXN0cyB0aGF0IGFyZSBrbm93biB0byBmYWlsJykKKyAgICBwYXJzZXIuYWRkX2FyZ3VtZW50KCctcycsICctLXNraXAta25vd24tZmFpbHVyZXMnLCBhY3Rpb249J3N0b3JlX3RydWUnLCBkZXN0PSdza2lwX2tub3duX2ZhaWx1cmVzJywKKyAgICAgICAgICAgICAgICAgICAg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ICAgZGlyZSA9IHBhdGhfam9pbihST09UX0RJUiwgRkVBVFVSRV9ESVJfUkVMQVRJVkUpIGlmIG9wdGlvbnMuZmVhdHVyZXMgaXMgbm90IE5vbmUgZWxzZSBURVNUX0RJUgorICAgICAgICByZXMgPSBjcm9zc3J1bm5lci5nZW5lcmF0ZV9rbm93bl9mYWlsdXJlcygKKyAgICAgICAgICAgIGRpcmUsIG9wdGlvbnMudXBkYXRlX2ZhaWx1cmVzID09ICdvdmVyd3JpdGUnLAorICAgICAgICAgICAgb3B0aW9ucy51cGRhdGVfZmFpbHVyZXMsIG9wdGlvbnMucHJpbnRfZmFpbHVyZXMpCisgICAgZWxpZiBvcHRpb25zLmZlYXR1cmVzIGlzIG5vdCBOb25lOgorICAgICAgICBmZWF0dXJlcyA9IG9wdGlvbnMuZmVhdHVyZXMgb3IgWycuKiddCisgICAgICAgIHJlcyA9IHJ1bl9mZWF0dXJlX3Rlc3RzKHNlcnZlcl9tYXRjaCwgZmVhdHVyZXMsIG9wdGlvbnMuam9icywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5za2lwX2tub3duX2ZhaWx1cmVzLCBvcHRpb25zLm9ubHlfa25vd25fZmFpbHVyZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmV0cnlfY291bnQsIG9wdGlvbnMucmVnZXgpCisgICAgZWxzZToKKyAgICAgICAgcmVzID0gcnVuX2Nyb3NzX3Rlc3RzKHNlcnZlcl9tYXRjaCwgY2xpZW50X21hdGNoLCBvcHRpb25zLmpvYnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLnNraXBfa25vd25fZmFpbHVyZXMsIG9wdGlvbnMub25seV9rbm93bl9mYWlsdXJlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnMucmV0cnlfY291bnQsIG9wdGlvbnMucmVnZXgpCisgICAgcmV0dXJuIDAgaWYgcmVzIGVs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IG5vZGVqcy8gc2VydmVyIiBcCi0gICAgICAgICIxIiAiNSIKLQotY2QgLQpkaWZmIC0tZ2l0IGEvdGVzdC90ZXN0cy5qc29uIGIvdGVzdC90ZXN0cy5qc29uCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjQzZDZkZWQKLS0tIC9kZXYvbnVsbAorKysgYi90ZXN0L3Rlc3RzLmpzb24KQEAgLTAsMCArMSw3NDkgQEAKK1sKKyAgeworICAgICJuYW1lIjogImNfZ2xpYiIsCisgICAgInBsYXRmb3JtcyI6IFsKKyAgICAgICJMaW51eCIKKyAgICBdLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInRlc3Rfc2VydmVyIiwKKyAgICAgICAgIi0tbHQtZGVidWciCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgImJpbmFyeTptdWx0aSIsCisgICAgICAgICJjb21wYWN0Om11bHRpYyIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInRlc3RfY2xpZW50IiwKKyAgICAgICAgIi0tbHQtZGVidWciCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgIm11bHRpOmJpbmFyeSIsCisgICAgICAgICJtdWx0aWM6Y29tcGFjdCIKKyAgICAgIF0sCisgICAgICAic29ja2V0cyI6IFsKKyAgICAgICAgImlwLXNzbCIKKyAgICAgIF0KKyAgICB9LAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJjb21wYWN0IiwKKyAgICAgICJtdWx0aSIsCisgICAgICAibXVsdGljIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiY19nbGliIgorICB9LAorICB7CisgICAgIm5hbWUiOiAiY2wiLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiY29tbWFuZCI6IFsiVGVzdFNlcnZlciJdLAorICAgICAgIndvcmtkaXIiOiAiY2wiLAorICAgICAgInByb3RvY29scyI6IFsiYmluYXJ5IiwgIm11bHRpIl0sCisgICAgICAidHJhbnNwb3J0cyI6IFsiYnVmZmVyZWQiLCAiZnJhbWVkIl0sCisgICAgICAic29ja2V0cyI6IFsiaXAiXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJjb21tYW5kIjogWyJUZXN0Q2xpZW50Il0sCisgICAgICAid29ya2RpciI6ICJjbCIsCisgICAgICAicHJvdG9jb2xzIjogWyJiaW5hcnkiLCAibXVsdGkiXSwKKyAgICAgICJ0cmFuc3BvcnRzIjogWyJidWZmZXJlZCIsICJmcmFtZWQiXSwKKyAgICAgICJzb2NrZXRzIjogWyJpcCJdCisgICAgfQorICB9LAorICB7CisgICAgIm5hbWUiOiAiZCIsCisgICAgInNlcnZlciI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAidGhyaWZ0X3Rlc3Rfc2VydmVyIiwKKyAgICAgICAgIi0tdHJhY2UiCisgICAgICBdCisgICAgfSwKKyAgICAiY2xpZW50IjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJ0aHJpZnRfdGVzdF9jbGllbnQiCisgICAgICBdCisgICAgfSwKKyAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICJodHRwIiwKKyAgICAgICJidWZmZXJlZCIsCisgICAgICAiZnJhbWVkIgorICAgIF0sCisgICAgInNvY2tldHMiOiBbCisgICAgICAiaXAiLAorICAgICAgImlwLXNzbCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJjb21wYWN0IiwKKyAgICAgICJqc29uIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiLi4vbGliL2QvdGVzdCIKKyAgfSwKKyAgeworICAgICJuYW1lIjogImdvIiwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJ0ZXN0c2VydmVyIiwKKyAgICAgICAgIi0tY2VydFBhdGg9Li4vLi4va2V5cyIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAidGltZW91dCI6IDYsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInRlc3RjbGllbnQiCisgICAgICBdCisgICAgfSwKKyAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICJidWZmZXJlZCIsCisgICAgICAiZnJhbWVkIiwKKyAgICAgICJodHRwIiwKKyAgICAgICJ6bGliIgorICAgIF0sCisgICAgInNvY2tldHMiOiBbCisgICAgICAiaXAiLAorICAgICAgImlwLXNzbCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJjb21wYWN0IiwKKyAgICAgICJqc29uIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiZ28vYmluIgorICB9LAorICB7CisgICAgIm5hbWUiOiAiamF2YSIsCisgICAgImpvaW5fYXJncyI6IGZhbHNlLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiZGVsYXkiOiAxNSwKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAiYnVpbGQvcnVuc2VydmVyIgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJiaW5hcnk6bXVsdGkiLAorICAgICAgICAiY29tcGFjdDptdWx0aWMiLAorICAgICAgICAianNvbjptdWx0aWoiCisgICAgICBdCisgICAgfSwKKyAgICAiY2xpZW50IjogeworICAgICAgInRpbWVvdXQiOiAxMywKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAiYnVpbGQvcnVuY2xpZW50IgorICAgICAgXSwKKyAgICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgICAiaHR0cCIKKyAgICAgIF0sCisgICAgICAicHJvdG9jb2xzIjogWworICAgICAgICAibXVsdGk6YmluYXJ5IiwKKyAgICAgICAgIm11bHRpYzpjb21wYWN0IiwKKyAgICAgICAgIm11bHRpajpqc29uIgorICAgICAgXQorICAgIH0sCisgICAgInRyYW5zcG9ydHMiOiBbCisgICAgICAiYnVmZmVyZWQiLAorICAgICAgImZyYW1lZCIsCisgICAgICAiZnJhbWVkOmZhc3RmcmFtZWQiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIsCisgICAgICAiaXAtc3NsIgorICAgIF0sCisgICAgInByb3RvY29scyI6IFsKKyAgICAgICJiaW5hcnkiLAorICAgICAgImNvbXBhY3QiLAorICAgICAgImpzb24iLAorICAgICAgIm11bHRpIiwKKyAgICAgICJtdWx0aWMiLAorICAgICAgIm11bHRpaiIKKyAgICBdLAorICAgICJ3b3JrZGlyIjogIi4uL2xpYi9qYXZhIgorICB9LAorICB7CisgICAgIm5hbWUiOiAibm9kZWpzIiwKKyAgICAiZW52IjogeworICAgICAgIk5PREVfUEFUSCI6ICIuLi9saWIiCisgICAgfSwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJub2RlIiwKKyAgICAgICAgInNlcnZlci5qcyIsCisgICAgICAgICItLXR5cGU9dGNwIgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogNiwKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAibm9kZSIsCisgICAgICAgICJjbGllbnQuanMiLAorICAgICAgICAiLS10eXBlPXRjcCIKKyAgICAgIF0KKyAgICB9LAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiLAorICAgICAgImh0dHAiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIsCisgICAgICAiaXAtc3NsIiwKKyAgICAgICJkb21haW4iCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImNvbXBhY3QiLAorICAgICAgImJpbmFyeSIsCisgICAgICAianNvbiIKKyAgICBdLAorICAgICJ3b3JrZGlyIjogIi4uL2xpYi9ub2RlanMvdGVzdCIKKyAgfSwKKyAgeworICAgICJuYW1lIjogImhzIiwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJUZXN0U2VydmVyIgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogNiwKKyAgICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgICAiaHR0cCIKKyAgICAgIF0sCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgIlRlc3RDbGllbnQiCisgICAgICBdCisgICAgfSwKKyAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICJidWZmZXJlZCIsCisgICAgICAiZnJhbWVkIgorICAgIF0sCisgICAgInNvY2tldHMiOiBbCisgICAgICAiaXAiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImhlYWRlciIsCisgICAgICAiY29tcGFjdCIsCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJqc29uIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiaHMiCisgIH0sCisgIHsKKyAgICAibmFtZSI6ICJweSIsCisgICAgInNlcnZlciI6IHsKKyAgICAgICJleHRyYV9hcmdzIjogWyJUU2ltcGxlU2VydmVyIl0sCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgIlRlc3RTZXJ2ZXIucHkiLAorICAgICAgICAiLS12ZXJib3NlIiwKKyAgICAgICAgIi0tZ2VucHlkaXI9Z2VuLXB5IgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogMTAsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgIlRlc3RDbGllbnQucHkiLAorICAgICAgICAiLS12ZXJib3NlIiwKKyAgICAgICAgIi0taG9zdD1sb2NhbGhvc3QiLAorICAgICAgICAiLS1nZW5weWRpcj1nZW4tcHkiCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgIm11bHRpIiwKKyAgICAgICAgIm11bHRpOm11bHRpYSIsCisgICAgICAgICJtdWx0aWMiLAorICAgICAgICAibXVsdGljOm11bHRpYWMiLAorICAgICAgICAibXVsdGlqIgorICAgICAgXQorICAgIH0sCisgICAgInRyYW5zcG9ydHMiOiBbCisgICAgICAiYnVmZmVyZWQiLAorICAgICAgImZyYW1lZCIsCisgICAgICAiaHR0cCIsCisgICAgICAiemxpYiIKKyAgICBdLAorICAgICJzb2NrZXRzIjogWworICAgICAgImlwIiwKKyAgICAgICJpcC1zc2wiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImNvbXBhY3QiLAorICAgICAgImJpbmFyeSIsCisgICAgICAianNvbiIsCisgICAgICAiYmluYXJ5OmFjY2VsIiwKKyAgICAgICJjb21wYWN0OmFjY2VsYyIsCisgICAgICAiaGVhZGVyIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAicHkiCisgIH0sCisgIHsKKyAgICAiY29tbWVudCI6ICJVc2luZyAncHl0aG9uMycgZXhlY3V0YWJsZSB0byB0ZXN0IHB5MiBhbmQgMyBhdCBvbmNlIiwKKyAgICAibmFtZSI6ICJweTMiLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiZXh0cmFfYXJncyI6IFsiVFNpbXBsZVNlcnZlciJdLAorICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJweXRob24zIiwKKyAgICAgICAgIlRlc3RTZXJ2ZXIucHkiLAorICAgICAgICAiLS12ZXJib3NlIiwKKyAgICAgICAgIi0tZ2VucHlkaXI9Z2VuLXB5IgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogMTAsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInB5dGhvbjMiLAorICAgICAgICAiVGVzdENsaWVudC5weSIsCisgICAgICAgICItLWhvc3Q9bG9jYWxob3N0IiwKKyAgICAgICAgIi0tZ2VucHlkaXI9Z2VuLXB5IgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJtdWx0aSIsCisgICAgICAgICJtdWx0aTptdWx0aWEiLAorICAgICAgICAibXVsdGljIiwKKyAgICAgICAgIm11bHRpYzptdWx0aWFjIiwKKyAgICAgICAgIm11bHRpaiIKKyAgICAgIF0KKyAgICB9LAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiLAorICAgICAgImh0dHAiLAorICAgICAgInpsaWIiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIsCisgICAgICAiaXAtc3NsIgorICAgIF0sCisgICAgInByb3RvY29scyI6IFsKKyAgICAgICJjb21wYWN0IiwKKyAgICAgICJiaW5hcnkiLAorICAgICAgImpzb24iLAorICAgICAgImJpbmFyeTphY2NlbCIsCisgICAgICAiY29tcGFjdDphY2NlbGMiLAorICAgICAgImhlYWRlciIKKyAgICBdLAorICAgICJ3b3JrZGlyIjogInB5IgorICB9LAorICB7CisgICAgIm5hbWUiOiAiY3BwIiwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJUZXN0U2VydmVyIgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJiaW5hcnk6bXVsdGkiLAorICAgICAgICAiY29tcGFjdDptdWx0aWMiLAorICAgICAgICAiaGVhZGVyOm11bHRpaCIsCisgICAgICAgICJqc29uOm11bHRpaiIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAidGltZW91dCI6IDgsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgIlRlc3RDbGllbnQiCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgIm11bHRpOmJpbmFyeSIsCisgICAgICAgICJtdWx0aWM6Y29tcGFjdCIsCisgICAgICAgICJtdWx0aWg6aGVhZGVyIiwKKyAgICAgICAgIm11bHRpajpqc29uIgorICAgICAgXQorICAgIH0sCisgICAgInRyYW5zcG9ydHMiOiBbCisgICAgICAiYnVmZmVyZWQiLAorICAgICAgImh0dHAiLAorICAgICAgImZyYW1lZCIsCisgICAgICAiemxpYiIKKyAgICBdLAorICAgICJzb2NrZXRzIjogWworICAgICAgImlwIiwKKyAgICAgICJpcC1zc2wiLAorICAgICAgImRvbWFpbiIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAiY29tcGFjdCIsCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJqc29uIiwKKyAgICAgICJoZWFkZXIiLAorICAgICAgIm11bHRpIiwKKyAgICAgICJtdWx0aWMiLAorICAgICAgIm11bHRpaCIsCisgICAgICAibXVsdGlqIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiY3BwIgorICB9LAorICB7CisgICAgIm5hbWUiOiAicmIiLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInJ1YnkiLAorICAgICAgICAiLi4vaW50ZWdyYXRpb24vVGVzdFNlcnZlci5yYiIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAidGltZW91dCI6IDUsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInJ1YnkiLAorICAgICAgICAiLi4vaW50ZWdyYXRpb24vVGVzdENsaWVudC5yYiIsCisgICAgICAgICItLSIKKyAgICAgIF0KKyAgICB9LAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJkb21haW4iLAorICAgICAgImlwIiwKKyAgICAgICJpcC1zc2wiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImJpbmFyeSIsCisgICAgICAiYmluYXJ5OmFjY2VsIiwKKyAgICAgICJjb21wYWN0IiwKKyAgICAgICJqc29uIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAicmIvZ2VuLXJiIgorICB9LAorICB7CisgICAgIm5hbWUiOiAiY3NoYXJwIiwKKyAgICAiZW52IjogeworICAgICAgIk1PTk9fUEFUSCI6ICIuLi8uLi9saWIvY3NoYXJwLyIKKyAgICB9LAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIsCisgICAgICAiaXAtc3NsIgorICAgIF0sCisgICAgInByb3RvY29scyI6IFsKKyAgICAgICJiaW5hcnkiLAorICAgICAgImNvbXBhY3QiLAorICAgICAgImpzb24iCisgICAgXSwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJtb25vIiwKKyAgICAgICAgIlRlc3RDbGllbnRTZXJ2ZXIuZXhlIiwKKyAgICAgICAgInNlcnZlciIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAidGltZW91dCI6IDksCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgIm1vbm8iLAorICAgICAgICAiVGVzdENsaWVudFNlcnZlci5leGUiLAorICAgICAgICAiY2xpZW50IgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJtdWx0aSIsCisgICAgICAgICJtdWx0aWMiLAorICAgICAgICAibXVsdGk6YmluYXJ5IiwKKyAgICAgICAgIm11bHRpYzpjb21wYWN0IgorICAgICAgXQorICAgIH0sCisgICAgIndvcmtkaXIiOiAiY3NoYXJwIgorICB9LAorICB7CisgICAgIm5hbWUiOiAibmV0Y29yZSIsCisgICAgInRyYW5zcG9ydHMiOiBbCisgICAgICAiYnVmZmVyZWQiLAorICAgICAgImZyYW1lZCIKKyAgICBdLAorICAgICJzb2NrZXRzIjogWworICAgICAgImlwIiwKKyAgICAgICJpcC1zc2wiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImJpbmFyeSIsCisgICAgICAiY29tcGFjdCIsCisgICAgICAianNvbiIKKyAgICBdLAorICAgICJzZXJ2ZXIiOiB7CisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgImRvdG5ldCIsCisgICAgICAgICJydW4iLAorICAgICAgICAiLS1uby1idWlsZCIsCisgICAgICAgICItLXByb2plY3Q9U2VydmVyL1NlcnZlci5jc3Byb2oiLAorICAgICAgICAic2VydmVyIgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogMTAsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgImRvdG5ldCIsCisgICAgICAgICJydW4iLAorICAgICAgICAiLS1uby1idWlsZCIsCisgICAgICAgICItLXByb2plY3Q9Q2xpZW50L0NsaWVudC5jc3Byb2oiLAorICAgICAgICAiY2xpZW50IgorICAgICAgXQorICAgIH0sCisgICAgICAgICJ3b3JrZGlyIjogIm5ldGNvcmUiCisgIH0sCisgIHsKKyAgICAibmFtZSI6ICJwZXJsIiwKKyAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICJidWZmZXJlZCIsCisgICAgICAiZnJhbWVkIgorICAgIF0sCisgICAgInNvY2tldHMiOiBbCisgICAgICAiaXAiLAorICAgICAgImlwLXNzbCIsCisgICAgICAiZG9tYWluIgorICAgIF0sCisgICAgInByb3RvY29scyI6IFsKKyAgICAgICJiaW5hcnkiLAorICAgICAgIm11bHRpIgorICAgIF0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAicGVybCIsCisgICAgICAgICItSWdlbi1wZXJsLyIsCisgICAgICAgICItSS4uLy4uL2xpYi9wZXJsL2xpYi8iLAorICAgICAgICAiVGVzdENsaWVudC5wbCIsCisgICAgICAgICItLWNhPS4uL2tleXMvQ0EucGVtIiwKKyAgICAgICAgIi0tY2VydD0uLi9rZXlzL2NsaWVudC5jcnQiLAorICAgICAgICAiLS1rZXk9Li4va2V5cy9jbGllbnQua2V5IgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJtdWx0aTpiaW5hcnkiCisgICAgICBdCisgICAgfSwKKyAgICAic2VydmVyIjogeworICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJwZXJsIiwKKyAgICAgICAgIi1JZ2VuLXBlcmwvIiwKKyAgICAgICAgIi1JLi4vLi4vbGliL3BlcmwvbGliLyIsCisgICAgICAgICJUZXN0U2VydmVyLnBsIiwKKyAgICAgICAgIi0tY2VydD0uLi9rZXlzL3NlcnZlci5jcnQiLAorICAgICAgICAiLS1rZXk9Li4va2V5cy9zZXJ2ZXIua2V5IgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJiaW5hcnk6bXVsdGkiCisgICAgICBdCisgICAgfSwKKyAgICAid29ya2RpciI6ICJwZXJsIgorICB9LAorICB7CisgICAgIm5hbWUiOiAicGhwIiwKKyAgICAiY2xpZW50IjogeworICAgICAgInRpbWVvdXQiOiA2LAorICAgICAgInRyYW5zcG9ydHMiOiBbCisgICAgICAgICJidWZmZXJlZCIsCisgICAgICAgICJmcmFtZWQiCisgICAgICBdLAorICAgICAgInNvY2tldHMiOiBbCisgICAgICAgICJpcCIKKyAgICAgIF0sCisgICAgICAicHJvdG9jb2xzIjogWworICAgICAgICAiYmluYXJ5IiwKKyAgICAgICAgImNvbXBhY3QiLAorICAgICAgICAiYmluYXJ5OmFjY2VsIgorICAgICAgXSwKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAicGhwIiwKKyAgICAgICAgIi1kZXh0ZW5zaW9uX2Rpcj1waHBfZXh0X2RpciIsCisgICAgICAgICItLXBocC1pbmk9dGVzdF9waHAuaW5pIiwKKyAgICAgICAgIi0tbm8tcGhwLWluaSIsCisgICAgICAgICItZGRpc3BsYXlfZXJyb3JzPXN0ZGVyciIsCisgICAgICAgICItZGxvZ19lcnJvcnM9MCIsCisgICAgICAgICItZGVycm9yX3JlcG9ydGluZz1FX0FMTCIsCisgICAgICAgICJUZXN0Q2xpZW50LnBocCIKKyAgICAgIF0KKyAgICB9LAorICAgICJ3b3JrZGlyIjogInBocCIKKyAgfSwKKyAgeworICAgICJuYW1lIjogImRhcnQiLAorICAgICJjbGllbnQiOiB7CisgICAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICAgImZyYW1lZCIsCisgICAgICAgICJodHRwIgorICAgICAgXSwKKyAgICAgICJzb2NrZXRzIjogWworICAgICAgICAiaXAiCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgImJpbmFyeSIsCisgICAgICAgICJjb21wYWN0IiwKKyAgICAgICAgImpzb24iCisgICAgICBdLAorICAgICAgImNvbW1hbmQiOiBbCisgICAgICAgICJkYXJ0IiwKKyAgICAgICAgInRlc3RfY2xpZW50L2Jpbi9tYWluLmRhcnQiCisgICAgICBdCisgICAgfSwKKyAgICAid29ya2RpciI6ICJkYXJ0IgorICB9LAorICB7CisgICAgIm5hbWUiOiAiZXJsIiwKKyAgICAidHJhbnNwb3J0cyI6IFsKKyAgICAgICJidWZmZXJlZCIsCisgICAgICAiZnJhbWVkIgorICAgIF0sCisgICAgInNvY2tldHMiOiBbCisgICAgICAiaXAiLAorICAgICAgImlwLXNzbCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAiYmluYXJ5IiwKKyAgICAgICJjb21wYWN0IgorICAgIF0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAiZXJsIiwKKyAgICAgICAgIitLIiwKKyAgICAgICAgInRydWUiLAorICAgICAgICAiLW5vc2hlbGwiLAorICAgICAgICAiLXBhIiwKKyAgICAgICAgIi4uLy4uL2xpYi9lcmwvZWJpbi8iLAorICAgICAgICAiLXBhIiwKKyAgICAgICAgIi4vZWJpbiIsCisgICAgICAgICItcyIsCisgICAgICAgICJ0ZXN0X2NsaWVudCIsCisgICAgICAgICItcyIsCisgICAgICAgICJpbml0IiwKKyAgICAgICAgInN0b3AiLAorICAgICAgICAiLWV4dHJhIgorICAgICAgXQorICAgIH0sCisgICAgInNlcnZlciI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAiZXJsIiwKKyAgICAgICAgIitLIiwKKyAgICAgICAgInRydWUiLAorICAgICAgICAiLW5vc2hlbGwiLAorICAgICAgICAiLXBhIiwKKyAgICAgICAgIi4uLy4uL2xpYi9lcmwvZWJpbi8iLAorICAgICAgICAiLXBhIiwKKyAgICAgICAgIi4vZWJpbiIsCisgICAgICAgICItcyIsCisgICAgICAgICJ0ZXN0X3RocmlmdF9zZXJ2ZXIiLAorICAgICAgICAiLWV4dHJhIgorICAgICAgXQorICAgIH0sCisgICAgIndvcmtkaXIiOiAiZXJsIgorICB9LAorICB7CisgICAgIm5hbWUiOiAianMiLAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImh0dHAiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIKKyAgICBdLAorICAgICJwcm90b2NvbHMiOiBbCisgICAgICAianNvbiIKKyAgICBdLAorICAgICJjbGllbnQiOiB7CisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInBoYW50b21qcyIsCisgICAgICAgICJ0ZXN0L3BoYW50b20tY2xpZW50LmpzIgorICAgICAgXQorICAgIH0sCisgICAgIndvcmtkaXIiOiAiLi4vbGliL2pzIgorICB9LAorICB7CisgICAgIm5hbWUiOiAibHVhIiwKKyAgICAiVE9ETyI6ICJBZGQgZGxsIHRvIExVQV9DUEFUSCIsCisgICAgImVudiI6IHsKKyAgICAgICJMVUFfUEFUSCI6ICI7O2dlbi1sdWEvPy5sdWE7Li4vLi4vbGliL2x1YS8/Lmx1YSIsCisgICAgICAiTFVBX0NQQVRIIjogIjs7Li4vLi4vbGliL2x1YS8ubGlicy8/LnNvIgorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogNSwKKyAgICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgICAiYnVmZmVyZWQiLAorICAgICAgICAiZnJhbWVkIiwKKyAgICAgICAgImh0dHAiCisgICAgICBdLAorICAgICAgInNvY2tldHMiOiBbCisgICAgICAgICJpcCIKKyAgICAgIF0sCisgICAgICAicHJvdG9jb2xzIjogWworICAgICAgICAiYmluYXJ5IiwKKyAgICAgICAgImNvbXBhY3QiLAorICAgICAgICAianNvbiIKKyAgICAgIF0sCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgImx1YSIsCisgICAgICAgICJ0ZXN0X2Jhc2ljX2NsaWVudC5sdWEiCisgICAgICBdCisgICAgfSwKKyAgICAid29ya2RpciI6ICJsdWEiCisgIH0sCisgIHsKKyAgICAibmFtZSI6ICJycyIsCisgICAgImVudiI6IHsKKyAgICAgICJSVVNUX0JBQ0tUUkFDRSI6ICIxIiwKKyAgICAgICJSVVNUX0xPRyI6ICJpbmZvIgorICAgIH0sCisgICAgInNlcnZlciI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAidGVzdF9zZXJ2ZXIiCisgICAgICBdLAorICAgICAgInByb3RvY29scyI6IFsKKyAgICAgICAgImJpbmFyeTptdWx0aSIsCisgICAgICAgICJjb21wYWN0Om11bHRpYyIKKyAgICAgIF0KKyAgICB9LAorICAgICJjbGllbnQiOiB7CisgICAgICAidGltZW91dCI6IDYsCisgICAgICAiY29tbWFuZCI6IFsKKyAgICAgICAgInRlc3RfY2xpZW50IgorICAgICAgXSwKKyAgICAgICJwcm90b2NvbHMiOiBbCisgICAgICAgICJtdWx0aTpiaW5hcnkiLAorICAgICAgICAibXVsdGljOmNvbXBhY3QiCisgICAgICBdCisgICAgfSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIKKyAgICBdLAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIiwKKyAgICAgICJmcmFtZWQiCisgICAgXSwKKyAgICAicHJvdG9jb2xzIjogWworICAgICAgImJpbmFyeSIsCisgICAgICAiY29tcGFjdCIsCisgICAgICAibXVsdGkiLAorICAgICAgIm11bHRpYyIKKyAgICBdLAorICAgICJ3b3JrZGlyIjogInJzL2JpbiIKKyAgfSwKKyAgeworICAgICJuYW1lIjogIm5vZGV0cyIsCisgICAgImVudiI6IHsKKyAgICAgICJOT0RFX1BBVEgiOiAiLi4vbGliIgorICAgIH0sCisgICAgInNlcnZlciI6IHsKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAicnVuU2VydmVyLnNoIgorICAgICAgXQorICAgIH0sCisgICAgImNsaWVudCI6IHsKKyAgICAgICJ0aW1lb3V0IjogNiwKKyAgICAgICJjb21tYW5kIjogWworICAgICAgICAicnVuQ2xpZW50LnNoIgorICAgICAgXQorICAgIH0sCisgICAgInByb3RvY29scyI6IFsKKyAgICAgICJiaW5hcnkiCisgICAgXSwKKyAgICAic29ja2V0cyI6IFsKKyAgICAgICJpcCIKKyAgICBdLAorICAgICJ0cmFuc3BvcnRzIjogWworICAgICAgImJ1ZmZlcmVkIgorICAgIF0sCisgICAgIndvcmtkaXIiOiAiLi4vbGliL25vZGV0cy90ZXN0IgorICB9CitdCmRpZmYgLS1naXQgYS90ZXN0L3RocmVhZHMvVGhyZWFkc0NsaWVudC5jcHAgYi90ZXN0L3RocmVhZHMvVGhyZWFkc0NsaWVudC5jcHAKaW5kZXggNzBiMDhhZC4uOTMwNmEzZiAxMDA2NDQKLS0tIGEvdGVzdC90aHJlYWRzL1RocmVhZHNDbGllbnQuY3BwCisrKyBiL3Rlc3QvdGhyZWFkcy9UaHJlYWRzQ2xpZW50LmNwcApAQ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gPSBOVUxMOworICBJbnZhbGlkT3BlcmF0aW9uICppbnZhbGlkX29wZXJhdGlvbiA9IE5VTEw7CisKKyAgV29yayAqd29yazsKKworICBnaW50MzIgc3VtOworICBnaW50MzIgZGlmZjsKKworICBpbnQgZXhpdF9zdGF0dXMgPSAwOworCisjaWYgKCFHTElCX0NIRUNLX1ZFUlNJT04gKDIsIDM2LCAwKSkKKyAgZ190eXBlX2luaXQgKCk7CisjZW5kaWYKKworICBzb2NrZXQgICAgPSBnX29iamVjdF9uZXcgKFRIUklGVF9UWVBFX1NPQ0tFVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaG9zdG5hbWUiLCAgImxvY2FsaG9zdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgInBvcnQiLCAgICAgIDkwOTAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIHRyYW5zcG9ydCA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQlVGRkVSRURfVFJBTlNQT1JULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0cmFuc3BvcnQiLCBzb2NrZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisgIHByb3RvY29sICA9IGdfb2JqZWN0X25ldyAoVEhSSUZUX1RZUEVfQklOQVJZX1BST1RPQ09MLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0cmFuc3BvcnQiLCB0cmFuc3BvcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgdGhyaWZ0X3RyYW5zcG9ydF9vcGVuICh0cmFuc3BvcnQsICZlcnJvcik7CisKKworICAvKiBJbiB0aGUgQyAoR0xpYikgaW1wbGVtZW50YXRpb24gb2YgVGhyaWZ0LCBzZXJ2aWNlIG1ldGhvZHMgb24gdGhlCisgICAgIHNlcnZlciBhcmUgYWNjZXNzZWQgdmlhIGEgZ2VuZXJhdGVkIGNsaWVudCBjbGFzcyB0aGF0I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HV0cyAoInBpbmcoKSIpOworICB9CisKKyAgLyogU2VydmljZSBtZXRob2RzIHRoYXQgcmV0dXJuIGEgdmFsdWUgZG8gc28gYnkgcGFzc2luZyB0aGUgcmVzdWx0CisgICAgIGJhY2sgdmlhIGFuIG91dHB1dCBwYXJhbWV0ZXIgKGhlcmUsICJzdW0iKS4gKi8KKyAgaWYgKCFlcnJvciAmJiBjYWxjdWxhdG9yX2lmX2FkZCAoY2xpZW50LCAmc3VtLCAxLCAxLCAmZXJyb3IpKSB7CisgICAgcHJpbnRmICgiMSsxPSVkXG4iLCBzdW0pOworICB9CisKKyAgLyogVGhyaWZ0IHN0cnVjdHMgYXJlIGltcGxlbWVudGVkIGFzIEdPYmplY3RzLCB3aXRoIGVhY2ggb2YgdGhlCisgICAgIHN0cnVjdCdzIG1lbWJlcnMgZXhwb3NlZCBhcyBhbiBvYmplY3QgcHJvcGVydHkuICovCisgIHdvcmsgPSBnX29iamVjdF9uZXcgKFRZUEVfV09SSywgTlVMTCk7CisKKyAgaWYgKCFlcnJvcikgeworICAgIGdfb2JqZWN0X3NldCAod29yaywKKyAgICAgICAgICAgICAgICAgICJudW0xIiwgMSwKKyAgICAgICAgICAgICAgICAgICJudW0yIiwgMCwKKyAgICAgICAgICAgICAgICAgICJvcCIsICAgT1BFUkFUSU9OX0RJVklERSwKKyAgICAgICAgICAgICAgICAgIE5VTEwpOworCisgICAgLyogRXhjZXB0aW9ucyBhcmUgcGFzc2VkIGJhY2sgZnJvbSBzZXJ2aWNlIG1ldGhvZHMgaW4gYSBtYW5uZXIKKyAgICAgICBzaW1pbGFyIHRvIHJldHVybiB2YWx1ZXMuICovCisgICAgaWYgKGNhbGN1bGF0b3JfaWZfY2FsY3VsYXRlIChjbGllbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdvcmssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW52YWxpZF9vcGVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICBwdXRzICgiV2hvYT8gV2UgY2FuIGRpdmlkZSBieSB6ZXJvISIpOworICAgIH0KKyAgICBlbHNlIHsKKyAgICAgIGlmIChpbnZhbGlkX29wZXJhdGlvbikgeworICAgICAgICBnY2hhciAqd2h5OworCisgICAgICAgIC8qIExpa2Ugc3RydWN0cywgZXhjZXB0aW9ucyBhcmUgaW1wbGVtZW50ZWQgYXMgb2JqZWN0cyB3aXRoCisgICAgICAgICAgIHByb3BlcnRpZXMuICovCisgICAgICAgIGdfb2JqZWN0X2dldCAoaW52YWxpZF9vcGVyYXRpb24sICJ3aHkiLCAmd2h5LCBOVUxMKTsKKworICAgICAgICBwcmludGYgKCJJbnZhbGlkT3BlcmF0aW9uOiAlc1xuIiwgd2h5KTsKKworICAgICAgICBpZiAod2h5ICE9IE5VTEwpCisgICAgICAgICAgZ19mcmVlICh3aHkpOworICAgICAgICBnX29iamVjdF91bnJlZiAoaW52YWxpZF9vcGVyYXRpb24pOworICAgICAgICBpbnZhbGlkX29wZXJhdGlvbiA9IE5VTEw7CisgICAgICB9CisKKyAgICAgIGdfY2xlYXJfZXJyb3IgKCZlcnJvcik7CisgICAgfQorICB9CisKKyAgaWYgKCFlcnJvcikgeworICAgIC8qIFN0cnVjdCBvYmplY3RzIGNhbiBiZSByZXVzZWQgYWNyb3NzIG1ldGhvZCBpbnZvY2F0aW9ucy4gKi8KKyAgICBnX29iamVjdF9zZXQgKHdvcmssCisgICAgICAgICAgICAgICAgICAibnVtMSIsIDE1LAorICAgICAgICAgICAgICAgICAgIm51bTIiLCAxMCwKKyAgICAgICAgICAgICAgICAgICJvcCIsICAgT1BFUkFUSU9OX1NVQlRSQUNULAorICAgICAgICAgICAgICAgICAgTlVMTCk7CisKKyAgICBpZiAoY2FsY3VsYXRvcl9pZl9jYWxjdWxhdGUgKGNsaWVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZkaWZmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdvcmssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmaW52YWxpZF9vcGVyYXRpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmZXJyb3IpKSB7CisgICAgICBwcmludGYgKCIxNS0xMD0lZFxuIiwgZGlmZik7CisgICAgfQorICB9CisKKyAgZ19vYmplY3RfdW5yZWYgKHdvcmspOworCisgIGlmICghZXJyb3IpIHsKKyAgICBTaGFyZWRTdHJ1Y3QgKnNoYXJlZF9zdHJ1Y3Q7CisgICAgZ2NoYXIgKnZhbHVlOworCisgICAgc2hhcmVkX3N0cnVjdCA9IGdfb2JqZWN0X25ldyAoVFlQRV9TSEFSRURfU1RSVUNULCBOVUxMKTsKKworICAgIC8qIEFzIGRlZmluZWQgaW4gdGhlIFRocmlmdCBmaWxlLCB0aGUgQ2FsY3VsYXRvciBzZXJ2aWNlIGV4dGVuZHMKKyAgICAgICB0aGUgU2hhcmVkU2VydmljZSBzZXJ2aWNlLiBDb3JyZXNwb25kaW5nbHksIGluIHRoZSBnZW5lcmF0ZWQKKyAgICAgICBjb2RlIENhbGN1bGF0b3JJZiBpbmhlcml0cyBmcm9tIFNoYXJlZFNlcnZpY2VJZiwgYW5kIHRoZSBwYXJlbnQKKyAgICAgICBzZXJ2aWNlJ3MgbWV0aG9kcyBhcmUgYWNjZXNzaWJsZSB0aHJvdWdoIGEgc2ltcGxlIGNhc3QuICovCisgICAgaWYgKHNoYXJlZF9zZXJ2aWNlX2NsaWVudF9nZXRfc3RydWN0IChTSEFSRURfU0VSVklDRV9JRiAoY2xpZW50KSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzaGFyZWRfc3RydWN0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sIGF2YWlsYWJsZSBvbmxpbmUgYXQKKyAgIGh0dHBzOi8vZGV2ZWxvcGVyLmdub21lLm9yZy9nb2JqZWN0Ly4gKi8KKworI2RlZmluZSBUWVBFX1RVVE9SSUFMX0NBTENVTEFUT1JfSEFORExFUiBcCisgICh0dXRvcmlhbF9jYWxjdWxhdG9yX2hhbmRsZXJfZ2V0X3R5cGUgKCkpCisKKyNkZWZpbmUgVFVUT1JJQUxfQ0FMQ1VMQVRPUl9IQU5ETEVSKG9iaikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgKEdfVFlQRV9DSEVDS19JTlNUQU5DRV9DQVNUICgob2JqKSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX1RVVE9SSUFMX0NBTENVTEFUT1JfSEFORExFUiwgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUdXRvcmlhbENhbGN1bGF0b3JIYW5kbGVyKSkKKyNkZWZpbmUgVFVUT1JJQUxfQ0FMQ1VMQVRPUl9IQU5ETEVSX0NMQVNTKGMpICAgICAgICAgICAgICAgICAgICBcCisgIChHX1RZUEVfQ0hFQ0tfQ0xBU1NfQ0FTVCAoKGMpLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEVfVFVUT1JJQUxfQ0FMQ1VMQVRPUl9IQU5ETEVSLCAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUdXRvcmlhbENhbGN1bGF0b3JIYW5kbGVyQ2xhc3MpKQorI2RlZmluZSBJU19UVVRPUklBTF9DQUxDVUxBVE9SX0hBTkRMRVIob2JqKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAoR19UWVBFX0NIRUNLX0lOU1RBTkNFX1RZUEUgKChvYmopLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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BzZXJ2aWNlIG1ldGhvZCBjYW4gYWxzbyB0aHJvdyBhIGN1c3RvbSBleGNlcHRpb24gKHRoYXQgaXMsIG9uZQorICAgZGVmaW5lZCBpbiB0aGUgLnRocmlmdCBmaWxlKSBhbiBhZGRpdGlvbmFsIG91dHB1dCBwYXJhbWV0ZXIgd2lsbCBiZQorICAgcHJvdmlkZWQgKGhlcmUsICJvdWNoIikgdG8gaG9sZCBhbiBpbnN0YW5jZSBvZiB0aGUgZXhjZXB0aW9uLCB3aGVuCisgICBuZWNlc3NhcnkuIE5vdGUgdGhlcmUgd2lsbCBiZSBhIHNlcGFyYXRlIHBhcmFtZXRlciBhZGRlZCBmb3IgZWFjaAorICAgdHlwZSBvZiBleGNlcHRpb24gdGhlIG1ldGhvZCBjYW4gdGhyb3cuCisKKyAgIFVubGlrZSByZXR1cm4gdmFsdWVzLCBleGNlcHRpb24gb2JqZWN0cyBhcmUgbmV2ZXIgcHJlLWNyZWF0ZWQ7IHRoaXMKKyAgIGlzIGFsd2F5cyB0aGUgcmVzcG9uc2liaWxpdHkgb2YgdGhlIGhhbmRsZXIgbWV0aG9kLiAqLworc3RhdGljIGdib29sZWFuCit0dXRvcmlhbF9jYWxjdWxhdG9yX2hhbmRsZXJfY2FsY3VsYXRlIChDYWxjdWxhdG9ySWYgICAgICAqaWZhY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaW50MzIgICAgICAgICAgICAqX3JldHVybiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGdpbnQzMiAgICAgICBsb2dpZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFdvcmsgICAgICAgICp3LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW52YWxpZE9wZXJhdGlvbiAqKm91Y2gsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRXJyb3IgICAgIC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Niwgd2hpY2ggd2lsbCBjbG9iYmVyIHZhcmlhYmxlcyBhZGphY2VudCBvbiB0aGUKKyAgICAgc3RhY2suIFJlbWVtYmVyOiBJZiB5b3UncmUgcmV0cmlldmluZyBhbiBpbnRlZ2VyIHByb3BlcnR5IHRoZQorICAgICByZWNlaXZpbmcgdmFyaWFibGUgbXVzdCBiZSBvZiBlaXRoZXIgdHlwZSBnaW50IG9yIGdpbnQ2NCwgYXMKKyAgICAgYXBwcm9wcmlhdGUuICovCisgIGdfb2JqZWN0X2dldCAoKFdvcmsgKil3LAorICAgICAgICAgICAgICAgICJudW0xIiwgJm51bTEsCisgICAgICAgICAgICAgICAgIm51bTIiLCAmbnVtMiwKKyAgICAgICAgICAgICAgICAib3AiLCAgICZvcCwKKyAgICAgICAgICAgICAgICBOVUxMKTsKKworICBwcmludGYgKCJjYWxjdWxhdGUoJWQseyVkLCVkLCVkfSlcbiIsIGxvZ2lkLCBvcCwgbnVtMSwgbnVtMik7CisKKyAgc3dpdGNoIChvcCkgeworICBjYXNlIE9QRVJBVElPTl9BREQ6CisgICAgKl9yZXR1cm4gPSBudW0xICsgbnVtMjsKKyAgICBicmVhazsKKworICBjYXNlIE9QRVJBVElPTl9TVUJUUkFDVDoKKyAgICAqX3JldHVybiA9IG51bTEgLSBudW0yOworICAgIGJyZWFrOworCisgIGNhc2UgT1BFUkFUSU9OX01VTFRJUExZOgorICAgICpfcmV0dXJuID0gbnVtMSAqIG51bTI7CisgICAgYnJlYWs7CisKKyAgY2FzZSBPUEVSQVRJT05fRElWSURFOgorICAgIGlmIChudW0yID09IDApIHsKKyAgICAgIC8qIEZvciBlYWNoIGN1c3RvbSBleGNlcHRpb24gdHlwZSBhIHN1YmNsYXNzIG9mIFRocmlmdFN0cnVjdCBpcworICAgICAgICAgZ2VuZXJhdGVkIGJ5IHRoZSBUaHJpZnQgY29tcGlsZXIuIFRocm93IGFuIGV4Y2VwdGlvbiBieQorICAgICAgICAgc2V0dGluZyB0aGUgY29yc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AgICAgICAgICAgICAgICAgICAgICAgIndoeSIsICBnX3N0cmR1cCAoIkludmFsaWQgT3BlcmF0aW9uIiksCisgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOworICAgIHJlc3VsdCA9IEZBTFNFOworICB9CisKKyAgLyogT24gc3VjY2VzcywgbG9nIGEgcmVjb3JkIG9mIHRoZSByZXN1bHQgdG8gb3VyIGhhc2ggdGFibGUgKi8KKyAgaWYgKHJlc3VsdCkgeworICAgIGxvZ19rZXkgPSBnX21hbGxvYyAoc2l6ZW9mICpsb2dfa2V5KTsKKyAgICAqbG9nX2tleSA9IGxvZ2lkOworCisgICAgc25wcmludGYgKGxvZ192YWx1ZSwgc2l6ZW9mIGxvZ192YWx1ZSwgIiVkIiwgKl9yZXR1cm4pOworCisgICAgbG9nX3N0cnVjdCA9IGdfb2JqZWN0X25ldyAoVFlQRV9TSEFSRURfU1RSVUNULAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJrZXkiLCAgICpsb2dfa2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2YWx1ZSIsICBnX3N0cmR1cCAobG9nX3ZhbHVlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOVUxMKTsKKyAgICBnX2hhc2hfdGFibGVfcmVwbGFjZSAoc2VsZi0+bG9nLCBsb2dfa2V5LCBsb2dfc3RydWN0KTsKKyAgfQorCisgIHJldHVybiByZXN1bHQ7Cit9CisKKy8qIEEgb25lLXdheSBtZXRob2QgaGFzIHRoZSBzYW1lIHNpZ25hdHVyZSBhcyBhbiBlcXVpdmFsZW50LCByZWd1bGFyCisgICBtZXRob2QgdGhhdCByZXR1cm5zIG5vIHZhbHVlLiAqLworc3RhdGljIGdib29sZWFuCit0dXRvcmlhbF9jYWxjdWxhdG9yX2hhbmRsZXJfemlwIChDYWxjdWxhdG9ySWYgICppZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdFcnJvciAgICAgICA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G5hbWVzICJnZW4tY2wvc2hhcmVkL3RocmlmdC1nZW4tc2hhcmVkLmFzZCIgKmxvYWQtdHJ1ZW5hbWUqKSkKKyhhc2RmOmxvYWQtYXNkIChtZXJnZS1wYXRobmFtZXMgImdlbi1jbC90dXRvcmlhbC90aHJpZnQtZ2VuLXR1dG9yaWFsLmFzZCIgKmxvYWQtdHJ1ZW5hbWUqKSkKKyhhc2RmOmxvYWQtYXNkIChtZXJnZS1wYXRobmFtZXMgInRocmlmdC10dXRvcmlhbC5hc2QiICpsb2FkLXRydWVuYW1lKikpCisoYXNkZjpsb2FkLXN5c3RlbSA6dGhyaWZ0LXR1dG9yaWFsKQorCisobmV0LmRpZGllcnZlcm5hLmNsb246bmlja25hbWUtcGFja2FnZSkKKworKGRlZnVuIG1haW4gKCkKKyAgIkVudHJ5IHBvaW50IGZvciB0aGUgYmluYXJ5LiIKKyAgKHRocmlmdDp3aXRoLWNsaWVudCAocHJvdCAjdSJ0aHJpZnQ6Ly8xMjcuMC4wLjE6OTA5MCIpCisgICAgKHR1dG9yaWFsLmNhbGN1bGF0b3I6cGluZyBwcm90KQorICAgIChmb3JtYXQgdCAicGluZygpfiUiKQorICAgIChmb3JtYXQgdCAiMSArIDEgPSB+YX4lIiAodHV0b3JpYWwuY2FsY3VsYXRvcjphZGQgcHJvdCAxIDEpKQorICAgIChsZXQgKCh3b3JrLWluc3RhbmNlICh0dXRvcmlhbDptYWtlLXdvcmsgOm51bTEgNQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm51bTIgMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm9wIHR1dG9yaWFsOm9wZXJhdGlvbi5kaXZpZGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDpjb21tZW50ICJCb295YSEiKSkpCisgICAgICAoaGFuZGxlci1jYXNlIChmb3JtYXQgdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICI1IC8gMCA9IH5hIC0gT2gsIHJlYWxseT8gQW4gZXhjZXB0aW9uIHNob3VsZCBoYXZlIGJlZW4gdGhyb3duIGhlcmUufiUiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHR1dG9yaWFsLmNhbGN1bGF0b3I6Y2FsY3VsYXRlIHByb3QgMSB3b3JrLWluc3RhbmNlKSkKKyAgICAgICAgKHR1dG9yaWFsOmludmFsaWRvcGVyYXRpb24gKGUpCisgICAgICAgICAgKGZvcm1hdCB0ICItLS1+JShFeHBlY3RlZCkgSW52YWxpZCBPcGVyYXRpb24gY2F1Z2h0OiB+JX5hfiUtLS1+JSIgZSkpKSkKKyAgICAobGV0ICgod29yay1pbnN0YW5jZSAodHV0b3JpYWw6bWFrZS13b3JrIDpudW0xIDE1CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6bnVtMiAxMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOm9wIHR1dG9yaWFsOm9wZXJhdGlvbi5zdWJ0cmFjdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOmNvbW1lbnQgIlBsYXlpbmcgbmljZSB0aGlzIHRpbWUuIikpKQorICAgICAgKGhhbmRsZXItY2FzZSAoZm9ybWF0IHQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiMTUgLSAxMCA9IH5hfiUiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHR1dG9yaWFsLmNhbGN1bGF0b3I6Y2FsY3VsYXRlIHByb3QgMSB3b3JrLWluc3RhbmNlKSkKKyAgICAgICAgKHR1dG9yaWFsOmludmFsaWRvcGVyYXRpb24gKGUpCisgICAgICAgICAgKGZvcm1hdCB0ICItLS1+JShVbmV4cGVjdGVkKSBJbnZhbGlkIE9wZXJhdGlvbiBjYXVnaHQ6IH4lfmF+JS0tLX4lIiBlKSkpKQorICAgIChmb3JtYXQgdCAiQ2h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Rpb246Y2FsY3VsYXRlIChsb2dpZCB3b3JrKQorICAoZm9ybWF0IHQgImNhbGN1bGF0ZSh+YSwgfmEpfiUiIGxvZ2lkIHdvcmspCisgIChoYW5kbGVyLWNhc2UKKyAgICAgIChsZXQqICgobnVtMSAodHV0b3JpYWw6d29yay1udW0xIHdvcmspKQorICAgICAgICAgICAgIChudW0yICh0dXRvcmlhbDp3b3JrLW51bTIgd29yaykpCisgICAgICAgICAgICAgKG9wICh0dXRvcmlhbDp3b3JrLW9wIHdvcmspKQorICAgICAgICAgICAgIChyZXN1bHQKKyAgICAgICAgICAgICAgKGNvbmQKKyAgICAgICAgICAgICAgICAoKD0gb3AgdHV0b3JpYWw6b3BlcmF0aW9uLmFkZCkgKCsgbnVtMSBudW0yKSkKKyAgICAgICAgICAgICAgICAoKD0gb3AgdHV0b3JpYWw6b3BlcmF0aW9uLnN1YnRyYWN0KSAoLSBudW0xIG51bTIpKQorICAgICAgICAgICAgICAgICgoPSBvcCB0dXRvcmlhbDpvcGVyYXRpb24ubXVsdGlwbHkpICgqIG51bTEgbnVtMikpCisgICAgICAgICAgICAgICAgKCg9IG9wIHR1dG9yaWFsOm9wZXJhdGlvbi5kaXZpZGUpICgvIG51bTEgbnVtMikpKSkpCisgICAgICAgIChzaGFyZWQtaW1wbGVtZW50YXRpb246OmFkZC1sb2cgbG9naWQgcmVzdWx0KQorICAgICAgICByZXN1bHQpCisgICAgKGRpdmlzaW9uLWJ5LXplcm8gKCkgKGVycm9yICd0dXRvcmlhbDppbnZhbGlkb3BlcmF0aW9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDp3aHkgIkRpdmlzaW9uIGJ5IHplcm8uIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6d2hhdC1vcCAodHV0b3JpYWw6d29yay1vcCB3b3JrKSkpKSkKKworKGRlZnVuIHR1dG9yaWFsLmNhbGN1bGF0b3ItaW1wbGVtZW50YXRpb246emlwICgpCisgIChmb3JtYXQgdCA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Ki8NCi0NCi11c2luZyBTeXN0ZW07DQotdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7DQotdXNpbmcgVGhyaWZ0LlNlcnZlcjsNCi11c2luZyBUaHJpZnQuVHJhbnNwb3J0Ow0KLQ0KLW5hbWVzcGFjZSBDU2hhcnBUdXRvcmlhbA0KLXsNCi0gICAgcHVibGljIGNsYXNzIENhbGN1bGF0b3JIYW5kbGVyIDogQ2FsY3VsYXRvci5JZmFjZQ0KLSAgICB7DQotICAgICAgICBEaWN0aW9uYXJ5PGludCwgU2hhcmVkU3RydWN0PiBsb2c7DQotDQotICAgICAgICBwdWJsaWMgQ2FsY3VsYXRvckhhbmRsZXIoKQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIGxvZyA9IG5ldyBEaWN0aW9uYXJ5PGludCwgU2hhcmVkU3RydWN0PigpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIHZvaWQgcGluZygpDQotICAgICAgICB7DQotICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInBpbmcoKSIpOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIGludCBhZGQoaW50IG4xLCBpbnQgbjIpDQotICAgICAgICB7DQotICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoImFkZCh7MH0sezF9KSIsIG4xLCBuMik7DQotICAgICAgICAgICAgcmV0dXJuIG4xICsgbjI7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgaW50IGNhbGN1bGF0ZShpbnQgbG9naWQsIFdvcmsgd29yaykNCi0gICAgICAgIHsNCi0gICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiY2FsY3VsYXRlKHswfSwgW3sxfSx7Mn0sezN9XSkiLCBsb2dpZCwgd29yay5PcCwgd29yay5OdW0xLCB3b3JrLk51bTIpOw0KLSAgICAgICAgICAgIGludCB2YWwgPSAwOw0KLSAgICAgICAgICAgIHN3aXRjaCAod29yay5PcCkNCi0gICAgICAgICAgICB7DQotICAgICAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLkFERDoNCi0gICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSArIHdvcmsuTnVtMjsNCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KLQ0KLSAgICAgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5TVUJUUkFDVDoNCi0gICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAtIHdvcmsuTnVtMjsNCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KLQ0KLSAgICAgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5NVUxUSVBMWToNCi0gICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAqIHdvcmsuTnVtMjsNCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KLQ0KLSAgICAgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5ESVZJREU6DQotICAgICAgICAgICAgICAgICAgICBpZiAod29yay5OdW0yID09IDApDQotICAgICAgICAgICAgICAgICAgICB7DQotICAgICAgICAgICAgICAgICAgICAgICAgSW52YWxpZE9wZXJhdGlvbiBpbyA9IG5ldyBJbnZhbGlkT3BlcmF0aW9uKCk7DQotICAgICAgICAgICAgICAgICAgICAgICAgaW8uV2hhdCA9IChpbnQpd29yay5PcDsNCi0gICAgICAgICAgICAgICAgICAgICAgICBpby5XaHkgPSAiQ2Fubm90IGRpdmlkZSBieSAwIjsNCi0gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpbzsNCi0gICAgICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAvIHdvcmsuTnVtMjsNCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOw0KLQ0KLSAgICAgICAgICAgICAgICBkZWZhdWx0Og0KLSAgICAgICAgICAgICAgICAgICAgew0KLSAgICAgICAgICAgICAgICAgICAgICAgIEludmFsaWRPcGVyYXRpb24gaW8gPSBuZXcgSW52YWxpZE9wZXJhdGlvbigpOw0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlvLldoYXQgPSAoaW50KXdvcmsuT3A7DQotICAgICAgICAgICAgICAgICAgICAgICAgaW8uV2h5ID0gIlVua25vd24gb3BlcmF0aW9uIjsNCi0gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpbzsNCi0gICAgICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICB9DQotDQotICAgICAgICAgICAgU2hhcmVkU3RydWN0IGVudHJ5ID0gbmV3IFNoYXJlZFN0cnVjdCgpOw0KLSAgICAgICAgICAgIGVudHJ5LktleSA9IGxvZ2lkOw0KLSAgICAgICAgICAgIGVudHJ5LlZhbHVlID0gdmFsLlRvU3RyaW5nKCk7DQotICAgICAgICAgICAgbG9nW2xvZ2lkXSA9IGVudHJ5Ow0KLQ0KLSAgICAgICAgICAgIHJldHVybiB2YWw7DQotICAgICAgICB9DQotDQotICAgICAgICBwdWJsaWMgU2hhcmVkU3RydWN0IGdldFN0cnVjdChpbnQga2V5KQ0KLSAgICAgICAgew0KLSAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJnZXRTdHJ1Y3QoezB9KSIsIGtleSk7DQotICAgICAgICAgICAgcmV0dXJuIGxvZ1trZXldOw0KLSAgICAgICAgfQ0KLQ0KLSAgICAgICAgcHVibGljIHZvaWQgemlwKCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiemlwKCkiKTsNCi0gICAgICAgIH0NCi0gICAgfQ0KLQ0KLSAgICBwdWJsaWMgY2xhc3MgQ1NoYXJwU2VydmVyDQotICAgIHsNCi0gICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkNCi0gICAgICAgIHsNCi0gICAgICAgICAgICB0cnkNCi0gICAgICAgICAgICB7DQotICAgICAgICAgICAgICAgIENhb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HJhbnNwb3J0OworCituYW1lc3BhY2UgQ1NoYXJwVHV0b3JpYWwKK3sKKyAgICBwdWJsaWMgY2xhc3MgQ2FsY3VsYXRvckhhbmRsZXIgOiBDYWxjdWxhdG9yLklmYWNlCisgICAgeworICAgICAgICBEaWN0aW9uYXJ5PGludCwgU2hhcmVkU3RydWN0PiBsb2c7CisKKyAgICAgICAgcHVibGljIENhbGN1bGF0b3JIYW5kbGVyKCkKKyAgICAgICAgeworICAgICAgICAgICAgbG9nID0gbmV3IERpY3Rpb25hcnk8aW50LCBTaGFyZWRTdHJ1Y3Q+KCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBwaW5nKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInBpbmcoKSIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGQoaW50IG4xLCBpbnQgbjIpCisgICAgICAgIHsKKyAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJhZGQoezB9LHsxfSkiLCBuMSwgbjIpOworICAgICAgICAgICAgcmV0dXJuIG4xICsgbjI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGNhbGN1bGF0ZShpbnQgbG9naWQsIFdvcmsgd29yaykKKyAgICAgICAgeworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoImNhbGN1bGF0ZSh7MH0sIFt7MX0sezJ9LHszfV0pIiwgbG9naWQsIHdvcmsuT3AsIHdvcmsuTnVtMSwgd29yay5OdW0yKTsKKyAgICAgICAgICAgIGludCB2YWwgPSAwOworICAgICAgICAgICAgc3dpdGNoICh3b3JrLk9wKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLkFERDoKKyAgICAgICAgICAgICAgICAgICAgdmFsID0gd29yay5OdW0xICsgd29yay5OdW0yOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLlNVQlRSQUNUOgorICAgICAgICAgICAgICAgICAgICB2YWwgPSB3b3JrLk51bTEgLSB3b3JrLk51bTI7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBPcGVyYXRpb24uTVVMVElQTFk6CisgICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAqIHdvcmsuTnVtMjsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5ESVZJREU6CisgICAgICAgICAgICAgICAgICAgIGlmICh3b3JrLk51bTIgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgSW52YWxpZE9wZXJhdGlvbiBpbyA9IG5ldyBJbnZhbGlkT3BlcmF0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpby5XaGF0T3AgPSAoaW50KXdvcmsuT3A7CisgICAgICAgICAgICAgICAgICAgICAgICBpby5XaHkgPSAiQ2Fubm90IGRpdmlkZSBieSAwIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGlvOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAvIHdvcmsuTnVtMjsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICBJbnZhbGlkT3BlcmF0aW9uIGlvID0gbmV3IEludmFsaWRPcGVyYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlvLldoYXRPcCA9IChpbnQpd29yay5PcDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlvLldoeSA9ICJVbmtub3duIG9wZXJhdGlvbiI7CisgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpbzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTaGFyZWRTdHJ1Y3QgZW50cnkgPSBuZXcgU2hhcmVkU3RydWN0KCk7CisgICAgICAgICAgICBlbnRyeS5LZXkgPSBsb2dpZDsKKyAgICAgICAgICAgIGVudHJ5LlZhbHVlID0gdmFsLlRvU3RyaW5nKCk7CisgICAgICAgICAgICBsb2dbbG9naWRdID0gZW50cnk7CisKKyAgICAgICAgICAgIHJldHVybiB2YWw7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU2hhcmVkU3RydWN0IGdldFN0cnVjdChpbnQga2V5KQorICAgICAgICB7CisgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiZ2V0U3RydWN0KHswfSkiLCBrZXkpOworICAgICAgICAgICAgcmV0dXJuIGxvZ1trZXldOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgemlwKCkKKyAgICAgICAgeworICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoInppcCgpIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgY2xhc3MgQ1NoYXJwU2VydmVyCisgICAgeworICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIENhbGN1bGF0b3JIYW5kbGVyIGhhbmRsZXIgPSBuZXcgQ2FsY3VsYXRvckhhbmRsZXIoKTsKKyAgICAgICAgICAgICAgICBDYWxjdWxhdG9yLlByb2Nlc3NvciBwcm9jZXNzb3IgPSBuZXcgQ2FsY3VsYXRvci5Qcm9jZXNzb3IoaGFuZGxlcik7CisgICAgICAgICAgICAgICAgVFNlcnZlclRyYW5zcG9ydCBzZXJ2ZXJUcmFuc3BvcnQgPSBuZXcgVFNlcnZlclNvY2tldCg5MDkwKTsKKyAgICAgICAgICAgICAgICBUU2VydmVyIHNlcnZlciA9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AgICBfY2FsY3VsYXRvckNsaWVudC5waW5nKCk7CisgIH0KKworICB2b2lkIF9idWlsZEFkZENvbXBvbmVudCgpIHsKKyAgICBvdXRwdXQuYXBwZW5kKG5ldyBIZWFkaW5nRWxlbWVudC5oMygpLi50ZXh0ID0gIkFkZCIpOworICAgIElucHV0RWxlbWVudCBudW0xID0gbmV3IElucHV0RWxlbWVudCgpCisgICAgICAuLmlkID0gImFkZDEiCisgICAgICAuLnR5cGUgPSAibnVtYmVyIgorICAgICAgLi5zdHlsZS5mb250U2l6ZSA9ICIxNHB4IgorICAgICAgLi5zdHlsZS53aWR0aCA9ICI1MHB4IjsKKyAgICBvdXRwdXQuYXBwZW5kKG51bTEpOworICAgIFNwYW5FbGVtZW50IG9wID0gbmV3IFNwYW5FbGVtZW50KCkKKyAgICAgIC4udGV4dCA9ICIrIgorICAgICAgLi5zdHlsZS5mb250U2l6ZSA9ICIxNHB4IgorICAgICAgLi5zdHlsZS5tYXJnaW5MZWZ0ID0gIjEwcHgiOworICAgIG91dHB1dC5hcHBlbmQob3ApOworICAgIElucHV0RWxlbWVudCBudW0yID0gbmV3IElucHV0RWxlbWVudCgpCisgICAgICAuLmlkID0gImFkZDIiCisgICAgICAuLnR5cGUgPSAibnVtYmVyIgorICAgICAgLi5zdHlsZS5mb250U2l6ZSA9ICIxNHB4IgorICAgICAgLi5zdHlsZS53aWR0aCA9ICI1MHB4IgorICAgICAgLi5zdHlsZS5tYXJnaW5MZWZ0ID0gIjEwcHgiOworICAgIG91dHB1dC5hcHBlbmQobnVtMik7CisgICAgQnV0dG9uRWxlbWVudCBhZGRCdXR0b24gPSBuZXcgQnV0dG9uRWxlbWVudCgpCisgICAgICAuLnRleHQgPSAiPSIKKyAgICAgIC4uc3R5bGUuZm9udFNpemUgPSAiMTRweCIKKyAgICAgIC4uc3R5bGUubWFyZ2luTGVmdCA9ICIxMHB4IgorICAgICAgLi5vbkNsaWNrLmxpc3Rlbihfb25BZGRDbGljayk7CisgICAgb3V0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Cit9OworCittYWluKExpc3Q8U3RyaW5nPiBhcmdzKSB7CisgIExvZ2dlci5yb290LmxldmVsID0gTGV2ZWwuQUxMOworICBMb2dnZXIucm9vdC5vblJlY29yZC5saXN0ZW4oKExvZ1JlY29yZCByZWMpIHsKKyAgICBwcmludCgnJHtyZWMubGV2ZWwubmFtZX06ICR7cmVjLnRpbWV9OiAke3JlYy5tZXNzYWdlfScpOworICB9KTsKKworICB2YXIgcGFyc2VyID0gbmV3IEFyZ1BhcnNlcigpOworICBwYXJzZXIuYWRkT3B0aW9uKCdwb3J0JywgZGVmYXVsdHNUbzogJzkwOTAnLCBoZWxwOiAnVGhlIHBvcnQgdG8gY29ubmVjdCB0bycpOworCisgIEFyZ1Jlc3VsdHMgcmVzdWx0czsKKyAgdHJ5IHsKKyAgICByZXN1bHRzID0gcGFyc2VyLnBhcnNlKGFyZ3MpOworICB9IGNhdGNoIChlKSB7CisgICAgcmVzdWx0cyA9IG51bGw7CisgIH0KKworICBpZiAocmVzdWx0cyA9PSBudWxsKSB7CisgICAgcHJpbnQocGFyc2VyLnVzYWdlKTsKKyAgICBleGl0KDApOworICB9CisKKyAgaW50IHBvcnQgPSBpbnQucGFyc2UocmVzdWx0c1sncG9ydCddKTsKKworICBfaW5pdENvbm5lY3Rpb24ocG9ydCkudGhlbigoXykgPT4gX3J1bigpKTsKK30KKworRnV0dXJlIF9pbml0Q29ubmVjdGlvbihpbnQgcG9ydCkgYXN5bmMgeworICB2YXIgc29ja2V0ID0gYXdhaXQgU29ja2V0LmNvbm5lY3QoJzEyNy4wLjAuMScsIHBvcnQpOworICBfdHJhbnNwb3J0ID0gbmV3IFRBc3luY0NsaWVudFNvY2tldFRyYW5zcG9ydCgKKyAgICAgIG5ldyBUVGNwU29ja2V0KHNvY2tldCksIG5ldyBUTWVzc2FnZVJlYWRlcihuZXcgVEJpbmFyeVByb3RvY29sRmFjdG9yeSgpKSk7CisgIFRQcm90b2NvbCBwcm90b2NvbCA9IG5ldyBUQmluYXJ5UHJvdG9jb2woX3RyYW5zcG9ydCk7CisgIGF3YWl0IF90cmFuc3BvcnQub3BlbigpOworCisgIF9jYWxjdWxhdG9yID0gbmV3IENhbGN1bGF0b3JDbGllbnQocHJvdG9jb2wpOworfQorCitGdXR1cmUgX3J1bigpIGFzeW5jIHsKKyAgX2hlbHAoKTsKKworICB3aGlsZSAodHJ1ZSkgeworICAgIHN0ZG91dC53cml0ZSgiPiAiKTsKKyAgICB2YXIgaW5wdXQgPSBzdGRpbi5yZWFkTGluZVN5bmMoKTsKKyAgICB2YXIgcGFydHMgPSBpbnB1dC5zcGxpdCgnICcpOworICAgIHZhciBjb21tYW5kID0gcGFydHNbMF07CisgICAgdmFyIGFyZ3MgPSBwYXJ0cy5sZW5ndGggPiAxID8gcGFydHMuc3VibGlzdCgxKSA6IFtdOworCisgICAgc3dpdGNoIChjb21tYW5kKSB7CisgICAgICBjYXNlICdwaW5nJzoKKyAgICAgICAgYXdhaXQgX3BpbmcoKTsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgJ2FkZCc6CisgICAgICAgIGF3YWl0IF9hZGQoaW50LnBhcnNlKGFyZ3NbMF0pLCBpbnQucGFyc2UoYXJnc1sxXSkpOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSAnY2FsYyc6CisgICAgICAgIGludCBvcCA9IG9wZXJhdGlvbkxvb2t1cFthcmdzWzFdXTsKKyAgICAgICAgaWYgKCFPcGVyYXRpb24uVkFMSURfVkFMVUVTLmNvbnRhaW5zKG9wKSkgeworICAgICAgICAgIHN0ZG91dC53cml0ZWxuKCdVbmtub3duIG9wZXJhdG9yICR7YXJnc1sxXX0nKTsKKyAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHZhciB3b3JrID0gbmV3IFdvcmsoKQorICAgICAgICAgIC4ubnVtMSA9IGludC5wYXJzZShhcmdzWzBdKQorICAgICAgICAgIC4ub3AgPSBvcAorICAgICAgICAgIC4ubnVtMiA9IGludC5wY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worCisgICAgc3dpdGNoICh3b3JrLm9wKSB7CisgICAgICBjYXNlIE9wZXJhdGlvbi5BREQ6CisgICAgICAgIHZhbCA9IHdvcmsubnVtMSArIHdvcmsubnVtMjsKKyAgICAgICAgYnJlYWs7CisKKyAgICAgIGNhc2UgT3BlcmF0aW9uLlNVQlRSQUNUOgorICAgICAgICB2YWwgPSB3b3JrLm51bTEgLSB3b3JrLm51bTI7CisgICAgICAgIGJyZWFrOworCisgICAgICBjYXNlIE9wZXJhdGlvbi5NVUxUSVBMWToKKyAgICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yOworICAgICAgICBicmVhazsKKworICAgICAgY2FzZSBPcGVyYXRpb24uRElWSURFOgorICAgICAgICBpZiAod29yay5udW0yID09IDApIHsKKyAgICAgICAgICB2YXIgeCA9IG5ldyBJbnZhbGlkT3BlcmF0aW9uKCk7CisgICAgICAgICAgeC53aGF0T3AgPSB3b3JrLm9wOworICAgICAgICAgIHgud2h5ID0gJ0Nhbm5vdCBkaXZpZGUgYnkgMCc7CisgICAgICAgICAgdGhyb3cgeDsKKyAgICAgICAgfQorICAgICAgICB2YWwgPSAod29yay5udW0xIC8gd29yay5udW0yKS5mbG9vcigpOworICAgICAgICBicmVhazsKKyAgICB9CisKKyAgICB2YXIgbG9nID0gbmV3IFNoYXJlZFN0cnVjdCgpOworICAgIGxvZy5rZXkgPSBsb2dpZDsKKyAgICBsb2cudmFsdWUgPSAnJHZhbCAiJHt3b3JrLmNvbW1lbnR9Iic7CisgICAgdGhpcy5fbG9nW2xvZ2lkXSA9IGxvZzsKKworICAgIHJldHVybiB2YWw7CisgIH0KKworICBGdXR1cmUgemlwKCkgYXN5bmMgeworICAgIHByaW50KCd6aXAoKScpOworICB9CisKKyAgRnV0dXJlPFNoYXJlZFN0cnVjdD4gZ2V0U3RydWN0KGludCBrZXkpIGFzeW5jIHsKKyAgICBwcmludCgnZ2V0U3RydWN0KCRrZXkpJyk7CisKKyAgICByZXR1cm4gX2xvZ1trZ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NyArMjgsNyBAQAogICAgIG9rLgogCiB0KCkgLT4KLSAgICBQb3J0ID0gOTk5OSwKKyAgICBQb3J0ID0gOTA5MCwKIAogICAgIHtvaywgQ2xpZW50MH0gPSB0aHJpZnRfY2xpZW50X3V0aWw6bmV3KCIxMjcuMC4wLjEiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBvcnQsCkBAIC00NCw3ICs0NCw3IEBACiAgICAge0NsaWVudDMsIHtvaywgU3VtMX19ID0gdGhyaWZ0X2NsaWVudDpjYWxsKENsaWVudDIsIGFkZCwgWzEsIDRdKSwKICAgICBpbzpmb3JtYXQoIjErND1+cH5uIiwgW1N1bTFdKSwKIAotICAgIFdvcmsgPSAjd29ya3tvcD0/dHV0b3JpYWxfT3BlcmF0aW9uX1NVQlRSQUNULAorICAgIFdvcmsgPSAjJ1dvcmsne29wPT9UVVRPUklBTF9PUEVSQVRJT05fU1VCVFJBQ1QsCiAgICAgICAgICAgICAgICAgIG51bTE9MTUsCiAgICAgICAgICAgICAgICAgIG51bTI9MTB9LAogICAgIHtDbGllbnQ0LCB7b2ssIERpZmZ9fSA9IHRocmlmdF9jbGllbnQ6Y2FsbChDbGllbnQzLCBjYWxjdWxhdGUsIFsxLCBXb3JrXSksCkBAIC01NSw3ICs1NSw3IEBACiAKICAgICBDbGllbnQ2ID0KICAgICAgICAgdHJ5Ci0gICAgICAgICAgICBXb3JrMSA9ICN3b3Jre29wPT90dXRvcmlhbF9PcGVyYXRpb25fRElWSURFLAorICAgICAgICAgICAgV29yazEgPSAjJ1dvcmsne29wPT9UVVRPUklBTF9PUEVSQVRJT05fRElWSURFLAogICAgICAgICAgICAgICAgICAgICAgICAgICBudW0xPTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bTI9MH0sCiAgICAgICAgICAgICB7Q2xpZW50UzEsIHtvaywgX1F1b3R9fSA9IHRocmlmdF9jbGllbnQ6Y2FsbChDbGllbnQ1LCBjYWxjdWxhdGU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WNlbnNlIiA6ICJBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAiCisgICAgLCJ1cmwiIDogImh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMCIKKyAgICAsInRhcmdldERhdGEiIDogWworICAgICAgICAgeworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJmbGFzaC5oeG1sIgorICAgICAgICAgICAgLCJydW5BY3Rpb25UeXBlIiA6IDEKKyAgICAgICAgICAgICwicnVuQWN0aW9uVGV4dCIgOiAiYmluL1R1dG9yaWFsLnN3ZiIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJqYXZhc2NyaXB0Lmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMQorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJiaW5cXGluZGV4Lmh0bWwiCisgICAgICAgIH0KKyAgICAgICAgLHsKKyAgICAgICAgICAgICAicGF0aFRvSHhtbCIgOiAibmVrby5oeG1sIgorICAgICAgICAgICAgLCJydW5BY3Rpb25UeXBlIiA6IDIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVGV4dCIgOiAibmVrbyBiaW4vVHV0b3JpYWwubiIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJwaHAuaHhtbCIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJjcHAuaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAyCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogImJpbi9NYWluLWRlYnVnLmV4ZSIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJqYXZhLmh4bWwiCisgICAgICAgIH0KKyAgICAgICAgLHsKKyAgICAgICAgICAgICAicGF0aFRvSHhtbCIgOiAiY3NoYXJwLmh4bWwiCisgICAgICAgICAgICAsInJ1bkFjdGlvblR5cGUiIDogMgorICAgICAgICAgICAgLCJydW5BY3Rpb25UZXh0IiA6ICJiaW5cXFR1dG9yaWFsLmV4ZVxcYmluXFxNYWluLURlYnVnLmV4ZSIKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoVG9IeG1sIiA6ICJweXRob24uaHhtbCIKKyAgICAgICAgICAgICwicnVuQWN0aW9uVHlwZSIgOiAyCisgICAgICAgICAgICAsInJ1bkFjdGlvblRleHQiIDogInB5dGhvbiBiaW4vVHV0b3JpYWwucHkiCisgICAgICAgIH0KKyAgICBdCisgICAgLCJmaWxlcyIgOiBbCisgICAgICAgICB7CisgICAgICAgICAgICAgInBhdGgiIDogInNyY1xcb3JnXFxhcGFjaGVcXHRocmlmdFxcc2VydmVyXFxUU2VydmVyLmh4IgorICAgICAgICAgICAgLCJ1c2VUYWJzIiA6IHRydWUKKyAgICAgICAgICAgICwiaW5kZW50U2l6ZSIgOiA0CisgICAgICAgICAgICAsImZvbGRlZFJlZ2lvbnMiIDogWworCisgICAgICAgICAgICBdCisgICAgICAgICAgICAsImFjdGl2ZUxpbmUiIDogNzYKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoIiA6ICJzcmNcXG9yZ1xcYXBhY2hlXFx0aHJpZnRcXHNlcnZlclxcVFNpbXBsZVNlcnZlci5oeCIKKyAgICAgICAgICAgICwidXNlVGFicyIgOiB0cnVlCisgICAgICAgICAgICAsImluZGVudFNpemUiIDogNAorICAgICAgICAgICAgLCJmb2xkZWRSZWdpb25zIiA6IFsKKworICAgICAgICAgICAgXQorICAgICAgICAgICAgLCJhY3RpdmVMaW5lIiA6IDEwMAorICAgICAgICB9CisgICAgICAgICx7CisgICAgICAgICAgICAgInBhdGgiIDogInNyY1xcc2hhcmVkXFxTaGFyZWRTZXJ2aWNlUHJvY2Vzc29yLmh4IgorICAgICAgICAgICAgLCJ1c2VUYWJzIiA6IHRydWUKKyAgICAgICAgICAgICwiaW5kZW50U2l6ZSIgOiA0CisgICAgICAgICAgICAsImZvbGRlZFJlZ2lvbnMiIDogWworCisgICAgICAgICAgICBdCisgICAgICAgICAgICAsImFjdGl2ZUxpbmUiIDogMjAKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoIiA6ICJzcmNcXHR1dG9yaWFsXFxDYWxjdWxhdG9yUHJvY2Vzc29yLmh4IgorICAgICAgICAgICAgLCJ1c2VUYWJzIiA6IHRydWUKKyAgICAgICAgICAgICwiaW5kZW50U2l6ZSIgOiA0CisgICAgICAgICAgICAsImZvbGRlZFJlZ2lvbnMiIDogWworCisgICAgICAgICAgICBdCisgICAgICAgICAgICAsImFjdGl2ZUxpbmUiIDogNzkKKyAgICAgICAgfQorICAgICAgICAseworICAgICAgICAgICAgICJwYXRoIiA6ICJzcmNcXE1haW4uaHgiCisgICAgICAgICAgICAsInVzZVRhYnMiIDogdHJ1ZQorICAgICAgICAgICAgLCJpbmRlbnRTaXplIiA6IDQKKyAgICAgICAgICAgICwiZm9sZGVkUmVnaW9ucyIgOiBbCisKKyAgICAgICAgICAgIF0KKyAgICAgICAgICAgICwiYWN0aXZlTGluZSIgOiAwCisgICAgICAgIH0KKyAgICBdCisgICAgLCJhY3RpdmVGaWxlIiA6ICJzcmNcXE1haW4uaHgiCisgICAgLCJvcGVuRkxUYXJnZXQiIDogbnVsbAorICAgICwib3BlbkZMQnVpbGRNb2RlIiA6ICJEZWJ1ZyIKKyAgICAsInJ1bkFjdGlvblR5cGUiIDogbnVsbAorICAgICwicnVuQWN0aW9uVGV4dCIgOiBudWxsCisgICAgLCJidWlsZEFjdGlvbkNvbW1hbmQiIDogbnVsbAorICAgICwiaGlkZGVuSXRlbXMiIDogWworCisgICAgXQorICAgICwic2hvd0hpZGRlbkl0ZW1zIiA6IGZhbHNlCit9ClwgTm8gbmV3bGluZSBhdCBlbmQ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ICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBwaW5nKCkgOiBWb2lkIHsKKyAgICAgICAgdHJhY2UoInBpbmcoKSIpOworICAgIH0KKworCisgICAgcHVibGljIGZ1bmN0aW9uIGFkZCggbnVtMSA6IGhheGUuSW50MzIsIG51bTIgOiBoYXhlLkludDMyKSA6IGhheGUuSW50MzIgeworICAgICAgICB0cmFjZSgnYWRkKCAkbnVtMSwgJG51bTIpJyk7CisgICAgICAgIHJldHVybiBudW0xICsgbnVtMjsKKyAgICB9CisKKyAgICBwdWJsaWMgZnVuY3Rpb24gY2FsY3VsYXRlKCBsb2dpZCA6IGhheGUuSW50MzIsIHdvcmsgOiBXb3JrKSA6IGhheGUuSW50MzIgIHsKKyAgICAgICAgdHJhY2UoJ2NhbGN1bGF0ZSggJGxvZ2lkLCAnK3dvcmsub3ArIiwiK3dvcmsubnVtMSsiLCIrd29yay5udW0yKyIpIik7CisKKyAgICAgICAgdmFyIHZhbCA6IGhheGUuSW50MzIgPSAwOworICAgICAgICBzd2l0Y2ggKHdvcmsub3ApCisgICAgICAgIHsKKyAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLkFERDoKKyAgICAgICAgICAgICAgICB2YWwgPSB3b3JrLm51bTEgKyB3b3JrLm51bTI7CisKKyAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLlNVQlRSQUNUOgorICAgICAgICAgICAgICAgIHZhbCA9IHdvcmsubnVtMSAtIHdvcmsubnVtMjsKKworICAgICAgICAgICAgY2FzZSBPcGVyYXRpb24uTVVMVElQTFk6CisgICAgICAgICAgICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yOworCisgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5ESVZJREU6CisgICAgICAgICAgICAgICAgaWYgKHdvcmsubnVtMiA9PSAwKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGlvID0gbmV3IEludmFsaWRPcGVyYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgaW8ud2hhdE9wID0gd29yay5vcDsKKyAgICAgICAgICAgICAgICAgICAgaW8ud2h5ID0gIkNhbm5vdCBkaXZpZGUgYnkgMCI7CisgICAgICAgICAgICAgICAgICAgIHRocm93IGlvOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB2YWwgPSBTdGQuaW50KCB3b3JrLm51bTEgLyB3b3JrLm51bTIpOworCisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHZhciBpbyA9IG5ldyBJbnZhbGlkT3BlcmF0aW9uKCk7CisgICAgICAgICAgICAgICAgaW8ud2hhdE9wID0gd29yay5vcDsKKyAgICAgICAgICAgICAgICBpby53aHkgPSAiVW5rbm93biBvcGVyYXRpb24iOworICAgICAgICAgICAgICAgIHRocm93IGlvOworICAgICAgICB9CisKKyAgICAgICAgdmFyIGVudHJ5ID0gbmV3IFNoYXJlZFN0cnVjdCgpOworICAgICAgICBlbnRyeS5rZXkgPSBsb2dpZDsKKyAgICAgICAgZW50cnkudmFsdWUgPSAnJHZhbCc7CisgICAgICAgIGxvZy5zZXQobG9naWQsIGVudHJ5KTsKKworICAgICAgICByZXR1cm4gdmFsOworICAgIH0KKworICAgIHB1YmxpYyBmdW5jdGlvbiBnZXRTdHJ1Y3QoIGtleSA6IGhheGUuSW50MzIpIDogU2hhcmVkU3RydWN0IHsKKyAgICAgICAgdHJhY2UoJ2dldFN0cnVjdCgka2V5KScpOworICAgICAgICByZXR1cm4gbG9nLmdldChrZXkpOworICAgIH0KKworICAgIC8vIG9uZXdheSBtZXRob2QsICBubyBhcmdzCisgICAgcHVibGljIGZ1bmN0aW9uIHppcCgpIDogVm9pZCB7CisgICAgICAgIHRyYWNlKCJ6aXAoKSIpOworICAgIH0KKworfQpkaWZmIC0tZ2l0IGEvdHV0b3JpYWwvaGF4ZS9zcmMvTWFpbi5oeCBiL3R1dG9yaWFsL2hheGUvc3JjL01haW4uaHgKbmV3IGZpbGUg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gICAgICNpZiAhIChmbGFzaCB8fCBqcyB8fCBwaHB3ZWJzZXJ2ZXIpCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgIFBhcnNlQXJncygpOworICAgICAgICB9IGNhdGNoIChlIDogU3RyaW5nKSB7CisgICAgICAgICAgICB0cmFjZShlKTsKKyAgICAgICAgICAgIHRyYWNlKEdldEhlbHAoKSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICAjZWxzZWlmICBwaHB3ZWJzZXJ2ZXIKKyAgICAgICAgLy9mb3JjaW5nIHNlcnZlcgorICAgICAgICBzZXJ2ZXIgPSB0cnVlOworICAgICAgICB0cm5zID0gaHR0cDsKKyAgICAgICAgaW5pdFBocFdlYlNlcnZlcigpOworICAgICAgICAvL2NoZWNrIG1ldGhvZAorICAgICAgICBpZihwaHAuV2ViLmdldE1ldGhvZCgpICE9ICdQT1NUJykgeworICAgICAgICAgIFN5cy5wcmludGxuKCdodHRwIGVuZHBvaW50IGZvciB0aHJpZnQgdGVzdCBzZXJ2ZXInKTsKKyAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgI2VuZAorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoc2VydmVyKQorICAgICAgICAgICAgICAgIFJ1blNlcnZlcigpOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIFJ1bkNsaWVudCgpOworICAgICAgICB9IGNhdGNoIChlIDogU3RyaW5nKSB7CisgICAgICAgICAgICB0cmFjZShlKTsKKyAgICAgICAgfQorCisgICAgICAgIHRyYWNlKCJDb21wbGV0ZWQuIik7CisgICAgfQorCisgICAgI2lmIHBocHdlYnNlcnZlcgorICAgIHByaXZhdGUgc3RhdGljIGZ1bmN0aW9uIGluaXRQaHBXZWJTZXJ2ZXIoKQorICAgIHsKKyAgICAgICAgLy9yZW1hcCB0cmFjZSB0byBlcnJvciBsb2cKKyAgICAgICAgaGF4ZS5Mb2cudHJhY2UgPSBmdW5jdGlvbih2OkR5bmFtaWMsID9pbmZvczpoYXhlLlBvc0luZm9zKQorICAgICAgICB7CisgICAgICAgICAgLy8gaGFuZGxlIHRyYWNlCisgICAgICAgICAgdmFyIG5ld1ZhbHVlIDogRHluYW1pYzsKKyAgICAgICAgICBpZiAoaW5mb3MgIT0gbnVsbCAmJiBpbmZvcy5jdXN0b21QYXJhbXMhPW51bGwpIHsKKyAgICAgICAgICAgIHZhciBleHRyYTpTdHJpbmcgPSAiIjsKKyAgICAgICAgICAgIGZvciggdiBpbiBpbmZvcy5jdXN0b21QYXJhbXMgKQorICAgICAgICAgICAgICBleHRyYSArPSAiLCIgKyB2OworICAgICAgICAgICAgbmV3VmFsdWUgPSB2ICsgZXh0cmE7CisgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgbmV3VmFsdWUgPSB2OworICAgICAgICAgIH0KKyAgICAgICAgICB2YXIgbXNnID0gaW5mb3MgIT0gbnVsbCA/IGluZm9zLmZpbGVOYW1lICsgJzonICsgaW5mb3MubGluZU51bWJlciArICc6ICcgOiAnJzsKKyAgICAgICAgICBTeXMuc3RkZXJyKCkud3JpdGVTdHJpbmcoJyR7bXNnfSR7bmV3VmFsdWV9XG4nKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAjZW5kCisKKworICAgICNpZiAhIChmbGFzaCB8fCBqcykKKworICAgIHByaXZhdGUgc3RhdGljIGZ1bmN0aW9uIEdldEhlbHAoKSA6IFN0cmluZyB7CisgICAgICAgIHJldHVybiBTeXMuZXhlY3V0YWJsZVBhdGgoKSsiICBtb2R1cyAgdHJuc09wdGlvbiAgdHJhbnNwb3J0ICBwcm90b2NvbFxuIgorICAgICAgICArIk9wdGlvbnM6XG4iCisgICAgICAgICsiICBtb2R1czogICAgICAgY2xpZW50LCBzZXJ2ZXIgICAoZGVmYXVsdDogY2xpZW50KVxuIgorICAgICAgICArIiAgdHJuc09wdGlvbjogIGZyYW1lZCwgYnVmZmVyZWQgKGRlZmF1bHQ6IG5vbmUpXG4iCisgICAgICAgICsiICB0cmFuc3BvcnQ6ICAgc29ja2V0LCBodHRwICAgICAoZGVmYXVsdDogc29ja2V0KVxuIgorICAgICAgICArIiAgcHJvdG9jb2w6ICAgIGJpbmFyeSwganNvbiAgICAgKGRlZmF1bHQ6IGJpbmFyeSlcbiIKKyAgICAgICAgKyJcbiIKKyAgICAgICAgKyJBbGwgYXJndW1lbnRzIGFyZSBvcHRpb25hbC5cbiI7CisgICAgfQorCisKKyAgICBwcml2YXRlIHN0YXRpYyBmdW5jdGlvbiBQYXJzZUFyZ3MoKSA6IFZvaWQgeworICAgICAgICB2YXIgc3RlcCA9IDA7CisgICAgICAgIGZvciAoYXJnIGluIFN5cy5hcmdzKCkpIHsKKworICAgICAgICAgICAgLy8gc2VydmVyfGNsaWVudAorICAgICAgICAgICAgc3dpdGNoKHN0ZXApIHsKKyAgICAgICAgICAgIGNhc2UgMDoKKyAgICAgICAgICAgICAgICArK3N0ZXA7CisgICAgICAgICAgICAgICAgaWYgKCBhcmcgPT0gImNsaWVudCIpCisgICAgICAgICAgICAgICAgICAgIHNlcnZlciA9IGZhbHNlOworICAgICAgICAgICAgICAgIGVsc2UgaWYgKCBhcmcgPT0gInNlcnZlciIpCisgICAgICAgICAgICAgICAgICAgIHNlcnZlciA9IHRydWU7CisgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB0aHJvdyAiRmlyc3QgYXJndW1lbnQgbXVzdCBiZSAnc2VydmVyJyBvciAnY2xpZW50JyI7CisKKyAgICAgICAgICAgIGNhc2UgMToKKyAgICAgICAgICAgICAgICBpZiAoIGFyZyA9PSAiZnJhbWVkIikgeworICAgICAgICAgICAgICAgICAgICBmcmFtZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIGFyZyA9PSAiYnVmZmVyZWQiKSB7CisgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcmVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCBhcmcgPT0gInNvY2tldCIpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJucyA9IHNvY2tldDsKKyAgICAgICAgICAgICAgICAgICAgKytzdGVwOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIGFyZyA9PSAiaHR0cCIpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJucyA9IGh0dHA7CisgICAgICAgICAgICAgICAgICAgICsrc3RlcDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyAiVW5rbm93biB0cmFuc3BvcnQgIithcmc7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICBjYXNlIDI6CisgICAgICAgICAgICAgICAgaWYgKCBhcmcgPT0gImJpbmFyeSIpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdCA9IGJpbmFyeTsKKyAgICAgICAgICAgICAgICAgICAgKytzdGVwOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIGFyZyA9PSAianNvbiIpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdCA9IGpzb247CisgICAgICAgICAgICAgICAgICAgICsrc3RlcDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyAiVW5rbm93biBwcm90b2NvbCAiK2FyZzsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgIlVuZXhwZWN0ZWQgYXJndW1lbnQgIithcmc7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICggZnJhbWVkICYmIGJ1ZmZlcmVkKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRyYWNlKCJXTjogZnJhbWVkIHN1cGVyc2VkZXMgYnVmZmVyZWQiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICB9CisgICAgfQorCisgICAgI2VuZAorCisgICAgcHJpdmF0Z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AgIHRyYW5zcG9ydCA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnQodHJhbnNwb3J0KTsKKyAgICAgICAgfQorCisKKyAgICAgICAgLy8gcHJvdG9jb2wKKyAgICAgICAgdmFyIHByb3RvY29sIDogVFByb3RvY29sOworICAgICAgICBzd2l0Y2gocHJvdCkKKyAgICAgICAgeworICAgICAgICBjYXNlIGJpbmFyeToKKyAgICAgICAgICAgICB0cmFjZSgiLSBiaW5hcnkgcHJvdG9jb2wiKTsKKyAgICAgICAgICAgICBwcm90b2NvbCA9IG5ldyBUQmluYXJ5UHJvdG9jb2woIHRyYW5zcG9ydCk7CisgICAgICAgIGNhc2UganNvbjoKKyAgICAgICAgICAgICB0cmFjZSgiLSBKU09OIHByb3RvY29sIik7CisgICAgICAgICAgICAgcHJvdG9jb2wgPSBuZXcgVEpTT05Qcm90b2NvbCggdHJhbnNwb3J0KTsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJVbmhhbmRsZWQgcHJvdG9jb2wiOworICAgICAgICB9CisKKworICAgICAgICAvLyBwdXQgZXZlcnl0aGluZyB0b2dldGhlcgorICAgICAgICB0cmFuc3BvcnQub3BlbigpOworICAgICAgICByZXR1cm4gbmV3IENhbGN1bGF0b3JJbXBsKHByb3RvY29sLHByb3RvY29sKTsKKyAgICB9CisKKworICAgIHByaXZhdGUgc3RhdGljIGZ1bmN0aW9uIFJ1bkNsaWVudCgpIDogVm9pZCB7CisgICAgICAgIHZhciBjbGllbnQgPSBDbGllbnRTZXR1cCgpOworCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgIGNsaWVudC5waW5nKCk7CisgICAgICAgICAgICB0cmFjZSgicGluZygpIHN1Y2Nlc3NmdWwiKTsKKyAgICAgICAgfSBjYXRjaChlcnJvciA6IFRFeGNlcHRpb24pIHsKKyAgICAgICAgICAgIHRyYWNlKCdwaW5nKCkgZmFpbGVkOiAkZXJyb3InKTsKKyAgICAgICAgfSBjYXRjaChlcnJvciA6IER5bmFtaWMpIHsKKyAgICAgICAgICAgIHRyYWNlKCdwaW5nKCkgZmFpbGVkOiAkZXJyb3InKTsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB2YXIgc3VtID0gY2xpZW50LmFkZCggMSwgMSk7CisgICAgICAgICAgICB0cmFjZSgnMSsxPSRzdW0nKTsKKyAgICAgICAgfSBjYXRjaChlcnJvciA6IFRFeGNlcHRpb24pIHsKKyAgICAgICAgICAgIHRyYWNlKCdhZGQoKSBmYWlsZWQ6ICRlcnJvcicpOworICAgICAgICB9IGNhdGNoKGVycm9yIDogRHluYW1pYykgeworICAgICAgICAgICAgdHJhY2UoJ2FkZCgpIGZhaWxlZDogJGVycm9yJyk7CisgICAgICAgIH0KKworCisgICAgICAgIHZhciB3b3JrID0gbmV3IHR1dG9yaWFsLldvcmsoKTsKKyAgICAgICAgd29yay5vcCA9IHR1dG9yaWFsLk9wZXJhdGlvbi5ESVZJREU7CisgICAgICAgIHdvcmsubnVtMSA9IDE7CisgICAgICAgIHdvcmsubnVtMiA9IDA7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB2YXIgcXVvdGllbnQgPSBjbGllbnQuY2FsY3VsYXRlKCAxLCB3b3JrKTsKKyAgICAgICAgICAgIHRyYWNlKCdXaG9hIHdlIGNhbiBkaXZpZGUgYnkgMCEgUmVzdWx0ID0gJHF1b3RpZW50Jyk7CisgICAgICAgIH0gY2F0Y2goZXJyb3IgOiBURXhjZXB0aW9uKSB7CisgICAgICAgICAgICB0cmFjZSgnY2FsY3VsYXRlKCkgZmFpbGVkOiAkZXJyb3InKTsKKyAgICAgICAgfSBjYXRjaChlcnJvciA6IER5bmFtaWMpIHsKKyAgICAgICAgICAgIHRyYWNlKCdjYWxjdWxhdGUoKSBmYWlsZWQ6ICRlcnJvcicpOworICAgICAgICB9CisKKyAgICAgICAgd29yay5vcCA9IHR1dG9yaWFsLk9wZXJhdGlvbi5TVUJUUkFDVDsKKyAgICAgICAgd29yay5udW0xID0gMTU7CisgICAgICAgIHdvcmsubnVtMiA9IDEwOworICAgICAgICB0cnkgeworICAgICAgICAgICAgdmFyIGRpZmYgPSBjbGllbnQuY2FsY3VsYXRlKCAxLCB3b3JrKTsKKyAgICAgICAgICAgIHRyYWNlKCcxNS0xMD0kZGlmZicpOworICAgICAgICB9IGNhdGNoKGVycm9yIDogVEV4Y2VwdGlvbikgeworICAgICAgICAgICAgdHJhY2UoJ2NhbGN1bGF0ZSgpIGZhaWxlZDogJGVycm9yJyk7CisgICAgICAgIH0gY2F0Y2goZXJyb3IgOiBEeW5hbWljKSB7CisgICAgICAgICAgICB0cmFjZSgnY2FsY3VsYXRlKCkgZmFpbGVkOiAkZXJyb3InKTsKKyAgICAgICAgfQorCisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHZhciBsb2cgOiBTaGFyZWRTdHJ1Y3QgPSBjbGllbnQuZ2V0U3RydWN0KCAxKTsKKyAgICAgICAgICAgIHZhciBsb2d2YWwgPSBsb2cudmFsdWU7CisgICAgICAgICAgICB0cmFjZSgnQ2hlY2sgbG9nOiAkbG9ndmFsJyk7CisgICAgICAgIH0gY2F0Y2goZXJyb3IgOiBURXhjZXB0aW9uKSB7CisgICAgICAgICAgICB0cmFjZSgnZ2V0U3RydWN0KCkgZmFpbGVkOiAkZXJyb3InKTsKKyAgICAgICAgfSBjYXRjaChlcnJvciA6IER5bmFtaWMpIHsKKyAgICAgICAgICAgIHRyYWNlKCdnZXRTdHJ1Y3QoKSBmYWlsZWQ6ICRlcnJvcicpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBwcml2YXRlIHN0YXRpYyBmdW5jdGlvbiBTZXJ2ZXJTZXR1cCgpIDogVFNlcnZlciB7CisgICAgICAgICB0cmFjZSgiU2VydmVyIGNvbmZpZ3VyYXRpb246Iik7CisKKyAgICAgICAgLy8gZW5kcG9pbnQgdHJhbnNwb3J0CisgICAgICAgIHZhciB0cmFuc3BvcnQgOiBUU2VydmVyVHJhbnNwb3J0ID0gbnVsbDsKKyAgICAgICAgc3dpdGNoKHRybnMpCisgICAgICAgIHsKKyAgICAgICAgY2FzZSBzb2NrZXQ6CisgICAgICAgICAgICAjaWYgKGZsYXNoIHx8IGpzKQorICAgICAgICAgICAgdGhyb3cgJ2N1cnJlbnQgcGxhdGZvcm0gZG9lcyBub3Qgc3VwcG9ydCBzb2NrZXQgc2VydmVycyc7CisgICAgICAgICAgICAjZWxzZQorICAgICAgICAgICAgIHRyYWNlKCctIHNvY2tldCB0cmFuc3BvcnQgcG9ydCAkdGFyZ2V0UG9ydCcpOworICAgICAgICAgICAgdHJhbnNwb3J0ID0gbmV3IFRTZXJ2ZXJTb2NrZXQoIHRhcmdldFBvcnQpOworICAgICAgICAgICAgI2VuZAorICAgICAgICBjYXNlIGh0dHA6CisgICAgICAgICAgICAjaWYgIXBocHdlYnNlcnZlcgorICAgICAgICAgICAgICB0aHJvdyAiSFRUUCBzZXJ2ZXIgbm90IGltcGxlbWVudGVkIHlldCI7CisgICAgICAgICAgICAgIC8vdHJhY2UoIi0gaHR0cCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgLy90cmFuc3BvcnQgPSBuZXcgVEh0dHBDbGllbnQoIHRhcmdldEhvc3QpOworICAgICAgICAgICAgI2Vsc2UKKyAgICAgICAgICAgICAgdHJhY2UoIi0gaHR0cCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgICAgdHJhbnNwb3J0ID0gbmV3IFRXcmFwcGluZ1NlcnZlclRyYW5zcG9ydCgKKyAgICAgICAgICAgICAgICAgICAgICBuZXcgVFN0cmVhbVRyYW5zcG9ydCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBURmlsZVN0cmVhbSgicGhwOi8vaW5wdXQiLCBSZWFkKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBURmlsZVN0cmVhbSgicGhwOi8vb3V0cHV0IiwgQXBwZW5kKQorICAgICAgICAgICAgICAgICAgICAgICAgKQorICAgICAgICAgICAgICAgICAgICAgICk7CisKKyAgICAgICAgICAgICNlbmQKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHRocm93ICJVbmhhbmRsZWQgdHJhbnNwb3J0IjsKKyAgICAgICAgfQorCisgICAgICAgIC8vIG9wdGlvbmFsOiBsYXllcmVkIHRyYW5zcG9ydAorICAgICAgICB2YXIgdHJhbnNmYWN0b3J5IDogVFRyYW5zcG9ydEZhY3RvcnkgPSBudWxsOworICAgICAgICBpZiAoIGZyYW1lZCkgeworICAgICAgICAgICAgdHJhY2UoIi0gZnJhbWVkIHRyYW5zcG9ydCIpOworICAgICAgICAgICAgdHJhbnNmYWN0b3J5ID0gbmV3IFRGcmFtZWRUcmFuc3BvcnRGYWN0b3J5KCk7CisgICAgICAgIH0gZWxzZSBpZiAoIGJ1ZmZlcmVkKSB7CisgICAgICAgICAgICB0cmFjZSgiLSBidWZmZXJlZCB0cmFuc3BvcnQiKTsKKyAgICAgICAgICAgIHRyYW5zZmFjdG9yeSA9IG5ldyBUQnVmZmVyZWRUcmFuc3BvcnRGYWN0b3J5KCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBwcm90b2NvbAorICAgICAgICB2YXIgcHJvdGZhY3RvcnkgOiBUUHJvdG9jb2xGYWN0b3J5ID0gbnVsbDsKKyAgICAgICAgc3dpdGNoKHByb3QpCisgICAgICAgIHsKKyAgICAgICAgY2FzZSBiaW5hcnk6CisgICAgICAgICAgICAgdHJhY2UoIi0gYmluYXJ5IHByb3RvY29sIik7CisgICAgICAgICAgICAgcHJvdGZhY3RvcnkgPSBuZXcgVEJpbmFyeVByb3RvY29sRmFjdG9yeSgpOworICAgICAgICBjYXNlIGpzb246CisgICAgICAgICAgICB0cmFjZSgiLSBKU09OIHByb3RvY29sIik7CisgICAgICAgICAgICAgcHJvdGZhY3RvcnkgPSBuZXcgVEpTT05Qcm90b2NvbEZhY3RvcnkoKTsKKyAgICAgICAgZGVmYXVsdDoKKyA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orICAgICAgICAoXGUgLT4gcHJpbnRmICJJbnZhbGlkT3BlcmF0aW9uICVzXG4iIChzaG93IChlIDo6IEludmFsaWRPcGVyYXRpb24pKSkKIAogCi0gIGxldCB3b3JrID0gV29yayB7IGZfV29ya19vcCA9IEp1c3QgU1VCVFJBQ1QsCi0gICAgICAgICAgICAgICAgICAgIGZfV29ya19udW0xID0gSnVzdCAxNSwKLSAgICAgICAgICAgICAgICAgICAgZl9Xb3JrX251bTIgPSBKdXN0IDEwLAotICAgICAgICAgICAgICAgICAgICBmX1dvcmtfY29tbWVudCA9IE5vdGhpbmcKKyAgbGV0IHdvcmsgPSBXb3JrIHsgd29ya19vcCA9IFNVQlRSQUNULAorICAgICAgICAgICAgICAgICAgICB3b3JrX251bTEgPSAxNSwKKyAgICAgICAgICAgICAgICAgICAgd29ya19udW0yID0gMTAsCisgICAgICAgICAgICAgICAgICAgIHdvcmtfY29tbWVudCA9IE5vdGhpbmcKICAgICAgICAgICAgICAgICAgIH0KIAogICBkaWZmIDwtIENsaWVudC5jYWxjdWxhdGUgY2xpZW50IDEgd29yawogICBwcmludGYgIjE1LTEwPSVkXG4iIGRpZmYKIAogICBsb2cgPC0gU0NsaWVudC5nZXRTdHJ1Y3QgY2xpZW50IDEKLSAgcHJpbnRmICJDaGVjayBsb2c6ICVzXG4iICAkIGZyb21KdXN0ICQgZl9TaGFyZWRTdHJ1Y3RfdmFsdWUgbG9nCisgIHByaW50ZiAiQ2hlY2sgbG9nOiAlc1xuIiAkIHVucGFjayAkIHNoYXJlZFN0cnVjdF92YWx1ZSBsb2cKIAogICAtLSBDbG9zZSEKICAgdENsb3NlIHRyYW5zcG9ydApkaWZmIC0tZ2l0IGEvdHV0b3JpYWwvaHMvSGFza2VsbFNlcnZlci5ocyBiL3R1dG9yaWFsL2hzL0hhc2tlbGxTZXJ2ZXIuaHMKaW5kZXggNGY5YWI3Yy4uY2ZlMTM0NCAxMDA2NDQKLS0tIGEvdHV0b3JpYWwvaHMvSGFza2V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cgc2VsZikKLSAgICByZXR1cm4gJCAobXlMb2cgISAoZnJvbUp1c3QgaykpCisgICAgcmV0dXJuICQgKG15TG9nICEgaykKIAogCiBpbnN0YW5jZSBDYWxjdWxhdG9yX0lmYWNlIENhbGN1bGF0b3JIYW5kbGVyIHdoZXJlCkBAIC01Myw4ICs1Nyw4IEBACiAgICAgcHJpbnQgInBpbmcoKSIKIAogICBhZGQgXyBuMSBuMiA9IGRvCi0gICAgcHJpbnRmICJhZGQoJWQsJWQpXG4iIChmcm9tSnVzdCBuMSkgKGZyb21KdXN0IG4yKQotICAgIHJldHVybiAoKGZyb21KdXN0IG4xKSsoZnJvbUp1c3QgbjIpKQorICAgIHByaW50ZiAiYWRkKCVkLCVkKVxuIiBuMSBuMgorICAgIHJldHVybiAobjEgKyBuMikKIAogICBjYWxjdWxhdGUgc2VsZiBtbG9naWQgbXdvcmsgPSBkbwogICAgIHByaW50ZiAiY2FsY3VsYXRlKCVkLCAlcylcbiIgbG9naWQgKHNob3cgd29yaykKQEAgLTcwLDI3ICs3NCwyNCBAQAogICAgICAgICAgICAgICAgICAgICBpZiBudW0yIHdvcmsgPT0gMCB0aGVuCiAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbnZhbGlkT3BlcmF0aW9uIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfSW52YWxpZE9wZXJhdGlvbl93aGF0ID0gSnVzdCAkIGZyb21FbnVtICQgb3Agd29yaywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfSW52YWxpZE9wZXJhdGlvbl93aHkgPSBKdXN0ICJDYW5ub3QgZGl2aWRlIGJ5IDAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkT3BlcmF0aW9uX3doYXRPcCA9IGZyb21JbnRlZ3JhbCAkIGZyb21FbnVtICQgb3Agd29yaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRPcGVyYXRpb25fd2h5ID0gIkNhbm5vdCBkaXZpZGUgYnkgMCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICBudW0xIHdvcmsgYGRpdmAgbnVtMiB3b3JrCiAKLSAgICBsZXQgbG9nRW50cnkgPSBTaGFyZWRTdHJ1Y3QgKEp1c3QgbG9naWQpIChKdXN0IChzaG93IHZhbCkpCisgICAgbGV0IGxvZ0VudHJ5ID0gU2hhcmVkU3RydWN0IGxvZ2lkIChmcm9tU3RyaW5nICQgc2hvdyAkIHZhbCkKICAgICBtb2RpZnlNVmFyXyAobWF0aExvZyBzZWxmKSAkIHJldHVybiAuKE0uaW5zZXJ0IGxvZ2lkIGxvZ0VudHJ5KQogCi0gICAgcmV0dXJuIHZhbAorICAgIHJldHVybiAkISB2YWwKIAogICAgd2hlcmUKICAgICAgLS0gc3R1cGlkIGR5bmFtaWMgbGFuZ3VhZ2VzIGYnaW5nIGl0IHVwCi0gICAgIG51bTEgPSBmcm9tSnVzdCAuIGZfV29ya19udW0xCi0gICAgIG51bTIgPSBmcm9tSnVzdCAuIGZfV29ya19udW0yCi0gICAgIG9wID0gZnJvbUp1c3QgLiBmX1dvcmtfb3AKLSAgICAgbG9naWQgPSBmcm9tSnVzdCBtbG9naWQKLSAgICAgd29yayA9IGZyb21KdXN0IG13b3JrCi0KLQotICAgIC0tcmV0dXJuIHZhbAorICAgICBudW0xID0gd29ya19udW0xCisgICAgIG51bTIgPSB3b3JrX251bTIKKyAgICAgb3AgPSB3b3JrX29wCisgICAgIGxvZ2lkID0gbWxvZ2lkCisgICAgIHdvcmsgPSBtd29yawogCiAgIHppcCBfID0KICAgICBwcmludCAiemlwKCkiCmRpZmYgLS1naXQgYS90dXRvcmlhbC9ocy9MSUNFTlNFIGIvdHV0b3JpYWwvaHMvTElDRU5TRQ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dpbGwgYmUgdXNlZAorICAgICAgICBjb21wYWN0IC0gY29tcGFjdCBwcm90b2NvbCB3aWxsIGJlIHVzZWQKKyAgICAgICAganNvbiAtIGpzb24gcHJvdG9jb2wgd2lsbCBiZSB1c2VkCisgICAgICAgIG11bHRpcGxleGVkIC0gbXVsdGlwbGV4ZWQgcHJvdG9jb2wgd2lsbCBiZSB1c2VkCisKKyAgICAtbWMgKG11bHRpcGxlIGNsaWVudHMpOgorICAgICAgICA8bnVtQ2xpZW50cz4gLSBudW1iZXIgb2YgbXVsdGlwbGUgY2xpZW50cyB0byBjb25uZWN0IHRvIHNlcnZlciAobWF4IDEwMCwgZGVmYXVsdCAxKQorCitTYW1wbGU6CisgICAgQ2xpZW50LmV4ZSAtdHI6dGNwIC1wOmJpbmFyeQorIik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQorICAgICAgICB7CisgICAgICAgICAgICBhcmdzID0gYXJncyA/PyBuZXcgc3RyaW5nWzBdOworCisgICAgICAgICAgICBpZiAoYXJncy5BbnkoeCA9PiB4LlN0YXJ0c1dpdGgoIi1oZWxwIiwgU3RyaW5nQ29tcGFyaXNvbi5PcmRpbmFsSWdub3JlQ2FzZSkpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIERpc3BsYXlIZWxwKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oIlN0YXJ0aW5nIGNsaWVudC4uLiIpOworCisgICAgICAgICAgICB1c2luZyAodmFyIHNvdXJjZSA9IG5ldyBDYW5jZWxsYXRpb25Ub2tlblNvdXJjZSgpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIFJ1bkFzeW5jKGFyZ3MsIHNvdXJjZS5Ub2tlbikuR2V0QXdhaXRlcigpLkdldFJlc3VsdCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgYXN5bmMgVGFzayBSdW5Bc3luYyhzdHJpbmdbXSBhcmdzLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIG51bUNsaWVudHMgPSBHZXROdW1iZXJPZkNsaWVudHMoYXJncyk7CisKKyAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIlNlbGVjdGVkICMgb2YgY2xpZW50czoge251bUNsaWVudHN9Iik7CisKKyAgICAgICAgICAgIHZhciB0cmFuc3BvcnRzID0gbmV3IFRDbGllbnRUcmFuc3BvcnRbbnVtQ2xpZW50c107CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNsaWVudHM7IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdCA9IEdldFRyYW5zcG9ydChhcmdzKTsKKyAgICAgICAgICAgICAgICB0cmFuc3BvcnRzW2ldID0gdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCQiU2VsZWN0ZWQgY2xpZW50IHRyYW5zcG9ydDoge3RyYW5zcG9ydHNbMF19Iik7CisKKyAgICAgICAgICAgIHZhciBwcm90b2NvbHMgPSBuZXcgVHVwbGU8UHJvdG9jb2wsIFRQcm90b2NvbD5bbnVtQ2xpZW50c107CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNsaWVudHM7IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgcCA9IEdldFByb3RvY29sKGFyZ3MsIHRyYW5zcG9ydHNbaV0pOworICAgICAgICAgICAgICAgIHByb3RvY29sc1tpXSA9IHA7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIlNlbGVjdGVkIGNsaWVudCBwcm90b2NvbDoge3Byb3RvY29sc1swXS5JdGVtMX0iKTsKKworICAgICAgICAgICAgdmFyIHRhc2tzID0gbmV3IFRhc2tbbnVtQ2xpZW50c107CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNsaWVudHM7IGkrKykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICB2YXIgdGFzayA9IFJ1bkNsaWVudEFzeW5jKHByb3RvY29sc1tpXSwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIHRhc2tzW2ldID0gdGFzazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgVGFzay5XYWl0QWxsKHRhc2tzKTsKKworICAgICAgICAgICAgYXdhaXQgVGFzay5Db21wbGV0ZWRUYXNrOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgVENsaWVudFRyYW5zcG9ydCBHZXRUcmFuc3BvcnQoc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRyYW5zcG9ydCA9IGFyZ3MuRmlyc3RPckRlZmF1bHQoeCA9PiB4LlN0YXJ0c1dpdGgoIi10ciIpKT8uU3BsaXQoJzonKT9bMV07CisKKyAgICAgICAgICAgIFRyYW5zcG9ydCBzZWxlY3RlZFRyYW5zcG9ydDsKKyAgICAgICAgICAgIGlmIChFbnVtLlRyeVBhcnNlKHRyYW5zcG9ydCwgdHJ1ZSwgb3V0IHNlbGVjdGVkVHJhbnNwb3J0KSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKHNlbGVjdGVkVHJhbnNwb3J0KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnQuVGNwOgorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUU29ja2V0Q2xpZW50VHJhbnNwb3J0KElQQWRkcmVzcy5Mb29wYmFjaywgOTA5MCk7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0Lk5hbWVkUGlwZToKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVE5hbWVkUGlwZUNsaWVudFRyYW5zcG9ydCgiLnRlc3QiKTsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnQuSHR0cDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVEh0dHBDbGllbnRUcmFuc3BvcnQobmV3IFVyaSgiaHR0cDovL2xvY2FsaG9zdDo5MDkwIiksIG51bGwpOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRyYW5zcG9ydC5UY3BCdWZmZXJlZDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVEJ1ZmZlcmVkQ2xpZW50VHJhbnNwb3J0KG5ldyBUU29ja2V0Q2xpZW50VHJhbnNwb3J0KElQQWRkcmVzcy5Mb29wYmFjaywgOTA5MCkpOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRyYW5zcG9ydC5UY3BUbHM6CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRUbHNTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzLkxvb3BiYWNrLCA5MDkwLCBHZXRDZXJ0aWZpY2F0ZSgpLCBDZXJ0VmFsaWRhdG9yLCBMb2NhbENlcnRpZmljYXRlU2VsZWN0aW9uQ2FsbGJhY2spOworICAgICAgICAgICAgICAgICAgICBjYXNlIFRyYW5zcG9ydC5GcmFtZWQ6CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFRGcmFtZWRDbGllbnRUcmFuc3BvcnQobmV3IFRTb2NrZXRDbGllbnRUcmFuc3BvcnQoSVBBZGRyZXNzLkxvb3BiYWNrLCA5MDkwKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gbm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JbmZvIGRpLCBpbnQgbWF4Q291bnQgPSA2KQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdG9wRGlyID0gZGk7CisgICAgICAgICAgICB2YXIgY2VydEZpbGUgPQorICAgICAgICAgICAgICAgIHRvcERpci5FbnVtZXJhdGVGaWxlcygiVGhyaWZ0VGVzdC5wZngiLCBTZWFyY2hPcHRpb24uQWxsRGlyZWN0b3JpZXMpCisgICAgICAgICAgICAgICAgICAgIC5GaXJzdE9yRGVmYXVsdCgpOworICAgICAgICAgICAgaWYgKGNlcnRGaWxlID09IG51bGwpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgaWYgKG1heENvdW50ID09IDApCisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIkNhbm5vdCBmaW5kIGZpbGUgaW4gZGlyZWN0b3JpZXMiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gR2V0Q2VydFBhdGgoZGkuUGFyZW50LCBtYXhDb3VudCAtIDEpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gY2VydEZpbGUuRnVsbE5hbWU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBYNTA5Q2VydGlmaWNhdGUgTG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrKG9iamVjdCBzZW5kZXIsCisgICAgICAgICAgICBzdHJpbmcgdGFyZ2V0SG9zdCwgWDUwOUNlcnRpZmljYXRlQ29sbGVjdGlvbiBsb2NhbENlcnRpZmljYXRlcywKKyAgICAgICAgICAgIFg1MDlDZXJ0aWZpY2F0ZSByZW1vdGVDZXJ0aWZpY2F0ZSwgc3RyaW5nW10gYWNjZXB0YWJsZUlzc3VlcnMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBHZXRDZXJ0aWZpY2F0ZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbCBDZXJ0VmFsaWRhdG9yKG9iamVjdCBzZW5kZXIsIFg1MDlDZXJ0aWZpY2F0ZSBjZXJ0aWZpY2F0ZSwKKyAgICAgICAgICAgIFg1MDlDaGFpbiBjaGFpbiwgU3NsUG9saWN5RXJyb3JzIHNzbFBvbGljeUVycm9ycykKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBUdXBsZTxQcm90b2NvbCwgVFByb3RvY29sPiBHZXRQcm90b2NvbChzdHJpbmdbXSBhcmdzLCBUQ2xpZW50VHJhbnNwb3J0IHRyYW5zcG9ydCkKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHByb3RvY29sID0gYXJncy5GaXJzdE9yRGVmYXVsdCh4ID0+IHguU3RhcnRzV2l0aCgiLXByIikpPy5TcGxpdCgnOicpP1sxXTsKKworICAgICAgICAgICAgUHJvdG9jb2wgc2VsZWN0ZWRQcm90b2NvbDsKKyAgICAgICAgICAgIGlmIChFbnVtLlRyeVBhcnNlKHByb3RvY29sLCB0cnVlLCBvdXQgc2VsZWN0ZWRQcm90b2NvbCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChzZWxlY3RlZFByb3RvY29sKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBQcm90b2NvbC5CaW5hcnk6CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFR1cGxlPFByb3RvY29sLCBUUHJvdG9jb2w+KHNlbGVjdGVkUHJvdG9jb2wsIG5ldyBUQmluYXJ5UHJvdG9jb2wodHJhbnNwb3J0KSk7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUHJvdG9jb2wuQ29tcGFjdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVHVwbGU8UHJvdG9jb2wsIFRQcm90b2NvbD4oc2VsZWN0ZWRQcm90b2NvbCwgbmV3IFRDb21wYWN0UHJvdG9jb2wodHJhbnNwb3J0KSk7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUHJvdG9jb2wuSnNvbjoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVHVwbGU8UHJvdG9jb2wsIFRQcm90b2NvbD4oc2VsZWN0ZWRQcm90b2NvbCwgbmV3IFRKc29uUHJvdG9jb2wodHJhbnNwb3J0KSk7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgUHJvdG9jb2wuTXVsdGlwbGV4ZWQ6CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBpdCByZXR1cm5zIEJpbmFyeVByb3RvY29sIHRvIGF2b2lkIG1ha2luZyB3cmFwcGVkIHByb3RvY29sIGFzIHB1YmxpYyBpbiBUUHJvdG9jb2xEZWNvcmF0b3IgKGluIFJ1bkNsaWVudEFzeW5jIGl0IHdpbGwgYmUgd3JhcHBlZCBpbnRvIE11bHRpcGxleGVkIHByb3RvY29sKQorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUdXBsZTxQcm90b2NvbCwgVFByb3RvY29sPihzZWxlY3RlZFByb3RvY29sLCBuZXcgVEJpbmFyeVByb3RvY29sKHRyYW5zcG9ydCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIG5ldyBUdXBsZTxQcm90b2NvbCwgVFByb3RvY29sPihzZWxlY3RlZFByb3RvY29sLCBuZXcgVEJpbmFyeVByb3RvY29sKHRyYW5zcG9ydCkpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgYXN5bmMgVGFzayBSdW5DbGllbnRBc3luYyhUdXBsZTxQcm90b2NvbCwgVFByb3RvY29sPiBwcm90b2NvbFR1cGxlLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIHByb3RvY29sID0gcHJvdG9jb2xUdXBsZS5JdGVtMjsKKyAgICAgICAgICAgICAgICB2YXIgcHJvdG9jb2xUeXBlID0gcHJvdG9jb2xUdXBsZS5JdGVtMTsKKworICAgICAgICAgICAgICAgIFRCYXNlQ2xpZW50IGNsaWVudCA9IG51bGw7CisKKyAgICAgICAgICAgICAgICB0cnkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGlmIChwcm90b2NvbFR5cGUgIT0gUHJvdG9jb2wuTXVsdGlwbGV4ZWQpCisgICAgICAgICAgICAgICAgICAgIHsKKworICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50ID0gbmV3IENhbGN1bGF0b3IuQ2xpZW50KHByb3RvY29sKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IEV4ZWN1dGVDYWxjdWxhdG9yQ2xpZW50T3BlcmF0aW9ucyhjYW5jZWxsYXRpb25Ub2tlbiwgKENhbGN1bGF0b3IuQ2xpZW50KWNsaWVudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBpdCB1c2VzIGJpbmFyeSBwcm90b2NvbCB0aGVyZSAgdG8gY3JlYXRlIE11bHRpcGxleGVkIHByb3RvY29scworICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG11bHRpcGxleCA9IG5ldyBUTXVsdGlwbGV4ZWRQcm90b2NvbChwcm90b2NvbCwgbmFtZW9mKENhbGN1bGF0b3IpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudCA9IG5ldyBDYWxjdWxhdG9yLkNsaWVudChtdWx0aXBsZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgRXhlY3V0ZUNhbGN1bGF0b3JDbGllbnRPcGVyYXRpb25zKGNhbmNlbGxhdGlvblRva2VuLCAoQ2FsY3VsYXRvci5DbGllbnQpY2xpZW50KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgbXVsdGlwbGV4ID0gbmV3IFRNdWx0aXBsZXhlZFByb3RvY29sKHByb3RvY29sLCBuYW1lb2YoU2hhcmVkU2VydmljZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50ID0gbmV3IFNoYXJlZFNlcnZpY2UuQ2xpZW50KG11bHRpcGxleCk7CisgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBFeGVjdXRlU2hhcmVkU2VydmljZUNsaWVudE9wZXJhdGlvbnMoY2FuY2VsbGF0aW9uVG9rZW4sIChTaGFyZWRTZXJ2aWNlLkNsaWVudCljbGllbnQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBMb2dnZXIuTG9nRXJyb3IoJCJ7Y2xpZW50Py5DbGllbnRJZH0gIiArIGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmluYWxseQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2wuVHJhbnNwb3J0LkNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKFRBcHBsaWNhdGlvbkV4Y2VwdGlvbiB4KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dFcnJvcih4LlRvU3RyaW5nKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgYXN5bmMgVGFzayBFeGVjdXRlQ2FsY3VsYXRvckNsaWVudE9wZXJhdGlvbnMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4sIENhbGN1bGF0b3IuQ2xpZW50IGNsaWVudCkKKyAgICAgICAgeworICAgICAgICAgICAgYXdhaXQgY2xpZW50Lk9wZW5UcmFuc3BvcnRBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisKKyAgICAgICAgICAgIC8vIEFzeW5jIHZlcnNpb24KKworICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCQie2NsaWVudC5DbGllbnRJZH0gUGluZ0FzeW5jKCkiKTsKKyAgICAgICAgICAgIGF3YWl0IGNsaWVudC5waW5nQXN5bmMoY2FuY2VsbGF0aW9uVG9rZW4pOworCisgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oJCJ7Y2xpZW50LkNsaWVudElkfSBBZGRBc3luYygxLDEpIik7CisgICAgICAgICAgICB2YXIgc3VtID0gYXdhaXQgY2xpZW50LmFkZEFzeW5jKDEsIDEsIGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIntjbGllbnQuQ2xpZW50SWR9IEFkZEFzeW5jKDEsMSk9e3N1bX0iKTsKKworICAgICAgICAgICAgdmFyIHdvcmsgPSBuZXcgV29yaworICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIE9wID0gT3BlcmF0aW9uLkRJVklERSwKKyAgICAgICAgICAgICAgICBOdW0xID0gMSwKKyAgICAgICAgICAgICAgICBOdW0yID0gMAorICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCQie2NsaWVudC5DbGllbnRJZH0gQ2FsY3VsYXRlQXN5bmMoMSkiKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBjbGllbnQuY2FsY3VsYXRlQXN5bmMoMSwgd29yaywgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIntjbGllbnQuQ2xpZW50SWR9IFdob2Egd2UgY2FuIGRpdmlkZSBieSAwIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoSW52YWxpZE9wZXJhdGlvbiBpbykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oJCJ7Y2xpZW50LkNsaWVudElkfSBJbnZhbGlkIG9wZXJhdGlvbjogIiArIGlvKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgd29yay5PcCA9IE9wZXJhdGlvbi5TVUJUUkFDVDsKKyAgICAgICAgICAgIHdvcmsuTnVtMSA9IDE1OworICAgICAgICAgICAgd29yay5OdW0yID0gMTA7CisKKyAgICAgICAgICAgIHRyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIntjbGllbnQuQ2xpZW50SWR9IENhbGN1bGF0ZUFzeW5jKDEpIik7CisgICAgICAgICAgICAgICAgdmFyIGRpZmYgPSBhd2FpdCBjbGllbnQuY2FsY3VsYXRlQXN5bmMoMSwgd29yaywgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIntjbGllbnQuQ2xpZW50SWR9IDE1LTEwPXtkaWZmfSIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2F0Y2ggKEludmFsaWRPcGVyYXRpb24gaW8pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCQie2NsaWVudC5DbGllbnRJZH0gSW52YWxpZCBvcGVyYXRpb246ICIgKyBpbyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIntjbGllbnQuQ2xpZW50SWR9IEdldFN0cnVjdEFzeW5jKDEpIik7CisgICAgICAgICAgICB2YXIgbG9nID0gYXdhaXQg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uc3BvcnQKK2Zyb20gdGhyaWZ0LnByb3RvY29sIGltcG9ydCBUQmluYXJ5UHJvdG9jb2wKK2Zyb20gdGhyaWZ0LnNlcnZlciBpbXBvcnQgVFNlcnZlcgorCisKK2NsYXNzIENhbGN1bGF0b3JIYW5kbGVyOgorICAgIGRlZiBfX2luaXRfXyhzZWxmKToKKyAgICAgICAgc2VsZi5sb2cgPSB7fQorCisgICAgZGVmIFBpbmcoc2VsZik6CisgICAgICAgIHByaW50KCdwaW5nKCknKQorCisgICAgZGVmIEFkZChzZWxmLCBuMSwgbjIpOgorICAgICAgICBwcmludCgnYWRkKCVkLCVkKScgJSAobjEsIG4yKSkKKyAgICAgICAgcmV0dXJuIG4xICsgbjIKKworICAgIGRlZiBDYWxjdWxhdGUoc2VsZiwgbG9naWQsIHdvcmspOgorICAgICAgICBwcmludCgnY2FsY3VsYXRlKCVkLCAlciknICUgKGxvZ2lkLCB3b3JrKSkKKworICAgICAgICBpZiB3b3JrLk9wID09IE9wZXJhdGlvbi5BZGQ6CisgICAgICAgICAgICB2YWwgPSB3b3JrLk51bTEgKyB3b3JrLk51bTIKKyAgICAgICAgZWxpZiB3b3JrLk9wID09IE9wZXJhdGlvbi5TdWJzdHJhY3Q6CisgICAgICAgICAgICB2YWwgPSB3b3JrLk51bTEgLSB3b3JrLk51bTIKKyAgICAgICAgZWxpZiB3b3JrLk9wID09IE9wZXJhdGlvbi5NdWx0aXBseToKKyAgICAgICAgICAgIHZhbCA9IHdvcmsuTnVtMSAqIHdvcmsuTnVtMgorICAgICAgICBlbGlmIHdvcmsuT3AgPT0gT3BlcmF0aW9uLkRpdmlkZToKKyAgICAgICAgICAgIGlmIHdvcmsuTnVtMiA9PSAwOgorICAgICAgICAgICAgICAgIHggPSBJbnZhbGlkT3BlcmF0aW9uKCkKKyAgICAgICAgICAgICAgICB4LldoYXRPcCA9IHdvcmsuT3AKKyAgICAgICAgICAgICAgICB4LldoeSA9ICdDYW5ub3QgZGl2aWRlIGJ5IDAnCisgICAgICAgICAgICAgICAgcmFpc2UgeAorICAgICAgICAgICAgdmFsID0gd29yay5OdW0xIC8gd29yay5OdW0yCisgICAgICAgIGVsc2U6CisgICAgICAgICAgICB4ID0gSW52YWxpZE9wZXJhdGlvbigpCisgICAgICAgICAgICB4LldoYXRPcCA9IHdvcmsuT3AKKyAgICAgICAgICAgIHguV2h5ID0gJ0ludmFsaWQgb3BlcmF0aW9uJworICAgICAgICAgICAgcmFpc2UgeAorCisgICAgICAgIGxvZyA9IFNoYXJlZFN0cnVjdCgpCisgICAgICAgIGxvZy5LZXkgPSBsb2dpZAorICAgICAgICBsb2cuVmFsdWUgPSAnJWQnICUgKHZhbCkKKyAgICAgICAgc2VsZi5sb2dbbG9naWRdID0gbG9nCisKKyAgICAgICAgcmV0dXJuIHZhbAorCisgICAgZGVmIEdldFN0cnVjdChzZWxmLCBrZXkpOgorICAgICAgICBwcmludCgnZ2V0U3RydWN0KCVkKScgJSAoa2V5KSkKKyAgICAgICAgcmV0dXJuIHNlbGYubG9nW2tleV0KKworICAgIGRlZiBaaXAoc2VsZik6CisgICAgICAgIHByaW50KCd6aXAoKScpCisKK2lmIF9fbmFtZV9fID09ICdfX21haW5fXyc6CisgICAgaGFuZGxlciA9IENhbGN1bGF0b3JIYW5kbGVyKCkKKyAgICBwcm9jZXNzb3IgPSBDYWxjdWxhdG9yLlByb2Nlc3NvcihoYW5kbGVyKQorICAgIHRyYW5zcG9ydCA9IFRTb2NrZXQuVFNlcnZlclNvY2tldChob3N0PSJ0ZXN0c2VydmVyIiwgcG9ydD05MDkwKQorICAgIHRmYWN0b3J5ID0gVFRyYW5zcG9ydC5UQnVmZmVyZWRUcmFuc3BvcnRGYWN0b3J5KCkKKyAgICBwZmFjdG9yeSA9IFRCaW5hcnlQcm90b2NvbC5UQmluYXJ5UHJvdG9jb2xGYWN0b3J5KCkKKworICAgIHNlcnZlciA9IFRTZXJ2ZXIuVFNpbXBsZVNlcnZlcihwcm9jZXNzb3IsIHRyY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m47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHVzaW5nICh2YXIgc291cmNlID0gbmV3IENhbmNlbGxhdGlvblRva2VuU291cmNlKCkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgUnVuQXN5bmMoYXJncywgc291cmNlLlRva2VuKS5HZXRBd2FpdGVyKCkuR2V0UmVzdWx0KCk7CisKKyAgICAgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oIlByZXNzIGFueSBrZXkgdG8gc3RvcC4uLiIpOworCisgICAgICAgICAgICAgICAgQ29uc29sZS5SZWFkTGluZSgpOworICAgICAgICAgICAgICAgIHNvdXJjZS5DYW5jZWwoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCJTZXJ2ZXIgc3RvcHBlZCIpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBEaXNwbGF5SGVscCgpCisgICAgICAgIHsKKyAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbihAIgorVXNhZ2U6IAorICAgIFNlcnZlci5leGUgLWhlbHAKKyAgICAgICAgd2lsbCBkaXBsYXkgaGVscCBpbmZvcm1hdGlvbiAKKworICAgIFNlcnZlci5leGUgLXRyOjx0cmFuc3BvcnQ+IC1wcjo8cHJvdG9jb2w+CisgICAgICAgIHdpbGwgcnVuIHNlcnZlciB3aXRoIHNwZWNpZmllZCBhcmd1bWVudHMgKHRjcCB0cmFuc3BvcnQgYW5kIGJpbmFyeSBwcm90b2NvbCBieSBkZWZhdWx0KQorCitPcHRpb25zOgorICAgIC10ciAodHJhbnNwb3J0KTogCisgICAgICAgIHRjcCAtIChkZWZhdWx0KSB0Y3AgdHJhbnNwb3J0IHdpbGwgYmUgdXNlZCAoaG9zdCAtICIibG9jYWxob3N0IiIsIHBvcnQgLSA5MDkwKQorICAgICAgICB0Y3BidWZmZXJlZCAtIHRjcCBid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VHJhbnNwb3J0ID0gR2V0VHJhbnNwb3J0KGFyZ3MpOworICAgICAgICAgICAgdmFyIHNlbGVjdGVkUHJvdG9jb2wgPSBHZXRQcm90b2NvbChhcmdzKTsKKworICAgICAgICAgICAgaWYgKHNlbGVjdGVkVHJhbnNwb3J0ID09IFRyYW5zcG9ydC5IdHRwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIG5ldyBIdHRwU2VydmVyU2FtcGxlKCkuUnVuKGNhbmNlbGxhdGlvblRva2VuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhd2FpdCBSdW5TZWxlY3RlZENvbmZpZ3VyYXRpb25Bc3luYyhzZWxlY3RlZFRyYW5zcG9ydCwgc2VsZWN0ZWRQcm90b2NvbCwgY2FuY2VsbGF0aW9uVG9rZW4pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgUHJvdG9jb2wgR2V0UHJvdG9jb2woc3RyaW5nW10gYXJncykKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRyYW5zcG9ydCA9IGFyZ3MuRmlyc3RPckRlZmF1bHQoeCA9PiB4LlN0YXJ0c1dpdGgoIi1wciIpKT8uU3BsaXQoJzonKT9bMV07CisKKyAgICAgICAgICAgIEVudW0uVHJ5UGFyc2UodHJhbnNwb3J0LCB0cnVlLCBvdXQgUHJvdG9jb2wgc2VsZWN0ZWRQcm90b2NvbCk7CisKKyAgICAgICAgICAgIHJldHVybiBzZWxlY3RlZFByb3RvY29sOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgVHJhbnNwb3J0IEdldFRyYW5zcG9ydChzdHJpbmdbXSBhcmdzKQorICAgICAgICB7CisgICAgICAgICAgICB2YXIgdHJhbnNwb3J0ID0gYXJncy5GaXJzdE9yRGVmYXVsdCh4ID0+IHguU3RhcnRzV2l0aCgiLXRyIikpPy5TcGxpdCgnOicpP1sxXTsKKworICAgICAgICAgICAgRW51bS5UcnlQYXJzZSh0cmFuc3BvcnQsIHRydWUsIG91dCBUcmFuc3BvcnQgc2VsZWN0ZWRUcmFuc3BvcnQpOworCisgICAgICAgICAgICByZXR1cm4gc2VsZWN0ZWRUcmFuc3BvcnQ7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBhc3luYyBUYXNrIFJ1blNlbGVjdGVkQ29uZmlndXJhdGlvbkFzeW5jKFRyYW5zcG9ydCB0cmFuc3BvcnQsIFByb3RvY29sIHByb3RvY29sLCBDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIGZhYnJpYyA9IG5ldyBMb2dnZXJGYWN0b3J5KCkuQWRkQ29uc29sZShMb2dMZXZlbC5UcmFjZSkuQWRkRGVidWcoTG9nTGV2ZWwuVHJhY2UpOworICAgICAgICAgICAgdmFyIGhhbmRsZXIgPSBuZXcgQ2FsY3VsYXRvckFzeW5jSGFuZGxlcigpOworICAgICAgICAgICAgSVRBc3luY1Byb2Nlc3NvciBwcm9jZXNzb3IgPSBudWxsOworCisgICAgICAgICAgICBUU2VydmVyVHJhbnNwb3J0IHNlcnZlclRyYW5zcG9ydCA9IG51bGw7CisKKyAgICAgICAgICAgIHN3aXRjaCAodHJhbnNwb3J0KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0LlRjcDoKKyAgICAgICAgICAgICAgICAgICAgc2VydmVyVHJhbnNwb3J0ID0gbmV3IFRTZXJ2ZXJTb2NrZXRUcmFuc3BvcnQoOTA5MCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgVHJhbnNwb3J0LlRjcEJ1ZmZlcmVkOgorICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQgPSBuZXcgVFNlcnZlclNvY2tldFRyYW5zcG9ydChwb3J0OiA5MDkwLCBjbGllbnRUaW1lb3V0OiAxMDAwMCwgdXNlQnVmZmVyZWRTb2NrZXRzOiB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnQuTmFtZWRQaXBlOgorICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQgPSBuZXcgVE5hbWVkUGlwZVNlcnZlclRyYW5zcG9ydCgiLnRlc3QiKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnQuVGNwVGxzOgorICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQgPSBuZXcgVFRsc1NlcnZlclNvY2tldFRyYW5zcG9ydCg5MDkwLCBmYWxzZSwgR2V0Q2VydGlmaWNhdGUoKSwgQ2xpZW50Q2VydFZhbGlkYXRvciwgTG9jYWxDZXJ0aWZpY2F0ZVNlbGVjdGlvbkNhbGxiYWNrKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBUcmFuc3BvcnQuRnJhbWVkOgorICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJUcmFuc3BvcnQgPSBuZXcgVFNlcnZlckZyYW1lZFRyYW5zcG9ydCg5MDkwKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIElUUHJvdG9jb2xGYWN0b3J5IGlucHV0UHJvdG9jb2xGYWN0b3J5OworICAgICAgICAgICAgSVRQcm90b2NvbEZhY3Rvcnkgb3V0cHV0UHJvdG9jb2xGYWN0b3J5OworCisgICAgICAgICAgICBzd2l0Y2ggKHByb3RvY29sKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGNhc2UgUHJvdG9jb2wuQmluYXJ5OgorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnkgPSBuZXcgVEJpbmFyeVByb3RvY29sLkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2xGYWN0b3J5ID0gbmV3IFRCaW5hcnlQcm90b2NvbC5GYWN0b3J5KCk7CisgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NvciA9IG5ldyBDYWxjdWxhdG9yLkFzeW5jUHJvY2Vzc29yKGhhbmRsZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBQcm90b2NvbC5Db21wYWN0OgorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRQcm90b2NvbEZhY3RvcnkgPSBuZXcgVENvbXBhY3RQcm90b2NvbC5GYWN0b3J5KCk7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dFByb3RvY29sRmFjdG9yeSA9IG5ldyBUQ29tcGFjdFByb3RvY29sLkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc29yID0gbmV3IENhbGN1bGF0b3IuQXN5bmNQcm9jZXNzb3IoaGFuZGxlcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFByb3RvY29sLkpzb246CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sRmFjdG9yeSA9IG5ldyBUSnNvblByb3RvY29sLkZhY3RvcnkoKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0cHV0UHJvdG9jb2xGYWN0b3J5ID0gbmV3IFRKc29uUHJvdG9jb2wuRmFjdG9yeSgpOworICAgICAgICAgICAgICAgICAgICBwcm9jZXNzb3IgPSBuZXcgQ2FsY3VsYXRvci5Bc3luY1Byb2Nlc3NvcihoYW5kbGVyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgUHJvdG9jb2wuTXVsdGlwbGV4ZWQ6CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpbnB1dFByb3RvY29sRmFjdG9yeSA9IG5ldyBUQmluYXJ5UHJvdG9jb2wuRmFjdG9yeSgpOworICAgICAgICAgICAgICAgICAgICBvdXRwdXRQcm90b2NvbEZhY3RvcnkgPSBuZXcgVEJpbmFyeVByb3RvY29sLkZhY3RvcnkoKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgY2FsY0hhbmRsZXIgPSBuZXcgQ2FsY3VsYXRvckFzeW5jSGFuZGxlcigpOworICAgICAgICAgICAgICAgICAgICB2YXIgY2FsY1Byb2Nlc3NvciA9IG5ldyBDYWxjdWxhdG9yLkFzeW5jUHJvY2Vzc29yKGNhbGNIYW5kbGVyKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgc2hhcmVkU2VydmljZUhhbmRsZXIgPSBuZXcgU2hhcmVkU2VydmljZUFzeW5jSGFuZGxlcigpOworICAgICAgICAgICAgICAgICAgICB2YXIgc2hhcmVkU2VydmljZVByb2Nlc3NvciA9IG5ldyBTaGFyZWRTZXJ2aWNlLkFzeW5jUHJvY2Vzc29yKHNoYXJlZFNlcnZpY2VIYW5kbGVyKTsKKworICAgICAgICAgICAgICAgICAgICB2YXIgbXVsdGlwbGV4ZWRQcm9jZXNzb3IgPSBuZXcgVE11bHRpcGxleGVkUHJvY2Vzc29yKCk7CisgICAgICAgICAgICAgICAgICAgIG11bHRpcGxleGVkUHJvY2Vzc29yLlJlZ2lzdGVyUHJvY2Vzc29yKG5hbWVvZihDYWxjdWxhdG9yKSwgY2FsY1Byb2Nlc3Nvcik7CisgICAgICAgICAgICAgICAgICAgIG11bHRpcGxleGVkUHJvY2Vzc29yLlJlZ2lzdGVyUHJvY2Vzc29yKG5hbWVvZihTaGFyZWRTZXJ2aWNlKSwgc2hhcmVkU2VydmljZVByb2Nlc3Nvcik7CisKKyAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc29yID0gbXVsdGlwbGV4ZWRQcm9jZXNzb3I7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJndW1lbnRPdXRPZlJhbmdlRXhjZXB0aW9uKG5hbWVvZihwcm90b2NvbCksIHByb3RvY29sLCBudWxsKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKAorICAgICAgICAgICAgICAgICAgICAkIlNlbGVjdGVkIFRBc3luY1NlcnZlciB3aXRoIHtzZXJ2ZXJUcmFuc3BvcnR9IHRyYW5zcG9ydCwge3Byb2Nlc3Nvcn0gcHJvY2Vzc29yIGFuZCB7aW5wdXRQcm90b2NvbEZhY3Rvcnl9IHByb3RvY29sIGZhY3RvcmllcyIpOworCisgICAgICAgICAgICAgICAgdmFyIHNlcnZlciA9IG5ldyBBc3luY0Jhc2VTZXJ2ZXIocHJvY2Vzc29yLCBzZXJ2ZXJUcmFuc3BvcnQsIGlucHV0UHJvdG9jb2xGYWN0b3J5LCBvdXRwdXRQcm90b2NvbEZhY3RvcnksIGZhYnJpYyk7CisKKyAgICAgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oIlN0YXJ0aW5nIHRoZSBzZXJ2ZXIuLi4iKTsKKyAgICAgICAgICAgICAgICBhd2FpdCBzZXJ2ZXIuU2VydmVBc3luYyhjYW5jZWxsYXRpb25Ub2tlbik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoRXhjZXB0aW9uIHgpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKHguVG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBYNTA5Q2VydGlmaWNhdGUyIEdldENlcnRpZmljYXRlKCkKKyAgICAgICAgeworICAgICAgICAgICAgLy8gZHVlIHRvIGZpbGVzIGxvY2F0aW9uIGluIG5ldCBjb3JlIGJldHRlciB0byB0YWtlIGNlcnRzIGZyb20gdG9wIGZvbGRlcgorICAgICAgICAgICAgdmFyIGNlcnRGaWxlID0gR2V0Q2VydFBhdGgoRGlyZWN0b3J5LkdldFBhcmVudChEaXJlY3RvcnkuR2V0Q3VycmVudERpcmVjdG9yeSgpKSk7CisgICAgICAgICAgICByZXR1cm4gbmV3IFg1MDlDZXJ0aWZpY2F0ZTIoY2VydEZpbGUsICJUaHJpZnRUZXN0Iik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgR2V0Q2VydFBhdGgoRGlyZWN0b3J5SW5mbyBkaSwgaW50IG1heENvdW50ID0gNikKKyAgICAgICAgeworICAgICAgICAgICAgdmFyIHRvcERpciA9IGRpOworICAgICAgICAgICAgdmFyIGNlcnRGaWxlID0KKyAgICAgICAgICAgICAgICB0b3BEaXIuRW51bWVyYXRlRmlsZXMoIlRocmlmdFRlc3QucGZ4IiwgU2VhcmNoT3B0aW9uLkFsbERpcmVjdG9yaWVzKQorICAgICAgICAgICAgICAgICAgICAuRmlyc3RPckRlZmF1bHQoKTsKKyAgICAgICAgICAgIGlmIChjZXJ0RmlsZSA9PSBudWxsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmIChtYXhDb3VudCA9PSAwKQorICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRmlsZU5vdEZvdW5kRXhjZXB0aW9uKCJDYW5ub3QgZmluZCBmaWxlIGluIGRpcmVjdG9yaWVzIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIEdldENlcnRQYXRoKGRpLlBhcmVudCwgbWF4Q291bnQgLSAxKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGNlcnRGaWxlLkZ1bGxOYW1lOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgWDUwOUNlcnRpZmljYXRlIExvY2FsQ2VydGlmaWNhdGVTZWxlY3Rpb25DYWxsYmFjayhvYmplY3Qgc2VuZGVyLAorICAgICAgICAgICAgc3RyaW5nIHRhcmdldEhvc3QsIFg1MDlDZXJ0aWZpY2F0ZUNvbGxlY3Rpb24gbG9jYWxDZXJ0aWZpY2F0ZXMsCisgICAgICAgICAgICBYNTA5Q2VydGlmaWNhdGUgcmVtb3RlQ2VydGlmaWNhdGUsIHN0cmluZ1tdIGFjY2VwdGFibGVJc3N1ZXJzKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gR2V0Q2VydGlmaWNhdGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3RhdGljIGJvb2wgQ2xpZW50Q2VydFZhbGlkYXRvcihvYmplY3Qgc2VuZGVyLCBYNTA5Q2VydGlmaWNhdGUgY2VydGlmaWNhdGUsCisgICAgICAgICAgICBYNTA5Q2hhaW4gY2hhaW4sIFNzbFBvbGljeUVycm9ycyBzc2xQb2xpY3lFcnJvcnMpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBlbnVtIFRyYW5zcG9ydAorICAgICAgICB7CisgICAgICAgICAgICBUY3AsCisgICAgICAgICAgICBUY3BCdWZmZXJlZCwKKyAgICAgICAgICAgIE5hbWVkUGlwZSwKKyAgICAgICAgICAgIEh0dHAsCisgICAgICAgICAgICBUY3BUbHMsCisgICAgICAgICAgICBGcmFtZWQKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgZW51bSBQcm90b2NvbAorICAgICAgICB7CisgICAgICAgICAgICBCaW5hcnksCisgICAgICAgICAgICBDb21wYWN0LAorICAgICAgICAgICAgSnNvbiwKKyAgICAgICAgICAgIE11bHRpcGxleGVkCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgY2xhc3MgSHR0cFNlcnZlclNhbXBsZQorICAgICAgICB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBSdW4oQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgdmFyIGNvbmZpZyA9IG5ldyBDb25maWd1cmF0aW9uQnVpbGRlcigpCisgICAgICAgICAgICAgICAgICAgIC5BZGRFbnZpcm9ubWVudFZhcmlhYmxlcyhwcmVmaXg6ICJBU1BORVRDT1JFXyIpCisgICAgICAgICAgICAgICAgICAgIC5CdWlsZCgpOworCisgICAgICAgICAgICAgICAgdmFyIGhvc3QgPSBuZXcgV2ViSG9zdEJ1aWxkZXIoKQorICAgICAgICAgICAgICAgICAgICAuVXNlQ29uZmlndXJhdGlvbihjb25maWcpCisgICAgICAgICAgICAgICAgICAgIC5Vc2VLZXN0cmVsKCkKKyAgICAgICAgICAgICAgICAgICAgLlVzZVVybHMoImh0dHA6Ly9sb2NhbGhvc3Q6OTA5MCIpCisgICAgICAgICAgICAgICAgICAgIC5Vc2VDb250ZW50Um9vdChEaXJlY3RvcnkuR2V0Q3VycmVudERpcmVjdG9yeSgpKQorICAgICAgICAgICAgICAgICAgICAuVXNlU3RhcnR1cDxTdGFydHVwPigpCisgICAgICAgICAgICAgICAgICAgIC5CdWlsZCgpOworCisgICAgICAgICAgICAgICAgaG9zdC5SdW5Bc3luYyhjYW5jZWxsYXRpb25Ub2tlbikuR2V0QXdhaXRlcigpLkdldFJlc3VsdCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgY2xhc3MgU3RhcnR1cAorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHB1YmxpYyBTdGFydHVwKElIb3N0aW5nRW52aXJvbm1lbnQgZW52KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgdmFyIGJ1aWxkZXIgPSBuZXcgQ29uZmlndXJhdGlvbkJ1aWxkZXIoKQorICAgICAgICAgICAgICAgICAgICAgICAgLlNldEJhc2VQYXRoKGVudi5Db250ZW50Um9vdFBhdGgpCisgICAgICAgICAgICAgICAgICAgICAgICAuQWRkRW52aXJvbm1lbnRWYXJpYWJsZXMoKTsKKworICAgICAgICAgICAgICAgICAgICBDb25maWd1cmF0aW9uID0gYnVpbGRlci5CdWlsZCgpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHB1YmxpYyBJQ29uZmlndXJhdGlvblJvb3QgQ29uZmlndXJhdGlvbiB7IGdldDsgfQorCisgICAgICAgICAgICAgICAgLy8gVGhpcyBtZXRob2QgZ2V0cyBjYWxsZWQgYnkgdGhlIHJ1bnRpbWUuIFVzZSB0aGlzIG1ldGhvZCB0byBhZGQgc2VydmljZXMgdG8gdGhlIGNvbnRhaW5lci4KKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBDb25maWd1cmVTZXJ2aWNlcyhJU2VydmljZUNvbGxlY3Rpb24gc2VydmljZXMpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlcy5BZGRUcmFuc2llbnQ8Q2FsY3VsYXRvci5JQXN5bmMsIENhbGN1bGF0b3JBc3luY0hhbmRsZXI+KCk7CisgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VzLkFkZFRyYW5zaWVudDxJVEFzeW5jUHJvY2Vzc29yLCBDYWxjdWxhdG9yLkFzeW5jUHJvY2Vzc29yPigpOworICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlcy5BZGRUcmFuc2llbnQ8VEh0dHBTZXJ2ZXJUcmFuc3BvcnQsIFRIdHRwU2VydmVyVHJhbnNwb3J0PigpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIFRoaXMgbWV0aG9kIGdldHMgY2FsbGVkIGJ5IHRoZSBydW50aW1lLiBVc2UgdGhpcyBtZXRob2QgdG8gY29uZmlndXJlIHRoZSBIVFRQIHJlcXVlc3QgcGlwZWxpbmUuCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgQ29uZmlndXJlKElBcHBsaWNhdGlvbkJ1aWxkZXIgYXBwLCBJSG9zdGluZ0Vudmlyb25tZW50IGVudiwKKyAgICAgICAgICAgICAgICAgICAgSUxvZ2dlckZhY3RvcnkgbG9nZ2VyRmFjdG9yeSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGFwcC5Vc2VNaWRkbGV3YXJlPFRIdHRwU2VydmVyVHJhbnNwb3J0PigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBjbGFzcyBDYWxjdWxhdG9yQXN5bmNIYW5kbGVyIDogQ2FsY3VsYXRvci5JQXN5bmMKKyAgICAgICAgeworICAgICAgICAgICAgcHJpdmF0ZSByZWFkb25seSBEaWN0aW9uYXJ5PGludCwgU2hhcmVkU3RydWN0PiBfbG9nID0gbmV3IERpY3Rpb25hcnk8aW50LCBTaGFyZWRTdHJ1Y3Q+KCk7CisKKyAgICAgICAgICAgIHB1YmxpYyBDYWxjdWxhdG9yQXN5bmNIYW5kbGVyKCkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8U2hhcmVkU3RydWN0PiBnZXRTdHJ1Y3RBc3luYyhpbnQga2V5LAorICAgICAgICAgICAgICAgIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigiR2V0U3RydWN0QXN5bmMoezB9KSIsIGtleSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbVJlc3VsdChfbG9nW2tleV0pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayBwaW5nQXN5bmMoQ2FuY2VsbGF0aW9uVG9rZW4gY2FuY2VsbGF0aW9uVG9rZW4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTG9nZ2VyLkxvZ0luZm9ybWF0aW9uKCJQaW5nQXN5bmMoKSIpOworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suQ29tcGxldGVkVGFzazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8aW50PiBhZGRBc3luYyhpbnQgbnVtMSwgaW50IG51bTIsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIkFkZEFzeW5jKHtudW0xfSx7bnVtMn0pIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbVJlc3VsdChudW0xICsgbnVtMik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBhc3luYyBUYXNrPGludD4gY2FsY3VsYXRlQXN5bmMoaW50IGxvZ2lkLCBXb3JrIHcsIENhbmNlbGxhdGlvblRva2VuIGNhbmNlbGxhdGlvblRva2VuKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIExvZ2dlci5Mb2dJbmZvcm1hdGlvbigkIkNhbGN1bGF0ZUFzeW5jKHtsb2dpZH0sIFt7dy5PcH0se3cuTnVtMX0se3cuTnVtMn1dKSIpOworCisgICAgICAgICAgICAgICAgdmFyIHZhbCA9IDA7CisgICAgICAgICAgICAgICAgc3dpdGNoICh3Lk9wKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBPcGVyYXRpb24uQUREOgorICAgICAgICAgICAgICAgICAgICAgICAgdmFsID0gdy5OdW0xICsgdy5OdW0yOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBPcGVyYXRpb24uU1VCVFJBQ1Q6CisgICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSB3Lk51bTEgLSB3Lk51bTI7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBjYXNlIE9wZXJhdGlvbi5NVUxUSVBMWToKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbCA9IHcuTnVtMSAqIHcuTnVtMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgICAgIGNhc2UgT3BlcmF0aW9uLkRJVklERToKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3Lk51bTIgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaW8gPSBuZXcgSW52YWxpZE9wZXJhdGlvbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2hhdE9wID0gKGludCkgdy5PcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2h5ID0gIkNhbm5vdCBkaXZpZGUgYnkgMCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaW87CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB2YWwgPSB3Lk51bTEgLyB3Lk51bTI7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaW8gPSBuZXcgSW52YWxpZE9wZXJhdGlvbgorICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdoYXRPcCA9IChpbnQpIHcuT3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2h5ID0gIlVua25vd24gb3BlcmF0aW9uIgorICAgICAgICAgICAgICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaW87CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB2YXIgZW50cnkgPSBuZXcgU2hhcmVkU3RydWN0CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBLZXkgPSBsb2dpZCwKKyAgICAgICAgICAgICAgICAgICAgVmFsdWUgPSB2YWwuVG9TdHJpbmcoKQorICAgICAgICAgICAgICAgIH07CisKKyAgICAgICAgICAgICAgICBfbG9nW2xvZ2lkXSA9IGVudHJ5OworCisgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IFRhc2suRnJvbVJlc3VsdCh2YWwpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgYXN5bmMgVGFzayB6aXBBc3luYyhDYW5jZWxsYXRpb25Ub2tlbiBjYW5jZWxsYXRpb25Ub2tlbikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBMb2dnZXIuTG9nSW5mb3JtYXRpb24oIlppcEFzeW5jKCkgd2l0aCBkZWxheSAxMDBtYyIpOworICAgICAgICAgICAgICAgIGF3YWl0IFRhc2suRGVsYXkoMTAwLCBDYW5jZWxsYXRpb25Ub2tlbi5Ob25lKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBjbGFzcyBTaGFyZWRTZXJ2aWNlQXN5bmNIYW5kbGVyIDogU2hhcmVkU2VydmljZS5JQXN5bmMKKyAgICAgICAgeworICAgICAgICAgICAgcHVibGljIGFzeW5jIFRhc2s8U2hhcmVkU3R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nKCJjYWxjdWxhdGUoIiwgbG9naWQsICIsIiwgd29yaywgIikiKTsKKworICAgIHZhciB2YWwgPSAwOworICAgIGlmICh3b3JrLm9wID09IHR0eXBlcy5PcGVyYXRpb24uQUREKSB7CisgICAgICB2YWwgPSB3b3JrLm51bTEgKyB3b3JrLm51bTI7CisgICAgfSBlbHNlIGlmICh3b3JrLm9wID09PSB0dHlwZXMuT3BlcmF0aW9uLlNVQlRSQUNUKSB7CisgICAgICB2YWwgPSB3b3JrLm51bTEgLSB3b3JrLm51bTI7CisgICAgfSBlbHNlIGlmICh3b3JrLm9wID09PSB0dHlwZXMuT3BlcmF0aW9uLk1VTFRJUExZKSB7CisgICAgICB2YWwgPSB3b3JrLm51bTEgKiB3b3JrLm51bTI7CisgICAgfSBlbHNlIGlmICh3b3JrLm9wID09PSB0dHlwZXMuT3BlcmF0aW9uLkRJVklERSkgeworICAgICAgaWYgKHdvcmsubnVtMiA9PT0gMCkgeworICAgICAgICB2YXIgeCA9IG5ldyB0dHlwZXMuSW52YWxpZE9wZXJhdGlvbigpOworICAgICAgICB4LndoYXRPcCA9IHdvcmsub3A7CisgICAgICAgIHgud2h5ID0gJ0Nhbm5vdCBkaXZpZGUgYnkgMCc7CisgICAgICAgIHJlc3VsdCh4KTsKKyAgICAgICAgcmV0dXJuOworICAgICAgfQorICAgICAgdmFsID0gd29yay5udW0xIC8gd29yay5udW0yOworICAgIH0gZWxzZSB7CisgICAgICB2YXIgeCA9IG5ldyB0dHlwZXMuSW52YWxpZE9wZXJhdGlvbigpOworICAgICAgeC53aGF0T3AgPSB3b3JrLm9wOworICAgICAgeC53aHkgPSAnSW52YWxpZCBvcGVyYXRpb24nOworICAgICAgcmVzdWx0KHgpOworICAgICAgcmV0dXJuOworICAgIH0KKworICAgIHZhciBlbnRyeSA9IG5ldyBTaGFyZWRTdHJ1Y3QoKTsKKyAgICBlbnRyeS5rZXkgPSBsb2dpZDsKKyAgICBlbnRyeS52YWx1ZSA9ICIiK3ZhbDs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Bjb25zb2xlLmxvZygicGluZygpIik7CisgIH0sCisKKyAgYWRkOiBmdW5jdGlvbihuMSwgbjIpIHsKKyAgICBjb25zb2xlLmxvZygiYWRkKCIsIG4xLCAiLCIsIG4yLCAiKSIpOworICAgIHJldHVybiBuMSArIG4yOworICB9LAorCisgIGNhbGN1bGF0ZTogZnVuY3Rpb24obG9naWQsIHdvcmspIHsKKyAgICBjb25zb2xlLmxvZygiY2FsY3VsYXRlKCIsIGxvZ2lkLCAiLCIsIHdvcmssICIpIik7CisKKyAgICB2YXIgdmFsID0gMDsKKyAgICBpZiAod29yay5vcCA9PSB0dHlwZXMuT3BlcmF0aW9uLkFERCkgeworICAgICAgdmFsID0gd29yay5udW0xICsgd29yay5udW0yOworICAgIH0gZWxzZSBpZiAod29yay5vcCA9PT0gdHR5cGVzLk9wZXJhdGlvbi5TVUJUUkFDVCkgeworICAgICAgdmFsID0gd29yay5udW0xIC0gd29yay5udW0yOworICAgIH0gZWxzZSBpZiAod29yay5vcCA9PT0gdHR5cGVzLk9wZXJhdGlvbi5NVUxUSVBMWSkgeworICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yOworICAgIH0gZWxzZSBpZiAod29yay5vcCA9PT0gdHR5cGVzLk9wZXJhdGlvbi5ESVZJREUpIHsKKyAgICAgIGlmICh3b3JrLm51bTIgPT09IDApIHsKKyAgICAgICAgdmFyIHggPSBuZXcgdHR5cGVzLkludmFsaWRPcGVyYXRpb24oKTsKKyAgICAgICAgeC53aGF0T3AgPSB3b3JrLm9wOworICAgICAgICB4LndoeSA9ICdDYW5ub3QgZGl2aWRlIGJ5IDAnOworCQl0aHJvdyB4OworICAgICAgfQorICAgICAgdmFsID0gd29yay5udW0xIC8gd29yay5udW0yOworICAgIH0gZWxzZSB7CisgICAgICB2YXIgeCA9IG5ldyB0dHlwZXMuSW52YWxpZE9wZXJhdGlvbigpOworICAgICAgeC53aGF0T3AgPSB3b3JrLm9wOworICAgICAgeC53aHkgPSAnSW52YWxpZC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DEzIEBACiAgICAgICAgIGVsaWYgd29yay5vcCA9PSBPcGVyYXRpb24uRElWSURFOgogICAgICAgICAgICAgaWYgd29yay5udW0yID09IDA6CiAgICAgICAgICAgICAgICAgeCA9IEludmFsaWRPcGVyYXRpb24oKQotICAgICAgICAgICAgICAgIHgud2hhdCA9IHdvcmsub3AKKyAgICAgICAgICAgICAgICB4LndoYXRPcCA9IHdvcmsub3AKICAgICAgICAgICAgICAgICB4LndoeSA9ICJDYW5ub3QgZGl2aWRlIGJ5IDAiCiAgICAgICAgICAgICAgICAgcmFpc2UgeAogICAgICAgICAgICAgdmFsID0gd29yay5udW0xIC8gd29yay5udW0yCiAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICB4ID0gSW52YWxpZE9wZXJhdGlvbigpCi0gICAgICAgICAgICB4LndoYXQgPSB3b3JrLm9wCisgICAgICAgICAgICB4LndoYXRPcCA9IHdvcmsub3AKICAgICAgICAgICAgIHgud2h5ID0gIkludmFsaWQgb3BlcmF0aW9uIgogICAgICAgICAgICAgcmFpc2UgeAogCkBAIC03NiwxNSArNzMsMTQgQEAKICAgICAgICAgbG9nLmtleSA9IGxvZ2lkCiAgICAgICAgIGxvZy52YWx1ZSA9ICclZCcgJSAodmFsKQogICAgICAgICBzZWxmLmxvZ1tsb2dpZF0gPSBsb2cKLSAgICAgICAgY2FsbGJhY2sodmFsKQorICAgICAgICByZXR1cm4gdmFsCiAKLSAgICBkZWYgZ2V0U3RydWN0KHNlbGYsIGtleSwgY2FsbGJhY2spOgotICAgICAgICBwcmludCAiZ2V0U3RydWN0KHt9KSIuZm9ybWF0KGtleSkKLSAgICAgICAgY2FsbGJhY2soc2VsZi5sb2dba2V5XSkKKyAgICBkZWYgZ2V0U3RydWN0KHNlbGYsIGtleSk6CisgICAgICAgIHByaW50KCJnZXRTdHJ1Y3Qoe30pIi5mb3JtYXQoa2V5KSkKKyAgICAgICAgcmV0dXJuIHNlbGYubG9nW2tleV0KIAotICAgIGRlZiB6aXAoc2V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mcm9tIHRocmlmdCBpbXBvcnQgVGhyaWZ0CiBmcm9tIHRocmlmdC50cmFuc3BvcnQgaW1wb3J0IFRUd2lzdGVkCiBmcm9tIHRocmlmdC5wcm90b2NvbCBpbXBvcnQgVEJpbmFyeVByb3RvY29sCiAKKwogQGlubGluZUNhbGxiYWNrcwogZGVmIG1haW4oY2xpZW50KToKLSAgeWllbGQgY2xpZW50LnBpbmcoKQotICBwcmludCAncGluZygpJworICAgIHlpZWxkIGNsaWVudC5waW5nKCkKKyAgICBwcmludCgncGluZygpJykKIAotICBzdW0gPSB5aWVsZCBjbGllbnQuYWRkKDEsMSkKLSAgcHJpbnQgJzErMT0lZCcgJSAoc3VtKQorICAgIHN1bSA9IHlpZWxkIGNsaWVudC5hZGQoMSwgMSkKKyAgICBwcmludCgoJzErMT0lZCcgJSAoc3VtKSkpCiAKLSAgd29yayA9IFdvcmsoKQorICAgIHdvcmsgPSBXb3JrKCkKIAotICB3b3JrLm9wID0gT3BlcmF0aW9uLkRJVklERQotICB3b3JrLm51bTEgPSAxCi0gIHdvcmsubnVtMiA9IDAKKyAgICB3b3JrLm9wID0gT3BlcmF0aW9uLkRJVklERQorICAgIHdvcmsubnVtMSA9IDEKKyAgICB3b3JrLm51bTIgPSAwCiAKLSAgdHJ5OgotICAgIHF1b3RpZW50ID0geWllbGQgY2xpZW50LmNhbGN1bGF0ZSgxLCB3b3JrKQotICAgIHByaW50ICdXaG9hPyBZb3Uga25vdyBob3cgdG8gZGl2aWRlIGJ5IHplcm8/JwotICBleGNlcHQgSW52YWxpZE9wZXJhdGlvbiwgaW86Ci0gICAgcHJpbnQgJ0ludmFsaWRPcGVyYXRpb246ICVyJyAlIGlvCisgICAgdHJ5OgorICAgICAgICBxdW90aWVudCA9IHlpZWxkIGNsaWVudC5jYWxjdWxhdGUoMSwgd29yaykKKyAgICAgICAgcHJpbnQoJ1dob2E/IFlvdSBrbm93IGhvdyB0byBkaXZpZGUgYnkgemVybz8nKQorICAgICAgICBwcmlud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2cgPSB7fQogCi0gIGRlZiBhZGQoc2VsZiwgbjEsIG4yKToKLSAgICBwcmludCAnYWRkKCVkLCVkKScgJSAobjEsIG4yKQotICAgIHJldHVybiBuMStuMgorICAgIGRlZiBwaW5nKHNlbGYpOgorICAgICAgICBwcmludCgncGluZygpJykKIAotICBkZWYgY2FsY3VsYXRlKHNlbGYsIGxvZ2lkLCB3b3JrKToKLSAgICBwcmludCAnY2FsY3VsYXRlKCVkLCAlciknICUgKGxvZ2lkLCB3b3JrKQorICAgIGRlZiBhZGQoc2VsZiwgbjEsIG4yKToKKyAgICAgICAgcHJpbnQoJ2FkZCglZCwlZCknICUgKG4xLCBuMikpCisgICAgICAgIHJldHVybiBuMSArIG4yCiAKLSAgICBpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5BREQ6Ci0gICAgICB2YWwgPSB3b3JrLm51bTEgKyB3b3JrLm51bTIKLSAgICBlbGlmIHdvcmsub3AgPT0gT3BlcmF0aW9uLlNVQlRSQUNUOgotICAgICAgdmFsID0gd29yay5udW0xIC0gd29yay5udW0yCi0gICAgZWxpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5NVUxUSVBMWToKLSAgICAgIHZhbCA9IHdvcmsubnVtMSAqIHdvcmsubnVtMgotICAgIGVsaWYgd29yay5vcCA9PSBPcGVyYXRpb24uRElWSURFOgotICAgICAgaWYgd29yay5udW0yID09IDA6Ci0gICAgICAgIHggPSBJbnZhbGlkT3BlcmF0aW9uKCkKLSAgICAgICAgeC53aGF0ID0gd29yay5vcAotICAgICAgICB4LndoeSA9ICdDYW5ub3QgZGl2aWRlIGJ5IDAnCi0gICAgICAgIHJhaXNlIHgKLSAgICAgIHZhbCA9IHdvcmsubnVtMSAvIHdvcmsubnVtMgotICAgIGVsc2U6Ci0gICAgICB4ID0gSW52YWxpZE9wZXJhdGlvbigpCi0gICAgICB4LndoYXQgPSB3b3JrLm9wCi0gICAgICB4LndoeSA9ICdJbnZhbGlkIG9wZXJhdGlvbicKLSAgICAgIHJhaXNlIHgKKyAgICBkZWYgY2FsY3VsYXRlKHNlbGYsIGxvZ2lkLCB3b3JrKToKKyAgICAgICAgcHJpbnQoJ2NhbGN1bGF0ZSglZCwgJXIpJyAlIChsb2dpZCwgd29yaykpCiAKLSAgICBsb2cgPSBTaGFyZWRTdHJ1Y3QoKQotICAgIGxvZy5rZXkgPSBsb2dpZAotICAgIGxvZy52YWx1ZSA9ICclZCcgJSAodmFsKQotICAgIHNlbGYubG9nW2xvZ2lkXSA9IGxvZworICAgICAgICBpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5BREQ6CisgICAgICAgICAgICB2YWwgPSB3b3JrLm51bTEgKyB3b3JrLm51bTIKKyAgICAgICAgZWxpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5TVUJUUkFDVDoKKyAgICAgICAgICAgIHZhbCA9IHdvcmsubnVtMSAtIHdvcmsubnVtMgorICAgICAgICBlbGlmIHdvcmsub3AgPT0gT3BlcmF0aW9uLk1VTFRJUExZOgorICAgICAgICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yCisgICAgICAgIGVsaWYgd29yay5vcCA9PSBPcGVyYXRpb24uRElWSURFOgorICAgICAgICAgICAgaWYgd29yay5udW0yID09IDA6CisgICAgICAgICAgICAgICAgeCA9IEludmFsaWRPcGVyYXRpb24oKQorICAgICAgICAgICAgICAgIHgud2hhdE9wID0gd29yay5vcAorICAgICAgICAgICAgICAgIHgud2h5ID0gJ0Nhbm5vdCBkaXZpZGUgYnkgMCcKKyAgICAgICAgICAgICAgICByYWlzZSB4CisgICAgICAgICAgICB2YWwgPSB3b3JrLm51bTEgLyB3b3JrLm51bTIKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHggPSBJbnZhbGlkT3BlcmF0aW9uKCkKKyAgICAgICAgICAgIHgud2hhdE9wID0gd29yay5vcAorICAgICAgICAgICAgeC53aHkgPSAnSW52YWxpZCBvcGVyYXRpb24nCisgICAgICAgICAgICByYWlzZSB4CiAKLSAgIC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Y29sIGVuY29kZXIKKyAgICBjbGllbnQgPSBDYWxjdWxhdG9yLkNsaWVudChwcm90b2NvbCkKIAotICAjIENvbm5lY3QhCi0gIHRyYW5zcG9ydC5vcGVuKCkKKyAgICAjIENvbm5lY3QhCisgICAgdHJhbnNwb3J0Lm9wZW4oKQogCi0gIGNsaWVudC5waW5nKCkKLSAgcHJpbnQgJ3BpbmcoKScKKyAgICBjbGllbnQucGluZygpCisgICAgcHJpbnQoJ3BpbmcoKScpCiAKLSAgc3VtID0gY2xpZW50LmFkZCgxLDEpCi0gIHByaW50ICcxKzE9JWQnICUgKHN1bSkKKyAgICBzdW1fID0gY2xpZW50LmFkZCgxLCAxKQorICAgIHByaW50KCcxKzE9JWQnICUgc3VtXykKIAotICB3b3JrID0gV29yaygpCisgICAgd29yayA9IFdvcmsoKQogCi0gIHdvcmsub3AgPSBPcGVyYXRpb24uRElWSURFCi0gIHdvcmsubnVtMSA9IDEKLSAgd29yay5udW0yID0gMAorICAgIHdvcmsub3AgPSBPcGVyYXRpb24uRElWSURFCisgICAgd29yay5udW0xID0gMQorICAgIHdvcmsubnVtMiA9IDAKIAotICB0cnk6Ci0gICAgcXVvdGllbnQgPSBjbGllbnQuY2FsY3VsYXRlKDEsIHdvcmspCi0gICAgcHJpbnQgJ1dob2E/IFlvdSBrbm93IGhvdyB0byBkaXZpZGUgYnkgemVybz8nCi0gIGV4Y2VwdCBJbnZhbGlkT3BlcmF0aW9uLCBpbzoKLSAgICBwcmludCAnSW52YWxpZE9wZXJhdGlvbjogJXInICUgaW8KKyAgICB0cnk6CisgICAgICAgIHF1b3RpZW50ID0gY2xpZW50LmNhbGN1bGF0ZSgxLCB3b3JrKQorICAgICAgICBwcmludCgnV2hvYT8gWW91IGtub3cgaG93IHRvIGRpdmlkZSBieSB6ZXJvPycpCisgICAgICAgIHByaW50KCdGWUkgdGhlIGFuc3dlciBpcyAlZCcgJSBxdW90aWVudCkKKyAgICBleGNlcHQgSW52YWxpZE9wZXJhdGlvbiBhcyBlOgorICAgICAgICBwcmludCgnSW52YWxpZE9wZXJhdGlvbjogJXInICUgZSkKIAotICB3b3JrLm9wID0gT3BlcmF0aW9uLlNVQlRSQUNUCi0gIHdvcmsubnVtMSA9IDE1Ci0gIHdvcmsubnVtMiA9IDEwCisgICAgd29yay5vcCA9IE9wZXJhdGlvbi5TVUJUUkFDVAorICAgIHdvcmsubnVtMSA9IDE1CisgICAgd29yay5udW0yID0gMTAKIAotICBkaWZmID0gY2xpZW50LmNhbGN1bGF0ZSgxLCB3b3JrKQotICBwcmludCAnMTUtMTA9JWQnICUgKGRpZmYpCisgICAgZGlmZiA9IGNsaWVudC5jYWxjdWxhdGUoMSwgd29yaykKKyAgICBwcmludCgnMTUtMTA9JWQnICUgZGlmZikKIAotICBsb2cgPSBjbGllbnQuZ2V0U3RydWN0KDEpCi0gIHByaW50ICdDaGVjayBsb2c6ICVzJyAlIChsb2cudmFsdWUpCisgICAgbG9nID0gY2xpZW50LmdldFN0cnVjdCgxKQorICAgIHByaW50KCdDaGVjayBsb2c6ICVzJyAlIGxvZy52YWx1ZSkKIAotICAjIENsb3NlIQotICB0cmFuc3BvcnQuY2xvc2UoKQorICAgICMgQ2xvc2UhCisgICAgdHJhbnNwb3J0LmNsb3NlKCkKIAotZXhjZXB0IFRocmlmdC5URXhjZXB0aW9uLCB0eDoKLSAgcHJpbnQgJyVzJyAlICh0eC5tZXNzYWdlKQorCitpZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgorICAgIHRyeToKKyAgICAgICAgbWFpbigpCisgICAgZXhjZXB0IFRocmlmdC5URXhjZXB0aW9uIGFzIHR4OgorICAgICAgICBwcmludCgnJXMnICUgdHgubWVzc2FnZSkKZGlmZiAtLWdpdCBhL3R1dG9yaWFsL3B5L1B5dGhvblNlcnZlci5weSBiL3R1dG9yaWFsL3B5L1B5dGhvblNlcnZlci5weQppbmRleCAwMTRhMTJlLi5lNjQyMWVmIDEwMDc1NQotLS0gYS90dXRvcmlhbC9weS9Q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pJyAlIChuMSwgbjIpCi0gICAgcmV0dXJuIG4xK24yCisgICAgZGVmIGFkZChzZWxmLCBuMSwgbjIpOgorICAgICAgICBwcmludCgnYWRkKCVkLCVkKScgJSAobjEsIG4yKSkKKyAgICAgICAgcmV0dXJuIG4xICsgbjIKIAotICBkZWYgY2FsY3VsYXRlKHNlbGYsIGxvZ2lkLCB3b3JrKToKLSAgICBwcmludCAnY2FsY3VsYXRlKCVkLCAlciknICUgKGxvZ2lkLCB3b3JrKQorICAgIGRlZiBjYWxjdWxhdGUoc2VsZiwgbG9naWQsIHdvcmspOgorICAgICAgICBwcmludCgnY2FsY3VsYXRlKCVkLCAlciknICUgKGxvZ2lkLCB3b3JrKSkKIAotICAgIGlmIHdvcmsub3AgPT0gT3BlcmF0aW9uLkFERDoKLSAgICAgIHZhbCA9IHdvcmsubnVtMSArIHdvcmsubnVtMgotICAgIGVsaWYgd29yay5vcCA9PSBPcGVyYXRpb24uU1VCVFJBQ1Q6Ci0gICAgICB2YWwgPSB3b3JrLm51bTEgLSB3b3JrLm51bTIKLSAgICBlbGlmIHdvcmsub3AgPT0gT3BlcmF0aW9uLk1VTFRJUExZOgotICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yCi0gICAgZWxpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5ESVZJREU6Ci0gICAgICBpZiB3b3JrLm51bTIgPT0gMDoKLSAgICAgICAgeCA9IEludmFsaWRPcGVyYXRpb24oKQotICAgICAgICB4LndoYXQgPSB3b3JrLm9wCi0gICAgICAgIHgud2h5ID0gJ0Nhbm5vdCBkaXZpZGUgYnkgMCcKLSAgICAgICAgcmFpc2UgeAotICAgICAgdmFsID0gd29yay5udW0xIC8gd29yay5udW0yCi0gICAgZWxzZToKLSAgICAgIHggPSBJbnZhbGlkT3BlcmF0aW9uKCkKLSAgICAgIHgud2hhdCA9IHdvcmsub3AKLSAgICAgIHgud2h5ID0gJ0ludmFsaWQgb3BlcmF0aW9uJwotICAgICAgcmFpc2UgeAorICAgICAgICBpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5BREQ6CisgICAgICAgICAgICB2YWwgPSB3b3JrLm51bTEgKyB3b3JrLm51bTIKKyAgICAgICAgZWxpZiB3b3JrLm9wID09IE9wZXJhdGlvbi5TVUJUUkFDVDoKKyAgICAgICAgICAgIHZhbCA9IHdvcmsubnVtMSAtIHdvcmsubnVtMgorICAgICAgICBlbGlmIHdvcmsub3AgPT0gT3BlcmF0aW9uLk1VTFRJUExZOgorICAgICAgICAgICAgdmFsID0gd29yay5udW0xICogd29yay5udW0yCisgICAgICAgIGVsaWYgd29yay5vcCA9PSBPcGVyYXRpb24uRElWSURFOgorICAgICAgICAgICAgaWYgd29yay5udW0yID09IDA6CisgICAgICAgICAgICAgICAgeCA9IEludmFsaWRPcGVyYXRpb24oKQorICAgICAgICAgICAgICAgIHgud2hhdE9wID0gd29yay5vcAorICAgICAgICAgICAgICAgIHgud2h5ID0gJ0Nhbm5vdCBkaXZpZGUgYnkgMCcKKyAgICAgICAgICAgICAgICByYWlzZSB4CisgICAgICAgICAgICB2YWwgPSB3b3JrLm51bTEgLyB3b3JrLm51bTIKKyAgICAgICAgZWxzZToKKyAgICAgICAgICAgIHggPSBJbnZhbGlkT3BlcmF0aW9uKCkKKyAgICAgICAgICAgIHgud2hhdE9wID0gd29yay5vcAorICAgICAgICAgICAgeC53aHkgPSAnSW52YWxpZCBvcGVyYXRpb24nCisgICAgICAgICAgICByYWlzZSB4CiAKLSAgICBsb2cgPSBTaGFyZWRTdHJ1Y3QoKQotICAgIGxvZy5rZXkgPSBsb2dpZAotICAgIGxvZy52YWx1ZSA9ICclZCcgJSAodmFsKQotICAgIHNlbGYubG9nW2xvZ2lkXSA9IGxvZworICAgICAgICBsb2cgPSBTaGFyZWRTdHJ1Y3QoKQorICAgICAgICBsb2cua2V5ID0gbG9naWQKKyAgICAgICAgbG9nLnZhbHVlID0gJyVkJyAlICh2YWwpCisgICAgICAgIHNlbGYubG9nW2xvZ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YnVpbGQgY2xpZW50CisgICAgLy8KKworICAgIHByaW50bG4hKCJjb25uZWN0IHRvIHNlcnZlciBvbiAxMjcuMC4wLjE6OTA5MCIpOworICAgIGxldCBtdXQgYyA9IFRUY3BUcmFuc3BvcnQ6Om5ldygpOworICAgIGMub3BlbigiMTI3LjAuMC4xOjkwOTAiKT87CisKKyAgICBsZXQgKGlfY2hhbiwgb19jaGFuKSA9IGMuc3BsaXQoKT87CisgICAgCisgICAgbGV0IGlfcHJvdCA9IFRDb21wYWN0SW5wdXRQcm90b2NvbDo6bmV3KAorICAgICAgICBURnJhbWVkUmVhZFRyYW5zcG9ydDo6bmV3KGlfY2hhbikKKyAgICApOworICAgIGxldCBvX3Byb3QgPSBUQ29tcGFjdE91dHB1dFByb3RvY29sOjpuZXcoCisgICAgICAgIFRGcmFtZWRXcml0ZVRyYW5zcG9ydDo6bmV3KG9fY2hhbikKKyAgICApOworCisgICAgbGV0IGNsaWVudCA9IENhbGN1bGF0b3JTeW5jQ2xpZW50OjpuZXcoaV9wcm90LCBvX3Byb3QpOworCisgICAgLy8KKyAgICAvLyBhbHJpZ2h0ISAtIGxldCdzIG1ha2Ugc29tZSBjYWxscworICAgIC8vCisKKyAgICAvLyB0d28td2F5LCB2b2lkIHJldHVybgorICAgIGNsaWVudC5waW5nKCk/OworCisgICAgLy8gdHdvLXdheSB3aXRoIHNvbWUgcmV0dXJuCisgICAgbGV0IHJlcyA9IGNsaWVudC5jYWxjdWxhdGUoCisgICAgICAgIDcyLAorICAgICAgICBXb3JrOjpuZXcoNywgOCwgT3BlcmF0aW9uOjpNVUxUSVBMWSwgTm9uZSkKKyAgICApPzsKKyAgICBwcmludGxuISgibXVsdGlwbGllZCA3IGFuZCA4LCBnb3Qge30iLCByZXMpOworCisgICAgLy8gdHdvLXdheSBhbmQgcmV0dXJucyBhIFRocmlmdC1kZWZpbmVkIGV4Y2VwdGlvbgorICAgIGxldCByZXMgPSBjbGllbnQuY2FsY3VsYXRlKAorICAgICAgIC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VzID0gaWYgbGV0IFNvbWUocmVmIG9wKSA9IHcub3AgeworICAgICAgICAgICAgaWYgdy5udW0xLmlzX25vbmUoKSB8fCB3Lm51bTIuaXNfbm9uZSgpIHsKKyAgICAgICAgICAgICAgICBFcnIoSW52YWxpZE9wZXJhdGlvbiB7CisgICAgICAgICAgICAgICAgICAgIHdoYXRfb3A6IFNvbWUoKm9wIGFzIGkzMiksCisgICAgICAgICAgICAgICAgICAgIHdoeTogU29tZSgibm8gb3BlcmFuZHMgc3BlY2lmaWVkIi50b19vd25lZCgpKSwKKyAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBzbyB0aGF0IEkgZG9uJ3QgaGF2ZSB0byBjYWxsIHVud3JhcCgpIG11bHRpcGxlIHRpbWVzIGJlbG93CisgICAgICAgICAgICAgICAgbGV0IG51bTEgPSB3Lm51bTEuYXNfcmVmKCkuZXhwZWN0KCJvcGVyYW5kcyBjaGVja2VkIik7CisgICAgICAgICAgICAgICAgbGV0IG51bTIgPSB3Lm51bTIuYXNfcmVmKCkuZXhwZWN0KCJvcGVyYW5kcyBjaGVja2VkIik7CisKKyAgICAgICAgICAgICAgICBtYXRjaCAqb3AgeworICAgICAgICAgICAgICAgICAgICBPcGVyYXRpb246OkFkZCA9PiBPayhudW0xICsgbnVtMiksCisgICAgICAgICAgICAgICAgICAgIE9wZXJhdGlvbjo6U3VidHJhY3QgPT4gT2sobnVtMSAtIG51bTIpLAorICAgICAgICAgICAgICAgICAgICBPcGVyYXRpb246Ok11bHRpcGx5ID0+IE9rKG51bTEgKiBudW0yKSwKKyAgICAgICAgICAgICAgICAgICAgT3BlcmF0aW9uOjpEaXZpZGUgPT4geworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKm51bTIgPT0gMCB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXJyKEludmFsaWRPcGVyYXRpb24geworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGF0X29wOiBTb21lKCpvcCBhcyBpMzIpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aHk6IFNvbWUoImRpdmlkZSBieSAwIi50b19vd25lZCgpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KQorICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBPayhudW0xIC8gbnVtMikKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEVycihJbnZhbGlkT3BlcmF0aW9uOjpuZXcoCisgICAgICAgICAgICAgICAgTm9uZSwKKyAgICAgICAgICAgICAgICAibm8gb3BlcmF0aW9uIHNwZWNpZmllZCIudG9fb3duZWQoKSwKKyAgICAgICAgICAgICkpCisgICAgICAgIH07CisKKyAgICAgICAgLy8gaWYgdGhlIG9wZXJhdGlvbiB3YXMgc3VjY2Vzc2Z1bCBsb2cgaXQKKyAgICAgICAgaWYgbGV0IE9rKHJlZiB2KSA9IHJlcyB7CisgICAgICAgICAgICBsZXQgbXV0IGxvZyA9IHNlbGYubG9nLmxvY2soKS51bndyYXAoKTsKKyAgICAgICAgICAgIGxvZy5pbnNlcnQobG9naWQsIFNoYXJlZFN0cnVjdDo6bmV3KGxvZ2lkLCBmb3JtYXQhKCJ7fSIsIHYpKSk7CisgICAgICAgIH0KKworICAgICAgICAvLyB0aGUgdHJ5ISBtYWNybyBhdXRvbWF0aWNhbGx5IG1hcHMgZXJyb3JzCisgICAgICAgIC8vIGJ1dCwgc2luY2Ugd2UgYXJlbid0IHVzaW5nIHRoYXQgaGVyZSB3ZSBoYXZlIHRvIG1hcCBlcnJvcnMgbWFudWFsbHkKKyAgICAgICAgLy8KKyAgICAgICAgLy8gZXhjZXB0aW9uIHN0cnVjdHMgZGVmaW5lZC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