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TWFwLmVuZCgpOworICAgICAgICAgdGV4dHVyZUl0KyspCisgICAgeworICAgICAgICBzdGF0aWMgYm9vbCBkb1NlcGFyYXRvcihmYWxzZSk7CisgICAgICAgIGlmIChkb1NlcGFyYXRvcikKKyAgICAgICAgeworICAgICAgICAgICAgb3B0aW9uVmFsdWVzICs9ICIsIjsKKyAgICAgICAgfQorICAgICAgICBjb25zdCBzdHJpbmcmIGN1ck5hbWUgPSB0ZXh0dXJlSXQtPmZpcnN0OworICAgICAgICBvcHRpb25WYWx1ZXMgKz0gY3VyTmFtZTsKKyAgICAgICAgZG9TZXBhcmF0b3IgPSB0cnVlOworICAgIH0KKyAgICBvcHRpb25zX1sidGV4dHVyZSJdID0gU2NlbmU6Ok9wdGlvbigidGV4dHVyZSIsICJuYXNhMSIsICJXaGljaCB0ZXh0dXJlIHRvIHVzZSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uVmFsdWVzKTsKKyAgICBvcHRpb25zX1sidXNlLXZibyJdID0gU2NlbmU6Ok9wdGlvbigidXNlLXZibyIsICJ0cnVlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiV2hldGhlciB0byB1c2UgVkJPcyBmb3IgcmVuZGVyaW5nIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZmFsc2UsdHJ1ZSIpOworICAgIG9wdGlvbnNfWyJpbnRlcmxlYXZlIl0gPSBTY2VuZTo6T3B0aW9uKCJpbnRlcmxlYXZlIiwgImZhbHNlIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiV2hldGhlciB0byBpbnRlcmxlYXZlIHZlcnRleCBhdHRyaWJ1dGUgZGF0YSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZhbHNlLHRydWUiKTsKK30KKworU2NlbmVSZWZyYWN0Ojp+U2NlbmVSZWZyYWN0KCk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ICAgUHJvZ3JhbSYgcHJvZ3JhbSgpIHsgcmV0dXJuIHByb2dyYW1fOyB9Cit9OworCitjbGFzcyBSZWZyYWN0UHJpdmF0ZQoreworICAgIENhbnZhcyYgY2FudmFzXzsKKyAgICBEaXN0YW5jZVJlbmRlclRhcmdldCBkZXB0aFRhcmdldF87CisgICAgUHJvZ3JhbSBwcm9ncmFtXzsKKyAgICBMaWJNYXRyaXg6OlN0YWNrNCBtb2RlbHZpZXdfOworICAgIExpYk1hdHJpeDo6U3RhY2s0IHByb2plY3Rpb25fOworICAgIE1lc2ggbWVzaF87CisgICAgTGliTWF0cml4Ojp2ZWMzIGNlbnRlclZlY187CisgICAgYm9vbCBvcmllbnRNb2RlbF87CisgICAgZmxvYXQgb3JpZW50YXRpb25BbmdsZV87CisgICAgTGliTWF0cml4Ojp2ZWMzIG9yaWVudGF0aW9uVmVjXzsKKyAgICBmbG9hdCByYWRpdXNfOworICAgIGZsb2F0IHJvdGF0aW9uXzsKKyAgICBmbG9hdCByb3RhdGlvblNwZWVkXzsKKyAgICB1bnNpZ25lZCBpbnQgdGV4dHVyZV87CisgICAgYm9vbCB1c2VWYm9fOworICAgIAorcHVibGljOgorICAgIFJlZnJhY3RQcml2YXRlKENhbnZhcyYgY2FudmFzKSA6CisgICAgICAgIGNhbnZhc18oY2FudmFzKSwKKyAgICAgICAgb3JpZW50TW9kZWxfKGZhbHNlKSwKKyAgICAgICAgb3JpZW50YXRpb25BbmdsZV8oMC4wKSwKKyAgICAgICAgcmFkaXVzXygwLjApLAorICAgICAgICByb3RhdGlvbl8oMC4wKSwKKyAgICAgICAgcm90YXRpb25TcGVlZF8oMzYuMCksCisgICAgICAgIHRleHR1cmVfKDApLAorICAgICAgICB1c2VWYm9fKHRydWUpIHt9CisgICAgflJlZnJhY3RQcml2YXRlKCkge30KKworICAgIGJvb2wgc2V0dXAoc3RkOjptYXA8c3RkOjpzdHJpbmcsIFNjZW5lOjpPcHRpb24+JiBvcHRpb25zKTsKKyAgICB2b2lkIHRlYXJkb3duKCk7CisgICAgdm9pZCB1cGRhdGUoZG91YmxlIGVsYXBzZWRUaW1lKTsKKyAgICB2b2lkIGRyYXcoKTsKK307CisKKyNlbmRpZiAvLyBTQ0VORV9SRUZSQUNUXwpkaWZmIC0tZ2l0IGEvc3JjL3NjZW5lLmggYi9zcmMvc2NlbmUuaAppbmRleCBkZDc3YmE5Li44OGY4MzlkIDEwMDY0NAotLS0gYS9zcmMvc2NlbmUuaAorKysgYi9zcmMvc2NlbmUuaApAQCAtNTc0LDQgKzU3NCwyMSBAQAogICAgIFZhbGlkYXRpb25SZXN1bHQgdmFsaWRhdGUoKTsKIH07CiAKK2NsYXNzIFJlZnJhY3RQcml2YXRlOworY2xhc3MgU2NlbmVSZWZyYWN0IDogcHVibGljIFNjZW5lCit7CisgICAgUmVmcmFjdFByaXZhdGUqIHByaXZfOworcHVibGljOgorICAgIFNjZW5lUmVmcmFjdChDYW52YXMmIGNhbnZhcyk7CisgICAgflNjZW5lUmVmcmFjdCgpOworICAgIGJvb2wgc3VwcG9ydGVkKGJvb2wgc2hvd19lcnJvcnMpOworICAgIGJvb2wgbG9hZCgpOworICAgIHZvaWQgdW5sb2FkKCk7CisgICAgYm9vbCBzZXR1cCgpOworICAgIHZvaWQgdGVhcmRvd24oKTsKKyAgICB2b2lkIHVwZGF0ZSgpOworICAgIHZvaWQgZHJhdygpOworICAgIFZhbGlkYXRpb25SZXN1bHQgdmFsaWRhdGUoKTsKK307CisKICNlbmRpZgo=