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ZmOworICB1bnNpZ25lZCBzaG9ydCAgIGRfcmVjbGVuOworICB1bnNpZ25lZCBjaGFyICAgIGRfdHlwZTsKKyAgY2hhciAgICAgICAgICAgICBkX25hbWVbMjU2XTsKIH07CiAKLXR5cGVkZWYgc3RydWN0IERJUiAgRElSOwordHlwZWRlZiBzdHJ1Y3QgRElSIERJUjsKKworZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogZGlycGF0aCk7CitleHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7CitleHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50KiBlbnRyeSwgc3RydWN0IGRpcmVudCoqIHJlc3VsdCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCBzdHJ1Y3QgZGlyZW50KiogYSwgY29uc3Qgc3RydWN0IGRpcmVudCoqIGIpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciogZGlyLCBzdHJ1Y3QgZGlyZW50KioqIG5hbWVsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqY29tcGFyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCoqKSk7CiAKIGV4dGVybiAgaW50ICAgICAgICAgICAgICBnZXRkZW50cyh1bnNpZ25lZCBpbnQsIHN0cnVjdCBkaXJlbnQqLCB1bnNpZ25lZCBpbnQpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogIGRpcnBhdGgpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOwotZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQgKmVudHJ5LCBzdHJ1Y3QgZGlyZW50ICoqcmVzdWx0KTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSICpkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCB2b2lkICphLCBjb25zdCB2b2lkICpiKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbnN0IGNoYXIgKmRpciwgc3RydWN0IGRpcmVudCAqKipuYW1lbGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqZmlsdGVyKShjb25zdCBzdHJ1Y3QgZGlyZW50ICopLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQgKiosIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBkaXJlbnQgKiopKTsKIAog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YmxlciBVc2VyJ3MgR3VpZGUsIFJFViBhbmQgUkVWMTYgYXJlIGF2YWlsYWJsZQorICogaW4gVGh1bWIgY29kZSBhbmQgMTYtYml0IGluc3RydWN0aW9ucyB3aGVuIHVzZWQgaW4gVGh1bWItMiBjb2RlLgorICoKKyAqIFJFViBSZCwgUm0KKyAqICAgUmQgYW5kIFJtIG11c3QgYm90aCBiZSBMbyByZWdpc3RlcnMuCisgKgorICogUkVWMTYgUmQsIFJtCisgKiAgIFJkIGFuZCBSbSBtdXN0IGJvdGggYmUgTG8gcmVnaXN0ZXJzLgorICoKKyAqIFRoZSArbCBjb25zdHJhaW50IHRha2VzIGNhcmUgb2YgdGhpcyB3aXRob3V0IGNvbnN0cmFpbmluZyB1cyBpbiBBUk0gbW9kZS4KKyAqLworI2RlZmluZSBfX3N3YXAxNm1kKHgpICh7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZWdpc3RlciB1X2ludDE2X3QgX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX19hc20gdm9sYXRpbGUgKCJyZXYxNiAlMCwgJTAiIDogIitsIiAoX3gpKTsgICAgICAgICAgICAgICAgXAorICAgIF94OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKK30pCisKKyNkZWZpbmUgX19zd2FwMzJtZCh4KSAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmVnaXN0ZXIgdV9pbnQzMl90IF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIF9fYXNtIHZvbGF0aWxlICgicmV2ICUwLCAlMCIgOiAiK2wiIChfeCkpOyAgICAgICAgICAgICAgICAgIFwKKyAgICBfeDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9KQorCisjZGVma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ysrIGIvOC9wbGF0Zm9ybXMvYW5kcm9pZC0xNC9hcmNoLW1pcHMvdXNyL2luY2x1ZGUvZGlyZW50LmgKQEAgLTUxLDI4ICs1MSwyOSBAQAogICogd2hvIGFzc3VtZSB0byBiZSBhYmxlIHRvIGFjY2VzcyBpdCBkaXJlY3RseS4gc2FkLi4uCiAgKi8KIHN0cnVjdCBkaXJlbnQgewotICAgIHVpbnQ2NF90ICAgICAgICAgZF9pbm87Ci0gICAgaW50NjRfdCAgICAgICAgICBkX29mZjsKLSAgICB1bnNpZ25lZCBzaG9ydCAgIGRfcmVjbGVuOwotICAgIHVuc2lnbmVkIGNoYXIgICAgZF90eXBlOwotICAgIGNoYXIgICAgICAgICAgICAgZF9uYW1lWzI1Nl07CisgIHVpbnQ2NF90ICAgICAgICAgZF9pbm87CisgIGludDY0X3QgICAgICAgICAgZF9vZmY7CisgIHVuc2lnbmVkIHNob3J0ICAgZF9yZWNsZW47CisgIHVuc2lnbmVkIGNoYXIgICAgZF90eXBlOworICBjaGFyICAgICAgICAgICAgIGRfbmFtZVsyNTZdOwogfTsKIAotdHlwZWRlZiBzdHJ1Y3QgRElSICBESVI7Cit0eXBlZGVmIHN0cnVjdCBESVIgRElSOworCitleHRlcm4gIERJUiogICAgICAgICAgICAgb3BlbmRpcihjb25zdCBjaGFyKiBkaXJwYXRoKTsKK2V4dGVybiAgRElSKiAgICAgICAgICAgICBmZG9wZW5kaXIoaW50IGZkKTsKK2V4dGVybiAgc3RydWN0IGRpcmVudCogICByZWFkZGlyKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQqIGVudHJ5LCBzdHJ1Y3QgZGlyZW50KiogcmVzdWx0KTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqIGRpcnApOworZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGRpcmZkKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgYWxwaGFzb3J0KGNvbnN0IHN0cnVjdCBkaXJlbnQqKiBhLCBjb25zdCBzdHJ1Y3QgZGlyZW50KiogYik7CitleHRlcm4gIGludCAgICAgICAgICAgICAgc2NhbmRpcihjb25zdCBjaGFyKiBkaXIsIHN0cnVjdCBkaXJlbnQqKiogbmFtZWxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmZpbHRlcikoY29uc3Qgc3RydWN0IGRpcmVudCopLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJ1Y3QgZGlyZW50KiopKTsKIAogZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGdldGRlbnRzKHVuc2lnbmVkIGludCwgc3RydWN0IGRpcmVudCosIHVuc2lnbmVkIGludCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgb3BlbmRpcihjb25zdCBjaGFyKiAgZGlycGF0aCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7Ci1leHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICByZWFkZGlyX3IoRElSKiAgZGlycCwgc3RydWN0IGRpcmVudCAqZW50cnksIHN0cnVjdCBkaXJlbnQgKipyZXN1bHQpOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGNsb3NlZGlyKERJUiogIGRpcnApOwotZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIgKmRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGRpcmZkKERJUiog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KKyAgY2hhciAgICAgICAgICAgICBkX25hbWVbMjU2XTsKIH07CiAKLXR5cGVkZWYgc3RydWN0IERJUiAgRElSOwordHlwZWRlZiBzdHJ1Y3QgRElSIERJUjsKKworZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogZGlycGF0aCk7CitleHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7CitleHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50KiBlbnRyeSwgc3RydWN0IGRpcmVudCoqIHJlc3VsdCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCBzdHJ1Y3QgZGlyZW50KiogYSwgY29uc3Qgc3RydWN0IGRpcmVudCoqIGIpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciogZGlyLCBzdHJ1Y3QgZGlyZW50KioqIG5hbWVsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqY29tcGFyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCoqKSk7CiAKIGV4dGVybiAgaW50ICAgICAgICAgICAgICBnZXRkZW50cyh1bnNpZ25lZCBpbnQsIHN0cnVjdCBkaXJlbnQqLCB1bnNpZ25lZCBpbnQpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogIGRpcnBhdGgpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOwotZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQgKmVudHJ5LCBzdHJ1Y3QgZGlyZW50ICoqcmVzdWx0KTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSICpkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCB2b2lkICphLCBjb25zdCB2b2lkICpiKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbnN0IGNoYXIgKmRpciwgc3RydWN0IGRpcmVudCAqKipuYW1lbGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqZmlsdGVyKShjb25zdCBzdHJ1Y3QgZGlyZW50ICopLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQgKiosIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBkaXJlbnQgKiopKTsKIAogX19FTkRfREVDTFMKIApkaWZmIC0tZ2l0IGEvOC9wbGF0Zm9ybXMvYW5kcm9pZC0xNC9hcmNoLXg4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FybS91c3IvaW5jbHVkZS9kaXJlbnQuaAorKysgYi84L3BsYXRmb3Jtcy9hbmRyb2lkLTMvYXJjaC1hcm0vdXNyL2luY2x1ZGUvZGlyZW50LmgKQEAgLTUxLDI4ICs1MSwyOSBAQAogICogd2hvIGFzc3VtZSB0byBiZSBhYmxlIHRvIGFjY2VzcyBpdCBkaXJlY3RseS4gc2FkLi4uCiAgKi8KIHN0cnVjdCBkaXJlbnQgewotICAgIHVpbnQ2NF90ICAgICAgICAgZF9pbm87Ci0gICAgaW50NjRfdCAgICAgICAgICBkX29mZjsKLSAgICB1bnNpZ25lZCBzaG9ydCAgIGRfcmVjbGVuOwotICAgIHVuc2lnbmVkIGNoYXIgICAgZF90eXBlOwotICAgIGNoYXIgICAgICAgICAgICAgZF9uYW1lWzI1Nl07CisgIHVpbnQ2NF90ICAgICAgICAgZF9pbm87CisgIGludDY0X3QgICAgICAgICAgZF9vZmY7CisgIHVuc2lnbmVkIHNob3J0ICAgZF9yZWNsZW47CisgIHVuc2lnbmVkIGNoYXIgICAgZF90eXBlOworICBjaGFyICAgICAgICAgICAgIGRfbmFtZVsyNTZdOwogfTsKIAotdHlwZWRlZiBzdHJ1Y3QgRElSICBESVI7Cit0eXBlZGVmIHN0cnVjdCBESVIgRElSOworCitleHRlcm4gIERJUiogICAgICAgICAgICAgb3BlbmRpcihjb25zdCBjaGFyKiBkaXJwYXRoKTsKK2V4dGVybiAgRElSKiAgICAgICAgICAgICBmZG9wZW5kaXIoaW50IGZkKTsKK2V4dGVybiAgc3RydWN0IGRpcmVudCogICByZWFkZGlyKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQqIGVudHJ5LCBzdHJ1Y3QgZGlyZW50KiogcmVzdWx0KTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqIGRpcnApOworZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGRpcmZkKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgYWxwaGFzb3J0KGNvbnN0IHN0cnVjdCBkaXJlbnQqKiBhLCBjb25zdCBzdHJ1Y3QgZGlyZW50KiogYik7CitleHRlcm4gIGludCAgICAgICAgICAgICAgc2NhbmRpcihjb25zdCBjaGFyKiBkaXIsIHN0cnVjdCBkaXJlbnQqKiogbmFtZWxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmZpbHRlcikoY29uc3Qgc3RydWN0IGRpcmVudCopLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJ1Y3QgZGlyZW50KiopKTsKIAogZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGdldGRlbnRzKHVuc2lnbmVkIGludCwgc3RydWN0IGRpcmVudCosIHVuc2lnbmVkIGludCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgb3BlbmRpcihjb25zdCBjaGFyKiAgZGlycGF0aCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7Ci1leHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICByZWFkZGlyX3IoRElSKiAgZGlycCwgc3RydWN0IGRpcmVudCAqZW50cnksIHN0cnVjdCBkaXJlbnQgKipyZXN1bHQpOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGNsb3NlZGlyKERJUiogIGRpcnApOwotZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIgKmRpcnApOwotZXh0ZXJuICBpbnQ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oInJldjE2ICUwLCAlMCIgOiAiK2wiIChfeCkpOyAgICAgICAgICAgICAgICBcCisgICAgX3g7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorfSkKKworI2RlZmluZSBfX3N3YXAzMm1kKHgpICh7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZWdpc3RlciB1X2ludDMyX3QgX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX19hc20gdm9sYXRpbGUgKCJyZXYgJTAsICUwIiA6ICIrbCIgKF94KSk7ICAgICAgICAgICAgICAgICAgXAorICAgIF94OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKK30pCisKKyNkZWZpbmUgX19zd2FwNjRtZCh4KSAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgdV9pbnQ2NF90IF9zd2FwNjRtZF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICh1X2ludDY0X3QpIF9fc3dhcDMybWQoX3N3YXA2NG1kX3ggPj4gMzIpIHwgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgKHVfaW50NjRfdCkgX19zd2FwMzJtZChfc3dhcDY0bWRfeCAmIDB4ZmZmZmZmZmYpIDw8IDMyOyBcCit9KQorCisvKiBUZWxsIHN5cy9lbmRpYW4uaCB3ZSBoYXZlIE1EIHZhcmlhbnRzIG9mIHRoZSBzd2FwIG1hY3Jvcy4gICovCisjZGVmaW5lIE1EX1NXQVAKKworI2VuZGlmICAvKiBfX0FSTV9BUkNIX18gKi8KKyNlbmRpZiAgLyogX19HTlVDX18gKi8KKworI2lmIGRlZmluZWQoX19BUk1FQl9fKQorI2RlZmluZSBfQllURV9PUkRFUiBfQklHX0VORElBTgorI2Vsc2UKKyNkZWZpbmUgX0JZVEV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HJ1Y3QgZGlyZW50KiBlbnRyeSwgc3RydWN0IGRpcmVudCoqIHJlc3VsdCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCBzdHJ1Y3QgZGlyZW50KiogYSwgY29uc3Qgc3RydWN0IGRpcmVudCoqIGIpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciogZGlyLCBzdHJ1Y3QgZGlyZW50KioqIG5hbWVsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqY29tcGFyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCoqKSk7CiAKIGV4dGVybiAgaW50ICAgICAgICAgICAgICBnZXRkZW50cyh1bnNpZ25lZCBpbnQsIHN0cnVjdCBkaXJlbnQqLCB1bnNpZ25lZCBpbnQpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogIGRpcnBhdGgpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOwotZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQgKmVudHJ5LCBzdHJ1Y3QgZGlyZW50ICoqcmVzdWx0KTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSICpkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCB2b2lkICphLCBjb25zdCB2b2lkICpiKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbnN0IGNoYXIgKmRpciwgc3RydWN0IGRpcmVudCAqKipuYW1lbGlzdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqZmlsdGVyKShjb25zdCBzdHJ1Y3QgZGlyZW50ICopLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQgKiosIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBkaXJlbnQgKiopKTsKIAogX19FTkRfREVDTFMKIApkaWZmIC0tZ2l0IGEvOC9wbGF0Zm9ybXMvYW5kcm9pZC00L2FyY2gtYXJtL3Vzci9pbmNsdWRlL2Vycm5vLmggYi84L3BsYXRmb3Jtcy9hbmRyb2lkLTQvYXJjaC1hcm0vdXNyL2luY2x1ZGUvZXJybm8uaAppbmRleCAyYjI2ODVhLi5lMWIxNWMwIDEwMDY0NAotLS0gYS84L3BsYXRmb3Jtcy9hbmRyb2lkLTQvYXJjaC1hcm0vdXNyL2luY2x1ZGUvZXJybm8uaAorKysgYi84L3BsYXRmb3Jtcy9hbmRyb2lkLTQvYXJjaC1hcm0vdXNyL2luY2x1ZGUvZXJybm8uaApAQCAtMzYsNyArMzYsNyBAQAogLyogb24gTGludXgsIEVOT1RTVVAgYW5kIEVPUE5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gICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZWdpc3RlciB1X2ludDE2X3QgX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX19hc20gdm9sYXRpbGUgKCJyZXYxNiAlMCwgJTAiIDogIitsIiAoX3gpKTsgICAgICAgICAgICAgICAgXAorICAgIF94OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKK30pCisKKyNkZWZpbmUgX19zd2FwMzJtZCh4KSAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmVnaXN0ZXIgdV9pbnQzMl90IF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIF9fYXNtIHZvbGF0aWxlICgicmV2ICUwLCAlMCIgOiAiK2wiIChfeCkpOyAgICAgICAgICAgICAgICAgIFwKKyAgICBfeDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9KQorCisjZGVmaW5lIF9fc3dhcDY0bWQoeCkgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHVfaW50NjRfdCBfc3dhcDY0bWRfeCA9ICh4KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAodV9pbnQ2NF90KSBfX3N3YXAzMm1kKF9zd2FwNjRtZF94ID4+IDMyKSB8ICAgICAgICAgICAgICAgICBcCisgICAgICAgICh1X2ludDY0X3QpIF9fc3dhcDMybWQoX3N3YXA2NG1kX3ggJiAweGZmZmZmZmZmKSA8PCAzMjsgXAorfSkKKworLyogVGVsbCBzeXMvZW5kaWFuLmggd2UgaGF2ZSBNRCB2YXJpYW50cyBvZiB0aGUgc3dhcCBtYWNyb3MuICAqLworI2RlZmluZSBNRF9TV0FQCisKKyNlbmRpZiAgLyogX19BUk1fQVJDSF9fIC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ICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQqIGVudHJ5LCBzdHJ1Y3QgZGlyZW50KiogcmVzdWx0KTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqIGRpcnApOworZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGRpcmZkKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgYWxwaGFzb3J0KGNvbnN0IHN0cnVjdCBkaXJlbnQqKiBhLCBjb25zdCBzdHJ1Y3QgZGlyZW50KiogYik7CitleHRlcm4gIGludCAgICAgICAgICAgICAgc2NhbmRpcihjb25zdCBjaGFyKiBkaXIsIHN0cnVjdCBkaXJlbnQqKiogbmFtZWxpc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmZpbHRlcikoY29uc3Qgc3RydWN0IGRpcmVudCopLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpjb21wYXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJ1Y3QgZGlyZW50KiopKTsKIAogZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGdldGRlbnRzKHVuc2lnbmVkIGludCwgc3RydWN0IGRpcmVudCosIHVuc2lnbmVkIGludCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgb3BlbmRpcihjb25zdCBjaGFyKiAgZGlycGF0aCk7Ci1leHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7Ci1leHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICByZWFkZGlyX3IoRElSKiAgZGlycCwgc3RydWN0IGRpcmVudCAqZW50cnksIHN0cnVjdCBkaXJlbnQgKipyZXN1bHQpOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGNsb3NlZGlyKERJUiogIGRpcnApOwotZXh0ZXJuICB2b2lkICAgICAgICAgICAgIHJld2luZGRpcihESVIgKmRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGRpcmZkKERJUiogZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgYWxwaGFzb3J0KGNvbnN0IHZvaWQgKmEsIGNvbnN0IHZvaWQgKmIpOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciAqZGlyLCBzdHJ1Y3QgZGlyZW50ICoqKm5hbWVsaXN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQgKiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmNvbXBhcikoY29uc3Qgc3RydWN0IGRpcmVudCAqKiwgCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCAqKikpOwogCiBfX0VORF9ERUNMUwogCmRpZmYgLS1naXQgYS84L3BsYXRmb3Jtcy9hbmRyb2lkLTUvYXJjaC1hcm0vdXNyL2luY2x1ZGUvZXJybm8uaCBiLzgvcGxhdGZvcm1zL2FuZHJvaWQtNS9hcmNoLWFybS91c3IvaW5jbHVkZS9lcnJuby5oCmluZGV4IDJiMjY4NWEuLmUxYjE1YzAgMTAwNjQ0Ci0tLSBhLzgvcGxhdGZvcm1zL2FuZHJvaWQtNS9hcmNoLWFybS91c3IvaW5jbHVkZS9lcnJuby5oCisrKyBiLzgvcGxhdGZvcm1zL2FuZHJvaWQtNS9hcmNoLWFybS91c3IvaW5jbHVkZS9lcnJuby5oCkBAIC0zNiw3ICszNiw3IEBACiAvKiBv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VmaW5lIF9fc3dhcDE2bWQoeCkgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHJlZ2lzdGVyIHVfaW50MTZfdCBfeCA9ICh4KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfX2FzbSB2b2xhdGlsZSAoInJldjE2ICUwLCAlMCIgOiAiK2wiIChfeCkpOyAgICAgICAgICAgICAgICBcCisgICAgX3g7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorfSkKKworI2RlZmluZSBfX3N3YXAzMm1kKHgpICh7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZWdpc3RlciB1X2ludDMyX3QgX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX19hc20gdm9sYXRpbGUgKCJyZXYgJTAsICUwIiA6ICIrbCIgKF94KSk7ICAgICAgICAgICAgICAgICAgXAorICAgIF94OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKK30pCisKKyNkZWZpbmUgX19zd2FwNjRtZCh4KSAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgdV9pbnQ2NF90IF9zd2FwNjRtZF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICh1X2ludDY0X3QpIF9fc3dhcDMybWQoX3N3YXA2NG1kX3ggPj4gMzIpIHwgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgKHVfaW50NjRfdCkgX19zd2FwMzJtZChfc3dhcDY0bWRfeCAmIDB4ZmZmZmZmZmYpIDw8IDMyOyBcCit9KQorCisvKiBUZWxsIHN5cy9lbmRpYW4uaCB3ZSBoYXZlIE1EIHZhcmlhbnRzIG9mIHRoZSBzd2FwIG1hY3Jvcy4gICovCisjZGVmaW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ZW50cnksIHN0cnVjdCBkaXJlbnQqKiByZXN1bHQpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGNsb3NlZGlyKERJUiogZGlycCk7CitleHRlcm4gIHZvaWQgICAgICAgICAgICAgcmV3aW5kZGlyKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgZGlyZmQoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBhbHBoYXNvcnQoY29uc3Qgc3RydWN0IGRpcmVudCoqIGEsIGNvbnN0IHN0cnVjdCBkaXJlbnQqKiBiKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbnN0IGNoYXIqIGRpciwgc3RydWN0IGRpcmVudCoqKiBuYW1lbGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqZmlsdGVyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmNvbXBhcikoY29uc3Qgc3RydWN0IGRpcmVudCoqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBkaXJlbnQqKikpOwogCiBleHRlcm4gIGludCAgICAgICAgICAgICAgZ2V0ZGVudHModW5zaWduZWQgaW50LCBzdHJ1Y3QgZGlyZW50KiwgdW5zaWduZWQgaW50KTsKLWV4dGVybiAgRElSKiAgICAgICAgICAgICBvcGVuZGlyKGNvbnN0IGNoYXIqICBkaXJwYXRoKTsKLWV4dGVybiAgRElSKiAgICAgICAgICAgICBmZG9wZW5kaXIoaW50IGZkKTsKLWV4dGVybiAgc3RydWN0IGRpcmVudCogICByZWFkZGlyKERJUiogIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50ICplbnRyeSwgc3RydWN0IGRpcmVudCAqKnJlc3VsdC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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmVnaXN0ZXIgdV9pbnQxNl90IF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIF9fYXNtIHZvbGF0aWxlICgicmV2MTYgJTAsICUwIiA6ICIrbCIgKF94KSk7ICAgICAgICAgICAgICAgIFwKKyAgICBfeDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9KQorCisjZGVmaW5lIF9fc3dhcDMybWQoeCkgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHJlZ2lzdGVyIHVfaW50MzJfdCBfeCA9ICh4KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfX2FzbSB2b2xhdGlsZSAoInJldiAlMCwgJTAiIDogIitsIiAoX3gpKTsgICAgICAgICAgICAgICAgICBcCisgICAgX3g7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorfSkKKworI2RlZmluZSBfX3N3YXA2NG1kKHgpICh7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB1X2ludDY0X3QgX3N3YXA2NG1kX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgKHVfaW50NjRfdCkgX19zd2FwMzJtZChfc3dhcDY0bWRfeCA+PiAzMikgfCAgICAgICAgICAgICAgICAgXAorICAgICAgICAodV9pbnQ2NF90KSBfX3N3YXAzMm1kKF9zd2FwNjRtZF94ICYgMHhmZmZmZmZmZikgPDwgMzI7IFwKK30pCisKKy8qIFRlbGwgc3lzL2VuZGlhbi5oIHdlIGhhdmUgTUQgdmFyaWFudHMgb2YgdGhlIHN3YXAgbWFjcm9zLiAgKi8KKyNkZWZpbmUgTURfU1dBUAorCisjZW5kaWYgIC8qIF9fQV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m9pZC05L2FyY2gtYXJtL3Vzci9pbmNsdWRlL2RpcmVudC5oCkBAIC01MSwyOCArNTEsMjkgQEAKICAqIHdobyBhc3N1bWUgdG8gYmUgYWJsZSB0byBhY2Nlc3MgaXQgZGlyZWN0bHkuIHNhZC4uLgogICovCiBzdHJ1Y3QgZGlyZW50IHsKLSAgICB1aW50NjRfdCAgICAgICAgIGRfaW5vOwotICAgIGludDY0X3QgICAgICAgICAgZF9vZmY7Ci0gICAgdW5zaWduZWQgc2hvcnQgICBkX3JlY2xlbjsKLSAgICB1bnNpZ25lZCBjaGFyICAgIGRfdHlwZTsKLSAgICBjaGFyICAgICAgICAgICAgIGRfbmFtZVsyNTZdOworICB1aW50NjRfdCAgICAgICAgIGRfaW5vOworICBpbnQ2NF90ICAgICAgICAgIGRfb2ZmOworICB1bnNpZ25lZCBzaG9ydCAgIGRfcmVjbGVuOworICB1bnNpZ25lZCBjaGFyICAgIGRfdHlwZTsKKyAgY2hhciAgICAgICAgICAgICBkX25hbWVbMjU2XTsKIH07CiAKLXR5cGVkZWYgc3RydWN0IERJUiAgRElSOwordHlwZWRlZiBzdHJ1Y3QgRElSIERJUjsKKworZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogZGlycGF0aCk7CitleHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7CitleHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50KiBlbnRyeSwgc3RydWN0IGRpcmVudCoqIHJlc3VsdCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCBzdHJ1Y3QgZGlyZW50KiogYSwgY29uc3Qgc3RydWN0IGRpcmVudCoqIGIpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciogZGlyLCBzdHJ1Y3QgZGlyZW50KioqIG5hbWVsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqY29tcGFyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCoqKSk7CiAKIGV4dGVybiAgaW50ICAgICAgICAgICAgICBnZXRkZW50cyh1bnNpZ25lZCBpbnQsIHN0cnVjdCBkaXJlbnQqLCB1bnNpZ25lZCBpbnQpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogIGRpcnBhdGgpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOwotZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQgKmVudHJ5LCBzdHJ1Y3QgZGlyZW50ICoqcmVzdWx0KTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSICpkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOwotZ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WNoaW5lL2NwdS1mZWF0dXJlcy5oPiBiZWNhdXNlIGl0IHBvbGx1dGVzIHRoZQorICogbmFtZXNwYWNlIHdpdGggbWFjcm9zIGxpa2UgUExELgorICovCisjaWYgIWRlZmluZWQgX19BUk1fQVJDSF81X18gJiYgIWRlZmluZWQgX19BUk1fQVJDSF81VF9fICYmIFwKKyAgICAhZGVmaW5lZCBfX0FSTV9BUkNIXzVURV9fICYmICFkZWZpbmVkIF9fQVJNX0FSQ0hfNVRFSl9fICYmIFwKKyAgICAhZGVmaW5lZCBfX0FSTV9BUkNIXzRUX18gJiYgIWRlZmluZWQgX19BUk1fQVJDSF80X18KKworLyogQWNjb3JkaW5nIHRvIFJlYWxWaWV3IEFzc2VtYmxlciBVc2VyJ3MgR3VpZGUsIFJFViBhbmQgUkVWMTYgYXJlIGF2YWlsYWJsZQorICogaW4gVGh1bWIgY29kZSBhbmQgMTYtYml0IGluc3RydWN0aW9ucyB3aGVuIHVzZWQgaW4gVGh1bWItMiBjb2RlLgorICoKKyAqIFJFViBSZCwgUm0KKyAqICAgUmQgYW5kIFJtIG11c3QgYm90aCBiZSBMbyByZWdpc3RlcnMuCisgKgorICogUkVWMTYgUmQsIFJtCisgKiAgIFJkIGFuZCBSbSBtdXN0IGJvdGggYmUgTG8gcmVnaXN0ZXJzLgorICoKKyAqIFRoZSArbCBjb25zdHJhaW50IHRha2VzIGNhcmUgb2YgdGhpcyB3aXRob3V0IGNvbnN0cmFpbmluZyB1cyBpbiBBUk0gbW9kZS4KKyAqLworI2RlZmluZSBfX3N3YXAxNm1kKHgpICh7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICByZWdpc3RlciB1X2ludDE2X3QgX3ggPSAoeCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX19hc20gdm9sYXRpbGUgKCJyZXYxNiAlMCwgJTAiIDogIitsIiAoX3gpKTsgICAgICAgICAgICAgICAgXAorICAgIF94OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKK30pCisKKyNkZWZpbmUgX19zd2FwMzJtZCh4KSAoeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmVnaXN0ZXIgdV9pbnQzMl90IF94ID0gKHgpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIF9fYXNtIHZvbGF0aWxlICgicmV2ICUwLCAlMCIgOiAiK2wiIChfeCkpOyAgICAgICAgICAgICAgICAgIFwKKyAgICBfeDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCit9KQorCisjZGVmaW5lIF9fc3dhcDY0bWQoeCkgKHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHVfaW50NjRfdCBfc3dhcDY0bWRfeCA9ICh4KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAodV9pbnQ2NF90KSBfX3N3YXAzMm1kKF9zd2FwNjRtZF94ID4+IDMyKSB8ICAgICAgICAgICAgICAgICBcCisgICAgICAgICh1X2ludDY0X3QpIF9fc3dhcDMybWQoX3N3YXA2NG1kX3ggJiAweGZmZmZmZmZmKSA8PCAzMjsgXAorfSkKKworLyogVGVsbCBzeXMvZW5kaWFuLmggd2UgaGF2ZSBNRCB2YXJpYW50cyBvZiB0aGUgc3dhcCBtYWNyb3MuICAqLworI2RlZmluZSBNRF9TV0FQCisKKyNlbmRpZiAgLyogX19BUk1fQVJDSF9fICovCisjZW5kaWYgIC8qIF9fR05VQ19fICovCisKKyNpZiBkZWZpbmVkKF9fQVJNRUJfXykKKyNkZWZpbmUgX0JZVEVfT1JERVIgX0JJR19FTkRJQU4KKyNlbHNlCisjZGVmaW5lIF9CWVRFX09SREVSIF9MSVRUTEVfRU5ESUFOCisjZW5kaWYKKyNkZWZpbmUgX19TVFJJQ1RfQUxJ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QgZGlyZWN0bHkuIHNhZC4uLgogICovCiBzdHJ1Y3QgZGlyZW50IHsKLSAgICB1aW50NjRfdCAgICAgICAgIGRfaW5vOwotICAgIGludDY0X3QgICAgICAgICAgZF9vZmY7Ci0gICAgdW5zaWduZWQgc2hvcnQgICBkX3JlY2xlbjsKLSAgICB1bnNpZ25lZCBjaGFyICAgIGRfdHlwZTsKLSAgICBjaGFyICAgICAgICAgICAgIGRfbmFtZVsyNTZdOworICB1aW50NjRfdCAgICAgICAgIGRfaW5vOworICBpbnQ2NF90ICAgICAgICAgIGRfb2ZmOworICB1bnNpZ25lZCBzaG9ydCAgIGRfcmVjbGVuOworICB1bnNpZ25lZCBjaGFyICAgIGRfdHlwZTsKKyAgY2hhciAgICAgICAgICAgICBkX25hbWVbMjU2XTsKIH07CiAKLXR5cGVkZWYgc3RydWN0IERJUiAgRElSOwordHlwZWRlZiBzdHJ1Y3QgRElSIERJUjsKKworZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogZGlycGF0aCk7CitleHRlcm4gIERJUiogICAgICAgICAgICAgZmRvcGVuZGlyKGludCBmZCk7CitleHRlcm4gIHN0cnVjdCBkaXJlbnQqICAgcmVhZGRpcihESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50KiBlbnRyeSwgc3RydWN0IGRpcmVudCoqIHJlc3VsdCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCBzdHJ1Y3QgZGlyZW50KiogYSwgY29uc3Qgc3RydWN0IGRpcmVudCoqIGIpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHNjYW5kaXIoY29uc3QgY2hhciogZGlyLCBzdHJ1Y3QgZGlyZW50KioqIG5hbWVsaXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50KCpmaWx0ZXIpKGNvbnN0IHN0cnVjdCBkaXJlbnQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqY29tcGFyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RydWN0IGRpcmVudCoqKSk7CiAKIGV4dGVybiAgaW50ICAgICAgICAgICAgICBnZXRkZW50cyh1bnNpZ25lZCBpbnQsIHN0cnVjdCBkaXJlbnQqLCB1bnNpZ25lZCBpbnQpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIG9wZW5kaXIoY29uc3QgY2hhciogIGRpcnBhdGgpOwotZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOwotZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgcmVhZGRpcl9yKERJUiogIGRpcnAsIHN0cnVjdCBkaXJlbnQgKmVudHJ5LCBzdHJ1Y3QgZGlyZW50ICoqcmVzdWx0KTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBjbG9zZWRpcihESVIqICBkaXJwKTsKLWV4dGVybiAgdm9pZCAgICAgICAgICAgICByZXdpbmRkaXIoRElSICpkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBkaXJmZChESVIqIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGFscGhhc29ydChjb25zdCB2b2lkICphLCBjb25zdCB2b2lkICpiKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbn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pcmVudCB7Ci0gICAgdWludDY0X3QgICAgICAgICBkX2lubzsKLSAgICBpbnQ2NF90ICAgICAgICAgIGRfb2ZmOwotICAgIHVuc2lnbmVkIHNob3J0ICAgZF9yZWNsZW47Ci0gICAgdW5zaWduZWQgY2hhciAgICBkX3R5cGU7Ci0gICAgY2hhciAgICAgICAgICAgICBkX25hbWVbMjU2XTsKKyAgdWludDY0X3QgICAgICAgICBkX2lubzsKKyAgaW50NjRfdCAgICAgICAgICBkX29mZjsKKyAgdW5zaWduZWQgc2hvcnQgICBkX3JlY2xlbjsKKyAgdW5zaWduZWQgY2hhciAgICBkX3R5cGU7CisgIGNoYXIgICAgICAgICAgICAgZF9uYW1lWzI1Nl07CiB9OwogCi10eXBlZGVmIHN0cnVjdCBESVIgIERJUjsKK3R5cGVkZWYgc3RydWN0IERJUiBESVI7CisKK2V4dGVybiAgRElSKiAgICAgICAgICAgICBvcGVuZGlyKGNvbnN0IGNoYXIqIGRpcnBhdGgpOworZXh0ZXJuICBESVIqICAgICAgICAgICAgIGZkb3BlbmRpcihpbnQgZmQpOworZXh0ZXJuICBzdHJ1Y3QgZGlyZW50KiAgIHJlYWRkaXIoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICByZWFkZGlyX3IoRElSKiAgZGlycCwgc3RydWN0IGRpcmVudCogZW50cnksIHN0cnVjdCBkaXJlbnQqKiByZXN1bHQpOworZXh0ZXJuICBpbnQgICAgICAgICAgICAgIGNsb3NlZGlyKERJUiogZGlycCk7CitleHRlcm4gIHZvaWQgICAgICAgICAgICAgcmV3aW5kZGlyKERJUiogZGlycCk7CitleHRlcm4gIGludCAgICAgICAgICAgICAgZGlyZmQoRElSKiBkaXJwKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBhbHBoYXNvcnQoY29uc3Qgc3RydWN0IGRpcmVudCoqIGEsIGNvbnN0IHN0cnVjdCBkaXJlbnQqKiBiKTsKK2V4dGVybiAgaW50ICAgICAgICAgICAgICBzY2FuZGlyKGNvbnN0IGNoYXIqIGRpciwgc3RydWN0IGRpcmVudCoqKiBuYW1lbGlzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCgqZmlsdGVyKShjb25zdCBzdHJ1Y3QgZGlyZW50KiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQoKmNvbXBhcikoY29uc3Qgc3RydWN0IGRpcmVudCoqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0cnVjdCBkaXJlbnQqKikpOwogCiBleHRlcm4gIGludCAgICAgICAgICAgICAgZ2V0ZGVudHModW5zaWduZWQgaW50LCBzdHJ1Y3QgZGlyZW50KiwgdW5zaWduZWQgaW50KTsKLWV4dGVybiAgRElSKiAgICAgICAgICAgICBvcGVuZGlyKGNvbnN0IGNoYXIqICBkaXJwYXRoKTsKLWV4dGVybiAgRElSKiAgICAgICAgICAgICBmZG9wZW5kaXIoaW50IGZkKTsKLWV4dGVybiAgc3RydWN0IGRpcmVudCogICByZWFkZGlyKERJUiogIGRpcnApOwotZXh0ZXJuICBpbnQgICAgICAgICAgICAgIHJlYWRkaXJfcihESVIqICBkaXJwLCBzdHJ1Y3QgZGlyZW50ICplbnRyeSwgc3RydWN0IGRpcmVudCAqKnJlc3VsdCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgY2xvc2VkaXIoRElSKiAgZGlycCk7Ci1leHRlcm4gIHZvaWQgICAgICAgICAgICAgcmV3aW5kZGlyKERJUiAqZGlycCk7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgZGlyZmQoRElSKiBkaXJwKTsKLWV4dGVybiAgaW50ICAgICAgICAgICAgICBhbHBoYXNvcnQoY29uc3Qgdm9pZCAqYSwgY29uc3Qgdm9pZCAqYik7Ci1leHRlcm4gIGludCAgICAgICAgICAgICAgc2NhbmRpcihjb25zdCBjaGFyICpkaXIsIHN0cnVjdCBkaXJlbnQgKioqbm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Ol9fYWRkcmVzc29mKF9NX2luc3RhbmNlW19ObV0pKTsgfQorCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yIAorICAgICAgY3JiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKGVuZCgpKTsgfQorCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yIAorICAgICAgY3JlbmQoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gY29uc3RfcmV2ZXJzZV9pdGVyYXRvcihiZWdpbigpKTsgfQorCisgICAgICAvLyBDYXBhY2l0eS4KKyAgICAgIGNvbnN0ZXhwciBzaXplX3R5cGUgCisgICAgICBzaXplKCkgY29uc3Qgbm9leGNlcHQgeyByZXR1cm4gX05tOyB9CisKKyAgICAgIGNvbnN0ZXhwciBzaXplX3R5cGUgCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0IG5vZXhjZXB0IHsgcmV0dXJuIF9ObTsgfQorCisgICAgICBjb25zdGV4cHIgYm9vbCAKKyAgICAgIGVtcHR5KCkgY29uc3Qgbm9leGNlcHQgeyByZXR1cm4gc2l6ZSgpID09IDA7IH0KKworICAgICAgLy8gRWxlbWVudCBhY2Nlc3MuCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2luc3RhbmNlW19fbl07IH0KKworICAgICAgY29uc3RleHByIGNvbnN0X3JlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShzaXplX3R5cGUgX19uKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01faW5zdGFuY2VbX19uXTsgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIGF0KHNpemVfdHlwZSBfX24pCisgICAgICB7CisJaWYgKF9fbiA+PSBfTm0pCisJICBzdGQ6Ol9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigiYXJyYXk6OmF0IikpOworCXJldHVybiBfTV9pbnN0YW5jZVtfX25dOworICAgICAgfQorCisgICAgICBjb25zdGV4cHIgY29uc3RfcmVmZXJlbmNlCisgICAgICBhdChzaXplX3R5cGUgX19uKSBjb25zdAorICAgICAgeworCS8vIFJlc3VsdCBvZiBjb25kaXRpb25hbCBleHByZXNzaW9uIG11c3QgYmUgYW4gbHZhbHVlIHNvIHVzZQorCS8vIGJvb2xlYW4gPyBsdmFsdWUgOiAodGhyb3ctZXhwciwgbHZhbHVlKQorCXJldHVybiBfX24gPCBfTm0gPyBfTV9pbnN0YW5jZVtfX25dCisJICA6IChzdGQ6Ol9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigiYXJyYXk6OmF0IikpLCBfTV9pbnN0YW5jZVswXSk7CisgICAgICB9CisKKyAgICAgIHJlZmVyZW5jZSAKKyAgICAgIGZyb250KCkKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZSAKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIHJlZmVyZW5jZSAKKyAgICAgIGJhY2soKQorICAgICAgeyByZXR1cm4gX05tID8gKihlbmQoKSAtIDEpIDogKmVuZCgpOyB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZSAKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeyByZXR1cm4gX05tID8gKihlbmQoKSAtIDEpIDogKmVuZCgpOyB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIGRhdGEoKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gc3RkOjpfX2FkZHJlc3NvZihfTV9pbnN0YW5jZVswXSk7IH0KKworICAgICAgY29uc3RfcG9pbnRlcgorICAgICAgZGF0YSgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKF9NX2luc3R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VybiBfTV9iLS07IH0KKworICAgICAgX19wb2ludGVyX3R5cGUKKyAgICAgIG9wZXJhdG9yLS0oaW50KSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fYi0tOyB9CisKKyAgICAgIF9fcG9pbnRlcl90eXBlCisgICAgICBvcGVyYXRvcisrKCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuICsrX01fYjsgfQorCisgICAgICBfX3BvaW50ZXJfdHlwZQorICAgICAgb3BlcmF0b3IrKygpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiArK19NX2I7IH0KKworICAgICAgX19wb2ludGVyX3R5cGUKKyAgICAgIG9wZXJhdG9yLS0oKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gLS1fTV9iOyB9CisKKyAgICAgIF9fcG9pbnRlcl90eXBlCisgICAgICBvcGVyYXRvci0tKCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIC0tX01fYjsgfQorCisgICAgICBfX3BvaW50ZXJfdHlwZQorICAgICAgb3BlcmF0b3IrPShwdHJkaWZmX3QgX19kKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fYi5vcGVyYXRvcis9KF9fZCk7IH0KKworICAgICAgX19wb2ludGVyX3R5cGUKKyAgICAgIG9wZXJhdG9yKz0ocHRyZGlmZl90IF9fZCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX2Iub3BlcmF0b3IrPShfX2QpOyB9CisKKyAgICAgIF9fcG9pbnRlcl90eXBlCisgICAgICBvcGVyYXRvci09KHB0cmRpZmZfdCBfX2QpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV9iLm9wZXJhdG9yLT0oX19kKTsgfQorCisgICAgICBfX3BvaW50ZXJfdHlwZQorICAgICAgb3BlcmF0b3ItPShwdHJkaWZmX3QgX19kKSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1c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lIF9faSkgbm9leGNlcHQgOiBfX2Jhc2VfdHlwZShfX2kpIHsgfQorCisgICAgICB1c2luZyBfX2Jhc2VfdHlwZTo6b3BlcmF0b3IgX19pbnRlZ3JhbF90eXBlOworICAgICAgdXNpbmcgX19iYXNlX3R5cGU6Om9wZXJhdG9yPTsKKyAgICB9OworCisgIC8vLyBFeHBsaWNpdCBzcGVjaWFsaXphdGlvbiBmb3IgY2hhci4KKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBhdG9taWM8Y2hhcj4gOiBwdWJsaWMgYXRvbWljX2NoYXIKKyAgICB7CisgICAgICB0eXBlZGVmIGNoYXIgCQkJX19pbnRlZ3JhbF90eXBlOworICAgICAgdHlwZWRlZiBhdG9taWNfY2hhciAJCV9fYmFzZV90eXBlOworCisgICAgICBhdG9taWMoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+YXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgYXRvbWljKGNvbnN0IGF0b21pYyYpID0gZGVsZXRlOworICAgICAgYXRvbWljJiBvcGVyYXRvcj0oY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSB2b2xhdGlsZSA9IGRlbGV0ZTsKKworICAgICAgY29uc3RleHByIGF0b21pYyhfX2ludGVncmFsX3R5cGUgX19pKSBub2V4Y2VwdCA6IF9fYmFzZV90eXBlKF9faSkgeyB9CisKKyAgICAgIHVzaW5nIF9fYmFzZV90eXBlOjpvcGVyYXRvciBfX2ludGVncmFsX3R5cGU7CisgICAgICB1c2luZyBfX2Jhc2VfdHlwZTo6b3BlcmF0b3I9OworICAgIH07CisKKyAgLy8vIEV4cGxpY2l0IHNwZWNpYWxpemF0aW9uIGZvciBzaWduZWQgY2hhci4KKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBhdG9taWM8c2lnbmVkIGNoYXI+IDogcHVibGljIGF0b21pY19zY2h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vbWljX2ludCAJCV9fYmFzZV90eXBlOworCisgICAgICBhdG9taWMoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+YXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgYXRvbWljKGNvbnN0IGF0b21pYyYpID0gZGVsZXRlOworICAgICAgYXRvbWljJiBvcGVyYXRvcj0oY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSB2b2xhdGlsZSA9IGRlbGV0ZTsKKworICAgICAgY29uc3RleHByIGF0b21pYyhfX2ludGVncmFsX3R5cGUgX19pKSBub2V4Y2VwdCA6IF9fYmFzZV90eXBlKF9faSkgeyB9CisKKyAgICAgIHVzaW5nIF9fYmFzZV90eXBlOjpvcGVyYXRvciBfX2ludGVncmFsX3R5cGU7CisgICAgICB1c2luZyBfX2Jhc2VfdHlwZTo6b3BlcmF0b3I9OworICAgIH07CisKKyAgLy8vIEV4cGxpY2l0IHNwZWNpYWxpemF0aW9uIGZvciB1bnNpZ25lZCBpbnQuCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgYXRvbWljPHVuc2lnbmVkIGludD4gOiBwdWJsaWMgYXRvbWljX3VpbnQKKyAgICB7CisgICAgICB0eXBlZGVmIHVuc2lnbmVkIGludAkJX19pbnRlZ3JhbF90eXBlOworICAgICAgdHlwZWRlZiBhdG9taWNfdWludCAJCV9fYmFzZV90eXBlOworCisgICAgICBhdG9taWMoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+YXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgYXRvbWljKGNvbnN0IGF0b21pYyYpID0gZGVsZXRlOworICAgICAgYXRvbWljJiBvcGVyYXRvcj0oY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSB2b2xhdGlsZSA9IGR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lZmF1bHQ7CisgICAgICBhdG9taWMoY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSA9IGRlbGV0ZTsKKyAgICAgIGF0b21pYyYgb3BlcmF0b3I9KGNvbnN0IGF0b21pYyYpIHZvbGF0aWxlID0gZGVsZXRlOworCisgICAgICBjb25zdGV4cHIgYXRvbWljKF9faW50ZWdyYWxfdHlwZSBfX2kpIG5vZXhjZXB0IDogX19iYXNlX3R5cGUoX19pKSB7IH0KKworICAgICAgdXNpbmcgX19iYXNlX3R5cGU6Om9wZXJhdG9yIF9faW50ZWdyYWxfdHlwZTsKKyAgICAgIHVzaW5nIF9fYmFzZV90eXBlOjpvcGVyYXRvcj07CisgICAgfTsKKworICAvLy8gRXhwbGljaXQgc3BlY2lhbGl6YXRpb24gZm9yIHVuc2lnbmVkIGxvbmcgbG9uZy4KKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBhdG9taWM8dW5zaWduZWQgbG9uZyBsb25nPiA6IHB1YmxpYyBhdG9taWNfdWxsb25nCisgICAgeworICAgICAgdHlwZWRlZiB1bnNpZ25lZCBsb25nIGxvbmcgICAgICAgCV9faW50ZWdyYWxfdHlwZTsKKyAgICAgIHR5cGVkZWYgYXRvbWljX3VsbG9uZyAJCV9fYmFzZV90eXBlOworCisgICAgICBhdG9taWMoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+YXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgYXRvbWljKGNvbnN0IGF0b21pYyYpID0gZGVsZXRlOworICAgICAgYXRvbWljJiBvcGVyYXRvcj0oY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSB2b2xhdGlsZSA9IGRlbGV0ZTsKKworICAgICAgY29uc3RleHByIGF0b21pYyhfX2ludGVncmFsX3R5cGUgX19pKSBub2V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YXRvbWljX2NoYXIxNl90CisgICAgeworICAgICAgdHlwZWRlZiBjaGFyMTZfdCAJCQlfX2ludGVncmFsX3R5cGU7CisgICAgICB0eXBlZGVmIGF0b21pY19jaGFyMTZfdCAJCV9fYmFzZV90eXBlOworCisgICAgICBhdG9taWMoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+YXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgYXRvbWljKGNvbnN0IGF0b21pYyYpID0gZGVsZXRlOworICAgICAgYXRvbWljJiBvcGVyYXRvcj0oY29uc3QgYXRvbWljJikgPSBkZWxldGU7CisgICAgICBhdG9taWMmIG9wZXJhdG9yPShjb25zdCBhdG9taWMmKSB2b2xhdGlsZSA9IGRlbGV0ZTsKKworICAgICAgY29uc3RleHByIGF0b21pYyhfX2ludGVncmFsX3R5cGUgX19pKSBub2V4Y2VwdCA6IF9fYmFzZV90eXBlKF9faSkgeyB9CisKKyAgICAgIHVzaW5nIF9fYmFzZV90eXBlOjpvcGVyYXRvciBfX2ludGVncmFsX3R5cGU7CisgICAgICB1c2luZyBfX2Jhc2VfdHlwZTo6b3BlcmF0b3I9OworICAgIH07CisKKyAgLy8vIEV4cGxpY2l0IHNwZWNpYWxpemF0aW9uIGZvciBjaGFyMzJfdC4KKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBhdG9taWM8Y2hhcjMyX3Q+IDogcHVibGljIGF0b21pY19jaGFyMzJfdAorICAgIHsKKyAgICAgIHR5cGVkZWYgY2hhcjMyX3QgCQkJX19pbnRlZ3JhbF90eXBlOworICAgICAgdHlwZWRlZiBhdG9taWNfY2hhcjMyX3QgCQlfX2Jhc2VfdHlwZTsKKworICAgICAgYXRvbWljKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgfmF0b21pYygpIG5vZXhjZXB0ID0gZGVmYXVsdDsKKyAgICAgIGF0b21pYyhjb25zdCBhdG9taWMmKSA9IGRlbGV0ZTsKKyAgICAgIGF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bGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY2xhc3MgYXV0b19wdHIKKyAgICB7CisgICAgcHJpdmF0ZToKKyAgICAgIF9UcCogX01fcHRyOworICAgICAgCisgICAgcHVibGljOgorICAgICAgLy8vIFRoZSBwb2ludGVkLXRvIHR5cGUuCisgICAgICB0eXBlZGVmIF9UcCBlbGVtZW50X3R5cGU7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQW4gJWF1dG9fcHRyIGlzIHVzdWFsbHkgY29uc3RydWN0ZWQgZnJvbSBhIHJhdyBwb2ludGVyLgorICAgICAgICogIEBwYXJhbSAgX19wICBBIHBvaW50ZXIgKGRlZmF1bHRzIHRvIE5VTEwpLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIG9iamVjdCBub3cgQGUgb3ducyB0aGUgb2JqZWN0IHBvaW50ZWQgdG8gYnkgQGEgX19wLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgYXV0b19wdHIoZWxlbWVudF90eXBlKiBfX3AgPSAwKSB0aHJvdygpIDogX01fcHRyKF9fcCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQW4gJWF1dG9fcHRyIGNhbiBiZSBjb25zdHJ1Y3RlZCBmcm9tIGFub3RoZXIgJWF1dG9fcHRyLgorICAgICAgICogIEBwYXJhbSAgX19hICBBbm90aGVyICVhdXRvX3B0ciBvZiB0aGUgc2FtZSB0eXBlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIG9iamVjdCBub3cgQGUgb3ducyB0aGUgb2JqZWN0IHByZXZpb3VzbHkgb3duZWQgYnkgQGEgX19hLAorICAgICAgICogIHdoaWNoIGhhcyBnaXZlbiB1cCBvd25lcnNoaXAuCisgICAgICAgKi8KKyAgICAgIGF1dG9fcHRyKGF1dG9fcHRyJiBfX2EpIHRocm93KCkgOiBfTV9wdHIoX19hLnJlbGVhc2UoKSkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQW4gJWF1dG9fcHRyIGNhbiBiZSBjb25zdHJ1Y3RlZCBmcm9tIGFub3RoZXIgJWF1dG9fcHRyLgorICAgICAgICogIEBwYXJhbSAgX19hICBBbm90aGVyICVhdXRvX3B0ciBvZiBhIGRpZmZlcmVudCBidXQgcmVsYXRlZCB0eXBlLgorICAgICAgICoKKyAgICAgICAqICBBIHBvaW50ZXItdG8tVHAxIG11c3QgYmUgY29udmVydGlibGUgdG8gYQorICAgICAgICogIHBvaW50ZXItdG8tVHAvZWxlbWVudF90eXBlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIG9iamVjdCBub3cgQGUgb3ducyB0aGUgb2JqZWN0IHByZXZpb3VzbHkgb3duZWQgYnkgQGEgX19hLAorICAgICAgICogIHdoaWNoIGhhcyBnaXZlbiB1cCBvd25lcnNoaXAuCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDE+CisgICAgICAgIGF1dG9fcHRyKGF1dG9fcHRyPF9UcDE+JiBfX2EpIHRocm93KCkgOiBfTV9wdHIoX19hLnJlbGVhc2UoKSkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJWF1dG9fcHRyIGFzc2lnbm1lbnQgb3BlcmF0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFub3RoZXIgJWF1dG9fcHRyIG9mIHRoZSBzYW1lIHR5cGUuCisgICAgICAgKgorICAgICAgICogIFRoaXMgb2JqZWN0IG5vdyBAZSBvd25zIHRoZSBvYmplY3QgcHJldmlvdXNseSBvd25lZCBieSBAYSBfX2EsCisgICAgICAgKiAgd2hpY2ggaGFzIGdpdmVuIHVwIG93bmVyc2hpcC4gIFRoZSBvYmplY3QgdGhhdCB0aGlzIG9uZSBAZQorICAgICAgICogIHVzZWQgdG8gb3duIGFuZCB0cmFjayBoYXMgYmVlbiBkZWxldGVkLgorICAgICAgICovCisgICAgICBhdXRvX3B0ciYKKyAgICAgIG9wZXJhdG9yPShhdXRvX3B0ciYgX19hKSB0aHJvdygpCisgICAgICB7CisJcmVzZXQoX19hLnJlbGVhc2UoKSk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVhdXRvX3B0ciBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX19hICBBbm90aGVyICVhdXRvX3B0ciBvZiBhIGRpZmZlcmVudCBidXQgcmVsYXRlZCB0eXBlLgorICAgICAgICoKKyAgICAgICAqICBBIHBvaW50ZXItdG8tVHAxIG11c3QgYmUgY29udmVydGlibGUgdG8gYSBwb2ludGVyLXRvLVRwL2VsZW1lbnRfdHlwZS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBvYmplY3Qgbm93IEBlIG93bnMgdGhlIG9iamVjdCBwcmV2aW91c2x5IG93bmVkIGJ5IEBhIF9fYSwKKyAgICAgICAqICB3aGljaCBoYXMgZ2l2ZW4gdXAgb3duZXJzaGlwLiAgVGhlIG9iamVjdCB0aGF0IHRoaXMgb25lIEBlCisgICAgICAgKiAgdXNlZCB0byBvd24gYW5kIHRyYWNrIGhhcyBiZWVuIGRlbGV0ZWQuCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDE+CisgICAgICAgIGF1dG9fcHRyJgorICAgICAgICBvcGVyYXRvcj0oYXV0b19wdHI8X1RwMT4mIF9fYSkgdGhyb3coKQorICAgICAgICB7CisJICByZXNldChfX2EucmVsZWFzZSgpKTsKKwkgIHJldHVybiAqdGhpczsKKwl9CisKKyAgICAgIC8qKgorICAgICAgICogIFdoZW4gdGhlICVhdXRvX3B0ciBnb2VzIG91dCBvZiBzY29wZSwgdGhlIG9iamVjdCBpdCBvd25zIGlzCisgICAgICAgKiAgZGVsZXRlZC4gIElmIGl0IG5vIGxvbmdlciBvd25zIGFueXRoaW5nIChpLmUuLCBAYyBnZXQoKSBpcworICAgICAgICogIEBjIE5VTEwp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ICAgICB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU21hcnQgcG9pbnRlciBkZXJlZmVyZW5jaW5nLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHJldHVybnMgdGhlIHBvaW50ZXIgaXRzZWxmLCB3aGljaCB0aGUgbGFuZ3VhZ2UgdGhlbiB3aWxsCisgICAgICAgKiAgYXV0b21hdGljYWxseSBjYXVzZSB0byBiZSBkZXJlZmVyZW5jZWQuCisgICAgICAgKi8KKyAgICAgIGVsZW1lbnRfdHlwZSoKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdCB0aHJvdygpIAorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX0FTU0VSVChfTV9wdHIgIT0gMCk7CisJcmV0dXJuIF9NX3B0cjsgCisgICAgICB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnlwYXNzaW5nIHRoZSBzbWFydCBwb2ludGVyLgorICAgICAgICogIEByZXR1cm4gIFRoZSByYXcgcG9pbnRlciBiZWluZyBtYW5hZ2VkLgorICAgICAgICoKKyAgICAgICAqICBZb3UgY2FuIGdldCBhIGNvcHkgb2YgdGhlIHBvaW50ZXIgdGhhdCB0aGlzIG9iamVjdCBvd25zLCBmb3IKKyAgICAgICAqICBzaXR1YXRpb25zIHN1Y2ggYXMgcGFzc2luZyB0byBhIGZ1bmN0aW9uIHdoaWNoIG9ubHkgYWNjZXB0cworICAgICAgICogIGEgcmF3IHBvaW50ZXIuCisgICAgICAgKgorICAgICAgICogIEBub3RlICBUaGlzICVhdXRvX3B0ciBzdGlsbCBvd25zIHRoZSBtZW1vcnkuCisgICAgICAgKi8KKyAgICAgIGVsZW1lbnRfdHlwZSoKKyAgICAgIGdldCgpIGNvbnN0IHRocm93KCkgeyByZXR1cm4gX01fcHRyOyB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnlwYXNzaW5nIHRoZSBzbWFydCBwb2ludGVyLgorICAgICAgICogIEByZXR1cm4gIFRoZSByYXcgcG9pbnRlciBiZWluZyBtYW5hZ2VkLgorICAgICAgICoKKyAgICAgICAqICBZb3UgY2FuIGdldCBhIGNvcHkgb2YgdGhlIHBvaW50ZXIgdGhhdCB0aGlzIG9iamVjdCBvd25zLCBmb3IKKyAgICAgICAqICBzaXR1YXRpb25zIHN1Y2ggYXMgcGFzc2luZyB0byBhIGZ1bmN0aW9uIHdoaWNoIG9ubHkgYWNjZXB0cworICAgICAgICogIGEgcmF3IHBvaW50ZXIuCisgICAgICAgKgorICAgICAgICogIEBub3RlICBUaGlzICVhdXRvX3B0ciBubyBsb25nZXIgb3ducyB0aGUgbWVtb3J5LiAgV2hlbiB0aGlzIG9iamVjdAorICAgICAgICogIGdvZXMgb3V0IG9mIHNjb3BlLCBub3RoaW5nIHdpbGwgaGFwcGVuLgorICAgICAgICovCisgICAgICBlbGVtZW50X3R5cGUqCisgICAgICByZWxlYXNlKCkgdGhyb3coKQorICAgICAgeworCWVsZW1lbnRfdHlwZSogX190bXAgPSBfTV9wdHI7CisJX01fcHRyID0gMDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRm9yY2libHkgZGVsZXRlcyB0aGUgbWFuYWdlZCBvYmplY3QuCisgICAgICAgKiAgQHBhcmFtICBfX3AgIEEgcG9pbnRlciAoZGVmYXVsdHMgdG8gTlVMTCkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgb2JqZWN0IG5vdyBAZSBvd25zIHRoZSBvYmplY3QgcG9pbnRlZCB0byBieSBAYSBfX3AuICBUaGUKKyAgICAgICAqICBwcmV2aW91cyBvYmplY3QgaGFzIGJlZW4gZGVsZXRlZC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoZWxlbWVudF90eXBlKiBfX3AgPSAwKSB0aHJvdygpCisgICAgICB7CisJaWYgKF9fcCAhPSBfTV9wdHIpCisJICB7CisJICAgIGRlbGV0ZSBfTV9wdHI7CisJICAgIF9NX3B0ciA9IF9fcDsKKwkgIH0KKyAgICAgIH0KKyAgICAgIAorICAgICAgLyoqIAorICAgICAgICogIEBicmllZiAgQXV0b21hdGljIGNvbnZlcnNpb25zCisgICAgICAgKgorICAgICAgICogIFRoZXNlIG9wZXJhdGlvbnMgY29udmVydCBhbiAlYXV0b19wdHIgaW50byBhbmQgZnJvbSBhbiBhdXRvX3B0cl9yZWYKKyAgICAgICAqICBhdXRvbWF0aWNhbGx5IGFzIG5lZWRlZC4gIFRoaXMgYWxsb3dzIGNvbnN0cnVjdHMgc3VjaCBhcworICAgICAgICogIEBjb2RlCisgICAgICAgKiAgICBhdXRvX3B0cjxEZXJpdmVkPiAgZnVuY19yZXR1cm5pbmdfYXV0b19wdHIoLi4uLi4pOworICAgICAgICogICAgLi4uCisgICAgICAgKiAgICBhdXRvX3B0cjxCYXNlPiBwdHIgPSBmdW5jX3JldHVybmluZ19hdXRvX3B0ciguLi4uLik7CisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICAqLworICAgICAgYXV0b19wdHIoYXV0b19wdHJfcmVmPGVsZW1lbnRfdHlwZT4gX19yZWYpIHRocm93KCkKKyAgICAgIDogX01fcHRyKF9fcmVmLl9NX3B0cikgeyB9CisgICAgICAKKyAgICAgIGF1dG9fcHRyJgorICAgICAgb3BlcmF0b3I9KGF1dG9fcHRyX3JlZjxlbGVtZW50X3R5cGU+IF9fcmVmKSB0aHJvdygpCisgICAgICB7CisJaWYgKF9fcmVmLl9NX3B0ciAhPSB0aGlzLT5nZXQoKSkKKwkgIHsKKwkgICAgZGVsZXRlIF9NX3B0cjsKKwkgICAgX01fcHRyID0gX19yZWYuX01fcHRyOworCSAgfQorCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIAorICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwMT4KKyAgICAgICAgb3BlcmF0b3IgYXV0b19wdHJfcmVmPF9UcDE+KCkgdGhyb3co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NpbmNsdWRlIDxiaXRzL2MrK2NvbmZpZy5oPgorCituYW1lc3BhY2UgX19nbnVfY3h4IF9HTElCQ1hYX1ZJU0lCSUxJVFkoZGVmYXVsdCkKK3sKK19HTElCQ1hYX0JFR0lOX05BTUVTUEFDRV9WRVJTSU9OCisKKyAgdXNpbmcgc3RkOjpzaXplX3Q7CisKKyAgdGVtcGxhdGU8Y2xhc3MgX0tleT4KKyAgICBzdHJ1Y3QgaGFzaCB7IH07CisKKyAgaW5saW5lIHNpemVfdAorICBfX3N0bF9oYXNoX3N0cmluZyhjb25zdCBjaGFyKiBfX3MpCisgIHsKKyAgICB1bnNpZ25lZCBsb25nIF9faCA9IDA7CisgICAgZm9yICggOyAqX19zOyArK19fcykKKyAgICAgIF9faCA9IDUgKiBfX2ggKyAqX19zOworICAgIHJldHVybiBzaXplX3QoX19oKTsKKyAgfQorCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgaGFzaDxjaGFyKj4KKyAgICB7CisgICAgICBzaXplX3QKKyAgICAgIG9wZXJhdG9yKCkoY29uc3QgY2hhciogX19zKSBjb25zdAorICAgICAgeyByZXR1cm4gX19zdGxfaGFzaF9zdHJpbmcoX19zKTsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBoYXNoPGNvbnN0IGNoYXIqPgorICAgIHsKKyAgICAgIHNpemVfdAorICAgICAgb3BlcmF0b3IoKShjb25zdCBjaGFyKiBfX3MpIGNvbnN0CisgICAgICB7IHJldHVybiBfX3N0bF9oYXNoX3N0cmluZyhfX3MpOyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8Y2hhcj4KKyAgICB7IAorICAgICAgc2l6ZV90CisgICAgICBvcGVyYXRvcigpKGNoYXIgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX194OyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8dW5zaWduZWQgY2hhcj4KKyAgICB7IAorICAgICAgc2l6ZV90CisgICAgICBvcGVyYXRvcigpKHVuc2lnbmVkIGNoYXIgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX194OyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8c2lnbmVkIGNoYXI+CisgICAgeworICAgICAgc2l6ZV90CisgICAgICBvcGVyYXRvcigpKHVuc2lnbmVkIGNoYXIgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX194OyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8c2hvcnQ+CisgICAgeworICAgICAgc2l6ZV90CisgICAgICBvcGVyYXRvcigpKHNob3J0IF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9feDsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBoYXNoPHVuc2lnbmVkIHNob3J0PgorICAgIHsKKyAgICAgIHNpemVfdAorICAgICAgb3BlcmF0b3IoKSh1bnNpZ25lZCBzaG9ydCBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfX3g7IH0KKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgaGFzaDxpbnQ+CisgICAgeyAKKyAgICAgIHNpemVfdCAKKyAgICAgIG9wZXJhdG9yKCkoaW50IF9feCkgY29uc3QgCisgICAgICB7IHJldHVybiBfX3g7IH0KKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgaGFzaDx1bnNpZ25lZCBpbnQ+CisgICAgeyAKKyAgICAgIHNpemVfdAorICAgICAgb3BlcmF0b3IoKSh1bnNpZ25lZCBpbnQgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX194OyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8bG9uZz4KKyAgICB7CisgICAgICBzaXplX3QKKyAgICAgIG9wZXJhdG9yKCkobG9uZyBfX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0X3VuaXF1ZShfX2YsIF9fbCk7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIGhhc2hfbWFwKF9JbnB1dEl0ZXJhdG9yIF9fZiwgX0lucHV0SXRlcmF0b3IgX19sLCBzaXplX3R5cGUgX19uLAorCQkgY29uc3QgaGFzaGVyJiBfX2hmKQorCTogX01faHQoX19uLCBfX2hmLCBrZXlfZXF1YWwoKSwgYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfdW5pcXVlKF9fZiwgX19sKTsgfQorCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfSW5wdXRJdGVyYXRvcj4KKyAgICAgICAgaGFzaF9tYXAoX0lucHV0SXRlcmF0b3IgX19mLCBfSW5wdXRJdGVyYXRvciBfX2wsIHNpemVfdHlwZSBfX24sCisJCSBjb25zdCBoYXNoZXImIF9faGYsIGNvbnN0IGtleV9lcXVhbCYgX19lcWwsCisJCSBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKwk6IF9NX2h0KF9fbiwgX19oZiwgX19lcWwsIF9fYSkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfdW5pcXVlKF9fZiwgX19sKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuc2l6ZSgpOyB9CisgICAgICAKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X3NpemUoKTsgfQorICAgICAgCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbXB0eSgpOyB9CisgIAorICAgICAgdm9pZAorICAgICAgc3dhcChoYXNoX21hcCYgX19ocykKKyAgICAgIHsgX01faHQuc3dhcChfX2hzLl9NX2h0KTsgfQorCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfSzEsIGNsYXNzIF9UMSwgY2xhc3MgX0hGLCBjbGFzcyBfRXFLLCBjbGFzcyBfQWw+CisgICAgICAgIGZyaWVuZCBib29sCisgICAgICAgIG9wZXJhdG9yPT0gKGNvbnN0IGhhc2hfbWFwPF9LMSwgX1QxLCBfSEYsIF9FcUssIF9BbD4mLAorCQkgICAgY29uc3QgaGFzaF9tYXA8X0sxLCBfVDEsIF9IRiwgX0VxSywgX0FsPiYpOworCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKQorICAgICAgeyByZXR1cm4gX01faHQuYmVnaW4oKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVuZCgpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5iZWdpbigpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZW5kKCk7IH0KKworICAgICAgcGFpcjxpdGVyYXRvciwgYm9vbD4KKyAgICAgIGluc2VydChjb25zdCB2YWx1ZV90eXBlJiBfX29iaikKKyAgICAgIHsgcmV0dXJuIF9NX2h0Lmluc2VydF91bmlxdWUoX19vYmopOyB9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgICB2b2lkCisgICAgICAgIGluc2VydChfSW5wdXRJdGVyYXRvciBfX2YsIF9JbnB1dEl0ZXJhdG9yIF9fbCkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfdW5pcXVlKF9fZiwgX19sKTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0X25vcmVzaXplKGNvbnN0IHZhbHVlX3R5cGUmIF9fb2JqKQorICAgICA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Gl0ZXJhdG9yIF9faXQpCisgICAgICB7IF9NX2h0LmVyYXNlKF9faXQpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9fZiwgaXRlcmF0b3IgX19sKQorICAgICAgeyBfTV9odC5lcmFzZShfX2YsIF9fbCk7IH0KKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKQorICAgICAgeyBfTV9odC5jbGVhcigpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19oaW50KQorICAgICAgeyBfTV9odC5yZXNpemUoX19oaW50KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5idWNrZXRfY291bnQoKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X2J1Y2tldF9jb3VudCgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZWxlbXNfaW5fYnVja2V0KHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbGVtc19pbl9idWNrZXQoX19uKTsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8Y2xhc3MgX0tleSwgY2xhc3MgX1RwLCBjbGFzcyBfSGFzaEZuLCBjbGFzcyBfRXFsS2V5LCBjbGFzcyBfQWxsb2M+CisgICAgaW5saW5lIGJvb2wKKyAgICBvcGVyYXRvcj09KGNvbnN0IGhhc2hfbWFwPF9LZXksIF9UcCwgX0hhc2hGbiwgX0VxbEtleSwgX0FsbG9jPiYgX19obTEsCisJICAgICAgIGNvbnN0IGhhc2hfbWFwPF9LZXksIF9UcCwgX0hhc2hGbiwgX0VxbEtleSwgX0FsbG9jPiYgX19obTIpCisgICAgeyByZXR1cm4gX19obTEuX01faHQgPT0gX19obTIuX01faHQ7IH0KKworICB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wgY2xhc3MgX0VxSywgY2xhc3MgX0FsPgorICAgICAgICBmcmllbmQgYm9vbAorICAgICAgICBvcGVyYXRvcj09KGNvbnN0IGhhc2hfbXVsdGltYXA8X0sxLCBfVDEsIF9IRiwgX0VxSywgX0FsPiYsCisJCSAgIGNvbnN0IGhhc2hfbXVsdGltYXA8X0sxLCBfVDEsIF9IRiwgX0VxSywgX0FsPiYpOworCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKQorICAgICAgeyByZXR1cm4gX01faHQuYmVnaW4oKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVuZCgpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5iZWdpbigpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZW5kKCk7IH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGluc2VydChjb25zdCB2YWx1ZV90eXBlJiBfX29iaikKKyAgICAgIHsgcmV0dXJuIF9NX2h0Lmluc2VydF9lcXVhbChfX29iaik7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIHZvaWQKKyAgICAgICAgaW5zZXJ0KF9JbnB1dEl0ZXJhdG9yIF9fZiwgX0lucHV0SXRlcmF0b3IgX19sKQorICAgICAgICB7IF9NX2h0Lmluc2VydF9lcXVhbChfX2YsX19sKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0X25vcmVzaXplKGNvbnN0IHZhbHVlX3R5cGUmIF9fb2JqKQorICAgICAgeyByZXR1cm4gX01faHQuaW5zZXJ0X2VxdWFsX25vcmVzaXplKF9fb2JqKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpCisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGNvdW50KGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmNvdW50KF9fa2V5KTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBpdGVyYXRvcj4KKyAgICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVxdWFsX3JhbmdlKF9fa2V5KTsgfQorCisgICAgICBwYWlyPGNvbnN0X2l0ZXJhdG9yLCBjb25zdF9pdGVyYXRvcj4KKyAgICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVxdWFsX3JhbmdlKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVyYXNlKF9fa2V5KTsgfQorCisgICAgICB2b2lkCisgICAgICBlcmFzZShpdGVyYXRvciBfX2l0KQorICAgICAgeyBfTV9odC5lcmFzZShfX2l0KTsgfQorCisgICAgICB2b2lkCisgICAgICBlcmFzZShpdGVyYXRvciBfX2YsIGl0ZXJhdG9yIF9fbCkKKyAgICAgIHsgX01faHQuZXJhc2UoX19mLCBfX2wpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCkKKyAgICAgIHsgX01faHQuY2xlYXIoKTsgfQorCisgICAgICB2b2lkCisgICAgICByZXNp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SwgX0FsbG9jPgorICAgICAgICBfQ29udGFpbmVyOworICAgICAgX0NvbnRhaW5lciogY29udGFpbmVyOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfQ29udGFpbmVyICAgICAgICAgIGNvbnRhaW5lcl90eXBlOworICAgICAgdHlwZWRlZiBvdXRwdXRfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194KQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yKF9Db250YWluZXImIF9feCwgdHlwZW5hbWUgX0NvbnRhaW5lcjo6aXRlcmF0b3IpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgdHlwZW5hbWUgX0NvbnRhaW5lcjo6dmFsdWVfdHlwZSYgX192YWx1ZSkKKyAgICAgIHsKKwljb250YWluZXItPmluc2VydChfX3ZhbHVlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKigpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcisrKCkgeyByZXR1cm4gKnRoaXM7IH0K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gpIHt9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcihfQ29udGFpbmVyJiBfX3gsIHR5cGVuYW1lIF9Db250YWluZXI6Oml0ZXJhdG9yKQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yPF9Db250YWluZXI+JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHR5cGVuYW1lIF9Db250YWluZXI6OnZhbHVlX3R5cGUmIF9fdmFsdWUpCisgICAgICB7CisJY29udGFpbmVyLT5pbnNlcnQoX192YWx1ZSk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvciooKQorICAgICAgeyByZXR1cm4gKnRoaXM7IH0KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yPF9Db250YWluZXI+JgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsgcmV0dXJuICp0aGlzOyB9CisgICAgfTsKKworX0dMSUJDWFhfRU5EX05BTUVTUEFDRV9WRVJTSU9OCit9IC8vIG5hbWVzcGFjZQorCisjZW5kaWYKZGlmZiAtLWdpdCBhLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvYmFja3dhcmQvaGFzaF9zZXQgYi84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL2JhY2t3YXJkL2hhc2hfc2V0Cm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmYxMTBmZWMKLS0tIC9kZXYvbnVsbAorKysgYi84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL2JhY2t3Y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yAgICAgICAgaGFzaF9zZXQoX0lucHV0SXRlcmF0b3IgX19mLCBfSW5wdXRJdGVyYXRvciBfX2wsIHNpemVfdHlwZSBfX24sCisJCSBjb25zdCBoYXNoZXImIF9faGYsIGNvbnN0IGtleV9lcXVhbCYgX19lcWwsCisJCSBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKwk6IF9NX2h0KF9fbiwgX19oZiwgX19lcWwsIF9fYSkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfdW5pcXVlKF9fZiwgX19sKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuc2l6ZSgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X3NpemUoKTsgfQorICAgICAgCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbXB0eSgpOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAoaGFzaF9zZXQmIF9faHMpCisgICAgICB7IF9NX2h0LnN3YXAoX19ocy5fTV9odCk7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX1ZhbCwgY2xhc3MgX0hGLCBjbGFzcyBfRXFLLCBjbGFzcyBfQWw+CisgICAgICAgIGZyaWVuZCBib29sCisgICAgICAgIG9wZXJhdG9yPT0oY29uc3QgaGFzaF9zZXQ8X1ZhbCwgX0hGLCBfRXFLLCBfQWw+JiwKKwkJICAgY29uc3QgaGFzaF9zZXQ8X1ZhbCwgX0hGLCBfRXFLLCBfQWw+Jik7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5iZWdpbigpOyB9CisgICAgICAKKyAgICAgIGl0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZW5kKCk7IH0KKworICAgICAgcGFpcjxpdGVyYXRvciwgYm9vbD4KKyAgICAgIGluc2VydChjb25zdCB2YWx1ZV90eXBlJiBfX29iaikKKyAgICAgIHsKKwlwYWlyPHR5cGVuYW1lIF9IdDo6aXRlcmF0b3IsIGJvb2w+IF9fcCA9IF9NX2h0Lmluc2VydF91bmlxdWUoX19vYmopOworCXJldHVybiBwYWlyPGl0ZXJhdG9yLGJvb2w+KF9fcC5maXJzdCwgX19wLnNlY29uZCk7CisgICAgICB9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgICB2b2lkCisgICAgICAgIGluc2VydChfSW5wdXRJdGVyYXRvciBfX2YsIF9JbnB1dEl0ZXJhdG9yIF9fbCkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfdW5pcXVlKF9fZiwgX19sKTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0X25vcmVzaXplKGNvbnN0IHZhbHVlX3R5cGUmIF9fb2JqKQorICAgICAgeworCXBhaXI8dHlwZW5hbWUgX0h0OjppdGVyYXRvciwgYm9vbD4gX19wCisJICA9IF9NX2h0Lmluc2VydF91bmlxdWVfbm9yZXNpemUoX19vYmopOworCXJldHVybiBwYWlyPGl0ZXJhdG9yLCBib29sPihfX3AuZmlyc3QsIF9fcC5zZWNvbmQpOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGNvdW50KGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmNvdW50KF9fa2V5KTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBpdGVyYXRvcj4KKyAgICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVxdWFsX3JhbmdlKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHtyZXR1cm4gX01faHQuZXJhc2UoX19rZXkpOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9faXQpCisgICAgICB7IF9NX2h0LmVyYXNlKF9faXQpOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9fZiwgaXRlcmF0b3IgX19sKQorICAgICAgeyBfTV9odC5lcmFzZShfX2YsIF9fbCk7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgY2xlYXIoKQorICAgICAgeyBfTV9odC5jbGVhcigpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19oaW50KQorICAgICAgeyBfTV9odC5yZXNpemUoX19oaW50KTsgfQorICAgICAgCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5idWNrZXRfY291bnQoKTsgfQorICAgICAgCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X2J1Y2tldF9jb3VudCgpOyB9CisgICAgICAKKyAgICAgIHNpemVfdHlwZQorICAgICAgZWxlbXNfaW5fYnVja2V0KHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbGVtc19pbl9idWNrZXQoX19uKTsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1ZhbHVlLCBjbGF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1YWwoKSwgYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgICAgeyBfTV9odC5pbnNlcnRfZXF1YWwoX19mLCBfX2wpOyB9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgICBoYXNoX211bHRpc2V0KF9JbnB1dEl0ZXJhdG9yIF9fZiwgX0lucHV0SXRlcmF0b3IgX19sLCBzaXplX3R5cGUgX19uLAorCQkgICAgICBjb25zdCBoYXNoZXImIF9faGYpCisJOiBfTV9odChfX24sIF9faGYsIGtleV9lcXVhbCgpLCBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgICB7IF9NX2h0Lmluc2VydF9lcXVhbChfX2YsIF9fbCk7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIGhhc2hfbXVsdGlzZXQoX0lucHV0SXRlcmF0b3IgX19mLCBfSW5wdXRJdGVyYXRvciBfX2wsIHNpemVfdHlwZSBfX24sCisJCSAgICAgIGNvbnN0IGhhc2hlciYgX19oZiwgY29uc3Qga2V5X2VxdWFsJiBfX2VxbCwKKwkJICAgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisJOiBfTV9odChfX24sIF9faGYsIF9fZXFsLCBfX2EpCisgICAgICAgIHsgX01faHQuaW5zZXJ0X2VxdWFsKF9fZiwgX19sKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuc2l6ZSgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X3NpemUoKTsgfQorCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbXB0eSgpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgI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bnN0CisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGNvdW50KGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmNvdW50KF9fa2V5KTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBpdGVyYXRvcj4KKyAgICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVxdWFsX3JhbmdlKF9fa2V5KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVyYXNlKF9fa2V5KTsgfQorICAKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9faXQpCisgICAgICB7IF9NX2h0LmVyYXNlKF9faXQpOyB9CisgIAorICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19mLCBpdGVyYXRvciBfX2wpCisgICAgICB7IF9NX2h0LmVyYXNlKF9fZiwgX19sKTsgfQorICAKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCkKKyAgICAgIHsgX01faHQuY2xlYXIoKTsgfQorCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9faGludCkKKyAgICAgIHsgX01faHQucmVzaXplKF9faGludCk7IH0KKyAgCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5idWNrZXRfY291bnQoKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X2J1Y2tldF9jb3VudCgpOyB9CisKKyAgICAgIHNpemVfdHl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ZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194KQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKyAgICAgIAorICAgICAgaW5zZXJ0X2l0ZXJhdG9yKF9Db250YWluZXImIF9feCwgdHlwZW5hbWUgX0NvbnRhaW5lcjo6aXRlcmF0b3IpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgdHlwZW5hbWUgX0NvbnRhaW5lcjo6dmFsdWVfdHlwZSYgX192YWx1ZSkKKyAgICAgIHsKKwljb250YWluZXItPmluc2VydChfX3ZhbHVlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKigpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorICAgICAgCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsgcmV0dXJuICp0aGlzOyB9CisgICAgICAKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeyByZXR1cm4gKnRoaXM7IH0KKyAgICB9OworCisgIHRlbXBsYXRlPGNsYXNzIF9WYWx1ZSwgY2xhc3MgX0hhc2hGY24sIGNsYXNzIF9FcXVhbEtleSwgY2xhc3MgX0FsbG9jPgorICAgIGNsYXNzIGluc2VydF9pdGVyYXRvcjxfX2dudV9jeHg6Omhhc2hfbXVsdGlzZXQ8X1ZhbHVlLCBfSGFzaEZjbiwKKwkJCQkJCSAgIF9FcXVhbEtleSwgX0FsbG9jPiA+CisgICAgeworICAgIHByb3RlY3RlZDoKKyAgICAgIHR5cGVkZWYgX19nbnVfY3h4OjpoYXNoX211bHRpc2V0PF9WYWx1ZSwgX0hhc2hGY24sIF9FcXVhbEtleSwgX0FsbG9jPgorICAgICAgICBfQ29udGFpbmVyOworICAgICAgX0NvbnRhaW5lciogY29udGFpbmVyOworICAgICAgdHlwZW5hbWUgX0NvbnRhaW5lcjo6aXRlcmF0b3IgaXRlcjsKKworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgX0NvbnRhaW5lciAgICAgICAgICBjb250YWluZXJfdHlwZTsKKyAgICAgIHR5cGVkZWYgb3V0cHV0X2l0ZXJhdG9yX3RhZyBpdGVyYXRvcl9jYXRlZ29yeTsKKyAgICAgIHR5cGVkZWYgdm9pZCAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgdm9pZCAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIAorICAgICAgaW5zZXJ0X2l0ZXJhdG9yKF9Db250YWluZXImIF9feCkKKyAgICAgIDogY29udGFpbmVyKCZfX3gpIHt9CisgICAgICAKKyAgICAgIGluc2VydF9pdGVyYXRvcihfQ29udGFpbmVyJiBfX3gsIHR5cGVuYW1lIF9Db250YWluZXI6Oml0ZXJhdG9yKQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yPF9Db250YWluZXI+JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHR5cGVuYW1lIF9Db250YWluZXI6OnZhbHVlX3R5cGUmIF9fdmFsdWUpCisgICAgICB7CisJY29udGFpbmVyLT5pb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9yOworICAgICAgdHlwZWRlZiBfSGFzaHRhYmxlX25vZGU8X1ZhbD4gX05vZGU7CisgICAgICB0eXBlZGVmIGZvcndhcmRfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiBfVmFsIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHB0cmRpZmZfdCBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIHNpemVfdCBzaXplX3R5cGU7CisgICAgICB0eXBlZGVmIF9WYWwmIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgX1ZhbCogcG9pbnRlcjsKKyAgICAgIAorICAgICAgX05vZGUqIF9NX2N1cjsKKyAgICAgIF9IYXNodGFibGUqIF9NX2h0OworCisgICAgICBfSGFzaHRhYmxlX2l0ZXJhdG9yKF9Ob2RlKiBfX24sIF9IYXNodGFibGUqIF9fdGFiKQorICAgICAgOiBfTV9jdXIoX19uKSwgX01faHQoX190YWIpIHsgfQorCisgICAgICBfSGFzaHRhYmxlX2l0ZXJhdG9yKCkgeyB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2N1ci0+X01fdmFsOyB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdAorICAgICAgeyByZXR1cm4gJihvcGVyYXRvciooKSk7IH0KKworICAgICAgaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCk7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCk7CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgaXRlcmF0b3ImIF9faXQpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9jdXIgPT0gX19pdC5fTV9jdXI7IH0KKworICAgICAgYm9vbAorICAgICAgb3BlcmF0b3IhPShjb25zdCBpdGVyYXRvci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uc3QgX1ZhbCogcG9pbnRlcjsKKyAgICAgIAorICAgICAgY29uc3QgX05vZGUqIF9NX2N1cjsKKyAgICAgIGNvbnN0IF9IYXNodGFibGUqIF9NX2h0OworCisgICAgICBfSGFzaHRhYmxlX2NvbnN0X2l0ZXJhdG9yKGNvbnN0IF9Ob2RlKiBfX24sIGNvbnN0IF9IYXNodGFibGUqIF9fdGFiKQorICAgICAgOiBfTV9jdXIoX19uKSwgX01faHQoX190YWIpIHsgfQorCisgICAgICBfSGFzaHRhYmxlX2NvbnN0X2l0ZXJhdG9yKCkgeyB9CisKKyAgICAgIF9IYXNodGFibGVfY29uc3RfaXRlcmF0b3IoY29uc3QgaXRlcmF0b3ImIF9faXQpCisgICAgICA6IF9NX2N1cihfX2l0Ll9NX2N1ciksIF9NX2h0KF9faXQuX01faHQpIHsgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9jdXItPl9NX3ZhbDsgfQorCisgICAgICBwb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICYob3BlcmF0b3IqKCkpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3IrKygpOworCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgb3BlcmF0b3IrKyhpbnQpOworCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2l0KSBjb25zdAorICAgICAgeyByZXR1cm4gX01fY3VyID09IF9faXQuX01fY3VyOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgY29uc3RfaXRlcmF0b3ImIF9faXQpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9jdXIgIT0gX19pdC5fTV9jdXI7IH0KKyAgICB9OworCisgIC8vIE5vdGU6IGFzc3VtZXMgbG9uZyBpcy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M6OnRlbXBsYXRlIHJlYmluZDxfTm9kZSo+OjpvdGhlciBfTm9kZXB0cl9BbGxvYzsKKyAgICAgIHR5cGVkZWYgdmVjdG9yPF9Ob2RlKiwgX05vZGVwdHJfQWxsb2M+IF9WZWN0b3JfdHlwZTsKKworICAgICAgX05vZGVfQWxsb2MgX01fbm9kZV9hbGxvY2F0b3I7CisKKyAgICAgIF9Ob2RlKgorICAgICAgX01fZ2V0X25vZGUoKQorICAgICAgeyByZXR1cm4gX01fbm9kZV9hbGxvY2F0b3IuYWxsb2NhdGUoMSk7IH0KKworICAgICAgdm9pZAorICAgICAgX01fcHV0X25vZGUoX05vZGUqIF9fcCkKKyAgICAgIHsgX01fbm9kZV9hbGxvY2F0b3IuZGVhbGxvY2F0ZShfX3AsIDEpOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgaGFzaGVyICAgICAgICAgICAgICAgIF9NX2hhc2g7CisgICAgICBrZXlfZXF1YWwgICAgICAgICAgICAgX01fZXF1YWxzOworICAgICAgX0V4dHJhY3RLZXkgICAgICAgICAgIF9NX2dldF9rZXk7CisgICAgICBfVmVjdG9yX3R5cGUgICAgICAgICAgX01fYnVja2V0czsKKyAgICAgIHNpemVfdHlwZSAgICAgICAgICAgICBfTV9udW1fZWxlbWVudHM7CisgICAgICAKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9IYXNodGFibGVfaXRlcmF0b3I8X1ZhbCwgX0tleSwgX0hhc2hGY24sIF9FeHRyYWN0S2V5LAorCQkJCSAgX0VxdWFsS2V5LCBfQWxsb2M+CisgICAgICAgIGl0ZXJhdG9yOworICAgICAgdHlwZWRlZiBfSGFzaHRhYmxlX2NvbnN0X2l0ZXJhdG9yPF9WYWwsIF9LZXksIF9IYXNoRmNuLCBfRXh0cmFjdEtleSwKKwkJCQkJX0VxdWFsS2V5LCBfQWxsb2M+CisgICAgICAgIGNvbnN0X2l0ZXJhdG9yOworCisgICAgICBmcmllbmQgc3RydWN0CisgICAgICBfSGF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aHRhYmxlKGNvbnN0IGhhc2h0YWJsZSYgX19odCkKKyAgICAgIDogX01fbm9kZV9hbGxvY2F0b3IoX19odC5nZXRfYWxsb2NhdG9yKCkpLCBfTV9oYXNoKF9faHQuX01faGFzaCksCisgICAgICBfTV9lcXVhbHMoX19odC5fTV9lcXVhbHMpLCBfTV9nZXRfa2V5KF9faHQuX01fZ2V0X2tleSksCisgICAgICBfTV9idWNrZXRzKF9faHQuZ2V0X2FsbG9jYXRvcigpKSwgX01fbnVtX2VsZW1lbnRzKDApCisgICAgICB7IF9NX2NvcHlfZnJvbShfX2h0KTsgfQorCisgICAgICBoYXNodGFibGUmCisgICAgICBvcGVyYXRvcj0gKGNvbnN0IGhhc2h0YWJsZSYgX19odCkKKyAgICAgIHsKKwlpZiAoJl9faHQgIT0gdGhpcykKKwkgIHsKKwkgICAgY2xlYXIoKTsKKwkgICAgX01faGFzaCA9IF9faHQuX01faGFzaDsKKwkgICAgX01fZXF1YWxzID0gX19odC5fTV9lcXVhbHM7CisJICAgIF9NX2dldF9rZXkgPSBfX2h0Ll9NX2dldF9rZXk7CisJICAgIF9NX2NvcHlfZnJvbShfX2h0KTsKKwkgIH0KKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIH5oYXNodGFibGUoKQorICAgICAgeyBjbGVhcigpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9udW1fZWxlbWVudHM7IH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBzaXplX3R5cGUoLTEpOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIGVtcHR5KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHNpemUoKSA9PSAwOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAoaGFzaHRhYmxlJiBfX2h0KQorICAgICAgeworCXN0ZDo6c3dhcChfTV9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gX0VxLAorCQljbGFzcyBfQWw+CisgICAgICAgIGZyaWVuZCBib29sCisgICAgICAgIG9wZXJhdG9yPT0oY29uc3QgaGFzaHRhYmxlPF9WbCwgX0t5LCBfSEYsIF9FeCwgX0VxLCBfQWw+JiwKKwkJICAgY29uc3QgaGFzaHRhYmxlPF9WbCwgX0t5LCBfSEYsIF9FeCwgX0VxLCBfQWw+Jik7CisKKyAgICBwdWJsaWM6CisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9idWNrZXRzLnNpemUoKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX0hhc2h0YWJsZV9wcmltZV9saXN0PHVuc2lnbmVkIGxvbmc+OjoKKyAgICAgICAgICAgICAgIF9TX2dldF9wcmltZV9saXN0KClbKGludClfU19udW1fcHJpbWVzIC0gMV07CisgICAgICB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZWxlbXNfaW5fYnVja2V0KHNpemVfdHlwZSBfX2J1Y2tldCkgY29uc3QKKyAgICAgIHsKKwlzaXplX3R5cGUgX19yZXN1bHQgPSAwOworCWZvciAoX05vZGUqIF9fbiA9IF9NX2J1Y2tldHNbX19idWNrZXRdOyBfX247IF9fbiA9IF9fbi0+X01fbmV4dCkKKwkgIF9fcmVzdWx0ICs9IDE7CisJcmV0dXJuIF9fcmVzdWx0OworICAgICAgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0X3VuaXF1ZShjb25zdCB2YWx1ZV90eXBlJiBfX29iaikKKyAgICAgIHsKKwlyZXNpemUoX01fbnVtX2VsZW1lbnRzICsgMSk7CisJcmV0dXJuIGluc2VydF91bmlxdWVfbm9yZXNpemUoX19vYmopOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0X2VxdWFsK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X2VxdWFsX25vcmVzaXplKCpfX2YpOworCX0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBmaW5kX29yX2luc2VydChjb25zdCB2YWx1ZV90eXBlJiBfX29iaik7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBmaW5kKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHsKKwlzaXplX3R5cGUgX19uID0gX01fYmt0X251bV9rZXkoX19rZXkpOworCV9Ob2RlKiBfX2ZpcnN0OworCWZvciAoX19maXJzdCA9IF9NX2J1Y2tldHNbX19uXTsKKwkgICAgIF9fZmlyc3QgJiYgIV9NX2VxdWFscyhfTV9nZXRfa2V5KF9fZmlyc3QtPl9NX3ZhbCksIF9fa2V5KTsKKwkgICAgIF9fZmlyc3QgPSBfX2ZpcnN0LT5fTV9uZXh0KQorCSAgeyB9CisJcmV0dXJuIGl0ZXJhdG9yKF9fZmlyc3QsIHRoaXMpOworICAgICAgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7CisJc2l6ZV90eXBlIF9fbiA9IF9NX2JrdF9udW1fa2V5KF9fa2V5KTsKKwljb25zdCBfTm9kZSogX19maXJzdDsKKwlmb3IgKF9fZmlyc3QgPSBfTV9idWNrZXRzW19fbl07CisJICAgICBfX2ZpcnN0ICYmICFfTV9lcXVhbHMoX01fZ2V0X2tleShfX2ZpcnN0LT5fTV92YWwpLCBfX2tleSk7CisJICAgICBfX2ZpcnN0ID0gX19maXJzdC0+X01fbmV4dCkKKwkgIHsgfQorCXJldHVybiBjb25zdF9pdGVyYXRvcihfX2ZpcnN0LCB0aGlzKTsKKyAgICAgIH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBjb3VudChjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7CisJY29uc3Qgc2l6ZV90eXBlIF9fbiA9IF9NX2JrdF9udW1fa2V5KF9fa2V5KTsKKwlzaXplX3R5cGUgX19yZXN1bHQgPSAwOworCQorCWZvciAoY29uc3QgX05vZGUqIF9fY3VyID0gX01fYnVja2V0c1tfX25dOyBfX2N1cjsKKwkgICAgIF9fY3VyID0gX19jdXItPl9NX25leHQpCisJICBpZiAoX01fZXF1YWxzKF9NX2dldF9rZXkoX19jdXItPl9NX3ZhbCksIF9fa2V5KSkKKwkgICAgKytfX3Jlc3VsdDsKKwlyZXR1cm4gX19yZXN1bHQ7CisgICAgICB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KTsKKworICAgICAgcGFpcjxjb25zdF9pdGVyYXRvciwgY29uc3RfaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0OworCisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlKGNvbnN0IGtleV90eXBlJiBfX2tleSk7CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGNvbnN0IGl0ZXJhdG9yJiBfX2l0KTsKKworICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19maXJzdCwgaXRlcmF0b3IgX19sYXN0KTsKKworICAgICAgdm9pZAorICAgICAgZXJhc2UoY29uc3QgY29uc3RfaXRlcmF0b3ImIF9faXQpOworCisgICAgICB2b2lkCisgICAgICBlcmFzZShjb25zdF9pdGVyYXRvciBfX2ZpcnN0LCBjb25zdF9pdGVyYXRvciBfX2xhc3QpOworCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9fbnVtX2VsZW1lbnRzX2hpbnQpOworCisgICAgICB2b2lkCisgICAgICBjbGVhcigpOworCisgICAgcHJpdmF0ZToKKyAgICAgIHNpemVfdHlwZQorICAgICAgX01fbmV4dF9zaXplKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfX3N0bF9uZXh0X3ByaW1lKF9fbik7IH0KKworICAgICAgdm9pZAorICAgICAgX01faW5pdGlhbGl6ZV9idWNrZXRzKHNpemVfdHlwZSBfX24pCisgICAgICB7CisJY29uc3Qgc2l6ZV90eXBlIF9fbl9idWNrZXRzID0gX01fbmV4dF9zaXplKF9fbik7CisJX01fYnVja2V0cy5yZXNlcnZlKF9fbl9idWNrZXRzKTsKKwlfTV9idWNrZXRzLmluc2VydChfTV9idWNrZXRzLmVuZCgpLCBfX25fYnVja2V0cywgKF9Ob2RlKikgMCk7CisJX01fbnVtX2VsZW1lbnRzID0gMDsKKyAgICAgIH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBfTV9ia3RfbnVtX2tleShjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ia3RfbnVtX2tleShfX2tleSwgX01fYnVja2V0cy5zaXplKCkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgX01fYmt0X251bShjb25zdCB2YWx1ZV90eXBlJiBfX29iaikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2JrdF9udW1fa2V5KF9NX2dldF9rZXkoX19vYmopKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIF9NX2JrdF9udW1fa2V5KGNvbnN0IGtleV90eXBlJiBfX2tleSwgc2l6ZV90IF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2hhc2goX19rZXkpICUgX19uOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgX01fYmt0X251bShjb25zdCB2YWx1ZV90eXBlJiBfX29iaiwgc2l6ZV90IF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2JrdF9udW1fa2V5KF9NX2dldF9rZXkoX19vYmopLCBfX24pOyB9CisKKyAgICAgIF9Ob2RlKgorICAgICAgX01fbmV3X25vZGUoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7CisJX05vZGUqIF9fbiA9IF9NX2dldF9ub2RlKCk7CisJX19uLT5fTV9uZXh0ID0gMDsKKwlfX3RyeQorCSAgeworCSAgICB0aGlzLT5nZXRfYWxsb2NhdG9yKCkuY29uc3RydWN0KCZfX24tPl9NX3ZhbCwgX19vYmopOworCSAgICByZXR1cm4gX19uOworCSAgfQorCV9fY2F0Y2goLi4uKQorCSAgeworCSAgICBfTV9wdXRfbm9kZShfX24pOworCSAgICBfX3Rocm93X2V4Y2VwdGlvbl9hZ2FpbjsKKwkgIH0KKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZGVsZXRlX25vZGUoX05vZGUqIF9fbikKKyAgICAgIHsKKwl0aGlzLT5nZXRfYWxsb2NhdG9yKCkuZGVzdHJveSgmX19uLT5fTV92YWwpOworCV9NX3B1dF9ub2RlKF9fbik7CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIF9NX2VyYXNlX2J1Y2tldChjb25zdCBzaXplX3R5cGUgX19uLCBfTm9kZSogX19maXJzdCwgX05vZGUqIF9fbGFzdCk7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2VyYXNlX2J1Y2tldChjb25zdCBzaXplX3R5cGUgX19uLCBfTm9kZSogX19sYXN0KTsKKworICAgICAgdm9pZAorICAgICAgX01fY29weV9mcm9tKGNvbnN0IGhhc2h0YWJsZSYgX19odCk7CisgICAgfTsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVmFsLCBjbGFzcyBfS2V5LCBjbGFzcyBfSEYsIGNsYXNzIF9FeEssIGNsYXNzIF9FcUssCisJICAgIGNsYXNzIF9BbGw+CisgICAgX0hhc2h0YWJsZV9pdGVyYXRvcjxfVmFsLCBfS2V5LCBfSEYsIF9FeEssIF9FcUssIF9BbGw+JgorICAgIF9IYXNodGFibGVfaXRlcmF0b3I8X1ZhbCwgX0tleSwgX0hGLCBfRXhLLCBfRXFLLCBfQWxsPjo6CisgICAgb3BlcmF0b3IrKygpCisgICAgeworIC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AgICBvcGVyYXRvcisrKCkKKyAgICB7CisgICAgICBjb25zdCBfTm9kZSogX19vbGQgPSBfTV9jdXI7CisgICAgICBfTV9jdXIgPSBfTV9jdXItPl9NX25leHQ7CisgICAgICBpZiAoIV9NX2N1cikKKwl7CisJICBzaXplX3R5cGUgX19idWNrZXQgPSBfTV9odC0+X01fYmt0X251bShfX29sZC0+X01fdmFsKTsKKwkgIHdoaWxlICghX01fY3VyICYmICsrX19idWNrZXQgPCBfTV9odC0+X01fYnVja2V0cy5zaXplKCkpCisJICAgIF9NX2N1ciA9IF9NX2h0LT5fTV9idWNrZXRzW19fYnVja2V0XTsKKwl9CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgIHRlbXBsYXRlPGNsYXNzIF9WYWwsIGNsYXNzIF9LZXksIGNsYXNzIF9IRiwgY2xhc3MgX0V4SywgY2xhc3MgX0VxSywKKwkgICAgY2xhc3MgX0FsbD4KKyAgICBpbmxpbmUgX0hhc2h0YWJsZV9jb25zdF9pdGVyYXRvcjxfVmFsLCBfS2V5LCBfSEYsIF9FeEssIF9FcUssIF9BbGw+CisgICAgX0hhc2h0YWJsZV9jb25zdF9pdGVyYXRvcjxfVmFsLCBfS2V5LCBfSEYsIF9FeEssIF9FcUssIF9BbGw+OjoKKyAgICBvcGVyYXRvcisrKGludCkKKyAgICB7CisgICAgICBjb25zdF9pdGVyYXRvciBfX3RtcCA9ICp0aGlzOworICAgICAgKysqdGhpczsKKyAgICAgIHJldHVybiBfX3RtcDsKKyAgICB9CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1ZhbCwgY2xhc3MgX0tleSwgY2xhc3MgX0hGLCBjbGFzcyBfRXgsIGNsYXNzIF9FcSwgY2xhc3MgX0FsbD4KKyAgICBib29sCisgICAgb3BlcmF0b3I9PShjb25zdCBoYXNodGFibGU8X1ZhbCwgX0tleSwgX0hGLCBfRXgsIF9FcSwgX0FsbD4mIF9faHQxLAorCSAgICAgICBjb25zdCBoYXNodGFibGU8X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hbHMoX01fZ2V0X2tleShfX25leHQtPl9NX3ZhbCksIF9fa2V5KSkKKwkJeworCQkgIGlmICgmX01fZ2V0X2tleShfX25leHQtPl9NX3ZhbCkgIT0gJl9fa2V5KQorCQkgICAgeworCQkgICAgICBfX2N1ci0+X01fbmV4dCA9IF9fbmV4dC0+X01fbmV4dDsKKwkJICAgICAgX01fZGVsZXRlX25vZGUoX19uZXh0KTsKKwkJICAgICAgX19uZXh0ID0gX19jdXItPl9NX25leHQ7CisJCSAgICAgICsrX19lcmFzZWQ7CisJCSAgICAgIC0tX01fbnVtX2VsZW1lbnRzOworCQkgICAgfQorCQkgIGVsc2UKKwkJICAgIHsKKwkJICAgICAgX19zYXZlZF9zbG90ID0gX19jdXI7CisJCSAgICAgIF9fY3VyID0gX19uZXh0OworCQkgICAgICBfX25leHQgPSBfX2N1ci0+X01fbmV4dDsKKwkJICAgIH0KKwkJfQorCSAgICAgIGVsc2UKKwkJeworCQkgIF9fY3VyID0gX19uZXh0OworCQkgIF9fbmV4dCA9IF9fY3VyLT5fTV9uZXh0OworCQl9CisJICAgIH0KKwkgIGJvb2wgX19kZWxldGVfZmlyc3QgPSBfTV9lcXVhbHMoX01fZ2V0X2tleShfX2ZpcnN0LT5fTV92YWwpLCBfX2tleSk7CisJICBpZiAoX19zYXZlZF9zbG90KQorCSAgICB7CisJICAgICAgX19uZXh0ID0gX19zYXZlZF9zbG90LT5fTV9uZXh0OworCSAgICAgIF9fc2F2ZWRfc2xvdC0+X01fbmV4dCA9IF9fbmV4dC0+X01fbmV4dDsKKwkgICAgICBfTV9kZWxldGVfbm9kZShfX25leHQpOworCSAgICAgICsrX19lcmFzZWQ7CisJICAgICAgLS1fTV9udW1fZWxlbWVudHM7CisJICAgIH0KKwkgIGlmIChfX2RlbGV0ZV9maXJzdCkKKwkgICAgeworCSAgICAgIF9NX2J1Y2tldHNbX19uXSA9IF9fZmlyc3QtPl9NX25leHQ7CisJICAgICAgX01fZGVsZXRlX25vZGUoX19maXJzdCk7CisJICAgICAgKytfX2VyYXNlZDsKKwkgICAgICAtLV9NX251bV9lbGVtZW50czsKKwkgICAgfQorCX0KKyAgICAgIHJldHVybiBfX2VyYXNlZDsKKyAgICB9CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1ZhbCwgY2xhc3MgX0tleSwgY2xhc3MgX0hGLCBjbGFzcyBfRXgsIGNsYXNzIF9FcSwgY2xhc3MgX0FsbD4KKyAgICB2b2lkIGhhc2h0YWJsZTxfVmFsLCBfS2V5LCBfSEYsIF9FeCwgX0VxLCBfQWxsPjo6CisgICAgZXJhc2UoY29uc3QgaXRlcmF0b3ImIF9faXQpCisgICAgeworICAgICAgX05vZGUqIF9fcCA9IF9faXQuX01fY3VyOworICAgICAgaWYgKF9fcCkKKwl7CisJICBjb25zdCBzaXplX3R5cGUgX19uID0gX01fYmt0X251bShfX3AtPl9NX3ZhbCk7CisJICBfTm9kZSogX19jdXIgPSBfTV9idWNrZXRzW19fbl07CisJICAKKwkgIGlmIChfX2N1ciA9PSBfX3ApCisJICAgIHsKKwkgICAgICBfTV9idWNrZXRzW19fbl0gPSBfX2N1ci0+X01fbmV4dDsKKwkgICAgICBfTV9kZWxldGVfbm9kZShfX2N1cik7CisJICAgICAgLS1fTV9udW1fZWxlbWVudHM7CisJICAgIH0KKwkgIGVsc2UKKwkgICAgeworCSAgICAgIF9Ob2RlKiBfX25leHQgPSBfX2N1ci0+X01fbmV4dDsKKwkgICAgICB3aGlsZSAoX19uZXh0KQorCQl7CisJCSAgaWYgKF9fbmV4dCA9PSBfX3ApCisJCSAgICB7CisJCSAgICAgIF9fY3VyLT5fTV9uZXh0ID0gX19uZXh0LT5fTV9uZXh0OworCQkgICAgICBfTV9kZWxldGVfbm9kZShfX25leHQpOworCQkgICAgICAtLV9NX251bV9lbGVtZW50czsKKwkJICAgICAgYnJlYWs7CisJCSAgICB9CisJCSAgZWxzZQorCQkgICAgeworCQkgICAgICBfX2N1ciA9IF9fbmV4dDsKKwkJICAgICAgX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hc2h0YWJsZSo+KF9faXQuX01faHQpKSk7IH0KKworICB0ZW1wbGF0ZTxjbGFzcyBfVmFsLCBjbGFzcyBfS2V5LCBjbGFzcyBfSEYsIGNsYXNzIF9FeCwgY2xhc3MgX0VxLCBjbGFzcyBfQWxsPgorICAgIHZvaWQKKyAgICBoYXNodGFibGU8X1ZhbCwgX0tleSwgX0hGLCBfRXgsIF9FcSwgX0FsbD46OgorICAgIHJlc2l6ZShzaXplX3R5cGUgX19udW1fZWxlbWVudHNfaGludCkKKyAgICB7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19vbGRfbiA9IF9NX2J1Y2tldHMuc2l6ZSgpOworICAgICAgaWYgKF9fbnVtX2VsZW1lbnRzX2hpbnQgPiBfX29sZF9uKQorCXsKKwkgIGNvbnN0IHNpemVfdHlwZSBfX24gPSBfTV9uZXh0X3NpemUoX19udW1fZWxlbWVudHNfaGludCk7CisJICBpZiAoX19uID4gX19vbGRfbikKKwkgICAgeworCSAgICAgIF9WZWN0b3JfdHlwZSBfX3RtcChfX24sIChfTm9kZSopKDApLCBfTV9idWNrZXRzLmdldF9hbGxvY2F0b3IoKSk7CisJICAgICAgX190cnkKKwkJeworCQkgIGZvciAoc2l6ZV90eXBlIF9fYnVja2V0ID0gMDsgX19idWNrZXQgPCBfX29sZF9uOyArK19fYnVja2V0KQorCQkgICAgeworCQkgICAgICBfTm9kZSogX19maXJzdCA9IF9NX2J1Y2tldHNbX19idWNrZXRdOworCQkgICAgICB3aGlsZSAoX19maXJzdCkKKwkJCXsKKwkJCSAgc2l6ZV90eXBlIF9fbmV3X2J1Y2tldCA9IF9NX2JrdF9udW0oX19maXJzdC0+X01fdmFsLAorCQkJCQkJCSAgICAgIF9fbik7CisJCQkgIF9NX2J1Y2tldHNbX19idWNrZXRdID0gX19maXJzdC0+X01fbmV4dDsKKwkJCSAgX19maXJzdC0+X01fbmV4dCA9IF9fdG1wW19fbmV3X2J1Y2tldF07CisJCQkgIF9fdG1wW19fbmV3X2J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F9FcSwgX0FsbD46OgorICAgIGNsZWFyKCkKKyAgICB7CisgICAgICBpZiAoX01fbnVtX2VsZW1lbnRzID09IDApCisJcmV0dXJuOworCisgICAgICBmb3IgKHNpemVfdHlwZSBfX2kgPSAwOyBfX2kgPCBfTV9idWNrZXRzLnNpemUoKTsgKytfX2kpCisJeworCSAgX05vZGUqIF9fY3VyID0gX01fYnVja2V0c1tfX2ldOworCSAgd2hpbGUgKF9fY3VyICE9IDApCisJICAgIHsKKwkgICAgICBfTm9kZSogX19uZXh0ID0gX19jdXItPl9NX25leHQ7CisJICAgICAgX01fZGVsZXRlX25vZGUoX19jdXIpOworCSAgICAgIF9fY3VyID0gX19uZXh0OworCSAgICB9CisJICBfTV9idWNrZXRzW19faV0gPSAwOworCX0KKyAgICAgIF9NX251bV9lbGVtZW50cyA9IDA7CisgICAgfQorCisgIHRlbXBsYXRlPGNsYXNzIF9WYWwsIGNsYXNzIF9LZXksIGNsYXNzIF9IRiwgY2xhc3MgX0V4LCBjbGFzcyBfRXEsIGNsYXNzIF9BbGw+CisgICAgdm9pZAorICAgIGhhc2h0YWJsZTxfVmFsLCBfS2V5LCBfSEYsIF9FeCwgX0VxLCBfQWxsPjo6CisgICAgX01fY29weV9mcm9tKGNvbnN0IGhhc2h0YWJsZSYgX19odCkKKyAgICB7CisgICAgICBfTV9idWNrZXRzLmNsZWFyKCk7CisgICAgICBfTV9idWNrZXRzLnJlc2VydmUoX19odC5fTV9idWNrZXRzLnNpemUoKSk7CisgICAgICBfTV9idWNrZXRzLmluc2VydChfTV9idWNrZXRzLmVuZCgpLCBfX2h0Ll9NX2J1Y2tldHMuc2l6ZSgpLCAoX05vZGUqKSAwKTsKKyAgICAgIF9fdHJ5CisJeworCSAgZm9yIChzaXplX3R5cGUgX19pID0gMDsgX19pIDwgX19odC5fTV9idWNrZXRzLnNpemUoKTsgKytfX2kpIHsKKwkgICAgY29uc3QgX05vZGUqIF9fY3VyID0gX19odC5fTV9idWNrZXRzW19faV07CisJ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55X29mIChDKysweCkKKyAgICBiaW5hcnlfc2VhcmNoCisgICAgY29weQorICAgIGNvcHlfYmFja3dhcmQKKyAgICBjb3B5X2lmIChDKysweCkKKyAgICBjb3B5X24gKEMrKzB4KQorICAgIGNvdW50CisgICAgY291bnRfaWYKKyAgICBlcXVhbAorICAgIGVxdWFsX3JhbmdlCisgICAgZmlsbAorICAgIGZpbGxfbgorICAgIGZpbmQKKyAgICBmaW5kX2VuZAorICAgIGZpbmRfZmlyc3Rfb2YKKyAgICBmaW5kX2lmCisgICAgZmluZF9pZl9ub3QgKEMrKzB4KQorICAgIGZvcl9lYWNoCisgICAgZ2VuZXJhdGUKKyAgICBnZW5lcmF0ZV9uCisgICAgaW5jbHVkZXMKKyAgICBpbnBsYWNlX21lcmdlCisgICAgaXNfaGVhcCAoQysrMHgpCisgICAgaXNfaGVhcF91bnRpbCAoQysrMHgpCisgICAgaXNfcGFydGl0aW9uZWQgKEMrKzB4KQorICAgIGlzX3NvcnRlZCAoQysrMHgpCisgICAgaXNfc29ydGVkX3VudGlsIChDKysweCkKKyAgICBpdGVyX3N3YXAKKyAgICBsZXhpY29ncmFwaGljYWxfY29tcGFyZQorICAgIGxvd2VyX2JvdW5kCisgICAgbWFrZV9oZWFwCisgICAgbWF4CisgICAgbWF4X2VsZW1lbnQKKyAgICBtZXJnZQorICAgIG1pbgorICAgIG1pbl9lbGVtZW50CisgICAgbWlubWF4IChDKysweCkKKyAgICBtaW5tYXhfZWxlbWVudCAoQysrMHgpCisgICAgbWlzbWF0Y2gKKyAgICBuZXh0X3Blcm11dGF0aW9uCisgICAgbm9uZV9vZiAoQysrMHgpCisgICAgbnRoX2VsZW1lbnQKKyAgICBwYXJ0aWFsX3NvcnQKKyAgICBwYXJ0aWFsX3NvcnRfY29weQorICAgIHBhcnRpdGlvbgorICAgIHBhcnRpdGlvbl9jb3B5IChDKysweCkKKyAgICBwYXJ0aXRpb25fcG9pbnQgKEMrKzB4KQorICAgIHBvcF9oZWFwCisgICAg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BhbGxvY2F0b3IncyBzaXplIHR5cGUKKyAgICAgICAqCisgICAgICAgKiBAYyBBbGxvYzo6c2l6ZV90eXBlIGlmIHRoYXQgdHlwZSBleGlzdHMsIG90aGVyd2lzZQorICAgICAgICogPHR0PiBtYWtlX3Vuc2lnbmVkPGRpZmZlcmVuY2VfdHlwZT46OnR5cGUgPC90dD4KKyAgICAgICovCisgICAgICB0eXBlZGVmIF9fc2l6ZV90eXBlIHNpemVfdHlwZTsKKworX0dMSUJDWFhfQUxMT0NfVFJfTkVTVEVEX1RZUEUocHJvcGFnYXRlX29uX2NvbnRhaW5lcl9jb3B5X2Fzc2lnbm1lbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZV90eXBlKQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiAgIEhvdyB0aGUgYWxsb2NhdG9yIGlzIHByb3BhZ2F0ZWQgb24gY29weSBhc3NpZ25tZW50CisgICAgICAgKgorICAgICAgICogQGMgQWxsb2M6OnByb3BhZ2F0ZV9vbl9jb250YWluZXJfY29weV9hc3NpZ25tZW50IGlmIHRoYXQgdHlwZSBleGlzdHMsCisgICAgICAgKiBvdGhlcndpc2UgQGMgZmFsc2VfdHlwZQorICAgICAgKi8KKyAgICAgIHR5cGVkZWYgX19wcm9wYWdhdGVfb25fY29udGFpbmVyX2NvcHlfYXNzaWdubWVudAorICAgICAgIAlwcm9wYWdhdGVfb25fY29udGFpbmVyX2NvcHlfYXNzaWdubWVudDsKKworX0dMSUJDWFhfQUxMT0NfVFJfTkVTVEVEX1RZUEUocHJvcGFnYXRlX29uX2NvbnRhaW5lcl9tb3ZlX2Fzc2lnbm1lbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZV90eXBlKQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiAgIEhvdyB0aGUgYWxsb2NhdG9yIGlzIHByb3BhZ2F0ZWQgb24gbW92ZSBhc3NpZ25tZW50CisgICAgICAgKgorICAgICAgICogQGMgQWxsb2M6OnByb3BhZ2F0ZV9vbl9jb250YWluZXJfbW92ZV9hc3NpZ25tZW50IGlmIHRoYXQgdHlwZSBleGlzdHMsCisgICAgICAgKiBvdGhlcndpc2UgQGMgZmFsc2VfdHlwZQorICAgICAgKi8KKyAgICAgIHR5cGVkZWYgX19wcm9wYWdhdGVfb25fY29udGFpbmVyX21vdmVfYXNzaWdubWVudAorICAgICAgIAlwcm9wYWdhdGVfb25fY29udGFpbmVyX21vdmVfYXNzaWdubWVudDsKKworX0dMSUJDWFhfQUxMT0NfVFJfTkVTVEVEX1RZUEUocHJvcGFnYXRlX29uX2NvbnRhaW5lcl9zd2FwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2VfdHlwZSkKKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgICBIb3cgdGhlIGFsbG9jYXRvciBpcyBwcm9wYWdhdGVkIG9uIHN3YXAKKyAgICAgICAqCisgICAgICAgKiBAYyBBbGxvYzo6cHJvcGFnYXRlX29uX2NvbnRhaW5lcl9zd2FwIGlmIHRoYXQgdHlwZSBleGlzdHMsCisgICAgICAgKiBvdGhlcndpc2UgQGMgZmFsc2VfdHlwZQorICAgICAgKi8KKyAgICAgIHR5cGVkZWYgX19wcm9wYWdhdGVfb25fY29udGFpbmVyX3N3YXAgcHJvcGFnYXRlX29uX2NvbnRhaW5lcl9zd2FwOworCisjdW5kZWYgX0dMSUJDWFhfQUxMT0NfVFJfTkVTVEVEX1RZUEUKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICB1c2luZyByZWJpbmRfYWxsb2MgPSB0eXBlbmFtZSBfX2FsbG9jdHJfcmViaW5kPF9BbGxvYywgX1RwPjo6X190eXBlOworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICB1c2luZyByZWJpbmRfdHJhaXRzID0gYWxsb2NhdG9yX3RyYWl0czxyZWJpbmRfYWxsb2M8X1RwPj47CisKKy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0FsbG9jMiYgX19hKQorCXsgcmV0dXJuIF9fYTsgfQorCisgICAgcHVibGljOgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFsbG9jYXRlIG1lbW9yeS4KKyAgICAgICAqICBAcGFyYW0gIF9fYSAgQW4gYWxsb2NhdG9yLgorICAgICAgICogIEBwYXJhbSAgX19uICBUaGUgbnVtYmVyIG9mIG9iamVjdHMgdG8gYWxsb2NhdGUgc3BhY2UgZm9yLgorICAgICAgICoKKyAgICAgICAqICBDYWxscyBAYyBhLmFsbG9jYXRlKG4pCisgICAgICAqLworICAgICAgc3RhdGljIHBvaW50ZXIKKyAgICAgIGFsbG9jYXRlKF9BbGxvYyYgX19hLCBzaXplX3R5cGUgX19uKQorICAgICAgeyByZXR1cm4gX19hLmFsbG9jYXRlKF9fbik7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBbGxvY2F0ZSBtZW1vcnkuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFuIGFsbG9jYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgVGhlIG51bWJlciBvZiBvYmplY3RzIHRvIGFsbG9jYXRlIHNwYWNlIGZvci4KKyAgICAgICAqICBAcGFyYW0gIF9faGludCBBaWQgdG8gbG9jYWxpdHkuCisgICAgICAgKiAgQHJldHVybiBNZW1vcnkgb2Ygc3VpdGFibGUgc2l6ZSBhbmQgYWxpZ25tZW50IGZvciBAYSBuIG9iamVjdHMKKyAgICAgICAqICAgICAgICAgIG9mIHR5cGUgQGMgdmFsdWVfdHlwZQorICAgICAgICoKKyAgICAgICAqICBSZXR1cm5zIDx0dD4gYS5hbGxvY2F0ZShuLCBoaW50KSA8L3R0PiBpZiB0aGF0IGV4cHJlc3Npb24gaXMKKyAgICAgICAqICB3ZWxsLWZvcm1lZCwgb3RoZXJ3aXNlIHJldHVybnMgQGMgYS5hbGxvY2F0ZShuKQorICAgICAgKi8KKyAgICAgIHN0YXRpYyBwb2ludGVyCisg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UKKyAgICAgICAqICBAcGFyYW0gIF9fYSAgQW4gYWxsb2NhdG9yLgorICAgICAgICogIEByZXR1cm4gQGMgX19hLm1heF9zaXplKCkgb3IgQGMgbnVtZXJpY19saW1pdHM8c2l6ZV90eXBlPjo6bWF4KCkKKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBAYyBfX2EubWF4X3NpemUoKSBpZiB0aGF0IGV4cHJlc3Npb24gaXMgd2VsbC1mb3JtZWQsCisgICAgICAgKiAgb3RoZXJ3aXNlIHJldHVybnMgQGMgbnVtZXJpY19saW1pdHM8c2l6ZV90eXBlPjo6bWF4KCkKKyAgICAgICovCisgICAgICBzdGF0aWMgc2l6ZV90eXBlIG1heF9zaXplKGNvbnN0IF9BbGxvYyYgX19hKQorICAgICAgeyByZXR1cm4gX1NfbWF4X3NpemUoX19hKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE9idGFpbiBhbiBhbGxvY2F0b3IgdG8gdXNlIHdoZW4gY29weWluZyBhIGNvbnRhaW5lci4KKyAgICAgICAqICBAcGFyYW0gIF9fcmhzICBBbiBhbGxvY2F0b3IuCisgICAgICAgKiAgQHJldHVybiBAYyBfX3Jocy5zZWxlY3Rfb25fY29udGFpbmVyX2NvcHlfY29uc3RydWN0aW9uKCkgb3IgQGEgX19yaHMKKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBAYyBfX3Jocy5zZWxlY3Rfb25fY29udGFpbmVyX2NvcHlfY29uc3RydWN0aW9uKCkgaWYgdGhhdAorICAgICAgICogIGV4cHJlc3Npb24gaXMgd2VsbC1mb3JtZWQsIG90aGVyd2lzZSByZXR1cm5zIEBhIF9fcmhzCisgICAgICAqLworICAgICAgc3RhdGljIF9BbGxvYworICAgICAgc2VsZWN0X29uX2NvbnRhaW5lcl9jb3B5X2NvbnN0cnVjdGlvbihjb25zdCBfQWxsb2MmIF9fcmhzKQorICAgICAgeyByZXR1cm4gX1Nfc2VsZWN0KF9fcmhzKTsgf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gICAJYXRvbWljX2ludF9mYXN0NjRfdDsKKworICAvLy8gYXRvbWljX3VpbnRfZmFzdDY0X3QKKyAgdHlwZWRlZiBfX2F0b21pY19iYXNlPHVpbnRfZmFzdDY0X3Q+CSAgICAgIAlhdG9taWNfdWludF9mYXN0NjRfdDsKKworCisgIC8vLyBhdG9taWNfaW50cHRyX3QKKyAgdHlwZWRlZiBfX2F0b21pY19iYXNlPGludHB0cl90PiAgCSAgICAgICAJYXRvbWljX2ludHB0cl90OworCisgIC8vLyBhdG9taWNfdWludHB0cl90CisgIHR5cGVkZWYgX19hdG9taWNfYmFzZTx1aW50cHRyX3Q+ICAJICAgICAgIAlhdG9taWNfdWludHB0cl90OworCisgIC8vLyBhdG9taWNfc2l6ZV90CisgIHR5cGVkZWYgX19hdG9taWNfYmFzZTxzaXplX3Q+CSAJICAgICAgIAlhdG9taWNfc2l6ZV90OworCisgIC8vLyBhdG9taWNfaW50bWF4X3QKKyAgdHlwZWRlZiBfX2F0b21pY19iYXNlPGludG1heF90PiAgCSAgICAgICAJYXRvbWljX2ludG1heF90OworCisgIC8vLyBhdG9taWNfdWludG1heF90CisgIHR5cGVkZWYgX19hdG9taWNfYmFzZTx1aW50bWF4X3Q+ICAJICAgICAgIAlhdG9taWNfdWludG1heF90OworCisgIC8vLyBhdG9taWNfcHRyZGlmZl90CisgIHR5cGVkZWYgX19hdG9taWNfYmFzZTxwdHJkaWZmX3Q+ICAJICAgICAgIAlhdG9taWNfcHRyZGlmZl90OworCisKKyNkZWZpbmUgQVRPTUlDX1ZBUl9JTklUKF9WSSkgeyBfVkkgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdHJ1Y3QgYXRvbWljOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdHJ1Y3QgYXRvbWljPF9UcCo+OworCisKKyAgLyoqCisgICAqICBAYnJpZWYgQmFzZSB0eXBlIGZvciBhdG9taWNfZmxhZy4KKyAgICoKKyA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b21pY19sbG9uZyAgICBsb25nIGxvbmcKKyAgLy8gYXRvbWljX3VsbG9uZyAgIHVuc2lnbmVkIGxvbmcgbG9uZworICAvLyBhdG9taWNfY2hhcjE2X3QgY2hhcjE2X3QKKyAgLy8gYXRvbWljX2NoYXIzMl90IGNoYXIzMl90CisgIC8vIGF0b21pY193Y2hhcl90ICB3Y2hhcl90CisgIC8vCisgIC8vIE5COiBBc3N1bWluZyBfSVRwIGlzIGFuIGludGVncmFsIHNjYWxhciB0eXBlIHRoYXQgaXMgMSwgMiwgNCwgb3IKKyAgLy8gOCBieXRlcywgc2luY2UgdGhhdCBpcyB3aGF0IEdDQyBidWlsdC1pbiBmdW5jdGlvbnMgZm9yIGF0b21pYworICAvLyBtZW1vcnkgYWNjZXNzIGV4cGVjdC4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0lUcD4KKyAgICBzdHJ1Y3QgX19hdG9taWNfYmFzZQorICAgIHsKKyAgICBwcml2YXRlOgorICAgICAgdHlwZWRlZiBfSVRwIAlfX2ludF90eXBlOworCisgICAgICBfX2ludF90eXBlIAlfTV9pOworCisgICAgcHVibGljOgorICAgICAgX19hdG9taWNfYmFzZSgpIG5vZXhjZXB0ID0gZGVmYXVsdDsKKyAgICAgIH5fX2F0b21pY19iYXNlKCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgX19hdG9taWNfYmFzZShjb25zdCBfX2F0b21pY19iYXNlJikgPSBkZWxldGU7CisgICAgICBfX2F0b21pY19iYXNlJiBvcGVyYXRvcj0oY29uc3QgX19hdG9taWNfYmFzZSYpID0gZGVsZXRlOworICAgICAgX19hdG9taWNfYmFzZSYgb3BlcmF0b3I9KGNvbnN0IF9fYXRvbWljX2Jhc2UmKSB2b2xhdGlsZSA9IGRlbGV0ZTsKKworICAgICAgLy8gUmVxdWlyZXMgX19pbnRfdHlwZSBjb252ZXJ0aWJsZSB0byBfTV9pLgorICAgICAgY29uc3RleHByIF9fYXRvbWljX2Jhc2UoX19pbnRfdHlwZSBfX2kpIG5vZXhjZXB0IDogX01faSAoX19pKSB7IH0KKworICAgICAgb3BlcmF0b3IgX19pbnRfdHlwZSgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBsb2FkKCk7IH0KKworICAgICAgb3BlcmF0b3IgX19pbnRfdHlwZSgpIGNvbnN0IHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBsb2FkKCk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3I9KF9faW50X3R5cGUgX19pKSBub2V4Y2VwdAorICAgICAgeworCXN0b3JlKF9faSk7CisJcmV0dXJuIF9faTsKKyAgICAgIH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3I9KF9faW50X3R5cGUgX19pKSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeworCXN0b3JlKF9faSk7CisJcmV0dXJuIF9faTsKKyAgICAgIH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3IrKyhpbnQpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBmZXRjaF9hZGQoMSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3IrKyhpbnQpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBmZXRjaF9hZGQoMSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3ItLShpbnQpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBmZXRjaF9zdWIoMSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3ItLShpbnQpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBmZXRjaF9zdWIoMSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3IrKygpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2F0b21pY19hZGRfZmV0Y2goJl9NX2ksIDEsIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvcisrKCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYXRvbWljX2FkZF9mZXRjaCgmX01faSwgMSwgbWVtb3J5X29yZGVyX3NlcV9jc3QpOyB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIG9wZXJhdG9yLS0oKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfc3ViX2ZldGNoKCZfTV9pLCAxLCBtZW1vcnlfb3JkZXJfc2VxX2NzdCk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3ItLSgpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2F0b21pY19zdWJfZmV0Y2goJl9NX2ksIDEsIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvcis9KF9faW50X3R5cGUgX19pKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfYWRkX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvcis9KF9faW50X3R5cGUgX19pKSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfYWRkX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvci09KF9faW50X3R5cGUgX19pKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfc3ViX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvci09KF9faW50X3R5cGUgX19pKSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfc3ViX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvciY9KF9faW50X3R5cGUgX19pKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfYW5kX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvciY9KF9faW50X3R5cGUgX19pKSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfYW5kX2ZldGNoKCZfTV9pLCBfX2ksIG1lbW9yeV9vcmRlcl9zZXFfY3N0KTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBvcGVyYXRvcnw9KF9faW50X3R5cGUgX19pKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfb3JfZmV0Y2goJl9NX2ksIF9faSwgbWVtb3J5X29yZGVyX3NlcV9jc3QpOyB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIG9wZXJhdG9yfD0oX19pbnRfdHlwZSBfX2kpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2F0b21pY19vcl9mZXRjaCgmX01faSwgX19pLCBtZW1vcnlfb3JkZXJfc2VxX2NzdCk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3JePShfX2ludF90eXBlIF9faSkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYXRvbWljX3hvcl9mZXRjaCgmX01faSwgX19pLCBtZW1vcnlfb3JkZXJfc2VxX2NzdCk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgb3BlcmF0b3JePShfX2ludF90eXBlIF9faSkgdm9sYXRpbGU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JX19nbGliY3h4X2Fzc2VydChfX20gIT0gbWVtb3J5X29yZGVyX2NvbnN1bWUpOworCisJX19hdG9taWNfc3RvcmVfbigmX01faSwgX19pLCBfX20pOworICAgICAgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBsb2FkKG1lbW9yeV9vcmRlciBfX20gPSBtZW1vcnlfb3JkZXJfc2VxX2NzdCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsKKwlfX2dsaWJjeHhfYXNzZXJ0KF9fbSAhPSBtZW1vcnlfb3JkZXJfcmVsZWFzZSk7CisJX19nbGliY3h4X2Fzc2VydChfX20gIT0gbWVtb3J5X29yZGVyX2FjcV9yZWwpOworCisJcmV0dXJuIF9fYXRvbWljX2xvYWRfbigmX01faSwgX19tKTsKKyAgICAgIH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgbG9hZChtZW1vcnlfb3JkZXIgX19tID0gbWVtb3J5X29yZGVyX3NlcV9jc3QpIGNvbnN0IHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7CisJX19nbGliY3h4X2Fzc2VydChfX20gIT0gbWVtb3J5X29yZGVyX3JlbGVhc2UpOworCV9fZ2xpYmN4eF9hc3NlcnQoX19tICE9IG1lbW9yeV9vcmRlcl9hY3FfcmVsKTsKKworCXJldHVybiBfX2F0b21pY19sb2FkX24oJl9NX2ksIF9fbSk7CisgICAgICB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIGV4Y2hhbmdlKF9faW50X3R5cGUgX19pLAorCSAgICAgICBtZW1vcnlfb3JkZXIgX19tID0gbWVtb3J5X29yZGVyX3NlcV9jc3QpIG5vZXhjZXB0CisgICAgICB7CisJcmV0dXJuIF9fYXRvbWljX2V4Y2hhbmdlX24oJl9NX2ksIF9faSwgX19tKTsKKyAgICAgIH0KKworCisgICAgICBfX2ludF90eXBlCisgICAgICBleGNoYW5nZShfX2ludF90eXBlIF9faSwKKwkgICAgICAgbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV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N0cm9uZyhfX2kxLCBfX2kyLCBfX20sCisJCQkJICAgICAgIF9fY21wZXhjaF9mYWlsdXJlX29yZGVyKF9fbSkpOworICAgICAgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBmZXRjaF9hZGQoX19pbnRfdHlwZSBfX2ksCisJCW1lbW9yeV9vcmRlciBfX20gPSBtZW1vcnlfb3JkZXJfc2VxX2NzdCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYXRvbWljX2ZldGNoX2FkZCgmX01faSwgX19pLCBfX20pOyB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIGZldGNoX2FkZChfX2ludF90eXBlIF9faSwKKwkJbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV9vcmRlcl9zZXFfY3N0KSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfZmV0Y2hfYWRkKCZfTV9pLCBfX2ksIF9fbSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgZmV0Y2hfc3ViKF9faW50X3R5cGUgX19pLAorCQltZW1vcnlfb3JkZXIgX19tID0gbWVtb3J5X29yZGVyX3NlcV9jc3QpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2F0b21pY19mZXRjaF9zdWIoJl9NX2ksIF9faSwgX19tKTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBmZXRjaF9zdWIoX19pbnRfdHlwZSBfX2ksCisJCW1lbW9yeV9vcmRlciBfX20gPSBtZW1vcnlfb3JkZXJfc2VxX2NzdCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYXRvbWljX2ZldGNoX3N1YigmX01faSwgX19pLCBfX20pOyB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIGZldGNoX2FuZChfX2ludF90eXBlIF9faSwKKwkJbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV9vcmRlcl9zZXFfY3N0KSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfZmV0Y2hfYW5kKCZfTV9pLCBfX2ksIF9fbSk7IH0KKworICAgICAgX19pbnRfdHlwZQorICAgICAgZmV0Y2hfYW5kKF9faW50X3R5cGUgX19pLAorCQltZW1vcnlfb3JkZXIgX19tID0gbWVtb3J5X29yZGVyX3NlcV9jc3QpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2F0b21pY19mZXRjaF9hbmQoJl9NX2ksIF9faSwgX19tKTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBmZXRjaF9vcihfX2ludF90eXBlIF9faSwKKwkgICAgICAgbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV9vcmRlcl9zZXFfY3N0KSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfZmV0Y2hfb3IoJl9NX2ksIF9faSwgX19tKTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBmZXRjaF9vcihfX2ludF90eXBlIF9faSwKKwkgICAgICAgbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV9vcmRlcl9zZXFfY3N0KSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19hdG9taWNfZmV0Y2hfb3IoJl9NX2ksIF9faSwgX19tKTsgfQorCisgICAgICBfX2ludF90eXBlCisgICAgICBmZXRjaF94b3IoX19pbnRfdHlwZSBfX2ksCisJCW1lbW9yeV9vcmRlciBfX20gPSBtZW1vcnlfb3JkZXJfc2VxX2NzdCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYXRvbWljX2ZldGNoX3hvcigmX01faSwgX19pLCBfX20pOyB9CisKKyAgICAgIF9faW50X3R5cGUKKyAgICAgIGZldGNoX3hvcihfX2ludF90eXBlIF9faSwKKwkJbWVtb3J5X29yZGVyIF9fbSA9IG1lbW9yeV9vcmRlcl9zZXFfY3N0KSB2b2xhdGlsZSBub2V4Y2VwdAorICAgICAgeyByZXR1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ZSBjb252ZXJ0aWJsZSB0byBfTV9wLgorICAgICAgY29uc3RleHByIF9fYXRvbWljX2Jhc2UoX19wb2ludGVyX3R5cGUgX19wKSBub2V4Y2VwdCA6IF9NX3AgKF9fcCkgeyB9CisKKyAgICAgIG9wZXJhdG9yIF9fcG9pbnRlcl90eXBlKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGxvYWQoKTsgfQorCisgICAgICBvcGVyYXRvciBfX3BvaW50ZXJfdHlwZSgpIGNvbnN0IHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBsb2FkKCk7IH0KKworICAgICAgX19wb2ludGVyX3R5cGUKKyAgICAgIG9wZXJhdG9yPShfX3BvaW50ZXJfdHlwZSBfX3ApIG5vZXhjZXB0CisgICAgICB7CisJc3RvcmUoX19wKTsKKwlyZXR1cm4gX19wOworICAgICAgfQorCisgICAgICBfX3BvaW50ZXJfdHlwZQorICAgICAgb3BlcmF0b3I9KF9fcG9pbnRlcl90eXBlIF9fcCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHsKKwlzdG9yZShfX3ApOworCXJldHVybiBfX3A7CisgICAgICB9CisKKyAgICAgIF9fcG9pbnRlcl90eXBlCisgICAgICBvcGVyYXRvcisrKGludCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGZldGNoX2FkZCgxKTsgfQorCisgICAgICBfX3BvaW50ZXJfdHlwZQorICAgICAgb3BlcmF0b3IrKyhpbnQpIHZvbGF0aWxlIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBmZXRjaF9hZGQoMSk7IH0KKworICAgICAgX19wb2ludGVyX3R5cGUKKyAgICAgIG9wZXJhdG9yLS0oaW50KSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gZmV0Y2hfc3ViKDEpOyB9CisKKyAgICAgIF9fcG9pbnRlcl90eXBlCisgICAgICBvcGVyYXRvci0tKGludCkgdm9sYXRpbGUgbm9leGNlcHQKKyAgICAgIHs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XJlIHN0YW5kYXJkIHR5cGVzLiAgVGhleSBwZXJtaXQgYSBzdGFuZGFyZGl6ZWQgd2F5IG9mCisgICAgICAgKiAgcmVmZXJyaW5nIHRvIG5hbWVzIG9mIChvciBuYW1lcyBkZXBlbmRhbnQgb24pIHRoZSB0ZW1wbGF0ZQorICAgICAgICogIHBhcmFtZXRlcnMsIHdoaWNoIGFyZSBzcGVjaWZpYyB0byB0aGUgaW1wbGVtZW50YXRpb24uCisgICAgICAqLworICAgICAgdHlwZWRlZiBfQ2hhclQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9UcmFpdHM6OmludF90eXBlICAgICAgICAgICAgIGludF90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfVHJhaXRzOjpwb3NfdHlwZSAgICAgICAgICAgICBwb3NfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX1RyYWl0czo6b2ZmX3R5cGUgICAgICAgICAgICAgb2ZmX3R5cGU7CisgICAgICB0eXBlZGVmIF9UcmFpdHMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWl0c190eXBlOworICAgICAgLy9AfQorCisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBUaGVzZSBhcmUgbm9uLXN0YW5kYXJkIHR5cGVzLgorICAgICAgKi8KKyAgICAgIHR5cGVkZWYgY3R5cGU8X0NoYXJUPiAgICAgICAgICAgICAgICAgICAgICAgICAgX19jdHlwZV90eXBlOworICAgICAgdHlwZWRlZiBudW1fcHV0PF9DaGFyVCwgb3N0cmVhbWJ1Zl9pdGVyYXRvcjxfQ2hhclQsIF9UcmFpdHM+ID4KKwkJCQkJCSAgICAgX19udW1fcHV0X3R5cGU7CisgICAgICB0eXBlZGVmIG51bV9nZXQ8X0NoYXJULCBpc3RyZWFtYnVmX2l0ZXJhdG9yPF9DaGFyVCwgX1RyYWl0cz4gPgorCQkJCQkJICAgICBfX251bV9nZXRfdHlwZTsKKyAgICAgIC8vQH0KKworICAgICAgLy8gRGF0YSBtZW1iZXJzOgorICAgIHByb3RlY3RlZDoKKyAgICAgIGJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiogICAgICAgICAgICAgICAgX01fdGllOworICAgICAgbXV0YWJsZSBjaGFyX3R5cGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfTV9maWxsOworICAgICAgbXV0YWJsZSBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfTV9maWxsX2luaXQ7CisgICAgICBiYXNpY19zdHJlYW1idWY8X0NoYXJULCBfVHJhaXRzPiogICAgICAgICAgICAgIF9NX3N0cmVhbWJ1ZjsKKworICAgICAgLy8gQ2FjaGVkIHVzZV9mYWNldDxjdHlwZT4sIHdoaWNoIGlzIGJhc2VkIG9uIHRoZSBjdXJyZW50IGxvY2FsZSBpbmZvLgorICAgICAgY29uc3QgX19jdHlwZV90eXBlKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfTV9jdHlwZTsKKyAgICAgIC8vIEZvciBvc3RyZWFtLgorICAgICAgY29uc3QgX19udW1fcHV0X3R5cGUqICAgICAgICAgICAgICAgICAgICAgICAgICBfTV9udW1fcHV0OworICAgICAgLy8gRm9yIGlzdHJlYW0uCisgICAgICBjb25zdCBfX251bV9nZXRfdHlwZSogICAgICAgICAgICAgICAgICAgICAgICAgIF9NX251bV9nZXQ7CisKKyAgICBwdWJsaWM6CisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRoZSBxdWljay1hbmQtZWFzeSBzdGF0dXMgY2hlY2suCisgICAgICAgKgorICAgICAgICogIFRoaXMgYWxsb3dzIHlvdSB0byB3cml0ZSBjb25zdHJ1Y3RzIHN1Y2ggYXMKKyAgICAgICAqICA8Y29kZT5pZiAoIWFfc3RyZWFtKSAuLi48L2NvZGU+IGFuZCA8Y29kZT53aGlsZSAoYV9zdHJlYW0pIC4uLjwvY29kZT4KKyAgICAgICovCisgICAgICBvcGVyYXRvciB2b2lkKigpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5mYWlsKCkgPyAwIDogY29uc3RfY2FzdDxiYXNpY19pb3MqPih0aGlzKTsgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvciEoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZmFpbCgpOyB9CisgICAgICAvL0B9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJucyB0aGUgZXJyb3Igc3RhdGUgb2YgdGhlIHN0cmVhbSBidWZmZXIuCisgICAgICAgKiAgQHJldHVybiAgQSBiaXQgcGF0dGVybiAod2VsbCwgaXNuJ3QgZXZlcnl0aGluZz8pCisgICAgICAgKgorICAgICAgICogIFNlZSBzdGQ6Omlvc19iYXNlOjppb3N0YXRlIGZvciB0aGUgcG9zc2libGUgYml0IHZhbHVlcy4gIE1vc3QKKyAgICAgICAqICB1c2VycyB3aWxsIGNhbGwgb25lIG9mIHRoZSBpbnRlcnByZXRpbmcgd3JhcHBlcnMsIGUuZy4sIGdvb2QoKS4KKyAgICAgICovCisgICAgICBpb3N0YXRlCisgICAgICByZHN0YXRlKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3N0cmVhbWJ1Zl9zdGF0ZTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFtSZV1zZXRzIHRoZSBlcnJvciBzdGF0ZS4KKyAgICAgICAqICBAcGFyYW0gIF9fc3RhdGUgIFRoZSBuZXcgc3RhdGUgZmxhZyhzKSB0byBzZXQuCisgICAgICAgKgorICAgICAgICogIFNlZSBzdGQ6Omlvc19iYXNlOjppb3N0YXRlIGZvciB0aGUgcG9zc2libGUgYml0IHZhbHVlcy4gIE1vc3QKKyAgICAgICAqICB1c2VycyB3aWxsIG5vdCBuZWVkIHRvIHBhc3MgYW4gYXJndW1lbnQuCisgICAgICAqLworICAgICAg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YXN0IGVycm9yIGNoZWNraW5nLgorICAgICAgICogIEByZXR1cm4gIFRydWUgaWYgbm8gZXJyb3IgZmxhZ3MgYXJlIHNldC4KKyAgICAgICAqCisgICAgICAgKiAgQSB3cmFwcGVyIGFyb3VuZCByZHN0YXRlLgorICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGdvb2QoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+cmRzdGF0ZSgpID09IDA7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGYXN0IGVycm9yIGNoZWNraW5nLgorICAgICAgICogIEByZXR1cm4gIFRydWUgaWYgdGhlIGVvZmJpdCBpcyBzZXQuCisgICAgICAgKgorICAgICAgICogIE5vdGUgdGhhdCBvdGhlciBpb3N0YXRlIGZsYWdzIG1heSBhbHNvIGJlIHNldC4KKyAgICAgICovCisgICAgICBib29sCisgICAgICBlb2YoKSBjb25zdAorICAgICAgeyByZXR1cm4gKHRoaXMtPnJkc3RhdGUoKSAmIGVvZmJpdCkgIT0gMDsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZhc3QgZXJyb3IgY2hlY2tpbmcuCisgICAgICAgKiAgQHJldHVybiAgVHJ1ZSBpZiBlaXRoZXIgdGhlIGJhZGJpdCBvciB0aGUgZmFpbGJpdCBpcyBzZXQuCisgICAgICAgKgorICAgICAgICogIENoZWNraW5nIHRoZSBiYWRiaXQgaW4gZmFpbCgpIGlzIGhpc3RvcmljYWwgcHJhY3RpY2UuCisgICAgICAgKiAgTm90ZSB0aGF0IG90aGVyIGlvc3RhdGUgZmxhZ3MgbWF5IGFsc28gYmUgc2V0LgorICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGZhaWwoKSBjb25zdAorICAgICAgeyByZXR1cm4gKHRoaXMtPnJkc3RhdGUoKSAmIChiYWRiaXQgfCBmYWlsYml0KSkgIT0gMDsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZhc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AgICAqICB9CisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICovCisgICAgICB2b2lkCisgICAgICBleGNlcHRpb25zKGlvc3RhdGUgX19leGNlcHQpCisgICAgICB7CisgICAgICAgIF9NX2V4Y2VwdGlvbiA9IF9fZXhjZXB0OworICAgICAgICB0aGlzLT5jbGVhcihfTV9zdHJlYW1idWZfc3RhdGUpOworICAgICAgfQorCisgICAgICAvLyBDb25zdHJ1Y3Rvci9kZXN0cnVjdG9yOgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb25zdHJ1Y3RvciBwZXJmb3JtcyBpbml0aWFsaXphdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIHBhcmFtZXRlciBpcyBwYXNzZWQgYnkgZGVyaXZlZCBzdHJlYW1zLgorICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBiYXNpY19pb3MoYmFzaWNfc3RyZWFtYnVmPF9DaGFyVCwgX1RyYWl0cz4qIF9fc2IpCisgICAgICA6IGlvc19iYXNlKCksIF9NX3RpZSgwKSwgX01fZmlsbCgpLCBfTV9maWxsX2luaXQoZmFsc2UpLCBfTV9zdHJlYW1idWYoMCksCisJX01fY3R5cGUoMCksIF9NX251bV9wdXQoMCksIF9NX251bV9nZXQoMCkKKyAgICAgIHsgdGhpcy0+aW5pdChfX3NiKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEVtcHR5LgorICAgICAgICoKKyAgICAgICAqICBUaGUgZGVzdHJ1Y3RvciBkb2VzIG5vdGhpbmcuICBNb3JlIHNwZWNpZmljYWxseSwgaXQgZG9lcyBub3QKKyAgICAgICAqICBkZXN0cm95IHRoZSBzdHJlYW1idWYgaGVsZCBieSByZGJ1ZigpLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwKKyAgICAgIH5iYXNpY19pb3MoKSB7IH0KKworICAgICAgLy8gTWVtYmVyczoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmV0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0aGlzIGZ1bmN0aW9uIGlzIGhpZGRlbgorICAgICAgICogIGluIGRlcml2ZWQgY2xhc3NlcyBieSBvdmVycmlkZXMgb2YgdGhlIHplcm8tYXJndW1lbnQgQGMgcmRidWYoKSwKKyAgICAgICAqICB3aGljaCBpcyBub24tdmlydHVhbCBmb3IgaHlzdGVyaWNhbCByYWlzaW5zLiAgQXMgYSByZXN1bHQsIHlvdQorICAgICAgICogIG11c3QgdXNlIGV4cGxpY2l0IHF1YWxpZmljYXRpb25zIHRvIGFjY2VzcyB0aGlzIGZ1bmN0aW9uIHZpYSBhbnkKKyAgICAgICAqICBkZXJpdmVkIGNsYXNzLiAgRm9yIGV4YW1wbGU6CisgICAgICAgKgorICAgICAgICogIEBjb2RlCisgICAgICAgKiAgc3RkOjpmc3RyZWFtICAgICBmb287ICAgICAgICAgLy8gb3Igc29tZSBvdGhlciBkZXJpdmVkIHR5cGUKKyAgICAgICAqICBzdGQ6OnN0cmVhbWJ1ZiogIHAgPSAuLi4uLjsKKyAgICAgICAqCisgICAgICAgKiAgZm9vLmlvczo6cmRidWYocCk7ICAgICAgICAgICAgLy8gaW9zID09IGJhc2ljX2lvczxjaGFyPgorICAgICAgICogIEBlbmRjb2RlCisgICAgICAqLworICAgICAgYmFzaWNfc3RyZWFtYnVmPF9DaGFyVCwgX1RyYWl0cz4qCisgICAgICByZGJ1ZihiYXNpY19zdHJlYW1idWY8X0NoYXJULCBfVHJhaXRzPiogX19zYik7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29waWVzIGZpZWxkcyBvZiBfX3JocyBpbnRvIHRoaXMuCisgICAgICAgKiAgQHBhcmFtICBfX3JocyAgVGhlIHNvdXJjZSB2YWx1ZXMgZm9yIHRoZSBjb3BpZXMuCisgICAgICAgKiAgQHJldHVybiAgUmVmZXJlbmNlIHRvIHRoaXMgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqICBBbGwgZmllbGRzIG9mIF9fcmhzIGFyZSBjb3BpZWQgaW50byB0aGlzIG9iamVjdCBleGNlcHQgdGhhdCByZGJ1ZigpCisgICAgICAgKiAgYW5kIHJkc3RhdGUoKSByZW1haW4gdW5jaGFuZ2VkLiAgQWxsIHZhbHVlcyBpbiB0aGUgcHdvcmQgYW5kIGl3b3JkCisgICAgICAgKiAgYXJyYXlzIGFyZSBjb3BpZWQuICBCZWZvcmUgY29weWluZywgZWFjaCBjYWxsYmFjayBpcyBpbnZva2VkIHdpdGgKKyAgICAgICAqICBlcmFzZV9ldmVudC4gIEFmdGVyIGNvcHlpbmcsIGVhY2ggKG5ldykgY2FsbGJhY2sgaXMgaW52b2tlZCB3aXRoCisgICAgICAgKiAgY29weWZtdF9ldmVudC4gIFRoZSBmaW5hbCBzdGVwIGlzIHRvIGNvcHkgZXhjZXB0aW9ucygpLgorICAgICAgKi8KKyAgICAgIGJhc2ljX2lvcyYKKyAgICAgIGNvcHlmbXQoY29uc3QgYmFzaWNfaW9zJiBfX3Jocyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0cmlldmVzIHRoZSBAYSBlbXB0eSBjaGFyYWN0ZXIuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGN1cnJlbnQgZmlsbCBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIEl0IGRlZmF1bHRzIHRvIGEgc3BhY2UgKCcgJykgaW4gdGhlIGN1cnJlbnQgbG9jYWxlLgorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZQorICAgICAgZmlsbCgpIGNvbnN0CisgICAgICB7CisJaWYgKCFfTV9maWxsX2luaXQpCisJICB7CisJICAgIF9NX2ZpbGwgPSB0aGlzLT53aWRlbignICcpOworCSAgICBfTV9maWxsX2luaXQgPSB0cnVlOworCSAgfQorCXJldHVybiBfTV9maWxsOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldHMgYSBuZXcgQGEgZW1wdHkgY2hhcmFjdGVyLgorICAgICAgICogIEBwYXJhbSA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Yy5nbnUub3JnL29ubGluZWRvY3MvbGlic3RkYysrL21hbnVhbC9sb2NhbGl6YXRpb24uaHRtbAorICAgICAgKi8KKyAgICAgIGxvY2FsZQorICAgICAgaW1idWUoY29uc3QgbG9jYWxlJiBfX2xvYyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU3F1ZWV6ZXMgY2hhcmFjdGVycy4KKyAgICAgICAqICBAcGFyYW0gIF9fYyAgVGhlIGNoYXJhY3RlciB0byBuYXJyb3cuCisgICAgICAgKiAgQHBhcmFtICBfX2RmYXVsdCAgVGhlIGNoYXJhY3RlciB0byBuYXJyb3cuCisgICAgICAgKiAgQHJldHVybiAgVGhlIG5hcnJvd2VkIGNoYXJhY3Rlci4KKyAgICAgICAqCisgICAgICAgKiAgTWFwcyBhIGNoYXJhY3RlciBvZiBAYyBjaGFyX3R5cGUgdG8gYSBjaGFyYWN0ZXIgb2YgQGMgY2hhciwKKyAgICAgICAqICBpZiBwb3NzaWJsZS4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyB0aGUgcmVzdWx0IG9mCisgICAgICAgKiAgQGNvZGUKKyAgICAgICAqICAgIHN0ZDo6dXNlX2ZhY2V0PGN0eXBlPGNoYXJfdHlwZT4gPihnZXRsb2MoKSkubmFycm93KGMsZGZhdWx0KQorICAgICAgICogIEBlbmRjb2RlCisgICAgICAgKgorICAgICAgICogIEFkZGl0aW9uYWwgbDEwbiBub3RlcyBhcmUgYXQKKyAgICAgICAqICBodHRwOi8vZ2NjLmdudS5vcmcvb25saW5lZG9jcy9saWJzdGRjKysvbWFudWFsL2xvY2FsaXphdGlvbi5odG1sCisgICAgICAqLworICAgICAgY2hhcgorICAgICAgbmFycm93KGNoYXJfdHlwZSBfX2MsIGNoYXIgX19kZmF1bHQpIGNvbnN0CisgICAgICB7IHJldHVybiBfX2NoZWNrX2ZhY2V0KF9NX2N0eXBlKS5uYXJyb3coX19jLCBfX2RmYXVsdCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbnMgY2hhcmFjdGVycy4KKyAgICAgICAqICBAcGFyYW0gIF9fYyAgVGhlIGNoYXJhY3RlciB0byB3aWRlbi4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgd2lkZW5lZCBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIE1hcHMgYSBjaGFyYWN0ZXIgb2YgQGMgY2hhciB0byBhIGNoYXJhY3RlciBvZiBAYyBjaGFyX3R5cGUuCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgdGhlIHJlc3VsdCBvZgorICAgICAgICogIEBjb2RlCisgICAgICAgKiAgICBzdGQ6OnVzZV9mYWNldDxjdHlwZTxjaGFyX3R5cGU+ID4oZ2V0bG9jKCkpLndpZGVuKGMpCisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICAqCisgICAgICAgKiAgQWRkaXRpb25hbCBsMTBuIG5vdGVzIGFyZSBhdAorICAgICAgICogIGh0dHA6Ly9nY2MuZ251Lm9yZy9vbmxpbmVkb2NzL2xpYnN0ZGMrKy9tYW51YWwvbG9jYWxpemF0aW9uLmh0bWwKKyAgICAgICovCisgICAgICBjaGFyX3R5cGUKKyAgICAgIHdpZGVuKGNoYXIgX19jKSBjb25zdAorICAgICAgeyByZXR1cm4gX19jaGVja19mYWNldChfTV9jdHlwZSkud2lkZW4oX19jKTsgfQorCisgICAgcHJvdGVjdGVkOgorICAgICAgLy8gMjcuNC41LjEgIGJhc2ljX2lvcyBjb25zdHJ1Y3RvcnMKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRW1wdHkuCisgICAgICAgKgorICAgICAgICogIFRoZSBkZWZhdWx0IGNvbnN0cnVjdG9yIGRvZXMgbm90aGluZyBhbmQgaXMgbm90IG5vcm1hbGx5CisgICAgICAgKiAgYWNjZXNzaWJsZSB0byB1c2Vycy4KKyAgICAgICovCisgICAgICBiYXNpY19pb3MoKQorICAgICAgOiBpb3NfYmFzZSgpLCBfTV90aWU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mNtQGNhbnRyaXAub3JnPi4KKyAgICoKKyAgICogIEEgc3RyaW5nIGxvb2tzIGxpa2UgdGhpczoKKyAgICoKKyAgICogIEBjb2RlCisgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtfUmVwXQorICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfTV9sZW5ndGgKKyAgICogICBbYmFzaWNfc3RyaW5nPGNoYXJfdHlwZT5dICAgICAgICAgICAgX01fY2FwYWNpdHkKKyAgICogICBfTV9kYXRhcGx1cyAgICAgICAgICAgICAgICAgICAgICAgICAgX01fcmVmY291bnQKKyAgICogICBfTV9wIC0tLS0tLS0tLS0tLS0tLS0+ICAgICAgICAgICAgICAgdW5uYW1lZCBhcnJheSBvZiBjaGFyX3R5cGUKKyAgICogIEBlbmRjb2RlCisgICAqCisgICAqICBXaGVyZSB0aGUgX01fcCBwb2ludHMgdG8gdGhlIGZpcnN0IGNoYXJhY3RlciBpbiB0aGUgc3RyaW5nLCBhbmQKKyAgICogIHlvdSBjYXN0IGl0IHRvIGEgcG9pbnRlci10by1fUmVwIGFuZCBzdWJ0cmFjdCAxIHRvIGdldCBhCisgICAqICBwb2ludGVyIHRvIHRoZSBoZWFkZXIuCisgICAqCisgICAqICBUaGlzIGFwcHJvYWNoIGhhcyB0aGUgZW5vcm1vdXMgYWR2YW50YWdlIHRoYXQgYSBzdHJpbmcgb2JqZWN0CisgICAqICByZXF1aXJlcyBvbmx5IG9uZSBhbGxvY2F0aW9uLiAgQWxsIHRoZSB1Z2xpbmVzcyBpcyBjb25maW5lZAorICAgKiAgd2l0aGluIGEgc2luZ2xlICVwYWlyIG9mIGlubGluZSBmdW5jdGlvbnMsIHdoaWNoIGVhY2ggY29tcGlsZSB0bworICAgKiAgYSBzaW5nbGUgQGEgYWRkIGluc3RydWN0aW9uOiBfUmVwOjpfTV9kYXRhKCksIGFuZAorICAgKiAgc3RyaW5nOjpfTV9yZXAoKTsgYW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ZXJhdG9yCisgICAgICBfTV9pZW5kKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGl0ZXJhdG9yKF9NX2RhdGEoKSArIHRoaXMtPnNpemUoKSk7IH0KKworICAgICAgdm9pZAorICAgICAgX01fbGVhaygpICAgIC8vIGZvciB1c2UgaW4gYmVnaW4oKSAmIG5vbi1jb25zdCBvcFtdCisgICAgICB7CisJaWYgKCFfTV9yZXAoKS0+X01faXNfbGVha2VkKCkpCisJICBfTV9sZWFrX2hhcmQoKTsKKyAgICAgIH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBfTV9jaGVjayhzaXplX3R5cGUgX19wb3MsIGNvbnN0IGNoYXIqIF9fcykgY29uc3QKKyAgICAgIHsKKwlpZiAoX19wb3MgPiB0aGlzLT5zaXplKCkpCisJICBfX3Rocm93X291dF9vZl9yYW5nZShfX04oX19zKSk7CisJcmV0dXJuIF9fcG9zOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9jaGVja19sZW5ndGgoc2l6ZV90eXBlIF9fbjEsIHNpemVfdHlwZSBfX24yLCBjb25zdCBjaGFyKiBfX3MpIGNvbnN0CisgICAgICB7CisJaWYgKHRoaXMtPm1heF9zaXplKCkgLSAodGhpcy0+c2l6ZSgpIC0gX19uMSkgPCBfX24yKQorCSAgX190aHJvd19sZW5ndGhfZXJyb3IoX19OKF9fcykpOworICAgICAgfQorCisgICAgICAvLyBOQjogX01fbGltaXQgZG9lc24ndCBjaGVjayBmb3IgYSBiYWQgX19wb3MgdmFsdWUuCisgICAgICBzaXplX3R5cGUKKyAgICAgIF9NX2xpbWl0KHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fb2ZmKSBjb25zdAorICAgICAgeworCWNvbnN0IGJvb2wgX190ZXN0b2ZmID0gIF9fb2ZmIDwgdGhpcy0+c2l6ZSgpIC0gX19wb3M7CisJcmV0dXJuIF9fdGVzdG9mZiA/IF9fb2ZmIDogdGhpcy0+c2l6ZSgpIC0gX19wb3M7CisgICAgICB9CisKKyAgICAgIC8vIFRydWUgaWYgX1JlcCBhbmQgc291cmNlIGRvIG5vdCBvdmVybGFwLgorICAgICAgYm9vbAorICAgICAgX01fZGlzanVuY3QoY29uc3QgX0NoYXJUKiBfX3MpIGNvbnN0CisgICAgICB7CisJcmV0dXJuIChsZXNzPGNvbnN0IF9DaGFyVCo+KCkoX19zLCBfTV9kYXRhKCkpCisJCXx8IGxlc3M8Y29uc3QgX0NoYXJUKj4oKShfTV9kYXRhKCkgKyB0aGlzLT5zaXplKCksIF9fcykpOworICAgICAgfQorCisgICAgICAvLyBXaGVuIF9fbiA9IDEgd2F5IGZhc3RlciB0aGFuIHRoZSBnZW5lcmFsIG11bHRpY2hhcgorICAgICAgLy8gdHJhaXRzX3R5cGU6OmNvcHkvbW92ZS9hc3NpZ24uCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgX01fY29weShfQ2hhclQqIF9fZCwgY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX24pCisgICAgICB7CisJaWYgKF9fbiA9PSAxKQorCSAgdHJhaXRzX3R5cGU6OmFzc2lnbigqX19kLCAqX19zKTsKKwllbHNlCisJICB0cmFpdHNfdHlwZTo6Y29weShfX2QsIF9fcywgX19uKTsKKyAgICAgIH0KKworICAgICAgc3RhdGljIHZvaWQKKyAgICAgIF9NX21vdmUoX0NoYXJUKiBfX2QsIGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19uKQorICAgICAgeworCWlmIChfX24gPT0gMSkKKwkgIHRyYWl0c190eXBlOjphc3NpZ24oKl9fZCwgKl9fcyk7CisJZWxzZQorCSAgdHJhaXRzX3R5cGU6Om1vdmUoX19kLCBfX3MsIF9fbik7CSAgCisgICAgICB9CisKKyAgICAgIHN0YXRpYyB2b2lkCisgICAgICBfTV9hc3NpZ24oX0NoYXJUKiBfX2QsIHNpemVfdHlwZSBfX24sIF9DaGFyVCBfX2MpCisgICAgICB7CisJaWYgKF9fbiA9PS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X0NoYXJUKiBfX2sxLCBfQ2hhclQqIF9fazIpCisgICAgICB7IF9NX2NvcHkoX19wLCBfX2sxLCBfX2syIC0gX19rMSk7IH0KKworICAgICAgc3RhdGljIHZvaWQKKyAgICAgIF9TX2NvcHlfY2hhcnMoX0NoYXJUKiBfX3AsIGNvbnN0IF9DaGFyVCogX19rMSwgY29uc3QgX0NoYXJUKiBfX2syKQorICAgICAgeyBfTV9jb3B5KF9fcCwgX19rMSwgX19rMiAtIF9fazEpOyB9CisKKyAgICAgIHN0YXRpYyBpbnQKKyAgICAgIF9TX2NvbXBhcmUoc2l6ZV90eXBlIF9fbjEsIHNpemVfdHlwZSBfX24yKQorICAgICAgeworCWNvbnN0IGRpZmZlcmVuY2VfdHlwZSBfX2QgPSBkaWZmZXJlbmNlX3R5cGUoX19uMSAtIF9fbjIpOworCisJaWYgKF9fZCA+IF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxpbnQ+OjpfX21heCkKKwkgIHJldHVybiBfX2dudV9jeHg6Ol9fbnVtZXJpY190cmFpdHM8aW50Pjo6X19tYXg7CisJZWxzZSBpZiAoX19kIDwgX19nbnVfY3h4OjpfX251bWVyaWNfdHJhaXRzPGludD46Ol9fbWluKQorCSAgcmV0dXJuIF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxpbnQ+OjpfX21pbjsKKwllbHNlCisJICByZXR1cm4gaW50KF9fZCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX211dGF0ZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX2xlbjEsIHNpemVfdHlwZSBfX2xlbjIpOworCisgICAgICB2b2lkCisgICAgICBfTV9sZWFrX2hhcmQoKTsKKworICAgICAgc3RhdGljIF9SZXAmCisgICAgICBfU19lbXB0eV9yZXAoKQorICAgICAgeyByZXR1cm4gX1JlcDo6X1NfZW1wdHlfcmVwKCk7IH0KKworICAgIHB1YmxpYzoKKyAgICAgIC8vIENvbnN0cnVjdC9jb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gICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29uc3RydWN0IHN0cmluZyBhcyBjb3B5IG9mIGEgc3Vic3RyaW5nLgorICAgICAgICogIEBwYXJhbSAgX19zdHIgIFNvdXJjZSBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtICBfX3BvcyAgSW5kZXggb2YgZmlyc3QgY2hhcmFjdGVyIHRvIGNvcHkgZnJvbS4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgTnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gY29weSAoZGVmYXVsdCByZW1haW5kZXIpLgorICAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcoY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwgc2l6ZV90eXBlIF9fcG9zLAorCQkgICBzaXplX3R5cGUgX19uID0gbnBvcyk7CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdCBzdHJpbmcgYXMgY29weSBvZiBhIHN1YnN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gIF9fc3RyICBTb3VyY2Ugc3RyaW5nLgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIEluZGV4IG9mIGZpcnN0IGNoYXJhY3RlciB0byBjb3B5IGZyb20uCisgICAgICAgKiAgQHBhcmFtICBfX24gIE51bWJlciBvZiBjaGFyYWN0ZXJzIHRvIGNvcHkuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFsbG9jYXRvciB0byB1c2UuCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3N0cmluZyhjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyLCBzaXplX3R5cGUgX19wb3MsCisJCSAgIHNpemVfdHlwZSBfX24sIGNvbnN0IF9BbGxvYyYgX19hKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb25zdHJ1Y3Qgc3RyaW5nIGluaXRpYWxpemVkIGJ5IGEgY2hhcmFjdGVyICVhcnJheS4KKyAgICAgICAqICBAcGFyYW0gIF9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9fc3RyICBTb3VyY2Ugc3RyaW5nLgorICAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0cikgCisgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oX19zdHIpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29weSBjb250ZW50cyBvZiBAYSBzIGludG8gdGhpcyBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFNvdXJjZSBudWxsLXRlcm1pbmF0ZWQgc3RyaW5nLgorICAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oY29uc3QgX0NoYXJUKiBfX3MpIAorICAgICAgeyByZXR1cm4gdGhpcy0+YXNzaWduKF9fcyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTZXQgdmFsdWUgdG8gc3RyaW5nIG9mIGxlbmd0aCAxLgorICAgICAgICogIEBwYXJhbSAgX19jICBTb3VyY2UgY2hhcmFjdGVyLgorICAgICAgICoKKyAgICAgICAqICBBc3NpZ25pbmcgdG8gYSBjaGFyYWN0ZXIgbWFrZXMgdGhpcyBzdHJpbmcgbGVuZ3RoIDEgYW5kCisgICAgICAgKiAgKCp0aGlzKVswXSA9PSBAYSBjLgorICAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oX0NoYXJUIF9fYykgCisgICAgICB7IAorCXRoaXMtPmFzc2lnbigxLCBfX2MpOyAKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBNb3ZlIGFzc2lnbiB0aGUgdmFsdWUgb2YgQGEgc3RyIHRvIHRoaXMgc3RyaW5nLgorICAgICAgICogIEBwYXJhbSAgX19zdHIgIFNvdXJjZSBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogIFRoZSBjb250ZW50cyBvZiBAYSBzdHIgYXJlIG1vdmVkIGludG8gdGhpcyBzdHJpbmcgKHdpdGhvdXQgY29weWluZykuCisgICAgICAgKiAgQGEgc3RyIGlzIGEgdmFsaWQsIGJ1dCB1bnNwZWNpZmllZCBzdHJpbmcuCisgICAgICAgKiovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oYmFzaWNfc3RyaW5nJiYgX19zdHIpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJdGhpcy0+c3dhcChfX3N0cik7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldCB2YWx1ZSB0byBzdHJpbmcgY29uc3RydWN0ZWQgZnJvbSBpbml0aWFsaXplciAlbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fbCAgc3RkOjppbml0aWFsaXplcl9saXN0LgorICAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oaW5pdGlhbGl6ZXJfbGlzdDxfQ2hhclQ+IF9fbCkKKyAgICAgIHsKKwl0aGlzLT5hc3NpZ24oX19sLmJlZ2luKCksIF9fbC5zaXplKCkpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZiAvLyBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworCisgICAgICAvLyBJdGVyYXRvcnM6CisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QgY2hhcmFjdGVyIGluCisgICAgICAgKiAgdGhlICVzdHJpbmcuICBVbnNoYXJlcyB0aGUgc3RyaW5nLgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9NX2x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nQgb2YgdGhlICVzdHJpbmcuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgZnJvbnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gb3BlcmF0b3JbXSgwKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZWZlcmVuY2UgdG8gdGhlIGRhdGEgYXQgdGhlIGxhc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlc3RyaW5nLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeyByZXR1cm4gb3BlcmF0b3JbXSh0aGlzLT5zaXplKCkgLSAxKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZQorICAgICAgICogIGxhc3QgZWxlbWVudCBvZiB0aGUgJXN0cmluZy4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIG9wZXJhdG9yW10odGhpcy0+c2l6ZSgpIC0gMSk7IH0KKyNlbmRpZgorCisgICAgICAvLyBNb2RpZmllcnM6CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFwcGVuZCBhIHN0cmluZyB0byB0aGlzIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFRoZSBzdHJpbmcgdG8gYXBwZW5kLgorICAgICAgICogIEByZXR1cm4gIFJlZmVyZW5jZSB0byB0aGlzIHN0cmluZy4KKyAgICAgICAqLworICAgICAgYmFzaWNfc3RyaW5nJgorICAgICAgb3BlcmF0b3IrPShjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyKQorICAgICAgeyByZXR1cm4gdGhpcy0+YXBwZW5kKF9fc3RyKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIC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ZW50cyBvZiBhbm90aGVyIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gIF9fc3RyICBTb3VyY2Ugc3RyaW5nIHRvIHVzZS4KKyAgICAgICAqICBAcmV0dXJuICBSZWZlcmVuY2UgdG8gdGhpcyBzdHJpbmcuCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3N0cmluZyYKKyAgICAgIGFzc2lnbihjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyKTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldCB2YWx1ZSB0byBjb250ZW50cyBvZiBhbm90aGVyIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gIF9fc3RyICBTb3VyY2Ugc3RyaW5nIHRvIHVzZS4KKyAgICAgICAqICBAcmV0dXJuICBSZWZlcmVuY2UgdG8gdGhpcyBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gc2V0cyB0aGlzIHN0cmluZyB0byB0aGUgZXhhY3QgY29udGVudHMgb2YgQGEgX19zdHIuCisgICAgICAgKiAgQGEgX19zdHIgaXMgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkIHN0cmluZy4KKyAgICAgICAqLworICAgICAgYmFzaWNfc3RyaW5nJgorICAgICAgYXNzaWduKGJhc2ljX3N0cmluZyYmIF9fc3RyKQorICAgICAgeworCXRoaXMtPnN3YXAoX19zdHIpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZiAvLyBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldCB2YWx1ZSB0byBhIHN1YnN0cmluZyBvZiBhIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFRoZSBzdHJpbmcgdG8gdXNlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2Yg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ICAgICAqICBAcGFyYW0gX19jICBUaGUgY2hhcmFjdGVyIHRvIGluc2VydC4KKyAgICAgICAqICBAcmV0dXJuICBSZWZlcmVuY2UgdG8gdGhpcyBzdHJpbmcuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Omxlbmd0aF9lcnJvciAgSWYgbmV3IGxlbmd0aCBleGNlZWRzIEBjIG1heF9zaXplKCkuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om91dF9vZl9yYW5nZSAgSWYgQGEgX19wb3MgaXMgYmV5b25kIHRoZSBlbmQgb2YgdGhpcworICAgICAgICogIHN0cmluZy4KKyAgICAgICAqCisgICAgICAgKiAgSW5zZXJ0cyBAYSBfX24gY29waWVzIG9mIGNoYXJhY3RlciBAYSBfX2Mgc3RhcnRpbmcgYXQgaW5kZXgKKyAgICAgICAqICBAYSBfX3Bvcy4gIElmIGFkZGluZyBjaGFyYWN0ZXJzIGNhdXNlcyB0aGUgbGVuZ3RoIHRvIGV4Y2VlZAorICAgICAgICogIG1heF9zaXplKCksIGxlbmd0aF9lcnJvciBpcyB0aHJvd24uICBJZiBAYSBfX3BvcyA+IGxlbmd0aCgpLAorICAgICAgICogIG91dF9vZl9yYW5nZSBpcyB0aHJvd24uICBUaGUgdmFsdWUgb2YgdGhlIHN0cmluZyBkb2Vzbid0CisgICAgICAgKiAgY2hhbmdlIGlmIGFuIGVycm9yIGlzIHRocm93bi4KKyAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBpbnNlcnQoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQorICAgICAgeyByZXR1cm4gX01fcmVwbGFjZV9hdXgoX01fY2hlY2soX19wb3MsICJiYXNpY19zdHJpbmc6Omluc2VydCIpLAorCQkJICAgICAgc2l6ZV90eXBlKDApLCBfX24sIF9fYyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBJbnNlcnQgb25lIGNoYXJhY3Rlci4KKy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OjpsZW5ndGgoX19zKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmVwbGFjZSByYW5nZSBvZiBjaGFyYWN0ZXJzIHdpdGggbXVsdGlwbGUgY2hhcmFjdGVycworICAgICAgICogIEBwYXJhbSBfX2kxICBJdGVyYXRvciByZWZlcmVuY2luZyBzdGFydCBvZiByYW5nZSB0byByZXBsYWNlLgorICAgICAgICogIEBwYXJhbSBfX2kyICBJdGVyYXRvciByZWZlcmVuY2luZyBlbmQgb2YgcmFuZ2UgdG8gcmVwbGFjZS4KKyAgICAgICAqICBAcGFyYW0gX19uICBOdW1iZXIgb2YgY2hhcmFjdGVycyB0byBpbnNlcnQuCisgICAgICAgKiAgQHBhcmFtIF9fYyAgQ2hhcmFjdGVyIHRvIGluc2VydC4KKyAgICAgICAqICBAcmV0dXJuICBSZWZlcmVuY2UgdG8gdGhpcyBzdHJpbmcuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Omxlbmd0aF9lcnJvciAgSWYgbmV3IGxlbmd0aCBleGNlZWRzIEBjIG1heF9zaXplKCkuCisgICAgICAgKgorICAgICAgICogIFJlbW92ZXMgdGhlIGNoYXJhY3RlcnMgaW4gdGhlIHJhbmdlIFtfX2kxLF9faTIpLiAgSW4gcGxhY2UsCisgICAgICAgKiAgQGEgX19uIGNvcGllcyBvZiBAYSBfX2MgYXJlIGluc2VydGVkLiAgSWYgdGhlIGxlbmd0aCBvZgorICAgICAgICogIHJlc3VsdCBleGNlZWRzIG1heF9zaXplKCksIGxlbmd0aF9lcnJvciBpcyB0aHJvd24uICBUaGUKKyAgICAgICAqICB2YWx1ZSBvZiB0aGUgc3RyaW5nIGRvZXNuJ3QgY2hhbmdlIGlmIGFuIGVycm9yIGlzIHRocm93bi4KKyAgICAgICovCisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICByZXBsYWNlKGl0ZXJhdG9yIF9faTEsIGl0ZXJhdG9yIF9faTIsIHNpemVfdHlwZSBfX24sI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gKiAgQHBhcmFtIF9fbiAgTnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gY29weS4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGZpcnN0IGNoYXJhY3RlciB0byBjb3B5LgorICAgICAgICogIEByZXR1cm4gIE51bWJlciBvZiBjaGFyYWN0ZXJzIGFjdHVhbGx5IGNvcGllZAorICAgICAgICogIEB0aHJvdyAgc3RkOjpvdXRfb2ZfcmFuZ2UgIElmIF9fcG9zID4gc2l6ZSgpLgorICAgICAgICoKKyAgICAgICAqICBDb3BpZXMgdXAgdG8gQGEgX19uIGNoYXJhY3RlcnMgc3RhcnRpbmcgYXQgQGEgX19wb3MgaW50byB0aGUKKyAgICAgICAqICBDIHN0cmluZyBAYSBfX3MuICBJZiBAYSBfX3BvcyBpcyAlZ3JlYXRlciB0aGFuIHNpemUoKSwKKyAgICAgICAqICBvdXRfb2ZfcmFuZ2UgaXMgdGhyb3duLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgY29weShfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fbiwgc2l6ZV90eXBlIF9fcG9zID0gMCkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU3dhcCBjb250ZW50cyB3aXRoIGFub3RoZXIgc3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3MgIFN0cmluZyB0byBzd2FwIHdpdGguCisgICAgICAgKgorICAgICAgICogIEV4Y2hhbmdlcyB0aGUgY29udGVudHMgb2YgdGhpcyBzdHJpbmcgd2l0aCB0aGF0IG9mIEBhIF9fcyBpbiBjb25zdGFudAorICAgICAgICogIHRpbWUuCisgICAgICAqLworICAgICAgdm9pZAorICAgICAgc3dhcChiYXNpY19zdHJpbmcmIF9fcyk7CisKKyAgICAgIC8vIFN0cmluZyBvcGVyYXRpb25zOgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gY29uc3QgcG9pbnRlciB0byBudWxsLXRlcm1pbmF0ZWQgY29udGVudHMuCisgICAgICAgKgorICAgICAgICogIFRoaXMgaXMgYSBoYW5kbGUgdG8gaW50ZXJuYWwgZGF0YS4gIERvIG5vdCBtb2RpZnkgb3IgZGlyZSB0aGluZ3MgbWF5CisgICAgICAgKiAgaGFwcGVuLgorICAgICAgKi8KKyAgICAgIGNvbnN0IF9DaGFyVCoKKyAgICAgIGNfc3RyKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX2RhdGEoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBjb25zdCBwb2ludGVyIHRvIGNvbnRlbnRzLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIGEgaGFuZGxlIHRvIGludGVybmFsIGRhdGEuICBEbyBub3QgbW9kaWZ5IG9yIGRpcmUgdGhpbmdzIG1heQorICAgICAgICogIGhhcHBlbi4KKyAgICAgICovCisgICAgICBjb25zdCBfQ2hhclQqCisgICAgICBkYXRhKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX2RhdGEoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBjb3B5IG9mIGFsbG9jYXRvciB1c2VkIHRvIGNvbnN0cnVjdCB0aGlzIHN0cmluZy4KKyAgICAgICovCisgICAgICBhbGxvY2F0b3JfdHlwZQorICAgICAgZ2V0X2FsbG9jYXRvcigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV9kYXRhcGx1czsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmQgcG9zaXRpb24gb2YgYSBDIHN1YnN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zICBDIHN0cmluZyB0byBsb2NhdGUuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBjaGFyYWN0Z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cmV0dXJucworICAgICAgICogIG5wb3MuCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICByZmluZChjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGxhc3QgcG9zaXRpb24gb2YgYSBDIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zICBDIHN0cmluZyB0byBsb2NhdGUuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBjaGFyYWN0ZXIgdG8gc3RhcnQgc2VhcmNoIGF0IChkZWZhdWx0IGVuZCkuCisgICAgICAgKiAgQHJldHVybiAgSW5kZXggb2Ygc3RhcnQgb2YgIGxhc3Qgb2NjdXJyZW5jZS4KKyAgICAgICAqCisgICAgICAgKiAgU3RhcnRpbmcgZnJvbSBAYSBfX3Bvcywgc2VhcmNoZXMgYmFja3dhcmQgZm9yIHRoZSB2YWx1ZSBvZgorICAgICAgICogIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwgcmV0dXJucyB0aGUgaW5kZXgKKyAgICAgICAqICB3aGVyZSBpdCBiZWdpbnMuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIHJmaW5kKGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19zdHJpbmcoX19zKTsKKwlyZXR1cm4gdGhpcy0+cmZpbmQoX19zLCBfX3BvcywgdHJhaXRzX3R5cGU6Omxlbmd0aChfX3MpKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGxhc3QgcG9zaXRpb24gb2YgYSBjaGFyYWN0ZXIuCisgICAgICAgKiAgQHBhcmFtIF9fYyAgQ2hhcmFjdGVyIHRvIGxvY2F0ZS4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggYmFjayBmcm9tIChkZWZhdWx0IGVuZCkuCisgICAgICAgKiAgQHJldHVybiAgSW5kZXggb2YgbGFzdCBvY2N1cnJlbmNlLgorICAgICAgICoKKyAgICAgICAqICBTdGFydGluZyBmcm9tIEBhIF9fcG9zLCBzZWFyY2hlcyBiYWNrd2FyZCBmb3IgQGEgX19jIHdpdGhpbgorICAgICAgICogIHRoaXMgc3RyaW5nLiAgSWYgZm91bmQsIHJldHVybnMgdGhlIGluZGV4IHdoZXJlIGl0IHdhcworICAgICAgICogIGZvdW5kLiAgSWYgbm90IGZvdW5kLCByZXR1cm5zIG5wb3MuCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICByZmluZChfQ2hhclQgX19jLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIHBvc2l0aW9uIG9mIGEgY2hhcmFjdGVyIG9mIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFN0cmluZyBjb250YWluaW5nIGNoYXJhY3RlcnMgdG8gbG9jYXRlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgY2hhcmFjdGVyIHRvIHNlYXJjaCBmcm9tIChkZWZhdWx0IDApLgorICAgICAgICogIEByZXR1cm4gIEluZGV4IG9mIGZpcnN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGZvcndhcmQgZm9yIG9uZSBvZiB0aGUKKyAgICAgICAqICBjaGFyYWN0ZXJzIG9mIEBhIF9fc3RyIHdpdGhpbiB0aGlzIHN0cmluZy4gIElmIG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gcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9maXJzdF9vZihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIHBvc2l0aW9uIG9mIGEgY2hhcmFjdGVyIG9mIEMgc3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3MgIFN0cmluZyBjb250YWluaW5nIGNoYXJhY3RlcnMgdG8gbG9jYXRlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgY2hhcmFjdGVyIHRvIHNlYXJjaCBmcm9tIChkZWZhdWx0IDApLgorICAgICAgICogIEByZXR1cm4gIEluZGV4IG9mIGZpcnN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGZvcndhcmQgZm9yIG9uZSBvZiB0aGUKKyAgICAgICAqICBjaGFyYWN0ZXJzIG9mIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwgcmV0dXJucworICAgICAgICogIHRoZSBpbmRleCB3aGVyZSBpdCB3YXMgZm91bmQuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIGZpbmRfZmlyc3Rfb2YoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworCXJldHVybiB0aGlzLT5maW5kX2ZpcnN0X29mKF9fcywgX19wb3MsIHRyYWl0c190eXBlOjpsZW5ndGgoX19zKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBwb3NpdGlvbiBvZ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CogX19zLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19zdHJpbmcoX19zKTsKKwlyZXR1cm4gdGhpcy0+ZmluZF9sYXN0X29mKF9fcywgX19wb3MsIHRyYWl0c190eXBlOjpsZW5ndGgoX19zKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBsYXN0IHBvc2l0aW9uIG9mIGEgY2hhcmFjdGVyLgorICAgICAgICogIEBwYXJhbSBfX2MgIENoYXJhY3RlciB0byBsb2NhdGUuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBjaGFyYWN0ZXIgdG8gc2VhcmNoIGJhY2sgZnJvbSAoZGVmYXVsdCBlbmQpLgorICAgICAgICogIEByZXR1cm4gIEluZGV4IG9mIGxhc3Qgb2NjdXJyZW5jZS4KKyAgICAgICAqCisgICAgICAgKiAgU3RhcnRpbmcgZnJvbSBAYSBfX3Bvcywgc2VhcmNoZXMgYmFja3dhcmQgZm9yIEBhIF9fYyB3aXRoaW4KKyAgICAgICAqICB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zIHRoZSBpbmRleCB3aGVyZSBpdCB3YXMKKyAgICAgICAqICBmb3VuZC4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiBlcXVpdmFsZW50IHRvIHJmaW5kKF9fYywgX19wb3MpLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9sYXN0X29mKF9DaGFyVCBfX2MsIHNpemVfdHlwZSBfX3BvcyA9IG5wb3MpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiB0aGlzLT5yZmluZChfX2MsIF9fcG9zKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmQgcG9zaXRpb24gb2YgYSB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KKyAgICAgICAqICBjb250YWluZWQgaW4gQGEgX19zIHdpdGhpbiB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zCisgICAgICAgKiAgdGhlIGluZGV4IHdoZXJlIGl0IHdhcyBmb3VuZC4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9maXJzdF9ub3Rfb2YoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworCXJldHVybiB0aGlzLT5maW5kX2ZpcnN0X25vdF9vZihfX3MsIF9fcG9zLCB0cmFpdHNfdHlwZTo6bGVuZ3RoKF9fcykpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmQgcG9zaXRpb24gb2YgYSBkaWZmZXJlbnQgY2hhcmFjdGVyLgorICAgICAgICogIEBwYXJhbSBfX2MgIENoYXJhY3RlciB0byBhdm9pZC4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggZnJvbSAoZGVmYXVsdCAwKS4KKyAgICAgICAqICBAcmV0dXJuICBJbmRleCBvZiBmaXJzdCBvY2N1cnJlbmNlLgorICAgICAgICoKKyAgICAgICAqICBTdGFydGluZyBmcm9tIEBhIF9fcG9zLCBzZWFyY2hlcyBmb3J3YXJkIGZvciBhIGNoYXJhY3RlcgorICAgICAgICogIG90aGVyIHRoYW4gQGEgX19jIHdpdGhpbiB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zIHRoZQorICAgICAgICogIGluZGV4IHdoZXJlIGl0IHdhcyBmb3VuZC4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9ma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BjaGFyYWN0ZXIgbm90IGluIEMgc3Vic3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3MgIEMgc3RyaW5nIGNvbnRhaW5pbmcgY2hhcmFjdGVycyB0byBhdm9pZC4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggYmFjayBmcm9tLgorICAgICAgICogIEBwYXJhbSBfX24gIE51bWJlciBvZiBjaGFyYWN0ZXJzIGZyb20gcyB0byBjb25zaWRlci4KKyAgICAgICAqICBAcmV0dXJuICBJbmRleCBvZiBsYXN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGJhY2t3YXJkIGZvciBhIGNoYXJhY3RlciBub3QKKyAgICAgICAqICBjb250YWluZWQgaW4gdGhlIGZpcnN0IEBhIF9fbiBjaGFyYWN0ZXJzIG9mIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuCisgICAgICAgKiAgSWYgZm91bmQsIHJldHVybnMgdGhlIGluZGV4IHdoZXJlIGl0IHdhcyBmb3VuZC4gIElmIG5vdCBmb3VuZCwKKyAgICAgICAqICByZXR1cm5zIG5wb3MuCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBmaW5kX2xhc3Rfbm90X29mKGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19wb3MsCisJCSAgICAgICBzaXplX3R5cGUgX19uKSBjb25zdDsKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBsYXN0IHBvc2l0aW9uIG9mIGEgY2hhcmFjdGVyIG5vdCBpbiBDIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zICBDIHN0cmluZyBjb250YWluaW5nIGNoYXJhY3RlcnMgdG8gYXZvaWQuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBjaGFyYWN0ZXIgdG8gc2Vh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ja3dhcmQgZm9yIGEgY2hhcmFjdGVyIG90aGVyIHRoYW4KKyAgICAgICAqICBAYSBfX2Mgd2l0aGluIHRoaXMgc3RyaW5nLiAgSWYgZm91bmQsIHJldHVybnMgdGhlIGluZGV4IHdoZXJlIGl0IHdhcworICAgICAgICogIGZvdW5kLiAgSWYgbm90IGZvdW5kLCByZXR1cm5zIG5wb3MuCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBmaW5kX2xhc3Rfbm90X29mKF9DaGFyVCBfX2MsIHNpemVfdHlwZSBfX3BvcyA9IG5wb3MpIGNvbnN0CisJX0dMSUJDWFhfTk9FWENFUFQ7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgR2V0IGEgc3Vic3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgZmlyc3QgY2hhcmFjdGVyIChkZWZhdWx0IDApLgorICAgICAgICogIEBwYXJhbSBfX24gIE51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHN1YnN0cmluZyAoZGVmYXVsdCByZW1haW5kZXIpLgorICAgICAgICogIEByZXR1cm4gIFRoZSBuZXcgc3RyaW5nLgorICAgICAgICogIEB0aHJvdyAgc3RkOjpvdXRfb2ZfcmFuZ2UgIElmIF9fcG9zID4gc2l6ZSgpLgorICAgICAgICoKKyAgICAgICAqICBDb25zdHJ1Y3QgYW5kIHJldHVybiBhIG5ldyBzdHJpbmcgdXNpbmcgdGhlIEBhIF9fbgorICAgICAgICogIGNoYXJhY3RlcnMgc3RhcnRpbmcgYXQgQGEgX19wb3MuICBJZiB0aGUgc3RyaW5nIGlzIHRvbworICAgICAgICogIHNob3J0LCB1c2UgdGhlIHJlbWFpbmRlciBvZiB0aGUgY2hhcmFjdGVycy4gIElmIEBhIF9fcG9zIGlzCisgICAgICAgKiAgYmV5b25kIHRoZSBlbmQgb2YgdGhlIHN0cmluZywgb3V0X29mX3JhbmdlIGlzIHRocm93bi4KKyAgICAgICovCisgICAgICB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oZSBzaG9ydGVyIG9uZSBpcyBvcmRlcmVkIGZpcnN0LgorICAgICAgKi8KKyAgICAgIGludAorICAgICAgY29tcGFyZShjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyKSBjb25zdAorICAgICAgeworCWNvbnN0IHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7CisJY29uc3Qgc2l6ZV90eXBlIF9fb3NpemUgPSBfX3N0ci5zaXplKCk7CisJY29uc3Qgc2l6ZV90eXBlIF9fbGVuID0gc3RkOjptaW4oX19zaXplLCBfX29zaXplKTsKKworCWludCBfX3IgPSB0cmFpdHNfdHlwZTo6Y29tcGFyZShfTV9kYXRhKCksIF9fc3RyLmRhdGEoKSwgX19sZW4pOworCWlmICghX19yKQorCSAgX19yID0gX1NfY29tcGFyZShfX3NpemUsIF9fb3NpemUpOworCXJldHVybiBfX3I7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29tcGFyZSBzdWJzdHJpbmcgdG8gYSBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBmaXJzdCBjaGFyYWN0ZXIgb2Ygc3Vic3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX24gIE51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHN1YnN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFN0cmluZyB0byBjb21wYXJlIGFnYWluc3QuCisgICAgICAgKiAgQHJldHVybiAgSW50ZWdlciA8IDAsIDAsIG9yID4gMC4KKyAgICAgICAqCisgICAgICAgKiAgRm9ybSB0aGUgc3Vic3RyaW5nIG9mIHRoaXMgc3RyaW5nIGZyb20gdGhlIEBhIF9fbiBjaGFyYWN0ZXJzCisgICAgICAgKiAgc3RhcnRpbmcgYXQgQGEgX19wb3MuICBSZXR1cm5zIGFuIGludGVnZXIgPCAwIGlmIHRoZQorICAgICAgICogIHN1YnN0cmluZyBpcyBvcmRlcmVkIGJlZm9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OyB9CisKKyAgaW5saW5lIHN0cmluZworICB0b19zdHJpbmcobG9uZyBsb25nIF9fdmFsKQorICB7IHJldHVybiBfX2dudV9jeHg6Ol9fdG9feHN0cmluZzxzdHJpbmc+KCZzdGQ6OnZzbnByaW50ZiwKKwkJCQkJICAgNCAqIHNpemVvZihsb25nIGxvbmcpLAorCQkJCQkgICAiJWxsZCIsIF9fdmFsKTsgfQorCisgIGlubGluZSBzdHJpbmcKKyAgdG9fc3RyaW5nKHVuc2lnbmVkIGxvbmcgbG9uZyBfX3ZhbCkKKyAgeyByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8c3RyaW5nPigmc3RkOjp2c25wcmludGYsCisJCQkJCSAgIDQgKiBzaXplb2YodW5zaWduZWQgbG9uZyBsb25nKSwKKwkJCQkJICAgIiVsbHUiLCBfX3ZhbCk7IH0KKworICBpbmxpbmUgc3RyaW5nCisgIHRvX3N0cmluZyhmbG9hdCBfX3ZhbCkKKyAgeworICAgIGNvbnN0IGludCBfX24gPSAKKyAgICAgIF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxmbG9hdD46Ol9fbWF4X2V4cG9uZW50MTAgKyAyMDsKKyAgICByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8c3RyaW5nPigmc3RkOjp2c25wcmludGYsIF9fbiwKKwkJCQkJICAgIiVmIiwgX192YWwpOworICB9CisKKyAgaW5saW5lIHN0cmluZworICB0b19zdHJpbmcoZG91YmxlIF9fdmFsKQorICB7CisgICAgY29uc3QgaW50IF9fbiA9IAorICAgICAgX19nbnVfY3h4OjpfX251bWVyaWNfdHJhaXRzPGRvdWJsZT46Ol9fbWF4X2V4cG9uZW50MTAgKyAyMDsKKyAgICByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8c3RyaW5nPigmc3RkOjp2c25wcmludGYsIF9fbiwKKwkJCQkJICAgIiVmIiwgX192YWwpOworICB9CisKKyAgaW5saW5lIHN0cmluZwor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W5saW5lIHdzdHJpbmcKKyAgdG9fd3N0cmluZyh1bnNpZ25lZCBsb25nIGxvbmcgX192YWwpCisgIHsgcmV0dXJuIF9fZ251X2N4eDo6X190b194c3RyaW5nPHdzdHJpbmc+KCZzdGQ6OnZzd3ByaW50ZiwKKwkJCQkJICAgIDQgKiBzaXplb2YodW5zaWduZWQgbG9uZyBsb25nKSwKKwkJCQkJICAgIEwiJWxsdSIsIF9fdmFsKTsgfQorCisgIGlubGluZSB3c3RyaW5nCisgIHRvX3dzdHJpbmcoZmxvYXQgX192YWwpCisgIHsKKyAgICBjb25zdCBpbnQgX19uID0KKyAgICAgIF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxmbG9hdD46Ol9fbWF4X2V4cG9uZW50MTAgKyAyMDsKKyAgICByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8d3N0cmluZz4oJnN0ZDo6dnN3cHJpbnRmLCBfX24sCisJCQkJCSAgICBMIiVmIiwgX192YWwpOworICB9CisKKyAgaW5saW5lIHdzdHJpbmcKKyAgdG9fd3N0cmluZyhkb3VibGUgX192YWwpCisgIHsKKyAgICBjb25zdCBpbnQgX19uID0KKyAgICAgIF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxkb3VibGU+OjpfX21heF9leHBvbmVudDEwICsgMjA7CisgICAgcmV0dXJuIF9fZ251X2N4eDo6X190b194c3RyaW5nPHdzdHJpbmc+KCZzdGQ6OnZzd3ByaW50ZiwgX19uLAorCQkJCQkgICAgTCIlZiIsIF9fdmFsKTsKKyAgfQorCisgIGlubGluZSB3c3RyaW5nCisgIHRvX3dzdHJpbmcobG9uZyBkb3VibGUgX192YWwpCisgIHsKKyAgICBjb25zdCBpbnQgX19uID0KKyAgICAgIF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxsb25nIGRvdWJsZT46Ol9fbWF4X2V4cG9uZW50MTAgKyAyMDsKKyAgICByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJp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5cGVuYW1lIF9BbGxvYz4KKyAgICAgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPiYKKyAgICAgYmFzaWNfc3RyaW5nPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6CisgICAgIGluc2VydChzaXplX3R5cGUgX19wb3MsIGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19uKQorICAgICB7CisgICAgICAgX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZ19sZW4oX19zLCBfX24pOworICAgICAgIF9NX2NoZWNrKF9fcG9zLCAiYmFzaWNfc3RyaW5nOjppbnNlcnQiKTsKKyAgICAgICBfTV9jaGVja19sZW5ndGgoc2l6ZV90eXBlKDApLCBfX24sICJiYXNpY19zdHJpbmc6Omluc2VydCIpOworICAgICAgIGlmIChfTV9kaXNqdW5jdChfX3MpIHx8IF9NX3JlcCgpLT5fTV9pc19zaGFyZWQoKSkKKyAgICAgICAgIHJldHVybiBfTV9yZXBsYWNlX3NhZmUoX19wb3MsIHNpemVfdHlwZSgwKSwgX19zLCBfX24pOworICAgICAgIGVsc2UKKyAgICAgICAgIHsKKyAgICAgICAgICAgLy8gV29yayBpbi1wbGFjZS4KKyAgICAgICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fb2ZmID0gX19zIC0gX01fZGF0YSgpOworICAgICAgICAgICBfTV9tdXRhdGUoX19wb3MsIDAsIF9fbik7CisgICAgICAgICAgIF9fcyA9IF9NX2RhdGEoKSArIF9fb2ZmOworICAgICAgICAgICBfQ2hhclQqIF9fcCA9IF9NX2RhdGEoKSArIF9fcG9zOworICAgICAgICAgICBpZiAoX19zICArIF9fbiA8PSBfX3ApCisgICAgICAgICAgICAgX01fY29weShfX3AsIF9fcywgX19uKTsKKyAgICAgICAgICAgZWxzZSBpZiAoX19zID49IF9fcCkKKyAgICAgICAgICAgICBfTV9jb3B5KF9fcCwgX19zICsgX19uLCBfX24pOworICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgeworCSAgICAgICBjb25zdCBzaXplX3R5cGUgX19ubGVmdCA9IF9fcCAtIF9fczsKKyAgICAgICAgICAgICAgIF9NX2NvcHkoX19wLCBfX3MsIF9fbmxlZnQpOworICAgICAgICAgICAgICAgX01fY29weShfX3AgKyBfX25sZWZ0LCBfX3AgKyBfX24sIF9fbiAtIF9fbmxlZnQpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgICAgfQorICAgICB9CisKKyAgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgorICAgICB0eXBlbmFtZSBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjppdGVyYXRvcgorICAgICBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjoKKyAgICAgZXJhc2UoaXRlcmF0b3IgX19maXJzdCwgaXRlcmF0b3IgX19sYXN0KQorICAgICB7CisgICAgICAgX0dMSUJDWFhfREVCVUdfUEVEQVNTRVJUKF9fZmlyc3QgPj0gX01faWJlZ2luKCkgJiYgX19maXJzdCA8PSBfX2xhc3QKKwkJCQkmJiBfX2xhc3QgPD0gX01faWVuZCgpKTsKKworICAgICAgIC8vIE5COiBUaGlzIGlzbid0IGp1c3QgYW4gb3B0aW1pemF0aW9uIChiYWlsIG91dCBlYXJseSB3aGVuCisgICAgICAgLy8gdGhlcmUgaXMgbm90aGluZyB0byBkbywgcmVhbGx5KSwgaXQncyBhbHNvIGEgY29ycmVjdG5lc3MKKyAgICAgICAvLyBpc3N1ZSB2cyBNVCwgc2VlIGxpYnN0ZGMrKy80MDUxOC4KKyAgICAgICBjb25zdCBzaXplX3R5cGUgX19zaXplID0gX19sYXN0IC0gX19maXJzdDsKKyAgICAgICBpZiAoX19zaXplKQorCSB7CisJICAgY29uc3Qgc2l6ZV90eXBlIF9fcG9zID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CBfX29zaXplKTsKKyAgICAgIGludCBfX3IgPSB0cmFpdHNfdHlwZTo6Y29tcGFyZShfTV9kYXRhKCkgKyBfX3BvcywgX19zdHIuZGF0YSgpLCBfX2xlbik7CisgICAgICBpZiAoIV9fcikKKwlfX3IgPSBfU19jb21wYXJlKF9fbiwgX19vc2l6ZSk7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHMsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICBpbnQKKyAgICBiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+OjoKKyAgICBjb21wYXJlKHNpemVfdHlwZSBfX3BvczEsIHNpemVfdHlwZSBfX24xLCBjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyLAorCSAgICBzaXplX3R5cGUgX19wb3MyLCBzaXplX3R5cGUgX19uMikgY29uc3QKKyAgICB7CisgICAgICBfTV9jaGVjayhfX3BvczEsICJiYXNpY19zdHJpbmc6OmNvbXBhcmUiKTsKKyAgICAgIF9fc3RyLl9NX2NoZWNrKF9fcG9zMiwgImJhc2ljX3N0cmluZzo6Y29tcGFyZSIpOworICAgICAgX19uMSA9IF9NX2xpbWl0KF9fcG9zMSwgX19uMSk7CisgICAgICBfX24yID0gX19zdHIuX01fbGltaXQoX19wb3MyLCBfX24yKTsKKyAgICAgIGNvbnN0IHNpemVfdHlwZSBfX2xlbiA9IHN0ZDo6bWluKF9fbjEsIF9fbjIpOworICAgICAgaW50IF9fciA9IHRyYWl0c190eXBlOjpjb21wYXJlKF9NX2RhdGEoKSArIF9fcG9zMSwKKwkJCQkgICAgIF9fc3RyLmRhdGEoKSArIF9fcG9zMiwgX19sZW4pOworICAgICAgaWYgKCFfX3IpCisJX19yID0gX1NfY29tcGFyZShfX24xLCBfX24yKTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgorICAgIGludAorICAgIGJhc2ljX3N0cmluZzxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgorICAgIGNvbXBhcmUoY29uc3QgX0NoYXJUKiBfX3MpIGNvbnN0CisgICAgeworICAgICAgX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fc2l6ZSA9IHRoaXMtPnNpemUoKTsKKyAgICAgIGNvbnN0IHNpemVfdHlwZSBfX29zaXplID0gdHJhaXRzX3R5cGU6Omxlbmd0aChfX3MpOworICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fbGVuID0gc3RkOjptaW4oX19zaXplLCBfX29zaXplKTsKKyAgICAgIGludCBfX3IgPSB0cmFpdHNfdHlwZTo6Y29tcGFyZShfTV9kYXRhKCksIF9fcywgX19sZW4pOworICAgICAgaWYgKCFfX3IpCisJX19yID0gX1NfY29tcGFyZShfX3NpemUsIF9fb3NpemUpOworICAgICAgcmV0dXJuIF9fcjsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgaW50CisgICAgYmFzaWNfc3RyaW5nIDxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgorICAgIGNvbXBhcmUoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uMSwgY29uc3QgX0NoYXJUKiBfX3MpIGNvbnN0CisgICAgeworICAgICAgX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworICAgICAgX01fY2hlY2soX19wb3MsICJiYXNpY19zdHJpbmc6OmNvbXBhcmUiKTsKKyAgICAgIF9fbjEgPSBfTV9saW1pdChfX3BvcywgX19uMSk7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19vc2l6ZSA9IHRyYWl0c190eXBlOjpsZW5ndGgoX19zKTsKKyAgICAgIGNvbnN0IHNpemVfdHlwZSBfX2xlbiA9IHN0ZDo6bWluKF9fbjEsIF9fb3NpemUpOworICAgICAgaW50IF9fciA9IHRyYWl0c190eXBlOjpjb21wYXJlKF9NX2RhdGEoKSArIF9fcG9zLCBfX3MsIF9fbGVuKTsKKyAgICAgIGlmICghX19yKQorCV9fciA9IF9TX2NvbXBhcmUoX19uMSwgX19vc2l6ZSk7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHMsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICBpbnQKKyAgICBiYXNpY19zdHJpbmcgPF9DaGFyVCwgX1RyYWl0cywgX0FsbG9jPjo6CisgICAgY29tcGFyZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24xLCBjb25zdCBfQ2hhclQqIF9fcywKKwkgICAgc2l6ZV90eXBlIF9fbjIpIGNvbnN0CisgICAgeworICAgICAgX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZ19sZW4oX19zLCBfX24yKTsKKyAgICAgIF9NX2NoZWNrKF9fcG9zLCAiYmFzaWNfc3RyaW5nOjpjb21wYXJlIik7CisgICAgICBfX24xID0gX01fbGltaXQoX19wb3MsIF9fbjEpOworICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fbGVuID0gc3RkOjptaW4oX19uMSwgX19uMik7CisgICAgICBpbnQgX19yID0gdHJhaXRzX3R5cGU6OmNvbXBhcmUoX01fZGF0YSgpICsgX19wb3MsIF9fcywgX19sZW4pOworICAgICAgaWYgKCFfX3IpCisJX19yID0gX1NfY29tcGFyZShfX24xLCBfX24yKTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorCisgIC8vIDIxLjMuNy45IGJhc2ljX3N0cmluZzo6Z2V0bGluZSBhbmQgb3BlcmF0b3JzCisgIHRlbXBsYXR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T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICAvLyBCYXNpYyBDb25jZXB0cworCisgIHRlbXBsYXRlIDxjbGFzcyBfVHA+CisgIHN0cnVjdCBfRGVmYXVsdENvbnN0cnVjdGlibGVDb25jZXB0CisgIHsKKyAgICB2b2lkIF9fY29uc3RyYWludHMoKSB7CisgICAgICBfVHAgX19hIF9Jc1VudXNlZDsgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSBkZWZhdWx0IGNvbnN0cnVjdG9yCisgICAgfQorICB9OworCisgIHRlbXBsYXRlIDxjbGFzcyBfVHA+CisgIHN0cnVjdCBfQXNzaWduYWJsZUNvbmNlcHQKKyAgeworICAgIHZvaWQgX19jb25zdHJhaW50cygpIHsKKyAgICAgIF9fYSA9IF9fYTsgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXF1aXJlIGFzc2lnbm1lbnQgb3BlcmF0b3IKKyAgICAgIF9fY29uc3RfY29uc3RyYWludHMoX19hKTsKKyAgICB9CisgICAgdm9pZCBfX2NvbnN0X2NvbnN0cmFpbnRzKGNvbnN0IF9UcCYgX19iKSB7CisgICAgICBfX2EgPSBfX2I7ICAgICAgICAgICAgICAgICAgIC8vIGNvbnN0IHJlcXVpcmVkIGZvciBhcmd1bWVudCB0byBhc3NpZ25tZW50CisgICAgfQorICAgIF9UcCBfX2E7CisgICAgLy8gcG9zc2libHkgc2hvdWxkIGJlICJUcCogYTsiIGFuZCB0aGVuIGRlcmVmZXJlbmNlICJhIiBpbiBjb25zdHJhaW50CisgICAgLy8gZnVuY3Rpb25zPyAgcHJlc2VudCB3YXkgd291bGQgcmVxdWlyZSBhIGRlZmF1bHQgY3RvciwgaSB0aGluay4uLgorICB9OworCisgIHRlbXBsYXRlIDxjbGFzcyBfVHA+CisgIHN0cnVjdCBfQ29weUNvbnN0cnVjdGlibGVDb25jZXB0CisgIHsKKyAgICB2b2lkIF9fY29uc3RyYWludHMoKSB7Cisg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SB3ZSBqdXN0IGNoZWNraW5nIGZvciAicmVmZXJlbmNlYWJpbGl0eSI/CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIHN0ZDo6aXRlcmF0b3JfdHJhaXRzPF9UcD46OnJlZmVyZW5jZSBfUmVmOworCisgICAgICBfX2kgKz0gX19uOyAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSBhc3NpZ25tZW50IGFkZGl0aW9uIG9wZXJhdG9yCisgICAgICBfX2kgPSBfX2kgKyBfX247IF9faSA9IF9fbiArIF9faTsgLy8gcmVxdWlyZSBhZGRpdGlvbiB3aXRoIGRpZmZlcmVuY2UgdHlwZQorICAgICAgX19pIC09IF9fbjsgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlcXVpcmUgYXNzaWdubWVudCBzdWJ0cmFjdGlvbiBvcAorICAgICAgX19pID0gX19pIC0gX19uOyAgICAgICAgICAgICAgICAgIC8vIHJlcXVpcmUgc3VidHJhY3Rpb24gd2l0aAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgZGlmZmVyZW5jZSB0eXBlCisgICAgICBfX24gPSBfX2kgLSBfX2o7ICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSBkaWZmZXJlbmNlIG9wZXJhdG9yCisgICAgICAodm9pZClfX2lbX19uXTsgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSBlbGVtZW50IGFjY2VzcyBvcGVyYXRvcgorICAgIH0KKyAgICBfVHAgX19hLCBfX2I7CisgICAgX1RwIF9faSwgX19qOworICAgIHR5cGVuYW1lIHN0ZDo6aXRlcmF0b3JfdHJhaXRzPF9UcD46OmRpZmZlcmVuY2VfdHlwZSBfX247CisgIH07CisKKyAgdGVtcGxhdGUgPGNsYXNzIF9UcD4KKyAgc3RydWN0IF9NdXRhYmxlX1JhbmRvbUFjY2Vzc0l0ZXJhdG9yQ29uY2VwdAorICB7CisgICAgdm9pZCBfX2NvbnN0cmFpb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RhdGljIGNoYXJfdHlwZSoKKyAgICAgIG1vdmUoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHN0ZDo6c2l6ZV90IF9fbik7CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBjb3B5KGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzdGQ6OnNpemVfdCBfX24pOworCisgICAgICBzdGF0aWMgY2hhcl90eXBlKgorICAgICAgYXNzaWduKGNoYXJfdHlwZSogX19zLCBzdGQ6OnNpemVfdCBfX24sIGNoYXJfdHlwZSBfX2EpOworCisgICAgICBzdGF0aWMgX0dMSUJDWFhfQ09OU1RFWFBSIGNoYXJfdHlwZQorICAgICAgdG9fY2hhcl90eXBlKGNvbnN0IGludF90eXBlJiBfX2MpCisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxjaGFyX3R5cGU+KF9fYyk7IH0KKworICAgICAgc3RhdGljIF9HTElCQ1hYX0NPTlNURVhQUiBpbnRfdHlwZQorICAgICAgdG9faW50X3R5cGUoY29uc3QgY2hhcl90eXBlJiBfX2MpCisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxpbnRfdHlwZT4oX19jKTsgfQorCisgICAgICBzdGF0aWMgX0dMSUJDWFhfQ09OU1RFWFBSIGJvb2wKKyAgICAgIGVxX2ludF90eXBlKGNvbnN0IGludF90eXBlJiBfX2MxLCBjb25zdCBpbnRfdHlwZSYgX19jMikKKyAgICAgIHsgcmV0dXJuIF9fYzEgPT0gX19jMjsgfQorCisgICAgICBzdGF0aWMgX0dMSUJDWFhfQ09OU1RFWFBSIGludF90eXBlCisgICAgICBlb2YoKQorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8aW50X3R5cGU+KF9HTElCQ1hYX1NURElPX0VPRik7IH0KKworICAgICAgc3RhdGljIF9HTElCQ1hYX0NPTlNURVhQUiBpbnRfdHlwZQorICAgICAgbm90X2VvZihjb25zdCBpbnRfdHlwZSYgX19jKQorICAgICAgeyByZXR1cm4gIWVxX2ludF90eXBlKF9fYywgZW9mKCkpID8gX19jIDogdG9faW50X3R5cGUoY2hhcl90eXBlKCkpOyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQ+CisgICAgaW50CisgICAgY2hhcl90cmFpdHM8X0NoYXJUPjo6CisgICAgY29tcGFyZShjb25zdCBjaGFyX3R5cGUqIF9fczEsIGNvbnN0IGNoYXJfdHlwZSogX19zMiwgc3RkOjpzaXplX3QgX19uKQorICAgIHsKKyAgICAgIGZvciAoc3RkOjpzaXplX3QgX19pID0gMDsgX19pIDwgX19uOyArK19faSkKKwlpZiAobHQoX19zMVtfX2ldLCBfX3MyW19faV0pKQorCSAgcmV0dXJuIC0xOworCWVsc2UgaWYgKGx0KF9fczJbX19pXSwgX19zMVtfX2ldKSkKKwkgIHJldHVybiAxOworICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBzdGQ6OnNpemVfdAorICAgIGNoYXJfdHJhaXRzPF9DaGFyVD46OgorICAgIGxlbmd0aChjb25zdCBjaGFyX3R5cGUqIF9fcCkKKyAgICB7CisgICAgICBzdGQ6OnNpemVfdCBfX2kgPSAwOworICAgICAgd2hpbGUgKCFlcShfX3BbX19pXSwgY2hhcl90eXBlKCkpKQorICAgICAgICArK19faTsKKyAgICAgIHJldHVybiBfX2k7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBjb25zdCB0eXBlbmFtZSBjaGFyX3RyYWl0czxfQ2hhclQ+OjpjaGFyX3R5cGUqCisgICAgY2hhcl90cmFpdHM8X0NoYXJUPjo6CisgICAgZmluZChjb25zdCBjaGFyX3R5cGUqIF9fcywgc3RkOjpzaXplX3QgX19uLCBjb25zdCBjaGFyX3R5cGUmIF9fYSkKKyAgICB7CisgICAgICBmb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MSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX19jMSA8IF9fYzI7IH0KKworICAgICAgc3RhdGljIGludAorICAgICAgY29tcGFyZShjb25zdCBjaGFyX3R5cGUqIF9fczEsIGNvbnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbikKKyAgICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9tZW1jbXAoX19zMSwgX19zMiwgX19uKTsgfQorCisgICAgICBzdGF0aWMgc2l6ZV90CisgICAgICBsZW5ndGgoY29uc3QgY2hhcl90eXBlKiBfX3MpCisgICAgICB7IHJldHVybiBfX2J1aWx0aW5fc3RybGVuKF9fcyk7IH0KKworICAgICAgc3RhdGljIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGZpbmQoY29uc3QgY2hhcl90eXBlKiBfX3MsIHNpemVfdCBfX24sIGNvbnN0IGNoYXJfdHlwZSYgX19hKQorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8Y29uc3QgY2hhcl90eXBlKj4oX19idWlsdGluX21lbWNocihfX3MsIF9fYSwgX19uKSk7IH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIG1vdmUoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNpemVfdCBfX24pCisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxjaGFyX3R5cGUqPihfX2J1aWx0aW5fbWVtbW92ZShfX3MxLCBfX3MyLCBfX24pKTsgfQorCisgICAgICBzdGF0aWMgY2hhcl90eXBlKgorICAgICAgY29weShjaGFyX3R5cGUqIF9fczEsIGNvbnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbikKKyAgICAgIHsgcmV0dXJuIHN0YXRpY19jYXN0PGNoYXJfdHlwZSo+KF9fYnVpbHRpbl9tZW1jcHkoX19zMSwgX19zMiwgX19uKSk7IH0KKworIC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kNYWF9DT05TVEVYUFIgYm9vbAorICAgICAgbHQoY29uc3QgY2hhcl90eXBlJiBfX2MxLCBjb25zdCBjaGFyX3R5cGUmIF9fYzIpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfX2MxIDwgX19jMjsgfQorCisgICAgICBzdGF0aWMgaW50CisgICAgICBjb21wYXJlKGNvbnN0IGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeyByZXR1cm4gd21lbWNtcChfX3MxLCBfX3MyLCBfX24pOyB9CisKKyAgICAgIHN0YXRpYyBzaXplX3QKKyAgICAgIGxlbmd0aChjb25zdCBjaGFyX3R5cGUqIF9fcykKKyAgICAgIHsgcmV0dXJuIHdjc2xlbihfX3MpOyB9CisKKyAgICAgIHN0YXRpYyBjb25zdCBjaGFyX3R5cGUqCisgICAgICBmaW5kKGNvbnN0IGNoYXJfdHlwZSogX19zLCBzaXplX3QgX19uLCBjb25zdCBjaGFyX3R5cGUmIF9fYSkKKyAgICAgIHsgcmV0dXJuIHdtZW1jaHIoX19zLCBfX2EsIF9fbik7IH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIG1vdmUoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNpemVfdCBfX24pCisgICAgICB7IHJldHVybiB3bWVtbW92ZShfX3MxLCBfX3MyLCBfX24pOyB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBjb3B5KGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeyByZXR1cm4gd21lbWNweShfX3MxLCBfX3MyLCBfX24pOyB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBhc3NpZ24oY2hhcl90eXBlKiBfX3MsIHNpemVfdCBfX24sIGNoYXJfdHlwZSBfX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B9CisKKyAgICAgIHN0YXRpYyBpbnQKKyAgICAgIGNvbXBhcmUoY29uc3QgY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNpemVfdCBfX24pCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX19uOyArK19faSkKKwkgIGlmIChsdChfX3MxW19faV0sIF9fczJbX19pXSkpCisJICAgIHJldHVybiAtMTsKKwkgIGVsc2UgaWYgKGx0KF9fczJbX19pXSwgX19zMVtfX2ldKSkKKwkgICAgcmV0dXJuIDE7CisJcmV0dXJuIDA7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBzaXplX3QKKyAgICAgIGxlbmd0aChjb25zdCBjaGFyX3R5cGUqIF9fcykKKyAgICAgIHsKKwlzaXplX3QgX19pID0gMDsKKwl3aGlsZSAoIWVxKF9fc1tfX2ldLCBjaGFyX3R5cGUoKSkpCisJICArK19faTsKKwlyZXR1cm4gX19pOworICAgICAgfQorCisgICAgICBzdGF0aWMgY29uc3QgY2hhcl90eXBlKgorICAgICAgZmluZChjb25zdCBjaGFyX3R5cGUqIF9fcywgc2l6ZV90IF9fbiwgY29uc3QgY2hhcl90eXBlJiBfX2EpCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX19uOyArK19faSkKKwkgIGlmIChlcShfX3NbX19pXSwgX19hKSkKKwkgICAgcmV0dXJuIF9fcyArIF9faTsKKwlyZXR1cm4gMDsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIG1vdmUoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNpemVfdCBfX24pCisgICAgICB7CisJcmV0dXJuIChzdGF0aWNfY2FzdDxjaGFyX3R5cGUqPgorCQkoX19idWlsdGluX21lbW1vdmUoX19zMSwgX19zMiwgX19uICogc2l6ZW9mKGNoYXJfdHlwZSkpKSk7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBjb3B5KGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeworCXJldHVybiAoc3RhdGljX2Nhc3Q8Y2hhcl90eXBlKj4KKwkJKF9fYnVpbHRpbl9tZW1jcHkoX19zMSwgX19zMiwgX19uICogc2l6ZW9mKGNoYXJfdHlwZSkpKSk7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBhc3NpZ24oY2hhcl90eXBlKiBfX3MsIHNpemVfdCBfX24sIGNoYXJfdHlwZSBfX2EpCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX19uOyArK19faSkKKwkgIGFzc2lnbihfX3NbX19pXSwgX19hKTsKKwlyZXR1cm4gX19zOworICAgICAgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGNoYXJfdHlwZQorICAgICAgdG9fY2hhcl90eXBlKGNvbnN0IGludF90eXBlJiBfX2MpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjaGFyX3R5cGUoX19jKTsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGludF90eXBlCisgICAgICB0b19pbnRfdHlwZShjb25zdCBjaGFyX3R5cGUmIF9fYykgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGludF90eXBlKF9fYyk7IH0KKworICAgICAgc3RhdGljIGNvbnN0ZXhwciBib29sCisgICAgICBlcV9pbnRfdHlwZShjb25zdCBpbnRfdHlwZSYgX19jMSwgY29uc3QgaW50X3R5cGUmIF9fYzIpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2MxID09IF9fYzI7IH0KKworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnRfdHlwZQorICAgICAgZW9mKCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIHN0YXRpY19jYXN0PGludF90eXBlPigtMSk7IH0KKworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnRfdHlwZQorICAgICAgbm90X2VvZihjb25zdCBpbnRfdHlwZSYgX19jKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gZXFfaW50X3R5cGUoX19jLCBlb2YoKSkgPyAwIDogX19jOyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGNoYXJfdHJhaXRzPGNoYXIzMl90PgorICAgIHsKKyAgICAgIHR5cGVkZWYgY2hhcjMyX3QgICAgICAgICAgY2hhcl90eXBlOworICAgICAgdHlwZWRlZiB1aW50X2xlYXN0MzJfdCAgICBpbnRfdHlwZTsKKyAgICAgIHR5cGVkZWYgc3RyZWFtb2ZmICAgICAgICAgb2ZmX3R5cGU7CisgICAgICB0eXBlZGVmIHUzMnN0cmVhbXBvcyAgICAgIHBvc190eXBlOworICAgICAgdHlwZWRlZiBtYnN0YXRlX3QgICAgICAgICBzdGF0ZV90eXBlOworCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgYXNzaWduKGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKSBub2V4Y2VwdAorICAgICAgeyBfX2MxID0gX19jMjsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGJvb2wKKyAgICAgIGVxKGNvbnN0IGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX19jMSA9PSBfX2MyOyB9CisKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgYm9vbAorICAgICAgbHQoY29uc3QgY2hhcl90eXBlJiBfX2MxLCBjb25zdCBjaGFyX3R5cGUmIF9fYzIpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfX2MxIDwgX19jMjsgfQorCisgICAgICBzdGF0aWMgaW50CisgICAgICBjb21wYXJlKGNvbnN0IGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeworCWZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsgKytfX2kpCisJICBpZiAobHQoX19zMVtfX2ldLCBfX3MyW19faV0pKQorCSAgICByZXR1cm4gLTE7CisJICBlbHNlIGlmIChsdChfX3MyW19faV0sIF9fczFbX19pXSkpCisJICAgIHJldHVybiAxOworCXJldHVybiAwOworICAgICAgfQorCisgICAgICBzdGF0aWMgc2l6ZV90CisgICAgICBsZW5ndGgoY29uc3QgY2hhcl90eXBlKiBfX3MpCisgICAgICB7CisJc2l6ZV90IF9faSA9IDA7CisJd2hpbGUgKCFlcShfX3NbX19pXSwgY2hhcl90eXBlKCkpKQorCSAgKytfX2k7CisJcmV0dXJuIF9faTsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGZpbmQoY29uc3QgY2hhcl90eXBlKiBfX3MsIHNpemVfdCBfX24sIGNvbnN0IGNoYXJfdHlwZSYgX19hKQorICAgICAgeworCWZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsgKytfX2kpCisJICBpZiAoZXEoX19zW19faV0sIF9fYSkpCisJICAgIHJldHVybiBfX3MgKyBfX2k7CisJcmV0dXJuIDA7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBtb3ZlKGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeworCXJldHVybiAoc3RhdGljX2Nhc3Q8Y2hhcl90eXBlKj4KKwkJKF9fYnVpbHRpbl9tZW1tb3ZlKF9fczEsIF9fczIsIF9fbiAqIHNpemVvZihjaGFyX3R5cGUpKSkpOworICAgICAgfQorCisgICAgICBzdGF0aWMgY2hhcl90eXBlKgorICAgICAgY29weShjaGFyX3R5cGUqIF9fczEsIGNvbnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbikKKyAgICAgIHsgCisJcmV0dXJuIChzdGF0aWNfY2FzdDxjaGFyX3R5cGUqPgorCQkoX19idWlsdGluX21lbWNweShfX3MxLCBfX3MyLCBfX24gKiBzaXplb2YoY2hhcl90eXBlKSkpKTsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIGFzc2lnbihjaGFyX3R5cGUqIF9fcywgc2l6ZV90IF9fbiwgY2hhcl90eXBlIF9fYSkKKyAgICAgIHsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCSAgYXNzaWduKF9fc1tfX2ldLCBfX2EpOworCXJldHVybiBfX3M7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgY2hhcl90eXBlCisgICAgICB0b19jaGFyX3R5cGUoY29uc3QgaW50X3R5cGUmIF9fYykgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGNoYXJfdHlwZShfX2MpOyB9CisKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgaW50X3R5cGUKKyAgICAgIHRvX2ludF90eXBlKGNvbnN0IGNoYXJfdHlwZSYgX19jKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gaW50X3R5cGUoX19jKTsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGJvb2wKKyAgICAgIGVxX2ludF90eXBlKGNvbnN0IGludF90eXBlJiBfX2MxLCBjb25zdCBpbnRfdHlwZSYgX19jMikgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYzEgPT0gX19jMjsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGludF90eXBlCisgICAgICBlb2YoKSBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8aW50X3R5cGU+KC0xKTsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGludF90eXBlCisgICAgICBub3RfZW9mKGNvbnN0IGludF90eXBlJiBfX2MpIG5vZXhjZXB0CisgICAgICB7IHJldHV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gZm9yIG1vcmUgaW5mb3JtYXRpb24uCisgICAgICAqLworICAgICAgdmlydHVhbCByZXN1bHQKKyAgICAgIGRvX291dChzdGF0ZV90eXBlJiBfX3N0YXRlLCBjb25zdCBpbnRlcm5fdHlwZSogX19mcm9tLAorCSAgICAgY29uc3QgaW50ZXJuX3R5cGUqIF9fZnJvbV9lbmQsIGNvbnN0IGludGVybl90eXBlKiYgX19mcm9tX25leHQsCisJICAgICBleHRlcm5fdHlwZSogX190bywgZXh0ZXJuX3R5cGUqIF9fdG9fZW5kLAorCSAgICAgZXh0ZXJuX3R5cGUqJiBfX3RvX25leHQpIGNvbnN0ID0gMDsKKworICAgICAgdmlydHVhbCByZXN1bHQKKyAgICAgIGRvX3Vuc2hpZnQoc3RhdGVfdHlwZSYgX19zdGF0ZSwgZXh0ZXJuX3R5cGUqIF9fdG8sCisJCSBleHRlcm5fdHlwZSogX190b19lbmQsIGV4dGVybl90eXBlKiYgX190b19uZXh0KSBjb25zdCA9IDA7CisKKyAgICAgIHZpcnR1YWwgcmVzdWx0CisgICAgICBkb19pbihzdGF0ZV90eXBlJiBfX3N0YXRlLCBjb25zdCBleHRlcm5fdHlwZSogX19mcm9tLAorCSAgICBjb25zdCBleHRlcm5fdHlwZSogX19mcm9tX2VuZCwgY29uc3QgZXh0ZXJuX3R5cGUqJiBfX2Zyb21fbmV4dCwKKwkgICAgaW50ZXJuX3R5cGUqIF9fdG8sIGludGVybl90eXBlKiBfX3RvX2VuZCwKKwkgICAgaW50ZXJuX3R5cGUqJiBfX3RvX25leHQpIGNvbnN0ID0gMDsKKworICAgICAgdmlydHVhbCBpbnQKKyAgICAgIGRvX2VuY29kaW5nKCkgY29uc3QgdGhyb3coKSA9IDA7CisKKyAgICAgIHZpcnR1YWwgYm9vbAorICAgICAgZG9fYWx3YXlzX25vY29udigpIGNvbnN0IHRocm93KCkgPSAwOworCisgICAgICB2aXJ0dWFsIGludAorICAgICAgZG9fbGVuZ3RoKHN0YXRlX3R5cGUmLC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RfYmFzZTxfSW50ZXJuVCwgX0V4dGVyblQsIF9TdGF0ZVQ+IChfX3JlZnMpLAorCV9NX2NfbG9jYWxlX2NvZGVjdnQoMCkKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgY29kZWN2dChfX2NfbG9jYWxlIF9fY2xvYywgc2l6ZV90IF9fcmVmcyA9IDApOworCisgICAgcHJvdGVjdGVkOgorICAgICAgdmlydHVhbAorICAgICAgfmNvZGVjdnQoKSB7IH0KKworICAgICAgdmlydHVhbCByZXN1bHQKKyAgICAgIGRvX291dChzdGF0ZV90eXBlJiBfX3N0YXRlLCBjb25zdCBpbnRlcm5fdHlwZSogX19mcm9tLAorCSAgICAgY29uc3QgaW50ZXJuX3R5cGUqIF9fZnJvbV9lbmQsIGNvbnN0IGludGVybl90eXBlKiYgX19mcm9tX25leHQsCisJICAgICBleHRlcm5fdHlwZSogX190bywgZXh0ZXJuX3R5cGUqIF9fdG9fZW5kLAorCSAgICAgZXh0ZXJuX3R5cGUqJiBfX3RvX25leHQpIGNvbnN0OworCisgICAgICB2aXJ0dWFsIHJlc3VsdAorICAgICAgZG9fdW5zaGlmdChzdGF0ZV90eXBlJiBfX3N0YXRlLCBleHRlcm5fdHlwZSogX190bywKKwkJIGV4dGVybl90eXBlKiBfX3RvX2VuZCwgZXh0ZXJuX3R5cGUqJiBfX3RvX25leHQpIGNvbnN0OworCisgICAgICB2aXJ0dWFsIHJlc3VsdAorICAgICAgZG9faW4oc3RhdGVfdHlwZSYgX19zdGF0ZSwgY29uc3QgZXh0ZXJuX3R5cGUqIF9fZnJvbSwKKwkgICAgY29uc3QgZXh0ZXJuX3R5cGUqIF9fZnJvbV9lbmQsIGNvbnN0IGV4dGVybl90eXBlKiYgX19mcm9tX25leHQsCisJICAgIGludGVybl90eXBlKiBfX3RvLCBpbnRlcm5fdHlwZSogX190b19lbmQsCisJICAgIGludGVybl90eXBlKiYgX190b19uZXh0KSBjb25zdDsKKworICAgICAgdmlydHVhbCB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7CisKKyAgICAgIHZpcnR1YWwgaW50CisgICAgICBkb19lbmNvZGluZygpIGNvbnN0IHRocm93KCk7CisKKyAgICAgIHZpcnR1YWwgYm9vbAorICAgICAgZG9fYWx3YXlzX25vY29udigpIGNvbnN0IHRocm93KCk7CisKKyAgICAgIHZpcnR1YWwgaW50CisgICAgICBkb19sZW5ndGgoc3RhdGVfdHlwZSYsIGNvbnN0IGV4dGVybl90eXBlKiBfX2Zyb20sCisJCWNvbnN0IGV4dGVybl90eXBlKiBfX2VuZCwgc2l6ZV90IF9fbWF4KSBjb25zdDsKKworICAgICAgdmlydHVhbCBpbnQKKyAgICAgIGRvX21heF9sZW5ndGgoKSBjb25zdCB0aHJvdygpOworICB9OworCisjaWZkZWYgX0dMSUJDWFhfVVNFX1dDSEFSX1QKKyAgLy8vIGNsYXNzIGNvZGVjdnQ8d2NoYXJfdCwgY2hhciwgbWJzdGF0ZV90PiBzcGVjaWFsaXphdGlvbi4KKyAgdGVtcGxhdGU8PgorICAgIGNsYXNzIGNvZGVjdnQ8d2NoYXJfdCwgY2hhciwgbWJzdGF0ZV90PgorICAgIDogcHVibGljIF9fY29kZWN2dF9hYnN0cmFjdF9iYXNlPHdjaGFyX3QsIGNoYXIsIG1ic3RhdGVfdD4KKyAgICB7CisgICAgcHVibGljOgorICAgICAgLy8gVHlwZXM6CisgICAgICB0eXBlZGVmIHdjaGFyX3QJCQlpbnRlcm5fdHlwZTsKKyAgICAgIHR5cGVkZWYgY2hhcgkJCWV4dGVybl90eXBlOworICAgICAgdHlwZWRlZiBtYnN0YXRlX3QJCQlzdGF0ZV90eXBlOworCisgICAgcHJvdGVjdGVkOgorICAgICAgX19jX2xvY2FsZQkJCV9NX2NfbG9jYWxlX2NvZGVjdnQ7CisKKyAgICBwdWJsaWM6CisgICAgICBzdGF0aWMgbG9jYWxlOjppZAkJCWlkOworCisgICAgICBleHBsaWNpdAorICAgICAgY29kZWN2dChzaXplX3QgX19yZWZzID0gMCk7CisKKyAgICAgIG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IF9faXNfaW50ZWdlcjxib29sPgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMSB9OworICAgICAgdHlwZWRlZiBfX3RydWVfdHlwZSBfX3R5cGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfaW50ZWdlcjxjaGFyPgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMSB9OworICAgICAgdHlwZWRlZiBfX3RydWVfdHlwZSBfX3R5cGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfaW50ZWdlcjxzaWduZWQgY2hhcj4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8dW5zaWduZWQgY2hhcj4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyMgaWZkZWYgX0dMSUJDWFhfVVNFX1dDSEFSX1QKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8d2NoYXJfdD4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisjIGVuZGlmCisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfaW50ZWdlcjxjaGFyMTZfdD4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8Y2hhcjMyX3Q+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworI2VuZGlmCisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8c2hvcnQ+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX19pc19pbnRlZ2VyPHVuc2lnbmVkIHNob3J0PgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMSB9OworICAgICAgdHlwZWRlZiBfX3RydWVfdHlwZSBfX3R5cGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfaW50ZWdlcjxpbnQ+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX19pc19pbnRlZ2VyPHVuc2lnbmVkIGludD4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8bG9uZz4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8dW5zaWduZWQgbG9uZz4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2ludGVnZXI8bG9uZyBsb25nPgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMSB9OworICAgICAgdHlwZWRlZiBfX3RydWVfdHlwZSBfX3R5cGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfaW50ZWdlcjx1bnNpZ25lZCBsb25nIGxvbmc+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIC8vCisgIC8vIEZsb2F0aW5nIHBvaW50IHR5cGVzCisgIC8vCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdHJ1Y3QgX19pc19mbG9hdGluZworICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMCB9OworICAgICAgdHlwZWRlZiBfX2ZhbHNlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgLy8gdGhyZWUgc3BlY2lhbGl6YXRpb25zIChmbG9hdCwgZG91YmxlIGFuZCAnbG9uZyBkb3VibGUnKQorICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IF9faXNfZmxvYXRpbmc8ZmxvYXQ+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX19pc19mbG9hdGluZzxkb3VibGU+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX19pc19mbG9hdGluZzxsb25nIGRvdWJsZT4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgLy8KKyAgLy8gUG9pbnRlciB0eXBlcworICAvLworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgc3RydWN0IF9faXNfcG9pbnRlcgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMCB9OworICAgICAgdHlwZWRlZiBfX2ZhbHNlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHN0cnVjdCBfX2lzX3BvaW50ZXI8X1RwKj4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgLy8KKyAgLy8gTm9ybWFsIGl0ZXJhdG9yIHR5cGUKKyAgLy8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHN0cnVjdCBfX2lzX25vcm1hbF9pdGVyYXRvcgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMCB9OworICAgICAgdHlwZWRlZiBfX2ZhbHNlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0l0ZXJhdG9yLCB0eXBlbmFtZSBfQ29udGFpbmVyPgorICAgIHN0cnVjdCBfX2lzX25vcm1hbF9pdGVyYXRvcjwgX19nbnVfY3h4OjpfX25vcm1hbF9pdGVyYXRvcjxfSXRlcmF0b3IsCisJCQkJCQkJICAgICAgX0NvbnRhaW5lcj4gPgorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMSB9OworICAgICAgdHlwZWRlZiBfX3RydWVfdHlwZSBfX3R5cGU7CisgICAgfTsKKworICAvLworICAvLyBBbiBhcml0aG1ldGljIH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Y3QgX19pc19jaGFyPGNoYXI+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisjaWZkZWYgX0dMSUJDWFhfVVNFX1dDSEFSX1QKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2NoYXI8d2NoYXJfdD4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisjZW5kaWYKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgc3RydWN0IF9faXNfYnl0ZQorICAgIHsKKyAgICAgIGVudW0geyBfX3ZhbHVlID0gMCB9OworICAgICAgdHlwZWRlZiBfX2ZhbHNlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2J5dGU8Y2hhcj4KKyAgICB7CisgICAgICBlbnVtIHsgX192YWx1ZSA9IDEgfTsKKyAgICAgIHR5cGVkZWYgX190cnVlX3R5cGUgX190eXBlOworICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBfX2lzX2J5dGU8c2lnbmVkIGNoYXI+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX19pc19ieXRlPHVuc2lnbmVkIGNoYXI+CisgICAgeworICAgICAgZW51bSB7IF9fdmFsdWUgPSAxIH07CisgICAgICB0eXBlZGVmIF9fdHJ1ZV90eXBlIF9fdHlwZTsKKyAgICB9OworCisgIC8vCisgIC8vIE1vdmUgaXRlcmF0b3IgdHlwZQorICAvLworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAg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X01fZmluaXNoLl9NX2N1ciwKKwkJCQkgICAgICBfX3ZhbHVlLCBfTV9nZXRfVHBfYWxsb2NhdG9yKCkpOworICAgICAgICB9CisgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgeworICAgICAgICAgIHN0ZDo6X0Rlc3Ryb3kodGhpcy0+X01faW1wbC5fTV9zdGFydCwgaXRlcmF0b3IoKl9fY3VyLCBfX2N1ciksCisJCQlfTV9nZXRfVHBfYWxsb2NhdG9yKCkpOworICAgICAgICAgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworICAgICAgICB9CisgICAgfQorCisgIHRlbXBsYXRlIDx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX0lucHV0SXRlcmF0b3I+CisgICAgICB2b2lkCisgICAgICBkZXF1ZTxfVHAsIF9BbGxvYz46OgorICAgICAgX01fcmFuZ2VfaW5pdGlhbGl6ZShfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6aW5wdXRfaXRlcmF0b3JfdGFnKQorICAgICAgeworICAgICAgICB0aGlzLT5fTV9pbml0aWFsaXplX21hcCgwKTsKKyAgICAgICAgX190cnkKKyAgICAgICAgICB7CisgICAgICAgICAgICBmb3IgKDsgX19maXJzdCAhPSBfX2xhc3Q7ICsrX19maXJzdCkKKyAgICAgICAgICAgICAgcHVzaF9iYWNrKCpfX2ZpcnN0KTsKKyAgICAgICAgICB9CisgICAgICAgIF9fY2F0Y2goLi4uKQorICAgICAgICAgIHsKKyAgICAgICAgICAgIGNsZWFyKCk7CisgICAgICAgICAgICBfX3Rocm93X2V4Y2VwdGlvbl9hZ2FpbjsKKyAgICAgICAgICB9CisgICAgICB9CisKKyAgdGVtcGxhdGUgPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorIC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F9Gb3J3YXJkSXRlcmF0b3IgX19sYXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmZvcndhcmRfaXRlcmF0b3JfdGFnKQorICAgICAgeworICAgICAgICBjb25zdCBzaXplX3R5cGUgX19uID0gc3RkOjpkaXN0YW5jZShfX2ZpcnN0LCBfX2xhc3QpOworICAgICAgICBpZiAoX19wb3MuX01fY3VyID09IHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fY3VyKQorCSAgeworCSAgICBpdGVyYXRvciBfX25ld19zdGFydCA9IF9NX3Jlc2VydmVfZWxlbWVudHNfYXRfZnJvbnQoX19uKTsKKwkgICAgX190cnkKKwkgICAgICB7CisJCXN0ZDo6X191bmluaXRpYWxpemVkX2NvcHlfYShfX2ZpcnN0LCBfX2xhc3QsIF9fbmV3X3N0YXJ0LAorCQkJCQkgICAgX01fZ2V0X1RwX2FsbG9jYXRvcigpKTsKKwkJdGhpcy0+X01faW1wbC5fTV9zdGFydCA9IF9fbmV3X3N0YXJ0OworCSAgICAgIH0KKwkgICAgX19jYXRjaCguLi4pCisJICAgICAgeworCQlfTV9kZXN0cm95X25vZGVzKF9fbmV3X3N0YXJ0Ll9NX25vZGUsCisJCQkJIHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fbm9kZSk7CisJCV9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworCSAgICAgIH0KKwkgIH0KKyAgICAgICAgZWxzZSBpZiAoX19wb3MuX01fY3VyID09IHRoaXMtPl9NX2ltcGwuX01fZmluaXNoLl9NX2N1cikKKwkgIHsKKwkgICAgaXRlcmF0b3IgX19uZXdfZmluaXNoID0gX01fcmVzZXJ2ZV9lbGVtZW50c19hdF9iYWNrKF9fbik7CisJICAgIF9fdHJ5CisJICAgICAgeworCQlzdGQ6Ol9fdW5pbml0aWFsaXplZF9jb3B5X2EoX19maXJzdCwgX19sYXN0LAorCQkJCQkgICAgdGhpcy0+X01faW1wbC5fTV9maW5pc2gsCisJCQk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XdfZWxlbXMgKyBfU19idWZmZXJfc2l6ZSgpIC0gMSkKKwkJCQkgICAgIC8gX1NfYnVmZmVyX3NpemUoKSk7CisgICAgICBfTV9yZXNlcnZlX21hcF9hdF9iYWNrKF9fbmV3X25vZGVzKTsKKyAgICAgIHNpemVfdHlwZSBfX2k7CisgICAgICBfX3RyeQorICAgICAgICB7CisgICAgICAgICAgZm9yIChfX2kgPSAxOyBfX2kgPD0gX19uZXdfbm9kZXM7ICsrX19pKQorICAgICAgICAgICAgKih0aGlzLT5fTV9pbXBsLl9NX2ZpbmlzaC5fTV9ub2RlICsgX19pKSA9IHRoaXMtPl9NX2FsbG9jYXRlX25vZGUoKTsKKyAgICAgICAgfQorICAgICAgX19jYXRjaCguLi4pCisgICAgICAgIHsKKyAgICAgICAgICBmb3IgKHNpemVfdHlwZSBfX2ogPSAxOyBfX2ogPCBfX2k7ICsrX19qKQorICAgICAgICAgICAgX01fZGVhbGxvY2F0ZV9ub2RlKCoodGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fbm9kZSArIF9faikpOworICAgICAgICAgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworICAgICAgICB9CisgICAgfQorCisgIHRlbXBsYXRlIDx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICB2b2lkCisgICAgZGVxdWU8X1RwLCBfQWxsb2M+OjoKKyAgICBfTV9yZWFsbG9jYXRlX21hcChzaXplX3R5cGUgX19ub2Rlc190b19hZGQsIGJvb2wgX19hZGRfYXRfZnJvbnQpCisgICAgeworICAgICAgY29uc3Qgc2l6ZV90eXBlIF9fb2xkX251bV9ub2RlcworCT0gdGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fbm9kZSAtIHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fbm9kZSArIDE7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19uZXdfbnVtX25vZGVzID0gX19vbGRfbnVtX25vZGVzICsgX19ub2Rlc190b19hZGQ7CisKKyAgICAgIF9NYXBfcG9pbnRlciBfX25ld19uc3RhcnQ7CisgICAgICBpZiAodGhpcy0+X01faW1wbC5fTV9tYXBfc2l6ZSA+IDIgKiBfX25ld19udW1fbm9kZXMpCisJeworCSAgX19uZXdfbnN0YXJ0ID0gdGhpcy0+X01faW1wbC5fTV9tYXAgKyAodGhpcy0+X01faW1wbC5fTV9tYXBfc2l6ZQorCQkJCQkgLSBfX25ld19udW1fbm9kZXMpIC8gMgorCSAgICAgICAgICAgICAgICAgKyAoX19hZGRfYXRfZnJvbnQgPyBfX25vZGVzX3RvX2FkZCA6IDApOworCSAgaWYgKF9fbmV3X25zdGFydCA8IHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fbm9kZSkKKwkgICAgc3RkOjpjb3B5KHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fbm9kZSwKKwkJICAgICAgdGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fbm9kZSArIDEsCisJCSAgICAgIF9fbmV3X25zdGFydCk7CisJICBlbHNlCisJICAgIHN0ZDo6Y29weV9iYWNrd2FyZCh0aGlzLT5fTV9pbXBsLl9NX3N0YXJ0Ll9NX25vZGUsCisJCQkgICAgICAgdGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fbm9kZSArIDEsCisJCQkgICAgICAgX19uZXdfbnN0YXJ0ICsgX19vbGRfbnVtX25vZGVzKTsKKwl9CisgICAgICBlbHNlCisJeworCSAgc2l6ZV90eXBlIF9fbmV3X21hcF9zaXplID0gdGhpcy0+X01faW1wbC5fTV9tYXBfc2l6ZQorCSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBzdGQ6Om1heCh0aGlzLT5fTV9pbXBsLl9NX21hcF9zaXplLAorCQkJCQkJX19ub2Rlc190b19hZGQpICsgMjsKKworCSAgX01hcF9wb2ludGVyIF9fbmV3X21hcCA9IHRoaXMtPl9NX2FsbG9jYXRlX21hcChfX25ld19tYXBfc2l6ZSk7CisJICBfX25ld19uc3Rh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fQorCisgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSogX01fbmV4dDsKKworICAgIF9Gd2RfbGlzdF9ub2RlX2Jhc2UqCisgICAgX01fdHJhbnNmZXJfYWZ0ZXIoX0Z3ZF9saXN0X25vZGVfYmFzZSogX19iZWdpbiwKKwkJICAgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSogX19lbmQpCisgICAgeworICAgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSogX19rZWVwID0gX19iZWdpbi0+X01fbmV4dDsKKyAgICAgIGlmIChfX2VuZCkKKwl7CisJICBfX2JlZ2luLT5fTV9uZXh0ID0gX19lbmQtPl9NX25leHQ7CisJICBfX2VuZC0+X01fbmV4dCA9IF9NX25leHQ7CisJfQorICAgICAgZWxzZQorCV9fYmVnaW4tPl9NX25leHQgPSAwOworICAgICAgX01fbmV4dCA9IF9fa2VlcDsKKyAgICAgIHJldHVybiBfX2VuZDsKKyAgICB9CisKKyAgICB2b2lkCisgICAgX01fcmV2ZXJzZV9hZnRlcigpIG5vZXhjZXB0CisgICAgeworICAgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSogX190YWlsID0gX01fbmV4dDsKKyAgICAgIGlmICghX190YWlsKQorCXJldHVybjsKKyAgICAgIHdoaWxlIChfRndkX2xpc3Rfbm9kZV9iYXNlKiBfX3RlbXAgPSBfX3RhaWwtPl9NX25leHQpCisJeworCSAgX0Z3ZF9saXN0X25vZGVfYmFzZSogX19rZWVwID0gX01fbmV4dDsKKwkgIF9NX25leHQgPSBfX3RlbXA7CisJICBfX3RhaWwtPl9NX25leHQgPSBfX3RlbXAtPl9NX25leHQ7CisJICBfTV9uZXh0LT5fTV9uZXh0ID0gX19rZWVwOworCX0KKyAgICB9CisgIH07CisKKyAgLyoqCisgICAqICBAYnJpZWYgIEEgaGVscGVyIG5vZGUgY2xhc3MgZm9yICVmb3J3YXJkX2xpc3QuCisgICAqICAgICAgICAgIFRoaXMgaXMganVzdCBhIGxpbmtlZCBsaXN0I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cmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpmb3J3YXJkX2l0ZXJhdG9yX3RhZyAgICAgICAgICBpdGVyYXRvcl9jYXRlZ29yeTsKKworICAgICAgX0Z3ZF9saXN0X2l0ZXJhdG9yKCkKKyAgICAgIDogX01fbm9kZSgpIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgX0Z3ZF9saXN0X2l0ZXJhdG9yKF9Gd2RfbGlzdF9ub2RlX2Jhc2UqIF9fbikgCisgICAgICA6IF9NX25vZGUoX19uKSB7IH0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvciooKSBjb25zdAorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8X05vZGUqPih0aGlzLT5fTV9ub2RlKS0+X01fdmFsdWU7IH0KKworICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKHN0YXRpY19jYXN0PF9Ob2RlKj4KKwkJCQkodGhpcy0+X01fbm9kZSktPl9NX3ZhbHVlKTsgfQorCisgICAgICBfU2VsZiYKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworICAgICAgICBfTV9ub2RlID0gX01fbm9kZS0+X01fbmV4dDsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfU2VsZgorICAgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgICB7CisgICAgICAgIF9TZWxmIF9fdG1wKCp0aGlzKTsKKyAgICAgICAgX01fbm9kZSA9IF9NX25vZGUtPl9NX25leHQ7CisgICAgICAgIHJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgYm9vbAorICAgICAgb3BlcmF0b3I9PShjb25zdCBfU2VsZiYgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbm9kZSA9PSBfX3guX01fbm9kZTsgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IF9TZWxmJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ub2RlICE9IF9feC5fTV9ub2RlOyB9CisKKyAgICAgIF9TZWxmCisgICAgICBfTV9uZXh0KCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgaWYgKF9NX25vZGUpCisgICAgICAgICAgcmV0dXJuIF9Gd2RfbGlzdF9pdGVyYXRvcihfTV9ub2RlLT5fTV9uZXh0KTsKKyAgICAgICAgZWxzZQorICAgICAgICAgIHJldHVybiBfRndkX2xpc3RfaXRlcmF0b3IoMCk7CisgICAgICB9CisKKyAgICAgIF9Gd2RfbGlzdF9ub2RlX2Jhc2UqIF9NX25vZGU7CisgICAgfTsKKworICAvKioKKyAgICogICBAYnJpZWYgQSBmb3J3YXJkX2xpc3Q6OmNvbnN0X2l0ZXJhdG9yLgorICAgKiAKKyAgICogICBBbGwgdGhlIGZ1bmN0aW9ucyBhcmUgb3Agb3ZlcmxvYWRzLgorICAgKi8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHN0cnVjdCBfRndkX2xpc3RfY29uc3RfaXRlcmF0b3IKKyAgICB7CisgICAgICB0eXBlZGVmIF9Gd2RfbGlzdF9jb25zdF9pdGVyYXRvcjxfVHA+ICAgICAgX1NlbGY7CisgICAgICB0eXBlZGVmIGNvbnN0IF9Gd2RfbGlzdF9ub2RlPF9UcD4gICAgICAgICAgX05vZGU7CisgICAgICB0eXBlZGVmIF9Gd2RfbGlzdF9pdGVyYXRvcjxfVHA+ICAgICAgICAgICAgaXRlcmF0b3I7CisKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqICAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXI7C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cisrKGludCkKKyAgICAgIHsKKyAgICAgICAgX1NlbGYgX190bXAoKnRoaXMpOworICAgICAgICBfTV9ub2RlID0gX01fbm9kZS0+X01fbmV4dDsKKyAgICAgICAgcmV0dXJuIF9fdG1wOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IF9TZWxmJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ub2RlID09IF9feC5fTV9ub2RlOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgX1NlbGYmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX25vZGUgIT0gX194Ll9NX25vZGU7IH0KKworICAgICAgX1NlbGYKKyAgICAgIF9NX25leHQoKSBjb25zdAorICAgICAgeworICAgICAgICBpZiAodGhpcy0+X01fbm9kZSkKKyAgICAgICAgICByZXR1cm4gX0Z3ZF9saXN0X2NvbnN0X2l0ZXJhdG9yKF9NX25vZGUtPl9NX25leHQpOworICAgICAgICBlbHNlCisgICAgICAgICAgcmV0dXJuIF9Gd2RfbGlzdF9jb25zdF9pdGVyYXRvcigwKTsKKyAgICAgIH0KKworICAgICAgY29uc3QgX0Z3ZF9saXN0X25vZGVfYmFzZSogX01fbm9kZTsKKyAgICB9OworCisgIC8qKgorICAgKiAgQGJyaWVmICBGb3J3YXJkIGxpc3QgaXRlcmF0b3IgZXF1YWxpdHkgY29tcGFyaXNvbi4KKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgYm9vbAorICAgIG9wZXJhdG9yPT0oY29uc3QgX0Z3ZF9saXN0X2l0ZXJhdG9yPF9UcD4mIF9feCwKKyAgICAgICAgICAgICAgIGNvbnN0IF9Gd2RfbGlzdF9jb25zdF9pdGVyYXRvcjxfVHA+JiBfX3kpCisgICAgeyByZXR1cm4gX194Ll9NX25vZGUgPT0gX195Ll9NX25vZGU7IH0KKworICAvKioKKyAgICogIE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Z3MpCisgICAgICAgIHsKKyAgICAgICAgICBfTm9kZSogX19ub2RlID0gdGhpcy0+X01fZ2V0X25vZGUoKTsKKyAgICAgICAgICBfX3RyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfTV9nZXRfTm9kZV9hbGxvY2F0b3IoKS5jb25zdHJ1Y3QoX19ub2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZDo6Zm9yd2FyZDxfQXJncz4oX19hcmdzKS4uLik7CisgICAgICAgICAgICAgIF9fbm9kZS0+X01fbmV4dCA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgICAgX19jYXRjaCguLi4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIHRoaXMtPl9NX3B1dF9ub2RlKF9fbm9kZSk7CisgICAgICAgICAgICAgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworICAgICAgICAgICAgfQorICAgICAgICAgIHJldHVybiBfX25vZGU7CisgICAgICAgIH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3M+CisgICAgICAgIF9Gd2RfbGlzdF9ub2RlX2Jhc2UqCisgICAgICAgIF9NX2luc2VydF9hZnRlcihjb25zdF9pdGVyYXRvciBfX3BvcywgX0FyZ3MmJi4uLiBfX2FyZ3MpOworCisgICAgICB2b2lkCisgICAgICBfTV9wdXRfbm9kZShfTm9kZSogX19wKQorICAgICAgeyBfTV9nZXRfTm9kZV9hbGxvY2F0b3IoKS5kZWFsbG9jYXRlKF9fcCwgMSk7IH0KKworICAgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSoKKyAgICAgIF9NX2VyYXNlX2FmdGVyKF9Gd2RfbGlzdF9ub2RlX2Jhc2UqIF9fcG9zKTsKKworICAgICAgX0Z3ZF9saXN0X25vZGVfYmFzZSoKKyAgICAgIF9NX2VyYXNlX2FmdGVyKF9Gd2RfbGlzdF9ub2RlX2Jhc2UqIF9fcG9zLCAKKyAgICAgICA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2UgICAgIGNvbnN0X3JlZmVyZW5jZTsKKyAKKyAgICAgIHR5cGVkZWYgX0Z3ZF9saXN0X2l0ZXJhdG9yPF9UcD4gICAgICAgICAgICAgICAgICAgICAgaXRlcmF0b3I7CisgICAgICB0eXBlZGVmIF9Gd2RfbGlzdF9jb25zdF9pdGVyYXRvcjxfVHA+ICAgICAgICAgICAgICAgIGNvbnN0X2l0ZXJhdG9yOworICAgICAgdHlwZWRlZiBzdGQ6OnNpemVfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3R5cGU7CisgICAgICB0eXBlZGVmIHN0ZDo6cHRyZGlmZl90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0FsbG9jICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisKKyAgICAgIC8vIDIzLjIuMy4xIGNvbnN0cnVjdC9jb3B5L2Rlc3Ryb3k6CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICVmb3J3YXJkX2xpc3Qgd2l0aCBubyBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gIF9fYWwgIEFuIGFsbG9jYXRvciBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBmb3J3YXJkX2xpc3QoY29uc3QgX0FsbG9jJiBfX2FsID0gX0FsbG9jKCkpCisgICAgICA6IF9CYXNlKF9Ob2RlX2FsbG9jX3R5cGUoX19hbCkpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb3B5IGNvbnN0cnVjdG9yIHdpdGggYWxsb2NhdG9yIGFyZ3VtZW50LgorICAgICAgICogIEBwYXJhbSAgX19saXN0ICBJbnB1dCBsaXN0IHRvIGNvcHkuCisgICAgICAgKiAgQHBhcmFtICBfX2FsICAgIEFuIGFsbG9jYXR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l6ZXJfbGlzdCBvZiB2YWx1ZV90eXBlLgorICAgICAgICogIEBwYXJhbSAgX19hbCAgQW4gYWxsb2NhdG9yIG9iamVjdC4KKyAgICAgICAqCisgICAgICAgKiAgQ3JlYXRlIGEgJWZvcndhcmRfbGlzdCBjb25zaXN0aW5nIG9mIGNvcGllcyBvZiB0aGUgZWxlbWVudHMKKyAgICAgICAqICBpbiB0aGUgaW5pdGlhbGl6ZXJfbGlzdCBAYSBfX2lsLiAgVGhpcyBpcyBsaW5lYXIgaW4gX19pbC5zaXplKCkuCisgICAgICAgKi8KKyAgICAgIGZvcndhcmRfbGlzdChzdGQ6OmluaXRpYWxpemVyX2xpc3Q8X1RwPiBfX2lsLAorICAgICAgICAgICAgICAgICAgIGNvbnN0IF9BbGxvYyYgX19hbCA9IF9BbGxvYygpKQorICAgICAgOiBfQmFzZShfTm9kZV9hbGxvY190eXBlKF9fYWwpKQorICAgICAgeyBfTV9pbml0aWFsaXplX2Rpc3BhdGNoKF9faWwuYmVnaW4oKSwgX19pbC5lbmQoKSwgX19mYWxzZV90eXBlKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVGhlIGZvcndhcmRfbGlzdCBkdG9yLgorICAgICAgICovCisgICAgICB+Zm9yd2FyZF9saXN0KCkgbm9leGNlcHQKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRoZSAlZm9yd2FyZF9saXN0IGFzc2lnbm1lbnQgb3BlcmF0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX2xpc3QgIEEgJWZvcndhcmRfbGlzdCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgICB0eXBlcy4KKyAgICAgICAqCisgICAgICAgKiAgQWxsIHRoZSBlbGVtZW50cyBvZiBAYSBfX2xpc3QgYXJlIGNvcGllZCwgYnV0IHVubGlrZSB0aGUgY29weQorICAgICAgICogIGNvbnN0cnVjdG9yLCB0aGUgYWxsb2NhdG9yIG9iamVjdCBpcyBub3QgY29waWVkLgorICAgICAgICovCisgICAgICBmb3J3YXJkX2xpc3QmCisgICAgICBvcGVyYXRvcj0oY29uc3QgZm9yd2FyZF9saXN0JiBfX2xpc3QpOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRoZSAlZm9yd2FyZF9saXN0IG1vdmUgYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9fbGlzdCAgQSAlZm9yd2FyZF9saXN0IG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IKKyAgICAgICAqICAgICAgICAgICAgICAgIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgY29udGVudHMgb2YgQGEgX19saXN0IGFyZSBtb3ZlZCBpbnRvIHRoaXMgJWZvcndhcmRfbGlzdAorICAgICAgICogICh3aXRob3V0IGNvcHlpbmcpLiBAYSBfX2xpc3QgaXMgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkCisgICAgICAgKiAgJWZvcndhcmRfbGlzdAorICAgICAgICovCisgICAgICBmb3J3YXJkX2xpc3QmCisgICAgICBvcGVyYXRvcj0oZm9yd2FyZF9saXN0JiYgX19saXN0KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCS8vIE5COiBEUiA2NzUuCisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5zd2FwKF9fbGlzdCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRoZSAlZm9yd2FyZF9saXN0IGluaXRpYWxpemVyIGxpc3QgYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9faWwgIEFuIGluaXRpYWxpemVyX2xpc3Qgb2YgdmFsdWVfdHlwZS4KKyAgICAgICAqCisgICAgICAgKiAgUmVwbGFjZSB0aGUgY29udGVudHMgb2YgdGhlICV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YW1lIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgICB2b2lkCisgICAgICAgIGFzc2lnbihfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QpCisgICAgICAgIHsKKyAgICAgICAgICBjbGVhcigpOworICAgICAgICAgIGluc2VydF9hZnRlcihjYmVmb3JlX2JlZ2luKCksIF9fZmlyc3QsIF9fbGFzdCk7CisgICAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBc3NpZ25zIGEgZ2l2ZW4gdmFsdWUgdG8gYSAlZm9yd2FyZF9saXN0LgorICAgICAgICogIEBwYXJhbSAgX19uICBOdW1iZXIgb2YgZWxlbWVudHMgdG8gYmUgYXNzaWduZWQuCisgICAgICAgKiAgQHBhcmFtICBfX3ZhbCAgVmFsdWUgdG8gYmUgYXNzaWduZWQuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gZmlsbHMgYSAlZm9yd2FyZF9saXN0IHdpdGggQGEgX19uIGNvcGllcyBvZiB0aGUKKyAgICAgICAqICBnaXZlbiB2YWx1ZS4gIE5vdGUgdGhhdCB0aGUgYXNzaWdubWVudCBjb21wbGV0ZWx5IGNoYW5nZXMgdGhlCisgICAgICAgKiAgJWZvcndhcmRfbGlzdCwgYW5kIHRoYXQgdGhlIHJlc3VsdGluZyAlZm9yd2FyZF9saXN0IGhhcyBfX24KKyAgICAgICAqICBlbGVtZW50cy4gIE9sZCBkYXRhIGlzIGxvc3QuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIGFzc2lnbihzaXplX3R5cGUgX19uLCBjb25zdCBfVHAmIF9fdmFsKQorICAgICAgeworICAgICAgICBjbGVhcigpOworICAgICAgICBpbnNlcnRfYWZ0ZXIoY2JlZm9yZV9iZWdpbigpLCBfX24sIF9fdmFsKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBc3NpZ25zIGFuIG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ICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcih0aGlzLT5fTV9pbXBsLl9NX2hlYWQuX01fbmV4dCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgaXRlcmF0b3IgdGhhdCBwb2ludHMgb25lIHBhc3QgdGhlIGxhc3QKKyAgICAgICAqICBlbGVtZW50IGluIHRoZSAlZm9yd2FyZF9saXN0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gb3JkaW5hcnkKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGl0ZXJhdG9yKDApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgaXRlcmF0b3IgdGhhdCBwb2ludHMgb25lIHBhc3QgdGhlIGxhc3QKKyAgICAgICAqICBlbGVtZW50IGluIHRoZSAlZm9yd2FyZF9saXN0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gb3JkaW5hcnkKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2l0ZXJhdG9yKDApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUKKyAgICAgICAqICBmaXJzdCBlbGVtZW50IGluIHRoZSAlZm9yd2FyZF9saXN0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gb3Jk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eS4gIChUaHVzIGJlZ2luKCkgd291bGQKKyAgICAgICAqICBlcXVhbCBlbmQoKS4pCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGVtcHR5KCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX2ltcGwuX01faGVhZC5fTV9uZXh0ID09IDA7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyB0aGUgbGFyZ2VzdCBwb3NzaWJsZSBudW1iZXIgb2YgZWxlbWVudHMgb2YgJWZvcndhcmRfbGlzdC4KKyAgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9nZXRfTm9kZV9hbGxvY2F0b3IoKS5tYXhfc2l6ZSgpOyB9CisKKyAgICAgIC8vIDIzLjIuMy4zIGVsZW1lbnQgYWNjZXNzOgorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZWZlcmVuY2UgdG8gdGhlIGRhdGEgYXQgdGhlIGZpcnN0CisgICAgICAgKiAgZWxlbWVudCBvZiB0aGUgJWZvcndhcmRfbGlzdC4KKyAgICAgICAqLworICAgICAgcmVmZXJlbmNlCisgICAgICBmcm9udCgpCisgICAgICB7CisgICAgICAgIF9Ob2RlKiBfX2Zyb250ID0gc3RhdGljX2Nhc3Q8X05vZGUqPih0aGlzLT5fTV9pbXBsLl9NX2hlYWQuX01fbmV4dCk7CisgICAgICAgIHJldHVybiBfX2Zyb250LT5fTV92YWx1ZTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlZm9yd2FyZF9saXN0LgorICAgICAgICovCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgX05vZGUqIF9fZnJvbnQgPSBzdGF0aWNfY2FzdDxfTm9kZSo+KHRoaXMtPl9NX2ltcGwuX01faGVhZC5fTV9uZXh0KTsKKyAgICAgICAgcmV0dXJuIF9fZnJvbnQtPl9NX3ZhbHVlOworICAgICAgfQorCisgICAgICAvLyAyMy4yLjMuNCBtb2Rp76yBZXJzOgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdHMgb2JqZWN0IGluICVmb3J3YXJkX2xpc3QgYXQgdGhlIGZyb250IG9mIHRoZQorICAgICAgICogICAgICAgICAgbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fYXJncyAgQXJndW1lbnRzLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHdpbGwgaW5zZXJ0IGFuIG9iamVjdCBvZiB0eXBlIFRwIGNvbnN0cnVjdGVkCisgICAgICAgKiAgd2l0aCBUcChzdGQ6OmZvcndhcmQ8QXJncz4oYXJncykuLi4pIGF0IHRoZSBmcm9udCBvZiB0aGUgbGlzdAorICAgICAgICogIER1ZSB0byB0aGUgbmF0dXJlIG9mIGEgJWZvcndhcmRfbGlzdCB0aGlzIG9wZXJhdGlvbiBjYW4KKyAgICAgICAqICBiZSBkb25lIGluIGNvbnN0YW50IHRpbWUsIGFuZCBkb2VzIG5vdCBpbnZhbGlkYXRlIGl0ZXJhdG9ycworICAgICAgICogIGFuZCByZWZlcmVuY2VzLgorICAgICAgICovCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKyAgICAgICAgdm9pZAorICAgICAgICBlbXBsYWNlX2Zyb250KF9BcmdzJiYuLi4gX19hcmdzKQorICAgICAgICB7IHRoaXMtPl9NX2luc2VydF9hZnRlcihjYmVmb3JlX2JlZ2luKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg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B2b2lkCisgICAgICBzd2FwKGZvcndhcmRfbGlzdCYgX19saXN0KQorICAgICAgeyBzdGQ6OnN3YXAodGhpcy0+X01faW1wbC5fTV9oZWFkLl9NX25leHQsCisJCSAgX19saXN0Ll9NX2ltcGwuX01faGVhZC5fTV9uZXh0KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgUmVzaXplcyB0aGUgJWZvcndhcmRfbGlzdCB0byB0aGUgc3BlY2lmaWVkIG51bWJlciBvZgorICAgICAgICogICAgICAgICBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gX19zeiBOdW1iZXIgb2YgZWxlbWVudHMgdGhlICVmb3J3YXJkX2xpc3Qgc2hvdWxkIGNvbnRhaW4uCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gd2lsbCAlcmVzaXplIHRoZSAlZm9yd2FyZF9saXN0IHRvIHRoZSBzcGVjaWZpZWQKKyAgICAgICAqICBudW1iZXIgb2YgZWxlbWVudHMuICBJZiB0aGUgbnVtYmVyIGlzIHNtYWxsZXIgdGhhbiB0aGUKKyAgICAgICAqICAlZm9yd2FyZF9saXN0J3MgY3VycmVudCBudW1iZXIgb2YgZWxlbWVudHMgdGhlICVmb3J3YXJkX2xpc3QKKyAgICAgICAqICBpcyB0cnVuY2F0ZWQsIG90aGVyd2lzZSB0aGUgJWZvcndhcmRfbGlzdCBpcyBleHRlbmRlZCBhbmQgdGhlCisgICAgICAgKiAgbmV3IGVsZW1lbnRzIGFyZSBkZWZhdWx0IGNvbnN0cnVjdGVkLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9fc3opOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgUmVzaXplcyB0aGUgJWZvcndhcmRfbGlzdCB0byB0aGUgc3BlY2lmaWVkIG51bWJlciBvZgorICAgICAgICogICAgICAgICBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gX19zeiBOdW1iZXIg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yByZXNwb25zaWJpbGl0eS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgY2xlYXIoKSBub2V4Y2VwdAorICAgICAgeyB0aGlzLT5fTV9lcmFzZV9hZnRlcigmdGhpcy0+X01faW1wbC5fTV9oZWFkLCAwKTsgfQorCisgICAgICAvLyAyMy4yLjMuNSBmb3J3YXJkX2xpc3Qgb3BlcmF0aW9uczoKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBJbnNlcnQgY29udGVudHMgb2YgYW5vdGhlciAlZm9yd2FyZF9saXN0LgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIEl0ZXJhdG9yIHJlZmVyZW5jaW5nIHRoZSBlbGVtZW50IHRvIGluc2VydCBhZnRlci4KKyAgICAgICAqICBAcGFyYW0gIF9fbGlzdCAgU291cmNlIGxpc3QuCisgICAgICAgKgorICAgICAgICogIFRoZSBlbGVtZW50cyBvZiBAYSBsaXN0IGFyZSBpbnNlcnRlZCBpbiBjb25zdGFudCB0aW1lIGFmdGVyCisgICAgICAgKiAgdGhlIGVsZW1lbnQgcmVmZXJlbmNlZCBieSBAYSBwb3MuICBAYSBsaXN0IGJlY29tZXMgYW4gZW1wdHkKKyAgICAgICAqICBsaXN0LgorICAgICAgICoKKyAgICAgICAqICBSZXF1aXJlcyB0aGlzICE9IEBhIHguCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHNwbGljZV9hZnRlcihjb25zdF9pdGVyYXRvciBfX3BvcywgZm9yd2FyZF9saXN0JiYgX19saXN0KQorICAgICAgeworCWlmICghX19saXN0LmVtcHR5KCkpCisJICBfTV9zcGxpY2VfYWZ0ZXIoX19wb3MsIF9fbGlzdC5iZWZvcmVfYmVnaW4oKSwgX19saXN0LmVuZCgpKTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgc3BsaWNlX2FmdGVyKGNvbnN0X2l0ZXJhdG9yIF9fcG9zLCBmb3J3YXJkX2xpc3QmIF9fbGlzdCkKKyAgICA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gorICAgICAgICogIEFzc3VtZXMgdGhhdCBib3RoIEBhIF9fbGlzdCBhbmQgdGhpcyBsaXN0IGFyZSBzb3J0ZWQgYWNjb3JkaW5nIHRvCisgICAgICAgKiAgY29tcC4gIE1lcmdlcyBlbGVtZW50cyBvZiBAYSBfX2xpc3QgaW50byB0aGlzIGxpc3QKKyAgICAgICAqICBpbiBzb3J0ZWQgb3JkZXIsIGxlYXZpbmcgQGEgX19saXN0IGVtcHR5IHdoZW4gY29tcGxldGUuICBFbGVtZW50cworICAgICAgICogIGluIHRoaXMgbGlzdCBwcmVjZWRlIGVsZW1lbnRzIGluIEBhIF9fbGlzdCB0aGF0IGFyZSBlcXVpdmFsZW50CisgICAgICAgKiAgYWNjb3JkaW5nIHRvIGNvbXAoKS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0NvbXA+CisgICAgICAgIHZvaWQKKyAgICAgICAgbWVyZ2UoZm9yd2FyZF9saXN0JiYgX19saXN0LCBfQ29tcCBfX2NvbXApOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ29tcD4KKyAgICAgICAgdm9pZAorICAgICAgICBtZXJnZShmb3J3YXJkX2xpc3QmIF9fbGlzdCwgX0NvbXAgX19jb21wKQorICAgICAgICB7IG1lcmdlKHN0ZDo6bW92ZShfX2xpc3QpLCBfX2NvbXApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU29ydCB0aGUgZWxlbWVudHMgb2YgdGhlIGxpc3QuCisgICAgICAgKgorICAgICAgICogIFNvcnRzIHRoZSBlbGVtZW50cyBvZiB0aGlzIGxpc3QgaW4gTmxvZ04gdGltZS4gIEVxdWl2YWxlbnQKKyAgICAgICAqICBlbGVtZW50cyByZW1haW4gaW4gbGlzdCBvcmRlci4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgc29ydCgpCisgICAgICB7IHNvcnQoc3RkOjpsZXNzPF9UcD4oKSk7IH0KKworICAgICAgLyoqC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faGVhZDsKKyAgICAgIGZvciAoOyBfX247IC0tX19uKQorICAgICAgICB7CisgICAgICAgICAgX190by0+X01fbmV4dCA9IHRoaXMtPl9NX2NyZWF0ZV9ub2RlKCk7CisgICAgICAgICAgX190byA9IF9fdG8tPl9NX25leHQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgZm9yd2FyZF9saXN0PF9UcCwgX0FsbG9jPiYKKyAgICBmb3J3YXJkX2xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICBvcGVyYXRvcj0oY29uc3QgZm9yd2FyZF9saXN0JiBfX2xpc3QpCisgICAgeworICAgICAgaWYgKCZfX2xpc3QgIT0gdGhpcykKKyAgICAgICAgeworICAgICAgICAgIGl0ZXJhdG9yIF9fcHJldjEgPSBiZWZvcmVfYmVnaW4oKTsKKyAgICAgICAgICBpdGVyYXRvciBfX2N1cnIxID0gYmVnaW4oKTsKKyAgICAgICAgICBpdGVyYXRvciBfX2xhc3QxID0gZW5kKCk7CisgICAgICAgICAgY29uc3RfaXRlcmF0b3IgX19maXJzdDIgPSBfX2xpc3QuY2JlZ2luKCk7CisgICAgICAgICAgY29uc3RfaXRlcmF0b3IgX19sYXN0MiA9IF9fbGlzdC5jZW5kKCk7CisgICAgICAgICAgd2hpbGUgKF9fY3VycjEgIT0gX19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3QyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAqX19jdXJyMSA9ICpfX2ZpcnN0MjsKKyAgICAgICAgICAgICAgKytfX3ByZXYxOworICAgICAgICAgICAgICArK19fY3VycjE7CisgICAgICAgICAgICAgICsrX19maXJzdDI7CisgICAgICAgICAgICB9CisgICAgICAgICAgaWYgKF9fZmlyc3QyID09IF9fbGFzdDIpCisgICAgICAgICAgICBlcmFzZV9hZnRlcihfX3ByZXYxLCBfX2xhc3QxKTsKKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICBpbnNlcnRfYWZ0ZXIoX19wcmV2MSwgX19maXJzdDIsIF9fbGFzdDIpOworICAgICAgICB9CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBmb3J3YXJkX2xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICBfTV9kZWZhdWx0X2luc2VydF9hZnRlcihjb25zdF9pdGVyYXRvciBfX3Bvcywgc2l6ZV90eXBlIF9fbikKKyAgICB7CisgICAgICBjb25zdF9pdGVyYXRvciBfX3NhdmVkX3BvcyA9IF9fcG9zOworICAgICAgX190cnkKKwl7CisJICBmb3IgKDsgX19uOyAtLV9fbikKKwkgICAgX19wb3MgPSBlbXBsYWNlX2FmdGVyKF9fcG9zKTsKKwl9CisgICAgICBfX2NhdGNoKC4uLikKKwl7CisJICBlcmFzZV9hZnRlcihfX3NhdmVkX3BvcywgKytfX3Bvcyk7CisJICBfX3Rocm93X2V4Y2VwdGlvbl9hZ2FpbjsKKwl9CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBmb3J3YXJkX2xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICByZXNpemUoc2l6ZV90eXBlIF9fc3opCisgICAgeworICAgICAgaXRlcmF0b3IgX19rID0gYmVmb3JlX2JlZ2luKCk7CisKKyAgICAgIHNpemVfdHlwZSBfX2xlbiA9IDA7CisgICAgICB3aGlsZSAoX19rLl9NX25leHQoKSAhPSBlbmQoKSAmJiBfX2xlbiA8IF9fc3opCisgICAgICAgIHsKKyAgICAgICAgICArK19fazsKKyAgICAgICAgICArK19fbGVuOworICAgICAgICB9CisgICAgICBpZiAoX19sZW4gPT0gX19zeikKKyAgICAgICAgZXJhc2VfYWZ0ZXIoX19rLCBlbmQoK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xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICAgIHJlbW92ZV9pZihfUHJlZCBfX3ByZWQpCisgICAgICB7CisJX05vZGUqIF9fY3VyciA9IHN0YXRpY19jYXN0PF9Ob2RlKj4oJnRoaXMtPl9NX2ltcGwuX01faGVhZCk7CisgICAgICAgIHdoaWxlIChfTm9kZSogX190bXAgPSBzdGF0aWNfY2FzdDxfTm9kZSo+KF9fY3Vyci0+X01fbmV4dCkpCisgICAgICAgICAgeworICAgICAgICAgICAgaWYgKF9fcHJlZChfX3RtcC0+X01fdmFsdWUpKQorICAgICAgICAgICAgICB0aGlzLT5fTV9lcmFzZV9hZnRlcihfX2N1cnIpOworICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICBfX2N1cnIgPSBzdGF0aWNfY2FzdDxfTm9kZSo+KF9fY3Vyci0+X01fbmV4dCk7CisgICAgICAgICAgfQorICAgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9CaW5QcmVkPgorICAgICAgdm9pZAorICAgICAgZm9yd2FyZF9saXN0PF9UcCwgX0FsbG9jPjo6CisgICAgICB1bmlxdWUoX0JpblByZWQgX19iaW5hcnlfcHJlZCkKKyAgICAgIHsKKyAgICAgICAgaXRlcmF0b3IgX19maXJzdCA9IGJlZ2luKCk7CisgICAgICAgIGl0ZXJhdG9yIF9fbGFzdCA9IGVuZCgpOworICAgICAgICBpZiAoX19maXJzdCA9PSBfX2xhc3QpCisgICAgICAgICAgcmV0dXJuOworICAgICAgICBpdGVyYXRvciBfX25leHQgPSBfX2ZpcnN0OworICAgICAgICB3aGlsZSAoKytfX25leHQgIT0gX19sYXN0KQorICAgICAgICB7CisgICAgICAgICAgaWYgKF9fYmluYXJ5X3ByZWQoKl9fZmlyc3QsICpfX25leHQpKQorICAgICAgICAgICAgZXJhc2VfYWZ0ZXIoX19maXJzdCk7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgX19maXJzdCA9IF9fbmV4dDsKKyAgICAgICAgICBfX25leHQgPSBfX2ZpcnN0OworICAgICAgICB9CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0NvbXA+CisgICAgICB2b2lkCisgICAgICBmb3J3YXJkX2xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICAgIG1lcmdlKGZvcndhcmRfbGlzdCYmIF9fbGlzdCwgX0NvbXAgX19jb21wKQorICAgICAgeworICAgICAgICBfTm9kZV9iYXNlKiBfX25vZGUgPSAmdGhpcy0+X01faW1wbC5fTV9oZWFkOworICAgICAgICB3aGlsZSAoX19ub2RlLT5fTV9uZXh0ICYmIF9fbGlzdC5fTV9pbXBsLl9NX2hlYWQuX01fbmV4dCkKKyAgICAgICAgICB7CisgICAgICAgICAgICBpZiAoX19jb21wKHN0YXRpY19jYXN0PF9Ob2RlKj4KKyAgICAgICAgICAgICAgICAgICAgICAgKF9fbGlzdC5fTV9pbXBsLl9NX2hlYWQuX01fbmV4dCktPl9NX3ZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxfTm9kZSo+CisgICAgICAgICAgICAgICAgICAgICAgIChfX25vZGUtPl9NX25leHQpLT5fTV92YWx1ZSkpCisgICAgICAgICAgICAgIF9fbm9kZS0+X01fdHJhbnNmZXJfYWZ0ZXIoJl9fbGlzdC5fTV9pbXBsLl9NX2hlYWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19saXN0Ll9NX2ltcGwuX01faGVhZC5fTV9uZXh0KTsKKyAgICAgICAgICAgIF9fbm9kZSA9IF9fbm9kZS0+X01fbmV4dDsKKyAgICAgICAgICB9CisgICAgICAgIGlmIChfX2xpc3QuX01faW1wbC5fTV9oZWFkLl9NX25leHQpCisgICAgICAgICAgeworICAgICAgICAgICAgX19ub2RlLT5fTV9uZXh0ID0gX19saXN0Ll9NX2ltcGwuX01faGVhZC5fTV9uZXh0OworICAgICAgICAgICAgX19saXN0Ll9NX2ltcGwuX01faGVhZC5fTV9uZXh0ID0gMDsKKyAgICAgICAgICB9CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgYm9vbAorICAgIG9wZXJhdG9yPT0oY29uc3QgZm9yd2FyZF9saXN0PF9UcCwgX0FsbG9jPiYgX19seCwKKyAgICAgICAgICAgICAgIGNvbnN0IGZvcndhcmRfbGlzdDxfVHAsIF9BbGxvYz4mIF9fbHkpCisgICAgeworICAgICAgLy8gIFdlIGRvbid0IGhhdmUgc2l6ZSgpIHNvIHdlIG5lZWQgdG8gd2FsayB0aHJvdWdoIGJvdGggbGlzdHMKKyAgICAgIC8vICBtYWtpbmcgc3VyZSBib3RoIGl0ZXJhdG9ycyBhcmUgdmFsaWQuCisgICAgICBhdXRvIF9faXggPSBfX2x4LmNiZWdpbigpOworICAgICAgYXV0byBfX2l5ID0gX19seS5jYmVnaW4oKTsKKyAgICAgIHdoaWxlIChfX2l4ICE9IF9fbHguY2VuZCgpICYmIF9faXkgIT0gX19seS5jZW5kKCkpCisgICAgICAgIHsKKyAgICAgICAgICBpZiAoKl9faXggIT0gKl9faXkpCisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgKytfX2l4OworICAgICAgICAgICsrX19peTsKKyAgICAgICAgfQorICAgICAgaWYgKF9faXggPT0gX19seC5jZW5kKCkgJiYgX19peSA9PSBfX2x5LmNlbmQoKSkKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICBlbHNlCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBjbGFzcyBfQWxsb2M+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0NvbXA+CisgICAgICB2b2lkCisgICAgICBmb3J3YXJkX2xpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICAgIHNvcnQoX0NvbXAgX19jb21wKQorICAgICAgeworICAgICAgICAvLyBJZiBgbmV4dCcgaXMgMCwgcmV0dXJuIGltbWVkaWF0ZWx5LgorICAgICAgICBfTm9kZSogX19saXN0ID0gc3RhdGljX2Nhc3Q8X05vZGUqPih0aGlzLT5fTV9pbXBsLl9NX2hlYWQuX01fbmV4dCk7CisgICAgICAgIGlmICghX19saXN0KQorICAgICAgICAgIHJldHVybjsKKworICAgICAgICB1bnNpZ25lZCBsb25nIF9faW5zaXplID0gMTsKKworICAgICAgICB3aGlsZSAoMSkKKyAgICAgICAgICB7CisgICAgICAgICAgICBfTm9kZSogX19wID0gX19saXN0OworICAgICAgICAgICAgX19saXN0ID0gMDsKKyAgICAgICAgICAgIF9Ob2RlKiBfX3RhaWwgPSAwOworCisgICAgICAgICAgICAvLyBDb3VudCBudW1iZXIgb2YgbWVyZ2VzIHdlIGRvIGluIHRoaXMgcGFzcy4KKyAgICAgICAgICAgIHVuc2lnbmVkIGxvbmcgX19ubWVyZ2VzID0gMDsKKworICAgICAgICAgICAgd2hpbGUgKF9fcCkKKyAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICsrX19ubWVyZ2VzOworICAgICAgICAgICAgICAgIC8vIFRoZXJlIGV4aXN0cyBhIG1lcmdlIHRvIGJlIGRvbmUuCisgICAgICAgICAgICAgICAgLy8gU3RlcCBgaW5zaXplJyBwbGFjZXMgYWxvbmcgZnJvbSBwLgorICAgICAgICAgICAgICAgIF9Ob2RlKiBfX3EgPSBfX3A7CisgICAgICAgICAgICAgICAgdW5zaWduZWQgbG9uZyBfX3BzaXplID0gMDsKKyAgICAgICAgICAgICAgICBmb3IgKHVuc2lnbmVkIGxvbmcgX19pID0gMDsgX19pIDwgX19pbnNpemU7ICsrX19pKQorICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICArK19fcHNpemU7CisgICAgICAgICAgICAgICAgICAgIF9fcSA9IHN0YXRpY19jYXN0PF9Ob2RlKj4oX19xLT5fTV9uZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFfX3EpCisgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBJZiBxIGhhc24ndCBmYWxsZW4gb2ZmIGVuZCwgd2UgaGF2ZSB0d28gbGlzdHMgdG8gbWVyZ2UuCisgICAgICAgICAgICAgICAgdW5zaWduZWQgbG9uZyBfX3FzaXplID0gX19pbnNpemU7CisKKyAgICAgICAgICAgICAgICAvLyBOb3cgd2UgaGF2ZSB0d28gbGlzdHM7IG1lcmdlIHRoZW0uCisgICAgICAgICAgICAgICAgd2hpbGUgKF9fcHNpemUgPiAwIHx8IChfX3FzaXplID4gMCAmJiBfX3EpKQorICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAvLyBEZWNpZGUgd2hldGhlciBuZXh0IG5vZGUgb2YgbWVyZ2UgY29tZXMgZnJvbSBwIG9yIHEuCisgICAgICAgICAgICAgICAgICAgIF9Ob2RlKiBfX2U7CisgICAgICAgICAgICAgICAgICAgIGlmIChfX3BzaXplID09IDApCisgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gcCBpcyBlbXB0eTsgZSBtdXN0IGNvbWUgZnJvbSBxLgorICAgICAgICAgICAgICAgICAgICAgICAgX19lID0gX19xOworICAgICAgICAgICAgICAgICAgICAgICAgX19xID0gc3RhdGljX2Nhc3Q8X05vZGUqPihfX3EtPl9NX25leHQpOworICAgICAgICAgICAgICAgICAgICAgICAgLS1fX3FzaXplOworICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoX19xc2l6ZSA9PSAwIHx8ICFfX3EpCisgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gcSBpcyBlbXB0eTsgZSBtdXN0IGNvbWUgZnJvbSBwLgorICAgICAgICAgICAgICAgICAgICAgICAgX19lID0gX19wOworICAgICAgICAgICAgICAgICAgICAgICAgX19wID0gc3RhdGljX2Nhc3Q8X05vZGUqPihfX3AtPl9NX25leHQpOworICAgICAgICAgICAgICAgICAgICAgICAgLS1fX3BzaXplOworICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoX19jb21wKF9fcC0+X01fdmFsdWUsIF9fcS0+X01fdmFsdWUpKQorICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZpcnN0IG5vZGUgb2YgcCBpcyBsb3dlcjsgZSBtdXN0IGNvbWUgZnJvbSBwLgorICAgICAgICAgICAgICAgICAgICAgICAgX19lID0gX19wOworICAgICAgICAgICAgICAgICAgICAgICAgX19wID0gc3RhdGljX2Nhc3Q8X05vZGUqPihfX3AtPl9NX25leHQpOworICAgICAgICAgICAgICAgICAgICAgICAgLS1fX3BzaXplOworICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZpcnN0IG5vZGUgb2YgcSBpcyBsb3dlcjsgZSBtdXN0IGNvbWUgZnJvbSBxLgorICAgICAgICAgICAgICAgICAgICAgICAgX19lID0gX19xOworICAgICAgICAgICAgICAgICAgICAgICAgX19xID0gc3RhdGljX2Nhc3Q8X05vZGUqPihfX3EtPl9NX25leHQpOworICAgICAgICAgICAgICAgICAgICAgICAgLS1fX3FzaXplOworICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBBZGQgdGhlIG5leHQgbm9kZSB0byB0aGUgbWVyZ2VkIGxpc3QuCisgICAgICAgICAgICAgICAgICAgIGlmIChfX3RhaWwpCisgICAgICAgICAgICAgICAgICAgICAgX190YWlsLT5fTV9uZXh0ID0gX19lOworICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgX19saXN0ID0gX19lOworICAgICAgICAgICAgICAgICAgICBfX3RhaWwgPSBfX2U7CisgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBOb3cgcCBoYXMgc3RlcHBlZCBgaW5zaXplJyBwbGFjZXMgYWxvbmcsIGFuZCBxIGhhcyB0b28uCisgICAgICAgICAgICAgICAgX19wID0gX19xOworICAgICAgICAgICAgICB9CisgICAgICAgICAgICBfX3RhaWwtPl9NX25leHQgPSAwOworCisgICAgICAgICAgICAvLyBJZiB3ZSBoYXZlIGRvbmUgb25seSBvbmUgbWVyZ2UsIHdlJ3JlIGZpbmlzaGVkLgorICAgICAgICAgICAgLy8gQWxsb3cgZm9yIG5tZXJnZXMgPT0gMCwgdGhlIGVtcHR5IGxpc3QgY2FzZS4KKyAgICAgICAgICAgIGlmIChfX25tZXJnZXMgPD0gMSkKKyAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHRoaXMtPl9NX2ltcGwuX01faGVhZC5fTV9uZXh0ID0gX19saXN0OworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBPdGhlcndpc2UgcmVwZWF0LCBtZXJnaW5nIGxpc3RzIHR3aWNlIHRoZSBzaXplLgorICAgICAgICAgICAgX19pbnNpemUgKj0gMjsKKyAgICAgICAgICB9CisgICAgICB9CisgCitfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX0NPTlRBSU5FUgorfSAvLyBuYW1lc3BhY2Ugc3RkCisKKyNlbmRpZiAvKiBfRk9SV0FSRF9MSVNUX1RDQyAqLworCmRpZmYgLS1naXQgYS84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL2JpdHMvZnN0cmVhbS50Y2MgYi84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kuCisgICAgICBjb25zdCBib29sIF9fdGVzdGluID0gX01fbW9kZSAmIGlvc19iYXNlOjppbjsKKyAgICAgIGNvbnN0IHN0cmVhbXNpemUgX19idWZsZW4gPSBfTV9idWZfc2l6ZSA+IDEgPyBfTV9idWZfc2l6ZSAtIDEgOiAxOworIAorICAgICAgaWYgKF9fbiA+IF9fYnVmbGVuICYmIF9fY2hlY2tfZmFjZXQoX01fY29kZWN2dCkuYWx3YXlzX25vY29udigpCisgCSAgICYmIF9fdGVzdGluKQorIAkgeworIAkgICAvLyBGaXJzdCwgY29weSB0aGUgY2hhcnMgYWxyZWFkeSBwcmVzZW50IGluIHRoZSBidWZmZXIuCisgCSAgIGNvbnN0IHN0cmVhbXNpemUgX19hdmFpbCA9IHRoaXMtPmVncHRyKCkgLSB0aGlzLT5ncHRyKCk7CisgCSAgIGlmIChfX2F2YWlsICE9IDApCisgCSAgICAgeworCSAgICAgICB0cmFpdHNfdHlwZTo6Y29weShfX3MsIHRoaXMtPmdwdHIoKSwgX19hdmFpbCk7CisgCSAgICAgICBfX3MgKz0gX19hdmFpbDsKKwkgICAgICAgdGhpcy0+c2V0Zyh0aGlzLT5lYmFjaygpLCB0aGlzLT5ncHRyKCkgKyBfX2F2YWlsLAorCQkJICB0aGlzLT5lZ3B0cigpKTsKKwkgICAgICAgX19yZXQgKz0gX19hdmFpbDsKKwkgICAgICAgX19uIC09IF9fYXZhaWw7CisgCSAgICAgfQorIAorIAkgICAvLyBOZWVkIHRvIGxvb3AgaW4gY2FzZSBvZiBzaG9ydCByZWFkcyAocmVsYXRpdmVseSBjb21tb24KKyAJICAgLy8gd2l0aCBwaXBlcykuCisgCSAgIHN0cmVhbXNpemUgX19sZW47CisgCSAgIGZvciAoOzspCisgCSAgICAgeworIAkgICAgICAgX19sZW4gPSBfTV9maWxlLnhzZ2V0bihyZWludGVycHJldF9jYXN0PGNoYXIqPihfX3MpLAorIAkJCQkgICAgICBfX24pOworIAkgICAgICAgaWYgKF9fbGVuID09IC0xKQorIAkJIF9fdGhyb3dfaW9zX2ZhaWx1cmUoX19OKCJiYXNpY19maWxlYnVmOjp4c2dldG4gIgorIAkJCQkJICJlcnJvciByZWFkaW5nIHRoZSBmaWxlIikpOworIAkgICAgICAgaWYgKF9fbGVuID09IDApCisgCQkgYnJlYWs7CisgCisgCSAgICAgICBfX24gLT0gX19sZW47CisgCSAgICAgICBfX3JldCArPSBfX2xlbjsKKyAJICAgICAgIGlmIChfX24gPT0gMCkKKyAJCSBicmVhazsKKyAKKyAJICAgICAgIF9fcyArPSBfX2xlbjsKKyAJICAgICB9CisgCisgCSAgIGlmIChfX24gPT0gMCkKKyAJICAgICB7CisgCSAgICAgICBfTV9zZXRfYnVmZmVyKDApOworIAkgICAgICAgX01fcmVhZGluZyA9IHRydWU7CisgCSAgICAgfQorIAkgICBlbHNlIGlmIChfX2xlbiA9PSAwKQorIAkgICAgIHsKKyAJICAgICAgIC8vIElmIGVuZCBvZiBmaWxlIGlzIHJlYWNoZWQsIHNldCAndW5jb21taXR0ZWQnCisgCSAgICAgICAvLyBtb2RlLCB0aHVzIGFsbG93aW5nIGFuIGltbWVkaWF0ZSB3cml0ZSB3aXRob3V0CisgCSAgICAgICAvLyBhbiBpbnRlcnZlbmluZyBzZWVrLgorIAkgICAgICAgX01fc2V0X2J1ZmZlcigtMSk7CisgCSAgICAgICBfTV9yZWFkaW5nID0gZmFsc2U7CisgCSAgICAgfQorIAkgfQorICAgICAgZWxzZQorIAkgX19yZXQgKz0gX19zdHJlYW1idWZfdHlwZTo6eHNnZXRuKF9fcywgX19uKTsKKyAKKyAgICAgIHJldHVybiBfX3JldDsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorICAgIHN0cmVhbXNpemUKKyAgICBiYXNpY19maWxlYnVmPF9DaGFyVCwgX1RyYWl0cz46OgorICAgIHhzcHV0bihjb25zdCBfQ2hhclQqIF9fcywgc3RyZWFtc2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RwKiBfX3ApIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiByZWludGVycHJldF9jYXN0PHNpemVfdD4oX19wKTsgfQorICAgIH07CisKKyAgLy8gRXhwbGljaXQgc3BlY2lhbGl6YXRpb25zIGZvciBpbnRlZ2VyIHR5cGVzLgorI2RlZmluZSBfQ3h4X2hhc2h0YWJsZV9kZWZpbmVfdHJpdmlhbF9oYXNoKF9UcCkgCVwKKyAgdGVtcGxhdGU8PgkJCQkJCVwKKyAgICBzdHJ1Y3QgaGFzaDxfVHA+IDogcHVibGljIF9faGFzaF9iYXNlPHNpemVfdCwgX1RwPiAgXAorICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICBzaXplX3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIG9wZXJhdG9yKCkoX1RwIF9fdmFsKSBjb25zdCBub2V4Y2VwdCAgICAgICAgICAgICAgXAorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8c2l6ZV90PihfX3ZhbCk7IH0gICAgICAgICAgICBcCisgICAgfTsKKworICAvLy8gRXhwbGljaXQgc3BlY2lhbGl6YXRpb24gZm9yIGJvb2wuCisgIF9DeHhfaGFzaHRhYmxlX2RlZmluZV90cml2aWFsX2hhc2goYm9vbCkKKworICAvLy8gRXhwbGljaXQgc3BlY2lhbGl6YXRpb24gZm9yIGNoYXIuCisgIF9DeHhfaGFzaHRhYmxlX2RlZmluZV90cml2aWFsX2hhc2goY2hhcikKKworICAvLy8gRXhwbGljaXQgc3BlY2lhbGl6YXRpb24gZm9yIHNpZ25lZCBjaGFyLgorICBfQ3h4X2hhc2h0YWJsZV9kZWZpbmVfdHJpdmlhbF9oYXNoKHNpZ25lZCBjaGFyKQorCisgIC8vLyBFeHBsaWNpdCBzcGVjaWFsaXphdGlvbiBmb3IgdW5zaWduZWQgY2hhci4KKyAgX0N4eF9oYXNodG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Xk8c2l6ZV90PiBfTV9pbmRleDsgLy8gTGluZWFyIGFycmF5IG9mIHJlZmVyZW5jZWQgaW5kaWNlcworCisgICAgICBfSW5kZXhlcigpCisgICAgICA6IF9NX2NvdW50KDEpLCBfTV9zdGFydCgwKSwgX01fc2l6ZSgpLCBfTV9zdHJpZGUoKSwgX01faW5kZXgoKSB7fQorCisgICAgICBfSW5kZXhlcihzaXplX3QsIGNvbnN0IHZhbGFycmF5PHNpemVfdD4mLAorCSAgICAgICBjb25zdCB2YWxhcnJheTxzaXplX3Q+Jik7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2luY3JlbWVudF91c2UoKQorICAgICAgeyArK19NX2NvdW50OyB9CisgICAgICAKKyAgICAgIHNpemVfdAorICAgICAgX01fZGVjcmVtZW50X3VzZSgpCisgICAgICB7IHJldHVybiAtLV9NX2NvdW50OyB9CisgICAgfTsKKworICAgIF9JbmRleGVyKiBfTV9pbmRleDsKKworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gZnJpZW5kIGNsYXNzIHZhbGFycmF5OworICB9OworCisgIGlubGluZSBzaXplX3QKKyAgZ3NsaWNlOjpzdGFydCgpIGNvbnN0CisgIHsgcmV0dXJuIF9NX2luZGV4ID8gX01faW5kZXgtPl9NX3N0YXJ0IDogMDsgfQorCisgIGlubGluZSB2YWxhcnJheTxzaXplX3Q+CisgIGdzbGljZTo6c2l6ZSgpIGNvbnN0CisgIHsgcmV0dXJuIF9NX2luZGV4ID8gX01faW5kZXgtPl9NX3NpemUgOiB2YWxhcnJheTxzaXplX3Q+KCk7IH0KKworICBpbmxpbmUgdmFsYXJyYXk8c2l6ZV90PgorICBnc2xpY2U6OnN0cmlkZSgpIGNvbnN0CisgIHsgcmV0dXJuIF9NX2luZGV4ID8gX01faW5kZXgtPl9NX3N0cmlkZSA6IHZhbGFycmF5PHNpemVfdD4oKTsgfQorCisgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgLy8gN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hc3NlcnQoX19pZl9oYXNoX2NvZGVfbm90X2NhY2hlZDxpc19lbXB0eTxfSENCYXNlPj46OnZhbHVlLAorCSAgICAiQ2FjaGUgdGhlIGhhc2ggY29kZSBvciBtYWtlIGZ1bmN0b3JzIGludm9sdmVkIGluIGhhc2ggY29kZSIKKwkgICAgIiBhbmQgYnVja2V0IGluZGV4IGNvbXB1dGF0aW9uIGVtcHR5Iik7CisKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9BbGxvY2F0b3IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIF9WYWx1ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0tleSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0VxdWFsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfZXF1YWw7CisgICAgICAvLyBtYXBwZWRfdHlwZSwgaWYgcHJlc2VudCwgY29tZXMgZnJvbSBfTWFwX2Jhc2UuCisgICAgICAvLyBoYXNoZXIsIGlmIHByZXNlbnQsIGNvbWVzIGZyb20gX0hhc2hfY29kZV9iYXNlLgorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQWxsb2NhdG9yOjpwb2ludGVyICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OmNvbnN0X3BvaW50ZXIgICAgICAgICAgY29uc3RfcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jYXRvcjo6cmVmZXJlbmNlICAgICAgICAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OmNvbnN0X3JlZmVyZW5j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dXJuIGFsbG9jYXRvcl90eXBlKF9NX25vZGVfYWxsb2NhdG9yKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9zaXplKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX25vZGVfYWxsb2NhdG9yLm1heF9zaXplKCk7IH0KKworICAgICAgLy8gT2JzZXJ2ZXJzCisgICAgICBrZXlfZXF1YWwKKyAgICAgIGtleV9lcSgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9lcSgpOyB9CisKKyAgICAgIC8vIGhhc2hfZnVuY3Rpb24sIGlmIHByZXNlbnQsIGNvbWVzIGZyb20gX0hhc2hfY29kZV9iYXNlLgorCisgICAgICAvLyBCdWNrZXQgb3BlcmF0aW9ucworICAgICAgc2l6ZV90eXBlCisgICAgICBidWNrZXRfY291bnQoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fYnVja2V0X2NvdW50OyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X2J1Y2tldF9jb3VudCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBtYXhfc2l6ZSgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0X3NpemUoc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIHN0ZDo6ZGlzdGFuY2UoYmVnaW4oX19uKSwgZW5kKF9fbikpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0KGNvbnN0IGtleV90eXBlJiBfX2spIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9idWNrZXRfaW5kZXgoX19rLCB0aGlzLT5fTV9oYXNoX2NvZGUoX19rKSk7IH0KKworICAgICAgbG9jYWxfaXRlcmF0b3IKKyAgICAgIGJlZ2luKHNpemVfdHlwZSBfX24pCisgICAgICB7IHJldHVybiBsb2NhbF9pdGVyYXRvcihfTV9idWNrZXRfYmVnaW4oX19uKSwgX19uLAorCQkJICAgICAgX01fYnVja2V0X2NvdW50KTsgfQorCisgICAgICBsb2NhbF9pdGVyYXRvcgorICAgICAgZW5kKHNpemVfdHlwZSBfX24pCisgICAgICB7IHJldHVybiBsb2NhbF9pdGVyYXRvcihudWxscHRyLCBfX24sIF9NX2J1Y2tldF9jb3VudCk7IH0KKworICAgICAgY29uc3RfbG9jYWxfaXRlcmF0b3IKKyAgICAgIGJlZ2luKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9sb2NhbF9pdGVyYXRvcihfTV9idWNrZXRfYmVnaW4oX19uKSwgX19uLAorCQkJCSAgICBfTV9idWNrZXRfY291bnQpOyB9CisKKyAgICAgIGNvbnN0X2xvY2FsX2l0ZXJhdG9yCisgICAgICBlbmQoc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2xvY2FsX2l0ZXJhdG9yKG51bGxwdHIsIF9fbiwgX01fYnVja2V0X2NvdW50KTsgfQorCisgICAgICAvLyBEUiA2OTEuCisgICAgICBjb25zdF9sb2NhbF9pdGVyYXRvcgorICAgICAgY2JlZ2luKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9sb2NhbF9pdGVyYXRvcihfTV9idWNrZXRfYmVnaW4oX19uKSwgX19uLAorCQkJCSAgICBfTV9idWNrZXRfY291bnQpOyB9CisKKyAgICAgIGNvbnN0X2xvY2FsX2l0ZXJhdG9yCisgICAgICBjZW5kKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9sb2NhbF9pdGVyYXRvcihudWxscHRyLCBfX24sIF9NX2J1Y2tldF9jb3VudCk7IH0KKworICAgICAgZmxvYXQKKyAgICAgIGxvYWRfZmFjdG9yKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsKKwlyZXR1cm4gc3RhdGljX2Nhc3Q8ZmxvYXQ+KHNpemUoKSkgLyBzdGF0aWNfY2FzdDxmbG9hdD4oYnVja2V0X2NvdW50KCkpOworICAgICAgfQorCisgICAgICAvLyBtYXhfbG9hZF9mYWN0b3IsIGlmIHByZXNlbnQsIGNvbWVzIGZyb20gX1JlaGFzaF9iYXNlLgorCisgICAgICAvLyBHZW5lcmFsaXphdGlvbiBvZiBtYXhfbG9hZF9mYWN0b3IuICBFeHRlbnNpb24sIG5vdCBmb3VuZCBpbiBUUjEuICBPbmx5CisgICAgICAvLyB1c2VmdWwgaWYgX1JlaGFzaFBvbGljeSBpcyBzb21ldGhpbmcgb3RoZXIgdGhhbiB0aGUgZGVmYXVsdC4KKyAgICAgIGNvbnN0IF9SZWhhc2hQb2xpY3kmCisgICAgICBfX3JlaGFzaF9wb2xpY3koKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcmVoYXNoX3BvbGljeTsgfQorCisgICAgICB2b2lkCisgICAgICBfX3JlaGFzaF9wb2xpY3koY29uc3QgX1JlaGFzaFBvbGljeSYpOworCisgICAgICAvLyBMb29rdXAuCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rKTsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHlwZSYgX19rKTsKKworICAgICAgc3RkOjpwYWlyPGNvbnN0X2l0ZXJhdG9yLCBjb25zdF9pdGVyYXRvcj4KKyAgICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2spIGNvbnN0OworCisgICAgcHJpdmF0ZToKKyAgICAgIC8vIEJ1Y2tldCBpbmRleCBjb21wdXRhdGlvbiB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9NX2J1Y2tldHMgPSBfTV9hbGxvY2F0ZV9idWNrZXRzKF9NX2J1Y2tldF9jb3VudCk7CisgICAgICBfX3RyeQorCXsKKwkgIGlmICghX19odC5fTV9iZWZvcmVfYmVnaW4uX01fbnh0KQorCSAgICByZXR1cm47CisKKwkgIC8vIEZpcnN0IGRlYWwgd2l0aCB0aGUgc3BlY2lhbCBmaXJzdCBub2RlIHBvaW50ZWQgdG8gYnkKKwkgIC8vIF9NX2JlZm9yZV9iZWdpbi4KKwkgIGNvbnN0IF9Ob2RlKiBfX2h0X24gPSBfX2h0Ll9NX2JlZ2luKCk7CisJICBfTm9kZSogX190aGlzX24gPSBfTV9hbGxvY2F0ZV9ub2RlKF9faHRfbi0+X01fdik7CisJICB0aGlzLT5fTV9jb3B5X2NvZGUoX190aGlzX24sIF9faHRfbik7CisJICBfTV9iZWZvcmVfYmVnaW4uX01fbnh0ID0gX190aGlzX247CisJICBfTV9idWNrZXRzW19NX2J1Y2tldF9pbmRleChfX3RoaXNfbildID0gJl9NX2JlZm9yZV9iZWdpbjsKKworCSAgLy8gVGhlbiBkZWFsIHdpdGggb3RoZXIgbm9kZXMuCisJICBfQmFzZU5vZGUqIF9fcHJldl9uID0gX190aGlzX247CisJICBmb3IgKF9faHRfbiA9IF9faHRfbi0+X01fbmV4dCgpOyBfX2h0X247IF9faHRfbiA9IF9faHRfbi0+X01fbmV4dCgpKQorCSAgICB7CisJICAgICAgX190aGlzX24gPSBfTV9hbGxvY2F0ZV9ub2RlKF9faHRfbi0+X01fdik7CisJICAgICAgX19wcmV2X24tPl9NX254dCA9IF9fdGhpc19uOworCSAgICAgIHRoaXMtPl9NX2NvcHlfY29kZShfX3RoaXNfbiwgX19odF9uKTsKKwkgICAgICBzaXplX3R5cGUgX19ia3QgPSBfTV9idWNrZXRfaW5kZXgoX190aGlzX24pOworCSAgICAgIGlmICghX01fYnVja2V0c1tfX2JrdF0pCisJCV9NX2J1Y2tldHNbX19ia3RdID0gX19wcmV2X247CisJ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IF9NX25vZGVfYWxsb2NhdG9yKHN0ZDo6bW92ZShfX2h0Ll9NX25vZGVfYWxsb2NhdG9yKSksCisgICAgICBfTV9idWNrZXRzKF9faHQuX01fYnVja2V0cyksCisgICAgICBfTV9idWNrZXRfY291bnQoX19odC5fTV9idWNrZXRfY291bnQpLAorICAgICAgX01fYmVmb3JlX2JlZ2luKF9faHQuX01fYmVmb3JlX2JlZ2luLl9NX254dCksCisgICAgICBfTV9lbGVtZW50X2NvdW50KF9faHQuX01fZWxlbWVudF9jb3VudCksCisgICAgICBfTV9yZWhhc2hfcG9saWN5KF9faHQuX01fcmVoYXNoX3BvbGljeSkKKyAgICB7CisgICAgICAvLyBVcGRhdGUsIGlmIG5lY2Vzc2FyeSwgYnVja2V0IHBvaW50aW5nIHRvIGJlZm9yZSBiZWdpbiB0aGF0IGhhc24ndCBtb3ZlLgorICAgICAgaWYgKF9NX2JlZ2luKCkpCisJX01fYnVja2V0c1tfTV9idWNrZXRfaW5kZXgoX01fYmVnaW4oKSldID0gJl9NX2JlZm9yZV9iZWdpbjsKKyAgICAgIF9faHQuX01fcmVoYXNoX3BvbGljeSA9IF9SZWhhc2hQb2xpY3koKTsKKyAgICAgIF9faHQuX01fYnVja2V0X2NvdW50ID0gX19odC5fTV9yZWhhc2hfcG9saWN5Ll9NX25leHRfYmt0KDApOworICAgICAgX19odC5fTV9idWNrZXRzID0gX19odC5fTV9hbGxvY2F0ZV9idWNrZXRzKF9faHQuX01fYnVja2V0X2NvdW50KTsKKyAgICAgIF9faHQuX01fYmVmb3JlX2JlZ2luLl9NX254dCA9IG51bGxwdHI7CisgICAgICBfX2h0Ll9NX2VsZW1lbnRfY291bnQgPSAwOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfS2V5LCB0eXBlbmFtZSBfVmFsdWUsCisJICAgdHlwZW5hbWUgX0FsbG9jYXRvciwgdHlwZW5hbWUgX0V4dHJhY3RLZXksIHR5cGVuYW1lIF9FcXVhbCwKKwkgIC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oaXMtPl9NX2N1ci0+X01fdik7IH0KKworICAgICAgX05vZGVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwl0aGlzLT5fTV9pbmNyKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfTm9kZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgICB7CisJX05vZGVfaXRlcmF0b3IgX190bXAoKnRoaXMpOworCXRoaXMtPl9NX2luY3IoKTsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisgICAgfTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVmFsdWUsIGJvb2wgX19jb25zdGFudF9pdGVyYXRvcnMsIGJvb2wgX19jYWNoZT4KKyAgICBzdHJ1Y3QgX05vZGVfY29uc3RfaXRlcmF0b3IKKyAgICA6IHB1YmxpYyBfTm9kZV9pdGVyYXRvcl9iYXNlPF9WYWx1ZSwgX19jYWNoZT4KKyAgICB7CisgICAgICB0eXBlZGVmIF9WYWx1ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgY29uc3QgX1ZhbHVlKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCBfVmFsdWUmICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIHN0ZDo6Zm9yd2FyZF9pdGVyYXRvcl90YWcgICAgICAgICAgICAgICAgaXRlcmF0b3JfY2F0ZWdvcnk7CisKKyAgICAgIF9Ob2RlX2NvbnN0X2l0ZXJhdG9yKCkKKyAgICAgIDogX05vZGVfaXRlcmF0b3JfYmFzZTxfVmFsdWUsIF9fY2FjaGU+KD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ZQorICAgICAgX01faGFzaF9jb2RlKGNvbnN0IF9LZXkmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gMDsgfQorCisgICAgICBzdGQ6OnNpemVfdAorICAgICAgX01fYnVja2V0X2luZGV4KGNvbnN0IF9LZXkmIF9faywgX0hhc2hfY29kZV90eXBlLAorCQkgICAgICBzdGQ6OnNpemVfdCBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9yYW5nZWRfaGFzaCgpKF9faywgX19uKTsgfQorCisgICAgICBzdGQ6OnNpemVfdAorICAgICAgX01fYnVja2V0X2luZGV4KGNvbnN0IF9IYXNoX25vZGU8X1ZhbHVlLCBmYWxzZT4qIF9fcCwKKwkJICAgICAgc3RkOjpzaXplX3QgX19uKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcmFuZ2VkX2hhc2goKShfTV9leHRyYWN0KCkoX19wLT5fTV92KSwgX19uKTsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9zdG9yZV9jb2RlKF9IYXNoX25vZGU8X1ZhbHVlLCBmYWxzZT4qLCBfSGFzaF9jb2RlX3R5cGUpIGNvbnN0CisgICAgICB7IH0KKworICAgICAgdm9pZAorICAgICAgX01fY29weV9jb2RlKF9IYXNoX25vZGU8X1ZhbHVlLCBmYWxzZT4qLAorCQkgICBjb25zdCBfSGFzaF9ub2RlPF9WYWx1ZSwgZmFsc2U+KikgY29uc3QKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9zd2FwKF9IYXNoX2NvZGVfYmFzZSYgX194KQorICAgICAgeworCXN0ZDo6c3dhcChfTV9leHRyYWN0KCksIF9feC5fTV9leHRyYWN0KCkpOworCXN0ZDo6c3dhcChfTV9yYW5nZWRfaGFzaCgpLCBfX3guX01fcmFuZ2VkX2hhc2goKSk7CisgICAgICB9CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICBjb25zdCBfRXh0cmFjdEtleSYKKyAgICAgIF9NX2V4dHJhY3QoKSBjb25zdC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MTsKKwkgICAgd2hpbGUgKF9fdG1wICE9IF9faXQxICYmICFib29sKCpfX3RtcCA9PSAqX19pdDEpKQorCSAgICAgICsrX190bXA7CisKKwkgICAgLy8gV2UndmUgc2VlbiB0aGlzIG9uZSBiZWZvcmUuCisJICAgIGlmIChfX3RtcCAhPSBfX2l0MSkKKwkgICAgICBjb250aW51ZTsKKworCSAgICBzdGQ6OnB0cmRpZmZfdCBfX24yID0gMDsKKwkgICAgZm9yIChfX3RtcCA9IF9fZmlyc3QyOyBfX3RtcCAhPSBfX2xhc3QyOyArK19fdG1wKQorCSAgICAgIGlmICgqX190bXAgPT0gKl9faXQxKQorCQkrK19fbjI7CisKKwkgICAgaWYgKCFfX24yKQorCSAgICAgIHJldHVybiBmYWxzZTsKKworCSAgICBzdGQ6OnB0cmRpZmZfdCBfX24xID0gMDsKKwkgICAgZm9yIChfX3RtcCA9IF9faXQxOyBfX3RtcCAhPSBfX2xhc3QxOyArK19fdG1wKQorCSAgICAgIGlmICgqX190bXAgPT0gKl9faXQxKQorCQkrK19fbjE7CisKKwkgICAgaWYgKF9fbjEgIT0gX19uMikKKwkgICAgICByZXR1cm4gZmFsc2U7CisJICB9CisJcmV0dXJuIHRydWU7CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0V4dHJhY3RLZXksIHR5cGVuYW1lIF9IYXNodGFibGU+CisgICAgYm9vbAorICAgIF9FcXVhbGl0eV9iYXNlPF9FeHRyYWN0S2V5LCBmYWxzZSwgX0hhc2h0YWJsZT46OgorICAgIF9NX2VxdWFsKGNvbnN0IF9IYXNodGFibGUmIF9fb3RoZXIpIGNvbnN0CisgICAgeworICAgICAgY29uc3QgX0hhc2h0YWJsZSogX190aGlzID0gc3RhdGljX2Nhc3Q8Y29uc3QgX0hhc2h0YWJsZSo+KHRoaXMpOworCisgICAgICBpZiAoX190aGlzLT5zaXplKCkgIT0gX19vdGhlci5zaXplKCkpCisJcmV0dXJuIGZhbHNlOworCisgICAgICBmb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2NjLmdudS5vcmcvb25saW5lZG9jcy9nY2MtNC4zLjIvZ2NjL1ZhZ3VlLUxpbmthZ2UuaHRtbAorICAgICAgdmlydHVhbAorICAgICAgfmZhaWx1cmUoKSB0aHJvdygpOworCisgICAgICB2aXJ0dWFsIGNvbnN0IGNoYXIqCisgICAgICB3aGF0KCkgY29uc3QgdGhyb3coKTsKKworICAgIHByaXZhdGU6CisgICAgICBzdHJpbmcgX01fbXNnOworICAgIH07CisKKyAgICAvLyAyNy40LjIuMS4yICBUeXBlIGlvc19iYXNlOjpmbXRmbGFncworICAgIC8qKgorICAgICAqICBAYnJpZWYgVGhpcyBpcyBhIGJpdG1hc2sgdHlwZS4KKyAgICAgKgorICAgICAqICBAYyBAYSBfSW9zX0ZtdGZsYWdzIGlzIGltcGxlbWVudGF0aW9uLWRlZmluZWQsIGJ1dCBpdCBpcyB2YWxpZCB0bworICAgICAqICBwZXJmb3JtIGJpdHdpc2Ugb3BlcmF0aW9ucyBvbiB0aGVzZSB2YWx1ZXMgYW5kIGV4cGVjdCB0aGUgUmlnaHQKKyAgICAgKiAgVGhpbmcgdG8gaGFwcGVuLiAgRGVmaW5lZCBvYmplY3RzIG9mIHR5cGUgZm10ZmxhZ3MgYXJlOgorICAgICAqICAtIGJvb2xhbHBoYQorICAgICAqICAtIGRlYworICAgICAqICAtIGZpeGVkCisgICAgICogIC0gaGV4CisgICAgICogIC0gaW50ZXJuYWwKKyAgICAgKiAgLSBsZWZ0CisgICAgICogIC0gb2N0CisgICAgICogIC0gcmlnaHQKKyAgICAgKiAgLSBzY2llbnRpZmljCisgICAgICogIC0gc2hvd2Jhc2UKKyAgICAgKiAgLSBzaG93cG9pbnQKKyAgICAgKiAgLSBzaG93cG9zCisgICAgICogIC0gc2tpcHdzCisgICAgICogIC0gdW5pdGJ1ZgorICAgICAqICAtIHVwcGVyY2FzZQorICAgICAqICAtIGFkanVzdGZpZWxkCisgICAgICogIC0gYmFzZWZpZWxkCisgICAgICogIC0gZmxvYX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ICAgaW9zdGF0ZQkJX01fZXhjZXB0aW9uOworICAgIGlvc3RhdGUJCV9NX3N0cmVhbWJ1Zl9zdGF0ZTsKKworICAgIC8vIDI3LjQuMi42ICBNZW1iZXJzIGZvciBjYWxsYmFja3MKKyAgICAvLyAyNy40LjIuNiAgaW9zX2Jhc2UgY2FsbGJhY2tzCisgICAgc3RydWN0IF9DYWxsYmFja19saXN0CisgICAgeworICAgICAgLy8gRGF0YSBNZW1iZXJzCisgICAgICBfQ2FsbGJhY2tfbGlzdCoJCV9NX25leHQ7CisgICAgICBpb3NfYmFzZTo6ZXZlbnRfY2FsbGJhY2sJX01fZm47CisgICAgICBpbnQJCQlfTV9pbmRleDsKKyAgICAgIF9BdG9taWNfd29yZAkJX01fcmVmY291bnQ7ICAvLyAwIG1lYW5zIG9uZSByZWZlcmVuY2UuCisKKyAgICAgIF9DYWxsYmFja19saXN0KGlvc19iYXNlOjpldmVudF9jYWxsYmFjayBfX2ZuLCBpbnQgX19pbmRleCwKKwkJICAgICBfQ2FsbGJhY2tfbGlzdCogX19jYikKKyAgICAgIDogX01fbmV4dChfX2NiKSwgX01fZm4oX19mbiksIF9NX2luZGV4KF9faW5kZXgpLCBfTV9yZWZjb3VudCgwKSB7IH0KKworICAgICAgdm9pZAorICAgICAgX01fYWRkX3JlZmVyZW5jZSgpIHsgX19nbnVfY3h4OjpfX2F0b21pY19hZGRfZGlzcGF0Y2goJl9NX3JlZmNvdW50LCAxKTsgfQorCisgICAgICAvLyAwID0+IE9LIHRvIGRlbGV0ZS4KKyAgICAgIGludAorICAgICAgX01fcmVtb3ZlX3JlZmVyZW5jZSgpIAorICAgICAgeworICAgICAgICAvLyBCZSByYWNlLWRldGVjdG9yLWZyaWVuZGx5LiAgRm9yIG1vcmUgaW5mbyBzZWUgYml0cy9jKytjb25maWcuCisgICAgICAgIF9HTElCQ1hYX1NZTkNIUk9OSVpBVElPTl9IQVBQRU5TX0JFRk9SRSgmX01fcmVmY291bnQpOworICAgICAgICBpbnQgX19yZXMgPSBfX2dudV9jeHg6Ol9fZXhjaGFuZ2VfYW5kX2FkZF9kaXNwYXRjaCgmX01fcmVmY291bnQsIC0xKTsKKyAgICAgICAgaWYgKF9fcmVzID09IDApCisgICAgICAgICAgeworICAgICAgICAgICAgX0dMSUJDWFhfU1lOQ0hST05JWkFUSU9OX0hBUFBFTlNfQUZURVIoJl9NX3JlZmNvdW50KTsKKyAgICAgICAgICB9CisgICAgICAgIHJldHVybiBfX3JlczsKKyAgICAgIH0KKyAgICB9OworCisgICAgIF9DYWxsYmFja19saXN0KglfTV9jYWxsYmFja3M7CisKKyAgICB2b2lkCisgICAgX01fY2FsbF9jYWxsYmFja3MoZXZlbnQgX19ldikgdGhyb3coKTsKKworICAgIHZvaWQKKyAgICBfTV9kaXNwb3NlX2NhbGxiYWNrcyh2b2lkKSB0aHJvdygpOworCisgICAgLy8gMjcuNC4yLjUgIE1lbWJlcnMgZm9yIGl3b3JkL3B3b3JkIHN0b3JhZ2UKKyAgICBzdHJ1Y3QgX1dvcmRzCisgICAgeworICAgICAgdm9pZCoJX01fcHdvcmQ7CisgICAgICBsb25nCV9NX2l3b3JkOworICAgICAgX1dvcmRzKCkgOiBfTV9wd29yZCgwKSwgX01faXdvcmQoMCkgeyB9CisgICAgfTsKKworICAgIC8vIE9ubHkgZm9yIGZhaWxlZCBpd29yZC9wd29yZCBjYWxscy4KKyAgICBfV29yZHMJCV9NX3dvcmRfemVybzsKKworICAgIC8vIEd1YXJhbnRlZWQgc3RvcmFnZS4KKyAgICAvLyBUaGUgZmlyc3QgNSBpd29yZCBhbmQgcHdvcmQgc2xvdHMgYXJlIHJlc2VydmVkIGZvciBpbnRlcm5hbCB1c2UuCisgICAgZW51bSB7IF9TX2xvY2FsX3dvcmRfc2l6ZSA9IDggfTsKKyAgICBfV29yZHMJCV9NX2xvY2FsX3dvcmRbX1NfbG9jYWxfd29yZF9zaXplXTsKKworICAgIC8vIEFsbG9jYXRlZCBzdG9yYWdlLgorICAgIGludAkJCV9NX3dvcmRfc2l6ZTsKKyAgICBfV29yZHMqCQlfTV93b3JkOworCisgICAgX1dvcmRzJgorICAgIF9NX2dyb3dfd29yZHMoaW50IF9faW5kZXgsIGJvb2wgX19pd29yZCk7CisKKyAgICAvLyBNZW1iZXJzIGZvciBsb2NhbGUgYW5kIGxvY2FsZSBjYWNoaW5nLgorICAgIGxvY2FsZQkJX01faW9zX2xvY2FsZTsKKworICAgIHZvaWQKKyAgICBfTV9pbml0KCkgdGhyb3coKTsKKworICBwdWJsaWM6CisKKyAgICAvLyAyNy40LjIuMS42ICBDbGFzcyBpb3NfYmFzZTo6SW5pdAorICAgIC8vIFVzZWQgdG8gaW5pdGlhbGl6ZSBzdGFuZGFyZCBzdHJlYW1zLiBJbiB0aGVvcnksIGcrKyBjb3VsZCB1c2UKKyAgICAvLyAtZmluaXQtcHJpb3JpdHkgdG8gb3JkZXIgdGhpcyBzdHVmZiBjb3JyZWN0bHkgd2l0aG91dCBnb2luZworICAgIC8vIHRocm91Z2ggdGhlc2UgbWFjaGluYXRpb25zLgorICAgIGNsYXNzIEluaXQKKyAgICB7CisgICAgICBmcmllbmQgY2xhc3MgaW9zX2Jhc2U7CisgICAgcHVibGljOgorICAgICAgSW5pdCgpOworICAgICAgfkluaXQoKTsKKworICAgIHByaXZhdGU6CisgICAgICBzdGF0aWMgX0F0b21pY193b3JkCV9TX3JlZmNvdW50OworICAgICAgc3RhdGljIGJvb2wJCV9TX3N5bmNlZF93aXRoX3N0ZGlvOworICAgIH07CisKKyAgICAvLyBbMjcuNC4yLjJdIGZtdGZsYWdzIHN0YXRlIGZ1bmN0aW9ucworICAgIC8qKgorICAgICAqICBAYnJpZWYgIEFjY2VzcyB0byBmb3JtYXQgZmxhZ3MuCisgICAgICogIEByZXR1cm4gIFRoZSBmb3JtYXQgY29udHJvbCBmbGFncyBmb3IgYm90aCBpbnB1dCBhbmQgb3V0cHV0LgorICAgICovCisgICAgZm10ZmxhZ3MKKyAgICBmbGFncygpIGNvbnN0CisgICAgeyByZXR1cm4gX01fZmxhZ3M7IH0KKworICAgIC8qKgorICAgICAqICBAYnJpZWYgIFNldHRpbmcgbmV3IGZvcm1hdCBmbGFncyBhbGwgYXQgb25jZS4KKyAgICAgKiAgQHBhcmFtICBfX2ZtdGZsICBUaGUgbmV3IGZsYWdzIHRvIHNldC4KKyAgICAgKiAgQHJldHVybiAgVGhlIHByZXZpb3VzIGZvcm1hdCBjb250cm9sIGZsYWdzLgorICAgICAqCisgICAgICogIFRoaXMgZnVuY3Rpb24gb3ZlcndyaXRlcyBhbGwgdGhlIGZvcm1hdCBmbGFncyB3aXRoIEBhIF9fZm10ZmwuCisgICAgKi8KKyAgICBmbXRmbGFncworICAgIGZsYWdzKGZtdGZsYWdzIF9fZm10ZmwpCisgICAgeworICAgICAgZm10ZmxhZ3MgX19vbGQgPSBfTV9mbGFnczsKKyAgICAgIF9NX2ZsYWdzID0gX19mbXRmbDsKKyAgICAgIHJldHVybiBfX29sZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiAgQGJyaWVmICBTZXR0aW5nIG5ldyBmb3JtYXQgZmxhZ3MuCisgICAgICogIEBwYXJhbSAgX19mbXRmbCAgQWRkaXRpb25hbCBmbGFncyB0byBzZXQuCisgICAgICogIEByZXR1cm4gIFRoZSBwcmV2aW91cyBmb3JtYXQgY29udHJvbCBmbGFncy4KKyAgICAgKgorICAgICAqICBUaGlzIGZ1bmN0aW9uIHNldHMgYWRkaXRpb25hbCBmbGFncyBpbiBmb3JtYXQgY29udHJvbC4gIEZsYWdzIHRoYXQKKyAgICAgKiAgd2VyZSBwcmV2aW91c2x5IHNldCByZW1haW4gc2V0LgorICAgICovCisgICAgZm10ZmxhZ3MKKyAgICBzZXRmKGZtdGZsYWdzIF9fZm10ZmwpCisgICAgeworICAgICAgZm10ZmxhZ3MgX19vbGQgPSBfTV9mbGFnczsKKyAgICAgIF9NX2ZsYWdzIHw9IF9fZm10Zmw7CisgICAgICByZXR1cm4gX19vbGQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogIEBicmllZiAgU2V0dGluZyBuZXcgZm9ybWF0IGZsYWdzLgorICAgICAqICBAcGFyYW0gIF9fZm10ZmwgIEFkZGl0aW9uYWwgZmxhZ3MgdG8gc2V0LgorICAgICAqICBAcGFyYW0gIF9fbWFzayAgVGhlIGZsYWdzIG1hc2sgZm9yIEBhIGZtdGZsLgorICAgICAqICBAcmV0dXJuICBUaGUgcHJldmlvdXMgZm9ybWF0IGNvbnRyb2wgZmxhZ3MuCisgICAgICoKKyAgICAgKiAgVGhpcyBmdW5jdGlvbiBjbGVhcnMgQGEgbWFzayBpbiB0aGUgZm9ybWF0IGZsYWdzLCB0aGVuIHNldHMKKyAgICAgKiAgQGEgZm10ZmwgQGMgJiBAYSBtYXNrLiAgQW4gZXhhbXBsZSBtYXNrIGlzIEBjIGlvc19iYXNlOjphZGp1c3RmaWVsZC4KKyAgICAqLworICAgIGZtdGZsYWdzCisgICAgc2V0ZihmbXRmbGFncyBfX2ZtdGZsLCBmbXRmbGFncyBfX21hc2spCisgICAgeworICAgICAgZm10ZmxhZ3MgX19vbGQgPSBfTV9mbGFnczsKKyAgICAgIF9NX2ZsYWdzICY9IH5fX21hc2s7CisgICAgICBfTV9mbGFncyB8PSAoX19mbXRmbCAmIF9fbWFzayk7CisgICAgICByZXR1cm4gX19vbGQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogIEBicmllZiAgQ2xlYXJpbmcgZm9ybWF0IGZsYWdzLgorICAgICAqICBAcGFyYW0gIF9fbWFzayAgVGhlIGZsYWdzIHRvIHVuc2V0LgorICAgICAqCisgICAgICogIFRoaXMgZnVuY3Rpb24gY2xlYXJzIEBhIF9fbWFzayBpbiB0aGUgZm9ybWF0IGZsYWdzLgorICAgICovCisgICAgdm9pZAorICAgIHVuc2V0ZihmbXRmbGFncyBfX21hc2spCisgICAgeyBfTV9mbGFncyAmPSB+X19tYXNrOyB9CisKKyAgICAvKioKKyAgICAgKiAgQGJy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HN0cmVhbXNpemUgX19uLCBjaGFyX3R5cGUgX19kZWxpbSkKKyAgICB7CisgICAgICBfTV9nY291bnQgPSAwOworICAgICAgaW9zX2Jhc2U6Omlvc3RhdGUgX19lcnIgPSBpb3NfYmFzZTo6Z29vZGJpdDsKKyAgICAgIHNlbnRyeSBfX2NlcmIoKnRoaXMsIHRydWUpOworICAgICAgaWYgKF9fY2VyYikKKwl7CisJICBfX3RyeQorCSAgICB7CisJICAgICAgY29uc3QgaW50X3R5cGUgX19pZGVsaW0gPSB0cmFpdHNfdHlwZTo6dG9faW50X3R5cGUoX19kZWxpbSk7CisJICAgICAgY29uc3QgaW50X3R5cGUgX19lb2YgPSB0cmFpdHNfdHlwZTo6ZW9mKCk7CisJICAgICAgX19zdHJlYW1idWZfdHlwZSogX19zYiA9IHRoaXMtPnJkYnVmKCk7CisJICAgICAgaW50X3R5cGUgX19jID0gX19zYi0+c2dldGMoKTsKKworCSAgICAgIHdoaWxlIChfTV9nY291bnQgKyAxIDwgX19uCisJCSAgICAgJiYgIXRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZW9mKQorCQkgICAgICYmICF0cmFpdHNfdHlwZTo6ZXFfaW50X3R5cGUoX19jLCBfX2lkZWxpbSkpCisJCXsKKwkJICAqX19zKysgPSB0cmFpdHNfdHlwZTo6dG9fY2hhcl90eXBlKF9fYyk7CisJCSAgKytfTV9nY291bnQ7CisJCSAgX19jID0gX19zYi0+c25leHRjKCk7CisJCX0KKwkgICAgICBpZiAodHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19lb2YpKQorCQlfX2VyciB8PSBpb3NfYmFzZTo6ZW9mYml0OworCSAgICB9CisJICBfX2NhdGNoKF9fY3h4YWJpdjE6Ol9fZm9yY2VkX3Vud2luZCYpCisJICAgIHsKKwkgICAgICB0aGlzLT5fTV9zZXRzdGF0ZShpb3NfYmFzZTo6YmFkYml0KTsKKwkgICAgICBfX3Rocm93X2V4Y2VwdGlvbl9h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CwgdHlwZW5hbWUgX1RyYWl0cz4KKyAgICBiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mCisgICAgYmFzaWNfaXN0cmVhbTxfQ2hhclQsIF9UcmFpdHM+OjoKKyAgICBnZXRsaW5lKGNoYXJfdHlwZSogX19zLCBzdHJlYW1zaXplIF9fbiwgY2hhcl90eXBlIF9fZGVsaW0pCisgICAgeworICAgICAgX01fZ2NvdW50ID0gMDsKKyAgICAgIGlvc19iYXNlOjppb3N0YXRlIF9fZXJyID0gaW9zX2Jhc2U6Omdvb2RiaXQ7CisgICAgICBzZW50cnkgX19jZXJiKCp0aGlzLCB0cnVlKTsKKyAgICAgIGlmIChfX2NlcmIpCisgICAgICAgIHsKKyAgICAgICAgICBfX3RyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBjb25zdCBpbnRfdHlwZSBfX2lkZWxpbSA9IHRyYWl0c190eXBlOjp0b19pbnRfdHlwZShfX2RlbGltKTsKKyAgICAgICAgICAgICAgY29uc3QgaW50X3R5cGUgX19lb2YgPSB0cmFpdHNfdHlwZTo6ZW9mKCk7CisgICAgICAgICAgICAgIF9fc3RyZWFtYnVmX3R5cGUqIF9fc2IgPSB0aGlzLT5yZGJ1ZigpOworICAgICAgICAgICAgICBpbnRfdHlwZSBfX2MgPSBfX3NiLT5zZ2V0YygpOworCisgICAgICAgICAgICAgIHdoaWxlIChfTV9nY291bnQgKyAxIDwgX19uCisgICAgICAgICAgICAgICAgICAgICAmJiAhdHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19lb2YpCisgICAgICAgICAgICAgICAgICAgICAmJiAhdHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19pZGVsaW0pKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICpfX3MrKyA9IHRyYWl0c190eXBlOjp0b19jaGFyX3R5cGUoX19jKTsKKyAgICAgICAgICAgICAgICAgIF9fYyA9IF9fc2ItPnNuZXh0YygpOworICAgICAgICAgICAgICAgICAgKytfTV9nY291bnQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBpZiAodHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19lb2YpKQorICAgICAgICAgICAgICAgIF9fZXJyIHw9IGlvc19iYXNlOjplb2ZiaXQ7CisgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBpZiAodHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19pZGVsaW0pKQorICAgICAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgICAgX19zYi0+c2J1bXBjKCk7CisgICAgICAgICAgICAgICAgICAgICAgKytfTV9nY291bnQ7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgX19lcnIgfD0gaW9zX2Jhc2U6OmZhaWxiaXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCSAgX19jYXRjaChfX2N4eGFiaXYxOjpfX2ZvcmNlZF91bndpbmQmKQorCSAgICB7CisJICAgICAgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7CisJICAgICAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJICAgIH0KKyAgICAgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgICAgIHsgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7IH0KKyAgICAgICAgfQorICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMjQzLiBnZXQgYW5kIGdldGxpbmUgd2hlbiBzZW50cnkgcmVwb3J0cyBmYWlsdXJlLgorICAgICAgaWYgKF9fbiA+IDApCisJKl9fcyA9IGNoYXJfdHlwZSgpOworICAgICAgaWYgKCFfTV9nY291bnQpCisgICAgICAgIF9fZXJ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2NhdGNoKF9fY3h4YWJpdjE6Ol9fZm9yY2VkX3Vud2luZCYpCisJICAgIHsKKwkgICAgICB0aGlzLT5fTV9zZXRzdGF0ZShpb3NfYmFzZTo6YmFkYml0KTsKKwkgICAgICBfX3Rocm93X2V4Y2VwdGlvbl9hZ2FpbjsKKwkgICAgfQorCSAgX19jYXRjaCguLi4pCisJICAgIHsgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7IH0KKwkgIGlmIChfX2VycikKKwkgICAgdGhpcy0+c2V0c3RhdGUoX19lcnIpOworCX0KKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorICAgIGJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICBiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz46OgorICAgIGlnbm9yZShzdHJlYW1zaXplIF9fbikKKyAgICB7CisgICAgICBfTV9nY291bnQgPSAwOworICAgICAgc2VudHJ5IF9fY2VyYigqdGhpcywgdHJ1ZSk7CisgICAgICBpZiAoX19jZXJiICYmIF9fbiA+IDApCisgICAgICAgIHsKKyAgICAgICAgICBpb3NfYmFzZTo6aW9zdGF0ZSBfX2VyciA9IGlvc19iYXNlOjpnb29kYml0OworICAgICAgICAgIF9fdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIGNvbnN0IGludF90eXBlIF9fZW9mID0gdHJhaXRzX3R5cGU6OmVvZigpOworICAgICAgICAgICAgICBfX3N0cmVhbWJ1Zl90eXBlKiBfX3NiID0gdGhpcy0+cmRidWYoKTsKKyAgICAgICAgICAgICAgaW50X3R5cGUgX19jID0gX19zYi0+c2dldGMoKTsKKworCSAgICAgIC8vIE4uQi4gT24gTEZTLWVuYWJsZWQgcGxhdGZvcm1zIHN0cmVhbXNpemUgaXMgc3RpbGwgMzIgYml0cworCSAg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sKKwkJICAgIH0KKwkJICBlbHNlCisJCSAgICBicmVhazsKKwkJfQorCisJICAgICAgaWYgKF9fbGFyZ2VfaWdub3JlKQorCQlfTV9nY291bnQgPSBfX2dudV9jeHg6Ol9fbnVtZXJpY190cmFpdHM8c3RyZWFtc2l6ZT46Ol9fbWF4OworCisJICAgICAgaWYgKHRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZW9mKSkKKyAgICAgICAgICAgICAgICBfX2VyciB8PSBpb3NfYmFzZTo6ZW9mYml0OworICAgICAgICAgICAgfQorCSAgX19jYXRjaChfX2N4eGFiaXYxOjpfX2ZvcmNlZF91bndpbmQmKQorCSAgICB7CisJICAgICAgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7CisJICAgICAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJICAgIH0KKyAgICAgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgICAgIHsgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7IH0KKyAgICAgICAgICBpZiAoX19lcnIpCisgICAgICAgICAgICB0aGlzLT5zZXRzdGF0ZShfX2Vycik7CisgICAgICAgIH0KKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorICAgIGJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICBiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz46OgorICAgIGlnbm9yZShzdHJlYW1zaXplIF9fbiwgaW50X3R5cGUgX19kZWxpbSkKKyAgICB7CisgICAgICBfTV9nY291bnQgPSAwOworICAgICAgc2VudHJ5IF9fY2VyYigqdGhpcywgdHJ1ZSk7CisgICAgICBpZiAoX19jZXJiICYmIF9fbiA+IDApCisgICAgICAgIHsKKyAgICAgICAgICBpb3NfYmFzZTo6aW9zdGF0ZSBfX2VyciA9IGlvc19iYXNlOjpnb29kYml0OworICAgICAgICAgIF9fdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIGNvbnN0IGludF90eXBlIF9fZW9mID0gdHJhaXRzX3R5cGU6OmVvZigpOworICAgICAgICAgICAgICBfX3N0cmVhbWJ1Zl90eXBlKiBfX3NiID0gdGhpcy0+cmRidWYoKTsKKyAgICAgICAgICAgICAgaW50X3R5cGUgX19jID0gX19zYi0+c2dldGMoKTsKKworCSAgICAgIC8vIFNlZSBjb21tZW50IGFib3ZlLgorCSAgICAgIGJvb2wgX19sYXJnZV9pZ25vcmUgPSBmYWxzZTsKKwkgICAgICB3aGlsZSAodHJ1ZSkKKwkJeworCQkgIHdoaWxlIChfTV9nY291bnQgPCBfX24KKwkJCSAmJiAhdHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9fYywgX19lb2YpCisJCQkgJiYgIXRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZGVsaW0pKQorCQkgICAgeworCQkgICAgICArK19NX2djb3VudDsKKwkJICAgICAgX19jID0gX19zYi0+c25leHRjKCk7CisJCSAgICB9CisJCSAgaWYgKF9fbiA9PSBfX2dudV9jeHg6Ol9fbnVtZXJpY190cmFpdHM8c3RyZWFtc2l6ZT46Ol9fbWF4CisJCSAgICAgICYmICF0cmFpdHNfdHlwZTo6ZXFfaW50X3R5cGUoX19jLCBfX2VvZikKKwkJICAgICAgJiYgIXRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZGVsaW0pKQorCQkgICAgeworCQkgICAgICBfTV9nY291bnQgPQorCQkJX19nbnVfY3h4OjpfX251bWVyaWNfdHJhaXRzPHN0cmVhbXNpemU+OjpfX21pbjsKKwkJICAgICAgX19sYXJnZV9pZ25vcmUgPSB0cnVlOworCQkgICAgfQorCQkgIGVsc2UKKwkJICAgIGJyZWFrOworCQl9CisKKwkgICAgICBpZiAoX19sYXJnZV9pZ25vcmUpCisJCV9NX2djb3VudCA9IF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxzdHJlYW1zaXplPjo6X19tYXg7CisKKyAgICAgICAgICAgICAgaWYgKHRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZW9mKSkKKyAgICAgICAgICAgICAgICBfX2VyciB8PSBpb3NfYmFzZTo6ZW9mYml0OworCSAgICAgIGVsc2UgaWYgKHRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIF9fZGVsaW0pKQorCQl7CisJCSAgaWYgKF9NX2djb3VudAorCQkgICAgICA8IF9fZ251X2N4eDo6X19udW1lcmljX3RyYWl0czxzdHJlYW1zaXplPjo6X19tYXgpCisJCSAgICArK19NX2djb3VudDsKKwkJICBfX3NiLT5zYnVtcGMoKTsKKwkJfQorICAgICAgICAgICAgfQorCSAgX19jYXRjaChfX2N4eGFiaXYxOjpfX2ZvcmNlZF91bndpbmQmKQorCSAgICB7CisJICAgICAgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7CisJICAgICAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJICAgIH0KKyAgICAgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgICAgIHsgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7IH0KKyAgICAgICAgICBpZiAoX19lcnIpCisgICAgICAgICAgICB0aGlzLT5zZXRzdGF0ZShfX2Vycik7CisgICAgICAgIH0KKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorICAgIHR5cGVuYW1lIGJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPjo6aW50X3R5cGUKKyAgICBiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz46OgorICAgIHBlZWsodm9pZCkKKyAgICB7CisgICAgICBpbnRfdHlwZSBfX2M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haXRzPgorICAgIGludAorICAgIGJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPjo6CisgICAgc3luYyh2b2lkKQorICAgIHsKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIERSNjAuICBEbyBub3QgY2hhbmdlIF9NX2djb3VudC4KKyAgICAgIGludCBfX3JldCA9IC0xOworICAgICAgc2VudHJ5IF9fY2VyYigqdGhpcywgdHJ1ZSk7CisgICAgICBpZiAoX19jZXJiKQorCXsKKwkgIGlvc19iYXNlOjppb3N0YXRlIF9fZXJyID0gaW9zX2Jhc2U6Omdvb2RiaXQ7CisJICBfX3RyeQorCSAgICB7CisJICAgICAgX19zdHJlYW1idWZfdHlwZSogX19zYiA9IHRoaXMtPnJkYnVmKCk7CisJICAgICAgaWYgKF9fc2IpCisJCXsKKwkJICBpZiAoX19zYi0+cHVic3luYygpID09IC0xKQorCQkgICAgX19lcnIgfD0gaW9zX2Jhc2U6OmJhZGJpdDsKKwkJICBlbHNlCisJCSAgICBfX3JldCA9IDA7CisJCX0KKwkgICAgfQorCSAgX19jYXRjaChfX2N4eGFiaXYxOjpfX2ZvcmNlZF91bndpbmQmKQorCSAgICB7CisJICAgICAgdGhpcy0+X01fc2V0c3RhdGUoaW9zX2Jhc2U6OmJhZGJpdCk7CisJICAgICAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJICAgIH0KKwkgIF9fY2F0Y2goLi4uKQorCSAgICB7IHRoaXMtPl9NX3NldHN0YXRlKGlvc19iYXNlOjpiYWRiaXQpOyB9CisJICBpZiAoX19lcnIpCisJICAgIHRoaXMtPnNldHN0YXRlKF9fZXJyKTsKKwl9CisgICAgICByZXR1cm4gX19yZXQ7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cz4KKyAgICB0eXBlbmFtZSBiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyY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gJiYgX19sZW4gPCBfX25ld19zaXplOyArK19faSwgKytfX2xlbikKKyAgICAgICAgOworICAgICAgaWYgKF9fbGVuID09IF9fbmV3X3NpemUpCisgICAgICAgIGVyYXNlKF9faSwgZW5kKCkpOworICAgICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gX19pID09IGVuZCgpCisJX01fZGVmYXVsdF9hcHBlbmQoX19uZXdfc2l6ZSAtIF9fbGVuKTsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgdm9pZAorICAgIGxpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICByZXNpemUoc2l6ZV90eXBlIF9fbmV3X3NpemUsIGNvbnN0IHZhbHVlX3R5cGUmIF9feCkKKyAgICB7CisgICAgICBpdGVyYXRvciBfX2kgPSBiZWdpbigpOworICAgICAgc2l6ZV90eXBlIF9fbGVuID0gMDsKKyAgICAgIGZvciAoOyBfX2kgIT0gZW5kKCkgJiYgX19sZW4gPCBfX25ld19zaXplOyArK19faSwgKytfX2xlbikKKyAgICAgICAgOworICAgICAgaWYgKF9fbGVuID09IF9fbmV3X3NpemUpCisgICAgICAgIGVyYXNlKF9faSwgZW5kKCkpOworICAgICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gX19pID09IGVuZCgpCisgICAgICAgIGluc2VydChlbmQoKSwgX19uZXdfc2l6ZSAtIF9fbGVuLCBfX3gpOworICAgIH0KKyNlbHNlCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBsaXN0PF9UcCwgX0FsbG9jPjo6CisgICAgcmVzaXplKHNpemVfdHlwZSBfX25ld19zaXplLCB2YWx1ZV90eXBlIF9feCkKKyAgICB7CisgICAgICBpdGVyYXRvciBfX2kgPSBiZWdpbigpOworICAgICAgc2l6ZV90eXBlIF9fbGVuID0gMDsKKyAgICAgIGZvciAoOyBfX2kgIT0gZW5kKCkgJiYgX19sZW4gPCBfX25ld19zaXplOyArK19faSwgKytfX2xlbikKKyAgICAgICAgOworICAgICAgaWYgKF9fbGVuID09IF9fbmV3X3NpemUpCisgICAgICAgIGVyYXNlKF9faSwgZW5kKCkpOworICAgICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gX19pID09IGVuZCgpCisgICAgICAgIGluc2VydChlbmQoKSwgX19uZXdfc2l6ZSAtIF9fbGVuLCBfX3gpOworICAgIH0KKyNlbmRpZgorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIGxpc3Q8X1RwLCBfQWxsb2M+JgorICAgIGxpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICBvcGVyYXRvcj0oY29uc3QgbGlzdCYgX194KQorICAgIHsKKyAgICAgIGlmICh0aGlzICE9ICZfX3gpCisJeworCSAgaXRlcmF0b3IgX19maXJzdDEgPSBiZWdpbigpOworCSAgaXRlcmF0b3IgX19sYXN0MSA9IGVuZCgpOworCSAgY29uc3RfaXRlcmF0b3IgX19maXJzdDIgPSBfX3guYmVnaW4oKTsKKwkgIGNvbnN0X2l0ZXJhdG9yIF9fbGFzdDIgPSBfX3guZW5kKCk7CisJICBmb3IgKDsgX19maXJzdDEgIT0gX19sYXN0MSAmJiBfX2ZpcnN0MiAhPSBfX2xhc3QyOworCSAgICAgICArK19fZmlyc3QxLCArK19fZmlyc3QyKQorCSAgICAqX19maXJzdDEgPSAqX19maXJzdDI7CisJICBpZiAoX19maXJzdDIgPT0gX19sYXN0MikKKwkgICAgZXJhc2UoX19maXJzdDEsIF9fbGFzdDEpOworCSAgZWxzZQorCSAgICBpbnNlcnQoX19sYXN0MSwgX19maXJzdDIsIF9fbGFzdDIpOworCX0KKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgdm9pZAorICAgIGxpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICBfTV9maWxsX2Fzc2lnbihzaXplX3R5cGUgX19uLCBjb25zdCB2YWx1ZV90eXBlJiBfX3ZhbCkKKyAgICB7CisgICAgICBpdGVyYXRvciBfX2kgPSBiZWdpbigpOworICAgICAgZm9yICg7IF9faSAhPSBlbmQoKSAmJiBfX24gPiAwOyArK19faSwgLS1fX24pCisgICAgICAgICpfX2kgPSBfX3ZhbDsKKyAgICAgIGlmIChfX24gPiAwKQorICAgICAgICBpbnNlcnQoZW5kKCksIF9fbiwgX192YWwpOworICAgICAgZWxzZQorICAgICAgICBlcmFzZShfX2ksIGVuZCgpKTsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgdGVtcGxhdGUgPHR5cGVuYW1lIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgdm9pZAorICAgICAgbGlzdDxfVHAsIF9BbGxvYz46OgorICAgICAgX01fYXNzaWduX2Rpc3BhdGNoKF9JbnB1dEl0ZXJhdG9yIF9fZmlyc3QyLCBfSW5wdXRJdGVyYXRvciBfX2xhc3QyLAorCQkJIF9fZmFsc2VfdHlwZSkKKyAgICAgIHsKKyAgICAgICAgaXRlcmF0b3IgX19maXJzdDEgPSBiZWdpbigpOworICAgICAgICBpdGVyYXRvciBfX2xhc3QxID0gZW5kKCk7CisgICAgICAgIGZvciAoOyBfX2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFzdDI7CisJICAgICArK19fZmlyc3QxLCArK19fZmlyc3QyKQorICAgICAgICAgICpfX2ZpcnN0MSA9ICpfX2ZpcnN0MjsKKyAgICAgICAgaWYgKF9fZmlyc3QyID09IF9fbGFzdDIpCisgICAgICAgICAgZXJhc2UoX19maXJzdDEsIF9fbGFzdDEpOworICAgICAgICBlbHNlCisgICAgICAgICAgaW5zZXJ0KF9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luKCk7CisJICAgIGl0ZXJhdG9yIF9fbGFzdDIgPSBfX3guZW5kKCk7CisJICAgIHdoaWxlIChfX2ZpcnN0MSAhPSBfX2xhc3QxICYmIF9fZmlyc3QyICE9IF9fbGFzdDIpCisJICAgICAgaWYgKF9fY29tcCgqX19maXJzdDIsICpfX2ZpcnN0MSkpCisJCXsKKwkJICBpdGVyYXRvciBfX25leHQgPSBfX2ZpcnN0MjsKKwkJICBfTV90cmFuc2ZlcihfX2ZpcnN0MSwgX19maXJzdDIsICsrX19uZXh0KTsKKwkJICBfX2ZpcnN0MiA9IF9fbmV4dDsKKwkJfQorCSAgICAgIGVsc2UKKwkJKytfX2ZpcnN0MTsKKwkgICAgaWYgKF9fZmlyc3QyICE9IF9fbGFzdDIpCisJICAgICAgX01fdHJhbnNmZXIoX19sYXN0MSwgX19maXJzdDIsIF9fbGFzdDIpOworCSAgfQorICAgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBsaXN0PF9UcCwgX0FsbG9jPjo6CisgICAgc29ydCgpCisgICAgeworICAgICAgLy8gRG8gbm90aGluZyBpZiB0aGUgbGlzdCBoYXMgbGVuZ3RoIDAgb3IgMS4KKyAgICAgIGlmICh0aGlzLT5fTV9pbXBsLl9NX25vZGUuX01fbmV4dCAhPSAmdGhpcy0+X01faW1wbC5fTV9ub2RlCisJICAmJiB0aGlzLT5fTV9pbXBsLl9NX25vZGUuX01fbmV4dC0+X01fbmV4dCAhPSAmdGhpcy0+X01faW1wbC5fTV9ub2RlKQorICAgICAgeworICAgICAgICBsaXN0IF9fY2Fycnk7CisgICAgICAgIGxpc3QgX190bXBbNjRdOworICAgICAgICBsaXN0ICogX19maWxsID0gJl9fdG1wWzBdOworICAgICAgICBsaXN0ICogX19jb3VudGVyOworCisgICAgICAgIGRvCisJICB7CisJICAgIF9fY2Fycnkuc3BsaWNlKF9fY2FycnkuYmVnaW4oKSwgKnRoaXMsIGJlZ2luKCkpOworCisJICAgIGZvcihfX2NvdW50ZXIgPSAmX190bXBbMF07CisJCV9fY291bnRlciAhPSBfX2ZpbGwgJiYgIV9fY291bnRlci0+ZW1wdHkoKTsKKwkJKytfX2NvdW50ZXIpCisJICAgICAgeworCQlfX2NvdW50ZXItPm1lcmdlKF9fY2FycnkpOworCQlfX2NhcnJ5LnN3YXAoKl9fY291bnRlcik7CisJICAgICAgfQorCSAgICBfX2NhcnJ5LnN3YXAoKl9fY291bnRlcik7CisJICAgIGlmIChfX2NvdW50ZXIgPT0gX19maWxsKQorCSAgICAgICsrX19maWxsOworCSAgfQorCXdoaWxlICggIWVtcHR5KCkgKTsKKworICAgICAgICBmb3IgKF9fY291bnRlciA9ICZfX3RtcFsxXTsgX19jb3VudGVyICE9IF9fZmlsbDsgKytfX2NvdW50ZXIpCisgICAgICAgICAgX19jb3VudGVyLT5tZXJnZSgqKF9fY291bnRlciAtIDEpKTsKKyAgICAgICAgc3dhcCggKihfX2ZpbGwgLSAxKSApOworICAgICAgfQorICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX1ByZWRpY2F0ZT4KKyAgICAgIHZvaWQKKyAgICAgIGxpc3Q8X1RwLCBfQWxsb2M+OjoKKyAgICAgIHJlbW92ZV9pZihfUHJlZGljYXRlIF9fcHJlZCkKKyAgICAgIHsKKyAgICAgICAgaXRlcmF0b3IgX19maXJzdCA9IGJlZ2luKCk7CisgICAgICAgIGl0ZXJhdG9yIF9fbGFzdCA9IGVuZCgpOworICAgICAgICB3aGlsZSAoX19maXJzdCAhPSBfX2xhc3QpCisJICB7CisJICAgIGl0ZXJhdG9yIF9fbmV4dCA9IF9fZmlyc3Q7CisJICAgICsrX19uZXh0OworCSAgICBpZiAoX19wcmVkKCpfX2ZpcnN0KSkKKwkgICAgICBfTV9lcmFzZShfX2Zpcn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C4KKyAgICAqLworICAgIHN0cmluZworICAgIG5hbWUoKSBjb25zdDsKKworICAgIC8qKgorICAgICAqICBAYnJpZWYgIExvY2FsZSBlcXVhbGl0eS4KKyAgICAgKgorICAgICAqICBAcGFyYW0gIF9fb3RoZXIgIFRoZSBsb2NhbGUgdG8gY29tcGFyZSBhZ2FpbnN0LgorICAgICAqICBAcmV0dXJuICBUcnVlIGlmIG90aGVyIGFuZCB0aGlzIHJlZmVyIHRvIHRoZSBzYW1lIGxvY2FsZSBpbnN0YW5jZSwgYXJlCisgICAgICoJCSBjb3BpZXMsIG9yIGhhdmUgdGhlIHNhbWUgbmFtZS4gIEZhbHNlIG90aGVyd2lzZS4KKyAgICAqLworICAgIGJvb2wKKyAgICBvcGVyYXRvcj09KGNvbnN0IGxvY2FsZSYgX19vdGhlcikgY29uc3QgdGhyb3coKTsKKworICAgIC8qKgorICAgICAqICBAYnJpZWYgIExvY2FsZSBpbmVxdWFsaXR5LgorICAgICAqCisgICAgICogIEBwYXJhbSAgX19vdGhlciAgVGhlIGxvY2FsZSB0byBjb21wYXJlIGFnYWluc3QuCisgICAgICogIEByZXR1cm4gICEgKCp0aGlzID09IF9fb3RoZXIpCisgICAgKi8KKyAgICBib29sCisgICAgb3BlcmF0b3IhPShjb25zdCBsb2NhbGUmIF9fb3RoZXIpIGNvbnN0IHRocm93KCkKKyAgICB7IHJldHVybiAhKHRoaXMtPm9wZXJhdG9yPT0oX19vdGhlcikpOyB9CisKKyAgICAvKioKKyAgICAgKiAgQGJyaWVmICBDb21wYXJlIHR3byBzdHJpbmdzIGFjY29yZGluZyB0byBjb2xsYXRlLgorICAgICAqCisgICAgICogIFRlbXBsYXRlIG9wZXJhdG9yIHRvIGNvbXBhcmUgdHdvIHN0cmluZ3MgdXNpbmcgdGhlIGNvbXBhcmUgZnVuY3Rpb24gb2YKKyAgICAgKiAgdGhlIGNvbGxhdGUgZmFjZXQgaW4gdGhpcyBsb2NhbGUuICBPbmUgdXNlIGlzIHRvIH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kLgorCisgICAgYm9vbAorICAgIF9NX2NoZWNrX3NhbWVfbmFtZSgpCisgICAgeworICAgICAgYm9vbCBfX3JldCA9IHRydWU7CisgICAgICBpZiAoX01fbmFtZXNbMV0pCisJLy8gV2UgbXVzdCBhY3R1YWxseSBjb21wYXJlIGFsbCB0aGUgX01fbmFtZXM6IGNhbiBiZSBhbGwgZXF1YWwhCisJZm9yIChzaXplX3QgX19pID0gMDsgX19yZXQgJiYgX19pIDwgX1NfY2F0ZWdvcmllc19zaXplIC0gMTsgKytfX2kpCisJICBfX3JldCA9IF9fYnVpbHRpbl9zdHJjbXAoX01fbmFtZXNbX19pXSwgX01fbmFtZXNbX19pICsgMV0pID09IDA7CisgICAgICByZXR1cm4gX19yZXQ7CisgICAgfQorCisgICAgdm9pZAorICAgIF9NX3JlcGxhY2VfY2F0ZWdvcmllcyhjb25zdCBfSW1wbCosIGNhdGVnb3J5KTsKKworICAgIHZvaWQKKyAgICBfTV9yZXBsYWNlX2NhdGVnb3J5KGNvbnN0IF9JbXBsKiwgY29uc3QgbG9jYWxlOjppZCogY29uc3QqKTsKKworICAgIHZvaWQKKyAgICBfTV9yZXBsYWNlX2ZhY2V0KGNvbnN0IF9JbXBsKiwgY29uc3QgbG9jYWxlOjppZCopOworCisgICAgdm9pZAorICAgIF9NX2luc3RhbGxfZmFjZXQoY29uc3QgbG9jYWxlOjppZCosIGNvbnN0IGZhY2V0Kik7CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfRmFjZXQ+CisgICAgICB2b2lkCisgICAgICBfTV9pbml0X2ZhY2V0KF9GYWNldCogX19mYWNldCkKKyAgICAgIHsgX01faW5zdGFsbF9mYWNldCgmX0ZhY2V0OjppZCwgX19mYWNldCk7IH0KKworICAgIHZvaWQKKyAgICBfTV9pbnN0YWxsX2NhY2hlKGNvbnN0IGZhY2V0Kiwgc2l6ZV90KTsKKyAgfTsKKworCisgIC8qKgorICAgKiAgQGJyaWVmICBGYWNldCBmb3IgbG9jYW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V9NX2NfbG9jYWxlX2NvbGxhdGU7CisKKyAgICBwdWJsaWM6CisgICAgICAvLy8gTnVtcHVuY3QgZmFjZXQgaWQuCisgICAgICBzdGF0aWMgbG9jYWxlOjppZAkJCWlkOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdG9yIHBlcmZvcm1zIGluaXRpYWxpemF0aW9uLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIHRoZSBjb25zdHJ1Y3RvciBwcm92aWRlZCBieSB0aGUgc3RhbmRhcmQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX3JlZnMgIFBhc3NlZCB0byB0aGUgYmFzZSBmYWNldCBjbGFzcy4KKyAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgY29sbGF0ZShzaXplX3QgX19yZWZzID0gMCkKKyAgICAgIDogZmFjZXQoX19yZWZzKSwgX01fY19sb2NhbGVfY29sbGF0ZShfU19nZXRfY19sb2NhbGUoKSkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEludGVybmFsIGNvbnN0cnVjdG9yLiBOb3QgZm9yIGdlbmVyYWwgdXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIGEgY29uc3RydWN0b3IgZm9yIHVzZSBieSB0aGUgbGlicmFyeSBpdHNlbGYgdG8gc2V0IHVwIG5ldworICAgICAgICogIGxvY2FsZXMuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2Nsb2MgIFRoZSBDIGxvY2FsZS4KKyAgICAgICAqICBAcGFyYW0gX19yZWZzICBQYXNzZWQgdG8gdGhlIGJhc2UgZmFjZXQgY2xhc3MuCisgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGNvbGxhdGUoX19jX2xvY2FsZSBfX2Nsb2MsIHNpemVfdCBfX3JlZnMgPSAwKQorICAgICAgOiBmYWNldChfX3JlZnMpLCBfTV9jX2xvY2FsZV9jb2xsYXRlKF9TX2Nsb25lX2NfbG9jYWxlKF9fY2xvYykpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb21wYXJlIHR3byBzdHJpbmdzLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGNvbXBhcmVzIHR3byBzdHJpbmdzIGFuZCByZXR1cm5zIHRoZSByZXN1bHQgYnkgY2FsbGluZworICAgICAgICogIGNvbGxhdGU6OmRvX2NvbXBhcmUoKS4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fbG8xICBTdGFydCBvZiBzdHJpbmcgMS4KKyAgICAgICAqICBAcGFyYW0gX19oaTEgIEVuZCBvZiBzdHJpbmcgMS4KKyAgICAgICAqICBAcGFyYW0gX19sbzIgIFN0YXJ0IG9mIHN0cmluZyAyLgorICAgICAgICogIEBwYXJhbSBfX2hpMiAgRW5kIG9mIHN0cmluZyAyLgorICAgICAgICogIEByZXR1cm4gIDEgaWYgc3RyaW5nMSA+IHN0cmluZzIsIC0xIGlmIHN0cmluZzEgPCBzdHJpbmcyLCBlbHNlIDAuCisgICAgICAqLworICAgICAgaW50CisgICAgICBjb21wYXJlKGNvbnN0IF9DaGFyVCogX19sbzEsIGNvbnN0IF9DaGFyVCogX19oaTEsCisJICAgICAgY29uc3QgX0NoYXJUKiBfX2xvMiwgY29uc3QgX0NoYXJUKiBfX2hpMikgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX2NvbXBhcmUoX19sbzEsIF9faGkxLCBfX2xvMiwgX19oaTIpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVHJhbnNmb3JtIHN0cmluZyB0byBjb21wYXJhYmxlIGZvcm0uCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gaXMgYSB3cmFwcGVyIGZvciBzdHJ4ZnJtIGZ1bmN0aW9uYWxpdHkuICBJdCB0YWtlcyB0aGUKKyAgICAgICAqICBpbnB1dCBzdHJpbmc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S5jX3N0cigpOworICAgICAgY29uc3QgX0NoYXJUKiBfX3BlbmQgPSBfX29uZS5kYXRhKCkgKyBfX29uZS5sZW5ndGgoKTsKKyAgICAgIGNvbnN0IF9DaGFyVCogX19xID0gX190d28uY19zdHIoKTsKKyAgICAgIGNvbnN0IF9DaGFyVCogX19xZW5kID0gX190d28uZGF0YSgpICsgX190d28ubGVuZ3RoKCk7CisKKyAgICAgIC8vIHN0cmNvbGwgc3RvcHMgd2hlbiBpdCBzZWVzIGEgbnVsIGNoYXJhY3RlciBzbyB3ZSBicmVhaworICAgICAgLy8gdGhlIHN0cmluZ3MgaW50byB6ZXJvLXRlcm1pbmF0ZWQgc3Vic3RyaW5ncyBhbmQgcGFzcyB0aG9zZQorICAgICAgLy8gdG8gc3RyY29sbC4KKyAgICAgIGZvciAoOzspCisJeworCSAgY29uc3QgaW50IF9fcmVzID0gX01fY29tcGFyZShfX3AsIF9fcSk7CisJICBpZiAoX19yZXMpCisJICAgIHJldHVybiBfX3JlczsKKworCSAgX19wICs9IGNoYXJfdHJhaXRzPF9DaGFyVD46Omxlbmd0aChfX3ApOworCSAgX19xICs9IGNoYXJfdHJhaXRzPF9DaGFyVD46Omxlbmd0aChfX3EpOworCSAgaWYgKF9fcCA9PSBfX3BlbmQgJiYgX19xID09IF9fcWVuZCkKKwkgICAgcmV0dXJuIDA7CisJICBlbHNlIGlmIChfX3AgPT0gX19wZW5kKQorCSAgICByZXR1cm4gLTE7CisJICBlbHNlIGlmIChfX3EgPT0gX19xZW5kKQorCSAgICByZXR1cm4gMTsKKworCSAgX19wKys7CisJICBfX3ErKzsKKwl9CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICB0eXBlbmFtZSBjb2xsYXRlPF9DaGFyVD46OnN0cmluZ190eXBlCisgICAgY29sbGF0ZTxfQ2hhclQ+OjoKKyAgICBkb190cmFuc2Zvcm0oY29uc3QgX0NoYXJUKiBfX2xvLCBjb25zdCBfQ2hh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FyVFtfX2xlbl07CisJCSAgX19yZXMgPSBfTV90cmFuc2Zvcm0oX19jLCBfX3AsIF9fbGVuKTsKKwkJfQorCisJICAgICAgX19yZXQuYXBwZW5kKF9fYywgX19yZXMpOworCSAgICAgIF9fcCArPSBjaGFyX3RyYWl0czxfQ2hhclQ+OjpsZW5ndGgoX19wKTsKKwkgICAgICBpZiAoX19wID09IF9fcGVuZCkKKwkJYnJlYWs7CisKKwkgICAgICBfX3ArKzsKKwkgICAgICBfX3JldC5wdXNoX2JhY2soX0NoYXJUKCkpOworCSAgICB9CisJfQorICAgICAgX19jYXRjaCguLi4pCisJeworCSAgZGVsZXRlIFtdIF9fYzsKKwkgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworCX0KKworICAgICAgZGVsZXRlIFtdIF9fYzsKKworICAgICAgcmV0dXJuIF9fcmV0OworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQ+CisgICAgbG9uZworICAgIGNvbGxhdGU8X0NoYXJUPjo6CisgICAgZG9faGFzaChjb25zdCBfQ2hhclQqIF9fbG8sIGNvbnN0IF9DaGFyVCogX19oaSkgY29uc3QKKyAgICB7CisgICAgICB1bnNpZ25lZCBsb25nIF9fdmFsID0gMDsKKyAgICAgIGZvciAoOyBfX2xvIDwgX19oaTsgKytfX2xvKQorCV9fdmFsID0KKwkgICpfX2xvICsgKChfX3ZhbCA8PCA3KQorCQkgICB8IChfX3ZhbCA+PiAoX19nbnVfY3h4OjpfX251bWVyaWNfdHJhaXRzPHVuc2lnbmVkIGxvbmc+OjoKKwkJCQlfX2RpZ2l0cyAtIDcpKSk7CisgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8bG9uZz4oX192YWwpOworICAgIH0KKworICAvLyBJbmhpYml0IGltcGxpY2l0IGluc3RhbnRpYXRpb25zIGZvciByZXF1aXJlZCBpbnN0YW50aWF0aW9ucywKKyAgLy8gd2hpY2ggYXJlIGRlZmluZWQgdmlhIGV4cGxpY2l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CB2aXJ0dWFsCisgICAqICBmdW5jdGlvbnMuCisgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBjbGFzcyBfX2N0eXBlX2Fic3RyYWN0X2Jhc2UgOiBwdWJsaWMgbG9jYWxlOjpmYWNldCwgcHVibGljIGN0eXBlX2Jhc2UKKyAgICB7CisgICAgcHVibGljOgorICAgICAgLy8gVHlwZXM6CisgICAgICAvLy8gVHlwZWRlZiBmb3IgdGhlIHRlbXBsYXRlIHBhcmFtZXRlcgorICAgICAgdHlwZWRlZiBfQ2hhclQgY2hhcl90eXBlOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRlc3QgY2hhcl90eXBlIGNsYXNzaWZpY2F0aW9uLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGZpbmRzIGEgbWFzayBNIGZvciBAYSBfX2MgYW5kIGNvbXBhcmVzIGl0IHRvCisgICAgICAgKiAgbWFzayBAYSBfX20uICBJdCBkb2VzIHNvIGJ5IHJldHVybmluZyB0aGUgdmFsdWUgb2YKKyAgICAgICAqICBjdHlwZTxjaGFyX3R5cGU+Ojpkb19pcygpLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19jICBUaGUgY2hhcl90eXBlIHRvIGNvbXBhcmUgdGhlIG1hc2sgb2YuCisgICAgICAgKiAgQHBhcmFtIF9fbSAgVGhlIG1hc2sgdG8gY29tcGFyZSBhZ2FpbnN0LgorICAgICAgICogIEByZXR1cm4gIChNICYgX19tKSAhPSAwLgorICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGlzKG1hc2sgX19tLCBjaGFyX3R5cGUgX19jKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9faXMoX19tLCBfX2MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGEgbWFzayBhcnJheS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvb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cl90eXBlPjo6ZG9fc2Nhbl9pcygpLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19tICBUaGUgbWFzayB0byBjb21wYXJlIGFnYWluc3QuCisgICAgICAgKiAgQHBhcmFtIF9fbG8gIFBvaW50ZXIgdG8gc3RhcnQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtIF9faGkgIFBvaW50ZXIgdG8gZW5kIG9mIHJhbmdlLgorICAgICAgICogIEByZXR1cm4gIFBvaW50ZXIgdG8gbWF0Y2hpbmcgY2hhcl90eXBlIGlmIGZvdW5kLCBlbHNlIEBhIF9faGkuCisgICAgICAqLworICAgICAgY29uc3QgY2hhcl90eXBlKgorICAgICAgc2Nhbl9pcyhtYXNrIF9fbSwgY29uc3QgY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19zY2FuX2lzKF9fbSwgX19sbywgX19oaSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGNoYXJfdHlwZSBub3QgbWF0Y2hpbmcgYSBtYXNrCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gc2VhcmNoZXMgZm9yIGFuZCByZXR1cm5zIHRoZSBmaXJzdCBjaGFyX3R5cGUgYyBpbgorICAgICAgICogIFtsbyxoaSkgZm9yIHdoaWNoIGlzKG0sYykgaXMgZmFsc2UuICBJdCBkb2VzIHNvIGJ5IHJldHVybmluZworICAgICAgICogIGN0eXBlPGNoYXJfdHlwZT46OmRvX3NjYW5fbm90KCkuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX20gIFRoZSBtYXNrIHRvIGNvbXBhcmUgYWdhaW5zdC4KKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBmaXJzdCBjaGFyIGluIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcmV0dXJuICBQb2ludGVyIHRvIG5vbi1tYXRjaGluZyBjaGFyIGlmIGZvdW5kLCBlbHNlIEBhIF9faGkuCisgICAgICAqLworICAgICAgY29uc3QgY2hhcl90eXBlKgorICAgICAgc2Nhbl9ub3QobWFzayBfX20sIGNvbnN0IGNoYXJfdHlwZSogX19sbywgY29uc3QgY2hhcl90eXBlKiBfX2hpKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fc2Nhbl9ub3QoX19tLCBfX2xvLCBfX2hpKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgdG8gdXBwZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGNvbnZlcnRzIHRoZSBhcmd1bWVudCB0byB1cHBlcmNhc2UgaWYgcG9zc2libGUuCisgICAgICAgKiAgSWYgbm90IHBvc3NpYmxlIChmb3IgZXhhbXBsZSwgJzInKSwgcmV0dXJucyB0aGUgYXJndW1lbnQuICBJdCBkb2VzCisgICAgICAgKiAgc28gYnkgcmV0dXJuaW5nIGN0eXBlPGNoYXJfdHlwZT46OmRvX3RvdXBwZXIoKS4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXJfdHlwZSB0byBjb252ZXJ0LgorICAgICAgICogIEByZXR1cm4gIFRoZSB1cHBlcmNhc2UgY2hhcl90eXBlIGlmIGNvbnZlcnRpYmxlLCBlbHNlIEBhIF9fYy4KKyAgICAgICovCisgICAgICBjaGFyX3R5cGUKKyAgICAgIHRvdXBwZXIoY2hhcl90eXBlIF9fYykgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX3RvdXBwZXIoX19jKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgYXJyYXkgdG8gdXBwZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ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sb3dlcmNhc2UgY2hhcl90eXBlIGlmIGNvbnZlcnRpYmxlLCBlbHNlIEBhIF9fYy4KKyAgICAgICovCisgICAgICBjaGFyX3R5cGUKKyAgICAgIHRvbG93ZXIoY2hhcl90eXBlIF9fYykgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX3RvbG93ZXIoX19jKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgYXJyYXkgdG8gbG93ZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGNvbnZlcnRzIGVhY2ggY2hhcl90eXBlIGluIHRoZSByYW5nZSBbX19sbyxfX2hpKSB0bworICAgICAgICogIGxvd2VyY2FzZSBpZiBwb3NzaWJsZS4gIE90aGVyIGVsZW1lbnRzIHJlbWFpbiB1bnRvdWNoZWQuICBJdCBkb2VzIHNvCisgICAgICAgKiAgYnkgcmV0dXJuaW5nIGN0eXBlPGNoYXJfdHlwZT46OiBkb190b2xvd2VyKF9fbG8sIF9faGkpLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICBjb25zdCBjaGFyX3R5cGUqCisgICAgICB0b2xvd2VyKGNoYXJfdHlwZSogX19sbywgY29uc3QgY2hhcl90eXBlKiBfX2hpKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fdG9sb3dlcihfX2xvLCBfX2hpKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFdpZGVuIGNoYXIgdG8gY2hhcl90eXBlCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXIgYXJndW1lbnQgdG8gY2hhcl90eXBlIHVzaW5nIHRoZQorICAgICAgICogIHNpbXBsZXN0IHJlYXNvbmFibGUgdHJhbnNmb3JtYXRpb24uICBJdCBkb2VzIHNvIGJ5IHJldHVybmluZworICAgICAgICogIGN0eXBlPGNoYXJfdHlwZT46OmRvX3dpZGVuKGMpLgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiB0aGlzIGlzIG5vdCB3aGF0IHlvdSB3YW50IGZvciBjb2RlcGFnZSBjb252ZXJzaW9ucy4gIFNlZQorICAgICAgICogIGNvZGVjdnQgZm9yIHRoYXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2MgIFRoZSBjaGFyIHRvIGNvbnZlcnQuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGNvbnZlcnRlZCBjaGFyX3R5cGUuCisgICAgICAqLworICAgICAgY2hhcl90eXBlCisgICAgICB3aWRlbihjaGFyIF9fYykgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX3dpZGVuKF9fYyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbiBhcnJheSB0byBjaGFyX3R5cGUKKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBjb252ZXJ0cyBlYWNoIGNoYXIgaW4gdGhlIGlucHV0IHRvIGNoYXJfdHlwZSB1c2luZyB0aGUKKyAgICAgICAqICBzaW1wbGVzdCByZWFzb25hYmxlIHRyYW5zZm9ybWF0aW9uLiAgSXQgZG9lcyBzbyBieSByZXR1cm5pbmcKKyAgICAgICAqICBjdHlwZTxjaGFyX3R5cGU+Ojpkb193aWRlbihjKS4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZTogdGhpcyBpcyBub3Qgd2hhdCB5b3Ugd2FudCBmb3IgY29kZXBhZ2UgY29udmVyc2lvbnMuICBTZWUKKyAgICAgICAqICBjb2RlY3Z0IGZvciB0aGF0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtIF9fdG8gIFBvaW50ZXIgdG8gdGhlIGRlc3RpbmF0aW9uIGFycmF5LgorICAgICAgICogIEByZXR1cm4gIEBhIF9faGkuCisgICAgICAqLworICAgICAgY29uc3QgY2hhcioKKyAgICAgIHdpZGVuKGNvbnN0IGNoYXIqIF9fbG8sIGNvbnN0IGNoYXIqIF9faGksIGNoYXJfdHlwZSogX190bykgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX3dpZGVuKF9fbG8sIF9faGksIF9fdG8pOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTmFycm93IGNoYXJfdHlwZSB0byBjaGFyCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXJfdHlwZSB0byBjaGFyIHVzaW5nIHRoZSBzaW1wbGVzdAorICAgICAgICogIHJlYXNvbmFibGUgdHJhbnNmb3JtYXRpb24uICBJZiB0aGUgY29udmVyc2lvbiBmYWlscywgZGZhdWx0IGlzCisgICAgICAgKiAgcmV0dXJuZWQgaW5zdGVhZC4gIEl0IGRvZXMgc28gYnkgcmV0dXJuaW5nCisgICAgICAgKiAgY3R5cGU8Y2hhcl90eXBlPjo6ZG9fbmFycm93KF9fYykuCisgICAgICAgKgorICAgICAgICogIE5vdGU6IHRoaXMgaXMgbm90IHdoYXQgeW91IHdhbnQgZm9yIGNvZGVwYWdlIGNvbnZlcnNpb25zLiAgU2VlCisgICAgICAgKiAgY29kZWN2dCBmb3IgdGhhdC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXJfdHlwZSB0byBjb252ZXJ0LgorICAgICAgICogIEBwYXJhbSBfX2RmYXVsdCAgQ2hhciB0byByZXR1cm4gaWYgY29udmVyc2lvbiBmYWlscy4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgY29udmVydGVkIGNoYXIuCisgICAgICAqLworICAgICAgY2hhcgorICAgICAgbmFycm93KGNoYXJfdHlwZSBfX2MsIGNoYXIgX19kZmF1bHQpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19uYXJyb3coX19jLCBfX2RmYXVsdCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBOYXJyb3cgYXJyYXkgdG8gY2hhciBhcnJheQorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGNvbnZlcnRzIGVhY2ggY2hhcl90eXBlIGluIHRoZSBpbnB1dCB0byBjaGFyIHVzaW5nIHRoZQorICAgICAgICogIHNpbXBsZXN0IHJlYXNvbmFibGUgdHJhbnNmb3JtYXRpb24gYW5kIHdyaXRlcyB0aGUgcmVzdWx0cyB0byB0aGUKKyAgICAgICAqICBkZXN0aW5hdGlvbiBhcnJheS4gIEZvciBhbnkgY2hhcl90eXBlIGluIHRoZSBpbnB1dCB0aGF0IGNhbm5vdCBiZQorICAgICAgICogIGNvbnZlcnRlZCwgQGEgZGZhdWx0IGlzIHVzZWQgaW5zdGVhZC4gIEl0IGRvZXMgc28gYnkgcmV0dXJuaW5nCisgICAgICAgKiAgY3R5cGU8Y2hhcl90eXBlPjo6ZG9fbmFycm93KF9fbG8sIF9faGksIF9fZGZhdWx0LCBfX3RvKS4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZTogdGhpcyBpcyBub3Qgd2hhdCB5b3Ugd2FudCBmb3IgY29kZXBhZ2UgY29udmVyc2lvbnMuICBTZWUKKyAgICAgICAqICBjb2RlY3Z0IGZvciB0aGF0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKi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vbnN0ID0gMDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb252ZXJ0IHRvIHVwcGVyY2FzZS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyB2aXJ0dWFsIGZ1bmN0aW9uIGNvbnZlcnRzIHRoZSBjaGFyX3R5cGUgYXJndW1lbnQgdG8gdXBwZXJjYXNlCisgICAgICAgKiAgaWYgcG9zc2libGUuICBJZiBub3QgcG9zc2libGUgKGZvciBleGFtcGxlLCAnMicpLCByZXR1cm5zIHRoZQorICAgICAgICogIGFyZ3VtZW50LgorICAgICAgICoKKyAgICAgICAqICBkb190b3VwcGVyKCkgaXMgYSBob29rIGZvciBhIGRlcml2ZWQgZmFjZXQgdG8gY2hhbmdlIHRoZSBiZWhhdmlvciBvZgorICAgICAgICogIHVwcGVyY2FzaW5nLiAgZG9fdG91cHBlcigpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yCisgICAgICAgKiAgdGhlIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2MgIFRoZSBjaGFyX3R5cGUgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgdXBwZXJjYXNlIGNoYXJfdHlwZSBpZiBjb252ZXJ0aWJsZSwgZWxzZSBAYSBfX2MuCisgICAgICAqLworICAgICAgdmlydHVhbCBjaGFyX3R5cGUKKyAgICAgIGRvX3RvdXBwZXIoY2hhcl90eXBlIF9fYykgY29uc3QgPSAwOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgYXJyYXkgdG8gdXBwZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyX3R5cGUgaW4gdGhlIHJhbmdlIFtfX2xvLF9faGkpCisgICAgICAgKiAgdG8gdXBwZXJjYXNlIGlmIHBvc3NpYmxlLiAgT3RoZXIgZWx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XN1bHQgZm9yCisgICAgICAgKiAgdGhlIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2MgIFRoZSBjaGFyX3R5cGUgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgbG93ZXJjYXNlIGNoYXJfdHlwZSBpZiBjb252ZXJ0aWJsZSwgZWxzZSBAYSBfX2MuCisgICAgICAqLworICAgICAgdmlydHVhbCBjaGFyX3R5cGUKKyAgICAgIGRvX3RvbG93ZXIoY2hhcl90eXBlIF9fYykgY29uc3QgPSAwOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgYXJyYXkgdG8gbG93ZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyX3R5cGUgaW4gdGhlIHJhbmdlIFtfX2xvLF9faGkpCisgICAgICAgKiAgdG8gbG93ZXJjYXNlIGlmIHBvc3NpYmxlLiAgT3RoZXIgZWxlbWVudHMgcmVtYWluIHVudG91Y2hlZC4KKyAgICAgICAqCisgICAgICAgKiAgZG9fdG9sb3dlcigpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICBsb3dlcmNhc2luZy4gIGRvX3RvbG93ZXIoKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvcgorICAgICAgICogIHRoZSBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGRvX3RvbG93ZXIoY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0ID0gMDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbiBjaGFyCisgICAgICAgKgorICAgICAgICogIFRoaXMgdmlydHVhbCBmdW5jdGlvbiBjb252ZXJ0cyB0aGUgY2hhciB0byBjaGFyX3R5cGUgdXNpbmcgdGhlCisgICAgICAgKiAgc2ltcGxlc3QgcmVhc29uYWJsZSB0cmFuc2Zvcm1hdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgZG9fd2lkZW4oKSBpcyBhIGhvb2sgZm9yIGEgZGVyaXZlZCBmYWNldCB0byBjaGFuZ2UgdGhlIGJlaGF2aW9yIG9mCisgICAgICAgKiAgd2lkZW5pbmcuICBkb193aWRlbigpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yIHRoZQorICAgICAgICogIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIE5vdGU6IHRoaXMgaXMgbm90IHdoYXQgeW91IHdhbnQgZm9yIGNvZGVwYWdlIGNvbnZlcnNpb25zLiAgU2VlCisgICAgICAgKiAgY29kZWN2dCBmb3IgdGhhdC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXIgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgY29udmVydGVkIGNoYXJfdHlwZQorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgY2hhcl90eXBlCisgICAgICBkb193aWRlbihjaGFyIF9fYykgY29uc3QgPSAwOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFdpZGVuIGNoYXIgYXJyYXkKKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBjb252ZXJ0cyBlYWNoIGNoYXIgaW4gdGhlIGlucHV0IHRvIGNoYXJfdHlwZSB1c2luZyB0aGUKKyAgICAgICAqICBzaW1wbGVzdCByZWFzb25hYmxlIHRyYW5zZm9ybWF0aW9uLgorICAgICAgICoKKyAgICAgICAqICBkb193aWRlbigpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICB3aWRlbmluZy4gIGRvX3dpZGVuKCkgbXVzdCBhbHdheXMgcmV0dXJuIHRoZSBzYW1lIHJlc3VsdCBmb3IgdGhlCisgICAgICAgKiAgc2FtZSBpbnB1dC4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZTogdGhpcyBpcyBub3Qgd2hhdCB5b3Ugd2FudCBmb3IgY29kZXBhZ2UgY29udmVyc2lvbnMuICBTZWUKKyAgICAgICAqICBjb2RlY3Z0IGZvciB0aGF0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtIF9fdG8gIFBvaW50ZXIgdG8gdGhlIGRlc3RpbmF0aW9uIGFycmF5LgorICAgICAgICogIEByZXR1cm4gIEBhIF9faGkuCisgICAgICAqLworICAgICAgdmlydHVhbCBjb25zdCBjaGFyKgorICAgICAgZG9fd2lkZW4oY29uc3QgY2hhciogX19sbywgY29uc3QgY2hhciogX19oaSwgY2hhcl90eXBlKiBfX3RvKSBjb25zdCA9IDA7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTmFycm93IGNoYXJfdHlwZSB0byBjaGFyCisgICAgICAgKgorICAgICAgICogIFRoaXMgdmlydHVhbCBmdW5jdGlvbiBjb252ZXJ0cyB0aGUgYXJndW1lbnQgdG8gY2hhciB1c2luZyB0aGUKKyAgICAgICAqICBzaW1wbGVzdCByZWFzb25hYmxlIHRyYW5zZm9ybWF0aW9uLiAgSWYgdGhlIGNvbnZlcnNpb24gZmFpbHMsIGRmYXVsdAorICAgICAgICogIGlzIHJldHVybmVkIGluc3RlYWQuCisgICAgICAgKgorICAgICAgICogIGRvX25hcnJvdygpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICBuYXJyb3dpbmcuICBkb19uYXJyb3coKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUKKyAgICAgICAqICBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiB0aGlzIGlzIG5vdCB3aGF0IHlvdSB3YW50IGZvciBjb2RlcGFnZSBjb252ZXJzaW9ucy4gIFNlZQorICAgICAgICogIGNvZGVjdnQgZm9yIHRoYXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2MgIFRoZSBjaGFyX3R5cGUgdG8gY29udmVydC4KKyAgICAgICAqICBAcGFyYW0gX19kZmF1bHQgIENoYXIgdG8gcmV0dXJuIGlmIGNvbnZlcnNpb24gZmFpbHMuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGNvbnZlcnRlZCBjaGFyLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgY2hhcgorICAgICAgZG9fbmFycm93KGNoYXJfdHlwZSBfX2MsIGNoYXIgX19kZmF1bHQpIGNvbnN0ID0gMDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBOYXJyb3cgY2hhcl90eXBlIGFycmF5IHRvIGNoYXIKKyAgICAgICAqCisgICAgICAgKiAgVGhpcyB2aXJ0dWFsIGZ1bmN0aW9uIGNvbnZlcnRzIGVhY2ggY2hhcl90eXBlIGluIHRoZSByYW5nZQorICAgICAgICogIFtfX2xvLF9faGkpIHRvIGNoYXIgdXNpbmcgdGhlIHNpbXBsZXN0IHJlYXNvbmFibGUKKyAgICAgICAqICB0cmFuc2Zvcm1hdGlvbiBhbmQ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zayB0byBjb21wYXJlIGFnYWluc3QuCisgICAgICAgKiAgQHJldHVybiAgVHJ1ZSBpZiBfX20gJiB0YWJsZVtfX2NdIGlzIHRydWUsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICovCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgaXMobWFzayBfX20sIGNoYXIgX19jKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gYSBtYXNrIGFycmF5LgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGZpbmRzIHRoZSBtYXNrIGZvciBlYWNoIGNoYXIgaW4gdGhlIHJhbmdlIFtsbywgaGkpIGFuZAorICAgICAgICogIHN1Y2Nlc3NpdmVseSB3cml0ZXMgaXQgdG8gdmVjLiAgdmVjIG11c3QgaGF2ZSBhcyBtYW55IGVsZW1lbnRzIGFzCisgICAgICAgKiAgdGhlIGNoYXIgYXJyYXkuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2xvICBQb2ludGVyIHRvIHN0YXJ0IG9mIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX192ZWMgIFBvaW50ZXIgdG8gYW4gYXJyYXkgb2YgbWFzayBzdG9yYWdlLgorICAgICAgICogIEByZXR1cm4gIEBhIF9faGkuCisgICAgICAqLworICAgICAgaW5saW5lIGNvbnN0IGNoYXIqCisgICAgICBpcyhjb25zdCBjaGFyKiBfX2xvLCBjb25zdCBjaGFyKiBfX2hpLCBtYXNrKiBfX3ZlYykgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBjaGFyIG1hdGNoaW5nIGEgbWFzaworICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHNlYXJjaGVzIGZvciBhbmQgcmV0dXJucyB0aGUgZmlyc3QgY2hhciBpbiBbbG8saGkpIGZvcgorICAgICAgICogIHdoaWNoIGlzKG0sY2hhcikgaXMgdHJ1ZS4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fbSAgVGhlIG1hc2sgdG8gY29tcGFyZSBhZ2FpbnN0LgorICAgICAgICogIEBwYXJhbSBfX2xvICBQb2ludGVyIHRvIHN0YXJ0IG9mIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcmV0dXJuICBQb2ludGVyIHRvIGEgbWF0Y2hpbmcgY2hhciBpZiBmb3VuZCwgZWxzZSBAYSBfX2hpLgorICAgICAgKi8KKyAgICAgIGlubGluZSBjb25zdCBjaGFyKgorICAgICAgc2Nhbl9pcyhtYXNrIF9fbSwgY29uc3QgY2hhciogX19sbywgY29uc3QgY2hhciogX19oaSkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBjaGFyIG5vdCBtYXRjaGluZyBhIG1hc2sKKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBzZWFyY2hlcyBmb3IgYW5kIHJldHVybnMgYSBwb2ludGVyIHRvIHRoZSBmaXJzdCBjaGFyCisgICAgICAgKiAgaW4gW19fbG8sX19oaSkgZm9yIHdoaWNoIGlzKG0sY2hhcikgaXMgZmFsc2UuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX20gIFRoZSBtYXNrIHRvIGNvbXBhcmUgYWdhaW5zdC4KKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgUG9pbnRlciB0byBhIG5vbi1tYXRjaGluZyBjaGFyIGlmIGZvdW5kLCBlbHNlIEBhIF9faGkuCisgICAgICAqLworICAgICAgaW5saW5lIGNvbnN0IGNoYXIqCisgICAgICBzY2FuX25vdChtYXNrIF9fbSwgY29uc3QgY2hhciogX19sbywgY29uc3QgY2hhciogX19oaSkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29udmVydCB0byB1cHBlcmNhc2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXIgYXJndW1lbnQgdG8gdXBwZXJjYXNlIGlmIHBvc3NpYmxlLgorICAgICAgICogIElmIG5vdCBwb3NzaWJsZSAoZm9yIGV4YW1wbGUsICcyJyksIHJldHVybnMgdGhlIGFyZ3VtZW50LgorICAgICAgICoKKyAgICAgICAqICB0b3VwcGVyKCkgYWN0cyBhcyBpZiBpdCByZXR1cm5zIGN0eXBlPGNoYXI+Ojpkb190b3VwcGVyKGMpLgorICAgICAgICogIGRvX3RvdXBwZXIoKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUgc2FtZSBpbnB1dC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXIgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgdXBwZXJjYXNlIGNoYXIgaWYgY29udmVydGlibGUsIGVsc2UgQGEgX19jLgorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZQorICAgICAgdG91cHBlcihjaGFyX3R5cGUgX19jKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fdG91cHBlcihfX2MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29udmVydCBhcnJheSB0byB1cHBlcmNhc2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyIGluIHRoZSByYW5nZSBbX19sbyxfX2hpKSB0byB1cHBlcmNhc2UKKyAgICAgICAqICBpZiBwb3NzaWJsZS4gIE90aGVyIGNoYXJzIH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bnB1dC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXIgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgbG93ZXJjYXNlIGNoYXIgaWYgY29udmVydGlibGUsIGVsc2UgQGEgX19jLgorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZQorICAgICAgdG9sb3dlcihjaGFyX3R5cGUgX19jKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fdG9sb3dlcihfX2MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29udmVydCBhcnJheSB0byBsb3dlcmNhc2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyIGluIHRoZSByYW5nZSBbbG8saGkpIHRvIGxvd2VyY2FzZQorICAgICAgICogIGlmIHBvc3NpYmxlLiAgT3RoZXIgY2hhcnMgcmVtYWluIHVudG91Y2hlZC4KKyAgICAgICAqCisgICAgICAgKiAgdG9sb3dlcigpIGFjdHMgYXMgaWYgaXQgcmV0dXJucyBjdHlwZTxjaGFyPjo6IGRvX3RvbG93ZXIoX19sbywgX19oaSkuCisgICAgICAgKiAgZG9fdG9sb3dlcigpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yIHRoZSBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBmaXJzdCBjaGFyIGluIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcmV0dXJuICBAYSBfX2hpLgorICAgICAgKi8KKyAgICAgIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIHRvbG93ZXIoY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0CisgICAgICB7IHJldHV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cy0+ZG9fd2lkZW4oX19jKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbiBjaGFyIGFycmF5CisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyIGluIHRoZSBpbnB1dCB0byBjaGFyIHVzaW5nIHRoZQorICAgICAgICogIHNpbXBsZXN0IHJlYXNvbmFibGUgdHJhbnNmb3JtYXRpb24uICBGb3IgYW4gdW5kZXJpdmVkIGN0eXBlPGNoYXI+CisgICAgICAgKiAgZmFjZXQsIHRoZSBhcmd1bWVudCB3aWxsIGJlIGNvcGllZCB1bmNoYW5nZWQuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gd29ya3MgYXMgaWYgaXQgcmV0dXJucyBjdHlwZTxjaGFyPjo6ZG9fd2lkZW4oYykuCisgICAgICAgKiAgZG9fd2lkZW4oKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUgc2FtZSBpbnB1dC4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZTogdGhpcyBpcyBub3Qgd2hhdCB5b3Ugd2FudCBmb3IgY29kZXBhZ2UgY29udmVyc2lvbnMuICBTZWUKKyAgICAgICAqICBjb2RlY3Z0IGZvciB0aGF0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBmaXJzdCBjaGFyIGluIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX190byAgUG9pbnRlciB0byB0aGUgZGVzdGluYXRpb24gYXJyYXkuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICBjb25zdCBjaGFyKgorICAgICAgd2lkZW4oY29uc3QgY2hhciogX19sbywgY29uc3QgY2hhciogX19oaSwgY2hhcl90eX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Bhcmd1bWVudCB3aWxsIGJlIGNvcGllZCB1bmNoYW5nZWQuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gd29ya3MgYXMgaWYgaXQgcmV0dXJucyBjdHlwZTxjaGFyPjo6ZG9fbmFycm93KGxvLCBoaSwKKyAgICAgICAqICBkZmF1bHQsIHRvKS4gIGRvX25hcnJvdygpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yIHRoZQorICAgICAgICogIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIE5vdGU6IHRoaXMgaXMgbm90IHdoYXQgeW91IHdhbnQgZm9yIGNvZGVwYWdlIGNvbnZlcnNpb25zLiAgU2VlCisgICAgICAgKiAgY29kZWN2dCBmb3IgdGhhdC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fbG8gIFBvaW50ZXIgdG8gc3RhcnQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtIF9faGkgIFBvaW50ZXIgdG8gZW5kIG9mIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2RmYXVsdCAgQ2hhciB0byB1c2UgaWYgY29udmVyc2lvbiBmYWlscy4KKyAgICAgICAqICBAcGFyYW0gX190byAgUG9pbnRlciB0byB0aGUgZGVzdGluYXRpb24gYXJyYXkuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICBjb25zdCBjaGFyX3R5cGUqCisgICAgICBuYXJyb3coY29uc3QgY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGksCisJICAgICBjaGFyIF9fZGZhdWx0LCBjaGFyKiBfX3RvKSBjb25zdAorICAgICAgeworCWlmIChfX2J1aWx0aW5fZXhwZWN0KF9NX25hcnJvd19vayA9PSAxLCB0cnVlKSkKKwkgIHsKKwkgICAgX19idWlsdGluX21lbWNweShfX3RvLCBfX2xvLCBfX2hpIC0gX19sbyk7CisJICAgIHJld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YKKyAgICAgICAqICB1cHBlcmNhc2luZy4gIGRvX3RvdXBwZXIoKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvcgorICAgICAgICogIHRoZSBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGRvX3RvdXBwZXIoY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0OworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgdG8gbG93ZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXIgYXJndW1lbnQgdG8gbG93ZXJjYXNlIGlmCisgICAgICAgKiAgcG9zc2libGUuICBJZiBub3QgcG9zc2libGUgKGZvciBleGFtcGxlLCAnMicpLCByZXR1cm5zIHRoZSBhcmd1bWVudC4KKyAgICAgICAqCisgICAgICAgKiAgZG9fdG9sb3dlcigpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICBsb3dlcmNhc2luZy4gIGRvX3RvbG93ZXIoKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvcgorICAgICAgICogIHRoZSBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19jICBUaGUgY2hhciB0byBjb252ZXJ0LgorICAgICAgICogIEByZXR1cm4gIFRoZSBsb3dlcmNhc2UgY2hhciBpZiBjb252ZXJ0aWJsZSwgZWxzZSBAYSBfX2MuCisgICAgICAqLworICAgICAgdmlydHVhbCBjaGFyX3R5cGUKKyAgICAgIGRvX3RvbG93ZXIoY2hhcl90eXBlIF9fYykgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29udmVydCBhcnJheSB0byBsb3dlcmNhc2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgdmlydHVhbCBmdW5jdGlvbiBjb252ZXJ0cyBlYWNoIGNoYXIgaW4gdGhlIHJhbmdlIFtsbyxoaSkgdG8KKyAgICAgICAqICBsb3dlcmNhc2UgaWYgcG9zc2libGUuICBPdGhlciBjaGFycyByZW1haW4gdW50b3VjaGVkLgorICAgICAgICoKKyAgICAgICAqICBkb190b2xvd2VyKCkgaXMgYSBob29rIGZvciBhIGRlcml2ZWQgZmFjZXQgdG8gY2hhbmdlIHRoZSBiZWhhdmlvciBvZgorICAgICAgICogIGxvd2VyY2FzaW5nLiAgZG9fdG9sb3dlcigpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yCisgICAgICAgKiAgdGhlIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2xvICBQb2ludGVyIHRvIGZpcnN0IGNoYXIgaW4gcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtIF9faGkgIFBvaW50ZXIgdG8gZW5kIG9mIHJhbmdlLgorICAgICAgICogIEByZXR1cm4gIEBhIF9faGkuCisgICAgICAqLworICAgICAgdmlydHVhbCBjb25zdCBjaGFyX3R5cGUqCisgICAgICBkb190b2xvd2VyKGNoYXJfdHlwZSogX19sbywgY29uc3QgY2hhcl90eXBlKiBfX2hpKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbiBjaGFyCisgICAgICAgKgorICAgICAgICogIFRoaXMgdmlydHVhbCBmdW5jdGlvbiBjb252ZXJ0cyB0aGUgY2hhciB0byBjaGFyIHVzaW5nIHRoZSBzaW1wbGVzdAorICAgICAgICogIHJlYXNvbmFibGUgdHJhbnNmb3JtYXRpb24uICBGb3IgYW4gdW5kZXJpdmVkIGN0eXBlPGNoYXI+IGZhY2V0LCB0aGUKKyAgICAgICAqICBhcmd1bWVudCB3aWxsIGJlIHJldHVybmVkIHVuY2hhbmdlZC4KKyAgICAgICAqCisgICAgICAgKiAgZG9fd2lkZW4oKSBpcyBhIGhvb2sgZm9yIGEgZGVyaXZlZCBmYWNldCB0byBjaGFuZ2UgdGhlIGJlaGF2aW9yIG9mCisgICAgICAgKiAgd2lkZW5pbmcuICBkb193aWRlbigpIG11c3QgYWx3YXlzIHJldHVybiB0aGUgc2FtZSByZXN1bHQgZm9yIHRoZQorICAgICAgICogIHNhbWUgaW5wdXQuCisgICAgICAgKgorICAgICAgICogIE5vdGU6IHRoaXMgaXMgbm90IHdoYXQgeW91IHdhbnQgZm9yIGNvZGVwYWdlIGNvbnZlcnNpb25zLiAgU2VlCisgICAgICAgKiAgY29kZWN2dCBmb3IgdGhhdC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtIF9fYyAgVGhlIGNoYXIgdG8gY29udmVydC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgY29udmVydGVkIGNoYXJhY3Rlci4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNoYXJfdHlwZQorICAgICAgZG9fd2lkZW4oY2hhciBfX2MpIGNvbnN0CisgICAgICB7IHJldHVybiBfX2M7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBXaWRlbiBjaGFyIGFycmF5CisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gY29udmVydHMgZWFjaCBjaGFyIGluIHRoZSByYW5nZSBbbG8saGkpIHRvIGNoYXIgdXNpbmcKKyAgICAgICAqICB0aGUgc2ltcGxlc3QgcmVhc29uYWJsZSB0cmFuc2Zvcm1hdGlvbi4gIEZvciBhbiB1bmRl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ZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXIgdG8gY2hhciB1c2luZyB0aGUgc2ltcGxlc3QKKyAgICAgICAqICByZWFzb25hYmxlIHRyYW5zZm9ybWF0aW9uLiAgSWYgdGhlIGNvbnZlcnNpb24gZmFpbHMsIGRmYXVsdCBpcworICAgICAgICogIHJldHVybmVkIGluc3RlYWQuICBGb3IgYW4gdW5kZXJpdmVkIGN0eXBlPGNoYXI+IGZhY2V0LCBAYSBjIHdpbGwgYmUKKyAgICAgICAqICByZXR1cm5lZCB1bmNoYW5nZWQuCisgICAgICAgKgorICAgICAgICogIGRvX25hcnJvdygpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICBuYXJyb3dpbmcuICBkb19uYXJyb3coKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUKKyAgICAgICAqICBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiB0aGlzIGlzIG5vdCB3aGF0IHlvdSB3YW50IGZvciBjb2RlcGFnZSBjb252ZXJzaW9ucy4gIFNlZQorICAgICAgICogIGNvZGVjdnQgZm9yIHRoYXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2MgIFRoZSBjaGFyIHRvIGNvbnZlcnQuCisgICAgICAgKiAgQHBhcmFtIF9fZGZhdWx0ICBDaGFyIHRvIHJldHVybiBpZiBjb252ZXJzaW9uIGZhaWxzLgorICAgICAgICogIEByZXR1cm4gIFRoZSBjb252ZXJ0ZWQgY2hhci4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNoYXIKKyAgICAgIGRvX25hcnJvdyhjaGFyX3R5cGUgX19jLCBjaGFyIF9fZGZhdWx0KSBjb25zdAorICAgICAgeyByZXR1cm4gX19jOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTmFycm93IGNoYXIg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0cyBwdWJsaWMgbWV0aG9kcyBmcm9tCisgICAqICBfX2N0eXBlX2Fic3RyYWN0X2Jhc2U8d2NoYXJfdD4uCisgICovCisgIHRlbXBsYXRlPD4KKyAgICBjbGFzcyBjdHlwZTx3Y2hhcl90PiA6IHB1YmxpYyBfX2N0eXBlX2Fic3RyYWN0X2Jhc2U8d2NoYXJfdD4KKyAgICB7CisgICAgcHVibGljOgorICAgICAgLy8gVHlwZXM6CisgICAgICAvLy8gVHlwZWRlZiBmb3IgdGhlIHRlbXBsYXRlIHBhcmFtZXRlciB3Y2hhcl90LgorICAgICAgdHlwZWRlZiB3Y2hhcl90CQljaGFyX3R5cGU7CisgICAgICB0eXBlZGVmIHdjdHlwZV90CQlfX3dtYXNrX3R5cGU7CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICBfX2NfbG9jYWxlCQlfTV9jX2xvY2FsZV9jdHlwZTsKKworICAgICAgLy8gUHJlLWNvbXB1dGVkIG5hcnJvd2VkIGFuZCB3aWRlbmVkIGNoYXJzLgorICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgICBfTV9uYXJyb3dfb2s7CisgICAgICBjaGFyICAgICAgICAgICAgICAgICAgICAgIF9NX25hcnJvd1sxMjhdOworICAgICAgd2ludF90ICAgICAgICAgICAgICAgICAgICBfTV93aWRlblsxICsgc3RhdGljX2Nhc3Q8dW5zaWduZWQgY2hhcj4oLTEpXTsKKworICAgICAgLy8gUHJlLWNvbXB1dGVkIGVsZW1lbnRzIGZvciBkb19pcy4KKyAgICAgIG1hc2sgICAgICAgICAgICAgICAgICAgICAgX01fYml0WzE2XTsKKyAgICAgIF9fd21hc2tfdHlwZSAgICAgICAgICAgICAgX01fd21hc2tbMTZdOworCisgICAgcHVibGljOgorICAgICAgLy8gRGF0YSBNZW1iZXJzOgorICAgICAgLy8vIFRoZSBmYWNldCBpZCBmb3IgY3R5cGU8d2NoYXJfdD4KKyAgICAgIHN0YXRpYyBsb2NhbGU6OmlkCQlpZDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb25zdHJ1Y3RvciBwZXJmb3JtcyBpbml0aWFsaXphdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyB0aGUgY29uc3RydWN0b3IgcHJvdmlkZWQgYnkgdGhlIHN0YW5kYXJkLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19yZWZzICBQYXNzZWQgdG8gdGhlIGJhc2UgZmFjZXQgY2xhc3MuCisgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGN0eXBlKHNpemVfdCBfX3JlZnMgPSAwKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb25zdHJ1Y3RvciBwZXJmb3JtcyBzdGF0aWMgaW5pdGlhbGl6YXRpb24uCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgaXMgdXNlZCB0byBjb25zdHJ1Y3QgdGhlIGluaXRpYWwgQyBsb2NhbGUgZmFjZXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2Nsb2MgIEhhbmRsZSB0byBDIGxvY2FsZSBkYXRhLgorICAgICAgICogIEBwYXJhbSBfX3JlZnMgIFBhc3NlZCB0byB0aGUgYmFzZSBmYWNldCBjbGFzcy4KKyAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgY3R5cGUoX19jX2xvY2FsZSBfX2Nsb2MsIHNpemVfdCBfX3JlZnMgPSAwKTsKKworICAgIHByb3RlY3RlZDoKKyAgICAgIF9fd21hc2tfdHlwZQorICAgICAgX01fY29udmVydF90b193bWFzayhjb25zdCBtYXNrIF9fbSkgY29uc3QgdGhyb3coKTsKKworICAgICAgLy8vIERlc3RydWN0b3IKKyAgICAgIHZpcnR1YWwKKyAgICAgIH5jdHlwZSgpOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFRlc3Qgd2NoYXJfdCBjbGFzc2lmaWNhdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgV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ZSBfX2MpIGNvbnN0OworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgYXJyYXkgdG8gdXBwZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgZWFjaCB3Y2hhcl90IGluIHRoZSByYW5nZSBbbG8saGkpIHRvCisgICAgICAgKiAgdXBwZXJjYXNlIGlmIHBvc3NpYmxlLiAgT3RoZXIgZWxlbWVudHMgcmVtYWluIHVudG91Y2hlZC4KKyAgICAgICAqCisgICAgICAgKiAgZG9fdG91cHBlcigpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICB1cHBlcmNhc2luZy4gIGRvX3RvdXBwZXIoKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvcgorICAgICAgICogIHRoZSBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGRvX3RvdXBwZXIoY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0OworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnZlcnQgdG8gbG93ZXJjYXNlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgdGhlIGFyZ3VtZW50IHRvIGxvd2VyY2FzZSBpZgorICAgICAgICogIHBvc3NpYmxlLiAgSWYgbm90IHBvc3NpYmxlIChmb3I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lucHV0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19sbyAgUG9pbnRlciB0byBzdGFydCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19oaSAgUG9pbnRlciB0byBlbmQgb2YgcmFuZ2UuCisgICAgICAgKiAgQHJldHVybiAgQGEgX19oaS4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGRvX3RvbG93ZXIoY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGkpIGNvbnN0OworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFdpZGVuIGNoYXIgdG8gd2NoYXJfdAorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgdGhlIGNoYXIgdG8gd2NoYXJfdCB1c2luZyB0aGUKKyAgICAgICAqICBzaW1wbGVzdCByZWFzb25hYmxlIHRyYW5zZm9ybWF0aW9uLiAgRm9yIGFuIHVuZGVyaXZlZCBjdHlwZTx3Y2hhcl90PgorICAgICAgICogIGZhY2V0LCB0aGUgYXJndW1lbnQgd2lsbCBiZSBjYXN0IHRvIHdjaGFyX3QuCisgICAgICAgKgorICAgICAgICogIGRvX3dpZGVuKCkgaXMgYSBob29rIGZvciBhIGRlcml2ZWQgZmFjZXQgdG8gY2hhbmdlIHRoZSBiZWhhdmlvciBvZgorICAgICAgICogIHdpZGVuaW5nLiAgZG9fd2lkZW4oKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUKKyAgICAgICAqICBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiB0aGlzIGlzIG5vdCB3aGF0IHlvdSB3YW50IGZvciBjb2RlcGFnZSBjb252ZXJzaW9ucy4gIFNlZQorICAgICAgICogIGNvZGVjdnQgZm9yIHRoYXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJh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KyAgICAgICAqICBjb2RlY3Z0IGZvciB0aGF0LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19jICBUaGUgd2NoYXJfdCB0byBjb252ZXJ0LgorICAgICAgICogIEBwYXJhbSBfX2RmYXVsdCAgQ2hhciB0byByZXR1cm4gaWYgY29udmVyc2lvbiBmYWlscy4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgY29udmVydGVkIGNoYXIuCisgICAgICAqLworICAgICAgdmlydHVhbCBjaGFyCisgICAgICBkb19uYXJyb3coY2hhcl90eXBlIF9fYywgY2hhciBfX2RmYXVsdCkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTmFycm93IHdjaGFyX3QgYXJyYXkgdG8gY2hhciBhcnJheQorICAgICAgICoKKyAgICAgICAqICBUaGlzIHZpcnR1YWwgZnVuY3Rpb24gY29udmVydHMgZWFjaCB3Y2hhcl90IGluIHRoZSByYW5nZSBbbG8saGkpIHRvCisgICAgICAgKiAgY2hhciB1c2luZyB0aGUgc2ltcGxlc3QgcmVhc29uYWJsZSB0cmFuc2Zvcm1hdGlvbiBhbmQgd3JpdGVzIHRoZQorICAgICAgICogIHJlc3VsdHMgdG8gdGhlIGRlc3RpbmF0aW9uIGFycmF5LiAgRm9yIGFueSB3Y2hhcl90IGluIHRoZSBpbnB1dCB0aGF0CisgICAgICAgKiAgY2Fubm90IGJlIGNvbnZlcnRlZCwgQGEgZGZhdWx0IGlzIHVzZWQgaW5zdGVhZC4gIEZvciBhbiB1bmRlcml2ZWQKKyAgICAgICAqICBjdHlwZTx3Y2hhcl90PiBmYWNldCwgdGhlIGFyZ3VtZW50IHdpbGwgYmUgY29waWVkLCBjYXN0aW5nIGVhY2gKKyAgICAgICAqICBlbGVtZW50IHRvIGNoYXIuCisgICAgICAgKgorICAgICAgICogIGRvX25hcnJvdygpIGlzIGEgaG9vayBmb3IgYSBkZXJpdmVkIGZhY2V0IHRvIGNoYW5nZSB0aGUgYmVoYXZpb3Igb2YKKyAgICAgICAqICBuYXJyb3dpbmcuICBkb19uYXJyb3coKSBtdXN0IGFsd2F5cyByZXR1cm4gdGhlIHNhbWUgcmVzdWx0IGZvciB0aGUKKyAgICAgICAqICBzYW1lIGlucHV0LgorICAgICAgICoKKyAgICAgICAqICBOb3RlOiB0aGlzIGlzIG5vdCB3aGF0IHlvdSB3YW50IGZvciBjb2RlcGFnZSBjb252ZXJzaW9ucy4gIFNlZQorICAgICAgICogIGNvZGVjdnQgZm9yIHRoYXQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX2xvICBQb2ludGVyIHRvIHN0YXJ0IG9mIHJhbmdlLgorICAgICAgICogIEBwYXJhbSBfX2hpICBQb2ludGVyIHRvIGVuZCBvZiByYW5nZS4KKyAgICAgICAqICBAcGFyYW0gX19kZmF1bHQgIENoYXIgdG8gdXNlIGlmIGNvbnZlcnNpb24gZmFpbHMuCisgICAgICAgKiAgQHBhcmFtIF9fdG8gIFBvaW50ZXIgdG8gdGhlIGRlc3RpbmF0aW9uIGFycmF5LgorICAgICAgICogIEByZXR1cm4gIEBhIF9faGkuCisgICAgICAqLworICAgICAgdmlydHVhbCBjb25zdCBjaGFyX3R5cGUqCisgICAgICBkb19uYXJyb3coY29uc3QgY2hhcl90eXBlKiBfX2xvLCBjb25zdCBjaGFyX3R5cGUqIF9faGksCisJCWNoYXIgX19kZmF1bHQsIGNoYXIqIF9fdG8pIGNvbnN0OworCisgICAgICAvLyBGb3IgdXNlIGF0IGNvbnN0cnVjdGlvbiB0aW1lIG9ubHkuCisgICAgICB2b2lkCisgICAgICBfTV9pbml0aWFsaXplX2N0eXBlKCkgdGhyb3coKTsKKyAgICB9OworI2VuZGlmIC8vX0dMSUJDWFhfVVNFX1dDSEFSX1QKKworICAvLy8gY2xhc3MgY3R5cGVfYnluYW1lIFsyMi4yLjEuMl0uCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBjbGFzcyBjdHlwZV9ieW5hbWUg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IHRoZXkgcmVxdWlyZSBmcm9tIGEgbnVtcHVuY3QgZmFjZXQuCisgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBjbGFzcyBudW1wdW5jdCA6IHB1YmxpYyBsb2NhbGU6OmZhY2V0CisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIC8vIFR5cGVzOgorICAgICAgLy9AeworICAgICAgLy8vIFB1YmxpYyB0eXBlZGVmcworICAgICAgdHlwZWRlZiBfQ2hhclQJCQljaGFyX3R5cGU7CisgICAgICB0eXBlZGVmIGJhc2ljX3N0cmluZzxfQ2hhclQ+CXN0cmluZ190eXBlOworICAgICAgLy9AfQorICAgICAgdHlwZWRlZiBfX251bXB1bmN0X2NhY2hlPF9DaGFyVD4gIF9fY2FjaGVfdHlwZTsKKworICAgIHByb3RlY3RlZDoKKyAgICAgIF9fY2FjaGVfdHlwZSoJCQlfTV9kYXRhOworCisgICAgcHVibGljOgorICAgICAgLy8vIE51bXB1bmN0IGZhY2V0IGlkLgorICAgICAgc3RhdGljIGxvY2FsZTo6aWQJCQlpZDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBOdW1wdW5jdCBjb25zdHJ1Y3Rvci4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtICBfX3JlZnMgIFJlZmNvdW50IHRvIHBhc3MgdG8gdGhlIGJhc2UgY2xhc3MuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBudW1wdW5jdChzaXplX3QgX19yZWZzID0gMCkKKyAgICAgIDogZmFjZXQoX19yZWZzKSwgX01fZGF0YSgwKQorICAgICAgeyBfTV9pbml0aWFsaXplX251bXB1bmN0KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBJbnRlcm5hbCBjb25zdHJ1Y3Rvci4gIE5vdCBmb3IgZ2VuZXJhbCB1c2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgaXMgYSBjb25zdHJ1Y3RvciBmb3IgdXNlIGJ5IHRoZSBsaWJyYXJ5IGl0c2VsZiB0byBzZXQgdXAgdGhlCisgICAgICAgKiAgcHJlZGVmaW5lZCBsb2NhbGUgZmFjZXRzLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9fY2FjaGUgIF9fbnVtcHVuY3RfY2FjaGUgb2JqZWN0LgorICAgICAgICogIEBwYXJhbSAgX19yZWZzICBSZWZjb3VudCB0byBwYXNzIHRvIHRoZSBiYXNlIGNsYXNzLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbnVtcHVuY3QoX19jYWNoZV90eXBlKiBfX2NhY2hlLCBzaXplX3QgX19yZWZzID0gMCkKKyAgICAgIDogZmFjZXQoX19yZWZzKSwgX01fZGF0YShfX2NhY2hlKQorICAgICAgeyBfTV9pbml0aWFsaXplX251bXB1bmN0KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBJbnRlcm5hbCBjb25zdHJ1Y3Rvci4gIE5vdCBmb3IgZ2VuZXJhbCB1c2UuCisgICAgICAgKgorICAgICAgICogIFRoaXMgaXMgYSBjb25zdHJ1Y3RvciBmb3IgdXNlIGJ5IHRoZSBsaWJyYXJ5IGl0c2VsZiB0byBzZXQgdXAgbmV3CisgICAgICAgKiAgbG9jYWxlcy4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtICBfX2Nsb2MgIFRoZSBDIGxvY2FsZS4KKyAgICAgICAqICBAcGFyYW0gIF9fcmVmcyAgUmVmY291bnQgdG8gcGFzcyB0byB0aGUgYmFzZSBjbGFzcy4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIG51bXB1bmN0KF9fY19sb2NhbGUgX19jbG9jLCBzaXplX3QgX19yZWZzID0gMCkKKyAgICAgIDogZmFjZXQoX19yZWZzKSwgX01fZGF0YSgwKQorICAgICAgeyBfTV9pbml0aWFsaXplX251bXB1bmN0KF9fY2xvYyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gZGVjaW1hbCBwb2ludCBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIGNoYXJfdHlwZSB0byB1c2UgYXMgYSBkZWNpbWFsIHBvaW50LiAgSXQKKyAgICAgICAqICBkb2VzIHNvIGJ5IHJldHVybmluZyByZXR1cm5pbmcKKyAgICAgICAqICBudW1wdW5jdDxjaGFyX3R5cGU+Ojpkb19kZWNpbWFsX3BvaW50KCkuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIEBhIGNoYXJfdHlwZSByZXByZXNlbnRpbmcgYSBkZWNpbWFsIHBvaW50LgorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZQorICAgICAgZGVjaW1hbF9wb2ludCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19kZWNpbWFsX3BvaW50KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gdGhvdXNhbmRzIHNlcGFyYXRvciBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIGNoYXJfdHlwZSB0byB1c2UgYXMgYSB0aG91c2FuZHMKKyAgICAgICAqICBzZXBhcmF0b3IuICBJdCBkb2VzIHNvIGJ5IHJldHVybmluZyByZXR1cm5pbmcKKyAgICAgICAqICBudW1wdW5jdDxjaGFyX3R5cGU+Ojpkb190aG91c2FuZHNfc2VwKCkuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIGNoYXJfdHlwZSByZXByZXNlbnRpbmcgYSB0aG91c2FuZHMgc2VwYXJhdG9yLgorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZQorICAgICAgdGhvdXNhbmRzX3NlcCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb190aG91c2FuZHNfc2VwKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaW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9yIGRlcml2ZWQgY2xhc3NlcyB0byBjaGFuZ2UgdGhlCisgICAgICAgKiAgdmFsdWUgcmV0dXJuZWQuICBAc2VlIGdyb3VwaW5nKCkgZm9yIGRldGFpbHMuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIFN0cmluZyByZXByZXNlbnRpbmcgZ3JvdXBpbmcgc3BlY2lmaWNhdGlvbi4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIHN0cmluZworICAgICAgZG9fZ3JvdXBpbmcoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZGF0YS0+X01fZ3JvdXBpbmc7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gc3RyaW5nIHJlcHJlc2VudGF0aW9uIG9mIGJvb2wgdHJ1ZS4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIHN0cmluZ190eXBlIGNvbnRhaW5pbmcgdGhlIHRleHQgcmVwcmVzZW50YXRpb24gZm9yIHRydWUKKyAgICAgICAqICBib29sIHZhcmlhYmxlcy4gIFRoaXMgZnVuY3Rpb24gaXMgYSBob29rIGZvciBkZXJpdmVkIGNsYXNzZXMgdG8KKyAgICAgICAqICBjaGFuZ2UgdGhlIHZhbHVlIHJldHVybmVkLgorICAgICAgICoKKyAgICAgICAqICBAcmV0dXJuICBzdHJpbmdfdHlwZSByZXByZXNlbnRpbmcgcHJpbnRlZCBmb3JtIG9mIHRydWUuCisgICAgICAqLworICAgICAgdmlydHVhbCBzdHJpbmdfdHlwZQorICAgICAgZG9fdHJ1ZW5hbWUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZGF0YS0+X01fdHJ1ZW5hbWU7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gc3RyaW5nIHJlcHJlc2VudGF0aW9uIG9mIGJvb2wgZmFsc2UuCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgYSBzdHJpbmdfdHlwZSBjb250YWluaW5nIHR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cGluZywgc2l6ZV90IF9fZ3JvdXBpbmdfc2l6ZSwKKwkJICAgY2hhcl90eXBlIF9fc2VwLCBpb3NfYmFzZSYgX19pbywgY2hhcl90eXBlKiBfX25ldywKKwkJICAgY2hhcl90eXBlKiBfX2NzLCBpbnQmIF9fbGVuKSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgX01fcGFkKGNoYXJfdHlwZSBfX2ZpbGwsIHN0cmVhbXNpemUgX193LCBpb3NfYmFzZSYgX19pbywKKwkgICAgIGNoYXJfdHlwZSogX19uZXcsIGNvbnN0IGNoYXJfdHlwZSogX19jcywgaW50JiBfX2xlbikgY29uc3Q7CisKKyAgICAgIC8vLyBEZXN0cnVjdG9yLgorICAgICAgdmlydHVhbAorICAgICAgfm51bV9wdXQoKSB7IH07CisKKyAgICAgIC8vQHsKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTnVtZXJpYyBmb3JtYXR0aW5nLgorICAgICAgICoKKyAgICAgICAqICBUaGVzZSBmdW5jdGlvbnMgZG8gdGhlIHdvcmsgb2YgZm9ybWF0dGluZyBudW1lcmljIHZhbHVlcyBhbmQKKyAgICAgICAqICBpbnNlcnRpbmcgdGhlbSBpbnRvIGEgc3RyZWFtLiBUaGlzIGZ1bmN0aW9uIGlzIGEgaG9vayBmb3IgZGVyaXZlZAorICAgICAgICogIGNsYXNzZXMgdG8gY2hhbmdlIHRoZSB2YWx1ZSByZXR1cm5lZC4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFN0cmVhbSB0byB3cml0ZSB0by4KKyAgICAgICAqICBAcGFyYW0gIF9faW8gIFNvdXJjZSBvZiBsb2NhbGUgYW5kIGZsYWdzLgorICAgICAgICogIEBwYXJhbSAgX19maWxsICBDaGFyX3R5cGUgdG8gdXNlIGZvciBmaWxsaW5nLgorICAgICAgICogIEBwYXJhbSAgX192ICBWYWx1ZSB0byBmb3JtYXQgYW5kIGluc2VydC4KKyAgICAgICAqICBAcmV0dXJuICB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ghX19mb3VuZF9tYW50aXNzYSkKKwkJeworCQkgIF9feHRyYyArPSAnMCc7CisJCSAgX19mb3VuZF9tYW50aXNzYSA9IHRydWU7CisJCX0KKwkgICAgICArK19fc2VwX3BvczsKKworCSAgICAgIGlmICgrK19fYmVnICE9IF9fZW5kKQorCQlfX2MgPSAqX19iZWc7CisJICAgICAgZWxzZQorCQlfX3Rlc3Rlb2YgPSB0cnVlOworCSAgICB9CisJICBlbHNlCisJICAgIGJyZWFrOworCX0KKworICAgICAgLy8gT25seSBuZWVkIGFjY2VwdGFibGUgZGlnaXRzIGZvciBmbG9hdGluZyBwb2ludCBudW1iZXJzLgorICAgICAgYm9vbCBfX2ZvdW5kX2RlYyA9IGZhbHNlOworICAgICAgYm9vbCBfX2ZvdW5kX3NjaSA9IGZhbHNlOworICAgICAgc3RyaW5nIF9fZm91bmRfZ3JvdXBpbmc7CisgICAgICBpZiAoX19sYy0+X01fdXNlX2dyb3VwaW5nKQorCV9fZm91bmRfZ3JvdXBpbmcucmVzZXJ2ZSgzMik7CisgICAgICBjb25zdCBjaGFyX3R5cGUqIF9fbGl0X3plcm8gPSBfX2xpdCArIF9fbnVtX2Jhc2U6Ol9TX2l6ZXJvOworCisgICAgICBpZiAoIV9fbGMtPl9NX2FsbG9jYXRlZCkKKwkvLyAiQyIgbG9jYWxlCisJd2hpbGUgKCFfX3Rlc3Rlb2YpCisJICB7CisJICAgIGNvbnN0IGludCBfX2RpZ2l0ID0gX01fZmluZChfX2xpdF96ZXJvLCAxMCwgX19jKTsKKwkgICAgaWYgKF9fZGlnaXQgIT0gLTEpCisJICAgICAgeworCQlfX3h0cmMgKz0gJzAnICsgX19kaWdpdDsKKwkJX19mb3VuZF9tYW50aXNzYSA9IHRydWU7CisJICAgICAgfQorCSAgICBlbHNlIGlmIChfX2MgPT0gX19sYy0+X01fZGVjaW1hbF9wb2ludAorCQkgICAgICYmICFfX2ZvdW5kX2RlYyAmJiAhX19mb3VuZF9zY2kpCisJICAgICAgeworC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uZWYgfHwgIV9fZG9uZXQpCisJICAgIHsKKwkgICAgICBpZiAoX19iZWcgPT0gX19lbmQpCisJCXsKKwkJICBfX3Rlc3Rlb2YgPSB0cnVlOworCQkgIGJyZWFrOworCQl9CisKKwkgICAgICBjb25zdCBjaGFyX3R5cGUgX19jID0gKl9fYmVnOworCisJICAgICAgaWYgKCFfX2RvbmVmKQorCQlfX3Rlc3RmID0gX19jID09IF9fbGMtPl9NX2ZhbHNlbmFtZVtfX25dOworCisJICAgICAgaWYgKCFfX3Rlc3RmICYmIF9fZG9uZXQpCisJCWJyZWFrOworCisJICAgICAgaWYgKCFfX2RvbmV0KQorCQlfX3Rlc3R0ID0gX19jID09IF9fbGMtPl9NX3RydWVuYW1lW19fbl07CisKKwkgICAgICBpZiAoIV9fdGVzdHQgJiYgX19kb25lZikKKwkJYnJlYWs7CisKKwkgICAgICBpZiAoIV9fdGVzdHQgJiYgIV9fdGVzdGYpCisJCWJyZWFrOworCisJICAgICAgKytfX247CisJICAgICAgKytfX2JlZzsKKworCSAgICAgIF9fZG9uZWYgPSAhX190ZXN0ZiB8fCBfX24gPj0gX19sYy0+X01fZmFsc2VuYW1lX3NpemU7CisJICAgICAgX19kb25ldCA9ICFfX3Rlc3R0IHx8IF9fbiA+PSBfX2xjLT5fTV90cnVlbmFtZV9zaXplOworCSAgICB9CisJICBpZiAoX190ZXN0ZiAmJiBfX24gPT0gX19sYy0+X01fZmFsc2VuYW1lX3NpemUgJiYgX19uKQorCSAgICB7CisJICAgICAgX192ID0gZmFsc2U7CisJICAgICAgaWYgKF9fdGVzdHQgJiYgX19uID09IF9fbGMtPl9NX3RydWVuYW1lX3NpemUpCisJCV9fZXJyID0gaW9zX2Jhc2U6OmZhaWxiaXQ7CisJICAgICAgZWxzZQorCQlfX2VyciA9IF9fdGVzdGVvZiA/IGlvc19iYXNlOjplb2ZiaXQgOiBpb3NfYmFzZTo6Z29vZGJpdDsKKwkgICAgfQorCSAgZWxzZSBpZiAoX190ZXN0dC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vbnN0CisgICAgeworICAgICAgc3RyaW5nIF9feHRyYzsKKyAgICAgIF9feHRyYy5yZXNlcnZlKDMyKTsKKyAgICAgIF9fYmVnID0gX01fZXh0cmFjdF9mbG9hdChfX2JlZywgX19lbmQsIF9faW8sIF9fZXJyLCBfX3h0cmMpOworICAgICAgc3RkOjpfX2NvbnZlcnRfdG9fdihfX3h0cmMuY19zdHIoKSwgX192LCBfX2VyciwgX1NfZ2V0X2NfbG9jYWxlKCkpOworICAgICAgaWYgKF9fYmVnID09IF9fZW5kKQorCV9fZXJyIHw9IGlvc19iYXNlOjplb2ZiaXQ7CisgICAgICByZXR1cm4gX19iZWc7CisgICAgfQorI2VuZGlmCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfSW5JdGVyPgorICAgIF9Jbkl0ZXIKKyAgICBudW1fZ2V0PF9DaGFyVCwgX0luSXRlcj46OgorICAgIGRvX2dldChpdGVyX3R5cGUgX19iZWcsIGl0ZXJfdHlwZSBfX2VuZCwgaW9zX2Jhc2UmIF9faW8sCisgICAgICAgICAgIGlvc19iYXNlOjppb3N0YXRlJiBfX2VyciwgbG9uZyBkb3VibGUmIF9fdikgY29uc3QKKyAgICB7CisgICAgICBzdHJpbmcgX194dHJjOworICAgICAgX194dHJjLnJlc2VydmUoMzIpOworICAgICAgX19iZWcgPSBfTV9leHRyYWN0X2Zsb2F0KF9fYmVnLCBfX2VuZCwgX19pbywgX19lcnIsIF9feHRyYyk7CisgICAgICBzdGQ6Ol9fY29udmVydF90b192KF9feHRyYy5jX3N0cigpLCBfX3YsIF9fZXJyLCBfU19nZXRfY19sb2NhbGUoKSk7CisgICAgICBpZiAoX19iZWcgPT0gX19lbmQpCisJX19lcnIgfD0gaW9zX2Jhc2U6OmVvZmJpdDsKKyAgICAgIHJldHVybiBfX2JlZzsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfSW5JdGVyPg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MTApICsgX19udW1fYmFzZTo6X1Nfb2RpZ2l0c107CisJICAgICAgX192IC89IDEwOworCSAgICB9CisJICB3aGlsZSAoX192ICE9IDApOworCX0KKyAgICAgIGVsc2UgaWYgKChfX2ZsYWdzICYgaW9zX2Jhc2U6OmJhc2VmaWVsZCkgPT0gaW9zX2Jhc2U6Om9jdCkKKwl7CisJICAvLyBPY3RhbC4KKwkgIGRvCisJICAgIHsKKwkgICAgICAqLS1fX2J1ZiA9IF9fbGl0WyhfX3YgJiAweDcpICsgX19udW1fYmFzZTo6X1Nfb2RpZ2l0c107CisJICAgICAgX192ID4+PSAzOworCSAgICB9CisJICB3aGlsZSAoX192ICE9IDApOworCX0KKyAgICAgIGVsc2UKKwl7CisJICAvLyBIZXguCisJICBjb25zdCBib29sIF9fdXBwZXJjYXNlID0gX19mbGFncyAmIGlvc19iYXNlOjp1cHBlcmNhc2U7CisJICBjb25zdCBpbnQgX19jYXNlX29mZnNldCA9IF9fdXBwZXJjYXNlID8gX19udW1fYmFzZTo6X1Nfb3VkaWdpdHMKKwkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBfX251bV9iYXNlOjpfU19vZGlnaXRzOworCSAgZG8KKwkgICAgeworCSAgICAgICotLV9fYnVmID0gX19saXRbKF9fdiAmIDB4ZikgKyBfX2Nhc2Vfb2Zmc2V0XTsKKwkgICAgICBfX3YgPj49IDQ7CisJICAgIH0KKwkgIHdoaWxlIChfX3YgIT0gMCk7CisJfQorICAgICAgcmV0dXJuIF9fYnVmZW5kIC0gX19idWY7CisgICAgfQorCitfR0xJQkNYWF9CRUdJTl9OQU1FU1BBQ0VfTERCTAorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX091dEl0ZXI+CisgICAgdm9pZAorICAgIG51bV9wdXQ8X0NoYXJULCBfT3V0SXRlcj46OgorICAgIF9NX2dyb3VwX2ludChjb25zdCBjaGFyKiBfX2dyb3VwaW5nLCBzaX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ICBpZiAoX19iYXNlZmllbGQgPT0gaW9zX2Jhc2U6Om9jdCkKKwkgICAgICAqLS1fX2NzID0gX19saXRbX19udW1fYmFzZTo6X1Nfb2RpZ2l0c10sICsrX19sZW47CisJICAgIGVsc2UKKwkgICAgICB7CisJCS8vICd4JyBvciAnWCcKKwkJY29uc3QgYm9vbCBfX3VwcGVyY2FzZSA9IF9fZmxhZ3MgJiBpb3NfYmFzZTo6dXBwZXJjYXNlOworCQkqLS1fX2NzID0gX19saXRbX19udW1fYmFzZTo6X1Nfb3ggKyBfX3VwcGVyY2FzZV07CisJCS8vICcwJworCQkqLS1fX2NzID0gX19saXRbX19udW1fYmFzZTo6X1Nfb2RpZ2l0c107CisJCV9fbGVuICs9IDI7CisJICAgICAgfQorCSAgfQorCisJLy8gUGFkLgorCWNvbnN0IHN0cmVhbXNpemUgX193ID0gX19pby53aWR0aCgpOworCWlmIChfX3cgPiBzdGF0aWNfY2FzdDxzdHJlYW1zaXplPihfX2xlbikpCisJICB7CisJICAgIF9DaGFyVCogX19jczMgPSBzdGF0aWNfY2FzdDxfQ2hhclQqPihfX2J1aWx0aW5fYWxsb2NhKHNpemVvZihfQ2hhclQpCisJCQkJCQkJCSAgKiBfX3cpKTsKKwkgICAgX01fcGFkKF9fZmlsbCwgX193LCBfX2lvLCBfX2NzMywgX19jcywgX19sZW4pOworCSAgICBfX2NzID0gX19jczM7CisJICB9CisJX19pby53aWR0aCgwKTsKKworCS8vIFsyMi4yLjIuMi4yXSBTdGFnZSA0LgorCS8vIFdyaXRlIHJlc3VsdGluZywgZnVsbHktZm9ybWF0dGVkIHN0cmluZyB0byBvdXRwdXQgaXRlcmF0b3IuCisJcmV0dXJuIHN0ZDo6X193cml0ZShfX3MsIF9fY3MsIF9fbGVuKTsKKyAgICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9PdXRJdGVyPgorICAgIHZvaWQKKyAgICBudW1fcHV0PF9DaGFyVCw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IEFiYnJldmlhdGVkIGRheSBuYW1lcywgc3RhcnRpbmcgd2l0aCAiQyIncyBTdW4uCisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTE7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTI7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTM7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTQ7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTU7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTY7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fYWRheTc7CisKKyAgICAgIC8vIE1vbnRoIG5hbWVzLCBzdGFydGluZyB3aXRoICJDIidzIEphbnVhcnkuCisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fbW9udGgwMTsKKyAgICAgIGNvbnN0IF9DaGFyVCoJCQlfTV9tb250aDAyOworICAgICAgY29uc3QgX0NoYXJUKgkJCV9NX21vbnRoMDM7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fbW9udGgwNDsKKyAgICAgIGNvbnN0IF9DaGFyVCoJCQlfTV9tb250aDA1OworICAgICAgY29uc3QgX0NoYXJUKgkJCV9NX21vbnRoMDY7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fbW9udGgwNzsKKyAgICAgIGNvbnN0IF9DaGFyVCoJCQlfTV9tb250aDA4OworICAgICAgY29uc3QgX0NoYXJUKgkJCV9NX21vbnRoMDk7CisgICAgICBjb25zdCBfQ2hhclQqCQkJX01fbW9udGgxMDsKKyAgICAgIGNvbnN0IF9DaGFyVCoJCQlfTV9tb250aDExOworICAgICAgY29uc3QgX0NoYXJUKgkJCV9NX21vbnRoMTI7CisKKyAgICAgIC8vIEFiYnJldmlhdGVkIG1vbnRoIG5hbWVzLCBzdGFydGluZyB3aXRoICJDIidzIEphbi4KKyAgICAgIGNvbnN0IF9DaGFyVCoJCQlfTV9hbW9udGgwMTsKKyAgICAgIGNv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GF5MygwKSwgX01fYWRheTQoMCksCisgICAgICBfTV9hZGF5NSgwKSwgX01fYWRheTYoMCksIF9NX2FkYXk3KDApLCBfTV9tb250aDAxKDApLAorICAgICAgX01fbW9udGgwMigwKSwgX01fbW9udGgwMygwKSwgX01fbW9udGgwNCgwKSwgX01fbW9udGgwNSgwKSwKKyAgICAgIF9NX21vbnRoMDYoMCksIF9NX21vbnRoMDcoMCksIF9NX21vbnRoMDgoMCksIF9NX21vbnRoMDkoMCksCisgICAgICBfTV9tb250aDEwKDApLCBfTV9tb250aDExKDApLCBfTV9tb250aDEyKDApLCBfTV9hbW9udGgwMSgwKSwKKyAgICAgIF9NX2Ftb250aDAyKDApLCBfTV9hbW9udGgwMygwKSwgX01fYW1vbnRoMDQoMCksCisgICAgICBfTV9hbW9udGgwNSgwKSwgX01fYW1vbnRoMDYoMCksIF9NX2Ftb250aDA3KDApLAorICAgICAgX01fYW1vbnRoMDgoMCksIF9NX2Ftb250aDA5KDApLCBfTV9hbW9udGgxMCgwKSwKKyAgICAgIF9NX2Ftb250aDExKDApLCBfTV9hbW9udGgxMigwKSwgX01fYWxsb2NhdGVkKGZhbHNlKQorICAgICAgeyB9CisKKyAgICAgIH5fX3RpbWVwdW5jdF9jYWNoZSgpOworCisgICAgICB2b2lkCisgICAgICBfTV9jYWNoZShjb25zdCBsb2NhbGUmIF9fbG9jKTsKKworICAgIHByaXZhdGU6CisgICAgICBfX3RpbWVwdW5jdF9jYWNoZSYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfX3RpbWVwdW5jdF9jYWNoZSYpOworICAgICAgCisgICAgICBleHBsaWNpdAorICAgICAgX190aW1lcHVuY3RfY2FjaGUoY29uc3QgX190aW1lcHVuY3RfY2FjaGUmKTsKKyAgICB9OworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVD4KKyAgICBfX3RpbWVwdW5jdF9jYWNoZTxfQ2hhclQ+Ojp+X190aW1lcHVuY3RfY2FjaGUoKQorICAgIHsKK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sKKwlfX2FtcG1bMV0gPSBfTV9kYXRhLT5fTV9wbTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZGF5cyhjb25zdCBfQ2hhclQqKiBfX2RheXMpIGNvbnN0CisgICAgICB7CisJX19kYXlzWzBdID0gX01fZGF0YS0+X01fZGF5MTsKKwlfX2RheXNbMV0gPSBfTV9kYXRhLT5fTV9kYXkyOworCV9fZGF5c1syXSA9IF9NX2RhdGEtPl9NX2RheTM7CisJX19kYXlzWzNdID0gX01fZGF0YS0+X01fZGF5NDsKKwlfX2RheXNbNF0gPSBfTV9kYXRhLT5fTV9kYXk1OworCV9fZGF5c1s1XSA9IF9NX2RhdGEtPl9NX2RheTY7CisJX19kYXlzWzZdID0gX01fZGF0YS0+X01fZGF5NzsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZGF5c19hYmJyZXZpYXRlZChjb25zdCBfQ2hhclQqKiBfX2RheXMpIGNvbnN0CisgICAgICB7CisJX19kYXlzWzBdID0gX01fZGF0YS0+X01fYWRheTE7CisJX19kYXlzWzFdID0gX01fZGF0YS0+X01fYWRheTI7CisJX19kYXlzWzJdID0gX01fZGF0YS0+X01fYWRheTM7CisJX19kYXlzWzNdID0gX01fZGF0YS0+X01fYWRheTQ7CisJX19kYXlzWzRdID0gX01fZGF0YS0+X01fYWRheTU7CisJX19kYXlzWzVdID0gX01fZGF0YS0+X01fYWRheTY7CisJX19kYXlzWzZdID0gX01fZGF0YS0+X01fYWRheTc7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX21vbnRocyhjb25zdCBfQ2hhclQqKiBfX21vbnRocykgY29uc3QKKyAgICAgIHsKKwlfX21vbnRoc1swXSA9IF9NX2RhdGEtPl9NX21vbnRoMDE7CisJX19tb250aHNbMV0gPSBfTV9kYXRhLT5fTV9tb250aDAyOworCV9fbW9udGhzWzJdID0gX01fZGF0YS0+X01fbW9udGgwMzsKKwlfX21vbnRoc1szXSA9IF9NX2RhdGEtPl9NX21vbnRoMDQ7CisJX19tb250aHNbNF0gPSBfTV9kYXRhLT5fTV9tb250aDA1OworCV9fbW9udGhzWzVdID0gX01fZGF0YS0+X01fbW9udGgwNjsKKwlfX21vbnRoc1s2XSA9IF9NX2RhdGEtPl9NX21vbnRoMDc7CisJX19tb250aHNbN10gPSBfTV9kYXRhLT5fTV9tb250aDA4OworCV9fbW9udGhzWzhdID0gX01fZGF0YS0+X01fbW9udGgwOTsKKwlfX21vbnRoc1s5XSA9IF9NX2RhdGEtPl9NX21vbnRoMTA7CisJX19tb250aHNbMTBdID0gX01fZGF0YS0+X01fbW9udGgxMTsKKwlfX21vbnRoc1sxMV0gPSBfTV9kYXRhLT5fTV9tb250aDEyOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9tb250aHNfYWJicmV2aWF0ZWQoY29uc3QgX0NoYXJUKiogX19tb250aHMpIGNvbnN0CisgICAgICB7CisJX19tb250aHNbMF0gPSBfTV9kYXRhLT5fTV9hbW9udGgwMTsKKwlfX21vbnRoc1sxXSA9IF9NX2RhdGEtPl9NX2Ftb250aDAyOworCV9fbW9udGhzWzJdID0gX01fZGF0YS0+X01fYW1vbnRoMDM7CisJX19tb250aHNbM10gPSBfTV9kYXRhLT5fTV9hbW9udGgwNDsKKwlfX21vbnRoc1s0XSA9IF9NX2RhdGEtPl9NX2Ftb250aDA1OworCV9fbW9udGhzWzVdID0gX01fZGF0YS0+X01fYW1vbnRoMDY7CisJX19tb250aHNbNl0gPSBfTV9kYXRhLT5fTV9hbW9udGgwNzsKKwlfX21vbnRoc1s3XSA9IF9NX2RhdGEtPl9NX2Ftb250aDA4OworCV9fbW9udGhzWzhdID0gX01fZGF0YS0+X01fYW1vbnRoMDk7CisJX19tb250aHNbOV0gPSBfTV9kYXRhLT5fTV9hbW9udGgxMDsKKwlfX21vbnRoc1sxMF0gPSBfTV9kYXRhLT5fTV9hbW9udGgxMTsKKwlfX21vbnRoc1sxMV0gPSBfTV9kYXRhLT5f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xlOjpmYWNldCwgcHVibGljIHRpbWVfYmFzZQorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICAvLyBUeXBlczoKKyAgICAgIC8vQHsKKyAgICAgIC8vLyBQdWJsaWMgdHlwZWRlZnMKKyAgICAgIHR5cGVkZWYgX0NoYXJUCQkJY2hhcl90eXBlOworICAgICAgdHlwZWRlZiBfSW5JdGVyCQkJaXRlcl90eXBlOworICAgICAgLy9AfQorICAgICAgdHlwZWRlZiBiYXNpY19zdHJpbmc8X0NoYXJUPglfX3N0cmluZ190eXBlOworCisgICAgICAvLy8gTnVtcHVuY3QgZmFjZXQgaWQuCisgICAgICBzdGF0aWMgbG9jYWxlOjppZAkJCWlkOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdG9yIHBlcmZvcm1zIGluaXRpYWxpemF0aW9uLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIHRoZSBjb25zdHJ1Y3RvciBwcm92aWRlZCBieSB0aGUgc3RhbmRhcmQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX3JlZnMgIFBhc3NlZCB0byB0aGUgYmFzZSBmYWNldCBjbGFzcy4KKyAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgdGltZV9nZXQoc2l6ZV90IF9fcmVmcyA9IDApCisgICAgICA6IGZhY2V0IChfX3JlZnMpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBwcmVmZXJyZWQgb3JkZXIgb2YgbW9udGgsIGRheSwgYW5kIHllYXIuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhbiBlbnVtIGZyb20gdGltZWJhc2U6OmRhdGVvcmRlciBnaXZpbmcgdGhlCisgICAgICAgKiAgcHJlZmVycmVkIG9yZGVyaW5nIGlmIHRoZSBmb3JtYXQgQGEgeCBnaXZlbiB0byB0aW1lX3B1dDo6cHV0KCkgb25seQorICAgICAgICogIHVzZXMgb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Bsb2NhbGU6OmZhY2V0CisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIC8vIFR5cGVzOgorICAgICAgLy9AeworICAgICAgLy8vIFB1YmxpYyB0eXBlZGVmcworICAgICAgdHlwZWRlZiBfQ2hhclQJCQljaGFyX3R5cGU7CisgICAgICB0eXBlZGVmIF9PdXRJdGVyCQkJaXRlcl90eXBlOworICAgICAgLy9AfQorCisgICAgICAvLy8gTnVtcHVuY3QgZmFjZXQgaWQuCisgICAgICBzdGF0aWMgbG9jYWxlOjppZAkJCWlkOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdG9yIHBlcmZvcm1zIGluaXRpYWxpemF0aW9uLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIHRoZSBjb25zdHJ1Y3RvciBwcm92aWRlZCBieSB0aGUgc3RhbmRhcmQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSBfX3JlZnMgIFBhc3NlZCB0byB0aGUgYmFzZSBmYWNldCBjbGFzcy4KKyAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgdGltZV9wdXQoc2l6ZV90IF9fcmVmcyA9IDApCisgICAgICA6IGZhY2V0KF9fcmVmcykgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRm9ybWF0IGFuZCBvdXRwdXQgYSB0aW1lIG9yIGRhdGUuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gZm9ybWF0cyB0aGUgZGF0YSBpbiBzdHJ1Y3QgdG0gYWNjb3JkaW5nIHRvIHRoZQorICAgICAgICogIHByb3ZpZGVkIGZvcm1hdCBzdHJpbmcuICBUaGUgZm9ybWF0IHN0cmluZyBpcyBpbnRlcnByZXRlZCBhcyBieQorICAgICAgICogIHN0cmZ0aW1lKCkuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgc3RyZWFtIHRvIHdyaXRlIHRvLgorICAgICAgICogIEBwYXJhbSAgX19pbyA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JUCQkJCV9NX2F0b21zW21vbmV5X2Jhc2U6Ol9TX2VuZF07CisKKyAgICAgIGJvb2wJCQkJX01fYWxsb2NhdGVkOworCisgICAgICBfX21vbmV5cHVuY3RfY2FjaGUoc2l6ZV90IF9fcmVmcyA9IDApIDogZmFjZXQoX19yZWZzKSwKKyAgICAgIF9NX2dyb3VwaW5nKDApLCBfTV9ncm91cGluZ19zaXplKDApLCBfTV91c2VfZ3JvdXBpbmcoZmFsc2UpLAorICAgICAgX01fZGVjaW1hbF9wb2ludChfQ2hhclQoKSksIF9NX3Rob3VzYW5kc19zZXAoX0NoYXJUKCkpLAorICAgICAgX01fY3Vycl9zeW1ib2woMCksIF9NX2N1cnJfc3ltYm9sX3NpemUoMCksCisgICAgICBfTV9wb3NpdGl2ZV9zaWduKDApLCBfTV9wb3NpdGl2ZV9zaWduX3NpemUoMCksCisgICAgICBfTV9uZWdhdGl2ZV9zaWduKDApLCBfTV9uZWdhdGl2ZV9zaWduX3NpemUoMCksCisgICAgICBfTV9mcmFjX2RpZ2l0cygwKSwKKyAgICAgIF9NX3Bvc19mb3JtYXQobW9uZXlfYmFzZTo6cGF0dGVybigpKSwKKyAgICAgIF9NX25lZ19mb3JtYXQobW9uZXlfYmFzZTo6cGF0dGVybigpKSwgX01fYWxsb2NhdGVkKGZhbHNlKQorICAgICAgeyB9CisKKyAgICAgIH5fX21vbmV5cHVuY3RfY2FjaGUoKTsKKworICAgICAgdm9pZAorICAgICAgX01fY2FjaGUoY29uc3QgbG9jYWxlJiBfX2xvYyk7CisKKyAgICBwcml2YXRlOgorICAgICAgX19tb25leXB1bmN0X2NhY2hlJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IF9fbW9uZXlwdW5jdF9jYWNoZSYpOworICAgICAgCisgICAgICBleHBsaWNpdAorICAgICAgX19tb25leXB1bmN0X2NhY2hlKGNvbnN0IF9fbW9uZXlwdW5jdF9jYWNoZSYpOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUg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gICAgICAqICBkb2VzIHNvIGJ5IHJldHVybmluZyByZXR1cm5pbmcKKyAgICAgICAqICBtb25leXB1bmN0PGNoYXJfdHlwZT46OmRvX2RlY2ltYWxfcG9pbnQoKS4KKyAgICAgICAqCisgICAgICAgKiAgQHJldHVybiAgQGEgY2hhcl90eXBlIHJlcHJlc2VudGluZyBhIGRlY2ltYWwgcG9pbnQuCisgICAgICAqLworICAgICAgY2hhcl90eXBlCisgICAgICBkZWNpbWFsX3BvaW50KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX2RlY2ltYWxfcG9pbnQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiB0aG91c2FuZHMgc2VwYXJhdG9yIGNoYXJhY3Rlci4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiByZXR1cm5zIGEgY2hhcl90eXBlIHRvIHVzZSBhcyBhIHRob3VzYW5kcworICAgICAgICogIHNlcGFyYXRvci4gIEl0IGRvZXMgc28gYnkgcmV0dXJuaW5nIHJldHVybmluZworICAgICAgICogIG1vbmV5cHVuY3Q8Y2hhcl90eXBlPjo6ZG9fdGhvdXNhbmRzX3NlcCgpLgorICAgICAgICoKKyAgICAgICAqICBAcmV0dXJuICBjaGFyX3R5cGUgcmVwcmVzZW50aW5nIGEgdGhvdXNhbmRzIHNlcGFyYXRvci4KKyAgICAgICovCisgICAgICBjaGFyX3R5cGUKKyAgICAgIHRob3VzYW5kc19zZXAoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fdGhvdXNhbmRzX3NlcCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGdyb3VwaW5nIHNwZWNpZmljYXRpb24uCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIHN0cmluZyByZXByZXNlbnRpbmcgZ3JvdXBpbmdzIGZvciB0aGUKKyAgICAgICAqIC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RoaXMgd291bGQKKyAgICAgICAqICBwdXQgbW9yZSB0aGFuIDUwIGRpZ2l0cyBpbnRvIHRoZSBsZWFzdCBzaWduaWZpY2FudCBncm91cCBpZgorICAgICAgICogIHRoZSBjaGFyYWN0ZXIgc2V0IGlzIEFTQ0lJLgorICAgICAgICoKKyAgICAgICAqICBUaGUgc3RyaW5nIGlzIHJldHVybmVkIGJ5IGNhbGxpbmcKKyAgICAgICAqICBtb25leXB1bmN0PGNoYXJfdHlwZT46OmRvX2dyb3VwaW5nKCkuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIHN0cmluZyByZXByZXNlbnRpbmcgZ3JvdXBpbmcgc3BlY2lmaWNhdGlvbi4KKyAgICAgICovCisgICAgICBzdHJpbmcKKyAgICAgIGdyb3VwaW5nKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRvX2dyb3VwaW5nKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gY3VycmVuY3kgc3ltYm9sIHN0cmluZy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiByZXR1cm5zIGEgc3RyaW5nX3R5cGUgdG8gdXNlIGFzIGEgY3VycmVuY3kgc3ltYm9sLiAgSXQKKyAgICAgICAqICBkb2VzIHNvIGJ5IHJldHVybmluZyByZXR1cm5pbmcKKyAgICAgICAqICBtb25leXB1bmN0PGNoYXJfdHlwZT46OmRvX2N1cnJfc3ltYm9sKCkuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIEBhIHN0cmluZ190eXBlIHJlcHJlc2VudGluZyBhIGN1cnJlbmN5IHN5bWJvbC4KKyAgICAgICovCisgICAgICBzdHJpbmdfdHlwZQorICAgICAgY3Vycl9zeW1ib2woKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fY3Vycl9zeW1ib2woKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBwb3NpdG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uZAorICAgICAgICogIG9wdGlvbnMgc2V0IHRvIGZvcmNlIHRoZSBzeW1ib2wsIHRoZSBjb3JyZXNwb25kaW5nIHN0cmluZyBpcworICAgICAgICogIDxjb2RlPiQrMTAuMDE8L2NvZGU+LgorICAgICAgICoKKyAgICAgICAqICBAcmV0dXJuICBQYXR0ZXJuIGZvciBtb25leSB2YWx1ZXMuCisgICAgICAqLworICAgICAgcGF0dGVybgorICAgICAgcG9zX2Zvcm1hdCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19wb3NfZm9ybWF0KCk7IH0KKworICAgICAgcGF0dGVybgorICAgICAgbmVnX2Zvcm1hdCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19uZWdfZm9ybWF0KCk7IH0KKyAgICAgIC8vQH0KKworICAgIHByb3RlY3RlZDoKKyAgICAgIC8vLyBEZXN0cnVjdG9yLgorICAgICAgdmlydHVhbAorICAgICAgfm1vbmV5cHVuY3QoKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gZGVjaW1hbCBwb2ludCBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgYSBjaGFyX3R5cGUgdG8gdXNlIGFzIGEgZGVjaW1hbCBwb2ludC4gIFRoaXMgZnVuY3Rpb24gaXMgYQorICAgICAgICogIGhvb2sgZm9yIGRlcml2ZWQgY2xhc3NlcyB0byBjaGFuZ2UgdGhlIHZhbHVlIHJldHVybmVkLgorICAgICAgICoKKyAgICAgICAqICBAcmV0dXJuICBAYSBjaGFyX3R5cGUgcmVwcmVzZW50aW5nIGEgZGVjaW1hbCBwb2ludC4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGNoYXJfdHlwZQorICAgICAgZG9fZGVjaW1hbF9wb2ludCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9kYXRhLT5fTV9kZWNpbWFsX3BvaW50OyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIHRob3VzYW5kcyBzZXBhcmF0b3IgY2hhcmFjdGVyLgorICAgICAgICoKKyAgICAgICAqICBSZXR1cm5zIGEgY2hhcl90eXBlIHRvIHVzZSBhcyBhIHRob3VzYW5kcyBzZXBhcmF0b3IuICBUaGlzIGZ1bmN0aW9uCisgICAgICAgKiAgaXMgYSBob29rIGZvciBkZXJpdmVkIGNsYXNzZXMgdG8gY2hhbmdlIHRoZSB2YWx1ZSByZXR1cm5lZC4KKyAgICAgICAqCisgICAgICAgKiAgQHJldHVybiAgQGEgY2hhcl90eXBlIHJlcHJlc2VudGluZyBhIHRob3VzYW5kcyBzZXBhcmF0b3IuCisgICAgICAqLworICAgICAgdmlydHVhbCBjaGFyX3R5cGUKKyAgICAgIGRvX3Rob3VzYW5kc19zZXAoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZGF0YS0+X01fdGhvdXNhbmRzX3NlcDsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBncm91cGluZyBzcGVjaWZpY2F0aW9uLgorICAgICAgICoKKyAgICAgICAqICBSZXR1cm5zIGEgc3RyaW5nIHJlcHJlc2VudGluZyBncm91cGluZ3MgZm9yIHRoZSBpbnRlZ2VyIHBhcnQgb2YgYQorICAgICAgICogIG51bWJlci4gIFRoaXMgZnVuY3Rpb24gaXMgYSBob29rIGZvciBkZXJpdmVkIGNsYXNzZXMgdG8gY2hhbmdlIHRoZQorICAgICAgICogIHZhbHVlIHJldHVybmVkLiAgQHNlZSBncm91cGluZygpIGZvciBkZXRhaWxzLgorICAgICAgICoKKyAgICAgICAqICBAcmV0dXJuICBTdHJpbmcgcmVwcmVzZW50aW5nIGdyb3VwaW5nIHNwZWNpZmljYXRpb24uCisgICAgICAqLworICAgICAgdmlydHVhbCBzdHJpbmcKKyAgICAgIGRvX2dyb3VwaW5nKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2RhdGEtPl9NX2dyb3VwaW5nOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGN1cnJlbmN5IHN5bWJvbCBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIHN0cmluZ190eXBlIHRvIHVzZSBhcyBhIGN1cnJlbmN5IHN5bWJvbC4KKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGlzIGEgaG9vayBmb3IgZGVyaXZlZCBjbGFzc2VzIHRvIGNoYW5nZSB0aGUgdmFsdWUKKyAgICAgICAqICByZXR1cm5lZC4gIEBzZWUgY3Vycl9zeW1ib2woKSBmb3IgZGV0YWlscy4KKyAgICAgICAqCisgICAgICAgKiAgQHJldHVybiAgQGEgc3RyaW5nX3R5cGUgcmVwcmVzZW50aW5nIGEgY3VycmVuY3kgc3ltYm9sLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgc3RyaW5nX3R5cGUKKyAgICAgIGRvX2N1cnJfc3ltYm9sKCkgICBjb25zdAorICAgICAgeyByZXR1cm4gX01fZGF0YS0+X01fY3Vycl9zeW1ib2w7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gcG9zaXRpdmUgc2lnbiBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIHN0cmluZ190eXBlIHRvIHVzZSBhcyBhIHNpZ24gZm9yIHBvc2l0aXZlCisgICAgICAgKiAgYW1vdW50cy4gIFRoaXMgZnVuY3Rpb24gaXMgYSBob29rIGZvciBkZXJpdmVkIGNsYXNzZXMgdG8gY2hhbmdlIHRoZQorICAgICAgICogIHZhbHVlIHJldHVybmVkLiAgQHNlZSBwb3NpdGl2ZV9zaWduKCkgZm9yIGRldGFpbHMuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIEBhIHN0cmluZ190eXBlIHJlcHJlc2VudGluZyBhIHBvc2l0aXZlIHNpZ24uCisgICAgICAqLworICAgICA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2UgdGhlIHZhbHVlIHJldHVybmVkLiAgQHNlZSBmcmFjX2RpZ2l0cygpCisgICAgICAgKiAgZm9yIGRldGFpbHMuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIE51bWJlciBvZiBkaWdpdHMgaW4gYW1vdW50IGZyYWN0aW9uLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgaW50CisgICAgICBkb19mcmFjX2RpZ2l0cygpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9kYXRhLT5fTV9mcmFjX2RpZ2l0czsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJldHVybiBwYXR0ZXJuIGZvciBtb25leSB2YWx1ZXMuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBhIHBhdHRlcm4gZGVzY3JpYmluZyB0aGUgZm9ybWF0dGluZyBvZiBhCisgICAgICAgKiAgcG9zaXRpdmUgdmFsdWVkIG1vbmV5IGFtb3VudC4gIFRoaXMgZnVuY3Rpb24gaXMgYSBob29rIGZvciBkZXJpdmVkCisgICAgICAgKiAgY2xhc3NlcyB0byBjaGFuZ2UgdGhlIHZhbHVlIHJldHVybmVkLiAgQHNlZSBwb3NfZm9ybWF0KCkgZm9yCisgICAgICAgKiAgZGV0YWlscy4KKyAgICAgICAqCisgICAgICAgKiAgQHJldHVybiAgUGF0dGVybiBmb3IgbW9uZXkgdmFsdWVzLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgcGF0dGVybgorICAgICAgZG9fcG9zX2Zvcm1hdCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9kYXRhLT5fTV9wb3NfZm9ybWF0OyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIHBhdHRlcm4gZm9yIG1vbmV5IHZhbHVlcy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiByZXR1cm5zIGEgcGF0dGVybiBkZXNjcmliaW5nIHRoZSBm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lwZTsKKyAgICAgIC8vQH0KKworICAgICAgLy8vIE51bXB1bmN0IGZhY2V0IGlkLgorICAgICAgc3RhdGljIGxvY2FsZTo6aWQJCQlpZDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb25zdHJ1Y3RvciBwZXJmb3JtcyBpbml0aWFsaXphdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyB0aGUgY29uc3RydWN0b3IgcHJvdmlkZWQgYnkgdGhlIHN0YW5kYXJkLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gX19yZWZzICBQYXNzZWQgdG8gdGhlIGJhc2UgZmFjZXQgY2xhc3MuCisgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIG1vbmV5X3B1dChzaXplX3QgX19yZWZzID0gMCkgOiBmYWNldChfX3JlZnMpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZvcm1hdCBhbmQgb3V0cHV0IGEgbW9uZXRhcnkgdmFsdWUuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gZm9ybWF0cyBAYSB1bml0cyBhcyBhIG1vbmV0YXJ5IHZhbHVlIGFjY29yZGluZyB0bworICAgICAgICogIG1vbmV5cHVuY3QgYW5kIGN0eXBlIGZhY2V0cyByZXRyaWV2ZWQgZnJvbSBpby5nZXRsb2MoKSwgYW5kIHdyaXRlcworICAgICAgICogIHRoZSByZXN1bHRpbmcgY2hhcmFjdGVycyB0byBAYSBfX3MuICBGb3IgZXhhbXBsZSwgdGhlIHZhbHVlIDEwMDEgaW4gYQorICAgICAgICogIFVTIGxvY2FsZSB3b3VsZCB3cml0ZSA8Y29kZT4kMTAuMDE8L2NvZGU+IHRvIEBhIF9fcy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiB3b3JrcyBieSByZXR1cm5pbmcgdGhlIHJlc3VsdCBvZiBkb19wdXQoKS4KKyAgICAgICAqCisgICAgICAgKiAgQH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gICAgICAqICBUaGlzIGlzIGEgY29uc3RydWN0b3IgZm9yIHVzZSBieSB0aGUgbGlicmFyeSBpdHNlbGYgdG8gc2V0IHVwIG5ldworICAgICAgICogIGxvY2FsZXMuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19jbG9jICBUaGUgQyBsb2NhbGUuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFRoZSBuYW1lIG9mIGEgbG9jYWxlLgorICAgICAgICogIEBwYXJhbSAgX19yZWZzICBSZWZjb3VudCB0byBwYXNzIHRvIHRoZSBiYXNlIGNsYXNzLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbWVzc2FnZXMoX19jX2xvY2FsZSBfX2Nsb2MsIGNvbnN0IGNoYXIqIF9fcywgc2l6ZV90IF9fcmVmcyA9IDApOworCisgICAgICAvKgorICAgICAgICogIEBicmllZiAgT3BlbiBhIG1lc3NhZ2UgY2F0YWxvZy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBvcGVucyBhbmQgcmV0dXJucyBhIGhhbmRsZSB0byBhIG1lc3NhZ2UgY2F0YWxvZyBieQorICAgICAgICogIHJldHVybmluZyBkb19vcGVuKF9fcywgX19sb2MpLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9fcyAgVGhlIGNhdGFsb2cgdG8gb3Blbi4KKyAgICAgICAqICBAcGFyYW0gIF9fbG9jICBMb2NhbGUgdG8gdXNlIGZvciBjaGFyYWN0ZXIgc2V0IGNvbnZlcnNpb25zLgorICAgICAgICogIEByZXR1cm4gIEhhbmRsZSB0byB0aGUgY2F0YWxvZyBvciB2YWx1ZSA8IDAgaWYgb3BlbiBmYWlscy4KKyAgICAgICovCisgICAgICBjYXRhbG9nCisgICAgICBvcGVuKGNvbnN0IGJhc2ljX3N0cmluZzxjaGFyPiYgX19zLCBjb25zdCBsb2NhbGUmIF9fbG9jKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZG9fb3B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GRvX2Nsb3NlKGMpLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9fYyAgVGhlIGNhdGFsb2cgdG8gY2xvc2UuCisgICAgICAqLworICAgICAgdm9pZAorICAgICAgY2xvc2UoY2F0YWxvZyBfX2MpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5kb19jbG9zZShfX2MpOyB9CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICAvLy8gRGVzdHJ1Y3Rvci4KKyAgICAgIHZpcnR1YWwKKyAgICAgIH5tZXNzYWdlcygpOworCisgICAgICAvKgorICAgICAgICogIEBicmllZiAgT3BlbiBhIG1lc3NhZ2UgY2F0YWxvZy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBvcGVucyBhbmQgcmV0dXJucyBhIGhhbmRsZSB0byBhIG1lc3NhZ2UgY2F0YWxvZyBpbiBhbgorICAgICAgICogIGltcGxlbWVudGF0aW9uLWRlZmluZWQgbWFubmVyLiAgVGhpcyBmdW5jdGlvbiBpcyBhIGhvb2sgZm9yIGRlcml2ZWQKKyAgICAgICAqICBjbGFzc2VzIHRvIGNoYW5nZSB0aGUgdmFsdWUgcmV0dXJuZWQuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgY2F0YWxvZyB0byBvcGVuLgorICAgICAgICogIEBwYXJhbSAgX19sb2MgIExvY2FsZSB0byB1c2UgZm9yIGNoYXJhY3RlciBzZXQgY29udmVyc2lvbnMuCisgICAgICAgKiAgQHJldHVybiAgSGFuZGxlIHRvIHRoZSBvcGVuZWQgY2F0YWxvZywgdmFsdWUgPCAwIGlmIG9wZW4gZmFpbGVkLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgY2F0YWxvZworICAgICAgZG9fb3Blbihjb25zdCBiYXNpY19zdHJpbmc8Y2hhcj4mLCBjb25zdCBsb2NhbGUmKSBjb25zdDsKKworICAgICAgLyoKKyAgICAgICAqICBAYnJpZWYgIExvb2sgdX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FzZTo6aW9zdGF0ZSBfX3RtcGVyciA9IGlvc19iYXNlOjpnb29kYml0OworICAgICAgc2l6ZV90IF9faSA9IDA7CisgICAgICBmb3IgKDsgX19iZWcgIT0gX19lbmQgJiYgX19pIDwgX19sZW4gJiYgIV9fdG1wZXJyOyArK19faSkKKwl7CisJICBpZiAoX19jdHlwZS5uYXJyb3coX19mb3JtYXRbX19pXSwgMCkgPT0gJyUnKQorCSAgICB7CisJICAgICAgLy8gVmVyaWZ5IHZhbGlkIGZvcm1hdHRpbmcgY29kZSwgYXR0ZW1wdCB0byBleHRyYWN0LgorCSAgICAgIGNoYXIgX19jID0gX19jdHlwZS5uYXJyb3coX19mb3JtYXRbKytfX2ldLCAwKTsKKwkgICAgICBpbnQgX19tZW0gPSAwOworCSAgICAgIGlmIChfX2MgPT0gJ0UnIHx8IF9fYyA9PSAnTycpCisJCV9fYyA9IF9fY3R5cGUubmFycm93KF9fZm9ybWF0WysrX19pXSwgMCk7CisJICAgICAgc3dpdGNoIChfX2MpCisJCXsKKwkJICBjb25zdCBjaGFyKiBfX2NzOworCQkgIF9DaGFyVCBfX3djc1sxMF07CisJCWNhc2UgJ2EnOgorCQkgIC8vIEFiYnJldmlhdGVkIHdlZWtkYXkgbmFtZSBbdG1fd2RheV0KKwkJICBjb25zdCBjaGFyX3R5cGUqICBfX2RheXMxWzddOworCQkgIF9fdHAuX01fZGF5c19hYmJyZXZpYXRlZChfX2RheXMxKTsKKwkJICBfX2JlZyA9IF9NX2V4dHJhY3RfbmFtZShfX2JlZywgX19lbmQsIF9fdG0tPnRtX3dkYXksIF9fZGF5czEsCisJCQkJCSAgNywgX19pbywgX190bXBlcnIpOworCQkgIGJyZWFrOworCQljYXNlICdBJzoKKwkJICAvLyBXZWVrZGF5IG5hbWUgW3RtX3dkYXldLgorCQkgIGNvbnN0IGNoYXJfdHlwZSogIF9fZGF5czJbN107CisJCSAgX190cC5fTV9kYXlzKF9fZGF5czIpOworCQkgIF9fYmVnID0gX01fZXh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oX19iZWcsIF9fZW5kLCBfX3RtcCwKKwkJCQkgICAgICAgX190aW1lcHVuY3RfY2FjaGU8X0NoYXJUPjo6X1NfdGltZXpvbmVzLAorCQkJCQkgICAgICAxNCwgX19pbywgX190bXBlcnIpOworCisJCSAgICAgIC8vIEdNVCByZXF1aXJlcyBzcGVjaWFsIGVmZm9ydC4KKwkJICAgICAgaWYgKF9fYmVnICE9IF9fZW5kICYmICFfX3RtcGVyciAmJiBfX3RtcCA9PSAwCisJCQkgICYmICgqX19iZWcgPT0gX19jdHlwZS53aWRlbignLScpCisJCQkgICAgICB8fCAqX19iZWcgPT0gX19jdHlwZS53aWRlbignKycpKSkKKwkJCXsKKwkJCSAgX19iZWcgPSBfTV9leHRyYWN0X251bShfX2JlZywgX19lbmQsIF9fdG1wLCAwLCAyMywgMiwKKwkJCQkJCSBfX2lvLCBfX3RtcGVycik7CisJCQkgIF9fYmVnID0gX01fZXh0cmFjdF9udW0oX19iZWcsIF9fZW5kLCBfX3RtcCwgMCwgNTksIDIsCisJCQkJCQkgX19pbywgX190bXBlcnIpOworCQkJfQorCQkgICAgfQorCQkgIGVsc2UKKwkJICAgIF9fdG1wZXJyIHw9IGlvc19iYXNlOjpmYWlsYml0OworCQkgIGJyZWFrOworCQlkZWZhdWx0OgorCQkgIC8vIE5vdCByZWNvZ25pemVkLgorCQkgIF9fdG1wZXJyIHw9IGlvc19iYXNlOjpmYWlsYml0OworCQl9CisJICAgIH0KKwkgIGVsc2UKKwkgICAgeworCSAgICAgIC8vIFZlcmlmeSBmb3JtYXQgYW5kIGlucHV0IG1hdGNoLCBleHRyYWN0IGFuZCBkaXNjYXJkLgorCSAgICAgIGlmIChfX2Zvcm1hdFtfX2ldID09ICpfX2JlZykKKwkJKytfX2JlZzsKKwkgICAgICBlbHNlCisJCV9fdG1wZXJyIHw9IGlvc19iYXNlOjpmYWlsYml0OworCSAgICB9CisJfQorCisgICAgICBpZiAoX190bXBlcnIgfHwgX19pICE9IF9fbGVuKQorCV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lc19sZW5ndGhzID0gMDsKKyAgICAgIHNpemVfdCBfX3BvcyA9IDA7CisKKyAgICAgIGlmIChfX2JlZyAhPSBfX2VuZCkKKwl7CisJICBjb25zdCBjaGFyX3R5cGUgX19jID0gKl9fYmVnOworCSAgZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgMiAqIF9faW5kZXhsZW47ICsrX19pKQorCSAgICBpZiAoX19jID09IF9fbmFtZXNbX19pXVswXQorCQl8fCBfX2MgPT0gX19jdHlwZS50b3VwcGVyKF9fbmFtZXNbX19pXVswXSkpCisJICAgICAgX19tYXRjaGVzW19fbm1hdGNoZXMrK10gPSBfX2k7CisJfQorCisgICAgICBpZiAoX19ubWF0Y2hlcykKKwl7CisJICArK19fYmVnLCArK19fcG9zOworCisJICBfX21hdGNoZXNfbGVuZ3RocworCSAgICA9IHN0YXRpY19jYXN0PHNpemVfdCo+KF9fYnVpbHRpbl9hbGxvY2Eoc2l6ZW9mKHNpemVfdCkKKwkJCQkJCSAgICAqIF9fbm1hdGNoZXMpKTsKKwkgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbm1hdGNoZXM7ICsrX19pKQorCSAgICBfX21hdGNoZXNfbGVuZ3Roc1tfX2ldCisJICAgICAgPSBfX3RyYWl0c190eXBlOjpsZW5ndGgoX19uYW1lc1tfX21hdGNoZXNbX19pXV0pOworCX0KKworICAgICAgZm9yICg7IF9fYmVnICE9IF9fZW5kOyArK19fYmVnLCArK19fcG9zKQorCXsKKwkgIHNpemVfdCBfX25za2lwcGVkID0gMDsKKwkgIGNvbnN0IGNoYXJfdHlwZSBfX2MgPSAqX19iZWc7CisJICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX25tYXRjaGVzOykKKwkgICAgeworCSAgICAgIGNvbnN0IGNoYXJfdHlwZSogX19uYW1lID0gX19uYW1lc1tfX21hdGNoZXNbX19pXV07CisJICAgICAgaWYgKF9fcG9zID49IF9fbWF0Y2hlc19sZW5ndGhzW19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F9fZW5kLCBfX3RtcHdkYXksIF9fZGF5cywgNywKKwkJCQkgICAgICAgX19pbywgX190bXBlcnIpOworICAgICAgaWYgKCFfX3RtcGVycikKKwlfX3RtLT50bV93ZGF5ID0gX190bXB3ZGF5OworICAgICAgZWxzZQorCV9fZXJyIHw9IGlvc19iYXNlOjpmYWlsYml0OworCisgICAgICBpZiAoX19iZWcgPT0gX19lbmQpCisJX19lcnIgfD0gaW9zX2Jhc2U6OmVvZmJpdDsKKyAgICAgIHJldHVybiBfX2JlZzsKKyAgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX0luSXRlcj4KKyAgICBfSW5JdGVyCisgICAgdGltZV9nZXQ8X0NoYXJULCBfSW5JdGVyPjo6CisgICAgZG9fZ2V0X21vbnRobmFtZShpdGVyX3R5cGUgX19iZWcsIGl0ZXJfdHlwZSBfX2VuZCwKKyAgICAgICAgICAgICAgICAgICAgIGlvc19iYXNlJiBfX2lvLCBpb3NfYmFzZTo6aW9zdGF0ZSYgX19lcnIsIHRtKiBfX3RtKSBjb25zdAorICAgIHsKKyAgICAgIHR5cGVkZWYgY2hhcl90cmFpdHM8X0NoYXJUPgkJX190cmFpdHNfdHlwZTsKKyAgICAgIGNvbnN0IGxvY2FsZSYgX19sb2MgPSBfX2lvLl9NX2dldGxvYygpOworICAgICAgY29uc3QgX190aW1lcHVuY3Q8X0NoYXJUPiYgX190cCA9IHVzZV9mYWNldDxfX3RpbWVwdW5jdDxfQ2hhclQ+ID4oX19sb2MpOworICAgICAgY29uc3QgY3R5cGU8X0NoYXJUPiYgX19jdHlwZSA9IHVzZV9mYWNldDxjdHlwZTxfQ2hhclQ+ID4oX19sb2MpOworICAgICAgY29uc3QgY2hhcl90eXBlKiAgX19tb250aHNbMjRdOworICAgICAgX190cC5fTV9tb250aHNfYWJicmV2aWF0ZWQoX19tb250aHMpOworICAgICAgX190cC5fTV9tb250aHMoX19tb250aHMgKyAxMik7CisgICAg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fVHA+JikgY29uc3Q7CisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfRG9tPgorICAgICAgICB2b2lkIG9wZXJhdG9yfD0oY29uc3QgX0V4cHI8X0RvbSxfVHA+JikgY29uc3Q7CisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfRG9tPgorICAgICAgICB2b2lkIG9wZXJhdG9yPDw9KGNvbnN0IF9FeHByPF9Eb20sX1RwPiYpIGNvbnN0OworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4KKyAgICAgICAgdm9pZCBvcGVyYXRvcj4+PShjb25zdCBfRXhwcjxfRG9tLF9UcD4mKSBjb25zdDsKKworICAgIHByaXZhdGU6CisgICAgICBtYXNrX2FycmF5KF9BcnJheTxfVHA+LCBzaXplX3QsIF9BcnJheTxib29sPik7CisgICAgICBmcmllbmQgY2xhc3MgdmFsYXJyYXk8X1RwPjsKKworICAgICAgY29uc3Qgc2l6ZV90ICAgICAgIF9NX3N6OworICAgICAgY29uc3QgX0FycmF5PGJvb2w+IF9NX21hc2s7CisgICAgICBjb25zdCBfQXJyYXk8X1RwPiAgX01fYXJyYXk7CisKKyAgICAgIC8vIG5vdCBpbXBsZW1lbnRlZAorICAgICAgbWFza19hcnJheSgpOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBtYXNrX2FycmF5PF9UcD46Om1hc2tfYXJyYXkoY29uc3QgbWFza19hcnJheTxfVHA+JiBhKQorICAgIDogX01fc3ooYS5fTV9zeiksIF9NX21hc2soYS5fTV9tYXNrKSwgX01fYXJyYXkoYS5fTV9hcnJheSkge30KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lCisgICAgbWFza19hcnJheTxfVHA+OjptYXNrX2FycmF5KF9BcnJheTxfVHA+IF9fYSwgc2l6ZV90IF9fcywgX0FycmF5PGJvb2w+IF9fbSkKKyAgICA6IF9NX3N6KF9fcyksIF9NX21hc2soX19tKSwgX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HJldHVybiBfX2MgPT0gMHUgPyAxdSA6IDB1OyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIGxhcmdlc3QgcG9zc2libGUgdmFsdWUgaW4gdGhlIG91dHB1dCByYW5nZS4KKyAgICAgICAqLworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZQorICAgICAgbWF4KCkKKyAgICAgIHsgcmV0dXJuIF9fbSAtIDF1OyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERpc2NhcmQgYSBzZXF1ZW5jZSBvZiByYW5kb20gbnVtYmVycy4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgZGlzY2FyZCh1bnNpZ25lZCBsb25nIGxvbmcgX196KQorICAgICAgeworCWZvciAoOyBfX3ogIT0gMFVMTDsgLS1fX3opCisJICAoKnRoaXMpKCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG5leHQgcmFuZG9tIG51bWJlciBpbiB0aGUgc2VxdWVuY2UuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCkKKyAgICAgIHsKKwlfTV94ID0gX19kZXRhaWw6Ol9fbW9kPF9VSW50VHlwZSwgX19tLCBfX2EsIF9fYz4oX01feCk7CisJcmV0dXJuIF9NX3g7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbXBhcmVzIHR3byBsaW5lYXIgY29uZ3J1ZW50aWFsIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiBvYmplY3RzIG9mIHRoZSBzYW1lIHR5cGUgZm9yIGVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBIGxpbmVhciBjb25ncnVlbnRpYWwgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgbGluZWFyIGNvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyB0cnVlIGlmIHRoZSBpbmZpbml0ZSBzZXF1ZW5jZXMgb2YgZ2VuZXJhdGVkIHZhbHVlcworICAgICAgICogICAgICAgICAgd291bGQgYmUgZXF1YWwsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAqLworICAgICAgZnJpZW5kIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgbGluZWFyX2NvbmdydWVudGlhbF9lbmdpbmUmIF9fbGhzLAorCQkgY29uc3QgbGluZWFyX2NvbmdydWVudGlhbF9lbmdpbmUmIF9fcmhzKQorICAgICAgeyByZXR1cm4gX19saHMuX01feCA9PSBfX3Jocy5fTV94OyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFdyaXRlcyB0aGUgdGV4dHVhbCByZXByZXNlbnRhdGlvbiBvZiB0aGUgc3RhdGUgeChpKSBvZiB4IHRvCisgICAgICAgKiAgICAgICAgQHAgX19vcy4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19vcyAgVGhlIG91dHB1dCBzdHJlYW0uCisgICAgICAgKiBAcGFyYW0gX19sY3IgQSAlIGxpbmVhcl9jb25ncnVlbnRpYWxfZW5naW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yLgorICAgICAgICogQHJldHVybnMgX19vcy4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VJbnRUeXBlMSwgX1VJbnRUeXBlMSBfX2ExLCBfVUludFR5cGUxIF9fYzEsCisJICAgICAgIF9VSW50VHlwZTEgX19tMSwgdHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorCWZyaWVuZCBzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiY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CisgICAgICByZXN1bHRfdHlwZQorICAgICAgb3BlcmF0b3IoKSgpOworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb21wYXJlcyB0d28gJSBtZXJzZW5uZV90d2lzdGVyX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgIG9iamVjdHMgb2YgdGhlIHNhbWUgdHlwZSBmb3IgZXF1YWxpdHkuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fbGhzIEEgJSBtZXJzZW5uZV90d2lzdGVyX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICAgICAqIEBwYXJhbSBfX3JocyBBbm90aGVyICUgbWVyc2VubmVfdHdpc3Rlcl9lbmdpbmUgcmFuZG9tIG51bWJlcgorICAgICAgICogICAgICAgICAgICAgIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgaW5maW5pdGUgc2VxdWVuY2VzIG9mIGdlbmVyYXRlZCB2YWx1ZXMKKyAgICAgICAqICAgICAgICAgIHdvdWxkIGJlIGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IG1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lJiBfX2xocywKKwkJIGNvbnN0IG1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lJiBfX3JocykKKyAgICAgIHsgcmV0dXJuIChzdGQ6OmVxdWFsKF9fbGhzLl9NX3gsIF9fbGhzLl9NX3ggKyBzdGF0ZV9zaXplLCBfX3Jocy5fTV94KQorCQkmJiBfX2xocy5fTV9wID09IF9fcmhzLl9NX3ApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluc2VydHMgdGhlIGN1cnJlbnQgc3RhdGUgb2YgYSA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zdCBzdGQ6Om1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lPF9VSW50VHlwZTEsIF9fdzEsIF9fbjEsCisJCSAgIF9fbTEsIF9fcjEsIF9fYTEsIF9fdTEsIF9fZDEsIF9fczEsIF9fYjEsIF9fdDEsIF9fYzEsCisJCSAgIF9fbDEsIF9fZjE+JiBfX3gpOworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBFeHRyYWN0cyB0aGUgY3VycmVudCBzdGF0ZSBvZiBhICUgbWVyc2VubmVfdHdpc3Rlcl9lbmdpbmUKKyAgICAgICAqICAgICAgICByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBlbmdpbmUgQHAgX194IGZyb20gdGhlIGlucHV0IHN0cmVhbQorICAgICAgICogICAgICAgIEBwIF9faXMuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9faXMgQW4gaW5wdXQgc3RyZWFtLgorICAgICAgICogQHBhcmFtIF9feCAgQSAlIG1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgVGhlIGlucHV0IHN0cmVhbSB3aXRoIHRoZSBzdGF0ZSBvZiBAcCBfX3ggZXh0cmFjdGVkIG9yIGluCisgICAgICAgKiBhbiBlcnJvciBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VJbnRUeXBlMSwKKwkgICAgICAgc2l6ZV90IF9fdzEsIHNpemVfdCBfX24xLAorCSAgICAgICBzaXplX3QgX19tMSwgc2l6ZV90IF9fcjEsCisJICAgICAgIF9VSW50VHlwZTEgX19hMSwgc2l6ZV90IF9fdTEsCisJICAgICAgIF9VSW50VHlwZTEgX19kMSwgc2l6ZV90IF9fczEsCisJICAgICAgIF9VSW50VHlwZTEgX19iMSwgc2l6ZV90IF9fdDEsCisJICAgICAgIF9VSW50V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IF9fdyAmJiBfX3cgPD0gc3RkOjpudW1lcmljX2xpbWl0czxfVUludFR5cGU+OjpkaWdpdHMsCisJCSAgICAidGVtcGxhdGUgYXJndW1lbnQgc3Vic3RpdHV0aW5nIF9fdyBvdXQgb2YgYm91bmRzIik7CisKKyAgICBwdWJsaWM6CisgICAgICAvKiogVGhlIHR5cGUgb2YgdGhlIGdlbmVyYXRlZCByYW5kb20gdmFsdWUuICovCisgICAgICB0eXBlZGVmIF9VSW50VHlwZSByZXN1bHRfdHlwZTsKKworICAgICAgLy8gcGFyYW1ldGVyIHZhbHVlcworICAgICAgc3RhdGljIGNvbnN0ZXhwciBzaXplX3QgICAgICB3b3JkX3NpemUgICAgPSBfX3c7CisgICAgICBzdGF0aWMgY29uc3RleHByIHNpemVfdCAgICAgIHNob3J0X2xhZyAgICA9IF9fczsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgc2l6ZV90ICAgICAgbG9uZ19sYWcgICAgID0gX19yOworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZSBkZWZhdWx0X3NlZWQgPSAxOTc4MDUwM3U7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnN0cnVjdHMgYW4gZXhwbGljaXRseSBzZWVkZWQgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5X2VuZ2luZQorICAgICAgICogICAgICAgIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgc3VidHJhY3Rfd2l0aF9jYXJyeV9lbmdpbmUocmVzdWx0X3R5cGUgX19zZCA9IGRlZmF1bHRfc2VlZCkKKyAgICAgIHsgc2VlZChfX3NkKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb25zdHJ1Y3RzIGEgJXN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lIHJhbmRvbSBudW1iZXIgZW5naW5lCisgICAgICAgKiAgICAgICAgc2VlZGVkIGZyb20gd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KQorICAgICAgeyByZXR1cm4gX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIF9fdz46Ol9fdmFsdWUgLSAxOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERpc2NhcmQgYSBzZXF1ZW5jZSBvZiByYW5kb20gbnVtYmVycy4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgZGlzY2FyZCh1bnNpZ25lZCBsb25nIGxvbmcgX196KQorICAgICAgeworCWZvciAoOyBfX3ogIT0gMFVMTDsgLS1fX3opCisJICAoKnRoaXMpKCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG5leHQgcmFuZG9tIG51bWJlciBpbiB0aGUgc2VxdWVuY2UuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCk7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbXBhcmVzIHR3byAlIHN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lIHJhbmRvbSBudW1iZXIKKyAgICAgICAqICAgICAgICBnZW5lcmF0b3Igb2JqZWN0cyBvZiB0aGUgc2FtZSB0eXBlIGZvciBlcXVhbGl0eS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19saHMgQSAlIHN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5X2VuZ2luZSByYW5kb20gbnVtYmVyCisgICAgICAgKiAgICAgICAgICAgICAgZ2VuZXJhdG9yIG9iamVjdC4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyB0cnVlIGlmIHRoZSBpbmZpbml0ZSBzZXF1ZW5jZXMgb2YgZ2VuZXJhdGVkIHZhbHVlcworICA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NzZXEmIF9fcSkKKwk6IF9NX2IoX19xKSwgX01fbigwKQorICAgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZWVkcyB0aGUgJWRpc2NhcmRfYmxvY2tfZW5naW5lIG9iamVjdCB3aXRoIHRoZSBkZWZhdWx0CisgICAgICAgKiAgICAgICAgc2VlZCBmb3IgdGhlIHVuZGVybHlpbmcgYmFzZSBjbGFzcyBnZW5lcmF0b3IgZW5naW5lLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzZWVkKCkKKyAgICAgIHsKKwlfTV9iLnNlZWQoKTsKKwlfTV9uID0gMDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZWVkcyB0aGUgJWRpc2NhcmRfYmxvY2tfZW5naW5lIG9iamVjdCB3aXRoIHRoZSBkZWZhdWx0CisgICAgICAgKiAgICAgICAgc2VlZCBmb3IgdGhlIHVuZGVybHlpbmcgYmFzZSBjbGFzcyBnZW5lcmF0b3IgZW5naW5lLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzZWVkKHJlc3VsdF90eXBlIF9fcykKKyAgICAgIHsKKwlfTV9iLnNlZWQoX19zKTsKKwlfTV9uID0gMDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZWVkcyB0aGUgJWRpc2NhcmRfYmxvY2tfZW5naW5lIG9iamVjdCB3aXRoIHRoZSBnaXZlbiBzZWVkCisgICAgICAgKiAgICAgICAgc2VxdWVuY2UuCisgICAgICAgKiBAcGFyYW0gX19xIEEgc2VlZCBnZW5lcmF0b3IgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9Tc2VxPgorICAgICAgICB2b2lkCisgICAgICAgIHNlZWQoX1NzZXEmIF9fcSkKKyAgICAgICAgeworCSAgX01fYi5zZWVkKF9fcSk7CisJICBfTV9uID0gMDsKKwl9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgYSBjb25zdCByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgZ2VuZXJhdG9yIGVuZ2luZQorICAgICAgICogICAgICAgIG9iamVjdC4KKyAgICAgICAqLworICAgICAgY29uc3QgX1JhbmRvbU51bWJlckVuZ2luZSYKKyAgICAgIGJhc2UoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fYjsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBtaW5pbXVtIHZhbHVlIGluIHRoZSBnZW5lcmF0ZWQgcmFuZG9tIG51bWJlciByYW5nZS4KKyAgICAgICAqLworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZQorICAgICAgbWluKCkKKyAgICAgIHsgcmV0dXJuIF9SYW5kb21OdW1iZXJFbmdpbmU6Om1pbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG1heGltdW0gdmFsdWUgaW4gdGhlIGdlbmVyYXRlZCByYW5kb20gbnVtYmVyIHJhbmdlLgorICAgICAgICovCisgICAgICBzdGF0aWMgY29uc3RleHByIHJlc3VsdF90eXBlCisgICAgICBtYXgoKQorICAgICAgeyByZXR1cm4gX1JhbmRvbU51bWJlckVuZ2luZTo6bWF4KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgRGlzY2FyZCBhIHNlcXVlbmNlIG9mIHJhbmRvbSBudW1iZXJzLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBkaXNjYXJkKHVuc2lnbmVkIGxvbmcgbG9uZyBfX3opCisgICAgICB7CisJZm9yICg7IF9feiAhPSAwVUxMOyAtLV9feikKKwkgICgqdGhpcykoKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgR2V0cyB0aGUgbmV4dCB2YWx1ZSBpbiB0aGUgZ2VuZXJhdGVkIHJhbmRvbSBudW1iZXIgc2VxdWVuY2UuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCk7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbXBhcmVzIHR3byAlZGlzY2FyZF9ibG9ja19lbmdpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICAgICAqICAgICAgICBvYmplY3RzIG9mIHRoZSBzYW1lIHR5cGUgZm9yIGVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBICVkaXNjYXJkX2Jsb2NrX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciAlZGlzY2FyZF9ibG9ja19lbmdpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICAgICAqICAgICAgICAgICAgICBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgaW5maW5pdGUgc2VxdWVuY2VzIG9mIGdlbmVyYXRlZCB2YWx1ZXMKKyAgICAgICAqICAgICAgICAgIHdvdWxkIGJlIGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IGRpc2NhcmRfYmxvY2tfZW5naW5lJiBfX2xocywKKwkJIGNvbnN0IGRpc2NhcmRfYmxvY2tfZW5naW5lJiBfX3JocykKKyAgICAgIHsgcmV0dXJuIF9fbGhzLl9NX2IgPT0gX19yaHMuX01fYiAmJiBfX2xocy5fTV9uID09IF9fcmhzLl9NX247IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgSW5zZXJ0cyB0aGUgY3VycmVudCBzdGF0ZSBvZiBhICVkaXNjYXJkX2Jsb2NrX2VuZ2luZSByYW5kb20KKyAgICAgICAqICAgICAgICBudW1iZX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LworICAgICAgZXhwbGljaXQKKyAgICAgIGluZGVwZW5kZW50X2JpdHNfZW5naW5lKGNvbnN0IF9SYW5kb21OdW1iZXJFbmdpbmUmIF9fcm5nKQorICAgICAgOiBfTV9iKF9fcm5nKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgTW92ZSBjb25zdHJ1Y3RzIGEgJWluZGVwZW5kZW50X2JpdHNfZW5naW5lIGVuZ2luZS4KKyAgICAgICAqCisgICAgICAgKiBDb3BpZXMgYW4gZXhpc3RpbmcgYmFzZSBjbGFzcyByYW5kb20gbnVtYmVyIGdlbmVyYXRvci4KKyAgICAgICAqIEBwYXJhbSBfX3JuZyBBbiBleGlzdGluZyAoYmFzZSBjbGFzcykgZW5naW5lIG9iamVjdC4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGluZGVwZW5kZW50X2JpdHNfZW5naW5lKF9SYW5kb21OdW1iZXJFbmdpbmUmJiBfX3JuZykKKyAgICAgIDogX01fYihzdGQ6Om1vdmUoX19ybmcpKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgU2VlZCBjb25zdHJ1Y3RzIGEgJWluZGVwZW5kZW50X2JpdHNfZW5naW5lIGVuZ2luZS4KKyAgICAgICAqCisgICAgICAgKiBDb25zdHJ1Y3RzIHRoZSB1bmRlcmx5aW5nIGdlbmVyYXRvciBlbmdpbmUgc2VlZGVkIHdpdGggQHAgX19zLgorICAgICAgICogQHBhcmFtIF9fcyBBIHNlZWQgdmFsdWUgZm9yIHRoZSBiYXNlIGNsYXNzIGVuZ2luZS4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGluZGVwZW5kZW50X2JpdHNfZW5naW5lKHJlc3VsdF90eXBlIF9fcykKKyAgICAgIDogX01fYihfX3MpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZW5lcmF0b3IgY29uc3RydWN0IGEgJWluZGVwZW5kZW50X2JpdHNfZW5naW5lIGVuZ2luZS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19xIEEgc2VlZCBzZXF1ZW5jZS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1NzZXEsIHR5cGVuYW1lID0gdHlwZW5hbWUKKwlzdGQ6OmVuYWJsZV9pZjwhc3RkOjppc19zYW1lPF9Tc2VxLCBpbmRlcGVuZGVudF9iaXRzX2VuZ2luZT46OnZhbHVlCisJCSAgICAgICAmJiAhc3RkOjppc19zYW1lPF9Tc2VxLCBfUmFuZG9tTnVtYmVyRW5naW5lPjo6dmFsdWU+CisgICAgICAgICAgICAgICA6OnR5cGU+CisgICAgICAgIGV4cGxpY2l0CisgICAgICAgIGluZGVwZW5kZW50X2JpdHNfZW5naW5lKF9Tc2VxJiBfX3EpCisgICAgICAgIDogX01fYihfX3EpCisgICAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNlZWRzIHRoZSAlaW5kZXBlbmRlbnRfYml0c19lbmdpbmUgb2JqZWN0IHdpdGggdGhlIGRlZmF1bHQKKyAgICAgICAqICAgICAgICBzZWVkIGZvciB0aGUgdW5kZXJseWluZyBiYXNlIGNsYXNzIGdlbmVyYXRvciBlbmdpbmUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHNlZWQoKQorICAgICAgeyBfTV9iLnNlZWQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNlZWRzIHRoZSAlaW5kZXBlbmRlbnRfYml0c19lbmdpbmUgb2JqZWN0IHdpdGggdGhlIGRlZmF1bHQKKyAgICAgICAqICAgICAgICBzZWVkIGZvciB0aGUgdW5kZXJseWluZyBiYXNlIGNsYXNzIGdlbmVyYXRvciBlbmdpbmUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHNlZWQocmVzdWx0X3R5cGUgX19zKQorICAgICAgeyBfTV9iLnNlZWQoX19zKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNlZWRzIHRoZSAlaW5kZXBlbmRlbnRfYml0c19lbmdpbmUgb2JqZWN0IHdpdGggdGhlIGdpdmVuCisgICAgICAgKiAgICAgICAgc2VlZCBzZXF1ZW5jZS4KKyAgICAgICAqIEBwYXJhbSBfX3EgQSBzZWVkIGdlbmVyYXRvciBmdW5jdGlvbi4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1NzZXE+CisgICAgICAgIHZvaWQKKyAgICAgICAgc2VlZChfU3NlcSYgX19xKQorICAgICAgICB7IF9NX2Iuc2VlZChfX3EpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgYSBjb25zdCByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgZ2VuZXJhdG9yIGVuZ2luZQorICAgICAgICogICAgICAgIG9iamVjdC4KKyAgICAgICAqLworICAgICAgY29uc3QgX1JhbmRvbU51bWJlckVuZ2luZSYKKyAgICAgIGJhc2UoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fYjsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBtaW5pbXVtIHZhbHVlIGluIHRoZSBnZW5lcmF0ZWQgcmFuZG9tIG51bWJlciByYW5nZS4KKyAgICAgICAqLworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZQorICAgICAgbWluKCkKKyAgICAgIHsgcmV0dXJuIDBVOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG1heGltdW0gdmFsdWUgaW4gdGhlIGdlbmVyYXRlZCByYW5kb20gbnVtYmVyIHJhbmdlLgorICAgICAgICovCisgICAgICBzdGF0aWMgY29uc3RleHByIHJlc3VsdF90eXBlCisgICAgICBtYXgoKQorICAgICAgeyByZXR1cm4gX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIF9fdz46Ol9fdmFsdWUgLSAxOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERpc2NhcmQgYSBzZXF1ZW5jZSBvZiByYW5kb20gbnVtYmVycy4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgZGlzY2FyZCh1bnNpZ25lZCBsb25nIGxvbmcgX196KQorICAgICAgeworCWZvciAoOyBfX3ogIT0gMFVMTDsgLS1fX3opCisJICAoKnRoaXMpKCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG5leHQgdmFsdWUgaW4gdGhlIGdlbmVyYXRlZCByYW5kb20gbnVtYmVyIHNlcXVlbmNlLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgb3BlcmF0b3IoKSgpOworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb21wYXJlcyB0d28gJWluZGVwZW5kZW50X2JpdHNfZW5naW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiBvYmplY3RzIG9mIHRoZSBzYW1lIHR5cGUgZm9yIGVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBICVpbmRlcGVuZGVudF9iaXRzX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICAgICAqIEBwYXJhbSBfX3JocyBBbm90aGVyICVpbmRlcGVuZGVudF9iaXRzX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyB0cnVlIGlmIHRoZSBpbmZpbml0ZSBzZXF1ZW5jZXMgb2YgZ2VuZXJhdGVkIHZhbHVlcworICAgICAgICogICAgICAgICAgd291bGQgYmUgZXF1YWwsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAqLworICAgICAgZnJpZW5kIGJvb2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3csIF9VSW50VHlwZT4mIF9feCkKKwl7CisJICBfX2lzID4+IF9feC5fTV9iOworCSAgcmV0dXJuIF9faXM7CisJfQorCisgICAgcHJpdmF0ZToKKyAgICAgIF9SYW5kb21OdW1iZXJFbmdpbmUgX01fYjsKKyAgICB9OworCisgIC8qKgorICAgKiBAYnJpZWYgQ29tcGFyZXMgdHdvICVpbmRlcGVuZGVudF9iaXRzX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgKiBvYmplY3RzIG9mIHRoZSBzYW1lIHR5cGUgZm9yIGluZXF1YWxpdHkuCisgICAqCisgICAqIEBwYXJhbSBfX2xocyBBICVpbmRlcGVuZGVudF9iaXRzX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciAlaW5kZXBlbmRlbnRfYml0c19lbmdpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICoKKyAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgaW5maW5pdGUgc2VxdWVuY2VzIG9mIGdlbmVyYXRlZCB2YWx1ZXMKKyAgICogICAgICAgICAgd291bGQgYmUgZGlmZmVyZW50LCBmYWxzZSBvdGhlcndpc2UuCisgICAqLworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUmFuZG9tTnVtYmVyRW5naW5lLCBzaXplX3QgX193LCB0eXBlbmFtZSBfVUludFR5cGU+CisgICAgaW5saW5lIGJvb2wKKyAgICBvcGVyYXRvciE9KGNvbnN0IHN0ZDo6aW5kZXBlbmRlbnRfYml0c19lbmdpbmU8X1JhbmRvbU51bWJlckVuZ2luZSwgX193LAorCSAgICAgICBfVUludFR5cGU+JiBfX2xocywKKwkgICAgICAgY29uc3Qgc3RkOjppbmRlcGVuZGVudF9iaXRzX2VuZ2luZTxfUmFuZG9tTnVtYmVy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WVmIENvcHkgY29uc3RydWN0cyBhICVzaHVmZmxlX29yZGVyX2VuZ2luZSBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQ29waWVzIGFuIGV4aXN0aW5nIGJhc2UgY2xhc3MgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IuCisgICAgICAgKiBAcGFyYW0gX19ybmcgQW4gZXhpc3RpbmcgKGJhc2UgY2xhc3MpIGVuZ2luZSBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBzaHVmZmxlX29yZGVyX2VuZ2luZShjb25zdCBfUmFuZG9tTnVtYmVyRW5naW5lJiBfX3JuZykKKyAgICAgIDogX01fYihfX3JuZykKKyAgICAgIHsgX01faW5pdGlhbGl6ZSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIE1vdmUgY29uc3RydWN0cyBhICVzaHVmZmxlX29yZGVyX2VuZ2luZSBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQ29waWVzIGFuIGV4aXN0aW5nIGJhc2UgY2xhc3MgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IuCisgICAgICAgKiBAcGFyYW0gX19ybmcgQW4gZXhpc3RpbmcgKGJhc2UgY2xhc3MpIGVuZ2luZSBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBzaHVmZmxlX29yZGVyX2VuZ2luZShfUmFuZG9tTnVtYmVyRW5naW5lJiYgX19ybmcpCisgICAgICA6IF9NX2Ioc3RkOjptb3ZlKF9fcm5nKSkKKyAgICAgIHsgX01faW5pdGlhbGl6ZSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNlZWQgY29uc3RydWN0cyBhICVzaHVmZmxlX29yZGVyX2VuZ2luZSBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQ29uc3RydWN0cyB0aGUgdW5kZXJseWluZyBnZW5lcmF0b3IgZW5naW5lIHNlZWRlZCB3aXRoIEBwIF9fcy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isJX01fYi5zZWVkKCk7CisJX01faW5pdGlhbGl6ZSgpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNlZWRzIHRoZSAlc2h1ZmZsZV9vcmRlcl9lbmdpbmUgb2JqZWN0IHdpdGggdGhlIGRlZmF1bHQgc2VlZAorICAgICAgICogICAgICAgIGZvciB0aGUgdW5kZXJseWluZyBiYXNlIGNsYXNzIGdlbmVyYXRvciBlbmdpbmUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHNlZWQocmVzdWx0X3R5cGUgX19zKQorICAgICAgeworCV9NX2Iuc2VlZChfX3MpOworCV9NX2luaXRpYWxpemUoKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZWVkcyB0aGUgJXNodWZmbGVfb3JkZXJfZW5naW5lIG9iamVjdCB3aXRoIHRoZSBnaXZlbiBzZWVkCisgICAgICAgKiAgICAgICAgc2VxdWVuY2UuCisgICAgICAgKiBAcGFyYW0gX19xIEEgc2VlZCBnZW5lcmF0b3IgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9Tc2VxPgorICAgICAgICB2b2lkCisgICAgICAgIHNlZWQoX1NzZXEmIF9fcSkKKyAgICAgICAgeworCSAgX01fYi5zZWVkKF9fcSk7CisJICBfTV9pbml0aWFsaXplKCk7CisJfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgYSBjb25zdCByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgZ2VuZXJhdG9yIGVuZ2luZSBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGNvbnN0IF9SYW5kb21OdW1iZXJFbmdpbmUmCisgICAgICBiYXNlKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX2I7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBtaW5pbXVtIHZhbHVlIGluIHRoZSBnZW5lcmF0ZWQgcmFuZG9tIG51bWJlciByYW5nZS4KKyAgICAgICAqLworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZQorICAgICAgbWluKCkKKyAgICAgIHsgcmV0dXJuIF9SYW5kb21OdW1iZXJFbmdpbmU6Om1pbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbWF4aW11bSB2YWx1ZSBpbiB0aGUgZ2VuZXJhdGVkIHJhbmRvbSBudW1iZXIgcmFuZ2UuCisgICAgICAgKi8KKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpCisgICAgICB7IHJldHVybiBfUmFuZG9tTnVtYmVyRW5naW5lOjptYXgoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIERpc2NhcmQgYSBzZXF1ZW5jZSBvZiByYW5kb20gbnVtYmVycy4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgZGlzY2FyZCh1bnNpZ25lZCBsb25nIGxvbmcgX196KQorICAgICAgeworCWZvciAoOyBfX3ogIT0gMFVMTDsgLS1fX3opCisJICAoKnRoaXMpKCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbmV4dCB2YWx1ZSBpbiB0aGUgZ2VuZXJhdGVkIHJhbmRvbSBudW1iZXIgc2VxdWVuY2UuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCk7CisKKyAgICAgIC8qKgorICAgICAgICogQ29tcGFyZXMgdHdvICVzaHVmZmxlX29yZGVyX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmplY3RzCisgICAgICAgKiBvZiB0aGUgc2FtZSB0eXBlIGZvciBlcXVhbGl0eS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19saHMgQSAlc2h1ZmZsZV9vcmRlcl9lbmdpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgJXNodWZmbGVfb3JkZXJfZW5naW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRydWUgaWYgdGhlIGluZmluaXRlIHNlcXVlbmNlcyBvZiBnZW5lcmF0ZWQgdmFsdWVzCisgICAgICAgKiAgICAgICAgICB3b3VsZCBiZSBlcXVhbCwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IHNodWZmbGVfb3JkZXJfZW5naW5lJiBfX2xocywKKwkJIGNvbnN0IHNodWZmbGVfb3JkZXJfZW5naW5lJiBfX3JocykKKyAgICAgIHsgcmV0dXJuIChfX2xocy5fTV9iID09IF9fcmhzLl9NX2IKKwkJJiYgc3RkOjplcXVhbChfX2xocy5fTV92LCBfX2xocy5fTV92ICsgX19rLCBfX3Jocy5fTV92KQorCQkmJiBfX2xocy5fTV95ID09IF9fcmhzLl9NX3kpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluc2VydHMgdGhlIGN1cnJlbnQgc3RhdGUgb2YgYSAlc2h1ZmZsZV9vcmRlcl9lbmdpbmUgcmFuZG9tCisgICAgICAgKiAgICAgICAgbnVtYmVyIGdlbmVyYXRvciBlbmdpbmUgQHAgX194IGludG8gdGhlIG91dHB1dCBzdHJlYW0KKwlAcCBfX29zLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX29zIEFuIG91dHB1dCBzdHJlYW0uCisgICAgICAgKiBAcGFyYW0gX194ICBBICVzaHVmZmxlX29yZGVyX2VuZ2luZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgVGhlIG91dHB1d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jb25zdGV4cHIgcmVzdWx0X3R5cGUKKyAgICBtaW4oKQorICAgIHsgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8cmVzdWx0X3R5cGU+OjptaW4oKTsgfQorCisgICAgc3RhdGljIGNvbnN0ZXhwciByZXN1bHRfdHlwZQorICAgIG1heCgpCisgICAgeyByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxyZXN1bHRfdHlwZT46Om1heCgpOyB9CisKKyAgICBkb3VibGUKKyAgICBlbnRyb3B5KCkgY29uc3Qgbm9leGNlcHQKKyAgICB7IHJldHVybiAwLjA7IH0KKworICAgIHJlc3VsdF90eXBlCisgICAgb3BlcmF0b3IoKSgpCisgICAgeworI2lmZGVmIF9HTElCQ1hYX1VTRV9SQU5ET01fVFIxCisgICAgICByZXN1bHRfdHlwZSBfX3JldDsKKyAgICAgIHN0ZDo6ZnJlYWQocmVpbnRlcnByZXRfY2FzdDx2b2lkKj4oJl9fcmV0KSwgc2l6ZW9mKHJlc3VsdF90eXBlKSwKKwkJIDEsIF9NX2ZpbGUpOworICAgICAgcmV0dXJuIF9fcmV0OworI2Vsc2UKKyAgICAgIHJldHVybiBfTV9tdCgpOworI2VuZGlmCisgICAgfQorCisgICAgLy8gTm8gY29weSBmdW5jdGlvbnMuCisgICAgcmFuZG9tX2RldmljZShjb25zdCByYW5kb21fZGV2aWNlJikgPSBkZWxldGU7CisgICAgdm9pZCBvcGVyYXRvcj0oY29uc3QgcmFuZG9tX2RldmljZSYpID0gZGVsZXRlOworCisgIHByaXZhdGU6CisKKyNpZmRlZiBfR0xJQkNYWF9VU0VfUkFORE9NX1RSMQorICAgIEZJTEUqICAgICAgICBfTV9maWxlOworI2Vsc2UKKyAgICBtdDE5OTM3ICAgICAgX01fbXQ7CisjZW5kaWYKKyAgfTsKKworICAvKiBAfSAqLyAvLyBncm91cCByYW5kb21fZ2VuZXJhdG9ycworCisgIC8qKgorICAgKiBAYWRkdG9ncm91cCByYW5kb21fZGlzdHJp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KKwlwYXJhbV90eXBlKF9JbnRUeXBlIF9fYSA9IDAsCisJCSAgIF9JbnRUeXBlIF9fYiA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X0ludFR5cGU+OjptYXgoKSkKKwk6IF9NX2EoX19hKSwgX01fYihfX2IpCisJeworCSAgX0dMSUJDWFhfREVCVUdfQVNTRVJUKF9NX2EgPD0gX01fYik7CisJfQorCisJcmVzdWx0X3R5cGUKKwlhKCkgY29uc3QKKwl7IHJldHVybiBfTV9hOyB9CisKKwlyZXN1bHRfdHlwZQorCWIoKSBjb25zdAorCXsgcmV0dXJuIF9NX2I7IH0KKworCWZyaWVuZCBib29sCisJb3BlcmF0b3I9PShjb25zdCBwYXJhbV90eXBlJiBfX3AxLCBjb25zdCBwYXJhbV90eXBlJiBfX3AyKQorCXsgcmV0dXJuIF9fcDEuX01fYSA9PSBfX3AyLl9NX2EgJiYgX19wMS5fTV9iID09IF9fcDIuX01fYjsgfQorCisgICAgICBwcml2YXRlOgorCV9JbnRUeXBlIF9NX2E7CisJX0ludFR5cGUgX01fYjsKKyAgICAgIH07CisKKyAgICBwdWJsaWM6CisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb25zdHJ1Y3RzIGEgdW5pZm9ybSBkaXN0cmlidXRpb24gb2JqZWN0LgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgdW5pZm9ybV9pbnRfZGlzdHJpYnV0aW9uKF9JbnRUeXBlIF9fYSA9IDAsCisJCQkgICBfSW50VHlwZSBfX2IgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9JbnRUeXBlPjo6bWF4KCkpCisgICAgICA6IF9NX3BhcmFtKF9fYSwgX19iKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICB1bmlmb3JtX2ludF9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKgorICAgICAgICogRG9lcyBub3RoaW5nIGZvciB0aGUgdW5pZm9ybSBpbnRlZ2VyIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoKSB7IH0KKworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIGEoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0uYSgpOyB9CisKKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBiKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmIoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHBhcmFtX3R5cGUKKyAgICAgIHBhcmFtKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNldHMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqIEBwYXJhbSBfX3BhcmFtIFRoZSBuZXcgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBwYXJhbShjb25zdCBwYXJhbV90eXBlJiBfX3BhcmFtKQorICAgICAgeyBfTV9wYXJhbSA9IF9fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgaW5jbHVzaXZlIGxvd2VyIGJvdW5kIG9mIHRoZSBkaXN0cmlidXRpb24gcmFuZ2UuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+YS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0aW9uIHN0YXRlLgorICAgICAgICoKKyAgICAgICAqIERvZXMgbm90aGluZyBmb3IgdGhlIHVuaWZvcm0gcmVhbCBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkgeyB9CisKKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBhKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmEoKTsgfQorCisgICAgICByZXN1bHRfdHlwZQorICAgICAgYigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5iKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcGFyYW0oY29uc3QgcGFyYW1fdHlwZSYgX19wYXJhbSkKKyAgICAgIHsgX01fcGFyYW0gPSBfX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGluY2x1c2l2ZSBsb3dlciBib3VuZCBvZiB0aGUgZGlzdHJpYnV0aW9uIHJhbmdlLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmEoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZ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vbi4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIG5vcm1hbF9kaXN0cmlidXRpb24ocmVzdWx0X3R5cGUgX19tZWFuID0gcmVzdWx0X3R5cGUoMCksCisJCQkgIHJlc3VsdF90eXBlIF9fc3RkZGV2ID0gcmVzdWx0X3R5cGUoMSkpCisgICAgICA6IF9NX3BhcmFtKF9fbWVhbiwgX19zdGRkZXYpLCBfTV9zYXZlZF9hdmFpbGFibGUoZmFsc2UpCisgICAgICB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIG5vcm1hbF9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApLCBfTV9zYXZlZF9hdmFpbGFibGUoZmFsc2UpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgX01fc2F2ZWRfYXZhaWxhYmxlID0gZmFsc2U7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgbWVhbiBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIG1lYW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0ubWVhbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHN0YW5kYXJkIGRldmlhdGlvbiBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIHN0ZGRldigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5zdGRkZXYoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc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9fcDEuX01fcyA9PSBfX3AyLl9NX3M7IH0KKworICAgICAgcHJpdmF0ZToKKwlfUmVhbFR5cGUgX01fbTsKKwlfUmVhbFR5cGUgX01fczsKKyAgICAgIH07CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBsb2dub3JtYWxfZGlzdHJpYnV0aW9uKF9SZWFsVHlwZSBfX20gPSBfUmVhbFR5cGUoMCksCisJCQkgICAgIF9SZWFsVHlwZSBfX3MgPSBfUmVhbFR5cGUoMSkpCisgICAgICA6IF9NX3BhcmFtKF9fbSwgX19zKSwgX01fbmQoKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBsb2dub3JtYWxfZGlzdHJpYnV0aW9uKGNvbnN0IHBhcmFtX3R5cGUmIF9fcCkKKyAgICAgIDogX01fcGFyYW0oX19wKSwgX01fbmQoKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgX01fbmQucmVzZXQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqCisgICAgICAgKi8KKyAgICAgIF9SZWFsVHlwZQorICAgICAgbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5tKCk7IH0KKworICAgICAgX1JlYWxUeXBlCisgICAgICBzKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLnMoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHBhcmFtX3R5cGUKKyAgICAgIHBhcmFtKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNldHMgdGhlIHBhcm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XQoKQorICAgICAgeyBfTV9uZC5yZXNldCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIEBmJFxhbHBoYUBmJCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIGFscGhhKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmFscGhhKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgQGYkXGJldGFAZiQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgX1JlYWxUeXBlCisgICAgICBiZXRhKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmJldGEoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHBhcmFtX3R5cGUKKyAgICAgIHBhcmFtKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNldHMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqIEBwYXJhbSBfX3BhcmFtIFRoZSBuZXcgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBwYXJhbShjb25zdCBwYXJhbV90eXBlJiBfX3BhcmFtKQorICAgICAgeyBfTV9wYXJhbSA9IF9fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgZ3JlYXRlc3QgbG93ZXIgYm91bmQgdmFsdWUgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgIC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YXJhbV90eXBlKF9SZWFsVHlwZSBfX24gPSBfUmVhbFR5cGUoMSkpCisJOiBfTV9uKF9fbikKKwl7IH0KKworCV9SZWFsVHlwZQorCW4oKSBjb25zdAorCXsgcmV0dXJuIF9NX247IH0KKworCWZyaWVuZCBib29sCisJb3BlcmF0b3I9PShjb25zdCBwYXJhbV90eXBlJiBfX3AxLCBjb25zdCBwYXJhbV90eXBlJiBfX3AyKQorCXsgcmV0dXJuIF9fcDEuX01fbiA9PSBfX3AyLl9NX247IH0KKworICAgICAgcHJpdmF0ZToKKwlfUmVhbFR5cGUgX01fbjsKKyAgICAgIH07CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBjaGlfc3F1YXJlZF9kaXN0cmlidXRpb24oX1JlYWxUeXBlIF9fbiA9IF9SZWFsVHlwZSgxKSkKKyAgICAgIDogX01fcGFyYW0oX19uKSwgX01fZ2QoX19uIC8gMikKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgY2hpX3NxdWFyZWRfZGlzdHJpYnV0aW9uKGNvbnN0IHBhcmFtX3R5cGUmIF9fcCkKKyAgICAgIDogX01fcGFyYW0oX19wKSwgX01fZ2QoX19wLm4oKSAvIDIpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgX01fZ2QucmVzZXQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqCisgICAgICAgKi8KKyAgICAgIF9SZWFsVHlwZQorICAgICAgbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5uKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgIC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cGFyYW1fdHlwZSYgX19wMikKKwl7IHJldHVybiBfX3AxLl9NX2EgPT0gX19wMi5fTV9hICYmIF9fcDEuX01fYiA9PSBfX3AyLl9NX2I7IH0KKworICAgICAgcHJpdmF0ZToKKwlfUmVhbFR5cGUgX01fYTsKKwlfUmVhbFR5cGUgX01fYjsKKyAgICAgIH07CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBjYXVjaHlfZGlzdHJpYnV0aW9uKF9SZWFsVHlwZSBfX2EgPSBfUmVhbFR5cGUoMCksCisJCQkgIF9SZWFsVHlwZSBfX2IgPSBfUmVhbFR5cGUoMSkpCisgICAgICA6IF9NX3BhcmFtKF9fYSwgX19iKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBjYXVjaHlfZGlzdHJpYnV0aW9uKGNvbnN0IHBhcmFtX3R5cGUmIF9fcCkKKyAgICAgIDogX01fcGFyYW0oX19wKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJlc2V0cyB0aGUgZGlzdHJpYnV0aW9uIHN0YXRlLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIGEoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0uYSgpOyB9CisKKyAgICAgIF9SZWFsVHlwZQorICAgICAgYigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5iKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRo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BfX24pLCBfTV9nZF94KF9fbSAvIDIpLCBfTV9nZF95KF9fbiAvIDIpCisgICAgICB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIGZpc2hlcl9mX2Rpc3RyaWJ1dGlvbihjb25zdCBwYXJhbV90eXBlJiBfX3ApCisgICAgICA6IF9NX3BhcmFtKF9fcCksIF9NX2dkX3goX19wLm0oKSAvIDIpLCBfTV9nZF95KF9fcC5uKCkgLyAyKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJlc2V0cyB0aGUgZGlzdHJpYnV0aW9uIHN0YXRlLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpCisgICAgICB7CisJX01fZ2RfeC5yZXNldCgpOworCV9NX2dkX3kucmVzZXQoKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIG0oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0ubSgpOyB9CisKKyAgICAgIF9SZWFsVHlwZQorICAgICAgbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5uKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcGFyYW0oY29uc3QgcGFyYW1fd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2l0CisgICAgICBzdHVkZW50X3RfZGlzdHJpYnV0aW9uKF9SZWFsVHlwZSBfX24gPSBfUmVhbFR5cGUoMSkpCisgICAgICA6IF9NX3BhcmFtKF9fbiksIF9NX25kKCksIF9NX2dkKF9fbiAvIDIsIDIpCisgICAgICB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIHN0dWRlbnRfdF9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApLCBfTV9uZCgpLCBfTV9nZChfX3AubigpIC8gMiwgMikKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbiBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoKQorICAgICAgeworCV9NX25kLnJlc2V0KCk7CisJX01fZ2QucmVzZXQoKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIG4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0ubigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgcGFyYW1fdHlwZQorICAgICAgcGFyYW0oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgU2V0cyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICogQHBhcmFtIF9fcGFyYW0gVGhlIG5ldyBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHBhcmFtKGNvbnN0IHBhcmFtX3R5cGUmIF9fcGFyYW0pCisgICAgICB7IF9NX3BhcmFtID0gX19wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBncmVhdGVzdCBsb3dlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8cmVzdWx0X3R5cGU+OjptaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBsZWFzdCB1cHBlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWF4KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8cmVzdWx0X3R5cGU+OjptYXgoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZW5lcmF0aW5nIGZ1bmN0aW9ucy4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VuaWZvcm1SYW5kb21OdW1iZXJHZW5lcmF0b3I+CisJcmVzdWx0X3R5cGUKKyAgICAgICAgb3BlcmF0b3IoKShfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvciYgX191cm5nKQorICAgICAgICB7IHJldHVybiBfTV9uZChfX3VybmcpICogc3RkOjpzcXJ0KG4oKSAvIF9NX2dkKF9fdXJuZykpOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yPgorCXJlc3VsdF90eXBlCisJb3BlcmF0b3IoKShfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvciYgX191cm5nLAorCQkgICBjb25zdCBwYXJhbV90eXBlJiBfX3ApCis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19wMi5fTV9wOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgZG91YmxlIF9NX3A7CisgICAgfTsKKworICBwdWJsaWM6CisgICAgLyoqCisgICAgICogQGJyaWVmIENvbnN0cnVjdHMgYSBCZXJub3VsbGkgZGlzdHJpYnV0aW9uIHdpdGggbGlrZWxpaG9vZCBAcCBwLgorICAgICAqCisgICAgICogQHBhcmFtIF9fcCAgW0lOXSAgVGhlIGxpa2VsaWhvb2Qgb2YgYSB0cnVlIHJlc3VsdCBiZWluZyByZXR1cm5lZC4KKyAgICAgKiAgICAgICAgICAgICAgICAgICBNdXN0IGJlIGluIHRoZSBpbnRlcnZhbCBAZiRbMCwgMV1AZiQuCisgICAgICovCisgICAgZXhwbGljaXQKKyAgICBiZXJub3VsbGlfZGlzdHJpYnV0aW9uKGRvdWJsZSBfX3AgPSAwLjUpCisgICAgOiBfTV9wYXJhbShfX3ApCisgICAgeyB9CisKKyAgICBleHBsaWNpdAorICAgIGJlcm5vdWxsaV9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgIDogX01fcGFyYW0oX19wKQorICAgIHsgfQorCisgICAgLyoqCisgICAgICogQGJyaWVmIFJlc2V0cyB0aGUgZGlzdHJpYnV0aW9uIHN0YXRlLgorICAgICAqCisgICAgICogRG9lcyBub3RoaW5nIGZvciBhIEJlcm5vdWxsaSBkaXN0cmlidXRpb24uCisgICAgICovCisgICAgdm9pZAorICAgIHJlc2V0KCkgeyB9CisKKyAgICAvKioKKyAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgQHAgcCBwYXJhbWV0ZXIgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgKi8KKyAgICBkb3VibGUKKyAgICBwKCkgY29uc3QKKyAgICB7IHJldHVybiBfTV9wYXJhbS5wKCk7IH0KKworICAgIC8qKgorICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidX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cGUmIF9fcDEsIGNvbnN0IHBhcmFtX3R5cGUmIF9fcDIpCisJeyByZXR1cm4gX19wMS5fTV90ID09IF9fcDIuX01fdCAmJiBfX3AxLl9NX3AgPT0gX19wMi5fTV9wOyB9CisKKyAgICAgIHByaXZhdGU6CisJdm9pZAorCV9NX2luaXRpYWxpemUoKTsKKworCV9JbnRUeXBlIF9NX3Q7CisJZG91YmxlIF9NX3A7CisKKwlkb3VibGUgX01fcTsKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisJZG91YmxlIF9NX2QxLCBfTV9kMiwgX01fczEsIF9NX3MyLCBfTV9jLAorCSAgICAgICBfTV9hMSwgX01fYTEyMywgX01fcywgX01fbGYsIF9NX2xwMXA7CisjZW5kaWYKKwlib29sICAgX01fZWFzeTsKKyAgICAgIH07CisKKyAgICAgIC8vIGNvbnN0cnVjdG9ycyBhbmQgbWVtYmVyIGZ1bmN0aW9uCisgICAgICBleHBsaWNpdAorICAgICAgYmlub21pYWxfZGlzdHJpYnV0aW9uKF9JbnRUeXBlIF9fdCA9IF9JbnRUeXBlKDEpLAorCQkJICAgIGRvdWJsZSBfX3AgPSAwLjUpCisgICAgICA6IF9NX3BhcmFtKF9fdCwgX19wKSwgX01fbmQoKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBiaW5vbWlhbF9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApLCBfTV9uZCgpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgX01fbmQucmVzZXQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBkaXN0cmlidXRpb24gQHAgdCBwYXJhbWV0ZXIuCisgICAgICAgKi8KKyAgICAgIF9JbnRUeXBlCisgICAgICB0KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLnQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBkaXN0cmlidXRpb24gQHAgcCBwYXJhbWV0ZXIuCisgICAgICAgKi8KKyAgICAgIGRvdWJsZQorICAgICAgcCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5wKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcGFyYW0oY29uc3QgcGFyYW1fdHlwZSYgX19wYXJhbSkKKyAgICAgIHsgX01fcGFyYW0gPSBfX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGdyZWF0ZXN0IGxvd2VyIGJvdW5kIHZhbHVlIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gMDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBsZWFzdCB1cHBlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJp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25zdCBwYXJhbV90eXBlJiBfX3ApCisgICAgICA6IF9NX3BhcmFtKF9fcCkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbiBzdGF0ZS4KKyAgICAgICAqCisgICAgICAgKiBEb2VzIG5vdGhpbmcgZm9yIHRoZSBnZW9tZXRyaWMgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBkaXN0cmlidXRpb24gcGFyYW1ldGVyIEBwIHAuCisgICAgICAgKi8KKyAgICAgIGRvdWJsZQorICAgICAgcCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5wKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcGFyYW0oY29uc3QgcGFyYW1fdHlwZSYgX19wYXJhbSkKKyAgICAgIHsgX01fcGFyYW0gPSBfX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGdyZWF0ZXN0IGxvd2VyIGJvdW5kIHZhbHVlIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi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rKSwgX01fcChfX3ApCisJeworCSAgX0dMSUJDWFhfREVCVUdfQVNTRVJUKChfTV9rID4gMCkgJiYgKF9NX3AgPiAwLjApICYmIChfTV9wIDw9IDEuMCkpOworCX0KKworCV9JbnRUeXBlCisJaygpIGNvbnN0CisJeyByZXR1cm4gX01fazsgfQorCisJZG91YmxlCisJcCgpIGNvbnN0CisJeyByZXR1cm4gX01fcDsgfQorCisJZnJpZW5kIGJvb2wKKwlvcGVyYXRvcj09KGNvbnN0IHBhcmFtX3R5cGUmIF9fcDEsIGNvbnN0IHBhcmFtX3R5cGUmIF9fcDIpCisJeyByZXR1cm4gX19wMS5fTV9rID09IF9fcDIuX01fayAmJiBfX3AxLl9NX3AgPT0gX19wMi5fTV9wOyB9CisKKyAgICAgIHByaXZhdGU6CisJX0ludFR5cGUgX01fazsKKwlkb3VibGUgX01fcDsKKyAgICAgIH07CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBuZWdhdGl2ZV9iaW5vbWlhbF9kaXN0cmlidXRpb24oX0ludFR5cGUgX19rID0gMSwgZG91YmxlIF9fcCA9IDAuNSkKKyAgICAgIDogX01fcGFyYW0oX19rLCBfX3ApLCBfTV9nZChfX2ssICgxLjAgLSBfX3ApIC8gX19wKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBuZWdhdGl2ZV9iaW5vbWlhbF9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApLCBfTV9nZChfX3AuaygpLCAoMS4wIC0gX19wLnAoKSkgLyBfX3AucCgpKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJlc2V0cyB0aGUgZGlzdHJpYnV0aW9uIHN0YXRlLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpCisgICAgICB7IF9NX2dkLnJlc2V0KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJuIHRoZSBAZiRrQGYkIHBhcmFtZXRlciBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfSW50VHlwZQorICAgICAgaygpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5rKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJuIHRoZSBAZiRwQGYkIHBhcmFtZXRlciBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBkb3VibGUKKyAgICAgIHAoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0ucCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgcGFyYW1fdHlwZQorICAgICAgcGFyYW0oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgU2V0cyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICogQHBhcmFtIF9fcGFyYW0gVGhlIG5ldyBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHBhcmFtKGNvbnN0IHBhcmFtX3R5cGUmIF9fcGFyYW0pCisgICAgICB7IF9NX3BhcmFtID0gX19wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBncmVhdGVzdCBsb3dlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHJlc3VsdF90eXBlKDApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQ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LyBjb25zdHJ1Y3RvcnMgYW5kIG1lbWJlciBmdW5jdGlvbgorICAgICAgZXhwbGljaXQKKyAgICAgIHBvaXNzb25fZGlzdHJpYnV0aW9uKGRvdWJsZSBfX21lYW4gPSAxLjApCisgICAgICA6IF9NX3BhcmFtKF9fbWVhbiksIF9NX25kKCkKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgcG9pc3Nvbl9kaXN0cmlidXRpb24oY29uc3QgcGFyYW1fdHlwZSYgX19wKQorICAgICAgOiBfTV9wYXJhbShfX3ApLCBfTV9uZCgpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgX01fbmQucmVzZXQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBkaXN0cmlidXRpb24gcGFyYW1ldGVyIEBwIG1lYW4uCisgICAgICAgKi8KKyAgICAgIGRvdWJsZQorICAgICAgbWVhbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbS5tZWFuKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAor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yAgICAgIHJlc2V0KCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGludmVyc2Ugc2NhbGUgcGFyYW1ldGVyIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIF9SZWFsVHlwZQorICAgICAgbGFtYmRhKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmxhbWJkYSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgcGFyYW1fdHlwZQorICAgICAgcGFyYW0oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgU2V0cyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICogQHBhcmFtIF9fcGFyYW0gVGhlIG5ldyBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHBhcmFtKGNvbnN0IHBhcmFtX3R5cGUmIF9fcGFyYW0pCisgICAgICB7IF9NX3BhcmFtID0gX19wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBncmVhdGVzdCBsb3dlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHJlc3VsdF90eXBlKDApOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGxlYXN0IHVwcGVyIGJvdW5kIHZhbHVlIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi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lciBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIGEoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0uYSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybiB0aGUgQGYkYkBmJCBwYXJhbWV0ZXIgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgX1JlYWxUeXBlCisgICAgICBiKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtLmIoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHBhcmFtX3R5cGUKKyAgICAgIHBhcmFtKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNldHMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqIEBwYXJhbSBfX3BhcmFtIFRoZSBuZXcgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBwYXJhbShjb25zdCBwYXJhbV90eXBlJiBfX3BhcmFtKQorICAgICAgeyBfTV9wYXJhbSA9IF9fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgZ3JlYXRlc3QgbG93ZXIgYm91bmQgdmFsdWUgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1pbigpIGNvbnN0CisgICAgICB7IHJldHVybiByZXN1bHRfdHlwZSgwKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZ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lCisJYigpIGNvbnN0CisJeyByZXR1cm4gX01fYjsgfQorCisJZnJpZW5kIGJvb2wKKwlvcGVyYXRvcj09KGNvbnN0IHBhcmFtX3R5cGUmIF9fcDEsIGNvbnN0IHBhcmFtX3R5cGUmIF9fcDIpCisJeyByZXR1cm4gX19wMS5fTV9hID09IF9fcDIuX01fYSAmJiBfX3AxLl9NX2IgPT0gX19wMi5fTV9iOyB9CisKKyAgICAgIHByaXZhdGU6CisJX1JlYWxUeXBlIF9NX2E7CisJX1JlYWxUeXBlIF9NX2I7CisgICAgICB9OworCisgICAgICBleHBsaWNpdAorICAgICAgZXh0cmVtZV92YWx1ZV9kaXN0cmlidXRpb24oX1JlYWxUeXBlIF9fYSA9IF9SZWFsVHlwZSgwKSwKKwkJCQkgX1JlYWxUeXBlIF9fYiA9IF9SZWFsVHlwZSgxKSkKKyAgICAgIDogX01fcGFyYW0oX19hLCBfX2IpCisgICAgICB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIGV4dHJlbWVfdmFsdWVfZGlzdHJpYnV0aW9uKGNvbnN0IHBhcmFtX3R5cGUmIF9fcCkKKyAgICAgIDogX01fcGFyYW0oX19wKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJlc2V0cyB0aGUgZGlzdHJpYnV0aW9uIHN0YXRlLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJuIHRoZSBAZiRhQGYkIHBhcmFtZXRlciBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIGEoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW0uYSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybiB0aGUgQGYkYkBmJCBwYXJhbWV0ZXIgb2YgdGhlIGRpc3RyaWJ1dGlvbi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01fcGFyYW0oX193YmVnaW4sIF9fd2VuZCkKKwl7IH0KKworICAgICAgZGlzY3JldGVfZGlzdHJpYnV0aW9uKGluaXRpYWxpemVyX2xpc3Q8ZG91YmxlPiBfX3dsKQorICAgICAgOiBfTV9wYXJhbShfX3dsKQorICAgICAgeyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9GdW5jPgorCWRpc2NyZXRlX2Rpc3RyaWJ1dGlvbihzaXplX3QgX19udywgZG91YmxlIF9feG1pbiwgZG91YmxlIF9feG1heCwKKwkJCSAgICAgIF9GdW5jIF9fZncpCisJOiBfTV9wYXJhbShfX253LCBfX3htaW4sIF9feG1heCwgX19mdykKKwl7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIGRpc2NyZXRlX2Rpc3RyaWJ1dGlvbihjb25zdCBwYXJhbV90eXBlJiBfX3ApCisgICAgICA6IF9NX3BhcmFtKF9fcCkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbiBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHByb2JhYmlsaXRpZXMgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgc3RkOjp2ZWN0b3I8ZG91YmxlPgorICAgICAgcHJvYmFiaWxpdGllcygpIGNvbnN0CisgICAgICB7CisJcmV0dXJuIF9NX3BhcmFtLl9NX3Byb2IuZW1wdHkoKQorCSAgPyBzdGQ6OnZlY3Rvcjxkb3VibGU+KDEsIDEuMCkgOiBfTV9wYXJhbS5fTV9wcm9iOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi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cCkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbiBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgYSB2ZWN0b3Igb2YgdGhlIGludGVydmFscy4KKyAgICAgICAqLworICAgICAgc3RkOjp2ZWN0b3I8X1JlYWxUeXBlPgorICAgICAgaW50ZXJ2YWxzKCkgY29uc3QKKyAgICAgIHsKKwlpZiAoX01fcGFyYW0uX01faW50LmVtcHR5KCkpCisJICB7CisJICAgIHN0ZDo6dmVjdG9yPF9SZWFsVHlwZT4gX190bXAoMik7CisJICAgIF9fdG1wWzFdID0gX1JlYWxUeXBlKDEpOworCSAgICByZXR1cm4gX190bXA7CisJICB9CisJZWxzZQorCSAgcmV0dXJuIF9NX3BhcmFtLl9NX2ludDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyBhIHZlY3RvciBvZiB0aGUgcHJvYmFiaWxpdHkgZGVuc2l0aWVzLgorICAgICAgICovCisgICAgICBzdGQ6OnZlY3Rvcjxkb3VibGU+CisgICAgICBkZW5zaXRpZXMoKSBjb25zdAorICAgICAgeworCXJldHVybiBfTV9wYXJhbS5fTV9kZW4uZW1wdHkoKQorCSAgPyBzdGQ6OnZlY3Rvcjxkb3VibGU+KDEsIDEuMCkgOiBfTV9wYXJhbS5fTV9kZW47CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgcGFyYW1fdHlwZQorICAgICAgcGFyYW0oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGFyYW07IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYn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9GdW5jIF9fZncpCisJOiBfTV9wYXJhbShfX253LCBfX3htaW4sIF9feG1heCwgX19mdykKKwl7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIHBpZWNld2lzZV9saW5lYXJfZGlzdHJpYnV0aW9uKGNvbnN0IHBhcmFtX3R5cGUmIF9fcCkKKyAgICAgIDogX01fcGFyYW0oX19wKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogUmVzZXRzIHRoZSBkaXN0cmlidXRpb24gc3RhdGUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm4gdGhlIGludGVydmFscyBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBzdGQ6OnZlY3RvcjxfUmVhbFR5cGU+CisgICAgICBpbnRlcnZhbHMoKSBjb25zdAorICAgICAgeworCWlmIChfTV9wYXJhbS5fTV9pbnQuZW1wdHkoKSkKKwkgIHsKKwkgICAgc3RkOjp2ZWN0b3I8X1JlYWxUeXBlPiBfX3RtcCgyKTsKKwkgICAgX190bXBbMV0gPSBfUmVhbFR5cGUoMSk7CisJICAgIHJldHVybiBfX3RtcDsKKwkgIH0KKwllbHNlCisJICByZXR1cm4gX01fcGFyYW0uX01faW50OworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm4gYSB2ZWN0b3Igb2YgdGhlIHByb2JhYmlsaXR5IGRlbnNpdGllcyBvZiB0aGUKKyAgICAgICAqICAgICAgICBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHN0ZDo6dmVjdG9yPGRvdWJsZT4KKyAgICAgIGRlbnNpdGllcygpIGNvbnN0CisgICAgICB7CisJcmV0dXJuIF9NX3BhcmFtLl9NX2Rlbi5lbXB0eSgpCisJICA/IHN0ZDo6dmVjdG9yPGRvdWJsZT4oMiwgMS4wKSA6IF9NX3BhcmFtLl9NX2RlbjsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgUmV0dXJucyB0aGUgcGFyYW1ldGVyIHNldCBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBwYXJhbV90eXBlCisgICAgICBwYXJhbSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9wYXJhbTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBTZXRzIHRoZSBwYXJhbWV0ZXIgc2V0IG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19wYXJhbSBUaGUgbmV3IHBhcmFtZXRlciBzZXQgb2YgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcGFyYW0oY29uc3QgcGFyYW1fdHlwZSYgX19wYXJhbSkKKyAgICAgIHsgX01fcGFyYW0gPSBfX3BhcmFtOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybnMgdGhlIGdyZWF0ZXN0IGxvd2VyIGJvdW5kIHZhbHVlIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtaW4oKSBjb25zdAorICAgICAgeworCXJldHVybiBfTV9wYXJhbS5fTV9pbnQuZW1wdHkoKQorCSAgPyByZXN1bHRfdHlwZSgwKSA6IF9NX3BhcmFtLl9NX2ludC5mcm9udCgpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBSZXR1cm5zIHRoZSBsZWFzdCB1cHBlciBib3VuZCB2YWx1ZSBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWF4KCkgY29uc3QKKyAgICAgIHsKKwlyZXR1cm4gX01fcGFyYW0uX01faW50LmVtcHR5KCkKKwkgID8gcmVzdWx0X3R5cGUoMSkgOiBfTV9wYXJhbS5fTV9pbnQuYmFjaygpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZW5lcmF0aW5nIGZ1bmN0aW9ucy4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VuaWZvcm1SYW5kb21OdW1iZXJHZW5lcmF0b3I+CisJcmVzdWx0X3R5cGUKKwlvcGVyYXRvcigpKF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yJiBfX3VybmcpCisJeyByZXR1cm4gdGhpcy0+b3BlcmF0b3IoKShfX3VybmcsIHRoaXMtPnBhcmFtKCkpOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yPgorCXJlc3VsdF90eXBlCisJb3BlcmF0b3IoKShfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvciYgX191cm5nLAorCQkgICBjb25zdCBwYXJhbV90eXBlJiBfX3ApOworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBJbnNlcnRzIGEgJXBpZWNld2lzZV9saW5lYXJfZGlzdHJpYnV0aW9uIHJhbmRvbSBudW1iZXIKKyAgICAgICAqICAgICAgICBkaXN0cmlidXRpb24gQHAgX194IGludG8gdGhlIG91dHB1dCBzdHJlYW0gQHAgX19vcy4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19vcyBBbiBvdXRwdXQgc3RyZWFtLgorICAgICAgICogQHBhcmFtIF9feCAgQSAlcGllY2V3aXNlX2xpbmVhcl9kaXN0cmlidXRpb24gcmFuZG9tIG51bWJlcgorICAgICAgICogICAgICAgICAgICAgZGlzdHJpYnV0aW9uLgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIFRoZSBvdXRwdXQgc3RyZWFtIHdpdGggdGhlIHN0YXRlIG9mIEBwIF9feCBpbnNlcnRlZCBvciBpbgorICAgICAgICogICAgICAgICAgYW4gZXJyb3Igc3Rh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fdCBfX24sIHNpemVfdCBfX20sIHNpemVfdCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgc2l6ZV90IF9fdSwgX1VJbnRUeXBlIF9fZCwgc2l6ZV90IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBzaXplX3QgX190LCBfVUludFR5cGUgX19jLCBzaXplX3QgX19sLAorCSAgIF9VSW50VHlwZSBfX2Y+CisgICAgY29uc3RleHByIHNpemVfdAorICAgIG1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19kLAorCQkJICAgIF9fcywgX19iLCBfX3QsIF9fYywgX19sLCBfX2Y+OjpzaGlmdF9zaXplOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9VSW50VHlwZSwKKwkgICBzaXplX3QgX193LCBzaXplX3QgX19uLCBzaXplX3QgX19tLCBzaXplX3QgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIHNpemVfdCBfX3UsIF9VSW50VHlwZSBfX2QsIHNpemVfdCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgc2l6ZV90IF9fdCwgX1VJbnRUeXBlIF9fYywgc2l6ZV90IF9fbCwKKwkgICBfVUludFR5cGUgX19mPgorICAgIGNvbnN0ZXhwciBzaXplX3QKKyAgICBtZXJzZW5uZV90d2lzdGVyX2VuZ2luZTxfVUludFR5cGUsIF9fdywgX19uLCBfX20sIF9fciwgX19hLCBfX3UsIF9fZCwKKwkJCSAgICBfX3MsIF9fYiwgX190LCBfX2MsIF9fbCwgX19mPjo6bWFza19iaXRzOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9VSW50VHlwZSwKKwkgICBzaXplX3QgX193LCBzaXplX3QgX19uLCBzaXplX3QgX19tLCBzaXplX3QgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIHNpemVfdCBfX3UsIF9VSW50VHlwZSBfX2QsIHNpemVfdCBfX3MsCisJICAgX1VJbnRU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AgIHNpemVfdCBfX3csIHNpemVfdCBfX24sIHNpemVfdCBfX20sIHNpemVfdCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgc2l6ZV90IF9fdSwgX1VJbnRUeXBlIF9fZCwgc2l6ZV90IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBzaXplX3QgX190LCBfVUludFR5cGUgX19jLCBzaXplX3QgX19sLAorCSAgIF9VSW50VHlwZSBfX2Y+CisgICAgY29uc3RleHByIHNpemVfdAorICAgIG1lcnNlbm5lX3R3aXN0ZXJfZW5naW5lPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19kLAorCQkJICAgIF9fcywgX19iLCBfX3QsIF9fYywgX19sLCBfX2Y+Ojp0ZW1wZXJpbmdfbDsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVUludFR5cGUsCisJICAgc2l6ZV90IF9fdywgc2l6ZV90IF9fbiwgc2l6ZV90IF9fbSwgc2l6ZV90IF9fciwKKwkgICBfVUludFR5cGUgX19hLCBzaXplX3QgX191LCBfVUludFR5cGUgX19kLCBzaXplX3QgX19zLAorCSAgIF9VSW50VHlwZSBfX2IsIHNpemVfdCBfX3QsIF9VSW50VHlwZSBfX2MsIHNpemVfdCBfX2wsCisJICAgX1VJbnRUeXBlIF9fZj4KKyAgICBjb25zdGV4cHIgX1VJbnRUeXBlCisgICAgbWVyc2VubmVfdHdpc3Rlcl9lbmdpbmU8X1VJbnRUeXBlLCBfX3csIF9fbiwgX19tLCBfX3IsIF9fYSwgX191LCBfX2QsCisJCQkgICAgX19zLCBfX2IsIF9fdCwgX19jLCBfX2wsIF9fZj46OgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxpemF0aW9uX211bHRpcGxpZXI7CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1VJbnRUeXBlLAorCSAgIHNpemVfdCBfX3csIHNpemVfdCBfX24sIHNpemVfdCBf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sZWFzdDMyX3QgX19hcnJbX19uICogX19rXTsKKwlfX3EuZ2VuZXJhdGUoX19hcnIgKyAwLCBfX2FyciArIF9fbiAqIF9fayk7CisKKwlib29sIF9femVybyA9IHRydWU7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgc3RhdGVfc2l6ZTsgKytfX2kpCisJICB7CisJICAgIF9VSW50VHlwZSBfX2ZhY3RvciA9IDF1OworCSAgICBfVUludFR5cGUgX19zdW0gPSAwdTsKKwkgICAgZm9yIChzaXplX3QgX19qID0gMDsgX19qIDwgX19rOyArK19faikKKwkgICAgICB7CisJCV9fc3VtICs9IF9fYXJyW19fayAqIF9faSArIF9fal0gKiBfX2ZhY3RvcjsKKwkJX19mYWN0b3IgKj0gX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIDMyPjo6X192YWx1ZTsKKwkgICAgICB9CisJICAgIF9NX3hbX19pXSA9IF9fZGV0YWlsOjpfX21vZDxfVUludFR5cGUsCisJICAgICAgX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIF9fdz46Ol9fdmFsdWU+KF9fc3VtKTsKKworCSAgICBpZiAoX196ZXJvKQorCSAgICAgIHsKKwkJaWYgKF9faSA9PSAwKQorCQkgIHsKKwkJICAgIGlmICgoX01feFswXSAmIF9fdXBwZXJfbWFzaykgIT0gMHUpCisJCSAgICAgIF9femVybyA9IGZhbHNlOworCQkgIH0KKwkJZWxzZSBpZiAoX01feFtfX2ldICE9IDB1KQorCQkgIF9femVybyA9IGZhbHNlOworCSAgICAgIH0KKwkgIH0KKyAgICAgICAgaWYgKF9femVybykKKyAgICAgICAgICBfTV94WzBdID0gX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIF9fdyAtIDE+OjpfX3ZhbHVlOworICAgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9VSW50VHlwZSwgc2l6ZV90IF9fdywKKwkgICBzaXplX3QgX19uLCBzaXplX3QgX19tLCBzaXplX3QgX19yL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kJICAgXiAoKF9feSAmIDB4MDEpID8gX19hIDogMCkpOworCSAgICB9CisKKwkgIGZvciAoc2l6ZV90IF9fayA9IChfX24gLSBfX20pOyBfX2sgPCAoX19uIC0gMSk7ICsrX19rKQorCSAgICB7CisJICAgICAgX1VJbnRUeXBlIF9feSA9ICgoX01feFtfX2tdICYgX191cHBlcl9tYXNrKQorCQkJICAgICAgIHwgKF9NX3hbX19rICsgMV0gJiBfX2xvd2VyX21hc2spKTsKKwkgICAgICBfTV94W19fa10gPSAoX01feFtfX2sgKyAoX19tIC0gX19uKV0gXiAoX195ID4+IDEpCisJCQkgICBeICgoX195ICYgMHgwMSkgPyBfX2EgOiAwKSk7CisJICAgIH0KKworCSAgX1VJbnRUeXBlIF9feSA9ICgoX01feFtfX24gLSAxXSAmIF9fdXBwZXJfbWFzaykKKwkJCSAgIHwgKF9NX3hbMF0gJiBfX2xvd2VyX21hc2spKTsKKwkgIF9NX3hbX19uIC0gMV0gPSAoX01feFtfX20gLSAxXSBeIChfX3kgPj4gMSkKKwkJCSAgIF4gKChfX3kgJiAweDAxKSA/IF9fYSA6IDApKTsKKwkgIF9NX3AgPSAwOworCX0KKworICAgICAgLy8gQ2FsY3VsYXRlIG8oeChpKSkuCisgICAgICByZXN1bHRfdHlwZSBfX3ogPSBfTV94W19NX3ArK107CisgICAgICBfX3ogXj0gKF9feiA+PiBfX3UpICYgX19kOworICAgICAgX196IF49IChfX3ogPDwgX19zKSAmIF9fYjsKKyAgICAgIF9feiBePSAoX196IDw8IF9fdCkgJiBfX2M7CisgICAgICBfX3ogXj0gKF9feiA+PiBfX2wpOworCisgICAgICByZXR1cm4gX196OworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVUludFR5cGUsIHNpemVfdCBfX3csCisJICAgc2l6ZV90IF9fbiwgc2l6ZV90IF9fbSwgc2l6ZV90IF9fciwKKwkgICBfVUludFR5cGUgX19hLCBzaXplX3QgX191LCBfVUludFR5cGUgX19kLCBzaXplX3Q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gfCBfX2lvc19iYXNlOjpza2lwd3MpOworCisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCV9faXMgPj4gX194Ll9NX3hbX19pXTsKKyAgICAgIF9faXMgPj4gX194Ll9NX3A7CisKKyAgICAgIF9faXMuZmxhZ3MoX19mbGFncyk7CisgICAgICByZXR1cm4gX19pczsKKyAgICB9CisKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVUludFR5cGUsIHNpemVfdCBfX3csIHNpemVfdCBfX3MsIHNpemVfdCBfX3I+CisgICAgY29uc3RleHByIHNpemVfdAorICAgIHN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lPF9VSW50VHlwZSwgX193LCBfX3MsIF9fcj46OndvcmRfc2l6ZTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVUludFR5cGUsIHNpemVfdCBfX3csIHNpemVfdCBfX3MsIHNpemVfdCBfX3I+CisgICAgY29uc3RleHByIHNpemVfdAorICAgIHN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lPF9VSW50VHlwZSwgX193LCBfX3MsIF9fcj46OnNob3J0X2xhZzsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVUludFR5cGUsIHNpemVfdCBfX3csIHNpemVfdCBfX3MsIHNpemVfdCBfX3I+CisgICAgY29uc3RleHByIHNpemVfdAorICAgIHN1YnRyYWN0X3dpdGhfY2FycnlfZW5naW5lPF9VSW50VHlwZSwgX193LCBfX3MsIF9fcj46OmxvbmdfbGFnOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9VSW50VHlwZSwgc2l6ZV90IF9fdywgc2l6ZV90IF9fcywgc2l6ZV90IF9fcj4KKyAgICBjb25zdGV4cHIgX1VJbnRUeXBlCisgICAgc3VidHJhY3Rfd2l0aF9jYXJyeV9lbmdpbmU8X1VJbnRUeXBlLCBfX3csIF9fcywgX19yPjo6ZGVmYXVsdF9zZWVkOworCisgIHRlbXBsYXRlPHR5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AoX193MCA8IF9fY2RpZykKKwkgICAgeworCSAgICAgIF9fczAgPSBfX2N0eXBlKDEpIDw8IF9fdzA7CisJICAgICAgX19zMSA9IF9fczAgPDwgMTsKKwkgICAgfQorCisJICBfX3kwID0gMDsKKwkgIF9feTEgPSAwOworCSAgaWYgKF9fcikKKwkgICAgeworCSAgICAgIF9feTAgPSBfX3MwICogKF9fciAvIF9fczApOworCSAgICAgIGlmIChfX3MxKQorCQlfX3kxID0gX19zMSAqIChfX3IgLyBfX3MxKTsKKworCSAgICAgIGlmIChfX3IgLSBfX3kwIDw9IF9feTAgLyBfX24pCisJCWJyZWFrOworCSAgICB9CisJICBlbHNlCisJICAgIGJyZWFrOworCX0KKworICAgICAgcmVzdWx0X3R5cGUgX19zdW0gPSAwOworICAgICAgZm9yIChzaXplX3QgX19rID0gMDsgX19rIDwgX19uMDsgKytfX2spCisJeworCSAgX19jdHlwZSBfX3U7CisJICBkbworCSAgICBfX3UgPSBfTV9iKCkgLSBfTV9iLm1pbigpOworCSAgd2hpbGUgKF9feTAgJiYgX191ID49IF9feTApOworCSAgX19zdW0gPSBfX3MwICogX19zdW0gKyAoX19zMCA/IF9fdSAlIF9fczAgOiBfX3UpOworCX0KKyAgICAgIGZvciAoc2l6ZV90IF9fayA9IF9fbjA7IF9fayA8IF9fbjsgKytfX2spCisJeworCSAgX19jdHlwZSBfX3U7CisJICBkbworCSAgICBfX3UgPSBfTV9iKCkgLSBfTV9iLm1pbigpOworCSAgd2hpbGUgKF9feTEgJiYgX191ID49IF9feTEpOworCSAgX19zdW0gPSBfX3MxICogX19zdW0gKyAoX19zMSA/IF9fdSAlIF9fczEgOiBfX3UpOworCX0KKyAgICAgIHJldHVybiBfX3N1bTsKKyAgICB9CisKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUmFuZG9tTnVtYmVyRW5naW5lLCBzaXplX3QgX19rPgorICAgIGNvbnN0ZXhwciBzaXplX3QKKyAgICBzaHVmZmxlX29yZGVyX2VuZ2luZT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c2lvbiA9IF9fb3MucHJlY2lzaW9uKCk7CisgICAgICBjb25zdCBfQ2hhclQgX19zcGFjZSA9IF9fb3Mud2lkZW4oJyAnKTsKKyAgICAgIF9fb3MuZmxhZ3MoX19pb3NfYmFzZTo6c2NpZW50aWZpYyB8IF9faW9zX2Jhc2U6OmxlZnQpOworICAgICAgX19vcy5maWxsKF9fc3BhY2UpOworICAgICAgX19vcy5wcmVjaXNpb24oc3RkOjpudW1lcmljX2xpbWl0czxfUmVhbFR5cGU+OjptYXhfZGlnaXRzMTApOworCisgICAgICBfX29zIDw8IF9feC5hKCkgPDwgX19zcGFjZSA8PCBfX3guYigpOworCisgICAgICBfX29zLmZsYWdzKF9fZmxhZ3MpOworICAgICAgX19vcy5maWxsKF9fZmlsbCk7CisgICAgICBfX29zLnByZWNpc2lvbihfX3ByZWNpc2lvbik7CisgICAgICByZXR1cm4gX19vczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlLCB0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgc3RkOjpiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mCisgICAgb3BlcmF0b3I+PihzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19pcywKKwkgICAgICAgdW5pZm9ybV9yZWFsX2Rpc3RyaWJ1dGlvbjxfUmVhbFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19pc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9faXN0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19pcy5mbGFncygpOworICAgICAgX19pcy5mbGFncyh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ZmlsbCgpOworICAgICAgY29uc3Qgc3RkOjpzdHJlYW1zaXplIF9fcHJlY2lzaW9uID0gX19vcy5wcmVjaXNpb24oKTsKKyAgICAgIGNvbnN0IF9DaGFyVCBfX3NwYWNlID0gX19vcy53aWRlbignICcpOworICAgICAgX19vcy5mbGFncyhfX2lvc19iYXNlOjpzY2llbnRpZmljIHwgX19pb3NfYmFzZTo6bGVmdCk7CisgICAgICBfX29zLmZpbGwoX19vcy53aWRlbignICcpKTsKKyAgICAgIF9fb3MucHJlY2lzaW9uKHN0ZDo6bnVtZXJpY19saW1pdHM8ZG91YmxlPjo6bWF4X2RpZ2l0czEwKTsKKworICAgICAgX19vcyA8PCBfX3guaygpIDw8IF9fc3BhY2UgPDwgX194LnAoKQorCSAgIDw8IF9fc3BhY2UgPDwgX194Ll9NX2dkOworCisgICAgICBfX29zLmZsYWdzKF9fZmxhZ3MpOworICAgICAgX19vcy5maWxsKF9fZmlsbCk7CisgICAgICBfX29zLnByZWNpc2lvbihfX3ByZWNpc2lvbik7CisgICAgICByZXR1cm4gX19vczsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0ludFR5cGUsIHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cz4KKyAgICBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICBvcGVyYXRvcj4+KHN0ZDo6YmFzaWNfaXN0cmVhbTxfQ2hhclQsIF9UcmFpdHM+JiBfX2lzLAorCSAgICAgICBuZWdhdGl2ZV9iaW5vbWlhbF9kaXN0cmlidXRpb248X0ludFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19pc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9faXN0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICA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b3VibGUgX19jNCA9IF9fYzMgKyAxOworCSAgICAvLyBlXigxIC8gNzgpCisJICAgIGNvbnN0IGRvdWJsZSBfX2UxNzggPSAxLjAxMjkwMzA0NzkzMjAwMTg1ODMxODU1MTQ3Nzc1MTI5ODNMOworCSAgICBjb25zdCBkb3VibGUgX19jNSA9IF9fYzQgKyBfX2UxNzg7CisJICAgIGNvbnN0IGRvdWJsZSBfX2MgPSBfX3BhcmFtLl9NX2NiICsgX19jNTsKKwkgICAgY29uc3QgZG91YmxlIF9fMmN4ID0gMiAqICgyICogX19tICsgX19wYXJhbS5fTV9kKTsKKworCSAgICBib29sIF9fcmVqZWN0ID0gdHJ1ZTsKKwkgICAgZG8KKwkgICAgICB7CisJCWNvbnN0IGRvdWJsZSBfX3UgPSBfX2MgKiBfX2F1cm5nKCk7CisJCWNvbnN0IGRvdWJsZSBfX2UgPSAtc3RkOjpsb2coX19hdXJuZygpKTsKKworCQlkb3VibGUgX193ID0gMC4wOworCisJCWlmIChfX3UgPD0gX19jMSkKKwkJICB7CisJCSAgICBjb25zdCBkb3VibGUgX19uID0gX01fbmQoX191cm5nKTsKKwkJICAgIGNvbnN0IGRvdWJsZSBfX3kgPSAtc3RkOjphYnMoX19uKSAqIF9fcGFyYW0uX01fc20gLSAxOworCQkgICAgX194ID0gc3RkOjpmbG9vcihfX3kpOworCQkgICAgX193ID0gLV9fbiAqIF9fbiAvIDI7CisJCSAgICBpZiAoX194IDwgLV9fbSkKKwkJICAgICAgY29udGludWU7CisJCSAgfQorCQllbHNlIGlmIChfX3UgPD0gX19jMikKKwkJICB7CisJCSAgICBjb25zdCBkb3VibGUgX19uID0gX01fbmQoX191cm5nKTsKKwkJICAgIGNvbnN0IGRvdWJsZSBfX3kgPSAxICsgc3RkOjphYnMoX19uKSAqIF9fcGFyYW0uX01fc2N4OworCQkgICAgX194ID0gc3RkOjpjZWlsKF9feSk7CisJCSAgICBfX3cgPSBfX3kgKiAoMiAtIF9feSkgKiBfX3BhcmFtLl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gICB7CisJCV9fcHJvZCAqPSBfX2F1cm5nKCk7CisJCV9feCArPSAxOworCSAgICAgIH0KKwkgICAgd2hpbGUgKF9fcHJvZCA+IF9fcGFyYW0uX01fbG1fdGhyKTsKKworCSAgICByZXR1cm4gX194IC0gMTsKKwkgIH0KKyAgICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW50VHlwZSwKKwkgICB0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgc3RkOjpiYXNpY19vc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mCisgICAgb3BlcmF0b3I8PChzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19vcywKKwkgICAgICAgY29uc3QgcG9pc3Nvbl9kaXN0cmlidXRpb248X0ludFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19vc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fb3N0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19vcy5mbGFncygpOworICAgICAgY29uc3QgX0NoYXJUIF9fZmlsbCA9IF9fb3MuZmlsbCgpOworICAgICAgY29uc3Qgc3RkOjpzdHJlYW1zaXplIF9fcHJlY2lzaW9uID0gX19vcy5wcmVjaXNpb24oKTsKKyAgICAgIGNvbnN0IF9DaGFyVCBfX3NwYWNlID0gX19vcy53aWRlbignICcpOworICAgICAgX19vcy5mbGFncyhfX2lvc19iYXNlOjpzY2llbnRpZmljIHwgX19pb3NfYmFzZTo6bGVmdCk7CisgICAgICBfX29zLmZpbGwoX19zcGFjZSk7CisgICAgICBfX29zLnByZWNpc2lvbihzdGQ6Om51bWVyaWNfbGltaXRz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3RkOjpudW1lcmljX2xpbWl0czxkb3VibGU+OjplcHNpbG9uKCkpIC8gMjsKKwkgICAgY29uc3QgZG91YmxlIF9fdGhyID0KKwkgICAgICBzdGQ6Om51bWVyaWNfbGltaXRzPF9JbnRUeXBlPjo6bWF4KCkgKyBfX25hZjsKKworCSAgICBjb25zdCBkb3VibGUgX19ucCA9IHN0ZDo6Zmxvb3IoX190ICogX19wMTIpOworCisJICAgIC8vIHNxcnQocGkgLyAyKQorCSAgICBjb25zdCBkb3VibGUgX19zcGlfMiA9IDEuMjUzMzE0MTM3MzE1NTAwMjUxMjA3ODgyNjQyNDA1NTIyNkw7CisJICAgIGNvbnN0IGRvdWJsZSBfX2ExID0gX19wYXJhbS5fTV9hMTsKKwkgICAgY29uc3QgZG91YmxlIF9fYTEyID0gX19hMSArIF9fcGFyYW0uX01fczIgKiBfX3NwaV8yOworCSAgICBjb25zdCBkb3VibGUgX19hMTIzID0gX19wYXJhbS5fTV9hMTIzOworCSAgICBjb25zdCBkb3VibGUgX19zMXMgPSBfX3BhcmFtLl9NX3MxICogX19wYXJhbS5fTV9zMTsKKwkgICAgY29uc3QgZG91YmxlIF9fczJzID0gX19wYXJhbS5fTV9zMiAqIF9fcGFyYW0uX01fczI7CisKKwkgICAgYm9vbCBfX3JlamVjdDsKKwkgICAgZG8KKwkgICAgICB7CisJCWNvbnN0IGRvdWJsZSBfX3UgPSBfX3BhcmFtLl9NX3MgKiBfX2F1cm5nKCk7CisKKwkJZG91YmxlIF9fdjsKKworCQlpZiAoX191IDw9IF9fYTEpCisJCSAgeworCQkgICAgY29uc3QgZG91YmxlIF9fbiA9IF9NX25kKF9fdXJuZyk7CisJCSAgICBjb25zdCBkb3VibGUgX195ID0gX19wYXJhbS5fTV9zMSAqIHN0ZDo6YWJzKF9fbik7CisJCSAgICBfX3JlamVjdCA9IF9feSA+PSBfX3BhcmFtLl9NX2QxOworCQkgICAgaWYgKCFfX3JlamVjdCkKKwkJICAgICAgeworCQkJY29uc3QgZ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ICAgIGNvbnN0IGRvdWJsZSBfX2UxID0gLXN0ZDo6bG9nKF9fYXVybmcoKSk7CisJCSAgICBjb25zdCBkb3VibGUgX19lMiA9IC1zdGQ6OmxvZyhfX2F1cm5nKCkpOworCisJCSAgICBjb25zdCBkb3VibGUgX195ID0gX19wYXJhbS5fTV9kMgorCQkJCSAgICAgKyAyICogX19zMnMgKiBfX2UxIC8gX19wYXJhbS5fTV9kMjsKKwkJICAgIF9feCA9IHN0ZDo6Zmxvb3IoLV9feSk7CisJCSAgICBfX3YgPSAtX19lMiAtIF9fcGFyYW0uX01fZDIgKiBfX3kgLyAoMiAqIF9fczJzKTsKKwkJICAgIF9fcmVqZWN0ID0gZmFsc2U7CisJCSAgfQorCisJCV9fcmVqZWN0ID0gX19yZWplY3QgfHwgX194IDwgLV9fbnAgfHwgX194ID4gX190IC0gX19ucDsKKwkJaWYgKCFfX3JlamVjdCkKKwkJICB7CisJCSAgICBjb25zdCBkb3VibGUgX19sZnggPQorCQkgICAgICBzdGQ6OmxnYW1tYShfX25wICsgX194ICsgMSkKKwkJICAgICAgKyBzdGQ6OmxnYW1tYShfX3QgLSAoX19ucCArIF9feCkgKyAxKTsKKwkJICAgIF9fcmVqZWN0ID0gX192ID4gX19wYXJhbS5fTV9sZiAtIF9fbGZ4CisJCQkgICAgICsgX194ICogX19wYXJhbS5fTV9scDFwOworCQkgIH0KKworCQlfX3JlamVjdCB8PSBfX3ggKyBfX25wID49IF9fdGhyOworCSAgICAgIH0KKwkgICAgd2hpbGUgKF9fcmVqZWN0KTsKKworCSAgICBfX3ggKz0gX19ucCArIF9fbmFmOworCisJICAgIGNvbnN0IF9JbnRUeXBlIF9feiA9IF9NX3dhaXRpbmcoX191cm5nLCBfX3QgLSBfSW50VHlwZShfX3gpKTsKKwkgICAgX19yZXQgPSBfSW50VHlwZShfX3gpICsgX196OworCSAgfQorCWVsc2UKKyNlbmRpZgorCSAgX19yZXQgPSBfTV93YWl0aW5nKF9fdXJuZywgX190KTsKK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l0eSBpcyBvbmUuCisgICAgICBfTV9jcFtfTV9jcC5zaXplKCkgLSAxXSA9IDEuMDsKKworICAgICAgZm9yIChzaXplX3QgX19rID0gMDsgX19rIDwgX01fZGVuLnNpemUoKTsgKytfX2spCisJX01fZGVuW19fa10gLz0gX01faW50W19fayArIDFdIC0gX01faW50W19fa107CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9SZWFsVHlwZT4KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW5wdXRJdGVyYXRvckIsIHR5cGVuYW1lIF9JbnB1dEl0ZXJhdG9yVz4KKyAgICAgIHBpZWNld2lzZV9jb25zdGFudF9kaXN0cmlidXRpb248X1JlYWxUeXBlPjo6cGFyYW1fdHlwZTo6CisgICAgICBwYXJhbV90eXBlKF9JbnB1dEl0ZXJhdG9yQiBfX2JiZWdpbiwKKwkJIF9JbnB1dEl0ZXJhdG9yQiBfX2JlbmQsCisJCSBfSW5wdXRJdGVyYXRvclcgX193YmVnaW4pCisgICAgICA6IF9NX2ludCgpLCBfTV9kZW4oKSwgX01fY3AoKQorICAgICAgeworCWlmIChfX2JiZWdpbiAhPSBfX2JlbmQpCisJICB7CisJICAgIGZvciAoOzspCisJICAgICAgeworCQlfTV9pbnQucHVzaF9iYWNrKCpfX2JiZWdpbik7CisJCSsrX19iYmVnaW47CisJCWlmIChfX2JiZWdpbiA9PSBfX2JlbmQpCisJCSAgYnJlYWs7CisKKwkJX01fZGVuLnB1c2hfYmFjaygqX193YmVnaW4pOworCQkrK19fd2JlZ2luOworCSAgICAgIH0KKwkgIH0KKworCV9NX2luaXRpYWxpemUoKTsKKyAgICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUmVhbFR5cGU+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0Z1bmM+CisgICAgICBwaWVjZXdpc2VfY29uc3RhbnRfZGlzdHJpYnV0aW9uPF9SZWFsVHlwZT46OnBhcmFtX3R5cGU6OgorICAgICAgcGFyYW1fdHlwZShpbml0aWFsaXplcl9saXN0PF9SZWFsVHlwZT4gX19ibCwgX0Z1bmMgX19mdykKKyAgICAgIDogX01faW50KCksIF9NX2RlbigpLCBfTV9jcCgpCisgICAgICB7CisJX01faW50LnJlc2VydmUoX19ibC5zaXplKCkpOworCWZvciAoYXV0byBfX2JpdGVyID0gX19ibC5iZWdpbigpOyBfX2JpdGVyICE9IF9fYmwuZW5kKCk7ICsrX19iaXRlcikKKwkgIF9NX2ludC5wdXNoX2JhY2soKl9fYml0ZXIpOworCisJX01fZGVuLnJlc2VydmUoX01faW50LnNpemUoKSAtIDEpOworCWZvciAoc2l6ZV90IF9fayA9IDA7IF9fayA8IF9NX2ludC5zaXplKCkgLSAxOyArK19faykKKwkgIF9NX2Rlbi5wdXNoX2JhY2soX19mdygwLjUgKiAoX01faW50W19fayArIDFdICsgX01faW50W19fa10pKSk7CisKKwlfTV9pbml0aWFsaXplKCk7CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlPgorICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9GdW5jPgorICAgICAgcGllY2V3aXNlX2NvbnN0YW50X2Rpc3RyaWJ1dGlvbjxfUmVhbFR5cGU+OjpwYXJhbV90eXBlOjoKKyAgICAgIHBhcmFtX3R5cGUoc2l6ZV90IF9fbncsIF9SZWFsVHlwZSBfX3htaW4sIF9SZWFsVHlwZSBfX3htYXgsIF9GdW5jIF9fZncpCisgICAgICA6IF9NX2ludCgpLCBfTV9kZW4oKSwgX01fY3AoKQorICAgICAgeworCWNvbnN0IHNpemVfdCBfX24gPSBfX253ID09IDAgPyAxIDogX19udzsKKwljb25zdCBfUmVhbFR5cGUgX19kZWx0YSA9IChfX3htYXggLSBfX3htaW4pIC8gX19uOworCisJX01faW50LnJlc2VydmUoX19uICsgMSk7CisJZm9yIChzaXplX3QgX19rID0gMDsgX19rIDw9IF9fbnc7ICsrX19rKQorCSAgX01faW50LnB1c2hfYmFj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IDAgPyBfX3BhcmFtLl9NX2NwW19faSAtIDFdIDogMC4wOworCisJcmV0dXJuIF9fcGFyYW0uX01faW50W19faV0gKyAoX19wIC0gX19wcmVmKSAvIF9fcGFyYW0uX01fZGVuW19faV07CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlLCB0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgc3RkOjpiYXNpY19vc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mCisgICAgb3BlcmF0b3I8PChzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19vcywKKwkgICAgICAgY29uc3QgcGllY2V3aXNlX2NvbnN0YW50X2Rpc3RyaWJ1dGlvbjxfUmVhbFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19vc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fb3N0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19vcy5mbGFncygpOworICAgICAgY29uc3QgX0NoYXJUIF9fZmlsbCA9IF9fb3MuZmlsbCgpOworICAgICAgY29uc3Qgc3RkOjpzdHJlYW1zaXplIF9fcHJlY2lzaW9uID0gX19vcy5wcmVjaXNpb24oKTsKKyAgICAgIGNvbnN0IF9DaGFyVCBfX3NwYWNlID0gX19vcy53aWRlbignICcpOworICAgICAgX19vcy5mbGFncyhfX2lvc19iYXNlOjpzY2llbnRpZmljIHwgX19pb3NfYmFzZTo6bGVmdCk7CisgICAgICBfX29zLmZpbGwoX19zcGFjZSk7CisgICAgICBfX29zLnByZWNpc2lvbihzdGQ6Om51bWVyaWNfbGltaXRzPF9SZWFsVHl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YmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19pcy5mbGFncygpOworICAgICAgX19pcy5mbGFncyhfX2lvc19iYXNlOjpkZWMgfCBfX2lvc19iYXNlOjpza2lwd3MpOworCisgICAgICBzaXplX3QgX19uOworICAgICAgX19pcyA+PiBfX247CisKKyAgICAgIHN0ZDo6dmVjdG9yPF9SZWFsVHlwZT4gX19pbnRfdmVjOworICAgICAgX19pbnRfdmVjLnJlc2VydmUoX19uICsgMSk7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPD0gX19uOyArK19faSkKKwl7CisJICBfUmVhbFR5cGUgX19pbnQ7CisJICBfX2lzID4+IF9faW50OworCSAgX19pbnRfdmVjLnB1c2hfYmFjayhfX2ludCk7CisJfQorCisgICAgICBzdGQ6OnZlY3Rvcjxkb3VibGU+IF9fZGVuX3ZlYzsKKyAgICAgIF9fZGVuX3ZlYy5yZXNlcnZlKF9fbik7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCXsKKwkgIGRvdWJsZSBfX2RlbjsKKwkgIF9faXMgPj4gX19kZW47CisJICBfX2Rlbl92ZWMucHVzaF9iYWNrKF9fZGVuKTsKKwl9CisKKyAgICAgIF9feC5wYXJhbSh0eXBlbmFtZSBwaWVjZXdpc2VfY29uc3RhbnRfZGlzdHJpYnV0aW9uPF9SZWFsVHlwZT46OgorCSAgcGFyYW1fdHlwZShfX2ludF92ZWMuYmVnaW4oKSwgX19pbnRfdmVjLmVuZCgpLCBfX2Rlbl92ZWMuYmVnaW4oKSkpOworCisgICAgICBfX2lzLmZsYWdzKF9fZmxhZ3MpOworICAgICAgcmV0dXJuIF9faXM7CisgICAgfQorCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlPgorICAgIHZvaWQKKyAgICBwaWVjZXdpc2V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CksIF9NX2NwKCksIF9NX20oKQorICAgICAgeworCWNvbnN0IHNpemVfdCBfX24gPSBfX253ID09IDAgPyAxIDogX19udzsKKwljb25zdCBfUmVhbFR5cGUgX19kZWx0YSA9IChfX3htYXggLSBfX3htaW4pIC8gX19uOworCisJX01faW50LnJlc2VydmUoX19uICsgMSk7CisJX01fZGVuLnJlc2VydmUoX19uICsgMSk7CisJZm9yIChzaXplX3QgX19rID0gMDsgX19rIDw9IF9fbnc7ICsrX19rKQorCSAgeworCSAgICBfTV9pbnQucHVzaF9iYWNrKF9feG1pbiArIF9fayAqIF9fZGVsdGEpOworCSAgICBfTV9kZW4ucHVzaF9iYWNrKF9fZncoX01faW50W19fa10gKyBfX2RlbHRhKSk7CisJICB9CisKKwlfTV9pbml0aWFsaXplKCk7CisgICAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlPgorICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yPgorICAgICAgdHlwZW5hbWUgcGllY2V3aXNlX2xpbmVhcl9kaXN0cmlidXRpb248X1JlYWxUeXBlPjo6cmVzdWx0X3R5cGUKKyAgICAgIHBpZWNld2lzZV9saW5lYXJfZGlzdHJpYnV0aW9uPF9SZWFsVHlwZT46OgorICAgICAgb3BlcmF0b3IoKShfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvciYgX191cm5nLAorCQkgY29uc3QgcGFyYW1fdHlwZSYgX19wYXJhbSkKKyAgICAgIHsKKwlfX2RldGFpbDo6X0FkYXB0b3I8X1VuaWZvcm1SYW5kb21OdW1iZXJHZW5lcmF0b3IsIGRvdWJsZT4KKwkgIF9fYXVybmcoX191cm5nKTsKKworCWNvbnN0IGRvdWJsZSBfX3AgPSBfX2F1cm5nKCk7CisJaWYgKF9fcGFyYW0uX01fY3AuZW1wdHkoKSkKKwkgIHJldHVybiBfX3A7CisKKwlhdXRvIF9fcG9zID0gc3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X3Q7CisgICAgICBjb25zdCBzaXplX3QgX19tID0gc3RkOjptYXgoc2l6ZV90KF9fcyArIDEpLCBfX24pOworCisgICAgICBmb3IgKHNpemVfdCBfX2sgPSAwOyBfX2sgPCBfX207ICsrX19rKQorCXsKKwkgIF9UeXBlIF9fYXJnID0gKF9fYmVnaW5bX19rICUgX19uXQorCQkJIF4gX19iZWdpblsoX19rICsgX19wKSAlIF9fbl0KKwkJCSBeIF9fYmVnaW5bKF9fayAtIDEpICUgX19uXSk7CisJICBfVHlwZSBfX3IxID0gX19hcmcgXiAoX19hcmcgPj4gMjcpOworCSAgX19yMSA9IF9fZGV0YWlsOjpfX21vZDxfVHlwZSwKKwkJICAgIF9fZGV0YWlsOjpfU2hpZnQ8X1R5cGUsIDMyPjo6X192YWx1ZT4oMTY2NDUyNXUgKiBfX3IxKTsKKwkgIF9UeXBlIF9fcjIgPSBfX3IxOworCSAgaWYgKF9fayA9PSAwKQorCSAgICBfX3IyICs9IF9fczsKKwkgIGVsc2UgaWYgKF9fayA8PSBfX3MpCisJICAgIF9fcjIgKz0gX19rICUgX19uICsgX01fdltfX2sgLSAxXTsKKwkgIGVsc2UKKwkgICAgX19yMiArPSBfX2sgJSBfX247CisJICBfX3IyID0gX19kZXRhaWw6Ol9fbW9kPF9UeXBlLAorCSAgICAgICAgICAgX19kZXRhaWw6Ol9TaGlmdDxfVHlwZSwgMzI+OjpfX3ZhbHVlPihfX3IyKTsKKwkgIF9fYmVnaW5bKF9fayArIF9fcCkgJSBfX25dICs9IF9fcjE7CisJICBfX2JlZ2luWyhfX2sgKyBfX3EpICUgX19uXSArPSBfX3IyOworCSAgX19iZWdpbltfX2sgJSBfX25dID0gX19yMjsKKwl9CisKKyAgICAgIGZvciAoc2l6ZV90IF9fayA9IF9fbTsgX19rIDwgX19tICsgX19uOyArK19faykKKwl7CisJICBfVHlwZSBfX2FyZyA9IChfX2JlZ2luW19fayAlIF9fbl0KKwkJCSArIF9fYmVnaW5bKF9fayArIF9fcC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hdXRvCisgICAgYmVnaW4oX0NvbnRhaW5lciYgX19jb250KSAtPiBkZWNsdHlwZShfX2NvbnQuYmVnaW4oKSkKKyAgICB7IHJldHVybiBfX2NvbnQuYmVnaW4oKTsgfQorCisgIC8qKgorICAgKiAgQGJyaWVmICBSZXR1cm4gYW4gaXRlcmF0b3IgcG9pbnRpbmcgdG8gdGhlIGZpcnN0IGVsZW1lbnQgb2YKKyAgICogICAgICAgICAgdGhlIGNvbnN0IGNvbnRhaW5lci4KKyAgICogIEBwYXJhbSAgX19jb250ICBDb250YWluZXIuCisgICAqLworICB0ZW1wbGF0ZTxjbGFzcyBfQ29udGFpbmVyPgorICAgIGlubGluZSBhdXRvCisgICAgYmVnaW4oY29uc3QgX0NvbnRhaW5lciYgX19jb250KSAtPiBkZWNsdHlwZShfX2NvbnQuYmVnaW4oKSkKKyAgICB7IHJldHVybiBfX2NvbnQuYmVnaW4oKTsgfQorCisgIC8qKgorICAgKiAgQGJyaWVmICBSZXR1cm4gYW4gaXRlcmF0b3IgcG9pbnRpbmcgdG8gb25lIHBhc3QgdGhlIGxhc3QgZWxlbWVudCBvZgorICAgKiAgICAgICAgICB0aGUgY29udGFpbmVyLgorICAgKiAgQHBhcmFtICBfX2NvbnQgIENvbnRhaW5lci4KKyAgICovCisgIHRlbXBsYXRlPGNsYXNzIF9Db250YWluZXI+CisgICAgaW5saW5lIGF1dG8KKyAgICBlbmQoX0NvbnRhaW5lciYgX19jb250KSAtPiBkZWNsdHlwZShfX2NvbnQuZW5kKCkpCisgICAgeyByZXR1cm4gX19jb250LmVuZCgpOyB9CisKKyAgLyoqCisgICAqICBAYnJpZWYgIFJldHVybiBhbiBpdGVyYXRvciBwb2ludGluZyB0byBvbmUgcGFzdCB0aGUgbGFzdCBlbGVtZW50IG9mCisgICAqICAgICAgICAgIHRoZSBjb25zdCBjb250YWluZXIuCisgICAqICBAcGFyYW0gIF9fY29udCAgQ29udGFpbmVyLgorICAgKi8KKyAgdGVtcGxhdGU8Y2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QorICAgICAgICBsb29rdXBfY2xhc3NuYW1lKF9Gd2RfaXRlciBfX2ZpcnN0LCBfRndkX2l0ZXIgX19sYXN0LAorCSAgICAgICAgICAgICAgICAgYm9vbCBfX2ljYXNlID0gZmFsc2UpIGNvbnN0CisJeyByZXR1cm4gMDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBEZXRlcm1pbmVzIGlmIEBwIGMgaXMgYSBtZW1iZXIgb2YgYW4gaWRlbnRpZmllZCBjbGFzcy4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19jIGEgY2hhcmFjdGVyLgorICAgICAgICogQHBhcmFtIF9fZiBhIGNsYXNzIHR5cGUgKGFzIHJldHVybmVkIGZyb20gbG9va3VwX2NsYXNzbmFtZSkuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgY2hhcmFjdGVyIEBwIF9fYyBpcyBhIG1lbWJlciBvZiB0aGUgY2xhc3NpZmljYXRpb24KKyAgICAgICAqIHJlcHJlc2VudGVkIGJ5IEBwIF9fZiwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3Mgc3RkOjpiYWRfY2FzdCBpZiB0aGUgY3VycmVudCBsb2NhbGUgZG9lcyBub3QgaGF2ZSBhIGN0eXBlCisgICAgICAgKiAgICAgICAgIGZhY2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICBpc2N0eXBlKF9DaF90eXBlIF9fYywgY2hhcl9jbGFzc190eXBlIF9fZikgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnZlcnRzIGEgZGlnaXQgdG8gYW4gaW50LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2NoICAgIGEgY2hhcmFjdGVyIHJlcHJlc2VudGluZyBhIGRpZ2l0LgorICAgICAgICogQHBhcmFtIF9fcmFkaXggdGhlIHJhZGl4IGlmIHRoZSBudW1lcmljIGNvbnZlcnNpb24gKGxpbWl0ZWQgdG8gOCwgMTAsCisgICAgICAgKiAgICAgICAgICAgICAgb3IgMTYpLgorICAgICAgICogCisgICAgICAgKiBAcmV0dXJucyB0aGUgdmFsdWUgcmVwcmVzZW50ZWQgYnkgdGhlIGRpZ2l0IF9fY2ggaW4gYmFzZSByYWRpeCBpZiB0aGUKKyAgICAgICAqIGNoYXJhY3RlciBfX2NoIGlzIGEgdmFsaWQgZGlnaXQgaW4gYmFzZSByYWRpeDsgb3RoZXJ3aXNlIHJldHVybnMgLTEuCisgICAgICAgKi8KKyAgICAgIGludAorICAgICAgdmFsdWUoX0NoX3R5cGUgX19jaCwgaW50IF9fcmFkaXgpIGNvbnN0OworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBJbWJ1ZXMgdGhlIHJlZ2V4X3RyYWl0cyBvYmplY3Qgd2l0aCBhIGNvcHkgb2YgYSBuZXcgbG9jYWxlLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xvYyBBIGxvY2FsZS4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyBhIGNvcHkgb2YgdGhlIHByZXZpb3VzIGxvY2FsZSBpbiB1c2UgYnkgdGhlIHJlZ2V4X3RyYWl0cworICAgICAgICogICAgICAgICAgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEBub3RlIENhbGxpbmcgaW1idWUgd2l0aCBhIGRpZmZlcmVudCBsb2NhbGUgdGhhbiB0aGUgb25lIGN1cnJlbnRseSBpbgorICAgICAgICogICAgICAgdXNlIGludmFsaWRhdGVzIGFsbCBjYWNoZWQgZGF0YSBoZWxkIGJ5ICp0aGlzLgorICAgICAgICovCisgICAgICBsb2NhbGVfdHlwZQorICAgICAgaW1idWUobG9jYWxlX3R5cGUgX19sb2MpCisgICAgICB7CisJc3RkOjpzd2FwKF9NX2xvY2FsZSwgX19sb2MpOworCXJldHVybiBfX2xvYzsKKyAgICAgIH0KKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgR2V0cyBhIGNvcHkgb2YgdGhlIGN1cnJlbnQgbG9jYWxlIGluIHVzZSBieSB0aGUgcmVnZXhfdHJhaXRzCisgICAgICAgKiBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGxvY2FsZV90eXBlCisgICAgICBnZXRsb2MoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbG9jYWxlOyB9CisgICAgICAKKyAgICBwcm90ZWN0ZWQ6CisgICAgICBsb2NhbGVfdHlwZSBfTV9sb2NhbGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hfdHlwZT4KKyAgICBib29sCisgICAgcmVnZXhfdHJhaXRzPF9DaF90eXBlPjo6CisgICAgaXNjdHlwZShfQ2hfdHlwZSBfX2MsIGNoYXJfY2xhc3NfdHlwZSBfX2YpIGNvbnN0CisgICAgeworICAgICAgdXNpbmcgc3RkOjpjdHlwZTsKKyAgICAgIHVzaW5nIHN0ZDo6dXNlX2ZhY2V0OworICAgICAgY29uc3QgY3R5cGU8X0NoX3R5cGU+JiBfX2N0eXBlKHVzZV9mYWNldDwKKwkJCQkgICAgIGN0eXBlPF9DaF90eXBlPiA+KF9NX2xvY2FsZSkpOworICAgICAgCisgICAgICBpZiAoX19jdHlwZS5pcyhfX2YsIF9fYykpCisJcmV0dXJuIHRydWU7CisgICAgICAKKyAgICAgIC8vIHNwZWNpYWwgY2FzZSBvZiB1bmRlcnNjb3JlIGluIFtbOnc6XV0KKyAgICAgIGlmIChfX2MgPT0gX19jdHlwZS53aWRlbignXycpKQorCXsKKwkgIGNvbnN0IGNoYXIgX193YltdID0gInciOworCSAgY2hhcl9jbGFzc190eXBlIF9fd3QgPSB0aGlzLT5sb29rdXBfY2xhc3NuYW1lKF9fd2IsCisJCQkJCQkJX193YiArIHNpemVvZihfX3diKSk7CisJICBpZiAoX19mIHwgX193dCkKKwkgICAgcmV0dXJuIHRydWU7CisJfQorICAgIAorICAgICAgLy8gc3BlY2lhbCBjYX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F4X29wdGlvbl90eXBlIG5vc3VicworICAgICAgICA9IHJlZ2V4X2NvbnN0YW50czo6bm9zdWJzOworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZWdleF9jb25zdGFudHM6OnN5bnRheF9vcHRpb25fdHlwZSBvcHRpbWl6ZQorICAgICAgICA9IHJlZ2V4X2NvbnN0YW50czo6b3B0aW1pemU7CisgICAgICBzdGF0aWMgY29uc3RleHByIHJlZ2V4X2NvbnN0YW50czo6c3ludGF4X29wdGlvbl90eXBlIGNvbGxhdGUKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6OmNvbGxhdGU7CisgICAgICBzdGF0aWMgY29uc3RleHByIHJlZ2V4X2NvbnN0YW50czo6c3ludGF4X29wdGlvbl90eXBlIEVDTUFTY3JpcHQKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6OkVDTUFTY3JpcHQ7CisgICAgICBzdGF0aWMgY29uc3RleHByIHJlZ2V4X2NvbnN0YW50czo6c3ludGF4X29wdGlvbl90eXBlIGJhc2ljCisgICAgICAgID0gcmVnZXhfY29uc3RhbnRzOjpiYXNpYzsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgcmVnZXhfY29uc3RhbnRzOjpzeW50YXhfb3B0aW9uX3R5cGUgZXh0ZW5kZWQKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6OmV4dGVuZGVkOworICAgICAgc3RhdGljIGNvbnN0ZXhwciByZWdleF9jb25zdGFudHM6OnN5bnRheF9vcHRpb25fdHlwZSBhd2sKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6OmF3azsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgcmVnZXhfY29uc3RhbnRzOjpzeW50YXhfb3B0aW9uX3R5cGUgZ3JlcAorICAgICAgICA9IHJlZ2V4X2NvbnN0YW50czo6Z3JlcDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgcmVnZXhfY29uc3RhbnRzOjpzeW50YXhfb3B0aW9uX3R5cGUgZWdyZXAKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6OmVncmVwOworICAgICAgLy9AfQorCisgICAgICAvLyBbNy44LjJdIGNvbnN0cnVjdC9jb3B5L2Rlc3Ryb3kKKyAgICAgIC8qKgorICAgICAgICogQ29uc3RydWN0cyBhIGJhc2ljIHJlZ3VsYXIgZXhwcmVzc2lvbiB0aGF0IGRvZXMgbm90IG1hdGNoIGFueQorICAgICAgICogY2hhcmFjdGVyIHNlcXVlbmNlLgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCgpCisgICAgICA6IF9NX2ZsYWdzKHJlZ2V4X2NvbnN0YW50czo6RUNNQVNjcmlwdCksCisgICAgICAgIF9NX2F1dG9tYXRvbihfX3JlZ2V4OjpfX2NvbXBpbGU8Y29uc3QgX0NoX3R5cGUqLCBfUnhfdHJhaXRzPigwLCAwLAorICAgICAgICAgICAgICAgICAgICAgX01fdHJhaXRzLCBfTV9mbGFncykpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQ29uc3RydWN0cyBhIGJhc2ljIHJlZ3VsYXIgZXhwcmVzc2lvbiBmcm9tIHRoZQorICAgICAgICogc2VxdWVuY2UgW19fcCwgX19wICsgY2hhcl90cmFpdHM8X0NoX3R5cGU+OjpsZW5ndGgoX19wKSkKKyAgICAgICAqIGludGVycHJldGVkIGFjY29yZGluZyB0byB0aGUgZmxhZ3MgaW4gQHAgX19mLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX3AgQSBwb2ludGVyIHRvIHRoZSBzdGFydCBvZiBhIEMtc3R5bGUgbnVsbC10ZXJtaW5hdGVkIHN0cmluZworICAgICAgICogICAgICAgICAgY29udGFpbmluZyBhIHJlZ3VsYXIgZXhwcmVzc2lvbi4KKyAgICAgICAqIEBwYXJhbSBfX2YgRmxhZ3MgaW5kaWNhdGluZyB0aGUgc3ludGF4IHJ1bGVzIGFuZCBvcHRpb25zLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3Mgc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GFyIGV4cHJlc3Npb24uCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3JlZ2V4KGNvbnN0IF9DaF90eXBlKiBfX3AsIHN0ZDo6c2l6ZV90IF9fbGVuLCBmbGFnX3R5cGUgX19mKQorICAgICAgOiBfTV9mbGFncyhfX2YpLAorICAgICAgICBfTV9hdXRvbWF0b24oX19yZWdleDo6X19jb21waWxlKF9fcCwgX19wICsgX19sZW4sIF9NX3RyYWl0cywgX01fZmxhZ3MpKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvcHktY29uc3RydWN0cyBhIGJhc2ljIHJlZ3VsYXIgZXhwcmVzc2lvbi4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19yaHMgQSBAcCByZWdleCBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3JlZ2V4KGNvbnN0IGJhc2ljX3JlZ2V4JiBfX3JocykKKyAgICAgIDogX01fZmxhZ3MoX19yaHMuX01fZmxhZ3MpLCBfTV90cmFpdHMoX19yaHMuX01fdHJhaXRzKSwKKyAgICAgICAgX01fYXV0b21hdG9uKF9fcmhzLl9NX2F1dG9tYXRvbikKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBNb3ZlLWNvbnN0cnVjdHMgYSBiYXNpYyByZWd1bGFyIGV4cHJlc3Npb24uCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fcmhzIEEgQHAgcmVnZXggb2JqZWN0LgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleChjb25zdCBiYXNpY19yZWdleCYmIF9fcmhzKSBub2V4Y2VwdAorICAgICAgOiBfTV9mbGFncyhfX3Jocy5fTV9mbGFncyksIF9NX3RyYWl0cyhfX3Jocy5fTV90cmFpdHMpLAorICAgICAgICBfTV9hdXRvbWF0b24oc3RkOjptb3ZlKF9fcmhzLl9NX2F1dG9tYXRvbikpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKi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XJhbSBfX2wgIFRoZSBpbml0aWFsaXplciBsaXN0LgorICAgICAgICogQHBhcmFtIF9fZiAgVGhlIGZvcm1hdCBmbGFncyBvZiB0aGUgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgQHAgX19sIGlzIG5vdCBhIHZhbGlkIHJlZ3VsYXIgZXhwcmVzc2lvbi4KKyAgICAgICAqLworICAgICAgYmFzaWNfcmVnZXgoaW5pdGlhbGl6ZXJfbGlzdDxfQ2hfdHlwZT4gX19sLAorCQkgIGZsYWdfdHlwZSBfX2YgPSByZWdleF9jb25zdGFudHM6OkVDTUFTY3JpcHQpCisgICAgICA6IF9NX2ZsYWdzKF9fZiksCisgICAgICAgIF9NX2F1dG9tYXRvbihfX3JlZ2V4OjpfX2NvbXBpbGUoX19sLmJlZ2luKCksIF9fbC5lbmQoKSwKKyAgICAgICAgCQkJCV9NX3RyYWl0cywgX01fZmxhZ3MpKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERlc3Ryb3lzIGEgYmFzaWMgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICovCisgICAgICB+YmFzaWNfcmVnZXgoKQorICAgICAgeyB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgb25lIHJlZ3VsYXIgZXhwcmVzc2lvbiB0byBhbm90aGVyLgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBiYXNpY19yZWdleCYgX19yaHMpCisgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oX19yaHMpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIE1vdmUtYXNzaWducyBvbmUgcmVndWxhciBleHByZXNzaW9uIHRvIGFub3RoZXIuCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3JlZ2V4JgorICAgICAgb3BlcmF0b3I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fQWxsb2NhdG9yPiYgX19zKQorICAgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oX19zLCBmbGFncygpKTsgfQorCisgICAgICAvLyBbNy44LjNdIGFzc2lnbgorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgdGhlIHJlYWwgYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciByZWd1bGFyIGV4cHJlc3Npb24gb2JqZWN0LgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIGFzc2lnbihjb25zdCBiYXNpY19yZWdleCYgX19yaHMpCisgICAgICB7CisJYmFzaWNfcmVnZXggX190bXAoX19yaHMpOworCXRoaXMtPnN3YXAoX190bXApOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgVGhlIG1vdmUtYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciByZWd1bGFyIGV4cHJlc3Npb24gb2JqZWN0LgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIGFzc2lnbihiYXNpY19yZWdleCYmIF9fcmhzKSBub2V4Y2VwdAorICAgICAgeworCWJhc2ljX3JlZ2V4IF9fdG1wKHN0ZDo6bW92ZShfX3JocykpOworCXRoaXMtPnN3YXAoX190bXApOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQXNzaWducyBhIG5ldyByZWd1bGFyIGV4cHJlc3Npb24gdG8gYSByZWdleCBvYmplY3QgZnJvbSBhCisgICAgICAgKiBDLXN0eWxlIG51bGwtdGVybWluYXRlZCBzdHJpbmcgY29udGFpbmluZyBhIHJlZ3VsYXIgZXhwcmVzc2lvbgorICAgICAgICogcGF0dGVybi4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19wICAgICBBIHBvaW50ZXIgdG8gYSBDLXN0eWxlIG51bGwtdGVybWluYXRlZCBzdHJpbmcgY29udGFpbmluZworICAgICAgICogICAgICAgICAgICAgIGEgcmVndWxhciBleHByZXNzaW9uIHBhdHRlcm4uCisgICAgICAgKiBAcGFyYW0gX19mbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgX19wIGRvZXMgbm90IGNvbnRhaW4gYSB2YWxpZCByZWd1bGFyCisgICAgICAgKiBleHByZXNzaW9uIHBhdHRlcm4gaW50ZXJwcmV0ZWQgYWNjb3JkaW5nIHRvIEBwIF9fZmxhZ3MuICBJZgorICAgICAgICogcmVnZXhfZXJyb3IgaXMgdGhyb3duLCAqdGhpcyByZW1haW5zIHVuY2hhbmdlZC4KKyAgICAgICAqLworICAgICAgYmFzaWNfcmVnZXgmCisgICAgICBhc3NpZ24oY29uc3QgX0NoX3R5cGUqIF9fcCwKKwkgICAgIGZsYWdfdHlwZSBfX2ZsYWdzID0gcmVnZXhfY29uc3RhbnRzOjpFQ01BU2NyaXB0KQorICAgICAgeyByZXR1cm4gdGhpcy0+YXNzaWduKHN0cmluZ190eXBlKF9fcCksIF9fZmxhZ3MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgYSBuZXcgcmVndWxhciBleHByZXNzaW9uIHRvIGEgcmVnZXggb2JqZWN0IGZyb20gYQorICAgICAgICogQy1zdHlsZSBzdHJpbmcgY29udGFpbmluZyBhIHJlZ3VsYXIgZXhwcmVzc2lvbiBwYXR0ZXJuLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX3AgICAgIEEgcG9pbnRlciB0byBhIEMtc3R5bGUgc3RyaW5nIGNvbnRhaW5pbmcgYQorICAgICAgICogICAgICAgICAgICAgICAgcmVndWxhciBleHByZXNzaW9uIHBhdHRlcm4uCisgICAgICAgKiBAcGFyYW0gX19sZW4gICBUaGUgbGVuZ3RoIG9mIHRoZSByZWd1bGFyIGV4cHJlc3Npb24gcGF0dGVybiBzdHJpbmcuCisgICAgICAgKiBAcGFyYW0gX19mbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgcCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQgcmVndWxhcgorICAgICAgICogZXhwcmVzc2lvbiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcCBfX2ZsYWdzLiAgSWYKKyAgICAgICAqIHJlZ2V4X2Vycm9yIGlzIHRocm93biwgKnRoaXMgcmVtYWlucyB1bmNoYW5nZWQuCisgICAgICAgKi8KKyAgICAgIGJhc2ljX3JlZ2V4JgorICAgICAgYXNzaWduKGNvbnN0IF9DaF90eXBlKiBfX3AsIHN0ZDo6c2l6ZV90IF9fbGVuLCBmbGFnX3R5cGUgX19mbGFncykKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmFzc2lnbihzdHJpbmdfdHlwZShfX3AsIF9fbGVuKSwgX19mbGFncyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQXNzaWducyBhIG5ldyByZWd1bGFyIGV4cHJlc3Npb24gdG8gYSByZWdleCBvYmplY3QgZnJvbSBhIAorICAgICAgICogc3RyaW5nIGNvbnRhaW5pbmcgYSByZWd1bGFyIGV4cHJlc3Npb24gcGF0dGVybi4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19zICAgICBBIHN0cmluZyBjb250YWluaW5nIGEgcmVndWxhciBleHByZXNzaW9uIHBhdHRlcm4uCisgICAgICAgKiBAcGFyYW0gX19mbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgX19zIGRvZXMgbm90IGNvbnRhaW4gYSB2YWxpZCByZWd1bGFyCisgICAg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YgcCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQgcmVndWxhcgorICAgICAgICogZXhwcmVzc2lvbiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcCBfX2ZsYWdzLiAgSWYKKyAgICAgICAqIHJlZ2V4X2Vycm9yIGlzIHRocm93biwgdGhlIG9iamVjdCByZW1haW5zIHVuY2hhbmdlZC4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIGJhc2ljX3JlZ2V4JgorICAgICAgICBhc3NpZ24oX0lucHV0SXRlcmF0b3IgX19maXJzdCwgX0lucHV0SXRlcmF0b3IgX19sYXN0LAorCSAgICAgICBmbGFnX3R5cGUgX19mbGFncyA9IHJlZ2V4X2NvbnN0YW50czo6RUNNQVNjcmlwdCkKKyAgICAgICAgeyByZXR1cm4gdGhpcy0+YXNzaWduKHN0cmluZ190eXBlKF9fZmlyc3QsIF9fbGFzdCksIF9fZmxhZ3MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgYSBuZXcgcmVndWxhciBleHByZXNzaW9uIHRvIGEgcmVnZXggb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2wgICAgIEFuIGluaXRpYWxpemVyIGxpc3QgcmVwcmVzZW50aW5nIGEgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICogQHBhcmFtIF9fZmxhZ3MgU3ludGF4IG9wdGlvbiBmbGFncy4KKyAgICAgICAqCisgICAgICAgKiBAdGhyb3dzIHJlZ2V4X2Vycm9yIGlmIEBwIF9fbCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQKKyAgICAgICAqIHJlZ3VsYXIgZXhwcmVzc2lvbiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcAorICAgICAgICogX19mbGFncy4gIElmIHJlZ2V4X2Vycm9yIGlzIHRocm93biwgdGhlIG9iam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YXJhbSBfX2xvYyBBIGxvY2FsZS4KKyAgICAgICAqLworICAgICAgbG9jYWxlX3R5cGUKKyAgICAgIGltYnVlKGxvY2FsZV90eXBlIF9fbG9jKQorICAgICAgeyByZXR1cm4gX01fdHJhaXRzLmltYnVlKF9fbG9jKTsgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBsb2NhbGUgY3VycmVudGx5IGltYnVlZCBpbiB0aGUgcmVndWxhciBleHByZXNzaW9uCisgICAgICAgKiAgICAgICAgb2JqZWN0LgorICAgICAgICovCisgICAgICBsb2NhbGVfdHlwZQorICAgICAgZ2V0bG9jKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3RyYWl0cy5nZXRsb2MoKTsgfQorICAgICAgCisgICAgICAvLyBbNy44LjZdIHN3YXAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFN3YXBzIHRoZSBjb250ZW50cyBvZiB0d28gcmVndWxhciBleHByZXNzaW9uIG9iamVjdHMuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgcmVndWxhciBleHByZXNzaW9uIG9iamVjdC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgc3dhcChiYXNpY19yZWdleCYgX19yaHMpCisgICAgICB7CisJc3RkOjpzd2FwKF9NX2ZsYWdzLCAgICAgX19yaHMuX01fZmxhZ3MpOworCXN0ZDo6c3dhcChfTV90cmFpdHMsICAgIF9fcmhzLl9NX3RyYWl0cyk7CisJc3RkOjpzd2FwKF9NX2F1dG9tYXRvbiwgX19yaHMuX01fYXV0b21hdG9uKTsKKyAgICAgIH0KKworI2lmZGVmIF9HTElCQ1hYX0RFQlVHCisgICAgICB2b2lkCisgICAgICBfTV9kb3Qoc3RkOjpvc3RyZWFtJiBfX29zdHIpCisgICAgICB7IF9NX2F1dG9tYXRvbi0+X01fZG90KF9fb3N0cik7IH0KKyNlbmRpZgorICAgICAgCisgICAgICBjb25zdCBfX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ZV90eXBlICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPF9CaUl0ZXI+OjpkaWZmZXJlbmNlX3R5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0JpSXRlciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgc3RkOjpiYXNpY19zdHJpbmc8dmFsdWVfdHlwZT4gICAgICAgICAgICAgICAgICAgICBzdHJpbmdfdHlwZTsKKworICAgIHB1YmxpYzoKKyAgICAgIGJvb2wgbWF0Y2hlZDsKKyAgICAgIAorICAgICAgY29uc3RleHByIHN1Yl9tYXRjaCgpIDogbWF0Y2hlZCgpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGxlbmd0aCBvZiB0aGUgbWF0Y2hpbmcgc2VxdWVuY2UuCisgICAgICAgKi8KKyAgICAgIGRpZmZlcmVuY2VfdHlwZQorICAgICAgbGVuZ3RoKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPm1hdGNoZWQgPyBzdGQ6OmRpc3RhbmNlKHRoaXMtPmZpcnN0LCB0aGlzLT5zZWNvbmQpIDogMDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBtYXRjaGluZyBzZXF1ZW5jZSBhcyBhIHN0cmluZy4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyB0aGUgbWF0Y2hpbmcgc2VxdWVuY2UgYXMgYSBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogVGhpcyBpcyB0aGUgaW1wbGljaXQgY29udmVyc2lvbiBvcGVyYXRvci4gIEl0IGlzIGlkZW50aWNhbCB0byB0aGUKKyAgICAgICAqIHN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AgICAgICAgICAgICAgICAgICAgICAgY29uc3RfcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBjb25zdF9yZWZlcmVuY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9CYXNlX3R5cGU6OmNvbnN0X2l0ZXJhdG9yICAgICAgICAgICAgIGNvbnN0X2l0ZXJhdG9yOworICAgICAgdHlwZWRlZiBjb25zdF9pdGVyYXRvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgc3RkOjppdGVyYXRvcl90cmFpdHM8X0JpX2l0ZXI+OjpkaWZmZXJlbmNlX3R5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBhbGxvY2F0b3JfdHJhaXRzPF9BbGxvY2F0b3I+OjpzaXplX3R5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiBfQWxsb2NhdG9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0b3JfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgc3RkOjppdGVyYXRvcl90cmFpdHM8X0JpX2l0ZXI+Ojp2YWx1ZV90eXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJfdHlwZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpiYXNpY19zdHJpbmc8Y2hhcl90eXBlPiAgICAgICAgICAgICAgICAgICAgc3RyaW5nX3R5cGU7CisgICAgICAvL0B9CisgIAorICAgIHB1YmxpYzoKKyAgICAgIC8qKgorICAgICAgICogQG5hbWUgMjguMTAuMSBDb25zdHJ1Y3Rpb24sIENvcHlpbmcsIGFuZCBEZXN0cnVjdGlvbgorICAgICAgICovCisgICAgICAvL0B7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnN0cnVjdHMgYSBkZWZhdWx0ICVtYXRjaF9yZXN1bHRzIGNvbnRhaW5lci4KKyAgICAgICAqIEBwb3N0IHNpemUoKSByZXR1cm5zIDAgYW5kIHN0cigpIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbWF0Y2hfcmVzdWx0cyhjb25zdCBfQWxsb2NhdG9yJiBfX2EgPSBfQWxsb2NhdG9yKCkpCisgICAgICA6IF9CYXNlX3R5cGUoX19hKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvcHkgY29uc3RydWN0cyBhICVtYXRjaF9yZXN1bHRzLgorICAgICAgICovCisgICAgICBtYXRjaF9yZXN1bHRzKGNvbnN0IG1hdGNoX3Jlc3VsdHMmIF9fcmhzKQorICAgICAgOiBfQmFzZV90eXBlKF9fcmhzKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIE1vdmUgY29uc3RydWN0cyBhICVtYXRjaF9yZXN1bHRzLgorICAgICAgICovCisgICAgICBtYXRjaF9yZXN1bHRzKG1hdGNoX3Jlc3VsdHMmJiBfX3Jocykgbm9leGNlcHQKKyAgICAgIDogX0Jhc2VfdHlwZShzdGQ6Om1vdmUoX19yaHMpKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgcmhzIHRvICp0aGlzLgorICAgICAgICovCisgICAgICBtYXRjaF9yZXN1bHRzJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IG1hdGNoX3Jlc3VsdHMmIF9fcmhzKQorICAgICAgeworCW1hdGNoX3Jlc3VsdHMoX19yaHMpLnN3YXAoKnRoaXMpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgTW92ZS1hc3NpZ25zIHJocyB0byAqdGhpcy4KKyAgICAgICAqLworICAgICAgbWF0Y2hfcmVzdWx0cyYKKyAgICAgIG9wZXJhdG9yPShtYXRjaF9yZXN1bHRzJiYgX19yaHMpCisgICAgICB7CisJbWF0Y2hfcmVzdWx0cyhzdGQ6Om1vdmUoX19yaHMpKS5zd2FwKCp0aGlzKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERlc3Ryb3lzIGEgJW1hdGNoX3Jlc3VsdHMgb2JqZWN0LgorICAgICAgICovCisgICAgICB+bWF0Y2hfcmVzdWx0cygpCisgICAgICB7IH0KKyAgICAgIAorICAgICAgLy9AfQorCisgICAgICAvLyAyOC4xMC4yLCBzdGF0ZToKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluZGljYXRlcyBpZiB0aGUgJW1hdGNoX3Jlc3VsdHMgaXMgcmVhZHkuCisgICAgICAgKiBAcmV0dmFsIHRydWUgICBUaGUgb2JqZWN0IGhhcyBhIGZ1bGx5LWVzdGFibGlzaGVkIHJlc3VsdCBzdGF0ZS4KKyAgICAgICAqIEByZXR2YWwgZmFsc2UgIFRoZSBvYmplY3QgaXMgbm90IHJlYWR5LgorICAgICAgICovCisgICAgICBib29sIHJlYWR5KCkgY29uc3QgeyByZXR1cm4gIV9CYXNlX3R5cGU6OmVtcHR5KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAbmFtZSAyOC4xMC4yIFNpemUKKyAgICAgICAqLworICAgICAgLy9AeworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBudW1iZXIgb2YgbWF0Y2hlcyBhbmQgc3VibWF0Y2hlcy4KKyAgICAgICAqCisgICAgICAgKiBUaGUgbnVtYmVyIG9mIG1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QKKyAgICAgIHsgcmV0dXJuICgqdGhpcylbX19zdWJdLnN0cigpOyB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgYSAlc3ViX21hdGNoIHJlZmVyZW5jZSBmb3IgdGhlIG1hdGNoIG9yIHN1Ym1hdGNoLgorICAgICAgICogQHBhcmFtIF9fc3ViIGluZGljYXRlcyB0aGUgc3VibWF0Y2guCisgICAgICAgKiBAcHJlICAgcmVhZHkoKSA9PSB0cnVlCisgICAgICAgKgorICAgICAgICogVGhpcyBmdW5jdGlvbiBnZXRzIGEgcmVmZXJlbmNlIHRvIHRoZSBpbmRpY2F0ZWQgc3VibWF0Y2gsIG9yCisgICAgICAgKiB0aGUgZW50aXJlIG1hdGNoIGlmIEBwIF9fc3ViIGlzIHplcm8uCisgICAgICAgKgorICAgICAgICogSWYgQHAgX19zdWIgPj0gc2l6ZSgpIHRoZW4gdGhpcyBmdW5jdGlvbiByZXR1cm5zIGEgJXN1Yl9tYXRjaCB3aXRoIGEKKyAgICAgICAqIHNwZWNpYWwgdmFsdWUgaW5kaWNhdGluZyBubyBzdWJtYXRjaC4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdHlwZSBfX3N1YikgY29uc3QKKyAgICAgIHsgCisgICAgICAJX0dMSUJDWFhfREVCVUdfQVNTRVJUKCByZWFkeSgpICk7CisgICAgICAJcmV0dXJuIF9fc3ViIDwgc2l6ZSgpCisJICAgICAgID8gIF9CYXNlX3R5cGU6Om9wZXJhdG9yW10oX19zdWIpCisJICAgICAgIDogX191bm1hdGNoZWRfc3ViPF9CaV9pdGVyPigpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIGEgJXN1Yl9tYXRjaCByZXByZXNlbnRpbmcgdGhlIG1hdGNoIHByZWZpeC4KKyAgICAgICAqIEBwcmUgICByZWFkeSgpID09IHRydWUKKyAgICAgICAqCisgICA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Jlc3VsdCksIF9fZm10LCBfX2ZsYWdzKTsKKyAgICAgICAgICByZXR1cm4gX19yZXN1bHQ7CisgICAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBAcHJlICAgcmVhZHkoKSA9PSB0cnVlCisgICAgICAgKi8KKyAgICAgIHN0cmluZ190eXBlCisgICAgICBmb3JtYXQoY29uc3QgY2hhcl90eXBlKiBfX2ZtdCwKKwkgICAgIHJlZ2V4X2NvbnN0YW50czo6bWF0Y2hfZmxhZ190eXBlIF9fZmxhZ3MKKwkgICAgID0gcmVnZXhfY29uc3RhbnRzOjpmb3JtYXRfZGVmYXVsdCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgc3RyaW5nX3R5cGUgX19yZXN1bHQ7CisgICAgICAgIGZvcm1hdChzdGQ6OmJhY2tfaW5zZXJ0ZXIoX19yZXN1bHQpLAorICAgICAgICAgICAgICAgX19mbXQgKyBjaGFyX3RyYWl0czxjaGFyX3R5cGU+OjpsZW5ndGgoX19mbXQpLAorICAgICAgICAgICAgICAgX19mbGFncyk7CisgICAgICAgIHJldHVybiBfX3Jlc3VsdDsKKyAgICAgIH0KKworICAgICAgLy9AfSAKKworICAgICAgLyoqCisgICAgICAgKiBAbmFtZSAxMC41IEFsbG9jYXRvcgorICAgICAgICovCisgICAgICAvL0B7IAorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIGEgY29weSBvZiB0aGUgYWxsb2NhdG9yLgorICAgICAgICovCisgICAgICBhbGxvY2F0b3JfdHlwZQorICAgICAgZ2V0X2FsbG9jYXRvcigpIGNvbnN0CisgICAgICB7IHJldHVybiBfQmFzZV90eXBlOjpnZXRfYWxsb2NhdG9yKCk7IH0KKyAgICAgIAorICAgICAgLy9AfSAKKworICAgICAgLyoqCisgICAgICAgKiBAbmFtZSAxMC42IFN3YXAKKyAgICAgICAqLworICAgICAgIC8vQHsgCisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFN3YXBzIHRoZSBjb250Z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sdWVfdHlwZSogICAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCB2YWx1ZV90eXBlJiAgICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpmb3J3YXJkX2l0ZXJhdG9yX3RhZyAgICAgICAgICBpdGVyYXRvcl9jYXRlZ29yeTsKKworICAgIHB1YmxpYzoKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFByb3ZpZGVzIGEgc2luZ3VsYXIgaXRlcmF0b3IsIHVzZWZ1bCBmb3IgaW5kaWNhdGluZworICAgICAgICogb25lLXBhc3QtdGhlLWVuZCBvZiBhIHJhbmdlLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICByZWdleF9pdGVyYXRvcigpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYSAlcmVnZXhfaXRlcmF0b3IuLi4KKyAgICAgICAqIEBwYXJhbSBfX2EgIFtJTl0gVGhlIHN0YXJ0IG9mIGEgdGV4dCByYW5nZSB0byBzZWFyY2guCisgICAgICAgKiBAcGFyYW0gX19iICBbSU5dIE9uZS1wYXN0LXRoZS1lbmQgb2YgdGhlIHRleHQgcmFuZ2UgdG8gc2VhcmNoLgorICAgICAgICogQHBhcmFtIF9fcmUgW0lOXSBUaGUgcmVndWxhciBleHByZXNzaW9uIHRvIG1hdGNoLgorICAgICAgICogQHBhcmFtIF9fbSAgW0lOXSBQb2xpY3kgZmxhZ3MgZm9yIG1hdGNoIHJ1bGVzLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICByZWdleF9pdGVyYXRvcihfQmlfaXRlciBfX2EsIF9CaV9pdGVyIF9fYiwgY29uc3QgcmVnZXhfdHlwZSYgX19yZSwKKwkJICAgICByZWdleF9jb25zdGFudHM6Om1hdGNoX2ZsYWdfdHlwZSBfX20KKwkJICAgICA9IHJlZ2V4X2NvbnN0YW50czo6bWF0Y2hfZGVmYXVsdCk7CisKKyAgICAgIC8qKgorICAgICAgICogQ29weSBjb25zdHJ1Y3RzIGEgJXJlZ2V4X2l0ZXJhdG9yLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICByZWdleF9pdGVyYXRvcihjb25zdCByZWdleF9pdGVyYXRvciYgX19yaHMpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICogQGRvY3RvZG8KKyAgICAgICAqLworICAgICAgcmVnZXhfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcj0oY29uc3QgcmVnZXhfaXRlcmF0b3ImIF9fcmhzKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgcmVnZXhfaXRlcmF0b3ImIF9fcmhzKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgcmVnZXhfaXRlcmF0b3ImIF9fcmhzKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIGNvbnN0IHZhbHVlX3R5cGUmCisgICAgICBvcGVyYXRvciooKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIGNvbnN0IHZhbHVlX3R5cGUqCisgICAgICBvcGVyYXRvci0+KCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICByZWdleF9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yKysoKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIHJlZ2V4X2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCk7CisgICAgICAKKyAgICBwcml2YXRlOgorICAgICAgLy8gdGhlc2UgbWVtYmVycyBhcmUgc2hvd24gZm9yIGV4cG9zaXRpb24gb25seToKKyAgICAgIF9CaV9pdGVyICAgICAgICAgICAgICAgICAgICAgICAgIGJlZ2luOworICAgICAgX0JpX2l0ZXIgICAgICAgICAgICAgICAgICAgICAgICAgZW5kOworICAgICAgY29uc3QgcmVnZXhfdHlwZSogICAgICAgICAgICAgICAgcHJlZ2V4OworICAgICAgcmVnZXhfY29uc3RhbnRzOjptYXRjaF9mbGFnX3R5cGUgZmxhZ3M7CisgICAgICBtYXRjaF9yZXN1bHRzPF9CaV9pdGVyPiAgICAgICAgICBtYXRjaDsKKyAgICB9OworICAKKyAgdHlwZWRlZiByZWdleF9pdGVyYXRvcjxjb25zdCBjaGFyKj4gICAgICAgICAgICAgY3JlZ2V4X2l0ZXJhdG9yOworICB0eXBlZGVmIHJlZ2V4X2l0ZXJhdG9yPHN0cmluZzo6Y29uc3RfaXRlcmF0b3I+ICBzc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yYWl0cz4gcmVnZXhfdHlwZTsKKyAgICAgIHR5cGVkZWYgc3ViX21hdGNoPF9CaV9pdGVyPiAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHN0ZDo6cHRyZGlmZl90ICAgICAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIGNvbnN0IHZhbHVlX3R5cGUqICAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCB2YWx1ZV90eXBlJiAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBzdGQ6OmZvcndhcmRfaXRlcmF0b3JfdGFnICAgICAgICAgaXRlcmF0b3JfY2F0ZWdvcnk7CisgICAgICAKKyAgICBwdWJsaWM6CisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBEZWZhdWx0IGNvbnN0cnVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIAorICAgICAgICogQSBkZWZhdWx0LWNvbnN0cnVjdGVkICVyZWdleF90b2tlbl9pdGVyYXRvciBpcyBhIHNpbmd1bGFyIGl0ZXJhdG9yCisgICAgICAgKiB0aGF0IHdpbGwgY29tcGFyZSBlcXVhbCB0byB0aGUgb25lLXBhc3QtdGhlLWVuZCB2YWx1ZSBmb3IgYW55CisgICAgICAgKiBpdGVyYXRvciBvZiB0aGUgc2FtZSB0eXBlLgorICAgICAgICovCisgICAgICByZWdleF90b2tlbl9pdGVyYXRvcigpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuLi4KKyAgICAgICAqIEBwYXJhbSBfX2EgICAgICAgICAgW0lOXSBUaGUgc3RhcnQgb2YgdGhlIHRleHQgdG8gc2VhcmNoLgorICAgICAgICogQHBhcmFtIF9fYiAgICAgICAgICBbSU5dIE9uZS1wYXN0LXRoZS1lbmQgb2YgdGhlIHRleHQgdG8gc2VhcmNoLgorICAgICAgICogQHBhcmFtIF9fcmUgICAgICAgICBbSU5dIFRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gc2VhcmNoIGZvci4KKyAgICAgICAqIEBwYXJhbSBfX3N1Ym1hdGNoICAgW0lOXSBXaGljaCBzdWJtYXRjaCB0byByZXR1cm4uICBUaGVyZSBhcmUgc29tZQorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsIHZhbHVlcyBmb3IgdGhpcyBwYXJhbWV0ZXI6CisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC0gLTEgZWFjaCBlbnVtZXJhdGVkIHN1YmV4cHJlc3Npb24gZG9lcyBOT1QKKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaCB0aGUgcmVndWxhciBleHByZXNzaW9uIChha2EgZmllbGQKKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBzcGxpdHRpbmcpCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC0gMCB0aGUgZW50aXJlIHN0cmluZyBtYXRjaGluZyB0aGUKKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJleHByZXNzaW9uIGlzIHJldHVybmVkIGZvciBlYWNoIG1hdGNoCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aGluIHRoZSB0ZXh0LgorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAtID4wIGVudW1lcmF0ZXMgb25seSB0aGUgaW5kaWNhdGVkCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgc3ViZXhwcmVzc2lvbiBmcm9tIGEgbWF0Y2ggd2l0aGluIHRoZSB0ZXh0LgorICAgICAgICogQHBhcmFtIF9fbSAgICAgICAgICBbSU5dIFBvbGljeSBmbGFncyBmb3IgbWF0Y2gg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IGVxdWFsaXR5LgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgcmVnZXhfdG9rZW5faXRlcmF0b3ImIF9fcmhzKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQ29tcGFyZXMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IgdG8gYW5vdGhlciBmb3IgaW5lcXVhbGl0eS4KKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IHJlZ2V4X3Rva2VuX2l0ZXJhdG9yJiBfX3Jocyk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERlcmVmZXJlbmNlcyBhICVyZWdleF90b2tlbl9pdGVyYXRvci4KKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICBjb25zdCB2YWx1ZV90eXBlJgorICAgICAgb3BlcmF0b3IqKCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNlbGVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IgbWVtYmVyLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIGNvbnN0IHZhbHVlX3R5cGUqCisgICAgICBvcGVyYXRvci0+KCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluY3JlbWVudHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqLworICAgICAgcmVnZXhfdG9rZW5faXRlcmF0b3ImCisgICAgICBvcGVyYXR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VG9rZW4gPSBfU190b2tlbl9saW5lX2JlZ2luOworCSAgKytfTV9jdXJyZW50OworCSAgcmV0dXJuOworCX0KKyAgICAgIGVsc2UgaWYgKF9fYyA9PSBfTV9jdHlwZS53aWRlbignJCcpKQorCXsKKwkgIF9NX2N1clRva2VuID0gX1NfdG9rZW5fbGluZV9lbmQ7CisJICArK19NX2N1cnJlbnQ7CisJICByZXR1cm47CisJfQorI2VuZGlmCisgICAgICBlbHNlIGlmIChfX2MgPT0gX01fY3R5cGUud2lkZW4oJy4nKSkKKwl7CisJICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2FueWNoYXI7CisJICArK19NX2N1cnJlbnQ7CisJICByZXR1cm47CisJfQorICAgICAgZWxzZSBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCcqJykpCisJeworCSAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9jbG9zdXJlMDsKKwkgICsrX01fY3VycmVudDsKKwkgIHJldHVybjsKKwl9CisgICAgICBlbHNlIGlmIChfX2MgPT0gX01fY3R5cGUud2lkZW4oJysnKSkKKwl7CisJICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2Nsb3N1cmUxOworCSAgKytfTV9jdXJyZW50OworCSAgcmV0dXJuOworCX0KKyAgICAgIGVsc2UgaWYgKF9fYyA9PSBfTV9jdHlwZS53aWRlbignfCcpKQorCXsKKwkgIF9NX2N1clRva2VuID0gX1NfdG9rZW5fb3I7CisJICArK19NX2N1cnJlbnQ7CisJICByZXR1cm47CisJfQorICAgICAgZWxzZSBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCdbJykpCisJeworCSAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9icmFja2V0X2JlZ2luOworCSAgX01fc3RhdGUgfD0gKF9TX3N0YXRlX2luX2JyYWNrZXQgfCBfU19zdGF0ZV9hdF9zdGFydCk7CisJICArK19NX2N1cnJlbnQ7CisJICByZXR1cm47CisJfQorICAgICAgZWxzZSBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCdcXCcpKQorCXsKKwkgIF9NX2VhdF9lc2NhcGUoKTsKKwkgIHJldHVybjsKKwl9CisgICAgICBlbHNlIGlmICghKF9NX2ZsYWdzICYgKHJlZ2V4X2NvbnN0YW50czo6YmFzaWMgfCByZWdleF9jb25zdGFudHM6OmdyZXApKSkKKwl7CisJICBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCcoJykpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX3N1YmV4cHJfYmVnaW47CisJICAgICAgKytfTV9jdXJyZW50OworCSAgICAgIHJldHVybjsKKwkgICAgfQorCSAgZWxzZSBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCcpJykpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX3N1YmV4cHJfZW5kOworCSAgICAgICsrX01fY3VycmVudDsKKwkgICAgICByZXR1cm47CisJICAgIH0KKwkgIGVsc2UgaWYgKF9fYyA9PSBfTV9jdHlwZS53aWRlbigneycpKQorCSAgICB7CisJICAgICAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9pbnRlcnZhbF9iZWdpbjsKKwkgICAgICBfTV9zdGF0ZSB8PSBfU19zdGF0ZV9pbl9icmFjZTsKKwkgICAgICArK19NX2N1cnJlbnQ7CisJICAgICAgcmV0dXJuOworCSAgICB9CisJfQorCisgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX29yZF9jaGFyOworICAgICAgX01fY3VyVmFsdWUuYXNzaWduKDEsIF9fYyk7CisgICAgICArK19NX2N1cnJlbnQ7CisgICAgfQorCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcmF0b3I+CisgICAgdm9pZAorICAgIF9TY2FubmVyPF9JbnB1dEl0ZXJhdG9yPjo6CisgICAgX01fc2Nhbl9pbl9icmFjZSgpCisgICAgeworICAgICAgaWYgKF9NX2N0eXBlLmlzKF9DdHlwZVQ6OmRpZ2l0LCAqX01fY3VycmVudCkpCisJeworCSAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9kdXBfY291bnQ7CisJICBfTV9jdXJWYWx1ZS5hc3NpZ24oMSwgKl9NX2N1cnJlbnQpOworCSAgKytfTV9jdXJyZW50OworCSAgd2hpbGUgKF9NX2N1cnJlbnQgIT0gX01fZW5kCisJCSAmJiBfTV9jdHlwZS5pcyhfQ3R5cGVUOjpkaWdpdCwgKl9NX2N1cnJlbnQpKQorCSAgICB7CisJICAgICAgX01fY3VyVmFsdWUgKz0gKl9NX2N1cnJlbnQ7CisJICAgICAgKytfTV9jdXJyZW50OworCSAgICB9CisJICByZXR1cm47CisJfQorICAgICAgZWxzZSBpZiAoKl9NX2N1cnJlbnQgPT0gX01fY3R5cGUud2lkZW4oJywnKSkKKwl7CisJICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2NvbW1hOworCSAgKytfTV9jdXJyZW50OworCSAgcmV0dXJuOworCX0KKyAgICAgIGlmIChfTV9mbGFncyAmIChyZWdleF9jb25zdGFudHM6OmJhc2ljIHwgcmVnZXhfY29uc3RhbnRzOjpncmVwKSkKKwl7CisJICBpZiAoKl9NX2N1cnJlbnQgPT0gX01fY3R5cGUud2lkZW4oJ1xcJykpCisJICAgIF9NX2VhdF9lc2NhcGUoKTsKKwl9CisgICAgICBlbHNlIAorCXsKKwkgIGlmICgqX01fY3VycmVudCA9PSBfTV9jdHlwZS53aWRlbignfScpKQorCSAgICB7CisJICAgICAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9pbnRlcnZhbF9lbmQ7CisJICAgICAgX01fc3RhdGUgJj0gfl9TX3N0YXRlX2luX2JyYWNlOworCSAgICAgICsrX01fY3VycmVudDsKKwkgICAgICByZXR1cm47CisJICAgIH0KKwl9CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXJhdG9yPgorICAgIHZvaWQKKyAgICBfU2Nhbm5lcjxfSW5wdXRJdGVyYXRvcj46OgorICAgIF9NX3NjYW5faW5fYnJhY2tldCgpCisgICAgeworICAgICAgaWYgKF9NX3N0YXRlICYgX1Nfc3RhdGVfYXRfc3RhcnQgJiYgKl9NX2N1cnJlbnQgPT0gX01fY3R5cGUud2lkZW4oJ14nKSkKKwl7CisJICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2ludmVyc2VfY2xhc3M7CisJICBfTV9zdGF0ZSAmPSB+X1Nfc3RhdGVfYXRfc3RhcnQ7CisJICArK19NX2N1cnJlbnQ7CisJICByZXR1cm47CisJfQorICAgICAgZWxzZSBpZiAoKl9NX2N1cnJlbnQgPT0gX01fY3R5cGUud2lkZW4oJ1snKSkKKwl7CisJICArK19NX2N1cnJlbnQ7CisJICBpZiAoX01fY3VycmVudCA9PSBfTV9lbmQpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2VvZjsKKwkgICAgICByZXR1cm47CisJICAgIH0KKworCSAgaWYgKCpfTV9jdXJyZW50ID09IF9NX2N0eXBlLndpZGVuKCcuJykpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2NvbGxzeW1ib2w7CisJICAgICAgX01fZWF0X2NvbGxzeW1ib2woKTsKKwkgICAgICByZXR1cm47CisJICAgIH0KKwkgIGVsc2UgaWYgKCpfTV9jdXJyZW50ID09IF9NX2N0eXBlLndpZGVuKCc6JykpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX2NoYXJfY2xhc3NfbmFtZTsKKwkgICAgICBfTV9lYXRfY2hhcmNsYXNzKCk7CisJICAgICAgcmV0dXJuOworCSAgICB9CisJICBlbHNlIGlmICgqX01fY3VycmVudCA9PSBfTV9jdHlwZS53aWRlbignPScpKQorCSAgICB7CisJICAgICAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9lcXVpdl9jbGFzc19uYW1lOworCSAgICAgIF9NX2VhdF9lcXVpdmNsYXNzKC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9CisgICAgICBfQ2hhclQgX19jID0gKl9NX2N1cnJlbnQ7CisgICAgICArK19NX2N1cnJlbnQ7CisKKyAgICAgIGlmIChfX2MgPT0gX01fY3R5cGUud2lkZW4oJygnKSkKKwl7CisJICBpZiAoIShfTV9mbGFncyAmIChyZWdleF9jb25zdGFudHM6OmJhc2ljIHwgcmVnZXhfY29uc3RhbnRzOjpncmVwKSkpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX29yZF9jaGFyOworCSAgICAgIF9NX2N1clZhbHVlLmFzc2lnbigxLCBfX2MpOworCSAgICB9CisJICBlbHNlCisJICAgIF9NX2N1clRva2VuID0gX1NfdG9rZW5fc3ViZXhwcl9iZWdpbjsKKwl9CisgICAgICBlbHNlIGlmIChfX2MgPT0gX01fY3R5cGUud2lkZW4oJyknKSkKKwl7CisJICBpZiAoIShfTV9mbGFncyAmIChyZWdleF9jb25zdGFudHM6OmJhc2ljIHwgcmVnZXhfY29uc3RhbnRzOjpncmVwKSkpCisJICAgIHsKKwkgICAgICBfTV9jdXJUb2tlbiA9IF9TX3Rva2VuX29yZF9jaGFyOworCSAgICAgIF9NX2N1clZhbHVlLmFzc2lnbigxLCBfX2MpOworCSAgICB9CisJICBlbHNlCisJICAgIF9NX2N1clRva2VuID0gX1NfdG9rZW5fc3ViZXhwcl9lbmQ7CisJfQorICAgICAgZWxzZSBpZiAoX19jID09IF9NX2N0eXBlLndpZGVuKCd7JykpCisJeworCSAgaWYgKCEoX01fZmxhZ3MgJiAocmVnZXhfY29uc3RhbnRzOjpiYXNpYyB8IHJlZ2V4X2NvbnN0YW50czo6Z3JlcCkpKQorCSAgICB7CisJICAgICAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9vcmRfY2hhcjsKKwkgICAgICBfTV9jdXJWYWx1ZS5hc3NpZ24oMSwgX19jKTsKKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgX01fY3VyVG9rZW4gPSBfU190b2tlbl9pb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AgX1NjYW5uZXI8X0lucHV0SXRlcmF0b3I+OjoKKyAgICBfTV9lYXRfY2hhcmNsYXNzKCkKKyAgICB7CisgICAgICArK19NX2N1cnJlbnQ7IC8vIHNraXAgJzonCisgICAgICBpZiAoX01fY3VycmVudCA9PSBfTV9lbmQpCisJX190aHJvd19yZWdleF9lcnJvcihyZWdleF9jb25zdGFudHM6OmVycm9yX2N0eXBlKTsKKyAgICAgIGZvciAoX01fY3VyVmFsdWUuY2xlYXIoKTsKKwkgICBfTV9jdXJyZW50ICE9IF9NX2VuZCAmJiAqX01fY3VycmVudCAhPSBfTV9jdHlwZS53aWRlbignOicpOworCSAgICsrX01fY3VycmVudCkKKwlfTV9jdXJWYWx1ZSArPSAqX01fY3VycmVudDsKKyAgICAgIGlmIChfTV9jdXJyZW50ID09IF9NX2VuZCkKKwlfX3Rocm93X3JlZ2V4X2Vycm9yKHJlZ2V4X2NvbnN0YW50czo6ZXJyb3JfY3R5cGUpOworICAgICAgKytfTV9jdXJyZW50OyAvLyBza2lwICc6JworICAgICAgaWYgKCpfTV9jdXJyZW50ICE9IF9NX2N0eXBlLndpZGVuKCddJykpCisJX190aHJvd19yZWdleF9lcnJvcihyZWdleF9jb25zdGFudHM6OmVycm9yX2N0eXBlKTsKKyAgICAgICsrX01fY3VycmVudDsgLy8gc2tpcCAnXScKKyAgICB9CisKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW5wdXRJdGVyYXRvcj4KKyAgICB2b2lkCisgICAgX1NjYW5uZXI8X0lucHV0SXRlcmF0b3I+OjoKKyAgICBfTV9lYXRfZXF1aXZjbGFzcygpCisgICAgeworICAgICAgKytfTV9jdXJyZW50OyAvLyBza2lwICc9JworICAgICAgaWYgKF9NX2N1cnJlbnQgPT0gX01fZW5kKQorCV9fdGhyb3dfcmVnZXhfZXJyb3IocmVnZXhfY29uc3RhbnRzOjplcnJvcl9jb2xsYXRlKTsKKyAgICAgIGZvciAoX01fY3VyVmFsdWUuY2xlYXIoKTs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XE+ID4gX1N0YWNrVDsKKyAgICAgIHR5cGVkZWYgX1JhbmdlTWF0Y2hlcjxfSW5JdGVyLCBfVHJhaXRzVD4gICAgICAgICAgICAgICBfUk1hdGNoZXJUOworCisgICAgICAvLyBhY2NlcHRzIGEgc3BlY2lmaWMgdG9rZW4gb3IgcmV0dXJucyBmYWxzZS4KKyAgICAgIGJvb2wKKyAgICAgIF9NX21hdGNoX3Rva2VuKF9Ub2tlblQgX190b2tlbik7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2Rpc2p1bmN0aW9uKCk7CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2FsdGVybmF0aXZlKCk7CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX3Rlcm0oKTsKKworICAgICAgYm9vbAorICAgICAgX01fYXNzZXJ0aW9uKCk7CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX3F1YW50aWZpZXIoKTsKKworICAgICAgYm9vbAorICAgICAgX01fYXRvbSgpOworCisgICAgICBib29sCisgICAgICBfTV9icmFja2V0X2V4cHJlc3Npb24oKTsKKworICAgICAgYm9vbAorICAgICAgX01fYnJhY2tldF9saXN0KF9STWF0Y2hlclQmIF9fbWF0Y2hlcik7CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2ZvbGxvd19saXN0KF9STWF0Y2hlclQmIF9fbWF0Y2hlcik7CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2ZvbGxvd19saXN0MihfUk1hdGNoZXJUJiBfX21hdGNoZXIpOworCisgICAgICBib29sCisgICAgICBfTV9leHByZXNzaW9uX3Rlcm0oX1JNYXRjaGVyVCYgX19tYXRjaGVyKTsKKworICAgICAgYm9vbAorICAgICAgX01fcmFuZ2VfZXhwcmVzc2lvbihfUk1hdGNoZXJUJiBfX21hdGNoZXIpOworCisgICAgICBib29sCisgICAgICBfTV9zdGFydF9yYW5nZShfUk1hdGNoZXJUJiBfX21hdGNoZXIpOworCisgICAgICBib29sCisgICAgICBfTV9jb2xsYXRp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AgQGJyaWVmIENvbnN0YW50IGRlZmluaXRpb25zIGZvciB0aGUgc3RkIHJlZ2V4IGxpYnJhcnkuCisgKgorICogIFRoaXMgaXMgYW4gaW50ZXJuYWwgaGVhZGVyIGZpbGUsIGluY2x1ZGVkIGJ5IG90aGVyIGxpYnJhcnkgaGVhZGVycy4KKyAqICBEbyBub3QgYXR0ZW1wdCB0byB1c2UgaXQgZGlyZWN0bHkuIEBoZWFkZXJuYW1le3JlZ2V4fQorICovCisKK25hbWVzcGFjZSBzdGQgX0dMSUJDWFhfVklTSUJJTElUWShkZWZhdWx0KQoreworLyoqCisgKiBAbmFtZXNwYWNlIHN0ZDo6cmVnZXhfY29uc3RhbnRzCisgKiBAYnJpZWYgSVNPIEMrKy0weCBlbnRpdGllcyBzdWIgbmFtZXNwYWNlIGZvciByZWdleC4KKyAqLworbmFtZXNwYWNlIHJlZ2V4X2NvbnN0YW50cworeworX0dMSUJDWFhfQkVHSU5fTkFNRVNQQUNFX1ZFUlNJT04KKworICAvKioKKyAgICogQG5hbWUgNS4xIFJlZ3VsYXIgRXhwcmVzc2lvbiBTeW50YXggT3B0aW9ucworICAgKi8KKyAgLy9AeworICBlbnVtIF9fc3ludGF4X29wdGlvbgorICAgIHsKKyAgICAgIF9TX2ljYXNlLAorICAgICAgX1Nfbm9zdWJzLAorICAgICAgX1Nfb3B0aW1pemUsCisgICAgICBfU19jb2xsYXRlLAorICAgICAgX1NfRUNNQVNjcmlwdCwKKyAgICAgIF9TX2Jhc2ljLAorICAgICAgX1NfZXh0ZW5kZWQsCisgICAgICBfU19hd2ssCisgICAgICBfU19ncmVwLAorICAgICAgX1NfZWdyZXAsCisgICAgICBfU19zeW50YXhfbGFzdAorICAgIH07CisKKyAgLyoqCisgICAqIEBicmllZiBUaGlzIGlzIGEgYml0bWFzayB0eXBlIGluZGljYXRpbmcgaG93IHRvIGludGVycHJldCB0aGUgcmVnZXguCisgICAqCisgICAqIFRoZSBAYyBzeW50YXhfb3B0aW9uX3R5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emVkQ3Vyc29yKGNvbnN0IF9Gd2RJdGVyVCYgX19iLCBjb25zdCBfRndkSXRlclQgX19lKQorICAgICAgOiBfTV9iKF9fYiksIF9NX2MoX19iKSwgX01fZShfX2UpCisgICAgICB7IH0KKworICAgICAgdHlwZW5hbWUgc3RkOjppdGVyYXRvcl90cmFpdHM8X0Z3ZEl0ZXJUPjo6dmFsdWVfdHlwZQorICAgICAgX01fY3VycmVudCgpIGNvbnN0CisgICAgICB7IHJldHVybiAqX01fYzsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9uZXh0KCkKKyAgICAgIHsgKytfTV9jOyB9CisKKyAgICAgIF9Gd2RJdGVyVAorICAgICAgX01fcG9zKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2M7IH0KKworICAgICAgY29uc3QgX0Z3ZEl0ZXJUJgorICAgICAgX01fYmVnaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fYjsgfQorCisgICAgICBjb25zdCBfRndkSXRlclQmCisgICAgICBfTV9lbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZTsgfQorCisgICAgICBib29sCisgICAgICBfTV9hdF9lbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fYyA9PSBfTV9lOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgX0Z3ZEl0ZXJUIF9NX2I7CisgICAgICBfRndkSXRlclQgX01fYzsKKyAgICAgIF9Gd2RJdGVyVCBfTV9lOworICAgIH07CisKKyAgLy8gSGVscGVyIGZ1bmN0aW9uIHRvIGNyZWF0ZSBhIGN1cnNvciBzcGVjaWFsaXplZCBmb3IgYW4gaXRlcmF0b3IgY2xhc3MuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9Gd2RJdGVyVD4KKyAgICBpbmxpbmUgX1NwZWNpYWxpemVkQ3Vyc29yPF9Gd2RJdGVyVD4KKyAgICBfX2N1cnNvcihjb25zdCBfRndkSXRlclQmIF9fYiwgY29uc3QgX0Z3ZEl0ZXJUIF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GVmIHR5cGVuYW1lIF9UcmFpdHNUOjpjaGFyX3R5cGUgX0NoYXJUOworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX3N0cmluZzxfQ2hhclQ+ICAgIF9TdHJpbmdUOworCisgICAgICBleHBsaWNpdAorICAgICAgX1JhbmdlTWF0Y2hlcihib29sIF9faXNfbm9uX21hdGNoaW5nLCBjb25zdCBfVHJhaXRzVCYgX190ID0gX1RyYWl0c1QoKSkKKyAgICAgIDogX01fdHJhaXRzKF9fdCksIF9NX2lzX25vbl9tYXRjaGluZyhfX2lzX25vbl9tYXRjaGluZykKKyAgICAgIHsgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvcigpKGNvbnN0IF9QYXR0ZXJuQ3Vyc29yJiBfX3BjKSBjb25zdAorICAgICAgeworCXR5cGVkZWYgY29uc3QgX1NwZWNpYWxpemVkQ3Vyc29yPF9Jbkl0ZXJUPiYgX0N1cnNvclQ7CisJX0N1cnNvclQgX19jID0gc3RhdGljX2Nhc3Q8X0N1cnNvclQ+KF9fcGMpOworCXJldHVybiB0cnVlOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9hZGRfY2hhcihfQ2hhclQgX19jKQorICAgICAgeyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2FkZF9jb2xsYXRpbmdfZWxlbWVudChjb25zdCBfU3RyaW5nVCYgX19zKQorICAgICAgeyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2FkZF9lcXVpdmFsZW5jZV9jbGFzcyhjb25zdCBfU3RyaW5nVCYgX19zKQorICAgICAgeyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2FkZF9jaGFyYWN0ZXJfY2xhc3MoY29uc3QgX1N0cmluZ1QmIF9fcykKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9tYWtlX3JhbmdlKCkKKyAgICAgIHsgfQorCisgICAgICBjb25zdCBfVHJhaXRzVCYgX01fdHJhaXRzOworICAgICAgYm9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plKCktMTsKKyAgICB9CisKKyAgICBfU3RhdGVJZFQKKyAgICBfTV9pbnNlcnRfYWx0KF9TdGF0ZUlkVCBfX25leHQsIF9TdGF0ZUlkVCBfX2FsdCkKKyAgICB7CisgICAgICB0aGlzLT5wdXNoX2JhY2soX1N0YXRlVChfX25leHQsIF9fYWx0KSk7CisgICAgICByZXR1cm4gdGhpcy0+c2l6ZSgpLTE7CisgICAgfQorCisgICAgX1N0YXRlSWRUCisgICAgX01faW5zZXJ0X21hdGNoZXIoX01hdGNoZXIgX19tKQorICAgIHsKKyAgICAgIHRoaXMtPnB1c2hfYmFjayhfU3RhdGVUKF9fbSkpOworICAgICAgcmV0dXJuIHRoaXMtPnNpemUoKS0xOworICAgIH0KKworICAgIF9TdGF0ZUlkVAorICAgIF9NX2luc2VydF9zdWJleHByX2JlZ2luKGNvbnN0IF9UYWdnZXImIF9fdCkKKyAgICB7CisgICAgICB0aGlzLT5wdXNoX2JhY2soX1N0YXRlVChfU19vcGNvZGVfc3ViZXhwcl9iZWdpbiwgX01fc3ViZXhwcl9jb3VudCsrLCBfX3QpKTsKKyAgICAgIHJldHVybiB0aGlzLT5zaXplKCktMTsKKyAgICB9CisKKyAgICBfU3RhdGVJZFQgCisgICAgX01faW5zZXJ0X3N1YmV4cHJfZW5kKHVuc2lnbmVkIGludCBfX2ksIGNvbnN0IF9UYWdnZXImIF9fdCkKKyAgICB7CisgICAgICB0aGlzLT5wdXNoX2JhY2soX1N0YXRlVChfU19vcGNvZGVfc3ViZXhwcl9lbmQsIF9faSwgX190KSk7CisgICAgICByZXR1cm4gdGhpcy0+c2l6ZSgpLTE7CisgICAgfQorCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICBzdGQ6Om9zdHJlYW0mCisgICAgX01fZG90KHN0ZDo6b3N0cmVhbSYgX19vc3RyKSBjb25zdDsKKyNlbmRpZgorCisgIHByaXZhdGU6CisgICAgX0ZsYWdUICAgICBfTV9mbGFnczsKKyAgICBfU3RhdGVJZ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NvdW50KCkgPT0gMSAmJiBnZXQoKSA9PSBfX3AKKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6YmFkX2FsbG9jLCBpbiB3aGljaCBjYXNlIEBhIF9fZChfX3ApIGlzIGNhbGxlZC4KKyAgICAgICAqCisgICAgICAgKiAgUmVxdWlyZW1lbnRzOiBfRGVsZXRlcidzIGNvcHkgY29uc3RydWN0b3IgYW5kIGRlc3RydWN0b3IgbXVzdAorICAgICAgICogIG5vdCB0aHJvdworICAgICAgICoKKyAgICAgICAqICBfX3NoYXJlZF9wdHIgd2lsbCByZWxlYXNlIF9fcCBieSBjYWxsaW5nIF9fZChfX3ApCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDEsIHR5cGVuYW1lIF9EZWxldGVyPgorCXNoYXJlZF9wdHIoX1RwMSogX19wLCBfRGVsZXRlciBfX2QpCisgICAgICAgIDogX19zaGFyZWRfcHRyPF9UcD4oX19wLCBfX2QpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbnN0cnVjdCBhICVzaGFyZWRfcHRyIHRoYXQgb3ducyBhIG51bGwgcG9pbnRlcgorICAgICAgICogICAgICAgICAgYW5kIHRoZSBkZWxldGVyIEBhIF9fZC4KKyAgICAgICAqICBAcGFyYW0gIF9fcCAgQSBudWxsIHBvaW50ZXIgY29uc3RhbnQuCisgICAgICAgKiAgQHBhcmFtICBfX2QgIEEgZGVsZXRlci4KKyAgICAgICAqICBAcG9zdCAgIHVzZV9jb3VudCgpID09IDEgJiYgZ2V0KCkgPT0gX19wCisgICAgICAgKiAgQHRocm93ICBzdGQ6OmJhZF9hbGxvYywgaW4gd2hpY2ggY2FzZSBAYSBfX2QoX19wKSBpcyBjYWxsZWQuCisgICAgICAgKgorICAgICAgICogIFJlcXVpcmVtZW50czogX0RlbGV0ZXIncyBjb3B5IGNvbnN0cnVjdG9yIGFuZCBkZXN0cnVjdG9yIG11c3QKKyAgICAgICAqICBub3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fcHRyPF9UcDE+JiBfX3IsIF9UcCogX19wKSBub2V4Y2VwdAorCTogX19zaGFyZWRfcHRyPF9UcD4oX19yLCBfX3ApIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIElmIEBhIF9fciBpcyBlbXB0eSwgY29uc3RydWN0cyBhbiBlbXB0eSAlc2hhcmVkX3B0cjsKKyAgICAgICAqICAgICAgICAgIG90aGVyd2lzZSBjb25zdHJ1Y3QgYSAlc2hhcmVkX3B0ciB0aGF0IHNoYXJlcyBvd25lcnNoaXAKKyAgICAgICAqICAgICAgICAgIHdpdGggQGEgX19yLgorICAgICAgICogIEBwYXJhbSAgX19yICBBICVzaGFyZWRfcHRyLgorICAgICAgICogIEBwb3N0ICAgZ2V0KCkgPT0gX19yLmdldCgpICYmIHVzZV9jb3VudCgpID09IF9fci51c2VfY291bnQoKQorICAgICAgICovCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAxLCB0eXBlbmFtZSA9IHR5cGVuYW1lCisJICAgICAgIHN0ZDo6ZW5hYmxlX2lmPHN0ZDo6aXNfY29udmVydGlibGU8X1RwMSosIF9UcCo+Ojp2YWx1ZT46OnR5cGU+CisJc2hhcmVkX3B0cihjb25zdCBzaGFyZWRfcHRyPF9UcDE+JiBfX3IpIG5vZXhjZXB0CisgICAgICAgIDogX19zaGFyZWRfcHRyPF9UcD4oX19yKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBNb3ZlLWNvbnN0cnVjdHMgYSAlc2hhcmVkX3B0ciBpbnN0YW5jZSBmcm9tIEBhIF9fci4KKyAgICAgICAqICBAcGFyYW0gIF9fciAgQSAlc2hhcmVkX3B0ciBydmFsdWUuCisgICAgICAgKiAgQHBvc3QgICAqdGhpcyBjb250YWlucyB0aGUgb2xkIHZhbHVlIG9mIEBhIF9fciwgQGEgX19yIGlzIGVtcHR5LgorICAgICAgICovCisgICAgICBzaGFyZWRfcHRyKHNoYXJlZF9wdHImJi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aGF2ZSB0aGUgbmVjZXNzYXJ5CisgICAgICAvLyBtZW1vcnkgYmFycmllcnMuCisgICAgICBlbnVtIHsgX1NfbmVlZF9iYXJyaWVycyA9IDEgfTsKKyAgICB9OworCisgIHRlbXBsYXRlPF9Mb2NrX3BvbGljeSBfTHAgPSBfX2RlZmF1bHRfbG9ja19wb2xpY3k+CisgICAgY2xhc3MgX1NwX2NvdW50ZWRfYmFzZQorICAgIDogcHVibGljIF9NdXRleF9iYXNlPF9McD4KKyAgICB7CisgICAgcHVibGljOiAgCisgICAgICBfU3BfY291bnRlZF9iYXNlKCkgbm9leGNlcHQKKyAgICAgIDogX01fdXNlX2NvdW50KDEpLCBfTV93ZWFrX2NvdW50KDEpIHsgfQorICAgICAgCisgICAgICB2aXJ0dWFsCisgICAgICB+X1NwX2NvdW50ZWRfYmFzZSgpIG5vZXhjZXB0CisgICAgICB7IH0KKyAgCisgICAgICAvLyBDYWxsZWQgd2hlbiBfTV91c2VfY291bnQgZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZSB0aGUgcmVzb3VyY2VzCisgICAgICAvLyBtYW5hZ2VkIGJ5ICp0aGlzLgorICAgICAgdmlydHVhbCB2b2lkCisgICAgICBfTV9kaXNwb3NlKCkgbm9leGNlcHQgPSAwOworICAgICAgCisgICAgICAvLyBDYWxsZWQgd2hlbiBfTV93ZWFrX2NvdW50IGRyb3BzIHRvIHplcm8uCisgICAgICB2aXJ0dWFsIHZvaWQKKyAgICAgIF9NX2Rlc3Ryb3koKSBub2V4Y2VwdAorICAgICAgeyBkZWxldGUgdGhpczsgfQorICAgICAgCisgICAgICB2aXJ0dWFsIHZvaWQqCisgICAgICBfTV9nZXRfZGVsZXRlcihjb25zdCBzdGQ6OnR5cGVfaW5mbyYpID0gMDsKKworICAgICAgdm9pZAorICAgICAgX01fYWRkX3JlZl9jb3B5KCkKKyAgICAgIHsgX19nbnVfY3h4OjpfX2F0b21pY19hZGRfZGlzcGF0Y2goJl9NX3VzZV9jb3Vud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3Rvci1mcmllbmRseS4gIEZvciBtb3JlIGluZm8gc2VlIGJpdHMvYysrY29uZmlnLgorICAgICAgICAgICAgX0dMSUJDWFhfU1lOQ0hST05JWkFUSU9OX0hBUFBFTlNfQkVGT1JFKCZfTV93ZWFrX2NvdW50KTsKKwkgICAgaWYgKF9fZ251X2N4eDo6X19leGNoYW5nZV9hbmRfYWRkX2Rpc3BhdGNoKCZfTV93ZWFrX2NvdW50LAorCQkJCQkJICAgICAgIC0xKSA9PSAxKQorICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgX0dMSUJDWFhfU1lOQ0hST05JWkFUSU9OX0hBUFBFTlNfQUZURVIoJl9NX3dlYWtfY291bnQpOworCSAgICAgICAgX01fZGVzdHJveSgpOworICAgICAgICAgICAgICB9CisJICB9CisgICAgICB9CisgIAorICAgICAgdm9pZAorICAgICAgX01fd2Vha19hZGRfcmVmKCkgbm9leGNlcHQKKyAgICAgIHsgX19nbnVfY3h4OjpfX2F0b21pY19hZGRfZGlzcGF0Y2goJl9NX3dlYWtfY291bnQsIDEpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3dlYWtfcmVsZWFzZSgpIG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIC8vIEJlIHJhY2UtZGV0ZWN0b3ItZnJpZW5kbHkuIEZvciBtb3JlIGluZm8gc2VlIGJpdHMvYysrY29uZmlnLgorICAgICAgICBfR0xJQkNYWF9TWU5DSFJPTklaQVRJT05fSEFQUEVOU19CRUZPUkUoJl9NX3dlYWtfY291bnQpOworCWlmIChfX2dudV9jeHg6Ol9fZXhjaGFuZ2VfYW5kX2FkZF9kaXNwYXRjaCgmX01fd2Vha19jb3VudCwgLTEpID09IDEpCisJICB7CisgICAgICAgICAgICBfR0xJQkNYWF9TWU5DSFJPTklaQVRJT05fSEFQUEVOU19BRlRFUigmX01fd2Vha19jb3VudCk7CisJICAgIGlmIChfTXV0ZXhfYmFzZTxfTHA+OjpfU19uZWVkX2JhcnJpZXJzKQorCSAgICAgIHsKKwkgICAgICAgIC8vIFNlZSBfTV9yZWxlYXNlKCksCisJICAgICAgICAvLyBkZXN0cm95KCkgbXVzdCBvYnNlcnZlIHJlc3VsdHMgb2YgZGlzcG9zZSgpCisJICAgICAgICBfR0xJQkNYWF9SRUFEX01FTV9CQVJSSUVSOworCSAgICAgICAgX0dMSUJDWFhfV1JJVEVfTUVNX0JBUlJJRVI7CisJICAgICAgfQorCSAgICBfTV9kZXN0cm95KCk7CisJICB9CisgICAgICB9CisgIAorICAgICAgbG9uZworICAgICAgX01fZ2V0X3VzZV9jb3VudCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIC8vIE5vIG1lbW9yeSBiYXJyaWVyIGlzIHVzZWQgaGVyZSBzbyB0aGVyZSBpcyBubyBzeW5jaHJvbml6YXRpb24KKyAgICAgICAgLy8gd2l0aCBvdGhlciB0aHJlYWRzLgorICAgICAgICByZXR1cm4gX19hdG9taWNfbG9hZF9uKCZfTV91c2VfY291bnQsIF9fQVRPTUlDX1JFTEFYRUQpOworICAgICAgfQorCisgICAgcHJpdmF0ZTogIAorICAgICAgX1NwX2NvdW50ZWRfYmFzZShfU3BfY291bnRlZF9iYXNlIGNvbnN0JikgPSBkZWxldGU7CisgICAgICBfU3BfY291bnRlZF9iYXNlJiBvcGVyYXRvcj0oX1NwX2NvdW50ZWRfYmFzZSBjb25zdCYpID0gZGVsZXRlOworCisgICAgICBfQXRvbWljX3dvcmQgIF9NX3VzZV9jb3VudDsgICAgIC8vICNzaGFyZWQKKyAgICAgIF9BdG9taWNfd29yZCAgX01fd2Vha19jb3VudDsgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorICAgIH07CisKKyAgdGVtcGxhdGU8PgorICAgIGlubGluZSB2b2lkCisgICAgX1NwX2NvdW50ZWRfYmFzZTxfU19zaW5nbGU+OjoKKyAgICBfTV9hZGRfcmVmX2xvY2soKQorICAgIHsKKyAgICAgIGlmIChfX2dudV9je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NvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX3IpOworCisgICAgICB+X19zaGFyZWRfY291bnQoKSBub2V4Y2VwdAorICAgICAgeworCWlmIChfTV9waSAhPSAwKQorCSAgX01fcGktPl9NX3JlbGVhc2UoKTsKKyAgICAgIH0KKworICAgICAgX19zaGFyZWRfY291bnQoY29uc3QgX19zaGFyZWRfY291bnQmIF9fcikgbm9leGNlcHQKKyAgICAgIDogX01fcGkoX19yLl9NX3BpKQorICAgICAgeworCWlmIChfTV9waSAhPSAwKQorCSAgX01fcGktPl9NX2FkZF9yZWZfY29weSgpOworICAgICAgfQorCisgICAgICBfX3NoYXJlZF9jb3VudCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfX3NoYXJlZF9jb3VudCYgX19yKSBub2V4Y2VwdAorICAgICAgeworCV9TcF9jb3VudGVkX2Jhc2U8X0xwPiogX190bXAgPSBfX3IuX01fcGk7CisJaWYgKF9fdG1wICE9IF9NX3BpKQorCSAgeworCSAgICBpZiAoX190bXAgIT0gMCkKKwkgICAgICBfX3RtcC0+X01fYWRkX3JlZl9jb3B5KCk7CisJICAgIGlmIChfTV9waSAhPSAwKQorCSAgICAgIF9NX3BpLT5fTV9yZWxlYXNlKCk7CisJICAgIF9NX3BpID0gX190bXA7CisJICB9CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9zd2FwKF9fc2hhcmVkX2NvdW50JiBfX3IpIG5vZXhjZXB0CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlfX3IuX01fcGkgPSBfTV9waTsKKwlfTV9waSA9IF9fdG1wOworICAgICAgfQorCisgICAgICBsb25nCisgICAgICBfTV9nZXRfdXNlX2NvdW50KCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX3BpICE9IDAgPyBfTV9waS0+X01fZ2V0X3VzZV9jb3VudCgpIDogMDsgfQorCisgICAgICBib29sCisgICAgICBfTV91bmlxdWUoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fZ2V0X3VzZV9jb3VudCgpID09IDE7IH0KKworICAgICAgdm9pZCoKKyAgICAgIF9NX2dldF9kZWxldGVyKGNvbnN0IHN0ZDo6dHlwZV9pbmZvJiBfX3RpKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fcGkgPyBfTV9waS0+X01fZ2V0X2RlbGV0ZXIoX190aSkgOiAwOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2xlc3MoY29uc3QgX19zaGFyZWRfY291bnQmIF9fcmhzKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gc3RkOjpsZXNzPF9TcF9jb3VudGVkX2Jhc2U8X0xwPio+KCkodGhpcy0+X01fcGksIF9fcmhzLl9NX3BpKTsgfQorCisgICAgICBib29sCisgICAgICBfTV9sZXNzKGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX3JocykgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIHN0ZDo6bGVzczxfU3BfY291bnRlZF9iYXNlPF9McD4qPigpKHRoaXMtPl9NX3BpLCBfX3Jocy5fTV9waSk7IH0KKworICAgICAgLy8gRnJpZW5kIGZ1bmN0aW9uIGluamVjdGVkIGludG8gZW5jbG9zaW5nIG5hbWVzcGFjZSBhbmQgZm91bmQgYnkgQURMCisgICAgICBmcmllbmQgaW5saW5lIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgX19zaGFyZWRfY291bnQmIF9fYSwgY29uc3QgX19zaGFyZWRfY291bnQmIF9fYikgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9fYS5fTV9waSA9PSBfX2IuX01fcGk7IH0KKworICAgIHByaXZhdGU6CisgICAgICBmcmllbmQgY2xhc3MgX193ZWFrX2NvdW50PF9McD47CisKKyAgICAgIHRlbXBsYXRlPHR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worCisKKyAgdGVtcGxhdGU8X0xvY2tfcG9saWN5IF9McD4KKyAgICBjbGFzcyBfX3dlYWtfY291bnQKKyAgICB7CisgICAgcHVibGljOgorICAgICAgY29uc3RleHByIF9fd2Vha19jb3VudCgpIG5vZXhjZXB0IDogX01fcGkoMCkKKyAgICAgIHsgfQorCisgICAgICBfX3dlYWtfY291bnQoY29uc3QgX19zaGFyZWRfY291bnQ8X0xwPiYgX19yKSBub2V4Y2VwdAorICAgICAgOiBfTV9waShfX3IuX01fcGkpCisgICAgICB7CisJaWYgKF9NX3BpICE9IDApCisJICBfTV9waS0+X01fd2Vha19hZGRfcmVmKCk7CisgICAgICB9CisKKyAgICAgIF9fd2Vha19jb3VudChjb25zdCBfX3dlYWtfY291bnQ8X0xwPiYgX19yKSBub2V4Y2VwdAorICAgICAgOiBfTV9waShfX3IuX01fcGkpCisgICAgICB7CisJaWYgKF9NX3BpICE9IDApCisJICBfTV9waS0+X01fd2Vha19hZGRfcmVmKCk7CisgICAgICB9CisKKyAgICAgIH5fX3dlYWtfY291bnQoKSBub2V4Y2VwdAorICAgICAgeworCWlmIChfTV9waSAhPSAwKQorCSAgX01fcGktPl9NX3dlYWtfcmVsZWFzZSgpOworICAgICAgfQorCisgICAgICBfX3dlYWtfY291bnQ8X0xwPiYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfX3NoYXJlZF9jb3VudDxfTHA+JiBfX3IpIG5vZXhjZXB0CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlpZiAoX190bXAgIT0gMCkKKwkgIF9fdG1wLT5fTV93ZWFrX2FkZF9yZWYoKTsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV93ZWFrX3JlbGVhc2UoKTsKKwlfTV9waSA9IF9fdG1wOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX193ZWFrX2NvdW50PF9McD4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgX193ZWFrX2NvdW50PF9McD4mIF9fcikgbm9leGNlcHQKKyAgICAgIHsKKwlfU3BfY291bnRlZF9iYXNlPF9McD4qIF9fdG1wID0gX19yLl9NX3BpOworCWlmIChfX3RtcCAhPSAwKQorCSAgX190bXAtPl9NX3dlYWtfYWRkX3JlZigpOworCWlmIChfTV9waSAhPSAwKQorCSAgX01fcGktPl9NX3dlYWtfcmVsZWFzZSgpOworCV9NX3BpID0gX190bXA7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9zd2FwKF9fd2Vha19jb3VudDxfTHA+JiBfX3IpIG5vZXhjZXB0CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlfX3IuX01fcGkgPSBfTV9waTsKKwlfTV9waSA9IF9fdG1wOworICAgICAgfQorCisgICAgICBsb25nCisgICAgICBfTV9nZXRfdXNlX2NvdW50KCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX3BpICE9IDAgPyBfTV9waS0+X01fZ2V0X3VzZV9jb3VudCgpIDogMDsgfQorCisgICAgICBib29sCisgICAgICBfTV9sZXNzKGNvbnN0IF9fd2Vha19jb3VudCYgX19yaHMpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6Omxlc3M8X1NwX2NvdW50ZWRfYmFzZTxfTHA+Kj4oKSh0aGlzLT5fTV9waSwgX19yaHMuX01fcGkpOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2xlc3MoY29uc3QgX19zaGFyZWRfY291bnQ8X0xwPiYgX19yaHMpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6Omxlc3M8X1NwX2NvdW50ZWRfYmFzZTxfTHA+Kj4oKSh0aGlzLT5fTV9waSwgX19yaHMuX01fcGkpOyB9CisKKyAgICAgIC8vIEZyaWVuZCBmdW5jdGl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0cgorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9UcCBlbGVtZW50X3R5cGU7CisKKyAgICAgIGNvbnN0ZXhwciBfX3dlYWtfcHRyKCkgbm9leGNlcHQKKyAgICAgIDogX01fcHRyKDApLCBfTV9yZWZjb3VudCgpCisgICAgICB7IH0KKworICAgICAgX193ZWFrX3B0cihjb25zdCBfX3dlYWtfcHRyJikgbm9leGNlcHQgPSBkZWZhdWx0OworICAgICAgX193ZWFrX3B0ciYgb3BlcmF0b3I9KGNvbnN0IF9fd2Vha19wdHImKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisgICAgICB+X193ZWFrX3B0cigpID0gZGVmYXVsdDsKKworICAgICAgLy8gVGhlICJvYnZpb3VzIiBjb252ZXJ0aW5nIGNvbnN0cnVjdG9yIGltcGxlbWVudGF0aW9uOgorICAgICAgLy8KKyAgICAgIC8vICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAxPgorICAgICAgLy8gICAgX193ZWFrX3B0cihjb25zdCBfX3dlYWtfcHRyPF9UcDEsIF9McD4mIF9fcikKKyAgICAgIC8vICAgIDogX01fcHRyKF9fci5fTV9wdHIpLCBfTV9yZWZjb3VudChfX3IuX01fcmVmY291bnQpIC8vIG5ldmVyIHRocm93cworICAgICAgLy8gICAgeyB9CisgICAgICAvLworICAgICAgLy8gaGFzIGEgc2VyaW91cyBwcm9ibGVtLgorICAgICAgLy8KKyAgICAgIC8vICBfX3IuX01fcHRyIG1heSBhbHJlYWR5IGhhdmUgYmVlbiBpbnZhbGlkYXRlZC4gVGhlIF9NX3B0cihfX3IuX01fcHRyKQorICAgICAgLy8gIGNvbnZlcnNpb24gbWF5IHJlcXVpcmUgYWNjZXNzIHRvICpfX3IuX01fcHRyICh2aXJ0dWFsIGluaGVyaXRhbmNlKS4KKyAgICAgIC8vCisgICAgICAvLyBJdCBpcyBub3QgcG9zc2libGUgdG8gYXZvaWQgc3B1cmlvdXMgYWNjZXNzIHZpb2xhd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fSAvLyBYWFggTVQKKworICAgICAgbG9uZworICAgICAgdXNlX2NvdW50KCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX3JlZmNvdW50Ll9NX2dldF91c2VfY291bnQoKTsgfQorCisgICAgICBib29sCisgICAgICBleHBpcmVkKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX3JlZmNvdW50Ll9NX2dldF91c2VfY291bnQoKSA9PSAwOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDE+CisJYm9vbAorCW93bmVyX2JlZm9yZShjb25zdCBfX3NoYXJlZF9wdHI8X1RwMSwgX0xwPiYgX19yaHMpIGNvbnN0CisJeyByZXR1cm4gX01fcmVmY291bnQuX01fbGVzcyhfX3Jocy5fTV9yZWZjb3VudCk7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwMT4KKwlib29sCisJb3duZXJfYmVmb3JlKGNvbnN0IF9fd2Vha19wdHI8X1RwMSwgX0xwPiYgX19yaHMpIGNvbnN0CisJeyByZXR1cm4gX01fcmVmY291bnQuX01fbGVzcyhfX3Jocy5fTV9yZWZjb3VudCk7IH0KKworICAgICAgdm9pZAorICAgICAgcmVzZXQoKSBub2V4Y2VwdAorICAgICAgeyBfX3dlYWtfcHRyKCkuc3dhcCgqdGhpcyk7IH0KKworICAgICAgdm9pZAorICAgICAgc3dhcChfX3dlYWtfcHRyJiBfX3MpIG5vZXhjZXB0CisgICAgICB7CisJc3RkOjpzd2FwKF9NX3B0ciwgX19zLl9NX3B0cik7CisJX01fcmVmY291bnQuX01fc3dhcChfX3MuX01fcmVmY291bnQpOworICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgIC8vIFVzZWQgYnkgX19lbmFibGVfc2hhcmVkX2Zyb21fdGhpcy4KKyAgICAgIHZvaWQKKyAgICAgIF9NX2Fzc2lnbihfVHAqIF9fcHRyLCBjb25zdCBfX3NoYXJlZF9jb3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YWx1ZVR5cGUgX190ID0gX0dMSUJDWFhfTU9WRSgqX19wKTsKKwkJICBfR0xJQkNYWF9NT1ZFMyhfX3AgKyAxLCBfX3AgKyBfX24sIF9fcCk7CisJCSAgKihfX3AgKyBfX24gLSAxKSA9IF9HTElCQ1hYX01PVkUoX190KTsKKwkJICByZXR1cm47CisJCX0KKwkgICAgICBfUmFuZG9tQWNjZXNzSXRlcmF0b3IgX19xID0gX19wICsgX19rOworCSAgICAgIGZvciAoX0Rpc3RhbmNlIF9faSA9IDA7IF9faSA8IF9fbiAtIF9fazsgKysgX19pKQorCQl7CisJCSAgc3RkOjppdGVyX3N3YXAoX19wLCBfX3EpOworCQkgICsrX19wOworCQkgICsrX19xOworCQl9CisJICAgICAgX19uICU9IF9fazsKKwkgICAgICBpZiAoX19uID09IDApCisJCXJldHVybjsKKwkgICAgICBzdGQ6OnN3YXAoX19uLCBfX2spOworCSAgICAgIF9fayA9IF9fbiAtIF9fazsKKwkgICAgfQorCSAgZWxzZQorCSAgICB7CisJICAgICAgX19rID0gX19uIC0gX19rOworCSAgICAgIGlmIChfX2lzX3BvZChfVmFsdWVUeXBlKSAmJiBfX2sgPT0gMSkKKwkJeworCQkgIF9WYWx1ZVR5cGUgX190ID0gX0dMSUJDWFhfTU9WRSgqKF9fcCArIF9fbiAtIDEpKTsKKwkJICBfR0xJQkNYWF9NT1ZFX0JBQ0tXQVJEMyhfX3AsIF9fcCArIF9fbiAtIDEsIF9fcCArIF9fbik7CisJCSAgKl9fcCA9IF9HTElCQ1hYX01PVkUoX190KTsKKwkJICByZXR1cm47CisJCX0KKwkgICAgICBfUmFuZG9tQWNjZXNzSXRlcmF0b3IgX19xID0gX19wICsgX19uOworCSAgICAgIF9fcCA9IF9fcSAtIF9fazsKKwkgICAgICBmb3IgKF9EaXN0YW5jZSBfX2kgPSAwOyBfX2kgPCBfX24gLSBfX2s7ICsrIF9faSkKKwkJeworCQkgIC0tX19wOworCQkgIC0tX19xOworCQkgIHN0ZDo6a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ICAgdHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPF9CaWRpcmVjdGlvbmFsSXRlcmF0b3I+Ojp2YWx1ZV90eXBlPikKKyAgICAgIF9fZ2xpYmN4eF9yZXF1aXJlc192YWxpZF9yYW5nZShfX2ZpcnN0LCBfX2xhc3QpOworCisgICAgICBpZiAoX19maXJzdCA9PSBfX2xhc3QpCisJcmV0dXJuIGZhbHNlOworICAgICAgX0JpZGlyZWN0aW9uYWxJdGVyYXRvciBfX2kgPSBfX2ZpcnN0OworICAgICAgKytfX2k7CisgICAgICBpZiAoX19pID09IF9fbGFzdCkKKwlyZXR1cm4gZmFsc2U7CisgICAgICBfX2kgPSBfX2xhc3Q7CisgICAgICAtLV9faTsKKworICAgICAgZm9yKDs7KQorCXsKKwkgIF9CaWRpcmVjdGlvbmFsSXRlcmF0b3IgX19paSA9IF9faTsKKwkgIC0tX19pOworCSAgaWYgKF9fY29tcCgqX19pLCAqX19paSkpCisJICAgIHsKKwkgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXJhdG9yIF9faiA9IF9fbGFzdDsKKwkgICAgICB3aGlsZSAoIWJvb2woX19jb21wKCpfX2ksICotLV9faikpKQorCQl7fQorCSAgICAgIHN0ZDo6aXRlcl9zd2FwKF9faSwgX19qKTsKKwkgICAgICBzdGQ6OnJldmVyc2UoX19paSwgX19sYXN0KTsKKwkgICAgICByZXR1cm4gdHJ1ZTsKKwkgICAgfQorCSAgaWYgKF9faSA9PSBfX2ZpcnN0KQorCSAgICB7CisJICAgICAgc3RkOjpyZXZlcnNlKF9fZmlyc3QsIF9fbGFzdCk7CisJICAgICAgcmV0dXJuIGZhbHNlOworCSAgICB9CisJfQorICAgIH0KKworICAvKioKKyAgICogIEBicmllZiAgUGVybXV0ZSByYW5nZSBpbnRvIHRoZSBwcmV2aW91cyBAZSBkaWN0aW9uYXJ5IG9yZGVyaW5nLgorICAgKiAgQGluZ3JvdXAgc29ydGluZ19hbGdvcml0aG1zCisgICAqICBAcGF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GFyYWJsZUNvbmNlcHQ8CisJICAgIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfQmlkaXJlY3Rpb25hbEl0ZXJhdG9yPjo6dmFsdWVfdHlwZT4pCisgICAgICBfX2dsaWJjeHhfcmVxdWlyZXNfdmFsaWRfcmFuZ2UoX19maXJzdCwgX19sYXN0KTsKKworICAgICAgaWYgKF9fZmlyc3QgPT0gX19sYXN0KQorCXJldHVybiBmYWxzZTsKKyAgICAgIF9CaWRpcmVjdGlvbmFsSXRlcmF0b3IgX19pID0gX19maXJzdDsKKyAgICAgICsrX19pOworICAgICAgaWYgKF9faSA9PSBfX2xhc3QpCisJcmV0dXJuIGZhbHNlOworICAgICAgX19pID0gX19sYXN0OworICAgICAgLS1fX2k7CisKKyAgICAgIGZvcig7OykKKwl7CisJICBfQmlkaXJlY3Rpb25hbEl0ZXJhdG9yIF9faWkgPSBfX2k7CisJICAtLV9faTsKKwkgIGlmICgqX19paSA8ICpfX2kpCisJICAgIHsKKwkgICAgICBfQmlkaXJlY3Rpb25hbEl0ZXJhdG9yIF9faiA9IF9fbGFzdDsKKwkgICAgICB3aGlsZSAoISgqLS1fX2ogPCAqX19pKSkKKwkJe30KKwkgICAgICBzdGQ6Oml0ZXJfc3dhcChfX2ksIF9faik7CisJICAgICAgc3RkOjpyZXZlcnNlKF9faWksIF9fbGFzdCk7CisJICAgICAgcmV0dXJuIHRydWU7CisJICAgIH0KKwkgIGlmIChfX2kgPT0gX19maXJzdCkKKwkgICAgeworCSAgICAgIHN0ZDo6cmV2ZXJzZShfX2ZpcnN0LCBfX2xhc3QpOworCSAgICAgIHJldHVybiBmYWxzZTsKKwkgICAgfQorCX0KKyAgICB9CisKKyAgLyoqCisgICAqICBAYnJpZWYgIFBlcm11dGUgcmFuZ2UgaW50byB0aGUgcHJldmlvdXMgQGUgZGljdGlvbmFyeSBvcmRlcmluZyB1c2luZworICAgKiAgICAgICAgICBjb21wYXJpc29uIGZ1bmN0b3IuCisgICAqICB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AgICAgIGlmICgqX19uZXh0IDwgKl9fZmlyc3QpCisJeworCSAgX19taW4gPSBfX25leHQ7CisJICBfX21heCA9IF9fZmlyc3Q7CisJfQorICAgICAgZWxzZQorCXsKKwkgIF9fbWluID0gX19maXJzdDsKKwkgIF9fbWF4ID0gX19uZXh0OworCX0KKworICAgICAgX19maXJzdCA9IF9fbmV4dDsKKyAgICAgICsrX19maXJzdDsKKworICAgICAgd2hpbGUgKF9fZmlyc3QgIT0gX19sYXN0KQorCXsKKwkgIF9fbmV4dCA9IF9fZmlyc3Q7CisJICBpZiAoKytfX25leHQgPT0gX19sYXN0KQorCSAgICB7CisJICAgICAgaWYgKCpfX2ZpcnN0IDwgKl9fbWluKQorCQlfX21pbiA9IF9fZmlyc3Q7CisJICAgICAgZWxzZSBpZiAoISgqX19maXJzdCA8ICpfX21heCkpCisJCV9fbWF4ID0gX19maXJzdDsKKwkgICAgICBicmVhazsKKwkgICAgfQorCisJICBpZiAoKl9fbmV4dCA8ICpfX2ZpcnN0KQorCSAgICB7CisJICAgICAgaWYgKCpfX25leHQgPCAqX19taW4pCisJCV9fbWluID0gX19uZXh0OworCSAgICAgIGlmICghKCpfX2ZpcnN0IDwgKl9fbWF4KSkKKwkJX19tYXggPSBfX2ZpcnN0OworCSAgICB9CisJICBlbHNlCisJICAgIHsKKwkgICAgICBpZiAoKl9fZmlyc3QgPCAqX19taW4pCisJCV9fbWluID0gX19maXJzdDsKKwkgICAgICBpZiAoISgqX19uZXh0IDwgKl9fbWF4KSkKKwkJX19tYXggPSBfX25leHQ7CisJICAgIH0KKworCSAgX19maXJzdCA9IF9fbmV4dDsKKwkgICsrX19maXJzdDsKKwl9CisKKyAgICAgIHJldHVybiBzdGQ6Om1ha2VfcGFpcihfX21pbiwgX19tYXgpOworICAgIH0KKworICAvKioKKyAgICogIEBicmllZiAgUmV0dXJuIGEgcGFpciBvZiBpdGVyYXRvcnMgcG9pbnRpbmcgdG8gdGhlIG1pbmltdW0gYW5kIG1heGltdW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24uICBJdCB3aWxsIHdvcmsgb24KKyAgICogIHRlbXBvcmFyeSBleHByZXNzaW9ucywgc2luY2UgdGhleSBhcmUgb25seSBldmFsdWF0ZWQgb25jZSwgdW5saWtlIGEKKyAgICogIHByZXByb2Nlc3NvciBtYWNyby4KKyAgKi8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb25zdCBfVHAmCisgICAgbWF4KGNvbnN0IF9UcCYgX19hLCBjb25zdCBfVHAmIF9fYikKKyAgICB7CisgICAgICAvLyBjb25jZXB0IHJlcXVpcmVtZW50cworICAgICAgX19nbGliY3h4X2Z1bmN0aW9uX3JlcXVpcmVzKF9MZXNzVGhhbkNvbXBhcmFibGVDb25jZXB0PF9UcD4pCisgICAgICAvL3JldHVybiAgX19hIDwgX19iID8gX19iIDogX19hOworICAgICAgaWYgKF9fYSA8IF9fYikKKwlyZXR1cm4gX19iOworICAgICAgcmV0dXJuIF9fYTsKKyAgICB9CisKKyAgLyoqCisgICAqICBAYnJpZWYgVGhpcyBkb2VzIHdoYXQgeW91IHRoaW5rIGl0IGRvZXMuCisgICAqICBAaW5ncm91cCBzb3J0aW5nX2FsZ29yaXRobXMKKyAgICogIEBwYXJhbSAgX19hICBBIHRoaW5nIG9mIGFyYml0cmFyeSB0eXBlLgorICAgKiAgQHBhcmFtICBfX2IgIEFub3RoZXIgdGhpbmcgb2YgYXJiaXRyYXJ5IHR5cGUuCisgICAqICBAcGFyYW0gIF9fY29tcCAgQSBAbGluayBjb21wYXJpc29uX2Z1bmN0b3JzIGNvbXBhcmlzb24gZnVuY3RvckBlbmRsaW5rLgorICAgKiAgQHJldHVybiAgIFRoZSBsZXNzZXIgb2YgdGhlIHBhcmFtZXRlcnMuCisgICAqCisgICAqICBUaGlzIHdpbGwgd29yayBvbiB0ZW1wb3JhcnkgZXhwcmVzc2lvbnMsIHNpbmNlIHRoZXkgYXJlIG9ubHkgZXZhbHVhdGVkCisgICAqICBvbmNlLCB1bmxpa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ZhbCkKKwkgICAgeworCSAgICAgIF9fZmlyc3QgPSBfX21pZGRsZTsKKwkgICAgICArK19fZmlyc3Q7CisJICAgICAgX19sZW4gPSBfX2xlbiAtIF9faGFsZiAtIDE7CisJICAgIH0KKwkgIGVsc2UKKwkgICAgX19sZW4gPSBfX2hhbGY7CisJfQorICAgICAgcmV0dXJuIF9fZmlyc3Q7CisgICAgfQorCisgIC8vLyBUaGlzIGlzIGEgaGVscGVyIGZ1bmN0aW9uIGZvciB0aGUgc29ydCByb3V0aW5lcyBhbmQgZm9yIHJhbmRvbS50Y2MuCisgIC8vICBQcmVjb25kaXRpb246IF9fbiA+IDAuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9TaXplPgorICAgIGlubGluZSBfU2l6ZQorICAgIF9fbGcoX1NpemUgX19uKQorICAgIHsKKyAgICAgIF9TaXplIF9fazsKKyAgICAgIGZvciAoX19rID0gMDsgX19uICE9IDA7IF9fbiA+Pj0gMSkKKwkrK19fazsKKyAgICAgIHJldHVybiBfX2sgLSAxOworICAgIH0KKworICBpbmxpbmUgaW50CisgIF9fbGcoaW50IF9fbikKKyAgeyByZXR1cm4gc2l6ZW9mKGludCkgKiBfX0NIQVJfQklUX18gIC0gMSAtIF9fYnVpbHRpbl9jbHooX19uKTsgfQorCisgIGlubGluZSB1bnNpZ25lZAorICBfX2xnKHVuc2lnbmVkIF9fbikKKyAgeyByZXR1cm4gc2l6ZW9mKGludCkgKiBfX0NIQVJfQklUX18gIC0gMSAtIF9fYnVpbHRpbl9jbHooX19uKTsgfQorCisgIGlubGluZSBsb25nCisgIF9fbGcobG9uZyBfX24pCisgIHsgcmV0dXJuIHNpemVvZihsb25nKSAqIF9fQ0hBUl9CSVRfXyAtIDEgLSBfX2J1aWx0aW5fY2x6bChfX24pOyB9CisKKyAgaW5saW5lIHVuc2lnbmVkIGxvbmcKKyAgX19sZyh1bnNpZ25lZCBsb25nIF9fbikKKyAgeyByZXR1cm4gc2l6ZW9mKGxvbmcpICogX19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6cmFuZG9tX2FjY2Vzc19pdGVyYXRvcl90YWcsIGJvb2w+CisgIHsKKyAgICBfQml0X3R5cGUgKiBfTV9wOworICAgIHVuc2lnbmVkIGludCBfTV9vZmZzZXQ7CisKKyAgICBfQml0X2l0ZXJhdG9yX2Jhc2UoX0JpdF90eXBlICogX194LCB1bnNpZ25lZCBpbnQgX195KQorICAgIDogX01fcChfX3gpLCBfTV9vZmZzZXQoX195KSB7IH0KKworICAgIHZvaWQKKyAgICBfTV9idW1wX3VwKCkKKyAgICB7CisgICAgICBpZiAoX01fb2Zmc2V0KysgPT0gaW50KF9TX3dvcmRfYml0KSAtIDEpCisJeworCSAgX01fb2Zmc2V0ID0gMDsKKwkgICsrX01fcDsKKwl9CisgICAgfQorCisgICAgdm9pZAorICAgIF9NX2J1bXBfZG93bigpCisgICAgeworICAgICAgaWYgKF9NX29mZnNldC0tID09IDApCisJeworCSAgX01fb2Zmc2V0ID0gaW50KF9TX3dvcmRfYml0KSAtIDE7CisJICAtLV9NX3A7CisJfQorICAgIH0KKworICAgIHZvaWQKKyAgICBfTV9pbmNyKHB0cmRpZmZfdCBfX2kpCisgICAgeworICAgICAgZGlmZmVyZW5jZV90eXBlIF9fbiA9IF9faSArIF9NX29mZnNldDsKKyAgICAgIF9NX3AgKz0gX19uIC8gaW50KF9TX3dvcmRfYml0KTsKKyAgICAgIF9fbiA9IF9fbiAlIGludChfU193b3JkX2JpdCk7CisgICAgICBpZiAoX19uIDwgMCkKKwl7CisJICBfX24gKz0gaW50KF9TX3dvcmRfYml0KTsKKwkgIC0tX01fcDsKKwl9CisgICAgICBfTV9vZmZzZXQgPSBzdGF0aWNfY2FzdDx1bnNpZ25lZCBpbnQ+KF9fbik7CisgICAgfQorCisgICAgYm9vbAorICAgIG9wZXJhdG9yPT0oY29uc3QgX0JpdF9pdGVyYXRvcl9iYXNlJiBfX2kpIGNvbnN0CisgICAgeyByZXR1cm4gX01fcCA9PSBfX2kuX01fcCAmJiBfTV9vZmZzZXQgPT0gX19pLl9NX29mZnNldDsgfQorCisgICAgYm9vbAorICAgIG9wZXJhdG9yPChjb25zdCBfQml0X2l0ZXJhdG9yX2Jhc2UmIF9faSkgY29uc3QKKyAgICB7CisgICAgICByZXR1cm4gX01fcCA8IF9faS5fTV9wCisJICAgICB8fCAoX01fcCA9PSBfX2kuX01fcCAmJiBfTV9vZmZzZXQgPCBfX2kuX01fb2Zmc2V0KTsKKyAgICB9CisKKyAgICBib29sCisgICAgb3BlcmF0b3IhPShjb25zdCBfQml0X2l0ZXJhdG9yX2Jhc2UmIF9faSkgY29uc3QKKyAgICB7IHJldHVybiAhKCp0aGlzID09IF9faSk7IH0KKworICAgIGJvb2wKKyAgICBvcGVyYXRvcj4oY29uc3QgX0JpdF9pdGVyYXRvcl9iYXNlJiBfX2kpIGNvbnN0CisgICAgeyByZXR1cm4gX19pIDwgKnRoaXM7IH0KKworICAgIGJvb2wKKyAgICBvcGVyYXRvcjw9KGNvbnN0IF9CaXRfaXRlcmF0b3JfYmFzZSYgX19pKSBjb25zdAorICAgIHsgcmV0dXJuICEoX19pIDwgKnRoaXMpOyB9CisKKyAgICBib29sCisgICAgb3BlcmF0b3I+PShjb25zdCBfQml0X2l0ZXJhdG9yX2Jhc2UmIF9faSkgY29uc3QKKyAgICB7IHJldHVybiAhKCp0aGlzIDwgX19pKTsgfQorICB9OworCisgIGlubGluZSBwdHJkaWZmX3QKKyAgb3BlcmF0b3ItKGNvbnN0IF9CaXRfaXRlcmF0b3JfYmFzZSYgX194LCBjb25zdCBfQml0X2l0ZXJhdG9yX2Jhc2UmIF9feSkKKyAgeworICAgIHJldHVybiAoaW50KF9TX3dvcmRfYml0KSAqIChfX3guX01fcCAtIF9feS5fTV9wKQorCSAgICArIF9feC5fTV9vZmZzZXQgLSBfX3kuX01fb2Zmc2V0KTsKKyAgfQorCisgIHN0cnVjdCBfQml0X2l0ZXJhdG9yIDogcHVibGljIF9CaXRfaXRlcmF0b3JfYmFzZQorICB7CisgICAgdHlwZWRlZiBfQml0X3JlZmVyZW5jZSAgcmVmZXJlbmNlOworICAgIHR5cGVkZWYgX0JpdF9yZWZlcmVuY2UqIHBvaW50ZXI7CisgICAgdHlwZWRlZiBfQml0X2l0ZXJhdG9yICAgaXRlcmF0b3I7CisKKyAgICBfQml0X2l0ZXJhdG9yKCkgOiBfQml0X2l0ZXJhdG9yX2Jhc2UoMCwgMCkgeyB9CisKKyAgICBfQml0X2l0ZXJhdG9yKF9CaXRfdHlwZSAqIF9feCwgdW5zaWduZWQgaW50IF9feSkKKyAgICA6IF9CaXRfaXRlcmF0b3JfYmFzZShfX3gsIF9feSkgeyB9CisKKyAgICByZWZlcmVuY2UKKyAgICBvcGVyYXRvciooKSBjb25zdAorICAgIHsgcmV0dXJuIHJlZmVyZW5jZShfTV9wLCAxVUwgPDwgX01fb2Zmc2V0KTsgfQorCisgICAgaXRlcmF0b3ImCisgICAgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgX01fYnVtcF91cCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGl0ZXJhdG9yCisgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgeworICAgICAgaXRlcmF0b3IgX190bXAgPSAqdGhpczsKKyAgICAgIF9NX2J1bXBfdXAoKTsKKyAgICAgIHJldHVybiBfX3RtcDsKKyAgICB9CisKKyAgICBpdGVyYXRvciYKKyAgICBvcGVyYXRvci0tKCkKKyAgICB7CisgICAgICBfTV9idW1wX2Rvd24oKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBpdGVyYXRvcgorICAgIG9wZXJhdG9yLS0oaW50KQorICAgIHsKKyAgICAgIGl0ZXJhdG9yIF9fdG1wID0gKnRoaXM7CisgICAgICBfTV9idW1wX2Rvd24oKTsKKyAgICAgIHJldHVybiBfX3RtcDsKKyAgICB9CisKKyAgICBpdGVyYXRvciYKKyAgICBvcGVyYXRvcis9KGRpZmZlcmVuY2VfdHlwZSBfX2kpCisgICAgeworICAgICAgX01faW5jcihfX2kpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGl0ZXJhdG9yJgorICAgIG9wZXJhdG9yLT0oZGlmZmVyZW5jZV90eXBlIF9faSkKKyAgICB7CisgICAgICAqdGhpcyArPSAtX19pOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGl0ZXJhdG9yCisgICAgb3BlcmF0b3IrKGRpZmZlcmVuY2VfdHlwZSBfX2kpIGNvbnN0CisgICAgeworICAgICAgaXRlcmF0b3IgX190bXAgPSAqdGhpczsKKyAgICAgIHJldHVybiBfX3RtcCArPSBfX2k7CisgICAgfQorCisgICAgaXRlcmF0b3IKKyAgICBvcGVyYXRvci0oZGlmZmVyZW5jZV90eXBlIF9faSkgY29uc3QKKyAgICB7CisgICAgICBpdGVyYXRvciBfX3RtcCA9ICp0aGlzOworICAgICAgcmV0dXJuIF9fdG1wIC09IF9faTsKKyAgICB9CisKKyAgICByZWZlcmVuY2UKKyAgICBvcGVyYXRvcltdKGRpZmZlcmVuY2VfdHlwZSBfX2kpIGNvbnN0CisgICAgeyByZXR1cm4gKigqdGhpcyArIF9faSk7IH0KKyAgfTsKKworICBpbmxpbmUgX0JpdF9pdGVyYXRvcgorICBvcGVyYXRvcisocHRyZGlmZl90IF9fbiwgY29uc3QgX0JpdF9pdGVyYXRvciYgX194KQorICB7IHJldHVybiBfX3ggKyBfX247IH0KKworICBzdHJ1Y3QgX0JpdF9jb25zdF9pdGVyYXRvciA6IHB1YmxpYyBfQml0X2l0ZXJhdG9yX2Jhc2UKKyAgeworICAgIHR5cGVkZWYgYm9vbCAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgIHR5cGVkZWYgYm9vbCAgICAgICAgICAgICAgICAgY29uc3RfcmVmZXJlbmNlOworICAgIHR5cGVkZWYgY29uc3QgYm9vbCogICAgICAgICAgcG9pbnRlcjsKKyAgICB0eXBlZGVmIF9CaXRfY29uc3RfaXRlcmF0b3IgIGNvbnN0X2l0ZXJhdG9yOworCisgICAgX0JpdF9jb25zdF9pdGVyYXRvcigpIDogX0JpdF9pdGVyYXRvcl9iYXNlKDAsIDApIHsgfQorCisgICAgX0JpdF9jb25zdF9pdGVyYXRvcihfQml0X3R5cGUgKiBfX3gsIHVuc2lnbmVkIGludCBfX3kpCisgICAgOiBfQml0X2l0ZXJhdG9yX2Jhc2UoX194LCBfX3kpIHsgfQorCisgICAgX0JpdF9jb25zdF9pdGVyYXRvcihjb25zdCBfQml0X2l0ZXJhdG9yJiBfX3gpCisgICAgOiBfQml0X2l0ZXJhdG9yX2Jhc2UoX194Ll9NX3AsIF9feC5fTV9vZmZzZXQpIHsgfQorCisgICAgY29uc3RfcmVmZXJlbmNlCisgICAgb3BlcmF0b3IqKCkgY29uc3QKKyAgICB7IHJldHVybiBfQml0X3JlZmVyZW5jZShfTV9wLCAxVUwgPDwgX01fb2Zmc2V0KTsgfQorCisgICAgY29uc3RfaXRlcmF0b3ImCisgICAgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgX01fYnVtcF91cCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgeworICAgICAgY29uc3RfaXRlcmF0b3IgX190bXAgPSAqdGhpczsKKyAgICAgIF9NX2J1bXBfdXAoKTsKKyAgICAgIHJldHVybiBfX3RtcDsKKyAgICB9CisKKyAgICBjb25zdF9pdGVyYXRvciYKKyAgICBvcGVyYXRvci0tKCkKKyAgICB7CisgICAgICBfTV9idW1wX2Rvd24oKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBjb25zdF9pdGVyYXRvcgorICAgIG9wZXJhdG9yLS0oaW50KQorICAgIHsKKyAgICAgIGNvbnN0X2l0ZXJhdG9yIF9fdG1wID0gKnRoaXM7CisgICAgICBfTV9idW1wX2Rvd24oKTsKKyAgICAgIHJldHVybiBfX3RtcDsKKyAgICB9CisKKyAgICBjb25zdF9pdGVyYXRvciYKKyAgICBvcGVyYXRvcis9KGRpZmZlcmVuY2VfdHlwZSBfX2kpCisgICAgeworICAgICAgX01faW5jcihfX2kpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGNvbnN0X2l0ZXJhdG9yJgorICAgIG9wZXJhdG9yLT0oZGlmZmVyZW5jZV90eXBlIF9faSkKKyAgICB7CisgICAgICAqdGhpcyArPSAtX19pOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGNvbnN0X2l0ZXJhdG9yIAorICAgIG9wZXJhdG9yKyhkaWZmZXJlbmNlX3R5cGUgX19pKSBjb25zdAorICAgIHsKKyAgICAgIGNvbnN0X2l0ZXJhdG9yIF9fdG1wID0gKnRoaXM7CisgICAgICByZXR1cm4gX190bXAgKz0gX19pOworICAgIH0KKworICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgb3BlcmF0b3ItKGRpZmZlcmVuY2VfdHlwZSBfX2kpIGNvbnN0CisgICAgeworICAgICAgY29uc3RfaXRlcmF0b3IgX190bXAgPSAqdGhpczsKKyAgICAgIHJldHVybiBfX3RtcCAtPSBfX2k7CisgICAgfQorCisgICAgY29uc3RfcmVmZXJlbmNlCisgICAgb3BlcmF0b3JbXShkaWZmZXJlbmNlX3R5cGUgX19pKSBjb25zdAorICAgIHsgcmV0dXJuICooKnRoaXMgKyBfX2kpOyB9CisgIH07CisKKyAgaW5saW5lIF9CaXRfY29uc3RfaXRlcmF0b3IKKyAgb3BlcmF0b3IrKHB0cmRpZmZfdCBfX24sIGNvbnN0IF9CaXRfY29uc3RfaXRlcmF0b3ImIF9feCkKKyAgeyByZXR1cm4gX194ICsgX19uOyB9CisKKyAgaW5saW5lIHZvaWQKKyAgX19maWxsX2J2ZWN0b3IoX0JpdF9pdGVyYXRvciBfX2ZpcnN0LCBfQml0X2l0ZXJhdG9yIF9fbGFzdCwgYm9vbCBfX3gpCisgIHsKKyAgICBmb3IgKDsgX19maXJzd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WYgc2l6ZV90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90eXBlOworICAgIHR5cGVkZWYgcHRyZGlmZl90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgIHR5cGVkZWYgX0JpdF9yZWZlcmVuY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgIHR5cGVkZWYgYm9vbCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RfcmVmZXJlbmNlOworICAgIHR5cGVkZWYgX0JpdF9yZWZlcmVuY2UqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICB0eXBlZGVmIGNvbnN0IGJvb2wqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0X3BvaW50ZXI7CisgICAgdHlwZWRlZiBfQml0X2l0ZXJhdG9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcjsKKyAgICB0eXBlZGVmIF9CaXRfY29uc3RfaXRlcmF0b3IgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0X2l0ZXJhdG9yOworICAgIHR5cGVkZWYgc3RkOjpyZXZlcnNlX2l0ZXJhdG9yPGNvbnN0X2l0ZXJhdG9yPiAgICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcjsKKyAgICB0eXBlZGVmIHN0ZDo6cmV2ZXJzZV9pdGVyYXRvcjxpdGVyYXRvcj4gICAgICAgICAgICAgIHJldmVyc2VfaXRlcmF0b3I7CisgICAgdHlwZWRlZiBfQWxsb2MgICAgICAgICAgICAgICAgICAgICAgICAJCSBhbGxvY2F0b3JfdHlwZTsKKworICAgIGFsbG9jYXRvcl90eXBlIGdldF9hbGxvY2F0b3IoKSBjb25zdAorICAgIHsgcmV0dXJuIF9CYXNlOjpnZXRfYWxsb2NhdG9yKCk7IH0KKworIC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DRVBUCisgICAgeyByZXR1cm4gc2l6ZV90eXBlKGVuZCgpIC0gYmVnaW4oKSk7IH0KKworICAgIHNpemVfdHlwZQorICAgIG1heF9zaXplKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICB7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19pc2l6ZSA9CisJX19nbnVfY3h4OjpfX251bWVyaWNfdHJhaXRzPGRpZmZlcmVuY2VfdHlwZT46Ol9fbWF4CisJLSBpbnQoX1Nfd29yZF9iaXQpICsgMTsKKyAgICAgIGNvbnN0IHNpemVfdHlwZSBfX2FzaXplID0gX01fZ2V0X0JpdF9hbGxvY2F0b3IoKS5tYXhfc2l6ZSgpOworICAgICAgcmV0dXJuIChfX2FzaXplIDw9IF9faXNpemUgLyBpbnQoX1Nfd29yZF9iaXQpCisJICAgICAgPyBfX2FzaXplICogaW50KF9TX3dvcmRfYml0KSA6IF9faXNpemUpOworICAgIH0KKworICAgIHNpemVfdHlwZQorICAgIGNhcGFjaXR5KCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICB7IHJldHVybiBzaXplX3R5cGUoY29uc3RfaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9lbmRfb2Zfc3RvcmFnZSwgMCkKKwkJICAgICAgIC0gYmVnaW4oKSk7IH0KKworICAgIGJvb2wKKyAgICBlbXB0eSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgeyByZXR1cm4gYmVnaW4oKSA9PSBlbmQoKTsgfQorCisgICAgcmVmZXJlbmNlCisgICAgb3BlcmF0b3JbXShzaXplX3R5cGUgX19uKQorICAgIHsKKyAgICAgIHJldHVybiAqaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9zdGFydC5fTV9wCisJCSAgICAgICArIF9fbiAvIGludChfU193b3JkX2JpdCksIF9fbiAlIGludChfU193b3JkX2JpdCkpOworICAgIH0KKworICAgIGNvbnN0X3JlZmVyZW5jZQorICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICB7CisgICAgICByZXR1cm4gKmNvbnN0X2l0ZXJhdG9yKHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fcAorCQkJICAgICArIF9fbiAvIGludChfU193b3JkX2JpdCksIF9fbiAlIGludChfU193b3JkX2JpdCkpOworICAgIH0KKworICBwcm90ZWN0ZWQ6CisgICAgdm9pZAorICAgIF9NX3JhbmdlX2NoZWNrKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgeworICAgICAgaWYgKF9fbiA+PSB0aGlzLT5zaXplKCkpCisgICAgICAgIF9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigidmVjdG9yPGJvb2w+OjpfTV9yYW5nZV9jaGVjayIpKTsKKyAgICB9CisKKyAgcHVibGljOgorICAgIHJlZmVyZW5jZQorICAgIGF0KHNpemVfdHlwZSBfX24pCisgICAgeyBfTV9yYW5nZV9jaGVjayhfX24pOyByZXR1cm4gKCp0aGlzKVtfX25dOyB9CisKKyAgICBjb25zdF9yZWZlcmVuY2UKKyAgICBhdChzaXplX3R5cGUgX19uKSBjb25zdAorICAgIHsgX01fcmFuZ2VfY2hlY2soX19uKTsgcmV0dXJuICgqdGhpcylbX19uXTsgfQorCisgICAgdm9pZAorICAgIHJlc2VydmUoc2l6ZV90eXBlIF9fbikKKyAgICB7CisgICAgICBpZiAoX19uID4gbWF4X3NpemUoKSkKKwlfX3Rocm93X2xlbmd0aF9lcnJvcihfX04oInZlY3Rvcjo6cmVzZXJ2ZSIpKTsKKyAgICAgIGlmIChjYXBhY2l0eSgpIDwgX19uKQorCV9NX3JlYWxsb2NhdGUoX19uKTsKKyAgICB9CisKKyAgICByZWZlcmVuY2UKKyAgICBmcm9udCgpCisgICAgeyByZXR1cm4gKmJlZ2luKCk7IH0KKworICAgIGNvbnN0X3JlZmVyZW5jZQorICAgIGZyb250KCkgY29uc3QKKyAgICB7IHJldHVybiAqYmVnaW4oKTsgfQorCisgICAgcmVmZXJ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F9fcG9zaXRpb24gKyAxLCBlbmQoKSwgX19wb3NpdGlvbik7CisgICAgICAtLXRoaXMtPl9NX2ltcGwuX01fZmluaXNoOworICAgICAgcmV0dXJuIF9fcG9zaXRpb247CisgICAgfQorCisgICAgaXRlcmF0b3IKKyAgICBlcmFzZShpdGVyYXRvciBfX2ZpcnN0LCBpdGVyYXRvciBfX2xhc3QpCisgICAgeworICAgICAgaWYgKF9fZmlyc3QgIT0gX19sYXN0KQorCV9NX2VyYXNlX2F0X2VuZChzdGQ6OmNvcHkoX19sYXN0LCBlbmQoKSwgX19maXJzdCkpOworICAgICAgcmV0dXJuIF9fZmlyc3Q7CisgICAgfQorCisgICAgdm9pZAorICAgIHJlc2l6ZShzaXplX3R5cGUgX19uZXdfc2l6ZSwgYm9vbCBfX3ggPSBib29sKCkpCisgICAgeworICAgICAgaWYgKF9fbmV3X3NpemUgPCBzaXplKCkpCisgICAgICAgIF9NX2VyYXNlX2F0X2VuZChiZWdpbigpICsgZGlmZmVyZW5jZV90eXBlKF9fbmV3X3NpemUpKTsKKyAgICAgIGVsc2UKKyAgICAgICAgaW5zZXJ0KGVuZCgpLCBfX25ld19zaXplIC0gc2l6ZSgpLCBfX3gpOworICAgIH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgdm9pZAorICAgIHNocmlua190b19maXQoKQorICAgIHsgX01fc2hyaW5rX3RvX2ZpdCgpOyB9CisjZW5kaWYKKworICAgIHZvaWQKKyAgICBmbGlwKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICB7CisgICAgICBmb3IgKF9CaXRfdHlwZSAqIF9fcCA9IHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fcDsKKwkgICBfX3AgIT0gdGhpcy0+X01faW1wbC5fTV9lbmRfb2Zfc3RvcmFnZTsgKytfX3ApCisgICAgICAgICpfX3AgPSB+Kl9fcDsKKyAgICB9CisKKyAgICB2b2lkCisgICAgY2xlYXIoKSBfR0x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1lIF9UcCwgdHlwZW5hbWUgX1JlZiwgdHlwZW5hbWUgX1B0cj4KKyAgICBzdHJ1Y3QgX0RlcXVlX2l0ZXJhdG9yCisgICAgeworICAgICAgdHlwZWRlZiBfRGVxdWVfaXRlcmF0b3I8X1RwLCBfVHAmLCBfVHAqPiAgICAgICAgICAgICBpdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgX0RlcXVlX2l0ZXJhdG9yPF9UcCwgY29uc3QgX1RwJiwgY29uc3QgX1RwKj4gY29uc3RfaXRlcmF0b3I7CisKKyAgICAgIHN0YXRpYyBzaXplX3QgX1NfYnVmZmVyX3NpemUoKQorICAgICAgeyByZXR1cm4gX19kZXF1ZV9idWZfc2l6ZShzaXplb2YoX1RwKSk7IH0KKworICAgICAgdHlwZWRlZiBzdGQ6OnJhbmRvbV9hY2Nlc3NfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiBfVHAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIF9QdHIgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgX1JlZiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIHNpemVfdCAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgX1RwKiogICAgICAgICAgICAgICAgICAgICAgICAgICBfTWFwX3BvaW50ZXI7CisgICAgICB0eXBlZGVmIF9EZXF1ZV9pdGVyYXRvciAgICAgICAgICAgICAgICAgX1NlbGY7CisKKyAgICAgIF9UcCogX01fY3VyOworICAgICAgX1RwKiBfTV9maXJzdDsKKyAgICAgIF9UcCogX01fbGFzdDsKKyAgICAgIF9NYXBfcG9pbnRlciBfTV9ub2RlOworCisgICAgICBfRGVxdWVfaXRlcmF0b3IoX1RwKiBfX3gsIF9NYXBfcG9pbnRlciBfX3kpCisgICAgICA6IF9NX2N1cihfX3gpLCBfTV9maXJzdCgqX195KSwKKyAgICAgICAgX01fbGFzdCgqX195ICsgX1NfYnVmZmVyX3NpemUoKSksIF9NX25vZGUoX195KSB7IH0KKworICAgICAgX0RlcXVlX2l0ZXJhdG9yKCkKKyAgICAgIDogX01fY3VyKDApLCBfTV9maXJzdCgwKSwgX01fbGFzdCgwKSwgX01fbm9kZSgwKSB7IH0KKworICAgICAgX0RlcXVlX2l0ZXJhdG9yKGNvbnN0IGl0ZXJhdG9yJiBfX3gpCisgICAgICA6IF9NX2N1cihfX3guX01fY3VyKSwgX01fZmlyc3QoX194Ll9NX2ZpcnN0KSwKKyAgICAgICAgX01fbGFzdChfX3guX01fbGFzdCksIF9NX25vZGUoX194Ll9NX25vZGUpIHsgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiAqX01fY3VyOyB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fY3VyOyB9CisKKyAgICAgIF9TZWxmJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7CisJKytfTV9jdXI7CisJaWYgKF9NX2N1ciA9PSBfTV9sYXN0KQorCSAgeworCSAgICBfTV9zZXRfbm9kZShfTV9ub2RlICsgMSk7CisJICAgIF9NX2N1ciA9IF9NX2ZpcnN0OworCSAgfQorCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NlbGYKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworCV9TZWxmIF9fdG1wID0gKnRoaXM7CisJKysqdGhpczsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIF9TZWxmJgorICAgIC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KKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvcisoZGlmZmVyZW5jZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCXJldHVybiBfX3RtcCArPSBfX247CisgICAgICB9CisKKyAgICAgIF9TZWxmJgorICAgICAgb3BlcmF0b3ItPShkaWZmZXJlbmNlX3R5cGUgX19uKQorICAgICAgeyByZXR1cm4gKnRoaXMgKz0gLV9fbjsgfQorCisgICAgICBfU2VsZgorICAgICAgb3BlcmF0b3ItKGRpZmZlcmVuY2VfdHlwZSBfX24pIGNvbnN0CisgICAgICB7CisJX1NlbGYgX190bXAgPSAqdGhpczsKKwlyZXR1cm4gX190bXAgLT0gX19uOworICAgICAgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oZGlmZmVyZW5jZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuICooKnRoaXMgKyBfX24pOyB9CisKKyAgICAgIC8qKiAKKyAgICAgICAqICBQcmVwYXJlcyB0byB0cmF2ZXJzZSBuZXdfbm9kZS4gIFNldHMgZXZlcnl0aGluZyBleGNlcHQKKyAgICAgICAqICBfTV9jdXIsIHdoaWNoIHNob3VsZCB0aGVyZWZvcmUgYmUgc2V0IGJ5IHRoZSBjYWxsZXIKKyAgICAgICAqICBpbW1lZGlhdGVseSBhZnRlcndhcmRzLCBiYXNlZCBvbiBfTV9maXJzdCBhbmQgX01fbGFzdC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgX01fc2V0X25vZGUoX01hcF9wb2ludGVyIF9fbmV3X25vZGUpCisgICAgICB7CisJX01fbm9kZSA9IF9fbmV3X25vZGU7CisJX01fZmlyc3QgPSAqX19uZXdfbm9kZTsKKwlfTV9sYXN0ID0gX01fZmlyc3QgKyBkaWZmZXJlbmNlX3R5cGUoX1NfYnVmZmVyX3NpemUoKSk7CisgIC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JldHVybiBfTV9pbXBsLl9UcF9hbGxvY190eXBlOjphbGxvY2F0ZShfX2RlcXVlX2J1Zl9zaXplKHNpemVvZihfVHApKSk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RlYWxsb2NhdGVfbm9kZShfVHAqIF9fcCkKKyAgICAgIHsKKwlfTV9pbXBsLl9UcF9hbGxvY190eXBlOjpkZWFsbG9jYXRlKF9fcCwgX19kZXF1ZV9idWZfc2l6ZShzaXplb2YoX1RwKSkpOworICAgICAgfQorCisgICAgICBfVHAqKgorICAgICAgX01fYWxsb2NhdGVfbWFwKHNpemVfdCBfX24pCisgICAgICB7IHJldHVybiBfTV9nZXRfbWFwX2FsbG9jYXRvcigpLmFsbG9jYXRlKF9fbik7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZGVhbGxvY2F0ZV9tYXAoX1RwKiogX19wLCBzaXplX3QgX19uKQorICAgICAgeyBfTV9nZXRfbWFwX2FsbG9jYXRvcigpLmRlYWxsb2NhdGUoX19wLCBfX24pOyB9CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICB2b2lkIF9NX2luaXRpYWxpemVfbWFwKHNpemVfdCk7CisgICAgICB2b2lkIF9NX2NyZWF0ZV9ub2RlcyhfVHAqKiBfX25zdGFydCwgX1RwKiogX19uZmluaXNoKTsKKyAgICAgIHZvaWQgX01fZGVzdHJveV9ub2RlcyhfVHAqKiBfX25zdGFydCwgX1RwKiogX19uZmluaXNoKTsKKyAgICAgIGVudW0geyBfU19pbml0aWFsX21hcF9zaXplID0gOCB9OworCisgICAgICBfRGVxdWVfaW1wbCBfTV9pbXBsOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgX0RlcXVlX2Jhc2U8X1RwLCBfQWxsb2M+OjoKKyAgICB+X0RlcXVlX2Jhc2UoKQorICAgIHsKKyAgICAgIGlmICh0aGlzLT5fTV9pbXBsLl9NX21hcCkKKwl7CisJICBfTV9kZXN0cm95X25vZGVzKHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fbm9kZSwKKwkJCSAgIHRoaXMtPl9NX2ltcGwuX01fZmluaXNoLl9NX25vZGUgKyAxKTsKKwkgIF9NX2RlYWxsb2NhdGVfbWFwKHRoaXMtPl9NX2ltcGwuX01fbWFwLCB0aGlzLT5fTV9pbXBsLl9NX21hcF9zaXplKTsKKwl9CisgICAgfQorCisgIC8qKgorICAgKiAgQGJyaWVmIExheW91dCBzdG9yYWdlLgorICAgKiAgQHBhcmFtICBfX251bV9lbGVtZW50cyAgVGhlIGNvdW50IG9mIFQncyBmb3Igd2hpY2ggdG8gYWxsb2NhdGUgc3BhY2UKKyAgICogICAgICAgICAgICAgICAgICAgICAgICBhdCBmaXJzdC4KKyAgICogIEByZXR1cm4gICBOb3RoaW5nLgorICAgKgorICAgKiAgVGhlIGluaXRpYWwgdW5kZXJseWluZyBtZW1vcnkgbGF5b3V0IGlzIGEgYml0IGNvbXBsaWNhdGVkLi4uCisgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBfRGVxdWVfYmFzZTxfVHAsIF9BbGxvYz46OgorICAgIF9NX2luaXRpYWxpemVfbWFwKHNpemVfdCBfX251bV9lbGVtZW50cykKKyAgICB7CisgICAgICBjb25zdCBzaXplX3QgX19udW1fbm9kZXMgPSAoX19udW1fZWxlbWVudHMvIF9fZGVxdWVfYnVmX3NpemUoc2l6ZW9mKF9UcCkpCisJCQkJICArIDEpOworCisgICAgICB0aGlzLT5fTV9pbXBsLl9NX21hcF9zaXplID0gc3RkOjptYXgoKHNpemVfdCkgX1NfaW5pdGlhbF9tYXBfc2l6ZSwKKwkJCQkJICAgc2l6ZV90KF9fbnVtX25vZGVzICsgMikpOworICAgICAgdGhpcy0+X01faW1wbC5fTV9tYXAgPSBfTV9hbGxvY2F0ZV9tYXAodGhpcy0+X01faW1w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dXIgPSBfTV9pbXBsLl9NX3N0YXJ0Ll9NX2ZpcnN0OworICAgICAgdGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fY3VyID0gKHRoaXMtPl9NX2ltcGwuX01fZmluaXNoLl9NX2ZpcnN0CisJCQkJCSsgX19udW1fZWxlbWVudHMKKwkJCQkJJSBfX2RlcXVlX2J1Zl9zaXplKHNpemVvZihfVHApKSk7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBfRGVxdWVfYmFzZTxfVHAsIF9BbGxvYz46OgorICAgIF9NX2NyZWF0ZV9ub2RlcyhfVHAqKiBfX25zdGFydCwgX1RwKiogX19uZmluaXNoKQorICAgIHsKKyAgICAgIF9UcCoqIF9fY3VyOworICAgICAgX190cnkKKwl7CisJICBmb3IgKF9fY3VyID0gX19uc3RhcnQ7IF9fY3VyIDwgX19uZmluaXNoOyArK19fY3VyKQorCSAgICAqX19jdXIgPSB0aGlzLT5fTV9hbGxvY2F0ZV9ub2RlKCk7CisJfQorICAgICAgX19jYXRjaCguLi4pCisJeworCSAgX01fZGVzdHJveV9ub2RlcyhfX25zdGFydCwgX19jdXIpOworCSAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJfQorICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9BbGxvYz4KKyAgICB2b2lkCisgICAgX0RlcXVlX2Jhc2U8X1RwLCBfQWxsb2M+OjoKKyAgICBfTV9kZXN0cm95X25vZGVzKF9UcCoqIF9fbnN0YXJ0LCBfVHAqKiBfX25maW5pc2gpCisgICAgeworICAgICAgZm9yIChfVHAqKiBfX24gPSBfX25zdGFydDsgX19uIDwgX19uZmluaXNoOyArK19fbikKKwlfTV9kZWFsbG9jYXRlX25vZGUoKl9fbik7CisgICAgfQorCisgIC8qKgorICAgKiAgQGJyaWVmICBBIHN0YW5kYXJkIGNvbnRh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KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICVkZXF1ZSB3aXRoIG5vIGVsZW1lbnRzLgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3Igb2JqZWN0LgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgZGVxdWUoY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSkKKyAgICAgIDogX0Jhc2UoX19hLCAwKSB7IH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENyZWF0ZXMgYSAlZGVxdWUgd2l0aCBkZWZhdWx0IGNvbnN0cnVjdGVkIGVsZW1lbnRzLgorICAgICAgICogIEBwYXJhbSAgX19uICBUaGUgbnVtYmVyIG9mIGVsZW1lbnRzIHRvIGluaXRpYWxseSBjcmVhdGUuCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgZmlsbHMgdGhlICVkZXF1ZSB3aXRoIEBhIG4gZGVmYXVsdAorICAgICAgICogIGNvbnN0cnVjdGVkIGVsZW1lbnRzLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgZGVxdWUoc2l6ZV90eXBlIF9fbikKKyAgICAgIDogX0Jhc2UoX19uKQorICAgICAgeyBfTV9kZWZhdWx0X2luaXRpYWxpemUoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENyZWF0ZXMgYSAlZGVxdWUgd2l0aCBjb3BpZXMgb2YgYW4gZXhlbXBsYXIgZWxlbWVudC4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgVGhlIG51bWJlciBvZiBlbGVtZW50cyB0byBpbml0aWFsbHkgY3JlYXRlLgorICAgICAgICogIEBwYXJhbSAgX192YWx1ZSAgQW4gZWxlbWVudCB0byBjb3B5LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3IuCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgZmlsbHMgdGhlICVkZXF1ZSB3aXRoIEBhIF9fbiBjb3BpZXMgb2YgQGEgX192YWx1ZS4KKyAgICAgICAqLworICAgICAgZGVxdWUoc2l6ZV90eXBlIF9fbiwgY29uc3QgdmFsdWVfdHlwZSYgX192YWx1ZSwKKwkgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fYSwgX19uKQorICAgICAgeyBfTV9maWxsX2luaXRpYWxpemUoX192YWx1ZSk7IH0KKyNlbHNlCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENyZWF0ZXMgYSAlZGVxdWUgd2l0aCBjb3BpZXMgb2YgYW4gZXhlbXBsYXIgZWxlbWVudC4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgVGhlIG51bWJlciBvZiBlbGVtZW50cyB0byBpbml0aWFsbHkgY3JlYXRlLgorICAgICAgICogIEBwYXJhbSAgX192YWx1ZSAgQW4gZWxlbWVudCB0byBjb3B5LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3IuCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgZmlsbHMgdGhlICVkZXF1ZSB3aXRoIEBhIF9fbiBjb3BpZXMgb2YgQGEgX192YWx1ZS4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGRlcXVlKHNpemVfdHlwZSBfX24sIGNvbnN0IHZhbHVlX3R5cGUmIF9fdmFsdWUgPSB2YWx1ZV90eXBlKCksCisJICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2EsIF9fbikKKyAgICAgIHsgX01fZmlsbF9pbml0aWFsaXplKF9fdmFsdWUpOyB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiAgQGJ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i8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiB0aGlzLT5fTV9pbXBsLl9NX3N0YXJ0OyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IGluIHRoZSAlZGVxdWUuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBvcmRpbmFyeSBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgYmVnaW4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faW1wbC5fTV9zdGFydDsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVkZXF1ZS4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIG9yZGluYXJ5CisgICAgICAgKiAgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiB0aGlzLT5fTV9pbXBsLl9NX2ZpbmlzaDsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgaXRlcmF0b3IgdGhhdCBwb2ludHMgb25lIHBhc3QKKyAgICAgICAqICB0aGUgbGFzdCBlbGVtZW50IGluIHRoZSAlZGVxdWUuICBJdGVyYXRpb24gaXMgZG9uZSBpbgorICAgICAgICogIG9yZGluYXJ5IGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faW1wbC5fTV9maW5pc2g7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUKKyAgICAgICAqICBsYXN0IGVsZW1lbnQgaW4gdGhlICVkZXF1ZS4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIHJldmVyc2UKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gcmV2ZXJzZV9pdGVyYXRvcih0aGlzLT5fTV9pbXBsLl9NX2ZpbmlzaCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMKKyAgICAgICAqICB0byB0aGUgbGFzdCBlbGVtZW50IGluIHRoZSAlZGVxdWUuICBJdGVyYXRpb24gaXMgZG9uZSBpbgorICAgICAgICogIHJldmVyc2UgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmJlZ2luKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9maW5pc2gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gb25lCisgICAgICAgKiAgYmVmb3JlIHRoZSBmaXJzdC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bGVtZW50cy4gIElmIHRoZSBudW1iZXIgaXMgc21hbGxlciB0aGFuIHRoZQorICAgICAgICogICVkZXF1ZSdzIGN1cnJlbnQgc2l6ZSB0aGUgJWRlcXVlIGlzIHRydW5jYXRlZCwgb3RoZXJ3aXNlIHRoZQorICAgICAgICogICVkZXF1ZSBpcyBleHRlbmRlZCBhbmQgbmV3IGVsZW1lbnRzIGFyZSBwb3B1bGF0ZWQgd2l0aCBnaXZlbgorICAgICAgICogIGRhdGEuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19uZXdfc2l6ZSwgdmFsdWVfdHlwZSBfX3ggPSB2YWx1ZV90eXBlKCkpCisgICAgICB7CisJY29uc3Qgc2l6ZV90eXBlIF9fbGVuID0gc2l6ZSgpOworCWlmIChfX25ld19zaXplID4gX19sZW4pCisJICBpbnNlcnQodGhpcy0+X01faW1wbC5fTV9maW5pc2gsIF9fbmV3X3NpemUgLSBfX2xlbiwgX194KTsKKwllbHNlIGlmIChfX25ld19zaXplIDwgX19sZW4pCisJICBfTV9lcmFzZV9hdF9lbmQodGhpcy0+X01faW1wbC5fTV9zdGFydAorCQkJICArIGRpZmZlcmVuY2VfdHlwZShfX25ld19zaXplKSk7CisgICAgICB9CisjZW5kaWYKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKiogIEEgbm9uLWJpbmRpbmcgcmVxdWVzdCB0byByZWR1Y2UgbWVtb3J5IHVzZS4gICovCisgICAgICB2b2lkCisgICAgICBzaHJpbmtfdG9fZml0KCkKKyAgICAgIHsgX01fc2hyaW5rX3RvX2ZpdCgpOyB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyB0cnVlIGlmIHRoZSAlZGVxdWUgaXMgZW1wdHkuICAoVGh1cyBiZWdpbigpIHdvdWxkCisgICAgICAgKiAgZXF1YWwgZW5kKCkuKQorICAgICAgICovCisgICA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gICAgICogIFRoaXMgZnVuY3Rpb24gcHJvdmlkZXMgZm9yIHNhZmVyIGRhdGEgYWNjZXNzLiAgVGhlIHBhcmFtZXRlciBpcyBmaXJzdAorICAgICAgICogIGNoZWNrZWQgdGhhdCBpdCBpcyBpbiB0aGUgcmFuZ2Ugb2YgdGhlIGRlcXVlLiAgVGhlIGZ1bmN0aW9uIHRocm93cworICAgICAgICogIG91dF9vZl9yYW5nZSBpZiB0aGUgY2hlY2sgZmFpbHMuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgYXQoc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsKKwlfTV9yYW5nZV9jaGVjayhfX24pOworCXJldHVybiAoKnRoaXMpW19fbl07CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlZGVxdWUuCisgICAgICAgKi8KKyAgICAgIHJlZmVyZW5jZQorICAgICAgZnJvbnQoKQorICAgICAgeyByZXR1cm4gKmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlZGVxdWUuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgZnJvbnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gKmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBsYXN0IGVsZW1lbnQgb2YgdGhlCisgICAgICAgKiAgJWRlcXVlLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeworCWl0ZXJhdG9yIF9fdG1wID0gZW5kKCk7CisJLS1fX3RtcDsKKwlyZXR1cm4gKl9fdG1wOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBsYXN0CisgICAgICAgKiAgZWxlbWVudCBvZiB0aGUgJWRlcXVlLgorICAgICAgICovCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeworCWNvbnN0X2l0ZXJhdG9yIF9fdG1wID0gZW5kKCk7CisJLS1fX3RtcDsKKwlyZXR1cm4gKl9fdG1wOworICAgICAgfQorCisgICAgICAvLyBbMjMuMi4xLjJdIG1vZGlmaWVycworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBZGQgZGF0YSB0byB0aGUgZnJvbnQgb2YgdGhlICVkZXF1ZS4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgRGF0YSB0byBiZSBhZGRlZC4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyBhIHR5cGljYWwgc3RhY2sgb3BlcmF0aW9uLiAgVGhlIGZ1bmN0aW9uIGNyZWF0ZXMgYW4KKyAgICAgICAqICBlbGVtZW50IGF0IHRoZSBmcm9udCBvZiB0aGUgJWRlcXVlIGFuZCBhc3NpZ25zIHRoZSBnaXZlbgorICAgICAgICogIGRhdGEgdG8gaXQuICBEdWUgdG8gdGhlIG5hdHVyZSBvZiBhICVkZXF1ZSB0aGlzIG9wZXJhdGlvbgorICAgICAgICogIGNhbiBiZSBkb25lIGluIGNvbnN0YW50IHRpbWUuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHB1c2hfZnJvbnQoY29uc3QgdmFsdWVfdHlwZSYgX194KQorICAgICAgeworCWlmICh0aGlzLT5fTV9pbXBsLl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ICAgICB2b2lkCisgICAgICBfTV9kZWZhdWx0X2FwcGVuZChzaXplX3R5cGUgX19uKTsKKworICAgICAgYm9vbAorICAgICAgX01fc2hyaW5rX3RvX2ZpdCgpOworI2VuZGlmCisKKyAgICAgIC8vQHsKKyAgICAgIC8vLyBNZW1vcnktaGFuZGxpbmcgaGVscGVycyBmb3IgdGhlIHByZXZpb3VzIGludGVybmFsIGluc2VydCBmdW5jdGlvbnMuCisgICAgICBpdGVyYXRvcgorICAgICAgX01fcmVzZXJ2ZV9lbGVtZW50c19hdF9mcm9udChzaXplX3R5cGUgX19uKQorICAgICAgeworCWNvbnN0IHNpemVfdHlwZSBfX3ZhY2FuY2llcyA9IHRoaXMtPl9NX2ltcGwuX01fc3RhcnQuX01fY3VyCisJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSB0aGlzLT5fTV9pbXBsLl9NX3N0YXJ0Ll9NX2ZpcnN0OworCWlmIChfX24gPiBfX3ZhY2FuY2llcykKKwkgIF9NX25ld19lbGVtZW50c19hdF9mcm9udChfX24gLSBfX3ZhY2FuY2llcyk7CisJcmV0dXJuIHRoaXMtPl9NX2ltcGwuX01fc3RhcnQgLSBkaWZmZXJlbmNlX3R5cGUoX19uKTsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIF9NX3Jlc2VydmVfZWxlbWVudHNfYXRfYmFjayhzaXplX3R5cGUgX19uKQorICAgICAgeworCWNvbnN0IHNpemVfdHlwZSBfX3ZhY2FuY2llcyA9ICh0aGlzLT5fTV9pbXBsLl9NX2ZpbmlzaC5fTV9sYXN0CisJCQkJICAgICAgIC0gdGhpcy0+X01faW1wbC5fTV9maW5pc2guX01fY3VyKSAtIDE7CisJaWYgKF9fbiA+IF9fdmFjYW5jaWVzKQorCSAgX01fbmV3X2VsZW1lbnRzX2F0X2JhY2soX19uIC0gX192YWNhbmNpZXMpOworCXJldHVybiB0aGlzLT5fTV9pbXBsLl9NX2ZpbmlzaCArIGRpZmZlcmVuY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DIzNSBObyBzcGVjaWZpY2F0aW9uIG9mIGRlZmF1bHQgY3RvciBmb3IgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmV2ZXJzZV9pdGVyYXRvcigpIDogY3VycmVudCgpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBUaGlzICVpdGVyYXRvciB3aWxsIG1vdmUgaW4gdGhlIG9wcG9zaXRlIGRpcmVjdGlvbiB0aGF0IEBwIHggZG9lcy4KKyAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgcmV2ZXJzZV9pdGVyYXRvcihpdGVyYXRvcl90eXBlIF9feCkgOiBjdXJyZW50KF9feCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFRoZSBjb3B5IGNvbnN0cnVjdG9yIGlzIG5vcm1hbC4KKyAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yKGNvbnN0IHJldmVyc2VfaXRlcmF0b3ImIF9feCkKKyAgICAgIDogY3VycmVudChfX3guY3VycmVudCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEEgJXJldmVyc2VfaXRlcmF0b3IgYWNyb3NzIG90aGVyIHR5cGVzIGNhbiBiZSBjb3BpZWQgaWYgdGhlCisgICAgICAgKiAgdW5kZXJseWluZyAlaXRlcmF0b3IgY2FuIGJlIGNvbnZlcnRlZCB0byB0aGUgdHlwZSBvZiBAYyBjdXJyZW50LgorICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9JdGVyPgorICAgICAgICByZXZlcnNlX2l0ZXJhdG9yKGNvbnN0IHJldmVyc2VfaXRlcmF0b3I8X0l0ZXI+JiBfX3gpCisJOiBjdXJyZW50KF9feC5iYXNlKCkpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBAYyBjdXJyZW50LCB0aGUgJWl0ZXJhdG9yIHVzZWQgZm9yIHVuZGVybHlpbmcgd29yay4KKyAgICAgICovCisgICAgICBpdGVyYXRvcl90eXBlCisgICAgICBiYXNlKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGN1cnJlbnQ7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHJldHVybiAgQSByZWZlcmVuY2UgdG8gdGhlIHZhbHVlIGF0IEBjIC0tY3VycmVudAorICAgICAgICoKKyAgICAgICAqICBUaGlzIHJlcXVpcmVzIHRoYXQgQGMgLS1jdXJyZW50IGlzIGRlcmVmZXJlbmNlYWJsZS4KKyAgICAgICAqCisgICAgICAgKiAgQHdhcm5pbmcgVGhpcyBpbXBsZW1lbnRhdGlvbiByZXF1aXJlcyB0aGF0IGZvciBhbiBpdGVyYXRvciBvZiB0aGUKKyAgICAgICAqICAgICAgICAgICB1bmRlcmx5aW5nIGl0ZXJhdG9yIHR5cGUsIEBjIHgsIGEgcmVmZXJlbmNlIG9idGFpbmVkIGJ5CisgICAgICAgKiAgICAgICAgICAgQGMgKnggcmVtYWlucyB2YWxpZCBhZnRlciBAYyB4IGhhcyBiZWVuIG1vZGlmaWVkIG9yCisgICAgICAgKiAgICAgICAgICAgZGVzdHJveWVkLiBUaGlzIGlzIGEgYnVnOiBodHRwOi8vZ2NjLmdudS5vcmcvUFI1MTgyMworICAgICAgKi8KKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkgY29uc3QKKyAgICAgIHsKKwlfSXRlcmF0b3IgX190bXAgPSBjdXJyZW50OworCXJldHVybiAqLS1fX3RtcDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHJldHVybiAgQSBwb2ludGVyIHRvIHRoZSB2YWx1ZSBhdCBAYyAtLWN1cnJlbnQKKyAgICAgICAqCisgICAgICAgKiAgVGhpcyByZXF1aXJlcyB0aGF0IEBjIC0tY3VycmVudCBpcyBkZXJlZmVyZW5jZWFibGUuCisgICAgICAqLworICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiAmKG9wZXJhdG9yKigpKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBAYyAqdGhpcworICAgICAgICoKKyAgICAgICAqICBEZWNyZW1lbnRzIHRoZSB1bmRlcmx5aW5nIGl0ZXJhdG9yLgorICAgICAgKi8KKyAgICAgIHJldmVyc2VfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwktLWN1cnJlbnQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBUaGUgb3JpZ2luYWwgdmFsdWUgb2YgQGMgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgRGVjcmVtZW50cyB0aGUgdW5kZXJseWluZyBpdGVyYXRvci4KKyAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlyZXZlcnNlX2l0ZXJhdG9yIF9fdG1wID0gKnRoaXM7CisJLS1jdXJyZW50OworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHJldHVybiAgQGMgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgSW5jcmVtZW50cyB0aGUgdW5kZXJseWluZyBpdGVyYXRvci4KKyAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3ItLSgpCisgICAgICB7CisJKytjdXJyZW50OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHJldHVybiAgQSByZXZlcnNlX2l0ZXJhdG9yIHdpdGggdGhlIHByZXZpb3VzIHZhbHVlIG9mIEBjICp0aGlzCisgICAgICAgKgorICAgICAgICogIEluY3JlbWVudHMgdGhlIHVuZGVybHlpbmcgaXRlcmF0b3IuCisgICAgICAqLworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3ItLShpbnQpCisgICAgICB7CisJcmV2ZXJzZV9pdGVyYXRvciBfX3RtcCA9ICp0aGlzOworCSsrY3VycmVudDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEByZXR1cm4gIEEgcmV2ZXJzZV9pdGVyYXRvciB0aGF0IHJlZmVycyB0byBAYyBjdXJyZW50IC0gQGEgX19uCisgICAgICAgKgorICAgICAgICogIFRoZSB1bmRlcmx5aW5nIGl0ZXJhdG9yIG11c3QgYmUgYSBSYW5kb20gQWNjZXNzIEl0ZXJhdG9yLgorICAgICAgKi8KKyAgICAgIHJldmVyc2VfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yKyhkaWZmZXJlbmNlX3R5cGUgX19uKSBjb25zdAorICAgICAgeyByZXR1cm4gcmV2ZXJzZV9pdGVyYXRvcihjdXJyZW50IC0gX19uKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBNb3ZlcyB0aGUgdW5kZXJseWluZyBpdGVyYXRvciBiYWNrd2FyZHMgQGEgX19uIHN0ZXBzLgorICAgICAgICogIFRoZSB1bmRlcmx5aW5nIGl0ZXJhdG9yIG11c3QgYmUgYSBSYW5kb20gQWNjZXNzIEl0ZXJhdG9yLgorICAgICAgKi8KKyAgICAgIHJldmVyc2VfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcis9KGRpZmZlcmVuY2VfdHlwZSBfX24pCisgICAgICB7CisJY3VycmVudCAtPSBfX247CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBBIHJldmVyc2VfaXRlcmF0b3IgdGhhdCByZWZlcnMgdG8gQGMgY3VycmVudCAtIEBhIF9fbgorICAgICAgICoKKyAgICAgICAqICBUaGUgdW5kZXJseWluZyBpdGVyYXRvciBtdXN0IGJlIGEgUmFuZG9tIEFjY2VzcyBJdGVyYXRvci4KKyAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvci0oZGlmZmVyZW5jZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIHJldmVyc2VfaXRlcmF0b3IoY3VycmVudCArIF9fbik7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHJldHVybiAgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgTW92ZXMgdGhlIHVuZGVybHlpbmcgaXRlcmF0b3IgZm9yd2FyZHMgQGEgX19uIHN0ZXBzLgorICAgICAgICogIFRoZSB1bmRlcmx5aW5nIGl0ZXJhdG9yIG11c3QgYmUgYSBSYW5kb20gQWNjZXNzIEl0ZXJhdG9yLgorICAgICAgKi8KKyAgICAgIHJldmVyc2VfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci09KGRpZmZlcmVuY2VfdHlwZSBfX24pCisgICAgICB7CisJY3VycmVudCArPSBfX247CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBUaGUgdmFsdWUgYXQgQGMgY3VycmVudCAtIEBhIF9fbiAtIDEKKyAgICAgICAqCisgICAgICAgKiAgVGhlIHVuZGVybHlpbmcgaXRlcmF0b3IgbXVzdCBiZSBhIFJhbmRvbSBBY2Nlc3MgSXRlcmF0b3IuCisgICAgICAqLworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKGRpZmZlcmVuY2VfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiAqKCp0aGlzICsgX19uKTsgfQorICAgIH07CisKKyAgLy9AeworICAvKioKKyAgICogIEBwYXJhbSAgX194ICBBICVyZXZlcnNlX2l0ZXJhdG9yLgorICAgKiAgQHBhcmFtICBfX3kgIEEgJXJldmVyc2VfaXRlcmF0b3IuCisgICAqICBAcmV0dXJuICBBIHNpbXBsZSBib29sLgorICAgKgorICAgKiAgUmV2ZXJzZSBpdGVyYXRvcnMgZm9yd2FyZCBtYW55IG9wZXJhdGlv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G9yPG91dHB1dF9pdGVyYXRvcl90YWcsIHZvaWQsIHZvaWQsIHZvaWQsIHZvaWQ+CisgICAgeworICAgIHByb3RlY3RlZDoKKyAgICAgIF9Db250YWluZXIqIGNvbnRhaW5lcjsKKworICAgIHB1YmxpYzoKKyAgICAgIC8vLyBBIG5lc3RlZCB0eXBlZGVmIGZvciB0aGUgdHlwZSBvZiB3aGF0ZXZlciBjb250YWluZXIgeW91IHVzZWQuCisgICAgICB0eXBlZGVmIF9Db250YWluZXIgICAgICAgICAgY29udGFpbmVyX3R5cGU7CisKKyAgICAgIC8vLyBUaGUgb25seSB3YXkgdG8gY3JlYXRlIHRoaXMgJWl0ZXJhdG9yIGlzIHdpdGggYSBjb250YWluZXIuCisgICAgICBleHBsaWNpdAorICAgICAgYmFja19pbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194KSA6IGNvbnRhaW5lcigmX194KSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQHBhcmFtICBfX3ZhbHVlICBBbiBpbnN0YW5jZSBvZiB3aGF0ZXZlciB0eXBlCisgICAgICAgKiAgICAgICAgICAgICAgICAgY29udGFpbmVyX3R5cGU6OmNvbnN0X3JlZmVyZW5jZSBpczsgcHJlc3VtYWJseSBhCisgICAgICAgKiAgICAgICAgICAgICAgICAgcmVmZXJlbmNlLXRvLWNvbnN0IFQgZm9yIGNvbnRhaW5lcjxUPi4KKyAgICAgICAqICBAcmV0dXJuICBUaGlzICVpdGVyYXRvciwgZm9yIGNoYWluZWQgb3BlcmF0aW9ucy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBraW5kIG9mICVpdGVyYXRvciBkb2Vzbid0IHJlYWxseSBoYXZlIGEgQGEgcG9zaXRpb24gaW4gdGhlCisgICAgICAgKiAgY29udGFpbmVyICh5b3UgY2FuIHRoaW5rIG9mIHRoZSBwb3NpdGlvbiBhcyBiZWluZyBwZXJtYW5lbnRseSBhdAorICAgICAgICogIHRoZSBlbmQsIGlmIHlv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udChfX3ZhbHVlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisjZWxzZQorICAgICAgZnJvbnRfaW5zZXJ0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHR5cGVuYW1lIF9Db250YWluZXI6OnZhbHVlX3R5cGUmIF9fdmFsdWUpCisgICAgICB7CisJY29udGFpbmVyLT5wdXNoX2Zyb250KF9fdmFsdWUpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgZnJvbnRfaW5zZXJ0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3I9KHR5cGVuYW1lIF9Db250YWluZXI6OnZhbHVlX3R5cGUmJiBfX3ZhbHVlKQorICAgICAgeworCWNvbnRhaW5lci0+cHVzaF9mcm9udChzdGQ6Om1vdmUoX192YWx1ZSkpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICAvLy8gU2ltcGx5IHJldHVybnMgKnRoaXMuCisgICAgICBmcm9udF9pbnNlcnRfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvciooKQorICAgICAgeyByZXR1cm4gKnRoaXM7IH0KKworICAgICAgLy8vIFNpbXBseSByZXR1cm5zICp0aGlzLiAgKFRoaXMgJWl0ZXJhdG9yIGRvZXMgbm90IEBhIG1vdmUuKQorICAgICAgZnJvbnRfaW5zZXJ0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorCisgICAgICAvLy8gU2ltcGx5IHJldHVybnMgKnRoaXMuICAoVGhpcyAlaXRlcmF0b3IgZG9lcyBub3QgQGEgbW92ZS4pCisgICAgICBmcm9udF9pbnNlcnRfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeyByZXR1cm4gKnRoaXM7IH0KKyAgICB9OworCisgIC8qKgorICAgKiAgQHBhcmFtICBfX3ggIEEgY29udGFpbmVyIG9mIGFyYml0cmFyeSB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lX3R5cGUmJgkJCQlyZWZlcmVuY2U7CisKKyAgICAgIG1vdmVfaXRlcmF0b3IoKQorICAgICAgOiBfTV9jdXJyZW50KCkgeyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBtb3ZlX2l0ZXJhdG9yKGl0ZXJhdG9yX3R5cGUgX19pKQorICAgICAgOiBfTV9jdXJyZW50KF9faSkgeyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9JdGVyPgorCW1vdmVfaXRlcmF0b3IoY29uc3QgbW92ZV9pdGVyYXRvcjxfSXRlcj4mIF9faSkKKwk6IF9NX2N1cnJlbnQoX19pLmJhc2UoKSkgeyB9CisKKyAgICAgIGl0ZXJhdG9yX3R5cGUKKyAgICAgIGJhc2UoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fY3VycmVudDsgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Om1vdmUoKl9NX2N1cnJlbnQpOyB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fY3VycmVudDsgfQorCisgICAgICBtb3ZlX2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7CisJKytfTV9jdXJyZW50OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgbW92ZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgICB7CisJbW92ZV9pdGVyYXRvciBfX3RtcCA9ICp0aGlzOworCSsrX01fY3VycmVudDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIG1vdmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci0tKCkKKyAgICAgIHsKKwktLV9NX2N1cnJlbnQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBtb3ZlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvci0tKGludCkKKyAgICAgIHsKKwltb3ZlX2l0ZXJhdG9yIF9fdG1wID0gKnRoaXM7CisJLS1fTV9jdXJyZW50OworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgbW92ZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3IrKGRpZmZlcmVuY2VfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBtb3ZlX2l0ZXJhdG9yKF9NX2N1cnJlbnQgKyBfX24pOyB9CisKKyAgICAgIG1vdmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcis9KGRpZmZlcmVuY2VfdHlwZSBfX24pCisgICAgICB7CisJX01fY3VycmVudCArPSBfX247CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBtb3ZlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvci0oZGlmZmVyZW5jZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIG1vdmVfaXRlcmF0b3IoX01fY3VycmVudCAtIF9fbik7IH0KKyAgICAKKyAgICAgIG1vdmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci09KGRpZmZlcmVuY2VfdHlwZSBfX24pCisgICAgICB7IAorCV9NX2N1cnJlbnQgLT0gX19uOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKGRpZmZlcmVuY2VfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Om1vdmUoX01fY3VycmVudFtfX25dKTsgfQorICAgIH07CisKKyAgLy8gTm90ZTogU2VlIF9fbm9ybWFsX2l0ZXJhdG9yIG9wZXJhdG9ycyBub3RlIGZyb20gR2FieSB0byB1bmRlcnN0YW5kCisgIC8vIHdoeSB0aGVyZSBhcmUgYWx3YXlzIDIgdmVyc2lvbnMgZm9yIG1vc3Qgb2YgdGhlIG1vdmVfaXRlcmF0b3IKKyAgLy8gb3Blc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AgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiBfVHAqICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgX1RwJiAgICAgICAgICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICB9OworCisgIC8vLyBQYXJ0aWFsIHNwZWNpYWxpemF0aW9uIGZvciBjb25zdCBwb2ludGVyIHR5cGVzLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgc3RydWN0IGl0ZXJhdG9yX3RyYWl0czxjb25zdCBfVHAqPgorICAgIHsKKyAgICAgIHR5cGVkZWYgcmFuZG9tX2FjY2Vzc19pdGVyYXRvcl90YWcgaXRlcmF0b3JfY2F0ZWdvcnk7CisgICAgICB0eXBlZGVmIF9UcCAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqICAgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgY29uc3QgX1RwJiAgICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICB9OworCisgIC8qKgorICAgKiAgVGhpcyBmdW5jdGlvbiBpcyBub3QgYSBwYXJ0IG9mIHRoZSBDKysgc3RhbmRhcmQgYnV0IGlzIHN5bnRhY3RpYworICAgKiAgc3VnYXIgZm9yIGludGVybmFsIGxpYnJhcnkgdXNlIG9ubHkuCisgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9JdGVyPgorICAgIGlubGluZSB0eXBlbmFtZSBpdGVyYXRvcl90cmFpdHM8X0l0ZXI+OjppdGVyYXRvcl9jYXRlZ29yeQorICAgIF9faXRlcmF0b3J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4KKyAgICAgIF9UcCBfTV9kYXRhOworCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICBfTGlzdF9ub2RlKF9BcmdzJiYuLi4gX19hcmdzKQorCTogX19kZXRhaWw6Ol9MaXN0X25vZGVfYmFzZSgpLCBfTV9kYXRhKHN0ZDo6Zm9yd2FyZDxfQXJncz4oX19hcmdzKS4uLikgCisgICAgICAgIHsgfQorI2VuZGlmCisgICAgfTsKKworICAvKioKKyAgICogIEBicmllZiBBIGxpc3Q6Oml0ZXJhdG9yLgorICAgKgorICAgKiAgQWxsIHRoZSBmdW5jdGlvbnMgYXJlIG9wIG92ZXJsb2Fkcy4KKyAgKi8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHN0cnVjdCBfTGlzdF9pdGVyYXRvcgorICAgIHsKKyAgICAgIHR5cGVkZWYgX0xpc3RfaXRlcmF0b3I8X1RwPiAgICAgICAgICAgICAgICBfU2VsZjsKKyAgICAgIHR5cGVkZWYgX0xpc3Rfbm9kZTxfVHA+ICAgICAgICAgICAgICAgICAgICBfTm9kZTsKKworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpiaWRpcmVjdGlvbmFsX2l0ZXJhdG9yX3RhZyAgICBpdGVyYXRvcl9jYXRlZ29yeTsKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBfVHAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIF9UcCYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworCisgICAgICBfTGlzdF9pdGVyYXRvcigpCisgICAgICA6IF9NX25vZGUoKSB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIF9MaXN0X2l0ZXJhdG9yKF9fZGV0YWlsOjpfTGlzdF9ub2RlX2Jhc2UqIF9feCkKKyAgICAgIDogX01fbm9kZShfX3gpIHsgfQorCisgICAgICAvLyBNdXN0IGRvd25jYXN0IGZyb20gX0xpc3Rfbm9kZV9iYXNlIHRvIF9MaXN0X25vZGUgdG8gZ2V0IHRvIF9NX2RhdGEuCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxfTm9kZSo+KF9NX25vZGUpLT5fTV9kYXRhOyB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdAorICAgICAgeyByZXR1cm4gc3RkOjpfX2FkZHJlc3NvZihzdGF0aWNfY2FzdDxfTm9kZSo+KF9NX25vZGUpLT5fTV9kYXRhKTsgfQorCisgICAgICBfU2VsZiYKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworCV9NX25vZGUgPSBfTV9ub2RlLT5fTV9uZXh0OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NlbGYKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworCV9TZWxmIF9fdG1wID0gKnRoaXM7CisJX01fbm9kZSA9IF9NX25vZGUtPl9NX25leHQ7CisJcmV0dXJuIF9fdG1wOworICAgICAgfQorCisgICAgICBfU2VsZiYKKyAgICAgIG9wZXJhdG9yLS0oKQorICAgICAgeworCV9NX25vZGUgPSBfTV9ub2RlLT5fTV9wcmV2OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NlbGYKKyAgICAgIG9wZXJhdG9yLS0oaW50KQorICAgICAgeworCV9TZWxmIF9fdG1wID0gKnRoaXM7CisJX01fbm9kZSA9IF9NX25vZGUtPl9NX3ByZXY7CisJcmV0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gICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqICAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIGNvbnN0IF9UcCYgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworCisgICAgICBfTGlzdF9jb25zdF9pdGVyYXRvcigpCisgICAgICA6IF9NX25vZGUoKSB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIF9MaXN0X2NvbnN0X2l0ZXJhdG9yKGNvbnN0IF9fZGV0YWlsOjpfTGlzdF9ub2RlX2Jhc2UqIF9feCkKKyAgICAgIDogX01fbm9kZShfX3gpIHsgfQorCisgICAgICBfTGlzdF9jb25zdF9pdGVyYXRvcihjb25zdCBpdGVyYXRvciYgX194KQorICAgICAgOiBfTV9ub2RlKF9feC5fTV9ub2RlKSB7IH0KKworICAgICAgLy8gTXVzdCBkb3duY2FzdCBmcm9tIExpc3Rfbm9kZV9iYXNlIHRvIF9MaXN0X25vZGUgdG8gZ2V0IHRvCisgICAgICAvLyBfTV9kYXRhLgorICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvciooKSBjb25zdAorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8X05vZGUqPihfTV9ub2RlKS0+X01fZGF0YTsgfQorCisgICAgICBwb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHN0ZDo6X19hZGRyZXNzb2Yoc3RhdGljX2Nhc3Q8X05vZGUqPihfTV9ub2RlKS0+X01fZGF0YSk7IH0KKworICAgICAgX1NlbGYmCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwlfTV9ub2RlID0gX01fbm9kZS0+X01fbmV4dDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCV9NX25vZGUgPSBfTV9ub2RlLT5fTV9uZXh0OworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgX1NlbGYmCisgICAgICBvcGVyYXRvci0tKCkKKyAgICAgIHsKKwlfTV9ub2RlID0gX01fbm9kZS0+X01fcHJldjsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvci0tKGludCkKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCV9NX25vZGUgPSBfTV9ub2RlLT5fTV9wcmV2OworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgYm9vbAorICAgICAgb3BlcmF0b3I9PShjb25zdCBfU2VsZiYgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbm9kZSA9PSBfX3guX01fbm9kZTsgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IF9TZWxmJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ub2RlICE9IF9feC5fTV9ub2RlOyB9CisKKyAgICAgIC8vIFRoZSBvbmx5IG1lbWJlciBwb2ludHMgdG8gdGhlICVsaXN0IGVsZW1lbnQuCisgICAgICBjb25zdCBfX2RldGFpbDo6X0xpc3Rfbm9kZV9iYXNlKiBfTV9ub2RlOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1ZhbD4KKyAgICBpbmxpbmUgYm9vbAorICAgIG9wZXJhdG9yPT0oY29uc3QgX0xpc3RfaXRlcmF0b3I8X1ZhbD4mIF9feCwKKwkgICAgICAgY29uc3QgX0xpc3RfY29uc3RfaXRlcmF0b3I8X1ZhbD4mIF9feSkKKyAgICB7IHJldHVybiBfX3guX01fbm9kZSA9PSBfX3kuX01fbm9kZTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9WYWw+CisgICAgaW5saW5lIGJvb2wKKyAgICBvcGVyYXRv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bGxvY190eXBlJiBfX2EpCisgICAgICA6IF9NX2ltcGwoX19hKQorICAgICAgeyBfTV9pbml0KCk7IH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICBfTGlzdF9iYXNlKF9MaXN0X2Jhc2UmJiBfX3gpCisgICAgICA6IF9NX2ltcGwoc3RkOjptb3ZlKF9feC5fTV9nZXRfTm9kZV9hbGxvY2F0b3IoKSkpCisgICAgICB7CisJX01faW5pdCgpOworCV9fZGV0YWlsOjpfTGlzdF9ub2RlX2Jhc2U6OnN3YXAoX01faW1wbC5fTV9ub2RlLCBfX3guX01faW1wbC5fTV9ub2RlKTsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICAvLyBUaGlzIGlzIHdoYXQgYWN0dWFsbHkgZGVzdHJveXMgdGhlIGxpc3QuCisgICAgICB+X0xpc3RfYmFzZSgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX2NsZWFyKCk7IH0KKworICAgICAgdm9pZAorICAgICAgX01fY2xlYXIoKTsKKworICAgICAgdm9pZAorICAgICAgX01faW5pdCgpCisgICAgICB7CisgICAgICAgIHRoaXMtPl9NX2ltcGwuX01fbm9kZS5fTV9uZXh0ID0gJnRoaXMtPl9NX2ltcGwuX01fbm9kZTsKKyAgICAgICAgdGhpcy0+X01faW1wbC5fTV9ub2RlLl9NX3ByZXYgPSAmdGhpcy0+X01faW1wbC5fTV9ub2RlOworICAgICAgfQorICAgIH07CisKKyAgLyoqCisgICAqICBAYnJpZWYgQSBzdGFuZGFyZCBjb250YWluZXIgd2l0aCBsaW5lYXIgdGltZSBhY2Nlc3MgdG8gZWxlbWVudHMsCisgICAqICBhbmQgZml4ZWQgdGltZSBpbnNlcnRpb24vZGVsZXRpb24gYXQgYW55IHBvaW50IGluIHRoZSBzZXF1ZW5jZS4KKyAgICoKKyAgICogIEBpbmdyb3VwIHNlcXVlbmNlcworICAgKgorICAgKiAgTWVldHMgdGhlIHJlcX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aWM6CisgICAgICB0eXBlZGVmIF9UcCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfVHBfYWxsb2NfdHlwZTo6cG9pbnRlciAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX1RwX2FsbG9jX3R5cGU6OmNvbnN0X3BvaW50ZXIgICAgIGNvbnN0X3BvaW50ZXI7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9UcF9hbGxvY190eXBlOjpyZWZlcmVuY2UgICAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9UcF9hbGxvY190eXBlOjpjb25zdF9yZWZlcmVuY2UgICBjb25zdF9yZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIF9MaXN0X2l0ZXJhdG9yPF9UcD4gICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgX0xpc3RfY29uc3RfaXRlcmF0b3I8X1RwPiAgICAgICAgICAgICAgICAgIGNvbnN0X2l0ZXJhdG9yOworICAgICAgdHlwZWRlZiBzdGQ6OnJldmVyc2VfaXRlcmF0b3I8Y29uc3RfaXRlcmF0b3I+ICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgc3RkOjpyZXZlcnNlX2l0ZXJhdG9yPGl0ZXJhdG9yPiAgICAgICAgICAgIHJldmVyc2VfaXRlcmF0b3I7CisgICAgICB0eXBlZGVmIHNpemVfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3R5cGU7CisgICAgICB0eXBlZGVmIHB0cmRpZmZfdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIF9BbGxvYyAgICAgICAgICAgICAgICAgICAgICAgICAgIC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X190aHJvd19leGNlcHRpb25fYWdhaW47CisJICB9CisJcmV0dXJuIF9fcDsKKyAgICAgIH0KKyNlbHNlCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKyAgICAgICAgX05vZGUqCisgICAgICAgIF9NX2NyZWF0ZV9ub2RlKF9BcmdzJiYuLi4gX19hcmdzKQorCXsKKwkgIF9Ob2RlKiBfX3AgPSB0aGlzLT5fTV9nZXRfbm9kZSgpOworCSAgX190cnkKKwkgICAgeworCSAgICAgIF9NX2dldF9Ob2RlX2FsbG9jYXRvcigpLmNvbnN0cnVjdChfX3AsCisJCQkJCQlzdGQ6OmZvcndhcmQ8X0FyZ3M+KF9fYXJncykuLi4pOworCSAgICB9CisJICBfX2NhdGNoKC4uLikKKwkgICAgeworCSAgICAgIF9NX3B1dF9ub2RlKF9fcCk7CisJICAgICAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJICAgIH0KKwkgIHJldHVybiBfX3A7CisJfQorI2VuZGlmCisKKyAgICBwdWJsaWM6CisgICAgICAvLyBbMjMuMi4yLjFdIGNvbnN0cnVjdC9jb3B5L2Rlc3Ryb3kKKyAgICAgIC8vIChhc3NpZ24oKSBhbmQgZ2V0X2FsbG9jYXRvcigpIGFyZSBhbHNvIGxpc3RlZCBpbiB0aGlzIHNlY3Rpb24pCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIERlZmF1bHQgY29uc3RydWN0b3IgY3JlYXRlcyBubyBlbGVtZW50cy4KKyAgICAgICAqLworICAgICAgbGlzdCgpCisgICAgICA6IF9CYXNlKCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICVsaXN0IHdpdGggbm8gZWxlbWVudHMuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFuIGFsbG9jYXRvciBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBsaXN0KGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EpCisgICAgICA6IF9CYXNlKF9Ob2RlX2FsbG9jX3R5cGUoX19hKSkgeyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDcmVhdGVzIGEgJWxpc3Qgd2l0aCBkZWZhdWx0IGNvbnN0cnVjdGVkIGVsZW1lbnRzLgorICAgICAgICogIEBwYXJhbSAgX19uICBUaGUgbnVtYmVyIG9mIGVsZW1lbnRzIHRvIGluaXRpYWxseSBjcmVhdGUuCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgZmlsbHMgdGhlICVsaXN0IHdpdGggQGEgX19uIGRlZmF1bHQKKyAgICAgICAqICBjb25zdHJ1Y3RlZCBlbGVtZW50cy4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGxpc3Qoc2l6ZV90eXBlIF9fbikKKyAgICAgIDogX0Jhc2UoKQorICAgICAgeyBfTV9kZWZhdWx0X2luaXRpYWxpemUoX19uKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENyZWF0ZXMgYSAlbGlzdCB3aXRoIGNvcGllcyBvZiBhbiBleGVtcGxhciBlbGVtZW50LgorICAgICAgICogIEBwYXJhbSAgX19uICBUaGUgbnVtYmVyIG9mIGVsZW1lbnRzIHRvIGluaXRpYWxseSBjcmVhdGUuCisgICAgICAgKiAgQHBhcmFtICBfX3ZhbHVlICBBbiBlbGVtZW50IHRvIGNvcHkuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFuIGFsbG9jYXRvciBvYmplY3QuCisgICAgICAgKgorICAgICAgICogIFRoaXMgY29uc3RydWN0b3IgZmlsbHMgdGhlICVsaXN0IHdpdGggQGEgX19uIGNvcGllcyBvZiBAYSBfX3ZhbHVlLgorICAgICAgICovCisgICAgICBsaXN0KHNpemVfdHlwZSBfX24sIGNvbnN0IHZhbHVlX3R5cGUmIF9fdmF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isgICAgICAgKgorICAgICAgICogIFRoZSBuZXdseS1jcmVhdGVkICVsaXN0IHVzZXMgYSBjb3B5IG9mIHRoZSBhbGxvY2F0aW9uIG9iamVjdCB1c2VkCisgICAgICAgKiAgYnkgQGEgX194LgorICAgICAgICovCisgICAgICBsaXN0KGNvbnN0IGxpc3QmIF9feCkKKyAgICAgIDogX0Jhc2UoX194Ll9NX2dldF9Ob2RlX2FsbG9jYXRvcigpKQorICAgICAgeyBfTV9pbml0aWFsaXplX2Rpc3BhdGNoKF9feC5iZWdpbigpLCBfX3guZW5kKCksIF9fZmFsc2VfdHlwZSgpKTsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJUxpc3QgbW92ZSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlbGlzdCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgbmV3bHktY3JlYXRlZCAlbGlzdCBjb250YWlucyB0aGUgZXhhY3QgY29udGVudHMgb2YgQGEgX194LgorICAgICAgICogIFRoZSBjb250ZW50cyBvZiBAYSBfX3ggYXJlIGEgdmFsaWQsIGJ1dCB1bnNwZWNpZmllZCAlbGlzdC4KKyAgICAgICAqLworICAgICAgbGlzdChsaXN0JiYgX194KSBub2V4Y2VwdAorICAgICAgOiBfQmFzZShzdGQ6Om1vdmUoX194KSkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnVpbGRzIGEgJWxpc3QgZnJvbSBhbiBpbml0aWFsaXplcl9saXN0CisgICAgICAgKiAgQHBhcmFtICBfX2wgIEFuIGluaXRpYWxpemVyX2xpc3Qgb2YgdmFsdWVfdHlwZS4KKyAgICAgICAqICBAcGFyYW0gIF9fYSAgQW4gYWxsb2NhdG9yIG9iamVjdC4KKyAgICAgICAqCisg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ICoKKyAgICAgICAqICBBbGwgdGhlIGVsZW1lbnRzIG9mIEBhIF9feCBhcmUgY29waWVkLCBidXQgdW5saWtlIHRoZSBjb3B5CisgICAgICAgKiAgY29uc3RydWN0b3IsIHRoZSBhbGxvY2F0b3Igb2JqZWN0IGlzIG5vdCBjb3BpZWQuCisgICAgICAgKi8KKyAgICAgIGxpc3QmCisgICAgICBvcGVyYXRvcj0oY29uc3QgbGlzdCYgX194KTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVMaXN0IG1vdmUgYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlbGlzdCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgY29udGVudHMgb2YgQGEgX194IGFyZSBtb3ZlZCBpbnRvIHRoaXMgJWxpc3QgKHdpdGhvdXQgY29weWluZykuCisgICAgICAgKiAgQGEgX194IGlzIGEgdmFsaWQsIGJ1dCB1bnNwZWNpZmllZCAlbGlzdAorICAgICAgICovCisgICAgICBsaXN0JgorICAgICAgb3BlcmF0b3I9KGxpc3QmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPnN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJUxpc3QgaW5pdGlhbGl6ZXIgbGlzdCBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX19sICBBbiBpbml0aWFsaXplcl9saXN0IG9mIHZhbHVlX3R5cGUuCisgICAgICAgKgorICAgICAgICogIFJlcGxhY2UgdGhlIGNvbnRlbnRzIG9mIHRoZSAlbGlzdCB3a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J5CisgICAgICAgKiAgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcigmdGhpcy0+X01faW1wbC5fTV9ub2RlKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBsYXN0CisgICAgICAgKiAgZWxlbWVudCBpbiB0aGUgJWxpc3QuICBJdGVyYXRpb24gaXMgZG9uZSBpbiByZXZlcnNlIGVsZW1lbnQKKyAgICAgICAqICBvcmRlci4KKyAgICAgICAqLworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmJlZ2luKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIHJldmVyc2VfaXRlcmF0b3IoZW5kKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvCisgICAgICAgKiAgdGhlIGxhc3QgZWxlbWVudCBpbiB0aGUgJWxpc3QuICBJdGVyYXRpb24gaXMgZG9uZSBpbiByZXZlcnNlCisgICAgICAgKiAgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmJlZ2luKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IoZW5kKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gb25lCisgICAgICA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mF0b3IodGhpcy0+X01faW1wbC5fTV9ub2RlLl9NX25leHQpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdAorICAgICAgICogIHRoZSBsYXN0IGVsZW1lbnQgaW4gdGhlICVsaXN0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gb3JkaW5hcnkKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgY2VuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcigmdGhpcy0+X01faW1wbC5fTV9ub2RlKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0bworICAgICAgICogIHRoZSBsYXN0IGVsZW1lbnQgaW4gdGhlICVsaXN0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gcmV2ZXJzZQorICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IKKyAgICAgIGNyYmVnaW4oKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gY29uc3RfcmV2ZXJzZV9pdGVyYXRvcihlbmQoKSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gb25lCisgICAgICAgKiAgYmVmb3JlIHRoZSBmaXJzdCBlbGVtZW50IGluIHRoZSAlbGlzdC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIHJldmVyc2UKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAg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udCBhY2Nlc3MKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlbGlzdC4KKyAgICAgICAqLworICAgICAgcmVmZXJlbmNlCisgICAgICBmcm9udCgpCisgICAgICB7IHJldHVybiAqYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgb2YgdGhlICVsaXN0LgorICAgICAgICovCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgbGFzdCBlbGVtZW50CisgICAgICAgKiAgb2YgdGhlICVsaXN0LgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeyAKKwlpdGVyYXRvciBfX3RtcCA9IGVuZCgpOworCS0tX190bXA7CisJcmV0dXJuICpfX3RtcDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgb2YgdGhlICVsaXN0LgorICAgICAgICovCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeyAKKwljb25zdF9pdGVyYXRvciBfX3RtcCA9IGVuZCgpOworCS0tX190bXA7CisJcmV0dXJuICpfX3RtcDsKKyAgIC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B0aGUgcG9pbnRlZC10byBtZW1vcnkgaXMgbm90IHRvdWNoZWQgaW4gYW55IHdheS4KKyAgICAgICAqICBNYW5hZ2luZyB0aGUgcG9pbnRlciBpcyB0aGUgdXNlcidzIHJlc3BvbnNpYmlsaXR5LgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisgICAgICAgIF9CYXNlOjpfTV9jbGVhcigpOworICAgICAgICBfQmFzZTo6X01faW5pdCgpOworICAgICAgfQorCisgICAgICAvLyBbMjMuMi4yLjRdIGxpc3Qgb3BlcmF0aW9ucworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBJbnNlcnQgY29udGVudHMgb2YgYW5vdGhlciAlbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fcG9zaXRpb24gIEl0ZXJhdG9yIHJlZmVyZW5jaW5nIHRoZSBlbGVtZW50IHRvIGluc2VydCBiZWZvcmUuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIFNvdXJjZSBsaXN0LgorICAgICAgICoKKyAgICAgICAqICBUaGUgZWxlbWVudHMgb2YgQGEgX194IGFyZSBpbnNlcnRlZCBpbiBjb25zdGFudCB0aW1lIGluIGZyb250IG9mCisgICAgICAgKiAgdGhlIGVsZW1lbnQgcmVmZXJlbmNlZCBieSBAYSBfX3Bvc2l0aW9uLiAgQGEgX194IGJlY29tZXMgYW4gZW1wdHkKKyAgICAgICAqICBsaXN0LgorICAgICAgICoKKyAgICAgICAqICBSZXF1aXJlcyB0aGlzICE9IEBhIF9feC4KKyAgICAgICAqLworICAgICAgdm9pZAorI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICBzcGxpY2UoaXRlcmF0b3IgX19wb3NpdGlvbiwgbGlzdCYmIF9feCkKKyNlbHNlCisgICAgICBzcGxpY2UoaXRlcmF0b3IgX19wb3NpdGlvbiwgbGlzdCYgX194KQorI2VuZGlmCisgICAgICB7CisJaWYgKCFfX3guZW1wdHkoKSkKKwkgIHsKKwkgICAgX01fY2hlY2tfZXF1YWxfYWxsb2NhdG9ycyhfX3gpOworCisJICAgIHRoaXMtPl9NX3RyYW5zZmVyKF9fcG9zaXRpb24sIF9feC5iZWdpbigpLCBfX3guZW5kKCkpOworCSAgfQorICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHZvaWQKKyAgICAgIHNwbGljZShpdGVyYXRvciBfX3Bvc2l0aW9uLCBsaXN0JiBfX3gpCisgICAgICB7IHNwbGljZShfX3Bvc2l0aW9uLCBzdGQ6Om1vdmUoX194KSk7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEluc2VydCBlbGVtZW50IGZyb20gYW5vdGhlciAlbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fcG9zaXRpb24gIEl0ZXJhdG9yIHJlZmVyZW5jaW5nIHRoZSBlbGVtZW50IHRvIGluc2VydCBiZWZvcmUuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIFNvdXJjZSBsaXN0LgorICAgICAgICogIEBwYXJhbSAgX19pICBJdGVyYXRvciByZWZlcmVuY2luZyB0aGUgZWxlbWVudCB0byBtb3ZlLgorICAgICAgICoKKyAgICAgICAqICBSZW1vdmVzIHRoZSBlbGVtZW50IGluIGxpc3QgQGEgX194IHJlZmVyZW5jZWQgYnkgQGEgX19pIGFuZAorICAgICAgICogIGluc2VydHMgaXQgaW50byB0aGUgY3VycmVudCBsaXN0IGJlZm9yZSBAYSBfX3Bvc2l0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHNwbGljZShpdGVyYXRvciBfX3Bvc2l0aW9uLCBsaXN0JiYgX194LCBpdGVyYXRvciBfX2kpCisjZWxzZQorICAgICAgc3BsaWNlKGl0ZXJhdG9yIF9fcG9zaXRpb24sIGxpc3QmIF9feCwgaXRlcmF0b3IgX19pKQorI2VuZGlmCisgICAgICB7CisJaXRlcmF0b3IgX19qID0gX19pOworCSsrX19qOworCWlmIChfX3Bvc2l0aW9uID09IF9faSB8fCBfX3Bvc2l0aW9uID09IF9faikKKwkgIHJldHVybjsKKworCWlmICh0aGlzICE9ICZfX3gpCisJICBfTV9jaGVja19lcXVhbF9hbGxvY2F0b3JzKF9feCk7CisKKwl0aGlzLT5fTV90cmFuc2ZlcihfX3Bvc2l0aW9uLCBfX2ksIF9faik7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdm9pZAorICAgICAgc3BsaWNlKGl0ZXJhdG9yIF9fcG9zaXRpb24sIGxpc3QmIF9feCwgaXRlcmF0b3IgX19pKQorICAgICAgeyBzcGxpY2UoX19wb3NpdGlvbiwgc3RkOjptb3ZlKF9feCksIF9faSk7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEluc2VydCByYW5nZSBmcm9tIGFub3RoZXIgJWxpc3QuCisgICAgICAgKiAgQHBhcmFtICBfX3Bvc2l0aW9uICBJdGVyYXRvciByZWZlcmVuY2luZyB0aGUgZWxlbWVudCB0byBpbnNlcnQgYmVmb3JlLgorICAgICAgICogIEBwYXJhbSAgX194ICBTb3VyY2UgbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fZmlyc3QgIEl0ZXJhdG9yIHJlZmVyZW5jaW5nIHRoZSBzdGFydCBvZiByYW5nZSBpbiB4LgorICAgICAgICogIEBwYXJhbSAgX19sYXN0ICBJdGVyYXRvciByZWZlcmVuY2luZyB0aGUgZW5kIG9mIHJhbmdlIGluIHguCisgICAgICAgKgorICAgICAgICogIFJlbW92ZXMgZWxlbWVudHMgaW4gdGhlIHJhbmdlIFtfX2ZpcnN0LF9fbGFzdCkgYW5kIGluc2VydHMgdGhlbQorICAgICAgICogIGJlZm9yZSB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AorICAgICAgcmV2ZXJzZSgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHRoaXMtPl9NX2ltcGwuX01fbm9kZS5fTV9yZXZlcnNlKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTb3J0IHRoZSBlbGVtZW50cy4KKyAgICAgICAqCisgICAgICAgKiAgU29ydHMgdGhlIGVsZW1lbnRzIG9mIHRoaXMgbGlzdCBpbiBObG9nTiB0aW1lLiAgRXF1aXZhbGVudAorICAgICAgICogIGVsZW1lbnRzIHJlbWFpbiBpbiBsaXN0IG9yZGVyLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzb3J0KCk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU29ydCB0aGUgZWxlbWVudHMgYWNjb3JkaW5nIHRvIGNvbXBhcmlzb24gZnVuY3Rpb24uCisgICAgICAgKgorICAgICAgICogIFNvcnRzIHRoZSBlbGVtZW50cyBvZiB0aGlzIGxpc3QgaW4gTmxvZ04gdGltZS4gIEVxdWl2YWxlbnQKKyAgICAgICAqICBlbGVtZW50cyByZW1haW4gaW4gbGlzdCBvcmRlci4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1N0cmljdFdlYWtPcmRlcmluZz4KKyAgICAgICAgdm9pZAorICAgICAgICBzb3J0KF9TdHJpY3RXZWFrT3JkZXJpbmcpOworCisgICAgcHJvdGVjdGVkOgorICAgICAgLy8gSW50ZXJuYWwgY29uc3RydWN0b3IgZnVuY3Rpb25zIGZvbGxvdy4KKworICAgICAgLy8gQ2FsbGVkIGJ5IHRoZSByYW5nZSBjb25zdHJ1Y3RvciB0byBpbXBsZW1lbnQgWzIzLjEuMV0vOQorCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyA0MzguIEFtYmlndWl0eSBpbiB0aGUgImRvIHRoZSByaWdodCB0aGluZyIgY2xhdXNlCisgICAgICB0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gIHR5cGVuYW1lIF9BbGxvYyA9IHN0ZDo6YWxsb2NhdG9yPHN0ZDo6cGFpcjxjb25zdCBfS2V5LCBfVHA+ID4gPgorICAgIGNsYXNzIG1hcAorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9LZXkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZTsKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcHBlZF90eXBlOworICAgICAgdHlwZWRlZiBzdGQ6OnBhaXI8Y29uc3QgX0tleSwgX1RwPiAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0NvbXBhcmUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleV9jb21wYXJlOworICAgICAgdHlwZWRlZiBfQWxsb2MgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisKKyAgICBwcml2YXRlOgorICAgICAgLy8gY29uY2VwdCByZXF1aXJlbWVudHMKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jOjp2YWx1ZV90eXBlICAgICAgICAgICAgICAgICAgIF9BbGxvY192YWx1ZV90eXBlOworICAgICAgX19nbGliY3h4X2NsYXNzX3JlcXVpcmVzKF9UcCwgX1NHSUFzc2lnbmFibGVDb25jZXB0KQorICAgICAgX19nbGliY3h4X2NsYXNzX3JlcXVpcmVzNChfQ29tcGFyZSwgYm9vbCwgX0tleSwgX0tleSwKKwkJCQlfQmluYXJ5RnVuY3Rpb25Db25jZXB0KQorICAgICAgX19nbGliY3h4X2NsYXNzX3JlcXVpcmVzMih2YWx1ZV90eXBlLCBfQWxsb2NfdmFsdWVfdHlwZSwgX1NhbWVUeXBlQ29uY2VwdCkKKworICAgIHB1YmxpYzoKKyAgICAgIGNsYXNzIHZhbHV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tYWxseSBsaXN0ZWQgaW4gdGhpcyBzZWN0aW9uLCBidXQgc2VlbXMgdG8gaGF2ZQorICAgICAgLy8gYmVlbiBhY2NpZGVudGFsbHkgb21pdHRlZCBpbiB0aGUgcHJpbnRlZCBzdGFuZGFyZCkKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRGVmYXVsdCBjb25zdHJ1Y3RvciBjcmVhdGVzIG5vIGVsZW1lbnRzLgorICAgICAgICovCisgICAgICBtYXAoKQorICAgICAgOiBfTV90KCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICVtYXAgd2l0aCBubyBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gIF9fY29tcCAgQSBjb21wYXJpc29uIG9iamVjdC4KKyAgICAgICAqICBAcGFyYW0gIF9fYSAgQW4gYWxsb2NhdG9yIG9iamVjdC4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIG1hcChjb25zdCBfQ29tcGFyZSYgX19jb21wLAorCSAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9NX3QoX19jb21wLCBfUGFpcl9hbGxvY190eXBlKF9fYSkpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVNYXAgY29weSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlbWFwIG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IgdHlwZXMuCisgICAgICAgKgorICAgICAgICogIFRoZSBuZXdseS1jcmVhdGVkICVtYXAgdXNlcyBhIGNvcHkgb2YgdGhlIGFsbG9jYXRpb24gb2JqZWN0CisgICAgICAgKiAgdXNlZCBieSBAYSBfX3guCisgICAgICAgKi8KKyAgICAgIG1hcChjb25zdCBtYXAmIF9feCkKKyAgICAgIDogX01fdChfX3guX01fdCkgeyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICAlTWFwIG1vdmUgY29uc3RydWN0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEEgJW1hcCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgbmV3bHktY3JlYXRlZCAlbWFwIGNvbnRhaW5zIHRoZSBleGFjdCBjb250ZW50cyBvZiBAYSBfX3guCisgICAgICAgKiAgVGhlIGNvbnRlbnRzIG9mIEBhIF9feCBhcmUgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkICVtYXAuCisgICAgICAgKi8KKyAgICAgIG1hcChtYXAmJiBfX3gpCisgICAgICBub2V4Y2VwdChpc19ub3Rocm93X2NvcHlfY29uc3RydWN0aWJsZTxfQ29tcGFyZT46OnZhbHVlKQorICAgICAgOiBfTV90KHN0ZDo6bW92ZShfX3guX01fdCkpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEJ1aWxkcyBhICVtYXAgZnJvbSBhbiBpbml0aWFsaXplcl9saXN0LgorICAgICAgICogIEBwYXJhbSAgX19sICBBbiBpbml0aWFsaXplcl9saXN0LgorICAgICAgICogIEBwYXJhbSAgX19jb21wICBBIGNvbXBhcmlzb24gb2JqZWN0LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3Igb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqICBDcmVhdGUgYSAlbWFwIGNvbnNpc3Rpbmcgb2YgY29waWVzIG9mIHRoZSBlbGVtZW50cyBpbiB0aGUKKyAgICAgICAqICBpbml0aWFsaXplcl9saXN0IEBhIF9fbC4KKyAgICAgICAqICBUaGlzIGlzIGxpbmVhciBpbiBOIGlmIHRoZSByYW5nZSBpcyBhbHJlYWR5IHNvcnRlZCwgYW5kIE5sb2dOCisgICAgICAgKiAgb3Ro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E1FIFRoZXJlIGlzIG5vIGR0b3IgZGVjbGFyZWQsIGJ1dCB3ZSBzaG91bGQgaGF2ZSBzb21ldGhpbmcKKyAgICAgIC8vIGdlbmVyYXRlZCBieSBEb3h5Z2VuLiAgSSBkb24ndCBrbm93IHdoYXQgdGFncyB0byBhZGQgdG8gdGhpcworICAgICAgLy8gcGFyYWdyYXBoIHRvIG1ha2UgdGhhdCBoYXBwZW46CisgICAgICAvKioKKyAgICAgICAqICBUaGUgZHRvciBvbmx5IGVyYXNlcyB0aGUgZWxlbWVudHMsIGFuZCBub3RlIHRoYXQgaWYgdGhlIGVsZW1lbnRzCisgICAgICAgKiAgdGhlbXNlbHZlcyBhcmUgcG9pbnRlcnMsIHRoZSBwb2ludGVkLXRvIG1lbW9yeSBpcyBub3QgdG91Y2hlZCBpbiBhbnkKKyAgICAgICAqICB3YXkuICBNYW5hZ2luZyB0aGUgcG9pbnRlciBpcyB0aGUgdXNlcidzIHJlc3BvbnNpYmlsaXR5LgorICAgICAgICovCisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJU1hcCBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX194ICBBICVtYXAgb2YgaWRlbnRpY2FsIGVsZW1lbnQgYW5kIGFsbG9jYXRvciB0eXBlcy4KKyAgICAgICAqCisgICAgICAgKiAgQWxsIHRoZSBlbGVtZW50cyBvZiBAYSBfX3ggYXJlIGNvcGllZCwgYnV0IHVubGlrZSB0aGUgY29weQorICAgICAgICogIGNvbnN0cnVjdG9yLCB0aGUgYWxsb2NhdG9yIG9iamVjdCBpcyBub3QgY29waWVkLgorICAgICAgICovCisgICAgICBtYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgbWFwJiBfX3gpCisgICAgICB7CisJX01fdCA9IF9feC5fTV90OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKK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y4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QuYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIHBhaXIgaW4gdGhlICVtYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBhc2NlbmRpbmcgb3JkZXIKKyAgICAgICAqICBhY2NvcmRpbmcgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBlbmQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5lbmQoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgaXRlcmF0b3IgdGhhdCBwb2ludHMgb25lIHBhc3QgdGhlIGxhc3QKKyAgICAgICAqICBwYWlyIGluIHRoZSAlbWFwLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gYXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0bworICAgICAgICogIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QuZW5kKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgbGFzdCBwYWlyIGluCisgICAgICAgKiAgdGhlICVtYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0byB0aGUKKyAgICAgICAqICBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5yYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUKKyAgICAgICAqICBsYXN0IHBhaXIgaW4gdGhlICVtYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyCisgICAgICAgKiAgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5yYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIG9uZSBiZWZvcmUgdGhlCisgICAgICAgKiAgZmlyc3QgcGFpciBpbiB0aGUgJW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGRlc2NlbmRpbmcgb3JkZXIKKyAgICAgICAqICBhY2NvcmRpbmcgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIHJldmVyc2VfaXRlcmF0b3IKKyAgICAgIHJlbmQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5yZW5kKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gb25lCisgICAgICAgKiAgYmVmb3JlIHRoZSBmaXJzdCBwYWlyIGluIHRoZSAlbWFwLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gZGVzY2VuZGluZworICAgICAgICogIG9yZGVyIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LnJlbmQoKTsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QgcGFpcgorICAgICAgICogIGluIHRoZSAlbWFwLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gYXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0byB0aGUKKyAgICAgICAqICBrZXlzLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgY2JlZ2luKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIF9NX3QuYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgaXRlcmF0b3IgdGhhdCBwb2ludHMgb25lIHBhc3QgdGhlIGxhc3QKKyAgICAgICAqICBwYWlyIGluIHRoZSAlbWFwLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gYXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0bworICAgICAgICogIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgY2VuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGxhc3QgcGFpciBpbiB0aGUgJW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGRlc2NlbmRpbmcgb3JkZXIKKyAgICAgICAqICBhY2NvcmRpbmcgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IKKyAgICAgIGNyYmVnaW4oKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdC5yYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byBvbmUKKyAgICAgICAqICBiZWZvcmUgdGhlIGZpcnN0IHBhaXIgaW4gdGhlICVtYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nCisgICAgICAgKiAgb3JkZXIgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICBjcmVuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV90LnJlbmQoKTsgfQorI2VuZGlmCisKKyAgICAgIC8vIGNhcGFjaXR5CisgICAgICAvKiogUmV0dXJucyB0cnVlIGlmIHRoZSAlbWFwIGlzIGVtcHR5LiAgKFRodXMgYmVnaW4oKSB3b3VsZCBlcXVhbAorICAgICAgICogIGVuZCgpLikKKyAgICAgICovCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVtcHR5KCk7IH0KKworICAgICAgLyoqIFJldHVybnMgdGhlIHNpemUgb2YgdGhlICVtYXAuICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBz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gpKF9faywgKCpfX2kpLmZpcnN0KSkKKwkgIF9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigibWFwOjphdCIpKTsKKwlyZXR1cm4gKCpfX2kpLnNlY29uZDsKKyAgICAgIH0KKworICAgICAgLy8gbW9kaWZpZXJzCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgQXR0ZW1wdHMgdG8gaW5zZXJ0IGEgc3RkOjpwYWlyIGludG8gdGhlICVtYXAuCisKKyAgICAgICAqICBAcGFyYW0gX194IFBhaXIgdG8gYmUgaW5zZXJ0ZWQgKHNlZSBzdGQ6Om1ha2VfcGFpciBmb3IgZWFzeQorICAgICAgICoJICAgICBjcmVhdGlvbiBvZiBwYWlycykuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gIEEgcGFpciwgb2Ygd2hpY2ggdGhlIGZpcnN0IGVsZW1lbnQgaXMgYW4gaXRlcmF0b3IgdGhhdCAKKyAgICAgICAqICAgICAgICAgICBwb2ludHMgdG8gdGhlIHBvc3NpYmx5IGluc2VydGVkIHBhaXIsIGFuZCB0aGUgc2Vjb25kIGlzIAorICAgICAgICogICAgICAgICAgIGEgYm9vbCB0aGF0IGlzIHRydWUgaWYgdGhlIHBhaXIgd2FzIGFjdHVhbGx5IGluc2VydGVkLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGF0dGVtcHRzIHRvIGluc2VydCBhIChrZXksIHZhbHVlKSAlcGFpciBpbnRvIHRoZSAlbWFwLgorICAgICAgICogIEEgJW1hcCByZWxpZXMgb24gdW5pcXVlIGtleXMgYW5kIHRodXMgYSAlcGFpciBpcyBvbmx5IGluc2VydGVkIGlmIGl0cworICAgICAgICogIGZpcnN0IGVsZW1lbnQgKHRoZSBrZXkpIGlzIG5vdCBhbHJlYWR5IHByZXNlbnQgaW4gdGhlICVtYXAuCisgICAgICAgKgorICAgICAgICogIEluc2VydGlvbiByZXF1aXJlcyBsb2dhcml0aG1pYyB0aW1lLgorICAgICAgIC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WNoCisgICAgICAgKiAgdGhhdCBzdGQ6OnN3YXAobTEsbTIpIHdpbGwgZmVlZCB0byB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzd2FwKG1hcCYgX194KQorICAgICAgeyBfTV90LnN3YXAoX194Ll9NX3QpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEVyYXNlcyBhbGwgZWxlbWVudHMgaW4gYSAlbWFwLiAgTm90ZSB0aGF0IHRoaXMgZnVuY3Rpb24gb25seQorICAgICAgICogIGVyYXNlcyB0aGUgZWxlbWVudHMsIGFuZCB0aGF0IGlmIHRoZSBlbGVtZW50cyB0aGVtc2VsdmVzIGFyZQorICAgICAgICogIHBvaW50ZXJzLCB0aGUgcG9pbnRlZC10byBtZW1vcnkgaXMgbm90IHRvdWNoZWQgaW4gYW55IHdheS4KKyAgICAgICAqICBNYW5hZ2luZyB0aGUgcG9pbnRlciBpcyB0aGUgdXNlcidzIHJlc3BvbnNpYmlsaXR5LgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX3QuY2xlYXIoKTsgfQorCisgICAgICAvLyBvYnNlcnZlcnMKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgdGhlIGtleSBjb21wYXJpc29uIG9iamVjdCBvdXQgb2Ygd2hpY2ggdGhlICVtYXAgd2FzCisgICAgICAgKiAgY29uc3RydWN0ZWQuCisgICAgICAgKi8KKyAgICAgIGtleV9jb21wYXJlCisgICAgICBrZXlfY29tcCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV90LmtleV9jb21wKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHZhbHVlIGNvbXBhcmlzb24gb2JqZWN0LCBidWlsdCBmcm9tIHRoZSBrZXkgY29tcGFyaXNvbgorICAgICAgICogIG9iamVjdCBvdXQgb2Ygd2hpY2ggdGhlICVtYXAgd2FzIGNvbnN0cnVjdGVkLgorICAgICAgICovCisgICAgICB2YWx1ZV9jb21wYXJlCisgICAgICB2YWx1ZV9jb21wKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHZhbHVlX2NvbXBhcmUoX01fdC5rZXlfY29tcCgpKTsgfQorCisgICAgICAvLyBbMjMuMy4xLjNdIG1hcCBvcGVyYXRpb25zCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgVHJpZXMgdG8gbG9jYXRlIGFuIGVsZW1lbnQgaW4gYSAlbWFwLgorICAgICAgICogIEBwYXJhbSAgX194ICBLZXkgb2YgKGtleSwgdmFsdWUpICVwYWlyIHRvIGJlIGxvY2F0ZWQuCisgICAgICAgKiAgQHJldHVybiAgSXRlcmF0b3IgcG9pbnRpbmcgdG8gc291Z2h0LWFmdGVyIGVsZW1lbnQsIG9yIGVuZCgpIGlmIG5vdAorICAgICAgICogICAgICAgICAgIGZvdW5kLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHRha2VzIGEga2V5IGFuZCB0cmllcyB0byBsb2NhdGUgdGhlIGVsZW1lbnQgd2l0aCB3aGljaAorICAgICAgICogIHRoZSBrZXkgbWF0Y2hlcy4gIElmIHN1Y2Nlc3NmdWwgdGhlIGZ1bmN0aW9uIHJldHVybnMgYW4gaXRlcmF0b3IKKyAgICAgICAqICBwb2ludGluZyB0byB0aGUgc291Z2h0IGFmdGVyICVwYWlyLiAgSWYgdW5zdWNjZXNzZnVsIGl0IHJldHVybnMgdGhlCisgICAgICAgKiAgcGFzdC10aGUtZW5kICggQGMgZW5kKCkgKSBpdGVyYXRvci4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9feCkKKyAgICAgIHsgcmV0dXJuIF9NX3QuZmluZChfX3gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBUcmllcyB0byBsb2NhdGUgYW4gZWxlbWVudCBpbiBhICVtYXAuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSBvZiAoa2V5LCB2YWx1ZSkgJXBhaXIgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBSZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciBwb2ludGluZyB0byBzb3VnaHQtYWZ0ZXIKKyAgICAgICAqICAgICAgICAgICBlbGVtZW50LCBvciBlbmQoKSBpZiBub3QgZm91bmQuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gdGFrZXMgYSBrZXkgYW5kIHRyaWVzIHRvIGxvY2F0ZSB0aGUgZWxlbWVudCB3aXRoIHdoaWNoCisgICAgICAgKiAgdGhlIGtleSBtYXRjaGVzLiAgSWYgc3VjY2Vzc2Z1bCB0aGUgZnVuY3Rpb24gcmV0dXJucyBhIGNvbnN0YW50CisgICAgICAgKiAgaXRlcmF0b3IgcG9pbnRpbmcgdG8gdGhlIHNvdWdodCBhZnRlciAlcGFpci4gSWYgdW5zdWNjZXNzZnVsIGl0CisgICAgICAgKiAgcmV0dXJucyB0aGUgcGFzdC10aGUtZW5kICggQGMgZW5kKCkgKSBpdGVyYXRvci4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QuZmluZChfX3gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZHMgdGhlIG51bWJlciBvZiBlbGVtZW50cyB3aXRoIGdpdmVuIGtleS4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgS2V5IG9mIChrZXksIHZhbHVlKSBwYWlycyB0byBiZSBsb2NhdGVkLgorICAgICAgICogIEByZXR1cm4gIE51bWJlciBvZiBlbGVtZW50cyB3aXRoIHNwZWNpZmllZCBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gb25seSBtYW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S4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgS2V5IG9mIChrZXksIHZhbHVlKSBwYWlyIHRvIGJlIGxvY2F0ZWQuCisgICAgICAgKiAgQHJldHVybiBJdGVyYXRvciBwb2ludGluZyB0byB0aGUgZmlyc3QgZWxlbWVudAorICAgICAgICogICAgICAgICAgZ3JlYXRlciB0aGFuIGtleSwgb3IgZW5kKCkuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gX01fdC51cHBlcl9ib3VuZChfX3gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBGaW5kcyB0aGUgZW5kIG9mIGEgc3Vic2VxdWVuY2UgbWF0Y2hpbmcgZ2l2ZW4ga2V5LgorICAgICAgICogIEBwYXJhbSAgX194ICBLZXkgb2YgKGtleSwgdmFsdWUpIHBhaXIgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBSZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciBwb2ludGluZyB0byBmaXJzdCBpdGVyYXRvcgorICAgICAgICogICAgICAgICAgIGdyZWF0ZXIgdGhhbiBrZXksIG9yIGVuZCgpLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgdXBwZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QudXBwZXJfYm91bmQoX194KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRmluZHMgYSBzdWJzZXF1ZW5jZSBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSBvZiAoa2V5LCB2YWx1ZSkgcGFpcnMgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBQYWlyIG9mIGl0ZXJhdG9ycyB0aGF0IHBvc3NpYmx5IHBvaW50cyB0byB0aGUgc3Vic2VxdWVuY2UKKyAgICAgICAqICAgICAgICAgICBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gaXMgZXF1aXZhbGVudCB0bworICAgICAgICogIEBjb2RlCisgICAgICAgKiAgICBzdGQ6Om1ha2VfcGFpcihjLmxvd2VyX2JvdW5kKHZhbCksCisgICAgICAgKiAgICAgICAgICAgICAgICAgICBjLnVwcGVyX2JvdW5kKHZhbCkpCisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICAqICAoYnV0IGlzIGZhc3RlciB0aGFuIG1ha2luZyB0aGUgY2FsbHMgc2VwYXJhdGVseSkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcHJvYmFibHkgb25seSBtYWtlcyBzZW5zZSBmb3IgbXVsdGltYXBzLgorICAgICAgICovCisgICAgICBzdGQ6OnBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9feCkKKyAgICAgIHsgcmV0dXJuIF9NX3QuZXF1YWxfcmFuZ2UoX194KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRmluZHMgYSBzdWJzZXF1ZW5jZSBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSBvZiAoa2V5LCB2YWx1ZSkgcGFpcnMgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBQYWlyIG9mIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9ycyB0aGF0IHBvc3NpYmx5IHBvaW50cworICAgICAgICogICAgICAgICAgIHRvIHRoZSBzdWJzZXF1ZW5jZSBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gaXMgZXF1aXZhbGVudCB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yAgKi8KKyAgdGVtcGxhdGUgPHR5cGVuYW1lIF9LZXksIHR5cGVuYW1lIF9UcCwKKwkgICAgdHlwZW5hbWUgX0NvbXBhcmUgPSBzdGQ6Omxlc3M8X0tleT4sCisJICAgIHR5cGVuYW1lIF9BbGxvYyA9IHN0ZDo6YWxsb2NhdG9yPHN0ZDo6cGFpcjxjb25zdCBfS2V5LCBfVHA+ID4gPgorICAgIGNsYXNzIG11bHRpbWFwCisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgX0tleSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleV90eXBlOworICAgICAgdHlwZWRlZiBfVHAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGVkX3R5cGU7CisgICAgICB0eXBlZGVmIHN0ZDo6cGFpcjxjb25zdCBfS2V5LCBfVHA+ICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBfQ29tcGFyZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5X2NvbXBhcmU7CisgICAgICB0eXBlZGVmIF9BbGxvYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvY2F0b3JfdHlwZTsKKworICAgIHByaXZhdGU6CisgICAgICAvLyBjb25jZXB0IHJlcXVpcmVtZW50cworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQWxsb2M6OnZhbHVlX3R5cGUgICAgICAgICAgICAgICAgICAgX0FsbG9jX3ZhbHVlX3R5cGU7CisgICAgICBfX2dsaWJjeHhfY2xhc3NfcmVxdWlyZXMoX1RwLCBfU0dJQXNzaWduYWJsZUNvbmNlcHQpCisgICAgICBfX2dsaWJjeHhfY2xhc3NfcmVxdWlyZXM0KF9Db21wYXJlLCBib29sLCBfS2V5LCBfS2V5LAorCQkJCV9CaW5hcnlGdW5jdGlvbkNvbmNlcHQpCisgICAgICBfX2dsa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lcmF0b3IgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcjsKKworICAgICAgLy8gWzIzLjMuMl0gY29uc3RydWN0L2NvcHkvZGVzdHJveQorICAgICAgLy8gKGdldF9hbGxvY2F0b3IoKSBpcyBhbHNvIGxpc3RlZCBpbiB0aGlzIHNlY3Rpb24pCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIERlZmF1bHQgY29uc3RydWN0b3IgY3JlYXRlcyBubyBlbGVtZW50cy4KKyAgICAgICAqLworICAgICAgbXVsdGltYXAoKQorICAgICAgOiBfTV90KCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICVtdWx0aW1hcCB3aXRoIG5vIGVsZW1lbnRzLgorICAgICAgICogIEBwYXJhbSAgX19jb21wICBBIGNvbXBhcmlzb24gb2JqZWN0LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3Igb2JqZWN0LgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbXVsdGltYXAoY29uc3QgX0NvbXBhcmUmIF9fY29tcCwKKwkgICAgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9NX3QoX19jb21wLCBfUGFpcl9hbGxvY190eXBlKF9fYSkpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVNdWx0aW1hcCBjb3B5IGNvbnN0cnVjdG9yLgorICAgICAgICogIEBwYXJhbSAgX194ICBBICVtdWx0aW1hcCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgbmV3bHktY3JlYXRlZCAlbXVsdGltYXAgdXNlcyBhIGNvcHkgb2YgdGhlIGFsbG9jYXRpb24gb2JqZWN0CisgICAgICAgKiAgdXNlZCBieSBAYSBfX3guCisgICAgICAgKi8KKyAgICAgIG11bHRpbWFwKGNvbnN0IG11bHRpbWFwJiBfX3gpCisgICAgICA6IF9NX3QoX194Ll9NX3QpIHsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJU11bHRpbWFwIG1vdmUgY29uc3RydWN0b3IuCisgICAgICAgKiAgQHBhcmFtICAgX194ICBBICVtdWx0aW1hcCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgbmV3bHktY3JlYXRlZCAlbXVsdGltYXAgY29udGFpbnMgdGhlIGV4YWN0IGNvbnRlbnRzIG9mIEBhIF9feC4KKyAgICAgICAqICBUaGUgY29udGVudHMgb2YgQGEgX194IGFyZSBhIHZhbGlkLCBidXQgdW5zcGVjaWZpZWQgJW11bHRpbWFwLgorICAgICAgICovCisgICAgICBtdWx0aW1hcChtdWx0aW1hcCYmIF9feCkKKyAgICAgIG5vZXhjZXB0KGlzX25vdGhyb3dfY29weV9jb25zdHJ1Y3RpYmxlPF9Db21wYXJlPjo6dmFsdWUpCisgICAgICA6IF9NX3Qoc3RkOjptb3ZlKF9feC5fTV90KSkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnVpbGRzIGEgJW11bHRpbWFwIGZyb20gYW4gaW5pdGlhbGl6ZXJfbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fbCAgQW4gaW5pdGlhbGl6ZXJfbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fY29tcCAgQSBjb21wYXJpc29uIGZ1bmN0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFuIGFsbG9jYXRvciBvYmplY3QuCisgICAgICAgKgorICAgICAgICogIENyZWF0ZSBhICVtdWx0aW1hcCBjb25zaXN0aW5nIG9mIGNvcGllcyBvZiB0aGUgZWxlbWVudHMgZnJvbQorICAgICAgICogIHRoZSBpbml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G11bHRpbWFwJiBfX3gpCisgICAgICB7CisJX01fdCA9IF9feC5fTV90OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVNdWx0aW1hcCBtb3ZlIGFzc2lnbm1lbnQgb3BlcmF0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEEgJW11bHRpbWFwIG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IgdHlwZXMuCisgICAgICAgKgorICAgICAgICogIFRoZSBjb250ZW50cyBvZiBAYSBfX3ggYXJlIG1vdmVkIGludG8gdGhpcyBtdWx0aW1hcCAod2l0aG91dCBjb3B5aW5nKS4KKyAgICAgICAqICBAYSBfX3ggaXMgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkIG11bHRpbWFwLgorICAgICAgICovCisgICAgICBtdWx0aW1hcCYKKyAgICAgIG9wZXJhdG9yPShtdWx0aW1hcCYmIF9feCkKKyAgICAgIHsKKwkvLyBOQjogRFIgMTIwNC4KKwkvLyBOQjogRFIgNjc1LgorCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+c3dhcChfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICAlTXVsdGltYXAgbGlzdCBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX19sICBBbiBpbml0aWFsaXplcl9saXN0LgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGZpbGxzIGEgJW11bHRpbWFwIHdpdGggY29waWVzIG9mIHRoZSBlbGVtZW50cworICAgICAgICogIGluIHRoZSBpbml0aWFsaXplciBsaXN0IEBhIF9fbC4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZSB0aGF0IHRoZSBhc3NpZ25tZW50IGNvbXBsZXRlbHkgY2hhbmdlcyB0aGUgJW11bHRpbWFwIGFuZAorICAgICAgICogIHRoYXQgdGhlIHJlc3VsdGluZyAlbXVsdGltYXAncyBzaXplIGlzIHRoZSBzYW1lIGFzIHRoZSBudW1iZXIKKyAgICAgICAqICBvZiBlbGVtZW50cyBhc3NpZ25lZC4gIE9sZCBkYXRhIG1heSBiZSBsb3N0LgorICAgICAgICovCisgICAgICBtdWx0aW1hcCYKKyAgICAgIG9wZXJhdG9yPShpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCkKKyAgICAgIHsKKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPmluc2VydChfX2wuYmVnaW4oKSwgX19sLmVuZCgpKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisjZW5kaWYKKworICAgICAgLy8vIEdldCBhIGNvcHkgb2YgdGhlIG1lbW9yeSBhbGxvY2F0aW9uIG9iamVjdC4KKyAgICAgIGFsbG9jYXRvcl90eXBlCisgICAgICBnZXRfYWxsb2NhdG9yKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQgCisgICAgICB7IHJldHVybiBhbGxvY2F0b3JfdHlwZShfTV90LmdldF9hbGxvY2F0b3IoKSk7IH0KKworICAgICAgLy8gaXRlcmF0b3JzCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QgcGFpciBpbiB0aGUKKyAgICAgICAqICAlbXVsdGltYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBhc2NlbmRpbmcgb3JkZXIgYWNjb3JkaW5nIHRvIHRoZQorICAgICAgICogIGtleXMuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdCBwYWlyCisgICAgICAgKiAgaW4gdGhlICVtdWx0aW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlciBhY2NvcmRpbmcgdG8KKyAgICAgICAqICB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QuYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdCBwYWlyIGluCisgICAgICAgKiAgdGhlICVtdWx0aW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlciBhY2NvcmRpbmcgdG8gdGhlCisgICAgICAgKiAga2V5cy4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIHBhaXIgaW4gdGhlICVtdWx0aW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlciBhY2NvcmRpbmcKKyAgICAgICAqICB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gdGhlIGxhc3QgcGFpciBpbgorICAgICAgICogIHRoZSAlbXVsdGltYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0byB0aGUKKyAgICAgICAqICBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5yYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUKKyAgICAgICAqICBsYXN0IHBhaXIgaW4gdGhlICVtdWx0aW1hcC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGRlc2NlbmRpbmcgb3JkZXIKKyAgICAgICAqICBhY2NvcmRpbmcgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IKKyAgICAgIHJiZWdpbigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LnJiZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gb25lIGJlZm9yZSB0aGUKKyAgICAgICAqICBmaXJzdCBwYWlyIGluIHRoZSAlbXVsdGltYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyCisgICAgICAgKiAgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QucmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIG9uZQorICAgICAgICogIGJlZm9yZSB0aGUgZmlyc3QgcGFpciBpbiB0aGUgJW11bHRpbWFwLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4KKyAgICAgICAqICBkZXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LnJlbmQoKTsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QgcGFpcgorICAgICAgICogIGluIHRoZSAlbXVsdGltYXAuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBhc2NlbmRpbmcgb3JkZXIgYWNjb3JkaW5nIHRvCisgICAgICAgKiAgdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBjYmVnaW4oKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdC5iZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIHBhaXIgaW4gdGhlICVtdWx0aW1hcC4gIEl0ZXJhdGlvbiBpcy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aW1hcCBpcyBlbXB0eS4gICovCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVtcHR5KCk7IH0KKworICAgICAgLyoqIFJldHVybnMgdGhlIHNpemUgb2YgdGhlICVtdWx0aW1hcC4gICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5zaXplKCk7IH0KKworICAgICAgLyoqIFJldHVybnMgdGhlIG1heGltdW0gc2l6ZSBvZiB0aGUgJW11bHRpbWFwLiAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5tYXhfc2l6ZSgpOyB9CisKKyAgICAgIC8vIG1vZGlmaWVycworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEluc2VydHMgYSBzdGQ6OnBhaXIgaW50byB0aGUgJW11bHRpbWFwLgorICAgICAgICogIEBwYXJhbSAgX194ICBQYWlyIHRvIGJlIGluc2VydGVkIChzZWUgc3RkOjptYWtlX3BhaXIgZm9yIGVhc3kgY3JlYXRpb24KKyAgICAgICAqICAgICAgICAgICAgIG9mIHBhaXJzKS4KKyAgICAgICAqICBAcmV0dXJuIEFuIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBpbnNlcnRlZCAoa2V5LHZhbHVlKSBwYWlyLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGluc2VydHMgYSAoa2V5LCB2YWx1ZSkgcGFpciBpbnRvIHRoZSAlbXVsdGltYXAuCisgICAgICAgKiAgQ29udHJhcnkgdG8gYSBzdGQ6Om1hcCB0aGUgJW11bHRpbWFwIGRvZXMgbm90IHJlbHkgb24gdW5pcXVlIGtleXMgYW5kCisgICAgICAgKi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iB0aGUgcmFuZ2UgdG8gYmUKKyAgICAgICAqICAgICAgICAgICAgICAgICBlcmFzZWQuCisgICAgICAgKiAgQHBhcmFtIF9fbGFzdCBJdGVyYXRvciBwb2ludGluZyB0byB0aGUgZW5kIG9mIHRoZSByYW5nZSB0bworICAgICAgICogICAgICAgICAgICAgICAgYmUgZXJhc2VkLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGVyYXNlcyBhIHNlcXVlbmNlIG9mIGVsZW1lbnRzIGZyb20gYSAlbXVsdGltYXAuCisgICAgICAgKiAgTm90ZSB0aGF0IHRoaXMgZnVuY3Rpb24gb25seSBlcmFzZXMgdGhlIGVsZW1lbnRzLCBhbmQgdGhhdCBpZgorICAgICAgICogIHRoZSBlbGVtZW50cyB0aGVtc2VsdmVzIGFyZSBwb2ludGVycywgdGhlIHBvaW50ZWQtdG8gbWVtb3J5IGlzIG5vdAorICAgICAgICogIHRvdWNoZWQgaW4gYW55IHdheS4gIE1hbmFnaW5nIHRoZSBwb2ludGVyIGlzIHRoZSB1c2VyJ3MKKyAgICAgICAqICByZXNwb25zaWJpbGl0eS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19maXJzdCwgaXRlcmF0b3IgX19sYXN0KQorICAgICAgeyBfTV90LmVyYXNlKF9fZmlyc3QsIF9fbGFzdCk7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFN3YXBzIGRhdGEgd2l0aCBhbm90aGVyICVtdWx0aW1hcC4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlbXVsdGltYXAgb2YgdGhlIHNhbWUgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGV4Y2hhbmdlcyB0aGUgZWxlbWVudHMgYmV0d2VlbiB0d28gbXVsdGltYXBzIGluIGNvbnN0YW50IHRpbWUuCisgICAgICAgKiA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gY29tcGFyaXNvbiBvYmplY3Qgb3V0IG9mIHdoaWNoIHRoZSAlbXVsdGltYXAKKyAgICAgICAqICB3YXMgY29uc3RydWN0ZWQuCisgICAgICAgKi8KKyAgICAgIGtleV9jb21wYXJlCisgICAgICBrZXlfY29tcCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV90LmtleV9jb21wKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHZhbHVlIGNvbXBhcmlzb24gb2JqZWN0LCBidWlsdCBmcm9tIHRoZSBrZXkgY29tcGFyaXNvbgorICAgICAgICogIG9iamVjdCBvdXQgb2Ygd2hpY2ggdGhlICVtdWx0aW1hcCB3YXMgY29uc3RydWN0ZWQuCisgICAgICAgKi8KKyAgICAgIHZhbHVlX2NvbXBhcmUKKyAgICAgIHZhbHVlX2NvbXAoKSBjb25zdAorICAgICAgeyByZXR1cm4gdmFsdWVfY29tcGFyZShfTV90LmtleV9jb21wKCkpOyB9CisKKyAgICAgIC8vIG11bHRpbWFwIG9wZXJhdGlvbnMKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBUcmllcyB0byBsb2NhdGUgYW4gZWxlbWVudCBpbiBhICVtdWx0aW1hcC4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgS2V5IG9mIChrZXksIHZhbHVlKSBwYWlyIHRvIGJlIGxvY2F0ZWQuCisgICAgICAgKiAgQHJldHVybiAgSXRlcmF0b3IgcG9pbnRpbmcgdG8gc291Z2h0LWFmdGVyIGVsZW1lbnQsCisgICAgICAgKiAgICAgICAgICAgb3IgZW5kKCkgaWYgbm90IGZvdW5kLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHRha2VzIGEga2V5IGFuZCB0cmllcyB0byBsb2NhdGUgdGhlIGVsZW1lbnQgd2l0aCB3aGljaAorICAgICAgICogIHRoZSBrZXkgbWF0Y2hlcy4gIElmIHN1Y2Nlc3NmdWwgdGhlIGZ1bmN0aW9uIHJldHV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sgcmV0dXJuIF9NX3QubG93ZXJfYm91bmQoX194KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRmluZHMgdGhlIGVuZCBvZiBhIHN1YnNlcXVlbmNlIG1hdGNoaW5nIGdpdmVuIGtleS4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgS2V5IG9mIChrZXksIHZhbHVlKSBwYWlyIHRvIGJlIGxvY2F0ZWQuCisgICAgICAgKiAgQHJldHVybiBJdGVyYXRvciBwb2ludGluZyB0byB0aGUgZmlyc3QgZWxlbWVudAorICAgICAgICogICAgICAgICAgZ3JlYXRlciB0aGFuIGtleSwgb3IgZW5kKCkuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gX01fdC51cHBlcl9ib3VuZChfX3gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBGaW5kcyB0aGUgZW5kIG9mIGEgc3Vic2VxdWVuY2UgbWF0Y2hpbmcgZ2l2ZW4ga2V5LgorICAgICAgICogIEBwYXJhbSAgX194ICBLZXkgb2YgKGtleSwgdmFsdWUpIHBhaXIgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBSZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciBwb2ludGluZyB0byBmaXJzdCBpdGVyYXRvcgorICAgICAgICogICAgICAgICAgIGdyZWF0ZXIgdGhhbiBrZXksIG9yIGVuZCgpLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgdXBwZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QudXBwZXJfYm91bmQoX194KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRmluZHMgYSBzdWJzZXF1ZW5jZSBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSBvZiAoa2V5LCB2YWx1ZSkgcGFpcnMgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBQYWlyIG9mIGl0ZXJhdG9ycyB0aGF0IHBvc3NpYmx5IHBvaW50cyB0byB0aGUgc3Vic2VxdWVuY2UKKyAgICAgICAqICAgICAgICAgICBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gaXMgZXF1aXZhbGVudCB0bworICAgICAgICogIEBjb2RlCisgICAgICAgKiAgICBzdGQ6Om1ha2VfcGFpcihjLmxvd2VyX2JvdW5kKHZhbCksCisgICAgICAgKiAgICAgICAgICAgICAgICAgICBjLnVwcGVyX2JvdW5kKHZhbCkpCisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICAqICAoYnV0IGlzIGZhc3RlciB0aGFuIG1ha2luZyB0aGUgY2FsbHMgc2VwYXJhdGVseSkuCisgICAgICAgKi8KKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gX01fdC5lcXVhbF9yYW5nZShfX3gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBGaW5kcyBhIHN1YnNlcXVlbmNlIG1hdGNoaW5nIGdpdmVuIGtleS4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgS2V5IG9mIChrZXksIHZhbHVlKSBwYWlycyB0byBiZSBsb2NhdGVkLgorICAgICAgICogIEByZXR1cm4gIFBhaXIgb2YgcmVhZC1vbmx5IChjb25zdGFudCkgaXRlcmF0b3JzIHRoYXQgcG9zc2libHkgcG9pbnRzCisgICAgICAgKiAgICAgICAgICAgdG8gdGhlIHN1YnNlcXVlbmNlIG1hdGNoaW5nIGdpdmVuIGtleS4KKyAgICAgICAqCisgICAgICAgKi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gICAgICovCisgICAgICBtdWx0aXNldChpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCwKKwkgICAgICAgY29uc3QgX0NvbXBhcmUmIF9fY29tcCA9IF9Db21wYXJlKCksCisJICAgICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfTV90KF9fY29tcCwgX0tleV9hbGxvY190eXBlKF9fYSkpCisgICAgICB7IF9NX3QuX01faW5zZXJ0X2VxdWFsKF9fbC5iZWdpbigpLCBfX2wuZW5kKCkpOyB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICAlTXVsdGlzZXQgYXNzaWdubWVudCBvcGVyYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlbXVsdGlzZXQgb2YgaWRlbnRpY2FsIGVsZW1lbnQgYW5kIGFsbG9jYXRvciB0eXBlcy4KKyAgICAgICAqCisgICAgICAgKiAgQWxsIHRoZSBlbGVtZW50cyBvZiBAYSBfX3ggYXJlIGNvcGllZCwgYnV0IHVubGlrZSB0aGUgY29weQorICAgICAgICogIGNvbnN0cnVjdG9yLCB0aGUgYWxsb2NhdG9yIG9iamVjdCBpcyBub3QgY29waWVkLgorICAgICAgICovCisgICAgICBtdWx0aXNldCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBtdWx0aXNldCYgX194KQorICAgICAgeworCV9NX3QgPSBfX3guX01fdDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICAlTXVsdGlzZXQgbW92ZSBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX194ICBBICVtdWx0aXNldCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgY29udGVudHMgb2YgQGEgX194IGFyZSBtb3ZlZCBpbnRvIHRoaXMgJW11bHRpc2V0CisgICAgICAgKiAgKHdpdGhvdXQgY29weWluZykuICBAYSBfX3ggaXMgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkCisgICAgICAgKiAgJW11bHRpc2V0LgorICAgICAgICovCisgICAgICBtdWx0aXNldCYKKyAgICAgIG9wZXJhdG9yPShtdWx0aXNldCYmIF9feCkKKyAgICAgIHsKKwkvLyBOQjogRFIgMTIwNC4KKwkvLyBOQjogRFIgNjc1LgorCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+c3dhcChfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICAlTXVsdGlzZXQgbGlzdCBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX19sICBBbiBpbml0aWFsaXplcl9saXN0LgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGZpbGxzIGEgJW11bHRpc2V0IHdpdGggY29waWVzIG9mIHRoZSBlbGVtZW50cyBpbiB0aGUKKyAgICAgICAqICBpbml0aWFsaXplciBsaXN0IEBhIF9fbC4KKyAgICAgICAqCisgICAgICAgKiAgTm90ZSB0aGF0IHRoZSBhc3NpZ25tZW50IGNvbXBsZXRlbHkgY2hhbmdlcyB0aGUgJW11bHRpc2V0IGFuZAorICAgICAgICogIHRoYXQgdGhlIHJlc3VsdGluZyAlbXVsdGlzZXQncyBzaXplIGlzIHRoZSBzYW1lIGFzIHRoZSBudW1iZXIKKyAgICAgICAqICBvZiBlbGVtZW50cyBhc3NpZ25lZC4gIE9sZCBkYXRhIG1heSBiZSBsb3N0LgorICAgICAgICovCisgICAgICBtdWx0aXNldCYKKyAgICAgIG9wZXJhdG9yPShpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCkKKyAgICAgIHsKK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orICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVtdWx0aXNldC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlcgorICAgICAgICogIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGxhc3QgZWxlbWVudCBpbiB0aGUgJW11bHRpc2V0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gZGVzY2VuZGluZyBvcmRlcgorICAgICAgICogIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmJlZ2luKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QucmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gdGhlCisgICAgICAgKiAgbGFzdCBlbGVtZW50IGluIHRoZSAlbXVsdGlzZXQuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyCisgICAgICAgKiAgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QucmVuZCgpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVtdWx0aXNldC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlcgorICAgICAgICogIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGNiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV90LmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIG9uZSBwYXN0IHRoZSBsYXN0CisgICAgICAgKiAgZWxlbWVudCBpbiB0aGUgJW11bHRpc2V0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gYXNjZW5kaW5nIG9yZGVyCisgICAgICAgKiAgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgY2VuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGxhc3QgZWxlbWVudCBpbiB0aGUgJW11bHRpc2V0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gZGVzY2VuZGluZyBvcmRlcgorICAgICAgICogIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgY3JiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV90LnJiZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSByZXZlcnNlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGxhc3QgZWxlbWVudCBpbiB0aGUgJW11bHRpc2V0LiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gZGVzY2VuZGluZyBvcmRlcgorICAgICAgICogIGFjY29yZGluZyB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgY3JlbmQoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdC5yZW5kKCk7IH0KKyNlbmRpZgorCisgICAgICAvLy8gIFJldHVybnMgdHJ1ZSBpZiB0aGUgJXNldCBpcyBlbXB0eS4KKyAgICAgIGJvb2wKKyAgICAgIGVtcHR5KCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QuZW1wdHkoKTsgfQorCisgICAgICAvLy8gIFJldHVybnMgdGhlIHNpemUgb2YgdGhlICVzZXQuCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5zaXplKCk7IH0KKworICAgICAgLy8vICBSZXR1cm5zIHRoZSBtYXhpbXVtIHNpemUgb2YgdGhlICVzZXQuCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9zaXplKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QubWF4X3NpemUoKTsgfQorCisgICAgICAvKioKKy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1lbnRzIGluIGEgJW11bHRpc2V0LiAgTm90ZSB0aGF0IHRoaXMgZnVuY3Rpb24gb25seQorICAgICAgICogIGVyYXNlcyB0aGUgZWxlbWVudHMsIGFuZCB0aGF0IGlmIHRoZSBlbGVtZW50cyB0aGVtc2VsdmVzIGFyZSBwb2ludGVycywKKyAgICAgICAqICB0aGUgcG9pbnRlZC10byBtZW1vcnkgaXMgbm90IHRvdWNoZWQgaW4gYW55IHdheS4gIE1hbmFnaW5nIHRoZSBwb2ludGVyCisgICAgICAgKiAgaXMgdGhlIHVzZXIncyByZXNwb25zaWJpbGl0eS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgY2xlYXIoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyBfTV90LmNsZWFyKCk7IH0KKworICAgICAgLy8gbXVsdGlzZXQgb3BlcmF0aW9uczoKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEZpbmRzIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgd2l0aCBnaXZlbiBrZXkuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSBvZiBlbGVtZW50cyB0byBiZSBsb2NhdGVkLgorICAgICAgICogIEByZXR1cm4gTnVtYmVyIG9mIGVsZW1lbnRzIHdpdGggc3BlY2lmaWVkIGtleS4KKyAgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBjb3VudChjb25zdCBrZXlfdHlwZSYgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gX01fdC5jb3VudChfX3gpOyB9CisKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIDIxNC4gIHNldDo6ZmluZCgpIG1pc3NpbmcgY29uc3Qgb3ZlcmxvYWQKKyAgICAgIC8vQHsKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBUcmllcyB0byBsb2NhdGUgYW4gZWxlbWVudCBpbiBhICVzZXQuCisgICAgICAgKiAgQHBhcmFtICBf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dGVyYXRvcgorICAgICAgdXBwZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9feCkKKyAgICAgIHsgcmV0dXJuIF9NX3QudXBwZXJfYm91bmQoX194KTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgdXBwZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QudXBwZXJfYm91bmQoX194KTsgfQorICAgICAgLy9AfQorCisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRmluZHMgYSBzdWJzZXF1ZW5jZSBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEtleSB0byBiZSBsb2NhdGVkLgorICAgICAgICogIEByZXR1cm4gIFBhaXIgb2YgaXRlcmF0b3JzIHRoYXQgcG9zc2libHkgcG9pbnRzIHRvIHRoZSBzdWJzZXF1ZW5jZQorICAgICAgICogICAgICAgICAgIG1hdGNoaW5nIGdpdmVuIGtleS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBpcyBlcXVpdmFsZW50IHRvCisgICAgICAgKiAgQGNvZGUKKyAgICAgICAqICAgIHN0ZDo6bWFrZV9wYWlyKGMubG93ZXJfYm91bmQodmFsKSwKKyAgICAgICAqICAgICAgICAgICAgICAgICAgIGMudXBwZXJfYm91bmQodmFsKSkKKyAgICAgICAqICBAZW5kY29kZQorICAgICAgICogIChidXQgaXMgZmFzdGVyIHRoYW4gbWFraW5nIHRoZSBjYWxscyBzZXBhcmF0ZWx5KS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBwcm9iYWJseSBvbmx5IG1ha2VzIHNlbnNlIGZvciBtdWx0aXNldHMuCisgICAgICAgKi8KKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHl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5KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGMuZW1wdHkoKTsgfQorCisgICAgICAvKiogIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGUgJXF1ZXVlLiAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBjLnNpemUoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZWZlcmVuY2UgdG8gdGhlIGRhdGEgYXQgdGhlIGZpcnN0CisgICAgICAgKiAgZWxlbWVudCBvZiB0aGUgJXF1ZXVlLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGZyb250KCkKKyAgICAgIHsKKwlfX2dsaWJjeHhfcmVxdWlyZXNfbm9uZW1wdHkoKTsKKwlyZXR1cm4gYy5mcm9udCgpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgb2YgdGhlICVxdWV1ZS4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBmcm9udCgpIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX25vbmVtcHR5KCk7CisJcmV0dXJuIGMuZnJvbnQoKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBsYXN0CisgICAgICAgKiAgZWxlbWVudCBvZiB0aGUgJXF1ZXVlLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19ub25lbXB0eSgpOworCXJldHVybiBjLmJhY2so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ZSAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfU2VxdWVuY2U6OnJlZmVyZW5jZSAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfU2VxdWVuY2U6OmNvbnN0X3JlZmVyZW5jZSAgICAgICAgICAgY29uc3RfcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfU2VxdWVuY2U6OnNpemVfdHlwZSAgICAgICAgICAgICAgICAgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiAgICAgICAgICBfU2VxdWVuY2UgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbmVyX3R5cGU7CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICAvLyAgU2VlIHF1ZXVlOjpjIGZvciBub3RlcyBvbiB0aGVzZSBuYW1lcy4KKyAgICAgIF9TZXF1ZW5jZSAgYzsKKyAgICAgIF9Db21wYXJlICAgY29tcDsKKworICAgIHB1YmxpYzoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRGVmYXVsdCBjb25zdHJ1Y3RvciBjcmVhdGVzIG5vIGVsZW1lbnRzLgorICAgICAgICovCisjaWZuZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICBleHBsaWNpdAorICAgICAgcHJpb3JpdHlfcXVldWUoY29uc3QgX0NvbXBhcmUmIF9feCA9IF9Db21wYXJlKCksCisJCSAgICAgY29uc3QgX1NlcXVlbmNlJiBfX3MgPSBfU2VxdWVuY2UoKSkKKyAgICAgIDogYyhfX3MpLCBjb21wKF9feCkKKyAgICAgIHsgc3RkOjptYWtlX2hlYXAoYy5iZWdpbigpLCBjLmVuZCgpLCBjb21wKTsgfQorI2Vsc2UKKyAgICAgIGV4cGxpY2l0CisgICAgICBwcmlvcml0eV9xdWV1ZShjb25zdCBfQ29tcGFyZSYgX194LAorCQkgICAgIGNvbnN0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2YgdGhlICVxdWV1ZS4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICB0b3AoKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19ub25lbXB0eSgpOworCXJldHVybiBjLmZyb250KCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQWRkIGRhdGEgdG8gdGhlICVxdWV1ZS4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgRGF0YSB0byBiZSBhZGRlZC4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyBhIHR5cGljYWwgJXF1ZXVlIG9wZXJhdGlvbi4KKyAgICAgICAqICBUaGUgdGltZSBjb21wbGV4aXR5IG9mIHRoZSBvcGVyYXRpb24gZGVwZW5kcyBvbiB0aGUgdW5kZXJseWluZworICAgICAgICogIHNlcXVlbmNlLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBwdXNoKGNvbnN0IHZhbHVlX3R5cGUmIF9feCkKKyAgICAgIHsKKwljLnB1c2hfYmFjayhfX3gpOworCXN0ZDo6cHVzaF9oZWFwKGMuYmVnaW4oKSwgYy5lbmQoKSwgY29tcCk7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdm9pZAorICAgICAgcHVzaCh2YWx1ZV90eXBlJiYgX194KQorICAgICAgeworCWMucHVzaF9iYWNrKHN0ZDo6bW92ZShfX3gpKTsKKwlzdGQ6OnB1c2hfaGVhcChjLmJlZ2luKCksIGMuZW5kKCksIGNvbXApOworICAgICAgfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKyAgICAgICAgdm9pZAorICAgICAgICBlbXBsYWNlKF9BcmdzJiYuLi4gX19hcmdzKQorCXsKKwkgIGMuZW1wbGFjZV9iYWNrKHN0ZDo6Zm9yd2FyZDxfQXJncz4oX19hcmdzKS4uLik7CisJICBzdGQ6OnB1c2hfaGVhcChjLmJlZ2luKCksIGMuZW5kKCksIGNvbXApOworCX0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJlbW92ZXMgZmlyc3QgZWxlbWVudC4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyBhIHR5cGljYWwgJXF1ZXVlIG9wZXJhdGlvbi4gIEl0IHNocmlua3MgdGhlICVxdWV1ZQorICAgICAgICogIGJ5IG9uZS4gIFRoZSB0aW1lIGNvbXBsZXhpdHkgb2YgdGhlIG9wZXJhdGlvbiBkZXBlbmRzIG9uIHRoZQorICAgICAgICogIHVuZGVybHlpbmcgc2VxdWVuY2UuCisgICAgICAgKgorICAgICAgICogIE5vdGUgdGhhdCBubyBkYXRhIGlzIHJldHVybmVkLCBhbmQgaWYgdGhlIGZpcnN0IGVsZW1lbnQncworICAgICAgICogIGRhdGEgaXMgbmVlZGVkLCBpdCBzaG91bGQgYmUgcmV0cmlldmVkIGJlZm9yZSBwb3AoKSBpcworICAgICAgICogIGNhbGxlZC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcG9wKCkKKyAgICAgIHsKKwlfX2dsaWJjeHhfcmVxdWlyZXNfbm9uZW1wdHkoKTsKKwlzdGQ6OnBvcF9oZWFwKGMuYmVnaW4oKSwgYy5lbmQoKSwgY29tcCk7CisJYy5wb3BfYmFjaygpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHZvaWQKKyAgICAgIHN3YXAocHJpb3JpdHlfcXVldWUmIF9fcHEpCisgICAgICBub2V4Y2VwdChub2V4Y2VwdChzd2FwKGMsIF9fcHEuYykpICYmIG5vZXhjZXB0KHN3YXAoY29tcCwgX19wcS5jb21wKSkpCisgICAgICB7CisJdXNpbmcgc3RkOjpzd2FwOworCXN3YXAoYywgX19wcS5jKTsKKwlzd2FwKGNvbXAsIF9fcHEuY29tcCk7CisgICAgICB9CisjZW5kaWYKK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0uCisgICAgICogIEBwYXJhbSAgX194ICBBIHRoaW5nLgorICAgICAqICBAcGFyYW0gIF9feSAgQW5vdGhlciB0aGluZy4KKyAgICAgKiAgQHJldHVybiAgIF9feCAhPSBfX3kKKyAgICAgKgorICAgICAqICBUaGlzIGZ1bmN0aW9uIHVzZXMgQGMgPT0gdG8gZGV0ZXJtaW5lIGl0cyByZXN1bHQuCisgICAgICovCisgICAgdGVtcGxhdGUgPGNsYXNzIF9UcD4KKyAgICAgIGlubGluZSBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IF9UcCYgX194LCBjb25zdCBfVHAmIF9feSkKKyAgICAgIHsgcmV0dXJuICEoX194ID09IF9feSk7IH0KKworICAgIC8qKgorICAgICAqICBAYnJpZWYgRGVmaW5lcyBAYyA+IGZvciBhcmJpdHJhcnkgdHlwZXMsIGluIHRlcm1zIG9mIEBjIDwuCisgICAgICogIEBwYXJhbSAgX194ICBBIHRoaW5nLgorICAgICAqICBAcGFyYW0gIF9feSAgQW5vdGhlciB0aGluZy4KKyAgICAgKiAgQHJldHVybiAgIF9feCA+IF9feQorICAgICAqCisgICAgICogIFRoaXMgZnVuY3Rpb24gdXNlcyBAYyA8IHRvIGRldGVybWluZSBpdHMgcmVzdWx0LgorICAgICAqLworICAgIHRlbXBsYXRlIDxjbGFzcyBfVHA+CisgICAgICBpbmxpbmUgYm9vbAorICAgICAgb3BlcmF0b3I+KGNvbnN0IF9UcCYgX194LCBjb25zdCBfVHAmIF9feSkKKyAgICAgIHsgcmV0dXJuIF9feSA8IF9feDsgfQorCisgICAgLyoqCisgICAgICogIEBicmllZiBEZWZpbmVzIEBjIDw9IGZvciBhcmJpdHJhcnkgdHlwZXMsIGluIHRlcm1zIG9mIEBjIDwuCisgICAgICogIEBwYXJhbSAgX194ICBBIHRoaW5nLgorICAgICAqICBAcGFyYW0gIF9feSAgQW5vdGhlciB0aGluZy4KKyAgICAgKiAgQHJldHVybiAgIF9feCA8PSBfX3kKKyAgICAgKgorICA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hdGlvbgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBEZWZhdWx0IGNvbnN0cnVjdG9yIGNyZWF0ZXMgbm8gZWxlbWVudHMuCisgICAgICAgKi8KKyAgICAgIHNldCgpCisgICAgICA6IF9NX3QoKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDcmVhdGVzIGEgJXNldCB3aXRoIG5vIGVsZW1lbnRzLgorICAgICAgICogIEBwYXJhbSAgX19jb21wICBDb21wYXJhdG9yIHRvIHVzZS4KKyAgICAgICAqICBAcGFyYW0gIF9fYSAgQW4gYWxsb2NhdG9yIG9iamVjdC4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIHNldChjb25zdCBfQ29tcGFyZSYgX19jb21wLAorCSAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9NX3QoX19jb21wLCBfS2V5X2FsbG9jX3R5cGUoX19hKSkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnVpbGRzIGEgJXNldCBmcm9tIGEgcmFuZ2UuCisgICAgICAgKiAgQHBhcmFtICBfX2ZpcnN0ICBBbiBpbnB1dCBpdGVyYXRvci4KKyAgICAgICAqICBAcGFyYW0gIF9fbGFzdCAgQW4gaW5wdXQgaXRlcmF0b3IuCisgICAgICAgKgorICAgICAgICogIENyZWF0ZSBhICVzZXQgY29uc2lzdGluZyBvZiBjb3BpZXMgb2YgdGhlIGVsZW1lbnRzIGZyb20KKyAgICAgICAqICBbX19maXJzdCxfX2xhc3QpLiAgVGhpcyBpcyBsaW5lYXIgaW4gTiBpZiB0aGUgcmFuZ2UgaXMKKyAgICAgICAqICBhbHJlYWR5IHNvcnRlZCwgYW5kIE5sb2dOIG90aGVyd2lzZSAod2hlcmUgTiBpcworICAgICAgICogIGRpc3RhbmNlKF9fZmlyc3QsX19sYXN0KSkuCisgICAgICAgKi8KKyAgICAgIH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oX19jb21wLCBfS2V5X2FsbG9jX3R5cGUoX19hKSkKKyAgICAgICAgeyBfTV90Ll9NX2luc2VydF91bmlxdWUoX19maXJzdCwgX19sYXN0KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVTZXQgY29weSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAlc2V0IG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IgdHlwZXMuCisgICAgICAgKgorICAgICAgICogIFRoZSBuZXdseS1jcmVhdGVkICVzZXQgdXNlcyBhIGNvcHkgb2YgdGhlIGFsbG9jYXRpb24gb2JqZWN0IHVzZWQKKyAgICAgICAqICBieSBAYSBfX3guCisgICAgICAgKi8KKyAgICAgIHNldChjb25zdCBzZXQmIF9feCkKKyAgICAgIDogX01fdChfX3guX01fdCkgeyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgJVNldCBtb3ZlIGNvbnN0cnVjdG9yCisgICAgICAgKiAgQHBhcmFtIF9feCAgQSAlc2V0IG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IgdHlwZXMuCisgICAgICAgKgorICAgICAgICogIFRoZSBuZXdseS1jcmVhdGVkICVzZXQgY29udGFpbnMgdGhlIGV4YWN0IGNvbnRlbnRzIG9mIEBhIHguCisgICAgICAgKiAgVGhlIGNvbnRlbnRzIG9mIEBhIHggYXJlIGEgdmFsaWQsIGJ1dCB1bnNwZWNpZmllZCAlc2V0LgorICAgICAgICovCisgICAgICBzZXQoc2V0JiYgX194KQorICAgICAgbm9leGNlcHQoaXNfbm90aHJvd19jb3B5X2NvbnN0cnVjdGlibGU8X0NvbXBhcmU+Ojp2YWx1ZSkKKyAgICAgIDogX01fdChzdGQ6Om1vdmUoX194Ll9NX3QpKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQG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dCB1bmxpa2UgdGhlIGNvcHkKKyAgICAgICAqICBjb25zdHJ1Y3RvciwgdGhlIGFsbG9jYXRvciBvYmplY3QgaXMgbm90IGNvcGllZC4KKyAgICAgICAqLworICAgICAgc2V0JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHNldCYgX194KQorICAgICAgeworCV9NX3QgPSBfX3guX01fdDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICVTZXQgbW92ZSBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSBfX3ggIEEgJXNldCBvZiBpZGVudGljYWwgZWxlbWVudCBhbmQgYWxsb2NhdG9yIHR5cGVzLgorICAgICAgICoKKyAgICAgICAqICBUaGUgY29udGVudHMgb2YgQGEgX194IGFyZSBtb3ZlZCBpbnRvIHRoaXMgJXNldCAod2l0aG91dCBjb3B5aW5nKS4KKyAgICAgICAqICBAYSBfX3ggaXMgYSB2YWxpZCwgYnV0IHVuc3BlY2lmaWVkICVzZXQuCisgICAgICAgKi8KKyAgICAgIHNldCYKKyAgICAgIG9wZXJhdG9yPShzZXQmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPnN3YXAoX194KTsKKyAgICAgIAlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJVNldCBsaXN0IGFzc2lnbm1lbnQgb3BlcmF0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX2wgIEFuIGluaXRpYWxpemVyX2xpc3QuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gZmlsbHMgYSAlc2V0IHdpdGggY29waWVzIG9mIHRoZSBlbGVtZW50cyBpbiB0aGUKKyAgICAgICA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3JfdHlwZQorICAgICAgZ2V0X2FsbG9jYXRvcigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBhbGxvY2F0b3JfdHlwZShfTV90LmdldF9hbGxvY2F0b3IoKSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVzZXQuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBhc2NlbmRpbmcgb3JkZXIgYWNjb3JkaW5nCisgICAgICAgKiAgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIG9uZSBwYXN0IHRoZSBsYXN0CisgICAgICAgKiAgZWxlbWVudCBpbiB0aGUgJXNldC4gIEl0ZXJhdGlvbiBpcyBkb25lIGluIGFzY2VuZGluZyBvcmRlciBhY2NvcmRpbmcKKyAgICAgICAqICB0byB0aGUga2V5cy4KKyAgICAgICAqLworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV90LmVuZCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVzZXQuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyIGFjY29yZGluZworICAgICAgICogIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdC5yYmVnaW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmV2ZXJzZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUKKyAgICAgICAqICBsYXN0IHBhaXIgaW4gdGhlICVzZXQuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBkZXNjZW5kaW5nIG9yZGVyCisgICAgICAgKiAgYWNjb3JkaW5nIHRvIHRoZSBrZXlzLgorICAgICAgICovCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIF9NX3QucmVuZCgpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICVzZXQuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBhc2NlbmRpbmcgb3JkZXIgYWNjb3JkaW5nCisgICAgICAgKiAgdG8gdGhlIGtleXMuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBjYmVnaW4oKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdC5iZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0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GVjaWFsaXplZCBzdWNoCisgICAgICAgKiAgdGhhdCBzdGQ6OnN3YXAoczEsczIpIHdpbGwgZmVlZCB0byB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzd2FwKHNldCYgX194KQorICAgICAgeyBfTV90LnN3YXAoX194Ll9NX3QpOyB9CisKKyAgICAgIC8vIGluc2VydC9lcmFzZQorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEF0dGVtcHRzIHRvIGluc2VydCBhbiBlbGVtZW50IGludG8gdGhlICVzZXQuCisgICAgICAgKiAgQHBhcmFtICBfX3ggIEVsZW1lbnQgdG8gYmUgaW5zZXJ0ZWQuCisgICAgICAgKiAgQHJldHVybiAgQSBwYWlyLCBvZiB3aGljaCB0aGUgZmlyc3QgZWxlbWVudCBpcyBhbiBpdGVyYXRvciB0aGF0IHBvaW50cworICAgICAgICogICAgICAgICAgIHRvIHRoZSBwb3NzaWJseSBpbnNlcnRlZCBlbGVtZW50LCBhbmQgdGhlIHNlY29uZCBpcyBhIGJvb2wKKyAgICAgICAqICAgICAgICAgICB0aGF0IGlzIHRydWUgaWYgdGhlIGVsZW1lbnQgd2FzIGFjdHVhbGx5IGluc2VydGVkLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIGF0dGVtcHRzIHRvIGluc2VydCBhbiBlbGVtZW50IGludG8gdGhlICVzZXQuICBBICVzZXQKKyAgICAgICAqICByZWxpZXMgb24gdW5pcXVlIGtleXMgYW5kIHRodXMgYW4gZWxlbWVudCBpcyBvbmx5IGluc2VydGVkIGlmIGl0IGlzCisgICAgICAgKiAgbm90IGFscmVhZHkgcHJlc2VudCBpbiB0aGUgJXNldC4KKyAgICAgICAqCisgICAgICAgKiAgSW5zZXJ0aW9uIHJlcXVpcmVzIGxvZ2FyaXRobWljIHRpbWUuCisgICAgICAgKi8KKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgYm9vbD4KKyAgICAgIG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2VsdmVzIGFyZSBwb2ludGVycywgdGhlCisgICAgICAgKiAgcG9pbnRlZC10byBtZW1vcnkgaXMgbm90IHRvdWNoZWQgaW4gYW55IHdheS4gIE1hbmFnaW5nIHRoZSBwb2ludGVyIGlzCisgICAgICAgKiAgdGhlIHVzZXIncyByZXNwb25zaWJpbGl0eS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgY2xlYXIoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyBfTV90LmNsZWFyKCk7IH0KKworICAgICAgLy8gc2V0IG9wZXJhdGlvbnM6CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZHMgdGhlIG51bWJlciBvZiBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgRWxlbWVudCB0byBsb2NhdGVkLgorICAgICAgICogIEByZXR1cm4gIE51bWJlciBvZiBlbGVtZW50cyB3aXRoIHNwZWNpZmllZCBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gb25seSBtYWtlcyBzZW5zZSBmb3IgbXVsdGlzZXRzOyBmb3Igc2V0IHRoZSByZXN1bHQgd2lsbAorICAgICAgICogIGVpdGhlciBiZSAwIChub3QgcHJlc2VudCkgb3IgMSAocHJlc2VudCkuCisgICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QuZmluZChfX3gpID09IF9NX3QuZW5kKCkgPyAwIDogMTsgfQorCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyAyMTQuICBzZXQ6OmZpbmQoKSBtaXNzaW5nIGNvbnN0IG92ZXJsb2FkCisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgVHJpZXMgdG8gbG9jYXRlIGFuIGVsZW1lbnQgaW4gYSAlc2V0LgorICAgICAgICogIEBwYXJhbSAgX194ICBFbGVtZW50IHRvIGJlIGxvY2F0ZWQuCisgICAgICAgKiAgQHJldHVybiAgSXRlcmF0b3IgcG9pbnRpbmcgdG8gc291Z2h0LWFmdGVyIGVsZW1lbnQsIG9yIGVuZCgpIGlmIG5vdAorICAgICAgICogICAgICAgICAgIGZvdW5kLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHRha2VzIGEga2V5IGFuZCB0cmllcyB0byBsb2NhdGUgdGhlIGVsZW1lbnQgd2l0aCB3aGljaAorICAgICAgICogIHRoZSBrZXkgbWF0Y2hlcy4gIElmIHN1Y2Nlc3NmdWwgdGhlIGZ1bmN0aW9uIHJldHVybnMgYW4gaXRlcmF0b3IKKyAgICAgICAqICBwb2ludGluZyB0byB0aGUgc291Z2h0IGFmdGVyIGVsZW1lbnQuICBJZiB1bnN1Y2Nlc3NmdWwgaXQgcmV0dXJucyB0aGUKKyAgICAgICAqICBwYXN0LXRoZS1lbmQgKCBAYyBlbmQoKSApIGl0ZXJhdG9yLgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gX01fdC5maW5kKF9feCk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3QuZmluZChfX3gpOyB9CisgICAgICAvL0B9CisKKyAgICAgIC8vQHsKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBGaW5kcyB0aGUgYmVnaW5uaW5nIG9mIGEgc3Vic2VxdWVuY2UgbWF0Y2hpbmcgZ2l2ZW4ga2V5LgorICAgICAgICogIEBwYXJhbSAgX194ICBLZXkgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBJdGVyYXRvciBwb2ludGluZyB0byBmaXJzdCBlbGVtZW50IGVx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ICAgICAgaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpCisgICAgICB7IHJldHVybiBfTV90LnVwcGVyX2JvdW5kKF9feCk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV90LnVwcGVyX2JvdW5kKF9feCk7IH0KKyAgICAgIC8vQH0KKworICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEZpbmRzIGEgc3Vic2VxdWVuY2UgbWF0Y2hpbmcgZ2l2ZW4ga2V5LgorICAgICAgICogIEBwYXJhbSAgX194ICBLZXkgdG8gYmUgbG9jYXRlZC4KKyAgICAgICAqICBAcmV0dXJuICBQYWlyIG9mIGl0ZXJhdG9ycyB0aGF0IHBvc3NpYmx5IHBvaW50cyB0byB0aGUgc3Vic2VxdWVuY2UKKyAgICAgICAqICAgICAgICAgICBtYXRjaGluZyBnaXZlbiBrZXkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gaXMgZXF1aXZhbGVudCB0bworICAgICAgICogIEBjb2RlCisgICAgICAgKiAgICBzdGQ6Om1ha2VfcGFpcihjLmxvd2VyX2JvdW5kKHZhbCksCisgICAgICAgKiAgICAgICAgICAgICAgICAgICBjLnVwcGVyX2JvdW5kKHZhbCkpCisgICAgICAgKiAgQGVuZGNvZGUKKyAgICAgICAqICAoYnV0IGlzIGZhc3RlciB0aGFuIG1ha2luZyB0aGUgY2FsbHMgc2VwYXJhdGVseSkuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gcHJvYmFibHkgb25seSBtYWtlcyBzZW5zZSBmb3IgbXVsdGlzZXRzLgorICAgICAgICovCisgICAgICBzdGQ6OnBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2Uo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lY3RlZDoKKyAgICAgIC8vICBTZWUgcXVldWU6OmMgZm9yIG5vdGVzIG9uIHRoaXMgbmFtZS4KKyAgICAgIF9TZXF1ZW5jZSBjOworCisgICAgcHVibGljOgorICAgICAgLy8gWFhYIHJlbW92ZWQgb2xkIGRlZiBjdG9yLCBhZGRlZCBkZWYgYXJnIHRvIHRoaXMgb25lIHRvIG1hdGNoIDE0ODgyCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIERlZmF1bHQgY29uc3RydWN0b3IgY3JlYXRlcyBubyBlbGVtZW50cy4KKyAgICAgICAqLworI2lmbmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgZXhwbGljaXQKKyAgICAgIHN0YWNrKGNvbnN0IF9TZXF1ZW5jZSYgX19jID0gX1NlcXVlbmNlKCkpCisgICAgICA6IGMoX19jKSB7IH0KKyNlbHNlCisgICAgICBleHBsaWNpdAorICAgICAgc3RhY2soY29uc3QgX1NlcXVlbmNlJiBfX2MpCisgICAgICA6IGMoX19jKSB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIHN0YWNrKF9TZXF1ZW5jZSYmIF9fYyA9IF9TZXF1ZW5jZSgpKQorICAgICAgOiBjKHN0ZDo6bW92ZShfX2MpKSB7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIHRydWUgaWYgdGhlICVzdGFjayBpcyBlbXB0eS4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgZW1wdHkoKSBjb25zdAorICAgICAgeyByZXR1cm4gYy5lbXB0eSgpOyB9CisKKyAgICAgIC8qKiAgUmV0dXJucyB0aGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoZSAlc3RhY2suICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBzaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGMuc2l6ZSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL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sdWVfdHlwZSYgX194KQorICAgICAgeyBjLnB1c2hfYmFjayhfX3gpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdm9pZAorICAgICAgcHVzaCh2YWx1ZV90eXBlJiYgX194KQorICAgICAgeyBjLnB1c2hfYmFjayhzdGQ6Om1vdmUoX194KSk7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3M+CisgICAgICAgIHZvaWQKKyAgICAgICAgZW1wbGFjZShfQXJncyYmLi4uIF9fYXJncykKKwl7IGMuZW1wbGFjZV9iYWNrKHN0ZDo6Zm9yd2FyZDxfQXJncz4oX19hcmdzKS4uLik7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJlbW92ZXMgZmlyc3QgZWxlbWVudC4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyBhIHR5cGljYWwgJXN0YWNrIG9wZXJhdGlvbi4gIEl0IHNocmlua3MgdGhlICVzdGFjaworICAgICAgICogIGJ5IG9uZS4gIFRoZSB0aW1lIGNvbXBsZXhpdHkgb2YgdGhlIG9wZXJhdGlvbiBkZXBlbmRzIG9uIHRoZQorICAgICAgICogIHVuZGVybHlpbmcgc2VxdWVuY2UuCisgICAgICAgKgorICAgICAgICogIE5vdGUgdGhhdCBubyBkYXRhIGlzIHJldHVybmVkLCBhbmQgaWYgdGhlIGZpcnN0IGVsZW1lbnQncworICAgICAgICogIGRhdGEgaXMgbmVlZGVkLCBpdCBzaG91bGQgYmUgcmV0cmlldmVkIGJlZm9yZSBwb3AoKSBpcworICAgICAgICogIGNhbGxlZC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcG9wKCkKKyAgICAgIHsKKwlfX2dsaWJjeHhfcmVxdWlyZXNfbm9uZW1wdHkoKTsKKwljLnBvcF9iYWNrKCk7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxf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ZmllbGQ7IH0KKworICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKHN0YXRpY19jYXN0PF9MaW5rX3R5cGU+CisJCQkJKF9NX25vZGUpLT5fTV92YWx1ZV9maWVsZCk7IH0KKworICAgICAgX1NlbGYmCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwlfTV9ub2RlID0gX1JiX3RyZWVfaW5jcmVtZW50KF9NX25vZGUpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NlbGYKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworCV9TZWxmIF9fdG1wID0gKnRoaXM7CisJX01fbm9kZSA9IF9SYl90cmVlX2luY3JlbWVudChfTV9ub2RlKTsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIF9TZWxmJgorICAgICAgb3BlcmF0b3ItLSgpCisgICAgICB7CisJX01fbm9kZSA9IF9SYl90cmVlX2RlY3JlbWVudChfTV9ub2RlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvci0tKGludCkKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCV9NX25vZGUgPSBfUmJfdHJlZV9kZWNyZW1lbnQoX01fbm9kZSk7CisJcmV0dXJuIF9fdG1wOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IF9TZWxmJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ub2RlID09IF9feC5fTV9ub2RlOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgX1NlbGYmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX25vZGUgIT0gX194Ll9NX25vZGU7IH0KKworICAgICAgX0Jhc2VfcHRyIF9NX25vZGU7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AgIHsgcmV0dXJuIGl0ZXJhdG9yKHN0YXRpY19jYXN0PHR5cGVuYW1lIGl0ZXJhdG9yOjpfTGlua190eXBlPgorCQkJKGNvbnN0X2Nhc3Q8dHlwZW5hbWUgaXRlcmF0b3I6Ol9CYXNlX3B0cj4oX01fbm9kZSkpKTsgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxfTGlua190eXBlPihfTV9ub2RlKS0+X01fdmFsdWVfZmllbGQ7IH0KKworICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKHN0YXRpY19jYXN0PF9MaW5rX3R5cGU+CisJCQkJKF9NX25vZGUpLT5fTV92YWx1ZV9maWVsZCk7IH0KKworICAgICAgX1NlbGYmCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwlfTV9ub2RlID0gX1JiX3RyZWVfaW5jcmVtZW50KF9NX25vZGUpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NlbGYKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworCV9TZWxmIF9fdG1wID0gKnRoaXM7CisJX01fbm9kZSA9IF9SYl90cmVlX2luY3JlbWVudChfTV9ub2RlKTsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIF9TZWxmJgorICAgICAgb3BlcmF0b3ItLSgpCisgICAgICB7CisJX01fbm9kZSA9IF9SYl90cmVlX2RlY3JlbWVudChfTV9ub2RlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvci0tKGludCkKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCV9NX25vZGUgPSBfUmJfdHJlZV9kZWNyZW1lbnQoX01fbm9kZSk7CisJcmV0dXJuIF9fdG1wOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IF9TZWxmJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9ub2RlID09IF9feC5fTV9ub2RlOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgX1NlbGYmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX25vZGUgIT0gX194Ll9NX25vZGU7IH0KKworICAgICAgX0Jhc2VfcHRyIF9NX25vZGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVmFsPgorICAgIGlubGluZSBib29sCisgICAgb3BlcmF0b3I9PShjb25zdCBfUmJfdHJlZV9pdGVyYXRvcjxfVmFsPiYgX194LAorICAgICAgICAgICAgICAgY29uc3QgX1JiX3RyZWVfY29uc3RfaXRlcmF0b3I8X1ZhbD4mIF9feSkKKyAgICB7IHJldHVybiBfX3guX01fbm9kZSA9PSBfX3kuX01fbm9kZTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9WYWw+CisgICAgaW5saW5lIGJvb2wKKyAgICBvcGVyYXRvciE9KGNvbnN0IF9SYl90cmVlX2l0ZXJhdG9yPF9WYWw+JiBfX3gsCisgICAgICAgICAgICAgICBjb25zdCBfUmJfdHJlZV9jb25zdF9pdGVyYXRvcjxfVmFsPiYgX195KQorICAgIHsgcmV0dXJuIF9feC5fTV9ub2RlICE9IF9feS5fTV9ub2RlOyB9CisKKyAgdm9pZAorICBfUmJfdHJlZV9pbnNlcnRfYW5kX3JlYmFsYW5jZShjb25zdCBib29sIF9faW5zZXJ0X2xlZnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9SYl90cmVlX25vZGVfYmFzZSogX194LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfUmJfdHJlZV9ub2RlX2Jhc2UqIF9fcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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QorCSAgICB7CisJICAgICAgX01fcHV0X25vZGUoX190bXApOworCSAgICAgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworCSAgICB9CisJICByZXR1cm4gX190bXA7CisJfQorCisgICAgICB2b2lkCisgICAgICBfTV9kZXN0cm95X25vZGUoX0xpbmtfdHlwZSBfX3ApCisgICAgICB7CisJX01fZ2V0X05vZGVfYWxsb2NhdG9yKCkuZGVzdHJveShfX3ApOworCV9NX3B1dF9ub2RlKF9fcCk7CisgICAgICB9CisjZW5kaWYKKworICAgICAgX0xpbmtfdHlwZQorICAgICAgX01fY2xvbmVfbm9kZShfQ29uc3RfTGlua190eXBlIF9feCkKKyAgICAgIHsKKwlfTGlua190eXBlIF9fdG1wID0gX01fY3JlYXRlX25vZGUoX194LT5fTV92YWx1ZV9maWVsZCk7CisJX190bXAtPl9NX2NvbG9yID0gX194LT5fTV9jb2xvcjsKKwlfX3RtcC0+X01fbGVmdCA9IDA7CisJX190bXAtPl9NX3JpZ2h0ID0gMDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfS2V5X2NvbXBhcmUsIAorCSAgICAgICBib29sIF9Jc19wb2RfY29tcGFyYXRvciA9IF9faXNfcG9kKF9LZXlfY29tcGFyZSk+CisgICAgICAgIHN0cnVjdCBfUmJfdHJlZV9pbXBsIDogcHVibGljIF9Ob2RlX2FsbG9jYXRvcgorICAgICAgICB7CisJICBfS2V5X2NvbXBhcmUJCV9NX2tleV9jb21wYXJlOworCSAgX1JiX3RyZWVfbm9kZV9iYXNlIAlfTV9oZWFkZXI7CisJICBzaXplX3R5cGUgCQlfTV9ub2RlX2NvdW50OyAvLyBLZWVwcyB0cmFjayBvZiBzaXplIG9mIHRyZWUuCisKKwkgIF9SYl90cmVlX2ltcGwoKQorCSAgOiBfTm9kZV9hbGxvY2F0b3IoKSwgX01fa2V5X2NvbXBhcmUoKSwgX01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JldHVybiB0aGlzLT5fTV9pbXBsLl9NX2hlYWRlci5fTV9wYXJlbnQ7IH0KKworICAgICAgX0NvbnN0X0Jhc2VfcHRyCisgICAgICBfTV9yb290KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX2ltcGwuX01faGVhZGVyLl9NX3BhcmVudDsgfQorCisgICAgICBfQmFzZV9wdHImCisgICAgICBfTV9sZWZ0bW9zdCgpCisgICAgICB7IHJldHVybiB0aGlzLT5fTV9pbXBsLl9NX2hlYWRlci5fTV9sZWZ0OyB9CisKKyAgICAgIF9Db25zdF9CYXNlX3B0cgorICAgICAgX01fbGVmdG1vc3QoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faW1wbC5fTV9oZWFkZXIuX01fbGVmdDsgfQorCisgICAgICBfQmFzZV9wdHImCisgICAgICBfTV9yaWdodG1vc3QoKQorICAgICAgeyByZXR1cm4gdGhpcy0+X01faW1wbC5fTV9oZWFkZXIuX01fcmlnaHQ7IH0KKworICAgICAgX0NvbnN0X0Jhc2VfcHRyCisgICAgICBfTV9yaWdodG1vc3QoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faW1wbC5fTV9oZWFkZXIuX01fcmlnaHQ7IH0KKworICAgICAgX0xpbmtfdHlwZQorICAgICAgX01fYmVnaW4oKQorICAgICAgeyByZXR1cm4gc3RhdGljX2Nhc3Q8X0xpbmtfdHlwZT4odGhpcy0+X01faW1wbC5fTV9oZWFkZXIuX01fcGFyZW50KTsgfQorCisgICAgICBfQ29uc3RfTGlua190eXBlCisgICAgICBfTV9iZWdpbigpIGNvbnN0CisgICAgICB7CisJcmV0dXJuIHN0YXRpY19jYXN0PF9Db25zdF9MaW5rX3R5cGU+CisJICAodGhpcy0+X01faW1wbC5fTV9oZWFkZXIuX01fcGFyZW50KTsKKyAgICAgIH0KKworICAgICAgX0xpbmtfdHlwZQorICAgICAgX01fZW5kKCkKKyAgICAgIHsgcmV0dXJuIHN0YXR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yBpbiBhc3NvY2lhdGl2ZSBjb250YWluZXJzLgorICAgICAgaXRlcmF0b3IKKyAgICAgIF9NX2luc2VydF9sb3dlcihfQmFzZV9wdHIgX194LCBfQmFzZV9wdHIgX195LCBjb25zdCB2YWx1ZV90eXBlJiBfX3YpOworCisgICAgICBpdGVyYXRvcgorICAgICAgX01faW5zZXJ0X2VxdWFsX2xvd2VyKGNvbnN0IHZhbHVlX3R5cGUmIF9feCk7CisjZW5kaWYKKworICAgICAgX0xpbmtfdHlwZQorICAgICAgX01fY29weShfQ29uc3RfTGlua190eXBlIF9feCwgX0xpbmtfdHlwZSBfX3ApOworCisgICAgICB2b2lkCisgICAgICBfTV9lcmFzZShfTGlua190eXBlIF9feCk7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBfTV9sb3dlcl9ib3VuZChfTGlua190eXBlIF9feCwgX0xpbmtfdHlwZSBfX3ksCisJCSAgICAgY29uc3QgX0tleSYgX19rKTsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIF9NX2xvd2VyX2JvdW5kKF9Db25zdF9MaW5rX3R5cGUgX194LCBfQ29uc3RfTGlua190eXBlIF9feSwKKwkJICAgICBjb25zdCBfS2V5JiBfX2spIGNvbnN0OworCisgICAgICBpdGVyYXRvcgorICAgICAgX01fdXBwZXJfYm91bmQoX0xpbmtfdHlwZSBfX3gsIF9MaW5rX3R5cGUgX195LAorCQkgICAgIGNvbnN0IF9LZXkmIF9fayk7CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBfTV91cHBlcl9ib3VuZChfQ29uc3RfTGlua190eXBlIF9feCwgX0NvbnN0X0xpbmtfdHlwZSBfX3ksCisJCSAgICAgY29uc3QgX0tleSYgX19rKSBjb25zdDsKKworICAgIHB1YmxpYzoKKyAgICAgIC8vIGFsbG9jYXRpb24vZGVhbGxvY2F0aW9uCisgICAgICBfUmJfdHJlZSgpIHsgfQorCisgICAgICBfUmJfdHJlZShjb25zdCBfQ29tcGFyZSYgX19jb21wLAorCSAgICAgICBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgIDogX01faW1wbChfX2NvbXAsIF9Ob2RlX2FsbG9jYXRvcihfX2EpKSB7IH0KKworICAgICAgX1JiX3RyZWUoY29uc3QgX1JiX3RyZWUmIF9feCkKKyAgICAgIDogX01faW1wbChfX3guX01faW1wbC5fTV9rZXlfY29tcGFyZSwgX194Ll9NX2dldF9Ob2RlX2FsbG9jYXRvcigpKQorICAgICAgeworCWlmIChfX3guX01fcm9vdCgpICE9IDApCisJICB7CisJICAgIF9NX3Jvb3QoKSA9IF9NX2NvcHkoX194Ll9NX2JlZ2luKCksIF9NX2VuZCgpKTsKKwkgICAgX01fbGVmdG1vc3QoKSA9IF9TX21pbmltdW0oX01fcm9vdCgpKTsKKwkgICAgX01fcmlnaHRtb3N0KCkgPSBfU19tYXhpbXVtKF9NX3Jvb3QoKSk7CisJICAgIF9NX2ltcGwuX01fbm9kZV9jb3VudCA9IF9feC5fTV9pbXBsLl9NX25vZGVfY291bnQ7CisJICB9CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgX1JiX3RyZWUoX1JiX3RyZWUmJiBfX3gpOworI2VuZGlmCisKKyAgICAgIH5fUmJfdHJlZSgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX2VyYXNlKF9NX2JlZ2luKCkpOyB9CisKKyAgICAgIF9SYl90cmVlJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IF9SYl90cmVlJiBfX3gpOworCisgICAgICAvLyBBY2Nlc3NvcnMuCisgICAgICBfQ29tcGFyZQorICAgICAga2V5X2NvbXAoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faW1wbC5fTV9rZXlfY29tcGFyZTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAor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CkgPSBfTV9lbmQoKTsKKyAgICAgICAgX01faW1wbC5fTV9ub2RlX2NvdW50ID0gMDsKKyAgICAgIH0KKworICAgICAgLy8gU2V0IG9wZXJhdGlvbnMuCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rKTsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBsb3dlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX19rKQorICAgICAgeyByZXR1cm4gX01fbG93ZXJfYm91bmQoX01fYmVnaW4oKSwgX01fZW5kKCksIF9fayk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGxvd2VyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX2spIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9sb3dlcl9ib3VuZChfTV9iZWdpbigpLCBfTV9lbmQoKSwgX19rKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgdXBwZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9faykKKyAgICAgIHsgcmV0dXJuIF9NX3VwcGVyX2JvdW5kKF9NX2JlZ2luKCksIF9NX2VuZCgpLCBfX2spOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX19rKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fdXBwZXJfYm91bmQoX01fYmVnaW4oKSwgX01fZW5kKCksIF9fayk7IH0KKworICAgICAgcGFpcjxpdGVyYXRvciwgaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHlwZSYgX19rKTsKKworICAgICAgcGFpcjxjb25zdF9pdGV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FTlRBTF9DWFgwWF9fCisgICAgX01faW5zZXJ0X3VuaXF1ZShfQXJnJiYgX192KQorI2Vsc2UKKyAgICBfTV9pbnNlcnRfdW5pcXVlKGNvbnN0IF9WYWwmIF9fdikKKyNlbmRpZgorICAgIHsKKyAgICAgIF9MaW5rX3R5cGUgX194ID0gX01fYmVnaW4oKTsKKyAgICAgIF9MaW5rX3R5cGUgX195ID0gX01fZW5kKCk7CisgICAgICBib29sIF9fY29tcCA9IHRydWU7CisgICAgICB3aGlsZSAoX194ICE9IDApCisJeworCSAgX195ID0gX194OworCSAgX19jb21wID0gX01faW1wbC5fTV9rZXlfY29tcGFyZShfS2V5T2ZWYWx1ZSgpKF9fdiksIF9TX2tleShfX3gpKTsKKwkgIF9feCA9IF9fY29tcCA/IF9TX2xlZnQoX194KSA6IF9TX3JpZ2h0KF9feCk7CisJfQorICAgICAgaXRlcmF0b3IgX19qID0gaXRlcmF0b3IoX195KTsKKyAgICAgIGlmIChfX2NvbXApCisJeworCSAgaWYgKF9faiA9PSBiZWdpbigpKQorCSAgICByZXR1cm4gcGFpcjxpdGVyYXRvciwgYm9vbD4KKwkgICAgICAoX01faW5zZXJ0XyhfX3gsIF9feSwgX0dMSUJDWFhfRk9SV0FSRChfQXJnLCBfX3YpKSwgdHJ1ZSk7CisJICBlbHNlCisJICAgIC0tX19qOworCX0KKyAgICAgIGlmIChfTV9pbXBsLl9NX2tleV9jb21wYXJlKF9TX2tleShfX2ouX01fbm9kZSksIF9LZXlPZlZhbHVlKCkoX192KSkpCisJcmV0dXJuIHBhaXI8aXRlcmF0b3IsIGJvb2w+CisJICAoX01faW5zZXJ0XyhfX3gsIF9feSwgX0dMSUJDWFhfRk9SV0FSRChfQXJnLCBfX3YpKSwgdHJ1ZSk7CisgICAgICByZXR1cm4gcGFpcjxpdGVyYXRvciwgYm9vbD4oX19qLCBmYWxzZSk7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9LZXksIHR5cGVuYW1lIF9WY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BAYnJpZWYgIENyZWF0ZXMgYSAldmVjdG9yIHdpdGggbm8gZWxlbWVudHMuCisgICAgICAgKiAgQHBhcmFtICBfX2EgIEFuIGFsbG9jYXRvciBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICB2ZWN0b3IoY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSkKKyAgICAgIDogX0Jhc2UoX19hKSB7IH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENyZWF0ZXMgYSAldmVjdG9yIHdpdGggZGVmYXVsdCBjb25zdHJ1Y3RlZCBlbGVtZW50cy4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgVGhlIG51bWJlciBvZiBlbGVtZW50cyB0byBpbml0aWFsbHkgY3JlYXRlLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGNvbnN0cnVjdG9yIGZpbGxzIHRoZSAldmVjdG9yIHdpdGggQGEgX19uIGRlZmF1bHQKKyAgICAgICAqICBjb25zdHJ1Y3RlZCBlbGVtZW50cy4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIHZlY3RvcihzaXplX3R5cGUgX19uKQorICAgICAgOiBfQmFzZShfX24pCisgICAgICB7IF9NX2RlZmF1bHRfaW5pdGlhbGl6ZShfX24pOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ3JlYXRlcyBhICV2ZWN0b3Igd2l0aCBjb3BpZXMgb2YgYW4gZXhlbXBsYXIgZWxlbWVudC4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgVGhlIG51bWJlciBvZiBlbGVtZW50cyB0byBpbml0aWFsbHkgY3JlYXRlLgorICAgICAgICogIEBwYXJhbSAgX192YWx1ZSAgQW4gZWxlbWVudCB0byBjb3B5LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3IuCisgICAgICAgKgorICAgIC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ioKKyAgICAgICAqICBAYnJpZWYgICVWZWN0b3IgY29weSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqICBAcGFyYW0gIF9feCAgQSAldmVjdG9yIG9mIGlkZW50aWNhbCBlbGVtZW50IGFuZCBhbGxvY2F0b3IgdHlwZXMuCisgICAgICAgKgorICAgICAgICogIFRoZSBuZXdseS1jcmVhdGVkICV2ZWN0b3IgdXNlcyBhIGNvcHkgb2YgdGhlIGFsbG9jYXRpb24KKyAgICAgICAqICBvYmplY3QgdXNlZCBieSBAYSBfX3guICBBbGwgdGhlIGVsZW1lbnRzIG9mIEBhIF9feCBhcmUgY29waWVkLAorICAgICAgICogIGJ1dCBhbnkgZXh0cmEgbWVtb3J5IGluCisgICAgICAgKiAgQGEgX194IChmb3IgZmFzdCBleHBhbnNpb24pIHdpbGwgbm90IGJlIGNvcGllZC4KKyAgICAgICAqLworICAgICAgdmVjdG9yKGNvbnN0IHZlY3RvciYgX194KQorICAgICAgOiBfQmFzZShfX3guc2l6ZSgpLAorICAgICAgICBfQWxsb2NfdHJhaXRzOjpfU19zZWxlY3Rfb25fY29weShfX3guX01fZ2V0X1RwX2FsbG9jYXRvcigpKSkKKyAgICAgIHsgdGhpcy0+X01faW1wbC5fTV9maW5pc2ggPQorCSAgc3RkOjpfX3VuaW5pdGlhbGl6ZWRfY29weV9hKF9feC5iZWdpbigpLCBfX3guZW5kKCksCisJCQkJICAgICAgdGhpcy0+X01faW1wbC5fTV9zdGFydCwKKwkJCQkgICAgICBfTV9nZXRfVHBfYWxsb2NhdG9yKCkpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgJVZlY3RvciBtb3ZlIGNvbnN0cnVjdG9yLgorICAgICAgICogIEBwYXJhbSAgX194ICBBICV2ZWN0b3Igb2YgaWRlbnRpY2FsIGVsZW1lbnQgYW5kIGFsbG9jYXRvciB0eXBlcy4KKyAgICA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CgpLAorCQkJCQkgIHRoaXMtPl9NX2ltcGwuX01fc3RhcnQsCisJCQkJCSAgX01fZ2V0X1RwX2FsbG9jYXRvcigpKTsKKwkgICAgX19ydi5jbGVhcigpOworCSAgfQorICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEJ1aWxkcyBhICV2ZWN0b3IgZnJvbSBhbiBpbml0aWFsaXplciBsaXN0LgorICAgICAgICogIEBwYXJhbSAgX19sICBBbiBpbml0aWFsaXplcl9saXN0LgorICAgICAgICogIEBwYXJhbSAgX19hICBBbiBhbGxvY2F0b3IuCisgICAgICAgKgorICAgICAgICogIENyZWF0ZSBhICV2ZWN0b3IgY29uc2lzdGluZyBvZiBjb3BpZXMgb2YgdGhlIGVsZW1lbnRzIGluIHRoZQorICAgICAgICogIGluaXRpYWxpemVyX2xpc3QgQGEgX19sLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIHdpbGwgY2FsbCB0aGUgZWxlbWVudCB0eXBlJ3MgY29weSBjb25zdHJ1Y3RvciBOIHRpbWVzCisgICAgICAgKiAgKHdoZXJlIE4gaXMgQGEgX19sLnNpemUoKSkgYW5kIGRvIG5vIG1lbW9yeSByZWFsbG9jYXRpb24uCisgICAgICAgKi8KKyAgICAgIHZlY3Rvcihpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCwKKwkgICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2EpCisgICAgICB7CisJX01fcmFuZ2VfaW5pdGlhbGl6ZShfX2wuYmVnaW4oKSwgX19sLmVuZCgpLAorCQkJICAgIHJhbmRvbV9hY2Nlc3NfaXRlcmF0b3JfdGFnKCkpOworICAgICAgfQorI2VuZGlmCisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQnVpbGRzIGEgJXZlY3RvciBmcm9tIGEgcmFuZ2UuCisgICAgICAgKiAgQHBhcmF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gZXhwYW5zaW9uKSB3aWxsIG5vdCBiZSBjb3BpZWQuICBVbmxpa2UgdGhlCisgICAgICAgKiAgY29weSBjb25zdHJ1Y3RvciwgdGhlIGFsbG9jYXRvciBvYmplY3QgaXMgbm90IGNvcGllZC4KKyAgICAgICAqLworICAgICAgdmVjdG9yJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHZlY3RvciYgX194KTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgICVWZWN0b3IgbW92ZSBhc3NpZ25tZW50IG9wZXJhdG9yLgorICAgICAgICogIEBwYXJhbSAgX194ICBBICV2ZWN0b3Igb2YgaWRlbnRpY2FsIGVsZW1lbnQgYW5kIGFsbG9jYXRvciB0eXBlcy4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIGNvbnRlbnRzIG9mIEBhIF9feCBhcmUgbW92ZWQgaW50byB0aGlzICV2ZWN0b3IgKHdpdGhvdXQgY29weWluZywKKyAgICAgICAqICBpZiB0aGUgYWxsb2NhdG9ycyBwZXJtaXQgaXQpLgorICAgICAgICogIEBhIF9feCBpcyBhIHZhbGlkLCBidXQgdW5zcGVjaWZpZWQgJXZlY3Rvci4KKyAgICAgICAqLworICAgICAgdmVjdG9yJgorICAgICAgb3BlcmF0b3I9KHZlY3RvciYmIF9feCkgbm9leGNlcHQoX0FsbG9jX3RyYWl0czo6X1Nfbm90aHJvd19tb3ZlKCkpCisgICAgICB7CisgICAgICAgIGNvbnN0ZXhwciBib29sIF9fbW92ZV9zdG9yYWdlID0KKyAgICAgICAgICBfQWxsb2NfdHJhaXRzOjpfU19wcm9wYWdhdGVfb25fbW92ZV9hc3NpZ24oKQorICAgICAgICAgIHx8IF9BbGxvY190cmFpdHM6Ol9TX2Fsd2F5c19lcXVhbCgpOworICAgICAgICBfTV9tb3ZlX2Fzc2lnbihzdGQ6Om1vdmUoX194KSwKKyAgICAgICAgICAgICAgICAg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W1iZXIKKyAgICAgICAqICBvZiBlbGVtZW50cyBhc3NpZ25lZC4gIE9sZCBkYXRhIG1heSBiZSBsb3N0LgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBhc3NpZ24oaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wpCisgICAgICB7IHRoaXMtPmFzc2lnbihfX2wuYmVnaW4oKSwgX19sLmVuZCgpKTsgfQorI2VuZGlmCisKKyAgICAgIC8vLyBHZXQgYSBjb3B5IG9mIHRoZSBtZW1vcnkgYWxsb2NhdGlvbiBvYmplY3QuCisgICAgICB1c2luZyBfQmFzZTo6Z2V0X2FsbG9jYXRvcjsKKworICAgICAgLy8gaXRlcmF0b3JzCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyB0byB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IGluIHRoZSAldmVjdG9yLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gb3JkaW5hcnkKKyAgICAgICAqICBlbGVtZW50IG9yZGVyLgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9zdGFydCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGZpcnN0IGVsZW1lbnQgaW4gdGhlICV2ZWN0b3IuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBvcmRpbmFyeQorICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcih0aGlzLT5fTV9pbXBsLl9NX3N0YXJ0KTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgaW4gdGhlICV2ZWN0b3IuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBvcmRpbmFyeQorICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBlbmQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9maW5pc2gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdAorICAgICAgICogIHRoZSBsYXN0IGVsZW1lbnQgaW4gdGhlICV2ZWN0b3IuICBJdGVyYXRpb24gaXMgZG9uZSBpbgorICAgICAgICogIG9yZGluYXJ5IGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9maW5pc2gpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gdGhlCisgICAgICAgKiAgbGFzdCBlbGVtZW50IGluIHRoZSAldmVjdG9yLiAgSXRlcmF0aW9uIGlzIGRvbmUgaW4gcmV2ZXJzZQorICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgI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hlICV2ZWN0b3IuICBJdGVyYXRpb24KKyAgICAgICAqICBpcyBkb25lIGluIHJldmVyc2UgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKGJlZ2luKCkpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZQorICAgICAgICogIGZpcnN0IGVsZW1lbnQgaW4gdGhlICV2ZWN0b3IuICBJdGVyYXRpb24gaXMgZG9uZSBpbiBvcmRpbmFyeQorICAgICAgICogIGVsZW1lbnQgb3JkZXIuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBjYmVnaW4oKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9zdGFydCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIG9uZSBwYXN0CisgICAgICAgKiAgdGhlIGxhc3QgZWxlbWVudCBpbiB0aGUgJXZlY3Rvci4gIEl0ZXJhdGlvbiBpcyBkb25lIGluCisgICAgICAgKiAgb3JkaW5hcnkgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGNlbmQoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IodGhpcy0+X01faW1wbC5fTV9maW5pc2gpOyB9CisKK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FN1YnNjcmlwdCBhY2Nlc3MgdG8gdGhlIGRhdGEgY29udGFpbmVkIGluIHRoZSAldmVjdG9yLgorICAgICAgICogIEBwYXJhbSBfX24gVGhlIGluZGV4IG9mIHRoZSBlbGVtZW50IGZvciB3aGljaCBkYXRhIHNob3VsZCBiZQorICAgICAgICogIGFjY2Vzc2VkLgorICAgICAgICogIEByZXR1cm4gIFJlYWQvd3JpdGUgcmVmZXJlbmNlIHRvIGRhdGEuCisgICAgICAgKgorICAgICAgICogIFRoaXMgb3BlcmF0b3IgYWxsb3dzIGZvciBlYXN5LCBhcnJheS1zdHlsZSwgZGF0YSBhY2Nlc3MuCisgICAgICAgKiAgTm90ZSB0aGF0IGRhdGEgYWNjZXNzIHdpdGggdGhpcyBvcGVyYXRvciBpcyB1bmNoZWNrZWQgYW5kCisgICAgICAgKiAgb3V0X29mX3JhbmdlIGxvb2t1cHMgYXJlIG5vdCBkZWZpbmVkLiAoRm9yIGNoZWNrZWQgbG9va3VwcworICAgICAgICogIHNlZSBhdCgpLikKKyAgICAgICAqLworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdHlwZSBfX24pCisgICAgICB7IHJldHVybiAqKHRoaXMtPl9NX2ltcGwuX01fc3RhcnQgKyBfX24pOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU3Vic2NyaXB0IGFjY2VzcyB0byB0aGUgZGF0YSBjb250YWluZWQgaW4gdGhlICV2ZWN0b3IuCisgICAgICAgKiAgQHBhcmFtIF9fbiBUaGUgaW5kZXggb2YgdGhlIGVsZW1lbnQgZm9yIHdoaWNoIGRhdGEgc2hvdWxkIGJlCisgICAgICAgKiAgYWNjZXNzZWQuCisgICAgICAgKiAgQHJldHVybiAgUmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIGRhdGEuCisgICAgICAgKgorICAgICAgICogIFRoaXMgb3BlcmF0b3IgYWxsb3dzIGZvciBlYXN5LCBhcnJheS1zdHlsZSwgZGF0YSBhY2Nlc3MuCisgICAgICAgKiAgTm90ZSB0aGF0IGRhdGEgYWNjZXNzIHdpdGggdGhpcyBvcGVyYXRvciBpcyB1bmNoZWNrZWQgYW5kCisgICAgICAgKiAgb3V0X29mX3JhbmdlIGxvb2t1cHMgYXJlIG5vdCBkZWZpbmVkLiAoRm9yIGNoZWNrZWQgbG9va3VwcworICAgICAgICogIHNlZSBhdCgpLikKKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiAqKHRoaXMtPl9NX2ltcGwuX01fc3RhcnQgKyBfX24pOyB9CisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICAvLy8gU2FmZXR5IGNoZWNrIHVzZWQgb25seSBmcm9tIGF0KCkuCisgICAgICB2b2lkCisgICAgICBfTV9yYW5nZV9jaGVjayhzaXplX3R5cGUgX19uKSBjb25zdAorICAgICAgeworCWlmIChfX24gPj0gdGhpcy0+c2l6ZSgpKQorCSAgX190aHJvd19vdXRfb2ZfcmFuZ2UoX19OKCJ2ZWN0b3I6Ol9NX3JhbmdlX2NoZWNrIikpOworICAgICAgfQorCisgICAgcHVibGljOgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBQcm92aWRlcyBhY2Nlc3MgdG8gdGhlIGRhdGEgY29udGFpbmVkIGluIHRoZSAldmVjdG9yLgorICAgICAgICogIEBwYXJhbSBfX24gVGhlIGluZGV4IG9mIHRoZSBlbGVtZW50IGZvciB3aGljaCBkYXRhIHNob3VsZCBiZQorICAgICAgICogIGFjY2Vzc2VkLgorICAgICAgICogIEByZXR1cm4gIFJlYWQvd3JpdGUgcmVmZXJlbmNlIHRvIGRhdGEuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om91dF9vZl9yYW5nZSAgSWYgQGEgX19uIGlzIGFuIGludmFsaWQgaW5kZXguCisgICAgICAgKgorICAgICAgICog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scy4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBhdChzaXplX3R5cGUgX19uKSBjb25zdAorICAgICAgeworCV9NX3JhbmdlX2NoZWNrKF9fbik7CisJcmV0dXJuICgqdGhpcylbX19uXTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQvd3JpdGUgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZSBmaXJzdAorICAgICAgICogIGVsZW1lbnQgb2YgdGhlICV2ZWN0b3IuCisgICAgICAgKi8KKyAgICAgIHJlZmVyZW5jZQorICAgICAgZnJvbnQoKQorICAgICAgeyByZXR1cm4gKmJlZ2luKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgZmlyc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAldmVjdG9yLgorICAgICAgICovCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUgbGFzdAorICAgICAgICogIGVsZW1lbnQgb2YgdGhlICV2ZWN0b3IuCisgICAgICAgKi8KKyAgICAgIHJlZmVyZW5jZQorICAgICAgYmFjaygpCisgICAgICB7IHJldHVybiAqKGVuZCgpIC0gMSk7IH0KKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIHJlZmVyZW5jZSB0byB0aGUgZGF0YSBhdCB0aGUKKyAgICAgICAqICBsYXN0IGVsZW1lbnQgb2YgdGhlICV2ZWN0b3IuCisgICAgICAgKi8KKyAgICAgIGNvbn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LgorICAgICAgICovCisgICAgICBpdGVyYXRvcgorICAgICAgZXJhc2UoaXRlcmF0b3IgX19wb3NpdGlvbik7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmVtb3ZlIGEgcmFuZ2Ugb2YgZWxlbWVudHMuCisgICAgICAgKiAgQHBhcmFtICBfX2ZpcnN0ICBJdGVyYXRvciBwb2ludGluZyB0byB0aGUgZmlyc3QgZWxlbWVudCB0byBiZSBlcmFzZWQuCisgICAgICAgKiAgQHBhcmFtICBfX2xhc3QgIEl0ZXJhdG9yIHBvaW50aW5nIHRvIG9uZSBwYXN0IHRoZSBsYXN0IGVsZW1lbnQgdG8gYmUKKyAgICAgICAqICAgICAgICAgICAgICAgICAgZXJhc2VkLgorICAgICAgICogIEByZXR1cm4gIEFuIGl0ZXJhdG9yIHBvaW50aW5nIHRvIHRoZSBlbGVtZW50IHBvaW50ZWQgdG8gYnkgQGEgX19sYXN0CisgICAgICAgKiAgICAgICAgICAgcHJpb3IgdG8gZXJhc2luZyAob3IgZW5kKCkpLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHdpbGwgZXJhc2UgdGhlIGVsZW1lbnRzIGluIHRoZSByYW5nZQorICAgICAgICogIFtfX2ZpcnN0LF9fbGFzdCkgYW5kIHNob3J0ZW4gdGhlICV2ZWN0b3IgYWNjb3JkaW5nbHkuCisgICAgICAgKgorICAgICAgICogIE5vdGUgVGhpcyBvcGVyYXRpb24gY291bGQgYmUgZXhwZW5zaXZlIGFuZCBpZiBpdCBpcworICAgICAgICogIGZyZXF1ZW50bHkgdXNlZCB0aGUgdXNlciBzaG91bGQgY29uc2lkZXIgdXNpbmcgc3RkOjpsaXN0LgorICAgICAgICogIFRoZSB1c2VyIGlzIGFsc28gY2F1dGlvbmVkIHRoYXQgdGhpcyBmdW5jdGlvbiBvbmx5IGVyYXNlcworICAgICAgICogIHRoZSBlbGVtZW50cywgYW5kIHRoYXQgaWYgdGhlIGVsZW1lbnR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ZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgc3RyZWFtc2l6ZQorICAgIGJhc2ljX3N0cmVhbWJ1ZjxfQ2hhclQsIF9UcmFpdHM+OjoKKyAgICB4c2dldG4oY2hhcl90eXBlKiBfX3MsIHN0cmVhbXNpemUgX19uKQorICAgIHsKKyAgICAgIHN0cmVhbXNpemUgX19yZXQgPSAwOworICAgICAgd2hpbGUgKF9fcmV0IDwgX19uKQorCXsKKwkgIGNvbnN0IHN0cmVhbXNpemUgX19idWZfbGVuID0gdGhpcy0+ZWdwdHIoKSAtIHRoaXMtPmdwdHIoKTsKKwkgIGlmIChfX2J1Zl9sZW4pCisJICAgIHsKKwkgICAgICBjb25zdCBzdHJlYW1zaXplIF9fcmVtYWluaW5nID0gX19uIC0gX19yZXQ7CisJICAgICAgY29uc3Qgc3RyZWFtc2l6ZSBfX2xlbiA9IHN0ZDo6bWluKF9fYnVmX2xlbiwgX19yZW1haW5pbmcpOworCSAgICAgIHRyYWl0c190eXBlOjpjb3B5KF9fcywgdGhpcy0+Z3B0cigpLCBfX2xlbik7CisJICAgICAgX19yZXQgKz0gX19sZW47CisJICAgICAgX19zICs9IF9fbGVuOworCSAgICAgIHRoaXMtPl9fc2FmZV9nYnVtcChfX2xlbik7CisJICAgIH0KKworCSAgaWYgKF9fcmV0IDwgX19uKQorCSAgICB7CisJICAgICAgY29uc3QgaW50X3R5cGUgX19jID0gdGhpcy0+dWZsb3coKTsKKwkgICAgICBpZiAoIXRyYWl0c190eXBlOjplcV9pbnRfdHlwZShfX2MsIHRyYWl0c190eXBlOjplb2YoKSkpCisJCXsKKwkJICB0cmFpdHNfdHlwZTo6YXNzaWduKCpfX3MrKywgdHJhaXRzX3R5cGU6OnRvX2NoYXJfdHlwZShfX2MpKTsKKwkJICArK19fcmV0OworCQl9CisJICAgICAgZWxzZQorCQlicmVhazsKKwkgICAgfQorCX0KKyAgICAgIHJldHVybiBfX3JldDsKKyAgICB9CisKKyAgdGVt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XJuIF9NX2F0X2VvZigpID09IF9fYi5fTV9hdF9lb2YoKTsgfQorCisgICAgcHJpdmF0ZToKKyAgICAgIGludF90eXBlCisgICAgICBfTV9nZXQoKSBjb25zdAorICAgICAgeworCWNvbnN0IGludF90eXBlIF9fZW9mID0gdHJhaXRzX3R5cGU6OmVvZigpOworCWludF90eXBlIF9fcmV0ID0gX19lb2Y7CisJaWYgKF9NX3NidWYpCisJICB7CisJICAgIGlmICghdHJhaXRzX3R5cGU6OmVxX2ludF90eXBlKF9NX2MsIF9fZW9mKSkKKwkgICAgICBfX3JldCA9IF9NX2M7CisJICAgIGVsc2UgaWYgKCF0cmFpdHNfdHlwZTo6ZXFfaW50X3R5cGUoKF9fcmV0ID0gX01fc2J1Zi0+c2dldGMoKSksCisJCQkJCSAgICAgICBfX2VvZikpCisJICAgICAgX01fYyA9IF9fcmV0OworCSAgICBlbHNlCisJICAgICAgX01fc2J1ZiA9IDA7CisJICB9CisJcmV0dXJuIF9fcmV0OworICAgICAgfQorCisgICAgICBib29sCisgICAgICBfTV9hdF9lb2YoKSBjb25zdAorICAgICAgeworCWNvbnN0IGludF90eXBlIF9fZW9mID0gdHJhaXRzX3R5cGU6OmVvZigpOworCXJldHVybiB0cmFpdHNfdHlwZTo6ZXFfaW50X3R5cGUoX01fZ2V0KCksIF9fZW9mKTsKKyAgICAgIH0KKyAgICB9OworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cz4KKyAgICBpbmxpbmUgYm9vbAorICAgIG9wZXJhdG9yPT0oY29uc3QgaXN0cmVhbWJ1Zl9pdGVyYXRvcjxfQ2hhclQsIF9UcmFpdHM+JiBfX2EsCisJICAgICAgIGNvbnN0IGlzdHJlYW1idWZfaXRlcmF0b3I8X0NoYXJULCBfVHJhaXRzPiYgX19iKQorICAgIHsgcmV0dXJuIF9fYS5lcXVhbChfX2IpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYX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wLCB0eXBlbmFtZSBfRHAgPSBkZWZhdWx0X2RlbGV0ZTxfVHA+ID4KKyAgICBjbGFzcyB1bmlxdWVfcHRyCisgICAgeworICAgICAgLy8gdXNlIFNGSU5BRSB0byBkZXRlcm1pbmUgd2hldGhlciBfRGVsOjpwb2ludGVyIGV4aXN0cworICAgICAgY2xhc3MgX1BvaW50ZXIKKyAgICAgIHsKKwl0ZW1wbGF0ZTx0eXBlbmFtZSBfVXA+CisJICBzdGF0aWMgdHlwZW5hbWUgX1VwOjpwb2ludGVyIF9fdGVzdCh0eXBlbmFtZSBfVXA6OnBvaW50ZXIqKTsKKworCXRlbXBsYXRlPHR5cGVuYW1lIF9VcD4KKwkgIHN0YXRpYyBfVHAqIF9fdGVzdCguLi4pOworCisJdHlwZWRlZiB0eXBlbmFtZSByZW1vdmVfcmVmZXJlbmNlPF9EcD46OnR5cGUgX0RlbDsKKworICAgICAgcHVibGljOgorCXR5cGVkZWYgZGVjbHR5cGUoIF9fdGVzdDxfRGVsPigwKSkgdHlwZTsKKyAgICAgIH07CisKKyAgICAgIHR5cGVkZWYgc3RkOjp0dXBsZTx0eXBlbmFtZSBfUG9pbnRlcjo6dHlwZSwgX0RwPiAgX190dXBsZV90eXBlOworICAgICAgX190dXBsZV90eXBlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfTV90OworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfUG9pbnRlcjo6dHlwZSAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIF9UcCAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudF90eXBlOworICAgICAgdHlwZWRlZiBfRHAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZXJfdHlwZTsKKworICAgICAgLy8gQ29uc3RydWN0b3JzLgorICAgICAgY29uc3RleHByIHVuaXF1ZV9wdHIoKSBub2V4Y2VwdAorICAgICAgOiBfTV90KCkKKyAgICAgIHsgc3RhdGljX2Fzc2VydC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WVfcHRyJgorICAgICAgb3BlcmF0b3I9KG51bGxwdHJfdCkgbm9leGNlcHQKKyAgICAgIHsKKwlyZXNldCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLy8gT2JzZXJ2ZXJzLgorICAgICAgdHlwZW5hbWUgc3RkOjphZGRfbHZhbHVlX3JlZmVyZW5jZTxlbGVtZW50X3R5cGU+Ojp0eXBlCisgICAgICBvcGVyYXRvcltdKHNpemVfdCBfX2kpIGNvbnN0CisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfQVNTRVJUKGdldCgpICE9IHBvaW50ZXIoKSk7CisJcmV0dXJuIGdldCgpW19faV07CisgICAgICB9CisKKyAgICAgIHBvaW50ZXIKKyAgICAgIGdldCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6OmdldDwwPihfTV90KTsgfQorCisgICAgICBkZWxldGVyX3R5cGUmCisgICAgICBnZXRfZGVsZXRlcigpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6OmdldDwxPihfTV90KTsgfQorCisgICAgICBjb25zdCBkZWxldGVyX3R5cGUmCisgICAgICBnZXRfZGVsZXRlcigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGQ6OmdldDwxPihfTV90KTsgfQorCisgICAgICBleHBsaWNpdCBvcGVyYXRvciBib29sKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGdldCgpID09IHBvaW50ZXIoKSA/IGZhbHNlIDogdHJ1ZTsgfQorCisgICAgICAvLyBNb2RpZmllcnMuCisgICAgICBwb2ludGVyCisgICAgICByZWxlYXNlKCkgbm9leGNlcHQKKyAgICAgIHsKKwlwb2ludGVyIF9fcCA9IGdldCgpOworCXN0ZDo6Z2V0PDA+KF9NX3QpID0gcG9pbnRlcigpOworCXJldHVybiBfX3A7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KHBvaW50ZXIgX19wID0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ybiBfTV9leHByW19NX2luZGV4W19faV1dOyB9CisgICAgICAKKyAgICAgIHNpemVfdAorICAgICAgc2l6ZSAoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faW5kZXguc2l6ZSgpOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgY29uc3QgX0RvbSYJICAgICAgX01fZXhwcjsKKyAgICAgIGNvbnN0IHZhbGFycmF5PHNpemVfdD4mIF9NX2luZGV4OworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNsYXNzIF9HQmFzZTxfQXJyYXk8X1RwPiA+CisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgX1RwIHZhbHVlX3R5cGU7CisgICAgICAKKyAgICAgIF9HQmFzZSAoX0FycmF5PF9UcD4gX19hLCBjb25zdCB2YWxhcnJheTxzaXplX3Q+JiBfX2kpCisgICAgICA6IF9NX2FycmF5IChfX2EpLCBfTV9pbmRleChfX2kpIHt9CisgICAgICAKKyAgICAgIHZhbHVlX3R5cGUKKyAgICAgIG9wZXJhdG9yW10gKHNpemVfdCBfX2kpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9hcnJheS5fTV9kYXRhW19NX2luZGV4W19faV1dOyB9CisgICAgICAKKyAgICAgIHNpemVfdAorICAgICAgc2l6ZSAoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faW5kZXguc2l6ZSgpOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgY29uc3QgX0FycmF5PF9UcD4gICAgICAgX01fYXJyYXk7CisgICAgICBjb25zdCB2YWxhcnJheTxzaXplX3Q+JiBfTV9pbmRleDsKKyAgICB9OworCisgIHRlbXBsYXRlPGNsYXNzIF9Eb20+CisgICAgc3RydWN0IF9HQ2xvczxfRXhwciwgX0RvbT4KKyAgICA6IF9HQmFzZTxfRG9tPgorICAgIHsKKyAgICAgIHR5cGVkZWYgX0dCYXNlPF9Eb20+IF9CYXNlOworICAgICAgdHlwZWRlZiB0eX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ZSBfRXhwcjxfVW5DbG9zPF9fbG9naWNhbF9ub3QsIF9FeHByLCBfRG9tPiwgYm9vbD4KKyAgICBfRXhwcjxfRG9tLCBfVHA+OjpvcGVyYXRvciEoKSBjb25zdAorICAgIHsKKyAgICAgIHR5cGVkZWYgX1VuQ2xvczxfX2xvZ2ljYWxfbm90LCBzdGQ6Ol9FeHByLCBfRG9tPiBfQ2xvc3VyZTsKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgYm9vbD4oX0Nsb3N1cmUodGhpcy0+X01fY2xvc3VyZSkpOworICAgIH0KKworI2RlZmluZSBfREVGSU5FX0VYUFJfVU5BUllfT1BFUkFUT1IoX09wLCBfTmFtZSkgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlPGNsYXNzIF9Eb20sIHR5cGVuYW1lIF9UcD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpbmxpbmUgX0V4cHI8X1VuQ2xvczxfTmFtZSwgc3RkOjpfRXhwciwgX0RvbT4sIF9UcD4gICAgICAgICAgICAgICAgICAgXAorICAgIF9FeHByPF9Eb20sIF9UcD46Om9wZXJhdG9yIF9PcCgpIGNvbnN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHR5cGVkZWYgX1VuQ2xvczxfTmFtZSwgc3RkOjpfRXhwciwgX0RvbT4gX0Nsb3N1cmU7ICAgICAgICAgICAgICAgICAgXAorICAgICAgcmV0dXJuIF9FeHByPF9DbG9zdXJlLCBfVHA+KF9DbG9zdXJlKHRoaXMtPl9NX2Nsb3N1cmUpKTsgICAgICAgICAgICBcCisgICAgfQorCisgICAgX0RFRklORV9FWFBSX1VOQVJZX09QRVJBVE9SKCssIF9fdW5hcnlfcGx1cykKKyAgICBfREVGSU5FX0V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KyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1ZhbHVlPihfQ2xvc3VyZShfX3YoKSwgX193KCkpKTsgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpbmxpbmUgX0V4cHI8X0JpbkNsb3M8X05hbWUsIF9FeHByLCBfQ29uc3RhbnQsIF9Eb20sICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZT4sICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICB0eXBlbmFtZSBfX2Z1bjxfTmFtZSwgdHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZT46OnJlc3VsdF90eXBlPiBcCisgICAgb3BlcmF0b3IgX09wKGNvbnN0IF9FeHByPF9Eb20sIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX3YsICAgICBcCisgICAgICAgICAgICAgICAgIGNvbnN0IHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUmIF9fdCkgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUgX0FyZzsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fZnVuPF9OYW1lLCBfQXJnPjo6cmVzdWx0X3R5cGUgX1ZhbHVlOyAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9OYW1lLCBfRXhwciwgX0NvbnN0YW50LCBfRG9tLCBfQXJnPiBfQ2xvc3VyZTsgICBcCisgICAgICByZXR1cm4gX0V4cHI8X0Nsb3N1cmUsIF9WYWx1ZT4oX0Nsb3N1cmUoX192KCksIF9fdCkpOyAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlPGNsYXNzIF9Eb20+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaW5saW5lIF9FeHByPF9CaW5DbG9zPF9OYW1lLCBfQ29uc3RhbnQsIF9FeHByLCAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUsIF9Eb20+LCAgICAgICAgICAgICBcCisgICAgICAgICAgICAgdHlwZW5hbWUgX19mdW48X05hbWUsIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+OjpyZXN1bHRfdHlwZT4gXAorICAgIG9wZXJhdG9yIF9PcChjb25zdCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlJiBfX3QsICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICBjb25zdCBfRXhwcjxfRG9tLCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiYgX192KSAgICAgXAorICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlIF9Bcmc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2Z1bjxfTmFtZSwgX0FyZz46OnJlc3VsdF90eXBlIF9WYWx1ZTsgICAgICAgICAgXAorICAgICAgdHlwZWRlZiBfQmluQ2xvczxfTmFtZSwgX0NvbnN0YW50LCBfRXhwciwgX0FyZywgX0RvbT4gX0Nsb3N1cmU7ICAgXAorICAgICAgcmV0dXJuIF9FeHByPF9DbG9zdXJlLCBfVmFsdWU+KF9DbG9zdXJlKF9fdCwgX192KCkpKTsgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB0ZW1wbGF0ZTxjbGFzcyBfRG9tPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfTmFtZSwgX0V4cHIsIF9WYWxBcnJheSwgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICBfRG9tLCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiwgICAgICAgICAgICAgXAorICAgICAgICAgICAgIHR5cGVuYW1lIF9fZnVuPF9OYW1lLCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPjo6cmVzdWx0X3R5cGU+IFwKKyAgICBvcGVyYXRvciBfT3AoY29uc3QgX0V4cHI8X0RvbSx0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiYgX19lLCAgICAgIFwKKyAgICAgICAgICAgICAgICAgY29uc3QgdmFsYXJyYXk8dHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZT4mIF9fdikgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZSBfQXJnOyAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19mdW48X05hbWUsIF9Bcmc+OjpyZXN1bHRfdHlwZSBfVmFsdWU7ICAgICAgICAgIFwKKyAgICAgIHR5cGVkZWYgX0JpbkNsb3M8X05hbWUsIF9FeHByLCBfVmFsQXJyYXksIF9Eb20sIF9Bcmc+IF9DbG9zdXJlOyAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1ZhbHVlPihfQ2xvc3VyZShfX2UoKSwgX192KSk7ICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpbmxpbmUgX0V4cHI8X0JpbkNsb3M8X05hbWUsIF9WYWxBcnJheSwgX0V4cHIsICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgdHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZSwgX0RvbT4sICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICB0eXBlbmFtZSBfX2Z1bjxfTmFtZSwgdHlwZW5hbWUgX0RvbTo6dmFsdWVfdHlwZT46OnJlc3VsdF90eXBlPiBcCisgICAgb3BlcmF0b3IgX09wKGNvbnN0IHZhbGFycmF5PHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX3YsICAgICAgICBcCisgICAgICAgICAgICAgICAgIGNvbnN0IF9FeHByPF9Eb20sIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX2UpICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUgX1RwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fZnVuPF9OYW1lLCBfVHA+OjpyZXN1bHRfdHlwZSBfVmFsdWU7ICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9OYW1lLCBfVmFsQXJyYXksIF9FeHByLCBfVHAsIF9Eb20+IF9DbG9zdXJlOyAgICBcCisgICAgICByZXR1cm4gX0V4cHI8X0Nsb3N1cmUsIF9WYWx1ZT4oX0Nsb3N1cmUoX192LCBfX2UgKCkpKTsgICAgICAgICAgICBcCisgICAgfQorCisgICAgX0RFRklORV9FWFBSX0JJTkFSWV9PUEVSQVRPUigrLCBfX3BsdXMpCisgICAgX0RFRklORV9FWFBSX0JJTkFSWV9PUEVSQVRPUigtLCBfX21pbnVzKQorICAgIF9ERUZJTkVfRVhQUl9CSU5BUllfT1BFUkFUT1IoKiwgX19tdWx0aXBsaWVzKQorICAgIF9ERUZJTkVfRVhQUl9CSU5BUllfT1BFUkFUT1IoLywgX19kaXZpZGVzKQorICAgIF9ERUZJTkVfRVhQUl9CSU5BUllfT1BFUkFUT1IoJSwgX19tb2R1bHVzKQorICAgIF9ERUZJTkVfRVhQUl9CSU5BUllfT1BFUkFUT1IoXiwgX19iaXR3aXNlX3hvcikKKyAgICBfREVGSU5FX0VYUFJfQklOQVJZX09QRVJBVE9SKCYsIF9fYml0d2lzZV9hbmQpCisgICAgX0RFRklORV9FWFBSX0JJTkFSWV9PUE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VlX3R5cGU+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIF9OYW1lKGNvbnN0IF9FeHByPF9Eb20sIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX2UpICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUgX1RwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiBfVW5DbG9zPF9VTmFtZSwgX0V4cHIsIF9Eb20+IF9DbG9zdXJlOyAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX2UoKSkpOyAgICAgICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgaW5saW5lIF9FeHByPF9VbkNsb3M8X1VOYW1lLCBfVmFsQXJyYXksIF9UcD4sIF9UcD4gICAgICAgICAgICAgICAgICAgXAorICAgIF9OYW1lKGNvbnN0IHZhbGFycmF5PF9UcD4mIF9fdikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9VbkNsb3M8X1VOYW1lLCBfVmFs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kNUSU9OKF9GdW4sIF9VRnVuKQkJICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbTEsIGNsYXNzIF9Eb20yPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX0V4cHIsIF9FeHByLCBfRG9tMSwgX0RvbTI+LCAgICAgICAgICBcCisJCSB0eXBlbmFtZSBfRG9tMTo6dmFsdWVfdHlwZT4gICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgX0Z1bihjb25zdCBfRXhwcjxfRG9tMSwgdHlwZW5hbWUgX0RvbTE6OnZhbHVlX3R5cGU+JiBfX2UxLCAgICAgICAgIFwKKwkgY29uc3QgX0V4cHI8X0RvbTIsIHR5cGVuYW1lIF9Eb20yOjp2YWx1ZV90eXBlPiYgX19lMikJICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tMTo6dmFsdWVfdHlwZSBfVHA7ICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9VRnVuLCBfRXhwciwgX0V4cHIsIF9Eb20xLCBfRG9tMj4gX0Nsb3N1cmU7ICAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX2UxKCksIF9fZTIoKSkpOyAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX0V4cHIsIF9WYWxBcnJheSwgX0RvbSwgICAgICAgICAgICAgICBcCisJCQkgIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+LCAgICAgICAgICAgICAgICAgIFwKKwkJIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfRnVuKGNvbnN0IF9FeHByPF9Eb20sIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX2UsICAgICAgICAgICAgXAorCSBjb25zdCB2YWxhcnJheTx0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiYgX192KSAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlIF9UcDsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9VRnVuLCBfRXhwciwgX1ZhbEFycmF5LCBfRG9tLCBfVHA+IF9DbG9zdXJlOyAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX2UoKSwgX192KSk7ICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX1ZhbEFycmF5LCBfRXhwciwgICAgICAgICAgICAgICAgICAgICBcCisJCQkgIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUsIF9Eb20+LCAgICAgICAgICAgIFwKKwkJIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfRnVuKGNvbnN0IHZhbGFycmF5PHR5cGVuYW1lIF9Eb206OnZhbGFycmF5PiYgX192LCAgICAgICAgICAgICAgICAgXAorCSBjb25zdCBfRXhwcjxfRG9tLCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiYgX19lKSAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlIF9UcDsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9VRnVuLCBfVmFsQXJyYXksIF9FeHByLCBfVHAsIF9Eb20+IF9DbG9zdXJlOyAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX3YsIF9fZSgpKSk7ICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX0V4cHIsIF9Db25zdGFudCwgX0RvbSwgICAgICAgICAgICAgICBcCisJCQkgIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+LCAgICAgICAgICAgICAgICAgIFwKKwkJIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfRnVuKGNvbnN0IF9FeHByPF9Eb20sIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+JiBfX2UsICAgICAgICAgICAgXAorCSBjb25zdCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlJiBfX3QpICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlIF9UcDsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9VRnVuLCBfRXhwciwgX0NvbnN0YW50LCBfRG9tLCBfVHA+IF9DbG9zdXJlOyAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX2UoKSwgX190KSk7ICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX0NvbnN0YW50LCBfRXhwciwgICAgICAgICAgICAgICAgICAgICBcCisJCQkgIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUsIF9Eb20+LCAgICAgICAgICAgIFwKKwkJIHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGU+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBfRnVuKGNvbnN0IHR5cGVuYW1lIF9Eb206OnZhbHVlX3R5cGUmIF9fdCwgICAgICAgICAgICAgICAgICAgICAgICAgXAorCSBjb25zdCBfRXhwcjxfRG9tLCB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlPiYgX19lKSAgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfRG9tOjp2YWx1ZV90eXBlIF9UcDsgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0eXBlZGVmIF9CaW5DbG9zPF9VRnVuLCBfQ29uc3RhbnQsIF9FeHByLCBfVHAsIF9Eb20+IF9DbG9zdXJlOyAgIFwKKyAgICAgIHJldHVybiBfRXhwcjxfQ2xvc3VyZSwgX1RwPihfQ2xvc3VyZShfX3QsIF9fZSgpKSk7ICAgICAgICAgICAgICAgXAorICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlubGluZSBfRXhwcjxfQmluQ2xvczxfVUZ1biwgX1ZhbEFycmF5LCBfVmFsQXJyYXksIF9UcCwgX1RwPiwgX1RwPiBcCisgICAgX0Z1bihjb25zdCB2YWxhcnJheTxfVHA+JiBfX3YsIGNvbnN0IHZhbGFycmF5PF9UcD4mIF9fdykgICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgdHlwZWRlZiBfQmluQ2xvczxfVUZ1biwgX1ZhbEFycmF5LCBfVmFsQXJyYXksIF9UcCwgX1RwPiBfQ2xvc3VyZTtcCisgICAgICByZXR1cm4gX0V4cHI8X0Nsb3N1cmUsIF9UcD4oX0Nsb3N1cmUoX192LCBfX3cpKTsgICAgICAgICAgICAgICAgIFwKKyAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBpbmxpbmUgX0V4cHI8X0JpbkNsb3M8X1VGdW4sIF9WYWxBcnJheSwgX0NvbnN0YW50LCBfVHAsIF9UcD4sIF9UcD4gXAorICAgIF9GdW4oY29uc3QgdmFsYXJyYXk8X1RwPiYgX192LCBjb25zdCBfVHAmIF9fdCkgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHR5cGVkZWYgX0JpbkNsb3M8X1VGdW4sIF9WYWxBcnJheSwgX0NvbnN0YW50LCBfVHAsIF9UcD4gX0Nsb3N1cmU7XAorICAgICAgcmV0dXJuIF9FeHByPF9DbG9zdXJlLCBfVHA+KF9DbG9zdXJlKF9fdiwgX190KSk7ICAgICAgICAgICAgICAgICBcCisgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKwkJCQ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RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChjb25zdCBfVHAqIF9fYiwgY29uc3QgX1RwKiBfX2UsCisJCQkgICAgICBfVHAqIF9fcmVzdHJpY3RfXyBfX28pCisgICAgeworICAgICAgX0FycmF5X2NvcHlfY3RvcjxfVHAsIF9faXNfdHJpdmlhbChfVHApPjo6X1NfZG9faXQoX19iLCBfX2UsIF9fbyk7CisgICAgfQorCisgIC8vIGNvcHktY29uc3RydWN0IHJhdyBhcnJheSBbX19vLCAqKSBmcm9tIHN0cmlkZWQgYXJyYXkgX19hWzxfX24gOiBfX3M+XQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHZvaWQKKyAgICBfX3ZhbGFycmF5X2NvcHlfY29uc3RydWN0IChjb25zdCBfVHAqIF9fcmVzdHJpY3RfXyBfX2EsIHNpemVfdCBfX24sCisJCQkgICAgICAgc2l6ZV90IF9fcywgX1RwKiBfX3Jlc3RyaWN0X18gX19vKQorICAgIHsKKyAgICAgIGlmIChfX2lzX3RyaXZpYWwoX1RwKSkKKwl3aGlsZSAoX19uLS0pCisJICB7CisJICAgICpfX28rKyA9ICpfX2E7CisJICAgIF9fYSArPSBfX3M7CisJICB9CisgICAgICBlbHNlCisJd2hpbGUgKF9fbi0tKQorCSAgeworCSAgICBuZXcoX19vKyspIF9UcCgqX19hKTsKKwkgICAgX19hICs9IF9fczsKKwkgIH0KKyAgICB9CisKKyAgLy8gY29weS1jb25zdHJ1Y3QgcmF3IGFycmF5IFtfX28sICopIGZyb20gaW5kZXhlZCBhcnJheSBfX2FbX19pWzxfX24+XV0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5X2NvbnN0cnVjdCAoY29uc3QgX1RwKiBfX3Jlc3RyaWN0X18gX19hLAorCQkJICAgICAgIGNvbnN0IHNpemVfdCogX19yZXN0cmljdF9fIF9faSwKKwkJCSAgICAgICBfVHAqIF9fcmVzdHJpY3RfXyBfX28sIHNpemVfdCBfX24pCisgICAgeworICAgICAgaWYgKF9faXNfdHJpdmlhbChfVHApKQorCXdoaWxlIChfX24tLSkKKwkgICpfX28rKyA9IF9fYVsqX19pKytdOworICAgICAgZWxzZQorCXdoaWxlIChfX24tLSkKKwkgIG5ldyAoX19vKyspIF9UcChfX2FbKl9faSsrXSk7CisgICAgfQorCisgIC8vIERvIHRoZSBuZWNlc3NhcnkgY2xlYW51cCB3aGVuIHdlJ3JlIGRvbmUgd2l0aCBhcnJheXMuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdm9pZAorICAgIF9fdmFsYXJyYXlfZGVzdHJveV9lbGVtZW50cyhfVHAqIF9fYiwgX1RwKiBfX2UpCisgICAgeworICAgICAgaWYgKCFfX2lzX3RyaXZpYWwoX1RwKSkKKwl3aGlsZSAoX19iICE9IF9fZSkKKwkgIHsKKwkgICAgX19iLT5+X1RwKCk7CisJICAgICsrX19iOworCSAgfQorICAgIH0KKworICAvLyBGaWxsIGEgcGxhaW4gYXJyYXkgX19hWzxfX24+XSB3aXRoIF9fdAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHZvaWQKKyAgICBfX3ZhbGFycmF5X2ZpbGwoX1RwKiBfX3Jlc3RyaWN0X18gX19hLCBzaXplX3QgX19uLCBjb25zdCBfVHAmIF9fdCkKKyAgICB7CisgICAgICB3aGlsZSAoX19uLS0pCisJKl9fYSsrID0gX190OworICAgIH0KKyAgCisgIC8vIGZpbGwgc3RyaWRlZCBhcnJheSBfX2FbPF9fbi0xIDogX19zPl0gd2l0aCBfX3QKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9maWxsKF9UcCogX19yZXN0cmljdF9fIF9fYSwgc2l6ZV90IF9fbiwKKwkJ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mUgc3RhdGljIHZvaWQKKyAgICAgIF9TX2RvX2l0KGNvbnN0IF9UcCogX19yZXN0cmljdF9fIF9fYSwgc2l6ZV90IF9fbiwgX1RwKiBfX3Jlc3RyaWN0X18gX19iKQorICAgICAgeyBfX2J1aWx0aW5fbWVtY3B5KF9fYiwgX19hLCBfX24gKiBzaXplb2YgKF9UcCkpOyB9CisgICAgfTsKKworICAvLyBDb3B5IGEgcGxhaW4gYXJyYXkgX19hWzxfX24+XSBpbnRvIGEgcGxheSBhcnJheSBfX2JbPD5dCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdm9pZAorICAgIF9fdmFsYXJyYXlfY29weShjb25zdCBfVHAqIF9fcmVzdHJpY3RfXyBfX2EsIHNpemVfdCBfX24sCisJCSAgICBfVHAqIF9fcmVzdHJpY3RfXyBfX2IpCisgICAgeworICAgICAgX0FycmF5X2NvcGllcjxfVHAsIF9faXNfdHJpdmlhbChfVHApPjo6X1NfZG9faXQoX19hLCBfX24sIF9fYik7CisgICAgfQorCisgIC8vIENvcHkgc3RyaWRlZCBhcnJheSBfX2FbPF9fbiA6IF9fcz5dIGluIHBsYWluIF9fYls8X19uPl0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5KGNvbnN0IF9UcCogX19yZXN0cmljdF9fIF9fYSwgc2l6ZV90IF9fbiwgc2l6ZV90IF9fcywKKwkJICAgIF9UcCogX19yZXN0cmljdF9fIF9fYikKKyAgICB7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pLCArK19fYiwgX19hICs9IF9fcykKKwkqX19iID0gKl9fYTsKKyAgICB9CisKKyAgLy8gQ29weSBhIHBsYWluIGFycmF5ICBfX2FbPF9fbj5dIGludG8gYSBzdHJpZGVkIGFycmF5IF9fYls8X19uIDogX19zPl0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5KGNvbnN0IF9UcCogX19yZXN0cmljdF9fIF9fYSwgX1RwKiBfX3Jlc3RyaWN0X18gX19iLAorCQkgICAgc2l6ZV90IF9fbiwgc2l6ZV90IF9fcykKKyAgICB7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pLCArK19fYSwgX19iICs9IF9fcykKKwkqX19iID0gKl9fYTsKKyAgICB9CisKKyAgLy8gQ29weSBzdHJpZGVkIGFycmF5IF9fc3JjWzxfX24gOiBfX3MxPl0gaW50byBhbm90aGVyCisgIC8vIHN0cmlkZWQgYXJyYXkgX19kc3RbPCA6IF9fczI+XS4gIFRoZWlyIHNpemVzIG11c3QgbWF0Y2guCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdm9pZAorICAgIF9fdmFsYXJyYXlfY29weShjb25zdCBfVHAqIF9fcmVzdHJpY3RfXyBfX3NyYywgc2l6ZV90IF9fbiwgc2l6ZV90IF9fczEsCisJCSAgICBfVHAqIF9fcmVzdHJpY3RfXyBfX2RzdCwgc2l6ZV90IF9fczIpCisgICAgeworICAgICAgZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX19uOyArK19faSkKKwlfX2RzdFtfX2kgKiBfX3MyXSA9IF9fc3JjW19faSAqIF9fczFdOworICAgIH0KKworICAvLyBDb3B5IGFuIGluZGV4ZWQgYXJyYXkgX19hW19faVs8X19uPl1dIGluIHBsYWluIGFycmF5IF9fYls8X19uPl0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5KGNvbnN0IF9UcCogX19yZXN0cmljdF9fIF9fYSwKKwkJICAgIGNvbnN0IHNpemVfdCogX19yZXN0cmljdF9fIF9faSwKKwkJICAgIF9UcCogX19yZXN0cmljdF9fIF9fYiwgc2l6ZV90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nJheSBzaG91bGQgYmUgZm9yd2FyZGVkIHRvIHRoaXMgY2xhc3MKKyAgLy8gd2hlbmV2ZXIgcG9zc2libGUuIC0tIGdkcgorICAvLworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdHJ1Y3QgX0FycmF5CisgICAgeworICAgICAgZXhwbGljaXQgX0FycmF5KHNpemVfdCk7CisgICAgICBleHBsaWNpdCBfQXJyYXkoX1RwKiBjb25zdCBfX3Jlc3RyaWN0X18pOworICAgICAgZXhwbGljaXQgX0FycmF5KGNvbnN0IHZhbGFycmF5PF9UcD4mKTsKKyAgICAgIF9BcnJheShjb25zdCBfVHAqIF9fcmVzdHJpY3RfXywgc2l6ZV90KTsKKyAgICAgIAorICAgICAgX1RwKiBiZWdpbigpIGNvbnN0OworICAgICAgCisgICAgICBfVHAqIGNvbnN0IF9fcmVzdHJpY3RfXyBfTV9kYXRhOworICAgIH07CisKKworICAvLyBDb3B5LWNvbnN0cnVjdCBwbGFpbiBhcnJheSBfX2JbPF9fbj5dIGZyb20gaW5kZXhlZCBhcnJheSBfX2FbX19pWzxfX24+XV0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2b2lkCisgICAgX192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfQXJyYXk8X1RwPiBfX2EsIF9BcnJheTxzaXplX3Q+IF9faSwKKwkJCSAgICAgIF9BcnJheTxfVHA+IF9fYiwgc2l6ZV90IF9fbikKKyAgICB7IHN0ZDo6X192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfX2EuX01fZGF0YSwgX19pLl9NX2RhdGEsCisJCQkJICAgICBfX2IuX01fZGF0YSwgX19uKTsgfQorCisgIC8vIENvcHktY29uc3RydWN0IHBsYWluIGFycmF5IF9fYls8X19uPl0gZnJvbSBzdHJpZGVkIGFycmF5IF9fYVs8X19uIDogX19zPl0KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB2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X2IuX01fZGF0YSArIF9fbjsgKytfX3AsICsrX19xKSBcCisgICAgICAgICpfX3AgX09wIyM9ICpfX3E7CQkJCQkJXAorICAgIH0JCQkJCQkJCQlcCisJCQkJCQkJCQlcCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgY2xhc3MgX0RvbT4JCQkJCVwKKyAgICB2b2lkCQkJCQkJCQlcCisgICAgX0FycmF5X2F1Z21lbnRlZF8jI19OYW1lKF9BcnJheTxfVHA+IF9fYSwJICAgICAgICAJCVwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgX0V4cHI8X0RvbSwgX1RwPiYgX19lLCBzaXplX3QgX19uKQlcCisgICAgewkJCQkJCQkJCVwKKyAgICAgIF9UcCogX19wKF9fYS5fTV9kYXRhKTsJCQkJCQlcCisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pLCArK19fcCkgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICpfX3AgX09wIyM9IF9fZVtfX2ldOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAlcCisgICAgfQkJCQkJCQkJCVwKKwkJCQkJCQkJCVwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgkJCQkJCVwKKyAgICBpbmxpbmUgdm9pZAkJCQkJCQkJXAorICAgIF9BcnJheV9hdWdtZW50ZWRfIyNfTmFtZShfQXJyYXk8X1RwPiBfX2EsIHNpemVfdCBfX24sIHNpemVfdCBfX3MsCVwKKwkgICAgICAgICAgICAgICAgICAgICBfQXJyYXk8X1RwPiBfX2IpCQkJCVwKKyAgICB7CQkJCQkJCQkJXAorICAgICAgX1RwKiBfX3EoX19iLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIGZvciAoX1RwKiBfX3AgPSBfX2EuX01fZGF0YTsgX19wIDwgX19hLl9NX2RhdGEgKyBfX3MgKiBfX247ICAgICAgIFwKKwkgICBfX3AgKz0gX19zLCArK19fcSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAqX19wIF9PcCMjPSAqX19xOwkJCQkJCVwKKyAgICB9CQkJCQkJCQkJXAorCQkJCQkJCQkJXAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CQkJCQkJXAorICAgIGlubGluZSB2b2lkCQkJCQkJCQlcCisgICAgX0FycmF5X2F1Z21lbnRlZF8jI19OYW1lKF9BcnJheTxfVHA+IF9fYSwgX0FycmF5PF9UcD4gX19iLAkJXAorCQkgICAgICAgICAgICAgc2l6ZV90IF9fbiwgc2l6ZV90IF9fcykJCQlcCisgICAgewkJCQkJCQkJCVwKKyAgICAgIF9UcCogX19xKF9fYi5fTV9kYXRhKTsJCQkJCQlcCisgICAgICBmb3IgKF9UcCogX19wID0gX19hLl9NX2RhdGE7IF9fcCA8IF9fYS5fTV9kYXRhICsgX19uOyAgICAgICAgICAgICBcCisJICAgKytfX3AsIF9fcSArPSBfX3MpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgKl9fcCBfT3AjIz0gKl9fcTsJCQkJCQlcCisgICAgfQkJCQkJCQkJCVwKKwkJCQkJCQkJCVwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBjbGFzcyBfRG9tPgkJCQkJXAorICAgIHZvaWQJCQkJCQkJCVwKKyAgICBfQXJyYXlfYXVnbWVudGVkXyMjX05hbWUoX0FycmF5PF9UcD4gX19hLCBzaXplX3QgX19zLAkJXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfRXhwcjxfRG9tLCBfVHA+JiBfX2UsIHNpemVfdCBfX24pCVwKKyAgICB7CQkJCQkJCQkJXAorICAgICAgX1RwKiBfX3AoX19hLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsgKytfX2ksIF9fcCArPSBfX3MpICAgICAgICAgICAgICAgIFwKKyAgICAgICAgKl9fcCBfT3AjIz0gX19lW19faV07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCVwKKyAgICB9CQkJCQkJCQkJXAorCQkJCQkJCQkJXAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CQkJCQkJXAorICAgIGlubGluZSB2b2lkCQkJCQkJCQlcCisgICAgX0FycmF5X2F1Z21lbnRlZF8jI19OYW1lKF9BcnJheTxfVHA+IF9fYSwgX0FycmF5PHNpemVfdD4gX19pLAlcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9BcnJheTxfVHA+IF9fYiwgc2l6ZV90IF9fbikJCVwKKyAgICB7CQkJCQkJCQkJXAorICAgICAgX1RwKiBfX3EoX19iLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIGZvciAoc2l6ZV90KiBfX2ogPSBfX2kuX01fZGF0YTsgX19qIDwgX19pLl9NX2RhdGEgKyBfX247ICAgICAgICAgIFwKKyAgICAgICAgICAgKytfX2osICsrX19xKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgX19hLl9NX2RhdGFbKl9fal0gX09wIyM9ICpfX3E7CQkJCQlcCisgICAgfQkJCQkJCQkJCVwKKwkJCQkJCQkJCVwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgkJCQkJCVwKKyAgICBpbmxpbmUgdm9pZAkJCQkJICAgICAgICAJCVwKKyAgICBfQXJyYXlfYXVnbWVudGVkXyMjX05hbWUoX0FycmF5PF9UcD4gX19hLCBzaXplX3QgX19uLAkJXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfQXJyYXk8X1RwPiBfX2IsIF9BcnJheTxzaXplX3Q+IF9faSkJXAorICAgIHsJCQkJCQkJCQlcCisgICAgICBfVHAqIF9fcChfX2EuX01fZGF0YSk7CQkJCQkJXAorICAgICAgZm9yIChzaXplX3QqIF9faiA9IF9faS5fTV9kYXRhOyBfX2o8X19pLl9NX2RhdGEgKyBfX247ICAgICAgICAgICAgXAorCSAgICsrX19qLCArK19fcCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICpfX3AgX09wIyM9IF9fYi5fTV9kYXRhWypfX2pdOwkJCQkJXAorICAgIH0JCQkJCQkJCQlcCisJCQkJCQkJCQlcCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgY2xhc3MgX0RvbT4JCQkJCVwKKyAgICB2b2lkCQkJCQkJCQlcCisgICAgX0FycmF5X2F1Z21lbnRlZF8jI19OYW1lKF9BcnJheTxfVHA+IF9fYSwgX0FycmF5PHNpemVfdD4gX19pLAlcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9FeHByPF9Eb20sIF9UcD4mIF9fZSwgc2l6ZV90IF9fbikJXAorICAgIHsJCQkJCQkJCQlcCisgICAgICBzaXplX3QqIF9faihfX2kuX01fZGF0YSk7CSAgICAgICAgCQkJCVwKKyAgICAgIGZvciAoc2l6ZV90IF9fayA9IDA7IF9fazxfX247ICsrX19rLCArK19faikJCQlcCisgICAgICAgIF9fYS5fTV9kYXRhWypfX2pdIF9PcCMjPSBfX2VbX19rXTsJCQkJXAorICAgIH0JCQkJCQkJCQlcCisJCQkJCQkJCQlcCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4JCQkJCQlcCisgICAgdm9pZAkJCQkJCQkJXAorICAgIF9BcnJheV9hdWdtZW50ZWRfIyNfTmFtZShfQXJyYXk8X1RwPiBfX2EsIF9BcnJheTxib29sPiBfX20sICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfQXJyYXk8X1RwPiBfX2IsIHNpemVfdCBfX24pCQlcCisgICAgewkJCQkJCQkJCVwKKyAgICAgIGJvb2wqIF9fb2soX19tLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIF9UcCogX19wKF9fYS5fTV9kYXRhKTsJCQkJCQlcCisgICAgICBmb3IgKF9UcCogX19xID0gX19iLl9NX2RhdGE7IF9fcSA8IF9fYi5fTV9kYXRhICsgX19uOyAgICAgICAgICAgICBcCisJICAgKytfX3EsICsrX19vaywgKytfX3ApICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICB3aGlsZSAoISAqX19vaykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIHsJCQkJCQkgICAgICAgIAlcCisgICAgICAgICAgICAgICsrX19vazsJCQkJCQkJXAorICAgICAgICAgICAgICArK19fcDsJCQkJCQkJXAorICAgICAgICAgICAgfQkJCQkJCQkJXAorICAgICAgICAgICpfX3AgX09wIyM9ICpfX3E7CQkJCQkJXAorICAgICAgICB9CQkJCQkJCQlcCisgICAgfQkJCQkJCQkJCVwKKwkJCQkJCQkJCVwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgkJCQkJCVwKKyAgICB2b2lkCQkJCQkJCQlcCisgICAgX0FycmF5X2F1Z21lbnRlZF8jI19OYW1lKF9BcnJheTxfVHA+IF9fYSwgc2l6ZV90IF9fbiwJCVwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX0FycmF5PF9UcD4gX19iLCBfQXJyYXk8Ym9vbD4gX19tKSAgIAlcCisgICAgewkJCQkJCQkJCVwKKyAgICAgIGJvb2wqIF9fb2soX19tLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIF9UcCogX19xKF9fYi5fTV9kYXRhKTsJCQkJCQlcCisgICAgICBmb3IgKF9UcCogX19wID0gX19hLl9NX2RhdGE7IF9fcCA8IF9fYS5fTV9kYXRhICsgX19uOyAgICAgICAgICAgICBcCisJICAgKytfX3AsICsrX19vaywgKytfX3EpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICB3aGlsZSAoISAqX19vaykgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgIHsJCQkJCSAgICAgICAgCQlcCisgICAgICAgICAgICAgICsrX19vazsJCQkJCQkJXAorICAgICAgICAgICAgICArK19fcTsJCQkJCQkJXAorICAgICAgICAgICAgfQkJCQkJCQkJXAorICAgICAgICAgICpfX3AgX09wIyM9ICpfX3E7CQkJCQkJXAorICAgICAgICB9CQkJCQkJCQlcCisgICAgfQkJCQkJCQkJCVwKKwkJCQkJCQkJCVwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBjbGFzcyBfRG9tPgkJCQkJXAorICAgIHZvaWQJCQkJCQkJCVwKKyAgICBfQXJyYXlfYXVnbWVudGVkXyMjX05hbWUoX0FycmF5PF9UcD4gX19hLCBfQXJyYXk8Ym9vbD4gX19tLCAgCVwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgX0V4cHI8X0RvbSwgX1RwPiYgX19lLCBzaXplX3QgX19uKQlcCisgICAgewkJCQkJCQkJCVwKKyAgICAgIGJvb2wqIF9fb2soX19tLl9NX2RhdGEpOwkJCQkJCVwKKyAgICAgIF9UcCogX19wKF9fYS5fTV9kYXRhKTsJCQkJCQlcCisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pLCArK19fb2ssICsrX19wKSAgICAgICAgICAgICBcCisgICAgICAgIHsJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAkJXAorICAgICAgICAgIHdoaWxlICghICpfX29rKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgewkJICAgICAgICAgCQkJCQlcCisJICAgICAgKytfX29rOwkJCQkJCQlcCisgICAgICAgICAgICAgICsrX19wOwkJCQkJCQlcCisgICAgICAgICAgICB9CQkJCQkJCQlcCisgICAgICAgICAgKl9fcCBfT3AjIz0gX19lW19faV07CQkJCQkJXAorICAgICAgICB9CQkJCQkJCQlcCisgICAgfQorCisgICBfREVGSU5FX0FSUkFZX0ZVTkNUSU9OKCssIF9fcGx1cykKKyAgIF9ERUZJTkVfQVJSQVlfRlVOQ1RJT04oLSwgX19taW51cykKKyAgIF9ERUZJTkVfQVJSQVlfRlVOQ1RJT04oKiwgX19tdWx0aXBsaWVzKQorICAgX0RFRklORV9BUlJBWV9GVU5DVElPTigvLCBfX2RpdmlkZXMpCisgICBfREVGSU5FX0FSUkFZX0ZVTkNUSU9OKCUsIF9fbW9kdWx1cykKKyAgIF9ERUZJTkVfQVJSQVlfRlVOQ1RJT04oXiwgX19iaXR3aXNlX3hvcikKKyAgIF9ERUZJTkVfQVJSQVlfRlVOQ1RJT04ofCwgX19iaXR3aXNlX29yKQorICAgX0RFRklORV9BUlJBWV9GVU5DVElPTigmLCBfX2JpdHdpc2VfYW5kKQorICAgX0RFRklORV9BUlJBWV9GVU5DVElPTig8PCwgX19zaGlmdF9sZWZ0KQorICAgX0RFRklORV9BUlJBWV9GVU5DVElPTig+PiwgX19zaGlmdF9yaWdodCkKKworI3VuZGVmIF9ERUZJTkVfQVJSQVlfRlVOQ1RJT04KKworX0dMSUJDWFhfRU5EX05BTUVTUEFDRV9WRVJTSU9OCit9IC8vIG5hbWVzcGFjZQorCisjIGluY2x1ZGUgPGJpdHMvdmFsYXJyYXlfYXJyYXkudGNjPgorCisjZW5kaWYgLyogX0FSUkFZX0ggKi8KZGlmZiAtLWdpdCBhLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvYml0cy92YWxhcnJheV9hcnJheS50Y2MgYi84L3NvdXJjZXMvY3h4LXN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cnJheTxfVHA+IF9fYSwgX0FycmF5PGJvb2w+IF9fbSwgc2l6ZV90IF9fbiwKKwkJICAgIF9BcnJheTxfVHA+IF9fYiwgX0FycmF5PGJvb2w+IF9faykKKyAgICB7CisgICAgICBfVHAqIF9fcCAoX19hLl9NX2RhdGEpOworICAgICAgX1RwKiBfX3EgKF9fYi5fTV9kYXRhKTsKKyAgICAgIGJvb2wqIF9fc3Jjb2sgKF9fbS5fTV9kYXRhKTsKKyAgICAgIGJvb2wqIF9fZHN0b2sgKF9fay5fTV9kYXRhKTsKKyAgICAgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsKKwkgICArK19fc3Jjb2ssICsrX19wLCArK19fZHN0b2ssICsrX19xLCArK19faSkKKwl7CisJICB3aGlsZSAoISAqX19zcmNvaykKKwkgICAgeworCSAgICAgICsrX19zcmNvazsKKwkgICAgICArK19fcDsKKwkgICAgfQorCSAgd2hpbGUgKCEgKl9fZHN0b2spIAorCSAgICB7CisJICAgICAgKytfX2RzdG9rOworCSAgICAgICsrX19xOworCSAgICB9CisJICAqX19xID0gKl9fcDsKKwl9CisgICAgfQorCisgIC8vIENvcHkgbiBjb25zZWN1dGl2ZSBlbGVtZW50cyBvZiBlIGludG8gY29uc2VjdXRpdmUgZWxlbWVudHMgb2YgYS4KKyAgLy8gSS5lLiBhW2ldID0gZVtpXS4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBjbGFzcyBfRG9tPgorICAgIHZvaWQKKyAgICBfX3ZhbGFycmF5X2NvcHkoY29uc3QgX0V4cHI8X0RvbSwgX1RwPiYgX19lLCBzaXplX3QgX19uLCBfQXJyYXk8X1RwPiBfX2EpCisgICAgeworICAgICAgX1RwKiBfX3AgKF9fYS5fTV9kYXRhKTsKKyAgICAgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsgKytfX2ksICsrX19wKQorCSpfX3AgPSBfX2VbX19pXTsKKyAgICB9CisKKyAgLy8gQ29weS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GFzcyBfRG9tPgorICAgIHZvaWQKKyAgICBfX3ZhbGFycmF5X2NvcHkoY29uc3QgX0V4cHI8X0RvbSwgX1RwPiYgX19lLCBzaXplX3QgX19uLAorCQkgICAgX0FycmF5PF9UcD4gX19hLCBfQXJyYXk8Ym9vbD4gX19tKQorICAgIHsKKyAgICAgIGJvb2wqIF9fb2sgKF9fbS5fTV9kYXRhKTsKKyAgICAgIF9UcCogX19wIChfX2EuX01fZGF0YSk7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pLCArK19fb2ssICsrX19wKQorCXsKKwkgIHdoaWxlICghICpfX29rKQorCSAgICB7CisJICAgICAgKytfX29rOworCSAgICAgICsrX19wOworCSAgICB9CisJICAqX19wID0gX19lW19faV07CisJfQorICAgIH0KKworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgY2xhc3MgX0RvbT4KKyAgICB2b2lkCisgICAgX192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChjb25zdCBfRXhwcjxfRG9tLCBfVHA+JiBfX2UsIHNpemVfdCBfX24sCisJCQkgICAgICBfQXJyYXk8X1RwPiBfX2EpCisgICAgeworICAgICAgX1RwKiBfX3AgKF9fYS5fTV9kYXRhKTsKKyAgICAgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9fbjsgKytfX2ksICsrX19wKQorCW5ldyAoX19wKSBfVHAoX19lW19faV0pOworICAgIH0KKworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICB2b2lkCisgICAgX192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfQXJyYXk8X1RwPiBfX2EsIF9BcnJheTxib29sPiBfX20sCisJCQkgICAgICBfQXJyYXk8X1RwPiBfX2IsIHNpemVfdCBfX24pCisgICAgeworICAgICAgX1RwKiBfX3AgKF9fYS5fTV9kYXRhKTsKKyAgICAgIGJvb2wqIF9fb2sgKF9fbS5fTV9kYXRhKTsKKyAgICAgIGZvciA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bnN0CisgICAgICB7IHJldHVybiBhYnMoX190KTsgfQorICB9OworCisgIHN0cnVjdCBfQ29zCisgIHsKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBfVHAgb3BlcmF0b3IoKShjb25zdCBfVHAmIF9fdCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvcyhfX3QpOyB9CisgIH07CisKKyAgc3RydWN0IF9BY29zCisgIHsKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBfVHAgb3BlcmF0b3IoKShjb25zdCBfVHAmIF9fdCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGFjb3MoX190KTsgfQorICB9OworCisgIHN0cnVjdCBfQ29zaAorICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3QpIGNvbnN0CisgICAgICB7IHJldHVybiBjb3NoKF9fdCk7IH0KKyAgfTsKKworICBzdHJ1Y3QgX1NpbgorICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3QpIGNvbnN0CisgICAgICB7IHJldHVybiBzaW4oX190KTsgfQorICB9OworCisgIHN0cnVjdCBfQXNpbgorICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3QpIGNvbnN0CisgICAgICB7IHJldHVybiBhc2luKF9fdCk7IH0KKyAgfTsKKworICBzdHJ1Y3QgX1NpbmgKKyAgeworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgIF9UcCBvcGVyYXRvcigpKGNvbnN0IF9UcCYgX190KSBjb25zdAorICAgICAgeyByZXR1cm4gc2luaChfX3QpOyB9CisgIH07CisKKyAgc3RydWN0IF9UYW4KKyAgeworICAgIHRlbXBsYXRl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ICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194IC0gX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fbXVsdGlwbGllcworICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194ICogX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fZGl2aWRlcworICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194IC8gX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fbW9kdWx1cworICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgX1RwIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194ICUgX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fYml0d2lzZV94b3IKKyAgeworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgIF9UcCBvcGVyYXRvcigpKGNvbnN0IF9UcCYgX194LCBjb25zdCBfVHAmIF9feSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9feCBeIF9feTsgfQorICB9OworCisgIHN0cnVjdCBfX2JpdHdpc2VfYW5kCisgIHsKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBfVHAgb3BlcmF0b3IoKShjb25zdCBfVHAmIF9feCwgY29uc3QgX1RwJiBfX3kpIGNvbnN0CisgICAgICB7IHJldHVybi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F0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBib29sIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiAhX194OyB9CisgIH07CisKKyAgc3RydWN0IF9fZXF1YWxfdG8KKyAgeworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgIGJvb2wgb3BlcmF0b3IoKShjb25zdCBfVHAmIF9feCwgY29uc3QgX1RwJiBfX3kpIGNvbnN0CisgICAgICB7IHJldHVybiBfX3ggPT0gX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fbm90X2VxdWFsX3RvCisgIHsKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBib29sIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194ICE9IF9feTsgfQorICB9OworCisgIHN0cnVjdCBfX2xlc3MKKyAgeworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgIGJvb2wgb3BlcmF0b3IoKShjb25zdCBfVHAmIF9feCwgY29uc3QgX1RwJiBfX3kpIGNvbnN0CisgICAgICB7IHJldHVybiBfX3ggPCBfX3k7IH0KKyAgfTsKKworICBzdHJ1Y3QgX19ncmVhdGVyCisgIHsKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBib29sIG9wZXJhdG9yKCkoY29uc3QgX1RwJiBfX3gsIGNvbnN0IF9UcCYgX195KSBjb25zdAorICAgICAgeyByZXR1cm4gX194ID4gX195OyB9CisgIH07CisKKyAgc3RydWN0IF9fbGVzc19lcXVhbAorICB7CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgYm9vbCBvcGVyYXRvcigpKGNvbnN0IF9UcCYgX194LCBjb25zdCBfVHAmIF9feSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9feCA8PSBfX3k7IH0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90IF9faSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2V4cHJbX01fc2xpY2Uuc3RhcnQgKCkgKyBfX2kgKiBfTV9zbGljZS5zdHJpZGUgKCldOyB9CisgICAgICAgIAorICAgICAgc2l6ZV90CisgICAgICBzaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3NsaWNlLnNpemUgKCk7IH0KKworICAgIHByaXZhdGU6CisgICAgICBjb25zdCBfRG9tJiBfTV9leHByOworICAgICAgY29uc3Qgc2xpY2UmIF9NX3NsaWNlOworICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNsYXNzIF9TQmFzZTxfQXJyYXk8X1RwPiA+CisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgX1RwIHZhbHVlX3R5cGU7CisgICAgICAKKyAgICAgIF9TQmFzZSAoX0FycmF5PF9UcD4gX19hLCBjb25zdCBzbGljZSYgX19zKQorICAgICAgOiBfTV9hcnJheSAoX19hLl9NX2RhdGErX19zLnN0YXJ0KCkpLCBfTV9zaXplIChfX3Muc2l6ZSgpKSwKKwlfTV9zdHJpZGUgKF9fcy5zdHJpZGUoKSkge30KKyAgICAgICAgCisgICAgICB2YWx1ZV90eXBlCisgICAgICBvcGVyYXRvcltdIChzaXplX3QgX19pKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fYXJyYXkuX01fZGF0YVtfX2kgKiBfTV9zdHJpZGVdOyB9CisgICAgICAKKyAgICAgIHNpemVfdAorICAgICAgc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9zaXplOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgY29uc3QgX0FycmF5PF9UcD4gX01fYXJyYXk7CisgICAgICBjb25zdCBzaXplX3QgX01fc2l6ZTsKKyAgICAgIGNvbnN0IHNpemVfdCBfTV9zdHJpZGU7CisgICAgfTsKKworICB0ZW1wbGF0ZTxjbGFzcyBfRG9tPgorICAgIHN0cnV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mRUJgorICAgICAgX01fZ2V0d29yZChzaXplX3QgX19wb3MpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93W19TX3doaWNod29yZChfX3BvcyldOyB9CisKKyAgICAgIF9HTElCQ1hYX0NPTlNURVhQUiBfV29yZFQKKyAgICAgIF9NX2dldHdvcmQoc2l6ZV90IF9fcG9zKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fd1tfU193aGljaHdvcmQoX19wb3MpXTsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIGNvbnN0IF9Xb3JkVCoKKyAgICAgIF9NX2dldGRhdGEoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdzsgfQorI2VuZGlmCisKKyAgICAgIF9Xb3JkVCYKKyAgICAgIF9NX2hpd29yZCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93W19OdyAtIDFdOyB9CisKKyAgICAgIF9HTElCQ1hYX0NPTlNURVhQUiBfV29yZFQKKyAgICAgIF9NX2hpd29yZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93W19OdyAtIDFdOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX2FuZChjb25zdCBfQmFzZV9iaXRzZXQ8X053PiYgX194KSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCWZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9OdzsgX19pKyspCisJICBfTV93W19faV0gJj0gX194Ll9NX3dbX19pXTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fb3IoY29uc3QgX0Jhc2VfYml0c2V0PF9Odz4mIF9feCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfTnc7IF9faSsrKQorCSAgX01fd1tfX2ldIHw9IF9feC5fTV93W19faV07CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3hvcihjb25zdCBfQmFzZV9iaXRzZXQ8X053PiYgX194KSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCWZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9OdzsgX19pKyspCisJICBfTV93W19faV0gXj0gX194Ll9NX3dbX19pXTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fbGVmdF9zaGlmdChzaXplX3QgX19zaGlmdCkgX0dMSUJDWFhfTk9FWENFUFQ7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3JpZ2h0X3NoaWZ0KHNpemVfdCBfX3NoaWZ0KSBfR0xJQkNYWF9OT0VYQ0VQVDsKKworICAgICAgdm9pZAorICAgICAgX01fZG9fZmxpcCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX053OyBfX2krKykKKwkgIF9NX3dbX19pXSA9IH5fTV93W19faV07CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3NldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX053OyBfX2krKykKKwkgIF9NX3dbX19pXSA9IH5zdGF0aWNfY2FzdDxfV29yZFQ+KDApOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19yZXNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9fYnVpbHRpbl9tZW1zZXQoX01fdywgMCwgX053ICogc2l6ZW9mKF9Xb3JkVCkpOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2lzX2VxdWFsKGNvbnN0IF9CYXNlX2JpdHNldDxfTnc+JiBfX3gpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX053OyArK19faSkKKwkgIGlmIChfTV93W19faV0gIT0gX194Ll9NX3dbX19pXSkKKwkgICAgcmV0dXJuIGZhbHNlOworCXJldHVybiB0cnVlOworICAgICAgfQorCisgICAgICB0ZW1wbGF0ZTxzaXplX3QgX05iPgorICAgICAgICBib29sCisgICAgICAgIF9NX2FyZV9hbGwoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgICB7CisJICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfTncgLSAxOyBfX2krKykKKwkgICAgaWYgKF9NX3dbX19pXSAhPSB+c3RhdGljX2Nhc3Q8X1dvcmRUPigwKSkKKwkgICAgICByZXR1cm4gZmFsc2U7CisJICByZXR1cm4gX01faGl3b3JkKCkgPT0gKH5zdGF0aWNfY2FzdDxfV29yZFQ+KDApCisJCQkJID4+IChfTncgKiBfR0xJQkNYWF9CSVRTRVRfQklUU19QRVJfV09SRAorCQkJCSAgICAgLSBfTmIpKTsKKwl9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2lzX2FueSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX053OyBfX2krKykKKwkgIGlmIChfTV93W19faV0gIT0gc3RhdGljX2Nhc3Q8X1dvcmRUPigwKSkKKwkgICAgcmV0dXJuIHRydWU7CisJcmV0dXJuIGZhbHNlOworICAgICAgfQorCisgICAgICBzaXplX3QKKyAgICAgIF9NX2RvX2NvdW50KCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlzaXplX3QgX19yZXN1bHQgPSAwOworCWZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IF9OdzsgX19pKyspCisJICBfX3Jlc3VsdCArPSBfX2J1aWx0aW5fcG9wY291bnRsKF9NX3dbX19pXSk7CisJcmV0dXJuIF9fcmVzdWx0OworICAgICAg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B1bnNpZ25lZCBsb25nIGxvbmcKKyAgICBfQmFzZV9iaXRzZXQ8X053Pjo6X01fZG9fdG9fdWxsb25nKCkgY29uc3QKKyAgICB7CisgICAgICBjb25zdCBib29sIF9fZHcgPSBzaXplb2YodW5zaWduZWQgbG9uZyBsb25nKSA+IHNpemVvZih1bnNpZ25lZCBsb25nKTsKKyAgICAgIGZvciAoc2l6ZV90IF9faSA9IDEgKyBfX2R3OyBfX2kgPCBfTnc7ICsrX19pKQorCWlmIChfTV93W19faV0pCisJICBfX3Rocm93X292ZXJmbG93X2Vycm9yKF9fTigiX0Jhc2VfYml0c2V0OjpfTV9kb190b191bGxvbmciKSk7CisKKyAgICAgIGlmIChfX2R3KQorCXJldHVybiBfTV93WzBdICsgKHN0YXRpY19jYXN0PHVuc2lnbmVkIGxvbmcgbG9uZz4oX01fd1sxXSkKKwkJCSAgPDwgX0dMSUJDWFhfQklUU0VUX0JJVFNfUEVSX1dPUkQpOworICAgICAgcmV0dXJuIF9NX3dbMF07CisgICAgfQorI2VuZGlmCisKKyAgdGVtcGxhdGU8c2l6ZV90IF9Odz4KKyAgICBzaXplX3QKKyAgICBfQmFzZV9iaXRzZXQ8X053Pjo6CisgICAgX01fZG9fZmluZF9maXJzdChzaXplX3QgX19ub3RfZm91bmQpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgeworICAgICAgZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgX053OyBfX2krKykKKwl7CisJICBfV29yZFQgX190aGlzd29yZCA9IF9NX3dbX19pXTsKKwkgIGlmIChfX3RoaXN3b3JkICE9IHN0YXRpY19jYXN0PF9Xb3JkVD4oMCkpCisJICAgIHJldHVybiAoX19pICogX0dMSUJDWFhfQklUU0VUX0JJVFNfUEVSX1dPUkQKKwkJICAgICsgX19idWlsdGluX2N0emwoX190aGlzd29yZCkpOworCX0KKyAgICAgIC8vIG5vdCBmb3VuZCwgc28gcmV0dXJuIGFuIGluZGljYXRpb24gb2YgZmFpbHVyZS4KKyAgICAgIHJldHVybiBfX25vdF9mb3VuZDsKKyAgICB9CisKKyAgdGVtcGxhdGU8c2l6ZV90IF9Odz4KKyAgICBzaXplX3QKKyAgICBfQmFzZV9iaXRzZXQ8X053Pjo6CisgICAgX01fZG9fZmluZF9uZXh0KHNpemVfdCBfX3ByZXYsIHNpemVfdCBfX25vdF9mb3VuZCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICB7CisgICAgICAvLyBtYWtlIGJvdW5kIGluY2x1c2l2ZQorICAgICAgKytfX3ByZXY7CisKKyAgICAgIC8vIGNoZWNrIG91dCBvZiBib3VuZHMKKyAgICAgIGlmIChfX3ByZXYgPj0gX053ICogX0dMSUJDWFhfQklUU0VUX0JJVFNfUEVSX1dPUkQpCisJcmV0dXJuIF9fbm90X2ZvdW5kOworCisgICAgICAvLyBzZWFyY2ggZmlyc3Qgd29yZAorICAgICAgc2l6ZV90IF9faSA9IF9TX3doaWNod29yZChfX3ByZXYpOworICAgICAgX1dvcmRUIF9fdGhpc3dvcmQgPSBfTV93W19faV07CisKKyAgICAgIC8vIG1hc2sgb2ZmIGJpdHMgYmVsb3cgYm91bmQKKyAgICAgIF9fdGhpc3dvcmQgJj0gKH5zdGF0aWNfY2FzdDxfV29yZFQ+KDApKSA8PCBfU193aGljaGJpdChfX3ByZXYpOworCisgICAgICBpZiAoX190aGlzd29yZCAhPSBzdGF0aWNfY2FzdDxfV29yZFQ+KDApKQorCXJldHVybiAoX19pICogX0dMSUJDWFhfQklUU0VUX0JJVFNfUEVSX1dPUkQKKwkJKyBfX2J1aWx0aW5fY3R6bChfX3RoaXN3b3JkKSk7CisKKyAgICAgIC8vIGNoZWNrIHN1YnNlcXVlbnQgd29yZHMKKyAgICAgIF9faSsrOworICAgICAgZm9yICg7IF9faSA8IF9OdzsgX19pKyspCisJeworCSAgX190aGlzd29yZCA9IF9NX3dbX19pXTsKKwkgIGlmIChfX3RoaXN3b3JkICE9IHN0YXRpY19jYXN0PF9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Xb3JkVCYKKyAgICAgIF9NX2hpd29yZCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93OyB9CisKKyAgICAgIF9HTElCQ1hYX0NPTlNURVhQUiBfV29yZFQKKyAgICAgIF9NX2hpd29yZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93OyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX2FuZChjb25zdCBfQmFzZV9iaXRzZXQ8MT4mIF9feCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgX01fdyAmPSBfX3guX01fdzsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19vcihjb25zdCBfQmFzZV9iaXRzZXQ8MT4mIF9feCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgX01fdyB8PSBfX3guX01fdzsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb194b3IoY29uc3QgX0Jhc2VfYml0c2V0PDE+JiBfX3gpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX3cgXj0gX194Ll9NX3c7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fbGVmdF9zaGlmdChzaXplX3QgX19zaGlmdCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgX01fdyA8PD0gX19zaGlmdDsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19yaWdodF9zaGlmdChzaXplX3QgX19zaGlmdCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgX01fdyA+Pj0gX19zaGlmdDsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19mbGlwKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgX01fdyA9IH5fTV93OyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3NldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX3cgPSB+c3RhdGljX2Nhc3Q8X1dvcmRUPigwKTsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19yZXNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IF9NX3cgPSAwOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2lzX2VxdWFsKGNvbnN0IF9CYXNlX2JpdHNldDwxPiYgX194KSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdyA9PSBfX3guX01fdzsgfQorCisgICAgICB0ZW1wbGF0ZTxzaXplX3QgX05iPgorICAgICAgICBib29sCisgICAgICAgIF9NX2FyZV9hbGwoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgICB7IHJldHVybiBfTV93ID09ICh+c3RhdGljX2Nhc3Q8X1dvcmRUPigwKQorCQkJICA+PiAoX0dMSUJDWFhfQklUU0VUX0JJVFNfUEVSX1dPUkQgLSBfTmIpKTsgfQorCisgICAgICBib29sCisgICAgICBfTV9pc19hbnkoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX01fdyAhPSAwOyB9CisKKyAgICAgIHNpemVfdAorICAgICAgX01fZG9fY291bnQoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gX19idWlsdGluX3BvcGNvdW50bChfTV93KTsgfQorCisgICAgICB1bnNpZ25lZCBsb25nCisgICAgICBfTV9kb190b191bG9uZygpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfTV93OyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdW5zaWduZWQgbG9uZyBsb25nCisgICAgICBfTV9kb190b191bGxvbmcoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gX01fdzsgfQorI2VuZGlmCisKKyAgICAgIHNpemVfdAorICAgICAgX01fZG9fZmluZF9maXJzdChzaXplX3QgX19ub3RfZm91bmQpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisgICAgICAgIGlmIChfTV93ICE9IDApCisgICAgICAgICAgcmV0dXJuIF9fYnVpbHRpbl9jdHpsKF9NX3cpOworICAgICAgICBlbHNlCisgICAgICAgICAgcmV0dXJuIF9fbm90X2ZvdW5kOworICAgICAgfQorCisgICAgICAvLyBmaW5kIHRoZSBuZXh0ICJvbiIgYml0IHRoYXQgZm9sbG93cyAicHJldiIKKyAgICAgIHNpemVfdAorICAgICAgX01fZG9fZmluZF9uZXh0KHNpemVfdCBfX3ByZXYsIHNpemVfdCBfX25vdF9mb3VuZCkgY29uc3QKKwlfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCSsrX19wcmV2OworCWlmIChfX3ByZXYgPj0gKChzaXplX3QpIF9HTElCQ1hYX0JJVFNFVF9CSVRTX1BFUl9XT1JEKSkKKwkgIHJldHVybiBfX25vdF9mb3VuZDsKKworCV9Xb3JkVCBfX3ggPSBfTV93ID4+IF9fcHJldjsKKwlpZiAoX194ICE9IDApCisJICByZXR1cm4gX19idWlsdGluX2N0emwoX194KSArIF9fcHJldjsKKwllbHNlCisJICByZXR1cm4gX19ub3RfZm91bmQ7CisgICAgICB9CisgICAgfTsKKworICAvKioKKyAgICogIEJhc2UgY2xhc3MsIHNwZWNpYWxpemF0aW9uIGZvciBubyBzdG9yYWdlICh6ZXJvLWxlbmd0aCAlYml0c2V0KS4KKyAgICoKKyAgICogIFNlZSBkb2N1bWVudGF0aW9uIGZvciBiaXRzZXQuCisgICovCisgIHRlbXBsYXRlPD4KKyAgICBzdHJ1Y3QgX0Jhc2VfYml0c2V0PDA+CisgICAgeworICAgICAgdHlwZWRlZiB1bnNpZ25lZCBsb25nIF9Xb3JkVDsKKworICAgICAgX0dMSUJDWFhfQ09OU1RFWFBSIF9CYXNlX2JpdHNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IH0KKworI2lmZGVmIF9fR1hYX0VYU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uIDA7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fYW5kKGNvbnN0IF9CYXNlX2JpdHNldDwwPiYpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fb3IoY29uc3QgX0Jhc2VfYml0c2V0PDA+JikgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb194b3IoY29uc3QgX0Jhc2VfYml0c2V0PDA+JikgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19sZWZ0X3NoaWZ0KHNpemVfdCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19yaWdodF9zaGlmdChzaXplX3QpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fZmxpcCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fc2V0KCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19yZXNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IH0KKworICAgICAgLy8gQXJlIGFsbCBlbXB0eSBiaXRzZXRzIGVxdWFsIHRvIGVhY2ggb3RoZXI/ICBBcmUgdGhleSBlcXVhbCB0bworICAgICAgLy8gdGhlbXNlbHZlcz8gIEhvdyB0byBjb21wYXJlIGEgdGhpbmcgd2hpY2ggaGFzIG5vIHN0YXRlPyAgV2hhdCBpcworICAgICAgLy8gdGhlIHNvdW5kIG9mIG9uZSB6ZXJvLWxlbmd0aCBiaXRzZXQgY2xhcHBpbmc/CisgICAgICBib29sCisgICAgICBfTV9pc19lcXVhbChjb25zdCBfQmFzZV9iaXRzZXQ8MD4mKSBj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ludHMKKyAgICogIDxlbT5iKCZhcG9zO2EmYXBvczspIGlzIDAwMDExMDAwMDE8L2VtPiBvbiBhIG1vZGVybiBBU0NJSSBzeXN0ZW0uCisgICAqCisgICAqICBAY29kZQorICAgKiAgICAgI2luY2x1ZGUgPGJpdHNldD4KKyAgICogICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KKyAgICogICAgICNpbmNsdWRlIDxzc3RyZWFtPgorICAgKgorICAgKiAgICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKKyAgICoKKyAgICogICAgIGludCBtYWluKCkKKyAgICogICAgIHsKKyAgICogICAgICAgICBsb25nICAgICAgICAgYSA9ICdhJzsKKyAgICogICAgICAgICBiaXRzZXQ8MTA+ICAgYihhKTsKKyAgICoKKyAgICogICAgICAgICBjb3V0IDw8ICJiKCdhJykgaXMgIiA8PCBiIDw8IGVuZGw7CisgICAqCisgICAqICAgICAgICAgb3N0cmluZ3N0cmVhbSBzOworICAgKiAgICAgICAgIHMgPDwgYjsKKyAgICogICAgICAgICBzdHJpbmcgIHN0ciA9IHMuc3RyKCk7CisgICAqICAgICAgICAgY291dCA8PCAiaW5kZXggMyBpbiB0aGUgc3RyaW5nIGlzICIgPDwgc3RyWzNdIDw8ICIgYnV0XG4iCisgICAqICAgICAgICAgICAgICA8PCAiaW5kZXggMyBpbiB0aGUgYml0c2V0IGlzICIgPDwgYlszXSA8PCBlbmRsOworICAgKiAgICAgfQorICAgKiAgQGVuZGNvZGUKKyAgICoKKyAgICogIEFsc28gc2VlOgorICAgKiAgaHR0cDovL2djYy5nbnUub3JnL29ubGluZWRvY3MvbGlic3RkYysrL21hbnVhbC9iazAxcHQxMmNoMzNzMDIuaHRtbAorICAgKiAgZm9yIGEgZGVzY3JpcHRpb24gb2YgZXh0ZW5zaW9ucy4KKyAgICoKKyAgICogIE1vc3Qgb2YgdGhlIGFjdHVhbCBjb2RlIGlzbid0IGNvbnRhaW5lZCBpbiAlYml0c2V0PD4gaXRzZWxmLCBidXQ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2hhcl90cmFpdHM8X0NoYXJUPj4oX19zdHIsIF9fbiwgMCwKKwkJCQkJCQkgICAgIF9fbiwgX196ZXJvLAorCQkJCQkJCSAgICAgX19vbmUpOworCX0KKyNlbmRpZgorCisgICAgICAvLyAyMy4zLjUuMiBiaXRzZXQgb3BlcmF0aW9uczoKKyAgICAgIC8vQHsKKyAgICAgIC8qKgorICAgICAgICogIE9wZXJhdGlvbnMgb24gYml0c2V0cy4KKyAgICAgICAqICBAcGFyYW0gIF9fcmhzICBBIHNhbWUtc2l6ZWQgYml0c2V0LgorICAgICAgICoKKyAgICAgICAqICBUaGVzZSBzaG91bGQgYmUgc2VsZi1leHBsYW5hdG9yeS4KKyAgICAgICAqLworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBvcGVyYXRvciY9KGNvbnN0IGJpdHNldDxfTmI+JiBfX3JocykgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19hbmQoX19yaHMpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBvcGVyYXRvcnw9KGNvbnN0IGJpdHNldDxfTmI+JiBfX3JocykgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19vcihfX3Jocyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIG9wZXJhdG9yXj0oY29uc3QgYml0c2V0PF9OYj4mIF9fcmhzKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCXRoaXMtPl9NX2RvX3hvcihfX3Jocyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorICAgICAgLy9AfQorICAgICAgCisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBPcGVyYXRpb25zIG9uIGJpdHNldHMuCisgICAgICAgKiAgQHBhcmFtICBfX3Bvc2l0aW9uICBUaGUgbnVtYmVyIG9mIHBsYW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c2lvbnMKKyAgICAgICAqLworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBfVW5jaGVja2VkX3NldChzaXplX3QgX19wb3MpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJdGhpcy0+X01fZ2V0d29yZChfX3BvcykgfD0gX0Jhc2U6Ol9TX21hc2tiaXQoX19wb3MpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBfVW5jaGVja2VkX3NldChzaXplX3QgX19wb3MsIGludCBfX3ZhbCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlpZiAoX192YWwpCisJICB0aGlzLT5fTV9nZXR3b3JkKF9fcG9zKSB8PSBfQmFzZTo6X1NfbWFza2JpdChfX3Bvcyk7CisJZWxzZQorCSAgdGhpcy0+X01fZ2V0d29yZChfX3BvcykgJj0gfl9CYXNlOjpfU19tYXNrYml0KF9fcG9zKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgX1VuY2hlY2tlZF9yZXNldChzaXplX3QgX19wb3MpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJdGhpcy0+X01fZ2V0d29yZChfX3BvcykgJj0gfl9CYXNlOjpfU19tYXNrYml0KF9fcG9zKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgX1VuY2hlY2tlZF9mbGlwKHNpemVfdCBfX3BvcykgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwl0aGlzLT5fTV9nZXR3b3JkKF9fcG9zKSBePSBfQmFzZTo6X1NfbWFza2JpdChfX3Bvcyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfR0xJQkNYWF9DT05TVEVYUFIgYm9vbAorICAgICAgX1VuY2hlY2tlZF90ZXN0KHNpemVfdCBfX3BvcykgY29uc3QgX0dMSUJD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gICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFNldHMgZXZlcnkgYml0IHRvIGZhbHNlLgorICAgICAgICovCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIHJlc2V0KCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19yZXNldCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFNldHMgYSBnaXZlbiBiaXQgdG8gZmFsc2UuCisgICAgICAgKiAgQHBhcmFtICBfX3Bvc2l0aW9uICBUaGUgaW5kZXggb2YgdGhlIGJpdC4KKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6b3V0X29mX3JhbmdlICBJZiBAYSBwb3MgaXMgYmlnZ2VyIHRoZSBzaXplIG9mIHRoZSAlc2V0LgorICAgICAgICoKKyAgICAgICAqICBTYW1lIGFzIHdyaXRpbmcgQGMgc2V0KHBvcyxmYWxzZSkuCisgICAgICAgKi8KKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgcmVzZXQoc2l6ZV90IF9fcG9zaXRpb24pCisgICAgICB7CisJaWYgKF9fcG9zaXRpb24gPj0gX05iKQorCSAgX190aHJvd19vdXRfb2ZfcmFuZ2UoX19OKCJiaXRzZXQ6OnJlc2V0IikpOworCXJldHVybiBfVW5jaGVja2VkX3Jlc2V0KF9fcG9zaXRpb24pOworICAgICAgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgVG9nZ2xlcyBldmVyeSBiaXQgdG8gaXRzIG9wcG9zaXRlIHZhbHVlLgorICAgICAgICovCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIGZsaXAoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCXRoaXMtPl9NX2RvX2ZsaXAoKTsKKwl0aGlzLT5fTV9kb19zYW5pdGl6ZSgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworIC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zIGRvIG5vIHJhbmdlIGNoZWNraW5nIGFuZCB0aHJvdyBubyBleGNlcHRpb25zLAorICAgICAgICogICAgICAgICBhcyByZXF1aXJlZCBieSBEUiAxMSB0byB0aGUgc3RhbmRhcmQuCisgICAgICAgKgorICAgICAgICogIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMgTm90ZSB0aGF0IHRoaXMgaW1wbGVtZW50YXRpb24gYWxyZWFkeQorICAgICAgICogIHJlc29sdmVzIERSIDExIChpdGVtcyAxIGFuZCAyKSwgYnV0IGRvZXMgbm90IGRvIHRoZSByYW5nZS1jaGVja2luZworICAgICAgICogIHJlcXVpcmVkIGJ5IHRoYXQgRFIncyByZXNvbHV0aW9uLiAgLXBtZQorICAgICAgICogIFRoZSBEUiBoYXMgc2luY2UgYmVlbiBjaGFuZ2VkOiAgcmFuZ2UtY2hlY2tpbmcgaXMgYSBwcmVjb25kaXRpb24KKyAgICAgICAqICAodXNlcnMnIHJlc3BvbnNpYmlsaXR5KSwgYW5kIHRoZXNlIGZ1bmN0aW9ucyBtdXN0IG5vdCB0aHJvdy4gIC1wbWUKKyAgICAgICAqLworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdCBfX3Bvc2l0aW9uKQorICAgICAgeyByZXR1cm4gcmVmZXJlbmNlKCp0aGlzLCBfX3Bvc2l0aW9uKTsgfQorCisgICAgICBfR0xJQkNYWF9DT05TVEVYUFIgYm9vbAorICAgICAgb3BlcmF0b3JbXShzaXplX3QgX19wb3NpdGlvbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9VbmNoZWNrZWRfdGVzdChfX3Bvc2l0aW9uKTsgfQorICAgICAgLy9AfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgUmV0dXJucyBhIG51bWVyaWNhbCBpbnRlcnByZXRhdGlvbiBvZiB0aGUgJWJpdHNldC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgaW50ZWdyYWwgZXF1aXZhbGVudCBvZiB0aGUgYml0cy4KKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6b3ZlcmZsb3dfZXJyb3IgIElmIHRoZXJlIGFyZSB0b28gbWFueSBiaXRzIHRvIGJlCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXByZXNlbnRlZCBpbiBhbiBAYyB1bnNpZ25lZCBAYyBsb25nLgorICAgICAgICovCisgICAgICB1bnNpZ25lZCBsb25nCisgICAgICB0b191bG9uZygpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9kb190b191bG9uZygpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdW5zaWduZWQgbG9uZyBsb25nCisgICAgICB0b191bGxvbmcoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fZG9fdG9fdWxsb25nKCk7IH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgUmV0dXJucyBhIGNoYXJhY3RlciBpbnRlcnByZXRhdGlvbiBvZiB0aGUgJWJpdHNldC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgc3RyaW5nIGVxdWl2YWxlbnQgb2YgdGhlIGJpdHMuCisgICAgICAgKgorICAgICAgICogIE5vdGUgdGhlIG9yZGVyaW5nIG9mIHRoZSBiaXRzOiAgZGVjcmVhc2luZyBjaGFyYWN0ZXIgcG9zaXRpb25zCisgICAgICAgKiAgY29ycmVzcG9uZCB0byBpbmNyZWFzaW5nIGJpdCBwb3NpdGlvbnMgKHNlZSB0aGUgbWFpbiBjbGFzcyBub3RlcyBmb3IKKyAgICAgICAqICBhbiBleGFtcGxlKS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0NoYXJULCBjbGFzcyBfVHJhaXRzLCBjbGFzcyBfQWxsb2M+CisJc3RkOjpiYXNpY19zdHJpbmc8X0NoYXJULCBfVHJhaXRzLCBfQWxsb2M+C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gICAgICAqICBAYnJpZWYgVGVzdHMgdGhlIHZhbHVlIG9mIGEgYml0LgorICAgICAgICogIEBwYXJhbSAgX19wb3NpdGlvbiAgVGhlIGluZGV4IG9mIGEgYml0LgorICAgICAgICogIEByZXR1cm4gIFRoZSB2YWx1ZSBhdCBAYSBwb3MuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om91dF9vZl9yYW5nZSAgSWYgQGEgcG9zIGlzIGJpZ2dlciB0aGUgc2l6ZSBvZiB0aGUgJXNldC4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgdGVzdChzaXplX3QgX19wb3NpdGlvbikgY29uc3QKKyAgICAgIHsKKwlpZiAoX19wb3NpdGlvbiA+PSBfTmIpCisJICBfX3Rocm93X291dF9vZl9yYW5nZShfX04oImJpdHNldDo6dGVzdCIpKTsKKwlyZXR1cm4gX1VuY2hlY2tlZF90ZXN0KF9fcG9zaXRpb24pOworICAgICAgfQorCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyBEUiA2OTMuIHN0ZDo6Yml0c2V0OjphbGwoKSBtaXNzaW5nLgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFRlc3RzIHdoZXRoZXIgYWxsIHRoZSBiaXRzIGFyZSBvbi4KKyAgICAgICAqICBAcmV0dXJuICBUcnVlIGlmIGFsbCB0aGUgYml0cyBhcmUgc2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICBhbGwoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gdGhpcy0+dGVtcGxhdGUgX01fYXJlX2FsbDxfTmI+KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFRlc3RzIHdoZXRoZXIgYW55IG9mIHRoZSBiaXRzIGFyZSBvbi4KKyAgICAgICAqICBAcmV0dXJuICBUcnVlIGlmIGF0IGxlYXN0IG9uZSBiaXQgaXMgc2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICBhbnkoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faXNfYW55KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFRlc3RzIHdoZXRoZXIgYW55IG9mIHRoZSBiaXRzIGFyZSBvbi4KKyAgICAgICAqICBAcmV0dXJuICBUcnVlIGlmIG5vbmUgb2YgdGhlIGJpdHMgYXJlIHNldC4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgbm9uZSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiAhdGhpcy0+X01faXNfYW55KCk7IH0KKworICAgICAgLy9AeworICAgICAgLy8vIFNlbGYtZXhwbGFuYXRvcnkuCisgICAgICBiaXRzZXQ8X05iPgorICAgICAgb3BlcmF0b3I8PChzaXplX3QgX19wb3NpdGlvbikgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIGJpdHNldDxfTmI+KCp0aGlzKSA8PD0gX19wb3NpdGlvbjsgfQorCisgICAgICBiaXRzZXQ8X05iPgorICAgICAgb3BlcmF0b3I+PihzaXplX3QgX19wb3NpdGlvbikgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIGJpdHNldDxfTmI+KCp0aGlzKSA+Pj0gX19wb3NpdGlvbjsgfQorICAgICAgLy9AfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmRzIHRoZSBpbmRleCBvZiB0aGUgZmlyc3QgIm9uIiBiaXQuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGluZGV4IG9mIHRoZSBmaXJzdCBiaXQgc2V0LCBvciBzaXplKCkgaWYgbm90IGZvdW5kLgorICAgICAgICogIEBpbmdyb3VwIFNHSWV4dGVuc2lvbnMKKyAgICAgICAqICBAc2EgIF9GaW5kX25leHQKKyAgICAgICAqLwor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Rvci0oKSBjb25zdAorCXsgcmV0dXJuIGR1cmF0aW9uKC1fX3IpOyB9CisKKwlkdXJhdGlvbiYKKwlvcGVyYXRvcisrKCkKKwl7CisJICArK19fcjsKKwkgIHJldHVybiAqdGhpczsKKwl9CisKKwlkdXJhdGlvbgorCW9wZXJhdG9yKysoaW50KQorCXsgcmV0dXJuIGR1cmF0aW9uKF9fcisrKTsgfQorCisJZHVyYXRpb24mCisJb3BlcmF0b3ItLSgpCisJeworCSAgLS1fX3I7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisJZHVyYXRpb24KKwlvcGVyYXRvci0tKGludCkKKwl7IHJldHVybiBkdXJhdGlvbihfX3ItLSk7IH0KKworCWR1cmF0aW9uJgorCW9wZXJhdG9yKz0oY29uc3QgZHVyYXRpb24mIF9fZCkKKwl7CisJICBfX3IgKz0gX19kLmNvdW50KCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisJZHVyYXRpb24mCisJb3BlcmF0b3ItPShjb25zdCBkdXJhdGlvbiYgX19kKQorCXsKKwkgIF9fciAtPSBfX2QuY291bnQoKTsKKwkgIHJldHVybiAqdGhpczsKKwl9CisKKwlkdXJhdGlvbiYKKwlvcGVyYXRvcio9KGNvbnN0IHJlcCYgX19yaHMpCisJeworCSAgX19yICo9IF9fcmhzOworCSAgcmV0dXJuICp0aGlzOworCX0KKworCWR1cmF0aW9uJgorCW9wZXJhdG9yLz0oY29uc3QgcmVwJiBfX3JocykKKwl7CisJICBfX3IgLz0gX19yaHM7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisJLy8gRFIgOTM0LgorCXRlbXBsYXRlPHR5cGVuYW1lIF9SZXAyID0gcmVwPgorCSAgdHlwZW5hbWUgZW5hYmxlX2lmPCF0cmVhdF9hc19mbG9hdGluZ19wb2ludDxfUmVwMj46OnZhbHVlLAorCQkJICAgICBkdXJhdGlvbiY+Ojp0eXBlCisJICBvcGVyYXRvciU9KGNvbnN0IHJlcCYgX19yaHMpCisJICB7CisJICAg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UJDWFhfQ09OU1RFWFBSCisgICAgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGFzaW4oX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fYXNpbihfX3gpOyB9CisKKyAgdXNpbmcgOjphdGFuOworCisjaWZuZGVmIF9fQ09SUkVDVF9JU09fQ1BQX01BVEhfSF9QUk9UTzEKKyAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUiBmbG9hdAorICBhdGFuKGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2F0YW5mKF9feCk7IH0KKworICBpbmxpbmUgX0dMSUJDWFhfQ09OU1RFWFBSIGxvbmcgZG91YmxlCisgIGF0YW4obG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fYXRhbmwoX194KTsgfQorI2VuZGlmCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfR0xJQkNYWF9DT05TVEVYUFIKKyAgICB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgYXRhbihfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9hdGFuKF9feCk7IH0KKworICB1c2luZyA6OmF0YW4yOworCisjaWZuZGVmIF9fQ09SUkVDVF9JU09fQ1BQX01BVEhfSF9QUk9UTzEKKyAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUiBmbG9hdAorICBhdGFuMihmbG9hdCBfX3ksIGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2F0YW4yZihfX3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9uZyBkb3VibGUKKyAgZnJleHAobG9uZyBkb3VibGUgX194LCBpbnQqIF9fZXhwKQorICB7IHJldHVybiBfX2J1aWx0aW5fZnJleHBsKF9feCwgX19leHApOyB9CisjZW5kaWYKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUgorICAgIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgZnJleHAoX1RwIF9feCwgaW50KiBfX2V4cCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fZnJleHAoX194LCBfX2V4cCk7IH0KKworICB1c2luZyA6OmxkZXhwOworCisjaWZuZGVmIF9fQ09SUkVDVF9JU09fQ1BQX01BVEhfSF9QUk9UTzEKKyAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUiBmbG9hdAorICBsZGV4cChmbG9hdCBfX3gsIGludCBfX2V4cCkKKyAgeyByZXR1cm4gX19idWlsdGluX2xkZXhwZihfX3gsIF9fZXhwKTsgfQorCisgIGlubGluZSBfR0xJQkNYWF9DT05TVEVYUFIgbG9uZyBkb3VibGUKKyAgbGRleHAobG9uZyBkb3VibGUgX194LCBpbnQgX19leHApCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9sZGV4cGwoX194LCBfX2V4cCk7IH0KKyNlbmRpZgorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX0dMSUJDWFhfQ09OU1RFWFBSCisgICAgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBsZGV4cChfVHAgX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xlCisgIHNpbihsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zaW5sKF9feCk7IH0KKyNlbmRpZgorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX0dMSUJDWFhfQ09OU1RFWFBSCisgICAgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBzaW4oX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fc2luKF9feCk7IH0KKworICB1c2luZyA6OnNpbmg7CisKKyNpZm5kZWYgX19DT1JSRUNUX0lTT19DUFBfTUFUSF9IX1BST1RPMQorICBpbmxpbmUgX0dMSUJDWFhfQ09OU1RFWFBSIGZsb2F0CisgIHNpbmgoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fc2luaGYoX194KTsgfQorCisgIGlubGluZSBfR0xJQkNYWF9DT05TVEVYUFIgbG9uZyBkb3VibGUKKyAgc2luaChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zaW5obChfX3gpOyB9CisjZW5kaWYKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUgorICAgIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgc2luaChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9zaW5oKF9feCk7IH0KKworICB1c2luZyA6OnNxcnQ7CisKKyNpZm5kZWYgX19DT1JSRUNUX0lTT19DUFBfTUF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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQ+OjpfX3R5cGUKKyAgICBmcGNsYXNzaWZ5KF9UcCBfX3gpCisgICAgeyByZXR1cm4gX194ICE9IDAgPyBGUF9OT1JNQUwgOiBGUF9aRVJPOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNmaW5pdGUoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNmaW5pdGUoX194KTsgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzZmluaXRlKGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc2Zpbml0ZShfX3gpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNmaW5pdGUobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNmaW5pdGUoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sPjo6X190eXBlCisgICAgaXNmaW5pdGUoX1RwIF9feCkKKyAgICB7IHJldHVybiB0cnVlOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNpbmYoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNpbmYoX194KTsgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzaW5mKGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc2luZihfX3gpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNpbmYobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNpbmYoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sPjo6X190eXBlCisgICAgaXNpbmYoX1RwIF9feCkKKyAgICB7IHJldHVybiBmYWxzZTsgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzbmFuKGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2lzbmFuKF9feCk7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBpc25hbihkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNuYW4oX194KTsgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzbmFuKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2lzbmFuKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbD46Ol9fdHlwZQorICAgIGlzbmFuKF9UcCBfX3gpCisgICAgeyByZXR1cm4gZmFsc2U7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBpc25vcm1hbChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc25vcm1hbChfX3gpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNub3JtYWwoZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2lzbm9ybWFsKF9feCk7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBpc25vcm1hbChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc25vcm1hbChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2w+OjpfX3R5cGUKKyAgICBpc25vcm1hbChfVHAgX194KQorICAgIHsgcmV0dXJuIF9feCAhPSAwID8gdHJ1ZSA6IGZhbHNlOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgc2lnbmJpdChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zaWduYml0KF9feCk7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBzaWduYml0KGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zaWduYml0KF9feCk7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBzaWduYml0KGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX3NpZ25iaXQoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sPjo6X190eXBlCisgICAgc2lnbmJpdChfVHAgX194KQorICAgIHsgcmV0dXJuIF9feCA8IDAgPyB0cnVlIDogZmFsc2U7IH0KKworICBjb25zdGV4cHIgYm9vbAorICBpc2dyZWF0ZXIoZmxvYXQgX194LCBmbG9hdCBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc2dyZWF0ZXIoX194LCBfX3kpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNncmVhdGVyKGRvdWJsZSBfX3gsIGRvdWJsZSBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pc2dyZWF0ZXIoX194LCBfX3kpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNncmVhdGVyKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNncmVhdGVyKF9feCwgX195KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX1VwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZQorICAgIF9fZ251X2N4eDo6X19lbmFibGVfaWY8KF9faXNfYXJpdGhtZXRpYzxfVHA+OjpfX3ZhbHVlCisJCQkgICAgJiYgX19pc19hcml0aG1ldGljPF9VcD46Ol9fdmFsdWUpLCBib29sPjo6X190eXBlCisgICAgaXNncmVhdGVyKF9UcCBfX3gsIF9VcCBfX3kpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBfX2J1aWx0aW5faXNncmVhdGVyKF9fdHlwZShfX3gpLCBfX3R5cGUoX195KSk7CisgICAgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzZ3JlYXRlcmVxdWFsKGZsb2F0IF9feCwgZmxvYXQgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNncmVhdGVyZXF1YWwoX194LCBfX3kpOyB9CisKKyAgY29uc3RleHByIGJvb2wKKyAgaXNncmVhdGVyZXF1YWwoZG91YmxlIF9feCwgZG91YmxlIF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX2lzZ3JlYXRlcmVxdWFsKF9feCwgX195KTsgfQorCisgIGNvbnN0ZXhwciBib29sCisgIGlzZ3JlYXRlcmVxdWFsKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5faXNncmVhdGVyZXF1YWwo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X2Fjb3NoZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIGFjb3NoKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2Fjb3NobChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBhY29zaChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9hY29zaChfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGFzaW5oKGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2FzaW5oZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIGFzaW5oKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2FzaW5obChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBhc2luaChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9hc2luaChfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGF0YW5oKGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2F0YW5oZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIGF0YW5oKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2F0YW5obChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBhdGFuaChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9hdGFuaChfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGNicnQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2JydGYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBjYnJ0KGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2NicnRsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGNicnQoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fY2JydChfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGNvcHlzaWduKGZsb2F0IF9feCwgZmxvYXQgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5fY29weXNpZ25mKF9feCwgX195KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBjb3B5c2lnbihsb25nIGRvdWJsZSBfX3gsIGxvbmcgZG91YmxlIF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX2NvcHlzaWdubChfX3gsIF9feSk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9VcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZQorICAgIGNvcHlzaWduKF9UcCBfX3gsIF9VcCBfX3kpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBjb3B5c2lnbihfX3R5cGUoX194KSwgX190eXBlKF9feSkpOworICAgIH0KKworICBjb25zdGV4cHIgZmxvYXQKKyAgZXJmKGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2VyZmYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBlcmYobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fZXJmbChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICBlcmYoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fZXJmKF9feCk7IH0KKworICBjb25zdGV4cHIgZmxvYXQKKyAgZXJmYyhmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9lcmZjZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIGVyZmMobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fZXJmY2woX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgZXJmYyhfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9lcmZjKF9feCk7IH0KKworICBjb25zdGV4cHIgZmxvYXQKKyAgZXhwMihmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9leHAyZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIGV4cDIobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fZXhwMmwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgZXhwMihfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9leHAyKF9feCk7IH0KKworICBjb25zdGV4cHIgZmxvYXQKKyAgZXhwbTEoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fZXhwbTFmKF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgZXhwbTEobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fZXhwbTFsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGV4cG0xKF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX2V4cG0xKF9feCk7IH0KKworICBjb25zdGV4cHIgZmxvYXQKKyAgZmRpbShmbG9hdCBfX3gsIGZsb2F0IF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX2ZkaW1mKF9feCwgX195KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBmZGltKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5fZmRpbWwoX194LCBfX3kpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfVXA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19wcm9tb3RlXzI8X1RwLCBfVXA+OjpfX3R5cGUKKyAgICBmZGltKF9UcCBfX3gsIF9VcCBfX3kpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBmZGltKF9fdHlwZShfX3gpLCBfX3R5cGUoX195KSk7CisgICAgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICBmbWEoZmxvYXQgX194LCBmbG9hdCBfX3ksIGZsb2F0IF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2ZtYWYoX194LCBfX3ksIF9feik7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgZm1hKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195LCBsb25nIGRvdWJsZSBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9mbWFsKF9feCwgX195LCBfX3opOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1R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fdHlwZShfX3kpKTsKKyAgICB9CisKKyAgY29uc3RleHByIGludAorICBpbG9nYihmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9pbG9nYmYoX194KTsgfQorCisgIGNvbnN0ZXhwciBpbnQKKyAgaWxvZ2IobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5faWxvZ2JsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByCisgICAgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQ+OjpfX3R5cGUKKyAgICBpbG9nYihfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9pbG9nYihfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGxnYW1tYShmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9sZ2FtbWFmKF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgbGdhbW1hKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2xnYW1tYWwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgbGdhbW1hKF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX2xnYW1tYShfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgbG9uZworICBsbHJpbnQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbGxyaW50ZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgbG9uZworICBsbHJpbnQobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbGxyaW50bChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGxvbmc+OjpfX3R5cGUKKyAgICBsbHJpbnQoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fbGxyaW50KF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZyBsb25nCisgIGxscm91bmQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbGxyb3VuZGYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGxvbmcKKyAgbGxyb3VuZChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9sbHJvdW5kbChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGxvbmc+OjpfX3R5cGUKKyAgICBsbHJvdW5kKF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX2xscm91bmQoX194KTsgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICBsb2cxcChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9sb2cxcGYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBsb2cxcChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9sb2cxcGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgbG9nMXAoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fbG9nMXAoX194KTsgfQorCisgIC8vIERSIDU2OC4KKyAgY29uc3RleHByIGZsb2F0CisgIGxvZzIoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbG9nMmYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBsb2cyKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2xvZzJsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGxvZzIoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fbG9nMihfX3gpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIGxvZ2IoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbG9nYmYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBsb2diKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2xvZ2JsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGxvZ2IoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fbG9nYihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcKKyAgbHJpbnQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbHJpbnRmKF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZworICBscmludChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9scmludGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZz46Ol9fdHlwZQorICAgIGxyaW50KF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX2xyaW50KF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZworICBscm91bmQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbHJvdW5kZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcKKyAgbHJvdW5kKGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX2xyb3VuZGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZz46Ol9fdHlwZQorICAgIGxyb3VuZChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9scm91bmQoX194KTsgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICBuZWFyYnlpbnQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fbmVhcmJ5aW50ZihfX3gpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIG5lYXJieWludChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9uZWFyYnlpbnRsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIG5lYXJieWludChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9uZWFyYnlpbnQoX194KTsgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICBuZXh0YWZ0ZXIoZmxvYXQgX194LCBmbG9hdCBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9uZXh0YWZ0ZXJmKF9feCwgX195KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBuZXh0YWZ0ZXIobG9uZyBkb3VibGUgX194LCBsb25nIGRvdWJsZSBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9uZXh0YWZ0ZXJsKF9feCwgX195KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX1VwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlCisgICAgbmV4dGFmdGVyKF9UcCBfX3gsIF9VcCBfX3kpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBuZXh0YWZ0ZXIoX190eXBlKF9feCksIF9fdHlwZShfX3kpKTsKKyAgICB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIG5leHR0b3dhcmQoZmxvYXQgX194LCBsb25nIGRvdWJsZSBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9uZXh0dG93YXJkZihfX3gsIF9feSk7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgbmV4dHRvd2FyZChsb25nIGRvdWJsZSBfX3gsIGxvbmcgZG91YmxlIF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX25leHR0b3dhcmRsKF9feCwgX195KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgbmV4dHRvd2FyZChfVHAgX194LCBsb25nIGRvdWJsZSBfX3kpCisgICAgeyByZXR1cm4gX19idWlsdGluX25leHR0b3dhcmQoX194LCBfX3kpOyB9CisKKyAgY29uc3RleHByIGZsb2F0CisgIHJlbWFpbmRlcihmbG9hdCBfX3gsIGZsb2F0IF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX3JlbWFpbmRlcmYoX194LCBfX3kpOyB9CisKKyAgY29uc3RleHByIGxvbmcgZG91YmxlCisgIHJlbWFpbmRlcihsb25nIGRvdWJsZSBfX3gsIGxvbmcgZG91YmxlIF9feSkKKyAgeyByZXR1cm4gX19idWlsdGluX3JlbWFpbmRlcmwoX194LCBfX3kpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfVXA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19wcm9tb3RlXzI8X1RwLCBfVXA+OjpfX3R5cGUKKyAgICByZW1haW5kZXIoX1RwIF9feCwgX1VwIF9feSkKKyAgICB7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fZ251X2N4eDo6X19wcm9tb3RlXzI8X1RwLCBfVXA+OjpfX3R5cGUgX190eXBlOworICAgICAgcmV0dXJuIHJlbWFpbmRlcihfX3R5cGUoX194KSwgX190eXBlKF9feSkpOworICAgIH0KKworICBpbmxpbmUgZmxvYXQKKyAgcmVtcXVvKGZsb2F0IF9feCwgZmxvYXQgX195LCBpbnQqIF9fcHF1bykKKyAgeyByZXR1cm4gX19idWlsdGluX3JlbXF1b2YoX194LCBfX3ksIF9fcHF1byk7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgcmVtcXVvKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195LCBpbnQqIF9fcHF1bykKKyAgeyByZXR1cm4gX19idWlsdGluX3JlbXF1b2woX194LCBfX3ksIF9fcHF1byk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9VcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZQorICAgIHJlbXF1byhfVHAgX194LCBfVXAgX195LCBpbnQqIF9fcHF1bykKKyAgICB7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fZ251X2N4eDo6X19wcm9tb3RlXzI8X1RwLCBfVXA+OjpfX3R5cGUgX190eXBlOworICAgICAgcmV0dXJuIHJlbXF1byhfX3R5cGUoX194KSwgX190eXBlKF9feSksIF9fcHF1byk7CisgICAgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICByaW50KGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX3JpbnRmKF9feCk7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgcmludChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9yaW50bChfX3gpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fZW5hYmxlX2lmPF9faXNfaW50ZWdlcjxfVHA+OjpfX3ZhbHVlLCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VibGU+OjpfX3R5cGUKKyAgICByaW50KF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX3JpbnQoX194KTsgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICByb3VuZChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9yb3VuZGYoX194KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICByb3VuZChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9yb3VuZGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgcm91bmQoX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fcm91bmQoX194KTsgfQorCisgIGNvbnN0ZXhwciBmbG9hdAorICBzY2FsYmxuKGZsb2F0IF9feCwgbG9uZyBfX2V4KQorICB7IHJldHVybiBfX2J1aWx0aW5fc2NhbGJsbmYoX194LCBfX2V4KTsgfQorCisgIGNvbnN0ZXhwciBsb25nIGRvdWJsZQorICBzY2FsYmxuKGxvbmcgZG91YmxlIF9feCwgbG9uZyBfX2V4KQorICB7IHJldHVybiBfX2J1aWx0aW5fc2NhbGJsbmwoX194LCBfX2V4KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91YmxlPjo6X190eXBlCisgICAgc2NhbGJsbihfVHAgX194LCBsb25nIF9fZXgpCisgICAgeyByZXR1cm4gX19idWlsdGluX3NjYWxibG4oX194LCBfX2V4KTsgfQorIAorICBjb25zdGV4cHIgZmxvYXQKKyAgc2NhbGJuKGZsb2F0IF9feCwgaW50IF9fZXgpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zY2FsYm5mKF9feCwgX19leCk7IH0KKworICBjb25zdGV4cHIgbG9uZyBkb3VibGUKKyAgc2NhbGJuKGxvbmcgZG91YmxlIF9feCwgaW50IF9fZXgpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9zY2FsYm5sKF9feCwgX19leCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29uc3RleHByIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvdWJsZT46Ol9fdHlwZQorICAgIHNjYWxibihfVHAgX194LCBpbnQgX19leCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fc2NhbGJuKF9feCwgX19leCk7IH0KKworICBjb25zdGV4cHIgZm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9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gRFIgMzg3LiBzdGQ6OmNvbXBsZXggb3Zlci1lbmNhcHN1bGF0ZWQuCisgICAgICBjb25zdGV4cHIgX1RwIAorICAgICAgcmVhbCgpIHsgcmV0dXJuIF9NX3JlYWw7IH0KKworICAgICAgY29uc3RleHByIF9UcCAKKyAgICAgIGltYWcoKSB7IHJldHVybiBfTV9pbWFnOyB9CisjZWxzZQorICAgICAgLy8vICBSZXR1cm4gcmVhbCBwYXJ0IG9mIGNvbXBsZXggbnVtYmVyLgorICAgICAgX1RwJiAKKyAgICAgIHJlYWwoKSB7IHJldHVybiBfTV9yZWFsOyB9CisKKyAgICAgIC8vLyAgUmV0dXJuIHJlYWwgcGFydCBvZiBjb21wbGV4IG51bWJlci4KKyAgICAgIGNvbnN0IF9UcCYgCisgICAgICByZWFsKCkgY29uc3QgeyByZXR1cm4gX01fcmVhbDsgfQorCisgICAgICAvLy8gIFJldHVybiBpbWFnaW5hcnkgcGFydCBvZiBjb21wbGV4IG51bWJlci4KKyAgICAgIF9UcCYgCisgICAgICBpbWFnKCkgeyByZXR1cm4gX01faW1hZzsgfQorCisgICAgICAvLy8gIFJldHVybiBpbWFnaW5hcnkgcGFydCBvZiBjb21wbGV4IG51bWJlci4KKyAgICAgIGNvbnN0IF9UcCYgCisgICAgICBpbWFnKCkgY29uc3QgeyByZXR1cm4gX01faW1hZzsgfQorI2VuZGlmCisKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIERSIDM4Ny4gc3RkOjpjb21wbGV4IG92ZXItZW5jYXBzdWxhdGVkLgorICAgICAgdm9pZCAKKyAgICAgIHJlYWwoX1RwIF9fdmFsKSB7IF9NX3JlYWwgPSBfX3ZhbDsgfQorCisgICAgICB2b2lkIAorICAgICAgaW1hZyhfVHAgX192YWwpIHsgX01faW1hZyA9IF9fdmFsOyB9CisKKyAgICAgIC8vLyBBc3NpZ24gdGhpcyBjb21wbGV4IG51bWJlciB0byBzY2FsYXIgQGEgdC4KKyAgICAgIGNvbXBsZXg8X1RwPiYgb3BlcmF0b3I9KGNvbnN0IF9UcCYpOworICAgICAgCisgICAgICAvLy8gQWRkIEBhIHQgdG8gdGhpcyBjb21wbGV4IG51bWJlci4KKyAgICAgIC8vIDI2LjIuNS8xCisgICAgICBjb21wbGV4PF9UcD4mCisgICAgICBvcGVyYXRvcis9KGNvbnN0IF9UcCYgX190KQorICAgICAgeworCV9NX3JlYWwgKz0gX190OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLy8vIFN1YnRyYWN0IEBhIHQgZnJvbSB0aGlzIGNvbXBsZXggbnVtYmVyLgorICAgICAgLy8gMjYuMi41LzMKKyAgICAgIGNvbXBsZXg8X1RwPiYKKyAgICAgIG9wZXJhdG9yLT0oY29uc3QgX1RwJiBfX3QpCisgICAgICB7CisJX01fcmVhbCAtPSBfX3Q7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvLy8gTXVsdGlwbHkgdGhpcyBjb21wbGV4IG51bWJlciBieSBAYSB0LgorICAgICAgY29tcGxleDxfVHA+JiBvcGVyYXRvcio9KGNvbnN0IF9UcCYpOworICAgICAgLy8vIERpdmlkZSB0aGlzIGNvbXBsZXggbnVtYmVyIGJ5IEBhIHQuCisgICAgICBjb21wbGV4PF9UcD4mIG9wZXJhdG9yLz0oY29uc3QgX1RwJik7CisKKyAgICAgIC8vIExldHMgdGhlIGNvbXBpbGVyIHN5bnRoZXNpemUgdGhlCisgICAgICAvLyBjb3B5IGFuZCBhc3NpZ25tZW50IG9wZXJhdG9yCisgICAgICAvLyBjb21wbGV4PF9UcD4mIG9wZXJhdG9yPSAoY29uc3QgY29tcGxleDxfVHA+Jik7CisgICAgICAvLy8gQXNzaWduIHRoaXMgY29tcGxleC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NvbXBsZXg8X1RwPjo6b3BlcmF0b3I9KGNvbnN0IF9UcCYgX190KQorICAgIHsKKyAgICAgX01fcmVhbCA9IF9fdDsKKyAgICAgX01faW1hZyA9IF9UcCgpOworICAgICByZXR1cm4gKnRoaXM7CisgICAgfSAKKworICAvLyAyNi4yLjUvNQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29tcGxleDxfVHA+JgorICAgIGNvbXBsZXg8X1RwPjo6b3BlcmF0b3IqPShjb25zdCBfVHAmIF9fdCkKKyAgICB7CisgICAgICBfTV9yZWFsICo9IF9fdDsKKyAgICAgIF9NX2ltYWcgKj0gX190OworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAvLyAyNi4yLjUvNworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29tcGxleDxfVHA+JgorICAgIGNvbXBsZXg8X1RwPjo6b3BlcmF0b3IvPShjb25zdCBfVHAmIF9fdCkKKyAgICB7CisgICAgICBfTV9yZWFsIC89IF9fdDsKKyAgICAgIF9NX2ltYWcgLz0gX190OworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VwPgorICAgIGNvbXBsZXg8X1RwPiYKKyAgICBjb21wbGV4PF9UcD46Om9wZXJhdG9yPShjb25zdCBjb21wbGV4PF9VcD4mIF9feikKKyAgICB7CisgICAgICBfTV9yZWFsID0gX196LnJlYWwoKTsKKyAgICAgIF9NX2ltYWcgPSBfX3ouaW1hZygpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAvLyAyNi4yLjUvOQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VwPgorICAgIGNvbXBsZXg8X1RwPiYKKyAgICBjb21wbGV4PF9UcD46Om9wZXJhdG9yKz0oY29uc3QgY29tcGxleDxfVXA+JiBfX3opCisgICAgeworICAgICAgX01fcmVhbCArPSBfX3oucmVhbCgpOworICAgICAgX01faW1hZyArPSBfX3ouaW1hZygpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAvLyAyNi4yLjUvMTEKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9VcD4KKyAgICBjb21wbGV4PF9UcD4mCisgICAgY29tcGxleDxfVHA+OjpvcGVyYXRvci09KGNvbnN0IGNvbXBsZXg8X1VwPiYgX196KQorICAgIHsKKyAgICAgIF9NX3JlYWwgLT0gX196LnJlYWwoKTsKKyAgICAgIF9NX2ltYWcgLT0gX196LmltYWcoKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgLy8gMjYuMi41LzEzCisgIC8vIFhYWDogVGhpcyBpcyBhIGdyYW1tYXIgc2Nob29sIGltcGxlbWVudGF0aW9uLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1VwPgorICAgIGNvbXBsZXg8X1RwPiYKKyAgICBjb21wbGV4PF9UcD46Om9wZXJhdG9yKj0oY29uc3QgY29tcGxleDxfVXA+JiBfX3opCisgICAgeworICAgICAgY29uc3QgX1RwIF9fciA9IF9NX3JlYWwgKiBfX3oucmVhbCgpIC0gX01faW1hZyAqIF9fei5pbWFnKCk7CisgICAgICBfTV9pbWFnID0gX01fcmVhbCAqIF9fei5pbWFnKCkgKyBfTV9pbWFnICogX196LnJlYWwoKTsKKyAgICAgIF9NX3JlYWwgPSBfX3I7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgIC8vIDI2LjIuNS8xNQorICAvLyBYWFg6IFRoaXMgaXMgYSBncmFtbWFyIHNjaG9vbCBpbXBsZW1lbnRhdGlvbi4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9VcD4KKyAgICBjb21wbGV4PF9UcD4mCisgICAgY29tcGxleDxfVHA+OjpvcGVyYXRvci89KGNvbnN0IGNvbXBsZXg8X1VwPiYgX196KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX3IgPSAgX01fcmVhbCAqIF9fei5yZWFsKCkgKyBfTV9pbWFnICogX196LmltYWcoKTsKKyAgICAgIGNvbnN0IF9UcCBfX24gPSBzdGQ6Om5vcm0oX196KTsKKyAgICAgIF9NX2ltYWcgPSAoX01faW1hZyAqIF9fei5yZWFsKCkgLSBfTV9yZWFsICogX196LmltYWcoKSkgLyBfX247CisgICAgICBfTV9yZWFsID0gX19yIC8gX19uOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKyAgICAKKyAgLy8gT3BlcmF0b3JzOgorICAvL0B7CisgIC8vLyAgUmV0dXJuIG5ldyBjb21wbGV4IHZhbHVlIEBhIHggcGx1cyBAYSB5LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIG9wZXJhdG9yKyhjb25zdCBjb21wbGV4PF9UcD4mIF9feCwgY29uc3QgY29tcGxleDxfVHA+JiBfX3kpCisgICAgeworICAgICAgY29tcGxleDxfVHA+IF9fciA9IF9feDsKKyAgICAgIF9fciArPSBfX3k7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIG9wZXJhdG9yKyhjb25zdCBjb21wbGV4PF9UcD4mIF9feCwgY29uc3QgX1RwJiBfX3kpCisgICAgeworICAgICAgY29tcGxleDxfVHA+IF9fciA9IF9feDsKKyAgICAgIF9fciArPSBfX3k7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIG9wZXJhdG9yKyhjb25zdCBfVHAmIF9feCwgY29uc3QgY29tcGxleDxfVHA+JiBfX3kpCisgICAgeworICAgICAgY29tcGxleDxfVHA+IF9fciA9IF9feTsKKyAgICAgIF9fciArPSBfX3g7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKyAgLy9AfQorCisgIC8vQHsKKyAgLy8vICBSZXR1cm4gbmV3IGNvbXBsZXggdmFsdWUgQGEgeCBtaW51cyBAYSB5LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIG9wZXJhdG9yLShjb25zdCBjb21wbGV4PF9UcD4mIF9feCwgY29uc3QgY29tcGxleDxfVHA+JiBfX3kpCisgICAgeworICAgICAgY29tcGxleDxfVHA+IF9fciA9IF9feDsKKyAgICAgIF9fciAtPSBfX3k7CisgICAgICByZXR1cm4gX19yOworICAgIH0KKyAgICAKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBvcGVyYXRvci0oY29uc3QgY29tcGxleDxfVHA+JiBfX3gsIGNvbnN0IF9UcCYgX195KQorICAgIHsKKyAgICAgIGNvbXBsZXg8X1RwPiBfX3IgPSBfX3g7CisgICAgICBfX3IgLT0gX195OworICAgICAgcmV0dXJuIF9fcjsKKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBvcGVyYXRvci0oY29uc3QgX1RwJiBfX3gsIGNvbnN0IGNvbXBsZXg8X1RwPiYgX195KQorICAgIHsKKyAgICAgIGNvbXBsZXg8X1RwPiBfX3IoX194LCAtX195LmltYWcoKSk7CisgICAgICBfX3IgLT0gX195LnJlYWwoKTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorICAvL0B9CisKKyAgLy9AeworICAvLy8gIFJldHVybiBuZXcgY29tcGxleCB2YWx1ZSBAYSB4IHRpbWVzIEBhIHkuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgb3BlcmF0b3IqKGNvbnN0IGNvbXBsZXg8X1RwPiYgX194LCBjb25zdCBjb21wbGV4PF9UcD4mIF9feSkKKyAgICB7CisgICAgICBjb21wbGV4PF9UcD4gX19yID0gX194OworICAgICAgX19yICo9IF9feTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgb3BlcmF0b3IqKGNvbnN0IGNvbXBsZXg8X1RwPiYgX194LCBjb25zdCBfVHAmIF9feSkKKyAgICB7CisgICAgICBjb21wbGV4PF9UcD4gX19yID0gX194OworICAgICAgX19yICo9IF9feTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgb3BlcmF0b3IqKGNvbnN0IF9UcCYgX194LCBjb25zdCBjb21wbGV4PF9UcD4mIF9feSkKKyAgICB7CisgICAgICBjb21wbGV4PF9UcD4gX19yID0gX195OworICAgICAgX19yICo9IF9feDsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorICAvL0B9CisKKyAgLy9AeworICAvLy8gIFJldHVybiBuZXcgY29tcGxleCB2YWx1ZSBAYSB4IGRpdmlkZWQgYnkgQGEgeS4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBvcGVyYXRvci8oY29uc3QgY29tcGxleDxfVHA+JiBfX3gsIGNvbnN0IGNvbXBsZXg8X1RwPiYgX195KQorICAgIHsKKyAgICAgIGNvbXBsZXg8X1RwPiBfX3IgPSBfX3g7CisgICAgICBfX3IgLz0gX195OworICAgICAgcmV0dXJuIF9fcjsKKyAgICB9CisgICAgCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgb3BlcmF0b3IvKGNvbnN0IGNvbXBsZXg8X1RwPiYgX194LCBjb25zdCBfVHAmIF9feSkKKyAgICB7CisgICAgICBjb21wbGV4PF9UcD4gX19yID0gX194OworICAgICAgX19yIC89IF9feTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgb3BlcmF0b3IvKGNvbnN0IF9UcCYgX194LCBjb25zdCBjb21wbGV4PF9UcD4mIF9feSkKKyAgICB7CisgICAgICBjb21wbGV4PF9UcD4gX19yID0gX194OworICAgICAgX19yIC89IF9feTsKKyAgICAgIHJldHVybiBfX3I7CisgICAgfQorICAvL0B9CisKKyAgLy8vICBSZXR1cm4gQGEgeC4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBvcGVyYXRvcisoY29uc3QgY29tcGxleDxfVHA+JiBfX3gpCisgICAgeyByZXR1cm4gX194OyB9CisKKyAgLy8vICBSZXR1cm4gY29tcGxleCBuZWdhdGlvbiBvZiBAYSB4LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIG9wZXJhdG9yLShjb25zdCBjb21wbGV4PF9UcD4mIF9feCkKKyAgICB7ICByZXR1cm4gY29tcGxleDxfVHA+KC1fX3gucmVhbCgpLCAtX194LmltYWcoKSk7IH0KKworICAvL0B7CisgIC8vLyAgUmV0dXJuIHRydWUgaWYgQGEgeCBpcyBlcXVhbCB0byBAYSB5LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9HTElCQ1hYX0NPTlNURVhQUiBib29sCisgICAgb3BlcmF0b3I9PShjb25zdCBjb21wbGV4P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gZWxzZQorCSAgICBfX2lzLnNldHN0YXRlKGlvc19iYXNlOjpmYWlsYml0KTsKKwl9CisgICAgICBlbHNlIAorCXsKKwkgIF9faXMucHV0YmFjayhfX2NoKTsKKwkgIF9faXMgPj4gX19yZV94OworCSAgX194ID0gX19yZV94OworCX0KKyAgICAgIHJldHVybiBfX2lzOworICAgIH0KKworICAvLy8gIEluc2VydGlvbiBvcGVyYXRvciBmb3IgY29tcGxleCB2YWx1ZXMuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX0NoYXJULCBjbGFzcyBfVHJhaXRzPgorICAgIGJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICBvcGVyYXRvcjw8KGJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19vcywgY29uc3QgY29tcGxleDxfVHA+JiBfX3gpCisgICAgeworICAgICAgYmFzaWNfb3N0cmluZ3N0cmVhbTxfQ2hhclQsIF9UcmFpdHM+IF9fczsKKyAgICAgIF9fcy5mbGFncyhfX29zLmZsYWdzKCkpOworICAgICAgX19zLmltYnVlKF9fb3MuZ2V0bG9jKCkpOworICAgICAgX19zLnByZWNpc2lvbihfX29zLnByZWNpc2lvbigpKTsKKyAgICAgIF9fcyA8PCAnKCcgPDwgX194LnJlYWwoKSA8PCAnLCcgPDwgX194LmltYWcoKSA8PCAnKSc7CisgICAgICByZXR1cm4gX19vcyA8PCBfX3Muc3RyKCk7CisgICAgfQorCisgIC8vIFZhbHVlcworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjb25zdGV4cHIgX1RwCisgICAgcmVhbChjb25zdCBjb21wbGV4PF9UcD4mIF9feikKKyAgICB7IHJldHVybiBfX3oucmVhbCgpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGNvbnN0ZXhwciBfVHAKKyAgICBpbWFnKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIF9fei5pbWFnKCk7IH0KKyNlbHNlCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX1RwJgorICAgIHJlYWwoY29tcGxleDxfVHA+JiBfX3opCisgICAgeyByZXR1cm4gX196LnJlYWwoKTsgfQorICAgIAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbnN0IF9UcCYKKyAgICByZWFsKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIF9fei5yZWFsKCk7IH0KKyAgICAKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfVHAmCisgICAgaW1hZyhjb21wbGV4PF9UcD4mIF9feikKKyAgICB7IHJldHVybiBfX3ouaW1hZygpOyB9CisgICAgCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29uc3QgX1RwJgorICAgIGltYWcoY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeyByZXR1cm4gX196LmltYWcoKTsgfQorI2VuZGlmCisKKyAgLy8gMjYuMi43LzMgYWJzKF9feik6ICBSZXR1cm5zIHRoZSBtYWduaXR1ZGUgb2YgX196LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9UcAorICAgIF9fY29tcGxleF9hYnMoY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeworICAgICAgX1RwIF9feCA9IF9fei5yZWFsKCk7CisgICAgICBfVHAgX195ID0gX196LmltYWcoKTsKKyAgICAgIGNvbnN0IF9UcCBfX3MgPSBzdGQ6Om1heChhYnMoX194KSwgYWJzKF9feSkpOworICAgICAgaWYgKF9fcyA9PSBfVHAoKSkgIC8vIHdlbGwgLi4uCisgICAgICAgIHJldHVybiBfX3M7CisgICAgICBfX3ggLz0gX19zOyAKKyAgICAgIF9feSAvPSBfX3M7CisgICAgICByZXR1cm4gX19zICogc3FydChfX3ggKiBfX3ggKyBfX3kgKiBfX3kpOworICAgIH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICBpbmxpbmUgZmxvYXQKKyAgX19jb21wbGV4X2FicyhfX2NvbXBsZXhfXyBmbG9hdCBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jYWJzZihfX3opOyB9CisKKyAgaW5saW5lIGRvdWJsZQorICBfX2NvbXBsZXhfYWJzKF9fY29tcGxleF9fIGRvdWJsZSBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jYWJzKF9feik7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgX19jb21wbGV4X2Ficyhjb25zdCBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZSYgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2Fic2woX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX1RwCisgICAgYWJzKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfYWJzKF9fei5fX3JlcCgpKTsgfQorI2Vsc2UKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfVHAKKyAgICBhYnMoY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9hYnMoX196KTsgfQorI2VuZGlmICAKKworCisgIC8vIDI2LjIuNy80OiBhcmcoX196KTogUmV0dXJucyB0aGUgcGhhc2UgYW5nbGUgb2YgX196LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9UcAorICAgIF9fY29tcGxleF9hcmcoY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeyByZXR1cm4gIGF0YW4yKF9fei5pbWFnKCksIF9fei5yZWFsKCkpOyB9CisK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gICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgcG9sYXIoY29uc3QgX1RwJiBfX3JobywgY29uc3QgX1RwJiBfX3RoZXRhKQorICAgIHsgcmV0dXJuIGNvbXBsZXg8X1RwPihfX3JobyAqIGNvcyhfX3RoZXRhKSwgX19yaG8gKiBzaW4oX190aGV0YSkpOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBjb25qKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIGNvbXBsZXg8X1RwPihfX3oucmVhbCgpLCAtX196LmltYWcoKSk7IH0KKyAgCisgIC8vIFRyYW5zY2VuZGVudGFscworCisgIC8vIDI2LjIuOC8xIGNvcyhfX3opOiAgUmV0dXJucyB0aGUgY29zaW5lIG9mIF9fei4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBfX2NvbXBsZXhfY29zKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX3ggPSBfX3oucmVhbCgpOworICAgICAgY29uc3QgX1RwIF9feSA9IF9fei5pbWFnKCk7CisgICAgICByZXR1cm4gY29tcGxleDxfVHA+KGNvcyhfX3gpICogY29zaChfX3kpLCAtc2luKF9feCkgKiBzaW5oKF9feSkpOworICAgIH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X2NvcyhfX2NvbXBsZXhfXyBmbG9hdCBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jY29zZihfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGRvdWJsZQorICBfX2NvbXBsZXhfY29zKF9fY29tcGxleF9fIGRvdWJsZSBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jY29zKF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gbG9uZyBkb3VibGUKKyAgX19jb21wbGV4X2Nvcyhjb25zdCBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZSYgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2Nvc2woX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgY29zKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfY29zKF9fei5fX3JlcCgpKTsgfQorI2Vsc2UKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBjb3MoY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9jb3MoX196KTsgfQorI2VuZGlmCisKKyAgLy8gMjYuMi44LzIgY29zaChfX3opOiBSZXR1cm5zIHRoZSBoeXBlcmJvbGljIGNvc2luZSBvZiBfX3ouCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgX19jb21wbGV4X2Nvc2goY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeworICAgICAgY29uc3QgX1RwIF9feCA9IF9fei5yZWFsKCk7CisgICAgICBjb25zdCBfVHAgX195ID0gX196LmltYWcoKTsKKyAgICAgIHJldHVybiBjb21wbGV4PF9UcD4oY29zaChfX3gpICogY29zKF9feSksIHNpbmgoX194KSAqIHNpbihfX3kpKTsKKyAgICB9CisKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X0NPTVBMRVgKKyAgaW5saW5lIF9fY29tcGxleF9fIGZsb2F0CisgIF9fY29tcGxleF9jb3NoKF9fY29tcGxleF9fIGZsb2F0IF9feikgeyByZXR1cm4gX19idWlsdGluX2Njb3NoZihfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGRvdWJsZQorICBfX2NvbXBsZXhfY29zaChfX2NvbXBsZXhfXyBkb3VibGUgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY2Nvc2goX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfY29zaChjb25zdCBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZSYgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2Nvc2hsKF9feik7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIGNvc2goY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9jb3NoKF9fei5fX3JlcCgpKTsgfQorI2Vsc2UKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBjb3NoKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfY29zaChfX3opOyB9CisjZW5kaWYKKworICAvLyAyNi4yLjgvMyBleHAoX196KTogUmV0dXJucyB0aGUgY29tcGxleCBiYXNlIGUgZXhwb25lbnRpYWwgb2YgeAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9leHAoY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeyByZXR1cm4gc3RkOjpwb2xhcihleHAoX196LnJlYWwoKSksIF9fei5pbWFnKCkpOyB9CisKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X0NPTVBMRVgKKyAgaW5saW5lIF9fY29tcGxleF9fIGZsb2F0CisgIF9fY29tcGxleF9leHAoX19jb21wbGV4X18gZmxvYXQgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY2V4cGYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X2V4cChfX2NvbXBsZXhfXyBkb3VibGUgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY2V4cChfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGxvbmcgZG91YmxlCisgIF9fY29tcGxleF9leHAoY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2NleHBsKF9feik7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIGV4cChjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X2V4cChfX3ouX19yZXAoKSk7IH0KKyNlbHNlCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgZXhwKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfZXhwKF9feik7IH0KKyNlbmRpZgorCisgIC8vIDI2LjIuOC81IGxvZyhfX3opOiBSZXR1cm5zIHRoZSBuYXR1cmFsIGNvbXBsZXggbG9nYXJpdGhtIG9mIF9fei4KKyAgLy8gICAgICAgICAgICAgICAgICAgIFRoZSBicmFuY2ggY3V0IGlzIGFsb25nIHRoZSBuZWdhdGl2ZSBheGlzLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9sb2coY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeyByZXR1cm4gY29tcGxleDxfVHA+KGxvZyhzdGQ6OmFicyhfX3opKSwgc3RkOjphcmcoX196KSk7IH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X2xvZyhfX2NvbXBsZXhfXyBmbG9hdCBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jbG9nZihfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGRvdWJsZQorICBfX2NvbXBsZXhfbG9nKF9fY29tcGxleF9fIGRvdWJsZSBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jbG9nKF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gbG9uZyBkb3VibGUKKyAgX19jb21wbGV4X2xvZyhjb25zdCBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZSYgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2xvZ2woX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgbG9nKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfbG9nKF9fei5fX3JlcCgpKTsgfQorI2Vsc2UKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBsb2coY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9sb2coX196KTsgfQorI2VuZGlmCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBsb2cxMChjb25zdCBjb21wbGV4PF9UcD4mIF9feikKKyAgICB7IHJldHVybiBzdGQ6OmxvZyhfX3opIC8gbG9nKF9UcCgxMC4wKSk7IH0KKworICAvLyAyNi4yLjgvMTAgc2luKF9feik6IFJldHVybnMgdGhlIHNpbmUgb2YgX196LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9zaW4oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeworICAgICAgY29uc3QgX1RwIF9feCA9IF9fei5yZWFsKCk7CisgICAgICBjb25zdCBfVHAgX195ID0gX196LmltYWcoKTsKKyAgICAgIHJldHVybiBjb21wbGV4PF9UcD4oc2luKF9feCkgKiBjb3NoKF9feSksIGNvcyhfX3gpICogc2luaChfX3kpKTsgCisgICAgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYCisgIGlubGluZSBfX2NvbXBsZXhfXyBmbG9hdAorICBfX2NvbXBsZXhfc2luKF9fY29tcGxleF9fIGZsb2F0IF9feikgeyByZXR1cm4gX19idWlsdGluX2NzaW5mKF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gZG91YmxlCisgIF9fY29tcGxleF9zaW4oX19jb21wbGV4X18gZG91YmxlIF9feikgeyByZXR1cm4gX19idWlsdGluX2NzaW4oX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfc2luKGNvbnN0IF9fY29tcGxleF9fIGxvbmcgZG91YmxlJiBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jc2lubChfX3opOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBzaW4oY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9zaW4oX196Ll9fcmVwKCkpOyB9CisjZWxzZQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHNpbihjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X3NpbihfX3opOyB9CisjZW5kaWYKKworICAvLyAyNi4yLjgvMTEgc2luaChfX3opOiBSZXR1cm5zIHRoZSBoeXBlcmJvbGljIHNpbmUgb2YgX196LgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9zaW5oKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX3ggPSBfX3oucmVhbCgpOworICAgICAgY29uc3QgX1RwICBfX3kgPSBfX3ouaW1hZygpOworICAgICAgcmV0dXJuIGNvbXBsZXg8X1RwPihzaW5oKF9feCkgKiBjb3MoX195KSwgY29zaChfX3gpICogc2luKF9feSkpOworICAgIH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X3NpbmgoX19jb21wbGV4X18gZmxvYXQgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY3NpbmhmKF9feik7IH0gICAgICAKKworICBpbmxpbmUgX19jb21wbGV4X18gZG91YmxlCisgIF9fY29tcGxleF9zaW5oKF9fY29tcGxleF9fIGRvdWJsZSBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jc2luaChfX3opOyB9ICAgICAgCisKKyAgaW5saW5lIF9fY29tcGxleF9fIGxvbmcgZG91YmxlCisgIF9fY29tcGxleF9zaW5oKGNvbnN0IF9fY29tcGxleF9fIGxvbmcgZG91YmxlJiBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jc2luaGwoX196KTsgfSAgICAgIAorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgc2luaChjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X3NpbmgoX196Ll9fcmVwKCkpOyB9CisjZWxzZQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHNpbmgoY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF9zaW5oKF9feik7IH0KKyNlbmRpZgorCisgIC8vIDI2LjIuOC8xMyBzcXJ0KF9feik6IFJldHVybnMgdGhlIGNvbXBsZXggc3F1YXJlIHJvb3Qgb2YgX196LgorICAvLyAgICAgICAgICAgICAgICAgICAgIFRoZSBicmFuY2ggY3V0IGlzIG9uIHRoZSBuZWdhdGl2ZSBheGlzLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29tcGxleDxfVHA+CisgICAgX19jb21wbGV4X3NxcnQoY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisgICAgeworICAgICAgX1RwIF9feCA9IF9fei5yZWFsKCk7CisgICAgICBfVHAgX195ID0gX196LmltYWcoKTsKKworICAgICAgaWYgKF9feCA9PSBfVHAoKSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3QgPSBzcXJ0KGFicyhfX3kpIC8gMik7CisgICAgICAgICAgcmV0dXJuIGNvbXBsZXg8X1RwPihfX3QsIF9feSA8IF9UcCgpID8gLV9fdCA6IF9fdCk7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3QgPSBzcXJ0KDIgKiAoc3RkOjphYnMoX196KSArIGFicyhfX3gpKSk7CisgICAgICAgICAgX1RwIF9fdSA9IF9fdCAvIDI7CisgICAgICAgICAgcmV0dXJuIF9feCA+IF9UcCgpCisgICAgICAgICAgICA/IGNvbXBsZXg8X1RwPihfX3UsIF9feSAvIF9fdCkKKyAgICAgICAgICAgIDogY29tcGxleDxfVHA+KGFicyhfX3kpIC8gX190LCBfX3kgPCBfVHAoKSA/IC1fX3UgOiBfX3UpOworICAgICAgICB9CisgICAgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYCisgIGlubGluZSBfX2NvbXBsZXhfXyBmbG9hdAorICBfX2NvbXBsZXhfc3FydChfX2NvbXBsZXhfXyBmbG9hdCBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jc3FydGYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X3NxcnQoX19jb21wbGV4X18gZG91YmxlIF9feikgeyByZXR1cm4gX19idWlsdGluX2NzcXJ0KF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gbG9uZyBkb3VibGUKKyAgX19jb21wbGV4X3NxcnQoY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2NzcXJ0bChfX3opOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBzcXJ0KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfc3FydChfX3ouX19yZXAoKSk7IH0KKyNlbHNlCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgc3FydChjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X3NxcnQoX196KTsgfQorI2VuZGlmCisKKyAgLy8gMjYuMi44LzE0IHRhbihfX3opOiAgUmV0dXJuIHRoZSBjb21wbGV4IHRhbmdlbnQgb2YgX196LgorICAKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBjb21wbGV4PF9UcD4KKyAgICBfX2NvbXBsZXhfdGFuKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIHN0ZDo6c2luKF9feikgLyBzdGQ6OmNvcyhfX3opOyB9CisKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X0NPTVBMRVgKKyAgaW5saW5lIF9fY29tcGxleF9fIGZsb2F0CisgIF9fY29tcGxleF90YW4oX19jb21wbGV4X18gZmxvYXQgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY3RhbmYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X3RhbihfX2NvbXBsZXhfXyBkb3VibGUgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY3RhbihfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGxvbmcgZG91YmxlCisgIF9fY29tcGxleF90YW4oY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2N0YW5sKF9feik7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHRhbihjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X3RhbihfX3ouX19yZXAoKSk7IH0KKyNlbHNlCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgdGFuKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KSB7IHJldHVybiBfX2NvbXBsZXhfdGFuKF9feik7IH0KKyNlbmRpZgorCisKKyAgLy8gMjYuMi44LzE1IHRhbmgoX196KTogIFJldHVybnMgdGhlIGh5cGVyYm9saWMgdGFuZ2VudCBvZiBfX3ouCisgIAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF90YW5oKGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIHN0ZDo6c2luaChfX3opIC8gc3RkOjpjb3NoKF9feik7IH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X3RhbmgoX19jb21wbGV4X18gZmxvYXQgX196KSB7IHJldHVybiBfX2J1aWx0aW5fY3RhbmhmKF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gZG91YmxlCisgIF9fY29tcGxleF90YW5oKF9fY29tcGxleF9fIGRvdWJsZSBfX3opIHsgcmV0dXJuIF9fYnVpbHRpbl9jdGFuaChfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGxvbmcgZG91YmxlCisgIF9fY29tcGxleF90YW5oKGNvbnN0IF9fY29tcGxleF9fIGxvbmcgZG91YmxlJiBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jdGFuaGwoX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgdGFuaChjb25zdCBjb21wbGV4PF9UcD4mIF9feikgeyByZXR1cm4gX19jb21wbGV4X3RhbmgoX196Ll9fcmVwKCkpOyB9CisjZWxzZQorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHRhbmgoY29uc3QgY29tcGxleDxfVHA+JiBfX3opIHsgcmV0dXJuIF9fY29tcGxleF90YW5oKF9feik7IH0KKyNlbmRpZgorCisKKyAgLy8gMjYuMi44LzkgIHBvdyhfX3gsIF9feSk6IFJldHVybnMgdGhlIGNvbXBsZXggcG93ZXIgYmFzZSBvZiBfX3gKKyAgLy8gICAgICAgICAgICAgICAgICAgICAgICAgIHJhaXNlZCB0byB0aGUgX195LXRoIHBvd2VyLiAgVGhlIGJyYW5jaAorICAvLyAgICAgICAgICAgICAgICAgICAgICAgICAgY3V0IGlzIG9uIHRoZSBuZWdhdGl2ZSBheGlzLgorI2lmbmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29tcGxleDxfVHA+CisgICAgX19jb21wbGV4X3Bvd191bnNpZ25lZChjb21wbGV4PF9UcD4gX194LCB1bnNpZ25lZCBfX24pCisgICAgeworICAgICAgY29tcGxleDxfVHA+IF9feSA9IF9fbiAlIDIgPyBfX3ggOiBjb21wbGV4PF9UcD4oMSk7CisKKyAgICAgIHdoaWxlIChfX24gPj49IDEpCisgICAgICAgIHsKKyAgICAgICAgICBfX3ggKj0gX194OworICAgICAgICAgIGlmIChfX24gJSAyKQorICAgICAgICAgICAgX195ICo9IF9feDsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gX195OworICAgIH0KKworICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgIC8vIERSIDg0NC4gY29tcGxleCBwb3cgcmV0dXJuIHR5cGUgaXMgYW1iaWd1b3VzLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHBvdyhjb25zdCBjb21wbGV4PF9UcD4mIF9feiwgaW50IF9fbikKKyAgICB7CisgICAgICByZXR1cm4gX19uIDwgMAorICAgICAgICA/IGNvbXBsZXg8X1RwPigxKSAvIHN0ZDo6X19jb21wbGV4X3Bvd191bnNpZ25lZChfX3osIC1fX24pCisgICAgICAgIDogc3RkOjpfX2NvbXBsZXhfcG93X3Vuc2lnbmVkKF9feiwgX19uKTsKKyAgICB9CisjZW5kaWYKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY29tcGxleDxfVHA+CisgICAgcG93KGNvbnN0IGNvbXBsZXg8X1RwPiYgX194LCBjb25zdCBfVHAmIF9feSkKKyAgICB7CisjaWZuZGVmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWAorICAgICAgaWYgKF9feCA9PSBfVHAoKSkKKwlyZXR1cm4gX1RwKCk7CisjZW5kaWYKKyAgICAgIGlmIChfX3guaW1hZygpID09IF9UcCgpICYmIF9feC5yZWFsKCkgPiBfVHAoKSkKKyAgICAgICAgcmV0dXJuIHBvdyhfX3gucmVhbCgpLCBfX3kpOworCisgICAgICBjb21wbGV4PF9UcD4gX190ID0gc3RkOjpsb2coX194KTsKKyAgICAgIHJldHVybiBzdGQ6OnBvbGFyKGV4cChfX3kgKiBfX3QucmVhbCgpKSwgX195ICogX190LmltYWcoKSk7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgY29tcGxleDxfVHA+CisgICAgX19jb21wbGV4X3Bvdyhjb25zdCBjb21wbGV4PF9UcD4mIF9feCwgY29uc3QgY29tcGxleDxfVHA+JiBfX3kpCisgICAgeyByZXR1cm4gX194ID09IF9UcCgpID8gX1RwKCkgOiBzdGQ6OmV4cChfX3kgKiBzdGQ6OmxvZyhfX3gpKTsgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYCisgIGlubGluZSBfX2NvbXBsZXhfXyBmbG9hdAorICBfX2NvbXBsZXhfcG93KF9fY29tcGxleF9fIGZsb2F0IF9feCwgX19jb21wbGV4X18gZmxvYXQgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5fY3Bvd2YoX194LCBfX3kpOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGRvdWJsZQorICBfX2NvbXBsZXhfcG93KF9fY29tcGxleF9fIGRvdWJsZSBfX3gsIF9fY29tcGxleF9fIGRvdWJsZSBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jcG93KF9feCwgX195KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfcG93KGNvbnN0IF9fY29tcGxleF9fIGxvbmcgZG91YmxlJiBfX3gsCisJCWNvbnN0IF9fY29tcGxleF9fIGxvbmcgZG91YmxlJiBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jcG93bChfX3gsIF9feSk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIGNvbXBsZXg8X1RwPgorICAgIHBvdyhjb25zdCBjb21wbGV4PF9UcD4mIF9feCwgY29uc3QgY29tcGxleDxfVHA+JiBfX3kpCisgICAgeyByZXR1cm4gX19jb21wbGV4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hYMFhfXworICAgICAgOiBfTV92YWx1ZXsgX19yLCBfX2kgfSB7IH0KKyNlbHNlCisgICAgICB7CisJX19yZWFsX18gX01fdmFsdWUgPSBfX3I7CisJX19pbWFnX18gX01fdmFsdWUgPSBfX2k7CisgICAgICB9CisjZW5kaWYKKworICAgICAgZXhwbGljaXQgX0dMSUJDWFhfQ09OU1RFWFBSIGNvbXBsZXgoY29uc3QgY29tcGxleDxkb3VibGU+Jik7CisgICAgICBleHBsaWNpdCBfR0xJQkNYWF9DT05TVEVYUFIgY29tcGxleChjb25zdCBjb21wbGV4PGxvbmcgZG91YmxlPiYpOwkKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyBEUiAzODcuIHN0ZDo6Y29tcGxleCBvdmVyLWVuY2Fwc3VsYXRlZC4KKyAgICAgIGNvbnN0ZXhwciBmbG9hdCAKKyAgICAgIHJlYWwoKSB7IHJldHVybiBfX3JlYWxfXyBfTV92YWx1ZTsgfQorCisgICAgICBjb25zdGV4cHIgZmxvYXQgCisgICAgICBpbWFnKCkgeyByZXR1cm4gX19pbWFnX18gX01fdmFsdWU7IH0KKyNlbHNlCisgICAgICBmbG9hdCYgCisgICAgICByZWFsKCkgeyByZXR1cm4gX19yZWFsX18gX01fdmFsdWU7IH0KKworICAgICAgY29uc3QgZmxvYXQmIAorICAgICAgcmVhbCgpIGNvbnN0IHsgcmV0dXJuIF9fcmVhbF9fIF9NX3ZhbHVlOyB9ICAgICAgCisKKyAgICAgIGZsb2F0JiAKKyAgICAgIGltYWcoKSB7IHJldHVybiBfX2ltYWdfXyBfTV92YWx1ZTsgfQorCisgICAgICBjb25zdCBmbG9hdCYgCisgICAgICBpbWFnKCkgY29uc3QgeyByZXR1cm4gX19pbWFnX18gX01fdmFsdWU7IH0KKyNlbmRpZgorCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyBEUiAzODcuIHN0ZDo6Y29tcGxleCBvdmVyLWVuY2Fwc3VsYXRlZC4KKyAgICAgIHZvaWQgCisgICAgICByZWFsKGZsb2F0IF9fdmFsKSB7IF9fcmVhbF9fIF9NX3ZhbHVlID0gX192YWw7IH0KKworICAgICAgdm9pZCAKKyAgICAgIGltYWcoZmxvYXQgX192YWwpIHsgX19pbWFnX18gX01fdmFsdWUgPSBfX3ZhbDsgfQorCisgICAgICBjb21wbGV4JgorICAgICAgb3BlcmF0b3I9KGZsb2F0IF9fZikKKyAgICAgIHsKKwlfTV92YWx1ZSA9IF9fZjsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvcis9KGZsb2F0IF9fZikKKyAgICAgIHsKKwlfTV92YWx1ZSArPSBfX2Y7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBjb21wbGV4JgorICAgICAgb3BlcmF0b3ItPShmbG9hdCBfX2YpCisgICAgICB7CisJX01fdmFsdWUgLT0gX19mOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgY29tcGxleCYKKyAgICAgIG9wZXJhdG9yKj0oZmxvYXQgX19mKQorICAgICAgeworCV9NX3ZhbHVlICo9IF9fZjsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvci89KGZsb2F0IF9fZikKKyAgICAgIHsKKwlfTV92YWx1ZSAvPSBfX2Y7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvLyBMZXQgdGhlIGNvbXBpbGVyIHN5bnRoZXNpemUgdGhlIGNvcHkgYW5kIGFzc2lnbm1lbnQKKyAgICAgIC8vIG9wZXJhdG9yLiAgSXQgYWx3YXlzIGRvZXMgYSBwcmV0dHkgZ29vZCBqb2IuCisgICAgICAvLyBjb21wbGV4JiBvcGVyYXRvcj0oY29uc3QgY29tcGxleCYpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yPShjb25zdCBjb21wbGV4PF9UcD4mICBfX3opCisJeworCSAgX19yZWFsX18gX01fdmFsdWUgPSBfX3oucmVhbCgpOworCSAgX19pbWFnX18gX01fdmFsdWUgPSBfX3ouaW1hZygpOworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICBjb21wbGV4JgorICAgICAgICBvcGVyYXRvcis9KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorCXsKKwkgIF9fcmVhbF9fIF9NX3ZhbHVlICs9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfTV92YWx1ZSArPSBfX3ouaW1hZygpOworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX1RwPgorICAgICAgICBjb21wbGV4JgorICAgICAgICBvcGVyYXRvci09KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorCXsKKwkgIF9fcmVhbF9fIF9NX3ZhbHVlIC09IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfTV92YWx1ZSAtPSBfX3ouaW1hZygpOworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX1RwPgorICAgICAgICBjb21wbGV4JgorICAgICAgICBvcGVyYXRvcio9KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorCXsKKwkgIF9Db21wbGV4VCBfX3Q7CisJICBfX3JlYWxfXyBfX3QgPSBfX3oucmVhbCgpOworCSAgX19pbWFnX18gX190ID0gX196LmltYWcoKTsKKwkgIF9NX3ZhbHVlICo9IF9fdDsKKwkgIHJldHVybiAqdGhpczsKKwl9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9UcD4KKyAgICAgICAgY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YWx1ZSA9IF9fdmFsOyB9CisKKyAgICAgIHZvaWQgCisgICAgICBpbWFnKGRvdWJsZSBfX3ZhbCkgeyBfX2ltYWdfXyBfTV92YWx1ZSA9IF9fdmFsOyB9CisKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvcj0oZG91YmxlIF9fZCkKKyAgICAgIHsKKwlfTV92YWx1ZSA9IF9fZDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvcis9KGRvdWJsZSBfX2QpCisgICAgICB7CisJX01fdmFsdWUgKz0gX19kOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKwkKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvci09KGRvdWJsZSBfX2QpCisgICAgICB7CisJX01fdmFsdWUgLT0gX19kOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgY29tcGxleCYKKyAgICAgIG9wZXJhdG9yKj0oZG91YmxlIF9fZCkKKyAgICAgIHsKKwlfTV92YWx1ZSAqPSBfX2Q7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBjb21wbGV4JgorICAgICAgb3BlcmF0b3IvPShkb3VibGUgX19kKQorICAgICAgeworCV9NX3ZhbHVlIC89IF9fZDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8vIFRoZSBjb21waWxlciB3aWxsIHN5bnRoZXNpemUgdGhpcywgZWZmaWNpZW50bHkuCisgICAgICAvLyBjb21wbGV4JiBvcGVyYXRvcj0oY29uc3QgY29tcGxleCYpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yPShjb25zdCBjb21wbGV4PF9UcD4mIF9feikKKwl7CisJICBfX3JlYWxfXyBfTV92YWx1ZSA9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfTV92YWx1ZSA9IF9fei5pbWFnKCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yKz0oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisJeworCSAgX19yZWFsX18gX01fdmFsdWUgKz0gX196LnJlYWwoKTsKKwkgIF9faW1hZ19fIF9NX3ZhbHVlICs9IF9fei5pbWFnKCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yLT0oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisJeworCSAgX19yZWFsX18gX01fdmFsdWUgLT0gX196LnJlYWwoKTsKKwkgIF9faW1hZ19fIF9NX3ZhbHVlIC09IF9fei5pbWFnKCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yKj0oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisJeworCSAgX0NvbXBsZXhUIF9fdDsKKwkgIF9fcmVhbF9fIF9fdCA9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfX3QgPSBfX3ouaW1hZygpOworCSAgX01fdmFsdWUgKj0gX190OworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICBjb21wbGV4JgorICAgICAgICBvcGVyYXRvci89KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorCXsKKwkgIF9Db21wbGV4VCBfX3Q7CisJICBfX3JlYWxfXyBfX3QgPSBfX3oucmVhbCgpOworCSAgX19pbWFnX18gX190ID0gX196LmltYWcoKTsKKwkgIF9NX3ZhbHVlIC89IF9fdDsKKwkgIHJld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faW1hZ19fIF9NX3ZhbHVlID0gX192YWw7IH0KKworICAgICAgY29tcGxleCYKKyAgICAgIG9wZXJhdG9yPShsb25nIGRvdWJsZSBfX3IpCisgICAgICB7CisJX01fdmFsdWUgPSBfX3I7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBjb21wbGV4JgorICAgICAgb3BlcmF0b3IrPShsb25nIGRvdWJsZSBfX3IpCisgICAgICB7CisJX01fdmFsdWUgKz0gX19yOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgY29tcGxleCYKKyAgICAgIG9wZXJhdG9yLT0obG9uZyBkb3VibGUgX19yKQorICAgICAgeworCV9NX3ZhbHVlIC09IF9fcjsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGNvbXBsZXgmCisgICAgICBvcGVyYXRvcio9KGxvbmcgZG91YmxlIF9fcikKKyAgICAgIHsKKwlfTV92YWx1ZSAqPSBfX3I7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBjb21wbGV4JgorICAgICAgb3BlcmF0b3IvPShsb25nIGRvdWJsZSBfX3IpCisgICAgICB7CisJX01fdmFsdWUgLz0gX19yOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLy8gVGhlIGNvbXBpbGVyIGtub3dzIGhvdyB0byBkbyB0aGlzIGVmZmljaWVudGx5CisgICAgICAvLyBjb21wbGV4JiBvcGVyYXRvcj0oY29uc3QgY29tcGxleCYpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisgICAgICAgIG9wZXJhdG9yPShjb25zdCBjb21wbGV4PF9UcD4mIF9feikKKwl7CisJICBfX3JlYWxfXyBfTV92YWx1ZSA9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfTV92YWx1ZSA9IF9fei5pbWFnKCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIGNvbXBsZXgmCisJb3BlcmF0b3IrPShjb25zdCBjb21wbGV4PF9UcD4mIF9feikKKwl7CisJICBfX3JlYWxfXyBfTV92YWx1ZSArPSBfX3oucmVhbCgpOworCSAgX19pbWFnX18gX01fdmFsdWUgKz0gX196LmltYWcoKTsKKwkgIHJldHVybiAqdGhpczsKKwl9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgICAgY29tcGxleCYKKwlvcGVyYXRvci09KGNvbnN0IGNvbXBsZXg8X1RwPiYgX196KQorCXsKKwkgIF9fcmVhbF9fIF9NX3ZhbHVlIC09IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfTV92YWx1ZSAtPSBfX3ouaW1hZygpOworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICBjb21wbGV4JgorCW9wZXJhdG9yKj0oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisJeworCSAgX0NvbXBsZXhUIF9fdDsKKwkgIF9fcmVhbF9fIF9fdCA9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfX3QgPSBfX3ouaW1hZygpOworCSAgX01fdmFsdWUgKj0gX190OworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICBjb21wbGV4JgorCW9wZXJhdG9yLz0oY29uc3QgY29tcGxleDxfVHA+JiBfX3opCisJeworCSAgX0NvbXBsZXhUIF9fdDsKKwkgIF9fcmVhbF9fIF9fdCA9IF9fei5yZWFsKCk7CisJICBfX2ltYWdfXyBfX3QgPSBfX3ouaW1hZygpOworCSAgX01fdmFsdWUgLz0gX190OworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgX0dMSUJDWFhfVVNFX0NPTlNURVhQUiBfQ29tcGxleFQgX19yZXAoKSBjb25zdCB7IHJldHVybiBfTV92Y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ICAgICAgX19udW0gPSBfX3IyICsgX19udW0gKiBfX251bTsKKyAgICAgIF9fZGVuID0gX19yMiArIF9fZGVuICogX19kZW47CisKKyAgICAgIHJldHVybiBzdGQ6OmNvbXBsZXg8X1RwPihfVHAoMC41KSAqIGF0YW4yKF9UcCgyLjApICogX196LnJlYWwoKSwgX194KSwKKwkJCSAgICAgICBfVHAoMC4yNSkgKiBsb2coX19udW0gLyBfX2RlbikpOworICAgIH0KKworI2lmIF9HTElCQ1hYX1VTRV9DOTlfQ09NUExFWF9UUjEKKyAgaW5saW5lIF9fY29tcGxleF9fIGZsb2F0CisgIF9fY29tcGxleF9hdGFuKF9fY29tcGxleF9fIGZsb2F0IF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2NhdGFuZihfX3opOyB9CisKKyAgaW5saW5lIF9fY29tcGxleF9fIGRvdWJsZQorICBfX2NvbXBsZXhfYXRhbihfX2NvbXBsZXhfXyBkb3VibGUgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2F0YW4oX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfYXRhbihjb25zdCBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZSYgX196KQorICB7IHJldHVybiBfX2J1aWx0aW5fY2F0YW5sKF9feik7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHN0ZDo6Y29tcGxleDxfVHA+CisgICAgYXRhbihjb25zdCBzdGQ6OmNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIF9fY29tcGxleF9hdGFuKF9fei5fX3JlcCgpKTsgfQorI2Vsc2UKKyAgLy8vIGF0YW4oX196KSBbOC4xLjRdLgorICAvLyAgRWZmZWN0czogIEJlaGF2ZXMgdGhlIHNhbWUgYXMgQzk5IGZ1bmN0aW9uIGNhdGFuLCBkZWZpbmVkCisgIC8vICAgICAgICAgICAgaW4gc3ViY2xhdXNlID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worICAgICAgY29uc3QgX1RwIF9feCA9IF9UcCgxLjApIC0gX19pMiAtIF9fei5yZWFsKCkgKiBfX3oucmVhbCgpOworCisgICAgICBfVHAgX19udW0gPSBfVHAoMS4wKSArIF9fei5yZWFsKCk7CisgICAgICBfVHAgX19kZW4gPSBfVHAoMS4wKSAtIF9fei5yZWFsKCk7CisKKyAgICAgIF9fbnVtID0gX19pMiArIF9fbnVtICogX19udW07CisgICAgICBfX2RlbiA9IF9faTIgKyBfX2RlbiAqIF9fZGVuOworCisgICAgICByZXR1cm4gc3RkOjpjb21wbGV4PF9UcD4oX1RwKDAuMjUpICogKGxvZyhfX251bSkgLSBsb2coX19kZW4pKSwKKwkJCSAgICAgICBfVHAoMC41KSAqIGF0YW4yKF9UcCgyLjApICogX196LmltYWcoKSwgX194KSk7CisgICAgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYX1RSMQorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X2F0YW5oKF9fY29tcGxleF9fIGZsb2F0IF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2NhdGFuaGYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X2F0YW5oKF9fY29tcGxleF9fIGRvdWJsZSBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jYXRhbmgoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfYXRhbmgoY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2NhdGFuaGwoX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgc3RkOjpjb21wbGV4PF9UcD4KKyAgICBhdGFuaChjb25zdCBzdGQ6OmNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJu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b21wbGV4PF9fdHlwZT4oX195KSk7CisgICAgfQorCisgIC8vIEZvcndhcmQgZGVjbGFyYXRpb25zLgorICAvLyBEUiA3ODEuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gc3RkOjpjb21wbGV4PF9UcD4gcHJvaihjb25zdCBzdGQ6OmNvbXBsZXg8X1RwPiYpOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdGQ6OmNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9wcm9qKGNvbnN0IHN0ZDo6Y29tcGxleDxfVHA+JiBfX3opCisgICAgeworICAgICAgY29uc3QgX1RwIF9fZGVuID0gKF9fei5yZWFsKCkgKiBfX3oucmVhbCgpCisJCQkgKyBfX3ouaW1hZygpICogX196LmltYWcoKSArIF9UcCgxLjApKTsKKworICAgICAgcmV0dXJuIHN0ZDo6Y29tcGxleDxfVHA+KChfVHAoMi4wKSAqIF9fei5yZWFsKCkpIC8gX19kZW4sCisJCQkgICAgICAgKF9UcCgyLjApICogX196LmltYWcoKSkgLyBfX2Rlbik7CisgICAgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYCisgIGlubGluZSBfX2NvbXBsZXhfXyBmbG9hdAorICBfX2NvbXBsZXhfcHJvaihfX2NvbXBsZXhfXyBmbG9hdCBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jcHJvamYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X3Byb2ooX19jb21wbGV4X18gZG91YmxlIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2Nwcm9qKF9feik7IH0KKworICBpbmxpbmUgX19jb21wbGV4X18gbG9uZyBkb3VibGUKKyAgX19jb21wbGV4X3Byb2ooY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2Nwcm9qbChfX3opOyB9CisKKyAgdGVtc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bm9leGNlcHQoZmFsc2UpCisJeworCSAgaWYgKHVuY2F1Z2h0X2V4Y2VwdGlvbigpKQorCSAgICBfX3RyeSB7IF9NX2xvY2subG9jaygpOyB9IF9fY2F0Y2goLi4uKSB7IH0KKwkgIGVsc2UKKwkgICAgX01fbG9jay5sb2NrKCk7CisJfQorCisJX1VubG9jayhjb25zdCBfVW5sb2NrJikgPSBkZWxldGU7CisJX1VubG9jayYgb3BlcmF0b3I9KGNvbnN0IF9VbmxvY2smKSA9IGRlbGV0ZTsKKworCV9Mb2NrJiBfTV9sb2NrOworICAgICAgfTsKKworICBwdWJsaWM6CisKKyAgICBjb25kaXRpb25fdmFyaWFibGVfYW55KCkgbm9leGNlcHQ7CisgICAgfmNvbmRpdGlvbl92YXJpYWJsZV9hbnkoKSBub2V4Y2VwdDsKKworICAgIGNvbmRpdGlvbl92YXJpYWJsZV9hbnkoY29uc3QgY29uZGl0aW9uX3ZhcmlhYmxlX2FueSYpID0gZGVsZXRlOworICAgIGNvbmRpdGlvbl92YXJpYWJsZV9hbnkmIG9wZXJhdG9yPShjb25zdCBjb25kaXRpb25fdmFyaWFibGVfYW55JikgPSBkZWxldGU7CisKKyAgICB2b2lkCisgICAgbm90aWZ5X29uZSgpIG5vZXhjZXB0CisgICAgeworICAgICAgbG9ja19ndWFyZDxtdXRleD4gX19sb2NrKF9NX211dGV4KTsKKyAgICAgIF9NX2NvbmQubm90aWZ5X29uZSgpOworICAgIH0KKworICAgIHZvaWQKKyAgICBub3RpZnlfYWxsKCkgbm9leGNlcHQKKyAgICB7CisgICAgICBsb2NrX2d1YXJkPG11dGV4PiBfX2xvY2soX01fbXV0ZXgpOworICAgICAgX01fY29uZC5ub3RpZnlfYWxsKCk7CisgICAgfQorCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0xvY2s+CisgICAgICB2b2lkCisgICAgICB3YWl0KF9Mb2NrJiBfX2xvY2spCisgICAgICB7CisJdW5pcXVlX2xvY2s8bXV0ZXg+IF9fbXlf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KKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBvcGVyYXRvcnw9KGNvbnN0IGJpdHNldDxfTmI+JiBfX3JocykgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlfTV9iYXNlKCkgfD0gX19yaHM7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIG9wZXJhdG9yXj0oY29uc3QgYml0c2V0PF9OYj4mIF9fcmhzKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9NX2Jhc2UoKSBePSBfX3JoczsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgb3BlcmF0b3I8PD0oc2l6ZV90IF9fcG9zKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9NX2Jhc2UoKSA8PD0gX19wb3M7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIG9wZXJhdG9yPj49KHNpemVfdCBfX3BvcykgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlfTV9iYXNlKCkgPj49IF9fcG9zOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBzZXQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9CYXNlOjpzZXQoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIDE4Ni4gYml0c2V0OjpzZXQoKSBzZWNvbmQgcGFyYW1ldGVyIHNob3VsZCBiZSBib29sCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIHNldChzaXplX3QgX19wb3MsIGJvb2wgX192YWwgPSB0cnVlKQorICAgICAgeworCV9CYXNlOjpzZXQoX19wb3MsIF9fdmFsKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgcmVzZXQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9CYXNlOjpyZXNldCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICByZXNldChzaXplX3QgX19wb3MpCisgICAgICB7CisJX0Jhc2U6OnJlc2V0KF9fcG9zKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+CisgICAgICBvcGVyYXRvcn4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gYml0c2V0KH5fTV9iYXNlKCkpOyB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgZmxpcCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJX0Jhc2U6OmZsaXAoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgZmxpcChzaXplX3QgX19wb3MpCisgICAgICB7CisJX0Jhc2U6OmZsaXAoX19wb3MpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLy8gZWxlbWVudCBhY2Nlc3M6CisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyAxMS4gQml0c2V0IG1pbm9yIHByb2JsZW1zCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90IF9fcG9zKQorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja19zdWJzY3JpcHQoX19wb3MpOworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisJcmV0dXJuIF9NX2Jhc2UoKVtfX3Bvc107CisjZWxzZQorCXJldHVybiByZWZlcmVuY2UoX01fYmFzZSgpW19fcG9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AoX19zeiA8IHRoaXMtPnNpemUoKSkKKwkgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWZ0ZXJfbnRoKF9fc3opOworCisJX0Jhc2U6OnJlc2l6ZShfX3N6LCBfX2MpOworCisJaWYgKF9faW52YWxpZGF0ZV9hbGwpCisJICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgfQorI2VuZGlmCisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdm9pZAorICAgICAgc2hyaW5rX3RvX2ZpdCgpCisgICAgICB7CisJaWYgKF9CYXNlOjpfTV9zaHJpbmtfdG9fZml0KCkpCisJICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgfQorI2VuZGlmCisKKyAgICAgIHVzaW5nIF9CYXNlOjplbXB0eTsKKworICAgICAgLy8gZWxlbWVudCBhY2Nlc3M6CisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikKKyAgICAgIHsKKwlfX2dsaWJjeHhfY2hlY2tfc3Vic2NyaXB0KF9fbik7CisJcmV0dXJuIF9NX2Jhc2UoKVtfX25dOworICAgICAgfQorCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsKKwlfX2dsaWJjeHhfY2hlY2tfc3Vic2NyaXB0KF9fbik7CisJcmV0dXJuIF9NX2Jhc2UoKVtfX25dOworICAgICAgfQorCisgICAgICB1c2luZyBfQmFzZTo6YXQ7CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgZnJvbnQoKQorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja19ub25lbXB0eSgpOworCXJldHVybiBfQmFzZTo6ZnJvbnQoKTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBmcm9udCgpIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X2NoZWNrX25vbmVtcHR5KCk7CisJcmV0dXJuIF9CYXNlOjpmcm9udCgpOworICAgICAgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja19ub25lbXB0eSgpOworCXJldHVybiBfQmFzZTo6YmFjaygpOworICAgICAgfQorCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja19ub25lbXB0eSgpOworCXJldHVybiBfQmFzZTo6YmFjaygpOworICAgICAgfQorCisgICAgICAvLyAyMy4yLjEuMyBtb2RpZmllcnM6CisgICAgICB2b2lkCisgICAgICBwdXNoX2Zyb250KGNvbnN0IF9UcCYgX194KQorICAgICAgeworCV9CYXNlOjpwdXNoX2Zyb250KF9feCk7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgcHVzaF9iYWNrKGNvbnN0IF9UcCYgX194KQorICAgICAgeworCV9CYXNlOjpwdXNoX2JhY2soX194KTsKKwl0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHZvaWQKKyAgICAgIHB1c2hfZnJvbnQoX1RwJiYgX194KQorICAgICAgeyBlbXBsYWNlX2Zyb250KHN0ZDo6bW92ZShfX3gpKTsgfQorCisgICAgICB2b2lkCisgICAgICBwdXNoX2JhY2soX1RwJiYgX194KQorICAgICAgeyBlbXBsYWNlX2JhY2soc3RkOjptb3ZlKF9feCkpOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICB2b2lkCisgICAgICAgIGVtcGxhY2VfZnJvbnQoX0FyZ3MmJi4uLiBfX2FyZ3MpCisJeworCSAgX0Jhc2U6OmVtcGxhY2Vf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AgICB7CisJX191bnVzZWRfcGFyYW0sCisJX19pdGVyYXRvciwKKwlfX3NlcXVlbmNlLAorCV9faW50ZWdlciwKKwlfX3N0cmluZworICAgICAgfSBfTV9raW5kOworCisgICAgICB1bmlvbgorICAgICAgeworCS8vIFdoZW4gX01fa2luZCA9PSBfX2l0ZXJhdG9yCisJc3RydWN0CisJeworCSAgY29uc3QgY2hhciogICAgICBfTV9uYW1lOworCSAgY29uc3Qgdm9pZCogICAgICBfTV9hZGRyZXNzOworCSAgY29uc3QgdHlwZV9pbmZvKiBfTV90eXBlOworCSAgX0NvbnN0bmVzcyAgICAgICBfTV9jb25zdG5lc3M7CisJICBfSXRlcmF0b3Jfc3RhdGUgIF9NX3N0YXRlOworCSAgY29uc3Qgdm9pZCogICAgICBfTV9zZXF1ZW5jZTsKKwkgIGNvbnN0IHR5cGVfaW5mbyogX01fc2VxX3R5cGU7CisJfSBfTV9pdGVyYXRvcjsKKworCS8vIFdoZW4gX01fa2luZCA9PSBfX3NlcXVlbmNlCisJc3RydWN0CisJeworCSAgY29uc3QgY2hhciogICAgICBfTV9uYW1lOworCSAgY29uc3Qgdm9pZCogICAgICBfTV9hZGRyZXNzOworCSAgY29uc3QgdHlwZV9pbmZvKiBfTV90eXBlOworCX0gX01fc2VxdWVuY2U7CisKKwkvLyBXaGVuIF9NX2tpbmQgPT0gX19pbnRlZ2VyCisJc3RydWN0CisJeworCSAgY29uc3QgY2hhciogX01fbmFtZTsKKwkgIGxvbmcgICAgICAgIF9NX3ZhbHVlOworCX0gX01faW50ZWdlcjsKKworCS8vIFdoZW4gX01fa2luZCA9PSBfX3N0cmluZworCXN0cnVjdAorCXsKKwkgIGNvbnN0IGNoYXIqIF9NX25hbWU7CisJICBjb25zdCBjaGFyKiBfTV92YWx1ZTsKKwl9IF9NX3N0cmluZzsKKyAgICAgIH0gX01fdmFyaWFudDsKKworICAgICAgX1BhcmFtZXRlcigpIDogX01fa2luZChfX3VudXNlZF9wYXJhbSksIF9NX3Zh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gICAgX01fbWF4X2xlbmd0aCg3OCksIF9NX2NvbHVtbigxKSwgX01fZmlyc3RfbGluZSh0cnVlKSwgX01fd29yZHdyYXAoZmFsc2UpCisgICAgeyBfTV9nZXRfbWF4X2xlbmd0aCgpOyB9CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICB2b2lkCisgICAgICBfTV9mb3JtYXRfd29yZChjaGFyKiwgaW50LCBjb25zdCBjaGFyKiwgX1RwKSBjb25zdCB0aHJvdyAoKTsKKworICAgIHZvaWQKKyAgICBfTV9wcmludF93b3JkKGNvbnN0IGNoYXIqIF9fd29yZCkgY29uc3Q7CisKKyAgICB2b2lkCisgICAgX01fcHJpbnRfc3RyaW5nKGNvbnN0IGNoYXIqIF9fc3RyaW5nKSBjb25zdDsKKworICAgIHZvaWQKKyAgICBfTV9nZXRfbWF4X2xlbmd0aCgpIGNvbnN0IHRocm93ICgpOworCisgICAgZW51bSB7IF9fbWF4X3BhcmFtZXRlcnMgPSA5IH07CisKKyAgICBjb25zdCBjaGFyKiAgICAgICAgIF9NX2ZpbGU7CisgICAgc3RkOjpzaXplX3QgICAgICAgICBfTV9saW5lOworICAgIG11dGFibGUgX1BhcmFtZXRlciAgX01fcGFyYW1ldGVyc1tfX21heF9wYXJhbWV0ZXJzXTsKKyAgICBtdXRhYmxlIHN0ZDo6c2l6ZV90IF9NX251bV9wYXJhbWV0ZXJzOworICAgIG11dGFibGUgY29uc3QgY2hhciogX01fdGV4dDsKKyAgICBtdXRhYmxlIHN0ZDo6c2l6ZV90IF9NX21heF9sZW5ndGg7CisgICAgZW51bSB7IF9NX2luZGVudCA9IDQgfSA7CisgICAgbXV0YWJsZSBzdGQ6OnNpemVfdCBfTV9jb2x1bW47CisgICAgbXV0YWJsZSBib29sICAgICAgICBfTV9maXJzdF9saW5lOworICAgIG11dGFibGUgYm9vbCAgICAgICAgX01fd29yZHdyYXA7CisKKyAgcHVibGljOgorICAgIHN0YXRpYyBfRXJyb3Jf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wkJX19nbnVfZGVidWc6Ol9fYmFzZShfX2xhc3QpLCBfX2FsKQorICAgICAgICB7IH0KKworICAgICAgZm9yd2FyZF9saXN0KGNvbnN0IGZvcndhcmRfbGlzdCYgX19saXN0KQorICAgICAgOiBfQmFzZShfX2xpc3QpCisgICAgICB7IH0KKworICAgICAgZm9yd2FyZF9saXN0KGZvcndhcmRfbGlzdCYmIF9fbGlzdCkgbm9leGNlcHQKKyAgICAgIDogX0Jhc2Uoc3RkOjptb3ZlKF9fbGlzdC5fTV9iYXNlKCkpKQorICAgICAgeworCXRoaXMtPl9NX3N3YXAoX19saXN0KTsKKyAgICAgIH0KKworICAgICAgZm9yd2FyZF9saXN0KHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDxfVHA+IF9faWwsCisgICAgICAgICAgICAgICAgICAgY29uc3QgX0FsbG9jJiBfX2FsID0gX0FsbG9jKCkpCisgICAgICA6IF9CYXNlKF9faWwsIF9fYWwpCisgICAgICB7IH0KKworICAgICAgfmZvcndhcmRfbGlzdCgpIG5vZXhjZXB0CisgICAgICB7IH0KKworICAgICAgZm9yd2FyZF9saXN0JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IGZvcndhcmRfbGlzdCYgX19saXN0KQorICAgICAgeworCXN0YXRpY19jYXN0PF9CYXNlJj4oKnRoaXMpID0gX19saXN0OworCXRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBmb3J3YXJkX2xpc3QmCisgICAgICBvcGVyYXRvcj0oZm9yd2FyZF9saXN0JiYgX19saXN0KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCS8vIE5COiBEUiA2NzUuCisJY2xlYXIoKTsKKwlzd2FwKF9fbGlzdCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBmb3J3YXJkX2xpc3QmCisgICAgICBvcGVyYXRvcj0oc3RkOjppbml0aWFsaXplcl9saXN0PF9UcD4gX19pbCk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R5cGUgX19zeiwgY29uc3QgdmFsdWVfdHlwZSYgX192YWwpCisgICAgICB7CisJdGhpcy0+X01fZGV0YWNoX3Npbmd1bGFyKCk7CisKKwkvLyBpZiBfX3N6IDwgc2l6ZSgpLCBpbnZhbGlkYXRlIGFsbCBpdGVyYXRvcnMgaW4gW2JlZ2luK19fc3osIGVuZCgpKQorCV9CYXNlX2l0ZXJhdG9yIF9fdmljdGltID0gX0Jhc2U6OmJlZ2luKCk7CisJX0Jhc2VfaXRlcmF0b3IgX19lbmQgPSBfQmFzZTo6ZW5kKCk7CisJZm9yIChzaXplX3R5cGUgX19pID0gX19zejsgX192aWN0aW0gIT0gX19lbmQgJiYgX19pID4gMDsgLS1fX2kpCisJICArK19fdmljdGltOworCisJZm9yICg7IF9fdmljdGltICE9IF9fZW5kOyArK19fdmljdGltKQorCSAgeworCSAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2lmKFtfX3ZpY3RpbV0oX0Jhc2VfY29uc3RfaXRlcmF0b3IgX19pdCkKKwkgICAgICB7IHJldHVybiBfX2l0ID09IF9fdmljdGltOyB9KTsKKwkgIH0KKworCV9fdHJ5CisJICB7CisJICAgIF9CYXNlOjpyZXNpemUoX19zeiwgX192YWwpOworCSAgfQorCV9fY2F0Y2goLi4uKQorCSAgeworCSAgICB0aGlzLT5fTV9yZXZhbGlkYXRlX3Npbmd1bGFyKCk7CisJICAgIF9fdGhyb3dfZXhjZXB0aW9uX2FnYWluOworICAgICAgICAgIH0KKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKSBub2V4Y2VwdAorICAgICAgeworCV9CYXNlOjpjbGVhcigpOworCXRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICB9CisKKyAgICAgIC8vIDIzLjIuMy41IGZvcndhcmRfbGlzdCBvcGVyYXRpb25zOgorICAgICAgdm9pZAorICAgICAgc3BsaWNlX2FmdGVyKGNvbnN0X2l0ZXJhdG9yIF9fcG9zLCBmb3J3Y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IF9fYSA9IF9BbGxvY2F0b3IoKSkKKyAgICAgIDogX0Jhc2UoX19nbnVfZGVidWc6Ol9fYmFzZShfX2dudV9kZWJ1Zzo6X19jaGVja192YWxpZF9yYW5nZShfX2ZpcnN0LAorCQkJCQkJCQkgICBfX2xhc3QpKSwKKyAgICAgICAgICAgICAgX19nbnVfZGVidWc6Ol9fYmFzZShfX2xhc3QpLCBfX2EpCisgICAgICB7IH0KKworCisgICAgICBsaXN0KGNvbnN0IGxpc3QmIF9feCkKKyAgICAgIDogX0Jhc2UoX194KSB7IH0KKworICAgICAgbGlzdChjb25zdCBfQmFzZSYgX194KQorICAgICAgOiBfQmFzZShfX3gpIHsgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIGxpc3QobGlzdCYmIF9feCkgbm9leGNlcHQKKyAgICAgIDogX0Jhc2Uoc3RkOjptb3ZlKF9feCkpCisgICAgICB7IHRoaXMtPl9NX3N3YXAoX194KTsgfQorCisgICAgICBsaXN0KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sLAorICAgICAgICAgICBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgICAgOiBfQmFzZShfX2wsIF9fYSkgeyB9CisjZW5kaWYKKworICAgICAgfmxpc3QoKSBfR0xJQkNYWF9OT0VYQ0VQVCB7IH0KKworICAgICAgbGlzdCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBsaXN0JiBfX3gpCisgICAgICB7CisJc3RhdGljX2Nhc3Q8X0Jhc2UmPigqdGhpcykgPSBfX3g7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgbGlzdCYKKyAgICAgIG9wZXJhdG9yPShsaXN0JiYgX194KQorICAgICAgewor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vLyBvYnNlcnZlcnM6CisgICAgICB1c2luZyBfQmFzZTo6a2V5X2NvbXA7CisgICAgICB1c2luZyBfQmFzZTo6dmFsdWVfY29tcDsKKworICAgICAgLy8gMjMuMy4xLjMgbWFwIG9wZXJhdGlvbnM6CisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gaXRlcmF0b3IoX0Jhc2U6OmZpbmQoX194KSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2l0ZXJhdG9yKF9CYXNlOjpmaW5kKF9feCksIHRoaXMpOyB9CisKKyAgICAgIHVzaW5nIF9CYXNlOjpjb3VudDsKKworICAgICAgaXRlcmF0b3IKKyAgICAgIGxvd2VyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpCisgICAgICB7IHJldHVybiBpdGVyYXRvcihfQmFzZTo6bG93ZXJfYm91bmQoX194KSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGxvd2VyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcihfQmFzZTo6bG93ZXJfYm91bmQoX194KSwgdGhpcyk7IH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpCisgICAgICB7IHJldHVybiBpdGVyYXRvcihfQmFzZTo6dXBwZXJfYm91bmQoX194KSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcihfQmFzZTo6dXBwZXJfYm91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0FsbG9jYXRvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9CYXNlOjpyZWZlcmVuY2UgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0Jhc2U6OmNvbnN0X3JlZmVyZW5jZSAgICAgICAgY29uc3RfcmVmZXJlbmNlOworCisgICAgICB0eXBlZGVmIF9fZ251X2RlYnVnOjpfU2FmZV9pdGVyYXRvcjxfQmFzZV9pdGVyYXRvciwgbXVsdGltYXA+CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yOworICAgICAgdHlwZWRlZiBfX2dudV9kZWJ1Zzo6X1NhZmVfaXRlcmF0b3I8X0Jhc2VfY29uc3RfaXRlcmF0b3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXVsdGltYXA+IGNvbnN0X2l0ZXJhdG9yOworCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9CYXNlOjpzaXplX3R5cGUgICAgICAgICAgICAgIHNpemVfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0Jhc2U6OmRpZmZlcmVuY2VfdHlwZSAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQmFzZTo6cG9pbnRlciAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQmFzZTo6Y29uc3RfcG9pbnRlciAgICAgICAgICBjb25zdF9wb2ludGVyOworICAgICAgdHlwZWRlZiBzdGQ6OnJldmVyc2VfaXRlcmF0b3I8aXRlcmF0b3I+ICAgICAgICByZXZlcnNlX2l0ZXJhdG9yOworICAgICAgdHlwZWRlZiBzdGQ6OnJldmVyc2VfaXRlcmF0b3I8Y29uc3RfaXRlc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ZShzdGQ6Om1vdmUoX194KSkKKyAgICAgIHsgdGhpcy0+X01fc3dhcChfX3gpOyB9CisKKyAgICAgIG11bHRpbWFwKGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sLAorCSAgICAgICBjb25zdCBfQ29tcGFyZSYgX19jID0gX0NvbXBhcmUoKSwKKwkgICAgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fbCwgX19jLCBfX2EpIHsgfQorI2VuZGlmCisKKyAgICAgIH5tdWx0aW1hcCgpIF9HTElCQ1hYX05PRVhDRVBUIHsgfQorCisgICAgICBtdWx0aW1hcCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBtdWx0aW1hcCYgX194KQorICAgICAgeworCSpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX194OworCXRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIG11bHRpbWFwJgorICAgICAgb3BlcmF0b3I9KG11bHRpbWFwJiYgX194KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCS8vIE5COiBEUiA2NzUuCisJY2xlYXIoKTsKKwlzd2FwKF9feCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBtdWx0aW1hcCYKKyAgICAgIG9wZXJhdG9yPShpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCkKKyAgICAgIHsKKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPmluc2VydChfX2wpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICB1c2luZyBfQmFzZTo6Z2V0X2FsbG9jYXRvcjsKKworICAgICAgLy8gaXRlcmF0b3JzOgorICAgICAgaXRlcmF0b3IKKyAgICAgIGJl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WVzc2FnZShfX2dudV9kZWJ1Zzo6X19tc2dfdmFsaWRfcmFuZ2UpCisJCQkJICAuX01faXRlcmF0b3IoX19maXJzdCwgImZpcnN0IikKKwkJCQkgIC5fTV9pdGVyYXRvcihfX2xhc3QsICJsYXN0IikpOworCSAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2lmKF9FcXVhbChfX3ZpY3RpbSkpOworCSAgfQorCV9CYXNlOjplcmFzZShfX2ZpcnN0LmJhc2UoKSwgX19sYXN0LmJhc2UoKSk7CisgICAgICB9CisjZW5kaWYKKworICAgICAgdm9pZAorICAgICAgc3dhcChtdWx0aXNldCYgX194KQorICAgICAgeworCV9CYXNlOjpzd2FwKF9feCk7CisJdGhpcy0+X01fc3dhcChfX3gpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKwlfQmFzZTo6Y2xlYXIoKTsKKyAgICAgIH0KKworICAgICAgLy8gb2JzZXJ2ZXJzOgorICAgICAgdXNpbmcgX0Jhc2U6OmtleV9jb21wOworICAgICAgdXNpbmcgX0Jhc2U6OnZhbHVlX2NvbXA7CisKKyAgICAgIC8vIG11bHRpc2V0IG9wZXJhdGlvbnM6CisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyByZXR1cm4gaXRlcmF0b3IoX0Jhc2U6OmZpbmQoX194KSwgdGhpcyk7IH0KKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMjE0LiBzZXQ6OmZpbmQoKSBtaXNzaW5nIGNvbnN0IG92ZXJsb2FkCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX194KSBjb25zdAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IoX0Jhc2U6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CSAgICAgIHx8IF9feC5fTV9jdXJyZW50ID09IF9JdGVyYXRvcigpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19pbml0X2NvcHlfc2luZ3VsYXIpCisJCQkgICAgICAuX01faXRlcmF0b3IoKnRoaXMsICJ0aGlzIikKKwkJCSAgICAgIC5fTV9pdGVyYXRvcihfX3gsICJvdGhlciIpKTsKKyAgICAgIH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBNb3ZlIGNvbnN0cnVjdGlvbi4KKyAgICAgICAqIEBwb3N0IF9feCBpcyBzaW5ndWxhciBhbmQgdW5hdHRhY2hlZAorICAgICAgICovCisgICAgICBfU2FmZV9pdGVyYXRvcihfU2FmZV9pdGVyYXRvciYmIF9feCkgOiBfTV9jdXJyZW50KCkKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkoIV9feC5fTV9zaW5ndWxhcigpCisJCQkgICAgICB8fCBfX3guX01fY3VycmVudCA9PSBfSXRlcmF0b3IoKSwKKwkJCSAgICAgIF9NX21lc3NhZ2UoX19tc2dfaW5pdF9jb3B5X3Npbmd1bGFyKQorCQkJICAgICAgLl9NX2l0ZXJhdG9yKCp0aGlzLCAidGhpcyIpCisJCQkgICAgICAuX01faXRlcmF0b3IoX194LCAib3RoZXIiKSk7CisJc3RkOjpzd2FwKF9NX2N1cnJlbnQsIF9feC5fTV9jdXJyZW50KTsKKwl0aGlzLT5fTV9hdHRhY2goX194Ll9NX3NlcXVlbmNlKTsKKwlfX3guX01fZGV0YWNoKCk7CisgICAgICB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIENvbnZlcnRpbmcgY29uc3RydWN0b3IgZnJvbSBhIG11dGFibGUgaXRlcmF0b3IgdG8gYQorICAgICAgICogIGNvbnN0YW50IGl0ZXJhdG9yLgorICAgICAgKi8KKyAgICAgIHRlbXBsYXRl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fTV9zZXF1ZW5jZSk7CisJX194Ll9NX2RldGFjaCgpOworCV9feC5fTV9jdXJyZW50ID0gX0l0ZXJhdG9yKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorI2VuZGlmCisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBJdGVyYXRvciBkZXJlZmVyZW5jZS4KKyAgICAgICAqICBAcHJlIGl0ZXJhdG9yIGlzIGRlcmVmZXJlbmNlYWJsZQorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfVkVSSUZZKHRoaXMtPl9NX2RlcmVmZXJlbmNlYWJsZSgpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19iYWRfZGVyZWYpCisJCQkgICAgICAuX01faXRlcmF0b3IoKnRoaXMsICJ0aGlzIikpOworCXJldHVybiAqX01fY3VycmVudDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEl0ZXJhdG9yIGRlcmVmZXJlbmNlLgorICAgICAgICogIEBwcmUgaXRlcmF0b3IgaXMgZGVyZWZlcmVuY2VhYmxlCisgICAgICAgKiAgQHRvZG8gTWFrZSB0aGlzIGNvcnJlY3Qgdy5yLnQuIGl0ZXJhdG9ycyB0aGF0IHJldHVybiBwcm94aWVzCisgICAgICAgKiAgQHRvZG8gVXNlIGFkZHJlc3NvZigpIGluc3RlYWQgb2YgJiBvcGVyYXRvcgorICAgICAgICovCisgICAgICBwb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkodGhpcy0+X01fZGVyZWZlcmVuY2VhYmxlKCksCisJCQkgICAgICBfTV9tZXNzYWdlKF9fbXNnX2JhZF9kZXJlZikKKwkJCSAgICAgIC5fTV9pdGVyYXRvcigqdGhpcywgInRoaXMiKSk7CisJcmV0dXJuICYqX01fY3VycmVudDsKKyAgICAgIH0KKworICAgICAgLy8gLS0tLS0tIElucHV0IGl0ZXJhdG9yIHJlcXVpcmVtZW50cyAtLS0tLS0KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBJdGVyYXRvciBwcmVpbmNyZW1lbnQKKyAgICAgICAqICBAcHJlIGl0ZXJhdG9yIGlzIGluY3JlbWVudGFibGUKKyAgICAgICAqLworICAgICAgX1NhZmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkodGhpcy0+X01faW5jcmVtZW50YWJsZSgpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19iYWRfaW5jKQorCQkJICAgICAgLl9NX2l0ZXJhdG9yKCp0aGlzLCAidGhpcyIpKTsKKwkrK19NX2N1cnJlbnQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgSXRlcmF0b3IgcG9zdGluY3JlbWVudAorICAgICAgICogIEBwcmUgaXRlcmF0b3IgaXMgaW5jcmVtZW50YWJsZQorICAgICAgICovCisgICAgICBfU2FmZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfVkVSSUZZKHRoaXMtPl9NX2luY3JlbWVudGFibGUoKSwKKwkJCSAgICAgIF9NX21lc3NhZ2UoX19tc2dfYmFkX2luYykKKwkJCSAgICAgIC5fTV9pdGVyYXRvcigqdGhpcywgInRoaXMiKSk7CisJX1NhZmVfaXRlcmF0b3IgX190bXAoKnRoaXMpOworCSsrX01fY3VycmVudDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIC8vIC0tLS0tLSBCaWRpcmVjdGlvbmFsIGl0ZXJhdG9yIHJlcXVpcmVtZW50cyAtLS0tLS0KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBJdGVyYXRvciBwcmVkZWNyZW1lbnQKKyAgICAgICAqICBAcHJlIGl0ZXJhdG9yIGlzIGRlY3JlbWVudGFibGUKKyAgICAgICAqLworICAgICAgX1NhZmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci0tKCkKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkodGhpcy0+X01fZGVjcmVtZW50YWJsZSgpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19iYWRfZGVjKQorCQkJICAgICAgLl9NX2l0ZXJhdG9yKCp0aGlzLCAidGhpcyIpKTsKKwktLV9NX2N1cnJlbnQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgSXRlcmF0b3IgcG9zdGRlY3JlbWVudAorICAgICAgICogIEBwcmUgaXRlcmF0b3IgaXMgZGVjcmVtZW50YWJsZQorICAgICAgICovCisgICAgICBfU2FmZV9pdGVyYXRvcgorICAgICAgb3BlcmF0b3ItLShpbnQpCisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfVkVSSUZZKHRoaXMtPl9NX2RlY3JlbWVudGFibGUoKSwKKwkJCSAgICAgIF9NX21lc3NhZ2UoX19tc2dfYmFkX2RlYykKKwkJCSAgICAgIC5fTV9pdGVyYXRvcigqdGhpcywgInRoaXMiKSk7CisJX1NhZmVfaXRlcmF0b3IgX190bXAoKnRoaXMpOworCS0tX01fY3VycmVudDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIC8vIC0tLS0tLSBSYW5kb20gYWNjZXNzIGl0ZXJhdG9yIHJlcXVpcmVtZW50cyAtLS0tLS0KKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShjb25zdCBkaWZmZXJlbmNlX3R5cGUmIF9fbikgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkodGhpcy0+X01fY2FuX2FkdmFuY2UoX19uKQorCQkJICAgICAgJiYgdGhpcy0+X01fY2FuX2FkdmFuY2UoX19uKzEpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19pdGVyX3N1YnNjcmlwdF9vb2IpCisJCQkgICAgICAuX01faXRlcmF0b3IoKnRoaXMpLl9NX2ludGVnZXIoX19uKSk7CisKKwlyZXR1cm4gX01fY3VycmVudFtfX25dOworICAgICAgfQorCisgICAgICBfU2FmZV9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yKz0oY29uc3QgZGlmZmVyZW5jZV90eXBlJiBfX24pCisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfVkVSSUZZKHRoaXMtPl9NX2Nhbl9hZHZhbmNlKF9fbiksCisJCQkgICAgICBfTV9tZXNzYWdlKF9fbXNnX2FkdmFuY2Vfb29iKQorCQkJICAgICAgLl9NX2l0ZXJhdG9yKCp0aGlzKS5fTV9pbnRlZ2VyKF9fbikpOworCV9NX2N1cnJlbnQgKz0gX19uOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NhZmVfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yKyhjb25zdCBkaWZmZXJlbmNlX3R5cGUmIF9fbikgY29uc3QKKyAgICAgIHsKKwlfU2FmZV9pdGVyYXRvciBfX3RtcCgqdGhpcyk7CisJX190bXAgKz0gX19uOworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgX1NhZmVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci09KGNvbnN0IGRpZmZlcmVuY2VfdHlwZSYgX19uKQorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX1ZFUklGWSh0aGlzLT5fTV9jYW5fYWR2YW5jZSgtX19uKSwKKwkJCSAgICAgIF9NX21lc3NhZ2UoX19tc2dfcmV0cmVhdF9vb2IpCisJCQkgICAgICAuX01faXRlcmF0b3IoKnRoaXMpLl9NX2ludGVnZXIoX19uKSk7CisJX01fY3VycmVudCArPSAtX19uOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1NhZmVfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yLShjb25zdCBkaWZmZXJlbmNlX3R5cGUmIF9fbikgY29uc3QKKyAgICAgIHsKKwlfU2FmZV9pdGVyYXRvciBfX3RtcCgqdGhpcyk7CisJX190bXAgLT0gX19uOworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgLy8gLS0tLS0tIFV0aWxpdGllcyAtLS0tLS0KKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybiB0aGUgdW5kZXJseWluZyBpdGVyYXRvcgorICAgICAgICovCisgICAgICBfSXRlcmF0b3IKKyAgICAgIGJhc2UoKSBjb25zdCB7IHJldHVybiBfTV9jdXJyZW50OyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnZlcnNpb24gdG8gdW5kZXJseWluZyBub24tZGVidWcgaXRlcmF0b3IgdG8gYWxsb3cKKyAgICAgICAqIGJldHRlciBpbnRlcmFjdGlvbiB3aXRoIG5vbi1kZWJ1ZyBjb250YWluZXJzLgorICAgICAgICovCisgICAgICBvcGVyYXRvciBfSXRlcmF0b3IoKSBjb25zdCB7IHJldHVybiBfTV9jdXJyZW50OyB9CisKKyAgICAgIC8qKiBBdHRhY2ggaXRlcmF0b3IgdG8gdGhlIGdpdmVuIHNlcXVlbmNlLiAqLworICAgICAgdm9pZAorICAgICAgX01fYXR0YWNoKF9TYWZlX3NlcXVlbmNlX2Jhc2UqIF9fc2VxKQorICAgICAgeworCV9TYWZlX2l0ZXJhdG9yX2Jhc2U6Ol9NX2F0dGFjaChfX3NlcSwgX01fY29uc3RhbnQoKSk7CisgICAgICB9CisKKyAgICAgIC8qKiBMaWtld2lzZSwgYnV0IG5vdCB0aHJlYWQtc2FmZS4gKi8KKyAgICAgIHZvaWQKKyAgICAgIF9NX2F0dGFjaF9zaW5nbGUoX1NhZmVfc2VxdWVuY2VfYmFzZSogX19zZXEpCisgICAgICB7CisJX1NhZmVfaXRlcmF0b3JfYmFzZTo6X01fYXR0YWNoX3NpbmdsZShfX3NlcSwgX01fY29uc3RhbnQoKSk7CisgICAgICB9CisKKyAgICAgIC8vLyBJcyB0aGUgaXRlcmF0b3IgZGVyZWZlcmVuY2VhYmxlPworICAgICAgYm9vbAorICAgICAgX01fZGVyZWZlcmVuY2VhYmxlKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICF0aGlzLT5fTV9zaW5ndWxhcigpICYmICFfTV9pc19lbmQoKSAmJiAhX01faXNfYmVmb3JlX2JlZ2luKCk7IH0KKworICAgICAgLy8vIElzIHRoZSBpdGVyYXRvciBiZWZvcmUgYSBkZXJlZmVyZW5jZWFibGUgb25lPworICAgICAgYm9vbAorICAgICAgX01fYmVmb3JlX2RlcmVmZXJlbmNlYWJsZSgpIGNvbnN0CisgICAgICB7CisJaWYgKHRoaXMtPl9NX2luY3JlbWVudGFibGUoKSkKKwl7CisJICBfSXRlcmF0b3IgX19iYXNlID0gYmFzZSgpOworCSAgcmV0dXJuICsrX19iYXNlICE9IF9NX2dldF9zZXF1ZW5jZSgpLT5fTV9iYXNlKCkuZW5kKCk7CisJfQorCXJldHVybiBmYWxzZTsKKyAgICAgIH0KKworICAgICAgLy8vIElzIHRoZSBpdGVyYXRvciBpbmNyZW1lbnRhYmxlPworICAgICAgYm9vbAorICAgICAgX01faW5jcmVtZW50YWJsZSgpIGNvbnN0CisgICAgICB7IHJldHVybiAhdGhpcy0+X01fc2luZ3VsYXIoKSAmJiAhX01faXNfZW5kKCk7IH0KKworICAgICAgLy8gSXMgdGhlIGl0ZXJhdG9yIGRlY3JlbWVudGFibGU/CisgICAgICBib29sCisgICAgICBfTV9kZWNyZW1lbnRhYmxlKCkgY29uc3QgeyByZXR1cm4gIV9NX3Npbmd1bGFyKCkgJiYgIV9NX2lzX2JlZ2luKCk7IH0KKworICAgICAgLy8gQ2FuIHdlIGFkdmFuY2UgdGhlIGl0ZXJhdG9yIEBwIF9fbiBzdGVwcyAoQHAgX19uIG1heSBiZSBuZWdhdGl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ICBfU2FmZV9sb2NhbF9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX1ZFUklGWSh0aGlzLT5fTV9pbmNyZW1lbnRhYmxlKCksCisJCQkgICAgICBfTV9tZXNzYWdlKF9fbXNnX2JhZF9pbmMpCisJCQkgICAgICAuX01faXRlcmF0b3IoKnRoaXMsICJ0aGlzIikpOworCSsrX01fY3VycmVudDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBJdGVyYXRvciBwb3N0aW5jcmVtZW50CisgICAgICAgKiAgQHByZSBpdGVyYXRvciBpcyBpbmNyZW1lbnRhYmxlCisgICAgICAgKi8KKyAgICAgIF9TYWZlX2xvY2FsX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19WRVJJRlkodGhpcy0+X01faW5jcmVtZW50YWJsZSgpLAorCQkJICAgICAgX01fbWVzc2FnZShfX21zZ19iYWRfaW5jKQorCQkJICAgICAgLl9NX2l0ZXJhdG9yKCp0aGlzLCAidGhpcyIpKTsKKwlfU2FmZV9sb2NhbF9pdGVyYXRvciBfX3RtcCgqdGhpcyk7CisJKytfTV9jdXJyZW50OworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKworICAgICAgLy8gLS0tLS0tIFV0aWxpdGllcyAtLS0tLS0KKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybiB0aGUgdW5kZXJseWluZyBpdGVyYXRvcgorICAgICAgICovCisgICAgICBfSXRlcmF0b3IKKyAgICAgIGJhc2UoKSBjb25zdCB7IHJldHVybiBfTV9jdXJyZW50OyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFJldHVybiB0aGUgYnVja2V0CisgICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0KCkgY29uc3QgeyByZXR1c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X19sLCBfX2NvbXAsIF9fYSkgeyB9CisjZW5kaWYKKworICAgICAgfnNldCgpIF9HTElCQ1hYX05PRVhDRVBUIHsgfQorCisgICAgICBzZXQmCisgICAgICBvcGVyYXRvcj0oY29uc3Qgc2V0JiBfX3gpCisgICAgICB7CisJKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3g7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgc2V0JgorICAgICAgb3BlcmF0b3I9KHNldCYmIF9feCkKKyAgICAgIHsKKwkvLyBOQjogRFIgMTIwNC4KKwkvLyBOQjogRFIgNjc1LgorCWNsZWFyKCk7CisJc3dhcChfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgc2V0JgorICAgICAgb3BlcmF0b3I9KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sKQorICAgICAgeworCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+aW5zZXJ0KF9fbCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorI2VuZGlmCisKKyAgICAgIHVzaW5nIF9CYXNlOjpnZXRfYWxsb2NhdG9yOworCisgICAgICAvLyBpdGVyYXRvcnM6CisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gaXRlcmF0b3IoX0Jhc2U6OmJlZ2luKCksIHRoaXMpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcihfQmFzZTo6YmVnaW4oKSwgdGhpcyk7IH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpIF9HTElCQ1hYX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X3N0cmluZygpIF9HTElCQ1hYX05PRVhDRVBUIHsgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIG9wZXJhdG9yPShjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyKQorICAgIHsKKyAgICAgICpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX19zdHI7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBvcGVyYXRvcj0oY29uc3QgX0NoYXJUKiBfX3MpCisgICAgeworICAgICAgX19nbGliY3h4X2NoZWNrX3N0cmluZyhfX3MpOworICAgICAgKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3M7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBvcGVyYXRvcj0oX0NoYXJUIF9fYykKKyAgICB7CisgICAgICAqc3RhdGljX2Nhc3Q8X0Jhc2UqPih0aGlzKSA9IF9fYzsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICBiYXNpY19zdHJpbmcmCisgICAgb3BlcmF0b3I9KGJhc2ljX3N0cmluZyYmIF9fc3RyKQorICAgIHsKKyAgICAgICpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gc3RkOjptb3ZlKF9fc3RyKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIG9wZXJhdG9yPShzdGQ6OmluaXRpYWxpemVyX2xpc3Q8X0NoYXJUPi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bCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBvcGVyYXRvcis9KGNvbnN0IF9DaGFyVCogX19zKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmcoX19zKTsKKyAgICAgIF9NX2Jhc2UoKSArPSBfX3M7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBvcGVyYXRvcis9KF9DaGFyVCBfX2MpCisgICAgeworICAgICAgX01fYmFzZSgpICs9IF9fYzsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICBiYXNpY19zdHJpbmcmCisgICAgb3BlcmF0b3IrPShzdGQ6OmluaXRpYWxpemVyX2xpc3Q8X0NoYXJUPiBfX2wpCisgICAgeworICAgICAgX01fYmFzZSgpICs9IF9fbDsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorI2VuZGlmIC8vIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisKKyAgICBiYXNpY19zdHJpbmcmCisgICAgYXBwZW5kKGNvbnN0IGJhc2ljX3N0cmluZyYgX19zdHIpCisgICAgeworICAgICAgX0Jhc2U6OmFwcGVuZChfX3N0cik7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBhcHBlbmQoY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uKQorICAgIHsKKyAgICAgIF9CYXNlOjphcHBlbmQoX19zdHIsIF9fcG9zLCBfX24pOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBiYXNpY19zdHJpbmcmCisgICAgYXBwZW5kKGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19uKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmdfbGVuKF9fcywgX19uKTsKKyAgICAgIF9CYXNlOjphcHBlbmQoX19zLCBfX24pOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBiYXNpY19zdHJpbmcmCisgICAgYXBwZW5kKGNvbnN0IF9DaGFyVCogX19zKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmcoX19zKTsKKyAgICAgIF9CYXNlOjphcHBlbmQoX19zKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIGFwcGVuZChzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQorICAgIHsKKyAgICAgIF9CYXNlOjphcHBlbmQoX19uLCBfX2MpOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW5wdXRJdGVyYXRvcj4KKyAgICAgIGJhc2ljX3N0cmluZyYKKyAgICAgIGFwcGVuZChfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QpCisgICAgICB7CisJX19nbGliY3h4X2NoZWNrX3ZhbGlkX3JhbmdlKF9fZmlyc3QsIF9fbGFzdCk7CisJ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LCBfX3BvcywgX19uKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIGFzc2lnbihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fbikKKyAgICB7CisgICAgICBfX2dsaWJjeHhfY2hlY2tfc3RyaW5nX2xlbihfX3MsIF9fbik7CisgICAgICBfQmFzZTo6YXNzaWduKF9fcywgX19uKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIGFzc2lnbihjb25zdCBfQ2hhclQqIF9fcykKKyAgICB7CisgICAgICBfX2dsaWJjeHhfY2hlY2tfc3RyaW5nKF9fcyk7CisgICAgICBfQmFzZTo6YXNzaWduKF9fcyk7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBhc3NpZ24oc2l6ZV90eXBlIF9fbiwgX0NoYXJUIF9fYykKKyAgICB7CisgICAgICBfQmFzZTo6YXNzaWduKF9fbiwgX19jKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcmF0b3I+CisgICAgICBiYXNpY19zdHJpbmcmCisgICAgICBhc3NpZ24oX0lucHV0SXRlcmF0b3IgX19maXJzdCwgX0lucHV0SXRlcmF0b3IgX19sYXN0KQorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja192YWxpZF9yYW5nZShfX2ZpcnN0LCBfX2xhc3QpOworCV9CYXNlOjphc3NpZ24oX19nbnVfZGVidWc6Ol9fYmFzZShfX2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orICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmcoX19zKTsKKyAgICAgIF9CYXNlOjppbnNlcnQoX19wb3MsIF9fcywgX19uKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIGluc2VydChzaXplX3R5cGUgX19wb3MsIGNvbnN0IF9DaGFyVCogX19zKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmcoX19zKTsKKyAgICAgIF9CYXNlOjppbnNlcnQoX19wb3MsIF9fcyk7CisgICAgICB0aGlzLT5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICBpbnNlcnQoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQorICAgIHsKKyAgICAgIF9CYXNlOjppbnNlcnQoX19wb3MsIF9fbiwgX19jKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgaXRlcmF0b3IKKyAgICBpbnNlcnQoaXRlcmF0b3IgX19wLCBfQ2hhclQgX19jKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19pbnNlcnQoX19wKTsKKyAgICAgIHR5cGVuYW1lIF9CYXNlOjppdGVyYXRvciBfX3JlcyA9IF9CYXNlOjppbnNlcnQoX19wLmJhc2UoKSwgX19jKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gaXRlcmF0b3IoX19yZXMsIHRoaXMpOworICAgIH0KKworICAgIHZvaWQKKyAgICBpbnNlcnQoaXRlcmF0b3IgX19wLCBzaXplX3R5cGUgX19uLCBfQ2hhclQgX19j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YXNlOjpwb3BfYmFjaygpOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICB9CisjZW5kaWYgLy8gX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKworICAgIGJhc2ljX3N0cmluZyYKKyAgICByZXBsYWNlKHNpemVfdHlwZSBfX3BvczEsIHNpemVfdHlwZSBfX24xLCBjb25zdCBiYXNpY19zdHJpbmcmIF9fc3RyKQorICAgIHsKKyAgICAgIF9CYXNlOjpyZXBsYWNlKF9fcG9zMSwgX19uMSwgX19zdHIpOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBiYXNpY19zdHJpbmcmCisgICAgcmVwbGFjZShzaXplX3R5cGUgX19wb3MxLCBzaXplX3R5cGUgX19uMSwgY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwKKwkgICAgc2l6ZV90eXBlIF9fcG9zMiwgc2l6ZV90eXBlIF9fbjIpCisgICAgeworICAgICAgX0Jhc2U6OnJlcGxhY2UoX19wb3MxLCBfX24xLCBfX3N0ciwgX19wb3MyLCBfX24yKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFzaWNfc3RyaW5nJgorICAgIHJlcGxhY2Uoc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uMSwgY29uc3QgX0NoYXJUKiBfX3MsCisJICAgIHNpemVfdHlwZSBfX24yKQorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmdfbGVuKF9fcywgX19uMik7CisgICAgICBfQmFzZTo6cmVwbGFjZShfX3BvcywgX19uMSwgX19zLCBfX24yKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgYmFza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mIF9feCkKKyAgICB7CisgICAgICBfQmFzZTo6c3dhcChfX3gpOworICAgICAgdGhpcy0+X01fc3dhcChfX3gpOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIF9feC5fTV9pbnZhbGlkYXRlX2FsbCgpOworICAgIH0KKworICAgIC8vIDIxLjMuNiBzdHJpbmcgb3BlcmF0aW9uczoKKyAgICBjb25zdCBfQ2hhclQqCisgICAgY19zdHIoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgIHsKKyAgICAgIGNvbnN0IF9DaGFyVCogX19yZXMgPSBfQmFzZTo6Y19zdHIoKTsKKyAgICAgIHRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisgICAgICByZXR1cm4gX19yZXM7CisgICAgfQorCisgICAgY29uc3QgX0NoYXJUKgorICAgIGRhdGEoKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgIHsKKyAgICAgIGNvbnN0IF9DaGFyVCogX19yZXMgPSBfQmFzZTo6ZGF0YSgpOworICAgICAgdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIHJldHVybiBfX3JlczsKKyAgICB9CisKKyAgICB1c2luZyBfQmFzZTo6Z2V0X2FsbG9jYXRvcjsKKworICAgIHNpemVfdHlwZQorICAgIGZpbmQoY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwgc2l6ZV90eXBlIF9fcG9zID0gMCkgY29uc3QKKyAgICAgIF9HTElCQ1hYX05PRVhDRVBUCisgICAgeyByZXR1cm4gX0Jhc2U6OmZpbmQoX19zdHIsIF9fcG9zKTsgfQorCisgICAgc2l6ZV90eXBlCisgICAgZmluZChjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uKSBjb25zdAorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmcoX19zKTsKKyAgICAgIHJldHVybiBfQmFzZTo6ZmluZChfX3MsIF9fcG9zLCBfX24pOworICAgIH0KKworICAgIHNpemVfdHlwZQorICAgIGZpbmQoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgeworICAgICAgX19nbGliY3h4X2NoZWNrX3N0cmluZyhfX3MpOworICAgICAgcmV0dXJuIF9CYXNlOjpmaW5kKF9fcywgX19wb3MpOworICAgIH0KKworICAgIHNpemVfdHlwZQorICAgIGZpbmQoX0NoYXJUIF9fYywgc2l6ZV90eXBlIF9fcG9zID0gMCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICB7IHJldHVybiBfQmFzZTo6ZmluZChfX2MsIF9fcG9zKTsgfQorCisgICAgc2l6ZV90eXBlCisgICAgcmZpbmQoY29uc3QgYmFzaWNfc3RyaW5nJiBfX3N0ciwgc2l6ZV90eXBlIF9fcG9zID0gX0Jhc2U6Om5wb3MpIGNvbnN0CisgICAgICBfR0xJQkNYWF9OT0VYQ0VQVAorICAgIHsgcmV0dXJuIF9CYXNlOjpyZmluZChfX3N0ciwgX19wb3MpOyB9CisKKyAgICBzaXplX3R5cGUKKyAgICByZmluZChjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zLCBzaXplX3R5cGUgX19uKSBjb25zdAorICAgIHsKKyAgICAgIF9fZ2xpYmN4eF9jaGVja19zdHJpbmdfbGVuKF9fcywgX19uKTsKKyAgICAgIHJldHVybiBfQmFzZTo6cmZpbmQoX19zLCBfX3BvcywgX19uKTsKKyAgICB9CisKKyAgICBzaXplX3R5cGUKKyAgICByZmluZChjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zID0gX0Jhc2U6Om5wb3MpIGNvbnN0CisgICAgeworICAgICAgX19nbGliY3h4X2NoZWNrX3N0cmluZyhfX3MpOworICAgICAgcmV0dXJuIF9CYXNlOjpyZmluZChfX3MsIF9fcG9zKTsKKyAgICB9CisKKyAgICBza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ICAgICAgdW5vcmRlcmVkX21hcChjb25zdCB1bm9yZGVyZWRfbWFwJiBfX3gpIAorICAgICAgOiBfQmFzZShfX3gpIHsgfQorCisgICAgICB1bm9yZGVyZWRfbWFwKGNvbnN0IF9CYXNlJiBfX3gpCisgICAgICA6IF9CYXNlKF9feCkgeyB9CisKKyAgICAgIHVub3JkZXJlZF9tYXAodW5vcmRlcmVkX21hcCYmIF9feCkKKyAgICAgIDogX0Jhc2Uoc3RkOjptb3ZlKF9feCkpIHsgfQorCisgICAgICB1bm9yZGVyZWRfbWFwKGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sLAorCQkgICAgc2l6ZV90eXBlIF9fbiA9IDAsCisJCSAgICBjb25zdCBoYXNoZXImIF9faGYgPSBoYXNoZXIoKSwKKwkJICAgIGNvbnN0IGtleV9lcXVhbCYgX19lcWwgPSBrZXlfZXF1YWwoKSwKKwkJICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2wsIF9fbiwgX19oZiwgX19lcWwsIF9fYSkgeyB9CisKKyAgICAgIH51bm9yZGVyZWRfbWFwKCkgbm9leGNlcHQgeyB9CisKKyAgICAgIHVub3JkZXJlZF9tYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgdW5vcmRlcmVkX21hcCYgX194KQorICAgICAgeworCSpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX194OworCXRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbWFwJgorICAgICAgb3BlcmF0b3I9KHVub3JkZXJlZF9tYXAmJiBfX3gpCisgICAgICB7CisgICAJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwljbGVhcigpOworCXN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKK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194KSB7IH0KKworICAgICAgdW5vcmRlcmVkX211bHRpbWFwKGNvbnN0IF9CYXNlJiBfX3gpIAorICAgICAgOiBfQmFzZShfX3gpIHsgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAodW5vcmRlcmVkX211bHRpbWFwJiYgX194KQorICAgICAgOiBfQmFzZShzdGQ6Om1vdmUoX194KSkgeyB9CisKKyAgICAgIHVub3JkZXJlZF9tdWx0aW1hcChpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCwKKwkJCSBzaXplX3R5cGUgX19uID0gMCwKKwkJCSBjb25zdCBoYXNoZXImIF9faGYgPSBoYXNoZXIoKSwKKwkJCSBjb25zdCBrZXlfZXF1YWwmIF9fZXFsID0ga2V5X2VxdWFsKCksCisJCQkgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fbCwgX19uLCBfX2hmLCBfX2VxbCwgX19hKSB7IH0KKworICAgICAgfnVub3JkZXJlZF9tdWx0aW1hcCgpIG5vZXhjZXB0IHsgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgdW5vcmRlcmVkX211bHRpbWFwJiBfX3gpCisgICAgICB7CisJKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3g7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9tdWx0aW1hcCYKKyAgICAgIG9wZXJhdG9yPSh1bm9yZGVyZWRfbXVsdGltYXAmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwljbGVhcigpOworCXN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9tdWx0aW1hcCYKK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b3I9KHVub3JkZXJlZF9zZXQmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwljbGVhcigpOworCXN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9zZXQmCisgICAgICBvcGVyYXRvcj0oaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wpCisgICAgICB7CisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5pbnNlcnQoX19sKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAodW5vcmRlcmVkX3NldCYgX194KQorICAgICAgeworCV9CYXNlOjpzd2FwKF9feCk7CisJX1NhZmVfYmFzZTo6X01fc3dhcChfX3gpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIG5vZXhjZXB0CisgICAgICB7CisJX0Jhc2U6OmNsZWFyKCk7CisJdGhpcy0+X01faW52YWxpZGF0ZV9hbGwoKTsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IgCisgICAgICBiZWdpbigpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBpdGVyYXRvcihfQmFzZTo6YmVnaW4oKSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3Qgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2l0ZXJhdG9yKF9CYXNlOjpiZWdpbigpLCB0aGlzKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkgbm9leGNlcHQKKyAgICAgIHsgcmV0dXJuIGl0ZXJhdG9yKF9CYXNlOjplbmQoKSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9pdGV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DogX0Jhc2Uoc3RkOjptb3ZlKF9feCkpIHsgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGlzZXQoaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wsCisJCQkgc2l6ZV90eXBlIF9fbiA9IDAsCisJCQkgY29uc3QgaGFzaGVyJiBfX2hmID0gaGFzaGVyKCksCisJCQkgY29uc3Qga2V5X2VxdWFsJiBfX2VxbCA9IGtleV9lcXVhbCgpLAorCQkJIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2wsIF9fbiwgX19oZiwgX19lcWwsIF9fYSkgeyB9CisKKyAgICAgIH51bm9yZGVyZWRfbXVsdGlzZXQoKSBub2V4Y2VwdCB7IH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHVub3JkZXJlZF9tdWx0aXNldCYgX194KQorICAgICAgeworCSpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX194OworCXRoaXMtPl9NX2ludmFsaWRhdGVfYWxsKCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGlzZXQmCisgICAgICBvcGVyYXRvcj0odW5vcmRlcmVkX211bHRpc2V0JiYgX194KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorICAgICAgICAvLyBOQjogRFIgNjc1LgorCWNsZWFyKCk7CisJc3dhcChfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0JgorICAgICAgb3BlcmF0b3I9KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sKQorICAgICAgeworCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+aW5zZXJ0KF9fbCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB2b2lkCisg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cGVyYXRvcltdKHNpemVfdHlwZSBfX24pCisgICAgICB7CisJX19nbGliY3h4X2NoZWNrX3N1YnNjcmlwdChfX24pOworCXJldHVybiBfTV9iYXNlKClbX19uXTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X2NoZWNrX3N1YnNjcmlwdChfX24pOworCXJldHVybiBfTV9iYXNlKClbX19uXTsKKyAgICAgIH0KKworICAgICAgdXNpbmcgX0Jhc2U6OmF0OworCisgICAgICByZWZlcmVuY2UKKyAgICAgIGZyb250KCkKKyAgICAgIHsKKwlfX2dsaWJjeHhfY2hlY2tfbm9uZW1wdHkoKTsKKwlyZXR1cm4gX0Jhc2U6OmZyb250KCk7CisgICAgICB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgZnJvbnQoKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9jaGVja19ub25lbXB0eSgpOworCXJldHVybiBfQmFzZTo6ZnJvbnQoKTsKKyAgICAgIH0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBiYWNrKCkKKyAgICAgIHsKKwlfX2dsaWJjeHhfY2hlY2tfbm9uZW1wdHkoKTsKKwlyZXR1cm4gX0Jhc2U6OmJhY2soKTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsKKwlfX2dsaWJjeHhfY2hlY2tfbm9uZW1wdHkoKTsKKwlyZXR1cm4gX0Jhc2U6OmJhY2soKTsKKyAgICAgIH0KKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gRFIgNDY0LiBTdWdnZXN0aW9uIGZvciBuZXcgbWVtYmVyIGZ1bmN0aW9ucyBpbiBzdGFuZGFyZCBjb250YWluZXJzLgorICAgICAgdXNpbmcgX0Jh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WNpbWFsMzIodW5zaWduZWQgaW50IF9feikJCQk6IF9fdmFsKF9feikge30KKyAgICBkZWNpbWFsMzIobG9uZyBfX3opCQkJCTogX192YWwoX196KSB7fQorICAgIGRlY2ltYWwzMih1bnNpZ25lZCBsb25nIF9feikJCTogX192YWwoX196KSB7fQorICAgIGRlY2ltYWwzMihsb25nIGxvbmcgX196KQkJCTogX192YWwoX196KSB7fQorICAgIGRlY2ltYWwzMih1bnNpZ25lZCBsb25nIGxvbmcgX196KQkJOiBfX3ZhbChfX3opIHt9CisKKyAgICAvLy8gQ29uZm9ybWluZyBleHRlbnNpb246IENvbnZlcnNpb24gZnJvbSBzY2FsYXIgZGVjaW1hbCB0eXBlLgorICAgIGRlY2ltYWwzMihfX2RlY2Zsb2F0MzIgX196KQkJCTogX192YWwoX196KSB7fQorCisgICAgLy8gMy4yLjIuNSAgQ29udmVyc2lvbiB0byBpbnRlZ3JhbCB0eXBlLiAoRElTQUJMRUQpCisgICAgLy9vcGVyYXRvciBsb25nIGxvbmcoKSBjb25zdCB7IHJldHVybiAobG9uZyBsb25nKV9fdmFsOyB9CisKKyAgICAvLyAzLjIuMi42ICBJbmNyZW1lbnQgYW5kIGRlY3JlbWVudCBvcGVyYXRvcnMuCisgICAgZGVjaW1hbDMyJiBvcGVyYXRvcisrKCkKKyAgICB7CisgICAgICBfX3ZhbCArPSAxOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGRlY2ltYWwzMiBvcGVyYXRvcisrKGludCkKKyAgICB7CisgICAgICBkZWNpbWFsMzIgX190bXAgPSAqdGhpczsKKyAgICAgIF9fdmFsICs9IDE7CisgICAgICByZXR1cm4gX190bXA7CisgICAgfQorCisgICAgZGVjaW1hbDMyJiBvcGVyYXRvci0tKCkKKyAgICB7CisgICAgICBfX3ZhbCAtPSAxOworICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGRlY2ltYWwzMiAgIG9wZXJhdG9yLS0oaW50KQorICAgIHsKKyAgIC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DY0KHVuc2lnbmVkIGludCBfX3opCQkJOiBfX3ZhbChfX3opIHt9CisgICAgZGVjaW1hbDY0KGxvbmcgX196KQkJCQk6IF9fdmFsKF9feikge30KKyAgICBkZWNpbWFsNjQodW5zaWduZWQgbG9uZyBfX3opCQk6IF9fdmFsKF9feikge30KKyAgICBkZWNpbWFsNjQobG9uZyBsb25nIF9feikJCQk6IF9fdmFsKF9feikge30KKyAgICBkZWNpbWFsNjQodW5zaWduZWQgbG9uZyBsb25nIF9feikJCTogX192YWwoX196KSB7fQorCisgICAgLy8vIENvbmZvcm1pbmcgZXh0ZW5zaW9uOiBDb252ZXJzaW9uIGZyb20gc2NhbGFyIGRlY2ltYWwgdHlwZS4KKyAgICBkZWNpbWFsNjQoX19kZWNmbG9hdDY0IF9feikJCQk6IF9fdmFsKF9feikge30KKworICAgIC8vIDMuMi4zLjUgIENvbnZlcnNpb24gdG8gaW50ZWdyYWwgdHlwZS4gKERJU0FCTEVEKQorICAgIC8vb3BlcmF0b3IgbG9uZyBsb25nKCkgY29uc3QgeyByZXR1cm4gKGxvbmcgbG9uZylfX3ZhbDsgfQorCisgICAgLy8gMy4yLjMuNiAgSW5jcmVtZW50IGFuZCBkZWNyZW1lbnQgb3BlcmF0b3JzLgorICAgIGRlY2ltYWw2NCYgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgX192YWwgKz0gMTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBkZWNpbWFsNjQgb3BlcmF0b3IrKyhpbnQpCisgICAgeworICAgICAgZGVjaW1hbDY0IF9fdG1wID0gKnRoaXM7CisgICAgICBfX3ZhbCArPSAxOworICAgICAgcmV0dXJuIF9fdG1wOworICAgIH0KKworICAgIGRlY2ltYWw2NCYgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgX192YWwgLT0gMTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBkZWNpbWFsNjQgb3BlcmF0b3ItLShpbnQpCisgICAge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WwxMjgodW5zaWduZWQgaW50IF9feikJCTogX192YWwoX196KSB7fQorICAgIGRlY2ltYWwxMjgobG9uZyBfX3opCQkJOiBfX3ZhbChfX3opIHt9CisgICAgZGVjaW1hbDEyOCh1bnNpZ25lZCBsb25nIF9feikJCTogX192YWwoX196KSB7fQorICAgIGRlY2ltYWwxMjgobG9uZyBsb25nIF9feikJCQk6IF9fdmFsKF9feikge30KKyAgICBkZWNpbWFsMTI4KHVuc2lnbmVkIGxvbmcgbG9uZyBfX3opCQk6IF9fdmFsKF9feikge30KKworICAgIC8vLyBDb25mb3JtaW5nIGV4dGVuc2lvbjogQ29udmVyc2lvbiBmcm9tIHNjYWxhciBkZWNpbWFsIHR5cGUuCisgICAgZGVjaW1hbDEyOChfX2RlY2Zsb2F0MTI4IF9feikJCTogX192YWwoX196KSB7fQorCisgICAgLy8gMy4yLjQuNSAgQ29udmVyc2lvbiB0byBpbnRlZ3JhbCB0eXBlLiAoRElTQUJMRUQpCisgICAgLy9vcGVyYXRvciBsb25nIGxvbmcoKSBjb25zdCB7IHJldHVybiAobG9uZyBsb25nKV9fdmFsOyB9CisKKyAgICAvLyAzLjIuNC42ICBJbmNyZW1lbnQgYW5kIGRlY3JlbWVudCBvcGVyYXRvcnMuCisgICAgZGVjaW1hbDEyOCYgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgX192YWwgKz0gMTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBkZWNpbWFsMTI4IG9wZXJhdG9yKysoaW50KQorICAgIHsKKyAgICAgIGRlY2ltYWwxMjggX190bXAgPSAqdGhpczsKKyAgICAgIF9fdmFsICs9IDE7CisgICAgICByZXR1cm4gX190bXA7CisgICAgfQorCisgICAgZGVjaW1hbDEyOCYgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgX192YWwgLT0gMTsKKyAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICBkZWNpbWFsMTI4ICAgb3BlcmF0b3ItLShpbnQp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cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMURGOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREY7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICBzdGF0aWMgZGVjaW1hbDMyIG1ha2VfZGVjaW1hbDMyKHVuc2lnbmVkIGxvbmcgbG9uZyBfX2NvZWZmLCBpbnQgX19leHBvbmVudCkKKyAgeworICAgIGRlY2ltYWwzMiBfX2RlY2V4cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMURGOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREY7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICBzdGF0aWMgZGVjaW1hbDY0IG1ha2VfZGVjaW1hbDY0KGxvbmcgbG9uZyBfX2NvZWZmLCBpbnQgX19leHBvbmVudCkKKyAgeworICAgIGRlY2ltYWw2NCBfX2RlY2V4cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMUREOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREQ7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICBzdGF0aWMgZGVjaW1hbDY0IG1ha2VfZGVjaW1hbDY0KHVuc2lnbmVkIGxvbmcgbG9uZyBfX2NvZWZmLCBpbnQgX19leHBvbmVudCkKKyAgeworICAgIGRlY2ltYWw2NCBfX2RlY2V4cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMUREOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREQ7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICBzdGF0aWMgZGVjaW1hbDEyOCBtYWtlX2RlY2ltYWwxMjgobG9uZyBsb25nIF9fY29lZmYsIGludCBfX2V4cG9uZW50KQorICB7CisgICAgZGVjaW1hbDEyOCBfX2RlY2V4cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMURMOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREw7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICBzdGF0aWMgZGVjaW1hbDEyOCBtYWtlX2RlY2ltYWwxMjgodW5zaWduZWQgbG9uZyBsb25nIF9fY29lZmYsIGludCBfX2V4cG9uZW50KQorICB7CisgICAgZGVjaW1hbDEyOCBfX2RlY2V4cCA9IDEsIF9fbXVsdGlwbGllcjsKKworICAgIGlmIChfX2V4cG9uZW50IDwgMCkKKyAgICAgIHsKKwlfX211bHRpcGxpZXIgPSAxLkUtMURMOworCV9fZXhwb25lbnQgPSAtX19leHBvbmVudDsKKyAgICAgIH0KKyAgICBlbHNlCisgICAgICBfX211bHRpcGxpZXIgPSAxLkUxREw7CisKKyAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX2V4cG9uZW50OyArK19faSkKKyAgICAgIF9fZGVjZXhwICo9IF9fbXVsdGlwbGllcjsKKworICAgIHJldHVybiBfX2NvZWZmICogX19kZWNleHA7CisgIH0KKworICAvLyBJU08vSUVDIFRSIDI0NzMzICAzLjIuNiAgQ29udmVyc2lvbiB0byBnZW5lcmljIGZsb2F0aW5nLXBvaW50IHR5cGUuCisKKyAgaW5saW5lIGZsb2F0IGRlY2ltYWwzMl90b19mbG9hdChkZWNpbWFsMzIgX19kKQorICB7IHJldHVybiAoZmxvYXQpX19kLl9fZ2V0dmFsKCk7IH0KKworICBpbmxpbmUgZmxvYXQgZGVjaW1hbDY0X3RvX2Zsb2F0KGRlY2ltYWw2NCBfX2QpCisgIHsgcmV0dXJuIChmbG9hdClfX2QuX19nZXR2YWwoKTsgfQorCisgIGlubGluZSBmbG9hdCBkZWNpbWFsMTI4X3RvX2Zsb2F0KGRlY2ltYWwxMjggX19kKQorICB7IHJldHVybiAoZmxvYXQpX19kLl9fZ2V0dmFsKCk7IH0KKworICBpbmx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gIC8vLyBCYXNlIGNsYXNzLgorIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBjbGFzcyBhcnJheV9hbGxvY2F0b3JfYmFzZQorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIHNpemVfdCAgICAgCXNpemVfdHlwZTsKKyAgICAgIHR5cGVkZWYgcHRyZGlmZl90ICAJZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiBfVHAqICAgICAgIAlwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqIAljb25zdF9wb2ludGVyOworICAgICAgdHlwZWRlZiBfVHAmICAgICAgIAlyZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIGNvbnN0IF9UcCYJY29uc3RfcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBfVHAgICAgICAgIAl2YWx1ZV90eXBlOworCisgICAgICBwb2ludGVyCisgICAgICBhZGRyZXNzKHJlZmVyZW5jZSBfX3gpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKF9feCk7IH0KKworICAgICAgY29uc3RfcG9pbnRlcgorICAgICAgYWRkcmVzcyhjb25zdF9yZWZlcmVuY2UgX194KSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gc3RkOjpfX2FkZHJlc3NvZihfX3gpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGRlYWxsb2NhdGUocG9pbnRlciwgc2l6ZV90eXBlKQorICAgICAgeyAKKwkvLyBEb2VzIG5vdGhpbmcuCisgICAgICB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdCBfR0xJQkNYWF9VU0VfTk9FWENFUFQgCisgICAgICB7IHJldHVybiBzaXplX3QoLTEpIC8gc2l6ZW9mKF9UcCk7IH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9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CkgY29uc3QgdGhyb3coKQorCXsKKwkgIHJldHVybiBzaXplX3QoYml0c19wZXJfYmxvY2spCisJICAgICogKChyZWludGVycHJldF9jYXN0PHNpemVfdCo+KHRoaXMtPl9NX2Jhc2UoKSkgCisJCS0gX01fY3Vycl9ibWFwKSAtIDEpOworCX0KKyAgICAKKwlfSW5kZXhfdHlwZQorCV9NX3doZXJlKCkgY29uc3QgdGhyb3coKQorCXsgcmV0dXJuIF9NX2N1cnJfaW5kZXg7IH0KKyAgICAgIH07CisKKyAgICAvKiogQGJyaWVmICBNYXJrIGEgbWVtb3J5IGFkZHJlc3MgYXMgYWxsb2NhdGVkIGJ5IHJlLXNldHRpbmcgdGhlCisgICAgICogIGNvcnJlc3BvbmRpbmcgYml0IGluIHRoZSBiaXQtbWFwLgorICAgICAqLworICAgIGlubGluZSB2b2lkIAorICAgIF9fYml0X2FsbG9jYXRlKHNpemVfdCogX19wYm1hcCwgc2l6ZV90IF9fcG9zKSB0aHJvdygpCisgICAgeworICAgICAgc2l6ZV90IF9fbWFzayA9IDEgPDwgX19wb3M7CisgICAgICBfX21hc2sgPSB+X19tYXNrOworICAgICAgKl9fcGJtYXAgJj0gX19tYXNrOworICAgIH0KKyAgCisgICAgLyoqIEBicmllZiAgTWFyayBhIG1lbW9yeSBhZGRyZXNzIGFzIGZyZWUgYnkgc2V0dGluZyB0aGUKKyAgICAgKiAgY29ycmVzcG9uZGluZyBiaXQgaW4gdGhlIGJpdC1tYXAuCisgICAgICovCisgICAgaW5saW5lIHZvaWQgCisgICAgX19iaXRfZnJlZShzaXplX3QqIF9fcGJtYXAsIHNpemVfdCBfX3BvcykgdGhyb3coKQorICAgIHsKKyAgICAgIHNpemVfdCBfX21hc2sgPSAxIDw8IF9fcG9zOworICAgICAgKl9fcGJtYXAgfD0gX19tYXNrOworICAgIH0KKworICBfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX1ZFUlNJT04KKyAgfSAvLyBuYW1lc3BhY2UgX19kZXRhaWwKKwor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2VyciA9IChpY29udl90KSgtMSk7CisgICAgICBib29sIF9fdGVzdCA9IF9NX2luX2Rlc2MgJiYgX01faW5fZGVzYyAhPSBfX2VycjsgCisgICAgICBfX3Rlc3QgJj0gIF9NX291dF9kZXNjICYmIF9NX291dF9kZXNjICE9IF9fZXJyOworICAgICAgcmV0dXJuIF9fdGVzdDsKKyAgICB9CisgICAgCisgICAgaW50CisgICAgY2hhcmFjdGVyX3JhdGlvKCkgY29uc3QKKyAgICB7IHJldHVybiBfTV9ieXRlczsgfQorCisgICAgY29uc3Qgc3RkOjpzdHJpbmcKKyAgICBpbnRlcm5hbF9lbmNvZGluZygpIGNvbnN0CisgICAgeyByZXR1cm4gX01faW50X2VuYzsgfQorCisgICAgaW50IAorICAgIGludGVybmFsX2JvbSgpIGNvbnN0CisgICAgeyByZXR1cm4gX01faW50X2JvbTsgfQorCisgICAgY29uc3Qgc3RkOjpzdHJpbmcKKyAgICBleHRlcm5hbF9lbmNvZGluZygpIGNvbnN0CisgICAgeyByZXR1cm4gX01fZXh0X2VuYzsgfQorCisgICAgaW50IAorICAgIGV4dGVybmFsX2JvbSgpIGNvbnN0CisgICAgeyByZXR1cm4gX01fZXh0X2JvbTsgfQorCisgICAgY29uc3QgZGVzY3JpcHRvcl90eXBlJgorICAgIGluX2Rlc2NyaXB0b3IoKSBjb25zdAorICAgIHsgcmV0dXJuIF9NX2luX2Rlc2M7IH0KKworICAgIGNvbnN0IGRlc2NyaXB0b3JfdHlwZSYKKyAgICBvdXRfZGVzY3JpcHRvcigpIGNvbnN0CisgICAgeyByZXR1cm4gX01fb3V0X2Rlc2M7IH0KKworICBwcm90ZWN0ZWQ6CisgICAgdm9pZAorICAgIGluaXQoKQorICAgIHsKKyAgICAgIGNvbnN0IGRlc2NyaXB0b3JfdHlwZSBfX2VyciA9IChpY29udl90KSgtMSk7CisgICAgICBjb25zdCBib29sIF9faGF2ZV9lbmNvZGluZ3MgPSBfTV9pbnRfZW5jLnNpemUoKSAmJiBfTV9leHRfZW5jLnNpemUoKTsKKyAgICAgIGlmICghX01faW5fZGVzYyAmJiBfX2hhdmVfZW5jb2RpbmdzKQorCXsKKwkgIF9NX2luX2Rlc2MgPSBpY29udl9vcGVuKF9NX2ludF9lbmMuY19zdHIoKSwgX01fZXh0X2VuYy5jX3N0cigpKTsKKwkgIGlmIChfTV9pbl9kZXNjID09IF9fZXJyKQorCSAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oImVuY29kaW5nX3N0YXRlOjpfTV9pbml0ICIKKwkJCQkgICAgImNyZWF0aW5nIGljb252IGlucHV0IGRlc2NyaXB0b3IgZmFpbGVkIikpOworCX0KKyAgICAgIGlmICghX01fb3V0X2Rlc2MgJiYgX19oYXZlX2VuY29kaW5ncykKKwl7CisJICBfTV9vdXRfZGVzYyA9IGljb252X29wZW4oX01fZXh0X2VuYy5jX3N0cigpLCBfTV9pbnRfZW5jLmNfc3RyKCkpOworCSAgaWYgKF9NX291dF9kZXNjID09IF9fZXJyKQorCSAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oImVuY29kaW5nX3N0YXRlOjpfTV9pbml0ICIKKwkJCQkgICJjcmVhdGluZyBpY29udiBvdXRwdXQgZGVzY3JpcHRvciBmYWlsZWQiKSk7CisJfQorICAgIH0KKworICAgIHZvaWQKKyAgICBjb25zdHJ1Y3QoY29uc3QgZW5jb2Rpbmdfc3RhdGUmIF9fb2JqKQorICAgIHsKKyAgICAgIGRlc3Ryb3koKTsKKyAgICAgIF9NX2ludF9lbmMgPSBfX29iai5fTV9pbnRfZW5jOworICAgICAgX01fZXh0X2VuYyA9IF9fb2JqLl9NX2V4dF9lbmM7CisgICAgICBfTV9leHRfYm9tID0gX19vYmouX01fZXh0X2JvbTsKKyAgICAgIF9NX2ludF9ib20gPSBfX29iai5fTV9pbnRfYm9tOworICAgICAgX01fYnl0ZXMgPSBfX29iai5fTV9ieXRlczsKKyAgICAgIGluaXQoKTsKKyAgICB9C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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJl9fZmxlbiwgJl9fY3RvLCAmX190bGVuKTsgCisJICAgIH0KKwkgIGVsc2UKKwkgICAgeworCSAgICAgIGV4dGVybl90eXBlKiBfX2NmaXhlZCA9IGNvbnN0X2Nhc3Q8ZXh0ZXJuX3R5cGUqPihfX2Zyb20pOworCSAgICAgIF9fY2Zyb20gPSByZWludGVycHJldF9jYXN0PGNoYXIqPihfX2NmaXhlZCk7CisJICAgICAgX19jb252ID0gX19pY29udl9hZGFwdG9yKGljb252LCBfX2Rlc2MsICZfX2Nmcm9tLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJl9fZmxlbiwgJl9fY3RvLCAmX190bGVuKTsgCisJICAgIH0KKworCSAgCisJICBpZiAoX19jb252ICE9IHNpemVfdCgtMSkpCisJICAgIHsKKwkgICAgICBfX2Zyb21fbmV4dCA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgZXh0ZXJuX3R5cGUqPihfX2Nmcm9tKTsKKwkgICAgICBfX3RvX25leHQgPSByZWludGVycHJldF9jYXN0PGludGVybl90eXBlKj4oX19jdG8pOworCSAgICAgIF9fcmV0ID0gY29kZWN2dF9iYXNlOjpvazsKKwkgICAgfQorCSAgZWxzZSAKKwkgICAgeworCSAgICAgIGlmIChfX2ZsZW4gPCBzdGF0aWNfY2FzdDxzaXplX3Q+KF9fZnJvbV9lbmQgLSBfX2Zyb20pKQorCQl7CisJCSAgX19mcm9tX25leHQgPSByZWludGVycHJldF9jYXN0PGNvbnN0IGV4dGVybl90eXBlKj4oX19jZnJvbSk7CisJCSAgX190b19uZXh0ID0gcmVpbnRlcnByZXRfY2FzdDxpbnRlcm5fdHlwZSo+KF9fY3RvKTsKKwkJICBfX3JldCA9IGNvZGVjdnRfYmFzZTo6cGFydGlhbDsKKwkJfQorCSAgICAgIGVsc2UKKwkJX19yZXQgPSBjb2RlY3Z0X2Jhc2U6OmVycm9yOworCSAgIC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saWMgc3RkOjpleGNlcHRpb24KKyAgeworICBwdWJsaWM6CisgICAgdmlydHVhbCBjaGFyIGNvbnN0KgorICAgIHdoYXQoKSBjb25zdCB0aHJvdygpCisgICAgeyByZXR1cm4gIl9fZ251X2N4eDo6X19jb25jdXJyZW5jZV91bmxvY2tfZXJyb3IiOyB9CisgIH07CisKKyAgY2xhc3MgX19jb25jdXJyZW5jZV9icm9hZGNhc3RfZXJyb3IgOiBwdWJsaWMgc3RkOjpleGNlcHRpb24KKyAgeworICBwdWJsaWM6CisgICAgdmlydHVhbCBjaGFyIGNvbnN0KgorICAgIHdoYXQoKSBjb25zdCB0aHJvdygpCisgICAgeyByZXR1cm4gIl9fZ251X2N4eDo6X19jb25jdXJyZW5jZV9icm9hZGNhc3RfZXJyb3IiOyB9CisgIH07CisKKyAgY2xhc3MgX19jb25jdXJyZW5jZV93YWl0X2Vycm9yIDogcHVibGljIHN0ZDo6ZXhjZXB0aW9uCisgIHsKKyAgcHVibGljOgorICAgIHZpcnR1YWwgY2hhciBjb25zdCoKKyAgICB3aGF0KCkgY29uc3QgdGhyb3coKQorICAgIHsgcmV0dXJuICJfX2dudV9jeHg6Ol9fY29uY3VycmVuY2Vfd2FpdF9lcnJvciI7IH0KKyAgfTsKKworICAvLyBTdWJzdGl0dXRlIGZvciBjb25jdXJyZW5jZV9lcnJvciBvYmplY3QgaW4gdGhlIGNhc2Ugb2YgLWZuby1leGNlcHRpb25zLgorICBpbmxpbmUgdm9pZAorICBfX3Rocm93X2NvbmN1cnJlbmNlX2xvY2tfZXJyb3IoKQorICB7CisjaWYgX19FWENFUFRJT05TCisgICAgdGhyb3cgX19jb25jdXJyZW5jZV9sb2NrX2Vycm9yKCk7CisjZWxzZQorICAgIF9fYnVpbHRpbl9hYm9ydCgpOworI2VuZGlmCisgIH0KKworICBpbmxpbmUgdm9pZAorICBfX3Rocm93X2NvbmN1cnJlbmNlX3VubG9ja19lcnJvcigpCisgIHsKKyNpZiBfX0VYQ0VQVElPT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lfX0dUSFJFQURfTVVURVhfSU5JVF9GVU5DVElPTigmX01fbXV0ZXgpOworI2VuZGlmCisgICAgfQorCisjaWYgX19HVEhSRUFEUyAmJiAhIGRlZmluZWQgX19HVEhSRUFEX01VVEVYX0lOSVQKKyAgICB+X19tdXRleCgpIAorICAgIHsgCisgICAgICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wKCkpCisJX19ndGhyZWFkX211dGV4X2Rlc3Ryb3koJl9NX211dGV4KTsgCisgICAgfQorI2VuZGlmIAorCisgICAgdm9pZCBsb2NrKCkKKyAgICB7CisjaWYgX19HVEhSRUFEUworICAgICAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCgpKQorCXsKKwkgIGlmIChfX2d0aHJlYWRfbXV0ZXhfbG9jaygmX01fbXV0ZXgpICE9IDApCisJICAgIF9fdGhyb3dfY29uY3VycmVuY2VfbG9ja19lcnJvcigpOworCX0KKyNlbmRpZgorICAgIH0KKyAgICAKKyAgICB2b2lkIHVubG9jaygpCisgICAgeworI2lmIF9fR1RIUkVBRFMKKyAgICAgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AoKSkKKwl7CisJICBpZiAoX19ndGhyZWFkX211dGV4X3VubG9jaygmX01fbXV0ZXgpICE9IDApCisJICAgIF9fdGhyb3dfY29uY3VycmVuY2VfdW5sb2NrX2Vycm9yKCk7CisJfQorI2VuZGlmCisgICAgfQorCisgICAgX19ndGhyZWFkX211dGV4X3QqIGd0aHJlYWRfbXV0ZXgodm9pZCkKKyAgICAgIHsgcmV0dXJuICZfTV9tdXRleDsgfQorICB9OworCisgIGNsYXNzIF9fcmVjdXJzaXZlX211dGV4IAorICB7CisgIHByaXZhdGU6CisjaWYgX19HVEhSRUFEUyAmJiBkZWZpbmVkIF9fR1RIUkVBRF9SRUNVUlNJVkVfTVVURVhfSU5JVAorICAgIF9fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdCBfTV9tdXRleCA9IF9fR1RIUkVBRF9SRUNVUlNJ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BlZF9sb2NrCisgIHsKKyAgcHVibGljOgorICAgIHR5cGVkZWYgX19tdXRleCBfX211dGV4X3R5cGU7CisKKyAgcHJpdmF0ZToKKyAgICBfX211dGV4X3R5cGUmIF9NX2RldmljZTsKKworICAgIF9fc2NvcGVkX2xvY2soY29uc3QgX19zY29wZWRfbG9jayYpOworICAgIF9fc2NvcGVkX2xvY2smIG9wZXJhdG9yPShjb25zdCBfX3Njb3BlZF9sb2NrJik7CisKKyAgcHVibGljOgorICAgIGV4cGxpY2l0IF9fc2NvcGVkX2xvY2soX19tdXRleF90eXBlJiBfX25hbWUpIDogX01fZGV2aWNlKF9fbmFtZSkKKyAgICB7IF9NX2RldmljZS5sb2NrKCk7IH0KKworICAgIH5fX3Njb3BlZF9sb2NrKCkgdGhyb3coKQorICAgIHsgX01fZGV2aWNlLnVubG9jaygpOyB9CisgIH07CisKKyNpZmRlZiBfX0dUSFJFQURfSEFTX0NPTkQKKyAgY2xhc3MgX19jb25kCisgIHsKKyAgcHJpdmF0ZToKKyNpZiBfX0dUSFJFQURTICYmIGRlZmluZWQgX19HVEhSRUFEX0NPTkRfSU5JVAorICAgIF9fZ3RocmVhZF9jb25kX3QgX01fY29uZCA9IF9fR1RIUkVBRF9DT05EX0lOSVQ7CisjZWxzZQorICAgIF9fZ3RocmVhZF9jb25kX3QgX01fY29uZDsKKyNlbmRpZgorCisgICAgX19jb25kKGNvbnN0IF9fY29uZCYpOworICAgIF9fY29uZCYgb3BlcmF0b3I9KGNvbnN0IF9fY29uZCYpOworCisgIHB1YmxpYzoKKyAgICBfX2NvbmQoKSAKKyAgICB7IAorI2lmIF9fR1RIUkVBRFMgJiYgISBkZWZpbmVkIF9fR1RIUkVBRF9DT05EX0lOSVQKKyAgICAgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AoKSkKKwlfX0dUSFJFQURfQ09ORF9JTklUX0ZVTkNUSU9OKCZfTV9jb25kKTsKKyNlbmRpZgorICAgIH0KKworI2lmIF9fR1RIUkVBR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NlIHdoZXJlIGRlYnVnIGluZm9ybWF0aW9uIGlzIHN0b3JlZC4KKyAgICAgIHNpemVfdHlwZSAJCV9NX2V4dHJhOworICAgICAgCisgICAgICBfQWxsb2MJCQlfTV9hbGxvY2F0b3I7CisKKyAgICBwdWJsaWM6CisgICAgICBkZWJ1Z19hbGxvY2F0b3IoKQorICAgICAgeworCWNvbnN0IHNpemVfdCBfX29ial9zaXplID0gc2l6ZW9mKHZhbHVlX3R5cGUpOworCV9NX2V4dHJhID0gKHNpemVvZihzaXplX3R5cGUpICsgX19vYmpfc2l6ZSAtIDEpIC8gX19vYmpfc2l6ZTsgCisgICAgICB9CisgICAgICAKKyAgICAgIHBvaW50ZXIKKyAgICAgIGFsbG9jYXRlKHNpemVfdHlwZSBfX24pCisgICAgICB7CisgICAgICAgIHBvaW50ZXIgX19yZXMgPSBfTV9hbGxvY2F0b3IuYWxsb2NhdGUoX19uICsgX01fZXh0cmEpOyAgICAgIAorCXNpemVfdHlwZSogX19wcyA9IHJlaW50ZXJwcmV0X2Nhc3Q8c2l6ZV90eXBlKj4oX19yZXMpOworCSpfX3BzID0gX19uOworICAgICAgICByZXR1cm4gX19yZXMgKyBfTV9leHRyYTsKKyAgICAgIH0KKworICAgICAgcG9pbnRlcgorICAgICAgYWxsb2NhdGUoc2l6ZV90eXBlIF9fbiwgY29uc3Qgdm9pZCogX19oaW50KQorICAgICAgeworICAgICAgICBwb2ludGVyIF9fcmVzID0gX01fYWxsb2NhdG9yLmFsbG9jYXRlKF9fbiArIF9NX2V4dHJhLCBfX2hpbnQpOworCXNpemVfdHlwZSogX19wcyA9IHJlaW50ZXJwcmV0X2Nhc3Q8c2l6ZV90eXBlKj4oX19yZXMpOworCSpfX3BzID0gX19uOworICAgICAgICByZXR1cm4gX19yZXMgKyBfTV9leHRyYTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgZGVhbGxvY2F0ZShwb2ludGVyIF9fcCwgc2l6ZV90eXBlIF9fbikKKyAgICAgIH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gorICAgKiAgQGFkZHRvZ3JvdXAgU0dJZXh0ZW5zaW9ucworICAgKiAgQHsKKyAgICovCisgIC8vLyBBbiBcbGluayBTR0lleHRlbnNpb25zIFNHSSBleHRlbnNpb24gXGVuZGxpbmsuCisgIHRlbXBsYXRlIDxjbGFzcyBfT3BlcmF0aW9uMSwgY2xhc3MgX09wZXJhdGlvbjI+CisgICAgY2xhc3MgdW5hcnlfY29tcG9zZQorICAgIDogcHVibGljIHVuYXJ5X2Z1bmN0aW9uPHR5cGVuYW1lIF9PcGVyYXRpb24yOjphcmd1bWVudF90eXBlLAorCQkJICAgIHR5cGVuYW1lIF9PcGVyYXRpb24xOjpyZXN1bHRfdHlwZT4KKyAgICB7CisgICAgcHJvdGVjdGVkOgorICAgICAgX09wZXJhdGlvbjEgX01fZm4xOworICAgICAgX09wZXJhdGlvbjIgX01fZm4yOworCisgICAgcHVibGljOgorICAgICAgdW5hcnlfY29tcG9zZShjb25zdCBfT3BlcmF0aW9uMSYgX194LCBjb25zdCBfT3BlcmF0aW9uMiYgX195KQorICAgICAgOiBfTV9mbjEoX194KSwgX01fZm4yKF9feSkge30KKworICAgICAgdHlwZW5hbWUgX09wZXJhdGlvbjE6OnJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKGNvbnN0IHR5cGVuYW1lIF9PcGVyYXRpb24yOjphcmd1bWVudF90eXBlJiBfX3gpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9mbjEoX01fZm4yKF9feCkpOyB9CisgICAgfTsKKworICAvLy8gQW4gXGxpbmsgU0dJZXh0ZW5zaW9ucyBTR0kgZXh0ZW5zaW9uIFxlbmRsaW5rLgorICB0ZW1wbGF0ZSA8Y2xhc3MgX09wZXJhdGlvbjEsIGNsYXNzIF9PcGVyYXRpb24yPgorICAgIGlubGluZSB1bmFyeV9jb21wb3NlPF9PcGVyYXRpb24xLCBfT3BlcmF0aW9uMj4KKyAgICBjb21wb3NlMShjb25zdCBfT3BlcmF0aW9uMSYgX19m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E5vdGUgdGhhdCB0aGlzIGNvZGUgYXNzdW1lcyB0aGF0IEBjIGludCBpcyAzMiBiaXRzLgorICAgKgorICAgKiAgQGluZ3JvdXAgU0dJZXh0ZW5zaW9ucworICAgKi8KKyAgY2xhc3Mgc3VidHJhY3RpdmVfcm5nCisgIDogcHVibGljIHVuYXJ5X2Z1bmN0aW9uPHVuc2lnbmVkIGludCwgdW5zaWduZWQgaW50PgorICB7CisgIHByaXZhdGU6CisgICAgdW5zaWduZWQgaW50IF9NX3RhYmxlWzU1XTsKKyAgICBzaXplX3QgX01faW5kZXgxOworICAgIHNpemVfdCBfTV9pbmRleDI7CisKKyAgcHVibGljOgorICAgIC8vLyBSZXR1cm5zIGEgbnVtYmVyIGxlc3MgdGhhbiB0aGUgYXJndW1lbnQuCisgICAgdW5zaWduZWQgaW50CisgICAgb3BlcmF0b3IoKSh1bnNpZ25lZCBpbnQgX19saW1pdCkKKyAgICB7CisgICAgICBfTV9pbmRleDEgPSAoX01faW5kZXgxICsgMSkgJSA1NTsKKyAgICAgIF9NX2luZGV4MiA9IChfTV9pbmRleDIgKyAxKSAlIDU1OworICAgICAgX01fdGFibGVbX01faW5kZXgxXSA9IF9NX3RhYmxlW19NX2luZGV4MV0gLSBfTV90YWJsZVtfTV9pbmRleDJdOworICAgICAgcmV0dXJuIF9NX3RhYmxlW19NX2luZGV4MV0gJSBfX2xpbWl0OworICAgIH0KKworICAgIHZvaWQKKyAgICBfTV9pbml0aWFsaXplKHVuc2lnbmVkIGludCBfX3NlZWQpCisgICAgeworICAgICAgdW5zaWduZWQgaW50IF9fayA9IDE7CisgICAgICBfTV90YWJsZVs1NF0gPSBfX3NlZWQ7CisgICAgICBzaXplX3QgX19pOworICAgICAgZm9yIChfX2kgPSAwOyBfX2kgPCA1NDsgX19pKyspCisJeworCSAgc2l6ZV90IF9faWkgPSAoMjEgKiAoX19pICsgMSkgJSA1NSkgLSAxOworCSAgX01fdGFibGVbX19paV0gPSBfX2s7CisJICBfX2sgP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H0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmJlZ2luKCk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbmQoKTsgfQorCisgICAgICBwYWlyPGl0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0KGNvbnN0IHZhbHVlX3R5cGUmIF9fb2JqKQorICAgICAgeyByZXR1cm4gX01faHQuaW5zZXJ0X3VuaXF1ZShfX29iaik7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIHZvaWQKKyAgICAgICAgaW5zZXJ0KF9JbnB1dEl0ZXJhdG9yIF9fZiwgX0lucHV0SXRlcmF0b3IgX19sKQorICAgICAgICB7IF9NX2h0Lmluc2VydF91bmlxdWUoX19mLCBfX2wpOyB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGJvb2w+CisgICAgICBpbnNlcnRfbm9yZXNpemUoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7IHJldHVybiBfTV9odC5pbnNlcnRfdW5pcXVlX25vcmVzaXplKF9fb2JqKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpCisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rZXkpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5maW5kKF9fa2V5KTsgfQorCisgICAgICBfVHAmCisgICAgICBvcGVyYXRvcltdKGNvbnN0IGtleV90eXBlJiBfX2tleSkKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmZpbmRfb3JfaW5zZXJ0KHZhbHVlX3R5cGUoX19rZXksIF9UcCgpKSkuc2Vjb25kOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuY291bnQoX19rZXkpOyB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KQorICAgICAgeyByZXR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHBhaXI8Y29uc3RfaXRlcmF0b3IsIGNvbnN0X2l0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZXJhc2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KQorICAgICAge3JldHVybiBfTV9odC5lcmFzZShfX2tleSk7IH0KKworICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19pdCkKKyAgICAgIHsgX01faHQuZXJhc2UoX19pdCk7IH0KKworICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19mLCBpdGVyYXRvciBfX2wpCisgICAgICB7IF9NX2h0LmVyYXNlKF9fZiwgX19sKTsgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpCisgICAgICB7IF9NX2h0LmNsZWFyKCk7IH0KKworICAgICAgdm9pZAorICAgICAgcmVzaXplKHNpemVfdHlwZSBfX2hpbnQpCisgICAgICB7IF9NX2h0LnJlc2l6ZShfX2hpbnQpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0X2NvdW50KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmJ1Y2tldF9jb3VudCgpOyB9CisKK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gX0h0Ojpjb25zdF9pdGVyYXRvciBjb25zdF9pdGVyYXRvcjsKKyAgICAgIAorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfSHQ6OmFsbG9jYXRvcl90eXBlIGFsbG9jYXRvcl90eXBlOworICAgICAgCisgICAgICBoYXNoZXIKKyAgICAgIGhhc2hfZnVuY3QoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuaGFzaF9mdW5jdCgpOyB9CisKKyAgICAgIGtleV9lcXVhbAorICAgICAga2V5X2VxKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmtleV9lcSgpOyB9CisKKyAgICAgIGFsbG9jYXRvcl90eXBlCisgICAgICBnZXRfYWxsb2NhdG9yKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmdldF9hbGxvY2F0b3IoKTsgfQorCisgICAgICBoYXNoX211bHRpbWFwKCkKKyAgICAgIDogX01faHQoMTAwLCBoYXNoZXIoKSwga2V5X2VxdWFsKCksIGFsbG9jYXRvcl90eXBlKCkpIHt9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBoYXNoX211bHRpbWFwKHNpemVfdHlwZSBfX24pCisgICAgICA6IF9NX2h0KF9fbiwgaGFzaGVyKCksIGtleV9lcXVhbCgpLCBhbGxvY2F0b3JfdHlwZSgpKSB7fQorCisgICAgICBoYXNoX211bHRpbWFwKHNpemVfdHlwZSBfX24sIGNvbnN0IGhhc2hlciYgX19oZikKKyAgICAgIDogX01faHQoX19uLCBfX2hmLCBrZXlfZXF1YWwoKSwgYWxsb2NhdG9yX3R5cGUoKSkge30KKworICAgICAgaGFzaF9tdWx0aW1hcChzaXplX3R5cGUgX19uLCBjb25zdCBoYXNoZXImIF9faGYsIGNvbnN0IGtleV9lcXVhbCYgX19lcWwsCisJCSAgICBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgIDogX01faHQoX19uLCBfX2hmLCBfX2V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2VxdWFsJiBfX2VxbCwKKwkJICAgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisJOiBfTV9odChfX24sIF9faGYsIF9fZXFsLCBfX2EpCisgICAgICAgIHsgX01faHQuaW5zZXJ0X2VxdWFsKF9fZiwgX19sKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuc2l6ZSgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X3NpemUoKTsgfQorCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbXB0eSgpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAoaGFzaF9tdWx0aW1hcCYgX19ocykKKyAgICAgIHsgX01faHQuc3dhcChfX2hzLl9NX2h0KTsgfQorCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfSzEsIGNsYXNzIF9UMSwgY2xhc3MgX0hGLCBjbGFzcyBfRXFLLCBjbGFzcyBfQWw+CisgICAgICAgIGZyaWVuZCBib29sCisgICAgICAgIG9wZXJhdG9yPT0oY29uc3QgaGFzaF9tdWx0aW1hcDxfSzEsIF9UMSwgX0hGLCBfRXFLLCBfQWw+JiwKKwkJICAgY29uc3QgaGFzaF9tdWx0aW1hcDxfSzEsIF9UMSwgX0hGLCBfRXFLLCBfQWw+Jik7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpCisgICAgICB7IHJldHVybiBfTV9odC5iZWdpbigpOyB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBlbmQoKQorICAgICAgeyByZXR1cm4gX01faHQuZW5kKCk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3QKKyAgICAgIHsgcmV0dXJ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XR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHBhaXI8Y29uc3RfaXRlcmF0b3IsIGNvbnN0X2l0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZXJhc2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KQorICAgICAgeyByZXR1cm4gX01faHQuZXJhc2UoX19rZXkpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9faXQpCisgICAgICB7IF9NX2h0LmVyYXNlKF9faXQpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9fZiwgaXRlcmF0b3IgX19sKQorICAgICAgeyBfTV9odC5lcmFzZShfX2YsIF9fbCk7IH0KKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKQorICAgICAgeyBfTV9odC5jbGVhcigpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19oaW50KQorICAgICAgeyBfTV9odC5yZXNpemUoX19oaW50KTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5idWNrZXRfY291bnQoKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQubWF4X2J1Y2tldF9jb3VudCgpOyB9CisgICAgICAKKyAgICAgIHNpemVfdHlwZQorICAgICAgZWxlbXNfaW5fYnVja2V0KHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5lbGVtc19pbl9idWNrZXQoX19uKTsgfQorICAg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AgICAgICAgICAgICAgICByZWZlcmVuY2U7CisgICAgICAKKyAgICAgIGluc2VydF9pdGVyYXRvcihfQ29udGFpbmVyJiBfX3gpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194LCB0eXBlbmFtZSBfQ29udGFpbmVyOjppdGVyYXRvcikKKyAgICAgIDogY29udGFpbmVyKCZfX3gpIHt9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yPShjb25zdCB0eXBlbmFtZSBfQ29udGFpbmVyOjp2YWx1ZV90eXBlJiBfX3ZhbHVlKQorICAgICAgeworCWNvbnRhaW5lci0+aW5zZXJ0KF9fdmFsdWUpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yPF9Db250YWluZXI+JgorICAgICAgb3BlcmF0b3IqKCkKKyAgICAgIHsgcmV0dXJuICp0aGlzOyB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKysoKSB7IHJldHVybiAqdGhpczsgfQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsgcmV0dXJuICp0aGlzOyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTxjbGFzcyBfS2V5LCBjbGFzcyBfVHAsIGNsYXNzIF9IYXNoRm4sICBjbGFzcyBfRXFLZXksIGNsYXNzIF9BbGxvYz4KKyAgICBjbGFzcyBpbnNlcnRfaXRlcmF0b3I8X19nbnVfY3h4OjpoYXNoX211bHRpbWFwPF9LZXksIF9UcCwgX0hhc2hGbiwKKwkJCQkJCSAgIF9FcUtleSwgX0FsbG9jPiA+CisgICAgeworICAgIHByb3RlY3RlZDoKKyAgICAgIHR5cGVkZWYgX19nbnVfY3h4OjpoYXNoX211bHRpbWFwPF9LZXksIF9UcCwgX0hhc2hGbiwgX0VxS2V5LCBfQWxsb2M+CisgICAgICAgIF9Db250YWluZXI7CisgICAgICBfQ29udGFpbmVyKiBjb250YWluZXI7CisgICAgICB0eXBlbmFtZSBfQ29udGFpbmVyOjppdGVyYXRvciBpdGVyOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfQ29udGFpbmVyICAgICAgICAgIGNvbnRhaW5lcl90eXBlOworICAgICAgdHlwZWRlZiBvdXRwdXRfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194KQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yKF9Db250YWluZXImIF9feCwgdHlwZW5hbWUgX0NvbnRhaW5lcjo6aXRlcmF0b3IpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgdHlwZW5hbWUgX0NvbnRhaW5lcjo6dmFsdWVfdHlwZSYgX192YWx1ZSkKKyAgICAgIHsKKwljb250YWluZXItPmluc2VydChfX3ZhbHVlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKigpCisgICAgICB7IHJldHVybi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iwgX0lucHV0SXRlcmF0b3IgX19sKQorICAgICAgICB7IF9NX2h0Lmluc2VydF91bmlxdWUoX19mLCBfX2wpOyB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGJvb2w+CisgICAgICBpbnNlcnRfbm9yZXNpemUoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7CisJcGFpcjx0eXBlbmFtZSBfSHQ6Oml0ZXJhdG9yLCBib29sPiBfX3AKKwkgID0gX01faHQuaW5zZXJ0X3VuaXF1ZV9ub3Jlc2l6ZShfX29iaik7CisJcmV0dXJuIHBhaXI8aXRlcmF0b3IsIGJvb2w+KF9fcC5maXJzdCwgX19wLnNlY29uZCk7CisgICAgICB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBmaW5kKGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmZpbmQoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuY291bnQoX19rZXkpOyB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZXJhc2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KQorICAgICAge3JldHVybiBfTV9odC5lcmFzZShfX2tleSk7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19pdCkKKyAgICAgIHsgX01faHQuZXJhc2UoX19pdCk7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19mLCBpdGVyYXRvciBfX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X01faHQuYmVnaW4oKTsgfQorICAgICAgCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVuZCgpOyB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7IHJldHVybiBfTV9odC5pbnNlcnRfZXF1YWwoX19vYmopOyB9CisgIAorICAgICAgdGVtcGxhdGU8Y2xhc3MgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIHZvaWQKKyAgICAgICAgaW5zZXJ0KF9JbnB1dEl0ZXJhdG9yIF9fZiwgX0lucHV0SXRlcmF0b3IgX19sKQorICAgICAgICB7IF9NX2h0Lmluc2VydF9lcXVhbChfX2YsX19sKTsgfQorICAKKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnRfbm9yZXNpemUoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7IHJldHVybiBfTV9odC5pbnNlcnRfZXF1YWxfbm9yZXNpemUoX19vYmopOyB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBmaW5kKGNvbnN0IGtleV90eXBlJiBfX2tleSkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmZpbmQoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuY291bnQoX19rZXkpOyB9CisKKyAgICAgIHBhaXI8aXRlcmF0b3IsIGl0ZXJhdG9yPgorICAgICAgZXF1YWxfcmFuZ2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KSBjb25zdAorICAgICAgeyByZXR1cm4gX01faHQuZXF1YWxfcmFuZ2UoX19rZXkpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgZXJhc2UoY29uc3Qga2V5X3R5cGUmIF9fa2V5KQorICAgICAgeyByZXR1cm4gX01faHQuZXJhc2UoX19rZXkpOyB9CisgIAorICAgICAgdm9pZAorICAgICAgZXJhc2UoaXRlcmF0b3IgX19pdCkKKyAgICAgIHsgX01faHQuZXJhc2UoX19pdCk7IH0KKyAgCisgICAgICB2b2lkCisgICAgICBlcmFzZShpdGVyYXRvciBfX2YsIGl0ZXJhdG9yIF9fbCkKKyAgICAgIHsgX01faHQuZXJhc2UoX19mLCBfX2wpOyB9CisgIAorICAgICAgdm9pZAorICAgICAgY2xlYXIoKQorICAgICAgeyBfTV9odC5jbGVhcigpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19oaW50KQorICAgICAgeyBfTV9odC5yZXNpemUoX19oaW50KTsgfQorICAKKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0X2NvdW50KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmJ1Y2tldF9jb3VudCgpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X2J1Y2tldF9jb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9odC5tYXhfYnVja2V0X2NvdW50KCk7IH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBlbGVtc19pbl9idWNrZXQoc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2h0LmVsZW1zX2luX2J1Y2tldChfX24pOyB9CisgICAgfTsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVmFsLCBjbGFzcyBfSGFzaEZjbiwgY2xhc3MgX0VxdWFsS2V5LCBjbGFzcyBfQWxsb2M+CisgICAgaW5saW5lIGJvb2wKKyAgICBvcGVyYXRvcj09KGNvbnN0IGhhc2hfbXVsdGlzZXQ8X1ZhbCwgX0hhc2hGY24sIF9FcXVhbEtleSwgX0FsbG9jPiYgX19oczEsCisJICAgICAgIGNvbnN0IGhhc2hfbXVsdGlzZXQ8X1ZhbCwgX0hhc2hGY24sI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NoX211bHRpc2V0LgorICB0ZW1wbGF0ZTxjbGFzcyBfVmFsdWUsIGNsYXNzIF9IYXNoRmNuLCBjbGFzcyBfRXF1YWxLZXksIGNsYXNzIF9BbGxvYz4KKyAgICBjbGFzcyBpbnNlcnRfaXRlcmF0b3I8X19nbnVfY3h4OjpoYXNoX3NldDxfVmFsdWUsIF9IYXNoRmNuLAorCQkJCQkgICAgICBfRXF1YWxLZXksIF9BbGxvYz4gPgorICAgIHsKKyAgICBwcm90ZWN0ZWQ6CisgICAgICB0eXBlZGVmIF9fZ251X2N4eDo6aGFzaF9zZXQ8X1ZhbHVlLCBfSGFzaEZjbiwgX0VxdWFsS2V5LCBfQWxsb2M+CisgICAgICAgIF9Db250YWluZXI7CisgICAgICBfQ29udGFpbmVyKiBjb250YWluZXI7CisKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9Db250YWluZXIgICAgICAgICAgY29udGFpbmVyX3R5cGU7CisgICAgICB0eXBlZGVmIG91dHB1dF9pdGVyYXRvcl90YWcgaXRlcmF0b3JfY2F0ZWdvcnk7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgdm9pZCAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgdm9pZCAgICAgICAgICAgICAgICByZWZlcmVuY2U7CisKKyAgICAgIGluc2VydF9pdGVyYXRvcihfQ29udGFpbmVyJiBfX3gpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorICAgICAgCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194LCB0eXBlbmFtZSBfQ29udGFpbmVyOjppdGVyYXRvcikKKyAgICAgIDogY29udGFpbmVyKCZfX3gpIHt9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGF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BlOworICAgICAgdHlwZWRlZiBvdXRwdXRfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194KQorICAgICAgOiBjb250YWluZXIoJl9feCkge30KKyAgICAgIAorICAgICAgaW5zZXJ0X2l0ZXJhdG9yKF9Db250YWluZXImIF9feCwgdHlwZW5hbWUgX0NvbnRhaW5lcjo6aXRlcmF0b3IpCisgICAgICA6IGNvbnRhaW5lcigmX194KSB7fQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgdHlwZW5hbWUgX0NvbnRhaW5lcjo6dmFsdWVfdHlwZSYgX192YWx1ZSkKKyAgICAgIHsKKwljb250YWluZXItPmluc2VydChfX3ZhbHVlKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKigpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorCisgICAgICBpbnNlcnRfaXRlcmF0b3I8X0NvbnRhaW5lcj4mCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsgcmV0dXJuICp0aGlzOyB9CisKKyAgICAgIGluc2VydF9pdGVyYXRvcjxfQ29udGFpbmVyPiYKKyAgICAgIG9wZXJhdG9yKysoaW50KSB7IHJldHVybiAqdGhpczsgfQorICAgIH07CisKK19HTElCQ1hYX0VORF9O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RocmVhZHMpLAorICAgICAgX01fZnJlZWxpc3RfaGVhZHJvb20oX19oZWFkcm9vbSksIF9NX2ZvcmNlX25ldyhfX2ZvcmNlKQorICAgICAgeyB9CisgICAgfTsKKyAgICAKKyAgICBzdHJ1Y3QgX0Jsb2NrX2FkZHJlc3MKKyAgICB7CisgICAgICB2b2lkKiAJCQlfTV9pbml0aWFsOworICAgICAgX0Jsb2NrX2FkZHJlc3MqIAkJX01fbmV4dDsKKyAgICB9OworICAgIAorICAgIGNvbnN0IF9UdW5lJgorICAgIF9NX2dldF9vcHRpb25zKCkgY29uc3QKKyAgICB7IHJldHVybiBfTV9vcHRpb25zOyB9CisKKyAgICB2b2lkCisgICAgX01fc2V0X29wdGlvbnMoX1R1bmUgX190KQorICAgIHsgCisgICAgICBpZiAoIV9NX2luaXQpCisJX01fb3B0aW9ucyA9IF9fdDsKKyAgICB9CisKKyAgICBib29sCisgICAgX01fY2hlY2tfdGhyZXNob2xkKHNpemVfdCBfX2J5dGVzKQorICAgIHsgcmV0dXJuIF9fYnl0ZXMgPiBfTV9vcHRpb25zLl9NX21heF9ieXRlcyB8fCBfTV9vcHRpb25zLl9NX2ZvcmNlX25ldzsgfQorCisgICAgc2l6ZV90CisgICAgX01fZ2V0X2Jpbm1hcChzaXplX3QgX19ieXRlcykKKyAgICB7IHJldHVybiBfTV9iaW5tYXBbX19ieXRlc107IH0KKworICAgIHNpemVfdAorICAgIF9NX2dldF9hbGlnbigpCisgICAgeyByZXR1cm4gX01fb3B0aW9ucy5fTV9hbGlnbjsgfQorCisgICAgZXhwbGljaXQgCisgICAgX19wb29sX2Jhc2UoKSAKKyAgICA6IF9NX29wdGlvbnMoX1R1bmUoKSksIF9NX2Jpbm1hcCgwKSwgX01faW5pdChmYWxzZSkgeyB9CisKKyAgICBleHBsaWNpdCAKKyAgICBfX3Bvb2xfYmFzZShjb25zdCBfVHVuZSYgX19vcHRpb25zKQorICAgIDogX01fb3B0aW9ucyhfX29wdGlvbnMpLCBfTV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RzIHRvIHRoZSBibG9ja19yZWNvcmQgb2YgdGhlIG5leHQgZnJlZSBibG9jay4KKwlfQmxvY2tfcmVjb3JkKiAJCQlfTV9uZXh0OworICAgICAgfTsKKworICAgICAgc3RydWN0IF9CaW5fcmVjb3JkCisgICAgICB7CisJLy8gQW4gImFycmF5IiBvZiBwb2ludGVycyB0byB0aGUgZmlyc3QgZnJlZSBibG9jay4KKwlfQmxvY2tfcmVjb3JkKioJCQlfTV9maXJzdDsKKworCS8vIEEgbGlzdCBvZiB0aGUgaW5pdGlhbCBhZGRyZXNzZXMgb2YgYWxsIGFsbG9jYXRlZCBibG9ja3MuCisJX0Jsb2NrX2FkZHJlc3MqCQkgICAgIAlfTV9hZGRyZXNzOworICAgICAgfTsKKyAgICAgIAorICAgICAgdm9pZAorICAgICAgX01faW5pdGlhbGl6ZV9vbmNlKCkKKyAgICAgIHsKKwlpZiAoX19idWlsdGluX2V4cGVjdChfTV9pbml0ID09IGZhbHNlLCBmYWxzZSkpCisJICBfTV9pbml0aWFsaXplKCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2Rlc3Ryb3koKSB0aHJvdygpOworCisgICAgICBjaGFyKiAKKyAgICAgIF9NX3Jlc2VydmVfYmxvY2soc2l6ZV90IF9fYnl0ZXMsIGNvbnN0IHNpemVfdCBfX3RocmVhZF9pZCk7CisgICAgCisgICAgICB2b2lkCisgICAgICBfTV9yZWNsYWltX2Jsb2NrKGNoYXIqIF9fcCwgc2l6ZV90IF9fYnl0ZXMpIHRocm93ICgpOworICAgIAorICAgICAgc2l6ZV90IAorICAgICAgX01fZ2V0X3RocmVhZF9pZCgpIHsgcmV0dXJuIDA7IH0KKyAgICAgIAorICAgICAgY29uc3QgX0Jpbl9yZWNvcmQmCisgICAgICBfTV9nZXRfYmluKHNpemVfdCBfX3doaWNoKQorICAgICAgeyByZXR1cm4gX01fYmluW19fd2hpY2hdOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIF9NX2FkanVzdF9mcmVlbGlzdChjb25zdCBfQmluX3JlY29yZCYsIF9CbG9ja19yZWNvcmQqLCBzaXplX3QpCisgICAgICB7IH0KKworICAgICAgZXhwbGljaXQgX19wb29sKCkgCisgICAgICA6IF9NX2JpbigwKSwgX01fYmluX3NpemUoMSkgeyB9CisKKyAgICAgIGV4cGxpY2l0IF9fcG9vbChjb25zdCBfX3Bvb2xfYmFzZTo6X1R1bmUmIF9fdHVuZSkgCisgICAgICA6IF9fcG9vbF9iYXNlKF9fdHVuZSksIF9NX2JpbigwKSwgX01fYmluX3NpemUoMSkgeyB9CisKKyAgICBwcml2YXRlOgorICAgICAgLy8gQW4gImFycmF5IiBvZiBiaW5fcmVjb3JkcyBlYWNoIG9mIHdoaWNoIHJlcHJlc2VudHMgYSBzcGVjaWZpYworICAgICAgLy8gcG93ZXIgb2YgMiBzaXplLiBNZW1vcnkgdG8gdGhpcyAiYXJyYXkiIGlzIGFsbG9jYXRlZCBpbgorICAgICAgLy8gX01faW5pdGlhbGl6ZSgpLgorICAgICAgX0Jpbl9yZWNvcmQqCQkgX01fYmluOworICAgICAgCisgICAgICAvLyBBY3R1YWwgdmFsdWUgY2FsY3VsYXRlZCBpbiBfTV9pbml0aWFsaXplKCkuCisgICAgICBzaXplX3QgCSAgICAgICAJICAgICAJX01fYmluX3NpemU7ICAgICAKKworICAgICAgdm9pZAorICAgICAgX01faW5pdGlhbGl6ZSgpOworICB9OworIAorI2lmZGVmIF9fR1RIUkVBRFMKKyAgLy8vIFNwZWNpYWxpemF0aW9uIGZvciB0aHJlYWQgZW5hYmxlZCwgdmlhIGd0aHJlYWRzLmguCisgIHRlbXBsYXRlPD4KKyAgICBjbGFzcyBfX3Bvb2w8dHJ1ZT4gOiBwdWJsaWMgX19wb29sX2Jhc2UKKyAgICB7CisgICAgcHVibGljOgorICAgICAgLy8gRWFjaCByZXF1ZXN0aW5nIHRocmVhZCBpcyBhc3NpZ25lZCBhbiBpZCByYW5naW5nIGZyb20gMS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gICAgIF9NX3Jlc2VydmVfYmxvY2soc2l6ZV90IF9fYnl0ZXMsIGNvbnN0IHNpemVfdCBfX3RocmVhZF9pZCk7CisgICAgCisgICAgICB2b2lkCisgICAgICBfTV9yZWNsYWltX2Jsb2NrKGNoYXIqIF9fcCwgc2l6ZV90IF9fYnl0ZXMpIHRocm93ICgpOworICAgIAorICAgICAgY29uc3QgX0Jpbl9yZWNvcmQmCisgICAgICBfTV9nZXRfYmluKHNpemVfdCBfX3doaWNoKQorICAgICAgeyByZXR1cm4gX01fYmluW19fd2hpY2hdOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIF9NX2FkanVzdF9mcmVlbGlzdChjb25zdCBfQmluX3JlY29yZCYgX19iaW4sIF9CbG9ja19yZWNvcmQqIF9fYmxvY2ssIAorCQkJIHNpemVfdCBfX3RocmVhZF9pZCkKKyAgICAgIHsKKwlpZiAoX19ndGhyZWFkX2FjdGl2ZV9wKCkpCisJICB7CisJICAgIF9fYmxvY2stPl9NX3RocmVhZF9pZCA9IF9fdGhyZWFkX2lkOworCSAgICAtLV9fYmluLl9NX2ZyZWVbX190aHJlYWRfaWRdOworCSAgICArK19fYmluLl9NX3VzZWRbX190aHJlYWRfaWRdOworCSAgfQorICAgICAgfQorCisgICAgICAvLyBYWFggR0xJQkNYWF9BQkkgRGVwcmVjYXRlZAorICAgICAgX0dMSUJDWFhfQ09OU1Qgdm9pZCAKKyAgICAgIF9NX2Rlc3Ryb3lfdGhyZWFkX2tleSh2b2lkKikgdGhyb3cgKCk7CisKKyAgICAgIHNpemVfdCAKKyAgICAgIF9NX2dldF90aHJlYWRfaWQoKTsKKworICAgICAgZXhwbGljaXQgX19wb29sKCkgCisgICAgICA6IF9NX2JpbigwKSwgX01fYmluX3NpemUoMSksIF9NX3RocmVhZF9mcmVlbGlzdCgwKSAKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdCBfX3Bvb2woY29uc3QgX19wb29sX2Jhc2U6Ol9UdW5lJiBfX3R1bmUpIAorICAgICAgOiBfX3Bvb2xfYmFzZShfX3R1bmUpLCBfTV9iaW4oMCksIF9NX2Jpbl9zaXplKDEpLCAKKwlfTV90aHJlYWRfZnJlZWxpc3QoMCkgCisgICAgICB7IH0KKworICAgIHByaXZhdGU6CisgICAgICAvLyBBbiAiYXJyYXkiIG9mIGJpbl9yZWNvcmRzIGVhY2ggb2Ygd2hpY2ggcmVwcmVzZW50cyBhIHNwZWNpZmljCisgICAgICAvLyBwb3dlciBvZiAyIHNpemUuIE1lbW9yeSB0byB0aGlzICJhcnJheSIgaXMgYWxsb2NhdGVkIGluCisgICAgICAvLyBfTV9pbml0aWFsaXplKCkuCisgICAgICBfQmluX3JlY29yZCoJCV9NX2JpbjsKKworICAgICAgLy8gQWN0dWFsIHZhbHVlIGNhbGN1bGF0ZWQgaW4gX01faW5pdGlhbGl6ZSgpLgorICAgICAgc2l6ZV90IAkgICAgICAgCSAgICAgCV9NX2Jpbl9zaXplOworCisgICAgICBfVGhyZWFkX3JlY29yZCogCQlfTV90aHJlYWRfZnJlZWxpc3Q7CisgICAgICB2b2lkKgkJCV9NX3RocmVhZF9mcmVlbGlzdF9pbml0aWFsOworCisgICAgICB2b2lkCisgICAgICBfTV9pbml0aWFsaXplKCk7CisgICAgfTsKKyNlbmRpZgorCisgIHRlbXBsYXRlPHRlbXBsYXRlIDxib29sPiBjbGFzcyBfUG9vbFRwLCBib29sIF9UaHJlYWQ+CisgICAgc3RydWN0IF9fY29tbW9uX3Bvb2wKKyAgICB7CisgICAgICB0eXBlZGVmIF9Qb29sVHA8X1RocmVhZD4gCQlwb29sX3R5cGU7CisgICAgICAKKyAgICAgIHN0YXRpYyBwb29sX3R5cGUmCisgICAgICBfU19nZXRfcG9vbCgpCisgICAgICB7IAorCXN0YXRpYyBwb29sX3R5cGUgX1NfcG9vbDsKKwlyZXR1cm4gX1NfcG9vbDsKKyAgICAgIH0KKyAgICB9OworCisgIHRlbXBsYXRlPHRlbXBsYXRlIDxib29sPiB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lcGVuZGVudCBtZW1iZXIgZnVuY3Rpb25zLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY2xhc3MgX19tdF9hbGxvY19iYXNlIAorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIHNpemVfdCAgICAgICAgICAgICAgICAgICAgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgX1RwKiAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqICAgICAgICAgICAgICAgIGNvbnN0X3BvaW50ZXI7CisgICAgICB0eXBlZGVmIF9UcCYgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAmICAgICAgICAgICAgICAgIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworCisgICAgICBwb2ludGVyCisgICAgICBhZGRyZXNzKHJlZmVyZW5jZSBfX3gpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKF9feCk7IH0KKworICAgICAgY29uc3RfcG9pbnRlcgorICAgICAgYWRkcmVzcyhjb25zdF9yZWZlcmVuY2UgX194KSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gc3RkOjpfX2FkZHJlc3NvZihfX3gpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdCBfR0xJQkNYWF9VU0VfTk9FWENFUFQgCisgICAgICB7IHJldHVybiBzaXplX3QoLTEpIC8gc2l6ZW9mKF9UcCk7IH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwW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YWQgcGx1cyBhIEBhIGdsb2JhbCBvbmUuIFN0ZXBzIGFyZSB0YWtlbiB0byBsaW1pdAorICAgKiAgdGhlIHBlciB0aHJlYWQgZnJlZWxpc3Qgc2l6ZXMgKGJ5IHJldHVybmluZyBleGNlc3MgYmFjayB0bworICAgKiAgdGhlIEBhIGdsb2JhbCBsaXN0KS4KKyAgICogIEBpbmdyb3VwIGFsbG9jYXRvcnMKKyAgICoKKyAgICogIEZ1cnRoZXIgZGV0YWlsczoKKyAgICogIGh0dHA6Ly9nY2MuZ251Lm9yZy9vbmxpbmVkb2NzL2xpYnN0ZGMrKy9tYW51YWwvYmswMXB0MTJjaDMyLmh0bWwKKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgCisJICAgdHlwZW5hbWUgX1Bvb2xwID0gX19jb21tb25fcG9vbF9wb2xpY3k8X19wb29sLCBfX3RocmVhZF9kZWZhdWx0PiA+CisgICAgY2xhc3MgX19tdF9hbGxvYyA6IHB1YmxpYyBfX210X2FsbG9jX2Jhc2U8X1RwPgorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIHNpemVfdCAgICAgICAgICAgICAgICAgICAgCXNpemVfdHlwZTsKKyAgICAgIHR5cGVkZWYgcHRyZGlmZl90ICAgICAgICAgICAgICAgICAJZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiBfVHAqICAgICAgICAgICAgICAgICAgICAgIAlwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCBfVHAqICAgICAgICAgICAgICAgIAljb25zdF9wb2ludGVyOworICAgICAgdHlwZWRlZiBfVHAmICAgICAgICAgICAgICAgICAgICAgIAlyZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIGNvbnN0IF9UcCYgICAgICAgICAgICAgICAgCWNvbnN0X3JlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICAJdmFsdWVfdHlwZTsKKyAgICAgIHR5cG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gZm9yIGV4dGVybmFsIGNvbnN1bXB0aW9uLgorCXJldHVybiBfX3BvbGljeV90eXBlOjpfU19nZXRfcG9vbCgpLl9NX2dldF9vcHRpb25zKCk7CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIF9NX3NldF9vcHRpb25zKF9fcG9vbF9iYXNlOjpfVHVuZSBfX3QpCisgICAgICB7IF9fcG9saWN5X3R5cGU6Ol9TX2dldF9wb29sKCkuX01fc2V0X29wdGlvbnMoX190KTsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfUG9vbHA+CisgICAgdHlwZW5hbWUgX19tdF9hbGxvYzxfVHAsIF9Qb29scD46OnBvaW50ZXIKKyAgICBfX210X2FsbG9jPF9UcCwgX1Bvb2xwPjo6CisgICAgYWxsb2NhdGUoc2l6ZV90eXBlIF9fbiwgY29uc3Qgdm9pZCopCisgICAgeworICAgICAgaWYgKF9fbiA+IHRoaXMtPm1heF9zaXplKCkpCisJc3RkOjpfX3Rocm93X2JhZF9hbGxvYygpOworCisgICAgICBfX3BvbGljeV90eXBlOjpfU19pbml0aWFsaXplX29uY2UoKTsKKworICAgICAgLy8gUmVxdWVzdHMgbGFyZ2VyIHRoYW4gX01fbWF4X2J5dGVzIGFyZSBoYW5kbGVkIGJ5IG9wZXJhdG9yCisgICAgICAvLyBuZXcvZGVsZXRlIGRpcmVjdGx5LgorICAgICAgX19wb29sX3R5cGUmIF9fcG9vbCA9IF9fcG9saWN5X3R5cGU6Ol9TX2dldF9wb29sKCk7CisgICAgICBjb25zdCBzaXplX3QgX19ieXRlcyA9IF9fbiAqIHNpemVvZihfVHApOworICAgICAgaWYgKF9fcG9vbC5fTV9jaGVja190aHJlc2hvbGQoX19ieXRlcykpCisJeworCSAgdm9pZCogX19yZXQgPSA6Om9wZXJhdG9yIG5ldyhfX2J5dGVzKTsKKwkgIHJldHVybiBzdGF0aWNfY2FzdDxfVHAqPihfX3JldCk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hdG9yOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSB0cmFpdHNfdHlwZTo6bm9kZV9pdGVyYXRvciAJbm9kZV9pdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgdHJhaXRzX3R5cGU6Om5vZGVfdXBkYXRlIAlub2RlX3VwZGF0ZTsKKworICAgICAgdHlwZWRlZiBDbXBfRm4gCQkJCQljbXBfZm47CisgICAgICB0eXBlZGVmIF9BbGxvYyAJCQkJCWFsbG9jYXRvcl90eXBlOworCisgICAgICBQQl9EU19CSU5fVFJFRV9OQU1FKCk7CisKKyAgICAgIFBCX0RTX0JJTl9UUkVFX05BTUUoY29uc3QgQ21wX0ZuJik7CisKKyAgICAgIFBCX0RTX0JJTl9UUkVFX05BTUUoY29uc3QgQ21wX0ZuJiwgY29uc3Qgbm9kZV91cGRhdGUmKTsKKworICAgICAgUEJfRFNfQklOX1RSRUVfTkFNRShjb25zdCBQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIH5QQl9EU19CSU5fVFJFRV9OQU1FKCk7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBlbXB0eSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBzaXplKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSBzaXplX3R5cGUKKyAgICAgIG1heF9zaXplKCkgY29uc3Q7CisKKyAgICAgIENtcF9GbiYKKyAgICAgIGdldF9jbXBfZm4oKTsKKworICAgICAgY29uc3QgQ21wX0ZuJgorICAgICAgZ2V0X2NtcF9mbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgcG9pbnRfaXRlcmF0b3IKKyAgICAgIGxvd2VyX2JvdW5kKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgcG9pbnRfY29uc3RfaXRlcmF0b3IKKyAgICAgIGxvd2VyX2JvdW5kKGtleV9jb25zdF9yZWZlcmVuY2UpIGNvbnN0OworCisgICAgICBpbmxpbmUgcG9pbnRfaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgcG9pbnRfY29uc3RfaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGtleV9jb25zdF9yZWZlcmVuY2UpIGNvbnN0OworCisgICAgICBpbmxpbmUgcG9pbnRfaXRlcmF0b3IKKyAgICAgIGZpbmQoa2V5X2NvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIGlubGluZSBwb2ludF9jb25zdF9pdGVyYXRvcgorICAgICAgZmluZChrZXlfY29uc3RfcmVmZXJlbmNlKSBjb25zdDsKKworICAgICAgaW5saW5lIGl0ZXJhdG9yCisgICAgICBiZWdpbigpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgZW5kKCk7CisKKyAgICAgIGlubGluZSBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IKKyAgICAgIHJiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpOworCisgICAgICBpbmxpbmUgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJucyBhIGNvbnN0IG5vZGVfaXRlcmF0b3IgY29ycmVzcG9uZGluZyB0byB0aGUgbm9kZSBhdCB0aGUKKyAgICAgIC8vLyByb290IG9mIHRoZSB0cmVlLgorICAgICAgaW5saW5lIG5v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2ludGVyCisgICAgICBnZXRfbmV3X25vZGVfZm9yX2xlYWZfaW5zZXJ0KGNvbnN0X3JlZmVyZW5jZSwgZmFsc2VfdHlwZSk7CisKKyAgICAgIGlubGluZSBub2RlX3BvaW50ZXIKKyAgICAgIGdldF9uZXdfbm9kZV9mb3JfbGVhZl9pbnNlcnQoY29uc3RfcmVmZXJlbmNlLCB0cnVlX3R5cGUpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgYWN0dWFsX2VyYXNlX25vZGUobm9kZV9wb2ludGVyKTsKKworICAgICAgaW5saW5lIHN0ZDo6cGFpcjxub2RlX3BvaW50ZXIsIGJvb2w+CisgICAgICBlcmFzZShub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgdXBkYXRlX21pbl9tYXhfZm9yX2VyYXNlZF9ub2RlKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIHN0YXRpYyB2b2lkCisgICAgICBjbGVhcl9pbXAobm9kZV9wb2ludGVyKTsKKworICAgICAgaW5saW5lIHN0ZDo6cGFpcjxwb2ludF9pdGVyYXRvciwgYm9vbD4KKyAgICAgIGluc2VydF9sZWFmKGNvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICByb3RhdGVfbGVmdChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgcm90YXRlX3JpZ2h0KG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICByb3RhdGVfcGFyZW50KG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBhcHBseV91cGRhdGUobm9kZV9wb2ludGVyLCBudWxsX25vZGVfdXBkYXRlX3BvaW50ZXIpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBOb2RlX1VwZGF0ZV8+CisJaW5saW5lIHZvaWQKKwlhcHBseV91cGRhdGUobm9kZV9wb2ludGVyLCBOb2RlX1VwZGF0ZV8qKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIHVwZGF0ZV90b190b3Aobm9kZV9wb2ludGVyLCBudWxsX25vZGVfdXBkYXRlX3BvaW50ZXIpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBOb2RlX1VwZGF0ZV8+CisJaW5saW5lIHZvaWQKKwl1cGRhdGVfdG9fdG9wKG5vZGVfcG9pbnRlciwgTm9kZV9VcGRhdGVfKik7CisKKyAgICAgIGJvb2wKKyAgICAgIGpvaW5fcHJlcChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBqb2luX2ZpbmlzaChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICBib29sCisgICAgICBzcGxpdF9wcmVwKGtleV9jb25zdF9yZWZlcmVuY2UsIFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIHZvaWQKKyAgICAgIHNwbGl0X2ZpbmlzaChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICBzaXplX3R5cGUKKyAgICAgIHJlY3Vyc2l2ZV9jb3VudChub2RlX3BvaW50ZXIpIGNvbnN0OworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgc3RydWN0dXJlX29ubHlfYXNzZXJ0X3ZhbGlkKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbm9kZV9jb25zaXN0ZW50KGNvbnN0IG5vZGVfcG9pbnRlciwgY29uc3QgY2hhciosIGludCkgY29uc3Q7CisjZW5kaWYKKworICAgIHByaXZhdGU6CisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9pdGVyYXRvcnMoY29uc3QgY2hhciosIGludCkgY29uc3Q7CisKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9jb25zaXN0ZW50X3dpdGhfZGVidWdfYmFzZShjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X25vZGVfY29uc2lzdGVudF93aXRoX2xlZnQoY29uc3Qgbm9kZV9wb2ludGVyLAorCQkJCSAgICAgICBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X25vZGVfY29uc2lzdGVudF93aXRoX3JpZ2h0KGNvbnN0IG5vZGVfcG9pbnRlciwKKwkJCQkJY29uc3QgY2hhciosIGludCkgY29uc3Q7CisKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9jb25zaXN0ZW50X3dpdGhfZGVidWdfYmFzZShjb25zdCBub2RlX3BvaW50ZXIsCisJCQkJCWNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbWluKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbWluX2ltcChjb25zdCBub2RlX3BvaW50ZXIsIGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbWF4KGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbWF4X2ltcChjb25zdCBub2RlX3BvaW50ZXIsIGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfc2l6ZShjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdHlwZWRlZiBzdGQ6OnBhaXI8Y29uc3RfcG9pbnRlciwgY29uc3RfcG9pbnRlcj4gbm9kZV9jb25zaXN0ZW50X3Q7CisKKyAgICAgIG5vZGVfY29uc2lzdGVudF90CisgICAgICBhc3NlcnRfbm9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SRUVfQ09OU1RfT0RJUl9JVF9DX0RFQyYgb3RoZXIpIAorICAgICAgOiBtX3BfbmQob3RoZXIubV9wX25kKQorICAgICAgeyB9CisKKyAgICAgIGlubGluZQorICAgICAgUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyYgCisgICAgICBvcGVyYXRvcj0oY29uc3QgUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyYgb3RoZXIpCisgICAgICB7CisJbV9wX25kID0gb3RoZXIubV9wX25kOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgaW5saW5lCisgICAgICBQQl9EU19UUkVFX0NPTlNUX0lUX0NfREVDJiAKKyAgICAgIG9wZXJhdG9yPShjb25zdCBQQl9EU19UUkVFX0NPTlNUX09ESVJfSVRfQ19ERUMmIG90aGVyKQorICAgICAgeworCW1fcF9uZCA9IG90aGVyLm1fcF9uZDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGlubGluZSBjb25zdF9wb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQobV9wX25kICE9IDApOworCXJldHVybiAmbV9wX25kLT5tX3ZhbHVlOworICAgICAgfQorCisgICAgICBpbmxpbmUgY29uc3RfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvciooKSBjb25zdAorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX0FTU0VSVChtX3BfbmQgIT0gMCk7CisJcmV0dXJuIG1fcF9uZC0+bV92YWx1ZTsKKyAgICAgIH0KKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyAmIG90aGVyKSBjb25zdAorICAgICAgeyByZXR1cm4gbV9wX25kID09IG90aGVyLm1fcF9uZDsgfQorCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgb3BlcmF0b3I9PShjb25zdCBQQl9EU19UUkVFX0NPTlNUX09ESVJfSVRfQ19ERUMgJiBvdGhlcikgY29uc3QKKyAgICAgIHsgcmV0dXJuIG1fcF9uZCA9PSBvdGhlci5tX3BfbmQ7IH0KKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyYgb3RoZXIpIGNvbnN0CisgICAgICB7IHJldHVybiBtX3BfbmQgIT0gb3RoZXIubV9wX25kOyB9CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IFBCX0RTX1RSRUVfQ09OU1RfT0RJUl9JVF9DX0RFQyYgb3RoZXIpIGNvbnN0CisgICAgICB7IHJldHVybiBtX3BfbmQgIT0gb3RoZXIubV9wX25kOyB9CisKKyAgICAgIGlubGluZSBQQl9EU19UUkVFX0NPTlNUX0lUX0NfREVDJiAKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX0FTU0VSVChtX3BfbmQgIT0gMCk7CisJaW5jKGludGVncmFsX2NvbnN0YW50PGludCxJc19Gb3J3YXJkX0l0ZXJhdG9yPigpKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGlubGluZSBQQl9EU19UUkVFX0NPTlNUX0lUX0NfREVDCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlQQl9EU19UUkVFX0NPTlNUX0lUX0NfREVDIHJldF9pdChtX3BfbmQpOworCW9wZXJhdG9yKysoKTsKKwlyZXR1cm4gcmV0X2l0OworICAgICAgfQorCisgICAgICBpbmxpbmUgUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyYgCisgICAgICBvcGVyYXRvci0tKCkKKyAgICAgIHsKKwlkZWMoaW50ZWdyYWxfY29uc3RhbnQ8aW50LElzX0ZvcndhcmRfSXRlcmF0b3I+KCkpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKwor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2FyZF9JdGVyYXRvciwKKwkgICAgIHR5cGVuYW1lIF9BbGxvYz4KKyAgICBjbGFzcyBiaW5fc2VhcmNoX3RyZWVfaXRfIDogcHVibGljIFBCX0RTX1RSRUVfQ09OU1RfSVRfQ19ERUMKKyAgICB7CisgICAgcHVibGljOgorICAgICAgaW5saW5lCisgICAgICBiaW5fc2VhcmNoX3RyZWVfaXRfKGNvbnN0IE5vZGVfUG9pbnRlciBwX25kID0gMCkgCisgICAgICA6IFBCX0RTX1RSRUVfQ09OU1RfSVRfQ19ERUMoKE5vZGVfUG9pbnRlcilwX25kKQorICAgICAgeyB9CisKKyAgICAgIGlubGluZQorICAgICAgYmluX3NlYXJjaF90cmVlX2l0Xyhjb25zdCBQQl9EU19UUkVFX09ESVJfSVRfQ19ERUMmIG90aGVyKSAKKyAgICAgIDogUEJfRFNfVFJFRV9DT05TVF9JVF9DX0RFQyhvdGhlci5tX3BfbmQpCisgICAgICB7IH0KKworICAgICAgaW5saW5lCisgICAgICBQQl9EU19UUkVFX0lUX0NfREVDJiAKKyAgICAgIG9wZXJhdG9yPShjb25zdCBQQl9EU19UUkVFX0lUX0NfREVDJiBvdGhlcikKKyAgICAgIHsKKwliYXNlX2l0X3R5cGU6Om1fcF9uZCA9IG90aGVyLm1fcF9uZDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGlubGluZQorICAgICAgUEJfRFNfVFJFRV9JVF9DX0RFQyYgCisgICAgICBvcGVyYXRvcj0oY29uc3QgUEJfRFNfVFJFRV9PRElSX0lUX0NfREVDJiBvdGhlcikKKyAgICAgIHsKKwliYXNlX2l0X3R5cGU6Om1fcF9uZCA9IG90aGVyLm1fcF9uZDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGlubGluZSB0eXBlbmFtZSBQQl9EU19UUkVFX0NPTlNUX0lUX0NfREVDOjpwb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsKKwlf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ZhbHVlLCBfQWxsb2M+CisgICAgICAJCQkJCQkJY29uc3RfaXRlcmF0b3I7CisKKyAgICAgIHR5cGVkZWYgY29uc3RfaXRlcmF0b3IgCQkJCWl0ZXJhdG9yOworCisKKyAgICAgIGJpbmFyeV9oZWFwKCk7CisKKyAgICAgIGJpbmFyeV9oZWFwKGNvbnN0IGNtcF9mbiYpOworCisgICAgICBiaW5hcnlfaGVhcChjb25zdCBiaW5hcnlfaGVhcCYpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKGJpbmFyeV9oZWFwJik7CisKKyAgICAgIH5iaW5hcnlfaGVhcCgpOworCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgZW1wdHkoKSBjb25zdDsKKworICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0OworCisgICAgICBDbXBfRm4mCisgICAgICBnZXRfY21wX2ZuKCk7CisKKyAgICAgIGNvbnN0IENtcF9GbiYKKyAgICAgIGdldF9jbXBfZm4oKSBjb25zdDsKKworICAgICAgaW5saW5lIHBvaW50X2l0ZXJhdG9yCisgICAgICBwdXNoKGNvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIHZvaWQKKyAgICAgIG1vZGlmeShwb2ludF9pdGVyYXRvciwgY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIGNvbnN0X3JlZmVyZW5jZQorICAgICAgdG9wKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBwb3AoKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGVyYXNlKHBvaW50X2l0ZXJhdG9yKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgUHJlZD4KKwlzaXplX3R5cGUKKwllcmFzZV9pZihQcmVkKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGVyYXNlX2F0KGVudHJ5X3BvaW50ZXIsIHNpemVfdHlwZSwgZmFsc2VfdHlwZSk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBlcmFzZV9hdChlbnRyeV9wb2ludGVyLCBzaXplX3R5cGUsIHRydWVfdHlwZSk7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGVuZCgpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBjbGVhcigpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorCXZvaWQKKwlzcGxpdChQcmVkLCBiaW5hcnlfaGVhcCYpOworCisgICAgICB2b2lkCisgICAgICBqb2luKGJpbmFyeV9oZWFwJik7CisKKyNpZmRlZiBQQl9EU19CSU5BUllfSEVBUF9UUkFDRV8KKyAgICAgIHZvaWQKKyAgICAgIHRyYWNlKCkgY29uc3Q7CisjZW5kaWYKKworICAgIHByb3RlY3RlZDoKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEl0PgorCXZvaWQKKwljb3B5X2Zyb21fcmFuZ2UoSXQsIEl0KTsKKworICAgIHByaXZhdGU6CisgICAgICB2b2lkCisgICAgICB2YWx1ZV9zd2FwKGJpbmFyeV9oZWFwJik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBpbnNlcnRfdmFsdWUoY29uc3RfcmVmZXJlbmNlLCBmYWxzZV90eXBlKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGluc2VydF92YWx1ZSh2YWx1ZV90eXBlLCB0cnVlX3R5cGUpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgcmVzaXplX2Zvcl9pbnNlcnRfaWZfbmVlZGVkKCk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBzd2FwX3ZhbHVlX2ltcChlbnRyeV9wb2ludGVyLCB2YWx1ZV90eXBlLCB0cnVlX3R5cGUpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgc3dhcF92YWx1ZV9pbXAoZW50cnlfcG9pbnRlciwgY29uc3RfcmVmZXJlbmNlLCBmYWxzZV90eXBlKTsKKworICAgICAgdm9pZAorICAgICAgZml4KGVudHJ5X3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgY29uc3RfcmVmZXJlbmNlCisgICAgICB0b3BfaW1wKHRydWVfdHlwZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBjb25zdF9yZWZlcmVuY2UKKyAgICAgIHRvcF9pbXAoZmFsc2VfdHlwZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBzdGF0aWMgc2l6ZV90eXBlCisgICAgICBsZWZ0X2NoaWxkKHNpemVfdHlwZSk7CisKKyAgICAgIGlubGluZSBzdGF0aWMgc2l6ZV90eXBlCisgICAgICByaWdodF9jaGlsZChzaXplX3R5cGUpOworCisgICAgICBpbmxpbmUgc3RhdGljIHNpemVfdHlwZQorICAgICAgcGFyZW50KHNpemVfdHlwZSk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICByZXNpemVfZm9yX2VyYXNlX2lmX25lZWRlZCgpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgc2l6ZV90eXBlCisgICAgICBwYXJ0aXRpb24oUHJlZCk7CisKKyAgICAgIHZvaWQKKyAgICAgIG1ha2VfaGVhcCgpCisgICAgICB7CisJY29uc3QgZW50cnlfY21wJiBtX2NtcCA9IHN0YXRpY19jYXN0PGVudHJ5X2NtcCY+KCp0aGlzKTsKKwllbnRyeV9wb2ludGVyIGVuZCA9IG1fYV9lbnRyaWVzICsgbV9zaXplOworCXN0ZDo6bWFrZV9oZWFwKG1fYV9lbnRyaWVzLCBlbmQsIG1fY21wKTsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQoaXNfaGVhcCgpKTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgcHVzaF9oZWFwKCkKKyAgICAgIHsKKwlpZiAoIWlzX2hlYXAoKSkKKwkgIG1ha2VfaGVhcCgpOworCWVsc2UKKwkgIHsKKwkgICAgY29uc3QgZW50cnlfY21wJiBtX2NtcCA9IHN0YXRpY19jYXN0PGVudHJ5X2NtcCY+KCp0aGlzKTsKKwkgICAgZW50cnlfcG9pbnRlciBlbmQgPSBtX2FfZW50cmllcyArIG1fc2l6ZTsKKwkgICAgc3RkOjpwdXNoX2hlYXAobV9hX2VudHJpZXMsIGVuZCwgbV9jbXApOworCSAgfQorICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBwb3BfaGVhcCgpCisgICAgICB7CisJY29uc3QgZW50cnlfY21wJiBtX2NtcCA9IHN0YXRpY19jYXN0PGVudHJ5X2NtcCY+KCp0aGlzKTsKKwllbnRyeV9wb2ludGVyIGVuZCA9IG1fYV9lbnRyaWVzICsgbV9zaXplOworCXN0ZDo6cG9wX2hlYXAobV9hX2VudHJpZXMsIGVuZCwgbV9jbXApOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBpc19oZWFwKCkKKyAgICAgIHsKKwljb25zdCBlbnRyeV9jbXAmIG1fY21wID0gc3RhdGljX2Nhc3Q8ZW50cnlfY21wJj4oKnRoaXMpOworCWVudHJ5X3BvaW50ZXIgZW5kID0gbV9hX2VudHJpZXMgKyBtX3NpemU7CisJYm9vbCBwID0gc3RkOjpfX2lzX2hlYXAobV9hX2VudHJpZXMsIGVuZCwgbV9jbXApOworCXJldHVybiBwOworICAgICAgfQorCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKyNlbmRpZgorCisjaWZkZWYgUEJfRFNfQklOQVJZX0hFQVBfVFJBQ0VfCisgICAgICB2b2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25hbWVzcGFjZSBfX2dudV9wYmRzCit7CisgIG5hbWVzcGFjZSBkZXRhaWwKKyAgeworICAgIC8vLyBSZXNpemUgcG9saWN5IGZvciBiaW5hcnkgaGVhcC4KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgY2xhc3MgcmVzaXplX3BvbGljeQorICAgIHsKKyAgICBwcml2YXRlOgorICAgICAgZW51bQorCXsKKwkgIHJhdGlvID0gOCwKKwkgIGZhY3RvciA9IDIKKwl9OworCisgICAgICAvLy8gTmV4dCBzaHJpbmsgc2l6ZS4KKyAgICAgIF9UcCAJCW1fc2hyaW5rX3NpemU7CisKKyAgICAgIC8vLyBOZXh0IGdyb3cgc2l6ZS4KKyAgICAgIF9UcCAJCW1fZ3Jvd19zaXplOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfVHAJc2l6ZV90eXBlOworCisgICAgICBzdGF0aWMgY29uc3QgX1RwCW1pbl9zaXplID0gMTY7CisKKyAgICAgIHJlc2l6ZV9wb2xpY3koKSA6IG1fc2hyaW5rX3NpemUoMCksIG1fZ3Jvd19zaXplKG1pbl9zaXplKQorICAgICAgeyBQQl9EU19BU1NFUlRfVkFMSUQoKCp0aGlzKSkgfQorCisgICAgICByZXNpemVfcG9saWN5KGNvbnN0IHJlc2l6ZV9wb2xpY3kmIG90aGVyKQorICAgICAgOiBtX3Nocmlua19zaXplKG90aGVyLm1fc2hyaW5rX3NpemUpLCBtX2dyb3dfc2l6ZShvdGhlci5tX2dyb3dfc2l6ZSkKKyAgICAgIHsgUEJfRFNfQVNTRVJUX1ZBTElEKCgqdGhpcykpIH0KKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIHN3YXAocmVzaXplX3BvbGljeTxfVHA+Jik7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICByZXNpemVfbmVlZGVkX2Zvcl9ncm93KHNpemVfdHlwZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICByZXNpemVfbmVlZGVkX2Zvcl9zaHJpbmsoc2l6ZV90eXBlKSBjb25zdDsKKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIGdyb3dfbmVlZGVkKHNpemVfdHlwZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBzaHJpbmtfbmVlZGVkKHNpemVfdHlwZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBzaXplX3R5cGUKKyAgICAgIGdldF9uZXdfc2l6ZV9mb3JfZ3JvdygpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBnZXRfbmV3X3NpemVfZm9yX3NocmluaygpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBnZXRfbmV3X3NpemVfZm9yX2FyYml0cmFyeShzaXplX3R5cGUpIGNvbnN0OworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgbm90aWZ5X2dyb3dfcmVzaXplKCk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBub3RpZnlfc2hyaW5rX3Jlc2l6ZSgpOworCisgICAgICB2b2lkCisgICAgICBub3RpZnlfYXJiaXRyYXJ5KHNpemVfdHlwZSk7CisKKyNpZmRlZiBfR0xJQkNYWF9ERUJVRworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X3ZhbGlkKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworI2VuZGlmCisKKyNpZmRlZiBQQl9EU19CSU5BUllfSEVBUF9UUkFDRV8KKyAgICAgIHZvaWQKKyAgICAgIHRyYWNlKCkgY29uc3Q7CisjZW5kaWYKKyAgICB9OworCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgY29uc3QgX1RwIHJlc2l6ZV9wb2xpY3k8X1RwPjo6bWluX3NpemU7CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHZvaWQKKyAgICByZXNpemVfcG9saWN5PF9UcD46OgorICAgIHN3YXAocm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ICBtX2FfZW50cmllcyA9IGFfZW50cmllczsKKyAgb3RoZXIubV9hX2VudHJpZXMgPSBhX290aGVyX2VudHJpZXM7CisKKyAgbWFrZV9oZWFwKCk7CisgIG90aGVyLm1ha2VfaGVhcCgpOworCisgIHJlc2l6ZV9wb2xpY3k6Om5vdGlmeV9hcmJpdHJhcnkobV9hY3R1YWxfc2l6ZSk7CisgIG90aGVyLm5vdGlmeV9hcmJpdHJhcnkob3RoZXIubV9hY3R1YWxfc2l6ZSk7CisKKyAgUEJfRFNfQVNTRVJUX1ZBTElEKCgqdGhpcykpCisgIFBCX0RTX0FTU0VSVF9WQUxJRChvdGhlcikKK30KKworUEJfRFNfQ0xBU1NfVF9ERUMKK2lubGluZSB2b2lkCitQQl9EU19DTEFTU19DX0RFQzo6Citqb2luKFBCX0RTX0NMQVNTX0NfREVDJiBvdGhlcikKK3sKKyAgUEJfRFNfQVNTRVJUX1ZBTElEKCgqdGhpcykpCisgIFBCX0RTX0FTU0VSVF9WQUxJRChvdGhlcikKKworICBjb25zdCBzaXplX3R5cGUgbGVuID0gbV9zaXplICsgb3RoZXIubV9zaXplOworICBjb25zdCBzaXplX3R5cGUgbmV3X3NpemUgPSByZXNpemVfcG9saWN5OjpnZXRfbmV3X3NpemVfZm9yX2FyYml0cmFyeShsZW4pOworCisgIGVudHJ5X3BvaW50ZXIgYV9lbnRyaWVzID0gMDsKKyAgZW50cnlfcG9pbnRlciBhX290aGVyX2VudHJpZXMgPSAwOworCisgIF9fdHJ5CisgICAgeworICAgICAgYV9lbnRyaWVzID0gc19lbnRyeV9hbGxvY2F0b3IuYWxsb2NhdGUobmV3X3NpemUpOworICAgICAgYV9vdGhlcl9lbnRyaWVzID0gc19lbnRyeV9hbGxvY2F0b3IuYWxsb2NhdGUocmVzaXplX3BvbGljeTo6bWluX3NpemUpOworICAgIH0KKyAgX19jYXRjaCguLi4pCisgICAgeworICAgICAgaWYgKGFfZW50cmllcyAhPSAwKQorCXNfZW50cnlfYWxsb2Nh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vbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIGlubGluZSBjb25zdF9yZWZlcmVuY2UKKyAgICAgIHRvcCgpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBwb3AoKTsKKworICAgICAgdm9pZAorICAgICAgZXJhc2UocG9pbnRfaXRlcmF0b3IpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgY2xlYXIoKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgUHJlZD4KKyAgICAgIHNpemVfdHlwZQorICAgICAgZXJhc2VfaWYoUHJlZCk7CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFByZWQ+CisgICAgICB2b2lkCisgICAgICBzcGxpdChQcmVkLCBQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBqb2luKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICBwcm90ZWN0ZWQ6CisKKyAgICAgIGJpbm9taWFsX2hlYXBfYmFzZSgpOworCisgICAgICBiaW5vbWlhbF9oZWFwX2Jhc2UoY29uc3QgQ21wX0ZuJik7CisKKyAgICAgIGJpbm9taWFsX2hlYXBfYmFzZShjb25zdCBQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIH5iaW5vbWlhbF9oZWFwX2Jhc2UoKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgSXQ+CisgICAgICB2b2lkCisgICAgICBjb3B5X2Zyb21fcmFuZ2UoSXQsIEl0KTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGZpbmRfbWF4KCk7CisKKyNpZmRlZiBfR0xJQkNYWF9ERUJVRworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X3ZhbGlkKGJvb2wsIGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfbWF4KGNvbnN0IGNoYX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JRF9DT05EKCgqdGhpcyksdHJ1ZSkKKyAgUEJfRFNfQVNTRVJUX1ZBTElEX0NPTkQob3RoZXIsdHJ1ZSkKK30KKworUEJfRFNfQ0xBU1NfVF9ERUMKK2lubGluZSB0eXBlbmFtZSBQQl9EU19DTEFTU19DX0RFQzo6bm9kZV9wb2ludGVyCitQQl9EU19DTEFTU19DX0RFQzo6Citqb2luKG5vZGVfcG9pbnRlciBwX2xocywgbm9kZV9wb2ludGVyIHBfcmhzKSBjb25zdAoreworICBub2RlX3BvaW50ZXIgcF9yZXQgPSAwOworICBub2RlX3BvaW50ZXIgcF9jdXIgPSAwOworCisgIHdoaWxlIChwX2xocyAhPSAwIHx8IHBfcmhzICE9IDApCisgICAgeworICAgICAgaWYgKHBfcmhzID09IDApCisJeworCSAgaWYgKHBfY3VyID09IDApCisJICAgIHBfcmV0ID0gcF9jdXIgPSBwX2xoczsKKwkgIGVsc2UKKwkgICAgeworCSAgICAgIHBfY3VyLT5tX3BfbmV4dF9zaWJsaW5nID0gcF9saHM7CisJICAgICAgcF9saHMtPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfY3VyOworCSAgICB9CisJICBwX2N1ciA9IHBfbGhzID0gMDsKKwl9CisgICAgICBlbHNlIGlmIChwX2xocyA9PSAwIHx8IHBfcmhzLT5tX21ldGFkYXRhIDwgcF9saHMtPm1fbWV0YWRhdGEpCisJeworCSAgaWYgKHBfY3VyID09IDApCisJICAgIHsKKwkgICAgICBwX3JldCA9IHBfY3VyID0gcF9yaHM7CisJICAgICAgcF9yaHMgPSBwX3Jocy0+bV9wX3ByZXZfb3JfcGFyZW50OworCSAgICB9CisJICBlbHNlCisJICAgIHsKKwkgICAgICBwX2N1ci0+bV9wX25leHRfc2libGluZyA9IHBfcmhzOworCSAgICAgIHBfcmhzID0gcF9yaHMtPm1fcF9wcmV2X29yX3BhcmVudDsKKwkgICAgICBwX2N1ci0+bV9wX25leHRfc2libGluZy0+bV9wX3ByZXZfb3JfcGFyZW50ID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BkZWJ1Z19tYXBfYmFzZTxLZXksCUVxX0ZuLCBcCisJCSAgdHlwZW5hbWUgX0FsbG9jOjp0ZW1wbGF0ZSByZWJpbmQ8S2V5Pjo6b3RoZXI6OmNvbnN0X3JlZmVyZW5jZT4KKyNlbmRpZgorCisKKyAgICAvKioKKyAgICAgKiAgQSBjb2xsaXNpb24tY2hhaW5pbmcgaGFzaC1iYXNlZCBjb250YWluZXIuCisgICAgICoKKyAgICAgKgorICAgICAqICBAaW5ncm91cCBoYXNoLWRldGFpbAorICAgICAqCisgICAgICogIEB0cGFyYW0gS2V5IAkgICAgCUtleSB0eXBlLgorICAgICAqCisgICAgICogIEB0cGFyYW0gTWFwcGVkIAkgICAgCU1hcCB0eXBlLgorICAgICAqCisgICAgICogIEB0cGFyYW0gSGFzaF9GbgkgICAgICAJSGFzaGluZyBmdW5jdG9yLgorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBEZWZhdWx0IGlzIF9fZ251X2N4eDo6aGFzaC4KKyAgICAgKgorICAgICAqICBAdHBhcmFtIEVxX0ZuCSAgICAgIAlFcXVhbCBmdW5jdG9yLgorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBEZWZhdWx0IHN0ZDo6ZXF1YWxfdG88S2V5PgorICAgICAqCisgICAgICogIEB0cGFyYW0gX0FsbG9jIAkgICAgCUFsbG9jYXRvciB0eXBlLgorICAgICAqCisgICAgICogIEB0cGFyYW0gU3RvcmVfSGFzaCAgICAJSWYga2V5IHR5cGUgc3RvcmVzIGV4dHJhIG1ldGFkYXRhLgorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBEZWZhdWx0cyB0byBmYWxzZS4KKyAgICAgKgorICAgICAqICBAdHBhcmFtIENvbWJfSGFzaF9GbglDb21iaW5pbmcgaGFzaCBmdW5jdG9yLgorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBJZiBIYXNoX0ZuIGlzIG5vdCBudWxsX3R5cGUsIHRoZW4gdGhpcworICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBpcyB0aGUgcmFuZ2VkLWhhc2ggZnVuY3Rvcjsgb3RoZXJ3aXNlLAorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzIGlzIHRoZSByYW5nZS1oYXNoaW5nIGZ1bmN0b3IuCisgICAgICogICAgICAgICAgICAgICAgICAgIFhYWChTZWUgRGVzaWduOjpIYXNoLUJhc2VkIENvbnRhaW5lcnM6Okhhc2ggUG9saWNpZXMuKQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICBEZWZhdWx0IGRpcmVjdF9tYXNrX3JhbmdlX2hhc2hpbmcuCisgICAgICoKKyAgICAgKiAgQHRwYXJhbSBSZXNpemVfUG9saWN5IAlSZXNpemVzIGhhc2guCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRzIHRvIGhhc2hfc3RhbmRhcmRfcmVzaXplX3BvbGljeSwKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgdXNpbmcgaGFzaF9leHBvbmVudGlhbF9zaXplX3BvbGljeSBhbmQKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzaF9sb2FkX2NoZWNrX3Jlc2l6ZV90cmlnZ2VyLgorICAgICAqCisgICAgICoKKyAgICAgKiAgQmFzZXMgYXJlOiBkZXRhaWw6Omhhc2hfZXFfZm4sIFJlc2l6ZV9Qb2xpY3ksIGRldGFpbDo6cmFuZ2VkX2hhc2hfZm4sCisgICAgICogICAgICAgICAgICAgZGV0YWlsOjp0eXBlc190cmFpdHMuIChPcHRpb25hbDogZGV0YWlsOjpkZWJ1Z19tYXBfYmFzZS4pCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgS2V5LAorCSAgICAgdHlwZW5hbWUgTWFwcGVkLAorCSAgICAgdHlwZW5hbWUgSGFzaF9GbiwKKwkgICAgIHR5cGVuYW1lIEVxX0ZuLAorCSAgICAgdHlwZW5hbWUgX0FsbG9jLAorCS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IAkJCWl0ZXJhdG9yOworI2VuZGlmCisKKyAgICAgIHR5cGVkZWYgY29uc3RfaXRlcmF0b3JfIAkJCWNvbnN0X2l0ZXJhdG9yOworCisgICAgICBQQl9EU19DQ19IQVNIX05BTUUoKTsKKworICAgICAgUEJfRFNfQ0NfSEFTSF9OQU1FKGNvbnN0IEhhc2hfRm4mKTsKKworICAgICAgUEJfRFNfQ0NfSEFTSF9OQU1FKGNvbnN0IEhhc2hfRm4mLCBjb25zdCBFcV9GbiYpOworCisgICAgICBQQl9EU19DQ19IQVNIX05BTUUoY29uc3QgSGFzaF9GbiYsIGNvbnN0IEVxX0ZuJiwgY29uc3QgQ29tYl9IYXNoX0ZuJik7CisKKyAgICAgIFBCX0RTX0NDX0hBU0hfTkFNRShjb25zdCBIYXNoX0ZuJiwgY29uc3QgRXFfRm4mLCBjb25zdCBDb21iX0hhc2hfRm4mLAorCQkgICAgICAgY29uc3QgUmVzaXplX1BvbGljeSYpOworCisgICAgICBQQl9EU19DQ19IQVNIX05BTUUoY29uc3QgUEJfRFNfQ0xBU1NfQ19ERUMmKTsKKworICAgICAgdmlydHVhbAorICAgICAgflBCX0RTX0NDX0hBU0hfTkFNRSgpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEl0PgorICAgICAgdm9pZAorICAgICAgY29weV9mcm9tX3JhbmdlKEl0LCBJdCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGluaXRpYWxpemUoKTsKKworICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0OworCisgICAgICAvLy8gVHJ1ZSBpZiBzaXplKCkgPT0gMC4KKyAgICAgIGlubGluZSBib29sCisgICAgICBlbXB0eSgpIGNvbnN0OworCisgICAgICAvLy8gUmV0dX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0b3JlX2V4dHJhX2luZGljYXRvcik7IH0KKworICAgICAgaW5saW5lIG1hcHBlZF9yZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oa2V5X2NvbnN0X3JlZmVyZW5jZSByX2tleSkKKyAgICAgIHsKKyNpZmRlZiBQQl9EU19EQVRBX1RSVUVfSU5ESUNBVE9SCisJcmV0dXJuIChzdWJzY3JpcHRfaW1wKHJfa2V5LCB0cmFpdHNfYmFzZTo6bV9zdG9yZV9leHRyYV9pbmRpY2F0b3IpKTsKKyNlbHNlCisJaW5zZXJ0KHJfa2V5KTsKKwlyZXR1cm4gdHJhaXRzX2Jhc2U6OnNfbnVsbF90eXBlOworI2VuZGlmCisgICAgICB9CisKKyAgICAgIGlubGluZSBwb2ludF9pdGVyYXRvcgorICAgICAgZmluZChrZXlfY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIHBvaW50X2NvbnN0X2l0ZXJhdG9yCisgICAgICBmaW5kKGtleV9jb25zdF9yZWZlcmVuY2UpIGNvbnN0OworCisgICAgICBpbmxpbmUgcG9pbnRfaXRlcmF0b3IKKyAgICAgIGZpbmRfZW5kKCk7CisKKyAgICAgIGlubGluZSBwb2ludF9jb25zdF9pdGVyYXRvcgorICAgICAgZmluZF9lbmQoKSBjb25zdDsKKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIGVyYXNlKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgZXJhc2VfaWYoUHJlZCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCk7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGVuZCgpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0OworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKyNlbmRpZgorCisjaWZkZWYgUEJfRFNfSFRfTUFQX1RSQUNFXworICAgICAgdm9pZAorICAgICAgdHJhY2UoKSBjb25zdDsKKyNlbmRpZgorCisgICAgcHJpdmF0ZToKKyAgICAgIHZvaWQKKyAgICAgIGRlYWxsb2NhdGVfYWxsKCk7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBkb19yZXNpemVfaWZfbmVlZGVkKCk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBkb19yZXNpemVfaWZfbmVlZGVkX25vX3Rocm93KCk7CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZV9pbXAoc2l6ZV90eXBlKTsKKworICAgICAgdm9pZAorICAgICAgZG9fcmVzaXplKHNpemVfdHlwZSk7CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZV9pbXBfbm9fZXhjZXB0aW9ucyhzaXplX3R5cGUsIGVudHJ5X3BvaW50ZXJfYXJyYXksIHNpemVfdHlwZSk7CisKKyAgICAgIGlubGluZSBlbnRyeV9wb2ludGVyCisgICAgICByZXNpemVfaW1wX25vX2V4Y2VwdGlvbnNfcmVhc3NpZ25fcG9pbnRlcihlbnRyeV9wb2ludGVyLAorCQkJCQkJZW50cnlfcG9pbnRlcl9hcnJheSwKKwkJCQkJCWZhbHNlX3R5cGUpOworCisgICAgICBpbmxpbmUgZW50cnlfcG9pbnRlcgorICAgICAgcmVzaXplX2ltcF9ub19leGNlcHRpb25zX3JlYXNzaWduX3BvaW50ZXIoZW50cnlfcG9pbnRlciwKKwkJCQkJCWVudHJ5X3BvaW50ZXJfYXJyYXksCisJCQkJCQl0cnVlX3R5cGUpOworCisgICAgICB2b2lk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lJiBvdGhlcikgY29uc3QKK3sgcmV0dXJuIGNtcF93aXRoX290aGVyKG90aGVyKTsgfQorCitQQl9EU19DTEFTU19UX0RFQwordGVtcGxhdGU8dHlwZW5hbWUgT3RoZXJfTWFwX1R5cGU+Citib29sCitQQl9EU19DTEFTU19DX0RFQzo6CitjbXBfd2l0aF9vdGhlcihjb25zdCBPdGhlcl9NYXBfVHlwZSYgb3RoZXIpIGNvbnN0Cit7CisgIGlmIChzaXplKCkgIT0gb3RoZXIuc2l6ZSgpKQorICAgIHJldHVybiBmYWxzZTsKKworICBmb3IgKHR5cGVuYW1lIE90aGVyX01hcF9UeXBlOjpjb25zdF9pdGVyYXRvciBpdCA9IG90aGVyLmJlZ2luKCk7CisgICAgICAgaXQgIT0gb3RoZXIuZW5kKCk7ICsraXQpCisgICAgeworICAgICAga2V5X2NvbnN0X3JlZmVyZW5jZSByX2tleSA9IGtleV9jb25zdF9yZWZlcmVuY2UoUEJfRFNfVjJGKCppdCkpOworCisgICAgICBtYXBwZWRfY29uc3RfcG9pbnRlciBwX21hcHBlZF92YWx1ZSA9CisJY29uc3RfY2FzdDxQQl9EU19DTEFTU19DX0RFQyYgPigqdGhpcykuCisJZmluZF9rZXlfcG9pbnRlcihyX2tleSwgdHJhaXRzX2Jhc2U6Om1fc3RvcmVfZXh0cmFfaW5kaWNhdG9yKTsKKworICAgICAgaWYgKHBfbWFwcGVkX3ZhbHVlID09IDApCisJcmV0dXJuIGZhbHNlOworCisjaWZkZWYgUEJfRFNfREFUQV9UUlVFX0lORElDQVRPUgorICAgICAgaWYgKHBfbWFwcGVkX3ZhbHVlLT5zZWNvbmQgIT0gaXQtPnNlY29uZCkKKwlyZXR1cm4gZmFsc2U7CisjZW5kaWYKKyAgICB9CisgIHJldHVybiB0cnVlOworfQorCitQQl9EU19DTEFTU19UX0RFQwordGVtcGxhdGU8dHlwZW5hbWUgT3RoZXJfSFRfTWFwX1R5cGU+Citib29sCitQQl9EU19DTEFTU19DX0RFQzo6Cit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9yZWZlcmVuY2UpOworCisgICAgICB2b2lkCisgICAgICBjbGVhcigpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgY2hlY2tfa2V5X2V4aXN0cyhrZXlfY29uc3RfcmVmZXJlbmNlLCBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGNoZWNrX2tleV9kb2VzX25vdF9leGlzdChrZXlfY29uc3RfcmVmZXJlbmNlLCBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGNoZWNrX3NpemUoc2l6ZV90eXBlLCBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgc3dhcChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBDbXBfRm4+CisgICAgICB2b2lkCisgICAgICBzcGxpdChrZXlfY29uc3RfcmVmZXJlbmNlLCBDbXBfRm4sIFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIHZvaWQKKyAgICAgIGpvaW4oUEJfRFNfQ0xBU1NfQ19ERUMmLCBib29sIHdpdGhfY2xlYW51cCA9IHRydWUpOworCisgICAgcHJpdmF0ZToKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoa2V5X2NvbnN0X3JlZmVyZW5jZSkgY29uc3Q7CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBmaW5kKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICBrZXlfcmVwb3NpdG9yeSAJbV9rZXlzOworICAgICAgRXFfRm4gCQltX2VxOworICAgIH07CisKKyAgICBQQl9EU19DTEFTU19UX0RFQworICAgIFBCX0RTX0NMQVNTX0NfREVDOjoKKyAgICBkZWJ1Z19tYXBfYmFzZS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a2V5X2V4aXN0cyAiCisJCSAgICA8PCByX2tleSA8PCBzdGQ6OmVuZGw7CisJICBzdGQ6OmFib3J0KCk7CisJfQorICAgIH0KKworICAgIFBCX0RTX0NMQVNTX1RfREVDCisgICAgaW5saW5lIHZvaWQKKyAgICBQQl9EU19DTEFTU19DX0RFQzo6CisgICAgY2hlY2tfa2V5X2RvZXNfbm90X2V4aXN0KGtleV9jb25zdF9yZWZlcmVuY2Ugcl9rZXksCisJCQkgICAgIGNvbnN0IGNoYXIqIF9fZmlsZSwgaW50IF9fbGluZSkgY29uc3QKKyAgICB7CisgICAgICBhc3NlcnRfdmFsaWQoX19maWxlLCBfX2xpbmUpOworICAgICAgaWYgKGZpbmQocl9rZXkpICE9IG1fa2V5cy5lbmQoKSkKKwl7CisJICB1c2luZyBzdGQ6OmNlcnI7CisJICB1c2luZyBzdGQ6OmVuZGw7CisJICBjZXJyIDw8IF9fZmlsZSA8PCAnOicgPDwgX19saW5lIDw8ICI6IGNoZWNrX2tleV9kb2VzX25vdF9leGlzdCAiCisJICAgICAgIDw8IHJfa2V5IDw8IGVuZGw7CisJICBzdGQ6OmFib3J0KCk7CisJfQorICAgIH0KKworICAgIFBCX0RTX0NMQVNTX1RfREVDCisgICAgaW5saW5lIHZvaWQKKyAgICBQQl9EU19DTEFTU19DX0RFQzo6CisgICAgY2hlY2tfc2l6ZShzaXplX3R5cGUgc2l6ZSwgY29uc3QgY2hhciogX19maWxlLCBpbnQgX19saW5lKSBjb25zdAorICAgIHsKKyAgICAgIGFzc2VydF92YWxpZChfX2ZpbGUsIF9fbGluZSk7CisgICAgICBjb25zdCBzaXplX3R5cGUga2V5c19zaXplID0gbV9rZXlzLnNpemUoKTsKKyAgICAgIGlmIChzaXplICE9IGtleXNfc2l6ZSkKKwl7CisJICBzdGQ6OmNlcnIgPDwgX19maWxlIDw8ICc6JyA8PCBfX2xpbmUgPDwgIjogY2hlY2tfc2l6ZSAiCisJCSAgICA8PCBzaXplIDw8ICIgIT0gIi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poYXNoLgorICAgICAqCisgICAgICogIEB0cGFyYW0gRXFfRm4JICAgICAgCUVxdWFsIGZ1bmN0b3IuCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIERlZmF1bHQgc3RkOjplcXVhbF90bzxLZXk+CisgICAgICoKKyAgICAgKiAgQHRwYXJhbSBfQWxsb2MgCSAgICAJQWxsb2NhdG9yIHR5cGUuCisgICAgICoKKyAgICAgKiAgQHRwYXJhbSBTdG9yZV9IYXNoICAgIAlJZiBrZXkgdHlwZSBzdG9yZXMgZXh0cmEgbWV0YWRhdGEuCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRzIHRvIGZhbHNlLgorICAgICAqCisgICAgICogIEB0cGFyYW0gQ29tYl9Qcm9iZV9GbglDb21iaW5pbmcgcHJvYmUgZnVuY3Rvci4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgSWYgSGFzaF9GbiBpcyBub3QgbnVsbF90eXBlLCB0aGVuIHRoaXMKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgaXMgdGhlIHJhbmdlZC1wcm9iZSBmdW5jdG9yOyBvdGhlcndpc2UsCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMgaXMgdGhlIHJhbmdlLWhhc2hpbmcgZnVuY3Rvci4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgWFhYIFNlZSBEZXNpZ246Okhhc2gtQmFzZWQgQ29udGFpbmVyczo6SGFzaCBQb2xpY2llcy4KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgRGVmYXVsdCBkaXJlY3RfbWFza19yYW5nZV9oYXNoaW5nLgorICAgICAqCisgICAgICogIEB0cGFyYW0gUHJvYmVfRm4gICAgICAgCVByb2JlIGZ1bmN0b3IuCisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRzIHRvIGxpbmVhcl9wcm9iZV9mbiwKKyAgICAgKiAgICAgICAgICAgICAgICAgICAg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pOworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgY29uc3QgZXFfZm4uCisgICAgICBjb25zdCBFcV9GbiYKKyAgICAgIGdldF9lcV9mbigpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgcHJvYmVfZm4uCisgICAgICBQcm9iZV9GbiYKKyAgICAgIGdldF9wcm9iZV9mbigpOworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgY29uc3QgcHJvYmVfZm4uCisgICAgICBjb25zdCBQcm9iZV9GbiYKKyAgICAgIGdldF9wcm9iZV9mbigpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgY29tYl9wcm9iZV9mbi4KKyAgICAgIENvbWJfUHJvYmVfRm4mCisgICAgICBnZXRfY29tYl9wcm9iZV9mbigpOworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgY29uc3QgY29tYl9wcm9iZV9mbi4KKyAgICAgIGNvbnN0IENvbWJfUHJvYmVfRm4mCisgICAgICBnZXRfY29tYl9wcm9iZV9mbigpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgcmVzaXplX3BvbGljeS4KKyAgICAgIFJlc2l6ZV9Qb2xpY3kmCisgICAgICBnZXRfcmVzaXplX3BvbGljeSgpOworCisgICAgICAvLy8gUmV0dXJuIGN1cnJlbnQgY29uc3QgcmVzaXplX3BvbGljeS4KKyAgICAgIGNvbnN0IFJlc2l6ZV9Qb2xpY3kmCisgICAgICBnZXRfcmVzaXplX3BvbGljeSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc3RkOjpwYWlyPHBvaW50X2l0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0KGNvbnN0X3JlZmVyZW5jZSByX3ZhbCkKKyAgICAgIHsKKyAgICAgICBfR0xJQkNYWF9ERUJVR19PTkxZKFBCX0RTX0NMQVNTX0NfREVDOjphc3NlcnRfdmFsaWQoX19GSUxFX18sIF9fTElORV9fKTspCisJcmV0dXJuIGluc2VydF9pbXAocl92YWwsIHRyYWl0c19iYXNlOjptX3N0b3JlX2V4dHJhX2luZGljYXRvcik7CisgICAgICB9CisKKyAgICAgIGlubGluZSBtYXBwZWRfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKGtleV9jb25zdF9yZWZlcmVuY2Ugcl9rZXkpCisgICAgICB7CisjaWZkZWYgUEJfRFNfREFUQV9UUlVFX0lORElDQVRPUgorCXJldHVybiBzdWJzY3JpcHRfaW1wKHJfa2V5LCB0cmFpdHNfYmFzZTo6bV9zdG9yZV9leHRyYV9pbmRpY2F0b3IpOworI2Vsc2UKKwlpbnNlcnQocl9rZXkpOworCXJldHVybiB0cmFpdHNfYmFzZTo6c19udWxsX3R5cGU7CisjZW5kaWYKKyAgICAgIH0KKworICAgICAgaW5saW5lIHBvaW50X2l0ZXJhdG9yCisgICAgICBmaW5kKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgcG9pbnRfY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoa2V5X2NvbnN0X3JlZmVyZW5jZSkgY29uc3Q7CisKKyAgICAgIGlubGluZSBwb2ludF9pdGVyYXRvcgorICAgICAgZmluZF9lbmQoKTsKKworICAgICAgaW5saW5lIHBvaW50X2NvbnN0X2l0ZXJhdG9yCisgICAgICBmaW5kX2VuZCgpIGNvbnN0OworCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgZXJhc2Uoa2V5X2NvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFByZWQ+CisgICAgICAgIGlubGluZSBzaXplX3R5cGUKKyAgICAgICAgZXJhc2VfaWYoUHJlZCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCk7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGVuZCgpOworICAgICAgCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0OworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKyNlbmRpZgorCisjaWZkZWYgUEJfRFNfSFRfTUFQX1RSQUNFXworICAgICAgdm9pZAorICAgICAgdHJhY2UoKSBjb25zdDsKKyNlbmRpZgorCisgICAgcHJpdmF0ZToKKyNpZmRlZiBQQl9EU19EQVRBX1RSVUVfSU5ESUNBVE9SCisgICAgICBmcmllbmQgY2xhc3MgaXRlcmF0b3JfOworI2VuZGlmCisKKyAgICAgIGZyaWVuZCBjbGFzcyBjb25zdF9pdGVyYXRvcl87CisKKyAgICAgIHZvaWQKKyAgICAgIGRlYWxsb2NhdGVfYWxsKCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGluaXRpYWxpemUoKTsKKworICAgICAgdm9pZAorICAgICAgZXJhc2VfYWxsX3ZhbGlkX2VudHJpZXMoZW50cnlfYXJyYXksIHNpemVfdHlwZSk7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBkb19yZXNpemVfaWZfbmVlZGVkKCk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBkb19yZXNpemVfaWZfbmVlZGVkX25vX3Rocm93KCk7CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZV9pbXAoc2l6ZV90eXBlKTsKKworICAgICAgdmlydHVhbCB2b2lkCisgICAgICBkb19yZXNpemUoc2l6ZV90eXBlKTsKKworICAgICAgdm9pZAorICAgICAgcmVzaXplX2ltcChlbnRyeV9hcnJheSwgc2l6ZV90eXBlKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIHJlc2l6ZV9pbXBfcmVhc3NpZ24oZW50cnlfcG9pb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2hfRm4mKTsKKworICAgICAgdm9pZAorICAgICAgc3dhcChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBub3RpZnlfcmVzaXplZChzaXplX3R5cGUpOworCisgICAgICBpbmxpbmUgY29tcF9oYXNoCisgICAgICBvcGVyYXRvcigpKGtleV9jb25zdF9yZWZlcmVuY2UpIGNvbnN0OworCisgICAgICBpbmxpbmUgY29tcF9oYXNoCisgICAgICBvcGVyYXRvcigpKGtleV9jb25zdF9yZWZlcmVuY2UsIHNpemVfdHlwZSkgY29uc3Q7CisgICAgfTsKKworICAgIFBCX0RTX0NMQVNTX1RfREVDCisgICAgUEJfRFNfQ0xBU1NfQ19ERUM6OgorICAgIHJhbmdlZF9oYXNoX2ZuKHNpemVfdHlwZSBzaXplKQorICAgIHsgQ29tYl9IYXNoX0ZuOjpub3RpZnlfcmVzaXplZChzaXplKTsgfQorCisgICAgUEJfRFNfQ0xBU1NfVF9ERUMKKyAgICBQQl9EU19DTEFTU19DX0RFQzo6CisgICAgcmFuZ2VkX2hhc2hfZm4oc2l6ZV90eXBlIHNpemUsIGNvbnN0IEhhc2hfRm4mIHJfaGFzaF9mbikgOgorICAgICAgSGFzaF9GbihyX2hhc2hfZm4pCisgICAgeyBDb21iX0hhc2hfRm46Om5vdGlmeV9yZXNpemVkKHNpemUpOyB9CisKKyAgICBQQl9EU19DTEFTU19UX0RFQworICAgIFBCX0RTX0NMQVNTX0NfREVDOjoKKyAgICByYW5nZWRfaGFzaF9mbihzaXplX3R5cGUgc2l6ZSwgY29uc3QgSGFzaF9GbiYgcl9oYXNoX2ZuLCAKKwkJICAgY29uc3QgQ29tYl9IYXNoX0ZuJiByX2NvbWJfaGFzaF9mbikgCisgICAgOiBIYXNoX0ZuKHJfaGFzaF9mbiksIENvbWJfSGFzaF9GbihyX2NvbWJfaGFzaF9mbikKKyAgICB7IGNvbWJfaGFzaF9mbl9iYXNlOjpub3RpZnlfcmVzaXplZChzaXplKTsgfQorCis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vciBvYmplY3QuCisgICAgICBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IFBCX0RTX0NMQVNTX0NfREVDJiBvdGhlcikgY29uc3QKKyAgICAgIHsgcmV0dXJuIChiYXNlX3R5cGU6Om1fcF9uZCAhPSBvdGhlci5tX3BfbmQpOyB9CisKKyAgICAgIFBCX0RTX0NMQVNTX0NfREVDJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfQVNTRVJUKGJhc2VfdHlwZTo6bV9wX25kICE9IDApOworCWluYygpOworCXJldHVybiAoKnRoaXMpOworICAgICAgfQorCisgICAgICBQQl9EU19DTEFTU19DX0RFQworICAgICAgb3BlcmF0b3IrKyhpbnQpCisgICAgICB7CisJUEJfRFNfQ0xBU1NfQ19ERUMgcmV0X2l0KGJhc2VfdHlwZTo6bV9wX25kKTsKKwlvcGVyYXRvcisrKCk7CisJcmV0dXJuIChyZXRfaXQpOworICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgIHZvaWQKKyAgICAgIGluYygpCisgICAgICB7CisJaWYgKGJhc2VfdHlwZTo6bV9wX25kLT5tX3BfbmV4dF9zaWJsaW5nICE9IDApCisJICB7CisJICAgIGJhc2VfdHlwZTo6bV9wX25kID0gYmFzZV90eXBlOjptX3BfbmQtPm1fcF9uZXh0X3NpYmxpbmc7CisJICAgIHdoaWxlIChiYXNlX3R5cGU6Om1fcF9uZC0+bV9wX2xfY2hpbGQgIT0gMCkKKwkgICAgICBiYXNlX3R5cGU6Om1fcF9uZCA9IGJhc2VfdHlwZTo6bV9wX25kLT5tX3BfbF9jaGlsZDsKKwkgICAgcmV0dXJuOworCSAgfQorCisJd2hpbGUgKHRydWUpCisJICB7CisJICAgIG5vZGVfcG9pbnRlciBwX25leHQgPSBiYXNlX3R5cGU6Om1fcF9uZDsKKwkgICAgYmFzZV90eXBlOjptX3BfbmQgPSBiYXNlX3R5cGU6Om1fcF9uZC0+bV9wX3ByZXZfb3Jf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KiA+KCZwX25ld19uZC0+bV92YWx1ZSkpKQorICAgIHR5cGVuYW1lIG5vZGU6OnZhbHVlX3R5cGUocl92YWwpOworCisgIGNvbmQuc2V0X25vX2FjdGlvbigpOworCisgICsrbV9zaXplOworCisgIHJldHVybiAocF9uZXdfbmQpOworfQorCitQQl9EU19DTEFTU19UX0RFQworaW5saW5lIHR5cGVuYW1lIFBCX0RTX0NMQVNTX0NfREVDOjpub2RlX3BvaW50ZXIKK1BCX0RTX0NMQVNTX0NfREVDOjoKK2dldF9uZXdfbm9kZV9mb3JfaW5zZXJ0KGNvbnN0X3JlZmVyZW5jZSByX3ZhbCwgdHJ1ZV90eXBlKQoreworICBub2RlX3BvaW50ZXIgcF9uZXdfbmQgPSBzX25vZGVfYWxsb2NhdG9yLmFsbG9jYXRlKDEpOworCisgIG5ldyAoY29uc3RfY2FzdDx2b2lkKiA+KAorCQkJICBzdGF0aWNfY2FzdDxjb25zdCB2b2lkKiA+KCZwX25ld19uZC0+bV92YWx1ZSkpKQorICAgIHR5cGVuYW1lIG5vZGU6OnZhbHVlX3R5cGUocl92YWwpOworCisgICsrbV9zaXplOworCisgIHJldHVybiAocF9uZXdfbmQpOworfQorCitQQl9EU19DTEFTU19UX0RFQworaW5saW5lIHZvaWQKK1BCX0RTX0NMQVNTX0NfREVDOjoKK21ha2VfY2hpbGRfb2Yobm9kZV9wb2ludGVyIHBfbmQsIG5vZGVfcG9pbnRlciBwX25ld19wYXJlbnQpCit7CisgIF9HTElCQ1hYX0RFQlVHX0FTU0VSVChwX25kICE9IDApOworICBfR0xJQkNYWF9ERUJVR19BU1NFUlQocF9uZXdfcGFyZW50ICE9IDApOworCisgIHBfbmQtPm1fcF9uZXh0X3NpYmxpbmcgPSBwX25ld19wYXJlbnQtPm1fcF9sX2NoaWxkOworCisgIGlmIChwX25ld19wYXJlbnQtPm1fcF9sX2NoaWxkICE9IDApCisgICAgcF9uZXdfcGFyZW50LT5tX3BfbF9jaGlsZC0+bV9wX3ByZXZ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9BbGxvYz4KKyAgICAgIGNvbnN0X2l0ZXJhdG9yOworCisgICAgICB0eXBlZGVmIGNvbnN0X2l0ZXJhdG9yIAkJCQlpdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgQ21wX0ZuIAkJCQkJY21wX2ZuOworICAgICAgdHlwZWRlZiBfQWxsb2MgCQkJCQlhbGxvY2F0b3JfdHlwZTsKKworICAgICAgbGVmdF9jaGlsZF9uZXh0X3NpYmxpbmdfaGVhcCgpOworICAgICAgbGVmdF9jaGlsZF9uZXh0X3NpYmxpbmdfaGVhcChjb25zdCBDbXBfRm4mKTsKKyAgICAgIGxlZnRfY2hpbGRfbmV4dF9zaWJsaW5nX2hlYXAoY29uc3QgbGVmdF9jaGlsZF9uZXh0X3NpYmxpbmdfaGVhcCYpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIH5sZWZ0X2NoaWxkX25leHRfc2libGluZ19oZWFwKCk7CisKKyAgICAgIGlubGluZSBib29sCisgICAgICBlbXB0eSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBzaXplKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSBzaXplX3R5cGUKKyAgICAgIG1heF9zaXplKCkgY29uc3Q7CisKKyAgICAgIENtcF9GbiYKKyAgICAgIGdldF9jbXBfZm4oKTsKKworICAgICAgY29uc3QgQ21wX0ZuJgorICAgICAgZ2V0X2NtcF9mbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGJlZ2luKCk7CisKKyAgICAgIGlubGluZSBjb25zdF9pdGVyYXRvcgorICAgICAgYmVnaW4oKSBjb25zdDsKKworICAgICAgaW5saW5lIGl0ZXJhdG9yCisgICAgICBlbmQoKTsKKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKTsKKworI2lmZGVmIFBCX0RTX0xDX05TX0hFQVBfVFJBQ0VfCisgICAgICB2b2lkCisgICAgICB0cmFjZSgpIGNvbnN0OworI2VuZGlmCisKKyAgICBwcm90ZWN0ZWQ6CisgICAgICBpbmxpbmUgbm9kZV9wb2ludGVyCisgICAgICBnZXRfbmV3X25vZGVfZm9yX2luc2VydChjb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgc3RhdGljIHZvaWQKKyAgICAgIG1ha2VfY2hpbGRfb2Yobm9kZV9wb2ludGVyLCBub2RlX3BvaW50ZXIpOworCisgICAgICB2b2lkCisgICAgICB2YWx1ZV9zd2FwKGxlZnRfY2hpbGRfbmV4dF9zaWJsaW5nX2hlYXAmKTsKKworICAgICAgaW5saW5lIHN0YXRpYyBub2RlX3BvaW50ZXIKKyAgICAgIHBhcmVudChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgc3dhcF93aXRoX3BhcmVudChub2RlX3BvaW50ZXIsIG5vZGVfcG9pbnRlcik7CisKKyAgICAgIHZvaWQKKyAgICAgIGJ1YmJsZV90b190b3Aobm9kZV9wb2ludGVyKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGFjdHVhbF9lcmFzZV9ub2RlKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyX2ltcChub2RlX3BvaW50ZXIpOworCisgICAgICB2b2lkCisgICAgICB0b19saW5rZWRfbGlzdCgpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgbm9kZV9wb2ludGVyCisgICAgICBwcnVuZShQcmVkKTsKKworI2lmZGVmIF9HTElCQ1hYX0RFQlVHCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfdmFsaWQoY29uc3QgY2hhciosIGludCkgY29uc3Q7CisKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9ub2RlX2NvbnNpc3RlbnQobm9kZV9jb25zdF9wb2ludGVyLCBib29sLCBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgc3RhdGljIHNpemVfdHlwZQorICAgICAgc2l6ZV91bmRlcl9ub2RlKG5vZGVfY29uc3RfcG9pbnRlcik7CisKKyAgICAgIHN0YXRpYyBzaXplX3R5cGUKKyAgICAgIGRlZ3JlZShub2RlX2NvbnN0X3BvaW50ZXIpOworI2VuZGlmCisKKyNpZmRlZiBQQl9EU19MQ19OU19IRUFQX1RSQUNFXworICAgICAgc3RhdGljIHZvaWQKKyAgICAgIHRyYWNlX25vZGUobm9kZV9jb25zdF9wb2ludGVyLCBzaXplX3R5cGUpOworI2VuZGlmCisKKyAgICBwcml2YXRlOgorI2lmZGVmIF9HTElCQ1hYX0RFQlVHCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfaXRlcmF0b3JzKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfc2l6ZShjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgc3RhdGljIHNpemVfdHlwZQorICAgICAgc2l6ZV9mcm9tX25vZGUobm9kZV9jb25zdF9wb2ludGVyKTsKKyNlbmRpZgorCisgICAgICBub2RlX3BvaW50ZXIKKyAgICAgIHJlY3Vyc2l2ZV9jb3B5X25vZGUobm9kZV9jb25zdF9wb2ludGVyKTsKKworICAgICAgaW5saW5lIG5vZGVfcG9pbnRlcgorICAgICAgZ2V0X25ld19ub2RlX2Zvcl9pbnNlcnQoY29uc3RfcmVmZXJlbmNlLCBmYWxzZV90eXBlKTsKKworICAgICAgaW5saW5lIG5vZGVfcG9pbnRlcgorICAgICAgZ2V0X25ld19ub2RlX2Zvcl9pbnNlcnQoY29uc3RfcmVmZXJlbmNlLCB0cnVlX3R5cGUpOworCisjaWZkZWYgUEJfRFNfTENfTlNfSEVBUF9UUkFDRV8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIE1ldGFkYXRhXz4KK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ERUMmKTsKKworICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgZW1wdHkoKSBjb25zdDsKKworICAgICAgaW5saW5lIG1hcHBlZF9yZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oa2V5X2NvbnN0X3JlZmVyZW5jZSByX2tleSkKKyAgICAgIHsKKyNpZmRlZiBQQl9EU19EQVRBX1RSVUVfSU5ESUNBVE9SCisJX0dMSUJDWFhfREVCVUdfT05MWShhc3NlcnRfdmFsaWQoX19GSUxFX18sIF9fTElORV9fKTspCisJcmV0dXJuIGluc2VydChzdGQ6Om1ha2VfcGFpcihyX2tleSwgbWFwcGVkX3R5cGUoKSkpLmZpcnN0LT5zZWNvbmQ7CisjZWxzZQorCWluc2VydChyX2tleSk7CisJcmV0dXJuIHRyYWl0c19iYXNlOjpzX251bGxfdHlwZTsKKyNlbmRpZgorICAgICAgfQorCisgICAgICBpbmxpbmUgc3RkOjpwYWlyPHBvaW50X2l0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0KGNvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIGlubGluZSBwb2ludF9pdGVyYXRvcgorICAgICAgZmluZChrZXlfY29uc3RfcmVmZXJlbmNlIHJfa2V5KQorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX09OTFkoYXNzZXJ0X3ZhbGlkKF9fRklMRV9fLCBfX0xJTkVfXyk7KQorCWVudHJ5X3BvaW50ZXIgcF9lID0gZmluZF9pbXAocl9rZXkpOworCXJldHVybiBwb2ludF9pdGVyYXRvcihwX2UgPT0gMCA/IDA6ICZwX2UtPm1fdmFsdWUpOworICAgICAgfQorCisgICAgICBpbmxpbmUgcG9pbnRfY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoa2V5X2NvbnN0X3JlZmVyZW5jZSByX2tleSkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19PTkxZKGFzc2VydF92YWxpZChfX0ZJTEVfXywgX19MSU5FX18pOykKKwllbnRyeV9wb2ludGVyIHBfZSA9IGZpbmRfaW1wKHJfa2V5KTsKKwlyZXR1cm4gcG9pbnRfY29uc3RfaXRlcmF0b3IocF9lID09IDAgPyAwOiAmcF9lLT5tX3ZhbHVlKTsKKyAgICAgIH0KKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIGVyYXNlKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgZXJhc2VfaWYoUHJlZCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCk7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGVuZCgpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0OworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiBmaWxlLCBpbnQgbGluZSkgY29uc3Q7CisjZW5kaWYKKworI2lmZGVmIFBCX0RTX0xVX01BUF9UUkFDRV8KKyAgICAgIHZvaWQKKyAgICAgIHRyYWNlKCkgY29uc3Q7CisjZW5kaWYKKworICAgIHByb3RlY3RlZDoKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgSXQ+CisgICAgICB2b2lkCisgICAgICBjb3B5X2Zyb21fcmFuZ2UoSXQsIEl0KTsKKworICAgIHByaXZhdGU6CisjaWZkZWYgUEJfRFNfREF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orCSAgX0dMSUJDWFhfREVCVUdfQVNTRVJUKGNudCAhPSBtX3NpemUpOworCSAgbmV3IChjb25zdF9jYXN0PHZvaWQqPihzdGF0aWNfY2FzdDxjb25zdCB2b2lkKj4odGFyZ2V0X2l0KSkpCisJICAgICAgdmFsdWVfdHlwZSgqc291cmNlX2l0KTsKKworCSAgKyt0YXJnZXRfaXQ7CisJfQorICAgICAgZWxzZQorCXJldF9pdCA9IHRhcmdldF9pdDsKKyAgICArK3NvdXJjZV9pdDsKKyAgICB9CisKKyAgX0dMSUJDWFhfREVCVUdfQVNTRVJUKG1fc2l6ZSA+IDApOworICByZWFsbG9jYXRlX21ldGFkYXRhKChub2RlX3VwZGF0ZSopdGhpcywgbV9zaXplIC0gMSk7CisgIGNkLnNldF9ub19hY3Rpb24oKTsKKyAgX0dMSUJDWFhfREVCVUdfT05MWShkZWJ1Z19iYXNlOjplcmFzZV9leGlzdGluZyhQQl9EU19WMkYoKml0KSk7KQorICB7CisgICAgY29uZF9kdG9yPHNpemVfdHlwZT4gY2QxKG1fYV92YWx1ZXMsIG1fZW5kX2l0LCBtX3NpemUpOworICB9CisKKyAgbV9hX3ZhbHVlcyA9IGFfdmFsdWVzOworICAtLW1fc2l6ZTsKKyAgbV9lbmRfaXQgPSBtX2FfdmFsdWVzICsgbV9zaXplOworICB1cGRhdGUobm9kZV9iZWdpbigpLCAobm9kZV91cGRhdGUqKXRoaXMpOworICBQQl9EU19BU1NFUlRfVkFMSUQoKCp0aGlzKSkKKyAgcmV0dXJuIEl0KHJldF9pdCk7Cit9CisKK1BCX0RTX0NMQVNTX1RfREVDCitib29sCitQQl9EU19DTEFTU19DX0RFQzo6CitlcmFzZShrZXlfY29uc3RfcmVmZXJlbmNlIHJfa2V5KQoreworICBwb2ludF9pdGVyYXRvciBpdCA9IGZpbmQocl9rZXkpOworICBpZiAoaXQgPT0gZW5kKCkpCisgICAgcmV0dXJuIGZhbHNlOworICBlcmFzZShpdCk7CisgIHJldHVybiB0cnVlO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kZV9jb25zdF9pdGVyYXRvcjsKKworCisgICAgICBQQl9EU19PVl9UUkVFX05BTUUoKTsKKworICAgICAgUEJfRFNfT1ZfVFJFRV9OQU1FKGNvbnN0IENtcF9GbiYpOworCisgICAgICBQQl9EU19PVl9UUkVFX05BTUUoY29uc3QgQ21wX0ZuJiwgY29uc3Qgbm9kZV91cGRhdGUmKTsKKworICAgICAgUEJfRFNfT1ZfVFJFRV9OQU1FKGNvbnN0IFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIH5QQl9EU19PVl9UUkVFX05BTUUoKTsKKworICAgICAgdm9pZAorICAgICAgc3dhcChQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBJdD4KKyAgICAgIHZvaWQKKyAgICAgIGNvcHlfZnJvbV9yYW5nZShJdCwgSXQpOworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0OworCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgZW1wdHkoKSBjb25zdDsKKworICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0OworCisgICAgICBDbXBfRm4mCisgICAgICBnZXRfY21wX2ZuKCk7CisKKyAgICAgIGNvbnN0IENtcF9GbiYKKyAgICAgIGdldF9jbXBfZm4oKSBjb25zdDsKKworICAgICAgaW5saW5lIG1hcHBlZF9yZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oa2V5X2NvbnN0X3JlZmVyZW5jZSByX2tleSkKKyAgICAgIHsKKyNpZmRlZiBQQl9EU19EQVRBX1RSVUVfSU5ESUNBVE9SCisJUEJfRFNfQVNTRVJUX1ZBTElEKCgqdGhpcykpCisJcG9pbnRfaXRlcmF0b3IgaXQgPSBsb3dlcl9ib3VuZChyX2tleSk7CisJaWYgKGl0ICE9IGVuZCgpICYmICFDbXBfRm46Om9wZXJhdG9yKCkocl9rZXksIFBCX0RTX1Yy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AgeyByZXR1cm4gZXJhc2VfaW1wPGl0ZXJhdG9yPihpdCk7IH0KKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKTsKKworICAgICAgdm9pZAorICAgICAgam9pbihQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBzcGxpdChrZXlfY29uc3RfcmVmZXJlbmNlLCBQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICBpbmxpbmUgaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkKKyAgICAgIHsgcmV0dXJuIG1fYV92YWx1ZXM7IH0KKworICAgICAgaW5saW5lIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0CisgICAgICB7IHJldHVybiBtX2FfdmFsdWVzOyB9CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgZW5kKCkKKyAgICAgIHsgcmV0dXJuIG1fZW5kX2l0OyB9CisKKyAgICAgIGlubGluZSBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIG1fZW5kX2l0OyB9CisKKyAgICAgIC8vLyBSZXR1cm5zIGEgY29uc3Qgbm9kZV9pdGVyYXRvciBjb3JyZXNwb25kaW5nIHRvIHRoZSBub2RlIGF0IHRoZQorICAgICAgLy8vIHJvb3Qgb2YgdGhlIHRyZWUuCisgICAgICBpbmxpbmUgbm9kZV9jb25zdF9pdGVyYXRvcgorICAgICAgbm9kZV9iZWdpbigpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJucyBhIG5vZGVfaXRlcmF0b3IgY29ycmVzcG9uZGluZyB0byB0aGUgbm9kZSBhdCB0aGUKKyAgICAgIC8vLyByb290IG9mIHRoZSB0cmVlLgorICAgICAgaW5saW5lIG5vZGVfaXRlcmF0b3IKKyAgICAgIG5vZGVfYmVnaW4oKTsKKworICAgICAgLy8vIFJldHVybnMgYSBjb25zdCBub2RlX2l0ZXJhdG9yIGNvcnJlc3BvbmRpbmc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gICBwcml2YXRlOgorICAgICAgdHlwZWRlZgorICAgICAgdHlwZW5hbWUgdHlwZXNfdHJhaXRzPAorICAgICAgS2V5LAorICAgICAgbnVsbF90eXBlLAorICAgICAgX0FsbG9jLAorICAgICAgZmFsc2U+Ojp2YWx1ZV90eXBlCisgICAgICB2YWx1ZV90eXBlOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZgorICAgICAgdHlwZW5hbWUgdHJlZV9ub2RlX21ldGFkYXRhX2Rpc3BhdGNoPAorICAgICAgS2V5LAorICAgICAgbnVsbF90eXBlLAorICAgICAgQ21wX0ZuLAorICAgICAgTm9kZV9VcGRhdGUsCisgICAgICBfQWxsb2M+Ojp0eXBlCisgICAgICBtZXRhZGF0YV90eXBlOworCisgICAgICAvLy8gVGhpcyBpcyBhbiBpdGVyYXRvciB0byBhbiBpdGVyYXRvcjogaXQgaXRlcmF0ZXMgb3ZlciBub2RlcywKKyAgICAgIC8vLyBhbmQgZGUtcmVmZXJlbmNpbmcgaXQgcmV0dXJucyBvbmUgb2YgdGhlIHRyZWUncyBpdGVyYXRvcnMuCisgICAgICB0eXBlZGVmCisgICAgICBvdl90cmVlX25vZGVfY29uc3RfaXRfPAorCXZhbHVlX3R5cGUsCisJbWV0YWRhdGFfdHlwZSwKKwlfQWxsb2M+CisgICAgICBub2RlX2NvbnN0X2l0ZXJhdG9yOworCisgICAgICB0eXBlZGVmIG5vZGVfY29uc3RfaXRlcmF0b3Igbm9kZV9pdGVyYXRvcjsKKworICAgICAgdHlwZWRlZgorICAgICAgTm9kZV9VcGRhdGU8CisJbm9kZV9jb25zdF9pdGVyYXRvciwKKwlub2RlX2NvbnN0X2l0ZXJhdG9yLAorCUNtcF9GbiwKKwlfQWxsb2M+CisgICAgICBub2RlX3VwZGF0ZTsKKworICAgICAgdHlwZWRlZgorICAgICAgX19nbnVfcGJkczo6bnVsbF9ub2RlX3VwZGF0ZTwKKwlub2RlX2NvbnN0X2l0ZXJhdG9yLAorCW5vZGVfaXR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fbmV4dF9zaWJsaW5nICE9IDApCisJcF9uZC0+bV9wX25leHRfc2libGluZy0+bV9wX3ByZXZfb3JfcGFyZW50ID0gcF9uZC0+bV9wX3ByZXZfb3JfcGFyZW50OworICAgICAgUEJfRFNfQVNTRVJUX05PREVfQ09OU0lTVEVOVChwX25kLT5tX3BfcHJldl9vcl9wYXJlbnQsIGZhbHNlKQorICAgICAgcmV0dXJuOworICAgIH0KKworICBpZiAocF9uZXdfY2hpbGQgIT0gMCkKKyAgICB7CisgICAgICBwX25ld19jaGlsZC0+bV9wX3ByZXZfb3JfcGFyZW50ID0gcF9uZC0+bV9wX3ByZXZfb3JfcGFyZW50OworICAgICAgcF9uZXdfY2hpbGQtPm1fcF9uZXh0X3NpYmxpbmcgPSBwX25kLT5tX3BfbmV4dF9zaWJsaW5nOworICAgICAgaWYgKHBfbmV3X2NoaWxkLT5tX3BfbmV4dF9zaWJsaW5nICE9IDApCisJcF9uZXdfY2hpbGQtPm1fcF9uZXh0X3NpYmxpbmctPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfbmV3X2NoaWxkOworICAgICAgcF9uZXdfY2hpbGQtPm1fcF9wcmV2X29yX3BhcmVudC0+bV9wX25leHRfc2libGluZyA9IHBfbmV3X2NoaWxkOworICAgICAgUEJfRFNfQVNTRVJUX05PREVfQ09OU0lTVEVOVChwX25kLT5tX3BfcHJldl9vcl9wYXJlbnQsIGZhbHNlKQorICAgICAgcmV0dXJuOworICAgIH0KKworICBwX25kLT5tX3BfcHJldl9vcl9wYXJlbnQtPm1fcF9uZXh0X3NpYmxpbmcgPSBwX25kLT5tX3BfbmV4dF9zaWJsaW5nOworICBpZiAocF9uZC0+bV9wX25leHRfc2libGluZyAhPSAwKQorICAgIHBfbmQtPm1fcF9uZXh0X3NpYmxpbmctPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfbmQtPm1fcF9wcmV2X29yX3BhcmVudDsKKyAgUEJfRFNfQVNTRVJUX05PREVfQ09OU0lTVEVOVChwX25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ZXh0LT5tX3ZhbHVlKSkKKyAgICB7CisgICAgICBwX25leHQtPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfbmQtPm1fcF9wcmV2X29yX3BhcmVudDsKKyAgICAgIGJhc2VfdHlwZTo6bWFrZV9jaGlsZF9vZihwX25kLCBwX25leHQpOworICAgICAgcmV0dXJuIHBfbmV4dC0+bV9wX25leHRfc2libGluZyA9PSAwIAorCT8gcF9uZXh0IDogcF9uZXh0LT5tX3BfbmV4dF9zaWJsaW5nOworICAgIH0KKworICBpZiAocF9uZXh0LT5tX3BfbmV4dF9zaWJsaW5nICE9IDApCisgICAgeworICAgICAgcF9uZXh0LT5tX3BfbmV4dF9zaWJsaW5nLT5tX3BfcHJldl9vcl9wYXJlbnQgPSBwX25kOworICAgICAgcF9uZC0+bV9wX25leHRfc2libGluZyA9IHBfbmV4dC0+bV9wX25leHRfc2libGluZzsKKyAgICAgIGJhc2VfdHlwZTo6bWFrZV9jaGlsZF9vZihwX25leHQsIHBfbmQpOworICAgICAgcmV0dXJuIHBfbmQtPm1fcF9uZXh0X3NpYmxpbmc7CisgICAgfQorCisgIHBfbmQtPm1fcF9uZXh0X3NpYmxpbmcgPSAwOworICBiYXNlX3R5cGU6Om1ha2VfY2hpbGRfb2YocF9uZXh0LCBwX25kKTsKKyAgUEJfRFNfQVNTRVJUX05PREVfQ09OU0lTVEVOVChwX25kLCBmYWxzZSkKKyAgcmV0dXJuIHBfbmQ7Cit9CisKK1BCX0RTX0NMQVNTX1RfREVDCit0eXBlbmFtZSBQQl9EU19DTEFTU19DX0RFQzo6bm9kZV9wb2ludGVyCitQQl9EU19DTEFTU19DX0RFQzo6CitiYWNrX2pvaW4obm9kZV9wb2ludGVyIHBfbmQsIG5vZGVfcG9pbnRlciBwX25leHQpCit7CisgIF9HTElCQ1hYX0RFQlVHX0FTU0VSVChwX25kICE9IDApOworICBfR0xJQkNYWF9ERUJVR19BU1NFUlQocF9uZXh0LT5tX3BfbmV4dF9zaWJsaW5nID09IDApOworCisgIGlmIChDbXBfRm46Om9wZXJhdG9yKCkocF9uZC0+bV92YWx1ZSwgcF9uZXh0LT5tX3ZhbHVlKSkKKyAgICB7CisgICAgICBwX25leHQtPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfbmQtPm1fcF9wcmV2X29yX3BhcmVudDsKKyAgICAgIGJhc2VfdHlwZTo6bWFrZV9jaGlsZF9vZihwX25kLCBwX25leHQpOworICAgICAgUEJfRFNfQVNTRVJUX05PREVfQ09OU0lTVEVOVChwX25leHQsIGZhbHNlKQorICAgICAgcmV0dXJuIHBfbmV4dDsKKyAgICB9CisKKyAgcF9uZC0+bV9wX25leHRfc2libGluZyA9IDA7CisgIGJhc2VfdHlwZTo6bWFrZV9jaGlsZF9vZihwX25leHQsIHBfbmQpOworICBQQl9EU19BU1NFUlRfTk9ERV9DT05TSVNURU5UKHBfbmQsIGZhbHNlKQorICByZXR1cm4gcF9uZDsKK30KKworUEJfRFNfQ0xBU1NfVF9ERUMKK3RlbXBsYXRlPHR5cGVuYW1lIFByZWQ+Cit0eXBlbmFtZSBQQl9EU19DTEFTU19DX0RFQzo6c2l6ZV90eXBlCitQQl9EU19DTEFTU19DX0RFQzo6CitlcmFzZV9pZihQcmVkIHByZWQpCit7CisgIFBCX0RTX0FTU0VSVF9WQUxJRCgoKnRoaXMpKQorICAgIGlmIChiYXNlX3R5cGU6OmVtcHR5KCkpCisgICAgICB7CisgICAgICAgIFBCX0RTX0FTU0VSVF9WQUxJRCgoKnRoaXMpKQorCXJldHVybiAwOworICAgICAgfQorICBiYXNlX3R5cGU6OnRvX2xpbmtlZF9saXN0KCk7CisgIG5vZGVfcG9pbnRlciBwX291dCA9IGJhc2VfdHlwZTo6cHJ1bmUocHJlZCk7CisgIHNpemVfdHlwZSBlcnNkID0gMDsKKyAgd2hpbGUgKHBfb3V0ICE9IDApCisgICAgeworICAgICAgKytlcnNkOworICAgICAgbm9kZV9wb2ludGVyIHBfbmV4dCA9IHBfb3V0LT5tX3Bf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gICBwYWlyaW5nX2hlYXAoKTsKKworICAgICAgcGFpcmluZ19oZWFwKGNvbnN0IENtcF9GbiYpOworCisgICAgICBwYWlyaW5nX2hlYXAoY29uc3QgcGFpcmluZ19oZWFwJik7CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAocGFpcmluZ19oZWFwJik7CisKKyAgICAgIH5wYWlyaW5nX2hlYXAoKTsKKworICAgICAgaW5saW5lIHBvaW50X2l0ZXJhdG9yCisgICAgICBwdXNoKGNvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIHZvaWQKKyAgICAgIG1vZGlmeShwb2ludF9pdGVyYXRvciwgY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIGNvbnN0X3JlZmVyZW5jZQorICAgICAgdG9wKCkgY29uc3Q7CisKKyAgICAgIHZvaWQKKyAgICAgIHBvcCgpOworCisgICAgICB2b2lkCisgICAgICBlcmFzZShwb2ludF9pdGVyYXRvcik7CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFByZWQ+CisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlX2lmKFByZWQpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgdm9pZAorICAgICAgc3BsaXQoUHJlZCwgcGFpcmluZ19oZWFwJik7CisKKyAgICAgIHZvaWQKKyAgICAgIGpvaW4ocGFpcmluZ19oZWFwJik7CisKKyAgICBwcm90ZWN0ZWQ6CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIEl0PgorICAgICAgdm9pZAorICAgICAgY29weV9mcm9tX3JhbmdlKEl0LCBJdCk7CisKKyNpZmRlZiBfR0xJQkNYWF9ERUJVRworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X3ZhbGlkKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworI2VuZGlmCisKKyAgICBwcml2YXRlOgorCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgcHVzaF9pbXAobm9kZV9w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xzZQorCWluc2VydChyX2tleSk7CisJcmV0dXJuIHRyYWl0c19iYXNlOjpzX251bGxfdHlwZTsKKyNlbmRpZgorICAgICAgfQorCisgICAgICBpbmxpbmUgcG9pbnRfaXRlcmF0b3IKKyAgICAgIGZpbmQoa2V5X2NvbnN0X3JlZmVyZW5jZSk7CisKKyAgICAgIGlubGluZSBwb2ludF9jb25zdF9pdGVyYXRvcgorICAgICAgZmluZChrZXlfY29uc3RfcmVmZXJlbmNlKSBjb25zdDsKKworICAgICAgaW5saW5lIHBvaW50X2l0ZXJhdG9yCisgICAgICBsb3dlcl9ib3VuZChrZXlfY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIHBvaW50X2NvbnN0X2l0ZXJhdG9yCisgICAgICBsb3dlcl9ib3VuZChrZXlfY29uc3RfcmVmZXJlbmNlKSBjb25zdDsKKworICAgICAgaW5saW5lIHBvaW50X2l0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChrZXlfY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIHBvaW50X2NvbnN0X2l0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChrZXlfY29uc3RfcmVmZXJlbmNlKSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgY2xlYXIoKTsKKworICAgICAgaW5saW5lIGJvb2wKKyAgICAgIGVyYXNlKGtleV9jb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVyYXNlKGNvbnN0X2l0ZXJhdG9yKTsKKworI2lmZGVmIFBCX0RTX0RBVEFfVFJVRV9JTkRJQ0FUT1IKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgZXJhc2UoaXRlcmF0b3IpOworI2VuZGlmCisKKyAgICAgIGlubGluZSBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICBlcmFzZShjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKTsKKworI2lmZGVmIFBCX0RTX0RBVEFfVFJVRV9JTkRJQ0FUT1IKKyAgICAgIGlubGluZSByZXZlcnNlX2l0ZXJhdG9yCisgICAgICBlcmFzZShyZXZlcnNlX2l0ZXJhdG9yKTsKKyNlbmRpZgorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgaW5saW5lIHNpemVfdHlwZQorICAgICAgZXJhc2VfaWYoUHJlZCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGpvaW4oUEJfRFNfQ0xBU1NfQ19ERUMmKTsKKworICAgICAgdm9pZAorICAgICAgc3BsaXQoa2V5X2NvbnN0X3JlZmVyZW5jZSwgUEJfRFNfQ0xBU1NfQ19ERUMmKTsKKworICAgICAgaW5saW5lIGl0ZXJhdG9yCisgICAgICBiZWdpbigpOworCisgICAgICBpbmxpbmUgY29uc3RfaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSBpdGVyYXRvcgorICAgICAgZW5kKCk7CisKKyAgICAgIGlubGluZSBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3Q7CisKKyAgICAgIGlubGluZSByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKTsKKworICAgICAgaW5saW5lIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IKKyAgICAgIHJiZWdpbigpIGNvbnN0OworCisgICAgICBpbmxpbmUgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpOworCisgICAgICBpbmxpbmUgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0OworCisgICAgICAvLy8gUmV0dXJucyBhIGNvbnN0IG5vZGVfaXRlcmF0b3IgY29ycmVzcG9uZGluZyB0byB0aGUgbm9kZSBhdCB0aGUKKyAgICAgIC8vLyByb290IG9mIHRoZSB0cmVlLgorICAgICAgaW5saW5lIG5vZGVfY29uc3RfaXRlcmF0b3IKKyAgICAgIG5vZ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mxpbmUgdm9pZAorICAgICAgYXBwbHlfdXBkYXRlKG5vZGVfcG9pbnRlciwgbnVsbF9ub2RlX3VwZGF0ZV9wb2ludGVyKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgTm9kZV9VcGRhdGVfPgorICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGFwcGx5X3VwZGF0ZShub2RlX3BvaW50ZXIsIE5vZGVfVXBkYXRlXyopOworCisgICAgICBib29sCisgICAgICBqb2luX3ByZXAoUEJfRFNfQ0xBU1NfQ19ERUMmLCBicmFuY2hfYmFnJik7CisKKyAgICAgIHZvaWQKKyAgICAgIHJlY19qb2luX3ByZXAobm9kZV9jb25zdF9wb2ludGVyLCBub2RlX2NvbnN0X3BvaW50ZXIsIGJyYW5jaF9iYWcmKTsKKworICAgICAgdm9pZAorICAgICAgcmVjX2pvaW5fcHJlcChsZWFmX2NvbnN0X3BvaW50ZXIsIGxlYWZfY29uc3RfcG9pbnRlciwgYnJhbmNoX2JhZyYpOworCisgICAgICB2b2lkCisgICAgICByZWNfam9pbl9wcmVwKGxlYWZfY29uc3RfcG9pbnRlciwgaW5vZGVfY29uc3RfcG9pbnRlciwgYnJhbmNoX2JhZyYpOworCisgICAgICB2b2lkCisgICAgICByZWNfam9pbl9wcmVwKGlub2RlX2NvbnN0X3BvaW50ZXIsIGxlYWZfY29uc3RfcG9pbnRlciwgYnJhbmNoX2JhZyYpOworCisgICAgICB2b2lkCisgICAgICByZWNfam9pbl9wcmVwKGlub2RlX2NvbnN0X3BvaW50ZXIsIGlub2RlX2NvbnN0X3BvaW50ZXIsIGJyYW5jaF9iYWcmKTsKKworICAgICAgbm9kZV9wb2ludGVyCisgICAgICByZWNfam9pbihub2RlX3BvaW50ZXIsIG5vZGVfcG9pbnRlciwgc2l6ZV90eXBlLCBicmFuY2hfYmFnJik7CisKKyAgICAgIG5vZGVfcG9pbnRlcgorICAgICAgcmVjX2pvaW4obGVhZl9wb2ludGVyLCBsZWFmX3BvaW50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9CisKKwlib29sCisJb3BlcmF0b3IhPShjb25zdCBpdGVyYXRvciYgb3RoZXIpIGNvbnN0CisJeyByZXR1cm4gY29uc3RfaXRlcmF0b3I6Om1fcF9wX2N1ciAhPSBvdGhlci5tX3BfcF9jdXI7IH0KKworCWl0ZXJhdG9yJgorCW9wZXJhdG9yKysoKQorCXsKKwkgIGNvbnN0X2l0ZXJhdG9yOjpvcGVyYXRvcisrKCk7CisJICByZXR1cm4gKnRoaXM7CisJfQorCisJaXRlcmF0b3IKKwlvcGVyYXRvcisrKGludCkKKwl7CisJICBpdGVyYXRvciByZXRfaXQoKnRoaXMpOworCSAgb3BlcmF0b3IrKygpOworCSAgcmV0dXJuIHJldF9pdDsKKwl9CisKKwlub2RlX3BvaW50ZXJfcG9pbnRlcgorCW9wZXJhdG9yLT4oKQorCXsKKwkgIF9HTElCQ1hYX0RFQlVHX09OTFkoY29uc3RfaXRlcmF0b3I6OmFzc2VydF9yZWZlcmVuY2libGUoKTspCisJICByZXR1cm4gY29uc3RfaXRlcmF0b3I6Om1fcF9wX2N1cjsKKwl9CisKKwlub2RlX3BvaW50ZXIKKwlvcGVyYXRvciooKQorCXsKKwkgIF9HTElCQ1hYX0RFQlVHX09OTFkoY29uc3RfaXRlcmF0b3I6OmFzc2VydF9yZWZlcmVuY2libGUoKTspCisJICByZXR1cm4gKmNvbnN0X2l0ZXJhdG9yOjptX3BfcF9jdXI7CisJfQorICAgICAgfTsKKworCisgICAgICBfSW5vZGUoc2l6ZV90eXBlLCBjb25zdCBhX2NvbnN0X2l0ZXJhdG9yKTsKKworICAgICAgdm9pZAorICAgICAgdXBkYXRlX3ByZWZpeGVzKGFfY29uc3RfcG9pbnRlcik7CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpIGNvbnN0OworCisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKTsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0OworCisgIC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X0NfREVDJiBvdGhlcikKKyAgICAgIDogbV9wX25kKG90aGVyLm1fcF9uZCkKKyAgICAgIHsgfQorCisgICAgICBfQ0l0ZXImCisgICAgICBvcGVyYXRvcj0oY29uc3QgX0NJdGVyJiBvdGhlcikKKyAgICAgIHsKKwltX3BfbmQgPSBvdGhlci5tX3BfbmQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfQ0l0ZXImCisgICAgICBvcGVyYXRvcj0oY29uc3QgUEJfRFNfQ09OU1RfT0RJUl9JVF9DX0RFQyYgb3RoZXIpCisgICAgICB7CisJbV9wX25kID0gb3RoZXIubV9wX25kOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgY29uc3RfcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfQVNTRVJUKG1fcF9uZC0+bV90eXBlID09IGxlYWZfbm9kZSk7CisJcmV0dXJuICZzdGF0aWNfY2FzdDxsZWFmX3BvaW50ZXI+KG1fcF9uZCktPnZhbHVlKCk7CisgICAgICB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQobV9wX25kLT5tX3R5cGUgPT0gbGVhZl9ub2RlKTsKKwlyZXR1cm4gc3RhdGljX2Nhc3Q8bGVhZl9wb2ludGVyPihtX3BfbmQpLT52YWx1ZSgpOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IF9DSXRlciYgb3RoZXIpIGNvbnN0CisgICAgICB7IHJldHVybiBtX3BfbmQgPT0gb3RoZXIubV9wX25kOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgUEJfRFNfQ09OU1RfT0RJUl9JVF9DX0RFQyYgb3RoZXIpIGNvbnN0CisgICAgICB7IHJldHVybiBtX3BfbmQgPT0gb3RoZXIubV9wX25kOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgX0NJdGVyJiBvdGhlcikgY29uc3QKKyAgICAgIHsgcmV0dXJuIG1fcF9uZCAhPSBvdGhlci5tX3BfbmQ7IH0KKworICAgICAgYm9vbAorICAgICAgb3BlcmF0b3IhPShjb25zdCBQQl9EU19DT05TVF9PRElSX0lUX0NfREVDJiBvdGhlcikgY29uc3QKKyAgICAgIHsgcmV0dXJuIG1fcF9uZCAhPSBvdGhlci5tX3BfbmQ7IH0KKworICAgICAgX0NJdGVyJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7CisJaW5jKGludGVncmFsX2NvbnN0YW50PGludCwgSXNfRm9yd2FyZF9JdGVyYXRvcj4oKSk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfQ0l0ZXIKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworCV9DSXRlciByZXRfaXQobV9wX25kKTsKKwlvcGVyYXRvcisrKCk7CisJcmV0dXJuIHJldF9pdDsKKyAgICAgIH0KKworICAgICAgX0NJdGVyJgorICAgICAgb3BlcmF0b3ItLSgpCisgICAgICB7CisJZGVjKGludGVncmFsX2NvbnN0YW50PGludCwgSXNfRm9yd2FyZF9JdGVyYXRvcj4oKSk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfQ0l0ZXIKKyAgICAgIG9wZXJhdG9yLS0oaW50KQorICAgICAgeworCV9DSXRlciByZXRfaXQobV9wX25kKTsKKwlvcGVyYXRvci0tKCk7CisJcmV0dXJuIHJldF9pdDsKKyAgICAgIH0KKworICAgIHByb3RlY3RlZDoKKyAgICAgIHZvaWQKKyAgICAgIGluYyhmYWxzZV90eXBlKQorICAgICAgeyBkZWModHJ1ZV90eXBlKCkpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIGluYyh0cnVlX3R5cGUpCisgICAgICB7CisJaWYgKG1fcF9u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OiBiYXNlX3R5cGUob3RoZXIubV9wX25kKSB7IH0KKworICAgICAgX0l0ZXImCisgICAgICBvcGVyYXRvcj0oY29uc3QgX0l0ZXImIG90aGVyKQorICAgICAgeworCWJhc2VfdHlwZTo6bV9wX25kID0gb3RoZXIubV9wX25kOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX0l0ZXImCisgICAgICBvcGVyYXRvcj0oY29uc3QgUEJfRFNfT0RJUl9JVF9DX0RFQyYgb3RoZXIpCisgICAgICB7CisJYmFzZV90eXBlOjptX3BfbmQgPSBvdGhlci5tX3BfbmQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBwb2ludGVyCisgICAgICBvcGVyYXRvci0+KCkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQoYmFzZV90eXBlOjptX3BfbmQtPm1fdHlwZSA9PSBsZWFmX25vZGUpOworCXJldHVybiAmc3RhdGljX2Nhc3Q8bGVhZl9wb2ludGVyPihiYXNlX3R5cGU6Om1fcF9uZCktPnZhbHVlKCk7CisgICAgICB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkgY29uc3QKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQoYmFzZV90eXBlOjptX3BfbmQtPm1fdHlwZSA9PSBsZWFmX25vZGUpOworCXJldHVybiBzdGF0aWNfY2FzdDxsZWFmX3BvaW50ZXI+KGJhc2VfdHlwZTo6bV9wX25kKS0+dmFsdWUoKTsKKyAgICAgIH0KKworICAgICAgX0l0ZXImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKwliYXNlX3R5cGU6Om9wZXJhdG9yKysoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9JdGVyCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlfSXRlciByZXQoYmFzZV90eXBlOjptX3BfbmQpOworCW9wZXJhd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9IDA7CisgIG5vZGVfcG9pbnRlciBwX25ld194X3BhcmVudCA9IDA7CisKKyAgaWYgKHBfeS0+bV9wX2xlZnQgPT0gMCkKKyAgICBwX3ggPSBwX3ktPm1fcF9yaWdodDsKKyAgZWxzZSBpZiAocF95LT5tX3BfcmlnaHQgPT0gMCkKKyAgICBwX3ggPSBwX3ktPm1fcF9sZWZ0OworICBlbHNlCisgICAgeworICAgICAgcF95ID0gcF95LT5tX3BfcmlnaHQ7CisgICAgICB3aGlsZSAocF95LT5tX3BfbGVmdCAhPSAwKQorCXBfeSA9IHBfeS0+bV9wX2xlZnQ7CisgICAgICBwX3ggPSBwX3ktPm1fcF9yaWdodDsKKyAgICB9CisKKyAgaWYgKHBfeSA9PSBwX3opCisgICAgeworICAgICAgcF9uZXdfeF9wYXJlbnQgPSBwX3ktPm1fcF9wYXJlbnQ7CisgICAgICBpZiAocF94ICE9IDApCisJcF94LT5tX3BfcGFyZW50ID0gcF95LT5tX3BfcGFyZW50OworCisgICAgICBpZiAoYmFzZV90eXBlOjptX3BfaGVhZC0+bV9wX3BhcmVudCA9PSBwX3opCisJYmFzZV90eXBlOjptX3BfaGVhZC0+bV9wX3BhcmVudCA9IHBfeDsKKyAgICAgIGVsc2UgaWYgKHBfei0+bV9wX3BhcmVudC0+bV9wX2xlZnQgPT0gcF96KQorICAgICAgICB7CisJICBwX3ktPm1fcF9sZWZ0ID0gcF96LT5tX3BfcGFyZW50OworCSAgcF96LT5tX3BfcGFyZW50LT5tX3BfbGVmdCA9IHBfeDsKKyAgICAgICAgfQorICAgICAgZWxzZQorICAgICAgICB7CisJICBwX3ktPm1fcF9sZWZ0ID0gMDsKKwkgIHBfei0+bV9wX3BhcmVudC0+bV9wX3JpZ2h0ID0gcF94OworICAgICAgICB9CisgICAgfQorICBlbHNlCisgICAgeworICAgICAgcF96LT5tX3BfbGVmdC0+bV9wX3BhcmVudCA9IHBfeTsKKyAgICAgIHBfeS0+bV9wX2xlZnQgPSBwX3otPm1fcF9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cF9uZC0+bV9wX3BhcmVudC0+bV9wX3BhcmVudC0+bV9yZWQgPSB0cnVlOworCSAgICAgIHBfbmQgPSBwX25kLT5tX3BfcGFyZW50LT5tX3BfcGFyZW50OworICAgICAgICAgICAgfQorCSAgZWxzZQorICAgICAgICAgICAgeworCSAgICAgIGlmIChwX25kID09IHBfbmQtPm1fcF9wYXJlbnQtPm1fcF9yaWdodCkKKyAgICAgICAgICAgICAgICB7CisJCSAgcF9uZCA9IHBfbmQtPm1fcF9wYXJlbnQ7CisJCSAgYmFzZV90eXBlOjpyb3RhdGVfbGVmdChwX25kKTsKKyAgICAgICAgICAgICAgICB9CisJICAgICAgcF9uZC0+bV9wX3BhcmVudC0+bV9yZWQgPSBmYWxzZTsKKwkgICAgICBwX25kLT5tX3BfcGFyZW50LT5tX3BfcGFyZW50LT5tX3JlZCA9IHRydWU7CisJICAgICAgYmFzZV90eXBlOjpyb3RhdGVfcmlnaHQocF9uZC0+bV9wX3BhcmVudC0+bV9wX3BhcmVudCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworCSAgbm9kZV9wb2ludGVyIHBfeSA9IHBfbmQtPm1fcF9wYXJlbnQtPm1fcF9wYXJlbnQtPm1fcF9sZWZ0OworCSAgaWYgKHBfeSAhPSAwICYmIHBfeS0+bV9yZWQpCisgICAgICAgICAgICB7CisJICAgICAgcF9uZC0+bV9wX3BhcmVudC0+bV9yZWQgPSBmYWxzZTsKKwkgICAgICBwX3ktPm1fcmVkID0gZmFsc2U7CisJICAgICAgcF9uZC0+bV9wX3BhcmVudC0+bV9wX3BhcmVudC0+bV9yZWQgPSB0cnVlOworCSAgICAgIHBfbmQgPSBwX25kLT5tX3BfcGFyZW50LT5tX3BfcGFyZW50OworICAgICAgICAgICAgfQorCSAgZWxzZQorICAgICAgICAgICAgeworCSAgICAgIGlmIChwX25kID09IHBfbmQtPm1fcF9wYXJlbnQtPm1fcF9sZWZ0KQorICAgICAgICAg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pbmctPm1fbWV0YWRhdGEpOworCisgICAgICAtLWl0OworICAgICAgcF9uZCA9IG5leHRfMl9wb2ludGVyKG5leHRfYWZ0ZXJfMF9wb2ludGVyKHBfbmQpKTsKKyAgICB9CisgIFBCX0RTX0RFQlVHX1ZFUklGWShpdCArIDEgPT0gbV9yYy5iZWdpbigpKTsKK30KKworUEJfRFNfQ0xBU1NfVF9ERUMKK3R5cGVuYW1lIFBCX0RTX0NMQVNTX0NfREVDOjpub2RlX2NvbnN0X3BvaW50ZXIKK1BCX0RTX0NMQVNTX0NfREVDOjoKK25leHRfMl9wb2ludGVyKG5vZGVfY29uc3RfcG9pbnRlciBwX25kKQoreworICBpZiAocF9uZCA9PSAwKQorICAgIHJldHVybiAwOworCisgIG5vZGVfcG9pbnRlciBwX25leHQgPSBwX25kLT5tX3BfbmV4dF9zaWJsaW5nOworCisgIGlmIChwX25leHQgPT0gMCkKKyAgICByZXR1cm4gMDsKKworICBpZiAocF9uZC0+bV9tZXRhZGF0YSA9PSBwX25leHQtPm1fbWV0YWRhdGEpCisgICAgcmV0dXJuIHBfbmQ7CisKKyAgcmV0dXJuIG5leHRfMl9wb2ludGVyKHBfbmV4dCk7Cit9CisKK1BCX0RTX0NMQVNTX1RfREVDCit0eXBlbmFtZSBQQl9EU19DTEFTU19DX0RFQzo6bm9kZV9jb25zdF9wb2ludGVyCitQQl9EU19DTEFTU19DX0RFQzo6CituZXh0X2FmdGVyXzBfcG9pbnRlcihub2RlX2NvbnN0X3BvaW50ZXIgcF9uZCkKK3sKKyAgaWYgKHBfbmQgPT0gMCkKKyAgICByZXR1cm4gMDsKKworICBub2RlX3BvaW50ZXIgcF9uZXh0ID0gcF9uZC0+bV9wX25leHRfc2libGluZzsKKworICBpZiAocF9uZXh0ID09IDApCisgICAgcmV0dXJuIDA7CisKKyAgaWYgKHBfbmQtPm1fbWV0YWRhdGEgPCBwX25leHQtPm1fbWV0YWRhdGEpCisgICAgcmV0dXJuIHBfbmV4dDsKKworICByZXR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GlmIChiYXNlX3R5cGU6Om1fcF9tYXggPT0gcF9uZCkKKwliYXNlX3R5cGU6Om1fcF9tYXggPSBwX25leHQ7CisKKyAgICAgIGJhc2VfdHlwZTo6bWFrZV9jaGlsZF9vZihwX25kLCBwX25leHQpOworCisgICAgICArK3BfbmV4dC0+bV9tZXRhZGF0YTsKKworICAgICAgcmV0dXJuIHBfbmV4dDsKKyAgICB9CisKKyAgcF9uZC0+bV9wX25leHRfc2libGluZyA9IHBfbmV4dC0+bV9wX25leHRfc2libGluZzsKKworICBpZiAocF9uZC0+bV9wX25leHRfc2libGluZyAhPSAwKQorICAgIHBfbmQtPm1fcF9uZXh0X3NpYmxpbmctPm1fcF9wcmV2X29yX3BhcmVudCA9IHBfbmQ7CisKKyAgaWYgKGJhc2VfdHlwZTo6bV9wX21heCA9PSBwX25leHQpCisgICAgYmFzZV90eXBlOjptX3BfbWF4ID0gcF9uZDsKKworICBiYXNlX3R5cGU6Om1ha2VfY2hpbGRfb2YocF9uZXh0LCBwX25kKTsKKworICArK3BfbmQtPm1fbWV0YWRhdGE7CisKKyAgcmV0dXJuIHBfbmQ7Cit9CisKK1BCX0RTX0NMQVNTX1RfREVDCit2b2lkCitQQl9EU19DTEFTU19DX0RFQzo6CittYWtlXzBfZXhwb3NlZCgpCit7CisgIGlmIChtX3JjLmVtcHR5KCkpCisgICAgcmV0dXJuOworCisgIG5vZGVfcG9pbnRlciBwX25kID0gbV9yYy50b3AoKTsKKworICBtX3JjLnBvcCgpOworCisgIF9HTElCQ1hYX0RFQlVHX0FTU0VSVChwX25kLT5tX3BfbmV4dF9zaWJsaW5nICE9IDApOworICBfR0xJQkNYWF9ERUJVR19BU1NFUlQocF9uZC0+bV9tZXRhZGF0YSA9PSBwX25kLT5tX3BfbmV4dF9zaWJsaW5nLT5tX21ldGFkYXRhKTsKKworICBub2RlX3BvaW50ZXIgcF9yZXMgPSBsaW5rX3dpdGhfbmV4dF9zaWJsaW5nKHBfbmQpOworCisgIGlmIChwX3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B7CisgICAgcHJpdmF0ZToKKyAgICAgIHR5cGVkZWYgX0FsbG9jIAkJCQkJIGFsbG9jYXRvcl90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBhbGxvY2F0b3JfdHlwZTo6c2l6ZV90eXBlIAkgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiBfTm9kZSAJCQkJCSBub2RlOworCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvYzo6dGVtcGxhdGUgcmViaW5kPG5vZGU+CSBfX3JlYmluZF9uOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX3JlYmluZF9uOjpvdGhlcjo6cG9pbnRlciAgICAgIAkgbm9kZV9wb2ludGVyOworCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvYzo6dGVtcGxhdGUgcmViaW5kPG5vZGVfcG9pbnRlcj4gIF9fcmViaW5kX25wOworCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fcmViaW5kX25wOjpvdGhlcjo6cG9pbnRlciAJIGVudHJ5X3BvaW50ZXI7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fcmViaW5kX25wOjpvdGhlcjo6Y29uc3RfcG9pbnRlciBlbnRyeV9jb25zdF9wb2ludGVyOworCisgICAgICBlbnVtCisJeworCSAgbWF4X2VudHJpZXMgPSBzaXplb2Yoc2l6ZV90eXBlKSA8PCAzCisJfTsKKworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgbm9kZV9wb2ludGVyIAkJCQkgZW50cnk7CisgICAgICB0eXBlZGVmIGVudHJ5X2NvbnN0X3BvaW50ZXIgCQkJIGNvbnN0X2l0ZXJhdG9yOworCisgICAgICByYygpOworCisgICAgICByYyhjb25zdCByYyYpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgc3dhcChyYyYpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgcHVzaChlbnRyeSk7CisKKyAgICAgIGlubGluZSBub2RlX3BvaW50ZXIKKy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AorICAgICAgcG9wKCk7CisKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKHBvaW50X2l0ZXJhdG9yKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIGNsZWFyKCk7CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFByZWQ+CisgICAgICBzaXplX3R5cGUKKyAgICAgIGVyYXNlX2lmKFByZWQpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgdm9pZAorICAgICAgc3BsaXQoUHJlZCwgUEJfRFNfQ0xBU1NfQ19ERUMmKTsKKworICAgICAgdm9pZAorICAgICAgam9pbihQQl9EU19DTEFTU19DX0RFQyYpOworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF92YWxpZChjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKyNlbmRpZgorCisjaWZkZWYgUEJfRFNfUkNfQklOT01JQUxfSEVBUF9UUkFDRV8KKyAgICAgIHZvaWQKKyAgICAgIHRyYWNlKCkgY29uc3Q7CisjZW5kaWYKKworICAgIHByaXZhdGU6CisKKyAgICAgIGlubGluZSBub2RlX3BvaW50ZXIKKyAgICAgIGxpbmtfd2l0aF9uZXh0X3NpYmxpbmcobm9kZV9wb2ludGVyKTsKKworICAgICAgdm9pZAorICAgICAgbWFrZV8wX2V4cG9zZWQoKTsKKworICAgICAgdm9pZAorICAgICAgbWFrZV9iaW5vbWlhbF9oZWFwKCk7CisKKyNpZmRlZiBfR0xJQkNYWF9ERUJVRworICAgICAgc3RhdGljIG5vZGVfY29uc3RfcG9pbnRlcgorICAgICAgbmV4dF8yX3BvaW50ZXIobm9kZV9jb25zdF9wb2ludGVyKTsKKworICAgICAgc3RhdGljIG5vZGVfY29uc3RfcG9pbnRlcgorICAgICAgbmV4dF9hZnRlcl8wX3BvaW50ZXIobm9kZV9jb25zdF9wb2ludGVyKTsKKyNlbmRpZgorCisgICAgICByY190IAkJC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zdGluY3Rfc2l6ZXNfNjRfYml0LAkKKyAgICB9OworCisgIC8vIE9yaWdpbmFsbHkgdGFrZW4gZnJvbSB0aGUgU0dJIGltcGxlbWVudGF0aW9uOyBhY2tub3dsZWRnZWQgaW4gdGhlIGRvY3MuCisgIC8vIEZ1cnRoZXIgbW9kaWZpZWQgKGZvciA2NCBiaXRzKSBmcm9tIHRyMSdzIGhhc2h0YWJsZS4KKyAgc3RhdGljIGNvbnN0IHN0ZDo6c2l6ZV90IGdfYV9zaXplc1tudW1fZGlzdGluY3Rfc2l6ZXNfNjRfYml0XSA9CisgICAgeworICAgICAgLyogMCAgICAgKi8gICAgICAgICAgICAgIDV1bCwKKyAgICAgIC8qIDEgICAgICovICAgICAgICAgICAgICAxMXVsLCAKKyAgICAgIC8qIDIgICAgICovICAgICAgICAgICAgICAyM3VsLCAKKyAgICAgIC8qIDMgICAgICovICAgICAgICAgICAgICA0N3VsLCAKKyAgICAgIC8qIDQgICAgICovICAgICAgICAgICAgICA5N3VsLCAKKyAgICAgIC8qIDUgICAgICovICAgICAgICAgICAgICAxOTl1bCwgCisgICAgICAvKiA2ICAgICAqLyAgICAgICAgICAgICAgNDA5dWwsIAorICAgICAgLyogNyAgICAgKi8gICAgICAgICAgICAgIDgyM3VsLCAKKyAgICAgIC8qIDggICAgICovICAgICAgICAgICAgICAxNzQxdWwsIAorICAgICAgLyogOSAgICAgKi8gICAgICAgICAgICAgIDM0Njl1bCwgCisgICAgICAvKiAxMCAgICAqLyAgICAgICAgICAgICAgNjk0OXVsLCAKKyAgICAgIC8qIDExICAgICovICAgICAgICAgICAgICAxNDAzM3VsLCAKKyAgICAgIC8qIDEyICAgICovICAgICAgICAgICAgICAyODQxMXVsLCAKKyAgICAgIC8qIDEzICAgICovICAgICAgICAgICAgICA1NzU1N3VsLCAKKyAgICAgIC8qIDE0ICAgICovICAgICAgICAgICAgICAxMTY3MzF1bCwgCisgICAgICAvKiAxNSAgICAqLyAgICAgICAgICAgICAgMjM2ODk3dWwsCisgICAgICAvKiAxNiAgICAqLyAgICAgICAgICAgICAgNDgwODgxdWwsIAorICAgICAgLyogMTcgICAgKi8gICAgICAgICAgICAgIDk3NjM2OXVsLAorICAgICAgLyogMTggICAgKi8gICAgICAgICAgICAgIDE5ODI2Mjd1bCwgCisgICAgICAvKiAxOSAgICAqLyAgICAgICAgICAgICAgNDAyNjAzMXVsLAorICAgICAgLyogMjAgICAgKi8gICAgICAgICAgICAgIDgxNzUzODN1bCwgCisgICAgICAvKiAyMSAgICAqLyAgICAgICAgICAgICAgMTY2MDE1OTN1bCwgCisgICAgICAvKiAyMiAgICAqLyAgICAgICAgICAgICAgMzM3MTI3Mjl1bCwKKyAgICAgIC8qIDIzICAgICovICAgICAgICAgICAgICA2ODQ2MDM5MXVsLCAKKyAgICAgIC8qIDI0ICAgICovICAgICAgICAgICAgICAxMzkwMjI0MTd1bCwgCisgICAgICAvKiAyNSAgICAqLyAgICAgICAgICAgICAgMjgyMzEyNzk5dWwsIAorICAgICAgLyogMjYgICAgKi8gICAgICAgICAgICAgIDU3MzI5MjgxN3VsLCAKKyAgICAgIC8qIDI3ICAgICovICAgICAgICAgICAgICAxMTY0MTg2MjE3dWwsCisgICAgICAvKiAyOCAgICAqLyAgICAgICAgICAgICAgMjM2NDExNDIxN3VsLCAKKyAgICAgIC8qIDI5ICAgICovICAgICAgICAgICAgICA0Mjk0OTY3MjkxdWwsCisgICAgICAvKiAzMCAgICAqLyAoc3RkOjpzaXplX3QpODU4OTkzNDU4M3VsbCwKKyAgICAgIC8qIDMxICAgICovIChzdGQ6OnNpemVfdCkxNzE3OTg2OTE0M3VsbCwKKyAgICAgIC8qIDMyICAgICovIChzdGQ6OnNpemVfdCkzNDM1OTczODMzN3VsbCwKKyAgICAgIC8qIDMzICAgICovIChzdGQ6OnNpemVfdCk2ODcxOTQ3NjczMXVsbCwKKyAgICAgIC8qIDM0ICAgICovIChzdGQ6OnNpemVfdCkxMzc0Mzg5NTM0NDd1bGwsCisgICAg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ZSByZXZlcnNlX2l0ZXJhdG9yCisgICAgICBlcmFzZShyZXZlcnNlX2l0ZXJhdG9yKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgUHJlZD4KKyAgICAgIGlubGluZSBzaXplX3R5cGUKKyAgICAgIGVyYXNlX2lmKFByZWQpOworCisgICAgICB2b2lkCisgICAgICBqb2luKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIHZvaWQKKyAgICAgIHNwbGl0KGtleV9jb25zdF9yZWZlcmVuY2UsIFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICBwcml2YXRlOgorICAgICAgaW5saW5lIHN0ZDo6cGFpcjxwb2ludF9pdGVyYXRvciwgYm9vbD4KKyAgICAgIGluc2VydF9sZWFmX2ltcChjb25zdF9yZWZlcmVuY2UpOworCisgICAgICBpbmxpbmUgbm9kZV9wb2ludGVyCisgICAgICBmaW5kX2ltcChrZXlfY29uc3RfcmVmZXJlbmNlKTsKKworICAgICAgaW5saW5lIGNvbnN0IG5vZGVfcG9pbnRlcgorICAgICAgZmluZF9pbXAoa2V5X2NvbnN0X3JlZmVyZW5jZSkgY29uc3Q7CisKKyNpZmRlZiBfR0xJQkNYWF9ERUJVRworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X3ZhbGlkKGNvbnN0IGNoYXIqIGZpbGUsIGludCBsaW5lKSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X3NwZWNpYWxfaW1wKGNvbnN0IG5vZGVfcG9pbnRlciwgY29uc3QgY2hhciogZmlsZSwgaW50IGxpbmUpIGNvbnN0OworI2VuZGlmCisKKyAgICAgIHZvaWQKKyAgICAgIHNwbGF5KG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBzcGxheV96aWdfemFnX2xlZnQobm9kZV9wb2ludGVyLCBub2RlX3BvaW50ZXIsIG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICB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isKKyAgICAgIHZvaWQKKyAgICAgIHBvcCgpOworCisgICAgICB2b2lkCisgICAgICBlcmFzZShwb2ludF9pdGVyYXRvcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBjbGVhcigpOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBQcmVkPgorICAgICAgc2l6ZV90eXBlCisgICAgICBlcmFzZV9pZihQcmVkKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgUHJlZD4KKyAgICAgIHZvaWQKKyAgICAgIHNwbGl0KFByZWQsIFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIHZvaWQKKyAgICAgIGpvaW4oUEJfRFNfQ0xBU1NfQ19ERUMmKTsKKworICAgIHByb3RlY3RlZDoKKyAgICAgIHRoaW5faGVhcCgpOworCisgICAgICB0aGluX2hlYXAoY29uc3QgQ21wX0ZuJik7CisKKyAgICAgIHRoaW5faGVhcChjb25zdCBQQl9EU19DTEFTU19DX0RFQyYpOworCisgICAgICB2b2lkCisgICAgICBzd2FwKFBCX0RTX0NMQVNTX0NfREVDJik7CisKKyAgICAgIH50aGluX2hlYXAoKTsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgSXQ+CisgICAgICB2b2lkCisgICAgICBjb3B5X2Zyb21fcmFuZ2UoSXQsIEl0KTsKKworI2lmZGVmIF9HTElCQ1hYX0RFQlVHCisgICAgICB2b2lkCisgICAgICBhc3NlcnRfdmFsaWQoY29uc3QgY2hhciosIGludCkgY29uc3Q7CisKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9tYXgoY29uc3QgY2hhciosIGludCkgY29uc3Q7CisjZW5kaWYKKworI2lmZGVmIFBCX0RTX1RISU5fSEVBUF9UUkFDRV8KKyAgICAgIHZvaWQKKyAgICAgIHRyYWNlKCkgY29uc3Q7CisjZW5kaWYKKworICAgIHByaXZhdGU6CisgICAgICBlbnVtCisJeworCSAgbWF4X3JhbmsgPSAoc2l6ZW9mKHNpemVfdHlwZSkgPDwgNCkgKyAyCisJfTsKKworICAgICAgdm9pZAorICAgICAgaW5pdGlhbGl6ZSgpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgdXBkYXRlX21heChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgZml4KG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBmaXhfcm9vdChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgZml4X3NpYmxpbmdfcmFua18xX3VubWFya2VkKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBmaXhfc2libGluZ19yYW5rXzFfbWFya2VkKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBmaXhfc2libGluZ19nZW5lcmFsX3VubWFya2VkKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBmaXhfc2libGluZ19nZW5lcmFsX21hcmtlZChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgZml4X2NoaWxkKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSBzdGF0aWMgdm9pZAorICAgICAgbWFrZV9yb290KG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBtYWtlX3Jvb3RfYW5kX2xpbmsobm9kZV9wb2ludGVyKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIHJlbW92ZV9tYXhfbm9kZSgpOworCisgICAgICB2b2lkCisgICAgICB0b19hdXhfZXhjZXB0X21heCgpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgYWRkX3RvX2F1eChub2RlX3BvaW50ZXIpOworCisgICAgICBpbmxpbmUgdm9pZAorICAgICAgbWFrZV9mcm9tX2F1eCgpOworCisgICAgICBpbmxpbmUgc2l6ZV90eXBlCisgICAgICByYW5rX2JvdW5kKCk7CisKKyAgICAgIGlubGluZSB2b2lkCisgICAgICBtYWtlX2NoaWxkX29mKG5vZGVfcG9pbnRlciwgbm9kZV9wb2ludGVyKTsKKworICAgICAgaW5saW5lIHZvaWQKKyAgICAgIHJlbW92ZV9ub2RlKG5vZGVfcG9pbnRlcik7CisKKyAgICAgIGlubGluZSBub2RlX3BvaW50ZXIKKyAgICAgIGpvaW4obm9kZV9wb2ludGVyLCBub2RlX3BvaW50ZXIpIGNvbnN0OworCisjaWZkZWYgX0dMSUJDWFhfREVCVUcKKyAgICAgIHZvaWQKKyAgICAgIGFzc2VydF9ub2RlX2NvbnNpc3RlbnQobm9kZV9jb25zdF9wb2ludGVyLCBib29sLCBjb25zdCBjaGFyKiwgaW50KSBjb25zdDsKKworICAgICAgdm9pZAorICAgICAgYXNzZXJ0X2F1eF9udWxsKGNvbnN0IGNoYXIqLCBpbnQpIGNvbnN0OworI2VuZGlmCisKKyAgICAgIG5vZGVfcG9pbnRlciAJbV9wX21heDsKKyAgICAgIG5vZGVfcG9pbnRlciAJbV9hX2F1eFttYXhfcmFua107CisgICAgfTsKKworICAgIGVudW0KKyAgICAgIHsKKwludW1fZGlzdGluY3RfcmFua19ib3VuZHMgPSA0OAorICAgICAgfTsKKworICAgIC8vIFRha2VuIGZyb20gdGhlIFNHSSBpbXBsZW1lbnRhdGlvbjsgYWNrbm93bGVkZ2VkIGluIHRoZSBkb2NzLgorICAgIHN0YXRpYyBjb25zdCBzdGQ6OnNpemVfdCBnX2FfcmFua19ib3VuZHNbbnVtX2Rpc3RpbmN0X3JhbmtfYm91bmRzXSA9CisgICAgICB7CisJLyogRGVhbGluZyBjYXJkcy4uLiAqLworCS8qIDAgICAgICovIDB1bCwKKwkvKiAxICAgICAqLyAxdWwsCisJLyogMiAgICAgKi8gMXVsLAorCS8qIDMgICAgICovIDJ1bCwKKwkvKiA0ICAgICAqLyA0dWwsCisJLyogNSAgICAgKi8gNnVsLAorCS8qIDYgICAgICovIDExdW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WluZWQgYnkgdGhlIFNpemVfUG9saWN5CisgICAgLy8vIG9iamVjdCkuCisgICAgdm9pZAorICAgIHJlc2l6ZShzaXplX3R5cGUgc3VnZ2VzdGVkX25ld19zaXplKTsKKworICBwcm90ZWN0ZWQ6CisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfaW5zZXJ0X3NlYXJjaF9zdGFydCgpOworCisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfaW5zZXJ0X3NlYXJjaF9jb2xsaXNpb24oKTsKKworICAgIGlubGluZSB2b2lkCisgICAgbm90aWZ5X2luc2VydF9zZWFyY2hfZW5kKCk7CisKKyAgICBpbmxpbmUgdm9pZAorICAgIG5vdGlmeV9maW5kX3NlYXJjaF9zdGFydCgpOworCisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfZmluZF9zZWFyY2hfY29sbGlzaW9uKCk7CisKKyAgICBpbmxpbmUgdm9pZAorICAgIG5vdGlmeV9maW5kX3NlYXJjaF9lbmQoKTsKKworICAgIGlubGluZSB2b2lkCisgICAgbm90aWZ5X2VyYXNlX3NlYXJjaF9zdGFydCgpOworCisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfZXJhc2Vfc2VhcmNoX2NvbGxpc2lvbigpOworCisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfZXJhc2Vfc2VhcmNoX2VuZCgpOworCisgICAgaW5saW5lIHZvaWQKKyAgICBub3RpZnlfaW5zZXJ0ZWQoc2l6ZV90eXBlIG51bV9lKTsKKworICAgIGlubGluZSB2b2lkCisgICAgbm90aWZ5X2VyYXNlZChzaXplX3R5cGUgbnVtX2UpOworCisgICAgdm9pZAorICAgIG5vdGlmeV9jbGVhcmVkKCk7CisKKyAgICB2b2lkCisgICAgbm90aWZ5X3Jlc2l6ZWQoc2l6ZV90eXBlIG5ld19zaXplKTsKKworICAgIGlubGluZSBib29sCisgICAgaXNfcmVzaXplX25lZWRlZCgpIGNvbnN0OworCisgICAgLy8vI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HR5cGVkZWYgc3RyZWFtb2ZmCQkJCW9mZl90eXBlOworCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgYXNzaWduKGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKQorICAgICAgeyBfX2MxID0gX19jMjsgfQorCisgICAgICBzdGF0aWMgYm9vbAorICAgICAgZXEoY29uc3QgY2hhcl90eXBlJiBfX2MxLCBjb25zdCBjaGFyX3R5cGUmIF9fYzIpCisgICAgICB7IHJldHVybiBfX2MxID09IF9fYzI7IH0KKworICAgICAgc3RhdGljIGJvb2wKKyAgICAgIGx0KGNvbnN0IGNoYXJfdHlwZSYgX19jMSwgY29uc3QgY2hhcl90eXBlJiBfX2MyKQorICAgICAgeyByZXR1cm4gX19jMSA8IF9fYzI7IH0KKworICAgICAgc3RhdGljIGludAorICAgICAgY29tcGFyZShjb25zdCBjaGFyX3R5cGUqIF9fczEsIGNvbnN0IGNoYXJfdHlwZSogX19zMiwgc2l6ZV90IF9fbikKKyAgICAgIHsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCSAgaWYgKCFlcShfX3MxW19faV0sIF9fczJbX19pXSkpCisJICAgIHJldHVybiBsdChfX3MxW19faV0sIF9fczJbX19pXSkgPyAtMSA6IDE7CisJcmV0dXJuIDA7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBzaXplX3QKKyAgICAgIGxlbmd0aChjb25zdCBjaGFyX3R5cGUqIF9fcykKKyAgICAgIHsKKwljb25zdCBjaGFyX3R5cGUqIF9fcCA9IF9fczsKKwl3aGlsZSAoX19wLT52YWx1ZSkKKwkgICsrX19wOworCXJldHVybiAoX19wIC0gX19zKTsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNvbnN0IGNoYXJfdHlwZSoKKyAgICAgIGZpbmQoY29uc3QgY2hhcl90eXBlKiBfX3MsIHNpemVfdCBfX24sIGNvbnN0IGNoYXJfdHlwZSYgX19hKQorICAgICAgeworCWZvciAoY29uc3QgY2hhcl90eXBlKiBfX3AgPSBfX3M7IHNpemVfdChfX3AgLSBfX3MpIDwgX19uOyArK19fcCkKKwkgIGlmICgqX19wID09IF9fYSkKKwkgICAgcmV0dXJuIF9fcDsKKwlyZXR1cm4gMDsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIG1vdmUoY2hhcl90eXBlKiBfX3MxLCBjb25zdCBjaGFyX3R5cGUqIF9fczIsIHNpemVfdCBfX24pCisgICAgICB7IAorCXJldHVybiBzdGF0aWNfY2FzdDxjaGFyX3R5cGUqPgorCSAgKF9fYnVpbHRpbl9tZW1tb3ZlKF9fczEsIF9fczIsIF9fbiAqIHNpemVvZihjaGFyX3R5cGUpKSk7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyBjaGFyX3R5cGUqCisgICAgICBjb3B5KGNoYXJfdHlwZSogX19zMSwgY29uc3QgY2hhcl90eXBlKiBfX3MyLCBzaXplX3QgX19uKQorICAgICAgeworCXN0ZDo6Y29weShfX3MyLCBfX3MyICsgX19uLCBfX3MxKTsKKwlyZXR1cm4gX19zMTsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZSoKKyAgICAgIGFzc2lnbihjaGFyX3R5cGUqIF9fcywgc2l6ZV90IF9fbiwgY2hhcl90eXBlIF9fYSkKKyAgICAgIHsKKwlzdGQ6OmZpbGxfbihfX3MsIF9fbiwgX19hKTsKKyAgICAgICAgcmV0dXJuIF9fczsKKyAgICAgIH0KKworICAgICAgc3RhdGljIGNoYXJfdHlwZQorICAgICAgdG9fY2hhcl90eXBlKGNvbnN0IGludF90eXBlJiBfX2kpCisgICAgICB7IHJldHVybiBjaGFyX3R5cGU6OnRlbXBsYXRlIGZyb20oX19pKTsgfQorCisgICAgICBzdGF0aWMgaW50X3R5cGUKKyAgICAgIHRvX2ludF90eXBlKGNvbnN0IGNoYXJfdHlwZSYgX19jKQorICAgICAgeyByZXR1cm4gY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aWdodCBiZSBtYXBwZWQgYXQgZGlmZmVyZW50IGFkZHJlc3NlcyBieSBkaWZmZXJlbnQgcHJvY2Vzc2VzLgorICAgKiBGb3IgbnVsbCBwb2ludGVycywgYSB2YWx1ZSBvZiAxIGlzIHVzZWQuICAoMCBpcyBsZWdpdGltYXRlCisgICAqIHNvbWV0aW1lcyBmb3Igbm9kZXMgaW4gY2lyY3VsYXJseSBsaW5rZWQgbGlzdHMpIFRoaXMgdmFsdWUgd2FzCisgICAqIGNob3NlbiBhcyB0aGUgbGVhc3QgbGlrZWx5IHRvIGdlbmVyYXRlIGFuIGluY29ycmVjdCBudWxsLCBBcworICAgKiB0aGVyZSBpcyBubyByZWFzb24gd2h5IGFueSBub3JtYWwgcG9pbnRlciB3b3VsZCBwb2ludCAxIGJ5dGUgaW50bworICAgKiBpdHMgb3duIHBvaW50ZXIgYWRkcmVzcy4KKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gCisgICAgY2xhc3MgX1JlbGF0aXZlX3BvaW50ZXJfaW1wbCAKKyAgICB7CisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfVHAgZWxlbWVudF90eXBlOworICAKKyAgICAgIF9UcCoKKyAgICAgIGdldCgpIGNvbnN0IAorICAgICAgeworICAgICAgICBpZiAoX01fZGlmZiA9PSAxKQorICAgICAgICAgIHJldHVybiAwOworICAgICAgICBlbHNlCisgICAgICAgICAgcmV0dXJuIHJlaW50ZXJwcmV0X2Nhc3Q8X1RwKj4ocmVpbnRlcnByZXRfY2FzdDxfVUludFB0clR5cGU+KHRoaXMpCisJCQkJCSsgX01fZGlmZik7CisgICAgICB9CisgIAorICAgICAgdm9pZCAKKyAgICAgIHNldChfVHAqIF9fYXJnKQorICAgICAgeworICAgICAgICBpZiAoIV9fYXJnKQorICAgICAgICAgIF9NX2RpZmYgPSAxOworICAgICAgICBlbHNlCisgICAgICAgICAgX01fZGlmZiA9IHJlaW50ZXJwcmV0X2Nhc3Q8X1VJbnR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V9wb2ludGVyX2ltcGwgbmVlZHMgYSBzcGVjaWFsaXphdGlvbiBmb3IgY29uc3QgVCBiZWNhdXNlIG9mCisgICAqIHRoZSBjYXN0aW5nIGRvbmUgZHVyaW5nIHBvaW50ZXIgYXJpdGhtZXRpYy4KKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gCisgICAgY2xhc3MgX1JlbGF0aXZlX3BvaW50ZXJfaW1wbDxjb25zdCBfVHA+IAorICAgIHsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIGNvbnN0IF9UcCBlbGVtZW50X3R5cGU7CisgIAorICAgICAgY29uc3QgX1RwKgorICAgICAgZ2V0KCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgaWYgKF9NX2RpZmYgPT0gMSkKKyAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgZWxzZQorICAgICAgICAgIHJldHVybiByZWludGVycHJldF9jYXN0PGNvbnN0IF9UcCo+CisJICAgICAgKHJlaW50ZXJwcmV0X2Nhc3Q8X1VJbnRQdHJUeXBlPih0aGlzKSArIF9NX2RpZmYpOworICAgICAgfQorICAKKyAgICAgIHZvaWQgCisgICAgICBzZXQoY29uc3QgX1RwKiBfX2FyZykKKyAgICAgIHsKKyAgICAgICAgaWYgKCFfX2FyZykKKyAgICAgICAgICBfTV9kaWZmID0gMTsKKyAgICAgICAgZWxzZQorICAgICAgICAgIF9NX2RpZmYgPSByZWludGVycHJldF9jYXN0PF9VSW50UHRyVHlwZT4oX19hcmcpIAorICAgICAgICAgICAgICAgICAgICAtIHJlaW50ZXJwcmV0X2Nhc3Q8X1VJbnRQdHJUeXBlPih0aGlzKTsKKyAgICAgIH0KKyAgCisgICAgICAvLyBDb21wYXJpc29uIG9mIHBvaW50ZXJzCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgb3BlcmF0b3I8KGNvbnN0IF9SZWxhdGl2ZV9wb2ludGVyX2ltcGwmIF9fcmFyZykgY29uc3QKKyAgICAgIHsgc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cD4mIF9fYXJnKQorICAgICAgICB7IF9TdG9yYWdlX3BvbGljeTo6c2V0KF9fYXJnLmdldCgpKTsgfQorCisgICAgICAvLyBEZXN0cnVjdG9yCisgICAgICB+X1BvaW50ZXJfYWRhcHRlcigpIHsgfQorICAKKyAgICAgIC8vIEFzc2lnbm1lbnQgb3BlcmF0b3IKKyAgICAgIF9Qb2ludGVyX2FkYXB0ZXImCisgICAgICBvcGVyYXRvcj0oY29uc3QgX1BvaW50ZXJfYWRhcHRlciYgX19hcmcpIAorICAgICAgeworICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfX2FyZy5nZXQoKSk7IAorICAgICAgICByZXR1cm4gKnRoaXM7IAorICAgICAgfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVXA+CisgICAgICAgIF9Qb2ludGVyX2FkYXB0ZXImCisgICAgICAgIG9wZXJhdG9yPShjb25zdCBfUG9pbnRlcl9hZGFwdGVyPF9VcD4mIF9fYXJnKQorICAgICAgICB7CisgICAgICAgICAgX1N0b3JhZ2VfcG9saWN5OjpzZXQoX19hcmcuZ2V0KCkpOyAKKyAgICAgICAgICByZXR1cm4gKnRoaXM7IAorICAgICAgICB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9VcD4KKyAgICAgICAgX1BvaW50ZXJfYWRhcHRlciYKKyAgICAgICAgb3BlcmF0b3I9KF9VcCogX19hcmcpCisgICAgICAgIHsKKyAgICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfX2FyZyk7IAorICAgICAgICAgIHJldHVybiAqdGhpczsgCisgICAgICAgIH0KKworICAgICAgLy8gT3BlcmF0b3IqLCByZXR1cm5zIGVsZW1lbnRfdHlwZSYKKyAgICAgIGlubGluZSByZWZlcmVuY2UgCisgICAgICBvcGVyYXRvciooKSBjb25zdCAKKyAgICAgIHsgcmV0dXJuICooX1N0b3JhZ2VfcG9saWN5OjpnZXQoKSk7IH0KKworICAgICAgLy8gT3BlcmF0b3ItPiwgcmV0dXJucyBlbGVtZW50X3R5cGUqCisgICAgICBpbmxpbmUgZWxlbWVudF90eXBlKiAKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdCAKKyAgICAgIHsgcmV0dXJuIF9TdG9yYWdlX3BvbGljeTo6Z2V0KCk7IH0KKworICAgICAgLy8gT3BlcmF0b3JbXSwgcmV0dXJucyBhIGVsZW1lbnRfdHlwZSYgdG8gdGhlIGl0ZW0gYXQgdGhhdCBsb2MuCisgICAgICBpbmxpbmUgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHN0ZDo6cHRyZGlmZl90IF9faW5kZXgpIGNvbnN0CisgICAgICB7IHJldHVybiBfU3RvcmFnZV9wb2xpY3k6OmdldCgpW19faW5kZXhdOyB9CisKKyAgICAgIC8vIFRvIGFsbG93IGltcGxpY2l0IGNvbnZlcnNpb24gdG8gImJvb2wiLCBmb3IgImlmIChwdHIpLi4uIgorICAgIHByaXZhdGU6CisgICAgICB0eXBlZGVmIGVsZW1lbnRfdHlwZSooX1BvaW50ZXJfYWRhcHRlcjo6Kl9fdW5zcGVjaWZpZWRfYm9vbF90eXBlKSgpIGNvbnN0OworCisgICAgcHVibGljOgorICAgICAgb3BlcmF0b3IgX191bnNwZWNpZmllZF9ib29sX3R5cGUoKSBjb25zdAorICAgICAgeworICAgICAgICByZXR1cm4gX1N0b3JhZ2VfcG9saWN5OjpnZXQoKSA9PSAwID8gMCA6IAorICAgICAgICAgICAgICAgICAgICAgICAgICZfUG9pbnRlcl9hZGFwdGVyOjpvcGVyYXRvci0+OyAKKyAgICAgIH0KKworICAgICAgLy8gISBvcGVyYXRvciAoZm9yOiBpZiAoIXB0cikuLi4pCisgICAgICBpbmxpbmUgYm9vbAorICAgICAgb3BlcmF0b3IhKCkgY29uc3QgCisgICAgICB7IHJldHVybiAoX1N0b3JhZ2VfcG9saWN5OjpnZXQoKSA9PSAwKTsgfQorICAKKyAgICAgIC8vIFBvaW50ZXIgZGlmZmVyZW5j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E9SX1NFVCh1bnNpZ25lZCBpbnQpOworICAgICAgX0NYWF9QT0lOVEVSX0FSSVRIX09QRVJBVE9SX1NFVChsb25nKTsKKyAgICAgIF9DWFhfUE9JTlRFUl9BUklUSF9PUEVSQVRPUl9TRVQodW5zaWduZWQgbG9uZyk7CisKKyAgICAgIC8vIE1hdGhlbWF0aWNhbCBNYW5pcHVsYXRvcnMKKyAgICAgIGlubGluZSBfUG9pbnRlcl9hZGFwdGVyJiAKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfU3RvcmFnZV9wb2xpY3k6OmdldCgpICsgMSk7IAorICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisgIAorICAgICAgaW5saW5lIF9Qb2ludGVyX2FkYXB0ZXIgCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKyAgICAgICAgX1BvaW50ZXJfYWRhcHRlciB0bXAoKnRoaXMpOworICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfU3RvcmFnZV9wb2xpY3k6OmdldCgpICsgMSk7CisgICAgICAgIHJldHVybiB0bXA7CisgICAgICB9CisgIAorICAgICAgaW5saW5lIF9Qb2ludGVyX2FkYXB0ZXImIAorICAgICAgb3BlcmF0b3ItLSgpIAorICAgICAgeworICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfU3RvcmFnZV9wb2xpY3k6OmdldCgpIC0gMSk7IAorICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisgIAorICAgICAgaW5saW5lIF9Qb2ludGVyX2FkYXB0ZXIKKyAgICAgIG9wZXJhdG9yLS0oaW50KSAKKyAgICAgIHsKKyAgICAgICAgX1BvaW50ZXJfYWRhcHRlciB0bXAoKnRoaXMpOworICAgICAgICBfU3RvcmFnZV9wb2xpY3k6OnNldChfU3RvcmFnZV9wb2xpY3k6OmdldCgpIC0gMSk7CisgICAgICAgIHJldHVybiB0bXA7CisgIC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IGFuIG9iamVjdCBvZiBzaXplIGV4YWN0bHkKKyAgICogICAgIF9TX3JvdW5kX3VwKHJlcXVlc3RlZF9zaXplKS4gIFRodXMgdGhlIGNsaWVudCBoYXMgZW5vdWdoIHNpemUKKyAgICogICAgIGluZm9ybWF0aW9uIHRoYXQgd2UgY2FuIHJldHVybiB0aGUgb2JqZWN0IHRvIHRoZSBwcm9wZXIgZnJlZSBsaXN0CisgICAqICAgICB3aXRob3V0IHBlcm1hbmVudGx5IGxvc2luZyBwYXJ0IG9mIHRoZSBvYmplY3QuCisgICAqLworICAgIGNsYXNzIF9fcG9vbF9hbGxvY19iYXNlCisgICAgeworICAgIHByb3RlY3RlZDoKKworICAgICAgZW51bSB7IF9TX2FsaWduID0gOCB9OworICAgICAgZW51bSB7IF9TX21heF9ieXRlcyA9IDEyOCB9OworICAgICAgZW51bSB7IF9TX2ZyZWVfbGlzdF9zaXplID0gKHNpemVfdClfU19tYXhfYnl0ZXMgLyAoc2l6ZV90KV9TX2FsaWduIH07CisgICAgICAKKyAgICAgIHVuaW9uIF9PYmoKKyAgICAgIHsKKwl1bmlvbiBfT2JqKiBfTV9mcmVlX2xpc3RfbGluazsKKwljaGFyICAgICAgICBfTV9jbGllbnRfZGF0YVsxXTsgICAgLy8gVGhlIGNsaWVudCBzZWVzIHRoaXMuCisgICAgICB9OworICAgICAgCisgICAgICBzdGF0aWMgX09iaiogdm9sYXRpbGUgICAgICAgICBfU19mcmVlX2xpc3RbX1NfZnJlZV9saXN0X3NpemVdOworCisgICAgICAvLyBDaHVuayBhbGxvY2F0aW9uIHN0YXRlLgorICAgICAgc3RhdGljIGNoYXIqICAgICAgICAgICAgICAgICAgX1Nfc3RhcnRfZnJlZTsKKyAgICAgIHN0YXRpYyBjaGFyKiAgICAgICAgICAgICAgICAgIF9TX2VuZF9mcmVlOworICAgICAgc3RhdGljIHNpemVfdCAgICAgICAgICAgICAgICAgX1NfaGVhcF9zaXplOyAgICAgCisgICAgICAKKyAgICAgIHNp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AgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbX1JlcF0KKyAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX01fbGVuZ3RoCisgICAqICAgW19fcmNfc3RyaW5nX2Jhc2U8Y2hhcl90eXBlPl0gICAgICAgIF9NX2NhcGFjaXR5CisgICAqICAgX01fZGF0YXBsdXMgICAgICAgICAgICAgICAgICAgICAgICAgIF9NX3JlZmNvdW50CisgICAqICAgX01fcCAtLS0tLS0tLS0tLS0tLS0tPiAgICAgICAgICAgICAgIHVubmFtZWQgYXJyYXkgb2YgY2hhcl90eXBlCisgICAqICBAZW5kY29kZQorICAgKgorICAgKiAgV2hlcmUgdGhlIF9NX3AgcG9pbnRzIHRvIHRoZSBmaXJzdCBjaGFyYWN0ZXIgaW4gdGhlIHN0cmluZywgYW5kCisgICAqICB5b3UgY2FzdCBpdCB0byBhIHBvaW50ZXItdG8tX1JlcCBhbmQgc3VidHJhY3QgMSB0byBnZXQgYQorICAgKiAgcG9pbnRlciB0byB0aGUgaGVhZGVyLgorICAgKgorICAgKiAgVGhpcyBhcHByb2FjaCBoYXMgdGhlIGVub3Jtb3VzIGFkdmFudGFnZSB0aGF0IGEgc3RyaW5nIG9iamVjdAorICAgKiAgcmVxdWlyZXMgb25seSBvbmUgYWxsb2NhdGlvbi4gIEFsbCB0aGUgdWdsaW5lc3MgaXMgY29uZmluZWQKKyAgICogIHdpdGhpbiBhIHNpbmdsZSBwYWlyIG9mIGlubGluZSBmdW5jdGlvbnMsIHdoaWNoIGVhY2ggY29tcGlsZSB0bworICAgKiAgYSBzaW5nbGUgQGEgYWRkIGluc3RydWN0aW9uOiBfUmVwOjpfTV9yZWZkYXRhKCksIGFuZAorICAgKiAgX19yY19zdHJpbmdfYmFzZTo6X01fcmVwKCk7IGFuZCB0aGUgYWxsb2NhdGlvbiBmdW5jdGlvbiB3aGljaCBnZXRzIGEKKyAgICogIGJsb2NrIG9mIHJhdyBieXR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nkgaXMgYWx3YXlzIChfTV9jYXBhY2l0eSArIDEpICogc2l6ZW9mKF9DaGFyVCkuCisgICAgICAvLyAgIDMuIF9NX3JlZmNvdW50IGhhcyB0aHJlZSBzdGF0ZXM6CisgICAgICAvLyAgICAgIC0xOiBsZWFrZWQsIG9uZSByZWZlcmVuY2UsIG5vIHJlZi1jb3BpZXMgYWxsb3dlZCwgbm9uLWNvbnN0LgorICAgICAgLy8gICAgICAgMDogb25lIHJlZmVyZW5jZSwgbm9uLWNvbnN0LgorICAgICAgLy8gICAgIG4+MDogbiArIDEgcmVmZXJlbmNlcywgb3BlcmF0aW9ucyByZXF1aXJlIGEgbG9jaywgY29uc3QuCisgICAgICAvLyAgIDQuIEFsbCBmaWVsZHMgPT0gMCBpcyBhbiBlbXB0eSBzdHJpbmcsIGdpdmVuIHRoZSBleHRyYSBzdG9yYWdlCisgICAgICAvLyAgICAgIGJleW9uZC10aGUtZW5kIGZvciBhIG51bGwgdGVybWluYXRvcjsgdGh1cywgdGhlIHNoYXJlZAorICAgICAgLy8gICAgICBlbXB0eSBzdHJpbmcgcmVwcmVzZW50YXRpb24gbmVlZHMgbm8gY29uc3RydWN0b3IuCisgICAgICBzdHJ1Y3QgX1JlcAorICAgICAgeworCXVuaW9uCisJeworCSAgc3RydWN0CisJICB7CisJICAgIHNpemVfdHlwZQkgICAgX01fbGVuZ3RoOworCSAgICBzaXplX3R5cGUJICAgIF9NX2NhcGFjaXR5OworCSAgICBfQXRvbWljX3dvcmQgICAgX01fcmVmY291bnQ7CisJICB9ICAgICAgICAgICAgICAgICBfTV9pbmZvOworCisJICAvLyBPbmx5IGZvciBhbGlnbm1lbnQgcHVycG9zZXMuCisJICBfQ2hhclQgICAgICAgICAgICBfTV9hbGlnbjsKKwl9OworCisJdHlwZWRlZiB0eXBlbmFtZSBfQWxsb2M6OnRlbXBsYXRlIHJlYmluZDxfUmVwPjo6b3RoZXIgX1JlcF9hbGxvY190eXBlOworCisgCV9DaGFyVCoKKwlfT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ZDo6Y29weShfX3guX01fYnVmZmVyLCBfX3guX01fYnVmZmVyICsgX194Ll9NX2J1Zl9jb3VudCwgX01fYnVmZmVyKTsKKyAgICAgIH0KKyAgICAgIAorICAgICAgc2VxdWVuY2VfYnVmZmVyKHNlcXVlbmNlX2J1ZmZlciYgX194KQorICAgICAgeworCV9feC5mbHVzaCgpOworCV9NX3ByZWZpeCA9IF9feC5fTV9wcmVmaXg7CisJX01fYnVmX2NvdW50ID0gMDsKKyAgICAgIH0KKyAgICAgIAorICAgICAgc2VxdWVuY2VfYnVmZmVyKF9TZXF1ZW5jZSYgX19zKQorICAgICAgOiBfTV9wcmVmaXgoJl9fcyksIF9NX2J1Zl9jb3VudCgwKSB7IH0KKyAgICAgIAorICAgICAgc2VxdWVuY2VfYnVmZmVyJgorICAgICAgb3BlcmF0b3I9KHNlcXVlbmNlX2J1ZmZlciYgX194KQorICAgICAgeworCV9feC5mbHVzaCgpOworCV9NX3ByZWZpeCA9IF9feC5fTV9wcmVmaXg7CisJX01fYnVmX2NvdW50ID0gMDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHNlcXVlbmNlX2J1ZmZlciYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBzZXF1ZW5jZV9idWZmZXImIF9feCkKKyAgICAgIHsKKwlfTV9wcmVmaXggPSBfX3guX01fcHJlZml4OworCV9NX2J1Zl9jb3VudCA9IF9feC5fTV9idWZfY291bnQ7CisJc3RkOjpjb3B5KF9feC5fTV9idWZmZXIsIF9feC5fTV9idWZmZXIgKyBfX3guX01fYnVmX2NvdW50LCBfTV9idWZmZXIpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgcHVzaF9iYWNrKHZhbHVlX3R5cGUgX194KQorICAgICAgeworCWlmIChfTV9idWZfY291bnQgPCBfQnVmX3N6KQorCSAgeworCSAgICBfTV9idWZmZXJbX01fYnVmX2NvdW50XSA9IF9feDsKKwkgICAgKytfTV9idWZfY291bnQ7CisJICB9CisJZWxzZQorCSAgeworCSAgICBmbHVzaCgpOworCSAgICBfTV9idWZmZXJbMF0gPSBfX3g7CisJICAgIF9NX2J1Zl9jb3VudCA9IDE7CisJICB9CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIGFwcGVuZCh2YWx1ZV90eXBlKiBfX3MsIHNpemVfdCBfX2xlbikKKyAgICAgIHsKKwlpZiAoX19sZW4gKyBfTV9idWZfY291bnQgPD0gX0J1Zl9zeikKKwkgIHsKKwkgICAgc2l6ZV90IF9faSA9IF9NX2J1Zl9jb3VudDsKKwkgICAgZm9yIChzaXplX3QgX19qID0gMDsgX19qIDwgX19sZW47IF9faSsrLCBfX2orKykKKwkgICAgICBfTV9idWZmZXJbX19pXSA9IF9fc1tfX2pdOworCSAgICBfTV9idWZfY291bnQgKz0gX19sZW47CisJICB9CisJZWxzZSBpZiAoMCA9PSBfTV9idWZfY291bnQpCisJICBfTV9wcmVmaXgtPmFwcGVuZChfX3MsIF9fcyArIF9fbGVuKTsKKwllbHNlCisJICB7CisJICAgIGZsdXNoKCk7CisJICAgIGFwcGVuZChfX3MsIF9fbGVuKTsKKwkgIH0KKyAgICAgIH0KKworICAgICAgc2VxdWVuY2VfYnVmZmVyJgorICAgICAgd3JpdGUodmFsdWVfdHlwZSogX19zLCBzaXplX3QgX19sZW4pCisgICAgICB7CisJYXBwZW5kKF9fcywgX19sZW4pOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIAorICAgICAgc2VxdWVuY2VfYnVmZmVyJgorICAgICAgcHV0KHZhbHVlX3R5cGUgX194KQorICAgICAgeworCXB1c2hfYmFjayhfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIAorICAgICAgc2VxdWVuY2VfYnVmZmVyJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHZhbHVlX3R5cGUmIF9fcmhzKQorICAgICAgeworCXB1c2hfYmFjayhfX3Jocy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19DT05TVCBfQ2hhclQqIF9NX2Nfc3RyaW5nOworI2lmZGVmIF9fR1RIUkVBRF9NVVRFWF9JTklUCisgICAgICBfX2d0aHJlYWRfbXV0ZXhfdCBfTV9jX3N0cmluZ19sb2NrID0gX19HVEhSRUFEX01VVEVYX0lOSVQ7CisjZWxzZQorICAgICAgX19ndGhyZWFkX211dGV4X3QgX01fY19zdHJpbmdfbG9jazsKKyNlbmRpZgorICAgICAgICAgICAgICAgICAgICAgICAgLyogRmxhdHRlbmVkIHZlcnNpb24gb2Ygc3RyaW5nLCBpZiBuZWVkZWQuICAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogdHlwaWNhbGx5IDAuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogSWYgaXQncyBub3QgMCwgdGhlbiB0aGUgbWVtb3J5IGlzIG93bmVkICAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogYnkgdGhpcyBub2RlLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogSW4gdGhlIGNhc2Ugb2YgYSBsZWFmLCB0aGlzIG1heSBwb2ludCB0byAqLworICAgICAgICAgICAgICAgICAgICAgICAgLyogdGhlIHNhbWUgbWVtb3J5IGFzIHRoZSBkYXRhIGZpZWxkLiAgICAgICAqLworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfUm9wZV9yZXBfYmFzZTxfQ2hhclQsIF9BbGxvYz46OmFsbG9jYXRvcl90eXBlCisgICAgICAgIGFsbG9jYXRvcl90eXBlOworCisgICAgICB1c2luZyBfUm9wZV9yZXBfYmFzZTxfQ2hhclQsIF9BbGxvYz46OmdldF9hbGxvY2F0b3I7CisgICAgICB1c2luZyBfUm9wZV9yZXBfYmFzZTxfQ2hhclQsIF9BbGxvYz46Ol9NX2dldF9hbGxvY2F0b3I7CisKKyAgICAgIF9Sb3BlX1JvcGVSZXAoX19kZXRhaWw6Ol9UYW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JkIHRvIGRvIGFueXRoaW5nIGVsc2UgYXQgdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBtb21lbnQsIGJlY2F1c2UgaXQncyB0ZW1wbGF0aXplZCB3LnIudC4KKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFuIGFsbG9jYXRvci4KKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIERvZXMgbm90aGluZyBpZiBfX0dDIGlzIGRlZmluZWQuCisjaWZuZGVmIF9fR0MKKyAgICAgIHZvaWQgX01fZnJlZV9jX3N0cmluZygpOworICAgICAgdm9pZCBfTV9mcmVlX3RyZWUoKTsKKyAgICAgIC8vIERlYWxsb2NhdGUgdC4gQXNzdW1lcyB0IGlzIG5vdCAwLgorICAgICAgdm9pZAorICAgICAgX01fdW5yZWZfbm9ubmlsKCkKKyAgICAgIHsKKwlpZiAoMCA9PSBfTV9kZWNyKCkpCisJICBfTV9mcmVlX3RyZWUoKTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fcmVmX25vbm5pbCgpCisgICAgICB7IF9NX2luY3IoKTsgfQorCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgX1NfdW5yZWYoX1JvcGVfUm9wZVJlcCogX190KQorICAgICAgeworCWlmICgwICE9IF9fdCkKKwkgIF9fdC0+X01fdW5yZWZfbm9ubmlsKCk7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyB2b2lkCisgICAgICBfU19yZWYoX1JvcGVfUm9wZVJlcCogX190KQorICAgICAgeworCWlmICgwICE9IF9fdCkKKwkgIF9fdC0+X01faW5jcigpOworICAgICAgfQorICAgICAgCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgX1NfZnJlZV9pZl91bnJlZihfUm9wZV9Sb3BlUmVwKiBfX3QpCisgICAgICB7CisJaWYgKDAgIT0gX190ICYmIDAgPT0gX190LT5fTV9yZWZfY291bnQpCisJICBfX3QtPl9NX2ZyZWVfdHJlZSgpOworICAgICAgfQorIyAgIGVsc2UgLyog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ZV90IF9fbikKKyAgICAgIHsKKyAgICAgICAgc2l6ZV90IF9fc2l6ZV93aXRoX2VvczsKKwkKKyAgICAgICAgaWYgKF9TX2lzX2Jhc2ljX2NoYXJfdHlwZSgoX0NoYXJUKikwKSkKKwkgIF9fc2l6ZV93aXRoX2VvcyA9IF9fbiArIDE7CisJZWxzZQorCSAgX19zaXplX3dpdGhfZW9zID0gX19uOworI2lmZGVmIF9fR0MKKwlyZXR1cm4gX19zaXplX3dpdGhfZW9zOworI2Vsc2UKKwkvLyBBbGxvdyBzbG9wIGZvciBpbi1wbGFjZSBleHBhbnNpb24uCisJcmV0dXJuICgoX19zaXplX3dpdGhfZW9zICsgc2l6ZV90KF9TX2FsbG9jX2dyYW51bGFyaXR5KSAtIDEpCisJCSZ+IChzaXplX3QoX1NfYWxsb2NfZ3JhbnVsYXJpdHkpIC0gMSkpOworI2VuZGlmCisgICAgICB9CisgICAgICBfX0dDX0NPTlNUIF9DaGFyVCogX01fZGF0YTsgLyogTm90IG5lY2Vzc2FyaWx5IDAgdGVybWluYXRlZC4gKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBUaGUgYWxsb2NhdGVkIHNpemUgaXMgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIF9TX3JvdW5kZWRfdXBfc2l6ZShzaXplKSwgZXhjZXB0ICovCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogaW4gdGhlIEdDIGNhc2UsIGluIHdoaWNoIGl0ICAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBkb2Vzbid0IG1hdHRlci4gICAgICAgICAgICAgICAqLworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfUm9wZV9yZXBfYmFzZTxfQ2hhclQsX0FsbG9jPjo6YWxsb2NhdG9yX3R5cGUKKyAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisKKyAgICAgIF9Sb3BlX1JvcGVMZW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9yIGN1cnJlbnQgbGVhZgorICAgICAgX19HQ19DT05TVCBfQ2hhclQqIF9NX2J1Zl9zdGFydDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQnVmZmVyIHBvc3NpYmx5CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnRhaW5pbmcgY3VycmVudCBjaGFyLgorICAgICAgX19HQ19DT05TVCBfQ2hhclQqIF9NX2J1Zl9wdHI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFBvaW50ZXIgdG8gY3VycmVudCBjaGFyIGluIGJ1ZmZlci4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gIT0gMCA9PT4gYnVmZmVyIHZhbGlkLgorICAgICAgX19HQ19DT05TVCBfQ2hhclQqIF9NX2J1Zl9lbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE9uZSBwYXN0IF9fbGFzdCB2YWxpZCBjaGFyIGluIGJ1ZmZlci4KKyAgICAgIC8vIFdoYXQgZm9sbG93cyBpcyB0aGUgcGF0aCBjYWNoZS4gIFdlIGdvIG91dCBvZiBvdXIKKyAgICAgIC8vIHdheSB0byBtYWtlIHRoaXMgY29tcGFjdC4KKyAgICAgIC8vIFBhdGhfZW5kIGNvbnRhaW5zIHRoZSBib3R0b20gc2VjdGlvbiBvZiB0aGUgcGF0aCBmcm9tCisgICAgICAvLyB0aGUgcm9vdCB0byB0aGUgY3VycmVudCBsZWFmLgorICAgICAgY29uc3QgX1JvcGVSZXAqIF9NX3BhdGhfZW5kW19TX3BhdGhfY2FjaGVfbGVuXTsKKyAgICAgIGludCBfTV9sZWFmX2luZGV4OyAgICAgLy8gTGFzdCB2YWxpZCBfX3BvcyBpbiBwYXRoX2VuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gX01fcGF0aF9lbmRbMF0gLi4uIF9NX3BhdGhfZW5kW2xlYWZfaW5kZXgtMV0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcG9pbnQgdG8gY29uY2F0ZW5hdGlvbiBub2Rlcy4KKyAgICAgIHVuc2lnbmVkIGNoYXIgX01fcGF0aF9kaXJlY3Rpb25zOworICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAocGF0aF9kaXJlY3Rpb25zID4+IF9faSkgJiAxIGlzIDEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaWZmIHdlIGdvdCBmcm9tIF9NX3BhdGhfZW5kW2xlYWZfaW5kZXggLSBfX2kgLSAxXQorICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0byBfTV9wYXRoX2VuZFtsZWFmX2luZGV4IC0gX19pXSBieSBnb2luZyB0byB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gX19yaWdodC4gQXNzdW1lcyBwYXRoX2NhY2hlX2xlbiA8PSA5LgorICAgICAgX0NoYXJUIF9NX3RtcF9idWZbX1NfaXRlcmF0b3JfYnVmX2xlbl07CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBTaG9ydCBidWZmZXIgZm9yIHN1cnJvdW5kaW5nIGNoYXJzLgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyB1c2VmdWwgcHJpbWFyaWx5IGZvcgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gUm9wZUZ1bmN0aW9ucy4gIFdlIHB1dCB0aGUgYnVmZmVyCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBoZXJlIHRvIGF2b2lkIGxvY2tpbmcgaW4gdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBtdWx0aXRocmVhZGVkIGNhc2UuCisgICAgICAvLyBUaGUgY2FjaGVkIHBhdGggaXMgZ2VuZXJhbGx5IGFzc3VtZWQgdG8gYmUgdmFsaWQKKyAgICAgIC8vIG9ubHkgaWYgdGhlIGJ1ZmZlciBpcyB2YWxpZC4KKyAgICAgIHN0YXRpYyB2b2lkIF9TX3NldGJ1ZihfUm9wZV9pdGVyYXRvcl9iYXNlJiBfX3gpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFNldCBidWZmZXIgY29udGVudHMgZ2l2ZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBwYXRoIGNhY2hlLgorICAgICAgc3RhdGljIHZvaWQgX1Nfc2V0Y2FjaGUoX1JvcGVfaXRlcmF0b3JfYmFzZSYgX194KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBTZXQgYnVmZmVyIGNvbnRlbnRzIGFuZAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHBhdGggY2FjaGUuCisgICAgICBzdGF0aWMgdm9pZCBfU19zZXRjYWNoZV9mb3JfaW5jcihfUm9wZV9pdGVyYXRvcl9iYXNlJiBfX3gpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFzIGFib3ZlLCBidXQgYXNzdW1lcyBwYXRoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2FjaGUgaXMgdmFsaWQgZm9yIHByZXZpb3VzIHBvc24uCisgICAgICBfUm9wZV9pdGVyYXRvcl9iYXNlKCkgeyB9CisKKyAgICAgIF9Sb3BlX2l0ZXJhdG9yX2Jhc2UoX1JvcGVSZXAqIF9fcm9vdCwgc2l6ZV90IF9fcG9zKQorICAgICAgOiBfTV9jdXJyZW50X3BvcyhfX3BvcyksIF9NX3Jvb3QoX19yb290KSwgX01fYnVmX3B0cigwKSB7IH0KKworICAgICAgdm9pZCBfTV9pbmNyKHNpemVfdCBfX24pOworICAgICAgdm9pZCBfTV9kZWNyKHNpemVfdCBfX24pOworICAgIHB1YmxpYzoKKyAgICAgIHNpemVfdAorICAgICAgaW5kZXgoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fY3VycmVudF9wb3M7IH0KKyAgICAKKyAgICAgIF9Sb3BlX2l0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BlX2l0ZXJhdG9yX2Jhc2U8X0NoYXJULCBfQWxsb2M+Kj4odGhpcykpID0gX194OworCWVsc2UKKwkgIHsKKyAgICAgICAgICAgIHRoaXMtPl9NX2N1cnJlbnRfcG9zID0gX194Ll9NX2N1cnJlbnRfcG9zOworICAgICAgICAgICAgdGhpcy0+X01fcm9vdCA9IF9feC5fTV9yb290OworICAgICAgICAgICAgdGhpcy0+X01fYnVmX3B0ciA9IDA7CisJICB9CisgICAgICAgIHJldHVybigqdGhpcyk7CisgICAgICB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkKKyAgICAgIHsKKyAgICAgICAgaWYgKDAgPT0gdGhpcy0+X01fYnVmX3B0cikKKwkgIHRoaXMtPl9TX3NldGNhY2hlKCp0aGlzKTsKKyAgICAgICAgcmV0dXJuICp0aGlzLT5fTV9idWZfcHRyOworICAgICAgfQorCisgICAgICAvLyBXaXRob3V0IHRoaXMgY29uc3QgdmVyc2lvbiwgUm9wZSBpdGVyYXRvcnMgZG8gbm90IG1lZXQgdGhlCisgICAgICAvLyByZXF1aXJlbWVudHMgb2YgYW4gSW5wdXQgSXRlcmF0b3IuCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7CisJcmV0dXJuICpjb25zdF9jYXN0PF9Sb3BlX2NvbnN0X2l0ZXJhdG9yJj4oKnRoaXMpOworICAgICAgfQorCisgICAgICBfUm9wZV9jb25zdF9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworICAgICAgICBfX0dDX0NPTlNUIF9DaGFyVCogX19uZXh0OworICAgICAgICBpZiAoMCAhPSB0aGlzLT5fTV9idWZfcHRyCisJICAgICYmIChfX25leHQgPSB0aGlzLT5fTV9idWZfcHRyICsgMSkgPCB0aGlzLT5fTV9idWZfZW5kKQorCSAgeworICAgICAgICAgICAgdGhpcy0+X01fYnVmX3B0ciA9IF9fbmV4dDsKKyAgICAgICAgICAgICsrdGhpcy0+X01fY3VycmVudF9wb3M7CisJICB9CisJZWxzZQorCSAgdGhpcy0+X01faW5jcigxKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9Sb3BlX2NvbnN0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3IrPShwdHJkaWZmX3QgX19uKQorICAgICAgeworICAgICAgICBpZiAoX19uID49IDApCisJICB0aGlzLT5fTV9pbmNyKF9fbik7CisJZWxzZQorCSAgdGhpcy0+X01fZGVjcigtX19uKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9Sb3BlX2NvbnN0X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3ItLSgpCisgICAgICB7CisgICAgICAgIHRoaXMtPl9NX2RlY3IoMSk7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1JvcGVfY29uc3RfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvci09KHB0cmRpZmZfdCBfX24pCisgICAgICB7CisgICAgICAgIGlmIChfX24gPj0gMCkKKwkgIHRoaXMtPl9NX2RlY3IoX19uKTsKKwllbHNlCisJICB0aGlzLT5fTV9pbmNyKC1fX24pOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX1JvcGVfY29uc3RfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeworICAgICAgICBzaXplX3QgX19vbGRfcG9zID0gdGhpcy0+X01fY3VycmVudF9wb3M7CisgICAgICAgIHRoaXMtPl9NX2luY3IoMSk7CisgICAgICAgIHJldHVybiBfUm9wZV9jb25zdF9pdGVyYXRvcjxfQ2hhclQsX0FsbG9jPih0aGlzLT5fTV9yb290LCBfX29sZF9wb3MpOworICAgICAgICAvLyBUaGlzIG1ha2VzIGEgc3Vic2VxdWVudCBkZXJlZmVyZW5jZSBleHBlbnNpdmUuCisgICAgICAgIC8vIFBlcmhhcHMgd2Ugc2hvdW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mF0b3I9KGNvbnN0IF9Sb3BlX2l0ZXJhdG9yJiBfX3gpCisgICAgICB7CisgICAgICAgIF9Sb3BlUmVwKiBfX29sZCA9IHRoaXMtPl9NX3Jvb3Q7CisJCisgICAgICAgIF9Sb3BlUmVwOjpfU19yZWYoX194Ll9NX3Jvb3QpOworICAgICAgICBpZiAoMCAhPSBfX3guX01fYnVmX3B0cikKKwkgIHsKKyAgICAgICAgICAgIF9NX3Jvb3Rfcm9wZSA9IF9feC5fTV9yb290X3JvcGU7CisgICAgICAgICAgICAqKHN0YXRpY19jYXN0PF9Sb3BlX2l0ZXJhdG9yX2Jhc2U8X0NoYXJULCBfQWxsb2M+Kj4odGhpcykpID0gX194OworCSAgfQorCWVsc2UKKwkgIHsKKwkgICAgdGhpcy0+X01fY3VycmVudF9wb3MgPSBfX3guX01fY3VycmVudF9wb3M7CisgICAgICAgICAgICB0aGlzLT5fTV9yb290ID0gX194Ll9NX3Jvb3Q7CisgICAgICAgICAgICBfTV9yb290X3JvcGUgPSBfX3guX01fcm9vdF9yb3BlOworICAgICAgICAgICAgdGhpcy0+X01fYnVmX3B0ciA9IDA7CisJICB9CisgICAgICAgIF9Sb3BlUmVwOjpfU191bnJlZihfX29sZCk7CisgICAgICAgIHJldHVybigqdGhpcyk7CisgICAgICB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3IqKCkKKyAgICAgIHsKKyAgICAgICAgX01fY2hlY2soKTsKKyAgICAgICAgaWYgKDAgPT0gdGhpcy0+X01fYnVmX3B0cikKKwkgIHJldHVybiBfUm9wZV9jaGFyX3JlZl9wcm94eTxfQ2hhclQsIF9BbGxvYz4oX01fcm9vdF9yb3BlLAorCQkJCQkJICAgICAgdGhpcy0+X01fY3VycmVudF9wb3MpOworCWVsc2UKKwkgIHJldHVybiBfUm9wZV9jaGFyX3JlZl9wcm94eTxfQ2hhclQsIF9BbGxvYz4oX01fcm9vdF9yb3BlLAorCQkJCQkJICAgICAgdGhpcy0+X01fY3VycmVudF9wb3MsCisJCQkJCQkgICAgICAqdGhpcy0+X01fYnVmX3B0cik7CisgICAgICB9CisKKyAgICAgIC8vIFNlZSBhYm92ZSBjb21tZW50LgorICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvciooKSBjb25zdAorICAgICAgeworCXJldHVybiAqY29uc3RfY2FzdDxfUm9wZV9pdGVyYXRvciY+KCp0aGlzKTsKKyAgICAgIH0KKworICAgICAgX1JvcGVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsKKyAgICAgICAgdGhpcy0+X01faW5jcigxKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfUm9wZV9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yKz0ocHRyZGlmZl90IF9fbikKKyAgICAgIHsKKyAgICAgICAgaWYgKF9fbiA+PSAwKQorCSAgdGhpcy0+X01faW5jcihfX24pOworCWVsc2UKKwkgIHRoaXMtPl9NX2RlY3IoLV9fbik7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfUm9wZV9pdGVyYXRvciYKKyAgICAgIG9wZXJhdG9yLS0oKQorICAgICAgeworICAgICAgICB0aGlzLT5fTV9kZWNyKDEpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9Sb3BlX2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3ItPShwdHJkaWZmX3QgX19uKQorICAgICAgeworICAgICAgICBpZiAoX19uID49IDApCisJICB0aGlzLT5fTV9kZWNyKF9fbik7CisJZWxzZQorCSAgdGhpcy0+X01faW5jcigtX19uKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9Sb3BlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKyAgICAgICAgc2l6ZV90IF9fb2xkX3BvcyA9IHRoaXMtPl9NX2N1cnJlbnRfcG9zOworICAgICAgICB0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B2b2lkIF9TX2FkZF90b19mb3Jlc3QoX1JvcGVSZXAqX19yLCBfUm9wZVJlcCoqIF9fZm9yZXN0KTsKKworICAgICAgLy8gQWRkIF9fciB0byBmb3Jlc3QsIGFzc3VtaW5nIF9fciBpcyBhbHJlYWR5IGJhbGFuY2VkLgorICAgICAgc3RhdGljIHZvaWQgX1NfYWRkX2xlYWZfdG9fZm9yZXN0KF9Sb3BlUmVwKiBfX3IsIF9Sb3BlUmVwKiogX19mb3Jlc3QpOworICAgICAgCisgICAgICAvLyBQcmludCB0byBzdGRvdXQsIGV4cG9zaW5nIHN0cnVjdHVyZQorICAgICAgc3RhdGljIHZvaWQgX1NfZHVtcChfUm9wZVJlcCogX19yLCBpbnQgX19pbmRlbnQgPSAwKTsKKyAgICAgIAorICAgICAgLy8gUmV0dXJuIC0xLCAwLCBvciAxIGlmIF9feCA8IF9feSwgX194ID09IF9feSwgb3IgX194ID4gX195IHJlc3AuCisgICAgICBzdGF0aWMgaW50IF9TX2NvbXBhcmUoY29uc3QgX1JvcGVSZXAqIF9feCwgY29uc3QgX1JvcGVSZXAqIF9feSk7CisgICAgICAKKyAgICBwdWJsaWM6CisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiAwID09IHRoaXMtPl9NX3RyZWVfcHRyOyB9CisgICAgICAKKyAgICAgIC8vIENvbXBhcmlzb24gbWVtYmVyIGZ1bmN0aW9uLiAgVGhpcyBpcyBwdWJsaWMgb25seSBmb3IgdGhvc2UKKyAgICAgIC8vIGNsaWVudHMgdGhhdCBuZWVkIGEgdGVybmFyeSBjb21wYXJpc29uLiAgT3RoZXJzCisgICAgICAvLyBzaG91bGQgdXNlIHRoZSBjb21wYXJpc29uIG9wZXJhdG9ycyBiZWxvdy4KKyAgICAgIGludAorICAgICAgY29tcGFyZShjb25zdCByb3BlJiBfX3kpIGNvbnN0CisgICAgICB7IHJldHVybiBfU19jb21wYXJlKHRoaXMtPl9NX3RyZWVfcHRy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SYKKyAgICAgIG9wZXJhdG9yPShjb25zdCByb3BlJiBfX3gpCisgICAgICB7CisJX1JvcGVSZXAqIF9fb2xkID0gdGhpcy0+X01fdHJlZV9wdHI7CisJdGhpcy0+X01fdHJlZV9wdHIgPSBfX3guX01fdHJlZV9wdHI7CisJX1NfcmVmKHRoaXMtPl9NX3RyZWVfcHRyKTsKKwlfU191bnJlZihfX29sZCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpCisgICAgICB7CisJX1NfdW5yZWYodGhpcy0+X01fdHJlZV9wdHIpOworCXRoaXMtPl9NX3RyZWVfcHRyID0gMDsKKyAgICAgIH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgcHVzaF9iYWNrKF9DaGFyVCBfX3gpCisgICAgICB7CisJX1JvcGVSZXAqIF9fb2xkID0gdGhpcy0+X01fdHJlZV9wdHI7CisJdGhpcy0+X01fdHJlZV9wdHIKKwkgID0gX1NfZGVzdHJfY29uY2F0X2NoYXJfaXRlcih0aGlzLT5fTV90cmVlX3B0ciwgJl9feCwgMSk7CisJX1NfdW5yZWYoX19vbGQpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBwb3BfYmFjaygpCisgICAgICB7CisJX1JvcGVSZXAqIF9fb2xkID0gdGhpcy0+X01fdHJlZV9wdHI7CisJdGhpcy0+X01fdHJlZV9wdHIgPSBfU19zdWJzdHJpbmcodGhpcy0+X01fdHJlZV9wdHIsCisJCQkJCSAwLCB0aGlzLT5fTV90cmVlX3B0ci0+X01fc2l6ZSAtIDEpOworCV9TX3VucmVmKF9fb2xkKTsKKyAgICAgIH0KKworICAgICAgX0NoYXJUCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9TX2ZldGNoKHRoaXMtPl9NX3RyZWVfcHRyLCB0aGlzLT5fTV90cmVlX3B0ci0+X01fc2l6ZSAtIDEpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHB1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VsdDsKKworCWlmICgwID09IF9fcikKKwkgIF9fcmVzdWx0ID0gX1NfY29uY2F0KF9fbGVmdCwgX19yaWdodCk7CisJZWxzZQorCSAgeworCSAgICBfU2VsZl9kZXN0cnVjdF9wdHIgX19sZWZ0X3Jlc3VsdChfU19jb25jYXQoX19sZWZ0LCBfX3IpKTsKKwkgICAgX19yZXN1bHQgPSBfU19jb25jYXQoX19sZWZ0X3Jlc3VsdCwgX19yaWdodCk7CisJICB9CisJcmV0dXJuIF9fcmVzdWx0OworICAgICAgfQorCisgICAgcHVibGljOgorICAgICAgdm9pZAorICAgICAgaW5zZXJ0KHNpemVfdCBfX3AsIGNvbnN0IHJvcGUmIF9fcikKKyAgICAgIHsKKwlfUm9wZVJlcCogX19yZXN1bHQgPQorCSAgcmVwbGFjZSh0aGlzLT5fTV90cmVlX3B0ciwgX19wLCBfX3AsIF9fci5fTV90cmVlX3B0cik7CisJX1NfdW5yZWYodGhpcy0+X01fdHJlZV9wdHIpOworCXRoaXMtPl9NX3RyZWVfcHRyID0gX19yZXN1bHQ7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIGluc2VydChzaXplX3QgX19wLCBzaXplX3QgX19uLCBfQ2hhclQgX19jKQorICAgICAgeworCXJvcGU8X0NoYXJULF9BbGxvYz4gX19yKF9fbixfX2MpOworCWluc2VydChfX3AsIF9fcik7CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIGluc2VydChzaXplX3QgX19wLCBjb25zdCBfQ2hhclQqIF9faSwgc2l6ZV90IF9fbikKKyAgICAgIHsKKwlfU2VsZl9kZXN0cnVjdF9wdHIgX19sZWZ0KF9TX3N1YnN0cmluZyh0aGlzLT5fTV90cmVlX3B0ciwgMCwgX19wKSk7CisJX1NlbGZfZGVzdHJ1Y3RfcHRyIF9fcmlnaHQoX1Nfc3Vic3RyaW5nKHRoaXMtPl9NX3RyZWVfcHRyLAorCQkJCQkJX19wLCBzaXplKCkpKTsKKwlfU2VsZl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fX2MpOworCXJlcGxhY2UoX19wLCBfX24sIF9fcik7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2Uoc2l6ZV90IF9fcCwgc2l6ZV90IF9fbiwgY29uc3QgX0NoYXJUKiBfX2Nfc3RyaW5nKQorICAgICAgeworCXJvcGUgX19yKF9fY19zdHJpbmcpOworCXJlcGxhY2UoX19wLCBfX24sIF9fcik7CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2Uoc2l6ZV90IF9fcCwgc2l6ZV90IF9fbiwKKwkgICAgICBjb25zdCBfQ2hhclQqIF9faSwgY29uc3QgX0NoYXJUKiBfX2opCisgICAgICB7CisJcm9wZSBfX3IoX19pLCBfX2opOworCXJlcGxhY2UoX19wLCBfX24sIF9fcik7CisgICAgICB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2Uoc2l6ZV90IF9fcCwgc2l6ZV90IF9fbiwKKwkgICAgICBjb25zdCBjb25zdF9pdGVyYXRvciYgX19pLCBjb25zdCBjb25zdF9pdGVyYXRvciYgX19qKQorICAgICAgeworCXJvcGUgX19yKF9faSwgX19qKTsKKwlyZXBsYWNlKF9fcCwgX19uLCBfX3IpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICByZXBsYWNlKHNpemVfdCBfX3AsIHNpemVfdCBfX24sCisJICAgICAgY29uc3QgaXRlcmF0b3ImIF9faSwgY29uc3QgaXRlcmF0b3ImIF9faikKKyAgICAgIHsKKwlyb3BlIF9fcihfX2ksIF9faik7CisJcmVwbGFjZShfX3AsIF9fbiwgX19yKTsKKyAgICAgIH0KKworICAgICAgLy8gU2luZ2xlIGNoYXJhY3RlciB2YXJpYW50czoKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2Uoc2l6ZV90IF9fcCwgX0NoYXJUIF9fYykKKyAgICAgIHsKKwlpdGVyYXRvciBfX2kodGhpcywgX19wKTsKKwkqX19pID0gX19jOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICByZXBsYWNlKHNpemVfdCBfX3AsIGNvbnN0IHJvcGUmIF9fcikKKyAgICAgIHsgcmVwbGFjZShfX3AsIDEsIF9fcik7IH0KKworICAgICAgdm9pZAorICAgICAgcmVwbGFjZShzaXplX3QgX19wLCBjb25zdCBfQ2hhclQqIF9faSwgc2l6ZV90IF9faV9sZW4pCisgICAgICB7IHJlcGxhY2UoX19wLCAxLCBfX2ksIF9faV9sZW4pOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2Uoc2l6ZV90IF9fcCwgY29uc3QgX0NoYXJUKiBfX2Nfc3RyaW5nKQorICAgICAgewlyZXBsYWNlKF9fcCwgMSwgX19jX3N0cmluZyk7IH0KKworICAgICAgdm9pZAorICAgICAgcmVwbGFjZShzaXplX3QgX19wLCBjb25zdCBfQ2hhclQqIF9faSwgY29uc3QgX0NoYXJUKiBfX2opCisgICAgICB7CXJlcGxhY2UoX19wLCAxLCBfX2ksIF9faik7IH0KKworICAgICAgdm9pZAorICAgICAgcmVwbGFjZShzaXplX3QgX19wLCBjb25zdCBjb25zdF9pdGVyYXRvciYgX19pLAorCSAgICAgIGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2opCisgICAgICB7IHJlcGxhY2UoX19wLCAxLCBfX2ksIF9faik7IH0KKworICAgICAgdm9pZAorICAgICAgcmVwbGFjZShzaXplX3QgX19wLCBjb25zdCBpdGVyYXRvciYgX19pLAorCSAgICAgIGNvbnN0IGl0ZXJhdG9yJiBfX2opCisgICAgICB7IHJlcGxhY2UoX19wLCAxLCBfX2ksIF9faik7IH0KKworICAgICAgLy8gRXJhc2UsIChwb3NpdGlvbiwgc2l6ZSkgdmFyaWFudC4KKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKHNpemVfdCBfX3AsIHNpemVfdCBfX24pCisgICAgICB7CisJX1JvcGVSZXAqIF9fcmVzdWx0ID0gcmVwbGFjZSh0aGlzLT5fTV90cmVlX3B0ciwgX19wLAorCQkJCSAgICAgX19wICsgX19uLCAwKTsKKwlfU191bnJlZih0aGlzLT5fTV90cmVlX3B0cik7CisJdGhpcy0+X01fdHJlZV9wdHIgPSBfX3Jlc3VsdDsKKyAgICAgIH0KKworICAgICAgLy8gRXJhc2UsIHNpbmdsZSBjaGFyYWN0ZXIKKyAgICAgIHZvaWQKKyAgICAgIGVyYXNlKHNpemVfdCBfX3ApCisgICAgICB7IGVyYXNlKF9fcCwgX19wICsgMSk7IH0KKworICAgICAgLy8gSW5zZXJ0LCBpdGVyYXRvciB2YXJpYW50cy4KKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoY29uc3QgaXRlcmF0b3ImIF9fcCwgY29uc3Qgcm9wZSYgX19yKQorICAgICAgeworCWluc2VydChfX3AuaW5kZXgoKSwgX19yKTsKKwlyZXR1cm4gX19wOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0KGNvbnN0IGl0ZXJhdG9yJiBfX3AsIHNpemVfdCBfX24sIF9DaGFyVCBfX2MpCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpLCBfX24sIF9fYyk7CisJcmV0dXJuIF9fcDsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IgaW5zZXJ0KGNvbnN0IGl0ZXJhdG9yJiBfX3AsIF9DaGFyVCBfX2MpCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpLCBfX2MpOworCXJldHVybiBfX3A7CisgICAgICB9CisgICAgICAKKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoY29uc3QgaXRlcmF0b3ImIF9fcCApCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpKTsKKwlyZXR1cm4gX19wOworICAgICAgfQorICAgICAgCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0KGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0IF9DaGFyVCogY19zdHJpbmcpCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpLCBjX3N0cmluZyk7CisJcmV0dXJuIF9fcDsKKyAgICAgIH0KKyAgICAgIAorICAgICAgaXRlcmF0b3IKKyAgICAgIGluc2VydChjb25zdCBpdGVyYXRvciYgX19wLCBjb25zdCBfQ2hhclQqIF9faSwgc2l6ZV90IF9fbikKKyAgICAgIHsKKwlpbnNlcnQoX19wLmluZGV4KCksIF9faSwgX19uKTsKKwlyZXR1cm4gX19wOworICAgICAgfQorICAgICAgCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0KGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0IF9DaGFyVCogX19pLAorCSAgICAgY29uc3QgX0NoYXJUKiBfX2opCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpLCBfX2ksIF9faik7IAorCXJldHVybiBfX3A7CisgICAgICB9CisgICAgICAKKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoY29uc3QgaXRlcmF0b3ImIF9fcCwKKwkgICAgIGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2ksIGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2opCisgICAgICB7CisJaW5zZXJ0KF9fcC5pbmRleCgpLCBfX2ksIF9faik7CisJcmV0dXJuIF9fcDsKKyAgICAgIH0KKyAgICAgIAorICAgICAgaXRlcmF0b3IKKyAgICAgIGluc2VydChjb25zdCBpdGVyYXRvciYgX19wLAorCSAgICAgY29uc3QgaXRlcmF0b3ImIF9faSwgY29uc3QgaXRlcmF0b3ImIF9faikKKyAgICAgIHsKKwlpbnNlcnQoX19wLmluZGV4KCksIF9faSwgX19qKTsKKwlyZXR1cm4gX19wOworICAgICAgfQorCisgICAgICAvLyBSZXBsYWNlLCByYW5nZSB2YXJpYW50cy4KKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2UoY29uc3QgaXRlcmF0b3ImIF9fcCwgY29uc3QgaXRlcmF0b3ImIF9fcSwgY29uc3Qg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X19wLCBjb25zdCBpdGVyYXRvciYgX19xLAorCSAgICAgIGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2ksIGNvbnN0IGNvbnN0X2l0ZXJhdG9yJiBfX2opCisgICAgICB7IHJlcGxhY2UoX19wLmluZGV4KCksIF9fcS5pbmRleCgpIC0gX19wLmluZGV4KCksIF9faSwgX19qKTsgfQorICAgICAgCisgICAgICB2b2lkCisgICAgICByZXBsYWNlKGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0IGl0ZXJhdG9yJiBfX3EsCisJICAgICAgY29uc3QgaXRlcmF0b3ImIF9faSwgY29uc3QgaXRlcmF0b3ImIF9faikKKyAgICAgIHsgcmVwbGFjZShfX3AuaW5kZXgoKSwgX19xLmluZGV4KCkgLSBfX3AuaW5kZXgoKSwgX19pLCBfX2opOyB9CisKKyAgICAgIC8vIFJlcGxhY2UsIGl0ZXJhdG9yIHZhcmlhbnRzLgorICAgICAgdm9pZAorICAgICAgcmVwbGFjZShjb25zdCBpdGVyYXRvciYgX19wLCBjb25zdCByb3BlJiBfX3IpCisgICAgICB7IHJlcGxhY2UoX19wLmluZGV4KCksIF9fcik7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgcmVwbGFjZShjb25zdCBpdGVyYXRvciYgX19wLCBfQ2hhclQgX19jKQorICAgICAgeyByZXBsYWNlKF9fcC5pbmRleCgpLCBfX2MpOyB9CisgICAgICAKKyAgICAgIHZvaWQKKyAgICAgIHJlcGxhY2UoY29uc3QgaXRlcmF0b3ImIF9fcCwgY29uc3QgX0NoYXJUKiBfX2Nfc3RyaW5nKQorICAgICAgeyByZXBsYWNlKF9fcC5pbmRleCgpLCBfX2Nfc3RyaW5nKTsgfQorICAgICAgCisgICAgICB2b2lkCisgICAgICByZXBsYWNlKGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0IF9DaGFyVCogX19pLCBzaXplX3QgX19uKQorICAgICAgeyByZXBsYWNlKF9fcC5pbmRleCgpLCBfX2ksIF9fbik7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgcmVwbGFjZShjb25zdCBpdGVyYXRvciYgX19wLCBjb25zdCBfQ2hhclQqIF9faSwgY29uc3QgX0NoYXJUKiBfX2opCisgICAgICB7IHJlcGxhY2UoX19wLmluZGV4KCksIF9faSwgX19qKTsgfQorICAgICAgCisgICAgICB2b2lkCisgICAgICByZXBsYWNlKGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0X2l0ZXJhdG9yIF9faSwgY29uc3RfaXRlcmF0b3IgX19qKQorICAgICAgeyByZXBsYWNlKF9fcC5pbmRleCgpLCBfX2ksIF9faik7IH0KKyAgICAgIAorICAgICAgdm9pZAorICAgICAgcmVwbGFjZShjb25zdCBpdGVyYXRvciYgX19wLCBpdGVyYXRvciBfX2ksIGl0ZXJhdG9yIF9faikKKyAgICAgIHsgcmVwbGFjZShfX3AuaW5kZXgoKSwgX19pLCBfX2opOyB9CisKKyAgICAgIC8vIEl0ZXJhdG9yIGFuZCByYW5nZSB2YXJpYW50cyBvZiBlcmFzZQorICAgICAgaXRlcmF0b3IKKyAgICAgIGVyYXNlKGNvbnN0IGl0ZXJhdG9yJiBfX3AsIGNvbnN0IGl0ZXJhdG9yJiBfX3EpCisgICAgICB7CisJc2l6ZV90IF9fcF9pbmRleCA9IF9fcC5pbmRleCgpOworCWVyYXNlKF9fcF9pbmRleCwgX19xLmluZGV4KCkgLSBfX3BfaW5kZXgpOworCXJldHVybiBpdGVyYXRvcih0aGlzLCBfX3BfaW5kZXgpOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZXJhc2UoY29uc3QgaXRlcmF0b3ImIF9fcCkKKyAgICAgIHsKKwlzaXplX3QgX19wX2luZGV4ID0gX19wLmluZGV4KCk7CisJZXJhc2UoX19wX2luZGV4LCAxKTsKKwlyZXR1cm4gaXRlcmF0b3IodGhpcywgX19wX2luZGV4KTsKKyAgICAgIH0KKworICAgICAgcm9wZQorICAg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SB7IH0KKyAgICAgIAorICAgICAgc2l6ZV90eXBlCisgICAgICBjYXBhY2l0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiBtYXhfc2l6ZSgpOyB9CisKKyAgICAgIC8vIFN0dWZmIGJlbG93IHRoaXMgbGluZSBpcyBkYW5nZXJvdXMgYmVjYXVzZSBpdCdzIGVycm9yIHByb25lLgorICAgICAgLy8gSSB3b3VsZCByZWFsbHkgbGlrZSB0byBnZXQgcmlkIG9mIGl0LgorICAgICAgLy8gY29weSBmdW5jdGlvbiB3aXRoIGZ1bm55IGFyZyBvcmRlcmluZy4KKyAgICAgIHNpemVfdHlwZQorICAgICAgY29weShfQ2hhclQqIF9fYnVmZmVyLCBzaXplX3R5cGUgX19uLAorCSAgIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7IHJldHVybiBjb3B5KF9fcG9zLCBfX24sIF9fYnVmZmVyKTsgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgZW5kKCkKKyAgICAgIHsgcmV0dXJuIG11dGFibGVfZW5kKCk7IH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkKKyAgICAgIHsgcmV0dXJuIG11dGFibGVfYmVnaW4oKTsgfQorCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkKKyAgICAgIHsgcmV0dXJuIG11dGFibGVfcmVuZCgpOyB9CisgICAgICAKKyAgICAgIHJldmVyc2VfaXRlcmF0b3IKKyAgICAgIHJiZWdpbigpCisgICAgICB7IHJldHVybiBtdXRhYmxlX3JiZWdpbigpOyB9CisKKyNlbHNlCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2VuZCgpOyB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBiZWdpbigpCisgICAgICB7IHJldHVybiBjb25zdF9iZWdpbigpOyB9CisKKyAgICAgIGNvbnN0X3JldmVyc2V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MgX0FsbG9jPgorICAgIGlubGluZSB2b2lkCisgICAgc3dhcChyb3BlPF9DaGFyVCwgX0FsbG9jPiYgX194LCByb3BlPF9DaGFyVCwgX0FsbG9jPiYgX195KQorICAgIHsgX194LnN3YXAoX195KTsgfQorCitfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX1ZFUlNJT04KK30gLy8gbmFtZXNwYWNlCisKKworbmFtZXNwYWNlIHN0ZCBfR0xJQkNYWF9WSVNJQklMSVRZKGRlZmF1bHQpCit7IAorbmFtZXNwYWNlIHRyMQoreworX0dMSUJDWFhfQkVHSU5fTkFNRVNQQUNFX1ZFUlNJT04KKworICB0ZW1wbGF0ZTw+CisgICAgc3RydWN0IGhhc2g8X19nbnVfY3h4Ojpjcm9wZT4KKyAgICB7CisgICAgICBzaXplX3QKKyAgICAgIG9wZXJhdG9yKCkoY29uc3QgX19nbnVfY3h4Ojpjcm9wZSYgX19zdHIpIGNvbnN0CisgICAgICB7CisJc2l6ZV90IF9fc2l6ZSA9IF9fc3RyLnNpemUoKTsKKwlpZiAoMCA9PSBfX3NpemUpCisJICByZXR1cm4gMDsKKwlyZXR1cm4gMTMgKiBfX3N0clswXSArIDUgKiBfX3N0cltfX3NpemUgLSAxXSArIF9fc2l6ZTsKKyAgICAgIH0KKyAgICB9OworCisKKyAgdGVtcGxhdGU8PgorICAgIHN0cnVjdCBoYXNoPF9fZ251X2N4eDo6d3JvcGU+CisgICAgeworICAgICAgc2l6ZV90CisgICAgICBvcGVyYXRvcigpKGNvbnN0IF9fZ251X2N4eDo6d3JvcGUmIF9fc3RyKSBjb25zdAorICAgICAgeworCXNpemVfdCBfX3NpemUgPSBfX3N0ci5zaXplKCk7CisJaWYgKDAgPT0gX19zaXplKQorCSAgcmV0dXJuIDA7CisJcmV0dXJuIDEzICogX19zdHJbMF0gKyA1ICogX19zdHJbX19zaXplIC0gMV0gKyBfX3NpemU7CisgICAgICB9CisgICAgfTsKKworX0dMSUJDWFhfRU5EX05BTUVTUEFDR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ZXggaW50byBwYXRoICAgICovCisgICAgICBzaXplX3QgX19jdXJyX3N0YXJ0X3BvcyA9IDA7CisgICAgICBzaXplX3QgX19wb3MgPSBfX3guX01fY3VycmVudF9wb3M7CisgICAgICB1bnNpZ25lZCBjaGFyIF9fZGlybnMgPSAwOyAvLyBCaXQgdmVjdG9yIG1hcmtpbmcgcmlnaHQgdHVybnMgaW4gdGhlIHBhdGgKKworICAgICAgaWYgKF9fcG9zID49IF9feC5fTV9yb290LT5fTV9zaXplKQorCXsKKwkgIF9feC5fTV9idWZfcHRyID0gMDsKKwkgIHJldHVybjsKKwl9CisgICAgICBfX2N1cnJfcm9wZSA9IF9feC5fTV9yb290OworICAgICAgaWYgKDAgIT0gX19jdXJyX3JvcGUtPl9NX2Nfc3RyaW5nKQorCXsKKwkgIC8qIFRyZWF0IHRoZSByb290IGFzIGEgbGVhZi4gKi8KKwkgIF9feC5fTV9idWZfc3RhcnQgPSBfX2N1cnJfcm9wZS0+X01fY19zdHJpbmc7CisJICBfX3guX01fYnVmX2VuZCA9IF9fY3Vycl9yb3BlLT5fTV9jX3N0cmluZyArIF9fY3Vycl9yb3BlLT5fTV9zaXplOworCSAgX194Ll9NX2J1Zl9wdHIgPSBfX2N1cnJfcm9wZS0+X01fY19zdHJpbmcgKyBfX3BvczsKKwkgIF9feC5fTV9wYXRoX2VuZFswXSA9IF9fY3Vycl9yb3BlOworCSAgX194Ll9NX2xlYWZfaW5kZXggPSAwOworCSAgX194Ll9NX2xlYWZfcG9zID0gMDsKKwkgIHJldHVybjsKKwl9CisgICAgICBmb3IoOzspCisJeworCSAgKytfX2N1cnJfZGVwdGg7CisJICBfX3BhdGhbX19jdXJyX2RlcHRoXSA9IF9fY3Vycl9yb3BlOworCSAgc3dpdGNoKF9fY3Vycl9yb3BlLT5fTV90YWcpCisJICAgIHsKKwkgICAgY2FzZSBfX2RldGFpbDo6X1NfbGVhZjoKKwkgICAgY2FzZSBfX2RldGFpbDo6X1NfZnVuY3Rpb246CisJ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XIgaW4gaXRzIHJpZ2h0IGNoaWxkLgorICAgICAgLy8gbm9kZV9zdGFydF9wb3MgaXMgc3RhcnRpbmcgcG9zaXRpb24gb2YgY3VycmVudF9ub2RlLgorICAgICAgX19ub2RlX3N0YXJ0X3BvcyArPSBfX2MtPl9NX2xlZnQtPl9NX3NpemU7CisgICAgICBfX2N1cnJlbnRfbm9kZSA9IF9fYy0+X01fcmlnaHQ7CisgICAgICBfX3guX01fcGF0aF9lbmRbKytfX2N1cnJlbnRfaW5kZXhdID0gX19jdXJyZW50X25vZGU7CisgICAgICBfX2Rpcm5zIHw9IDE7CisgICAgICB3aGlsZSAoX19kZXRhaWw6Ol9TX2NvbmNhdCA9PSBfX2N1cnJlbnRfbm9kZS0+X01fdGFnKQorCXsKKwkgICsrX19jdXJyZW50X2luZGV4OworCSAgaWYgKGludChfU19wYXRoX2NhY2hlX2xlbikgPT0gX19jdXJyZW50X2luZGV4KQorCSAgICB7CisJICAgICAgaW50IF9faTsKKwkgICAgICBmb3IgKF9faSA9IDA7IF9faSA8IGludChfU19wYXRoX2NhY2hlX2xlbikgLSAxOyBfX2krKykKKwkJX194Ll9NX3BhdGhfZW5kW19faV0gPSBfX3guX01fcGF0aF9lbmRbX19pKzFdOworCSAgICAgIC0tX19jdXJyZW50X2luZGV4OworCSAgICB9CisJICBfX2N1cnJlbnRfbm9kZSA9CisJICAgICgoX1JvcGVfUm9wZUNvbmNhdGVuYXRpb248X0NoYXJULCBfQWxsb2M+KilfX2N1cnJlbnRfbm9kZSktPl9NX2xlZnQ7CisJICBfX3guX01fcGF0aF9lbmRbX19jdXJyZW50X2luZGV4XSA9IF9fY3VycmVudF9ub2RlOworCSAgX19kaXJucyA8PD0gMTsKKwkgIC8vIG5vZGVfc3RhcnRfcG9zIGlzIHVuY2hhbmdlZC4KKwl9CisgICAgICBfX3guX01fbGVhZl9pbmRleCA9IF9fY3VycmVudF9pbmRleDsKKyAgICAgIF9feC5fTV9sZWFmX3BvcyA9IF9fbm9k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bHQ7CisJICAgIH0KKwl9CisgICAgICBfUm9wZVJlcCogX19ucmlnaHQgPQorCV9fU1RMX1JPUEVfRlJPTV9VTk9XTkVEX0NIQVJfUFRSKF9fcywgX19zbGVuLCBfX3ItPl9NX2dldF9hbGxvY2F0b3IoKSk7CisgICAgICBfX3RyeQorCXsKKwkgIF9fci0+X01fcmVmX25vbm5pbCgpOworCSAgX19yZXN1bHQgPSBfU190cmVlX2NvbmNhdChfX3IsIF9fbnJpZ2h0KTsKKwl9CisgICAgICBfX2NhdGNoKC4uLikKKwl7CisJICBfU191bnJlZihfX3IpOworCSAgX1NfdW5yZWYoX19ucmlnaHQpOworCSAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJfQorICAgICAgcmV0dXJuIF9fcmVzdWx0OworICAgIH0KKworI2lmbmRlZiBfX0dDCisgIHRlbXBsYXRlIDxjbGFzcyBfQ2hhclQsIGNsYXNzIF9BbGxvYz4KKyAgICB0eXBlbmFtZSByb3BlPF9DaGFyVCxfQWxsb2M+OjpfUm9wZVJlcCoKKyAgICByb3BlPF9DaGFyVCxfQWxsb2M+OjoKKyAgICBfU19kZXN0cl9jb25jYXRfY2hhcl9pdGVyKF9Sb3BlUmVwKiBfX3IsIGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3QgX19zbGVuKQorICAgIHsKKyAgICAgIF9Sb3BlUmVwKiBfX3Jlc3VsdDsKKyAgICAgIGlmICgwID09IF9fcikKKwlyZXR1cm4gX19TVExfUk9QRV9GUk9NX1VOT1dORURfQ0hBUl9QVFIoX19zLCBfX3NsZW4sCisJCQkJCQlfX3ItPl9NX2dldF9hbGxvY2F0b3IoKSk7CisgICAgICBzaXplX3QgX19jb3VudCA9IF9fci0+X01fcmVmX2NvdW50OworICAgICAgc2l6ZV90IF9fb3JpZ19zaXplID0gX19yLT5fTV9zaXplOworICAgICAgaWYgKF9fY291bnQgPiAxKQorCXJldHVybiBfU19jb25jYXRfY2hhcl9pdGVyKF9fciwgX19zLCBfX3Ns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YmVmb3JlLgorCSAgICAgICgoX1JvcGVDb25jYXRlbmF0aW9uKilfX3IpLT5fTV9yaWdodCA9IF9fbmV3X3JpZ2h0OworCSAgICAgIF9fci0+X01fc2l6ZSA9IF9fb3JpZ19zaXplICsgX19zbGVuOworCSAgICAgIGlmICgwICE9IF9fci0+X01fY19zdHJpbmcpCisJCXsKKwkJICBfX3ItPl9NX2ZyZWVfY19zdHJpbmcoKTsKKwkJICBfX3ItPl9NX2Nfc3RyaW5nID0gMDsKKwkJfQorCSAgICAgIHJldHVybiBfX3I7CisJICAgIH0KKwl9CisgICAgICBfUm9wZVJlcCogX19yaWdodCA9CisJX19TVExfUk9QRV9GUk9NX1VOT1dORURfQ0hBUl9QVFIoX19zLCBfX3NsZW4sIF9fci0+X01fZ2V0X2FsbG9jYXRvcigpKTsKKyAgICAgIF9fci0+X01fcmVmX25vbm5pbCgpOworICAgICAgX190cnkKKwl7IF9fcmVzdWx0ID0gX1NfdHJlZV9jb25jYXQoX19yLCBfX3JpZ2h0KTsgfQorICAgICAgX19jYXRjaCguLi4pCisJeworCSAgX1NfdW5yZWYoX19yKTsKKwkgIF9TX3VucmVmKF9fcmlnaHQpOworCSAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJfQorICAgICAgcmV0dXJuIF9fcmVzdWx0OworICAgIH0KKyNlbmRpZiAvKiAhX19HQyAqLworICAKKyAgdGVtcGxhdGUgPGNsYXNzIF9DaGFyVCwgY2xhc3MgX0FsbG9jPgorICAgIHR5cGVuYW1lIHJvcGU8X0NoYXJULCBfQWxsb2M+OjpfUm9wZVJlcCoKKyAgICByb3BlPF9DaGFyVCwgX0FsbG9jPjo6CisgICAgX1NfY29uY2F0KF9Sb3BlUmVwKiBfX2xlZnQsIF9Sb3BlUmVwKiBfX3JpZ2h0KQorICAgIHsKKyAgICAgIGlmICgwID09IF9fbGVmdCkKKwl7CisJICBfU19yZWYoX19yaWdodCk7CisJICByZXR1cm4gX19yaWdodDsKKwl9CisgICAgICBpZi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XIoX0luc2VydF9vc3RyZWFtJiBfX3dyaXRlcikKKwk6IF9NX28oX193cml0ZXIpIHt9OworICAgICAgfl9Sb3BlX2luc2VydF9jaGFyX2NvbnN1bWVyKCkgeyB9OworICAgICAgLy8gQ2FsbGVyIGlzIHByZXN1bWVkIHRvIG93biB0aGUgb3N0cmVhbQorICAgICAgYm9vbCBvcGVyYXRvcigpIChjb25zdCBfQ2hhclQqIF9fbGVhZiwgc2l6ZV90IF9fbik7CisgICAgICAvLyBSZXR1cm5zIHRydWUgdG8gY29udGludWUgdHJhdmVyc2FsLgorICAgIH07CisKKyAgdGVtcGxhdGU8Y2xhc3MgX0NoYXJULCBjbGFzcyBfVHJhaXRzPgorICAgIGJvb2wKKyAgICBfUm9wZV9pbnNlcnRfY2hhcl9jb25zdW1lcjxfQ2hhclQsIF9UcmFpdHM+OjoKKyAgICBvcGVyYXRvcigpKGNvbnN0IF9DaGFyVCogX19sZWFmLCBzaXplX3QgX19uKQorICAgIHsKKyAgICAgIHNpemVfdCBfX2k7CisgICAgICAvLyAgV2UgYXNzdW1lIHRoYXQgZm9ybWF0dGluZyBpcyBzZXQgdXAgY29ycmVjdGx5IGZvciBlYWNoIGVsZW1lbnQuCisgICAgICBmb3IgKF9faSA9IDA7IF9faSA8IF9fbjsgX19pKyspCisJX01fby5wdXQoX19sZWFmW19faV0pOworICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgIHRlbXBsYXRlIDxjbGFzcyBfQ2hhclQsIGNsYXNzIF9BbGxvYz4KKyAgICBib29sCisgICAgcm9wZTxfQ2hhclQsIF9BbGxvYz46OgorICAgIF9TX2FwcGx5X3RvX3BpZWNlcyhfUm9wZV9jaGFyX2NvbnN1bWVyPF9DaGFyVD4mIF9fYywKKwkJICAgICAgIGNvbnN0IF9Sb3BlUmVwKiBfX3IsIHNpemVfdCBfX2JlZ2luLCBzaXplX3QgX19lbmQpCisgICAgeworICAgICAgaWYgKDAgPT0gX19yKQorCXJldHVybiB0cnVlOwor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F0b3JfdHlwZSYgX19hKQorICAgIDogX0Jhc2UoX19hKQorICAgIHsKKyAgICAgIHJvcGU8X0NoYXJULF9BbGxvYz4gX19yZXN1bHQ7CisgICAgICBjb25zdCBzaXplX3QgX19leHBvbmVudGlhdGVfdGhyZXNob2xkID0gMzI7CisgICAgICBzaXplX3QgX19leHBvbmVudDsKKyAgICAgIHNpemVfdCBfX3Jlc3Q7CisgICAgICBfQ2hhclQqIF9fcmVzdF9idWZmZXI7CisgICAgICBfUm9wZVJlcCogX19yZW1haW5kZXI7CisgICAgICByb3BlPF9DaGFyVCwgX0FsbG9jPiBfX3JlbWFpbmRlcl9yb3BlOworCisgICAgICBpZiAoMCA9PSBfX24pCisJcmV0dXJuOworCisgICAgICBfX2V4cG9uZW50ID0gX19uIC8gX19leHBvbmVudGlhdGVfdGhyZXNob2xkOworICAgICAgX19yZXN0ID0gX19uICUgX19leHBvbmVudGlhdGVfdGhyZXNob2xkOworICAgICAgaWYgKDAgPT0gX19yZXN0KQorCV9fcmVtYWluZGVyID0gMDsKKyAgICAgIGVsc2UKKwl7CisJICBfX3Jlc3RfYnVmZmVyID0gdGhpcy0+X0RhdGFfYWxsb2NhdGUoX1Nfcm91bmRlZF91cF9zaXplKF9fcmVzdCkpOworCSAgX191bmluaXRpYWxpemVkX2ZpbGxfbl9hKF9fcmVzdF9idWZmZXIsIF9fcmVzdCwgX19jLAorCQkJCSAgIF9NX2dldF9hbGxvY2F0b3IoKSk7CisJICBfU19jb25kX3N0b3JlX2VvcyhfX3Jlc3RfYnVmZmVyW19fcmVzdF0pOworCSAgX190cnkKKwkgICAgeyBfX3JlbWFpbmRlciA9IF9TX25ld19Sb3BlTGVhZihfX3Jlc3RfYnVmZmVyLCBfX3Jlc3QsCisJCQkJCSAgICBfTV9nZXRfYWxsb2NhdG9yKCkpOyB9CisJICBfX2NhdGNoKC4uLikKKwkgICAgeworCSAgICAgIF9Sb3BlUmVwOjpfX1NUTF9GUkVFX1NUUklORyhfX3Jlc3R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jsKKyAgICAgIHR5cGVkZWYgX1NsaXN0X2l0ZXJhdG9yPF9UcCwgX1JlZiwgX1B0cj4gICAgICAgICAgICAgX1NlbGY7CisKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiBfUHRyICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIF9SZWYgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiBfU2xpc3Rfbm9kZTxfVHA+IF9Ob2RlOworCisgICAgICBleHBsaWNpdAorICAgICAgX1NsaXN0X2l0ZXJhdG9yKF9Ob2RlKiBfX3gpCisgICAgICA6IF9TbGlzdF9pdGVyYXRvcl9iYXNlKF9feCkge30KKworICAgICAgX1NsaXN0X2l0ZXJhdG9yKCkKKyAgICAgIDogX1NsaXN0X2l0ZXJhdG9yX2Jhc2UoMCkge30KKworICAgICAgX1NsaXN0X2l0ZXJhdG9yKGNvbnN0IGl0ZXJhdG9yJiBfX3gpCisgICAgICA6IF9TbGlzdF9pdGVyYXRvcl9iYXNlKF9feC5fTV9ub2RlKSB7fQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiAoKF9Ob2RlKikgX01fbm9kZSktPl9NX2RhdGE7IH0KKworICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiAmKG9wZXJhdG9yKigpKTsgfQorCisgICAgICBfU2VsZiYKKyAgICAgIG9wZXJhdG9yKysoKQorICAgICAgeworCV9NX2luY3IoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIF9TZWxmCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsKKwlfU2VsZiBfX3RtcCA9ICp0aGlzOworCV9NX2luY3IoKTsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisgICAgfTsKKworIC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CisJICBnZXRfYWxsb2NhdG9yKCkuZGVzdHJveSgmX190bXAtPl9NX2RhdGEpOworCSAgX01fcHV0X25vZGUoX190bXApOworCX0KKyAgICAgIF9fYmVmb3JlX2ZpcnN0LT5fTV9uZXh0ID0gX19sYXN0X25vZGU7CisgICAgICByZXR1cm4gX19sYXN0X25vZGU7CisgICAgfQorCisgIC8qKgorICAgKiAgVGhpcyBpcyBhbiBTR0kgZXh0ZW5zaW9uLgorICAgKiAgQGluZ3JvdXAgU0dJZXh0ZW5zaW9ucworICAgKiAgQGRvY3RvZG8KKyAgICovCisgIHRlbXBsYXRlIDxjbGFzcyBfVHAsIGNsYXNzIF9BbGxvYyA9IGFsbG9jYXRvcjxfVHA+ID4KKyAgICBjbGFzcyBzbGlzdCA6IHByaXZhdGUgX1NsaXN0X2Jhc2U8X1RwLF9BbGxvYz4KKyAgICB7CisgICAgICAvLyBjb25jZXB0IHJlcXVpcmVtZW50cworICAgICAgX19nbGliY3h4X2NsYXNzX3JlcXVpcmVzKF9UcCwgX1NHSUFzc2lnbmFibGVDb25jZXB0KQorCQorICAgIHByaXZhdGU6CisgICAgICB0eXBlZGVmIF9TbGlzdF9iYXNlPF9UcCxfQWxsb2M+IF9CYXNlOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfVHAgICAgICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgdHlwZWRlZiB2YWx1ZV90eXBlKiAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCB2YWx1ZV90eXBlKiBjb25zdF9wb2ludGVyOworICAgICAgdHlwZWRlZiB2YWx1ZV90eXBlJiAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIGNvbnN0IHZhbHVlX3R5cGUmIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgc2l6ZV90ICAgICAgICAgICAgc2l6ZV90eXBlOworICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICAgICAgICBkaWZmZXJlb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Bjb25zdF9pdGVyYXRvcigoX05vZGUqKSAmdGhpcy0+X01faGVhZCk7IH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBzaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9fc2xpc3Rfc2l6ZSh0aGlzLT5fTV9oZWFkLl9NX25leHQpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgbWF4X3NpemUoKSBjb25zdAorICAgICAgeyByZXR1cm4gc2l6ZV90eXBlKC0xKTsgfQorCisgICAgICBib29sCisgICAgICBlbXB0eSgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9oZWFkLl9NX25leHQgPT0gMDsgfQorCisgICAgICB2b2lkCisgICAgICBzd2FwKHNsaXN0JiBfX3gpCisgICAgICB7IHN0ZDo6c3dhcCh0aGlzLT5fTV9oZWFkLl9NX25leHQsIF9feC5fTV9oZWFkLl9NX25leHQpOyB9CisKKyAgICBwdWJsaWM6CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgZnJvbnQoKQorICAgICAgeyByZXR1cm4gKChfTm9kZSopIHRoaXMtPl9NX2hlYWQuX01fbmV4dCktPl9NX2RhdGE7IH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBmcm9udCgpIGNvbnN0CisgICAgICB7IHJldHVybiAoKF9Ob2RlKikgdGhpcy0+X01faGVhZC5fTV9uZXh0KS0+X01fZGF0YTsgfQorCisgICAgICB2b2lkCisgICAgICBwdXNoX2Zyb250KGNvbnN0IHZhbHVlX3R5cGUmIF9feCkKKyAgICAgIHsgX19zbGlzdF9tYWtlX2xpbmsoJnRoaXMtPl9NX2hlYWQsIF9NX2NyZWF0ZV9ub2RlKF9feCkpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHB1c2hfZnJvbnQoKQorICAgICAgeyBfX3NsaXN0X21ha2VfbGluaygmdGhpcy0+X01faGVhZCwgX01fY3JlYXRlX25vZGUoKSk7IH0KKworICAgICAgdm9pZAorICAgICAgcG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0PF9UcCwgX0FsbG9jPiYgX194KQorICAgIHsKKyAgICAgIGlmICgmX194ICE9IHRoaXMpCisJeworCSAgX05vZGVfYmFzZSogX19wMSA9ICZ0aGlzLT5fTV9oZWFkOworCSAgX05vZGUqIF9fbjEgPSAoX05vZGUqKSB0aGlzLT5fTV9oZWFkLl9NX25leHQ7CisJICBjb25zdCBfTm9kZSogX19uMiA9IChjb25zdCBfTm9kZSopIF9feC5fTV9oZWFkLl9NX25leHQ7CisJICB3aGlsZSAoX19uMSAmJiBfX24yKQorCSAgICB7CisJICAgICAgX19uMS0+X01fZGF0YSA9IF9fbjItPl9NX2RhdGE7CisJICAgICAgX19wMSA9IF9fbjE7CisJICAgICAgX19uMSA9IChfTm9kZSopIF9fbjEtPl9NX25leHQ7CisJICAgICAgX19uMiA9IChjb25zdCBfTm9kZSopIF9fbjItPl9NX25leHQ7CisJICAgIH0KKwkgIGlmIChfX24yID09IDApCisJICAgIHRoaXMtPl9NX2VyYXNlX2FmdGVyKF9fcDEsIDApOworCSAgZWxzZQorCSAgICBfTV9pbnNlcnRfYWZ0ZXJfcmFuZ2UoX19wMSwgY29uc3RfaXRlcmF0b3IoKF9Ob2RlKilfX24yKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdF9pdGVyYXRvcigwKSk7CisJfQorICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICB0ZW1wbGF0ZSA8Y2xhc3MgX1RwLCBjbGFzcyBfQWxsb2M+CisgICAgdm9pZAorICAgIHNsaXN0PF9UcCwgX0FsbG9jPjo6X01fZmlsbF9hc3NpZ24oc2l6ZV90eXBlIF9fbiwgY29uc3QgX1RwJiBfX3ZhbCkKKyAgICB7CisgICAgICBfTm9kZV9iYXNlKiBfX3ByZXYgPSAmdGhpcy0+X01faGVhZDsKKyAgICAgIF9Ob2RlKiBfX25vZGUgPSAoX05vZGUqKSB0aGlzLT5fTV9oZWFkLl9NX25leHQ7CisgICAgICBmb3IgKDsgX19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ZWN0ZWQ6CisgICAgICB0eXBlZGVmIF9fZ251X2N4eDo6c2xpc3Q8X1RwLCBfQWxsb2M+IF9Db250YWluZXI7CisgICAgICBfQ29udGFpbmVyKiBjb250YWluZXI7CisgICAgICB0eXBlbmFtZSBfQ29udGFpbmVyOjppdGVyYXRvciBpdGVyOworCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfQ29udGFpbmVyICAgICAgICAgIGNvbnRhaW5lcl90eXBlOworICAgICAgdHlwZWRlZiBvdXRwdXRfaXRlcmF0b3JfdGFnIGl0ZXJhdG9yX2NhdGVnb3J5OworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB2b2lkICAgICAgICAgICAgICAgIHBvaW50ZXI7CisgICAgICB0eXBlZGVmIHZvaWQgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworCisgICAgICBpbnNlcnRfaXRlcmF0b3IoX0NvbnRhaW5lciYgX194LCB0eXBlbmFtZSBfQ29udGFpbmVyOjppdGVyYXRvciBfX2kpCisgICAgICA6IGNvbnRhaW5lcigmX194KQorICAgICAgeworCWlmIChfX2kgPT0gX194LmJlZ2luKCkpCisJICBpdGVyID0gX194LmJlZm9yZV9iZWdpbigpOworCWVsc2UKKwkgIGl0ZXIgPSBfX3gucHJldmlvdXMoX19pKTsKKyAgICAgIH0KKworICAgICAgaW5zZXJ0X2l0ZXJhdG9yPF9Db250YWluZXI+JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHR5cGVuYW1lIF9Db250YWluZXI6OnZhbHVlX3R5cGUmIF9fdmFsdWUpCisgICAgICB7CisJaXRlciA9IGNvbnRhaW5lci0+aW5zZXJ0X2FmdGVyKGl0ZXIsIF9fdmFsdWUpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgaW5zZXJ0X2l0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b2MmIF9fYSk7CisKKyAgICAgIH5fX3Nzb19zdHJpbmdfYmFzZSgpCisgICAgICB7IF9NX2Rpc3Bvc2UoKTsgfQorCisgICAgICBfQ2hhclRfYWxsb2NfdHlwZSYKKyAgICAgIF9NX2dldF9hbGxvY2F0b3IoKQorICAgICAgeyByZXR1cm4gX01fZGF0YXBsdXM7IH0KKworICAgICAgY29uc3QgX0NoYXJUX2FsbG9jX3R5cGUmCisgICAgICBfTV9nZXRfYWxsb2NhdG9yKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2RhdGFwbHVzOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3N3YXAoX19zc29fc3RyaW5nX2Jhc2UmIF9fcmNzKTsKKworICAgICAgdm9pZAorICAgICAgX01fYXNzaWduKGNvbnN0IF9fc3NvX3N0cmluZ19iYXNlJiBfX3Jjcyk7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3Jlc2VydmUoc2l6ZV90eXBlIF9fcmVzKTsKKworICAgICAgdm9pZAorICAgICAgX01fbXV0YXRlKHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fbGVuMSwgY29uc3QgX0NoYXJUKiBfX3MsCisJCXNpemVfdHlwZSBfX2xlbjIpOworCisgICAgICB2b2lkCisgICAgICBfTV9lcmFzZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24pOworCisgICAgICB2b2lkCisgICAgICBfTV9jbGVhcigpCisgICAgICB7IF9NX3NldF9sZW5ndGgoMCk7IH0KKworICAgICAgYm9vbAorICAgICAgX01fY29tcGFyZShjb25zdCBfX3Nzb19zdHJpbmdfYmFzZSYpIGNvbnN0CisgICAgICB7IHJldHVybiBmYWxzZTsgfQorICAgIH07CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzLCB0eXBlbmFtZSBfQWxsb2M+CisgICAgdm9pZAorICAgIF9fc3NvX3N0cmluZ19iYXNlPF9D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X3Bvcywgc2l6ZV90eXBlIF9fbGVuMSwgY29uc3QgX0NoYXJUKiBfX3MsCisJICAgICAgc2l6ZV90eXBlIF9fbGVuMikKKyAgICB7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19ob3dfbXVjaCA9IF9NX2xlbmd0aCgpIC0gX19wb3MgLSBfX2xlbjE7CisgICAgICAKKyAgICAgIHNpemVfdHlwZSBfX25ld19jYXBhY2l0eSA9IF9NX2xlbmd0aCgpICsgX19sZW4yIC0gX19sZW4xOworICAgICAgX0NoYXJUKiBfX3IgPSBfTV9jcmVhdGUoX19uZXdfY2FwYWNpdHksIF9NX2NhcGFjaXR5KCkpOworCisgICAgICBpZiAoX19wb3MpCisJdGhpcy0+X1NfY29weShfX3IsIF9NX2RhdGEoKSwgX19wb3MpOworICAgICAgaWYgKF9fcyAmJiBfX2xlbjIpCisJdGhpcy0+X1NfY29weShfX3IgKyBfX3BvcywgX19zLCBfX2xlbjIpOworICAgICAgaWYgKF9faG93X211Y2gpCisJdGhpcy0+X1NfY29weShfX3IgKyBfX3BvcyArIF9fbGVuMiwKKwkJICAgICAgX01fZGF0YSgpICsgX19wb3MgKyBfX2xlbjEsIF9faG93X211Y2gpOworICAgICAgCisgICAgICBfTV9kaXNwb3NlKCk7CisgICAgICBfTV9kYXRhKF9fcik7CisgICAgICBfTV9jYXBhY2l0eShfX25ld19jYXBhY2l0eSk7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cywgdHlwZW5hbWUgX0FsbG9jPgorICAgIHZvaWQKKyAgICBfX3Nzb19zdHJpbmdfYmFzZTxfQ2hhclQsIF9UcmFpdHMsIF9BbGxvYz46OgorICAgIF9NX2VyYXNlKHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fbikKKyAgICB7CisgICAgICBjb25zdCBzaXplX3R5cGUgX19ob3dfbXVjaCA9IF9NX2xlbmd0aCgpIC0gX19wb3MgLSBf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QgZnJvbSBiYXNpY19zdHJlYW1idWY6OnN1bmdldGMoKQorICAgICAgaW50X3R5cGUgX01fdW5nZXRfYnVmOworCisgICAgcHVibGljOgorICAgICAgZXhwbGljaXQKKyAgICAgIHN0ZGlvX3N5bmNfZmlsZWJ1ZihzdGQ6Ol9fY19maWxlKiBfX2YpCisgICAgICA6IF9NX2ZpbGUoX19mKSwgX01fdW5nZXRfYnVmKHRyYWl0c190eXBlOjplb2YoKSkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAcmV0dXJuICBUaGUgdW5kZXJseWluZyBGSUxFKi4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBmdW5jdGlvbiBjYW4gYmUgdXNlZCB0byBhY2Nlc3MgdGhlIHVuZGVybHlpbmcgQyBmaWxlIHBvaW50ZXIuCisgICAgICAgKiAgTm90ZSB0aGF0IHRoZXJlIGlzIG5vIHdheSBmb3IgdGhlIGxpYnJhcnkgdG8gdHJhY2sgd2hhdCB5b3UgZG8KKyAgICAgICAqICB3aXRoIHRoZSBmaWxlLCBzbyBiZSBjYXJlZnVsLgorICAgICAgICovCisgICAgICBzdGQ6Ol9fY19maWxlKiBjb25zdAorICAgICAgZmlsZSgpIHsgcmV0dXJuIHRoaXMtPl9NX2ZpbGU7IH0KKworICAgIHByb3RlY3RlZDoKKyAgICAgIGludF90eXBlCisgICAgICBzeW5jZ2V0YygpOworCisgICAgICBpbnRfdHlwZQorICAgICAgc3luY3VuZ2V0YyhpbnRfdHlwZSBfX2MpOworCisgICAgICBpbnRfdHlwZQorICAgICAgc3luY3B1dGMoaW50X3R5cGUgX19jKTsKKworICAgICAgdmlydHVhbCBpbnRfdHlwZQorICAgICAgdW5kZXJmbG93KCkKKyAgICAgIHsKKwlpbnRfdHlwZSBfX2MgPSB0aGlzLT5zeW5jZ2V0YygpOworCXJldHVybiB0aGlzLT5zeW5jdW5nZXRjKF9fYyk7CisgICAgICB9CisKKyAgICAgIHZpcnR1YWwgaW50X3R5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kIGxvbmcgbCA9IHN0YXRpY19jYXN0PHVuc2lnbmVkIGxvbmc+KHJlZi5zZWNvbmQuZmlyc3QpOworICAgICAgX19idWlsdGluX3NwcmludGYoYnVmLCAiJWx1IiwgbCk7CisgICAgICBzICs9IGJ1ZjsKKyAgICAgIHMgKz0gdGFiOworICAgICAgcyArPSAic2l6ZTogIjsKKyAgICAgIGwgPSBzdGF0aWNfY2FzdDx1bnNpZ25lZCBsb25nPihyZWYuc2Vjb25kLnNlY29uZCk7CisgICAgICBfX2J1aWx0aW5fc3ByaW50ZihidWYsICIlbHUiLCBsKTsKKyAgICAgIHMgKz0gYnVmOworICAgICAgcyArPSB0YWI7CisgICAgICBzICs9ICJhZGRyZXNzOiAiOworICAgICAgX19idWlsdGluX3NwcmludGYoYnVmLCAiJXAiLCByZWYuZmlyc3QpOworICAgICAgcyArPSBidWY7CisgICAgICBzICs9ICdcbic7CisgICAgfQorCisgICAgc3RhdGljIHNpemVfdCYKKyAgICBsYWJlbCgpCisgICAgeworICAgICAgc3RhdGljIHNpemVfdCBfU19sYWJlbChzdGQ6Om51bWVyaWNfbGltaXRzPHNpemVfdD46Om1heCgpKTsKKyAgICAgIHJldHVybiBfU19sYWJlbDsKKyAgICB9CisKKyAgICBzdGF0aWMgbWFwX3R5cGUmCisgICAgbWFwKCkKKyAgICB7CisgICAgICBzdGF0aWMgbWFwX3R5cGUgX1NfbWFwOworICAgICAgcmV0dXJuIF9TX21hcDsKKyAgICB9CisgIH07CisKKyAgaW5saW5lIHN0ZDo6b3N0cmVhbSYKKyAgb3BlcmF0b3I8PChzdGQ6Om9zdHJlYW0mIG9zLCBjb25zdCBhbm5vdGF0ZV9iYXNlJiBfX2IpCisgIHsKKyAgICBzdGQ6OnN0cmluZyBlcnJvcjsKKyAgICB0eXBlZGVmIGFubm90YXRlX2Jhc2UgYmFzZV90eXBlOworICAgIGJhc2VfdHlwZTo6Y29uc3RfaXRlcmF0b3IgYmVnID0gX19iLm1hcCgpLmJlZ2luK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xpbWl0KCkpIHsgfQorCisgICAgICB2aXJ0dWFsCisgICAgICB+YWRqdXN0b3JfYmFzZSgpIHsgc2V0X2xpbWl0KF9NX29yaWcpOyB9CisgICAgfTsKKworICAgIC8vLyBOZXZlciBlbnRlciB0aGUgY29uZGl0aW9uLgorICAgIHN0cnVjdCBuZXZlcl9hZGp1c3RvciA6IHB1YmxpYyBhZGp1c3Rvcl9iYXNlCisgICAgeworICAgICAgbmV2ZXJfYWRqdXN0b3IoKSB7IHNldF9saW1pdChzdGQ6Om51bWVyaWNfbGltaXRzPHNpemVfdD46Om1heCgpKTsgfQorICAgIH07CisKKyAgICAvLy8gQWx3YXlzIGVudGVyIHRoZSBjb25kaXRpb24uCisgICAgc3RydWN0IGFsd2F5c19hZGp1c3RvciA6IHB1YmxpYyBhZGp1c3Rvcl9iYXNlCisgICAgeworICAgICAgYWx3YXlzX2FkanVzdG9yKCkgeyBzZXRfbGltaXQoY291bnQoKSk7IH0KKyAgICB9OworCisgICAgLy8vIEVudGVyIHRoZSBudGggY29uZGl0aW9uLgorICAgIHN0cnVjdCBsaW1pdF9hZGp1c3RvciA6IHB1YmxpYyBhZGp1c3Rvcl9iYXNlCisgICAgeworICAgICAgbGltaXRfYWRqdXN0b3IoY29uc3Qgc2l6ZV90IF9fbCkgeyBzZXRfbGltaXQoX19sKTsgfQorICAgIH07CisKKyAgICAvLyBJbmNyZW1lbnQgX1NfY291bnQgZXZlcnkgdGltZSBjYWxsZWQuCisgICAgLy8gSWYgX1NfY291bnQgbWF0Y2hlcyB0aGUgbGltaXQgY291bnQsIHRocm93LgorICAgIHN0YXRpYyB2b2lkCisgICAgdGhyb3dfY29uZGl0aW9uYWxseSgpCisgICAgeworICAgICAgaWYgKGNvdW50KCkgPT0gbGltaXQoKSkKKwlfX3Rocm93X2ZvcmNlZF9lcnJvcigpOworICAgICAgKytjb3VudCgpOworICAgIH0KKworICAgIHN0YXRpYyBzaXplX3QmCisgICAgY291bnQoKQorICAgIHsKKyAgICAgIHN0YXRpYyBzaXplX3QgX1NfY291bnQoMCk7CisgICAgICByZXR1cm4gX1NfY291bnQ7CisgICAgfQorCisgICAgc3RhdGljIHNpemVfdCYKKyAgICBsaW1pdCgpCisgICAgeworICAgICAgc3RhdGljIHNpemVfdCBfU19saW1pdChzdGQ6Om51bWVyaWNfbGltaXRzPHNpemVfdD46Om1heCgpKTsKKyAgICAgIHJldHVybiBfU19saW1pdDsKKyAgICB9CisKKyAgICAvLyBaZXJvIHRoZSB0aHJvdyBjb3VudGVyLCBzZXQgbGltaXQgdG8gYXJndW1lbnQuCisgICAgc3RhdGljIHZvaWQKKyAgICBzZXRfbGltaXQoY29uc3Qgc2l6ZV90IF9fbCkKKyAgICB7CisgICAgICBsaW1pdCgpID0gX19sOworICAgICAgY291bnQoKSA9IDA7CisgICAgfQorICB9OworCisKKyAgLyoqCisgICAqICBAYnJpZWYgQmFzZSBjbGFzcyBmb3IgcmFuZG9tIHByb2JhYmlsaXR5IGNvbnRyb2wgYW5kIHRocm93LgorICAgKi8KKyAgc3RydWN0IHJhbmRvbV9jb25kaXRpb24gOiBwdWJsaWMgY29uZGl0aW9uX2Jhc2UKKyAgeworICAgIC8vIFNjb3BlLWxldmVsIGFkanVzdG9yIG9iamVjdHM6IHNldCBwcm9iYWJpbGl0eSBmb3IgdGhyb3cgYXQgdGhlCisgICAgLy8gYmVnaW5uaW5nIG9mIGEgc2NvcGUgYmxvY2ssIGFuZCByZXN0b3JlcyB0byBwcmV2aW91cworICAgIC8vIHByb2JhYmlsaXR5IHdoZW4gb2JqZWN0IGlzIGRlc3Ryb3llZCBvbiBleGl0aW5nIHRoZSBibG9jay4KKyAgICBzdHJ1Y3QgYWRqdXN0b3JfYmFzZQorICAgIHsKKyAgICBwcml2YXRlOgorICAgICAgY29uc3QgZG91YmxlIF9NX29yaWc7CisKKyAgICBwdWJsaWM6CisgICAgICBhZGp1c3Rvcl9iYXNlKCkgOiBfTV9vcmlnKHByb2JhYmlsaXR5KCkpIHsgfQorCisgICAgICB2aXJ0dWFsIH5hZGp1c3Rvcl9iYXNlKCkKKyAgICAgIHsgc2V0X3Byb2JhYmlsaXR5KF9NX29yaWcpOyB9CisgICAgfTsKKworICAgIC8vLyBHcm91cCBjb25kaXRpb24uCisgICAgc3RydWN0IGdyb3VwX2FkanVzdG9yIDogcHVibGljIGFkanVzdG9yX2Jhc2UKKyAgICB7CisgICAgICBncm91cF9hZGp1c3RvcihzaXplX3Qgc2l6ZSkKKyAgICAgIHsgc2V0X3Byb2JhYmlsaXR5KDEgLSBzdGQ6OnBvdyhkb3VibGUoMSAtIHByb2JhYmlsaXR5KCkpLAorCQkJCSAgICAgZG91YmxlKDAuNSAvIChzaXplICsgMSkpKSk7CisgICAgICB9CisgICAgfTsKKworICAgIC8vLyBOZXZlciBlbnRlciB0aGUgY29uZGl0aW9uLgorICAgIHN0cnVjdCBuZXZlcl9hZGp1c3RvciA6IHB1YmxpYyBhZGp1c3Rvcl9iYXNlCisgICAgeworICAgICAgbmV2ZXJfYWRqdXN0b3IoKSB7IHNldF9wcm9iYWJpbGl0eSgwKTsgfQorICAgIH07CisKKyAgICAvLy8gQWx3YXlzIGVudGVyIHRoZSBjb25kaXRpb24uCisgICAgc3RydWN0IGFsd2F5c19hZGp1c3RvciA6IHB1YmxpYyBhZGp1c3Rvcl9iYXNlCisgICAgeworICAgICAgYWx3YXlzX2FkanVzdG9yKCkgeyBzZXRfcHJvYmFiaWxpdHkoMSk7IH0KKyAgICB9OworCisgICAgcmFuZG9tX2NvbmRpdGlvbigpCisgICAgeworICAgICAgcHJvYmFiaWxpdHkoKTsKKyAgICAgIGVuZ2luZSgpOworICAgIH0KKworICAgIHN0YXRpYyB2b2lkCisgICAgc2V0X3Byb2JhYmlsaXR5KGRvdWJsZSBfX3ApCisgICAgeyBwcm9iYWJpbGl0eSgpID0gX19wOyB9CisKKyAgICBzdGF0aWMgdm9pZAorICAgIHRocm93X2NvbmRpdGlvbmFsbHkoKQorICAgIHsKKyAgICAgIGl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0aHJvdy4KKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9Db25kPgorICAgIHN0cnVjdCB0aHJvd192YWx1ZV9iYXNlIDogcHVibGljIF9Db25kCisgICAgeworICAgICAgdHlwZWRlZiBfQ29uZCAgCQkJCWNvbmRpdGlvbl90eXBlOworCisgICAgICB1c2luZyBjb25kaXRpb25fdHlwZTo6dGhyb3dfY29uZGl0aW9uYWxseTsKKworICAgICAgc3RkOjpzaXplX3QJCQkgICAgICAgCV9NX2k7CisKKyNpZm5kZWYgX0dMSUJDWFhfSVNfQUdHUkVHQVRFCisgICAgICB0aHJvd192YWx1ZV9iYXNlKCkgOiBfTV9pKDApCisgICAgICB7IHRocm93X2NvbmRpdGlvbmFsbHkoKTsgfQorCisgICAgICB0aHJvd192YWx1ZV9iYXNlKGNvbnN0IHRocm93X3ZhbHVlX2Jhc2UmIF9fdikgOiBfTV9pKF9fdi5fTV9pKQorICAgICAgeyB0aHJvd19jb25kaXRpb25hbGx5KCk7IH0KKworICAgICAgZXhwbGljaXQgdGhyb3dfdmFsdWVfYmFzZShjb25zdCBzdGQ6OnNpemVfdCBfX2kpIDogX01faShfX2kpCisgICAgICB7IHRocm93X2NvbmRpdGlvbmFsbHkoKTsgfQorI2VuZGlmCisKKyAgICAgIHRocm93X3ZhbHVlX2Jhc2UmCisgICAgICBvcGVyYXRvcj0oY29uc3QgdGhyb3dfdmFsdWVfYmFzZSYgX192KQorICAgICAgeworCXRocm93X2NvbmRpdGlvbmFsbHkoKTsKKwlfTV9pID0gX192Ll9NX2k7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB0aHJvd192YWx1ZV9iYXNlJgorICAgICAgb3BlcmF0b3IrKygpCisgICAgICB7CisJdGhyb3dfY29uZGl0aW9uYWxseSgpOworCSsrX01faTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisgICAgfTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ29uZD4KKyAgICBpbmxpbmU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ICAqICBAYnJpZWYgIFN0cmluZyBtb3ZlIGFzc2lnbm1lbnQgb3BlcmF0b3IuCisgICAgICAgKiAgQHBhcmFtICBfX3N0ciAgU291cmNlIHN0cmluZy4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIGNvbnRlbnRzIG9mIEBhIF9fc3RyIGFyZSBtb3ZlZCBpbnRvIHRoaXMgc3RyaW5nICh3aXRob3V0CisgICAgICAgKiAgY29weWluZykuICBAYSBfX3N0ciBpcyBhIHZhbGlkLCBidXQgdW5zcGVjaWZpZWQgc3RyaW5nLgorICAgICAgICovCisgICAgICBfX3ZlcnNhX3N0cmluZyYKKyAgICAgIG9wZXJhdG9yPShfX3ZlcnNhX3N0cmluZyYmIF9fc3RyKQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCXRoaXMtPnN3YXAoX19zdHIpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTZXQgdmFsdWUgdG8gc3RyaW5nIGNvbnN0cnVjdGVkIGZyb20gaW5pdGlhbGl6ZXIgbGlzdC4KKyAgICAgICAqICBAcGFyYW0gIF9fbCAgc3RkOjppbml0aWFsaXplcl9saXN0LgorICAgICAgICovCisgICAgICBfX3ZlcnNhX3N0cmluZyYKKyAgICAgIG9wZXJhdG9yPShzdGQ6OmluaXRpYWxpemVyX2xpc3Q8X0NoYXJUPiBfX2wpCisgICAgICB7CisJdGhpcy0+YXNzaWduKF9fbC5iZWdpbigpLCBfX2wuZW5kKCkpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvcHkgY29udGVudHMgb2YgQGEgX19zIGludG8gdGhpcyBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFNvdXJjZSBudWxsLXRlcm1pbmF0ZWQgc3RyaW5nLgorICAgICAgICovCisgICAgICBfX3ZlcnNhX3N0cmluZyYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfQ2hhclQqIF9fcykgCisgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oX19zKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldCB2YWx1ZSB0byBzdHJpbmcgb2YgbGVuZ3RoIDEuCisgICAgICAgKiAgQHBhcmFtICBfX2MgIFNvdXJjZSBjaGFyYWN0ZXIuCisgICAgICAgKgorICAgICAgICogIEFzc2lnbmluZyB0byBhIGNoYXJhY3RlciBtYWtlcyB0aGlzIHN0cmluZyBsZW5ndGggMSBhbmQKKyAgICAgICAqICAoKnRoaXMpWzBdID09IEBhIF9fYy4KKyAgICAgICAqLworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICBvcGVyYXRvcj0oX0NoYXJUIF9fYykgCisgICAgICB7IAorCXRoaXMtPmFzc2lnbigxLCBfX2MpOyAKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8vIEl0ZXJhdG9yczoKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkL3dyaXRlIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdCBjaGFyYWN0ZXIgaW4KKyAgICAgICAqICB0aGUgJXN0cmluZy4gIFVuc2hhcmVzIHRoZSBzdHJpbmcuCisgICAgICAgKi8KKyAgICAgIGl0ZXJhdG9yCisgICAgICBiZWdpbigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJdGhpcy0+X01fbGVhaygpOworCXJldHVybiBpdGVyYXRvcih0aGlzLT5fTV9kYXRhKCkpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgaXRlcmF0b3IgdGhhdCBwb2ludHMgdG8gdGhlIGZpcnN0CisgICAgICAgKiAgY2hhcmFjdGVyIGluIHRoZSAlc3RyaW5nLgorICAgICAgICovCisgICAgICBjb25zdF9pdGV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RhbnQpIHJldmVyc2UgaXRlcmF0b3IgdGhhdCBwb2ludHMKKyAgICAgICAqICB0byBvbmUgYmVmb3JlIHRoZSBmaXJzdCBjaGFyYWN0ZXIgaW4gdGhlICVzdHJpbmcuICBJdGVyYXRpb24KKyAgICAgICAqICBpcyBkb25lIGluIHJldmVyc2UgZWxlbWVudCBvcmRlci4KKyAgICAgICAqLworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKHRoaXMtPmJlZ2luKCkpOyB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgUmV0dXJucyBhIHJlYWQtb25seSAoY29uc3RhbnQpIGl0ZXJhdG9yIHRoYXQgcG9pbnRzIHRvIHRoZSBmaXJzdAorICAgICAgICogIGNoYXJhY3RlciBpbiB0aGUgJXN0cmluZy4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGNiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9pdGVyYXRvcih0aGlzLT5fTV9kYXRhKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIFJldHVybnMgYSByZWFkLW9ubHkgKGNvbnN0YW50KSBpdGVyYXRvciB0aGF0IHBvaW50cyBvbmUgcGFzdCB0aGUKKyAgICAgICAqICBsYXN0IGNoYXJhY3RlciBpbiB0aGUgJXN0cmluZy4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGNlbmQoKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IodGhpcy0+X01fZGF0YSgpICsgdGhpcy0+c2l6ZSgpKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZ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bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gb3BlcmF0b3JbXSgwKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC93cml0ZSByZWZlcmVuY2UgdG8gdGhlIGRhdGEgYXQgdGhlIGxhc3QKKyAgICAgICAqICBlbGVtZW50IG9mIHRoZSAlc3RyaW5nLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeyByZXR1cm4gb3BlcmF0b3JbXSh0aGlzLT5zaXplKCkgLSAxKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm5zIGEgcmVhZC1vbmx5IChjb25zdGFudCkgcmVmZXJlbmNlIHRvIHRoZSBkYXRhIGF0IHRoZQorICAgICAgICogIGxhc3QgZWxlbWVudCBvZiB0aGUgJXN0cmluZy4KKyAgICAgICAqLworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIG9wZXJhdG9yW10odGhpcy0+c2l6ZSgpIC0gMSk7IH0KKyNlbmRpZgorCisgICAgICAvLyBNb2RpZmllcnM6CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFwcGVuZCBhIHN0cmluZyB0byB0aGlzIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFRoZSBzdHJpbmcgdG8gYXBwZW5kLgorICAgICAgICogIEByZXR1cm4gIFJlZmVyZW5jZSB0byB0aGlzIHN0cmluZy4KKyAgICAgICAqLworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICBvcGVyYXRvcis9KGNvbnN0IF9fdmVyc2Ffc3RyaW5nJiBfX3N0cikKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmFwcGVuZChfX3N0cik7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBcHBlbmQgYSBDIHN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zICBUaGUgQ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fQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFwcGVuZCBhIHNpbmdsZSBjaGFyYWN0ZXIuCisgICAgICAgKiAgQHBhcmFtIF9fYyAgQ2hhcmFjdGVyIHRvIGFwcGVuZC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcHVzaF9iYWNrKF9DaGFyVCBfX2MpCisgICAgICB7IAorCWNvbnN0IHNpemVfdHlwZSBfX3NpemUgPSB0aGlzLT5zaXplKCk7CisJaWYgKF9fc2l6ZSArIDEgPiB0aGlzLT5jYXBhY2l0eSgpIHx8IHRoaXMtPl9NX2lzX3NoYXJlZCgpKQorCSAgdGhpcy0+X01fbXV0YXRlKF9fc2l6ZSwgc2l6ZV90eXBlKDApLCAwLCBzaXplX3R5cGUoMSkpOworCXRyYWl0c190eXBlOjphc3NpZ24odGhpcy0+X01fZGF0YSgpW19fc2l6ZV0sIF9fYyk7CisJdGhpcy0+X01fc2V0X2xlbmd0aChfX3NpemUgKyAxKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTZXQgdmFsdWUgdG8gY29udGVudHMgb2YgYW5vdGhlciBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtICBfX3N0ciAgU291cmNlIHN0cmluZyB0byB1c2UuCisgICAgICAgKiAgQHJldHVybiAgUmVmZXJlbmNlIHRvIHRoaXMgc3RyaW5nLgorICAgICAgICovCisgICAgICBfX3ZlcnNhX3N0cmluZyYKKyAgICAgIGFzc2lnbihjb25zdCBfX3ZlcnNhX3N0cmluZyYgX19zdHIpCisgICAgICB7CisJdGhpcy0+X01fYXNzaWduKF9fc3RyKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTZXQgdmFsdWUgdG8gY29udGVudHMgb2YgYW5vdGhlciBzdHJpbmcuCisgICAgICA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dGVycyBpbiBAYSBfX3MsIHRoZSByZW1haW5kZXIgb2YKKyAgICAgICAqICBAYSBfX3MgaXMgdXNlZC4KKyAgICAgICAqLworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICBhc3NpZ24oY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX24pCisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZ19sZW4oX19zLCBfX24pOworCXJldHVybiBfTV9yZXBsYWNlKHNpemVfdHlwZSgwKSwgdGhpcy0+c2l6ZSgpLCBfX3MsIF9fbik7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU2V0IHZhbHVlIHRvIGNvbnRlbnRzIG9mIGEgQyBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcyAgVGhlIEMgc3RyaW5nIHRvIHVzZS4KKyAgICAgICAqICBAcmV0dXJuICBSZWZlcmVuY2UgdG8gdGhpcyBzdHJpbmcuCisgICAgICAgKgorICAgICAgICogIFRoaXMgZnVuY3Rpb24gc2V0cyB0aGUgdmFsdWUgb2YgdGhpcyBzdHJpbmcgdG8gdGhlIHZhbHVlIG9mCisgICAgICAgKiAgQGEgX19zLiAgVGhlIGRhdGEgaXMgY29waWVkLCBzbyB0aGVyZSBpcyBubyBkZXBlbmRlbmNlIG9uIEBhCisgICAgICAgKiAgX19zIG9uY2UgdGhlIGZ1bmN0aW9uIHJldHVybnMuCisgICAgICAgKi8KKyAgICAgIF9fdmVyc2Ffc3RyaW5nJgorICAgICAgYXNzaWduKGNvbnN0IF9DaGFyVCogX19zKQorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19zdHJpbmcoX19zKTsKKwlyZXR1cm4gX01fcmVwbGFjZShzaXplX3R5cGUoMCksIHRoaXMtPnNpemUoKSwgX19zLAorCQkJICB0cmFpdHNfdHlwZTo6bGVuZ3RoKF9fcykpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJ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pcy0+X01fZGF0YSgpICsgX19wb3MpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmVtb3ZlIHRoZSBsYXN0IGNoYXJhY3Rlci4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIHN0cmluZyBtdXN0IGJlIG5vbi1lbXB0eS4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcG9wX2JhY2soKQorICAgICAgeyB0aGlzLT5fTV9lcmFzZShzaXplKCktMSwgMSk7IH0KKyNlbmRpZiAvLyBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFJlcGxhY2UgY2hhcmFjdGVycyB3aXRoIHZhbHVlIGZyb20gYW5vdGhlciBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBmaXJzdCBjaGFyYWN0ZXIgdG8gcmVwbGFjZS4KKyAgICAgICAqICBAcGFyYW0gX19uICBOdW1iZXIgb2YgY2hhcmFjdGVycyB0byBiZSByZXBsYWNlZC4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFN0cmluZyB0byBpbnNlcnQuCisgICAgICAgKiAgQHJldHVybiAgUmVmZXJlbmNlIHRvIHRoaXMgc3RyaW5nLgorICAgICAgICogIEB0aHJvdyAgc3RkOjpvdXRfb2ZfcmFuZ2UgIElmIEBhIF9fcG9zIGlzIGJleW9uZCB0aGUgZW5kIG9mIHRoaXMKKyAgICAgICAqICBzdHJpbmcuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Omxlbmd0aF9lcnJvciAgSWYgbmV3IGxlbmd0aCBleGNlZWRzIEBjIG1heF9zaXplKCkuCisgICAgICAgKgorICAgICAgICogIFJlbW92ZXMgdGhlIGNoYXJhY3RlcnMgaW4gdGhlIHJhbmdlIFtwb3MscG9zK24pIGZyb20gdGhpcworICAgICAgIC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AqLworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICByZXBsYWNlKHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fbjEsIHNpemVfdHlwZSBfX24yLCBfQ2hhclQgX19jKQorICAgICAgeyByZXR1cm4gX01fcmVwbGFjZV9hdXgoX01fY2hlY2soX19wb3MsICJfX3ZlcnNhX3N0cmluZzo6cmVwbGFjZSIpLAorCQkJICAgICAgX01fbGltaXQoX19wb3MsIF9fbjEpLCBfX24yLCBfX2MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmVwbGFjZSByYW5nZSBvZiBjaGFyYWN0ZXJzIHdpdGggc3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX2kxICBJdGVyYXRvciByZWZlcmVuY2luZyBzdGFydCBvZiByYW5nZSB0byByZXBsYWNlLgorICAgICAgICogIEBwYXJhbSBfX2kyICBJdGVyYXRvciByZWZlcmVuY2luZyBlbmQgb2YgcmFuZ2UgdG8gcmVwbGFjZS4KKyAgICAgICAqICBAcGFyYW0gX19zdHIgIFN0cmluZyB2YWx1ZSB0byBpbnNlcnQuCisgICAgICAgKiAgQHJldHVybiAgUmVmZXJlbmNlIHRvIHRoaXMgc3RyaW5nLgorICAgICAgICogIEB0aHJvdyAgc3RkOjpsZW5ndGhfZXJyb3IgIElmIG5ldyBsZW5ndGggZXhjZWVkcyBAYyBtYXhfc2l6ZSgpLgorICAgICAgICoKKyAgICAgICAqICBSZW1vdmVzIHRoZSBjaGFyYWN0ZXJzIGluIHRoZSByYW5nZSBbaTEsaTIpLiAgSW4gcGxhY2UsIHRoZQorICAgICAgICogIHZhbHVlIG9mIEBhIF9fc3RyIGlzIGluc2VydGVkLiAgSWYgdGhlIGxlbmd0aCBvZiByZXN1bHQKKyAgICAgICAqICBleGNlZWRzIG1heF9zaXplKCksIGxlbmd0aF9lcnJvciBpcyB0aHJvd24uICBUaGUgdmFsdWUgb2YKKyAgICAgICAqICB0aGUgc3RyaW5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19jKTsKKworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICBfTV9yZXBsYWNlKHNpemVfdHlwZSBfX3Bvcywgc2l6ZV90eXBlIF9fbGVuMSwgY29uc3QgX0NoYXJUKiBfX3MsCisJCSBjb25zdCBzaXplX3R5cGUgX19sZW4yKTsKKworICAgICAgX192ZXJzYV9zdHJpbmcmCisgICAgICBfTV9hcHBlbmQoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX24pOworCisgICAgcHVibGljOgorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvcHkgc3Vic3RyaW5nIGludG8gQyBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcyAgQyBzdHJpbmcgdG8gY29weSB2YWx1ZSBpbnRvLgorICAgICAgICogIEBwYXJhbSBfX24gIE51bWJlciBvZiBjaGFyYWN0ZXJzIHRvIGNvcHkuCisgICAgICAgKiAgQHBhcmFtIF9fcG9zICBJbmRleCBvZiBmaXJzdCBjaGFyYWN0ZXIgdG8gY29weS4KKyAgICAgICAqICBAcmV0dXJuICBOdW1iZXIgb2YgY2hhcmFjdGVycyBhY3R1YWxseSBjb3BpZWQKKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6b3V0X29mX3JhbmdlICBJZiBwb3MgPiBzaXplKCkuCisgICAgICAgKgorICAgICAgICogIENvcGllcyB1cCB0byBAYSBfX24gY2hhcmFjdGVycyBzdGFydGluZyBhdCBAYSBfX3BvcyBpbnRvIHRoZQorICAgICAgICogIEMgc3RyaW5nIEBhIHMuICBJZiBAYSBfX3BvcyBpcyBncmVhdGVyIHRoYW4gc2l6ZSgpLAorICAgICAgICogIG91dF9vZl9yYW5nZSBpcyB0aHJvd24uCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBjb3B5KF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19uLCBzaXplX3R5cGUgX19wb3MgPSAwKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTd2FwIGNvbnRlbnRzIHdpdGggYW5vdGhlciBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcyAgU3RyaW5nIHRvIHN3YXAgd2l0aC4KKyAgICAgICAqCisgICAgICAgKiAgRXhjaGFuZ2VzIHRoZSBjb250ZW50cyBvZiB0aGlzIHN0cmluZyB3aXRoIHRoYXQgb2YgQGEgX19zIGluCisgICAgICAgKiAgY29uc3RhbnQgdGltZS4KKyAgICAgICovCisgICAgICB2b2lkCisgICAgICBzd2FwKF9fdmVyc2Ffc3RyaW5nJiBfX3MpCisgICAgICB7IHRoaXMtPl9NX3N3YXAoX19zKTsgfQorCisgICAgICAvLyBTdHJpbmcgb3BlcmF0aW9uczoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGNvbnN0IHBvaW50ZXIgdG8gbnVsbC10ZXJtaW5hdGVkIGNvbnRlbnRzLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGlzIGEgaGFuZGxlIHRvIGludGVybmFsIGRhdGEuICBEbyBub3QgbW9kaWZ5IG9yIGRpcmUgdGhpbmdzIG1heQorICAgICAgICogIGhhcHBlbi4KKyAgICAgICovCisgICAgICBjb25zdCBfQ2hhclQqCisgICAgICBjX3N0cigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiB0aGlzLT5fTV9kYXRhKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gY29uc3QgcG9pbnRlciB0byBjb250ZW50cy4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBpcyBhIGhhbmRsZSB0byBpbnRlcm5hbCBkYXRhLiAgRG8gbm90IG1vZGlmeSBvciBkaXJlIHRoaW5ncyBtYXkKKyAgICAgICAqICBoYXBwZW4uCisgICAgICAqLworICAgICAgY29uc3QgX0NoYXJUKgorICAgICAgZGF0YSgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgIC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ByZXR1cm4gIEluZGV4IG9mIHN0YXJ0IG9mIGZpcnN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGZvcndhcmQgZm9yIHRoZSB2YWx1ZSBvZiBAYQorICAgICAgICogIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwgcmV0dXJucyB0aGUgaW5kZXggd2hlcmUKKyAgICAgICAqICBpdCBiZWdpbnMuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIGZpbmQoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworCXJldHVybiB0aGlzLT5maW5kKF9fcywgX19wb3MsIHRyYWl0c190eXBlOjpsZW5ndGgoX19zKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBwb3NpdGlvbiBvZiBhIGNoYXJhY3Rlci4KKyAgICAgICAqICBAcGFyYW0gX19jICBDaGFyYWN0ZXIgdG8gbG9jYXRlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgY2hhcmFjdGVyIHRvIHNlYXJjaCBmcm9tIChkZWZhdWx0IDApLgorICAgICAgICogIEByZXR1cm4gIEluZGV4IG9mIGZpcnN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGZvcndhcmQgZm9yIEBhIF9fYyB3aXRoaW4KKyAgICAgICAqICB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zIHRoZSBpbmRleCB3aGVyZSBpdCB3YXMKKyAgICAgICAqICBmb3VuZC4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZChfQ2hhclQgX19jLCBzaXplX3R5cGUgX19wb3MgPSAwKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGxhc3QgcG9zaXRpb24gb2YgYSBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fc3RyICBTdHJpbmcgdG8gbG9jYXRlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgY2hhcmFjdGVyIHRvIHNlYXJjaCBiYWNrIGZyb20gKGRlZmF1bHQgZW5kKS4KKyAgICAgICAqICBAcmV0dXJuICBJbmRleCBvZiBzdGFydCBvZiBsYXN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGJhY2t3YXJkIGZvciB2YWx1ZSBvZiBAYQorICAgICAgICogIF9fc3RyIHdpdGhpbiB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zIHRoZSBpbmRleCB3aGVyZQorICAgICAgICogIGl0IGJlZ2lucy4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgcmZpbmQoY29uc3QgX192ZXJzYV9zdHJpbmcmIF9fc3RyLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdAorCV9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiB0aGlzLT5yZmluZChfX3N0ci5kYXRhKCksIF9fcG9zLCBfX3N0ci5zaXplKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBsYXN0IHBvc2l0aW9uIG9mIGEgQyBzdWJzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fcyAgQyBzdHJpbmcgdG8gbG9jYXRlL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gorICAgICAgICogIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwgcmV0dXJucyB0aGUgaW5kZXgKKyAgICAgICAqICB3aGVyZSBpdCBiZWdpbnMuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIHJmaW5kKGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdAorICAgICAgeworCV9fZ2xpYmN4eF9yZXF1aXJlc19zdHJpbmcoX19zKTsKKwlyZXR1cm4gdGhpcy0+cmZpbmQoX19zLCBfX3BvcywgdHJhaXRzX3R5cGU6Omxlbmd0aChfX3MpKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGxhc3QgcG9zaXRpb24gb2YgYSBjaGFyYWN0ZXIuCisgICAgICAgKiAgQHBhcmFtIF9fYyAgQ2hhcmFjdGVyIHRvIGxvY2F0ZS4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggYmFjayBmcm9tIChkZWZhdWx0IGVuZCkuCisgICAgICAgKiAgQHJldHVybiAgSW5kZXggb2YgbGFzdCBvY2N1cnJlbmNlLgorICAgICAgICoKKyAgICAgICAqICBTdGFydGluZyBmcm9tIEBhIF9fcG9zLCBzZWFyY2hlcyBiYWNrd2FyZCBmb3IgQGEgX19jIHdpdGhpbgorICAgICAgICogIHRoaXMgc3RyaW5nLiAgSWYgZm91bmQsIHJldHVybnMgdGhlIGluZGV4IHdoZXJlIGl0IHdhcworICAgICAgICogIGZvdW5kLiAgSWYgbm90IGZvdW5kLCByZXR1cm5zIG5wb3MuCisgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICByZmluZChfQ2hhclQgX19jLCBzaXplX3R5cGUgX19wb3MgPSBucG9zKSBjb25zdCBfR0xJQkNYWF9OT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AgICAgICAqICBjaGFyYWN0ZXJzIG9mIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwgcmV0dXJucworICAgICAgICogIHRoZSBpbmRleCB3aGVyZSBpdCB3YXMgZm91bmQuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIGZpbmRfZmlyc3Rfb2YoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworCXJldHVybiB0aGlzLT5maW5kX2ZpcnN0X29mKF9fcywgX19wb3MsIHRyYWl0c190eXBlOjpsZW5ndGgoX19zKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZCBwb3NpdGlvbiBvZiBhIGNoYXJhY3Rlci4KKyAgICAgICAqICBAcGFyYW0gX19jICBDaGFyYWN0ZXIgdG8gbG9jYXRlLgorICAgICAgICogIEBwYXJhbSBfX3BvcyAgSW5kZXggb2YgY2hhcmFjdGVyIHRvIHNlYXJjaCBmcm9tIChkZWZhdWx0IDApLgorICAgICAgICogIEByZXR1cm4gIEluZGV4IG9mIGZpcnN0IG9jY3VycmVuY2UuCisgICAgICAgKgorICAgICAgICogIFN0YXJ0aW5nIGZyb20gQGEgX19wb3MsIHNlYXJjaGVzIGZvcndhcmQgZm9yIHRoZSBjaGFyYWN0ZXIKKyAgICAgICAqICBAYSBfX2Mgd2l0aGluIHRoaXMgc3RyaW5nLiAgSWYgZm91bmQsIHJldHVybnMgdGhlIGluZGV4CisgICAgICAgKiAgd2hlcmUgaXQgd2FzIGZvdW5kLiAgSWYgbm90IGZvdW5kLCByZXR1cm5zIG5wb3MuCisgICAgICAgKgorICAgICAgICogIE5vdGU6IGVxdWl2YWxlbnQgdG8gZmluZChjLCBwb3MpLgorICAgICAgKi8KK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SBfX3BvcywKKwkJCXNpemVfdHlwZSBfX24pIGNvbnN0OworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmQgcG9zaXRpb24gb2YgYSBjaGFyYWN0ZXIgbm90IGluIEMgc3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3MgIEMgc3RyaW5nIGNvbnRhaW5pbmcgY2hhcmFjdGVycyB0byBhdm9pZC4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggZnJvbSAoZGVmYXVsdCAwKS4KKyAgICAgICAqICBAcmV0dXJuICBJbmRleCBvZiBmaXJzdCBvY2N1cnJlbmNlLgorICAgICAgICoKKyAgICAgICAqICBTdGFydGluZyBmcm9tIEBhIF9fcG9zLCBzZWFyY2hlcyBmb3J3YXJkIGZvciBhIGNoYXJhY3RlciBub3QKKyAgICAgICAqICBjb250YWluZWQgaW4gQGEgX19zIHdpdGhpbiB0aGlzIHN0cmluZy4gIElmIGZvdW5kLCByZXR1cm5zCisgICAgICAgKiAgdGhlIGluZGV4IHdoZXJlIGl0IHdhcyBmb3VuZC4gIElmIG5vdCBmb3VuZCwgcmV0dXJucyBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9maXJzdF9ub3Rfb2YoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcyA9IDApIGNvbnN0CisgICAgICB7CisJX19nbGliY3h4X3JlcXVpcmVzX3N0cmluZyhfX3MpOworCXJldHVybiB0aGlzLT5maW5kX2ZpcnN0X25vdF9vZihfX3MsIF9fcG9zLCB0cmFpdHNfdHlwZTo6bGVuZ3RoKF9fcykpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEZpbmQgcG9zaXRpb24gb2YgYSBkaWZmZXJlbnQgY2hhcmFjdGVyLgorICAgICAgICogIEBwYXJhbSBfX2MgIENoYXJhY3RlciB0byBhd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3VuZCwgcmV0dXJucyB0aGUgaW5kZXggd2hlcmUgaXQKKyAgICAgICAqICB3YXMgZm91bmQuICBJZiBub3QgZm91bmQsIHJldHVybnMgbnBvcy4KKyAgICAgICovCisgICAgICBzaXplX3R5cGUKKyAgICAgIGZpbmRfbGFzdF9ub3Rfb2YoY29uc3QgX0NoYXJUKiBfX3MsIHNpemVfdHlwZSBfX3BvcywKKwkJICAgICAgIHNpemVfdHlwZSBfX24pIGNvbnN0OworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGaW5kIGxhc3QgcG9zaXRpb24gb2YgYSBjaGFyYWN0ZXIgbm90IGluIEMgc3RyaW5nLgorICAgICAgICogIEBwYXJhbSBfX3MgIEMgc3RyaW5nIGNvbnRhaW5pbmcgY2hhcmFjdGVycyB0byBhdm9pZC4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGNoYXJhY3RlciB0byBzZWFyY2ggYmFjayBmcm9tIChkZWZhdWx0IGVuZCkuCisgICAgICAgKiAgQHJldHVybiAgSW5kZXggb2YgbGFzdCBvY2N1cnJlbmNlLgorICAgICAgICoKKyAgICAgICAqICBTdGFydGluZyBmcm9tIEBhIF9fcG9zLCBzZWFyY2hlcyBiYWNrd2FyZCBmb3IgYSBjaGFyYWN0ZXIKKyAgICAgICAqICBub3QgY29udGFpbmVkIGluIEBhIF9fcyB3aXRoaW4gdGhpcyBzdHJpbmcuICBJZiBmb3VuZCwKKyAgICAgICAqICByZXR1cm5zIHRoZSBpbmRleCB3aGVyZSBpdCB3YXMgZm91bmQuICBJZiBub3QgZm91bmQsIHJldHVybnMKKyAgICAgICAqICBucG9zLgorICAgICAgKi8KKyAgICAgIHNpemVfdHlwZQorICAgICAgZmluZF9sYXN0X25vdF9vZihjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fcG9zID0gbnBvcykgY29uc3QKKyAgICAgIHsKKwlfX2dsaWJjeHhfcmVxdWlyZXNfc3RyaW5nKF9fcy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dWx0IHJlbWFpbmRlcikuCisgICAgICAgKiAgQHJldHVybiAgVGhlIG5ldyBzdHJpbmcuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om91dF9vZl9yYW5nZSAgSWYgcG9zID4gc2l6ZSgpLgorICAgICAgICoKKyAgICAgICAqICBDb25zdHJ1Y3QgYW5kIHJldHVybiBhIG5ldyBzdHJpbmcgdXNpbmcgdGhlIEBhIF9fbgorICAgICAgICogIGNoYXJhY3RlcnMgc3RhcnRpbmcgYXQgQGEgX19wb3MuICBJZiB0aGUgc3RyaW5nIGlzIHRvbworICAgICAgICogIHNob3J0LCB1c2UgdGhlIHJlbWFpbmRlciBvZiB0aGUgY2hhcmFjdGVycy4gIElmIEBhIF9fcG9zIGlzCisgICAgICAgKiAgYmV5b25kIHRoZSBlbmQgb2YgdGhlIHN0cmluZywgb3V0X29mX3JhbmdlIGlzIHRocm93bi4KKyAgICAgICovCisgICAgICBfX3ZlcnNhX3N0cmluZworICAgICAgc3Vic3RyKHNpemVfdHlwZSBfX3BvcyA9IDAsIHNpemVfdHlwZSBfX24gPSBucG9zKSBjb25zdAorICAgICAgeworCXJldHVybiBfX3ZlcnNhX3N0cmluZygqdGhpcywgX01fY2hlY2soX19wb3MsICJfX3ZlcnNhX3N0cmluZzo6c3Vic3RyIiksCisJCQkgICAgICBfX24pOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENvbXBhcmUgdG8gYSBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fc3RyICBTdHJpbmcgdG8gY29tcGFyZSBhZ2FpbnN0LgorICAgICAgICogIEByZXR1cm4gIEludGVnZXIgPCAwLCAwLCBvciA+IDAuCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgYW4gaW50ZWdlciA8IDAgaWYgdGhpcyBzdHJpbmcgaXMgb3JkZXJlZCBiZWZvcmUgQGEKKyAgICAgICAqICBfX3N0ciwgMCBpZiB0aGVpciB2YWx1ZXMgYXJlIGVxdW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20gQGEgX19zLiAgVGhlCisgICAgICAgKiAgZnVuY3Rpb24gdGhlbiBjb21wYXJlcyB0aGUgdHdvIHN0cmluZyBieSBjYWxsaW5nCisgICAgICAgKiAgdHJhaXRzOjpjb21wYXJlKHN1YnN0cmluZy5kYXRhKCkscyxybGVuKS4gIElmIHRoZSByZXN1bHQgb2YKKyAgICAgICAqICB0aGUgY29tcGFyaXNvbiBpcyBub256ZXJvIHJldHVybnMgaXQsIG90aGVyd2lzZSB0aGUgc2hvcnRlcgorICAgICAgICogIG9uZSBpcyBvcmRlcmVkIGZpcnN0LgorICAgICAgKi8KKyAgICAgIGludAorICAgICAgY29tcGFyZShzaXplX3R5cGUgX19wb3MsIHNpemVfdHlwZSBfX24xLCBjb25zdCBfQ2hhclQqIF9fcykgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29tcGFyZSBzdWJzdHJpbmcgYWdhaW5zdCBhIGNoYXJhY3RlciBhcnJheS4KKyAgICAgICAqICBAcGFyYW0gX19wb3MgIEluZGV4IG9mIGZpcnN0IGNoYXJhY3RlciBvZiBzdWJzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtIF9fbjEgIE51bWJlciBvZiBjaGFyYWN0ZXJzIGluIHN1YnN0cmluZy4KKyAgICAgICAqICBAcGFyYW0gX19zICBjaGFyYWN0ZXIgYXJyYXkgdG8gY29tcGFyZSBhZ2FpbnN0LgorICAgICAgICogIEBwYXJhbSBfX24yICBOdW1iZXIgb2YgY2hhcmFjdGVycyBvZiBzLgorICAgICAgICogIEByZXR1cm4gIEludGVnZXIgPCAwLCAwLCBvciA+IDAuCisgICAgICAgKgorICAgICAgICogIEZvcm0gdGhlIHN1YnN0cmluZyBvZiB0aGlzIHN0cmluZyBmcm9tIHRoZSBAYSBfX24xCisgICAgICAgKiAgY2hhcmFjdGVycyBzdGFydGluZyBhdCBAYSBfX3Bvcy4gIEZvcm0gYSBzdHJpbmcgZnJvbSB0aGUKKyAgICAgICAqICBm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GluZSBfX3ZzdHJpbmcKKyAgdG9fc3RyaW5nKGxvbmcgX192YWwpCisgIHsgcmV0dXJuIF9fZ251X2N4eDo6X190b194c3RyaW5nPF9fdnN0cmluZz4oJnN0ZDo6dnNucHJpbnRmLAorCQkJCQkgICAgICA0ICogc2l6ZW9mKGxvbmcpLAorCQkJCQkgICAgICAiJWxkIiwgX192YWwpOyB9CisKKyAgaW5saW5lIF9fdnN0cmluZworICB0b19zdHJpbmcodW5zaWduZWQgbG9uZyBfX3ZhbCkKKyAgeyByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8X192c3RyaW5nPigmc3RkOjp2c25wcmludGYsCisJCQkJCSAgICAgIDQgKiBzaXplb2YodW5zaWduZWQgbG9uZyksCisJCQkJCSAgICAgICIlbHUiLCBfX3ZhbCk7IH0KKworCisgIGlubGluZSBfX3ZzdHJpbmcKKyAgdG9fc3RyaW5nKGxvbmcgbG9uZyBfX3ZhbCkKKyAgeyByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8X192c3RyaW5nPigmc3RkOjp2c25wcmludGYsCisJCQkJCSAgICAgIDQgKiBzaXplb2YobG9uZyBsb25nKSwKKwkJCQkJICAgICAgIiVsbGQiLCBfX3ZhbCk7IH0KKworICBpbmxpbmUgX192c3RyaW5nCisgIHRvX3N0cmluZyh1bnNpZ25lZCBsb25nIGxvbmcgX192YWwpCisgIHsgcmV0dXJuIF9fZ251X2N4eDo6X190b194c3RyaW5nPF9fdnN0cmluZz4oJnN0ZDo6dnNucHJpbnRmLAorCQkJCQkgICAgICA0ICogc2l6ZW9mKHVuc2lnbmVkIGxvbmcgbG9uZyksCisJCQkJCSAgICAgICIlbGx1IiwgX192YWwpOyB9CisKKyAgaW5saW5lIF9fdnN0cmluZworICB0b19zdHJpbmcoZmxvYXQgX192YWwpCisgIHsKKyAgICBjb25zdCBpbnQgX19uID0gX19udW1lcmljX3RyYWl0czxmbG9hdD46Ol9fbWF4X2V4cG9uZW50MTAgKyAyMDsKKyAgICByZXR1cm4gX19nbnVfY3h4OjpfX3RvX3hzdHJpbmc8X192c3RyaW5nPigmc3RkOjp2c25wcmludGYsIF9fbiwKKwkJCQkJICAgICAgIiVmIiwgX192YWwpOworICB9CisKKyAgaW5saW5lIF9fdnN0cmluZworICB0b19zdHJpbmcoZG91YmxlIF9fdmFsKQorICB7CisgICAgY29uc3QgaW50IF9fbiA9IF9fbnVtZXJpY190cmFpdHM8ZG91YmxlPjo6X19tYXhfZXhwb25lbnQxMCArIDIwOworICAgIHJldHVybiBfX2dudV9jeHg6Ol9fdG9feHN0cmluZzxfX3ZzdHJpbmc+KCZzdGQ6OnZzbnByaW50ZiwgX19uLAorCQkJCQkgICAgICAiJWYiLCBfX3ZhbCk7CisgIH0KKworICBpbmxpbmUgX192c3RyaW5nCisgIHRvX3N0cmluZyhsb25nIGRvdWJsZSBfX3ZhbCkKKyAgeworICAgIGNvbnN0IGludCBfX24gPSBfX251bWVyaWNfdHJhaXRzPGxvbmcgZG91YmxlPjo6X19tYXhfZXhwb25lbnQxMCArIDIwOworICAgIHJldHVybiBfX2dudV9jeHg6Ol9fdG9feHN0cmluZzxfX3ZzdHJpbmc+KCZzdGQ6OnZzbnByaW50ZiwgX19uLAorCQkJCQkgICAgICAiJUxmIiwgX192YWwpOworICB9CisKKyNpZmRlZiBfR0xJQkNYWF9VU0VfV0NIQVJfVAorICBpbmxpbmUgaW50IAorICBzdG9pKGNvbnN0IF9fd3ZzdHJpbmcmIF9fc3RyLCBzdGQ6OnNpemVfdCogX19pZHggPSAwLCBpbnQgX19iYXNlID0gMTApCisgIHsgcmV0dXJuIF9fZ251X2N4eDo6X19zdG9hPGxvbmcsIGludD4oJnN0ZDo6d2NzdG9sLCAic3RvaSIsIF9fc3RyLmNfc3RyKCksCisJCQkJCV9faWR4LCBfX2Jhc2UpOyB9CisKKyAgaW5saW5lIGxvbmcgCisgIHN0b2woY29uc3QgX193dnN0cmluZyYgX19zdHIsIHN0ZDo6c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CSAgICAgIF9fc3RyLmVyYXNlKCk7CisJICAgICAgX0NoYXJUIF9fYnVmWzEyOF07CisJICAgICAgX19zaXplX3R5cGUgX19sZW4gPSAwOworCSAgICAgIGNvbnN0IHN0cmVhbXNpemUgX193ID0gX19pbi53aWR0aCgpOworCSAgICAgIGNvbnN0IF9fc2l6ZV90eXBlIF9fbiA9IF9fdyA+IDAgPyBzdGF0aWNfY2FzdDxfX3NpemVfdHlwZT4oX193KQorCQkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IF9fc3RyLm1heF9zaXplKCk7CisJICAgICAgY29uc3QgX19jdHlwZV90eXBlJiBfX2N0ID0gdXNlX2ZhY2V0PF9fY3R5cGVfdHlwZT4oX19pbi5nZXRsb2MoKSk7CisJICAgICAgY29uc3QgX19pbnRfdHlwZSBfX2VvZiA9IF9UcmFpdHM6OmVvZigpOworCSAgICAgIF9faW50X3R5cGUgX19jID0gX19pbi5yZGJ1ZigpLT5zZ2V0YygpOworCisJICAgICAgd2hpbGUgKF9fZXh0cmFjdGVkIDwgX19uCisJCSAgICAgJiYgIV9UcmFpdHM6OmVxX2ludF90eXBlKF9fYywgX19lb2YpCisJCSAgICAgJiYgIV9fY3QuaXMoX19jdHlwZV9iYXNlOjpzcGFjZSwKKwkJCQkgX1RyYWl0czo6dG9fY2hhcl90eXBlKF9fYykpKQorCQl7CisJCSAgaWYgKF9fbGVuID09IHNpemVvZihfX2J1ZikgLyBzaXplb2YoX0NoYXJUKSkKKwkJICAgIHsKKwkJICAgICAgX19zdHIuYXBwZW5kKF9fYnVmLCBzaXplb2YoX19idWYpIC8gc2l6ZW9mKF9DaGFyVCkpOworCQkgICAgICBfX2xlbiA9IDA7CisJCSAgICB9CisJCSAgX19idWZbX19sZW4rK10gPSBfVHJhaXRzOjp0b19jaGFyX3R5cGUoX19jKTsKKwkJICArK19fZXh0cmFjdGVkOworCQkgIF9fYyA9IF9faW4ucmRidWYoKS0+c25leHRjKCk7CisJCX0KKwkgICAgICBfX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qICBfTV9wOyAvLyBUaGUgYWN0dWFsIGRhdGEuCisJfTsKKworICAgICAgLy8gV2hlbiBfX24gPSAxIHdheSBmYXN0ZXIgdGhhbiB0aGUgZ2VuZXJhbCBtdWx0aWNoYXIKKyAgICAgIC8vIHRyYWl0c190eXBlOjpjb3B5L21vdmUvYXNzaWduLgorICAgICAgc3RhdGljIHZvaWQKKyAgICAgIF9TX2NvcHkoX0NoYXJUKiBfX2QsIGNvbnN0IF9DaGFyVCogX19zLCBzaXplX3R5cGUgX19uKQorICAgICAgeworCWlmIChfX24gPT0gMSkKKwkgIHRyYWl0c190eXBlOjphc3NpZ24oKl9fZCwgKl9fcyk7CisJZWxzZQorCSAgdHJhaXRzX3R5cGU6OmNvcHkoX19kLCBfX3MsIF9fbik7CisgICAgICB9CisKKyAgICAgIHN0YXRpYyB2b2lkCisgICAgICBfU19tb3ZlKF9DaGFyVCogX19kLCBjb25zdCBfQ2hhclQqIF9fcywgc2l6ZV90eXBlIF9fbikKKyAgICAgIHsKKwlpZiAoX19uID09IDEpCisJICB0cmFpdHNfdHlwZTo6YXNzaWduKCpfX2QsICpfX3MpOworCWVsc2UKKwkgIHRyYWl0c190eXBlOjptb3ZlKF9fZCwgX19zLCBfX24pOworICAgICAgfQorCisgICAgICBzdGF0aWMgdm9pZAorICAgICAgX1NfYXNzaWduKF9DaGFyVCogX19kLCBzaXplX3R5cGUgX19uLCBfQ2hhclQgX19jKQorICAgICAgeworCWlmIChfX24gPT0gMSkKKwkgIHRyYWl0c190eXBlOjphc3NpZ24oKl9fZCwgX19jKTsKKwllbHNlCisJICB0cmFpdHNfdHlwZTo6YXNzaWduKF9fZCwgX19uLCBfX2MpOworICAgICAgfQorCisgICAgICAvLyBfU19jb3B5X2NoYXJzIGlzIGEgc2VwYXJhdGUgdGVtcGxhdGUgdG8gcGVybWl0IHNwZWNpYWxpemF0aW9uCisgICAgICAvLyB0byBvcHRpbWl6ZSBmb3IgdGhlIGNvbW1vbiBjYXNlIG9mIHB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3IgX19rMikKKyAgICAgIHsgX1NfY29weV9jaGFycyhfX3AsIF9fazEuYmFzZSgpLCBfX2syLmJhc2UoKSk7IH0KKworICAgICAgc3RhdGljIHZvaWQKKyAgICAgIF9TX2NvcHlfY2hhcnMoX0NoYXJUKiBfX3AsIF9DaGFyVCogX19rMSwgX0NoYXJUKiBfX2syKQorICAgICAgeyBfU19jb3B5KF9fcCwgX19rMSwgX19rMiAtIF9fazEpOyB9CisKKyAgICAgIHN0YXRpYyB2b2lkCisgICAgICBfU19jb3B5X2NoYXJzKF9DaGFyVCogX19wLCBjb25zdCBfQ2hhclQqIF9fazEsIGNvbnN0IF9DaGFyVCogX19rMikKKyAgICAgIHsgX1NfY29weShfX3AsIF9fazEsIF9fazIgLSBfX2sxKTsgfQorCisgICAgICBzdGF0aWMgaW50CisgICAgICBfU19jb21wYXJlKHNpemVfdHlwZSBfX24xLCBzaXplX3R5cGUgX19uMikKKyAgICAgIHsKKwljb25zdCBkaWZmZXJlbmNlX3R5cGUgX19kID0gZGlmZmVyZW5jZV90eXBlKF9fbjEgLSBfX24yKTsKKworCWlmIChfX2QgPiBfX251bWVyaWNfdHJhaXRzX2ludGVnZXI8aW50Pjo6X19tYXgpCisJICByZXR1cm4gX19udW1lcmljX3RyYWl0c19pbnRlZ2VyPGludD46Ol9fbWF4OworCWVsc2UgaWYgKF9fZCA8IF9fbnVtZXJpY190cmFpdHNfaW50ZWdlcjxpbnQ+OjpfX21pbikKKwkgIHJldHVybiBfX251bWVyaWNfdHJhaXRzX2ludGVnZXI8aW50Pjo6X19taW47CisJZWxzZQorCSAgcmV0dXJuIGludChfX2QpOworICAgICAgfQorICAgIH07CisKK19HTElCQ1hYX0VORF9OQU1FU1BBQ0VfVkVSU0lPTgorfSAvLyBuYW1lc3BhY2UKKworI2VuZGlmIC8qIF9WU1RSSU5HX1VUSUxfSCAqLwpkaWZmIC0tZ2l0IGEvOC9zb3VyY2VzL2N4eC1zdGwvZ251LWxpYnN0ZGMrKy80Ljc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0aGUgb3ZlcmZsb3cgY2hhciBvZgorICAgICAgICogIGEgZnVsbCBhcmVhLgorICAgICAgICovCisgICAgICBzaXplX3QJCQlfTV9idWZfc2l6ZTsKKworICAgICAgLy8gU2V0IGlmZiBfTV9idWYgaXMgYWxsb2NhdGVkIG1lbW9yeSBmcm9tIF9NX2FsbG9jYXRlX2ludGVybmFsX2J1ZmZlci4KKyAgICAgIGJvb2wJCQlfTV9idWZfYWxsb2NhdGVkOworCisgICAgICAvKioKKyAgICAgICAqICBfTV9yZWFkaW5nID09IGZhbHNlICYmIF9NX3dyaXRpbmcgPT0gZmFsc2UgZm9yIEBiIHVuY29tbWl0dGVkIG1vZGU7CisgICAgICAgKiAgX01fcmVhZGluZyA9PSB0cnVlIGZvciBAYiByZWFkIG1vZGU7CisgICAgICAgKiAgX01fd3JpdGluZyA9PSB0cnVlIGZvciBAYiB3cml0ZSBtb2RlOworICAgICAgICoKKyAgICAgICAqICBOQjogX01fcmVhZGluZyA9PSB0cnVlICYmIF9NX3dyaXRpbmcgPT0gdHJ1ZSBpcyB1bnVzZWQuCisgICAgICAgKi8KKyAgICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgX01fcmVhZGluZzsKKyAgICAgIGJvb2wgICAgICAgICAgICAgICAgICAgICAgX01fd3JpdGluZzsKKworICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgTmVjZXNzYXJ5IGJpdHMgZm9yIHB1dGJhY2sgYnVmZmVyIG1hbmFnZW1lbnQuCisgICAgICAgKgorICAgICAgICogIEBub3RlIHBiYWNrcyBvZiBvdmVyIG9uZSBjaGFyYWN0ZXIgYXJlIG5vdCBjdXJyZW50bHkgc3VwcG9ydGVkLgorICAgICAgICovCisgICAgICBjaGFyX3R5cGUJCQlfTV9wYmFjazsKKyAgICAgIGNoYXJfdHlwZSoJCV9NX3BiYWNrX2N1cl9zYXZlOworICAgICAgY2hhcl90eXBlKgkJX01fcGJhY2tfZW5kX3NhdmU7CisgICAgICBib29sC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hhcyBhbHJlYWR5IGJlZW4gbW92ZWQgYmFjaworICAgICAgICovCisgICAgICB2b2lkCisgICAgICBfTV9jcmVhdGVfcGJhY2soKQorICAgICAgeworCWlmICghX01fcGJhY2tfaW5pdCkKKwkgIHsKKwkgICAgX01fcGJhY2tfY3VyX3NhdmUgPSB0aGlzLT5ncHRyKCk7CisJICAgIF9NX3BiYWNrX2VuZF9zYXZlID0gdGhpcy0+ZWdwdHIoKTsKKwkgICAgdGhpcy0+c2V0ZygmX01fcGJhY2ssICZfTV9wYmFjaywgJl9NX3BiYWNrICsgMSk7CisJICAgIF9NX3BiYWNrX2luaXQgPSB0cnVlOworCSAgfQorICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBEZWFjdGl2YXRlcyBwYmFjayBidWZmZXIgY29udGVudHMsIGFuZCByZXN0b3JlcyBub3JtYWwgYnVmZmVyLgorICAgICAgICogIEFzc3VtcHRpb25zOgorICAgICAgICogIFRoZSBwYmFjayBidWZmZXIgaGFzIG9ubHkgbW92ZWQgZm9yd2FyZC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgX01fZGVzdHJveV9wYmFjaygpIHRocm93KCkKKyAgICAgIHsKKwlpZiAoX01fcGJhY2tfaW5pdCkKKwkgIHsKKwkgICAgLy8gTGVuZ3RoIF9NX2luX2N1ciBtb3ZlZCBpbiB0aGUgcGJhY2sgYnVmZmVyLgorCSAgICBfTV9wYmFja19jdXJfc2F2ZSArPSB0aGlzLT5ncHRyKCkgIT0gdGhpcy0+ZWJhY2soKTsKKwkgICAgdGhpcy0+c2V0ZyhfTV9idWYsIF9NX3BiYWNrX2N1cl9zYXZlLCBfTV9wYmFja19lbmRfc2F2ZSk7CisJICAgIF9NX3BiYWNrX2luaXQgPSBmYWxzZTsKKwkgIH0KKyAgICAgIH0KKworICAgIHB1YmxpYzoKKyAgICAgIC8vIENvbnN0cnVjdG9ycy9kZXN0cnVjdG9yOgorICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBEb2VzIG5vdCBvcGVuIGFueSBmaWxlcy4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIGRlZmF1bHQgY29uc3RydWN0b3IgaW5pdGlhbGl6ZXMgdGhlIHBhcmVudCBjbGFzcyB1c2luZyBpdHMKKyAgICAgICAqICBvd24gZGVmYXVsdCBjdG9yLgorICAgICAgICovCisgICAgICBiYXNpY19maWxlYnVmKCk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVGhlIGRlc3RydWN0b3IgY2xvc2VzIHRoZSBmaWxlIGZpcnN0LgorICAgICAgICovCisgICAgICB2aXJ0dWFsCisgICAgICB+YmFzaWNfZmlsZWJ1ZigpCisgICAgICB7IHRoaXMtPmNsb3NlKCk7IH0KKworICAgICAgLy8gTWVtYmVyczoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJucyB0cnVlIGlmIHRoZSBleHRlcm5hbCBmaWxlIGlzIG9wZW4uCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGlzX29wZW4oKSBjb25zdCB0aHJvdygpCisgICAgICB7IHJldHVybiBfTV9maWxlLmlzX29wZW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE9wZW5zIGFuIGV4dGVybmFsIGZpbGUuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFRoZSBuYW1lIG9mIHRoZSBmaWxlLgorICAgICAgICogIEBwYXJhbSAgX19tb2RlICBUaGUgb3BlbiBtb2RlIGZsYWdzLgorICAgICAgICogIEByZXR1cm4gIEBjIHRoaXMgb24gc3VjY2VzcywgTlVMTCBvbiBmYWlsdXJlCisgICAgICAgKgorICAgICAgICogIElmIGEgZmlsZSBpcyBhbHJlYWR5IG9wZW4sIHRoaXMgZnVuY3Rpb24gaW1tZWRpYXRlbHkgZmFpbHMuCisgICAgICAgKiAgT3RoZXJ3aXNlIGl0IHRyaWVzIHRvIG9wZW4gdGhlIGZpbGUgbmFtZWQgQGEgX19zIHVzaW5nIHRoZSBmbGFncworICAgICAgICogIGdpdmVuIGluIEBhIG1vZGUuCisgICAgICAgKgorICAgICAgICogIFRhYmxlIDkyLCBhZGFwdGVkIGhlcmUsIGdpdmVzIHRoZSByZWxhdGlvbiBiZXR3ZWVuIG9wZW5tb2RlCisgICAgICAgKiAgY29tYmluYXRpb25zIGFuZCB0aGUgZXF1aXZhbGVudCBmb3BlbigpIGZsYWdzLgorICAgICAgICogIChOQjogbGluZXMgYXBwLCBpbnxvdXR8YXBwLCBpbnxhcHAsIGJpbmFyeXxhcHAsIGJpbmFyeXxpbnxvdXR8YXBwLAorICAgICAgICogIGFuZCBiaW5hcnl8aW58YXBwIHBlciBEUiA1OTYpCisgICAgICAgKiAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKyAgICAgICAqICB8IGlvc19iYXNlIEZsYWcgY29tYmluYXRpb24gICAgICAgICAgICBzdGRpbyBlcXVpdmFsZW50ICAgfAorICAgICAgICogIHxiaW5hcnkgIGluICBvdXQgIHRydW5jICBhcHAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSsKKyAgICAgICAqICB8ICAgICAgICAgICAgICsgICAgICAgICAgICAgICAgICAgICAgICB3ICAgICAgICAgICAgICAgICAgfAorICAgICAgICogIHwgICAgICAgICAgICAgKyAgICAgICAgICAgKyAgICAgICAgICAgIGEgICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICAgICAgICAgICAgICAgICAgICAgICArICAgICAgICAgICAgYSAgICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICB8ICAgICAgICAgICAgICsgICAgICsgICAgICAgICAgICAgICAgICB3ICAgICAgICAgICAgICAgICAgfAorICAgICAgICogIHwgICAgICAgICArICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICAgICAgICsgICArICAgICAgICAgICAgICAgICAgICAgICAgcisgICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICB8ICAgICAgICAgKyAgICsgICAgICsgICAgICAgICAgICAgICAgICB3KyAgICAgICAgICAgICAgICAgfAorICAgICAgICogIHwgICAgICAgICArICAgKyAgICAgICAgICAgKyAgICAgICAgICAgIGErICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICAgICAgICsgICAgICAgICAgICAgICArICAgICAgICAgICAgYSsgICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICArLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKworICAgICAgICogIHwgICArICAgICAgICAgKyAgICAgICAgICAgICAgICAgICAgICAgIHdiICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICsgICAgICAgICArICAgICAgICAgICArICAgICAgICAgICAgYWIgICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICB8ICAgKyAgICAgICAgICAgICAgICAgICAgICsgICAgICAgICAgICBhYiAgICAgICAgICAgICAgICAgfAorICAgICAgICogIHwgICArICAgICAgICAgKyAgICAgKyAgICAgICAgICAgICAgICAgIHdiICAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICsgICAgICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmIgICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICB8ICAgKyAgICAgKyAgICsgICAgICAgICAgICAgICAgICAgICAgICByK2IgICAgICAgICAgICAgICAgfAorICAgICAgICogIHwgICArICAgICArICAgKyAgICAgKyAgICAgICAgICAgICAgICAgIHcrYiAgICAgICAgICAgICAgICB8CisgICAgICAgKiAgfCAgICsgICAgICsgICArICAgICAgICAgICArICAgICAgICAgICAgYStiICAgICAgICAgICAgICAgIHwKKyAgICAgICAqICB8ICAgKyAgICAgKyAgICAgICAgICAgICAgICsgICAgICAgICAgICBhK2IgICAgICAgICAgICAgICAgfAorICAgICAgICogICstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rCisgICAgICAgKi8KKyAgICAgIF9fZmlsZWJ1Zl90eXBlKgorICAgICAgb3Blbihjb25zdCBjaGFyKiBfX3MsIGlvc19iYXNlOjpvcGVubW9kZSBfX21vZGUpOworCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgT3BlbnMgYW4gZXh0ZXJuYWwgZmlsZS4KKyAgICAgICAqICBAcGFyYW0gIF9fcyAgVGhlIG5hbWUgb2YgdGhlIGZpbGUuCisgICAgICAgKiAgQHBhcmFtICBfX21vZGUgIFRoZSBvcGVuIG1vZGUgZmxhZ3MuCisgICAgICAgKiAgQHJldHVybiAgQGMgdGhpcyBvbiBzdWNjZXNzLCBOVUxMIG9uIGZhaWx1cmUKKyAgICAgICAqLworICAgICAgX19maWxlYnVmX3R5cGUqCisgICAgICBvcGVuKGNvbnN0IHN0ZDo6c3RyaW5nJiBfX3MsIGlvc19iYXNlOjpvcGVubW9kZSBfX21vZGUpCisgICAgICB7IHJldHVybiBvcGVuKF9fcy5jX3N0cigpLCBfX21vZGUpOyB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDbG9zZXMgdGhlIGN1cnJlbnRseSBhc3NvY2lhdGVkIGZpbGUuCisgICAgICAgKiAgQHJldHVybiAgQGMgdGhpcyBvbiBzdWNjZXNzLCBOVUxMIG9uIGZhaWx1cmUKKyAgICAgICAqCisgICAgICAgKiAgSWYgbm8gZmlsZSBpcyBjdXJyZW50bHkgb3BlbiwgdGhpcyBmdW5jdGlvbiBpbW1lZGlhdGVseSBmYWlscy4KKyAgICAgICAqCisgICAgICAgKiA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bSgpCisgICAgICB7IH0KKworICAgICAgLy8gTWVtYmVyczoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQWNjZXNzaW5nIHRoZSB1bmRlcmx5aW5nIGJ1ZmZlci4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgY3VycmVudCBiYXNpY19maWxlYnVmIGJ1ZmZlci4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBoaWRlcyBib3RoIHNpZ25hdHVyZXMgb2Ygc3RkOjpiYXNpY19pb3M6OnJkYnVmKCkuCisgICAgICAgKi8KKyAgICAgIF9fZmlsZWJ1Zl90eXBlKgorICAgICAgcmRidWYoKSBjb25zdAorICAgICAgeyByZXR1cm4gY29uc3RfY2FzdDxfX2ZpbGVidWZfdHlwZSo+KCZfTV9maWxlYnVmKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFdyYXBwZXIgdG8gdGVzdCBmb3IgYW4gb3BlbiBmaWxlLgorICAgICAgICogIEByZXR1cm4gIEBjIHJkYnVmKCktPmlzX29wZW4oKQorICAgICAgICovCisgICAgICBib29sCisgICAgICBpc19vcGVuKCkKKyAgICAgIHsgcmV0dXJuIF9NX2ZpbGVidWYuaXNfb3BlbigpOyB9CisKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIDM2NS4gTGFjayBvZiBjb25zdC1xdWFsaWZpY2F0aW9uIGluIGNsYXVzZSAyNworICAgICAgYm9vbAorICAgICAgaXNfb3BlbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9maWxlYnVmLmlzX29wZW4oKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE9wZW5zIGFuIGV4dGVybmFsIGZpbGUuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFRoZSBuYW1lIG9mIHRoZSBmaWxlLgorICAgICAgICogIEBwYXJhbSAgX19tb2RlICBUaGUgb3BlbiBtb2RlIGZsYWdzLgorICA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ICogIEByZXR1cm4gIFRoZSBjdXJyZW50IGJhc2ljX2ZpbGVidWYgYnVmZmVyLgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGhpZGVzIGJvdGggc2lnbmF0dXJlcyBvZiBzdGQ6OmJhc2ljX2lvczo6cmRidWYoKS4KKyAgICAgICAqLworICAgICAgX19maWxlYnVmX3R5cGUqCisgICAgICByZGJ1ZigpIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9jYXN0PF9fZmlsZWJ1Zl90eXBlKj4oJl9NX2ZpbGVidWYpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgV3JhcHBlciB0byB0ZXN0IGZvciBhbiBvcGVuIGZpbGUuCisgICAgICAgKiAgQHJldHVybiAgQGMgcmRidWYoKS0+aXNfb3BlbigpCisgICAgICAgKi8KKyAgICAgIGJvb2wKKyAgICAgIGlzX29wZW4oKQorICAgICAgeyByZXR1cm4gX01fZmlsZWJ1Zi5pc19vcGVuKCk7IH0KKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMzY1LiBMYWNrIG9mIGNvbnN0LXF1YWxpZmljYXRpb24gaW4gY2xhdXNlIDI3CisgICAgICBib29sCisgICAgICBpc19vcGVuKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2ZpbGVidWYuaXNfb3BlbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgT3BlbnMgYW4gZXh0ZXJuYWwgZmlsZS4KKyAgICAgICAqICBAcGFyYW0gIF9fcyAgVGhlIG5hbWUgb2YgdGhlIGZpbGUuCisgICAgICAgKiAgQHBhcmFtICBfX21vZGUgIFRoZSBvcGVuIG1vZGUgZmxhZ3MuCisgICAgICAgKgorICAgICAgICogIENhbGxzIEBjIHN0ZDo6YmFzaWNfZmlsZWJ1Zjo6b3BlbihfX3MsX19tb2RlKS4gIElmIHRoYXQKKyAgICAgICAqICBmdW5jdGlvbiBmYWl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ZSBfQWxsb2M+CisJdm9pZAorCWFzc2lnbihfRnVuY3RvciYmIF9fZiwgY29uc3QgX0FsbG9jJiBfX2EpCisJeworCSAgZnVuY3Rpb24oYWxsb2NhdG9yX2FyZywgX19hLAorCQkgICBzdGQ6OmZvcndhcmQ8X0Z1bmN0b3I+KF9fZikpLnN3YXAoKnRoaXMpOworCX0KKyAgICAgICovCisKKyAgICAgIC8vIFszLjcuMi4zXSBmdW5jdGlvbiBjYXBhY2l0eQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRGV0ZXJtaW5lIGlmIHRoZSAlZnVuY3Rpb24gd3JhcHBlciBoYXMgYSB0YXJnZXQuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm4gQGMgdHJ1ZSB3aGVuIHRoaXMgJWZ1bmN0aW9uIG9iamVjdCBjb250YWlucyBhIHRhcmdldCwKKyAgICAgICAqICBvciBAYyBmYWxzZSB3aGVuIGl0IGlzIGVtcHR5LgorICAgICAgICoKKyAgICAgICAqICBUaGlzIGZ1bmN0aW9uIHdpbGwgbm90IHRocm93IGFuICVleGNlcHRpb24uCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0IG9wZXJhdG9yIGJvb2woKSBjb25zdCBub2V4Y2VwdAorICAgICAgeyByZXR1cm4gIV9NX2VtcHR5KCk7IH0KKworICAgICAgLy8gWzMuNy4yLjRdIGZ1bmN0aW9uIGludm9jYXRpb24KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEludm9rZXMgdGhlIGZ1bmN0aW9uIHRhcmdldGVkIGJ5IEBjICp0aGlzLgorICAgICAgICogIEByZXR1cm5zIHRoZSByZXN1bHQgb2YgdGhlIHRhcmdldC4KKyAgICAgICAqICBAdGhyb3dzIGJhZF9mdW5jdGlvbl9jYWxsIHdoZW4gQGMgIShib29sKSp0aGlzCisgICAgICAgKgorICAgICAgICogIFRoZSBmdW5jdGlvbiBjYWxsIG9wZXJhdG9yIGludm9rZXMgdGhlIHRhcmdldCBm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cm9taXNlOworCisgIC8vLyBMYXVuY2ggY29kZSBmb3IgZnV0dXJlcworICBlbnVtIGNsYXNzIGxhdW5jaAorICB7CisgICAgYXN5bmMgPSAxLAorICAgIGRlZmVycmVkID0gMgorICB9OworCisgIGNvbnN0ZXhwciBsYXVuY2ggb3BlcmF0b3ImKGxhdW5jaCBfX3gsIGxhdW5jaCBfX3kpCisgIHsKKyAgICByZXR1cm4gc3RhdGljX2Nhc3Q8bGF1bmNoPigKKwlzdGF0aWNfY2FzdDxpbnQ+KF9feCkgJiBzdGF0aWNfY2FzdDxpbnQ+KF9feSkpOworICB9CisKKyAgY29uc3RleHByIGxhdW5jaCBvcGVyYXRvcnwobGF1bmNoIF9feCwgbGF1bmNoIF9feSkKKyAgeworICAgIHJldHVybiBzdGF0aWNfY2FzdDxsYXVuY2g+KAorCXN0YXRpY19jYXN0PGludD4oX194KSB8IHN0YXRpY19jYXN0PGludD4oX195KSk7CisgIH0KKworICBjb25zdGV4cHIgbGF1bmNoIG9wZXJhdG9yXihsYXVuY2ggX194LCBsYXVuY2ggX195KQorICB7CisgICAgcmV0dXJuIHN0YXRpY19jYXN0PGxhdW5jaD4oCisJc3RhdGljX2Nhc3Q8aW50PihfX3gpIF4gc3RhdGljX2Nhc3Q8aW50PihfX3kpKTsKKyAgfQorCisgIGNvbnN0ZXhwciBsYXVuY2ggb3BlcmF0b3J+KGxhdW5jaCBfX3gpCisgIHsgcmV0dXJuIHN0YXRpY19jYXN0PGxhdW5jaD4ofnN0YXRpY19jYXN0PGludD4oX194KSk7IH0KKworICBpbmxpbmUgbGF1bmNoJiBvcGVyYXRvciY9KGxhdW5jaCYgX194LCBsYXVuY2ggX195KQorICB7IHJldHVybiBfX3ggPSBfX3ggJiBfX3k7IH0KKworICBpbmxpbmUgbGF1bmNoJiBvcGVyYXRvcnw9KGxhdW5jaCYgX194LCBsYXVuY2ggX195KQorICB7IHJldHVybiBfX3ggPSBfX3ggfCBfX3k7IH0KKworICBpbmxpbmUgbGF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ICAvLyBjaGVjayB0aGlzIGlzIG9ubHkgdXNlZCBieSBwcm9taXNlPFI+OjpzZXRfdmFsdWUoY29uc3QgUiYpCisgICAgICAgICAgLy8gb3IgcHJvbWlzZTxSPjo6c2V0X3ZhbHVlKFImKQorICAgICAgICAgIHN0YXRpY19hc3NlcnQoaXNfc2FtZTxfUmVzLCBfQXJnJj46OnZhbHVlICAvLyBwcm9taXNlPFImPgorICAgICAgICAgICAgICB8fCBpc19zYW1lPGNvbnN0IF9SZXMsIF9Bcmc+Ojp2YWx1ZSwgIC8vIHByb21pc2U8Uj4KKyAgICAgICAgICAgICAgIkludmFsaWQgc3BlY2lhbGlzYXRpb24iKTsKKworICAgICAgICAgIHR5cGVuYW1lIHByb21pc2U8X1Jlcz46Ol9QdHJfdHlwZSBvcGVyYXRvcigpKCkKKyAgICAgICAgICB7CisgICAgICAgICAgICBfU3RhdGVfYmFzZTo6X1NfY2hlY2soX01fcHJvbWlzZS0+X01fZnV0dXJlKTsKKyAgICAgICAgICAgIF9NX3Byb21pc2UtPl9NX3N0b3JhZ2UtPl9NX3NldChfTV9hcmcpOworICAgICAgICAgICAgcmV0dXJuIHN0ZDo6bW92ZShfTV9wcm9taXNlLT5fTV9zdG9yYWdlKTsKKyAgICAgICAgICB9CisgICAgICAgICAgcHJvbWlzZTxfUmVzPiogICAgX01fcHJvbWlzZTsKKyAgICAgICAgICBfQXJnJiAgICAgICAgICAgICBfTV9hcmc7CisgICAgICAgIH07CisKKyAgICAgIC8vIHNldCBydmFsdWVzCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUmVzPgorICAgICAgICBzdHJ1Y3QgX1NldHRlcjxfUmVzLCBfUmVzJiY+CisgICAgICAgIHsKKyAgICAgICAgICB0eXBlbmFtZSBwcm9taXNlPF9SZXM+OjpfUHRyX3R5cGUgb3BlcmF0b3IoKSgpCisgICAgICAgICAgeworICAgICAgICAgICAgX1N0YXRlX2Jhc2U6Ol9TX2NoZWNrKF9NX3Byb21pc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0ZXIocHJvbWlzZTxfUmVzPiogX19wcm9tLCBfQXJnJiYgX19hcmcpCisgICAgICAgIHsKKyAgICAgICAgICByZXR1cm4gX1NldHRlcjxfUmVzLCBfQXJnJiY+eyBfX3Byb20sIF9fYXJnIH07CisgICAgICAgIH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1Jlcz4KKyAgICAgICAgc3RhdGljIF9TZXR0ZXI8X1JlcywgX19leGNlcHRpb25fcHRyX3RhZz4KKyAgICAgICAgX19zZXR0ZXIoZXhjZXB0aW9uX3B0ciYgX19leCwgcHJvbWlzZTxfUmVzPiogX19wcm9tKQorICAgICAgICB7CisgICAgICAgICAgcmV0dXJuIF9TZXR0ZXI8X1JlcywgX19leGNlcHRpb25fcHRyX3RhZz57IF9fcHJvbSwgX19leCB9OworICAgICAgICB9CisKKyAgICAgIHN0YXRpYyBfU2V0dGVyPHZvaWQsIHZvaWQ+CisgICAgICBfX3NldHRlcihwcm9taXNlPHZvaWQ+KiBfX3Byb20pOworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIHN0YXRpYyBib29sCisgICAgICAgIF9TX2NoZWNrKGNvbnN0IHNoYXJlZF9wdHI8X1RwPiYgX19wKQorICAgICAgICB7CisgICAgICAgICAgaWYgKCFzdGF0aWNfY2FzdDxib29sPihfX3ApKQorICAgICAgICAgICAgX190aHJvd19mdXR1cmVfZXJyb3IoKGludClmdXR1cmVfZXJyYzo6bm9fc3RhdGUpOworICAgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgdm9pZAorICAgICAgX01fZG9fc2V0KGZ1bmN0aW9uPF9QdHJfdHlwZSgpPiYgX19mLCBib29sJiBfX3NldCkKKyAgICAgIHsKKyAgICAgICAgX1B0cl90eXBlIF9fcmVzID0gX19mKCk7CisgICAgICAgIHsKKyAgICAgICAgICBsb2NrX2d1YXJkPG11dGV4PiBfX2xvY2soX01fbXV0ZXgpOworICAgICAgICAgIF9NX3Jlc3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AgICB+cHJvbWlzZSgpCisgICAgICB7CisgICAgICAgIGlmIChzdGF0aWNfY2FzdDxib29sPihfTV9mdXR1cmUpICYmICFfTV9mdXR1cmUudW5pcXVlKCkpCisgICAgICAgICAgX01fZnV0dXJlLT5fTV9icmVha19wcm9taXNlKHN0ZDo6bW92ZShfTV9zdG9yYWdlKSk7CisgICAgICB9CisKKyAgICAgIC8vIEFzc2lnbm1lbnQKKyAgICAgIHByb21pc2UmCisgICAgICBvcGVyYXRvcj0ocHJvbWlzZSYmIF9fcmhzKSBub2V4Y2VwdAorICAgICAgeworICAgICAgICBwcm9taXNlKHN0ZDo6bW92ZShfX3JocykpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHByb21pc2UmIG9wZXJhdG9yPShjb25zdCBwcm9taXNlJikgPSBkZWxldGU7CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAocHJvbWlzZSYgX19yaHMpIG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIF9NX2Z1dHVyZS5zd2FwKF9fcmhzLl9NX2Z1dHVyZSk7CisgICAgICAgIF9NX3N0b3JhZ2Uuc3dhcChfX3Jocy5fTV9zdG9yYWdlKTsKKyAgICAgIH0KKworICAgICAgLy8gUmV0cmlldmluZyB0aGUgcmVzdWx0CisgICAgICBmdXR1cmU8X1Jlcz4KKyAgICAgIGdldF9mdXR1cmUoKQorICAgICAgeyByZXR1cm4gZnV0dXJlPF9SZXM+KF9NX2Z1dHVyZSk7IH0KKworICAgICAgLy8gU2V0dGluZyB0aGUgcmVzdWx0CisgICAgICB2b2lkCisgICAgICBzZXRfdmFsdWUoY29uc3QgX1JlcyYgX19yKQorICAgICAgeworICAgICAgICBhdXRvIF9fc2V0dGVyID0gX1N0YXRlOjpfX3NldHRlcih0aGlzLCBfX3IpOworICAgICAgICBfTV9mdXR1cmUtPl9NX3NldF9yZXN1bHQoc3RkOjptb3ZlKF9fc2V0dGVyKSk7CisgIC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sbG9jYXRvcl9hcmdfdCwgY29uc3QgX0FsbG9jYXRvciYsIHByb21pc2UmJiBfX3JocykKKyAgICAgICAgOiBfTV9mdXR1cmUoc3RkOjptb3ZlKF9fcmhzLl9NX2Z1dHVyZSkpLAorCSAgX01fc3RvcmFnZShzdGQ6Om1vdmUoX19yaHMuX01fc3RvcmFnZSkpCisgICAgICAgIHsgfQorCisgICAgICBwcm9taXNlKGNvbnN0IHByb21pc2UmKSA9IGRlbGV0ZTsKKworICAgICAgfnByb21pc2UoKQorICAgICAgeworICAgICAgICBpZiAoc3RhdGljX2Nhc3Q8Ym9vbD4oX01fZnV0dXJlKSAmJiAhX01fZnV0dXJlLnVuaXF1ZSgpKQorICAgICAgICAgIF9NX2Z1dHVyZS0+X01fYnJlYWtfcHJvbWlzZShzdGQ6Om1vdmUoX01fc3RvcmFnZSkpOworICAgICAgfQorCisgICAgICAvLyBBc3NpZ25tZW50CisgICAgICBwcm9taXNlJgorICAgICAgb3BlcmF0b3I9KHByb21pc2UmJiBfX3Jocykgbm9leGNlcHQKKyAgICAgIHsKKyAgICAgICAgcHJvbWlzZShzdGQ6Om1vdmUoX19yaHMpKS5zd2FwKCp0aGlzKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBwcm9taXNlJiBvcGVyYXRvcj0oY29uc3QgcHJvbWlzZSYpID0gZGVsZXRlOworCisgICAgICB2b2lkCisgICAgICBzd2FwKHByb21pc2UmIF9fcmhzKSBub2V4Y2VwdAorICAgICAgeworICAgICAgICBfTV9mdXR1cmUuc3dhcChfX3Jocy5fTV9mdXR1cmUpOworICAgICAgICBfTV9zdG9yYWdlLnN3YXAoX19yaHMuX01fc3RvcmFnZSk7CisgICAgICB9CisKKyAgICAgIC8vIFJldHJpZXZpbmcgdGhlIHJlc3VsdAorICAgICAgZnV0dXJlPF9SZXMmPgorICAgICAgZ2V0X2Z1dHVyZSgpCisgICAgICB7IHJldHVybiBmdXR1cmU8X1JlcyY+KF9N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Y2FzdDxib29sPihfTV9mdXR1cmUpICYmICFfTV9mdXR1cmUudW5pcXVlKCkpCisgICAgICAgICAgX01fZnV0dXJlLT5fTV9icmVha19wcm9taXNlKHN0ZDo6bW92ZShfTV9zdG9yYWdlKSk7CisgICAgICB9CisKKyAgICAgIC8vIEFzc2lnbm1lbnQKKyAgICAgIHByb21pc2UmCisgICAgICBvcGVyYXRvcj0ocHJvbWlzZSYmIF9fcmhzKSBub2V4Y2VwdAorICAgICAgeworICAgICAgICBwcm9taXNlKHN0ZDo6bW92ZShfX3JocykpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHByb21pc2UmIG9wZXJhdG9yPShjb25zdCBwcm9taXNlJikgPSBkZWxldGU7CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAocHJvbWlzZSYgX19yaHMpIG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIF9NX2Z1dHVyZS5zd2FwKF9fcmhzLl9NX2Z1dHVyZSk7CisgICAgICAgIF9NX3N0b3JhZ2Uuc3dhcChfX3Jocy5fTV9zdG9yYWdlKTsKKyAgICAgIH0KKworICAgICAgLy8gUmV0cmlldmluZyB0aGUgcmVzdWx0CisgICAgICBmdXR1cmU8dm9pZD4KKyAgICAgIGdldF9mdXR1cmUoKQorICAgICAgeyByZXR1cm4gZnV0dXJlPHZvaWQ+KF9NX2Z1dHVyZSk7IH0KKworICAgICAgLy8gU2V0dGluZyB0aGUgcmVzdWx0CisgICAgICB2b2lkIHNldF92YWx1ZSgpOworCisgICAgICB2b2lkCisgICAgICBzZXRfZXhjZXB0aW9uKGV4Y2VwdGlvbl9wdHIgX19wKQorICAgICAgeworICAgICAgICBhdXRvIF9fc2V0dGVyID0gX1N0YXRlOjpfX3NldHRlcihfX3AsIHRoaXMpOworICAgICAgICBfTV9mdXR1cmUtPl9NX3NldF9yZXN1bHQoc3RkOjptb3ZlKF9fc2V0dGVyKSk7CisgICAgICB9CisgICA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b25zdCBfQWxsb2NhdG9yJiwKKyAgICAgICAgICAgICAgICAgICAgICBwYWNrYWdlZF90YXNrJiYgX19vdGhlcikgbm9leGNlcHQKKyAgICAgICAgeyB0aGlzLT5zd2FwKF9fb3RoZXIpOyB9CisKKyAgICAgIHBhY2thZ2VkX3Rhc2smIG9wZXJhdG9yPShwYWNrYWdlZF90YXNrJiYgX19vdGhlcikgbm9leGNlcHQKKyAgICAgIHsKKyAgICAgICAgcGFja2FnZWRfdGFzayhzdGQ6Om1vdmUoX19vdGhlcikpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAocGFja2FnZWRfdGFzayYgX19vdGhlcikgbm9leGNlcHQKKyAgICAgIHsgX01fc3RhdGUuc3dhcChfX290aGVyLl9NX3N0YXRlKTsgfQorCisgICAgICBib29sCisgICAgICB2YWxpZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxib29sPihfTV9zdGF0ZSk7IH0KKworICAgICAgLy8gUmVzdWx0IHJldHJpZXZhbAorICAgICAgZnV0dXJlPF9SZXM+CisgICAgICBnZXRfZnV0dXJlKCkKKyAgICAgIHsgcmV0dXJuIGZ1dHVyZTxfUmVzPihfTV9zdGF0ZSk7IH0KKworICAgICAgLy8gRXhlY3V0aW9uCisgICAgICB2b2lkCisgICAgICBvcGVyYXRvcigpKF9BcmdUeXBlcy4uLiBfX2FyZ3MpCisgICAgICB7CisgICAgICAgIF9fZnV0dXJlX2Jhc2U6Ol9TdGF0ZV9iYXNlOjpfU19jaGVjayhfTV9zdGF0ZSk7CisgICAgICAgIF9NX3N0YXRlLT5fTV9ydW4oc3RkOjpmb3J3YXJkPF9BcmdUeXBlcz4oX19hcmdzKS4uLik7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkKKyAgICAgIHsKKyAgICAgICAgX19mdXR1cmVfYm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9CisKKyAgICBwdWJsaWM6CisgICAgICBjb25zdGV4cHIgaW5pdGlhbGl6ZXJfbGlzdCgpIG5vZXhjZXB0CisgICAgICA6IF9NX2FycmF5KDApLCBfTV9sZW4oMCkgeyB9CisKKyAgICAgIC8vIE51bWJlciBvZiBlbGVtZW50cy4KKyAgICAgIGNvbnN0ZXhwciBzaXplX3R5cGUKKyAgICAgIHNpemUoKSBjb25zdCBub2V4Y2VwdCB7IHJldHVybiBfTV9sZW47IH0KKworICAgICAgLy8gRmlyc3QgZWxlbWVudC4KKyAgICAgIGNvbnN0ZXhwciBjb25zdF9pdGVyYXRvcgorICAgICAgYmVnaW4oKSBjb25zdCBub2V4Y2VwdCB7IHJldHVybiBfTV9hcnJheTsgfQorCisgICAgICAvLyBPbmUgcGFzdCB0aGUgbGFzdCBlbGVtZW50LgorICAgICAgY29uc3RleHByIGNvbnN0X2l0ZXJhdG9yCisgICAgICBlbmQoKSBjb25zdCBub2V4Y2VwdCB7IHJldHVybiBiZWdpbigpICsgc2l6ZSgpOyB9CisgIH07CisKKyAgLyoqCisgICAqICBAYnJpZWYgIFJldHVybiBhbiBpdGVyYXRvciBwb2ludGluZyB0byB0aGUgZmlyc3QgZWxlbWVudCBvZgorICAgKiAgICAgICAgICB0aGUgaW5pdGlsaXplcl9saXN0LgorICAgKiAgQHBhcmFtICBfX2lscyAgSW5pdGlhbGl6ZXIgbGlzdC4KKyAgICovCisgIHRlbXBsYXRlPGNsYXNzIF9UcD4KKyAgICBjb25zdGV4cHIgY29uc3QgX1RwKgorICAgIGJlZ2luKGluaXRpYWxpemVyX2xpc3Q8X1RwPiBfX2lscykgbm9leGNlcHQKKyAgICB7IHJldHVybiBfX2lscy5iZWdpbigpOyB9CisKKyAgLyoqCisgICAqICBAYnJpZWYgIFJldHVybiBhbiBpdGVyYXRvciBwb2ludGluZyB0byBvbmUgcGFzdCB0aGUgbGFzdCBlbGVtZW50CisgICAqICAgICAgICAgIG9mIHRoZSBpbml0aWxpemVyX2x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ZSYKKyAgICAgIG9wZXJhdG9yPj4oaW50JiBfX24pOworCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPj4odW5zaWduZWQgaW50JiBfX24pCisgICAgICB7IHJldHVybiBfTV9leHRyYWN0KF9fbik7IH0KKworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICBvcGVyYXRvcj4+KGxvbmcmIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2V4dHJhY3QoX19uKTsgfQorCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPj4odW5zaWduZWQgbG9uZyYgX19uKQorICAgICAgeyByZXR1cm4gX01fZXh0cmFjdChfX24pOyB9CisKKyNpZmRlZiBfR0xJQkNYWF9VU0VfTE9OR19MT05HCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPj4obG9uZyBsb25nJiBfX24pCisgICAgICB7IHJldHVybiBfTV9leHRyYWN0KF9fbik7IH0KKworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICBvcGVyYXRvcj4+KHVuc2lnbmVkIGxvbmcgbG9uZyYgX19uKQorICAgICAgeyByZXR1cm4gX01fZXh0cmFjdChfX24pOyB9CisjZW5kaWYKKyAgICAgIC8vQH0KKworICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBGbG9hdGluZyBwb2ludCBhcml0aG1ldGljIGV4dHJhY3RvcnMKKyAgICAgICAqICBAcGFyYW0gIF9fZiBBIHZhcmlhYmxlIG9mIGJ1aWx0aW4gZmxvYXRpbmcgcG9pbnQgdHlwZS4KKyAgICAgICAqICBAcmV0dXJuICBAYyAqdGhpcyBpZiBzdWNjZXNzZnVsCisgICAgICAgKgorICAgICAgICogIFRoZXNlIGZ1bmN0aW9ucyB1c2UgdGhlIHN0cmVhbSdzIGN1cnJlbnQgbG9jYWxlIChzcGVjaWZpY2FsbHksIHRoZQorICAgICAgICogIEBjIG51bV9nZXQgZmFjZXQpIHRvIHBhcnNlIHRoZSBpbnB1dCBkYXRhLgorICAgICAgKi8KKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I+PihmbG9hdCYgX19mKQorICAgICAgeyByZXR1cm4gX01fZXh0cmFjdChfX2YpOyB9CisKKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I+Pihkb3VibGUmIF9fZikKKyAgICAgIHsgcmV0dXJuIF9NX2V4dHJhY3QoX19mKTsgfQorCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPj4obG9uZyBkb3VibGUmIF9fZikKKyAgICAgIHsgcmV0dXJuIF9NX2V4dHJhY3QoX19mKTsgfQorICAgICAgLy9AfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEJhc2ljIGFyaXRobWV0aWMgZXh0cmFjdG9ycworICAgICAgICogIEBwYXJhbSAgX19wIEEgdmFyaWFibGUgb2YgcG9pbnRlciB0eXBlLgorICAgICAgICogIEByZXR1cm4gIEBjICp0aGlzIGlmIHN1Y2Nlc3NmdWwKKyAgICAgICAqCisgICAgICAgKiAgVGhlc2UgZnVuY3Rpb25zIHVzZSB0aGUgc3RyZWFtJ3MgY3VycmVudCBsb2NhbGUgKHNwZWNpZmljYWxseSwgdGhlCisgICAgICAgKiAgQGMgbnVtX2dldCBmYWNldCkgdG8gcGFyc2UgdGhlIGlucHV0IGRhdGEuCisgICAgICAqLworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICBvcGVyYXRvcj4+KHZvaWQqJiBfX3ApCisgICAgICB7IHJldHVybiBfTV9leHRyYWN0KF9fcCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBFeHRyYWN0aW5nIGludG8gYW5vdGhlciBzdHJlYW1idWYuCisgICAgICAgKiAgQHBhcmFtICBfX3NiICBBIHBvaW50ZXIgdG8gYSBzdHJlYW1idWYKKyAgICAg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b29kLCB0aGUgZnVuY3Rpb24gdHJpZXMgdG8gZXh0cmFjdAorICAgICAgICogIHdoYXRldmVyIGRhdGEgaXMgYXBwcm9wcmlhdGUgZm9yIHRoZSB0eXBlIG9mIHRoZSBhcmd1bWVudC4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzIGV4dHJhY3RlZCBpcyBzdG9yZWQgZm9yIGxhdGVyIHJldHJpZXZhbAorICAgICAgICogIGJ5IGdjb3VudCgpLgorICAgICAgICoKKyAgICAgICAqICBJZiBhbiBleGNlcHRpb24gaXMgdGhyb3duIGR1cmluZyBleHRyYWN0aW9uLCBpb3NfYmFzZTo6YmFkYml0CisgICAgICAgKiAgd2lsbCBiZSB0dXJuZWQgb24gaW4gdGhlIHN0cmVhbSdzIGVycm9yIHN0YXRlIHdpdGhvdXQgY2F1c2luZyBhbgorICAgICAgICogIGlvc19iYXNlOjpmYWlsdXJlIHRvIGJlIHRocm93bi4gIFRoZSBvcmlnaW5hbCBleGNlcHRpb24gd2lsbCB0aGVuCisgICAgICAgKiAgYmUgcmV0aHJvd24uCisgICAgICAqLworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNpbXBsZSBleHRyYWN0aW9uLgorICAgICAgICogIEByZXR1cm4gIEEgY2hhcmFjdGVyLCBvciBlb2YoKS4KKyAgICAgICAqCisgICAgICAgKiAgVHJpZXMgdG8gZXh0cmFjdCBhIGNoYXJhY3Rlci4gIElmIG5vbmUgYXJlIGF2YWlsYWJsZSwgc2V0cyBmYWlsYml0CisgICAgICAgKiAgYW5kIHJldHVybnMgdHJhaXRzOjplb2YoKS4KKyAgICAgICovCisgICAgICBpbnRfdHlwZQorICAgICAgZ2V0KCk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU2ltcGxlIGV4dHJhY3Rpb24uCisgICAgICAgKiAgQHBhcmFtICBfX2MgIFRoZSBjaGFyYWN0ZXIgaW4gd2hpY2ggdG8gc3RvcmUgZGF0YS4KKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBUcmllcyB0byBleHRyYWN0IGEgY2hhcmFjdGVyIGFuZCBzdG9yZSBpdCBpbiBAYSBfX2MuICBJZiBub25lIGFyZQorICAgICAgICogIGF2YWlsYWJsZSwgc2V0cyBmYWlsYml0IGFuZCByZXR1cm5zIHRyYWl0czo6ZW9mKCkuCisgICAgICAgKgorICAgICAgICogIEBub3RlICBUaGlzIGZ1bmN0aW9uIGlzIG5vdCBvdmVybG9hZGVkIG9uIHNpZ25lZCBjaGFyIGFuZAorICAgICAgICogICAgICAgICB1bnNpZ25lZCBjaGFyLgorICAgICAgKi8KKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgZ2V0KGNoYXJfdHlwZSYgX19jKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTaW1wbGUgbXVsdGlwbGUtY2hhcmFjdGVyIGV4dHJhY3Rpb24uCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFBvaW50ZXIgdG8gYW4gYXJyYXkuCisgICAgICAgKiAgQHBhcmFtICBfX24gIE1heGltdW0gbnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gc3RvcmUgaW4gQGEgX19zLgorICAgICAgICogIEBwYXJhbSAgX19kZWxpbSAgQSAic3RvcCIgY2hhcmFjdGVyLgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIENoYXJhY3RlcnMgYXJlIGV4dHJhY3RlZCBhbmQgc3RvcmVkIGludG8gQGEgX19zIHVudGlsIG9uZSBvZiB0aGUKKyAgICAgICAqICBmb2xsb3dpbmcgaGFwcGVuczoKKyAgICAgICAqCisgICAgICAgKiAgLSBAYyBfX24tMSBjaGFyYWN0ZXJzIGFyZSBzdG9yZWQKKyAgICAgICAqICAtIHRoZSBpbnB1dCBzZXF1ZW5jZSByZWFjaGVzIEVPRgorICAgICAgICogIC0gdGhlIG5leHQgY2hhcmFjdGVyIGVxdWFscyBAYSBfX2RlbGltLCBpbiB3aGljaCBjYXNlIHRoZSBjaGFyYWN0ZXIKKyAgICAgICAqICAgIGlzIG5vdCBleHRyYWN0ZWQKKyAgICAgICAqCisgICAgICAgKiBJZiBubyBjaGFyYWN0ZXJzIGFyZSBzdG9yZWQsIGZhaWxiaXQgaXMgc2V0IGluIHRoZSBzdHJlYW0ncyBlcnJvcgorICAgICAgICogc3RhdGUuCisgICAgICAgKgorICAgICAgICogSW4gYW55IGNhc2UsIGEgbnVsbCBjaGFyYWN0ZXIgaXMgc3RvcmVkIGludG8gdGhlIG5leHQgbG9jYXRpb24gaW4KKyAgICAgICAqIHRoZSBhcnJheS4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIFRoaXMgZnVuY3Rpb24gaXMgbm90IG92ZXJsb2FkZWQgb24gc2lnbmVkIGNoYXIgYW5kCisgICAgICAgKiAgICAgICAgIHVuc2lnbmVkIGNoYXIuCisgICAgICAqLworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICBnZXQoY2hhcl90eXBlKiBfX3MsIHN0cmVhbXNpemUgX19uLCBjaGFyX3R5cGUgX19kZWxpbSk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU2ltcGxlIG11bHRpcGxlLWNoYXJhY3RlciBleHRyYWN0aW9uLgorICAgICAgICogIEBwYXJhbSAgX19zICBQb2ludGVyIHRvIGFuIGFycmF5LgorICAgICAgICogIEBwYXJhbSAgX19uICBNYXhpbXVtIG51bWJlciBvZiBjaGFyYWN0ZXJzIHRvIHN0b3JlIGluIEBhIHMuCisgICAgICAgKiAgQHJldHVybiAgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBAYyBnZXQoX19zLF9fbix3aWRlbigmYXBvcztcXG4mYXBvczspKS4KKyAgICAgICovCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIGdldChjaGFyX3R5cGUqIF9fcywgc3RyZWFtc2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XJyb3IKKyAgICAgICAqIHN0YXRlLgorICAgICAgKi8KKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgZ2V0KF9fc3RyZWFtYnVmX3R5cGUmIF9fc2IsIGNoYXJfdHlwZSBfX2RlbGltKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBFeHRyYWN0aW9uIGludG8gYW5vdGhlciBzdHJlYW1idWYuCisgICAgICAgKiAgQHBhcmFtICBfX3NiICBBIHN0cmVhbWJ1ZiBpbiB3aGljaCB0byBzdG9yZSBkYXRhLgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgQGMgZ2V0KF9fc2Isd2lkZW4oJmFwb3M7XFxuJmFwb3M7KSkuCisgICAgICAqLworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICBnZXQoX19zdHJlYW1idWZfdHlwZSYgX19zYikKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmdldChfX3NiLCB0aGlzLT53aWRlbignXG4nKSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTdHJpbmcgZXh0cmFjdGlvbi4KKyAgICAgICAqICBAcGFyYW0gIF9fcyAgQSBjaGFyYWN0ZXIgYXJyYXkgaW4gd2hpY2ggdG8gc3RvcmUgdGhlIGRhdGEuCisgICAgICAgKiAgQHBhcmFtICBfX24gIE1heGltdW0gbnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gZXh0cmFjdC4KKyAgICAgICAqICBAcGFyYW0gIF9fZGVsaW0gIEEgInN0b3AiIGNoYXJhY3Rlci4KKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBFeHRyYWN0cyBhbmQgc3RvcmVzIGNoYXJhY3RlcnMgaW50byBAYSBfX3MgdW50aWwgb25lIG9mIHRoZQorICAgICAgICogIGZvbGxvd2luZyBoYXBwZW5zLiAgTm90ZSB0aGF0IHRoZXNlIGNyaXRlcmlhI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gX19pc3RyZWFtX3R5cGUmCisgICAgICBnZXRsaW5lKGNoYXJfdHlwZSogX19zLCBzdHJlYW1zaXplIF9fbiwgY2hhcl90eXBlIF9fZGVsaW0pOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFN0cmluZyBleHRyYWN0aW9uLgorICAgICAgICogIEBwYXJhbSAgX19zICBBIGNoYXJhY3RlciBhcnJheSBpbiB3aGljaCB0byBzdG9yZSB0aGUgZGF0YS4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgTWF4aW11bSBudW1iZXIgb2YgY2hhcmFjdGVycyB0byBleHRyYWN0LgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgQGMgZ2V0bGluZShfX3MsX19uLHdpZGVuKCZhcG9zO1xcbiZhcG9zOykpLgorICAgICAgKi8KKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgZ2V0bGluZShjaGFyX3R5cGUqIF9fcywgc3RyZWFtc2l6ZSBfX24pCisgICAgICB7IHJldHVybiB0aGlzLT5nZXRsaW5lKF9fcywgX19uLCB0aGlzLT53aWRlbignXG4nKSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBEaXNjYXJkaW5nIGNoYXJhY3RlcnMKKyAgICAgICAqICBAcGFyYW0gIF9fbiAgTnVtYmVyIG9mIGNoYXJhY3RlcnMgdG8gZGlzY2FyZC4KKyAgICAgICAqICBAcGFyYW0gIF9fZGVsaW0gIEEgInN0b3AiIGNoYXJhY3Rlci4KKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBFeHRyYWN0cyBjaGFyYWN0ZXJzIGFuZCB0aHJvd3MgdGhlbSBhd2F5IHVudGlsIG9uZSBvZiB0aGUKKyAgICAgICAqICBmb2xsb3dpbmcgaGFwcGVuczoKKyAgICAgICAqICAtIGlmIEBhIF9fbiBAYyAhPSBAYyBzdGQ6Om51bWVyaWNfbGlta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1vcmUgZnJvbSB0aGUgZXh0ZXJuYWwgaW5wdXQgc2VxdWVuY2UgY29udHJvbGxlZCBieSB0aGUgc3RyZWFtYnVmLgorICAgICAgKi8KKyAgICAgIHN0cmVhbXNpemUKKyAgICAgIHJlYWRzb21lKGNoYXJfdHlwZSogX19zLCBzdHJlYW1zaXplIF9fbik7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVW5leHRyYWN0aW5nIGEgc2luZ2xlIGNoYXJhY3Rlci4KKyAgICAgICAqICBAcGFyYW0gIF9fYyAgVGhlIGNoYXJhY3RlciB0byBwdXNoIGJhY2sgaW50byB0aGUgaW5wdXQgc3RyZWFtLgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIElmIEBjIHJkYnVmKCkgaXMgbm90IG51bGwsIGNhbGxzIEBjIHJkYnVmKCktPnNwdXRiYWNrYyhjKS4KKyAgICAgICAqCisgICAgICAgKiAgSWYgQGMgcmRidWYoKSBpcyBudWxsIG9yIGlmIEBjIHNwdXRiYWNrYygpIGZhaWxzLCBzZXRzIGJhZGJpdCBpbgorICAgICAgICogIHRoZSBlcnJvciBzdGF0ZS4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIFRoaXMgZnVuY3Rpb24gZmlyc3QgY2xlYXJzIGVvZmJpdC4gIFNpbmNlIG5vIGNoYXJhY3RlcnMKKyAgICAgICAqICAgICAgICAgYXJlIGV4dHJhY3RlZCwgdGhlIG5leHQgY2FsbCB0byBAYyBnY291bnQoKSB3aWxsIHJldHVybiAwLAorICAgICAgICogICAgICAgICBhcyByZXF1aXJlZCBieSBEUiA2MC4KKyAgICAgICovCisgICAgICBfX2lzdHJlYW1fdHlwZSYKKyAgICAgIHB1dGJhY2soY2hhcl90eXBlIF9fYyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVW5leHRyYWN0aW5nIHRoZSBwcmV2aW91cyBjaGFyYWN0ZXIuCisgICAgICAgKiAgQHJldHVybiAgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgSWYgQGMgcmRidWYoKSBpcyBub3QgbnVsbCwgY2FsbHMgQGMgcmRidWYoKS0+c3VuZ2V0YyhjKS4KKyAgICAgICAqCisgICAgICAgKiAgSWYgQGMgcmRidWYoKSBpcyBudWxsIG9yIGlmIEBjIHN1bmdldGMoKSBmYWlscywgc2V0cyBiYWRiaXQgaW4KKyAgICAgICAqICB0aGUgZXJyb3Igc3RhdGUuCisgICAgICAgKgorICAgICAgICogIEBub3RlICBUaGlzIGZ1bmN0aW9uIGZpcnN0IGNsZWFycyBlb2ZiaXQuICBTaW5jZSBubyBjaGFyYWN0ZXJzCisgICAgICAgKiAgICAgICAgIGFyZSBleHRyYWN0ZWQsIHRoZSBuZXh0IGNhbGwgdG8gQGMgZ2NvdW50KCkgd2lsbCByZXR1cm4gMCwKKyAgICAgICAqICAgICAgICAgYXMgcmVxdWlyZWQgYnkgRFIgNjAuCisgICAgICAqLworICAgICAgX19pc3RyZWFtX3R5cGUmCisgICAgICB1bmdldCgpOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFN5bmNocm9uaXppbmcgdGhlIHN0cmVhbSBidWZmZXIuCisgICAgICAgKiAgQHJldHVybiAgMCBvbiBzdWNjZXNzLCAtMSBvbiBmYWlsdXJlCisgICAgICAgKgorICAgICAgICogIElmIEBjIHJkYnVmKCkgaXMgYSBudWxsIHBvaW50ZXIsIHJldHVybnMgLTEuCisgICAgICAgKgorICAgICAgICogIE90aGVyd2lzZSwgY2FsbHMgQGMgcmRidWYoKS0+cHVic3luYygpLCBhbmQgaWYgdGhhdCByZXR1cm5zIC0xLAorICAgICAgICogIHNldHMgYmFkYml0IGFuZCByZXR1cm5zIC0xLgorICAgICAgICoKKyAgICAgICAqICBPdGhlcndpc2UsIHJldHVybnMgMC4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIFRoaXMgZnVuY3Rpb24gZG9lcyBub3QgY291bnQgdGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzCisgICAgICAgKiAgICAgICAgIGV4dHJhY3RlZCwgaWYgYW55LCBhbmQgdGhlcmVmb3JlIGRvZXMgbm90IGFmZmVjdCB0aGUgbmV4dAorICAgICAgICogICAgICAgICBjYWxsIHRvIEBjIGdjb3VudCgpLgorICAgICAgKi8KKyAgICAgIGludAorICAgICAgc3luYygpOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEdldHRpbmcgdGhlIGN1cnJlbnQgcmVhZCBwb3NpdGlvbi4KKyAgICAgICAqICBAcmV0dXJuICBBIGZpbGUgcG9zaXRpb24gb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqICBJZiBAYyBmYWlsKCkgaXMgbm90IGZhbHNlLCByZXR1cm5zIEBjIHBvc190eXBlKC0xKSB0byBpbmRpY2F0ZQorICAgICAgICogIGZhaWx1cmUuICBPdGhlcndpc2UgcmV0dXJucyBAYyByZGJ1ZigpLT5wdWJzZWVrb2ZmKDAsY3VyLGluKS4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIFRoaXMgZnVuY3Rpb24gZG9lcyBub3QgY291bnQgdGhlIG51bWJlciBvZiBjaGFyYWN0ZXJzCisgICAgICAgKiAgICAgICAgIGV4dHJhY3RlZCwgaWYgYW55LCBhbmQgdGhlcmVmb3JlIGRvZXMgbm90IGFmZmVjdCB0aGUgbmV4dAorICAgICAgICogICAgICAgICBjYWxsIHRvIEBjIGdjb3VudCgpLiAgQXQgdmFyaWFuY2Ugd2l0aCBwdXRiYWNrLCB1bmdldCBhbmQKKyAgICAgICAqICAgICAgICAgc2Vla2csIGVvZmJpdCBpcyBub3QgY2xlYXJlZCBmaXJzdC4KKyAgICAgICovCisgICAgICBwb3NfdHlwZQorICAgICAgdGVsbGcoKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDaGFuZ2luZyB0aGUgY3VycmVudCByZWFkIHBvc2l0aW9uLgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIEEgZmlsZSBwb3NpdGlvbiBvYmplY3QuCisgICAgICAgKiAgQHJldHVybiAgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgSWYgQGMgZmFpbCgpIGlzIG5vdCB0cnVlLCBjYWxscyBAYyByZGJ1ZigpLT5wdWJzZWVrcG9zKF9fcG9zKS4gIElmCisgICAgICAgKiAgdGhhdCBmdW5jdGlvbiBmYWlscywgc2V0cyBmYWlsYml0LgorICAgICAgICoKKyAgICAgICAqICBAbm90ZSAgVGhpcyBmdW5jdGlvbiBmaXJzdCBjbGVhcnMgZW9mYml0LiAgSXQgZG9lcyBub3QgY291bnQgdGhlCisgICAgICAgKiAgICAgICAgIG51bWJlciBvZiBjaGFyYWN0ZXJzIGV4dHJhY3RlZCwgaWYgYW55LCBhbmQgdGhlcmVmb3JlIGRvZXMKKyAgICAgICAqICAgICAgICAgbm90IGFmZmVjdCB0aGUgbmV4dCBjYWxsIHRvIEBjIGdjb3VudCgpLgorICAgICAgKi8KKyAgICAgIF9faXN0cmVhbV90eXBlJgorICAgICAgc2Vla2cocG9zX3R5cGUpOworCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENoYW5naW5nIHRoZSBjdXJyZW50IHJlYWQgcG9zaXRpb24uCisgICAgICAgKiAgQHBhcmFtICBfX29mZiAgQSBmaWxlIG9mZnNldCBvYmplY3QuCisgICAgICAgKiAgQHBhcmFtICBfX2RpciAgVGhlIGRpcmVjdGlvbiBpbiB3aGljaCB0byBzZWVrLgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIElmIEBjIGZhaWwoKSBpcyBub3QgdHJ1ZSwgY2FsbHMgQGMgcmRidWYoKS0+cHVic2Vla29mZihfX29mZixfX2RpcikuCisgICAgICAgKiAgSWYgdGhhdCBmdW5jdGlvbiBmYWlscywgc2V0cyBmYWlsYml0LgorICAgICAgICoKKyAgICAgICAqICBAbm90ZSAgVGhpcyBmdW5jdGlvbiBmaXJzdCBj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ICAgIG1pbigpIG5vZXhjZXB0IHsgcmV0dXJuIF9fZ2xpYmN4eF9taW4gKGNoYXIzMl90KTsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGNoYXIzMl90IAorICAgICAgbWF4KCkgbm9leGNlcHQgeyByZXR1cm4gX19nbGliY3h4X21heCAoY2hhcjMyX3QpOyB9CisKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgY2hhcjMyX3QgCisgICAgICBsb3dlc3QoKSBub2V4Y2VwdCB7IHJldHVybiBtaW4oKTsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGludCBkaWdpdHMgPSBfX2dsaWJjeHhfZGlnaXRzIChjaGFyMzJfdCk7CisgICAgICBzdGF0aWMgY29uc3RleHByIGludCBkaWdpdHMxMCA9IF9fZ2xpYmN4eF9kaWdpdHMxMCAoY2hhcjMyX3QpOworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQgbWF4X2RpZ2l0czEwID0gMDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgYm9vbCBpc19zaWduZWQgPSBfX2dsaWJjeHhfc2lnbmVkIChjaGFyMzJfdCk7CisgICAgICBzdGF0aWMgY29uc3RleHByIGJvb2wgaXNfaW50ZWdlciA9IHRydWU7CisgICAgICBzdGF0aWMgY29uc3RleHByIGJvb2wgaXNfZXhhY3QgPSB0cnVlOworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQgcmFkaXggPSAyOworCisgICAgICBzdGF0aWMgY29uc3RleHByIGNoYXIzMl90IAorICAgICAgZXBzaWxvbigpIG5vZXhjZXB0IHsgcmV0dXJuIDA7IH0KKworICAgICAgc3RhdGljIGNvbnN0ZXhwciBjaGFyMzJfdCAKKyAgICAgIHJvdW5kX2Vycm9yKCkgbm9leGNlcHQgeyByZXR1cm4gMDsgfQorCisgICAgICBzdGF0aWMgY29uc3RleHByIGludCBtaW5fZXhwb25lbnQgPSAwOworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnQgbWluX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gICBfX2d0aHJlYWRfbXV0ZXhfZGVzdHJveShfX214KTsKKyAgICAgIH0KKyNlbmRpZgorICB9OworCisgIC8qKgorICAgKiBAZGVmZ3JvdXAgbXV0ZXhlcyBNdXRleGVzCisgICAqIEBpbmdyb3VwIGNvbmN1cnJlbmN5CisgICAqCisgICAqIENsYXNzZXMgZm9yIG11dGV4IHN1cHBvcnQuCisgICAqIEB7CisgICAqLworCisgIC8vLyBtdXRleAorICBjbGFzcyBtdXRleCA6IHByaXZhdGUgX19tdXRleF9iYXNlCisgIHsKKyAgcHVibGljOgorICAgIHR5cGVkZWYgX19uYXRpdmVfdHlwZSogCQkJbmF0aXZlX2hhbmRsZV90eXBlOworCisjaWZkZWYgX19HVEhSRUFEX01VVEVYX0lOSVQKKyAgICBjb25zdGV4cHIKKyNlbmRpZgorICAgIG11dGV4KCkgbm9leGNlcHQgPSBkZWZhdWx0OworICAgIH5tdXRleCgpID0gZGVmYXVsdDsKKworICAgIG11dGV4KGNvbnN0IG11dGV4JikgPSBkZWxldGU7CisgICAgbXV0ZXgmIG9wZXJhdG9yPShjb25zdCBtdXRleCYpID0gZGVsZXRlOworCisgICAgdm9pZAorICAgIGxvY2soKQorICAgIHsKKyAgICAgIGludCBfX2UgPSBfX2d0aHJlYWRfbXV0ZXhfbG9jaygmX01fbXV0ZXgpOworCisgICAgICAvLyBFSU5WQUwsIEVBR0FJTiwgRUJVU1ksIEVJTlZBTCwgRURFQURMSyhtYXkpCisgICAgICBpZiAoX19lKQorCV9fdGhyb3dfc3lzdGVtX2Vycm9yKF9fZSk7CisgICAgfQorCisgICAgYm9vbAorICAgIHRyeV9sb2NrKCkgbm9leGNlcHQKKyAgICB7CisgICAgICAvLyBYWFggRUlOVkFMLCBFQUdBSU4sIEVCVVNZCisgICAgICByZXR1cm4gIV9fZ3RocmVhZF9tdXRleF90cnlsb2NrKCZfTV9tdXRleCk7CisgICAgfQorCisgICAgdm9pZAorICAgIHVubG9jaygpCisgICAgeworICAgICAgLy8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d25zKGZhbHNlKQorICAgICAgeyB9CisKKyAgICAgIGV4cGxpY2l0IHVuaXF1ZV9sb2NrKG11dGV4X3R5cGUmIF9fbSkKKyAgICAgIDogX01fZGV2aWNlKCZfX20pLCBfTV9vd25zKGZhbHNlKQorICAgICAgeworCWxvY2soKTsKKwlfTV9vd25zID0gdHJ1ZTsKKyAgICAgIH0KKworICAgICAgdW5pcXVlX2xvY2sobXV0ZXhfdHlwZSYgX19tLCBkZWZlcl9sb2NrX3QpIG5vZXhjZXB0CisgICAgICA6IF9NX2RldmljZSgmX19tKSwgX01fb3ducyhmYWxzZSkKKyAgICAgIHsgfQorCisgICAgICB1bmlxdWVfbG9jayhtdXRleF90eXBlJiBfX20sIHRyeV90b19sb2NrX3QpCisgICAgICA6IF9NX2RldmljZSgmX19tKSwgX01fb3ducyhfTV9kZXZpY2UtPnRyeV9sb2NrKCkpCisgICAgICB7IH0KKworICAgICAgdW5pcXVlX2xvY2sobXV0ZXhfdHlwZSYgX19tLCBhZG9wdF9sb2NrX3QpCisgICAgICA6IF9NX2RldmljZSgmX19tKSwgX01fb3ducyh0cnVlKQorICAgICAgeworCS8vIFhYWCBjYWxsaW5nIHRocmVhZCBvd25zIG11dGV4CisgICAgICB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9DbG9jaywgdHlwZW5hbWUgX0R1cmF0aW9uPgorCXVuaXF1ZV9sb2NrKG11dGV4X3R5cGUmIF9fbSwKKwkJICAgIGNvbnN0IGNocm9ubzo6dGltZV9wb2ludDxfQ2xvY2ssIF9EdXJhdGlvbj4mIF9fYXRpbWUpCisJOiBfTV9kZXZpY2UoJl9fbSksIF9NX293bnMoX01fZGV2aWNlLT50cnlfbG9ja191bnRpbChfX2F0aW1lKSkKKwl7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlcCwgdHlwZW5hbWUgX1BlcmlvZD4KKwl1bmlxdWVfbG9jayhtdXRleF90eXBlJiBfX20sCisJCSAgICBjb25zdCBjaHJvbm86OmR1cmF0aW9uPF9SZXAsIF9QZXJpb2Q+JiBfX3J0aW1lKQorCTogX01fZGV2aWNlKCZfX20pLCBfTV9vd25zKF9NX2RldmljZS0+dHJ5X2xvY2tfZm9yKF9fcnRpbWUpKQorCXsgfQorCisgICAgICB+dW5pcXVlX2xvY2soKQorICAgICAgeworCWlmIChfTV9vd25zKQorCSAgdW5sb2NrKCk7CisgICAgICB9CisKKyAgICAgIHVuaXF1ZV9sb2NrKGNvbnN0IHVuaXF1ZV9sb2NrJikgPSBkZWxldGU7CisgICAgICB1bmlxdWVfbG9jayYgb3BlcmF0b3I9KGNvbnN0IHVuaXF1ZV9sb2NrJikgPSBkZWxldGU7CisKKyAgICAgIHVuaXF1ZV9sb2NrKHVuaXF1ZV9sb2NrJiYgX191KSBub2V4Y2VwdAorICAgICAgOiBfTV9kZXZpY2UoX191Ll9NX2RldmljZSksIF9NX293bnMoX191Ll9NX293bnMpCisgICAgICB7CisJX191Ll9NX2RldmljZSA9IDA7CisJX191Ll9NX293bnMgPSBmYWxzZTsKKyAgICAgIH0KKworICAgICAgdW5pcXVlX2xvY2smIG9wZXJhdG9yPSh1bmlxdWVfbG9jayYmIF9fdSkgbm9leGNlcHQKKyAgICAgIHsKKwlpZihfTV9vd25zKQorCSAgdW5sb2NrKCk7CisKKwl1bmlxdWVfbG9jayhzdGQ6Om1vdmUoX191KSkuc3dhcCgqdGhpcyk7CisKKwlfX3UuX01fZGV2aWNlID0gMDsKKwlfX3UuX01fb3ducyA9IGZhbHNlOworCisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBsb2NrKCkKKyAgICAgIHsKKwlpZiAoIV9NX2RldmljZSkKKwkgIF9fdGhyb3dfc3lzdGVtX2Vycm9yKGludChlcnJjOjpvcGVyYXRpb25fbm90X3Blcm1pdHRlZCkpOworCWVsc2UgaWYgKF9NX293bnMpCisJICBfX3Rocm93X3N5c3RlbV9lcnJvcihpbnQoZXJyYzo6cmVzb3VyY2VfZGVhZGxvY2tfd291bGRfb2NjdXIpKTsKKwllbHNlCisJICB7CisJICAgIF9NX2RldmljZS0+bG9jaygpOworCSAgICBfTV9vd25zID0gdHJ1ZTsKKwkgIH0KKyAgICAgIH0KKworICAgICAgYm9vbAorICAgICAgdHJ5X2xvY2soKQorICAgICAgeworCWlmICghX01fZGV2aWNlKQorCSAgX190aHJvd19zeXN0ZW1fZXJyb3IoaW50KGVycmM6Om9wZXJhdGlvbl9ub3RfcGVybWl0dGVkKSk7CisJZWxzZSBpZiAoX01fb3ducykKKwkgIF9fdGhyb3dfc3lzdGVtX2Vycm9yKGludChlcnJjOjpyZXNvdXJjZV9kZWFkbG9ja193b3VsZF9vY2N1cikpOworCWVsc2UKKwkgIHsKKwkgICAgX01fb3ducyA9IF9NX2RldmljZS0+dHJ5X2xvY2soKTsKKwkgICAgcmV0dXJuIF9NX293bnM7CisJICB9CisgICAgICB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9DbG9jaywgdHlwZW5hbWUgX0R1cmF0aW9uPgorCWJvb2wKKwl0cnlfbG9ja191bnRpbChjb25zdCBjaHJvbm86OnRpbWVfcG9pbnQ8X0Nsb2NrLCBfRHVyYXRpb24+JiBfX2F0aW1lKQorCXsKKwkgIGlmICghX01fZGV2aWNlKQorCSAgICBfX3Rocm93X3N5c3RlbV9lcnJvcihpbnQoZXJyYzo6b3BlcmF0aW9uX25vdF9wZXJtaXR0ZWQpKTsKKwkgIGVsc2UgaWYgKF9NX293bnMpCisJICAgIF9fdGhyb3dfc3lzdGVtX2Vycm9yKGludChlcnJjOjpyZXNvdXJjZV9kZWFkbG9ja193b3VsZF9vY2N1cikpOworCSAgZWxzZQorCSAgICB7CisJICAgICAgX01fb3ducyA9IF9NX2RldmljZS0+dHJ5X2xvY2tfdW50aWwoX19hdGltZSk7CisJICAgICAgcmV0dXJuIF9NX293bnM7CisJICAgIH0KKwl9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9SZXAsIHR5cGVuYW1lIF9QZXJpb2Q+CisJYm9vbAorCXRyeV9sb2NrX2Zvcihjb25zdCBjaHJvbm86OmR1cmF0aW9uPF9SZXAsIF9QZXJpb2Q+JiBfX3J0aW1lKQorCXsKKwkgIGlmICghX01fZGV2aWNlKQorCSAgICBfX3Rocm93X3N5c3RlbV9lcnJvcihpbnQoZXJyYzo6b3BlcmF0aW9uX25vdF9wZXJtaXR0ZWQpKTsKKwkgIGVsc2UgaWYgKF9NX293bnMpCisJICAgIF9fdGhyb3dfc3lzdGVtX2Vycm9yKGludChlcnJjOjpyZXNvdXJjZV9kZWFkbG9ja193b3VsZF9vY2N1cikpOworCSAgZWxzZQorCSAgICB7CisJICAgICAgX01fb3ducyA9IF9NX2RldmljZS0+dHJ5X2xvY2tfZm9yKF9fcnRpbWUpOworCSAgICAgIHJldHVybiBfTV9vd25zOworCSAgICB9CisJIH0KKworICAgICAgdm9pZAorICAgICAgdW5sb2NrKCkKKyAgICAgIHsKKwlpZiAoIV9NX293bnMpCisJICBfX3Rocm93X3N5c3RlbV9lcnJvcihpbnQoZXJyYzo6b3BlcmF0aW9uX25vdF9wZXJtaXR0ZWQpKTsKKwllbHNlIGlmIChfTV9kZXZpY2UpCisJICB7CisJICAgIF9NX2RldmljZS0+dW5sb2NrKCk7CisJICAgIF9NX293bnMgPSBmYWxzZTsKKwkgIH0KKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgc3dhcCh1bmlxdWVfbG9jayYgX191KSBub2V4Y2VwdAorICAgICAgeworCXN0ZDo6c3dhcChfTV9kZXZpY2UsIF9fdS5fTV9kZXZpY2UpOworCXN0ZDo6c3dhcChfTV9vd25zLCBfX3UuX01fb3ducyk7CisgICAgICB9CisKKyAgICAgIG11dGV4X3R5cGUqCisgICAgICByZWxlYXNlKCkgbm9leGNlcHQKKyAgICAgIHsKKwltdXRleF90eXBlKiBfX3JldCA9IF9NX2RldmljZTsKKwlfTV9kZXZpY2UgPSAwOworC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yB0byBsb2NrKCksIHRyeV9sb2NrKCkKKyAgICogIGFuZCB1bmxvY2soKS4gIElmIHRoZSBjYWxsIGV4aXRzIHZpYSBhbiBleGNlcHRpb24gYW55IGxvY2tzIHRoYXQgd2VyZQorICAgKiAgb2J0YWluZWQgd2lsbCBiZSByZWxlYXNlZC4KKyAgICovCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9MMSwgdHlwZW5hbWUgX0wyLCB0eXBlbmFtZSAuLi5fTDM+CisgICAgdm9pZAorICAgIGxvY2soX0wxJiBfX2wxLCBfTDImIF9fbDIsIF9MMyYuLi4gX19sMykKKyAgICB7CisgICAgICB3aGlsZSAodHJ1ZSkKKyAgICAgICAgeworICAgICAgICAgIHVuaXF1ZV9sb2NrPF9MMT4gX19maXJzdChfX2wxKTsKKyAgICAgICAgICBpbnQgX19pZHg7CisgICAgICAgICAgYXV0byBfX2xvY2tzID0gc3RkOjp0aWUoX19sMiwgX19sMy4uLik7CisgICAgICAgICAgX190cnlfbG9ja19pbXBsPDAsIHNpemVvZi4uLihfTDMpPjo6X19kb190cnlfbG9jayhfX2xvY2tzLCBfX2lkeCk7CisgICAgICAgICAgaWYgKF9faWR4ID09IC0xKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX2ZpcnN0LnJlbGVhc2UoKTsKKyAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgIC8vLyBvbmNlX2ZsYWcKKyAgc3RydWN0IG9uY2VfZmxhZworICB7CisgIHByaXZhdGU6CisgICAgdHlwZWRlZiBfX2d0aHJlYWRfb25jZV90IF9fbmF0aXZlX3R5cGU7CisgICAgX19uYXRpdmVfdHlwZSAgX01fb25jZSA9IF9fR1RIUkVBRF9PTkNFX0lOSVQ7CisKKyAgcHVibGljOgorICAgIC8vLyBDb25zdHJ1Y3RvcgorICAgIGNvbnN0ZXhwciBvbmNlX2ZsYWcoKSBub2V4Y2VwdCA9IGRlZmF1bHQ7CisK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Bmb3JtYXR0aW5nLgorICAgICAgKi8KKyAgICAgIF9fb3N0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I8PChsb25nIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2luc2VydChfX24pOyB9CisKKyAgICAgIF9fb3N0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I8PCh1bnNpZ25lZCBsb25nIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2luc2VydChfX24pOyB9CisKKyAgICAgIF9fb3N0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I8PChib29sIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2luc2VydChfX24pOyB9CisKKyAgICAgIF9fb3N0cmVhbV90eXBlJgorICAgICAgb3BlcmF0b3I8PChzaG9ydCBfX24pOworCisgICAgICBfX29zdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPDwodW5zaWduZWQgc2hvcnQgX19uKQorICAgICAgeworCS8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKwkvLyAxMTcuIGJhc2ljX29zdHJlYW0gdXNlcyBub25leGlzdGVudCBudW1fcHV0IG1lbWJlciBmdW5jdGlvbnMuCisJcmV0dXJuIF9NX2luc2VydChzdGF0aWNfY2FzdDx1bnNpZ25lZCBsb25nPihfX24pKTsKKyAgICAgIH0KKworICAgICAgX19vc3RyZWFtX3R5cGUmCisgICAgICBvcGVyYXRvcjw8KGludCBfX24pOworCisgICAgICBfX29zdHJlYW1fdHlwZSYKKyAgICAgIG9wZXJhdG9yPDwodW5zaWduZWQgaW50IF9fbikKKyAgICAgIHsKKwkvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisJLy8gMTE3LiBiYXNpY19vc3RyZWFtIHVzZXMgbm9uZXhpc3RlbnQgbnVtX3B1dCBtZW1iZXIgZnVuY3Rpb25zLgorCXJldHVybiBfTV9pbnNlcnQoc3RhdGljX2Nhc3Q8dW5zaWduZWQgbG9uZz4oX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yAgVGhlIGNoYXJhY3RlciB0byBpbnNlcnQuCisgICAgICAgKiAgQHJldHVybiAgKnRoaXMKKyAgICAgICAqCisgICAgICAgKiAgVHJpZXMgdG8gaW5zZXJ0IEBwIF9fYy4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIFRoaXMgZnVuY3Rpb24gaXMgbm90IG92ZXJsb2FkZWQgb24gc2lnbmVkIGNoYXIgYW5kCisgICAgICAgKiAgICAgICAgIHVuc2lnbmVkIGNoYXIuCisgICAgICAqLworICAgICAgX19vc3RyZWFtX3R5cGUmCisgICAgICBwdXQoY2hhcl90eXBlIF9fYyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29yZSB3cml0ZSBmdW5jdGlvbmFsaXR5LCB3aXRob3V0IHNlbnRyeS4KKyAgICAgICAqICBAcGFyYW0gIF9fcyAgVGhlIGFycmF5IHRvIGluc2VydC4KKyAgICAgICAqICBAcGFyYW0gIF9fbiAgTWF4aW11bSBudW1iZXIgb2YgY2hhcmFjdGVycyB0byBpbnNlcnQuCisgICAgICAqLworICAgICAgdm9pZAorICAgICAgX01fd3JpdGUoY29uc3QgY2hhcl90eXBlKiBfX3MsIHN0cmVhbXNpemUgX19uKQorICAgICAgeworCWNvbnN0IHN0cmVhbXNpemUgX19wdXQgPSB0aGlzLT5yZGJ1ZigpLT5zcHV0bihfX3MsIF9fbik7CisJaWYgKF9fcHV0ICE9IF9fbikKKwkgIHRoaXMtPnNldHN0YXRlKGlvc19iYXNlOjpiYWRiaXQpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENoYXJhY3RlciBzdHJpbmcgaW5zZXJ0aW9uLgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgYXJyYXkgdG8gaW5zZXJ0LgorICAgICAgICogIEBwYXJhbSAgX19uICBNYXhpbXVtIG51bWJlciBvZiBjaGFyYWN0ZXJzIHRvIGluc2VydC4KKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBDaGFyYWN0ZXJzIGFyZSBjb3BpZWQgZnJvbSBAcCBfX3MgYW5kIGluc2VydGVkIGludG8gdGhlIHN0cmVhbSB1bnRpbAorICAgICAgICogIG9uZSBvZiB0aGUgZm9sbG93aW5nIGhhcHBlbnM6CisgICAgICAgKgorICAgICAgICogIC0gQHAgX19uIGNoYXJhY3RlcnMgYXJlIGluc2VydGVkCisgICAgICAgKiAgLSBpbnNlcnRpbmcgaW50byB0aGUgb3V0cHV0IHNlcXVlbmNlIGZhaWxzIChpbiB0aGlzIGNhc2UsIGJhZGJpdAorICAgICAgICogICAgd2lsbCBiZSBzZXQgaW4gdGhlIHN0cmVhbSdzIGVycm9yIHN0YXRlKQorICAgICAgICoKKyAgICAgICAqICBAbm90ZSAgVGhpcyBmdW5jdGlvbiBpcyBub3Qgb3ZlcmxvYWRlZCBvbiBzaWduZWQgY2hhciBhbmQKKyAgICAgICAqICAgICAgICAgdW5zaWduZWQgY2hhci4KKyAgICAgICovCisgICAgICBfX29zdHJlYW1fdHlwZSYKKyAgICAgIHdyaXRlKGNvbnN0IGNoYXJfdHlwZSogX19zLCBzdHJlYW1zaXplIF9fbik7CisgICAgICAvL0B9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU3luY2hyb25pemluZyB0aGUgc3RyZWFtIGJ1ZmZlci4KKyAgICAgICAqICBAcmV0dXJuICAqdGhpcworICAgICAgICoKKyAgICAgICAqICBJZiBAYyByZGJ1ZigpIGlzIGEgbnVsbCBwb2ludGVyLCBjaGFuZ2VzIG5vdGhpbmcuCisgICAgICAgKgorICAgICAgICogIE90aGVyd2lzZSwgY2FsbHMgQGMgcmRidWYoKS0+cHVic3luYygpLCBhbmQgaWYgdGhhdCByZXR1cm5zIC0xLAorICAgICAgICogIHNldHMgYmFkYml0LgorICAgICAgKi8KKyAgICAgIF9fb3N0cmVhbV90eXBlJgorICAgICAgZmx1c2goKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBHZXR0aW5nIHRoZSBjdXJyZW50IHdyaXRlIHBvc2l0aW9uLgorICAgICAgICogIEByZXR1cm4gIEEgZmlsZSBwb3NpdGlvbiBvYmplY3QuCisgICAgICAgKgorICAgICAgICogIElmIEBjIGZhaWwoKSBpcyBub3QgZmFsc2UsIHJldHVybnMgQGMgcG9zX3R5cGUoLTEpIHRvIGluZGljYXRlCisgICAgICAgKiAgZmFpbHVyZS4gIE90aGVyd2lzZSByZXR1cm5zIEBjIHJkYnVmKCktPnB1YnNlZWtvZmYoMCxjdXIsb3V0KS4KKyAgICAgICovCisgICAgICBwb3NfdHlwZQorICAgICAgdGVsbHAoKTsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDaGFuZ2luZyB0aGUgY3VycmVudCB3cml0ZSBwb3NpdGlvbi4KKyAgICAgICAqICBAcGFyYW0gIF9fcG9zICBBIGZpbGUgcG9zaXRpb24gb2JqZWN0LgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIElmIEBjIGZhaWwoKSBpcyBub3QgdHJ1ZSwgY2FsbHMgQGMgcmRidWYoKS0+cHVic2Vla3Bvcyhwb3MpLiAgSWYKKyAgICAgICAqICB0aGF0IGZ1bmN0aW9uIGZhaWxzLCBzZXRzIGZhaWxiaXQuCisgICAgICAqLworICAgICAgX19vc3RyZWFtX3R5cGUmCisgICAgICBzZWVrcChwb3NfdHlwZSk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ2hhbmdpbmcgdGhlIGN1cnJlbnQgd3JpdGUgcG9zaXRpb24uCisgICAgICAgKiAgQHBhcmFtICBfX29mZiAgQSBmaWxlIG9mZnNldCBvYmplY3QuCisgICAgICAgKiAgQHBhcmFtICBfX2RpciAgVGhlIGRpcmVjdGlvbiBpbiB3aGljaCB0byBzZWVrLgorICAgICAgICogIEByZXR1cm4gICp0aGlzCisgICAgICAgKgorICAgICAgICogIElmIEBjIGZhaWwoK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mFzZTo6dW5pdGJ1ZikgJiYgIXVuY2F1Z2h0X2V4Y2VwdGlvbigpKQorCSAgeworCSAgICAvLyBDYW4ndCBjYWxsIGZsdXNoIGRpcmVjdGx5IG9yIGVsc2Ugd2lsbCBnZXQgaW50byByZWN1cnNpdmUgbG9jay4KKwkgICAgaWYgKF9NX29zLnJkYnVmKCkgJiYgX01fb3MucmRidWYoKS0+cHVic3luYygpID09IC0xKQorCSAgICAgIF9NX29zLnNldHN0YXRlKGlvc19iYXNlOjpiYWRiaXQpOworCSAgfQorICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFF1aWNrIHN0YXR1cyBjaGVja2luZy4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgc2VudHJ5IHN0YXRlLgorICAgICAgICoKKyAgICAgICAqICBGb3IgZWFzZSBvZiB1c2UsIHNlbnRyaWVzIG1heSBiZSBjb252ZXJ0ZWQgdG8gYm9vbGVhbnMuICBUaGUKKyAgICAgICAqICByZXR1cm4gdmFsdWUgaXMgdGhhdCBvZiB0aGUgc2VudHJ5IHN0YXRlICh0cnVlID09IG9rYXkpLgorICAgICAgKi8KKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgZXhwbGljaXQKKyNlbmRpZgorICAgICAgb3BlcmF0b3IgYm9vbCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9vazsgfQorICAgIH07CisKKyAgLy9AeworICAvKioKKyAgICogIEBicmllZiAgQ2hhcmFjdGVyIGluc2VydGVycworICAgKiAgQHBhcmFtICBfX291dCAgQW4gb3V0cHV0IHN0cmVhbS4KKyAgICogIEBwYXJhbSAgX19jICBBIGNoYXJhY3Rlci4KKyAgICogIEByZXR1cm4gIG91dAorICAgKgorICAgKiAgQmVoYXZlcyBsaWtlIG9uZSBvZiB0aGUgZm9ybWF0dGVkIGFyaXRobWV0aWMgaW5zZXJ0ZXJzIGRlc2NyaWJlZCBpbgorICAgKiAgc3RkO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isJX01fYmFzZSgpIF49IF9fcmhzOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBvcGVyYXRvcjw8PShzaXplX3QgX19wb3MpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJX01fYmFzZSgpIDw8PSBfX3BvczsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgb3BlcmF0b3I+Pj0oc2l6ZV90IF9fcG9zKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworCV9NX2Jhc2UoKSA+Pj0gX19wb3M7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIHNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJX0Jhc2U6OnNldCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMTg2LiBiaXRzZXQ6OnNldCgpIHNlY29uZCBwYXJhbWV0ZXIgc2hvdWxkIGJlIGJvb2wKKyAgICAgIGJpdHNldDxfTmI+JgorICAgICAgc2V0KHNpemVfdCBfX3BvcywgYm9vbCBfX3ZhbCA9IHRydWUpCisgICAgICB7CisJX0Jhc2U6OnNldChfX3BvcywgX192YWwpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICByZXNldCgpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisJX0Jhc2U6OnJlc2V0KCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBiaXRzZXQ8X05iPiYKKyAgICAgIHJlc2V0KHNpemVfdCBfX3BvcykKKyAgICAgIHsKKwlfQmFzZTo6cmVzZXQoX19wb3MpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4KKyAgICAgIG9wZXJhdG9yfigpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBiaXRzZXQofl9NX2Jhc2UoKSk7IH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBmbGlwKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKwlfQmFzZTo6ZmxpcCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgYml0c2V0PF9OYj4mCisgICAgICBmbGlwKHNpemVfdCBfX3BvcykKKyAgICAgIHsKKwlfQmFzZTo6ZmxpcChfX3Bvcyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvLyBlbGVtZW50IGFjY2VzczoKKyAgICAgIC8vIF9HTElCQ1hYX1JFU09MVkVfTElCX0RFRkVDVFMKKyAgICAgIC8vIDExLiBCaXRzZXQgbWlub3IgcHJvYmxlbXMKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShzaXplX3QgX19wb3MpCisgICAgICB7CisJcmV0dXJuIHJlZmVyZW5jZShfTV9iYXNlKClbX19wb3NdLCB0aGlzKTsKKyAgICAgIH0KKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMTEuIEJpdHNldCBtaW5vciBwcm9ibGVtcworICAgICAgX0dMSUJDWFhfQ09OU1RFWFBSIGJvb2wKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90IF9fcG9zKSBjb25zdAorICAgICAgeworCXJldHVybiBfQmFzZTo6b3BlcmF0b3JbXShfX3Bvcyk7CisgICAgICB9CisKKyAgICAgIHVzaW5nIF9CYXNlOjp0b191bG9uZzsKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdXNpbmcgX0Jhc2U6OnRvX3VsbG9uZzsKKyNlbmRpZgorCisgICAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX0N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ICB1c2luZyBfQmFzZTo6bWF4X3NpemU7CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdm9pZAorICAgICAgcmVzaXplKHNpemVfdHlwZSBfX3N6KQorICAgICAgeworCV9CYXNlOjpyZXNpemUoX19zeik7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19zeiwgY29uc3QgX1RwJiBfX2MpCisgICAgICB7CisJX0Jhc2U6OnJlc2l6ZShfX3N6LCBfX2MpOworICAgICAgfQorI2Vsc2UKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19zeiwgX1RwIF9fYyA9IF9UcCgpKQorICAgICAgeworCV9CYXNlOjpyZXNpemUoX19zeiwgX19jKTsKKyAgICAgIH0KKyNlbmRpZgorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHVzaW5nIF9CYXNlOjpzaHJpbmtfdG9fZml0OworI2VuZGlmCisKKyAgICAgIHVzaW5nIF9CYXNlOjplbXB0eTsKKworICAgICAgLy8gZWxlbWVudCBhY2Nlc3M6CisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikKKyAgICAgIHsKKwlyZXR1cm4gX01fYmFzZSgpW19fbl07CisgICAgICB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShzaXplX3R5cGUgX19uKSBjb25zdAorICAgICAgeworCXJldHVybiBfTV9iYXNlKClbX19uXTsKKyAgICAgIH0KKworICAgICAgdXNpbmcgX0Jhc2U6OmF0OworCisgICAgICByZWZlcmVuY2UKKyAgICAgIGZyb250KCkKKyAgICAgIHsKKwlyZXR1cm4gX0Jhc2U6OmZyb250KCk7CisgICAgICB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgZnJvbnQoKSBjb25zdAorICAgICAgeworCXJldHVybiBfQmFzZTo6ZnJvbnQoKTsKKyAgICAgIH0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBiYWNrKCkKKyAgICAgIHsKKwlyZXR1cm4gX0Jhc2U6OmJhY2soKTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsKKwlyZXR1cm4gX0Jhc2U6OmJhY2soKTsKKyAgICAgIH0KKworICAgICAgLy8gMjMuMi4xLjMgbW9kaWZpZXJzOgorICAgICAgdm9pZAorICAgICAgcHVzaF9mcm9udChjb25zdCBfVHAmIF9feCkKKyAgICAgIHsKKwlfQmFzZTo6cHVzaF9mcm9udChfX3gpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBwdXNoX2JhY2soY29uc3QgX1RwJiBfX3gpCisgICAgICB7CisJX0Jhc2U6OnB1c2hfYmFjayhfX3gpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHZvaWQKKyAgICAgIHB1c2hfZnJvbnQoX1RwJiYgX194KQorICAgICAgeyBlbXBsYWNlX2Zyb250KHN0ZDo6bW92ZShfX3gpKTsgfQorCisgICAgICB2b2lkCisgICAgICBwdXNoX2JhY2soX1RwJiYgX194KQorICAgICAgeyBlbXBsYWNlX2JhY2soc3RkOjptb3ZlKF9feCkpOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICB2b2lkCisgICAgICAgIGVtcGxhY2VfZnJvbnQoX0FyZ3MmJi4uLiBfX2FyZ3MpCisJeworCSAgX0Jhc2U6OmVtcGxhY2VfZnJvbnQoc3RkOjpmb3J3YXJkPF9BcmdzPihfX2FyZ3MpLi4uKTsKKwl9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICB2b2lkCisgICAgICAgIGVtcGxhY2VfYmFjayhf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ICBwdWJsaWM6CisgICAgICAvLyAyMy4yLjMuMSBjb25zdHJ1Y3QvY29weS9kZXN0cm95OgorICAgICAgZXhwbGljaXQKKyAgICAgIGZvcndhcmRfbGlzdChjb25zdCBfQWxsb2MmIF9fYWwgPSBfQWxsb2MoKSkKKyAgICAgIDogX0Jhc2UoX19hbCkgeyB9CisKKyAgICAgIGZvcndhcmRfbGlzdChjb25zdCBmb3J3YXJkX2xpc3QmIF9fbGlzdCwgY29uc3QgX0FsbG9jJiBfX2FsKQorICAgICAgOiBfQmFzZShfX2xpc3QsIF9fYWwpCisgICAgICB7IH0KKworICAgICAgZm9yd2FyZF9saXN0KGZvcndhcmRfbGlzdCYmIF9fbGlzdCwgY29uc3QgX0FsbG9jJiBfX2FsKQorICAgICAgOiBfQmFzZShzdGQ6Om1vdmUoX19saXN0KSwgX19hbCkKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgZm9yd2FyZF9saXN0KHNpemVfdHlwZSBfX24pCisgICAgICA6IF9CYXNlKF9fbikKKyAgICAgIHsgfQorCisgICAgICBmb3J3YXJkX2xpc3Qoc2l6ZV90eXBlIF9fbiwgY29uc3QgX1RwJiBfX3ZhbHVlLAorICAgICAgICAgICAgICAgICAgIGNvbnN0IF9BbGxvYyYgX19hbCA9IF9BbGxvYygpKQorICAgICAgOiBfQmFzZShfX24sIF9fdmFsdWUsIF9fYWwpCisgICAgICB7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcmF0b3I+CisgICAgICAgIGZvcndhcmRfbGlzdChfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QsCisgICAgICAgICAgICAgICAgICAgICBjb25zdCBfQWxsb2MmIF9fYWwgPSBfQWxsb2MoKSkKKyAgICAgICAgOiBfQmFzZShfX2ZpcnN0LCBfX2xhc3QsIF9fYWwpCisgICAgICAgIHsgfQorCisgICAgICBmb3J3YXJkX2xpc3Qo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MSUJDWFhfUFJPRklMRV9QUk9GSUxFUl9IIDEKKworI2luY2x1ZGUgPGJpdHMvYysrY29uZmlnLmg+CisKKy8vIE1lY2hhbmlzbSB0byBkZWZpbmUgZGF0YSB3aXRoIGlubGluZSBsaW5rYWdlLgorI2RlZmluZSBfR0xJQkNYWF9QUk9GSUxFX0RFRklORV9VTklOSVRfREFUQShfX3R5cGUsIF9fbmFtZSkgICAgICAgICAgICAgXAorICBpbmxpbmUgX190eXBlJiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICBfX2dldF8jI19fbmFtZSgpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHN0YXRpYyBfX3R5cGUgX19uYW1lOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHJldHVybiBfX25hbWU7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9CisjZGVmaW5lIF9HTElCQ1hYX1BST0ZJTEVfREVGSU5FX0RBVEEoX190eXBlLCBfX25hbWUsIF9faW5pdGlhbF92YWx1ZS4uLikgXAorICBpbmxpbmUgX190eXBlJiBfX2dldF8jI19fbmFtZSgpIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBzdGF0aWMgX190eXBlIF9fbmFtZShfX2luaXRpYWxfdmFsdWUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcmV0dXJuIF9fbmFtZTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB9CisjZGVmaW5lIF9HTElCQ1hYX1BST0ZJTEVfREFUQShfX25hbWUpIFwKKyAgX19nZXRfIyNfX25hbWUoKQorCituYW1lc3BhY2UgX19nbnVfcHJvZmlsZQoreworICAvKiogQGJyaWVmIFJlZW50cmFuY2UgZ3VhcmQuCisgICAqCisgICAqIE1lY2hhbmlzbSB0byBwcm90ZWN0IGFsbCBfX2dudV9wcm9maWxlIG9wZXJhdGlvbnMgYWdhaW5zdCByZWN1cnNpb24sCisgICAqIG11bHRpdGhyZWFkZWQgYW5kIGV4Y2VwdGlvbiByZWVudHJhbmNlLgorICAgKi8KKyAgc3RydWN0IF9fcmVlbnRyYW5jZV9ndWFyZAorICB7CisgICAgc3RhdGljIGJvb2wKKyAgICBfX2dldF9pbigpCisgICAgeworICAgICAgaWYgKF9faW5zaWRlKCkgPT0gdHJ1ZSkKKwlyZXR1cm4gZmFsc2U7CisgICAgICBlbHNlCisJeworCSAgX19pbnNpZGUoKSA9IHRydWU7CisJICByZXR1cm4gdHJ1ZTsKKwl9CisgICAgfQorCisgICAgc3RhdGljIGJvb2wmCisgICAgX19pbnNpZGUoKQorICAgIHsKKyAgICAgIHN0YXRpYyBfX3RocmVhZCBib29sIF9TX2luc2lkZShmYWxzZSk7CisgICAgICByZXR1cm4gX1NfaW5zaWRlOworICAgIH0KKworICAgIF9fcmVlbnRyYW5jZV9ndWFyZCgpIHsgfQorICAgIH5fX3JlZW50cmFuY2VfZ3VhcmQoKSB7IF9faW5zaWRlKCkgPSBmYWxzZTsgfQorICB9OworCisjZGVmaW5lIF9HTElCQ1hYX1BST0ZJTEVfUkVFTlRSQU5DRV9HVUFSRChfX3guLi4pCSAgICAgIAlcCisgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIGlmIChfX2dudV9wcm9maWxlOjpfX3JlZW50cmFuY2VfZ3VhcmQ6Ol9fZ2V0X2luKCkpICAgICAgICAgIFwKKyAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC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fX2NvbnRhaW5lcl9zaXplX2luZm8oY29uc3QgX19jb250YWluZXJfc2l6ZV9pbmZvJiBfX28pCisgICAgOiBfX29iamVjdF9pbmZvX2Jhc2UoX19vKSwgX01faW5pdChfX28uX01faW5pdCksIF9NX21heChfX28uX01fbWF4KSwKKyAgICAgIF9NX21pbihfX28uX01fbWluKSwgX01fdG90YWwoX19vLl9NX3RvdGFsKSwKKyAgICAgIF9NX2l0ZW1fbWluKF9fby5fTV9pdGVtX21pbiksIF9NX2l0ZW1fbWF4KF9fby5fTV9pdGVtX21heCksCisgICAgICBfTV9pdGVtX3RvdGFsKF9fby5fTV9pdGVtX3RvdGFsKSwgX01fY291bnQoX19vLl9NX2NvdW50KSwKKyAgICAgIF9NX3Jlc2l6ZShfX28uX01fcmVzaXplKSwgX01fY29zdChfX28uX01fY29zdCkKKyAgICB7IH0KKworICAgIF9fY29udGFpbmVyX3NpemVfaW5mbyhfX3N0YWNrX3QgX19zdGFjaywgc3RkOjpzaXplX3QgX19udW0pCisgICAgOiBfX29iamVjdF9pbmZvX2Jhc2UoX19zdGFjayksIF9NX2luaXQoX19udW0pLCBfTV9tYXgoX19udW0pLAorICAgICAgX01fbWluKDApLCBfTV90b3RhbCgwKSwgX01faXRlbV9taW4oMCksIF9NX2l0ZW1fbWF4KDApLAorICAgICAgX01faXRlbV90b3RhbCgwKSwgX01fY291bnQoMCksIF9NX3Jlc2l6ZSgwKSwgX01fY29zdCgwKQorICAgIHsgfQorCisgICAgdmlydHVhbCB+X19jb250YWluZXJfc2l6ZV9pbmZvKCkgeyB9CisKKyAgICB2b2lkCisgICAgX193cml0ZShGSUxFKiBfX2YpIGNvbnN0CisgICAgeworICAgICAgc3RkOjpmcHJpbnRmKF9fZiwgIiVadSAlWnUgJVp1ICVadSAlWnUgJVp1ICVadSAlWnUgJVp1ICVadVxuIiwgCisJCSAgIF9NX2luaXQsIF9NX2NvdW50LCBfTV9jb3N0LCBfTV9yZXNpemUsIF9NX21pbiwgX01fbWF4LAorCQkgICBfTV90b3RhbCwgX01faXRlbV9taW4sIF9NX2l0ZW1fbWF4LCBfTV9pdGVtX3RvdGFsKTsKKyAgICB9CisKKyAgICBmbG9hdAorICAgIF9fbWFnbml0dWRlKCkgY29uc3QKKyAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxmbG9hdD4oX01fY29zdCk7IH0KKworICAgIHN0ZDo6c3RyaW5nCisgICAgX19hZHZpY2UoKSBjb25zdAorICAgIHsKKyAgICAgIHN0ZDo6c3RyaW5nc3RyZWFtIF9fbWVzc2FnZTsKKyAgICAgIGlmIChfTV9pbml0IDwgX01faXRlbV9tYXgpCisJX19tZXNzYWdlIDw8ICJjaGFuZ2UgaW5pdGlhbCBjb250YWluZXIgc2l6ZSBmcm9tICIgPDwgX01faW5pdAorCQkgIDw8ICIgdG8gIiA8PCBfTV9pdGVtX21heDsKKyAgICAgIHJldHVybiBfX21lc3NhZ2Uuc3RyKCk7CisgICAgfQorCisgICAgdm9pZAorICAgIF9fbWVyZ2UoY29uc3QgX19jb250YWluZXJfc2l6ZV9pbmZvJiBfX28pCisgICAgeworICAgICAgX01faW5pdCAgICAgICAgPSBzdGQ6Om1heChfTV9pbml0LCBfX28uX01faW5pdCk7CisgICAgICBfTV9tYXggICAgICAgICA9IHN0ZDo6bWF4KF9NX21heCwgX19vLl9NX21heCk7CisgICAgICBfTV9pdGVtX21heCAgICA9IHN0ZDo6bWF4KF9NX2l0ZW1fbWF4LCBfX28uX01faXRlbV9tYXgpOworICAgICAgX01fbWluICAgICAgICAgPSBzdGQ6Om1pbihfTV9taW4sIF9fby5fTV9taW4pOworICAgICAgX01faXRlbV9taW4gICAgPSBzdGQ6Om1pbihfTV9pdGVtX21pbiwgX19vLl9NX2l0ZW1fbWluKTsKKyAgICAgIF9NX3RvdGFsICAgICAgKz0gX19vLl9NX3RvdGFsOworICAgICAgX01faXRlbV90b3RhbCArPSBfX28uX01faXRlbV90b3RhbDsKKyAgICAgIF9NX2NvdW50ICAgICAgKz0gX19vLl9NX2NvdW50OworICAgICAgX01fY29zdCAgICAgICArPSBfX28uX01fY29zdDsKKyAgICAgIF9NX3Jlc2l6ZSAgICAgKz0gX19vLl9NX3Jlc2l6ZTsKKyAgICB9CisKKyAgICAvLyBDYWxsIGlmIGEgY29udGFpbmVyIGlzIGRlc3RydWN0ZWQgb3IgY2xlYW5lZC4KKyAgICB2b2lkCisgICAgX19kZXN0cnVjdChzdGQ6OnNpemVfdCBfX251bSwgc3RkOjpzaXplX3QgX19pbnVtKQorICAgIHsKKyAgICAgIF9NX21heCA9IHN0ZDo6bWF4KF9NX21heCwgX19udW0pOworICAgICAgX01faXRlbV9tYXggPSBzdGQ6Om1heChfTV9pdGVtX21heCwgX19pbnVtKTsKKyAgICAgIGlmIChfTV9taW4gPT0gMCkKKwl7CisJICBfTV9taW4gPSBfX251bTsgCisJICBfTV9pdGVtX21pbiA9IF9faW51bTsKKwl9CisgICAgICBlbHNlCisJeworCSAgX01fbWluID0gc3RkOjptaW4oX01fbWluLCBfX251bSk7CisJICBfTV9pdGVtX21pbiA9IHN0ZDo6bWluKF9NX2l0ZW1fbWluLCBfX2ludW0pOworCX0KKyAgICAgIF9NX3RvdGFsICs9IF9fbnVtOworICAgICAgX01faXRlbV90b3RhbCArPSBfX2ludW07CisgICAgICBfTV9jb3VudCArPSAxOworICAgIH0KKworICAgIC8vIEVzdGltYXRlIHRoZSBjb3N0IG9mIHJlc2l6ZS9yZWhhc2guIAorICAgIGZsb2F0CisgICAgX19yZXNpemVfY29zdChzdGQ6OnNpemVfdCBfX2Zyb20sIHN0ZDo6c2l6ZV90KQorICAgIHsgcmV0dXJuIF9fZnJvbTsgfQorCisgICAgLy8gQ2FsbCBpZiBjb250YWluZXIgaXMgcmVzaXplZC4KKyAgICB2b2lkCisgICAgX19yZXNpemUoc3RkOjpzaXplX3QgX19mcm9tLCBzdGQ6OnNpemVfdCBfX3RvKQorICAgIHsKKyAgICAgIF9NX2Nvc3QgKz0gdGhpcy0+X19yZXNpemVfY29zdChfX2Zyb20sIF9fdG8pOworICAgICAgX01fcmVzaXplICs9IDE7CisgICAgICBfTV9tYXggPSBzdGQ6Om1heChfTV9tYXgsIF9fdG8pOworICAgIH0KKworICBwcml2YXRlOgorICAgIHN0ZDo6c2l6ZV90IF9NX2luaXQ7CisgICAgc3RkOjpzaXplX3QgX01fbWF4OyAgLy8gcmFuZ2Ugb2YgIyBidWNrZXRzCisgICAgc3RkOjpzaXplX3QgX01fbWluOworICAgIHN0ZDo6c2l6ZV90IF9NX3RvdGFsOworICAgIHN0ZDo6c2l6ZV90IF9NX2l0ZW1fbWluOyAgLy8gcmFuZ2Ugb2YgIyBpdGVtcworICAgIHN0ZDo6c2l6ZV90IF9NX2l0ZW1fbWF4OworICAgIHN0ZDo6c2l6ZV90IF9NX2l0ZW1fdG90YWw7CisgICAgc3RkOjpzaXplX3QgX01fY291bnQ7CisgICAgc3RkOjpzaXplX3QgX01fcmVzaXplOworICAgIHN0ZDo6c2l6ZV90IF9NX2Nvc3Q7CisgIH07CisKKworICAvKiogQGJyaWVmIEEgY29udGFpbmVyIHNpemUgaW5zdHJ1bWVudGF0aW9uIGxpbmUgaW4gdGhlIHN0YWNrIHRhYmxlLiAgKi8KKyAgY2xhc3MgX19jb250YWluZXJfc2l6ZV9zdGFja19pbmZvCisgIDogcHVibGljIF9fY29udGFpbmVyX3NpemVfaW5mbworICB7CisgIHB1YmxpYzoKKyAgICBfX2NvbnRhaW5lcl9zaXplX3N0YWNrX2luZm8oY29uc3QgX19jb250YWluZXJfc2l6ZV9pbmZvJiBfX28pCisgICAgOiBfX2NvbnRhaW5lcl9zaXplX2luZm8oX19vKSB7IH0KKyAgfTsKKworICAKKyAgLyoqIEBicmllZiBDb250YWluZXIgc2l6ZSBpbnN0cnVtZW50YXRpb24gdHJhY2UgcHJvZHVjZXIuICAqLworICBjbGFzcyBfX3RyYWNlX2NvbnRhaW5lcl9zaXplCisgIDogcHVibGljIF9fdHJhY2VfYmFzZTxfX2Nvb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mdlKGNvbnN0IF9fbGlzdDJzbGlzdF9pbmZvJikgeyB9CisKKyAgICB2b2lkCisgICAgX193cml0ZShGSUxFKiBfX2YpIGNvbnN0CisgICAgeyBzdGQ6OmZwcmludGYoX19mLCAiJXNcbiIsIF9NX3Jld2luZCA/ICJpbnZhbGlkIiA6ICJ2YWxpZCIpOyB9CisKKyAgICBzdGQ6OnN0cmluZworICAgIF9fYWR2aWNlKCkgY29uc3QKKyAgICB7IHJldHVybiAiY2hhbmdlIHN0ZDo6bGlzdCB0byBzdGQ6OmZvcndhcmRfbGlzdCI7IH0KKworICAgIHZvaWQKKyAgICBfX29wcl9yZXdpbmQoKQorICAgIHsKKyAgICAgIF9NX3Jld2luZCA9IHRydWU7CisgICAgICBfTV92YWxpZCA9IGZhbHNlOworICAgIH0KKworICAgIHZvaWQKKyAgICBfX3JlY29yZF9vcGVyYXRpb24oKQorICAgIHsgKytfTV9vcGVyYXRpb25zOyB9CisKKyAgICBib29sCisgICAgX19oYXNfcmV3aW5kKCkKKyAgICB7IHJldHVybiBfTV9yZXdpbmQ7IH0KKworICBwcml2YXRlOgorICAgIGJvb2wgX01fcmV3aW5kOworICAgIHN0ZDo6c2l6ZV90IF9NX29wZXJhdGlvbnM7CisgIH07CisKKyAgY2xhc3MgX19saXN0MnNsaXN0X3N0YWNrX2luZm8KKyAgOiBwdWJsaWMgX19saXN0MnNsaXN0X2luZm8KKyAgeworICBwdWJsaWM6CisgICAgX19saXN0MnNsaXN0X3N0YWNrX2luZm8oY29uc3QgX19saXN0MnNsaXN0X2luZm8mIF9fbykgCisgICAgOiBfX2xpc3Qyc2xpc3RfaW5mbyhfX28pIHsgfQorICB9OworCisgIGNsYXNzIF9fdHJhY2VfbGlzdF90b19zbGlzdAorICA6IHB1YmxpYyBfX3RyYWNlX2Jhc2U8X19saXN0MnNsaXN0X2luZm8sIF9fbGlzdDJzbGlzdF9zdGFja19pbmZvPiAKKyAgeworICBwdWJsaWM6CisgICAgfl9fdHJhY2VfbGlzdF90b19zbGlzdCgpIHsgfQorCisgICAgX190cmFjZV9saXN0X3RvX3NsaXN0KCkKKyAgICA6IF9fdHJhY2VfYmFzZTxfX2xpc3Qyc2xpc3RfaW5mbywgX19saXN0MnNsaXN0X3N0YWNrX2luZm8+KCkKKyAgICB7IF9faWQgPSAibGlzdC10by1zbGlzdCI7IH0KKworICAgIHZvaWQKKyAgICBfX29wcl9yZXdpbmQoY29uc3Qgdm9pZCogX19vYmopCisgICAgeworICAgICAgX19saXN0MnNsaXN0X2luZm8qIF9fcmVzID0gX19nZXRfb2JqZWN0X2luZm8oX19vYmopOworICAgICAgaWYgKF9fcmVzKQorCV9fcmVzLT5fX29wcl9yZXdpbmQoKTsKKyAgICB9CisKKyAgICB2b2lkCisgICAgX19yZWNvcmRfb3BlcmF0aW9uKGNvbnN0IHZvaWQqIF9fb2JqKQorICAgIHsKKyAgICAgIF9fbGlzdDJzbGlzdF9pbmZvKiBfX3JlcyA9IF9fZ2V0X29iamVjdF9pbmZvKF9fb2JqKTsKKyAgICAgIGlmIChfX3JlcykKKwlfX3Jlcy0+X19yZWNvcmRfb3BlcmF0aW9uKCk7CisgICAgfQorCisgICAgdm9pZAorICAgIF9faW5zZXJ0KGNvbnN0IF9fb2JqZWN0X3QgX19vYmosIF9fc3RhY2tfdCBfX3N0YWNrKQorICAgIHsgX19hZGRfb2JqZWN0KF9fb2JqLCBfX2xpc3Qyc2xpc3RfaW5mbyhfX3N0YWNrKSk7IH0KKyAgCisgICAgdm9pZAorICAgIF9fZGVzdHJ1Y3QoY29uc3Qgdm9pZCogX19vYmopCisgICAgeworICAgICAgaWYgKCFfX2lzX29uKCkpCisJcmV0dXJuOworCisgICAgICBfX2xpc3Qyc2xpc3RfaW5mbyogX19yZXMgPSBfX2dldF9vYmplY3RfaW5mbyhfX29iaik7CisgICAgICBpZiAoIV9fcmVzKQorCXJldHVybjsKKworICAgICAgX19yZXRpcmVfb2JqZWN0KF9fb2JqKTsKKyAgICB9CisgIH07CisKK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orICAgIHN0ZDo6c2l6ZV90CisgICAgX19pdGVyYXRlKCkKKyAgICB7IHJldHVybiBfTV9pdGVyYXRlOyB9CisgIAorICAgIGZsb2F0CisgICAgX19saXN0X2Nvc3QoKQorICAgIHsgcmV0dXJuIF9NX2xpc3RfY29zdDsgfQorICAKKyAgICBzdGQ6OnNpemVfdAorICAgIF9fcmVzaXplKCkKKyAgICB7IHJldHVybiBfTV9yZXNpemU7IH0KKyAgCisgICAgdm9pZAorICAgIF9fc2V0X2xpc3RfY29zdChmbG9hdCBfX2xjKQorICAgIHsgX01fbGlzdF9jb3N0ID0gX19sYzsgfQorICAgIAorICAgIHZvaWQKKyAgICBfX3NldF92ZWN0b3JfY29zdChmbG9hdCBfX3ZjKQorICAgIHsgX01fdmVjdG9yX2Nvc3QgPSBfX3ZjOyB9CisgICAgCisgICAgYm9vbAorICAgIF9faXNfdmFsaWQoKQorICAgIHsgcmV0dXJuIF9NX3ZhbGlkOyB9CisgICAgCisgICAgdm9pZAorICAgIF9fc2V0X2ludmFsaWQoKQorICAgIHsgX01fdmFsaWQgPSBmYWxzZTsgfQorCisgICAgdm9pZAorICAgIF9fb3ByX2luc2VydChzdGQ6OnNpemVfdCBfX3NoaWZ0LCBzdGQ6OnNpemVfdCBfX3NpemUpCisgICAgeworICAgICAgX01fc2hpZnRfY291bnQgKz0gX19zaGlmdDsKKyAgICAgIF9NX21heF9zaXplID0gc3RkOjptYXgoX01fbWF4X3NpemUsIF9fc2l6ZSk7CisgICAgfQorCisgICAgdm9pZAorICAgIF9fb3ByX2l0ZXJhdGUoc3RkOjpzaXplX3QgX19udW0pCisgICAgeyBfTV9pdGVyYXRlICs9IF9fbnVtO30KKworICAgIHZvaWQKKyAgICBfX3Jlc2l6ZShzdGQ6OnNpemVfdCBfX2Zyb20sIHN0ZDo6c2l6ZV90KQorICAgIHsgX01fcmVzaXplICs9IF9fZnJvbTsgfQorCisgIHByaXZhdGU6CisgICAgc3RkOjpzaXplX3QgX01fc2hpZnRf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GljIF9fb2JqZWN0X2luZm9fYmFzZQorICB7CisgIHB1YmxpYzoKKyAgICBfX21hcDJ1bWFwX2luZm8oKQorICAgIDogX01faW5zZXJ0KDApLCBfTV9lcmFzZSgwKSwgX01fZmluZCgwKSwgX01faXRlcmF0ZSgwKSwKKyAgICAgIF9NX3VtYXBfY29zdCgwLjApLCBfTV9tYXBfY29zdCgwLjApLCBfTV92YWxpZCh0cnVlKSB7IH0KKyAgICAKKyAgICBfX21hcDJ1bWFwX2luZm8oX19zdGFja190IF9fc3RhY2spCisgICAgOiBfX29iamVjdF9pbmZvX2Jhc2UoX19zdGFjayksIF9NX2luc2VydCgwKSwgX01fZXJhc2UoMCksIF9NX2ZpbmQoMCksIAorICAgICAgX01faXRlcmF0ZSgwKSwgX01fdW1hcF9jb3N0KDAuMCksIF9NX21hcF9jb3N0KDAuMCksIF9NX3ZhbGlkKHRydWUpIHsgfQorCisgICAgdmlydHVhbCB+X19tYXAydW1hcF9pbmZvKCkgeyB9CisKKyAgICBfX21hcDJ1bWFwX2luZm8oY29uc3QgX19tYXAydW1hcF9pbmZvJiBfX28pCisgICAgOiBfX29iamVjdF9pbmZvX2Jhc2UoX19vKSwgX01faW5zZXJ0KF9fby5fTV9pbnNlcnQpLAorICAgICAgX01fZXJhc2UoX19vLl9NX2VyYXNlKSwgX01fZmluZChfX28uX01fZmluZCksCisgICAgICBfTV9pdGVyYXRlKF9fby5fTV9pdGVyYXRlKSwgX01fdW1hcF9jb3N0KF9fby5fTV91bWFwX2Nvc3QpLAorICAgICAgX01fbWFwX2Nvc3QoX19vLl9NX21hcF9jb3N0KSwgX01fdmFsaWQoX19vLl9NX3ZhbGlkKSB7IH0KKworICAgIHZvaWQKKyAgICBfX21lcmdlKGNvbnN0IF9fbWFwMnVtYXBfaW5mbyYgX19vKQorICAgIHsKKyAgICAgIF9NX2luc2VydCAgICArPSBfX28uX01faW5zZXJ0OworICAgICAgX01fZXJhc2UgICAgICs9IF9fby5fTV9lcmFzZTsKKy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AgICB9CisKKyAgICB2b2lkCisgICAgX19yZWNvcmRfZXJhc2Uoc3RkOjpzaXplX3QgX19zaXplLCBzdGQ6OnNpemVfdCBfX2NvdW50KQorICAgIHsKKyAgICAgIF9NX2VyYXNlICs9IF9fY291bnQ7CisgICAgICBfTV9tYXBfY29zdCArPSBfX2NvdW50ICogX19tYXBfZXJhc2VfY29zdChfX3NpemUpOworICAgICAgX01fdW1hcF9jb3N0CisJKz0gKF9fY291bnQKKwkgICAgKiBfR0xJQkNYWF9QUk9GSUxFX0RBVEEoX191bWFwX2VyYXNlX2Nvc3RfZmFjdG9yKS5fX3ZhbHVlKTsKKyAgICB9CisKKyAgICB2b2lkCisgICAgX19yZWNvcmRfZmluZChzdGQ6OnNpemVfdCBfX3NpemUpCisgICAgeworICAgICAgX01fZmluZCArPSAxOworICAgICAgX01fbWFwX2Nvc3QgKz0gX19tYXBfZmluZF9jb3N0KF9fc2l6ZSk7CisgICAgICBfTV91bWFwX2Nvc3QgKz0gX0dMSUJDWFhfUFJPRklMRV9EQVRBKF9fdW1hcF9maW5kX2Nvc3RfZmFjdG9yKS5fX3ZhbHVlOworICAgIH0KKworICAgIHZvaWQKKyAgICBfX3JlY29yZF9pdGVyYXRlKHN0ZDo6c2l6ZV90IF9fY291bnQpCisgICAgeworICAgICAgX01faXRlcmF0ZSArPSBfX2NvdW50OworICAgICAgX01fbWFwX2Nvc3QKKwkrPSAoX19jb3VudAorCSAgICAqIF9HTElCQ1hYX1BST0ZJTEVfREFUQShfX21hcF9pdGVyYXRlX2Nvc3RfZmFjdG9yKS5fX3ZhbHVlKTsKKyAgICAgIF9NX3VtYXBfY29zdAorCSs9IChfX2NvdW50CisJICAgICogX0dMSUJDWFhfUFJPRklMRV9EQVRBKF9fdW1hcF9pdGVyYXRlX2Nvc3RfZmFjdG9yKS5fX3ZhbHVlKTsKKyAgICB9CisKKyAgICB2b2lkCisgICAgX19yZWNvcmRfaW52YWxpZGF0ZSgpCisgICAgeyBfTV92YWxpZC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FjZV9tYXBfdG9fdW5vcmRlcmVkX21hcF9pbnNlcnQoY29uc3Qgdm9pZCogX19vYmosIAorCQkJCSAgICAgIHN0ZDo6c2l6ZV90IF9fc2l6ZSwgc3RkOjpzaXplX3QgX19jb3VudCkKKyAgeworICAgIGlmICghX19wcm9mY3h4X2luaXQoKSkKKyAgICAgIHJldHVybjsKKworICAgIF9fbWFwMnVtYXBfaW5mbyogX19pbmZvCisgICAgICA9IF9HTElCQ1hYX1BST0ZJTEVfREFUQShfU19tYXAydW1hcCktPl9fZ2V0X29iamVjdF9pbmZvKF9fb2JqKTsKKworICAgIGlmIChfX2luZm8pCisgICAgICBfX2luZm8tPl9fcmVjb3JkX2luc2VydChfX3NpemUsIF9fY291bnQpOworICB9CisKKyAgaW5saW5lIHZvaWQKKyAgX190cmFjZV9tYXBfdG9fdW5vcmRlcmVkX21hcF9lcmFzZShjb25zdCB2b2lkKiBfX29iaiwgCisJCQkJICAgICBzdGQ6OnNpemVfdCBfX3NpemUsIHN0ZDo6c2l6ZV90IF9fY291bnQpCisgIHsKKyAgICBpZiAoIV9fcHJvZmN4eF9pbml0KCkpIAorICAgICAgcmV0dXJuOworCisgICAgX19tYXAydW1hcF9pbmZvKiBfX2luZm8gCisgICAgICA9IF9HTElCQ1hYX1BST0ZJTEVfREFUQShfU19tYXAydW1hcCktPl9fZ2V0X29iamVjdF9pbmZvKF9fb2JqKTsKKworICAgIGlmIChfX2luZm8pCisgICAgICBfX2luZm8tPl9fcmVjb3JkX2VyYXNlKF9fc2l6ZSwgX19jb3VudCk7CisgIH0KKworICBpbmxpbmUgdm9pZAorICBfX3RyYWNlX21hcF90b191bm9yZGVyZWRfbWFwX2ZpbmQoY29uc3Qgdm9pZCogX19vYmosIHN0ZDo6c2l6ZV90IF9fc2l6ZSkKKyAgeworICAgIGlmICghX19wcm9mY3h4X2luaXQoKSkKKyAgICAgIHJldHVybjsKKworICAgIF9fbWFwMnVtYXBfaW5mbyogX19pbmZvCisgICAgICA9IF9HTElCQ1hYX1BST0ZJTEVfREFUQShfU19tYXAydW1hcCktPl9fZ2V0X29iamVjdF9pbmZvKF9fb2JqKTsKKworICAgIGlmIChfX2luZm8pCisgICAgICBfX2luZm8tPl9fcmVjb3JkX2ZpbmQoX19zaXplKTsKKyAgfQorCisgIGlubGluZSB2b2lkCisgIF9fdHJhY2VfbWFwX3RvX3Vub3JkZXJlZF9tYXBfaXRlcmF0ZShjb25zdCB2b2lkKiBfX29iaiwgc3RkOjpzaXplX3QgX19jb3VudCkKKyAgeworICAgIGlmICghX19wcm9mY3h4X2luaXQoKSkKKyAgICAgIHJldHVybjsKKworICAgIF9fbWFwMnVtYXBfaW5mbyogX19pbmZvCisgICAgICA9IF9HTElCQ1hYX1BST0ZJTEVfREFUQShfU19tYXAydW1hcCktPl9fZ2V0X29iamVjdF9pbmZvKF9fb2JqKTsKKyAgICAKKyAgICBpZiAoX19pbmZvKQorICAgICAgX19pbmZvLT5fX3JlY29yZF9pdGVyYXRlKF9fY291bnQpOworICB9CisKKyAgaW5saW5lIHZvaWQKKyAgX190cmFjZV9tYXBfdG9fdW5vcmRlcmVkX21hcF9pbnZhbGlkYXRlKGNvbnN0IHZvaWQqIF9fb2JqKQorICB7CisgICAgaWYgKCFfX3Byb2ZjeHhfaW5pdCgpKQorICAgICAgcmV0dXJuOworCisgICAgX19tYXAydW1hcF9pbmZvKiBfX2luZm8KKyAgICAgID0gX0dMSUJDWFhfUFJPRklMRV9EQVRBKF9TX21hcDJ1bWFwKS0+X19nZXRfb2JqZWN0X2luZm8oX19vYmopOworCisgICAgaWYgKF9faW5mbykKKyAgICAgIF9faW5mby0+X19yZWNvcmRfaW52YWxpZGF0ZSgpOworICB9CisKK30gLy8gbmFtZXNwYWNlIF9fZ251X3Byb2ZpbGUKKyNlbmRpZiAvKiBfR0xJQkNYWF9QUk9GSUxFX1BST0ZJTEVSX01BUF9UT19VTk9SREVSRURfTUFQX0ggKi8KZGlmZiAtLWdpdCBhLzgvc291cmNlcy9je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aykKKyAgeworICAgIGlmICghX19zdGFjaykKKyAgICAgIHJldHVybiAwOworICAgIGVsc2UKKyAgICAgIHJldHVybiBfX3N0YWNrLT5zaXplKCk7CisgIH0KKworICAvLyBYWFgKKyAgaW5saW5lIHZvaWQKKyAgX193cml0ZShGSUxFKiBfX2YsIF9fc3RhY2tfdCBfX3N0YWNrKQorICB7CisgICAgaWYgKCFfX3N0YWNrKQorICAgICAgcmV0dXJuOworICAKKyAgICBfX3N0YWNrX25wdDo6Y29uc3RfaXRlcmF0b3IgX19pdDsKKyAgICBmb3IgKF9faXQgPSBfX3N0YWNrLT5iZWdpbigpOyBfX2l0ICE9IF9fc3RhY2stPmVuZCgpOyArK19faXQpCisgICAgICBzdGQ6OmZwcmludGYoX19mLCAiJXAgIiwgKl9faXQpOworICB9CisKKyAgLyoqIEBicmllZiBIYXNoIGZ1bmN0aW9uIGZvciBzdW1tYXJ5IHRyYWNlIHVzaW5nIGNhbGwgc3RhY2sgYXMgaW5kZXguICAqLworICBjbGFzcyBfX3N0YWNrX2hhc2ggCisgIHsKKyAgcHVibGljOgorICAgIHN0ZDo6c2l6ZV90CisgICAgb3BlcmF0b3IoKShfX3N0YWNrX3QgX19zKSBjb25zdAorICAgIHsKKyAgICAgIGlmICghX19zKSAKKwlyZXR1cm4gMDsKKworICAgICAgc3RkOjpzaXplX3QgX19pbmRleCA9IDA7CisgICAgICBfX3N0YWNrX25wdDo6Y29uc3RfaXRlcmF0b3IgX19pdDsKKyAgICAgIGZvciAoX19pdCA9IF9fcy0+YmVnaW4oKTsgX19pdCAhPSBfX3MtPmVuZCgpOyArK19faXQpCisJX19pbmRleCArPSByZWludGVycHJldF9jYXN0PHN0ZDo6c2l6ZV90PigqX19pdCk7CisgICAgICByZXR1cm4gX19pbmRleDsKKyAgICB9CisKKyAgICBib29sIG9wZXJhdG9yKCkgKF9fc3RhY2tfdCBfX3N0YWNrMSwgX19zdGFja190IF9fc3RhY2syKSBjb25zdAorICAgIHsKKyAgICAgIG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2lkIF9fcmV0aXJlX29iamVjdChfX29iamVjdF90IF9fb2JqZWN0KTsKKyAgICAgIHZvaWQgX193cml0ZShGSUxFKiBfX2YpOworICAgICAgdm9pZCBfX2NvbGxlY3Rfd2FybmluZ3MoX193YXJuaW5nX3ZlY3Rvcl90JiBfX3dhcm5pbmdzKTsKKworICAgIHByaXZhdGU6CisgICAgICBfX2dudV9jeHg6Ol9fbXV0ZXggX19vYmplY3RfdGFibGVfbG9jazsKKyAgICAgIF9fZ251X2N4eDo6X19tdXRleCBfX3N0YWNrX3RhYmxlX2xvY2s7CisgICAgICB0eXBlZGVmIF9HTElCQ1hYX0lNUExfVU5PUkRFUkVEX01BUDxfX29iamVjdF90LCAKKwkJCQkJICBfX29iamVjdF9pbmZvPiBfX29iamVjdF90YWJsZV90OworICAgICAgdHlwZWRlZiBfR0xJQkNYWF9JTVBMX1VOT1JERVJFRF9NQVA8X19zdGFja190LCBfX3N0YWNrX2luZm8sCisJCQkJCSAgX19zdGFja19oYXNoLCAKKwkJCQkJICBfX3N0YWNrX2hhc2g+IF9fc3RhY2tfdGFibGVfdDsKKyAgICAgIF9fb2JqZWN0X3RhYmxlX3QgX19vYmplY3RfdGFibGU7CisgICAgICBfX3N0YWNrX3RhYmxlX3QgX19zdGFja190YWJsZTsKKyAgICAgIHN0ZDo6c2l6ZV90IF9fc3RhY2tfdGFibGVfYnl0ZV9zaXplOworCisgICAgcHJvdGVjdGVkOgorICAgICAgY29uc3QgY2hhciogX19pZDsKKyAgICB9OworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9fb2JqZWN0X2luZm8sIHR5cGVuYW1lIF9fc3RhY2tfaW5mbz4KKyAgICB2b2lkCisgICAgX190cmFjZV9iYXNlPF9fb2JqZWN0X2luZm8sIF9fc3RhY2tfaW5mbz46OgorICAgIF9fY29sbGVjdF93YXJuaW5ncyhfX3dhcm5pbmdfdmVjdG9yX3QmIF9fd2FybmluZ3MpCisgICAgeworICAgICAgZm9yICh0eXBlbmFtZ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0YWNrX2luZm8+OjoKKyAgICBfX2dldF9vYmplY3RfaW5mbyhfX29iamVjdF90IF9fb2JqZWN0KQorICAgIHsKKyAgICAgIC8vIFhYWDogUmV2aXNpdCB0aGlzIHRvIHNlZSBpZiB3ZSBjYW4gZGVjcmVhc2UgbXV0ZXggc3BhbnMuCisgICAgICAvLyBXaXRob3V0IHRoaXMgbXV0ZXgsIHRoZSBvYmplY3QgdGFibGUgY291bGQgYmUgcmVoYXNoZWQgZHVyaW5nIGFuCisgICAgICAvLyBpbnNlcnRpb24gb24gYW5vdGhlciB0aHJlYWQsIHdoaWNoIGNvdWxkIHJlc3VsdCBpbiBhIHNlZ2ZhdWx0LgorICAgICAgdGhpcy0+X19vYmplY3RfdGFibGVfbG9jay5sb2NrKCk7CisgICAgICB0eXBlbmFtZSBfX29iamVjdF90YWJsZV90OjppdGVyYXRvciBfX29iamVjdF9pdAorCT0gIF9fb2JqZWN0X3RhYmxlLmZpbmQoX19vYmplY3QpOworCisgICAgICBpZiAoX19vYmplY3RfaXQgPT0gX19vYmplY3RfdGFibGUuZW5kKCkpCisJeworCSAgdGhpcy0+X19vYmplY3RfdGFibGVfbG9jay51bmxvY2soKTsKKwkgIHJldHVybiAwOworCX0KKyAgICAgIGVsc2UKKwl7CisJICB0aGlzLT5fX29iamVjdF90YWJsZV9sb2NrLnVubG9jaygpOworCSAgcmV0dXJuICZfX29iamVjdF9pdC0+c2Vjb25kOworCX0KKyAgICB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX19vYmplY3RfaW5mbywgdHlwZW5hbWUgX19zdGFja19pbmZvPgorICAgIHZvaWQKKyAgICBfX3RyYWNlX2Jhc2U8X19vYmplY3RfaW5mbywgX19zdGFja19pbmZvPjo6CisgICAgX19yZXRpcmVfb2JqZWN0KF9fb2JqZWN0X3QgX19vYmplY3QpCisgICAgeworICAgICAgdGhpcy0+X19vYmplY3RfdGFibGVfbG9jay5sb2NrKCk7CisgICAgICB0aGlzLT5fX3N0YWNrX3RhYmxlX2xvY2subG9jaygpOworICAgICAgdHlwZW5hbWUgX19vYmplY3RfdGFibGVfdDo6aXRlcmF0b3IgX19vYmplY3RfaXQKKwk9IF9fb2JqZWN0X3RhYmxlLmZpbmQoX19vYmplY3QpOworICAKKyAgICAgIGlmIChfX29iamVjdF9pdCAhPSBfX29iamVjdF90YWJsZS5lbmQoKSkKKwl7CisJICBjb25zdCBfX29iamVjdF9pbmZvJiBfX2luZm8gPSBfX29iamVjdF9pdC0+c2Vjb25kOworCSAgY29uc3QgX19zdGFja190JiBfX3N0YWNrID0gX19pbmZvLl9fc3RhY2soKTsKKwkgIHR5cGVuYW1lIF9fc3RhY2tfdGFibGVfdDo6aXRlcmF0b3IgX19zdGFja19pdAorCSAgICA9IF9fc3RhY2tfdGFibGUuZmluZChfX3N0YWNrKTsKKyAgICAKKwkgIGlmIChfX3N0YWNrX2l0ID09IF9fc3RhY2tfdGFibGUuZW5kKCkpCisJICAgIHsKKwkgICAgICAvLyBGaXJzdCBvY2N1cmVuY2Ugb2YgdGhpcyBjYWxsIGNvbnRleHQuCisJICAgICAgaWYgKF9fbWF4X21lbSgpID09IDAgfHwgX19zdGFja190YWJsZV9ieXRlX3NpemUgPCBfX21heF9tZW0oKSkgCisJCXsKKwkJICBfX3N0YWNrX3RhYmxlX2J5dGVfc2l6ZSAKKwkJICAgICs9IChzaXplb2YoX19pbnN0cnVjdGlvbl9hZGRyZXNzX3QpICogX19zaXplKF9fc3RhY2spCisJCQkrIHNpemVvZihfX3N0YWNrKSArIHNpemVvZihfX3N0YWNrX2luZm8pKTsKKwkJICBfX3N0YWNrX3RhYmxlLmluc2VydChtYWtlX3BhaXIoX19zdGFjaywKKwkJCQkJCSBfX3N0YWNrX2luZm8oX19pbmZvKSkpOworCQl9CisJICAgIH0KKwkgIGVsc2UKKwkgICAgeworCSAgICAgIC8vIE1lcmdlIG9iamVjdCBpbmZvIGludG8gaW5mbyBzdW1tYXJ5IGZvciB0aGlzIGNhbGwgY29udGV4dC4KKwkgICAgICBfX3N0YWNrX2l0LT5zZWNvbmQuX19tZXJnZShfX2luZm8pOworCSAgICAgIGRlbGV0ZSBfX3N0YWNrOworCSAgICB9CisJICBfX29iamVjdF90YWJsZS5lcmFzZShfX29iamVjdCk7CisJfQorCisgICAgICB0aGlzLT5fX29iamVjdF90YWJsZV9sb2NrLnVubG9jaygpOworICAgICAgdGhpcy0+X19zdGFja190YWJsZV9sb2NrLnVubG9jaygpOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfX29iamVjdF9pbmZvLCB0eXBlbmFtZSBfX3N0YWNrX2luZm8+CisgICAgdm9pZAorICAgIF9fdHJhY2VfYmFzZTxfX29iamVjdF9pbmZvLCBfX3N0YWNrX2luZm8+OjoKKyAgICBfX3dyaXRlKEZJTEUqIF9fZikKKyAgICB7CisgICAgICBmb3IgKHR5cGVuYW1lIF9fc3RhY2tfdGFibGVfdDo6aXRlcmF0b3IgX19pdAorCSAgICAgPSBfX3N0YWNrX3RhYmxlLmJlZ2luKCk7IF9faXQgIT0gX19zdGFja190YWJsZS5lbmQoKTsgKytfX2l0KQorCWlmIChfX2l0LT5zZWNvbmQuX19pc192YWxpZCgpKQorCSAgeworCSAgICBzdGQ6OmZwcmludGYoX19mLCBfX2lkKTsKKwkgICAgc3RkOjpmcHJpbnRmKF9fZiwgInwiKTsKKwkgICAgX19nbnVfcHJvZmlsZTo6X193cml0ZShfX2YsIF9faXQtPmZpcnN0KTsKKwkgICAgc3RkOjpmcHJpbnRmKF9fZiwgInwiKTsKKwkgICAgX19pdC0+c2Vjb25kLl9fd3JpdGUoX19mKTsKKwkgIH0KKyAgICB9CisKKyAgaW5saW5lIHN0ZDo6c2l6ZV90CisgIF9fZW52X3RvX3NpemVfdChjb25zdCBjaGFyKiBfX2Vudl92YXIsIHN0ZDo6c2l6ZV90IF9fZGVmYXVsdF92YWx1ZSkKKyAgeworICAgIGNoYXIqIF9fZW52X3ZhbHVlID0gc3RkOjpnZXRlbnY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Nvc3QgPSBfX2xjOyB9CisgICAgCisgICAgdm9pZAorICAgIF9fc2V0X3ZlY3Rvcl9jb3N0KGZsb2F0IF9fdmMpCisgICAgeyBfTV92ZWN0b3JfY29zdCA9IF9fdmM7IH0KKyAgICAKKyAgICBib29sCisgICAgX19pc192YWxpZCgpCisgICAgeyByZXR1cm4gX01fdmFsaWQ7IH0KKyAgICAKKyAgICB2b2lkCisgICAgX19zZXRfaW52YWxpZCgpCisgICAgeyBfTV92YWxpZCA9IGZhbHNlOyB9CisKKyAgICB2b2lkCisgICAgX19vcHJfaW5zZXJ0KHN0ZDo6c2l6ZV90IF9fcG9zLCBzdGQ6OnNpemVfdCBfX251bSkKKyAgICB7IF9NX3NoaWZ0X2NvdW50ICs9IF9fbnVtIC0gX19wb3M7IH0KKworICAgIHZvaWQKKyAgICBfX29wcl9pdGVyYXRlKHN0ZDo6c2l6ZV90IF9fbnVtKQorICAgIHsgX01faXRlcmF0ZSArPSBfX251bTsgfQorCisgICAgdm9pZAorICAgIF9fcmVzaXplKHN0ZDo6c2l6ZV90IF9fZnJvbSwgc3RkOjpzaXplX3QpCisgICAgeyBfTV9yZXNpemUgKz0gX19mcm9tOyB9CisKKyAgICB2b2lkCisgICAgX19vcHJfZmluZChzdGQ6OnNpemVfdCBfX3NpemUpCisgICAgeworICAgICAgLy8gVXNlIGF2ZXJhZ2UgY2FzZSBjb21wbGV4aXR5LgorICAgICAgX01faXRlcmF0ZSArPSAzLjAgLyA0LjAgKiBfX3NpemU7CisgICAgfQorCisgIHByaXZhdGU6CisgICAgc3RkOjpzaXplX3QgX01fc2hpZnRfY291bnQ7CisgICAgc3RkOjpzaXplX3QgX01faXRlcmF0ZTsKKyAgICBzdGQ6OnNpemVfdCBfTV9yZXNpemU7CisgICAgZmxvYXQgX01fbGlzdF9jb3N0OworICAgIGZsb2F0IF9NX3ZlY3Rvcl9jb3N0OworICAgIGJvb2wgIF9NX3ZhbGlkOworICB9OworCisKKyAgLyoqIEBicmllZiBBI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AgICAgIF9faXRlcmF0b3JfdHJhY2tlciYKKyAgICAgIG9wZXJhdG9yLS0oKQorICAgICAgeworCV9NX2RzLT5fTV9wcm9maWxlX2l0ZXJhdGUoMSk7CisJLS1fTV9jdXJyZW50OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgX19pdGVyYXRvcl90cmFja2VyJgorICAgICAgb3BlcmF0b3ItLShpbnQpCisgICAgICB7CisJX01fZHMtPl9NX3Byb2ZpbGVfaXRlcmF0ZSgxKTsKKwlfX2l0ZXJhdG9yX3RyYWNrZXIgX190bXAoKnRoaXMpOworCS0tX01fY3VycmVudDsKKwlyZXR1cm4gX190bXA7CisgICAgICB9CisKKyAgICAgIF9faXRlcmF0b3JfdHJhY2tlciYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfX2l0ZXJhdG9yX3RyYWNrZXImIF9feCkKKyAgICAgIHsKKwlfTV9jdXJyZW50ID0gX194Ll9NX2N1cnJlbnQ7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0CisgICAgICB7IHJldHVybiAqX01fY3VycmVudDsgfQorCisgICAgICAvLyAtLS0tLS0gUmFuZG9tIGFjY2VzcyBpdGVyYXRvciByZXF1aXJlbWVudHMgLS0tLS0tCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oY29uc3QgZGlmZmVyZW5jZV90eXBlJiBfX24pIGNvbnN0IAorICAgICAgeyByZXR1cm4gX01fY3VycmVudFtfX25dOyB9CisKKyAgICAgIF9faXRlcmF0b3JfdHJhY2tlciYKKyAgICAgIG9wZXJhdG9yKz0oY29uc3QgZGlmZmVyZW5jZV90eXBlJiBfX24pCisgICAgICB7CisJX01fY3VycmVudCArPSBfX247CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBfX2l0ZXJhdG9yX3RyYWNrZXIKKyAgICAgIG9wZXJhdG9yKyhjb25zdCBk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cGxpY2l0CisgICAgICBsaXN0KHNpemVfdHlwZSBfX24pCisgICAgICA6IF9CYXNlKF9fbikgCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9saXN0X2NvbnN0cnVjdCh0aGlzKTsgCisgICAgICAgIF9fcHJvZmN4eF9saXN0X2NvbnN0cnVjdDIodGhpcyk7IAorICAgICAgfQorCisgICAgICBsaXN0KHNpemVfdHlwZSBfX24sIGNvbnN0IF9UcCYgX192YWx1ZSwKKwkgICBjb25zdCBfQWxsb2NhdG9yJiBfX2EgPSBfQWxsb2NhdG9yKCkpCisgICAgICA6IF9CYXNlKF9fbiwgX192YWx1ZSwgX19hKSAKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2xpc3RfY29uc3RydWN0KHRoaXMpOyAKKyAgICAgICAgX19wcm9mY3h4X2xpc3RfY29uc3RydWN0Mih0aGlzKTsgCisgICAgICB9CisjZWxzZQorICAgICAgZXhwbGljaXQKKyAgICAgIGxpc3Qoc2l6ZV90eXBlIF9fbiwgY29uc3QgX1RwJiBfX3ZhbHVlID0gX1RwKCksCisJICAgY29uc3QgX0FsbG9jYXRvciYgX19hID0gX0FsbG9jYXRvcigpKQorICAgICAgOiBfQmFzZShfX24sIF9fdmFsdWUsIF9fYSkgCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9saXN0X2NvbnN0cnVjdCh0aGlzKTsgCisgICAgICAgIF9fcHJvZmN4eF9saXN0X2NvbnN0cnVjdDIodGhpcyk7IAorICAgICAgfQorI2VuZGlmCisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgbGlzdChfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QsCisJICAgY29uc3QgX0FsbG9jYXRvciYgX19hID0gX0FsbG9jYXRvcigpKQorICAgICAgOiBfQmFzZShfX2ZpcnN0LCBfX2xhc3QsIF9fYSkKKyAgICAgIHsKKyAg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wYWNpdHk6CisgICAgICB1c2luZyBfQmFzZTo6ZW1wdHk7CisgICAgICB1c2luZyBfQmFzZTo6c2l6ZTsKKyAgICAgIHVzaW5nIF9CYXNlOjptYXhfc2l6ZTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9fc3opCisgICAgICB7IF9CYXNlOjpyZXNpemUoX19zeik7IH0KKworICAgICAgdm9pZAorICAgICAgcmVzaXplKHNpemVfdHlwZSBfX3N6LCBjb25zdCBfVHAmIF9fYykKKyAgICAgIHsgX0Jhc2U6OnJlc2l6ZShfX3N6LCBfX2MpOyB9CisjZWxzZQorICAgICAgdm9pZAorICAgICAgcmVzaXplKHNpemVfdHlwZSBfX3N6LCBfVHAgX19jID0gX1RwKCkpCisgICAgICB7IF9CYXNlOjpyZXNpemUoX19zeiwgX19jKTsgfQorI2VuZGlmCisKKyAgICAgIC8vIGVsZW1lbnQgYWNjZXNzOgorICAgICAgcmVmZXJlbmNlCisgICAgICBmcm9udCgpCisgICAgICB7IHJldHVybiBfQmFzZTo6ZnJvbnQoKTsgfQorCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9CYXNlOjpmcm9udCgpOyB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgYmFjaygpCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9saXN0X3Jld2luZCh0aGlzKTsKKwlyZXR1cm4gX0Jhc2U6OmJhY2soKTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBiYWNrKCkgY29uc3QKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2xpc3RfcmV3aW5kKHRoaXMpOworCXJldHVybiBfQmFzZTo6YmFjaygpOworICAgICAgfQorCisgICAgICAvLyAyMy4yLjIuMyBtb2RpZmllcnM6CisgICAg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24uYmFzZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGQ6OmZvcndhcmQ8X0FyZ3M+KF9fYXJncykuLi4pKTsKKwl9CisjZW5kaWYKKworICAgICAgaXRlcmF0b3IKKyAgICAgIGluc2VydChpdGVyYXRvciBfX3Bvc2l0aW9uLCBjb25zdCBfVHAmIF9feCkKKyAgICAgIHsKKyAgICAgICAgX01fcHJvZmlsZV9pbnNlcnQodGhpcywgX19wb3NpdGlvbiwgc2l6ZSgpKTsKKyAgICAgICAgcmV0dXJuIGl0ZXJhdG9yKF9CYXNlOjppbnNlcnQoX19wb3NpdGlvbi5iYXNlKCksIF9feCksIHRoaXMpOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoaXRlcmF0b3IgX19wb3NpdGlvbiwgX1RwJiYgX194KQorICAgICAgeyAKKyAgICAgICAgX01fcHJvZmlsZV9pbnNlcnQodGhpcywgX19wb3NpdGlvbiwgc2l6ZSgpKTsKKyAgICAgICAgcmV0dXJuIGl0ZXJhdG9yKF9CYXNlOjplbXBsYWNlKF9fcG9zaXRpb24uYmFzZSgpLCBzdGQ6Om1vdmUoX194KSksCisgICAgICAgICAgICAgICAgICAgICAgICB0aGlzKTsgCisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIGluc2VydChpdGVyYXRvciBfX3Bvc2l0aW9uLCBpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCkKKyAgICAgIHsKKyAgICAgICAgX01fcHJvZmlsZV9pbnNlcnQodGhpcywgX19wb3NpdGlvbiwgc2l6ZSgpKTsKKyAgICAgICAgX0Jhc2U6Omluc2VydChfX3Bvc2l0aW9uLmJhc2UoKSwgX19sKTsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICB2b2lkCisgICAgICBpbnNlcnQoaXRlcmF0b3IgX19wb3NpdGl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XRlcmF0b3IgX19uZXh0ID0gX19maXJzdDsKKwl3aGlsZSAoKytfX25leHQgIT0gX19sYXN0KQorCSAgeworICAgICAgICAgICAgX19wcm9mY3h4X2xpc3Rfb3BlcmF0aW9uKHRoaXMpOworCSAgICBpZiAoKl9fZmlyc3QgPT0gKl9fbmV4dCkKKwkgICAgICBlcmFzZShfX25leHQpOworCSAgICBlbHNlCisJICAgICAgX19maXJzdCA9IF9fbmV4dDsKKwkgICAgX19uZXh0ID0gX19maXJzdDsKKwkgIH0KKyAgICAgIH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0JpbmFyeVByZWRpY2F0ZT4KKyAgICAgICAgdm9pZAorICAgICAgICB1bmlxdWUoX0JpbmFyeVByZWRpY2F0ZSBfX2JpbmFyeV9wcmVkKQorICAgICAgICB7CisJICBpdGVyYXRvciBfX2ZpcnN0ID0gYmVnaW4oKTsKKwkgIGl0ZXJhdG9yIF9fbGFzdCA9IGVuZCgpOworCSAgaWYgKF9fZmlyc3QgPT0gX19sYXN0KQorCSAgICByZXR1cm47CisJICBpdGVyYXRvciBfX25leHQgPSBfX2ZpcnN0OworCSAgd2hpbGUgKCsrX19uZXh0ICE9IF9fbGFzdCkKKwkgICAgeworICAgICAgICAgICAgICBfX3Byb2ZjeHhfbGlzdF9vcGVyYXRpb24odGhpcyk7CisJICAgICAgaWYgKF9fYmluYXJ5X3ByZWQoKl9fZmlyc3QsICpfX25leHQpKQorCQllcmFzZShfX25leHQpOworCSAgICAgIGVsc2UKKwkJX19maXJzdCA9IF9fbmV4dDsKKwkgICAgICBfX25leHQgPSBfX2ZpcnN0OworCSAgICB9CisJfQorCisgICAgICB2b2lkCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIG1lcmdlKGxpc3QmJiBfX3gpCisjZWxzZQorICAgICAgbWVyZ2UobGlzdCYgX194KQorI2VuZGlmCisgICAgICB7CisJLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJ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QmFzZTo6ZW5kKCk7IH0KKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGVuZCgpIGNvbnN0IF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHJldHVybiBfQmFzZTo6ZW5kKCk7IH0KKworICAgICAgcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgcmJlZ2luKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgCisgICAgICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9pbnZhbGlkYXRlKHRoaXMpOworICAgICAgICByZXR1cm4gcmV2ZXJzZV9pdGVyYXRvcihlbmQoKSk7IAorICAgICAgfQorCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICByYmVnaW4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfaW52YWxpZGF0ZSh0aGlzKTsKKyAgICAgICAgcmV0dXJuIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IoZW5kKCkpOworICAgICAgfQorCisgICAgICByZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2ludmFsaWRhdGUodGhpcyk7CisgICAgICAgIHJldHVybiByZXZlcnNlX2l0ZXJhdG9yKGJlZ2luKCkpOworICAgICAgfQorCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICByZW5kKCkgY29uc3QgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2ludmFsaWRhdGUodGhpcyk7CisgICAgICAgIHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKGJlZ2luKCkpOworICAgIC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ICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9maW5kKHRoaXMsIHNpemUoKSk7CisgICAgICAgIHJldHVybiBfQmFzZTo6b3BlcmF0b3JbXShfX2spOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIG1hcHBlZF90eXBlJgorICAgICAgb3BlcmF0b3JbXShrZXlfdHlwZSYmIF9faykKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2ZpbmQodGhpcywgc2l6ZSgpKTsKKyAgICAgICAgcmV0dXJuIF9CYXNlOjpvcGVyYXRvcltdKHN0ZDo6bW92ZShfX2spKTsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICBtYXBwZWRfdHlwZSYKKyAgICAgIGF0KGNvbnN0IGtleV90eXBlJiBfX2spCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9maW5kKHRoaXMsIHNpemUoKSk7CisgICAgICAgIHJldHVybiBfQmFzZTo6YXQoX19rKTsKKyAgICAgIH0KKworICAgICAgY29uc3QgbWFwcGVkX3R5cGUmCisgICAgICBhdChjb25zdCBrZXlfdHlwZSYgX19rKSBjb25zdAorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfZmluZCh0aGlzLCBzaXplKCkpOworICAgICAgICByZXR1cm4gX0Jhc2U6OmF0KF9fayk7CisgICAgICB9CisKKyAgICAgIC8vIG1vZGlmaWVyczoKKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgYm9vbD4KKyAgICAgIGluc2VydChjb25zdCB2YWx1ZV90eXBlJiBfX3gpCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9pbnNlcnQodGhpcywgc2l6ZSgpLCAxKTsKKwl0eXBlZGVmIHR5cGV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pID0gX0Jhc2U6OmVyYXNlKF9fcG9zaXRpb24pOworICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfZXJhc2UodGhpcywgc2l6ZSgpLCAxKTsKKyAgICAgICAgcmV0dXJuIF9faTsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGVyYXNlKGl0ZXJhdG9yIF9fcG9zaXRpb24pCisgICAgICB7IHJldHVybiBlcmFzZShjb25zdF9pdGVyYXRvcihfX3Bvc2l0aW9uKSk7IH0KKyNlbHNlCisgICAgICB2b2lkCisgICAgICBlcmFzZShpdGVyYXRvciBfX3Bvc2l0aW9uKQorICAgICAgeworCV9CYXNlOjplcmFzZShfX3Bvc2l0aW9uKTsKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2VyYXNlKHRoaXMsIHNpemUoKSwgMSk7CisgICAgICB9CisjZW5kaWYKKworICAgICAgc2l6ZV90eXBlCisgICAgICBlcmFzZShjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeworCWl0ZXJhdG9yIF9fdmljdGltID0gZmluZChfX3gpOworCWlmIChfX3ZpY3RpbSA9PSBlbmQoKSkKKwkgIHJldHVybiAwOworCWVsc2UKKwl7CisJICBfQmFzZTo6ZXJhc2UoX192aWN0aW0pOworCSAgcmV0dXJuIDE7CisJfQorICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIGl0ZXJhdG9yCisgICAgICBlcmFzZShjb25zdF9pdGVyYXRvciBfX2ZpcnN0LCBjb25zdF9pdGVyYXRvciBfX2xhc3QpCisgICAgICB7IHJldHVybiBpdGVyYXRvcihfQmFzZTo6ZXJhc2UoX19maXJzdCwgX19sYXN0KSk7IH0KKyNlbHNlCisgICAgICB2b2lkCisgICAgICBlcmFzZShpdGVyYXRvciBfX2ZpcnN0LCBpdGVyYXRvciBfX2xhc3QpCisgICAgICB7IF9CYXNlOjplcmFzZShfX2ZpcnN0LCBfX2xhc3QpOyB9CisjZW5kaWYKKworICAgICAgdm9pZAorICAgICAgc3dhcChtYXAmIF9feCkKKyAgICAgIHsgX0Jhc2U6OnN3YXAoX194KTsgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7IHRoaXMtPmVyYXNlKGJlZ2luKCksIGVuZCgpKTsgfQorCisgICAgICAvLyBvYnNlcnZlcnM6CisgICAgICB1c2luZyBfQmFzZTo6a2V5X2NvbXA7CisgICAgICB1c2luZyBfQmFzZTo6dmFsdWVfY29tcDsKKworICAgICAgLy8gMjMuMy4xLjMgbWFwIG9wZXJhdGlvbnM6CisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfZmluZCh0aGlzLCBzaXplKCkpOworICAgICAgICByZXR1cm4gaXRlcmF0b3IoX0Jhc2U6OmZpbmQoX194KSk7CisgICAgICB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICBmaW5kKGNvbnN0IGtleV90eXBlJiBfX3gpIGNvbnN0CisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9maW5kKHRoaXMsIHNpemUoKSk7CisgICAgICAgIHJldHVybiBjb25zdF9pdGVyYXRvcihfQmFzZTo6ZmluZChfX3gpKTsKKyAgICAgIH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBjb3VudChjb25zdCBrZXlfdHlwZSYgX194KSBjb25zdAorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfZmluZCh0aGlzLCBzaXplKCkpOworICAgICAgICByZXR1cm4gX0Jhc2U6OmNvdW50KF9feCk7CisgICAgICB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBsb3dlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeyAKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2ludmFsaWRhdGUodGhpcyk7CisgICAgICAgIHJldHVybiBpdGVyYXRvcihfQmFzZTo6bG93ZXJfYm91bmQoX194KSk7IAorICAgICAgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgbG93ZXJfYm91bmQoY29uc3Qga2V5X3R5cGUmIF9feCkgY29uc3QKKyAgICAgIHsgCisgICAgICAgIF9fcHJvZmN4eF9tYXBfdG9fdW5vcmRlcmVkX21hcF9pbnZhbGlkYXRlKHRoaXMpOworICAgICAgICByZXR1cm4gY29uc3RfaXRlcmF0b3IoX0Jhc2U6Omxvd2VyX2JvdW5kKF9feCkpOyAKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIHVwcGVyX2JvdW5kKGNvbnN0IGtleV90eXBlJiBfX3gpCisgICAgICB7IAorICAgICAgICBfX3Byb2ZjeHhfbWFwX3RvX3Vub3JkZXJlZF9tYXBfaW52YWxpZGF0ZSh0aGlzKTsKKyAgICAgICAgcmV0dXJuIGl0ZXJhdG9yKF9CYXNlOjp1cHBlcl9ib3VuZChfX3gpKTsgCisgICAgICB9CisKKyAgICAgIGNvbnN0X2l0ZXJhdG9yCisgICAgICB1cHBlcl9ib3VuZChjb25zdCBrZXlfdHlwZSYgX194KSBjb25zdAorICAgICAgeyAKKyAgICAgICAgX19wcm9mY3h4X21hcF90b191bm9yZGVyZWRfbWFwX2ludmFsaWRhdGUodGhpcyk7CisgICAgICAgIHJldHVybiBjb25zdF9pdGVyYXRvcihfQmFzZTo6dXBwZXJfYm91bmQoX194KSk7IAorICAgICAgfQorCisgICAgICBzdGQ6OnBhaXI8aXRlcmF0b3IsaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfdHlwZSYgX194KQorICAgICAgeworCXR5cGVkZWYg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GQ6Om1vdmUoX194KSkKKyAgICAgIHsgfQorCisgICAgICBtdWx0aW1hcChpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCwKKwkgICAgICAgY29uc3QgX0NvbXBhcmUmIF9fYyA9IF9Db21wYXJlKCksCisJICAgICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2wsIF9fYywgX19hKSB7IH0KKyNlbmRpZgorCisgICAgICB+bXVsdGltYXAoKSBfR0xJQkNYWF9OT0VYQ0VQVCB7IH0KKworICAgICAgbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgbXVsdGltYXAmIF9feCkKKyAgICAgIHsKKwkqc3RhdGljX2Nhc3Q8X0Jhc2UqPih0aGlzKSA9IF9feDsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0obXVsdGltYXAmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPnN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIG11bHRpbWFwJgorICAgICAgb3BlcmF0b3I9KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sKQorICAgICAgeworCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+aW5zZXJ0KF9fbCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorI2VuZGlmCisKKyAgICAgIHVzaW5nIF9CYXNlOjpnZXRfYWxsb2NhdG9yOworCisgICAgICAvLyBpdGVyYXRvcnM6CisgICAgICBpdGVyYXRvcgorICAgICAgYmVnaW4oKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgey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VhDRVBUIHsgfQorCisgICAgICBzZXQmCisgICAgICBvcGVyYXRvcj0oY29uc3Qgc2V0JiBfX3gpCisgICAgICB7CisJKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3g7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisjaWZkZWYgX19HWFhfRVhQRVJJTUVOVEFMX0NYWDBYX18KKyAgICAgIHNldCYKKyAgICAgIG9wZXJhdG9yPShzZXQmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPnN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHNldCYKKyAgICAgIG9wZXJhdG9yPShpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCkKKyAgICAgIHsKKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPmluc2VydChfX2wpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyNlbmRpZgorCisgICAgICB1c2luZyBfQmFzZTo6Z2V0X2FsbG9jYXRvcjsKKworICAgICAgLy8gaXRlcmF0b3JzOgorICAgICAgaXRlcmF0b3IKKyAgICAgIGJlZ2luKCkgX0dMSUJDWFhfTk9FWENFUFQKKyAgICAgIHsgcmV0dXJuIGl0ZXJhdG9yKF9CYXNlOjpiZWdpbigpKTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgYmVnaW4oKSBjb25zdCBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gY29uc3RfaXRlcmF0b3IoX0Jhc2U6OmJlZ2luKCkpOyB9CisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBlbmQoKSBfR0xJQkNYWF9OT0VYQ0VQVAorICAgICAgeyByZXR1cm4gaXRlcmF0b3IoX0Jhc2U6OmVuZCgpKTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kK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ICAgICB1bm9yZGVyZWRfbWFwKGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sLAorCQkgICAgc2l6ZV90eXBlIF9fbiA9IDAsCisJCSAgICBjb25zdCBoYXNoZXImIF9faGYgPSBoYXNoZXIoKSwKKwkJICAgIGNvbnN0IGtleV9lcXVhbCYgX19lcWwgPSBrZXlfZXF1YWwoKSwKKwkJICAgIGNvbnN0IGFsbG9jYXRvcl90eXBlJiBfX2EgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfQmFzZShfX2wsIF9fbiwgX19oZiwgX19lcWwsIF9fYSkgeyB9CisKKyAgICAgIHVub3JkZXJlZF9tYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgdW5vcmRlcmVkX21hcCYgX194KQorICAgICAgeworCSpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX194OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX21hcCYKKyAgICAgIG9wZXJhdG9yPSh1bm9yZGVyZWRfbWFwJiYgX194KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCS8vIE5COiBEUiA2NzUuCisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5zd2FwKF9feCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbWFwJgorICAgICAgb3BlcmF0b3I9KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sKQorICAgICAgeworCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+aW5zZXJ0KF9fbCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB+dW5vcmRlcmVkX21hcCgpIG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfZGVzdHJ1Y3QodGhpcywgX0Jhc2U6OmJ1Y2tldF9jb3VudCgpLAorCQkJCSAgICAgX0Jhc2U6OnNpemU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VyZWRfbXVsdGltYXAmIF9feCkKKyAgICAgIDogX0Jhc2UoX194KQorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCkpOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAoY29uc3QgX0Jhc2UmIF9feCkKKyAgICAgIDogX0Jhc2UoX194KQorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCkpOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAodW5vcmRlcmVkX211bHRpbWFwJiYgX194KQorICAgICAgOiBfQmFzZShzdGQ6Om1vdmUoX194KSkKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2hhc2h0YWJsZV9jb25zdHJ1Y3QodGhpcywgX0Jhc2U6OmJ1Y2tldF9jb3VudCgpKTsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX211bHRpbWFwKGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sLAorCQkJIHNpemVfdHlwZSBfX24gPSAwLAorCQkJIGNvbnN0IGhhc2hlciYgX19oZiA9IGhhc2hlcigpLAorCQkJIGNvbnN0IGtleV9lcXVhbCYgX19lcWwgPSBrZXlfZXF1YWwoKSwKKwkJCSBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hID0gYWxsb2NhdG9yX3R5cGUoKSkKKyAgICAgIDogX0Jhc2UoX19sLCBfX24sIF9faGYsIF9fZXFsLCBfX2EpIHsgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0oY29uc3QgdW5vcmRlcmVkX211bHRpbWFwJiBfX3gpCisgICAgICB7CisJKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3g7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0odW5vcmRlcmVkX211bHRpbWFwJiYgX194KQorICAgICAgeworCS8vIE5COiBEUiAxMjA0LgorCS8vIE5COiBEUiA2NzUuCisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5zd2FwKF9feCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfbXVsdGltYXAmCisgICAgICBvcGVyYXRvcj0oaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wpCisgICAgICB7CisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5pbnNlcnQoX19sKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIH51bm9yZGVyZWRfbXVsdGltYXAoKSBub2V4Y2VwdAorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2Rlc3RydWN0KHRoaXMsIF9CYXNlOjpidWNrZXRfY291bnQoKSwgCisJCQkJICAgICBfQmFzZTo6c2l6ZSgpKTsKKyAgICAgICAgX01fcHJvZmlsZV9kZXN0cnVjdCgpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIG5vZXhjZXB0CisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfZGVzdHJ1Y3QodGhpcywgX0Jhc2U6OmJ1Y2tldF9jb3VudCgpLCAKKwkJCQkgICAgIF9CYXNlOjpzaXplKCkpOworICAgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCk7CisgICAgICAgIF9CYXNlOjpjbGVhcigpOworICAgICAgfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKwlpdGVyYXRvcgorCWVtcGxhY2UoX0FyZ3MmJi4uLiBfX2FyZ3MpCisJeworCSAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZ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9CYXNlOjpzd2FwKF9feCk7IH0KKworICAgICAgdm9pZCByZWhhc2goc2l6ZV90eXBlIF9fbikKKyAgICAgIHsKKyAgICAgICAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7CisgICAgICAgIF9CYXNlOjpyZWhhc2goX19uKTsKKyAgICAgICAgX01fcHJvZmlsZV9yZXNpemUoX19vbGRfc2l6ZSk7IAorICAgICAgfQorCisgICAgcHJpdmF0ZToKKyAgICAgIHZvaWQKKyAgICAgIF9NX3Byb2ZpbGVfcmVzaXplKHNpemVfdHlwZSBfX29sZF9zaXplKQorICAgICAgeworCXNpemVfdHlwZSBfX25ld19zaXplID0gX0Jhc2U6OmJ1Y2tldF9jb3VudCgpOworICAgICAgICBpZiAoX19vbGRfc2l6ZSAhPSBfX25ld19zaXplKQorICAgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfcmVzaXplKHRoaXMsIF9fb2xkX3NpemUsIF9fbmV3X3NpemUpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCkKKyAgICAgIHsKKwlzaXplX3R5cGUgX19ob3BzID0gMCwgX19sYyA9IDAsIF9fY2hhaW4gPSAwOworCWl0ZXJhdG9yIF9faXQgPSB0aGlzLT5iZWdpbigpOworCXdoaWxlIChfX2l0ICE9IHRoaXMtPmVuZCgpKQorCSAgeworCSAgICBzaXplX3R5cGUgX19ia3QgPSB0aGlzLT5idWNrZXQoX19pdC0+Zmlyc3QpOworCSAgICBhdXRvIF9fbGl0ID0gdGhpcy0+YmVnaW4oX19ia3QpOworCSAgICBhdXRvIF9fbGVuZCA9IHRoaXMtPmVuZChfX2JrdCk7CisJICAgIGZvciAoKytfX2l0LCArK19fbGl0OyBfX2xpdCAhPSBfX2xlbmQ7ICsrX19pdCwgKytfX2xpdCkKKwkgICAgICArK19fY2hhaW47CisJICAgIGlmIChfX2NoYWluKQorCSAgICAgIHsKKw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XRfY291bnQoKSk7CisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfY29uc3RydWN0Mih0aGlzKTsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX3NldChjb25zdCB1bm9yZGVyZWRfc2V0JiBfX3gpCisgICAgICA6IF9CYXNlKF9feCkgCisgICAgICB7IAorICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCkpOworICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdDIodGhpcyk7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9zZXQoY29uc3QgX0Jhc2UmIF9feCkKKyAgICAgIDogX0Jhc2UoX194KSAKKyAgICAgIHsgCisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfY29uc3RydWN0KHRoaXMsIF9CYXNlOjpidWNrZXRfY291bnQoKSk7CisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfY29uc3RydWN0Mih0aGlzKTsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX3NldCh1bm9yZGVyZWRfc2V0JiYgX194KQorICAgICAgOiBfQmFzZShzdGQ6Om1vdmUoX194KSkgCisgICAgICB7IAorICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCkpOworICAgICAgICBfX3Byb2ZjeHhfaGFzaHRhYmxlX2NvbnN0cnVjdDIodGhpcyk7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9zZXQoaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wsCisJCSAgICBzaXplX3R5cGUgX19uID0gMCwKKwkJICAgIGNvbnN0IGhhc2hlciYgX19oZiA9IGhhc2hlcigpLAorCQkgICAgY29uc3Qga2V5X2VxdWFsJiBfX2VxbCA9IGtleV9lcXVhbCgpLAorCQkgICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fbCwgX19uLCBfX2hmLCBfX2VxbCwgX19hKSB7IH0KKworICAgICAgdW5vcmRlcmVkX3NldCYKKyAgICAgIG9wZXJhdG9yPShjb25zdCB1bm9yZGVyZWRfc2V0JiBfX3gpCisgICAgICB7CisJKnN0YXRpY19jYXN0PF9CYXNlKj4odGhpcykgPSBfX3g7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB1bm9yZGVyZWRfc2V0JgorICAgICAgb3BlcmF0b3I9KHVub3JkZXJlZF9zZXQmJiBfX3gpCisgICAgICB7CisJLy8gTkI6IERSIDEyMDQuCisJLy8gTkI6IERSIDY3NS4KKwl0aGlzLT5jbGVhcigpOworCXRoaXMtPnN3YXAoX194KTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9zZXQmCisgICAgICBvcGVyYXRvcj0oaW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wpCisgICAgICB7CisJdGhpcy0+Y2xlYXIoKTsKKwl0aGlzLT5pbnNlcnQoX19sKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIH51bm9yZGVyZWRfc2V0KCkgbm9leGNlcHQKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2hhc2h0YWJsZV9kZXN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCksIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9CYXNlOjpzaXplKCkpOworICAgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAodW5vcmRlcmVkX3NldCYgX194KQorICAgICAgeworICAgICAgICBfQmFzZTo6c3dhcChfX3gpOworICAgICAgfQorCisgICAgICB2b2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worICAgICAgdm9pZAorICAgICAgaW5zZXJ0KHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDx2YWx1ZV90eXBlPiBfX2wpCisgICAgICB7IAorICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IF9CYXNlOjpidWNrZXRfY291bnQoKTsKKyAgICAgICAgX0Jhc2U6Omluc2VydChfX2wpOyAKKyAgICAgICAgX01fcHJvZmlsZV9yZXNpemUoX19vbGRfc2l6ZSk7IAorICAgICAgfQorCisgICAgICBzdGQ6OnBhaXI8aXRlcmF0b3IsIGJvb2w+CisgICAgICBpbnNlcnQoY29uc3QgdmFsdWVfdHlwZSYgX19vYmopCisgICAgICB7CisgICAgICAgIHNpemVfdHlwZSBfX29sZF9zaXplID0gX0Jhc2U6OmJ1Y2tldF9jb3VudCgpOworICAgICAgICBzdGQ6OnBhaXI8aXRlcmF0b3IsIGJvb2w+IF9fcmVzID0gX0Jhc2U6Omluc2VydChfX29iaik7CisgICAgICAgIF9NX3Byb2ZpbGVfcmVzaXplKF9fb2xkX3NpemUpOyAKKyAgICAgICAgcmV0dXJuIF9fcmVzOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0KGNvbnN0X2l0ZXJhdG9yIF9faXRlciwgY29uc3QgdmFsdWVfdHlwZSYgX192KQorICAgICAgeyAKKyAgICAgICAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7IAorICAgICAgICBpdGVyYXRvciBfX3JlcyA9IF9CYXNlOjppbnNlcnQoX19pdGVyLCBfX3YpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZShfX29sZF9zaXplKTsgCisgICAgICAgIHJldHVybiBfX3JlczsKKyAgICAgIH0KKworICAgICAgc3RkOjpwYWlyPGl0ZXJhdG9yLCBib29sPgorICAgICAgaW5zZXJ0KHZhbHVlX3R5cGUmJiBfX29iaikKKyAgICAgIHsKKyAgICAgICAgc2l6ZV90eXB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2V0X2NvdW50KCk7IAorICAgICAgICBfQmFzZTo6aW5zZXJ0KF9fZmlyc3QsIF9fbGFzdCk7CisgICAgICAgIF9NX3Byb2ZpbGVfcmVzaXplKF9fb2xkX3NpemUpOyAKKyAgICAgIH0KKyAgICAgCisgICAgICB2b2lkIHJlaGFzaChzaXplX3R5cGUgX19uKQorICAgICAgeworICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IF9CYXNlOjpidWNrZXRfY291bnQoKTsKKyAgICAgICAgX0Jhc2U6OnJlaGFzaChfX24pOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZShfX29sZF9zaXplKTsgCisgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgdm9pZAorICAgICAgX01fcHJvZmlsZV9yZXNpemUoc2l6ZV90eXBlIF9fb2xkX3NpemUpCisgICAgICB7CisJc2l6ZV90eXBlIF9fbmV3X3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7CisJaWYgKF9fb2xkX3NpemUgIT0gX19uZXdfc2l6ZSkKKwkgIF9fcHJvZmN4eF9oYXNodGFibGVfcmVzaXplKHRoaXMsIF9fb2xkX3NpemUsIF9fbmV3X3NpemUpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCkKKyAgICAgIHsKKwlzaXplX3R5cGUgX19ob3BzID0gMCwgX19sYyA9IDAsIF9fY2hhaW4gPSAwOworCWl0ZXJhdG9yIF9faXQgPSB0aGlzLT5iZWdpbigpOworCXdoaWxlIChfX2l0ICE9IHRoaXMtPmVuZCgpKQorCSAgeworCSAgICBzaXplX3R5cGUgX19ia3QgPSB0aGlzLT5idWNrZXQoKl9faXQpOworCSAgICBhdXRvIF9fbGl0ID0gdGhpcy0+YmVnaW4oX19ia3QpOworCSAgICBhdXRvIF9fbGVuZCA9IHRoaXMtPmVuZChfX2JrdCk7CisJICAgIGZvciAoKytfX2l0LCArK19fbGl0OyBfX2xpdCAhPSBfX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ZV9jb25zdHJ1Y3QodGhpcywgX0Jhc2U6OmJ1Y2tldF9jb3VudCgpKTsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0KHVub3JkZXJlZF9tdWx0aXNldCYmIF9feCkKKyAgICAgIDogX0Jhc2Uoc3RkOjptb3ZlKF9feCkpCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF9oYXNodGFibGVfY29uc3RydWN0KHRoaXMsIF9CYXNlOjpidWNrZXRfY291bnQoKSk7CisgICAgICB9CisKKyAgICAgIHVub3JkZXJlZF9tdWx0aXNldChpbml0aWFsaXplcl9saXN0PHZhbHVlX3R5cGU+IF9fbCwKKwkJCSBzaXplX3R5cGUgX19uID0gMCwKKwkJCSBjb25zdCBoYXNoZXImIF9faGYgPSBoYXNoZXIoKSwKKwkJCSBjb25zdCBrZXlfZXF1YWwmIF9fZXFsID0ga2V5X2VxdWFsKCksCisJCQkgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYSA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fbCwgX19uLCBfX2hmLCBfX2VxbCwgX19hKSB7IH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHVub3JkZXJlZF9tdWx0aXNldCYgX194KQorICAgICAgeworCSpzdGF0aWNfY2FzdDxfQmFzZSo+KHRoaXMpID0gX194OworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0JgorICAgICAgb3BlcmF0b3I9KHVub3JkZXJlZF9tdWx0aXNldCYmIF9feCkKKyAgICAgIHsKKwkvLyBOQjogRFIgMTIwNC4KKwkvLyBOQjogRFIgNjc1LgorCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+c3dhcChfX3gpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgdW5vcmRlcmVkX211bHRpc2V0JgorICAgICAgb3BlcmF0b3I9KGluaXRpYWxpemVyX2xpc3Q8dmFsdWVfdHlwZT4gX19sKQorICAgICAgeworCXRoaXMtPmNsZWFyKCk7CisJdGhpcy0+aW5zZXJ0KF9fbCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICB+dW5vcmRlcmVkX211bHRpc2V0KCkgbm9leGNlcHQKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2hhc2h0YWJsZV9kZXN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCksIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9CYXNlOjpzaXplKCkpOworICAgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHN3YXAodW5vcmRlcmVkX211bHRpc2V0JiBfX3gpCisgICAgICB7CisgICAgICAgIF9CYXNlOjpzd2FwKF9feCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCkgbm9leGNlcHQKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X2hhc2h0YWJsZV9kZXN0cnVjdCh0aGlzLCBfQmFzZTo6YnVja2V0X2NvdW50KCksIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9CYXNlOjpzaXplKCkpOworICAgICAgICBfTV9wcm9maWxlX2Rlc3RydWN0KCk7CisgICAgICAgIF9CYXNlOjpjbGVhcigpOworICAgICAgfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKwlpdGVyYXRvcgorCWVtcGxhY2UoX0FyZ3MmJi4uLiBfX2FyZ3MpCisJeworCSAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7CisJICBpdGVyYXRvciBfX3JlcyA9IF9CYXNlOjplbXBsYWNlKHN0ZDo6Zm9yd2FyZDxfQXJncz4oX19hcmdzKS4uLik7CisJICBf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KGNvbnN0X2l0ZXJhdG9yIF9faXRlciwgY29uc3QgdmFsdWVfdHlwZSYgX192KQorICAgICAgeworICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IF9CYXNlOjpidWNrZXRfY291bnQoKTsgCisgICAgICAgIGl0ZXJhdG9yIF9fcmVzID0gX0Jhc2U6Omluc2VydChfX2l0ZXIsIF9fdik7CisgICAgICAgIF9NX3Byb2ZpbGVfcmVzaXplKF9fb2xkX3NpemUpOyAKKyAgICAgICAgcmV0dXJuIF9fcmVzOworICAgICAgfQorCisgICAgICBpdGVyYXRvcgorICAgICAgaW5zZXJ0KHZhbHVlX3R5cGUmJiBfX29iaikKKyAgICAgIHsKKwlzaXplX3R5cGUgX19vbGRfc2l6ZSA9IF9CYXNlOjpidWNrZXRfY291bnQoKTsKKyAgICAgICAgaXRlcmF0b3IgX19yZXMgPSBfQmFzZTo6aW5zZXJ0KHN0ZDo6bW92ZShfX29iaikpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZShfX29sZF9zaXplKTsgCisgICAgICAgIHJldHVybiBfX3JlczsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGluc2VydChjb25zdF9pdGVyYXRvciBfX2l0ZXIsIHZhbHVlX3R5cGUmJiBfX3YpCisgICAgICB7CisgICAgICAgIHNpemVfdHlwZSBfX29sZF9zaXplID0gX0Jhc2U6OmJ1Y2tldF9jb3VudCgpOyAKKyAgICAgICAgaXRlcmF0b3IgX19yZXMgPSBfQmFzZTo6aW5zZXJ0KF9faXRlciwgc3RkOjptb3ZlKF9fdikpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZShfX29sZF9zaXplKTsgCisgICAgICAgIHJldHVybiBfX3JlczsKKyAgICAgIH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0lucHV0SXRlcj4KKyAgICAgICAgdm9pZAorICAgICAgICBpbnNlcnQoX0lucHV0SXRlciBfX2ZpcnN0LCBfSW5wdXRJdGVyIF9fbGFzdCkKKyAgICAgICAgeworCSAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7IAorCSAgX0Jhc2U6Omluc2VydChfX2ZpcnN0LCBfX2xhc3QpOworCSAgX01fcHJvZmlsZV9yZXNpemUoX19vbGRfc2l6ZSk7IAorCX0KKworICAgICAgdm9pZAorICAgICAgaW5zZXJ0KGNvbnN0IHZhbHVlX3R5cGUqIF9fZmlyc3QsIGNvbnN0IHZhbHVlX3R5cGUqIF9fbGFzdCkKKyAgICAgIHsKKyAgICAgICAgc2l6ZV90eXBlIF9fb2xkX3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7IAorICAgICAgICBfQmFzZTo6aW5zZXJ0KF9fZmlyc3QsIF9fbGFzdCk7CisgICAgICAgIF9NX3Byb2ZpbGVfcmVzaXplKF9fb2xkX3NpemUpOyAKKyAgICAgIH0KKyAgICAgCisgICAgICB2b2lkIHJlaGFzaChzaXplX3R5cGUgX19uKQorICAgICAgeworICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IF9CYXNlOjpidWNrZXRfY291bnQoKTsKKyAgICAgICAgX0Jhc2U6OnJlaGFzaChfX24pOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZShfX29sZF9zaXplKTsgCisgICAgICB9CisKKyAgICBwcml2YXRlOgorICAgICAgdm9pZAorICAgICAgX01fcHJvZmlsZV9yZXNpemUoc2l6ZV90eXBlIF9fb2xkX3NpemUpCisgICAgICB7CisJc2l6ZV90eXBlIF9fbmV3X3NpemUgPSBfQmFzZTo6YnVja2V0X2NvdW50KCk7CisgICAgICAgIGlmIChfX29sZF9zaXplICE9IF9fbmV3X3NpemUpCisgICAgICAgICAgX19wcm9mY3h4X2hhc2h0YWJsZV9yZXNpemUodGhpcywgX19vbGRfc2l6ZSwgX19uZXdfc2l6ZSk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3Byb2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NvbnN0X2l0ZXJhdG9yKF9CYXNlOjplbmQoKSwgdGhpcyk7IH0KKworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvcgorICAgICAgY3JiZWdpbigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKGVuZCgpKTsgfQorCisgICAgICBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yCisgICAgICBjcmVuZCgpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBjb25zdF9yZXZlcnNlX2l0ZXJhdG9yKGJlZ2luKCkpOyB9CisjZW5kaWYKKworICAgICAgLy8gMjMuMi40LjIgY2FwYWNpdHk6CisgICAgICB1c2luZyBfQmFzZTo6c2l6ZTsKKyAgICAgIHVzaW5nIF9CYXNlOjptYXhfc2l6ZTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9fc3opCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF92ZWN0b3JfaW52YWxpZF9vcGVyYXRvcih0aGlzKTsKKyAgICAgICAgX01fcHJvZmlsZV9yZXNpemUodGhpcywgdGhpcy0+Y2FwYWNpdHkoKSwgX19zeik7CisgICAgICAgIF9CYXNlOjpyZXNpemUoX19zeik7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19zeiwgY29uc3QgX1RwJiBfX2MpCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF92ZWN0b3JfaW52YWxpZF9vcGVyYXRvcih0aGlzKTsKKyAgICAgICAgX01fcHJvZmlsZV9yZXNpemUodGhpcywgdGhpcy0+Y2FwYWNpdHkoKSwgX19zeik7CisgICAgICAgIF9CYXNlOjpyZXNpemUoX19zeiwgX19jKTsKKyAgICAgIH0KKyNlbHNlCisgICAgICB2b2lkCisgICAgICByZXNpemUoc2l6ZV90eXBlIF9fc3osIF9UcCBfX2MgPSBfVHAoKSkKKyAgICAgIHsKKyAgICAgICAgX19wcm9mY3h4X3ZlY3Rvcl9pbnZhbGlkX29wZXJhdG9yKHRoaXMpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZSh0aGlzLCB0aGlzLT5jYXBhY2l0eSgpLCBfX3N6KTsKKyAgICAgICAgX0Jhc2U6OnJlc2l6ZShfX3N6LCBfX2MpOworICAgICAgfQorI2VuZGlmCisKKyNpZmRlZiBfX0dYWF9FWFBFUklNRU5UQUxfQ1hYMFhfXworICAgICAgdXNpbmcgX0Jhc2U6OnNocmlua190b19maXQ7CisjZW5kaWYKKworICAgICAgdXNpbmcgX0Jhc2U6OmVtcHR5OworCisgICAgICAvLyBlbGVtZW50IGFjY2VzczoKKyAgICAgIHJlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShzaXplX3R5cGUgX19uKQorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfdmVjdG9yX2ludmFsaWRfb3BlcmF0b3IodGhpcyk7CisgICAgICAgIHJldHVybiBfTV9iYXNlKClbX19uXTsKKyAgICAgIH0KKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgb3BlcmF0b3JbXShzaXplX3R5cGUgX19uKSBjb25zdAorICAgICAgeworICAgICAgICBfX3Byb2ZjeHhfdmVjdG9yX2ludmFsaWRfb3BlcmF0b3IodGhpcyk7CisgICAgICAgIHJldHVybiBfTV9iYXNlKClbX19uXTsKKyAgICAgIH0KKworICAgICAgdXNpbmcgX0Jhc2U6OmF0OworCisgICAgICByZWZlcmVuY2UKKyAgICAgIGZyb250KCkKKyAgICAgIHsgCisgICAgICAgIHJldHVybiBfQmFzZTo6ZnJvbnQoKTsKKyAgICAgIH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBmcm9udCgpIGNvbnN0CisgICAgICB7CisJcmV0dXJuIF9CYXNlOjpmcm9udCgpOworICAgICAgfQorCisgICAgICByZWZlcmVuY2UKKyAgICAgIGJhY2soKQorICAgICAgeworCXJldHVybiBfQmFzZTo6YmFjaygpOworICAgICAgfQorCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeworCXJldHVybiBfQmFzZTo6YmFjaygpOworICAgICAgfQorCisgICAgICAvLyBfR0xJQkNYWF9SRVNPTFZFX0xJQl9ERUZFQ1RTCisgICAgICAvLyBEUiA0NjQuIFN1Z2dlc3Rpb24gZm9yIG5ldyBtZW1iZXIgZnVuY3Rpb25zIGluIHN0YW5kYXJkIGNvbnRhaW5lcnMuCisgICAgICB1c2luZyBfQmFzZTo6ZGF0YTsKKworICAgICAgLy8gMjMuMi40LjMgbW9kaWZpZXJzOgorICAgICAgdm9pZAorICAgICAgcHVzaF9iYWNrKGNvbnN0IF9UcCYgX194KQorICAgICAgeworICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IHRoaXMtPmNhcGFjaXR5KCk7CisJX0Jhc2U6OnB1c2hfYmFjayhfX3gpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZSh0aGlzLCBfX29sZF9zaXplLCB0aGlzLT5jYXBhY2l0eSgpKTsKKyAgICAgIH0KKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICB2b2lkCisgICAgICBwdXNoX2JhY2soX1RwJiYgX194KQorICAgICAgeworICAgICAgICBzaXplX3R5cGUgX19vbGRfc2l6ZSA9IHRoaXMtPmNhcGFjaXR5KCk7CisgICAgICAgIF9CYXNlOjpwdXNoX2JhY2soc3RkOjptb3ZlKF9feCkpOworICAgICAgICBfTV9wcm9maWxlX3Jlc2l6ZSh0aGlzLCBfX29sZF9zaXplLCB0aGlzLT5jYXBhY2l0eSgpKTsKKyAgICAgIH0KKworI2VuZGlmCisKKyAgICAgIGl0ZXJhdG9yCisgICAgICBpbnNlcnQoaXRlcmF0b3IgX19wb3NpdGlvbiwgY29uc3QgX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hc2UoX19maXJzdC5iYXNlKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2xhc3QuYmFzZSgpKTsKKwlyZXR1cm4gaXRlcmF0b3IoX19yZXMsIHRoaXMpOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBjbGVhcigpIF9HTElCQ1hYX05PRVhDRVBUCisgICAgICB7CisgICAgICAgIF9fcHJvZmN4eF92ZWN0b3JfZGVzdHJ1Y3QodGhpcywgdGhpcy0+Y2FwYWNpdHkoKSwgdGhpcy0+c2l6ZSgpKTsKKyAgICAgICAgX19wcm9mY3h4X3ZlY3Rvcl9kZXN0cnVjdDIodGhpcyk7CisgICAgICAgIF9CYXNlOjpjbGVhcigpOworICAgICAgfQorCisgICAgICBpbmxpbmUgdm9pZCBfTV9wcm9maWxlX2ZpbmQoKSBjb25zdCAKKyAgICAgIHsgCisgICAgICAgIF9fcHJvZmN4eF92ZWN0b3JfZmluZCh0aGlzLCBzaXplKCkpOyAKKyAgICAgIH0KKworICAgICAgaW5saW5lIHZvaWQgX01fcHJvZmlsZV9pdGVyYXRlKGludCBfX3Jld2luZCA9IDApIGNvbnN0IAorICAgICAgeyAKKyAgICAgICAgX19wcm9mY3h4X3ZlY3Rvcl9pdGVyYXRlKHRoaXMpOyAKKyAgICAgIH0KKworICAgIHByaXZhdGU6CisgICAgICB2b2lkIF9NX3Byb2ZpbGVfcmVzaXplKHZvaWQqIG9iaiwgc2l6ZV90eXBlIF9fb2xkX3NpemUsIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3R5cGUgX19uZXdfc2l6ZSkKKyAgICAgIHsKKyAgICAgICAgaWYgKF9fb2xkX3NpemUgPCBfX25ld19zaXplKSB7CisgICAgICAgICAgX19wcm9mY3h4X3ZlY3Rvcl9yZXNpemUodGhpcywgdGhpcy0+c2l6ZSgpLCBfX25ld19zaXplKTsKKyAgICAgICAgICBfX3Byb2ZjeHhfdmVjdG9yX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F9faGkyICYmIF9fbG8xIDwgX19sbzIpKT4KKyAgICB7IH07CisKKyAgdGVtcGxhdGU8dWludG1heF90IF9faGkxLCB1aW50bWF4X3QgX19sbzEsIHVpbnRtYXhfdCBfX2hpMiwgdWludG1heF90IF9fbG8yPgorICAgIHN0cnVjdCBfX2JpZ19hZGQKKyAgICB7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2xvID0gX19sbzEgKyBfX2xvMjsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9faGkgPSAoX19oaTEgKyBfX2hpMiArCisJCQkJCSAoX19sbzEgKyBfX2xvMiA8IF9fbG8xKSk7IC8vIGNhcnJ5CisgICAgfTsKKworICAvLyBTdWJ0cmFjdCBhIG51bWJlciBmcm9tIGEgYmlnZ2VyIG9uZS4KKyAgdGVtcGxhdGU8dWludG1heF90IF9faGkxLCB1aW50bWF4X3QgX19sbzEsIHVpbnRtYXhfdCBfX2hpMiwgdWludG1heF90IF9fbG8yPgorICAgIHN0cnVjdCBfX2JpZ19zdWIKKyAgICB7CisgICAgICBzdGF0aWNfYXNzZXJ0KCFfX2JpZ19sZXNzPF9faGkxLCBfX2xvMSwgX19oaTIsIF9fbG8yPjo6dmFsdWUsCisJCSAgICAiSW50ZXJuYWwgbGlicmFyeSBlcnJvciIpOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19sbyA9IF9fbG8xIC0gX19sbzI7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2hpID0gKF9faGkxIC0gX19oaTIgLQorCQkJCQkgKF9fbG8xIDwgX19sbzIpKTsgLy8gY2FycnkKKyAgICB9OworCisgIC8vIFNhbWUgcHJpbmNpcGxlIGFzIF9fc2FmZV9tdWx0aXBseS4KKyAgdGVtcGxhdGU8dWludG1heF90IF9feCwgdWludG1heF90IF9feT4KKyAgICBzdHJ1Y3QgX19iaWdfbXVsCisgICAgeworICAgIHByaXZhdGU6CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2MgPSB1aW50bWF4X3QoMSkgPDwgKHNpemVvZihpbnRtYXhfdCkgKiA0KTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9feDAgPSBfX3ggJSBfX2M7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3gxID0gX194IC8gX19jOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX195MCA9IF9feSAlIF9fYzsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9feTEgPSBfX3kgLyBfX2M7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3gweTAgPSBfX3gwICogX195MDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9feDB5MSA9IF9feDAgKiBfX3kxOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX194MXkwID0gX194MSAqIF9feTA7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3gxeTEgPSBfX3gxICogX195MTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fbWl4ID0gX194MHkxICsgX194MXkwOyAvLyBwb3NzaWJsZSBjYXJyeS4uLgorICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19taXhfbG8gPSBfX21peCAqIF9fYzsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fbWl4X2hpCisgICAgICA9IF9fbWl4IC8gX19jICsgKChfX21peCA8IF9feDB5MSkgPyBfX2MgOiAwKTsgLy8gLi4uIGFkZGVkIGhlcmUKKyAgICAgIHR5cGVkZWYgX19iaWdfYWRkPF9fbWl4X2hpLCBfX21peF9sbywgX194MXkxLCBfX3gweTA+IF9SZXM7CisgICAgcHVibGljOgorICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19oaSA9IF9SZXM6Ol9faGk7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2xvID0gX1Jlczo6X19sbzsKKyAgICB9OworCisgIC8vIEFkYXB0ZWQgZnJvbSBfX3VkaXZfcXJubmRfYyBpbiBsb25nbG9uZy5oCisgIC8vIFRoaXMgdmVyc2lvbiBhc3N1bWVzIHRoYXQgdGhlIGhpZ2ggYml0IG9mIF9fZCBpcyAxLgorICB0ZW1wbGF0ZTx1aW50bWF4X3QgX19uMSwgdWludG1heF90IF9fbjAsIHVpbnRtYXhfdCBfX2Q+CisgICAgc3RydWN0IF9fYmlnX2Rpdl9pbXBsCisgICAgeworICAgIHByaXZhdGU6CisgICAgICBzdGF0aWNfYXNzZXJ0KF9fZCA+PSAodWludG1heF90KDEpIDw8IChzaXplb2YoaW50bWF4X3QpICogOCAtIDEpKSwKKwkJICAgICJJbnRlcm5hbCBsaWJyYXJ5IGVycm9yIik7CisgICAgICBzdGF0aWNfYXNzZXJ0KF9fbjEgPCBfX2QsICJJbnRlcm5hbCBsaWJyYXJ5IGVycm9yIik7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2MgPSB1aW50bWF4X3QoMSkgPDwgKHNpemVvZihpbnRtYXhfdCkgKiA0KTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fZDEgPSBfX2QgLyBfX2M7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2QwID0gX19kICUgX19jOworCisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3ExeCA9IF9fbjEgLyBfX2QxOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19yMXggPSBfX24xICUgX19kMTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fbSA9IF9fcTF4ICogX19kMDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fcjF5ID0gX19yMXggKiBfX2MgKyBfX24wIC8gX19jOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19yMXogPSBfX3IxeSArIF9fZDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fcjEKKyAgICAgID0gKChfX3IxeSA8IF9fbSkgPyAoKF9fcjF6ID49IF9fZCkgJiYgKF9fcjF6IDwgX19tKSkKKwkgPyAoX19yMXogKyBfX2QpIDogX19yMXogOiBfX3IxeSkgLSBfX207CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3ExCisgICAgICA9IF9fcTF4IC0gKChfX3IxeSA8IF9fbSkKKwkJID8gKChfX3IxeiA+PSBfX2QpICYmIChfX3IxeiA8IF9fbSkpID8gMiA6IDEgOiAwKTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fcTB4ID0gX19yMSAvIF9fZDE7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3IweCA9IF9fcjEgJSBfX2QxOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19uID0gX19xMHggKiBfX2QwOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19yMHkgPSBfX3IweCAqIF9fYyArIF9fbjAgJSBfX2M7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3IweiA9IF9fcjB5ICsgX19kOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19yMAorICAgICAgPSAoKF9fcjB5IDwgX19uKSA/ICgoX19yMHogPj0gX19kKSAmJiAoX19yMHogPCBfX24pKQorCSA/IChfX3IweiArIF9fZCkgOiBfX3IweiA6IF9fcjB5KSAtIF9fbjsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fcTAKKyAgICAgID0gX19xMHggLSAoKF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3RleHByIGludCBfX3NoaWZ0ID0gX19idWlsdGluX2NsemxsKF9fZCk7CisgICAgICBzdGF0aWMgY29uc3RleHByIGludCBfX2Nvc2hpZnRfID0gc2l6ZW9mKHVpbnRtYXhfdCkgKiA4IC0gX19zaGlmdDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgaW50IF9fY29zaGlmdCA9IChfX3NoaWZ0ICE9IDApID8gX19jb3NoaWZ0XyA6IDA7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2MxID0gdWludG1heF90KDEpIDw8IF9fc2hpZnQ7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX2MyID0gdWludG1heF90KDEpIDw8IF9fY29zaGlmdDsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fbmV3X2QgPSBfX2QgKiBfX2MxOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19uZXdfbjAgPSBfX24wICogX19jMTsKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgdWludG1heF90IF9fbjFfc2hpZnRlZCA9IChfX24xICUgX19kKSAqIF9fYzE7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX24wX3RvcCA9IChfX3NoaWZ0ICE9IDApID8gKF9fbjAgLyBfX2MyKSA6IDA7CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX25ld19uMSA9IF9fbjFfc2hpZnRlZCArIF9fbjBfdG9wOworICAgICAgdHlwZWRlZiBfX2JpZ19kaXZfaW1wbDxfX25ld19uMSwgX19uZXdfbjAsIF9fbmV3X2Q+IF9SZXM7CisKKyAgICBwdWJsaWM6CisgICAgICBzdGF0aWMgY29uc3RleHByIHVpbnRtYXhfdCBfX3F1b3RfaGkgPSBfX24xIC8gX19kOworICAgICAgc3RhdGljIGNvbnN0ZXhwciB1aW50bWF4X3QgX19xdW90X2xvID0gX1Jlczo6X19xdW90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hdGU8aW50bWF4X3QgX051bSwgaW50bWF4X3QgX0Rlbj4KKyAgICBjb25zdGV4cHIgaW50bWF4X3QgcmF0aW88X051bSwgX0Rlbj46OmRlbjsKKworICAvLy8gcmF0aW9fbXVsdGlwbHkKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1IxLCB0eXBlbmFtZSBfUjI+CisgICAgc3RydWN0IHJhdGlvX211bHRpcGx5CisgICAgeworICAgIHByaXZhdGU6CisgICAgICBzdGF0aWMgY29uc3QgaW50bWF4X3QgX19nY2QxID0KKyAgICAgICAgX19zdGF0aWNfZ2NkPF9SMTo6bnVtLCBfUjI6OmRlbj46OnZhbHVlOworICAgICAgc3RhdGljIGNvbnN0IGludG1heF90IF9fZ2NkMiA9CisgICAgICAgIF9fc3RhdGljX2djZDxfUjI6Om51bSwgX1IxOjpkZW4+Ojp2YWx1ZTsKKworICAgIHB1YmxpYzoKKyAgICAgIHR5cGVkZWYgcmF0aW88CisgICAgICAgIF9fc2FmZV9tdWx0aXBseTwoX1IxOjpudW0gLyBfX2djZDEpLAorICAgICAgICAgICAgICAgICAgICAgICAgKF9SMjo6bnVtIC8gX19nY2QyKT46OnZhbHVlLAorICAgICAgICBfX3NhZmVfbXVsdGlwbHk8KF9SMTo6ZGVuIC8gX19nY2QyKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChfUjI6OmRlbiAvIF9fZ2NkMSk+Ojp2YWx1ZT4gdHlwZTsKKworICAgICAgc3RhdGljIGNvbnN0ZXhwciBpbnRtYXhfdCBudW0gPSB0eXBlOjpudW07CisgICAgICBzdGF0aWMgY29uc3RleHByIGludG1heF90IGRlbiA9IHR5cGU6OmRlbjsKKyAgICB9OworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9SMSwgdHlwZW5hbWUgX1IyPgorICAgIGNvbnN0ZXhwciBpbnRtYXhfdCByYXRpb19tdWx0aXBseTxfUjEsIF9SMj46Om51bTsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUjEsI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hdGU8dHlwZW5hbWUgX1IxLCB0eXBlbmFtZSBfUjI+CisgICAgY29uc3RleHByIGludG1heF90IHJhdGlvX3N1YnRyYWN0PF9SMSwgX1IyPjo6bnVtOworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9SMSwgdHlwZW5hbWUgX1IyPgorICAgIGNvbnN0ZXhwciBpbnRtYXhfdCByYXRpb19zdWJ0cmFjdDxfUjEsIF9SMj46OmRlbjsKKworCisKKyAgdHlwZWRlZiByYXRpbzwxLCAgICAgICAxMDAwMDAwMDAwMDAwMDAwMDAwPiBhdHRvOworICB0eXBlZGVmIHJhdGlvPDEsICAgICAgICAgIDEwMDAwMDAwMDAwMDAwMDA+IGZlbXRvOworICB0eXBlZGVmIHJhdGlvPDEsICAgICAgICAgICAgIDEwMDAwMDAwMDAwMDA+IHBpY287CisgIHR5cGVkZWYgcmF0aW88MSwgICAgICAgICAgICAgICAgMTAwMDAwMDAwMD4gbmFubzsKKyAgdHlwZWRlZiByYXRpbzwxLCAgICAgICAgICAgICAgICAgICAxMDAwMDAwPiBtaWNybzsKKyAgdHlwZWRlZiByYXRpbzwxLCAgICAgICAgICAgICAgICAgICAgICAxMDAwPiBtaWxsaTsKKyAgdHlwZWRlZiByYXRpbzwxLCAgICAgICAgICAgICAgICAgICAgICAgMTAwPiBjZW50aTsKKyAgdHlwZWRlZiByYXRpbzwxLCAgICAgICAgICAgICAgICAgICAgICAgIDEwPiBkZWNpOworICB0eXBlZGVmIHJhdGlvPCAgICAgICAgICAgICAgICAgICAgICAgMTAsIDE+IGRlY2E7CisgIHR5cGVkZWYgcmF0aW88ICAgICAgICAgICAgICAgICAgICAgIDEwMCwgMT4gaGVjdG87CisgIHR5cGVkZWYgcmF0aW88ICAgICAgICAgICAgICAgICAgICAgMTAwMCwgMT4ga2lsbzsKKyAgdHlwZWRlZiByYXRpbzwgICAgICAgICAgICAgICAgICAxMDAwMDAwLCAxPiBtZWdhOworICB0eXBlZGVmIHJhdGlvPCAgICAgICAg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lY3Rfb25fY29udGFpbmVyX2NvcHlfY29uc3RydWN0aW9uKF9fYSk7CisgICAgICAgIH0KKworICAgICAgdGVtcGxhdGU8c3RkOjpzaXplX3QuLi4gX0luZGljZXM+CisgICAgICAgIHNjb3BlZF9hbGxvY2F0b3JfYWRhcHRvcih0dXBsZTxjb25zdCBfT3V0ZXJBbGxvYyYsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfSW5uZXJBbGxvY3MmLi4uPiBfX3JlZnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfSW5kZXhfdHVwbGU8X0luZGljZXMuLi4+KQorICAgICAgICA6IF9PdXRlckFsbG9jKF9TX3NlbGVjdF9vbl9jb3B5KHN0ZDo6Z2V0PDA+KF9fcmVmcykpKSwKKyAgICAgICAgICBfTV9pbm5lcihfU19zZWxlY3Rfb25fY29weShzdGQ6OmdldDxfSW5kaWNlcysxPihfX3JlZnMpKS4uLikKKyAgICAgICAgeyB9CisKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9PdXRlckFsbG9jICAgICAgICAgICAgICAgICAgICAgICBvdXRlcl9hbGxvY2F0b3JfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19pbm5lcl90eXBlOjpfX3R5cGUgICAgIGlubmVyX2FsbG9jYXRvcl90eXBlOworCisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fdHJhaXRzOjp2YWx1ZV90eXBlICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fdHJhaXRzOjpzaXplX3R5cGUgICAgICAgICAgICAgIHNpemVfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX190cmFpdHM6OmRpZmZlcmVuY2VfdHlwZSAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX3RyYWl0czo6cG9pbnRlciAgICAgICA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AgICAgc3RydWN0IHJlYmluZAorICAgICAgICB7CisgICAgICAgICAgdHlwZWRlZiBzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3I8CisgICAgICAgICAgICB0eXBlbmFtZSBfX3RyYWl0czo6dGVtcGxhdGUgcmViaW5kX2FsbG9jPF9UcD4sCisgICAgICAgICAgICBfSW5uZXJBbGxvY3MuLi4+IG90aGVyOworICAgICAgICB9OworCisgICAgICBzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3IoKSA6IF9PdXRlckFsbG9jKCksIF9NX2lubmVyKCkgeyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9PdXRlcjI+CisgICAgICAgIHNjb3BlZF9hbGxvY2F0b3JfYWRhcHRvcihfT3V0ZXIyJiYgX19vdXRlciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9Jbm5lckFsbG9jcyYuLi4gX19pbm5lcikKKyAgICAgICAgOiBfT3V0ZXJBbGxvYyhzdGQ6OmZvcndhcmQ8X091dGVyMj4oX19vdXRlcikpLAorICAgICAgICAgIF9NX2lubmVyKF9faW5uZXIuLi4pCisgICAgICAgIHsgfQorCisgICAgICBzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3IoY29uc3Qgc2NvcGVkX2FsbG9jYXRvcl9hZGFwdG9yJiBfX290aGVyKQorICAgICAgOiBfT3V0ZXJBbGxvYyhfX290aGVyLm91dGVyX2FsbG9jYXRvcigpKSwKKwlfTV9pbm5lcihfX290aGVyLl9NX2lubmVyKQorICAgICAgeyB9CisKKyAgICAgIHNjb3BlZF9hbGxvY2F0b3JfYWRhcHRvcihzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3ImJiBfX290aGVyKQorICAgICAgOiBfT3V0ZXJBbGxvYyhzdGQ6Om1vdmUoX19vdGhlci5vdXRlcl9hbGxvY2F0b3IoKSkpLAorCV9NX2lubmVyKHN0ZDo6bW92ZShfX290aGVyLl9NX2lubmVyKSkKKyAgICAgIHsgfQorCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfT3V0ZXIyPgorICAgICAgICBzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3IoCisgICAgICAgICAgICBjb25zdCBzY29wZWRfYWxsb2NhdG9yX2FkYXB0b3I8X091dGVyMiwgX0lubmVyQWxsb2NzLi4uPiYgX19vdGhlcikKKyAgICAgICAgOiBfT3V0ZXJBbGxvYyhfX290aGVyLm91dGVyX2FsbG9jYXRvcigpKSwKKyAgICAgICAgICBfTV9pbm5lcihfX290aGVyLl9NX2lubmVyKQorICAgICAgICB7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX091dGVyMj4KKyAgICAgICAgc2NvcGVkX2FsbG9jYXRvcl9hZGFwdG9yKAorICAgICAgICAgICAgc2NvcGVkX2FsbG9jYXRvcl9hZGFwdG9yPF9PdXRlcjIsIF9Jbm5lckFsbG9jcy4uLj4mJiBfX290aGVyKQorICAgICAgICA6IF9PdXRlckFsbG9jKHN0ZDo6bW92ZShfX290aGVyLm91dGVyX2FsbG9jYXRvcigpKSksCisgICAgICAgICAgX01faW5uZXIoc3RkOjptb3ZlKF9fb3RoZXIuX01faW5uZXIpKQorICAgICAgICB7IH0KKworICAgICAgaW5uZXJfYWxsb2NhdG9yX3R5cGUmIGlubmVyX2FsbG9jYXRvcigpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV9pbm5lci5fTV9nZXQodGhpcyk7IH0KKworICAgICAgY29uc3QgaW5uZXJfYWxsb2NhdG9yX3R5cGUmIGlubmVyX2FsbG9jYXRvcigpIGNvbnN0IG5vZXhjZXB0CisgICAgICB7IHJldHVybiBfTV9pbm5lci5fTV9nZXQodGhpcyk7IH0KKworICAgICAgb3V0ZXJfYWxsb2NhdG9yX3R5cGUmIG91dGVyX2FsbG9jYXRvcigpIG5vZXhjZXB0CisgICAgICB7IHJldHVybiBzdGF0aWNfY2FzdDxfT3V0ZXJBbGxvYyY+KCp0aGlzKTsgfQor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ncHRyKCk7CisJICB9CisJcmV0dXJuIF9fcmV0OworICAgICAgfQorCisgICAgICB2aXJ0dWFsIGludF90eXBlCisgICAgICB1bmRlcmZsb3coKTsKKworICAgICAgdmlydHVhbCBpbnRfdHlwZQorICAgICAgcGJhY2tmYWlsKGludF90eXBlIF9fYyA9IHRyYWl0c190eXBlOjplb2YoKSk7CisKKyAgICAgIHZpcnR1YWwgaW50X3R5cGUKKyAgICAgIG92ZXJmbG93KGludF90eXBlIF9fYyA9IHRyYWl0c190eXBlOjplb2YoKSk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTWFuaXB1bGF0ZXMgdGhlIGJ1ZmZlci4KKyAgICAgICAqICBAcGFyYW0gIF9fcyAgUG9pbnRlciB0byBhIGJ1ZmZlciBhcmVhLgorICAgICAgICogIEBwYXJhbSAgX19uICBTaXplIG9mIEBhIF9fcy4KKyAgICAgICAqICBAcmV0dXJuICBAYyB0aGlzCisgICAgICAgKgorICAgICAgICogIElmIG5vIGJ1ZmZlciBoYXMgYWxyZWFkeSBiZWVuIGNyZWF0ZWQsIGFuZCBib3RoIEBhIF9fcyBhbmQgQGEgX19uIGFyZQorICAgICAgICogIG5vbi16ZXJvLCB0aGVuIEBjIF9fcyBpcyB1c2VkIGFzIGEgYnVmZmVyOyBzZWUKKyAgICAgICAqICBodHRwOi8vZ2NjLmdudS5vcmcvb25saW5lZG9jcy9saWJzdGRjKysvbWFudWFsL2JrMDFwdDExY2gyNXMwMi5odG1sCisgICAgICAgKiAgZm9yIG1vcmUuCisgICAgICAqLworICAgICAgdmlydHVhbCBfX3N0cmVhbWJ1Zl90eXBlKgorICAgICAgc2V0YnVmKGNoYXJfdHlwZSogX19zLCBzdHJlYW1zaXplIF9fbikKKyAgICAgIHsKKwlpZiAoX19zICYmIF9fbiA+PSAwKQorCSAgeworCSAgICAvLyBUaGlzIGlzIGltcGxlbWVudGF0aW9uLWRlZmluZWQgYmVoYXZpb3IsIGFuZCBhc3N1bWVzCisJIC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ZXhwbGljaXQKKyAgICAgIGJhc2ljX2lzdHJpbmdzdHJlYW0oY29uc3QgX19zdHJpbmdfdHlwZSYgX19zdHIsCisJCQkgIGlvc19iYXNlOjpvcGVubW9kZSBfX21vZGUgPSBpb3NfYmFzZTo6aW4pCisgICAgICA6IF9faXN0cmVhbV90eXBlKCksIF9NX3N0cmluZ2J1ZihfX3N0ciwgX19tb2RlIHwgaW9zX2Jhc2U6OmluKQorICAgICAgeyB0aGlzLT5pbml0KCZfTV9zdHJpbmdidWYpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgVGhlIGRlc3RydWN0b3IgZG9lcyBub3RoaW5nLgorICAgICAgICoKKyAgICAgICAqICBUaGUgYnVmZmVyIGlzIGRlYWxsb2NhdGVkIGJ5IHRoZSBzdHJpbmdidWYgb2JqZWN0LCBub3QgdGhlCisgICAgICAgKiAgZm9ybWF0dGluZyBzdHJlYW0uCisgICAgICAqLworICAgICAgfmJhc2ljX2lzdHJpbmdzdHJlYW0oKQorICAgICAgeyB9CisKKyAgICAgIC8vIE1lbWJlcnM6CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFjY2Vzc2luZyB0aGUgdW5kZXJseWluZyBidWZmZXIuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGN1cnJlbnQgYmFzaWNfc3RyaW5nYnVmIGJ1ZmZlci4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBoaWRlcyBib3RoIHNpZ25hdHVyZXMgb2Ygc3RkOjpiYXNpY19pb3M6OnJkYnVmKCkuCisgICAgICAqLworICAgICAgX19zdHJpbmdidWZfdHlwZSoKKyAgICAgIHJkYnVmKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2Nhc3Q8X19zdHJpbmdidWZfdHlwZSo+KCZfTV9zdHJpbmdidWYpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29weWluZyBvdXQgdGhlIHN0cmluZyBidWZmZXIuCisgICAg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zdHJpbmdidWYgb2JqZWN0LCBub3QgdGhlCisgICAgICAgKiAgZm9ybWF0dGluZyBzdHJlYW0uCisgICAgICAqLworICAgICAgfmJhc2ljX29zdHJpbmdzdHJlYW0oKQorICAgICAgeyB9CisKKyAgICAgIC8vIE1lbWJlcnM6CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFjY2Vzc2luZyB0aGUgdW5kZXJseWluZyBidWZmZXIuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGN1cnJlbnQgYmFzaWNfc3RyaW5nYnVmIGJ1ZmZlci4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBoaWRlcyBib3RoIHNpZ25hdHVyZXMgb2Ygc3RkOjpiYXNpY19pb3M6OnJkYnVmKCkuCisgICAgICAqLworICAgICAgX19zdHJpbmdidWZfdHlwZSoKKyAgICAgIHJkYnVmKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2Nhc3Q8X19zdHJpbmdidWZfdHlwZSo+KCZfTV9zdHJpbmdidWYpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29weWluZyBvdXQgdGhlIHN0cmluZyBidWZmZXIuCisgICAgICAgKiAgQHJldHVybiAgQGMgcmRidWYoKS0+c3RyKCkKKyAgICAgICovCisgICAgICBfX3N0cmluZ190eXBlCisgICAgICBzdHIoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fc3RyaW5nYnVmLnN0cigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU2V0dGluZyBhIG5ldyBidWZmZXIuCisgICAgICAgKiAgQHBhcmFtICBfX3MgIFRoZSBzdHJpbmcgdG8gdXNlIGFzIGEgbmV3IHNlcXVlbmNlLgorICAgICAgICoKKyAgICAgICAqICBDYWxscyBAYyByZGJ1ZigpLT5zdHIocykuCisgICAgICAqLworICAgICAgdm9pZAorICAgICAgc3RyKGNvbnN0IF9fc3RyaW5nX3R5cGUmIF9fcykKKyAgICAgIHsgX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gYXQgdGhlIHRpbWUKKyAgICAgICAqICBvZiBjb25zdHJ1Y3Rpb24gaXMgcmV0dXJuZWQuCisgICAgICAqLworICAgICAgbG9jYWxlICAgCisgICAgICBnZXRsb2MoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fYnVmX2xvY2FsZTsgfSAKKworICAgICAgLy8gWzI3LjUuMi4yLjJdIGJ1ZmZlciBtYW5hZ2VtZW50IGFuZCBwb3NpdGlvbmluZworICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBFbnRyeSBwb2ludHMgZm9yIGRlcml2ZWQgYnVmZmVyIGZ1bmN0aW9ucy4KKyAgICAgICAqCisgICAgICAgKiAgVGhlIHB1YmxpYyB2ZXJzaW9ucyBvZiBAYyBwdWJmb28gZGlzcGF0Y2ggdG8gdGhlIHByb3RlY3RlZAorICAgICAgICogIGRlcml2ZWQgQGMgZm9vIG1lbWJlciBmdW5jdGlvbnMsIHBhc3NpbmcgdGhlIGFyZ3VtZW50cyAoaWYgYW55KQorICAgICAgICogIGFuZCByZXR1cm5pbmcgdGhlIHJlc3VsdCB1bmNoYW5nZWQuCisgICAgICAqLworICAgICAgX19zdHJlYW1idWZfdHlwZSogCisgICAgICBwdWJzZXRidWYoY2hhcl90eXBlKiBfX3MsIHN0cmVhbXNpemUgX19uKSAKKyAgICAgIHsgcmV0dXJuIHRoaXMtPnNldGJ1ZihfX3MsIF9fbik7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBbHRlcnMgdGhlIHN0cmVhbSBwb3NpdGlvbi4KKyAgICAgICAqICBAcGFyYW0gIF9fb2ZmICBPZmZzZXQuCisgICAgICAgKiAgQHBhcmFtICBfX3dheSAgVmFsdWUgZm9yIGlvc19iYXNlOjpzZWVrZGlyLgorICAgICAgICogIEBwYXJhbSAgX19tb2RlIFZhbHVlIGZvciBpb3NfYmFzZTo6b3Blbm1vZGUuCisgICAgICAgKgorICAgICAgICogIENhbGxzIHZpcnR1YWwgc2Vla29mZiBmdW5jdGlvbi4KKyAgICAgICovCisgICAgICBwb3NfdHlwZSAKKyAgICAgIHB1YnNlZWtvZmYob2ZmX3R5cGUgX19vZmYsIGlvc19iYXNlOjpzZWVrZGlyIF9fd2F5LCAKKwkJIGlvc19iYXNlOjpvcGVubW9kZSBfX21vZGUgPSBpb3NfYmFzZTo6aW4gfCBpb3NfYmFzZTo6b3V0KQorICAgICAgeyByZXR1cm4gdGhpcy0+c2Vla29mZihfX29mZiwgX193YXksIF9fbW9kZSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBbHRlcnMgdGhlIHN0cmVhbSBwb3NpdGlvbi4KKyAgICAgICAqICBAcGFyYW0gIF9fc3AgIFBvc2l0aW9uCisgICAgICAgKiAgQHBhcmFtICBfX21vZGUgVmFsdWUgZm9yIGlvc19iYXNlOjpvcGVubW9kZS4KKyAgICAgICAqCisgICAgICAgKiAgQ2FsbHMgdmlydHVhbCBzZWVrcG9zIGZ1bmN0aW9uLgorICAgICAgKi8KKyAgICAgIHBvc190eXBlIAorICAgICAgcHVic2Vla3Bvcyhwb3NfdHlwZSBfX3NwLAorCQkgaW9zX2Jhc2U6Om9wZW5tb2RlIF9fbW9kZSA9IGlvc19iYXNlOjppbiB8IGlvc19iYXNlOjpvdXQpCisgICAgICB7IHJldHVybiB0aGlzLT5zZWVrcG9zKF9fc3AsIF9fbW9kZSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDYWxscyB2aXJ0dWFsIHN5bmMgZnVuY3Rpb24uCisgICAgICAqLworICAgICAgaW50IAorICAgICAgcHVic3luYygpIHsgcmV0dXJuIHRoaXMtPnN5bmMoKTsgfQorICAgICAgLy9AfQorCisgICAgICAvLyBbMjcuNS4yLjIuM10gZ2V0IGFyZWEKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTG9va2luZyBhaGVhZCBpbnRvIHRoZSBzdHJlYW0uCisgICAgICAgKiAgQHJldHVybi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kJICAgICAgIF9fcmV0KSwgdHJ1ZSkpCisJICBfX3JldCA9IHRoaXMtPnNnZXRjKCk7CisJcmV0dXJuIF9fcmV0OworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEdldHRpbmcgdGhlIG5leHQgY2hhcmFjdGVyLgorICAgICAgICogIEByZXR1cm4gIFRoZSBuZXh0IGNoYXJhY3Rlciwgb3IgZW9mLgorICAgICAgICoKKyAgICAgICAqICBJZiB0aGUgaW5wdXQgcmVhZCBwb3NpdGlvbiBpcyBhdmFpbGFibGUsIHJldHVybnMgdGhhdCBjaGFyYWN0ZXIKKyAgICAgICAqICBhbmQgaW5jcmVtZW50cyB0aGUgcmVhZCBwb2ludGVyLCBvdGhlcndpc2UgY2FsbHMgYW5kIHJldHVybnMKKyAgICAgICAqICBAYyB1ZmxvdygpLgorICAgICAgKi8KKyAgICAgIGludF90eXBlIAorICAgICAgc2J1bXBjKCkKKyAgICAgIHsKKwlpbnRfdHlwZSBfX3JldDsKKwlpZiAoX19idWlsdGluX2V4cGVjdCh0aGlzLT5ncHRyKCkgPCB0aGlzLT5lZ3B0cigpLCB0cnVlKSkKKwkgIHsKKwkgICAgX19yZXQgPSB0cmFpdHNfdHlwZTo6dG9faW50X3R5cGUoKnRoaXMtPmdwdHIoKSk7CisJICAgIHRoaXMtPmdidW1wKDEpOworCSAgfQorCWVsc2UgCisJICBfX3JldCA9IHRoaXMtPnVmbG93KCk7CisJcmV0dXJuIF9fcmV0OworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEdldHRpbmcgdGhlIG5leHQgY2hhcmFjdGVyLgorICAgICAgICogIEByZXR1cm4gIFRoZSBuZXh0IGNoYXJhY3Rlciwgb3IgZW9mLgorICAgICAgICoKKyAgICAgICAqICBJZiB0aGUgaW5wdXQgcmVhZCBwb3NpdGlvbiBpcyBhdmFpbGFibGUsIHJldHVybnMgdGhhdCBjaGFyYWN0ZXIsCisgICAgICAgKiAgb3RoZXJ3aXNlIGNhbGxzIGFuZCByZXR1cm5zIEBjIHVuZGVyZmxvdygpLiAgRG9lcyBub3QgbW92ZSB0aGUgCisgICAgICAgKiAgcmVhZCBwb3NpdGlvbiBhZnRlciBmZXRjaGluZyB0aGUgY2hhcmFjdGVyLgorICAgICAgKi8KKyAgICAgIGludF90eXBlIAorICAgICAgc2dldGMoKQorICAgICAgeworCWludF90eXBlIF9fcmV0OworCWlmIChfX2J1aWx0aW5fZXhwZWN0KHRoaXMtPmdwdHIoKSA8IHRoaXMtPmVncHRyKCksIHRydWUpKQorCSAgX19yZXQgPSB0cmFpdHNfdHlwZTo6dG9faW50X3R5cGUoKnRoaXMtPmdwdHIoKSk7CisJZWxzZSAKKwkgIF9fcmV0ID0gdGhpcy0+dW5kZXJmbG93KCk7CisJcmV0dXJuIF9fcmV0OworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEVudHJ5IHBvaW50IGZvciB4c2dldG4uCisgICAgICAgKiAgQHBhcmFtICBfX3MgIEEgYnVmZmVyIGFyZWEuCisgICAgICAgKiAgQHBhcmFtICBfX24gIEEgY291bnQuCisgICAgICAgKgorICAgICAgICogIFJldHVybnMgeHNnZXRuKF9fcyxfX24pLiAgVGhlIGVmZmVjdCBpcyB0byBmaWxsIEBhIF9fc1swXSB0aHJvdWdoCisgICAgICAgKiAgQGEgX19zW19fbi0xXSB3aXRoIGNoYXJhY3RlcnMgZnJvbSB0aGUgaW5wdXQgc2VxdWVuY2UsIGlmIHBvc3NpYmxlLgorICAgICAgKi8KKyAgICAgIHN0cmVhbXNpemUgCisgICAgICBzZ2V0bihjaGFyX3R5cGUqIF9fcywgc3RyZWFtc2l6ZSBfX24pCisgICAgICB7IHJldHVybiB0aGlzLT54c2dldG4oX19zLCBfX24pOyB9CisKKyAgICAgIC8vIFsyNy41LjIuMi40XSBwdXRiYWNrCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFB1c2hpbmcgY2hhcmFj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ICAqICBAcGFyYW0gIF9fbiAgVGhlIGRlbHRhIGJ5IHdoaWNoIHRvIG1vdmUuCisgICAgICAgKgorICAgICAgICogIFRoaXMganVzdCBhZHZhbmNlcyB0aGUgcmVhZCBwb3NpdGlvbiB3aXRob3V0IHJldHVybmluZyBhbnkgZGF0YS4KKyAgICAgICovCisgICAgICB2b2lkIAorICAgICAgZ2J1bXAoaW50IF9fbikgeyBfTV9pbl9jdXIgKz0gX19uOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgU2V0dGluZyB0aGUgdGhyZWUgcmVhZCBhcmVhIHBvaW50ZXJzLgorICAgICAgICogIEBwYXJhbSAgX19nYmVnICBBIHBvaW50ZXIuCisgICAgICAgKiAgQHBhcmFtICBfX2duZXh0ICBBIHBvaW50ZXIuCisgICAgICAgKiAgQHBhcmFtICBfX2dlbmQgIEEgcG9pbnRlci4KKyAgICAgICAqICBAcG9zdCAgQGEgX19nYmVnID09IEBjIGViYWNrKCksIEBhIF9fZ25leHQgPT0gQGMgZ3B0cigpLCBhbmQKKyAgICAgICAqICAgICAgICAgQGEgX19nZW5kID09IEBjIGVncHRyKCkKKyAgICAgICovCisgICAgICB2b2lkIAorICAgICAgc2V0ZyhjaGFyX3R5cGUqIF9fZ2JlZywgY2hhcl90eXBlKiBfX2duZXh0LCBjaGFyX3R5cGUqIF9fZ2VuZCkKKyAgICAgIHsKKwlfTV9pbl9iZWcgPSBfX2diZWc7CisJX01faW5fY3VyID0gX19nbmV4dDsKKwlfTV9pbl9lbmQgPSBfX2dlbmQ7CisgICAgICB9CisKKyAgICAgIC8vIFsyNy41LjIuMy4yXSBwdXQgYXJlYSBhY2Nlc3MKKyAgICAgIC8vQHsKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQWNjZXNzIHRvIHRoZSBwdXQgYXJlYS4KKyAgICAgICAqCisgICAgICAgKiAgVGhlc2UgZnVuY3Rpb25zIGFyZSBvbmx5IGF2YWlsYWJsZSB0byBvdGhlciBwcm90ZWN0ZWQgZnVuY3Rpb25zLAorICAgICAgICogIGluY2x1ZGluZyBkZXJpdmVkIGNsYXNzZXMuCisgICAgICAgKgorICAgICAgICogIC0gcGJhc2UoKSByZXR1cm5zIHRoZSBiZWdpbm5pbmcgcG9pbnRlciBmb3IgdGhlIG91dHB1dCBzZXF1ZW5jZQorICAgICAgICogIC0gcHB0cigpIHJldHVybnMgdGhlIG5leHQgcG9pbnRlciBmb3IgdGhlIG91dHB1dCBzZXF1ZW5jZQorICAgICAgICogIC0gZXBwdHIoKSByZXR1cm5zIHRoZSBlbmQgcG9pbnRlciBmb3IgdGhlIG91dHB1dCBzZXF1ZW5jZQorICAgICAgKi8KKyAgICAgIGNoYXJfdHlwZSogCisgICAgICBwYmFzZSgpIGNvbnN0IHsgcmV0dXJuIF9NX291dF9iZWc7IH0KKworICAgICAgY2hhcl90eXBlKiAKKyAgICAgIHBwdHIoKSBjb25zdCB7IHJldHVybiBfTV9vdXRfY3VyOyB9CisKKyAgICAgIGNoYXJfdHlwZSogCisgICAgICBlcHB0cigpIGNvbnN0IHsgcmV0dXJuIF9NX291dF9lbmQ7IH0KKyAgICAgIC8vQH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBNb3ZpbmcgdGhlIHdyaXRlIHBvc2l0aW9uLgorICAgICAgICogIEBwYXJhbSAgX19uICBUaGUgZGVsdGEgYnkgd2hpY2ggdG8gbW92ZS4KKyAgICAgICAqCisgICAgICAgKiAgVGhpcyBqdXN0IGFkdmFuY2VzIHRoZSB3cml0ZSBwb3NpdGlvbiB3aXRob3V0IHJldHVybmluZyBhbnkgZGF0YS4KKyAgICAgICovCisgICAgICB2b2lkIAorICAgICAgcGJ1bXAoaW50IF9fbikgeyBfTV9vdXRfY3VyICs9IF9fbjsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIFNldHRpbmcgdGhlIHRocmVlIHdyaXRlIGFyZWEgcG9pbnRlcnMuCisgICAgICAgKiAgQHBhcm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ICAgICAgKgorICAgICAgICogIEBub3RlICBCYXNlIGNsYXNzIHZlcnNpb24gZG9lcyBub3RoaW5nLgorICAgICAgKi8KKyAgICAgIHZpcnR1YWwgdm9pZCAKKyAgICAgIGltYnVlKGNvbnN0IGxvY2FsZSYgX19sb2MpIAorICAgICAgeyB9CisKKyAgICAgIC8vIFsyNy41LjIuNC4yXSBidWZmZXIgbWFuYWdlbWVudCBhbmQgcG9zaXRpb25pbmcKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTWFuaXB1bGF0ZXMgdGhlIGJ1ZmZlci4KKyAgICAgICAqCisgICAgICAgKiAgRWFjaCBkZXJpdmVkIGNsYXNzIHByb3ZpZGVzIGl0cyBvd24gYXBwcm9wcmlhdGUgYmVoYXZpb3IuICBTZWUKKyAgICAgICAqICB0aGUgbmV4dC10by1sYXN0IHBhcmFncmFwaCBvZiAKKyAgICAgICAqICBodHRwOi8vZ2NjLmdudS5vcmcvb25saW5lZG9jcy9saWJzdGRjKysvbWFudWFsL2JrMDFwdDExY2gyNXMwMi5odG1sCisgICAgICAgKiAgZm9yIG1vcmUgb24gdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqCisgICAgICAgKiAgQG5vdGUgIEJhc2UgY2xhc3MgdmVyc2lvbiBkb2VzIG5vdGhpbmcsIHJldHVybnMgQGMgdGhpcy4KKyAgICAgICovCisgICAgICB2aXJ0dWFsIGJhc2ljX3N0cmVhbWJ1ZjxjaGFyX3R5cGUsX1RyYWl0cz4qIAorICAgICAgc2V0YnVmKGNoYXJfdHlwZSosIHN0cmVhbXNpemUpCisgICAgICB7CXJldHVybiB0aGlzOyB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQWx0ZXJzIHRoZSBzdHJlYW0gcG9zaXRpb25zLgorICAgICAgICoKKyAgICAgICAqICBFYWNoIGRlcml2ZWQgY2xhc3MgcHJvdmlkZXMgaXRzIG93biBhcHByb3ByaWF0ZSBiZWhhdmlvci4KKyAgICA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orICB7IHJldHVybiAhKF9fbGhzID09IF9fcmhzKTsgfQorCisgIGlubGluZSBib29sCisgIG9wZXJhdG9yIT0oY29uc3QgZXJyb3JfY29kZSYgX19saHMsIGNvbnN0IGVycm9yX2NvbmRpdGlvbiYgX19yaHMpIG5vZXhjZXB0CisgIHsgcmV0dXJuICEoX19saHMgPT0gX19yaHMpOyB9CisKKyAgaW5saW5lIGJvb2wKKyAgb3BlcmF0b3IhPShjb25zdCBlcnJvcl9jb25kaXRpb24mIF9fbGhzLCBjb25zdCBlcnJvcl9jb2RlJiBfX3Jocykgbm9leGNlcHQKKyAgeyByZXR1cm4gIShfX2xocyA9PSBfX3Jocyk7IH0KKworICBpbmxpbmUgYm9vbAorICBvcGVyYXRvciE9KGNvbnN0IGVycm9yX2NvbmRpdGlvbiYgX19saHMsCisJICAgICBjb25zdCBlcnJvcl9jb25kaXRpb24mIF9fcmhzKSBub2V4Y2VwdAorICB7IHJldHVybiAhKF9fbGhzID09IF9fcmhzKTsgfQorCisKKyAgLyoqIAorICAgKiAgQGJyaWVmIFRocm93biB0byBpbmRpY2F0ZSBlcnJvciBjb2RlIG9mIHVuZGVybHlpbmcgc3lzdGVtLgorICAgKgorICAgKiAgQGluZ3JvdXAgZXhjZXB0aW9ucworICAgKi8KKyAgY2xhc3Mgc3lzdGVtX2Vycm9yIDogcHVibGljIHN0ZDo6cnVudGltZV9lcnJvcgorICB7CisgIHByaXZhdGU6CisgICAgZXJyb3JfY29kZSAJX01fY29kZTsKKworICBwdWJsaWM6CisgICAgc3lzdGVtX2Vycm9yKGVycm9yX2NvZGUgX19lYyA9IGVycm9yX2NvZGUoKSkKKyAgICA6IHJ1bnRpbWVfZXJyb3IoX19lYy5tZXNzYWdlKCkpLCBfTV9jb2RlKF9fZWMpIHsgfQorCisgICAgc3lzdGVtX2Vycm9yKGVycm9yX2NvZGUgX19lYywgY29uc3Qgc3RyaW5nJiBfX3doYXQpCisgICAgOiBydW50aW1lX2Vycm9yKF9fd2hhdCAr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0dXJuIGNvbnN0X3JldmVyc2VfaXRlcmF0b3IoZW5kKCkpOyB9CisKKyAgICAgIHJldmVyc2VfaXRlcmF0b3IgCisgICAgICByZW5kKCkKKyAgICAgIHsgcmV0dXJuIHJldmVyc2VfaXRlcmF0b3IoYmVnaW4oKSk7IH0KKworICAgICAgY29uc3RfcmV2ZXJzZV9pdGVyYXRvciAKKyAgICAgIHJlbmQoKSBjb25zdAorICAgICAgeyByZXR1cm4gY29uc3RfcmV2ZXJzZV9pdGVyYXRvcihiZWdpbigpKTsgfQorCisgICAgICAvLyBDYXBhY2l0eS4KKyAgICAgIHNpemVfdHlwZSAKKyAgICAgIHNpemUoKSBjb25zdCB7IHJldHVybiBfTm07IH0KKworICAgICAgc2l6ZV90eXBlIAorICAgICAgbWF4X3NpemUoKSBjb25zdCB7IHJldHVybiBfTm07IH0KKworICAgICAgYm9vbCAKKyAgICAgIGVtcHR5KCkgY29uc3QgeyByZXR1cm4gc2l6ZSgpID09IDA7IH0KKworICAgICAgLy8gRWxlbWVudCBhY2Nlc3MuCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fbikKKyAgICAgIHsgcmV0dXJuIF9NX2luc3RhbmNlW19fbl07IH0KKworICAgICAgY29uc3RfcmVmZXJlbmNlCisgICAgICBvcGVyYXRvcltdKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9pbnN0YW5jZVtfX25dOyB9CisKKyAgICAgIHJlZmVyZW5jZQorICAgICAgYXQoc2l6ZV90eXBlIF9fbikKKyAgICAgIHsKKwlpZiAoX19uID49IF9ObSkKKwkgIHN0ZDo6X190aHJvd19vdXRfb2ZfcmFuZ2UoX19OKCJhcnJheTo6YXQiKSk7CisJcmV0dXJuIF9NX2luc3RhbmNlW19fbl07CisgICAgICB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgYXQoc2l6ZV90eXBlIF9fbikgY29uc3QKKyAgICAgIHsKKwlpZiAoX19uID49IF9ObSkKKwkgIHN0ZDo6X190aHJvd19vdXRfb2ZfcmFuZ2UoX19OKCJhcnJheTo6YXQiKSk7CisJcmV0dXJuIF9NX2luc3RhbmNlW19fbl07CisgICAgICB9CisKKyAgICAgIHJlZmVyZW5jZSAKKyAgICAgIGZyb250KCkKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZSAKKyAgICAgIGZyb250KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICpiZWdpbigpOyB9CisKKyAgICAgIHJlZmVyZW5jZSAKKyAgICAgIGJhY2soKQorICAgICAgeyByZXR1cm4gX05tID8gKihlbmQoKSAtIDEpIDogKmVuZCgpOyB9CisKKyAgICAgIGNvbnN0X3JlZmVyZW5jZSAKKyAgICAgIGJhY2soKSBjb25zdAorICAgICAgeyByZXR1cm4gX05tID8gKihlbmQoKSAtIDEpIDogKmVuZCgpOyB9CisKKyAgICAgIF9UcCoKKyAgICAgIGRhdGEoKQorICAgICAgeyByZXR1cm4gc3RkOjpfX2FkZHJlc3NvZihfTV9pbnN0YW5jZVswXSk7IH0KKworICAgICAgY29uc3QgX1RwKgorICAgICAgZGF0YSgpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKF9NX2luc3RhbmNlWzBdKTsgfQorICAgIH07CisKKyAgLy8gQXJyYXkgY29tcGFyaXNvbnMuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgc3RkOjpzaXplX3QgX05tPgorICAgIGlubGluZSBib29sIAorICAgIG9wZXJhdG9yPT0oY29uc3QgYXJyYXk8X1RwLCBfTm0+JiBfX29uZSwgY29uc3QgYXJyYXk8X1RwLCBfTm0+JiBfX3R3bykKKyAgICB7IHJldHVybiBzdGQ6OmVxdWFsKF9fb25lLmJlZ2luKCksIF9fb25lLmVuZCgpLCBfX3R3by5iZWdpbigpKTsgfQorCisgIHRlbXBsYX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gICAgICAgICAgICBfX0pudSA9IF9UcCgxKTsKKyAgICAgICAgICAgICAgX19KcG51ID0gX1RwKDApOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgaWYgKF9fbnUgPT0gX1RwKDEpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX0pudSA9IF9UcCgwKTsKKyAgICAgICAgICAgICAgX19KcG51ID0gX1RwKDAuNUwpOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19KbnUgPSBfVHAoMCk7CisgICAgICAgICAgICAgIF9fSnBudSA9IF9UcCgwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBfX05udSA9IC1zdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmluZmluaXR5KCk7CisgICAgICAgICAgX19OcG51ID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjppbmZpbml0eSgpOworICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICBjb25zdCBfVHAgX19lcHMgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKTsKKyAgICAgIC8vICBXaGVuIHRoZSBtdWx0aXBsaWVyIGlzIE4gaS5lLgorICAgICAgLy8gIGZwX21pbiA9IE4gKiBtaW4oKQorICAgICAgLy8gIFRoZW4gSl8wIGFuZCBOXzAgdGFuayBhdCB4ID0gOCAqIE4gKEpfMCA9IDAgYW5kIE5fMCA9IG5hbikhCisgICAgICAvL2NvbnN0IF9UcCBfX2ZwX21pbiA9IF9UcCgyMCkgKiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1pbigpOworICAgICAgY29uc3QgX1RwIF9fZnBfbWluID0gc3RkOjpzcXJ0KHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6bWluKCkpOworICAgICAgY29uc3QgaW50IF9fbWF4X2l0ZXIgPSAxNTAwMDsKKyAgICAgIGNvbnN0IF9UcCBfX3hfbWluID0gX1RwKDIpOworCisgICAgICBjb25zdCBpbnQgX19ubCA9IChfX3ggPCBfX3hfbWluCisgICAgICAgICAgICAgICAgICAgID8gc3RhdGljX2Nhc3Q8aW50PihfX251ICsgX1RwKDAuNUwpKQorICAgICAgICAgICAgICAgICAgICA6IHN0ZDo6bWF4KDAsIHN0YXRpY19jYXN0PGludD4oX19udSAtIF9feCArIF9UcCgxLjVMKSkpKTsKKworICAgICAgY29uc3QgX1RwIF9fbXUgPSBfX251IC0gX19ubDsKKyAgICAgIGNvbnN0IF9UcCBfX211MiA9IF9fbXUgKiBfX211OworICAgICAgY29uc3QgX1RwIF9feGkgPSBfVHAoMSkgLyBfX3g7CisgICAgICBjb25zdCBfVHAgX194aTIgPSBfVHAoMikgKiBfX3hpOworICAgICAgX1RwIF9fdyA9IF9feGkyIC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisgICAgICBpbnQgX19pc2lnbiA9IDE7CisgICAgICBfVHAgX19oID0gX19udSAqIF9feGk7CisgICAgICBpZiAoX19oIDwgX19mcF9taW4pCisgICAgICAgIF9faCA9IF9fZnBfbWluOworICAgICAgX1RwIF9fYiA9IF9feGkyICogX19udTsKKyAgICAgIF9UcCBfX2QgPSBfVHAoMCk7CisgICAgICBfVHAgX19jID0gX19oOworICAgICAgaW50IF9faTsKKyAgICAgIGZvciAoX19pID0gMTsgX19pIDw9IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX19iICs9IF9feGkyOworICAgICAgICAgIF9fZCA9IF9fYiAtIF9fZDsKKyAgICAgICAgICBpZiAoc3RkOjphYnMoX19kKSA8IF9fZnBfbWluKQorICAgICAgICAgICAgX19kID0gX19mcF9taW47CisgICAgICAgICAgX19jID0gX19iIC0gX1RwKDEpIC8gX19jOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2MpIDwgX19mcF9taW4pCisgICAgICAgICAgICBfX2MgPSBfX2ZwX21pbjsKKyAgICAgICAgICBfX2QgPSBfVHAoMSkgLyBfX2Q7CisgICAgICAgICAgY29uc3QgX1RwIF9fZGVsID0gX19jICogX19kOworICAgICAgICAgIF9faCAqPSBfX2RlbDsKKyAgICAgICAgICBpZiAoX19kIDwgX1RwKDApKQorICAgICAgICAgICAgX19pc2lnbiA9IC1fX2lzaWduOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2RlbCAtIF9UcCgxKSkgPCBfX2VwcykKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICBpZiAoX19pID4gX19tYXhfaXRlcikKKyAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJBcmd1bWVudCB4IHRvbyBsYXJnZSBpbiBfX2Jlc3NlbF9qbjsgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRyeSBhc3ltcHRvdGljIGV4cGFuc2lvbi4iKSk7CisgICAgICBfVHAgX19KbnVsID0gX19pc2lnbiAqIF9fZnBfbWluOworICAgICAgX1RwIF9fSnBudWwgPSBfX2ggKiBfX0pudWw7CisgICAgICBfVHAgX19KbnVsMSA9IF9fSm51bDsKKyAgICAgIF9UcCBfX0pwbnUxID0gX19KcG51bDsKKyAgICAgIF9UcCBfX2ZhY3QgPSBfX251ICogX194aTsKKyAgICAgIGZvciAoIGludCBfX2wgPSBfX25sOyBfX2wgPj0gMTsgLS1fX2wgKQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fSm51dGVtcCA9IF9fZmFjdCAqIF9fSm51bCArIF9fSnBudWw7CisgICAgICAgICAgX19mYWN0IC09IF9feGk7CisgICAgICAgICAgX19KcG51bCA9IF9fZmFjdCAqIF9fSm51dGVtcCAtIF9fSm51bDsKKyAgICAgICAgICBfX0pudWwgPSBfX0pudXRlbXA7CisgICAgICAgIH0KKyAgICAgIGlmIChfX0pudWwgPT0gX1RwKDApKQorICAgICAgICBfX0pudWwgPSBfX2VwczsKKyAgICAgIF9UcCBfX2Y9IF9fSnBudWwgLyBfX0pudWw7CisgICAgICBfVHAgX19ObXUsIF9fTm51MSwgX19OcG11LCBfX0ptdTsKKyAgICAgIGlmIChfX3ggPCBfX3hfbWluKQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9feDIgPSBfX3ggLyBfVHAoMik7CisgICAgICAgICAgY29uc3QgX1RwIF9fcGltdSA9IF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpICogX19tdTsKKyAgICAgICAgICBfVHAgX19mYWN0ID0gKHN0ZDo6YWJzKF9fcGltdSkgPCBfX2VwcworICAgICAgICAgICAgICAgICAgICAgID8gX1RwKDEpIDogX19waW11IC8gc3RkOjpzaW4oX19waW11KSk7CisgICAgICAgICAgX1RwIF9fZCA9IC1zdGQ6OmxvZyhfX3gyKTsKKyAgICAgICAgICBfVHAgX19lID0gX19tdSAqIF9fZDsKKyAgICAgICAgICBfVHAgX19mYWN0MiA9IChzdGQ6OmFicyhfX2UpIDwgX19lcHMKKyAgICAgICAgICAgICAgICAgICAgICAgPyBfVHAoMSkgOiBzdGQ6OnNpbmgoX19lKSAvIF9fZSk7CisgICAgICAgICAgX1RwIF9fZ2FtMSwgX19nYW0yLCBfX2dhbXBsLCBfX2dhbW1pOworICAgICAgICAgIF9fZ2FtbWFfdGVtbWUoX19tdSwgX19nYW0xLCBfX2dhbTIsIF9fZ2FtcGwsIF9fZ2FtbWkpOworICAgICAgICAgIF9UcCBfX2ZmID0gKF9UcCgyKSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpKQorICAgICAgICAgICAgICAgICAgICogX19mYWN0ICogKF9fZ2FtMSAqIHN0ZDo6Y29zaChfX2UpICsgX19nYW0yICogX19mYWN0MiAqIF9fZCk7CisgICAgICAgICAgX19lID0gc3RkOjpleHAoX19lKTsKKyAgICAgICAgICBfVHAgX19wID0gX19lIC8gKF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpICogX19nYW1wbCk7CisgICAgICAgICAgX1RwIF9fcSA9IF9UcCgxKSAvIChfX2UgKiBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKSAqIF9fZ2FtbWkpOworICAgICAgICAgIGNvbnN0IF9UcCBfX3BpbXUyID0gX19waW11IC8gX1RwKDIpOworICAgICAgICAgIF9UcCBfX2ZhY3QzID0gKHN0ZDo6YWJzKF9fcGltdTIpIDwgX19lcHMKKyAgICAgICAgICAgICAgICAgICAgICAgPyBfVHAoMSkgOiBzdGQ6OnNpbihfX3BpbXUyKSAvIF9fcGltdTIgKTsKKyAgICAgICAgICBfVHAgX19yID0gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCkgKiBfX3BpbXUyICogX19mYWN0MyAqIF9fZmFjdDM7CisgICAgICAgICAgX1RwIF9fYyA9IF9UcCgxKTsKKyAgICAgICAgICBfX2QgPSAtX194MiAqIF9feDI7CisgICAgICAgICAgX1RwIF9fc3VtID0gX19mZiArIF9fciAqIF9fcTsKKyAgICAgICAgICBfVHAgX19zdW0xID0gX19wOworICAgICAgICAgIGZvciAoX19pID0gMTsgX19pIDw9IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX2ZmID0gKF9faSAqIF9fZmYgKyBfX3AgKyBfX3EpIC8gKF9faSAqIF9faSAtIF9fbXUyKTsKKyAgICAgICAgICAgICAgX19jICo9IF9fZCAvIF9UcChfX2kpOworICAgICAgICAgICAgICBfX3AgLz0gX1RwKF9faSkgLSBfX211OworICAgICAgICAgICAgICBfX3EgLz0gX1RwKF9faSkgKyBfX211OworICAgICAgICAgICAgICBjb25zdCBfVHAgX19kZWwgPSBfX2MgKiAoX19mZiArIF9fciAqIF9fcSk7CisgICAgICAgICAgICAgIF9fc3VtICs9IF9fZGVsOyAKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9fZGVsMSA9IF9fYyAqIF9fcCAtIF9faSAqIF9fZGVsOworICAgICAgICAgICAgICBfX3N1bTEgKz0gX19kZWwxOworICAgICAgICAgICAgICBpZiAoIHN0ZDo6YWJzKF9fZGVsKSA8IF9fZXBzICogKF9UcCgxKSArIHN0ZDo6YWJzKF9fc3VtKSkgKQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgIGlmICggX19pID4gX19tYXhfaXRlciApCisgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIkJlc3NlbCB5IHNlcmllcyBmYWlsZWQgdG8gY29udmVyZ2UgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2Jlc3NlbF9qbi4iKSk7CisgICAgICAgICAgX19ObXUgPSAtX19zdW07CisgICAgICAgICAgX19ObnUxID0gLV9fc3VtMSAqIF9feGkyOworICAgICAgICAgIF9fTnBtdSA9IF9fbXUgKiBfX3hpICogX19ObXUgLSBfX05udTE7CisgICAgICAgICAgX19KbXUgPSBfX3cgLyAoX19OcG11IC0gX19mICogX19ObXUpOworICAgICAgICB9CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19hID0gX1RwKDAuMjVMKSAtIF9fbXUyOworICAgICAgICAgIF9UcCBfX3EgPSBfVHAoMSk7CisgICAgICAgICAgX1RwIF9fcCA9IC1fX3hpIC8gX1RwKDIpOworICAgICAgICAgIF9UcCBfX2JyID0gX1RwKDIpICogX194OworICAgICAgICAgIF9UcCBfX2JpID0gX1RwKDIpOworICAgICAgICAgIF9UcCBfX2ZhY3QgPSBfX2EgKiBfX3hpIC8gKF9fcCAqIF9fcCArIF9fcSAqIF9fcSk7CisgICAgICAgICAgX1RwIF9fY3IgPSBfX2JyICsgX19xICogX19mYWN0OworICAgICAgICAgIF9UcCBfX2NpID0gX19iaSArIF9fcCAqIF9fZmFjdDsKKyAgICAgICAgICBfVHAgX19kZW4gPSBfX2JyICogX19iciArIF9fYmkgKiBfX2JpOworICAgICAgICAgIF9UcCBfX2RyID0gX19iciAvIF9fZGVuOworICAgICAgICAgIF9UcCBfX2RpID0gLV9fYmkgLyBfX2RlbjsKKyAgICAgICAgICBfVHAgX19kbHIgPSBfX2NyICogX19kciAtIF9fY2kgKiBfX2RpOworICAgICAgICAgIF9UcCBfX2RsaSA9IF9fY3IgKiBfX2RpICsgX19jaSAqIF9fZHI7CisgICAgICAgICAgX1RwIF9fdGVtcCA9IF9fcCAqIF9fZGxyIC0gX19xICogX19kbGk7CisgICAgICAgICAgX19xID0gX19wICogX19kbGkgKyBfX3EgKiBfX2RscjsKKyAgICAgICAgICBfX3AgPSBfX3RlbXA7CisgICAgICAgICAgaW50IF9faTsKKyAgICAgICAgICBmb3IgKF9faSA9IDI7IF9faSA8PSBfX21heF9pdGVyOyArK19faSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19hICs9IF9UcCgyICogKF9faSAtIDEpKTsKKyAgICAgICAgICAgICAgX19iaSArPSBfVHAoMik7CisgICAgICAgICAgICAgIF9fZHIgPSBfX2EgKiBfX2RyICsgX19icjsKKyAgICAgICAgICAgICAgX19kaSA9IF9fYSAqIF9fZGkgKyBfX2JpOworICAgICAgICAgICAgICBpZiAoc3RkOjphYnMoX19kcikgKyBzdGQ6OmFicyhfX2RpKSA8IF9fZnBfbWluKQorICAgICAgICAgICAgICAgIF9fZHIgPSBfX2ZwX21pbjsKKyAgICAgICAgICAgICAgX19mYWN0ID0gX19hIC8gKF9fY3IgKiBfX2NyICsgX19jaSAqIF9fY2kpOworICAgICAgICAgICAgICBfX2NyID0gX19iciArIF9fY3IgKiBfX2ZhY3Q7CisgICAgICAgICAgICAgIF9fY2kgPSBfX2JpIC0gX19jaSAqIF9fZmFjdDsKKyAgICAgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fY3IpICsgc3RkOjphYnMoX19jaSkgPCBfX2ZwX21pbikKKyAgICAgICAgICAgICAgICBfX2NyID0gX19mcF9taW47CisgICAgICAgICAgICAgIF9fZGVuID0gX19kciAqIF9fZHIgKyBfX2RpICogX19kaTsKKyAgICAgICAgICAgICAgX19kciAvPSBfX2RlbjsKKyAgICAgICAgICAgICAgX19kaSAvPSAtX19kZW47CisgICAgICAgICAgICAgIF9fZGxyID0gX19jciAqIF9fZHIgLSBfX2NpICogX19kaTsKKyAgICAgICAgICAgICAgX19kbGkgPSBfX2NyICogX19kaSArIF9fY2kgKiBfX2RyOworICAgICAgICAgICAgICBfX3RlbXAgPSBfX3AgKiBfX2RsciAtIF9fcSAqIF9fZGxpOworICAgICAgICAgICAgICBfX3EgPSBfX3AgKiBfX2RsaSArIF9fcSAqIF9fZGxyOworICAgICAgICAgICAgICBfX3AgPSBfX3RlbXA7CisgICAgICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2RsciAtIF9UcCgxKSkgKyBzdGQ6OmFicyhfX2RsaSkgPCBfX2VwcykKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICB9CisgICAgICAgICAgaWYgKF9faSA+IF9fbWF4X2l0ZXIpCisgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIkxlbnR6J3MgbWV0aG9kIGZhaWxlZCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fYmVzc2VsX2puLiIpKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19nYW0gPSAoX19wIC0gX19mKSAvIF9fcTsKKyAgICAgICAgICBfX0ptdSA9IHN0ZDo6c3FydChfX3cgLyAoKF9fcCAtIF9fZikgKiBfX2dhbSArIF9fcSkpOworI2lmIF9HTElCQ1hYX1VTRV9DOTlfTUFUSF9UUjEKKyAgICAgICAgICBfX0ptdSA9IHN0ZDo6dHIxOjpjb3B5c2lnbihfX0ptdSwgX19KbnVsKTsKKyNlbHNlCisgICAgICAgICAgaWYgKF9fSm11ICogX19KbnVsIDwgX1RwKDApKQorICAgICAgICAgICAgX19KbXUgPSAtX19KbXU7CisjZW5kaWYKKyAgICAgICAgICBfX05tdSA9IF9fZ2FtICogX19KbXU7CisgICAgICAgICAgX19OcG11ID0gKF9fcCArIF9fcSAvIF9fZ2FtKSAqIF9fTm11OworICAgICAgICAgIF9fTm51MSA9IF9fbXUgKiBfX3hpICogX19ObXUgLSBfX05wbXU7CisgICAgICB9CisgICAgICBfX2ZhY3QgPSBfX0ptdSAvIF9fSm51bDsKKyAgICAgIF9fSm51ID0gX19mYWN0ICogX19KbnVsMTsKKyAgICAgIF9fSnBudSA9IF9fZmFjdCAqIF9fSnBudTE7CisgICAgICBmb3IgKF9faSA9IDE7IF9faSA8PSBfX25sOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX05udXRlbXAgPSAoX19tdSArIF9faSkgKiBfX3hpMiAqIF9fTm51MSAtIF9fTm11OworICAgICAgICAgIF9fTm11ID0gX19ObnUxOworICAgICAgICAgIF9fTm51MSA9IF9fTm51dGVtcDsKKyAgICAgICAgfQorICAgICAgX19ObnUgPSBfX05tdTsKKyAgICAgIF9fTnBudSA9IF9fbnUgKiBfX3hpICogX19ObXUgLSBfX05udTE7CisKKyAgICAgIHJldHVybjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFRoaXMgcm91dGluZSBjb21wdXRlcyB0aGUgYXN5bXB0b3RpYyBjeWxpbmRyaWNhbCBCZXNzZWwKKyAgICAgKiAgICAgICAgICBhbmQgTmV1bWFubiBmdW5jdGlvbnMgb2Ygb3JkZXIgbnU6IFxmJCBKX3tcbnV9IFxmJCwKKyAgICAgKiAgICAgICAgICBcZiQgTl97XG51fSBcZiQuCisgICAgICoKKyAgICAgKiAgIFJlZmVyZW5jZXM6CisgICAgICogICAgKDEpIEhhbmRib29rIG9mIE1hdGhlbWF0aWNhbCBGdW5jdGlvbnMsCisgICAgICogICAgICAgIGVkLiBNaWx0b24gQWJyYW1vd2l0eiBhbmQgSXJlbmUgQS4gU3RlZ3VuLAorICAgICAqICAgICAg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19tdW00OSA9IF9fbXUgLSBfVHAoNDkpOworICAgICAgY29uc3QgX1RwIF9feHggPSBfVHAoNjQpICogX194ICogX194OworICAgICAgY29uc3QgX1RwIF9fUCA9IF9UcCgxKSAtIF9fbXVtMSAqIF9fbXVtOSAvIChfVHAoMikgKiBfX3h4KQorICAgICAgICAgICAgICAgICAgICAqIChfVHAoMSkgLSBfX211bTI1ICogX19tdW00OSAvIChfVHAoMTIpICogX194eCkpOworICAgICAgY29uc3QgX1RwIF9fUSA9IF9fbXVtMSAvIChfVHAoOCkgKiBfX3gpCisgICAgICAgICAgICAgICAgICAgICogKF9UcCgxKSAtIF9fbXVtOSAqIF9fbXVtMjUgLyAoX1RwKDYpICogX194eCkpOworCisgICAgICBjb25zdCBfVHAgX19jaGkgPSBfX3ggLSAoX19udSArIF9UcCgwLjVMKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waV8yKCk7CisgICAgICBjb25zdCBfVHAgX19jID0gc3RkOjpjb3MoX19jaGkpOworICAgICAgY29uc3QgX1RwIF9fcyA9IHN0ZDo6c2luKF9fY2hpKTsKKworICAgICAgX19KbnUgPSBfX2NvZWYgKiAoX19jICogX19QIC0gX19zICogX19RKTsKKyAgICAgIF9fTm51ID0gX19jb2VmICogKF9fcyAqIF9fUCArIF9fYyAqIF9fUSk7CisKKyAgICAgIHJldHVybjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFRoaXMgcm91dGluZSByZXR1cm5zIHRoZSBjeWxpbmRyaWNhbCBCZXNzZWwgZnVuY3Rpb25zCisgICAgICogICAgICAgICAgb2Ygb3JkZXIgXGYkIFxudSBcZiQ6IFxmJCBKX3tcbnV9IFxmJCBvciBcZiQgSV97XG51fSBcZiQKKyAgICAgKiAgICAgICAgICBieSBzZXJpZXMgZXhwYW5zaW9uLgorICAgICAqCisgICAgICogICBUaGUgbW9kaWZpZWQgY3lsaW5kcmlj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AgICAgICAgICAgICArMSBmb3IgdGhlIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbiBvZiB0aGUgZmlyc3Qga2luZC4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBvdXRwdXQgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlIDx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19jeWxfYmVzc2VsX2lqX3Nlcmllcyhjb25zdCBfVHAgX19udSwgY29uc3QgX1RwIF9feCwgY29uc3QgX1RwIF9fc2duLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIpCisgICAgeworCisgICAgICBjb25zdCBfVHAgX194MiA9IF9feCAvIF9UcCgyKTsKKyAgICAgIF9UcCBfX2ZhY3QgPSBfX251ICogc3RkOjpsb2coX194Mik7CisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgX19mYWN0IC09IHN0ZDo6dHIxOjpsZ2FtbWEoX19udSArIF9UcCgxKSk7CisjZWxzZQorICAgICAgX19mYWN0IC09IF9fbG9nX2dhbW1hKF9fbnUgKyBfVHAoMSkpOworI2VuZGlmCisgICAgICBfX2ZhY3QgPSBzdGQ6OmV4cChfX2ZhY3QpOworICAgICAgY29uc3QgX1RwIF9feHg0ID0gX19zZ24gKiBfX3gyICogX194MjsKKyAgICAgIF9UcCBfX0puID0gX1RwKDEpOworICAgICAgX1RwIF9fdGVybSA9IF9UcCgxKTsKKworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pID0gMTsgX19pIDwgX19tYXhfaXRlcjsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBfX3Rlcm0gKj0gX194eDQgLyAoX1RwKF9faSkgKiAoX19udSArIF9UcChfX2kpKSk7CisgICAgICAgICAgX19KbiArPSBfX3Rlcm07CisgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fdGVybSAvIF9fSm4pIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gX19mYWN0ICogX19KbjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIEJlc3NlbCBmdW5jdGlvbiBvZiBvcmRlciBcZiQgXG51IFxmJDoKKyAgICAgKiAgICAgICAgICAgXGYkIEpfe1xudX0oeCkgXGYkLgorICAgICAqCisgICAgICogICBUaGUgY3lsaW5kcmljYWwgQmVzc2VsIGZ1bmN0aW9uIGlzOgorICAgICAqICAgQGZbCisgICAgICogICAgSl97XG51fSh4KSA9IFxzdW1fe2s9MH1ee1xpbmZ0eX0KKyAgICAgKiAgICAgICAgICAgICAgXGZyYWN7KC0xKV5rICh4LzIpXntcbnUgKyAya319e2shXEdhbW1hKFxudStrKzEpfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX19udSAgVGhlIG9yZGVyIG9mIHRoZSBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgIFRoZSBhcmd1bWVudCBvZiB0aGUgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIG91dHB1dCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fY3lsX2Jlc3NlbF9qKGNvbnN0IF9UcCBfX251LCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGlmIChfX251IDwgX1RwKDApIHx8IF9feCA8IF9UcCgwKSkKKyAgICAgICAgc3RkOjpfX3Rocm93X2RvbWFpbl9lcnJvcihfX04oIkJhZCBhcmd1bWVudCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2N5bF9iZXNzZWxfai4iKSk7CisgICAgICBlbHNlIGlmIChfX2lzbmFuKF9fbnUpIHx8IF9faXNuYW4oX194KSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChfX3ggKiBfX3ggPCBfVHAoMTApICogKF9fbnUgKyBfVHAoMSkpKQorICAgICAgICByZXR1cm4gX19jeWxfYmVzc2VsX2lqX3NlcmllcyhfX251LCBfX3gsIC1fVHAoMSksIDIwMCk7CisgICAgICBlbHNlIGlmIChfX3ggPiBfVHAoMTAwMCkpCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19KX251LCBfX05fbnU7CisgICAgICAgICAgX19jeWxfYmVzc2VsX2puX2FzeW1wKF9fbnUsIF9feCwgX19KX251LCBfX05fbnUpOworICAgICAgICAgIHJldHVybiBfX0pfbnU7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0pfbnUsIF9fTl9udSwgX19KcF9udSwgX19OcF9udTsKKyAgICAgICAgICBfX2Jlc3NlbF9qbihfX251LCBfX3gsIF9fSl9udSwgX19OX251LCBfX0pwX251LCBfX05wX251KTsKKyAgICAgICAgICByZXR1cm4gX19KX251OworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBOZXVtYW5uIGZ1bmN0aW9uIG9mIG9yZGVyIFxmJCBcbnUgXGYkOgorICAgICAqICAgICAgICAgICBcZiQgTl97XG51fSh4KSBcZiQuCisgICAgICoKKyAgICAgKiAgIFRoZSBOZXVtYW5uIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnk6CisgICAgICogICBAZlsKKyAgICAgKiAgICAgIE5fe1xudX0oeCkgPSBcZnJhY3tKX3tcbnV9KHgpIFxjb3MgXG51XHBpIC0gSl97LVxudX0oeCl9CisgICAgICogICAgICAgICAgICAgICAgICAgICAgICB7XHNpbiBcbnVccGl9CisgICAgICogICBAZl0KKyAgICAgKiAgIHdoZXJlIGZvciBpbnRlZ3JhbCBcZiQgXG51ID0gbiBcZiQgYSBsaW1pdCBpcyB0YWtlbjoKKyAgICAgKiAgIFxmJCBsaW1fe1xudSBcdG8gbn0gXGYkLgorICAgICAqCisgICAgICogICBAcGFyYW0gIF9fbnUgIFRoZSBvcmRlciBvZiB0aGUgTmV1bWFubiBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICAgVGhlIGFyZ3VtZW50IG9mIHRoZSBOZXVtYW5uIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIG91dHB1dCBOZXVtYW5uIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2N5bF9uZXVtYW5uX24oY29uc3QgX1RwIF9fbnUsIGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9fbnUgPCBfVHAoMCkgfHwgX194IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fY3lsX25ldW1hbm5fbi4iKSk7CisgICAgICBlbHNlIGlmIChfX2lzbmFuKF9fbnUpIHx8IF9faXNuYW4oX194KSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChfX3ggPiBfVHAoMTAwMCkpCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19KX251LCBfX05fbnU7CisgICAgICAgICAgX19jeWxfYmVzc2VsX2puX2FzeW1wKF9fbnUsIF9feCwgX19KX251LCBfX05fbnUpOworICAgICAgICAgIHJldHVybiBfX05fbnU7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0pfbnUsIF9fTl9udSwgX19KcF9udSwgX19OcF9udTsKKyAgICAgICAgICBfX2Jlc3NlbF9qbihfX251LCBfX3gsIF9fSl9udSwgX19OX251LCBfX0pwX251LCBfX05wX251KTsKKyAgICAgICAgICByZXR1cm4gX19OX251OworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgQ29tcHV0ZSB0aGUgc3BoZXJpY2FsIEJlc3NlbCBAZiQgal9uKHgpIEBmJAorICAgICAqICAgICAgICAgICBhbmQgTmV1bWFubiBAZiQgbl9uKHgpIEBmJCBmdW5jdGlvbnMgYW5kIHRoZWlyIGZpcnN0CisgICAgICogICAgICAgICAgIGRlcml2YXRpdmVzIEBmJCBqJ19uKHgpIEBmJCBhbmQgQGYkIG4nX24oeCkgQGYkCisgICAgICogICAgICAgICAgIHJlc3BlY3RpdmVseS4KKyAgICAgKgorICAgICAqICAgQHBhcmFtICBfX24gIFRoZSBvcmRlciBvZiB0aGUgc3BoZXJpY2FsIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9fal9uICBUaGUgb3V0cHV0IHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9fbl9uICBUaGUgb3V0cHV0IHNwaGVyaWNhbCBOZXVtYW5uIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX2pwX24gVGhlIG91dHB1dCBkZXJpdmF0aXZlIG9mIHRoZSBzcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX25wX24gVGhlIG91dHB1dCBkZXJpdmF0aXZlIG9mIHRoZSBzcGhlcmljYWwgTmV1bWFubiBmdW5jdGlvbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX1RwPgorICAgIHZvaWQKKyAgICBfX3NwaF9iZXNzZWxfam4oY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCwKKyAgICAgICAgICAgICAgICAgICAgX1RwICYgX19qX24sIF9UcCAmIF9fbl9uLCBfVHAgJiBfX2pwX24sIF9UcCAmIF9fbnBfbikKKyAgICB7CisgICAgICBjb25zdCBfVHAgX19udSA9IF9UcChfX24pICsgX1RwKDAuNUwpOworCisgICAgICBfVHAgX19KX251LCBfX05fbnUsIF9fSnBfbnUsIF9fTnBfbnU7CisgICAgICBfX2Jlc3NlbF9qbihfX251LCBfX3gsIF9fSl9udSwgX19OX251LCBfX0pwX251LCBfX05wX251KTsKKworICAgICAgY29uc3QgX1RwIF9fZmFjdG9yID0gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3NxcnRwaW8yKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAvIHN0ZDo6c3FydChfX3gpOworCisgICAgICBfX2pfbiA9IF9fZmFjdG9yICogX19KX251OworICAgICAgX19uX24gPSBfX2ZhY3RvciAqIF9fTl9udTsKKyAgICAgIF9fanBfbiA9IF9fZmFjdG9yICogX19KcF9udSAtIF9fal9uIC8gKF9UcCgyKSAqIF9feCk7CisgICAgICBfX25wX24gPSBfX2ZhY3RvciAqIF9fTnBfbnUgLSBfX25fbiAvIChfVHAoMikgKiBfX3gpOworCisgICAgICByZXR1cm47CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBzcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9uCisgICAgICogICAgICAgICAgIEBmJCBqX24oeCkgQGYkIG9mIG9yZGVyIG4uCisgICAgICoKKyAgICAgKiAgIFRoZSBzcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnk6CisgICAgICogICBAZlsKKyAgICAgKiAgICBqX24oeCkgPSBcbGVmdCggXGZyYWN7XHBpfXsyeH0gXHJpZ2h0KSBeezEvMn0gSl97bisxLzJ9KHgpCisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgQHBhcmFtICBfX24gIFRoZSBvcmRlciBvZiB0aGUgc3BoZXJpY2FsIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgb3V0cHV0IHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGUgPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3NwaF9iZXNzZWwoY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBpZiAoX194IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fc3BoX2Jlc3NlbC4iKSk7CisgICAgICBlbHNlIGlmIChfX2lzbmFuKF9feCkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoX194ID09IF9UcCgwKSkKKyAgICAgICAgeworICAgICAgICAgIGlmIChfX24gPT0gMCkKKyAgICAgICAgICAgIHJldHVybiBfVHAoMSk7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgcmV0dXJuIF9UcCgwKTsKKyAgICAgICAgfQorICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgX1RwIF9fal9uLCBfX25fbiwgX19qcF9uLCBfX25wX247CisgICAgICAgICAgX19zcGhfYmVzc2VsX2puKF9fbiwgX194LCBfX2pfbiwgX19uX24sIF9fanBfbiwgX19ucF9uKTsKKyAgICAgICAgICByZXR1cm4gX19qX247CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIHNwaGVyaWNhbCBOZXVtYW5uIGZ1bmN0aW9uCisgICAgICogICAgICAgICAgIEBmJCBuX24oeCkgQGYkLgorICAgICAqCisgICAgICogICBUaGUgc3BoZXJpY2FsIE5ldW1hbm4gZnVuY3Rpb24gaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgIG5fbih4KSA9IFxsZWZ0KCBcZnJhY3tccGl9ezJ4fSBccmlnaHQpIF57MS8yfSBOX3tuKzEvMn0oeCkKKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gIF9fbiAgVGhlIG9yZGVyIG9mIHRoZSBzcGhlcmljYWwgTmV1bWFubiBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIHNwaGVyaWNhbCBOZXVtYW5uIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIG91dHB1dCBzcGhlcmljYWwgTmV1bWFubiBmdW5jdGlvbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fc3BoX25ldW1hbm4oY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBpZiAoX194IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fc3BoX25ldW1hbm4uIikpOworICAgICAgZWxzZSBpZiAoX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+Ojpxd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BlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19iZXRhX2dhbW1hKF9UcCBfX3gsIF9UcCBfX3kpCisgICAgeworCisgICAgICBfVHAgX19iZXQ7CisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgaWYgKF9feCA+IF9feSkKKyAgICAgICAgeworICAgICAgICAgIF9fYmV0ID0gc3RkOjp0cjE6OnRnYW1tYShfX3gpCisgICAgICAgICAgICAgICAgLyBzdGQ6OnRyMTo6dGdhbW1hKF9feCArIF9feSk7CisgICAgICAgICAgX19iZXQgKj0gc3RkOjp0cjE6OnRnYW1tYShfX3kpOworICAgICAgICB9CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBfX2JldCA9IHN0ZDo6dHIxOjp0Z2FtbWEoX195KQorICAgICAgICAgICAgICAgIC8gc3RkOjp0cjE6OnRnYW1tYShfX3ggKyBfX3kpOworICAgICAgICAgIF9fYmV0ICo9IHN0ZDo6dHIxOjp0Z2FtbWEoX194KTsKKyAgICAgICAgfQorI2Vsc2UKKyAgICAgIGlmIChfX3ggPiBfX3kpCisgICAgICAgIHsKKyAgICAgICAgICBfX2JldCA9IF9fZ2FtbWEoX194KSAvIF9fZ2FtbWEoX194ICsgX195KTsKKyAgICAgICAgICBfX2JldCAqPSBfX2dhbW1hKF9feSk7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9fYmV0ID0gX19nYW1tYShfX3kpIC8gX19nYW1tYShfX3ggKyBfX3kpOworICAgICAgICAgIF9fYmV0ICo9IF9fZ2FtbWEoX194KTsKKyAgICAgICAgfQorI2VuZGlmCisKKyAgICAgIHJldHVybiBfX2JldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBiZXRhIGZ1bmN0aW9uIFxmJEIoeCx5KVxmJCB1c2luZworICAgICAqICAgICAgICAgICB0aGUgbG9nIGdhbW1hIGZ1bmN0aW9ucy4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBiZXRhIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnkKKyAgICAgKiAgIEBmWworICAgICAqICAgICBCKHgseSkgPSBcZnJhY3tcR2FtbWEoeClcR2FtbWEoeSl9e1xHYW1tYSh4K3kpfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSBfX3ggVGhlIGZpcnN0IGFyZ3VtZW50IG9mIHRoZSBiZXRhIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtIF9feSBUaGUgc2Vjb25kIGFyZ3VtZW50IG9mIHRoZSBiZXRhIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGJldGEgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fYmV0YV9sZ2FtbWEoX1RwIF9feCwgX1RwIF9feSkKKyAgICB7CisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgX1RwIF9fYmV0ID0gc3RkOjp0cjE6OmxnYW1tYShfX3gpCisgICAgICAgICAgICAgICAgKyBzdGQ6OnRyMTo6bGdhbW1hKF9feSkKKyAgICAgICAgICAgICAgICAtIHN0ZDo6dHIxOjpsZ2FtbWEoX194ICsgX195KTsKKyNlbHNlCisgICAgICBfVHAgX19iZXQgPSBfX2xvZ19nYW1tYShfX3gpCisgICAgICAgICAgICAgICAgKyBfX2xvZ19nYW1tYShfX3kpCisgICAgICAgICAgICAgICAgLSBfX2xvZ19nYW1tYShfX3ggKyBfX3kpOworI2VuZGlmCisgICAgICBfX2JldCA9IHN0ZDo6ZXhwKF9fYmV0KTsKKyAgICAgIHJldHVybiBfX2JldDsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGJldGEgZnVuY3Rpb24gXGYkQih4LHkpXGYkIHVzaW5nCisgICAgICogICAgICAgICAgIHRoZSBwcm9kdWN0IGZvcm0uCisgICAgICogCisgICAgICogICBUaGUgYmV0YSBmdW5jdGlvbiBpcyBkZWZpbmVkIGJ5CisgICAgICogICBAZlsKKyAgICAgKiAgICAgQih4LHkpID0gXGZyYWN7XEdhbW1hKHgpXEdhbW1hKHkpfXtcR2FtbWEoeCt5KX0KKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gX194IFRoZSBmaXJzdCBhcmd1bWVudCBvZiB0aGUgYmV0YSBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSBfX3kgVGhlIHNlY29uZCBhcmd1bWVudCBvZiB0aGUgYmV0YSBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBiZXRhIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2JldGFfcHJvZHVjdChfVHAgX194LCBfVHAgX195KQorICAgIHsKKworICAgICAgX1RwIF9fYmV0ID0gKF9feCArIF9feSkgLyAoX194ICogX195KTsKKworICAgICAgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDAwMDAwOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19rID0gMTsgX19rIDwgX19tYXhfaXRlcjsgKytfX2spCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX190ZXJtID0gKF9UcCgxKSArIChfX3ggKyBfX3kpIC8gX19rKQorICAgICAgICAgICAgICAgICAgICAgLyAoKF9UcCgxKSArIF9feCAvIF9faykgKiAoX1RwKDEpICsgX195IC8gX19rKSk7CisgICAgICAgICAgX19iZXQgKj0gX190ZXJtOworICAgICAgICB9CisKKyAgICAgIHJldHVybiBfX2JldDsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGJldGEgZnVuY3Rpb24gXGYkIEIoeCx5KSBcZiQuCisgICAgICogCisgICAgICogICBUaGUgY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ICB1c2luZyA6OmVyZjsKKyAgdXNpbmcgOjplcmZmOworICB1c2luZyA6OmVyZmw7CisKKyAgdXNpbmcgOjplcmZjOworICB1c2luZyA6OmVyZmNmOworICB1c2luZyA6OmVyZmNsOworCisgIHVzaW5nIDo6ZXhwMjsKKyAgdXNpbmcgOjpleHAyZjsKKyAgdXNpbmcgOjpleHAybDsKKworICB1c2luZyA6OmV4cG0xOworICB1c2luZyA6OmV4cG0xZjsKKyAgdXNpbmcgOjpleHBtMWw7CisKKyAgdXNpbmcgOjpmZGltOworICB1c2luZyA6OmZkaW1mOworICB1c2luZyA6OmZkaW1sOworCisgIHVzaW5nIDo6Zm1hOworICB1c2luZyA6OmZtYWY7CisgIHVzaW5nIDo6Zm1hbDsKKworICB1c2luZyA6OmZtYXg7CisgIHVzaW5nIDo6Zm1heGY7CisgIHVzaW5nIDo6Zm1heGw7CisKKyAgdXNpbmcgOjpmbWluOworICB1c2luZyA6OmZtaW5mOworICB1c2luZyA6OmZtaW5sOworCisgIHVzaW5nIDo6aHlwb3Q7CisgIHVzaW5nIDo6aHlwb3RmOworICB1c2luZyA6Omh5cG90bDsKKworICB1c2luZyA6Omlsb2diOworICB1c2luZyA6Omlsb2diZjsKKyAgdXNpbmcgOjppbG9nYmw7CisKKyAgdXNpbmcgOjpsZ2FtbWE7CisgIHVzaW5nIDo6bGdhbW1hZjsKKyAgdXNpbmcgOjpsZ2FtbWFsOworCisgIHVzaW5nIDo6bGxyaW50OworICB1c2luZyA6OmxscmludGY7CisgIHVzaW5nIDo6bGxyaW50bDsKKworICB1c2luZyA6Omxscm91bmQ7CisgIHVzaW5nIDo6bGxyb3VuZGY7CisgIHVzaW5nIDo6bGxyb3VuZGw7CisKKyAgdXNpbmcgOjpsb2cxcDsKKyAgdXNpbmcgOjpsb2cxcGY7CisgIHVzaW5nIDo6bG9nMXBsOworCisgIHVzaW5nIDo6bG9nMjsKKyAgdXNpbmcgOjpsb2cyZjsKKyAgdXNpbmcgOjpsb2cybDsK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xlPjo6X190eXBlCisgICAgYWNvc2goX1RwIF9feCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fYWNvc2goX194KTsgfQorCisgIHVzaW5nIHN0ZDo6YXNpbjsKKworICBpbmxpbmUgZmxvYXQKKyAgYXNpbmgoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fYXNpbmhmKF9feCk7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgYXNpbmgobG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fYXNpbmhsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorCQkJCQkgICBkb3VibGU+OjpfX3R5cGUKKyAgICBhc2luaChfVHAgX194KQorICAgIHsgcmV0dXJuIF9fYnVpbHRpbl9hc2luaChfX3gpOyB9CisKKyAgdXNpbmcgc3RkOjphdGFuOworICB1c2luZyBzdGQ6OmF0YW4yOworCisgIGlubGluZSBmbG9hdAorICBhdGFuaChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9hdGFuaGYoX194KTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICBhdGFuaChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9hdGFuaGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisJCQkJCSAgIGRvdWJsZT46Ol9fdHlwZQorICAgIGF0YW5oKF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX2F0YW5oKF9feCk7IH0KKworICBpbmxpbmUgZmxvYXQKK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9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlCisgICAgZmRpbShfVHAgX194LCBfVXAgX195KQorICAgIHsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZSBfX3R5cGU7CisgICAgICByZXR1cm4gZmRpbShfX3R5cGUoX194KSwgX190eXBlKF9feSkpOworICAgIH0KKworICB1c2luZyBzdGQ6OmZsb29yOworCisgIGlubGluZSBmbG9hdAorICBmbWEoZmxvYXQgX194LCBmbG9hdCBfX3ksIGZsb2F0IF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2ZtYWYoX194LCBfX3ksIF9feik7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgZm1hKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195LCBsb25nIGRvdWJsZSBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9mbWFsKF9feCwgX195LCBfX3opOyB9CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCB0eXBlbmFtZSBfVXAsIHR5cGVuYW1lIF9WcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMzxfVHAsIF9VcCwgX1ZwPjo6X190eXBlCisgICAgZm1hKF9UcCBfX3gsIF9VcCBfX3ksIF9WcCBfX3opCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8zPF9UcCwgX1VwLCBfVnA+OjpfX3R5cGUgX190eXBlOworICAgICAgcmV0dXJuIGZtYShfX3R5cGUoX194KSwgX190eXBlKF9feSksIF9fdHlwZShfX3opKTsKKyAgICB9CisKKyAgaW5saW5lIGZsb2F0CisgIGZtYXgoZmxvYXQgX194LCBmbG9hdCBfX3kpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9mbWF4ZihfX3gsIF9feSk7IH0KKworICB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HBvdyhmbG9hdCxpbnQpIGJlPworICAvLyBOQjogQysrMHggYW5kIFRSMSAhPSBDKyswMy4KKyAgLy8gICB1c2luZyBzdGQ6OnBvdzsKKworICBpbmxpbmUgZmxvYXQKKyAgcmVtYWluZGVyKGZsb2F0IF9feCwgZmxvYXQgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5fcmVtYWluZGVyZihfX3gsIF9feSk7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgcmVtYWluZGVyKGxvbmcgZG91YmxlIF9feCwgbG9uZyBkb3VibGUgX195KQorICB7IHJldHVybiBfX2J1aWx0aW5fcmVtYWluZGVybChfX3gsIF9feSk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9VcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZQorICAgIHJlbWFpbmRlcihfVHAgX194LCBfVXAgX195KQorICAgIHsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZSBfX3R5cGU7CisgICAgICByZXR1cm4gcmVtYWluZGVyKF9fdHlwZShfX3gpLCBfX3R5cGUoX195KSk7CisgICAgfQorCisgIGlubGluZSBmbG9hdAorICByZW1xdW8oZmxvYXQgX194LCBmbG9hdCBfX3ksIGludCogX19wcXVvKQorICB7IHJldHVybiBfX2J1aWx0aW5fcmVtcXVvZihfX3gsIF9feSwgX19wcXVvKTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICByZW1xdW8obG9uZyBkb3VibGUgX194LCBsb25nIGRvdWJsZSBfX3ksIGludCogX19wcXVvKQorICB7IHJldHVybiBfX2J1aWx0aW5fcmVtcXVvbChfX3gsIF9feSwgX19wcXVvKTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX1VwPgorICAgIGlubGluZSB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcCwgX1VwPjo6X190eXBlCisgICAgcmVtcXVvKF9UcCBfX3gsIF9VcCBfX3ksIGludCogX19wcXVvKQorICAgIHsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHAsIF9VcD46Ol9fdHlwZSBfX3R5cGU7CisgICAgICByZXR1cm4gcmVtcXVvKF9fdHlwZShfX3gpLCBfX3R5cGUoX195KSwgX19wcXVvKTsKKyAgICB9CisKKyAgaW5saW5lIGZsb2F0CisgIHJpbnQoZmxvYXQgX194KQorICB7IHJldHVybiBfX2J1aWx0aW5fcmludGYoX194KTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICByaW50KGxvbmcgZG91YmxlIF9feCkKKyAgeyByZXR1cm4gX19idWlsdGluX3JpbnRsKF9feCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorCQkJCQkgICBkb3VibGU+OjpfX3R5cGUKKyAgICByaW50KF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX3JpbnQoX194KTsgfQorCisgIGlubGluZSBmbG9hdAorICByb3VuZChmbG9hdCBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9yb3VuZGYoX194KTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICByb3VuZChsb25nIGRvdWJsZSBfX3gpCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9yb3VuZGwoX194KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisJCQkJCSAgIGRvdWJsZT46Ol9fdHlwZQorICAgIHJvdW5kKF9UcCBfX3gpCisgICAgeyByZXR1cm4gX19idWlsdGluX3JvdW5kKF9feCk7IH0KKworICBpbmxpbmUgZmxvYXQKKyAgc2NhbGJsbihmbG9hdCBfX3gsIGxvbmcgX19leCkKKyAgeyByZXR1cm4gX19idWlsdGluX3NjYWxibG5mKF9feCwgX19leCk7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgc2NhbGJsbihsb25nIGRvdWJsZSBfX3gsIGxvbmcgX19leCkKKyAgeyByZXR1cm4gX19idWlsdGluX3NjYWxibG5sKF9feCwgX19leCk7IH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHR5cGVuYW1lIF9fZ251X2N4eDo6X19lbmFibGVfaWY8X19pc19pbnRlZ2VyPF9UcD46Ol9fdmFsdWUsIAorCQkJCQkgICBkb3VibGU+OjpfX3R5cGUKKyAgICBzY2FsYmxuKF9UcCBfX3gsIGxvbmcgX19leCkKKyAgICB7IHJldHVybiBfX2J1aWx0aW5fc2NhbGJsbihfX3gsIF9fZXgpOyB9CisgCisgIGlubGluZSBmbG9hdAorICBzY2FsYm4oZmxvYXQgX194LCBpbnQgX19leCkKKyAgeyByZXR1cm4gX19idWlsdGluX3NjYWxibmYoX194LCBfX2V4KTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICBzY2FsYm4obG9uZyBkb3VibGUgX194LCBpbnQgX19leCkKKyAgeyByZXR1cm4gX19idWlsdGluX3NjYWxibmwoX194LCBfX2V4KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19nbnVfY3h4OjpfX2VuYWJsZV9pZjxfX2lzX2ludGVnZXI8X1RwPjo6X192YWx1ZSwgCisJCQkJCSAgIGRvdWJsZT46Ol9fdHlwZQorICAgIHNjYWxibihfVHAgX194LCBpbnQg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udSBfX251LCBfVHAgX194KQorICAgIHsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGVfMjxfVHBudSwgX1RwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBfX2RldGFpbDo6X19jeWxfYmVzc2VsX2s8X190eXBlPihfX251LCBfX3gpOworICAgIH0KKworICBpbmxpbmUgZmxvYXQKKyAgY3lsX25ldW1hbm5mKGZsb2F0IF9fbnUsIGZsb2F0IF9feCkKKyAgeyByZXR1cm4gX19kZXRhaWw6Ol9fY3lsX25ldW1hbm5fbjxmbG9hdD4oX19udSwgX194KTsgfQorCisgIGlubGluZSBsb25nIGRvdWJsZQorICBjeWxfbmV1bWFubmwobG9uZyBkb3VibGUgX19udSwgbG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2RldGFpbDo6X19jeWxfbmV1bWFubl9uPGxvbmcgZG91YmxlPihfX251LCBfX3gpOyB9CisKKyAgLy8vICA1LjIuMS4xMSAgQ3lsaW5kcmljYWwgTmV1bWFubiBmdW5jdGlvbnMuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcG51LCB0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHR5cGVuYW1lIF9fZ251X2N4eDo6X19wcm9tb3RlXzI8X1RwbnUsIF9UcD46Ol9fdHlwZQorICAgIGN5bF9uZXVtYW5uKF9UcG51IF9fbnUsIF9UcCBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZV8yPF9UcG51LCBfVHA+OjpfX3R5cGUgX190eXBlOworICAgICAgcmV0dXJuIF9fZGV0YWlsOjpfX2N5bF9uZXVtYW5uX248X190eXBlPihfX251LCBfX3gpOworICAgIH0KKworICBpbmxpbmUgZmxvYXQKKyAgZWxsaW50XzFmKGZsb2F0IF9faywgZmxvYXQgX19waGkpCisgIHsgcmV0dXJuIF9fZGV0YWlsOjpfX2VsbGlud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hbm5femV0YShfVHAgX194KQorICAgIHsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX19nbnVfY3h4OjpfX3Byb21vdGU8X1RwPjo6X190eXBlIF9fdHlwZTsKKyAgICAgIHJldHVybiBfX2RldGFpbDo6X19yaWVtYW5uX3pldGE8X190eXBlPihfX3gpOworICAgIH0KKworICBpbmxpbmUgZmxvYXQKKyAgc3BoX2Jlc3NlbGYodW5zaWduZWQgaW50IF9fbiwgZmxvYXQgX194KQorICB7IHJldHVybiBfX2RldGFpbDo6X19zcGhfYmVzc2VsPGZsb2F0PihfX24sIF9feCk7IH0KKworICBpbmxpbmUgbG9uZyBkb3VibGUKKyAgc3BoX2Jlc3NlbGwodW5zaWduZWQgaW50IF9fbiwgbG9uZyBkb3VibGUgX194KQorICB7IHJldHVybiBfX2RldGFpbDo6X19zcGhfYmVzc2VsPGxvbmcgZG91YmxlPihfX24sIF9feCk7IH0KKworICAvLy8gIDUuMi4xLjIxICBTcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9ucy4KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZTxfVHA+OjpfX3R5cGUKKyAgICBzcGhfYmVzc2VsKHVuc2lnbmVkIGludCBfX24sIF9UcCBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfX2dudV9jeHg6Ol9fcHJvbW90ZTxfVHA+OjpfX3R5cGUgX190eXBlOworICAgICAgcmV0dXJuIF9fZGV0YWlsOjpfX3NwaF9iZXNzZWw8X190eXBlPihfX24sIF9feCk7CisgICAgfQorCisgIGlubGluZSBmbG9hdAorICBzcGhfbGVnZW5kcmVmKHVuc2lnbmVkIGludCBfX2wsIHVuc2lnbmVkIGludCBfX20sIGZsb2F0IF9fdGhldGEpCisgIHsgcmV0dXJuIF9fZGV0YWlsOjpfX3NwaF9sZWdlbmRyZTxmbG9hdD4oX19sLCB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ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIHN0ZDo6Y29tcGxleDxfVHA+CisgICAgYXNpbihjb25zdCBzdGQ6OmNvbXBsZXg8X1RwPiYgX196KQorICAgIHsgcmV0dXJuIF9fY29tcGxleF9hc2luKF9feik7IH0KKyNlbmRpZgorICAKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIHN0ZDo6Y29tcGxleDxfVHA+CisgICAgX19jb21wbGV4X2F0YW4oY29uc3Qgc3RkOjpjb21wbGV4PF9UcD4mIF9feikKKyAgICB7CisgICAgICBjb25zdCBfVHAgX19yMiA9IF9fei5yZWFsKCkgKiBfX3oucmVhbCgpOworICAgICAgY29uc3QgX1RwIF9feCA9IF9UcCgxLjApIC0gX19yMiAtIF9fei5pbWFnKCkgKiBfX3ouaW1hZygpOworCisgICAgICBfVHAgX19udW0gPSBfX3ouaW1hZygpICsgX1RwKDEuMCk7CisgICAgICBfVHAgX19kZW4gPSBfX3ouaW1hZygpIC0gX1RwKDEuMCk7CisKKyAgICAgIF9fbnVtID0gX19yMiArIF9fbnVtICogX19udW07CisgICAgICBfX2RlbiA9IF9fcjIgKyBfX2RlbiAqIF9fZGVuOworCisgICAgICByZXR1cm4gc3RkOjpjb21wbGV4PF9UcD4oX1RwKDAuNSkgKiBhdGFuMihfVHAoMi4wKSAqIF9fei5yZWFsKCksIF9feCksCisJCQkgICAgICAgX1RwKDAuMjUpICogbG9nKF9fbnVtIC8gX19kZW4pKTsKKyAgICB9CisKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X0NPTVBMRVhfVFIxCisgIGlubGluZSBfX2NvbXBsZXhfXyBmbG9hdAorICBfX2NvbXBsZXhfYXRhbihfX2NvbXBsZXhfXyBmbG9hdCBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jYXRhbmYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X2F0YW4oX19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isgICAgeyByZXR1cm4gX19jb21wbGV4X2Fjb3NoKF9feik7IH0KKyNlbmRpZgorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBzdGQ6OmNvbXBsZXg8X1RwPgorICAgIF9fY29tcGxleF9hc2luaChjb25zdCBzdGQ6OmNvbXBsZXg8X1RwPiYgX196KQorICAgIHsKKyAgICAgIHN0ZDo6Y29tcGxleDxfVHA+IF9fdCgoX196LnJlYWwoKSAtIF9fei5pbWFnKCkpCisJCQkgICAgKiAoX196LnJlYWwoKSArIF9fei5pbWFnKCkpICsgX1RwKDEuMCksCisJCQkgICAgX1RwKDIuMCkgKiBfX3oucmVhbCgpICogX196LmltYWcoKSk7CisgICAgICBfX3QgPSBzdGQ6OnNxcnQoX190KTsKKworICAgICAgcmV0dXJuIHN0ZDo6bG9nKF9fdCArIF9feik7CisgICAgfQorCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9DT01QTEVYX1RSMQorICBpbmxpbmUgX19jb21wbGV4X18gZmxvYXQKKyAgX19jb21wbGV4X2FzaW5oKF9fY29tcGxleF9fIGZsb2F0IF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2Nhc2luaGYoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBkb3VibGUKKyAgX19jb21wbGV4X2FzaW5oKF9fY29tcGxleF9fIGRvdWJsZSBfX3opCisgIHsgcmV0dXJuIF9fYnVpbHRpbl9jYXNpbmgoX196KTsgfQorCisgIGlubGluZSBfX2NvbXBsZXhfXyBsb25nIGRvdWJsZQorICBfX2NvbXBsZXhfYXNpbmgoY29uc3QgX19jb21wbGV4X18gbG9uZyBkb3VibGUmIF9feikKKyAgeyByZXR1cm4gX19idWlsdGluX2Nhc2luaGwoX196KTsgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgc3RkOjpjb21wbGV4PF9UcD4KKyAgICBhc2luaChjb25zdCBzdGQ6OmNvbXBsZXg8X1R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CisgIHVzaW5nIDo6aW50MTZfdDsKKyAgdXNpbmcgOjppbnQzMl90OworICB1c2luZyA6OmludDY0X3Q7CisKKyAgdXNpbmcgOjppbnRfZmFzdDhfdDsKKyAgdXNpbmcgOjppbnRfZmFzdDE2X3Q7CisgIHVzaW5nIDo6aW50X2Zhc3QzMl90OworICB1c2luZyA6OmludF9mYXN0NjRfdDsKKworICB1c2luZyA6OmludF9sZWFzdDhfdDsKKyAgdXNpbmcgOjppbnRfbGVhc3QxNl90OworICB1c2luZyA6OmludF9sZWFzdDMyX3Q7CisgIHVzaW5nIDo6aW50X2xlYXN0NjRfdDsKKworICB1c2luZyA6OmludG1heF90OworICB1c2luZyA6OmludHB0cl90OworICAKKyAgdXNpbmcgOjp1aW50OF90OworICB1c2luZyA6OnVpbnQxNl90OworICB1c2luZyA6OnVpbnQzMl90OworICB1c2luZyA6OnVpbnQ2NF90OworCisgIHVzaW5nIDo6dWludF9mYXN0OF90OworICB1c2luZyA6OnVpbnRfZmFzdDE2X3Q7CisgIHVzaW5nIDo6dWludF9mYXN0MzJfdDsKKyAgdXNpbmcgOjp1aW50X2Zhc3Q2NF90OworCisgIHVzaW5nIDo6dWludF9sZWFzdDhfdDsKKyAgdXNpbmcgOjp1aW50X2xlYXN0MTZfdDsKKyAgdXNpbmcgOjp1aW50X2xlYXN0MzJfdDsKKyAgdXNpbmcgOjp1aW50X2xlYXN0NjRfdDsKKworICB1c2luZyA6OnVpbnRtYXhfdDsKKyAgdXNpbmcgOjp1aW50cHRyX3Q7Cit9Cit9CisKKyNlbmRpZiAvLyBfR0xJQkNYWF9VU0VfQzk5X1NURElOVF9UUjEKKworI2VuZGlmIC8vIF9HTElCQ1hYX1RSMV9DU1RESU5UCisKZGlmZiAtLWdpdCBhLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvdHIxL2NzdGRpbyBiLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1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8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19lbGxpbnRfcmYoY29uc3QgX1RwIF9feCwgY29uc3QgX1RwIF9feSwgY29uc3QgX1RwIF9feikKKyAgICB7CisgICAgICBjb25zdCBfVHAgX19taW4gPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1pbigpOworICAgICAgY29uc3QgX1RwIF9fbWF4ID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptYXgoKTsKKyAgICAgIGNvbnN0IF9UcCBfX2xvbGltID0gX1RwKDUpICogX19taW47CisgICAgICBjb25zdCBfVHAgX191cGxpbSA9IF9fbWF4IC8gX1RwKDUpOworCisgICAgICBpZiAoX194IDwgX1RwKDApIHx8IF9feSA8IF9UcCgwKSB8fCBfX3ogPCBfVHAoMCkpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCBsZXNzIHRoYW4gemVybyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2VsbGludF9yZi4iKSk7CisgICAgICBlbHNlIGlmIChfX3ggKyBfX3kgPCBfX2xvbGltIHx8IF9feCArIF9feiA8IF9fbG9saW0KKyAgICAgICAgICAgIHx8IF9feSArIF9feiA8IF9fbG9saW0pCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCB0b28gc21hbGwgaW4gX19lbGxpbnRfcmYiKSk7CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMCA9IF9UcCgxKSAvIF9UcCg0KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMSA9IF9UcCgxKSAvIF9UcCgyNCk7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzIgPSBfVHAoMSkgLyBfVHAoMTApOworICAgICAgICAgIGNvbnN0IF9UcCBfX2MzID0gX1RwKDMpIC8gX1RwKDQ0KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jNCA9IF9UcCgxKSAvIF9UcCgxNCk7CisKKyAgICAgICAgICBfVHAgX194biA9IF9feDsKKyAgICAgICAgICBfVHAgX195biA9IF9feTsKKyAgICAgICAgICBfVHAgX196biA9IF9fejsKKworICAgICAgICAgIGNvbnN0IF9UcCBfX2VwcyA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2VycnRvbCA9IHN0ZDo6cG93KF9fZXBzLCBfVHAoMSkgLyBfVHAoNikpOworICAgICAgICAgIF9UcCBfX211OworICAgICAgICAgIF9UcCBfX3huZGV2LCBfX3luZGV2LCBfX3puZGV2OworCisgICAgICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDA7CisgICAgICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pdGVyID0gMDsgX19pdGVyIDwgX19tYXhfaXRlcjsgKytfX2l0ZXIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fbXUgPSAoX194biArIF9feW4gKyBfX3puKSAvIF9UcCgzKTsKKyAgICAgICAgICAgICAgX194bmRldiA9IDIgLSAoX19tdSArIF9feG4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX195bmRldiA9IDIgLSAoX19tdSArIF9feW4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX196bmRldiA9IDIgLSAoX19tdSArIF9fem4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX1RwIF9fZXBzaWxvbiA9IHN0ZDo6bWF4KHN0ZDo6YWJzKF9feG5kZXYpLCBzdGQ6OmFicyhfX3luZGV2KSk7CisgICAgICAgICAgICAgIF9fZXBzaWxvbiA9IHN0ZDo6bWF4KF9fZXBzaWxvbiwgc3RkOjphYnMoX196bmRldikpOworICAgICAgICAgICAgICBpZiAoX19lcHNpbG9uIDwgX19lcnJ0b2wpCisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3hucm9vdCA9IHN0ZDo6c3FydChfX3huKTsKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9feW5yb290ID0gc3RkOjpzcXJ0KF9feW4pOworICAgICAgICAgICAgICBjb25zdCBfVHAgX196bnJvb3QgPSBzdGQ6OnNxcnQoX196bik7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2xhbWJkYSA9IF9feG5yb290ICogKF9feW5yb290ICsgX196bnJvb3QpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIF9feW5yb290ICogX196bnJvb3Q7CisgICAgICAgICAgICAgIF9feG4gPSBfX2MwICogKF9feG4gKyBfX2xhbWJkYSk7CisgICAgICAgICAgICAgIF9feW4gPSBfX2MwICogKF9feW4gKyBfX2xhbWJkYSk7CisgICAgICAgICAgICAgIF9fem4gPSBfX2MwICogKF9fem4gKyBfX2xhbWJkYSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICBjb25zdCBfVHAgX19lMiA9IF9feG5kZXYgKiBfX3luZGV2IC0gX196bmRldiAqIF9fem5kZXY7CisgICAgICAgICAgY29uc3QgX1RwIF9fZTMgPSBfX3huZGV2ICogX195bmRldiAqIF9fem5kZXY7CisgICAgICAgICAgY29uc3QgX1RwIF9fcyAgPSBfVHAoMSkgKyAoX19jMSAqIF9fZTIgLSBfX2MyIC0gX19jMyAqIF9fZTMpICogX19lMgorICAgICAgICAgICAgICAgICAgICsgX19jNCAqIF9fZTM7CisKKyAgICAgICAgICByZXR1cm4gX19zIC8gc3RkOjpzcXJ0KF9fbXUpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIGNvbXBsZXRlIGVsbGlwdGljIGludGVncmFsIG9mIHRoZSBmaXJzdCBraW5kCisgICAgICogICAgICAgICAgQGYkIEsoaykgQGYkIGJ5IHNlcmllcyBleHBhbnNpb24uCisgICAgICogCisgICAgICogICBUaGUgY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIGZpcnN0IGtpbmQgaXMgZGVmaW5lZCBhcworICAgICAqICAgQGZbCisgICAgICogICAgIEsoaykgPSBGKGssXHBpLzIpID0gXGludF8wXntccGkvMn1cZnJhY3tkXHRoZXRhfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xzcXJ0ezEgLSBrXjJzaW5eMlx0aGV0YX19CisgICAgICogICBAZl0KKyAgICAgKiAKKyAgICAgKiAgIFRoaXMgcm91dGluZSBpcyBub3QgYmFkIGFzIGxvbmcgYXMgfGt8IGlzIHNvbWV3aGF0IHNtYWxsZXIgdGhhbiAxCisgICAgICogICBidXQgaXMgbm90IGlzIGdvb2QgYXMgdGhlIENhcmxzb24gZWxsaXB0aWMgaW50ZWdyYWwgZm9ybXVsYXRpb24uCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fayAgVGhlIGFyZ3VtZW50IG9mIHRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgZmlyc3Qga2luZC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19jb21wX2VsbGludF8xX3Nlcmllcyhjb25zdCBfVHAgX19rKQorICAgIHsKKworICAgICAgY29uc3QgX1RwIF9fa2sgPSBfX2sgKiBfX2s7CisKKyAgICAgIF9UcCBfX3Rlcm0gPSBfX2trIC8gX1RwKDQpOworICAgICAgX1RwIF9fc3VtID0gX1RwKDEpICsgX190ZXJtOworCisgICAgICBjb25zdCB1bnNpZ25lZCBpbnQgX19tYXhfaXRlciA9IDEwMDA7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2kgPSAyOyBfX2kgPCBfX21heF9pdGVyOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIF9fdGVybSAqPSAoMiAqIF9faSAtIDEpICogX19rayAvICgyICogX19pKTsKKyAgICAgICAgICBpZiAoX190ZXJtIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waV8yKCkgKiBfX3N1bTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGNvbXBsZXRlIGVsbGlwdGljIGludGVncmFsIG9mIHRoZSBmaXJzdCBraW5kCisgICAgICogICAgICAgICAgIEBmJCBLKGspIEBmJCB1c2luZyB0aGUgQ2FybHNvbiBmb3JtdWxhdGlvbi4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBjb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgZmlyc3Qga2luZCBpcyBkZWZpbmVkIGFzCisgICAgICogICBAZlsKKyAgICAgKiAgICAgSyhrKSA9IEYoayxccGkvMikgPSBcaW50XzBee1xwaS8yfVxmcmFje2RcdGhldGF9CisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xzcXJ0ezEgLSBrXjIgc2luXjJcdGhldGF9fQorICAgICAqICAgQGZdCisgICAgICogICB3aGVyZSBAZiQgRihrLFxwaGkpIEBmJCBpcyB0aGUgaW5jb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUKKyAgICAgKiAgIGZpcnN0IGtpbmQuCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fayAgVGhlIGFyZ3VtZW50IG9mIHRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgZmlyc3Qga2luZC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19jb21wX2VsbGludF8xKGNvbnN0IF9UcCBfX2spCisgICAgeworCisgICAgICBpZiAoX19pc25hbihfX2spKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKHN0ZDo6YWJzKF9faykgPj0gX1RwKDEpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIF9fZWxsaW50X3JmKF9UcCgwKSwgX1RwKDEpIC0gX19rICogX19rLCBfVHAoMSkpOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgaW5jb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgZmlyc3Qga2luZAorICAgICAqICAgICAgICAgICBAZiQgRihrLFxwaGkpIEBmJCB1c2luZyB0aGUgQ2FybHNvbiBmb3JtdWxhdGlvbi4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBpbmNvbXBsZXRlIGVsbGlwdGljIGludGVncmFsIG9mIHRoZSBmaXJzdCBraW5kIGlzIGRlZmluZWQgYXMKKyAgICAgKiAgIEBmWworICAgICAqICAgICBGKGssXHBoaSkgPSBcaW50XzBee1xwaGl9XGZyYWN7ZFx0aGV0YX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAge1xzcXJ0ezEgLSBrXjIgc2luXjJcdGhldGF9fQorICAgICAqICAgQGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fayAgVGhlIGFyZ3VtZW50IG9mIHRoZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19waGkgIFRoZSBpbnRlZ3JhbCBsaW1pdCBhcmd1bWVudCBvZiB0aGUgZWxsaXB0aWMgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgZWxsaXB0aWMgZnVuY3Rpb24gb2YgdGhlIGZpcnN0IGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZWxsaW50XzEoY29uc3QgX1RwIF9faywgY29uc3QgX1RwIF9fcGhpKQorICAgIHsKKworICAgICAgaWYgKF9faXNuYW4oX19rKSB8fCBfX2lzbmFuKF9fcGhpKSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChzdGQ6OmFicyhfX2spID4gX1RwKDEpKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50IGluIF9fZWxsaW50XzEuIikpOworICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgLy8gIFJlZHVjZSBwaGkgdG8gLXBpLzIgPCBwaGkgPCArcGkvMi4KKyAgICAgICAgICBjb25zdCBpbnQgX19uID0gc3RkOjpmbG9vcihfX3BoaSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDAuNUwpKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19waGlfcmVkID0gX19waGkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19uICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisKKyAgICAgICAgICBjb25zdCBfVHAgX19zID0gc3RkOjpzaW4oX19waGlfcmVkKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jID0gc3RkOjpjb3MoX19waGlfcmVkKTsKKworICAgICAgICAgIGNvbnN0IF9UcCBfX0YgPSBfX3MKKyAgICAgICAgICAgICAgICAgICAgICAgICogX19lbGxpbnRfcmYoX19jICogX19jLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfVHAoMSkgLSBfX2sgKiBfX2sgKiBfX3MgKiBfX3MsIF9UcCgxKSk7CisKKyAgICAgICAgICBpZiAoX19uID09IDApCisgICAgICAgICAgICByZXR1cm4gX19GOworICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHJldHVybiBfX0YgKyBfVHAoMikgKiBfX24gKiBfX2NvbXBfZWxsaW50XzEoX19rKTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgUmV0dXJuIHRoZSBjb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgc2Vjb25kIGtpbmQKKyAgICAgKiAgICAgICAgICBAZiQgRShrKSBAZiQgYnkgc2VyaWVzIGV4cGFuc2lvbi4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBjb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgc2Vjb25kIGtpbmQgaXMgZGVmaW5lZCBhcworICAgICAqICAgQGZbCisgICAgICogICAgIEUoayxccGkvMikgPSBcaW50XzBee1xwaS8yfVxzcXJ0ezEgLSBrXjIgc2luXjJcdGhldGF9CisgICAgICogICBAZl0KKyAgICAgKiAKKyAgICAgKiAgIFRoaXMgcm91dGluZSBpcyBub3QgYmFkIGFzIGxvbmcgYXMgfGt8IGlzIHNvbWV3aGF0IHNtYWxsZXIgdGhhbiAxCisgICAgICogICBidXQgaXMgbm90IGlzIGdvb2QgYXMgdGhlIENhcmxzb24gZWxsaXB0aWMgaW50ZWdyYWwgZm9ybXVsYXRpb24uCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fayAgVGhlIGFyZ3VtZW50IG9mIHRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBjb21wbGV0ZSBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgc2Vjb25kIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fY29tcF9lbGxpbnRfMl9zZXJpZXMoY29uc3QgX1RwIF9faykKKyAgICB7CisKKyAgICAgIGNvbnN0IF9UcCBfX2trID0gX19rICogX19rOworCisgICAgICBfVHAgX190ZXJtID0gX19razsKKyAgICAgIF9UcCBfX3N1bSA9IF9fdGVybTsKKworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDAwOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pID0gMjsgX19pIDwgX19tYXhfaXRlcjsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBjb25zdCBfVHAgX19pMm0gPSAyICogX19pIC0gMTsKKyAgICAgICAgICBjb25zdCBfVHAgX19pMiA9IDIgKiBfX2k7CisgICAgICAgICAgX190ZXJtICo9IF9faTJtICogX19pMm0gKiBfX2trIC8gKF9faTIgKiBfX2kyKTsKKyAgICAgICAgICBpZiAoX190ZXJtIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm0gLyBfX2kybTsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpXzIoKSAqIChfVHAoMSkgLSBfX3N1bSk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBDYXJsc29uIGVsbGlwdGljIGZ1bmN0aW9uIG9mIHRoZSBzZWNvbmQga2luZAorICAgICAqICAgICAgICAgICBAZiQgUl9EKHgseSx6KSA9IFJfSih4LHkseix6KSBAZiQgd2hlcmUKKyAgICAgKiAgICAgICAgICAgQGYkIFJfSih4LHkseixwKSBAZiQgaXMgdGhlIENhcmxzb24gZWxsaXB0aWMgZnVuY3Rpb24KKyAgICAgKiAgICAgICAgICAgb2YgdGhlIHRoaXJkIGtpbmQuCisgICAgICogCisgICAgICogICBUaGUgQ2FybHNvbiBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgc2Vjb25kIGtpbmQgaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIFJfRCh4LHkseikgPSBcZnJhY3szfXsyfSBcaW50XzBeXGluZnR5CisgICAgICogICAgICAgICAgICAgICAgIFxmcmFje2R0fXsodCArIHgpXnsxLzJ9KHQgKyB5KV57MS8yfSh0ICsgeileezMvMn19CisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgQmFzZWQgb24gQ2FybHNvbidzIGFsZ29yaXRobXM6CisgICAgICogICAtICBCLiBDLiBDYXJsc29uIE51bWVyLiBNYXRoLiAzMywgMSAoMTk3OSkKKyAgICAgKiAgIC0gIEIuIEMuIENhcmxzb24sIFNwZWNpYWwgRnVuY3Rpb25zIG9mIEFwcGxpZWQgTWF0aGVtYXRpY3MgKDE5NzcpCisgICAgICogICAtICBOdW1lcmljYWwgUmVjaXBlcyBpbiBDLCAybmQgZWQsIHBwLiAyNjEtMjY5LAorICAgICAqICAgICAgYnkgUHJlc3MsIFRldWtvbHNreSwgVmV0dGVybGluZywgRmxhbm5lcnkgKDE5OTIpCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgZmlyc3Qgb2YgdHdvIHN5bW1ldHJpYyBhcmd1bWVudHMuCisgICAgICogICBAcGFyYW0gIF9feSAgVGhlIHNlY29uZCBvZiB0d28gc3ltbWV0cmljIGFyZ3VtZW50cy4KKyAgICAgKiAgIEBwYXJhbSAgX196ICBUaGUgdGhpcmQgYXJndW1lbnQuCisgICAgICogICBAcmV0dXJuICBUaGUgQ2FybHNvbiBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgc2Vjb25kIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZWxsaW50X3JkKGNvbnN0IF9UcCBfX3gsIGNvbnN0IF9UcCBfX3ksIGNvbnN0IF9UcCBfX3opCisgICAgeworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBjb25zdCBfVHAgX19lcnJ0b2wgPSBzdGQ6OnBvdyhfX2VwcyAvIF9UcCg4KSwgX1RwKDEpIC8gX1RwKDYpKTsKKyAgICAgIGNvbnN0IF9UcCBfX21pbiA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6bWluKCk7CisgICAgICBjb25zdCBfVHAgX19tYXggPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1heCgpOworICAgICAgY29uc3QgX1RwIF9fbG9saW0gPSBfVHAoMikgLyBzdGQ6OnBvdyhfX21heCwgX1RwKDIpIC8gX1RwKDMpKTsKKyAgICAgIGNvbnN0IF9UcCBfX3VwbGltID0gc3RkOjpwb3coX1RwKDAuMUwpICogX19lcnJ0b2wgLyBfX21pbiwgX1RwKDIpIC8gX1RwKDMpKTsKKworICAgICAgaWYgKF9feCA8IF9UcCgwKSB8fCBfX3kgPCBfVHAoMCkpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCBsZXNzIHRoYW4gemVybyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2VsbGludF9yZC4iKSk7CisgICAgICBlbHNlIGlmIChfX3ggKyBfX3kgPCBfX2xvbGltIHx8IF9feiA8IF9fbG9saW0pCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCB0b28gc21hbGwgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19lbGxpbnRfcmQuIikpOworICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzAgPSBfVHAoMSkgLyBfVHAoNCk7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzEgPSBfVHAoMykgLyBfVHAoMTQpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2MyID0gX1RwKDEpIC8gX1RwKDYpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2MzID0gX1RwKDkpIC8gX1RwKDIyKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jNCA9IF9UcCgzKSAvIF9UcCgyNik7CisKKyAgICAgICAgICBfVHAgX194biA9IF9feDsKKyAgICAgICAgICBfVHAgX195biA9IF9feTsKKyAgICAgICAgICBfVHAgX196biA9IF9fejsKKyAgICAgICAgICBfVHAgX19zaWdtYSA9IF9UcCgwKTsKKyAgICAgICAgICBfVHAgX19wb3dlcjQgPSBfVHAoMSk7CisKKyAgICAgICAgICBfVHAgX19tdTsKKyAgICAgICAgICBfVHAgX194bmRldiwgX195bmRldiwgX196bmRldjsKKworICAgICAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBfX21heF9pdGVyID0gMTAwOworICAgICAgICAgIGZvciAodW5zaWduZWQgaW50IF9faXRlciA9IDA7IF9faXRlciA8IF9fbWF4X2l0ZXI7ICsrX19pdGVyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX211ID0gKF9feG4gKyBfX3luICsgX1RwKDMpICogX196bikgLyBfVHAoNSk7CisgICAgICAgICAgICAgIF9feG5kZXYgPSAoX19tdSAtIF9feG4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX195bmRldiA9IChfX211IC0gX195bikgLyBfX211OworICAgICAgICAgICAgICBfX3puZGV2ID0gKF9fbXUgLSBfX3puKSAvIF9fbXU7CisgICAgICAgICAgICAgIF9UcCBfX2Vwc2lsb24gPSBzdGQ6Om1heChzdGQ6OmFicyhfX3huZGV2KSwgc3RkOjphYnMoX195bmRldikpOworICAgICAgICAgICAgICBfX2Vwc2lsb24gPSBzdGQ6Om1heChfX2Vwc2lsb24sIHN0ZDo6YWJzKF9fem5kZXYpKTsKKyAgICAgICAgICAgICAgaWYgKF9fZXBzaWxvbiA8IF9fZXJydG9sKQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBfVHAgX194bnJvb3QgPSBzdGQ6OnNxcnQoX194bik7CisgICAgICAgICAgICAgIF9UcCBfX3lucm9vdCA9IHN0ZDo6c3FydChfX3luKTsKKyAgICAgICAgICAgICAgX1RwIF9fem5yb290ID0gc3RkOjpzcXJ0KF9fem4pOworICAgICAgICAgICAgICBfVHAgX19sYW1iZGEgPSBfX3hucm9vdCAqIChfX3lucm9vdCArIF9fem5yb290KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBfX3lucm9vdCAqIF9fem5yb290OworICAgICAgICAgICAgICBfX3NpZ21hICs9IF9fcG93ZXI0IC8gKF9fem5yb290ICogKF9fem4gKyBfX2xhbWJkYSkpOworICAgICAgICAgICAgICBfX3Bvd2VyNCAqPSBfX2MwOworICAgICAgICAgICAgICBfX3huID0gX19jMCAqIChfX3huICsgX19sYW1iZGEpOworICAgICAgICAgICAgICBfX3luID0gX19jMCAqIChfX3luICsgX19sYW1iZGEpOworICAgICAgICAgICAgICBfX3puID0gX19jMCAqIChfX3puICsgX19sYW1iZGEpOworICAgICAgICAgICAgfQorCisJICAvLyBOb3RlOiBfX2VhIGlzIGFuIFNQVSBiYWRuYW1lLgorICAgICAgICAgIF9UcCBfX2VhYSA9IF9feG5kZXYgKiBfX3luZGV2OworICAgICAgICAgIF9UcCBfX2ViID0gX196bmRldiAqIF9fem5kZXY7CisgICAgICAgICAgX1RwIF9fZWMgPSBfX2VhYSAtIF9fZWI7CisgICAgICAgICAgX1RwIF9fZWQgPSBfX2VhYSAtIF9UcCg2KSAqIF9fZWI7CisgICAgICAgICAgX1RwIF9fZWYgPSBfX2VkICsgX19lYyArIF9fZWM7CisgICAgICAgICAgX1RwIF9fczEgPSBfX2VkICogKC1fX2MxICsgX19jMyAqIF9fZWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyBfVHAoMykgLSBfVHAoMykgKiBfX2M0ICogX196bmRldiAqIF9fZWYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyBfVHAoMikpOworICAgICAgICAgIF9UcCBfX3MyID0gX196bmRldgorICAgICAgICAgICAgICAgICAgICogKF9fYzIgKiBfX2VmCisgICAgICAgICAgICAgICAgICAgICsgX196bmRldiAqICgtX19jMyAqIF9fZWMgLSBfX3puZGV2ICogX19jNCAtIF9fZWFhKSk7CisKKyAgICAgICAgICByZXR1cm4gX1RwKDMpICogX19zaWdtYSArIF9fcG93ZXI0ICogKF9UcCgxKSArIF9fczEgKyBfX3MyKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gKF9fbXUgKiBzdGQ6OnNxcnQoX19tdSkpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBjb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgc2Vjb25kIGtpbmQKKyAgICAgKiAgICAgICAgICAgQGYkIEUoaykgQGYkIHVzaW5nIHRoZSBDYXJsc29uIGZvcm11bGF0aW9uLgorICAgICAqIAorICAgICAqICAgVGhlIGNvbXBsZXRlIGVsbGlwdGljIGludGVncmFsIG9mIHRoZSBzZWNvbmQga2luZCBpcyBkZWZpbmVkIGFzCisgICAgICogICBAZlsKKyAgICAgKiAgICAgRShrLFxwaS8yKSA9IFxpbnRfMF57XHBpLzJ9XHNxcnR7MSAtIGteMiBzaW5eMlx0aGV0YX0KKyAgICAgKiAgIEBmXQorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX2sgIFRoZSBhcmd1bWVudCBvZiB0aGUgY29tcGxldGUgZWxsaXB0aWMgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgY29tcGxldGUgZWxsaXB0aWMgZnVuY3Rpb24gb2YgdGhlIHNlY29uZCBraW5kLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2NvbXBfZWxsaW50XzIoY29uc3QgX1RwIF9faykKKyAgICB7CisKKyAgICAgIGlmIChfX2lzbmFuKF9faykpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoc3RkOjphYnMoX19rKSA9PSAxKQorICAgICAgICByZXR1cm4gX1RwKDEpOworICAgICAgZWxzZSBpZiAoc3RkOjphYnMoX19rKSA+IF9UcCgxKSkKKyAgICAgICAgc3RkOjpfX3Rocm93X2RvbWFpbl9lcnJvcihfX04oIkJhZCBhcmd1bWVudCBpbiBfX2NvbXBfZWxsaW50XzIuIikpOworICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fa2sgPSBfX2sgKiBfX2s7CisKKyAgICAgICAgICByZXR1cm4gX19lbGxpbnRfcmYoX1RwKDApLCBfVHAoMSkgLSBfX2trLCBfVHAoMSkpCisgICAgICAgICAgICAgICAtIF9fa2sgKiBfX2VsbGludF9yZChfVHAoMCksIF9UcCgxKSAtIF9fa2ssIF9UcCgxKSkgLyBfVHAoMyk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGluY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIHNlY29uZCBraW5kCisgICAgICogICAgICAgICAgIEBmJCBFKGssXHBoaSkgQGYkIHVzaW5nIHRoZSBDYXJsc29uIGZvcm11bGF0aW9uLgorICAgICAqIAorICAgICAqICAgVGhlIGluY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIHNlY29uZCBraW5kIGlzIGRlZmluZWQgYXMKKyAgICAgKiAgIEBmWworICAgICAqICAgICBFKGssXHBoaSkgPSBcaW50XzBee1xwaGl9IFxzcXJ0ezEgLSBrXjIgc2luXjJcdGhldGF9CisgICAgICogICBAZl0KKyAgICAgKiAKKyAgICAgKiAgIEBwYXJhbSAgX19rICBUaGUgYXJndW1lbnQgb2YgdGhlIGVsbGlwdGljIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX3BoaSAgVGhlIGludGVncmFsIGxpbWl0IGFyZ3VtZW50IG9mIHRoZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgc2Vjb25kIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZWxsaW50XzIoY29uc3QgX1RwIF9faywgY29uc3QgX1RwIF9fcGhpKQorICAgIHsKKworICAgICAgaWYgKF9faXNuYW4oX19rKSB8fCBfX2lzbmFuKF9fcGhpKSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChzdGQ6OmFicyhfX2spID4gX1RwKDEpKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50IGluIF9fZWxsaW50XzIuIikpOworICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgLy8gIFJlZHVjZSBwaGkgdG8gLXBpLzIgPCBwaGkgPCArcGkvMi4KKyAgICAgICAgICBjb25zdCBpbnQgX19uID0gc3RkOjpmbG9vcihfX3BoaSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDAuNUwpKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19waGlfcmVkID0gX19waGkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19uICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisKKyAgICAgICAgICBjb25zdCBfVHAgX19rayA9IF9fayAqIF9fazsKKyAgICAgICAgICBjb25zdCBfVHAgX19zID0gc3RkOjpzaW4oX19waGlfcmVkKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19zcyA9IF9fcyAqIF9fczsKKyAgICAgICAgICBjb25zdCBfVHAgX19zc3MgPSBfX3NzICogX19zOworICAgICAgICAgIGNvbnN0IF9UcCBfX2MgPSBzdGQ6OmNvcyhfX3BoaV9yZWQpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2NjID0gX19jICogX19jOworCisgICAgICAgICAgY29uc3QgX1RwIF9fRSA9IF9fcworICAgICAgICAgICAgICAgICAgICAgICAgKiBfX2VsbGludF9yZihfX2NjLCBfVHAoMSkgLSBfX2trICogX19zcywgX1RwKDEpKQorICAgICAgICAgICAgICAgICAgICAgICAgLSBfX2trICogX19zc3MKKyAgICAgICAgICAgICAgICAgICAgICAgICogX19lbGxpbnRfcmQoX19jYywgX1RwKDEpIC0gX19rayAqIF9fc3MsIF9UcCgxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIC8gX1RwKDMpOworCisgICAgICAgICAgaWYgKF9fbiA9PSAwKQorICAgICAgICAgICAgcmV0dXJuIF9fRTsKKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICByZXR1cm4gX19FICsgX1RwKDIpICogX19uICogX19jb21wX2VsbGludF8yKF9fayk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIENhcmxzb24gZWxsaXB0aWMgZnVuY3Rpb24KKyAgICAgKiAgICAgICAgICAgQGYkIFJfQyh4LHkpID0gUl9GKHgseSx5KSBAZiQgd2hlcmUgQGYkIFJfRih4LHkseikgQGYkCisgICAgICogICAgICAgICAgIGlzIHRoZSBDYXJsc29uIGVsbGlwdGljIGZ1bmN0aW9uIG9mIHRoZSBmaXJzdCBraW5kLgorICAgICAqIAorICAgICAqICAgVGhlIENhcmxzb24gZWxsaXB0aWMgZnVuY3Rpb24gaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIFJfQyh4LHkpID0gXGZyYWN7MX17Mn0gXGludF8wXlxpbmZ0eQorICAgICAqICAgICAgICAgICAgICAgICBcZnJhY3tkdH17KHQgKyB4KV57MS8yfSh0ICsgeSl9CisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgQmFzZWQgb24gQ2FybHNvbidzIGFsZ29yaXRobXM6CisgICAgICogICAtICBCLiBDLiBDYXJsc29uIE51bWVyLiBNYXRoLiAzMywgMSAoMTk3OSkKKyAgICAgKiAgIC0gIEIuIEMuIENhcmxzb24sIFNwZWNpYWwgRnVuY3Rpb25zIG9mIEFwcGxpZWQgTWF0aGVtYXRpY3MgKDE5NzcpCisgICAgICogICAtICBOdW1lcmljYWwgUmVjaXBlcyBpbiBDLCAybmQgZWQsIHBwLiAyNjEtMjY5LAorICAgICAqICAgICAgYnkgUHJlc3MsIFRldWtvbHNreSwgVmV0dGVybGluZywgRmxhbm5lcnkgKDE5OTIpCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgZmlyc3QgYXJndW1lbnQuCisgICAgICogICBAcGFyYW0gIF9feSAgVGhlIHNlY29uZCBhcmd1bWVudC4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBDYXJsc29uIGVsbGlwdGljIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2VsbGludF9yYyhjb25zdCBfVHAgX194LCBjb25zdCBfVHAgX195KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX21pbiA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6bWluKCk7CisgICAgICBjb25zdCBfVHAgX19tYXggPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1heCgpOworICAgICAgY29uc3QgX1RwIF9fbG9saW0gPSBfVHAoNSkgKiBfX21pbjsKKyAgICAgIGNvbnN0IF9UcCBfX3VwbGltID0gX19tYXggLyBfVHAoNSk7CisKKyAgICAgIGlmIChfX3ggPCBfVHAoMCkgfHwgX195IDwgX1RwKDApIHx8IF9feCArIF9feSA8IF9fbG9saW0pCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCBsZXNzIHRoYW4gemVybyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2VsbGludF9yYy4iKSk7CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMCA9IF9UcCgxKSAvIF9UcCg0KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMSA9IF9UcCgxKSAvIF9UcCg3KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMiA9IF9UcCg5KSAvIF9UcCgyMik7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzMgPSBfVHAoMykgLyBfVHAoMTApOworICAgICAgICAgIGNvbnN0IF9UcCBfX2M0ID0gX1RwKDMpIC8gX1RwKDgpOworCisgICAgICAgICAgX1RwIF9feG4gPSBfX3g7CisgICAgICAgICAgX1RwIF9feW4gPSBfX3k7CisKKyAgICAgICAgICBjb25zdCBfVHAgX19lcHMgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19lcnJ0b2wgPSBzdGQ6OnBvdyhfX2VwcyAvIF9UcCgzMCksIF9UcCgxKSAvIF9UcCg2KSk7CisgICAgICAgICAgX1RwIF9fbXU7CisgICAgICAgICAgX1RwIF9fc247CisKKyAgICAgICAgICBjb25zdCB1bnNpZ25lZCBpbnQgX19tYXhfaXRlciA9IDEwMDsKKyAgICAgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2l0ZXIgPSAwOyBfX2l0ZXIgPCBfX21heF9pdGVyOyArK19faXRlcikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19tdSA9IChfX3huICsgX1RwKDIpICogX195bikgLyBfVHAoMyk7CisgICAgICAgICAgICAgIF9fc24gPSAoX195biArIF9fbXUpIC8gX19tdSAtIF9UcCgyKTsKKyAgICAgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fc24pIDwgX19lcnJ0b2wpCisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2xhbWJkYSA9IF9UcCgyKSAqIHN0ZDo6c3FydChfX3huKSAqIHN0ZDo6c3FydChfX3luKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIF9feW47CisgICAgICAgICAgICAgIF9feG4gPSBfX2MwICogKF9feG4gKyBfX2xhbWJkYSk7CisgICAgICAgICAgICAgIF9feW4gPSBfX2MwICogKF9feW4gKyBfX2xhbWJkYSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICBfVHAgX19zID0gX19zbiAqIF9fc24KKyAgICAgICAgICAgICAgICAgICogKF9fYzMgKyBfX3NuKihfX2MxICsgX19zbiAqIChfX2M0ICsgX19zbiAqIF9fYzIpKSk7CisKKyAgICAgICAgICByZXR1cm4gKF9UcCgxKSArIF9fcykgLyBzdGQ6OnNxcnQoX19tdSk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIENhcmxzb24gZWxsaXB0aWMgZnVuY3Rpb24gQGYkIFJfSih4LHkseixwKSBAZiQKKyAgICAgKiAgICAgICAgICAgb2YgdGhlIHRoaXJkIGtpbmQuCisgICAgICogCisgICAgICogICBUaGUgQ2FybHNvbiBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgdGhpcmQga2luZCBpcyBkZWZpbmVkIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICAgICAgUl9KKHgseSx6LHApID0gXGZyYWN7M317Mn0gXGludF8wXlxpbmZ0eQorICAgICAqICAgICAgIFxmcmFje2R0fXsodCArIHgpXnsxLzJ9KHQgKyB5KV57MS8yfSh0ICsgeileezEvMn0odCArIHApfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIEJhc2VkIG9uIENhcmxzb24ncyBhbGdvcml0aG1zOgorICAgICAqICAgLSAgQi4gQy4gQ2FybHNvbiBOdW1lci4gTWF0aC4gMzMsIDEgKDE5NzkpCisgICAgICogICAtICBCLiBDLiBDYXJsc29uLCBTcGVjaWFsIEZ1bmN0aW9ucyBvZiBBcHBsaWVkIE1hdGhlbWF0aWNzICgxOTc3KQorICAgICAqICAgLSAgTnVtZXJpY2FsIFJlY2lwZXMgaW4gQywgMm5kIGVkLCBwcC4gMjYxLTI2OSwKKyAgICAgKiAgICAgIGJ5IFByZXNzLCBUZXVrb2xza3ksIFZldHRlcmxpbmcsIEZsYW5uZXJ5ICgxOTkyKQorICAgICAqCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGZpcnN0IG9mIHRocmVlIHN5bW1ldHJpYyBhcmd1bWVudHMuCisgICAgICogICBAcGFyYW0gIF9feSAgVGhlIHNlY29uZCBvZiB0aHJlZSBzeW1tZXRyaWMgYXJndW1lbnRzLgorICAgICAqICAgQHBhcmFtICBfX3ogIFRoZSB0aGlyZCBvZiB0aHJlZSBzeW1tZXRyaWMgYXJndW1lbnRzLgorICAgICAqICAgQHBhcmFtICBfX3AgIFRoZSBmb3VydGggYXJndW1lbnQuCisgICAgICogICBAcmV0dXJuICBUaGUgQ2FybHNvbiBlbGxpcHRpYyBmdW5jdGlvbiBvZiB0aGUgZm91cnRoIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZWxsaW50X3JqKGNvbnN0IF9UcCBfX3gsIGNvbnN0IF9UcCBfX3ksIGNvbnN0IF9UcCBfX3osIGNvbnN0IF9UcCBfX3ApCisgICAgeworICAgICAgY29uc3QgX1RwIF9fbWluID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptaW4oKTsKKyAgICAgIGNvbnN0IF9UcCBfX21heCA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6bWF4KCk7CisgICAgICBjb25zdCBfVHAgX19sb2xpbSA9IHN0ZDo6cG93KF9UcCg1KSAqIF9fbWluLCBfVHAoMSkvX1RwKDMpKTsKKyAgICAgIGNvbnN0IF9UcCBfX3VwbGltID0gX1RwKDAuM0wpCisgICAgICAgICAgICAgICAgICAgICAgICAqIHN0ZDo6cG93KF9UcCgwLjJMKSAqIF9fbWF4LCBfVHAoMSkvX1RwKDMpKTsKKworICAgICAgaWYgKF9feCA8IF9UcCgwKSB8fCBfX3kgPCBfVHAoMCkgfHwgX196IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQXJndW1lbnQgbGVzcyB0aGFuIHplcm8gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19lbGxpbnRfcmouIikpOworICAgICAgZWxzZSBpZiAoX194ICsgX195IDwgX19sb2xpbSB8fCBfX3ggKyBfX3ogPCBfX2xvbGltCisgICAgICAgICAgICB8fCBfX3kgKyBfX3ogPCBfX2xvbGltIHx8IF9fcCA8IF9fbG9saW0pCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCB0b28gc21hbGwgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19lbGxpbnRfcmoiKSk7CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMCA9IF9UcCgxKSAvIF9UcCg0KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19jMSA9IF9UcCgzKSAvIF9UcCgxNCk7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzIgPSBfVHAoMSkgLyBfVHAoMyk7CisgICAgICAgICAgY29uc3QgX1RwIF9fYzMgPSBfVHAoMykgLyBfVHAoMjIpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2M0ID0gX1RwKDMpIC8gX1RwKDI2KTsKKworICAgICAgICAgIF9UcCBfX3huID0gX194OworICAgICAgICAgIF9UcCBfX3luID0gX195OworICAgICAgICAgIF9UcCBfX3puID0gX196OworICAgICAgICAgIF9UcCBfX3BuID0gX19wOworICAgICAgICAgIF9UcCBfX3NpZ21hID0gX1RwKDApOworICAgICAgICAgIF9UcCBfX3Bvd2VyNCA9IF9UcCgxKTsKKworICAgICAgICAgIGNvbnN0IF9UcCBfX2VwcyA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2VycnRvbCA9IHN0ZDo6cG93KF9fZXBzIC8gX1RwKDgpLCBfVHAoMSkgLyBfVHAoNikpOworCisgICAgICAgICAgX1RwIF9fbGFtYmRhLCBfX211OworICAgICAgICAgIF9UcCBfX3huZGV2LCBfX3luZGV2LCBfX3puZGV2LCBfX3BuZGV2OworCisgICAgICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDA7CisgICAgICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pdGVyID0gMDsgX19pdGVyIDwgX19tYXhfaXRlcjsgKytfX2l0ZXIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fbXUgPSAoX194biArIF9feW4gKyBfX3puICsgX1RwKDIpICogX19wbikgLyBfVHAoNSk7CisgICAgICAgICAgICAgIF9feG5kZXYgPSAoX19tdSAtIF9feG4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX195bmRldiA9IChfX211IC0gX195bikgLyBfX211OworICAgICAgICAgICAgICBfX3puZGV2ID0gKF9fbXUgLSBfX3puKSAvIF9fbXU7CisgICAgICAgICAgICAgIF9fcG5kZXYgPSAoX19tdSAtIF9fcG4pIC8gX19tdTsKKyAgICAgICAgICAgICAgX1RwIF9fZXBzaWxvbiA9IHN0ZDo6bWF4KHN0ZDo6YWJzKF9feG5kZXYpLCBzdGQ6OmFicyhfX3luZGV2KSk7CisgICAgICAgICAgICAgIF9fZXBzaWxvbiA9IHN0ZDo6bWF4KF9fZXBzaWxvbiwgc3RkOjphYnMoX196bmRldikpOworICAgICAgICAgICAgICBfX2Vwc2lsb24gPSBzdGQ6Om1heChfX2Vwc2lsb24sIHN0ZDo6YWJzKF9fcG5kZXYpKTsKKyAgICAgICAgICAgICAgaWYgKF9fZXBzaWxvbiA8IF9fZXJydG9sKQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjb25zdCBfVHAgX194bnJvb3QgPSBzdGQ6OnNxcnQoX194bik7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3lucm9vdCA9IHN0ZDo6c3FydChfX3luKTsKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9fem5yb290ID0gc3RkOjpzcXJ0KF9fem4pOworICAgICAgICAgICAgICBjb25zdCBfVHAgX19sYW1iZGEgPSBfX3hucm9vdCAqIChfX3lucm9vdCArIF9fem5yb290KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBfX3lucm9vdCAqIF9fem5yb290OworICAgICAgICAgICAgICBjb25zdCBfVHAgX19hbHBoYTEgPSBfX3BuICogKF9feG5yb290ICsgX195bnJvb3QgKyBfX3pucm9vdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBfX3hucm9vdCAqIF9feW5yb290ICogX196bnJvb3Q7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2FscGhhMiA9IF9fYWxwaGExICogX19hbHBoYTE7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2JldGEgPSBfX3BuICogKF9fcG4gKyBfX2xhbWJkYSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiAoX19wbiArIF9fbGFtYmRhKTsKKyAgICAgICAgICAgICAgX19zaWdtYSArPSBfX3Bvd2VyNCAqIF9fZWxsaW50X3JjKF9fYWxwaGEyLCBfX2JldGEpOworICAgICAgICAgICAgICBfX3Bvd2VyNCAqPSBfX2MwOworICAgICAgICAgICAgICBfX3huID0gX19jMCAqIChfX3huICsgX19sYW1iZGEpOworICAgICAgICAgICAgICBfX3luID0gX19jMCAqIChfX3luICsgX19sYW1iZGEpOworICAgICAgICAgICAgICBfX3puID0gX19jMCAqIChfX3puICsgX19sYW1iZGEpOworICAgICAgICAgICAgICBfX3BuID0gX19jMCAqIChfX3BuICsgX19sYW1iZGEpOworICAgICAgICAgICAgfQorCisJICAvLyBOb3RlOiBfX2VhIGlzIGFuIFNQVSBiYWRuYW1lLgorICAgICAgICAgIF9UcCBfX2VhYSA9IF9feG5kZXYgKiAoX195bmRldiArIF9fem5kZXYpICsgX195bmRldiAqIF9fem5kZXY7CisgICAgICAgICAgX1RwIF9fZWIgPSBfX3huZGV2ICogX195bmRldiAqIF9fem5kZXY7CisgICAgICAgICAgX1RwIF9fZWMgPSBfX3BuZGV2ICogX19wbmRldjsKKyAgICAgICAgICBfVHAgX19lMiA9IF9fZWFhIC0gX1RwKDMpICogX19lYzsKKyAgICAgICAgICBfVHAgX19lMyA9IF9fZWIgKyBfVHAoMikgKiBfX3BuZGV2ICogKF9fZWFhIC0gX19lYyk7CisgICAgICAgICAgX1RwIF9fczEgPSBfVHAoMSkgKyBfX2UyICogKC1fX2MxICsgX1RwKDMpICogX19jMyAqIF9fZTIgLyBfVHAoNCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIF9UcCgzKSAqIF9fYzQgKiBfX2UzIC8gX1RwKDIpKTsKKyAgICAgICAgICBfVHAgX19zMiA9IF9fZWIgKiAoX19jMiAvIF9UcCgyKQorICAgICAgICAgICAgICAgICAgICsgX19wbmRldiAqICgtX19jMyAtIF9fYzMgKyBfX3BuZGV2ICogX19jNCkpOworICAgICAgICAgIF9UcCBfX3MzID0gX19wbmRldiAqIF9fZWFhICogKF9fYzIgLSBfX3BuZGV2ICogX19jMykKKyAgICAgICAgICAgICAgICAgICAtIF9fYzIgKiBfX3BuZGV2ICogX19lYzsKKworICAgICAgICAgIHJldHVybiBfVHAoMykgKiBfX3NpZ21hICsgX19wb3dlcjQgKiAoX19zMSArIF9fczIgKyBfX3MzKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyAoX19tdSAqIHN0ZDo6c3FydChfX211KSk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIHRoaXJkIGtpbmQKKyAgICAgKiAgICAgICAgICBAZiQgXFBpKGssXG51KSA9IFxQaShrLFxudSxccGkvMikgQGYkIHVzaW5nIHRoZQorICAgICAqICAgICAgICAgIENhcmxzb24gZm9ybXVsYXRpb24uCisgICAgICogCisgICAgICogICBUaGUgY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIHRoaXJkIGtpbmQgaXMgZGVmaW5lZCBhcworICAgICAqICAgQGZbCisgICAgICogICAgIFxQaShrLFxudSkgPSBcaW50XzBee1xwaS8yfQorICAgICAqICAgICAgICAgICAgICAgICAgIFxmcmFje2RcdGhldGF9CisgICAgICogICAgICAgICAgICAgICAgIHsoMSAtIFxudSBcc2luXjJcdGhldGEpXHNxcnR7MSAtIGteMiBcc2luXjJcdGhldGF9fQorICAgICAqICAgQGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fayAgVGhlIGFyZ3VtZW50IG9mIHRoZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19udSAgVGhlIHNlY29uZCBhcmd1bWVudCBvZiB0aGUgZWxsaXB0aWMgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgY29tcGxldGUgZWxsaXB0aWMgZnVuY3Rpb24gb2YgdGhlIHRoaXJkIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fY29tcF9lbGxpbnRfMyhjb25zdCBfVHAgX19rLCBjb25zdCBfVHAgX19udSkKKyAgICB7CisKKyAgICAgIGlmIChfX2lzbmFuKF9faykgfHwgX19pc25hbihfX251KSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChfX251ID09IF9UcCgxKSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6aW5maW5pdHkoKTsKKyAgICAgIGVsc2UgaWYgKHN0ZDo6YWJzKF9faykgPiBfVHAoMSkpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJCYWQgYXJndW1lbnQgaW4gX19jb21wX2VsbGludF8zLiIpKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX2trID0gX19rICogX19rOworCisgICAgICAgICAgcmV0dXJuIF9fZWxsaW50X3JmKF9UcCgwKSwgX1RwKDEpIC0gX19raywgX1RwKDEpKQorICAgICAgICAgICAgICAgLSBfX251CisgICAgICAgICAgICAgICAqIF9fZWxsaW50X3JqKF9UcCgwKSwgX1RwKDEpIC0gX19raywgX1RwKDEpLCBfVHAoMSkgKyBfX251KQorICAgICAgICAgICAgICAgLyBfVHAoMyk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgaW5jb21wbGV0ZSBlbGxpcHRpYyBpbnRlZ3JhbCBvZiB0aGUgdGhpcmQga2luZAorICAgICAqICAgICAgICAgIEBmJCBcUGkoayxcbnUsXHBoaSkgQGYkIHVzaW5nIHRoZSBDYXJsc29uIGZvcm11bGF0aW9uLgorICAgICAqIAorICAgICAqICAgVGhlIGluY29tcGxldGUgZWxsaXB0aWMgaW50ZWdyYWwgb2YgdGhlIHRoaXJkIGtpbmQgaXMgZGVmaW5lZCBhcworICAgICAqICAgQGZbCisgICAgICogICAgIFxQaShrLFxudSxccGhpKSA9IFxpbnRfMF57XHBoaX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgXGZyYWN7ZFx0aGV0YX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7KDEgLSBcbnUgXHNpbl4yXHRoZXRhKQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcc3FydHsxIC0ga14yIFxzaW5eMlx0aGV0YX19CisgICAgICogICBAZl0KKyAgICAgKiAKKyAgICAgKiAgIEBwYXJhbSAgX19rICBUaGUgYXJndW1lbnQgb2YgdGhlIGVsbGlwdGljIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX251ICBUaGUgc2Vjb25kIGFyZ3VtZW50IG9mIHRoZSBlbGxpcHRpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19waGkgIFRoZSBpbnRlZ3JhbCBsaW1pdCBhcmd1bWVudCBvZiB0aGUgZWxsaXB0aWMgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgZWxsaXB0aWMgZnVuY3Rpb24gb2YgdGhlIHRoaXJkIGtpbmQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZWxsaW50XzMoY29uc3QgX1RwIF9faywgY29uc3QgX1RwIF9fbnUsIGNvbnN0IF9UcCBfX3BoaSkKKyAgICB7CisKKyAgICAgIGlmIChfX2lzbmFuKF9faykgfHwgX19pc25hbihfX251KSB8fCBfX2lzbmFuKF9fcGhpKSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChzdGQ6OmFicyhfX2spID4gX1RwKDEpKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50IGluIF9fZWxsaW50XzMuIikpOworICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgLy8gIFJlZHVjZSBwaGkgdG8gLXBpLzIgPCBwaGkgPCArcGkvMi4KKyAgICAgICAgICBjb25zdCBpbnQgX19uID0gc3RkOjpmbG9vcihfX3BoaSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDAuNUwpKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19waGlfcmVkID0gX19waGkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19uICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisKKyAgICAgICAgICBjb25zdCBfVHAgX19rayA9IF9fayAqIF9fazsKKyAgICAgICAgICBjb25zdCBfVHAgX19zID0gc3RkOjpzaW4oX19waGlfcmVkKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19zcyA9IF9fcyAqIF9fczsKKyAgICAgICAgICBjb25zdCBfVHAgX19zc3MgPSBfX3NzICogX19zOworICAgICAgICAgIGNvbnN0IF9UcCBfX2MgPSBzdGQ6OmNvcyhfX3BoaV9yZWQpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2NjID0gX19jICogX19jOworCisgICAgICAgICAgY29uc3QgX1RwIF9fUGkgPSBfX3MKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIF9fZWxsaW50X3JmKF9fY2MsIF9UcCgxKSAtIF9fa2sgKiBfX3NzLCBfVHAoMSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgLSBfX251ICogX19zc3MKKyAgICAgICAgICAgICAgICAgICAgICA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oZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfRTFfc2VyaWVzKGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBfVHAgX190ZXJtID0gX1RwKDEpOworICAgICAgX1RwIF9fZXN1bSA9IF9UcCgwKTsKKyAgICAgIF9UcCBfX29zdW0gPSBfVHAoMCk7CisgICAgICBjb25zdCB1bnNpZ25lZCBpbnQgX19tYXhfaXRlciA9IDEwMDsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDE7IF9faSA8IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX190ZXJtICo9IC0gX194IC8gX19pOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0pIDwgX19lcHMpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBpZiAoX190ZXJtID49IF9UcCgwKSkKKyAgICAgICAgICAgIF9fZXN1bSArPSBfX3Rlcm0gLyBfX2k7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgX19vc3VtICs9IF9fdGVybSAvIF9faTsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gLSBfX2VzdW0gLSBfX29zdW0KKyAgICAgICAgICAgICAtIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19nYW1tYV9lKCkgLSBzdGQ6OmxvZyhfX3gpOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgUmV0dXJuIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBAZiQgRV8xKHgpIEBmJAorICAgICAqICAgICAgICAgIGJ5IGFzeW1wdG90aWMgZXhwYW5zaW9uLgorICAgICAqIAorICAgICAqICAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsIGlzIGdpdmVuIGJ5CisgICAgICogICAgICAgICAgXGZbCisgICAgICogICAgICAgICAgICBFXzEoeCkgPSBcaW50X3sxfV5caW5mdHkgXGZyYWN7ZV57LXh0fX17dH0gZHQKKyAgICAgKiAgICAgICAgICBcZl0KKyAgICAgKiAKKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGV4cG9uZW50aWFsIGludGVncmFsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2V4cGludF9FMV9hc3ltcChjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIF9UcCBfX3Rlcm0gPSBfVHAoMSk7CisgICAgICBfVHAgX19lc3VtID0gX1RwKDEpOworICAgICAgX1RwIF9fb3N1bSA9IF9UcCgwKTsKKyAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBfX21heF9pdGVyID0gMTAwMDsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDE7IF9faSA8IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX1RwIF9fcHJldiA9IF9fdGVybTsKKyAgICAgICAgICBfX3Rlcm0gKj0gLSBfX2kgLyBfX3g7CisgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fdGVybSkgPiBzdGQ6OmFicyhfX3ByZXYpKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgaWYgKF9fdGVybSA+PSBfVHAoMCkpCisgICAgICAgICAgICBfX2VzdW0gKz0gX190ZXJtOworICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIF9fb3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIHN0ZDo6ZXhwKC0gX194KSAqIChfX2VzdW0gKyBfX29zdW0pIC8gX194OworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgUmV0dXJuIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBAZiQgRV9uKHgpIEBmJAorICAgICAqICAgICAgICAgIGJ5IHNlcmllcyBzdW1tYXRpb24uCisgICAgICogCisgICAgICogICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgaXMgZ2l2ZW4gYnkKKyAgICAgKiAgICAgICAgICBcZlsKKyAgICAgKiAgICAgICAgICAgIEVfbih4KSA9IFxpbnRfezF9XlxpbmZ0eSBcZnJhY3tlXnsteHR9fXt0Xm59IGR0CisgICAgICogICAgICAgICAgXGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fbiAgVGhlIG9yZGVyIG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGV4cG9uZW50aWFsIGludGVncmFsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2V4cGludF9Fbl9zZXJpZXMoY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBjb25zdCB1bnNpZ25lZCBpbnQgX19tYXhfaXRlciA9IDEwMDsKKyAgICAgIGNvbnN0IF9UcCBfX2VwcyA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworICAgICAgY29uc3QgaW50IF9fbm0xID0gX19uIC0gMTsKKyAgICAgIF9UcCBfX2FucyA9IChfX25tMSAhPSAwCisgICAgICAgICAgICAgICAgPyBfVHAoMSkgLyBfX25tMSA6IC1zdGQ6OmxvZyhfX3gpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX2dhbW1hX2UoKSk7CisgICAgICBfVHAgX19mYWN0ID0gX1RwKDEpOworICAgICAgZm9yIChpbnQgX19pID0gMTsgX19pIDw9IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX19mYWN0ICo9IC1fX3ggLyBfVHAoX19pKTsKKyAgICAgICAgICBfVHAgX19kZWw7CisgICAgICAgICAgaWYgKCBfX2kgIT0gX19ubTEgKQorICAgICAgICAgICAgX19kZWwgPSAtX19mYWN0IC8gX1RwKF9faSAtIF9fbm0xKTsKKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9UcCBfX3BzaSA9IC1fX251bWVyaWNfY29uc3RhbnRzPF9UcD46OmdhbW1hX2UoKTsKKyAgICAgICAgICAgICAgZm9yIChpbnQgX19paSA9IDE7IF9faWkgPD0gX19ubTE7ICsrX19paSkKKyAgICAgICAgICAgICAgICBfX3BzaSArPSBfVHAoMSkgLyBfVHAoX19paSk7CisgICAgICAgICAgICAgIF9fZGVsID0gX19mYWN0ICogKF9fcHNpIC0gc3RkOjpsb2coX194KSk7IAorICAgICAgICAgICAgfQorICAgICAgICAgIF9fYW5zICs9IF9fZGVsOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2RlbCkgPCBfX2VwcyAqIHN0ZDo6YWJzKF9fYW5zKSkKKyAgICAgICAgICAgIHJldHVybiBfX2FuczsKKyAgICAgICAgfQorICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJTZXJpZXMgc3VtbWF0aW9uIGZhaWxlZCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fZXhwaW50X0VuX3Nlcmllcy4iKSk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIGV4cG9uZW50aWFsIGludGVncmFsIEBmJCBFX24oeCkgQGYkCisgICAgICogICAgICAgICAgYnkgY29udGludWVkIGZyYWN0aW9ucy4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBpcyBnaXZlbiBieQorICAgICAqICAgICAgICAgIFxmWworICAgICAqICAgICAgICAgICAgRV9uKHgpID0gXGludF97MX1eXGluZnR5IFxmcmFje2Veey14dH19e3Rebn0gZHQKKyAgICAgKiAgICAgICAgICBcZl0KKyAgICAgKiAKKyAgICAgKiAgIEBwYXJhbSAgX19uICBUaGUgb3JkZXIgb2YgdGhlIGV4cG9uZW50aWFsIGludGVncmFsIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX3ggIFRoZSBhcmd1bWVudCBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZXhwaW50X0VuX2NvbnRfZnJhYyhjb25zdCB1bnNpZ25lZCBpbnQgX19uLCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBfX21heF9pdGVyID0gMTAwOworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBjb25zdCBfVHAgX19mcF9taW4gPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1pbigpOworICAgICAgY29uc3QgaW50IF9fbm0xID0gX19uIC0gMTsKKyAgICAgIF9UcCBfX2IgPSBfX3ggKyBfVHAoX19uKTsKKyAgICAgIF9UcCBfX2MgPSBfVHAoMSkgLyBfX2ZwX21pbjsKKyAgICAgIF9UcCBfX2QgPSBfVHAoMSkgLyBfX2I7CisgICAgICBfVHAgX19oID0gX19kOworICAgICAgZm9yICggdW5zaWduZWQgaW50IF9faSA9IDE7IF9faSA8PSBfX21heF9pdGVyOyArK19faSApCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19hID0gLV9UcChfX2kgKiAoX19ubTEgKyBfX2kpKTsKKyAgICAgICAgICBfX2IgKz0gX1RwKDIpOworICAgICAgICAgIF9fZCA9IF9UcCgxKSAvIChfX2EgKiBfX2QgKyBfX2IpOworICAgICAgICAgIF9fYyA9IF9fYiArIF9fYSAvIF9fYzsKKyAgICAgICAgICBjb25zdCBfVHAgX19kZWwgPSBfX2MgKiBfX2Q7CisgICAgICAgICAgX19oICo9IF9fZGVsOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2RlbCAtIF9UcCgxKSkgPCBfX2VwcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9fYW5zID0gX19oICogc3RkOjpleHAoLV9feCk7CisgICAgICAgICAgICAgIHJldHVybiBfX2FuczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJDb250aW51ZWQgZnJhY3Rpb24gZmFpbGVkICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19leHBpbnRfRW5fY29udF9mcmFjLiIpKTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVfbih4KSBAZiQKKyAgICAgKiAgICAgICAgICBieSByZWN1cnNpb24uICBVc2UgdXB3YXJkIHJlY3Vyc2lvbiBmb3IgQGYkIHggPCBuIEBmJAorICAgICAqICAgICAgICAgIGFuZCBkb3dud2FyZCByZWN1cnNpb24gKE1pbGxlcidzIGFsZ29yaXRobSkgb3RoZXJ3aXNlLgorICAgICAqIAorICAgICAqICAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsIGlzIGdpdmVuIGJ5CisgICAgICogICAgICAgICAgXGZbCisgICAgICogICAgICAgICAgICBFX24oeCkgPSBcaW50X3sxfV5caW5mdHkgXGZyYWN7ZV57LXh0fX17dF5ufSBkdAorICAgICAqICAgICAgICAgIFxmXQorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX24gIFRoZSBvcmRlciBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfRW5fcmVjdXJzaW9uKGNvbnN0IHVuc2lnbmVkIGludCBfX24sIGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgX1RwIF9fRW47CisgICAgICBfVHAgX19FMSA9IF9fZXhwaW50X0UxKF9feCk7CisgICAgICBpZiAoX194IDwgX1RwKF9fbikpCisgICAgICAgIHsKKyAgICAgICAgICAvLyAgRm9yd2FyZCByZWN1cnNpb24gaXMgc3RhYmxlIG9ubHkgZm9yIG4gPCB4LgorICAgICAgICAgIF9fRW4gPSBfX0UxOworICAgICAgICAgIGZvciAodW5zaWduZWQgaW50IF9faiA9IDI7IF9faiA8IF9fbjsgKytfX2opCisgICAgICAgICAgICBfX0VuID0gKHN0ZDo6ZXhwKC1fX3gpIC0gX194ICogX19FbikgLyBfVHAoX19qIC0gMSk7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIC8vICBCYWNrd2FyZCByZWN1cnNpb24gaXMgc3RhYmxlIG9ubHkgZm9yIG4gPj0geC4KKyAgICAgICAgICBfX0VuID0gX1RwKDEpOworICAgICAgICAgIGNvbnN0IGludCBfX04gPSBfX24gKyAyMDsgIC8vICBUT0RPOiBDaGVjayB0aGlzIHN0YXJ0aW5nIG51bWJlci4KKyAgICAgICAgICBfVHAgX19zYXZlID0gX1RwKDApOworICAgICAgICAgIGZvciAoaW50IF9faiA9IF9fTjsgX19qID4gMDsgLS1fX2opCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fRW4gPSAoc3RkOjpleHAoLV9feCkgLSBfX2ogKiBfX0VuKSAvIF9feDsKKyAgICAgICAgICAgICAgaWYgKF9faiA9PSBfX24pCisgICAgICAgICAgICAgICAgX19zYXZlID0gX19FbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIF9UcCBfX25vcm0gPSBfX0VuIC8gX19FMTsKKyAgICAgICAgICAgIF9fRW4gLz0gX19ub3JtOworICAgICAgICB9CisKKyAgICAgIHJldHVybiBfX0VuOworICAgIH0KKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVpKHgpIEBmJAorICAgICAqICAgICAgICAgIGJ5IHNlcmllcyBzdW1tYXRpb24uCisgICAgICogCisgICAgICogICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgaXMgZ2l2ZW4gYnkKKyAgICAgKiAgICAgICAgICBcZlsKKyAgICAgKiAgICAgICAgICAgIEVpKHgpID0gLVxpbnRfey14fV5caW5mdHkgXGZyYWN7ZV50fXt0fSBkdAorICAgICAqICAgICAgICAgIFxmXQorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX3ggIFRoZSBhcmd1bWVudCBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZXhwaW50X0VpX3Nlcmllcyhjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIF9UcCBfX3Rlcm0gPSBfVHAoMSk7CisgICAgICBfVHAgX19zdW0gPSBfVHAoMCk7CisgICAgICBjb25zdCB1bnNpZ25lZCBpbnQgX19tYXhfaXRlciA9IDEwMDA7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2kgPSAxOyBfX2kgPCBfX21heF9pdGVyOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIF9fdGVybSAqPSBfX3ggLyBfX2k7CisgICAgICAgICAgX19zdW0gKz0gX190ZXJtIC8gX19pOworICAgICAgICAgIGlmIChfX3Rlcm0gPCBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKSAqIF9fc3VtKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19nYW1tYV9lKCkgKyBfX3N1bSArIHN0ZDo6bG9nKF9feCk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIGV4cG9uZW50aWFsIGludGVncmFsIEBmJCBFaSh4KSBAZiQKKyAgICAgKiAgICAgICAgICBieSBhc3ltcHRvdGljIGV4cGFuc2lvbi4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBpcyBnaXZlbiBieQorICAgICAqICAgICAgICAgIFxmWworICAgICAqICAgICAgICAgICAgRWkoeCkgPSAtXGludF97LXh9XlxpbmZ0eSBcZnJhY3tlXnR9e3R9IGR0CisgICAgICogICAgICAgICAgXGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfRWlfYXN5bXAoY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBfVHAgX190ZXJtID0gX1RwKDEpOworICAgICAgX1RwIF9fc3VtID0gX1RwKDEpOworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDAwOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pID0gMTsgX19pIDwgX19tYXhfaXRlcjsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19wcmV2ID0gX190ZXJtOworICAgICAgICAgIF9fdGVybSAqPSBfX2kgLyBfX3g7CisgICAgICAgICAgaWYgKF9fdGVybSA8IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgaWYgKF9fdGVybSA+PSBfX3ByZXYpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIHN0ZDo6ZXhwKF9feCkgKiBfX3N1bSAvIF9feDsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVpKHgpIEBmJC4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBpcyBnaXZlbiBieQorICAgICAqICAgICAgICAgIFxmWworICAgICAqICAgICAgICAgICAgRWkoeCkgPSAtXGludF97LXh9XlxpbmZ0eSBcZnJhY3tlXnR9e3R9IGR0CisgICAgICogICAgICAgICAgXGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfRWkoY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBpZiAoX194IDwgX1RwKDApKQorICAgICAgICByZXR1cm4gLV9fZXhwaW50X0UxKC1fX3gpOworICAgICAgZWxzZSBpZiAoX194IDwgLXN0ZDo6bG9nKHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpKSkKKyAgICAgICAgcmV0dXJuIF9fZXhwaW50X0VpX3NlcmllcyhfX3gpOworICAgICAgZWxzZQorICAgICAgICByZXR1cm4gX19leHBpbnRfRWlfYXN5bXAoX194KTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVfMSh4KSBAZiQuCisgICAgICogCisgICAgICogICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgaXMgZ2l2ZW4gYnkKKyAgICAgKiAgICAgICAgICBcZlsKKyAgICAgKiAgICAgICAgICAgIEVfMSh4KSA9IFxpbnRfezF9XlxpbmZ0eSBcZnJhY3tlXnsteHR9fXt0fSBkdAorICAgICAqICAgICAgICAgIFxmXQorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX3ggIFRoZSBhcmd1bWVudCBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fZXhwaW50X0UxKGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9feCA8IF9UcCgwKSkKKyAgICAgICAgcmV0dXJuIC1fX2V4cGludF9FaSgtX194KTsKKyAgICAgIGVsc2UgaWYgKF9feCA8IF9UcCgxKSkKKyAgICAgICAgcmV0dXJuIF9fZXhwaW50X0UxX3NlcmllcyhfX3gpOworICAgICAgZWxzZSBpZiAoX194IDwgX1RwKDEwMCkpICAvLyAgVE9ETzogRmluZCBhIGdvb2QgYXN5bXB0b3RpYyBzd2l0Y2ggcG9pbnQuCisgICAgICAgIHJldHVybiBfX2V4cGludF9Fbl9jb250X2ZyYWMoMSwgX194KTsKKyAgICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIF9fZXhwaW50X0UxX2FzeW1wKF9feCk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIGV4cG9uZW50aWFsIGludGVncmFsIEBmJCBFX24oeCkgQGYkCisgICAgICogICAgICAgICAgZm9yIGxhcmdlIGFyZ3VtZW50LgorICAgICAqIAorICAgICAqICAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsIGlzIGdpdmVuIGJ5CisgICAgICogICAgICAgICAgXGZbCisgICAgICogICAgICAgICAgICBFX24oeCkgPSBcaW50X3sxfV5caW5mdHkgXGZyYWN7ZV57LXh0fX17dF5ufSBkdAorICAgICAqICAgICAgICAgIFxmXQorICAgICAqIAorICAgICAqICAgVGhpcyBpcyBzb21ldGhpbmcgb2YgYW4gZXh0ZW5zaW9uLgorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX24gIFRoZSBvcmRlciBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfYXN5bXAoY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBfVHAgX190ZXJtID0gX1RwKDEpOworICAgICAgX1RwIF9fc3VtID0gX1RwKDEpOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pID0gMTsgX19pIDw9IF9fbjsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19wcmV2ID0gX190ZXJtOworICAgICAgICAgIF9fdGVybSAqPSAtKF9fbiAtIF9faSArIDEpIC8gX194OworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0pID4gc3RkOjphYnMoX19wcmV2KSkKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIF9fc3VtICs9IF9fdGVybTsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gc3RkOjpleHAoLV9feCkgKiBfX3N1bSAvIF9feDsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVfbih4KSBAZiQKKyAgICAgKiAgICAgICAgICBmb3IgbGFyZ2Ugb3JkZXIuCisgICAgICogCisgICAgICogICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgaXMgZ2l2ZW4gYnkKKyAgICAgKiAgICAgICAgICBcZlsKKyAgICAgKiAgICAgICAgICAgIEVfbih4KSA9IFxpbnRfezF9XlxpbmZ0eSBcZnJhY3tlXnsteHR9fXt0Xm59IGR0CisgICAgICogICAgICAgICAgXGZdCisgICAgICogICAgICAgIAorICAgICAqICAgVGhpcyBpcyBzb21ldGhpbmcgb2YgYW4gZXh0ZW5zaW9uLgorICAgICAqIAorICAgICAqICAgQHBhcmFtICBfX24gIFRoZSBvcmRlciBvZiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19leHBpbnRfbGFyZ2Vfbihjb25zdCB1bnNpZ25lZCBpbnQgX19uLCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX3hwbiA9IF9feCArIF9fbjsKKyAgICAgIGNvbnN0IF9UcCBfX3hwbjIgPSBfX3hwbiAqIF9feHBuOworICAgICAgX1RwIF9fdGVybSA9IF9UcCgxKTsKKyAgICAgIF9UcCBfX3N1bSA9IF9UcCgxKTsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDE7IF9faSA8PSBfX247ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX1RwIF9fcHJldiA9IF9fdGVybTsKKyAgICAgICAgICBfX3Rlcm0gKj0gKF9fbiAtIDIgKiAoX19pIC0gMSkgKiBfX3gpIC8gX194cG4yOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0pIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIHN0ZDo6ZXhwKC1fX3gpICogX19zdW0gLyBfX3hwbjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgQGYkIEVfbih4KSBAZiQuCisgICAgICogCisgICAgICogICBUaGUgZXhwb25lbnRpYWwgaW50ZWdyYWwgaXMgZ2l2ZW4gYnkKKyAgICAgKiAgICAgICAgICBcZlsKKyAgICAgKiAgICAgICAgICAgIEVfbih4KSA9IFxpbnRfezF9XlxpbmZ0eSBcZnJhY3tlXnsteHR9fXt0Xm59IGR0CisgICAgICogICAgICAgICAgXGZdCisgICAgICogICBUaGlzIGlzIHNvbWV0aGluZyBvZiBhbiBleHRlbnNpb24uCisgICAgICogCisgICAgICogICBAcGFyYW0gIF9fbiAgVGhlIG9yZGVyIG9mIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGV4cG9uZW50aWFsIGludGVncmFsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2V4cGludChjb25zdCB1bnNpZ25lZCBpbnQgX19uLCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIC8vICBSZXR1cm4gTmFOIG9uIE5hTiBpbnB1dC4KKyAgICAgIGlmIChfX2lzbmFuKF9feCkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoX19uIDw9IDEgJiYgX194ID09IF9UcCgwKSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6aW5maW5pdHkoKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0UwID0gc3RkOjpleHAoX194KSAvIF9feDsKKyAgICAgICAgICBpZiAoX19uID09IDApCisgICAgICAgICAgICByZXR1cm4gX19FMDsKKworICAgICAgICAgIF9UcCBfX0UxID0gX19leHBpbnRfRTEoX194KTsKKyAgICAgICAgICBpZiAoX19uID09IDEpCisgICAgICAgICAgICByZXR1cm4gX19FMTsKKworICAgICAgICAgIGlmIChfX3ggPT0gX1RwKDApKQorICAgICAgICAgICAgcmV0dXJuIF9UcCgxKSAvIHN0YXRpY19jYXN0PF9UcD4oX19uIC0gMSk7CisKKyAgICAgICAgICBfVHAgX19FbiA9IF9fZXhwaW50X0VuX3JlY3Vyc2lvbihfX24sIF9feCk7CisKKyAgICAgICAgICByZXR1cm4gX19FbjsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgUmV0dXJuIHRoZSBleHBvbmVudGlhbCBpbnRlZ3JhbCBAZiQgRWkoeCkgQGYkLgorICAgICAqIAorICAgICAqICAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsIGlzIGdpdmVuIGJ5CisgICAgICogICBcZlsKKyAgICAgKiAgICAgRWkoeCkgPSAtXGludF97LXh9XlxpbmZ0eSBcZnJhY3tlXnR9e3R9IGR0CisgICAgICogICBcZl0KKyAgICAgKiAKKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGV4cG9uZW50aWFsIGludGVncmFsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGV4cG9uZW50aWFsIGludGVncmFsLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX1RwCisgICAgX19leHBpbnQoY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBpZiAoX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIF9fZXhwaW50X0VpKF9feCk7CisgICAgfQorCisgIF9HTElCQ1hYX0VORF9OQU1FU1BBQ0VfVkVSU0lPTgorICB9IC8vIG5hbWVzcGFjZSBzdGQ6OnRyMTo6X19kZXRhaWwKK30KK30KKworI2VuZGlmIC8vIF9HTElCQ1hYX1RSMV9FWFBfSU5URUdSQUxfVENDCmRpZmYgL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wPjo6dHlwZQorICAgICAgICBfTV9mdW5jX3R5cGU7CisKKyAgICAgIF9UcCogX01fZGF0YTsKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9UcCB0eXBlOworCisgICAgICBleHBsaWNpdAorICAgICAgcmVmZXJlbmNlX3dyYXBwZXIoX1RwJiBfX2luZGF0YSkKKyAgICAgIDogX01fZGF0YShzdGQ6Ol9fYWRkcmVzc29mKF9faW5kYXRhKSkKKyAgICAgIHsgfQorCisgICAgICByZWZlcmVuY2Vfd3JhcHBlcihjb25zdCByZWZlcmVuY2Vfd3JhcHBlcjxfVHA+JiBfX2lucmVmKToKKyAgICAgIF9NX2RhdGEoX19pbnJlZi5fTV9kYXRhKQorICAgICAgeyB9CisKKyAgICAgIHJlZmVyZW5jZV93cmFwcGVyJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHJlZmVyZW5jZV93cmFwcGVyPF9UcD4mIF9faW5yZWYpCisgICAgICB7CisgICAgICAgIF9NX2RhdGEgPSBfX2lucmVmLl9NX2RhdGE7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgb3BlcmF0b3IgX1RwJigpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5nZXQoKTsgfQorCisgICAgICBfVHAmCisgICAgICBnZXQoKSBjb25zdAorICAgICAgeyByZXR1cm4gKl9NX2RhdGE7IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3M+CisgICAgICAgIHR5cGVuYW1lIHJlc3VsdF9vZjxfTV9mdW5jX3R5cGUoX0FyZ3MuLi4pPjo6dHlwZQorICAgICAgICBvcGVyYXRvcigpKF9BcmdzJi4uLiBfX2FyZ3MpIGNvbnN0CisgICAgICAgIHsKKwkgIHJldHVybiBfX2ludm9rZShnZXQoKSwgX19hcmdzLi4uKTsKKwl9CisgICAgfTsKKworCisgIC8vIERlbm90ZXMgYSByZWZlcmVuY2Ugc2hvdWxkIGJlIHRha2VuIHR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isgICAgICAvLyBUaGlzIGJpdCBvZiBnZW5pdXMgaXMgZHVlIHRvIFBldGVyIERpbW92LCBpbXByb3ZlZCBzbGlnaHRseSBieQorICAgICAgLy8gRG91Z2xhcyBHcmVnb3IuCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICAgIF9SZXMmCisgICAgICAgIF9NX2NhbGwoX1RwJiBfX29iamVjdCwgX0NsYXNzICopIGNvbnN0CisgICAgICAgIHsgcmV0dXJuIF9fb2JqZWN0LipfX3BtOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX1VwPgorICAgICAgICBfUmVzJgorICAgICAgICBfTV9jYWxsKF9UcCYgX19vYmplY3QsIF9VcCAqIGNvbnN0ICopIGNvbnN0CisgICAgICAgIHsgcmV0dXJuICgqX19vYmplY3QpLipfX3BtOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgdHlwZW5hbWUgX1VwPgorICAgICAgICBjb25zdCBfUmVzJgorICAgICAgICBfTV9jYWxsKF9UcCYgX19vYmplY3QsIGNvbnN0IF9VcCAqIGNvbnN0ICopIGNvbnN0CisgICAgICAgIHsgcmV0dXJuICgqX19vYmplY3QpLipfX3BtOyB9CisKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgICAgY29uc3QgX1JlcyYKKyAgICAgICAgX01fY2FsbChfVHAmIF9fb2JqZWN0LCBjb25zdCBfQ2xhc3MgKikgY29uc3QKKyAgICAgICAgeyByZXR1cm4gX19vYmplY3QuKl9fcG07IH0KKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICBjb25zdCBfUmVzJgorICAgICAgICBfTV9jYWxsKF9UcCYgX19wdHIsIGNvbnN0IHZvbGF0aWxlIHZvaWQqKSBjb25zdAorICAgICAgICB7IHJldHVybiAoKl9fcHRyKS4qX19wbTsgfQorCisgICAgICB0ZW1wbG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dGVtcGxhdGU8dHlwZW5hbWUgX1NpZ25hdHVyZT4KKyAgICAgICAgc3RydWN0IHJlc3VsdDsKKworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0NWTWVtLCB0eXBlbmFtZSBfVHA+CisgICAgICAgIHN0cnVjdCByZXN1bHQ8X0NWTWVtKF9UcCk+CisJOiBwdWJsaWMgX1Jlc3VsdF90eXBlPF9UcD4geyB9OworCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ1ZNZW0sIHR5cGVuYW1lIF9UcD4KKyAgICAgICAgc3RydWN0IHJlc3VsdDxfQ1ZNZW0oX1RwJik+CisJOiBwdWJsaWMgX1Jlc3VsdF90eXBlPF9UcD4geyB9OworCisgICAgICBleHBsaWNpdAorICAgICAgX01lbV9mbihfUmVzIF9DbGFzczo6Kl9fcG0pIDogX19wbShfX3BtKSB7IH0KKworICAgICAgLy8gSGFuZGxlIG9iamVjdHMKKyAgICAgIF9SZXMmCisgICAgICBvcGVyYXRvcigpKF9DbGFzcyYgX19vYmplY3QpIGNvbnN0CisgICAgICB7IHJldHVybiBfX29iamVjdC4qX19wbTsgfQorCisgICAgICBjb25zdCBfUmVzJgorICAgICAgb3BlcmF0b3IoKShjb25zdCBfQ2xhc3MmIF9fb2JqZWN0KSBjb25zdAorICAgICAgeyByZXR1cm4gX19vYmplY3QuKl9fcG07IH0KKworICAgICAgLy8gSGFuZGxlIHBvaW50ZXJzCisgICAgICBfUmVzJgorICAgICAgb3BlcmF0b3IoKShfQ2xhc3MqIF9fb2JqZWN0KSBjb25zdAorICAgICAgeyByZXR1cm4gX19vYmplY3QtPipfX3BtOyB9CisKKyAgICAgIGNvbnN0IF9SZXMmCisgICAgICBvcGVyYXRvcigpKGNvbnN0IF9DbGFzcyogX19vYmplY3QpIGNvbnN0CisgICAgICB7IHJldHVybiBfX29iamVjdC0+Kl9fcG07IH0KKworICAgICAgLy8gSGFuZGxlIHNtYXJ0IHBvaW50ZXJzIGFuZCBkZXJpd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ncywgdHVwbGU8X0FyZ3MuLi4+KT46OnR5cGUuLi4pCisgICAgICAgICAgICAgICAgID46OnR5cGUKKyAgICAgICAgX19jYWxsKGNvbnN0IHR1cGxlPF9BcmdzLi4uPiYgX19hcmdzLCBfSW5kZXhfdHVwbGU8X0luZGV4ZXMuLi4+KQorICAgICAgICB7CisgICAgICAgICAgcmV0dXJuIF9NX2YoX011PF9Cb3VuZF9hcmdzPigpCisgICAgICAgICAgICAgICAgICAgICAgKHRyMTo6Z2V0PF9JbmRleGVzPihfTV9ib3VuZF9hcmdzKSwgX19hcmdzKS4uLik7CisgICAgICAgIH0KKworICAgICAgLy8gQ2FsbCBhcyBjb25zdAorICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3MsIGludC4uLiBfSW5kZXhlcz4KKyAgICAgICAgdHlwZW5hbWUgcmVzdWx0X29mPAorICAgICAgICAgICAgICAgICAgIGNvbnN0IF9GdW5jdG9yKHR5cGVuYW1lIHJlc3VsdF9vZjxfTXU8X0JvdW5kX2FyZ3M+IAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbnN0IF9Cb3VuZF9hcmdzLCB0dXBsZTxfQXJncy4uLj4pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPjo6dHlwZS4uLik+Ojp0eXBlCisgICAgICAgIF9fY2FsbChjb25zdCB0dXBsZTxfQXJncy4uLj4mIF9fYXJncywgX0luZGV4X3R1cGxlPF9JbmRleGVzLi4uPikgY29uc3QKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiBfTV9mKF9NdTxfQm91bmRfYXJncz4oKQorICAgICAgICAgICAgICAgICAgICAgICh0cjE6OmdldDxfSW5kZXhlcz4oX01fYm91bmRfYXJncyksIF9fYXJncykuLi4pOworICAgICAgICB9CisKKyAgICAgIC8vIENhbGwgYXMgdm9sYXRpbGUKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzLCBpbnQuLi4gX0luZGV4ZXM+CisgICAgICAgIHR5cGVuYW1lIHJlc3VsdF9vZjwKKyAgICAgICAgICAgICAgICAgICB2b2xhdGlsZSBfRnVuY3Rvcih0eXBlbmFtZSByZXN1bHRfb2Y8X011PF9Cb3VuZF9hcmdzPiAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2xhdGlsZSBfQm91bmRfYXJncywgdHVwbGU8X0FyZ3MuLi4+KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID46OnR5cGUuLi4pPjo6dHlwZQorICAgICAgICBfX2NhbGwoY29uc3QgdHVwbGU8X0FyZ3MuLi4+JiBfX2FyZ3MsIAorICAgICAgICAgICAgICAgX0luZGV4X3R1cGxlPF9JbmRleGVzLi4uPikgdm9sYXRpbGUKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiBfTV9mKF9NdTxfQm91bmRfYXJncz4oKQorICAgICAgICAgICAgICAgICAgICAgICh0cjE6OmdldDxfSW5kZXhlcz4oX01fYm91bmRfYXJncyksIF9fYXJncykuLi4pOworICAgICAgICB9CisKKyAgICAgIC8vIENhbGwgYXMgY29uc3Qgdm9sYXRpbGUKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzLCBpbnQuLi4gX0luZGV4ZXM+CisgICAgICAgIHR5cGVuYW1lIHJlc3VsdF9vZjwKKyAgICAgICAgICAgICAgICAgICBjb25zdCB2b2xhdGlsZSBfRnVuY3Rvcih0eXBlbmFtZSByZXN1bHRfb2Y8X011PF9Cb3VuZF9hcmdzPiAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb25zdCB2b2xhdGlsZSBfQm91bmRfYXJncywgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHVwbGU8X0FyZ3MuLi4+KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID46OnR5cGUuLi4pPjo6dHlwZQorICAgICAgICBfX2NhbGwoY29uc3QgdHVwbGU8X0FyZ3MuLi4+JiBfX2FyZ3MsIAorICAgICAgICAgICAgICAgX0luZGV4X3R1cGxlPF9JbmRleGVzLi4uPikgY29uc3Qgdm9sYXRpbGUKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiBfTV9mKF9NdTxfQm91bmRfYXJncz4oKQorICAgICAgICAgICAgICAgICAgICAgICh0cjE6OmdldDxfSW5kZXhlcz4oX01fYm91bmRfYXJncyksIF9fYXJncykuLi4pOworICAgICAgICB9CisKKyAgICAgcHVibGljOgorICAgICAgZXhwbGljaXQgX0JpbmQoX0Z1bmN0b3IgX19mLCBfQm91bmRfYXJncy4uLiBfX2JvdW5kX2FyZ3MpCisgICAgICAgIDogX01fZihfX2YpLCBfTV9ib3VuZF9hcmdzKF9fYm91bmRfYXJncy4uLikgeyB9CisKKyAgICAgIC8vIENhbGwgdW5xdWFsaWZpZWQKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICB0eXBlbmFtZSByZXN1bHRfb2Y8CisgICAgICAgICAgICAgICAgICAgX0Z1bmN0b3IodHlwZW5hbWUgcmVzdWx0X29mPF9NdTxfQm91bmRfYXJncz4gCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKF9Cb3VuZF9hcmdzLCB0dXBsZTxfQXJncy4uLj4pPjo6dHlwZS4uLikKKyAgICAgICAgICAgICAgICAgPjo6dHlwZQorICAgICAgICBvcGVyYXRvcigpKF9BcmdzJi4uLiBfX2FyZ3MpCisgICAgICAgIHsKKyAgICAgICAgICByZXR1cm4gdGhpcy0+X19jYWxsKHRyMTo6dGllKF9fYXJncy4uLiksIF9Cb3VuZF9pbmRleGVzKCkpOworICAgICAgICB9CisKKyAgICAgIC8vIENhbGwgYXMgY29uc3QKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIF9BcmdzPgorICAgICAgICB0eXBlbmFtZSByZXN1bHRfb2Y8CisgICAgICAgICAgICAgICAgICAgY29uc3QgX0Z1bmN0b3IodHlwZW5hbWUgcmVzdWx0X29mPF9NdTxfQm91bmRfYXJncz4gCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbnN0IF9Cb3VuZF9hcmdzLCB0dXBsZTxfQXJncy4uLj4pPjo6dHlwZS4uLikKKyAgICAgICAgICAgICAgICAgPjo6dHlwZQorICAgICAgICBvcGVyYXRvcigpKF9BcmdzJi4uLiBfX2FyZ3MpIGNvbnN0CisgICAgICAgIHsKKyAgICAgICAgICByZXR1cm4gdGhpcy0+X19jYWxsKHRyMTo6dGllKF9fYXJncy4uLiksIF9Cb3VuZF9pbmRleGVzKCkpOworICAgICAgICB9CisKKworICAgICAgLy8gQ2FsbCBhcyB2b2xhdGlsZQorICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3M+CisgICAgICAgIHR5cGVuYW1lIHJlc3VsdF9vZjwKKyAgICAgICAgICAgICAgICAgICB2b2xhdGlsZSBfRnVuY3Rvcih0eXBlbmFtZSByZXN1bHRfb2Y8X011PF9Cb3VuZF9hcmdzPiAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9sYXRpbGUgX0JvdW5kX2FyZ3MsIHR1cGxlPF9BcmdzLi4uPik+Ojp0eXBlLi4uKQorICAgICAgICAgICAgICAgICA+Ojp0eXBlCisgICAgICAgIG9wZXJhdG9yKCkoX0FyZ3MmLi4uIF9fYXJncykgdm9sYXRpbGUKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiB0aGlzLT5fX2NhbGwodHIxOjp0aWUoX19hcmdzLi4uKSwgX0JvdW5kX2luZGV4ZXMoKSk7CisgICAgICAgIH0KKworCisgICAgICAvLyBDYWxsIGFzIGNvbnN0IHZvbGF0aWxlCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKyAgICAgICAgdHlwZW5hbWUgcmVzdWx0X29mPAorICAgICAgICAgICAgICAgICAgIGNvbnN0IHZvbGF0aWxlIF9GdW5jdG9yKHR5cGVu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YoX011PF9Cb3VuZF9hcmdzPigpCisgICAgICAgICAgICAgICAgICAgICAgKHRyMTo6Z2V0PF9JbmRleGVzPihfTV9ib3VuZF9hcmdzKSwgX19hcmdzKS4uLik7CisgICAgICAgIH0KKworICAgICAgLy8gQ2FsbCBhcyBjb25zdCB2b2xhdGlsZQorICAgICAgdGVtcGxhdGU8dHlwZW5hbWUuLi4gX0FyZ3MsIGludC4uLiBfSW5kZXhlcz4KKyAgICAgICAgX1Jlc3VsdAorICAgICAgICBfX2NhbGwoY29uc3QgdHVwbGU8X0FyZ3MuLi4+JiBfX2FyZ3MsIAorICAgICAgICAgICAgICAgX0luZGV4X3R1cGxlPF9JbmRleGVzLi4uPikgY29uc3Qgdm9sYXRpbGUKKyAgICAgICAgeworICAgICAgICAgIHJldHVybiBfTV9mKF9NdTxfQm91bmRfYXJncz4oKQorICAgICAgICAgICAgICAgICAgICAgICh0cjE6OmdldDxfSW5kZXhlcz4oX01fYm91bmRfYXJncyksIF9fYXJncykuLi4pOworICAgICAgICB9CisKKyAgICBwdWJsaWM6CisgICAgICB0eXBlZGVmIF9SZXN1bHQgcmVzdWx0X3R5cGU7CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBfQmluZF9yZXN1bHQoX0Z1bmN0b3IgX19mLCBfQm91bmRfYXJncy4uLiBfX2JvdW5kX2FyZ3MpCisgICAgICA6IF9NX2YoX19mKSwgX01fYm91bmRfYXJncyhfX2JvdW5kX2FyZ3MuLi4pIHsgfQorCisgICAgICAvLyBDYWxsIHVucXVhbGlmaWVkCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBfQXJncz4KKyAgICAgICAgcmVzdWx0X3R5cGUKKyAgICAgICAgb3BlcmF0b3IoKShfQXJncyYuLi4gX19hcmdzKQorICAgICAgICB7CisgICAgICAgICAgcmV0dXJuIHRoaXMtPl9fY2FsbCh0cjE6OnRpZShfX2FyZ3MuLi4pLCBfQm91bmRfaW5kZXhlcygpKTsKKyAgICAgICAgfQor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wgaXNfbWVtYmVyX3BvaW50ZXI8X1RwPjo6dmFsdWUpPgorICAgIHsKKyAgICB9OworCisgIGNsYXNzIF9VbmRlZmluZWRfY2xhc3M7CisKKyAgdW5pb24gX05vY29weV90eXBlcworICB7CisgICAgdm9pZCogICAgICAgX01fb2JqZWN0OworICAgIGNvbnN0IHZvaWQqIF9NX2NvbnN0X29iamVjdDsKKyAgICB2b2lkICgqX01fZnVuY3Rpb25fcG9pbnRlcikoKTsKKyAgICB2b2lkIChfVW5kZWZpbmVkX2NsYXNzOjoqX01fbWVtYmVyX3BvaW50ZXIpKCk7CisgIH07CisKKyAgdW5pb24gX0FueV9kYXRhCisgIHsKKyAgICB2b2lkKiAgICAgICBfTV9hY2Nlc3MoKSAgICAgICB7IHJldHVybiAmX01fcG9kX2RhdGFbMF07IH0KKyAgICBjb25zdCB2b2lkKiBfTV9hY2Nlc3MoKSBjb25zdCB7IHJldHVybiAmX01fcG9kX2RhdGFbMF07IH0KKworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICAgIF9UcCYKKyAgICAgIF9NX2FjY2VzcygpCisgICAgICB7IHJldHVybiAqc3RhdGljX2Nhc3Q8X1RwKj4oX01fYWNjZXNzKCkpOyB9CisKKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgICBjb25zdCBfVHAmCisgICAgICBfTV9hY2Nlc3MoKSBjb25zdAorICAgICAgeyByZXR1cm4gKnN0YXRpY19jYXN0PGNvbnN0IF9UcCo+KF9NX2FjY2VzcygpKTsgfQorCisgICAgX05vY29weV90eXBlcyBfTV91bnVzZWQ7CisgICAgY2hhciBfTV9wb2RfZGF0YVtzaXplb2YoX05vY29weV90eXBlcyldOworICB9OworCisgIGVudW0gX01hbmFnZXJfb3BlcmF0aW9uCisgIHsKKyAgICBfX2dldF90eXBlX2luZm8sCisgICAgX19nZXRfZnVuY3Rvcl9wdHIsCisgICAgX19jbG9uZV9mdW5jdG9yLAorICAgIF9fZGVz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9OworCisgICAgICAvLy8gVGhpcyB0eXBlZGVmIGlzIHVzZWQgdG8gaW1wbGVtZW50IHRoZSBzYWZlX2Jvb2wgaWRpb20uCisgICAgICB0eXBlZGVmIF9IaWRkZW5fdHlwZSogX0hpZGRlbl90eXBlOjoqIF9TYWZlX2Jvb2w7CisjZW5kaWYKKworICAgICAgdHlwZWRlZiBfUmVzIF9TaWduYXR1cmVfdHlwZShfQXJnVHlwZXMuLi4pOworICAgICAgCisgICAgICBzdHJ1Y3QgX1VzZWxlc3MgeyB9OworICAgICAgCisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfUmVzIHJlc3VsdF90eXBlOworICAgICAgCisgICAgICAvLyBbMy43LjIuMV0gY29uc3RydWN0L2NvcHkvZGVzdHJveQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRGVmYXVsdCBjb25zdHJ1Y3QgY3JlYXRlcyBhbiBlbXB0eSBmdW5jdGlvbiBjYWxsIHdyYXBwZXIuCisgICAgICAgKiAgQHBvc3QgQGMgIShib29sKSp0aGlzCisgICAgICAgKi8KKyAgICAgIGZ1bmN0aW9uKCkgOiBfRnVuY3Rpb25fYmFzZSgpIHsgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgRGVmYXVsdCBjb25zdHJ1Y3QgY3JlYXRlcyBhbiBlbXB0eSBmdW5jdGlvbiBjYWxsIHdyYXBwZXIuCisgICAgICAgKiAgQHBvc3QgQGMgIShib29sKSp0aGlzCisgICAgICAgKi8KKyAgICAgIGZ1bmN0aW9uKF9NX2NsZWFyX3R5cGUqKSA6IF9GdW5jdGlvbl9iYXNlKCkgeyB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAlRnVuY3Rpb24gY29weSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqICBAcGFyYW0geCBBICVmdW5jdGlvbiBvYmplY3Qgd2l0aCBpZGVudGljYWwgY2FsbCBzaWduYXR1cmUuCisgICAgICA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vbiB3aWxsIG5vdCB0aHJvdyBhbiAlZXhjZXB0aW9uLgorICAgICAgICovCisgICAgICBmdW5jdGlvbiYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBmdW5jdGlvbiYgX194KQorICAgICAgeworICAgICAgICBmdW5jdGlvbihfX3gpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAlRnVuY3Rpb24gYXNzaWdubWVudCB0byB6ZXJvLgorICAgICAgICogIEBwb3N0IEBjICEoYm9vbCkqdGhpcworICAgICAgICogIEByZXR1cm5zIEBjICp0aGlzCisgICAgICAgKgorICAgICAgICogIFRoZSB0YXJnZXQgb2YgQGMgKnRoaXMgaXMgZGVhbGxvY2F0ZWQsIGxlYXZpbmcgaXQgZW1wdHkuCisgICAgICAgKi8KKyAgICAgIGZ1bmN0aW9uJgorICAgICAgb3BlcmF0b3I9KF9NX2NsZWFyX3R5cGUqKQorICAgICAgeworICAgICAgICBpZiAoX01fbWFuYWdlcikKKwkgIHsKKwkgICAgX01fbWFuYWdlcihfTV9mdW5jdG9yLCBfTV9mdW5jdG9yLCBfX2Rlc3Ryb3lfZnVuY3Rvcik7CisJICAgIF9NX21hbmFnZXIgPSAwOworCSAgICBfTV9pbnZva2VyID0gMDsKKwkgIH0KKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgJUZ1bmN0aW9uIGFzc2lnbm1lbnQgdG8gYSBuZXcgdGFyZ2V0LgorICAgICAgICogIEBwYXJhbSBmIEEgJWZ1bmN0aW9uIG9iamVjdCB0aGF0IGlzIGNhbGxhYmxlIHdpdGggcGFyYW1ldGVycyBvZgorICAgICAgICogIHR5cGUgQGMgVDEsIEBjIFQyLCAuLi4sIEBjIFROIGFuZCByZXR1cm5zIGEgdmFsdWUgY29udmVydGlibGUKKyAgICAgICAqICB0byBAYyBSZXMuCis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JuICFfTV9lbXB0eSgpOyB9CisjZWxzZQorICAgICAgb3BlcmF0b3IgX1NhZmVfYm9vbCgpIGNvbnN0CisgICAgICB7CisgICAgICAgIGlmIChfTV9lbXB0eSgpKQorCSAgcmV0dXJuIDA7CisJZWxzZQorCSAgcmV0dXJuICZfSGlkZGVuX3R5cGU6Ol9NX2Jvb2w7CisgICAgICB9CisjZW5kaWYKKworICAgICAgLy8gWzMuNy4yLjRdIGZ1bmN0aW9uIGludm9jYXRpb24KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIEludm9rZXMgdGhlIGZ1bmN0aW9uIHRhcmdldGVkIGJ5IEBjICp0aGlzLgorICAgICAgICogIEByZXR1cm5zIHRoZSByZXN1bHQgb2YgdGhlIHRhcmdldC4KKyAgICAgICAqICBAdGhyb3dzIGJhZF9mdW5jdGlvbl9jYWxsIHdoZW4gQGMgIShib29sKSp0aGlzCisgICAgICAgKgorICAgICAgICogIFRoZSBmdW5jdGlvbiBjYWxsIG9wZXJhdG9yIGludm9rZXMgdGhlIHRhcmdldCBmdW5jdGlvbiBvYmplY3QKKyAgICAgICAqICBzdG9yZWQgYnkgQGMgdGhpcy4KKyAgICAgICAqLworICAgICAgX1JlcyBvcGVyYXRvcigpKF9BcmdUeXBlcy4uLiBfX2FyZ3MpIGNvbnN0OworCisjaWZkZWYgX19HWFhfUlRUSQorICAgICAgLy8gWzMuNy4yLjVdIGZ1bmN0aW9uIHRhcmdldCBhY2Nlc3MKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBEZXRlcm1pbmUgdGhlIHR5cGUgb2YgdGhlIHRhcmdldCBvZiB0aGlzIGZ1bmN0aW9uIG9iamVjdAorICAgICAgICogIHdyYXBwZXIuCisgICAgICAgKgorICAgICAgICogIEByZXR1cm5zIHRoZSB0eXBlIGlkZW50aWZpZXIgb2YgdGhlIHRhcmdldCBmdW5jdGlvbiBvYmplY3QsIG9yCisgICAgICAgKiAgQGMgdHlwZWlkKHZvaWQpIGlmI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KKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBUaGlzIHJldHVybnMgQmVybm91bGxpIG51bWJlcnMgZnJvbSBhIHRhYmxlIG9yIGJ5IHN1bW1hdGlvbgorICAgICAqICAgICAgICAgIGZvciBsYXJnZXIgdmFsdWVzLgorICAgICAqCisgICAgICogICBSZWN1cnNpb24gaXMgdW5zdGFibGUuCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSBfX24gdGhlIG9yZGVyIG4gb2YgdGhlIEJlcm5vdWxsaSBudW1iZXIuCisgICAgICogICBAcmV0dXJuICBUaGUgQmVybm91bGxpIG51bWJlciBvZiBvcmRlciBuLgorICAgICAqLworICAgIHRlbXBsYXRlIDx0eXBlbmFtZSBfVHA+CisgICAgX1RwIF9fYmVybm91bGxpX3Nlcmllcyh1bnNpZ25lZCBpbnQgX19uKQorICAgIHsKKworICAgICAgc3RhdGljIGNvbnN0IF9UcCBfX251bVsyOF0gPSB7CisgICAgICAgIF9UcCgxVUwpLCAgICAgICAgICAgICAgICAgICAgICAgIC1fVHAoMVVMKSAvIF9UcCgyVUwpLAorICAgICAgICBfVHAoMVVMKSAvIF9UcCg2VUwpLCAgICAgICAgICAgICBfVHAoMFVMKSwKKyAgICAgICAgLV9UcCgxVUwpIC8gX1RwKDMwVUwpLCAgICAgICAgICAgX1RwKDBVTCksCisgICAgICAgIF9UcCgxVUwpIC8gX1RwKDQyVUwpLCAgICAgICAgICAgIF9UcCgwVUwpLAorICAgICAgICAtX1RwKDFVTCkgLyBfVHAoMzBVTCksICAgICAgICAgICBfVHAoMFVMKSwKKyAgICAgICAgX1RwKDVVTCkgLyBfVHAoNjZVTCksICAgICAgICAgICAgX1RwKDBVTCksCisgICAgICAgIC1fVHAoNjkxVUwpIC8gX1RwKDI3MzBVTCksICAgICAgIF9UcCgwVUwpLAorICAgICAgICBfVHAoN1VMKSAvIF9UcCg2VUwpLCAgICAgICAgICAgICBfVHAoMFVMKSwKKyAgICAgICAgLV9UcCgzNjE3VUwpIC8gX1RwKDUxMFVMKSwgICAgICAgX1RwKDBVTCksCisgICAgICAgIF9UcCg0Mzg2N1VMKSAvIF9UcCg3OThVTCksICAgICAgIF9UcCgwVUwpLAorICAgICAgICAtX1RwKDE3NDYxMSkgLyBfVHAoMzMwVUwpLCAgICAgICBfVHAoMFVMKSwKKyAgICAgICAgX1RwKDg1NDUxM1VMKSAvIF9UcCgxMzhVTCksICAgICAgX1RwKDBVTCksCisgICAgICAgIC1fVHAoMjM2MzY0MDkxVUwpIC8gX1RwKDI3MzBVTCksIF9UcCgwVUwpLAorICAgICAgICBfVHAoODU1MzEwM1VMKSAvIF9UcCg2VUwpLCAgICAgICBfVHAoMFVMKQorICAgICAgfTsKKworICAgICAgaWYgKF9fbiA9PSAwKQorICAgICAgICByZXR1cm4gX1RwKDEpOworCisgICAgICBpZiAoX19uID09IDEpCisgICAgICAgIHJldHVybiAtX1RwKDEpIC8gX1RwKDIpOworCisgICAgICAvLyAgVGFrZSBjYXJlIG9mIHRoZSByZXN0IG9mIHRoZSBvZGQgb25lcy4KKyAgICAgIGlmIChfX24gJSAyID09IDEpCisgICAgICAgIHJldHVybiBfVHAoMCk7CisKKyAgICAgIC8vICBUYWtlIGNhcmUgb2Ygc29tZSBzbWFsbCBldmVucyB0aGF0IGFyZSBwYWluZnVsIGZvciB0aGUgc2VyaWVzLgorICAgICAgaWYgKF9fbiA8IDI4KQorICAgICAgICByZXR1cm4gX19udW1bX19uXTsKKworCisgICAgICBfVHAgX19mYWN0ID0gX1RwKDEpOworICAgICAgaWYgKChfX24gLyAyKSAlIDIgPT0gMCkKKyAgICAgICAgX19mYWN0ICo9IF9UcCgtMSk7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2sgPSAxOyBfX2sgPD0gX19uOyArK19faykKKyAgICAgICAgX19mYWN0ICo9IF9fayAvIChfVHAoMikgKiBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKSk7CisgICAgICBfX2ZhY3QgKj0gX1RwKDIpOworCisgICAgICBfVHAgX19zdW0gPSBfVHAoMCk7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2kgPSAxOyBfX2kgPCAxMDAwOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3Rlcm0gPSBzdGQ6OnBvdyhfVHAoX19pKSwgLV9UcChfX24pKTsKKyAgICAgICAgICBpZiAoX190ZXJtIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIF9fZmFjdCAqIF9fc3VtOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgVGhpcyByZXR1cm5zIEJlcm5vdWxsaSBudW1iZXIgXGYkQl9uXGYkLgorICAgICAqCisgICAgICogICBAcGFyYW0gX19uIHRoZSBvcmRlciBuIG9mIHRoZSBCZXJub3VsbGkgbnVtYmVyLgorICAgICAqICAgQHJldHVybiAgVGhlIEJlcm5vdWxsaSBudW1iZXIgb2Ygb3JkZXIgbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9UcAorICAgIF9fYmVybm91bGxpKGNvbnN0IGludCBfX24pCisgICAgeworICAgICAgcmV0dXJuIF9fYmVybm91bGxpX3NlcmllczxfVHA+KF9fbik7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gXGYkbG9nKFxHYW1tYSh4KSlcZiQgYnkgYXN5bXB0b3RpYyBleHBhbnNpb24KKyAgICAgKiAgICAgICAgICB3aXRoIEJlcm5vdWxsaSBudW1iZXIgY29lZmZpY2llbnRzLiAgVGhpcyBpcyBsaWtlCisgICAgICogICAgICAgICAgU3RlcmxpbmcncyBhcHByb3hpbWF0aW9uLgorICAgICAqCisgICAgICogICBAcGFyYW0gX194IFRoZSBhcmd1bWVudCBvZiB0aGUgbG9nIG9mIHRoZSBnYW1tYSBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBsb2dhcml0aG0gb2YgdGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2xvZ19nYW1tYV9iZXJub3VsbGkoY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBfVHAgX19sZyA9IChfX3ggLSBfVHAoMC41TCkpICogc3RkOjpsb2coX194KSAtIF9feAorICAgICAgICAgICAgICAgKyBfVHAoMC41TCkgKiBzdGQ6OmxvZyhfVHAoMikKKyAgICAgICAgICAgICAgICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCkpOworCisgICAgICBjb25zdCBfVHAgX194eCA9IF9feCAqIF9feDsKKyAgICAgIF9UcCBfX2hlbHAgPSBfVHAoMSkgLyBfX3g7CisgICAgICBmb3IgKCB1bnNpZ25lZCBpbnQgX19pID0gMTsgX19pIDwgMjA7ICsrX19pICkKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfXzJpID0gX1RwKDIgKiBfX2kpOworICAgICAgICAgIF9faGVscCAvPSBfXzJpICogKF9fMmkgLSBfVHAoMSkpICogX194eDsKKyAgICAgICAgICBfX2xnICs9IF9fYmVybm91bGxpPF9UcD4oMiAqIF9faSkgKiBfX2hlbHA7CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIF9fbGc7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gXGYkbG9nKFxHYW1tYSh4KSlcZiQgYnkgdGhlIExhbmN6b3MgbWV0aG9kLgorICAgICAqICAgICAgICAgIFRoaXMgbWV0aG9kIGRvbWluYXRlcyBhbGwgb3RoZXJzIG9uIHRoZSBwb3NpdGl2ZSBheGlzIEkgdGhpbmsuCisgICAgICoKKyAgICAgKiAgIEBwYXJhbS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NzZMKTsKKworICAgICAgX1RwIF9fc3VtID0gX19sYW5jem9zX2NoZWJfN1swXTsKKyAgICAgIGZvcih1bnNpZ25lZCBpbnQgX19rID0gMTsgX19rIDwgOTsgKytfX2spCisgICAgICAgIF9fc3VtICs9IF9fbGFuY3pvc19jaGViXzdbX19rXSAvIChfX3htMSArIF9fayk7CisKKyAgICAgIGNvbnN0IF9UcCBfX3Rlcm0xID0gKF9feG0xICsgX1RwKDAuNUwpKQorICAgICAgICAgICAgICAgICAgICAgICAgKiBzdGQ6OmxvZygoX194bTEgKyBfVHAoNy41TCkpCisgICAgICAgICAgICAgICAgICAgICAgIC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX2V1bGVyKCkpOworICAgICAgY29uc3QgX1RwIF9fdGVybTIgPSBfX0xPR1JPT1QyUEkgKyBzdGQ6OmxvZyhfX3N1bSk7CisgICAgICBjb25zdCBfVHAgX19yZXN1bHQgPSBfX3Rlcm0xICsgKF9fdGVybTIgLSBfVHAoNykpOworCisgICAgICByZXR1cm4gX19yZXN1bHQ7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gXGYkIGxvZyh8XEdhbW1hKHgpfCkgXGYkLgorICAgICAqICAgICAgICAgIFRoaXMgd2lsbCByZXR1cm4gdmFsdWVzIGV2ZW4gZm9yIFxmJCB4IDwgMCBcZiQuCisgICAgICogICAgICAgICAgVG8gcmVjb3ZlciB0aGUgc2lnbiBvZiBcZiQgXEdhbW1hKHgpIFxmJCBmb3IKKyAgICAgKiAgICAgICAgICBhbnkgYXJndW1lbnQgdXNlIEBhIF9fbG9nX2dhbW1hX3NpZ24uCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSBfX3ggVGhlIGFyZ3VtZW50IG9mIHRoZSBsb2cgb2YgdGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGxvZ2FyaXRobSBvZiB0aGUgZ2FtbWEgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fbG9nX2dhbW1hKGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9feCA+IF9UcCgwLjVMKSkKKyAgICAgICAgcmV0dXJuIF9fbG9nX2dhbW1hX2xhbmN6b3MoX194KTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX3Npbl9mYWN0CisgICAgICAgICAgICAgICAgID0gc3RkOjphYnMoc3RkOjpzaW4oX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCkgKiBfX3gpKTsKKyAgICAgICAgICBpZiAoX19zaW5fZmFjdCA9PSBfVHAoMCkpCisgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQXJndW1lbnQgaXMgbm9ucG9zaXRpdmUgaW50ZWdlciAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19sb2dfZ2FtbWEiKSk7CisgICAgICAgICAgcmV0dXJuIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19sbnBpKCkKKyAgICAgICAgICAgICAgICAgICAgIC0gc3RkOjpsb2coX19zaW5fZmFjdCkKKyAgICAgICAgICAgICAgICAgICAgIC0gX19sb2dfZ2FtbWFfbGFuY3pvcyhfVHAoMSkgLSBfX3gpOworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIHNpZ24gb2YgXGYkIFxHYW1tYSh4KSBcZiQuCisgICAgICogICAgICAgICAgQXQgbm9ucG9zaXRpdmUgaW50ZWdlcnMgemVybyBpcyByZXR1cm5lZC4KKyAgICAgKgorICAgICAqICAgQHBhcmFtIF9feCBUaGUgYXJndW1lbnQgb2YgdGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIHNpZ24gb2YgdGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2xvZ19nYW1tYV9zaWduKGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9feCA+IF9UcCgwKSkKKyAgICAgICAgcmV0dXJuIF9UcCgxKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX3Npbl9mYWN0CisgICAgICAgICAgICAgICAgICA9IHN0ZDo6c2luKF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpICogX194KTsKKyAgICAgICAgICBpZiAoX19zaW5fZmFjdCA+IF9UcCgwKSkKKyAgICAgICAgICAgIHJldHVybiAoMSk7CisgICAgICAgICAgZWxzZSBpZiAoX19zaW5fZmFjdCA8IF9UcCgwKSkKKyAgICAgICAgICAgIHJldHVybiAtX1RwKDEpOworICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHJldHVybiBfVHAoMCk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgbG9nYXJpdGhtIG9mIHRoZSBiaW5vbWlhbCBjb2VmZmljaWVudC4KKyAgICAgKiAgIFRoZSBiaW5vbWlhbCBjb2VmZmljaWVudCBpcyBnaXZlbiBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgXGxlZnQoICBccmlnaHQpID0gXGZyYWN7biF9eyhuLWspISBrIX0KKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gX19uIFRoZSBmaXJzdCBhcmd1bWVudCBvZiB0aGUgYmlub21pYWwgY29lZmZpY2llbnQuCisgICAgICogICBAcGFyYW0gX19rIFRoZSBzZWNvbmQgYXJndW1lbnQgb2YgdGhlIGJpbm9taWFsIGNvZWZmaWNpZW50LgorICAgICAqICAgQHJldHVybiAgVGhlIGJpbm9taWFsIGNvZWZmaWNpZW50LgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2xvZ19iaW5jb2VmKGNvbnN0IHVuc2lnbmVkIGludCBfX24sIGNvbnN0IHVuc2lnbmVkIGludCBfX2spCisgICAgeworICAgICAgLy8gIE1heCBlIGV4cG9uZW50IGJlZm9yZSBvdmVyZmxvdy4KKyAgICAgIHN0YXRpYyBjb25zdCBfVHAgX19tYXhfYmluY29lZmYKKyAgICAgICAgICAgICAgICAgICAgICA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6bWF4X2V4cG9uZW50MTAKKyAgICAgICAgICAgICAgICAgICAgICAqIHN0ZDo6bG9nKF9UcCgxMCkpIC0gX1RwKDEpOworI2lmIF9HTElCQ1hYX1VTRV9DOTlfTUFUSF9UUjEKKyAgICAgIF9UcCBfX2NvZWZmID0gIHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKDEgKyBfX24pKQorICAgICAgICAgICAgICAgICAgLSBzdGQ6OnRyMTo6bGdhbW1hKF9UcCgxICsgX19rKSkKKyAgICAgICAgICAgICAgICAgIC0gc3RkOjp0cjE6OmxnYW1tYShfVHAoMSArIF9fbiAtIF9faykpOworI2Vsc2UKKyAgICAgIF9UcCBfX2NvZWZmID0gIF9fbG9nX2dhbW1hKF9UcCgxICsgX19uKSkKKyAgICAgICAgICAgICAgICAgIC0gX19sb2dfZ2FtbWEoX1RwKDEgKyBfX2spKQorICAgICAgICAgICAgICAgICAgLSBfX2xvZ19nYW1tYShfVHAoMSArIF9fbiAtIF9faykpOworI2VuZGlmCisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBSZXR1cm4gdGhlIGJpbm9taWFsIGNvZWZmaWNpZW50LgorICAgICAqICAgVGhlIGJpbm9taWFsIGNvZWZmaWNpZW50IGlzIGdpdmVuIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICBcbGVmdCggIFxyaWdodCkgPSBcZnJhY3tuIX17KG4taykhIGshfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSBfX24gVGhlIGZpcnN0IGFyZ3VtZW50IG9mIHRoZSBiaW5vbWlhbCBjb2VmZmljaWVudC4KKyAgICAgKiAgIEBwYXJhbSBfX2sgVGhlIHNlY29uZCBhcmd1bWVudCBvZiB0aGUgYmlub21pYWwgY29lZmZpY2llbnQuCisgICAgICogICBAcmV0dXJuICBUaGUgYmlub21pYWwgY29lZmZpY2llbnQuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fYmluY29lZihjb25zdCB1bnNpZ25lZCBpbnQgX19uLCBjb25zdCB1bnNpZ25lZCBpbnQgX19rKQorICAgIHsKKyAgICAgIC8vICBNYXggZSBleHBvbmVudCBiZWZvcmUgb3ZlcmZsb3cuCisgICAgICBzdGF0aWMgY29uc3QgX1RwIF9fbWF4X2JpbmNvZWZmCisgICAgICAgICAgICAgICAgICAgICAgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46Om1heF9leHBvbmVudDEwCisgICAgICAgICAgICAgICAgICAgICAgKiBzdGQ6OmxvZyhfVHAoMTApKSAtIF9UcCgxKTsKKworICAgICAgY29uc3QgX1RwIF9fbG9nX2NvZWZmID0gX19sb2dfYmluY29lZjxfVHA+KF9fbiwgX19rKTsKKyAgICAgIGlmIChfX2xvZ19jb2VmZiA+IF9fbWF4X2JpbmNvZWZmKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIHN0ZDo6ZXhwKF9fbG9nX2NvZWZmKTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiBcZiQgXEdhbW1hKHgpIFxmJC4KKyAgICAgKgorICAgICAqICAgQHBhcmFtIF9feCBUaGUgYXJndW1lbnQgb2YgdGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIGdhbW1hIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX1RwCisgICAgX19nYW1tYShjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIHJldHVybiBzdGQ6OmV4cChfX2xvZ19nYW1tYShfX3gpKTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGRpZ2FtbWEgZnVuY3Rpb24gYnkgc2VyaWVzIGV4cGFuc2lvbi4KKyAgICAgKiAgIFRoZSBkaWdhbW1hIG9yIEBmJCBccHNpKHgpIEBmJCBmdW5jdGlvbiBpcyBkZWZpbmVkIGJ5CisgICAgICogICBAZlsKKyAgICAgKiAgICAgXHBzaSh4KSA9IFxmcmFje1xHYW1tYScoeCl9e1xHYW1tYSh4KX0KKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBUaGUgc2VyaWVzIGlzIGdpdmVuIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICAgIFxwc2koeCkgPSAtXGdhbW1hX0UgLSBcZnJhY3sxfXt4fQorICAgICAqICAgICAgICAgICAgICBcc3VtX3trPTF9XntcaW5mdHl9IFxmcmFje3h9e2soeCArIGspfQorICAgICAqICAgQGZdCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fcHNpX3Nlcmllcyhjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIF9UcCBfX3N1bSA9IC1fX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fZ2FtbWFfZSgpIC0gX1RwKDEpIC8gX194OworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDAwMDA7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2sgPSAxOyBfX2sgPCBfX21heF9pdGVyOyArK19faykKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX3Rlcm0gPSBfX3ggLyAoX19rICogKF9fayArIF9feCkpOworICAgICAgICAgIF9fc3VtICs9IF9fdGVybTsKKyAgICAgICAgICBpZiAoc3RkOjphYnMoX190ZXJtIC8gX19zdW0pIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgcmV0dXJuIF9fc3VtOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgZGlnYW1tYSBmdW5jdGlvbiBmb3IgbGFyZ2UgYXJndW1lbnQuCisgICAgICogICBUaGUgZGlnYW1tYSBvciBAZiQgXHBzaSh4KSBAZiQgZnVuY3Rpb24gaXMgZGVmaW5lZCBieQorICAgICAqICAgQGZbCisgICAgICogICAgIFxwc2koeCkgPSBcZnJhY3tcR2FtbWEnKHgpfXtcR2FtbWEoeCl9CisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgVGhlIGFzeW1wdG90aWMgc2VyaWVzIGlzIGdpdmVuIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICAgIFxwc2koeCkgPSBcbG4oeCkgLSBcZnJhY3sxfXsyeH0KKyAgICAgKiAgICAgICAgICAgICAtIFxzdW1fe249MX1ee1xpbmZ0eX0gXGZyYWN7Ql97Mm59fXsyIG4geF57Mm59fQorICAgICAqICAgQGZdCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fcHNpX2FzeW1wKGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgX1RwIF9fc3VtID0gc3RkOjpsb2coX194KSAtIF9UcCgwLjVMKSAvIF9feDsKKyAgICAgIGNvbnN0IF9UcCBfX3h4ID0gX194ICogX194OworICAgICAgX1RwIF9feHAgPSBfX3h4OworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDA7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2sgPSAxOyBfX2sgPCBfX21heF9pdGVyOyArK19faykKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX3Rlcm0gPSBfX2Jlcm5vdWxsaTxfVHA+KDIgKiBfX2spIC8gKDIgKiBfX2sgKiBfX3hwKTsKKyAgICAgICAgICBfX3N1bSAtPSBfX3Rlcm07CisgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fdGVybSAvIF9fc3VtKSA8IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgX194cCAqPSBfX3h4OworICAgICAgICB9CisgICAgICByZXR1cm4gX19zdW07CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBkaWdhbW1hIGZ1bmN0aW9uLgorICAgICAqICAgVGhlIGRpZ2FtbWEgb3IgQGYkIFxwc2koeCkgQGYkIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnkKKyAgICAgKiAgIEBmWworICAgICAqICAgICBccHNpKHgpID0gXGZyYWN7XEdhbW1hJyh4KX17XEdhbW1hKHgpfQorICAgICAqICAgQGZdCisgICAgICogICBGb3IgbmVnYXRpdmUgYXJndW1lbnQgdGhlIHJlZmxlY3Rpb24gZm9ybXVsYSBpcyB1c2VkOgorICAgICAqICAgQGZbCisgICAgICogICAgIFxwc2koeCkgPSBccHNpKDEteCkgLSBccGkgXGNvdChccGkgeCkKKyAgICAgKiAgIEBmXQorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3BzaShjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGNvbnN0IGludCBfX24gPSBzdGF0aWNfY2FzdDxpbnQ+KF9feCArIDAuNUwpOworICAgICAgY29uc3QgX1RwIF9fZXBzID0gX1RwKDQpICogc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBpZiAoX19uIDw9IDAgJiYgc3RkOjphYnMoX194IC0gX1RwKF9fbikpIDwgX19lcHMpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoX194IDwgX1RwKDApKQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fcGkgPSBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKTsKKyAgICAgICAgICByZXR1cm4gX19wc2koX1RwKDEpIC0gX194KQorICAgICAgICAgICAgICAgLSBfX3BpICogc3RkOjpjb3MoX19waSAqIF9feCkgLyBzdGQ6OnNpbihfX3BpICogX194KTsKKyAgICAgICAgfQorICAgICAgZWxzZSBpZiAoX194ID4gX1RwKDEwMCkpCisgICAgICAgIHJldHVybiBfX3BzaV9hc3ltcChfX3gpOworICAgICAgZWxzZQorICAgICAgICByZXR1cm4gX19wc2lfc2VyaWVzKF9feCk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBwb2x5Z2FtbWEgZnVuY3Rpb24gQGYkIFxwc2leeyhuKX0oeCkgQGYkLgorICAgICAqIAorICAgICAqICAgVGhlIHBvbHlnYW1tYSBmdW5jdGlvbiBpcyByZWxhdGVkIHRvIHRoZSBIdXJ3aXR6IHpldGEgZnVuY3Rpb246CisgICAgICogICBAZlsKKyAgICAgKiAgICAgXHBzaV57KG4pfSh4KSA9ICgtMSlee24rMX0gbSEgXHpldGEobSsxLHgpCisgICAgICogICBAZl0KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19wc2koY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBpZiAoX194IDw9IF9UcCgwKSkKKyAgICAgICAgc3RkOjpfX3Rocm93X2RvbWFpbl9lcnJvcihfX04oIkFyZ3VtZW50IG91dCBvZiByYW5nZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX3BzaSIpKTsKKyAgICAgIGVsc2UgaWYgKF9fbiA9PSAwKQorICAgICAgICByZXR1cm4gX19wc2koX194KTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX2h6ZXRhID0gX19odXJ3aXR6X3pldGEoX1RwKF9fbiArIDEpLCBfX3gpOworI2lmIF9HTElCQ1hYX1VTRV9DOTlfTUFUSF9UUjEKKyAgICAgICAgICBjb25zdCBfVHAgX19sbl9uZmFjdCA9IHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKF9fbiArIDEpKTsKKyNlbHNlCisgICAgICAgICAgY29uc3QgX1RwIF9fbG5fbmZhY3QgPSBfX2xvZ19nYW1tYShfVHAoX19uICsgMSkpOworI2VuZGlmCisgICAgICAgICAgX1RwIF9fcmVzdWx0ID0gc3RkOjpleHAoX19sbl9uZmFjdCkgKiBfX2h6ZXRhOworICAgICAgICAgIGlmIChfX24gJSAyID09IDEpCisgICAgICAgICAgICBfX3Jlc3VsdCA9IC1fX3Jlc3VsdDsKKyAgICAgICAgICByZXR1cm4gX19yZXN1bHQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgX0dMSUJDWFhfRU5EX05BTUVTUEFDRV9WRVJTSU9OCisgIH0gLy8gbmFtZXNwYWNlIHN0ZDo6dHIxOjpfX2RldGFpbAorfQorfQorCisjZW5kaWYgLy8gX0dMSUJDWFhfVFIxX0dBTU1BX1RDQworCmRpZmYgLS1naXQgYS84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL3RyMS9oYXNodGFibGUuaCBiLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvdH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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIF9WYWx1ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0tleSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0VxdWFsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlfZXF1YWw7CisgICAgICAvLyBtYXBwZWRfdHlwZSwgaWYgcHJlc2VudCwgY29tZXMgZnJvbSBfTWFwX2Jhc2UuCisgICAgICAvLyBoYXNoZXIsIGlmIHByZXNlbnQsIGNvbWVzIGZyb20gX0hhc2hfY29kZV9iYXNlLgorICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQWxsb2NhdG9yOjpkaWZmZXJlbmNlX3R5cGUgICAgICAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jYXRvcjo6c2l6ZV90eXBlICAgICAgICAgICAgICBzaXplX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OnBvaW50ZXIgICAgICAgICAgICAgICAgcG9pbnRlcjsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jYXRvcjo6Y29uc3RfcG9pbnRlciAgICAgICAgICBjb25zdF9wb2ludGVyOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQWxsb2NhdG9yOjpyZWZlcmVuY2UgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jYXRvcjo6Y29uc3RfcmVmZXJlbmNlICAgICAgICBjb25zdF9yZWZlcmVuY2U7CisKKyAgICAgIHR5cGVkZWYgX19kZXRhaWw6Ol9Ob2RlX2l0ZXJhd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YmluZDxfTm9kZT46Om90aGVyCisJCQkJCQkJX05vZGVfYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OnRlbXBsYXRlIHJlYmluZDxfTm9kZSo+OjpvdGhlcgorCQkJCQkJCV9CdWNrZXRfYWxsb2NhdG9yX3R5cGU7CisKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX0FsbG9jYXRvcjo6dGVtcGxhdGUgcmViaW5kPF9WYWx1ZT46Om90aGVyCisJCQkJCQkJX1ZhbHVlX2FsbG9jYXRvcl90eXBlOworCisgICAgICBfTm9kZV9hbGxvY2F0b3JfdHlwZSAgIF9NX25vZGVfYWxsb2NhdG9yOworICAgICAgX05vZGUqKiAgICAgICAgICAgICAgICBfTV9idWNrZXRzOworICAgICAgc2l6ZV90eXBlICAgICAgICAgICAgICBfTV9idWNrZXRfY291bnQ7CisgICAgICBzaXplX3R5cGUgICAgICAgICAgICAgIF9NX2VsZW1lbnRfY291bnQ7CisgICAgICBfUmVoYXNoUG9saWN5ICAgICAgICAgIF9NX3JlaGFzaF9wb2xpY3k7CisKKyAgICAgIF9Ob2RlKgorICAgICAgX01fYWxsb2NhdGVfbm9kZShjb25zdCB2YWx1ZV90eXBlJiBfX3YpOworCisgICAgICB2b2lkCisgICAgICBfTV9kZWFsbG9jYXRlX25vZGUoX05vZGUqIF9fbik7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RlYWxsb2NhdGVfbm9kZXMoX05vZGUqKiwgc2l6ZV90eXBlKTsKKworICAgICAgX05vZGUqKgorICAgICAgX01fYWxsb2NhdGVfYnVja2V0cyhzaXplX3R5cGUgX19uKTsKKworICAgICAgdm9pZAorICAgICAgX01fZGVhbGxvY2F0ZV9idWNrZXRzKF9Ob2RlKiosIHNpemVfdHlwZSBfX24pOworCisgICAgcHVibGljOgorICAgICAgLy8gQ29uc3RydWN0b3IsIGRlc3RydWN0b3IsIGFzc2lnbm1lbnQsI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lmICghX19pLl9NX2N1cl9ub2RlKQorCSAgX19pLl9NX2luY3JfYnVja2V0KCk7CisJcmV0dXJuIF9faTsKKyAgICAgIH0KKworICAgICAgaXRlcmF0b3IKKyAgICAgIGVuZCgpCisgICAgICB7IHJldHVybiBpdGVyYXRvcihfTV9idWNrZXRzICsgX01fYnVja2V0X2NvdW50KTsgfQorCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGNvbnN0X2l0ZXJhdG9yKF9NX2J1Y2tldHMgKyBfTV9idWNrZXRfY291bnQpOyB9CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9lbGVtZW50X2NvdW50OyB9CisKKyAgICAgIGJvb2wKKyAgICAgIGVtcHR5KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHNpemUoKSA9PSAwOyB9CisKKyAgICAgIGFsbG9jYXRvcl90eXBlCisgICAgICBnZXRfYWxsb2NhdG9yKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIGFsbG9jYXRvcl90eXBlKF9NX25vZGVfYWxsb2NhdG9yKTsgfQorCisgICAgICBfVmFsdWVfYWxsb2NhdG9yX3R5cGUKKyAgICAgIF9NX2dldF9WYWx1ZV9hbGxvY2F0b3IoKSBjb25zdAorICAgICAgeyByZXR1cm4gX1ZhbHVlX2FsbG9jYXRvcl90eXBlKF9NX25vZGVfYWxsb2NhdG9yKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9zaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX25vZGVfYWxsb2NhdG9yLm1heF9zaXplKCk7IH0KKworICAgICAgLy8gT2JzZXJ2ZXJzCisgICAgICBrZXlfZXF1YWwKKyAgICAgIGtleV9lcSgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9lcTsgfQorCisgICAgICAvLyBoYXNoX2Z1bmN0aW9uLCBpZiBwcmVzZW50LCBjb21lcyBmcm9tIF9IYXNoX2NvZGVfYmFzZS4KKworICAgICAgLy8gQnVja2V0IG9wZXJhdGlvbnMKKyAgICAgIHNpemVfdHlwZQorICAgICAgYnVja2V0X2NvdW50KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2J1Y2tldF9jb3VudDsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIG1heF9idWNrZXRfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gbWF4X3NpemUoKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldF9zaXplKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6OmRpc3RhbmNlKGJlZ2luKF9fbiksIGVuZChfX24pKTsgfQorCisgICAgICBzaXplX3R5cGUKKyAgICAgIGJ1Y2tldChjb25zdCBrZXlfdHlwZSYgX19rKSBjb25zdAorICAgICAgeworCXJldHVybiB0aGlzLT5fTV9idWNrZXRfaW5kZXgoX19rLCB0aGlzLT5fTV9oYXNoX2NvZGUoX19rKSwKKwkJCQkgICAgIGJ1Y2tldF9jb3VudCgpKTsKKyAgICAgIH0KKworICAgICAgbG9jYWxfaXRlcmF0b3IKKyAgICAgIGJlZ2luKHNpemVfdHlwZSBfX24pCisgICAgICB7IHJldHVybiBsb2NhbF9pdGVyYXRvcihfTV9idWNrZXRzW19fbl0pOyB9CisKKyAgICAgIGxvY2FsX2l0ZXJhdG9yCisgICAgICBlbmQoc2l6ZV90eXBlKQorICAgICAgeyByZXR1cm4gbG9jYWxfaXRlcmF0b3IoMCk7IH0KKworICAgICAgY29uc3RfbG9jYWxfaXRlcmF0b3IKKyAgICAgIGJlZ2luKHNpemVfdHlwZSBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBjb25zdF9sb2NhbF9pdGVyYXRvcihfTV9idWNrZXRzW19fbl0pOyB9CisKKyAgICAgIGNvbnN0X2xvY2FsX2l0ZXJhdG9yCisgICAgICBlbmQoc2l6ZV90eXBlKSBjb25zdAorICAgICAgeyByZXR1cm4gY29uc3RfbG9jYWxfaXRlcmF0b3IoMCk7IH0KKworICAgICAgZmxvYXQKKyAgICAgIGxvYWRfZmFjdG9yKCkgY29uc3QKKyAgICAgIHsKKwlyZXR1cm4gc3RhdGljX2Nhc3Q8ZmxvYXQ+KHNpemUoKSkgLyBzdGF0aWNfY2FzdDxmbG9hdD4oYnVja2V0X2NvdW50KCkpOworICAgICAgfQorCisgICAgICAvLyBtYXhfbG9hZF9mYWN0b3IsIGlmIHByZXNlbnQsIGNvbWVzIGZyb20gX1JlaGFzaF9iYXNlLgorCisgICAgICAvLyBHZW5lcmFsaXphdGlvbiBvZiBtYXhfbG9hZF9mYWN0b3IuICBFeHRlbnNpb24sIG5vdCBmb3VuZCBpbiBUUjEuICBPbmx5CisgICAgICAvLyB1c2VmdWwgaWYgX1JlaGFzaFBvbGljeSBpcyBzb21ldGhpbmcgb3RoZXIgdGhhbiB0aGUgZGVmYXVsdC4KKyAgICAgIGNvbnN0IF9SZWhhc2hQb2xpY3kmCisgICAgICBfX3JlaGFzaF9wb2xpY3koKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcmVoYXNoX3BvbGljeTsgfQorCisgICAgICB2b2lkCisgICAgICBfX3JlaGFzaF9wb2xpY3koY29uc3QgX1JlaGFzaFBvbGljeSYpOworCisgICAgICAvLyBMb29rdXAuCisgICAgICBpdGVyYXRvcgorICAgICAgZmluZChjb25zdCBrZXlfdHlwZSYgX19rKTsKKworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGZpbmQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIHNpemVfdHlwZQorICAgICAgY291bnQoY29uc3Qga2V5X3R5cGUmIF9faykgY29uc3Q7CisKKyAgICAgIHN0ZDo6cGFpcjxpdGVyYXRvciwgaXRlcmF0b3I+CisgICAgICBlcXVhbF9yYW5nZShjb25zdCBrZXlfd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IoX19odC5fTV9ub2RlX2FsbG9jYXRvciksCisgICAgICBfTV9idWNrZXRfY291bnQoX19odC5fTV9idWNrZXRfY291bnQpLAorICAgICAgX01fZWxlbWVudF9jb3VudChfX2h0Ll9NX2VsZW1lbnRfY291bnQpLAorICAgICAgX01fcmVoYXNoX3BvbGljeShfX2h0Ll9NX3JlaGFzaF9wb2xpY3kpCisgICAgeworICAgICAgX01fYnVja2V0cyA9IF9NX2FsbG9jYXRlX2J1Y2tldHMoX01fYnVja2V0X2NvdW50KTsKKyAgICAgIF9fdHJ5CisJeworCSAgZm9yIChzaXplX3R5cGUgX19pID0gMDsgX19pIDwgX19odC5fTV9idWNrZXRfY291bnQ7ICsrX19pKQorCSAgICB7CisJICAgICAgX05vZGUqIF9fbiA9IF9faHQuX01fYnVja2V0c1tfX2ldOworCSAgICAgIF9Ob2RlKiogX190YWlsID0gX01fYnVja2V0cyArIF9faTsKKwkgICAgICB3aGlsZSAoX19uKQorCQl7CisJCSAgKl9fdGFpbCA9IF9NX2FsbG9jYXRlX25vZGUoX19uLT5fTV92KTsKKwkJICB0aGlzLT5fTV9jb3B5X2NvZGUoKl9fdGFpbCwgX19uKTsKKwkJICBfX3RhaWwgPSAmKCgqX190YWlsKS0+X01fbmV4dCk7CisJCSAgX19uID0gX19uLT5fTV9uZXh0OworCQl9CisJICAgIH0KKwl9CisgICAgICBfX2NhdGNoKC4uLikKKwl7CisJICBjbGVhcigpOworCSAgX01fZGVhbGxvY2F0ZV9idWNrZXRzKF9NX2J1Y2tldHMsIF9NX2J1Y2tldF9jb3VudCk7CisJICBfX3Rocm93X2V4Y2VwdGlvbl9hZ2FpbjsKKwl9CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9LZXksIHR5cGVuYW1lIF9WYWx1ZSwKKwkgICB0eXBlbmFtZSBfQWxsb2NhdG9yLCB0eXBlbmFtZSBfRXh0cmFjdEtleSwgdHlwZW5hbWUgX0VxdWFsLAorCSAgIHR5cGVuYW1lIF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PgorICAgIF9IYXNodGFibGU8X0tleSwgX1ZhbHVlLCBfQWxsb2NhdG9yLCBfRXh0cmFjdEtleSwgX0VxdWFsLAorCSAgICAgICBfSDEsIF9IMiwgX0hhc2gsIF9SZWhhc2hQb2xpY3ksIF9fY2hjLCBfX2NpdCwgX191az46OgorICAgIGVxdWFsX3JhbmdlKGNvbnN0IGtleV90eXBlJiBfX2spCisgICAgeworICAgICAgdHlwZW5hbWUgX0hhc2h0YWJsZTo6X0hhc2hfY29kZV90eXBlIF9fY29kZSA9IHRoaXMtPl9NX2hhc2hfY29kZShfX2spOworICAgICAgc3RkOjpzaXplX3QgX19uID0gdGhpcy0+X01fYnVja2V0X2luZGV4KF9faywgX19jb2RlLCBfTV9idWNrZXRfY291bnQpOworICAgICAgX05vZGUqKiBfX2hlYWQgPSBfTV9idWNrZXRzICsgX19uOworICAgICAgX05vZGUqIF9fcCA9IF9NX2ZpbmRfbm9kZSgqX19oZWFkLCBfX2ssIF9fY29kZSk7CisKKyAgICAgIGlmIChfX3ApCisJeworCSAgX05vZGUqIF9fcDEgPSBfX3AtPl9NX25leHQ7CisJICBmb3IgKDsgX19wMTsgX19wMSA9IF9fcDEtPl9NX25leHQpCisJICAgIGlmICghdGhpcy0+X01fY29tcGFyZShfX2ssIF9fY29kZSwgX19wMSkpCisJICAgICAgYnJlYWs7CisKKwkgIGl0ZXJhdG9yIF9fZmlyc3QoX19wLCBfX2hlYWQpOworCSAgaXRlcmF0b3IgX19sYXN0KF9fcDEsIF9faGVhZCk7CisJICBpZiAoIV9fcDEpCisJICAgIF9fbGFzdC5fTV9pbmNyX2J1Y2tldCgpOworCSAgcmV0dXJuIHN0ZDo6bWFrZV9wYWlyKF9fZmlyc3QsIF9fbGFzdCk7CisJfQorICAgICAgZWxzZQorCXJldHVybiBzdGQ6Om1ha2VfcGFpcih0aGlzLT5lbmQoKSwgdGhpcy0+ZW5kKCkpOworICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfS2V5L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b2RlID0gdGhpcy0+X01faGFzaF9jb2RlKF9fayk7CisgICAgICBzaXplX3R5cGUgX19uID0gdGhpcy0+X01fYnVja2V0X2luZGV4KF9faywgX19jb2RlLCBfTV9idWNrZXRfY291bnQpOworCisgICAgICAvLyBGaXJzdCBmaW5kIHRoZSBub2RlLCBhdm9pZCBsZWFraW5nIG5ld19ub2RlIGlmIGNvbXBhcmUgdGhyb3dzLgorICAgICAgX05vZGUqIF9fcHJldiA9IF9NX2ZpbmRfbm9kZShfTV9idWNrZXRzW19fbl0sIF9faywgX19jb2RlKTsKKyAgICAgIF9Ob2RlKiBfX25ld19ub2RlID0gX01fYWxsb2NhdGVfbm9kZShfX3YpOworCisgICAgICBpZiAoX19wcmV2KQorCXsKKwkgIF9fbmV3X25vZGUtPl9NX25leHQgPSBfX3ByZXYtPl9NX25leHQ7CisJICBfX3ByZXYtPl9NX25leHQgPSBfX25ld19ub2RlOworCX0KKyAgICAgIGVsc2UKKwl7CisJICBfX25ld19ub2RlLT5fTV9uZXh0ID0gX01fYnVja2V0c1tfX25dOworCSAgX01fYnVja2V0c1tfX25dID0gX19uZXdfbm9kZTsKKwl9CisgICAgICB0aGlzLT5fTV9zdG9yZV9jb2RlKF9fbmV3X25vZGUsIF9fY29kZSk7CisKKyAgICAgICsrX01fZWxlbWVudF9jb3VudDsKKyAgICAgIHJldHVybiBpdGVyYXRvcihfX25ld19ub2RlLCBfTV9idWNrZXRzICsgX19uKTsKKyAgICB9CisKKyAgLy8gRm9yIGVyYXNlKGl0ZXJhdG9yKSBhbmQgZXJhc2UoY29uc3RfaXRlcmF0b3IpLgorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfS2V5LCB0eXBlbmFtZSBfVmFsdWUsCisJICAgdHlwZW5hbWUgX0FsbG9jYXRvciwgdHlwZW5hbWUgX0V4dHJhY3RLZXksIHR5cGVuYW1lIF9FcXVhbCwKKwkgICB0eXBlbmFtZSBfSDEsIHR5cGVuYW1lIF9IMiwgdHlwZW5hbWU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JCQkJICAgIGNvbnN0IF9WYWx1ZSYsIF9WYWx1ZSY+OjpfX3R5cGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVuY2U7CisgICAgICB0eXBlZGVmIHN0ZDo6cHRyZGlmZl90ICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgdHlwZWRlZiBzdGQ6OmZvcndhcmRfaXRlcmF0b3JfdGFnICAgICAgICAgICAgICAgIGl0ZXJhdG9yX2NhdGVnb3J5OworCisgICAgICBfTm9kZV9pdGVyYXRvcigpCisgICAgICA6IF9Ob2RlX2l0ZXJhdG9yX2Jhc2U8X1ZhbHVlLCBfX2NhY2hlPigwKSB7IH0KKworICAgICAgZXhwbGljaXQKKyAgICAgIF9Ob2RlX2l0ZXJhdG9yKF9IYXNoX25vZGU8X1ZhbHVlLCBfX2NhY2hlPiogX19wKQorICAgICAgOiBfTm9kZV9pdGVyYXRvcl9iYXNlPF9WYWx1ZSwgX19jYWNoZT4oX19wKSB7IH0KKworICAgICAgcmVmZXJlbmNlCisgICAgICBvcGVyYXRvciooKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fY3VyLT5fTV92OyB9CisgIAorICAgICAgcG9pbnRlcgorICAgICAgb3BlcmF0b3ItPigpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Ol9fYWRkcmVzc29mKHRoaXMtPl9NX2N1ci0+X01fdik7IH0KKworICAgICAgX05vZGVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsgCisJdGhpcy0+X01faW5jcigpOworCXJldHVybiAqdGhpczsgCisgICAgICB9CisgIAorICAgICAgX05vZGVfaXRlcmF0b3IKKyAgICAgIG9wZXJhdG9yKysoaW50KQorICAgICAgeyAKKwlfTm9kZV9pdGVyYXRvciBfX3RtcCgqdGhpcyk7CisJdGhpcy0+X01faW5jcigpOworCXJldHVyb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gICAgIHsgcmV0dXJuIHN0ZDo6X19hZGRyZXNzb2YodGhpcy0+X01fY3VyX25vZGUtPl9NX3YpOyB9CisKKyAgICAgIF9IYXNodGFibGVfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCkKKyAgICAgIHsgCisJdGhpcy0+X01faW5jcigpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgCisgICAgICBfSGFzaHRhYmxlX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCkKKyAgICAgIHsgCisJX0hhc2h0YWJsZV9pdGVyYXRvciBfX3RtcCgqdGhpcyk7CisJdGhpcy0+X01faW5jcigpOworCXJldHVybiBfX3RtcDsKKyAgICAgIH0KKyAgICB9OworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9WYWx1ZSwgYm9vbCBfX2NvbnN0YW50X2l0ZXJhdG9ycywgYm9vbCBfX2NhY2hlPgorICAgIHN0cnVjdCBfSGFzaHRhYmxlX2NvbnN0X2l0ZXJhdG9yCisgICAgOiBwdWJsaWMgX0hhc2h0YWJsZV9pdGVyYXRvcl9iYXNlPF9WYWx1ZSwgX19jYWNoZT4KKyAgICB7CisgICAgICB0eXBlZGVmIF9WYWx1ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgIHR5cGVkZWYgY29uc3QgX1ZhbHVlKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyOworICAgICAgdHlwZWRlZiBjb25zdCBfVmFsdWUmICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgc3RkOjpwdHJkaWZmX3QgICAgICAgICAgICAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIHN0ZDo6Zm9yd2FyZF9pdGVyYXRvcl90YWcgICAgICAgICAgICAgICAgaXRlcmF0b3JfY2F0ZWdvcnk7CisKKyAgICAgIF9IYX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RXh0cmFjdEtleSYgX19leCwgY29uc3QgX0VxdWFsJiBfX2VxLAorCQkgICAgICBjb25zdCBfSDEmLCBjb25zdCBfSDImLCBjb25zdCBfSGFzaCYgX19oKQorICAgICAgOiBfTV9leHRyYWN0KF9fZXgpLCBfTV9lcShfX2VxKSwgX01fcmFuZ2VkX2hhc2goX19oKSB7IH0KKworICAgICAgdHlwZWRlZiB2b2lkKiBfSGFzaF9jb2RlX3R5cGU7CisgIAorICAgICAgX0hhc2hfY29kZV90eXBlCisgICAgICBfTV9oYXNoX2NvZGUoY29uc3QgX0tleSYgX19rZXkpIGNvbnN0CisgICAgICB7IHJldHVybiAwOyB9CisgIAorICAgICAgc3RkOjpzaXplX3QKKyAgICAgIF9NX2J1Y2tldF9pbmRleChjb25zdCBfS2V5JiBfX2ssIF9IYXNoX2NvZGVfdHlwZSwKKwkJICAgICAgc3RkOjpzaXplX3QgX19uKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcmFuZ2VkX2hhc2goX19rLCBfX24pOyB9CisKKyAgICAgIHN0ZDo6c2l6ZV90CisgICAgICBfTV9idWNrZXRfaW5kZXgoY29uc3QgX0hhc2hfbm9kZTxfVmFsdWUsIGZhbHNlPiogX19wLAorCQkgICAgICBzdGQ6OnNpemVfdCBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9yYW5nZWRfaGFzaChfTV9leHRyYWN0KF9fcC0+X01fdiksIF9fbik7IH0KKyAgCisgICAgICBib29sCisgICAgICBfTV9jb21wYXJlKGNvbnN0IF9LZXkmIF9faywgX0hhc2hfY29kZV90eXBlLAorCQkgX0hhc2hfbm9kZTxfVmFsdWUsIGZhbHNlPiogX19uKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZXEoX19rLCBfTV9leHRyYWN0KF9fbi0+X01fdikpOyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3N0b3JlX2NvZGUoX0hhc2hfbm9kZTxfVmFsdWUsIGZhbHNlPiosIF9IYXNoX2NvZ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F9faDEsIGNvbnN0IF9IMiYgX19oMiwKKwkJICAgICAgY29uc3QgX0RlZmF1bHRfcmFuZ2VkX2hhc2gmKQorICAgICAgOiBfTV9leHRyYWN0KF9fZXgpLCBfTV9lcShfX2VxKSwgX01faDEoX19oMSksIF9NX2gyKF9faDIpIHsgfQorCisgICAgICB0eXBlZGVmIHN0ZDo6c2l6ZV90IF9IYXNoX2NvZGVfdHlwZTsKKworICAgICAgX0hhc2hfY29kZV90eXBlCisgICAgICBfTV9oYXNoX2NvZGUoY29uc3QgX0tleSYgX19rKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faDEoX19rKTsgfQorICAgICAgCisgICAgICBzdGQ6OnNpemVfdAorICAgICAgX01fYnVja2V0X2luZGV4KGNvbnN0IF9LZXkmLCBfSGFzaF9jb2RlX3R5cGUgX19jLAorCQkgICAgICBzdGQ6OnNpemVfdCBfX24pIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9oMihfX2MsIF9fbik7IH0KKworICAgICAgc3RkOjpzaXplX3QKKyAgICAgIF9NX2J1Y2tldF9pbmRleChjb25zdCBfSGFzaF9ub2RlPF9WYWx1ZSwgZmFsc2U+KiBfX3AsCisJCSAgICAgIHN0ZDo6c2l6ZV90IF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2gyKF9NX2gxKF9NX2V4dHJhY3QoX19wLT5fTV92KSksIF9fbik7IH0KKworICAgICAgYm9vbAorICAgICAgX01fY29tcGFyZShjb25zdCBfS2V5JiBfX2ssIF9IYXNoX2NvZGVfdHlwZSwKKwkJIF9IYXNoX25vZGU8X1ZhbHVlLCBmYWxzZT4qIF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2VxKF9faywgX01fZXh0cmFjdChfX24tPl9NX3YpKTsgfQorCisgICAgICB2b2lkCisgICAgICBfTV9zdG9yZV9jb2RlKF9IYXNoX25vZGU8X1ZhbHVlLCBmYWxzZT4qLCBfSGFzaF9jb2RlX3R5cGUpIGNvbnN0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XF1YWwsIF9IMSwgX0gyLAorCQkJICAgX0RlZmF1bHRfcmFuZ2VkX2hhc2gsIHRydWU+CisgICAgeworICAgICAgdHlwZWRlZiBfSDEgaGFzaGVyOworICAgICAgCisgICAgICBoYXNoZXIKKyAgICAgIGhhc2hfZnVuY3Rpb24oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faDE7IH0KKworICAgIHByb3RlY3RlZDoKKyAgICAgIF9IYXNoX2NvZGVfYmFzZShjb25zdCBfRXh0cmFjdEtleSYgX19leCwgY29uc3QgX0VxdWFsJiBfX2VxLAorCQkgICAgICBjb25zdCBfSDEmIF9faDEsIGNvbnN0IF9IMiYgX19oMiwKKwkJICAgICAgY29uc3QgX0RlZmF1bHRfcmFuZ2VkX2hhc2gmKQorICAgICAgOiBfTV9leHRyYWN0KF9fZXgpLCBfTV9lcShfX2VxKSwgX01faDEoX19oMSksIF9NX2gyKF9faDIpIHsgfQorCisgICAgICB0eXBlZGVmIHN0ZDo6c2l6ZV90IF9IYXNoX2NvZGVfdHlwZTsKKyAgCisgICAgICBfSGFzaF9jb2RlX3R5cGUKKyAgICAgIF9NX2hhc2hfY29kZShjb25zdCBfS2V5JiBfX2spIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9oMShfX2spOyB9CisgIAorICAgICAgc3RkOjpzaXplX3QKKyAgICAgIF9NX2J1Y2tldF9pbmRleChjb25zdCBfS2V5JiwgX0hhc2hfY29kZV90eXBlIF9fYywKKwkJICAgICAgc3RkOjpzaXplX3QgX19uKSBjb25zdAorICAgICAgeyByZXR1cm4gX01faDIoX19jLCBfX24pOyB9CisKKyAgICAgIHN0ZDo6c2l6ZV90CisgICAgICBfTV9idWNrZXRfaW5kZXgoY29uc3QgX0hhc2hfbm9kZTxfVmFsdWUsIHRydWU+KiBfX3AsCisJCSAgICAgIHN0ZDo6c2l6ZV90IF9fbikgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2gyKF9fcC0+X01faGFzaF9jb2RlLCBfX24pOy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AgX194KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX2VwcyA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworCisgICAgICBfVHAgX190ZXJtID0gX1RwKDEpOworICAgICAgX1RwIF9fRmFjID0gX1RwKDEpOworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4X2l0ZXIgPSAxMDAwMDA7CisgICAgICB1bnNpZ25lZCBpbnQgX19pOworICAgICAgZm9yIChfX2kgPSAwOyBfX2kgPCBfX21heF9pdGVyOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIF9fdGVybSAqPSAoX19hICsgX1RwKF9faSkpICogX194CisgICAgICAgICAgICAgICAgICAvICgoX19jICsgX1RwKF9faSkpICogX1RwKDEgKyBfX2kpKTsKKyAgICAgICAgICBpZiAoc3RkOjphYnMoX190ZXJtKSA8IF9fZXBzKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBfX0ZhYyArPSBfX3Rlcm07CisgICAgICAgIH0KKyAgICAgIGlmIChfX2kgPT0gX19tYXhfaXRlcikKKyAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJTZXJpZXMgZmFpbGVkIHRvIGNvbnZlcmdlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2NvbmZfaHlwZXJnX3Nlcmllcy4iKSk7CisKKyAgICAgIHJldHVybiBfX0ZhYzsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICBAYnJpZWYgIFJldHVybiB0aGUgaHlwb2dlb21ldHJpYyBmdW5jdGlvbiBAZiQgXzJGXzEoYSxiO2M7eCkgQGYkCisgICAgICogICAgICAgICAgYnkgYW4gaXRlcmF0aXZlIHByb2NlZHVyZSBkZXNjcmliZWQgaW4KKyAgICAgKiAgICAgICAgICBMdWtlLCBBbGdvcml0aG1zIGZvciB0aGUg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VHAgX19Cbm0zID0gX1RwKDEpOworICAgICAgX1RwIF9fQm5tMiA9IF9UcCgxKSArIF9fdDEgKiBfX3g7CisgICAgICBfVHAgX19Cbm0xID0gX1RwKDEpICsgX190MiAqIF9feCAqIChfVHAoMSkgKyBfX3QxIC8gX1RwKDMpICogX194KTsKKworICAgICAgX1RwIF9fQW5tMyA9IF9UcCgxKTsKKyAgICAgIF9UcCBfX0FubTIgPSBfX0JubTIgLSBfX3QwICogX194OworICAgICAgX1RwIF9fQW5tMSA9IF9fQm5tMSAtIF9fdDAgKiAoX1RwKDEpICsgX190MiAqIF9feCkgKiBfX3gKKyAgICAgICAgICAgICAgICAgKyBfX3QwICogX190MSAqIChfX2MgLyAoX19jICsgX1RwKDEpKSkgKiBfX3ggKiBfX3g7CisKKyAgICAgIGludCBfX24gPSAzOworICAgICAgd2hpbGUoMSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX25wYW0xID0gX1RwKF9fbiAtIDEpICsgX19hOworICAgICAgICAgIF9UcCBfX25wY20xID0gX1RwKF9fbiAtIDEpICsgX19jOworICAgICAgICAgIF9UcCBfX25wYW0yID0gX1RwKF9fbiAtIDIpICsgX19hOworICAgICAgICAgIF9UcCBfX25wY20yID0gX1RwKF9fbiAtIDIpICsgX19jOworICAgICAgICAgIF9UcCBfX3RubTEgID0gX1RwKDIgKiBfX24gLSAxKTsKKyAgICAgICAgICBfVHAgX190bm0zICA9IF9UcCgyICogX19uIC0gMyk7CisgICAgICAgICAgX1RwIF9fdG5tNSAgPSBfVHAoMiAqIF9fbiAtIDUpOworICAgICAgICAgIF9UcCBfX0YxID0gIChfVHAoX19uIC0gMikgLSBfX2EpIC8gKF9UcCgyKSAqIF9fdG5tMyAqIF9fbnBjbTEpOworICAgICAgICAgIF9UcCBfX0YyID0gIChfVHAoX19uKSArIF9fYSkgKiBfX25wYW0xCisgICAgICAgICAgICAgICAgICAgLyAoX1RwKDQpICogX190bm0xICogX190bm0zICogX19ucGNtMiAqIF9fbnBjbTEpOworICAgICAgICAgIF9UcCBfX0YzID0gLV9fbnBhbTIgKiBfX25wYW0xICogKF9UcChfX24gLSAyKSAtIF9fYSkKKyAgICAgICAgICAgICAgICAgICAvIChfVHAoOCkgKiBfX3RubTMgKiBfX3RubTMgKiBfX3RubTUKKyAgICAgICAgICAgICAgICAgICAqIChfVHAoX19uIC0gMykgKyBfX2MpICogX19ucGNtMiAqIF9fbnBjbTEpOworICAgICAgICAgIF9UcCBfX0UgID0gLV9fbnBhbTEgKiAoX1RwKF9fbiAtIDEpIC0gX19jKQorICAgICAgICAgICAgICAgICAgIC8gKF9UcCgyKSAqIF9fdG5tMyAqIF9fbnBjbTIgKiBfX25wY20xKTsKKworICAgICAgICAgIF9UcCBfX0FuID0gKF9UcCgxKSArIF9fRjEgKiBfX3gpICogX19Bbm0xCisgICAgICAgICAgICAgICAgICAgKyAoX19FICsgX19GMiAqIF9feCkgKiBfX3ggKiBfX0FubTIgKyBfX0YzICogX194MyAqIF9fQW5tMzsKKyAgICAgICAgICBfVHAgX19CbiA9IChfVHAoMSkgKyBfX0YxICogX194KSAqIF9fQm5tMQorICAgICAgICAgICAgICAgICAgICsgKF9fRSArIF9fRjIgKiBfX3gpICogX194ICogX19Cbm0yICsgX19GMyAqIF9feDMgKiBfX0JubTM7CisgICAgICAgICAgX1RwIF9fciA9IF9fQW4gLyBfX0JuOworCisgICAgICAgICAgX19wcmVjID0gc3RkOjphYnMoKF9fRiAtIF9fcikgLyBfX0YpOworICAgICAgICAgIF9fRiA9IF9fcjsKKworICAgICAgICAgIGlmIChfX3ByZWMgPCBfX2VwcyB8fCBfX24gPiBfX25tYXgpCisgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX0FuKSA+IF9fYmlnIHx8IHN0ZDo6YWJzKF9fQm4pID4gX19iaWcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fQW4gICAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19CbiAgIC89IF9fYmlnOworICAgICAgICAgICAgICBfX0FubTEgLz0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm5tMSAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Bbm0yIC89IF9fYmlnOworICAgICAgICAgICAgICBfX0JubTIgLz0gX19iaWc7CisgICAgICAgICAgICAgIF9fQW5tMyAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Cbm0zIC89IF9fYmlnOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgaWYgKHN0ZDo6YWJzKF9fQW4pIDwgX1RwKDEpIC8gX19iaWcKKyAgICAgICAgICAgICAgICB8fCBzdGQ6OmFicyhfX0JuKSA8IF9UcCgxKSAvIF9fYmlnKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX0FuICAgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm4gICAqPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Bbm0xICo9IF9fYmlnOworICAgICAgICAgICAgICBfX0JubTEgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQW5tMiAqPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Cbm0yICo9IF9fYmlnOworICAgICAgICAgICAgICBfX0FubTMgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm5tMyAqPSBfX2JpZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICsrX19uOworICAgICAgICAgIF9fQm5tMyA9IF9fQm5tMjsKKyAgICAgICAgICBfX0JubTIgPSBfX0JubTE7CisgICAgICAgICAgX19Cbm0xID0gX19CbjsKKyAgICAgICAgICBfX0FubTMgPSBfX0FubTI7CisgICAgICAgICAgX19Bbm0yID0gX19Bbm0xOworICAgICAgICAgIF9fQW5tMSA9IF9fQW47CisgICAgICAgIH0KKworICAgICAgaWYgKF9fbiA+PSBfX25tYXgpCisgICAgICAgIHN0ZDo6X190aHJvd19ydW50aW1lX2Vycm9yKF9fTigiSXRlcmF0aW9uIGZhaWxlZCB0byBjb252ZXJnZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19jb25mX2h5cGVyZ19sdWtlLiIpKTsKKworICAgICAgcmV0dXJuIF9fRjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIGNvbmZsdWVudCBoeXBvZ2VvbWV0cmljIGZ1bmN0aW9uCisgICAgICogICAgICAgICAgIEBmJCBfMUZfMShhO2M7eCkgQGYkLgorICAgICAqIAorICAgICAqICAgQHRvZG8gIEhhbmRsZSBiID09IG5vbnBvc2l0aXZlIGludGVnZXIgYmxvd3VwIC0gcmV0dXJuIE5hTi4KKyAgICAgKgorICAgICAqICAgQHBhcmFtICBfX2EgIFRoZSBAYSBudW1lcmF0b3IgcGFyYW1ldGVyLgorICAgICAqICAgQHBhcmFtICBfX2MgIFRoZSBAYSBkZW5vbWluYXRvciBwYXJhbWV0ZXIuCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBjb25mbHVlbnQgaHlwZXJnZW9tZXRyaWMgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuICBUaGUgY29uZmx1ZW50IGh5cGVyZ2VvbWV0cmljIGZ1bmN0aW9uLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBpbmxpbmUgX1RwCisgICAgX19jb25mX2h5cGVyZyhjb25zdCBfVHAgX19hLCBjb25zdCBfVHAgX19jLCBjb25zdCBfVHAgX194KQorICAgIHsKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICBjb25zdCBfVHAgX19jX25pbnQgPSBzdGQ6OnRyMTo6bmVhcmJ5aW50KF9fYyk7CisjZWxzZQorICAgICAgY29uc3QgX1RwIF9fY19uaW50ID0gc3RhdGljX2Nhc3Q8aW50PihfX2MgKyBfVHAoMC41TCkpOworI2VuZGlmCisgICAgICBpZiAoX19pc25hbihfX2EpIHx8IF9faXNuYW4oX19jKSB8fCBfX2lzbmFuKF9feCkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoX19jX25pbnQgPT0gX19jICYmIF9fY19uaW50IDw9IDApCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmluZmluaXR5KCk7CisgICAgICBlbHNlIGlmIChfX2EgPT0gX1RwKDApKQorICAgICAgICByZXR1cm4gX1RwKDEpOworICAgICAgZWxzZSBpZiAoX19jID09IF9fYSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6ZXhwKF9feCk7CisgICAgICBlbHNlIGlmIChfX3ggPCBfVHAoMCkpCisgICAgICAgIHJldHVybiBfX2NvbmZfaHlwZXJnX2x1a2UoX19hLCBfX2MsIF9feCk7CisgICAgICBlbHNlCisgICAgICAgIHJldHVybiBfX2NvbmZfaHlwZXJnX3NlcmllcyhfX2EsIF9fYywgX194KTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFJldHVybiB0aGUgaHlwb2dlb21ldHJpYyBmdW5jdGlvbiBAZiQgXzJGXzEoYSxiO2M7eCkgQGYkCisgICAgICogICBieSBzZXJpZXMgZXhwYW5zaW9uLgorICAgICAqIAorICAgICAqICAgVGhlIGh5cG9nZW9tZXRyaWMgZnVuY3Rpb24gaXMgZGVmaW5lZCBieQorICAgICAqICAgQGZbCisgICAgICogICAgIF8yRl8xKGEsYjtjO3gpID0gXGZyYWN7XEdhbW1hKGMpfXtcR2FtbWEoYSlcR2FtbWEoYil9CisgICAgICogICAgICAgICAgICAgICAgICAgICAgXHN1bV97bj0wfV57XGluZnR5fQorICAgICAqICAgICAgICAgICAgICAgICAgICAgIFxmcmFje1xHYW1tYShhK24pXEdhbW1hKGIrbil9e1xHYW1tYShjK24pfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgIFxmcmFje3hebn17biF9CisgICAgICogICBAZl0KKyAgICAgKiAKKyAgICAgKiAgIFRoaXMgd29ya3MgYW5kIGl0J3MgcHJldHR5IGZhc3QuCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX19hICBUaGUgZmlyc3QgQGEgbnVtZXJhdG9yIHBhcmFtZXRlci4KKyAgICAgKiAgIEBwYXJhbSAgX19hICBUaGUgc2Vjb25kIEBhIG51bWVyYXRvciBwYXJhbWV0ZXIuCisgICAgICogICBAcGFyYW0gIF9fYyAgVGhlIEBhIGRlbm9taW5hdG9yIHBhcmFtZXRlci4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGNvbmZsdWVudCBoeXBlcmdlb21ldHJpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBjb25mbHVlbnQgaHlwZXJnZW9tZXRyaWMgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9faHlwZXJnX3Nlcmllcyhjb25zdCBfVHAgX19hLCBjb25zdCBfVHAgX19iLAorICAgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX19jLCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX2VwcyA9IHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworCisgICAgICBfVHAgX190ZXJtID0gX1RwKDEpOworICAgICAgX1RwIF9fRmFiYyA9IF9UcCgxKTsKKyAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBfX21heF9pdGVyID0gMTAwMDAwOworICAgICAgdW5zaWduZWQgaW50IF9faTsKKyAgICAgIGZvciAoX19pID0gMDsgX19pIDwgX19tYXhfaXRlcjsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBfX3Rlcm0gKj0gKF9fYSArIF9UcChfX2kpKSAqIChfX2IgKyBfVHAoX19pKSkgKiBfX3gKKyAgICAgICAgICAgICAgICAgIC8gKChfX2MgKyBfVHAoX19pKSkgKiBfVHAoMSArIF9faSkpOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0pIDwgX19lcHMpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgIF9fRmFiYyArPSBfX3Rlcm07CisgICAgICAgIH0KKyAgICAgIGlmIChfX2kgPT0gX19tYXhfaXRlcikKKyAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJTZXJpZXMgZmFpbGVkIHRvIGNvbnZlcmdlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2h5cGVyZ19zZXJpZXMuIikpOworCisgICAgICByZXR1cm4gX19GYWJjOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgaHlwb2dlb21ldHJpYyBmdW5jdGlvbiBAZiQgXzJGXzEoYSxiO2M7eCkgQGYkCisgICAgICogICAgICAgICAgIGJ5IGFuIGl0ZXJhdGl2ZSBwcm9jZWR1cmUgZGVzY3JpYmVkIGluCisgICAgICogICAgICAgICAgIEx1a2UsIEFsZ29yaXRobXMgZm9yIHRoZSBDb21wdXRhdGlvbiBvZiBNYXRoZW1hdGljYWwgRnVuY3Rpb25zLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2h5cGVyZ19sdWtlKGNvbnN0IF9UcCBfX2EsIGNvbnN0IF9UcCBfX2IsIGNvbnN0IF9UcCBfX2MsCisgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX194aW4pCisgICAgeworICAgICAgY29uc3QgX1RwIF9fYmlnID0gc3RkOjpwb3coc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptYXgoKSwgX1RwKDAuMTZMKSk7CisgICAgICBjb25zdCBpbnQgX19ubWF4ID0gMjAwMDA7CisgICAgICBjb25zdCBfVHAgX19lcHMgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKTsKKyAgICAgIGNvbnN0IF9UcCBfX3ggID0gLV9feGluOworICAgICAgY29uc3QgX1RwIF9feDMgPSBfX3ggKiBfX3ggKiBfX3g7CisgICAgICBjb25zdCBfVHAgX190MCA9IF9fYSAqIF9fYiAvIF9fYzsKKyAgICAgIGNvbnN0IF9UcCBfX3QxID0gKF9fYSArIF9UcCgxKSkgKiAoX19iICsgX1RwKDEpKSAvIChfVHAoMikgKiBfX2MpOworICAgICAgY29uc3QgX1RwIF9fdDIgPSAoX19hICsgX1RwKDIpKSAqIChfX2IgKyBfVHAoMikpCisgICAgICAgICAgICAgICAgICAgICAvIChfVHAoMikgKiAoX19jICsgX1RwKDEpKSk7CisKKyAgICAgIF9UcCBfX0YgPSBfVHAoMSk7CisKKyAgICAgIF9UcCBfX0JubTMgPSBfVHAoMSk7CisgICAgICBfVHAgX19Cbm0yID0gX1RwKDEpICsgX190MSAqIF9feDsKKyAgICAgIF9UcCBfX0JubTEgPSBfVHAoMSkgKyBfX3QyICogX194ICogKF9UcCgxKSArIF9fdDEgLyBfVHAoMykgKiBfX3gpOworCisgICAgICBfVHAgX19Bbm0zID0gX1RwKDEpOworICAgICAgX1RwIF9fQW5tMiA9IF9fQm5tMiAtIF9fdDAgKiBfX3g7CisgICAgICBfVHAgX19Bbm0xID0gX19Cbm0xIC0gX190MCAqIChfVHAoMSkgKyBfX3QyICogX194KSAqIF9feAorICAgICAgICAgICAgICAgICArIF9fdDAgKiBfX3QxICogKF9fYyAvIChfX2MgKyBfVHAoMSkpKSAqIF9feCAqIF9feDsKKworICAgICAgaW50IF9fbiA9IDM7CisgICAgICB3aGlsZSAoMSkKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX25wYW0xID0gX1RwKF9fbiAtIDEpICsgX19hOworICAgICAgICAgIGNvbnN0IF9UcCBfX25wYm0xID0gX1RwKF9fbiAtIDEpICsgX19iOworICAgICAgICAgIGNvbnN0IF9UcCBfX25wY20xID0gX1RwKF9fbiAtIDEpICsgX19jOworICAgICAgICAgIGNvbnN0IF9UcCBfX25wYW0yID0gX1RwKF9fbiAtIDIpICsgX19hOworICAgICAgICAgIGNvbnN0IF9UcCBfX25wYm0yID0gX1RwKF9fbiAtIDIpICsgX19iOworICAgICAgICAgIGNvbnN0IF9UcCBfX25wY20yID0gX1RwKF9fbiAtIDIpICsgX19jOworICAgICAgICAgIGNvbnN0IF9UcCBfX3RubTEgID0gX1RwKDIgKiBfX24gLSAxKTsKKyAgICAgICAgICBjb25zdCBfVHAgX190bm0zICA9IF9UcCgyICogX19uIC0gMyk7CisgICAgICAgICAgY29uc3QgX1RwIF9fdG5tNSAgPSBfVHAoMiAqIF9fbiAtIDUpOworICAgICAgICAgIGNvbnN0IF9UcCBfX24yID0gX19uICogX19uOworICAgICAgICAgIGNvbnN0IF9UcCBfX0YxID0gKF9UcCgzKSAqIF9fbjIgKyAoX19hICsgX19iIC0gX1RwKDYpKSAqIF9fbgorICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDIpIC0gX19hICogX19iIC0gX1RwKDIpICogKF9fYSArIF9fYikpCisgICAgICAgICAgICAgICAgICAgICAgICAgLyAoX1RwKDIpICogX190bm0zICogX19ucGNtMSk7CisgICAgICAgICAgY29uc3QgX1RwIF9fRjIgPSAtKF9UcCgzKSAqIF9fbjIgLSAoX19hICsgX19iICsgX1RwKDYpKSAqIF9fbgorICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDIpIC0gX19hICogX19iKSAqIF9fbnBhbTEgKiBfX25wYm0xCisgICAgICAgICAgICAgICAgICAgICAgICAgLyAoX1RwKDQpICogX190bm0xICogX190bm0zICogX19ucGNtMiAqIF9fbnBjbTEpOworICAgICAgICAgIGNvbnN0IF9UcCBfX0YzID0gKF9fbnBhbTIgKiBfX25wYW0xICogX19ucGJtMiAqIF9fbnBibTEKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIChfVHAoX19uIC0gMikgLSBfX2EpICogKF9UcChfX24gLSAyKSAtIF9fYikpCisgICAgICAgICAgICAgICAgICAgICAgICAgLyAoX1RwKDgpICogX190bm0zICogX190bm0zICogX190bm01CisgICAgICAgICAgICAgICAgICAgICAgICAgKiAoX1RwKF9fbiAtIDMpICsgX19jKSAqIF9fbnBjbTIgKiBfX25wY20xKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19FICA9IC1fX25wYW0xICogX19ucGJtMSAqIChfVHAoX19uIC0gMSkgLSBfX2MpCisgICAgICAgICAgICAgICAgICAgICAgICAgLyAoX1RwKDIpICogX190bm0zICogX19ucGNtMiAqIF9fbnBjbTEpOworCisgICAgICAgICAgX1RwIF9fQW4gPSAoX1RwKDEpICsgX19GMSAqIF9feCkgKiBfX0FubTEKKyAgICAgICAgICAgICAgICAgICArIChfX0UgKyBfX0YyICogX194KSAqIF9feCAqIF9fQW5tMiArIF9fRjMgKiBfX3gzICogX19Bbm0zOworICAgICAgICAgIF9UcCBfX0JuID0gKF9UcCgxKSArIF9fRjEgKiBfX3gpICogX19Cbm0xCisgICAgICAgICAgICAgICAgICAgKyAoX19FICsgX19GMiAqIF9feCkgKiBfX3ggKiBfX0JubTIgKyBfX0YzICogX194MyAqIF9fQm5tMzsKKyAgICAgICAgICBjb25zdCBfVHAgX19yID0gX19BbiAvIF9fQm47CisKKyAgICAgICAgICBjb25zdCBfVHAgX19wcmVjID0gc3RkOjphYnMoKF9fRiAtIF9fcikgLyBfX0YpOworICAgICAgICAgIF9fRiA9IF9fcjsKKworICAgICAgICAgIGlmIChfX3ByZWMgPCBfX2VwcyB8fCBfX24gPiBfX25tYXgpCisgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX0FuKSA+IF9fYmlnIHx8IHN0ZDo6YWJzKF9fQm4pID4gX19iaWcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fQW4gICAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19CbiAgIC89IF9fYmlnOworICAgICAgICAgICAgICBfX0FubTEgLz0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm5tMSAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Bbm0yIC89IF9fYmlnOworICAgICAgICAgICAgICBfX0JubTIgLz0gX19iaWc7CisgICAgICAgICAgICAgIF9fQW5tMyAvPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Cbm0zIC89IF9fYmlnOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgaWYgKHN0ZDo6YWJzKF9fQW4pIDwgX1RwKDEpIC8gX19iaWcKKyAgICAgICAgICAgICAgICB8fCBzdGQ6OmFicyhfX0JuKSA8IF9UcCgxKSAvIF9fYmlnKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX0FuICAgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm4gICAqPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Bbm0xICo9IF9fYmlnOworICAgICAgICAgICAgICBfX0JubTEgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQW5tMiAqPSBfX2JpZzsKKyAgICAgICAgICAgICAgX19Cbm0yICo9IF9fYmlnOworICAgICAgICAgICAgICBfX0FubTMgKj0gX19iaWc7CisgICAgICAgICAgICAgIF9fQm5tMyAqPSBfX2JpZzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICsrX19uOworICAgICAgICAgIF9fQm5tMyA9IF9fQm5tMjsKKyAgICAgICAgICBfX0JubTIgPSBfX0JubTE7CisgICAgICAgICAgX19Cbm0xID0gX19CbjsKKyAgICAgICAgICBfX0FubTMgPSBfX0FubTI7CisgICAgICAgICAgX19Bbm0yID0gX19Bbm0xOworICAgICAgICAgIF9fQW5tMSA9IF9fQW47CisgICAgICAgIH0KKworICAgICAgaWYgKF9fbiA+PSBfX25tYXgpCisgICAgICAgIHN0ZDo6X190aHJvd19ydW50aW1lX2Vycm9yKF9fTigiSXRlcmF0aW9uIGZhaWxlZCB0byBjb252ZXJnZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW4gX19oeXBlcmdfbHVrZS4iKSk7CisKKyAgICAgIHJldHVybiBfX0Y7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgQGJyaWVmICBSZXR1cm4gdGhlIGh5cG9nZW9tZXRyaWMgZnVuY3Rpb24gQGYkIF8yRl8xKGEsYjtjO3gpIEBmJCAKKyAgICAgKiAgYnkgdGhlIHJlZmxlY3Rpb24gZm9ybXVsYWUgaW4gQWJyYW1vd2l0eiAmIFN0ZWd1biBmb3JtdWxhCisgICAgICogIDE1LjMuNiBmb3IgZCA9IGMgLSBhIC0gYiBub3QgaW50ZWdyYWwgYW5kIGZvcm11bGEgMTUuMy4xMSBmb3IKKyAgICAgKiAgZCA9IGMgLSBhIC0gYiBpbnRlZ3JhbC4gIFRoaXMgYXNzdW1lcyBhLCBiLCBjICE9IG5lZ2F0aXZlCisgICAgICogIGludGVnZXIuCisgICAgICoKKyAgICAgKiAgIFRoZSBoeXBvZ2VvbWV0cmljIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnkKKyAgICAgKiAgIEBmWworICAgICAqICAgICBfMkZfMShhLGI7Yzt4KSA9IFxmcmFje1xHYW1tYShjKX17XEdhbW1hKGEpXEdhbW1hKGIpfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgIFxzdW1fe249MH1ee1xpbmZ0eX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICBcZnJhY3tcR2FtbWEoYStuKVxHYW1tYShiK24pfXtcR2FtbWEoYytuKX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICBcZnJhY3t4Xm59e24hfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIFRoZSByZWZsZWN0aW9uIGZvcm11bGEgZm9yIG5vbmludGVncmFsIEBmJCBkID0gYyAtIGEgLSBiIEBmJCBpczoKKyAgICAgKiAgIEBmWworICAgICAqICAgICBfMkZfMShhLGI7Yzt4KSA9IFxmcmFje1xHYW1tYShjKVxHYW1tYShkKX17XEdhbW1hKGMtYSlcR2FtbWEoYy1iKX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfMkZfMShhLGI7MS1kOzEteCkKKyAgICAgKiAgICAgICAgICAgICAgICAgICAgKyBcZnJhY3tcR2FtbWEoYylcR2FtbWEoLWQpfXtcR2FtbWEoYSlcR2FtbWEoYil9CisgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgXzJGXzEoYy1hLGMtYjsxK2Q7MS14KQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIFRoZSByZWZsZWN0aW9uIGZvcm11bGEgZm9yIGludGVncmFsIEBmJCBtID0gYyAtIGEgLSBiIEBmJCBpczoKKyAgICAgKiAgIEBmWworICAgICAqICAgICBfMkZfMShhLGI7YStiK207eCkgPSBcZnJhY3tcR2FtbWEobSlcR2FtbWEoYStiK20pfXtcR2FtbWEoYSttKVxHYW1tYShiK20pfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgXHN1bV97az0wfV57bS0xfSBcZnJhY3sobSthKV9rKG0rYilfa317ayEoMS1tKV9rfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgIC0gCisgICAgICogICBAZl0KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19oeXBlcmdfcmVmbGVjdChjb25zdCBfVHAgX19hLCBjb25zdCBfVHAgX19iLCBjb25zdCBfVHAgX19jLAorICAgICAgICAgICAgICAgICAgICAgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICBjb25zdCBfVHAgX19kID0gX19jIC0gX19hIC0gX19iOworICAgICAgY29uc3QgaW50IF9faW50ZCAgPSBzdGQ6OmZsb29yKF9fZCArIF9UcCgwLjVMKSk7CisgICAgICBjb25zdCBfVHAgX19lcHMgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKTsKKyAgICAgIGNvbnN0IF9UcCBfX3RvbGVyID0gX1RwKDEwMDApICogX19lcHM7CisgICAgICBjb25zdCBfVHAgX19sb2dfbWF4ID0gc3RkOjpsb2coc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptYXgoKSk7CisgICAgICBjb25zdCBib29sIF9fZF9pbnRlZ2VyID0gKHN0ZDo6YWJzKF9fZCAtIF9faW50ZCkgPCBfX3RvbGVyKTsKKworICAgICAgaWYgKF9fZF9pbnRlZ2VyKQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fbG5fb214ID0gc3RkOjpsb2coX1RwKDEpIC0gX194KTsKKyAgICAgICAgICBjb25zdCBfVHAgX19hZCA9IHN0ZDo6YWJzKF9fZCk7CisgICAgICAgICAgX1RwIF9fRjEsIF9fRjI7CisKKyAgICAgICAgICBfVHAgX19kMSwgX19kMjsKKyAgICAgICAgICBpZiAoX19kID49IF9UcCgwKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19kMSA9IF9fZDsKKyAgICAgICAgICAgICAgX19kMiA9IF9UcCgwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fZDEgPSBfVHAoMCk7CisgICAgICAgICAgICAgIF9fZDIgPSBfX2Q7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICBjb25zdCBfVHAgX19sbmdfYyA9IF9fbG9nX2dhbW1hKF9fYyk7CisKKyAgICAgICAgICAvLyAgRXZhbHVhdGUgRjEuCisgICAgICAgICAgaWYgKF9fYWQgPCBfX2VwcykKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgLy8gIGQgPSBjIC0gYSAtIGIgPSAwLgorICAgICAgICAgICAgICBfX0YxID0gX1RwKDApOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKworICAgICAgICAgICAgICBib29sIF9fb2tfZDEgPSB0cnVlOworICAgICAgICAgICAgICBfVHAgX19sbmdfYWQsIF9fbG5nX2FkMSwgX19sbmdfYmQxOworICAgICAgICAgICAgICBfX3RyeQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIF9fbG5nX2FkID0gX19sb2dfZ2FtbWEoX19hZCk7CisgICAgICAgICAgICAgICAgICBfX2xuZ19hZDEgPSBfX2xvZ19nYW1tYShfX2EgKyBfX2QxKTsKKyAgICAgICAgICAgICAgICAgIF9fbG5nX2JkMSA9IF9fbG9nX2dhbW1hKF9fYiArIF9fZDEpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgX19jYXRjaCguLi4pCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgX19va19kMSA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICBpZiAoX19va19kMSkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAvKiBHYW1tYSBmdW5jdGlvbnMgaW4gdGhlIGRlbm9taW5hdG9yIGFyZSBvay4KKyAgICAgICAgICAgICAgICAgICAqIFByb2NlZWQgd2l0aCBldmFsdWF0aW9uLgorICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICBfVHAgX19zdW0xID0gX1RwKDEpOworICAgICAgICAgICAgICAgICAgX1RwIF9fdGVybSA9IF9UcCgxKTsKKyAgICAgICAgICAgICAgICAgIF9UcCBfX2xuX3ByZTEgPSBfX2xuZ19hZCArIF9fbG5nX2MgKyBfX2QyICogX19sbl9vbXgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBfX2xuZ19hZDEgLSBfX2xuZ19iZDE7CisKKyAgICAgICAgICAgICAgICAgIC8qIERvIEYxIHN1bS4KKyAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgZm9yIChpbnQgX19pID0gMTsgX19pIDwgX19hZDsgKytfX2kpCisgICAgICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnQgX19qID0gX19pIC0gMTsKKyAgICAgICAgICAgICAgICAgICAgICBfX3Rlcm0gKj0gKF9fYSArIF9fZDIgKyBfX2opICogKF9fYiArIF9fZDIgKyBfX2opCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvIChfVHAoMSkgKyBfX2QyICsgX19qKSAvIF9faSAqIChfVHAoMSkgLSBfX3gpOworICAgICAgICAgICAgICAgICAgICAgIF9fc3VtMSArPSBfX3Rlcm07CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgaWYgKF9fbG5fcHJlMSA+IF9fbG9nX21heCkKKyAgICAgICAgICAgICAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJPdmVyZmxvdyBvZiBnYW1tYSBmdW5jdGlvbnMiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGluIF9faHlwZXJnX2x1a2UuIikpOworICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICBfX0YxID0gc3RkOjpleHAoX19sbl9wcmUxKSAqIF9fc3VtMTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAvLyAgR2FtbWEgZnVuY3Rpb25zIGluIHRoZSBkZW5vbWluYXRvciB3ZXJlIG5vdCBvay4KKyAgICAgICAgICAgICAgICAgIC8vICBTbyB0aGUgRjEgdGVybSBpcyB6ZXJvLgorICAgICAgICAgICAgICAgICAgX19GMSA9IF9UcCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IC8vIGVuZCBGMSBldmFsdWF0aW9uCisKKyAgICAgICAgICAvLyBFdmFsdWF0ZSBGMi4KKyAgICAgICAgICBib29sIF9fb2tfZDIgPSB0cnVlOworICAgICAgICAgIF9UcCBfX2xuZ19hZDIsIF9fbG5nX2JkMjsKKyAgICAgICAgICBfX3RyeQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX2xuZ19hZDIgPSBfX2xvZ19nYW1tYShfX2EgKyBfX2QyKTsKKyAgICAgICAgICAgICAgX19sbmdfYmQyID0gX19sb2dfZ2FtbWEoX19iICsgX19kMik7CisgICAgICAgICAgICB9CisgICAgICAgICAgX19jYXRjaCguLi4pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fb2tfZDIgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgIGlmIChfX29rX2QyKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAvLyAgR2FtbWEgZnVuY3Rpb25zIGluIHRoZSBkZW5vbWluYXRvciBhcmUgb2suCisgICAgICAgICAgICAgIC8vICBQcm9jZWVkIHdpdGggZXZhbHVhdGlvbi4KKyAgICAgICAgICAgICAgY29uc3QgaW50IF9fbWF4aXRlciA9IDIwMDA7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3BzaV8xID0gLV9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19nYW1tYV9lKCk7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3BzaV8xcGQgPSBfX3BzaShfVHAoMSkgKyBfX2FkKTsKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9fcHNpX2FwZDEgPSBfX3BzaShfX2EgKyBfX2QxKTsKKyAgICAgICAgICAgICAgY29uc3QgX1RwIF9fcHNpX2JwZDEgPSBfX3BzaShfX2IgKyBfX2QxKTsKKworICAgICAgICAgICAgICBfVHAgX19wc2lfdGVybSA9IF9fcHNpXzEgKyBfX3BzaV8xcGQgLSBfX3BzaV9hcGQxCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19wc2lfYnBkMSAtIF9fbG5fb214OworICAgICAgICAgICAgICBfVHAgX19mYWN0ID0gX1RwKDEpOworICAgICAgICAgICAgICBfVHAgX19zdW0yID0gX19wc2lfdGVybTsKKyAgICAgICAgICAgICAgX1RwIF9fbG5fcHJlMiA9IF9fbG5nX2MgKyBfX2QxICogX19sbl9vbXgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIF9fbG5nX2FkMiAtIF9fbG5nX2JkMjsKKworICAgICAgICAgICAgICAvLyBEbyBGMiBzdW0uCisgICAgICAgICAgICAgIGludCBfX2o7CisgICAgICAgICAgICAgIGZvciAoX19qID0gMTsgX19qIDwgX19tYXhpdGVyOyArK19faikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAvLyAgVmFsdWVzIGZvciBwc2kgZnVuY3Rpb25zIHVzZSByZWN1cnJlbmNlOworICAgICAgICAgICAgICAgICAgLy8gIEFicmFtb3dpdHogJiBTdGVndW4gNi4zLjUKKyAgICAgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3Rlcm0xID0gX1RwKDEpIC8gX1RwKF9faikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDEpIC8gKF9fYWQgKyBfX2opOworICAgICAgICAgICAgICAgICAgY29uc3QgX1RwIF9fdGVybTIgPSBfVHAoMSkgLyAoX19hICsgX19kMSArIF9UcChfX2ogLSAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDEpIC8gKF9fYiArIF9fZDEgKyBfVHAoX19qIC0gMSkpOworICAgICAgICAgICAgICAgICAgX19wc2lfdGVybSArPSBfX3Rlcm0xIC0gX190ZXJtMjsKKyAgICAgICAgICAgICAgICAgIF9fZmFjdCAqPSAoX19hICsgX19kMSArIF9UcChfX2ogLSAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgKiAoX19iICsgX19kMSArIF9UcChfX2ogLSAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgLyAoKF9fYWQgKyBfX2opICogX19qKSAqIChfVHAoMSkgLSBfX3gpOworICAgICAgICAgICAgICAgICAgY29uc3QgX1RwIF9fZGVsdGEgPSBfX2ZhY3QgKiBfX3BzaV90ZXJtOworICAgICAgICAgICAgICAgICAgX19zdW0yICs9IF9fZGVsdGE7CisgICAgICAgICAgICAgICAgICBpZiAoc3RkOjphYnMoX19kZWx0YSkgPCBfX2VwcyAqIHN0ZDo6YWJzKF9fc3VtMikpCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgaWYgKF9faiA9PSBfX21heGl0ZXIpCisgICAgICAgICAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJTdW0gRjIgZmFpbGVkIHRvIGNvbnZlcmdlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9faHlwZXJnX3JlZmxlY3QiKSk7CisKKyAgICAgICAgICAgICAgaWYgKF9fc3VtMiA9PSBfVHAoMCkpCisgICAgICAgICAgICAgICAgX19GMiA9IF9UcCgwKTsKKyAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIF9fRjIgPSBzdGQ6OmV4cChfX2xuX3ByZTIpICogX19zdW0yOworICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgLy8gR2FtbWEgZnVuY3Rpb25zIGluIHRoZSBkZW5vbWluYXRvciBub3Qgb2suCisgICAgICAgICAgICAgIC8vIFNvIHRoZSBGMiB0ZXJtIGlzIHplcm8uCisgICAgICAgICAgICAgIF9fRjIgPSBfVHAoMCk7CisgICAgICAgICAgICB9IC8vIGVuZCBGMiBldmFsdWF0aW9uCisKKyAgICAgICAgICBjb25zdCBfVHAgX19zZ25fMiA9IChfX2ludGQgJSAyID09IDEgPyAtX1RwKDEpIDogX1RwKDEpKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19GID0gX19GMSArIF9fc2duXzIgKiBfX0YyOworCisgICAgICAgICAgcmV0dXJuIF9fRjsKKyAgICAgICAgfQorICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgLy8gIGQgPSBjIC0gYSAtIGIgbm90IGFuIGludGVnZXIuCisKKyAgICAgICAgICAvLyAgVGhlc2UgZ2FtbWEgZnVuY3Rpb25zIGFwcGVhciBpbiB0aGUgZGVub21pbmF0b3IsIHNvIHdlCisgICAgICAgICAgLy8gIGNhdGNoIHRoZWlyIGhhcm1sZXNzIGRvbWFpbiBlcnJvcnMgYW5kIHNldCB0aGUgdGVybXMgdG8gemVyby4KKyAgICAgICAgICBib29sIF9fb2sxID0gdHJ1ZTsKKyAgICAgICAgICBfVHAgX19zZ25fZzFjYSA9IF9UcCgwKSwgX19sbl9nMWNhID0gX1RwKDApOworICAgICAgICAgIF9UcCBfX3Nnbl9nMWNiID0gX1RwKDApLCBfX2xuX2cxY2IgPSBfVHAoMCk7CisgICAgICAgICAgX190cnkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19zZ25fZzFjYSA9IF9fbG9nX2dhbW1hX3NpZ24oX19jIC0gX19hKTsKKyAgICAgICAgICAgICAgX19sbl9nMWNhID0gX19sb2dfZ2FtbWEoX19jIC0gX19hKTsKKyAgICAgICAgICAgICAgX19zZ25fZzFjYiA9IF9fbG9nX2dhbW1hX3NpZ24oX19jIC0gX19iKTsKKyAgICAgICAgICAgICAgX19sbl9nMWNiID0gX19sb2dfZ2FtbWEoX19jIC0gX19iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19vazEgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgIGJvb2wgX19vazIgPSB0cnVlOworICAgICAgICAgIF9UcCBfX3Nnbl9nMmEgPSBfVHAoMCksIF9fbG5fZzJhID0gX1RwKDApOworICAgICAgICAgIF9UcCBfX3Nnbl9nMmIgPSBfVHAoMCksIF9fbG5fZzJiID0gX1RwKDApOworICAgICAgICAgIF9fdHJ5CisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fc2duX2cyYSA9IF9fbG9nX2dhbW1hX3NpZ24oX19hKTsKKyAgICAgICAgICAgICAgX19sbl9nMmEgPSBfX2xvZ19nYW1tYShfX2EpOworICAgICAgICAgICAgICBfX3Nnbl9nMmIgPSBfX2xvZ19nYW1tYV9zaWduKF9fYik7CisgICAgICAgICAgICAgIF9fbG5fZzJiID0gX19sb2dfZ2FtbWEoX19iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBfX2NhdGNoKC4uLikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19vazIgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgIGNvbnN0IF9UcCBfX3Nnbl9nYyA9IF9fbG9nX2dhbW1hX3NpZ24oX19jKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19sbl9nYyA9IF9fbG9nX2dhbW1hKF9fYyk7CisgICAgICAgICAgY29uc3QgX1RwIF9fc2duX2dkID0gX19sb2dfZ2FtbWFfc2lnbihfX2QpOworICAgICAgICAgIGNvbnN0IF9UcCBfX2xuX2dkID0gX19sb2dfZ2FtbWEoX19kKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19zZ25fZ21kID0gX19sb2dfZ2FtbWFfc2lnbigtX19kKTsKKyAgICAgICAgICBjb25zdCBfVHAgX19sbl9nbWQgPSBfX2xvZ19nYW1tYSgtX19kKTsKKworICAgICAgICAgIGNvbnN0IF9UcCBfX3NnbjEgPSBfX3Nnbl9nYyAqIF9fc2duX2dkICAqIF9fc2duX2cxY2EgKiBfX3Nnbl9nMWNiOworICAgICAgICAgIGNvbnN0IF9UcCBfX3NnbjIgPSBfX3Nnbl9nYyAqIF9fc2duX2dtZCAqIF9fc2duX2cyYSAgKiBfX3Nnbl9nMmI7CisKKyAgICAgICAgICBfVHAgX19wcmUxLCBfX3ByZTI7CisgICAgICAgICAgaWYgKF9fb2sxICYmIF9fb2syKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfVHAgX19sbl9wcmUxID0gX19sbl9nYyArIF9fbG5fZ2QgIC0gX19sbl9nMWNhIC0gX19sbl9nMWNiOworICAgICAgICAgICAgICBfVHAgX19sbl9wcmUyID0gX19sbl9nYyArIF9fbG5fZ21kIC0gX19sbl9nMmEgIC0gX19sbl9nMmIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIF9fZCAqIHN0ZDo6bG9nKF9UcCgxKSAtIF9feCk7CisgICAgICAgICAgICAgIGlmIChfX2xuX3ByZTEgPCBfX2xvZ19tYXggJiYgX19sbl9wcmUyIDwgX19sb2dfbWF4KQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIF9fcHJlMSA9IHN0ZDo6ZXhwKF9fbG5fcHJlMSk7CisgICAgICAgICAgICAgICAgICBfX3ByZTIgPSBzdGQ6OmV4cChfX2xuX3ByZTIpOworICAgICAgICAgICAgICAgICAgX19wcmUxICo9IF9fc2duMTsKKyAgICAgICAgICAgICAgICAgIF9fcHJlMiAqPSBfX3NnbjI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJPdmVyZmxvdyBvZiBnYW1tYSBmdW5jdGlvbnMgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2h5cGVyZ19yZWZsZWN0IikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlIGlmIChfX29rMSAmJiAhX19vazIpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9UcCBfX2xuX3ByZTEgPSBfX2xuX2djICsgX19sbl9nZCAtIF9fbG5fZzFjYSAtIF9fbG5fZzFjYjsKKyAgICAgICAgICAgICAgaWYgKF9fbG5fcHJlMSA8IF9fbG9nX21heCkKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBfX3ByZTEgPSBzdGQ6OmV4cChfX2xuX3ByZTEpOworICAgICAgICAgICAgICAgICAgX19wcmUxICo9IF9fc2duMTsKKyAgICAgICAgICAgICAgICAgIF9fcHJlMiA9IF9UcCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIk92ZXJmbG93IG9mIGdhbW1hIGZ1bmN0aW9ucyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9faHlwZXJnX3JlZmxlY3QiKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgIGVsc2UgaWYgKCFfX29rMSAmJiBfX29rMikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX1RwIF9fbG5fcHJlMiA9IF9fbG5fZ2MgKyBfX2xuX2dtZCAtIF9fbG5fZzJhIC0gX19sbl9nMmIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIF9fZCAqIHN0ZDo6bG9nKF9UcCgxKSAtIF9feCk7CisgICAgICAgICAgICAgIGlmIChfX2xuX3ByZTIgPCBfX2xvZ19tYXgpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgX19wcmUxID0gX1RwKDApOworICAgICAgICAgICAgICAgICAgX19wcmUyID0gc3RkOjpleHAoX19sbl9wcmUyKTsKKyAgICAgICAgICAgICAgICAgIF9fcHJlMiAqPSBfX3NnbjI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgc3RkOjpfX3Rocm93X3J1bnRpbWVfZXJyb3IoX19OKCJPdmVyZmxvdyBvZiBnYW1tYSBmdW5jdGlvbnMgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2h5cGVyZ19yZWZsZWN0IikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fcHJlMSA9IF9UcCgwKTsKKyAgICAgICAgICAgICAgX19wcmUyID0gX1RwKDApOworICAgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIlVuZGVyZmxvdyBvZiBnYW1tYSBmdW5jdGlvbnMgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9faHlwZXJnX3JlZmxlY3QiKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICBjb25zdCBfVHAgX19GMSA9IF9faHlwZXJnX3NlcmllcyhfX2EsIF9fYiwgX1RwKDEpIC0gX19kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9UcCgxKSAtIF9feCk7CisgICAgICAgICAgY29uc3QgX1RwIF9fRjIgPSBfX2h5cGVyZ19zZXJpZXMoX19jIC0gX19hLCBfX2MgLSBfX2IsIF9UcCgxKSArIF9fZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfVHAoMSkgLSBfX3gpOworCisgICAgICAgICAgY29uc3QgX1RwIF9fRiA9IF9fcHJlMSAqIF9fRjEgKyBfX3ByZTIgKiBfX0YyOworCisgICAgICAgICAgcmV0dXJuIF9fRjsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgUmV0dXJuIHRoZSBoeXBvZ2VvbWV0cmljIGZ1bmN0aW9uIEBmJCBfMkZfMShhLGI7Yzt4KSBAZiQuCisgICAgICoKKyAgICAgKiAgIFRoZSBoeXBvZ2VvbWV0cmljIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnkKKyAgICAgKiAgIEBmWworICAgICAqICAgICBfMkZfMShhLGI7Yzt4KSA9IFxmcmFje1xHYW1tYShjKX17XEdhbW1hKGEpXEdhbW1hKGIpfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgIFxzdW1fe249MH1ee1xpbmZ0eX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICBcZnJhY3tcR2FtbWEoYStuKVxHYW1tYShiK24pfXtcR2FtbWEoYytuKX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICBcZnJhY3t4Xm59e24hfQorICAgICAqICAgQGZdCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX19hICBUaGUgZmlyc3QgQGEgbnVtZXJhdG9yIHBhcmFtZXRlci4KKyAgICAgKiAgIEBwYXJhbSAgX19hICBUaGUgc2Vjb25kIEBhIG51bWVyYXRvciBwYXJhbWV0ZXIuCisgICAgICogICBAcGFyYW0gIF9fYyAgVGhlIEBhIGRlbm9taW5hdG9yIHBhcmFtZXRlci4KKyAgICAgKiAgIEBwYXJhbSAgX194ICBUaGUgYXJndW1lbnQgb2YgdGhlIGNvbmZsdWVudCBoeXBlcmdlb21ldHJpYyBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBjb25mbHVlbnQgaHlwZXJnZW9tZXRyaWMgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfVHAKKyAgICBfX2h5cGVyZyhjb25zdCBfVHAgX19hLCBjb25zdCBfVHAgX19iLCBjb25zdCBfVHAgX19jLCBjb25zdCBfVHAgX194KQorICAgIHsKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICBjb25zdCBfVHAgX19hX25pbnQgPSBzdGQ6OnRyMTo6bmVhcmJ5aW50KF9fYSk7CisgICAgICBjb25zdCBfVHAgX19iX25pbnQgPSBzdGQ6OnRyMTo6bmVhcmJ5aW50KF9fYik7CisgICAgICBjb25zdCBfVHAgX19jX25pbnQgPSBzdGQ6OnRyMTo6bmVhcmJ5aW50KF9fYyk7CisjZWxzZQorICAgICAgY29uc3QgX1RwIF9fYV9uaW50ID0gc3RhdGljX2Nhc3Q8aW50PihfX2EgKyBfVHAoMC41TCkpOworICAgICAgY29uc3QgX1RwIF9fYl9uaW50ID0gc3RhdGljX2Nhc3Q8aW50PihfX2IgKyBfVHAoMC41TCkpOworICAgICAgY29uc3QgX1RwIF9fY19uaW50ID0gc3RhdGljX2Nhc3Q8aW50PihfX2MgKyBfVHAoMC41TCkpOworI2VuZGlmCisgICAgICBjb25zdCBfVHAgX190b2xlciA9IF9UcCgxMDAwKSAqIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6ZXBzaWxvbigpOworICAgICAgaWYgKHN0ZDo6YWJzKF9feCkgPj0gX1RwKDEpKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQXJndW1lbnQgb3V0c2lkZSB1bml0IGNpcmNsZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2h5cGVyZy4iKSk7CisgICAgICBlbHNlIGlmIChfX2lzbmFuKF9fYSkgfHwgX19pc25hbihfX2IpCisgICAgICAgICAgICB8fCBfX2lzbmFuKF9fYykgfHwgX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKF9fY19uaW50ID09IF9fYyAmJiBfX2NfbmludCA8PSBfVHAoMCkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmluZmluaXR5KCk7CisgICAgICBlbHNlIGlmIChzdGQ6OmFicyhfX2MgLSBfX2IpIDwgX190b2xlciB8fCBzdGQ6OmFicyhfX2MgLSBfX2EpIDwgX190b2xlcikKKyAgICAgICAgcmV0dXJuIHN0ZDo6cG93KF9UcCgxKSAtIF9feCwgX19jIC0gX19hIC0gX19iKTsKKyAgICAgIGVsc2UgaWYgKF9fYSA+PSBfVHAoMCkgJiYgX19iID49IF9UcCgwKSAmJiBfX2MgPj0gX1RwKDApCisgICAgICAgICAgICAmJiBfX3ggPj0gX1RwKDApICYmIF9feCA8IF9UcCgwLjk5NUwpKQorICAgICAgICByZXR1cm4gX19oeXBlcmdfc2VyaWVzKF9fYSwgX19iLCBfX2MsIF9feCk7CisgICAgICBlbHNlIGlmIChzdGQ6OmFicyhfX2EpIDwgX1RwKDEwKSAmJiBzdGQ6OmFicyhfX2IpIDwgX1RwKDEwKSkKKyAgICAgICAgeworICAgICAgICAgIC8vICBGb3IgaW50ZWdlciBhIGFuZCBiIHRoZSBoeXBlcmdlb21ldHJpYyBmdW5jdGlvbiBpcyBhCisgICAgICAgICAgLy8gIGZpbml0ZSBwb2x5bm9taWFsLgorICAgICAgICAgIGlmIChfX2EgPCBfVHAoMCkgICYmICBzdGQ6OmFicyhfX2EgLSBfX2FfbmludCkgPCBfX3RvbGVyKQorICAgICAgICAgICAgcmV0dXJuIF9faHlwZXJnX3NlcmllcyhfX2FfbmludCwgX19iLCBfX2MsIF9feCk7CisgICAgICAgICAgZWxzZSBpZiAoX19iIDwgX1RwKDApICAmJiAgc3RkOjphYnMoX19iIC0gX19iX25pbnQpIDwgX190b2xlcikKKyAgICAgICAgICAgIHJldHVybiBfX2h5cGVyZ19zZXJpZXMoX19hLCBfX2JfbmludCwgX19jLCBfX3gpOworICAgICAgICAgIGVsc2UgaWYgKF9feCA8IC1fVHAoMC4yNUwpKQorICAgICAgICAgICAgcmV0dXJuIF9faHlwZXJnX2x1a2UoX19hLCBfX2IsIF9fYywgX194KTsKKyAgICAgICAgICBlbHNlIGlmIChfX3ggPCBfVHAoMC41TCkpCisgICAgICAgICAgICByZXR1cm4gX19oeXBlcmdfc2VyaWVzKF9fYSwgX19iLCBfX2MsIF9feCk7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgaWY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kLgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3BvbHlfbGVnZW5kcmVfcChjb25zdCB1bnNpZ25lZCBpbnQgX19sLCBjb25zdCBfVHAgX194KQorICAgIHsKKworICAgICAgaWYgKChfX3ggPCBfVHAoLTEpKSB8fCAoX194ID4gX1RwKCsxKSkpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJBcmd1bWVudCBvdXQgb2YgcmFuZ2UiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgaW4gX19wb2x5X2xlZ2VuZHJlX3AuIikpOworICAgICAgZWxzZSBpZiAoX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKF9feCA9PSArX1RwKDEpKQorICAgICAgICByZXR1cm4gK19UcCgxKTsKKyAgICAgIGVsc2UgaWYgKF9feCA9PSAtX1RwKDEpKQorICAgICAgICByZXR1cm4gKF9fbCAlIDIgPT0gMSA/IC1fVHAoMSkgOiArX1RwKDEpKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3BfbG0yID0gX1RwKDEpOworICAgICAgICAgIGlmIChfX2wgPT0gMCkKKyAgICAgICAgICAgIHJldHVybiBfX3BfbG0yOworCisgICAgICAgICAgX1RwIF9fcF9sbTEgPSBfX3g7CisgICAgICAgICAgaWYgKF9fbCA9PSAxKQorICAgICAgICAgICAgcmV0dXJuIF9fcF9sbTE7CisKKyAgICAgICAgICBfVHAgX19wX2wgPSAwOworICAgICAgICAgIGZvciAodW5zaWduZWQgaW50IF9fbGwgPSAyOyBfX2xsIDw9IF9fbDsgKytfX2xsKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAvLyAgVGhpcyBhcnJhbmdlbWVudCBpcyBzdXBwb3NlZCB0byBiZSBiZXR0ZXIgZm9yIHJvdW5kb2ZmCisgICAgICAgICAgICAgIC8vICBwcm90ZWN0aW9uLCBBcmZrZW4sIDJuZCBFZCwgRXEgMTIuMTdhLgorICAgICAgICAgICAgICBfX3BfbCA9IF9UcCgyKSAqIF9feCAqIF9fcF9sbTEgLSBfX3BfbG0yCisgICAgICAgICAgICAgICAgICAgIC0gKF9feCAqIF9fcF9sbTEgLSBfX3BfbG0yKSAvIF9UcChfX2xsKTsKKyAgICAgICAgICAgICAgX19wX2xtMiA9IF9fcF9sbTE7CisgICAgICAgICAgICAgIF9fcF9sbTEgPSBfX3BfbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgIHJldHVybiBfX3BfbDsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgYXNzb2NpYXRlZCBMZWdlbmRyZSBmdW5jdGlvbiBieSByZWN1cnNpb24KKyAgICAgKiAgICAgICAgICAgb24gQGYkIGwgQGYkLgorICAgICAqIAorICAgICAqICAgVGhlIGFzc29jaWF0ZWQgTGVnZW5kcmUgZnVuY3Rpb24gaXMgZGVyaXZlZCBmcm9tIHRoZSBMZWdlbmRyZSBmdW5jdGlvbgorICAgICAqICAgQGYkIFBfbCh4KSBAZiQgYnkgdGhlIFJvZHJpZ3VlcyBmb3JtdWxhOgorICAgICAqICAgQGZbCisgICAgICogICAgIFBfbF5tKHgpID0gKDEgLSB4XjIpXnttLzJ9XGZyYWN7ZF5tfXtkeF5tfVBfbCh4KQorICAgICAqICAgQGZdCisgICAgICogCisgICAgICogICBAcGFyYW0gIGwgIFRoZSBvcmRlciBvZiB0aGUgYXNzb2NpYXRlZCBMZWdlbmRyZSBmdW5jdGlvbi4KKyAgICAgKiAgICAgICAgICAgICAgQGYkIGwgPj0gMCBAZiQuCisgICAgICogICBAcGFyYW0gIG0gIFRoZSBvcmRlciBvZiB0aGUgYXNzb2NpYXRlZCBMZWdlbmRyZSBmdW5jdGlvbi4KKyAgICAgKiAgICAgICAgICAgICAgQGYkIG0gPD0gbCBAZiQuCisgICAgICogICBAcGFyYW0gIHggIFRoZSBhcmd1bWVudCBvZiB0aGUgYXNzb2NpYXRlZCBMZWdlbmRyZSBmdW5jdGlvbi4KKyAgICAgKiAgICAgICAgICAgICAgQGYkIHx4fCA8PSAxIEBmJC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19hc3NvY19sZWdlbmRyZV9wKGNvbnN0IHVuc2lnbmVkIGludCBfX2wsIGNvbnN0IHVuc2lnbmVkIGludCBfX20sCisgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3gpCisgICAgeworCisgICAgICBpZiAoX194IDwgX1RwKC0xKSB8fCBfX3ggPiBfVHAoKzEpKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQXJndW1lbnQgb3V0IG9mIHJhbmdlIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGluIF9fYXNzb2NfbGVnZW5kcmVfcC4iKSk7CisgICAgICBlbHNlIGlmIChfX20gPiBfX2wpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJEZWdyZWUgb3V0IG9mIHJhbmdlIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGluIF9fYXNzb2NfbGVnZW5kcmVfcC4iKSk7CisgICAgICBlbHNlIGlmIChfX2lzbmFuKF9feCkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OnF1aWV0X05hTigpOworICAgICAgZWxzZSBpZiAoX19tID09IDApCisgICAgICAgIHJldHVybiBfX3BvbHlfbGVnZW5kcmVfcChfX2wsIF9feCk7CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19wX21tID0gX1RwKDEpOworICAgICAgICAgIGlmIChfX20gPiAwKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAvLyAgVHdvIHNxdWFyZSByb290cyBzZWVtIG1vcmUgYWNjdXJhdGUgbW9yZSBvZiB0aGUgdGltZQorICAgICAgICAgICAgICAvLyAgdGhhbiBqdXN0IG9uZS4KKyAgICAgICAgICAgICAgX1RwIF9fcm9vdCA9IHN0ZDo6c3FydChfVHAoMSkgLSBfX3gpICogc3RkOjpzcXJ0KF9UcCgxKSArIF9feCk7CisgICAgICAgICAgICAgIF9UcCBfX2ZhY3QgPSBfVHAoMSk7CisgICAgICAgICAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDE7IF9faSA8PSBfX207ICsrX19pKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIF9fcF9tbSAqPSAtX19mYWN0ICogX19yb290OworICAgICAgICAgICAgICAgICAgX19mYWN0ICs9IF9UcCgyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgaWYgKF9fbCA9PSBfX20pCisgICAgICAgICAgICByZXR1cm4gX19wX21tOworCisgICAgICAgICAgX1RwIF9fcF9tcDFtID0gX1RwKDIgKiBfX20gKyAxKSAqIF9feCAqIF9fcF9tbTsKKyAgICAgICAgICBpZiAoX19sID09IF9fbSArIDEpCisgICAgICAgICAgICByZXR1cm4gX19wX21wMW07CisKKyAgICAgICAgICBfVHAgX19wX2xtMm0gPSBfX3BfbW07CisgICAgICAgICAgX1RwIF9fUF9sbTFtID0gX19wX21wMW07CisgICAgICAgICAgX1RwIF9fcF9sbSA9IF9UcCgwKTsKKyAgICAgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2ogPSBfX20gKyAyOyBfX2ogPD0gX19sOyArK19faikKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19wX2xtID0gKF9UcCgyICogX19qIC0gMSkgKiBfX3ggKiBfX1BfbG0xbQorICAgICAgICAgICAgICAgICAgICAgIC0gX1RwKF9faiArIF9fbSAtIDEpICogX19wX2xtMm0pIC8gX1RwKF9faiAtIF9fbSk7CisgICAgICAgICAgICAgIF9fcF9sbTJtID0gX19QX2xtMW07CisgICAgICAgICAgICAgIF9fUF9sbTFtID0gX19wX2xtOworICAgICAgICAgICAgfQorCisgICAgICAgICAgcmV0dXJuIF9fcF9sbTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgc3BoZXJpY2FsIGFzc29jaWF0ZWQgTGVnZW5kcmUgZnVuY3Rpb24uCisgICAgICogCisgICAgICogICBUaGUgc3BoZXJpY2FsIGFzc29jaWF0ZWQgTGVnZW5kcmUgZnVuY3Rpb24gb2YgQGYkIGwgQGYkLCBAZiQgbSBAZiQsCisgICAgICogICBhbmQgQGYkIFx0aGV0YSBAZiQgaXMgZGVmaW5lZCBhcyBAZiQgWV9sXm0oXHRoZXRhLDApIEBmJCB3aGVyZQorICAgICAqICAgQGZbCisgICAgICogICAgICBZX2xebShcdGhldGEsXHBoaSkgPSAoLTEpXm1bXGZyYWN7KDJsKzEpfXs0XHBpfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxmcmFjeyhsLW0pIX17KGwrbSkhfV0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgIFBfbF5tKFxjb3NcdGhldGEpIFxleHBee2ltXHBoaX0KKyAgICAgKiAgIEBmXQorICAgICAqICAgaXMgdGhlIHNwaGVyaWNhbCBoYXJtb25pYyBmdW5jdGlvbiBhbmQgQGYkIFBfbF5tKHgpIEBmJCBpcyB0aGUKKyAgICAgKiAgIGFzc29jaWF0ZWQgTGVnZW5kcmUgZnVuY3Rpb24uCisgICAgICogCisgICAgICogICBUaGlzIGZ1bmN0aW9uIGRpZmZlcnMgZnJvbSB0aGUgYXNzb2NpYXRlZCBMZWdlbmRyZSBmdW5jdGlvbiBieQorICAgICAqICAgYXJndW1lbnQgKEBmJHggPSBcY29zKFx0aGV0YSlAZiQ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IHN0ZDo6Y29zKF9fdGhldGEpOworCisgICAgICBpZiAoX19sIDwgX19tKQorICAgICAgICB7CisgICAgICAgICAgc3RkOjpfX3Rocm93X2RvbWFpbl9lcnJvcihfX04oIkJhZCBhcmd1bWVudCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fc3BoX2xlZ2VuZHJlLiIpKTsKKyAgICAgICAgfQorICAgICAgZWxzZSBpZiAoX19tID09IDApCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19QID0gX19wb2x5X2xlZ2VuZHJlX3AoX19sLCBfX3gpOworICAgICAgICAgIF9UcCBfX2ZhY3QgPSBzdGQ6OnNxcnQoX1RwKDIgKiBfX2wgKyAxKQorICAgICAgICAgICAgICAgICAgICAgLyAoX1RwKDQpICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCkpKTsKKyAgICAgICAgICBfX1AgKj0gX19mYWN0OworICAgICAgICAgIHJldHVybiBfX1A7CisgICAgICAgIH0KKyAgICAgIGVsc2UgaWYgKF9feCA9PSBfVHAoMSkgfHwgX194ID09IC1fVHAoMSkpCisgICAgICAgIHsKKyAgICAgICAgICAvLyAgbSA+IDAgaGVyZQorICAgICAgICAgIHJldHVybiBfVHAoMCk7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIC8vIG0gPiAwIGFuZCB8eHwgPCAxIGhlcmUKKworICAgICAgICAgIC8vIFN0YXJ0aW5nIHZhbHVlIGZvciByZWN1cnNpb24uCisgICAgICAgICAgLy8gWV9tXm0oeCkgPSBzcXJ0KCAoMm0rMSkvKDRwaSBtKSBnYW1tYShtKzEvMikvZ2FtbWEobSkgKQorICAgICAgICAgIC8vICAgICAgICAgICAgICgtMSlebSAoMS14XjIpXihtLzIpIC8gcGleKDEvNCkKKyAgICAgICAgICBjb25zdCBfVHAgX19zZ24gPSAoIF9fbSAlIDIgPT0gMSA/IC1fVHAoMSkgOiBfVHAoMSkpOworICAgICAgICAgIGNvbnN0IF9UcCBfX3lfbXAxbV9mYWN0b3IgPSBfX3ggKiBzdGQ6OnNxcnQoX1RwKDIgKiBfX20gKyAzKSk7CisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgICAgIGNvbnN0IF9UcCBfX2xuY2lyYyA9IHN0ZDo6dHIxOjpsb2cxcCgtX194ICogX194KTsKKyNlbHNlCisgICAgICAgICAgY29uc3QgX1RwIF9fbG5jaXJjID0gc3RkOjpsb2coX1RwKDEpIC0gX194ICogX194KTsKKyNlbmRpZgorICAgICAgICAgIC8vICBHYW1tYShtKzEvMikgLyBHYW1tYShtKQorI2lmIF9HTElCQ1hYX1VTRV9DOTlfTUFUSF9UUjEKKyAgICAgICAgICBjb25zdCBfVHAgX19sbnBvY2ggPSBzdGQ6OnRyMTo6bGdhbW1hKF9UcChfX20gKyBfVHAoMC41TCkpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKF9fbSkpOworI2Vsc2UKKyAgICAgICAgICBjb25zdCBfVHAgX19sbnBvY2ggPSBfX2xvZ19nYW1tYShfVHAoX19tICsgX1RwKDAuNUwpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBfX2xvZ19nYW1tYShfVHAoX19tKSk7CisjZW5kaWYKKyAgICAgICAgICBjb25zdCBfVHAgX19sbnByZV92YWwgPQorICAgICAgICAgICAgICAgICAgICAtX1RwKDAuMjVMKSAqIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19sbnBpKCkKKyAgICAgICAgICAgICAgICAgICAgKyBfVHAoMC41TCkgKiAoX19sbnBvY2ggKyBfX20gKiBfX2xuY2lyYyk7CisgICAgICAgICAgX1RwIF9fc3IgPSBzdGQ6OnNxcnQoKF9UcCgyKSArIF9UcCgxKSAvIF9fbSkKKyAgICAgICAgICAgICAgICAgICAvIChfVHAoNCkgKiBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKSkpOworICAgICAgICAgIF9UcCBfX3lfbW0gPSBfX3NnbiAqIF9fc3IgKiBzdGQ6OmV4cChfX2xucHJlX3ZhbCk7CisgICAgICAgICAgX1RwIF9feV9tcDFtID0gX195X21wMW1fZmFjdG9yICogX195X21tOworCisgICAgICAgICAgaWYgKF9fbCA9PSBfX20pCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIHJldHVybiBfX3lfbW07CisgICAgICAgICAgICB9CisgICAgICAgICAgZWxzZSBpZiAoX19sID09IF9fbSArIDEpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIHJldHVybiBfX3lfbXAxbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9UcCBfX3lfbG0gPSBfVHAoMCk7CisKKyAgICAgICAgICAgICAgLy8gQ29tcHV0ZSBZX2xebSwgbCA+IG0rMSwgdXB3YXJkIHJlY3Vyc2lvbiBvbiBsLgorICAgICAgICAgICAgICBmb3IgKCBpbnQgX19sbCA9IF9fbSArIDI7IF9fbGwgPD0gX19sOyArK19fbGwpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgY29uc3QgX1RwIF9fcmF0MSA9IF9UcChfX2xsIC0gX19tKSAvIF9UcChfX2xsICsgX19tKTsKKyAgICAgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3JhdDIgPSBfVHAoX19sbCAtIF9fbSAtIDEpIC8gX1RwKF9fbGwgKyBfX20gLSAxKTsKKyAgICAgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2ZhY3QxID0gc3RkOjpzcXJ0KF9fcmF0MSAqIF9UcCgyICogX19sbCArIDEpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBfVHAoMiAqIF9fbGwgLSAxKSk7CisgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX19mYWN0MiA9IHN0ZDo6c3FydChfX3JhdDEgKiBfX3JhdDIgKiBfVHAoMiAqIF9fbGwgKyAxKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gX1RwKDIgKiBfX2xsIC0gMykpOworICAgICAgICAgICAgICAgICAgX195X2xtID0gKF9feCAqIF9feV9tcDFtICogX19mYWN0MQorICAgICAgICAgICAgICAgICAgICAgICAgIC0gKF9fbGwgKyBfX20gLSAxKSAqIF9feV9tbSAqIF9fZmFjdDIpIC8gX1RwKF9fbGwgLSBfX20pOworICAgICAgICAgICAgICAgICAgX195X21tID0gX195X21wMW07CisgICAgICAgICAgICAgICAgICBfX3lfbXAxbSA9IF9feV9sbTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgcmV0dXJuIF9feV9sbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICBfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX1ZFUlNJT04KKyAgfSAvLyBuYW1lc3BhY2Ugc3RkOjp0cjE6Ol9fZGV0YWlsCit9Cit9CisKKyNlbmRpZiAvLyBfR0xJQkNYWF9UUjFfTEVHRU5EUkVfRlVOQ1RJT05fVENDCmRpZmYgLS1naXQgYS84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL3RyMS9saW1pdHMuaCBiLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvdHIxL2xpbWl0cy5oCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmQ5NWQzNjAKLS0tIC9kZXYvbnVsbAorKysgYi84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrLzQuNy9pbmNsdWRlL3RyMS9saW1pdHMuaApAQCAtMCwwICsxLDM0IEBACisvLyBUUjEgbGltaXRzLmggLSotIEMrKyAtKi0KKworLy8gQ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WwKKyAgICAgKiAgICAgICAgICAgc3RhYmlsaXR5LgorICAgICAqCisgICAgICogICBAcGFyYW0gIF9fbnUgIFRoZSBvcmRlciBvZiB0aGUgQmVzc2VsIGZ1bmN0aW9ucy4KKyAgICAgKiAgIEBwYXJhbSAgX194ICAgVGhlIGFyZ3VtZW50IG9mIHRoZSBCZXNzZWwgZnVuY3Rpb25zLgorICAgICAqICAgQHBhcmFtICBfX0ludSAgVGhlIG91dHB1dCByZWd1bGFyIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19LbnUgIFRoZSBvdXRwdXQgaXJyZWd1bGFyIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19JcG51ICBUaGUgb3V0cHV0IGRlcml2YXRpdmUgb2YgdGhlIHJlZ3VsYXIKKyAgICAgKiAgICAgICAgICAgICAgICAgICBtb2RpZmllZCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9fS3BudSAgVGhlIG91dHB1dCBkZXJpdmF0aXZlIG9mIHRoZSBpcnJlZ3VsYXIKKyAgICAgKiAgICAgICAgICAgICAgICAgICBtb2RpZmllZCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICovCisgICAgdGVtcGxhdGUgPHR5cGVuYW1lIF9UcD4KKyAgICB2b2lkCisgICAgX19iZXNzZWxfaWsoY29uc3QgX1RwIF9fbnUsIGNvbnN0IF9UcCBfX3gsCisgICAgICAgICAgICAgICAgX1RwICYgX19JbnUsIF9UcCAmIF9fS251LCBfVHAgJiBfX0lwbnUsIF9UcCAmIF9fS3BudSkKKyAgICB7CisgICAgICBpZiAoX194ID09IF9UcCgwKSkKKyAgICAgICAgeworICAgICAgICAgIGlmIChfX251ID09IF9UcCgwKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19JbnUgPSBfVHAoMSk7CisgICAgICAgICAgICAgIF9fSXBudSA9IF9UcCgwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlIGlmIChfX251ID09IF9UcCgxKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19JbnUgPSBfVHAoMCk7CisgICAgICAgICAgICAgIF9fSXBudSA9IF9UcCgwLjVMKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBlbHNlCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9fSW51ID0gX1RwKDApOworICAgICAgICAgICAgICBfX0lwbnUgPSBfVHAoMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgX19LbnUgPSBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmluZmluaXR5KCk7CisgICAgICAgICAgX19LcG51ID0gLXN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6aW5maW5pdHkoKTsKKyAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBjb25zdCBfVHAgX19mcF9taW4gPSBfVHAoMTApICogc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICBjb25zdCBpbnQgX19tYXhfaXRlciA9IDE1MDAwOworICAgICAgY29uc3QgX1RwIF9feF9taW4gPSBfVHAoMik7CisKKyAgICAgIGNvbnN0IGludCBfX25sID0gc3RhdGljX2Nhc3Q8aW50PihfX251ICsgX1RwKDAuNUwpKTsKKworICAgICAgY29uc3QgX1RwIF9fbXUgPSBfX251IC0gX19ubDsKKyAgICAgIGNvbnN0IF9UcCBfX211MiA9IF9fbXUgKiBfX211OworICAgICAgY29uc3QgX1RwIF9feGkgPSBfVHAoMSkgLyBfX3g7CisgICAgICBjb25zdCBfVHAgX194aTIgPSBfVHAoMikgKiBfX3hpOworICAgICAgX1RwIF9faCA9IF9fbnUgKiBfX3hpOworICAgICAgaWYgKCBfX2ggPCBfX2ZwX21pbiApCisgICAgICAgIF9faCA9IF9fZnBfbWluOworICAgICAgX1RwIF9fYiA9IF9feGkyICogX19udTsKKyAgICAgIF9UcCBfX2QgPSBfVHAoMCk7CisgICAgICBfVHAgX19jID0gX19oOworICAgICAgaW50IF9faTsKKyAgICAgIGZvciAoIF9faSA9IDE7IF9faSA8PSBfX21heF9pdGVyOyArK19faSApCisgICAgICAgIHsKKyAgICAgICAgICBfX2IgKz0gX194aTI7CisgICAgICAgICAgX19kID0gX1RwKDEpIC8gKF9fYiArIF9fZCk7CisgICAgICAgICAgX19jID0gX19iICsgX1RwKDEpIC8gX19jOworICAgICAgICAgIGNvbnN0IF9UcCBfX2RlbCA9IF9fYyAqIF9fZDsKKyAgICAgICAgICBfX2ggKj0gX19kZWw7CisgICAgICAgICAgaWYgKHN0ZDo6YWJzKF9fZGVsIC0gX1RwKDEpKSA8IF9fZXBzKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgIGlmIChfX2kgPiBfX21heF9pdGVyKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIkFyZ3VtZW50IHggdG9vIGxhcmdlICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX2Jlc3NlbF9qbjsgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInRyeSBhc3ltcHRvdGljIGV4cGFuc2lvbi4iKSk7CisgICAgICBfVHAgX19JbnVsID0gX19mcF9taW47CisgICAgICBfVHAgX19JcG51bCA9IF9faCAqIF9fSW51bDsKKyAgICAgIF9UcCBfX0ludWwxID0gX19JbnVsOworICAgICAgX1RwIF9fSXBudTEgPSBfX0lwbnVsOworICAgICAgX1RwIF9fZmFjdCA9IF9fbnUgKiBfX3hpOworICAgICAgZm9yIChpbnQgX19sID0gX19ubDsgX19sID49IDE7IC0tX19sKQorICAgICAgICB7CisgICAgICAgICAgY29uc3QgX1RwIF9fSW51dGVtcCA9IF9fZmFjdCAqIF9fSW51bCArIF9fSXBudWw7CisgICAgICAgICAgX19mYWN0IC09IF9feGk7CisgICAgICAgICAgX19JcG51bCA9IF9fZmFjdCAqIF9fSW51dGVtcCArIF9fSW51bDsKKyAgICAgICAgICBfX0ludWwgPSBfX0ludXRlbXA7CisgICAgICAgIH0KKyAgICAgIF9UcCBfX2YgPSBfX0lwbnVsIC8gX19JbnVsOworICAgICAgX1RwIF9fS211LCBfX0tudTE7CisgICAgICBpZiAoX194IDwgX194X21pbikKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX3gyID0gX194IC8gX1RwKDIpOworICAgICAgICAgIGNvbnN0IF9UcCBfX3BpbXUgPSBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKSAqIF9fbXU7CisgICAgICAgICAgY29uc3QgX1RwIF9fZmFjdCA9IChzdGQ6OmFicyhfX3BpbXUpIDwgX19lcHMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IF9UcCgxKSA6IF9fcGltdSAvIHN0ZDo6c2luKF9fcGltdSkpOworICAgICAgICAgIF9UcCBfX2QgPSAtc3RkOjpsb2coX194Mik7CisgICAgICAgICAgX1RwIF9fZSA9IF9fbXUgKiBfX2Q7CisgICAgICAgICAgY29uc3QgX1RwIF9fZmFjdDIgPSAoc3RkOjphYnMoX19lKSA8IF9fZXBzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBfVHAoMSkgOiBzdGQ6OnNpbmgoX19lKSAvIF9fZSk7CisgICAgICAgICAgX1RwIF9fZ2FtMSwgX19nYW0yLCBfX2dhbXBsLCBfX2dhbW1pOworICAgICAgICAgIF9fZ2FtbWFfdGVtbWUoX19tdSwgX19nYW0xLCBfX2dhbTIsIF9fZ2FtcGwsIF9fZ2FtbWkpOworICAgICAgICAgIF9UcCBfX2ZmID0gX19mYWN0CisgICAgICAgICAgICAgICAgICAgKiAoX19nYW0xICogc3RkOjpjb3NoKF9fZSkgKyBfX2dhbTIgKiBfX2ZhY3QyICogX19kKTsKKyAgICAgICAgICBfVHAgX19zdW0gPSBfX2ZmOworICAgICAgICAgIF9fZSA9IHN0ZDo6ZXhwKF9fZSk7CisgICAgICAgICAgX1RwIF9fcCA9IF9fZSAvIChfVHAoMikgKiBfX2dhbXBsKTsKKyAgICAgICAgICBfVHAgX19xID0gX1RwKDEpIC8gKF9UcCgyKSAqIF9fZSAqIF9fZ2FtbWkpOworICAgICAgICAgIF9UcCBfX2MgPSBfVHAoMSk7CisgICAgICAgICAgX19kID0gX194MiAqIF9feDI7CisgICAgICAgICAgX1RwIF9fc3VtMSA9IF9fcDsKKyAgICAgICAgICBpbnQgX19pOworICAgICAgICAgIGZvciAoX19pID0gMTsgX19pIDw9IF9fbWF4X2l0ZXI7ICsrX19pKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBfX2ZmID0gKF9faSAqIF9fZmYgKyBfX3AgKyBfX3EpIC8gKF9faSAqIF9faSAtIF9fbXUyKTsKKyAgICAgICAgICAgICAgX19jICo9IF9fZCAvIF9faTsKKyAgICAgICAgICAgICAgX19wIC89IF9faSAtIF9fbXU7CisgICAgICAgICAgICAgIF9fcSAvPSBfX2kgKyBfX211OworICAgICAgICAgICAgICBjb25zdCBfVHAgX19kZWwgPSBfX2MgKiBfX2ZmOworICAgICAgICAgICAgICBfX3N1bSArPSBfX2RlbDsgCisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX2RlbDEgPSBfX2MgKiAoX19wIC0gX19pICogX19mZik7CisgICAgICAgICAgICAgIF9fc3VtMSArPSBfX2RlbDE7CisgICAgICAgICAgICAgIGlmIChzdGQ6OmFicyhfX2RlbCkgPCBfX2VwcyAqIHN0ZDo6YWJzKF9fc3VtKSkKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBpZiAoX19pID4gX19tYXhfaXRlcikKKyAgICAgICAgICAgIHN0ZDo6X190aHJvd19ydW50aW1lX2Vycm9yKF9fTigiQmVzc2VsIGsgc2VyaWVzIGZhaWxlZCB0byBjb252ZXJnZSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fYmVzc2VsX2puLiIpKTsKKyAgICAgICAgICBfX0ttdSA9IF9fc3VtOworICAgICAgICAgIF9fS251MSA9IF9fc3VtMSAqIF9feGkyOworICAgICAgICB9CisgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19iID0gX1RwKDIpICogKF9UcCgxKSArIF9feCk7CisgICAgICAgICAgX1RwIF9fZCA9IF9UcCgxKSAvIF9fYjsKKyAgICAgICAgICBfVHAgX19kZWxoID0gX19kOworICAgICAgICAgIF9UcCBfX2ggPSBfX2RlbGg7CisgICAgICAgICAgX1RwIF9fcTEgPSBfVHAoMCk7CisgICAgICAgICAgX1RwIF9fcTIgPSBfVHAoMSk7CisgICAgICAgICAgX1RwIF9fYTEgPSBfVHAoMC4yNUwpIC0gX19tdTI7CisgICAgICAgICAgX1RwIF9fcSA9IF9fYyA9IF9fYTE7CisgICAgICAgICAgX1RwIF9fYSA9IC1fX2ExOworICAgICAgICAgIF9UcCBfX3MgPSBfVHAoMSkgKyBfX3EgKiBfX2RlbGg7CisgICAgICAgICAgaW50IF9faTsKKyAgICAgICAgICBmb3IgKF9faSA9IDI7IF9faSA8PSBfX21heF9pdGVyOyArK19faSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgX19hIC09IDIgKiAoX19pIC0gMSk7CisgICAgICAgICAgICAgIF9fYyA9IC1fX2EgKiBfX2MgLyBfX2k7CisgICAgICAgICAgICAgIGNvbnN0IF9UcCBfX3FuZXcgPSAoX19xMSAtIF9fYiAqIF9fcTIpIC8gX19hOworICAgICAgICAgICAgICBfX3ExID0gX19xMjsKKyAgICAgICAgICAgICAgX19xMiA9IF9fcW5ldzsKKyAgICAgICAgICAgICAgX19xICs9IF9fYyAqIF9fcW5ldzsKKyAgICAgICAgICAgICAgX19iICs9IF9UcCgyKTsKKyAgICAgICAgICAgICAgX19kID0gX1RwKDEpIC8gKF9fYiArIF9fYSAqIF9fZCk7CisgICAgICAgICAgICAgIF9fZGVsaCA9IChfX2IgKiBfX2QgLSBfVHAoMSkpICogX19kZWxoOworICAgICAgICAgICAgICBfX2ggKz0gX19kZWxoOworICAgICAgICAgICAgICBjb25zdCBfVHAgX19kZWxzID0gX19xICogX19kZWxoOworICAgICAgICAgICAgICBfX3MgKz0gX19kZWxzOworICAgICAgICAgICAgICBpZiAoIHN0ZDo6YWJzKF9fZGVscyAvIF9fcykgPCBfX2VwcyApCisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgaWYgKF9faSA+IF9fbWF4X2l0ZXIpCisgICAgICAgICAgICBzdGQ6Ol9fdGhyb3dfcnVudGltZV9lcnJvcihfX04oIlN0ZWVkJ3MgbWV0aG9kIGZhaWxlZCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fYmVzc2VsX2puLiIpKTsKKyAgICAgICAgICBfX2ggPSBfX2ExICogX19oOworICAgICAgICAgIF9fS211ID0gc3RkOjpzcXJ0KF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpIC8gKF9UcCgyKSAqIF9feCkpCisgICAgICAgICAgICAgICAgKiBzdGQ6OmV4cCgtX194KSAvIF9fczsKKyAgICAgICAgICBfX0tudTEgPSBfX0ttdSAqIChfX211ICsgX194ICsgX1RwKDAuNUwpIC0gX19oKSAqIF9feGk7CisgICAgICAgIH0KKworICAgICAgX1RwIF9fS3BtdSA9IF9fbXUgKiBfX3hpICogX19LbXUgLSBfX0tudTE7CisgICAgICBfVHAgX19JbnVtdSA9IF9feGkgLyAoX19mICogX19LbXUgLSBfX0twbXUpOworICAgICAgX19JbnUgPSBfX0ludW11ICogX19JbnVsMSAvIF9fSW51bDsKKyAgICAgIF9fSXBudSA9IF9fSW51bXUgKiBfX0lwbnUxIC8gX19JbnVsOworICAgICAgZm9yICggX19pID0gMTsgX19pIDw9IF9fbmw7ICsrX19pICkKKyAgICAgICAgeworICAgICAgICAgIGNvbnN0IF9UcCBfX0tudXRlbXAgPSAoX19tdSArIF9faSkgKiBfX3hpMiAqIF9fS251MSArIF9fS211OworICAgICAgICAgIF9fS211ID0gX19LbnUxOworICAgICAgICAgIF9fS251MSA9IF9fS251dGVtcDsKKyAgICAgICAgfQorICAgICAgX19LbnUgPSBfX0ttdTsKKyAgICAgIF9fS3BudSA9IF9fbnUgKiBfX3hpICogX19LbXUgLSBfX0tudTE7CisgIAorICAgICAgcmV0dXJuOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIFJldHVybiB0aGUgcmVndWxhciBtb2RpZmllZCBCZXNzZWwgZnVuY3Rpb24gb2Ygb3JkZXIKKyAgICAgKiAgICAgICAgICAgXGYkIFxudSBcZiQ6IFxmJCBJX3tcbnV9KHgpIFxmJC4KKyAgICAgKgorICAgICAqICAgVGhlIHJlZ3VsYXIgbW9kaWZpZWQgY3lsaW5kcmljYWwgQmVzc2VsIGZ1bmN0aW9uIGlzOgorICAgICAqICAgQGZbCisgICAgICogICAgSV97XG51fSh4KSA9IFxzdW1fe2s9MH1ee1xpbmZ0eX0KKyAgICAgKiAgICAgICAgICAgICAgXGZyYWN7KHgvMilee1xudSArIDJrfX17ayFcR2FtbWEoXG51K2srMSl9CisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgQHBhcmFtICBfX251ICBUaGUgb3JkZXIgb2YgdGhlIHJlZ3VsYXIgbW9kaWZpZWQgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX3ggICBUaGUgYXJndW1lbnQgb2YgdGhlIHJlZ3VsYXIgbW9kaWZpZWQgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHJldHVybiAgVGhlIG91dHB1dCByZWd1bGFyIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19jeWxfYmVzc2VsX2koY29uc3QgX1RwIF9fbnUsIGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9fbnUgPCBfVHAoMCkgfHwgX194IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fY3lsX2Jlc3NlbF9pLiIpKTsKKyAgICAgIGVsc2UgaWYgKF9faXNuYW4oX19udSkgfHwgX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKF9feCAqIF9feCA8IF9UcCgxMCkgKiAoX19udSArIF9UcCgxKSkpCisgICAgICAgIHJldHVybiBfX2N5bF9iZXNzZWxfaWpfc2VyaWVzKF9fbnUsIF9feCwgK19UcCgxKSwgMjAwKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0lfbnUsIF9fS19udSwgX19JcF9udSwgX19LcF9udTsKKyAgICAgICAgICBfX2Jlc3NlbF9payhfX251LCBfX3gsIF9fSV9udSwgX19LX251LCBfX0lwX251LCBfX0twX251KTsKKyAgICAgICAgICByZXR1cm4gX19JX251OworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBpcnJlZ3VsYXIgbW9kaWZpZWQgQmVzc2VsIGZ1bmN0aW9uCisgICAgICogICAgICAgICAgIFxmJCBLX3tcbnV9KHgpIFxmJCBvZiBvcmRlciBcZiQgXG51IFxmJC4KKyAgICAgKgorICAgICAqICAgVGhlIGlycmVndWxhciBtb2RpZmllZCBCZXNzZWwgZnVuY3Rpb24gaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgS197XG51fSh4KSA9IFxmcmFje1xwaX17Mn0KKyAgICAgKiAgICAgICAgICAgICAgICAgICBcZnJhY3tJX3stXG51fSh4KSAtIElfe1xudX0oeCl9e1xzaW4gXG51XHBpfQorICAgICAqICAgQGZdCisgICAgICogICB3aGVyZSBmb3IgaW50ZWdyYWwgXGYkIFxudSA9IG4gXGYkIGEgbGltaXQgaXMgdGFrZW46CisgICAgICogICBcZiQgbGltX3tcbnUgXHRvIG59IFxmJC4KKyAgICAgKgorICAgICAqICAgQHBhcmFtICBfX251ICBUaGUgb3JkZXIgb2YgdGhlIGlycmVndWxhciBtb2RpZmllZCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgIFRoZSBhcmd1bWVudCBvZiB0aGUgaXJyZWd1bGFyIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gIFRoZSBvdXRwdXQgaXJyZWd1bGFyIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19jeWxfYmVzc2VsX2soY29uc3QgX1RwIF9fbnUsIGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgaWYgKF9fbnUgPCBfVHAoMCkgfHwgX194IDwgX1RwKDApKQorICAgICAgICBzdGQ6Ol9fdGhyb3dfZG9tYWluX2Vycm9yKF9fTigiQmFkIGFyZ3VtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluIF9fY3lsX2Jlc3NlbF9rLiIpKTsKKyAgICAgIGVsc2UgaWYgKF9faXNuYW4oX19udSkgfHwgX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0lfbnUsIF9fS19udSwgX19JcF9udSwgX19LcF9udTsKKyAgICAgICAgICBfX2Jlc3NlbF9payhfX251LCBfX3gsIF9fSV9udSwgX19LX251LCBfX0lwX251LCBfX0twX251KTsKKyAgICAgICAgICByZXR1cm4gX19LX251OworICAgICAgICB9CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgQ29tcHV0ZSB0aGUgc3BoZXJpY2FsIG1vZGlmaWVkIEJlc3NlbCBmdW5jdGlvbnMKKyAgICAgKiAgICAgICAgICAgQGYkIGlfbih4KSBAZiQgYW5kIEBmJCBrX24oeCkgQGYkIGFuZCB0aGVpciBmaXJzdAorICAgICAqICAgICAgICAgICBkZXJpdmF0aXZlcyBAZiQgaSdfbih4KSBAZiQgYW5kIEBmJCBrJ19uKHgpIEBmJAorICAgICAqICAgICAgICAgICByZXNwZWN0aXZlbHkuCisgICAgICoKKyAgICAgKiAgIEBwYXJhbSAgX19uICBUaGUgb3JkZXIgb2YgdGhlIG1vZGlmaWVkIHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9feCAgVGhlIGFyZ3VtZW50IG9mIHRoZSBtb2RpZmllZCBzcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX2lfbiAgVGhlIG91dHB1dCByZWd1bGFyIG1vZGlmaWVkIHNwaGVyaWNhbCBCZXNzZWwgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gIF9fa19uICBUaGUgb3V0cHV0IGlycmVndWxhciBtb2RpZmllZCBzcGhlcmljYWwKKyAgICAgKiAgICAgICAgICAgICAgICAgIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSAgX19pcF9uICBUaGUgb3V0cHV0IGRlcml2YXRpdmUgb2YgdGhlIHJlZ3VsYXIgbW9kaWZpZWQKKyAgICAgKiAgICAgICAgICAgICAgICAgICBzcGhlcmljYWwgQmVzc2VsIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtICBfX2twX24gIFRoZSBvdXRwdXQgZGVyaXZhdGl2ZSBvZiB0aGUgaXJyZWd1bGFyIG1vZGlmaWVkCisgICAgICogICAgICAgICAgICAgICAgICAgc3BoZXJpY2FsIEJlc3NlbCBmdW5jdGlvbi4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX1RwPgorICAgIHZvaWQKKyAgICBfX3NwaF9iZXNzZWxfaWsoY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCwKKyAgICAgICAgICAgICAgICAgICAgX1RwICYgX19pX24sIF9UcCAmIF9fa19uLCBfVHAgJiBfX2lwX24sIF9UcCAmIF9fa3BfbikKKyAgICB7CisgICAgICBjb25zdCBfVHAgX19udSA9IF9UcChfX24pICsgX1RwKDAuNUwpOworCisgICAgICBfVHAgX19JX251LCBfX0lwX251LCBfX0tfbnUsIF9fS3BfbnU7CisgICAgICBfX2Jlc3NlbF9payhfX251LCBfX3gsIF9fSV9udSwgX19LX251LCBfX0lwX251LCBfX0twX251KTsKKworICAgICAgY29uc3QgX1RwIF9fZmFjdG9yID0gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3NxcnRwaW8yKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAvIHN0ZDo6c3FydChfX3gpOworCisgICAgICBfX2lfbiA9IF9fZmFjdG9yICogX19JX251OworICAgICAgX19rX24gPSBfX2ZhY3RvciAqIF9fS19udTsKKyAgICAgIF9faXBfbiA9IF9fZmFjdG9yICogX19JcF9udSAtIF9faV9uIC8gKF9UcCgyKSAqIF9feCk7CisgICAgICBfX2twX24gPSBfX2ZhY3RvciAqIF9fS3BfbnUgLSBfX2tfbiAvIChfVHAoMikgKiBfX3gpOworCisgICAgICByZXR1cm47CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBic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ICogX19hYnN4ICogX19yb290eCAvIF9UcCgzKTsKKworICAgICAgaWYgKF9faXNuYW4oX194KSkKKyAgICAgICAgcmV0dXJuIHN0ZDo6bnVtZXJpY19saW1pdHM8X1RwPjo6cXVpZXRfTmFOKCk7CisgICAgICBlbHNlIGlmIChfX3ggPiBfVHAoMCkpCisgICAgICAgIHsKKyAgICAgICAgICBfVHAgX19JX251LCBfX0lwX251LCBfX0tfbnUsIF9fS3BfbnU7CisKKyAgICAgICAgICBfX2Jlc3NlbF9payhfVHAoMSkgLyBfVHAoMyksIF9feiwgX19JX251LCBfX0tfbnUsIF9fSXBfbnUsIF9fS3BfbnUpOworICAgICAgICAgIF9fQWkgPSBfX3Jvb3R4ICogX19LX251CisgICAgICAgICAgICAgICAvIChfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fc3FydDMoKQorICAgICAgICAgICAgICAgICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCkpOworICAgICAgICAgIF9fQmkgPSBfX3Jvb3R4ICogKF9fS19udSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpCisgICAgICAgICAgICAgICAgICsgX1RwKDIpICogX19JX251IC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3NxcnQzKCkpOworCisgICAgICAgICAgX19iZXNzZWxfaWsoX1RwKDIpIC8gX1RwKDMpLCBfX3osIF9fSV9udSwgX19LX251LCBfX0lwX251LCBfX0twX251KTsKKyAgICAgICAgICBfX0FpcCA9IC1fX3ggKiBfX0tfbnUKKyAgICAgICAgICAgICAgICAvIChfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fc3FydDMoKQorICAgICAgICAgICAgICAgICAqIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpKTsKKyAgICAgICAgICBfX0JpcCA9IF9feCAqIChfX0tfbnUgLyBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKQorICAgICAgICAgICAgICAgICAgICAgICsgX1RwKDIpICogX19JX251CisgICAgICAgICAgICAgICAgICAgICAgLyBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fc3FydDMoKSk7CisgICAgICAgIH0KKyAgICAgIGVsc2UgaWYgKF9feCA8IF9UcCgwKSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX0pfbnUsIF9fSnBfbnUsIF9fTl9udSwgX19OcF9udTsKKworICAgICAgICAgIF9fYmVzc2VsX2puKF9UcCgxKSAvIF9UcCgzKSwgX196LCBfX0pfbnUsIF9fTl9udSwgX19KcF9udSwgX19OcF9udSk7CisgICAgICAgICAgX19BaSA9IF9fcm9vdHggKiAoX19KX251CisgICAgICAgICAgICAgICAgICAgIC0gX19OX251IC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3NxcnQzKCkpIC8gX1RwKDIpOworICAgICAgICAgIF9fQmkgPSAtX19yb290eCAqIChfX05fbnUKKyAgICAgICAgICAgICAgICAgICAgKyBfX0pfbnUgLyBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fc3FydDMoKSkgLyBfVHAoMik7CisKKyAgICAgICAgICBfX2Jlc3NlbF9qbihfVHAoMikgLyBfVHAoMyksIF9feiwgX19KX251LCBfX05fbnUsIF9fSnBfbnUsIF9fTnBfbnUpOworICAgICAgICAgIF9fQWlwID0gX19hYnN4ICogKF9fTl9udSAvIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19zcXJ0MygpCisgICAgICAgICAgICAgICAgICAgICAgICAgICsgX19KX251KSAvIF9UcCgyKTsKKyAgICAgICAgICBfX0JpcCA9IF9fYWJzeCAqIChfX0pfbnUgLyBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fc3FydDMoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAtIF9fTl9udSkgLyBfVHAoMik7CisgICAgICAgIH0KKyAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgIC8vICBSZWZlcmVuY2U6CisgICAgICAg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G9seW5vbWlhbCBvZiBvcmRlciBuCisgICAgICogICAgICAgICAgIGFuZCBhcmd1bWVudCB4LgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3BvbHlfaGVybWl0ZV9yZWN1cnNpb24oY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwIF9feCkKKyAgICB7CisgICAgICAvLyAgQ29tcHV0ZSBIXzAuCisgICAgICBfVHAgX19IXzAgPSAxOworICAgICAgaWYgKF9fbiA9PSAwKQorICAgICAgICByZXR1cm4gX19IXzA7CisKKyAgICAgIC8vICBDb21wdXRlIEhfMS4KKyAgICAgIF9UcCBfX0hfMSA9IDIgKiBfX3g7CisgICAgICBpZiAoX19uID09IDEpCisgICAgICAgIHJldHVybiBfX0hfMTsKKworICAgICAgLy8gIENvbXB1dGUgSF9uLgorICAgICAgX1RwIF9fSF9uLCBfX0hfbm0xLCBfX0hfbm0yOworICAgICAgdW5zaWduZWQgaW50IF9faTsKKyAgICAgIGZvciAgKF9fSF9ubTIgPSBfX0hfMCwgX19IX25tMSA9IF9fSF8xLCBfX2kgPSAyOyBfX2kgPD0gX19uOyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIF9fSF9uID0gMiAqIChfX3ggKiBfX0hfbm0xIC0gKF9faSAtIDEpICogX19IX25tMik7CisgICAgICAgICAgX19IX25tMiA9IF9fSF9ubTE7CisgICAgICAgICAgX19IX25tMSA9IF9fSF9uOworICAgICAgICB9CisKKyAgICAgIHJldHVybiBfX0hfbjsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFRoaXMgcm91dGluZSByZXR1cm5zIHRoZSBIZXJtaXRlIHBvbHlub21pYWwKKyAgICAgKiAgICAgICAgICBvZiBvcmRlciBuOiBcZiQgSF9uKHgpIFxmJC4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBIZXJtaXRlIHBvbHlub21pYWwgaXMgZGVmaW5lZCBie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Y3Rpb24uCisgICAgICogICBAcGFyYW0gX194IFRoZSBhcmd1bWVudCBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuIFRoZSB2YWx1ZSBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24gb2Ygb3JkZXIgbiwKKyAgICAgKiAgICAgICAgICAgZGVncmVlIEBmJCBcYWxwaGEgQGYkLCBhbmQgYXJndW1lbnQgeC4KKyAgICAgKgorICAgICAqICBUaGlzIGlzIGZyb20gdGhlIEdOVSBTY2llbnRpZmljIExpYnJhcnkuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwYSwgdHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fcG9seV9sYWd1ZXJyZV9sYXJnZV9uKGNvbnN0IHVuc2lnbmVkIF9fbiwgY29uc3QgX1RwYSBfX2FscGhhMSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGNvbnN0IF9UcCBfX2EgPSAtX1RwKF9fbik7CisgICAgICBjb25zdCBfVHAgX19iID0gX1RwKF9fYWxwaGExKSArIF9UcCgxKTsKKyAgICAgIGNvbnN0IF9UcCBfX2V0YSA9IF9UcCgyKSAqIF9fYiAtIF9UcCg0KSAqIF9fYTsKKyAgICAgIGNvbnN0IF9UcCBfX2NvczJ0aCA9IF9feCAvIF9fZXRhOworICAgICAgY29uc3QgX1RwIF9fc2luMnRoID0gX1RwKDEpIC0gX19jb3MydGg7CisgICAgICBjb25zdCBfVHAgX190aCA9IHN0ZDo6YWNvcyhzdGQ6OnNxcnQoX19jb3MydGgpKTsKKyAgICAgIGNvbnN0IF9UcCBfX3ByZV9oID0gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpXzIoKQorICAgICAgICAgICAgICAgICAgICAgICAgKiBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGlfMigpCisgICAgICAgICAgICAgICAgICAgICAgICAqIF9fZXRhICogX19ldGEgKiBfX2NvczJ0aCAqIF9fc2luMnRoOworCisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgY29uc3QgX1RwIF9fbGdfYiA9IHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKF9fbikgKyBfX2IpOworICAgICAgY29uc3QgX1RwIF9fbG5mYWN0ID0gc3RkOjp0cjE6OmxnYW1tYShfVHAoX19uICsgMSkpOworI2Vsc2UKKyAgICAgIGNvbnN0IF9UcCBfX2xnX2IgPSBfX2xvZ19nYW1tYShfVHAoX19uKSArIF9fYik7CisgICAgICBjb25zdCBfVHAgX19sbmZhY3QgPSBfX2xvZ19nYW1tYShfVHAoX19uICsgMSkpOworI2VuZGlmCisKKyAgICAgIF9UcCBfX3ByZV90ZXJtMSA9IF9UcCgwLjVMKSAqIChfVHAoMSkgLSBfX2IpCisgICAgICAgICAgICAgICAgICAgICAgKiBzdGQ6OmxvZyhfVHAoMC4yNUwpICogX194ICogX19ldGEpOworICAgICAgX1RwIF9fcHJlX3Rlcm0yID0gX1RwKDAuMjVMKSAqIHN0ZDo6bG9nKF9fcHJlX2gpOworICAgICAgX1RwIF9fbG5wcmUgPSBfX2xnX2IgLSBfX2xuZmFjdCArIF9UcCgwLjVMKSAqIF9feAorICAgICAgICAgICAgICAgICAgICAgICsgX19wcmVfdGVybTEgLSBfX3ByZV90ZXJtMjsKKyAgICAgIF9UcCBfX3Nlcl90ZXJtMSA9IHN0ZDo6c2luKF9fYSAqIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpKTsKKyAgICAgIF9UcCBfX3Nlcl90ZXJtMiA9IHN0ZDo6c2luKF9UcCgwLjI1TCkgKiBfX2V0YQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiAoX1RwKDIpICogX190aAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc3RkOjpzaW4oX1RwKDIpICogX190aCkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGlfNCgpKTsKKyAgICAgIF9UcCBfX3NlciA9IF9fc2VyX3Rlcm0xICsgX19zZXJfdGVybTI7CisKKyAgICAgIHJldHVybiBzdGQ6OmV4cChfX2xucHJlKSAqIF9fc2VyOworICAgIH0KKworCisgICAgLyoqCisgICAgICogIEBicmllZiAgRXZhbHVhdGUgdGhlIHBvbHlub21pYWwgYmFzZWQgb24gdGhlIGNvbmZsdWVudCBoeXBlcmdlb21ldHJpYworICAgICAqICAgICAgICAgIGZ1bmN0aW9uIGluIGEgc2FmZSB3YXksIHdpdGggbm8gcmVzdHJpY3Rpb24gb24gdGhlIGFyZ3VtZW50cy4KKyAgICAgKgorICAgICAqICAgVGhlIGFzc29jaWF0ZWQgTGFndWVycmUgZnVuY3Rpb24gaXMgZGVmaW5lZCBieQorICAgICAqICAgQGZbCisgICAgICogICAgICAgTF9uXlxhbHBoYSh4KSA9IFxmcmFjeyhcYWxwaGEgKyAxKV9ufXtuIX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgXzFGXzEoLW47IFxhbHBoYSArIDE7IHgpCisgICAgICogICBAZl0KKyAgICAgKiAgIHdoZXJlIEBmJCAoXGFscGhhKV9uIEBmJCBpcyB0aGUgUG9jaGhhbW1lciBzeW1ib2wgYW5kCisgICAgICogICBAZiQgXzFGXzEoYTsgYzsgeCkgQGYkIGlzIHRoZSBjb25mbHVlbnQgaHlwZXJnZW9tZXRyaWMgZnVuY3Rpb24uCisgICAgICoKKyAgICAgKiAgVGhpcyBmdW5jdGlvbiBhc3N1bWVzIHggIT0gMC4KKyAgICAgKgorICAgICAqICBUaGlzIGlzIGZyb20gdGhlIEdOVSBTY2llbnRpZmljIExpYnJhcnkuCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwYSwgdHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fcG9seV9sYWd1ZXJyZV9oeXBlcmcoY29uc3QgdW5zaWduZWQgaW50IF9fbiwgY29uc3QgX1RwYSBfX2FscGhhMSwKKwkJCSAgIGNvbnN0IF9UcCBfX3gpCisgICAgeworICAgICAgY29uc3QgX1RwIF9fYiA9IF9UcChfX2FscGhhMSkgKyBfVHAoMSk7CisgICAgICBjb25zdCBfVHAgX19teCA9IC1fX3g7CisgICAgICBjb25zdCBfVHAgX190Y19zZ24gPSAoX194IDwgX1RwKDApID8gX1RwKDEpCisgICAgICAgICAgICAgICAgICAgICAgICAgOiAoKF9fbiAlIDIgPT0gMSkgPyAtX1RwKDEpIDogX1RwKDEpKSk7CisgICAgICAvLyAgR2V0IHx4fF5uL24hCisgICAgICBfVHAgX190YyA9IF9UcCgxKTsKKyAgICAgIGNvbnN0IF9UcCBfX2F4ID0gc3RkOjphYnMoX194KTsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9fayA9IDE7IF9fayA8PSBfX247ICsrX19rKQorICAgICAgICBfX3RjICo9IChfX2F4IC8gX19rKTsKKworICAgICAgX1RwIF9fdGVybSA9IF9fdGMgKiBfX3RjX3NnbjsKKyAgICAgIF9UcCBfX3N1bSA9IF9fdGVybTsKKyAgICAgIGZvciAoaW50IF9fayA9IGludChfX24pIC0gMTsgX19rID49IDA7IC0tX19rKQorICAgICAgICB7CisgICAgICAgICAgX190ZXJtICo9ICgoX19iICsgX1RwKF9faykpIC8gX1RwKGludChfX24pIC0gX19rKSkKKyAgICAgICAgICAgICAgICAgICogX1RwKF9fayArIDEpIC8gX19teDsKKyAgICAgICAgICBfX3N1bSArPSBfX3Rlcm07CisgICAgICAgIH0KKworICAgICAgcmV0dXJuIF9fc3VtOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgVGhpcyByb3V0aW5lIHJldHVybnMgdGhlIGFzc29jaWF0ZWQgTGFndWVycmUgcG9seW5vbWlhbCAKKyAgICAgKiAgICAgICAgICBvZiBvcmRlciBAZiQgbiBAZiQsIGRlZ3JlZSBAZiQgXGFscGhhIEBmJDogQGYkIExfbl5cYWxwaGEoeCkgQGYkCisgICAgICogICAgICAgICAgYnkgcmVjdXJzaW9uLgorICAgICAqCisgICAgICogICBUaGUgYXNzb2NpYXRlZCBMYWd1ZXJyZSBmdW5jdGlvbiBpcyBkZWZpbmVkIGJ5CisgICAgICogICBAZlsKKyAgICAgKiAgICAgICBMX25eXGFscGhhKHgpID0gXGZyYWN7KFxhbHBoYSArIDEpX259e24hfQorICAgICAqICAgICAgICAgICAgICAgICAgICAgICBfMUZfMSgtbjsgXGFscGhhICsgMTsgeCkKKyAgICAgKiAgIEBmXQorICAgICAqICAgd2hlcmUgQGYkIChcYWxwaGEpX24gQGYkIGlzIHRoZSBQb2NoaGFtbWVyIHN5bWJvbCBhbmQKKyAgICAgKiAgIEBmJCBfMUZfMShhOyBjOyB4KSBAZiQgaXMgdGhlIGNvbmZsdWVudCBoeXBlcmdlb21ldHJpYyBmdW5jdGlvbi4KKyAgICAgKgorICAgICAqICAgVGhlIGFzc29jaWF0ZWQgTGFndWVycmUgcG9seW5vbWlhbCBpcyBkZWZpbmVkIGZvciBpbnRlZ3JhbAorICAgICAqICAgQGYkIFxhbHBoYSA9IG0gQGYkIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICAgICAgTF9uXm0oeCkgPSAoLTEpXm0gXGZyYWN7ZF5tfXtkeF5tfSBMX3tuICsgbX0oeCkKKyAgICAgKiAgIEBmXQorICAgICAqICAgd2hlcmUgdGhlIExhZ3VlcnJlIHBvbHlub21pYWwgaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIExfbih4KSA9IFxmcmFje2VeeH17biF9IFxmcmFje2Rebn17ZHhebn0gKHhebmVeey14fSkKKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gX19uIFRoZSBvcmRlciBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gX19hbHBoYSBUaGUgZGVncmVlIG9mIHRoZSBMYWd1ZXJyZSBmdW5jdGlvbi4KKyAgICAgKiAgIEBwYXJhbSBfX3ggVGhlIGFyZ3VtZW50IG9mIHRoZSBMYWd1ZXJyZSBmdW5jdGlvbi4KKyAgICAgKiAgIEByZXR1cm4gVGhlIHZhbHVlIG9mIHRoZSBMYWd1ZXJyZSBmdW5jdGlvbiBvZiBvcmRlciBuLAorICAgICAqICAgICAgICAgICBkZWdyZWUgQGYkIFxhbHBoYSBAZiQsIGFuZCBhcmd1bWVudCB4LgorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcGEsIHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3BvbHlfbGFndWVycmVfcmVjdXJzaW9uKGNvbnN0IHVuc2lnbmVkIGludCBfX24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfVHBhIF9fYWxwaGExLCBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIC8vICAgQ29tcHV0ZSBsXzAuCisgICAgICBfVHAgX19sXzAgPSBfVHAoMSk7CisgICAgICBpZiAgKF9fbiA9PSAwKQorICAgICAgICByZXR1cm4gX19sXzA7CisKKyAgICAgIC8vICBDb21wdXRlIGxfMV5hbHBoYS4KKyAgICAgIF9UcCBfX2xfMSA9IC1fX3ggKyBfVHAoMSkgKyBfVHAoX19hbHBoYTEpOworICAgICAgaWYgIChfX24gPT0gMSkKKyAgICAgICAgcmV0dXJuIF9fbF8xOworCisgICAgICAvLyAgQ29tcHV0ZSBsX25eYWxwaGEgYnkgcmVjdXJzaW9uIG9uIG4uCisgICAgICBfVHAgX19sX24yID0gX19sXzA7CisgICAgICBfVHAgX19sX24xID0gX19sXzE7CisgICAgICBfVHAgX19sX24gPSBfVHAoMCk7CisgICAgICBmb3IgICh1bnNpZ25lZCBpbnQgX19ubiA9IDI7IF9fbm4gPD0gX19uOyArK19fbm4pCisgICAgICAgIHsKKyAgICAgICAgICAgIF9fbF9uID0gKF9UcCgyICogX19ubiAtIDEpICsgX1RwKF9fYWxwaGExKSAtIF9feCkKKyAgICAgICAgICAgICAgICAgICogX19sX24xIC8gX1RwKF9fbm4pCisgICAgICAgICAgICAgICAgICAtIChfVHAoX19ubiAtIDEpICsgX1RwKF9fYWxwaGExKSkgKiBfX2xfbjIgLyBfVHAoX19ubik7CisgICAgICAgICAgICBfX2xfbjIgPSBfX2xfbjE7CisgICAgICAgICAgICBfX2xfbjEgPSBfX2xfbjsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gX19sX247CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiBUaGlzIHJvdXRpbmUgcmV0dXJucyB0aGUgYXNzb2NpYXRlZCBMYWd1ZXJyZSBwb2x5bm9taWFsCisgICAgICogICAgICAgICAgb2Ygb3JkZXIgbiwgZGVncmVlIEBmJCBcYWxwaGEgQGYkOiBAZiQgTF9uXmFscGhhKHgpIEBmJC4KKyAgICAgKgorICAgICAqICAgVGhlIGFzc29jaWF0ZWQgTGFndWVycmUgZnVuY3Rpb24gaXMgZGVmaW5lZCBieQorICAgICAqICAgQGZbCisgICAgICogICAgICAgTF9uXlxhbHBoYSh4KSA9IFxmcmFjeyhcYWxwaGEgKyAxKV9ufXtuIX0KKyAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgXzFGXzEoLW47IFxhbHBoYSArIDE7IHgpCisgICAgICogICBAZl0KKyAgICAgKiAgIHdoZXJlIEBmJCAoXGFscGhhKV9uIEBmJCBpcyB0aGUgUG9jaGhhbW1lciBzeW1ib2wgYW5kCisgICAgICogICBAZiQgXzFGXzEoYTsgYzsgeCkgQGYkIGlzIHRoZSBjb25mbHVlbnQgaHlwZXJnZW9tZXRyaWMgZnVuY3Rpb24uCisgICAgICoKKyAgICAgKiAgIFRoZSBhc3NvY2lhdGVkIExhZ3VlcnJlIHBvbHlub21pYWwgaXMgZGVmaW5lZCBmb3IgaW50ZWdyYWwKKyAgICAgKiAgIEBmJCBcYWxwaGEgPSBtIEBmJCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIExfbl5tKHgpID0gKC0xKV5tIFxmcmFje2RebX17ZHhebX0gTF97biArIG19KHgpCisgICAgICogICBAZl0KKyAgICAgKiAgIHdoZXJlIHRoZSBMYWd1ZXJyZSBwb2x5bm9taWFsIGlzIGRlZmluZWQgYnk6CisgICAgICogICBAZlsKKyAgICAgKiAgICAgICBMX24oeCkgPSBcZnJhY3tlXnh9e24hfSBcZnJhY3tkXm59e2R4Xm59ICh4Xm5lXnsteH0pCisgICAgICogICBAZl0KKyAgICAgKgorICAgICAqICAgQHBhcmFtIF9fbiBUaGUgb3JkZXIgb2YgdGhlIExhZ3VlcnJlIGZ1bmN0aW9uLgorICAgICAqICAgQHBhcmFtIF9fYWxwaGEgVGhlIGRlZ3JlZSBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24uCisgICAgICogICBAcGFyYW0gX194IFRoZSBhcmd1bWVudCBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24uCisgICAgICogICBAcmV0dXJuIFRoZSB2YWx1ZSBvZiB0aGUgTGFndWVycmUgZnVuY3Rpb24gb2Ygb3JkZXIgbiwKKyAgICAgKiAgICAgICAgICAgZGVncmVlIEBmJCBcYWxwaGEgQGYkLCBhbmQgYXJndW1lbnQgeC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHBhLCB0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9UcAorICAgIF9fcG9seV9sYWd1ZXJyZShjb25zdCB1bnNpZ25lZCBpbnQgX19uLCBjb25zdCBfVHBhIF9fYWxwaGExLAorICAgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIGlmIChfX3ggPCBfVHAoMCkpCisgICAgICAgIHN0ZDo6X190aHJvd19kb21haW5fZXJyb3IoX19OKCJOZWdhdGl2ZSBhcmd1bWVudCAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbiBfX3BvbHlfbGFndWVycmUuIikpOworICAgICAgLy8gIFJldHVybiBOYU4gb24gTmFOIGlucHV0LgorICAgICAgZWxzZSBpZiAoX19pc25hbihfX3gpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKF9fbiA9PSAwKQorICAgICAgICByZXR1cm4gX1RwKDEpOworICAgICAgZWxzZSBpZiAoX19uID09IDEpCisgICAgICAgIHJldHVybiBfVHAoMSkgKyBfVHAoX19hbHBoYTEpIC0gX194OworICAgICAgZWxzZSBpZiAoX194ID09IF9UcCgwKSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3Byb2QgPSBfVHAoX19hbHBoYTEpICsgX1RwKDEpOworICAgICAgICAgIGZvciAodW5zaWduZWQgaW50IF9fayA9IDI7IF9fayA8PSBfX247ICsrX19rKQorICAgICAgICAgICAgX19wcm9kICo9IChfVHAoX19hbHBoYTEpICsgX1RwKF9faykpIC8gX1RwKF9fayk7CisgICAgICAgICAgcmV0dXJuIF9fcHJvZDsKKyAgICAgICAgfQorICAgICAgZWxzZSBpZiAoX19uID4gMTAwMDAwMDAgJiYgX1RwKF9fYWxwaGExKSA+IC1fVHAoMSkKKyAgICAgICAgICAgICYmIF9feCA8IF9UcCgyKSAqIChfVHAoX19hbHBoYTEpICsgX1RwKDEpKSArIF9UcCg0ICogX19uKSkKKyAgICAgICAgcmV0dXJuIF9fcG9seV9sYWd1ZXJyZV9sYXJnZV9uKF9fbiwgX19hbHBoYTEsIF9feCk7CisgICAgICBlbHNlIGlmIChfVHAoX19hbHBoYTEpID49IF9UcCgwKQorICAgICAgICAgICB8fCAoX194ID4gX1RwKDApICYmIF9UcChfX2FscGhhMSkgPCAtX1RwKF9fbiArIDEpKSkKKyAgICAgICAgcmV0dXJuIF9fcG9seV9sYWd1ZXJyZV9yZWN1cnNpb24oX19uLCBfX2FscGhhMSwgX194KTsKKyAgICAgIGVsc2UKKyAgICAgICAgcmV0dXJuIF9fcG9seV9sYWd1ZXJyZV9oeXBlcmcoX19uLCBfX2FscGhhMSwgX194KTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmIFRoaXMgcm91dGluZSByZXR1cm5zIHRoZSBhc3NvY2lhdGVkIExhZ3VlcnJlIHBvbHlub21pYWwKKyAgICAgKiAgICAgICAgICBvZiBvcmRlciBuLCBkZWdyZWUgbTogQGYkIExfbl5tKHgpIEBmJC4KKyAgICAgKgorICAgICAqICAgVGhlIGFzc29jaWF0ZWQgTGFndWVycmUgcG9seW5vbWlhbCBpcyBkZWZpbmVkIGZvciBpbnRlZ3JhbAorICAgICAqICAgQGYkIFxhbHBoYSA9IG0gQGYkIGJ5OgorICAgICAqICAgQGZbCisgICAgICogICAgICAgTF9uXm0oeCkgPSAoLTEpXm0gXGZyYWN7ZF5tfXtkeF5tfSBMX3tuICsgbX0oeCkKKyAgICAgKiAgIEBmXQorICAgICAqICAgd2hlcmUgdGhlIExhZ3VlcnJlIHBvbHlub21pYWwgaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIExfbih4KSA9IFxmcmFje2VeeH17biF9IFxmcmFje2Rebn17ZHhebn0gKHhebmVeey14fSkKKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gX19uIFRoZSBvcmRlciBvZiB0aGUgTGFndWVycmUgcG9seW5vbWlhbC4KKyAgICAgKiAgIEBwYXJhbSBfX20gVGhlIGRlZ3JlZSBvZiB0aGUgTGFndWVycmUgcG9seW5vbWlhbC4KKyAgICAgKiAgIEBwYXJhbSBfX3ggVGhlIGFyZ3VtZW50IG9mIHRoZSBMYWd1ZXJyZSBwb2x5bm9taWFsLgorICAgICAqICAgQHJldHVybiBUaGUgdmFsdWUgb2YgdGhlIGFzc29jaWF0ZWQgTGFndWVycmUgcG9seW5vbWlhbCBvZiBvcmRlciBuLAorICAgICAqICAgICAgICAgICBkZWdyZWUgbSwgYW5kIGFyZ3VtZW50IHguCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfVHAKKyAgICBfX2Fzc29jX2xhZ3VlcnJlKGNvbnN0IHVuc2lnbmVkIGludCBfX24sIGNvbnN0IHVuc2lnbmVkIGludCBfX20sCisgICAgICAgICAgICAgICAgICAgICBjb25zdCBfVHAgX194KQorICAgIHsKKyAgICAgIHJldHVybiBfX3BvbHlfbGFndWVycmU8dW5zaWduZWQgaW50LCBfVHA+KF9fbiwgX19tLCBfX3gpOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgVGhpcyByb3V0aW5lIHJldHVybnMgdGhlIExhZ3VlcnJlIHBvbHlub21pYWwKKyAgICAgKiAgICAgICAgICBvZiBvcmRlciBuOiBAZiQgTF9uKHgpIEBmJC4KKyAgICAgKgorICAgICAqICAgVGhlIExhZ3VlcnJlIHBvbHlub21pYWwgaXMgZGVmaW5lZCBieToKKyAgICAgKiAgIEBmWworICAgICAqICAgICAgIExfbih4KSA9IFxmcmFje2VeeH17biF9IFxmcmFje2Rebn17ZHhebn0gKHhebmVeey14fSkKKyAgICAgKiAgIEBmXQorICAgICAqCisgICAgICogICBAcGFyYW0gX19uIFRoZSBvcmRlciBvZiB0aGUgTGFndWVycmUgcG9seW5vbWlhbC4KKyAgICAgKiAgIEBwYXJhbSBfX3ggVGhlIGFyZ3VtZW50IG9mIHRoZSBMYWd1ZXJyZSBwb2x5bm9taWFsLgorICAgICAqICAgQHJldHVybiBUaGUgdmFsdWUgb2YgdGhlIExhZ3VlcnJlIHBvbHlub21pYWwgb2Ygb3JkZXIgbgorICAgICAqICAgICAgICAgICBhbmQgYXJndW1lbnQgeC4KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgaW5saW5lIF9UcAorICAgIF9fbGFndWVycmUoY29uc3QgdW5zaWduZWQg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ChfX2Rpc3QpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIG5leHQgZ2VuZXJhdGVkIHZhbHVlIG9uIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCkKKyAgICAgIHsgcmV0dXJuIF9NX2Rpc3QoX01fZW5naW5lKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIFdURj8KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgICAgICByZXN1bHRfdHlwZQorICAgICAgICBvcGVyYXRvcigpKF9UcCBfX3ZhbHVlKQorICAgICAgICB7IHJldHVybiBfTV9kaXN0KF9NX2VuZ2luZSwgX192YWx1ZSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIGEgcmVmZXJlbmNlIHRvIHRoZSB1bmRlcmx5aW5nIHVuaWZvcm0gcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICAgICAqIG9iamVjdC4KKyAgICAgICAqLworICAgICAgZW5naW5lX3ZhbHVlX3R5cGUmCisgICAgICBlbmdpbmUoKQorICAgICAgeyByZXR1cm4gX01fZW5naW5lOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyBhIGNvbnN0IHJlZmVyZW5jZSB0byB0aGUgdW5kZXJseWluZyB1bmlmb3JtIHJhbmRvbSBudW1iZXIKKyAgICAgICAqIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGNvbnN0IGVuZ2luZV92YWx1ZV90eXBlJgorICAgICAgZW5naW5lKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2VuZ2luZTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgYSByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgcmFuZG9tIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgZGlzdHJpYnV0aW9uX3R5cGUmCisgICAgICBkaXN0cmlidXRpb24oKQorICAgICAgeyByZXR1cm4gX01fZGlzdDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgYSBjb25zdCByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgcmFuZG9tIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgY29uc3QgZGlzdHJpYnV0aW9uX3R5cGUmCisgICAgICBkaXN0cmlidXRpb24oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fZGlzdDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGNsb3NlZCBsb3dlciBib3VuZCBvZiB0aGUgZGlzdHJpYnV0aW9uIGludGVydmFsLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPmRpc3RyaWJ1dGlvbigpLm1pbigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgY2xvc2VkIHVwcGVyIGJvdW5kIG9mIHRoZSBkaXN0cmlidXRpb24gaW50ZXJ2YWwuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtYXgoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+ZGlzdHJpYnV0aW9uKCkubWF4KCk7IH0KKworICAgIHByaXZhdGU6CisgICAgICBlbmdpbmVfdmFsdWVfdHlwZSBfTV9lbmdpbmU7CisgICAgICBkaXN0cmlidXRpb25fdHlwZSBfTV9kaXN0OworICAgIH07CisKKworICAvKioKKyAgICogQGFkZHRvZ3JvdXAgdHIxX3JhbmRvbV9nZW5lcmF0b3JzIFJhbmRvbSBOdW1iZXIgR2VuZXJhdG9ycworICAgKiBAaW5ncm91cCB0cjFfcmFuZG9tCisgICAqCisgICAqIFRoZXNlIGNsYXNzZXMgZGVmaW5lIG9iamVjdHMgd2hpY2ggcHJvdmlkZSByYW5kb20gb3IgcHNldWRvcmFuZG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AgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIChfX2RldGFpbDo6X19tb2Q8X1VJbnRUeXBlLCAxLCAwLCBfX20+KF9fYykgPT0gMCkgPyAxIDogMDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGxhcmdlc3QgcG9zc2libGUgdmFsdWUgaW4gdGhlIG91dHB1dCByYW5nZS4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfX20gLSAxOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbmV4dCByYW5kb20gbnVtYmVyIGluIHRoZSBzZXF1ZW5jZS4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG9wZXJhdG9yKCkoKTsKKworICAgICAgLyoqCisgICAgICAgKiBDb21wYXJlcyB0d28gbGluZWFyIGNvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogb2JqZWN0cyBvZiB0aGUgc2FtZSB0eXBlIGZvciBlcXVhbGl0eS4KKyAgICAgICAqICAKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBIGxpbmVhciBjb25ncnVlbnRpYWwgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgbGluZWFyIGNvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmouCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgdHdvIG9iamVjdHMgYXJlIGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IGxpbmVhcl9jb25ncnVlbnRpYWwmIF9fbGhzLAorCQkgY29uc3QgbGluZWFyX2NvbmdydWVudGlhbCYgX19yaHMpCisgICAgICB7IHJldHVybiBfX2xocy5fTV94ID09IF9fcmhzLl9NX3g7IH0KKworICAgICAgLyoqCisgICAgICAgKiBDb21wYXJlcyB0d28gbGluZWFyIGNvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogb2JqZWN0cyBvZiB0aGUgc2FtZSB0eXBlIGZvciBpbmVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBIGxpbmVhciBjb25ncnVlbnRpYWwgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgbGluZWFyIGNvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmouCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgdHdvIG9iamVjdHMgYXJlIG5vdCBlcXVhbCwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgICovCisgICAgICBmcmllbmQgYm9vbAorICAgICAgb3BlcmF0b3IhPShjb25zdCBsaW5lYXJfY29uZ3J1ZW50aWFsJiBfX2xocywKKwkJIGNvbnN0IGxpbmVhcl9jb25ncnVlbnRpYWwmIF9fcmhzKQorICAgICAgeyByZXR1cm4gIShfX2xocyA9PSBfX3Jocyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBXcml0ZXMgdGhlIHRleHR1YWwgcmVwcmVzZW50YXRpb24gb2YgdGhlIHN0YXRlIHgoaSkgb2YgeCB0byBAcCBfX29zLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX29zICBUaGUgb3V0cHV0IHN0cmVhbS4KKyAgICAgICAqIEBwYXJhbSBfX2xjciBBICUgbGluZWFyX2NvbmdydWVudGlhbCByYW5kb20gbnVtYmVyIGdlbmVyYXRvci4KKyAgICAgICAqIEByZXR1cm5zIF9fb3MuCisgICAgICAgKi8KK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WJjeHhfY2xhc3NfcmVxdWlyZXMoX1VJbnRUeXBlLCBfVW5zaWduZWRJbnRlZ2VyQ29uY2VwdCkKKworICAgIHB1YmxpYzoKKyAgICAgIC8vIHR5cGVzCisgICAgICB0eXBlZGVmIF9VSW50VHlwZSByZXN1bHRfdHlwZTsKKworICAgICAgLy8gcGFyYW1ldGVyIHZhbHVlcworICAgICAgc3RhdGljIGNvbnN0IGludCAgICAgICB3b3JkX3NpemUgICA9IF9fdzsKKyAgICAgIHN0YXRpYyBjb25zdCBpbnQgICAgICAgc3RhdGVfc2l6ZSAgPSBfX247CisgICAgICBzdGF0aWMgY29uc3QgaW50ICAgICAgIHNoaWZ0X3NpemUgID0gX19tOworICAgICAgc3RhdGljIGNvbnN0IGludCAgICAgICBtYXNrX2JpdHMgICA9IF9fcjsKKyAgICAgIHN0YXRpYyBjb25zdCBfVUludFR5cGUgcGFyYW1ldGVyX2EgPSBfX2E7CisgICAgICBzdGF0aWMgY29uc3QgaW50ICAgICAgIG91dHB1dF91ICAgID0gX191OworICAgICAgc3RhdGljIGNvbnN0IGludCAgICAgICBvdXRwdXRfcyAgICA9IF9fczsKKyAgICAgIHN0YXRpYyBjb25zdCBfVUludFR5cGUgb3V0cHV0X2IgICAgPSBfX2I7CisgICAgICBzdGF0aWMgY29uc3QgaW50ICAgICAgIG91dHB1dF90ICAgID0gX190OworICAgICAgc3RhdGljIGNvbnN0IF9VSW50VHlwZSBvdXRwdXRfYyAgICA9IF9fYzsKKyAgICAgIHN0YXRpYyBjb25zdCBpbnQgICAgICAgb3V0cHV0X2wgICAgPSBfX2w7CisKKyAgICAgIC8vIGNvbnN0cnVjdG9ycyBhbmQgbWVtYmVyIGZ1bmN0aW9uCisgICAgICBtZXJzZW5uZV90d2lzdGVyKCkKKyAgICAgIHsgc2VlZCgpOyB9CisKKyAgICAgIGV4cGxpY2l0CisgICAgICBtZXJzZW5uZV90d2lzdGVyKHVuc2lnbmVkIGxvbmcgX192YWx1ZSkKKyAgICAg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AgICAgICAqICAgICAgICAgICAgICBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgdHdvIG9iamVjdHMgYXJlIGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IG1lcnNlbm5lX3R3aXN0ZXImIF9fbGhzLAorCQkgY29uc3QgbWVyc2VubmVfdHdpc3RlciYgX19yaHMpCisgICAgICB7IHJldHVybiBzdGQ6OmVxdWFsKF9fbGhzLl9NX3gsIF9fbGhzLl9NX3ggKyBzdGF0ZV9zaXplLCBfX3Jocy5fTV94KTsgfQorCisgICAgICAvKioKKyAgICAgICAqIENvbXBhcmVzIHR3byAlIG1lcnNlbm5lX3R3aXN0ZXIgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0cyBvZgorICAgICAgICogdGhlIHNhbWUgdHlwZSBmb3IgaW5lcXVhbGl0eS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19saHMgQSAlIG1lcnNlbm5lX3R3aXN0ZXIgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgJSBtZXJzZW5uZV90d2lzdGVyIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRydWUgaWYgdGhlIHR3byBvYmplY3RzIGFyZSBub3QgZXF1YWwsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAqLworICAgICAgZnJpZW5kIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3QgbWVyc2VubmVfdHdpc3RlciYgX19saHMsCisJCSBjb25zdCBtZXJzZW5uZV90d2lzdGVyJiBfX3JocykKKyAgICAgIHsgcmV0dXJuICEoX19saHMgPT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XQgY2FycnkgdG8gMSwgb3RoZXJ3aXNlIHNldHMgY2FycnkgdG8gMC4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgc2VlZCh1bnNpZ25lZCBsb25nIF9fdmFsdWUgPSAxOTc4MDUwMyk7CisKKyAgICAgIC8qKgorICAgICAgICogU2VlZHMgdGhlIGluaXRpYWwgc3RhdGUgQGYkIHhfMCBAZiQgb2YgdGhlICUgc3VidHJhY3Rfd2l0aF9jYXJyeQorICAgICAgICogcmFuZG9tIG51bWJlciBnZW5lcmF0b3IuCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9HZW4+CisgICAgICAgIHZvaWQKKyAgICAgICAgc2VlZChfR2VuJiBfX2cpCisgICAgICAgIHsgc2VlZChfX2csIHR5cGVuYW1lIGlzX2Z1bmRhbWVudGFsPF9HZW4+Ojp0eXBlKCkpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgaW5jbHVzaXZlIG1pbmltdW0gdmFsdWUgb2YgdGhlIHJhbmdlIG9mIHJhbmRvbSBpbnRlZ2VycworICAgICAgICogcmV0dXJuZWQgYnkgdGhpcyBnZW5lcmF0b3IuCisgICAgICAgKi8KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gMDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGluY2x1c2l2ZSBtYXhpbXVtIHZhbHVlIG9mIHRoZSByYW5nZSBvZiByYW5kb20gaW50ZWdlcnMKKyAgICAgICAqIHJldHVybmVkIGJ5IHRoaXMgZ2VuZXJhdG9yLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWF4KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPm1vZHVsdXMgLSAxOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbmV4dCByYW5kb20gbnVtYmVyIGluIHRoZSBzZXF1ZW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aXRoX2NhcnJ5IHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIG9iamVjdC4KKyAgICAgICAqIEBwYXJhbSBfX3JocyBBbm90aGVyICUgc3VidHJhY3Rfd2l0aF9jYXJyeSByYW5kb20gbnVtYmVyIGdlbmVyYXRvcgorICAgICAgICogICAgICAgICAgICAgIG9iamVjdC4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyB0cnVlIGlmIHRoZSB0d28gb2JqZWN0cyBhcmUgbm90IGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IHN1YnRyYWN0X3dpdGhfY2FycnkmIF9fbGhzLAorCQkgY29uc3Qgc3VidHJhY3Rfd2l0aF9jYXJyeSYgX19yaHMpCisgICAgICB7IHJldHVybiAhKF9fbGhzID09IF9fcmhzKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEluc2VydHMgdGhlIGN1cnJlbnQgc3RhdGUgb2YgYSAlIHN1YnRyYWN0X3dpdGhfY2FycnkgcmFuZG9tIG51bWJlcgorICAgICAgICogZ2VuZXJhdG9yIGVuZ2luZSBAcCBfX3ggaW50byB0aGUgb3V0cHV0IHN0cmVhbSBAcCBfX29zLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX29zIEFuIG91dHB1dCBzdHJlYW0uCisgICAgICAgKiBAcGFyYW0gX194ICBBICUgc3VidHJhY3Rfd2l0aF9jYXJyeSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgVGhlIG91dHB1dCBzdHJlYW0gd2l0aCB0aGUgc3RhdGUgb2YgQHAgX194IGluc2VydGVkIG9yIGluCisgICAgICAgKiBhbiBlcnJvciBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0ludFR5cGUxLCBfSW50VHlwZTEgX19tM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Ki8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlLCBpbnQgX193LCBpbnQgX19zLCBpbnQgX19yPgorICAgIGNsYXNzIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEKKyAgICB7CisgICAgcHVibGljOgorICAgICAgLyoqIFRoZSB0eXBlIG9mIHRoZSBnZW5lcmF0ZWQgcmFuZG9tIHZhbHVlLiAqLworICAgICAgdHlwZWRlZiBfUmVhbFR5cGUgcmVzdWx0X3R5cGU7CisgICAgICAKKyAgICAgIC8vIHBhcmFtZXRlciB2YWx1ZXMKKyAgICAgIHN0YXRpYyBjb25zdCBpbnQgICAgICB3b3JkX3NpemUgPSBfX3c7CisgICAgICBzdGF0aWMgY29uc3QgaW50ICAgICAgbG9uZ19sYWcgID0gX19yOworICAgICAgc3RhdGljIGNvbnN0IGludCAgICAgIHNob3J0X2xhZyA9IF9fczsKKworICAgICAgLyoqCisgICAgICAgKiBDb25zdHJ1Y3RzIGEgZGVmYXVsdC1pbml0aWFsaXplZCAlIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEgcmFuZG9tCisgICAgICAgKiBudW1iZXIgZ2VuZXJhdG9yLgorICAgICAgICovCisgICAgICBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxKCkKKyAgICAgIHsKKwl0aGlzLT5zZWVkKCk7CisJX01faW5pdGlhbGl6ZV9ucG93cygpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYW4gZXhwbGljaXRseSBzZWVkZWQgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxIHJhbmRvbSBudW1iZXIKKyAgICAgICAqIGdlbmVyYXRvci4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEodW5zaWduZWQgbG9uZyBfX3ZhbHVlKQorICAgICAgeworCXRoaXMtPnNlZWQoX192YWx1ZSk7CisJX01faW5pdGlhbGl6ZV9ucG93c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IG9mIHRoZSByYW5nZSBvZiByYW5kb20gZmxvYXRzCisgICAgICAgKiByZXR1cm5lZCBieSB0aGlzIGdlbmVyYXRvci4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1pbigpIGNvbnN0CisgICAgICB7IHJldHVybiAwLjA7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBtYXhpbXVtIHZhbHVlIG9mIHRoZSByYW5nZSBvZiByYW5kb20gZmxvYXRzCisgICAgICAgKiByZXR1cm5lZCBieSB0aGlzIGdlbmVyYXRvci4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpIGNvbnN0CisgICAgICB7IHJldHVybiAxLjA7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBuZXh0IHJhbmRvbSBudW1iZXIgaW4gdGhlIHNlcXVlbmNlLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgb3BlcmF0b3IoKSgpOworCisgICAgICAvKioKKyAgICAgICAqIENvbXBhcmVzIHR3byAlIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0cworICAgICAgICogb2YgdGhlIHNhbWUgdHlwZSBmb3IgZXF1YWxpdHkuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fbGhzIEEgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxIHJhbmRvbSBudW1iZXIKKyAgICAgICAqICAgICAgICAgICAgICBnZW5lcmF0b3Igb2JqZWN0LgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRydWUgaWYgdGhlIHR3byBvYmplY3RzIGFyZSBlcXVhbCwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgICovCisgICAgICBmcmllbmQgYm9vbAorICAgICAgb3BlcmF0b3I9PShjb25zdCBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxJiBfX2xocywKKwkJIGNvbnN0IHN1YnRyYWN0X3dpdGhfY2FycnlfMDEmIF9fcmhzKQorICAgICAgeworCWZvciAoaW50IF9faSA9IDA7IF9faSA8IGxvbmdfbGFnOyArK19faSkKKwkgIGlmICghc3RkOjplcXVhbChfX2xocy5fTV94W19faV0sIF9fbGhzLl9NX3hbX19pXSArIF9fbiwKKwkJCSAgX19yaHMuX01feFtfX2ldKSkKKwkgICAgcmV0dXJuIGZhbHNlOworCXJldHVybiB0cnVlOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIENvbXBhcmVzIHR3byAlIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEgcmFuZG9tIG51bWJlciBnZW5lcmF0b3Igb2JqZWN0cworICAgICAgICogb2YgdGhlIHNhbWUgdHlwZSBmb3IgaW5lcXVhbGl0eS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gX19saHMgQSAlIHN1YnRyYWN0X3dpdGhfY2FycnlfMDEgcmFuZG9tIG51bWJlcgorICAgICAgICogICAgICAgICAgICAgIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fcmhzIEFub3RoZXIgJSBzdWJ0cmFjdF93aXRoX2NhcnJ5XzAxIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yCisgICAgICAgKiAgICAgICAgICAgICAgb2JqZWN0LgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRydWUgaWYgdGhlIHR3byBvYmplY3RzIGFyZSBub3QgZXF1YWwsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAqLworICAgICAgZnJpZW5kIGJvb2wKKyAgICAgIG9wZXJhdG9yIT0oY29uc3Qgc3VidHJhY3Rfd2l0aF9jYXJ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mFtIHJuZyBBbiBleGlzdGluZyAoYmFzZSBjbGFzcykgZW5naW5lIG9iamVjdC4KKyAgICAgICAqLworICAgICAgZXhwbGljaXQKKyAgICAgIGRpc2NhcmRfYmxvY2soY29uc3QgYmFzZV90eXBlJiBfX3JuZykKKyAgICAgIDogX01fYihfX3JuZyksIF9NX24oMCkgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogU2VlZCBjb25zdHJ1Y3RzIGEgJWRpc2NhcmRfYmxvY2sgZW5naW5lLgorICAgICAgICoKKyAgICAgICAqIENvbnN0cnVjdHMgdGhlIHVuZGVybHlpbmcgZ2VuZXJhdG9yIGVuZ2luZSBzZWVkZWQgd2l0aCBAcCBfX3MuCisgICAgICAgKiBAcGFyYW0gX19zIEEgc2VlZCB2YWx1ZSBmb3IgdGhlIGJhc2UgY2xhc3MgZW5naW5lLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgZGlzY2FyZF9ibG9jayh1bnNpZ25lZCBsb25nIF9fcykKKyAgICAgIDogX01fYihfX3MpLCBfTV9uKDApIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdlbmVyYXRvciBjb25zdHJ1Y3QgYSAlZGlzY2FyZF9ibG9jayBlbmdpbmUuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fZyBBIHNlZWQgZ2VuZXJhdG9yIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfR2VuPgorICAgICAgICBkaXNjYXJkX2Jsb2NrKF9HZW4mIF9fZykKKwk6IF9NX2IoX19nKSwgX01fbigwKSB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBSZXNlZWRzIHRoZSAlZGlzY2FyZF9ibG9jayBvYmplY3Qgd2l0aCB0aGUgZGVmYXVsdCBzZWVkIGZvciB0aGUKKyAgICAgICAqIHVuZGVybHlpbmcgYmFzZSBjbGFzcyBnZW5lcmF0b3IgZW5naW5lLgorICAgICAgICovCisgICAgICB2b2lkIHNlZWQoKQorICAgICAgeworCV9NX2Iuc2VlZCgpOworCV9NX24gPSAwOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIFJlc2VlZHMgdGhlICVkaXNjYXJkX2Jsb2NrIG9iamVjdCB3aXRoIHRoZSBnaXZlbiBzZWVkIGdlbmVyYXRvcgorICAgICAgICogZnVuY3Rpb24uCisgICAgICAgKiBAcGFyYW0gX19nIEEgc2VlZCBnZW5lcmF0b3IgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9HZW4+CisgICAgICAgIHZvaWQgc2VlZChfR2VuJiBfX2cpCisgICAgICAgIHsKKwkgIF9NX2Iuc2VlZChfX2cpOworCSAgX01fbiA9IDA7CisJfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgYSBjb25zdCByZWZlcmVuY2UgdG8gdGhlIHVuZGVybHlpbmcgZ2VuZXJhdG9yIGVuZ2luZSBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGNvbnN0IGJhc2VfdHlwZSYKKyAgICAgIGJhc2UoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fYjsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIG1pbmltdW0gdmFsdWUgaW4gdGhlIGdlbmVyYXRlZCByYW5kb20gbnVtYmVyIHJhbmdlLgorICAgICAgICovCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2IubWluKCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBtYXhpbXVtIHZhbHVlIGluIHRoZSBnZW5lcmF0ZWQgcmFuZG9tIG51bWJlciByYW5nZS4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9iLm1heCgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbmV4dCB2YWx1ZSBpb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BfX3MpCisgICAgICA6IF9NX2IxKF9fcyksIF9NX2IyKF9fcyArIDEpCisgICAgICB7IF9NX2luaXRpYWxpemVfbWF4KCk7IH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0dlbj4KKyAgICAgICAgeG9yX2NvbWJpbmUoX0dlbiYgX19nKQorCTogX01fYjEoX19nKSwgX01fYjIoX19nKQorICAgICAgICB7IF9NX2luaXRpYWxpemVfbWF4KCk7IH0KKworICAgICAgdm9pZAorICAgICAgc2VlZCgpCisgICAgICB7CisJX01fYjEuc2VlZCgpOworCV9NX2IyLnNlZWQoKTsKKyAgICAgIH0KKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0dlbj4KKyAgICAgICAgdm9pZAorICAgICAgICBzZWVkKF9HZW4mIF9fZykKKyAgICAgICAgeworCSAgX01fYjEuc2VlZChfX2cpOworCSAgX01fYjIuc2VlZChfX2cpOworCX0KKworICAgICAgY29uc3QgYmFzZTFfdHlwZSYKKyAgICAgIGJhc2UxKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX2IxOyB9CisKKyAgICAgIGNvbnN0IGJhc2UyX3R5cGUmCisgICAgICBiYXNlMigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9iMjsgfQorCisgICAgICByZXN1bHRfdHlwZQorICAgICAgbWluKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIDA7IH0KKworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9tYXg7IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBuZXh0IHJhbmRvbSBudW1iZXIgaW4gdGhlIHNlcXVlbmNlLgorICAgICAgICovCisgICAgICAvLyBOQjogTm90IGV4YWN0bHkgdGhlIFRSMSBmb3JtdWxhLCBwZXIgTjIwNzkgaW5zdGVhZC4KKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBvcGVyYXRvcigpKCkKKyAgICAgIHsKKwlyZXR1cm4gKChyZXN1bHRfdHlwZShfTV9iMSgpIC0gX01fYjEubWluKCkpIDw8IHNoaWZ0MSkKKwkJXiAocmVzdWx0X3R5cGUoX01fYjIoKSAtIF9NX2IyLm1pbigpKSA8PCBzaGlmdDIpKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBDb21wYXJlcyB0d28gJXhvcl9jb21iaW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIG9iamVjdHMgb2YKKyAgICAgICAqIHRoZSBzYW1lIHR5cGUgZm9yIGVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBICV4b3JfY29tYmluZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciAleG9yX2NvbWJpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICAgICAqICAgICAgICAgICAgICBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgdHdvIG9iamVjdHMgYXJlIGVxdWFsLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgKi8KKyAgICAgIGZyaWVuZCBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IHhvcl9jb21iaW5lJiBfX2xocywgY29uc3QgeG9yX2NvbWJpbmUmIF9fcmhzKQorICAgICAgeworCXJldHVybiAoX19saHMuYmFzZTEoKSA9PSBfX3Jocy5iYXNlMSgpKQorCSAgICAgICAgJiYgKF9fbGhzLmJhc2UyKCkgPT0gX19yaHMuYmFzZTIoKSk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogQ29tcGFyZXMgdHdvICV4b3JfY29tYmluZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmplY3RzIG9mCisgICAgICAgKiB0aGUgc2FtZSB0eXBlIGZvciBpbmVxdWFsaXR5LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX2xocyBBICV4b3JfY29tYmluZSByYW5kb20gbnVtYmVyIGdlbmVyYXRvciBvYmplY3QuCisgICAgICAgKiBAcGFyYW0gX19yaHMgQW5vdGhlciAleG9yX2NvbWJpbmUgcmFuZG9tIG51bWJlciBnZW5lcmF0b3IKKyAgICAgICAqICAgICAgICAgICAgICBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgdHJ1ZSBpZiB0aGUgdHdvIG9iamVjdHMgYXJlIG5vdCBlcXVhbCwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgICovCisgICAgICBmcmllbmQgYm9vbAorICAgICAgb3BlcmF0b3IhPShjb25zdCB4b3JfY29tYmluZSYgX19saHMsIGNvbnN0IHhvcl9jb21iaW5lJiBfX3JocykKKyAgICAgIHsgcmV0dXJuICEoX19saHMgPT0gX19yaHMpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogSW5zZXJ0cyB0aGUgY3VycmVudCBzdGF0ZSBvZiBhICV4b3JfY29tYmluZSByYW5kb20gbnVtYmVyCisgICAgICAgKiBnZW5lcmF0b3IgZW5naW5lIEBwIF9feCBpbnRvIHRoZSBvdXRwdXQgc3RyZWFtIEBwIF9fb3MuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fb3MgQW4gb3V0cHV0IHN0cmVhbS4KKyAgICAgICAqIEBwYXJhbSBfX3ggIEEgJXhvcl9jb21iaW5lIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIGVuZ2luZS4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyBUaGUgb3V0cHV0IHN0cmVhbSB3aXRoIHRoZSBzdGF0ZSBvZiBAcCBfX3ggaW5zZXJ0ZWQgb3IgaW4KKyAgICAgICAqIGFuIGVycm9yIHN0YXRlLgorICAgICAgICovCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvcjExLCBpbnQgX19zMTEsCisJICAgICAgIGNsYXNz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Vycm9yKF9fTigicmFuZG9tX2RldmljZTo6X01fc3RydG91bCIKKwkJCQkJICAgIihjb25zdCBzdGQ6OnN0cmluZyYpIikpOworCX0KKyAgICAgIHJldHVybiBfX3JldDsKKyAgICB9CisKKyAgcHVibGljOgorCisjZW5kaWYKKworICAgIHJlc3VsdF90eXBlCisgICAgbWluKCkgY29uc3QKKyAgICB7IHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPHJlc3VsdF90eXBlPjo6bWluKCk7IH0KKworICAgIHJlc3VsdF90eXBlCisgICAgbWF4KCkgY29uc3QKKyAgICB7IHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPHJlc3VsdF90eXBlPjo6bWF4KCk7IH0KKworICAgIGRvdWJsZQorICAgIGVudHJvcHkoKSBjb25zdAorICAgIHsgcmV0dXJuIDAuMDsgfQorCisgICAgcmVzdWx0X3R5cGUKKyAgICBvcGVyYXRvcigpKCkKKyAgICB7CisjaWZkZWYgX0dMSUJDWFhfVVNFX1JBTkRPTV9UUjEKKyAgICAgIHJlc3VsdF90eXBlIF9fcmV0OworICAgICAgc3RkOjpmcmVhZChyZWludGVycHJldF9jYXN0PHZvaWQqPigmX19yZXQpLCBzaXplb2YocmVzdWx0X3R5cGUpLAorCQkgMSwgX01fZmlsZSk7CisgICAgICByZXR1cm4gX19yZXQ7CisjZWxzZQorICAgICAgcmV0dXJuIF9NX210KCk7CisjZW5kaWYKKyAgICB9CisKKyAgcHJpdmF0ZToKKyAgICByYW5kb21fZGV2aWNlKGNvbnN0IHJhbmRvbV9kZXZpY2UmKTsKKyAgICB2b2lkIG9wZXJhdG9yPShjb25zdCByYW5kb21fZGV2aWNlJik7CisKKyNpZmRlZiBfR0xJQkNYWF9VU0VfUkFORE9NX1RSMQorICAgIEZJTEUqICAgICAgICBfTV9maWxlOworI2Vsc2UKKyAgICBtdDE5OTM3ICAgICAgX01fbXQ7CisjZW5kaWYKKyAgfTsKKworICAvKiBAfSAqLyAvLyBncm91cCB0cjF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5cGU7CisKKyAgICBwdWJsaWM6CisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYSB1bmlmb3JtIGRpc3RyaWJ1dGlvbiBvYmplY3QuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICB1bmlmb3JtX2ludChfSW50VHlwZSBfX21pbiA9IDAsIF9JbnRUeXBlIF9fbWF4ID0gOSkKKyAgICAgIDogX01fbWluKF9fbWluKSwgX01fbWF4KF9fbWF4KQorICAgICAgeworCV9HTElCQ1hYX0RFQlVHX0FTU0VSVChfTV9taW4gPD0gX01fbWF4KTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBpbmNsdXNpdmUgbG93ZXIgYm91bmQgb2YgdGhlIGRpc3RyaWJ1dGlvbiByYW5nZS4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1pbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9taW47IH0KKworICAgICAgLyoqCisgICAgICAgKiBHZXRzIHRoZSBpbmNsdXNpdmUgdXBwZXIgYm91bmQgb2YgdGhlIGRpc3RyaWJ1dGlvbiByYW5nZS4KKyAgICAgICAqLworICAgICAgcmVzdWx0X3R5cGUKKyAgICAgIG1heCgpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9tYXg7IH0KKworICAgICAgLyoqCisgICAgICAgKiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbiBzdGF0ZS4KKyAgICAgICAqCisgICAgICAgKiBEb2VzIG5vdGhpbmcgZm9yIHRoZSB1bmlmb3JtIGludGVnZXIgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICByZXNldCgpIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgYSB1bmlmb3JtbHkgZGlzdHJpYnV0ZWQgcmFuZG9tIG51bWJlciBpbiB0aGUgcmFuZ2UKKyAgICAgICAqIEBmJChtaW4sIG1heClAZiQuCisgICA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25zdHJ1Y3RvcnMgYW5kIG1lbWJlciBmdW5jdGlvbgorICAgICAgZXhwbGljaXQKKyAgICAgIGJpbm9taWFsX2Rpc3RyaWJ1dGlvbihfSW50VHlwZSBfX3QgPSAxLAorCQkJICAgIGNvbnN0IF9SZWFsVHlwZSYgX19wID0gX1JlYWxUeXBlKDAuNSkpCisgICAgICA6IF9NX3QoX190KSwgX01fcChfX3ApLCBfTV9uZCgpCisgICAgICB7CisJX0dMSUJDWFhfREVCVUdfQVNTRVJUKChfTV90ID49IDApICYmIChfTV9wID49IDAuMCkgJiYgKF9NX3AgPD0gMS4wKSk7CisJX01faW5pdGlhbGl6ZSgpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGRpc3RyaWJ1dGlvbiBAcCB0IHBhcmFtZXRlci4KKyAgICAgICAqLworICAgICAgX0ludFR5cGUKKyAgICAgIHQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fdDsgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIGRpc3RyaWJ1dGlvbiBAcCBwIHBhcmFtZXRlci4KKyAgICAgICAqLworICAgICAgX1JlYWxUeXBlCisgICAgICBwKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3A7IH0KKworICAgICAgdm9pZAorICAgICAgcmVzZXQoKQorICAgICAgeyBfTV9uZC5yZXNldCgpOyB9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yPgorICAgICAgICByZXN1bHRfdHlwZQorICAgICAgICBvcGVyYXRvcigpKF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yJiBfX3VybmcpOworCisgICAgICAvKioKKyAgICAgICAqIEluc2VydHMgYSAlYmlub21pYWxfZGlzdHJpYnV0aW9uIHJhbmRvbSBudW1iZXIgZGlzdHJpYnV0aW9uCisgICAgICAgKiBAcCBfX3ggaW50byB0aGUgb3V0cHV0IHN0cmVhbSBAcCBfX29zLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX29zIEFuIG91dHB1dCBzdHJlYW0uCisgICAgICAgKiBAcGFyYW0gX194ICBBICViaW5vbWlhbF9kaXN0cmlidXRpb24gcmFuZG9tIG51bWJlciBkaXN0cmlidXRpb24uCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgVGhlIG91dHB1dCBzdHJlYW0gd2l0aCB0aGUgc3RhdGUgb2YgQHAgX194IGluc2VydGVkIG9yIGluCisgICAgICAgKiBhbiBlcnJvciBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0ludFR5cGUxLCB0eXBlbmFtZSBfUmVhbFR5cGUxLAorCSAgICAgICB0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgICAgIGZyaWVuZCBzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICAgICAgb3BlcmF0b3I8PChzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19vcywKKwkJICAgY29uc3QgYmlub21pYWxfZGlzdHJpYnV0aW9uPF9JbnRUeXBlMSwgX1JlYWxUeXBlMT4mIF9feCk7CisKKyAgICAgIC8qKgorICAgICAgICogRXh0cmFjdHMgYSAlYmlub21pYWxfZGlzdHJpYnV0aW9uIHJhbmRvbSBudW1iZXIgZGlzdHJpYnV0aW9uCisgICAgICAgKiBAcCBfX3ggZnJvbSB0aGUgaW5wdXQgc3RyZWFtIEBwIF9faXMuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9faXMgQW4gaW5wdXQgc3RyZWFtLgorICAgICAgICogQHBhcmFtIF9feCAgQSAlYmlub21pYWxfZGlzdHJpYnV0aW9uIHJhbmRvbSBudW1iZXIgZ2VuZXJhdG9yIGVuZ2luZS4KKyAgICAgICAqCisgICAgICAgKiBAcmV0dXJucyBUaGUgaW5wd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d2VyIGJvdW5kIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKiBAcGFyYW0gX19tYXggW0lOXSAgVGhlIHVwcGVyIGJvdW5kIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICB1bmlmb3JtX3JlYWwoX1JlYWxUeXBlIF9fbWluID0gX1JlYWxUeXBlKDApLAorCQkgICBfUmVhbFR5cGUgX19tYXggPSBfUmVhbFR5cGUoMSkpCisgICAgICA6IF9NX21pbihfX21pbiksIF9NX21heChfX21heCkKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQoX01fbWluIDw9IF9NX21heCk7CisgICAgICB9CisKKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbWluOyB9CisKKyAgICAgIHJlc3VsdF90eXBlCisgICAgICBtYXgoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbWF4OyB9CisKKyAgICAgIHZvaWQKKyAgICAgIHJlc2V0KCkgeyB9CisKKyAgICAgIHRlbXBsYXRlPGNsYXNzIF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yPgorICAgICAgICByZXN1bHRfdHlwZQorICAgICAgICBvcGVyYXRvcigpKF9Vbmlmb3JtUmFuZG9tTnVtYmVyR2VuZXJhdG9yJiBfX3VybmcpCisgICAgICAgIHsgcmV0dXJuIChfX3VybmcoKSAqIChfTV9tYXggLSBfTV9taW4pKSArIF9NX21pbjsgfQorCisgICAgICAvKioKKyAgICAgICAqIEluc2VydHMgYSAldW5pZm9ybV9yZWFsIHJhbmRvbSBudW1iZXIgZGlzdHJpYnV0aW9uIEBwIF9feCBpbnRvIHRoZQorICAgICAgICogb3V0cHV0IHN0cmVhbSBAcCBfX29zLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBfX29zIEFuIG91dHB1dCBzdHJlYW0uCisgICAgICAgKiBAcG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yAKKyAgICogQGYkIHAoeCkgPSBcZnJhY3sxfXtcc2lnbWEgXHNxcnR7MiBccGl9fSAKKyAgICogICAgICAgICAgICBlXnstIFxmcmFje3t4IC0gbWVhbn1eIHsyfX17MiBcc2lnbWEgXiB7Mn19IH0gQGYkLgorICAgKi8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlID0gZG91YmxlPgorICAgIGNsYXNzIG5vcm1hbF9kaXN0cmlidXRpb24KKyAgICB7CisgICAgcHVibGljOgorICAgICAgLy8gdHlwZXMKKyAgICAgIHR5cGVkZWYgX1JlYWxUeXBlIGlucHV0X3R5cGU7CisgICAgICB0eXBlZGVmIF9SZWFsVHlwZSByZXN1bHRfdHlwZTsKKworICAgIHB1YmxpYzoKKyAgICAgIC8qKgorICAgICAgICogQ29uc3RydWN0cyBhIG5vcm1hbCBkaXN0cmlidXRpb24gd2l0aCBwYXJhbWV0ZXJzIEBmJCBtZWFuIEBmJCBhbmQKKyAgICAgICAqIEBmJCBcc2lnbWEgQGYkLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbm9ybWFsX2Rpc3RyaWJ1dGlvbihjb25zdCByZXN1bHRfdHlwZSYgX19tZWFuID0gcmVzdWx0X3R5cGUoMCksCisJCQkgIGNvbnN0IHJlc3VsdF90eXBlJiBfX3NpZ21hID0gcmVzdWx0X3R5cGUoMSkpCisgICAgICA6IF9NX21lYW4oX19tZWFuKSwgX01fc2lnbWEoX19zaWdtYSksIF9NX3NhdmVkX2F2YWlsYWJsZShmYWxzZSkKKyAgICAgIHsgCisJX0dMSUJDWFhfREVCVUdfQVNTRVJUKF9NX3NpZ21hID4gMCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogR2V0cyB0aGUgbWVhbiBvZiB0aGUgZGlzdHJpYnV0aW9uLgorICAgICAgICovCisgICAgICBfUmVhbFR5cGUKKyAgICAgIG1lYW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbWVhbjsgfQorCisgICAgICAvKioKKyAgICAgICAqIEdldHMgdGhlIEBmJCBcc2lnbWEgQGYkIG9mIHRoZSBkaXN0cmlidXRpb24uCisgICAgICAgKi8KKyAgICAgIF9SZWFsVHlwZQorICAgICAgc2lnbWEoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fc2lnbWE7IH0KKworICAgICAgLyoqCisgICAgICAgKiBSZXNldHMgdGhlIGRpc3RyaWJ1dGlvbi4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgcmVzZXQoKQorICAgICAgeyBfTV9zYXZlZF9hdmFpbGFibGUgPSBmYWxzZTsgfQorCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvcj4KKyAgICAgICAgcmVzdWx0X3R5cGUKKyAgICAgICAgb3BlcmF0b3IoKShfVW5pZm9ybVJhbmRvbU51bWJlckdlbmVyYXRvciYgX191cm5nKTsKKworICAgICAgLyoqCisgICAgICAgKiBJbnNlcnRzIGEgJW5vcm1hbF9kaXN0cmlidXRpb24gcmFuZG9tIG51bWJlciBkaXN0cmlidXRpb24KKyAgICAgICAqIEBwIF9feCBpbnRvIHRoZSBvdXRwdXQgc3RyZWFtIEBwIF9fb3MuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIF9fb3MgQW4gb3V0cHV0IHN0cmVhbS4KKyAgICAgICAqIEBwYXJhbSBfX3ggIEEgJW5vcm1hbF9kaXN0cmlidXRpb24gcmFuZG9tIG51bWJlciBkaXN0cmlidXRpb24uCisgICAgICAgKgorICAgICAgICogQHJldHVybnMgVGhlIG91dHB1dCBzdHJlYW0gd2l0aCB0aGUgc3RhdGUgb2YgQHAgX194IGluc2VydGVkIG9yIGluCisgICAgICAgKiBhbiBlcnJvciBzdGF0ZS4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1JlYWxUeXBlMSwgdHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRz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GVuYW1lIF9UcCwgX1RwIF9fYSwgX1RwIF9fYywgX1RwIF9fbSwgYm9vbD4KKyAgICAgIHN0cnVjdCBfTW9kCisgICAgICB7CisJc3RhdGljIF9UcAorCV9fY2FsYyhfVHAgX194KQorCXsKKwkgIGlmIChfX2EgPT0gMSkKKwkgICAgX194ICU9IF9fbTsKKwkgIGVsc2UKKwkgICAgeworCSAgICAgIHN0YXRpYyBjb25zdCBfVHAgX19xID0gX19tIC8gX19hOworCSAgICAgIHN0YXRpYyBjb25zdCBfVHAgX19yID0gX19tICUgX19hOworCSAgICAgIAorCSAgICAgIF9UcCBfX3QxID0gX19hICogKF9feCAlIF9fcSk7CisJICAgICAgX1RwIF9fdDIgPSBfX3IgKiAoX194IC8gX19xKTsKKwkgICAgICBpZiAoX190MSA+PSBfX3QyKQorCQlfX3ggPSBfX3QxIC0gX190MjsKKwkgICAgICBlbHNlCisJCV9feCA9IF9fbSAtIF9fdDIgKyBfX3QxOworCSAgICB9CisKKwkgIGlmIChfX2MgIT0gMCkKKwkgICAgeworCSAgICAgIGNvbnN0IF9UcCBfX2QgPSBfX20gLSBfX3g7CisJICAgICAgaWYgKF9fZCA+IF9fYykKKwkJX194ICs9IF9fYzsKKwkgICAgICBlbHNlCisJCV9feCA9IF9fYyAtIF9fZDsKKwkgICAgfQorCSAgcmV0dXJuIF9feDsKKwl9CisgICAgICB9OworCisgICAgLy8gU3BlY2lhbCBjYXNlIGZvciBtID09IDAgLS0gdXNlIHVuc2lnbmVkIGludGVnZXIgb3ZlcmZsb3cgYXMgbW9kdWxvCisgICAgLy8gb3BlcmF0b3IuCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBfVHAgX19hLCBfVHAgX19jLCBfVHAgX19tPgorICAgICAgc3RydWN0IF9Nb2Q8X1RwLCBfX2EsIF9fYywgX19tLCB0cnVlPgorICAgICAgeworCXN0YXRpYyBfVHAKKwlfX2NhbGMoX1RwIF9feCkKKwl7IHJldHVybiBfX2EgKiBfX3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fX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19pcy5mbGFncygpOworICAgICAgX19pcy5mbGFncyhfX2lvc19iYXNlOjpkZWMpOworCisgICAgICBfX2lzID4+IF9fbGNyLl9NX3g7CisKKyAgICAgIF9faXMuZmxhZ3MoX19mbGFncyk7CisgICAgICByZXR1cm4gX19pczsKKyAgICB9IAorCisKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICBjb25zdCBpbnQKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46OndvcmRfc2l6ZTsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBpbnQgX190LCBfVUludFR5cGUgX19jLCBpbnQgX19sPgorICAgIGNvbnN0IGludAorICAgIG1lcnNlbm5lX3R3aXN0ZXI8X1VJbnRUeXBlLCBfX3csIF9fbiwgX19tLCBfX3IsIF9fYSwgX191LCBfX3MsCisJCSAgICAgX19iLCBfX3QsIF9fYywgX19sPjo6c3RhdGVfc2l6ZTsKKyAgICAKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICBjb25zdCBpbnQKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46OnNoaWZ0X3NpemU7CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICBjb25zdCBpbnQKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46Om1hc2tfYml0czsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBpbnQgX190LCBfVUludFR5cGUgX19jLCBpbnQgX19sPgorICAgIGNvbnN0IF9VSW50VHlwZQorICAgIG1lcnNlbm5lX3R3aXN0ZXI8X1VJbnRUeXBlLCBfX3csIF9fbiwgX19tLCBfX3IsIF9fYSwgX191LCBfX3MsCisJCSAgICAgX19iLCBfX3QsIF9fYywgX19sPjo6cGFyYW1ldGVyX2E7CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICBjb25zdCBpbnQKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46Om91dHB1dF91OworCisgIHRlbXBsYXRlPGNsYXNzIF9VSW50VHlwZSwgaW50IF9fdywgaW50IF9fbiwgaW50IF9fbSwgaW50IF9fciwKKwkgICBfVUludFR5cGUgX19hLCBpbnQgX191LCBpbnQgX19zLAorCSAgIF9VSW50VHlwZSBfX2IsIGludCBfX3QsIF9VSW50VHlwZSBfX2MsIGludCBfX2w+CisgICAgY29uc3QgaW50CisgICAgbWVyc2VubmVfdHdpc3RlcjxfVUludFR5cGUsIF9fdywgX19uLCBfX20sIF9fciwgX19hLCBfX3UsIF9fcywKKwkJICAgICBfX2IsIF9fdCwgX19jLCBfX2w+OjpvdXRwdXRfczsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBpbnQgX190LCBfVUludFR5cGUgX19jLCBpbnQgX19sPgorICAgIGNvbnN0IF9VSW50VHlwZQorICAgIG1lcnNlbm5lX3R3aXN0ZXI8X1VJbnRUeXBlLCBfX3csIF9fbiwgX19tLCBfX3IsIF9fYSwgX191LCBfX3MsCisJCSAgICAgX19iLCBfX3QsIF9fYywgX19sPjo6b3V0cHV0X2I7CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICBjb25zdCBpbnQKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46Om91dHB1dF90OworCisgIHRlbXBsYXRlPGNsYXNzIF9VSW50VHlwZSwgaW50IF9fdywgaW50IF9fbiwgaW50IF9fbSwgaW50IF9fciwKKwkgICBfVUludFR5cGUgX19hLCBpbnQgX191LCBpbnQgX19zLAorCSAgIF9VSW50VHlwZSBfX2IsIGludCBfX3QsIF9VSW50VHlwZSBfX2MsIGludCBfX2w+CisgICAgY29uc3QgX1VJbnRUeXBlCisgICAgbWVyc2VubmVfdHdpc3RlcjxfVUludFR5cGUsIF9fdywgX19uLCBfX20sIF9fciwgX19hLCBfX3UsIF9fcywKKwkJICAgICBfX2IsIF9fdCwgX19jLCBfX2w+OjpvdXRwdXRfYzsKKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBpbnQgX190LCBfVUludFR5cGUgX19jLCBpbnQgX19sPgorICAgIGNvbnN0IGludAorICAgIG1lcnNlbm5lX3R3aXN0ZXI8X1VJbnRUeXBlLCBfX3csIF9fbiwgX19tLCBfX3IsIF9fYSwgX191LCBfX3MsCisJCSAgICAgX19iLCBfX3QsIF9fYywgX19sPjo6b3V0cHV0X2w7CisKKyAgdGVtcGxhdGU8Y2xhc3MgX1VJbnRUeXBlLCBpbnQgX193LCBpbnQgX19uLCBpbnQgX19tLCBpbnQgX19yLAorCSAgIF9VSW50VHlwZSBfX2EsIGludCBfX3UsIGludCBfX3MsCisJICAgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwgX1VJbnRUeXBlIF9fYywgaW50IF9fbD4KKyAgICB2b2lkCisgICAgbWVyc2VubmVfdHdpc3RlcjxfVUludFR5cGUsIF9fdywgX19uLCBfX20sIF9fciwgX19hLCBfX3UsIF9fcywKKwkJICAgICBfX2IsIF9fdCwgX19jLCBfX2w+OjoKKyAgICBzZWVkKHVuc2lnbmVkIGxvbmcgX192YWx1ZSkKKyAgICB7CisgICAgICBfTV94WzBdID0gX19kZXRhaWw6Ol9fbW9kPF9VSW50VHlwZSwgMSwgMCwKKwlfX2RldGFpbDo6X1NoaWZ0PF9VSW50VHlwZSwgX193Pjo6X192YWx1ZT4oX192YWx1ZSk7CisKKyAgICAgIGZvciAoaW50IF9faSA9IDE7IF9faSA8IHN0YXRlX3NpemU7ICsrX19pKQorCXsKKwkgIF9VSW50VHlwZSBfX3ggPSBfTV94W19faSAtIDFdOworCSAgX194IF49IF9feCA+PiAoX193IC0gMik7CisJICBfX3ggKj0gMTgxMjQzMzI1M3VsOworCSAgX194ICs9IF9faTsKKwkgIF9NX3hbX19pXSA9IF9fZGV0YWlsOjpfX21vZDxfVUludFR5cGUsIDEsIDAsCisJICAgIF9fZGV0YWlsOjpfU2hpZnQ8X1VJbnRUeXBlLCBfX3c+OjpfX3ZhbHVlPihfX3gpOwkgIAorCX0KKyAgICAgIF9NX3AgPSBzdGF0ZV9zaXplOworICAgIH0KKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywKKwkgICBfVUludFR5cGUgX19iLCBpbnQgX190LCBfVUludFR5cGUgX19jLCBpbnQgX19sPgorICAgIHRlbXBsYXRlPGNsYXNzIF9HZW4+CisgICAgICB2b2lkCisgICAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgICAgX19iLCBfX3QsIF9fYywgX19sPjo6CisgICAgICBzZWVkKF9HZW4mIF9fZ2VuLCBmYWxzZV90eXBlKQorICAgICAgeworCWZvciAoaW50IF9faSA9IDA7IF9faSA8IHN0YXRlX3NpemU7ICsrX19pKQorCSAgX01feFtfX2ldID0gX19kZXRhaWw6Ol9fbW9kPF9VSW50VHlwZSwgMSwgMCwKKwkgICAgX19kZXRhaWw6Ol9TaGlmdDxfVUludFR5cGUsIF9fdz46Ol9fdmFsdWU+KF9fZ2VuKCkpOworCV9NX3AgPSBzdGF0ZV9zaXplOworICAgICAgfQorCisgIHRlbXBsYXRlPGNsYXNzIF9VSW50VHlwZSwgaW50IF9fdywgaW50IF9fbiwgaW50IF9fbSwgaW50IF9fciwKKwkgICBfVUludFR5cGUgX19hLCBpbnQgX191LCBpbnQgX19zLAorCSAgIF9VSW50VHlwZSBfX2IsIGludCBfX3QsIF9VSW50VHlwZSBfX2MsIGludCBfX2w+CisgICAgdHlwZW5hbWUKKyAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwgX19yLCBfX2EsIF9fdSwgX19zLAorCQkgICAgIF9fYiwgX190LCBfX2MsIF9fbD46OnJlc3VsdF90eXBlCisgICAgbWVyc2VubmVfdHdpc3RlcjxfVUludFR5cGUsIF9fdywgX19uLCBfX20sIF9fciwgX19hLCBfX3UsIF9fcywKKwkJICAgICBfX2IsIF9fdCwgX19jLCBfX2w+OjoKKyAgICBvcGVyYXRvcigpKCkKKyAgICB7CisgICAgICAvLyBSZWxvYWQgdGhlIHZlY3RvciAtIGNvc3QgaXMgTyhuKSBhbW9ydGl6ZWQgb3ZlciBuIGNhbGxzLgorICAgICAgaWYgKF9NX3AgPj0gc3RhdGVfc2l6ZSkKKwl7CisJICBjb25zdCBfVUludFR5cGUgX191cHBlcl9tYXNrID0gKH5fVUludFR5cGUoKSkgPDwgX19yOworCSAgY29uc3QgX1VJbnRUeXBlIF9fbG93ZXJfbWFzayA9IH5fX3VwcGVyX21hc2s7CisKKwkgIGZvciAoaW50IF9fayA9IDA7IF9fayA8IChfX24gLSBfX20pOyArK19faykKKwkgICAgeworCSAgICAgIF9VSW50VHlwZSBfX3kgPSAoKF9NX3hbX19rXSAmIF9fdXBwZXJfbWFzaykKKwkJCSAgICAgICB8IChfTV94W19fayArIDFdICYgX19sb3dlcl9tYXNrKSk7CisJICAgICAgX01feFtfX2tdID0gKF9NX3hbX19rICsgX19tXSBeIChfX3kgPj4gMSkKKwkJCSAgIF4gKChfX3kgJiAweDAxKSA/IF9fYSA6IDApKTsKKwkgICAgfQorCisJICBmb3IgKGludCBfX2sgPSAoX19uIC0gX19tKTsgX19rIDwgKF9fbiAtIDEpOyArK19faykKKwkgICAgeworCSAgICAgIF9VSW50VHlwZSBfX3kgPSAoKF9NX3hbX19rXSAmIF9fdXBwZXJfbWFzaykKKwkJCSAgICAgICB8IChfTV94W19fayArIDFdICYgX19sb3dlcl9tYXNrKSk7CisJICAgICAgX01feFtfX2tdID0gKF9NX3hbX19rICsgKF9fbSAtIF9fbildIF4gKF9feSA+PiAxKQorCQkJICAgXiAoKF9feSAmIDB4MDEpID8gX19hIDogMCkpOworCSAgICB9CisKKwkgIF9VSW50VHlwZSBfX3kgPSAoKF9NX3hbX19uIC0gMV0gJiBfX3VwcGVyX21hc2spCisJCQkgICB8IChfTV94WzBdICYgX19sb3dlcl9tYXNrKSk7CisJICBfTV94W19fbiAtIDFdID0gKF9NX3hbX19tIC0gMV0gXiAoX195ID4+IDEpCisJCQkgICBeICgoX195ICYgMHgwMSkgPyBfX2EgOiAwKSk7CisJICBfTV9wID0gMDsKKwl9CisKKyAgICAgIC8vIENhbGN1bGF0ZSBvKHgoaSkpLgorICAgICAgcmVzdWx0X3R5cGUgX196ID0gX01feFtfTV9wKytdOworICAgICAgX196IF49IChfX3ogPj4gX191KTsKKyAgICAgIF9feiBePSAoX196IDw8IF9fcykgJiBfX2I7CisgICAgICBfX3ogXj0gKF9feiA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Jhc2U6OmxlZnQpOworICAgICAgX19vcy5maWxsKF9fc3BhY2UpOworCisgICAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX24gLSAxOyArK19faSkKKwlfX29zIDw8IF9feC5fTV94W19faV0gPDwgX19zcGFjZTsKKyAgICAgIF9fb3MgPDwgX194Ll9NX3hbX19uIC0gMV07CisKKyAgICAgIF9fb3MuZmxhZ3MoX19mbGFncyk7CisgICAgICBfX29zLmZpbGwoX19maWxsKTsKKyAgICAgIHJldHVybiBfX29zOworICAgIH0KKworICB0ZW1wbGF0ZTxjbGFzcyBfVUludFR5cGUsIGludCBfX3csIGludCBfX24sIGludCBfX20sIGludCBfX3IsCisJICAgX1VJbnRUeXBlIF9fYSwgaW50IF9fdSwgaW50IF9fcywgX1VJbnRUeXBlIF9fYiwgaW50IF9fdCwKKwkgICBfVUludFR5cGUgX19jLCBpbnQgX19sLAorCSAgIHR5cGVuYW1lIF9DaGFyVCwgdHlwZW5hbWUgX1RyYWl0cz4KKyAgICBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiYKKyAgICBvcGVyYXRvcj4+KHN0ZDo6YmFzaWNfaXN0cmVhbTxfQ2hhclQsIF9UcmFpdHM+JiBfX2lzLAorCSAgICAgICBtZXJzZW5uZV90d2lzdGVyPF9VSW50VHlwZSwgX193LCBfX24sIF9fbSwKKwkgICAgICAgX19yLCBfX2EsIF9fdSwgX19zLCBfX2IsIF9fdCwgX19jLCBfX2w+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19pc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9faXN0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19pcy5mbGFncygpOworICAgICAgX19pcy5mbGFncyhfX2lvc19iYXNlOjpkZWMgfCBfX2lvc19iYXNlOjpza2lwd3MpOworCisgICAgICBmb3IgKGludCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCV9faXMgPj4gX194Ll9NX3hbX19pXTsKKworICAgICAgX19pcy5mbGFncyhfX2ZsYWdzKTsKKyAgICAgIHJldHVybiBfX2lzOworICAgIH0KKworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnRUeXBlLCBfSW50VHlwZSBfX20sIGludCBfX3MsIGludCBfX3I+CisgICAgY29uc3QgX0ludFR5cGUKKyAgICBzdWJ0cmFjdF93aXRoX2NhcnJ5PF9JbnRUeXBlLCBfX20sIF9fcywgX19yPjo6bW9kdWx1czsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW50VHlwZSwgX0ludFR5cGUgX19tLCBpbnQgX19zLCBpbnQgX19yPgorICAgIGNvbnN0IGludAorICAgIHN1YnRyYWN0X3dpdGhfY2Fycnk8X0ludFR5cGUsIF9fbSwgX19zLCBfX3I+Ojpsb25nX2xhZzsKKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfSW50VHlwZSwgX0ludFR5cGUgX19tLCBpbnQgX19zLCBpbnQgX19yPgorICAgIGNvbnN0IGludAorICAgIHN1YnRyYWN0X3dpdGhfY2Fycnk8X0ludFR5cGUsIF9fbSwgX19zLCBfX3I+OjpzaG9ydF9sYWc7CisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0ludFR5cGUsIF9JbnRUeXBlIF9fbSwgaW50IF9fcywgaW50IF9fcj4KKyAgICB2b2lkCisgICAgc3VidHJhY3Rfd2l0aF9jYXJyeTxfSW50VHlwZSwgX19tLCBfX3MsIF9fcj46OgorICAgIHNlZWQodW5zaWduZWQgbG9uZyBfX3ZhbHVlKQorICAgIHsKKyAgICAgIGlmIChfX3ZhbHVlID09IDApCisJX192YWx1ZSA9IDE5NzgwNTAzOworCisgICAgICBzdGQ6O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iA9IDA7IF9faiA8IF9fbiAtIDE7ICsrX19qKQorCSAgICAgIF9NX3hbX19pXVtfX2pdID0gX19kZXRhaWw6Ol9fbW9kPF9VSW50MzJUeXBlLCAxLCAwLCAwPihfX2dlbigpKTsKKwkgICAgX01feFtfX2ldW19fbiAtIDFdID0gX19kZXRhaWw6Ol9fbW9kPF9VSW50MzJUeXBlLCAxLCAwLAorCSAgICAgIF9fZGV0YWlsOjpfU2hpZnQ8X1VJbnQzMlR5cGUsIF9fdyAlIDMyPjo6X192YWx1ZT4oX19nZW4oKSk7CisJICB9CisKKwlfTV9jYXJyeSA9IDE7CisJZm9yIChpbnQgX19qID0gMDsgX19qIDwgX19uOyArK19faikKKwkgIGlmIChfTV94W2xvbmdfbGFnIC0gMV1bX19qXSAhPSAwKQorCSAgICB7CisJICAgICAgX01fY2FycnkgPSAwOworCSAgICAgIGJyZWFrOworCSAgICB9CisKKwlfTV9wID0gMDsKKyAgICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfUmVhbFR5cGUsIGludCBfX3csIGludCBfX3MsIGludCBfX3I+CisgICAgdHlwZW5hbWUgc3VidHJhY3Rfd2l0aF9jYXJyeV8wMTxfUmVhbFR5cGUsIF9fdywgX19zLCBfX3I+OjpyZXN1bHRfdHlwZQorICAgIHN1YnRyYWN0X3dpdGhfY2FycnlfMDE8X1JlYWxUeXBlLCBfX3csIF9fcywgX19yPjo6CisgICAgb3BlcmF0b3IoKSgpCisgICAgeworICAgICAgLy8gRGVyaXZlIHNob3J0IGxhZyBpbmRleCBmcm9tIGN1cnJlbnQgaW5kZXguCisgICAgICBpbnQgX19wcyA9IF9NX3AgLSBzaG9ydF9sYWc7CisgICAgICBpZiAoX19wcyA8IDApCisJX19wcyArPSBsb25nX2xhZzsKKworICAgICAgX1VJbnQzMlR5cGUgX19uZXdfY2Fycnk7CisgICAgICBmb3IgKGludCBfX2ogPSAwOyBfX2ogPCBfX24gLSAxOyArK19faikKKwl7CisJICBpZiAoX01feFtfX3BzXVtfX2pdID4gX01feFtfTV9wXVtfX2pdCisJICAgICAgfHwgKF9NX3hbX19wc11bX19qXSA9PSBfTV94W19NX3BdW19fal0gJiYgX01fY2FycnkgPT0gMCkpCisJICAgIF9fbmV3X2NhcnJ5ID0gMDsKKwkgIGVsc2UKKwkgICAgX19uZXdfY2FycnkgPSAxOworCisJICBfTV94W19NX3BdW19fal0gPSBfTV94W19fcHNdW19fal0gLSBfTV94W19NX3BdW19fal0gLSBfTV9jYXJyeTsKKwkgIF9NX2NhcnJ5ID0gX19uZXdfY2Fycnk7CisJfQorCisgICAgICBpZiAoX01feFtfX3BzXVtfX24gLSAxXSA+IF9NX3hbX01fcF1bX19uIC0gMV0KKwkgIHx8IChfTV94W19fcHNdW19fbiAtIDFdID09IF9NX3hbX01fcF1bX19uIC0gMV0gJiYgX01fY2FycnkgPT0gMCkpCisJX19uZXdfY2FycnkgPSAwOworICAgICAgZWxzZQorCV9fbmV3X2NhcnJ5ID0gMTsKKyAgICAgIAorICAgICAgX01feFtfTV9wXVtfX24gLSAxXSA9IF9fZGV0YWlsOjpfX21vZDxfVUludDMyVHlwZSwgMSwgMCwKKwlfX2RldGFpbDo6X1NoaWZ0PF9VSW50MzJUeXBlLCBfX3cgJSAzMj46Ol9fdmFsdWU+CisJKF9NX3hbX19wc11bX19uIC0gMV0gLSBfTV94W19NX3BdW19fbiAtIDFdIC0gX01fY2FycnkpOworICAgICAgX01fY2FycnkgPSBfX25ld19jYXJyeTsKKworICAgICAgcmVzdWx0X3R5cGUgX19yZXQgPSAwLjA7CisgICAgICBmb3IgKGludCBfX2ogPSAwOyBfX2ogPCBfX247ICsrX19qKQorCV9fcmV0ICs9IF9NX3hbX01fcF1bX19qXSAqIF9NX25wb3dzW19fal07CisKKyAgICAgIC8vIEFkanVzdCBjdXJyZW50IGluZGV4IHRvIGxvb3AgYXJvdW5kIGluIHJpbmcgYnVmZmVyLgorICAgICAgaWYgKCsrX01fcCA+PSBsb25nX2xhZykKKw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YXggPSBfX3VybmcubWF4KCk7CisJY29uc3QgX191cm50eXBlIF9fdXJucmFuZ2UgPSBfX3Vybm1heCAtIF9fdXJubWluOworCWNvbnN0IF9fdWN0eXBlIF9fdXJhbmdlID0gX19tYXggLSBfX21pbjsKKwljb25zdCBfX3VjdHlwZSBfX3VkZW5vbSA9IChfX3VybnJhbmdlIDw9IF9fdXJhbmdlCisJCQkJICAgPyAxIDogX191cm5yYW5nZSAvIChfX3VyYW5nZSArIDEpKTsKKwlkbworCSAgX19yZXQgPSAoX191cm50eXBlKF9fdXJuZygpKSAtICBfX3Vybm1pbikgLyBfX3VkZW5vbTsKKwl3aGlsZSAoX19yZXQgPiBfX21heCAtIF9fbWluKTsKKworCXJldHVybiBfX3JldCArIF9fbWluOworICAgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnRUeXBlLCB0eXBlbmFtZSBfQ2hhclQsIHR5cGVuYW1lIF9UcmFpdHM+CisgICAgc3RkOjpiYXNpY19vc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mCisgICAgb3BlcmF0b3I8PChzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiYgX19vcywKKwkgICAgICAgY29uc3QgdW5pZm9ybV9pbnQ8X0ludFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX29zdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19vc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9fb3N0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19vcy5mbGFncygpOworICAgICAgY29uc3QgX0NoYXJUIF9fZmlsbCA9IF9fb3MuZmlsbCgpOworICAgICAgY29uc3QgX0NoYXJUIF9fc3BhY2UgPSBfX29zLndpZGVuKCcgJy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UgX19lID0gLXN0ZDo6bG9nKF9fdXJuZygpKTsKKworCQlfUmVhbFR5cGUgX193ID0gMC4wOworCQkKKwkJaWYgKF9fdSA8PSBfX2MxKQorCQkgIHsKKwkJICAgIGNvbnN0IF9SZWFsVHlwZSBfX24gPSBfTV9uZChfX3VybmcpOworCQkgICAgY29uc3QgX1JlYWxUeXBlIF9feSA9IC1zdGQ6OmFicyhfX24pICogX01fc20gLSAxOworCQkgICAgX194ID0gc3RkOjpmbG9vcihfX3kpOworCQkgICAgX193ID0gLV9fbiAqIF9fbiAvIDI7CisJCSAgICBpZiAoX194IDwgLV9fbSkKKwkJICAgICAgY29udGludWU7CisJCSAgfQorCQllbHNlIGlmIChfX3UgPD0gX19jMikKKwkJICB7CisJCSAgICBjb25zdCBfUmVhbFR5cGUgX19uID0gX01fbmQoX191cm5nKTsKKwkJICAgIGNvbnN0IF9SZWFsVHlwZSBfX3kgPSAxICsgc3RkOjphYnMoX19uKSAqIF9NX3NjeDsKKwkJICAgIF9feCA9IHN0ZDo6Y2VpbChfX3kpOworCQkgICAgX193ID0gX195ICogKDIgLSBfX3kpICogX01fMWN4OworCQkgICAgaWYgKF9feCA+IF9NX2QpCisJCSAgICAgIGNvbnRpbnVlOworCQkgIH0KKwkJZWxzZSBpZiAoX191IDw9IF9fYzMpCisJCSAgLy8gTkI6IFRoaXMgY2FzZSBub3QgaW4gdGhlIGJvb2ssIG5vciBpbiB0aGUgRXJyYXRhLAorCQkgIC8vIGJ1dCBzaG91bGQgYmUgb2suLi4KKwkJICBfX3ggPSAtMTsKKwkJZWxzZSBpZiAoX191IDw9IF9fYzQpCisJCSAgX194ID0gMDsKKwkJZWxzZSBpZiAoX191IDw9IF9fYzUpCisJCSAgX194ID0gMTsKKwkJZWxzZQorCQkgIHsKKwkJICAgIGNvbnN0IF9SZWFsVHlwZSBfX3YgPSAtc3RkOjpsb2coX191cm5nKCkpOworCQkgICAgY29uc3QgX1JlYWxUeXBlIF9feSA9IF9NX2QgKyBfX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BfTV9zMTsKKwkgICAgY29uc3QgX1JlYWxUeXBlIF9fczJzID0gX01fczIgKiBfTV9zMjsKKworCSAgICBib29sIF9fcmVqZWN0OworCSAgICBkbworCSAgICAgIHsKKwkJY29uc3QgX1JlYWxUeXBlIF9fdSA9IF9NX3MgKiBfX3VybmcoKTsKKworCQlfUmVhbFR5cGUgX192OworCisJCWlmIChfX3UgPD0gX19hMSkKKwkJICB7CisJCSAgICBjb25zdCBfUmVhbFR5cGUgX19uID0gX01fbmQoX191cm5nKTsKKwkJICAgIGNvbnN0IF9SZWFsVHlwZSBfX3kgPSBfTV9zMSAqIHN0ZDo6YWJzKF9fbik7CisJCSAgICBfX3JlamVjdCA9IF9feSA+PSBfTV9kMTsKKwkJICAgIGlmICghX19yZWplY3QpCisJCSAgICAgIHsKKwkJCWNvbnN0IF9SZWFsVHlwZSBfX2UgPSAtc3RkOjpsb2coX191cm5nKCkpOworCQkJX194ID0gc3RkOjpmbG9vcihfX3kpOworCQkJX192ID0gLV9fZSAtIF9fbiAqIF9fbiAvIDIgKyBfTV9jOworCQkgICAgICB9CisJCSAgfQorCQllbHNlIGlmIChfX3UgPD0gX19hMTIpCisJCSAgeworCQkgICAgY29uc3QgX1JlYWxUeXBlIF9fbiA9IF9NX25kKF9fdXJuZyk7CisJCSAgICBjb25zdCBfUmVhbFR5cGUgX195ID0gX01fczIgKiBzdGQ6OmFicyhfX24pOworCQkgICAgX19yZWplY3QgPSBfX3kgPj0gX01fZDI7CisJCSAgICBpZiAoIV9fcmVqZWN0KQorCQkgICAgICB7CisJCQljb25zdCBfUmVhbFR5cGUgX19lID0gLXN0ZDo6bG9nKF9fdXJuZygpKTsKKwkJCV9feCA9IHN0ZDo6Zmxvb3IoLV9feSk7CisJCQlfX3YgPSAtX19lIC0gX19uICogX19uIC8gMjsKKwkJICAgICAgfQorCQkgIH0KKwkJZWxzZSBpZiAoX191IDw9IF9fYTEyMykKKwkJICB7CisJCSAgICBjb25zdCBfUmVhbFR5cGUgX19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zaXplIF9fcHJlY2lzaW9uID0gX19vcy5wcmVjaXNpb24oKTsKKyAgICAgIGNvbnN0IF9DaGFyVCBfX3NwYWNlID0gX19vcy53aWRlbignICcpOworICAgICAgX19vcy5mbGFncyhfX2lvc19iYXNlOjpzY2llbnRpZmljIHwgX19pb3NfYmFzZTo6bGVmdCk7CisgICAgICBfX29zLmZpbGwoX19zcGFjZSk7CisgICAgICBfX29zLnByZWNpc2lvbihfX2dudV9jeHg6Ol9fbnVtZXJpY190cmFpdHM8X1JlYWxUeXBlPjo6X19tYXhfZGlnaXRzMTApOworCisgICAgICBfX29zIDw8IF9feC5taW4oKSA8PCBfX3NwYWNlIDw8IF9feC5tYXgoKTsKKworICAgICAgX19vcy5mbGFncyhfX2ZsYWdzKTsKKyAgICAgIF9fb3MuZmlsbChfX2ZpbGwpOworICAgICAgX19vcy5wcmVjaXNpb24oX19wcmVjaXNpb24pOworICAgICAgcmV0dXJuIF9fb3M7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9SZWFsVHlwZSwgdHlwZW5hbWUgX0NoYXJULCB0eXBlbmFtZSBfVHJhaXRzPgorICAgIHN0ZDo6YmFzaWNfaXN0cmVhbTxfQ2hhclQsIF9UcmFpdHM+JgorICAgIG9wZXJhdG9yPj4oc3RkOjpiYXNpY19pc3RyZWFtPF9DaGFyVCwgX1RyYWl0cz4mIF9faXMsCisJICAgICAgIHVuaWZvcm1fcmVhbDxfUmVhbFR5cGU+JiBfX3gpCisgICAgeworICAgICAgdHlwZWRlZiBzdGQ6OmJhc2ljX2lzdHJlYW08X0NoYXJULCBfVHJhaXRzPiAgX19pc3RyZWFtX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9faXN0cmVhbV90eXBlOjppb3NfYmFzZSAgICBfX2lvc19iYXNlOworCisgICAgICBjb25zdCB0eXBlbmFtZSBfX2lvc19iYXNlOjpmbXRmbGFncyBfX2ZsYWdzID0gX19pcy5mbGFncygpOworICAgICAgX19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cmVqZWN0OworCWlmIChfTV9hbHBoYSA+PSAxKQorCSAgeworCSAgICAvLyBhbHBoYSAtIGxvZyg0KQorCSAgICBjb25zdCByZXN1bHRfdHlwZSBfX2IgPSBfTV9hbHBoYQorCSAgICAgIC0gcmVzdWx0X3R5cGUoMS4zODYyOTQzNjExMTk4OTA2MTg4MzQ0NjQyNDI5MTYzNTMxTCk7CisJICAgIGNvbnN0IHJlc3VsdF90eXBlIF9fYyA9IF9NX2FscGhhICsgX01fbF9kOworCSAgICBjb25zdCByZXN1bHRfdHlwZSBfXzFsID0gMSAvIF9NX2xfZDsKKworCSAgICAvLyAxICsgbG9nKDkgLyAyKQorCSAgICBjb25zdCByZXN1bHRfdHlwZSBfX2sgPSAyLjUwNDA3NzM5Njc3NjI3NDA3MzM3MzI1ODM1MjM4Njg3NDhMOworCisJICAgIGRvCisJICAgICAgeworCQljb25zdCByZXN1bHRfdHlwZSBfX3UgPSBfX3VybmcoKTsKKwkJY29uc3QgcmVzdWx0X3R5cGUgX192ID0gX191cm5nKCk7CisKKwkJY29uc3QgcmVzdWx0X3R5cGUgX195ID0gX18xbCAqIHN0ZDo6bG9nKF9fdiAvICgxIC0gX192KSk7CisJCV9feCA9IF9NX2FscGhhICogc3RkOjpleHAoX195KTsKKworCQljb25zdCByZXN1bHRfdHlwZSBfX3ogPSBfX3UgKiBfX3YgKiBfX3Y7CisJCWNvbnN0IHJlc3VsdF90eXBlIF9fciA9IF9fYiArIF9fYyAqIF9feSAtIF9feDsKKworCQlfX3JlamVjdCA9IF9fciA8IHJlc3VsdF90eXBlKDQuNSkgKiBfX3ogLSBfX2s7CisJCWlmIChfX3JlamVjdCkKKwkJICBfX3JlamVjdCA9IF9fciA8IHN0ZDo6bG9nKF9feik7CisJICAgICAgfQorCSAgICB3aGlsZSAoX19yZWplY3QpOworCSAgfQorCWVsc2UKKwkgIHsKKwkgICAgY29uc3QgcmVzdWx0X3R5cGUgX19jID0gMSAvIF9NX2FscGhhOworCisJICAgIGRv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AvKioKKyAgICogQG5hbWUgNS4xIFJlZ3VsYXIgRXhwcmVzc2lvbiBTeW50YXggT3B0aW9ucworICAgKi8KKyAgLy9AeworICBlbnVtIF9fc3ludGF4X29wdGlvbgorICAgIHsKKyAgICAgIF9TX2ljYXNlLAorICAgICAgX1Nfbm9zdWJzLAorICAgICAgX1Nfb3B0aW1pemUsCisgICAgICBfU19jb2xsYXRlLAorICAgICAgX1NfRUNNQVNjcmlwdCwKKyAgICAgIF9TX2Jhc2ljLAorICAgICAgX1NfZXh0ZW5kZWQsCisgICAgICBfU19hd2ssCisgICAgICBfU19ncmVwLAorICAgICAgX1NfZWdyZXAsCisgICAgICBfU19zeW50YXhfbGFzdAorICAgIH07CisKKyAgLyoqCisgICAqIEBicmllZiBUaGlzIGlzIGEgYml0bWFzayB0eXBlIGluZGljYXRpbmcgaG93IHRvIGludGVycHJldCB0aGUgcmVnZXguCisgICAqCisgICAqIFRoZSBAYyBzeW50YXhfb3B0aW9uX3R5cGUgaXMgaW1wbGVtZW50YXRpb24gZGVmaW5lZCBidXQgaXQgaXMgdmFsaWQgdG8KKyAgICogcGVyZm9ybSBiaXR3aXNlIG9wZXJhdGlvbnMgb24gdGhlc2UgdmFsdWVzIGFuZCBleHBlY3QgdGhlIHJpZ2h0IHRoaW5nIHRvCisgICAqIGhhcHBlbi4KKyAgICoKKyAgICogQSB2YWxpZCB2YWx1ZSBvZiB0eXBlIHN5bnRheF9vcHRpb25fdHlwZSBzaGFsbCBoYXZlIGV4YWN0bHkgb25lIG9mIHRoZQorICAgKiBlbGVtZW50cyBAYyBFQ01BU2NyaXB0LCBAYyBiYXNpYywgQGMgZXh0ZW5kZWQsIEBjIGF3aywgQGMgZ3JlcCwgQGMgZWdyZXAKKyAgICogJXNldC4KKyAgICovCisgIHR5cGVkZWYgdW5zaWduZWQgaW50IHN5bnRheF9vcHRpb25fdHlwZTsKKworICAvKiogCisgICAqIFNwZWNpZmllcyB0aGF0IHRoZSBtYXRjaGluZyBvZiByZ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ljOgorICAgIC8qKgorICAgICAqIEBicmllZiBDb25zdHJ1Y3RzIGEgcmVnZXhfZXJyb3Igb2JqZWN0LgorICAgICAqCisgICAgICogQHBhcmFtIGVjb2RlIHRoZSByZWdleCBlcnJvciBjb2RlLgorICAgICAqLworICAgIGV4cGxpY2l0CisgICAgcmVnZXhfZXJyb3IocmVnZXhfY29uc3RhbnRzOjplcnJvcl90eXBlIF9fZWNvZGUpCisgICAgOiBzdGQ6OnJ1bnRpbWVfZXJyb3IoInJlZ2V4X2Vycm9yIiksIF9NX2NvZGUoX19lY29kZSkKKyAgICB7IH0KKworICAgIC8qKgorICAgICAqIEBicmllZiBHZXRzIHRoZSByZWdleCBlcnJvciBjb2RlLgorICAgICAqCisgICAgICogQHJldHVybnMgdGhlIHJlZ2V4IGVycm9yIGNvZGUuCisgICAgICovCisgICAgcmVnZXhfY29uc3RhbnRzOjplcnJvcl90eXBlCisgICAgY29kZSgpIGNvbnN0CisgICAgeyByZXR1cm4gX01fY29kZTsgfQorCisgIHByb3RlY3RlZDoKKyAgICByZWdleF9jb25zdGFudHM6OmVycm9yX3R5cGUgX01fY29kZTsKKyAgfTsKKworICAvLyBbNy43XSBDbGFzcyByZWdleF90cmFpdHMKKyAgLyoqCisgICAqIEBicmllZiBEZXNjcmliZXMgYXNwZWN0cyBvZiBhIHJlZ3VsYXIgZXhwcmVzc2lvbi4KKyAgICoKKyAgICogQSByZWd1bGFyIGV4cHJlc3Npb24gdHJhaXRzIGNsYXNzIHRoYXQgc2F0aXNmaWVzIHRoZSByZXF1aXJlbWVudHMgb2YgdHIxCisgICAqIHNlY3Rpb24gWzcuMl0uCisgICAqCisgICAqIFRoZSBjbGFzcyAlcmVnZXggaXMgcGFyYW1ldGVyaXplZCBhcm91bmQgYSBzZXQgb2YgcmVsYXRlZCB0eXBlcyBhbmQKKyAgICogZnVuY3Rpb25zIHVzZWQgdG8gY29tcGxldGUgdGhlIGRlZmluaXRpb24gb2YgaXRzIHNlbWFudGljcy4gIF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IGJ5IHRoZQorICAgICAgICogaXRlcmF0b3IgcmFuZ2UgW2ZpcnN0LCBsYXN0KS4gVGhlIHZhbHVlIHJldHVybmVkIHNoYWxsIGJlIGluZGVwZW5kZW50CisgICAgICAgKiBvZiB0aGUgY2FzZSBvZiB0aGUgY2hhcmFjdGVycyBpbiB0aGUgY2hhcmFjdGVyIHNlcXVlbmNlLiBJZiB0aGUgbmFtZQorICAgICAgICogaXMgbm90IHJlY29nbml6ZWQgdGhlbiByZXR1cm5zIGEgdmFsdWUgdGhhdCBjb21wYXJlcyBlcXVhbCB0byAwLgorICAgICAgICoKKyAgICAgICAqIEF0IGxlYXN0IHRoZSBmb2xsb3dpbmcgbmFtZXMgKG9yIHRoZWlyIHdpZGUtY2hhcmFjdGVyIGVxdWl2YWxlbnQpIGFyZQorICAgICAgICogc3VwcG9ydGVkLgorICAgICAgICogLSBkCisgICAgICAgKiAtIHcKKyAgICAgICAqIC0gcworICAgICAgICogLSBhbG51bQorICAgICAgICogLSBhbHBoYQorICAgICAgICogLSBibGFuaworICAgICAgICogLSBjbnRybAorICAgICAgICogLSBkaWdpdAorICAgICAgICogLSBncmFwaAorICAgICAgICogLSBsb3dlcgorICAgICAgICogLSBwcmludAorICAgICAgICogLSBwdW5jdAorICAgICAgICogLSBzcGFjZQorICAgICAgICogLSB1cHBlcgorICAgICAgICogLSB4ZGlnaXQKKyAgICAgICAqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqLworICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgX0Z3ZF9pdGVyPgorICAgICAgICBjaGFyX2NsYXNzX3R5cGUKKyAgICAgICAgbG9va3VwX2NsYXNzbmFtZShfRndkX2l0ZXIgX19maXJzdCwgX0Z3ZF9pdGVyIF9fbGFzdCkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERldGVybWluZXMgaWYgQHAgYyBpcyBhIG1lbWJlciBvZiBhbiBpZGVudGlmaWVkIGNsYXNzLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBjIGEgY2hhcmFjdGVyLgorICAgICAgICogQHBhcmFtIGYgYSBjbGFzcyB0eXBlIChhcyByZXR1cm5lZCBmcm9tIGxvb2t1cF9jbGFzc25hbWUpLgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRydWUgaWYgdGhlIGNoYXJhY3RlciBAcCBjIGlzIGEgbWVtYmVyIG9mIHRoZSBjbGFzc2lmaWNhdGlvbgorICAgICAgICogcmVwcmVzZW50ZWQgYnkgQHAgZiwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3Mgc3RkOjpiYWRfY2FzdCBpZiB0aGUgY3VycmVudCBsb2NhbGUgZG9lcyBub3QgaGF2ZSBhIGN0eXBlCisgICAgICAgKiAgICAgICAgIGZhY2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICBpc2N0eXBlKF9DaF90eXBlIF9fYywgY2hhcl9jbGFzc190eXBlIF9fZikgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnZlcnRzIGEgZGlnaXQgdG8gYW4gaW50LgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBjaCAgICBhIGNoYXJhY3RlciByZXByZXNlbnRpbmcgYSBkaWdpdC4KKyAgICAgICAqIEBwYXJhbSByYWRpeCB0aGUgcmFkaXggaWYgdGhlIG51bWVyaWMgY29udmVyc2lvbiAobGltaXRlZCB0byA4LCAxMCwKKyAgICAgICAqICAgICAgICAgICAgICBvciAxNikuCisgICAgICAgKiAKKyAgICAgICAqIEByZXR1cm5zIHRoZSB2YWx1ZSByZXByZXNlbnRlZCBieSB0aGUgZGlnaXQgY2ggaW4gYmFzZSByYWRpeCBpZiB0aGUKKyAgICAgICAqIGNoYXJhY3RlciBjaCBpcyBhIHZhbGlkIGRpZ2l0IGluIGJhc2UgcmFkaXg7IG90aGVyd2lzZSByZXR1cm5zIC0xLgorICAgICAgICovCisgICAgICBpbnQKKyAgICAgIHZhbHVlKF9DaF90eXBlIF9fY2gsIGludCBfX3JhZGl4KSBjb25zdDsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgSW1idWVzIHRoZSByZWdleF90cmFpdHMgb2JqZWN0IHdpdGggYSBjb3B5IG9mIGEgbmV3IGxvY2FsZS4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gbG9jIEEgbG9jYWxlLgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIGEgY29weSBvZiB0aGUgcHJldmlvdXMgbG9jYWxlIGluIHVzZSBieSB0aGUgcmVnZXhfdHJhaXRzCisgICAgICAgKiAgICAgICAgICBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQG5vdGUgQ2FsbGluZyBpbWJ1ZSB3aXRoIGEgZGlmZmVyZW50IGxvY2FsZSB0aGFuIHRoZSBvbmUgY3VycmVudGx5IGluCisgICAgICAgKiAgICAgICB1c2UgaW52YWxpZGF0ZXMgYWxsIGNhY2hlZCBkYXRhIGhlbGQgYnkgKnRoaXMuCisgICAgICAgKi8KKyAgICAgIGxvY2FsZV90eXBlCisgICAgICBpbWJ1ZShsb2NhbGVfdHlwZSBfX2xvYykKKyAgICAgIHsKKwlzdGQ6OnN3YXAoX01fbG9jYWxlLCBfX2xvYyk7CisJcmV0dXJuIF9fbG9jOworICAgICAgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIGEgY29weSBvZiB0aGUgY3VycmVudCBsb2NhbGUgaW4gdXNlIGJ5IHRoZSByZWdleF90cmFpdHMKKyAgICAgICAqIG9iamVjdC4KKyAgICAgICAqLworICAgICAgbG9jYWxlX3R5cGUKKyAgICAgIGdldGxvYygpIGNvbnN0CisgICAgICB7IHJldHVybiBfTV9sb2NhbGU7IH0KKyAgICAgIAorICAgIHByb3RlY3RlZDoKKyAgICAgIGxvY2FsZV90eXBlIF9NX2xvY2Fs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czxfQ2hfdHlwZT4gPgorICAgIGNsYXNzIGJhc2ljX3JlZ2V4CisgICAgeworICAgIHB1YmxpYzoKKyAgICAgIC8vIHR5cGVzOgorICAgICAgdHlwZWRlZiBfQ2hfdHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHJlZ2V4X2NvbnN0YW50czo6c3ludGF4X29wdGlvbl90eXBlIGZsYWdfdHlwZTsKKyAgICAgIHR5cGVkZWYgdHlwZW5hbWUgX1J4X3RyYWl0czo6bG9jYWxlX3R5cGUgIGxvY2FsZV90eXBlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfUnhfdHJhaXRzOjpzdHJpbmdfdHlwZSAgc3RyaW5nX3R5cGU7CisKKyAgICAgIC8qKgorICAgICAgICogQG5hbWUgQ29uc3RhbnRzCisgICAgICAgKiB0cjEgWzcuOC4xXSBzdGQgWzI4LjguMV0KKyAgICAgICAqLworICAgICAgLy9AeworICAgICAgc3RhdGljIGNvbnN0IHJlZ2V4X2NvbnN0YW50czo6c3ludGF4X29wdGlvbl90eXBlIGljYXNlCisgICAgICAgID0gcmVnZXhfY29uc3RhbnRzOjppY2FzZTsKKyAgICAgIHN0YXRpYyBjb25zdCByZWdleF9jb25zdGFudHM6OnN5bnRheF9vcHRpb25fdHlwZSBub3N1YnMKKyAgICAgICAgPSByZWdleF9jb25zdGFudHM6Om5vc3ViczsKKyAgICAgIHN0YXRpYyBjb25zdCByZWdleF9jb25zdGFudHM6OnN5bnRheF9vcHRpb25fdHlwZSBvcHRpbWl6ZQorICAgICAgICA9IHJlZ2V4X2NvbnN0YW50czo6b3B0aW1pemU7CisgICAgICBzdGF0aWMgY29uc3QgcmVnZXhfY29uc3RhbnRzOjpzeW50YXhfb3B0aW9uX3R5cGUgY29sbGF0ZQorICAgICAgICA9IHJlZ2V4X2NvbnN0YW50czo6Y29sbGF0ZTsKKyAgICAgIHN0YXRpYyBjb25zdCByZWdleF9j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ZSBmbGFncyBpbiBAcCBmLgorICAgICAgICoKKyAgICAgICAqIEBwYXJhbSBwICAgQSBwb2ludGVyIHRvIHRoZSBzdGFydCBvZiBhIHN0cmluZyBjb250YWluaW5nIGEgcmVndWxhcgorICAgICAgICogICAgICAgICAgICBleHByZXNzaW9uLgorICAgICAgICogQHBhcmFtIGxlbiBUaGUgbGVuZ3RoIG9mIHRoZSBzdHJpbmcgY29udGFpbmluZyB0aGUgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICogQHBhcmFtIGYgICBGbGFncyBpbmRpY2F0aW5nIHRoZSBzeW50YXggcnVsZXMgYW5kIG9wdGlvbnMuCisgICAgICAgKgorICAgICAgICogQHRocm93cyByZWdleF9lcnJvciBpZiBAcCBwIGlzIG5vdCBhIHZhbGlkIHJlZ3VsYXIgZXhwcmVzc2lvbi4KKyAgICAgICAqLworICAgICAgYmFzaWNfcmVnZXgoY29uc3QgX0NoX3R5cGUqIF9fcCwgc3RkOjpzaXplX3QgX19sZW4sIGZsYWdfdHlwZSBfX2YpCisgICAgICA6IF9NX2ZsYWdzKF9fZikgLCBfTV9wYXR0ZXJuKF9fcCwgX19sZW4pLCBfTV9tYXJrX2NvdW50KDApCisgICAgICB7IF9NX2NvbXBpbGUoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb3B5LWNvbnN0cnVjdHMgYSBiYXNpYyByZWd1bGFyIGV4cHJlc3Npb24uCisgICAgICAgKgorICAgICAgICogQHBhcmFtIHJocyBBIEBwIHJlZ2V4IG9iamVjdC4KKyAgICAgKi8KKyAgICAgIGJhc2ljX3JlZ2V4KGNvbnN0IGJhc2ljX3JlZ2V4JiBfX3JocykKKyAgICAgIDogX01fZmxhZ3MoX19yaHMuX01fZmxhZ3MpLCBfTV9wYXR0ZXJuKF9fcmhzLl9NX3BhdHRlcm4pLAorCV9NX21hcmtfY291bnQoX19yaHMuX01fbWFya19jb3VudCkKKyAgICAgIHsgX01fY29tcGlsZSgpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnN0cnVjdHMgYSBiYXNpYyByZWd1bGFyIGV4cHJlc3Npb24gZnJvbSB0aGUgc3RyaW5nCisgICAgICAgKiBAcCBzIGludGVycHJldGVkIGFjY29yZGluZyB0byB0aGUgZmxhZ3MgaW4gQHAgZi4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gcyBBIHN0cmluZyBjb250YWluaW5nIGEgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICogQHBhcmFtIGYgRmxhZ3MgaW5kaWNhdGluZyB0aGUgc3ludGF4IHJ1bGVzIGFuZCBvcHRpb25zLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgQHAgcyBpcyBub3QgYSB2YWxpZCByZWd1bGFyIGV4cHJlc3Npb24uCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9DaF90cmFpdHMsIHR5cGVuYW1lIF9DaF9hbGxvYz4KKyAgICAgICAgZXhwbGljaXQKKyAgICAgICAgYmFzaWNfcmVnZXgoY29uc3QgYmFzaWNfc3RyaW5nPF9DaF90eXBlLCBfQ2hfdHJhaXRzLCBfQ2hfYWxsb2M+JiBfX3MsCisJCSAgICBmbGFnX3R5cGUgX19mID0gcmVnZXhfY29uc3RhbnRzOjpFQ01BU2NyaXB0KQorCTogX01fZmxhZ3MoX19mKSwgX01fcGF0dGVybihfX3MuYmVnaW4oKSwgX19zLmVuZCgpKSwgX01fbWFya19jb3VudCgwKQorICAgICAgICB7IF9NX2NvbXBpbGUoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb25zdHJ1Y3RzIGEgYmFzaWMgcmVndWxhciBleHByZXNzaW9uIGZyb20gdGhlIHJhbmdlCisgICAgICAgKiBbZmlyc3QsIGxhc3QpIGludGVycHJldGVkIGFjY29yZGluZyB0byB0aGUgZmxhZ3MgaW4gQHAgZi4KKyAgICAgICAqCisgICAgICAgKiBAcGFyYW0gZmlyc3QgVGhlIHN0YXJ0IG9mIGEgcmFuZ2UgY29udGFpbmluZyBhIHZhbGlkIHJlZ3VsYXIKKyAgICAgICAqICAgICAgICAgICAgICBleHByZXNzaW9uLgorICAgICAgICogQHBhcmFtIGxhc3QgIFRoZSBlbmQgb2YgYSByYW5nZSBjb250YWluaW5nIGEgdmFsaWQgcmVndWxhcgorICAgICAgICogICAgICAgICAgICAgIGV4cHJlc3Npb24uCisgICAgICAgKiBAcGFyYW0gZiAgICAgVGhlIGZvcm1hdCBmbGFncyBvZiB0aGUgcmVndWxhciBleHByZXNzaW9uLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgQHAgW2ZpcnN0LCBsYXN0KSBpcyBub3QgYSB2YWxpZCByZWd1bGFyCisgICAgICAgKiAgICAgICAgIGV4cHJlc3Npb24uCisgICAgICAgKi8KKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9JbnB1dEl0ZXJhdG9yPgorICAgICAgICBiYXNpY19yZWdleChfSW5wdXRJdGVyYXRvciBfX2ZpcnN0LCBfSW5wdXRJdGVyYXRvciBfX2xhc3QsIAorCQkgICAgZmxhZ190eXBlIF9fZiA9IHJlZ2V4X2NvbnN0YW50czo6RUNNQVNjcmlwdCkKKwk6IF9NX2ZsYWdzKF9fZiksIF9NX3BhdHRlcm4oX19maXJzdCwgX19sYXN0KSwgX01fbWFya19jb3VudCgwKQorICAgICAgICB7IF9NX2NvbXBpbGUoKTsgfQorCisjaWZkZWYgX0dMSUJDWFhfSU5DTFVERV9BU19DWFgwWAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQ29uc3RydWN0cyBhIGJhc2ljIHJlZ3VsYXIgZXhwcmVzc2lvbiBmcm9tIGFuIGluaXRpYWxpemVyIGxpc3QuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIGwgIFRoZSBpbml0aWFsaXplciBsaXN0LgorICAgICAgICogQHBhcmFtIGYg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QpCisgICAgICB7CisJYmFzaWNfcmVnZXggX190bXAoX190aGF0KTsKKwl0aGlzLT5zd2FwKF9fdG1wKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgYSBuZXcgcmVndWxhciBleHByZXNzaW9uIHRvIGEgcmVnZXggb2JqZWN0IGZyb20gYQorICAgICAgICogQy1zdHlsZSBudWxsLXRlcm1pbmF0ZWQgc3RyaW5nIGNvbnRhaW5pbmcgYSByZWd1bGFyIGV4cHJlc3Npb24KKyAgICAgICAqIHBhdHRlcm4uCisgICAgICAgKgorICAgICAgICogQHBhcmFtIHAgICAgIEEgcG9pbnRlciB0byBhIEMtc3R5bGUgbnVsbC10ZXJtaW5hdGVkIHN0cmluZyBjb250YWluaW5nCisgICAgICAgKiAgICAgICAgICAgICAgYSByZWd1bGFyIGV4cHJlc3Npb24gcGF0dGVybi4KKyAgICAgICAqIEBwYXJhbSBmbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgcCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQgcmVndWxhciBleHByZXNzaW9uCisgICAgICAgKiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcCBmbGFncy4gIElmIHJlZ2V4X2Vycm9yIGlzIHRocm93biwKKyAgICAgICAqICp0aGlzIHJlbWFpbnMgdW5jaGFuZ2VkLgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIGFzc2lnbihjb25zdCBfQ2hfdHlwZSogX19wLAorCSAgICAgZmxhZ190eXBlIF9fZmxhZ3MgPSByZWdleF9jb25zdGFudHM6OkVDTUFTY3JpcHQpCisgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oc3RyaW5nX3R5cGUoX19wKSwgX19mbGFncyk7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQXNzaWducyBhIG5ldyByZWd1bGFyIGV4cHJlc3Npb24gdG8gYSByZWdleCBvYmplY3QgZnJvbSBhCisgICAgICAgKiBDLXN0eWxlIHN0cmluZyBjb250YWluaW5nIGEgcmVndWxhciBleHByZXNzaW9uIHBhdHRlcm4uCisgICAgICAgKgorICAgICAgICogQHBhcmFtIHAgICAgIEEgcG9pbnRlciB0byBhIEMtc3R5bGUgc3RyaW5nIGNvbnRhaW5pbmcgYQorICAgICAgICogICAgICAgICAgICAgIHJlZ3VsYXIgZXhwcmVzc2lvbiBwYXR0ZXJuLgorICAgICAgICogQHBhcmFtIGxlbiAgIFRoZSBsZW5ndGggb2YgdGhlIHJlZ3VsYXIgZXhwcmVzc2lvbiBwYXR0ZXJuIHN0cmluZy4KKyAgICAgICAqIEBwYXJhbSBmbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgcCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQgcmVndWxhciBleHByZXNzaW9uCisgICAgICAgKiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcCBmbGFncy4gIElmIHJlZ2V4X2Vycm9yIGlzIHRocm93biwKKyAgICAgICAqICp0aGlzIHJlbWFpbnMgdW5jaGFuZ2VkLgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIGFzc2lnbihjb25zdCBfQ2hfdHlwZSogX19wLCBzdGQ6OnNpemVfdCBfX2xlbiwgZmxhZ190eXBlIF9fZmxhZ3MpCisgICAgICB7IHJldHVybiB0aGlzLT5hc3NpZ24oc3RyaW5nX3R5cGUoX19wLCBfX2xlbiksIF9fZmxhZ3MpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEFzc2lnbnMgYSBuZXcgcmVndWxhciBleHByZXNzaW9uIHRvIGEgcmVnZXggb2JqZWN0IGZyb20gYSAKKyAgICAgICAqIHN0cmluZyBjb250YWluaW5nIGEgcmVndWxhciBleHByZXNzaW9uIHBhdHRlcm4uCisgICAgICAgKgorICAgICAgICogQHBhcmFtIHMgICAgIEEgc3RyaW5nIGNvbnRhaW5pbmcgYSByZWd1bGFyIGV4cHJlc3Npb24gcGF0dGVybi4KKyAgICAgICAqIEBwYXJhbSBmbGFncyBTeW50YXggb3B0aW9uIGZsYWdzLgorICAgICAgICoKKyAgICAgICAqIEB0aHJvd3MgcmVnZXhfZXJyb3IgaWYgcCBkb2VzIG5vdCBjb250YWluIGEgdmFsaWQgcmVndWxhciBleHByZXNzaW9uCisgICAgICAgKiBwYXR0ZXJuIGludGVycHJldGVkIGFjY29yZGluZyB0byBAcCBmbGFncy4gIElmIHJlZ2V4X2Vycm9yIGlzIHRocm93biwKKyAgICAgICAqICp0aGlzIHJlbWFpbnMgdW5jaGFuZ2VkLgorICAgICAgICovCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hfdHlwZXJhaXRzLCB0eXBlbmFtZSBfQWxsb2NhdG9yPgorICAgICAgICBiYXNpY19yZWdleCYKKyAgICAgICAgYXNzaWduKGNvbnN0IGJhc2ljX3N0cmluZzxfQ2hfdHlwZSwgX0NoX3R5cGVyYWl0cywgX0FsbG9jYXRvcj4mIF9fcywKKwkgICAgICAgZmxhZ190eXBlIF9fZiA9IHJlZ2V4X2NvbnN0YW50czo6RUNNQVNjcmlwdCkKKyAgICAgICAgeyAKKwkgIGJhc2ljX3JlZ2V4IF9fdG1wKF9fcywgX19mKTsKKwkgIHRoaXMtPnN3YXAoX190bXApOworCSAgcmV0dXJuICp0aGlzOworCX0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQXNzaWducyBhIG5ldyByZWd1bGFyIGV4cHJlc3Npb24gdG8gYSByZWdleCBvYmplY3QuCisgICAgICAgKgorICAgICAgICogQHBhcmFtIGZpcnN0IFRoZSBzdGFydCBvZiBhIHJhbmdlIGNvbnRhaW5pbmcgYSB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dCByZXByZXNlbnRpbmcgYSByZWd1bGFyIGV4cHJlc3Npb24uCisgICAgICAgKiBAcGFyYW0gZmxhZ3MgU3ludGF4IG9wdGlvbiBmbGFncy4KKyAgICAgICAqCisgICAgICAgKiBAdGhyb3dzIHJlZ2V4X2Vycm9yIGlmIEBwIGwgZG9lcyBub3QgY29udGFpbiBhIHZhbGlkIHJlZ3VsYXIKKyAgICAgICAqIGV4cHJlc3Npb24gcGF0dGVybiBpbnRlcnByZXRlZCBhY2NvcmRpbmcgdG8gQHAgZmxhZ3MuICBJZiByZWdleF9lcnJvcgorICAgICAgICogaXMgdGhyb3duLCB0aGUgb2JqZWN0IHJlbWFpbnMgdW5jaGFuZ2VkLgorICAgICAgICovCisgICAgICBiYXNpY19yZWdleCYKKyAgICAgIGFzc2lnbihpbml0aWFsaXplcl9saXN0PF9DaF90eXBlPiBfX2wsCisJICAgICBmbGFnX3R5cGUgX19mID0gcmVnZXhfY29uc3RhbnRzOjpFQ01BU2NyaXB0KQorICAgICAgeyByZXR1cm4gdGhpcy0+YXNzaWduKF9fbC5iZWdpbigpLCBfX2wuZW5kKCksIF9fZik7IH0KKyNlbmRpZgorCisgICAgICAvLyBbNy44LjRdIGNvbnN0IG9wZXJhdGlvbnMKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEdldHMgdGhlIG51bWJlciBvZiBtYXJrZWQgc3ViZXhwcmVzc2lvbnMgd2l0aGluIHRoZSByZWd1bGFyCisgICAgICAgKiBleHByZXNzaW9uLgorICAgICAgICovCisgICAgICB1bnNpZ25lZCBpbnQKKyAgICAgIG1hcmtfY291bnQoKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fbWFya19jb3VudDsgfQorICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBmbGFncyB1c2VkIHRvIGNvbnN0cnVjdCB0aGUgcmVndWxhciBleHByZXNzaW9uCisgICAgICAgKiBvciBpbiB0aGUgbGFzdCBjYWxsIHRvIGFzc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vIHRoZSBlbmQgb2YgdGhlIHNlcXVlbmNlCisgICAqIHRoYXQgd2FzIHNlYXJjaGVkLgorICAgKgorICAgKiBAbm9zdWJncm91cGluZworICAgKi8KKyAgdGVtcGxhdGU8dHlwZW5hbWUgX0JpX2l0ZXIsCisJICAgdHlwZW5hbWUgX0FsbG9jYXRvciA9IGFsbG9jYXRvcjxzdWJfbWF0Y2g8X0JpX2l0ZXI+ID4gPgorICAgIGNsYXNzIG1hdGNoX3Jlc3VsdHMKKyAgICA6IHByaXZhdGUgc3RkOjp2ZWN0b3I8c3RkOjp0cjE6OnN1Yl9tYXRjaDxfQmlfaXRlcj4sIF9BbGxvY2F0b3I+CisgICAgeworICAgIHByaXZhdGU6CisgICAgICB0eXBlZGVmIHN0ZDo6dmVjdG9yPHN0ZDo6dHIxOjpzdWJfbWF0Y2g8X0JpX2l0ZXI+LCBfQWxsb2NhdG9yPgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfQmFzZV90eXBlOworCisgICAgcHVibGljOgorICAgICAgLyoqCisgICAgICAgKiBAbmFtZSAxMC4/IFB1YmxpYyBUeXBlcworICAgICAgICovCisgICAgICAvL0B7CisgICAgICB0eXBlZGVmIHN1Yl9tYXRjaDxfQmlfaXRlcj4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OmNvbnN0X3JlZmVyZW5jZSAgICAgICAgICAgIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgIHR5cGVkZWYgY29uc3RfcmVmZXJlbmNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgdHlwZWRlZiB0eXBlbmFtZSBfQmFzZV90eXBlOjpjb25zdF9pdGVyYXRvciAgICAgICAgICAgICBjb25zdF9pdGVyYXRvcjsKKyAgICAgIHR5cGVkZWYgY29uc3RfaXRlcmF0b3IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlcmF0b3I7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfQmlfaXRlcj46OmRpZmZlcmVuY2VfdHlwZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIF9BbGxvY2F0b3I6OnNpemVfdHlwZSAgICAgICAgICAgICAgICAgIHNpemVfdHlwZTsKKyAgICAgIHR5cGVkZWYgX0FsbG9jYXRvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIHR5cGVuYW1lIGl0ZXJhdG9yX3RyYWl0czxfQmlfaXRlcj46OnZhbHVlX3R5cGUgIGNoYXJfdHlwZTsKKyAgICAgIHR5cGVkZWYgYmFzaWNfc3RyaW5nPGNoYXJfdHlwZT4gICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nX3R5cGU7CisgICAgICAvL0B9CisgIAorICAgIHB1YmxpYzoKKyAgICAgIC8qKgorICAgICAgICogQG5hbWUgMTAuMSBDb25zdHJ1Y3Rpb24sIENvcHlpbmcsIGFuZCBEZXN0cnVjdGlvbgorICAgICAgICovCisgICAgICAvL0B7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIENvbnN0cnVjdHMgYSBkZWZhdWx0ICVtYXRjaF9yZXN1bHRzIGNvbnRhaW5lci4KKyAgICAgICAqIEBwb3N0IHNpemUoKSByZXR1cm5zIDAgYW5kIHN0cigpIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nLgorICAgICAgICovCisgICAgICBleHBsaWNpdAorICAgICAgbWF0Y2hfcmVzdWx0cyhjb25zdCBfQWxsb2NhdG9yJiBfX2EgPSBfQWxsb2NhdG9yKCkpCisgICAgICA6IF9CYXNlX3R5cGUoX19hKSwgX01fbWF0Y2hlZChmYWxzZSkKKyAgICAgIHsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBDb3B5IGNvbnN0cnVjdHMgYSAlbWF0Y2hfcmVzdWx0cy4KKyAgICAgICAqLworICAgICAgbWF0Y2hfcmVzdWx0cyhjb25zdCBtYXRjaF9yZXN1bHRzJiBfX3JocykKKyAgICAgIDogX0Jhc2VfdHlwZShfX3JocyksIF9NX21hdGNoZWQoX19yaHMuX01fbWF0Y2hlZCksCisJX01fcHJlZml4KF9fcmhzLl9NX3ByZWZpeCksIF9NX3N1ZmZpeChfX3Jocy5fTV9zdWZmaXgpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgQXNzaWducyByaHMgdG8gKnRoaXMuCisgICAgICAgKi8KKyAgICAgIG1hdGNoX3Jlc3VsdHMmCisgICAgICBvcGVyYXRvcj0oY29uc3QgbWF0Y2hfcmVzdWx0cyYgX19yaHMpCisgICAgICB7CisJbWF0Y2hfcmVzdWx0cyBfX3RtcChfX3Jocyk7CisJdGhpcy0+c3dhcChfX3RtcCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBEZXN0cm95cyBhICVtYXRjaF9yZXN1bHRzIG9iamVjdC4KKyAgICAgICAqLworICAgICAgfm1hdGNoX3Jlc3VsdHMoKQorICAgICAgeyB9CisgICAgICAKKyAgICAgIC8vQH0KKworICAgICAgLyoqCisgICAgICAgKiBAbmFtZSAxMC4yIFNpemUKKyAgICAgICAqLworICAgICAgLy9AeworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBudW1iZXIgb2YgbWF0Y2hlcyBhbmQgc3VibWF0Y2hlcy4KKyAgICAgICAqCisgICAgICAgKiBUaGUgbnVtYmVyIG9mIG1hdGNoZXMgZm9yIGEgZ2l2ZW4gcmVndWxhciBleHByZXNzaW9uIHdpbGwgYmUgZWl0aGVyIDAKKyAgICAgICAqIGlmIHRoZXJlIHdhcyBubyBtYXRjaCBvciBtYXJrX2NvdW50KCkgKyAxIGlmIGEgbWF0Y2ggd2FzIHN1Y2Nlc3NmdWwuCisgICAgICAgKiBTb21lIG1hdGNoZXMgbWF5IGJlIGVtcHR5LgorICAgICAgICoKKyAgICAgICAqIEByZXR1cm5zIHRoZSBudW1iZXIgb2YgbWF0Y2hlcyBmb3VuZC4KKyAgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBzaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX21hdGNoZWQgPyBfQmFzZV90eXBlOjpzaXplKCkgKyAxIDogMDsgfQorICAgICAgCisgICAgICAvL3NpemVfdHlwZQorICAgICAgLy9tYXhfc2l6ZSgpIGNvbnN0OworICAgICAgdXNpbmcgX0Jhc2VfdHlwZTo6bWF4X3NpemU7CisKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluZGljYXRlcyBpZiB0aGUgJW1hdGNoX3Jlc3VsdHMgY29udGFpbnMgbm8gcmVzdWx0cy4KKyAgICAgICAqIEByZXR2YWwgdHJ1ZSBUaGUgJW1hdGNoX3Jlc3VsdHMgb2JqZWN0IGlzIGVtcHR5LgorICAgICAgICogQHJldHZhbCBmYWxzZSBUaGUgJW1hdGNoX3Jlc3VsdHMgb2JqZWN0IGlzIG5vdCBlbXB0eS4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgZW1wdHkoKSBjb25zdAorICAgICAgeyByZXR1cm4gc2l6ZSgpID09IDA7IH0KKyAgICAgIAorICAgICAgLy9AfQorCisgICAgICAvKioKKyAgICAgICAqIEBuYW1lIDEwLjMgRWxlbWVudCBBY2Nlc3MKKyAgICAgICAqLworICAgICAgLy9AeworCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIHRoZSBsZW5ndGggb2YgdGhlIGluZGljYXRlZCBzdWJtYXRjaC4KKyAgICAgICAqIEBwYXJ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AgICogcGFydCBvZiB0aGUgdGFyZ2V0IHJhbmdlIGJldHdlZW4gdGhlIGVuZCBvZiB0aGUgbWF0Y2ggYW5kIHRoZSBlbmQgb2YKKyAgICAgICAqIHRoZSB0YXJnZXQgcmFuZ2UuCisgICAgICAgKi8KKyAgICAgIGNvbnN0X3JlZmVyZW5jZQorICAgICAgc3VmZml4KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9NX3N1ZmZpeDsgfQorCisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBHZXRzIGFuIGl0ZXJhdG9yIHRvIHRoZSBzdGFydCBvZiB0aGUgJXN1Yl9tYXRjaCBjb2xsZWN0aW9uLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgYmVnaW4oKSBjb25zdAorICAgICAgeyByZXR1cm4gX0Jhc2VfdHlwZTo6YmVnaW4oKTsgfQorICAgICAgCisjaWZkZWYgX0dMSUJDWFhfSU5DTFVERV9BU19DWFgwWAorICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgR2V0cyBhbiBpdGVyYXRvciB0byB0aGUgc3RhcnQgb2YgdGhlICVzdWJfbWF0Y2ggY29sbGVjdGlvbi4KKyAgICAgICAqLworICAgICAgY29uc3RfaXRlcmF0b3IKKyAgICAgIGNiZWdpbigpIGNvbnN0CisgICAgICB7IHJldHVybiBfQmFzZV90eXBlOjpiZWdpbigpOyB9CisjZW5kaWYKKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgR2V0cyBhbiBpdGVyYXRvciB0byBvbmUtcGFzdC10aGUtZW5kIG9mIHRoZSBjb2xsZWN0aW9uLgorICAgICAgICovCisgICAgICBjb25zdF9pdGVyYXRvcgorICAgICAgZW5kKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIF9CYXNlX3R5cGU6OmVuZCgpOyB9CisgICAgICAKKyNpZmRlZiBfR0xJQkNYWF9JTkNMVURFX0FTX0NYWDBYCisgICAgICAvKioKKyAgICAgICAqIEBicmllZi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b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICBzdHJpbmdfdHlwZQorICAgICAgZm9ybWF0KGNvbnN0IHN0cmluZ190eXBlJiBfX2ZtdCwKKwkgICAgIHJlZ2V4X2NvbnN0YW50czo6bWF0Y2hfZmxhZ190eXBlIF9fZmxhZ3MKKwkgICAgID0gcmVnZXhfY29uc3RhbnRzOjpmb3JtYXRfZGVmYXVsdCkgY29uc3Q7CisKKyAgICAgIC8vQH0gCisKKyAgICAgIC8qKgorICAgICAgICogQG5hbWUgMTAuNSBBbGxvY2F0b3IKKyAgICAgICAqLworICAgICAgLy9AeyAKKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgR2V0cyBhIGNvcHkgb2YgdGhlIGFsbG9jYXRvci4KKyAgICAgICAqLworICAgICAgLy9hbGxvY2F0b3JfdHlwZQorICAgICAgLy9nZXRfYWxsb2NhdG9yKCkgY29uc3Q7CisgICAgICB1c2luZyBfQmFzZV90eXBlOjpnZXRfYWxsb2NhdG9yOworICAgICAgCisgICAgICAvL0B9IAorCisgICAgICAvKioKKyAgICAgICAqIEBuYW1lIDEwLjYgU3dhcAorICAgICAgICovCisgICAgICAgLy9AeyAKKworICAgICAgLyoqCisgICAgICAgKiBAYnJpZWYgU3dhcHMgdGhlIGNvbnRlbnRzIG9mIHR3byBtYXRjaF9yZXN1bHRzLgorICAgICAgICovCisgICAgICB2b2lkCisgICAgICBzd2FwKG1hdGNoX3Jlc3VsdHMmIF9fdGhhdCkKKyAgICAgIHsKKwlfQmFzZV90eXBlOjpzd2FwKF9fdGhhdCk7CisJc3RkOjpzd2FwKF9NX21hdGNoZWQsIF9fdGhhdC5fTV9tYXRjaGVkKTsKKwlzdGQ6OnN3YXAoX01fcHJlZml4LCAgX190aGF0Ll9NX3ByZWZpeCk7CisJc3RkOjpzd2FwKF9NX3N1ZmZpeCwgIF9fdGhhdC5fTV9zdWZmaXgpOworICAgICAgfQorICAgICAgLy9AfSA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50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICByZWdleF9pdGVyYXRvcigpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYSAlcmVnZXhfaXRlcmF0b3IuLi4KKyAgICAgICAqIEBwYXJhbSBhICBbSU5dIFRoZSBzdGFydCBvZiBhIHRleHQgcmFuZ2UgdG8gc2VhcmNoLgorICAgICAgICogQHBhcmFtIGIgIFtJTl0gT25lLXBhc3QtdGhlLWVuZCBvZiB0aGUgdGV4dCByYW5nZSB0byBzZWFyY2guCisgICAgICAgKiBAcGFyYW0gcmUgW0lOXSBUaGUgcmVndWxhciBleHByZXNzaW9uIHRvIG1hdGNoLgorICAgICAgICogQHBhcmFtIG0gIFtJTl0gUG9saWN5IGZsYWdzIGZvciBtYXRjaCBydWxlcy4KKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICogQGRvY3RvZG8KKyAgICAgICAqLworICAgICAgcmVnZXhfaXRlcmF0b3IoX0JpX2l0ZXIgX19hLCBfQmlfaXRlciBfX2IsIGNvbnN0IHJlZ2V4X3R5cGUmIF9fcmUsCisJCSAgICAgcmVnZXhfY29uc3RhbnRzOjptYXRjaF9mbGFnX3R5cGUgX19tCisJCSAgICAgPSByZWdleF9jb25zdGFudHM6Om1hdGNoX2RlZmF1bHQpOworCisgICAgICAvKioKKyAgICAgICAqIENvcHkgY29uc3RydWN0cyBhICVyZWdleF9pdGVyYXRvci4KKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICogQGRvY3RvZG8KKyAgICAgICAqLworICAgICAgcmVnZXhfaXRlcmF0b3IoY29uc3QgcmVnZXhfaXRlcmF0b3ImIF9fcmhzKTsKKyAgICAgIAorICAgICAgLyoqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIHJlZ2V4X2l0ZXJhdG9yJgorICAgICAgb3BlcmF0b3I9KGNvbnN0IHJlZ2V4X2l0ZXJhdG9yJiBfX3Jocyk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IHJlZ2V4X2l0ZXJhdG9yJiBfX3Jocyk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICBib29sCisgICAgICBvcGVyYXRvciE9KGNvbnN0IHJlZ2V4X2l0ZXJhdG9yJiBfX3Jocyk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICBjb25zdCB2YWx1ZV90eXBlJgorICAgICAgb3BlcmF0b3IqKCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9kbworICAgICAgICovCisgICAgICBjb25zdCB2YWx1ZV90eXBlKgorICAgICAgb3BlcmF0b3ItPigpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICogQGRvY3RvZG8KKyAgICAgICAqLworICAgICAgcmVnZXhfaXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKiBAZG9jdG9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BwdWJsaWM6CisgICAgICAvKioKKyAgICAgICAqIEBicmllZiBEZWZhdWx0IGNvbnN0cnVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIAorICAgICAgICogQSBkZWZhdWx0LWNvbnN0cnVjdGVkICVyZWdleF90b2tlbl9pdGVyYXRvciBpcyBhIHNpbmd1bGFyIGl0ZXJhdG9yCisgICAgICAgKiB0aGF0IHdpbGwgY29tcGFyZSBlcXVhbCB0byB0aGUgb25lLXBhc3QtdGhlLWVuZCB2YWx1ZSBmb3IgYW55CisgICAgICAgKiBpdGVyYXRvciBvZiB0aGUgc2FtZSB0eXBlLgorICAgICAgICovCisgICAgICByZWdleF90b2tlbl9pdGVyYXRvcigpOworICAgICAgCisgICAgICAvKioKKyAgICAgICAqIENvbnN0cnVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuLi4KKyAgICAgICAqIEBwYXJhbSBhICAgICAgICAgIFtJTl0gVGhlIHN0YXJ0IG9mIHRoZSB0ZXh0IHRvIHNlYXJjaC4KKyAgICAgICAqIEBwYXJhbSBiICAgICAgICAgIFtJTl0gT25lLXBhc3QtdGhlLWVuZCBvZiB0aGUgdGV4dCB0byBzZWFyY2guCisgICAgICAgKiBAcGFyYW0gcmUgICAgICAgICBbSU5dIFRoZSByZWd1bGFyIGV4cHJlc3Npb24gdG8gc2VhcmNoIGZvci4KKyAgICAgICAqIEBwYXJhbSBzdWJtYXRjaCAgIFtJTl0gV2hpY2ggc3VibWF0Y2ggdG8gcmV0dXJuLiAgVGhlcmUgYXJlIHNvbWUKKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbCB2YWx1ZXMgZm9yIHRoaXMgcGFyYW1ldGVyOgorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAtIC0xIGVhY2ggZW51bWVyYXRlZCBzdWJleHByZXNzaW9uIGRvZXMgTk9UCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgbWF0Y2ggdGhlIHJlZ3VsYXIgZXhwcmVzc2lvbiAoYWthIGZpZWxkCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgc3BsaXR0aW5nKQorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAtIDAgdGhlIGVudGlyZSBzdHJpbmcgbWF0Y2hpbmcgdGhlCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgc3ViZXhwcmVzc2lvbiBpcyByZXR1cm5lZCBmb3IgZWFjaCBtYXRjaAorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhpbiB0aGUgdGV4dC4KKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgLSA+MCBlbnVtZXJhdGVzIG9ubHkgdGhlIGluZGljYXRlZAorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgIHN1YmV4cHJlc3Npb24gZnJvbSBhIG1hdGNoIHdpdGhpbiB0aGUgdGV4dC4KKyAgICAgICAqIEBwYXJhbSBtICAgICAgICAgIFtJTl0gUG9saWN5IGZsYWdzIGZvciBtYXRjaCBydWxlcy4KKyAgICAgICAqCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqIEBkb2N0b2RvCisgICAgICAgKi8KKyAgICAgIHJlZ2V4X3Rva2VuX2l0ZXJhdG9yKF9CaV9pdGVyIF9fYSwgX0JpX2l0ZXIgX19iLCBjb25zdCByZWdleF90eXBlJiBfX3JlLAorCQkJICAgaW50IF9fc3VibWF0Y2ggPSAwLAorCQkJICAgcmVnZXhfY29uc3RhbnRzOjptYXRjaF9mbGFnX3R5cGUgX19tCisJCQkgICA9IHJlZ2V4X2NvbnN0YW50czo6bWF0Y2hfZGVmYXVsdCk7CisKKyAgICAgIC8qKgorICAgICAgICogQ29uc3RydWN0cyBhICVyZWdleF90b2tlbl9p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KyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIERlcmVmZXJlbmNlcyBhICVyZWdleF90b2tlbl9pdGVyYXRvci4KKyAgICAgICAqIEB0b2RvIEltcGxlbWVudCB0aGlzIGZ1bmN0aW9uLgorICAgICAgICovCisgICAgICBjb25zdCB2YWx1ZV90eXBlJgorICAgICAgb3BlcmF0b3IqKCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFNlbGVjdHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IgbWVtYmVyLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIGNvbnN0IHZhbHVlX3R5cGUqCisgICAgICBvcGVyYXRvci0+KCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIEluY3JlbWVudHMgYSAlcmVnZXhfdG9rZW5faXRlcmF0b3IuCisgICAgICAgKiBAdG9kbyBJbXBsZW1lbnQgdGhpcyBmdW5jdGlvbi4KKyAgICAgICAqLworICAgICAgcmVnZXhfdG9rZW5faXRlcmF0b3ImCisgICAgICBvcGVyYXRvcisrKCk7CisgICAgICAKKyAgICAgIC8qKgorICAgICAgICogQGJyaWVmIFBvc3RpbmNyZW1lbnRzIGEgJXJlZ2V4X3Rva2VuX2l0ZXJhdG9yLgorICAgICAgICogQHRvZG8gSW1wbGVtZW50IHRoaXMgZnVuY3Rpb24uCisgICAgICAgKi8KKyAgICAgIHJlZ2V4X3Rva2VuX2l0ZXJhdG9yCisgICAgICBvcGVyYXRvcisrKGludCk7CisgICAgICAKKyAgICBwcml2YXRlOiAvLyBkYXRhIG1lbWJlcnMgZm9yIGV4cG9zaXRpb24gb25seToKKyAgICAgIHR5cGVkZWYgcmVnZXhfaXRlcmF0b3I8X0JpX2l0ZXIsIF9DaF90eXBlLCBfUnhfdHJhaXRzPiBwb3NpdGlvbl9pdGVyYXRvcjsKKworICAgICAgcG9zaXRpb25faXRlc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AgQGJyaWVmICBDb21wdXRlIHRoZSBSaWVtYW5uIHpldGEgZnVuY3Rpb24gQGYkIFx6ZXRhKHMpIEBmJAorICAgICAqICAgICAgICAgICBieSBzdW1tYXRpb24gZm9yIHMgPiAxLgorICAgICAqIAorICAgICAqICAgVGhlIFJpZW1hbm4gemV0YSBmdW5jdGlvbiBpcyBkZWZpbmVkIGJ5OgorICAgICAqICAgIFxmWworICAgICAqICAgICAgXHpldGEocykgPSBcc3VtX3trPTF9XntcaW5mdHl9IFxmcmFjezF9e2tee3N9fSBmb3IgcyA+IDEKKyAgICAgKiAgICBcZl0KKyAgICAgKiAgIEZvciBzIDwgMSB1c2UgdGhlIHJlZmxlY3Rpb24gZm9ybXVsYToKKyAgICAgKiAgICBcZlsKKyAgICAgKiAgICAgIFx6ZXRhKHMpID0gMl5zIFxwaV57cy0xfSBcR2FtbWEoMS1zKSBcemV0YSgxLXMpCisgICAgICogICAgXGZdCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIF9UcAorICAgIF9fcmllbWFubl96ZXRhX3N1bShjb25zdCBfVHAgX19zKQorICAgIHsKKyAgICAgIC8vICBBIHVzZXIgc2hvdWxkbid0IGdldCB0byB0aGlzLgorICAgICAgaWYgKF9fcyA8IF9UcCgxKSkKKyAgICAgICAgc3RkOjpfX3Rocm93X2RvbWFpbl9lcnJvcihfX04oIkJhZCBhcmd1bWVudCBpbiB6ZXRhIHN1bS4iKSk7CisKKyAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBtYXhfaXRlciA9IDEwMDAwOworICAgICAgX1RwIF9femV0YSA9IF9UcCgwKTsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9fayA9IDE7IF9fayA8IG1heF9pdGVyOyArK19faykKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3Rlcm0gPSBzdGQ6OnBvdyhzdGF0aWNfY2FzdDxfVHA+KF9fayksIC1fX3MpOworICAgICAgICAgIGlmIChfX3Rlcm0gPCBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgX196ZXRhICs9IF9fdGVybTsKKyAgICAgICAgfQorCisgICAgICByZXR1cm4gX196ZXRhOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIEV2YWx1YXRlIHRoZSBSaWVtYW5uIHpldGEgZnVuY3Rpb24gQGYkIFx6ZXRhKHMpIEBmJAorICAgICAqICAgICAgICAgICBieSBhbiBhbHRlcm5hdGUgc2VyaWVzIGZvciBzID4gMC4KKyAgICAgKiAKKyAgICAgKiAgIFRoZSBSaWVtYW5uIHpldGEgZnVuY3Rpb24gaXMgZGVmaW5lZCBieToKKyAgICAgKiAgICBcZlsKKyAgICAgKiAgICAgIFx6ZXRhKHMpID0gXHN1bV97az0xfV57XGluZnR5fSBcZnJhY3sxfXtrXntzfX0gZm9yIHMgPiAxCisgICAgICogICAgXGZdCisgICAgICogICBGb3IgcyA8IDEgdXNlIHRoZSByZWZsZWN0aW9uIGZvcm11bGE6CisgICAgICogICAgXGZbCisgICAgICogICAgICBcemV0YShzKSA9IDJecyBccGlee3MtMX0gXEdhbW1hKDEtcykgXHpldGEoMS1zKQorICAgICAqICAgIFxmXQorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3JpZW1hbm5femV0YV9hbHQoY29uc3QgX1RwIF9fcykKKyAgICB7CisgICAgICBfVHAgX19zZ24gPSBfVHAoMSk7CisgICAgICBfVHAgX196ZXRhID0gX1RwKDApOworICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19pID0gMTsgX19pIDwgMTAwMDAwMDA7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgX1RwIF9fdGVybSA9IF9fc2duIC8gc3RkOjpwb3coX19pLCBfX3MpOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0pIDwgc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCkpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3pldGEgKz0gX190ZXJtOworICAgICAgICAgIF9fc2duICo9IF9UcCgtMSk7CisgICAgICAgIH0KKyAgICAgIF9femV0YSAvPSBfVHAoMSkgLSBzdGQ6OnBvdyhfVHAoMiksIF9UcCgxKSAtIF9fcyk7CisKKyAgICAgIHJldHVybiBfX3pldGE7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgRXZhbHVhdGUgdGhlIFJpZW1hbm4gemV0YSBmdW5jdGlvbiBieSBzZXJpZXMgZm9yIGFsbCBzICE9IDEuCisgICAgICogICAgICAgICAgIENvbnZlcmdlbmNlIGlzIGdyZWF0IHVudGlsIGxhcmdpc2ggbmVnYXRpdmUgbnVtYmVycy4KKyAgICAgKiAgICAgICAgICAgVGhlbiB0aGUgY29udmVyZ2VuY2Ugb2YgdGhlID4gMCBzdW0gZ2V0cyBiZXR0ZXIuCisgICAgICoKKyAgICAgKiAgIFRoZSBzZXJpZXMgaXM6CisgICAgICogICAgXGZbCisgICAgICogICAgICBcemV0YShzKSA9IFxmcmFjezF9ezEtMl57MS1zfX0KKyAgICAgKiAgICAgICAgICAgICAgICAgXHN1bV97bj0wfV57XGluZnR5fSBcZnJhY3sxfXsyXntuKzF9fQorICAgICAqICAgICAgICAgICAgICAgICBcc3VtX3trPTB9XntufSAoLTEpXmsgXGZyYWN7biF9eyhuLWspIWshfSAoaysxKV57LXN9CisgICAgICogICAgXGZdCisgICAgICogICBIYXZpbCAyMDAzLCBwLiAyMDYuCisgICAgICoKKyAgICAgKiAgIFRoZSBSaWVtYW5uIHpldGEgZnVuY3Rpb24gaXMgZGVmaW5lZCBieToKKyAgICAgKiAgICBcZlsKKyAgICAgKiAgICAgIFx6ZXRhKHMpID0gXHN1bV97az0xfV57XGluZnR5fSBcZnJhY3sxfXtrXntzfX0gZm9yIHMgPiAxCisgICAgICogICAgXGZdCisgICAgICogICBGb3IgcyA8IDEgdXNlIHRoZSByZWZsZWN0aW9uIGZvcm11bGE6CisgICAgICogICAgXGZbCisgICAgICogICAgICBcemV0YShzKSA9IDJecyBccGlee3MtMX0gXEdhbW1hKDEtcykgXHpldGEoMS1zKQorICAgICAqICAgIFxmXQorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX3JpZW1hbm5femV0YV9nbG9iKGNvbnN0IF9UcCBfX3MpCisgICAgeworICAgICAgX1RwIF9femV0YSA9IF9UcCgwKTsKKworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICAvLyAgTWF4IGUgZXhwb25lbnQgYmVmb3JlIG92ZXJmbG93LgorICAgICAgY29uc3QgX1RwIF9fbWF4X2JpbmNvZWZmID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptYXhfZXhwb25lbnQxMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogc3RkOjpsb2coX1RwKDEwKSkgLSBfVHAoMSk7CisKKyAgICAgIC8vICBUaGlzIHNlcmllcyB3b3JrcyB1bnRpbCB0aGUgYmlub21pYWwgY29lZmZpY2llbnQgYmxvd3MgdXAKKyAgICAgIC8vICBzbyB1c2UgcmVmbGVjdGlvbi4KKyAgICAgIGlmIChfX3MgPCBfVHAoMCkpCisgICAgICAgIHsKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICAgICAgaWYgKHN0ZDo6dHIxOjpmbW9kKF9fcyxfVHAoMikpID09IF9UcCgwKSkKKyAgICAgICAgICAgIHJldHVybiBfVHAoMCk7CisgICAgICAgICAgZWxzZQorI2VuZGlmCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIF9UcCBfX3pldGEgPSBfX3JpZW1hbm5femV0YV9nbG9iKF9UcCgxKSAtIF9fcyk7CisgICAgICAgICAgICAgIF9femV0YSAqPSBzdGQ6OnBvdyhfVHAoMikKKyAgICAgICAgICAgICAgICAgICAgICogX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCksIF9fcykKKyAgICAgICAgICAgICAgICAgICAgICogc3RkOjpzaW4oX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpXzIoKSAqIF9fcykKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICAgICAgICAgICAgICAgICAqIHN0ZDo6ZXhwKHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKDEpIC0gX19zKSkKKyNlbHNlCisgICAgICAgICAgICAgICAgICAgICAqIHN0ZDo6ZXhwKF9fbG9nX2dhbW1hKF9UcCgxKSAtIF9fcykpCisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgIC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisgICAgICAgICAgICAgIHJldHVybiBfX3pldGE7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgX1RwIF9fbnVtID0gX1RwKDAuNUwpOworICAgICAgY29uc3QgdW5zaWduZWQgaW50IF9fbWF4aXQgPSAxMDAwMDsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDA7IF9faSA8IF9fbWF4aXQ7ICsrX19pKQorICAgICAgICB7CisgICAgICAgICAgYm9vbCBfX3B1bnQgPSBmYWxzZTsKKyAgICAgICAgICBfVHAgX19zZ24gPSBfVHAoMSk7CisgICAgICAgICAgX1RwIF9fdGVybSA9IF9UcCgwKTsKKyAgICAgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2ogPSAwOyBfX2ogPD0gX19pOyArK19faikKKyAgICAgICAgICAgIHsKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICAgICAgICAgIF9UcCBfX2JpbmNvZWZmID0gIHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKDEgKyBfX2kpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBzdGQ6OnRyMTo6bGdhbW1hKF9UcCgxICsgX19qKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc3RkOjp0cjE6OmxnYW1tYShfVHAoMSArIF9faSAtIF9faikpOworI2Vsc2UKKyAgICAgICAgICAgICAgX1RwIF9fYmluY29lZmYgPSAgX19sb2dfZ2FtbWEoX1RwKDEgKyBfX2kpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBfX2xvZ19nYW1tYShfVHAoMSArIF9faikpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIF9fbG9nX2dhbW1hKF9UcCgxICsgX19pIC0gX19qKSk7CisjZW5kaWYKKyAgICAgICAgICAgICAgaWYgKF9fYmluY29lZmYgPiBfX21heF9iaW5jb2VmZikKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAvLyAgVGhpcyBvbmx5IGdldHMgaGl0IGZvciB4IDw8IDAuCisgICAgICAgICAgICAgICAgICBfX3B1bnQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBfX2JpbmNvZWZmID0gc3RkOjpleHAoX19iaW5jb2VmZik7CisgICAgICAgICAgICAgIF9fdGVybSArPSBfX3NnbiAqIF9fYmluY29lZmYgKiBzdGQ6OnBvdyhfVHAoMSArIF9faiksIC1fX3MpOworICAgICAgICAgICAgICBfX3NnbiAqPSBfVHAoLTEpOworICAgICAgICAgICAgfQorICAgICAgICAgIGlmIChfX3B1bnQpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3Rlcm0gKj0gX19udW07CisgICAgICAgICAgX196ZXRhICs9IF9fdGVybTsKKyAgICAgICAgICBpZiAoc3RkOjphYnMoX190ZXJtL19femV0YSkgPCBfX2VwcykKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgIF9fbnVtICo9IF9UcCgwLjVMKTsKKyAgICAgICAgfQorCisgICAgICBfX3pldGEgLz0gX1RwKDEpIC0gc3RkOjpwb3coX1RwKDIpLCBfVHAoMSkgLSBfX3MpOworCisgICAgICByZXR1cm4gX196ZXRhOworICAgIH0KKworCisgICAgLyoqCisgICAgICogICBAYnJpZWYgIENvbXB1dGUgdGhlIFJpZW1hbm4gemV0YSBmdW5jdGlvbiBAZiQgXHpldGEocykgQGYkCisgICAgICogICAgICAgICAgIHVzaW5nIHRoZSBwcm9kdWN0IG92ZXIgcHJpbWUgZmFjdG9ycy4KKyAgICAgKiAgICBcZlsKKyAgICAgKiAgICAgIFx6ZXRhKHMpID0gXFBpX3tpPTF9XlxpbmZ0eSBcZnJhY3sxfXsxIC0gcF9pXnstc319CisgICAgICogICAgXGZdCisgICAgICogICAgd2hlcmUgQGYkIHtwX2l9IEBmJCBhcmUgdGhlIHByaW1lIG51bWJlcnMuCisgICAgICogCisgICAgICogICBUaGUgUmllbWFubiB6ZXRhIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnk6CisgICAgICogICAgXGZbCisgICAgICogICAgICBcemV0YShzKSA9IFxzdW1fe2s9MX1ee1xpbmZ0eX0gXGZyYWN7MX17a157c319IGZvciBzID4gMQorICAgICAqICAgIFxmXQorICAgICAqICAgRm9yIHMgPCAxIHVzZSB0aGUgcmVmbGVjdGlvbiBmb3JtdWxhOgorICAgICAqICAgIFxmWworICAgICAqICAgICAgXHpldGEocykgPSAyXnMgXHBpXntzLTF9IFxHYW1tYSgxLXMpIFx6ZXRhKDEtcykKKyAgICAgKiAgICBcZl0KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19yaWVtYW5uX3pldGFfcHJvZHVjdChjb25zdCBfVHAgX19zKQorICAgIHsKKyAgICAgIHN0YXRpYyBjb25zdCBfVHAgX19wcmltZVtdID0geworICAgICAgICBfVHAoMiksIF9UcCgzKSwgX1RwKDUpLCBfVHAoNyksIF9UcCgxMSksIF9UcCgxMyksIF9UcCgxNyksIF9UcCgxOSksCisgICAgICAgIF9UcCgyMyksIF9UcCgyOSksIF9UcCgzMSksIF9UcCgzNyksIF9UcCg0MSksIF9UcCg0MyksIF9UcCg0NyksCisgICAgICAgIF9UcCg1MyksIF9UcCg1OSksIF9UcCg2MSksIF9UcCg2NyksIF9UcCg3MSksIF9UcCg3MyksIF9UcCg3OSksCisgICAgICAgIF9UcCg4MyksIF9UcCg4OSksIF9UcCg5NyksIF9UcCgxMDEpLCBfVHAoMTAzKSwgX1RwKDEwNyksIF9UcCgxMDkpCisgICAgICB9OworICAgICAgc3RhdGljIGNvbnN0IHVuc2lnbmVkIGludCBfX251bV9wcmltZXMgPSBzaXplb2YoX19wcmltZSkgLyBzaXplb2YoX1RwKTsKKworICAgICAgX1RwIF9femV0YSA9IF9UcCgxKTsKKyAgICAgIGZvciAodW5zaWduZWQgaW50IF9faSA9IDA7IF9faSA8IF9fbnVtX3ByaW1lczsgKytfX2kpCisgICAgICAgIHsKKyAgICAgICAgICBjb25zdCBfVHAgX19mYWN0ID0gX1RwKDEpIC0gc3RkOjpwb3coX19wcmltZVtfX2ldLCAtX19zKTsKKyAgICAgICAgICBfX3pldGEgKj0gX19mYWN0OworICAgICAgICAgIGlmIChfVHAoMSkgLSBfX2ZhY3QgPCBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmVwc2lsb24oKSkKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgIF9femV0YSA9IF9UcCgxKSAvIF9femV0YTsKKworICAgICAgcmV0dXJuIF9femV0YTsKKyAgICB9CisKKworICAgIC8qKgorICAgICAqICAgQGJyaWVmICBSZXR1cm4gdGhlIFJpZW1hbm4gemV0YSBmdW5jdGlvbiBAZiQgXHpldGEocykgQGYkLgorICAgICAqIAorICAgICAqICAgVGhlIFJpZW1hbm4gemV0YSBmdW5jdGlvbiBpcyBkZWZpbmVkIGJ5OgorICAgICAqICAgIFxmWworICAgICAqICAgICAgXHpldGEocykgPSBcc3VtX3trPTF9XntcaW5mdHl9IGteey1zfSBmb3IgcyA+IDEKKyAgICAgKiAgICAgICAgICAgICAgICAgXGZyYWN7KDJccGkpXnN9e3BpfSBzaW4oXGZyYWN7XHBpIHN9ezJ9KQorICAgICAqICAgICAgICAgICAgICAgICBcR2FtbWEgKDEgLSBzKSBcemV0YSAoMSAtIHMpIGZvciBzIDwgMQorICAgICAqICAgIFxmXQorICAgICAqICAgRm9yIHMgPCAxIHVzZSB0aGUgcmVmbGVjdGlvbiBmb3JtdWxhOgorICAgICAqICAgIFxmWworICAgICAqICAgICAgXHpldGEocykgPSAyXnMgXHBpXntzLTF9IFxHYW1tYSgxLXMpIFx6ZXRhKDEtcykKKyAgICAgKiAgICBcZl0KKyAgICAgKi8KKyAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHA+CisgICAgX1RwCisgICAgX19yaWVtYW5uX3pldGEoY29uc3QgX1RwIF9fcykKKyAgICB7CisgICAgICBpZiAoX19pc25hbihfX3MpKQorICAgICAgICByZXR1cm4gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjpxdWlldF9OYU4oKTsKKyAgICAgIGVsc2UgaWYgKF9fcyA9PSBfVHAoMSkpCisgICAgICAgIHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPF9UcD46OmluZmluaXR5KCk7CisgICAgICBlbHNlIGlmIChfX3MgPCAtX1RwKDE5KSkKKyAgICAgICAgeworICAgICAgICAgIF9UcCBfX3pldGEgPSBfX3JpZW1hbm5femV0YV9wcm9kdWN0KF9UcCgxKSAtIF9fcyk7CisgICAgICAgICAgX196ZXRhICo9IHN0ZDo6cG93KF9UcCgyKSAqIF9fbnVtZXJpY19jb25zdGFudHM8X1RwPjo6X19waSgpLCBfX3MpCisgICAgICAgICAgICAgICAgICogc3RkOjpzaW4oX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpXzIoKSAqIF9fcykKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICAgICAgICAgICAgICogc3RkOjpleHAoc3RkOjp0cjE6OmxnYW1tYShfVHAoMSkgLSBfX3MpKQorI2Vsc2UKKyAgICAgICAgICAgICAgICAgKiBzdGQ6OmV4cChfX2xvZ19nYW1tYShfVHAoMSkgLSBfX3MpKQorI2VuZGlmCisgICAgICAgICAgICAgICAgIC8gX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpKCk7CisgICAgICAgICAgcmV0dXJuIF9femV0YTsKKyAgICAgICAgfQorICAgICAgZWxzZSBpZiAoX19zIDwgX1RwKDIwKSkKKyAgICAgICAgeworICAgICAgICAgIC8vICBHbG9iYWwgZG91YmxlIHN1bSBvciBNY0xhdXJpbj8KKyAgICAgICAgICBib29sIF9fZ2xvYiA9IHRydWU7CisgICAgICAgICAgaWYgKF9fZ2xvYikKKyAgICAgICAgICAgIHJldHVybiBfX3JpZW1hbm5femV0YV9nbG9iKF9fcyk7CisgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBpZiAoX19zID4gX1RwKDEpKQorICAgICAgICAgICAgICAgIHJldHVybiBfX3JpZW1hbm5femV0YV9zdW0oX19zKTsKKyAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIF9UcCBfX3pldGEgPSBzdGQ6OnBvdyhfVHAoMikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBfX251bWVyaWNfY29uc3RhbnRzPF9UcD46Ol9fcGkoKSwgX19zKQorICAgICAgICAgICAgICAgICAgICAgICAgICogc3RkOjpzaW4oX19udW1lcmljX2NvbnN0YW50czxfVHA+OjpfX3BpXzIoKSAqIF9fcykKKyNpZiBfR0xJQkNYWF9VU0VfQzk5X01BVEhfVFIxCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogc3RkOjp0cjE6OnRnYW1tYShfVHAoMSkgLSBfX3MpCisjZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqIHN0ZDo6ZXhwKF9fbG9nX2dhbW1hKF9UcCgxKSAtIF9fcykpCisjZW5kaWYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBfX3JpZW1hbm5femV0YV9zdW0oX1RwKDEpIC0gX19zKTsKKyAgICAgICAgICAgICAgICAgIHJldHVybiBfX3pldGE7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICBlbHNlCisgICAgICAgIHJldHVybiBfX3JpZW1hbm5femV0YV9wcm9kdWN0KF9fcyk7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBIdXJ3aXR6IHpldGEgZnVuY3Rpb24gQGYkIFx6ZXRhKHgscykgQGYkCisgICAgICogICAgICAgICAgIGZvciBhbGwgcyAhPSAxIGFuZCB4ID4gLTEuCisgICAgICogCisgICAgICogICBUaGUgSHVyd2l0eiB6ZXRhIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnk6CisgICAgICogICBAZlsKKyAgICAgKiAgICAgXHpldGEoeCxzKSA9IFxzdW1fe249MH1ee1xpbmZ0eX0gXGZyYWN7MX17KG4gKyB4KV5zfQorICAgICAqICAgQGZdCisgICAgICogICBUaGUgUmllbWFubiB6ZXRhIGZ1bmN0aW9uIGlzIGEgc3BlY2lhbCBjYXNlOgorICAgICAqICAgQGZbCisgICAgICogICAgIFx6ZXRhKHMpID0gXHpldGEoMSxzKQorICAgICAqICAgQGZdCisgICAgICogCisgICAgICogICBUaGlzIGZ1bmN0aW9ucyB1c2VzIHRoZSBkb3VibGUgc3VtIHRoYXQgY29udmVyZ2VzIGZvciBzICE9IDEKKyAgICAgKiAgIGFuZCB4ID4gLTE6CisgICAgICogICBAZlsKKyAgICAgKiAgICAgXHpldGEoeCxzKSA9IFxmcmFjezF9e3MtMX0KKyAgICAgKiAgICAgICAgICAgICAgICBcc3VtX3tuPTB9XntcaW5mdHl9IFxmcmFjezF9e24gKyAxfQorICAgICAqICAgICAgICAgICAgICAgIFxzdW1fe2s9MH1ee259ICgtMSleayBcZnJhY3tuIX17KG4taykhayF9ICh4K2spXnstc30KKyAgICAgKiAgIEBmXQorICAgICAqLworICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4KKyAgICBfVHAKKyAgICBfX2h1cndpdHpfemV0YV9nbG9iKGNvbnN0IF9UcCBfX2EsIGNvbnN0IF9UcCBfX3MpCisgICAgeworICAgICAgX1RwIF9femV0YSA9IF9UcCgwKTsKKworICAgICAgY29uc3QgX1RwIF9fZXBzID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjplcHNpbG9uKCk7CisgICAgICAvLyAgTWF4IGUgZXhwb25lbnQgYmVmb3JlIG92ZXJmbG93LgorICAgICAgY29uc3QgX1RwIF9fbWF4X2JpbmNvZWZmID0gc3RkOjpudW1lcmljX2xpbWl0czxfVHA+OjptYXhfZXhwb25lbnQxMAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICogc3RkOjpsb2coX1RwKDEwKSkgLSBfVHAoMSk7CisKKyAgICAgIGNvbnN0IHVuc2lnbmVkIGludCBfX21heGl0ID0gMTAwMDA7CisgICAgICBmb3IgKHVuc2lnbmVkIGludCBfX2kgPSAwOyBfX2kgPCBfX21heGl0OyArK19faSkKKyAgICAgICAgeworICAgICAgICAgIGJvb2wgX19wdW50ID0gZmFsc2U7CisgICAgICAgICAgX1RwIF9fc2duID0gX1RwKDEpOworICAgICAgICAgIF9UcCBfX3Rlcm0gPSBfVHAoMCk7CisgICAgICAgICAgZm9yICh1bnNpZ25lZCBpbnQgX19qID0gMDsgX19qIDw9IF9faTsgKytfX2opCisgICAgICAgICAgICB7CisjaWYgX0dMSUJDWFhfVVNFX0M5OV9NQVRIX1RSMQorICAgICAgICAgICAgICBfVHAgX19iaW5jb2VmZiA9ICBzdGQ6OnRyMTo6bGdhbW1hKF9UcCgxICsgX19pKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gc3RkOjp0cjE6OmxnYW1tYShfVHAoMSArIF9faikpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHN0ZDo6dHIxOjpsZ2FtbWEoX1RwKDEgKyBfX2kgLSBfX2opKTsKKyNlbHNlCisgICAgICAgICAgICAgIF9UcCBfX2JpbmNvZWZmID0gIF9fbG9nX2dhbW1hKF9UcCgxICsgX19pKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gX19sb2dfZ2FtbWEoX1RwKDEgKyBfX2opKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBfX2xvZ19nYW1tYShfVHAoMSArIF9faSAtIF9faikpOworI2VuZGlmCisgICAgICAgICAgICAgIGlmIChfX2JpbmNvZWZmID4gX19tYXhfYmluY29lZmYpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgLy8gIFRoaXMgb25seSBnZXRzIGhpdCBmb3IgeCA8PCAwLgorICAgICAgICAgICAgICAgICAgX19wdW50ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgX19iaW5jb2VmZiA9IHN0ZDo6ZXhwKF9fYmluY29lZmYpOworICAgICAgICAgICAgICBfX3Rlcm0gKz0gX19zZ24gKiBfX2JpbmNvZWZmICogc3RkOjpwb3coX1RwKF9fYSArIF9faiksIC1fX3MpOworICAgICAgICAgICAgICBfX3NnbiAqPSBfVHAoLTEpOworICAgICAgICAgICAgfQorICAgICAgICAgIGlmIChfX3B1bnQpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3Rlcm0gLz0gX1RwKF9faSArIDEpOworICAgICAgICAgIGlmIChzdGQ6OmFicyhfX3Rlcm0gLyBfX3pldGEpIDwgX19lcHMpCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBfX3pldGEgKz0gX190ZXJtOworICAgICAgICB9CisKKyAgICAgIF9femV0YSAvPSBfX3MgLSBfVHAoMSk7CisKKyAgICAgIHJldHVybiBfX3pldGE7CisgICAgfQorCisKKyAgICAvKioKKyAgICAgKiAgIEBicmllZiAgUmV0dXJuIHRoZSBIdXJ3aXR6IHpldGEgZnVuY3Rpb24gQGYkIFx6ZXRhKHgscykgQGYkCisgICAgICogICAgICAgICAgIGZvciBhbGwgcyAhPSAxIGFuZCB4ID4gLTEuCisgICAgICogCisgICAgICogICBUaGUgSHVyd2l0eiB6ZXRhIGZ1bmN0aW9uIGlzIGRlZmluZWQgYnk6CisgICAgICogICBAZlsKKyAgICAgKiAgICAgXHpldGEoeCxzKSA9IFxzdW1fe249MH1ee1xpbmZ0eX0gXGZyYWN7MX17KG4gKyB4KV5zfQorICAgICAqICAgQGZdCisgICAgICogICBUaGUgUmllbWFubiB6ZXRhIGZ1bmN0aW9uIGlzIGEgc3BlY2lhbCBjYXNlOgorICAgICAqICAgQGZbCisgICAgICogICAgIFx6ZXRhKHMpID0gXHpldGEoMSxzKQorICAgICAqICAgQGZdCisgICAgICovCisgICAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorICAgIGlubGluZSBfVHAKKyAgICBfX2h1cndpdHpfemV0YShjb25zdCBfVHAgX19hLCBjb25zdCBfVHAgX19zKQorICAgIHsKKyAgICAgIHJldHVybiBfX2h1cndpdHpfemV0YV9nbG9iKF9fYSwgX19zKTsKKyAgICB9CisKKyAgX0dMSUJDWFhfRU5EX05BTUVTUEFDRV9WRVJTSU9OCisgIH0gLy8gbmFtZXNwYWNlIHN0ZDo6dHIxOjpfX2RldGFpbAorfQorfQorCisjZW5kaWYgLy8gX0dMSUJDWFhfVFIxX1JJRU1BTk5fWkVUQV9UQ0MKZGlmZiAtLWdpdCBhLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2luY2x1ZGUvdHIxL3NoYXJlZF9wdHIuaCBiLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzd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X19yLmdldCgpLCBfU3BfZGVsZXRlcjxfVHA+KCkpKQorICAgICAgICB7IF9fci5yZWxlYXNlKCk7IH0KKworICAgICAgLy8gVGhyb3cgYmFkX3dlYWtfcHRyIHdoZW4gX19yLl9NX2dldF91c2VfY291bnQoKSA9PSAwLgorICAgICAgZXhwbGljaXQKKyAgICAgIF9fc2hhcmVkX2NvdW50KGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX3IpOworICAKKyAgICAgIH5fX3NoYXJlZF9jb3VudCgpIC8vIG5vdGhyb3cKKyAgICAgIHsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV9yZWxlYXNlKCk7CisgICAgICB9CisgICAgICAKKyAgICAgIF9fc2hhcmVkX2NvdW50KGNvbnN0IF9fc2hhcmVkX2NvdW50JiBfX3IpCisgICAgICA6IF9NX3BpKF9fci5fTV9waSkgLy8gbm90aHJvdworICAgICAgeworCWlmIChfTV9waSAhPSAwKQorCSAgX01fcGktPl9NX2FkZF9yZWZfY29weSgpOworICAgICAgfQorICAKKyAgICAgIF9fc2hhcmVkX2NvdW50JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IF9fc2hhcmVkX2NvdW50JiBfX3IpIC8vIG5vdGhyb3cKKyAgICAgIHsKKwlfU3BfY291bnRlZF9iYXNlPF9McD4qIF9fdG1wID0gX19yLl9NX3BpOworCWlmIChfX3RtcCAhPSBfTV9waSkKKwkgIHsKKwkgICAgaWYgKF9fdG1wICE9IDApCisJICAgICAgX190bXAtPl9NX2FkZF9yZWZfY29weSgpOworCSAgICBpZiAoX01fcGkgIT0gMCkKKwkgICAgICBfTV9waS0+X01fcmVsZWFzZSgpOworCSAgICBfTV9waSA9IF9fdG1wOworCSAgfQorCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgCisgICAgICB2b2lkCisgICAgICBfTV9zd2FwKF9fc2hhcmVkX2NvdW50JiBfX3IpIC8vIG5vdGhyb3cKKyAgICAgIHsKKwlfU3BfY291bnRlZF9iYXNlPF9McD4qIF9fdG1wID0gX19yLl9NX3BpOworCV9fci5fTV9waSA9IF9NX3BpOworCV9NX3BpID0gX190bXA7CisgICAgICB9CisgIAorICAgICAgbG9uZworICAgICAgX01fZ2V0X3VzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICAgIHsgcmV0dXJuIF9NX3BpICE9IDAgPyBfTV9waS0+X01fZ2V0X3VzZV9jb3VudCgpIDogMDsgfQorCisgICAgICBib29sCisgICAgICBfTV91bmlxdWUoKSBjb25zdCAvLyBub3Rocm93CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9nZXRfdXNlX2NvdW50KCkgPT0gMTsgfQorICAgICAgCisgICAgICBmcmllbmQgaW5saW5lIGJvb2wKKyAgICAgIG9wZXJhdG9yPT0oY29uc3QgX19zaGFyZWRfY291bnQmIF9fYSwgY29uc3QgX19zaGFyZWRfY291bnQmIF9fYikKKyAgICAgIHsgcmV0dXJuIF9fYS5fTV9waSA9PSBfX2IuX01fcGk7IH0KKyAgCisgICAgICBmcmllbmQgaW5saW5lIGJvb2wKKyAgICAgIG9wZXJhdG9yPChjb25zdCBfX3NoYXJlZF9jb3VudCYgX19hLCBjb25zdCBfX3NoYXJlZF9jb3VudCYgX19iKQorICAgICAgeyByZXR1cm4gc3RkOjpsZXNzPF9TcF9jb3VudGVkX2Jhc2U8X0xwPio+KCkoX19hLl9NX3BpLCBfX2IuX01fcGkpOyB9CisgIAorICAgICAgdm9pZCoKKyAgICAgIF9NX2dldF9kZWxldGVyKGNvbnN0IHN0ZDo6dHlwZV9pbmZvJiBfX3RpKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fcGkgPyBfTV9waS0+X01fZ2V0X2RlbGV0ZXIoX190aSkgOiAwOyB9CisKKyAgICBwcml2YXRlOgorICAgICAgZnJpZW5kIGNsYXNzIF9fd2Vha19jb3VudDxfTHA+OworCisgICAgICBfU3BfY291bnRlZF9iYXNlPF9McD4qICBfTV9waTsKKyAgICB9OworCisKKyAgdGVtcGxhdGU8X0xvY2tfcG9saWN5IF9McD4KKyAgICBjbGFzcyBfX3dlYWtfY291bnQKKyAgICB7CisgICAgcHVibGljOgorICAgICAgX193ZWFrX2NvdW50KCkKKyAgICAgIDogX01fcGkoMCkgLy8gbm90aHJvdworICAgICAgeyB9CisgIAorICAgICAgX193ZWFrX2NvdW50KGNvbnN0IF9fc2hhcmVkX2NvdW50PF9McD4mIF9fcikKKyAgICAgIDogX01fcGkoX19yLl9NX3BpKSAvLyBub3Rocm93CisgICAgICB7CisJaWYgKF9NX3BpICE9IDApCisJICBfTV9waS0+X01fd2Vha19hZGRfcmVmKCk7CisgICAgICB9CisgICAgICAKKyAgICAgIF9fd2Vha19jb3VudChjb25zdCBfX3dlYWtfY291bnQ8X0xwPiYgX19yKQorICAgICAgOiBfTV9waShfX3IuX01fcGkpIC8vIG5vdGhyb3cKKyAgICAgIHsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV93ZWFrX2FkZF9yZWYoKTsKKyAgICAgIH0KKyAgICAgIAorICAgICAgfl9fd2Vha19jb3VudCgpIC8vIG5vdGhyb3cKKyAgICAgIHsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV93ZWFrX3JlbGVhc2UoKTsKKyAgICAgIH0KKyAgICAgIAorICAgICAgX193ZWFrX2NvdW50PF9McD4mCisgICAgICBvcGVyYXRvcj0oY29uc3QgX19zaGFyZWRfY291bnQ8X0xwPiYgX19yKSAvLyBub3Rocm93CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlpZiAoX190bXAgIT0gMCkKKwkgIF9fdG1wLT5fTV93ZWFrX2FkZF9yZWYoKTsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV93ZWFrX3JlbGVhc2UoKTsKKwlfTV9waSA9IF9fdG1wOyAgCisJcmV0dXJuICp0aGlzOworICAgICAgfQorICAgICAgCisgICAgICBfX3dlYWtfY291bnQ8X0xwPiYKKyAgICAgIG9wZXJhdG9yPShjb25zdCBfX3dlYWtfY291bnQ8X0xwPiYgX19yKSAvLyBub3Rocm93CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlpZiAoX190bXAgIT0gMCkKKwkgIF9fdG1wLT5fTV93ZWFrX2FkZF9yZWYoKTsKKwlpZiAoX01fcGkgIT0gMCkKKwkgIF9NX3BpLT5fTV93ZWFrX3JlbGVhc2UoKTsKKwlfTV9waSA9IF9fdG1wOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fc3dhcChfX3dlYWtfY291bnQ8X0xwPiYgX19yKSAvLyBub3Rocm93CisgICAgICB7CisJX1NwX2NvdW50ZWRfYmFzZTxfTHA+KiBfX3RtcCA9IF9fci5fTV9waTsKKwlfX3IuX01fcGkgPSBfTV9waTsKKwlfTV9waSA9IF9fdG1wOworICAgICAgfQorICAKKyAgICAgIGxvbmcKKyAgICAgIF9NX2dldF91c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgICB7IHJldHVybiBfTV9waSAhPSAwID8gX01fcGktPl9NX2dldF91c2VfY291bnQoKSA6IDA7IH0KKworICAgICAgZnJpZW5kIGlubGluZSBib29sCisgICAgICBvcGVyYXRvcj09KGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX2EsIGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX2IpCisgICAgICB7IHJldHVybiBfX2EuX01fcGkgPT0gX19iLl9NX3BpOyB9CisgICAgICAKKyAgICAgIGZyaWVuZCBpbmxpbmUgYm9vbAorICAgICAgb3BlcmF0b3I8KGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX2EsIGNvbnN0IF9fd2Vha19jb3VudDxfTHA+JiBfX2IpCisgICAgICB7IHJldHVybiBzdGQ6Omxlc3M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hdGlvbiB3aGVuIF9UcCBpcyBbY3YtcXVhbF0gdm9pZC4KKyAgICAgIHR5cGVuYW1lIHN0ZDo6dHIxOjphZGRfcmVmZXJlbmNlPF9UcD46OnR5cGUKKyAgICAgIG9wZXJhdG9yKigpIGNvbnN0IC8vIG5ldmVyIHRocm93cworICAgICAgeworCV9HTElCQ1hYX0RFQlVHX0FTU0VSVChfTV9wdHIgIT0gMCk7CisJcmV0dXJuICpfTV9wdHI7CisgICAgICB9CisKKyAgICAgIF9UcCoKKyAgICAgIG9wZXJhdG9yLT4oKSBjb25zdCAvLyBuZXZlciB0aHJvd3MKKyAgICAgIHsKKwlfR0xJQkNYWF9ERUJVR19BU1NFUlQoX01fcHRyICE9IDApOworCXJldHVybiBfTV9wdHI7CisgICAgICB9CisgICAgCisgICAgICBfVHAqCisgICAgICBnZXQoKSBjb25zdCAvLyBuZXZlciB0aHJvd3MKKyAgICAgIHsgcmV0dXJuIF9NX3B0cjsgfQorCisgICAgICAvLyBJbXBsaWNpdCBjb252ZXJzaW9uIHRvICJib29sIgorICAgIHByaXZhdGU6CisgICAgICB0eXBlZGVmIF9UcCogX19zaGFyZWRfcHRyOjoqX191bnNwZWNpZmllZF9ib29sX3R5cGU7CisKKyAgICBwdWJsaWM6CisgICAgICBvcGVyYXRvciBfX3Vuc3BlY2lmaWVkX2Jvb2xfdHlwZSgpIGNvbnN0IC8vIG5ldmVyIHRocm93cworICAgICAgeyByZXR1cm4gX01fcHRyID09IDAgPyAwIDogJl9fc2hhcmVkX3B0cjo6X01fcHRyOyB9CisKKyAgICAgIGJvb2wKKyAgICAgIHVuaXF1ZSgpIGNvbnN0IC8vIG5ldmVyIHRocm93cworICAgICAgeyByZXR1cm4gX01fcmVmY291bnQuX01fdW5pcXVlKCk7IH0KKworICAgICAgbG9uZworICAgICAgdXNlX2NvdW50KCkgY29uc3QgLy8gbmV2ZXIgdGhyb3dzCisgICAgICB7IHJldHVybiBfTV9yZWZjb3VudC5fTV9nZXRfdXNlX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VkX3B0cjxfVHAsIF9McD4mIF9fcCkKKyAgICB7CisgICAgICBfX29zIDw8IF9fcC5nZXQoKTsKKyAgICAgIHJldHVybiBfX29zOworICAgIH0KKworICAvLyAyLjIuMy4xMCBzaGFyZWRfcHRyIGdldF9kZWxldGVyIChleHBlcmltZW50YWwpCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9EZWwsIHR5cGVuYW1lIF9UcCwgX0xvY2tfcG9saWN5IF9McD4KKyAgICBpbmxpbmUgX0RlbCoKKyAgICBnZXRfZGVsZXRlcihjb25zdCBfX3NoYXJlZF9wdHI8X1RwLCBfTHA+JiBfX3ApCisgICAgeworI2lmZGVmIF9fR1hYX1JUVEkKKyAgICAgIHJldHVybiBzdGF0aWNfY2FzdDxfRGVsKj4oX19wLl9NX2dldF9kZWxldGVyKHR5cGVpZChfRGVsKSkpOworI2Vsc2UKKyAgICAgIHJldHVybiAwOworI2VuZGlmCisgICAgfQorCisKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwLCBfTG9ja19wb2xpY3kgX0xwPgorICAgIGNsYXNzIF9fd2Vha19wdHIKKyAgICB7CisgICAgcHVibGljOgorICAgICAgdHlwZWRlZiBfVHAgZWxlbWVudF90eXBlOworICAgICAgCisgICAgICBfX3dlYWtfcHRyKCkKKyAgICAgIDogX01fcHRyKDApLCBfTV9yZWZjb3VudCgpIC8vIG5ldmVyIHRocm93cworICAgICAgeyB9CisKKyAgICAgIC8vIEdlbmVyYXRlZCBjb3B5IGNvbnN0cnVjdG9yLCBhc3NpZ25tZW50LCBkZXN0cnVjdG9yIGFyZSBmaW5lLgorICAgICAgCisgICAgICAvLyBUaGUgIm9idmlvdXMiIGNvbnZlcnRpbmcgY29uc3RydWN0b3IgaW1wbGVtZW50YXRpb246CisgICAgICAvLworICAgICAgLy8gIHRlbXBsYXRlPHR5cGVuYW1lIF9UcDE+CisgICAgICAvLyAgICBfX3dlYWtfcHRyKGNvbnN0IF9fd2Vha19wdHI8X1RwMSwgX0x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pcyk7CisJICB9CisJX19jYXRjaChjb25zdCBiYWRfd2Vha19wdHImKQorCSAgeworCSAgICAvLyBROiBIb3cgY2FuIHdlIGdldCBoZXJlPworCSAgICAvLyBBOiBBbm90aGVyIHRocmVhZCBtYXkgaGF2ZSBpbnZhbGlkYXRlZCByIGFmdGVyIHRoZQorCSAgICAvLyAgICB1c2VfY291bnQgdGVzdCBhYm92ZS4KKwkgICAgcmV0dXJuIF9fc2hhcmVkX3B0cjxlbGVtZW50X3R5cGUsIF9McD4oKTsKKwkgIH0KKwkKKyNlbHNlCisJLy8gT3B0aW1pemF0aW9uOiBhdm9pZCB0cnkvY2F0Y2ggb3ZlcmhlYWQgd2hlbiBzaW5nbGUgdGhyZWFkZWQuCisJcmV0dXJuIGV4cGlyZWQoKSA/IF9fc2hhcmVkX3B0cjxlbGVtZW50X3R5cGUsIF9McD4oKQorCSAgICAgICAgICAgICAgICAgOiBfX3NoYXJlZF9wdHI8ZWxlbWVudF90eXBlLCBfTHA+KCp0aGlzKTsKKworI2VuZGlmCisgICAgICB9IC8vIFhYWCBNVAorCisgICAgICBsb25nCisgICAgICB1c2VfY291bnQoKSBjb25zdCAvLyBuZXZlciB0aHJvd3MKKyAgICAgIHsgcmV0dXJuIF9NX3JlZmNvdW50Ll9NX2dldF91c2VfY291bnQoKTsgfQorCisgICAgICBib29sCisgICAgICBleHBpcmVkKCkgY29uc3QgLy8gbmV2ZXIgdGhyb3dzCisgICAgICB7IHJldHVybiBfTV9yZWZjb3VudC5fTV9nZXRfdXNlX2NvdW50KCkgPT0gMDsgfQorICAgICAgCisgICAgICB2b2lkCisgICAgICByZXNldCgpIC8vIG5ldmVyIHRocm93cworICAgICAgeyBfX3dlYWtfcHRyKCkuc3dhcCgqdGhpcyk7IH0KKworICAgICAgdm9pZAorICAgICAgc3dhcChfX3dlYWtfcHRyJiBfX3MpIC8vIG5ldmVyIHRocm93cworICAgICAgeworCXN0ZDo6c3dhcChfTV9wdHIsIF9fcy5fTV9wdHIp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BfX2xocywgY29uc3QgX193ZWFrX3B0cjxfVHAxLCBfTHA+JiBfX3JocykKKyAgICAgICAgeyByZXR1cm4gX19saHMuX01fbGVzcyhfX3Jocyk7IH0KKworICAgICAgX1RwKiAgICAgICAJIF9NX3B0cjsgICAgICAgICAvLyBDb250YWluZWQgcG9pbnRlci4KKyAgICAgIF9fd2Vha19jb3VudDxfTHA+ICBfTV9yZWZjb3VudDsgICAgLy8gUmVmZXJlbmNlIGNvdW50ZXIuCisgICAgfTsKKworICAvLyAyLjIuNC43IHdlYWtfcHRyIHNwZWNpYWxpemVkIGFsZ29yaXRobXMuCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgX0xvY2tfcG9saWN5IF9McD4KKyAgICBpbmxpbmUgdm9pZAorICAgIHN3YXAoX193ZWFrX3B0cjxfVHAsIF9McD4mIF9fYSwgX193ZWFrX3B0cjxfVHAsIF9McD4mIF9fYikKKyAgICB7IF9fYS5zd2FwKF9fYik7IH0KKworCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcCwgX0xvY2tfcG9saWN5IF9McD4KKyAgICBjbGFzcyBfX2VuYWJsZV9zaGFyZWRfZnJvbV90aGlzCisgICAgeworICAgIHByb3RlY3RlZDoKKyAgICAgIF9fZW5hYmxlX3NoYXJlZF9mcm9tX3RoaXMoKSB7IH0KKyAgICAgIAorICAgICAgX19lbmFibGVfc2hhcmVkX2Zyb21fdGhpcyhjb25zdCBfX2VuYWJsZV9zaGFyZWRfZnJvbV90aGlzJikgeyB9CisgICAgICAKKyAgICAgIF9fZW5hYmxlX3NoYXJlZF9mcm9tX3RoaXMmCisgICAgICBvcGVyYXRvcj0oY29uc3QgX19lbmFibGVfc2hhcmVkX2Zyb21fdGhpcyYpCisgICAgICB7IHJldHVybiAqdGhpczsgfQorCisgICAgICB+X19lbmFibGVfc2hhcmVkX2Zyb21fdGhpcygpIHsgfQorICAgICAgCisgICAgcHVibGljOgorICAgICAgX19zaGFyZWRfcHRyPF9UcCwgX0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ltcGw8X19pLCBfSGVhZCwgX1RhaWwuLi4+JiBfX3QpCisgICAgeworICAgICAgcmV0dXJuIF9fdC5fTV9oZWFkOworICAgIH0KKworICAvLyBSZXR1cm4gYSByZWZlcmVuY2UgKGNvbnN0IHJlZmVyZW5jZSkgdG8gdGhlIGl0aCBlbGVtZW50IG9mIGEgdHVwbGUuCisgIC8vIEFueSBjb25zdCBvciBub24tY29uc3QgcmVmIGVsZW1lbnRzIGFyZSByZXR1cm5lZCB3aXRoIHRoZWlyIG9yaWdpbmFsIHR5cGUuCisgIHRlbXBsYXRlPGludCBfX2ksIHR5cGVuYW1lLi4uIF9FbGVtZW50cz4KKyAgICBpbmxpbmUgdHlwZW5hbWUgX19hZGRfcmVmPAorICAgICAgICAgICAgICAgICAgICAgIHR5cGVuYW1lIHR1cGxlX2VsZW1lbnQ8X19pLCB0dXBsZTxfRWxlbWVudHMuLi4+ID46OnR5cGUKKyAgICAgICAgICAgICAgICAgICAgPjo6dHlwZQorICAgIGdldCh0dXBsZTxfRWxlbWVudHMuLi4+JiBfX3QpCisgICAgeyAKKyAgICAgIHJldHVybiBfX2dldF9oZWxwZXI8X19pPihfX3QpOyAKKyAgICB9CisKKyAgdGVtcGxhdGU8aW50IF9faSwgdHlwZW5hbWUuLi4gX0VsZW1lbnRzPgorICAgIGlubGluZSB0eXBlbmFtZSBfX2FkZF9jX3JlZjwKKyAgICAgICAgICAgICAgICAgICAgICB0eXBlbmFtZSB0dXBsZV9lbGVtZW50PF9faSwgdHVwbGU8X0VsZW1lbnRzLi4uPiA+Ojp0eXBlCisgICAgICAgICAgICAgICAgICAgID46OnR5cGUKKyAgICBnZXQoY29uc3QgdHVwbGU8X0VsZW1lbnRzLi4uPiYgX190KQorICAgIHsKKyAgICAgIHJldHVybiBfX2dldF9oZWxwZXI8X19pPihfX3QpOworICAgIH0KKworICAvLyBUaGlzIGNsYXNzIGhlbHBzIGNvbnN0cnVjdCB0aGUgdmFyaW91cyBjb21wYXJpc29uIG9wZX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FtbWluZworICAgKiBAeworICAgKi8KKworICBzdHJ1Y3QgX19zZmluYWVfdHlwZXMKKyAgeworICAgIHR5cGVkZWYgY2hhciBfX29uZTsKKyAgICB0eXBlZGVmIHN0cnVjdCB7IGNoYXIgX19hcnJbMl07IH0gX190d287CisgIH07CisKKyNkZWZpbmUgX0RFRklORV9TUEVDXzBfSEVMUEVSICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlPD4KKworI2RlZmluZSBfREVGSU5FX1NQRUNfMV9IRUxQRVIgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPgorCisjZGVmaW5lIF9ERUZJTkVfU1BFQ18yX0hFTFBFUiAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIHR5cGVuYW1lIF9DcD4KKworI2RlZmluZSBfREVGSU5FX1NQRUMoX09yZGVyLCBfVHJhaXQsIF9UeXBlLCBfVmFsdWUpICAgIFwKKyAgX0RFRklORV9TUEVDXyMjX09yZGVyIyNfSEVMUEVSICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgc3RydWN0IF9UcmFpdDxfVHlwZT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIDogcHVibGljIGludGVncmFsX2NvbnN0YW50PGJvb2wsIF9WYWx1ZT4geyB9OworCisgIC8vIGhlbHBlciBjbGFzc2VzIFs0LjNdLgorCisgIC8vLyBpbnRlZ3JhbF9jb25zdGFudAorICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVHAsIF9UcCBfX3Y+CisgICAgc3RydWN0IGludGVncmFsX2NvbnN0YW50CisgICAgeworICAgICAgc3RhdGljIGNvbnN0IF9UcCAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IF9fdjsKKyAgICAgIHR5cGVkZWYgX1RwICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgI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vLy8gIENvbnZlcnNpb24gdG8gYm9vbC4KKyAgICAvL2V4cGxpY2l0CisgICAgb3BlcmF0b3IgYm9vbCgpIGNvbnN0CisgICAgeworICAgICAgaWYgKCEgaXNfc2luZ2xldG9uKCkpCisJdGhyb3cgc3RkOjpiYWRfY2FzdCgpOworICAgICAgcmV0dXJuIF9NX2I7CisgICAgfQorCisgICAgLy8vCisgICAgc3RhdGljIGJvb2xfc2V0IGluZGV0ZXJtaW5hdGUoKQorICAgIHsKKyAgICAgIGJvb2xfc2V0IF9fYjsKKyAgICAgIF9fYi5fTV9iID0gX1NfaW5kZXQ7CisgICAgICByZXR1cm4gX19iOworICAgIH0KKworICAgIC8vLworICAgIHN0YXRpYyBib29sX3NldCBlbXB0eXNldCgpCisgICAgeworICAgICAgYm9vbF9zZXQgX19iOworICAgICAgX19iLl9NX2IgPSBfU19lbXB0eTsKKyAgICAgIHJldHVybiBfX2I7CisgICAgfQorCisgICAgZnJpZW5kIGJvb2xfc2V0CisgICAgb3BlcmF0b3IhKGJvb2xfc2V0IF9fYikKKyAgICB7IHJldHVybiBfX2IuX01fbm90KCk7IH0KKworICAgIGZyaWVuZCBib29sX3NldAorICAgIG9wZXJhdG9yXihib29sX3NldCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgICB7IHJldHVybiBfX3MuX01feG9yKF9fdCk7IH0KKworICAgIGZyaWVuZCBib29sX3NldAorICAgIG9wZXJhdG9yfChib29sX3NldCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgICB7IHJldHVybiBfX3MuX01fb3IoX190KTsgfQorCisgICAgZnJpZW5kIGJvb2xfc2V0CisgICAgb3BlcmF0b3ImKGJvb2xfc2V0IF9fcywgYm9vbF9zZXQgX190KQorICAgIHsgcmV0dXJuIF9fcy5fTV9hbmQoX190KTsgfQorCisgICAgZnJpZW5kIGJvb2xfc2V0CisgICAgb3BlcmF0b3I9PShib29sX3NldCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgICB7IHJldHVybi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01fYjsKKworICAgIC8vLworICAgIGJvb2xfc2V0KF9Cb29sX3NldF92YWwgX19jKSA6IF9NX2IoX19jKSB7IH0KKworICAgIC8vLworICAgIGJvb2xfc2V0IF9NX25vdCgpIGNvbnN0CisgICAgeyByZXR1cm4gX1Nfbm90W3RoaXMtPl9NX2JdOyB9CisKKyAgICAvLy8KKyAgICBib29sX3NldCBfTV94b3IoYm9vbF9zZXQgX19iKSBjb25zdAorICAgIHsgcmV0dXJuIF9TX3hvclt0aGlzLT5fTV9iXVtfX2IuX01fYl07IH0KKworICAgIC8vLworICAgIGJvb2xfc2V0IF9NX29yKGJvb2xfc2V0IF9fYikgY29uc3QKKyAgICB7IHJldHVybiBfU19vclt0aGlzLT5fTV9iXVtfX2IuX01fYl07IH0KKworICAgIC8vLworICAgIGJvb2xfc2V0IF9NX2FuZChib29sX3NldCBfX2IpIGNvbnN0CisgICAgeyByZXR1cm4gX1NfYW5kW3RoaXMtPl9NX2JdW19fYi5fTV9iXTsgfQorCisgICAgLy8vCisgICAgYm9vbF9zZXQgX01fZXEoYm9vbF9zZXQgX19iKSBjb25zdAorICAgIHsgcmV0dXJuIF9TX2VxW3RoaXMtPl9NX2JdW19fYi5fTV9iXTsgfQorCisgICAgLy8vCisgICAgc3RhdGljIF9Cb29sX3NldF92YWwgX1Nfbm90WzRdOworCisgICAgLy8vCisgICAgc3RhdGljIF9Cb29sX3NldF92YWwgX1NfeG9yWzRdWzRdOworCisgICAgLy8vCisgICAgc3RhdGljIF9Cb29sX3NldF92YWwgX1Nfb3JbNF1bNF07CisKKyAgICAvLy8KKyAgICBzdGF0aWMgX0Jvb2xfc2V0X3ZhbCBfU19hbmRbNF1bNF07CisKKyAgICAvLy8KKyAgICBzdGF0aWMgX0Jvb2xfc2V0X3ZhbCBfU19lcVs0XVs0XTsKKyAgfTsKKworICAvLyAgMjAuMi4zLjIgYm9vbF9zZXQgdmFsdWVzCisKKyAgaW5saW5lIGJvb2wKKyAgY29udGFpbnMoYm9vbF9zZXQgX19zLCBib29sX3NldCBfX3QpCisgIHsgcmV0dXJuIF9fcy5jb250YWlucyhfX3QpOyB9CisKKyAgaW5saW5lIGJvb2wKKyAgZXF1YWxzKGJvb2xfc2V0IF9fcywgYm9vbF9zZXQgX190KQorICB7IHJldHVybiBfX3MuZXF1YWxzKF9fdCk7IH0KKworICBpbmxpbmUgYm9vbAorICBpc19lbXB0eXNldChib29sX3NldCBfX2IpCisgIHsgcmV0dXJuIF9fYi5pc19lbXB0eXNldCgpOyB9CisKKyAgaW5saW5lIGJvb2wKKyAgaXNfaW5kZXRlcm1pbmF0ZShib29sX3NldCBfX2IpCisgIHsgcmV0dXJuIF9fYi5pc19pbmRldGVybWluYXRlKCk7IH0KKworICBpbmxpbmUgYm9vbAorICBpc19zaW5nbGV0b24oYm9vbF9zZXQgX19iKQorICB7IHJldHVybiBfX2IuaXNfc2luZ2xldG9uKCk7IH0KKworICBpbmxpbmUgYm9vbAorICBjZXJ0YWlubHkoYm9vbF9zZXQgX19iKQorICB7IHJldHVybiAhIF9fYi5jb250YWlucyhmYWxzZSk7IH0KKworICBpbmxpbmUgYm9vbAorICBwb3NzaWJseShib29sX3NldCBfX2IpCisgIHsgcmV0dXJuIF9fYi5jb250YWlucyh0cnVlKTsgfQorCisKKyAgLy8gIDIwLjIuMy4zIGJvb2xfc2V0IHNldCBvcGVyYXRpb25zCisKKyAgaW5saW5lIGJvb2xfc2V0CisgIHNldF91bmlvbihib29sIF9fcywgYm9vbF9zZXQgX190KQorICB7IHJldHVybiBib29sX3NldChfX3MpIHwgX190OyB9CisKKyAgaW5saW5lIGJvb2xfc2V0CisgIHNldF91bmlvbihib29sX3NldCBfX3MsIGJvb2wgX190KQorICB7IHJldHVybiBfX3MgfCBib29sX3NldChfX3QpOyB9CisKKyAgaW5saW5lIGJvb2xfc2V0CisgIHNldF91bmlvbihib29sX3NldCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gX19zIHwgX190OyB9CisKKyAgaW5saW5lIGJvb2xfc2V0CisgIHNldF9pbnRlcnNlY3Rpb24oYm9vbCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gYm9vbF9zZXQoX19zKSAmIF9fdDsgfQorCisgIGlubGluZSBib29sX3NldAorICBzZXRfaW50ZXJzZWN0aW9uKGJvb2xfc2V0IF9fcywgYm9vbCBfX3QpCisgIHsgcmV0dXJuIF9fcyAmIGJvb2xfc2V0KF9fdCk7IH0KKworICBpbmxpbmUgYm9vbF9zZXQKKyAgc2V0X2ludGVyc2VjdGlvbihib29sX3NldCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gX19zICYgX190OyB9CisKKyAgaW5saW5lIGJvb2xfc2V0CisgIHNldF9jb21wbGVtZW50KGJvb2xfc2V0IF9fYikKKyAgeyByZXR1cm4gISBfX2I7IH0KKworCisgIC8vICAyMC4yLjMuNCBib29sX3NldCBsb2dpY2FsIG9wZXJhdG9ycworCisgIGlubGluZSBib29sX3NldAorICBvcGVyYXRvcl4oYm9vbCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gYm9vbF9zZXQoX19zKSBeIF9fdDsgfQorCisgIGlubGluZSBib29sX3NldAorICBvcGVyYXRvcl4oYm9vbF9zZXQgX19zLCBib29sIF9fdCkKKyAgeyByZXR1cm4gX19zIF4gYm9vbF9zZXQoX190KTsgfQorCisgIGlubGluZSBib29sX3NldAorICBvcGVyYXRvcnwoYm9vbCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gYm9vbF9zZXQoX19zKSB8IF9fdDsgfQorCisgIGlubGluZSBib29sX3NldAorICBvcGVyYXRvcnwoYm9vbF9zZXQgX19zLCBib29sIF9fdCkKKyAgeyByZXR1cm4gX19zIHwgYm9vbF9zZXQoX190KTsgfQorCisgIGlubGluZSBib29sX3NldAorICBvcGVyYXRvciYoYm9vbCBfX3MsIGJvb2xfc2V0IF9fdCkKKyAgeyByZXR1cm4gY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sb2MgYWxsb2NhdG9yX3R5cGU7CisgICAgICB0eXBlZGVmIHNpemVfdCBzaXplX3R5cGU7CisKKyAgICAgIHN0YXRpYyBjb25zdCBzaXplX3R5cGUgX1NfYml0c19wZXJfYmxvY2sgPSBfX0NIQVJfQklUX18gKiBzaXplb2YoYmxvY2tfdHlwZSk7CisgICAgICBzdGF0aWMgY29uc3Qgc2l6ZV90eXBlIG5wb3MgPSBzdGF0aWNfY2FzdDxzaXplX3R5cGU+KC0xKTsKKworICAgICAgLy8vIDAgaXMgdGhlIGxlYXN0IHNpZ25pZmljYW50IHdvcmQuCisgICAgICBzdGQ6OnZlY3RvcjxibG9ja190eXBlLCBhbGxvY2F0b3JfdHlwZT4gX01fdzsKKworICAgICAgZXhwbGljaXQKKyAgICAgIF9fZHluYW1pY19iaXRzZXRfYmFzZShjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hbGxvYyA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9NX3coX19hbGxvYykKKyAgICAgIHsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgX19keW5hbWljX2JpdHNldF9iYXNlKF9fZHluYW1pY19iaXRzZXRfYmFzZSYmIF9fYikKKyAgICAgIHsgdGhpcy0+X01fdy5zd2FwKF9fYi5fTV93KTsgfQorCisgICAgICBleHBsaWNpdAorICAgICAgX19keW5hbWljX2JpdHNldF9iYXNlKHNpemVfdHlwZSBfX25iaXRzLCB1bnNpZ25lZCBsb25nIGxvbmcgX192YWwgPSAwVUxMLAorCQkJICAgY29uc3QgYWxsb2NhdG9yX3R5cGUmIF9fYWxsb2MgPSBhbGxvY2F0b3JfdHlwZSgpKQorICAgICAgOiBfTV93KF9fbmJpdHMgLyBfU19iaXRzX3Blcl9ibG9jaworCSAgICAgKyAoX19uYml0cyAlIF9TX2JpdHNfcGVyX2Jsb2NrID4gMCksCisJICAgICBfX3ZhbCwgX19hbGxvYykKKyAgICAgIHsKKwl1bnNpZ25lZCBsb25nIGxvbmcgX19tYXNrID0gfnN0YXRpY19jYXN0PGJsb2NrX3R5cGU+KDApOworCXNpemVfdCBfX24gPSBzdGQ6Om1pbih0aGlzLT5fTV93LnNpemUoKSwKKwkJCSAgICAgIHNpemVvZih1bnNpZ25lZCBsb25nIGxvbmcpIC8gc2l6ZW9mKGJsb2NrX3R5cGUpKTsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfX247ICsrX19pKQorCSAgeworCSAgICB0aGlzLT5fTV93W19faV0gPSAoX192YWwgJiBfX21hc2spID4+IChfX2kgKiBfU19iaXRzX3Blcl9ibG9jayk7CisJICAgIF9fbWFzayA8PD0gX1NfYml0c19wZXJfYmxvY2s7CisJICB9CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2Fzc2lnbihjb25zdCBfX2R5bmFtaWNfYml0c2V0X2Jhc2UmIF9fYikKKyAgICAgIHsgdGhpcy0+X01fdyA9IF9fYi5fTV93OyB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX3N3YXAoX19keW5hbWljX2JpdHNldF9iYXNlJiBfX2IpCisgICAgICB7IHRoaXMtPl9NX3cuc3dhcChfX2IuX01fdyk7IH0KKworICAgICAgdm9pZAorICAgICAgX01fY2xlYXIoKQorICAgICAgeyB0aGlzLT5fTV93LmNsZWFyKCk7IH0KKworICAgICAgdm9pZAorICAgICAgX01fcmVzaXplKHNpemVfdCBfX25iaXRzLCBib29sIF9fdmFsdWUpCisgICAgICB7CisJc2l6ZV90IF9fc3ogPSBfX25iaXRzIC8gX1NfYml0c19wZXJfYmxvY2s7CisJaWYgKF9fbmJpdHMgJSBfU19iaXRzX3Blcl9ibG9jayA+IDApCisJICArK19fc3o7CisJaWYgKF9fc3ogIT0gdGhpcy0+X01fdy5zaXplKCkpCisJICB0aGlzLT5fTV93LnJlc2l6ZShfX3N6KTsKKyAgICAgIH0KKworICAgICAgYWxsb2NhdG9yX3R5cGUKKyAgICAgIF9NX2dldF9hbGxvY2F0b3IoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fdy5nZXRfYWxsb2NhdG9yKCk7IH0KKworICAgICAgc3RhdGljIHNpemVfdHlwZQorICAgICAgX1Nfd2hpY2h3b3JkKHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsgcmV0dXJuIF9fcG9zIC8gX1NfYml0c19wZXJfYmxvY2s7IH0KKworICAgICAgc3RhdGljIHNpemVfdHlwZQorICAgICAgX1Nfd2hpY2hieXRlKHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsgcmV0dXJuIChfX3BvcyAlIF9TX2JpdHNfcGVyX2Jsb2NrKSAvIF9fQ0hBUl9CSVRfXzsgfQorCisgICAgICBzdGF0aWMgc2l6ZV90eXBlCisgICAgICBfU193aGljaGJpdChzaXplX3R5cGUgX19wb3MpCisgICAgICB7IHJldHVybiBfX3BvcyAlIF9TX2JpdHNfcGVyX2Jsb2NrOyB9CisKKyAgICAgIHN0YXRpYyBibG9ja190eXBlCisgICAgICBfU19tYXNrYml0KHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsgcmV0dXJuIChzdGF0aWNfY2FzdDxibG9ja190eXBlPigxKSkgPDwgX1Nfd2hpY2hiaXQoX19wb3MpOyB9CisKKyAgICAgIGJsb2NrX3R5cGUmCisgICAgICBfTV9nZXR3b3JkKHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX3dbX1Nfd2hpY2h3b3JkKF9fcG9zKV07IH0KKworICAgICAgYmxvY2tfdHlwZQorICAgICAgX01fZ2V0d29yZChzaXplX3R5cGUgX19wb3MpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV93W19TX3doaWNod29yZChfX3BvcyldOyB9CisKKyAgICAgIGJsb2NrX3R5cGUmCisgICAgICBfTV9oaXdvcmQoKQorICAgICAgeyByZXR1cm4gdGhpcy0+X01fd1tfTV93LnNpemUoKSAtIDFdOyB9CisKKyAgICAgIGJsb2NrX3R5cGUKKyAgICAgIF9NX2hpd29yZCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV93W19NX3cuc2l6ZSgpIC0gMV07IH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fYW5kKGNvbnN0IF9fZHluYW1pY19iaXRzZXRfYmFzZSYgX194KQorICAgICAgeworCWlmIChfX3guX01fdy5zaXplKCkgPT0gdGhpcy0+X01fdy5zaXplKCkpCisJICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCB0aGlzLT5fTV93LnNpemUoKTsgKytfX2kpCisJICAgIHRoaXMtPl9NX3dbX19pXSAmPSBfX3guX01fd1tfX2ldOworCWVsc2UKKwkgIHJldHVybjsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fb3IoY29uc3QgX19keW5hbWljX2JpdHNldF9iYXNlJiBfX3gpCisgICAgICB7CisJaWYgKF9feC5fTV93LnNpemUoKSA9PSB0aGlzLT5fTV93LnNpemUoKSkKKwkgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IHRoaXMtPl9NX3cuc2l6ZSgpOyArK19faSkKKwkgICAgdGhpcy0+X01fd1tfX2ldIHw9IF9feC5fTV93W19faV07CisJZWxzZQorCSAgcmV0dXJuOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb194b3IoY29uc3QgX19keW5hbWljX2JpdHNldF9iYXNlJiBfX3gpCisgICAgICB7CisJaWYgKF9feC5fTV93LnNpemUoKSA9PSB0aGlzLT5fTV93LnNpemUoKSkKKwkgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IHRoaXMtPl9NX3cuc2l6ZSgpOyArK19faSkKKwkgICAgdGhpcy0+X01fd1tfX2ldIF49IF9feC5fTV93W19faV07CisJZWxzZQorCSAgcmV0dXJuOworICAgICAgfQorCisgICAgICB2b2lkCisgICAgICBfTV9kb19kaWYoY29uc3QgX19keW5hbWljX2JpdHNldF9iYXNlJiBfX3gpCisgICAgICB7CisJaWYgKF9feC5fTV93LnNpemUoKSA9PSB0aGlzLT5fTV93LnNpemUoKSkKKwkgIGZvciAoc2l6ZV90IF9faSA9IDA7IF9faSA8IHRoaXMtPl9NX3cuc2l6ZSgpOyArK19faSkKKwkgICAgdGhpcy0+X01fd1tfX2ldICY9IH5fX3guX01fd1tfX2ldOworCWVsc2UKKwkgIHJldHVybjsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fbGVmdF9zaGlmdChzaXplX3QgX19zaGlmdCk7CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3JpZ2h0X3NoaWZ0KHNpemVfdCBfX3NoaWZ0KTsKKworICAgICAgdm9pZAorICAgICAgX01fZG9fZmxpcCgpCisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgdGhpcy0+X01fdy5zaXplKCk7ICsrX19pKQorCSAgdGhpcy0+X01fd1tfX2ldID0gfnRoaXMtPl9NX3dbX19pXTsKKyAgICAgIH0KKworICAgICAgdm9pZAorICAgICAgX01fZG9fc2V0KCkKKyAgICAgIHsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCB0aGlzLT5fTV93LnNpemUoKTsgKytfX2kpCisJICB0aGlzLT5fTV93W19faV0gPSB+c3RhdGljX2Nhc3Q8YmxvY2tfdHlwZT4oMCk7CisgICAgICB9CisKKyAgICAgIHZvaWQKKyAgICAgIF9NX2RvX3Jlc2V0KCkKKyAgICAgIHsKKwlmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCB0aGlzLT5fTV93LnNpemUoKTsgKytfX2kpCisJICB0aGlzLT5fTV93W19faV0gPSBzdGF0aWNfY2FzdDxibG9ja190eXBlPigwKTsKKyAgICAgIH0KKworICAgICAgYm9vbAorICAgICAgX01faXNfZXF1YWwoY29uc3QgX19keW5hbWljX2JpdHNldF9iYXNlJiBfX3gpIGNvbnN0CisgICAgICB7CisJaWYgKF9feC5zaXplKCkgPT0gdGhpcy0+c2l6ZSgpKQorCSAgeworCSAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCB0aGlzLT5fTV93LnNpemUoKTsgKytfX2kpCisJICAgICAgaWYgKHRoaXMtPl9NX3dbX19pXSAhPSBfX3guX01fd1tfX2ldKQorCQlyZXR1cm4gZmFsc2U7CisJICAgIHJldHVybiB0cnVlOworCSAgfQorCWVsc2UKKwkgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKworICAgICAgYm9vbAorICAgICAgX01faXNfbGVzcyhjb25zdCBfX2R5bmFtaWNfYml0c2V0X2Jhc2UmIF9feCkgY29uc3QKKyAgICAgIHsKKwlpZiAoX194LnNpemUoKSA9PSB0aGlzLT5zaXplKCkpCisJICB7CisJICAgIGZvciAoc2l6ZV90IF9faSA9IHRoaXMtPl9NX3cuc2l6ZSgpOyBfX2kgPiAwOyAtLV9faSkKKwkgICAgICB7CisJCWlmICh0aGlzLT5fTV93W19faS0xXSA8IF9feC5fTV93W19faS0xXSkKKwkJICByZXR1cm4gdHJ1ZTsKKwkJZWxzZSBpZiAodGhpcy0+X01fd1tfX2ktMV0gPiBfX3guX01fd1tfX2ktMV0pCisJCSAgcmV0dXJuIGZhbHNlOworCSAgICAgIH0KKwkgICAgcmV0dXJuIGZhbHNlOworCSAgfQorCWVsc2UKKwkgIHJldHVybiBmYWxzZTsKKyAgICAgIH0KKworICAgICAgc2l6ZV90CisgICAgICBfTV9hcmVfYWxsX2F1eCgpIGNvbnN0CisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgdGhpcy0+X01fdy5zaXplKCkgLSAxOyArK19faSkKKwkgIGlmIChfTV93W19faV0gIT0gfnN0YXRpY19jYXN0PGJsb2NrX3R5cGU+KDApKQorCSAgICByZXR1cm4gMDsKKwlyZXR1cm4gKCh0aGlzLT5fTV93LnNpemUoKSAtIDEpICogX1NfYml0c19wZXJfYmxvY2sKKwkJKyBfX2J1aWx0aW5fcG9wY291bnRsKHRoaXMtPl9NX2hpd29yZCgpKSk7CisgICAgICB9CisKKyAgICAgIGJvb2wKKyAgICAgIF9NX2lzX2FueSgpIGNvbnN0CisgICAgICB7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgdGhpcy0+X01fdy5zaXplKCk7ICsrX19pKQorCSAgaWYgKHRoaXMtPl9NX3dbX19pXSAhPSBzdGF0aWNfY2FzdDxibG9ja190eXBlPigwKSkKKwkgICAgcmV0dXJuIHRydWU7CisJcmV0dXJuIGZhbHNlOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBfTV9pc19zdWJzZXRfb2YoY29uc3QgX19keW5hbWljX2JpdHNldF9iYXNlJiBfX2IpCisgICAgICB7CisJaWYgKF9fYi5zaXplKCkgPT0gdGhpcy0+c2l6ZSgpKQorCSAgeworCSAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCBfTV93LnNpemUoKTsgKytfX2kpCisJICAgICAgaWYgKHRoaXMtPl9NX3dbX19pXSAhPSAodGhpcy0+X01fd1tfX2ldIHwgX19iLl9NX3dbX19pXSkpCisJCXJldHVybiBmYWxzZTsKKwkgICAgcmV0dXJuIHRydWU7CisJICB9CisJZWxzZQorCSAgcmV0dXJuIGZhbHNlOworICAgICAgfQorCisgICAgICBib29sCisgICAgICBfTV9pc19wcm9wZXJfc3Vic2V0X29mKGNvbnN0IF9fZHluYW1pY19iaXRzZXRfYmFzZSYgX19iKSBjb25zdAorICAgICAgeworCWlmICh0aGlzLT5pc19zdWJzZXRfb2YoX19iKSkKKwkgIHsKKwkgICAgaWYgKCp0aGlzID09IF9fYikKKwkgICAgICByZXR1cm4gZmFsc2U7CisJICAgIGVsc2UKKwkgICAgICByZXR1cm4gdHJ1ZTsKKwkgIH0KKwllbHNlCisJICByZXR1cm4gZmFsc2U7CisgICAgICB9CisKKyAgICAgIHNpemVfdAorICAgICAgX01fZG9fY291bnQoKSBjb25zdAorICAgICAgeworCXNpemVfdCBfX3Jlc3VsdCA9IDA7CisJZm9yIChzaXplX3QgX19pID0gMDsgX19pIDwgdGhpcy0+X01fdy5zaXplKCk7ICsrX19pKQorCSAgX19yZXN1bHQgKz0gX19idWlsdGluX3BvcGNvdW50bCh0aGlzLT5fTV93W19faV0pOworCXJldHVybiBfX3Jlc3VsdDsKKyAgICAgIH0KKworICAgICAgc2l6ZV90eXBlCisgICAgICBfTV9zaXplKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX3cuc2l6ZSgpOyB9CisKKyAgICAgIHVuc2lnbmVkIGxvbmcKKyAgICAgIF9NX2RvX3RvX3Vsb25nKCkgY29uc3Q7CisKKyAgICAgIHVuc2lnbmVkIGxvbmcgbG9uZworICAgICAgX01fZG9fdG9fdWxsb25nKCkgY29uc3Q7CisKKyAgICAgIC8vIGZpbmQgZmlyc3QgIm9uIiBiaXQKKyAgICAgIHNpemVfdHlwZQorICAgICAgX01fZG9fZmluZF9maXJzdChzaXplX3QgX19ub3RfZm91bmQpIGNvbnN0OworCisgICAgICAvLyBmaW5kIHRoZSBuZXh0ICJvbiIgYml0IHRoYXQgZm9sbG93cyAicHJldiIKKyAgICAgIHNpemVfdHlwZQorICAgICAgX01fZG9fZmluZF9uZXh0KHNpemVfdCBfX3ByZXYsIHNpemVfdCBfX25vdF9mb3VuZCkgY29uc3Q7CisKKyAgICAgIC8vIGRvIGFwcGVuZCBvZiBibG9jaworICAgICAgdm9pZAorICAgICAgX01fZG9fYXBwZW5kX2Jsb2NrKGJsb2NrX3R5cGUgX19ibG9jaywgc2l6ZV90eXBlIF9fcG9zKQorICAgICAgeworCXNpemVfdCBfX29mZnNldCA9IF9fcG9zICUgX1NfYml0c19wZXJfYmxvY2s7CisJaWYgKF9fb2Zmc2V0ID09IDApCisJICB0aGlzLT5fTV93LnB1c2hfYmFjayhfX2Jsb2NrKTsKKwllbHNlCisJICB7CisJICAgIHRoaXMtPl9NX2hpd29yZCgpIHw9IChfX2Jsb2NrIDw8IF9fb2Zmc2V0KTsKKwkgICAgdGhpcy0+X01fdy5wdX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ICB7CisgICAgICBmb3IgKHNpemVfdCBfX2kgPSAwOyBfX2kgPCB0aGlzLT5fTV93LnNpemUoKTsgKytfX2kpCisJeworCSAgX1dvcmRUIF9fdGhpc3dvcmQgPSB0aGlzLT5fTV93W19faV07CisJICBpZiAoX190aGlzd29yZCAhPSBzdGF0aWNfY2FzdDxfV29yZFQ+KDApKQorCSAgICByZXR1cm4gKF9faSAqIF9TX2JpdHNfcGVyX2Jsb2NrCisJCSAgICArIF9fYnVpbHRpbl9jdHpsKF9fdGhpc3dvcmQpKTsKKwl9CisgICAgICAvLyBub3QgZm91bmQsIHNvIHJldHVybiBhbiBpbmRpY2F0aW9uIG9mIGZhaWx1cmUuCisgICAgICByZXR1cm4gX19ub3RfZm91bmQ7CisgICAgfQorCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9Xb3JkVCwgdHlwZW5hbWUgX0FsbG9jPgorICAgIHNpemVfdAorICAgIF9fZHluYW1pY19iaXRzZXRfYmFzZTxfV29yZFQsIF9BbGxvYz4KKyAgICA6Ol9NX2RvX2ZpbmRfbmV4dChzaXplX3QgX19wcmV2LCBzaXplX3QgX19ub3RfZm91bmQpIGNvbnN0CisgICAgeworICAgICAgLy8gbWFrZSBib3VuZCBpbmNsdXNpdmUKKyAgICAgICsrX19wcmV2OworCisgICAgICAvLyBjaGVjayBvdXQgb2YgYm91bmRzCisgICAgICBpZiAoX19wcmV2ID49IHRoaXMtPl9NX3cuc2l6ZSgpICogX1NfYml0c19wZXJfYmxvY2spCisJcmV0dXJuIF9fbm90X2ZvdW5kOworCisgICAgICAvLyBzZWFyY2ggZmlyc3Qgd29yZAorICAgICAgc2l6ZV90IF9faSA9IF9TX3doaWNod29yZChfX3ByZXYpOworICAgICAgX1dvcmRUIF9fdGhpc3dvcmQgPSB0aGlzLT5fTV93W19faV07CisKKyAgICAgIC8vIG1hc2sgb2ZmIGJpdHMgYmVsb3cgYm91bmQKKyAgICAgIF9fdGhpc3dvcmQgJj0gKH5zdGF0aWNfY2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ICogIHBvc2l0aW9uLiAgVGh1cywgdW5saWtlIG90aGVyIGNvbnRhaW5lcnMsIGEgJWR5bmFtaWNfYml0c2V0J3MKKyAgICogIGluZGV4ICJjb3VudHMgZnJvbSByaWdodCB0byBsZWZ0LCIgdG8gcHV0IGl0IHZlcnkgbG9vc2VseS4KKyAgICoKKyAgICogIFRoaXMgYmVoYXZpb3IgaXMgcHJlc2VydmVkIHdoZW4gdHJhbnNsYXRpbmcgdG8gYW5kIGZyb20gc3RyaW5ncy4KKyAgICogIEZvciBleGFtcGxlLCB0aGUgZmlyc3QgbGluZSBvZiB0aGUgZm9sbG93aW5nIHByb2dyYW0gcHJvYmFibHkKKyAgICogIHByaW50cyAiYignYScpIGlzIDAwMDExMDAwMDEiIG9uIGEgbW9kZXJuIEFTQ0lJIHN5c3RlbS4KKyAgICoKKyAgICogIEBjb2RlCisgICAqICAgICAjaW5jbHVkZSA8ZHluYW1pY19iaXRzZXQ+CisgICAqICAgICAjaW5jbHVkZSA8aW9zdHJlYW0+CisgICAqICAgICAjaW5jbHVkZSA8c3N0cmVhbT4KKyAgICoKKyAgICogICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CisgICAqCisgICAqICAgICBpbnQgbWFpbigpCisgICAqICAgICB7CisgICAqICAgICAgICAgbG9uZyAgICAgICAgIGEgPSAnYSc7CisgICAqICAgICAgICAgZHluYW1pY19iaXRzZXQgICBiKGEpOworICAgKgorICAgKiAgICAgICAgIGNvdXQgPDwgImIoJ2EnKSBpcyAiIDw8IGIgPDwgZW5kbDsKKyAgICoKKyAgICogICAgICAgICBvc3RyaW5nc3RyZWFtIHM7CisgICAqICAgICAgICAgcyA8PCBiOworICAgKiAgICAgICAgIHN0cmluZyAgc3RyID0gcy5zdHIoKTsKKyAgICogICAgICAgICBjb3V0IDw8ICJpbmRleCAzIGluIHRoZSBzdHJpbmcgaXMgIiA8PCBzdHJbM10gPDwgIiBidXRcbiIKKyAgICogICAgICAgICAgICAgIDw8ICJpbmRleC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+X01faGl3b3JkKCkgJj0gfigofnN0YXRpY19jYXN0PGJsb2NrX3R5cGU+KDApKSA8PCBfX3NoaWZ0KTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgVGhlc2UgdmVyc2lvbnMgb2Ygc2luZ2xlLWJpdCBzZXQsIHJlc2V0LCBmbGlwLCBhbmQgdGVzdAorICAgICAgICogIGRvIG5vIHJhbmdlIGNoZWNraW5nLgorICAgICAgICovCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBfTV91bmNoZWNrZWRfc2V0KHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsKKwl0aGlzLT5fTV9nZXR3b3JkKF9fcG9zKSB8PSBfQmFzZTo6X1NfbWFza2JpdChfX3Bvcyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBfTV91bmNoZWNrZWRfc2V0KHNpemVfdHlwZSBfX3BvcywgaW50IF9fdmFsKQorICAgICAgeworCWlmIChfX3ZhbCkKKwkgIHRoaXMtPl9NX2dldHdvcmQoX19wb3MpIHw9IF9CYXNlOjpfU19tYXNrYml0KF9fcG9zKTsKKwllbHNlCisJICB0aGlzLT5fTV9nZXR3b3JkKF9fcG9zKSAmPSB+X0Jhc2U6Ol9TX21hc2tiaXQoX19wb3MpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgX01fdW5jaGVja2VkX3Jlc2V0KHNpemVfdHlwZSBfX3BvcykKKyAgICAgIHsKKwl0aGlzLT5fTV9nZXR3b3JkKF9fcG9zKSAmPSB+X0Jhc2U6Ol9TX21hc2tiaXQoX19wb3MpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgIC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yZXNpemUodGhpcy0+X01fTmIpOworCSAgdGhpcy0+X01fY29weV9mcm9tX3N0cmluZyhfX3N0ciwgX19wb3MsIF9fbiwKKwkJCQkgICAgX0NoYXJUKCcwJyksIF9DaGFyVCgnMScpKTsKKwl9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQ29uc3RydWN0IGZyb20gYSBzdHJpbmcuCisgICAgICAgKiAgQHBhcmFtICBfX3N0ciAgQSBzdHJpbmcgb2YgJzAnIGFuZCAnMScgY2hhcmFjdGVycy4KKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6aW52YWxpZF9hcmd1bWVudCAgSWYgYSBjaGFyYWN0ZXIgYXBwZWFycyBpbiB0aGUgc3RyaW5nCisgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWNoIGlzIG5laXRoZXIgJzAnIG5vciAnMScuCisgICAgICAgKi8KKyAgICAgIGV4cGxpY2l0CisgICAgICBkeW5hbWljX2JpdHNldChjb25zdCBjaGFyKiBfX3N0ciwKKwkJICAgICBjb25zdCBhbGxvY2F0b3JfdHlwZSYgX19hbGxvYyA9IGFsbG9jYXRvcl90eXBlKCkpCisgICAgICA6IF9CYXNlKF9fYWxsb2MpCisgICAgICB7CisJc2l6ZV90IF9fbGVuID0gMDsKKwlpZiAoX19zdHIpCisJICB3aGlsZSAoX19zdHJbX19sZW5dICE9ICdcMCcpCisJICAgICsrX19sZW47CisJdGhpcy0+cmVzaXplKF9fbGVuKTsKKwl0aGlzLT5fTV9jb3B5X2Zyb21fcHRyPGNoYXIsc3RkOjpjaGFyX3RyYWl0czxjaGFyPj4KKwkJICAgKF9fc3RyLCBfX2xlbiwgMCwgX19sZW4sICcwJywgJzEnKTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBDb3B5IGNvbnN0cnVjdG9yLgorICAgICAgICovCisgICAgICBkeW5hbWljX2JpdHNldChjb25zdCBkeW5hbWljX2JpdHNldCYgX19iKQorICAgICAgOiBfQmFzZShfX2IpLCBfTV9OYihfX2Iuc2l6ZSgpKQorICAgICAgeyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgTW92ZSBjb25zdHJ1Y3Rvci4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQoZHluYW1pY19iaXRzZXQmJiBfX2IpCisgICAgICA6IF9CYXNlKHN0ZDo6Zm9yd2FyZDxfQmFzZT4oX19iKSksIF9NX05iKF9fYi5zaXplKCkpCisgICAgICB7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBTd2FwIHdpdGggYW5vdGhlciBiaXRzZXQuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHN3YXAoZHluYW1pY19iaXRzZXQmIF9fYikKKyAgICAgIHsKKwl0aGlzLT5fTV9zd2FwKF9fYik7CisJc3RkOjpzd2FwKHRoaXMtPl9NX05iLCBfX2IuX01fTmIpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFzc2lnbm1lbnQuCisgICAgICAgKi8KKyAgICAgIGR5bmFtaWNfYml0c2V0JgorICAgICAgb3BlcmF0b3I9KGNvbnN0IGR5bmFtaWNfYml0c2V0JiBfX2IpCisgICAgICB7CisJaWYgKCZfX2IgIT0gdGhpcykKKwkgIHsKKwkgICAgdGhpcy0+X01fYXNzaWduKF9fYik7CisJICAgIHRoaXMtPl9NX05iID0gX19iLl9NX05iOworCSAgfQorICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE1vdmUgYXNzaWdubWVudC4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQmCisgICAgICBvcGVyYXRvcj0oZHluYW1pY19iaXRzZXQmJiBfX2IpCisgICAgICB7CisJdGhpcy0+c3dhcChfX2IpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gdGhlIGFsbG9jYXRvciBmb3IgdGhlIGJpdHNldC4KKyAgICAgICAqLworICAgICAgYWxsb2NhdG9yX3R5cGUKKyAgICAgIGdldF9hbGxvY2F0b3IoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fZ2V0X2FsbG9jYXRvcigpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmVzaXplIHRoZSBiaXRzZXQuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHJlc2l6ZShzaXplX3R5cGUgX19uYml0cywgYm9vbCBfX3ZhbHVlID0gZmFsc2UpCisgICAgICB7CisJdGhpcy0+X01fcmVzaXplKF9fbmJpdHMsIF9fdmFsdWUpOworCXRoaXMtPl9NX05iID0gX19uYml0czsKKwl0aGlzLT5fTV9kb19zYW5pdGl6ZSgpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIENsZWFyIHRoZSBiaXRzZXQuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIGNsZWFyKCkKKyAgICAgIHsKKwl0aGlzLT5fTV9jbGVhcigpOworCXRoaXMtPl9NX05iID0gMDsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBQdXNoIGEgYml0IG9udG8gdGhlIGhpZ2ggZW5kIG9mIHRoZSBiaXRzZXQuCisgICAgICAgKi8KKyAgICAgIHZvaWQKKyAgICAgIHB1c2hfYmFjayhib29sIF9fYml0KQorICAgICAgeworCWlmIChzaXplX3QgX19vZmZzZXQgPSB0aGlzLT5zaXplKCkgJSBiaXRzX3Blcl9ibG9jayA9PSAwKQorCSAgdGhpcy0+X01fZG9fYXBwZW5kX2Jsb2NrKGJsb2NrX3R5cGUoMCksIHRoaXMtPl9NX05iKTsKKwkrK3RoaXMtPl9NX05iOworCXRoaXMtPl9NX3VuY2hlY2tlZF9zZXQodGhpcy0+X01fTmIsIF9fYml0KTsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBcHBlbmQgYSBibG9jay4KKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgYXBwZW5kKGJsb2NrX3R5cGUgX19ibG9jaykKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19hcHBlbmRfYmxvY2soX19ibG9jaywgdGhpcy0+X01fTmIpOworCXRoaXMtPl9NX05iICs9IGJpdHNfcGVyX2Jsb2NrOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYKKyAgICAgICAqLworICAgICAgdm9pZAorICAgICAgYXBwZW5kKGluaXRpYWxpemVyX2xpc3Q8YmxvY2tfdHlwZT4gX19pbCkKKyAgICAgIHsgdGhpcy0+YXBwZW5kKF9faWwuYmVnaW4oKSwgX19pbC5lbmQoKSk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBcHBlbmQgYW4gaXRlcmF0b3IgcmFuZ2Ugb2YgYmxvY2tzLgorICAgICAgICovCisgICAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgX0Jsb2NrSW5wdXRJdGVyYXRvcj4KKwl2b2lkCisJYXBwZW5kKF9CbG9ja0lucHV0SXRlcmF0b3IgX19maXJzdCwgX0Jsb2NrSW5wdXRJdGVyYXRvciBfX2xhc3QpCisJeworCSAgZm9yICg7IF9fZmlyc3QgIT0gX19sYXN0OyArK19fZmlyc3QpCisJICAgIHRoaXMtPmFwcGVuZCgqX19maXJzdCk7CisJfQorCisgICAgICAvLyAyMy4zLjUuMiBkeW5hbWljX2JpdHNldCBvcGVyYXRpb25zOgorICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBPcGVyYXRpb25zIG9uIGR5bmFtaWNfYml0c2V0cy4KKyAgICAgICAqICBAcGFyYW0gIF9fcmhzICBBIHNhbWUtc2l6ZWQgZHluYW1pY19iaXRzZXQuCisgICAgICAgKgorICAgICAgICogIFRoZXNlIHNob3VsZCBiZSBzZWxmLWV4cGxhbmF0b3J5LgorICAgICAgICovCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBvcGVyYXRvciY9KGNvbnN0IGR5bmFtaWNfYml0c2V0PF9Xb3JkVCwgX0FsbG9jPiYgX19yaHMpCisgICAgICB7CisJdGhpcy0+X01fZG9fYW5kKF9fcmhzKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGR5bmFtaWNfYml0c2V0PF9Xb3JkVCwgX0FsbG9jPiYKKyAgICAgIG9wZXJhdG9yJj0oZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JiYgX19yaHMpCisgICAgICB7CisJdGhpcy0+X01fZG9fYW5kKHN0ZDo6bW92ZShfX3JocykpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgb3BlcmF0b3J8PShjb25zdCBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mIF9fcmhzKQorICAgICAgeworCXRoaXMtPl9NX2RvX29yKF9fcmhzKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIGR5bmFtaWNfYml0c2V0PF9Xb3JkVCwgX0FsbG9jPiYKKyAgICAgIG9wZXJhdG9yXj0oY29uc3QgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JiBfX3JocykKKyAgICAgIHsKKwl0aGlzLT5fTV9kb194b3IoX19yaHMpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgb3BlcmF0b3ItPShjb25zdCBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mIF9fcmhzKQorICAgICAgeworCXRoaXMtPl9NX2RvX2RpZihfX3Jocyk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorICAgICAgLy9AfQorCisgICAgICAvL0B7CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE9wZXJhdGlvbnMgb24gZHluYW1pY19iaXRzZXRzLgorICAgICAgICogIEBwYXJhbSAgX19wb3MgVGhlIG51bWJlciBvZiBwbGFjZXMgdG8gc2hpZnQuCisgICAgICAgKgorICAgICAgICogIFRoZXNlIHNob3VsZCBiZSBzZWxmLWV4cGxhbmF0b3J5LgorICAgICAgICovCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBvcGVyYXRvcjw8PShzaXplX3R5cGUgX19wb3MpCisgICAgICB7CisJaWYgKF9fYnVpbHRpbl9leHBlY3QoX19wb3MgPCB0aGlzLT5fTV9OYiwgMSkpCisJICB7CisJICAgIHRoaXMtPl9NX2RvX2xlZnRfc2hpZnQoX19wb3MpOworCSAgICB0aGlzLT5fTV9kb19zYW5pdGl6ZSgpOworCSAgfQorCWVsc2UKKwkgIHRoaXMtPl9NX2RvX3Jlc2V0KCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBvcGVyYXRvcj4+PShzaXplX3R5cGUgX19wb3MpCisgICAgICB7CisJaWYgKF9fYnVpbHRpbl9leHBlY3QoX19wb3MgPCB0aGlzLT5fTV9OYiwgMSkpCisJICB7CisJICAgIHRoaXMtPl9NX2RvX3JpZ2h0X3NoaWZ0KF9fcG9zKTsKKwkgICAgdGhpcy0+X01fZG9fc2FuaXRpemUoKTsKKwkgIH0KKwllbHNlCisJICB0aGlzLT5fTV9kb19yZXNldCgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKyAgICAgIC8vQH0KKworICAgICAgLy8gU2V0LCByZXNldCwgYW5kIGZsaXAuCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgU2V0cyBldmVyeSBiaXQgdG8gdHJ1ZS4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgc2V0KCkKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19zZXQoKTsKKwl0aGlzLT5fTV9kb19zYW5pdGl6ZSgpOworCXJldHVybiAqdGhpczsKKyAgICAgIH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFNldHMgYSBnaXZlbiBiaXQgdG8gYSBwYXJ0aWN1bGFyIHZhbHVlLgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIFRoZSBpbmRleCBvZiB0aGUgYml0LgorICAgICAgICogIEBwYXJhbSAgX192YWwgIEVpdGhlciB0cnVlIG9yIGZhbHNlLCBkZWZhdWx0cyB0byB0cnVlLgorICAgICAgICogIEB0aHJvdyAgc3RkOjpvdXRfb2ZfcmFuZ2UgIElmIEBhIF9fcG9zIGlzIGJpZ2dlciB0aGUgc2l6ZSBvZiB0aGUgJXNldC4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgc2V0KHNpemVfdHlwZSBfX3BvcywgYm9vbCBfX3ZhbCA9IHRydWUpCisgICAgICB7CisJaWYgKF9fcG9zID49IF9NX05iKQorCSAgX190aHJvd19vdXRfb2ZfcmFuZ2UoX19OKCJkeW5hbWljX2JpdHNldDo6c2V0IikpOworCXJldHVybiB0aGlzLT5fTV91bmNoZWNrZWRfc2V0KF9fcG9zLCBfX3ZhbCk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBTZXRzIGV2ZXJ5IGJpdCB0byBmYWxzZS4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgcmVzZXQoKQorICAgICAgeworCXRoaXMtPl9NX2RvX3Jlc2V0KCk7CisJcmV0dXJuICp0aGlzOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgU2V0cyBhIGdpdmVuIGJpdCB0byBmYWxzZS4KKyAgICAgICAqICBAcGFyYW0gIF9fcG9zICBUaGUgaW5kZXggb2YgdGhlIGJpdC4KKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6b3V0X29mX3JhbmdlICBJZiBAYSBfX3BvcyBpcyBiaWdnZXIgdGhlIHNpemUgb2YgdGhlICVzZXQuCisgICAgICAgKgorICAgICAgICogIFNhbWUgYXMgd3JpdGluZyBAYyBzZXQoX19wb3MsIGZhbHNlKS4KKyAgICAgICAqLworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+JgorICAgICAgcmVzZXQoc2l6ZV90eXBlIF9fcG9zKQorICAgICAgeworCWlmIChfX3BvcyA+PSBfTV9OYikKKwkgIF9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigiZHluYW1pY19iaXRzZXQ6OnJlc2V0IikpOworCXJldHVybiB0aGlzLT5fTV91bmNoZWNrZWRfcmVzZXQoX19wb3MpOworICAgICAgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgVG9nZ2xlcyBldmVyeSBiaXQgdG8gaXRzIG9wcG9zaXRlIHZhbHVlLgorICAgICAgICovCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4mCisgICAgICBmbGlwKCkKKyAgICAgIHsKKwl0aGlzLT5fTV9kb19mbGlwKCk7CisJdGhpcy0+X01fZG9fc2FuaXRpemUoKTsKKwlyZXR1cm4gKnRoaXM7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBUb2dnbGVzIGEgZ2l2ZW4gYml0IHRvIGl0cyBvcHBvc2l0ZSB2YWx1ZS4KKyAgICAgICAqICBAcGFyYW0gIF9fcG9zICBUaGUgaW5kZXggb2YgdGhlIGJpdC4KKyAgICAgICAqICBAdGhyb3cgIHN0ZDo6b3V0X29mX3JhbmdlICBJZiBAYSBfX3BvcyBpcyBiaWdnZXIgdGhlIHNpemUgb2YgdGhlICVzZXQuCisgICAgICAgKi8KKyAgICAgIGR5bmFtaWNfYml0c2V0PF9Xb3JkVCwgX0FsbG9jPiYKKyAgICAgIGZsaXAoc2l6ZV90eXBlIF9fcG9zKQorICAgICAgeworCWlmIChfX3BvcyA+PSBfTV9OYikKKwkgIF9fdGhyb3dfb3V0X29mX3JhbmdlKF9fTigiZHluYW1pY19iaXRzZXQ6OmZsaXAiKSk7CisJcmV0dXJuIHRoaXMtPl9NX3VuY2hlY2tlZF9mbGlwKF9fcG9zKTsKKyAgICAgIH0KKworICAgICAgLy8vIFNlZSB0aGUgbm8tYXJndW1lbnQgZmxpcCgpLgorICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+CisgICAgICBvcGVyYXRvcn4oKSBjb25zdAorICAgICAgeyByZXR1cm4gZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+KCp0aGlzKS5mbGlwKCk7IH0KKworICAgICAgLy9AeworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBBcnJheS1pbmRleGluZyBzdXBwb3J0LgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIEluZGV4IGludG8gdGhlICVkeW5hbWljX2JpdHNldC4KKyAgICAgICAqICBAcmV0dXJuIEEgYm9vbCBmb3IgYSAnY29uc3QgJWR5bmFtaWNfYml0c2V0Jy4gIEZvciBub24tY29uc3QKKyAgICAgICAqICAgICAgICAgICBiaXRzZXRzLCBhbiBpbnN0YW5jZSBvZiB0aGUgcmVmZXJlbmNlIHByb3h5IGNsYXNzLgorICAgICAgICogIEBub3RlIFRoZXNlIG9wZXJhdG9ycyBkbyBubyByYW5nZSBjaGVja2luZyBhbmQgdGhyb3cgbm8KKyAgICAgICAqICAgICAgICAgZXhjZXB0aW9ucywgYXMgcmVxdWlyZWQgYnkgRFIgMTEgdG8gdGhlIHN0YW5kYXJkLgorICAgICAgICovCisgICAgICByZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fcG9zKQorICAgICAgeyByZXR1cm4gcmVmZXJlbmNlKCp0aGlzLF9fcG9zKTsgfQorCisgICAgICBjb25zdF9yZWZlcmVuY2UKKyAgICAgIG9wZXJhdG9yW10oc2l6ZV90eXBlIF9fcG9zKSBjb25zdAorICAgICAgeyByZXR1cm4gX01fdW5jaGVja2VkX3Rlc3QoX19wb3MpOyB9CisgICAgICAvL0B9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBSZXR1cm5zIGEgbnVtZXJpY2FsIGludGVycHJldGF0aW9uIG9mIHRoZSAlZHluYW1pY19iaXRzZXQuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGludGVncmFsIGVxdWl2YWxlbnQgb2YgdGhlIGJpdHMuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om92ZXJmbG93X2Vycm9yICBJZiB0aGVyZSBhcmUgdG9vIG1hbnkgYml0cyB0byBiZQorICAgICAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwcmVzZW50ZWQgaW4gYW4gQGMgdW5zaWduZWQgQGMgbG9uZy4KKyAgICAgICAqLworICAgICAgdW5zaWduZWQgbG9uZworICAgICAgdG9fdWxvbmcoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01fZG9fdG9fdWxvbmcoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgUmV0dXJucyBhIG51bWVyaWNhbCBpbnRlcnByZXRhdGlvbiBvZiB0aGUgJWR5bmFtaWNfYml0c2V0LgorICAgICAgICogIEByZXR1cm4gIFRoZSBpbnRlZ3JhbCBlcXVpdmFsZW50IG9mIHRoZSBiaXRzLgorICAgICAgICogIEB0aHJvdyAgc3RkOjpvdmVyZmxvd19lcnJvciAgSWYgdGhlcmUgYXJlIHRvbyBtYW55IGJpdHMgdG8gYmUKKyAgICAgICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcHJlc2VudGVkIGluIGFuIEBjIHVuc2lnbmVkIEBjIGxvbmcuCisgICAgICAgKi8KKyAgICAgI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BudW1iZXIgb2YgYml0cyB3aGljaCBhcmUgc2V0LgorICAgICAgc2l6ZV90eXBlCisgICAgICBjb3VudCgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9kb19jb3VudCgpOyB9CisKKyAgICAgIC8vLyBSZXR1cm5zIHRoZSB0b3RhbCBudW1iZXIgb2YgYml0cy4KKyAgICAgIHNpemVfdHlwZQorICAgICAgc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiB0aGlzLT5fTV9OYjsgfQorCisgICAgICAvLy8gUmV0dXJucyB0aGUgdG90YWwgbnVtYmVyIG9mIGJsb2Nrcy4KKyAgICAgIHNpemVfdHlwZSBudW1fYmxvY2tzKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX3NpemUoKTsgfQorCisgICAgICAvLy8gUmV0dXJucyB0cnVlIGlmIHRoZSBkeW5hbWljX2JpdHNldCBpcyBlbXB0eS4KKyAgICAgIGJvb2wKKyAgICAgIGVtcHR5KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuICh0aGlzLT5fTV9OYiA9PSAwKTsgfQorCisgICAgICAvLy8gUmV0dXJucyB0aGUgbWF4aW11bSBzaXplIG9mIGEgZHluYW1pY19iaXRzZXQgb2JqZWN0IGhhdmluZyB0aGUgc2FtZQorICAgICAgLy8vIHR5cGUgYXMgKnRoaXMuCisgICAgICAvLy8gVGhlIHJlYWwgYW5zd2VyIGlzIG1heCgpICogYml0c19wZXJfYmxvY2sgYnV0IGlzIGxpa2VseSB0byBvdmVyZmxvdy4KKyAgICAgIC8qY29uc3RleHByKi8gc2l6ZV90eXBlCisgICAgICBtYXhfc2l6ZSgpIGNvbnN0CisgICAgICB7IHJldHVybiBzdGQ6Om51bWVyaWNfbGltaXRzPGJsb2NrX3R5cGU+OjptYXgoKTsgfQorCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgVGVzdHMgdGhlIHZhbHVlIG9mIGEgYml0LgorICAgICAgICogIEBwYXJhbSAgX19wb3MgIFRoZSBpbmRleCBvZiBhIGJpdC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgdmFsdWUgYXQgQGEgX19wb3MuCisgICAgICAgKiAgQHRocm93ICBzdGQ6Om91dF9vZl9yYW5nZSAgSWYgQGEgX19wb3MgaXMgYmlnZ2VyIHRoZSBzaXplIG9mIHRoZSAlc2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICB0ZXN0KHNpemVfdHlwZSBfX3BvcykgY29uc3QKKyAgICAgIHsKKwlpZiAoX19wb3MgPj0gX01fTmIpCisJICBfX3Rocm93X291dF9vZl9yYW5nZShfX04oImR5bmFtaWNfYml0c2V0Ojp0ZXN0IikpOworCXJldHVybiBfTV91bmNoZWNrZWRfdGVzdChfX3Bvcyk7CisgICAgICB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiBUZXN0cyB3aGV0aGVyIGFsbCB0aGUgYml0cyBhcmUgb24uCisgICAgICAgKiAgQHJldHVybiAgVHJ1ZSBpZiBhbGwgdGhlIGJpdHMgYXJlIHNldC4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgYWxsKCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX2FyZV9hbGxfYXV4KCkgPT0gX01fTmI7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFRlc3RzIHdoZXRoZXIgYW55IG9mIHRoZSBiaXRzIGFyZSBvbi4KKyAgICAgICAqICBAcmV0dXJuICBUcnVlIGlmIGF0IGxlYXN0IG9uZSBiaXQgaXMgc2V0LgorICAgICAgICovCisgICAgICBib29sCisgICAgICBhbnkoKSBjb25zdAorICAgICAgeyByZXR1cm4gdGhpcy0+X01faXNfYW55KCk7IH0KKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmIFRlc3RzIHdoZXRoZXIgYW55IG9mIHRoZSBiaXRzIGFyZSBvbi4KKyAgICAgICAqICBAcmV0dXJuICBUcnVlIGlmIG5vbmUgb2YgdGhlIGJpdHMgYXJlIHNldC4KKyAgICAgICAqLworICAgICAgYm9vbAorICAgICAgbm9uZSgpIGNvbnN0CisgICAgICB7IHJldHVybiAhdGhpcy0+X01faXNfYW55KCk7IH0KKworICAgICAgLy9AeworICAgICAgLy8vIFNlbGYtZXhwbGFuYXRvcnkuCisgICAgICBkeW5hbWljX2JpdHNldDxfV29yZFQsIF9BbGxvYz4KKyAgICAgIG9wZXJhdG9yPDwoc2l6ZV90eXBlIF9fcG9zKSBjb25zdAorICAgICAgeyByZXR1cm4gZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+KCp0aGlzKSA8PD0gX19wb3M7IH0KKworICAgICAgZHluYW1pY19iaXRzZXQ8X1dvcmRULCBfQWxsb2M+CisgICAgICBvcGVyYXRvcj4+KHNpemVfdHlwZSBfX3BvcykgY29uc3QKKyAgICAgIHsgcmV0dXJuIGR5bmFtaWNfYml0c2V0PF9Xb3JkVCwgX0FsbG9jPigqdGhpcykgPj49IF9fcG9zOyB9CisgICAgICAvL0B9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZHMgdGhlIGluZGV4IG9mIHRoZSBmaXJzdCAib24iIGJpdC4KKyAgICAgICAqICBAcmV0dXJuICBUaGUgaW5kZXggb2YgdGhlIGZpcnN0IGJpdCBzZXQsIG9yIHNpemUoKSBpZiBub3QgZm91bmQuCisgICAgICAgKiAgQHNhICBmaW5kX25leHQKKyAgICAgICAqLworICAgICAgc2l6ZV90eXBlCisgICAgICBmaW5kX2ZpcnN0KCkgY29uc3QKKyAgICAgIHsgcmV0dXJuIHRoaXMtPl9NX2RvX2ZpbmRfZmlyc3QodGhpcy0+X01fTmIpOyB9CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgRmluZHMgdGhlIGluZGV4IG9mIHRoZSBuZXh0ICJvbiIgYml0IGFmdGVyIHByZXYuCisgICAgICAgKiAgQHJldHVybiAgVGhlIGluZGV4IG9mIHRoZSBuZXh0IGJpd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SZXN1bHRfb2ZfaW1wbDwKKwlpc19tZW1iZXJfb2JqZWN0X3BvaW50ZXI8CisJICB0eXBlbmFtZSByZW1vdmVfcmVmZXJlbmNlPF9GdW5jdG9yPjo6dHlwZSA+Ojp2YWx1ZSwKKyAgICAgICAgaXNfbWVtYmVyX2Z1bmN0aW9uX3BvaW50ZXI8CisJICB0eXBlbmFtZSByZW1vdmVfcmVmZXJlbmNlPF9GdW5jdG9yPjo6dHlwZSA+Ojp2YWx1ZSwKKyAgICAgICAJX0Z1bmN0b3IsIF9BcmdUeXBlcy4uLj46Ol9fdHlwZQorCXR5cGU7CisgICAgfTsKKworICAvKioKKyAgICogIFVzZSBTRklOQUUgdG8gZGV0ZXJtaW5lIGlmIHRoZSB0eXBlIF9UcCBoYXMgYSBwdWJsaWNseS1hY2Nlc3NpYmxlCisgICAqICBtZW1iZXIgdHlwZSBfTlRZUEUuCisgICAqLworI2RlZmluZSBfR0xJQkNYWF9IQVNfTkVTVEVEX1RZUEUoX05UWVBFKSAgICAgICAgICAgICAgICAgICAgICAgICBcCisgIHRlbXBsYXRlPHR5cGVuYW1lIF9UcD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICBjbGFzcyBfX2hhc18jI19OVFlQRSMjX2hlbHBlciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIDogX19zZmluYWVfdHlwZXMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIF9VcD4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBzdHJ1Y3QgX1dyYXBfdHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisJeyB9OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVXA+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgc3RhdGljIF9fb25lIF9fdGVzdChfV3JhcF90eXBlPHR5cGVuYW1lIF9VcDo6X05UWVBFPiopOyAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBfVXA+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgc3RhdGljIF9fdHdvIF9fdGVzdCguLi4pOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgcHVibGljOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgIHN0YXRpYyBjb25zdGV4cHIgYm9vbCB2YWx1ZSA9IHNpemVvZihfX3Rlc3Q8X1RwPigwKSkgPT0gMTsgXAorICAgIH07ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgdGVtcGxhdGU8dHlwZW5hbWUgX1RwPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgIHN0cnVjdCBfX2hhc18jI19OVFlQRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgOiBpbnRlZ3JhbF9jb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F5KGluaXRpYWxpemVyX2xpc3Q8X1RwPik7CisjZW5kaWYKKworICAgICAgdGVtcGxhdGU8Y2xhc3MgX0RvbT4KKwl2YWxhcnJheShjb25zdCBfRXhwcjxfRG9tLCBfVHA+JiBfX2UpOworCisgICAgICB+dmFsYXJyYXkoKSBfR0xJQkNYWF9OT0VYQ0VQVDsKKworICAgICAgLy8gX2xpYi52YWxhcnJheS5hc3NpZ25fIGFzc2lnbm1lbnQ6CisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIEFzc2lnbiBlbGVtZW50cyB0byBhbiBhcnJheS4KKyAgICAgICAqCisgICAgICAgKiAgQXNzaWduIGVsZW1lbnRzIG9mIGFycmF5IHRvIHZhbHVlcyBpbiBAYSB2LgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9fdiAgVmFsYXJyYXkgdG8gZ2V0IHZhbHVlcyBmcm9tLgorICAgICAgICovCisgICAgICB2YWxhcnJheTxfVHA+JiBvcGVyYXRvcj0oY29uc3QgdmFsYXJyYXk8X1RwPiYgX192KTsKKworI2lmZGVmIF9fR1hYX0VYUEVSSU1FTlRBTF9DWFgwWF9fCisgICAgICAvKioKKyAgICAgICAqICBAYnJpZWYgIE1vdmUgYXNzaWduIGVsZW1lbnRzIHRvIGFuIGFycmF5LgorICAgICAgICoKKyAgICAgICAqICBNb3ZlIGFzc2lnbiBlbGVtZW50cyBvZiBhcnJheSB0byB2YWx1ZXMgaW4gQGEgdi4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtICBfX3YgIFZhbGFycmF5IHRvIGdldCB2YWx1ZXMgZnJvbS4KKyAgICAgICAqLworICAgICAgdmFsYXJyYXk8X1RwPiYgb3BlcmF0b3I9KHZhbGFycmF5PF9UcD4mJiBfX3YpIG5vZXhjZXB0OworI2VuZGlmCisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgQXNzaWduIGVsZW1lbnRzIHRvIGEgdmFsdWUuCisgICAgICAgKgorICAgICAgICogIEFz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dG8gYW4gaW5pdGlhbGl6ZXJfbGlzdC4KKyAgICAgICAqCisgICAgICAgKiAgQXNzaWduIGVsZW1lbnRzIG9mIGFycmF5IHRvIHZhbHVlcyBpbiBAYSBfX2wuICBSZXN1bHRzIGFyZSB1bmRlZmluZWQKKyAgICAgICAqICBpZiBAYSBfX2wgZG9lcyBub3QgaGF2ZSB0aGUgc2FtZSBzaXplIGFzIHRoaXMgYXJyYXkuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19sICBpbml0aWFsaXplcl9saXN0IHRvIGdldCB2YWx1ZXMgZnJvbS4KKyAgICAgICAqLworICAgICAgdmFsYXJyYXkmIG9wZXJhdG9yPShpbml0aWFsaXplcl9saXN0PF9UcD4gX19sKTsKKyNlbmRpZgorCisgICAgICB0ZW1wbGF0ZTxjbGFzcyBfRG9tPiB2YWxhcnJheTxfVHA+JgorCW9wZXJhdG9yPSAoY29uc3QgX0V4cHI8X0RvbSwgX1RwPiYpOworCisgICAgICAvLyBfbGliLnZhbGFycmF5LmFjY2Vzc18gZWxlbWVudCBhY2Nlc3M6CisgICAgICAvKioKKyAgICAgICAqICBSZXR1cm4gYSByZWZlcmVuY2UgdG8gdGhlIGkndGggYXJyYXkgZWxlbWVudC4gIAorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9faSAgSW5kZXggb2YgZWxlbWVudCB0byByZXR1cm4uCisgICAgICAgKiAgQHJldHVybiAgUmVmZXJlbmNlIHRvIHRoZSBpJ3RoIGVsZW1lbnQuCisgICAgICAgKi8KKyAgICAgIF9UcCYgICAgICAgICAgICAgICAgb3BlcmF0b3JbXShzaXplX3QgX19pKTsKKworICAgICAgLy8gX0dMSUJDWFhfUkVTT0xWRV9MSUJfREVGRUNUUworICAgICAgLy8gMzg5LiBDb25zdCBvdmVybG9hZCBvZiB2YWxhcnJheTo6b3BlcmF0b3JbXSByZXR1cm5zIGJ5IHZhbHVlLgorICAgICAgY29uc3QgX1RwJiAgICAgICAgICBvcGVyYXRvcltdKHNpemVfdCkgY29uc3Q7CisKKyAgICAgIC8vIF9saWIudmFsYXJyYXkuc3ViXyBzdWJzZXQgb3BlcmF0aW9uczoKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGFuIGFycmF5IHN1YnNldC4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIG5ldyB2YWxhcnJheSBjb250YWluaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIHNsaWNlIGFyZ3VtZW50LiAgVGhlIG5ldyB2YWxhcnJheSBoYXMgdGhlIHNhbWUgc2l6ZQorICAgICAgICogIGFzIHRoZSBpbnB1dCBzbGljZS4gIEBzZWUgc2xpY2UuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgc291cmNlIHNsaWNlLgorICAgICAgICogIEByZXR1cm4gIE5ldyB2YWxhcnJheSBjb250YWluaW5nIGVsZW1lbnRzIGluIEBhIF9fcy4KKyAgICAgICAqLworICAgICAgX0V4cHI8X1NDbG9zPF9WYWxBcnJheSwgX1RwPiwgX1RwPiBvcGVyYXRvcltdKHNsaWNlIF9fcykgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGEgcmVmZXJlbmNlIHRvIGFuIGFycmF5IHN1YnNldC4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIG5ldyB2YWxhcnJheSBjb250YWluaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIHNsaWNlIGFyZ3VtZW50LiAgVGhlIG5ldyB2YWxhcnJheSBoYXMgdGhlIHNhbWUgc2l6ZQorICAgICAgICogIGFzIHRoZSBpbnB1dCBzbGljZS4gIEBzZWUgc2xpY2UuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgc291cmNlIHNsaWNlLgorICAgICAgICogIEByZXR1cm4gIE5ldyB2YWxhcnJheSBjb250YWluaW5nIGVsZW1lbnRzIGluIEBhIF9fcy4KKyAgICAgICAqLworICAgICAgc2xpY2VfYXJyYXk8X1RwPiAgICBvcGVyYXRvcltdKHNsaWNlIF9fcyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGFuIGFycmF5IHN1YnNldC4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIHNsaWNlX2FycmF5IHJlZmVyZW5jaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIHNsaWNlIGFyZ3VtZW50LiAgQHNlZSBnc2xpY2UuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgc291cmNlIHNsaWNlLgorICAgICAgICogIEByZXR1cm4gIFNsaWNlX2FycmF5IHJlZmVyZW5jaW5nIGVsZW1lbnRzIGluZGljYXRlZCBieSBAYSBfX3MuCisgICAgICAgKi8KKyAgICAgIF9FeHByPF9HQ2xvczxfVmFsQXJyYXksIF9UcD4sIF9UcD4gb3BlcmF0b3JbXShjb25zdCBnc2xpY2UmIF9fcykgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGEgcmVmZXJlbmNlIHRvIGFuIGFycmF5IHN1YnNldC4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIG5ldyB2YWxhcnJheSBjb250YWluaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIGdzbGljZSBhcmd1bWVudC4gIFRoZSBuZXcgdmFsYXJyYXkgaGFzCisgICAgICAgKiAgdGhlIHNhbWUgc2l6ZSBhcyB0aGUgaW5wdXQgZ3NsaWNlLiAgQHNlZSBnc2xpY2UuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19zICBUaGUgc291cmNlIGdzbGljZS4KKyAgICAgICAqICBAcmV0dXJuICBOZXcgdmFsYXJyYXkgY29udGFpbmluZyBlbGVtZW50cyBpbiBAYSBfX3MuCisgICAgICAgKi8KKyAgICAgIGdzbGljZV9hcnJheTxfVHA+ICAgb3BlcmF0b3JbXShjb25zdCBnc2xpY2UmIF9fcyk7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUmV0dXJuIGFuIGFycmF5IHN1YnNldC4KKyAgICAgICAqCisgICAgICAgKiAgUmV0dXJucyBhIG5ldyB2YWxhcnJheSBjb250YWluaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIGFyZ3VtZW50LiAgVGhlIGlucHV0IGlzIGEgdmFsYXJyYXkgb2YgYm9vbCB3aGljaAorICAgICAgICogIHJlcHJlc2VudHMgYSBiaXRtYXNrIGluZGljYXRpbmcgd2hpY2ggZWxlbWVudHMgc2hvdWxkIGJlIGNvcGllZCBpbnRvCisgICAgICAgKiAgdGhlIG5ldyB2YWxhcnJheS4gIEVhY2ggZWxlbWVudCBvZiB0aGUgYXJyYXkgaXMgYWRkZWQgdG8gdGhlIHJldHVybgorICAgICAgICogIHZhbGFycmF5IGlmIHRoZSBjb3JyZXNwb25kaW5nIGVsZW1lbnQgb2YgdGhlIGFyZ3VtZW50IGlzIHRydWUuCisgICAgICAgKgorICAgICAgICogIEBwYXJhbSAgX19tICBUaGUgdmFsYXJyYXkgYml0bWFzay4KKyAgICAgICAqICBAcmV0dXJuICBOZXcgdmFsYXJyYXkgY29udGFpbmluZyBlbGVtZW50cyBpbmRpY2F0ZWQgYnkgQGEgX19tLgorICAgICAgICovCisgICAgICB2YWxhcnJheTxfVHA+ICAgICAgIG9wZXJhdG9yW10oY29uc3QgdmFsYXJyYXk8Ym9vbD4mIF9fbSkgY29uc3Q7CisKKyAgICAgIC8qKgorICAgICAgICogIEBicmllZiAgUm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QgYXMgdGhlIGluZGljZXMgb2YgZWxlbWVudHMgb2YgdGhpcyB2YWxhcnJheSB0byBjb3B5IHRvCisgICAgICAgKiAgdGhlIHJldHVybiB2YWxhcnJheS4KKyAgICAgICAqCisgICAgICAgKiAgQHBhcmFtICBfX2kgIFRoZSB2YWxhcnJheSBlbGVtZW50IGluZGV4IGxpc3QuCisgICAgICAgKiAgQHJldHVybiAgTmV3IHZhbGFycmF5IGNvbnRhaW5pbmcgZWxlbWVudHMgaW4gQGEgX19zLgorICAgICAgICovCisgICAgICBfRXhwcjxfSUNsb3M8X1ZhbEFycmF5LCBfVHA+LCBfVHA+CisgICAgICAgIG9wZXJhdG9yW10oY29uc3QgdmFsYXJyYXk8c2l6ZV90PiYgX19pKSBjb25zdDsKKworICAgICAgLyoqCisgICAgICAgKiAgQGJyaWVmICBSZXR1cm4gYSByZWZlcmVuY2UgdG8gYW4gYXJyYXkgc3Vic2V0LgorICAgICAgICoKKyAgICAgICAqICBSZXR1cm5zIGFuIGluZGlyZWN0X2FycmF5IHJlZmVyZW5jaW5nIHRoZSBlbGVtZW50cyBvZiB0aGUgYXJyYXkKKyAgICAgICAqICBpbmRpY2F0ZWQgYnkgdGhlIGFyZ3VtZW50LiAgVGhlIGVsZW1lbnRzIGluIHRoZSBhcmd1bWVudCBhcmUKKyAgICAgICAqICBpbnRlcnByZXRlZCBhcyB0aGUgaW5kaWNlcyBvZiBlbGVtZW50cyBvZiB0aGlzIHZhbGFycmF5IHRvIGluY2x1ZGUKKyAgICAgICAqICBpbiB0aGUgc3Vic2V0LiAgVGhlIHJldHVybmVkIGluZGlyZWN0X2FycmF5IHJlZmVycyB0byB0aGVzZQorICAgICAgICogIGVsZW1lbnRzLgorICAgICAgICoKKyAgICAgICAqICBAcGFyYW0gIF9faSAgVGhlIHZhbGFycmF5IGVsZW1lbnQgaW5kZXggbGlzdC4KKyAgICAgICAqICBAcmV0dXJuICBJbmRpcmVjdF9hcnJheSByZWZlcmVuY2luZyBlbGVtZ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nQKKwkgeworCSAgIGlmIChzaXplX3QoX19uKSA+IF9NX3NpemUpCisJICAgICBfX24gPSBpbnQoX01fc2l6ZSk7CisKKwkgICBzdGQ6Ol9fdmFsYXJyYXlfY29weV9jb25zdHJ1Y3QoX01fZGF0YSArIF9fbiwKKwkJCQkJICBfTV9kYXRhICsgX01fc2l6ZSwgX190bXBfTV9kYXRhKTsKKwkgICBzdGQ6Ol9fdmFsYXJyYXlfZGVmYXVsdF9jb25zdHJ1Y3QoX190bXBfTV9kYXRhICsgX01fc2l6ZSAtIF9fbiwKKwkJCQkJICAgICBfX3RtcF9NX2RhdGEgKyBfTV9zaXplKTsKKwkgfQorICAgICAgIGVsc2UgICAgICAgICAgICAgICAgICAgLy8gc2hpZnQgcmlnaHQKKwkgeworCSAgIGlmICgtc2l6ZV90KF9fbikgPiBfTV9zaXplKQorCSAgICAgX19uID0gLWludChfTV9zaXplKTsKKworCSAgIHN0ZDo6X192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfTV9kYXRhLCBfTV9kYXRhICsgX01fc2l6ZSArIF9fbiwKKwkJCQkJICBfX3RtcF9NX2RhdGEgLSBfX24pOworCSAgIHN0ZDo6X192YWxhcnJheV9kZWZhdWx0X2NvbnN0cnVjdChfX3RtcF9NX2RhdGEsCisJCQkJCSAgICAgX190bXBfTV9kYXRhIC0gX19uKTsKKwkgfQorCisgICAgICAgX19yZXQuX01fc2l6ZSA9IF9NX3NpemU7CisgICAgICAgX19yZXQuX01fZGF0YSA9IF9fdG1wX01fZGF0YTsKKyAgICAgICByZXR1cm4gX19yZXQ7CisgICAgIH0KKworICB0ZW1wbGF0ZTxjbGFzcyBfVHA+CisgICAgIGlubGluZSB2YWxhcnJheTxfVHA+CisgICAgIHZhbGFycmF5PF9UcD46OmNzaGlmdChpbnQgX19uKSBjb25zdAorICAgICB7CisgICAgICAgdmFsYXJyYXk8X1RwPiBfX3JldDsKKworICAgICAgIGlmIChfTV9zaXplID09IDApCisJIHJldHVybiBfX3JldDsKKworICAgICAgIF9UcCogX19yZXN0cmljdF9fIF9fdG1wX01fZGF0YSA9CisJIHN0ZDo6X192YWxhcnJheV9nZXRfc3RvcmFnZTxfVHA+KF9NX3NpemUpOworCisgICAgICAgaWYgKF9fbiA9PSAwKQorCSBzdGQ6Ol9fdmFsYXJyYXlfY29weV9jb25zdHJ1Y3QoX01fZGF0YSwKKwkJCQkJX01fZGF0YSArIF9NX3NpemUsIF9fdG1wX01fZGF0YSk7CisgICAgICAgZWxzZSBpZiAoX19uID4gMCkgICAgICAvLyBjc2hpZnQgbGVmdAorCSB7CisJICAgaWYgKHNpemVfdChfX24pID4gX01fc2l6ZSkKKwkgICAgIF9fbiA9IGludChfX24gJSBfTV9zaXplKTsKKworCSAgIHN0ZDo6X192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfTV9kYXRhLCBfTV9kYXRhICsgX19uLAorCQkJCQkgIF9fdG1wX01fZGF0YSArIF9NX3NpemUgLSBfX24pOworCSAgIHN0ZDo6X192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfTV9kYXRhICsgX19uLCBfTV9kYXRhICsgX01fc2l6ZSwKKwkJCQkJICBfX3RtcF9NX2RhdGEpOworCSB9CisgICAgICAgZWxzZSAgICAgICAgICAgICAgICAgICAvLyBjc2hpZnQgcmlnaHQKKwkgeworCSAgIGlmICgtc2l6ZV90KF9fbikgPiBfTV9zaXplKQorCSAgICAgX19uID0gLWludCgtc2l6ZV90KF9fbikgJSBfTV9zaXplKTsKKworCSAgIHN0ZDo6X192YWxhcnJheV9jb3B5X2NvbnN0cnVjdChfTV9kYXRhICsgX01fc2l6ZSArIF9fbiwKKwkJCQkJICBfTV9kYXRhICsgX01fc2l6ZSwgX190bXBfTV9kYXRhKTsKKwkgICBzdGQ6Ol9fdmFsYXJyYXlfY29weV9jb25zdHJ1Y3QoX01fZGF0YSwgX01fZGF0YSArIF9NX3NpemUgKyBfX24sCisJCQkJCSAgX190bXBfTV9kYXRhIC0gX19uKTsKKwkg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F9fYmFzaWNfZmlsZSoKKyAgICAgIHN5c19vcGVuKF9fY19maWxlKiBfX2ZpbGUsIGlvc19iYXNlOjpvcGVubW9kZSk7CisKKyAgICAgIF9fYmFzaWNfZmlsZSoKKyAgICAgIHN5c19vcGVuKGludCBfX2ZkLCBpb3NfYmFzZTo6b3Blbm1vZGUgX19tb2RlKSB0aHJvdyAoKTsKKworICAgICAgX19iYXNpY19maWxlKiAKKyAgICAgIGNsb3NlKCk7IAorCisgICAgICBfR0xJQkNYWF9QVVJFIGJvb2wgCisgICAgICBpc19vcGVuKCkgY29uc3QgdGhyb3cgKCk7CisKKyAgICAgIF9HTElCQ1hYX1BVUkUgaW50IAorICAgICAgZmQoKSB0aHJvdyAoKTsKKworICAgICAgX0dMSUJDWFhfUFVSRSBfX2NfZmlsZSoKKyAgICAgIGZpbGUoKSB0aHJvdyAoKTsKKworICAgICAgfl9fYmFzaWNfZmlsZSgpOworCisgICAgICBzdHJlYW1zaXplIAorICAgICAgeHNwdXRuKGNvbnN0IGNoYXIqIF9fcywgc3RyZWFtc2l6ZSBfX24pOworCisgICAgICBzdHJlYW1zaXplIAorICAgICAgeHNwdXRuXzIoY29uc3QgY2hhciogX19zMSwgc3RyZWFtc2l6ZSBfX24xLAorCSAgICAgICBjb25zdCBjaGFyKiBfX3MyLCBzdHJlYW1zaXplIF9fbjIpOworCisgICAgICBzdHJlYW1zaXplIAorICAgICAgeHNnZXRuKGNoYXIqIF9fcywgc3RyZWFtc2l6ZSBfX24pOworCisgICAgICBzdHJlYW1vZmYKKyAgICAgIHNlZWtvZmYoc3RyZWFtb2ZmIF9fb2ZmLCBpb3NfYmFzZTo6c2Vla2RpciBfX3dheSkgdGhyb3cgKCk7CisKKyAgICAgIGludCAKKyAgICAgIHN5bmMoKTsKKworICAgICAgc3RyZWFtc2l6ZQorICAgICAgc2hvd21hbnljKCk7CisgICAgfTsKKworX0dMSUJDWFhfRU5EX05BTUVTUEFDRV9WRVJTSU9OCit9IC8vIG5hbWV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OT0VYRUMsCisgICAgICBmaWxlX2V4aXN0cyA9IAkgICAgICAgCQkJRUVYSVNULAorICAgICAgZmlsZV90b29fbGFyZ2UgPSAJCQkJRUZCSUcsCisgICAgICBmaWxlbmFtZV90b29fbG9uZyA9IAkJCUVOQU1FVE9PTE9ORywKKyAgICAgIGZ1bmN0aW9uX25vdF9zdXBwb3J0ZWQgPSAJCQlFTk9TWVMsCisgICAgICBob3N0X3VucmVhY2hhYmxlID0gCQkJRUhPU1RVTlJFQUNILAorCisjaWZkZWYgX0dMSUJDWFhfSEFWRV9FSURSTQorICAgICAgaWRlbnRpZmllcl9yZW1vdmVkID0gCQkJRUlEUk0sCisjZW5kaWYKKworICAgICAgaWxsZWdhbF9ieXRlX3NlcXVlbmNlID0gCQkJRUlMU0VRLAorICAgICAgaW5hcHByb3ByaWF0ZV9pb19jb250cm9sX29wZXJhdGlvbiA9IAlFTk9UVFksCisgICAgICBpbnRlcnJ1cHRlZCA9IAkJCQlFSU5UUiwKKyAgICAgIGludmFsaWRfYXJndW1lbnQgPSAJCQlFSU5WQUwsCisgICAgICBpbnZhbGlkX3NlZWsgPSAJCQkJRVNQSVBFLAorICAgICAgaW9fZXJyb3IgPSAJCQkJRUlPLAorICAgICAgaXNfYV9kaXJlY3RvcnkgPSAJCQkJRUlTRElSLAorICAgICAgbWVzc2FnZV9zaXplID0gCQkJCUVNU0dTSVpFLAorICAgICAgbmV0d29ya19kb3duID0gCQkJCUVORVRET1dOLAorICAgICAgbmV0d29ya19yZXNldCA9IAkJCQlFTkVUUkVTRVQsCisgICAgICBuZXR3b3JrX3VucmVhY2hhYmxlID0gCQkJRU5FVFVOUkVBQ0gsCisgICAgICBub19idWZmZXJfc3BhY2UgPSAJCQlFTk9CVUZTLAorICAgICAgbm9fY2hpbGRfcHJvY2VzcyA9IAkJCUVDSElMRCwKKworI2lmZGVmIF9HTElCQ1hYX0hBVkVfRU5PTElOSworICAgICAgbm9fbGluayA9IAkJCQlFTk9MSU5LLAorI2Vu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YnJvYWRjYXN0KQorX19ndGhydzMocHRocmVhZF9jb25kX3NpZ25hbCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydzMocHRocmVhZF9jb25kX3RpbWVkd2FpdCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF9kZXN0cm95KQorI2Vsc2UKK19fZ3RocncocHRocmVhZF9vbmNlKQorX19ndGhydyhwdGhyZWFkX2dldHNwZWNpZmljKQorX19ndGhydyhwdGhyZWFkX3NldHNwZWNpZmljKQorCitfX2d0aHJ3KHB0aHJlYWRfY3JlYXRlKQorX19ndGhydyhwdGhyZWFkX2pvaW4pCitfX2d0aHJ3KHB0aHJlYWRfZXF1YWwpCitfX2d0aHJ3KHB0aHJlYWRfc2VsZikKK19fZ3RocncocHRocmVhZF9kZXRhY2gpCisjaWZuZGVmIF9fQklPTklDX18KK19fZ3RocncocHRocmVhZF9jYW5jZWwpCisjZW5kaWYKK19fZ3Rocncoc2NoZWRfeWllbGQpCisKK19fZ3RocncocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGhydyhwdGhyZWFkX211dGV4X3RyeWxvY2spCisjaWYgX0dUSFJFQURfVVNFX01VVEVYX1RJTUVETE9DSworX19ndGhydyhwdGhyZWFkX211dGV4X3RpbWVkbG9jaykKKyNlbmRpZgorX19ndGhydyhwdGhyZWFkX211dGV4X3VubG9jaykKK19fZ3RocncocHRocmVhZF9tdXRleF9pbml0KQorX19ndGhydyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpCisKK19fZ3RocncocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9icm9hZGNhc3QpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9zaWduYWwpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydyhwdGhyZWFkX2NvbmRfdGltZWR3YWl0KQorX19ndGhydyhwdGhyZWFkX2NvbmRfZGVzdHJveSkKKyNlbmRpZgorCitfX2d0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dGhyZWFkX3QpIG5ld190aHJlYWRfaGFuZGxlOworICBlbHNlCisgICAgdGhyZWFkX2lkID0gTlVMTDsKKworICByZXR1cm4gdGhyZWFkX2lkOworfQorCisvKiBTZXQgdGhlIGN1cnJlbnQgdGhyZWFkJ3MgcHJpb3JpdHkuICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX3RocmVhZF9zZXRfcHJpb3JpdHkgKGludCBwcmlvcml0eSkKK3sKKyAgaWYgKCFfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIC0xOworICBlbHNlCisgICAgeworI2lmZGVmIF9QT1NJWF9QUklPUklUWV9TQ0hFRFVMSU5HCisjaWZkZWYgX1BPU0lYX1RIUkVBRF9QUklPUklUWV9TQ0hFRFVMSU5HCisgICAgICBwdGhyZWFkX3QgdGhyZWFkX2lkID0gX19ndGhyd18ocHRocmVhZF9zZWxmKSAoKTsKKyAgICAgIGludCBwb2xpY3k7CisgICAgICBzdHJ1Y3Qgc2NoZWRfcGFyYW0gcGFyYW1zOworICAgICAgaW50IHByaW9yaXR5X21pbiwgcHJpb3JpdHlfbWF4OworCisgICAgICBpZiAoX19ndGhyd18ocHRocmVhZF9nZXRzY2hlZHBhcmFtKSAodGhyZWFkX2lkLCAmcG9saWN5LCAmcGFyYW1zKSA9PSAwKQorCXsKKwkgIGlmICgocHJpb3JpdHlfbWF4ID0gX19ndGhyd18oc2NoZWRfZ2V0X3ByaW9yaXR5X21heCkgKHBvbGljeSkpID09IC0xKQorCSAgICByZXR1cm4gLTE7CisKKwkgIGlmICgocHJpb3JpdHlfbWluID0gX19ndGhyd18oc2NoZWRfZ2V0X3ByaW9yaXR5X21pbikgKHBvbGljeSkpID09IC0xKQorCSAgICByZXR1cm4gLTE7CisKKwkgIGlmIChwcmlvcml0eSA+IHByaW9yaXR5X21heCkKKwkgICAgcHJpb3JpdHkgPSBwcmlvcml0eV9tYXg7CisJICBlbHNlIGlmIChwcmlvcml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N0aXZlX3AgKCkpCisgICAgeworICAgICAgbXV0ZXgtPmJhY2tlbmQgPSBvYmpjX21hbGxvYyAoc2l6ZW9mIChwdGhyZWFkX211dGV4X3QpKTsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfaW5pdCkgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQsIE5VTEwpKQorCXsKKwkgIG9iamNfZnJlZSAobXV0ZXgtPmJhY2tlbmQpOworCSAgbXV0ZXgtPmJhY2tlbmQgPSBOVUxMOworCSAgcmV0dXJuIC0xOworCX0KKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIERlYWxsb2NhdGUgYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfZGVhbGxvY2F0ZSAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIGludCBjb3VudDsKKworICAgICAgLyoKKyAgICAgICAqIFBvc2l4IFRocmVhZHMgc3BlY2lmaWNhbGx5IHJlcXVpcmUgdGhhdCB0aGUgdGhyZWFkIGJlIHVubG9ja2VkCisgICAgICAgKiBmb3IgX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSB0byB3b3JrLgorICAgICAgICovCisKKyAgICAgIGRvCisJeworCSAgY291bnQgPSBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3VubG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworCSAgaWYgKGNvdW50IDwgMCkKKwkgICAgcmV0dXJuIC0xOworCX0KKyAgICAgIHdoaWxlIChjb3VudCk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSkKKwlyZXR1cm4gLTE7CisKKyAgICAgIG9iamNfZnJlZSAobXV0ZXgtPmJhY2tlbmQpOworICAgICAgbXV0ZXgtPmJhY2tlbmQgPSBOVUxMOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKy8qIEdyYWIgYSBsb2NrIG9uIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2xvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF9sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBUcnkgdG8gZ3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdHJ5bG9jayAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpCisgICAgICAmJiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3RyeWxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIFVubG9jayB0aGUgbXV0ZXggKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF91bmxvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyA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Ew7CisgICAgfQorICByZXR1cm4gMDsKK30KKworLyogV2FpdCBvbiB0aGUgY29uZGl0aW9uICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3dhaXQgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uLCBvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF93YWl0KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCwKKwkJCSAgICAgIChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworICBlbHNlCisgICAgcmV0dXJuIDA7Cit9CisKKy8qIFdha2UgdXAgYWxsIHRocmVhZHMgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2Jyb2FkY2FzdCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9icm9hZGNhc3QpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIG9uZSB0aHJlYWQgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3NpZ25hbCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9zaWduYWwpICgocHRocmVhZF9jb25kX3Q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9jayAoX19tdXRleCk7Cit9CisKKyNpZmRlZiBfR1RIUkVBRF9VU0VfQ09ORF9JTklUX0ZVTkMKK3N0YXRpYyBpbmxpbmUgdm9pZAorX19ndGhyZWFkX2NvbmRfaW5pdF9mdW5jdGlvbiAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIF9fZ3RocndfKHB0aHJlYWRfY29uZF9pbml0KSAoX19jb25kLCBOVUxMKTsKK30KKyNlbmRpZgorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfYnJvYWRjYXN0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KSAoX19jb25kKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3NpZ25hbCAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3NpZ25hbCkgKF9fY29uZCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF93YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3dhaXQpIChfX2NvbmQsIF9fbXV0ZXgpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4LAorCQkJICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICpfX2Fic190aW1lb3V0KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3RpbWVkd2FpdCkgKF9fY29uZCwgX19tdXRle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X2d0aHJ3XyAjIyBuYW1lLCBfXyAjIyBuYW1lLCBuYW1lKQorX19ndGhydzMocHRocmVhZF9vbmNlKQorX19ndGhydzMocHRocmVhZF9nZXRzcGVjaWZpYykKK19fZ3RocnczKHB0aHJlYWRfc2V0c3BlY2lmaWMpCisKK19fZ3RocnczKHB0aHJlYWRfY3JlYXRlKQorX19ndGhydzMocHRocmVhZF9qb2luKQorX19ndGhydzMocHRocmVhZF9kZXRhY2gpCitfX2d0aHJ3MyhwdGhyZWFkX2VxdWFsKQorX19ndGhydzMocHRocmVhZF9zZWxmKQorX19ndGhydzMocHRocmVhZF9jYW5jZWwpCitfX2d0aHJ3MyhzY2hlZF95aWVsZCkKKworX19ndGhydzMocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGhydzMocHRocmVhZF9tdXRleF90cnlsb2NrKQorI2lmIF9HVEhSRUFEX1VTRV9NVVRFWF9USU1FRExPQ0sKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfdGltZWRsb2NrKQorI2VuZGlmCitfX2d0aHJ3MyhwdGhyZWFkX211dGV4X3VubG9jaykKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfaW5pdCkKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkKKworX19ndGhydzMocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3MyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KQorX19ndGhydzMocHRocmVhZF9jb25kX3NpZ25hbCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydzMocHRocmVhZF9jb25kX3RpbWVkd2FpdCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF9kZXN0cm95KQorI2Vsc2UKK19fZ3RocncocHRocmVhZF9vbmNlKQorX19ndGhydyhwdGhyZWFkX2dldHNwZWNpZmljKQorX19ndGhydyhwdGhyZWFkX3NldHNwZWNpZmljKQorCitfX2d0aHJ3KHB0aHJlYWRfY3JlYXRlKQorX19ndGhydyhwdGhyZWFkX2pvaW4pCitfX2d0aHJ3KHB0aHJlYWRfZXF1YWwpCitfX2d0aHJ3KHB0aHJlYWRfc2VsZikKK19fZ3RocncocHRocmVhZF9kZXRhY2gpCisjaWZuZGVmIF9fQklPTklDX18KK19fZ3RocncocHRocmVhZF9jYW5jZWwpCisjZW5kaWYKK19fZ3Rocncoc2NoZWRfeWllbGQpCisKK19fZ3RocncocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGhydyhwdGhyZWFkX211dGV4X3RyeWxvY2spCisjaWYgX0dUSFJFQURfVVNFX01VVEVYX1RJTUVETE9DSworX19ndGhydyhwdGhyZWFkX211dGV4X3RpbWVkbG9jaykKKyNlbmRpZgorX19ndGhydyhwdGhyZWFkX211dGV4X3VubG9jaykKK19fZ3RocncocHRocmVhZF9tdXRleF9pbml0KQorX19ndGhydyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpCisKK19fZ3RocncocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9icm9hZGNhc3QpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9zaWduYWwpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydyhwdGhyZWFkX2NvbmRfdGltZWR3YWl0KQorX19ndGhydyhwdGhyZWFkX2NvbmRfZGVzdHJveSkKKyNlbmRpZgorCitfX2d0aHJ3KHB0aHJlYWRfa2V5X2NyZWF0ZSkKK19fZ3RocncocHRocmVhZF9rZXlfZGVsZXRlKQorX19ndGhydyhwdGhyZWFkX211dGV4YXR0cl9pbml0KQorX19ndGhydyhwdGhyZWFkX211dGV4YXR0cl9zZXR0eXBlKQorX19ndGhydyhwdGhyZWFkX211dGV4YXR0cl9kZXN0cm95KQorCisKKyNpZiBkZWZpbmVkKF9MSUJPQkpDKSB8fCBkZWZpbmVkKF9MSUJPQkpDX1dFQUspCisvKiBPYmplY3RpdmUtQy4gICovCisjaWYgZGVmaW5lZChfX29zZl9fKSAm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KKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIERlYWxsb2NhdGUgYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfZGVhbGxvY2F0ZSAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIGludCBjb3VudDsKKworICAgICAgLyoKKyAgICAgICAqIFBvc2l4IFRocmVhZHMgc3BlY2lmaWNhbGx5IHJlcXVpcmUgdGhhdCB0aGUgdGhyZWFkIGJlIHVubG9ja2VkCisgICAgICAgKiBmb3IgX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSB0byB3b3JrLgorICAgICAgICovCisKKyAgICAgIGRvCisJeworCSAgY291bnQgPSBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3VubG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworCSAgaWYgKGNvdW50IDwgMCkKKwkgICAgcmV0dXJuIC0xOworCX0KKyAgICAgIHdoaWxlIChjb3VudCk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSkKKwlyZXR1cm4gLTE7CisKKyAgICAgIG9iamNfZnJlZSAobXV0ZXgtPmJhY2tlbmQpOworICAgICAgbXV0ZXgtPmJhY2tlbmQgPSBOVUxMOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKy8qIEdyYWIgYSBsb2NrIG9uIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2xvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF9sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBUcnkgdG8gZ3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdHJ5bG9jayAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpCisgICAgICAmJiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3RyeWxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIFVubG9jayB0aGUgbXV0ZXggKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF91bmxvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIEJhY2tlbmQgY29uZGl0aW9uIG11dGV4IGZ1bmN0aW9ucyAqLworCisvKiBBbGxvY2F0ZSBhIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2FsbG9jYXRlIChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbikKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICB7CisgICAgICBjb25kaXRpb24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YmFja2VuZCwKKwkJCSAgICAgIChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworICBlbHNlCisgICAgcmV0dXJuIDA7Cit9CisKKy8qIFdha2UgdXAgYWxsIHRocmVhZHMgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2Jyb2FkY2FzdCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9icm9hZGNhc3QpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIG9uZSB0aHJlYWQgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3NpZ25hbCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9zaWduYWwpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisjZWxzZSAvKiBfTElCT0JKQyAqLworCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NyZWF0ZSAoX19ndGhyZWFkX3QgKl9fdGhyZWFkaWQsIHZvaWQgKigqX19mdW5jKSAodm9pZCopLAorCQkgIHZvaWQgKl9fYXJncykKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY3JlYXRlKSAoX190aHJlYWRpZCwgTlVMTCwgX19mdW5jLCBfX2FyZ3M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FkX2NvbmRfYnJvYWRjYXN0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KSAoX19jb25kKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3NpZ25hbCAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3NpZ25hbCkgKF9fY29uZCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF93YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3dhaXQpIChfX2NvbmQsIF9fbXV0ZXgpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4LAorCQkJICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICpfX2Fic190aW1lb3V0KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3RpbWVkd2FpdCkgKF9fY29uZCwgX19tdXRleCwgX19hYnNfdGltZW91dCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF93YWl0X3JlY3Vyc2l2ZSAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kLAorCQkJICAgICAgIF9fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdCAqX19tdXRleCkKK3sKKyAgcmV0dXJuIF9fZ3RocmVhZF9jb25kX3dhaXQgKF9fY29uZCwgX19tdXRleCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF90aW1lZHdhaX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RfZ2V0X3ByaW9yaXR5ICh2b2lkKQoreworICByZXR1cm4gT0JKQ19USFJFQURfSU5URVJBQ1RJVkVfUFJJT1JJVFk7Cit9CisKKy8qIFlpZWxkIG91ciBwcm9jZXNzIHRpbWUgdG8gYW5vdGhlciB0aHJlYWQuICAqLworc3RhdGljIGlubGluZSB2b2lkCitfX2d0aHJlYWRfb2JqY190aHJlYWRfeWllbGQgKHZvaWQpCit7CisgIHJldHVybjsKK30KKworLyogVGVybWluYXRlIHRoZSBjdXJyZW50IHRocmVhZC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfdGhyZWFkX2V4aXQgKHZvaWQpCit7CisgIC8qIE5vIHRocmVhZCBzdXBwb3J0IGF2YWlsYWJsZSAqLworICAvKiBTaG91bGQgd2UgcmVhbGx5IGV4aXQgdGhlIHByb2dyYW0gKi8KKyAgLyogZXhpdCAoJl9fb2JqY190aHJlYWRfZXhpdF9zdGF0dXMpOyAqLworICByZXR1cm4gLTE7Cit9CisKKy8qIFJldHVybnMgYW4gaW50ZWdlciB2YWx1ZSB3aGljaCB1bmlxdWVseSBkZXNjcmliZXMgYSB0aHJlYWQuICAqLworc3RhdGljIGlubGluZSBvYmpjX3RocmVhZF90CitfX2d0aHJlYWRfb2JqY190aHJlYWRfaWQgKHZvaWQpCit7CisgIC8qIE5vIHRocmVhZCBzdXBwb3J0LCB1c2UgMS4gICovCisgIHJldHVybiAob2JqY190aHJlYWRfdCkgMTsKK30KKworLyogU2V0cyB0aGUgdGhyZWFkJ3MgbG9jYWwgc3RvcmFnZSBwb2ludGVyLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY190aHJlYWRfc2V0X2RhdGEgKHZvaWQgKnZhbHVlKQoreworICB0aHJlYWRfbG9jYWxfc3RvcmFnZSA9IHZhbHVlOworICByZXR1cm4gMDsKK30KKworLyogUmV0dXJucyB0aGUgdGhyZWFkJ3MgbG9jYWwgc3RvcmFnZSBwb2ludGVyLiAgKi8KK3N0YXRpYyBpbmxpbmUgdm9pZCAqCitfX2d0aHJlYWRfb2JqY190aHJlYWRfZ2V0X2RhdGEgKHZvaWQpCit7CisgIHJldHVybiB0aHJlYWRfbG9jYWxfc3RvcmFnZTsKK30KKworLyogQmFja2VuZCBtdXRleCBmdW5jdGlvbnMgKi8KKworLyogQWxsb2NhdGUgYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfYWxsb2NhdGUgKG9iamNfbXV0ZXhfdCBtdXRleCBfR0xJQkNYWF9VTlVTRUQpCit7CisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2RlYWxsb2NhdGUgKG9iamNfbXV0ZXhfdCBtdXRleCBfR0xJQkNYWF9VTlVTRUQpCit7CisgIHJldHVybiAwOworfQorCisvKiBHcmFiIGEgbG9jayBvbiBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9sb2NrIChvYmpjX211dGV4X3QgbXV0ZXggX0dMSUJDWFhfVU5VU0VEKQoreworICAvKiBUaGVyZSBjYW4gb25seSBiZSBvbmUgdGhyZWFkLCBzbyB3ZSBhbHdheXMgZ2V0IHRoZSBsb2NrICovCisgIHJldHVybiAwOworfQorCisvKiBUcnkgdG8gZ3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdHJ5bG9jayAob2JqY19tdXRleF90IG11dGV4IF9HTElCQ1hYX1VOVVNFRCkKK3sKKyAgLyogVGhlcmUgY2FuIG9ubHkgYmUgb25lIHRocmVhZCwgc28gd2UgYWx3YXlzIGdldCB0aGUgbG9jayAqLworICByZXR1cm4gMDsKK30KKworLyogVW5sb2NrIHRoZSBtdXRleCAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X3VubG9jayAob2JqY19tdXRleF90IG11dGV4IF9HTElCQ1hYX1VOVVNFRCkKK3sKKyAgcmV0dXJuIDA7Cit9CisKKy8qIEJhY2tlbmQgY29uZGl0aW9uIG11dGV4IGZ1bmN0aW9ucyAqLworCisvKiBBbGxvY2F0ZSBhIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2FsbG9jYXRlIChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbiBfR0xJQkNYWF9VTlVTRUQpCit7CisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fZGVhbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24gX0dMSUJDWFhfVU5VU0VEKQoreworICByZXR1cm4gMDsKK30KKworLyogV2FpdCBvbiB0aGUgY29uZGl0aW9uICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3dhaXQgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uIF9HTElCQ1hYX1VOVVNFRCwKKwkJCSAgICAgICBvYmpjX211dGV4X3QgbXV0ZXggX0dMSUJDWFhfVU5VU0VEKQoreworICByZXR1cm4gMDsKK30KKworLyogV2FrZSB1cCBhbGwgdGhyZWFkcyB3YWl0aW5nIG9uIHRoaXMgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fYnJvYWRjYXN0IChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbiBfR0xJQkNYWF9VTlVTRUQpCit7CisgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIG9uZSB0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pOworICAgICBpbnQgX19ndGhyZWFkX2VxdWFsIChfX2d0aHJlYWRfdCB0MSwgX19ndGhyZWFkX3QgdDIpOworICAgICBfX2d0aHJlYWRfdCBfX2d0aHJlYWRfc2VsZiAodm9pZCk7CisgICAgIGludCBfX2d0aHJlYWRfeWllbGQgKHZvaWQpOworCisgICAgIGludCBfX2d0aHJlYWRfbXV0ZXhfdGltZWRsb2NrIChfX2d0aHJlYWRfbXV0ZXhfdCAqbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKmFic190aW1lb3V0KTsKKyAgICAgaW50IF9fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdGltZWRsb2NrIChfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3QgKm0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICphYnNfdGltZSk7CisKKyAgICAgaW50IF9fZ3RocmVhZF9jb25kX3NpZ25hbCAoX19ndGhyZWFkX2NvbmRfdCAqY29uZCk7CisgICAgIGludCBfX2d0aHJlYWRfY29uZF90aW1lZHdhaXQgKF9fZ3RocmVhZF9jb25kX3QgKmNvbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fZ3RocmVhZF9tdXRleF90ICptdXRleCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgX19ndGhyZWFkX3RpbWVfdCAqYWJzX3RpbWVvdXQpOworICAgICBpbnQgX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0X3JlY3Vyc2l2ZSAoX19ndGhyZWFkX2NvbmRfdCAqY29uZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdCAqbXV0ZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg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cGUqIF9fY2FjaGUsIHNpemVfdCBfX3JlZnMpIAorICAgIDogZmFjZXQoX19yZWZzKSwgX01fZGF0YShfX2NhY2hlKQorICAgIHsgCisgICAgICBfTV9uYW1lX3RpbWVwdW5jdCA9IF9TX2dldF9jX25hbWUoKTsKKyAgICAgIF9NX2luaXRpYWxpemVfdGltZXB1bmN0KCk7IAorICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQ+CisgICAgX190aW1lcHVuY3Q8X0NoYXJUPjo6X190aW1lcHVuY3QoX19jX2xvY2FsZSBfX2Nsb2MsIGNvbnN0IGNoYXIqIF9fcywgCisJCQkJICAgICBzaXplX3QgX19yZWZzKSAKKyAgICA6IGZhY2V0KF9fcmVmcyksIF9NX2RhdGEoMCkKKyAgICB7CisgICAgICBpZiAoX19idWlsdGluX3N0cmNtcChfX3MsIF9TX2dldF9jX25hbWUoKSkgIT0gMCkKKwl7CisJICBjb25zdCBzaXplX3QgX19sZW4gPSBfX2J1aWx0aW5fc3RybGVuKF9fcykgKyAxOworCSAgY2hhciogX190bXAgPSBuZXcgY2hhcltfX2xlbl07CisJICBfX2J1aWx0aW5fbWVtY3B5KF9fdG1wLCBfX3MsIF9fbGVuKTsKKwkgIF9NX25hbWVfdGltZXB1bmN0ID0gX190bXA7CisJfQorICAgICAgZWxzZQorCV9NX25hbWVfdGltZXB1bmN0ID0gX1NfZ2V0X2NfbmFtZSgpOworCisgICAgICBfX3RyeQorCXsgX01faW5pdGlhbGl6ZV90aW1lcHVuY3QoX19jbG9jKTsgfQorICAgICAgX19jYXRjaCguLi4pCisJeworCSAgaWYgKF9NX25hbWVfdGltZXB1bmN0ICE9IF9TX2dldF9jX25hbWUoKSkKKwkgICAgZGVsZXRlIFtdIF9NX25hbWVfdGltZXB1bmN0OworCSAgX190aHJvd19leGNlcHRpb25fYWdhaW47CisJfQorICAgIH0KKworICB0ZW1wbGF0ZTx0eXBlbmFtZSBfQ2hhclQ+CisgICAgX190aW1lc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0b3JhZ2UgcG9pbnRlci4gICovCitzdGF0aWMgaW5saW5lIHZvaWQgKgorX19ndGhyZWFkX29iamNfdGhyZWFkX2dldF9kYXRhICh2b2lkKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2dldHNwZWNpZmljKSAoX29iamNfdGhyZWFkX3N0b3JhZ2UpOworICBlbHNlCisgICAgcmV0dXJuIHRocmVhZF9sb2NhbF9zdG9yYWdlOworfQorCisvKiBCYWNrZW5kIG11dGV4IGZ1bmN0aW9ucyAqLworCisvKiBBbGxvY2F0ZSBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9hbGxvY2F0ZSAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIG11dGV4LT5iYWNrZW5kID0gb2JqY19tYWxsb2MgKHNpemVvZiAocHRocmVhZF9tdXRleF90KSk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2luaXQpICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kLCBOVUxMKSkKKwl7CisJICBvYmpjX2ZyZWUgKG11dGV4LT5iYWNrZW5kKTsKKwkgIG11dGV4LT5iYWNrZW5kID0gTlVMTDsKKwkgIHJldHVybiAtMTsKKwl9CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2RlYWxsb2NhdGUgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICB7CisgICAgICBpbnQgY291bnQ7CisKKyAgICAgIC8qCisgICAgICAgKiBQb3NpeCBUaHJlYWRzIHNwZWNpZmljYWxseSByZXF1aXJlIHRoYXQgdGhlIHRocmVhZCBiZSB1bmxvY2tlZAorICAgICAgICogZm9yIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkgdG8gd29yay4KKyAgICAgICAqLworCisgICAgICBkbworCXsKKwkgIGNvdW50ID0gX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKTsKKwkgIGlmIChjb3VudCA8IDApCisJICAgIHJldHVybiAtMTsKKwl9CisgICAgICB3aGlsZSAoY291bnQpOworCisgICAgICBpZiAoX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkpCisJcmV0dXJuIC0xOworCisgICAgICBvYmpjX2ZyZWUgKG11dGV4LT5iYWNrZW5kKTsKKyAgICAgIG11dGV4LT5iYWNrZW5kID0gTlVMTDsKKyAgICB9CisgIHJldHVybiAwOworfQorCisvKiBHcmFiIGEgbG9jayBvbiBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9sb2NrIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkKKyAgICAgICYmIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfbG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpICE9IDApCisgICAgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogVHJ5IHRvIGdyYWIgYSBsb2NrIG9uIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X3RyeWxvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF90cnlsb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBVbmxvY2sgdGhlIG11dGV4ICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdW5sb2NrIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkKKyAgICAgICYmIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfdW5sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBCYWNrZW5kIGNvbmRpdGlvbiBtdXRleCBmdW5jdGlvbnMgKi8KKworLyogQWxsb2NhdGUgYSBjb25kaXRpb24uICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl9hbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgY29uZGl0aW9uLT5iYWNrZW5kID0gb2JqY19tYWxsb2MgKHNpemVvZiAocHRocmVhZF9jb25kX3QpKTsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfY29uZF9pbml0KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCwgTlVMTCkpCisJeworCSAgb2JqY19mcmVlIChjb25kaXRpb24tPmJhY2tlbmQpOworCSAgY29uZGl0aW9uLT5iYWNrZW5kID0gTlVMTDsKKwkgIHJldHVybiAtMTsKKwl9CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fZGVhbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfY29uZF9kZXN0cm95KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCkpCisJcmV0dXJuIC0xOworCisgICAgICBvYmpjX2ZyZWUgKGNvbmRpdGlvbi0+YmFja2VuZCk7CisgICAgICBjb25kaXRpb24tPmJhY2tlbmQgPSBOVUxMOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKy8qIFdhaXQgb24gdGhlIGNvbmRpdGlvbiAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl93YWl0IChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbiwgb2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfd2FpdCkgKChwdGhyZWFkX2NvbmRfdCAqKSBjb25kaXRpb24tPmJhY2tlbmQsCisJCQkgICAgICAocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIGFsbCB0aHJlYWRzIHdhaXRpbmcgb24gdGhpcyBjb25kaXRpb24uICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl9icm9hZGNhc3QgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uKQoreworICBpZiAoX19ndGhyZWFk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XR1cm4gX19ndGhyd18ocHRocmVhZF9kZXRhY2gpIChfX3RocmVhZGlkKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9lcXVhbCAoX19ndGhyZWFkX3QgX190MSwgX19ndGhyZWFkX3QgX190MikKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfZXF1YWwpIChfX3QxLCBfX3QyKTsKK30KKworc3RhdGljIGlubGluZSBfX2d0aHJlYWRfdAorX19ndGhyZWFkX3NlbGYgKHZvaWQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX3NlbGYpICgpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX3lpZWxkICh2b2lkKQoreworICByZXR1cm4gX19ndGhyd18oc2NoZWRfeWllbGQpICgpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29uY2UgKF9fZ3RocmVhZF9vbmNlX3QgKl9fb25jZSwgdm9pZCAoKl9fZnVuYykgKHZvaWQpKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX29uY2UpIChfX29uY2UsIF9fZnVuYyk7CisgIGVsc2UKKyAgICByZXR1cm4gLTE7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfa2V5X2NyZWF0ZSAoX19ndGhyZWFkX2tleV90ICpfX2tleSwgdm9pZCAoKl9fZHRvcikgKHZvaWQgKikpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2tleV9jcmVhdGUpIChfX2tleSwgX19kdG9yKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9rZXlfZGVsZXRlIChfX2d0aHJlYWRfa2V5X3QgX19rZXkpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2tleV9kZWxldGUpIChfX2tleSk7Cit9CisKK3N0YXRpYyBpbmxpbmU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EoX19ndGhyd18ocHRocmVhZF9jcmVhdGUpICgmbmV3X3RocmVhZF9oYW5kbGUsICZfb2JqY190aHJlYWRfYXR0cmlicywKKwkJCQkgICh2b2lkICopIGZ1bmMsIGFyZykpKQorICAgIHRocmVhZF9pZCA9IChvYmpjX3RocmVhZF90KSBuZXdfdGhyZWFkX2hhbmRsZTsKKyAgZWxzZQorICAgIHRocmVhZF9pZCA9IE5VTEw7CisKKyAgcmV0dXJuIHRocmVhZF9pZDsKK30KKworLyogU2V0IHRoZSBjdXJyZW50IHRocmVhZCdzIHByaW9yaXR5LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY190aHJlYWRfc2V0X3ByaW9yaXR5IChpbnQgcHJpb3JpdHkpCit7CisgIGlmICghX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiAtMTsKKyAgZWxzZQorICAgIHsKKyNpZmRlZiBfUE9TSVhfUFJJT1JJVFlfU0NIRURVTElORworI2lmZGVmIF9QT1NJWF9USFJFQURfUFJJT1JJVFlfU0NIRURVTElORworICAgICAgcHRocmVhZF90IHRocmVhZF9pZCA9IF9fZ3RocndfKHB0aHJlYWRfc2VsZikgKCk7CisgICAgICBpbnQgcG9saWN5OworICAgICAgc3RydWN0IHNjaGVkX3BhcmFtIHBhcmFtczsKKyAgICAgIGludCBwcmlvcml0eV9taW4sIHByaW9yaXR5X21heDsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfZ2V0c2NoZWRwYXJhbSkgKHRocmVhZF9pZCwgJnBvbGljeSwgJnBhcmFtcykgPT0gMCkKKwl7CisJICBpZiAoKHByaW9yaXR5X21heCA9IF9fZ3RocndfKHNjaGVkX2dldF9wcmlvcml0eV9tYXgpIChwb2xpY3kpKSA9PSAtMSkKKwkgICAgcmV0dXJuIC0xOworCisJICBpZiAoKHByaW9yaXR5X21pbiA9IF9fZ3RocndfKHNjaGVkX2dldF9wcmlvcml0eV9taW4pIChwb2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AgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9hbGxvY2F0ZSAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIG11dGV4LT5iYWNrZW5kID0gb2JqY19tYWxsb2MgKHNpemVvZiAocHRocmVhZF9tdXRleF90KSk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2luaXQpICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kLCBOVUxMKSkKKwl7CisJICBvYmpjX2ZyZWUgKG11dGV4LT5iYWNrZW5kKTsKKwkgIG11dGV4LT5iYWNrZW5kID0gTlVMTDsKKwkgIHJldHVybiAtMTsKKwl9CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2RlYWxsb2NhdGUgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICB7CisgICAgICBpbnQgY291bnQ7CisKKyAgICAgIC8qCisgICAgICAgKiBQb3NpeCBUaHJlYWRzIHNwZWNpZmljYWxseSByZXF1aXJlIHRoYXQgdGhlIHRocmVhZCBiZSB1bmxvY2tlZAorICAgICAgICogZm9yIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkgdG8gd29yay4KKyAgICAgICAqLworCisgICAgICBkbworCXsKKwkgIGNvdW50ID0gX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKTsKKwkgIGlmIChjb3VudCA8IDApCisJICAgIHJldHVybiAtMTsKKwl9CisgICAgICB3aGlsZSAoY291bnQpOworCisgICAgICBpZiAoX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkpCisJcmV0dXJuIC0xOworCisgICAgICBvYmpjX2ZyZWUgKG11dGV4LT5iYWNrZW5kKTsKKyAgICAgIG11dGV4LT5iYWNrZW5kID0gTlVMTDsKKyAgICB9CisgIHJldHVybiAwOworfQorCisvKiBHcmFiIGEgbG9jayBvbiBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9sb2NrIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkKKyAgICAgICYmIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfbG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpICE9IDApCisgICAgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogVHJ5IHRvIGdyYWIgYSBsb2NrIG9uIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X3RyeWxvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF90cnlsb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBVbmxvY2sgdGhlIG11dGV4ICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdW5sb2NrIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkKKyAgICAgICYmIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfdW5sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBCYWNrZW5kIGNvbmRpdGlvbiBtdXRleCBmdW5jdGlvbnMgKi8KKworLyogQWxsb2NhdGUgYSBjb25kaXRpb24uICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl9hbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgY29uZGl0aW9uLT5iYWNrZW5kID0gb2JqY19tYWxsb2MgKHNpemVvZiAocHRocmVhZF9jb25kX3QpKTsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfY29uZF9pbml0KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCwgTlVMTCkpCisJeworCSAgb2JqY19mcmVlIChjb25kaXRpb24tPmJhY2tlbmQpOworCSAgY29uZGl0aW9uLT5iYWNrZW5kID0gTlVMTDsKKwkgIHJldHVybiAtMTsKKwl9CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fZGVhbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfY29uZF9kZXN0cm95KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCkpCisJcmV0dXJuIC0xOworCisgICAgICBvYmpjX2ZyZWUgKGNvbmRpdGlvbi0+YmFja2VuZCk7CisgICAgICBjb25kaXRpb24tPmJhY2tlbmQgPSBOVUxMOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKy8qIFdhaXQgb24gdGhlIGNvbmRpdGlvbiAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl93YWl0IChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbiwgb2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfd2FpdCkgKChwdGhyZWFkX2NvbmRfdCAqKSBjb25kaXRpb24tPmJhY2tlbmQsCisJCQkgICAgICAocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIGFsbCB0aHJlYWRzIHdhaXRpbmcgb24gdGhpcyBjb25kaXRpb24uICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl9icm9hZGNhc3QgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCk7CisgIGVsc2UKKyAgICByZXR1cm4gMDsKK30KKworLyogV2FrZSB1cCBvbmUgdGhyZWFkIHdhaXRpbmcgb24gdGhpcyBjb25kaXRpb24uICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX2NvbmRpdGlvbl9zaWduYWwgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uKQoreworICBpZiAoX19ndGhyZW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NkZWZpbmUgX19HVEhSRUFEU19DWFgwWCAxCisgICB0byBlbmFibGUgdGhlIGMrKzB4IHRocmVhZCBsaWJyYXJ5LgorCisgICBUeXBlczoKKyAgICAgX19ndGhyZWFkX3QKKyAgICAgX19ndGhyZWFkX3RpbWVfdAorCisgICBJbnRlcmZhY2U6CisgICAgIGludCBfX2d0aHJlYWRfY3JlYXRlIChfX2d0aHJlYWRfdCAqdGhyZWFkLCB2b2lkICooKmZ1bmMpICh2b2lkKiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkICphcmdzKTsKKyAgICAgaW50IF9fZ3RocmVhZF9qb2luIChfX2d0aHJlYWRfdCB0aHJlYWQsIHZvaWQgKip2YWx1ZV9wdHIpOworICAgICBpbnQgX19ndGhyZWFkX2RldGFjaCAoX19ndGhyZWFkX3QgdGhyZWFkKTsKKyAgICAgaW50IF9fZ3RocmVhZF9lcXVhbCAoX19ndGhyZWFkX3QgdDEsIF9fZ3RocmVhZF90IHQyKTsKKyAgICAgX19ndGhyZWFkX3QgX19ndGhyZWFkX3NlbGYgKHZvaWQpOworICAgICBpbnQgX19ndGhyZWFkX3lpZWxkICh2b2lkKTsKKworICAgICBpbnQgX19ndGhyZWFkX211dGV4X3RpbWVkbG9jayAoX19ndGhyZWFkX211dGV4X3QgKm0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICphYnNfdGltZW91dCk7CisgICAgIGludCBfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3RpbWVkbG9jayAoX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF90ICptLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgX19ndGhyZWFkX3RpbWVfdCAqYWJzX3RpbWUpOworCisgICAgIGludCBfX2d0aHJlYWRfY29uZF9zaWduYWwgKF9fZ3RocmVhZF9jb25kX3QgKmNvbmQpOworICAgICBpbnQgX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0IChfX2d0aHJlYWRfY29uZF90ICpjb25kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2d0aHJlYWRfbXV0ZXhfdCAqbXV0ZXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKmFic190aW1lb3V0KTsKKyAgICAgaW50IF9fZ3RocmVhZF9jb25kX3RpbWVkd2FpdF9yZWN1cnNpdmUgKF9fZ3RocmVhZF9jb25kX3QgKmNvbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3QgKm11dGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgX19ndGhyZWFkX3RpbWVfdCAqYWJzX3RpbWUpCisKKyovCisKKyNpZiBfX0dYWF9XRUFLX18KKy8qIFRoZSBwZS1jb2ZmIHdlYWsgc3VwcG9ydCBpc24ndCBmdWxseSBjb21wYXRpYmxlIHRvIEVMRidzIHdlYWsuCisgICBGb3Igc3RhdGljIGxpYnJhcmllcyBpdCBtaWdodCB3b3VsZCB3b3JrLCBidXQgYXMgd2UgbmVlZCB0byBkZWFsCisgICB3aXRoIHNoYXJlZCB2ZXJzaW9ucyB0b28sIHdlIGRpc2FibGUgaXQgZm9yIG1pbmd3LXRhcmdldHMuICAqLworI2lmZGVmIF9HTElCQ1hYX19fTUlOR1czMl9HTElCQ1hYX19fCisjdW5kZWYgX0dMSUJDWFhfR1RIUkVBRF9VU0VfV0VBSworI2RlZmluZSBfR0xJQkNYWF9HVEhSRUFEX1VTRV9XRUFLIDAKKyNlbmRpZgorCisjaWZuZGVmIF9HTElCQ1hYX0dUSFJFQURfVVNFX1dFQUsKKyNkZWZpbmUgX0dMSUJDWFhfR1RIUkVBRF9VU0VfV0VBSyAxCisjZW5kaWYKKyNlbm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Glvc19iYXNlOjpvcGVubW9kZSBfX21vZGUpIHRocm93ICgpOworCisgICAgICBfX2Jhc2ljX2ZpbGUqIAorICAgICAgY2xvc2UoKTsgCisKKyAgICAgIF9HTElCQ1hYX1BVUkUgYm9vbCAKKyAgICAgIGlzX29wZW4oKSBjb25zdCB0aHJvdyAoKTsKKworICAgICAgX0dMSUJDWFhfUFVSRSBpbnQgCisgICAgICBmZCgpIHRocm93ICgpOworCisgICAgICBfR0xJQkNYWF9QVVJFIF9fY19maWxlKgorICAgICAgZmlsZSgpIHRocm93ICgpOworCisgICAgICB+X19iYXNpY19maWxlKCk7CisKKyAgICAgIHN0cmVhbXNpemUgCisgICAgICB4c3B1dG4oY29uc3QgY2hhciogX19zLCBzdHJlYW1zaXplIF9fbik7CisKKyAgICAgIHN0cmVhbXNpemUgCisgICAgICB4c3B1dG5fMihjb25zdCBjaGFyKiBfX3MxLCBzdHJlYW1zaXplIF9fbjEsCisJICAgICAgIGNvbnN0IGNoYXIqIF9fczIsIHN0cmVhbXNpemUgX19uMik7CisKKyAgICAgIHN0cmVhbXNpemUgCisgICAgICB4c2dldG4oY2hhciogX19zLCBzdHJlYW1zaXplIF9fbik7CisKKyAgICAgIHN0cmVhbW9mZgorICAgICAgc2Vla29mZihzdHJlYW1vZmYgX19vZmYsIGlvc19iYXNlOjpzZWVrZGlyIF9fd2F5KSB0aHJvdyAoKTsKKworICAgICAgaW50IAorICAgICAgc3luYygpOworCisgICAgICBzdHJlYW1zaXplCisgICAgICBzaG93bWFueWMoKTsKKyAgICB9OworCitfR0xJQkNYWF9FTkRfTkFNRVNQQUNFX1ZFUlNJT04KK30gLy8gbmFtZXNwYWNlCisKKyNlbmRpZgkKZGlmZiAtLWdpdCBhLzgvc291cmNlcy9jeHgtc3RsL2dudS1saWJzdGRjKysvNC43L2xpYnMvbWlwcy9pbmNsdWRlL2JpdHMvYysrYWxsb2NhdG9yLmggYi84L3NvdXJjZXMvY3h4LXN0bC9nbnUtbGlic3RkYysrL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VhZF9hY3RpdmVfcCAoKSkKKyAgICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9nZXRzcGVjaWZpYykgKF9vYmpjX3RocmVhZF9zdG9yYWdlKTsKKyAgZWxzZQorICAgIHJldHVybiB0aHJlYWRfbG9jYWxfc3RvcmFnZTsKK30KKworLyogQmFja2VuZCBtdXRleCBmdW5jdGlvbnMgKi8KKworLyogQWxsb2NhdGUgYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfYWxsb2NhdGUgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICB7CisgICAgICBtdXRleC0+YmFja2VuZCA9IG9iamNfbWFsbG9jIChzaXplb2YgKHB0aHJlYWRfbXV0ZXhfdCkpOworCisgICAgICBpZiAoX19ndGhyd18ocHRocmVhZF9tdXRleF9pbml0KSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCwgTlVMTCkpCisJeworCSAgb2JqY19mcmVlIChtdXRleC0+YmFja2VuZCk7CisJICBtdXRleC0+YmFja2VuZCA9IE5VTEw7CisJICByZXR1cm4gLTE7CisJfQorICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogRGVhbGxvY2F0ZSBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF9kZWFsbG9jYXRlIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgaW50IGNvdW50OworCisgICAgICAvKgorICAgICAgICogUG9zaXggVGhyZWFkcyBzcGVjaWZpY2FsbHkgcmVxdWlyZSB0aGF0IHRoZSB0aHJlYWQgYmUgdW5sb2NrZWQKKyAgICAgICAqIGZvciBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpIHRvIHdvcmsuCisgICAgICAgKi8KKworICAgICAgZG8KKwl7CisJICBjb3VudCA9IF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfdW5sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCk7CisJICBpZiAoY291bnQgPCAwKQorCSAgICByZXR1cm4gLTE7CisJfQorICAgICAgd2hpbGUgKGNvdW50KTsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpKQorCXJldHVybiAtMTsKKworICAgICAgb2JqY19mcmVlIChtdXRleC0+YmFja2VuZCk7CisgICAgICBtdXRleC0+YmFja2VuZCA9IE5VTEw7CisgICAgfQorICByZXR1cm4gMDsKK30KKworLyogR3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfbG9jayAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpCisgICAgICAmJiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2xvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIFRyeSB0byBncmFiIGEgbG9jayBvbiBhIG11dGV4LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF90cnlsb2NrIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkKKyAgICAgICYmIF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfdHJ5bG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpICE9IDApCisgICAgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogVW5sb2NrIHRoZSBtdXRleCAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X3VubG9jayAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpCisgICAgICAmJiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3VubG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpICE9IDApCisgICAgeworICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogQmFja2VuZCBjb25kaXRpb24gbXV0ZXggZnVuY3Rpb25zICovCisKKy8qIEFsbG9jYXRlIGEgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fYWxsb2NhdGUgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIGNvbmRpdGlvbi0+YmFja2VuZCA9IG9iamNfbWFsbG9jIChzaXplb2YgKHB0aHJlYWRfY29uZF90KSk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfaW5pdCkgKChwdGhyZWFkX2NvbmRfdCAqKSBjb25kaXRpb24tPmJhY2tlbmQsIE5VTEwpKQorCXsKKwkgIG9iamNfZnJlZSAoY29uZGl0aW9uLT5iYWNrZW5kKTsKKwkgIGNvbmRpdGlvbi0+YmFja2VuZCA9IE5VTEw7CisJICByZXR1cm4gLTE7CisJfQorICAgIH0KKworICByZXR1cm4gMDsKK30KKworLyogRGVhbGxvY2F0ZSBhIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2RlYW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ZF90IF9fdDEsIF9fZ3RocmVhZF90IF9fdDIpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2VxdWFsKSAoX190MSwgX190Mik7Cit9CisKK3N0YXRpYyBpbmxpbmUgX19ndGhyZWFkX3QKK19fZ3RocmVhZF9zZWxmICh2b2lkKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9zZWxmKSAoKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF95aWVsZCAodm9pZCkKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHNjaGVkX3lpZWxkKSAoKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vbmNlIChfX2d0aHJlYWRfb25jZV90ICpfX29uY2UsIHZvaWQgKCpfX2Z1bmMpICh2b2lkKSkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9vbmNlKSAoX19vbmNlLCBfX2Z1bmMpOworICBlbHNlCisgICAgcmV0dXJuIC0xOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2tleV9jcmVhdGUgKF9fZ3RocmVhZF9rZXlfdCAqX19rZXksIHZvaWQgKCpfX2R0b3IpICh2b2lkICopKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9rZXlfY3JlYXRlKSAoX19rZXksIF9fZHRvcik7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfa2V5X2RlbGV0ZSAoX19ndGhyZWFkX2tleV90IF9fa2V5KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9rZXlfZGVsZXRlKSAoX19rZXkpOworfQorCitzdGF0aWMgaW5saW5lIHZvaWQgKgorX19ndGhyZWFkX2dldHNwZWNpZmljIChfX2d0aHJlYWRfa2V5X3QgX19rZXkpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2dldHNwZWNpZmljKSAoX19rZXkpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX3NldHNwZWNpZmljIChfX2d0aHJlYWRfa2V5X3QgX19rZXksIGNvbnN0IHZvaWQgKl9fcHRyKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9zZXRzcGVjaWZpYykgKF9fa2V5LCBfX3B0cik7Cit9CisKKyNpZmRlZiBfR1RIUkVBRF9VU0VfTVVURVhfSU5JVF9GVU5DCitzdGF0aWMgaW5saW5lIHZvaWQKK19fZ3RocmVhZF9tdXRleF9pbml0X2Z1bmN0aW9uIChfX2d0aHJlYWRfbXV0ZXhfdCAqX19tdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2luaXQpIChfX211dGV4LCBOVUxMKTsKK30KKyNlbmRpZgorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX211dGV4X2Rlc3Ryb3kgKF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpIChfX211dGV4KTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX211dGV4X2xvY2sgKF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2xvY2spIChfX211dGV4KTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX211dGV4X3RyeWxvY2sgKF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3RyeWxvY2spIChfX211dGV4KTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisjaWYgX0dUSFJFQURfVVNFX01VVEVYX1RJTUVETE9DSworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9tdXRleF90aW1lZGxvY2sgKF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4LAorCQkJICAgY29uc3QgX19ndGhyZWFkX3RpbWVfdCAqX19hYnNfdGltZW91dCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9tdXRleF90aW1lZGxvY2spIChfX211dGV4LCBfX2Fic190aW1lb3V0KTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorI2VuZGlmCisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfbXV0ZXhfdW5sb2NrIChfX2d0aHJlYWRfbXV0ZXhfdCAqX19tdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spIChfX211dGV4KTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisjaWYgIWRlZmluZWQoIFBUSFJFQURfUkVDVVJTSVZFX01VVEVYX0lOSVRJQUxJWkVSX05QKSBcCisgIHx8IGRlZmluZWQoX0dUSFJFQURfVVNFX1JFQ1VSU0lWRV9NVVRFWF9JTklUX0ZVTkMpCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF9pbml0X2Z1bmN0aW9uIChfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3QgKl9fbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgcHRocmVhZF9tdXRleGF0dHJfdCBfX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ic190aW1lb3V0KQoreworICByZXR1cm4gX19ndGhyZWFkX211dGV4X3RpbWVkbG9jayAoX19tdXRleCwgX19hYnNfdGltZW91dCk7Cit9CisjZW5kaWYKKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdW5sb2NrIChfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3QgKl9fbXV0ZXgpCit7CisgIHJldHVybiBfX2d0aHJlYWRfbXV0ZXhfdW5sb2NrIChfX211dGV4KTsKK30KKworI2lmZGVmIF9HVEhSRUFEX1VTRV9DT05EX0lOSVRfRlVOQworc3RhdGljIGlubGluZSB2b2lkCitfX2d0aHJlYWRfY29uZF9pbml0X2Z1bmN0aW9uIChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgX19ndGhyd18ocHRocmVhZF9jb25kX2luaXQpIChfX2NvbmQsIE5VTEwpOworfQorI2VuZGlmCisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF9icm9hZGNhc3QgKF9fZ3RocmVhZF9jb25kX3QgKl9fY29uZCkKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9icm9hZGNhc3QpIChfX2NvbmQpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfc2lnbmFsIChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfc2lnbmFsKSAoX19jb25kKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3dhaXQgKF9fZ3RocmVhZF9jb25kX3QgKl9fY29uZCwgX19ndGhyZWFkX211dGV4X3QgKl9fbXV0ZXgpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfd2FpdCkgKF9fY29uZCwgX19tdXRleCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF90aW1lZHdhaXQgKF9fZ3RocmVhZF9jb25kX3QgKl9fY29uZCwgX19ndGhyZWFkX211dGV4X3QgKl9fbXV0ZXgsCisJCQkgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKl9fYWJzX3RpbWVvdXQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfdGltZWR3YWl0KSAoX19jb25kLCBfX211dGV4LCBfX2Fic190aW1lb3V0KTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3dhaXRfcmVjdXJzaXZlIChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsCisJCQkgICAgICAgX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF90ICpfX211dGV4KQoreworICByZXR1cm4gX19ndGhyZWFkX2NvbmRfd2FpdCAoX19jb25kLCBfX211dGV4KTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3RpbWVkd2FpdF9yZWN1cnNpdmUgKF9fZ3RocmVhZF9jb25kX3QgKl9fY29uZCwKKwkJCQkgICAgX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF90ICpfX211dGV4LAorCQkJCSAgICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICpfX2Fic190aW1lb3V0KQoreworICByZXR1cm4gX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0IChfX2NvbmQsIF9fbXV0ZXgsIF9fYWJzX3RpbWVvdXQpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfZGVzdHJveSAoX19ndGhyZWFkX2NvbmRfdCogX19jb25kKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX2Rlc3Ryb3kpIChfX2NvbmQpOworfQorCisjZW5kaWYgLyogX0xJQk9CSkMgKi8KKworI2VuZGlmIC8qIC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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKmFic190aW1lKTsKKworICAgICBpbnQgX19ndGhyZWFkX2NvbmRfc2lnbmFsIChfX2d0aHJlYWRfY29uZF90ICpjb25kKTsKKyAgICAgaW50IF9fZ3RocmVhZF9jb25kX3RpbWVkd2FpdCAoX19ndGhyZWFkX2NvbmRfdCAqY29uZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19ndGhyZWFkX211dGV4X3QgKm11dGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICphYnNfdGltZW91dCk7CisgICAgIGludCBfX2d0aHJlYWRfY29uZF90aW1lZHdhaXRfcmVjdXJzaXZlIChfX2d0aHJlYWRfY29uZF90ICpjb25kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF90ICptdXRleCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKmFic190aW1lKQorCisqLworCisjaWYgX19HWFhfV0VBS19fCisvKiBUaGUgcGUtY29mZiB3ZWFrIHN1cHBvcnQgaXNuJ3QgZnVsbHkgY29tcGF0aWJsZSB0byBFTEYncyB3ZWFrLgorICAgRm9yIHN0YXRpYyBsaWJyYXJpZXMgaXQgbWlnaHQgd291bGQgd29yaywgYnV0IGFzIHdlIG5lZWQgdG8gZGVhbAorICAgd2l0aCBzaGFyZWQgdmVyc2lvbnMgdG9vLCB3ZSBkaXNhYmxlIGl0IGZvciBtaW5ndy10YXJnZXRzLiAgKi8KKyNpZmRlZiBfR0xJQkNYWF9fX01JTkdXMzJfR0xJQkNYWF9fXworI3VuZGVmIF9HTElCQ1hYX0dUSFJFQURfVVNFX1dFQUsKKyNkZWZpbmUg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lwZS5jYworCituYW1lc3BhY2Ugc3RkIF9HTElCQ1hYX1ZJU0lCSUxJVFkoZGVmYXVsdCkKK3sKK19HTElCQ1hYX0JFR0lOX05BTUVTUEFDRV9WRVJTSU9OCisKKyAgYm9vbAorICBjdHlwZTxjaGFyPjo6CisgIGlzKG1hc2sgX19tLCBjaGFyIF9fYykgY29uc3QKKyAgeyByZXR1cm4gX01fdGFibGVbc3RhdGljX2Nhc3Q8dW5zaWduZWQgY2hhcj4oX19jKV0gJiBfX207IH0KKworICBjb25zdCBjaGFyKgorICBjdHlwZTxjaGFyPjo6CisgIGlzKGNvbnN0IGNoYXIqIF9fbG93LCBjb25zdCBjaGFyKiBfX2hpZ2gsIG1hc2sqIF9fdmVjKSBjb25zdAorICB7CisgICAgd2hpbGUgKF9fbG93IDwgX19oaWdoKQorICAgICAgKl9fdmVjKysgPSBfTV90YWJsZVtzdGF0aWNfY2FzdDx1bnNpZ25lZCBjaGFyPigqX19sb3crKyldOworICAgIHJldHVybiBfX2hpZ2g7CisgIH0KKworICBjb25zdCBjaGFyKgorICBjdHlwZTxjaGFyPjo6CisgIHNjYW5faXMobWFzayBfX20sIGNvbnN0IGNoYXIqIF9fbG93LCBjb25zdCBjaGFyKiBfX2hpZ2gpIGNvbnN0CisgIHsKKyAgICB3aGlsZSAoX19sb3cgPCBfX2hpZ2ggJiYgIXRoaXMtPmlzKF9fbSwgKl9fbG93KSkKKyAgICAgICsrX19sb3c7CisgICAgcmV0dXJuIF9fbG93OworICB9CisKKyAgY29uc3QgY2hhcioKKyAgY3R5cGU8Y2hhcj46OgorICBzY2FuX25vdChtYXNrIF9fbSwgY29uc3QgY2hhciogX19sb3csIGNvbnN0IGNoYXIqIF9faGlnaCkgY29uc3QKKyAgeworICAgIHdoaWxlIChfX2xvdyA8IF9faGlnaCAmJiB0aGlzLT5pcyhfX20sICpfX2xvdykgIT0gMCkKKyAgICAgICsrX19sb3c7CisgICAgcmV0dXJuIF9fbG93OworICB9CisKK19HTElCQ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2d0aHJ3MyhwdGhyZWFkX2VxdWFsKQorX19ndGhydzMocHRocmVhZF9zZWxmKQorX19ndGhydzMocHRocmVhZF9jYW5jZWwpCitfX2d0aHJ3MyhzY2hlZF95aWVsZCkKKworX19ndGhydzMocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGhydzMocHRocmVhZF9tdXRleF90cnlsb2NrKQorI2lmIF9HVEhSRUFEX1VTRV9NVVRFWF9USU1FRExPQ0sKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfdGltZWRsb2NrKQorI2VuZGlmCitfX2d0aHJ3MyhwdGhyZWFkX211dGV4X3VubG9jaykKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfaW5pdCkKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkKKworX19ndGhydzMocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3MyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KQorX19ndGhydzMocHRocmVhZF9jb25kX3NpZ25hbCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydzMocHRocmVhZF9jb25kX3RpbWVkd2FpdCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF9kZXN0cm95KQorI2Vsc2UKK19fZ3RocncocHRocmVhZF9vbmNlKQorX19ndGhydyhwdGhyZWFkX2dldHNwZWNpZmljKQorX19ndGhydyhwdGhyZWFkX3NldHNwZWNpZmljKQorCitfX2d0aHJ3KHB0aHJlYWRfY3JlYXRlKQorX19ndGhydyhwdGhyZWFkX2pvaW4pCitfX2d0aHJ3KHB0aHJlYWRfZXF1YWwpCitfX2d0aHJ3KHB0aHJlYWRfc2VsZikKK19fZ3RocncocHRocmVhZF9kZXRhY2gpCisjaWZuZGVmIF9fQklPTklDX18KK19fZ3RocncocHRocmVhZF9jYW5jZWwpCisjZW5kaWYKK19fZ3Rocncoc2NoZWRfeWllbGQpCisKK19fZ3RocncocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGh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IFBvc2l4IFRocmVhZHMgc3BlY2lmaWNhbGx5IHJlcXVpcmUgdGhhdCB0aGUgdGhyZWFkIGJlIHVubG9ja2VkCisgICAgICAgKiBmb3IgX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSB0byB3b3JrLgorICAgICAgICovCisKKyAgICAgIGRvCisJeworCSAgY291bnQgPSBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3VubG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworCSAgaWYgKGNvdW50IDwgMCkKKwkgICAgcmV0dXJuIC0xOworCX0KKyAgICAgIHdoaWxlIChjb3VudCk7CisKKyAgICAgIGlmIChfX2d0aHJ3XyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSkKKwlyZXR1cm4gLTE7CisKKyAgICAgIG9iamNfZnJlZSAobXV0ZXgtPmJhY2tlbmQpOworICAgICAgbXV0ZXgtPmJhY2tlbmQgPSBOVUxMOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKy8qIEdyYWIgYSBsb2NrIG9uIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2xvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF9sb2NrKSAoKHB0aHJlYWRfbXV0ZXhfdCAqKSBtdXRleC0+YmFja2VuZCkgIT0gMCkKKyAgICB7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIHJldHVybiAwOworfQorCisvKiBUcnkgdG8gZ3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdHJ5bG9jayAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpCisgICAgICAmJiBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3RyeWxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIFVubG9jayB0aGUgbXV0ZXggKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19tdXRleF91bmxvY2sgKG9iamNfbXV0ZXhfdCBtdXRleCkKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKQorICAgICAgJiYgX19ndGhyd18ocHRocmVhZF9tdXRleF91bmxvY2spICgocHRocmVhZF9tdXRleF90ICopIG11dGV4LT5iYWNrZW5kKSAhPSAwKQorICAgIHsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIEJhY2tlbmQgY29uZGl0aW9uIG11dGV4IGZ1bmN0aW9ucyAqLworCisvKiBBbGxvY2F0ZSBhIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2FsbG9jYXRlIChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbikKK3sKKyAgaWYgKF9fZ3RocmVhZF9hY3RpdmVfcCAoKSkKKyAgICB7CisgICAgICBjb25kaXRpb24tPmJhY2tlbmQgPSBvYmpjX21hbGxvYyAoc2l6ZW9mIChwdGhyZWFkX2NvbmRfdCkpOworCisgICAgICBpZiAoX19ndGhyd18ocHRocmVhZF9jb25kX2luaXQpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kLCBOVUxMKSkKKwl7CisJICBvYmpjX2ZyZWUgKGNvbmRpdGlvbi0+YmFja2VuZCk7CisJICBjb25kaXRpb24tPmJhY2tl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b25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9icm9hZGNhc3QpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIG9uZSB0aHJlYWQgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3NpZ25hbCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9zaWduYWwpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisjZWxzZSAvKiBfTElCT0JKQyAqLworCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NyZWF0ZSAoX19ndGhyZWFkX3QgKl9fdGhyZWFkaWQsIHZvaWQgKigqX19mdW5jKSAodm9pZCopLAorCQkgIHZvaWQgKl9fYXJncykKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY3JlYXRlKSAoX190aHJlYWRpZCwgTlVMTCwgX19mdW5jLCBfX2FyZ3MpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2pvaW4gKF9fZ3RocmVhZF90IF9fdGhyZWFkaWQsIHZvaWQgKipfX3ZhbHVlX3B0cikKK3sKKyAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfam9pbikgKF9fdGhyZWFkaWQsIF9fdmFsdWVfcHRyKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9kZXRhY2ggKF9fZ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ocnczKHB0aHJlYWRfbXV0ZXhfaW5pdCkKK19fZ3RocnczKHB0aHJlYWRfbXV0ZXhfZGVzdHJveSkKKworX19ndGhydzMocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3MyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KQorX19ndGhydzMocHRocmVhZF9jb25kX3NpZ25hbCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF93YWl0KQorX19ndGhydzMocHRocmVhZF9jb25kX3RpbWVkd2FpdCkKK19fZ3RocnczKHB0aHJlYWRfY29uZF9kZXN0cm95KQorI2Vsc2UKK19fZ3RocncocHRocmVhZF9vbmNlKQorX19ndGhydyhwdGhyZWFkX2dldHNwZWNpZmljKQorX19ndGhydyhwdGhyZWFkX3NldHNwZWNpZmljKQorCitfX2d0aHJ3KHB0aHJlYWRfY3JlYXRlKQorX19ndGhydyhwdGhyZWFkX2pvaW4pCitfX2d0aHJ3KHB0aHJlYWRfZXF1YWwpCitfX2d0aHJ3KHB0aHJlYWRfc2VsZikKK19fZ3RocncocHRocmVhZF9kZXRhY2gpCisjaWZuZGVmIF9fQklPTklDX18KK19fZ3RocncocHRocmVhZF9jYW5jZWwpCisjZW5kaWYKK19fZ3Rocncoc2NoZWRfeWllbGQpCisKK19fZ3RocncocHRocmVhZF9tdXRleF9sb2NrKQorX19ndGhydyhwdGhyZWFkX211dGV4X3RyeWxvY2spCisjaWYgX0dUSFJFQURfVVNFX01VVEVYX1RJTUVETE9DSworX19ndGhydyhwdGhyZWFkX211dGV4X3RpbWVkbG9jaykKKyNlbmRpZgorX19ndGhydyhwdGhyZWFkX211dGV4X3VubG9jaykKK19fZ3RocncocHRocmVhZF9tdXRleF9pbml0KQorX19ndGhydyhwdGhyZWFkX211dGV4X2Rlc3Ryb3kpCisKK19fZ3RocncocHRocmVhZF9jb25kX2luaXQpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9icm9hZGNhc3QpCitfX2d0aHJ3KHB0aHJlYWRfY29uZF9za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FsbG9jYXRlIGEgbXV0ZXguICAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X2FsbG9jYXRlIChvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgeworICAgICAgbXV0ZXgtPmJhY2tlbmQgPSBvYmpjX21hbGxvYyAoc2l6ZW9mIChwdGhyZWFkX211dGV4X3QpKTsKKworICAgICAgaWYgKF9fZ3RocndfKHB0aHJlYWRfbXV0ZXhfaW5pdCkgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQsIE5VTEwpKQorCXsKKwkgIG9iamNfZnJlZSAobXV0ZXgtPmJhY2tlbmQpOworCSAgbXV0ZXgtPmJhY2tlbmQgPSBOVUxMOworCSAgcmV0dXJuIC0xOworCX0KKyAgICB9CisKKyAgcmV0dXJuIDA7Cit9CisKKy8qIERlYWxsb2NhdGUgYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfZGVhbGxvY2F0ZSAob2JqY19tdXRleF90IG11dGV4KQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIHsKKyAgICAgIGludCBjb3VudDsKKworICAgICAgLyoKKyAgICAgICAqIFBvc2l4IFRocmVhZHMgc3BlY2lmaWNhbGx5IHJlcXVpcmUgdGhhdCB0aGUgdGhyZWFkIGJlIHVubG9ja2VkCisgICAgICAgKiBmb3IgX19ndGhyd18ocHRocmVhZF9tdXRleF9kZXN0cm95KSB0byB3b3JrLgorICAgICAgICovCisKKyAgICAgIGRvCisJeworCSAgY291bnQgPSBfX2d0aHJ3XyhwdGhyZWFkX211dGV4X3VubG9jaykgKChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworCSAgaWYgKGNvdW50IDwgMCkKKwkgICAgcmV0dXJuIC0xOworCX0KKyAgICAgIHdoa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gKikgY29uZGl0aW9uLT5iYWNrZW5kKSkKKwlyZXR1cm4gLTE7CisKKyAgICAgIG9iamNfZnJlZSAoY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgICAgIGNvbmRpdGlvbi0+YmFja2VuZCA9IE5VTEw7CisgICAgfQorICByZXR1cm4gMDsKK30KKworLyogV2FpdCBvbiB0aGUgY29uZGl0aW9uICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3dhaXQgKG9iamNfY29uZGl0aW9uX3QgY29uZGl0aW9uLCBvYmpjX211dGV4X3QgbXV0ZXgpCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF93YWl0KSAoKHB0aHJlYWRfY29uZF90ICopIGNvbmRpdGlvbi0+YmFja2VuZCwKKwkJCSAgICAgIChwdGhyZWFkX211dGV4X3QgKikgbXV0ZXgtPmJhY2tlbmQpOworICBlbHNlCisgICAgcmV0dXJuIDA7Cit9CisKKy8qIFdha2UgdXAgYWxsIHRocmVhZHMgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2Jyb2FkY2FzdCAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24pCit7CisgIGlmIChfX2d0aHJlYWRfYWN0aXZlX3AgKCkpCisgICAgcmV0dXJuIF9fZ3RocndfKHB0aHJlYWRfY29uZF9icm9hZGNhc3QpICgocHRocmVhZF9jb25kX3QgKikgY29uZGl0aW9uLT5iYWNrZW5kKTsKKyAgZWxzZQorICAgIHJldHVybiAwOworfQorCisvKiBXYWtlIHVwIG9uZSB0aHJlYWQgd2FpdGluZyBvbiB0aGlzIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX3NpZ25hbCAob2Jq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BpbmxpbmUgaW50CitfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3VubG9jayAoX19ndGhyZWFkX3JlY3Vyc2l2ZV9tdXRleF90ICpfX211dGV4KQoreworICByZXR1cm4gX19ndGhyZWFkX211dGV4X3VubG9jayAoX19tdXRleCk7Cit9CisKKyNpZmRlZiBfR1RIUkVBRF9VU0VfQ09ORF9JTklUX0ZVTkMKK3N0YXRpYyBpbmxpbmUgdm9pZAorX19ndGhyZWFkX2NvbmRfaW5pdF9mdW5jdGlvbiAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kKQoreworICBpZiAoX19ndGhyZWFkX2FjdGl2ZV9wICgpKQorICAgIF9fZ3RocndfKHB0aHJlYWRfY29uZF9pbml0KSAoX19jb25kLCBOVUxMKTsKK30KKyNlbmRpZgorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfYnJvYWRjYXN0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQpCit7CisgIHJldHVybiBfX2d0aHJ3XyhwdGhyZWFkX2NvbmRfYnJvYWRjYXN0KSAoX19jb25kKTsKK30KKworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9jb25kX3NpZ25hbCAoX19ndGhyZWFkX2NvbmRfdCAqX19jb25kKQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3NpZ25hbCkgKF9fY29uZCk7Cit9CisKK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfY29uZF93YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRleF90ICpfX211dGV4KQoreworICByZXR1cm4gX19ndGhyd18ocHRocmVhZF9jb25kX3dhaXQpIChfX2NvbmQsIF9fbXV0ZXgpOworfQorCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX2NvbmRfdGltZWR3YWl0IChfX2d0aHJlYWRfY29uZF90ICpfX2NvbmQsIF9fZ3RocmVhZF9tdXRle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WFhfVU5VU0VEKQoreworICAvKiBObyB0aHJlYWQgc3VwcG9ydCBhdmFpbGFibGUgKi8KKyAgcmV0dXJuIE5VTEw7Cit9CisKKy8qIFNldCB0aGUgY3VycmVudCB0aHJlYWQncyBwcmlvcml0eS4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfdGhyZWFkX3NldF9wcmlvcml0eSAoaW50IHByaW9yaXR5IF9HTElCQ1hYX1VOVVNFRCkKK3sKKyAgLyogTm8gdGhyZWFkIHN1cHBvcnQgYXZhaWxhYmxlICovCisgIHJldHVybiAtMTsKK30KKworLyogUmV0dXJuIHRoZSBjdXJyZW50IHRocmVhZCdzIHByaW9yaXR5LiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY190aHJlYWRfZ2V0X3ByaW9yaXR5ICh2b2lkKQoreworICByZXR1cm4gT0JKQ19USFJFQURfSU5URVJBQ1RJVkVfUFJJT1JJVFk7Cit9CisKKy8qIFlpZWxkIG91ciBwcm9jZXNzIHRpbWUgdG8gYW5vdGhlciB0aHJlYWQuICAqLworc3RhdGljIGlubGluZSB2b2lkCitfX2d0aHJlYWRfb2JqY190aHJlYWRfeWllbGQgKHZvaWQpCit7CisgIHJldHVybjsKK30KKworLyogVGVybWluYXRlIHRoZSBjdXJyZW50IHRocmVhZC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfdGhyZWFkX2V4aXQgKHZvaWQpCit7CisgIC8qIE5vIHRocmVhZCBzdXBwb3J0IGF2YWlsYWJsZSAqLworICAvKiBTaG91bGQgd2UgcmVhbGx5IGV4aXQgdGhlIHByb2dyYW0gKi8KKyAgLyogZXhpdCAoJl9fb2JqY190aHJlYWRfZXhpdF9zdGF0dXMpOyAqLworICByZXR1cm4gLTE7Cit9CisKKy8qIFJldHVybnMgYW4gaW50ZWdlciB2YWx1ZSB3aGljaCB1bmlxdWVseSBkZXNjcmliZXMgYSB0aHJlYWQuIC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vYmpjX211dGV4X3QgbXV0ZXggX0dMSUJDWFhfVU5VU0VEKQoreworICAvKiBUaGVyZSBjYW4gb25seSBiZSBvbmUgdGhyZWFkLCBzbyB3ZSBhbHdheXMgZ2V0IHRoZSBsb2NrICovCisgIHJldHVybiAwOworfQorCisvKiBUcnkgdG8gZ3JhYiBhIGxvY2sgb24gYSBtdXRleC4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfbXV0ZXhfdHJ5bG9jayAob2JqY19tdXRleF90IG11dGV4IF9HTElCQ1hYX1VOVVNFRCkKK3sKKyAgLyogVGhlcmUgY2FuIG9ubHkgYmUgb25lIHRocmVhZCwgc28gd2UgYWx3YXlzIGdldCB0aGUgbG9jayAqLworICByZXR1cm4gMDsKK30KKworLyogVW5sb2NrIHRoZSBtdXRleCAqLworc3RhdGljIGlubGluZSBpbnQKK19fZ3RocmVhZF9vYmpjX211dGV4X3VubG9jayAob2JqY19tdXRleF90IG11dGV4IF9HTElCQ1hYX1VOVVNFRCkKK3sKKyAgcmV0dXJuIDA7Cit9CisKKy8qIEJhY2tlbmQgY29uZGl0aW9uIG11dGV4IGZ1bmN0aW9ucyAqLworCisvKiBBbGxvY2F0ZSBhIGNvbmRpdGlvbi4gICovCitzdGF0aWMgaW5saW5lIGludAorX19ndGhyZWFkX29iamNfY29uZGl0aW9uX2FsbG9jYXRlIChvYmpjX2NvbmRpdGlvbl90IGNvbmRpdGlvbiBfR0xJQkNYWF9VTlVTRUQpCit7CisgIHJldHVybiAwOworfQorCisvKiBEZWFsbG9jYXRlIGEgY29uZGl0aW9uLiAgKi8KK3N0YXRpYyBpbmxpbmUgaW50CitfX2d0aHJlYWRfb2JqY19jb25kaXRpb25fZGVhbGxvY2F0ZSAob2JqY19jb25kaXRpb25fdCBjb25kaXRpb24gX0dMSUJDWFhfVU5VU0VEKQoreworICByZXR1cm4gMDsKK30KKworLyogV2FpdCBvbiB0aGUgY29uZGl0aW9uICovCitzdGF0aWMgaW5saW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sZSB0aGUgYysrMHggdGhyZWFkIGxpYnJhcnkuCisKKyAgIFR5cGVzOgorICAgICBfX2d0aHJlYWRfdAorICAgICBfX2d0aHJlYWRfdGltZV90CisKKyAgIEludGVyZmFjZToKKyAgICAgaW50IF9fZ3RocmVhZF9jcmVhdGUgKF9fZ3RocmVhZF90ICp0aHJlYWQsIHZvaWQgKigqZnVuYykgKHZvaWQqKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgKmFyZ3MpOworICAgICBpbnQgX19ndGhyZWFkX2pvaW4gKF9fZ3RocmVhZF90IHRocmVhZCwgdm9pZCAqKnZhbHVlX3B0cik7CisgICAgIGludCBfX2d0aHJlYWRfZGV0YWNoIChfX2d0aHJlYWRfdCB0aHJlYWQpOworICAgICBpbnQgX19ndGhyZWFkX2VxdWFsIChfX2d0aHJlYWRfdCB0MSwgX19ndGhyZWFkX3QgdDIpOworICAgICBfX2d0aHJlYWRfdCBfX2d0aHJlYWRfc2VsZiAodm9pZCk7CisgICAgIGludCBfX2d0aHJlYWRfeWllbGQgKHZvaWQpOworCisgICAgIGludCBfX2d0aHJlYWRfbXV0ZXhfdGltZWRsb2NrIChfX2d0aHJlYWRfbXV0ZXhfdCAqbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IF9fZ3RocmVhZF90aW1lX3QgKmFic190aW1lb3V0KTsKKyAgICAgaW50IF9fZ3RocmVhZF9yZWN1cnNpdmVfbXV0ZXhfdGltZWRsb2NrIChfX2d0aHJlYWRfcmVjdXJzaXZlX211dGV4X3QgKm0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBfX2d0aHJlYWRfdGltZV90ICphYnNfdGltZSk7CisKKyAgICAgaW50IF9fZ3RocmVhZF9jb25kX3NpZ25hbCAoX19ndGhyZWFkX2NvbmRfdCAqY29uZCk7CisgICAgIGludCBfX2d0aHJlYWRfY29uZF90aW1lZHdhaXQgKF9fZ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