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VidWdnZXJkX2RlZmF1bHRzIl0sCisgICAgcmFtZGlza19hdmFpbGFibGU6IHRydWUsCiAgICAgcmVjb3ZlcnlfYXZhaWxhYmxlOiB0cnVlLAogICAgIHZlbmRvcl9yYW1kaXNrX2F2YWlsYWJsZTogdHJ1ZSwKIApAQCAtMTk3LDcgKzIzNCw2IEBACiAgICAgICAgICJsaWJkZWJ1Z2dlcmQvb3Blbl9maWxlc19saXN0LmNwcCIsCiAgICAgICAgICJsaWJkZWJ1Z2dlcmQvdG9tYnN0b25lLmNwcCIsCiAgICAgICAgICJsaWJkZWJ1Z2dlcmQvdG9tYnN0b25lX3Byb3RvLmNwcCIsCi0gICAgICAgICJsaWJkZWJ1Z2dlcmQvdG9tYnN0b25lX3Byb3RvX3RvX3RleHQuY3BwIiwKICAgICAgICAgImxpYmRlYnVnZ2VyZC91dGlsaXR5LmNwcCIsCiAgICAgXSwKIApAQCAtMjIxLDExICsyNTcsOSBAQAogICAgICAgICAibGliYmFzZSIsCiAgICAgICAgICJsaWJjdXRpbHMiLAogICAgIF0sCi0gICAgcnVudGltZV9saWJzOiBbCi0gICAgICAgICJsaWJkZXhmaWxlIiwgICAgICAgICAgIC8vIGxpYmRleGZpbGVfc3VwcG9ydCBkZXBlbmRlbmN5Ci0gICAgXSwKIAogICAgIHdob2xlX3N0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJkZWJ1Z2dlcmRfdG9tYnN0b25lX3Byb3RvX3RvX3RleHQiLAogICAgICAgICAibGliYXN5bmNfc2FmZSIsCiAgICAgICAgICJnd3BfYXNhbl9jcmFzaF9oYW5kbGVyIiwKICAgICAgICAgImxpYnRvbWJzdG9uZV9wcm90byIsCkBAIC0yNTAsNiArMjg0LDE5IEBACiAgICAgICAgICAgICAgICAgImxpYmRleGZpbGUiLAogICAgICAgICAgICAgXSwKICAgICAgICAgfSwKKyAgICAgICAgcmFtZGlzazogeworICAgICAgICAgICAgZXhjbHVkZV9zdGF0aWNfbGliczogWworICAgICAgICAg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HsKICAgICAgIGVycngoMSwgImZhaWxlZCB0byBkdW1wIHByb2Nlc3MgJWQiLCBwaWQpOwogICAgIH0gZWxzZSB7CkBAIC0xMjIsNiArMTAzLDUgQEAKICAgICB9CiAgIH0KIAotICByZWRpcmVjdF90aHJlYWQuam9pbigpOwogICByZXR1cm4gMDsKIH0KZGlmZiAtLWdpdCBhL2RlYnVnZ2VyZC9kZWJ1Z2dlcmRfdGVzdC5jcHAgYi9kZWJ1Z2dlcmQvZGVidWdnZXJkX3Rlc3QuY3BwCmluZGV4IDRjZDYxOTMuLmE2ZDgyMjYgMTAwNjQ0Ci0tLSBhL2RlYnVnZ2VyZC9kZWJ1Z2dlcmRfdGVzdC5jcHAKKysrIGIvZGVidWdnZXJkL2RlYnVnZ2VyZF90ZXN0LmNwcApAQCAtOTQsNyArOTQsNyBAQAogICAgIGlmIChzaWdhY3Rpb24oU0lHQUxSTSwgJm5ld19zaWdhY3Rpb24sICZvbGRfc2lnYWN0aW9uKSAhPSAwKSB7IFwKICAgICAgIGVycigxLCAic2lnYWN0aW9uIGZhaWxlZCIpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAotICAgIGFsYXJtKHNlY29uZHMpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBhbGFybShzZWNvbmRzICogYW5kcm9pZDo6YmFzZTo6SHdUaW1lb3V0TXVsdGlwbGllcigpKTsgICAgICAgICBcCiAgICAgYXV0byB2YWx1ZSA9IGV4cHI7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgIGludCBzYXZlZF9lcnJubyA9IGVycm5vOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICBpZiAoc2lnYWN0aW9uKFNJR0FMUk0sICZvbGRf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BGaWxlOjpmcm9tX3Jhd19mZCh0b21ic3RvbmVkX3NvY2tldCkgfSwKICAgICAgICAgICAgIHRleHRfb3V0cHV0OiBpZiB0ZXh0X291dHB1dF9mZCA+PSAwIHsKLSAgICAgICAgICAgICAgICBTb21lKEZpbGU6OmZyb21fcmF3X2ZkKHRleHRfb3V0cHV0X2ZkKSkKKyAgICAgICAgICAgICAgICAvLyBTQUZFVFk6IFRoZSBjYWxsZXIgZ3VhcmFudGVlcyB0aGF0IHRoZSBmaWxlIGRlc2NyaXB0b3IgaXMgdmFsaWQgYW5kIG9wZW4uCisgICAgICAgICAgICAgICAgU29tZSh1bnNhZmUgeyBGaWxlOjpmcm9tX3Jhd19mZCh0ZXh0X291dHB1dF9mZCkgfSkKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgTm9uZQogICAgICAgICAgICAgfSwKICAgICAgICAgICAgIHByb3RvX291dHB1dDogaWYgcHJvdG9fb3V0cHV0X2ZkID49IDAgewotICAgICAgICAgICAgICAgIFNvbWUoRmlsZTo6ZnJvbV9yYXdfZmQocHJvdG9fb3V0cHV0X2ZkKSkKKyAgICAgICAgICAgICAgICAvLyBTQUZFVFk6IFRoZSBjYWxsZXIgZ3VhcmFudGVlcyB0aGF0IHRoZSBmaWxlIGRlc2NyaXB0b3IgaXMgdmFsaWQgYW5kIG9wZW4uCisgICAgICAgICAgICAgICAgU29tZSh1bnNhZmUgeyBGaWxlOjpmcm9tX3Jhd19mZChwcm90b19vdXRwdXRfZmQpIH0pCiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIE5vbmUKICAgICAgICAgICAgIH0sCkBAIC03MSw2ICs3Nyw4IEBACiAgICAgICAgICAgICAmbXV0IHByb3RvX291dHB1dF9mZCwKICAgICAgICAgICAgIGR1bXBfdHlwZSwKICAgICAgICAgKSB7CisgICAgICAgICAgICAvLyBTQUZFVFk6IElmIHRvbWJzdG9uZWRfY29ubmVjdF9maWxlcyByZXR1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bGwgc3VwcG9ydCBJTlRfTUFYLCBidXQgdGhpcyByZXN1bHRzIGluIGxhcmdlIGFsbG9jYXRpb25zLCBzbwogLy8gbGV0J3Mga2VlcCBpdCBhdCAxR0IgdG8gYXZvaWQgbWVtb3J5IHByZXNzdXJlIG9uIHRoZSBob3N0Lgogc3RhdGljIGNvbnN0ZXhwciBpbnQ2NF90IFJFU1BBUlNFX0xJTUlUID0gMSAqIDEwMjQgKiAxMDI0ICogMTAyNDsKLXN0YXRpYyB1aW50NjRfdCBzcGFyc2VfbGltaXQgPSAwOwogc3RhdGljIGludDY0X3QgdGFyZ2V0X3NwYXJzZV9saW1pdCA9IC0xOwogCiBzdGF0aWMgdW5zaWduZWQgZ19iYXNlX2FkZHIgPSAweDEwMDAwMDAwOwpAQCAtMTE4LDYgKzExNSw5IEBACiBzdGF0aWMgc3RkOjp2ZWN0b3I8SW1hZ2U+IGltYWdlcyA9IHsKICAgICAgICAgLy8gY2xhbmctZm9ybWF0IG9mZgogICAgIHsgImJvb3QiLCAgICAgImJvb3QuaW1nIiwgICAgICAgICAiYm9vdC5zaWciLCAgICAgImJvb3QiLCAgICAgZmFsc2UsIEltYWdlVHlwZTo6Qm9vdENyaXRpY2FsIH0sCisgICAgeyAiYm9vdGxvYWRlciIsCisgICAgICAgICAgICAgICAgICAiYm9vdGxvYWRlci5pbWciLCAgICIiLCAgICAgICAgICAgICAiYm9vdGxvYWRlciIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlLCAgSW1hZ2VUeXBlOjpFeHRyYSB9LAogICAgIHsgImluaXRfYm9vdCIsCiAgICAgICAgICAgICAgICAgICAiaW5pdF9ib290LmltZyIsICAgICJpbml0X2Jvb3Quc2lnIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbml0X2Jvb3QiLApAQCAtMTMwLDYgKzEzMCw3IEBACiAgIC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GlmIChuZXR3b3JrX3NlcmlhbC5vaygpKSB7CiAgICAgICAgICAgICBzdGQ6OnN0cmluZyBlcnJvcjsKICAgICAgICAgICAgIGlmIChuZXR3b3JrX3NlcmlhbC0+cHJvdG9jb2wgPT0gU29ja2V0OjpQcm90b2NvbDo6a1RjcCkgewotICAgICAgICAgICAgICAgIHRyYW5zcG9ydCA9IHRjcDo6Q29ubmVjdChuZXR3b3JrX3NlcmlhbC0+YWRkcmVzcywgbmV0d29ya19zZXJpYWwtPnBvcnQsICZlcnJvcikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgdHJhbnNwb3J0ID0gdGNwOjpDb25uZWN0KG5ldHdvcmtfc2VyaWFsLT5hZGRyZXNzLCBuZXR3b3JrX3NlcmlhbC0+cG9ydCwgJmVycm9yKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAobmV0d29ya19zZXJpYWwtPnByb3RvY29sID09IFNvY2tldDo6UHJvdG9jb2w6OmtVZHApIHsKLSAgICAgICAgICAgICAgICB0cmFuc3BvcnQgPSB1ZHA6OkNvbm5lY3QobmV0d29ya19zZXJpYWwtPmFkZHJlc3MsIG5ldHdvcmtfc2VyaWFsLT5wb3J0LCAmZXJyb3IpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAucmVsZWFzZSgpOworICAgICAgICAgICAgICAgIHRyYW5zcG9ydCA9IHVkcDo6Q29ubmVjdChuZXR3b3JrX3NlcmlhbC0+YWRkcmVzcywgbmV0d29ya19zZXJpYWwtPnBvcnQsICZlcnJvcik7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmICh0cmFuc3BvcnQgPT0gbnVsbHB0ciAmJiBhbm5vdW5jZSkgeworICAgICAgICAgICAgaWYgKCF0cmFuc3BvcnQgJiYgYW5ub3VuY2UpIHsKICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJlcnJvcjogIiA8PCB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nN0IFRyYW5zcG9ydCogdHJhbnNwb3J0ID0gb3Blbl9kZXZpY2UobG9jYWxfc2VyaWFsLCBmYWxzZSk7Ci0gICAgaWYgKHRyYW5zcG9ydCA9PSBudWxscHRyKSB7CisgICAgaWYgKCFvcGVuX2RldmljZShsb2NhbF9zZXJpYWwsIGZhbHNlKSkgewogICAgICAgICByZXR1cm4gMTsKICAgICB9CiAKQEAgLTUyNSw2ICs1MjUsNyBAQAogICAgIHVzYl9vcGVuKGxpc3RfZGV2aWNlc19jYWxsYmFjayk7CiAgICAgTmV0d29ya0RldmljZUNvbm5lY3RlZCgvKiBwcmludCAqLyB0cnVlKTsKIH0KKwogdm9pZCBzeW50YXhfZXJyb3IoY29uc3QgY2hhciogZm10LCAuLi4pIHsKICAgICBmcHJpbnRmKHN0ZGVyciwgImZhc3Rib290OiB1c2FnZTogIik7CiAKQEAgLTYyOCw2ICs2MjksOSBAQAogICAgICAgICAgICAgIiAtLXNraXAtcmVib290ICAgICAgICAgICAgICBEb24ndCByZWJvb3QgZGV2aWNlIGFmdGVyIGZsYXNoaW5nLlxuIgogICAgICAgICAgICAgIiAtLWRpc2FibGUtdmVyaXR5ICAgICAgICAgICBTZXRzIGRpc2FibGUtdmVyaXR5IHdoZW4gZmxhc2hpbmcgdmJtZXRhLlxuIgogICAgICAgICAgICAgIiAtLWRpc2FibGUtdmVyaWZpY2F0aW9uICAgICBTZXRzIGRpc2FibGUtdmVyaWZpY2F0aW9uIHdoZW4gZmxhc2hpbmcgdmJtZXRhLlxuIgorICAgICAgICAgICAgIiAtLWRpc2FibGUtc3VwZXItb3B0aW1pemF0aW9uXG4iCisgICAgICAgICAgICAiICAgICAgICAgICAgICAgICAgICAgICAgICAgIERpc2FibGVzIG9wdGltaXphdGlvbnMgb24gZmxhc2hpbmcgc3VwZXIgcGFydGl0aW9uLlxuIgorICAgICAgICAgICAgIiAtLWRpc2FibGUtZmFzdGJvb3QtaW5mbyAgICBXaWxsIGNvbGxlY3RzIHRhc2t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dF9uYW1lLCBib29sIGFsbG93X2FsbCkgewpAQCAtMTMxOCw3ICsxMzMyLDcgQEAKICAgICAgICAgaWYgKGFsbG93X2FsbCkgewogICAgICAgICAgICAgcmV0dXJuICJhbGwiOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaW50IGNvdW50ID0gZ2V0X3Nsb3RfY291bnQoKTsKKyAgICAgICAgICAgIGludCBjb3VudCA9IGdldF9zbG90X2NvdW50KGZiKTsKICAgICAgICAgICAgIGlmIChjb3VudCA+IDApIHsKICAgICAgICAgICAgICAgICByZXR1cm4gImEiOwogICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTEzMjcsNyArMTM0MSw3IEBACiAgICAgICAgIH0KICAgICB9CiAKLSAgICBpbnQgY291bnQgPSBnZXRfc2xvdF9jb3VudCgpOworICAgIGludCBjb3VudCA9IGdldF9zbG90X2NvdW50KGZiKTsKICAgICBpZiAoY291bnQgPT0gMCkgZGllKCJEZXZpY2UgZG9lcyBub3Qgc3VwcG9ydCBzbG90cyIpOwogCiAgICAgaWYgKHNsb3QgPT0gIm90aGVyIikgewpAQCAtMTQwMCw3ICsxNDE0LDcgQEAKICAgICAgICAgICAgICAgICBzbG90LmNfc3RyKCkpOwogICAgICAgICB9CiAgICAgICAgIGlmIChoYXNfc2xvdCA9PSAieWVzIikgewotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBnZXRfc2xvdF9jb3VudCgpOyBpKyspIHsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZ2V0X3Nsb3RfY291bnQoZmIpOyBpKyspIHsKICAgICAgICAgICAgICAgICBkb19mb3JfcGFydGl0aW9uKHBhcnQsIHN0ZDo6c3RyaW5nKDEsIChjaGFyKShpICsgJ2EnKSksIGZ1bmMsIGZvcmNlX3Nsb3QpOwogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewpAQCAtMTQxMSwxOCArMTQyNSwxMSBAQAogICAgIH0KIH0KIAotYm9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ZXJzIGluIHZlcnNpb24gaW5mbyBpbiBmYXN0Ym9vdC1pbmZvLnR4dCAtPiAiCiAgICAgICAgICAgICAgICAgICAgPDwgYW5kcm9pZDo6YmFzZTo6Sm9pbihjb21tYW5kLCAiICIpOwpAQCAtMTY5NiwxOCArMTcxNCwyMCBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCi0gICAgaWYgKCFJc051bWJlcihjb21tYW5kWzFdKSkgewotICAgICAgICBMT0coRVJST1IpIDw8ICJ2ZXJzaW9uIG51bWJlciBjb250YWlucyBub24tbnVtZXJpYyB2YWx1ZXMgaW4gZmFzdGJvb3QtaW5mby50eHQgLT4gIgorICAgIHVpbnQzMl90IGZhc3Rib290X2luZm9fdmVyc2lvbjsKKyAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlBhcnNlVWludChjb21tYW5kWzFdLCAmZmFzdGJvb3RfaW5mb192ZXJzaW9uKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJ2ZXJzaW9uIG51bWJlciBjb250YWlucyBub24tbnVtZXJpYyBjaGFyYWN0ZXJzIGluIGZhc3Rib290LWluZm8udHh0IC0+ICIKICAgICAgICAgICAgICAgICAgICA8PCBhbmRyb2lkOjpiYXNlOjpKb2luKGNvbW1hbmQsICIgIik7CiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKICAgICBMT0coVkVSQk9TRSkgPDwgIkNoZWNraW5nICdmYXN0Ym9vdC1pbmZvLnR4dCB2ZXJzaW9uJyI7Ci0gICAgaWYgKGNvbW1hbmRbMV0gPCBQTEFURk9STV9UT09MU19WRVJTSU9OKSB7CisgICAgaWYgKGZhc3Rib290X2luZm9fdmVyc2lvbiA8PSBob3N0X3Rvb2xfdmVyc2lvbikgewogICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9CisKICAgICBMT0coRVJST1IpIDw8ICJmYXNib290LWluZm8udHh0IHZlcnNpb246ICIgPDwgY29tbWFuZFsxXQotICAgICAgICAgICAgICAgPDwgIiBub3QgY29tcGF0aWJsZSB3aXRoIGhvc3QgdG9vbCB2ZXJzaW9uIC0tPiAiIDw8IFBMQVRGT1JNX1RPT0xTX1ZFUlNJT047CisgICAgICAgICAgICAgICA8PCAiIG5vdCBjb21wYXRpYmxlIHdpdGggaG9zdCB0b29sIHZlcnNpb24gLS0+ICIgPDwgaG9zdF90b29sX3ZlcnNpb247CiAgICAgcmV0dXJuIGZhbHNlOwogfQogCkBAIC0xNzIxLDcgKzE3NDEsNyBAQAogICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGNvbW1hbmQuc2l6ZSgpID4gMSAmJiBjb21tYW5kWzBdID09ICJ2ZXJzaW9uIikgewotICAgICAgICAgICAgaWYgKCFDaGVja0Zhc3Rib290SW5mb1JlcXVpcmVtZW50cyhjb21tYW5kKSkgeworICAgICAgICAgICAgaWYgKCFDaGVja0Zhc3Rib290SW5mb1JlcXVpcmVtZW50cyhjb21tYW5kLCBGQVNUQk9PVF9JTkZPX1ZFUlNJT04pKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgfQogICAgICAgICAgICAgY29udGludWU7CkBAIC0xNzMzLDQ0ICsxNzUzLDIyIEBACiAgICAgICAgIH0KICAgICAgICAgYXV0byB0YXNrID0gUGFyc2VGYXN0Ym9vdEluZm9MaW5lKGZwLCBjb21tYW5kKTsKICAgICAgICAgaWYgKCF0YXNrKSB7Ci0gICAgICAgICAgICBMT0coRVJST1IpIDw8ICJFcnJvciB3aGVuIHBhcnNpbmcgZmFzdGJvb3QtaW5mby50eHQsIGZhbGxpbmcgYmFjayBvbiBIYXJkY29kZWQgbGlzdDogIgotICAgICAgICAgICAgICAgICAgICAgICA8PCB0ZXh0OwogICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICB9CiAgICAgICAgIHRhc2tzLmVtcGxhY2VfYmFjayhzdGQ6Om1vdmUodGFzaykpOwogICAgIH0KLSAgICB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gICBpZiAoZnBfLT5leGNsdWRlX2R5bmFtaWNfcGFydGl0aW9ucykgeworICAgICAgICBhdXRvIGlzX25vbl9zdGF0aWNfZmxhc2hfdGFzayA9IFsmXShjb25zdCBhdXRvJiB0YXNrKSAtPiBib29sIHsKKyAgICAgICAgICAgIGlmIChhdXRvIGZsYXNoX3Rhc2sgPSB0YXNrLT5Bc0ZsYXNoVGFzaygpKSB7CisgICAgICAgICAgICAgICAgaWYgKCFzaG91bGRfZmxhc2hfaW5fdXNlcnNwYWNlKGZwXy0+c291cmNlLmdldCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFzaF90YXNrLT5HZXRQYXJ0aXRpb25BbmRTbG90KCkpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfTsKKyAgICAgICAgdGFza3MuZXJhc2Uoc3RkOjpyZW1vdmVfaWYodGFza3MuYmVnaW4oKSwgdGFza3MuZW5kKCksIGlzX25vbl9zdGF0aWNfZmxhc2hfdGFzayksCisgICAgICAgICAgICAgICAgICAgIHRhc2tzLmVuZCgpKTsKKyAgICB9CisgICAgcmV0dXJuIHRhc2tzOwogfQogCiB2b2lkIEZsYXNoQWxsVG9vbDo6Q2hlY2tSZXF1aXJlbWVudHMoKSB7CkBAIC0xODMzLDcgKzE4NDMsNyBAQAogICAgICAgICBmcF8tPnNlY29uZGFyeV9zbG90ID0gZ2V0X290aGVyX3Nsb3QoKTsKICAgICB9CiAgICAgaWYgKGZwXy0+c2Vjb25kYXJ5X3Nsb3QgPT0gIiIpIHsKLSAgICAgICAgaWYgKHN1cHBvcnRzX0FCKCkpIHsKKyAgICAgICAgaWYgKHN1cHBvcnRzX0FCKGZiKSkgewogICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJXYXJuaW5nOiBDb3Vs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SkgeworICAgIGlmICghd2lwZV9zdXBlcigqbWV0YWRhdGEuZ2V0KCksIHNsb3QsICZtZXNzYWdlLCBmcCkpIHsKICAgICAgICAgZGllKG1lc3NhZ2UpOwogICAgIH0KIH0KQEAgLTIyMzAsNiArMjIxNyw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsiY21kbGluZSIsIHJlcXVpcmVkX2FyZ3VtZW50LCAwLCAwfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJkaXNhYmxlLXZlcmlmaWNhdGlvbiIsIG5vX2FyZ3VtZW50LCAwLCAwfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJkaXNhYmxlLXZlcml0eSIsIG5vX2FyZ3VtZW50LCAwLCAwfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJkaXNhYmxlLXN1cGVyLW9wdGltaXphdGlvbiIsIG5vX2FyZ3VtZW50LCAwLCAwfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJleGNsdWRlLWR5bmFtaWMtcGFydGl0aW9ucyIsIG5vX2FyZ3VtZW50LCAwLCAwfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJkaXNhYmxlLWZhc3Rib290LWluZm8iLCBub19hcmd1bWVudCwgMCwgMH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsiZm9yY2UiLCBub19hcmd1bWVudCwgMCwgMH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsiZnMtb3B0aW9ucyIsIHJlcXVpcmVkX2FyZ3VtZW50LCAwLCAwfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyJoZWFkZXItdmVyc2lvbiIsIHJlcXVpcmVkX2FyZ3VtZW50LCAwLCAwfSwKQEAgLTIyNTEsNyArMjI0MSwxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7InZlcnNpb24iLCBub19hcmd1bWVudCwgMCwgMH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHswLCAwLCAwLCAwfX07CiAKLSAgICBzZXJpYWwgPSBnZXRlbnYoIkFORFJPSURfU0VSSUFMIik7CisgICAgc2VyaWFsID0gZ2V0ZW52KCJGQVNUQk9PVF9ERVZJQ0UiKTsKKyAgICBpZiAoIXNlcmlhbCkgeworICAgICAgICBzZXJpYWwgPSBnZXRlbnYoIkFORFJPSURfU0VSSUFMIik7CisgICAgfQogCiAgICAgaW50IGM7CiAgICAgd2hpbGUgKChjID0gZ2V0b3B0X2xvbmcoYXJnYywgYXJndiwgImE6OmhsczpTOnZ3IiwgbG9uZ29wdHMsICZsb25naW5kZXgpKSAhPSAtMSkgewpAQCAtMjI2NSw2ICsyMjU4LDEzIEBACiAgICAgICAgICAgICAgICAgZ19kaXNhYmxlX3ZlcmlmaWNhdGlvbiA9IHRydWU7CiAgICAgICAgICAgICB9IGVsc2UgaWYgKG5hbWUgPT0gImRpc2FibGUtdmVyaXR5IikgewogICAgICAgICAgICAgICAgIGdfZGlzYWJsZV92ZXJpdHkgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lID09ICJkaXNhYmxlLXN1cGVyLW9wdGltaXphdGlvbiIpIHsKKyAgICAgICAgICAgICAgICBmcC0+c2hvdWxkX29wdGltaXplX2ZsYXNoX3N1cGVyID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG5hbWUgPT0gImV4Y2x1ZGUtZHluYW1pYy1wYXJ0aXRpb25zIikgeworICAgICAgICAgICAgICAgIGZwLT5leGNsdWRlX2R5bmFtaWNfcGFydGl0aW9ucyA9IHRydWU7CisgICAgICAgICAgICAgICAgZnAtPnNob3VsZF9vcHRpbWl6ZV9mbGFzaF9zdXBlciA9IGZhbHNlOworICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lID09ICJkaXNhYmxlLWZhc3Rib290LWluZm8iKSB7CisgICAgICAgICAgICAgICAgZnAtPnNob3VsZF91c2VfZmFzdGJvb3RfaW5mbyA9IGZhbHNlOwogICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lID09ICJmb3JjZSIpIHsKICAgICAgICAgICAgICAgICBmcC0+Zm9yY2VfZmxhc2ggPSB0cnVlOwogICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lID09ICJmcy1vcHRpb25zIikgewpAQCAtMjMyMCw3ICsyMzIwLDcgQEAKICAgICAgICAgICAgICAgICAgICAgc2VyaWFsID0gb3B0YXJnOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlICdTJzoKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFhbmRyb2lkOjpiYXNlOjpQYXJzZUJ5dGVDb3VudChvcHRhcmcsICZzcGFyc2VfbGltaXQpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghYW5kcm9pZDo6YmFzZTo6UGFyc2VCeXRlQ291bnQob3B0YXJnLCAmZnAtPnNwYXJzZV9saW1pdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGRpZSgiaW52YWxpZCBzcGFyc2UgbGltaXQgJXMiLCBvcHRhcmcpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtMjM2NCw4ICsyMzY0LDggQEAKICAgICAgICAgcmV0dXJuIHNob3dfaGVscCgpOwogICAgIH0KIAotICAgIFRyYW5zcG9ydCogdHJhbnNwb3J0ID0gb3Blbl9kZXZpY2UoKTsKLSAgICBpZiAodHJhbnNwb3J0ID09IG51bGxwdHIpIHsKKyAgICBzdGQ6OnVuaXF1ZV9wdHI8VHJhbnNwb3J0PiB0cmFuc3BvcnQgPSBvcGVuX2RldmljZSgpOworICAgIGlmICghdHJhbnNwb3J0KSB7CiAgICAgICAgIHJldHVybiAxOw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x4MWMnLCAnXHgwMCcsICdceDBjJywgJ1x4MDAnLAotICAgICAgICAnXHgwMCcsICdceDEwJywgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHgwOCcsICdceDAwJywgJ1x4MDEnLCAnXHgwMCcsICdceDAwJywgJ1x4MDAnLAotICAgICAgICAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHgwMCcsICdceGMxJywgJ1x4Y2EnLCAnXHgwMCcsICdceDAwJywgJ1x4MDEnLCAnXHgwMCcsICdceDAwJywgJ1x4MDAnLAotICAgICAgICAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHg4MCcsICdceDExJywgJ1x4MjInLCAnXHgzMycsICdceDQ0JwotICAgIH07CisgICAgICAgICAgICAnXHgzYScsICdceGZmJywgJ1x4MjYnLCAnXHhlZCcsICdceDAxJywgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4MWMnLCAnXHgwMCcsICdceDBjJywKKyAgICAgICAgICAgICdceDAwJywgJ1x4MDAnLCAnXHgxMCcsICdceDAwJywgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4MDgnLCAnXHgwMCcsICdceDAxJywgJ1x4MDAnLAorICAgICAgICAgICAgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4YzEnLCAnXHhjYScsICdceDAwJywgJ1x4MDAnLCAnXHgwMScsCisgICAgICAgICAgICAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHgwMCcsICdceDAwJywgJ1x4MDAnLCAnXHg4MCcsICdceDExJywgJ1x4MjInLCAnXHgzMycsICdceDQ0J307CiAKICAgICBBU1NFUlRfRVEoRG93bmxvYWRDb21tYW5kKGJ1Zi5zaXplKCkpLCBTVUNDRVNTKSA8PCAiRGV2aWNlIHJlamVjdGVkIGRvd25sb2FkIGNvbW1hbmQiOwogICAgIEFTU0VSVF9FUShTZW5kQnVmZmVyK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Rmxhc2hTdXBlckxheW91dFRhc2soY29uc3Qgc3RkOjpzdHJpbmcmIHN1cGVyX25hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPFN1cGVyRmxhc2hIZWxwZXI+IGhlbHBlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTcGFyc2VQdHIgc3BhcnNlX2xheW91dCwgdWludDY0X3Qgc3VwZXJfc2l6ZSkKK3N0ZDo6c3RyaW5nIFJlYm9vdFRhc2s6OlRvU3RyaW5nKCkgY29uc3QgeworICAgIHJldHVybiAicmVib290ICIgKyByZWJvb3RfdGFyZ2V0XzsKK30KKworT3B0aW1pemVkRmxhc2hTdXBlclRhc2s6Ok9wdGltaXplZEZsYXNoU3VwZXJUYXNrKGNvbnN0IHN0ZDo6c3RyaW5nJiBzdXBlcl9uYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dW5pcXVlX3B0cjxTdXBlckZsYXNoSGVscGVyPiBoZWxwZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3BhcnNlUHRyIHNwYXJzZV9sYXlvdXQsIHVpbnQ2NF90IHN1cGVyX3NpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgRmxhc2hpbmdQbGFuKiBmcCkKICAgICA6IHN1cGVyX25hbWVfKHN1cGVyX25hbWUpLAogICAgICAgaGVscGVyXyhzdGQ6Om1vdmUoaGVscGVyKSksCiAgICAgICBzcGFyc2VfbGF5b3V0XyhzdGQ6Om1vdmUoc3BhcnNlX2xheW91dCkpLAotICAgICAgc3VwZXJfc2l6ZV8oc3VwZXJfc2l6ZSkge30KKyAgICAgIHN1cGVyX3NpemVfKHN1cGVyX3NpemUpLAorICAgICAgZnBfKGZwKSB7fQogC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gICAgICAgICJ2ZXJzaW9uIDIyLjAwIiwKLSAgICB9OworVEVTVF9GKFBhcnNlVGVzdCwgVmVyc2lvbkNoZWNrQ29ycmVjdCkgeworICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiBjb3JyZWN0X3ZlcnNpb25zID0geyJ2ZXJzaW9uIDEiLCAidmVyc2lvbiAyMiIsICJ2ZXJzaW9uIDUiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2ZXJzaW9uIDE3In07CiAKLSAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gYmFkX3ZlcnNpb25zID0geyJ2ZXJzaW9uIiwgICAgICAgICJ2ZXJzaW9uIC4wMSIsICJ2ZXJzaW9uIHgxIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ2ZXJzaW9uIDEuMC4xIiwgICJ2ZXJzaW9uIDEuIiwgICJzIDEuMCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmVyc2lvbiAxLjAgMi4wIn07CisgICAgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IGJhZF92ZXJzaW9ucyA9IHsidmVyc2lvbiIsICAgICAgICAgInZlcnNpb24gLjAxIiwgICAgInZlcnNpb24geDEiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInZlcnNpb24gMS4wLjEiLCAgICJ2ZXJzaW9uIDEuIiwgICAgICJzIDEuMCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAidmVyc2lvbiAxLjAgMi4wIiwgInZlcnNpb24gMTAwLjAwIiwgInZlcnNpb24gMSAyIn07CiAKICAgICBmb3IgKGF1dG8mIHZlcnNpb24gOiBjb3JyZWN0X3ZlcnNpb25zKSB7Ci0gICAgICAgIEFTU0VSVF9UUlVFKENoZWNrRmFzdGJvb3RJb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jdG9yPHN0ZDo6dW5pcXVlX3B0cjxUYXNrPj4gdGFza3MgPSBQYXJzZUZhc3Rib290SW5mbyhmcC5nZXQoKSwgdGVzdC5maXJzdCk7CisgICAgICAgIC8vIENoZWNrIHRvIG1ha2Ugc3VyZSB3ZSBoYXZlIGFuIG9wdGltaXplZCBmbGFzaCBzdXBlciB0YXNrICYmIG5vIG1vcmUgZHluYW1pYyBwYXJ0aXRpb24KKyAgICAgICAgLy8gZmxhc2hpbmcgdGFza3MKKyAgICAgICAgYXV0byYmIElzT3B0aW1pemVkID0gW10oY29uc3QgRmxhc2hpbmdQbGFuKiBmcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjp2ZWN0b3I8c3RkOjp1bmlxdWVfcHRyPFRhc2s+PiYgdGFza3MpIHsKKyAgICAgICAgICAgIGJvb2wgY29udGFpbnNfb3B0aW1pemVkX3Rhc2sgPSBmYWxzZTsKKyAgICAgICAgICAgIGZvciAoYXV0byYgdGFzayA6IHRhc2tzKSB7CisgICAgICAgICAgICAgICAgaWYgKHRhc2stPkFzT3B0aW1pemVkRmxhc2hTdXBlclRhc2soKSkgeworICAgICAgICAgICAgICAgICAgICBjb250YWluc19vcHRpbWl6ZWRfdGFzayA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChhdXRvIGZsYXNoX3Rhc2sgPSB0YXNrLT5Bc0ZsYXNoVGFzaygpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChGbGFzaFRhc2s6OklzRHluYW1pY1Bhcml0aXRpb24oZnAtPnNvdXJjZS5nZXQoKSwgZmxhc2hfdGFzaykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBjb250YWluc19vcHRpbWl6ZWRfdGFzazsKKyAgIC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Y2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCi0gICAgaW5jbHVkZV9kaXJzOiBbInN5c3RlbS92b2xkIl0sCisgICAgbG9jYWxfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUvIl0sCiAgICAgY2ZsYWdzOiBbCiAgICAgICAgICItRF9GSUxFX09GRlNFVF9CSVRTPTY0IiwKICAgICBdLApAQCAtNzAsOCArNjksOSBAQAogICAgICAgICAiZnNfbWdyLmNwcCIsCiAgICAgICAgICJmc19tZ3JfZm9ybWF0LmNwcCIsCiAgICAgICAgICJmc19tZ3JfZG1fbGluZWFyLmNwcCIsCi0gICAgICAgICJmc19tZ3Jfb3ZlcmxheWZzLmNwcCIsCiAgICAgICAgICJmc19tZ3Jfcm9vdHMuY3BwIiwKKyAgICAgICAgImZzX21ncl9vdmVybGF5ZnNfY29udHJvbC5jcHAiLAorICAgICAgICAiZnNfbWdyX292ZXJsYXlmc19tb3VudC5jcHAiLAogICAgICAgICAiZnNfbWdyX3ZlbmRvcl9vdmVybGF5LmNwcCIsCiAgICAgICAgICI6bGliZmllbWFwX3NyY3MiLAogICAgIF0sCkBAIC04OSw4ICs4OSw2IEBACiAgICAgc3RhdGljX2xpYnM6IFsKICAgICAgICAgImxpYmF2YiIsCiAgICAgICAgICJsaWJmc19hdmIiLAotICAgICAgICAibGliZnN0YWIiLAotICAgICAgICAibGliZG0iLAogICAgICAgICAibGliZ3NpIiwKICAgICBdLAogICAgIGV4cG9ydF9zdGF0aWNfbGliX2hlYWRlcnM6IFsKQEAgLTE3NCwzOCArMTcyLDIyIEBACiB9CiAKIGNjX2xpYnJhcnlfc3RhdGljIHsKLSAgICAvLyBEbyBub3QgZXZlciBtYWtlIHRoaXMgYSBzaGFyZWQgbGlicmFyeSBhcyBsb25nIGFzIGl0IGlzIHZlbmRvcl9hdmFpbGFibGUuCi0gICAgLy8gSXQgZG9lcyBub3QgaGF2ZSBhIHN0YWJsZSBpbnRlcmZhY2UuCi0gICAgbmFtZTogImx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N5cy8iKSArIGJsb2NrX2RldmljZS5zdWJzdHIoNSk7Ci0KKyAgICBzdHJ1Y3Qgc3RhdCBzdDsKKyAgICBpZiAoc3RhdChyZWFsX3BhdGguY19zdHIoKSwgJnN0KSA8IDApIHsKKyAgICAgICAgUExPRyhFUlJPUikgPDwgInN0YXQgZmFpbGVkOiAiIDw8IHJlYWxfcGF0aDsKKyAgICAgICAgcmV0dXJuIHN0ZDo6c3RyaW5nKCk7CisgICAgfQorICAgIGlmICghU19JU0JMSyhzdC5zdF9tb2RlKSkgeworICAgICAgICBQTE9HKEVSUk9SKSA8PCByZWFsX3BhdGggPDwgIiBpcyBub3QgYmxvY2sgZGV2aWNlIjsKKyAgICAgICAgcmV0dXJuIHN0ZDo6c3RyaW5nKCk7CisgICAgfQorICAgIHN0ZDo6c3RyaW5nIHN5c19kaXIgPSBhbmRyb2lkOjpiYXNlOjpTdHJpbmdQcmludGYoIi9zeXMvZGV2L2Jsb2NrLyV1OiV1IiwgbWFqb3Ioc3Quc3RfcmRldiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5vcihzdC5zdF9yZGV2KSk7CiAgICAgZm9yICg7OykgewogICAgICAgICBzdGQ6OnN0cmluZyBuYW1lOwogICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlJlYWRGaWxlVG9TdHJpbmcoc3lzX2RpciArICIvZG0vbmFtZSIsICZuYW1lKSkgewotICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgYmxvY2tfZGV2aWNlIDw8ICIgaXMgbm90IGRtIGRldmljZSI7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCByZWFsX3BhdGggPDwgIiBpcyBub3QgZG0gZGV2aWNlIjsKICAgICAgICAgICAgIHJldHVybiBzdGQ6OnN0cmluZygpOwogICAgICAgICB9CiAKQEAgLTEzOTksNiArMTQyMSw4IEBACiAgICAgICAgIHJldHVybiB7RlNfTUdSX01OVEFMTF9G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gYmV0d2VlbiA8a2V5PiBhbmQgPGtleT49Ci0gICAgICAgICAgICAgICAgcmVzdWx0LmVtcGxhY2VfYmFjayhzdGQ6Om1vdmUobGluZSksICIiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJlc3VsdC5lbXBsYWNlX2JhY2soYW5kcm9pZDo6YmFzZTo6VHJpbShsaW5lLnN1YnN0cigwLCBlcXVhbF9zaWduKSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6OmJhc2U6OlRyaW0obGluZS5zdWJzdHIoZXF1YWxfc2lnbiArIDEpKSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICByZXR1cm4gcmVzdWx0OwotfQotCi1ib29sIGZzX21ncl9nZXRfYm9vdF9jb25maWdfZnJvbV9ib290Y29uZmlnKGNvbnN0IHN0ZDo6c3RyaW5nJiBib290Y29uZmlnLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgYW5kcm9pZF9rZXksIHN0ZDo6c3RyaW5nKiBvdXRfdmFsKSB7Ci0gICAgRlNfTUdSX0NIRUNLKG91dF92YWwgIT0gbnVsbHB0cik7Ci0KLSAgICBjb25zdCBzdGQ6OnN0cmluZyBib290Y29uZmlnX2tleSgiYW5kcm9pZGJvb3QuIiArIGFuZHJvaWRfa2V5KTsKLSAgICBmb3IgKGNvbnN0IGF1dG8mIFtrZXksIHZhbHVlXSA6IGZzX21ncl9wYXJzZV9wcm9jX2Jvb3Rjb25maWcoYm9vdGNvbmZpZykpIHsKLSAgICAgICAgaWYgKGtleSA9PSBib290Y29uZmlnX2tleSkgewotICAgICAgICAgICAgKm91dF92YWwgPSB2YWx1ZTsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgKm91dF92YWwgPSAiIjsKLSAgICByZXR1cm4gZmFsc2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LSAgICAgICAgICAgICAgICAgICAgaWYgKGVudHJ5LT5kX25hbWVbMF0gIT0gJy4nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjbGVhbnVwX2FsbCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAoZXJybm8gPT0gRU5PRU5UKSB7Ci0gICAgICAgICAgICBjbGVhbnVwX2FsbCA9IHRydWU7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXQgPSBmYWxzZTsKLSAgICAgICAgICAgIFBFUlJPUiA8PCAicm1kaXIgIiA8PCB0b3A7Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgaWYgKHNob3VsZF9kZXN0cm95X3NjcmF0Y2gpICpzaG91bGRfZGVzdHJveV9zY3JhdGNoID0gY2xlYW51cF9hbGw7Ci0gICAgcmV0dXJuIHJldDsKLX0KLQotYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX3NldF9zaGFyZWRfbW91bnQoY29uc3Qgc3RkOjpzdHJpbmcmIG1vdW50X3BvaW50LCBib29sIHNoYXJlZF9mbGFnKSB7Ci0gICAgYXV0byByZXQgPSBtb3VudChudWxscHRyLCBtb3VudF9wb2ludC5jX3N0cigpLCBudWxscHRyLCBzaGFyZWRfZmxhZyA/IE1TX1NIQVJFRCA6IE1TX1BSSVZBVEUsCi0gICAgICAgICAgICAgICAgICAgICBudWxscHRyKTsKLSAgICBpZiAocmV0KSB7Ci0gICAgICAgIFBFUlJPUiA8PCAiX19tb3VudCh0YXJnZXQ9IiA8PCBtb3VudF9wb2ludAotICAgICAgICAgICAgICAgPDwgIixmbGFnPSIgPDwgKHNoYXJlZF9mbGFnID8gIk1TX1NIQVJFRCIgOiAiTVNfUFJJVkFURSIpIDw8ICIpPSIgPDwgcmV0OwotICAgICAgICAvL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KLSAgICAgICAgfQotICAgICAgICBpZiAoIXN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSB7Ci0gICAgICAgICAgICBMRVJST1IgPDwgIkVycm9yIHBhcnNpbmcgbW91bnQgc291cmNlIjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgIGlmICghc3RydG9rX3IobnVsbHB0ciwgZGVsaW0sICZzYXZlX3B0cikpIHsKLSAgICAgICAgICAgIExFUlJPUiA8PCAiRXJyb3IgcGFyc2luZyByb290IjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KLSAgICAgICAgY2hhciogcDsKLSAgICAgICAgaWYgKCEocCA9IHN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSkgewotICAgICAgICAgICAgTEVSUk9SIDw8ICJFcnJvciBwYXJzaW5nIG1vdW50X3BvaW50IjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgICAgIG1vdW50X2luZm8gZW50cnkgPSB7cCwgZmFsc2V9OwotCi0gICAgICAgIGlmICghc3RydG9rX3IobnVsbHB0ciwgZGVsaW0sICZzYXZlX3B0cikpIHsKLSAgICAgICAgICAgIExFUlJPUiA8PCAiRXJyb3IgcGFyc2luZyBtb3VudF9mbGFncyI7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotCi0gICAgICAgIHdoaWxlICgocCA9IHN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSkgewotICAgICAgICAgICAgaWYgKChwWzBdID09ICctJykgJiYgKHBbMV0gPT0gJ1wwJykpIGJyZWFrOwotICAgICAgICAgICAgaWYgKGFuZHJvaWQ6OmJhc2U6OlN0YXJ0c1dpdGgocCwgInNoYXJlZDoiKSkgZW50cnkuc2hhcmVkX2ZsYWcgPSB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIGlmICghcCkgewotICAgICAgICAgICAgTEVSUk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AyKTsKLSAgICAgICAgICAgIGlmIChwYXJ0aXRpb25fc2l6ZSA+IHBhcnRpdGlvbi0+c2l6ZSgpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFidWlsZGVyLT5SZXNpemVQYXJ0aXRpb24ocGFydGl0aW9uLCBwYXJ0aXRpb25fc2l6ZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gVHJ5IHRvIGZyZWUgdXAgc3BhY2UgYnkgZGVhbGxvY2F0aW5nIHBhcnRpdGlvbnMgaW4gdGhlIG90aGVyIHNsb3QuCi0gICAgICAgICAgICAgICAgICAgIFRydW5jYXRlUGFydGl0aW9uc1dpdGhTdWZmaXgoYnVpbGRlci5nZXQoKSwgZnNfbWdyX2dldF9vdGhlcl9zbG90X3N1ZmZpeCgpKTsKLQotICAgICAgICAgICAgICAgICAgICBwYXJ0aXRpb25fc2l6ZSA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci0+QWxsb2NhdGFibGVTcGFjZSgpIC0gYnVpbGRlci0+VXNlZFNwYWNlKCkgKyBwYXJ0aXRpb24tPnNpemUoKTsKLSAgICAgICAgICAgICAgICAgICAgcGFydGl0aW9uX3NpemUgPSBzdGQ6Om1heChzdGQ6Om1pbihrTWluaW11bVNpemUsIHBhcnRpdGlvbl9zaXplIC0gbWFyZ2luX3NpemUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpdGlvbl9zaXplIC8gMik7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghYnVpbGRlci0+UmVzaXplUGFydGl0aW9uKHBhcnRpdGlvbiwgcGFydGl0aW9uX3NpemUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMRVJST1IgPDwgInJlc2l6ZSAiIDw8IHBhcnRpdGlvbl9uYW1lOwotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmICghcGFydGl0aW9uX2NyZWF0ZSkgRGVzdHJveUxvZ2ljYWxQYXJ0aXRpb24ocGFydGl0aW9uX25hbWUpOwotICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgICpwYXJ0aXRpb25fZXhpc3RzID0gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0gICAgLy8gbGFuZCB0aGUgdXBkYXRlIGJhY2sgb24gdG8gdGhlIHBhcnRpdGlvbgotICAgIGlmIChjaGFuZ2VkKSB7Ci0gICAgICAgIGF1dG8gbWV0YWRhdGEgPSBidWlsZGVyLT5FeHBvcnQoKTsKLSAgICAgICAgaWYgKCFtZXRhZGF0YSB8fCAhVXBkYXRlUGFydGl0aW9uVGFibGUoc3VwZXJfZGV2aWNlLCAqbWV0YWRhdGEuZ2V0KCksIHNsb3RfbnVtYmVyKSkgewotICAgICAgICAgICAgTEVSUk9SIDw8ICJhZGQgcGFydGl0aW9uICIgPDwgcGFydGl0aW9uX25hbWU7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBpZiAoY2hhbmdlZCB8fCBwYXJ0aXRpb25fY3JlYXRlKSB7Ci0gICAgICAgIENyZWF0ZUxvZ2ljYWxQYXJ0aXRpb25QYXJhbXMgcGFyYW1zID0gewotICAgICAgICAgICAgICAgIC5ibG9ja19kZXZpY2UgPSBzdXBlcl9kZXZpY2UsCi0gICAgICAgICAgICAgICAgLm1ldGFkYXRhX3Nsb3QgPSBzbG90X251bWJlciwKLSAgICAgICAgICAgICAgICAucGFydGl0aW9uX25hbWUgPSBwYXJ0aXRpb25fbmFtZSwKLSAgICAgICAgICAgICAgICAuZm9yY2Vfd3JpdGFibGUgPSB0cnVlLAotICAgICAgICAgICAgICAgIC50aW1lb3V0X21zID0gMTBzLAotICAgICAgICB9OwotICAgICAgICB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HMiOwotICAgICAgICByZXR1cm4ge307Ci0gICAgfQotCi0gICAgRnN0YWIgY2FuZGlkYXRlczsKLSAgICBmb3IgKGNvbnN0IGF1dG8mIGVudHJ5IDogZnN0YWIpIHsKLSAgICAgICAgLy8gRmlsdGVyIG91dCBwYXJ0aXRpb25zIHdob3NlIHR5cGUgZG9lc24ndCBtYXRjaCB3aGF0J3MgbW91bnRlZC4KLSAgICAgICAgLy8gVGhpcyBhdm9pZHMgc3BhbW15IGJlaGF2aW9yIG9uIGRldmljZXMgd2hpY2ggY2FuIG1vdW50IGRpZmZlcmVudAotICAgICAgICAvLyBmaWxlc3lzdGVtcyBmb3IgZWFjaCBwYXJ0aXRpb24uCi0gICAgICAgIGF1dG8gcHJvY19tb3VudF9wb2ludCA9IChlbnRyeS5tb3VudF9wb2ludCA9PSAiL3N5c3RlbSIpID8gIi8iIDogZW50cnkubW91bnRfcG9pbnQ7Ci0gICAgICAgIGF1dG8gbW91bnRlZCA9IEdldEVudHJ5Rm9yTW91bnRQb2ludCgmbW91bnRzLCBwcm9jX21vdW50X3BvaW50KTsKLSAgICAgICAgaWYgKCFtb3VudGVkIHx8IG1vdW50ZWQtPmZzX3R5cGUgIT0gZW50cnkuZnNfdHlwZSkgewotICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgIH0KLQotICAgICAgICBGc3RhYkVudHJ5IG5ld19lbnRyeSA9IGVudHJ5OwotICAgICAgICBpZiAoIWZzX21ncl9vdmVybGF5ZnNfYWxyZWFkeV9tb3VudGVkKGVudHJ5Lm1vdW50X3BvaW50KSAmJgotICAgICAgICAgICAgIWZzX21ncl93YW50c19vdmVybGF5ZnMoJm5ld19lbnRyeSkpIHsKLSAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICB9Ci0gICAgICAgIGF1dG8gbmV3X21vdW50X3BvaW50ID0gZnNfbWdyX21vdW50X3BvaW50KGVudHJ5Lm1vdW50X3BvaW50KTsKLSAgICAgICAgYXV0byBkdXBsaWNhdGVfb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A8PCBtb3VudF9wb2ludDsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICB9Ci0KLSAgICBzdGQ6OnN0cmluZyBkaXI7Ci0gICAgZm9yIChjb25zdCBhdXRvJiBvdmVybGF5X21vdW50X3BvaW50IDogT3ZlcmxheU1vdW50UG9pbnRzKCkpIHsKLSAgICAgICAgaWYgKG92ZXJsYXlfbW91bnRfcG9pbnQgPT0ga1NjcmF0Y2hNb3VudFBvaW50KSB7Ci0gICAgICAgICAgICBpZiAoIWZzX21ncl9vdmVybGF5ZnNfc2V0dXBfc2NyYXRjaChmc3RhYikpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChHZXRFbnRyeUZvck1vdW50UG9pbnQoJmZzdGFiLCBvdmVybGF5X21vdW50X3BvaW50KSA9PSBudWxscHRyKSB7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgZGlyID0gb3ZlcmxheV9tb3VudF9wb2ludDsKLSAgICAgICAgYnJlYWs7Ci0gICAgfQotICAgIGlmIChkaXIuZW1wdHkoKSkgewotICAgICAgICBMT0coRVJST1IpIDw8ICJDb3VsZCBub3QgYWxsb2NhdGUgYmFja2luZyBzdG9yYWdlIGZvciBvdmVybGF5cyI7Ci0gICAgICAgIHJldHVybiBmYWxzZTsKLSAgICB9Ci0KLSAgICBjb25zdCBhdXRvIG92ZXJsYXkgPSBmc19tZ3Jfb3ZlcmxheWZzX3NldHVwX2RpcihkaXIpOwotICAgIGlmIChvdmVybGF5LmVtcHR5KCkpIHsKLSAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIH0KLQotICAgIGJvb2wgb2sgPSB0cnVlOwotICAgIGZvciAoY29uc3QgYXV0byYgZW50cnkgOiBjYW5ka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it9CisKK3N0YXRpYyBib29sIGZzX21ncl9ybV9hbGwoY29uc3Qgc3RkOjpzdHJpbmcmIHBhdGgsIGJvb2wqIGNoYW5nZSA9IG51bGxwdHIsIGludCBsZXZlbCA9IDApIHsKKyAgICBzdGQ6OnVuaXF1ZV9wdHI8RElSLCBkZWNsdHlwZSgmY2xvc2VkaXIpPiBkaXIob3BlbmRpcihwYXRoLmNfc3RyKCkpLCBjbG9zZWRpcik7CisgICAgaWYgKCFkaXIpIHsKKyAgICAgICAgaWYgKGVycm5vID09IEVOT0VOVCkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgUEVSUk9SIDw8ICJvcGVuZGlyICIgPDwgcGF0aCA8PCAiIGRlcHRoPSIgPDwgbGV2ZWw7CisgICAgICAgIGlmICgoZXJybm8gPT0gRVBFUk0pICYmIChsZXZlbCAhPSAwKSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBkaXJlbnQqIGVudHJ5OworICAgIGF1dG8gcmV0ID0gdHJ1ZTsKKyAgICB3aGlsZSAoKGVudHJ5ID0gcmVhZGRpcihkaXIuZ2V0KCkpKSkgeworICAgICAgICBpZiAoKCIuInMgPT0gZW50cnktPmRfbmFtZSkgfHwgKCIuLiJzID09IGVudHJ5LT5kX25hbWUpKSBjb250aW51ZTsKKyAgICAgICAgYXV0byBmaWxlID0gcGF0aCArICIvIiArIGVudHJ5LT5kX25hbWU7CisgICAgICAgIGlmIChlbnRyeS0+ZF90eXBlID09IERUX1VOS05PV04pIHsKKyAgICAgICAgICAgIHN0cnVjdCBzdGF0IHN0OworICAgICAgICAgICAgaWYgKCFsc3RhdChmaWxlLmNfc3RyKCksICZzdCkgJiYgKHN0LnN0X21vZGUgJiBTX0lGRElSKSkgZW50cnktPmRfdHlwZSA9IERUX0RJUjsKKyAgICAgICAgfQorICAgICAgICBpZiAoZW50cnktPmRfdHlwZSA9PSBEVF9ESVIpIHsKKyAgICAgICAgICAgIHJldCAmPSBmc19tZ3Jfcm1fYWxsKGZpbGUsIGNoYW5nZSwgbGV2ZWwgKyAxKTsKKyAgICAgICAgICAgIGlmICghcm1kaXIoZmlsZS5jX3N0cigpKSkgeworICAgICAgICAgICAgICAgIGlmIChjaGFuZ2UpICpjaGFuZ2UgPSB0cnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoZXJybm8gIT0gRU5PRU5UKSByZXQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBQRVJST1IgPDwgInJtZGlyICIgPDwgZmlsZSA8PCAiIGRlcHRoPSIgPDwgbGV2ZWw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIXVubGluayhmaWxlLmNfc3RyKCkpKSB7CisgICAgICAgICAgICBpZiAoY2hhbmdlKSAqY2hhbmdlID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGlmIChlcnJubyAhPSBFTk9FTlQpIHJldCA9IGZhbHNlOworICAgICAgICAgICAgUEVSUk9SIDw8ICJybSAiIDw8IGZpbGUgPDwgIiBkZXB0aD0iIDw8IGxldmVsOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiByZXQ7Cit9CisKK3N0ZDo6c3RyaW5nIGZzX21ncl9vdmVybGF5ZnNfc2V0dXBfZGlyKGNvbnN0IHN0ZDo6c3RyaW5nJiBkaXIpIHsKKyAgICBhdXRvIHRvcCA9IGRpciArICIvIiArIGtPdmVybGF5VG9wRGlyOworCisgICAgQXV0b1NldEZzQ3JlYXRlQ29uIGNyZWF0ZWNvbihrT3ZlcmxheWZzRmlsZUNvbnRleHQpOworICAgIGlmICghY3JlYXRlY29uLk9rKCkpIHsKKyAgICAgICAgcmV0dXJuIHt9OworICAgIH0KKyAgICBpZiAobWtkaXIodG9wLmNfc3RyKCksIDA3NTUpICE9IDAgJiYgZXJybm8gIT0gRUVYSVNUKSB7CisgICAgICAgIFBFUlJPUiA8PCAibWtkaXIgIiA8PCB0b3A7CisgICAgICAgIHJldHVybiB7fTsKKyAgICB9CisgICAgaWYgKCFjcmVhdGVjb24uUmVzdG9yZSgpKSB7CisgICAgICAgIHJldHVybiB7fTsKKyAgICB9CisgICAgcmV0dXJuIHRvcDsKK30KKworYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX3NldHVwX29uZShjb25zdCBzdGQ6OnN0cmluZyYgb3ZlcmxheSwgY29uc3Qgc3RkOjpzdHJpbmcmIG1vdW50X3BvaW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sKiB3YW50X3JlYm9vdCkgeworICAgIGlmIChmc19tZ3Jfb3ZlcmxheWZzX2FscmVhZHlfbW91bnRlZChtb3VudF9wb2ludCkpIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIGNvbnN0IGF1dG8gYmFzZSA9IEdldEVuY29kZWRCYXNlRGlyRm9yTW91bnRQb2ludChtb3VudF9wb2ludCk7CisgICAgYXV0byBmc3JlY19tb3VudF9wb2ludCA9IG92ZXJsYXkgKyAiLyIgKyBiYXNlICsgIi8iOworCisgICAgQXV0b1NldEZzQ3JlYXRlQ29uIGNyZWF0ZWNvbihrT3ZlcmxheWZzRmlsZUNvbnRleHQpOworICAgIGlmICghY3JlYXRlY29uLk9rKCkpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZiAobWtkaXIoZnNyZWNfbW91bnRfcG9pbnQuY19zdHIoKSwgMDc1NSkgIT0gMCAmJiBlcnJubyAhPSBFRVhJU1QpIHsKKyAgICAgICAgUEVSUk9SIDw8ICJta2RpciAiIDw8IGZzcmVjX21vdW50X3BvaW50OworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGlmIChta2RpcigoZnNyZWNfbW91bnRfcG9pbnQgKyBrV29ya05hbWUpLmNfc3RyKCksIDA3NTUpICE9IDAgJiYgZXJybm8gIT0gRUVYSVNUKSB7CisgICAgICAgIFBFUlJPUiA8PCAibWtkaXIgIiA8PCBmc3JlY19tb3VudF9wb2ludCA8PCBrV29ya05hbWU7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgaWYgKCFjcmVhdGVjb24uUmVzdG9yZSgpKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBjcmVhdGVjb24gPSB7fTsKKworICAgIGF1dG8gbmV3X2NvbnRleHQgPSBmc19tZ3JfZ2V0X2NvbnRleHQobW91bnRfcG9pbnQpOworICAgIGlmIChuZXdfY29udGV4dC5lbXB0eSgpIHx8ICFjcmVhdGVjb24uU2V0KG5ld19jb250ZXh0KSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgYXV0byB1cHBlciA9IGZzcmVjX21vdW50X3BvaW50ICsga1VwcGVyTmFtZTsKKyAgICBpZiAobWtkaXIodXBwZXIuY19zdHIoKSwgMDc1NSkgIT0gMCAmJiBlcnJubyAhPSBFRVhJU1QpIHsKKyAgICAgICAgUEVSUk9SIDw8ICJta2RpciAiIDw8IHVwcGVyOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGlmICghY3JlYXRlY29uLlJlc3RvcmUoKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgaWYgKHdhbnRfcmVib290KSAqd2FudF9yZWJvb3QgPSB0cnVlOworCisgICAgcmV0dXJuIHRydWU7Cit9CisKK3N0YXRpYyB1aW50MzJfdCBmc19tZ3Jfb3ZlcmxheWZzX3Nsb3RfbnVtYmVyKCkgeworICAgIHJldHVybiBTbG90TnVtYmVyRm9yU2xvdFN1ZmZpeChmc19tZ3JfZ2V0X3Nsb3Rfc3VmZml4KCkpOworfQorCitzdGF0aWMgYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX2hhc19sb2dpY2FsKGNvbnN0IEZzdGFiJiBmc3RhYikgeworICAgIGZvciAoY29uc3QgYXV0byYgZW50cnkgOiBmc3RhYikgeworICAgICAgICBpZiAoZW50cnkuZnNfbWdyX2ZsYWdzLmxvZ2ljYWwpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKK30KKworT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQgVGVhcmRvd25EYXRhU2NyYXRjaChJSW1hZ2VNYW5hZ2VyKiBpbWFnZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBwYXJ0aXRpb25fbmFtZSwgYm9vbCB3YXNfbW91bnRlZCkgeworICAgIGlmICghaW1hZ2VzKSB7CisgICAgICAgIHJldHVybiBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6RXJyb3I7CisgICAgfQorICAgIGlmICghaW1hZ2VzLT5EaXNhYmxlSW1hZ2UocGFydGl0aW9uX25hbWUpKSB7CisgICAgICAgIHJldHVybiBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6RXJyb3I7CisgICAgfQorICAgIGlmICh3YXNfbW91bnRlZCkgeworICAgICAgICAvLyBJZiBvdmVybGF5ZnMgd2FzIG1vdW50ZWQsIGRvbid0IGJvdGhlciB0cnlpbmcgdG8gdW5tYXAgc2luY2UKKyAgICAgICAgLy8gaXQnbGwgZmFpbCBhbmQgY3JlYXRlIGVycm9yIHNwYW0uCisgICAgICAgIHJldHVybiBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6QnVzeTsKKyAgICB9CisgICAgaWYgKCFpbWFnZXMtPlVubWFwSW1hZ2VJZkV4aXN0cyhwYXJ0aXRpb25fbmFtZSkpIHsKKyAgICAgICAgcmV0dXJuIE92ZXJsYXlmc1RlYXJkb3duUmVzdWx0OjpCdXN5OworICAgIH0KKyAgICBpZiAoIWltYWdlcy0+RGVsZXRlQmFja2luZ0ltYWdlKHBhcnRpdGlvbl9uYW1lKSkgeworICAgICAgICByZXR1cm4gT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQ6OkJ1c3k7CisgICAgfQorICAgIHJldHVybiBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6T2s7Cit9CisKK092ZXJsYXlmc1RlYXJkb3duUmVzdWx0IGZzX21ncl9vdmVybGF5ZnNfdGVhcmRvd25fc2NyYXRjaChjb25zdCBzdGQ6OnN0cmluZyYgb3ZlcmxheSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sKiBjaGFuZ2UpIHsKKyAgICAvLyB1bW91bnQgYW5kIGRlbGV0ZSBrU2NyYXRjaE1vdW50UG9pbnQgc3RvcmFnZSBpZiB3ZSBoYXZlIGxvZ2ljYWwgcGFydGl0aW9ucworICAgIGlmIChvdmVybGF5ICE9IGtTY3JhdGNoTW91bnRQb2ludCkgeworICAgICAgICByZXR1cm4gT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQ6Ok9rOworICAgIH0KKworICAgIC8vIFZhbGlkYXRpb24gY2hlY2suCisgICAgaWYgKGZzX21ncl9pc19kc3VfcnVubmluZygpKSB7CisgICAgICAgIExFUlJPUiA8PCAiRGVzdHJveWluZyBEU1Ugc2NyYXRjaCBpcyBub3QgYWxsb3dlZC4iOworICAgICAgICByZXR1cm4gT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQ6OkVycm9yOworICAgIH0KKworICAgIGJvb2wgd2FzX21vdW50ZWQgPSBmc19tZ3Jfb3ZlcmxheWZzX2FscmVhZHlfbW91bnRlZChrU2NyYXRjaE1vdW50UG9pbnQsIGZhbHNlKTsKKyAgICBpZiAod2FzX21vdW50ZWQpIHsKKyAgICAgICAgZnNfbWdyX292ZXJsYXlmc191bW91bnRfc2NyYXRjaCgpOworICAgIH0KKworICAgIGNvbnN0IGF1dG8gcGFydGl0aW9uX25hbWUgP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YW5nZSkgKmNoYW5nZSA9IHRydWU7CisgICAgfSBlbHNlIGlmIChlcnJubyAhPSBFTk9FTlQpIHsKKyAgICAgICAgcmV0ID0gZmFsc2U7CisgICAgICAgIFBFUlJPUiA8PCAicm1kaXIgIiA8PCBuZXdwYXRoOworICAgIH0KKyAgICBpZiAoIWNsZWFudXBfYWxsKSB7CisgICAgICAgIGlmICghcm1kaXIodG9wLmNfc3RyKCkpKSB7CisgICAgICAgICAgICBpZiAoY2hhbmdlKSAqY2hhbmdlID0gdHJ1ZTsKKyAgICAgICAgICAgIGNsZWFudXBfYWxsID0gdHJ1ZTsKKyAgICAgICAgfSBlbHNlIGlmIChlcnJubyA9PSBFTk9URU1QVFkpIHsKKyAgICAgICAgICAgIGNsZWFudXBfYWxsID0gdHJ1ZTsKKyAgICAgICAgICAgIC8vIGNsZWFudXAgYWxsIGlmIHRoZSBjb250ZW50IGlzIGFsbCBoaWRkZW4gKGxlYWRpbmcgLikKKyAgICAgICAgICAgIHN0ZDo6dW5pcXVlX3B0cjxESVIsIGRlY2x0eXBlKCZjbG9zZWRpcik+IGRpcihvcGVuZGlyKHRvcC5jX3N0cigpKSwgY2xvc2VkaXIpOworICAgICAgICAgICAgaWYgKCFkaXIpIHsKKyAgICAgICAgICAgICAgICBQRVJST1IgPDwgIm9wZW5kaXIgIiA8PCB0b3A7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGRpcmVudCogZW50cnk7CisgICAgICAgICAgICAgICAgd2hpbGUgKChlbnRyeSA9IHJlYWRkaXIoZGlyLmdldCgpKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVudHJ5LT5kX25hbWVbMF0gIT0gJy4nKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjbGVhbnVwX2FsbCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9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XplIC8gMik7CisgICAgICAgICAgICAgICAgICAgIGlmICghYnVpbGRlci0+UmVzaXplUGFydGl0aW9uKHBhcnRpdGlvbiwgcGFydGl0aW9uX3NpemUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMRVJST1IgPDwgInJlc2l6ZSAiIDw8IHBhcnRpdGlvbl9uYW1lOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICghcGFydGl0aW9uX2NyZWF0ZSkgRGVzdHJveUxvZ2ljYWxQYXJ0aXRpb24ocGFydGl0aW9uX25hbWUpOworICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlOworICAgICAgICAgICAgICAgICpwYXJ0aXRpb25fZXhpc3RzID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgLy8gbGFuZCB0aGUgdXBkYXRlIGJhY2sgb24gdG8gdGhlIHBhcnRpdGlvbgorICAgIGlmIChjaGFuZ2VkKSB7CisgICAgICAgIGF1dG8gbWV0YWRhdGEgPSBidWlsZGVyLT5FeHBvcnQoKTsKKyAgICAgICAgaWYgKCFtZXRhZGF0YSB8fCAhVXBkYXRlUGFydGl0aW9uVGFibGUoc3VwZXJfZGV2aWNlLCAqbWV0YWRhdGEuZ2V0KCksIHNsb3RfbnVtYmVyKSkgeworICAgICAgICAgICAgTEVSUk9SIDw8ICJhZGQgcGFydGl0aW9uICIgPDwgcGFydGl0aW9uX25hbWU7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAoY2hhbmdlZCB8fCBwYXJ0aXRpb25fY3JlYXRlKSB7CisgICAgICAgIENyZWF0ZUxvZ2ljYWxQYXJ0aXRpb25QYXJhbXMgcGFyYW1zID0geworICAgICAgICAgICAgICAgIC5ibG9ja19kZXZpY2UgPSBzdXBlcl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Gl0IHVzZWxlc3MsIG5vIG92ZXJyaWRlcyBhbmQgbm8gZnJlZSBzcGFjZQorICAgICAgICAgICAgaWYgKCFmc19tZ3Jfb3ZlcmxheWZzX3Vtb3VudF9zY3JhdGNoKCkpIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gdW5tb3VudCBzY3JhdGNoIHBhcnRpdGlvbiI7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgaWYgKCFNYWtlU2NyYXRjaEZpbGVzeXN0ZW0oc2NyYXRjaF9kZXZpY2UpKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIkZhaWxlZCB0byBmb3JtYXQgc2NyYXRjaCBwYXJ0aXRpb24iOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcmV0dXJuIE1vdW50U2NyYXRjaChzY3JhdGNoX2RldmljZSk7Cit9CisKK2NvbnN0ZXhwciBib29sIE92ZXJsYXlmc1RlYXJkb3duQWxsb3dlZCgpIHsKKyAgICAvLyBOZXZlciBhbGxvdyBvbiBub24tZGVidWdnYWJsZSBidWlsZC4KKyAgICByZXR1cm4ga0FsbG93T3ZlcmxheWZzOworfQorCit9ICAvLyBuYW1lc3BhY2UKKworYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX3NldHVwKGNvbnN0IEZzdGFiJiBmc3RhYiwgY29uc3QgY2hhciogbW91bnRfcG9pbnQsIGJvb2wqIHdhbnRfcmVib290LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wganVzdF9kaXNhYmxlZF92ZXJpdHkpIHsKKyAgICBpZiAoIU92ZXJsYXlmc1NldHVwQWxsb3dlZCgvKnZlcmJvc2U9Ki90cnVlKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgaWYgKCFmc19tZ3JfYm9vdF9jb21wbGV0ZWQoKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJDYW5ub3Qgc2V0dXAgb3ZlcmxheWZzIGJlZm9yZSBwZXJzaXN0ZW50IHByb3BlcnRpZXMgYXJlIHJlYWR5IjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGF1dG8gY2FuZGlkYXRlcyA9IGZzX21ncl9vdmVybGF5ZnNfY2FuZGlkYXRlX2xpc3QoZnN0YWIpOworICAgIGZvciAoYXV0byBpdCA9IGNhbmRpZGF0ZXMuYmVnaW4oKTsgaXQgIT0gY2FuZGlkYXRlcy5lbmQoKTspIHsKKyAgICAgICAgaWYgKG1vdW50X3BvaW50ICYmCisgICAgICAgICAgICAoZnNfbWdyX21vdW50X3BvaW50KGl0LT5tb3VudF9wb2ludCkgIT0gZnNfbWdyX21vdW50X3BvaW50KG1vdW50X3BvaW50KSkpIHsKKyAgICAgICAgICAgIGl0ID0gY2FuZGlkYXRlcy5lcmFzZShpdCk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorCisgICAgICAgIGF1dG8gdmVyaXR5X2VuYWJsZWQgPSAhanVzdF9kaXNhYmxlZF92ZXJpdHkgJiYgZnNfbWdyX2lzX3Zlcml0eV9lbmFibGVkKCppdCk7CisgICAgICAgIGlmICh2ZXJpdHlfZW5hYmxlZCkgeworICAgICAgICAgICAgaXQgPSBjYW5kaWRhdGVzLmVyYXNlKGl0KTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgICsraXQ7CisgICAgfQorCisgICAgaWYgKGNhbmRpZGF0ZXMuZW1wdHkoKSkgeworICAgICAgICBpZiAobW91bnRfcG9pbnQpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIk5vIG92ZXJsYXlmcyBjYW5kaWRhdGUgd2FzIGZvdW5kIGZvciAiIDw8IG1vdW50X3BvaW50OworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHN0ZDo6c3RyaW5nIGRpcjsKKyAgICBmb3IgKGNvbnN0IGF1dG8mIG92ZXJsYXlfbW91bnRfcG9pbnQgOiBPdmVybGF5TW91bnRQb2ludHMoKSkgeworICAgICAgICBpZiAob3ZlcmxheV9tb3VudF9wb2ludCA9PSBrU2NyYXRjaE1vdW50UG9pbnQpIHsKKyAgICAgICAgICAgIGlmICghZnNfbWdyX292ZXJsYXlmc19zZXR1cF9zY3JhdGNoKGZzdGFiKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKCFmc19tZ3Jfb3ZlcmxheWZzX2FscmVhZHlfbW91bnRlZChvdmVybGF5X21vdW50X3BvaW50LCBmYWxzZSAvKiBvdmVybGF5ICovKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGRpciA9IG92ZXJsYXlfbW91bnRfcG9pbnQ7CisgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBpZiAoZGlyLmVtcHR5KCkpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ291bGQgbm90IGFsbG9jYXRlIGJhY2tpbmcgc3RvcmFnZSBmb3Igb3ZlcmxheXMiOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgY29uc3QgYXV0byBvdmVybGF5ID0gZnNfbWdyX292ZXJsYXlmc19zZXR1cF9kaXIoZGlyKTsKKyAgICBpZiAob3ZlcmxheS5lbXB0eSgpKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBib29sIG9rID0gdHJ1ZTsKKyAgICBmb3IgKGNvbnN0IGF1dG8mIGVudHJ5IDogY2FuZGlkYXRlcykgeworICAgICAgICBhdXRvIGZzdGFiX21vdW50X3BvaW50ID0gZnNfbWdyX21vdW50X3BvaW50KGVudHJ5Lm1vdW50X3Bv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JmluZm8uZGV2aWNlKSkgeworICAgICAgICAgICAgcmV0dXJuIHt9OworICAgICAgICB9CisgICAgICAgIGluZm8ubmFtZSA9IHBhcnRpdGlvbl9uYW1lOworICAgICAgICBpbmZvLmltYWdlcyA9IHN0ZDo6bW92ZShpbWFnZXMpOworICAgICAgICByZXR1cm4ge3N0ZDo6bW92ZShpbmZvKX07CisgICAgfQorCisgICAgLy8gQXZvaWQgdWFydCBzcGFtIGJ5IGZpcnN0IGNoZWNraW5nIGZvciBhIHNjcmF0Y2ggcGFydGl0aW9uLgorICAgIGNvbnN0IGF1dG8gc3VwZXJfZGV2aWNlID0ga1BoeXNpY2FsRGV2aWNlICsgZnNfbWdyX2dldF9zdXBlcl9wYXJ0aXRpb25fbmFtZSgpOworICAgIGF1dG8gbWV0YWRhdGEgPSBSZWFkQ3VycmVudE1ldGFkYXRhKHN1cGVyX2RldmljZSk7CisgICAgaWYgKCFtZXRhZGF0YSkgeworICAgICAgICByZXR1cm4ge307CisgICAgfQorCisgICAgYXV0byBwYXJ0aXRpb24gPSBGaW5kUGFydGl0aW9uKCptZXRhZGF0YS5nZXQoKSwgcGFydGl0aW9uX25hbWUpOworICAgIGlmICghcGFydGl0aW9uKSB7CisgICAgICAgIHJldHVybiB7fTsKKyAgICB9CisKKyAgICBDcmVhdGVMb2dpY2FsUGFydGl0aW9uUGFyYW1zIHBhcmFtcyA9IHsKKyAgICAgICAgICAgIC5ibG9ja19kZXZpY2UgPSBzdXBlcl9kZXZpY2UsCisgICAgICAgICAgICAubWV0YWRhdGEgPSBtZXRhZGF0YS5nZXQoKSwKKyAgICAgICAgICAgIC5wYXJ0aXRpb24gPSBwYXJ0aXRpb24sCisgICAgICAgICAgICAuZm9yY2Vfd3JpdGFibGUgPSB0cnVlLAorICAgICAgICAgICAgLnRpbWVvdXRfbXMgPSAxMHMsCisgICAgfTsKKyAgICBpZiAoIUNyZWF0ZUxvZ2ljYWxQYXJ0aXRpb24ocGFyYW1zLCAmaW5mby5kZXZ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GFuZHJvaWQ6OmdzaTo6a0RzdVNjcmF0Y2gsIDEwcywgZGV2aWNlKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitzdGF0aWMgT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQgVGVhcmRvd25Nb3VudHNBbmRTY3JhdGNoKGNvbnN0IGNoYXIqIG1vdW50X3BvaW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sKiB3YW50X3JlYm9vdCkgeworICAgIGJvb2wgc2hvdWxkX2Rlc3Ryb3lfc2NyYXRjaCA9IGZhbHNlOworICAgIGF1dG8gcnYgPSBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6T2s7CisgICAgZm9yIChjb25zdCBhdXRvJiBvdmVybGF5X21vdW50X3BvaW50IDogT3ZlcmxheU1vdW50UG9pbnRzKCkpIHsKKyAgICAgICAgYXV0byBvayA9IGZzX21ncl9vdmVybGF5ZnNfdGVhcmRvd25fb25lKAorICAgICAgICAgICAgICAgIG92ZXJsYXlfbW91bnRfcG9pbnQsIG1vdW50X3BvaW50ID8gZnNfbWdyX21vdW50X3BvaW50KG1vdW50X3BvaW50KSA6ICIiLAorICAgICAgICAgICAgICAgIHdhbnRfcmVib290LAorICAgICAgICAgICAgICAgIG92ZXJsYXlfbW91bnRfcG9pbnQgPT0ga1NjcmF0Y2hNb3VudFBvaW50ID8gJnNob3VsZF9kZXN0cm95X3NjcmF0Y2ggOiBudWxscHRyKTsKKyAgICAgICAgaWYgKCFvaykgeworICAgICAgICAgICAgcnYgPSBPdmVybGF5ZnNUZWFyZG93blJlc3VsdDo6RXJyb3I7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBEbyBub3QgYXR0ZW1wdCB0byBkZXN0cm95IERTVSBzY3JhdGNoIGlmIHdpdGhpbiBhIERTVSBzeXN0ZW0sCisgICAgLy8gYmVjYXVzZSBEU1Ugc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vIHRlYXJkb3duLgorICAgICAgICByZXR1cm4gT3ZlcmxheWZzVGVhcmRvd25SZXN1bHQ6Ok9rOworICAgIH0KKyAgICAvLyBJZiBzY3JhdGNoIGV4aXN0cywgYnV0IGlzIG5vdCBtb3VudGVkLCBsZXRzIGdhaW4gYWNjZXNzIHRvIGNsZWFuCisgICAgLy8gc3BlY2lmaWMgb3ZlcnJpZGUgZW50cmllcy4KKyAgICBhdXRvIG1vdW50X3NjcmF0Y2ggPSBmYWxzZTsKKyAgICBpZiAoKG1vdW50X3BvaW50ICE9IG51bGxwdHIpICYmICFmc19tZ3Jfb3ZlcmxheWZzX2FscmVhZHlfbW91bnRlZChrU2NyYXRjaE1vdW50UG9pbnQsIGZhbHNlKSkgeworICAgICAgICBzdGQ6OnN0cmluZyBzY3JhdGNoX2RldmljZSA9IEdldEJvb3RTY3JhdGNoRGV2aWNlKCk7CisgICAgICAgIGlmICghc2NyYXRjaF9kZXZpY2UuZW1wdHkoKSkgeworICAgICAgICAgICAgbW91bnRfc2NyYXRjaCA9IE1vdW50U2NyYXRjaChzY3JhdGNoX2RldmljZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBhdXRvIHJ2ID0gVGVhcmRvd25Nb3VudHNBbmRTY3JhdGNoKG1vdW50X3BvaW50LCB3YW50X3JlYm9vdCk7CisKKyAgICBpZiAobW91bnRfc2NyYXRjaCkgeworICAgICAgICBpZiAoIWZzX21ncl9vdmVybGF5ZnNfdW1vdW50X3NjcmF0Y2goKSkgeworICAgICAgICAgICAgcmV0dXJuIE92ZXJsYXlmc1RlYXJkb3duUmVzdWx0OjpCdXN5OworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBydjsKK30KKworbmFtZXNwYWNlIGFuZHJvaWQgeworbmFtZXNwYWNlIGZzX21nciB7CisKK3ZvaWQgTWFwU2NyYXRjaFBhcnRpdGlvbklmTmVlZGVkKEZzdGFiKiBmc3RhYiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmFibGUgdG8gZGlzYWJsZSBzY3JhdGNoIHBhcnRpdGlvbiBmb3IgIiA8PCBrU2NyYXRjaE1vdW50UG9pbnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBOb3RlIGlmIHdlIGp1c3QgZGlzYWJsZWQgc2NyYXRjaCwgdGhpcyBtb3VudCB3aWxsIGZhaWwuCisgICAgaWYgKGF1dG8gaW5mbyA9IEVuc3VyZVNjcmF0Y2hNYXBwZWQoKTsgaW5mby5oYXNfdmFsdWUoKSkgeworICAgICAgICAvLyBNYXAgc2NyYXRjaCBkZXZpY2UsIG1vdW50IGtTY3JhdGNoTW91bnRQb2ludCBhbmQgdGVhcmRvd24ga1NjcmF0Y2hNb3VudFBvaW50LgorICAgICAgICBmc19tZ3Jfb3ZlcmxheWZzX3Vtb3VudF9zY3JhdGNoKCk7CisgICAgICAgIGlmIChNb3VudFNjcmF0Y2goaW5mby0+ZGV2aWNlKSkgeworICAgICAgICAgICAgYm9vbCBzaG91bGRfZGVzdHJveV9zY3JhdGNoID0gZmFsc2U7CisgICAgICAgICAgICBmc19tZ3Jfb3ZlcmxheWZzX3RlYXJkb3duX29uZShrU2NyYXRjaE1vdW50UG9pbnQsIHRlYXJkb3duX2RpciwgaWdub3JlX2NoYW5nZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZzaG91bGRfZGVzdHJveV9zY3JhdGNoKTsKKyAgICAgICAgICAgIGZzX21ncl9vdmVybGF5ZnNfdW1vdW50X3NjcmF0Y2goKTsKKyAgICAgICAgICAgIGlmIChzaG91bGRfZGVzdHJveV9zY3JhdGNoKSB7CisgICAgICAgICAgICAgICAgZnNfbWdyX292ZXJsYXlmc190ZWFyZG93bl9zY3JhdGNoKGtTY3JhdGNoTW91bnRQb2ludCwgbnVsbHB0cik7CisgICA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isgICAgZm9yIChjb25zdCBhdXRvJiBvdmVybGF5X21vdW50X3BvaW50IDogT3ZlcmxheU1vdW50UG9pbnRzKCkpIHsKKyAgICAgICAgY29uc3QgYXV0byBkaXIgPSBvdmVybGF5X21vdW50X3BvaW50ICsgIi8iICsga092ZXJsYXlUb3BEaXIgKyAiLyIgKyBiYXNlICsgIi8iOworICAgICAgICBjb25zdCBhdXRvIHVwcGVyID0gZGlyICsga1VwcGVyTmFtZTsKKyAgICAgICAgY29uc3QgYXV0byB3b3JrID0gZGlyICsga1dvcmtOYW1lOworICAgICAgICBpZiAoIWZzX21ncl9pc19kaXIodXBwZXIpIHx8ICFmc19tZ3JfaXNfZGlyKHdvcmspIHx8IGFjY2Vzcyh3b3JrLmNfc3RyKCksIFJfT0sgfCBXX09LKSkgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgYXV0byByZXQgPSBrTG93ZXJkaXJPcHRpb24gKyBtb3VudF9wb2ludCArICIsIiArIGtVcHBlcmRpck9wdGlvbiArIHVwcGVyICsgIiwiICsKKyAgICAgICAgICAgICAgICAgICBrV29ya2Rpck9wdGlvbiArIHdvcmsgKyBhbmRyb2lkOjpmc19tZ3I6OkNoZWNrT3ZlcmxheWZzKCkubW91bnRfZmxhZ3M7CisgICAgICAgIGZvciAoY29uc3QgYXV0byYgZmxhZyA6IGFuZHJvaWQ6OmJhc2U6OlNwbGl0KGVudHJ5LmZzX29wdGlvbnMsICIsIikpIHsKKyAgICAgICAgICAgIGlmIChhbmRyb2lkOjpiYXNlOjpTdGFydHNXaXRoKGZsYWcsICJjb250ZXh0PSIpKSB7CisgICAgICAgICAgICAgICAgcmV0ICs9ICIsIiArIGZsYWc7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJldDsKKyAgICB9CisgICAgcmV0dXJuICIiOworfQorCitib29sIEF1dG9TZXRGc0NyZWF0ZUNvbjo6U2V0KGNvbnN0IHN0ZDo6c3RyaW5nJiBjb250ZXh0KSB7CisgICAgaWYgKHNldGZzY3JlYXRlY29uKGNvbnRleHQuY19zdHIoKSkpIHsKKyAgICAgICAgUExPRyhFUlJPUikgPDwgInNldGZzY3JlYXRlY29uICIgPDwgY29udGV4dDsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBva18gPSB0cnVlOworICAgIHJldHVybiB0cnVlOworfQorCitib29sIEF1dG9TZXRGc0NyZWF0ZUNvbjo6UmVzdG9yZSgpIHsKKyAgICBpZiAocmVzdG9yZWRfIHx8ICFva18pIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIGlmIChzZXRmc2NyZWF0ZWNvbihudWxscHRyKSkgeworICAgICAgICBQTE9HKEVSUk9SKSA8PCAic2V0ZnNjcmVhdGVjb24gbnVsbCI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgcmVzdG9yZWRfID0gdHJ1ZTsKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworLy8gUmV0dXJucyB0cnVlIGlmIGltbWVkaWF0ZSB1bm1vdW50IHN1Y2NlZWRlZCBhbmQgdGhlIHNjcmF0Y2ggbW91bnQgcG9pbnQgd2FzCisvLyByZW1vdmVkLgorYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX3Vtb3VudF9zY3JhdGNoKCkgeworICAgIGlmICh1bW91bnQoa1NjcmF0Y2hNb3VudFBvaW50KSAhPSAwKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgaWYgKHJtZGlyKGtTY3JhdGNoTW91bnRQb2ludCkgIT0gMCAmJiBlcnJubyAhPSBFTk9FTlQpIHsKKyAgICAgICAgUExPRyhFUlJPUikgPDwgInJtZGlyICIgPDwga1NjcmF0Y2hNb3VudFBvaW50OworICAgIH0KKyAgICByZXR1cm4gdHJ1ZTsKK30KKworc3RhdGljIGJvb2wgZnNfbWdyX292ZXJsYXlmc19zZXRfc2hhcmVkX21vdW50KGNvbn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Sk+e2ZvcGVuKHBhdGguY19zdHIoKSwgInJlIiksIGZjbG9zZX07CisgICAgaWYgKCFmaWxlKSB7CisgICAgICAgIFBFUlJPUiA8PCBfX0ZVTkNUSU9OX18gPDwgIigpOiBjYW5ub3Qgb3BlbiBmaWxlOiAnIiA8PCBwYXRoIDw8ICInIjsKKyAgICAgICAgcmV0dXJuIGluZm87CisgICAgfQorCisgICAgc3NpemVfdCBsZW47CisgICAgc2l6ZV90IGFsbG9jX2xlbiA9IDA7CisgICAgY2hhciogbGluZSA9IG51bGxwdHI7CisgICAgd2hpbGUgKChsZW4gPSBnZXRsaW5lKCZsaW5lLCAmYWxsb2NfbGVuLCBmaWxlLmdldCgpKSkgIT0gLTEpIHsKKyAgICAgICAgLyogaWYgdGhlIGxhc3QgY2hhcmFjdGVyIGlzIGEgbmV3bGluZSwgc2hvcnRlbiB0aGUgc3RyaW5nIGJ5IDEgYnl0ZSAqLworICAgICAgICBpZiAobGluZVtsZW4gLSAxXSA9PSAnXG4nKSB7CisgICAgICAgICAgICBsaW5lW2xlbiAtIDFdID0gJ1wwJzsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyBjb25zdGV4cHIgY2hhciBkZWxpbVtdID0gIiBcdCI7CisgICAgICAgIGNoYXIqIHNhdmVfcHRyOworICAgICAgICBpZiAoIXN0cnRva19yKGxpbmUsIGRlbGltLCAmc2F2ZV9wdHIpKSB7CisgICAgICAgICAgICBMRVJST1IgPDwgIkVycm9yIHBhcnNpbmcgbW91bnQgSUQiOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFzdHJ0b2tfcihudWxscHRyLCBkZWxpbSwgJnNhdmVfcHRyKSkgeworICAgICAgICAgICAgTEVSUk9SIDw8ICJFcnJvciBwYXJzaW5nIHBhcmVudCBJRCI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBpZiAoIXN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSB7CisgICAgICAgICAgICBMRVJST1IgPDwgIkVycm9yIHBhcnNpbmcgbW91bnQgc291cmNlIjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmICghc3RydG9rX3IobnVsbHB0ciwgZGVsaW0sICZzYXZlX3B0cikpIHsKKyAgICAgICAgICAgIExFUlJPUiA8PCAiRXJyb3IgcGFyc2luZyByb290IjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgY2hhciogcDsKKyAgICAgICAgaWYgKCEocCA9IHN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSkgeworICAgICAgICAgICAgTEVSUk9SIDw8ICJFcnJvciBwYXJzaW5nIG1vdW50X3BvaW50IjsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIG1vdW50X2luZm8gZW50cnkgPSB7cCwgZmFsc2V9OworCisgICAgICAgIGlmICghc3RydG9rX3IobnVsbHB0ciwgZGVsaW0sICZzYXZlX3B0cikpIHsKKyAgICAgICAgICAgIExFUlJPUiA8PCAiRXJyb3IgcGFyc2luZyBtb3VudF9mbGFncyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHdoaWxlICgocCA9IHN0cnRva19yKG51bGxwdHIsIGRlbGltLCAmc2F2ZV9wdHIpKSkgeworICAgICAgICAgICAgaWYgKChwWzBdID09ICctJykgJiYgKHBbMV0gPT0gJ1wwJykpIGJyZWFrOworICAgICAgICAgICAgaWYgKGFuZHJvaWQ6OmJhc2U6OlN0YXJ0c1dpdGgocCwgInNoYXJlZDoiKSkgZW50cnkuc2hhcmVkX2ZsYWcgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGlmICghcCkgeworICAgICAgICAgICAgTEVSUk9SIDw8ICJFcnJvciBwYXJzaW5nIGZpZWxkcyI7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICBpbmZvLmVtcGxhY2VfYmFjayhzdGQ6Om1vdmUoZW50cnkpKTsKKyAgICB9CisKKyAgICBmcmVlKGxpbmUpOworICAgIGlmIChpbmZvLmVtcHR5KCkpIHsKKyAgICAgICAgTEVSUk9SIDw8IF9fRlVOQ1RJT05fXyA8PCAiKCk6IGZhaWxlZCB0byBsb2FkIG1vdW50aW5mbyBmcm9tIDogJyIgPDwgcGF0aCA8PCAiJyI7CisgICAgfQorICAgIHJldHVybiBpbmZvOworfQorCitzdGF0aWMgYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX21vdW50X29uZShjb25zdCBGc3RhYkVudHJ5JiBmc3RhYl9lbnRyeSkgeworICAgIGNvbnN0IGF1dG8gbW91bnRfcG9pbnQgPSBmc19tZ3JfbW91bnRfcG9pbnQoZnN0YWJfZW50cnkubW91bnRfcG9pbnQpOworICAgIGNvbnN0IGF1dG8gb3B0aW9ucyA9IGZzX21ncl9nZXRfb3ZlcmxheWZzX29wdGlvbnMoZnN0YWJfZW50cnkpOworICAgIGlmIChvcHRpb25zLmVtcHR5KCkpIHJldHVybiBmYWxzZTsKKworICAgIHN0cnVjdCBNb3ZlRW50cnkgeworICAgICAgICBzdGQ6OnN0cmluZyBtb3VudF9wb2ludDsKKyAgICAgICAgc3RkOjpzdHJpbmcgZGlyOworICAgICAgICBib29sIHNoYXJlZF9mbGFnOworICAgIH07CisgICAgc3RkOjp2ZWN0b3I8TW92ZUVudHJ5PiBtb3ZlZF9tb3VudHM7CisKKyAgICBib29sIHJldHZhbCA9IHRydWU7CisgICAgYm9vbCBtb3ZlX2Rpcl9zaGFyZWQgPSB0cnVlOworICAgIGJvb2wgcGFyZW50X3NoYXJlZCA9IHRydWU7CisgICAgYm9vbCByb290X3NoYXJlZCA9IHRydWU7CisgICAgYm9vbCByb290X21hZGVfcHJpdmF0ZSA9IGZhbHNlOworCisgICAgLy8gVGhlcmUgY291bGQgYmUgbXVsdGlwbGUgbW91bnQgZW50cmllcyB3aXRoIHRoZSBzYW1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5mby5lbmQoKSk7CisgICAgc3RkOjpyZXZlcnNlKG1vdW50aW5mby5iZWdpbigpLCBtb3VudGluZm8uZW5kKCkpOworICAgIC8vIG1vdW50aW5mbyBpcyByZXZlcnNlZCB0d2ljZSwgc28gc3RpbGwgaXMgaW4gbGV4aWNhbCBzb3J0ZWQgb3JkZXIuCisKKyAgICBmb3IgKGNvbnN0IGF1dG8mIGVudHJ5IDogbW91bnRpbmZvKSB7CisgICAgICAgIGlmIChlbnRyeS5tb3VudF9wb2ludCA9PSBrTW92ZU1vdW50VGVtcERpcikgeworICAgICAgICAgICAgbW92ZV9kaXJfc2hhcmVkID0gZW50cnkuc2hhcmVkX2ZsYWc7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGVudHJ5Lm1vdW50X3BvaW50ID09IG1vdW50X3BvaW50IHx8CisgICAgICAgICAgICAobW91bnRfcG9pbnQgPT0gIi9zeXN0ZW0iICYmIGVudHJ5Lm1vdW50X3BvaW50ID09ICIvIikpIHsKKyAgICAgICAgICAgIHBhcmVudF9zaGFyZWQgPSBlbnRyeS5zaGFyZWRfZmxhZzsKKyAgICAgICAgfQorICAgICAgICBpZiAoZW50cnkubW91bnRfcG9pbnQgPT0gIi8iKSB7CisgICAgICAgICAgICByb290X3NoYXJlZCA9IGVudHJ5LnNoYXJlZF9mbGFnOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gUHJlY29uZGl0aW9uIGlzIHRoYXQga01vdmVNb3VudFRlbXBEaXIgaXMgTVNfUFJJVkFURSwgb3RoZXJ3aXNlIGRvbid0IHRyeSB0byBtb3ZlIGFueQorICAgIC8vIHN1Ym1vdW50IGluIHRvIG9yIG91dCBvZiBpdC4KKyAgICBpZiAobW92ZV9kaXJfc2hhcmVkKSB7CisgICAgICAgIG1vdW50aW5mby5jbGVhcigpOworICAgIH0KKworICAgIC8vIE5lZWQgdG8gbWFrZSB0aGUgb3JpZ2luYWwgbW91bnRwb2ludCBNU19QUklWQVRFLCBzbyB0aGF0IHRoZ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JiBpdCkgeworICAgICAgICAgICAgICAgIHJldHVybiBpdC5tb3VudF9wb2ludCA9PSBlbnRyeS5tb3VudF9wb2ludCB8fAorICAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOjpiYXNlOjpTdGFydHNXaXRoKGVudHJ5Lm1vdW50X3BvaW50LCBpdC5tb3VudF9wb2ludCArICIvIik7CisgICAgICAgICAgICB9KSAhPSBtb3ZlZF9tb3VudHMuZW5kKCkpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIC8vIG1vdW50aW5mbyBpcyBpbiBsZXhpY2FsIG9yZGVyLCBzbyBubyBuZWVkIHRvIHdvcnJ5IGFib3V0IHxlbnRyeXwgYmVpbmcgYSBwYXJlbnQgbW91bnQgb2YKKyAgICAgICAgLy8gZW50cmllcyBvZiB8bW92ZWRfbW91bnRzfC4KKworICAgICAgICBNb3ZlRW50cnkgbmV3X2VudHJ5e2VudHJ5Lm1vdW50X3BvaW50LCBrTW92ZU1vdW50VGVtcERpciArICIvVGVtcG9yYXJ5RGlyLVhYWFhYWCJzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5LnNoYXJlZF9mbGFnfTsKKyAgICAgICAgeworICAgICAgICAgICAgQXV0b1NldEZzQ3JlYXRlQ29uIGNyZWF0ZWNvbjsKKyAgICAgICAgICAgIGF1dG8gbmV3X2NvbnRleHQgPSBmc19tZ3JfZ2V0X2NvbnRleHQoZW50cnkubW91bnRfcG9pbnQpOworICAgICAgICAgICAgaWYgKG5ld19jb250ZXh0LmVtcHR5KCkgfHwgIWNyZWF0ZWNvbi5TZXQobmV3X2NvbnRleHQpKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb25zdCBhdXRvIHRhcmdldCA9IG1rZHRlbXAobmV3X2VudHJ5LmRpci5kYXRhKCkpOworICAgICAgICAgICAgaWYgKCF0YXJnZXQpIHsKKyAgICAgICAgICAgICAgICByZXR2YWwgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBQRVJST1IgPDwgInRlbXBvcmFyeSBkaXJlY3RvcnkgZm9yIE1TX01PVkUiOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFjcmVhdGVjb24uUmVzdG9yZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dmFsID0gZmFsc2U7CisgICAgICAgICAgICAgICAgcm1kaXIobmV3X2VudHJ5LmRpci5jX3N0cigpKTsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChuZXdfZW50cnkuc2hhcmVkX2ZsYWcpIHsKKyAgICAgICAgICAgIG5ld19lbnRyeS5zaGFyZWRfZmxhZyA9IGZzX21ncl9vdmVybGF5ZnNfc2V0X3NoYXJlZF9tb3VudChuZXdfZW50cnkubW91bnRfcG9pbnQsIGZhbHNlKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWZzX21ncl9vdmVybGF5ZnNfbW92ZV9tb3VudChuZXdfZW50cnkubW91bnRfcG9pbnQsIG5ld19lbnRyeS5kaXIpKSB7CisgICAgICAgICAgICByZXR2YWwgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChuZXdfZW50cnkuc2hhcmVkX2ZsYWcpIHsKKyAgICAgICAgICAgICAgICBmc19tZ3Jfb3ZlcmxheWZzX3NldF9zaGFyZWRfbW91bnQobmV3X2VudHJ5Lm1vdW50X3BvaW50LCB0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJtZGlyKG5ld19lbnRyeS5kaXIuY19zdHIoKSk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBtb3ZlZF9tb3VudHMucHVzaF9iYWNrKHN0ZDo6bW92ZShuZXdfZW50cnkpKTsKKyAgICB9CisKKyAgICByZXR2YWwgJj0gZnNfbWdyX292Z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kaXIoa1NjcmF0Y2hNb3VudFBvaW50LCAwNzU1KSAmJiAoZXJybm8gIT0gRUVYSVNUKSkgeworICAgICAgICBQRVJST1IgPDwgImNyZWF0ZSAiIDw8IGtTY3JhdGNoTW91bnRQb2ludDsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIEZzdGFiRW50cnkgZW50cnk7CisgICAgZW50cnkuYmxrX2RldmljZSA9IGRldmljZV9wYXRoOworICAgIGVudHJ5Lm1vdW50X3BvaW50ID0ga1NjcmF0Y2hNb3VudFBvaW50OworICAgIGVudHJ5LmZsYWdzID0gTVNfTk9BVElNRSB8IE1TX1JET05MWTsKKyAgICBpZiAoIXJlYWRvbmx5KSB7CisgICAgICAgIGVudHJ5LmZsYWdzICY9IH5NU19SRE9OTFk7CisgICAgICAgIGVudHJ5LmZsYWdzIHw9IE1TX1NZTkNIUk9OT1VTOworICAgICAgICBlbnRyeS5mc19vcHRpb25zID0gIm5vZGlzY2FyZCI7CisgICAgICAgIGZzX21ncl9zZXRfYmxrX3JvKGRldmljZV9wYXRoLCBmYWxzZSk7CisgICAgfQorICAgIC8vIGNoZWNrX2ZzIHJlcXVpcmVzIGFwZXggcnVudGltZSBsaWJyYXJ5CisgICAgaWYgKGZzX21ncl9vdmVybGF5ZnNfYWxyZWFkeV9tb3VudGVkKCIvZGF0YSIsIGZhbHNlKSkgeworICAgICAgICBlbnRyeS5mc19tZ3JfZmxhZ3MuY2hlY2sgPSB0cnVlOworICAgIH0KKyAgICBib29sIG1vdW50ZWQgPSBmYWxzZTsKKyAgICBmb3IgKGF1dG8gZnNfdHlwZSA6IGZpbGVzeXN0ZW1fY2FuZGlkYXRlcykgeworICAgICAgICBlbnRyeS5mc190eXBlID0gZnNfdHlwZTsKKyAgICAgICAgaWYgKGZzX21ncl9kb19tb3VudF9vbmUoZW50cnkpID09IDApIHsKKyAgICAgICAgICAgIG1vdW50ZWQgPSB0cnVlOworICAgICAgICAgICAgYnJlYWs7CisgICAgIC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gmbW91bnRzLCBwcm9jX21vdW50X3BvaW50KTsKKyAgICAgICAgaWYgKCFtb3VudGVkIHx8IG1vdW50ZWQtPmZzX3R5cGUgIT0gZW50cnkuZnNfdHlwZSkgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKworICAgICAgICBGc3RhYkVudHJ5IG5ld19lbnRyeSA9IGVudHJ5OworICAgICAgICBpZiAoIWZzX21ncl9vdmVybGF5ZnNfYWxyZWFkeV9tb3VudGVkKGVudHJ5Lm1vdW50X3BvaW50KSAmJgorICAgICAgICAgICAgIWZzX21ncl93YW50c19vdmVybGF5ZnMoJm5ld19lbnRyeSkpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGNvbnN0IGF1dG8gbmV3X21vdW50X3BvaW50ID0gZnNfbWdyX21vdW50X3BvaW50KG5ld19lbnRyeS5tb3VudF9wb2ludCk7CisgICAgICAgIGlmIChzdGQ6OmZpbmRfaWYoY2FuZGlkYXRlcy5iZWdpbigpLCBjYW5kaWRhdGVzLmVuZCgpLCBbJl0oY29uc3QgYXV0byYgaXQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZnNfbWdyX21vdW50X3BvaW50KGl0Lm1vdW50X3BvaW50KSA9PSBuZXdfbW91bnRfcG9pbnQ7CisgICAgICAgICAgICB9KSAhPSBjYW5kaWRhdGVzLmVuZCgpKSB7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBjYW5kaWRhdGVzLnB1c2hfYmFjayhzdGQ6Om1vdmUobmV3X2VudHJ5KSk7CisgICAgfQorICAgIHJldHVybiBjYW5kaWRhdGVzOworfQorCitzdGF0aWMgdm9pZCBUcnlNb3VudFNjcmF0Y2goKSB7CisgICAgLy8gTm90ZSB3ZSBnZXQgdGhlIGJvb3Qgc2NyYXRjaCBkZXZpY2UgaGVyZSwgd2hpY2ggbWVhbnMgaWYgc2NyYXRjaCB3YXMKKyAgICAvLyBqdXN0IGNyZWF0ZWQgdGhyb3VnaCBJbWFnZU1hbmFnZXIsIHRoaXMgY291bGQgZmFpbC4gSW4gcHJhY3RpY2UgdGhpcworICAgIC8vIHNob3VsZCBub3QgaGFwcGVuIGJlY2F1c2UgInJlbW91bnQiIGRldGVjdHMgdGhpcyBzY2VuYXJpbyAoYnkgY2hlY2tpbmcKKyAgICAvLyBpZiB2ZXJpdHkgaXMgc3RpbGwgZGlzYWJsZWQsIGkuZS4gbm8gcmVib290IG9jY3VycmVkKSwgYW5kIHNraXBzIGNhbGxpbmcKKyAgICAvLyBmc19tZ3Jfb3ZlcmxheWZzX21vdW50X2FsbCgpLgorICAgIGF1dG8gc2NyYXRjaF9kZXZpY2UgPSBHZXRCb290U2NyYXRjaERldmljZSgpOworICAgIGlmIChhY2Nlc3Moc2NyYXRjaF9kZXZpY2UuY19zdHIoKSwgUl9PSyB8IFdfT0spKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgaWYgKCFXYWl0Rm9yRmlsZShzY3JhdGNoX2RldmljZSwgMTBzKSkgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGlmICghTW91bnRTY3JhdGNoKHNjcmF0Y2hfZGV2aWNlLCB0cnVlIC8qIHJlYWRvbmx5ICovKSkgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGNvbnN0IGF1dG8gdG9wID0ga1NjcmF0Y2hNb3VudFBvaW50ICsgIi8icyArIGtPdmVybGF5VG9wRGlyOworICAgIGNvbnN0IGJvb2wgaGFzX292ZXJsYXlmc19kaXIgPSBhY2Nlc3ModG9wLmNfc3RyKCksIEZfT0spID09IDA7CisgICAgZnNfbWdyX292ZXJsYXlmc191bW91bnRfc2NyYXRjaCgpOworICAgIGlmIChoYXNfb3ZlcmxheWZzX2RpcikgeworICAgICAgICBNb3VudFNjcmF0Y2goc2NyYXRjaF9kZXZpY2UpOworICAgIH0KK30KKworYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX21vdW50X2FsbChGc3RhYiogZ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ZW1wRGlyLCBmYWxzZSk7CisgICAgYW5kcm9pZDo6YmFzZTo6U2NvcGVHdWFyZCB1bW91bnREaXIoW10oKSB7CisgICAgICAgIHVtb3VudChrTW92ZU1vdW50VGVtcERpcik7CisgICAgICAgIHJtZGlyKGtNb3ZlTW91bnRUZW1wRGlyKTsKKyAgICB9KTsKKworICAgIGF1dG8gcmV0ID0gdHJ1ZTsKKyAgICBhdXRvIHNjcmF0Y2hfY2FuX2JlX21vdW50ZWQgPSAhZnNfbWdyX292ZXJsYXlmc19hbHJlYWR5X21vdW50ZWQoa1NjcmF0Y2hNb3VudFBvaW50LCBmYWxzZSk7CisgICAgZm9yIChjb25zdCBhdXRvJiBlbnRyeSA6IGZzX21ncl9vdmVybGF5ZnNfY2FuZGlkYXRlX2xpc3QoKmZzdGFiKSkgeworICAgICAgICBpZiAoZnNfbWdyX2lzX3Zlcml0eV9lbmFibGVkKGVudHJ5KSkgY29udGludWU7CisgICAgICAgIGF1dG8gbW91bnRfcG9pbnQgPSBmc19tZ3JfbW91bnRfcG9pbnQoZW50cnkubW91bnRfcG9pbnQpOworICAgICAgICBpZiAoZnNfbWdyX292ZXJsYXlmc19hbHJlYWR5X21vdW50ZWQobW91bnRfcG9pbnQpKSB7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoc2NyYXRjaF9jYW5fYmVfbW91bnRlZCkgeworICAgICAgICAgICAgc2NyYXRjaF9jYW5fYmVfbW91bnRlZCA9IGZhbHNlOworICAgICAgICAgICAgVHJ5TW91bnRTY3JhdGNoKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0ICY9IGZzX21ncl9vdmVybGF5ZnNfbW91bnRfb25lKGVudHJ5KTsKKyAgICB9CisgICAgcmV0dXJuIHJldDsKK30KKworYm9vbCBmc19tZ3Jfb3ZlcmxheWZzX2lzX3NldHVwKCkgeworICAgIGlmICghT3ZlcmxheWZzU2V0dXBBbGxvd2VkKCkpIHsKKyAgICAgICAgc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AgICBpZiAoZW50cnktPmZzX3R5cGUgIT0gIm92ZXJsYXkiICYmIGVudHJ5LT5mc190eXBlICE9ICJvdmVybGF5ZnMiKSB7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBjb25zdCBhdXRvIG9wdGlvbnMgPSBhbmRyb2lkOjpiYXNlOjpTcGxpdChlbnRyeS0+ZnNfb3B0aW9ucywgIiwiKTsKKyAgICAgICAgZm9yIChjb25zdCBhdXRvJiBvcHQgOiBvcHRpb25zKSB7CisgICAgICAgICAgICBpZiAob3B0ID09IGxvd2VyZGlyKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIGZhbHNlOworfQorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgZnNfbWdyIHsKKwordm9pZCBNb3VudE92ZXJsYXlmcyhjb25zdCBGc3RhYkVudHJ5JiBmc3RhYl9lbnRyeSwgYm9vbCogc2NyYXRjaF9jYW5fYmVfbW91bnRlZCkgeworICAgIGlmICghT3ZlcmxheWZzU2V0dXBBbGxvd2VkKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBjb25zdCBhdXRvIGNhbmRpZGF0ZXMgPSBmc19tZ3Jfb3ZlcmxheWZzX2NhbmRpZGF0ZV9saXN0KHtmc3RhYl9lbnRyeX0pOworICAgIGlmIChjYW5kaWRhdGVzLmVtcHR5KCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBjb25zdCBhdXRvJiBlbnRyeSA9IGNhbmRpZGF0ZXMuZnJvbnQoKTsKKyAgICBpZiAoZnNfbWdyX2lzX3Zlcml0eV9lbmFibGVkKGVudHJ5KSkgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGNvbnN0IGF1dG8gbW91bnRfcG9pbnQgPSBmc19tZ3JfbW91bnRfcG9pbnQoZW50cnkubW91bnRfcG9pb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NvdWxkIG5vdCBkZXRlcm1pbmUgY2hlY2twb2ludGluZyBzdGF0dXMuIjsKLSAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIH0KLSAgICBpZiAoY2hlY2twb2ludGluZykgewotICAgICAgICBMT0coRVJST1IpIDw8ICJDYW5ub3QgdXNlIHJlbW91bnQgd2hlbiBhIGNoZWNrcG9pbnQgaXMgaW4gcHJvZ3Jlc3MuIjsKLSAgICAgICAgTE9HKEVSUk9SKSA8PCAiVG8gZm9yY2UgZW5kIGNoZWNrcG9pbnRpbmcsIGNhbGwgJ3ZkYyBjaGVja3BvaW50IGNvbW1pdENoYW5nZXMnIjsKLSAgICAgICAgTE9HKEVSUk9SKSA8PCAiV2FybmluZzogdGhpcyBjYW4gbGVhZCB0byBkYXRhIGNvcnJ1cHRpb24gaWYgcm9sbGVkIGJhY2suIjsKLSAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIGJvb2wgc2hvd19oZWxwID0gdHJ1ZTsKKworICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgIGlmICghdm9sZC0+aXNDaGVja3BvaW50aW5nKCZjaGVja3BvaW50aW5nKS5pc09rKCkpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvdWxkIG5vdCBkZXRlcm1pbmUgY2hlY2twb2ludGluZyBzdGF0dXMuIjsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWNoZWNrcG9pbnRpbmcpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGlmIChzaG93X2hlbHApIHsKKyAgICAgICAgICAgIHNob3dfaGVscCA9IGZhbHNlOworICAgICAgICAgICAgc3RkOjpjZXJyIDw8ICJXQVJOSU5HOiBVc2VyZGF0YSBjaGVja3BvaW50IGlzIGluIHByb2dyZXNzLiBUbyBmb3JjZSBlbmQgY2hlY2twb2ludGluZywgIgorICAgICAgICAgICAgICAgICAgICAgICAgICJjYWx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9SKSA8PCAiRmFpbGVkIHRvIGFsbG9jYXRlIHNwYWNlIGZvciBmaWxlOiAiIDw8IGZpbGVfcGF0aAorICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBzaXplOiAiIDw8IGZpbGVfc2l6ZTsKKyAgICAgICAgICAgIHJldHVybiBGaWVtYXBTdGF0dXM6OkZyb21FcnJubyhlcnJubyk7CisgICAgICAgIH0KKworICAgICAgICBzdHJ1Y3Qgc3RhdCBzOworICAgICAgICBpZiAoZnN0YXQoZmlsZV9mZCwgJnMpIDwgMCkgeworICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgIkZhaWxlZCB0byBmc3RhdCBhZnRlciBmYWxsb2NhdGUgZmFpbHVyZTogIiA8PCBmaWxlX3BhdGg7CisgICAgICAgICAgICByZXR1cm4gRmllbWFwU3RhdHVzOjpGcm9tRXJybm8oZXJybm8pOworICAgICAgICB9CisgICAgICAgIGlmICghcHJldl9zaXplKSB7CisgICAgICAgICAgICBwcmV2X3NpemUgPSB7cy5zdF9zaXplfTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmICgqcHJldl9zaXplID49IHMuc3Rfc2l6ZSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiRmFsbG9jYXRlIHJldHJ5IGZhaWxlZCwgZ290ICIgPDwgcy5zdF9zaXplIDw8ICIsIGFza2VkIGZvciAiCisgICAgICAgICAgICAgICAgICAgICAgIDw8IGZpbGVfc2l6ZTsKKyAgICAgICAgICAgIHJldHVybiBGaWVtYXBTdGF0dXMoRmllbWFwU3RhdHVzOjpFcnJvckNvZGU6Ok5PX1NQQUNFKTsKKyAgICAgICAgfQorICAgICAgICBMT0coSU5GTykgPDwgIlJldHJ5aW5nIGZhbGxvY2F0ZSwgZ290ICIgPDwgcy5zdF9zaXplIDw8ICIsIGFza2VkIGZvciAiIDw8IGZpbGVfc2l6ZTsKICAgICB9CiAKICAgICBpZiAobmVlZF9leHBsaWNpdF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fdXRpbF90ZXN0LmNwcAorKysgYi9mc19tZ3IvbGliZnNfYXZiL3Rlc3RzL2F2Yl91dGlsX3Rlc3QuY3BwCkBAIC02NTUsMTAgKzY1NSwxMiBAQAogICAgICAgICAgICAgIiAgICAgIFBhcnRpdGlvbiBOYW1lOiAgICAgICAgICBib290XG4iCiAgICAgICAgICAgICAiICAgICAgUm9sbGJhY2sgSW5kZXggTG9jYXRpb246IDFcbiIKICAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgY2RiYjc3MTc3ZjczMTkyMGJiZTBhMGY5NGY4NGQ5MDM4YWUwNjE3ZFxuIgorICAgICAgICAgICAgIiAgICAgIEZsYWdzOiAgICAgICAgICAgICAgICAgICAwXG4iCiAgICAgICAgICAgICAiICAgIENoYWluIFBhcnRpdGlvbiBkZXNjcmlwdG9yOlxuIgogICAgICAgICAgICAgIiAgICAgIFBhcnRpdGlvbiBOYW1lOiAgICAgICAgICBzeXN0ZW1cbiIKICAgICAgICAgICAgICIgICAgICBSb2xsYmFjayBJbmRleCBMb2NhdGlvbjogMlxuIgotICAgICAgICAgICAgIiAgICAgIFB1YmxpYyBrZXkgKHNoYTEpOiAgICAgICAyNTk3YzIxOGFhZTQ3MGExMzBmNjExNjJmZWFhZTcwYWZkOTdmMDExXG4iLAorICAgICAgICAgICAgIiAgICAgIFB1YmxpYyBrZXkgKHNoYTEpOiAgICAgICAyNTk3YzIxOGFhZTQ3MGExMzBmNjExNjJmZWFhZTcwYWZkOTdmMDExXG4iCisgICAgICAgICAgICAiICAgICAgRmxhZ3M6ICAgICAgICAgICAgICAgICAgIDBcbiIsCiAgICAgICAgICAgICBJbmZvSW1hZ2UoInZibWV0YS5pbWciKSk7CiAKICAgICBhbmRyb2lkOjpiYXNlOjp1bmlxdWVfZmQgZmQob3Blbih2Ym1ldGFfcGF0aC52YWx1ZSgpLmNfc3RyKCksIE9fUkRPTkxZIHwgT19DTE9FWEVDKSk7CkBAIC04NzYsMTAgKzg3OCwxMiBAQAogICAgICAgICAgICAgIiAgICAgIFBhcnRpdGlvbiBOYW1lOiAgICAgICAgICBib290XG4iCiAgICAgICAgICAgICAiICAgICAgUm9sbGJhY2sgSW5kZXggTG9jYXRpb246IDFcbiIKICAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgY2RiYjc3MTc3ZjczMTkyMGJiZTBhMGY5NGY4NGQ5MDM4YWUwNjE3ZFxuIgorICAgICAgICAgICAgIiAgICAgIEZsYWdzOiAgICAgICAgICAgICAgICAgICAwXG4iCiAgICAgICAgICAgICAiICAgIENoYWluIFBhcnRpdGlvbiBkZXNjcmlwdG9yOlxuIgogICAgICAgICAgICAgIiAgICAgIFBhcnRpdGlvbiBOYW1lOiAgICAgICAgICB2Ym1ldGFfc3lzdGVtXG4iCiAgICAgICAgICAgICAiICAgICAgUm9sbGJhY2sgSW5kZXggTG9jYXRpb246IDJcbiIKLSAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgMjU5N2MyMThhYWU0NzBhMTMwZjYxMTYyZmVhYWU3MGFmZDk3ZjAxMVxuIiwKKyAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgMjU5N2MyMThhYWU0NzBhMTMwZjYxMTYyZmVhYWU3MGFmZDk3ZjAxMVxuIgorICAgICAgICAgICAgIiAgICAgIEZsYWdzOiAgICAgICAgICAgICAgICAgICAwXG4iLAogICAgICAgICAgICAgSW5mb0ltYWdlKCJ2Ym1ldGEuaW1nIikpOwogCiAgICAgYm9vbCBmYXRhbF9lcnJvciA9IGZhbHNlOwpAQCAtOTA5LDcgKzkxMyw4IEBACiAgICAgICAgICAgICAiICAgIENoYWluIFBhcnRpdGlvbiBkZXNjcmlwdG9yOlxuIgogICAgICAgICAgICAgIiAgICAgIFBhcnRpdGlvbiBOYW1lOiAgICAgICAgICBzeXN0ZW1cbiIKICAgICAgICAgICAgICIgICAgICBSb2xsYmFjayBJ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AgICAgICIgICAgICBGbGFnczogICAgICAgICAgICAgICAgICAgMFxuIgogICAgICAgICAgICAgIiAgICBDaGFpbiBQYXJ0aXRpb24gZGVzY3JpcHRvcjpcbiIKICAgICAgICAgICAgICIgICAgICBQYXJ0aXRpb24gTmFtZTogICAgICAgICAgc3lzdGVtXG4iCiAgICAgICAgICAgICAiICAgICAgUm9sbGJhY2sgSW5kZXggTG9jYXRpb246IDJcbiIKLSAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgMjU5N2MyMThhYWU0NzBhMTMwZjYxMTYyZmVhYWU3MGFmZDk3ZjAxMVxuIiwKKyAgICAgICAgICAgICIgICAgICBQdWJsaWMga2V5IChzaGExKTogICAgICAgMjU5N2MyMThhYWU0NzBhMTMwZjYxMTYyZmVhYWU3MGFmZDk3ZjAxMVxuIgorICAgICAgICAgICAgIiAgICAgIEZsYWdzOiAgICAgICAgICAgICAgICAgICAwXG4iLAogICAgICAgICAgICAgSW5mb0ltYWdlKCJ2Ym1ldGEuaW1nIikpOwogfQogCmRpZmYgLS1naXQgYS9mc19tZ3IvbGliZnN0YWIvQW5kcm9pZC5icCBiL2ZzX21nci9saWJmc3RhYi9BbmRyb2lkLmJwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmRmMDI2OWMKLS0tIC9kZXYvbnVsbAorKysgYi9mc19tZ3IvbGliZnN0YWIvQW5kcm9pZC5icApAQCAtMCwwICsxLDYyIEBACisvLworLy8gQ29weXJpZ2h0IChDKSAyMDIzIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKy8vCisvLyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKKy8vIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS4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tfYXZhaWxhYmxlOiB0cnVlLAorICAgIHJlY292ZXJ5X2F2YWlsYWJsZTogdHJ1ZSwKKyAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKKyAgICBkZWZhdWx0czogWyJmc19tZ3JfZGVmYXVsdHMiXSwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYmFzZV9oZWFkZXJzIiwKKyAgICAgICAgImxpYmdzaV9oZWFkZXJzIiwKKyAgICBdLAorICAgIHNyY3M6IFsKKyAgICAgICAgImZzdGFiLmNwcCIsCisgICAgICAgICJib290X2NvbmZpZy5jcHAiLAorICAgICAgICAic2xvdHNlbGVjdC5jcHAiLAorICAgIF0sCisgICAgdGFyZ2V0OiB7CisgICAgICAgIGRhcndpbjogeworICAgICAgICAgICAgZW5hYmxlZDogZmFsc2UsCisgICAgICAgIH0sCisgICAgICAgIHZlbmRvcjogeworICAgICAgICAgICAgY2ZsYWdzOiBbCisgICAgICAgICAgICAgICAgLy8gU2tpcHBpbmcgZW50cmllcyBpbiBmc3RhYiBzaG91bGQgb25seSBiZSBkb25lIGluIGEgc3lzdGVtCisgICAgICAgICAgICAgICAgLy8gcHJvY2VzcyBhcyB0aGUgY29uZmlnIGZpbGUgaXMgaW4gL3N5c3RlbV9leHQuCisgICAgICAgICAgICAgICAgLy8gUmVtb3ZlIHRoZSBvcCBmcm9tIHRoZSB2ZW5kb3IgdmFyaWFudC4KKyAgICAgICAgICAgICAgICAiLUROT19TS0lQX01PVU5UIiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgfSwKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTphbnlhcGV4IiwKKyAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgIF0sCisgICAgbWluX3Nka192ZXJzaW9uOiAiMzEiLAorfQpkaW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nB1c2hfYmFjaygnLycpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gRmFsbCBiYWNrIHRvIHRoZSBzdGFuZGFyZCBwcm9jZnMtYmFzZWQgcGF0aAorICAgICAgICAgICAgYW5kcm9pZF9kdF9kaXIgPSAiL3Byb2MvZGV2aWNlLXRyZWUvZmlybXdhcmUvYW5kcm9pZC8iOworICAgICAgICB9CisgICAgICAgIExJTkZPIDw8ICJVc2luZyBBbmRyb2lkIERUIGRpcmVjdG9yeSAiIDw8IGFuZHJvaWRfZHRfZGlyOworICAgICAgICByZXR1cm4gYW5kcm9pZF9kdF9kaXI7CisgICAgfSgpOworICAgIHJldHVybiBrQW5kcm9pZER0RGlyOworfQorCit2b2lkIEltcG9ydEJvb3Rjb25maWdGcm9tU3RyaW5nKGNvbnN0IHN0ZDo6c3RyaW5nJiBib290Y29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OmZ1bmN0aW9uPHZvaWQoc3RkOjpzdHJpbmcsIHN0ZDo6c3RyaW5nKT4mIGZuKSB7CisgICAgZm9yIChzdGQ6OnN0cmluZ192aWV3IGxpbmUgOiBhbmRyb2lkOjpiYXNlOjpTcGxpdChib290Y29uZmlnLCAiXG4iKSkgeworICAgICAgICBjb25zdCBhdXRvIGVxdWFsX3BvcyA9IGxpbmUuZmluZCgnPScpOworICAgICAgICBzdGQ6OnN0cmluZyBrZXkgPSBhbmRyb2lkOjpiYXNlOjpUcmltKGxpbmUuc3Vic3RyKDAsIGVxdWFsX3BvcykpOworICAgICAgICBpZiAoa2V5LmVtcHR5KCkpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIHZhbHVlOworICAgICAgICBpZiAoZXF1YWxfcG9zICE9IGxpbmUubnBvcykgeworICAgICAgICAgICAgdmFsdWUgPSBhbmRyb2lkOjpiYXNlOjpUcmltKGxpb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cgY29kZSwgd2UgbW9kaWZ5IHRoZSB2YWx1ZSB0bworICAgICAgICAgICAgICAgIC8vIGtlZXAgdGhlIGZvcm1hdCBjb25zaXN0ZW50IHdpdGggdGhlIGtlcm5lbCBjbWRsaW5lIGJ5IHJlbW92aW5nIHF1b3RlIGFuZCBzcGFjZS4KKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZ192aWV3IHN2KHZhbHVlKTsKKyAgICAgICAgICAgICAgICBhbmRyb2lkOjpiYXNlOjpDb25zdW1lUHJlZml4KCZzdiwgIlwiIik7CisgICAgICAgICAgICAgICAgYW5kcm9pZDo6YmFzZTo6Q29uc3VtZVN1ZmZpeCgmc3YsICJcIiIpOworICAgICAgICAgICAgICAgIHZhbHVlID0gYW5kcm9pZDo6YmFzZTo6U3RyaW5nUmVwbGFjZShzdiwgUiIoIiwgIikiLCAiLCIsIHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vICJrZXkiIGFuZCAia2V5ID0iIG1lYW5zIGVtcHR5IHZhbHVlLgorICAgICAgICBmbihzdGQ6Om1vdmUoa2V5KSwgc3RkOjptb3ZlKHZhbHVlKSk7CisgICAgfQorfQorCitib29sIEdldEJvb3Rjb25maWdGcm9tU3RyaW5nKGNvbnN0IHN0ZDo6c3RyaW5nJiBib290Y29uZmlnLCBjb25zdCBzdGQ6OnN0cmluZyYga2V5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyogb3V0KSB7CisgICAgYm9vbCBmb3VuZCA9IGZhbHNlOworICAgIEltcG9ydEJvb3Rjb25maWdGcm9tU3RyaW5nKGJvb3Rjb25maWcsIFsmXShzdGQ6OnN0cmluZyBjb25maWdfa2V5LCBzdGQ6OnN0cmluZyB2YWx1ZSkgeworICAgICAgICBpZiAoIWZvdW5kICYmIGNvbmZpZ19rZXkgPT0ga2V5KSB7CisgICAgICAgICAgICAqb3V0ID0gc3RkOjptb3ZlKHZhbHVlKTsKKyAgICA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gICAgbmFtZTogImxpYmxwX2Z1enpfZGVmYXVsdHMiLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJzdG9yYWdlX2xpdGVyYWxzX2hlYWRlcnMiLAorICAgIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmxwIiwKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGlibG9nIiwKKyAgICBdLAorICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJjdXRpbHMiLAorICAgIF0sCisgICAgaW5jbHVkZV9kaXJzOiBbCisgICAgICAgICJzeXN0ZW0vY29yZS9mc19tZ3IvbGlibHAiLAorICAgIF0sCisgICAgZnV6el9jb25maWc6IHsKKyAgICAgICAgY2M6IFsKKyAgICAgICAgICAgICJhbmRyb2lkLW1lZGlhLWZ1enppbmctcmVwb3J0c0Bnb29nbGUuY29tIiwKKyAgICAgICAgXSwKKyAgICAgICAgY29tcG9uZW50aWQ6IDU5MTQ4LAorICAgICAgICBob3RsaXN0czogWyI0NTkzMzExIl0sCisgICAgICAgIGRlc2NyaXB0aW9uOiAiVGhlIGZ1enplcnMgdGFyZ2V0IHRoZSBBUElzIG9mIGFsbCBsaWJscCBtb2R1bGVzIiwKKyAgICAgICAgdmVjdG9yOiAibG9jYWxfbm9fcHJpdmlsZWdlc19yZXF1aXJlZCIsCisgICAgICAgIHNlcnZpY2VfcHJpdmlsZWdlOiAicHJpdmlsZWdlZCIsCisgICAgICAgIHVzZXJzOiAibXVsdGlfdXNlciIsCisgICAgICAgIGZ1enplZF9jb2RlX3VzYWdlOiAic2hpcHBlZCIKKyAgICB9Cit9CisKK2NjX2Z1enogeworICAgIG5hbWU6ICJsaWJscF9idWlsZGVyX2Z1enplciIsCisgICAgc3JjczogWyJsaWJscF9idWlsZGVyX2Z1enplci5jcHAiXSwKKyAgICBkZWZhdWx0czogWyJsaWJscF9mdXp6X2RlZmF1bHRzIl0sCit9CisKK2NjX2Z1enogeworICAgIG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tZGlza19wbGF0Zm9ybSIsCisgICAgICAgICI6dGVzdF9ib290Y29uZmlnIiwKKyAgICBdLAorICAgIGNtZDogIiQobG9jYXRpb24gbWtib290aW1nKSAtLWhlYWRlcl92ZXJzaW9uIDQgIiArCisgICAgICAgICItLWR0YiAkKGxvY2F0aW9uIDp0ZXN0X2R0YikgIiArCisgICAgICAgICItLXZlbmRvcl9ib290Y29uZmlnICQobG9jYXRpb24gOnRlc3RfYm9vdGNvbmZpZykgIiArCisgICAgICAgICItLXJhbWRpc2tfdHlwZSBub25lIC0tcmFtZGlza19uYW1lIG5vbmVfcmFtZGlzayAiICsKKyAgICAgICAgIi0tdmVuZG9yX3JhbWRpc2tfZnJhZ21lbnQgJChsb2NhdGlvbiA6dGVzdF92ZW5kb3JfcmFtZGlza19ub25lKSAiICsKKyAgICAgICAgIi0tcmFtZGlza190eXBlIHBsYXRmb3JtIC0tcmFtZGlza19uYW1lIHBsYXRmb3JtX3JhbWRpc2sgIiArCisgICAgICAgICItLXZlbmRvcl9yYW1kaXNrX2ZyYWdtZW50ICQobG9jYXRpb24gOnRlc3RfdmVuZG9yX3JhbWRpc2tfcGxhdGZvcm0pICIgKworICAgICAgICAiLS12ZW5kb3JfYm9vdCAkKG91dCkgJiYgIiArCisgICAgICAgIGZhc3Rib290X3NpZ25fdGVzdF9pbWFnZSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImxpYmxwX2FwaXNfZnV6emVyIiwKKyAgICBzcmNzOiBbCisgICAgICAgICJsaWJscF9hcGlzX2Z1enplci5jcHAiLAorICAgICAgICAiOlRlc3RQYXJ0aXRpb25PcGVuZXJfZ3JvdXAiLAorICAgIF0sCisgICAgZGVmYXVsdHM6IFsibGlibHBfZnV6el9kZWZhdWx0cyJdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJzcGFyc2UiLAorICAgIF0sCisgICAgZGF0YTogWworICAgICAgICAiOnRlc3RfZHRiIiwKKyAgICAgICAgIjp0ZXN0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CisKKyAgICBpZiAobUJ1aWxkZXIuZ2V0KCkpIHsKKyAgICAgICAgbUJ1aWxkZXItPkFkZFBhcnRpdGlvbihrU3lzdGVtUGFydGl0aW9uTmFtZSwgTFBfUEFSVElUSU9OX0FUVFJfUkVBRE9OTFkpOworCisgICAgICAgIG1QYXJ0aXRpb25OYW1lID0KKyAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyBtRmRwLkNvbnN1bWVSYW5kb21MZW5ndGhTdHJpbmcoa01heEJ5dGVzKSA6IGtQYXJ0aXRpb25OYW1lOworICAgICAgICBpZiAoIW1QYXJ0aXRpb25OYW1lLnNpemUoKSkgeworICAgICAgICAgICAgbVBhcnRpdGlvbk5hbWUgPSBrUGFydGl0aW9uTmFtZTsKKyAgICAgICAgfQorICAgICAgICBtU3VwZXJQYXJ0aXRpb25OYW1lID0gbUZkcC5Db25zdW1lQm9vbCgpID8gbUZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKGtNYXhCeXRlcykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGtTdXBlclBhcnRpdGlvbk5hbWU7CisgICAgICAgIGlmICghbVN1cGVyUGFydGl0aW9uTmFtZS5zaXplKCkpIHsKKyAgICAgICAgICAgIG1TdXBlclBhcnRpdGlvbk5hbWUgPSBrU3VwZXJQYXJ0aXRpb25OYW1lOworICAgICAgICB9CisKKyAgICAgICAgUGFydGl0aW9uKiBzdXBlciA9IG1CdWlsZGVyLT5BZGRQYXJ0aXRpb24obVN1cGVyUGFydGl0aW9uTmFtZSwgTFBfUEFSVElUSU9OX0FUVFJfUkVBRE9OTFkpOworICAgICAgICBtQnVpbGRlci0+QWRkUGFydGl0aW9uKG1QYXJ0aXRpb25OYW1lLCBMUF9QQVJUSVRJT05fQVRUUl9SRUFET05MWSk7CisKKyAgICAgICAgaWYgKHN1cGVyKSB7CisgICAgICAgICAgICBpbnQ2NF90IG51bVNlY3RvcnMgPSBtRmRwLkNvbnN1bWVCb29sKCkgPyBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDY0X3Q+KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrTWluU2VjdG9yVmFsdWUsIGtNYXhTZWN0b3JWYWx1ZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGtWYWxpZE51bVNlY3RvcnM7CisgICAgICAgICAgICBpbnQ2NF90IHBoeXNpY2FsU2VjdG9yID0gbUZkcC5Db25zdW1lQm9vbCgpID8gbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ2NF90PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtNaW5TZWN0b3JWYWx1ZSwga01heFNlY3RvclZhbHVlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGtWYWxpZFBoeXNpY2FsU2VjdG9yOworICAgICAgICAgICAgbUJ1aWxkZXItPkFkZExpbmVhckV4dGVudChzdXBlciwgbUJsb2NrRGV2aWNlSW5mb05hbWUsIG51bVNlY3RvcnMsIHBoeXNpY2FsU2VjdG9yKTsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBMaXBscEFwaXNGdXp6ZXI6OnByb2Nlc3MoKSB7CisgICAgQmxvY2tEZXZpY2VJbmZvIHN1cGVySW5mbyA9IGdldEJsb2NrRGV2aWNlKCk7CisgICAgdW5pcXVlX2ZkIGZkKHN5c2NhbGwoX19OUl9tZW1mZF9jcmVhdGUsICJpbWFnZV9maWxlIiwgTUZEX0FMTE9XX1NFQUxJTkcpKTsKKyAgICBzZXR1cEJ1aWxkZXIoKTsKKworICAgIFRlc3RQYXJ0aXRpb25PcGVuZXIgb3BlbmVyKAorICAgICAgIC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CkgeyBGbGFzaFBhcnRpdGlvblRhYmxlKG9wZW5lciwga1N1cGVyTmFtZSwgbWV0YWRhdGFWYWx1ZSk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFVwZGF0ZVBhcnRpdGlvblRhYmxlKG9wZW5lciwgbVBhcnRpdGlvbk5hbWUsIG1ldGFkYXRhVmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyAwIDogMSAvKiBzbG90X251bWJlciAqLyk7CisgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFJlYWRNZXRhZGF0YShtUGFydGl0aW9uTmFtZSwgbUZkcC5Db25zdW1lQm9vbCgpID8gMCA6IDEgLyogc2xvdF9udW1iZXIgKi8pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IEZsYXNoUGFydGl0aW9uVGFibGUobVBhcnRpdGlvbk5hbWUsIG1ldGFkYXRhVmFsdWUpOyB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBVcGRhdGVQYXJ0aXRpb25UYWJsZShtUGFydGl0aW9uTmFtZSwgbWV0YWRhdGFWYWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IDAgOiAxIC8qIHNsb3RfbnVtYmVyICovKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGVUb0ltYWdlRmlsZShrSW1hZ2VGaWxlLmNfc3RyKCksIG1ldGFkYXRhVmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFkYXRhLT5nZW9tZXRyeS5sb2dpY2FsX2Jsb2NrX3NpemUsIGltYWdlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lQm9vbCgpID8gdHJ1ZSA6IGZhbHNlIC8qIHNwYXJzaWZ5ICovKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKworICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBXcml0ZVNwbGl0SW1hZ2VGaWxlcyhrSW1hZ2VGaWxlLmNfc3RyKCksIG1ldGFkYXRhVmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhZGF0YS0+Z2VvbWV0cnkubG9naWNhbF9ibG9ja19zaXplLCBpbWFnZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyB0cnVlIDogZmFsc2UgLyogc3BhcnNpZnkgKi8pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IFJlYWRGcm9tSW1hZ2VGaWxlKGtJbWFnZUZpbGUuY19zdHIoKSk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgSXNFbXB0eVN1cGVySW1hZ2Uoa0ltYWdlRmlsZS5jX3N0cigpKTsgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QgYnVmZmVyU2l6ZSA9IG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50NjRfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgKiBrTWV0YWRhdGFHZW9tZXRyeVNpemUsIGtNYXhCdWZmZXJTaXplKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZlY3Rvcjx1aW50OF90PiBidWZmZXIgPSBtRmRwLkNvbnN1bWVCeXRlczx1aW50OF90PihrTWF4Qnl0ZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyLnJlc2l6ZShidWZmZXJTaXplKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFJlYWRGcm9tSW1hZ2VCbG9iKGJ1ZmZlci5kYXRhKCksIGJ1ZmZlci5zaXplKCkpOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBncm91cFZlY3RvclNpemUgPSBtZXRhZGF0YS0+Z3JvdXBzLnNpemUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHJhbmRvbUdyb3VwSW5kZXggPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDMyX3Q+KDAsIGdyb3VwVmVjdG9yU2l6ZSAtIDEpOworICAgICAgICAgICAgICAgICAgICAgICAgR2V0UGFydGl0aW9uR3JvdXBOYW1lKG1ldGFkYXRhLT5ncm91cHNbcmFuZG9tR3JvdXBJbmRleF0pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBibG9ja0RldmljZVZlY3RvclNpemUgPSBtZXRhZGF0YS0+YmxvY2tfZGV2aWNlcy5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCByYW5kb21CbG9ja0RldmljZUluZGV4ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQzMl90PigwLCBibG9ja0RldmljZVZlY3RvclNpemUgLSAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEdldEJsb2NrRGV2aWNlUGFydGl0aW9uTmFtZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0YWRhdGEtPmJsb2NrX2RldmljZXNbcmFuZG9tQmxvY2tEZXZpY2VJbmRleF0pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IEdldE1ldGFkYXRhU3VwZXJCbG9ja0RldmljZShtZXRhZGF0YVZhbHVlKTsgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHN1ZmZpeCA9IG1GZHAuQ29uc3VtZUJvb2woKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBtRmRwLlBpY2tWYWx1ZUluQXJyYXk8c3RyaW5nPihrU3VmZml4KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBtRmRwLkNvbnN1bWVSYW5kb21MZW5ndGhTdHJpbmcoa01heEJ5dGVzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFNsb3ROdW1iZXJGb3JTbG90U3VmZml4KHN1ZmZpeCk7CisgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGF1dG8gZW50cnkgPSBGaW5kUGFydGl0aW9uKG1ldGFkYXRhVmFsdWUsIGtTeXN0ZW1QYXJ0aXRpb25OYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEdldFBhcnRpdGlvblNpemUobWV0YWRhdGFWYWx1ZSwgKmVudHJ5KTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBHZXRQYXJ0aXRpb25TbG90U3VmZml4KG1QYXJ0aXRpb25OYW1lKTsgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBGaW5kUGFydGl0aW9uKG1ldGFkYXRhVmFsdWUsIG1QYXJ0aXRpb25OYW1lKTsgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgcGFydGl0aW9uVmVjdG9yU2l6ZSA9IG1ldGFkYXRhLT5wYXJ0aXRpb25zLnNpemUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IHJhbmRvbVBhcnRpdGlvbkluZGV4ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQzMl90PigwLCBwYXJ0aXRpb25WZWN0b3JTaXplIC0gMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBHZXRQYXJ0aXRpb25OYW1lKG1ldGFkYXRhLT5wYXJ0aXRpb25zW3JhbmRvbVBhcnRpdGlvbkluZGV4XSk7CisgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgR2V0VG90YWxTdXBlclBhcnRpdGlvblNpemUobWV0YWRhdGFWYWx1ZSk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgR2V0QmxvY2tEZXZpY2VQYXJ0aXRpb25OYW1lcyhtZXRhZGF0YVZhbHVlKTsgfSwKKyAgICAgICAgICAgIH0pOworICAgICAgICAgICAgaW52b2tlQVBJcygpOworICAgICAgICB9CisgICAgICAgIHJlbW92ZShrSW1hZ2VGaWxlLmNfc3RyKCkpOworICAgIH0KK30KKworZXh0ZXJuICJDIiBpbnQgTExWTUZ1enplclRlc3RPbmVJbnB1dChjb25zdCB1aW50OF90KiBkYXRhLCBzaXplX3Qgc2l6ZSkgeworICAgIExpcGxwQXBpc0Z1enplciBsaXBscEFwaXNGdXp6ZXIoZGF0YSwgc2l6ZSk7CisgICAgbGlwbHBBcGlzRnV6emVyLnByb2Nlc3MoKTsKKyAgICByZXR1cm4gMDsKK30KZGlmZiAtLWdpdCBhL2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ICAgICAgICByZXR1cm4gcGFyYW1ldGVyOworICAgIH0KK307CisKK3ZvaWQgQnVpbGRlckZ1enplcjo6c2VsZWN0UmFuZG9tQnVpbGRlcihpbnQzMl90IHJhbmRvbUJ1aWxkZXIsIHN0cmluZyBzdXBlckJsb2NrRGV2aWNlTmFtZSkgeworICAgIHN3aXRjaCAocmFuZG9tQnVpbGRlcikgeworICAgICAgICBjYXNlIDA6IHsKKyAgICAgICAgICAgIHVpbnQzMl90IG1heE1ldGFkYXRhU2l6ZSA9IGdldFBhcmFtVmFsdWUoa1ZhbGlkTWF4TWV0YWRhdGFTaXplKTsKKyAgICAgICAgICAgIHVpbnQzMl90IG51bVNsb3RzID0gbUZkcC5Db25zdW1lQm9vbCgpID8gMCA6IDE7CisgICAgICAgICAgICBtQnVpbGRlciA9IE1ldGFkYXRhQnVpbGRlcjo6TmV3KG1CbG9ja0RldmljZXMsIHN1cGVyQmxvY2tEZXZpY2VOYW1lLCBtYXhNZXRhZGF0YVNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bVNsb3RzKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgMTogeworICAgICAgICAgICAgdWludDY0X3QgYmxvY2tEZXZTaXplID0KKyAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ2NF90PihrTWluQmxvY2tEZXZWYWx1ZSwga01heEJsb2NrRGV2VmFsdWUpOworICAgICAgICAgICAgdWludDMyX3QgbWV0YWRhdGFNYXhTaXplID0KKyAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQzMl90PihrTWluTWV0YWRhdGFWYWx1ZSwga01heE1ldGFkYXRhVmFsdWUpOworICAgICAgICAgICAgdWludDMyX3QgbWV0YWRhdGFTbG90Q291bnQgPSBtRmRwLkNvbnN1bWVCb29sKCkgPyAwIDogMTsKKyAgICAgICAgICAgIG1CdWlsZGVyID0gTWV0YWRhdGFCdWlsZGVyOjpOZXcoYmxvY2tEZXZTaXplLCBtZXRhZGF0YU1heFNpemUsIG1ldGFkYXRhU2xvdENvdW50KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgMjogeworICAgICAgICAgICAgdWludDY0X3QgYmxvY2tEZXZTaXplID0gZ2V0UGFyYW1WYWx1ZShrVmFsaWRCbG9ja1NpemUpOworICAgICAgICAgICAgdWludDMyX3QgbWV0YWRhdGFTaXplID0gZ2V0UGFyYW1WYWx1ZShrVmFsaWRNZXRhZGF0YVNpemUpOworICAgICAgICAgICAgdWludDMyX3QgbWV0YWRhdGFTbG90Q291bnQgPSBtRmRwLkNvbnN1bWVCb29sKCkgPyAwIDogMTsKKyAgICAgICAgICAgIG1CdWlsZGVyID0gTWV0YWRhdGFCdWlsZGVyOjpOZXcoYmxvY2tEZXZTaXplLCBtZXRhZGF0YVNpemUsIG1ldGFkYXRhU2xvdENvdW50KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2UgMzogeworICAgICAgICAgICAgc3RyaW5nIHN1cGVyUGFydGl0aW9uTmFtZSA9IG1GZHAuQ29uc3VtZUJvb2woKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBrU3VwZXJQYXJ0aXRpb25OYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1GZHAuQ29uc3VtZVJhbmRvbUxlbmd0aFN0cmluZyhrTWF4Qnl0ZXMpOworICAgICAgICAgICAgbUJ1aWxkZXIgPSBNZXRhZGF0YUJ1aWxkZXI6Ok5ldyhQYXJ0aXRpb25PcGVuZXIoKSwgc3VwZXJQYXJ0aXRpb25OYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2UoMCwgMSkgLyogc2xvdF9udW1iZXIgKi8pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSA0OiB7CisgICAgICAgICAgICBzdHJpbmcgc3VwZXJQYXJ0aXRpb25OYW1lID0gbUZkcC5Db25zdW1lQm9vbCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IGtTdXBlclBhcnRpdGlvbk5hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbUZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKGtNYXhCeXRlcyk7CisgICAgICAgICAgICBtQnVpbGRlciA9IE1ldGFkYXRhQnVpbGRlcjo6TmV3KAorICAgICAgICAgICAgICAgICAgICBzdXBlclBhcnRpdGlvbk5hbWUsCisgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50MzJfdD4oMCwgMSkgLyogc2xvdF9udW1iZXIgKi8pOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgQnVpbGRlckZ1enplcjo6c2V0dXBCdWlsZGVyKHN0cmluZyBzdXBlckJsb2NrRGV2aWNlTmFtZSkgeworICAgIHVpbnQ2NF90IGJsb2NrRGV2aWNlSW5mb1NpemUgPQorICAgICAgICAgICAgbUZkcC5Db25zdW1lQm9vbCgpID8gbUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDY0X3Q+KCkgOiBrVmFsaWRCbG9ja0RldmljZUluZm9TaXplOworICAgIHVpbnQzMl90IGFsaWdubWVudCA9IG1GZHAuQ29uc3VtZUJvb2woKSA/IG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQzMl90PigpIDoga1ZhbGlkQWxpZ25tZW50OworICAgIHVpbnQzMl90IGFsaWdubWVudE9mZnNldCA9CisgICAgICA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plUGFydGl0aW9uTmFtZS5zaXplKCkpIHsKKyAgICAgICAgbVJlc2l6ZVBhcnRpdGlvbk5hbWUgPSAicmVzaXplX3BhcnRpdGlvbiI7CisgICAgfQorICAgIG1SZXNpemVQYXJ0aXRpb24gPSBtQnVpbGRlci0+QWRkUGFydGl0aW9uKG1SZXNpemVQYXJ0aXRpb25OYW1lLCBrRGVmYXVsdEdyb3VwTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMUF9QQVJUSVRJT05fQVRUUl9SRUFET05MWSk7CisKKyAgICBzdHJpbmcgY2hhbmdlUGFydGl0aW9uRGV2aWNlSW5mb05hbWUgPQorICAgICAgICAgICAgbUZkcC5Db25zdW1lQm9vbCgpID8ga0RldmljZUluZm9OYW1lIDogbUZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKGtNYXhCeXRlcyk7CisgICAgQmxvY2tEZXZpY2VJbmZvIGNoYW5nZVBhcnRpdGlvbkRldmljZUluZm8oCisgICAgICAgICAgICBjaGFuZ2VQYXJ0aXRpb25EZXZpY2VJbmZvTmFtZSwKKyAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIDoga0Jsb2NrRGV2aWNlSW5mb1NpemUgLyogc2l6ZSAqLywKKyAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQzMl90PigpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBrWmVyb0FsaWdubWVudE9mZnNldCAvKiBhbGlnbm1lbnQgKi8sCisgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyBtRmRwLkNvbnN1bWVJbnRlZ3JhbDx1aW50MzJfdD4oKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDoga1plcm9BbGlnbm1lbnRPZmZzZXQgLyogYWx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R4KSB7CisgICAgICAgICAgICBzb3VyY2VCdWlsZGVyLT5BZGRQYXJ0aXRpb24obUZkcC5QaWNrVmFsdWVJbkFycmF5KG1QYXJ0aXRpb25OYW1lcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTFBfUEFSVElUSU9OX0FUVFJfUkVBRE9OTFkpOworICAgICAgICB9CisKKyAgICAgICAgaW50NjRfdCB0YXJnZXRHcm91cHMgPSBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8aW50NjRfdD4oa01pbkVsZW1lbnRzLCBrTWF4RWxlbWVudHMpOworICAgICAgICBmb3IgKGludDY0X3QgaWR4ID0gMDsgaWR4IDwgdGFyZ2V0R3JvdXBzOyArK2lkeCkgeworICAgICAgICAgICAgdGFyZ2V0QnVpbGRlci0+QWRkR3JvdXAoCisgICAgICAgICAgICAgICAgICAgIG1GZHAuUGlja1ZhbHVlSW5BcnJheShtR3JvdXBOYW1lcyksCisgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IGtWYWxpZE1heEdyb3VwU2l6ZSA6IG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpKTsKKyAgICAgICAgfQorCisgICAgICAgIGludDY0X3QgdGFyZ2V0UGFydGl0aW9ucyA9IG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQ2NF90PihrTWluRWxlbWVudHMsIGtNYXhFbGVtZW50cyk7CisgICAgICAgIGZvciAoaW50NjRfdCBpZHggPSAwOyBpZHggPCB0YXJnZXRQYXJ0aXRpb25zOyArK2lkeCkgeworICAgICAgICAgICAgdGFyZ2V0QnVpbGRlci0+QWRkUGFydGl0aW9uKG1GZHAuUGlja1ZhbHVlSW5BcnJheShtUGFydGl0aW9uTmFtZXMpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExQX1BBUlRJVElPTl9BVFRSX1JFQURPTkxZKTsKKyAgICAgICAg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x1ZUluQXJyYXk8Y29uc3QgZnVuY3Rpb248dm9pZCgpPj4oeworICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IGNhbGxDaGFuZ2VQYXJ0aXRpb25Hcm91cCgpOyB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgYWRkZWRHcm91cE5hbWUgPSBtRmRwLlBpY2tWYWx1ZUluQXJyYXkobUdyb3VwTmFtZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXItPkFkZEdyb3VwKGFkZGVkR3JvdXBOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50NjRfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrTWluVmFsdWUsIGtNYXhWYWx1ZSkgLyogbWF4X3NpemUgKi8pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgcGFydGl0aW9uTmFtZSA9IG1GZHAuUGlja1ZhbHVlSW5BcnJheShtUGFydGl0aW9uTmFtZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgUGFydGl0aW9uKiBhZGRlZFBhcnRpdGlvbiA9IG1CdWlsZGVyLT5BZGRQYXJ0aXRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpdGlvbk5hbWUsIG1GZHAuUGlja1ZhbHVlSW5BcnJheShrQXR0cmlidXRlVHlwZXMpKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCBudW1TZWN0b3JzID0gbUZkcC5Db25zdW1lQm9vbCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ2NF90PigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtNaW5TZWN0b3JWYWx1ZSwga01heFNlY3RvclZhbHVlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGtWYWxpZE51bVNlY3RvcnM7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IHBoeXNpY2FsU2VjdG9yID0gbUZkcC5Db25zdW1lQm9vbCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50NjRfdD4oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga01pblNlY3RvclZhbHVlLCBrTWF4U2VjdG9yVmFsdWUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGtWYWxpZFBoeXNpY2FsU2VjdG9yOworCisgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IG51bUV4dGVudHMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8aW50NjRfdD4oa01pbkVsZW1lbnRzLCBrTWF4RWxlbWVudHMpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1GdXp6UGFydGl0aW9uKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBleHRlbnRBZGRlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50NjRfdCBpID0gMDsgaSA8PSBudW1FeHRlbnRzOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0ZW50QWRkZWQgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLT5BZGRMaW5lYXJFeHRlbnQobUZ1enpQYXJ0aXRpb24sIGtEZXZpY2VJbmZvTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bVNlY3RvcnMsIHBoeXNpY2FsU2VjdG9yKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXh0ZW50QWRkZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pcXVlX3B0cjxMcE1ldGFkYXRhPiBtZXRhZGF0YSA9IG1CdWlsZGVyLT5FeHBvcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QgYWxpZ25lZFNpemUgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50NjRfdD4oa01pblZhbHVlLCBrTWF4VmFsdWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRnV6elBhcnRpdGlvbi0+R2V0QmVnaW5uaW5nRXh0ZW50cyhMUF9TRUNUT1JfU0laRSAqIG51bUV4dGVudHMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBjYWxsVmVyaWZ5RXh0ZW50c0FnYWluc3RTb3VyY2VNZXRhZGF0YSgpOyB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IG1CdWlsZGVyLT5MaXN0UGFydGl0aW9uc0luR3JvdXAobUZkcC5QaWNrVmFsdWVJbkFycmF5KG1Hcm91cE5hbWVzKSk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QgbWF4U2l6ZSA9IG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpOworICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXItPkNoYW5nZUdyb3VwU2l6ZShtRmRwLlBpY2tWYWx1ZUluQXJyYXkobUdyb3VwTmFtZXMpLCBtYXhTaXplKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGRldmljZUluZm9OYW1lID0gbUZkcC5Db25zdW1lQm9vbCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8ga0RldmljZUluZm9OYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbUZkcC5Db25zdW1lUmFuZG9tTGVuZ3RoU3RyaW5nKGtNYXhCeXRlcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci0+R2V0QmxvY2tEZXZpY2VJbmZvKGRldmljZUluZm9OYW1lLCAmbUJsb2NrRGV2aWNlc1sxXSk7CisgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBkZXZpY2VJbmZvTmFtZSA9IG1GZHAuQ29uc3VtZUJvb2woKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IGtEZXZpY2VJbmZvTmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1GZHAuQ29uc3VtZVJhbmRvbUxlbmd0aFN0cmluZyhrTWF4Qnl0ZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXItPlVwZGF0ZUJsb2NrRGV2aWNlSW5mbyhkZXZpY2VJbmZvTmFtZSwgbUJsb2NrRGV2aWNlc1sxXSk7CisgICAgICAgICAgICAgICAgICAgIH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVuaXF1ZV9wdHI8THBNZXRhZGF0YT4gbWV0YWRhdGEgPSBtQnVpbGRlci0+RXhwb3J0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci0+SW1wb3J0UGFydGl0aW9ucygqbWV0YWRhdGEuZ2V0KCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7bUZkcC5QaWNrVmFsdWVJbkFycmF5KG1QYXJ0aXRpb25OYW1lcyl9KTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBtQnVpbGRlci0+SGFzQmxvY2tEZXZpY2UobUZkcC5QaWNrVmFsdWVJbkFycmF5KG1QYXJ0aXRpb25OYW1lcykpOyB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7IG1CdWlsZGVyLT5TZXRWaXJ0dWFsQUJEZXZpY2VGbGFnKCk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgbUJ1aWxkZXItPlNldEF1dG9TbG90U3VmZml4aW5nKCk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgbUJ1aWxkZXItPkxpc3RHcm91cHMoKTsgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBtQnVpbGRlci0+VXNlZFNwYWNlKCk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsgbUJ1aWxkZXItPlJlcXVpcmVFeHBhbmRlZE1ldGFkYXRhSGVhZGVyKCk7IH0sCisgICAgICAgICAgICAgICAgICAgIFsmXSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ2NF90IHJlc2l6ZWRQYXJ0aXRpb25TaXplID0gZ2V0UGFyYW1WYWx1ZSgwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLT5SZXNpemVQYXJ0aXRpb24obVJlc2l6ZVBhcnRpdGlvbiwgcmVzaXplZFBhcnRpdGlvblNpemUpOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBzb3VyY2VTbG90ID0gbUZkcC5Db25zdW1lQm9vbCgpID8gMCA6IDE7CisgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCB0YXJnZXRTbG90ID0gbUZkcC5Db25zdW1lQm9vbCgpID8gMCA6IDE7CisgICAgICAgICAgICAgICAgICAgICAgICBQYXJ0aXRpb25PcGVuZXIgcGFydGl0aW9uT3BlbmVyOworICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIHNvdXJjZVBhcnRpdGlvbiA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IGtGdXp6UGFydGl0aW9uTmFtZSA6IGtEZXZpY2VJbmZvTmFtZTsKKworICAgICAgICAgICAgICAgICAgICAgICAgTWV0YWRhdGFCdWlsZGVyOjpOZXdGb3JVcGRhdGUocGFydGl0aW9uT3BlbmVyLCBzb3VyY2VQYXJ0aXRpb24sIHNvdXJjZVNsb3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRTbG90KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpdGlvbk9wZW5lci5HZXREZXZpY2VTdHJpbmcobUZkcC5QaWNrVmFsdWVJbkFycmF5KG1QYXJ0aXRpb25OYW1lcykpOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB1bmlxdWVfcHRyPExwTWV0YWRhdGE+IG1ldGFkYXRhID0gbUJ1aWxkZXItPkV4cG9ydCgpOworICAgICAgICAgICAgICAgICAgICAgICAgTWV0YWRhdGFCdWlsZGVyOjpOZXcoKm1ldGFkYXRhLmdldCgpKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeyBtQnVpbGRlci0+QWxsb2NhdGFibGVTcGFjZSgpOyB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBQYXJ0aXRpb25PcGVuZXIgcE9wZW5lcjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBzdXBlclBhcnRpdGlvbk5hbWUgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyBrU3VwZXJQYXJ0aXRpb25OYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1GZHAuQ29uc3VtZVJhbmRvbUxlbmd0aFN0cmluZyhrTWF4Qnl0ZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgcE9wZW5lci5PcGVuKHN1cGVyUGFydGl0aW9uTmFtZSwgT19SRE9OTFkpOworICAgICAgICAgICAgICAgICAgICAgICAgcE9wZW5lci5HZXRJbmZvKHN1cGVyUGFydGl0aW9uTmFtZSwgJm1CbG9ja0RldmljZXNbMF0pOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBQYXJ0aXRpb25PcGVuZXIgcE9wZW5lcjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyBzdXBlclBhcnRpdGlvbk5hbWUgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVCb29sKCkgPyBrU3VwZXJQYXJ0aXRpb25OYW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1GZHAuQ29uc3VtZVJhbmRvbUxlbmd0aFN0cmluZyhrTWF4Qnl0ZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgcE9wZW5lci5PcGVuKHN1cGVyUGFydGl0aW9uTmFtZSwgT19SRE9OTFkpOworICAgICAgICAgICAgICAgICAgICAgICAgcE9wZW5lci5HZXREZXZpY2VTdHJpbmcoc3VwZXJQYXJ0aXRpb25OYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgSW50ZXJ2YWw6OkludGVyc2VjdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZXJ2YWwobUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDY0X3Q+KCkgLyogZGV2aWNlIF9pbmRleCAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDY0X3Q+KCkgLyogc3RhcnQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpKSAvKiBlbmQgKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEludGVydmFsKG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIC8qIGRldmljZSBfaW5kZXggKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIC8qIHN0YXJ0ICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbDx1aW50NjRfdD4oKSAvKiBlbmQgKi8pKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmVjdG9yPEludGVydmFsPiBpbnRlcnZhbFZlY3RvckE7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90IGludGVybmFsVmVjdG9yQUVsZW1lbnRzID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPGludDY0X3Q+KGtNaW5FbGVtZW50cywga01heEVsZW1lbnRzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50NjRfdCBpZHggPSAwOyBpZHggPCBpbnRlcm5hbFZlY3RvckFFbGVtZW50czsgKytpZHgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnRlcnZhbFZlY3RvckEucHVzaF9iYWNrKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZXJ2YWwobUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDY0X3Q+KCkgLyogZGV2aWNlIF9pbmRleCAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIC8qIHN0YXJ0ICovLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWw8dWludDY0X3Q+KCkgLyogZW5kICovKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHZlY3RvcjxJbnRlcnZhbD4gaW50ZXJ2YWxWZWN0b3JCOworICAgICAgICAgICAgICAgICAgICAgICAgaW50NjRfdCBpbnRlcm5hbFZlY3RvckJFbGVtZW50cyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQ2NF90PihrTWluRWxlbWVudHMsIGtNYXhFbGVtZW50cyk7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludDY0X3QgaWR4ID0gMDsgaWR4IDwgaW50ZXJuYWxWZWN0b3JCRWxlbWVudHM7ICsraWR4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJ2YWxWZWN0b3JCLnB1c2hfYmFjaygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEludGVydmFsKG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIC8qIGRldmljZSBfaW5kZXggKi8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbDx1aW50NjRfdD4oKSAvKiBzdGFydCAqLywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsPHVpbnQ2NF90PigpIC8qIGVuZCAqLykpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICBJbnRlcnZhbDo6SW50ZXJzZWN0KGludGVydmFsVmVjdG9yQSwgaW50ZXJ2YWxWZWN0b3JCKTsKKyAgICAgICAgICAgICAgICAgICAgfSwKKyAgICAgICAgICAgICAgICAgICAgWyZdKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdWludDY0X3QgbnVtU2VjdG9ycyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50NjRfdD4oa01pblZhbHVlLCBrTWF4VmFsdWUpOworICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgZGV2aWNlSW5kZXggPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDMyX3Q+KGtNaW5WYWx1ZSwga01heFZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ2NF90IHBoeXNpY2FsU2VjdG9yID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZkcC5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ2NF90PihrTWluVmFsdWUsIGtNYXhWYWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBMaW5lYXJFeHRlbnQgZXh0ZW50KG51bVNlY3RvcnMsIGRldmljZUluZGV4LCBwaHlzaWNhbFNlY3Rvcik7CisgICAgICAgICAgICAgICAgICAgICAgICBleHRlbnQuQXNJbnRlcnZhbCgpOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgICAgICAgICBbJl0oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBJUHJvcGVydHlGZXRjaGVyOjpPdmVycmlkZUZvclRlc3Rpbmcoc3RkOjptYWtlX3VuaXF1ZTxQcm9wZXJ0eUZldGNoZXI+KCkpOworICAgICAgICAgICAgICAgICAgICB9LAorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBpbnZva2VBUElzKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1GZHAuQ29uc3VtZUJvb2woKSkgeworICAgICAgICAgICAgbUJ1aWxkZXItPlJlbW92ZUdyb3VwQW5kUGFydGl0aW9ucyhtRmRwLlBpY2tWYWx1ZUluQXJyYXkobUdyb3VwTmFtZXMpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN0cmluZyByZW1vdmVQYXJ0aXRpb24gPSBtRmRwLlBpY2tWYWx1ZUluQXJyYXkobVBhcnRpdGlvbk5hbWVzKTsKKyAgICAgICAgICAgIG1CdWlsZGVyLT5SZW1vdmVQYXJ0aXRpb24ocmVtb3ZlUGFydGl0aW9uKTsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBCdWlsZGVyRnV6emVyO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ludDMyX3QgbWV0YWRhdGFNYXhTaXplID0KKyAgICAgICAgICAgIG1GZHAuQ29uc3VtZUJvb2woKSA/IGtTdXBlckxheW91dFZhbGlkTWV0YWRhdGFTaXplIDogcmFuZG9tTWV0YWRhdGFNYXhTaXplOworICAgIHVpbnQzMl90IG1ldGFkYXRhU2xvdENvdW50ID0gbUZkcC5Db25zdW1lQm9vbCgpID8gMCA6IDE7CisgICAgbVN1cGVyQnVpbGRlciA9IE1ldGFkYXRhQnVpbGRlcjo6TmV3KGJsb2NrRGV2U2l6ZSwgbWV0YWRhdGFNYXhTaXplLCBtZXRhZGF0YVNsb3RDb3VudCk7CisKKyAgICBpZiAobVN1cGVyQnVpbGRlci5nZXQoKSkgeworICAgICAgICBpZiAobUZkcC5Db25zdW1lQm9vbCgpKSB7CisgICAgICAgICAgICBpbnQzMl90IG51bVBhcnRpdGlvbnMgPQorICAgICAgICAgICAgICAgICAgICBtRmRwLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8aW50MzJfdD4oa01pbkVsZW1lbnRzLCBrTWF4RWxlbWVudHMpOworICAgICAgICAgICAgYWRkTXVsdGlwbGVQYXJ0aXRpb25zKG51bVBhcnRpdGlvbnMpOworICAgICAgICB9CisKKyAgICAgICAgdWludDMyX3QgcmFuZG9tT3BlbiA9IG1GZHAuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50MzJfdD4oa01pbk9wZW4sIGtNYXhPcGVuKTsKKyAgICAgICAgY2FsbFJhbmRvbU9wZW4ocmFuZG9tT3Blbik7CisgICAgfQorfQorCit2b2lkIFN1cGVyTGF5b3V0QnVpbGRlckZ1enplcjo6YWRkTXVsdGlwbGVQYXJ0aXRpb25zKGludDMyX3QgbnVtUGFydGl0aW9ucykgeworICAgIGZvciAoaW50MzJfdCBpZHggPSAwOyBpZHggPCBudW1QYXJ0aXRpb25zOyArK2lkeCkgeworICAgICAgICBzdHJpbmcgcGFydGl0aW9uTmFtZSA9IG1GZHAuQ29uc3VtZUJ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ICAgIF0sCiAgICAgaGVhZGVyX2xpYnM6IFsKQEAgLTg1LDExICs4NSw5IEBACiAgICAgICAgICJhbmRyb2lkL3NuYXBzaG90L3NuYXBzaG90LnByb3RvIiwKICAgICAgICAgImRldmljZV9pbmZvLmNwcCIsCiAgICAgICAgICJzbmFwc2hvdC5jcHAiLAotICAgICAgICAic25hcHNob3RfcmVhZGVyLmNwcCIsCiAgICAgICAgICJzbmFwc2hvdF9zdGF0cy5jcHAiLAogICAgICAgICAic25hcHNob3Rfc3R1Yi5jcHAiLAogICAgICAgICAic25hcHNob3RfbWV0YWRhdGFfdXBkYXRlci5jcHAiLAotICAgICAgICAic25hcHNob3Rfd3JpdGVyLmNwcCIsCiAgICAgICAgICJwYXJ0aXRpb25fY293X2NyZWF0b3IuY3BwIiwKICAgICAgICAgInJldHVybi5jcHAiLAogICAgICAgICAidXRpbGl0eS5jcHAiLApAQCAtMTAzLDcgKzEwMSw3IEBACiB9CiAKIGNjX2xpYnJhcnlfc3RhdGljIHsKLSAgICBuYW1lOiAibGlic25hcHNob3QiLAorICAgIG5hbWU6ICJsaWJzbmFwc2hvdF9zdGF0aWMiLAogICAgIGRlZmF1bHRzOiBbCiAgICAgICAgICJsaWJzbmFwc2hvdF9kZWZhdWx0cyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9oYWxfZGVwcyIsCkBAIC0xMTQsNiArMTEyLDI1IEBACiAgICAgXSwKIH0KIAorY2NfbGlicmFyeSB7CisgICAgbmFtZTogImxpYnNuYXBzaG90IiwKKyAgICBkZWZhdWx0czogWworICAgICAgICAibGlic25hcHNob3RfZGVmYXVsdHMiLAorICAgICAgICAibGlic25hcHNob3RfY293X2RlZmF1bHRzIiwKKyAgICAgICAgImxpYnNuYXBzaG90X2hhbF9kZXBzIiwKKyAgICBdLAorICAgIHNyY3M6IFsiOmxpYnNuYXBzaG90X3NvdXJjZXMiXSwKKyAgICBzaGFyZWRfbGliczogWworICAgICAgICAibGliZnNfbWdyX2JpbmRlciIsCisgICAgICAgICJsaWJscCIsCisgICAgICAgICJsaWJwcm90b2J1Zi1jcHAtbGl0ZSIsCisgICAgXSwKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGliYysrZnMiLAorICAgICAgICAibGlic25hcHNob3RfY293IiwKKyAgICBdCit9CisKIGNjX2xpYnJhcnlfc3RhdGljIHsKICAgICBuYW1lOiAibGlic25hcHNob3RfaW5pdCIsCiAgICAgbmF0aXZlX2NvdmVyYWdlIDogdHJ1ZSwKQEAgLTE2Myw4ICsxODAsMTEgQEAKICAgICAgICAgImxpYmJyb3RsaSIsCiAgICAgICAgICJsaWJ6IiwKICAgICAgICAgImxpYmx6NCIsCisgICAgICAgICJsaWJ6c3RkIiwKICAgICBdLAotICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdLAorICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJ1cGRhdGVfZW5naW5lX2hlYWRlcnMiLAorICAgIF0sCiB9CiAKIGNjX2xpYnJhcnlfc3RhdGljIHsKQEAgLTE3MywxMiArMTkzLDE4IEBACiAgICAgICAgICJsaWJzbmFwc2hvdF9jb3dfZGVmYXVsdHMiLAogICAgIF0sCiAgICAgc3JjczogWwotICAgICAgICAibGlic25hcHNob3RfY293L2Nvd19kZWNvbXByZXNzLmNwcCIsCi0gICAgICAgICJsaWJzbmFwc2hvdF9jb3cvY293X3JlYWRlci5jcHAiLAotICAgICAgICAibGlic25hcHNob3RfY293L2Nvd193cml0ZXIuY3BwIiwKLSAgICAgICAgImxpYnNuYXBzaG90X2Nvdy9jb3dfZm9ybWF0LmNwcCIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9jb3cvY293X2NvbXByZXNzLmNwcCIsCisgICAgICAgICJsaWJzbmFwc2hvdF9jb3cvY293X2RlY29tcHJlc3MuY3BwIiwKKyAgICAgICAgImxpYnNuYXBzaG90X2Nvdy9jb3dfZm9ybWF0LmNwcCIsCisgICAgICAgICJsaWJzbmFwc2hvdF9jb3cvY293X3JlYWRlci5jcHAiLAorICAgICAgICAibGlic25hcHNob3RfY293L3BhcnNlcl92Mi5jcHAiLAorICAgICAgICAibGlic25hcHNob3RfY293L3BhcnNlcl92My5jcHAiLAorICAgICAgICAibGlic25hcHNob3RfY293L3NuYXBzaG90X3JlYWRlci5jcHAiLAorICAgICAgICAibGlic25hcHNob3RfY293L3dyaXRlcl9iYXNlLmNwcCIsCisgICAgICAgICJsaWJzbmFwc2hvdF9jb3cvd3JpdGVyX3YyLmNwcCIsCisgICAgICAgICJsaWJzbmFwc2hvdF9jb3cvd3JpdGVyX3YzLmNwcCIsCiAgICAgXSwKKyAgICBleHBvcnRfaW5jbHVkZV9kaXJzOiBbImluY2x1ZGUiXSwKICAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKICAgICByZWNvdmVyeV9hdmFpbGFibGU6IHRydWUsCiAgICAgcmFtZGlza19hdmFpbGFibGU6IHRydWUsCkBAIC0yMjEsOSArMjQ3LDcgQEAKICAgICBzcmNzOiBbCiAgICAgICAgICJwYXJ0aXRpb25fY293X2NyZWF0b3JfdGVzdC5jcHAiLAogICAgICAgICAic25hcHNob3RfbWV0YWRhdGFfdXBkYXRlcl90ZXN0LmNwcCIsCi0gICAgICAgICJzbmFwc2hvdF9yZWFkZXJfdGVzdC5jcHAiLAogICAgICAgICAic25hcHNob3RfdGVzdC5jcHAiLAotICAgICAgICAic25hcHNob3Rfd3JpdGVyX3Rlc3QuY3BwIiwKICAgICBdLAogICAgIHNoYXJlZF9saWJzOiBbCiAgICAgICAgICJsaWJiaW5kZXIiLApAQCAtMjQ0LDcgKzI2OCw3IEBACiAgICAgICAgICJsaWJnc2kiLAogICAgICAgICAibGliZ21vY2siLAogICAgICAgICAibGlibHAiLAotICAgICAgICAibGlic25hcHNob3QiLAorICAgICAgICAibGlic25hcHNob3Rfc3RhdGljIiwKICAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF90ZXN0X2hlbHBlcnMiLAogICAgICAgICAibGlic3BhcnNlIiwKQEAgLTMyNyw4ICszNTEsNiBAQAogICAgICAgICAibGliYnJvdGxpIiwKICAgICAgICAgImxpYmMrK2ZzIiwKICAgICAgICAgImxpYmZzdGFiIiwKLSAgICAgICAgImxpYnNuYXBzaG90IiwKLSAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCiAgICAgICAgICJsaWJ6IiwKICAgICAgICAgInVwZGF0ZV9tZXRhZGF0YS1wcm90b3MiLAogICAgIF0sCkBAIC0zNDEsNiArMzYzLDcgQEAKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJscCIsCiAgICAgICAgICJsaWJwcm90b2J1Zi1jcHAtbGl0ZSIsCisgICAgICAgICJsaWJzbmFwc2hvdCIsCiAgICAgICAgICJsaWJzdGF0c2xvZyIsCiAgICAgICAgICJsaWJ1dGlscyIsCiAgICAgXSwKQEAgLTM2OSw3ICszOTIsOSBAQAogICAgICAgICAibGlic25hcHNob3RfY293X2RlZmF1bHRzIiwKICAgICBdLAogICAgIHNyY3M6IFsKLSAgICAgICAgImxpYnNuYXBzaG90X2Nvdy9jb3dfYXBpX3Rlc3QuY3BwIiwKKyAgICAgICAgImxpYnNuYXBzaG90X2Nvdy9zbmFwc2hvdF9yZWFkZXJfdGVzdC5jcHAiLAorICAgICAgICAibGlic25hcHNob3RfY293L3Rlc3RfdjIuY3BwIiwKKyAgICAgICAgImxpYnNuYXBzaG90X2Nvdy90ZXN0X3YzLmNwcCIsCiAgICAgXSwKICAgICBjZmxhZ3M6IFsKICAgICAgICAgIi1EX0ZJTEVfT0ZGU0VUX0JJVFM9NjQiLApAQCAtMzkzLDYgKzQxOCwxMCBAQAogICAgIHRlc3Rfb3B0aW9uczogewogICAgICAgICBtaW5fc2hpcHBpbmdfYXBpX2xldmVsOiAzMCwKICAgICB9LAorICAgIGRhdGE6IFsKKyAgICAgICAgInRvb2xzL3Rlc3RkYXRhL2Nvd192MiIsCisgICAgICAgICJ0b29scy90ZXN0ZGF0YS9pbmNvbXByZXNzaWJsZV9ibG9jayIsCisgICAgXSwKICAgICBhdXRvX2dlbl9jb25maWc6IHRydWUsCiAgICAgcmVxdWlyZV9yb290OiBmYWxzZSwKICAgICBob3N0X3N1cHBvcnRlZDogdHJ1ZSwKQEAgLTQxMyw2ICs0NDIsNyBAQAogICAgICAgICAibGliYnJvdGxpIiwKICAgICAgICAgImxpYmNyeXB0b19zdGF0aWMiLAogICAgICAgICAibGlibG9nIiwKKyAgICAgICAgImxpYmdmbGFncyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9jb3ciLAogICAgICAgICAibGlieiIsCiAgICAgXSwKQEAgLTQyMyw2ICs0NTMsNTQgQEAKICAgICBdLAogfQogCitjY19iaW5hcnkgeworICAgIG5hbWU6ICJjcmVhdGVfc25hcHNob3QiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIGRldmljZV9zdXBwb3J0ZWQ6IGZhbHNlLAorCisgICAgc3JjczogWyJsaWJzbmFwc2hvdF9jb3cvY3JlYXRlX2Nvdy5jcHAiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLVdhbGwiLAorICAgICAgICAiLVdlcnJvciIsCisgICAgXSwKKworICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJsb2ciLAorICAgICAgICAibGliYmFzZSIsCisgICAgICAgICJsaWJleHQ0X3V0aWxzIiwKKyAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCisgICAgICAgICJsaWJjcnlwdG8iLAorICAgICAgICAibGliYnJvdGxpIiwKKyAgICAgICAgImxpYnoiLAorICAgICAgICAibGlibHo0IiwKKyAgICAgICAgImxpYnpzdGQiLAorICAgICAgICAibGliZ2ZsYWdzIiwKKyAgICBdLAorICAgIHNoYXJlZF9saWJzOiBbCisgICAgXSwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJzdG9yYWdlX2xpdGVyYWxzX2hlYWRlc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21wcmVzc2lvbiBjb21wcmVzc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBibG9ja19zaXplKTsKKworICAgIHVpbnQzMl90IEdldENvbXByZXNzaW9uTGV2ZWwoKSBjb25zdCB7IHJldHVybiBjb21wcmVzc2lvbl9sZXZlbF87IH0KKyAgICB1aW50MzJfdCBHZXRCbG9ja1NpemUoKSBjb25zdCB7IHJldHVybiBibG9ja19zaXplXzsgfQorICAgIFtbbm9kaXNjYXJkXV0gdmlydHVhbCBzdGQ6OmJhc2ljX3N0cmluZzx1aW50OF90PiBDb21wcmVzcyhjb25zdCB2b2lkKiBkYXRhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgbGVuZ3RoKSBjb25zdCA9IDA7CisKKyAgcHJpdmF0ZToKKyAgICB1aW50MzJfdCBjb21wcmVzc2lvbl9sZXZlbF87CisgICAgdWludDMyX3QgYmxvY2tfc2l6ZV87Cit9OworfSAgLy8gbmFtZXNwYWNlIHNuYXBzaG90Cit9ICAvLyBuYW1lc3BhY2UgYW5kcm9pZApcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2ZzX21nci9saWJzbmFwc2hvdC9pbmNsdWRlL2xpYnNuYXBzaG90L2Nvd19mb3JtYXQuaCBiL2ZzX21nci9saWJzbmFwc2hvdC9pbmNsdWRlL2xpYnNuYXBzaG90L2Nvd19mb3JtYXQuaAppbmRleCBiYTc1YThkLi42YjM0MTUyIDEwMDY0NAotLS0gYS9mc19tZ3IvbGlic25hcHNob3QvaW5jbHVkZS9saWJzbmFwc2hvdC9jb3dfZm9ybWF0LmgKKysrIGIvZnNfbWdyL2xpYnNuYXBzaG90L2luY2x1ZGUvbGlic25hcHNob3QvY293X2Zvcm1hdC5oCkBAIC0xNSwxOSArMTUsMzAgQEAKICNwc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HRyPElTbmFwc2hvdFdyaXRlcj4gT3Blbktlcm5lbFNuYXBzaG90V3JpdGVyKAotICAgICAgICAgICAgTG9ja2VkRmlsZSogbG9jaywgY29uc3Qgc3RkOjpvcHRpb25hbDxzdGQ6OnN0cmluZz4mIHNvdXJjZV9kZXZpY2UsCi0gICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgcGFydGl0aW9uX25hbWUsIGNvbnN0IFNuYXBzaG90U3RhdHVzJiBzdGF0dXMsCi0gICAgICAgICAgICBjb25zdCBTbmFwc2hvdFBhdGhzJiBwYXRocyk7CisgICAgc3RkOjp1bmlxdWVfcHRyPElDb3dXcml0ZXI+IE9wZW5Db21wcmVzc2VkU25hcHNob3RXcml0ZXIoTG9ja2VkRmlsZSogbG9jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBTbmFwc2hvdFN0YXR1cyYgc3RhdHVzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IFNuYXBzaG90UGF0aHMmIHBhdGhzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3B0aW9uYWw8dWludDY0X3Q+IGxhYmVsKTsKIAogICAgIC8vIE1hcCB0aGUgYmFzZSBkZXZpY2UsIENPVyBkZXZpY2VzLCBhbmQgc25hcHNob3QgZGV2aWNlLgogICAgIGJvb2wgTWFwUGFydGl0aW9uV2l0aFNuYXBzaG90KExvY2tlZEZpbGUqIGxvY2ssIENyZWF0ZUxvZ2ljYWxQYXJ0aXRpb25QYXJhbXMgcGFyYW1zLApAQCAtNzQ3LDcgKzc0NSw3IEBACiAgICAgLy8gSW5pdGlhbGl6ZSBzbmFwc2hvdHMgc28gdGhhdCB0aGV5IGNhbiBiZSBtYXBwZWQgbGF0ZXIuCiAgICAgLy8gT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VuZ3RoKSB7CitzdGQ6OnVuaXF1ZV9wdHI8SUNvbXByZXNzb3I+IElDb21wcmVzc29yOjpDcmVhdGUoQ293Q29tcHJlc3Npb24gY29tcHJlc3Npb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBibG9ja19zaXplKSB7CisgICAgc3dpdGNoIChjb21wcmVzc2lvbi5hbGdvcml0aG0pIHsKKyAgICAgICAgY2FzZSBrQ293Q29tcHJlc3NMejQ6CisgICAgICAgICAgICByZXR1cm4gSUNvbXByZXNzb3I6Okx6NChjb21wcmVzc2lvbi5jb21wcmVzc2lvbl9sZXZlbCwgYmxvY2tfc2l6ZSk7CisgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzQnJvdGxpOgorICAgICAgICAgICAgcmV0dXJuIElDb21wcmVzc29yOjpCcm90bGkoY29tcHJlc3Npb24uY29tcHJlc3Npb25fbGV2ZWwsIGJsb2NrX3NpemUpOworICAgICAgICBjYXNlIGtDb3dDb21wcmVzc0d6OgorICAgICAgICAgICAgcmV0dXJuIElDb21wcmVzc29yOjpHeihjb21wcmVzc2lvbi5jb21wcmVzc2lvbl9sZXZlbCwgYmxvY2tfc2l6ZSk7CisgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzWnN0ZDoKKyAgICAgICAgICAgIHJldHVybiBJQ29tcHJlc3Nvcjo6WnN0ZChjb21wcmVzc2lvbi5jb21wcmVzc2lvbl9sZXZlbCwgYmxvY2tfc2l6ZSk7CisgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzTm9uZToKKyAgICAgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKyAgICByZXR1cm4gbnVsbHB0cjsKK30KKworLy8gMS4gRGVmYXVsdCBjb21wcmVzc2lvbiBsZXZlbCBpcyBkZXRlcm1pbmVkIGJ5IGNvbXByZXNzaW9uIGFsZ29yaXRobQorLy8gMi4gVGhlcmUgbWlnaHQgYmUgY29tc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Jjb21wcmVzczIgcmV0dXJuZWQ6ICIgPDwgcnY7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHt9OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnVmZmVyLnJlc2l6ZShkZXN0X2xlbik7Ci0gICAgICAgICAgICByZXR1cm4gYnVmZmVyOworICAgICAgICAgICAgcmV0dXJuIFpfQkVTVF9DT01QUkVTU0lPTjsKICAgICAgICAgfQogICAgICAgICBjYXNlIGtDb3dDb21wcmVzc0Jyb3RsaTogewotICAgICAgICAgICAgY29uc3QgYXV0byBib3VuZCA9IEJyb3RsaUVuY29kZXJNYXhDb21wcmVzc2VkU2l6ZShsZW5ndGgpOwotICAgICAgICAgICAgaWYgKCFib3VuZCkgewotICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkJyb3RsaUVuY29kZXJNYXhDb21wcmVzc2VkU2l6ZSByZXR1cm5lZCAwIjsKLSAgICAgICAgICAgICAgICByZXR1cm4ge307Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGQ6OmJhc2ljX3N0cmluZzx1aW50OF90PiBidWZmZXIoYm91bmQsICdcMCcpOwotCi0gICAgICAgICAgICBzaXplX3QgZW5jb2RlZF9zaXplID0gYm91bmQ7Ci0gICAgICAgICAgICBhdXRvIHJ2ID0gQnJvdGxpRW5jb2RlckNvbXByZXNzKAotICAgICAgICAgICAgICAgICAgICBCUk9UTElfREVGQVVMVF9RVUFMSVRZLCBCUk9UTElfREVGQVVMVF9XSU5ET1csIEJST1RMSV9ERUZBVUxUX01PREUsIGxlbmd0aCwKLSAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDxjb25zdCB1aW50OF90Kj4oZGF0YSksICZlbmNvZGVkX3NpemUsIGJ1ZmZlci5kYXRhKCkpOwotICAgICAgICAgICAgaWYgKCFydikgewotICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkJyb3RsaUVuY29kZXJDb21wcmVzcyBmYWlsZWQiOwotICAgICAgICAgICAgICAgIHJldHVybiB7fTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJ1ZmZlci5yZXNpemUoZW5jb2RlZF9zaXplKTsKLSAgICAgICAgICAgIHJldHVybiBidWZmZXI7CisgICAgICAgICAgICByZXR1cm4gQlJPVExJX0RFRkFVTFRfUVVBTElUWTsKICAgICAgICAgfQogICAgICAgICBjYXNlIGtDb3dDb21wcmVzc0x6NDogewotICAgICAgICAgICAgY29uc3QgYXV0byBib3VuZCA9IExaNF9jb21wcmVzc0JvdW5kKGxlbmd0aCk7Ci0gICAgICAgICAgICBpZiAoIWJvdW5kKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTFo0X2NvbXByZXNzQm91bmQgcmV0dXJuZWQgMCI7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHt9OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4gYnVmZmVyKGJvdW5kLCAnXDAnKTsKLQotICAgICAgICAgICAgY29uc3QgYXV0byBjb21wcmVzc2VkX3NpemUgPSBMWjRfY29tcHJlc3NfZGVmYXVsdCgKLSAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8Y29uc3QgY2hhcio+KGRhdGEpLCByZWludGVycHJldF9jYXN0PGNoYXIqPihidWZmZXIuZGF0YSgpKSwgbGVuZ3RoLAotICAgICAgICAgICAgICAgICAgICBidWZmZXIuc2l6ZSgpKTsKLSAgICAgICAgICAgIGlmIChjb21wcmVzc2VkX3NpemUgPD0gMCkgewotICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkxaNF9jb21wcmVzc19kZWZhdWx0IGZhaWxlZCwgaW5wdXQgc2l6ZTogIiA8PCBsZW5ndGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIsIGNvbXByZXNzaW9uIGJvdW5kOiAiIDw8IGJvdW5kIDw8ICIsIHJldDogIiA8PCBjb21wcmVzc2VkX3NpemU7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHt9OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgLy8gRG9uJ3QgcnVuIGNvbXByZXNzaW9uIGlmIHRoZSBjb21wcmVzc2VkIG91dHB1dCBpcyBsYXJnZXIKLSAgICAgICAgICAgIGlmIChjb21wcmVzc2VkX3NpemUgPj0gbGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgYnVmZmVyLnJlc2l6ZShsZW5ndGgpOwotICAgICAgICAgICAgICAgIG1lbWNweShidWZmZXIuZGF0YSgpLCBkYXRhLCBsZW5ndGgpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBidWZmZXIucmVzaXplKGNvbXByZXNzZWRfc2l6ZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gYnVmZmVyOwotICAgICAgICB9Ci0gICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICBMT0coRVJST1IpIDw8ICJ1bmhhbmRsZWQgY29tcHJlc3Npb24gdHlwZTogIiA8PCBjb21wcmVzc2lvbjsKICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzWnN0ZDogeworICAgICAgICAgICAgcmV0dXJuIFpTVERfZGVmYXVsdENMZXZlbCgpOworICAgICAgICB9CisgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzTm9uZTogeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KICAgICB9Ci0gICAgcmV0dXJuIHt9OworICAgIHJldHVybiAwOwogfQorCitjbGFzcyBHekNvbXByZXNzb3IgZmluYWwgOiBwdWJsaWMgSUNvbXByZXNzb3IgeworICBwdWJsaWM6CisgICAgR3pDb21wcmVzc29yKHVpbnQzMl90IGNvbXByZXNzaW9uX2xldmVsLCBjb25zdCB1aW50MzJfdCBibG9ja19zaXplKQorICAgICAgICA6IElDb21wcmVzc29yKGNvbXByZXNzaW9uX2xldmVsLCBibG9ja19zaXplKXt9OworCisgICAgc3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4gQ29tcHJlc3MoY29uc3Qgdm9pZCogZGF0YSwgc2l6ZV90IGxlbmd0aCkgY29uc3Qgb3ZlcnJpZGUgeworICAgICAgICBjb25zdCBhdXRvIGJvdW5kID0gY29tcHJlc3NCb3VuZChsZW5ndGgpOworICAgICAgICBzdGQ6OmJhc2ljX3N0cmluZzx1aW50OF90PiBidWZmZXIoYm91bmQsICdcMCcpOworCisgICAgICAgIHVMb25nZiBkZXN0X2xlbiA9IGJvdW5kOworICAgICAgICBhdXRvIHJ2ID0gY29tcHJlc3MyKGJ1ZmZlci5kYXRhKCksICZkZXN0X2xlbiwgcmVpbnRlcnByZXRfY2FzdDxjb25zdCBCeXRlZio+KGRhdGEpLCBsZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgR2V0Q29tcHJlc3Npb25MZXZlbCgpKTsKKyAgICAgICAgaWYgKHJ2ICE9IFpfT0spIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgImNvbXByZXNzMiByZXR1cm5lZDogIiA8PCBydjsKKyAgICAgICAgICAgIHJldHVybiB7fTsKKyAgICAgICAgfQorICAgICAgICBidWZmZXIucmVzaXplKGRlc3RfbGVuKTsKKyAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKKyAgICB9OworfTsKKworY2xhc3MgTHo0Q29tcHJlc3NvciBmaW5hbCA6IHB1YmxpYyBJQ29tcHJlc3NvciB7CisgIHB1YmxpYzoKKyAgICBMejRDb21wcmVzc29yKHVpbnQzMl90IGNvbXByZXNzaW9uX2xldmVsLCBjb25zdCB1aW50MzJfdCBibG9ja19zaXplKQorICAgICAgICA6IElDb21wcmVzc29yKGNvbXByZXNzaW9uX2xldmVsLCBibG9ja19zaXplKXt9OworCisgICAgc3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4gQ29tcHJlc3MoY29uc3Qgdm9pZCogZGF0YSwgc2l6ZV90IGxlbmd0aCkgY29uc3Qgb3ZlcnJpZGUgeworICAgICAgICBjb25zdCBhdXRvIGJvdW5kID0gTFo0X2NvbXByZXNzQm91bmQobGVuZ3RoKTsKKyAgICAgICAgaWYgKCFib3VuZCkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTFo0X2NvbXByZXNzQm91bmQgcmV0dXJuZWQgMCI7CisgICAgICAgICAgICByZXR1cm4ge307CisgICAgICAgIH0KKyAgICAgICAgc3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4gYnVmZmVyKGJvdW5kLCAnXDAnKTsKKworICAgICAgICBjb25zdCBhdXRvIGNvbXByZXNzZWRfc2l6ZSA9CisgICAgICAgICAgICAgICAgTFo0X2NvbXByZXNzX2RlZmF1bHQoc3RhdGljX2Nhc3Q8Y29uc3QgY2hhcio+KGRhdGEpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhcio+KGJ1ZmZlci5kYXRhKCkpLCBsZW5ndGgsIGJ1ZmZlci5zaXplKCkpOworICAgICAgICBpZiAoY29tcHJlc3NlZF9zaXplIDw9IDApIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkxaNF9jb21wcmVzc19kZWZhdWx0IGZhaWxlZCwgaW5wdXQgc2l6ZTogIiA8PCBsZW5ndGgKKyAgICAgICAgICAgICAgICAgICAgICAgPDwgIiwgY29tcHJlc3Npb24gYm91bmQ6ICIgPDwgYm91bmQgPDwgIiwgcmV0OiAiIDw8IGNvbXByZXNzZWRfc2l6ZTsKKyAgICAgICAgICAgIHJldHVybiB7fTsKKyAgICAgICAgfQorICAgICAgICAvLyBEb24ndCBydW4gY29tcHJlc3Npb24gaWYgdGhlIGNvbXByZXNzZWQgb3V0cHV0IGlzIGxhcmdlcgorICAgICAgICBpZiAoY29tcHJlc3NlZF9zaXplID49IGxlbmd0aCkgeworICAgICAgICAgICAgYnVmZmVyLnJlc2l6ZShsZW5ndGgpOworICAgICAgICAgICAgbWVtY3B5KGJ1ZmZlci5kYXRhKCksIGRhdGEsIGxlbmd0aCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBidWZmZXIucmVzaXplKGNvbXByZXNzZWRfc2l6ZSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKKyAgICB9OworfTsKKworY2xhc3MgQnJvdGxpQ29tcHJlc3NvciBmaW5hbCA6IHB1YmxpYyBJQ29tcHJlc3NvciB7CisgIHB1YmxpYzoKKyAgICBCcm90bGlDb21wcmVzc29yKHVpbnQzMl90IGNvbXByZXNzaW9uX2xldmVsLCBjb25zdCB1aW50MzJfdCBibG9ja19zaXplKQorICAgICAgICA6IElDb21wcmVzc29yKGNvbXByZXNzaW9uX2xldmVsLCBibG9ja19zaXplKXt9OworCisgICAgc3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4gQ29tcHJlc3MoY29uc3Qgdm9pZCogZGF0YSwgc2l6ZV90IGxlbmd0aCkgY29uc3Qgb3ZlcnJpZGUgeworICAgICAgICBjb25zdCBhdXRvIGJvdW5kID0gQnJvdGxpRW5jb2Rlck1heENvbXByZXNzZWRTaXplKGxlbmd0aCk7CisgICAgICAgIGlmICghYm91bmQpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkJyb3RsaUVuY29kZXJNYXhDb21wcmVzc2VkU2l6ZSByZXR1cm5lZCAwIjsKKyAgICAgICAgICAgIHJldHVybiB7fTsKKyAgICAgICAgfQorICAgICAgICBzdGQ6OmJhc2ljX3N0cmluZzx1aW50OF90PiBidWZmZXIoYm91bmQsICdcMCcpOworCisgICAgICAgIHNpemVfdCBlbmNvZGVkX3NpemUgPSBib3VuZDsKKyAgICAgICAgYXV0byBydiA9IEJyb3RsaUVuY29kZXJDb21wcmVzcygKKyAgICAgICAgICAgICAgICBHZXRDb21wcmVzc2lvbkxldmVsKCksIEJST1RMSV9ERUZBVUxUX1d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RoKSBjb25zdCBvdmVycmlkZSB7CisgICAgICAgIHN0ZDo6YmFzaWNfc3RyaW5nPHVpbnQ4X3Q+IGJ1ZmZlcihaU1REX2NvbXByZXNzQm91bmQobGVuZ3RoKSwgJ1wwJyk7CisgICAgICAgIGNvbnN0IGF1dG8gY29tcHJlc3NlZF9zaXplID0KKyAgICAgICAgICAgICAgICBaU1REX2NvbXByZXNzMih6c3RkX2NvbnRleHRfLmdldCgpLCBidWZmZXIuZGF0YSgpLCBidWZmZXIuc2l6ZSgpLCBkYXRhLCBsZW5ndGgpOworICAgICAgICBpZiAoY29tcHJlc3NlZF9zaXplIDw9IDApIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIlpTVEQgY29tcHJlc3Npb24gZmFpbGVkICIgPDwgY29tcHJlc3NlZF9zaXplOworICAgICAgICAgICAgcmV0dXJuIHt9OworICAgICAgICB9CisgICAgICAgIC8vIERvbid0IHJ1biBjb21wcmVzc2lvbiBpZiB0aGUgY29tcHJlc3NlZCBvdXRwdXQgaXMgbGFyZ2VyCisgICAgICAgIGlmIChjb21wcmVzc2VkX3NpemUgPj0gbGVuZ3RoKSB7CisgICAgICAgICAgICBidWZmZXIucmVzaXplKGxlbmd0aCk7CisgICAgICAgICAgICBtZW1jcHkoYnVmZmVyLmRhdGEoKSwgZGF0YSwgbGVuZ3RoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGJ1ZmZlci5yZXNpemUoY29tcHJlc3NlZF9zaXplKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gYnVmZmVyOworICAgIH07CisKKyAgcHJpdmF0ZToKKyAgICBzdGQ6OnVuaXF1ZV9wdHI8WlNURF9DQ3R4LCBkZWNsdHlwZSgmWlNURF9mcmVlQ0N0eCk+IHpzdGRfY29udGV4dF87Cit9OworCiBib29sIENvbXByZXNzV29ya2VyOjpDb21wcmVzc0Jsb2Nrcyhjb25zdCB2b2lkKiBidWZmZXIsIHNpemVfdCBudW1fYmxvY2tzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpiYXNpY19zdHJpbmc8dWludDhfdD4+KiBjb21wcmVzc2VkX2RhdGEpIHsKLSAgICByZXR1cm4gQ29tcHJlc3NCbG9ja3MoY29tcHJlc3Npb25fLCBibG9ja19zaXplXywgYnVmZmVyLCBudW1fYmxvY2tzLCBjb21wcmVzc2VkX2RhdGEpOworICAgIHJldHVybiBDb21wcmVzc0Jsb2Nrcyhjb21wcmVzc29yXy5nZXQoKSwgYmxvY2tfc2l6ZV8sIGJ1ZmZlciwgbnVtX2Jsb2NrcywgY29tcHJlc3NlZF9kYXRhKTsKIH0KIAotYm9vbCBDb21wcmVzc1dvcmtlcjo6Q29tcHJlc3NCbG9ja3MoQ293Q29tcHJlc3Npb25BbGdvcml0aG0gY29tcHJlc3Npb24sIHNpemVfdCBibG9ja19zaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgdm9pZCogYnVmZmVyLCBzaXplX3QgbnVtX2Jsb2NrcywKK2Jvb2wgQ29tcHJlc3NXb3JrZXI6OkNvbXByZXNzQmxvY2tzKElDb21wcmVzc29yKiBjb21wcmVzc29yLCBzaXplX3QgYmxvY2tfc2l6ZSwgY29uc3Qgdm9pZCogYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG51bV9ibG9ja3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OmJhc2ljX3N0cmluZzx1aW50OF90Pj4qIGNvbXByZXNzZWRfZGF0YSkgewogICAgIGNvbnN0IHVpbnQ4X3QqIGl0ZXIgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQ4X3QqPihidWZmZXIpOwogICAgIHdoaWxlIChudW1fYmxvY2tzKSB7Ci0gICAgICAgIGF1dG8gZGF0YSA9IENvbXByZXNzKGNvbXByZXNzaW9uLCBpdGVyLCBibG9ja19zaXplKTsKKyAgICAgICAgYXV0byBkYXRhID0gY29tcHJlc3Nvci0+Q29tcHJlc3MoaXRlciwgYmxvY2tfc2l6ZSk7CiAgICAgICAgIGlmIChkYXRhLmVtcHR5KCkpIHsKICAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJDb21wcmVzc0Jsb2NrczogQ29tcHJlc3Npb24gZmFpbGVkIjsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKQEAgLTIxMiw2ICszMTcsMjUgQEAKICAgICByZXR1cm4gdHJ1ZTsKIH0KIAorc3RkOjp1bmlxdWVfcHRyPElDb21wcmVzc29yPiBJQ29tcHJlc3Nvcjo6QnJvdGxpKHVpbnQzMl90IGNvbXByZXNzaW9uX2xldmVsLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGludDMyX3QgYmxvY2tfc2l6ZSkgeworICAgIHJldHVybiBzdGQ6Om1ha2VfdW5pcXVlPEJyb3RsaUNvbXByZXNzb3I+KGNvbXByZXNzaW9uX2xldmVsLCBibG9ja19zaXplKTsKK30KKworc3RkOjp1bmlxdWVfcHRyPElDb21wcmVzc29yPiBJQ29tcHJlc3Nvcjo6R3oodWludDMyX3QgY29tcHJlc3Npb25fbGV2ZWwsIGNvbnN0IGludDMyX3QgYmxvY2tfc2l6ZSkgeworICAgIHJldHVybiBzdGQ6Om1ha2VfdW5pcXVlPEd6Q29tcHJlc3Nvcj4oY29tcHJlc3Npb25fbGV2ZWwsIGJsb2NrX3NpemUpOworfQorCitzdGQ6OnVuaXF1ZV9wdHI8SUNvbXByZXNzb3I+IElDb21wcmVzc29yOjpMejQodWludDMyX3QgY29tcHJlc3Npb25fbGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50MzJfdCBibG9ja19zaXplKSB7CisgICAgcmV0dXJuIHN0ZDo6bWFr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NLX0xFKGFjdHVhbF9yZWFkLCB0b19yZWFkKTsKIAotICAgICAgICAvLyBSZWFkIHVudGlsIHdlIGNhbiBmaWxsIHRoZSBidWZmZXIuCi0gICAgICAgIHVpbnQ4X3QqIGJ1ZmZlcl9wb3MgPSBidWZmZXI7Ci0gICAgICAgIHNpemVfdCBieXRlc190b19yZWFkID0gc3RkOjptaW4oYnVmZmVyX3NpemUsIHN0cmVhbV9yZW1haW5pbmcpOwotICAgICAgICB3aGlsZSAoYnl0ZXNfdG9fcmVhZCkgewotICAgICAgICAgICAgc2l6ZV90IHJlYWQ7Ci0gICAgICAgICAgICBpZiAoIXN0cmVhbV8tPlJlYWQoYnVmZmVyX3BvcywgYnl0ZXNfdG9fcmVhZCwgJnJlYWQpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFyZWFkKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiU3RyZWFtIGVuZGVkIHByZW1hdHVyZWx5IjsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIXNpbmtfLT5SZXR1cm5EYXRhKGJ1ZmZlcl9wb3MsIHJlYWQpKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ291bGQgbm90IHJldHVybiBidWZmZXIgdG8gc2luayI7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnVmZmVyX3BvcyArPSByZWFkOwotICAgICAgICAgICAgYnl0ZXNfdG9fcmVhZCAtPSByZWFkOwotICAgICAgICAgICAgc3RyZWFtX3JlbWFpbmluZyAtPSByZWFkOwotICAgICAgICB9CisgICAgICAgIHN0cmVhbV9yZW1haW5pbmcgLT0gYWN0dWFsX3JlYWQ7CisgICAgICAgIGJ1ZmZlcl9wb3MgKz0gYWN0dWFsX3JlYWQ7CisgICAgICAgIGJ1ZmZlcl9yZW1haW5pbmcgLT0gYWN0dWFsX3JlYWQ7CiAgICAgfQotICAgIHJldHVybiB0cnVlOworICAgIHJldHVybiBidWZmZXJfcG9zIC0gYnVmZmVyX3N0YXJ0OwogfQogCi1zdGQ6OnVuaXF1ZV9wdHI8SURlY29tcHJlc3Nvcj4gSURlY29tcHJlc3Nvcjo6VW5jb21wcmVzc2VkKCkgewotICAgIHJldHVybiBzdGQ6OnVuaXF1ZV9wdHI8SURlY29tcHJlc3Nvcj4obmV3IE5vRGVjb21wcmVzc29yKCkpOworc3RkOjp1bmlxdWVfcHRyPElEZWNvbXByZXNzb3I+IElEZWNvbXByZXNzb3I6OkZyb21TdHJpbmcoc3RkOjpzdHJpbmdfdmlldyBjb21wcmVzc29yKSB7CisgICAgaWYgKGNvbXByZXNzb3IgPT0gImx6NCIpIHsKKyAgICAgICAgcmV0dXJuIElEZWNvbXByZXNzb3I6Okx6NCgpOworICAgIH0gZWxzZSBpZiAoY29tcHJlc3NvciA9PSAiYnJvdGxpIikgeworICAgICAgICByZXR1cm4gSURlY29tcHJlc3Nvcjo6QnJvdGxpKCk7CisgICAgfSBlbHNlIGlmIChjb21wcmVzc29yID09ICJneiIpIHsKKyAgICAgICAgcmV0dXJuIElEZWNvbXByZXNzb3I6Okd6KCk7CisgICAgfSBlbHNlIGlmIChjb21wcmVzc29yID09ICJ6c3RkIikgeworICAgICAgICByZXR1cm4gSURlY29tcHJlc3Nvcjo6WnN0ZCgpOworICAgIH0gZWxzZSB7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KIH0KIAogLy8gUmVhZCBjaHVua3Mgb2YgdGhlIENPVyBhbmQgaW5jcmVtZW50YWxseSBzdHJlYW0gdGhlbSB0byB0aGUgZGVjb2Rlci4KIGNsYXNzIFN0cmVhbURlY29tcHJlc3NvciA6IHB1YmxpYyBJRGVjb21wcmVzc29yIHsKICAgcHVibGljOgotICAgIGJvb2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HJlYW1fLT5SZWFkKGNodW5rLCBtYXhfcmVhZCk7CisgICAgICAgIGlmIChyZWFkIDwgMCkgeworICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICB9CiAgICAgICAgIGlmICghcmVhZCkgewogICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiU3RyZWFtIGVuZGVkIHByZW1hdHVyZWx5IjsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQotICAgICAgICBpZiAoIURlY29tcHJlc3NJbnB1dChjaHVuaywgcmVhZCkpIHsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgaWYgKCFQYXJ0aWFsRGVjb21wcmVzcyhjaHVuaywgcmVhZCkpIHsKKyAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgfQotCiAgICAgICAgIHN0cmVhbV9yZW1haW5pbmdfIC09IHJlYWQ7CisgICAgfQogCi0gICAgICAgIGlmIChzdHJlYW1fcmVtYWluaW5nXyAmJiBEb25lKCkpIHsKKyAgICBpZiAoc3RyZWFtX3JlbWFpbmluZ18pIHsKKyAgICAgICAgaWYgKGRlY29tcHJlc3Nvcl9lbmRlZF8gJiYgIU91dHB1dEZ1bGwoKSkgeworICAgICAgICAgICAgLy8gSWYgdGhlcmUncyBtb3JlIGlucHV0IGluIHRoZSBzdHJlYW0sIGJ1dCB3ZSBoYXZlbid0IGZpbmlzaGVkCisgICAgICAgICAgICAvLyBjb25zdW1pbmcgaWdub3JlZCBieXRlcyBvciBhdmFpbGFibGUgb3V0cHV0IHNwYWNlIHlldCwgdGhlbgorICAgICAgICAgICAgLy8gc29tZXRoaW5nIHdlaXJkIGhhcHBlbmVkLiBSZXBvcnQgaXQgYW5kIGZhaWwuCiAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJEZWNvbXByZXNzb3IgdGVybWluYXRlZCBlYXJseSI7Ci0gICAgICAgICAgICByZXR1cm4gZmF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hdmFpbF9pbikgewotICAgICAgICAvLyBJZiBubyBtb3JlIG91dHB1dCBidWZmZXIsIGdyYWIgYSBuZXcgYnVmZmVyLgotICAgICAgICBpZiAoel8uYXZhaWxfb3V0ID09IDApIHsKLSAgICAgICAgICAgIGlmICghR2V0RnJlc2hCdWZmZXIoKSkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHpfLm5leHRfb3V0ID0gcmVpbnRlcnByZXRfY2FzdDxCeXRlZio+KG91dHB1dF9idWZmZXJfKTsKLSAgICAgICAgICAgIHpfLmF2YWlsX291dCA9IG91dHB1dF9idWZmZXJfcmVtYWluaW5nXzsKKyAgICAvLyBJZiB3ZSdyZSBhc2tlZCB0byBpZ25vcmUgc3RhcnRpbmcgYnl0ZXMsIHdlIHNpbmsgdGhvc2UgaW50byB0aGUgb3V0cHV0CisgICAgLy8gcmVwZWF0ZWRseSB1bnRpbCB0aGVyZSBpcyBub3RoaW5nIGxlZnQgdG8gaWdub3JlLgorICAgIHdoaWxlIChpZ25vcmVfYnl0ZXNfICYmIHpfLmF2YWlsX2luKSB7CisgICAgICAgIHN0ZDo6YXJyYXk8Qnl0ZWYsIGtDaHVua1NpemU+IGlnbm9yZV9idWZmZXI7CisgICAgICAgIHNpemVfdCBtYXhfaWdub3JlID0gc3RkOjptaW4oaWdub3JlX2J5dGVzXywgaWdub3JlX2J1ZmZlci5zaXplKCkpOworICAgICAgICB6Xy5uZXh0X291dCA9IGlnbm9yZV9idWZmZXIuZGF0YSgpOworICAgICAgICB6Xy5hdmFpbF9vdXQgPSBtYXhfaWdub3JlOworCisgICAgICAgIGludCBydiA9IGluZmxhdGUoJnpfLCBaX05PX0ZMVVNIKTsKKyAgICAgICAgaWYgKHJ2ICE9IFpfT0sgJiYgcnYgIT0gWl9TVFJFQU1fRU5EKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJpbmZsYXRlIHJldHVybmVkIGVycm9y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ICYmICFCcm90bGlEZWNvZGVySXNGaW5pc2hlZChkZWNvZGVyXykpIHsKKyAgICAgICAgc3RkOjphcnJheTx1aW50OF90LCBrQ2h1bmtTaXplPiBpZ25vcmVfYnVmZmVyOworICAgICAgICBzaXplX3QgbWF4X2lnbm9yZSA9IHN0ZDo6bWluKGlnbm9yZV9ieXRlc18sIGlnbm9yZV9idWZmZXIuc2l6ZSgpKTsKKyAgICAgICAgc2l6ZV90IGlnbm9yZV9zaXplID0gbWF4X2lnbm9yZTsKKworICAgICAgICB1aW50OF90KiBpZ25vcmVfYnVmZmVyX3B0ciA9IGlnbm9yZV9idWZmZXIuZGF0YSgpOworICAgICAgICBhdXRvIHIgPSBCcm90bGlEZWNvZGVyRGVjb21wcmVzc1N0cmVhbShkZWNvZGVyXywgJmF2YWlsYWJsZV9pbiwgJm5leHRfaW4sICZpZ25vcmVfc2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmlnbm9yZV9idWZmZXJfcHRyLCBudWxscHRyKTsKKyAgICAgICAgaWYgKHIgPT0gQlJPVExJX0RFQ09ERVJfUkVTVUxUX0VSUk9SKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJicm90bGkgZGVjb2RlIGZhaWxlZCI7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0gZWxzZSBpZiAociA9PSBCUk9UTElfREVDT0RFUl9SRVNVTFRfTkVFRFNfTU9SRV9JTlBVVCAmJiBhdmFpbGFibGVfaW4pIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgImJyb3RsaSB1bmV4cGVjdGVkIG5lZWRzIG1vcmUgaW5wdXQiOwogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CisgICAgICAgIGlnbm9yZV9ieXRlc18gLT0gbWF4X2lnbm9yZSAtIGlnbm9yZV9zaXplOworICAgIH0KIAotICAgICAgICBhdXRvIG91dHB1dF9idWZmZXIgPSBvdXRwdXRfYnVmZmVyXzsKKyAgICB3aGlsZSAoYXZhaWxhYmxlX2luICYmICFCcm90bGlEZWNvZGVySXNGaW5pc2hlZChkZWNvZGVyXykpIHsKICAgICAgICAgYXV0byByID0gQnJvdGxpRGVjb2RlckRlY29tcHJlc3NTdHJlYW0oZGVjb2Rlcl8sICZhdmFpbGFibGVfaW4sICZuZXh0X2luLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmb3V0cHV0X2J1ZmZlcl9yZW1haW5pbmdfLCAmb3V0cHV0X2J1ZmZlcl8sIG51bGxwdHIpOwogICAgICAgICBpZiAociA9PSBCUk9UTElfREVDT0RFUl9SRVNVTFRfRVJST1IpIHsKICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgImJyb3RsaSBkZWNvZGUgZmFpbGVkIjsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICBpZiAoIXNpbmtfLT5SZXR1cm5EYXRhKG91dHB1dF9idWZmZXIsIG91dHB1dF9idWZmZXJfIC0gb3V0cHV0X2J1ZmZlcikpIHsKKyAgICAgICAgfSBlbHNlIGlmIChyID09IEJST1RMSV9ERUNPREVSX1JFU1VMVF9ORUVEU19NT1JFX0lOUFVUICYmIGF2YWlsYWJsZV9pbikgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiYnJvdGxpIHVuZXhwZWN0ZWQgbmVlZHMgbW9yZSBpbnB1dCI7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KLSAgICAgICAgbmVlZHNfbW9yZV9vdXRwdXQgPSAociA9PSBCUk9UTElfREVDT0RFUl9SRVNVTFRfTkVFRFNfTU9SRV9PVVRQVVQpOwogICAgIH0KLSAgICByZXR1cm4gdHJ1ZTsKLX0KIAotc3RkOjp1bmlxdWVfcHRyPElEZWNvbXByZXNzb3I+IElEZWNvbXByZXNzb3I6OkJyb3RsaSgpIHsKLSAgIC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3RlZCBvdXRwdXQgc2l6ZTogIgorICAgICAgICAgICAgICAgICAgICAgICA8PCBieXRlc19kZWNvbXByZXNzZWQgPDwgIiwgYWN0dWFsOiAiIDw8IGJ5dGVzX2RlY29tcHJlc3NlZDsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgICAgICBDSEVDS19MRShieXRlc19kZWNvbXByZXNzZWQsIGRlY29kZV9idWZmZXJfc2l6ZSk7CisKKyAgICAgICAgaWYgKGlnbm9yZV9ieXRlcyA+IGJ5dGVzX2RlY29tcHJlc3NlZCkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiSWdub3JpbmcgbW9yZSBieXRlcyB0aGFuIGV4aXN0IGluIHN0cmVhbSAoaWdub3JpbmcgIiA8PCBpZ25vcmVfYnl0ZXMKKyAgICAgICAgICAgICAgICAgICAgICAgPDwgIiwgZ290ICIgPDwgYnl0ZXNfZGVjb21wcmVzc2VkIDw8ICIpIjsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICh0ZW1wLmVtcHR5KCkpIHsKKyAgICAgICAgICAgIC8vIExaNCdzIEFQSSBoYXMgbm8gd2F5IHRvIHNpbmsgb3V0IHRoZSBmaXJzdCBOIGJ5dGVzIG9mIGRlY29kaW5nLAorICAgICAgICAgICAgLy8gc28gd2UgcmVhZCB0aGVtIGFsbCBpbiBhbmQgbWVtbW92ZSgpIHRvIGRyb3AgdGhlIHBhcnRpYWwgcmVhZC4KKyAgICAgICAgICAgIGlmIChpZ25vcmVfYnl0ZXMpIHsKKyAgICAgICAgICAgICAgICBtZW1tb3ZlKGRlY29kZV9idWZmZXIsIGRlY29kZV9idWZmZXIgKyBpZ25vcmVfYnl0ZXMsCisgICAgICAgICAgICAgICAgICAgICAgICBieXRlc19kZWNvbXByZXNzZWQgLSBpZ25vcmVfYnl0ZXMpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc2lua18tPlJldHVybkRhdGEob3V0cHV0X2J1ZmZlciwgb3V0cHV0X3NpemUpOwotICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICByZXR1cm4gYnl0ZXNfZGVjb21wcmVzc2VkIC0gaWdub3JlX2J5dGVzOwogICAgICAgICB9CisKKyAgICAgICAgc2l6ZV90IG1heF9jb3B5ID0gc3RkOjptaW4oYnl0ZXNfZGVjb21wcmVzc2VkIC0gaWdub3JlX2J5dGVzLCBidWZmZXJfc2l6ZSk7CisgICAgICAgIG1lbWNweShidWZmZXIsIHRlbXAuZGF0YSgpICsgaWdub3JlX2J5dGVzLCBtYXhfY29weSk7CisgICAgICAgIHJldHVybiBtYXhfY29weTsKKyAgICB9Cit9OworCitjbGFzcyBac3RkRGVjb21wcmVzc29yIGZpbmFsIDogcHVibGljIElEZWNvbXByZXNzb3IgeworICBwdWJsaWM6CisgICAgc3NpemVfdCBEZWNvbXByZXNzKHZvaWQqIGJ1ZmZlciwgc2l6ZV90IGJ1ZmZlcl9zaXplLCBzaXplX3QgZGVjb21wcmVzc2VkX3NpemUsCisgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBpZ25vcmVfYnl0ZXMgPSAwKSBvdmVycmlkZSB7CisgICAgICAgIGlmIChidWZmZXJfc2l6ZSA8IGRlY29tcHJlc3NlZF9zaXplIC0gaWdub3JlX2J5dGVzKSB7CisgICAgICAgICAgICBMT0coSU5GTykgPDwgImJ1ZmZlciBzaXplICIgPDwgYnVmZmVyX3NpemUKKyAgICAgICAgICAgICAgICAgICAgICA8PCAiIGlzIG5vdCBsYXJnZSBlbm91Z2ggdG8gaG9sZCBkZWNvbXByZXNzZWQgZGF0YS4gRGVjb21wcmVzc2VkIHNpemUgIgorICAgICAgICAgICAgICAgICAgICAgIDw8IGRlY29tcHJlc3NlZF9zaXplIDw8ICIsIGlnbm9yZV9ieXRlcyAiIDw8IGlnbm9yZV9ieXRlczsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAg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XRfYnVmZmVyLnNpemUoKSkgewogICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiRmFpbGVkIHRvIHJlYWQgYWxsIGlucHV0IGF0IG9uY2UuIEV4cGVjdGVkOiAiIDw8IGlucHV0X2J1ZmZlci5zaXplKCkKICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBhY3R1YWw6ICIgPDwgYnl0ZXNfcmVhZDsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQotICAgICAgICBjb25zdCBpbnQgYnl0ZXNfZGVjb21wcmVzc2VkID0KLSAgICAgICAgICAgICAgICBMWjRfZGVjb21wcmVzc19zYWZlKGlucHV0X2J1ZmZlci5kYXRhKCksIHN0YXRpY19jYXN0PGNoYXIqPihvdXRwdXRfYnVmZmVyKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0X2J1ZmZlci5zaXplKCksIG91dHB1dF9zaXplKTsKKyAgICAgICAgY29uc3QgYXV0byBieXRlc19kZWNvbXByZXNzZWQgPSBaU1REX2RlY29tcHJlc3Mob3V0cHV0X2J1ZmZlciwgb3V0cHV0X3NpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0X2J1ZmZlci5kYXRhKCksIGlucHV0X2J1ZmZlci5zaXplKCkpOwogICAgICAgICBpZiAoYnl0ZXNfZGVjb21wcmVzc2VkICE9IG91dHB1dF9zaXplKSB7Ci0gICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gZGVjb21wcmVzcyBMWjQgYmxvY2ssIGV4cGVjdGVkIG91dHB1dCBzaXplOiAiIDw8IG91dHB1dF9zaXplCisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gZGVjb21wcmVzcyBaU1REIGJsb2NrLCBleHBlY3RlZCBvdXRwdXQgc2l6ZTogIiA8PCBvdXRwdXRfc2l6ZQogICAgICAgICAgICAg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V0dXJuIGZhbHNlOwogICAgIH0KIAotICAgIGlmIChoZWFkZXJfLm1hZ2ljICE9IGtDb3dNYWdpY051bWJlcikgewotICAgICAgICBMT0coRVJST1IpIDw8ICJIZWFkZXIgTWFnaWMgY29ycnVwdGVkLiBNYWdpYzogIiA8PCBoZWFkZXJfLm1hZ2ljCi0gICAgICAgICAgICAgICAgICAgPDwgIkV4cGVjdGVkOiAiIDw8IGtDb3dNYWdpY051bWJlcjsKLSAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIHN0ZDo6dW5pcXVlX3B0cjxDb3dQYXJzZXJCYXNlPiBwYXJzZXI7CisgICAgc3dpdGNoIChoZWFkZXJfLnByZWZpeC5tYWpvcl92ZXJzaW9uKSB7CisgICAgICAgIGNhc2UgMToKKyAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgcGFyc2VyID0gc3RkOjptYWtlX3VuaXF1ZTxDb3dQYXJzZXJWMj4oKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIDM6CisgICAgICAgICAgICBwYXJzZXIgPSBzdGQ6Om1ha2VfdW5pcXVlPENvd1BhcnNlclYzPigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJVbmtub3duIHZlcnNpb246ICIgPDwgaGVhZGVyXy5wcmVmaXgubWFqb3JfdmVyc2lvbjsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9Ci0gICAgaWYgKGhlYWRlcl8uZm9vdGVyX3NpemUgIT0gc2l6ZW9mKENvd0Zvb3RlcikpIHsKLSAgICAgICAgTE9HKEVSUk9SKSA8PCAiRm9vdGVyIHNpemUgdW5rbm93biwgcmVhZCAiIDw8IGhlYWRlcl8uZm9vdGVyX3NpemUgPDwgIiwgZXhwZWN0ZWQgIgotICAgICAgICAgICAgICAgICAgIDw8IHNpemVvZihDb3dGb290ZXIpOwotICAgICAgICByZXR1cm4gZmFsc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Gx5KGZkXywgJm9wc19idWZmZXItPmRhdGEoKVtjdXJyZW50X29wX251bV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvX2FkZCAqIHNpemVvZihDb3dPcGVyYXRpb24pKSkgewotICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgInJlYWQgb3AgZmFpbGVkIjsKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgICAgICAvLyBQYXJzZSBjdXJyZW50IGNsdXN0ZXIgdG8gZmluZCBzdGFydCBvZiBuZXh0IGNsdXN0ZXIKLSAgICAgICAgd2hpbGUgKGN1cnJlbnRfb3BfbnVtIDwgb3BzX2J1ZmZlci0+c2l6ZSgpKSB7Ci0gICAgICAgICAgICBhdXRvJiBjdXJyZW50X29wID0gb3BzX2J1ZmZlci0+ZGF0YSgpW2N1cnJlbnRfb3BfbnVtXTsKLSAgICAgICAgICAgIGN1cnJlbnRfb3BfbnVtKys7Ci0gICAgICAgICAgICBpZiAoY3VycmVudF9vcC50eXBlID09IGtDb3dYb3JPcCkgewotICAgICAgICAgICAgICAgIGRhdGFfbG9jLT5pbnNlcnQoe2N1cnJlbnRfb3AubmV3X2Jsb2NrLCBkYXRhX3Bvc30pOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcG9zICs9IHNpemVvZihDb3dPcGVyYXRpb24pICsgR2V0TmV4dE9wT2Zmc2V0KGN1cnJlbnRfb3AsIGhlYWRlcl8uY2x1c3Rlcl9vcHMpOwotICAgICAgICAgICAgZGF0YV9wb3MgKz0gY3VycmVudF9vcC5kYXRhX2xlbmd0aCArIEdldE5leHREYXRhT2Zmc2V0KGN1cnJlbnRfb3AsIGhlYWRlcl8uY2x1c3Rlcl9vcHMpOwotCi0gICAgICAgICAgICBpZiAoY3VycmVudF9vcC50eXBlID09IGtDb3dDbHVzdGVyT3ApIHsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudF9vcC50eXBlID09IGtDb3dMYWJlbE9wKSB7Ci0gICAgICAgICAgICAgICAgbGFzdF9sYWJlbF8gPSB7Y3VycmVudF9vcC5zb3VyY2V9OwotCi0gICAgICAgICAgICAgICAgLy8gSWYgd2UgcmVhY2ggdGhlIHJlcXVlc3RlZCBsYWJlbCwgc3RvcCByZWFkaW5nLgotICAgICAgICAgICAgICAgIGlmIChsYWJlbCAmJiBsYWJlbC52YWx1ZSgpID09IGN1cnJlbnRfb3Auc291cmNlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRvbmUgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRfb3AudHlwZSA9PSBrQ293Rm9vdGVyT3ApIHsKLSAgICAgICAgICAgICAgICBmb290ZXJfLmVtcGxhY2UoKTsKLSAgICAgICAgICAgICAgICBDb3dGb290ZXIqIGZvb3RlciA9ICZmb290ZXJfLnZhbHVlKCk7Ci0gICAgICAgICAgICAgICAgbWVtY3B5KCZmb290ZXJfLT5vcCwgJmN1cnJlbnRfb3AsIHNpemVvZihmb290ZXItPm9wKSk7Ci0gICAgICAgICAgICAgICAgb2ZmX3Qgb2ZmcyA9IGxzZWVrKGZkXy5nZXQoKSwgcG9zLCBTRUVLX1NFVCk7Ci0gICAgICAgICAgICAgICAgaWYgKG9mZnMgPCAwIHx8IHBvcyAhPSBzdGF0aWNfY2FzdDx1aW50NjRfdD4ob2ZmcykpIHsKLSAgICAgICAgICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgImxzZWVrIG5leHQgb3AgZmFpbGVkICIgPDwgb2ZmczsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlJlYWRGdWxseShmZF8sICZmb290ZXItPmRhdGEsIHNpem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IGkgPCBvcHNfLT5zaXplKCk7IGkrKykgewotICAgICAgICBhdXRvJiBjdXJyZW50X29wID0gb3BzXy0+ZGF0YSgpW2ldOwotCi0gICAgICAgIGlmIChjdXJyZW50X29wLnR5cGUgPT0ga0Nvd1NlcXVlbmNlT3ApIHsKLSAgICAgICAgICAgIHNpemVfdCBzZXFfbGVuID0gY3VycmVudF9vcC5kYXRhX2xlbmd0aCAvIHNpemVvZih1aW50MzJfdCk7Ci0KLSAgICAgICAgICAgIG1lcmdlX29wX2Jsb2Nrcy0+cmVzaXplKG1lcmdlX29wX2Jsb2Nrcy0+c2l6ZSgpICsgc2VxX2xlbik7Ci0gICAgICAgICAgICBpZiAoIUdldFJhd0J5dGVzKGN1cnJlbnRfb3Auc291cmNlLCAmbWVyZ2Vfb3BfYmxvY2tzLT5kYXRhKClbbnVtX3NlcXNdLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50X29wLmRhdGFfbGVuZ3RoLCAmcmVhZCkpIHsKLSAgICAgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAiRmFpbGVkIHRvIHJlYWQgc2VxdWVuY2Ugb3AhIjsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmb3IgKHNpemVfdCBqID0gbnVtX3NlcXM7IGogPCBudW1fc2VxcyArIHNlcV9sZW47IGorKykgewotICAgICAgICAgICAgICAgIHNlcV9vcHNfc2V0Lmluc2VydChtZXJnZV9vcF9ibG9ja3MtPmRhdGEoKVtqXSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBudW1fc2VxcyArPSBzZXFfbGVuOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKElzTWV0YWRhdGFPcChjdXJyZW50X29wKSkgewotICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoIWhhc19zZXFfb3BzXyAmJiBJc09yZGVyZWRPcChjdXJyZW50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tzLT5zaXplKCkgKyBzZXFfbGVuKTsKKyAgICAgICAgICAgIGlmICghR2V0UmF3Qnl0ZXMoJmN1cnJlbnRfb3AsICZtZXJnZV9vcF9ibG9ja3MtPmRhdGEoKVtudW1fc2Vxc10sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRfb3AuZGF0YV9sZW5ndGgsICZyZWFkKSkgeworICAgICAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gcmVhZCBzZXF1ZW5jZSBvcCEiOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoc2l6ZV90IGogPSBudW1fc2VxczsgaiA8IG51bV9zZXFzICsgc2VxX2xlbjsgaisrKSB7CisgICAgICAgICAgICAgICAgc2VxX29wc19zZXQuaW5zZXJ0KG1lcmdlX29wX2Jsb2Nrcy0+YXQoaikpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbnVtX3NlcXMgKz0gc2VxX2xlbjsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChJc01ldGFkYXRhT3AoY3VycmVudF9vcCkpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisKKyAgICAgICAgLy8gU2VxdWVuY2Ugb3BzIG11c3QgYmUgdGhlIGZpcnN0IG9wcyBpbiB0aGUgc3RyZWFtLgorICAgICAgICBpZiAoc2VxX29wc19zZXQuZW1wdHkoKSAmJiBJc09yZGVyZWRPcChjdXJyZW50X29wKSkgeworICAgICAgICAgICAgbWVyZ2Vfb3BfYmxvY2tzLT5lbXBsYWNlX2JhY2soY3VycmVudF9vcC5uZXdfYmxvY2spOworICAgICAgICB9IGVsc2UgaWYgKHNlcV9vcHNfc2V0LmNvdW50KGN1cnJlbnRfb3AubmV3X2Jsb2NrKSA9PSAwKSB7CisgICAgICAgICAgICBvdGhlcl9vcHMtPnB1c2hfYmFjayhjdXJyZW50X29wLm5ld19ibG9jay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gb3BzLiBJZiB3ZSBmaW5kIHRoZSBmaXJzdCBvcCB3aGljaAorICAgICAgICAvLyBpcyBub3Qgb3JkZXJlZCwgdGhhdCBtZWFucyBhbGwgb3JkZXJlZCBvcHMgcHJvY2Vzc2luZworICAgICAgICAvLyBoYXMgYmVlbiBjb21wbGV0ZWQuCisgICAgICAgIGlmICghSXNPcmRlcmVkT3AoKm9wKSkgeworICAgICAgICAgICAgbm9uX29yZGVyZWRfb3BfZm91bmQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgLy8gU2luY2UsIGFsbCBvcmRlcmVkIG9wcyBwcm9jZXNzaW5nIGhhcyBiZWVuIGNvbXBsZXRlZCwKKyAgICAgICAgLy8gY2hlY2sgdGhhdCB0aGUgc3Vic2VxdWVudCBvcHMgYXJlIG5vdCBvcmRlcmVkLgorICAgICAgICBpZiAobm9uX29yZGVyZWRfb3BfZm91bmQgJiYgSXNPcmRlcmVkT3AoKm9wKSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiSW52YWxpZCBzZXF1ZW5jZSAtIG5vbi1vcmRlcmVkIGFuZCBvcmRlcmVkIG9wcyIKKyAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBjYW5ub3QgYmUgbWl4ZWQgZHVyaW5nIHNlcXVlbmNlIGdlbmVyYXRpb24iOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFHZXRTb3VyY2VPZmZzZXQob3AsICZvZmZzZXQpKSB7CiAgICAgICAgICAgICBpdHItPk5leHQoKTsKICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICB9CiAKLSAgICAgICAgQ293T3BlcmF0aW9uKiBvdmVyd3JpdGUgPSBudWxscHRyOworICAgICAgICB1aW50NjRfdCBibG9jayA9IEdldEJsb2NrRnJvbU9mZnNldChoZWFkZXJfLCBvZmZzZXQpOworICAgICAgICBib29sIG1pc2FsaWduZWQgPSAoR2V0QmxvY2tSZWxh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1ZV9wdHI8SURlY29tcHJlc3Nvcj4gZGVjb21wcmVzc29yOwotICAgIHN3aXRjaCAob3AuY29tcHJlc3Npb24pIHsKKyAgICBzd2l0Y2ggKEdldENvbXByZXNzaW9uVHlwZSgpKSB7CiAgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzTm9uZToKLSAgICAgICAgICAgIGRlY29tcHJlc3NvciA9IElEZWNvbXByZXNzb3I6OlVuY29tcHJlc3NlZCgpOwogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGNhc2Uga0Nvd0NvbXByZXNzR3o6CiAgICAgICAgICAgICBkZWNvbXByZXNzb3IgPSBJRGVjb21wcmVzc29yOjpHeigpOwpAQCAtNzgyLDI0ICs3MTQsNDkgQEAKICAgICAgICAgY2FzZSBrQ293Q29tcHJlc3NCcm90bGk6CiAgICAgICAgICAgICBkZWNvbXByZXNzb3IgPSBJRGVjb21wcmVzc29yOjpCcm90bGkoKTsKICAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIGtDb3dDb21wcmVzc1pzdGQ6CisgICAgICAgICAgICBpZiAoaGVhZGVyXy5ibG9ja19zaXplICE9IG9wLT5kYXRhX2xlbmd0aCkgeworICAgICAgICAgICAgICAgIGRlY29tcHJlc3NvciA9IElEZWNvbXByZXNzb3I6OlpzdGQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIGtDb3dDb21wcmVzc0x6NDoKLSAgICAgICAgICAgIGRlY29tcHJlc3NvciA9IElEZWNvbXByZXNzb3I6Okx6NCgpOworICAgICAgICAgICAgaWYgKGhlYWRlcl8uYmxvY2tfc2l6ZSAhPSBvcC0+ZGF0YV9sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBkZWNvbXByZXNzb3IgPSBJRGVjb21wcmVzc29yOjpMejQoKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICA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NlOworICAgICAgICB9CisKKyAgICAgICAgc2l6ZV90IG51bV9ibG9ja3MgPSB0b19yZWFkIC8gQkxPQ0tfU1o7CisgICAgICAgIHVpbnQ2NF90IGJ1ZmZlcl9vZmZzZXQgPSAwOworICAgICAgICBvZmZfdCBmb2Zmc2V0ID0gZmlsZV9vZmZzZXQ7CisKKyAgICAgICAgd2hpbGUgKG51bV9ibG9ja3MpIHsKKyAgICAgICAgICAgIGNvbnN0IHZvaWQqIGJ1ZnB0ciA9IChjaGFyKilidWZmZXIuZ2V0KCkgKyBidWZmZXJfb2Zmc2V0OworICAgICAgICAgICAgdWludDY0X3QgYmxraW5kZXggPSBmb2Zmc2V0IC8gQkxPQ0tfU1o7CisKKyAgICAgICAgICAgIHVpbnQ4X3QgY2hlY2tzdW1bMzJdOworICAgICAgICAgICAgU0hBMjU2KGJ1ZnB0ciwgQkxPQ0tfU1osIGNoZWNrc3VtKTsKKyAgICAgICAgICAgIHN0ZDo6c3RyaW5nIGhhc2ggPSBUb0hleFN0cmluZyhjaGVja3N1bSwgc2l6ZW9mKGNoZWNrc3VtKSk7CisKKyAgICAgICAgICAgIGlmIChjcmVhdGVfc25hcHNob3RfcGF0Y2hfKSB7CisgICAgICAgICAgICAgICAgaWYgKCFXcml0ZVNuYXBzaG90KGJ1ZnB0ciwgYmxraW5kZXgsIGhhc2gpKSB7CisgICAgICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIldyaXRlU25hcHNob3QgZmFpbGVkIGZvciBibG9jazogIiA8PCBibGtpbmRleDsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2soc291cmNlX2Jsb2NrX2hhc2hfbG9ja18pOworICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNvdXJjZV9ibG9ja19oYXNoXy5jb3VudChoYXNoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2VfYmxvY2tfaGFzaF9baGFzaF0gPSBibGtpbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJ1ZmZlcl9vZmZzZXQgKz0gQkxPQ0tfU1o7CisgICAgICAgICAgICBmb2Zmc2V0ICs9IEJMT0NLX1NaOworICAgICAgICAgICAgbnVtX2Jsb2NrcyAtPSAxOworICAgICAgICB9CisKKyAgICAgICAgZmlsZV9vZmZzZXQgKz0gKHNraXBfYmxvY2tzICogdG9fcmVhZCk7CisgICAgICAgIGlmIChmaWxlX29mZnNldCA+PSBkZXZfc3opIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgQ3JlYXRlU25hcHNob3Q6OlBhcnNlUGFydGl0aW9uKCkgeworICAgIHVuaXF1ZV9mZCBmZChURU1QX0ZBSUxVUkVfUkVUUlkob3BlbihwYXJzaW5nX2ZpbGVfLmNfc3RyKCksIE9fUkRPTkxZKSkpOworICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAib3BlbiBmYWlsZWQ6ICIgPDwgcGFyc2luZ19maWxlXzsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHVpbnQ2NF90IGRldl9zeiA9IGxzZWVrKGZkLmdldCgpLCAwLCBTRUVLX0VORCk7CisgICAgaWYgKCFkZXZfc3opIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ291bGQgbm90IGRldGVybWluZSBibG9jayBkZXZpY2Ugc2l6ZTogIiA8PCBwYXJzaW5nX2ZpbGVfOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgaWYgKCFJc0Jsb2NrQWxpZ25lZChkZXZfc3opKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgImRldl9zejogIiA8PCBkZXZfc3ogPDwgIiBpcyBub3QgYmxvY2sgYWxpZ25lZCI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpbnQgbnVtX3RocmVhZHMgPSBrTnVtVGhyZWFkczsKKworICAgIHN0ZDo6dmVjdG9yPHN0ZDo6ZnV0dXJlPGJvb2w+PiB0aHJlYWRzOworICAgIG9mZl90IHN0YXJ0X29mZnNldCA9IDA7CisgICAgY29uc3QgaW50IHNraXBfYmxvY2tzID0gbnVtX3RocmVhZHM7CisKKyAgICB3aGlsZSAobnVtX3RocmVhZHMpIHsKKyAgICAgICAgdGhyZWFkcy5lbXBsYWNlX2JhY2soc3RkOjphc3luYyhzdGQ6OmxhdW5jaDo6YXN5bmMsICZDcmVhdGVTbmFwc2hvdDo6UmVhZEJsb2NrcywgdGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydF9vZmZzZXQsIHNraXBfYmxvY2tzLCBkZXZfc3opKTsKKyAgICAgICAgc3RhcnRfb2Zmc2V0ICs9IGtCbG9ja1NpemVUb1JlYWQ7CisgICAgICAgIG51bV90aHJlYWRzIC09IDE7CisgICAgICAgIGlmIChzdGFydF9vZmZzZXQgPj0gZGV2X3N6KSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIGJvb2wgcmV0ID0gdHJ1ZTsKKyAgICBmb3IgKGF1dG8mIHQgOiB0aHJlYWRzKSB7CisgICAgICAgIHJldCA9IHQuZ2V0KCkgJiYgcmV0OworICAgIH0KKworICAgIGlmIChyZXQgJiYgY3JlYXRlX3NuYXBzaG90X3BhdGNoXyAmJiAhd3JpdGVyXy0+RmluYWxpemUoKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJGaW56YWxpemUgZmFpbGVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOwor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2ggKGhlYWRlci5wcmVmaXgubWFqb3JfdmVyc2lvbikgeworICAgICAgICBjYXNlIDE6CisgICAgICAgIGNhc2UgMjoKKyAgICAgICAgICAgIHJldHVybiBTaG93UmF3T3BTdHJlYW1WMihmZCwgaGVhZGVyKTsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgInVua25vd24gQ09XIHZlcnNpb246ICIgPDwgaGVhZGVyLnByZWZpeC5tYWpvcl92ZXJzaW9uOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KK30KKworc3RhdGljIGJvb2wgSW5zcGVjdChjb25zdCBzdGQ6OnN0cmluZyYgcGF0aCkgeworICAgIHVuaXF1ZV9mZCBmZChvcGVuKHBhdGguY19zdHIoKSwgT19SRE9OTFkpKTsKICAgICBpZiAoZmQgPCAwKSB7CiAgICAgICAgIFBMT0coRVJST1IpIDw8ICJvcGVuIGZhaWxlZDogIiA8PCBwYXRoOwogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgdW5pcXVlX2ZkIGV4dHJhY3RfdG87CisgICAgaWYgKCFGTEFHU19leHRyYWN0X3RvLmVtcHR5KCkpIHsKKyAgICAgICAgZXh0cmFjdF90by5yZXNldChvcGVuKEZMQUdTX2V4dHJhY3RfdG8uY19zdHIoKSwgT19SRFdSIHwgT19DUkVBVCB8IE9fVFJVTkMsIDA2NjQpKTsKKyAgICAgICAgaWYgKGV4dHJhY3RfdG8gPCAwKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAiY291bGQgbm90IG9wZW4gIiA8PCBGTEFHU19leHRyYWN0X3RvIDw8ICIgZm9yIHdyaXRpbmciOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCiAgICAgQ293UmVhZGVyIHJlYWRlcjsKKworICAgIGF1dG8gc3RhcnRfdGltZSA9IHN0ZDo6Y2hyb25vOjpzdGVhZHlfY2xvY2s6Om5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3RkOjpjZXJyIDw8ICJGYWlsZWQgdG8gZGVjb21wcmVzcyBmb3IgOiIgPDwgKm9wIDw8ICJcbiI7CiAgICAgICAgICAgICAgICAgc3VjY2VzcyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIGlmIChvcHQuc2hvd19iYWQpIFNob3dCYWQocmVhZGVyLCBvcCk7CisgICAgICAgICAgICAgICAgaWYgKEZMQUdTX3Nob3dfYmFkX2RhdGEpIFNob3dCYWQocmVhZGVyLCBvcCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBzaW5rLlJlc2V0KCk7CisgICAgICAgICAgICBpZiAoZXh0cmFjdF90byA+PSAwKSB7CisgICAgICAgICAgICAgICAgb2ZmX3Qgb2Zmc2V0ID0gdWludDY0X3Qob3AtPm5ld19ibG9jaykgKiBoZWFkZXIuYmxvY2tfc2l6ZTsKKyAgICAgICAgICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OldyaXRlRnVsbHlBdE9mZnNldChleHRyYWN0X3RvLCBidWZmZXIuZGF0YSgpLCBidWZmZXIuc2l6ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCkpIHsKKyAgICAgICAgICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgImZhaWxlZCB0byB3cml0ZSBibG9jayAiIDw8IG9wLT5uZXdfYmxvY2s7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoZXh0cmFjdF90byA+PSAwICYmICFJc01ldGFkYXRhT3AoKm9wKSAmJiBvcC0+dHlwZSgpICE9IGtDb3daZXJvT3ApIHsKKyAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJDYW5ub3QgZXh0cmFjdCBvcCB5ZXQ6ICIgPDwgKm9wOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICA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ICAgIHN0ZDo6Y291dCA8PCAiU2VxdWVuY2UgZm9yICIgPDwgKm9wIDw8ICIgaXMgOlxuIjsKICAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNlcV9sZW47IGkrKykgewogICAgICAgICAgICAgICAgICAgICBzdGQ6OmNvdXQgPDwgc3RkOjpzZXRmaWxsKCcwJykgPDwgc3RkOjpzZXR3KDYpIDw8IG1lcmdlX29wX2Jsb2Nrc1tpXSA8PCAiLCAiOwogICAgICAgICAgICAgICAgICAgICBpZiAoKGkgKyAxKSAlIDEwID09IDAgfHwgaSArIDEgPT0gc2VxX2xlbikgc3RkOjpjb3V0IDw8ICJcbiI7CkBAIC0xODgsMjQgKzIzNiwyNiBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAKLSAgICAgICAgaWYgKG9wLnR5cGUgPT0ga0Nvd0NvcHlPcCkgeworICAgICAgICBpZiAob3AtPnR5cGUoKSA9PSBrQ293Q29weU9wKSB7CiAgICAgICAgICAgICBjb3B5X29wcysrOwotICAgICAgICB9IGVsc2UgaWYgKG9wLnR5cGUgPT0ga0Nvd1JlcGxhY2VPcCkgeworICAgICAgICB9IGVsc2UgaWYgKG9wLT50eXBlKCkgPT0ga0Nvd1JlcGxhY2VPcCkgewogICAgICAgICAgICAgcmVwbGFjZV9vcHMrKzsKLSAgICAgICAgfSBlbHNlIGlmIChvcC50eXBlID09IGtDb3daZXJvT3ApIHsKKyAgICAgICAgfSBlbHNlIGlmIChvcC0+dHlwZSgpID09IGtDb3daZXJvT3ApIHsKICAgICAgICAgICAgIHplcm9fb3BzKys7Ci0gICAgICAgIH0gZWxzZSBpZiAob3AudHlwZSA9PSBrQ293WG9yT3ApIHsKKyAgICAgICAgfSBlbHNlIGlmIChvcC0+dHlwZSgpID09IGtDb3dYb3JPcCkgewogICAgICAgICAgICAgeG9yX29wcysrOwogICAgICAgICB9CiAKICAgICAgICAgaXRlci0+TmV4dCgpOwogICAgIH0KIAotICAgIGl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Agb3B0LmRlY29tcHJlc3MgPSBmYWxzZTsKLSAgICBvcHQuc2hvd19iYWQgPSBmYWxzZTsKLSAgICBvcHQuaXRlcl90eXBlID0gYW5kcm9pZDo6c25hcHNob3Q6Ok5vcm1hbDsKLSAgICBvcHQudmVyaWZ5X3NlcXVlbmNlID0gZmFsc2U7Ci0gICAgb3B0LmluY2x1ZGVfbWVyZ2VkID0gZmFsc2U7Ci0gICAgd2hpbGUgKChjaCA9IGdldG9wdChhcmdjLCBhcmd2LCAic2RibW5vbHZhIikpICE9IC0xKSB7Ci0gICAgICAgIHN3aXRjaCAoY2gpIHsKLSAgICAgICAgICAgIGNhc2UgJ3MnOgotICAgICAgICAgICAgICAgIG9wdC5zaWxlbnQgPSB0cnVlOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAnZCc6Ci0gICAgICAgICAgICAgICAgb3B0LmRlY29tcHJlc3MgPSB0cnVlOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAnYic6Ci0gICAgICAgICAgICAgICAgb3B0LnNob3dfYmFkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgJ20nOgotICAgICAgICAgICAgICAgIG9wdC5pdGVyX3R5cGUgPSBhbmRyb2lkOjpzbmFwc2hvdDo6UmV2TWVyZ2U7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlICduJzoKLSAgICAgICAgICAgICAgICBvcHQuaXRlcl90eXBlID0gYW5kcm9pZDo6c25hcHNob3Q6Ok1lcmdlOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSAnbyc6Ci0gICAgICAgICAgICAgICAgb3B0LnNob3dfc2VxID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgJ2wnOgotICAgICAgICAgICAgICAgIG9wdC5zaG93X29wc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gKiBzaXplb2YoQ293T3BlcmF0aW9uVjIpOworICAgIH0gZWxzZSB7CisgICAgICAgIGRhdGFfcG9zID0gcG9zICsgc2l6ZW9mKENvd09wZXJhdGlvblYyKTsKKyAgICB9CisKKyAgICBhdXRvIG9wc19idWZmZXIgPSBzdGQ6Om1ha2Vfc2hhcmVkPHN0ZDo6dmVjdG9yPENvd09wZXJhdGlvblYyPj4oKTsKKyAgICB1aW50NjRfdCBjdXJyZW50X29wX251bSA9IDA7CisgICAgdWludDY0X3QgY2x1c3Rlcl9vcHMgPSBoZWFkZXJfLmNsdXN0ZXJfb3BzID86IDE7CisgICAgYm9vbCBkb25lID0gZmFsc2U7CisKKyAgICAvLyBBbHRlcm5hdGluZyBvcCBjbHVzdGVycyBhbmQgZGF0YQorICAgIHdoaWxlICghZG9uZSkgeworICAgICAgICB1aW50NjRfdCB0b19hZGQgPSBzdGQ6Om1pbihjbHVzdGVyX29wcywgKGZkX3NpemVfIC0gcG9zKSAvIHNpemVvZihDb3dPcGVyYXRpb25WMikpOworICAgICAgICBpZiAodG9fYWRkID09IDApIGJyZWFrOworICAgICAgICBvcHNfYnVmZmVyLT5yZXNpemUoY3VycmVudF9vcF9udW0gKyB0b19hZGQpOworICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlJlYWRGdWxseShmZCwgJm9wc19idWZmZXItPmRhdGEoKVtjdXJyZW50X29wX251bV0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvX2FkZCAqIHNpemVvZihDb3dPcGVyYXRpb25WMikpKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAicmVhZCBvcCBmYWlsZWQiOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIC8vIFBhcnNlIGN1cnJlbnQgY2x1c3RlciB0byBmaW5kIHN0YXJ0IG9mIG5leHQgY2x1c3RlcgorICAgICAgICB3aGlsZSAoY3VycmVudF9vcF9udW0gPCBvcHNfYnVmZmVyLT5zaXplKCkpIHsKKyAgICAgICAgICAgIGF1dG8mIGN1cnJlbnRfb3AgPSBvcHNfYnVmZmVyLT5kYXRhKClbY3VycmVudF9vcF9udW1dOworICAgICAgICAgICAgY3VycmVudF9vcF9udW0rKzsKKyAgICAgICAgICAgIGlmIChjdXJyZW50X29wLnR5cGUgPT0ga0Nvd1hvck9wKSB7CisgICAgICAgICAgICAgICAgeG9yX2RhdGFfbG9jLT5pbnNlcnQoe2N1cnJlbnRfb3AubmV3X2Jsb2NrLCBkYXRhX3Bvc30pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9zICs9IHNpemVvZihDb3dPcGVyYXRpb25WMikgKyBHZXROZXh0T3BPZmZzZXQoY3VycmVudF9vcCwgaGVhZGVyXy5jbHVzdGVyX29wcyk7CisgICAgICAgICAgICBkYXRhX3BvcyArPSBjdXJyZW50X29wLmRhdGFfbGVuZ3RoICsgR2V0TmV4dERhdGFPZmZzZXQoY3VycmVudF9vcCwgaGVhZGVyXy5jbHVzdGVyX29wcyk7CisKKyAgICAgICAgICAgIGlmIChjdXJyZW50X29wLnR5cGUgPT0ga0Nvd0NsdXN0ZXJPcCkgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50X29wLnR5cGUgPT0ga0Nvd0xhYmVsT3ApIHsKKyAgICAgICAgICAgICAgICBsYXN0X2xhYmVsXyA9IHtjdXJyZW50X29wLnNvdXJjZX07CisKKyAgICAgICAgICAgICAgICAvLyBJZiB3ZSByZWFjaCB0aGUgcmVxdWVzdGVkIGxhYmVsLCBzdG9wIHJlYWRpbmcuCisgICAgICAgICAgICAgICAgaWYgKGxhYmVsICYmIGxhYmVsLnZhbHVlKCkgPT0gY3VycmVudF9vcC5zb3VyY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgZG9uZSA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudF9vcC50eXBlID09IGtDb3dGb290ZXJPcCkgeworICAgICAgICAgICAgICAgIGZvb3Rlcl8uZW1wbGFjZSgpOworICAgICAgICAgICAgICAgIENvd0Zvb3RlciogZm9vdGVyID0gJmZvb3Rlcl8udmFsdWUoKTsKKyAgICAgICAgICAgICAgICBtZW1jcHkoJmZvb3Rlcl8tPm9wLCAmY3VycmVudF9vcCwgc2l6ZW9mKGZvb3Rlci0+b3ApKTsKKyAgICAgICAgICAgICAgICBvZmZfdCBvZmZzID0gbHNlZWsoZmQuZ2V0KCksIHBvcywgU0VFS19TRVQpOworICAgICAgICAgICAgICAgIGlmIChvZmZzIDwgMCB8fCBwb3MgIT0gc3RhdGljX2Nhc3Q8dWludDY0X3Q+KG9mZnMpKSB7CisgICAgICAgICAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJsc2VlayBuZXh0IG9wIGZhaWxlZCAiIDw8IG9mZnM7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKCFhbmRyb2lkOjpiYXNlOjpSZWFkRnVsbHkoZmQsICZmb290ZXItPnVudXNlZCwgc2l6ZW9mKGZvb3Rlci0+dW51c2VkKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ291bGQgbm90IHJlYWQgQ09XIGZvb3RlciI7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBEcm9wIHRoZSBmb290ZXIgZnJvbSB0aGUgb3Agc3RyZWFtLgorICAgICAgICAgICAgICAgIGN1cnJlbnRfb3BfbnVtLS07CisgICAgICAgICAgICAgICAgZG9uZSA9IHRydWU7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLy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KEVSUk9SKSA8PCAiRGlkIG5vdCBmaW5kIGxhYmVsICIgPDwgbGFiZWwudmFsdWUoKQorICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCBsYXN0IGxhYmVsPSIgPDwgbGFzdF9sYWJlbF8udmFsdWUoKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoIWZvb3Rlcl8pIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiTm8gQ09XIGZvb3RlciBmb3VuZCI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICB1aW50OF90IGNzdW1bMzJdOworICAgIG1lbXNldChjc3VtLCAwLCBzaXplb2YodWludDhfdCkgKiAzMik7CisKKyAgICBpZiAoZm9vdGVyXykgeworICAgICAgICBpZiAob3BzX2J1ZmZlci0+c2l6ZSgpICE9IGZvb3Rlcl8tPm9wLm51bV9vcHMpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIm51bSBvcHMgZG9lcyBub3QgbWF0Y2gsIGV4cGVjdGVkICIgPDwgZm9vdGVyXy0+b3AubnVtX29wcyA8PCAiLCBmb3VuZCAiCisgICAgICAgICAgICAgICAgICAgICAgIDw8IG9wc19idWZmZXItPnNpemUoKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBpZiAob3BzX2J1ZmZlci0+c2l6ZSgpICogc2l6ZW9mKENvd09wZXJhdGlvblYyKSAhPSBmb290ZXJfLT5vcC5vcHNfc2l6ZSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAib3BzIHNpemUgZG9lcyBub3QgbWF0Y2ggIjsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHYyX29wc18gPSBvcHNfYnVmZmVyOworICAgIHYyX29wc18tPnNocmlua190b19maXQoKTsKKyAgICB4b3JfZGF0YV9sb2NfID0geG9y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TWFzazsKKyAgICAgICAgICAgIGlmIChzb3VyY2VfaW5mbyAhPSB2Ml9vcC5zb3VyY2UpIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJPdXQtb2YtcmFuZ2Ugc291cmNlIHZhbHVlIGluIENPVyBvcDogIiA8PCB2Ml9vcDsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKHYyX29wLmNvbXByZXNzaW9uICE9IGtDb3dDb21wcmVzc05vbmUpIHsKKyAgICAgICAgICAgIGlmIChoZWFkZXJfLmNvbXByZXNzaW9uX2FsZ29yaXRobSA9PSBrQ293Q29tcHJlc3NOb25lKSB7CisgICAgICAgICAgICAgICAgaGVhZGVyXy5jb21wcmVzc2lvbl9hbGdvcml0aG0gPSB2Ml9vcC5jb21wcmVzc2lvbjsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoaGVhZGVyXy5jb21wcmVzc2lvbl9hbGdvcml0aG0gIT0gdjJfb3AuY29tcHJlc3Npb24pIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJDT1cgaGFzIG1peGVkIGNvbXByZXNzaW9uIHR5cGVzIHdoaWNoIGlzIG5vdCBzdXBwb3J0ZWQ7IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBwcmV2aW91c2x5IHNhdyAiIDw8IGhlYWRlcl8uY29tcHJlc3Npb25fYWxnb3JpdGhtIDw8ICIsIGdvdCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCB2Ml9vcC5jb21wcmVzc2lvbiA8PCAiLCBvcDogIiA8PCB2Ml9vcDsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbmV3X29wLnNldF9zb3VyY2Uoc291cmNlX2luZm8pOworICAgIH0KKworICAgIG91dC0+aGVhZGVyID0gaGVhZGVyXzsKKyA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lmIChwb3MgPCAwKSB7CisgICAgICAgIFBMT0coRVJST1IpIDw8ICJsc2VlayBlbmQgZmFpbGVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBmZF9zaXplXyA9IHBvczsKKyAgICBoZWFkZXJfID0gaGVhZGVyOworCisgICAgaWYgKGhlYWRlcl8uZm9vdGVyX3NpemUgIT0gMCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJGb290ZXIgc2l6ZSBpc24ndCAwLCByZWFkICIgPDwgaGVhZGVyXy5mb290ZXJfc2l6ZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGlmIChoZWFkZXJfLm9wX3NpemUgIT0gc2l6ZW9mKENvd09wZXJhdGlvblYzKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJPcGVyYXRpb24gc2l6ZSB1bmtub3duLCByZWFkICIgPDwgaGVhZGVyXy5vcF9zaXplIDw8ICIsIGV4cGVjdGVkICIKKyAgICAgICAgICAgICAgICAgICA8PCBzaXplb2YoQ293T3BlcmF0aW9uVjMpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGlmIChoZWFkZXJfLmNsdXN0ZXJfb3BzICE9IDApIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ2x1c3RlciBvcHMgbm90IHN1cHBvcnRlZCBpbiB2MyI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpZiAoaGVhZGVyXy5wcmVmaXgubWFqb3JfdmVyc2lvbiAhPSAzIHx8IGhlYWRlcl8ucHJlZml4Lm1pbm9yX3ZlcnNpb24gIT0gMCkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJIZWFkZXIgdmVyc2lvbiBtaXNtYXRjaCwgIgorICAgICAgICAgICAgICAgICAgIDw8ICJtYWpvciB2ZXJzaW9uOiAiIDw8IGhlYWRlcl8ucHJlZml4Lm1ham9yX3ZlcnNpb24KKyAgICAgICAgICAgIC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RyaW5nPiYgc291cmNlX2RldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6b3B0aW9uYWw8dWludDY0X3Q+IGJsb2NrX2Rldl9zaXplKQorICAgIDogY293XyhzdGQ6Om1vdmUoY293KSksCisgICAgICBibG9ja19zaXplXyhjb3dfLT5HZXRIZWFkZXIoKS5ibG9ja19zaXplKSwKKyAgICAgIHNvdXJjZV9kZXZpY2VfKHNvdXJjZV9kZXZpY2UpLAorICAgICAgYmxvY2tfZGV2aWNlX3NpemVfKGJsb2NrX2Rldl9zaXplLnZhbHVlX29yKDApKSB7CisgICAgY29uc3QgYXV0byYgaGVhZGVyID0gY293Xy0+R2V0SGVhZGVyKCk7CisgICAgYmxvY2tfc2l6ZV8gPSBoZWFkZXIuYmxvY2tfc2l6ZTsKKworICAgIC8vIFBvcHVsYXRlIHRoZSBvcGVyYXRpb24gbWFwLgorICAgIG9wX2l0ZXJfID0gY293Xy0+R2V0T3BJdGVyKGZhbHNlKTsKKyAgICB3aGlsZSAoIW9wX2l0ZXJfLT5BdEVuZCgpKSB7CisgICAgICAgIGNvbnN0IENvd09wZXJhdGlvbiogb3AgPSBvcF9pdGVyXy0+R2V0KCk7CisgICAgICAgIGlmIChJc01ldGFkYXRhT3AoKm9wKSkgeworICAgICAgICAgICAgb3BfaXRlcl8tPk5leHQoKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChvcC0+bmV3X2Jsb2NrID49IG9wc18uc2l6ZSgpKSB7CisgICAgICAgICAgICBvcHNfLnJlc2l6ZShvcC0+bmV3X2Jsb2NrICsgMSwgbnVsbHB0cik7CisgICAgICAgIH0KKyAgICAgICAgb3BzX1tvcC0+bmV3X2Jsb2NrXSA9IG9wOworICAgICAgICBvcF9pdGVyXy0+TmV4dCgpOworICAgIH0KK30KKworLy8gTm90IHN1cHBvcnRlZC4KK2Jvb2wgQ29tcHJlc3NlZFNuYXBzaG90UmVhZGVyOjpPcGVuKGNvbnN0IGNoYXIqLCBpbnQsIG1vZGVfdCkgeworICAgIGVycm5vID0gRUlOVkFMOworICAgIHJldHVybiBmYWxzZTsKK30KKworYm9vbCBDb21wcmVzc2VkU25hcHNob3RSZWFkZXI6Ok9wZW4oY29uc3QgY2hhciosIGludCkgeworICAgIGVycm5vID0gRUlOVkFMOworICAgIHJldHVybiBmYWxzZTsKK30KKworc3NpemVfdCBDb21wcmVzc2VkU25hcHNob3RSZWFkZXI6OldyaXRlKGNvbnN0IHZvaWQqLCBzaXplX3QpIHsKKyAgICBlcnJubyA9IEVJTlZBTDsKKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK2Jvb2wgQ29tcHJlc3NlZFNuYXBzaG90UmVhZGVyOjpCbGtJb2N0bChpbnQsIHVpbnQ2NF90LCB1aW50NjRfdCwgaW50KikgeworICAgIGVycm5vID0gRUlOVkFMOworICAgIHJldHVybiBmYWxzZTsKK30KKworYm9ycm93ZWRfZmQgQ29tcHJlc3NlZFNuYXBzaG90UmVhZGVyOjpHZXRTb3VyY2VGZCgpIHsKKyAgICBpZiAoc291cmNlX2ZkXyA8IDApIHsKKyAgICAgICAgaWYgKCFzb3VyY2VfZGV2aWNlXykgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ29tcHJlc3NlZFNuYXBzaG90UmVhZGVyIG5lZWRzIHNvdXJjZSBkZXZpY2UsIGJ1dCBub25lIHdhcyBzZXQiOworICAgICAgICAgICAgZXJybm8gPSBFSU5WQUw7CisgICAgICAgICAgICByZXR1cm4gey0xfTsKKyAgICAgICAgfQorICAgICAgICBzb3VyY2VfZmRfLnJlc2V0KG9wZW4oc291cmNlX2RldmljZV8tPmNfc3RyKCksIE9fUkRPTkxZIHwgT19DTE9FWEVDKSk7CisgICAgICAgIGlmIChzb3VyY2VfZmRfIDwgMCkgeworICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgIm9wZW4gIiA8PCAqc291cmNl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h1bmsgKyAxOyBjaHVuayA8IGVuZF9jaHVuazsgY2h1bmsrKykgeworICAgICAgICBzc2l6ZV90IHJ2ID0gUmVhZEJsb2NrKGNodW5rLCAwLCBidWZfcG9zLCBidWZfcmVtYWluaW5nKTsKKyAgICAgICAgaWYgKHJ2IDwgMCkgeworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgICAgIG9mZnNldF8gKz0gcnY7CisgICAgICAgIGJ1Zl9wb3MgKz0gcnY7CisgICAgICAgIGJ1Zl9yZW1haW5pbmcgLT0gcnY7CisgICAgfQorCisgICAgaWYgKGJ1Zl9yZW1haW5pbmcpIHsKKyAgICAgICAgc3NpemVfdCBydiA9IFJlYWRCbG9jayhlbmRfY2h1bmssIDAsIGJ1Zl9wb3MsIGJ1Zl9yZW1haW5pbmcpOworICAgICAgICBpZiAocnYgPCAwKSB7CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICAgICAgb2Zmc2V0XyArPSBydjsKKyAgICAgICAgYnVmX3BvcyArPSBydjsKKyAgICAgICAgYnVmX3JlbWFpbmluZyAtPSBydjsKKyAgICB9CisKKyAgICBDSEVDS19FUShidWZfcG9zIC0gcmVpbnRlcnByZXRfY2FzdDx1aW50OF90Kj4oYnVmKSwgY291bnQpOworICAgIENIRUNLX0VRKGJ1Zl9yZW1haW5pbmcsIDApOworCisgICAgZXJybm8gPSAwOworICAgIHJldHVybiBjb3VudDsKK30KKworc3NpemVfdCBDb21wcmVzc2VkU25hcHNob3RSZWFkZXI6OlJlYWRCbG9jayh1aW50NjRfdCBjaHVuaywgc2l6ZV90IHN0YXJ0X29mZnNldCwgdm9pZCogYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgYnVmZmVyX3NpemUpIHsKKyAgICBzaXplX3QgYnl0ZXNfdG9fcmVhZCA9IHN0ZDo6bWluKHN0YXRpY19jYXN0PHNpemVfdD4oYmxvY2tfc2l6ZV8pLCBidWZmZXJfc2l6ZSk7CisKKyAgICAvLyBUaGUgb2Zmc2V0IGlzIHJlbGF0aXZlIHRvIHRoZSBjaHVuazsgd2Ugc2hvdWxkIGJlIHJlYWRpbmcgbm8gbW9yZSB0aGFuCisgICAgLy8gb25lIGNodW5rLgorICAgIENIRUNLKHN0YXJ0X29mZnNldCArIGJ5dGVzX3RvX3JlYWQgPD0gYmxvY2tfc2l6ZV8pOworCisgICAgY29uc3QgQ293T3BlcmF0aW9uKiBvcCA9IG51bGxwdHI7CisgICAgaWYgKGNodW5rIDwgb3BzXy5zaXplKCkpIHsKKyAgICAgICAgb3AgPSBvcHNfW2NodW5rXTsKKyAgICB9CisKKyAgICBpZiAoIW9wIHx8IG9wLT50eXBlKCkgPT0ga0Nvd0NvcHlPcCkgeworICAgICAgICBib3Jyb3dlZF9mZCBmZCA9IEdldFNvdXJjZUZkKCk7CisgICAgICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgICAgIC8vIEdldFNvdXJjZUZkIHNldHMgZXJybm8uCisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKworICAgICAgICBpZiAob3ApIHsKKyAgICAgICAgICAgIHVpbnQ2NF90IHNvdXJjZV9vZmZzZXQ7CisgICAgICAgICAgICBpZiAoIWNvd18tPkdldFNvdXJjZU9mZnNldChvcCwgJnNvdXJjZV9vZmZzZXQpKSB7CisgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiR2V0U291cmNlT2Zmc2V0IGZhaWxlZCBpbiBDb21wcmVzc2VkU25hcHNob3RSZWFkZXIgZm9yIG9wOiAiIDw8ICpvcDsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjaHVuayA9IEdldEJsb2NrRnJvbU9mZnNldChjb3dfLT5HZXRIZWFkZXIoKSwgc291cmNlX29mZnNldCk7CisgICAgICAgIH0KKworICAgICAgICBvZmY2NF90IG9mZnNldCA9IChjaHVuayAqIGJsb2NrX3NpemVfKSArIHN0YXJ0X29mZnNldDsKKyAgICAgICAgaWYgKCFhbmRyb2lkOjpiYXNlOjpSZWFkRnVsbHlBdE9mZnNldChmZCwgYnVmZmVyLCBieXRlc190b19yZWFkLCBvZmZzZXQpKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAicmVhZCAiIDw8ICpzb3VyY2VfZGV2aWNlXzsKKyAgICAgICAgICAgIC8vIFJlYWRGdWxseUF0T2Zmc2V0IHNldHMgZXJybm8uCisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKG9wLT50eXBlKCkgPT0ga0Nvd1plcm9PcCkgeworICAgICAgICBtZW1zZXQoYnVmZmVyLCAwLCBieXRlc190b19yZWFkKTsKKyAgICB9IGVsc2UgaWYgKG9wLT50eXBlKCkgPT0ga0Nvd1JlcGxhY2VPcCkgeworICAgICAgICBpZiAoY293Xy0+UmVhZERhdGEob3AsIGJ1ZmZlciwgYnl0ZXNfdG9fcmVhZCwgc3RhcnRfb2Zmc2V0KSA8IGJ5dGVzX3RvX3JlYWQpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvbXByZXNzZWRTbmFwc2hvdFJlYWRlciBmYWlsZWQgdG8gcmVhZCByZXBsYWNlIG9wIjsKKyAgICAgICAgICAgIGVycm5vID0gRUlPOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfSBlbHNlIGlmIChvcC0+dHlwZSgpID09IGtDb3dYb3JPcCkgeworICAgICAgICBib3Jyb3dlZF9mZCBmZCA9IEdldFNvdXJjZUZkKCk7CisgICAgICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgICAgIC8vIEdldFNvdXJjZUZkIHNldHMgZXJybm8uCisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKworICAgICAgICB1aW50NjRfdCBzb3VyY2Vfb2Zmc2V0OworICAgICAgICBpZiAoIWNvd18tPkdldFNvdXJjZU9mZnNldChvcCwgJnNvdXJjZV9vZmZzZXQpKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJHZXRTb3VyY2VPZmZzZXQgZmFpbGVkIGluIENvbXByZXNzZWRTbmFwc2hvdFJlYWRlciBmb3Igb3A6ICIgPDwgKm9wOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIG9mZjY0X3Qgb2Zmc2V0ID0gc291cmNlX29mZnNldCArIHN0YXJ0X29mZnNldDsKKworICAgICAgICBzdGQ6OnN0cmluZyBkYXRhKGJ5dGVzX3RvX3JlYWQsICdcMCcpOworICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlJlYWRGdWxseUF0T2Zmc2V0KGZkLCBkYXRhLmRhdGEoKSwgZGF0YS5zaXplKCksIG9mZnNldCkpIHsKKyAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJyZWFkICIgPDwgKnNvdXJjZV9kZXZpY2VfOworICAgICAgICAgICAgLy8gUmVhZEZ1bGx5QXRPZmZzZXQgc2V0cyBlcnJuby4KKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChjb3dfLT5SZWFkRGF0YShvcCwgYnVmZmVyLCBieXRlc190b19yZWFkLCBzdGFydF9vZmZzZXQpIDwgYnl0ZXNfdG9fcmVhZCkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ29tcHJlc3NlZFNuYXBzaG90UmVhZGVyIGZhaWxlZCB0byByZWFkIHhvciBvcCI7CisgICAgICAgICAgICBlcnJubyA9IEVJTzsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorCisgICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgYnl0ZXNfdG9fcmVhZDsgaSsrKSB7CisgICAgICAgICAgICAoKGNoYXIqKWJ1ZmZlcilbaV0gXj0gZGF0YVtpXTsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIkNvbXByZXNzZWRTbmFwc2hvdFJlYWRlciB1bmtub3duIG9wIHR5cGU6ICIgPDwgdWludDMyX3Qob3AtPnR5cGUoKSk7CisgICAgICAgIGVycm5vID0gRUlOVkFMOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgLy8gTWVtb3J5Qnl0ZVNpbmsgZG9lc24ndCBkbyBhbnl0aGluZyBpbiBSZXR1cm5CdWZmZXIsIHNvIGRvbid0IGJvdGhlciBjYWxsaW5nIGl0LgorICAgIHJldHVybiBieXRlc190b19yZWFkOworfQorCitvZmY2NF90IENvbXByZXNzZWRTbmFwc2hvdFJlYWRlcjo6U2VlayhvZmY2NF90IG9mZnNldCwgaW50IHdoZW5jZSkgeworICAgIHN3aXRjaCAod2hlbmNlKSB7CisgICAgICAgIGNhc2UgU0VFS19TRVQ6CisgICAgICAgICAgICBvZmZzZXRfID0gb2Zmc2V0OworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgU0VFS19FTkQ6CisgICAgICAgICAgICBvZmZzZXRfID0gc3RhdGljX2Nhc3Q8b2ZmNjRfdD4oYmxvY2tfZGV2aWNlX3NpemVfKSArIG9mZnNldDsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIFNFRUtfQ1VSOgorICAgICAgICAgICAgb2Zmc2V0XyArPSBvZmZzZXQ7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIlVucmVjb2duaXplZCBzZWVrIHdoZW5jZTogIiA8PCB3aGVuY2U7CisgICAgICAgICAgICBlcnJubyA9IEVJTlZBTDsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgcmV0dXJuIG9mZnNldF87Cit9CisKK3VpbnQ2NF90IENvbXByZXNzZWRTbmFwc2hvdFJlYWRlcjo6QmxvY2tE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URVNUX1AoQ29tcHJlc3Npb25UZXN0LCBUaHJlYWRlZEJhdGNoV3JpdGVzKSB7CiAgICAgQ293T3B0aW9ucyBvcHRpb25zOwogICAgIG9wdGlvbnMuY29tcHJlc3Npb24gPSBHZXRQYXJhbSgpOwogICAgIG9wdGlvbnMubnVtX2NvbXByZXNzX3RocmVhZHMgPSAyOwogCi0gICAgQ293V3JpdGVyIHdyaXRlcihvcHRpb25zKTsKKyAgICBDb3dXcml0ZXJWMiB3cml0ZXIob3B0aW9ucywgR2V0Q293RmQoKSk7CiAKLSAgICBBU1NFUlRfVFJVRSh3cml0ZXIuSW5pdGlhbGl6ZShjb3dfLT5mZCkpOworICAgIEFTU0VSVF9UUlVFKHdyaXRlci5Jbml0aWFsaXplKCkpOwogCiAgICAgc3RkOjpzdHJpbmcgeG9yX2RhdGEgPSAiVGhpcyBpcyB0ZXN0IGRhdGEtMS4gVGVzdGluZyB4b3IiOwogICAgIHhvcl9kYXRhLnJlc2l6ZShvcHRpb25zLmJsb2NrX3NpemUsICdcMCcpOwpAQCAtMzM3LDM2ICszMjIsMzcgQEAKICAgICBBU1NFUlRfTkUoaXRlciwgbnVsbHB0cik7CiAKICAgICBpbnQgdG90YWxfYmxvY2tzID0gMDsKLSAgICB3aGlsZSAoIWl0ZXItPkRvbmUoKSkgewotICAgICAgICBhdXRvIG9wID0gJml0ZXItPkdldCgpOworICAgIHdoaWxlICghaXRlci0+QXRFbmQoKSkgeworICAgICAgICBhdXRvIG9wID0gaXRlci0+R2V0KCk7CiAKLSAgICAgICAgaWYgKG9wLT50eXBlID09IGtDb3dYb3JPcCkgeworICAgICAgICBpZiAob3AtPnR5cGUoKSA9PSBrQ293WG9yT3ApIHsKICAgICAgICAgICAgIHRvdGFsX2Jsb2NrcyArPSAxOwotICAgICAgICAgICAgU3RyaW5nU2luayBzaW5rOworICAgICAgICAgICAgc3RkOjpzdHJpbmcgc2luayh4b3JfZGF0YS5zaXplKCksICdcMCcpOwogICAgICAgICAgICAgQVNTRVJUX0VRKG9wLT5uZXdfYmxvY2ssIDUwKTsKLSAgICAgICAgICAgIEFTU0VSVF9FUShvcC0+c291cmNlLCA5ODMxNCk7ICAvLyA0MDk2ICogMjQgKyAxMAotICAgICAgICAgICAgQVNTRVJUX1RSVUUocmVhZGVyLlJlYWREYXRhKCpvcCwgJnNpbmspKTsKLSAgICAgICAgICAgIEFTU0VSVF9FUShzaW5rLnN0cmVhbSgpLCB4b3JfZGF0YSk7CisgICAgICAgICAgICBBU1NFUlRfRVEob3AtPnNvdXJjZSgpLCA5ODMxNCk7ICAvLyA0MDk2ICogMjQgKyAxMAorICAgICAgICAgICAgQVNTRVJUX1RSVUUoUmVhZERhdGEocmVhZGVyLCBvcCwgc2luay5kYXRhKCksIHNpbmsuc2l6ZSgpKSk7CisgICAgICAgICAgICBBU1NFUlRfRVEoc2luaywgeG9yX2RhdGEpOwogICAgICAgICB9CiAKLSAgICAgICAgaWYgKG9wLT50eXBlID09IGtDb3dSZXBsYWNlT3ApIHsKKyAgICAgICAgaWYgKG9wLT50eXBlKCkgPT0ga0Nvd1JlcGxhY2VPcCkgewogICAgICAgICAgICAgdG90YWxfYmxvY2tzICs9IDE7CiAgICAgICAgICAgICBpZiAob3AtPm5ld19ibG9jayA9PSAxMDApIHsKLSAgICAgICAgICAgICAgICBTdHJpbmdTaW5rIHNpbms7Ci0gICAgICAgICAgICAgICAgQVNTRVJUX1RSVUUocmVhZGVyLlJlYWREYXRhKCpvcCwgJnNpbmspKTsKICAgICAgICAgICAgICAgICBkYXRhLnJlc2l6ZShvcHRpb25zLmJsb2NrX3NpemUpOwotICAgICAgICAgICAgICAgIEFTU0VSVF9FUShzaW5rLnN0cmVhbSgpLCBkYXRhKTsKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzaW5rKGRhdGEuc2l6ZSgpLCAnXDAnKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfVFJVRShSZWFkRGF0YShyZWFkZXIsIG9wLCBzaW5rLmRhdGEoKSwgc2luay5zaXplKCkpKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoc2luay5zaXplKCksIGRhdGEuc2l6ZSgpKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoc2luaywgZGF0YSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAob3AtPm5ld19ibG9jayA9PSA2MDAwKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nU2luayBzaW5rOwotICAgICAgICAgICAgICAgIEFTU0VSVF9UUlVFKHJlYWRlci5SZWFkRGF0YSgqb3AsICZzaW5rKSk7CiAgICAgICAgICAgICAgICAgZGF0YTIucmVzaXplKG9wdGlvbnMuYmxvY2tfc2l6ZSk7Ci0gICAgICAgICAgICAgICAgQVNTRVJUX0VRKHNpbmsuc3RyZWFtKCksIGRhdGEyKTsKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzaW5rKGRhdGEyLnNpemUoKSwgJ1wwJyk7CisgICAgICAgICAgICAgICAgQVNTRVJUX1RSVUUoUmVhZERhdGEocmVhZGVyLCBvcCwgc2luay5kYXRhKCksIHNpbmsuc2l6ZSgpKSk7CisgICAgICAgICAgICAgICAgQVNTRVJUX0VRKHNpbmssIGRhdGEyKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChvcC0+bmV3X2Jsb2NrID09IDkwMDApIHsKLSAgICAgICAgICAgICAgICBTdHJpbmdTaW5rIHNpbms7Ci0gICAgICAgICAgICAgICAgQVNTRVJUX1RSVUUocmVhZGVyLlJlYWREYXRhKCpvcCwgJnNpbmspKTsKLSAgICAgICAgICAgICAgICBBU1NFUlRfRVEoc2luay5zdHJlYW0oKSwgZGF0YTMpOworICAgICAgICAgICAgICAgIHN0ZDo6c3RyaW5nIHNpbmsoZGF0YTMuc2l6ZSgpLCAnXDAnKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfVFJVRShSZWFkRGF0YShyZWFkZXIsIG9wLCBzaW5rLmRhdGEoKSwg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AoIWl0ZXItPkF0RW5kKCkpIHsKKyAgICAgICAgYXV0byBvcCA9IGl0ZXItPkdldCgpOwogCi0gICAgICAgIGlmIChvcC0+dHlwZSA9PSBrQ293UmVwbGFjZU9wKSB7CisgICAgICAgIGlmIChvcC0+dHlwZSgpID09IGtDb3dSZXBsYWNlT3ApIHsKICAgICAgICAgICAgIHRvdGFsX2Jsb2NrcyArPSAxOwogICAgICAgICAgICAgaWYgKG9wLT5uZXdfYmxvY2sgPT0gNTApIHsKLSAgICAgICAgICAgICAgICBTdHJpbmdTaW5rIHNpbms7Ci0gICAgICAgICAgICAgICAgQVNTRVJUX1RSVUUocmVhZGVyLlJlYWREYXRhKCpvcCwgJnNpbmspKTsKICAgICAgICAgICAgICAgICBkYXRhLnJlc2l6ZShvcHRpb25zLmJsb2NrX3NpemUpOwotICAgICAgICAgICAgICAgIEFTU0VSVF9FUShzaW5rLnN0cmVhbSgpLCBkYXRhKTsKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZyBzaW5rKGRhdGEuc2l6ZSgpLCAnXDAnKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfVFJVRShSZWFkRGF0YShyZWFkZXIsIG9wLCBzaW5rLmRhdGEoKSwgc2luay5zaXplKCkpKTsKKyAgICAgICAgICAgICAgICBBU1NFUlRfRVEoc2luaywgZGF0YSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAob3AtPm5ld19ibG9jayA9PSAzMDAwKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nU2luayBzaW5rOwotICAgICAgICAgICAgICAgIEFTU0VSVF9UUlVFKHJlYWRlci5SZWFkRGF0YSgqb3AsICZzaW5rKSk7CiAgICAgICAgICAgICAgICAgZGF0YTIucmVzaXplKG9wdGlvbnMuYmxvY2tfc2l6ZSk7Ci0gICAgICAgICAgICAgICAgQVNTRVJUX0VRKHNpbmsuc3RyZWFtKCksIGRhdGEyKTsKKyAgICAgICAgICAgICAgICBzdGQ6OnN0cmluZ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ZXJ0aW9uUmVzdWx0IENvbXBhcmVEYXRhQmxvY2soQ293UmVhZGVyKiByZWFkZXIsIGNvbnN0IENvd09wZXJhdGlvbiYgb3AsCitBc3NlcnRpb25SZXN1bHQgQ29tcGFyZURhdGFCbG9jayhDb3dSZWFkZXIqIHJlYWRlciwgY29uc3QgQ293T3BlcmF0aW9uKiBvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBkYXRhKSB7Ci0gICAgQ293SGVhZGVyIGhlYWRlcjsKLSAgICByZWFkZXItPkdldEhlYWRlcigmaGVhZGVyKTsKKyAgICBjb25zdCBhdXRvJiBoZWFkZXIgPSByZWFkZXItPkdldEhlYWRlcigpOwogCiAgICAgc3RkOjpzdHJpbmcgY21wID0gZGF0YTsKICAgICBjbXAucmVzaXplKGhlYWRlci5ibG9ja19zaXplLCAnXDAnKTsKIAotICAgIFN0cmluZ1Npbmsgc2luazsKLSAgICBpZiAoIXJlYWRlci0+UmVhZERhdGEob3AsICZzaW5rKSkgeworICAgIHN0ZDo6c3RyaW5nIHNpbmsoY21wLnNpemUoKSwgJ1wwJyk7CisgICAgaWYgKCFyZWFkZXItPlJlYWREYXRhKG9wLCBzaW5rLmRhdGEoKSwgc2luay5zaXplKCkpKSB7CiAgICAgICAgIHJldHVybiBBc3NlcnRpb25GYWlsdXJlKCkgPDwgIkZhaWxlZCB0byByZWFkIGRhdGEgYmxvY2siOwogICAgIH0KLSAgICBpZiAoY21wICE9IHNpbmsuc3RyZWFtKCkpIHsKKyAgICBpZiAoY21wICE9IHNpbmspIHsKICAgICAgICAgcmV0dXJuIEFzc2VydGlvbkZhaWx1cmUoKSA8PCAiRGF0YSBibG9ja3MgZGlkIG5vdCBtYXRjaCwgZXhwZWN0ZWQgIiA8PCBjbXAgPDwgIiwgZ290ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCBzaW5rLnN0cmVhbSgpOworICAgICAgICAgICA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ICAgYXV0byBvcCA9IGl0ZXItPkdldCgpOworICAgICAgICBBU1NFUlRfRVEob3AtPnR5cGUoKSwga0Nvd1hvck9wKTsKKyAgICAgICAgQVNTRVJUX0VRKG9wLT5kYXRhX2xlbmd0aCwgNDA5Nik7CisgICAgICAgIEFTU0VSVF9FUShvcC0+bmV3X2Jsb2NrLCA1MCArIGkpOworICAgICAgICBBU1NFUlRfRVEob3AtPnNvdXJjZSgpLCA5ODMxNCArIChpICogb3B0aW9ucy5ibG9ja19zaXplKSk7ICAvLyA0MDk2ICogMjQgKyAxMAorICAgICAgICBBU1NFUlRfVFJVRSgKKyAgICAgICAgICAgICAgICBSZWFkRGF0YShyZWFkZXIsIG9wLCBzaW5rLmRhdGEoKSArIChpICogb3B0aW9ucy5ibG9ja19zaXplKSwgb3B0aW9ucy5ibG9ja19zaXplKSk7CisgICAgICAgIGl0ZXItPk5leHQoKTsKKyAgICAgICAgaSsrOworICAgIH0KKyAgICBBU1NFUlRfRVEoc2luaywgZGF0YSk7CisKKyAgICBBU1NFUlRfRVEoaSwgNSk7Cit9CisKK1RFU1RfRihDb3dUZXN0VjMsIEFsbE9wc1dpdGhDb21wcmVzc2lvbikgeworICAgIENvd09wdGlvbnMgb3B0aW9uczsKKyAgICBvcHRpb25zLmNvbXByZXNzaW9uID0gImd6IjsKKyAgICBvcHRpb25zLm9wX2NvdW50X21heCA9IDEwMDsKKyAgICBhdXRvIHdyaXRlciA9IENyZWF0ZUNvd1dyaXRlcigzLCBvcHRpb25zLCBHZXRDb3dGZCgpKTsKKworICAgIHN0ZDo6c3RyaW5nIGRhdGE7CisgICAgZGF0YS5yZXNpemUob3B0aW9ucy5ibG9ja19zaXplICogNSk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBkYXRhLnNpemUoKTsgaSsrKSB7CisgICAgICAgIGRhdGFbaV0gPSBjaGFyKHJhbmQoKSAlIDQpOworICAgIH0KKworICAgIEFTU0VSVF9UUlVFKHdyaXRlci0+QWRkWmVyb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AgICBzaXplX3QgaSA9IDA7CisKKyAgICB3aGlsZSAoaSA8IDUpIHsKKyAgICAgICAgYXV0byBvcCA9IGl0ZXItPkdldCgpOworICAgICAgICBBU1NFUlRfRVEob3AtPnR5cGUoKSwga0Nvd1plcm9PcCk7CisgICAgICAgIEFTU0VSVF9FUShvcC0+bmV3X2Jsb2NrLCAxMCArIGkpOworICAgICAgICBpdGVyLT5OZXh0KCk7CisgICAgICAgIGkrKzsKKyAgICB9CisgICAgaSA9IDA7CisgICAgd2hpbGUgKGkgPCA1KSB7CisgICAgICAgIGF1dG8gb3AgPSBpdGVyLT5HZXQoKTsKKyAgICAgICAgQVNTRVJUX0VRKG9wLT50eXBlKCksIGtDb3dDb3B5T3ApOworICAgICAgICBBU1NFUlRfRVEob3AtPm5ld19ibG9jaywgMTUgKyBpKTsKKyAgICAgICAgQVNTRVJUX0VRKG9wLT5zb3VyY2UoKSwgMyArIGkpOworICAgICAgICBpdGVyLT5OZXh0KCk7CisgICAgICAgIGkrKzsKKyAgICB9CisgICAgaSA9IDA7CisgICAgc3RkOjpzdHJpbmcgc2luayhkYXRhLnNpemUoKSwgJ1wwJyk7CisKKyAgICB3aGlsZSAoaSA8IDUpIHsKKyAgICAgICAgYXV0byBvcCA9IGl0ZXItPkdldCgpOworICAgICAgICBBU1NFUlRfRVEob3AtPnR5cGUoKSwga0Nvd1JlcGxhY2VPcCk7CisgICAgICAgIEFTU0VSVF9FUShvcC0+bmV3X2Jsb2NrLCAxOCArIGkpOworICAgICAgICBBU1NFUlRfVFJVRSgKKyAgICAgICAgICAgICAgICBSZWFkRGF0YShyZWFkZXIsIG9wLCBzaW5rLmRhdGEoKSArIChpICogb3B0aW9ucy5ibG9ja19zaXplKSwgb3B0aW9ucy5ibG9ja19zaXplKSk7CisgICAgICAgIGl0ZXItPk5leHQoKTsKKyAgICAgICAgaSsrOworICAgIH0KKyAgICBBU1NFUlRfRVEoc2luaywgZGF0YSk7CisKKyAgICBpID0gMDsKKyAgICBzdG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OworICAgIHJlc3VtZV9wb2ludF9jb3VudCA9IDA7CisgICAgcmVzdW1lX3BvaW50X21heCA9IDQ7CisgICAgKi8KKyAgICBBU1NFUlRfVFJVRSh3cml0ZXItPkZpbmFsaXplKCkpOworCisgICAgQ293UmVhZGVyIHJlYWRlcjsKKyAgICBBU1NFUlRfVFJVRShyZWFkZXIuUGFyc2UoY293Xy0+ZmQpKTsKKworICAgIGF1dG8gaGVhZGVyID0gcmVhZGVyLmhlYWRlcl92MygpOworICAgIEFTU0VSVF9FUShoZWFkZXIuc2VxdWVuY2VfZGF0YV9jb3VudCwgMCk7CisgICAgQVNTRVJUX0VRKGhlYWRlci5yZXN1bWVfcG9pbnRfY291bnQsIDApOworICAgIEFTU0VSVF9FUShoZWFkZXIucmVzdW1lX3BvaW50X21heCwgNCk7CisKKyAgICB3cml0ZXItPkFkZExhYmVsKDApOworICAgIEFTU0VSVF9UUlVFKHJlYWRlci5QYXJzZShjb3dfLT5mZCkpOworICAgIGhlYWRlciA9IHJlYWRlci5oZWFkZXJfdjMoKTsKKyAgICBBU1NFUlRfRVEoaGVhZGVyLnNlcXVlbmNlX2RhdGFfY291bnQsIDApOworICAgIEFTU0VSVF9FUShoZWFkZXIucmVzdW1lX3BvaW50X2NvdW50LCAxKTsKKyAgICBBU1NFUlRfRVEoaGVhZGVyLnJlc3VtZV9wb2ludF9tYXgsIDQpOworCisgICAgQVNTRVJUX1RSVUUocmVhZGVyLlBhcnNlKGNvd18tPmZkKSk7CisgICAgaGVhZGVyID0gcmVhZGVyLmhlYWRlcl92MygpOworCisgICAgLyoKKyAgICBIZWFkZXIgbWV0YWRhZmllbGRzCisgICAgc2VxdWVuY2VfZGF0YV9jb3VudCA9IDE7CisgICAgcmVzdW1lX3BvaW50X2NvdW50ID0gMDsKKyAgICByZXN1bWVfcG9pbnRfbWF4ID0gNDsKKyAgICAqLworfQorCitURVNUX0YoQ293VGVzdFYzLCBTZXF1ZW5jZVRlc3QpIHsKKyAgICBDb3dPcHR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ZCgpKTsKK30KKworVEVTVF9GKENvd1Rlc3RWMywgU2V0U291cmNlTWFueVRpbWVzKSB7CisgICAgQ293T3BlcmF0aW9uVjMgb3B7fTsKKyAgICBvcC5zZXRfc291cmNlKDEpOworICAgIEFTU0VSVF9FUShvcC5zb3VyY2UoKSwgMSk7CisgICAgb3Auc2V0X3NvdXJjZSgyKTsKKyAgICBBU1NFUlRfRVEob3Auc291cmNlKCksIDIpOworICAgIG9wLnNldF9zb3VyY2UoNCk7CisgICAgQVNTRVJUX0VRKG9wLnNvdXJjZSgpLCA0KTsKKyAgICBvcC5zZXRfc291cmNlKDgpOworICAgIEFTU0VSVF9FUShvcC5zb3VyY2UoKSwgOCk7Cit9CisKK1RFU1RfRihDb3dUZXN0VjMsIFNldFR5cGVNYW55VGltZXMpIHsKKyAgICBDb3dPcGVyYXRpb25WMyBvcHt9OworICAgIG9wLnNldF90eXBlKGtDb3dDb3B5T3ApOworICAgIEFTU0VSVF9FUShvcC50eXBlKCksIGtDb3dDb3B5T3ApOworICAgIG9wLnNldF90eXBlKGtDb3dSZXBsYWNlT3ApOworICAgIEFTU0VSVF9FUShvcC50eXBlKCksIGtDb3dSZXBsYWNlT3ApOworICAgIG9wLnNldF90eXBlKGtDb3daZXJvT3ApOworICAgIEFTU0VSVF9FUShvcC50eXBlKCksIGtDb3daZXJvT3ApOworICAgIG9wLnNldF90eXBlKGtDb3dYb3JPcCk7CisgICAgQVNTRVJUX0VRKG9wLnR5cGUoKSwga0Nvd1hvck9wKTsKK30KKworVEVTVF9GKENvd1Rlc3RWMywgU2V0VHlwZVNvdXJjZUludmVybGVhdmUpIHsKKyAgICBDb3dPcGVyYXRpb25WMyBvcHt9OworICAgIG9wLnNldF90eXBlKGtDb3dDb3B5T3ApOworICAgIEFTU0VSVF9FUShvcC50eXBlKCksIGtDb3dDb3B5T3ApOworICAgIG9wLnNldF9zb3VyY2UoMHgwMTAyMDMwNDA1MDYpOworICAgIEFTU0VSVF9FUShvcC5zb3VyY2U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pbGVfcGF0aC5zaXplKCkpOworICAgIGlmIChlcnIgPD0gMCkgeworICAgICAgICBQTE9HKEVSUk9SKSA8PCAiRmFpbGVkIHRvIGRldGVybWluZSBwYXRoIGZvciBmZCAiIDw8IGZkLmdldCgpOworICAgICAgICBmaWxlX3BhdGguY2xlYXIoKTsKKyAgICB9IGVsc2UgeworICAgICAgICBmaWxlX3BhdGgucmVzaXplKGVycik7CisgICAgfQorICAgIHJldHVybiBmaWxlX3BhdGg7Cit9Cit9ICAvLyBuYW1lc3BhY2UKKworQ293V3JpdGVyQmFzZTo6Q293V3JpdGVyQmFzZShjb25zdCBDb3dPcHRpb25zJiBvcHRpb25zLCB1bmlxdWVfZmQmJiBmZCkKKyAgICA6IG9wdGlvbnNfKG9wdGlvbnMpLCBmZF8oc3RkOjptb3ZlKGZkKSkge30KKworYm9vbCBDb3dXcml0ZXJCYXNlOjpJbml0RmQoKSB7CisgICAgaWYgKGZkXy5nZXQoKSA8IDApIHsKKyAgICAgICAgZmRfLnJlc2V0KG9wZW4oIi9kZXYvbnVsbCIsIE9fUkRXUiB8IE9fQ0xPRVhFQykpOworICAgICAgICBpZiAoZmRfIDwgMCkgeworICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgIm9wZW4gL2Rldi9udWxsIGZhaWxlZCI7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgaXNfZGV2X251bGxfID0gdHJ1ZTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgc3RydWN0IHN0YXQgc3RhdCB7fTsKKyAgICBpZiAoZnN0YXQoZmRfLmdldCgpLCAmc3RhdCkgPCAwKSB7CisgICAgICAgIFBMT0coRVJST1IpIDw8ICJmc3RhdCBmYWlsZWQiOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGNvbnN0IGF1dG8gZmlsZV9wYXRoID0gR2V0RmRQYXRoKGZkXyk7CisgICAgaXNfYmxvY2tfZGV2aW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N0ZDo6bWFrZV91bmlxdWU8Q293UmVhZGVyPigpOworICAgIGlmICghY293LT5QYXJzZShzdGQ6Om1vdmUoY293X2ZkKSkpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ293V3JpdGVyVjI6Ok9wZW5SZWFkZXI6IHVuYWJsZSB0byByZWFkIENPVyI7CisgICAgICAgIHJldHVybiBudWxscHRyOworICAgIH0KKyAgICByZXR1cm4gY293OworfQorCitzdGQ6OnVuaXF1ZV9wdHI8Y2hyb21lb3NfdXBkYXRlX2VuZ2luZTo6RmlsZURlc2NyaXB0b3I+IENvd1dyaXRlckJhc2U6Ok9wZW5GaWxlRGVzY3JpcHRvcigKKyAgICAgICAgY29uc3Qgc3RkOjpvcHRpb25hbDxzdGQ6OnN0cmluZz4mIHNvdXJjZV9kZXZpY2UpIHsKKyAgICBhdXRvIHJlYWRlciA9IE9wZW5SZWFkZXIoKTsKKyAgICBpZiAoIXJlYWRlcikgeworICAgICAgICByZXR1cm4gbnVsbHB0cjsKKyAgICB9CisKKyAgICBzdGQ6Om9wdGlvbmFsPHVpbnQ2NF90PiBibG9ja19kZXZfc2l6ZTsKKyAgICBpZiAob3B0aW9uc18ubWF4X2Jsb2NrcykgeworICAgICAgICBibG9ja19kZXZfc2l6ZSA9IHsqb3B0aW9uc18ubWF4X2Jsb2NrcyAqIG9wdGlvbnNfLmJsb2NrX3NpemV9OworICAgIH0KKworICAgIHJldHVybiBzdGQ6Om1ha2VfdW5pcXVlPENvbXByZXNzZWRTbmFwc2hvdFJlYWRlcj4oc3RkOjptb3ZlKHJlYWRlciksIHNvdXJjZV9kZXZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9ja19kZXZfc2l6ZSk7Cit9CisKK2Jvb2wgQ293V3JpdGVyQmFzZTo6U3luYygpIHsKKyAgICBpZiAoaXNfZGV2X251bGxfKSB7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyA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ibG9ja3MpIHsKLSAgICAgICAgICAgIENvd09wZXJhdGlvbiBvcCA9IHt9OworICAgICAgICAgICAgQ293T3BlcmF0aW9uVjIgb3AgPSB7fTsKICAgICAgICAgICAgIG9wLm5ld19ibG9jayA9IG5ld19ibG9ja19zdGFydCArIGk7CiAgICAgICAgICAgICBvcC50eXBlID0gdHlwZTsKICAgICAgICAgICAgIGlmICh0eXBlID09IGtDb3dYb3JPcCkgewpAQCAtNTE3LDE5ICs0MDYsMjIgQEAKICAgICAgICAgICAgICAgICBvcC5zb3VyY2UgPSBuZXh0X2RhdGFfcG9zXzsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKGNvbXByZXNzaW9uXykgeworICAgICAgICAgICAgaWYgKGNvbXByZXNzaW9uXy5hbGdvcml0aG0pIHsKICAgICAgICAgICAgICAgICBhdXRvIGRhdGEgPSBbJiwgdGhpc10oKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChudW1fY29tcHJlc3NfdGhyZWFkc18gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvIGRhdGEgPSBzdGQ6Om1vdmUoKmJ1Zl9pdGVyXyk7CiAgICAgICAgICAgICAgICAgICAgICAgICBidWZfaXRlcl8rKzsKICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkYXRhOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgYXV0byBkYXRhID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29tcHJlc3NXb3JrZXI6OkNvbXByZXNzKGNvbXByZXNzaW9uXywgaXRlciwgaGVhZGVyXy5ibG9ja19zaXplKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghY29tcHJlc3Nvcl8pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wcmVzc29yXyA9IElDb21wcmVzc29yOjpDcmVhdGUoY29tcHJlc3Npb25fLCBoZWFkZXJfLmJsb2NrX3NpemUpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICBhdXRvIGRhdGEgPSBjb21wcmVzc29yXy0+Q29tcHJlc3MoaXRlciwgaGVhZGVyXy5ibG9ja19zaXplKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkYXRhOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSgpOwotICAgICAgICAgICAgICAgIG9wLmNvbXByZXNzaW9uID0gY29tcHJlc3Npb25fOworICAgICAgICAgICAgICAgIG9wLmNvbXByZXNzaW9uID0gY29tcHJlc3Npb25fLmFsZ29yaXRobTsKICAgICAgICAgICAgICAgICBvcC5kYXRhX2xlbmd0aCA9IHN0YXRpY19jYXN0PHVpbnQxNl90PihkYXRhLnNpemUoKSk7CiAKICAgICAgICAgICAgICAgICBpZiAoIVdyaXRlT3BlcmF0aW9uKG9wLCBkYXRhLmRhdGEoKSwgZGF0YS5zaXplKCkpKSB7CkBAIC01NTQsMTAgKzQ0NiwxMCBAQAogICAgIHJldHVybiB0cnVlOwogfQogCi1ib29sIENvd1dyaXRlcjo6RW1pdFplcm9CbG9ja3ModWludDY0X3QgbmV3X2Jsb2NrX3N0YXJ0LCB1aW50NjRfdCBudW1fYmxvY2tzKSB7Citib29sIENvd1dyaXRlclYyOjpFbWl0WmVyb0Jsb2Nrcyh1aW50NjRfdCBuZXdfYmxvY2tfc3RhcnQsIHVpbnQ2NF90IG51bV9ibG9ja3MpIHsKICAgICBDSEVDSyghbWVyZ2VfaW5fcHJvZ3Jlc3NfKTsKICAgICBmb3IgKHVpbnQ2NF90IGkgPSAwOyBpIDwgbnVtX2Jsb2NrczsgaSsrKSB7Ci0gICAgICAgIENvd09wZXJhdGlvbiBvcCA9IHt9OworICAgICAgICBDb3dPcGVyYXRpb25WMiBvcCA9IHt9OwogICAgICAgICBvcC50eXBlID0ga0Nvd1plcm9PcDsKICAgICAgICAgb3AubmV3X2Jsb2N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B7CiAgICAgICAgIExPRyhFUlJPUikgPDwgIk5vIHNwYWNlIGxlZnQgb24gQ09XIGRldmljZS4gUmVxdWlyZWQ6ICIgPDwgYnl0ZXNfbmVlZGVkCiAgICAgICAgICAgICAgICAgICAgPDwgIiwgYXZhaWxhYmxlOiAiIDw8IGNvd19pbWFnZV9zaXplXzsKQEAgLTcyNSwxNCArNjA0LDE0IEBACiAgICAgcmV0dXJuIHRydWU7CiB9CiAKLWJvb2wgQ293V3JpdGVyOjpGbHVzaENsdXN0ZXIoKSB7Citib29sIENvd1dyaXRlclYyOjpGbHVzaENsdXN0ZXIoKSB7CiAgICAgc3NpemVfdCByZXQ7CiAKICAgICBpZiAob3BfdmVjX2luZGV4XykgewogICAgICAgICByZXQgPSBwd3JpdGV2KGZkXy5nZXQoKSwgY293b3BfdmVjXy5nZXQoKSwgb3BfdmVjX2luZGV4XywgY3VycmVudF9vcF9wb3NfKTsKLSAgICAgICAgaWYgKHJldCAhPSAob3BfdmVjX2luZGV4XyAqIHNpemVvZihDb3dPcGVyYXRpb24pKSkgewotICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgInB3cml0ZXYgZmFpbGVkIGZvciBDb3dPcGVyYXRpb24uIEV4cGVjdGVkOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICA8PCAob3BfdmVjX2luZGV4XyAqIHNpemVvZihDb3dPcGVyYXRpb24pKTsKKyAgICAgICAgaWYgKHJldCAhPSAob3BfdmVjX2luZGV4XyAqIHNpemVvZihDb3dPcGVyYXRpb25WMikpKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAicHdyaXRldiBmYWlsZWQgZm9yIENvd09wZXJhdGlvblYyLiBFeHBlY3RlZDogIgorICAgICAgICAgICAgICAgICAgICAgICAgPDwgKG9wX3ZlY19pbmRleF8gKiBzaXplb2YoQ293T3BlcmF0aW9uVjIpKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogICAgIH0KQEAgLTc1NCw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fbWF4ID0gMDsKKyAgICBoZWFkZXJfLmNvbXByZXNzaW9uX2FsZ29yaXRobSA9IGtDb3dDb21wcmVzc05vbmU7CisgICAgcmV0dXJuOworfQorCitib29sIENvd1dyaXRlclYzOjpQYXJzZU9wdGlvbnMoKSB7CisgICAgbnVtX2NvbXByZXNzX3RocmVhZHNfID0gc3RkOjptYXgob3B0aW9uc18ubnVtX2NvbXByZXNzX3RocmVhZHMsIDEpOworICAgIGF1dG8gcGFydHMgPSBhbmRyb2lkOjpiYXNlOjpTcGxpdChvcHRpb25zXy5jb21wcmVzc2lvbiwgIiwiKTsKKyAgICBpZiAocGFydHMuc2l6ZSgpID4gMikgeworICAgICAgICBMT0coRVJST1IpIDw8ICJmYWlsZWQgdG8gcGFyc2UgY29tcHJlc3Npb24gcGFyYW1ldGVyczogaW52YWxpZCBhcmd1bWVudCBjb3VudDogIgorICAgICAgICAgICAgICAgICAgIDw8IHBhcnRzLnNpemUoKSA8PCAiICIgPDwgb3B0aW9uc18uY29tcHJlc3Npb247CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgYXV0byBhbGdvcml0aG0gPSBDb21wcmVzc2lvbkFsZ29yaXRobUZyb21TdHJpbmcocGFydHNbMF0pOworICAgIGlmICghYWxnb3JpdGhtKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgInVucmVjb2duaXplZCBjb21wcmVzc2lvbjogIiA8PCBvcHRpb25zXy5jb21wcmVzc2lvbjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBoZWFkZXJfLmNvbXByZXNzaW9uX2FsZ29yaXRobSA9ICphbGdvcml0aG07CisgICAgaGVhZGVyXy5vcF9jb3VudF9tYXggPSBvcHRpb25zXy5vcF9jb3VudF9tYXg7CisKKyAgICBpZiAocGFydHMuc2l6ZSgpID4gMSkgeworICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OlBhcnNlVWludChwYXJ0c1sxXSwgJmNvbXByZXNzaW9uXy5jb21wcmVzc2lvbl9sZXZlbCkpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgImZhaWxlZCB0byBwYXJzZSBjb21wcmVzc2lvbiBsZXZlbCBpbnZhbGlkIHR5cGU6ICIgPDwgcGFydHNbMV07CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICBjb21wcmVzc2lvbl8uY29tcHJlc3Npb25fbGV2ZWwgPQorICAgICAgICAgICAgICAgIENvbXByZXNzV29ya2VyOjpHZXREZWZhdWx0Q29tcHJlc3Npb25MZXZlbChhbGdvcml0aG0udmFsdWUoKSk7CisgICAgfQorCisgICAgY29tcHJlc3Npb25fLmFsZ29yaXRobSA9ICphbGdvcml0aG07CisgICAgY29tcHJlc3Nvcl8gPSBJQ29tcHJlc3Nvcjo6Q3JlYXRlKGNvbXByZXNzaW9uXywgaGVhZGVyXy5ibG9ja19zaXplKTsKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworQ293V3JpdGVyVjM6On5Db3dXcml0ZXJWMygpIHt9CisKK2Jvb2wgQ293V3JpdGVyVjM6OkluaXRpYWxpemUoc3RkOjpvcHRpb25hbDx1aW50NjRfdD4gbGFiZWwpIHsKKyAgICBpZiAoIUluaXRGZCgpIHx8ICFQYXJzZU9wdGlvbnMoKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGlmICghbGFiZWwpIHsKKyAgICAgICAgaWYgKCFPcGVuRm9yV3JpdGUoKSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgaWYgKCFPcGVuRm9yQXBwZW5kKCpsYWJlbCkpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCitib29sIENvd1dyaXRlclYzOjpPcGVuRm9yV3JpdGUoKSB7CisgICAgLy8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WG9yT3ApIHsKKyAgICAgICAgICAgIG9wLnNldF9zb3VyY2UoKG9sZF9ibG9jayArIGkpICogaGVhZGVyXy5ibG9ja19zaXplICsgb2Zmc2V0KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG9wLnNldF9zb3VyY2UobmV4dF9kYXRhX3Bvc18pOworICAgICAgICB9CisgICAgICAgIHN0ZDo6YmFzaWNfc3RyaW5nPHVpbnQ4X3Q+IGNvbXByZXNzZWRfZGF0YTsKKyAgICAgICAgY29uc3Qgdm9pZCogb3V0X2RhdGEgPSBpdGVyOworCisgICAgICAgIG9wLmRhdGFfbGVuZ3RoID0gaGVhZGVyXy5ibG9ja19zaXplOworCisgICAgICAgIGlmIChjb21wcmVzc2lvbl8uYWxnb3JpdGhtKSB7CisgICAgICAgICAgICBpZiAoIWNvbXByZXNzb3JfKSB7CisgICAgICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgIkNvbXByZXNzb3Igbm90IGluaXRpYWxpemVkIjsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb21wcmVzc2VkX2RhdGEgPSBjb21wcmVzc29yXy0+Q29tcHJlc3Mob3V0X2RhdGEsIGhlYWRlcl8uYmxvY2tfc2l6ZSk7CisgICAgICAgICAgICBpZiAoY29tcHJlc3NlZF9kYXRhLnNpemUoKSA8IG9wLmRhdGFfbGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgb3V0X2RhdGEgPSBjb21wcmVzc2VkX2RhdGEuZGF0YSgpOworICAgICAgICAgICAgICAgIG9wLmRhdGFfbGVuZ3RoID0gY29tcHJlc3NlZF9kYXRhLnNpemUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoIVdyaXRlT3BlcmF0aW9uKG9wLCBvdXRfZGF0YSwgb3AuZGF0YV9sZW5ndGgpKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAiQWRk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gICAgICAgUExPRyhFUlJPUikgPDwgIndyaXRpbmcgcmVzdW1lIGJ1ZmZlciBmYWlsZWQiOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiBGaW5hbGl6ZSgpOworfQorCitib29sIENvd1dyaXRlclYzOjpFbWl0U2VxdWVuY2VEYXRhKHNpemVfdCBudW1fb3BzLCBjb25zdCB1aW50MzJfdCogZGF0YSkgeworICAgIC8vIFRPRE86IHNpemUgc2VxdWVuY2UgYnVmZmVyIGJhc2VkIG9uIG9wdGlvbnMKKyAgICBoZWFkZXJfLnNlcXVlbmNlX2RhdGFfY291bnQgPSBudW1fb3BzOworICAgIGlmICghYW5kcm9pZDo6YmFzZTo6V3JpdGVGdWxseUF0T2Zmc2V0KGZkXywgZGF0YSwgc2l6ZW9mKGRhdGFbMF0pICogbnVtX29wcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHZXRTZXF1ZW5jZU9mZnNldChoZWFkZXJfKSkpIHsKKyAgICAgICAgUExPRyhFUlJPUikgPDwgIndyaXRpbmcgc2VxdWVuY2UgYnVmZmVyIGZhaWxlZCI7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgQ293V3JpdGVyVjM6OldyaXRlT3BlcmF0aW9uKGNvbnN0IENvd09wZXJhdGlvblYzJiBvcCwgY29uc3Qgdm9pZCogZGF0YSwgc2l6ZV90IHNpemUpIHsKKyAgICBpZiAoSXNFc3RpbWF0aW5nKCkpIHsKKyAgICAgICAgaGVhZGVyXy5vcF9jb3VudCsrOworICAgICAgICBpZiAoaGVhZGVyXy5vcF9jb3VudCA+IGhlYWRlcl8ub3BfY291bnRfbWF4KSB7CisgICAgICAgICAgICAvLyBJZiB3ZSBpbmNyZW1lbnQgb3BfY291bnRfbWF4LCB0aGUgb2Zmc2V0IG9mIGRhdGEgc2VjdGlvbiB3b3VsZAorICAgICAgIC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cnRpdGlvbk1ldGFkYXRhUGF0aCgpLAorICAgICAgICAgICAgR2V0U25hcHNob3RCb290SW5kaWNhdG9yUGF0aCgpLCAgICAgICAgICBHZXRSb2xsYmFja0luZGljYXRvclBhdGgoKSwKKyAgICAgICAgICAgIEdldEZvcndhcmRNZXJnZUluZGljYXRvclBhdGgoKSwgICAgICAgICAgR2V0T2xkUGFydGl0aW9uTWV0YWRhdGFQYXRoKCksCisgICAgICAgICAgICBHZXRCb290U25hcHNob3RzV2l0aG91dFNsb3RTd2l0Y2hQYXRoKCksCiAgICAgfTsKICAgICBmb3IgKGNvbnN0IGF1dG8mIGZpbGUgOiBmaWxlcykgewogICAgICAgICBSZW1vdmVGaWxlSWZFeGlzdHMoZmlsZSk7CkBAIC00ODMsNiArNTAzLDMyIEBACiAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gcmV0cmlldmUgYmFzZV9zZWN0b3JzIGZyb20gU25hcHVzZXJkIjsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQorICAgIH0gZWxzZSBpZiAoSXNTbmFwc2hvdFdpdGhvdXRTbG90U3dpdGNoKCkpIHsKKyAgICAgICAgLy8gV2hlbiBzbmFwc2hvdHMgYXJlIG9uIGN1cnJlbnQgc2xvdCwgd2UgZGV0ZXJtaW5lIHRoZSBzaXplCisgICAgICAgIC8vIG9mIGJsb2NrIGRldmljZSBiYXNlZCBvbiB0aGUgbnVtYmVyIG9mIENPVyBvcGVyYXRpb25zLiBXZSBjYW5ub3QKKyAgICAgICAgLy8gdXNlIGJhc2UgZGV2aWNlIGFzIGl0IHdpbGwgYmUgZnJvbSBvbGRlciBpbWFnZS4KKyAgICAgICAgc2l6ZV90IG51bV9vcHMgPSAwOworICAgICAgICB1aW50NjRfdCBkZXZfc3ogPSAwOworICAgICAgICB1bmlxdWVfZmQgZmQob3Blbihjb3dfZmlsZS5jX3N0cigpLCBPX1JET05MWSB8IE9fQ0xPRVhFQykpOworICAgICAgICBpZiAoZmQgPCAwKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAiRmFpbGVkIHRvIG9wZW4gIiA8PCBjb3dfZmlsZTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIENvd1JlYWRlciByZWFkZXI7CisgICAgICAgIGlmICghcmVhZGVyLlBhcnNlKHN0ZDo6bW92ZShmZCkpKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gcGFyc2UgY293ICIgPDwgY293X2ZpbGU7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBjb25zdCBhdXRvJiBoZWFkZXIgPSByZWFkZXIuR2V0SGVhZGVyKCk7CisgICAgICAgIGlmIChoZWFkZXIucHJlZml4Lm1ham9yX3ZlcnNpb24gPiAyKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJDT1cgZm9ybWF0IG5vdCBzdXBwb3J0ZWQiOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIG51bV9vcHMgPSByZWFkZXIuZ2V0X251bV90b3RhbF9kYXRhX29wcygpOworICAgICAgICBkZXZfc3ogPSAobnVtX29wcyAqIGhlYWRlci5ibG9ja19zaXplKTsKKyAgICAgICAgYmFzZV9zZWN0b3JzID0gZGV2X3N6ID4+IDk7CiAgICAgfSBlbHNlIHsKICAgICAgICAgLy8gRm9yIHVzZXJzcGFjZSBzbmFwc2hvdHMsIHRoZSBzaXplIG9mIHRoZSBiYXNlIGRldmljZSBpcyB0YWtlbiBhcyB0aGUKICAgICAgICAgLy8gc2l6ZSBvZiB0aGUgZG0tdXNlciBibG9jayBkZXZpY2UuIFNpbmNlIHRoZXJlIGlzIG5vIHBzZXVkbyBtYXBwaW5nCkBAIC03MjksNiArNzc1LDE0IEBACiAgICAgICAgIExPRyhFUlJPUikgPDwgIkZhaWxlZCB0byByZW1vd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oIWFuZHJvaWQ6OmZzX21ncjo6V2FpdEZvckZpbGUoY293X3BhdGgsIDZzKSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiVGltZWQgb3V0IHdhaXRpbmcgZm9yIGRldmljZSB0byBhcHBlYXI6ICIgPDwgY293X3BhdGg7CisgICAgICAgICAgICByZXR1cm4gUmV0dXJuOjpFcnJvcigpOworICAgICAgICB9CisKICAgICAgICAgaWYgKGl0LT5zZWNvbmQudXNpbmdfc25hcHVzZXJkKCkpIHsKICAgICAgICAgICAgIHVuaXF1ZV9mZCBmZChvcGVuKGNvd19wYXRoLmNfc3RyKCksIE9fUkRXUiB8IE9fQ0xPRVhFQykpOwogICAgICAgICAgICAgaWYgKGZkIDwgMCkgewpAQCAtMzU1NCw4ICszNTUyLDggQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG9wdGlvbnMuY29tcHJlc3Npb24gPSBpdC0+c2Vjb25kLmNvbXByZXNzaW9uX2FsZ29yaXRobSgpOwogCi0gICAgICAgICAgICBDb3dXcml0ZXIgd3JpdGVyKG9wdGlvbnMpOwotICAgICAgICAgICAgaWYgKCF3cml0ZXIuSW5pdGlhbGl6ZShmZCkgfHwgIXdyaXRlci5GaW5hbGl6ZSgpKSB7CisgICAgICAgICAgICBhdXRvIHdyaXRlciA9IENyZWF0ZUNvd1dyaXRlcihjb3dfdmVyc2lvbiwgb3B0aW9ucywgc3RkOjptb3ZlKGZkKSk7CisgICAgICAgICAgICBpZiAoIXdyaXRlci0+RmluYWxpemUoKSkgewogICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkNvdWxkIG5vdCBpbml0aWFsaXplIENPVyBkZXZpY2UgZm9yICIgPDwgdGFyZ2V0X3BhcnRpdGlvbi0+bmFtZSgpOwogICAgICAgICAgICAgICAgIHJldHVybiBSZXR1cm46OkVycm9yKCk7CiAgICAgICAgICAgICB9CkBAIC0zNjA1LDEyICszNjAzLDEyIEBACiAgICAgcmV0dXJuIHRydWU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gZGV2X3N6ID0gbHNlZWsoZmQuZ2V0KCksIDAsIFNFRUtfRU5EKTsKKyAgICBpZiAoIWRldl9zeikgeworICAgICAgICBMT0coRVJST1IpIDw8ICJDb3VsZCBub3QgZGV0ZXJtaW5lIGJsb2NrIGRldmljZSBzaXplOiAiIDw8IHBhcnNpbmdfZmlsZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGNvbnN0IGludCBibG9ja19zeiA9IDRfS2lCOworICAgIGRldl9zeiArPSBibG9ja19zeiAtIDE7CisgICAgZGV2X3N6ICY9IH4oYmxvY2tfc3ogLSAxKTsKKworICAgIFNuYXBzaG90U3RhdHVzIHN0YXR1czsKKyAgICBzdGF0dXMuc2V0X3N0YXRlKFNuYXBzaG90U3RhdGU6OkNSRUFURUQpOworICAgIHN0YXR1cy5zZXRfdXNpbmdfc25hcHVzZXJkKHRydWUpOworICAgIHN0YXR1cy5zZXRfb2xkX3BhcnRpdGlvbl9zaXplKDApOworICAgIHN0YXR1cy5zZXRfbmFtZShwYXJ0aXRpb25fbmFtZSk7CisgICAgc3RhdHVzLnNldF9jb3dfZmlsZV9zaXplKGRldl9zeik7CisgICAgc3RhdHVzLnNldF9jb3dfcGFydGl0aW9uX3NpemUoMCk7CisKKyAgICBQYXJ0aXRpb25Db3dDcmVhdG9yIGNvd19jcmVhdG9yOworICAgIGNvd19jcmVhdG9yLnVzaW5nX3NuYXB1c2VyZCA9IHRydWU7CisKKyAgICBpZiAoIXNtXy0+Q3JlYXRlU25hcHNob3QobG9ja18uZ2V0KCksICZjb3dfY3JlYXRvciwgJnN0YXR1cykpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ3JlYXRlU25hcHNob3QgZmFpbGVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGlmICghc21fLT5DcmVhdGVDb3dJbWFnZShsb2NrXy5nZXQoKSwgcGFydGl0aW9uX25hbWUpKSB7CisgICAgICAgIExPRyh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hZCwgZmlsZV9vZmZzZXQpKSB7CisgICAgICAgICAgICBQTE9HKEVSUk9SKSA8PCAiV3JpdGVGdWxseUF0T2Zmc2V0IGZhaWxlZCI7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgZmlsZV9vZmZzZXQgKz0gdG9fcmVhZDsKKyAgICAgICAgaWYgKGZpbGVfb2Zmc2V0ID49IGRldl9zeikgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZnN5bmMoY2ZkLmdldCgpKSA8IDApIHsKKyAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJGc3luYyBmYWlsZWQgYXQgb2Zmc2V0OiAiIDw8IGZpbGVfb2Zmc2V0IDw8ICIgc2l6ZTogIiA8PCB0b19yZWFkOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitib29sIE1hcFNuYXBzaG90czo6SW5pdGlhdGVUaHJlYWRlZFNuYXBzaG90V3JpdGUoc3RkOjpzdHJpbmcmIHBuYW1lLCBzdGQ6OnN0cmluZyYgc25hcHNob3RfcGF0Y2gpIHsKKyAgICBhdXRvIHBhdGggPSBHZXRDb3dJbWFnZVBhdGgocG5hbWUpOworICAgIGlmICghcGF0aC5oYXNfdmFsdWUoKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHRocmVhZHNfLmVtcGxhY2VfYmFjayhzdGQ6OmFzeW5jKHN0ZDo6bGF1bmNoOjphc3luYywgJk1hcFNuYXBzaG90czo6V3JpdGVTbmFwc2hvdFBhdGNoLCB0aGlzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGgudmFsdWUoKSwgc25hcHNob3RfcGF0Y2gpKTsKKyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBNYXBTbmFwc2hvdHM6OkZpbmlzaFNuYXBzaG90V3Jp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ZmF1bHRzIiwKKyAgICAgICAgImxpYnNuYXB1c2VyZF9jbGllbnRfZGVmYXVsdHMiLAogICAgIF0sCiAgICAgcmVjb3ZlcnlfYXZhaWxhYmxlOiB0cnVlLAogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAgICJsaWJjdXRpbHNfc29ja2V0cyIsCi0gICAgICAgICJsaWJmc19tZ3IiLAorICAgICAgICAibGliZnNfbWdyX2ZpbGVfd2FpdCIsCiAgICAgXSwKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGliYmFzZSIsCkBAIC01NywzMiArNTcsNDUgQEAKICAgICBkZWZhdWx0czogWwogICAgICAgICAiZnNfbWdyX2RlZmF1bHRzIiwKICAgICBdLAorICAgIGxvY2FsX2luY2x1ZGVfZGlyczogWyJpbmNsdWRlLyJdLAogICAgIHNyY3M6IFsKICAgICAgICAgImRtLXNuYXBzaG90LW1lcmdlL3NuYXB1c2VyZC5jcHAiLAotICAgICAgICAiZG0tc25hcHNob3QtbWVyZ2Uvc25hcHVzZXJkX3dvcmtlci5jcHAiLAogICAgICAgICAiZG0tc25hcHNob3QtbWVyZ2Uvc25hcHVzZXJkX3JlYWRhaGVhZC5jcHAiLAorICAgICAgICAiZG0tc25hcHNob3QtbWVyZ2Uvc25hcHVzZXJkX3dvcmtlci5jcHAiLAorICAgICAgICAiZG1fdXNlcl9ibG9ja19zZXJ2ZXIuY3BwIiwKICAgICAgICAgInNuYXB1c2VyZF9idWZmZXIuY3BwIiwKKyAgICAgICAgInVzZXItc3BhY2UtbWVyZ2UvaGFuZGxlcl9tYW5hZ2VyLmNwcCIsCisgICAgICAgICJ1c2VyLXNwYWNlLW1lcmdlL21lcmdlX3dvcmtlci5jcHAiLAorICAgICAgICAidXNlci1zcGFjZS1tZXJnZS9yZWFkX3dvcmtlci5jcHAiLAogICAgICAgICAidXNlci1zcGFjZS1tZXJnZS9zbmFwdXNlcmRfY29yZS5jcHAiLAotICAgICAgICAidXNlci1zcGFjZS1tZXJnZS9zbmFwdXNlcmRfZG1fdXNlci5jcHAiLAotICAgICAgICAidXNlci1zcGFjZS1tZXJnZS9zbmFwdXNlcmRfbWVyZ2UuY3BwIiwKICAgICAgICAgInVzZXItc3BhY2UtbWVyZ2Uvc25hcHVzZXJkX3JlYWRhaGVhZC5jcHAiLAogICAgICAgICAidXNlci1zcGFjZS1tZXJnZS9zbmFwdXNlcmRfdHJhbnNpdGlvbnMuY3BwIiwKICAgICAgICAgInVzZXItc3BhY2UtbWVyZ2Uvc25hcHVzZXJkX3ZlcmlmeS5jcHAiLAorICAgICAgICAidXNlci1zcGFjZS1tZXJnZS93b3JrZXIuY3BwIiwKKyAgICAgICAgInV0aWxpdHkuY3BwIiwKKyAgICBdLAorICAgIGNmbGFnczogWworICAgICAgICAiLURfRklMRV9PRkZTRVRfQklUUz02NCIsCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2Vycm9yIiwKICAgICBdLAogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAgICJsaWJiYXNlIiwKICAgICAgICAgImxpYmRtIiwKKyAgICAgICAgImxpYmV4dDJfdXVpZCIsCiAgICAgICAgICJsaWJleHQ0X3V0aWxzIiwKICAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCiAgICAgICAgICJsaWJ1cmluZyIsCiAgICAgXSwKICAgICBpbmNsdWRlX2RpcnM6IFsiYmlvbmljL2xpYmMva2VybmVsIl0sCisgICAgZXhwb3J0X2luY2x1ZGVfZGlyczogWyJpbmNsdWRlIl0sCiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYnN0b3JhZ2VfbGl0ZXJhbHNfaGVhZGVycyIsCiAgICAgXSwKICAgICByYW1kaXNrX2F2YWlsYWJsZTogdHJ1ZSwKICAgICB2ZW5kb3JfcmFtZGlza19hdmFpbGFibGU6IHRydWUsCiAgICAgcmVjb3ZlcnlfYXZhaWxhYmxlOiB0cnVlLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAogfQogCiBjY19kZWZhdWx0cyB7CkBAIC05OCw2ICsxMTEsOCBAQAogCiAgICAgY2ZsYWdzOiBbCiAgICAgICAgICItRF9GSUxFX09GRlNFVF9CSVRTPTY0IiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAogICAgIF0sCiAKICAgICBzdGF0aWNfbGliczogWwpAQCAtMTA1LDE2ICsxMjAsMTggQEAKICAgICAgICAgImxpYmJyb3RsaSIsCiAgICAgICAgICJsaWJjdXRpbHNfc29ja2V0cyIsCiAgICAgICAgICJsaWJkbSIsCi0gICAgICAgICJsaWJmc19tZ3IiLAorICAgICAgICAibGliZXh0Ml91dWlkIiwKKyAgICAgICAgImxpYmZzX21ncl9maWxlX3dhaXQiLAogICAgICAgICAibGliZ2ZsYWdzIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9jb3ciLAotICAgICAgICAibGlic25hcHNob3Rfc25hcHVzZXJkIiwKICAgICAgICAgImxpYnNuYXB1c2VyZCIsCisgICAgICAgICJsaWJzbmFwdXNlcmRfY2xpZW50IiwKICAgICAgICAgImxpYnoiLAogICAgICAgICAibGlibHo0IiwKICAgICAgICAgImxpYmV4dDRfdXRpbHMiLAogICAgICAgICAibGlidXJpbmciLAorICAgICAgICAibGlienN0ZCIsCiAgICAgXSwKIAogICAgIGhlYWRlcl9saWJzOiBbCkBAIC0xNDQsNiArMTYxLDkgQEAKICAgICBpbml0X3JjOiBbCiAgICAgICAgICJzbmFwdXNlcmQucmMiLAogICAgIF0sCisgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgImxpYnNuYXB1c2VyZF9jbGllbnQiLAorICAgIF0sCiAgICAgcmFtZGlza19hdmFpbGFibGU6IGZhbHNlLAogICAgIHZlbmRvcl9yYW1kaXNrX2F2YWlsYWJsZTogdHJ1ZSwKIH0KQEAgLTE2Nyw3ICsxODcsNyBAQAogfQogCiBjY190ZXN0IHsKLSAgICBuYW1lOiAiY293X3NuYXB1c2VyZF90ZXN0IiwKKyAgICBuYW1lOiAic25hcHVzZXJkX3Rlc3RfbGVnYWN5IiwKICAgICBkZWZhdWx0czogWwogICAgICAgICAiZnNfbWdyX2RlZmF1bHRzIiwKICAgICAgICAgImxpYnNuYXBzaG90X2Nvd19kZWZhdWx0cyIsCkBAIC0xODYsMTIgKzIwNiwxMyBAQAogICAgICAgICAibGliYnJvdGxpIiwKICAgICAgICAgImxpYmd0ZXN0IiwKICAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCi0gICAgICAgICJsaWJzbmFwc2hvdF9zbmFwdXNlcmQiLAorICAgICAgICAibGlic25hcHVzZXJkX2NsaWVudCIsCiAgICAgICAgICJsaWJjdXRpbHNfc29ja2V0cyIsCiAgICAgICAgICJsaWJ6IiwKLSAgICAgICAgImxpYmZzX21nciIsCiAgICAgICAgICJsaWJkbSIsCisgICAgICAgICJsaWJleHQyX3V1aWQiLAogICAgICAgICAibGliZXh0NF91dGlscyIsCisgICAgICAgICJsaWJmc19tZ3JfZmlsZV93YWl0IiwKICAgICBdLAogICAgIGhlYWRlcl9saWJzOiBbCiAgICAgICAgICJsaWJzdG9yYWdlX2xpdGVyYWxzX2hlYWRlcnMiLApAQCAtMjA0LDMzICsyMjUsNDUgQEAKICAgICByZXF1aXJlX3Jvb3Q6IGZhbHNlLAogfQogCi1jY190ZXN0IHsKLSAgICBuYW1lOiAic25hcHVzZXJkX3Rlc3QiLAorY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJzbmFwdXNlcmRfdGVzdF9kZWZhdWx0cyIsCiAgICAgZGVmYXVsdHM6IFsKICAgICAgICAgImZzX21ncl9kZWZhdWx0cyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9jb3dfZGVmYXVsdHMiLAogICAgIF0sCiAgICAgc3JjczogWworICAgICAgICAidGVzdGluZy9kbV91c2VyX2hhcm5lc3MuY3BwIiwKKyAgICAgICAgInRlc3RpbmcvaGFybmVzcy5jcHAiLAorICAgICAgICAidGVzdGluZy9ob3N0X2hhcm5lc3MuY3BwIiwKICAgICAgICAgInVzZXItc3BhY2UtbWVyZ2Uvc25hcHVzZXJkX3Rlc3QuY3BwIiwKICAgICBdLAorICAgIGNmbGFnczogWworICAgICAgICAiLURfRklMRV9PRkZTRVRfQklUUz02NCIsCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2Vycm9yIiwKKyAgICBdLAogICAgIHNoYXJlZF9saWJzOiBbCiAgICAgICAgICJsaWJiYXNlIiwKICAgICAgICAgImxpYmxvZyIsCiAgICAgXSwKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibGliYnJvdGxpIiwKKyAgICAgICAgImxpYmN1dGlsc19zb2NrZXRzIiwKKyAgICAgICAgImxpYmRtIiwKKyAgICAgICAgImxpYmV4dDJfdXVpZCIsCisgICAgICAgICJsaWJleHQ0X3V0aWxzIiwKKyAgICAgICAgImxpYmZzX21ncl9maWxlX3dhaXQiLAorICAgICAgICAibGliZ2ZsYWdzIiwKICAgICAgICAgImxpYmd0ZXN0IiwKICAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCi0gICAgICAgICJsaWJzbmFwc2hvdF9zbmFwdXNlcmQiLAotICAgICAgICAibGliY3V0aWxzX3NvY2tldHMiLAotICAgICAgICAibGlieiIsCi0gICAgICAgICJsaWJmc19tZ3IiLAotICAgICAgICAibGliZG0iLAotICAgICAgICAibGliZXh0NF91dGlscyIsCisgICAgICAgICJsaWJzbmFwdXNlcmQiLAogICAgICAgICAibGlidXJpbmciLAotICAgICAgICAibGliZ2ZsYWdzIiwKKyAgICAgICAgImxpYnoiLAogICAgIF0sCi0gICAgaW5jbHVkZV9kaXJzOiBbImJpb25pYy9saWJjL2tlcm5lbCJdLAorICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiYmlvbmljL2xpYmMva2VybmVsIiwKKyAgICAgICAgIi4iLAorICAgIF0sCiAgICAgaGVhZGVyX2xpYnM6IFsKICAgICAgICAgImxpYnN0b3JhZ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cCIsCisgICAgICAgICJ1c2VyLXNwYWNlLW1lcmdlL2V4dHJhY3Rvci5jcHAiLAorICAgICAgICAic25hcHVzZXJkX2V4dHJhY3Rvci5jcHAiLAorICAgIF0sCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItRF9GSUxFX09GRlNFVF9CSVRTPTY0IiwKKyAgICAgICAgIi1XYWxsIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgIF0sCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGlibG9nIiwKKyAgICBdLAorICAgIHN0YXRpY19saWJzOiBbCisgICAgICAgICJsaWJicm90bGkiLAorICAgICAgICAibGliY3V0aWxzX3NvY2tldHMiLAorICAgICAgICAibGliZG0iLAorICAgICAgICAibGliZXh0Ml91dWlkIiwKKyAgICAgICAgImxpYmV4dDRfdXRpbHMiLAorICAgICAgICAibGliZnNfbWdyX2ZpbGVfd2FpdCIsCisgICAgICAgICJsaWJnZmxhZ3MiLAorICAgICAgICAibGlic25hcHNob3RfY293IiwKKyAgICAgICAgImxpYnNuYXB1c2VyZCIsCisgICAgICAgICJsaWJ1cmluZyIsCisgICAgICAgICJsaWJ6IiwKKyAgICBdLAorICAgIGluY2x1ZGVfZGlyczogWworICAgICAgICAiYmlvbmljL2xpYmMva2VybmVsIiwKKyAgICAgICAgIi4iLAorICAgIF0sCisgICAgaGVhZGVyX2xpYnM6IFsKKyAgICAgICAgImxpYnN0b3JhZ2VfbGl0ZXJhbHNfaGVhZGVycyIsCisgICAgICAgICJsaWJmaWVtYXBfaGVhZGVycyIsCisgICAgXSwKIH0KZGlmZiAtLWdpdCBhL2ZzX21nci9saWJzbmFwc2hvdC9zbmFwdXNlcmQvZG0tc25hcHNob3QtbWVyZ2UvY293X3NuYXB1c2VyZF90ZXN0LmNwcCBiL2ZzX21nci9saWJzbmFwc2hvdC9zbmFwdXNlcmQvZG0tc25hcHNob3QtbWVyZ2UvY293X3NuYXB1c2VyZF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gICAgICAgaWYgKGNvd19vcC0+dHlwZSgpID09IGtDb3dSZXBsYWNlT3ApIHsKICAgICAgICAgICAgIHJlcGxhY2Vfb3BzKys7Ci0gICAgICAgIH0gZWxzZSBpZiAoY293X29wLT50eXBlID09IGtDb3daZXJvT3ApIHsKKyAgICAgICAgfSBlbHNlIGlmIChjb3dfb3AtPnR5cGUoKSA9PSBrQ293WmVyb09wKSB7CiAgICAgICAgICAgICB6ZXJvX29wcysrOwogICAgICAgICB9CiAKQEAgLTQ0Miw3ICs0MzcsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVvZihzdHJ1Y3QgZGlza19leGNlcHRpb24pKTsKICAgICAgICAgICAgIG1lbXNldChkZV9wdHIuZ2V0KCksIDAsIChleGNlcHRpb25zX3Blcl9hcmVhXyAqIHNpemVvZihzdHJ1Y3QgZGlza19leGNlcHRpb24pKSk7CiAKLSAgICAgICAgICAgIGlmIChjb3dvcF9ybV9pdGVyLT5Eb25lKCkpIHsKKyAgICAgICAgICAgIGlmIChjb3dvcF9ybV9pdGVyLT5BdEVuZCgpKSB7CiAgICAgICAgICAgICAgICAgdmVjXy5wdXNoX2JhY2soc3RkOjptb3ZlKGRlX3B0cikpOwogICAgICAgICAgICAgfQogICAgICAgICB9CkBAIC00NjIsOSArNDU3LDkgQEAKICAgICAgICAgICAgICAgICAgICAgPDwgIiBOdW1iZXIgb2YgcmVwbGFjZS96ZXJvIG9wcyBjb21wbGV0ZWQgaW4gdGhpcyBhcmVhOiAiIDw8IG51bV9vcHMKICAgICAgICAgICAgICAgICAgICAgPDwgIiBQZW5kaW5nIGNvcHkgb3BzIGZvciB0aGlzIGFyZWE6ICIgPDwgcGVuZGluZ19vcmRlcmVkX29wczsKIAotICAgIHdoaWxlICghY293b3Bfcm1faXRlci0+RG9uZSgpKSB7CisgICAgd2hpbGUgKCFjb3dvcF9ybV9pdGVyLT5BdEVuZCgpKSB7CiAgICAgICAgIGRvIHsKLSAgICAgICAgICAgIGNvbnN0IENvd09wZXJhdGlvbiogY293X29wID0gJmNvd29wX3JtX2l0ZXItPkdldCgpOworICAgICAgICAgICAgY29uc3QgQ293T3BlcmF0aW9uKiBjb3dfb3AgPSBjb3dvcF9ybV9pdGVyLT5HZXQoKTsKIAogICAgICAgICAgICAgLy8gV2UgaGF2ZSB0d28gY2FzZXMgc3BlY2lmaWMgY2FzZXM6CiAgICAgICAgICAgICAvLwpAQCAtNTEzLDExICs1MDgsOSBAQAogICAgICAgICAgICAgLy8gdGhlIG1lcmdlIG9mIG9wZXJhdGlvbnMgYXJlIGRvbmUgYmFzZWQgb24gdGhlIG9wcyBwcmVzZW50CiAgICAgICAgICAgICAvLyBpbiB0aGUgZmlsZS4KICAgICAgICAgICAgIC8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLSAgICAgICAgICAgIHVpbnQ2NF90IGJsb2NrX3NvdXJjZSA9IGNvd19vcC0+c291cmNlOwotICAgICAgICAgICAgdWludDY0X3QgYmxvY2tfb2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIHVpbnQ2NF90IGJsb2NrX3NvdXJjZSA9IGNvd19vcC0+c291cmNlKCk7CiAgICAgICAgICAgICBpZiAocHJldl9pZC5oYXNfdmFsdWUoKSkgewotICAgICAgICAgICAgICAgIGlmIChkZXN0X2Jsb2Nrcy5jb3VudChjb3dfb3AtPm5ld19ibG9jaykgfHwgc291cmNlX2Jsb2Nrcy5jb3VudChibG9ja19zb3VyY2UpIHx8Ci0gICAgICAgICAgICAgICAgICAgIChibG9ja19vZmZzZXQgPiAwICYmIHNvdXJjZV9ibG9ja3MuY291bnQoYmxvY2tfc291cmNlICsgMSkpKSB7CisgICAgICAgICAgICAgICAgaWYgKGRlc3RfYmxvY2tzLmNvdW50KGNvd19vcC0+bmV3X2Jsb2NrKSB8fCBzb3VyY2VfYmxvY2tzLmNvdW50KGJsb2NrX3NvdXJjZSkpIHsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQpAQCAtNTI1LDEzICs1MTgsMTAgQEAKICAgICAgICAgICAgIHBlbmRpbmdfb3JkZXJlZF9vcHMgLT0gMTsKICAgICAgICAgICAgIHZlYy5wdXNoX2JhY2soY293X29wKTsKICAgICAgICAgICAgIGRlc3RfYmxvY2tzLmluc2VydChibG9ja19zb3VyY2UpOwotICAgICAgICAgICAgaWYgKGJsb2NrX29mZnNldCA+IDApIHsKLSAgICAgICAgICAgICAgICBkZXN0X2Jsb2Nrcy5pbnNlcnQoYmxvY2tfc291cmNlICsgMSk7Ci0gICAgICAgICAgICB9CiAgICAgICAgICAgICBzb3VyY2VfYmxvY2tzLmluc2VydChjb3dfb3AtPm5ld19ibG9jayk7CiAgICAgICAgICAgICBwcmV2X2lkID0gY293X29wLT5uZXdfYmxvY2s7CiAgICAgICAgICAgICBjb3dvcF9ybV9pdGVyLT5OZXh0KCk7Ci0gICAgICAgIH0gd2hpbGUgKCFjb3dvcF9ybV9pdGVyLT5Eb25lKCkgJiYgcGVuZGluZ19vcmRlcmVkX29wcyk7CisgICAgICAgIH0gd2hpbGUgKCFjb3dvcF9ybV9pdGVyLT5BdEVuZCgpICYmIHBlbmRpbmdfb3JkZXJlZF9vcHMpOwogCiAgICAgICAgIGRhdGFfY2h1bmtfaWQgPSBHZXROZXh0QWxsb2NhdGFibGVDaHVua0lkKGRhdGFfY2h1bmtfaWQpOwogICAgICAgICBTTkFQX0xPRyhERUJVRykgPDwgIkJhdGNoIE1lcmdlIGNvcHktb3BzIG9mIHNpemU6ICIgPDwgdmVjLnNpemUoKQpAQCAtNTUwLDcgKzU0MCw3IEBACiAgICAgICAgICAgICBjaHVua192ZWNfLnB1c2hfYmFjayhzdGQ6Om1ha2VfcGFpcihDaHVua1RvU2VjdG9yKGRhdGFfY2h1bmtfaWQpLCBjb3dfb3ApKTsKICAgICAgICAgICAgIG9mZnNldCArPSBzaXplb2Yoc3RydWN0IGRpc2tfZXhjZXB0aW9uKTsKICAgICAgICAgICAgIG51bV9vcHMgKz0gMTsKLSAgICAgICAgICAgIGlmIChjb3dfb3AtPnR5cGUgPT0ga0Nvd0NvcHlPcCkgeworICAgICAgICAgICAgaWYgKGNvd19vcC0+dHlwZSgpID09IGtDb3dDb3B5T3ApIHsKICAgICAgICAgICAgICAgICBjb3B5X29wcysrOwogICAgICAgICAgICAgfQogCkBAIC01NzQsNyArNTY0LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHN0cnVjdCBkaXNrX2V4Y2VwdGlvbikpOwogICAgICAgICAgICAgICAgIG1lbXNldChkZV9wdHIuZ2V0KCksIDAsIChleGNlcHRpb25zX3Blcl9hcmVhXyAqIHNpemVvZihzdHJ1Y3QgZGlza19leGNlcHRpb24pKSk7CiAKLSAgICAgICAgICAgICAgICBpZiAoY293b3Bfcm1faXRlci0+RG9uZSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKGNvd29wX3JtX2l0ZXItPkF0RW5kKCkpIHsKICAgICAgICAgICAgICAgICAgICAgdmVjXy5wdXNoX2JhY2soc3RkOjptb3ZlKGRlX3B0cikpOwogICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhERUJVRykgPDwgIlJlYWRNZXRhZGF0YSgpIGNvbXBsZXRlZDsgTnVtYmVyIG9mIEFyZWFzOiAiIDw8IHZlY18uc2l6ZSgpOwogICAgICAgICAgICAgICAgIH0KQEAgLTYzNiwxMSArNjI2LDEwIEBACiB9CiAKIGJvb2wgU25hcHVzZXJkOjpNbWFwTWV0YWRhdGEoKSB7Ci0gICAgQ293SGVhZGVyIGhlYWRlcjsKLSAgICByZWFkZXJfLT5HZXRIZWFkZXIoJmhlYWRlcik7CisgICAgY29uc3QgYXV0byYgaGVhZGVyID0gcmVhZGVyXy0+R2V0SGVhZGVyKCk7CiAKLSAgICBpZ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291cmNlKCk7CisgICAgaWYgKGRlc3RfYmxvY2tzXy5jb3VudChjb3dfb3AtPm5ld19ibG9jaykgfHwgc291cmNlX2Jsb2Nrc18uY291bnQoc291cmNlX2Jsb2NrKSkgewogICAgICAgICBvdmVybGFwXyA9IHRydWU7CiAgICAgfQogCiAgICAgZGVzdF9ibG9ja3NfLmluc2VydChzb3VyY2VfYmxvY2spOwotICAgIGlmIChzb3VyY2Vfb2Zmc2V0ID4gMCkgewotICAgICAgICBkZXN0X2Jsb2Nrc18uaW5zZXJ0KHNvdXJjZV9ibG9jayArIDEpOwotICAgIH0KICAgICBzb3VyY2VfYmxvY2tzXy5pbnNlcnQoY293X29wLT5uZXdfYmxvY2spOwogfQogCkBAIC0xOTYsOCArMTkxLDggQEAKICAgICAgICAgLy8gR2V0IHRoZSBmaXJzdCBibG9jayB3aXRoIG9mZnNldAogICAgICAgICBjb25zdCBDb3dPcGVyYXRpb24qIGNvd19vcCA9IEdldFJBT3BJdGVyKCk7CiAgICAgICAgIENIRUNLX05FKGNvd19vcCwgbnVsbHB0cik7Ci0gICAgICAgICpzb3VyY2Vfb2Zmc2V0ID0gY293X29wLT5zb3VyY2U7Ci0gICAgICAgIGlmIChjb3dfb3AtPnR5cGUgPT0ga0Nvd0NvcHlPcCkgeworICAgICAgICAqc291cmNlX29mZnNldCA9IGNvd19vcC0+c291cmNlKCk7CisgICAgICAgIGlmIChjb3dfb3AtPnR5cGUoKSA9PSBrQ293Q29weU9wKSB7CiAgICAgICAgICAgICAqc291cmNlX29mZnNldCAqPSBCTE9DS19TWjsKICAgICAgICAgfQogICAgICAgICBSQUl0ZXJOZXh0KCk7CkBAIC0yMTUsOCArMjEwLDggQEAKICAgICAgICAgd2hpbGUgKCFSQUl0ZXJEb25lKCkgJiYgbnVtX29wcykgewogICAgICAgICAgICAgY29uc3QgQ293T3BlcmF0aW9uKiBvcCA9IEdldFJBT3BJdGVyKCk7CiAgICAgICAgICAgICBDSEVDS19ORShvcCwgbnVsbHB0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+dHlwZSkgeworICAgIHN3aXRjaCAoY293X29wLT50eXBlKCkpIHsKICAgICAgICAgY2FzZSBrQ293UmVwbGFjZU9wOiB7CiAgICAgICAgICAgICByZXR1cm4gUHJvY2Vzc1JlcGxhY2VPcChjb3dfb3ApOwogICAgICAgICB9CkBAIC0xODQsNyArMTkxLDggQEAKICAgICAgICAgfQogCiAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiVW5zdXBwb3J0ZWQgb3BlcmF0aW9uLXR5cGUgZm91bmQ6ICIgPDwgY293X29wLT50eXBlOworICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJVbnN1cHBvcnRlZCBvcGVyYXRpb24tdHlwZSBmb3VuZDogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHN0YXRpY19jYXN0PHVpbnQ4X3Q+KGNvd19vcC0+dHlwZSgpKTsKICAgICAgICAgfQogICAgIH0KICAgICByZXR1cm4gZmFsc2U7CkBAIC01MDIsNyArNTEwLDcgQEAKICAgICAgICAgICAgICAgICBpZiAocmVhZF9haGVhZF9idWZmZXJfbWFwLmZpbmQoY293X29wLT5uZXdfYmxvY2spID09IHJlYWRfYWhlYWRfYnVmZmVyX21hcC5lbmQoKSkgewogICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIEJsb2NrOiAiIDw8IGNvd19vcC0+bmV3X2Jsb2NrIDw8ICIgbm90IGZvdW5kIGluIHJlYWQtYWhlYWQgY2FjaGUiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBTb3VyY2U6ICIgPDwgY293X29wLT5zb3VyY2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBPcDogIiA8PCAqY293X29wOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICA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KTsKKyAgICBnZmxhZ3M6OlBhcnNlQ29tbWFuZExpbmVGbGFncygmYXJnYywgJmFyZ3YsIHRydWUpOworCisgICAgaWYgKEZMQUdTX291dC5lbXB0eSgpKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIk1pc3NpbmcgLW91dCBhcmd1bWVudC4iOworICAgICAgICByZXR1cm4gMTsKKyAgICB9CisgICAgaWYgKEZMQUdTX2Jhc2UuZW1wdHkoKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJNaXNzaW5nIC1iYXNlIGFyZ3VtZW50LiI7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKyAgICBpZiAoRkxBR1NfY293LmVtcHR5KCkpIHsKKyAgICAgICAgTE9HKEVSUk9SKSA8PCAibWlzc2luZyAtb3V0IGFyZ3VtZW50LiI7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKyAgICBpZiAoIUZMQUdTX251bV9zZWN0b3JzKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIm1pc3NpbmcgLW51bV9zZWN0b3JzIGFyZ3VtZW50LiI7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKworICAgIGFuZHJvaWQ6OnNuYXBzaG90OjpFeHRyYWN0b3IgZXh0cmFjdG9yKEZMQUdTX2Jhc2UsIEZMQUdTX2Nvdyk7CisgICAgaWYgKCFleHRyYWN0b3IuSW5pdCgpKSB7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKyAgICBpZiAoIWV4dHJhY3Rvci5FeHRyYWN0KEZMQUdTX251bV9zZWN0b3JzLCBGTEFHU19vdXQpKSB7CisgICAgICAgIHJldHVybiAxOworICAgIH0KKyAgICByZXR1cm4gMDsKK30KZGlmZiAtLWdpdCBhL2ZzX21nci9saWJzbmFwc2hvdC9zbmFwdXNlcmQvc25hcHVzZXJkX2xvZ2dpbmcuaCBiL2ZzX21nci9saWJzbmFwc2hvdC9zbmFwdXNlcmQvc25hcHVzZXJkX2xvZ2dpbmcuaApuZXcgZmlsZSBt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AgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGRldl8gPSBzdGQ6Om1ha2VfdW5pcXVlPExvb3BEZXZpY2U+KG1lbWZkXywgMTBzKTsKKyAgICAgICAgcmV0dXJuIGRldl8tPnZhbGlkKCk7CisgICAgfQorICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBHZXRQYXRoKCkgb3ZlcnJpZGUgeyByZXR1cm4gZGV2Xy0+ZGV2aWNlKCk7IH0KKyAgICB1aW50NjRfdCBHZXRTaXplKCkgb3ZlcnJpZGUgeworICAgICAgICB1bmlxdWVfZmQgZmQob3BlbihHZXRQYXRoKCkuY19zdHIoKSwgT19SRE9OTFkgfCBPX0NMT0VYRUMpKTsKKyAgICAgICAgaWYgKGZkIDwgMCkgeworICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgIm9wZW4gZmFpbGVkOiAiIDw8IEdldFBhdGgoKTsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIHJldHVybiBnZXRfYmxvY2tfZGV2aWNlX3NpemUoZmQuZ2V0KCkpOworICAgIH0KKworICBwcml2YXRlOgorICAgIHVuaXF1ZV9mZCBtZW1mZF87CisgICAgc3RkOjp1bmlxdWVfcHRyPExvb3BEZXZpY2U+IGRldl87Cit9OworI2VuZGlmCisKK2NsYXNzIEZpbGVCYWNrZWREZXZpY2UgZmluYWwgOiBwdWJsaWMgSUJhY2tpbmdEZXZpY2UgeworICBwdWJsaWM6CisgICAgYm9vbCBJbml0KHVpbnQ2NF90IHNpemUpIHsKKyAgICAgICAgaWYgKHRlbXBfLmZkIDwgMCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmIChmdHJ1bmNhdGUodGVtcF8uZmQsIHNpemUpIDwgMCkgeworICAgICAgICAgICAgUExPRyhFUlJPUikgPDwgImZ0cnVuY2F0ZSBmYWlsZWQ6ICIgPDwgdGVtcF8ucGF0aDsKKy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NlLgorCisjcHJhZ21hIG9uY2UKKworI2luY2x1ZGUgPGNocm9ubz4KKyNpbmNsdWRlIDxzdHJpbmc+CisKKyNpbmNsdWRlIDxsaWJkbS9kbS5oPgorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2Ugc25hcHNob3QgeworCit1c2luZyBhbmRyb2lkOjpkbTo6RGV2aWNlTWFwcGVyOwordXNpbmcgYW5kcm9pZDo6ZG06OkRtVGFibGU7CisKK2NsYXNzIFRlbXBkZXZpY2UgeworICBwdWJsaWM6CisgICAgVGVtcGRldmljZShjb25zdCBzdGQ6OnN0cmluZyYgbmFtZSwgY29uc3QgRG1UYWJsZSYgdGFibGUpCisgICAgICAgIDogZG1fKERldmljZU1hcHBlcjo6SW5zdGFuY2UoKSksIG5hbWVfKG5hbWUpLCB2YWxpZF8oZmFsc2UpIHsKKyAgICAgICAgdmFsaWRfID0gZG1fLkNyZWF0ZURldmljZShuYW1lLCB0YWJsZSwgJnBhdGhfLCBzdGQ6OmNocm9ubzo6c2Vjb25kcyg1KSk7CisgICAgfQorICAgIFRlbXBkZXZpY2UoVGVtcGRldmljZSYmIG90aGVyKSBub2V4Y2VwdAorICAgICAgICA6IGRtXyhvdGhlci5kbV8pLCBuYW1lXyhvdGhlci5uYW1lXyksIHBhdGhfKG90aGVyLnBhdGhfKSwgdmFsaWRfKG90aGVyLnZhbGlkXykgeworICAgICAgICBvdGhlci52YWxpZF8gPSBmYWxzZTsKKyAgICB9CisgICAgflRlbXBkZXZpY2UoKSB7CisgICAgICAgIGlmICh2YWxpZF8pIHsKKyAgICAgICAgICAgIGRtXy5EZWxldGVEZXZpY2VJZkV4aXN0cyhuYW1lXyk7CisgICAgICAgIH0KKyAgICB9CisgICAgYm9vbCBEZXN0cm95KCkgeworICAgICAgICBpZiAoIXZhbGlkXykgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgdmFsaWRfID0gZmFsc2U7CisgICAgICAgIHJld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jY0KSk7CisgICAgaWYgKG91dF9mZCA8IDApIHsKKyAgICAgICAgUExPRyhFUlJPUikgPDwgIkNvdWxkIG5vdCBvcGVuIGZvciB3cml0aW5nOiAiIDw8IG91dF9wYXRoOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgZm9yIChvZmZfdCBpID0gMDsgaSA8IG51bV9zZWN0b3JzOyBpKyspIHsKKyAgICAgICAgaWYgKCFyZWFkX3dvcmtlcl8tPlJlcXVlc3RTZWN0b3JzKGksIDUxMikpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIlJlYWQgc2VjdG9yICIgPDwgaSA8PCAiIGZhaWxlZC4iOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHN0ZDo6c3RyaW5nIHJlc3VsdCA9IHN0ZDo6bW92ZShibG9ja19zZXJ2ZXJfLT5zZW50X2lvKCkpOworICAgICAgICBvZmZfdCBvZmZzZXQgPSBpICogNTEyOworICAgICAgICBpZiAoIWFuZHJvaWQ6OmJhc2U6OldyaXRlRnVsbHlBdE9mZnNldChvdXRfZmQsIHJlc3VsdC5kYXRhKCksIHJlc3VsdC5zaXplKCksIG9mZnNldCkpIHsKKyAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJ3cml0ZSBmYWlsZWQiOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCit9ICAvLyBuYW1lc3BhY2Ugc25hcHNob3QKK30gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCmRpZmYgLS1naXQgYS9mc19tZ3IvbGlic25hcHNob3Qvc25hcHVzZXJkL3VzZXItc3BhY2UtbWVyZ2UvZXh0cmFjdG9yLmggYi9mc19tZ3IvbGlic25hcHNob3Qvc25hcHVzZXJkL3VzZXItc3BhY2UtbWVyZ2UvZXh0cmFjdG9yLmgKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5k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Zfb2ZfbG9jaywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnNoYXJlZF9wdHI8SGFuZGxlclRocmVhZD4mIGhhbmRsZXIpIHsKKyAgICBDSEVDSyhwcm9vZl9vZl9sb2NrKTsKKworICAgIGlmICghaGFuZGxlci0+c25hcHVzZXJkKCktPklzQXR0YWNoZWQoKSkgeworICAgICAgICBMT0coRVJST1IpIDw8ICJIYW5kbGVyIG5vdCBhdHRhY2hlZCB0byBkbS11c2VyIC0gTWVyZ2UgdGhyZWFkIGNhbm5vdCBiZSBzdGFydGVkIjsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGhhbmRsZXItPnNuYXB1c2VyZCgpLT5Nb25pdG9yTWVyZ2UoKTsKKworICAgIGlmICghbWVyZ2VfbW9uaXRvcl8uam9pbmFibGUoKSkgeworICAgICAgICBtZXJnZV9tb25pdG9yXyA9IHN0ZDo6dGhyZWFkKCZTbmFwc2hvdEhhbmRsZXJNYW5hZ2VyOjpNb25pdG9yTWVyZ2UsIHRoaXMpOworICAgIH0KKworICAgIG1lcmdlX2hhbmRsZXJzXy5wdXNoKGhhbmRsZXIpOworICAgIFdha2V1cE1vbml0b3JNZXJnZVRocmVhZCgpOworICAgIHJldHVybiB0cnVlOworfQorCit2b2lkIFNuYXBzaG90SGFuZGxlck1hbmFnZXI6Oldha2V1cE1vbml0b3JNZXJnZVRocmVhZCgpIHsKKyAgICB1aW50NjRfdCBub3RpZnkgPSAxOworICAgIHNzaXplX3QgcmMgPSBURU1QX0ZBSUxVUkVfUkVUUlkod3JpdGUobW9uaXRvcl9tZXJnZV9ldmVudF9mZF8uZ2V0KCksICZub3RpZnksIHNpemVvZihub3RpZnkpKSk7CisgICAgaWYgKHJjIDwgMCkgeworICAgICAgICBQTE9HKEZBVEFMKSA8PCAiZmFpbGVkIHRvIG5vdGlmeSBtb25pdG9yIG1lcmdlIHRocmVhZCI7CisgICAgfQorfQorCit2b2lkIFNuYXBzaG90SGFuZGxlck1hbmFnZXI6Ok1vbml0b3JNZXJnZSgpIHsKKyAgICBwdGhyZWFkX3NldG5hbWVfbnAocHRocmVhZF9zZWxmKCksICJNZXJnZSBNb25pdG9yIik7CisgICAgd2hpbGUgKCFzdG9wX21vbml0b3JfbWVyZ2VfdGhyZWFkXykgeworICAgICAgICB1aW50NjRfdCB0ZXN0VmFsOworICAgICAgICBzc2l6ZV90IHJldCA9CisgICAgICAgICAgICAgICAgVEVNUF9GQUlMVVJFX1JFVFJZKHJlYWQobW9uaXRvcl9tZXJnZV9ldmVudF9mZF8uZ2V0KCksICZ0ZXN0VmFsLCBzaXplb2YodGVzdFZhbCkpKTsKKyAgICAgICAgaWYgKHJldCA9PSAtMSkgeworICAgICAgICAgICAgUExPRyhGQVRBTCkgPDwgIkZhaWxlZCB0byByZWFkIGZyb20gZXZlbnRmZCI7CisgICAgICAgIH0gZWxzZSBpZiAocmV0ID09IDApIHsKKyAgICAgICAgICAgIExPRyhGQVRBTCkgPDwgIkhpdCBFT0Ygb24gZXZlbnRmZCI7CisgICAgICAgIH0KKworICAgICAgICBMT0coSU5GTykgPDwgIk1vbml0b3JNZXJnZTogYWN0aXZlLW1lcmdlLXRocmVhZHM6ICIgPDwgYWN0aXZlX21lcmdlX3RocmVhZHNfOworICAgICAgICB7CisgICAgICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhsb2NrXyk7CisgICAgICAgICAgICB3aGlsZSAoYWN0aXZlX21lcmdlX3RocmVhZHNfIDwga01heE1lcmdlVGhyZWFkcyAmJiBtZXJnZV9oYW5kbGVyc18uc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgIGF1dG8gaGFuZGxlciA9IG1lcmdlX2hhbmRsZXJzXy5mcm9udCgpOworICAgICAgICAgICAgICAgIG1lcmdlX2hhbmRsZXJzXy5wb3AoKTsKKworICAgICAgICAgICAgICAgIGlmICghaGFuZGxlci0+c25hcHVzZXJkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgTE9HKElORk8pIDw8ICJNb25pdG9yTWVyZ2U6IHNraXBwaW5nIGRlbGV0ZWQgaGFuZGxlcjogIiA8PCBoYW5kbGVyLT5taXNjX25hbWUoKTsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgTE9HKElORk8pIDw8ICJTdGFydGluZyBtZXJnZSBmb3IgcGFydGl0aW9uOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IGhhbmRsZXItPnNuYXB1c2VyZCgpLT5HZXRNaXNjTmFtZSgpOworICAgICAgICAgICAgICAgIGhhbmRsZXItPnNuYXB1c2VyZCgpLT5Jbml0aWF0ZU1lcmdlKCk7CisgICAgICAgICAgICAgICAgYWN0aXZlX21lcmdlX3RocmVhZHNfICs9IDE7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBMT0coSU5GTykgPDwgIkV4aXRpbmcgTW9uaXRvck1lcmdlOiBzaXplOiAiIDw8IG1lcmdlX2hhbmRsZXJzXy5zaXplKCk7Cit9CisKK3N0ZDo6c3RyaW5nIFNuYXBzaG90SGFuZGxlck1hbmFnZXI6OkdldE1lcmdlU3RhdHVzKGNvbnN0IHN0ZDo6c3RyaW5nJiBtaXNjX25hbWUpIHsKKyAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gbG9jayhsb2NrXyk7CisgICAgYXV0byBpdGVyID0gRmluZEhhbmRsZXIoJmxvY2ssIG1pc2NfbmFtZSk7CisgICAgaWYgKGl0ZXIgPT0gZG1fdXNlcnNfLmVuZCgpKSB7CisgICAgICAgIExPRyhFUlJPUikgPDwgIkNvdWxkIG5vdCBmaW5kIGhhbmRsZXI6ICIgPDwgbWlzY19uYW1lOworICAgICAgICByZXR1cm4ge307CisgICAgfQorCisgICAgcmV0dXJuICgqaXRlciktPnNuYXB1c2VyZC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yaW5nJiBiYWNraW5nX2RldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBiYXNlX3BhdGhfbWVyZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnNoYXJlZF9wdHI8SUJsb2NrU2VydmVyT3BlbmVyPiBvcGVuZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbnVtX3dvcmtlcl90aHJlYWRzLCBib29sIHVzZV9pb3VyaW5nLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBvX2RpcmVjdCkgPSAwOworCisgICAgLy8gU3RhcnQgc2VydmluZyByZXF1ZXN0cyBvbiBhIHNuYXBzaG90IGhhbmRsZXIuCisgICAgdmlydHVhbCBib29sIFN0YXJ0SGFuZGxlcihjb25zdCBzdGQ6OnN0cmluZyYgbWlzY19uYW1lKSA9IDA7CisKKyAgICAvLyBTdG9wIHNlcnZpbmcgcmVxdWVzdHMgb24gYSBzbmFwc2hvdCBoYW5kbGVyIGFuZCByZW1vdmUgaXQuCisgICAgdmlydHVhbCBib29sIERlbGV0ZUhhbmRsZXIoY29uc3Qgc3RkOjpzdHJpbmcmIG1pc2NfbmFtZSkgPSAwOworCisgICAgLy8gQmVnaW4gbWVyZ2luZyBibG9ja3Mgb24gdGhlIGdpdmVuIHNuYXBzaG90IGhhbmRsZXIuCisgICAgdmlydHVhbCBib29sIEluaXRpYXRlTWVyZ2UoY29uc3Qgc3RkOjpzdHJpbmcmIG1pc2NfbmFtZSkgPSAwOworCisgICAgLy8gUmV0dXJuIGEgc3RyaW5nIGNvbnRhaW5pbmcgYSBzdGF0dXMgY29kZSBpbmRpY2F0aW5nIHRoZSBtZXJnZSBzdGF0dXMKKyAgICAvL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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBjb3dfZGV2aWNlX3BhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGJhY2tpbmdfZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBiYXNlX3BhdGhfbWVyZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpzaGFyZWRfcHRyPElCbG9ja1NlcnZlck9wZW5lcj4gb3BlbmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBudW1fd29ya2VyX3RocmVhZHMsIGJvb2wgdXNlX2lvdXJpbmcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBvX2RpcmVjdCkgb3ZlcnJpZGU7CisgICAgYm9vbCBTdGFydEhhbmRsZXIoY29uc3Qgc3RkOjpzdHJpbmcmIG1pc2NfbmFtZSkgb3ZlcnJpZGU7CisgICAgYm9vbCBEZWxldGVIYW5kbGVyKGNvbnN0IHN0ZDo6c3RyaW5nJiBtaXNjX25hbWUpIG92ZXJyaWRlOworICAgIGJvb2wgSW5pdGlhdGVNZXJnZShjb25zdCBzdGQ6OnN0cmluZyYgbWlzY19uYW1lKSBvdmVycmlkZTsKKyAgICBzdGQ6OnN0cmluZyBHZXRNZXJnZVN0YXR1cyhjb25zdCBzdGQ6OnN0cmluZyYgbWlzY19uYW1lKSBvdmVycmlkZTsKKyAgICB2b2lkIEpvaW5BbGxUaHJlYWRzKCkgb3ZlcnJpZGU7CisgICAgdm9pZCBUZXJtaW5hdGVNZXJnZVRocmVhZHMoKSBvdmVycmlkZTsKKyAgICBkb3VibGUgR2V0TWVyZ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B0cjxTbmFwc2hvdEhhbmRsZXI+IHNuYXB1c2VyZCkKKyAgICA6IFdvcmtlcihjb3dfZGV2aWNlLCBtaXNjX25hbWUsIGJhc2VfcGF0aF9tZXJnZSwgc25hcHVzZXJkKSB7fQorCitpbnQgTWVyZ2VXb3JrZXI6OlByZXBhcmVNZXJnZSh1aW50NjRfdCogc291cmNlX29mZnNldCwgaW50KiBwZW5kaW5nX29wcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPGNvbnN0IENvd09wZXJhdGlvbio+KiByZXBsYWNlX3plcm9fdmVjKSB7CiAgICAgaW50IG51bV9vcHMgPSAqcGVuZGluZ19vcHM7CiAgICAgaW50IG5yX2NvbnNlY3V0aXZlID0gMDsKICAgICBib29sIGNoZWNrT3JkZXJlZE9wID0gKHJlcGxhY2VfemVyb192ZWMgPT0gbnVsbHB0cik7CiAKICAgICBkbyB7Ci0gICAgICAgIGlmICghY293b3BfaXRlcl8tPkRvbmUoKSAmJiBudW1fb3BzKSB7Ci0gICAgICAgICAgICBjb25zdCBDb3dPcGVyYXRpb24qIGNvd19vcCA9ICZjb3dvcF9pdGVyXy0+R2V0KCk7CisgICAgICAgIGlmICghY293b3BfaXRlcl8tPkF0RW5kKCkgJiYgbnVtX29wcykgeworICAgICAgICAgICAgY29uc3QgQ293T3BlcmF0aW9uKiBjb3dfb3AgPSBjb3dvcF9pdGVyXy0+R2V0KCk7CiAgICAgICAgICAgICBpZiAoY2hlY2tPcmRlcmVkT3AgJiYgIUlzT3JkZXJlZE9wKCpjb3dfb3ApKSB7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC00NSw4ICs1NCw4IEBACiAgICAgICAgICAgICBudW1fb3BzIC09IDE7CiAgICAgICAgICAgICBucl9jb25zZWN1dGl2ZSA9IDE7CiAKLSAgICAgICAgICAgIHdoaWxlICghY293b3BfaXRlcl8tPkRvbmUoKSAmJiBudW1fb3BzKSB7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gICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIkFjcXVpcmVCdWZmZXIgZmFpbGVkIGluIE1lcmdlUmVwbGFjZU9wcyI7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGNvd19vcC0+dHlwZSgpID09IGtDb3dSZXBsYWNlT3ApIHsKKyAgICAgICAgICAgICAgICBpZiAoIXJlYWRlcl8tPlJlYWREYXRhKGNvd19vcCwgYnVmZmVyLCBCTE9DS19TWikpIHsKKyAgICAgICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gcmVhZCBDT1cgaW4gbWVyZ2UiOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBDSEVDSyhjb3dfb3AtPnR5cGUgPT0ga0Nvd1plcm9PcCk7Ci0gICAgICAgICAgICAgICAgaWYgKCFQcm9jZXNzWmVyb09wKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJNZXJnZSBaZXJvT3AgZmFpbGVkLiI7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgQ0hFQ0soY293X29wLT50eXBlKCkgPT0ga0Nvd1plcm9PcCk7CisgICAgICAgICAgICAgICAgbWVtc2V0KGJ1ZmZlciwgMCwgQkxPQ0tfU1opOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBidWZzaW5rXy5VcGRhdGVCdWZmZXJPZmZzZXQoQkxPQ0tfU1opOwogICAgICAgICB9CiAKICAgICAgICAgc2l6ZV90IGlvX3NpemUgPSBsaW5lYXJfYmxvY2tzICogQkxPQ0tfU1o7CkBAIC0xNDksNyArMTU5LDcgQEAKIAogICAgICAgICBpZiAoc25h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19vcCA9IGNvd29wX2l0ZXJfLT5HZXQoKTsKICAgICAgICAgaWYgKCFJc09yZGVyZWRPcCgqY293X29wKSkgewogICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KQEAgLTE5MCw2ICsyMDAsNyBAQAogICAgICAgICAvLyBXYWl0IGZvciBSQSB0aHJlYWQgdG8gbm90aWZ5IHRoYXQgdGhlIG1lcmdlIHdpbmRvdwogICAgICAgICAvLyBpcyByZWFkeSBmb3IgbWVyZ2luZy4KICAgICAgICAgaWYgKCFzbmFwdXNlcmRfLT5XYWl0Rm9yTWVyZ2VCZWdpbigpKSB7CisgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIkZhaWxlZCB3YWl0aW5nIGZvciBtZXJnZSB0byBiZWdpbiI7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KIApAQCAtMjk1LDcgKzMwNiw3IEBACiAgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgZmFsbGJhY2sgdG8gc3luY2hyb25vdXMgSS9PLgogICAgICAgICAgICAgICAgICAgICByZXQgPSBpb191cmluZ193YWl0X2NxZShyaW5nXy5nZXQoKSwgJmNxZSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiTWVyZ2U6IGlvX3VyaW5nX3dhaXRfY3FlIGZhaWxlZDogIiA8PCByZXQ7CisgICAgICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIk1lcmdlOiBpb191cmluZ193YWl0X2NxZSBmYWlsZWQ6ICIgPDwgc3RyZXJyb3IoLXJldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXMgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9CkBAIC0zNTQsMTUgKzM2NSwxNSBAQAogICAgIHJldHV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J1ZmZlcikgeworICAgIGlmICghUmVhZEZyb21Tb3VyY2VEZXZpY2UoY293X29wLCBidWZmZXIpKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBpZiAoeG9yX2J1ZmZlcl8uZW1wdHkoKSkgeworICAgICAgICB4b3JfYnVmZmVyXy5yZXNpemUoQkxPQ0tfU1opOworICAgIH0KKyAgICBDSEVDSyh4b3JfYnVmZmVyXy5zaXplKCkgPT0gQkxPQ0tfU1opOworCisgICAgc3NpemVfdCBzaXplID0gcmVhZGVyXy0+UmVhZERhdGEoY293X29wLCB4b3JfYnVmZmVyXy5kYXRhKCksIHhvcl9idWZmZXJfLnNpemUoKSk7CisgICAgaWYgKHNpemUgIT0gQkxPQ0tfU1opIHsKKyAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJQcm9jZXNzWG9yT3AgZmFpbGVkIGZvciBibG9jayAiIDw8IGNvd19vcC0+bmV3X2Jsb2NrCisgICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCByZXR1cm4gdmFsdWU6ICIgPDwgc2l6ZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGF1dG8geG9yX291dCA9IHJlaW50ZXJwcmV0X2Nhc3Q8dWludDhfdCo+KGJ1ZmZlcik7CisgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBCTE9DS19TWjsgaSsrKSB7CisgICAgICAgIHhvcl9vdXRbaV0gXj0geG9yX2J1ZmZlcl9baV07CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitib29sIFJlYWRXb3JrZXI6OlByb2Nlc3NaZXJvT3Aodm9pZCogYnVmZmVyKSB7CisgICAgbWVtc2V0KGJ1ZmZlciwgMCwgQkxPQ0tfU1opOworICAgIHJldHVybiB0cnVlOworfQorCitib29sIFJlYWRXb3JrZXI6OlByb2Nlc3NPcmRlcmVkT3AoY29uc3QgQ293T3BlcmF0aW9uKiBjb3dfb3AsIHZvaWQqIGJ1ZmZlcikgeworICAgIE1FUkdFX0dST1VQX1NUQVRFIHN0YXRlID0gc25hcHVzZXJkXy0+UHJvY2Vzc01lcmdpbmdCbG9jayhjb3dfb3AtPm5ld19ibG9jaywgYnVmZmVyKTsKKworICAgIHN3aXRjaCAoc3RhdGUpIHsKKyAgICAgICAgY2FzZSBNRVJHRV9HUk9VUF9TVEFURTo6R1JPVVBfTUVSR0VfQ09NUExFVEVEOiB7CisgICAgICAgICAgICAvLyBNZXJnZSBpcyBjb21wbGV0ZWQgZm9yIHRoaXMgQ09XIG9wOyBqdXN0IHJlYWQgZGlyZWN0bHkgZnJvbQorICAgICAgICAgICAgLy8gdGhlIGJhc2UgZGV2aWNlCisgICAgICAgICAgICBTTkFQX0xPRyhERUJVRykgPDwgIk1lcmdlLWNvbXBsZXRlZDogUmVhZGluZyBmcm9tIGJhc2UgZGV2aWNlIHNlY3RvcjogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IChjb3dfb3AtPm5ld19ibG9jayA+PiBTRUNUT1JfU0hJRlQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBCbG9jay1udW1iZXI6ICIgPDwgY293X29wLT5uZXdfYmxvY2s7CisgICAgICAgICAgICBpZiAoIVJlYWREYXRhRnJvbUJhc2VEZXZpY2UoQ2h1bmtUb1NlY3Rvcihjb3dfb3AtPm5ld19ibG9jayksIGJ1ZmZlciwgQkxPQ0tfU1opKSB7CisgICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJSZWFkRGF0YUZyb21CYXNlRGV2aWNlIGF0IHNlY3RvcjogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAoY293X29wLT5uZXdfYmxvY2sgPj4gU0VDVE9SX1NISUZUKSA8PCAiIGFmdGVyIG1lcmdlLWNvbXBsZXRlLiI7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBNRVJHRV9HUk9VUF9TVEFURTo6R1JPVVBfTUVSR0VfUEVORElORzogeworICAgICAgICAgICAgYm9vbCByZXQ7CisgICAgICAgICAgICBpZiAoY293X29wLT50eXBlKCkgPT0ga0Nvd0NvcHlPcCkgeworICAgICAgICAgICAgICAgIHJldCA9IFByb2Nlc3NDb3B5T3AoY293X29wLCBidWZmZXIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXQgPSBQcm9jZXNzWG9yT3AoY293X29wLCBidWZmZXIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBJL08gaXMgY29tcGxldGUgLSBkZWNyZW1lbnQgdGhlIHJlZmNvdW50IGlycmVzcGVjdGl2ZSBvZiB0aGUgcmV0dXJuCisgICAgICAgICAgICAvLyBzdGF0dXMKKyAgICAgICAgICAgIHNuYXB1c2VyZF8tPk5vdGlmeUlPQ29tcGxldGlvbihjb3dfb3AtPm5ld19ibG9jayk7CisgICAgICAgICAgICByZXR1cm4gcmV0OworICAgICAgICB9CisgICAgICAgIC8vIFdlIGFscmVhZHkgaGF2ZSB0aGUgZGF0YSBpbiB0aGUgYnVmZmVyIHJldHJpZXZlZCBmcm9tIFJBIHRocmVhZC4KKyAgICAgICAgLy8gTm90aGluZyB0byBwcm9jZXNzIGZ1cnRoZXIuCisgICAgICAgIGNhc2UgTUVSR0VfR1JPVVBfU1RBVEU6OkdST1VQX01FUkdFX1JBX1JFQURZOiB7CisgICAgICAgICAgICBbW2ZhbGx0aHJvdWdoXV07CisgICAgICAgIH0KKyAgICAgICAgY2FzZSBNRVJHRV9HUk9VUF9TVEFURTo6R1JPVVBfTUVSR0VfSU5fUFJPR1JFU1M6IHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgIC8vIEFsbCBvdGhlciBzdGF0ZXMsIGZhaWwgdGhlIEkvTyB2aXogKEdST1VQX01FUkdFX0ZBSUxFRCBhbmQgR1JPVVBfSU5WQUxJRCkKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiBmYWxzZTsKK30KKworYm9vbCBSZWFkV29ya2VyOjpQcm9jZXNzQ293T3AoY29uc3QgQ293T3BlcmF0aW9uKiBjb3dfb3AsIHZvaWQqIGJ1ZmZlcikgeworICAgIGlmIChjb3dfb3AgPT0gbnVsbHB0cikgeworICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlByb2Nlc3NDb3dPcDogSW52YWxpZCBjb3dfb3AiOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgc3dpdGNoIChjb3dfb3AtPnR5cGUoKSkgeworICAgICAgICBjYXNlIGtDb3dSZXBsYWNlT3A6IHsKKyAgICAgICAgICAgIHJldHVybiBQcm9jZXNzUmVwbGFjZU9wKGNvd19vcCwgYnVmZmVyKTsKKyAgICAgICAgfQorCisgICAgICAgIGNhc2Uga0Nvd1plcm9PcDogeworICAgICAgICAgICAgcmV0dXJuIFByb2Nlc3NaZXJvT3AoYnVmZmVyKTsKKyAgICAgICAgfQorCisgICAgICAgIGNhc2Uga0Nvd0NvcHlPcDoKKyAgICAgICAgICAgIFtbZmFsbHRocm91Z2hdXTsKKyAgICAgICAgY2FzZSBrQ293WG9yT3A6IHsKKyAgICAgICAgICAgIHJldHVybiBQcm9jZXNzT3JkZXJlZE9wKGNvd19vcCwgYnVmZmVyKTsKKyAgICAgICAgfQorCisgICAgICAgIGRlZmF1bHQ6IHsKKyAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiVW5rbm93biBvcGVyYXRpb24tdHlwZSBmb3VuZDogIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHN0YXRpY19jYXN0PHVpbnQ4X3Q+KGNvd19vcC0+dHlwZSgpKTsKKyAgICAgICAgfQorICAgIH0KKyA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7CisKKyAgICBkbyB7CisgICAgICAgIC8vIFByb2Nlc3MgMU1CIHBheWxvYWQgYXQgYSB0aW1lCisgICAgICAgIHNpemVfdCByZWFkX3NpemUgPSBzdGQ6Om1pbihQQVlMT0FEX0JVRkZFUl9TWiwgcmVtYWluaW5nX3NpemUpOworCisgICAgICAgIHNpemVfdCB0b3RhbF9ieXRlc19yZWFkID0gMDsKKworICAgICAgICB3aGlsZSAocmVhZF9zaXplKSB7CisgICAgICAgICAgICAvLyBXZSBuZWVkIHRvIGNoZWNrIGV2ZXJ5IDRrIGJsb2NrIHRvIHZlcmlmeSBpZiBpdCBpcworICAgICAgICAgICAgLy8gcHJlc2VudCBpbiB0aGUgbWFwcGluZy4KKyAgICAgICAgICAgIHNpemVfdCBzaXplID0gc3RkOjptaW4oQkxPQ0tfU1osIHJlYWRfc2l6ZSk7CisKKyAgICAgICAgICAgIGF1dG8gaXQgPSBzdGQ6Omxvd2VyX2JvdW5kKGNodW5rX3ZlYy5iZWdpbigpLCBjaHVua192ZWMuZW5kKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6Om1ha2VfcGFpcihzZWN0b3IsIG51bGxwdHIpLCBTbmFwc2hvdEhhbmRsZXI6OmNvbXBhcmUpOworICAgICAgICAgICAgYm9vbCBub3RfZm91bmQgPSAoaXQgPT0gY2h1bmtfdmVjLmVuZCgpIHx8IGl0LT5maXJzdCAhPSBzZWN0b3IpOworCisgICAgICAgICAgICB2b2lkKiBidWZmZXIgPSBibG9ja19zZXJ2ZXJfLT5HZXRSZXNwb25zZUJ1ZmZlcihCTE9DS19TWiwgc2l6ZSk7CisgICAgICAgICAgICBpZiAoIWJ1ZmZlcikgeworICAgICAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiQWNxdWlyZUJ1ZmZlciBmYWlsZWQgaW4gUmVhZEFsaWduZWRTZWN0b3IiOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG5vdF9mb3VuZCkgeworICAgICAgICAgICAgICAgIC8vIEJsb2NrIG5vdCBmb3VuZCBpbiBtYXAgLSB3aGljaCBtZWFucyB0aGlzIGJsb2NrIHdhcyBub3QKKyAgICAgICAgICAgICAgICAvLyBjaGFuZ2VkIGFzIHBlciB0aGUgT1RBLiBKdXN0IHJvdXRlIHRoZSBJL08gdG8gdGhlIGJhc2UKKyAgICAgICAgICAgICAgICAvLyBkZXZpY2UuCisgICAgICAgICAgICAgICAgaWYgKCFSZWFkRGF0YUZyb21CYXNlRGV2aWNlKHNlY3RvciwgYnVmZmVyLCBzaXplKSkgeworICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlJlYWREYXRhRnJvbUJhc2VEZXZpY2UgZmFpbGVkIjsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldCA9IHNpemU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIFdlIGZvdW5kIHRoZSBzZWN0b3IgaW4gbWFwcGluZy4gQ2hlY2sgdGhlIHR5cGUgb2YgQ09XIE9QIGFuZAorICAgICAgICAgICAgICAgIC8vIHByb2Nlc3MgaXQuCisgICAgICAgICAgICAgICAgaWYgKCFQcm9jZXNzQ293T3AoaXQtPnNlY29uZCwgYnVmZmVyKSkgeworICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiUHJvY2Vzc0Nvd09wIGZhaWxlZCwgc2VjdG9yID0gIiA8PCBzZWN0b3IgPDwgIiwgc2l6ZSA9ICIgPDwgc3o7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXQgPSBzdGQ6Om1pbihCTE9DS19TWi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ZXQgPCAwKSB7CisgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlJlYWRVbmFsaWduZWRTZWN0b3IgZmFpbGVkIGZvciBzZWN0b3I6ICIgPDwgc2VjdG9yCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBzaXplOiAiIDw8IHNpemUgPDwgIiBpdC0+c2VjdG9yOiAiIDw8IGl0LT5maXJzdDsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHJlbWFpbmluZ19zaXplIC09IHJldDsKKyAgICAgICAgc2VjdG9yICs9IChyZXQgPj4gU0VDVE9SX1NISUZUKTsKKworICAgICAgICAvLyBTZW5kIHRoZSBkYXRhIGJhY2sKKyAgICAgICAgaWYgKCFTZW5kQnVmZmVyZWRJbygpKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICAvLyBJZiB3ZSBzdGlsbCBoYXZlIHBlbmRpbmcgZGF0YSB0byBiZSBwcm9jZXNzZWQsIHRoaXMgd2lsbCBiZSBhbGlnbmVkIEkvTworICAgICAgICBpZiAocmVtYWluaW5nX3NpemUpIHsKKyAgICAgICAgICAgIHJldHVybiBSZWFkQWxpZ25lZFNlY3RvcihzZWN0b3IsIHJlbWFpbmluZ19zaXplKTsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIC8vIFRoaXMgaXMgYWxsIGFib3V0IGhhbmRsaW5nIEkvTyByZXF1ZXN0IHRvIGJlIHJvdXRlZCB0byBiYXNlIGRldmljZQorICAgICAgICAvLyBhcyB0aGUgSS9PIGlzIG5vdCBtYXBwZWQgdG8gYW55IG9mIHRoZSBDT1cgb3BzLgorICAgICAgICBsb2ZmX3QgYWxpZ25lZF9vZmZzZXQgPSByZXF1ZXN0ZWRfb2Zmc2V0OworICAgICAgICAvLyBBbGlnbiB0byBuZWFyZXN0IDRrCisgICAgICAgIGFsaWduZWRfb2Zmc2V0ICs9IEJMT0NLX1NaIC0gMTsKKyAgICAgICAgYWxpZ25lZF9vZmZzZXQgJj0gfihCTE9DS19TWiAtIDEpOworICAgICAgICAvLyBGaW5kIHRoZSBkaWZmIG9mIHRoZSBhbGlnbmVkIG9mZnNldAorICAgICAgICBzaXplX3QgZGlmZl9zaXplID0gYWxpZ25lZF9vZmZzZXQgLSByZXF1ZXN0ZWRfb2Zmc2V0OworICAgICAgICBDSEVDSyhkaWZmX3NpemUgPD0gQkxPQ0tfU1opOworCisgICAgICAgIHNpemVfdCByZWFkX3NpemUgPSBzdGQ6Om1pbihyZW1haW5pbmdfc2l6ZSwgZGlmZl9zaXplKTsKKyAgICAgICAgdm9pZCogYnVmZmVyID0gYmxvY2tfc2VydmVyXy0+R2V0UmVzcG9uc2VCdWZmZXIoQkxPQ0tfU1osIHJlYWRfc2l6ZSk7CisgICAgICAgIGlmICghYnVmZmVyKSB7CisgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIkFjcXVpcmVCdWZmZXIgZmFpbGVkIGluIFJlYWRVbmFsaWduZWRTZWN0b3IiOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmICghUmVhZERhdGFGcm9tQmFzZURldmljZShzZWN0b3IsIGJ1ZmZlciwgcmVhZF9zaXplKSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmICghU2VuZEJ1ZmZlcmVkSW8oKSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHJlbWFpbmluZ19zaXplID49IGRpZmZfc2l6ZSkgeworICAgICAgICAgICAgcmVtYWluaW5nX3NpemUgLT0gZGlmZl9zaXplOworICAgICAgICAgICAgc2l6ZV90IG51bV9zZWN0b3JzX3JlYWQgPSAoZGlmZl9zaXplID4+IFNFQ1RPUl9TSElGVCk7CisgICAgICAgICAgICBzZWN0b3IgKz0gbnVtX3N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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaXNjX25hbWVfLCBiYXNlX3BhdGhfbWVyZ2VfLCBHZXRTaGFyZWRQdHIoKSk7CisgICAgICAgIGF1dG8gd3QgPSBzdGQ6Om1ha2VfdW5pcXVlPFJlYWRXb3JrZXI+KGNvd19kZXZpY2VfLCBiYWNraW5nX3N0b3JlX2RldmljZV8sIG1pc2NfbmFtZV8sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VfcGF0aF9tZXJnZV8sIEdldFNoYXJlZFB0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibG9ja19zZXJ2ZXJfb3BlbmVyXywgb19kaXJlY3RfKTsKICAgICAgICAgaWYgKCF3dC0+SW5pdCgpKSB7CiAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlRocmVhZCBpbml0aWFsaXphdGlvbiBmYWlsZWQiOwogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwpAQCAtNTcsOCArNjEsOCBAQAogICAgICAgICB3b3JrZXJfdGhyZWFkc18ucHVzaF9iYWNrKHN0ZDo6bW92ZSh3dCkpOwogICAgIH0KIAotICAgIG1lcmdlX3RocmVhZF8gPSBzdGQ6Om1ha2VfdW5pcXVlPFdvcmtlcj4oY293X2RldmljZV8sIGJhY2tpbmdfc3RvcmVfZGV2aWNlXywgY29udHJvbF9kZXZpY2VfLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlzY19uYW1lXywgYmFzZV9wYXRoX21lcmdlXywgR2V0U2hhcmVkUHRyKCkpOworICAgIG1lcmdlX3RocmVhZF8gPSBzdGQ6Om1ha2VfdW5pcXVlPE1lcmdlV29ya2VyPihjb3dfZGV2aWNlXywgbWlzY19uYW1lXywgYmFzZV9wYXRoX21lcmdlXywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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rKSwgQkxPQ0tfU1opKSB7Ci0gICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJSZWFkRGF0YUZyb21CYXNlRGV2aWNlIGF0IHNlY3RvcjogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAoY293X29wLT5uZXdfYmxvY2sgPj4gU0VDVE9SX1NISUZUKSA8PCAiIGFmdGVyIG1lcmdlLWNvbXBsZXRlLiI7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgY2FzZSBNRVJHRV9HUk9VUF9TVEFURTo6R1JPVVBfTUVSR0VfUEVORElORzogewotICAgICAgICAgICAgYm9vbCByZXQ7Ci0gICAgICAgICAgICBpZiAoY293X29wLT50eXBlID09IGtDb3dDb3B5T3ApIHsKLSAgICAgICAgICAgICAgICByZXQgPSBQcm9jZXNzQ29weU9wKGNvd19vcCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldCA9IFByb2Nlc3NYb3JPcChjb3dfb3ApOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBJL08gaXMgY29tcGxldGUgLSBkZWNyZW1lbnQgdGhlIHJlZmNvdW50IGlycmVzcGVjdGl2ZSBvZiB0aGUgcmV0dXJuCi0gICAgICAgICAgICAvLyBzdGF0dXMKLSAgICAgICAgICAgIHNuYXB1c2VyZF8tPk5vdGlmeUlPQ29tcGxldGlvbihjb3dfb3AtPm5ld19ibG9jayk7Ci0gICAgICAgICAgICByZXR1cm4gcmV0OwotICAgICAgICB9Ci0gICAgICAgIC8vIFdlIGFscmVhZHkgaGF2ZSB0aGUgZGF0YSBpbiB0aGUgYnVmZmVyIHJldHJpZXZlZCBmcm9tIFJBIHRocmVhZC4KLSAgICAgICAgLy8gTm90aGluZyB0byBwcm9jZXNzIGZ1cnRoZXIuCi0gICAgICAgIGNhc2UgTUVSR0VfR1JPVVBfU1RBVEU6OkdST1VQX01FUkdFX1JBX1JFQURZOiB7Ci0gICAgICAgICAgICBbW2ZhbGx0aHJvdWdoXV07Ci0gICAgICAgIH0KLSAgICAgICAgY2FzZSBNRVJHRV9HUk9VUF9TVEFURTo6R1JPVVBfTUVSR0VfSU5fUFJPR1JFU1M6IHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgIC8vIEFsbCBvdGhlciBzdGF0ZXMsIGZhaWwgdGhlIEkvTyB2aXogKEdST1VQX01FUkdFX0ZBSUxFRCBhbmQgR1JPVVBfSU5WQUxJRCkKLSAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHJldHVybiBmYWxzZTsKLX0KLQotYm9vbCBXb3JrZXI6OlByb2Nlc3NDb3dPcChjb25zdCBDb3dPcGVyYXRpb24qIGNvd19vcCkgewotICAgIGlmIChjb3dfb3AgPT0gbnVsbHB0cikgewotICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlByb2Nlc3NDb3dPcDogSW52YWxpZCBjb3dfb3AiOwotICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgfQotCi0gICAgc3dpdGNoIChjb3dfb3AtPnR5cGUpIHsKLSAgICAgICAgY2FzZSBrQ293UmVwbGFjZU9wOiB7Ci0gICAgICAgICAgICByZXR1cm4gUHJvY2Vzc1JlcGxhY2VPcChjb3dfb3ApOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBrQ293WmVyb09wOiB7Ci0gICAgICAgICAgICByZXR1cm4gUHJvY2Vzc1plcm9PcCgpOwotICAgICAgICB9Ci0KLSAgICAgICAgY2FzZSBrQ293Q29weU9wOgotICAgICAgICAgICAgW1tmYWxsdGhyb3VnaF1dOwotICAgICAgICBjYXNlIGtDb3dYb3JPcDogewotICAgICAgICAgICAgcmV0dXJu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OwotICAgIGludCByZXQgPSAwOwotCi0gICAgZG8gewotICAgICAgICAvLyBQcm9jZXNzIDFNQiBwYXlsb2FkIGF0IGEgdGltZQotICAgICAgICBzaXplX3QgcmVhZF9zaXplID0gc3RkOjptaW4oUEFZTE9BRF9CVUZGRVJfU1osIHJlbWFpbmluZ19zaXplKTsKLQotICAgICAgICBoZWFkZXItPnR5cGUgPSBETV9VU0VSX1JFU1BfU1VDQ0VTUzsKLSAgICAgICAgc2l6ZV90IHRvdGFsX2J5dGVzX3JlYWQgPSAwOwotICAgICAgICBpb19lcnJvciA9IGZhbHNlOwotICAgICAgICBidWZzaW5rXy5SZXNldEJ1ZmZlck9mZnNldCgpOwotCi0gICAgICAgIHdoaWxlIChyZWFkX3NpemUpIHsKLSAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gY2hlY2sgZXZlcnkgNGsgYmxvY2sgdG8gdmVyaWZ5IGlmIGl0IGlzCi0gICAgICAgICAgICAvLyBwcmVzZW50IGluIHRoZSBtYXBwaW5nLgotICAgICAgICAgICAgc2l6ZV90IHNpemUgPSBzdGQ6Om1pbihCTE9DS19TWiwgcmVhZF9zaXplKTsKLQotICAgICAgICAgICAgYXV0byBpdCA9IHN0ZDo6bG93ZXJfYm91bmQoY2h1bmtfdmVjLmJlZ2luKCksIGNodW5rX3ZlYy5lbmQoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6bWFrZV9wYWlyKHNlY3RvciwgbnVsbHB0ciksIFNuYXBzaG90SGFuZGxlcjo6Y29tcGFyZSk7Ci0gICAgICAgICAgICBib29sIG5vdF9mb3VuZCA9IChpdCA9PSBjaHVua192ZWMuZW5kKCkgfHwgaXQtPmZpcnN0ICE9IHNlY3Rvcik7Ci0KLSAgICAgICAgICAgIGlmIChub3RfZm91bmQpIHsKLSAgICAgICAgICAgICAgICAvLyBCbG9jayBub3QgZm91bmQgaW4gbWFwIC0gd2hpY2ggbWVhbnMgdGhpcyBibG9jayB3YXMgbm90Ci0gICAgICAgICAgICAgICAgLy8gY2hhbmdlZCBhcyBwZXIgdGhlIE9UQS4gSnVzdCByb3V0ZSB0aGUgSS9PIHRvIHRoZSBiYXNlCi0gICAgICAgICAgICAgICAgLy8gZGV2aWNlLgotICAgICAgICAgICAgICAgIGlmICghUmVhZERhdGFGcm9tQmFzZURldmljZShzZWN0b3IsIHNpemUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiUmVhZERhdGFGcm9tQmFzZURldmljZSBmYWlsZWQiOwotICAgICAgICAgICAgICAgICAgICBoZWFkZXItPnR5cGUgPSBETV9VU0VSX1JFU1BfRVJST1I7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgcmV0ID0gc2l6ZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgLy8gV2UgZm91bmQgdGhlIHNlY3RvciBpbiBtYXBwaW5nLiBDaGVjayB0aGUgdHlwZSBvZiBDT1cgT1AgYW5kCi0gICAgICAgICAgICAgICAgLy8gcHJvY2VzcyBpdC4KLSAgICAgICAgICAgICAgICBpZiAoIVByb2Nlc3NDb3dPcChpdC0+c2Vjb25kKSkgewotICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlByb2Nlc3NDb3dPcCBmYWlsZWQiOwotICAgICAgICAgICAgICAgICAgICBoZWFkZXItPnR5cGUgPSBETV9VU0VSX1JFU1BfRVJST1I7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgcmV0ID0gQkxPQ0tfU1o7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIEp1c3QgcmV0dXJuIHRoZSBoZWFkZXIgaWYgaXQgaXMgYW4gZXJyb3IKLSAgICAgICAgICAgIGlmIChoZWFkZXItPnR5cGUgPT0gRE1fVVNFUl9SRVNQX0VSUk9SKSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFSZXNwb25kSU9FcnJvcihoZWFkZXJfcmVzcG9uc2UpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpb19lcnJvciA9IHRydWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJlYWRfc2l6ZSAtPSByZXQ7Ci0gICAgICAgICAgICB0b3RhbF9ieXRlc19yZWFkICs9IHJldDsKLSAgICAgICAgICAgIHNlY3RvciArPSAocmV0ID4+IFNFQ1RPUl9TSElGVCk7Ci0gICAgICAgICAgICBidWZzaW5rXy5VcGRhdGVCdWZmZXJPZmZzZXQocmV0KTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICghaW9fZXJyb3IpIHsKLSAgICAgICAgICAgIGlmICghV3JpdGVEbVVzZXJQYXlsb2FkKHRvdGFsX2J5dGVzX3JlYWQsIGhlYWRlcl9yZXNwb25zZSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIFNOQVBfTE9HKERFQlVHKSA8PCAiV3JpdGVEbVVzZXJQYXlsb2FkIHN1Y2Nlc3MgdG90YWxfYnl0ZXNfcmVhZDogIiA8PCB0b3RhbF9ieXRlc19yZWFkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBoZWFkZXItcmVzcG9uc2U6ICIgPDwgaGVhZGVyX3Jlc3BvbnNlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiByZW1haW5pbmdfc2l6ZTogIiA8PCByZW1haW5pbmdfc2l6ZTsKLSAgICAgICAgICAgIGhlYWRlcl9yZXNwb25zZSA9IGZhbHNlOwotICAgICAgICAgICAgcmVtYWluaW5nX3NpemUgLT0gdG90YWxfYnl0ZXNfcmVhZDsKLSAgICAgICAgfQotICAgIH0gd2hpb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gIC8vIG1hcHBpbmcuCkBAIC0xNjIsNyArMTkxLDYgQEAKICAgICAgICAgaWYgKCEobnVtX29wcyA9PSAwKSkgewogICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJSZWNvbnN0cnVjdERhdGFGcm9tQ293IGZhaWxlZC4gTm90IGFsbCBvcHMgcmVjb3ZlcmQgIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgUGVuZGluZyBvcHM6ICIgPDwgbnVtX29wczsKLSAgICAgICAgICAgIHNuYXB1c2VyZF8tPlJlYWRBaGVhZElPRmFpbGVkKCk7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KIApAQCAtMTc1LDExICsyMDMsMTIgQEAKIAogICAgIGlmICghc25hcHVzZXJkXy0+UmVhZEFoZWFkSU9Db21wbGV0ZWQodHJ1ZSkpIHsKICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJSZWFkQWhlYWRJT0NvbXBsZXRlZCBmYWlsZWQuLi4iOwotICAgICAgICBzbmFwdXNlcmRfLT5SZWFkQWhlYWRJT0ZhaWxlZCgpOwogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgc25hcHVzZXJkXy0+UmFUaHJlYWRTdGFydGVkKCk7CiAgICAgU05BUF9MT0coSU5GTykgPDwgIlJlY29uc3RydWN0RGF0YUZyb21Db3cgc3VjY2VzcyI7CisgICAgbm90aWZ5X3JlYWRfYWhlYWRfZmFpbGVkLkNhbmNlbCgpOwogICAgIHJldHVybiB0cnVlOwogfQogCkBAIC00MDIsNyArNDMxLDcgQEAKICAgICAgICAgLy8gd2lsbCBmYWxsYmFjayB0byBzeW5jaHJvbm91cyBJL08uCiAgICAgICAgIGludCByZXQgPSBpb191cmluZ193YWl0X2NxZShyaW5nXy5nZXQoKSwgJmNxZSk7CiAgICAgICAgIGlmIChyZXQpIHsKLSAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiUmVhZC1haGVhZCAtIGlvX3VyaW5nX3dhaXRfY3FlIGZhaWxlZDogIiA8PCByZXQ7CisgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlJlYWQtYWhlYWQgLSBpb191cmluZ193YWl0X2NxZSBmYWlsZWQ6ICIgPDwgc3RyZXJyb3IoLXJldCk7CiAgICAgICAgICAgICBzdGF0dXMgPSBmYWxzZTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CkBAIC00NjcsMTQgKzQ5NiwyMCBAQAogICAgICAgICBpZiAoeG9yX29wX2luZGV4IDwgeG9yX29wX3ZlYy5zaXplKCkpIHsKICAgICAgICAgICAgIGNvbnN0IENvd09wZXJhdGlvbiogeG9yX29wID0geG9yX29wX3ZlY1t4b3Jfb3BfaW5kZXhdOwogICAgICAgICAgICAgaWYgKHhvcl9vcC0+bmV3X2Jsb2NrID09IG5ld19ibG9jaykgewotICAgICAgICAgICAgICAgIGlmICghcmVhZGVyXy0+UmVhZERhdGEoKnhvcl9vcCwgJmJ1ZnNpbmtfKSkgeworICAgICAgICAgICAgICAgIHZvaWQqIGJ1ZmZlciA9IGJ1ZnNpbmtfLkFjcXVpcmVCdWZmZXIoQkxPQ0tfU1opOworICAgICAgICAgICAgICAgIGlmICghYnVmZmVyKSB7CisgICAgICAgICAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiUmVhZEFoZWFkIC0gZmFpbGVkIHRvIGFsbG9jYXRlIGJ1ZmZlciBmb3IgYmxvY2s6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHhvcl9vcC0+bmV3X2Jsb2NrOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChzc2l6ZV90IHJ2ID0gcmVhZGVyXy0+UmVhZERhdGEoeG9yX29wLCBidWZmZXIsIEJMT0NLX1NaKTsgcnYgIT0gQkxPQ0tfU1opIHsKICAgICAgICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBSZWFkQWhlYWQgLSBYb3JPcCBSZWFkIGZhaWxlZCBmb3IgYmxvY2s6ICIgPDwgeG9yX29wLT5uZXdfYmxvY2s7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBSZWFkQWhlYWQgLSBYb3JPcCBSZWFkIGZhaWxlZCBmb3IgYmxvY2s6ICIgPDwgeG9yX29wLT5uZXdfYmxvY2sKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCByZXR1cm4gdmFsdWU6ICIgPDwgcnY7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICB4b3Jfb3BfaW5kZXggKz0gMTsKLSAgICAgICAgICAgICAgICBidWZzaW5rXy5VcGRhdGVCdWZmZXJPZmZzZXQoQkxPQ0tfU1opOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGJsb2NrX2luZGV4ICs9IDE7CkBAIC00OTIsNiArNTI3LDggQEAKICAgICBibG9ja3NfLmNsZWFyKCk7CiAgICAgc3RkOjp2ZWN0b3I8Y29uc3QgQ293T3BlcmF0aW9uKj4geG9yX29wX3ZlYzsKIAorICAgIEF1dG9Ob3RpZnlSZWFkQWhlYWRGYWlsZWQgbm90aWZ5X3JlYWRfYWhlYWRfZmFpbGVkKHNuYXB1c2VyZF8pOworCiAgICAgYnVmc2lua18uUmVzZXRCdWZmZXJPZmZzZXQoKTsKIAogICAgIC8vIE51bWJlciBvZiBvcHMgdG8gYmUgbWVyZ2VkIGluIHRoaXMgd2luZG93LiBUaGlzIGlzIGEgZml4ZWQgc2l6ZQpAQCAtNTE4LDggKzU1NSw2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgb2Zmc2V0IDoiIDw8IHNvdXJjZV9vZmZzZXQgJSBCTE9DS19TWgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIGJ1ZmZlcl9vZmZzZXQgOiAiIDw8IGJ1ZmZlcl9vZmZzZXQgPDwgIiBpb19zaXplIDogIiA8PCBpb19zaXplCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgYnVmLWFkZHIgOiAiIDw8IHJlYWRfYWhlYWRfYnVmZmVyXzsKLQotICAgICAgICAgICAgc25hcHVzZXJkXy0+UmVhZEFoZWFkSU9GYWlsZWQoKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogCkBAIC01MzAsNiArNTY1LDcgQEAKIAogICAgIC8vIERvbmUgd2l0aCBtZXJnaW5nIG9yZGVyZWQgb3BzCiAgICAgaWYgKFJBSXRlckRvbmUoKSAmJiB0b3RhbF9ibG9ja3NfbWVyZ2VkXyA9PSAwKSB7CisgICAgICAgIG5vdGlmeV9yZWFkX2FoZWFkX2ZhaWxlZC5DYW5jZWwoKTsKICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgfQogCkBAIC01NjAsMjAgKzU5NiwyNSBAQAogICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhpcyBibG9jayBpcyBhbiBYT1Igb3AKICAgICAgICAgICAgIGlmICh4b3Jfb3AtPm5ld19ibG9jayA9PSBuZXdfYmxvY2spIHsKICAgICAgICAgICAgICAgICAvLyBSZWFkIHRoZSB4b3InZWQgZGF0YSBmcm9tIENPVwotICAgICAgICAgICAgICAgIGlmICghcmVhZGVyXy0+UmVhZERhdGEoKnhvcl9vcCwgJmJ1ZnNpbmspKSB7CisgICAgICAgICAgICAgICAgdm9pZCogYnVmZmVyID0gYnVmc2luay5HZXRQYXlsb2FkQnVmZmVyKEJMT0NLX1NaKTsKKyAgICAgICAgICAgICAgICBpZiAoIWJ1ZmZlcikgeworICAgICAgICAgICAgICAgICAgICBTTkFQX0xPRyhFUlJPUikgPDwgIlJlYWRBaGVhZCAtIGZhaWxlZCB0byBhbGxvY2F0ZSBidWZmZXIiOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChzc2l6ZV90IHJ2ID0gcmVhZGVyXy0+UmVhZERhdGEoeG9yX29wLCBidWZmZXIsIEJMT0NLX1NaKTsgcnYgIT0gQkxPQ0tfU1opIHsKICAgICAgICAgICAgICAgICAgICAgU05BUF9MT0coRVJST1IpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBSZWFkQWhlYWQgLSBYb3JPcCBSZWFkIGZhaWxlZCBmb3IgYmxvY2s6ICIgPDwgeG9yX29wLT5uZXdfYmxvY2s7Ci0gICAgICAgICAgICAgICAgICAgIHNuYXB1c2VyZF8tPlJlYWRBaGVhZElPRmFpbGVkKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBSZWFkQWhlYWQgLSBYb3JPcCBSZWFkIGZhaWxlZCBmb3IgYmxvY2s6ICIgPDwgeG9yX29wLT5uZXdfYmxvY2sKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiLCByZXR1cm4gdmFsdWU6ICIgPDwgcnY7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgLy8gUG9pbnRlciB0byB0aGUgZGF0YSByZWFkIGZyb20gYmFzZSBkZXZpY2UKLSAgICAgICAgICAgICAgICB1aW50OF90KiBidWZmZXIgPSByZWludGVycHJldF9jYXN0PHVpbnQ4X3QqPihidWZwdHIpOworICAgICAgICAgICAgICAgIHVpbnQ4X3QqIHJlYWRfYnVmZmVyID0gcmVpbnRlcnByZXRfY2FzdDx1aW50OF90Kj4oYnVmcHRyKTsKICAgICAgICAgICAgICAgICAvLyBHZXQgdGhlIHhvcidlZCBkYXRhIHJlYWQgZnJvbSBDT1cgZGV2aWNlCiAgICAgICAgICAgICAgICAgdWludDhf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lcigpOworICAgIGJvb2wgUkFJdGVyRG9uZSgpOworICAgIHZvaWQgUkFJdGVyTmV4dCgpOworICAgIHZvaWQgUkFSZXNldEl0ZXIodWludDY0X3QgbnVtX2Jsb2Nrcyk7CisgICAgY29uc3QgQ293T3BlcmF0aW9uKiBHZXRSQU9wSXRlcigpOworCisgICAgdm9pZCBJbml0aWFsaXplQnVmZmVyKCk7CisgICAgYm9vbCBJbml0UmVhZGVyKCk7CisgICAgYm9vbCBJbml0aWFsaXplRmRzKCk7CisKKyAgICB2b2lkIENsb3NlRmRzKCkgeyBiYWNraW5nX3N0b3JlX2ZkXyA9IHt9OyB9CisKKyAgICBib29sIFJlYWRBaGVhZElPU3RhcnQoKTsKKyAgICBpbnQgUHJlcGFyZU5leHRSZWFkQWhlYWQodWludDY0X3QqIHNvdXJjZV9vZmZzZXQsIGludCogcGVuZGluZ19vcHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6dmVjdG9yPHVpbnQ2NF90PiYgYmxvY2tzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OnZlY3Rvcjxjb25zdCBDb3dPcGVyYXRpb24qPiYgeG9yX29wX3ZlYyk7CisgICAgYm9vbCBSZWNvbnN0cnVjdERhdGFGcm9tQ293KCk7CisgICAgdm9pZCBDaGVja092ZXJsYXAoY29uc3QgQ293T3BlcmF0aW9uKiBjb3dfb3ApOworCisgICAgYm9vbCBSZWFkQWhlYWRBc3luY0lPKCk7CisgICAgYm9vbCBSZWFwSW9Db21wbGV0aW9ucyhpbnQgcGVuZGluZ19pb3NfdG9fY29tcGxldGUpOworICAgIGJvb2wgUmVhZFhvckRhdGEoc2l6ZV90IGJsb2NrX2luZGV4LCBzaXplX3QgeG9yX29wX2luZGV4LAorICAgICAgICAgICAgICAgICAgICAgc3RkOjp2ZWN0b3I8Y29uc3QgQ293T3BlcmF0aW9uKj4mIHhvcl9vcF92ZWMpOworICAgIHZvaWQgUHJvY2Vzc1hvckRhd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yBvcCA9IFJlc29sdmVvcChvdXRbMF0pOwogCi0gICAgc3dpdGNoIChvcCkgewotICAgICAgICBjYXNlIERhZW1vbk9wczo6SU5JVDogewotICAgICAgICAgICAgLy8gTWVzc2FnZSBmb3JtYXQ6Ci0gICAgICAgICAgICAvLyBpbml0LDxtaXNjX25hbWU+LDxjb3dfZGV2aWNlX3BhdGg+LDxiYWNraW5nX2RldmljZT4sPGJhc2VfcGF0aF9tZXJnZT4KLSAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAvLyBSZWFkcyB0aGUgbWV0YWRhdGEgYW5kIHNlbmQgdGhlIG51bWJlciBvZiBzZWN0b3JzCi0gICAgICAgICAgICBpZiAob3V0LnNpemUoKSAhPSA1KSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTWFsZm9ybWVkIGluaXQgbWVzc2FnZSwgIiA8PCBvdXQuc2l6ZSgpIDw8ICIgcGFydHMiOwotICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAiZmFpbCIpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBhdXRvIGhhbmRsZXIgPSBBZGRIYW5kbGVyKG91dFsxXSwgb3V0WzJdLCBvdXRbM10sIG91dFs0XSk7Ci0gICAgICAgICAgICBpZiAoIWhhbmRsZXIpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgYXV0byByZXR2YWwgPSAic3VjY2VzcywiICsgc3RkOjp0b19zdHJpbmcoaGFuZGxlci0+c25hcHVzZXJkKCktPkdldE51bVNlY3RvcnMoKSk7Ci0gICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgcmV0dmFsKTsKLSAgICAgICAgfQotICAgICAgICBjYXNlIERhZW1vbk9wczo6U1RBUlQ6IHsKLSAgICAgICAgICAgIC8vIE1lc3NhZ2UgZm9ybWF0OgotICAgICAgICAgICAgLy8gc3RhcnQsPG1pc2NfbmFtZT4KLSAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAvLyBTdGFydCB0aGUgbmV3IHRocmVhZCB3aGljaCBiaW5kcyB0byBkbS11c2VyIG1pc2MgZGV2aWNlCi0gICAgICAgICAgICBpZiAob3V0LnNpemUoKSAhPSAyKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTWFsZm9ybWVkIHN0YXJ0IG1lc3NhZ2UsICIgPDwgb3V0LnNpemUoKSA8PCAiIHBhcnRzIjsKLSAgICAgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobG9ja18pOwotICAgICAgICAgICAgYXV0byBpdGVyID0gRmluZEhhbmRsZXIoJmxvY2ssIG91dFsxXSk7Ci0gICAgICAgICAgICBpZiAoaXRlciA9PSBkbV91c2Vyc18uZW5kKCkpIHsKLSAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJDb3VsZCBub3QgZmluZCBoYW5kbGVyOiAiIDw8IG91dFsxXTsKLSAgICAgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghKCppdGVyKS0+c25hcHVzZXJkKCkgfHwgKCppdGVyKS0+c25hcHVzZXJkKCktPklzQXR0YWNoZWQoKSkgewotICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIlRyaWVkIHRvIHJlLWF0dGFjaCBjb250cm9sIGRldmljZTogIiA8PCBvdXRbMV07Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIVN0YXJ0SGFuZGxlcigqaXRlcikpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4g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gcmVhZHkgdG8gcmVjZWl2ZSBjb250cm9sIG1lc3NhZ2UuCi0gICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgR2V0RGFlbW9uU3RhdHVzKCkpOwotICAgICAgICB9Ci0gICAgICAgIGNhc2UgRGFlbW9uT3BzOjpERUxFVEU6IHsKLSAgICAgICAgICAgIC8vIE1lc3NhZ2UgZm9ybWF0OgotICAgICAgICAgICAgLy8gZGVsZXRlLDxtaXNjX25hbWU+Ci0gICAgICAgICAgICBpZiAob3V0LnNpemUoKSAhPSAyKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTWFsZm9ybWVkIGRlbGV0ZSBtZXNzYWdlLCAiIDw8IG91dC5zaXplKCkgPDwgIiBwYXJ0cyI7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobG9ja18pOwotICAgICAgICAgICAgICAgIGF1dG8gaXRlciA9IEZpbmRIYW5kbGVyKCZsb2NrLCBvdXRbMV0pOwotICAgICAgICAgICAgICAgIGlmIChpdGVyID09IGRtX3VzZXJzXy5lbmQoKSkgewotICAgICAgICAgICAgICAgICAgICAvLyBBZnRlciBtZXJnZSBpcyBjb21wbGV0ZWQsIHdlIHN3YXAgZG0tdXNlciB0YWJsZSB3aXRoCi0gICAgICAgICAgICAgICAgICAgIC8vIHRoZSB1bmRlcmx5aW5nIGRtLWxpbmVhciBiYXNlIGRldmljZS4gSGVuY2UsIHdvcmtlcgotICAgICAgICAgICAgICAgICAgICAvLyB0aHJlYWRzIHdvdWxkIGhhdmUgdGVybWludGVkIGFuZCB3YXMgcmVtb3ZlZCBmcm9tCi0gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBsaXN0LgotICAgICAgICAgICAgICAgICAgICBMT0coREVCVUcpIDw8ICJDb3VsZCBub3QgZmluZCBoYW5kbGVyOiAiIDw8IG91dFsxXTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJzdWNjZXNzIik7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKCEoKml0ZXIpLT5UaHJlYWRUZXJtaW5hdGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgKCppdGVyKS0+c25hcHVzZXJkKCktPk5vdGlmeUlPVGVybWluYXRlZCgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghUmVtb3ZlQW5kSm9pbkhhbmRsZXIob3V0WzFdKSkgewotICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAiZmFpbCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJzdWNjZXNzIik7Ci0gICAgICAgIH0KLSAgICAgICAgY2FzZSBEYWVtb25PcHM6OkRFVEFDSDogewotICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobG9ja18pOwotICAgICAgICAgICAgVGVybWluYXRlTWVyZ2VUaHJlYWRzKCZsb2NrKTsKLSAgICAgICAgICAgIHRlcm1pbmF0aW5nXyA9IHRydWU7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBjYXNlIERhZW1vbk9wczo6U1VQUE9SVFM6IHsKLSAgICAgICAgICAgIGlmIChvdXQuc2l6ZSgpICE9IDIpIHsKLSAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJNYWxmb3JtZWQgc3VwcG9ydHMgbWVzc2FnZSwgIiA8PCBvdXQuc2l6ZSgpIDw8ICIgcGFydHMiOwotICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAiZmFpbCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG91dFsxXSA9PSAic2Vjb25kX3N0YWdlX3NvY2tldF9oYW5kb2ZmIikgewotICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAic3VjY2VzcyIpOwotICAgICAgICAgICAgfQorICAgIGNvbnN0IGF1dG8mIGNtZCA9IG91dFswXTsKKyAgICBpZiAoY21kID09ICJpbml0IikgeworICAgICAgICAvLyBNZXNzYWdlIGZvcm1hdDoKKyAgICAgICAgLy8gaW5pdCw8bWlzY19uYW1lPiw8Y293X2RldmljZV9wYXRoPiw8YmFja2luZ19kZXZpY2U+LDxiYXNlX3BhdGhfbWVyZ2U+CisgICAgICAgIC8vCisgICAgICAgIC8vIFJlYWRzIHRoZSBtZXRhZGF0YSBhbmQgc2VuZCB0aGUgbnVtYmVyIG9mIHNlY3RvcnMKKyAgICAgICAgaWYgKG91dC5zaXplKCkgIT0gNSkgeworICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTWFsZm9ybWVkIGluaXQgbWVzc2FnZSwgIiA8PCBvdXQuc2l6ZSgpIDw8ICIgcGFydHMiOwogICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7CiAgICAgICAgIH0KLSAgICAgICAgY2FzZSBEYWVtb25PcHM6OklOSVRJQVRFOiB7Ci0gICAgICAgICAgICBpZiAob3V0LnNpemUoKSAhPSAyKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiTWFsZm9ybWVkIGluaXRpYXRlLW1lcmdlIG1lc3NhZ2UsICIgPDwgb3V0LnNpemUoKSA8PCAiIHBhcnRzIjsKLSAgICAgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChvdXRbMF0gPT0gImluaXRpYXRlX21lcmdlIikgewotICAgICAgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKGxvY2tfKTsKLSAgICAgICAgICAgICAgICBhdXRvIGl0ZXIgPSBGaW5kSGFuZGxlcigmbG9jaywgb3V0WzFdKTsKLSAgICAgICAgICAgICAgICBpZiAoaXRlciA9PSBkbV91c2Vyc18uZW5kKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ291bGQgbm90IGZpbmQgaGFuZGxlcjogIiA8PCBvdXRbMV07Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAiZmFpbCIpOwotICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmICghU3RhcnRNZXJnZSgmbG9jaywgKml0ZXIpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAiZmFpbCIpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHJldHVybiBTZW5kbXNnKGZkLCAic3VjY2VzcyIpOwotICAgICAgICAgICAgfQorICAgICAgICBhdXRvIGhhbmRsZXIgPSBBZGRIYW5kbGVyKG91dFsxXSwgb3V0WzJdLCBvdXRbM10sIG91dFs0XSk7CisgICAgICAgIGlmICghaGFuZGxlcikgewogICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7CiAgICAgICAgIH0KLSAgICAgICAgY2FzZSBEYWVtb25PcHM6OlBFUkNFTlRBR0U6IHsKLSAgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKGxvY2tfKTsKLSAgICAgICAgICAgIGRvdWJsZSBwZXJjZW50YWdlID0gR2V0TWVyZ2VQZXJjZW50YWdlKCZsb2NrKTsKIAotICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsIHN0ZDo6dG9fc3RyaW5nKHBlcmNlbnRhZ2UpKTsKKyAgICAgICAgYXV0byBudW1fc2VjdG9ycyA9IGhhbmRsZXItPnNuYXB1c2VyZCgpLT5HZX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mZCwgbWVyZ2Vfc3RhdHVzKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgYXV0byByZXR2YWwgPSAic3VjY2VzcywiICsgc3RkOjp0b19zdHJpbmcobnVtX3NlY3RvcnMpOworICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgcmV0dmFsKTsKKyAgICB9IGVsc2UgaWYgKGNtZCA9PSAic3RhcnQiKSB7CisgICAgICAgIC8vIE1lc3NhZ2UgZm9ybWF0OgorICAgICAgICAvLyBzdGFydCw8bWlzY19uYW1lPgorICAgICAgICAvLworICAgICAgICAvLyBTdGFydCB0aGUgbmV3IHRocmVhZCB3aGljaCBiaW5kcyB0byBkbS11c2VyIG1pc2MgZGV2aWNlCisgICAgICAgIGlmIChvdXQuc2l6ZSgpICE9IDIpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIk1hbGZvcm1lZCBzdGFydCBtZXNzYWdlLCAiIDw8IG91dC5zaXplKCkgPDwgIiBwYXJ0cyI7CisgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKICAgICAgICAgfQotICAgICAgICBjYXNlIERhZW1vbk9wczo6VVBEQVRFX1ZFUklGWTogewotICAgICAgICAgICAgc3RkOjpsb2NrX2d1YXJkPHN0ZDo6bXV0ZXg+IGxvY2sobG9ja18pOwotICAgICAgICAgICAgaWYgKCFVcGRhdGVWZXJpZmljYXRpb24oJmxvY2spKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7Ci0gICAgICAgICAgICB9CiAKKyAgICAgICAgaWYgKCFoYW5kbGVyc18tPlN0YXJ0SGFuZGxlcihvdXRbMV0pKSB7CisgICAgICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgImZhaWwiKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gU2VuZG1zZyhmZCwgInN1Y2Nlc3MiKTsKKyAgICB9IGVsc2UgaWYgKGNtZCA9PSAic3RvcCIpI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gIGlmIChvdXQuc2l6ZSgpICE9IDIpIHsKKyAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIk1hbGZvcm1lZCBkZWxldGUgbWVzc2FnZSwgIiA8PCBvdXQuc2l6ZSgpIDw8ICIgcGFydHMiOworICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFoYW5kbGVyc18tPkRlbGV0ZUhhbmRsZXIob3V0WzFdKSkgeworICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJzdWNjZXNzIik7CisgICAgfSBlbHNlIGlmIChjbWQgPT0gImRldGFjaCIpIHsKKyAgICAgICAgaGFuZGxlcnNfLT5UZXJtaW5hdGVNZXJnZVRocmVhZHMoKTsKKyAgICAgICAgdGVybWluYXRpbmdfID0gdHJ1ZTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfSBlbHNlIGlmIChjbWQgPT0gInN1cHBvcnRzIikgeworICAgICAgICBpZiAob3V0LnNpemUoKSAhPSAyKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJNYWxmb3JtZWQgc3VwcG9ydHMgbWVzc2FnZSwgIiA8PCBvdXQuc2l6ZSgpIDw8ICIgcGFydHMiOworICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJmYWlsIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG91dFsxXSA9PSAic2Vjb25kX3N0YWdlX3NvY2tldF9oYW5kb2ZmIikgewogICAgICAgICAgICAgcmV0dXJuIFNlbmRtc2coZmQsICJzdWNjZXNzIik7CiAgICAgICAgIH0KLSAgICAgICAgZGVmYXVsdDogewotICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiUmVjZWl2ZWQgdW5rbm93biBtZXNzYWdlIHR5cGUgZnJvbSBjbGllbnQiOwotICAgICAgICAgICA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yZ2VUaHJlYWQoKTsKLX0KLQogdm9pZCBVc2VyU25hcHNob3RTZXJ2ZXI6OkFkZFdhdGNoZWRGZChhbmRyb2lkOjpiYXNlOjpib3Jyb3dlZF9mZCBmZCwgaW50IGV2ZW50cykgewogICAgIHN0cnVjdCBwb2xsZmQgcCA9IHt9OwogICAgIHAuZmQgPSBmZC5nZXQoKTsKQEAgLTQ4Nyw3ICszNDYsOCBAQAogc3RkOjpzaGFyZWRfcHRyPEhhbmRsZXJUaHJlYWQ+IFVzZXJTbmFwc2hvdFNlcnZlcjo6QWRkSGFuZGxlcihjb25zdCBzdGQ6OnN0cmluZyYgbWlzY19uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgY293X2RldmljZV9wYXRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGQ6OnN0cmluZyYgYmFja2luZ19kZXZpY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nJiBiYXNlX3BhdGhfbWVyZ2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGJhc2VfcGF0aF9tZXJnZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgYm9vbCBvX2RpcmVjdCkgewogICAgIC8vIFdlIHdpbGwgbmVlZCBtdWx0aXBsZSB3b3JrZXIgdGhyZWFkcyBvbmx5IGR1cmluZwogICAgIC8vIGRldmljZSBib290IGFmdGVyIE9UQS4gRm9yIGFsbCBvdGhlciBwdXJwb3NlcywKICAgICAvLyBvbmU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SGl0IEVPRiBvbiBldmVudGZkIjsKLSAgICAgICAgfQotCi0gICAgICAgIExPRyhJTkZPKSA8PCAiTW9uaXRvck1lcmdlOiBhY3RpdmUtbWVyZ2UtdGhyZWFkczogIiA8PCBhY3RpdmVfbWVyZ2VfdGhyZWFkc187Ci0gICAgICAgIHsKLSAgICAgICAgICAgIHN0ZDo6bG9ja19ndWFyZDxzdGQ6Om11dGV4PiBsb2NrKGxvY2tfKTsKLSAgICAgICAgICAgIHdoaWxlIChhY3RpdmVfbWVyZ2VfdGhyZWFkc18gPCBrTWF4TWVyZ2VUaHJlYWRzICYmIG1lcmdlX2hhbmRsZXJzXy5zaXplKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgYXV0byBoYW5kbGVyID0gbWVyZ2VfaGFuZGxlcnNfLmZyb250KCk7Ci0gICAgICAgICAgICAgICAgbWVyZ2VfaGFuZGxlcnNfLnBvcCgpOwotCi0gICAgICAgICAgICAgICAgaWYgKCFoYW5kbGVyLT5zbmFwdXNlcmQoKSkgewotICAgICAgICAgICAgICAgICAgICBMT0coSU5GTykgPDwgIk1vbml0b3JNZXJnZTogc2tpcHBpbmcgZGVsZXRlZCBoYW5kbGVyOiAiIDw8IGhhbmRsZXItPm1pc2NfbmFtZSgpOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBMT0coSU5GTykgPDwgIlN0YXJ0aW5nIG1lcmdlIGZvciBwYXJ0aXRpb246ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgaGFuZGxlci0+c25hcHVzZXJkKCktPkdldE1pc2NOYW1lKCk7Ci0gICAgICAgICAgICAgICAgaGFuZGxlci0+c25hcHVzZXJkKCktPkluaXRpYXRlTWVyZ2UoKTsKLSAgICAgICAgICAgICAgICBhY3RpdmVfbWVyZ2VfdGhyZWFkc18gKz0gMTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQot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IChpbnQgaSA9IDA7IGkgPCBudW1fYmxvY2tzOyBpKyspIHsKKyAgICAgICAgc2VxdWVuY2VbaV0gPSBudW1fYmxvY2tzIC0gMSAtIGk7CisgICAgfQorICAgIC8vIFNlcXVlbmNlIGZvciBYb3Igb3BzCisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1fYmxvY2tzOyBpKyspIHsKKyAgICAgICAgc2VxdWVuY2VbbnVtX2Jsb2NrcyArIGldID0gNSAqIG51bV9ibG9ja3MgLSAxIC0gaTsKKyAgICB9CisgICAgQVNTRVJUX1RSVUUod3JpdGVyLT5BZGRTZXF1ZW5jZURhdGEoMiAqIG51bV9ibG9ja3MsIHNlcXVlbmNlKSk7CisKKyAgICBzaXplX3QgeCA9IG51bV9ibG9ja3M7CisgICAgd2hpbGUgKDEpIHsKKyAgICAgICAgQVNTRVJUX1RSVUUod3JpdGVyLT5BZGRDb3B5KHNvdXJjZV9ibGssIGJsa19zcmNfY29weSkpOworICAgICAgICB4IC09IDE7CisgICAgICAgIGlmICh4ID09IDApIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHNvdXJjZV9ibGsgLT0gMTsKKyAgICAgICAgYmxrX3NyY19jb3B5IC09IDE7CisgICAgfQorCisgICAgc291cmNlX2JsayA9IG51bV9ibG9ja3M7CisgICAgYmxrX3NyY19jb3B5ID0gYmxrX2VuZF9jb3B5OworCisgICAgQVNTRVJUX1RSVUUod3JpdGVyLT5BZGRSYXdCbG9ja3Moc291cmNlX2JsaywgcmFuZG9tX2J1ZmZlcl8xXy5nZXQoKSwgc2l6ZV8pKTsKKworICAgIHNpemVfdCBibGtfemVyb19jb3B5X3N0YXJ0ID0gc291cmNlX2JsayArIG51bV9ibG9ja3M7CisgICAgc2l6ZV90IGJsa196ZXJvX2NvcHlfZW5kID0gYmxrX3plcm9fY29weV9zdGFydCArIG51bV9ibG9ja3M7CisKKyAgICBBU1NFUlRfVFJVRSh3cml0ZXItPkFkZFplc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dyaXRlci0+QWRkQ29weShzb3VyY2VfYmxrLCBibGtfc3JjX2NvcHkpKTsKICAgICAgICAgeCAtPSAxOwogICAgICAgICBpZiAoeCA9PSAwKSB7CiAgICAgICAgICAgICBicmVhazsKQEAgLTQzNSwxMiArNTU2LDEyIEBACiAgICAgfQogCiAgICAgZm9yIChzaXplX3QgaSA9IG51bV9ibG9ja3M7IGkgPiAwOyBpLS0pIHsKLSAgICAgICAgQVNTRVJUX1RSVUUod3JpdGVyLkFkZFhvckJsb2NrcyhudW1fYmxvY2tzICsgaSAtIDEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnJhbmRvbV9idWZmZXJfMV8uZ2V0KClbb3B0aW9ucy5ibG9ja19zaXplICogKGkgLSAxKV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5ibG9ja19zaXplLCAyICogbnVtX2Jsb2NrcyArIGkgLSAxLCB4b3Jfb2Zmc2V0KSk7CisgICAgICAgIEFTU0VSVF9UUlVFKHdyaXRlci0+QWRkWG9yQmxvY2tzKAorICAgICAgICAgICAgICAgIG51bV9ibG9ja3MgKyBpIC0gMSwgJnJhbmRvbV9idWZmZXJfMV8uZ2V0KClbd3JpdGVyLT5HZXRCbG9ja1NpemUoKSAqIChpIC0gMSldLAorICAgICAgICAgICAgICAgIHdyaXRlci0+R2V0QmxvY2tTaXplKCksIDIgKiBudW1fYmxvY2tzICsgaSAtIDEsIHhvcl9vZmZzZXQpKTsKICAgICB9CiAgICAgLy8gRmx1c2ggb3BlcmF0aW9ucwotICAgIEFTU0VSVF9UUlVFKHdyaXRlci5GaW5hbGl6ZSgpKTsKKyAgICBBU1NFUlRfVFJVRSh3cml0ZXItPkZpbmFsaXplKCkpOwogICAgIC8vIENvbnN0cnVjdCB0aGUgYnVmZmVyIHJlcXVpcmVkIGZvciB2YWxpZGF0aW9uCiAgICAgb3JpZ19idWZmZXJfID0gc3RkOjptYWtlX3Vu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b19zdGF0ZV8gPT0gTUVSR0VfSU9fVFJBTlNJVElPTjo6SU9fVEVSTUlOQVRFRCkgeworICAgICAgICAgICAgU05BUF9MT0coRVJST1IpIDw8ICJXYWl0IGZvciBtZXJnZSByZWFkeSBmYWlsZWQ6ICIgPDwgaW9fc3RhdGVfOwogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiB0cnVlOwpAQCAtMzY2LDEwICszNjYsMzYgQEAKICAgICB9CiB9CiAKK3ZvaWQgU25hcHNob3RIYW5kbGVyOjpSYVRocmVhZFN0YXJ0ZWQoKSB7CisgICAgc3RkOjp1bmlxdWVfbG9jazxzdGQ6Om11dGV4PiBsb2NrKGxvY2tfKTsKKyAgICByYV90aHJlYWRfc3RhcnRlZF8gPSB0cnVlOworfQorCit2b2lkIFNuYXBzaG90SGFuZGxlcjo6V2FpdEZvclJhVGhyZWFkVG9TdGFydCgpIHsKKyAgICBhdXRvIG5vdyA9IHN0ZDo6Y2hyb25vOjpzeXN0ZW1fY2xvY2s6Om5vdygpOworICAgIGF1dG8gZGVhZGxpbmUgPSBub3cgKyAzczsKKyAgICB7CisgICAgICAgIHN0ZDo6dW5pcXVlX2xvY2s8c3RkOjptdXRleD4gbG9jayhsb2NrXyk7CisgICAgICAgIHdoaWxlICghcmFfdGhyZWFkX3N0YXJ0ZWRfKSB7CisgICAgICAgICAgICBhdXRvIHN0YXR1cyA9IGN2LndhaXRfdW50aWwobG9jaywgZGVhZGxpbmUpOworICAgICAgICAgICAgaWYgKHN0YXR1cyA9PSBzdGQ6OmN2X3N0YXR1czo6dGltZW91dCkgeworICAgICAgICAgICAgICAgIFNOQVBfTE9HKEVSUk9SKSA8PCAiUmVhZC1haGVhZCB0aHJlYWQgZGlkIG5vdCBzdGFydCI7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFNuYXBzaG90SGFuZGxlcjo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gICAgICAgIC8vIGJsb2Nrcy4KKyAgICAgICAgICAgICAgICBpZiAocmVzdW1lX21lcmdlXyAmJiBHZXRSQUJ1ZmZlcigmbG9jaywgbmV3X2Jsb2NrLCBidWZmZXIpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAoTUVSR0VfR1JPVVBfU1RBVEU6OkdST1VQX01FUkdFX0lOX1BST0dSRVNTKTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYmxrX3N0YXRlLT5udW1faW9zX2luX3Byb2dyZXNzICs9IDE7ICAvLyByZWYgY291bnQKICAgICAgICAgICAgICAgICBbW2ZhbGx0aHJvdWdoXV07CiAgICAgICAgICAgICB9CkBAIC02NjgsNSArNjk4LDI2IEBACiAgICAgfQogfQogCitzdGQ6Om9zdHJlYW0mIG9wZXJhdG9yPDwoc3RkOjpvc3RyZWFtJiBvcywgTUVSR0VfSU9fVFJBTlNJVElPTiB2YWx1ZSkgeworICAgIHN3aXRjaCAodmFsdWUpIHsKKyAgICAgICAgY2FzZSBNRVJHRV9JT19UUkFOU0lUSU9OOjpJTlZBTElEOgorICAgICAgICAgICAgcmV0dXJuIG9zIDw8ICJJTlZBTElEIjsKKyAgICAgICAgY2FzZSBNRVJHRV9JT19UUkFOU0lUSU9OOjpNRVJHRV9SRUFEWToKKyAgICAgICAgICAgIHJldHVybiBvcyA8PCAiTUVSR0VfUkVBRFkiOworICAgICAgICBjYXNlIE1FUkdFX0lPX1RSQU5TSVRJT046Ok1FUkdFX0JFR0lOOgorICAgICAgICAgICAgcmV0dXJuIG9zIDw8ICJNRVJHRV9CRUdJTiI7CisgICAgICAgIGNhc2UgTUVSR0VfSU9fVFJBTlNJVElPTjo6TUVSR0VfRkFJTEVEOgorICAgICAgICAgICAgcmV0dXJuIG9zIDw8ICJNRVJHRV9GQUlMRUQiOworICAgICAgICBjYXNlIE1FUkdFX0lPX1RSQU5TSVRJT046Ok1FUkdFX0NPTVBMRVRFOgorICAgICAgICAgICA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90L3Rvb2xzL0FuZHJvaWQuYnAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYTFjOTJjMAotLS0gL2Rldi9udWxsCisrKyBiL2ZzX21nci9saWJzbmFwc2hvdC90b29scy9BbmRyb2lkLmJwCkBAIC0wLDAgKzEsNDYgQEAKKworY2NfYmluYXJ5IHsKKyAgICBuYW1lOiAiY293X2JlbmNobWFyayIsCisgICAgaG9zdF9zdXBwb3J0ZWQ6IHRydWUsCisgICAgZGVmYXVsdHM6IFsKKyAgICAgICAgImZzX21ncl9kZWZhdWx0cyIsCisgICAgICAgICJsaWJzbmFwc2hvdF9jb3dfZGVmYXVsdHMiLAorICAgIF0sCisKKyAgICBzcmNzOiBbImNvd19iZW5jaG1hcmsuY3BwIl0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlic25hcHNob3RfY293IiwKKyAgICBdLAorCisgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgImxpYmJhc2UiLAorICAgICAgICAibGlibG9nIiwKKyAgICBdLAorCisgICAgY2ZsYWdzOiBbIi1XZXJyb3IiXSwKK30KKworCitjY19iaW5hcnkgeworICAgIG5hbWU6ICJ3cml0ZV9jb3ciLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorICAgIGRlZmF1bHRzOiBbCisgICAgICAgICJmc19tZ3JfZGVmYXVsdHMiLAorICAgICAgICAibGlic25hcHNob3RfY293X2RlZmF1bHRzIiwKKyAgICBdLAorCisgICAgc3JjczogWyJ3cml0ZV9jb3cuY3BwIl0sCisKKyAgICBzdGF0aWNfbGliczogWworICAgICAgICAibGlic25hcHNob3RfY293IiwKKyAgICAgICAgImxpYmdmbGFncyIsCisgICAgXSwKKworICAgIHNoYXJlZF9saWJzOiBbCisgICAgICAgICJsaWJiYXNlIiwKKyAgICAgICAgImxpYmxvZyIsCisgICAgXSwKKworICAgIGNmbGFnczogWyItV2Vycm9yIl0sCit9CmRpZmYgLS1naXQ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fdmVyc2lvbiA8PCAiXG4iOworICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCitpbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFyZ3YpIHsKKyAgICBnZmxhZ3M6OlBhcnNlQ29tbWFuZExpbmVGbGFncygmYXJnYywgJmFyZ3YsIHRydWUpOworICAgIGlmIChGTEFHU193cml0ZV9sZWdhY3kpIHsKKyAgICAgICAgd3JpdGVfbGVnYWN5X2Nvd192MigpOworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisgICAgaWYgKGFyZ2MgPCAyKSB7CisgICAgICAgIGdmbGFnczo6U2hvd1VzYWdlV2l0aEZsYWdzKGFyZ3ZbMF0pOworICAgICAgICByZXR1cm4gMTsKKyAgICB9CisgICAgaWYgKCFXcml0ZUNvdyhhcmd2WzFdKSkgeworICAgICAgICByZXR1cm4gMTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9mc19tZ3IvdGVzdHMvQW5kcm9pZC5icCBiL2ZzX21nci90ZXN0cy9BbmRyb2lkLmJwCmluZGV4IGI5YmFlMjUuLjJhZWJhMGEgMTAwNjQ0Ci0tLSBhL2ZzX21nci90ZXN0cy9BbmRyb2lkLmJwCisrKyBiL2ZzX21nci90ZXN0cy9BbmRyb2lkLmJwCkBAIC0zOCw3ICszOCw4IEBACiAgICAgXSwKICAgICBzdGF0aWNfbGliczogWwogICAgICAgICAibGliZnNfbWdyIiwKLSAgICAgICAgImxpYmZzdGFiIiwKKyAgICAgICAgImxpYmdtb2NrIiwKKyAgICAgICAgImxpYmd0ZXN0IiwKICAgICBdLAogICAgIHNyY3M6IFsKICAgICAgICAgImZpbGVfd2FpdF90ZXN0LmNwcCIsCkBAIC0xMDksNyArMTEwLDYgQEAKICAgICBdLAogICAgIHN0YXRpY19saWJzOiBbCiAgICAgICAgICJsaWJmc19tZ3IiLAotICAgICAgICAibGliZnN0YWIiLAogICAgICAgICAibGliZ21vY2siLAogICAgICAgICAibGliZ3Rlc3QiLAogICAgIF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kL0FuZHJvaWQuYnAKKysrIGIvZ2F0ZWtlZXBlcmQvQW5kcm9pZC5icApAQCAtMTgsOCArMTgsOCBAQAogICAgIGRlZmF1bHRfYXBwbGljYWJsZV9saWNlbnNlczogWyJBbmRyb2lkLUFwYWNoZS0yLjAiXSwKIH0KIAotY2NfYmluYXJ5IHsKLSAgICBuYW1lOiAiZ2F0ZWtlZXBlcmQiLAorY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJnYXRla2VlcGVyZF9kZWZhdWx0cyIsCiAgICAgY2ZsYWdzOiBbCiAgICAgICAgICItV2FsbCIsCiAgICAgICAgICItV2V4dHJhIiwKQEAgLTUyLDYgKzUyLDE2IEBACiAKICAgICBzdGF0aWNfbGliczogWyJsaWJzY3J5cHRfc3RhdGljIl0sCiAgICAgaW5jbHVkZV9kaXJzOiBbImV4dGVybmFsL3NjcnlwdC9saWIvY3J5cHRvIl0sCit9CisKK2NjX2JpbmFyeSB7CisgICAgbmFtZTogImdhdGVrZWVwZXJkIiwKKyAgICBkZWZhdWx0czogWworICAgICAgICAiZ2F0ZWtlZXBlcmRfZGVmYXVsdHMiLAorICAgIF0sCisgICAgc3JjczogWworICAgICAgICAibWFpbi5jcHAiLAorICAgIF0sCiAgICAgaW5pdF9yYzogWyJnYXRla2VlcGVyZC5yYyJdLAogfQogCkBAIC04OCwzICs5OCwyMCBAQAogICAgICAgICAibGliYmluZGVyIiwKICAgICBdLAogfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAiZ2F0ZWtlZXBlcmRfc2VydmljZV9mdXp6ZXIiLAorICAgIGRlZmF1bHRzOiBbCisgICAgICAgICJnYXRla2VlcGVyZF9kZWZhdWx0cyIsCisgICAgICAgICJzZXJ2aWNlX2Z1enplcl9kZWZhdWx0cyIKKyAgICBdLAorICAgIHNyY3M6IFsKKyAgICAgICAgImZ1enplci9HYXRlS2VlcGVyU2VydmljZUZ1enplci5jcHAiLAorICAgIF0sCisgICAgZnV6el9jb25maWc6IHsKKyA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1JFQVQsIFNfSVJVU1IgfCBTX0lXVVNSKTsKLSAgICAgICAgICAgIGlmIChmZCA8IDApIHsKLSAgICAgICAgICAgICAgICBBTE9HRSgiY291bGQgbm90IG9wZW4gZmlsZTogJXMgOiAlcyIsIGZpbGVuYW1lLCBzdHJlcnJvcihlcnJubykpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNsb3NlKGZkKTsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBmYWxzZTsKKyAgICBpZiAoaXNfcnVubmluZ19nc2kpIHsKKyAgICAgICAgKmh3X3VzZXJJZCA9IHVzZXJJZCArIGtHc2lPZmZzZXQ7CisgICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7CiAgICAgfQotCi0gICAgdm9pZCBtYXliZV9zdG9yZV9zaWQodWludDMyX3QgdXNlcklkLCB1aW50NjRfdCBzaWQpIHsKLSAgICAgICAgY2hhciBmaWxlbmFtZVsyMV07Ci0gICAgICAgIHNucHJpbnRmKGZpbGVuYW1lLCBzaXplb2YoZmlsZW5hbWUpLCAiJXUiLCB1c2VySWQpOwotICAgICAgICBpZiAoYWNjZXNzKGZpbGVuYW1lLCBGX09LKSA9PSAtMSkgewotICAgICAgICAgICAgc3RvcmVfc2lkKHVzZXJJZCwgc2lkKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHVpbnQ2NF90IHJlYWRfc2lkKHVpbnQzMl90IHVzZXJJZCkgewotICAgICAgICBjaGFyIGZpbGVuYW1lWzIxXTsKLSAgICAgICAgdWludDY0X3Qgc2lkOwotICAgICAgICBzbnByaW50ZihmaWxlbmFtZSwgc2l6ZW9mKGZpbGVuYW1lKSwgIiV1IiwgdXNlcklkKTsKLSAgICAgICAgaW50IGZkID0gb3BlbihmaWxlbmFtZSwgT19SRE9OTFkpOwotICAgICAgICBpZiAoZmQgPCAwKSByZXR1cm4gMD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isgICAgICAgICAgICAgICAgTE9HKElORk8pIDw8ICJQYXNzd29yZCBoYW5kbGUgaGFzIHdyb25nIGxlbmd0aCI7CiAgICAgICAgICAgICAgICAgcmV0dXJuIEdLX0VSUk9SOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHJzcC5zdGF0dXNDb2RlID49IEFpZGxJR2F0ZWtlZXBlcjo6U1RBVFVTX09LKSB7Ci0gICAgICAgICAgICAgICAgKmdrUmVzcG9uc2UgPSBHS1Jlc3BvbnNlOjpvayh7cnNwLmRhdGEuYmVnaW4oKSwgcnNwLmRhdGEuZW5kKCl9KTsKLSAgICAgICAgICAgICAgICBzZWN1cmVVc2VySWQgPSBzdGF0aWNfY2FzdDx1aW50NjRfdD4ocnNwLnNlY3VyZVVzZXJJZCk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKHJzcC5zdGF0dXNDb2RlID09IEFpZGxJR2F0ZWtlZXBlcjo6RVJST1JfUkVUUllfVElNRU9VVCAmJgotICAgICAgICAgICAgICAgICAgICAgICByc3AudGltZW91dE1zID4gMCkgewotICAgICAgICAgICAgICAgICpna1Jlc3BvbnNlID0gR0tSZXNwb25zZTo6cmV0cnkocnNwLnRpbWVvdXRNcyk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICpna1Jlc3BvbnNlID0gR0tSZXNwb25zZTo6ZXJyb3IoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChod19kZXZpY2UpIHsKLSAgICAgICAgICAgIC8vIEhJREwgZ2F0ZWtlZXBlciBzZXJ2aWNlCi0gICAgICAgICAgICBSZXR1cm48dm9pZD4gaHdSZXMgPSBod19kZXZpY2UtPmVucm9sbCgKKyAgICAgICAgfQorICAgICAgICBjdXJQd2RIYW5kbGUuc2V0VG9FeHRlcm5hbChjb25zdF9jYXN0PHVpbnQ4X3QqPihjdXJyZW50UGFzc3dvcmRIYW5kbGUtPmRhdGEoKSksCisgICAgICAgICA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Vycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIGlmICghaHdSZXMuaXNPaygpKSB7Ci0gICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiZW5yb2xsIHRyYW5zYWN0aW9uIGZhaWxlZCI7CisgICAgICAgIGlmICghaHdSZXMuaXNPaygpKSB7CisgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJlbnJvbGwgdHJhbnNhY3Rpb24gZmFpbGVkIjsKKyAgICAgICAgICAgIHJldHVybiBHS19FUlJPUjsKKyAgICAgICAgfQorICAgICAgICBpZiAoZ2tSZXNwb25zZS0+cmVzcG9uc2VfY29kZSgpID09IEdLUmVzcG9uc2VDb2RlOjpPSykgeworICAgICAgICAgICAgaWYgKGdrUmVzcG9uc2UtPnBheWxvYWQoKS5zaXplKCkgIT0gc2l6ZW9mKGdhdGVrZWVwZXI6OnBhc3N3b3JkX2hhbmRsZV90KSkgeworICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkhBTCByZXR1cm5lZCBwYXNzd29yZCBoYW5kbGUgb2YgaW52YWxpZCBsZW5ndGggIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgZ2tSZXNwb25zZS0+cGF5bG9hZCgpLnNpemUoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gR0tfRVJST1I7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoZ2tSZXNwb25zZS0+cmVzcG9uc2VfY29kZSgpID09IEdLUmVzcG9uc2VDb2RlOjpPSykgewotICAgICAgICAgICAgICAgIGlmIChna1Jlc3BvbnNlLT5wYXlsb2FkKCkuc2l6ZSgpICE9IHNpemVvZihnYXRla2VlcGVyOjpwYXNzd29yZF9oYW5kbGVfdCkpIHsKLSAgICAgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiSEFMIHJldHVybmVkIHBhc3N3b3JkIGhhbmRsZSBvZiBpbnZhbGlkI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OlNUQVRVU19PSykgeworICAgICAgICAgICAgc2VjdXJlVXNlcklkID0gcnNwLmhhcmR3YXJlQXV0aFRva2VuLnVzZXJJZDsKKyAgICAgICAgICAgIC8vIFNlcmlhbGl6ZSBIYXJkd2FyZUF1dGhUb2tlbiB0byBhIHZlY3RvciBhcyBod19hdXRoX3Rva2VuX3QuCisgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6Om9rKAorICAgICAgICAgICAgICAgICAgICBhdXRoVG9rZW4yQWlkbFZlYyhyc3AuaGFyZHdhcmVBdXRoVG9rZW4pLAorICAgICAgICAgICAgICAgICAgICByc3Auc3RhdHVzQ29kZSA9PSBBaWRsSUdhdGVrZWVwZXI6OlNUQVRVU19SRUVOUk9MTCAvKiByZWVucm9sbCAqLyk7CisgICAgICAgIH0gZWxzZSBpZiAocnNwLnN0YXR1c0NvZGUgPT0gQWlkbElHYXRla2VlcGVyOjpFUlJPUl9SRVRSWV9USU1FT1VUKSB7CisgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6OnJldHJ5KHJzcC50aW1lb3V0TXMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgKmdrUmVzcG9uc2UgPSBHS1Jlc3BvbnNlOjplcnJvcigpOwogICAgICAgICB9Ci0KLSAgICAgICAgdWludDMyX3QgaHdfdXNlcklkID0gYWRqdXN0X3VzZXJJZCh1c2VySWQpOwotICAgICAgICBhbmRyb2lkOjpoYXJkd2FyZTo6aGlkbF92ZWM8dWludDhfdD4gY3VyUHdkSGFuZGxlOwotICAgICAgICBjdXJQd2RIYW5kbGUuc2V0VG9FeHRlcm5hbChjb25zdF9jYXN0PHVpbnQ4X3QqPihlbnJvbGxlZFBhc3N3b3JkSGFuZGxlLmRhdGEoKSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVucm9sbGVkUGFzc3dvcmRIYW5kbGUuc2l6ZSgpKTsKLSAgICAgICAgYW5kcm9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lID0gR0tSZXNwb25zZTo6b2soYXV0aFRva2VuMkFpZGxWZWMocnNwLmhhcmR3YXJlQXV0aFRva2VuKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJzcC5zdGF0dXNDb2RlID09Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWlkbElHYXRla2VlcGVyOjpTVEFUVVNfUkVFTlJPTEwgLyogcmVlbnJvbGwgKi8pOwotICAgICAgICAgICAgfSBlbHNlIGlmIChyc3Auc3RhdHVzQ29kZSA9PSBBaWRsSUdhdGVrZWVwZXI6OkVSUk9SX1JFVFJZX1RJTUVPVVQpIHsKLSAgICAgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6OnJldHJ5KHJzcC50aW1lb3V0TXMpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6OmVycm9yKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAoaHdfZGV2aWNlKSB7Ci0gICAgICAgICAgICAvLyBISURMIGdhdGVrZWVwZXIgc2VydmljZQotICAgICAgICAgICAgUmV0dXJuPHZvaWQ+IGh3UmVzID0gaHdfZGV2aWNlLT52ZXJpZnkoCisgICAgfSBlbHNlIGlmIChod19kZXZpY2UpIHsKKyAgICAgICAgLy8gSElETCBnYXRla2VlcGVyIHNlcnZpY2UKKyAgICAgICAgUmV0dXJuPHZvaWQ+IGh3UmVzID0gaHdfZGV2aWNlLT52ZXJpZnkoCiAgICAgICAgICAgICAgICAgaHdfdXNlcklkLCBjaGFsbGVuZ2UsIGN1clB3ZEhhbmRsZSwgZW50ZXJlZFB3ZCwKICAgICAgICAgICAgICAgICBbJmdrUmVzcG9uc2VdKGNvbnN0IEdhdGVrZWVwZXJSZXNwb25zZSYgcnNwKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChyc3AuY29kZSA+PSBHYXRla2VlcGVyU3RhdHVzQ29kZTo6U1RBVFVTX09LKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6Om9rKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtyc3AuZGF0YS5iZWdpbigpLCByc3AuZGF0YS5lbmQoKX0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcnNwLmNvZGUgPT0gR2F0ZWtlZXBlclN0YXR1c0NvZGU6OlNUQVRVU19SRUVOUk9MTCAvKiByZWVucm9sbCAqLyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtyc3AuZGF0YS5iZWdpbigpLCByc3AuZGF0YS5lbmQoKX0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJzcC5jb2RlID09IEdhdGVrZWVwZXJTdGF0dXNDb2RlOjpTVEFUVVNfUkVFTlJPTEwgLyogcmVlbnJvbGwgKi8pOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHJzcC5jb2RlID09IEdhdGVrZWVwZXJTdGF0dXNDb2RlOjpFUlJPUl9SRVRSWV9USU1FT1VUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAqZ2tSZXNwb25zZSA9IEdLUmVzcG9uc2U6OnJldHJ5KHJzcC50aW1lb3V0KTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTM2MiwxNDkgKzM2NiwxMTUgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0pOwogCi0gICAgICAgICAgICBpZiAoIWh3UmVzLmlzT2soKSkgewotICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgInZlcmlmeSB0cmFuc2FjdGlvbiBmYWlsZWQiOwotICAgICAgICAgICAgICAgIHJldHVybiBHS19FUlJPUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNvbnN0IGdhdGVrZWVwZ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VNYW5hZ2VyX2dldFNlcnZpY2UoImFuZHJvaWQuc2VjdXJpdHkuYXV0aG9yaXphdGlvbiIpOwotICAgICAgICAgICAgICAgIDo6bmRrOjpTcEFJQmluZGVyIGF1dGh6QmluZGVyKGF1dGh6QUlCaW5kZXIpOwotICAgICAgICAgICAgICAgIGF1dG8gYXV0aHpTZXJ2aWNlID0gSUtleXN0b3JlQXV0aG9yaXphdGlvbjo6ZnJvbUJpbmRlcihhdXRoekJpbmRlcik7Ci0gICAgICAgICAgICAgICAgaWYgKGF1dGh6U2VydmljZSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZ2tSZXNwb25zZS0+cGF5bG9hZCgpLnNpemUoKSAhPSBzaXplb2YoaHdfYXV0aF90b2tlbl90KSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiSW5jb3JyZWN0IHNpemUgb2YgQXV0aFRva2VuIHBheWxvYWQuIjsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHS19FUlJPUjsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGNvbnN0IGh3X2F1dGhfdG9rZW5fdCogaHdBdXRoVG9rZW4gPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgaHdfYXV0aF90b2tlbl90Kj4oZ2tSZXNwb25zZS0+cGF5bG9hZCgpLmRhdGEoKSk7Ci0gICAgICAgICAgICAgICAgICAgIEhhcmR3YXJlQXV0aFRva2VuIGF1dGhUb2tlbjsKLQotICAgICAgICAgICAgICAgICAgICBhdXRoVG9rZW4udGltZXN0YW1wLm1pbGxpU2Vjb25kcyA9IGJldG9oNjQoaHdBdXRoVG9rZW4tPnRpbWVzdGFtcCk7Ci0gICAgICAgICAgICAgICAgICAgIGF1dGhUb2tlbi5jaGFsbGVuZ2UgPSBod0F1dGhUb2tlbi0+Y2hhbGxlbmdlOwotICAgICAgICAgICAgICAgICAgICBhdXRoVG9rZW4udXNlcklkID0gaHdBdXRoVG9rZW4tPnVzZXJfaWQ7Ci0gICAgICAgICAgICAgICAgICAgIGF1dGhUb2tlbi5hdXRoZW50aWNhdG9ySWQgPSBod0F1dGhUb2tlbi0+YXV0aGVudGljYXRvcl9pZDsKLSAgICAgICAgICAgICAgICAgICAgYXV0aFRva2VuLmF1dGhlbnRpY2F0b3JUeXBlID0gc3RhdGljX2Nhc3Q8SGFyZHdhcmVBdXRoZW50aWNhdG9yVHlwZT4oCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmV0b2gzMihod0F1dGhUb2tlbi0+YXV0aGVudGljYXRvcl90eXBlKSk7Ci0gICAgICAgICAgICAgICAgICAgIGF1dGhUb2tlbi5tYWMuYXNzaWduKCZod0F1dGhUb2tlbi0+aG1hY1swXSwgJmh3QXV0aFRva2VuLT5obWFjWzMyXSk7Ci0gICAgICAgICAgICAgICAgICAgIGF1dG8gcmVzdWx0ID0gYXV0aHpTZXJ2aWNlLT5hZGRBdXRoVG9rZW4oYXV0aFRva2VuKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQuaXNPaygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsdXJlIGluIHNlbmRpbmcgQXV0aFRva2VuIHRvIEF1dGhvcml6YXRpb25TZXJ2aWNlLiI7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR0tfRVJST1I7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJDYW5ub3QgZGVsaXZlciBhdXRoIHRva2VuLiBVbmFibGUgdG8gY29tbXVuaWNhdGUgd2l0aCAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIktleXN0b3JlLiI7CisgICAgaWYgKGdrUmVzcG9uc2UtPnJlc3BvbnNlX2NvZGUoKSA9PSBHS1Jlc3BvbnNlQ29kZTo6T0spIHsKKyAgICAgICAgaWYgKGdrUmVzcG9uc2UtPnBheWxvYWQoKS5zaXplKCkgIT0gMCkgeworICAgICAgICAgICAgLy8gdHJ5IHRvIGNvbm5lY3QgdG8gSUtleXN0b3JlQXV0aG9yaXphdGlvbiBBSURMIHNlcnZpY2UgZmlyc3QuCisgICAgICAgICAgICBBSUJpbmRlciogYXV0aHpBSUJpbmRlciA9IEFTZXJ2aWNlTWFuYWdlcl9nZXRTZXJ2aWNlKCJhbmRyb2lkLnNlY3VyaXR5LmF1dGhvcml6YXRpb24iKTsKKyAgICAgICAgICAgIDo6bmRrOjpTcEFJQmluZGVyIGF1dGh6QmluZGVyKGF1dGh6QUlCaW5kZXIpOworICAgICAgICAgICAgYXV0byBhdXRoelNlcnZpY2UgPSBJS2V5c3RvcmVBdXRob3JpemF0aW9uOjpmcm9tQmluZGVyKGF1dGh6QmluZGVyKTsKKyAgICAgICAgICAgIGlmIChhdXRoelNlcnZpY2UpIHsKKyAgICAgICAgICAgICAgICBpZiAoZ2tSZXNwb25zZS0+cGF5bG9hZCgpLnNpemUoKSAhPSBzaXplb2YoaHdfYXV0aF90b2tlbl90KSkgeworICAgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJJbmNvcnJlY3Qgc2l6ZSBvZiBBdXRoVG9rZW4gcGF5bG9hZC4iOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gR0tfRVJST1I7CiAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgY29uc3QgaHdfYXV0aF90b2tlbl90KiBod0F1dGhUb2tlbiA9CisgICAgICAgICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PGNvbnN0IGh3X2F1dGhfdG9rZW5fdCo+KGdrUmVzcG9uc2UtPnBheWxvYWQoKS5kYXRhKCkpOworICAgICAgICAgICAgICAgIEhhcmR3YXJlQXV0aFRva2VuIGF1dGhUb2tlbjsKKworICAgICAgICAgICAgICAgIGF1dGhUb2tlbi50aW1lc3RhbXAubWlsbGlTZWNvbmRzID0gYmV0b2g2NChod0F1dGhUb2tlbi0+dGltZXN0YW1wKTsKKyAgICAgICAgICAgICAgICBhdXRoVG9rZW4uY2hhbGxlbmdlID0gaHdBdXRoVG9rZW4tPmNoYWxsZW5nZTsKKyAgICAgICAgICAgICAgICBhdXRoVG9rZW4udXNlcklkID0gaHdBdXRoVG9rZW4tPnVzZXJfaWQ7CisgICAgICAgICAgICAgICAgYXV0aFRva2VuLmF1dGhlbnRpY2F0b3JJZCA9IGh3QXV0aFRva2VuLT5hdXRoZW50aWNhdG9yX2lkOworICAgICAgICAgICAgICAgIGF1dGhUb2tlbi5hdXRoZW50aWNhdG9yVHlwZSA9IHN0YXRpY19jYXN0PEhhcmR3YXJlQXV0aGVudGljYXRvclR5cGU+KAorICAgICAgICAgICAgICAgICAgICAgICAgYmV0b2gzMihod0F1dGhUb2tlbi0+YXV0aGVudGljYXRvcl90eXBlKSk7CisgICAgICAgICAgICAgICAgYXV0aFRva2VuLm1hYy5hc3NpZ24oJmh3QXV0aFRva2VuLT5obWFjWzBdLCAmaHdBdXRoVG9rZW4tPmhtYWNbMzJdKTsKKyAgICAgICAgICAgICAgICBhdXRvIHJlc3VsdCA9IGF1dGh6U2VydmljZS0+YWRkQXV0aFRva2VuKGF1dGhUb2tlbik7CisgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQuaXNPaygpKSB7CisgICAgICAgICAgICAgICAgICAgIExPRyhFUlJPUikgPDwgIkZhaWx1cmUgaW4gc2VuZGluZyBBdXRoVG9rZW4gdG8gQXV0aG9yaXphdGlvblNlcnZpY2UuIjsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdLX0VSUk9SOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgTE9HKEVSUk9SKSA8PCAiQ2Fubm90IGRlbGl2ZXIgYXV0aCB0b2tlbi4gVW5hYmxlIHRvIGNvbW11bmljYXRlIHdpdGggIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIktleXN0b3JlLiI7CisgICAgICAgICAgICAgICAgcmV0dXJuIEdLX0VSUk9SOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtYXliZV9zdG9yZV9zaWQodXNlcklkLCBzZWN1cmVVc2VySWQpOwogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKKyAgICAgICAgbWF5YmVfc3RvcmVfc2lkKHVzZXJJZCwgc2VjdXJlVXNlcklkKTsKICAgICB9CiAKLSAgICBTdGF0dXMgZ2V0U2VjdXJlVXNlcklkKGludDMyX3QgdXNlcklkLCBpbnQ2NF90KiBzaWQpIG92ZXJyaWRlIHsKLSAgICAgICAgKnNpZCA9IHJlYWRfc2lkKHVzZXJJZCk7Ci0gICAgICAgIHJldHVybiBTdGF0dXM6Om9rKCk7Ci0gICAgfQotCi0gICAgU3RhdHVzIGNsZWFyU2VjdXJlVXNlcklkKGludDMyX3QgdXNlcklkKSBvdmVycmlkZSB7Ci0gICAgICAgIElQQ1RocmVhZFN0YXRlKiBpcGMgPSBJUENUaHJlYWRTdGF0ZTo6c2VsZigpOwotICAgICAgICBjb25zdCBpbnQgY2FsbGluZ19waWQgPSBpcGMtPmdldENhbGxpbmdQaWQoKTsKLSAgICAgICAgY29uc3QgaW50IGNhbGxpbmdfdWlkID0gaXBjLT5nZXRDYWxsaW5nVWlkKCk7Ci0gICAgICAgIGlmICghUGVybWlzc2lvbkNhY2hlOjpjaGVja1Blcm1pc3Npb24oS0VZR1VBUkRfUEVSTUlTU0lPTiwgY2FsbGluZ19waWQsIGNhbGxpbmdfdWlkKSkgewotICAgICAgICAgICAgQUxPR0UoIiVzOiBwZXJtaXNzaW9uIGRlbmllZCBmb3IgWyVkOiVkXSIsIF9fZnVuY19fLCBjYWxsaW5nX3BpZCwgY2FsbGluZ191aWQpOwotICAgICAgICAgICAgcmV0d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ldHVybiBTdGF0dXM6Om9rKCk7CisgICAgfQorICAgIGNsZWFyX3NpZCh1c2VySWQpOworCisgICAgdWludDMyX3QgaHdfdXNlcklkID0gMDsKKyAgICBTdGF0dXMgcmVzdWx0ID0gYWRqdXN0X3VzZXJJZCh1c2VySWQsICZod191c2VySWQpOworICAgIGlmICghcmVzdWx0LmlzT2soKSkgeworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIGlmIChhaWRsX2h3X2RldmljZSkgeworICAgICAgICBhaWRsX2h3X2RldmljZS0+ZGVsZXRlVXNlcihod191c2VySWQpOworICAgIH0gZWxzZSBpZiAoaHdfZGV2aWNlKSB7CisgICAgICAgIGh3X2RldmljZS0+ZGVsZXRlVXNlcihod191c2VySWQsIFtdKGNvbnN0IEdhdGVrZWVwZXJSZXNwb25zZSYpIHt9KTsKKyAgICB9CisgICAgcmV0dXJuIFN0YXR1czo6b2soKTsKK30KKworU3RhdHVzIEdhdGVLZWVwZXJQcm94eTo6cmVwb3J0RGV2aWNlU2V0dXBDb21wbGV0ZSgpIHsKKyAgICBJUENUaHJlYWRTdGF0ZSogaXBjID0gSVBDVGhyZWFkU3RhdGU6OnNlbGYoKTsKKyAgICBjb25zdCBpbnQgY2FsbGluZ19waWQgPSBpcGMtPmdldENhbGxpbmdQaWQoKTsKKyAgICBjb25zdCBpbnQgY2FsbGluZ191aWQgPSBpcGMtPmdldENhbGxpbmdVaWQoKTsKKyAgICBpZiAoIVBlcm1pc3Npb25DYWNoZTo6Y2hlY2tQZXJtaXNzaW9uKEtFWUdVQVJEX1BFUk1JU1NJT04sIGNhbGxpbmdfcGlkLCBjYWxsaW5nX3VpZCkpIHsKKyAgICAgICAgQUxPR0UoIiVzOiBwZXJtaXNzaW9uIGRlbmllZCBmb3IgWyVkOiVkXSIsIF9fZnVuY19fLCBjYWxsaW5nX3BpZCwgY2FsbGluZ191aWQpOworICAgICAgICByZXR1cm4gU3RhdHVzOjpvaygpOworICAgIH0KKworICAgIGN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GU19QQVRILAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOwotICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5zdHJpbmcoKSwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2hhcmdlck5hbWVzW2ldLmNfc3RyKCkpOworICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICBtSGVhbHRoSW5mby0+Y2hhcmdlckRvY2tPbmxpbmUgPSB0cnVlOwogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgS0xPR19XQVJOSU5HKExPR19UQUcsICIlczogVW5rbm93biBwb3dlciBzdXBwbHkgdHlwZVxuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5jX3N0cigpKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jdXJyZW50X21heCIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5zdHJpbmcoKSk7Ci0gICAgICAgICAgICBpbnQgQ2hhcmdpbmdDdXJyZW50ID0KLSAgICAgICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLnN0cmluZygpLCBSX09LKSA9PSAwKSA/IGdldEludEZpZWxkKHBhdGgpIDogMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uY19zdHIoKSk7CisgICAgICAgICAgICBpbnQgQ2hhcmdpbmdDdXJyZW50ID0gKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApID8gZ2V0SW50RmllbGQocGF0aCkgOiAwOwogCiAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvdm9sdGFnZV9tYXgiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5jX3N0cigpKTsKIAogICAgICAgICAgICAgaW50IENoYXJnaW5nVm9sdGFnZSA9Ci0gICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLnN0cmluZygpLCBSX09LKSA9PSAwKSA/IGdldEludEZpZWxkKHBhdGgpIDoKLSAgICAgICAgICAgICAgICBERUZBVUxUX1ZCVVNfVk9MVEFHRTsKKyAgICAgICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApID8gZ2V0SW50RmllbGQocGF0aCkgOiBERUZBVUxUX1ZCVVNfVk9MVEFHRTsKIAogICAgICAgICAgICAgZG91YmxlIHBvd2VyID0gKChkb3VibGUpQ2hhcmdpbmdDdXJyZW50IC8gTUlMTElPTikgKgogICAgICAgICAgICAgICAgICAgICAgICAgICAgKChkb3VibGUpQ2hhcmdpbmdWb2x0YWdlIC8gTUlMTElPTik7CkBAIC01MTAsMTcgKzUwNiwxNyBAQAogICAgICAgICAgICAgICAgICBwcm9wcy5iYXR0ZXJ5U3RhdHVzKTsKIAogICAgICAgICBsZW4gPSBzdHJsZW4oZG1lc2dsaW5lKTsKLSAgICAgICAgaWYgKCFoZWFsdGhkX2NvbmZpZy5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguaXNFbXB0eSgpK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ycmVudE5vd1BhdGguaXNFbXB0eSgpKSB7CisgICAgICAgIGlmICghbUhlYWx0aGRDb25maWctPmJhdHRlcnlDdXJyZW50Tm93UGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICB2YWwtPnZhbHVlSW50NjQgPQogICAgICAgICAgICAgICAgIGdldEludEZpZWxkKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGgpOwogICAgICAgICAgICAgcmV0ID0gT0s7CkBAIC02MzEsNyArNjI3LDcgQEAKICAgICAgICAgYnJlYWs7CiAKICAgICBjYXNlIEJBVFRFUllfUFJPUF9DVVJSRU5UX0FWRzoKLSAgICAgICAgaWYgKCFtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICBpZiAoIW1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudEF2Z1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgdmFsLT52YWx1ZUludDY0ID0KICAgICAgICAgICAgICAgICBnZXRJbnRGaWVsZChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoKTsKICAgICAgICAgICAgIHJldCA9IE9LOwpAQCAtNjQxLDcgKzYzNyw3IEBACiAgICAgICAgIGJyZWFrOwogCiAgICAgY2FzZSBCQVRURVJZX1BST1BfQ0FQQUNJVFk6Ci0gICAgICAgIGlmICghbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgIGlmICghbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgdmFsLT52YWx1ZUludDY0ID0KICAgICAgICAgICAgICAgICBnZXRJbnRGaWVsZChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUNhcGFjaXR5UGF0aCk7CiAgICAgICAgICAgICByZXQgPSBP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nRmKHZzLCBzaXplb2YodnMpLCAiRnVsbCBjaGFyZ2U6ICVkXG4iLCBwcm9wcy5iYXR0ZXJ5RnVsbENoYXJnZVVhaCk7CiAgICAgICAgIHdyaXRlKGZkLCB2cywgc3RybGVuKHZzKSk7CiAgICAgfQpAQCAtNzc1LDggKzc3MSw3IEBACiAgICAgICAgICAgICBjYXNlIEFORFJPSURfUE9XRVJfU1VQUExZX1RZUEVfRE9DSzoKICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL29ubGluZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguc3RyaW5nKCksIFJfT0spID09IDApCi0gICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXMuYWRkKFN0cmluZzgobmFtZSkpOworICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSBtQ2hhcmdlck5hbWVzLmFkZChTdHJpbmc4KG5hbWUpKTsKICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgY2FzZSBBTkRST0lEX1BPV0VSX1NVUFBMWV9UWVBFX0JBVFRFUlk6CkBAIC03ODcsMTY2ICs3ODIsMTY4IEBACiAgICAgICAgICAgICAgICAgaWYgKGlzU2NvcGVkUG93ZXJTdXBwbHkobmFtZSkpIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgIG1CYXR0ZXJ5RGV2aWNlUHJlc2VudCA9IHRydWU7CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlTdGF0dXNQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVN0YXR1c1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9zdGF0dXMiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5U3RhdHVzUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVN0YXR1c1BhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUhlYWx0aFBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5SGVhbHRoUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2hlYWx0aCIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlIZWFsdGhQYXRoID0gcGF0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5SGVhbHRoUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9wcmVzZW50IiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCi0gICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVByZXNlbnRQYXRoID0gcGF0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUNhcGFjaXR5UGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jYXBhY2l0eSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVZvbHRhZ2VQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVZvbHRhZ2VQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvdm9sdGFnZV9ub3ciLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlWb2x0YWdlUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NoYXJnZV9mdWxsIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jdXJyZW50X25vdyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQorICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvY3ljbGVfY291bnQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NhcGFjaXR5X2xldmVsIiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q2FwYWNpdHlMZXZlbFBhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VUaW1lVG9GdWxsTm93UGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VUaW1lVG9GdWxsTm93UGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL3RpbWVfdG9fZnVsbF9ub3ciLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUNoYXJnZVRpbWVUb0Z1bGxOb3dQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlRGVzaWduQ2FwYWNpdHlVYWhQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZ1bGxDaGFyZ2VEZXNpZ25DYXBhY2l0eVVhaFBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jaGFyZ2VfZnVsbF9kZXNpZ24iLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZ1bGxDaGFyZ2VEZXNpZ25DYXBhY2l0eVVhaFBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvY3VycmVudF9hdmciLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NoYXJnZV9jb3VudGVyIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVtcGVyYXR1cmVQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVRlbXBlcmF0dXJlUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL3RlbXAiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlUZW1wZXJhdHVyZVBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVjaG5vbG9neVBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVjaG5vbG9neVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy90ZWNobm9sb2d5IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlUZWNobm9sb2d5UGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5U3RhdGVPZkhlYWx0aFBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5U3RhdGVPZkhlYWx0aFBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9zdGF0ZV9vZl9oZWFsdGgiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlTdGF0ZU9mSGVhbHRoUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvaGVhbHRoX2luZGV4IiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlTdGF0ZU9mSGVhbHRoUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlIZWFsdGhTdGF0dXNQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUhlYWx0aFN0YXR1c1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9oZWFsdGhfc3RhdHVzIiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5SGVhbHRoU3RhdHVzUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUhlYWx0aFN0YXR1c1BhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5TWFudWZhY3R1cmluZ0RhdGVQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeU1hbnVmYWN0dXJpbmdEYXRlUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL21hbnVmYWN0dXJpbmdfZGF0ZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQorICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5TWFudWZhY3R1cmluZ0RhdGVQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGaXJzdFVzYWdlRGF0ZVBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Rmlyc3RVc2FnZURhdGVQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvZmlyc3RfdXNhZ2VfZGF0ZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKSBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZpcnN0VXNhZ2VEYXRlUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZpcnN0VXNhZ2VEYXRlUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmNoYXJnaW5nU3RhdGVQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+Y2hhcmdpbmdTdGF0ZVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jaGFyZ2luZ19zdGF0ZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKSBtSGVhbHRoZENvbmZpZy0+Y2hhcmdpbmdTdGF0ZVBhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgbUhlYWx0aGRDb25maWctPmNoYXJnaW5nU3RhdGVQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmNoYXJnaW5nUG9saWN5UGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmNoYXJnaW5nUG9saWN5UGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NoYXJnaW5nX3BvbGljeSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKSBtSGVhbHRoZENvbmZpZy0+Y2hhcmdpbmdQb2xpY3lQYXRoID0gcGF0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5jaGFyZ2luZ1BvbGljeVBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtOTU4LDEyICs5NTUsMTAgQEAKICAgICAgICAgICAgIC8vIExvb2sgZm9yICJpc19kb2NrIiBmaWxlCiAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvaXNfZG9jayIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5zdHJpbmcoKSwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIHsKICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL29ubGluZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguc3RyaW5nKCksIFJfT0spID09IDApCi0gICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXMuYWRkKFN0cmluZzgobmFtZSkpOwotCisgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1DaGFyZ2VyTmFtZXMuYWRkKFN0cmluZzgobmFtZSkpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtOTc1LDQzICs5NzAsNDMgQEAKICAgICAgICAgaGMtPnBlcmlvZGljX2Nob3Jlc19pbnRlcnZhbF9mYXN0ID0gLTE7CiAgICAgICAgIGhjLT5wZXJpb2RpY19jaG9yZXNfaW50ZXJ2YWxfc2xvdyA9IC0xOwogICAgIH0gZWxzZSB7Ci0gICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVN0YXR1c1BhdGguaXNFbXB0eSgpKQorICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlTdGF0dXNQYXRoLmVtcHR5KCkpCiAgICAgICAgICAgICBLTE9HX1dBUk5JTkcoTE9HX1RBRywgIkJhdHRlcnlTdGF0dX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IG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOwotICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5zdHJpbmcoKSwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2hhcmdlck5hbWVzW2ldLmNfc3RyKCkpOworICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICBtSGVhbHRoSW5mby0+Y2hhcmdlckRvY2tPbmxpbmUgPSB0cnVlOwogICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgS0xPR19XQVJOSU5HKExPR19UQUcsICIlczogVW5rbm93biBwb3dlciBzdXBwbHkgdHlwZVxuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5jX3N0cigpKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jdXJyZW50X21heCIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5zdHJpbmcoKSk7Ci0gICAgICAgICAgICBpbnQgQ2hhcmdpbmdDdXJyZW50ID0KLSAgICAgICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLnN0cmluZygpLCBSX09LKSA9PSAwKSA/IGdldEludEZpZWxkKHBhdGgpIDogMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uY19zdHIoKSk7CisgICAgICAgICAgICBpbnQgQ2hhcmdpbmdDdXJyZW50ID0gKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApID8gZ2V0SW50RmllbGQocGF0aCkgOiAwOwogCiAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvdm9sdGFnZV9tYXgiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXNbaV0uc3RyaW5nKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNoYXJnZXJOYW1lc1tpXS5jX3N0cigpKTsKIAogICAgICAgICAgICAgaW50IENoYXJnaW5nVm9sdGFnZSA9Ci0gICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLnN0cmluZygpLCBSX09LKSA9PSAwKSA/IGdldEludEZpZWxkKHBhdGgpIDoKLSAgICAgICAgICAgICAgICBERUZBVUxUX1ZCVVNfVk9MVEFHRTsKKyAgICAgICAgICAgICAgICAgICAgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApID8gZ2V0SW50RmllbGQocGF0aCkgOiBERUZBVUxUX1ZCVVNfVk9MVEFHRTsKIAogICAgICAgICAgICAgZG91YmxlIHBvd2VyID0gKChkb3VibGUpQ2hhcmdpbmdDdXJyZW50IC8gTUlMTElPTikgKgogICAgICAgICAgICAgICAgICAgICAgICAgICAgKChkb3VibGUpQ2hhcmdpbmdWb2x0YWdlIC8gTUlMTElPTik7CkBAIC00MjQsMTcgKzQyMCwxNyBAQAogICAgICAgICAgICAgICAgICBwcm9wcy5iYXR0ZXJ5U3RhdHVzKTsKIAogICAgICAgICBsZW4gPSBzdHJsZW4oZG1lc2dsaW5lKTsKLSAgICAgICAgaWYgKCFoZWFsdGhkX2NvbmZpZy5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguaXNFbXB0eSgpKSB7CisgICAgICAgIGlmICghaGVhbHRoZF9jb25maWcuYmF0dGV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ZkLCB2cywgc3RybGVuKHZzKSk7CiAgICAgfQpAQCAtNjI4LDggKzYyNCw3IEBACiAgICAgICAgICAgICBjYXNlIEFORFJPSURfUE9XRVJfU1VQUExZX1RZUEVfRE9DSzoKICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL29ubGluZSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguc3RyaW5nKCksIFJfT0spID09IDApCi0gICAgICAgICAgICAgICAgICAgIG1DaGFyZ2VyTmFtZXMuYWRkKFN0cmluZzgobmFtZSkpOworICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSBtQ2hhcmdlck5hbWVzLmFkZChTdHJpbmc4KG5hbWUpKTsKICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgY2FzZSBBTkRST0lEX1BPV0VSX1NVUFBMWV9UWVBFX0JBVFRFUlk6CkBAIC02NDAsMTIxICs2MzUsMTE5IEBACiAgICAgICAgICAgICAgICAgaWYgKGlzU2NvcGVkUG93ZXJTdXBwbHkobmFtZSkpIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgIG1CYXR0ZXJ5RGV2aWNlUHJlc2VudCA9IHRydWU7CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlTdGF0dXNQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVN0YXR1c1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9zdGF0dXMiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5U3RhdHVzUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKSBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVN0YXR1c1BhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUhlYWx0aFBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5SGVhbHRoUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2hlYWx0aCIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlIZWFsdGhQYXRoID0gcGF0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5SGVhbHRoUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9wcmVzZW50IiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCi0gICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVByZXNlbnRQYXRoID0gcGF0aDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5UHJlc2VudFBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUNhcGFjaXR5UGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jYXBhY2l0eSIsIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eVBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVZvbHRhZ2VQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVZvbHRhZ2VQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvdm9sdGFnZV9ub3ciLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlWb2x0YWdlUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NoYXJnZV9mdWxsIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jdXJyZW50X25vdyIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPV0VSX1NVUFBMWV9TWVNGU19QQVRILCBuYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLCBSX09LKSA9PSAwKQorICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q3VycmVudE5vd1BhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvY3ljbGVfY291bnQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN5Y2xlQ291bnRQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NhcGFjaXR5X2xldmVsIiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApIG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5Q2FwYWNpdHlMZXZlbFBhdGggPSBwYXRoOworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDYXBhY2l0eUxldmVsUGF0aCA9IHBhdGg7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VUaW1lVG9GdWxsTm93UGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VUaW1lVG9GdWxsTm93UGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL3RpbWVfdG9fZnVsbF9ub3ciLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUNoYXJnZVRpbWVUb0Z1bGxOb3dQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlGdWxsQ2hhcmdlRGVzaWduQ2FwYWNpdHlVYWhQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZ1bGxDaGFyZ2VEZXNpZ25DYXBhY2l0eVVhaFBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9jaGFyZ2VfZnVsbF9kZXNpZ24iLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUZ1bGxDaGFyZ2VEZXNpZ25DYXBhY2l0eVVhaFBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZEZvcm1hdCgiJXMvJXMvY3VycmVudF9hdmciLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLmNfc3RyKCksIFJfT0spID09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhbHRoZENvbmZpZy0+YmF0dGVyeUN1cnJlbnRBdmdQYXRoID0gcGF0aDsKICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL2NoYXJnZV9jb3VudGVyIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlDaGFyZ2VDb3VudGVyUGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVtcGVyYXR1cmVQYXRoLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIGlmIChtSGVhbHRoZENvbmZpZy0+YmF0dGVyeVRlbXBlcmF0dXJlUGF0aC5lbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmRGb3JtYXQoIiVzLyVzL3RlbXAiLCBQT1dFUl9TVVBQTFlfU1lTRlNfUEFUSCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aCwgUl9PSykgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGguY19zdHIoKSwgUl9PSykgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlUZW1wZXJhdHVyZVBhdGggPSBwYXRoOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVjaG5vbG9neVBhdGguaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1IZWFsdGhkQ29uZmlnLT5iYXR0ZXJ5VGVjaG5vbG9neVBhdGguZW1wdHkoKSkgewogICAgICAgICAgICAgICAgICAgICBwYXRoLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy90ZWNobm9sb2d5IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoYWNjZXNzKHBhdGgsIFJfT0spID09IDApCisgICAgICAgICAgICAgICAgICAgIGlmIChhY2Nlc3MocGF0aC5jX3N0cigpLCBSX09LKSA9PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWx0aGRDb25maWctPmJhdHRlcnlUZWNobm9sb2d5UGF0aCA9IHBhdGg7CiAgICAgICAgICAgICAgICAgfQogCkBAIC03NjcsMTIgKzc2MCwxMCBAQAogICAgICAgICAgICAgLy8gTG9vayBmb3IgImlzX2RvY2siIGZpbGUKICAgICAgICAgICAgIHBhdGguY2xlYXIoKTsKICAgICAgICAgICAgIHBhdGguYXBwZW5kRm9ybWF0KCIlcy8lcy9pc19kb2NrIiwgUE9XRVJfU1VQUExZX1NZU0ZTX1BBVEgsIG5hbWUpOwotICAgICAgICAgICAgaWYgKGFjY2VzcyhwYXRoLnN0cmlu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AgICAgICJsaWJib290bG9hZGVyX21lc3NhZ2UiLAogICAgICAgICAibGliYysrZnMiLAogICAgICAgICAibGliY2dyb3VwcmNfZm9ybWF0IiwKLSAgICAgICAgImxpYmZzdmVyaXR5X2luaXQiLAogICAgICAgICAibGlibG1rZF91dGlscyIsCiAgICAgICAgICJsaWJsejQiLAotICAgICAgICAibGlibWluaV9rZXljdGxfc3RhdGljIiwKKyAgICAgICAgImxpYnpzdGQiLAogICAgICAgICAibGlibW9kcHJvYmUiLAogICAgICAgICAibGlicHJvY2luZm8iLAogICAgICAgICAibGlicHJvdG9idWYtY3BwLWxpdGUiLAogICAgICAgICAibGlicHJvcGVydHlpbmZvc2VyaWFsaXplciIsCiAgICAgICAgICJsaWJwcm9wZXJ0eWluZm9wYXJzZXIiLAotICAgICAgICAibGlic2lnbmluZ3V0aWxzIiwKICAgICAgICAgImxpYnNuYXBzaG90X2NvdyIsCiAgICAgICAgICJsaWJzbmFwc2hvdF9pbml0IiwKICAgICAgICAgImxpYnhtbDIiLApAQCAtMTg0LDcgKzE4Miw2IEBACiAgICAgXSwKICAgICBzaGFyZWRfbGliczogWwogICAgICAgICAibGliYmFzZSIsCi0gICAgICAgICJsaWJjcnlwdG8iLAogICAgICAgICAibGliY3V0aWxzIiwKICAgICAgICAgImxpYmRsIiwKICAgICAgICAgImxpYmV4dDRfdXRpbHMiLApAQCAtMjAwLDcgKzE5Nyw2IEBACiAgICAgICAgICJsaWJzZWxpbnV4IiwKICAgICAgICAgImxpYnVud2luZHN0YWNrIiwKICAgICAgICAgImxpYnV0aWxzIiwKLSAgICAgICAgImxpYnppcGFyY2hpdmUiLAogICAgIF0sCiAgICAgaGVhZGVyX2xpYnM6IFsiYmlvbmljX2xpYmNfcGxhdGZvcm1faGVhZGVycyJdLAogICAgIGJvb3RzdHJhcDogdHJ1ZSwKQEAgLTIxMyw4ICsyMDksOCBAQAogICAgIHZpc2liaWxpdHk6IFsiOl9fc3VicGFja2FnZXNfXyJdLAogfQogCi1jY19saWJyYXJ5X3N0YXRpYyB7Ci0gICAgbmFtZTogImxpYmluaXQiLAorY2NfZGVmYXVsdHMgeworICAgIG5hbWU6ICJsaWJpbml0X2RlZmF1bHRzIiwKICAgICByZWNvdmVyeV9hdmFpbGFibGU6IHRydWUsCiAgICAgZGVmYXVsdHM6IFsKICAgICAgICAgImluaXRfZGVmYXVsdHMiLApAQCAtMjI3LDcgKzIyMyw2IEBACiAgICAgXSwKICAgICB3aG9sZV9zdGF0aWNfbGliczogWwogICAgICAgICAibGliY2FwIiwKLSAgICAgICAgImxpYmNvbS5hbmRyb2lkLnN5c3Byb3AuYXBleCIsCiAgICAgICAgICJsaWJjb20uYW5kcm9pZC5zeXNwcm9wLmluaXQiLAogICAgIF0sCiAgICAgaGVhZGVyX2xpYnM6IFsiYm9vdGltZ19oZWFkZXJzIl0sCkBAIC0yNTEsMTAgKzI0NiwxNyBAQAogICAgICAgICAgICAgXSwKICAgICAgICAgfSwKICAgICB9LAotICAgIHZpc2liaWxpdHk6IFsKLSAgICAgICAgIi8vc3lzdGVtL2FwZXgvYXBleGQiLAotICAgICAgICAiLy9mcmFtZXdvcmtzL25hdGl2ZS9jbWRzL2luc3RhbGxkIiwKLSAgICBdLAorfQorCitjY19saWJyYXJ5X3N0YXRpYyB7CisgICAgbmFtZTogImxpYmluaXQiLAorICAgIGRlZmF1bHRzOiBbImxpYmluaXRfZGVmYXVsdHMiXSwKK30KKworY2NfbGlicmFyeV9zdGF0aWMgeworICAgIG5hbWU6ICJsaWJpbml0Lm1pY3JvZHJvaWQiLAorICAgIGRlZmF1bHRzOiBbImxpYmluaXRfZGVmYXVsdHMiXSwKKyAgICBjZmxhZ3M6IFsiLURNSUNST0RST0lEPTEiXSwKIH0KIAogcGhvbnkgewpAQCAtMjY0LDEyICsyNjYsMTEgQEAKICAgICBdLAogfQogCi1jY19iaW5hcnkgewotICAgIG5hbWU6ICJpbml0X3NlY29uZF9zdGFnZSIsCitjY19kZWZhdWx0cyB7CisgICAg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250aW51ZTsKICAgICAgICAgfQotICAgICAgICAvLyBGaWx0ZXIgZGlyZWN0b3JpZXMKLSAgICAgICAgaWYgKHBhdGguYmFjaygpID09ICcvJykgeworCisgICAgICAgIC8vIEdldCBhcGV4IG5hbWUgZnJvbSBwYXRoLgorICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gcGF0aHMgPSBhbmRyb2lkOjpiYXNlOjpTcGxpdChwYXRoLCAiLyIpOworICAgICAgICBpZiAocGF0aHMuc2l6ZSgpIDwgMykgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcmIGFwZXhfbmFtZSA9IHBhdGhzWzJdOworCisgICAgICAgIC8vIEZpbHRlciBvdXQgL2FwZXgvPG5hbWU+QDx2ZXI+IHBhdGhzLiBUaGUgcGF0aHMgYXJlIGJpbmQtbW91bnRlZCB0bworICAgICAgICAvLyAvYXBleC88bmFtZT4gcGF0aHMsIHNvIHVubGVzcyB3ZSBmaWx0ZXIgdGhlbSBvdXQsIHdlIHdpbGwgcGFyc2UgdGhlCisgICAgICAgIC8vIHNhbWUgZmlsZSB0d2ljZS4KKyAgICAgICAgaWYgKGFwZXhfbmFtZS5maW5kKCdAJykgIT0gc3RkOjpzdHJpbmc6Om5wb3MpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisKKyAgICAgICAgLy8gRmlsdGVyIG91dCBza2lwX3NldCBhcGV4ZXMKKyAgICAgICAgaWYgKHNraXBfYXBleGVzLmNvdW50KGFwZXhfbmFtZSkgPiAwKSB7CiAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgfQogICAgICAgICBjb25maWdzLnB1c2hfYmFjayhwYXRoKTsKQEAgLTY0LDExICs4Miw0MSBAQAogICAgIHJldHVybiBjb25maWdzOwogfQogCi1zdGF0aWMgUmVzdWx0PHZvaWQ+IFBhcnNlQ29uZmlncyhjb25zdCBzdGQ6OnZlY3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AgICAgICAgbG9vcF9pbmZvIGluZm87Ci0gICAgICAgICAgICAvKiBpZiBpdCBpcyBhIGJsYW5rIGxvb3AgZGV2aWNlICovCi0gICAgICAgICAgICBpZiAoaW9jdGwobG9vcC5nZXQoKSwgTE9PUF9HRVRfU1RBVFVTLCAmaW5mbykgPCAwICYmIGVycm5vID09IEVOWElPKSB7Ci0gICAgICAgICAgICAgICAgLyogaWYgaXQgYmVjb21lcyBvdXIgbG9vcCBkZXZpY2UgKi8KLSAgICAgICAgICAgICAgICBpZiAoaW9jdGwobG9vcC5nZXQoKSwgTE9PUF9TRVRfRkQsIGZkLmdldCgpKSA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtb3VudCh0bXAuY19zdHIoKSwgdGFyZ2V0LCBzeXN0ZW0sIGZsYWdzLCBvcHRpb25zKSA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlvY3RsKGxvb3AuZ2V0KCksIExPT1BfQ0xSX0ZELCAwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFcnJub0Vycm9yKCkgPDwgIm1vdW50KCkgZmFpbGVkIjsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICAvLyBPcGVuIHNvdXJjZSBmaWxlCisgICAgICAgIGlmICh3YWl0KSB7CisgICAgICAgICAgICB3YWl0X2Zvcl9maWxlKGZpbGVfcGF0aCwga0NvbW1hbmRSZXRyeVRpbWVvdXQpOwogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIEVycm9yKCkgPDwgIm91dCBvZiBsb29wYmFjayBkZXZpY2VzIjsKKyAgICAgICAgdW5pcXVlX2ZkIGZkKFRFTVBfRkFJTFVSRV9SRVRSWShvcGVuKGZpbGVfcGF0aCwgbW9kZSB8IE9fQ0xPRVhFQykpKTsKKyAgICAgICAgaWYgKGZkIDwgMCk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XBhcnNlX3Jlc3VsdC5vaygpKSB7CisgICAgICAgIHJldHVybiBwYXJzZV9yZXN1bHQuZXJyb3IoKTsKICAgICB9CiAKICAgICBhdXRvIHVwZGF0ZV9saW5rZXJfY29uZmlnID0gZG9fdXBkYXRlX2xpbmtlcl9jb25maWcoYXJncyk7CkBAIC0xMzIzLDYgKzEzMDIsOSBAQAogICAgICAgICByZXR1cm4gdXBkYXRlX2xpbmtlcl9jb25maWcuZXJyb3IoKTsKICAgICB9CiAKKyAgICBpZiAoIWJvb3RzdHJhcCkgeworICAgICAgICBTZXJ2aWNlTGlzdDo6R2V0SW5zdGFuY2UoKS5TdGFydERlbGF5ZWRTZXJ2aWNlcygpOworICAgIH0KICAgICByZXR1cm4ge307CiB9CiAKQEAgLTEzNzcsNyArMTM1OSw3IEBACiAgICAgICAgIC8vIG1vdW50IGFuZCB1bW91bnQgYXJlIHJ1biBpbiB0aGUgc2FtZSBjb250ZXh0IGFzIG1vdW50X2FsbCBmb3Igc3ltbWV0cnkuCiAgICAgICAgIHsibW91bnRfYWxsIiwgICAgICAgICAgICAgICB7MCwgICAgIGtNYXgsIHtmYWxzZSwgIGRvX21vdW50X2FsbH19fSwKICAgICAgICAgeyJtb3VudCIsICAgICAgICAgICAgICAgICAgIHszLCAgICAga01heCwge2ZhbHNlLCAgZG9fbW91bnR9fX0sCi0gICAgICAgIHsicGVyZm9ybV9hcGV4X2NvbmZpZyIsICAgICB7MCwgICAgIDAsICAgIHtmYWxzZSwgIGRvX3BlcmZvcm1fYXBleF9jb25maWd9fX0sCisgICAgICAgIHsicGVyZm9ybV9hcGV4X2NvbmZpZyIsICAgICB7MCwgICAgIDEsICAgIHtmYWxzZSwgIGRvX3BlcmZvcm1fYXBleF9jb25maWd9fX0sCiAgICAgICAgIHsidW1vdW50IiwgICAgICAgICAgICAgICAgICB7MSwgICAgIDEsICAgIHtmYWxzZSwgIGRvX3Vtb3VudH19fSwKICAgICAgICAgeyJ1bW91bnRfYWxsIiwgICAgIC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Ht9OwogICAgIGlmIChzdGF0KCIvIiwgJm9sZF9yb290X2luZm8pICE9IDApIHsKICAgICAgICAgUExPRyhFUlJPUikgPDwgIkNvdWxkIG5vdCBzdGF0KFwiL1wiKSwgbm90IGZyZWVpbmcgcmFtZGlzayI7CiAgICAgICAgIG9sZF9yb290X2Rpci5yZXNldCgpOwpAQCAtMzI4LDcgKzQzMCw4IEBACiAKICAgICBib290X2Nsb2NrOjp0aW1lX3BvaW50IG1vZHVsZV9zdGFydF90aW1lID0gYm9vdF9jbG9jazo6bm93KCk7CiAgICAgaW50IG1vZHVsZV9jb3VudCA9IDA7Ci0gICAgaWYgKCFMb2FkS2VybmVsTW9kdWxlcyhJc1JlY292ZXJ5TW9kZSgpICYmICFGb3JjZU5vcm1hbEJvb3QoY21kbGluZSwgYm9vdGNvbmZpZyksIHdhbnRfY29uc29sZSwKKyAgICBCb290TW9kZSBib290X21vZGUgPSBHZXRCb290TW9kZShjbWRsaW5lLCBib290Y29uZmlnKTsKKyAgICBpZiAoIUxvYWRLZXJuZWxNb2R1bGVzKGJvb3RfbW9kZSwgd2FudF9jb25zb2xlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FudF9wYXJhbGxlbCwgbW9kdWxlX2NvdW50KSkgewogICAgICAgICBpZiAod2FudF9jb25zb2xlICE9IEZpcnN0U3RhZ2VDb25zb2xlUGFyYW06OkRJU0FCTEVEKSB7CiAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gbG9hZCBrZXJuZWwgbW9kdWxlcywgc3RhcnRpbmcgY29uc29sZSI7CkBAIC0zNDQsMTIgKzQ0NywxNyBAQAogICAgICAgICAgICAgICAgICAgPDwgbW9kdWxlX2VsYXBzZV90aW1lLmNvdW50KCkgPDwgIiBtcyI7CiAgICAgfQogCisgICAgc3RkOjp1bmlxdWVfcHRyPEZpcnN0U3RhZ2VNb3VudD4gZnNtOworCiAgICAgYm9vbCBjcmVhdGVkX2RldmljZXMgPSBmYWxzZTsKICAgICBpZiAod2FudF9jb25zb2xlID09IEZpcnN0U3RhZ2VDb25zb2xlUGFyYW06OkNPTlNPTEVfT05fRkFJTFVSRSkgewogICAgICAgICBpZiAoIUlzUmVjb3ZlcnlNb2RlKCkpIHsKLSAgICAgICAgICAgIGNyZWF0ZWRfZGV2aWNlcyA9IERvQ3JlYXRlRGV2aWNlcygpOwotICAgICAgICAgICAgaWYgKCFjcmVhdGVkX2RldmljZXMpIHsKLSAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gY3JlYXRlIGRldmljZSBub2RlcyBlYXJseSI7CisgICAgICAgICAgICBmc20gPSBDcmVhdGVGaXJzdFN0YWdlTW91bnQoY21kbGluZSk7CisgICAgICAgICAgICBpZiAoZnNtKSB7CisgICAgICAgICAgICAgICAgY3JlYXRlZF9kZXZpY2VzID0gZnNtLT5Eb0NyZWF0ZURldmljZXMoKTsKKyAgICAgICAgICAgICAgICBpZiAoIWNyZWF0ZWRfZGV2aWNlcykgeworICAgICAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gY3JlYXRlIGRldmljZSBub2RlcyBlYXJseSI7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIFN0YXJ0Q29uc29sZShjbWRsaW5lKTsKQEAgLTQwMCwxMSArNTA4LDI2IEBACiAgICAgICAgIFN3aXRjaFJvb3QoIi9maXJzdF9zdGFnZV9yYW1kaXNrIik7CiAgICAgfQogCi0gICAgaWYgKCFEb0ZpcnN0U3RhZ2VNb3VudCghY3JlYXRlZF9kZXZpY2VzKSkgewotICAgICAgICBMT0coRkFUQUwpIDw8ICJGYWlsZWQgdG8gbW91bnQgcmVxdWlyZWQgcGFydGl0aW9ucyBlYXJseSAuLi4iOworICAgIGlmIChJc1JlY292ZXJ5TW9kZSgpKSB7CisgICAgICAgIExPRyhJTkZPKSA8PCAiRmlyc3Qgc3RhZ2UgbW91bnQ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kgJyIgPDwgcHJvcC5uYW1lKCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICInIGRvZXNuJ3Qgc3RhcnQgd2l0aCAncGVyc2lzdC4nIjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICInIGRvZXNuJ3Qgc3RhcnQgd2l0aCAncGVyc2lzdC4nIG9yICduZXh0X2Jvb3QuJyI7CiAgICAgICAgIH0KICAgICB9CiAgICAgcmV0dXJuIHBlcnNpc3RlbnRfcHJvcGVydGllczsKQEAgLTIyMSw2ICsyMDMsMjQgQEAKICAgICByZXR1cm4ge307CiB9CiAKK1BlcnNpc3RlbnRQcm9wZXJ0aWVzIExvYWRQZXJzaXN0ZW50UHJvcGVydGllc0Zyb21NZW1vcnkoKSB7CisgICAgUGVyc2lzdGVudFByb3BlcnRpZXMgcGVyc2lzdGVudF9wcm9wZXJ0aWVzOworICAgIF9fc3lzdGVtX3Byb3BlcnR5X2ZvcmVhY2goCisgICAgICAgICAgICBbXShjb25zdCBwcm9wX2luZm8qIHBpLCB2b2lkKiBjb29raWUpIHsKKyAgICAgICAgICAgICAgICBfX3N5c3RlbV9wcm9wZXJ0eV9yZWFkX2NhbGxiYWNrKAorICAgICAgICAgICAgICAgICAgICAgICAgcGksCisgICAgICAgICAgICAgICAgICAgICAgICBbXSh2b2lkKiBjb29raWUsIGNvbnN0IGNoYXIqIG5hbWUsIGNvbnN0IGNoYXIqIHZhbHVlLCB1bnNpZ25lZCBzZXJpYWwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoU3RhcnRzV2l0aChuYW1lLCAicGVyc2lzdC4iKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvIHByb3BlcnRpZXMgPSByZWludGVycHJldF9jYXN0PFBlcnNpc3RlbnRQcm9wZXJ0aWVzKj4oY29va2llKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWRkUGVyc2lzdGVudFByb3BlcnR5KG5h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NjM2Y4NDguLmE2OTU1ZjYgMTAwNjQ0Ci0tLSBhL2luaXQvcmxpbWl0X3BhcnNlcl90ZXN0LmNwcAorKysgYi9pbml0L3JsaW1pdF9wYXJzZXJfdGVzdC5jcHAKQEAgLTY3LDYgKzY3LDcgQEAKICAgICAgICAgICAgICAgICAgICAge3sicnRwcmlvIiwgIjEwIiwgIjEwIn0sIHsxNCwgezEwLCAxMH19fSwKICAgICAgICAgICAgICAgICAgICAge3sicnR0aW1lIiwgIjEwIiwgIjEwIn0sIHsxNSwgezEwLCAxMH19fSwKIAorICAgICAgICAgICAgICAgICAgICAvLyBGb3Igc29tZSByZWFzb24sIHdlIHNwZWxsZWQgdGhlc2Ugd3JvbmcuCiAgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1fQ1BVIiwgIjEwIiwgIjEwIn0sIHswLCB7MTAsIDEwfX19LAogICAgICAgICAgICAgICAgICAgICB7eyJSTElNX0ZTSVpFIiwgIjEwIiwgIjEwIn0sIHsxLCB7MTAsIDEwfX19LAogICAgICAgICAgICAgICAgICAgICB7eyJSTElNX0RBVEEiLCAiMTAiLCAiMTAifSwgezIsIHsxMCwgMTB9fX0sCkBAIC04NCw2ICs4NSwyNCBAQAogICAgICAgICAgICAgICAgICAgICB7eyJSTElNX1JUUFJJTyIsICIxMCIsICIxMCJ9LCB7MTQsIHsxMCwgMTB9fX0sCiAgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1fUlRUSU1FIiwgIjEwIiwgIjEwIn0sIHsxNSwgezEwLCAxMH19fSwKIAorICAgICAgICAgICAgICAgICAgICAvLyBUaGVzZSBhcmUgdGhlIGNvcnJlY3Qgc3BlbGxpbmdzLgorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfQ1BVIiwgIjEwIiwgIjEwIn0sIHswLCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfRlNJWkUiLCAiMTAiLCAiMTAifSwgezEsIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9EQVRBIiwgIjEwIiwgIjEwIn0sIHsyLCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfU1RBQ0siLCAiMTAiLCAiMTAifSwgezMsIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9DT1JFIiwgIjEwIiwgIjEwIn0sIHs0LCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfUlNTIiwgIjEwIiwgIjEwIn0sIHs1LCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfTlBST0MiLCAiMTAiLCAiMTAifSwgezYsIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9OT0ZJTEUiLCAiMTAiLCAiMTAifSwgezcsIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9NRU1MT0NLIiwgIjEwIiwgIjEwIn0sIHs4LCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfQVMiLCAiMTAiLCAiMTAifSwgezksIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9MT0NLUyIsICIxMCIsICIxMCJ9LCB7MTAsIHsxMCwgMTB9fX0sCisgICAgICAgICAgICAgICAgICAgIHt7IlJMSU1JVF9TSUdQRU5ESU5HIiwgIjEwIiwgIjEwIn0sIHsxMSwgezEwLCAxMH19fSwKKyAgICAgICAgICAgICAgICAgICAge3siUkxJTUlUX01TR1FVRVVFIiwgIjEwIiwgIjEwIn0sIHsxMiwgezEwLCAxMH19fSwKKyAgICAgICAgICAgICAgICAgICAge3siUkxJTUlUX05JQ0UiLCAiMTAiLCAiMTAifSwgezEzLCB7MTAsIDEwfX19LAorICAgICAgICAgICAgICAgICAgICB7eyJSTElNSVRfUlRQUklPIiwgIjEwIiwgIjEwIn0sIHsxNCwgezEwLCAxMH19fSwKKyAgICAgICAgICAgICAgICAgICAge3siUkxJTUlUX1JUVElNRSIsICIxMCIsICIxMCJ9LCB7MTUsIHsxMCwgMTB9fX0sCisKICAgICAgICAgICAgICAgICAgICAge3siMCIsICIxMCIsICIxMCJ9LCB7MCwgezEwLCAxMH19fSwKICAgICAgICAgICAgICAgICAgICAge3siMSIsICIxMCIsICIxMCJ9LCB7MSwgezEwLCAxMH19fSwKICAgICAgICAgICAgICAgICAgICAge3siMiIsICIxMCIsICIxMCJ9LCB7MiwgezEwLCAxMH19fSwKQEAgLTExMyw2ICsxMzIsNyBAQAogICAgICAgICAgICAge3siMTAwIiwgIjEwIiwgIjEwIn0sICJSZXNvdXJjZSAnMTAwJyBvdmVyIHRoZSBtYXhpbXVtIHJlc291cmNlIHZhbHVlICcxNicifSwKICAgICAgICAgICAgIHt7ImJhZF9zdHJpbmciLCAiMTAiLCAiMTAifSwgIkNvdWxkIG5vdCBwYXJzZSByZXNvdXJjZSAnYmFkX3N0cmluZycifSwKICAgICAgICAgICAgIHt7IlJMSU1fIiwgIjEwIiwgIjEwIn0sICJDb3VsZCBub3QgcGFyc2UgcmVzb3VyY2UgJ1JMSU1fJyJ9LAorICAgICAgICAgICAge3siUkxJTUlUXyIsICIxMCIsICIxMCJ9LCAiQ291bGQgbm90IHBhcnNlIHJlc291cmNlICdSTElNSVRfJyJ9LAogICAgICAgICAgICAge3siY3B1IiwgImFiYyIsICIxMCJ9LCAiQ291bGQgbm90IHBhcnNlIHNvZnQgbGltaXQgJ2FiYycifSwKICAgICAgICAgICAgIHt7ImNwdSIsICIxMCIsICJhYmMifSwgIkNvdWxkIG5vdCBwYXJzZSBoYXJkIGxpbWl0ICdhYmMnIn0sCiAgICAgICAgICAgICB7eyJjcHUiLCAidW5saW1pdCIsICIxMCJ9LCAiQ291bGQgbm90IHBhcnNlIHNvZnQgbGltaXQgJ3VubGltaXQnIn0sCmRpZmYgLS1naXQgYS9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lkcy5iZWdpbigpLCBwaWRzLmVuZCgpKTsKKyAgICBFcG9sbCBlcG9sbDsKKyAgICBpZiAoc2lnY2hsZF9mZCA+PSAwKSB7CisgICAgICAgIGlmIChhdXRvIHJlc3VsdCA9IGVwb2xsLk9wZW4oKTsgcmVzdWx0Lm9rKCkpIHsKKyAgICAgICAgICAgIHJlc3VsdCA9CisgICAgICAgICAgICAgICAgICAgIGVwb2xsLlJlZ2lzdGVySGFuZGxlcihzaWdjaGxkX2ZkLCBbc2lnY2hsZF9mZF0oKSB7IEhhbmRsZVNpZ25hbChzaWdjaGxkX2ZkKTsgfSk7CisgICAgICAgICAgICBpZiAoIXJlc3VsdC5vaygpKSB7CisgICAgICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8IF9fZnVuY19fCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgUmVnaXN0ZXJIYW5kbGVyKCkgZmFpbGVkLiBGYWxsaW5nIGJhY2sgdG8gc2xlZXBfZm9yKCk6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPDwgcmVzdWx0LmVycm9yKCk7CisgICAgICAgICAgICAgICAgc2lnY2hsZF9mZCA9IC0xOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8IF9fZnVuY19fIDw8ICIgRXBvbGw6Ok9wZW4oKSBmYWlsZWQuIEZhbGxpbmcgYmFjayB0byBzbGVlcF9mb3IoKTogIgorICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHJlc3VsdC5lcnJvcigpOworICAgICAgICAgICAgc2lnY2hsZF9mZCA9IC0xOworICAgICAgICB9CisgICAgfQorICAgIHN0ZDo6dmVjdG9yPHBpZF90PiBhbGl2ZV9waWRzKHBpZHMpOworICAgIFJlYXBBbmRSZW1vdmUoYWxpdmVfcGlkcyk7CiAgICAgd2hpbGUgKCFhbGl2ZV9waWRzLmVtcHR5KCkgJiYgdC5kdXJhdGlvbigpIDwgdGltZW91dCkgewotICAgICAgICBwaWRfdCBwaWQ7Ci0gICAgICAgIHdoaWxlICgocGlkID0gUmVhcE9uZVByb2Nlc3MoKSkgIT0gMCkgewotICAgICAgICAgICAgYXV0byBpdCA9IHN0ZDo6ZmluZChhbGl2ZV9waWRzLmJlZ2luKCksIGFsaXZlX3BpZHMuZW5kKCksIHBpZCk7Ci0gICAgICAgICAgICBpZiAoaXQgIT0gYWxpdmVfcGlkcy5lbmQoKSkgewotICAgICAgICAgICAgICAgIGFsaXZlX3BpZHMuZXJhc2UoaXQpOworICAgICAgICBpZiAoc2lnY2hsZF9mZCA+PSAwKSB7CisgICAgICAgICAgICBhdXRvIHJlc3VsdCA9IGVwb2xsLldhaXQoc3RkOjptYXgodGltZW91dCAtIHQuZHVyYXRpb24oKSwgMG1zKSk7CisgICAgICAgICAgICBpZiAocmVzdWx0Lm9rKCkpIHsKKyAgICAgICAgICAgICAgICBSZWFwQW5kUmVtb3ZlKGFsaXZlX3BpZHMpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBMT0coV0FSTklORykgPDwgIkVwb2xsOjpXYWl0KCkgZmFpbGVkICIgPDwgcmVzdWx0LmVycm9yKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgaWYgKGFsaXZlX3BpZHMuZW1wdHkoKSkgewotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KICAgICAgICAgc3RkOjp0aGlzX3RocmVhZDo6c2xlZXBfZm9yKDUwbXMpOworICAgICAgICBSZWFwQW5kUmVtb3ZlKGFsaXZlX3BpZHMpOwogICAgIH0KICAgICBMT0coSU5GTykgPDwgIldhaXRpbmcgZm9yICIgPDwgcGlkcy5zaXplKCkgPDwgIiBwaWRzIHRvIGJlIHJlYXBlZCB0b29rICIgPDwgdCA8PCAiIHdpdGggIgogICAgICAgICAgICAgICA8PCBhbGl2ZV9waWRzLnNp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X2xpYnM6IFsKLSAgICAgICAgImxpYmJpbmRlciIsCi0gICAgICAgICJsaWJjaHJvbWUiLAotICAgICAgICAibGlidXRpbHMiLAotICAgIF0sCi19Ci0KLS8vIGxpYmJpbmRlcndyYXBwZXIgc2hhcmVkIGxpYnJhcnkKLS8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci1jY19saWJyYXJ5X3NoYXJlZCB7Ci0gICAgbmFtZTogImxpYmJpbmRlcndyYXBwZXIiLAotICAgIGRlZmF1bHRzOiBbImxpYmJpbmRlcndyYXBwZXJfZGVmYXVsdHMiXSwKLSAgICB2ZW5kb3JfYXZhaWxhYmxlOiB0cnVlLAotCi0gICAgc3JjczogWwotICAgICAgICAiYmluZGVyX3dyYXBwZXIuY2MiLAotICAgICAgICAicmVhbF9iaW5kZXJfd3JhcHBlci5jYyIsCi0gICAgXSwKLX0KLQotLy8gbGliYmluZGVyd3JhcHBlcl90ZXN0X3N1cHBvcnQgc3RhdGljIGxpYnJhcnkKLS8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci1jY19saWJyYXJ5X3N0YXRpYyB7Ci0gICAgbmFtZTogImxpYmJpbmRlcndyYXBwZXJfdGVzdF9zdXBwb3J0IiwKLSAgICBkZWZhdWx0czogWyJsaWJiaW5kZXJ3cmFwcGVyX2RlZmF1bHRzIl0sCi0KLSAgICBzdGF0aWNfbGliczogWyJsaWJndGVzdCJdLAotICAgIHNoYXJlZF9saWJzOiBbImxpYmJpbmRlcndyYXBwZXIiXSwKLQotICAgIHNyY3M6IFsKLSAgICAgICAgImJpbmRlcl90ZXN0X2Jhc2UuY2MiLAotICAgICAgICAic3R1Yl9iaW5kZXJfd3JhcHBlci5jYyIsCi0gICAgXSwKLX0KZGlmZiAtLWdpdCBhL2xpYmJpbmRlcndyYXBwZXIvYmluZGVyX3Rlc3RfYmFzZS5jYyBiL2xpYmJpb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2Q5ZSAxMDA2NDQKLS0tIGEvbGliY3V0aWxzL0FuZHJvaWQuYnAKKysrIGIvbGliY3V0aWxzL0FuZHJvaWQuYnAKQEAgLTE2Miw3ICsxNjIsNiBAQAogICAgICAgICAicHJvcGVydGllcy5jcHAiLAogICAgICAgICAicmVjb3JkX3N0cmVhbS5jcHAiLAogICAgICAgICAic3RybGNweS5jIiwKLSAgICAgICAgInRocmVhZHMuY3BwIiwKICAgICBdLAogCiAgICAgdGFyZ2V0OiB7CkBAIC0xNzIsMTEgKzE3MSwxNSBAQAogICAgICAgICAgICAgICAgICJsaWJhc3luY19zYWZlIiwKICAgICAgICAgICAgIF0sCiAgICAgICAgIH0sCisgICAgICAgIGxpbnV4OiB7CisgICAgICAgICAgICBzcmNzOiBbCisgICAgICAgICAgICAgICAgImNhbm5lZF9mc19jb25maWcuY3BwIiwKKyAgICAgICAgICAgICAgICAiZnNfY29uZmlnLmNwcCIsCisgICAgICAgICAgICBdLAorICAgICAgICB9LAogICAgICAgICBub3Rfd2luZG93czogewogICAgICAgICAgICAgc3JjczogbGliY3V0aWxzX25vbndpbmRvd3Nfc291cmNlcyArIFsKICAgICAgICAgICAgICAgICAiYXNobWVtLWhvc3QuY3BwIiwKLSAgICAgICAgICAgICAgICAiY2FubmVkX2ZzX2NvbmZpZy5jcHAiLAotICAgICAgICAgICAgICAgICJmc19jb25maWcuY3BwIiwKICAgICAgICAgICAgICAgICAidHJhY2UtaG9zdC5jcHAiLAogICAgICAgICAgICAgXSwKICAgICAgICAgfSwKQEAgLTIwMiw4ICsyMDUsNiBAQAogICAgICAgICAgICAgc3JjczogbGliY3V0aWxzX25vbndpbmRvd3Nfc291cmNlcyArIFsKICAgICAgICAgICAgICAgICAiYW5kcm9pZF9yZWJvb3QuY3BwIiwKICAgICAgICAgICAgICAgICAiYXNobWVtLWRldi5jcHAiLAotICAgICAgICAgICAgICAgICJjYW5uZWRfZnNfY29uZmlnLmNwcCIsCi0gICAgICAgICAgICAgICAgImZzX2NvbmZpZy5jcHAiLAogICAgICAgICAgICAgICAgICJrbG9nLmNwcCIsCiAgICAgICAgICAgICAgICAgInBhcnRpdGlvbl91dGlscy5jcHAiLAogICAgICAgICAgICAgICAgICJxdGFndWlkLmNwcCIsCkBAIC0yMTksMTEgKzIyMCwxOSBAQAogICAgICAgICAgICAgZXhjbHVkZV9zcmNzOiBbCiAgICAgICAgICAgICAgICAgInF0YWd1aWQuY3BwIiwKICAgICAgICAgICAgIF0sCisgICAgICAgICAgICBoZWFkZXJfYWJpX2NoZWNrZXI6IHsKKyAgICAgICAgICAgICAgICBlbmFibGVkOiB0cnVlLAorICAgICAgICAgICAgICAgIHJlZl9kdW1wX2RpcnM6IFsiYWJpLWR1bXBzIl0sCisgICAgICAgICAgICB9LAogICAgICAgICB9LAogICAgICAgICBwcm9kdWN0OiB7CiAgICAgICAgICAgICBleGNsdWRlX3NyY3M6IFsKICAgICAgICAgICAgICAgICAicXRhZ3VpZC5jcHAiLAogICAgICAgICAgICAgXSwKKyAgICAgICAgICAgIGhlYWRlcl9hYmlfY2hlY2tlcjogeworICAgICAgICAgICAgICAgIGVuYWJsZWQ6IHRydWUsCisgICAgICAgICAgICAgICAgcmVmX2R1bXBfZGlyczogWyJhYmktZHVtcHMiXSwKKyAgICAgICAgICAgIH0sCiAgICAgICAgIH0sCiAgICAgfSwKIApkaWZmIC0tZ2l0IGEvbGliY3V0aWxzL0tlcm5lbExpYmN1dGlsc1Rlc3QueG1sIGIvbGliY3V0aWxzL0tlcm5lbExpYmN1dGlsc1Rlc3QueG1sCmluZGV4IDQwZTRlZjQuLjk3NTBjYmYgMTAwNjQ0Ci0tLSBhL2xpYmN1dGlscy9LZXJuZWxMaWJjdXRpbHNUZXN0LnhtbAorKysgYi9saWJjdXRpbHMvS2VybmVsTGliY3V0aWxzVGVzdC54bWwKQEAgLTIyLDExICsyMiwxMSBAQAogCiAgICAgPHRhcmdldF9wcmVwYXJlciBjbGFzcz0iY29tLmFuZHJvaWQudHJhZGV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iX1pUSUEwX2kiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbmF0aXZlX2hhbmRsZS5oIgorICB9CisgXSwKKyAiYnVpbHRpbl90eXBlcyIgOgorIFsKKyAgeworICAgImFsaWdubWVudCIgOiAxLAorICAgImlzX2ludGVncmFsIiA6IHRydWUsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElhIiwKKyAgICJuYW1lIiA6ICJzaWduZWQgY2hhciIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJYSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJYSIsCisgICAic2l6ZSIgOiAxCisgIH0sCisgIHsKKyAgICJhbGlnbm1lbnQiIDogMSwKKyAgICJpc19pbnRlZ3JhbCIgOiB0cnVlLAorICAgImlzX3Vuc2lnbmVkIiA6IHRydWUsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVEliIiwKKyAgICJuYW1lIiA6ICJib29sIiwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEliIiwKKyAgICJzZWxmX3R5cGUiIDogIl9aVEliIiwKKyAgICJzaXplIiA6IDEKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiAxLAorICAgImlzX2ludGVncmFsIiA6IHRydWUsCisgICAiaXNfdW5zaWduZWQiIDogdHJ1ZSwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiX1pUSWMiLAorICAgIm5hbWUiIDogImNoYXIiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWMiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSWMiLAorICAgInNpemUiIDogMQorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElmIiwKKyAgICJuYW1lIiA6ICJmbG9hdCIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJZiIsCisgICAic2Vs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AgfSwKKyAgeworICAgIm5hbWUiIDogImFzaG1lbV9waW5fcmVnaW9uIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXNobWVtX3NldF9wcm90X3JlZ2lvbiIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImFzaG1lbV91bnBpbl9yZWdpb24iCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhc2htZW1fdmFsaWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfYXN5bmNfYmVnaW5fYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9hc3luY19lbmRfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9hc3luY19mb3JfdHJhY2tfYmVnaW5fYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9hc3luY19mb3JfdHJhY2tfZW5kX2JvZHkiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfYmVnaW5fYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9lbmRfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9nZXRfZW5hYmxlZF90YWdzIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2luaXQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfaW5zdGFudF9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2luc3RhbnRfZm9yX3RyYWNrX2JvZHkiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfaW50NjRfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9pbnRfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9zZXRfdHJhY2luZ19lbmFibGVkIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX3NldHVwIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX3VwZGF0ZV90YWdzIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY2FubmVkX2ZzX2NvbmZpZyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImNvbmZpZ19ib29sIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX2ZpbmQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJjb25maWdfZnJlZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImNvbmZpZ19sb2FkIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX2xvYWRfZmlsZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImNvbmZpZ19ub2RlIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX3NldCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImNvbmZpZ19zdHIiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJmc19jb25maWciCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJmc19ta2RpcnMiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJmc19wcmVwYXJlX2RpciIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX3ByZXBhcmVfZGlyX3N0cmljdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX3ByZXBhcmVfZmlsZV9zdHJpY3QiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJmc19yZWFkX2F0b21pY19pbnQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJmc193cml0ZV9hdG9taWNfaW50IgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcENyZWF0ZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImhhc2htYXBGb3JFYWNoIgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcEZyZWUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwR2V0IgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcEhhc2giCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwTG9jayIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImhhc2htYXBQdXQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwUmVtb3ZlIgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcFVubG9jayIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImtsb2dfc2V0X2xldmVsIgorICB9LAorICB7CisgICAibmFtZSIgOiAia2xvZ193cml0ZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImtsb2dfd3JpdGV2IgorICB9LAorICB7CisgICAibmFtZSIgOiAibG9hZF9jYW5uZWRfZnNfY29uZmlnIgorICB9LAorICB7CisgICAibmFtZSIgOiAibG9hZF9maWxlIgorICB9LAorICB7CisgICAibmFtZSIgOiAibXVsdGl1c2VyX2NvbnZlcnRfc2RrX3NhbmRib3hfdG9fYXBwX3VpZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogIm11bHRpdXNlcl9nZXRfYXBwX2lkIgorICB9LAorICB7CisgICAibmFtZSIgOiAibXVsdGl1c2VyX2dldF9jYWNoZV9naWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X2V4dF9jYWNoZV9naWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X2V4dF9naWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X3Nka19zYW5kYm94X3VpZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogIm11bHRpdXNlcl9nZXRfc2hhcmVkX2FwcF9naWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X3NoYXJlZF9naWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X3VpZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogIm11bHRpdXNlcl9nZXRfdXNlcl9pZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogIm5hdGl2ZV9oYW5kbGVfY2xvbmUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJuYXRpdmVfaGFuZGxlX2Nsb3NlIgorICB9LAorICB7CisgICAibmFtZSIgOiAibmF0aXZlX2hhbmRsZV9jbG9zZV93aXRoX3RhZyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogIm5hdGl2ZV9oYW5kbGVfY3JlYXRlIgorICB9LAorICB7CisgICAibmFtZSIgOiAibmF0aXZlX2hhbmRsZV9kZWxldGUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJuYXRpdmVfaGFuZGxlX2luaXQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJuYXRpdmVfaGFuZGxlX3NldF9mZHNhbl90YWciCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJuYXRpdmVfaGFuZGxlX3Vuc2V0X2Zkc2FuX3RhZyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInBhcnRpdGlvbl93aXBlZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInByb3BlcnR5X2dldCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInByb3BlcnR5X2dldF9ib29sIgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfZ2V0X2ludDMyIgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfZ2V0X2ludDY0IgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfbGlzdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInByb3BlcnR5X3NldCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInJlY29yZF9zdHJlYW1fZnJlZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInJlY29yZF9zdHJlYW1fZ2V0X25leHQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJyZWNvcmRfc3RyZWFtX25ldyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9jbG9zZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9nZXRfbG9jYWxfcG9ydCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9pbmFkZHJfYW55X3NlcnZlciIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9sb2NhbF9jbGllbnQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfbG9jYWxfY2xpZW50X2Nvbm5lY3QiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfbG9jYWxfc2VydmVyIgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X2xvY2FsX3NlcnZlcl9iaW5kIgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X25ldHdvcmtfY2xpZW50IgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X25ldHdvcmtfY2xpZW50X3RpbWVvdXQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfc2VuZF9idWZmZXJzIgorICB9LAorICB7CisgICAibmFtZSIgOiAic3RyX3Bhcm1zX2FkZF9mbG9hdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInN0cl9wYXJtc19hZGRfaW50IgorICB9LAorICB7CisgICAibmFtZSIgOiAic3RyX3Bhcm1zX2FkZF9zdHIiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzdHJfcGFybXNfY3JlYXRlIgorICB9LAorICB7CisgICAibmFtZSIgOiAic3RyX3Bhcm1zX2NyZWF0ZV9zdHIiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzdHJfcGFybXNfZGVsIgorICB9LAorICB7CisgICAibmFtZSIgOiAic3RyX3Bhcm1zX2Rlc3Ryb3kiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzdHJfcGFybXNfZHVtcCIKKyAgfS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bmRlcmx5aW5nX3R5cGUiIDogIl9aVElqIgorICB9CisgXSwKKyAiZnVuY3Rpb25fdHlwZXMiIDoKKyBbCisgIHsKKyAgICJhbGlnbm1lbnQiIDogNCwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiX1pUSUZiUHZTX0UiLAorICAgIm5hbWUiIDogImJvb2wgKHZvaWQgKiwgdm9pZCAqKSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElGYlB2U19FIiwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWIiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSUZiUHZTX0UiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElGYlB2U19TX0UiLAorICAgIm5hbWUiIDogImJvb2wgKHZvaWQgKiwgdm9pZCAqLCB2b2lkICopIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0KKyAgIF0sCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJRmJQdlNfU19FIiwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWIiLAorICAgInNlbGZfdHlwZSI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worICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQMTJJb1NjaGVkQ2xhc3MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9pb3NjaGVkX3BvbGljeS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYW5kcm9pZF9yZWJvb3QiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhbmRyb2lkX3JlYm9vdCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2FuZHJvaWRfcmVib290LmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhbmRyb2lkX3NldF9pb3ByaW8iLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhbmRyb2lkX3NldF9pb3ByaW8iLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJMTJJb1NjaGVkQ2xhc3MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2lvc2NoZWRfcG9saWN5LmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhc2htZW1fY3JlYXRlX3JlZ2lvbiIsCisgICAibGlua2VyX3NldF9rZXkiIDogImFzaG1lbV9jcmVhdGVfcmVnaW9uIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJbSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9hc2htZW0uaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImFzaG1lbV9nZXRfc2l6ZV9yZWdpb24iLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhc2htZW1fZ2V0X3NpemVfcmVnaW9uIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9hc2htZW0uaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImFzaG1lbV9waW5fcmVnaW9uIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXNobWVtX3Bpbl9yZWdpb24iLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJbSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSW0iCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvYXNobWVtLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhc2htZW1fc2V0X3Byb3RfcmVnaW9uIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXNobWVtX3NldF9wcm90X3JlZ2lvbiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2FzaG1lbS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXNobWVtX3VucGluX3JlZ2lvbiIsCisgICAibGlua2VyX3NldF9rZXkiIDogImFzaG1lbV91bnBpbl9yZWdpb24iLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAge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IiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2JlZ2luX2JvZHkiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhdHJhY2VfYmVnaW5fYm9keSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2VuZF9ib2R5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2VuZF9ib2R5IiwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvdHJhY2UuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImF0cmFjZV9nZXRfZW5hYmxlZF90YWdzIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2dldF9lbmFibGVkX3RhZ3MiLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJbSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2luaXQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhdHJhY2VfaW5pdCIsCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3RyYWNlLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY2VfaW5zdGFudF9ib2R5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2luc3RhbnRfYm9keSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2luc3RhbnRfZm9yX3RyYWNrX2JvZHkiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhdHJhY2VfaW5zdGFudF9mb3JfdHJhY2tfYm9keSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2ludDY0X2JvZHkiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhdHJhY2VfaW50NjRfYm9keSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWwiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvdHJhY2UuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImF0cmFjZV9pbnRfYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9pbnRfYm9keSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvdHJhY2UuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImF0cmFjZV9zZXRfdHJhY2luZ19lbmFibGVkIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX3NldF90cmFjaW5nX2VuYWJsZWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEliIgorICAgIH0KKyAgIF0sCisgICAic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bm9kZSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19mcmVlIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX2ZyZWUiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiY29uZmlnX2xvYWQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfbG9hZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA1Y25vZGUiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19sb2FkX2ZpbGUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfbG9hZF9maWxlIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19ub2RlIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX25vZGUiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVA1Y25vZGUiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvY29uZmlnX3V0aWxzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJjb25maWdfc2V0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX3NldCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA1Y25vZGUiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvY29uZmlnX3V0aWxzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJjb25maWdfc3RyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX3N0ciIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA1Y25vZGUiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVBLYyIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImZzX2NvbmZpZyIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX2NvbmZpZyIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQbSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL3ByaXZhdGUvZnNfY29uZmlnLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJmc19ta2RpcnMiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJmc19ta2RpcnMiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2ZzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJmc19wcmVwYXJlX2RpciIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX3ByZXBhcmVfZGlyIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2ZzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvb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gIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJmc19yZWFkX2F0b21pY19pbnQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJmc19yZWFkX2F0b21pY19pbnQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9mcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiZnNfd3JpdGVfYXRvbWljX2ludCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX3dyaXRlX2F0b21pY19pbnQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2ZzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwQ3JlYXRlIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcENyZWF0ZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSW0iCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQRmlQdkUiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQRmJQdlNfRSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUDdIYXNobWFwIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBGb3JFYWNoIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcEZvckVhY2giLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQN0hhc2htYXAiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQRmJQdlNfU19FIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiaGFzaG1hcEZyZWUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwRnJlZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwR2V0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcEdldCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwSGFzaCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImhhc2htYXBIYXNoIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEltIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBMb2NrIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcExvY2siLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQN0hhc2htYXAiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiaGFzaG1hcFB1dCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImhhc2htYXBQdXQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQN0hhc2htYXAiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwUmVtb3ZlIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcFJlbW92ZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwVW5sb2NrIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcFVubG9jayIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJrbG9nX3NldF9sZXZlbCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImtsb2dfc2V0X2xldmVsIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9rbG9nLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJrbG9nX3dyaXRlIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAia2xvZ193cml0ZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMva2xvZy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAia2xvZ193cml0ZXYiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJrbG9nX3dyaXRldiIsCisgICAicGFyYW1ldGVycyIgOgorICAgW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RfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWoiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbXVsdGl1c2VyLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X2V4dF9jYWNoZV9naWQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJtdWx0aXVzZXJfZ2V0X2V4dF9jYWNoZV9naWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9tdWx0aXVzZXIuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogIm11bHRpdXNlcl9nZXRfZXh0X2dpZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogIm11bHRpdXNlcl9nZXRfZXh0X2dpZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElqIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL211bHRpdXNlci5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAibXVsdGl1c2VyX2dldF9zZGtfc2FuZGJveF91aWQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJtdWx0aXVzZXJfZ2V0X3Nka19zYW5kYm94X3VpZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElqIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL211bHRpdXNlci5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAibXVsdGl1c2VyX2dldF9zaGFyZWRfYXBwX2dpZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogIm11bHRpdXNlcl9nZXRfc2hhcmVkX2FwcF9naWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElqIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL211bHRpdXNlci5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAibXVsdGl1c2VyX2dldF9zaGFyZWRfZ2lkIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAibXVsdGl1c2VyX2dldF9zaGFyZWRfZ2lkIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoi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3V0aWxzL2luY2x1ZGUvY3V0aWxzL25hdGl2ZV9oYW5kbGUuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInBhcnRpdGlvbl93aXBlZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInBhcnRpdGlvbl93aXBlZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9wYXJ0aXRpb25fdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInByb3BlcnR5X2dldCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInByb3BlcnR5X2dldCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3Byb3BlcnRpZXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInByb3BlcnR5X2dldF9ib29sIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAicHJvcGVydHlfZ2V0X2Jvb2wiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElhIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElhIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3Byb3BlcnRpZXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInByb3BlcnR5X2dldF9pbnQzMiIsCisgICAibGlua2VyX3NldF9rZXkiIDogInByb3BlcnR5X2dldF9pbnQzMiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvcHJvcGVydGllcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAicHJvcGVydHlfZ2V0X2ludDY0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAicHJvcGVydHlfZ2V0X2ludDY0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJbCIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJbCIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9wcm9wZXJ0aWVzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGl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ZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvcmVjb3JkX3N0cmVhbS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAicmVjb3JkX3N0cmVhbV9nZXRfbmV4dCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInJlY29yZF9zdHJlYW1fZ2V0X25leHQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQMTJSZWNvcmRTdHJlYW0iCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQbSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9yZWNvcmRfc3RyZWFtLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJyZWNvcmRfc3RyZWFtX25ldyIsCisgICAibGlua2VyX3NldF9rZXkiIDogInJlY29yZF9zdHJlYW1fbmV3IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSW0iCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVAxMlJlY29yZFN0cmVhbSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9yZWNvcmRfc3RyZWFtLmgiCisgIH0sC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yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic29ja2V0X2xvY2FsX2NsaWVudCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9sb2NhbF9jbGllbnQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbG9jYWxfY2xpZW50X2Nvbm5lY3QiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzb2NrZXRfbG9jYWxfY2xpZW50X2Nvbm5lY3QiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic29ja2V0X2xvY2FsX3NlcnZlciIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9sb2NhbF9zZXJ2ZXIiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbG9jYWxfc2VydmVyX2JpbmQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzb2NrZXRfbG9jYWxfc2VydmVyX2JpbmQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbmV0d29ya19jbGllbnQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzb2NrZXRfbmV0d29ya19jbGllbnQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbmV0d29ya19jbGllbnRfdGltZW91dCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9uZXR3b3JrX2NsaWVudF90aW1lb3V0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic29ja2V0X3NlbmRfYnVmZmVycyIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9zZW5kX2J1ZmZlcnMiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEsyMmN1dGlsc19zb2NrZXRfYnVmZmVyX3QiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEltIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElsIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19hZGRfZmxvYXQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfYWRkX2Zsb2F0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElmIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3N0cl9wYXJtcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic3RyX3Bhcm1zX2FkZF9pbnQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfYWRkX2ludCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19hZGRfc3RyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic3RyX3Bhcm1zX2FkZF9zdHIiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQOXN0cl9wYXJtcyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19jcmVhdGUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfY3JlYXRlIiwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1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gImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfZ2V0X2ludCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfZ2V0X3N0ciIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19nZXRfc3RyIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfaGFzX2tleSIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19oYXNfa2V5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfdG9fc3RyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic3RyX3Bhcm1zX3RvX3N0ciIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQYyIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInVldmVudF9rZXJuZWxfbXVsdGljYXN0X3JlY3YiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJ1ZXZlbnRfa2VybmVsX211bHRpY2FzdF9yZWN2IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJbSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJbCIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy91ZXZlbnQuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInVldmVudF9rZXJuZWxfbXVsdGljYXN0X3VpZF9yZWN2IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAidWV2ZW50X2tlcm5lbF9tdWx0aWNhc3RfdWlkX3JlY3YiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEltIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWwiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvdWV2ZW50LmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJ1ZXZlbnRfa2VybmVsX3JlY3YiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJ1ZXZlbnRfa2VybmVsX3JlY3YiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEltIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90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SIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQS3YiLAorICAgIm5hbWUiIDogImNvbnN0IHZvaWQgKiIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJS3YiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVBLdiIsCisgICAic2l6ZSIgOiA4LAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQUHYiLAorICAgIm5hbWUiIDogInZvaWQgKioiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IiwKKyAgICJzZWxmX3R5cGUiIDogIl9aVElQUHYiLAorICAgInNpemUiIDogOCwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3JlY29yZF9zdHJlYW0uaCIKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA4LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJUGMiLAorICAgIm5hbWUiIDogImNoYXIgKiIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJYyIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJUGMiLAorICAgInNpemUiIDogOCwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQZiIsCisgICAibmFtZSIgOiAiZmxvYXQgKiIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJZiIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJUGYiLAorICAgInNpemUiIDogOCwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3N0cl9wYXJtcy5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQaSIsCisgICAibmFtZSIgOiAiaW50ICoiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVBpIiwKKyAgICJzaXplIiA6IDgsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9pb3NjaGVkX3BvbGljeS5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQaiIsCisgICAibmFtZSIgOiAidW5zaWduZWQgaW50ICoiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVBqIiwKKyAgICJzaXplIiA6IDgsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9taXNjLmgiCisgIH0sCisgIHsKKyAgICJhbGlnbm1lbnQiIDogOCwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiX1pUSVBtIiwKKyAgICJuYW1lIiA6ICJ1bnNpZ25lZCBsb25nICoiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSW0iLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVBtIiwKKyAgICJzaXplIiA6IDgsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2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t2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfQorIF0sCisgInJlY29yZF90eXBlcyIgOgorIFsKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImZpZWxkcyIgOgorICAgWworICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogInZlcnNpb24iLAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogIm51bUZkcyIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogMzIsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAibnVtSW50cyIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogNjQsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAiZGF0YSIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogOTYsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElBMF9pIgorICAgIH0KKyAgIF0sCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVEkxM25hdGl2ZV9oYW5kbGUiLAorICAgIm5hbWUiIDogIm5hdGl2ZV9oYW5kbGUiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSTEzbmF0aXZlX2hhbmRsZSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJMTNuYXRpdmVfaGFuZGxlIiwKKyAgICJzaXplIiA6IDEyLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbmF0aXZlX2hhbmRsZS5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDgsCisgICAiZmllbGRzIiA6CisgICBbCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAiZGF0YSIsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS3YiCisgICAgfSwKKyAgICB7CisgICAgICJmaWVsZF9uYW1lIiA6ICJsZW5ndGgiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDY0LAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJbSIKKyAgICB9CisgICBdLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJMjJjdXRpbHNfc29ja2V0X2J1ZmZlcl90IiwKKyAgICJuYW1lIiA6ICJjdXRpbHNfc29ja2V0X2J1ZmZlcl90IiwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEkyMmN1dGlsc19zb2NrZXRfYnVmZmVyX3QiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSTIyY3V0aWxzX3NvY2tldF9idWZmZXJfdCIsCisgICAic2l6ZSIgOiAxNiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA4LAorICAgImZpZWxkcyIgOgorICAgWworICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogIm5leHQiLAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogImZpcnN0X2NoaWxkIiwKKyAgICAgImZpZWxkX29mZnNldCIgOiA2NCwKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA1Y25vZGUiCisgICAgfSwKKyAgICB7CisgICAgICJmaWVsZF9uYW1lIiA6ICJsYXN0X2NoaWxkIiwKKyAgICAgImZpZWxkX29mZnNldCIgOiAxMjgsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAibmFtZSIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogMTkyLAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAidmFsdWUiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDI1NiwKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJNWNub2RlIiwKKyAgICJuYW1lIiA6ICJjbm9kZSIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJNWNub2RlIiwKKyAgICJzZWxmX3R5cGUiIDogIl9aVEk1Y25vZGUiLAorICAgInNpemUiIDogNDAsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfQorIF0sCisgInJ2YWx1ZV9yZWZlcmVuY2VfdHlwZXMiIDogW10KK30KZGlmZiAtLWdpdCBhL2xpYmN1dGlscy9hYmktZHVtcHMvYXJtX2FybTY0L3NvdXJjZS1iYXNlZC9saWJjdXRpbHMuc28ubHNkdW1wIGIvbGliY3V0aWxzL2FiaS1kdW1wcy9hcm1fYXJtNjQvc291cmNlLWJhc2VkL2xpYmN1dGlscy5zby5sc2R1bXAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZjYxMmZiOQotLS0gL2Rldi9udWxsCisrKyBiL2xpYmN1dGlscy9hYmktZHVtcHMvYXJtX2FybTY0L3NvdXJjZS1iYXNlZC9saWJjdXRpbHMuc28ubHNkdW1wCkBAIC0wLDAgKzEsMjcwMCBAQAoreworICJhcnJheV90eXBlcyIgOgorIFsKKyAgeworICAgImFsaWdubWVudCIgOiA0LAor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A6IDEKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJZiIsCisgICAibmFtZSIgOiAiZmxvYXQiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWYiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSWYiLAorICAgInNpemUiIDogNAorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAiaXNfaW50ZWdyYWwiIDogdHJ1ZSwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiX1pUSWkiLAorICAgIm5hbWUiIDogImludCIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJaSIsCisgICAic2l6ZSIgOiA0CisgIH0sCisgIHsKKyAgICJhbGlnbm1lbnQiIDogNCwKKyAgICJpc19pbnRlZ3JhbCIgOiB0cnVlLAorICAgImlzX3Vuc2lnbmVkIiA6IHRydWUsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElqIiwKKyAgICJuYW1lIiA6ICJ1bnNpZ25lZCBpbnQiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSWoiLAorICAgInNpemUiIDogNAorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDIsCisgICAiaXNfaW50ZWdyYWwiIDogdHJ1ZSwKKyAgICJpc191bnNpZ25lZCIgOiB0cnVlLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJdCIsCisgICAibmFtZSIgOiAidW5zaWduZWQgc2hvcnQiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSXQiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSXQiLAorICAgInNpemUiIDogMgorICB9LAorICB7CisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVEl2IiwKKyAgICJuYW1lIiA6ICJ2b2lkI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c0ljRUVFRVJOU18xM2Jhc2ljX29zdHJlYW1JY1RfRUVTNl9QS2MiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhbmRyb2lkX2dldF9jb250cm9sX2ZpbGUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhbmRyb2lkX2dldF9jb250cm9sX3NvY2tldCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImFuZHJvaWRfZ2V0X2lvcHJpbyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImFuZHJvaWRfcmVib290IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYW5kcm9pZF9zZXRfaW9wcmlvIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXNobWVtX2NyZWF0ZV9yZWdpb24iCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhc2htZW1fZ2V0X3NpemVfcmVnaW9uIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXNobWVtX3Bpbl9yZWdpb24iCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhc2htZW1fc2V0X3Byb3RfcmVnaW9uIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXNobWVtX3VucGluX3JlZ2lvbiIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImFzaG1lbV92YWxpZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9hc3luY19iZWdpbl9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2FzeW5jX2VuZF9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2FzeW5jX2Zvcl90cmFja19iZWdpbl9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2FzeW5jX2Zvcl90cmFja19lbmRfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9iZWdpbl9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2VuZF9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2dldF9lbmFibGVkX3RhZ3MiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfaW5pdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9pbnN0YW50X2JvZHkiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfaW5zdGFudF9mb3JfdHJhY2tfYm9keSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9pbnQ2NF9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2ludF9ib2R5IgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX3NldF90cmFjaW5nX2VuYWJsZWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2Vfc2V0dXAiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJhdHJhY2VfdXBkYXRlX3RhZ3MiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJjYW5uZWRfZnNfY29uZmlnIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX2Jvb2wiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJjb25maWdfZmluZCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImNvbmZpZ19mcmVlIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX2xvYWQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJjb25maWdfbG9hZF9maWxlIgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX25vZGUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJjb25maWdfc2V0IgorICB9LAorICB7CisgICAibmFtZSIgOiAiY29uZmlnX3N0ciIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX2NvbmZpZyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX21rZGlycyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX3ByZXBhcmVfZGlyIgorICB9LAorICB7CisgICAibmFtZSIgOiAiZnNfcHJlcGFyZV9kaXJfc3RyaWN0IgorICB9LAorICB7CisgICAibmFtZSIgOiAiZnNfcHJlcGFyZV9maWxlX3N0cmljdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX3JlYWRfYXRvbWljX2ludCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImZzX3dyaXRlX2F0b21pY19pbnQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwQ3JlYXRlIgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcEZvckVhY2giCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwRnJlZSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImhhc2htYXBHZXQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwSGFzaCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImhhc2htYXBMb2NrIgorICB9LAorICB7CisgICAibmFtZSIgOiAiaGFzaG1hcFB1dCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImhhc2htYXBSZW1vdmUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJoYXNobWFwVW5sb2NrIgorICB9LAorICB7CisgICAibmFtZSIgOiAia2xvZ19zZXRfbGV2ZWwiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJrbG9nX3dyaXRlIgorICB9LAorICB7CisgICAibmFtZSIgOiAia2xvZ193cml0ZXYiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJsb2FkX2Nhbm5lZF9mc19jb25maWciCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJsb2FkX2ZpbGUiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJtdWx0aXVzZXJfY29udmVydF9zZGtfc2FuZGJveF90b19hcHBfdWlkIgorICB9LAorICB7CisgICAibmFtZSIgOiAibXVsdGl1c2VyX2dldF9hcHBfaW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Gl0aW9uX3dpcGVkIgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfZ2V0IgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfZ2V0X2Jvb2wiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJwcm9wZXJ0eV9nZXRfaW50MzIiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJwcm9wZXJ0eV9nZXRfaW50NjQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJwcm9wZXJ0eV9saXN0IgorICB9LAorICB7CisgICAibmFtZSIgOiAicHJvcGVydHlfc2V0IgorICB9LAorICB7CisgICAibmFtZSIgOiAicmVjb3JkX3N0cmVhbV9mcmVlIgorICB9LAorICB7CisgICAibmFtZSIgOiAicmVjb3JkX3N0cmVhbV9nZXRfbmV4dCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInJlY29yZF9zdHJlYW1fbmV3IgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X2Nsb3NlIgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X2dldF9sb2NhbF9wb3J0IgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X2luYWRkcl9hbnlfc2VydmVyIgorICB9LAorICB7CisgICAibmFtZSIgOiAic29ja2V0X2xvY2FsX2NsaWVudCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9sb2NhbF9jbGllbnRfY29ubmVjdCIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogInNvY2tldF9sb2NhbF9zZXJ2ZXIiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfbG9jYWxfc2VydmVyX2JpbmQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfbmV0d29ya19jbGllbnQiCisgIH0sCisgIHsKKyAgICJuYW1lIiA6ICJzb2NrZXRfbmV0d29ya19jbGllbnRfdGltZW91dCIKKyAgfSwKKyAgeworICAgIm5hbWUi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RpbmciIDogIndlYWsiLAorICAgIm5hbWUiIDogIl9aVENOU3QzX18xMTRiYXNpY19pZnN0cmVhbUljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRTBfTlNfMTNiYXNpY19pc3RyZWFtSWNTMl9FRSIKKyAgfSwKKyAgeworICAgImJpbmRpbmciIDogIndlYWsiLAorICAgIm5hbWUiIDogIl9aVFROU3QzX18xMTRiYXNpY19pZnN0cmVhbUljTlNfMTFjaGFyX3RyYWl0c0ljRUVFRSIKKyAgfSwKKyAgeworICAgImJpbmRpbmciIDogIndlYWsiLAorICAgIm5hbWUiIDogIl9aVFZOU3QzX18xMTNiYXNpY19maWxlYnVmSWNOU18xMWNoYXJfdHJhaXRzSWNFRUVFIgorICB9LAorICB7CisgICAiYmluZGluZyIgOiAid2VhayIsCisgICAibmFtZSIgOiAiX1pUVk5TdDNfXzExNGJhc2ljX2lmc3RyZWFtSWNOU18xMWNoYXJfdHJhaXRzSWNFRUVFIgorICB9LAorICB7CisgICAibmFtZSIgOiAiYXRyYWNlX2VuYWJsZWRfdGFncyIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9pc19yZWFkeSIKKyAgfSwKKyAgeworICAgIm5hbWUiIDogImF0cmFjZV9tYXJrZXJfZmQiCisgIH0KKyBdLAorICJlbnVtX3R5cGVzIiA6CisgWworICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAiZW51bV9maWVsZHMiIDoKKyAgIFsKKyAgICB7CisgICAgICJlbnVtX2ZpZWxkX3ZhbHVlIiA6IDAsCisgICAgICJuYW1lIiA6ICJJb1NjaGVkQ2xhc3NfTk9ORSIKKyAgICB9LAorICAgIHsKKyAgICAgImVudW1fZmllbGRfdmFsdWUiIDogMSwKKyAgICAgIm5hbWUiIDogIklvU2NoZWRDbGFzc19SVCIKKyAgICB9LAorICAgIHsKKyAgICAgImVudW1fZmllbGRfdmFsdWUiIDogMiwKKyAgICAgIm5hbWUiIDogIklvU2NoZWRDbGFzc19CRSIKKyAgICB9LAorICAgIHsKKyAgICAgImVudW1fZmllbGRfdmFsdWUiIDogMywKKyAgICAgIm5hbWUiIDogIklvU2NoZWRDbGFzc19JRExFIgorICAgIH0KKyAgIF0sCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVEkxMklvU2NoZWRDbGFzcyIsCisgICAibmFtZSIgOiAiSW9TY2hlZENsYXNzIiwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEkxMklvU2NoZWRDbGFzcyIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJMTJJb1NjaGVkQ2xhc3MiLAorICAgInNpemUiIDogNCwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2lvc2NoZWRfcG9saWN5LmgiLAorICAgInVuZGVybHlpbmdfdHlwZSIgOiAiX1pUSWoiCisgIH0KKyBdLAorICJmdW5jdGlvbl90eXBlcyIgOgorIFsKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJRmJQdlNfRSIsCisgICAibmFtZSIgOiAiYm9vbCAodm9pZCAqLCB2b2lkICopIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9CisgICBdLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSUZiUHZTX0UiLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJYiIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJRmJQdlNfRSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJhbGlnbm1lbnQiIDogNCwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiX1pUSUZiUHZTX1NfRSIsCisgICAibmFtZSIgOiAiYm9vbCAodm9pZCAqLCB2b2lkICosIHZvaWQgKikiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElGYlB2U19TX0UiLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJYiIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJRmJQdlNfU19FIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJRmlQdkUiLAorICAgIm5hbWUiIDogImludCAodm9pZCAqKSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0KKyAgIF0sCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJRmlQdkUiLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJRmlQdkUiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElGdlBLY1MwX1B2RSIs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bGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2FzaG1lbS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXNobWVtX2dldF9zaXplX3JlZ2lvbiIsCisgICAibGlua2VyX3NldF9rZXkiIDogImFzaG1lbV9nZXRfc2l6ZV9yZWdpb24iLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2FzaG1lbS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXNobWVtX3Bpbl9yZWdpb24iLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhc2htZW1fcGluX3JlZ2lvbiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9hc2htZW0uaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImFzaG1lbV9zZXRfcHJvdF9yZWdpb24iLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJhc2htZW1fc2V0X3Byb3RfcmVnaW9uIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvYXNobWVtLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhc2htZW1fdW5waW5fcmVnaW9uIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXNobWVtX3VucGluX3JlZ2lvbiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9hc2htZW0uaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImFzaG1lbV92YWxpZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImFzaG1lbV92YWxpZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvYXNobWVtLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY2VfYXN5bmNfYmVnaW5fYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9hc3luY19iZWdpbl9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2FzeW5jX2VuZF9ib2R5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2FzeW5jX2VuZF9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2FzeW5jX2Zvcl90cmFja19iZWdpbl9ib2R5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2FzeW5jX2Zvcl90cmFja19iZWdpbl9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2FzeW5jX2Zvcl90cmFja19lbmRfYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9hc3luY19mb3JfdHJhY2tfZW5kX2JvZHkiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3RyYWNlLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY2VfYmVnaW5fYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9iZWdpbl9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3RyYWNlLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY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yAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY2VfaW5zdGFudF9mb3JfdHJhY2tfYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9pbnN0YW50X2Zvcl90cmFja19ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3RyYWNlLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJhdHJhY2VfaW50NjRfYm9keSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9pbnQ2NF9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJeCIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy90cmFjZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiYXRyYWNlX2ludF9ib2R5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiYXRyYWNlX2ludF9ib2R5IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZ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2ZzX2NvbmZpZyIsCisgICAibGlua2VyX3NldF9rZXkiIDogImNhbm5lZF9mc19jb25maWciLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9wcml2YXRlL2Nhbm5lZF9mc19jb25maWcuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19ib29sIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX2Jvb2wiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19maW5kIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiY29uZmlnX2ZpbmQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQNWNub2RlIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiY29uZmlnX2ZyZWUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfZnJlZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA1Y25vZGUiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSXYiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvY29uZmlnX3V0aWxzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJjb25maWdfbG9hZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImNvbmZpZ19sb2FkIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiY29uZmlnX2xvYWRfZmlsZSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImNvbmZpZ19sb2FkX2ZpbGUiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiY29uZmlnX25vZGUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfbm9kZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUDVjbm9kZSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19zZXQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfc2V0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImNvbmZpZ19zdHIiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJjb25maWdfc3RyIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUEtjIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiZnNfY29uZmlnIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiZnNfY29uZmlnIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB5IgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvcHJpdmF0ZS9mc19jb25maWcuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImZzX21rZGlycyIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX21rZGlycyIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSXQiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvZnMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImZzX3ByZXBhcmVfZGlyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiZnNfcHJlcGFyZV9kaXIiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEl0IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvZnMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImZzX3ByZXBhcmVfZGlyX3N0cmljdCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX3ByZXBhcmVfZGlyX3N0cmljdCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSXQiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9mcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiZnNfcHJlcGFyZV9maWxlX3N0cmljdCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX3ByZXBhcmVfZmlsZV9zdHJpY3QiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEl0IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvZnMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImZzX3JlYWRfYXRvbWljX2ludCIsCisgICAibGlua2VyX3NldF9rZXkiIDogImZzX3JlYWRfYXRvbWljX2ludCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2ZzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJmc193cml0ZV9hdG9taWNfaW50IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiZnNfd3JpdGVfYXRvbWljX2ludCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvZnMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBDcmVhdGUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwQ3JlYXRlIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBGaVB2RSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBGYlB2U19FIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQN0hhc2htYXAiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiaGFzaG1hcEZvckVhY2giLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwRm9yRWFjaCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBGYlB2U19TX0UiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwRnJlZSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImhhc2htYXBGcmVlIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDdIYXNobWFwIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBHZXQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwR2V0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDdIYXNobWFwIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVB2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBIYXNoIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcEhhc2giLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAiaGFzaG1hcExvY2siLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwTG9jayIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9oYXNobWFwLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJoYXNobWFwUHV0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAiaGFzaG1hcFB1dCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVB2IgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVB2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImhhc2htYXBSZW1vdmUiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJoYXNobWFwUmVtb3ZlIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZX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IiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9rbG9nLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJrbG9nX3dyaXRldiIsCisgICAibGlua2VyX3NldF9rZXkiIDogImtsb2dfd3JpdGV2IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLNWlvdmVjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9rbG9nLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJsb2FkX2Nhbm5lZF9mc19jb25maWciLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJsb2FkX2Nhbm5lZF9mc19jb25maWciLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9wcml2YXRlL2Nhbm5lZF9mc19jb25maWcuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogImxvYWRfZmlsZSIsCisgICAibGlua2VyX3NldF9rZXkiIDogImxvYWRfZmlsZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9taXNjLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJtdWx0aXVzZXJfY29udmVydF9zZGtfc2FuZGJveF90b19hcHBfdWlkIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAibXVsdGl1c2VyX2NvbnZlcnRfc2RrX3NhbmRib3hfdG9fYXBwX3VpZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWoiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbXVsdGl1c2VyLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X2FwcF9pZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogIm11bHRpdXNlcl9nZXRfYXBwX2lkIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9tdWx0aXVzZXIuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogIm11bHRpdXNlcl9nZXRfY2FjaGVfZ2lkIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAibXVsdGl1c2VyX2dldF9jYWNoZV9naWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9tdWx0aXVzZXIuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogIm11bHRpdXNlcl9nZXRfZXh0X2NhY2hlX2dpZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogIm11bHRpdXNlcl9nZXRfZXh0X2NhY2hlX2dpZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElqIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL211bHRpdXNlci5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAibXVsdGl1c2VyX2dldF9leHRfZ2lkIiwKKyAgICJsaW5rZXJfc2V0X2tleSI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SWoiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbXVsdGl1c2VyLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJtdWx0aXVzZXJfZ2V0X3NoYXJlZF9naWQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJtdWx0aXVzZXJfZ2V0X3NoYXJlZF9naWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9tdWx0aXVzZXIuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogIm11bHRpdXNlcl9nZXRfdWlkIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAibXVsdGl1c2VyX2dldF91aWQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9tdWx0aXVzZXIuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogIm11bHRpdXNlcl9nZXRfdXNlcl9pZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogIm11bHRpdXNlcl9nZXRfdXNlcl9pZCI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fQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvbmF0aXZlX2hhbmRsZS5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAibmF0aXZlX2hhbmRsZV9pbml0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAibmF0aXZlX2hhbmRsZV9pbml0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUDEzbmF0aXZlX2hhbmRsZSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9uYXRpdmVfaGFuZGxlLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJuYXRpdmVfaGFuZGxlX3NldF9mZHNhbl90YWciLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJuYXRpdmVfaGFuZGxlX3NldF9mZHNhbl90YWciLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQSzEzbmF0aXZlX2hhbmRsZSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJdiIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9uYXRpdmVfaGFuZGxlLmgiCisgIH0sCisgIHsKKyAgICJmdW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lcl9zZXRfa2V5IiA6ICJwcm9wZXJ0eV9nZXRfaW50NjQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEl4IgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVEl4IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3Byb3BlcnRpZXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInByb3BlcnR5X2xpc3QiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJwcm9wZXJ0eV9saXN0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEZ2UEtjUzBfUHZFIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvcHJvcGVydGllcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAicHJvcGVydHlfc2V0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAicHJvcGVydHlfc2V0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElp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saW5rZXJfc2V0X2tleSIgOiAicmVjb3JkX3N0cmVhbV9uZXciLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUDEyUmVjb3JkU3RyZWFtIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3JlY29yZF9zdHJlYW0uaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInNvY2tldF9jbG9zZSIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9jbG9zZSIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic29ja2V0X2dldF9sb2NhbF9wb3J0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic29ja2V0X2dldF9sb2NhbF9wb3J0IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfaW5hZGRyX2FueV9zZXJ2ZXIiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzb2NrZXRfaW5hZGRyX2FueV9zZXJ2ZXIiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbG9jYWxfY2xpZW50IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic29ja2V0X2xvY2FsX2NsaWVudCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInNvY2tldF9sb2NhbF9jbGllbnRfY29ubmVjdCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9sb2NhbF9jbGllbnRfY29ubmVjdCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfbG9jYWxfc2VydmVyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic29ja2V0X2xvY2FsX3NlcnZlciIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInNvY2tldF9sb2NhbF9zZXJ2ZXJfYmluZCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9sb2NhbF9zZXJ2ZXJfYmluZCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInNvY2tldF9uZXR3b3JrX2NsaWVudCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInNvY2tldF9uZXR3b3JrX2NsaWVudCIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInNvY2tldF9uZXR3b3JrX2NsaWVudF90aW1lb3V0IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic29ja2V0X25ldHdvcmtfY2xpZW50X3RpbWVvdXQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zb2NrZXRzLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzb2NrZXRfc2VuZF9idWZmZXJzIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic29ja2V0X3NlbmRfYnVmZmVycyIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQSzIyY3V0aWxzX3NvY2tldF9idWZmZXJfdCIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc29ja2V0cy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic3RyX3Bhcm1zX2FkZF9mbG9hdCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19hZGRfZmxvYXQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQOXN0cl9wYXJtcyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfYWRkX2ludCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19hZGRfaW50IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3N0cl9wYXJtcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic3RyX3Bhcm1zX2FkZF9zdHIiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfYWRkX3N0ciIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3N0cl9wYXJtcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAic3RyX3Bhcm1zX2NyZWF0ZSIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19jcmVhdGUiLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfY3JlYXRlX3N0ciIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19jcmVhdGVfc3RyIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElQOXN0cl9wYXJtcyIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19kZWwiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfZGVsIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfQorICAgX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X1pUSVA5c3RyX3Bhcm1zIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGYiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvc3RyX3Bhcm1zLmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJzdHJfcGFybXNfZ2V0X2ludCIsCisgICAibGlua2VyX3NldF9rZXkiIDogInN0cl9wYXJtc19nZXRfaW50IiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQS2MiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19nZXRfc3RyIiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic3RyX3Bhcm1zX2dldF9zdHIiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQOXN0cl9wYXJtcyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBjIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc19oYXNfa2V5IiwKKyAgICJsaW5rZXJfc2V0X2tleSIgOiAic3RyX3Bhcm1zX2hhc19rZXkiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQOXN0cl9wYXJtcyIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInN0cl9wYXJtc190b19zdHIiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJzdHJfcGFybXNfdG9fc3RyIiwKKyAgICJwYXJhbWV0ZXJzIiA6CisgICBbCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDlzdHJfcGFybXMiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSVBjIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3N0cl9wYXJtcy5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAidWV2ZW50X2tlcm5lbF9tdWx0aWNhc3RfcmVjdiIsCisgICAibGlua2VyX3NldF9rZXkiIDogInVldmVudF9rZXJuZWxfbXVsdGljYXN0X3JlY3YiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUHYiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElqIgorICAgIH0KKyAgIF0sCisgICAicmV0dXJuX3R5cGUiIDogIl9aVElpIiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3VldmVudC5oIgorICB9LAorICB7CisgICAiZnVuY3Rpb25fbmFtZSIgOiAidWV2ZW50X2tlcm5lbF9tdWx0aWNhc3RfdWlkX3JlY3YiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJ1ZXZlbnRfa2VybmVsX211bHRpY2FzdF91aWRfcmVjdiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQaiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy91ZXZlbnQuaCIKKyAgfSwKKyAgeworICAgImZ1bmN0aW9uX25hbWUiIDogInVldmVudF9rZXJuZWxfcmVjdiIsCisgICAibGlua2VyX3NldF9rZXkiIDogInVldmVudF9rZXJuZWxfcmVjdiIsCisgICAicGFyYW1ldGVycyIgOgorICAgWworICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWkiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQdiIKKyAgICB9LAorICAgIHsKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSWoiCisgICAgfSwKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVEliIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUGoiCisgICAgfQorICAgXSwKKyAgICJyZXR1cm5fdHlwZSIgOiAiX1pUSWkiLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvdWV2ZW50LmgiCisgIH0sCisgIHsKKyAgICJmdW5jdGlvbl9uYW1lIiA6ICJ1ZXZlbnRfb3Blbl9zb2NrZXQiLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJ1ZXZlbnRfb3Blbl9zb2NrZXQiLAorICAgInBhcmFtZXRlcnMiIDoKKyAgIFsKKyAgICB7CisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJYiIKKyAgICB9CisgICBdLAorICAgInJldHVybl90eXBlIiA6ICJfWlRJaSIsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy91ZXZlbnQuaCIKKyAgfQorIF0sCisgImdsb2JhbF92YXJzIiA6CisgWworICB7CisgICAibGlua2VyX3NldF9rZXkiIDogImF0cmFjZV9lbmFibGVkX3RhZ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dGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2NvbmZpZ191dGlscy5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQN0hhc2htYXAiLAorICAgIm5hbWUiIDogIkhhc2htYXAgKiIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJN0hhc2htYXAiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVA3SGFzaG1hcCIsCisgICAic2l6ZSIgOiA0LAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQOXN0cl9wYXJtcyIsCisgICAibmFtZSIgOiAic3RyX3Bhcm1zICoiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSTlzdHJfcGFybXMiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVA5c3RyX3Bhcm1zIiwKKyAgICJzaXplIiA6IDQsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9zdHJfcGFybXMuaCIKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJUEZiUHZTX0UiLAorICAgIm5hbWUiIDogImJvb2wgKCopKHZvaWQgKiwgdm9pZCAqKSIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJRmJQdlNfRSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJUEZiUHZTX0UiLAorICAgInNpemUiIDogNCwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL2hhc2htYXAuaCIKKyAgfSwKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJUEZiUHZTX1NfRSIsCisgICAibmFtZSIgOiAiYm9vbCAoKikodm9pZCAqLCB2b2lkICosIHZvaWQgKikiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSUZiUHZTX1NfRSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJUEZiUHZTX1NfRSIsCisgICAic2l6ZSIgOiA0LAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQRmlQdkUiLAorICAgIm5hbWUiIDogImludCAoKikodm9pZCAqKSIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJRmlQdkUiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSVBGaVB2RSIsCisgICAic2l6ZSIgOiA0LAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvaGFzaG1hcC5oIgorICB9LAorICB7CisgICAiYWxpZ25tZW50IiA6IDQsCisgICAibGlua2VyX3NldF9rZXkiIDogIl9aVElQRnZQS2NTMF9QdkUiLAorICAgIm5hbWUiIDogInZvaWQgKCopKGNvbnN0IGNoYXIgKiwgY29uc3QgY2hhciAqLCB2b2lkICopIiwKKyAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElGdlBLY1MwX1B2RSIsCisgICAic2VsZl90eXBlIiA6ICJfWlRJUEZ2UEtjUzBfUHZFIiwKKyAgICJzaXplIiA6IDQsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9wcm9wZXJ0aWVzLmgiCisgI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X3R5cGUiIDogIl9aVEljIiwKKyAgICJzZWxmX3R5cGUiIDogIl9aVElLYyIsCisgICAic2l6ZSIgOiAxLAorICAgInNvdXJjZV9maWxlIiA6ICJzeXN0ZW0vY29yZS9saWJjdXRpbHMvaW5jbHVkZS9jdXRpbHMvY29uZmlnX3V0aWxzLmgiCisgIH0sCisgIHsKKyAgICJpc19jb25zdCIgOiB0cnVlLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJS3YiLAorICAgIm5hbWUiIDogImNvbnN0IHZvaWQiLAorICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSXYiLAorICAgInNlbGZfdHlwZSIgOiAiX1pUSUt2IiwKKyAgICJzb3VyY2VfZmlsZSIgOiAic3lzdGVtL2NvcmUvbGliY3V0aWxzL2luY2x1ZGUvY3V0aWxzL3NvY2tldHMuaCIKKyAgfQorIF0sCisgInJlY29yZF90eXBlcyIgOgorIFsKKyAgeworICAgImFsaWdubWVudCIgOiA0LAorICAgImZpZWxkcyIgOgorICAgWworICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogInZlcnNpb24iLAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJaSIKKyAgICB9LAorICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogIm51bUZkcyIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogMzIsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAibnVtSW50cyIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogNjQsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElpIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAiZGF0YSIsCisgICAgICJmaWVsZF9vZmZzZXQiIDogOTYsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElBMF9pIgorICAgIH0KKyAgIF0sCisgICAibGlua2VyX3N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llbGRfbmFtZSIgOiAibmV4dCIsCisgICAgICJyZWZlcmVuY2VkX3R5cGUiIDogIl9aVElQNWNub2RlIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAiZmlyc3RfY2hpbGQiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDMyLAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogImxhc3RfY2hpbGQiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDY0LAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUDVjbm9kZSIKKyAgICB9LAorICAgIHsKKyAgICAgImZpZWxkX25hbWUiIDogIm5hbWUiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDk2LAorICAgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJUEtjIgorICAgIH0sCisgICAgeworICAgICAiZmllbGRfbmFtZSIgOiAidmFsdWUiLAorICAgICAiZmllbGRfb2Zmc2V0IiA6IDEyOCwKKyAgICAgInJlZmVyZW5jZWRfdHlwZSIgOiAiX1pUSVBLYyIKKyAgICB9CisgICBdLAorICAgImxpbmtlcl9zZXRfa2V5IiA6ICJfWlRJNWNub2RlIiwKKyAgICJuYW1lIiA6ICJjbm9kZSIsCisgICAicmVmZXJlbmNlZF90eXBlIiA6ICJfWlRJNWNub2RlIiwKKyAgICJzZWxmX3R5cGUiIDogIl9aVEk1Y25vZGUiLAorICAgInNpemUiIDogMjAsCisgICAic291cmNlX2ZpbGUiIDogInN5c3RlbS9jb3JlL2xpYmN1dGlscy9pbmNsdWRlL2N1dGlscy9jb25maWdfdXRpbHMuaCIKKyAgfQorIF0sCisgInJ2YWx1ZV9yZWZlcmVuY2VfdHlwZXMiIDogW10KK30KZGlmZiAtLWdpdCBhL2xpYmN1dGlscy9hcmNoLXg4Ni9jYWNoZS5oIGIvbGliY3V0aWxzL2FyY2gte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24gKikgJml0ZW0tPmRhdGE7Ci0KLSAgICAvKiBuZWVkIGEgc3RhbmRhcmQgcHJpbWFyeSBwYXJ0aXRpb24gZW50cnkgKi8KLSAgICBpZiAocGluZm8pIHsKLSAgICAgICAgLyogbmVlZCB0aGlzIHRvIGJlIDY0IGJpdCBpbiBjYXNlIGxlbl9rYiBpcyBsYXJnZSAqLwotICAgICAgICB1aW50NjRfdCBsZW5fbGJhOyAKLQotICAgICAgICBpZiAocGluZm8tPmxlbl9rYiAhPSAodWludDMyX3QpLTEpIHsKLSAgICAgICAgICAgIC8qIGJ1bXAgaXQgdXAgdG8gdGhlIG5leHQgTEJBIGJvdW5kYXJ5IGp1c3QgaW4gY2FzZSAqLwotICAgICAgICAgICAgbGVuX2xiYSA9ICgodWludDY0X3QpcGluZm8tPmxlbl9rYiAqIDEwMjQpOwotICAgICAgICAgICAgbGVuX2xiYSArPSAoKHVpbnQ2NF90KWRpbmZvLT5zZWN0X3NpemUgLSAxKTsKLSAgICAgICAgICAgIGxlbl9sYmEgJj0gfigodWludDY0X3QpZGluZm8tPnNlY3Rfc2l6ZSAtIDEpOwotICAgICAgICAgICAgbGVuX2xiYSAvPSAodWludDY0X3QpZGluZm8tPnNlY3Rfc2l6ZTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIC8qIG1ha2UgaXQgZmlsbCB0aGUgcmVzdCBvZiBkaXNrICovCi0gICAgICAgICAgICBsZW5fbGJhID0gZGluZm8tPm51bV9sYmEgLSAqbGJhOwotICAgICAgICB9Ci0KLSAgICAgICAgY2ZnX3BlbnRyeShwZW50cnksICgocGluZm8tPmZsYWdzICYgUEFSVF9BQ1RJVkVfRkxBRykgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBDX1BBUlRfQUNUSVZFIDogUENfUEFSVF9OT1JNQUwpLAotICAgICAgICAgICAgICAgICAgIHBpbmZvLT50eXBlLCAqbGJhLCAodWludDMyX3QpbGVuX2xiYSk7Ci0KLSAgICAgICAg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kgewotICAgICAgICBwaW5mbyA9ICZkaW5mby0+cGFydF9sc3RbY250XTsKLQotICAgICAgICAvKiBTaG91bGQgd2UgY3JlYXRlIGFuIGV4dGVkbmVkIHBhcnRpdGlvbj8gKi8KLSAgICAgICAgaWYgKGNudCA9PSAoUENfTlVNX0JPT1RfUkVDT1JEX1BBUlRTIC0gMSkpIHsKLSAgICAgICAgICAgIGlmIChjbnQgKyAxIDwgZGluZm8tPm51bV9wYXJ0cykgewotICAgICAgICAgICAgICAgIGV4dGVuZGVkID0gMTsKLSAgICAgICAgICAgICAgICBleHRfbGJhID0gY3VyX2xiYTsKLSAgICAgICAgICAgICAgICBpZiAoKHRlbXBfd3IgPSBta19wcmlfcGVudHJ5KGRpbmZvLCBOVUxMLCBjbnQsICZjdXJfbGJhKSkpCi0gICAgICAgICAgICAgICAgICAgIHdsaXN0X2FkZCgmd3JfbGlzdCwgdGVtcF93cik7Ci0gICAgICAgICAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIEFMT0dFKCJDYW5ub3QgY3JlYXRlIHByaW1hcnkgZXh0ZW5kZWQgcGFydGl0aW9uLiIpOwotICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLyogaWYgZXh0ZW5kZWQsIG5lZWQgMSBsYmEgZm9yIGViciAqLwotICAgICAgICBpZiAoKGN1cl9sYmEgKyBleHRlbmRlZCkgPj0gZGluZm8tPm51bV9sYmEpCi0gICAgICAgICAgICBnb3RvIG5vc3BhY2U7Ci0gICAgICAgIGVsc2UgaWYgKHBpbmZvLT5sZW5fa2IgIT0gKHVpbnQzMl90KS0xKSB7Ci0gICAgICAgICAgICB1aW50MzJfdCBzel9sYmEgPSAocGluZm8tPmxlbl9rYiAvIGRpbmZvLT5zZWN0X3NpemUpICogMTAyNDsKLSAgICAgICAgICAgIGlmICgoY3VyX2xiYSArIHN6X2x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GYoIk1CUiIpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgUEFSVF9TQ0hFTUVfR1BUOgotICAgICAgICAgICAgcHJpbnRmKCJHUFQgKHVuc3VwcG9ydGVkKSIpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICBwcmludGYoIlVua25vd24iKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgIH0KLSAgICBwcmludGYgKCJcbiIpOwotCi0gICAgcHJpbnRmKCJTZWN0b3Igc2l6ZTogJWRcbiIsIGRpbmZvLT5zZWN0X3NpemUpOwotICAgIHByaW50ZigiU2tpcCBsZWFkaW5nIExCQXM6ICV1XG4iLCBkaW5mby0+c2tpcF9sYmEpOwotICAgIHByaW50ZigiTnVtYmVyIG9mIExCQXM6ICV1XG4iLCBkaW5mby0+bnVtX2xiYSk7Ci0gICAgcHJpbnRmKCJQYXJ0aXRpb25zOlxuIik7Ci0KLSAgICBmb3IgKGNudCA9IDA7IGNudCA8IGRpbmZvLT5udW1fcGFydHM7ICsrY250KSB7Ci0gICAgICAgIHBhcnQgPSAmZGluZm8tPnBhcnRfbHN0W2NudF07Ci0gICAgICAgIHByaW50ZigiXHRuYW1lID0gJXNcbiIsIHBhcnQtPm5hbWUpOwotICAgICAgICBwcmludGYoIlx0XHRmbGFncyA9ICVzXG4iLAotICAgICAgICAgICAgICAgcGFydC0+ZmxhZ3MgJiBQQVJUX0FDVElWRV9GTEFHID8gIkFjdGl2ZSIgOiAiTm9uZSIpOwotICAgICAgICBwcmludGYoIlx0XHR0eXBlID0gJXNcbiIsCi0gICAgICAgICAgICAgICBwYXJ0LT50eXBlID09IFBDX1BBUlRfVFlQRV9MSU5VWCA/ICJMaW51eCIgOiAiVW5rbm93biIpOwotICAgICAgICBpZiAocGFydC0+bGVuX2tiID09ICh1aW50MzJfdCktMSkKLSAgICAgICAgICAgIHByaW50ZigiXHRcdGxlbiA9IHJlc3Qgb2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QgPSBvcGVuKHNyYywgT19SRE9OTFkpKSA8IDApIHsKLSAgICAgICAgQUxPR0UoIkNvdWxkIG5vdCBvcGVuICVzIGZvciByZWFkaW5nIChlcnJubz0lZCkuIiwgc3JjLCBlcnJubyk7Ci0gICAgICAgIGdvdG8gZmFpbDsKLSAgICB9Ci0KLSAgICBpZiAoIXRlc3QpIHsKLSAgICAgICAgaWYgKChkc3RfZmQgPSBvcGVuKGRzdCwgT19SRFdSKSkgPCAwKSB7Ci0gICAgICAgICAgICBBTE9HRSgiQ291bGQgbm90IG9wZW4gJyVzJyBmb3IgcmVhZC93cml0ZSAoZXJybm89JWQpLiIsIGRzdCwgZXJybm8pOwotICAgICAgICAgICAgZ290byBmYWlsOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGxzZWVrNjQoZHN0X2ZkLCBvZmZzZXQsIFNFRUtfU0VUKSAhPSBvZmZzZXQpIHsKLSAgICAgICAgICAgIEFMT0dFKCJDb3VsZCBub3Qgc2VlayB0byBvZmZzZXQgJWxsZCBpbiAlcy4iLCAobG9uZyBsb25nKW9mZnNldCwgZHN0KTsKLSAgICAgICAgICAgIGdvdG8gZmFpbDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHdoaWxlICghZG9uZSkgewotICAgICAgICBpZiAoKG5yX2J5dGVzID0gcmVhZChzcmNfZmQsIGJ1ZmZlciwgc2l6ZW9mKGJ1ZmZlcikpKSA8IDApIHsKLSAgICAgICAgICAgIC8qIFhYWDogU2hvdWxkIHdlIG5vdCBldmVuIGJvdGhlciB3aXRoIEVJTlRSPyAqLwotICAgICAgICAgICAgaWYgKGVycm5vID09IEVJTlRSKQotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgQUxPR0UoIkVycm9yICglZCkgd2hpbGUgcmVhZGluZyBmcm9tICclcyciLCBlcnJubywgc3JjKTsKLSAgICAgICAgICAgIGdvdG8gZmFpbDsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICghbnJfYnl0ZXMpIHsKLSAgICAgICAgICAgIC8qIHdlJ3JlIGRvbmUuICovCi0gICAgICAgICAgICBkb25lID0gMTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0KLSAgICAgICAgdG90YWwgKz0gbnJfYnl0ZXM7Ci0KLSAgICAgICAgLyogc2tpcCB0aGUgd3JpdGUgbG9vcCBpZiB3ZSdyZSB0ZXN0aW5nICovCi0gICAgICAgIGlmICh0ZXN0KQotICAgICAgICAgICAgbnJfYnl0ZXMgPSAwOwotCi0gICAgICAgIHdoaWxlIChucl9ieXRlcyA+IDApIHsKLSAgICAgICAgICAgIGlmICgodG1wID0gd3JpdGUoZHN0X2ZkLCBidWZmZXIsIG5yX2J5dGVzKSkgPCAwKSB7Ci0gICAgICAgICAgICAgICAgLyogWFhYOiBTaG91bGQgd2Ugbm90IGV2ZW4gYm90aGVyIHdpdGggRUlOVFI/ICovCi0gICAgICAgICAgICAgICAgaWYgKGVycm5vID09IEVJTlRSKQotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICBBTE9HRSgiRXJyb3IgKCVkKSB3aGlsZSB3cml0aW5nIHRvICclcyciLCBlcnJubywgZHN0KTsKLSAgICAgICAgICAgICAgICBnb3RvIGZhaWw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIXRtcCkKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIG5yX2J5dGVzIC09IHRtcDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIGlmICghZG9uZSkgewotICAgICAgICBBTE9HRSgiRXhpdGVkIHJlYWQvd3JpdGUgbG9vcCB3aXRob3V0IHNldHRpbmcgZmxhZyEgV1RGPyEiKTsKLSAgICAgICAgZ290byBmYWlsOwotICAgIH0KLQotICAgIGlmIChkc3RfZmQgPj0gMCkKLSAgICAgICAgZnN5bmMoZHN0X2ZkKTsKLQotICAgIEFMT0dJKCJXcm90ZSAlIiBQUkl1Nj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NYWtlQ2Fub25pY2FsKGl0X21vZCkpWzBdKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHdoaWxlICghbW9kX3dpdGhfZGVwcy5lbXB0eSgpICYmICBjb3VudCAhPSBtb2R1bGVfbG9hZGVkXy5zaXplKCkpIHsKKyAgICB3aGlsZSAoIW1vZF93aXRoX2RlcHMuZW1wdHkoKSkgewogICAgICAgICBzdGQ6OnZlY3RvcjxzdGQ6OnRocmVhZD4gdGhyZWFkczsKICAgICAgICAgc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IG1vZHNfcGF0aF90b19sb2FkOwogICAgICAgICBzdGQ6Om11dGV4IHZlY3Rvcl9sb2NrOwotICAgICAgICBjb3VudCA9IG1vZHVsZV9sb2FkZWRfLnNpemUoKTsKIAogICAgICAgICAvLyBGaW5kIGluZGVwZW5kZW50IG1vZHVsZXMKICAgICAgICAgZm9yIChjb25zdCBhdXRvJiBbaXRfbW9kLCBpdF9kZXBdIDogbW9kX3dpdGhfZGVwcykgewotICAgICAgICAgICAgaWYgKGl0X2RlcC5zaXplKCkgPT0gMSkgewotICAgICAgICAgICAgICAgIGlmIChtb2R1bGVfb3B0aW9uc19baXRfbW9kXS5maW5kKCJsb2FkX3NlcXVlbnRpYWw9MSIpICE9IHN0ZDo6c3RyaW5nOjpucG9zKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghTG9hZFdpdGhBbGlhc2VzKGl0X21vZCwgdHJ1ZSkgJiYgIUlzQmxvY2tsaXN0ZWQoaXRfbW9kKSkgewotICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1vZHNfcGF0aF90b19sb2FkLmVtcGxhY2VfYmFjayhpdF9tb2QpOworICAgICAgICAgICAgYXV0byBpdGRfbGFzdCA9IGl0X2RlcC5yYmVnaW4oKTsKKyAgICAgICAgICAgIGlmIChpdGRfbGFzdCA9PSBpdF9kZXAucmVuZCgpKQorICAgICAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgICAgICBhdXRvIGNuZF9sYXN0ID0gTWFrZUNhbm9uaWNhbCgqaXRkX2xhc3QpOworICAgICAgICAgICAgLy8gSGFyZC1kZXBlbmRlbmNpZXMgY2Fubm90IGJlIGJsb2NrbGlzdGVkCisgICAgICAgICAgICBpZiAoSXNCbG9ja2xpc3RlZChjbmRfbGFzdCkpIHsKKyAgICAgICAgICAgICAgICBMT0coRVJST1IpIDw8ICJMTVA6IEJsb2NrbGlzdDogTW9kdWxlLWRlcCAiIDw8IGNuZF9sYXN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIDogZmFpbGVkIHRvIGxvYWQgbW9kdWxlICIgPDwgaXRfbW9kOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1vZHVsZV9vcHRpb25zX1tjbmRfbGFzdF0uZmluZCgibG9hZF9zZXF1ZW50aWFsPTEiKSAhPSBzdGQ6OnN0cmluZzo6bnBvcykgeworICAgICAgICAgICAgICAgIGlmICghTG9hZFdpdGhBbGlhc2VzKGNuZF9sYXN0LCB0cnVlKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoc3RkOjpmaW5kKG1vZHNfcGF0aF90b19sb2FkLmJlZ2luKCksIG1vZHNfcGF0aF90b19sb2FkLmVuZCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNuZF9sYXN0KSA9PSBtb2RzX3BhdGhfdG9fbG9hZC5lbmQoKSkgeworICAgICAgICAgICAgICAgICAgICBtb2RzX3BhdGhfdG9fbG9hZC5lbXBsYWNlX2JhY2soY25kX2xhc3QpOwogICAgICAgICAgICAgICAgIH0KICAg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cXVlX3B0cjxESVIsIGRlY2x0eXBlKCZjbG9zZWRpcik+IHVpZChvcGVuZGlyKHVpZF9wYXRoLmNfc3RyKCkpLCBjbG9zZWRpcik7CiAgICAgYm9vbCBlbXB0eSA9IHRydWU7CiAgICAgaWYgKHVpZCAhPSBOVUxMKSB7CkBAIC0yNDIsMjEgKzI2Nyw2IEBACiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGF1dG8gcGF0aCA9IFN0cmluZ1ByaW50ZigiJXMvJXMiLCB1aWRfcGF0aC5jX3N0cigpLCBkaXItPmRfbmFtZSk7Ci0gICAgICAgICAgICBpZiAoZW1wdHlfb25seSkgewotICAgICAgICAgICAgICAgIHN0cnVjdCBzdGF0IHN0OwotICAgICAgICAgICAgICAgIGF1dG8gcHJvY3NfZmlsZSA9IFN0cmluZ1ByaW50ZigiJXMvJXMiLCBwYXRoLmNfc3RyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBST0NFU1NHUk9VUF9DR1JPVVBfUFJPQ1NfRklMRSk7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXQocHJvY3NfZmlsZS5jX3N0cigpLCAmc3QpID09IC0xKSB7Ci0gICAgICAgICAgICAgICAgICAgIFBMT0coRVJST1IpIDw8ICJGYWlsZWQgdG8gZ2V0IHN0YXRzIGZvciAiIDw8IHByb2NzX2ZpbGU7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoc3Quc3Rfc2l6ZSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gc2tpcCBub24tZW1wdHkgZ3JvdXBzCi0gICAgICAgICAgICAgICAgICAgIExPRyhWRVJCT1NFKSA8PCAiU2tpcHBpbmcgbm9uLWVtcHR5IGdyb3VwICIgPDwgcGF0aDsKLSAgICAgICAgICAgICAgICAgICAgZW1wdHkgPSBmYWxzZTsKLSAgICAgICA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IGlmIChub3cgPCB1bnRpbCkKKyAgICAgICAgICAgICAgICAgICAgc3RkOjp0aGlzX3RocmVhZDo6c2xlZXBfZm9yKHN0ZDo6bWluKDVtcywgdG9NaWxsaXNlYyh1bnRpbCAtIG5vdykpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgTE9HKFZFUkJPU0UpIDw8ICJXYWl0ZWQgIgorICAgICAgICAgICAgICAgICAgICAgICAgIDw8IHRvTWlsbGlzZWMoc3RkOjpjaHJvbm86OnN0ZWFkeV9jbG9jazo6bm93KCkgLSBwb2xsX3N0YXJ0KS5jb3VudCgpCisgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBtcyBmb3IgIiA8PCBldmVudHNmaWxlIDw8ICIgcG9sbCI7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoIUNncm91cHNBdmFpbGFibGUoKSkgewotICAgICAgICAgICAgLy8gbm90aGluZyB0byBkbyBoZXJlLCBpZiBjZ3JvdXBzIGlzbid0IGF2YWlsYWJsZQotICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIGNvbnN0IHN0ZDo6Y2hyb25vOjptaWxsaXNlY29uZHMga2lsbF9kdXJhdGlvbiA9CisgICAgICAgICAgICAgICAgdG9NaWxsaXNlYyhzdGQ6OmNocm9ubzo6c3RlYWR5X2Nsb2NrOjpub3coKSAtIHN0YXJ0KTsKKworICAgICAgICBpZiAocG9wdWxhdGVkID09IHBvcHVsYXRlZF9zdGF0dXM6OnBvcHVsYXRlZCkgeworICAgICAgICAgICAgTE9HKFdBUk5JTkcpIDw8ICJTdGlsbCB3YWl0aW5nIG9uIHByb2Nlc3MoZXMpIHRvIGV4aXQgZm9yIGNncm91cCAiIDw8IGNncm91cF92Ml9wYXRoCisgICAgICAgICAgICAgICAgICAgICAgICAgPDwgIiBhZnRlciAiIDw8IGtpbGxfZHVyYXRpb24uY291bnQoKSA8PCAiIG1zIjsKKyAgICAgICAgICAgIC8vIFdlJ2xsIHN0aWxsIHRy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bWUiOiAiQ2ZxV2VpZ2h0IiwKKyAgICAgICJDb250cm9sbGVyIjogImlvIiwKKyAgICAgICJGaWxlIjogImlvLndlaWdodCIKKyAgICB9LAorICAgIHsKKyAgICAgICJOYW1lIjogIklvUHJpb0NsYXNzIiwKKyAgICAgICJDb250cm9sbGVyIjogImlvIiwKKyAgICAgICJGaWxlIjogImlvLnByaW8uY2xhc3MiCiAgICAgfQogICBdLAogCkBAIC00MzksMTEgKzQ1OSwzOSBAQAogICAgICAgIk5hbWUiOiAiTG93SW9Qcmlvcml0eSIsCiAgICAgICAiQWN0aW9ucyI6IFsKICAgICAgICAgewotICAgICAgICAgICJOYW1lIjogIkpvaW5DZ3JvdXAiLAorICAgICAgICAgICJOYW1lIjogIlNldEF0dHJpYnV0ZSIsCiAgICAgICAgICAgIlBhcmFtcyI6CiAgICAgICAgICAgewotICAgICAgICAgICAgIkNvbnRyb2xsZXIiOiAiYmxraW8iLAotICAgICAgICAgICAgIlBhdGgiOiAiYmFja2dyb3VuZCIKKyAgICAgICAgICAgICJOYW1lIjogIkJmcVdlaWdodCIsCisgICAgICAgICAgICAiVmFsdWUiOiAiMTAiLAorICAgICAgICAgICAgIk9wdGlvbmFsIjogInRydWUiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKKyAgICAgICAgICAiUGFyYW1zIjoKKyAgICAgICAgICB7CisgICAgICAgICAgICAiTmFtZSI6ICJDZnFHcm91cElkbGUiLAorICAgICAgICAgICAgIlZhbHVlIjogIjAiLAorICAgICAgICAgICAgIk9wdGlvbmFsIjogInRydWUiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKKyAgICAgICAgICAiUGFyYW1zIjoKKyAgICAgICAgICB7CisgICAgICAgICAgICAiTmFtZSI6ICJDZnFXZWlnaHQiLAorICAgICAgICAgICAgIlZhbHVlIjogIjIwMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIklvUHJpb0NsYXNzIiwKKyAgICAgICAgICAgICJWYWx1ZSI6ICJyZXN0cmljdC10by1iZSIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgIF0KQEAgLTQ1MiwxMSArNTAwLDM5IEBACiAgICAgICAiTmFtZSI6ICJOb3JtYWxJb1ByaW9yaXR5IiwKICAgICAgICJBY3Rpb25zIjogWwogICAgICAgICB7Ci0gICAgICAgICAgIk5hbWUiOiAiSm9pbkNncm91cCIsCisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKICAgICAgICAgICAiUGFyYW1zIjoKICAgICAgICAgICB7Ci0gICAgICAgICAgICAiQ29udHJvbGxlciI6ICJibGtpbyIsCi0gICAgICAgICAgICAiUGF0aCI6ICIiCisgICAgICAgICAgICAiTmFtZSI6ICJCZnFXZWlnaHQiLAorICAgICAgICAgICAgIlZhbHVlIjogIjEwMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIkNmcUdyb3VwSWRsZSIsCisgICAgICAgICAgICAiVmFsdWUiOiAiMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIkNmcVdlaWdodCIsCisgICAgICAgICAgICAiVmFsdWUiOiAiMTAwMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIklvUHJpb0NsYXNzIiwKKyAgICAgICAgICAgICJWYWx1ZSI6ICJyZXN0cmljdC10by1iZSIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgIF0KQEAgLTQ2NSwxMSArNTQxLDM5IEBACiAgICAgICAiTmFtZSI6ICJIaWdoSW9Qcmlvcml0eSIsCiAgICAgICAiQWN0aW9ucyI6IFsKICAgICAgICAgewotICAgICAgICAgICJOYW1lIjogIkpvaW5DZ3JvdXAiLAorICAgICAgICAgICJOYW1lIjogIlNldEF0dHJpYnV0ZSIsCiAgICAgICAgICAgIlBhcmFtcyI6CiAgICAgICAgICAgewotICAgICAgICAgICAgIkNvbnRyb2xsZXIiOiAiYmxraW8iLAotICAgICAgICAgICAgIlBhdGgiOiAiIgorICAgICAgICAgICAgIk5hbWUiOiAiQmZxV2VpZ2h0IiwKKyAgICAgICAgICAgICJWYWx1ZSI6ICIxMDAiLAorICAgICAgICAgICAgIk9wdGlvbmFsIjogInRydWUiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKKyAgICAgICAgICAiUGFyYW1zIjoKKyAgICAgICAgICB7CisgICAgICAgICAgICAiTmFtZSI6ICJDZnFHcm91cElkbGUiLAorICAgICAgICAgICAgIlZhbHVlIjogIjAiLAorICAgICAgICAgICAgIk9wdGlvbmFsIjogInRydWUiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKKyAgICAgICAgICAiUGFyYW1zIjoKKyAgICAgICAgICB7CisgICAgICAgICAgICAiTmFtZSI6ICJDZnFXZWlnaHQiLAorICAgICAgICAgICAgIlZhbHVlIjogIjEwMDAiLAorICAgICAgICAgICAgIk9wdGlvbmFsIjogInRydWUiCisgICAgICAgICAgfQorICAgICAgICB9LAorICAgICAgICB7CisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKKyAgICAgICAgICAiUGFyYW1zIjoKKyAgICAgICAgICB7CisgICAgICAgICAgICAiTmFtZSI6ICJJb1ByaW9DbGFzcyIsCisgICAgICAgICAgICAiVmFsdWUiOiAicHJvbW90ZS10by1ydCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgIF0KQEAgLTQ3OCwxMSArNTgyLDM5IEBACiAgICAgICAiTmFtZSI6ICJNYXhJb1ByaW9yaXR5IiwKICAgICAgICJBY3Rpb25zIjogWwogICAgICAgICB7Ci0gICAgICAgICAgIk5hbWUiOiAiSm9pbkNncm91cCIsCisgICAgICAgICAgIk5hbWUiOiAiU2V0QXR0cmlidXRlIiwKICAgICAgICAgICAiUGFyYW1zIjoKICAgICAgICAgICB7Ci0gICAgICAgICAgICAiQ29udHJvbGxlciI6ICJibGtpbyIsCi0gICAgICAgICAgICAiUGF0aCI6ICIiCisgICAgICAgICAgICAiTmFtZSI6ICJCZnFXZWlnaHQiLAorICAgICAgICAgICAgIlZhbHVlIjogIjEwMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIkNmcUdyb3VwSWRsZSIsCisgICAgICAgICAgICAiVmFsdWUiOiAiMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIkNmcVdlaWdodCIsCisgICAgICAgICAgICAiVmFsdWUiOiAiMTAwMCIsCisgICAgICAgICAgICAiT3B0aW9uYWwiOiAidHJ1ZSIKKyAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIHsKKyAgICAgICAgICAiTmFtZSI6ICJTZXRBdHRyaWJ1dGUiLAorICAgICAgICAgICJQYXJhbXMiOgorICAgICAgICAgIHsKKyAgICAgICAgICAgICJOYW1lIjogIklvUHJpb0NsYXNzIiwKKyAgICAgICAgICAgICJWYWx1ZSI6ICJwcm9tb3RlLXRvLXJ0IiwKKyAgICAgICAgICAgICJPcHRpb25hbCI6ICJ0cnVlIgogICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgXQpkaWZmIC0tZ2l0IGEvbGlicHJvY2Vzc2dyb3VwL3NldHVwL2Nncm91cF9tYXBfd3JpdGUuY3BwIGIvbGlicHJvY2Vzc2dyb3VwL3NldHVwL2Nncm91cF9tYXBfd3JpdGUuY3BwCmluZGV4IGZiZWVkZjkuLjRlNDRjOTEgMTAwNjQ0Ci0tLSBhL2xpYnByb2Nlc3Nncm91cC9zZXR1cC9jZ3JvdXBfbWFwX3dyaXRlLmNwcAorKysgYi9saWJwcm9jZXNzZ3JvdXAvc2V0dXAvY2dyb3VwX21hcF93cml0ZS5jcHAKQEAgLTIx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SKSA8PCAiRmFpbGVkIHRvIGFkZCB0YXNrIGludG8gY2dyb3VwIjsKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KQEAgLTg2Niw3ICs4NjgsMTMgQEAKIAogICAgICAgICAgICAgICAgIGF1dG8gY29udHJvbGxlciA9IGNnX21hcC5GaW5kQ29udHJvbGxlcihjb250cm9sbGVyX25hbWUpOwogICAgICAgICAgICAgICAgIGlmIChjb250cm9sbGVyLkhhc1ZhbHVlKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcHJvZmlsZS0+QWRkKHN0ZDo6bWFrZV91bmlxdWU8U2V0Q2dyb3VwQWN0aW9uPihjb250cm9sbGVyLCBwYXRoKSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjb250cm9sbGVyLnZlcnNpb24oKSA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwcm9maWxlLT5BZGQoc3RkOjptYWtlX3VuaXF1ZTxTZXRDZ3JvdXBBY3Rpb24+KGNvbnRyb2xsZXIsIHBhdGgpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExPRyhXQVJOSU5HKSA8PCAiQSBKb2luQ2dyb3VwIGFjdGlvbiBpbiB0aGUgIiA8PCBwcm9maWxlX25hbWUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8PCAiIHByb2ZpbGUgaXMgdXNlZCBmb3IgY29udHJvbGxlciAiIDw8IGNvbnRyb2xsZXJfbmFtZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw8ICIgaW4gdGhlIGNncm91cCB2MiBoaWVyYXJjaHkgYW5kIHdpbGwgYmUgaWdub3JlZCI7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBMT0coV0FSTklORykgPDwgIkpvaW5DZ3JvdXA6IGNvbnRyb2xsZXIgIiA8P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RMb2dnZXJXcml0ZS5zb2NrLCByZXQpOwotICAgICAgICAgICAgICAgICAgICAvKiBGQUxMVEhSVSAqLworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CkBAIC0xODgsNyArMTg4LDcgQEAKICAgICAgKiAgfTsKICAgICAgKi8KIAotICAgIGhlYWRlci50aWQgPSBnZXR0aWQoKTsKKyAgICBoZWFkZXIudGlkID0gYW5kcm9pZDo6YmFzZTo6R2V0VGhyZWFkSWQoKTsKICAgICBoZWFkZXIucmVhbHRpbWUudHZfc2VjID0gdHMtPnR2X3NlYzsKICAgICBoZWFkZXIucmVhbHRpbWUudHZfbnNlYyA9IHRzLT50dl9uc2VjOwogCkBAIC0yNzIsNyArMjcyLDcgQEAKICAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CiAgICAgICAgICAgICAgICAgcmV0ID0gLWVycm5vOwogICAgICAgICAgICAgfQotICAgICAgICAvKiBGQUxMVEhSVSAqLworICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICBicmVhazsKICAgICB9CmRpZmYgLS1naXQgYS9saWJzdGF0cy9wdXNoX2NvbXBhdC9zdGF0c2Rfd3JpdGVyLmggYi9saWJzdGF0cy9wdXNoX2NvbXBhdC9zdGF0c2Rfd3JpdGVyLmgKaW5kZXggZmUyZDM3Yy4uZjAzMGI5NiAxMDA2NDQKLS0tIGEvbGlic3RhdHMvcHVzaF9jb21wYXQvc3RhdHNkX3dyaXRlci5oCisrKyBiL2xpYnN0YXRzL3B1c2hfY29tcGF0L3N0YXRzZF93cml0ZXIuaApAQCAtMjEsNiArMjEsOCBAQAogI2luY2x1ZGUgPHN0ZGF0b21pYy5oPgogI2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4KIAorX19CRUdJTl9ERUNMUworCi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KLS0tIGEvbGlidXRpbHMvQW5kcm9pZC5icAorKysgYi9saWJ1dGlscy9BbmRyb2lkLmJwCkBAIC02OCwxMyArNjgsNiBAQAogICAgICAgICAiLVduby1leGl0LXRpbWUtZGVzdHJ1Y3RvcnMiLAogICAgICAgICAiLURBTkRST0lEX1VUSUxTX1JFRl9CQVNFX0RJU0FCTEVfSU1QTElDSVRfQ09OU1RSVUNUSU9OIiwKICAgICBdLAotICAgIGhlYWRlcl9saWJzOiBbCi0gICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAotICAgICAgICAibGlidXRpbHNfaGVhZGVycyIsCi0gICAgXSwKLSAgICBleHBvcnRfaGVhZGVyX2xpYl9oZWFkZXJzOiBbCi0gICAgICAgICJsaWJ1dGlsc19oZWFkZXJzIiwKLSAgICBdLAogCiAgICAgc2hhcmVkX2xpYnM6IFsKICAgICAgICAgImxpYmN1dGlscyIsCkBAIC0xMzIsMjUgKzEyNSwyNyBAQAogICAgIF0sCiAgICAgbmF0aXZlX2JyaWRnZV9zdXBwb3J0ZWQ6IHRydWUsCiAKKyAgICB3aG9sZV9zdGF0aWNfbGliczogWyJsaWJ1dGlsc19iaW5kZXIiXSwKKworICAgIGhlYWRlcl9saWJzOiBbCisgICAgICAgICJsaWJiYXNlX2hlYWRlcnMiLAorICAgICAgICAibGlidXRpbHNfaGVhZGVycyIsCisgICAgXSwKKyAgICBleHBvcnRfaGVhZGVyX2xpYl9oZWFkZXJzOiBbCisgICAgICAgICJsaWJ1dGlsc19oZWFkZXJzIiwKKyAgICBdLAorCiAgICAgc3JjczogWwotICAgICAgICAiRXJyb3JzLmNwcCIsCiAgICAgICAgICJGaWxlTWFwLmNwcCIsCiAgICAgICAgICJKZW5raW5zSGFzaC5jcHAiLAogICAgICAgICAiTGlnaHRSZWZCYXNlLmNwcCIsCiAgICAgICAgICJOYXRpdmVIYW5kbGUuY3BwIiwKICAgICAgICAgIlByaW50ZXIuY3BwIiwKLSAgICAgICAgIlJlZkJhc2UuY3BwIiwKLSAgICAgICAgIlNoYXJlZEJ1ZmZlci5jcHAiLAogICAgICAgICAiU3RvcFdhdGNoLmNwcCIsCi0gICAgICAgICJTdHJpbmc4LmNwcCIsCi0gICAgICAgICJTdHJpbmcxNi5jcHAiLAotICAgICAgICAiU3Ryb25nUG9pbnRlci5jcHAiLAogICAgICAgICAiU3lzdGVtQ2xvY2suY3BwIiwKICAgICAgICAgIlRocmVhZHMuY3BwIiwKICAgICAgICAgIlRpbWVycy5jcHAiLAogICAgICAgICAiVG9rZW5pemVyLmNwcCIsCi0gICAgICAgICJVbmljb2RlLmNwcCIsCi0gICAgICAgICJWZWN0b3JJbXBsLmNwcCIsCiAgICAgICAgICJtaXNjLmNwcCIsCiAgICAgXSwKIApAQCAtMTg1LDEwICsxODAsMjEgQEAKICAgICAgICAgc3VwcG9ydF9zeXN0ZW1fcHJvY2VzczogdHJ1ZSwKICAgICB9LAogCi0gICAgaGVhZGVyX2FiaV9jaGVja2VyOiB7Ci0gICAgICAgIC8vIEFGRE8gYWZmZWN0cyB3ZWFrIHN5bWJvbHMuCi0gICAgICAgIGRpZmZfZmxhZ3M6IFsiLWFsbG93LWFkZGluZy1yZW1vdmluZy13ZWFrLXN5bWJvbHMiXSwKLSAgICAgICAgcmVmX2R1bXBfZGlyczogWyJhYmktZHVtcHMiXSwKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgcHJvZHVjdDogeworICAgICAgICAgICAgaGVhZGVyX2FiaV9jaGVja2VyOiB7CisgICAgICAgICAgICAgICAgLy8gQUZETyBhZmZlY3RzIHdlYWsgc3ltYm9scy4KKyAgICAgICAgICAgICAgICBkaWZmX2ZsYWdzOiBbIi1hbGxvdy1hZGRpbmctcmVtb3Zpbmctd2Vhay1zeW1ib2xzIl0sCisgICAgICAgICAgICAgICAgcmVmX2R1bXBfZGlyczogWyJhYmktZHVtcHMiXSwKKyAgICAgICAgICAgIH0sCisgICAgICAgIH0sCisgICAgICAgIHZlbmRvcjogeworICAgICAgICAgICAgaGVhZGVyX2FiaV9jaGVja2VyOiB7CisgICAgICAgICAgICAgICAgLy8gQUZETyBhZmZlY3RzIHdlYWsgc3ltYm9scy4KKyAgICAgICAgICAgICAgICBkaWZmX2ZsYWdzOiBbIi1hbGxvdy1hZGRpbmctcmVtb3Zpbmctd2Vhay1zeW1ib2xzIl0sCisgICAgICAgICAgICAgICAgcmVmX2R1bXBfZGlyczogWyJhYmktZHVtcHMiXSwKKyAgICAgICAgICAgIH0sCisgICAgICAgIH0sCiAgICAgfSwKIH0KIApAQCAtMTk3LDcgKzIwMyw3IEBACiAgICAgZGVmYXVsdHM6IFsibGlidXRpbHNfaW1wbF9kZWZhdWx0cyJdLAogCiAgICAgY2ZsYWdzOiBbCi0gICAgICAgICItRENBTExTVEFDS1M9MSIsCisgICAgICAgICItRERFQlVHX0NBTExCQUNLUz0xIiwKICAgICAgICAgIi1EREVCVUdfUE9MTF9BTkRfV0FLRT0xIiwKICAgICAgICAgIi1EREVCVUdfUkVGUz0xIiwKICAgICAgICAgIi1EREVCVUdfVE9LRU5JWkVSPTEiLApAQCAtMjE3LDYgKzIyMywxNCBAQAogICAgICAgICBzdXBwb3J0X3N5c3RlbV9wcm9jZXNzOiB0cnVlLAogICAgIH0sCiAKKyAgICBoZWFkZXJfbGliczogWworICAgICAgICAibGliYmFzZV9oZWFkZXJzIiwKKyAgICAgICAgImxpYnV0aWxzX2hlYWRlcnMiLAorICAgIF0sCisgICAgZXhwb3J0X2hlYWRlcl9saWJfaGVhZGVyczogWworICAgICAgICAibGlidXRpbHNfaGVhZGVycyIsCisgICAgXSwKKwogICAgIHNyY3M6IFsKICAgICAgICAgIkNhbGxTdGFjay5jcHAiLAogICAgIF0sCkBAIC0yNjQsMjQgKzI3OCw2IEBACiB9CiAKIGNjX2Z1enogewotICAgIG5hbWU6ICJsaWJ1dGlsc19mdXp6X3N0cmluZzgiLAotICAgIGRlZmF1bHRzOiBbImxpYnV0aWxzX2Z1enpfZGVmYXVsdHMiXSwKL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l90KiBlMiA9IHMyK24yOwotCi0gICAgd2hpbGUgKHMxIDwgZTEgJiYgczIgPCBlMikgewotICAgICAgICBjb25zdCBpbnQgZCA9IChpbnQpKnMxKysgLSAoaW50KSpzMisrOwotICAgICAgICBpZiAoZCkgewotICAgICAgICAgICAgcmV0dXJuIGQ7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICByZXR1cm4gbjEgPCBuMgotICAgICAgICA/ICgwIC0gKGludCkqczIpCi0gICAgICAgIDogKG4xID4gbjIKLSAgICAgICAgICAgPyAoKGludCkqczEgLSAwKQotICAgICAgICAgICA6IDApOwotfQotCi12b2lkIHV0ZjE2X3RvX3V0ZjgoY29uc3QgY2hhcjE2X3QqIHNyYywgc2l6ZV90IHNyY19sZW4sIGNoYXIqIGRzdCwgc2l6ZV90IGRzdF9sZW4pCi17Ci0gICAgaWYgKHNyYyA9PSBudWxscHRyIHx8IHNyY19sZW4gPT0gMCB8fCBkc3QgPT0gbnVsbHB0cikgewotICAgICAgICByZXR1cm47Ci0gICAgfQotCi0gICAgY29uc3QgY2hhcjE2X3QqIGN1cl91dGYxNiA9IHNyYzsKLSAgICBjb25zdCBjaGFyMTZfdCogY29uc3QgZW5kX3V0ZjE2ID0gc3JjICsgc3JjX2xlbjsKLSAgICBjaGFyICpjdXIgPSBkc3Q7Ci0gICAgd2hpbGUgKGN1cl91dGYxNiA8IGVuZF91dGYxNikgewotICAgICAgICBjaGFyMzJfdCB1dGYzMjsKLSAgICAgICAgLy8gc3Vycm9nYXRlIHBhaXJzCi0gICAgICAgIGlmKCgqY3VyX3V0ZjE2ICYgMHhGQzAwKSA9PSAweEQ4MDAgJiYgKGN1cl91dGYxNiArIDEpIDwgZW5kX3V0ZjE2Ci0gICAgICAgICAgICAgICAgJiYgKCooY3VyX3V0ZjE2ICsgMSkgJiAweEZDMDApID09IDB4REMwMCkgewotICAgICAgICAgICAgdXRmMzIgPSAoKmN1cl91dGYxNisrIC0gMHhEODAwKSA8PCAxMDsKLSA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2YgbGVhZGluZyBiaXRzLgotICoKLSAqIDExMTEgLT4gNAotICogMTExMCAtPiAzCi0gKiAxMTB4IC0+IDIKLSAqIDEweHggLT4gMQotICogMHh4eCAtPiAxCi0gKi8KLXN0YXRpYyBpbmxpbmUgc2l6ZV90IHV0ZjhfY29kZXBvaW50X2xlbih1aW50OF90IGNoKQotewotICAgIHJldHVybiAoKDB4ZTUwMDAwMDAgPj4gKChjaCA+PiAzKSAmIDB4MWUpKSAmIDMpICsgMTsKLX0KLQotc3RhdGljIGlubGluZSB2b2lkIHV0Zjhfc2hpZnRfYW5kX21hc2sodWludDMyX3QqIGNvZGVQb2ludCwgY29uc3QgdWludDhfdCBieXRlKQotewotICAgICpjb2RlUG9pbnQgPDw9IDY7Ci0gICAgKmNvZGVQb2ludCB8PSAweDNGICYgYnl0ZTsKLX0KLQotc3RhdGljIGlubGluZSB1aW50MzJfdCB1dGY4X3RvX3V0ZjMyX2NvZGVwb2ludChjb25zdCB1aW50OF90ICpzcmMsIHNpemVfdCBsZW5ndGgpCi17Ci0gICAgdWludDMyX3QgdW5pY29kZTsKLQotICAgIHN3aXRjaCAobGVuZ3RoKQotICAgIHsKLSAgICAgICAgY2FzZSAxOgotICAgICAgICAgICAgcmV0dXJuIHNyY1swXTsKLSAgICAgICAgY2FzZSAyOgotICAgICAgICAgICAgdW5pY29kZSA9IHNyY1swXSAmIDB4MWY7Ci0gICAgICAgICAgICB1dGY4X3NoaWZ0X2FuZF9tYXNrKCZ1bmljb2RlLCBzcmNbMV0pOwotICAgICAgICAgICAgcmV0dXJuIHVuaWNvZGU7Ci0gICAgICAgIGNhc2UgMzoKLSAgICAgICAgICAgIHVuaWNvZGUgPSBzcmNbMF0gJiAweDBmOwotICAgICAgICAgICAgdXRmOF9zaGlmdF9hbmRfbWFzaygmdW5pY29kZSwgc3JjWzFdKTsKLSAgICAgICAgICAgIHV0Zjhfc2hpZnRfYW5kX21hc2soJnVuaWNvZGUsIHNyY1syXSk7Ci0gICAgICAg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KKyAgICBuYXRpdmVfYnJpZGdlX3N1cHBvcnRlZDogdHJ1ZSwKKworICAgIGV4cG9ydF9pbmNsdWRlX2RpcnM6IFsiaW5jbHVkZSJdLAorICAgIHNyY3M6IFsKKyAgICAgICAgIkVycm9ycy5jcHAiLAorICAgICAgICAiUmVmQmFzZS5jcHAiLAorICAgICAgICAiU2hhcmVkQnVmZmVyLmNwcCIsCisgICAgICAgICJTdHJpbmcxNi5jcHAiLAorICAgICAgICAiU3RyaW5nOC5jcHAiLAorICAgICAgICAiU3Ryb25nUG9pbnRlci5jcHAiLAorICAgICAgICAiVW5pY29kZS5jcHAiLAorICAgICAgICAiVmVjdG9ySW1wbC5jcHAiLAorICAgIF0sCisKKyAgICBhcGV4X2F2YWlsYWJsZTogWworICAgICAgICAiLy9hcGV4X2F2YWlsYWJsZTphbnlhcGV4IiwKKyAgICAgICAgIi8vYXBleF9hdmFpbGFibGU6cGxhdGZvcm0iLAorICAgIF0sCisKKyAgICBhZmRvOiB0cnVlLAorfQorCitjY19saWJyYXJ5IHsKKyAgICBuYW1lOiAibGlidXRpbHNfYmluZGVyIiwKKyAgICBkZWZhdWx0czogWyJsaWJ1dGlsc19iaW5kZXJfaW1wbF9kZWZhdWx0cyJdLAorfQorCitjY19saWJyYXJ5IHsKKyAgICBuYW1lOiAibGlidXRpbHNfYmluZGVyX3Rlc3RfY29tcGlsZSIsCisgICAgZGVmYXVsdHM6IFsibGlidXRpbHNfYmluZGVyX2ltcGxfZGVmYXVsdHMiXSwKKworICAgIGNmbGFnczogWworICAgICAgICAiLURERUJVR19SRUZTPTEiLAorICAgIF0sCisKKyAgICB2aXNpYmlsaXR5OiBbIjpfX3N1YnBhY2thZ2VzX18iXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImxpYnV0aWxzX2Z1enpfc3RyaW5nOCIsCisgICAgZGVmYXVsdHM6IFsibGlidXRpbHNfZnV6el9kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsiU3RyaW5nOF9mdXp6LmNwcCJdLAorfQorCitjY19mdXp6IHsKKyAgICBuYW1lOiAibGlidXRpbHNfZnV6el9zdHJpbmcxNiIsCisgICAgZGVmYXVsdHM6IFsibGlidXRpbHNfZnV6el9kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsiU3RyaW5nMTZfZnV6ei5jcHAiXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImxpYnV0aWxzX2Z1enpfdmVjdG9yIiwKKyAgICBkZWZhdWx0czogWyJsaWJ1dGlsc19mdXp6X2RlZmF1bHRzIl0sCisgICAgc3JjczogWyJWZWN0b3JfZnV6ei5jcHAiXSwKK30KKworY2NfZnV6eiB7CisgICAgbmFtZTogImxpYnV0aWxzX2Z1enpfcmVmYmFzZSIsCisgICAgZGVmYXVsdHM6IFsibGlidXRpbHNfZnV6el9kZWZhdWx0cyJdLAorICAgIHNyY3M6IFsiUmVmQmFzZV9mdXp6LmNwcCJdLAorfQorCitjY190ZXN0IHsKKyAgICBuYW1lOiAibGlidXRpbHNfYmluZGVyX3Rlc3QiLAorICAgIGhvc3Rfc3VwcG9ydGVkOiB0cnVlLAorCisgICAgc3JjczogWworICAgICAgICAiRXJyb3JzX3Rlc3QuY3BwIiwKKyAgICAgICAgIlNoYXJlZEJ1ZmZlcl90ZXN0LmNwcCIsCisgICAgICAgICJTdHJpbmcxNl90ZXN0LmNwcCIsCisgICAgICAgICJTdHJpbmc4X3Rlc3QuY3BwIiwKKyAgICAgICAgIlN0cm9uZ1BvaW50ZXJfdGVzdC5jcHAiLAorICAgICAgICAiVW5pY29kZV90ZXN0LmNwcCIsCisgICAgICAgICJWZWN0b3JfdGVzdC5jcHAiLAorICAgIF0sCisKKyAgICB0YXJnZXQ6IHsKKyAgICAgICAgYW5kcm9pZDogeworICAgICAgICAgICAgc2hhcmVkX2xpYnM6IFsKKyAgICAgICAgICAgICAgICAibGliYmFzZSIsCisgICAgICAgICAgICAgICAgImxpYmN1dGlscyIsCisgICAgICAgICAgICAgICAgImxpYmxvZyIsCisgICAgICAgICAgICAgICAgImxpYmx6bWEiLAorICAgICAgICAgICAgICAgICJsaWJ1dGlscyIsIC8vIHdoaWNoIGluY2x1ZGVzIGxpYnV0aWxzX2JpbmRlcgorICAgICAgICAgICAgICAgICJsaWJ6IiwKKyAgICAgICAgICAgIF0sCisgICAgICAgIH0sCisgICAgICAgIGxpbnV4OiB7CisgICAgICAgICAgICBzcmNzOiBbCisgICAgICAgICAgICAgICAgIlJlZkJhc2VfdGVzdC5jcHAiLAorICAgICAgICAgICAgXSwKKyAgICAgICAgfSwKKyAgICAgICAgaG9zdDogeworICAgICAgICAgICAgc3RhdGljX2xpYnM6IFsKKyAgICAgICAgICAgICAgICAibGliYmFzZSIsCisgICAgICAgICAgICAgICAgImxpYmxvZyIsCisgICAgICAgICAgICAgICAgImxpYmx6bWEiLAorICAgICAgICAgICAgICAgICJsaWJ1dGlscyIsIC8vIHdoaWNoIGluY2x1ZGVzIGxpYnV0aWxzX2JpbmRlcgorICAgICAgICAgICAgXSwKKyAgICAgICAgfSwKKyAgICB9LAorCisgICAgY2ZsYWdzOiBbCisgICAgICAgICItV2FsbCIsCisgICAgICAgICItV2V4dHJhIiwKKyAgICAgICAgIi1XZXJyb3IiLAorICAgICAgICAiLVd0aHJlYWQtc2FmZXR5IiwKKyAgICBdLAorCisgICAgdGVzdF9zdWl0ZXM6IFsiZGV2aWNlLXRlc3RzIl0sCit9CisKK2NjX2JlbmNobWFyayB7CisgICAgbmFtZTogImxpYnV0aWxzX2JpbmRlcl9iZW5jaG1hcmsiLAorICAgIHNyY3M6IFsiVmVjdG9yX2JlbmNobWFyay5jcHAiXSwKKyAgICBzaGFyZWRfbGliczogWyJsaWJ1dGlscyJdLAorfQpkaWZmIC0tZ2l0IGEvbGlidXRpbHMvRXJyb3JzLmNwcCBiL2xpYnV0aWxzL2JpbmRlci9FcnJvcnMuY3BwCnNpbWlsYXJpdHkgaW5kZXggOTglCnJlbmFtZSBmcm9tIGxpYnV0aWxzL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pZiBBTkRST0lEX1VUSUxTX0NBTExTVEFDS19FTkFCTEVECiAgICAgICAgICAgICBDYWxsU3RhY2s6OmxvZ1N0YWNrKExPR19UQUcpOwogI2VuZGlmCiAgICAgICAgIH0KQEAgLTQwNiw3ICs0MDUsNyBAQAogICAgIHZvaWQgcmVuYW1lUmVmc0lkKHJlZl9lbnRyeSogciwgY29uc3Qgdm9pZCogb2xkX2lkLCBjb25zdCB2b2lkKiBuZXdfaWQpCiAgICAgewogICAgICAgICBpZiAobVRyYWNrRW5hYmxlZCkgewotICAgICAgICAgICAgQXV0b011dGV4IF9sKG1NdXRleCk7CisgICAgICAgICAgICBzdGQ6OmxvY2tfZ3VhcmQ8c3RkOjptdXRleD4gX2wobU11dGV4KTsKICAgICAgICAgICAgIHJlZl9lbnRyeSogcmVmID0gcjsKICAgICAgICAgICAgIHdoaWxlIChyZWYgIT0gTlVMTCkgewogICAgICAgICAgICAgICAgIGlmIChyZWYtPmlkID09IG9sZF9pZCkgewpAQCAtNDI1LDcgKzQyNCw3IEBACiAgICAgICAgICAgICBzbnByaW50ZihidWYsIHNpemVvZihidWYpLCAiXHQlYyBJRCAlcCAocmVmICVkKTpcbiIsCiAgICAgICAgICAgICAgICAgICAgICBpbmMsIHJlZnMtPmlkLCByZWZzLT5yZWYpOwogICAgICAgICAgICAgb3V0LT5hcHBlbmQoYnVmKTsKLSNpZiBERUJVR19SRUZTX0NBTExTVEFDS19FTkFCTEVEICYmIENBTExTVEFDS19FTkFCTEVECisjaWYgREVCVUdfUkVGU19DQUxMU1RBQ0tfRU5BQkxFRCAmJiBBTkRST0lEX1VUSUxTX0NBTExTVEFDS19FTkFCTEVECiAgICAgICAgICAgICBvdXQtPmFwcGVuZChDYWxsU3RhY2s6OnN0YWNrVG9TdHJpbmcoIlx0XHQiLCByZWZzLT5zdGFjay5nZXQoKSkpOwogI2Vsc2UKICAgICAgICAgICAgIG91dC0+YXBwZW5kKCJcdFx0KGNhbGwgc3RhY2tzIGRpc2FibGV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cxNikgLT4gdm9pZCB7CiAgICAgICAgICAgICAgICAgICAgIHN0cjEuaXNTdGF0aWNTdHJpbmcoKTsKQEAgLTM5LDcgKzQxLDcgQEAKICAgICAgICAgICAgICAgICAgICAgc3RyMS5zdGFydHNXaXRoKHN0cjIpOwogICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgIChbXShGdXp6ZWREYXRhUHJvdmlkZXImLCBhbmRyb2lkOjpTdHJpbmcxNiBzdHIxLCBhbmRyb2lkOjpTdHJpbmcxNiBzdHIyKSAtPiB2b2lkIHsKLSAgICAgICAgICAgICAgICAgICAgc3RyMS5jb250YWlucyhzdHIyLnN0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgc3RyMS5jb250YWlucyhzdHIyLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgIChbXShGdXp6ZWREYXRhUHJvdmlkZXImLCBhbmRyb2lkOjpTdHJpbmcxNiBzdHIxLCBhbmRyb2lkOjpTdHJpbmcxNiBzdHIyKSAtPiB2b2lkIHsKICAgICAgICAgICAgICAgICAgICAgc3RyMS5jb21wYXJlKHN0cjIpOwpAQCAtNTIsNyArNTQsNyBAQAogICAgICAgICAgICAgICAgIChbXShGdXp6ZWREYXRhUHJvdmlkZXImIGRhdGFQcm92aWRlciwgYW5kcm9pZDo6U3RyaW5nMTYgc3RyMSwKICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDo6U3RyaW5nMTYgc3RyMikgLT4gdm9pZCB7CiAgICAgICAgICAgICAgICAgICAgIGludCBwb3MgPSBkYXRhUHJvdmlkZXIuQ29uc3VtZUludGVncmFsSW5SYW5nZTxpbnQ+KDAsIHN0cjEuc2l6ZSgpKTsKLSAgICAgICAgICAgICAgICAgICAgc3RyMS5pbnNlcnQocG9zLCBzdHIyLnN0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgc3RyMS5pbnNlcnQocG9zLCBzdHIyLmNfc3RyKCkpOwogICAgICA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AgICAgICAgIFtdKEZ1enplZERhdGFQcm92aWRlciosIGFuZHJvaWQ6OlN0cmluZzgqIHN0cjEsIGFuZHJvaWQ6OlN0cmluZzgqKSAtPiB2b2lkIHsKLSAgICAgICAgICAgICAgICAgICAgc3RyMS0+aXNFbXB0eSgpOworICAgICAgICAgICAgICAgICAgICBzdHIxLT5lbXB0eSgpOwogICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgW10oRnV6emVkRGF0YVByb3ZpZGVyKiwgYW5kcm9pZDo6U3RyaW5nOCogc3RyMSwgYW5kcm9pZDo6U3RyaW5nOCopIC0+IHZvaWQgewogICAgICAgICAgICAgICAgICAgICBzdHIxLT5sZW5ndGgoKTsKQEAgLTQ1LDYgKzQ1LDggQEAKICAgICAgICAgICAgICAgICAgICAgc3RyMS0+dG9Mb3dlcigpOwogICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgW10oRnV6emVkRGF0YVByb3ZpZGVyKiwgYW5kcm9pZDo6U3RyaW5nOCogc3RyMSwgYW5kcm9pZDo6U3RyaW5nOCogc3RyMikgLT4gdm9pZCB7CisgICAgICAgICAgICAgICAgICAgIGlmIChzdHIyLT5zaXplKCkgPT0gMCkgcmV0dXJuOworCiAgICAgICAgICAgICAgICAgICAgIHN0cjEtPnJlbW92ZUFsbChzdHIyLT5jX3N0cigpKTsKICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgIFtdKEZ1enplZERhdGFQcm92aWRlciosIGFuZHJvaWQ6OlN0cmluZzgqIHN0cjEsIGFuZHJvaWQ6OlN0cmluZzgqIHN0cjIpIC0+IHZvaWQgewpAQCAtNjYsMzMgKzY4LDYgQEAKICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0X2luZGV4ID0gZGF0YVByb3ZpZGVyLT5Db25zdW1lSW50ZWdyYWxJblJhbmdlPGludD4oMCwgc3RyMS0+c2l6ZSgpKTsKICAgICAgICAgICAgICAgICAgICAgc3RyMS0+ZmluZChzdHIyLT5jX3N0cigpLCBzdGFydF9pbmRleCk7CiAgICAgICAgICAgICAgICAgfSwKLQotICAgICAgICAgICAgICAgIC8vIFBhdGggaGFuZGxpbmcKLSAgICAgICAgICAgICAgICBbXShGdXp6ZWREYXRhUHJvdmlkZXIqLCBhbmRyb2lkOjpTdHJpbmc4KiBzdHIxLCBhbmRyb2lkOjpTdHJpbmc4KikgLT4gdm9pZCB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cjEtPmdldEJhc2VQYXRoKCk7Ci0gICAgICAgICAgICAgICAgfSwKLSAgICAgICAgICAgICAgICBbXShGdXp6ZWREYXRhUHJvdmlkZXIqLCBhbmRyb2lkOjpTdHJpbmc4KiBzdHIxLCBhbmRyb2lkOjpTdHJpbmc4KikgLT4gdm9pZCB7Ci0gICAgICAgICAgICAgICAgICAgIHN0cjEtPmdldFBhdGhFeHRlbnNpb24oKTsKLSAgICAgICAgICAgICAgICB9LAotICAgICAgICAgICAgICAgIFtdKEZ1enplZERhdGFQcm92aWRlciosIGFuZHJvaWQ6OlN0cmluZzgqIHN0cjEsIGFuZHJvaWQ6OlN0cmluZzgqKSAtPiB2b2lkIHsKLSAgICAgICAgICAgICAgICAgICAgc3RyMS0+Z2V0UGF0aExlYWYoKTsKLSAgICAgICAgICAgICAgICB9LAotICAgICAgICAgICAgICAgIFtdKEZ1enplZERhdGFQcm92aWRlciosIGFuZHJvaWQ6OlN0cmluZzgqIHN0cjEsIGFuZHJvaWQ6OlN0cmluZzgqKSAtPiB2b2lkIHsKLSAgICAgICAgICAgICAgICAgICAgc3RyMS0+Z2V0UGF0aERpcigpOwotICAgICAgICAgICAgICAgIH0sCi0gICAgICAgICAgICAgICAgW10oRnV6emVkRGF0YVByb3ZpZGVyKiwgYW5kcm9pZDo6U3RyaW5nOCogc3RyMSwgYW5kcm9pZDo6U3RyaW5nOCopIC0+IHZvaWQgewotICAgICAgICAgICAgICAgICAgICBzdHIxLT5jb252ZXJ0VG9SZXNQYXRoKCk7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rIHw9IG1hc2s7CisgICAgdXRmMzIgJj0gfih0b19pZ25vcmVfbWFzayA8PCAoNiAqIChudW1fdG9fcmVhZCAtIDEpKSk7CisKKyAgICAqbnVtX3JlYWQgPSBudW1fdG9fcmVhZDsKKyAgICByZXR1cm4gc3RhdGljX2Nhc3Q8aW50MzJfdD4odXRmMzIpOworfQorCitpbnQzMl90IHV0ZjMyX2Zyb21fdXRmOF9hdChjb25zdCBjaGFyICpzcmMsIHNpemVfdCBzcmNfbGVuLCBzaXplX3QgaW5kZXgsIHNpemVfdCAqbmV4dF9pbmRleCkKK3sKKyAgICBpZiAoaW5kZXggPj0gc3JjX2xlbikgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIHNpemVfdCB1bnVzZWRfaW5kZXg7CisgICAgaWYgKG5leHRfaW5kZXggPT0gbnVsbHB0cikgeworICAgICAgICBuZXh0X2luZGV4ID0gJnVudXNlZF9pbmRleDsKKyAgICB9CisgICAgc2l6ZV90IG51bV9yZWFkOworICAgIGludDMyX3QgcmV0ID0gdXRmMzJfYXRfaW50ZXJuYWwoc3JjICsgaW5kZXgsICZudW1fcmVhZCk7CisgICAgaWYgKHJldCA+PSAwKSB7CisgICAgICAgICpuZXh0X2luZGV4ID0gaW5kZXggKyBudW1fcmVhZDsKKyAgICB9CisKKyAgICByZXR1cm4gcmV0OworfQorCitzc2l6ZV90IHV0ZjMyX3RvX3V0ZjhfbGVuZ3RoKGNvbnN0IGNoYXIzMl90ICpzcmMsIHNpemVfdCBzcmNfbGVuKQoreworICAgIGlmIChzcmMgPT0gbnVsbHB0ciB8fCBzcmNfbGVuID09IDApIHsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIHNpemVfdCByZXQgPSAwOworICAgIGNvbnN0IGNoYXIzMl90ICplbmQgPSBzcmMgKyBzcmNfbGVuOworICAgIHdoaWxlIChzcmMgPCBlbmQpIHsKKyAgICAgICAgc2l6ZV90IGNoYXJfbGVuID0gdXRmMzJfY29kZX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Ws7CisgICAgfQorICB9IHdoaWxlICgtLW4pOworCisgIHJldHVybiBkOworfQorCitzaXplX3Qgc3RybGVuMTYoY29uc3QgY2hhcjE2X3QgKnMpCit7CisgIGNvbnN0IGNoYXIxNl90ICpzcyA9IHM7CisgIHdoaWxlICggKnNzICkKKyAgICBzcysrOworICByZXR1cm4gc3MtczsKK30KKworc2l6ZV90IHN0cm5sZW4xNihjb25zdCBjaGFyMTZfdCAqcywgc2l6ZV90IG1heGxlbikKK3sKKyAgY29uc3QgY2hhcjE2X3QgKnNzID0gczsKKworICAvKiBJbXBvcnRhbnQ6IHRoZSBtYXhsZW4gdGVzdCBtdXN0IHByZWNlZGUgdGhlIHJlZmVyZW5jZSB0aHJvdWdoIHNzOworICAgICBzaW5jZSB0aGUgYnl0ZSBiZXlvbmQgdGhlIG1heGltdW0gbWF5IHNlZ2ZhdWx0ICovCisgIHdoaWxlICgobWF4bGVuID4gMCkgJiYgKnNzKSB7CisgICAgc3MrKzsKKyAgICBtYXhsZW4tLTsKKyAgfQorICByZXR1cm4gc3MtczsKK30KKworY2hhcjE2X3QqIHN0cnN0cjE2KGNvbnN0IGNoYXIxNl90KiBzcmMsIGNvbnN0IGNoYXIxNl90KiB0YXJnZXQpCit7CisgICAgY29uc3QgY2hhcjE2X3QgbmVlZGxlID0gKnRhcmdldDsKKyAgICBpZiAobmVlZGxlID09ICdcMCcpIHJldHVybiAoY2hhcjE2X3QqKXNyYzsKKworICAgIGNvbnN0IHNpemVfdCB0YXJnZXRfbGVuID0gc3RybGVuMTYoKyt0YXJnZXQpOworICAgIGRvIHsKKyAgICAgICAgZG8geworICAgICAgICAgICAgaWYgKCpzcmMgPT0gJ1wwJykgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxscHRyOworICAgICAgICAgICAgfQorICAgICAgICB9IHdoaWxlICgqc3JjKysgIT0gbmVlZGxlKTsKKyAgICB9IHdoaWxlIChzdHJuY21wMTYoc3JjLCB0YXJnZXQsIHRhcmdldF9sZW4pICE9IDApOworICAgIHNyYy0tOworCisgICAgcmV0dXJuIChjaGFyMTZfdCopc3JjOworfQorCitpbnQgc3RyemNtcDE2KGNvbnN0IGNoYXIxNl90ICpzMSwgc2l6ZV90IG4xLCBjb25zdCBjaGFyMTZfdCAqczIsIHNpemVfdCBuMikKK3sKKyAgICBjb25zdCBjaGFyMTZfdCogZTEgPSBzMStuMTsKKyAgICBjb25zdCBjaGFyMTZfdCogZTIgPSBzMituMjsKKworICAgIHdoaWxlIChzMSA8IGUxICYmIHMyIDwgZTIpIHsKKyAgICAgICAgY29uc3QgaW50IGQgPSAoaW50KSpzMSsrIC0gKGludCkqczIrKzsKKyAgICAgICAgaWYgKGQpIHsKKyAgICAgICAgICAgIHJldHVybiBkOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIG4xIDwgbjIKKyAgICAgICAgPyAoMCAtIChpbnQpKnMyKQorICAgICAgICA6IChuMSA+IG4yCisgICAgICAgICAgID8gKChpbnQpKnMxIC0gMCkKKyAgICAgICAgICAgOiAwKTsKK30KKworLy8gaXNfYW55X3N1cnJvZ2F0ZSgpIHJldHVybnMgdHJ1ZSBpZiB3IGlzIGVpdGhlciBhIGhpZ2ggb3IgbG93IHN1cnJvZ2F0ZQorc3RhdGljIGNvbnN0ZXhwciBib29sIGlzX2FueV9zdXJyb2dhdGUoY2hhcjE2X3QgdykgeworICAgIHJldHVybiAodyAmIDB4ZjgwMCkgPT0gMHhkODAwOworfQorCisvLyBpc19zdXJyb2dhdGVfcGFpcigpIHJldHVybnMgdHJ1ZSBpZiB3MSBhbmQgdzIgZm9ybSBhIHZhbGlkIHN1cnJvZ2F0ZSBwYWlyCitzdGF0aWMgY29uc3RleHByIGJvb2wgaXNfc3Vycm9nYXRlX3BhaXIoY2hhcjE2X3QgdzEsIGNoYXIxNl90IHcyKSB7CisgICAgcmV0dXJuICgodzEgJiAweGZjMDApID09IDB4ZDgwMCkgJiYgKCh3MiAmIDB4ZmMwMCkgPT0gMHhkYzAwKTsKK30KKworLy8gVE9ETzogY3VycmVudGx5IHV0ZjE2X3RvX3V0ZjhfbGVuZ3RoKCkgcmV0dXJucyAtMSBpZiBzcmNfbGVuID09IDAsCisvLyB3aGljaCBpcyBpbmNvbnNpc3RlbnQgd2l0aCB1dGY4X3RvX3V0ZjE2X2xlbmd0aCgpLCBoZXJlIHdlIGtlZXAgdGhlCisvLyBjdXJyZW50IGJlaGF2aW9yIGFzIGludGVuZGVkIG5vdCB0byBicmVhayBjb21wYXRpYmlsaXR5Citzc2l6ZV90IHV0ZjE2X3RvX3V0ZjhfbGVuZ3RoKGNvbnN0IGNoYXIxNl90ICpzcmMsIHNpemVfdCBzcmNfbGVuKQoreworICAgIGlmIChzcmMgPT0gbnVsbHB0ciB8fCBzcmNfbGVuID09IDApCisgICAgICAgIHJldHVybiAtMTsKKworICAgIGNvbnN0IGNoYXIxNl90KiBjb25zdCBlbmQgPSBzcmMgKyBzcmNfbGVuOworICAgIGNvbnN0IGNoYXIxNl90KiBpbiA9IHNyYzsKKyAgICBzaXplX3QgdXRmOF9sZW4gPSAwOworCisgICAgd2hpbGUgKGluIDwgZW5kKSB7CisgICAgICAgIGNoYXIxNl90IHcgPSAqaW4rKzsKKyAgICAgICAgaWYgKHcgPCAweDAwODApIFtbbGlrZWx5XV0geworICAgICAgICAgICAgdXRmOF9sZW4gKz0gMTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmICh3IDwgMHgwODAwKSBbW2xpa2VseV1dIHsKKyAgICAgICAgICAgIHV0ZjhfbGVuICs9IDI7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWlzX2FueV9zdXJyb2dhdGUodykpIFtbbGlrZWx5XV0geworICAgICAgICAgICAgdXRmOF9sZW4gKz0gMzsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChpbiA8IGVuZCAmJiBpc19zdXJyb2dhdGVfcGFpcih3LCAqaW4pKSB7CisgICAgICAgICAgICB1dGY4X2xlbiArPSA0OworICAgICAgICAgICAgaW4rKzsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIC8qIHNraXAgaWYgYXQgdGhlIGVuZCBvZiB0aGUgc3RyaW5nIG9yIGludmFsaWQgc3Vycm9nYXRlIHBhaXIgKi8KKyAgICB9CisgICAgcmV0dXJuIChpbiA9PSBlbmQgJiYgdXRmOF9sZW4gPCBTU0laRV9NQVgpID8gdXRmOF9sZW4gOiAtMTsKK30KKwordm9pZCB1dGYxNl90b191dGY4KGNvbnN0IGNoYXIxNl90KiBzcmMsIHNpemVfdCBzcmNfbGVuLCBjaGFyKiBkc3QsIHNpemVfdCBkc3RfbGVuKQoreworICAgIGlmIChzcmMgPT0gbnVsbHB0ciB8fCBzcmNfbGVuID09IDAgfHwgZHN0ID09IG51bGxwdHIpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGNvbnN0IGNoYXIxNl90KiBpbiA9IHNyYzsKKyAgICBjb25zdCBjaGFyMTZfdCogY29uc3QgaW5fZW5kID0gc3JjICsgc3JjX2xlbjsKKyAgICBjaGFyKiBvdXQgPSBkc3Q7CisgICAgY29uc3QgY2hhciogY29uc3Qgb3V0X2VuZCA9IGRzdCArIGRzdF9sZW47CisgICAgY2hhcjE2X3QgdzI7CisKKyAgICBhdXRvIGVycl9vdXQgPSBbJm91dCwgJm91dF9lbmQsICZkc3RfbGVuXSgpIHsKKyAgICAgICAgTE9HX0FMV0FZU19GQVRBTF9JRihvdXQgPj0gb3V0X2VuZCwKKyAgICAgICAgICAgICAgICAidGFyZ2V0IHV0Zjggc3RyaW5nIHNpemUgJXp1IHRvbyBzaG9ydCIsIGRzdF9sZW4pOworICAgIH07CisKKyAgICB3aGlsZSAoaW4gPCBpbl9lbmQpIHsKKyAgICAgICAgY2hhcjE2X3QgdyA9ICppbisrOworICAgICAgICBpZiAodyA8IDB4MDA4MCkgW1tsaWtlbHldXSB7CisgICAgICAgICAgICBpZiAob3V0ICsgMSA+IG91dF9lbmQpCisgICAgICAgICAgICAgICAgcmV0dXJuIGVycl9vdXQoKTsKKyAgICAgICAgICAgICpvdXQrKyA9IChjaGFyKSh3ICYgMHhmZik7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAodyA8IDB4MDgwMCkgW1tsaWtlbHldXSB7CisgICAgICAgICAgICBpZiAob3V0ICsgMiA+IG91dF9lbmQpCisgICAgICAgICAgICAgICAgcmV0dXJuIGVycl9vdXQoKTsKKyAgICAgICAgICAgICpvdXQrKyA9IChjaGFyKSgweGMwIHwgKCh3ID4+IDYpICYgMHgxZikpOworICAgICAgICAgICAgKm91dCsrID0gKGNoYXIpKDB4ODAgfCAoKHcgPj4gMCkgJiAweDNmKSk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoIWlzX2FueV9zdXJyb2dhdGUodykpIFtbbGlrZWx5XV0geworICAgICAgICAgICAgaWYgKG91dCArIDMgPiBvdXRfZW5kKQorICAgICAgICAgICAgICAgIHJldHVybiBlcnJfb3V0KCk7CisgICAgICAgICAgICAqb3V0KysgPSAoY2hhcikoMHhlMCB8ICgodyA+PiAxMikgJiAweGYpKTsKKyAgICAgICAgICAgICpvdXQrKyA9IChjaGFyKSgweDgwIHwgKCh3ID4+IDYpICYgMHgzZikpOworICAgICAgICAgICAgKm91dCsrID0gKGNoYXIpKDB4ODAgfCAoKHcgPj4gMCkgJiAweDNmKSk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICAvKiBzdXJyb2dhdGUgcGFpciAqLworICAgICAgICBpZiAoaW4gPCBpbl9lbmQgJiYgKHcyID0gKmluLCBpc19zdXJyb2dhdGVfcGFpcih3LCB3MikpKSB7CisgICAgICAgICAgICBpZiAob3V0ICsgNCA+IG91dF9lbmQpCisgICAgICAgICAgICAgICAgcmV0dXJuIGV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Ly8gYnJlYWsgY29tcGF0aWJpbGl0eS4gIEhvd2V2ZXIsIHRoaXMgbmVlZHMgdG8gYmUgYWRkcmVzc2VkIGxhdGVyLgorCitzc2l6ZV90IHV0ZjhfdG9fdXRmMTZfbGVuZ3RoKGNvbnN0IHVpbnQ4X3QqIHU4c3RyLCBzaXplX3QgdThsZW4sIGJvb2wgb3ZlcnJlYWRJc0ZhdGFsKQoreworICAgIGlmICh1OHN0ciA9PSBudWxscHRyKQorICAgICAgICByZXR1cm4gLTE7CisKKyAgICBjb25zdCB1aW50OF90KiBjb25zdCBpbl9lbmQgPSB1OHN0ciArIHU4bGVuOworICAgIGNvbnN0IHVpbnQ4X3QqIGluID0gdThzdHI7CisgICAgc2l6ZV90IHV0ZjE2X2xlbiA9IDA7CisKKyAgICB3aGlsZSAoaW4gPCBpbl9lbmQpIHsKKyAgICAgICAgdWludDhfdCBjID0gKmluOworICAgICAgICB1dGYxNl9sZW4rKzsKKyAgICAgICAgaWYgKChjICYgMHg4MCkgPT0gMCkgW1tsaWtlbHldXSB7CisgICAgICAgICAgICBpbisrOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGMgPCAweGMwKSBbW3VubGlrZWx5XV0geworICAgICAgICAgICAgQUxPR1coIkludmFsaWQgVVRGLTggbGVhZGluZyBieXRlOiAweCUwMngiLCBjKTsKKyAgICAgICAgICAgIGluKys7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoYyA8IDB4ZTApIFtbbGlrZWx5XV0geworICAgICAgICAgICAgaW4gKz0gMjsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChjIDwgMHhmMCkgW1tsaWtlbHldXSB7CisgICAgICAgICAgICBpbiArPSAzOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB1aW50OF90IGMyLCBjMywgYzQ7CisgICAgICAgICAg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lbmQpIHsKKyAgICAgICAgYyA9ICppbisrOworICAgICAgICBpZiAoKGMgJiAweDgwKSA9PSAwKSBbW2xpa2VseV1dIHsKKyAgICAgICAgICAgICpvdXQrKyA9IChjaGFyMTZfdCkoYyk7CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAoYyA8IDB4YzApIFtbdW5saWtlbHldXSB7CisgICAgICAgICAgICBBTE9HVygiSW52YWxpZCBVVEYtOCBsZWFkaW5nIGJ5dGU6IDB4JTAyeCIsIGMpOworICAgICAgICAgICAgKm91dCsrID0gKGNoYXIxNl90KShjKTsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIGlmIChjIDwgMHhlMCkgW1tsaWtlbHldXSB7CisgICAgICAgICAgICBpZiAoaW4gKyAxID4gaW5fZW5kKSBbW3VubGlrZWx5XV0geworICAgICAgICAgICAgICAgIHJldHVybiBlcnJfaW4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGMyID0gKmluKys7CisgICAgICAgICAgICAqb3V0KysgPSAoY2hhcjE2X3QpKCgoYyAmIDB4MWYpIDw8IDYpIHwgKGMyICYgMHgzZikpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGMgPCAweGYwKSBbW2xpa2VseV1dIHsKKyAgICAgICAgICAgIGlmIChpbiArIDIgPiBpbl9lbmQpIFtbdW5saWtlbHldXSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGVycl9pbigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYzIgPSAqaW4rKzsgYzMgPSAqaW4rKzsKKyAgICAgICAgICAgICpvdXQrKyA9IChjaGFyMTZfdCkoKChjICYgMHgwZikgPDwgMTIpIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChjMiAmIDB4M2YpIDw8IDYpIHwgKGMzICYgMHgzZikpOworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoaW4gKyAzID4gaW5fZW5kKSBbW3VubGlrZWx5XV0geworICAgICAgICAgICAgICAgIHJldHVybiBlcnJfaW4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChjID49IDB4ZjgpIFtbdW5saWtlbHldXSB7CisgICAgICAgICAgICAgICAgQUxPR1coIkludmFsaWQgVVRGLTggbGVhZGluZyBieXRlOiAweCUwMngiLCBjKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIE11bHRpcGxlIFVURjE2IGNoYXJhY3RlcnMgd2l0aCBzdXJyb2dhdGVzCisgICAgICAgICAgICBjMiA9ICppbisrOyBjMyA9ICppbisrOyBjNCA9ICppbisrOworICAgICAgICAgICAgdyA9IHV0ZjhfNGJfdG9fdXRmMzIoYywgYzIsIGMzLCBjNCk7CisgICAgICAgICAgICBpZiAodyA8IDB4MTAwMDApIFtbdW5saWtlbHldXSB7CisgICAgICAgICAgICAgICAgKm91dCsrID0gKGNoYXIxNl90KSh3KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaWYgKG91dCArIDIgPiBvdXRfZW5kKSBbW3VubGlrZWx5XV0geworICAgICAgICAgICAgICAgICAgICAvLyBPb29wcy4uLi4gbm90IGVub3VnaCByb29tIGZvciB0aGlzIHN1cnJvZ2F0ZSBwYWlyLgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3V0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAqb3V0KysgPSAoY2hhcjE2X3QpKCgodyAtIDB4MTAwMDApID4+IDEwKSArIDB4ZDgwMCk7CisgICAgICAgICAgICAgICAgKm91dCsrID0gKGNoYXIxNl90KSgoKHcgLSAweDEwMDAwKSAmIDB4M2ZmKSArIDB4ZGMwMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gb3V0O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gICAgICAgICAodm9pZClwcm92aWRlcjsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koImNsZWFyIik7CisgICAgICAgICAgICAgICAgdmVjdG9yLmNsZWFyKCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpcHJvdmlkZXI7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJzaXplIik7CisgICAgICAgICAgICAgICAgdmVjdG9yLnNpemUoKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAgICAodm9pZClwcm92aWRlcjsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koImlzRW1wdHkiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3IuaXNFbXB0eSgpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIFsmXShGdXp6ZWREYXRhUHJvdmlkZXImIHByb3ZpZGVyLCBWZWN0b3I8VD4mIHZlY3RvcikgeworICAgICAgICAgICAgICAgICh2b2lkKXByb3ZpZGVyOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgiY2FwYWNpdHkiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3IuY2FwYWNpdHkoKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAgICBzaXplX3QgdmVjdG9yU2l6ZSA9IHByb3ZpZGVyLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8c2l6ZV90PigwLCBNQVhfVkVDX1NJWkUpOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgic2V0Q2FwYWNpdHkiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3Iuc2V0Q2FwYWNpdHkodmVjdG9yU2l6ZSk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgc2l6ZV90IHZlY3RvclNpemUgPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHNpemVfdD4oMCwgTUFYX1ZFQ19TSVpFKTsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koInJlc2l6ZSIpOworICAgICAgICAgICAgICAgIHZlY3Rvci5yZXNpemUodmVjdG9yU2l6ZSk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpcHJvdmlkZXI7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJhcnJheSIpOworICAgICAgICAgICAgICAgIHZlY3Rvci5hcnJheSgpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIFsmXShGdXp6ZWREYXRhUHJvdmlkZXImIHByb3ZpZGVyLCBWZWN0b3I8VD4mIHZlY3RvcikgeworICAgICAgICAgICAgICAgICh2b2lkKXByb3ZpZGVyOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgiZWRpdEFycmF5Iik7CisgICAgICAgICAgICAgICAgdmVjdG9yLmVkaXRBcnJheSgpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIFsmXShGdXp6ZWREYXRhUHJvdmlkZXImIHByb3ZpZGVyLCBWZWN0b3I8VD4mIHZlY3RvcikgeworICAgICAgICAgICAgICAgIGlmICh2ZWN0b3Iuc2l6ZSgpID09IDApIHJldHVybjsKKyAgICAgICAgICAgICAgICBzaXplX3QgaWR4ID0gcHJvdmlkZXIuQ29uc3VtZUludGVncmFsSW5SYW5nZTxzaXplX3Q+KDAsIHZlY3Rvci5zaXplKCkgLSAxKTsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koIm9wZXJhdG9yW10iKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3JbaWR4XTsgIC8vIHJldHVybnMgYSBjb25zdCB2YWx1ZSBmb3IgVmVjdG9yCisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgaWYgKHZlY3Rvci5zaXplKCkgPT0gMCkgcmV0dXJuOworICAgICAgICAgICAgICAgIHNpemVfdCBpZHggPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHNpemVfdD4oMCwgdmVjdG9yLnNpemUoKSAtIDEpOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgiaXRlbUF0Iik7CisgICAgICAgICAgICAgICAgdmVjdG9yLml0ZW1BdChpZHgpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIFsmXShGdXp6ZWREYXRhUHJvdmlkZXImIHByb3ZpZGVyLCBWZWN0b3I8VD4mIHZlY3RvcikgeworICAgICAgICAgICAgICAgICh2b2lkKXByb3ZpZGVyOworICAgICAgICAgICAgICAgIGlmICh2ZWN0b3Iuc2l6ZSgpID09IDApIHJldHVybjsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koInRvcCIpOworICAgICAgICAgICAgICAgIHZlY3Rvci50b3AoKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAg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Xp1IiwgaWR4LCB2ZWMyLnNpemUoKSk7CisgICAgICAgICAgICAgICAgdmVjdG9yLmluc2VydFZlY3RvckF0KHZlYzIsIGlkeCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJhcHBlbmRWZWN0b3IiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3IuYXBwZW5kVmVjdG9yKHRlc3RWZWN0b3IocHJvdmlkZXIpKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICAvLyBUT0RPOiBpbnNlcnRBcnJheUF0CisgICAgICAgICAgICAvLyBUT0RPOiBhcHBlbmRBcnJheQorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgdWludDhfdCBpZHggPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ4X3Q+KDAsIHZlY3Rvci5zaXplKCkpOworICAgICAgICAgICAgICAgIHVpbnQ4X3QgbnVtSXRlbXMgPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ4X3Q+KDEsIDEwMCk7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJpbnNlcnRBdCIpOworICAgICAgICAgICAgICAgIHZlY3Rvci5pbnNlcnRBdChpZHgsIG51bUl0ZW1zKTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAgICB1aW50OF90IGlkeCA9IHByb3ZpZGVyLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDhfdD4oMCwgdmVjdG9yLnNpemUoKSk7CisgICAgICAgICAgICAgICAgdWludDhfdCBudW1JdGVtcyA9IHByb3ZpZGVyLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDhfdD4oMSwgMTAwKTsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koImluc2VydEF0Iik7CisgICAgICAgICAgICAgICAgdmVjdG9yLmluc2VydEF0KFR7fSwgaWR4LCBudW1JdGVtcyk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpcHJvdmlkZXI7CisgICAgICAgICAgICAgICAgaWYgKHZlY3Rvci5zaXplKCkgPT0gMCkgcmV0dXJuOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgicG9wIik7CisgICAgICAgICAgICAgICAgdmVjdG9yLnBvcCgpOworICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIFsmXShGdXp6ZWREYXRhUHJvdmlkZXImIHByb3ZpZGVyLCBWZWN0b3I8VD4mIHZlY3RvcikgeworICAgICAgICAgICAgICAgICh2b2lkKXByb3ZpZGVyOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgicHVzaCIpOworICAgICAgICAgICAgICAgIHZlY3Rvci5wdXNoKCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpcHJvdmlkZXI7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJhZGQiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3IuYWRkKCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgKHZvaWQpcHJvdmlkZXI7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJhZGQiKTsKKyAgICAgICAgICAgICAgICB2ZWN0b3IuYWRkKFR7fSk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgdWludDhfdCBpZHggPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHVpbnQ4X3Q+KDAsIHZlY3Rvci5zaXplKCkgLSAxKTsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koInJlcGxhY2VBdCIpOworICAgICAgICAgICAgICAgIHZlY3Rvci5yZXBsYWNlQXQoaWR4KTsKKyAgICAgICAgICAgIH0sCisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAgICB1aW50OF90IGlkeCA9IHByb3ZpZGVyLkNvbnN1bWVJbnRlZ3JhbEluUmFuZ2U8dWludDhfdD4oMCwgdmVjdG9yLnNpemUoKSAtIDEpOworICAgICAgICAgICAgICAgIGlmIChrTG9nKSBBTE9HSSgicmVwbGFjZUF0Iik7CisgICAgICAgICAgICAgICAgdmVjdG9yLnJlcGxhY2VBdChUe30sIGlkeCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgWyZdKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIsIFZlY3RvcjxUPiYgdmVjdG9yKSB7CisgICAgICAgICAgICAgICAgaWYgKHZlY3Rvci5zaXplKCkgPT0gMCkgcmV0dXJuOworICAgICAgICAgICAgICAgIHVpbnQ4X3QgaWR4ID0gcHJvdmlkZXIuQ29uc3VtZUludGVncmFsSW5SYW5nZTx1aW50OF90PigwLCB2ZWN0b3Iuc2l6ZSgpIC0gMSk7CisgICAgICAgICAgICAgICAgaWYgKGtMb2cpIEFMT0dJKCJyZW1vdGVJdGVtc0F0Iik7CisgICAgICAgICAgICAgICAgdmVjdG9yLnJlbW92ZUl0ZW1zQXQoaWR4KTsgIC8vIFRPRE86IGRpZmZlcmVudCBjb3VudAorICAgICAgICAgICAgfSwKKyAgICAgICAgICAgIC8vIHJlbW92ZUF0IGlzIGFsaWFzIGZvciByZW1vdmVJdGVtc0F0CisgICAgICAgICAgICAvLyBUT0RPOiBzb3J0CisgICAgICAgICAgICBbJl0oRnV6emVkRGF0YVByb3ZpZGVyJiBwcm92aWRlciwgVmVjdG9yPFQ+JiB2ZWN0b3IpIHsKKyAgICAgICAgICAgICAgICAodm9pZClwcm92aWRlcjsKKyAgICAgICAgICAgICAgICBpZiAoa0xvZykgQUxPR0koImdldEl0ZW1TaXplIik7CisgICAgICAgICAgICAgICAgdmVjdG9yLmdldEl0ZW1TaXplKCk7CisgICAgICAgICAgICB9LAorICAgICAgICAgICAgLy8gVE9ETzogaXRlcmF0b3JzCisgICAgfTsKKworICAgIFZlY3RvcjxUPiB0ZXN0VmVjdG9yKEZ1enplZERhdGFQcm92aWRlciYgcHJvdmlkZXIpIHsKKyAgICAgICAgVmVjdG9yPFQ+IHZlYzsKKyAgICAgICAgc2l6ZV90IHZlY3RvclNpemUgPSBwcm92aWRlci5Db25zdW1lSW50ZWdyYWxJblJhbmdlPHNpemVfdD4oMCwgTUFYX1ZFQ19TSVpFKTsKKyAgICAgICAgcmV0dXJuIHZlYzsKKyAgICB9CisKKyAgICB2b2lkIGZ1enooRnV6emVkRGF0YVByb3ZpZGVyJiYgcHJvdmlkZXIpIHsKKyAgICAgICAgd2hpbGUgKHByb3ZpZGVyLnJlbWFpbmluZ19ieXRlcygpKSB7CisgICAgICAgICAgICBzaXplX3QgZnVuY0lkeCA9IHByb3ZpZGVyLkNvbnN1bWVJbnRlZ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ogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgICAgICBzZXRUbyhjb25zdCBjaGFyMTZfdCogb3RoZXIpOwogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgICAgICBzZXRUbyhjb25zdCBjaGFyMTZfdCogb3RoZXIsIHNpemVfdCBsZW4pOwpAQCAtODYsNiArOTIsNyBAQAogICAgICAgICAgICAgYm9vbCAgICAgICAgICAgICAgICBzdGFydHNXaXRoKGNvbnN0IGNoYXIxNl90KiBwcmVmaXgpIGNvbnN0OwogCiAgICAgICAgICAgICBib29sICAgICAgICAgICAgICAgIGNvbnRhaW5zKGNvbnN0IGNoYXIxNl90KiBjaHJzKSBjb25zdDsKKyAgICBpbmxpbmUgIGJvb2wgICAgICAgICAgICAgICAgY29udGFpbnMoY29uc3QgU3RyaW5nMTYmIG90aGVyKSBjb25zdDsKIAogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgICAgICByZXBsYWNlQWxsKGNoYXIxNl90IHJlcGxhY2VUaGlzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIxNl90IHdpdGhUaGlzKTsKQEAgLTEwOCw2ICsxMTUsMTIgQEAKIAogICAgIGlubGluZSAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRvciBjb25zdCBjaGFyMTZfdCooKSBjb25zdDsKIAorI2lmZGVmIEhBU19TVFJJTkdfVklFVworICAgIC8vIEltcGxpY2l0IGNhc3QgdG8gc3RkOjp1MTZzdHJpbmcgaXMgbm90IGltcGxlbWVudGVkIG9uIHB1cnBvc2UgLSB1MTZzdHJpbmdfdmlldyBpcyBtdWNoCisgICAgLy8gbGlnaHRlciBhbmQgaWYgb25lIG5lZWRzLCB0aGV5IGNhbiBzdGlsbCBjcmVhdGUgdTE2c3RyaW5nIGZyb20gdTE2c3RyaW5nX3ZpZXcuCisgICAgaW5saW5lICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdG9yIHN0ZDo6dTE2c3RyaW5nX3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gICAgICAgICAgICAgICAgICBTdHJpbmc4KGNvbnN0IGNoYXIzMl90KiBvLCBzaXplX3QgbnVtQ2hhcnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB+U3RyaW5nOCgpOwogCi0gICAgc3RhdGljIGlubGluZSBjb25zdCBTdHJpbmc4IGVtcHR5KCk7Ci0KICAgICBzdGF0aWMgU3RyaW5nOCAgICAgICAgICAgICAgZm9ybWF0KGNvbnN0IGNoYXIqIGZtdCwgLi4uKSBfX2F0dHJpYnV0ZV9fKChmb3JtYXQgKHByaW50ZiwgMSwgMikpKTsKICAgICBzdGF0aWMgU3RyaW5nOCAgICAgICAgICAgICAgZm9ybWF0Vihjb25zdCBjaGFyKiBmbXQsIHZhX2xpc3QgYXJncyk7CiAKICAgICBpbmxpbmUgIGNvbnN0IGNoYXIqICAgICAgICAgY19zdHIoKSBjb25zdDsKLSAgICBpbmxpbmUgIGNvbnN0IGNoYXIqICAgICAgICAgc3RyaW5nKCkgY29uc3Q7Ci0KLXByaXZhdGU6Ci0gICAgc3RhdGljIGlubGluZSBzdGQ6OnN0cmluZyAgIHN0ZF9zdHJpbmcoY29uc3QgU3RyaW5nOCYgc3RyKTsKLXB1YmxpYzoKIAogICAgIGlubGluZSAgc2l6ZV90ICAgICAgICAgICAgICBzaXplKCkgY29uc3Q7CiAgICAgaW5saW5lICBzaXplX3QgICAgICAgICAgICAgIGJ5dGVzKCkgY29uc3Q7Ci0gICAgaW5saW5lICBib29sICAgICAgICAgICAgICAgIGlzRW1wdHkoKSBjb25zdDsKKyAgICBpbmxpbmUgIGJvb2wgICAgICAgICAgICAgICAgZW1wdHkoKSBjb25zdDsKIAogICAgICAgICAgICAgc2l6ZV90ICAgICAgICAgICAgICBsZW5ndGgoKSBjb25zdDsKIApAQCAtMTE0LDYgKzExNiwxMCBAQAogCiAgICAgaW5saW5lICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdG9yIGNvbnN0IGNoYXIqKCkgY29uc3Q7CiAKKyNpZmRlZiBIQVNfU1RSSU5HX1ZJRVcKKyAgICBpbmxpbmUgZXhwbGljaXQgICAgICAgICAgICAgb3BlcmF0b3Igc3RkOjpzdHJpbmdfdmlldygpIGNvbnN0OworI2VuZGlmCisKICAgICAgICAgICAgIGNoYXIqICAgICAgICAgICAgICAgbG9ja0J1ZmZlcihzaXplX3Qgc2l6ZSk7CiAgICAgICAgICAgICB2b2lkICAgICAgICAgICAgICAgIHVubG9ja0J1ZmZlcigpOwogICAgICAgICAgICAgc3RhdHVzX3QgICAgICAgICAgICB1bmxvY2tCdWZmZXIoc2l6ZV90IHNpemUpOwpAQCAtMTIxLDEwMSArMTI3LDM1IEBACiAgICAgICAgICAgICAvLyByZXR1cm4gdGhlIGluZGV4IG9mIHRoZSBmaXJzdCBieXRlIG9mIG90aGVyIGluIHRoaXMgYXQgb3IgYWZ0ZXIKICAgICAgICAgICAgIC8vIHN0YXJ0LCBvciAtMSBpZiBub3QgZm91bmQKICAgICAgICAgICAgIHNzaXplX3QgICAgICAgICAgICAgZmluZChjb25zdCBjaGFyKiBvdGhlciwgc2l6ZV90IHN0YXJ0ID0gMCkgY29uc3Q7CisgICAgaW5saW5lICBzc2l6ZV90ICAgICAgICAgICAgIGZpbmQoY29uc3QgU3RyaW5nOCYgb3RoZXIsIHNpemVfdCBzdGFydCA9IDApIGNvbnN0OwogCiAgICAgICAgICAgICAvLyByZXR1cm4gdHJ1ZSBpZiB0aGlzIHN0cmluZyBjb250YWlucyB0aGUgc3BlY2lmaWVkIHN1YnN0cmluZwogICAgIGlubGluZSAgYm9vbCAgICAgICAgICAgICAgICBjb250YWlucyhjb25zdCBjaGFyKiBvdGhlcikgY29uc3Q7CisgICAgaW5saW5lICBib29sICAgICAgICAgICAgICAgIGNvbnRhaW5zKGNvbnN0IFN0cmluZzgmIG90aGVyKSBjb25zdDsKIAogICAgICAgICAgICAgLy8gcmVtb3ZlcyBhbGwgb2NjdXJyZW5jZSBvZiB0aGUgc3BlY2lmaWVkIHN1YnN0cmluZwogICAgICAgICAgICAgLy8gcmV0dXJucyB0cnVlIGlmIGFueSB3ZXJlIGZvdW5kIGFuZCByZW1vdmVkCiAgICAgICAgICAgICBib29sICAgICAgICAgICAgICAgIHJlbW92ZUFsbChjb25zdCBjaGFyKiBvdGhlcik7CisgICAgaW5saW5lICBib29sICAgICAgICAgICAgICAgIHJlbW92ZUFsbChjb25zdCBTdHJpbmc4JiBvdGhlcik7CiAKICAgICAgICAgICAgIHZvaWQgICAgICAgICAgICAgICAgdG9Mb3dlcigpOwogCi0KLSAgICAvKgotICAgICAqIFRoZXNlIG1ldGhvZHMgb3BlcmF0ZSBvbiB0aGUgc3RyaW5nIGFzIGlmIGl0IHdlcmUgYSBwYXRoIG5hbWUuCi0gICAgICovCi0KLSAgICAvKgotICAgICAqIEdldCBqdXN0IHRoZSBmaWxlbmFtZSBjb21wb25lbnQuCi0gICAgICoKLSAgICAgKiAiL3RtcC9mb28vYmFyLmMiIC0tPiAiYmFyLmMiCi0gICAgICovCi0gICAgU3RyaW5nOCBnZXRQYXRoTGVhZih2b2lkKSBjb25zdDsKLQotICAgIC8qCi0gICAgICogUmVtb3ZlIHRoZSBsYXN0IChmaWxlIG5hbWUpIGNvbXBvbmVudCwgbGVhdmluZyBqdXN0IHRoZSBkaXJlY3RvcnkKLSAgICAgKiBuYW1lLgotICAgICAqCi0gICAgICogIi90bXAvZm9vL2Jhci5jIiAtLT4gIi90bXAvZm9vIgotICAgICAqICIvdG1wIiAtLT4gIiIgLy8gPz8/Pz8gc2hvdWxkbid0IHRoaXMgYmUgIi8iID8/Pz8gWFhYCi0gICAgICogImJhci5jIiAtLT4gIiIKLSAgICAgKi8KLSAgICBTdHJpbmc4IGdldFBhdGhEaXIodm9pZCkgY29uc3Q7Ci0KLSAgICAvKgotICAgICAqIFJldHJpZXZlIHRoZSBmcm9udCAocm9vdCBkaXIpIGNvbXBvbmVudC4gIE9wdGlvbmFsbHkgYWxzbyByZXR1cm4gdGhlCi0gICAg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X2RldnBhdGgKKyAgICBkaXJuYW1lIC9kZXYvdmZpbworCiAjIHVldmVudGQgY2FuIG9ubHkgc2V0IHBlcm1pc3Npb25zIG9uIGRldmljZSBub2RlcyBhbmQgdGhlaXIgYXNzb2NpYXRlZAogIyBzeXNmcyBhdHRyaWJ1dGVzLCBub3Qgb24gYXJiaXRyYXJ5IHBhdGhzLgogIwpAQCAtNDMsNiArNDgsNyBAQAogL2Rldi9iaW5kZXIgICAgICAgICAgICAgICAwNjY2ICAgcm9vdCAgICAgICByb290CiAvZGV2L2h3YmluZGVyICAgICAgICAgICAgIDA2NjYgICByb290ICAgICAgIHJvb3QKIC9kZXYvdm5kYmluZGVyICAgICAgICAgICAgMDY2NiAgIHJvb3QgICAgICAgcm9vdAorL2Rldi92ZmlvLyogICAgICAgICAgICAgICAwNjY2ICAgcm9vdCAgICAgICByb290CiAKIC9kZXYvcG1zZzAgICAgICAgICAgICAgICAgMDIyMiAgIHJvb3QgICAgICAgbG9nCiAvZGV2L2RtYV9oZWFwL3N5c3RlbSAgICAgIDA0NDQgICBzeXN0ZW0gICAgIHN5c3RlbQpAQCAtNjUsNiArNzEsNyBAQAogL2Rldi9tdHBfdXNiICAgICAgICAgICAgICAwNjYwICAgcm9vdCAgICAgICBtdHAKIC9kZXYvdXNiX2FjY2Vzc29yeSAgICAgICAgMDY2MCAgIHJvb3QgICAgICAgdXNiCiAvZGV2L3R1biAgICAgICAgICAgICAgICAgIDA2NjAgICBzeXN0ZW0gICAgIHZwbgorL2Rldi9oaWRyYXcqICAgICAgICAgICAgICAwNjYwICAgc3lzdGVtICAgICBzeXN0ZW0KIAogIyBDRE1BIHJhZGlvIGludGVyZmFjZSBNVVgKIC9kZXYvcHBwICAgICAgICAgICAgICAgICAgMDY2MCAgIHJhZGlvICAgICAgdnBuCmRpZmYgLS1naXQgYS9ydW4tYXMvcnVuLWFzLmNwcCBiL3J1bi1hcy9ydW4tYXMuY3BwCmluZGV4IGNjOTJjNjguLjMyMDU3YjQg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kRGF0YVByb3ZpZGVyJiBwcm92aWRlcikgeworICAgIHN0ZDo6dmVjdG9yPFRydXN0eUFwcD4gdHJ1c3R5QXBwczsKIAorICAgIHdoaWxlIChwcm92aWRlci5yZW1haW5pbmdfYnl0ZXMoKSA+IDApIHsKKyAgICAgICAgaWYgKHRydXN0eUFwcHMuc2l6ZSgpIDwgTUFYX0NPTk5FQ1RJT05TICYmIHByb3ZpZGVyLkNvbnN1bWVCb29sKCkpIHsKKyAgICAgICAgICAgIGF1dG8mIHRhID0gdHJ1c3R5QXBwcy5lbXBsYWNlX2JhY2soVElQQ19ERVYsIFRSVVNUWV9BUFBfUE9SVCk7CisgICAgICAgICAgICBjb25zdCBhdXRvIHJlc3VsdCA9IHRhLkNvbm5lY3QoKTsKKyAgICAgICAgICAgIGlmICghcmVzdWx0Lm9rKCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uc3QgYXV0byBpID0gcHJvdmlkZXIuQ29uc3VtZUludGVncmFsSW5SYW5nZTxzaXplX3Q+KDAsIHRydXN0eUFwcHMuc2l6ZSgpKTsKKyAgICAgICAgICAgIHN0ZDo6c3dhcCh0cnVzdHlBcHBzW2ldLCB0cnVzdHlBcHBzLmJhY2soKSk7CisKKyAgICAgICAgICAgIGlmIChwcm92aWRlci5Db25zdW1lQm9vbCgpKSB7CisgICAgICAgICAgICAgICAgYXV0byYgdGEgPSB0cnVzdHlBcHBzLmJhY2soKTsKKworICAgICAgICAgICAgICAgIGNvbnN0IGF1dG8gZGF0YSA9IHByb3ZpZGVyLkNvbnN1bWVSYW5kb21MZW5ndGhTdHJpbmcoKTsKKyAgICAgICAgICAgICAgICBhdXRvIHJlc3VsdCA9IHRhLldyaXRlKGRhdGEuZGF0YSgpLCBkYXRhLnNpemUoKSk7CisgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQub2soKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHN0ZDo6YXJyYXk8dWludDhfdCwgVElQQ19NQVhfTVNHX1NJWkU+IGJ1ZjsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSB0YS5SZWFkKGJ1Zi5kYXRhKCksIGJ1Zi5zaXplKCkpOworICAgICAgICAgICAgICAgIGlmICghcmVzdWx0Lm9rKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBSZWNvbm5lY3QgdG8gZW5zdXJlIHRoYXQgdGhlIHNlcnZpY2UgaXMgc3RpbGwgdXAuCisgICAgICAgICAgICAgICAgdGEuRGlzY29ubmVjdCgpOworICAgICAgICAgICAgICAgIHJlc3VsdCA9IHRhLkNvbm5lY3QoKTsKKyAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdC5vaygpKSB7CisgICAgICAgICAgICAgICAgICAgIHN0ZDo6Y2VyciA8PCByZXN1bHQuZXJyb3IoKSA8PCBzdGQ6OmVuZGw7CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6OnRydXN0eTo6ZnV6ejo6QWJvcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRydXN0eUFwcHMucG9wX2JhY2soKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4ge307Cit9CisKK2V4dGVybiAiQyIgaW50IExMVk1GdXp6ZXJUZXN0T25lSW5wdXQoY29uc3QgdWludDhfdCogZGF0YSwgc2l6ZV90IHNpemUpIHsKICAgICBFeHRyYUNvdW50ZXJzIGNvdW50ZXJzKHJlY29yZC5nZXQoKSk7CiAgICAgY291bnRlcnMuUmVzZXQoKTsK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JnLCBzdHJsZW4ob3B0YXJnKSk7CisgICAgICAgICAgICAgICAgcmVxLmJhc2UuYnJhbmQuUmVpbml0aWFsaXplKG9wdGFyZywgc3RybGVuKG9wdGFyZykpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAnZCc6Ci0gICAgICAgICAgICAgICAgcmVxLmRldmljZS5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CisgICAgICAgICAgICAgICAgcmVxLmJhc2UuZGV2aWNlLlJlaW5pdGlhbGl6ZShvcHRhcmcsIHN0cmxlbihvcHRhcmcpKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ3AnOgotICAgICAgICAgICAgICAgIHJlcS5wcm9kdWN0LlJlaW5pdGlhbGl6ZShvcHRhcmcsIHN0cmxlbihvcHRhcmcpKTsKKyAgICAgICAgICAgICAgICByZXEuYmFzZS5wcm9kdWN0LlJlaW5pdGlhbGl6ZShvcHRhcmcsIHN0cmxlbihvcHRhcmcpKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ3MnOgotICAgICAgICAgICAgICAgIHJlcS5zZXJpYWwuUmVpbml0aWFsaXplKG9wdGFyZywgc3RybGVuKG9wdGFyZykpOworICAgICAgICAgICAgICAgIHJlcS5iYXNlLnNlcmlhbC5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdNJzoKLSAgICAgICAgICAgICAgICByZXEubWFudWZhY3R1cmVyLlJlaW5pdGlhbGl6ZShvcHRhcmcsIHN0cmxlbihvcHRhcmcpKTsKKyAgICAgICAgICAgICAgICByZXEuYmFzZS5tYW51ZmFjdHVyZXIuUmVpbml0aWFsaXplKG9wdGFyZywgc3RybGVuKG9wdGFyZykpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAnbSc6Ci0gICAgICAgICAgICAgICAgcmVxLm1vZGVsLlJlaW5pdGlhbGl6ZShvcHRhcmcsIHN0cmxlbihvcHRhcmcpKTsKKyAgICAgICAgICAgICAgICByZXEuYmFzZS5tb2RlbC5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdpJzoKLSAgICAgICAgICAgICAgICByZXEuaW1laS5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CisgICAgICAgICAgICAgICAgcmVxLmJhc2UuaW1laS5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdjJzoKLSAgICAgICAgICAgICAgICByZXEubWVpZC5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CisgICAgICAgICAgICAgICAgcmVxLmJhc2UubWVpZC5SZWluaXRpYWxpemUob3B0YXJnLCBzdHJsZW4ob3B0YXJnKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlICcyJzoKKyAgICAgICAgICAgICAgICByZXEuc2Vjb25kX2ltZWkuUmVpbml0aWFsaXplKG9wdGFyZywgc3RybGVuKG9wdGFyZykpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAnaCc6CiAgICAgICAgICAgICAgICAgcHJpbnRfdXNhZ2UoYXJndlswXSwgcmVxKTsKQEAgLTE0NCwxOSArMjIwLDMzIEBACiAgICAgICAgICAgICIgIG1hbnVmYWN0dXJlcjogJXNcbiIKICAgICAgICAgICAgIiAgbW9kZWw6ICAgICAgICAlc1xuIgogICAgICAgICAgICAiICBJTUVJOiAgICAgICAgICVzXG4iCi0gICAgICAgICAgICIgIE1FSUQ6ICAgIC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R5S2V5bWFzdGVyUmVzcG9uc2UgcnNwKC8qIHZlciA9ICovIDQpOwotICAgIHJldCA9IHRydXN0eV9rZXltYXN0ZXJfc2VuZChLTV9TRVRfQVRURVNUQVRJT05fSURTLCByZXEsICZyc3ApOwotICAgIGlmIChyZXQpIHsKLSAgICAgICAgZnByaW50ZihzdGRlcnIsICJTRVRfQVRURVNUQVRJT05fSURTIGZhaWxlZDogJWRcbiIsIHJldCk7Ci0gICAgICAgIHRydXN0eV9rZXltYXN0ZXJfZGlzY29ubmVjdCgpOwotICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgIGNvbnN0IGNoYXIqIG1zZzsKKyAgICBpZiAocmVxLnNlY29uZF9pbWVpLmF2YWlsYWJsZV9yZWFkKCkgPT0gMCkgeworICAgICAgICAvLyBObyBTRUNPTkRfSU1FSSBzZXQsIHVzZSBiYXNlIGNvbW1hbmQuCisgICAgICAgIHJldCA9IHRydXN0eV9rZXltYXN0ZXJfc2VuZChLTV9TRVRfQVRURVNUQVRJT05fSURTLCByZXEuYmFzZSwgJnJzcCk7CisgICAgICAgIG1zZyA9ICJTRVRfQVRURVNUQVRJT05fSURTIjsKKyAgICB9IGVsc2UgeworICAgICAgICAvLyBTRUNPTkRfSU1FSSBpcyBzZXQsIHVzZSB1cGRhdGVkIGNvbW1hbmQuCisgICAgICAgIHJldCA9IHRydXN0eV9rZXltYXN0ZXJfc2VuZChLTV9TRVRfQVRURVNUQVRJT05fSURTX0tNMywgcmVxLCAmcnNwKTsKKyAgICAgICAgbXNnID0gIlNFVF9BVFRFU1RBVElPTl9JRFNfS00zIjsKICAgICB9CisgICAgdHJ1c3R5X2tleW1hc3Rlcl9kaXNjb25uZWN0KCk7CiAKLSAgICByZXR1cm4gRVhJVF9TVUNDRVNTOworICAgIGlmIChyZXQpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICIlcyBmYWlsZWQ6ICVkXG4iLCBtc2csIHJldCk7CisgICAgICAgIHJldHVybiBFW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KLSAgICBzaXplX3QgYnVmX3NpemUgPSBQQUdFX1NJWkUgKiBudW1fcGFnZXM7CisgICAgc2l6ZV90IGJ1Zl9zaXplID0gbWVtcmVmX2NodW5rX3NpemUgKiBudW1fY2h1bmtzOwogICAgIGRtYV9idWYgPSBEbWFidWZIZWFwQWxsb2MoYWxsb2NhdG9yLCAic3lzdGVtIiwgYnVmX3NpemUsIDAsIDAgLyogbGVnYWN5IGFsaWduICovKTsKICAgICBpZiAoZG1hX2J1ZiA8IDApIHsKICAgICAgICAgcmV0ID0gZG1hX2J1ZjsKQEAgLTkyNywxMyArOTI4LDE3IEBACiAgICAgdGlwY19jbG9zZShmZCk7CiAKICAgICByZXQgPSAwOwotICAgIGZvciAoc2l6ZV90IHNraXAgPSAwOyBza2lwIDwgbnVtX3BhZ2VzOyBza2lwKyspIHsKLSAgICAgICAgcmV0IHw9IHN0cmNtcCgiSGVsbG8gZnJvbSBUcnVzdHkhIiwgKGNvbnN0IGNoYXIqKSZidWZbc2tpcCAqIFBBR0VfU0laRV0pID8gKC0xKSA6IDA7CisgICAgZm9yIChzaXplX3Qgc2tpcCA9IDA7IHNraXAgPCBudW1fY2h1bmtzOyBza2lwKyspIHsKKyAgICAgICAgaW50IGNtcCA9IHN0cmNtcCgiSGVsbG8gZnJvbSBUcnVzdHkhIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAoY29uc3QgY2hhciopJmJ1Zltza2lwICogbWVtcmVmX2NodW5rX3NpemVdKSA/ICgtMSkgOiAwOworICAgICAgICBpZiAoY21wKQorICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJGYWlsZWQ6IFVuZXhwZWN0ZWQgY29udGVudCBhdCBwYWdlICV6dSBpbiBkbWFidWZcbiIsIHNraXApOworICAgICAgICByZXQgfD0gY21wOwogICAgIH0KIAogY2xlYW51cDoKICAgICBpZiAoYnVmICE9IE1BUF9GQUlMRUQpIHsKLSAgICAgICAgbXVubWFwKChjaGFyKilidWYsIFBBR0VfU0laRSk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dWlkXygqdXVpZCksCisgICAgICByZWNvcmRfbGVuXygwKSwKKyAgICAgIHNobV8oTlVMTCksCisgICAgICBzaG1fbGVuXygwKSB7fQorCitDb3ZlcmFnZVJlY29yZDo6fkNvdmVyYWdlUmVjb3JkKCkgeworICAgIGlmIChzaG1fKSB7CisgICAgICAgIG11bm1hcCgodm9pZCopc2htXywgc2htX2xlbl8pOworICAgIH0KK30KKwordm9sYXRpbGUgdm9pZCAqQ292ZXJhZ2VSZWNvcmQ6OmdldFNobSgpIHsKKyAgICBpZighSXNPcGVuKCkpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJXYXJuaW5nISBTSE0gaXMgTlVMTCFcbiIpOworICAgIH0KKyAgICByZXR1cm4gc2htXzsKK30KKworUmVzdWx0PHZvaWQ+IENvdmVyYWdlUmVjb3JkOjpScGMoc3RydWN0IGxpbmVfY292ZXJhZ2VfY2xpZW50X3JlcSogcmVxLCBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHJlcV9mZCwgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCBsaW5lX2NvdmVyYWdlX2NsaWVudF9yZXNwKiByZXNwKSB7CisgICAgaW50IHJjOworCisgICAgaWYgKHJlcV9mZCA8IDApIHsKKyAgICAgICAgcmMgPSB3cml0ZShjb3ZlcmFnZV9zcnZfZmRfLCByZXEsIHNpemVvZigqcmVxKSk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgaW92ZWMgaW92ID0geworICAgICAgICAgICAgICAgIC5pb3ZfYmFzZSA9IHJlcSwKKyAgICAgICAgICAgICAgICAuaW92X2xlbiA9IHNpemVvZigqcmVxKSwKKyAgICAgICAgfTsKKworICAgICAgICB0cnVzdHlfc2htIHNobSA9IHsKKyAgICAgICAgICAgICAgICAuZmQgPSByZXFfZmQsCisgICAgICAgICAgICAgICAgLnRyYW5zZmVyID0gVFJVU1RZX1NIQVJFLAorICAgICAgICB9OworCisgICAgICAgIHJjID0gdGlwY19zZW5kKGNvdmVyYWdlX3Nydl9mZF8sICZpb3YsIDEsICZzaG0sIDEpOworICAgIH0KKworICAgIGlmIChyYyAhPSAoaW50KXNpemVvZigqcmVxKSkgeworICAgICAgICByZXR1cm4gRXJybm9FcnJvcigpIDw8ICJmYWlsZWQgdG8gc2VuZCByZXF1ZXN0IHRvIGNvdmVyYWdlIHNlcnZlcjogIjsKKyAgICB9CisKKyAgICByYyA9IHJlYWQoY292ZXJhZ2Vfc3J2X2ZkXywgcmVzcCwgc2l6ZW9mKCpyZXNwKSk7CisgICAgaWYgKHJjICE9IChpbnQpc2l6ZW9mKCpyZXNwKSkgeworICAgICAgICByZXR1cm4gRXJybm9FcnJvcigpIDw8ICJmYWlsZWQgdG8gcmVhZCByZXBseSBmcm9tIGNvdmVyYWdlIHNlcnZlcjogIjsKKyAgICB9CisKKyAgICBpZiAocmVzcC0+aGRyLmNtZCAhPSAocmVxLT5oZHIuY21kIHwgTElORV9DT1ZFUkFHRV9DTElFTlRfQ01EX1JFU1BfQklUKSkgeworICAgICAgICByZXR1cm4gRXJybm9FcnJvcigpIDw8ICJ1bmtub3duIHJlc3BvbnNlIGNtZDogIiA8PCByZXNwLT5oZHIuY21kOworICAgIH0KKworICAgIHJldHVybiB7fTsKK30KKworUmVzdWx0PHZvaWQ+IENvdmVyYWdlUmVjb3JkOjpPcGVuKGludCBmZCkgeworICAgIHN0cnVjdCBsaW5lX2NvdmVyYWdlX2NsaWVudF9yZXEgcmVxOworICAgIHN0cnVjdCBsaW5lX2NvdmVyYWdlX2NsaWVudF9yZXNwIHJlc3A7CisKKyAgICBpZiAoc2htXykgeworICAgICAgICByZXR1cm4ge307IC8qIGFscmVhZHkgaW5pdGlhbGl6ZWQgKi8KKyAgICB9CisKKyAgICBjb3ZlcmFnZV9zcnZfZmRfPSBmZDsKKworICAgIHJlcS5oZHIuY21kID0gTElORV9DT1ZFUkFHRV9DTElFTlRfQ01EX09QRU47CisgICAgcmVxLm9wZW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Jlc3ApOworICAgIGlmICghcmV0Lm9rKCkpIHsKKyAgICAgICAgcmV0dXJuIEVycm9yKCkgPDwgImZhaWxlZCB0byBzZW5kIHNoYXJlZCBtZW1vcnk6ICIgPDwgcmV0LmVycm9yKCk7CisgICAgfQorCisgICAgc2htXyA9IHNobTsKKworICAgIHJlcS5oZHIuY21kID0gTElORV9DT1ZFUkFHRV9DTElFTlRfQ01EX09QRU47CisgICAgcmVxLm9wZW5fYXJncy51dWlkID0gdXVpZF87CisgICAgcmV0ID0gUnBjKCZyZXEsIC0xLCAmcmVzcCk7CisgICAgaWYgKCFyZXQub2soKSkgeworICAgICAgICByZXR1cm4gRXJyb3IoKSA8PCAiZmFpbGVkIHRvIG9wZW4gY292ZXJhZ2UgY2xpZW50OiAiIDw8IHJldC5lcnJvcigpOworICAgIH0KKworICAgIHJldHVybiB7fTsKK30KKworYm9vbCBDb3ZlcmFnZVJlY29yZDo6SXNPcGVuKCkgeworICAgIHJldHVybiBzaG1fOworfQorCitSZXN1bHQ8dm9pZD4gQ292ZXJhZ2VSZWNvcmQ6OlNhdmVGaWxlKGNvbnN0IHN0ZDo6c3RyaW5nJiBmaWxlbmFtZSkgeworICAgIGlmKCFJc09wZW4oKSkgeworICAgICAgICByZXR1cm4gRXJybm9FcnJvcigpIDw8ICJXYXJuaW5nISBTSE0gaXMgTlVMTCEiOworICAgIH0KKyAgICBhbmRyb2lkOjpiYXNlOjp1bmlxdWVfZmQgb3V0cHV0X2ZkKFRFTVBfRkFJTFVSRV9SRVRSWShjcmVhdChmaWxlbmFtZS5jX3N0cigpLCAwMDY0NCkpKTsKKyAgICBpZiAoIW91dHB1dF9mZC5vaygpKSB7CisgICAgICAgIHJldHVybiBFcnJub0Vycm9yKCkgPDwgIkNvdWxkIG5vdCBvcGVuIG91dHB1dCBmaWxlIjsKKyAgICB9CisKKyAgICB1aW50cHRyX3QqIGJlZ2luID0gKHVpbnRwdHJfdCopKChjaGFyICopc2htXyArIHNpemVvZihzdHJ1Y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gICAgICAgICAgICAgICAgICAgICAgICAgICBrVHJ1c3R5Q3Jhc2hlclV1aWQpOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUShTdHJpbmc4KHZlbmRvckF0b20udmFsdWVzWzBdLmdldDxWZW5kb3JBdG9tVmFsdWU6OnN0cmluZ1ZhbHVlPigpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAga1RydXN0eUNyYXNoZXJVdWlkKTsKICAgICAgICAgICAgICAgICBhdG9tQ3Jhc2hSZWFzb25zLnB1c2hfYmFjayh2ZW5kb3JBdG9tLnZhbHVlc1sxXS5nZXQ8VmVuZG9yQXRvbVZhbHVlOjppbnRWYWx1ZT4oKSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIFRydXN0eUF0b21zOjpUcnVzdHlTdG9yYWdlRXJyb3I6CkBAIC0zNDQsNyArMzQ0LDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgVHJ1c3R5QXRvbXM6OlRydXN0eUVycm9yOgogICAgICAgICAgICAgICAgICsrYXRvbVRydXN0eUVycm9yQ250OwotICAgICAgICAgICAgICAgIEFTU0VSVF9TVFJFUShTdHJpbmc4KHZlbmRvckF0b20udmFsdWVzWzFdLmdldDxWZW5kb3JBdG9tVmFsdWU6OnN0cmluZ1ZhbHVlPigpKSwgIiIpOworICAgICAgICAgICAgICAgIEFTU0VSVF9FUShTdHJpbmc4KHZlbmRvckF0b20udmFsdWVzWzFdLmdldDxWZW5kb3JBdG9tVmFsdWU6OnN0cmluZ1ZhbHVlPigpKSwgIiIpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICBGQUlMKCkgPDwgIlVua25vd24gdmVuZG9yIGF0b20gSUQ6ICIgPDwgdmVuZG9yQXRvbS5hdG9tSWQ7CmRpZmYgLS1naXQgYS90cnVzdHkvdXRpbHMvYWN2cC90cnVzdHl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KQEAgLTIxNywxNyArMjE4LDI0IEBACiAgICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOwogICAgICAgICB9CiAKLSAgICAgICAgTW9kdWxlV3JhcHBlciB3cmFwcGVyOwotICAgICAgICBhdXRvIHJlcyA9IHdyYXBwZXIuU2VuZE1lc3NhZ2UoYXJncyk7Ci0gICAgICAgIGlmICghcmVzLm9rKCkpIHsKLSAgICAgICAgICAgIHN0ZDo6Y2VyciA8PCByZXMuZXJyb3IoKSA8PCBzdGQ6OmVuZGw7Ci0gICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOwotICAgICAgICB9CisgICAgICAgIGlmIChFcVN0cmluZyhhcmdzWzBdLCAiZmx1c2giKSkgeworICAgICAgICAgICAgaWYgKCFic3NsOjphY3ZwOjpGbHVzaEJ1ZmZlcihTVERPVVRfRklMRU5PKSkgeworICAgICAgICAgICAgICAgIEFMT0dFKCJDb3VsZCBub3QgZmx1c2ggdGhlIGJ1ZmZlciB0byBzdGRvdXRcbiIpOworICAgICAgICAgICAgICAgIHJldHVybiBFWElUX0ZBSUxVUkU7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBNb2R1bGVXcmFwcGVyIHdyYXBwZXI7CisgICAgICAgICAgICBhdXRvIHJlcyA9IHdyYXBwZXIuU2VuZE1lc3NhZ2UoYXJncyk7CisgICAgICAgICAgICBpZiAoIXJlcy5vaygpKSB7CisgICAgICAgICAgICAgICAgc3RkOjpjZXJyIDw8IHJlcy5lcnJvcigpIDw8IHN0ZDo6ZW5kbDsKKyAgICAgICAgICAgICAgICByZXR1cm4gRVhJVF9GQUlMVVJFOworICAgICAgICAgICAgfQogCi0gICAgICAgIHJlcyA9IHdyYXBwZXIuRm9yd2FyZFJlc3BvbnNlKCk7Ci0gICAgICAgIGlmICghcmVzLm9rKCkpIHsKLSAgICAgICAgICAgIHN0ZDo6Y2VyciA8PCByZXMuZXJyb3IoKSA8PCBzdGQ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QURfT05DRSgoY29udHJvbC0+d3JpdGVfYnVmZmVyX3N0YXJ0X2NvdW50KSk7CisgICAgICAgICAgICBjb21wbGV0ZV9jbnQgPSBSRUFEX09OQ0UoY29udHJvbC0+d3JpdGVfYnVmZmVyX2NvbXBsZXRlX2NvdW50KTsKKyAgICAgICAgICAgIGZsYWdzID0gUkVBRF9PTkNFKGNvbnRyb2wtPmNudHJsX2ZsYWdzKTsKKworICAgICAgICAgICAgaWYgKGNvbXBsZXRlX2NudCAhPSBjb3VudGVyc1tpbmRleF0gJiYgc3RhcnRfY250ID09IGNvbXBsZXRlX2NudCkgeworICAgICAgICAgICAgICAgIFdSSVRFX09OQ0UoY29udHJvbC0+Y250cmxfZmxhZ3MsIEZMQUdfTk9ORSk7CisgICAgICAgICAgICAgICAgc3RkOjpzdHJpbmcgZmlsZW5hbWU7CisgICAgICAgICAgICAgICAgZmlsZW5hbWUgPSBhbmRyb2lkOjpiYXNlOjpTdHJpbmdQcmludGYoIi8lcy4lIiBQUkl1NjQgIi5wcm9mcmF3IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dWlkX2xpc3RfW2luZGV4XS5jX3N0cigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50ZXJzW2luZGV4XSk7CisgICAgICAgICAgICAgICAgZmlsZW5hbWUuaW5zZXJ0KDAsIG91dHB1dF9kaXIpOworICAgICAgICAgICAgICAgIGFuZHJvaWQ6OmJhc2U6OlJlc3VsdDx2b2lkPiByZXMgPSByZWNvcmRfbGlzdF9baW5kZXhdLT5TYXZlRmlsZShmaWxlbmFtZSk7CisgICAgICAgICAgICAgICAgY291bnRlcnNbaW5kZXhdKys7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZihjb21wbGV0ZV9jbnQgPT0gY291bnRlcnNbaW5kZXhdICYmCisgICAgICAgICAgICAgICAgIShmbGFncyAmIEZMQUdfU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ZXEpKSB7CisgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImZhaWxlZCB0byBzZW5kIHJlcXVlc3QgdG8gY292ZXJhZ2Ugc2VydmVyOiAlZFxuIiwgcmMpOworICAgICAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIHdoaWxlKDEpIHsKKyAgICAgICAgcmMgPSByZWFkKGNvdmVyYWdlX3Nydl9mZCwgJnJlc3AsIHNpemVvZihyZXNwKSk7CisgICAgICAgIGlmIChyYyAhPSAoaW50KXNpemVvZihyZXNwKSkgeworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJmYWlsZWQgdG8gcmVhZCByZXBseSBmcm9tIGNvdmVyYWdlIHNlcnZlcjo6ICVkXG4iLCByYyk7CisgICAgICAgIH0KKworICAgICAgICBpZiAocmVzcC5oZHIuY21kID09IChyZXEuaGRyLmNtZCB8IExJTkVfQ09WRVJBR0VfQ0xJRU5UX0NNRF9SRVNQX0JJVCkpIHsKKyAgICAgICAgICAgIGlmICghbWVtY21wKCZyZXNwLnNlbmRfbGlzdF9hcmdzLnV1aWQsICZ6ZXJvX3V1aWQsIHNpemVvZihzdHJ1Y3QgdXVpZCkpKSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZih1dWlkX3NldF8uZmluZChyZXNwLnNlbmRfbGlzdF9hcmdzLnV1aWQpID09IHV1aWRfc2V0Xy5lbmQoKSkgeworICAgICAgICAgICAgICAgIHV1aWRfc2V0Xy5pbnNlcnQocmVzcC5zZW5kX2xpc3RfYXJncy51dWlkKTsKKyAgICAgICAgICAgICAgICBzcHJpbnRmKHV1aWRfc3RyLAorICAgICAgICAgICAgICAgICAgICAiJTA4IiBQUkl4MzIgIi0lMDQiIFBSSXgxNiAiLSUwNCIgUFJJeDE2ICItJTAyIiBQUkl4OCAiJTAyIiBQUkl4OAorICAgICAgICAgICAgICAgICAgICAiLSUwMiIgUFJJeDggIiUwMiIgUFJJeDggIiUwMiIgUFJJeDggIiUwMiIgUFJJeDggIiUwMiIgUFJJeDggIiUwMiIgUFJJeDgsCisgICAgICAgICAgICAgICAgICAgIHJlc3Auc2VuZF9saXN0X2FyZ3MudXVpZC50aW1lX2xvdywKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLnRpbWVfbWlkLAorICAgICAgICAgICAgICAgICAgICByZXNwLnNlbmRfbGlzdF9hcmdzLnV1aWQudGltZV9oaV9hbmRfdmVyc2lvbiwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVswXSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVsxXSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVsyXSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVszXSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVs0XSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVs1XSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVs2XSwKKyAgICAgICAgICAgICAgICAgICAgcmVzcC5zZW5kX2xpc3RfYXJncy51dWlkLmNsb2NrX3NlcV9hbmRfbm9kZVs3XSk7CisgICAgICAgICAgICAgICAgdXVpZF9saXN0Xy5wdXNoX2JhY2sodXVpZF9zdHIpOworICAgICAgICAgICAgICAgIHJlY29yZF9saXN0Xy5wdXNoX2JhY2soc3RkOjptYWtlX3VuaXF1ZTxDb3ZlcmFnZVJlY29yZD4oVElQQ19ERVYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZyZXNwLnNlbmRfbGlzdF9hcmdzLnV1aWQpKTsKKyAgICAgICAgICAgICAgICBjb3VudGVycy5wdXNoX2JhY2soMCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIlVua25vd24gcmVzcG9uc2UgaGVhZGVyXG4iKTsKKyAgICAgICAgfQorICAgICAgICBjdXJfaW5kZXgrKzsKKyAgICAgICAgcmVxLmhkci5jbWQgPSBMSU5FX0NPVkVSQUdFX0NMSUVOVF9DTURfU0VORF9MSVNUOworICAgICAgICByZXEuc2VuZF9saXN0X2FyZ3MuaW5kZXggPSBjdXJfaW5kZXg7CisgICAgICAgIGludCByYyA9IHdyaXRlKGNvdmVyYWdlX3Nydl9mZCwgJnJlcSwgc2l6ZW9mKHJlcSkpOworICAgICAgICBpZiAocmMgIT0gKGludClzaXplb2YocmVxKSkgeworICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJmYWlsZWQgdG8gc2VuZCByZXF1ZXN0IHRvIGNvdmVyYWdlIHNlcnZlcjogJWRcbiIsIHJjKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZvcihpbnQgaW5kID0gMCA7IGluZCA8IHJlY29yZF9saXN0Xy5zaXplKCkgOyBpbmQrKykgeworICAgICAgICByZWNvcmRfbGlzdF9baW5kXS0+T3Blbihjb3ZlcmFnZV9zcnZfZmQpOworICAgIH0KK30KKworCit9ICAvLyBuYW1lc3BhY2UgY29udHJvbGxlcgorfSAgLy8gbmFtZXNwYWNlIHRydXN0eQorfSAgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkgeworCisgICAgc3RkOjpzdHJpbmcgb3B0YXJnID0gIiI7CisgICAgZG8geworICAgICAgICBpbnQgYzsKKyAgICAgICAgYyA9IGdldG9wdChhcmdjLCBhcmd2LCAibyIpOworCisgICAgICAgIGlmIChjID09IC0xKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICBjYXNlICdvJzoKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJ1c2FnZTogJXMgLW8gW291dHB1dF9kaXJlY3RvcnldXG4iLCBhcmd2WzBdKTsKKyAgICAgICAgICAgIGV4aXQoRVhJVF9GQUlMVVJFKTsKKyAgICAgICAgfQorICAgIH0gd2hpbGUgKDEpOworCisgICAgaWYgKGFyZ2MgPiBvcHRpbmQgKyAxKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiJXM6IHRvbyBtYW55IGFyZ3VtZW50c1xuIiwgYXJndlswXSk7CisgICAgICAgIGV4aXQoRVhJVF9GQUlMVVJFKTsKKyAgICB9CisKKyAgICBpZiAoYXJnYyA+IG9wdGluZCkgeworICAgICAgICBvcHRhcmcgPSBhcmd2W29wdGluZF07CisgICAgfQorICAgIGlmIChvcHRhcmcuc2l6ZSgpPT0wKSB7CisgICAgICAgIG9wdGFyZyA9ICJkYXRhL2xvY2FsL3RtcCI7CisgICAgfQorCisgICAgYW5kcm9pZDo6dHJ1c3R5Ojpjb250cm9sbGVyOjpDb250cm9sbGVyIGN1cjsKKyAgICBjdXIucnVuKG9wdGFyZyk7CisKKyAgICByZXR1cm4gRVhJVF9TVUNDRVNTOworfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL3RydXN0eS91dGlscy9jb3ZlcmFnZS1jb250cm9sbGVyL2NvbnRyb2xsZXIuaCBiL3RydXN0eS91dGl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