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HlwZW5hbWUgVT4KKyAgICAgICAgICAgIHN0cnVjdCByZWJpbmQgeworICAgICAgICAgICAgICAgIHR5cGVkZWYgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRbXSwgVT4gb3RoZXI7CisgICAgICAgICAgICB9OworICAgICAgICAgICAgYWxsb2NhdGVfYXJyYXlfaGVscGVyKGNvbnN0IEEmIGFsbG9jYXRvciwgc3RkOjpzaXplX3Qgc2l6ZSwgVCoqIGRhdGEpCisgICAgICAgICAgICAgICAgOiBhbGxvY2F0b3IoYWxsb2NhdG9yKSwKKyAgICAgICAgICAgICAgICAgIHNpemUoc2l6ZW9mKFQpICogc2l6ZSksCisgICAgICAgICAgICAgICAgICBkYXRhKGRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPGNsYXNzIFU+CisgICAgICAgICAgICBhbGxvY2F0ZV9hcnJheV9oZWxwZXIoY29uc3QgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRbXSwgVT4mIG90aGVyKSAKKyAgICAgICAgICAgICAgICA6IGFsbG9jYXRvcihvdGhlci5hbGxvY2F0b3IpLAorICAgICAgICAgICAgICAgICAgc2l6ZShvdGhlci5zaXplKSwKKyAgICAgICAgICAgICAgICAgIGRhdGEob3RoZXIuZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9pbnRlciBhZGRyZXNzKHJlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IuYWRkcmVzcyh2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb25zdF9wb2ludGVyIGFkZHJlc3MoY29uc3RfcmVmZXJlbmNlIHZhbHVlKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFsbG9jYXRvci5hZGRyZXNzKHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNpemVfdHlwZSBtYXhfc2l6ZSgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWxsb2NhdG9yLm1heF9zaXplKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFsbG9jYXRlKHNpemVfdHlwZSBjb3VudCwgY29uc3Qgdm9pZCogdmFsdWUgPSAwKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIGNoYXIqICBwMSA9IEEzKGFsbG9jYXRvcikuYWxsb2NhdGUobjEgKyBzaXplLCB2YWx1ZSk7CisgICAgICAgICAgICAgICAgY2hhciogIHAyID0gcDEgKyBuMTsKKyAgICAgICAgICAgICAgICB3aGlsZSAoc3RkOjpzaXplX3QocDIpICUgYTEgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBwMi0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAqZGF0YSA9IHJlaW50ZXJwcmV0X2Nhc3Q8VCo+KHAyKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gIHJlaW50ZXJwcmV0X2Nhc3Q8WSo+KHAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgZGVhbGxvY2F0ZShwb2ludGVyIG1lbW9yeSwgc2l6ZV90eXBlIGNvdW50KSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIGNoYXIqICBwMSA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhcio+KG1lbW9yeSk7CisgICAgICAgICAgICAgICAgQTMoYWxsb2NhdG9yKS5kZWFsbG9jYXRlKHAxLCBuMSArIHNpemUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBjb25zdHJ1Y3QocG9pbnRlciBtZW1vcnksIGNvbnN0IFkmIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgYWxsb2NhdG9yLmNvbnN0cnVjdChtZW1vcnksIHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgZGVzdHJveShwb2ludGVyIG1lbW9yeSkgeworICAgICAgICAgICAgICAgIGFsbG9jYXRvci5kZXN0cm95KG1lbW9yeSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgYm9vbCBvcGVyYXRvcj09KGNvbnN0IGFsbG9jYXRlX2FycmF5X2hlbHBlcjxBLCBUW10sIFU+JiBvdGhlcikgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IgPT0gb3RoZXIuYWxsb2NhdG9yOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3IhPShjb25zdCBhbGxvY2F0ZV9hcnJheV9oZWxwZXI8QSwgVFtdLCBVPiYgb3RoZXIpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gISgqdGhpcyA9PSBvdGhlcik7IAorICAgICAgICAgICAgfQorICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgQTIgYWxsb2NhdG9yOworICAgICAgICAgICAgc3RkOjpzaXplX3Qgc2l6ZTsKKyAgICAgICAgICAgIFQqKiBkYXRhOworICAgICAgICB9OworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBBLCB0eXBlbmFtZSBULCBzdGQ6OnNpemVfdCBOLCB0eXBlbmFtZSBZPgorICAgICAgICBjbGFz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ZV9hcnJheV9oZWxwZXI8QSwgVFtOXSwgVT4gb3RoZXI7CisgICAgICAgICAgICB9OworICAgICAgICAgICAgYWxsb2NhdGVfYXJyYXlfaGVscGVyKGNvbnN0IEEmIGFsbG9jYXRvciwgVCoqIGRhdGEpCisgICAgICAgICAgICAgICAgOiBhbGxvY2F0b3IoYWxsb2NhdG9yKSwKKyAgICAgICAgICAgICAgICAgIGRhdGEoZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8Y2xhc3MgVT4KKyAgICAgICAgICAgIGFsbG9jYXRlX2FycmF5X2hlbHBlcihjb25zdCBhbGxvY2F0ZV9hcnJheV9oZWxwZXI8QSwgVFtOXSwgVT4mIG90aGVyKSAKKyAgICAgICAgICAgICAgICA6IGFsbG9jYXRvcihvdGhlci5hbGxvY2F0b3IpLAorICAgICAgICAgICAgICAgICAgZGF0YShvdGhlci5kYXRhKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFkZHJlc3MocmVmZXJlbmNlIHZhbHVlKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFsbG9jYXRvci5hZGRyZXNzKHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbnN0X3BvaW50ZXIgYWRkcmVzcyhjb25zdF9yZWZlcmVuY2UgdmFsdWUpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWxsb2NhdG9yLmFkZHJlc3ModmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2l6ZV90eXBlIG1heF9zaXplKCkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IubWF4X3NpemUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBvaW50ZXIgYWxsb2NhdGUoc2l6ZV90eXBlIGNvdW50LCBjb25zdCB2b2lkKiB2YWx1ZSA9IDApIHsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBhMSA9IG5kbmJvb3N0OjphbGlnbm1lbnRfb2Y8VD46OnZhbHVlOworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IG4xID0gY291bnQgKiBzaXplb2YoWSkgKyBhMSAtIDE7CisgICAgICAgICAgICAgICAgY2hhciogIHAxID0gQTMoYWxsb2NhdG9yKS5hbGxvY2F0ZShuMSArIE4xLCB2YWx1ZSk7CisgICAgICAgICAgICAgICAgY2hhciogIHAyID0gcDEgKyBuMTsKKyAgICAgICAgICAgICAgICB3aGlsZSAoc3RkOjpzaXplX3QocDIpICUgYTEgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBwMi0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAqZGF0YSA9IHJlaW50ZXJwcmV0X2Nhc3Q8VCo+KHAyKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gIHJlaW50ZXJwcmV0X2Nhc3Q8WSo+KHAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgZGVhbGxvY2F0ZShwb2ludGVyIG1lbW9yeSwgc2l6ZV90eXBlIGNvdW50KSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIGNoYXIqICBwMSA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y2hhcio+KG1lbW9yeSk7CisgICAgICAgICAgICAgICAgQTMoYWxsb2NhdG9yKS5kZWFsbG9jYXRlKHAxLCBuMSArIE4xKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgY29uc3RydWN0KHBvaW50ZXIgbWVtb3J5LCBjb25zdCBZJiB2YWx1ZSkgeworICAgICAgICAgICAgICAgIGFsbG9jYXRvci5jb25zdHJ1Y3QobWVtb3J5LCB2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlc3Ryb3kocG9pbnRlciBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBhbGxvY2F0b3IuZGVzdHJveShtZW1vcnkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3I9PShjb25zdCBhbGxvY2F0ZV9hcnJheV9oZWxwZXI8QSwgVFtOXSwgVT4mIG90aGVyKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFsbG9jYXRvciA9PSBvdGhlci5hbGxvY2F0b3I7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgYm9vbCBvcGVyYXRvciE9KGNvbnN0IGFsbG9jYXRlX2FycmF5X2hlbHBlcjxBLCBUW05dLCBVPiYgb3RoZXIpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gISgqdGhpcyA9PSBvdGhlcik7IAorICAgICAgICAgICAgfQorICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgZW51bSB7CisgICAgICAgICAgICAgICAgTjEgPSBOICogc2l6ZW9mKFQpCisgICAgICAgICAgICB9OworICAgICAgICAgICAgQTIgYWxsb2NhdG9yOworICAgICAgICAgICAgVCoqIGRhdGE7CisgICAgICAgIH07CisgICAgfQorfQorCisjZW5kaWYKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXJyYXlfZGVsZXRlci5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2FycmF5X2RlbGV0ZXIuaHBwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjJhZmU5NmMKLS0tIC9kZXYvbnVsbAorKysgYi9uZG5ib29zdC9zbWFydF9w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ICAgICAgICAgICAgICAgIGlmIChvYmplY3QpIHsKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShvYmplY3QsIHNpemUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgaW5pdChUKiBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0KG1lbW9yeSwgc2l6ZSk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1JWQUxVRV9SRUZFUkVOQ0VTKQorICAgICAgICAgICAgdm9pZCBpbml0KFQqIG1lbW9yeSwgVCYmIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF92YWx1ZShtZW1vcnksIHNpemUsIHNwX2ZvcndhcmQ8VD4odmFsdWUpKTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7ICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1ZBUklBRElDX1RFTVBMQVRFUykKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIEFyZ3M+CisgICAgICAgICAgICB2b2lkIGluaXQoVCogbWVtb3J5LCBBcmdzJiYuLi4gYXJncykgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfYXJncyhtZW1vcnksIHNpemUsIHNwX2ZvcndhcmQ8QXJncz4oYXJncykuLi4pOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyNlbmRpZgorI2VuZGlmCisgICAgICAgICAgICB2b2lkIGluaXRfbGlzdChUKiBtZW1vcnksIGNvbnN0IFQqIGxpc3QpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0X2xpc3QobWVtb3J5LCBzaXplLCBsaXN0KTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTxzdGQ6OnNpemVfdCBNPgorICAgICAgICAgICAgdm9pZCBpbml0X2xpc3QoVCogbWVtb3J5LCBjb25zdCBUKiBsaXN0KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF9saXN0PFQsIE0+KG1lbW9yeSwgc2l6ZSwgbGlzdCk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBub2luaXQoVCogbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfbm9pbml0KG1lbW9yeSwgc2l6ZSk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBvcGVyYXRvcigpKGNvbnN0IHZvaWQqKSB7CisgICAgICAgICAgICAgICAgaWYgKG9iamVjdCkgeworICAgICAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG9iamVjdCwgc2l6ZSk7CisgICAgICAgICAgICAgICAgICAgIG9iamVjdCA9IDA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgc3RkOjpzaXplX3Qgc2l6ZTsKKyAgICAgICAgICAgIFQqIG9iamVjdDsKKyAgICAgICAgfTsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgc3RkOjpzaXplX3QgTj4KKyAgICAgICAgY2xhc3MgYXJyYXlfZGVsZXRlcjxUW05dPiB7CisgICAgICAgIHB1YmxpYzoKKyAgICAgICAgICAgIGFycmF5X2RlbGV0ZXIoKQorICAgICAgICAgICAgICAgIDogb2JqZWN0KDApIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH5hcnJheV9kZWxldGVyKCkgeworICAgICAgICAgICAgICAgIGlmIChvYmplY3QpIHsKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShvYmplY3QsIE4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgaW5pdChUKiBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0KG1lbW9yeSwgTik7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1JWQUxVRV9SRUZFUkVOQ0VTKQorICAgICAgICAgICAgdm9pZCBpbml0KFQqIG1lbW9yeSwgVCYmIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF92YWx1ZShtZW1vcnksIE4sIHNwX2ZvcndhcmQ8VD4odmFsdWUpKTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7ICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1ZBUklBRElDX1RFTVBMQVRFUykKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lLi4uIEFyZ3M+CisgICAgICAgICAgICB2b2lkIGluaXQoVCogbWVtb3J5LCBBcmdzJiYuLi4gYXJncykgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfYXJncyhtZW1vcnksIE4sIHNwX2ZvcndhcmQ8QXJncz4oYXJncykuLi4pOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyNlbmRpZgorI2VuZGlmCisgICAgICAgICAgICB2b2lkIGluaXRfbGlzdChUKiBtZW1vcnksIGNvbnN0IFQqIGxpc3QpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0X2xpc3QobWVtb3J5LCBOLCBsaXN0KTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTxzdGQ6OnNpemVfdCBNPgorICAgICAgICAgICAgdm9pZCBpbml0X2xpc3QoVCogbWVtb3J5LCBjb25zdCBUKiBsaXN0KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF9saXN0PFQsIE0+KG1lbW9yeSwgTiwgbGlzdCk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBub2luaXQoVCogbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfbm9pbml0KG1lbW9yeSwgTik7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBvcGVyYXRvcigpKGNvbnN0IHZvaWQqKSB7CisgICAgICAgICAgICAgICAgaWYgKG9iamVjdCkgeworICAgICAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG9iamVjdCwgTik7CisgICAgICAgICAgICAgICAgICAgIG9iamVjdCA9IDA7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgVCogb2JqZWN0OworICAgICAgICB9OworICAgIH0KK30KKworI2VuZGlmCmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2FycmF5X3RyYWl0cy5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2FycmF5X3RyYWl0cy5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNzBkMjM5MQotLS0gL2Rldi9udWxsCisrKyBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXJyYXlfdHJhaXRzLmhwcApAQCAtMCwwICsxLDUzIEBACisvKgorICogQ29weXJpZ2h0IChjKSAyMDEyIEdsZW4gSm9zZXBoIEZlcm5hbmRlcyAKKyAqIGdsZW5mZSBhdCBsaXZlIGR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ICBtZW1vcnlbLS1pXS5+VCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2Rlc3Ryb3koVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplKSB7CisgICAgICAgICAgICBuZG5ib29zdDo6aGFzX3RyaXZpYWxfZGVzdHJ1Y3RvcjxUPiB0eXBlOworICAgICAgICAgICAgYXJyYXlfZGVzdHJveShtZW1vcnksIHNpemUsIHR5cGUpOworICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2luaXQoVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplLCBuZG5ib29zdDo6dHJ1ZV90eXBlKSB7CisgICAgICAgICAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgbWVtb3J5W2ldID0gVCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2luaXQoVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplLCBuZG5ib29zdDo6ZmFsc2VfdHlwZSkgeworI2lmICFkZWZpbmVkKEJPT1NUX05PX0VYQ0VQVElPTlMpCisgICAgICAgICAgICBzdGQ6OnNpemVfdCBpID0gMDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZm9yICg7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKC4uLikgeworICAgICAgICAgICAgICAgIGFycmF5X2Rlc3Ryb3kobWVtb3J5LCBpKTsKKyAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgIH0KKyNlbHNlCisgICAgICAgICAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKCk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9pbml0KFQqIG1lbW9yeSwgc3RkOjpzaXplX3Qgc2l6ZSkgeworICAgICAgICAgICAgbmRuYm9vc3Q6Omhhc190cml2aWFsX2RlZmF1bHRfY29uc3RydWN0b3I8VD4gdHlwZTsgICAgICAgICAgICAKKyAgICAgICAgICAgIGFycmF5X2luaXQobWVtb3J5LCBzaXplLCB0eXBlKTsKKyAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1JWQUxVRV9SRUZFUkVOQ0VTKQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9pbml0X3ZhbHVlKFQqIG1lbW9yeSwgc3RkOjpzaXplX3Qgc2l6ZSwgVCYmIHZhbHVlKSB7CisjaWYgIWRlZmluZWQoQk9PU1RfTk9fRVhDRVBUSU9OUykKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGkgPSAwOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBmb3IgKDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKHZhbHVlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG1lbW9yeSwgaSk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVCh2YWx1ZSk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorI2lmICFkZWZpbmVkKEJPT1NUX05PX0NYWDExX1ZBUklBRElDX1RFTVBMQVRFUykKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgdHlwZW5hbWUuLi4gQXJncz4KKyAgICAgICAgaW5saW5lIHZvaWQgYXJyYXlfaW5pdF9hcmdzKFQqIG1lbW9yeSwgc3RkOjpzaXplX3Qgc2l6ZSwgQXJncyYmLi4uIGFyZ3MpIHsKKyNpZiAhZGVmaW5lZChCT09TVF9OT19FWENFUFRJT05TKQorICAgICAgICAgICAgc3RkOjpzaXplX3QgaSA9IDA7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZvciAoOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQoYXJncy4uLik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoLi4uKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShtZW1vcnksIGkpOworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgICAgIGZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQoYXJncy4uLik7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorI2VuZGlmCisjZW5kaWYKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgaW5saW5lIHZvaWQgYXJyYXlfaW5pdF9saXN0KFQqIG1lbW9yeSwgc3RkOjpzaXplX3Qgc2l6ZSwgY29uc3QgVCogbGlzdCkgeworI2lmICFkZWZpbmVkKEJPT1NUX05PX0VYQ0VQVElPTlMpCisgICAgICAgICAgICBzdGQ6OnNpemVfdCBpID0gMDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZm9yICg7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVChsaXN0W2ldKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG1lbW9yeSwgaSk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVChsaXN0W2ldKTsKKyAgICAgICAgICAgIH0KKyNlbmRpZgorICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHN0ZDo6c2l6ZV90IE4+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2luaXRfbGlzdChUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUsIGNvbnN0IFQqIGxpc3QpIHsKKyNpZiAhZGVmaW5lZChCT09TVF9OT19FWENFUFRJT05TKQorICAgICAgICAgICAgc3RkOjpzaXplX3QgaSA9IDA7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZvciAoOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQobGlzdFtpICUgTl0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKC4uLikgeworICAgICAgICAgICAgICAgIGFycmF5X2Rlc3Ryb3kobWVtb3J5LCBpKTsKKyAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgIH0KKyNlbHNlCisgICAgICAgICAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKGxpc3RbaSAlIE5dKTsKKyAgICAgICAgICAgIH0KKyNlbmRpZgorICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X25vaW5pdChUKiwgc3RkOjpzaXplX3QsIG5kbmJvb3N0Ojp0cnVlX3R5cGUpIHsKKyAgICAgICAgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9ub2luaXQoVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplLCBuZG5ib29zdDo6ZmFsc2VfdHlwZSkgeworI2lmICFkZWZpbmVkKEJPT1NUX05PX0VYQ0VQVElPTlMpCisgICAgICAgICAgICBzdGQ6OnNpemVfdCBpID0gMDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZm9yICg7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG1lbW9yeSwgaSk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVDsKKyAgICAgICAgICAgIH0KKyNlbmRpZgorICAgICAgICB9CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X25vaW5pdChUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUpIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpoYXNfdHJpdmlhbF9kZWZhdWx0X2NvbnN0cnVjdG9yPFQ+IHR5cGU7CisgICAgICAgICAgICBhcnJheV9ub2luaXQobWVtb3J5LCBzaXplLCB0eXBlKTsKKyAgICAgICAgfQorICAgIH0KK30KKworI2VuZGlmCmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2F0b21pY19jb3VudC5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2F0b21pY19jb3VudC5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMDFiNjYxYgotLS0gL2Rldi9udWxsCisrKyBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXRvbWljX2NvdW50LmhwcApAQCAtMCwwICsxLDExOSBAQAorI2lmbmRlZiBCT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y8vCisvLyAgQ29weXJpZ2h0IDIwMDcgUGV0ZXIgRGltb3YKKy8vCisvLyAgRGlzdHJpYnV0ZWQgdW5kZXIgdGhlIEJvb3N0IFNvZnR3YXJlIExpY2Vuc2UsIFZlcnNpb24gMS4wLiAoU2VlCisvLyAgYWNjb21wYW55aW5nIGZpbGUgTElDRU5TRV8xXzAudHh0IG9yIGNvcHkgYXQKKy8vICBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitjbGFzcyBhdG9taWNfY291bnQKK3sKK3B1YmxpYzoKKworICAgIGV4cGxpY2l0IGF0b21pY19jb3VudCggbG9uZyB2ICkgOiB2YWx1ZV8oIHN0YXRpY19jYXN0PCBpbnQgPiggdiApICkge30KKworICAgIGxvbmcgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2V4Y2hhbmdlX2FuZF9hZGQoICZ2YWx1ZV8sICsxICkgKyAxOworICAgIH0KKworICAgIGxvbmcgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2V4Y2hhbmdlX2FuZF9hZGQoICZ2YWx1ZV8sIC0xICkgLSAxOworICAgIH0KKworICAgIG9wZXJhdG9yIGxvbmcoKSBjb25zdAorICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19leGNoYW5nZV9hbmRfYWRkKCAmdmFsdWVfLCAwICk7CisgICAgfQorCitwcml2YXRlOgorCisgICAgYXRvbWljX2NvdW50KGF0b21pY19jb3VudCBjb25zdCAmKTsKKyAgICBhdG9taWNfY291bnQgJiBvcGVyYXRvcj0oYXRvbWljX2NvdW50IGNvbnN0ICYpOworCisgICAgbXV0YWJsZSBpbnQgdmFsdWVfOworCitwcml2YXRlOgorCisgICAgc3RhdGljIGludCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggaW50ICogcHcsIGludCBkdiApCisgICAgeworICAgICAgICAvLyBpbnQgciA9ICpwdzsKKyAgICAgICAgLy8gKnB3ICs9IGR2OworICAgICAgICAvLyByZXR1cm4gcjsKKworICAgICAgICBpbnQgcjsKKworICAgICAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXworICAgICAgICAoCisgICAgICAgICAgICAibG9ja1xuXHQiCisgICAgICAgICAgICAieGFkZCAlMSwgJTAiOgorICAgICAgICAgICAgIittIiggKnB3ICksICI9ciIoIHIgKTogLy8gb3V0cHV0cyAoJTAsICUxKQorICAgICAgICAgICAgIjEiKCBkdiApOiAvLyBpbnB1dHMgKCUyID09ICUxKQorICAgICAgICAgICAgIm1lbW9yeSIsICJjYyIgLy8gY2xvYmJlcnMKKyAgICAgICAgKTsKKworICAgICAgICByZXR1cm4gcjsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9BVE9NSUNfQ09VTlRfR0NDX1g4Nl9IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXRvbWljX2NvdW50X3B0aHJlYWRzLmhwcCBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXRvbWljX2NvdW50X3B0aHJlYWRzLmhwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4wOTQ1NTY2Ci0tLSAvZGV2L251bGwKKysrIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9hdG9taWNfY291bnRfcHRocmVhZHMuaHBwCkBAIC0wLDAgKzEsOTYgQEAKKyNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9BVE9NSUNfQ09VTlRfUFRIUkVBRFNfSFBQX0lOQ0xVREVECisjZGVmaW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KKyAgICAgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jaygmbV8pOworICAgICAgICB9CisKKyAgICAgICAgfnNjb3BlZF9sb2NrKCkKKyAgICAgICAgeworICAgICAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soJm1fKTsKKyAgICAgICAgfQorCisgICAgcHJpdmF0ZToKKworICAgICAgICBwdGhyZWFkX211dGV4X3QgJiBtXzsKKyAgICB9OworCitwdWJsaWM6CisKKyAgICBleHBsaWNpdCBhdG9taWNfY291bnQobG9uZyB2KTogdmFsdWVfKHYpCisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2luaXQoJm11dGV4XywgMCk7CisgICAgfQorCisgICAgfmF0b21pY19jb3VudCgpCisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2Rlc3Ryb3koJm11dGV4Xyk7CisgICAgfQorCisgICAgbG9uZyBvcGVyYXRvcisrKCkKKyAgICB7CisgICAgICAgIHNjb3BlZF9sb2NrIGxvY2sobXV0ZXhfKTsKKyAgICAgICAgcmV0dXJuICsrdmFsdWVfOworICAgIH0KKworICAgIGxvbmcgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgICBzY29wZWRfbG9jayBsb2NrKG11dGV4Xyk7CisgICAgICAgIHJldHVybiAtLXZhbHVlXzsKKyAgICB9CisKKyAgICBvcGVyYXRvciBsb25nKCkgY29uc3QKKyAgICB7CisgICAgICAgIHNjb3BlZF9sb2NrIGxvY2sobXV0ZXhfKTsKKyAgICAgICAgcmV0dXJuIHZhbHVlXzsKKyAgICB9CisKK3ByaXZhdGU6CisKKyAgICBhdG9taWNfY291bnQoYXRvbWljX2NvdW50IGNvbnN0ICYpOworICAgIGF0b21pY19jb3VudCAmIG9wZXJhdG9yPShhdG9taWNfY291bnQgY29uc3QgJik7CisKKyAgICBtdXRhYmxlIHB0aHJlYWRfbXV0ZXhfdCBtdXRleF87CisgICAgbG9uZyB2YWx1ZV87Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRh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3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworCisjaWYgZGVmaW5lZCggX19pYTY0X18gKSAmJiBkZWZpbmVkKCBfX0lOVEVMX0NPTVBJTEVSICkKKyMgaW5jbHVkZSA8aWE2NGludHJpbi5oPgorI2VuZGlmCisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2NsYXNzIGF0b21pY19jb3VudAoreworcHVibGljOgorCisgICAgZXhwbGljaXQgYXRvbWljX2NvdW50KCBsb25nIHYgKSA6IHZhbHVlXyggdiApIHt9CisKKyAgICBsb25nIG9wZXJhdG9yKysoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIF9fc3luY19hZGRfYW5kX2ZldGNoKCAmdmFsdWVfLCAxICk7CisgICAgfQorCisgICAgbG9uZyBvcGVyYXRvci0tKCkKKyAgICB7CisgICAgICAgIHJldHVybiBfX3N5bmNfYWRkX2FuZF9mZXRjaCggJnZhbHVlXywgLTEgKTsKKyAgICB9CisKKyAgICBvcGVyYXRvciBsb25nKCkgY29uc3QKKyAgICB7CisgICAgICAgIHJldHVybiBfX3N5bmNfZmV0Y2hfYW5kX2FkZCggJnZhbHVlXywgMCApOworICAgIH0KKworcHJpdmF0ZToKKworICAgIGF0b21pY19jb3VudChhdG9taWNfY291bnQgY29uc3QgJik7CisgICAgYXRvbWljX2NvdW50ICYgb3BlcmF0b3I9KGF0b21pY19jb3VudCBjb25zdCAmKTsKKworICAgIG11dGFibGUgbG9uZyB2YWx1ZV87Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9BVE9NSUNfQ09VTlRfU1lOQ19IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXRvbWljX2NvdW50X3dp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PHB0aHJlYWQuaD4KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworY2xhc3MgbGlnaHR3ZWlnaHRfbXV0ZXgKK3sKK3ByaXZhdGU6CisKKyAgICBwdGhyZWFkX211dGV4X3QgbV87CisKKyAgICBsaWdodHdlaWdodF9tdXRleChsaWdodHdlaWdodF9tdXRleCBjb25zdCAmKTsKKyAgICBsaWdodHdlaWdodF9tdXRleCAmIG9wZXJhdG9yPShsaWdodHdlaWdodF9tdXRleCBjb25zdCAmKTsKKworcHVibGljOgorCisgICAgbGlnaHR3ZWlnaHRfbXV0ZXgoKQorICAgIHsKKworLy8gSFBVWCAxMC4yMCAvIERDRSBoYXMgYSBub25zdGFuZGFyZCBwdGhyZWFkX211dGV4X2luaXQKKworI2lmIGRlZmluZWQoX19ocHV4KSAmJiBkZWZpbmVkKF9ERUNUSFJFQURTXykKKyAgICAgICAgQk9PU1RfVkVSSUZZKCBwdGhyZWFkX211dGV4X2luaXQoICZtXywgcHRocmVhZF9tdXRleGF0dHJfZGVmYXVsdCApID09IDAgKTsKKyNlbHNlCisgICAgICAgIEJPT1NUX1ZFUklGWSggcHRocmVhZF9tdXRleF9pbml0KCAmbV8sIDAgKSA9PSAwICk7CisjZW5kaWYKKyAgICB9CisKKyAgICB+bGlnaHR3ZWlnaHRfbXV0ZXgoKQorICAgIHsKKyAgICAgICAgQk9PU1RfVkVSSUZZKCBwdGhyZWFkX211dGV4X2Rlc3Ryb3koICZtXyApID09IDAgKTsKKyAgICB9CisKKyAgICBjbGFzcyBzY29wZWRfbG9jazsKKyAgICBmcmllbmQgY2xhc3Mgc2NvcGVkX2xvY2s7CisKKyAgICBjbGFzcyBzY29wZWRfbG9jaworICAgIHsKKyAgICBwcml2YXRlOgorCisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdCAmIG1fOworCisgICAgICAgIHNjb3BlZF9sb2NrKHNjb3BlZF9sb2NrIGNvbnN0ICYpOwor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b3QgY29tCisgKgorICogRGlzdHJpYnV0ZWQgdW5kZXIgdGhlIEJvb3N0IFNvZnR3YXJlIExpY2Vuc2UsIAorICogVmVyc2lvbiAxLjAuIChTZWUgYWNjb21wYW55aW5nIGZpbGUgTElDRU5TRV8xXzAudHh0IAorICogb3IgY29weSBhdCBodHRwOi8vYm9vc3Qub3JnL0xJQ0VOU0VfMV8wLnR4dCkKKyAqLworI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX01BS0VfQVJSQVlfSEVMUEVSX0hQUAorI2RlZmluZSBCT09TVF9TTUFSVF9QVFJfREVUQUlMX01BS0VfQVJSQVlfSEVMUEVSX0hQUAorCisjaW5jbHVkZSA8bmRuYm9vc3QvdHlwZV90cmFpdHMvYWxpZ25tZW50X29mLmhwcD4KKworbmFtZXNwYWNlIG5kbmJvb3N0IHsKKyAgICBuYW1lc3BhY2UgZGV0YWlsIHsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgdHlwZW5hbWUgWSA9IGNoYXI+CisgICAgICAgIGNsYXNzIG1ha2VfYXJyYXlfaGVscGVyOworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBULCB0eXBlbmFtZSBZPgorICAgICAgICBjbGFzcyBtYWtlX2FycmF5X2hlbHBlcjxUW10sIFk+IHsKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQyLCB0eXBlbmFtZSBZMj4KKyAgICAgICAgICAgIGZyaWVuZCBjbGFzcyBtYWtlX2FycmF5X2hlbHBlcjsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgdHlwZWRlZiBZICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgICAgICAgdHlwZWRlZiBZKiAgICAgICAgICBwb2ludGVyOworICAgICAgICAgICAgdHlwZWRlZiBjb25zdCBZKiAgICBjb25zdF9wb2ludGVyOworICAgICAgICAgICAgdHlwZWRlZiBZJiAgICAgICAgICByZWZlcmVuY2U7CisgICAgICAgICAgICB0eXBlZGVmIGNvbnN0IFkmICAgIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgICAgICAgIHR5cGVkZWYgc3RkOjpzaXplX3Qgc2l6ZV90eXBlOworICAgICAgICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgc3RydWN0IHJlYmluZCB7CisgICAgICAgICAgICAgICAgdHlwZWRlZiBtYWtlX2FycmF5X2hlbHBlcjxUW10sIFU+IG90aGVyOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIG1ha2VfYXJyYXlfaGVscGVyKHN0ZDo6c2l6ZV90IHNpemUsIFQqKiBkYXRhKQorICAgICAgICAgICAgICAgIDogc2l6ZShzaXplb2YoVCkgKiBzaXplKSwKKyAgICAgICAgICAgICAgICAgIGRhdGEoZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8Y2xhc3MgVT4KKyAgICAgICAgICAgIG1ha2VfYXJyYXlfaGVscGVyKGNvbnN0IG1ha2VfYXJyYXlfaGVscGVyPFRbXSwgVT4mIG90aGVyKSAKKyAgICAgICAgICAgICAgICA6IHNpemUob3RoZXIuc2l6ZSksCisgICAgICAgICAgICAgICAgICBkYXRhKG90aGVyLmRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBvaW50ZXIgYWRkcmVzcyhyZWZlcmVuY2UgdmFsdWUpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gJnZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3RfcG9pbnRlciBhZGRyZXNzKGNvbnN0X3JlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiAmdmFsdWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzaXplX3R5cGUgbWF4X3NpemUoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PHN0ZDo6c2l6ZV90PigtMSkgLyBzaXplb2YoWSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFsbG9jYXRlKHNpemVfdHlwZSBjb3VudCwgY29uc3Qgdm9pZCogPSAwKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIHZvaWQqICBwMSA9IDo6b3BlcmF0b3IgbmV3KG4xICsgc2l6ZSk7CisgICAgICAgICAgICAgICAgY2hhciogIHAyID0gc3RhdGljX2Nhc3Q8Y2hhcio+KHAxKSArIG4xOworICAgICAgICAgICAgICAgIHdoaWxlIChzdGQ6OnNpemVfdChwMikgJSBhMSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHAyLS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICpkYXRhID0gcmVpbnRlcnByZXRfY2FzdDxUKj4ocDIpOworICAgICAgICAgICAgICAgIHJldHVybiAgcmVpbnRlcnByZXRfY2FzdDxZKj4ocDEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBkZWFsbG9jYXRlKHBvaW50ZXIgbWVtb3J5LCBzaXplX3R5cGUpIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeTsKKyAgICAgICAgICAgICAgICA6Om9wZXJhdG9yIGRlbGV0ZShwMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGNvbnN0cnVjdChwb2ludGVyIG1lbW9yeSwgY29uc3QgWSYgdmFsdWUpIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgWSh2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlc3Ryb3kocG9pbnRlciBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBtZW1vcnktPn5ZKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgYm9vbCBvcGVyYXRvcj09KGNvbnN0IG1ha2VfYXJyYXlfaGVscGVyPFRbXSwgVT4mIG90aGVyKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgYm9vbCBvcGVyYXRvciE9KGNvbnN0IG1ha2VfYXJyYXlfaGVscGVyPFRbXSwgVT4mIG90aGVyKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuICEoKnRoaXMgPT0gb3RoZXIpOyAKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHNpemU7CisgICAgICAgICAgICBUKiogZGF0YTsKKyAgICAgICAgfTsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgc3RkOjpzaXplX3QgTiwgdHlwZW5hbWUgWT4KKyAgICAgICAgY2xhc3MgbWFrZV9hcnJheV9oZWxwZXI8VFtOXSwgWT4geworICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVDIsIHR5cGVuYW1lIFkyPgorICAgICAgICAgICAgZnJpZW5kIGNsYXNzIG1ha2VfYXJyYXlfaGVscGVyOworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICB0eXBlZGVmIFkgICAgICAgICAgIHZhbHVlX3R5cGU7CisgICAgICAgICAgICB0eXBlZGVmIFkqICAgICAgICAgIHBvaW50ZXI7CisgICAgICAgICAgICB0eXBlZGVmIGNvbnN0IFkqICAgIGNvbnN0X3BvaW50ZXI7CisgICAgICAgICAgICB0eXBlZGVmIFkmICAgICAgICAgIHJlZmVyZW5jZTsKKyAgICAgICAgICAgIHR5cGVkZWYgY29uc3QgWSYgICAgY29uc3RfcmVmZXJlbmNlOworICAgICAgICAgICAgdHlwZWRlZiBzdGQ6OnNpemVfdCBzaXplX3R5cGU7CisgICAgICAgICAgICB0eXBlZGVmIHB0cmRpZmZfdCAgIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFU+CisgICAgICAgICAgICBzdHJ1Y3QgcmViaW5kIHsKKyAgICAgICAgICAgICAgICB0eXBlZGVmIG1ha2VfYXJyYXlfaGVscGVyPFRbTl0sIFU+IG90aGVyOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIG1ha2VfYXJyYXlfaGVscGVyKFQqKiBkYXRhKQorICAgICAgICAgICAgICAgIDogZGF0YShkYXRhKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTxjbGFzcyBVPgorICAgICAgICAgICAgbWFrZV9hcnJheV9oZWxwZXIoY29uc3QgbWFrZV9hcnJheV9oZWxwZXI8VFtOXSwgVT4mIG90aGVyKSAKKyAgICAgICAgICAgICAgICA6IGRhdGEob3RoZXIuZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9pbnRlciBhZGRyZXNzKHJlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiAmdmFsdWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb25zdF9wb2ludGVyIGFkZHJlc3MoY29uc3RfcmVmZXJlbmNlIHZhbHVlKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuICZ2YWx1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNpemVfdHlwZSBtYXhfc2l6ZSgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8c3RkOjpzaXplX3Q+KC0xKSAvIHNpemVvZihZKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBvaW50ZXIgYWxsb2NhdGUoc2l6ZV90eXBlIGNvdW50LCBjb25zdCB2b2lkKiA9IDApIHsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBhMSA9IG5kbmJvb3N0OjphbGlnbm1lbnRfb2Y8VD46OnZhbHVlOworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IG4xID0gY291bnQgKiBzaXplb2YoWSkgKyBhMSAtIDE7CisgICAgICAgICAgICAgICAgdm9pZCogIHAxID0gOjpvcGVyYXRvciBuZXcobjEgKyBOMSk7CisgICAgICAgICAgICAgICAgY2hhciogIHAyID0gc3RhdGljX2Nhc3Q8Y2hhcio+KHAxKSArIG4xOworICAgICAgICAgICAgICAgIHdoaWxlIChzdGQ6OnNpemVfdChwMikgJSBhMSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHAyLS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICpkYXRhID0gcmVpbnRlcnByZXRfY2FzdDxUKj4ocDIpOworICAgICAgICAgICAgICAgIHJldHVybiAgcmVpbnRlcnByZXRfY2FzdDxZKj4ocDEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBkZWFsbG9jYXRlKHBvaW50ZXIgbWVtb3J5LCBzaXplX3R5cGUpIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeTsKKyAgICAgICAgICAgICAgICA6Om9wZXJhdG9yIGRlbGV0ZShwMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGNvbnN0cnVjdChwb2ludGVyIG1lbW9yeSwgY29uc3QgWSYgdmFsdWUpIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgWSh2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlc3Ryb3kocG9pbnRlciBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBtZW1vcnktPn5ZKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgYm9vbCBvcGVyYXRvcj09KGNvbnN0IG1ha2VfYXJyYXlfaGVscGVyPFRbTl0sIFU+JiBvdGhlcikgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3IhPShjb25zdCBtYWtlX2FycmF5X2hlbHBlcjxUW05dLCBVPiYgb3RoZXIpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gISgqdGhpcyA9PSBvdGhlcik7IAorICAgICAgICAgICAgfQorICAgICAgICBwcml2YXRlOgorICAgICAgICAgICAgZW51bSB7CisgICAgICAgICAgICAgICAgTjEgPSBOICogc2l6ZW9mKFQpCisgICAgICAgICAgICB9OworICAgICAgICAgICAgVCoqIGRhdGE7CisgICAgICAgIH07CisgICAgfQorfQorCisjZW5kaWYKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvb3BlcmF0b3JfYm9vbC5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL29wZXJhdG9yX2Jvb2wuaHBwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjhhZTE1MjcKLS0tIC9kZXYvbnVsbAorKysgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL29wZXJhdG9yX2Jvb2wuaHBwCkBAIC0wLDAgKzEsNjMgQEAKKy8vICBUaGlzIGhlYWRlciBpbnRlbnRpb25hbGx5IGhhcyBubyBpbmNsdWRlIGd1YXJkcy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ID09IDA/IDA6IHVuc3BlY2lmaWVkX2Jvb2w7CisgICAgfQorCisjZWxpZiBcCisgICAgKCBkZWZpbmVkKF9fTVdFUktTX18pICYmIEJPT1NUX1dPUktBUk9VTkQoX19NV0VSS1NfXywgPCAweDMyMDApICkgfHwgXAorICAgICggZGVmaW5lZChfX0dOVUNfXykgJiYgKF9fR05VQ19fICogMTAwICsgX19HTlVDX01JTk9SX18gPCAzMDQpICkgfHwgXAorICAgICggZGVmaW5lZChfX1NVTlBST19DQykgJiYgQk9PU1RfV09SS0FST1VORChfX1NVTlBST19DQywgPD0gMHg1OTApICkKKworICAgIHR5cGVkZWYgZWxlbWVudF90eXBlICogKHRoaXNfdHlwZTo6KnVuc3BlY2lmaWVkX2Jvb2xfdHlwZSkoKSBjb25zdDsKKworICAgIG9wZXJhdG9yIHVuc3BlY2lmaWVkX2Jvb2xfdHlwZSgpIGNvbnN0IEJPT1NUX05PRVhDRVBUCisgICAgeworICAgICAgICByZXR1cm4gcHggPT0gMD8gMDogJnRoaXNfdHlwZTo6Z2V0OworICAgIH0KKworI2Vsc2UKKworICAgIHR5cGVkZWYgZWxlbWVudF90eXBlICogdGhpc190eXBlOjoqdW5zcGVjaWZpZWRfYm9vbF90eXBlOworCisgICAgb3BlcmF0b3IgdW5zcGVjaWZpZWRfYm9vbF90eXBlKCkgY29uc3QgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHJldHVybiBweCA9PSAwPyAwOiAmdGhpc190eXBlOjpweDsKKyAgICB9CisKKyNlbmRpZgorCisgICAgLy8gb3BlcmF0b3IhIGlzIHJlZHVuZGFudCwgYnV0IHNvbWUgY29tcGlsZXJzIG5lZWQgaXQKKyAgICBib29sIG9wZXJhdG9yISAoKSBjb25zdCBCT09TVF9OT0VYQ0VQVAorICAgIHsKKyAgICAgICAgcmV0dXJuIHB4ID09IDA7CisgICAgfQpkaWZmIC0tZ2l0IGEvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9xdWlja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naHRfbXV0ZXggKiBwbSA9IG5ldyggJmZibSApIGxpZ2h0d2VpZ2h0X211dGV4OworICAgICAgICByZXR1cm4gKnBtOworICAgIH0KKworICAgIHN0YXRpYyBsaWdodHdlaWdodF9tdXRleCAqIG11dGV4X2luaXQ7CisKKyNlbmRpZgorCisgICAgc3RhdGljIGJsb2NrICogZnJlZTsKKyAgICBzdGF0aWMgYmxvY2sgKiBwYWdlOworICAgIHN0YXRpYyB1bnNpZ25lZCBsYXN0OworCisgICAgc3RhdGljIGlubGluZSB2b2lkICogYWxsb2MoKQorICAgIHsKKyNpZmRlZiBCT09TVF9IQVNfVEhSRUFEUworICAgICAgICBsaWdodHdlaWdodF9tdXRleDo6c2NvcGVkX2xvY2sgbG9jayggbXV0ZXgoKSApOworI2VuZGlmCisgICAgICAgIGlmKGJsb2NrICogeCA9IGZyZWUpCisgICAgICAgIHsKKyAgICAgICAgICAgIGZyZWUgPSB4LT5uZXh0OworICAgICAgICAgICAgcmV0dXJuIHg7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBpZihsYXN0ID09IGl0ZW1zX3Blcl9wYWdlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIC8vICJMaXN0ZW4gdG8gbWUgY2FyZWZ1bGx5OiB0aGVyZSBpcyBubyBtZW1vcnkgbGVhayIKKyAgICAgICAgICAgICAgICAvLyAtLSBTY290dCBNZXllcnMsIEVmZiBDKysgMm5kIEVkIEl0ZW0gMTAKKyAgICAgICAgICAgICAgICBwYWdlID0gOjpuZXcgYmxvY2tbaXRlbXNfcGVyX3BhZ2VdOworICAgICAgICAgICAgICAgIGxhc3QgPSAwOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gJnBhZ2VbbGFzdCsrXTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHN0YXRpYyBpbmxpbmUgdm9pZCAqIGFsbG9jKHN0ZDo6c2l6ZV90IG4pCisgICAgeworICAgICAgICBpZihuICE9IHNpemUpIC8vIGNsYXNzLXNwZWNpZmljIG5ldyBjYWxsZWQgZm9yIGEgZGVyaXZlZCBvYmplY3QKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIDo6b3BlcmF0b3IgbmV3KG4pOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworI2lmZGVmIEJPT1NUX0hBU19USFJFQURTCisgICAgICAgICAgICBsaWdodHdlaWdodF9tdXRleDo6c2NvcGVkX2xvY2sgbG9jayggbXV0ZXgoKSApOworI2VuZGlmCisgICAgICAgICAgICBpZihibG9jayAqIHggPSBmcmVlKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGZyZWUgPSB4LT5uZXh0OworICAgICAgICAgICAgICAgIHJldHVybiB4OworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGlmKGxhc3QgPT0gaXRlbXNfcGVyX3BhZ2UpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBwYWdlID0gOjpuZXcgYmxvY2tbaXRlbXNfcGVyX3BhZ2VdOworICAgICAgICAgICAgICAgICAgICBsYXN0ID0gMDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXR1cm4gJnBhZ2VbbGFzdCsrXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHN0YXRpYyBpbmxpbmUgdm9pZCBkZWFsbG9jKHZvaWQgKiBwdikKKyAgICB7CisgICAgICAgIGlmKHB2ICE9IDApIC8vIDE4LjQuMS4xLzEzCisgICAgICAgIHsKKyNpZmRlZiBCT09TVF9IQVNfVEhSRUFEUworICAgICAgICAgICAgbGlnaHR3ZWlnaHRfbXV0ZXg6OnNjb3BlZF9sb2NrIGxvY2soIG11dGV4KCkgKTsKKyNlbmRpZgorICAgICAgICAgICAgYmxvY2sgKiBwYiA9IHN0YXRpY19jYXN0PGJsb2NrICo+KHB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Bub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICB9CisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBZPiBleHBsaWNpdCBzaGFyZWRfY291bnQoIFkgKiBwICk6IHBpXyggMCApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICBwaV8gPSBuZXcgc3BfY291bnRlZF9pbXBsX3A8WT4oIHAgKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCguLi4pCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpjaGVja2VkX2RlbGV0ZSggcCApOworICAgICAgICAgICAgdGhyb3c7CisgICAgICAgIH0KKworI2Vsc2UKKworICAgICAgICBwaV8gPSBuZXcgc3BfY291bnRlZF9pbXBsX3A8WT4oIHAgKTsKKworICAgICAgICBpZiggcGlfID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6Y2hlY2tlZF9kZWxldGUoIHAgKTsKKyAgICAgICAgICAgIG5kbmJvb3N0Ojp0aHJvd19leGNlcHRpb24oIHN0ZDo6YmFkX2FsbG9jKCkgKTsKKyAgICAgICAgfQorCisjZW5kaWYKKyAgICB9CisKKyNpZiBkZWZpbmVkKCBCT09TVF9NU1ZDICkgJiYgQk9PU1RfV09SS0FST1VORCggQk9PU1RfTVNWQywgPD0gMTIwMCApCisgICAgdGVtcGxhdGU8Y2xhc3MgWSwgY2xhc3MgRD4gc2hhcmVkX2NvdW50KCBZICogcCwgRCBkICk6IHBpXygwKQorI2Vsc2UKKyAgICB0ZW1wbGF0ZTxjbGFzcyBQLCBjbGFzcyBEPiBzaGFyZWRfY291bnQoIFAgcCwgRCBkICk6IHBpXygwKQorI2VuZGlmCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyNpZiBkZWZpbmVkKCBCT09TVF9NU1ZDICkgJiYgQk9PU1RfV09SS0FST1VORCggQk9PU1RfTVNWQywgPD0gMTIwMCApCisgICAgICAgIHR5cGVkZWYgWSogUDsKKyNlbmRpZgorI2lmbmRlZiBCT09TVF9OT19FWENFUFRJT05TCisKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHBpXyA9IG5ldyBzcF9jb3VudGVkX2ltcGxfcGQ8UCwgRD4ocCwgZCk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2goLi4uKQorICAgICAgICB7CisgICAgICAgICAgICBkKHApOyAvLyBkZWxldGUgcAorICAgICAgICAgICAgdGhyb3c7CisgICAgICAgIH0KKworI2Vsc2UKKworICAgICAgICBwaV8gPSBuZXcgc3BfY291bnRlZF9pbXBsX3BkPFAsIEQ+KHAsIGQpOworCisgICAgICAgIGlmKHBpXyA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBkKHApOyAvLyBkZWxldGUgcAorICAgICAgICAgICAgbmRuYm9vc3Q6OnRocm93X2V4Y2VwdGlvbihzdGQ6OmJhZF9hbGxvYygpKTsKKyAgICAgICAgfQorCisjZW5kaWYKKyAgICB9CisKKyNpZiAhZGVmaW5lZCggQk9PU1RfTk9fRlVOQ1RJT05fVEVNUExBVEVfT1JERVJJTkcgKQorCisgICAgdGVtcGxhdGU8IGNsYXNzIFAsIGNsYXNzIEQgPiBzaGFyZWRfY291bnQoIFAgcCwgc3BfaW5wbGFjZV90YWc8RD4gKTogcGlfKCAwICkKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8oc2hhcmVkX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworI2lmbmRlZiBCT09TVF9OT19FWENFUFRJT05TCisKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHBpXyA9IG5ldyBzcF9jb3VudGVkX2ltcGxfcGQ8IFAsIEQgPiggcCApOworICAgICAgICB9CisgICAgICAgIGNhdGNoKCAuLi4gKQorICAgICAgICB7CisgICAgICAgICAgICBEKCkoIHAgKTsgLy8gZGVsZXRlIHAKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcGlfID0gbmV3IHNwX2NvdW50ZWRfaW1wbF9wZDwgUCwgRCA+KCBwICk7CisKKyAgICAgICAgaWYoIHBpXyA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgRCgpKCBwICk7IC8vIGRlbGV0ZSBwCisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKCBzdGQ6OmJhZF9hbGxvYygpICk7CisgICAgICAgIH0KKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworICAgIH0KKworI2VuZGlmIC8vICFkZWZpbmVkKCBCT09TVF9OT19GVU5DVElPTl9URU1QTEFURV9PUkRFUklORyApCisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBQLCBjbGFzcyBELCBjbGFzcyBBPiBzaGFyZWRfY291bnQoIFAgcCwgRCBkLCBBIGEgKTogcGlfKCAwICkKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8oc2hhcmVkX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICB0eXBlZGVmIHNwX2NvdW50ZWRfaW1wbF9wZGE8UCwgRCwgQT4gaW1wbF90eXBlOworICAgICAgICB0eXBlZGVmIHR5cGVuYW1lIEE6OnRlbXBsYXRlIHJlYmluZDwgaW1wbF90eXBlID46Om90aGVyIEEyOworCisgICAgICAgIEEyIGEyKCBhICk7CisKKyNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICBwaV8gPSBhMi5hbGxvY2F0ZSggMSwgc3RhdGljX2Nhc3Q8IGltcGxfdHlwZSogPiggMCApICk7CisgICAgICAgICAgICBuZXcoIHN0YXRpY19jYXN0PCB2b2lkKiA+KCBwaV8gKSApIGltcGxfdHlwZSggcCwgZCwgYSApOworICAgICAgICB9CisgICAgICAgIGNhdGNoKC4uLikKKyAgICAgICAgeworICAgICAgICAgICAgZCggcCApOworCisgICAgICAgICAgICBpZiggcGlfICE9IDAgKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGEyLmRlYWxsb2NhdGUoIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIHBpXyApLCAxICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcGlfID0gYTIuYWxsb2NhdGUoIDEsIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIDAgKSApOworCisgICAgICAgIGlmKCBwaV8gIT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5ldyggc3RhdGljX2Nhc3Q8IHZvaWQqID4oIHBpXyApICkgaW1wbF90eXBlKCBwLCBkLCBhICk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBkKCBwICk7CisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKCBzdGQ6OmJhZF9hbGxvYygpICk7CisgICAgICAgIH0KKworI2VuZGlmCisgICAgfQorCisjaWYgIWRlZmluZWQoIEJPT1NUX05PX0ZVTkNUSU9OX1RFTVBMQVRFX09SREVSSU5HICkKKworICAgIHRlbXBsYXRlPCBjbGFzcyBQLCBjbGFzcyBELCBjbGFzcyBBID4gc2hhcmVkX2NvdW50KCBQIHAsIHNwX2lucGxhY2VfdGFnPCBEID4sIEEgYSApOiBwaV8oIDAgKQorI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyhzaGFyZWRfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisgICAgICAgIHR5cGVkZWYgc3BfY291bnRlZF9pbXBsX3BkYTwgUCwgRCwgQSA+IGltcGxfdHlwZTsKKyAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBBOjp0ZW1wbGF0ZSByZWJpbmQ8IGltcGxfdHlwZSA+OjpvdGhlciBBMjsKKworICAgICAgICBBMiBhMiggYSApOworCisjaWZuZGVmIEJPT1NUX05PX0VYQ0VQVElPTlMKKworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgcGlfID0gYTIuYWxsb2NhdGUoIDEsIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIDAgKSApOworICAgICAgICAgICAgbmV3KCBzdGF0aWNfY2FzdDwgdm9pZCogPiggcGlfICkgKSBpbXBsX3R5cGUoIHAsIGEgKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCguLi4pCisgICAgICAgIHsKKyAgICAgICAgICAgIEQoKSggcCApOworCisgICAgICAgICAgICBpZiggcGlfICE9IDAgKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIGEyLmRlYWxsb2NhdGUoIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIHBpXyApLCAxICk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcGlfID0gYTIuYWxsb2NhdGUoIDEsIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIDAgKSApOworCisgICAgICAgIGlmKCBwaV8gIT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5ldyggc3RhdGljX2Nhc3Q8IHZvaWQqID4oIHBpXyApICkgaW1wbF90eXBlKCBwLCBhICk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICBEKCkoIHAgKTsKKyAgICAgICAgICAgIG5kbmJvb3N0Ojp0aHJvd19leGNlcHRpb24oIHN0ZDo6YmFkX2FsbG9jKCkgKTsKKyAgICAgICAgfQorCisjZW5kaWYgLy8gI2lmbmRlZiBCT09TVF9OT19FWENFUFRJT05TCisgICAgfQorCisjZW5kaWYgLy8gIWRlZmluZWQoIEJPT1NUX05PX0ZVTkNUSU9OX1RFTVBMQVRFX09SREVSSU5HICkKKworI2lmbmRlZiBCT09TVF9OT19BVVRPX1BUUgorCisgICAgLy8gYXV0b19wdHI8WT4gaXMgc3BlY2lhbCBjYXNlZCB0byBwcm92aWRlIHRoZSBzdHJvbmcgZ3VhcmFudGVlCisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBZPgorICAgIGV4cGxpY2l0IHNoYXJlZF9jb3VudCggc3RkOjphdXRvX3B0cjxZPiAmIHIgKTogcGlfKCBuZXcgc3BfY291bnRlZF9pbXBsX3A8WT4oIHIuZ2V0KCkgKSApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyNpZmRlZiBCT09TVF9OT19FWENFUFRJT05TCisKKyAgICAgICAgaWYoIHBpXyA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgbmRuYm9vc3Q6OnRocm93X2V4Y2VwdGlvbihzdGQ6OmJhZF9hbGxvYygpKTsKKyAgICAgICAgfQorCisjZW5kaWYKKworICAgICAgICByLnJlbGVhc2UoKTsKKyAgICB9CisKKyNlbmRpZiAKKworI2lmICFkZWZpbmVkKCBCT09TVF9OT19DWFgxMV9TTUFSVF9QVFIgKQorCisgICAgdGVtcGxhdGU8Y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F8oc2hhcmVkX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICBpZiggcGlfICE9IDAgKSBwaV8tPmFkZF9yZWZfY29weSgpOworICAgIH0KKworI2lmICFkZWZpbmVkKCBCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUyApCisKKyAgICBzaGFyZWRfY291bnQoc2hhcmVkX2NvdW50ICYmIHIpOiBwaV8oci5waV8pIC8vIG5vdGhyb3cKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8oc2hhcmVkX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICByLnBpXyA9IDA7CisgICAgfQorCisjZW5kaWYKKworICAgIGV4cGxpY2l0IHNoYXJlZF9jb3VudCh3ZWFrX2NvdW50IGNvbnN0ICYgcik7IC8vIHRocm93cyBiYWRfd2Vha19wdHIgd2hlbiByLnVzZV9jb3VudCgpID09IDAKKyAgICBzaGFyZWRfY291bnQoIHdlYWtfY291bnQgY29uc3QgJiByLCBzcF9ub3Rocm93X3RhZyApOyAvLyBjb25zdHJ1Y3RzIGFuIGVtcHR5ICp0aGlzIHdoZW4gci51c2VfY291bnQoKSA9PSAwCisKKyAgICBzaGFyZWRfY291bnQgJiBvcGVyYXRvcj0gKHNoYXJlZF9jb3VudCBjb25zdCAmIHIpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHNwX2NvdW50ZWRfYmFzZSAqIHRtcCA9IHIucGlfOworCisgICAgICAgIGlmKCB0bXAgIT0gcGlfICkKKyAgICAgICAgeworICAgICAgICAgICAgaWYoIHRtcCAhPSAwICkgdG1wLT5hZGRfcmVmX2NvcHkoKTsKKyAgICAgICAgICAgIGlmKCBwaV8gIT0gMCApIHBpXy0+cmVsZWFzZSgpOworICAgICAgICAgICAgcGlfID0gdG1wOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIHZvaWQgc3dhcChzaGFyZWRfY291bnQgJiByKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcF9jb3VudGVkX2Jhc2UgKiB0bXAgPSByLnBpXzsKKyAgICAgICAgci5waV8gPSBwaV87CisgICAgICAgIHBpXyA9IHRtcDsKKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBwaV8gIT0gMD8gcGlfLT51c2VfY291bnQoKTogMDsKKyAgICB9CisKKyAgICBib29sIHVuaXF1ZSgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiB1c2VfY291bnQoKSA9PSAxOworICAgIH0KKworICAgIGJvb2wgZW1wdHkoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gcGlfID09IDA7CisgICAgfQorCisgICAgZnJpZW5kIGlubGluZSBib29sIG9wZXJhdG9yPT0oc2hhcmVkX2NvdW50IGNvbnN0ICYgYSwgc2hhcmVkX2NvdW50IGNvbnN0ICYgYikKKyAgICB7CisgICAgICAgIHJldHVybiBhLnBpXyA9PSBiLnBpXzsKKyAgICB9CisKKyAgICBmcmllbmQgaW5saW5lIGJvb2wgb3BlcmF0b3I8KHNoYXJlZF9jb3VudCBjb25zdCAmIGEsIHNoYXJlZF9jb3VudCBjb25zdCAmIGIpCisgICAgeworICAgICAgICByZXR1cm4gc3RkOjpsZXNzPHNwX2NvdW50ZWRfYmFzZSAqPigpKCBhLnBpXywgYi5waV8gKTsKKyAgICB9CisKKyAgICB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSBjb25zdAorICAgIHsKKyAgICAgICAgcmV0dXJuIHBpXz8gcGlfLT5nZXRfZGVsZXRlciggdGkgKTogMDsKKyAgICB9CisKKyAgICB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpIGNvbnN0CisgICAgeworICAgICAgICByZXR1cm4gcGlfPyBwaV8tPmdldF91bnR5cGVkX2RlbGV0ZXIoKTogMDsKKyAgICB9Cit9OworCisKK2NsYXNzIHdlYWtfY291bnQKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UgKiBwaV87CisKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICBpbnQgaWRfOworI2VuZGlmCisKKyAgICBmcmllbmQgY2xhc3Mgc2hhcmVkX2NvdW50OworCitwdWJsaWM6CisKKyAgICB3ZWFrX2NvdW50KCk6IHBpXygwKSAvLyBub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHdlYWtfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisgICAgfQorCisgICAgd2Vha19jb3VudChzaGFyZWRfY291bnQgY29uc3QgJiByKTogcGlfKHIucGlfKSAvLyBub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHdlYWtfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisgICAgICAgIGlmKHBpXyAhPSAwKSBwaV8tPndlYWtfYWRkX3JlZigpOworICAgIH0KKworICAgIHdlYWtfY291bnQod2Vha19jb3VudCBjb25zdCAmIHIpOiBwaV8oci5waV8pIC8vIG5vdGhyb3cKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8od2Vha19jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgaWYocGlfICE9IDApIHBpXy0+d2Vha19hZGRfcmVmKCk7CisgICAgfQorCisvLyBNb3ZlIHN1cHBvcnQKKworI2lmICFkZWZpbmVkKCBCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUyApCisKKyAgICB3ZWFrX2NvdW50KHdlYWtfY291bnQgJiYgcik6IHBpXyhyLnBpXykgLy8gbm90aHJvdworI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyh3ZWFrX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICByLnBpXyA9IDA7CisgICAgfQorCisjZW5kaWYKKworICAgIH53ZWFrX2NvdW50KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYocGlfICE9IDApIHBpXy0+d2Vha19yZWxlYXNlKCk7CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgIGlkXyA9IDA7CisjZW5kaWYKKyAgICB9CisKKyAgICB3ZWFrX2NvdW50ICYgb3BlcmF0b3I9IChzaGFyZWRfY291bnQgY29uc3QgJiByKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcF9jb3VudGVkX2Jhc2UgKiB0bXAgPSByLnBpXzsKKworICAgICAgICBpZiggdG1wICE9IHBpXyApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKHRtcCAhPSAwKSB0bXAtPndlYWtfYWRkX3JlZigpOworICAgICAgICAgICAgaWYocGlfICE9IDApIHBpXy0+d2Vha19yZWxlYXNlKCk7CisgICAgICAgICAgICBwaV8gPSB0bXA7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgd2Vha19jb3VudCAmIG9wZXJhdG9yPSAod2Vha19jb3VudCBjb25zdCAmIHIpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHNwX2NvdW50ZWRfYmFzZSAqIHRtcCA9IHIucGlfOworCisgICAgICAgIGlmKCB0bXAgIT0gcGlfICkKKyAgICAgICAgeworICAgICAgICAgICAgaWYodG1wICE9IDApIHRtcC0+d2Vha19hZGRfcmVmKCk7CisgICAgICAgICAgICBpZihwaV8gIT0gMCkgcGlfLT53ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgICAgIHBpXyA9IHRtcDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICB2b2lkIHN3YXAod2Vha19jb3VudCAmIHIpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHNwX2NvdW50ZWRfYmFzZSAqIHRtcCA9IHIucGlfOworICAgICAgICByLnBpXyA9IHBpXzsKKyAgICAgICAgcGlfID0gdG1wOworICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHBpXyAhPSAwPyBwaV8tPnVzZV9jb3VudCgpOiAwOworICAgIH0KKworICAgIGJvb2wgZW1wdHkoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gcGlfID09IDA7CisgICAgfQorCisgICAgZnJpZW5kIGlubGluZSBib29sIG9wZXJhdG9yPT0od2Vha19jb3VudCBjb25zdCAmIGEsIHdlYWtfY291bnQgY29uc3QgJiBiKQorICAgIHsKKyAgICAgICAgcmV0dXJuIGEucGlfID09IGIucGlfOworICAgIH0KKworICAgIGZyaWVuZCBpbmxpbmUgYm9vbCBvcGVyYXRvcjwod2Vha19jb3VudCBjb25zdCAmIGEsIHdlYWtfY291bnQgY29uc3QgJiBiKQorICAgIHsKKyAgICAgICAgcmV0dXJuIHN0ZDo6bGVzczxzcF9jb3VudGVkX2Jhc2UgKj4oKShhLnBpXywgYi5waV8pOworICAgIH0KK307CisKK2lubGluZSBzaGFyZWRfY291bnQ6OnNoYXJlZF9jb3VudCggd2Vha19jb3VudCBjb25zdCAmIHIgKTogcGlfKCByLnBpXyApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgoreworICAgIGlmKCBwaV8gPT0gMCB8fCAhcGlfLT5hZGRfcmVmX2xv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gPGFsZ29yaXRobT4gICAgICAgIC8vIGZvciBzdGQ6OnN3YXAKKyNpbmNsdWRlIDxmdW5jdGlvbmFsPiAgICAgICAvLyBmb3Igc3RkOjpsZXNzCisjaW5jbHVkZSA8bmV3PiAgICAgICAgICAgICAgLy8gZm9yIHN0ZDo6YmFkX2FsbG9jCisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCit0ZW1wbGF0ZTxjbGFzcyBUPiBjbGFzcyBzaGFyZWRfcHRyCit7Citwcml2YXRlOgorCisgICAgdHlwZWRlZiBkZXRhaWw6OmF0b21pY19jb3VudCBjb3VudF90eXBlOworCitwdWJsaWM6CisKKyAgICB0eXBlZGVmIFQgZWxlbWVudF90eXBlOworICAgIHR5cGVkZWYgVCB2YWx1ZV90eXBlOworCisgICAgZXhwbGljaXQgc2hhcmVkX3B0cihUICogcCA9IDApOiBweChwKQorICAgIHsKKyNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIHRyeSAgLy8gcHJldmVudCBsZWFrIGlmIG5ldyB0aHJvd3MKKyAgICAgICAgeworICAgICAgICAgICAgcG4gPSBuZXcgY291bnRfdHlwZSgxKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCguLi4pCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpjaGVja2VkX2RlbGV0ZShwKTsKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcG4gPSBuZXcgY291bnRfdHlwZSgxKTsKKworICAgICAgICBpZihwbiA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6Y2hlY2tlZF9kZWxldGUocCk7CisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKHN0ZDo6YmFkX2FsbG9jKCkpOworICAgICAgICB9CisKKyNlbmRpZgorICAgIH0KKworICAgIH5zaGFyZWRfcHRyKCkKKyAgICB7CisgICAgICAgIGlmKC0tKnBuID09IDApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpjaGVja2VkX2RlbGV0ZShweCk7CisgICAgICAgICAgICBkZWxldGUgcG47CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzaGFyZWRfcHRyKHNoYXJlZF9wdHIgY29uc3QgJiByKTogcHgoci5weCkgIC8vIG5ldmVyIHRocm93cworICAgIHsKKyAgICAgICAgcG4gPSByLnBuOworICAgICAgICArKypwbjsKKyAgICB9CisKKyAgICBzaGFyZWRfcHRyICYgb3BlcmF0b3I9KHNoYXJlZF9wdHIgY29uc3QgJiByKQorICAgIHsKKyAgICAgICAgc2hhcmVkX3B0cihyKS5zd2FwKCp0aGlzKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworI2lmbmRlZiBCT09TVF9OT19BVVRPX1BUUgorCisgICAgZXhwbGljaXQgc2hhcmVkX3B0cihzdGQ6OmF1dG9fcHRyPFQ+ICYgcikKKyAgICB7IAorICAgICAgICBwbiA9IG5ldyBjb3VudF90eXBlKDEpOyAvLyBtYXkgdGhyb3cKKyAgICAgICAgcHggPSByLnJlbGVhc2UoKTsgLy8gZml4OiBtb3ZlZCBoZXJlIHRvIHN0b3AgbGVhayBpZiBuZXcgdGhyb3dzCisgICAgfSAKKworICAgIHNoYXJlZF9wdHIgJiBvcGVyYXRvcj0oc3RkOjphdXRvX3B0cjxUPiAmIHIpCisgICAgeworICAgICAgICBzaGFyZWRfcHRyKHIpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisjZW5kaWYKKworICAgIHZvaWQgcmVzZXQoVCAqIHAgPSAwKQorICAgIHsKKyAgICAgICAgQk9PU1RfQVNTRVJUKHAgPT0gMCB8fCBwICE9IHB4KTsKKyAgICAgICAgc2hhcmVkX3B0cihwKS5zd2FwKCp0aGlzKTsKKyAgICB9CisKKyAgICBUICYgb3BlcmF0b3IqKCkgY29uc3QgIC8vIG5ldmVyIHRocm93cworICAgIHsKKyAgICAgICAgQk9PU1RfQVNTRVJUKHB4ICE9IDApOworICAgICAgICByZXR1cm4gKnB4OworICAgIH0KKworICAgIFQgKiBvcGVyYXRvci0+KCkgY29uc3QgIC8vIG5ldmVyIHRocm93cworICAgIHsKKyAgICAgICAgQk9PU1RfQVNTRVJUKHB4ICE9IDApOworICAgICAgICByZXR1cm4gcHg7CisgICAgfQorCisgICAgVCAqIGdldCgpIGNvbnN0ICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIHJldHVybiBweDsKKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0ICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIHJldHVybiAqcG47CisgICAgfQorCisgICAgYm9vbCB1bmlxdWUoKSBjb25zdCAgLy8gbmV2ZXIgdGhyb3dzCisgICAgeworICAgICAgICByZXR1cm4gKnBuID09IDE7CisgICAgfQorICAgIAorICAgIHZvaWQgc3dhcChzaGFyZWRfcHRyPFQ+ICYgb3RoZXIpICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIHN0ZDo6c3dhcChweCwgb3RoZXIucHgpOworICAgICAgICBzdGQ6OnN3YXAocG4sIG90aGVyLnBuKTsKKyAgICB9CisKK3ByaXZhdGU6CisKKyAgICBUICogcHg7ICAgICAgICAgICAgLy8gY29udGFpbmVkIHBvaW50ZXIKKyAgICBjb3VudF90eXBlICogcG47ICAgLy8gcHRyIHRvIHJlZmVyZW5jZSBjb3VudGVyCit9OworCit0ZW1wbGF0ZTxjbGFzcyBULCBjbGFzcyBVPiBpbmxpbmUgYm9vbCBvcGVyYXRvcj09KHNoYXJlZF9wdHI8VD4gY29uc3QgJiBhLCBzaGFyZWRfcHRyPFU+IGNvbnN0ICYgYikKK3sKKyAgICByZXR1cm4gYS5nZXQoKSA9PSBiLmdldCgpOworfQorCit0ZW1wbGF0ZTxjbGFzcyBULCBjbGFzcyBVPiBpbmxpbmUgYm9vbCB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kZChfRkFTWl9XLCBfU0VNX1JFTCwgcHcsICsxLCBfTERISU5UX05PTkUpOworfSAKKworaW5saW5lIGludCBhdG9taWNfZGVjcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gcmV0dXJuIC0tKnB3OworCisgICAgaW50IHIgPSBzdGF0aWNfY2FzdDxpbnQ+KF9Bc21fZmV0Y2hhZGQoX0ZBU1pfVywgX1NFTV9SRUwsIHB3LCAtMSwgX0xESElOVF9OT05FKSk7CisgICAgaWYgKDEgPT0gcikKKyAgICB7CisgICAgICAgIF9Bc21fbWYoKTsKKyAgICB9CisgICAgCisgICAgcmV0dXJuIHIgLSAxOworfQorCitpbmxpbmUgaW50IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyBpZiggKnB3ICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gKnB3OworCisgICAgaW50IHYgPSAqcHc7CisgICAgCisgICAgZm9yICg7OykKKyAgICB7CisgICAgICAgIGlmICgwID09IHYpCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBfQXNtX21vdl90b19hcihfQVJFR19DQ1YsCisgICAgICAgICAgICAgICAgICAgICAgIHYsCisgICAgICAgICAgICAgICAgICAgICAgIChfVVBfQ0FMTF9GRU5DRSB8IF9VUF9TWVNfRkVOQ0UgfCBfRE9XTl9DQUxMX0ZFTkNFIHwgX0RPV05fU1lTX0ZFTkNFKSk7CisgICAgICAgIGludCByID0gc3RhdGljX2Nhc3Q8aW50PihfQXNtX2NtcHhjaGcoX1NaX1csIF9TRU1fQUNRLCBwdywgdiArIDEsIF9MREhJTlRfTk9ORSkpOworICAgICAgICBpZiAociA9PSB2KQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gciArIDE7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHYgPSByOworICAgIH0KK30KKworY2xhc3Mgc3BfY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50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PGludCBjb25zdCB2b2xhdGlsZSAmPiggdXNlX2NvdW50XyApOyAvLyBUT0RPIHVzZSBsZC5hY3EgaGVyZQorICAgIH0KK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYgIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUF9DT1VOVEVEX0JBU0VfQUNDX0lBNjRfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5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J5IEFsZXhhbmRlciBUZXJla2hvdgorLy8KKy8vICBUaGFua3MgdG8gQmVuIEhpdGNoaW5ncyBmb3IgdGhlICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKy8vICBmb3JtdWxhdGlvbgorLy8KKworI2luY2x1ZGUgPG5kbmJvb3N0L2RldGFpbC9zcF90eXBlaW5mby5ocHA+CisjaW5jbHVkZSA8YnVpbHRpbnMuaD4KKyNpbmNsdWRlIDxzeXMvYXRvbWljX29wLmg+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIGludDMyX3QqIHB3ICkKK3sKKyAgICAvLyArKypwdzsKKworICAgIGZldGNoX2FuZF9hZGQoIHB3LCAxICk7Cit9CisKK2lubGluZSBpbnQzMl90IGF0b21pY19kZWNyZW1lbnQoIGludDMyX3QgKiBwdyApCit7CisgICAgLy8gcmV0dXJuIC0tKnB3OworCisgICAgaW50MzJfdCBvcmlnaW5hbFZhbHVlOworCisgICAgX19sd3N5bmMoKTsKKyAgICBvcmlnaW5hbFZhbHVlID0gZmV0Y2hfYW5kX2FkZCggcHcsIC0xICk7CisgICAgX19pc3luYygpOworCisgICAgcmV0dXJuIChvcmlnaW5hbFZhbHVlIC0gMSk7Cit9CisKK2lubGluZSBpbnQzMl90IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludDMyX3QgKiBwdyApCit7CisgICAgLy8gaWYoICpwdyAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuICpwdzsKKworICAgIGludDMyX3QgdG1wID0gZmV0Y2hfYW5kX2FkZCggcHcsIDAgKTsKKyAgICBmb3IoIDs7ICkKKyAgICB7CisgICAgICAgIGlmKCB0bXAgPT0gMCApIHJldHVybiAwOworICAgICAgICBpZiggY29tcGFyZV9hbmRfc3dhcCggcHcsICZ0bXAsIHRtcCArIDEgKSApIHJldHVybiAodG1wICsgMSk7CisgICAgfQorfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIGludDMyX3QgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQzMl90IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ3ZWFrX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBmZXRjaF9hbmRfYWRkKCBjb25zdF9jYXN0PGludDMyX3QqPigmdXNlX2NvdW50XyksIDAgKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9CQVNFX0FJWF9IUFBfSU5DTFVERUQKZGlmZi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kgYXQKKy8vICBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworLy8KKy8vICBMb2NrLWZyZWUgYWxnb3JpdGhtIGJ5IEFsZXhhbmRlciBUZXJla2hvdgorLy8KKy8vICBUaGFua3MgdG8gQmVuIEhpdGNoaW5ncyBmb3IgdGhlICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKy8vICBmb3JtdWxhdGlvbgorLy8KKworI2luY2x1ZGUgPG5kbmJvb3N0L2RldGFpbC9zcF90eXBlaW5mby5ocHA+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIHJlZ2lzdGVyIGxvbmcgKiBwdyApCit7CisgICAgcmVnaXN0ZXIgaW50IGE7CisKKyAgICBhc20KKyAgICB7Citsb29wOgorCisgICAgbHdhcnggICBhLCAwLCBwdworICAgIGFkZGkgICAgYSwgYSwgMQorICAgIHN0d2N4LiAgYSwgMCwgcHcKKyAgICBibmUtICAgIGxvb3AKKyAgICB9Cit9CisKK2lubGluZSBsb25nIGF0b21pY19kZWNyZW1lbnQoIHJlZ2lzdGVyIGxvbmcgKiBwdyApCit7CisgICAgcmVnaXN0ZXIgaW50IGE7CisKKyAgICBhc20KKyAgICB7CisgICAgc3luYworCitsb29wOgorCisgICAgbHdhcnggICBhLCAwLCBwdworICAgIGFkZGkgICAgYSwgYSwgLTEKKyAgICBzdHdjeC4gIGEsIDAsIHB3CisgICAgYm5lLSAgICBsb29wCisKKyAgICBpc3luYworICAgIH0KKworICAgIHJldHVybiBhOworfQorCitpbmxpbmUgbG9uZyBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCByZWdpc3RlciBsb25nICogcHcgKQoreworICAgIHJlZ2lzdGVyIGludCBhOworCisgICAgYXNtCisgICAgeworbG9vcDoKKworICAgIGx3YXJ4ICAgYSwgMCwgcHcKKyAgICB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ZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PGxvbmcgY29uc3Qgdm9sYXRpbGUgJj4oIHVzZV9jb3VudF8gKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKK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WxlIExJQ0VOU0VfMV8wLnR4dCBvciBjb3B5IGF0CisvLyAgaHR0cDovL3d3dy5ib29zdC5vcmcvTElDRU5TRV8xXzAudHh0KQorLy8KKy8vCisvLyAgTG9jay1mcmVlIGFsZ29yaXRobSBieSBBbGV4YW5kZXIgVGVyZWtob3YKKy8vCisKKyNpbmNsdWRlIDxuZG5ib29zdC9kZXRhaWwvc3BfdHlwZWluZm8uaHBwPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gKysqcHc7CisKKyAgICBpbnQgdG1wOworCisgICAgLy8gTm8gYmFycmllciBpcyByZXF1aXJlZCBoZXJlIGJ1dCBmZXRjaGFkZCBhbHdheXMgaGFzIGFuIGFjcXVpcmUgb3IKKyAgICAvLyByZWxlYXNlIGJhcnJpZXIgYXNzb2NpYXRlZCB3aXRoIGl0LiAgV2UgY2hvb3NlIHJlbGVhc2UgYXMgaXQgc2hvdWxkIGJlCisgICAgLy8gY2hlYXBlci4KKyAgICBfX2FzbV9fICgiZmV0Y2hhZGQ0LnJlbCAlMD0lMSwxIiA6CisgICAgICAgICAiPXIiKHRtcCksICI9bSIoKnB3KSA6CisgICAgICAgICAibSIoICpwdyApKTsKK30KKworaW5saW5lIGludCBhdG9taWNfZGVjcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gcmV0dXJuIC0tKnB3OworCisgICAgaW50IHJ2OworCisgICAgX19hc21fXyAoIiAgICAgZmV0Y2hhZGQ0LnJlbCAlMD0lMSwtMSA7OyBcbiIKKyAgICAgICAgICAgICAiICAgICBjbXAuZXEgICAgICAgIHA3LHAwPTEsJTAgOzsgXG4iCisgICAgICAgICAgICAgIihwNykgbGQ0LmFjcSAgICAgICAlMD0lMSAgICAiIDoKKyAgICAgICAgICAgICAiPSZyIihydiksICI9bSIoKnB3KSA6CisgICAgICAgICAgICAgIm0iKCAqcHcgKSA6CisgICAgICAgICAgICAgInA3Iik7CisKKyAgICByZXR1cm4gcnY7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIGlmKCAqcHcgIT0gMCApICsrKnB3OworICAgIC8vIHJldHVybiAqcHc7CisKKyAgICBpbnQgcnYsIHRtcCwgdG1wMjsKKworICAgIF9fYXNtX18gKCIwOiAgIGxkNCAgICAgICAgICAlMD0lMyAgICAgICAgICAgOzsgXG4iCisgICAgICAgICAiICAgICBjbXAuZXEgICAgICAgcDcscDA9MCwlMCAgICAgICAgOzsgXG4iCisgICAgICAgICAiKHA3KSBici5jb25kLnNwbnQgMWYgICAgICAgICAgICAgICAgXG4iCisgICAgICAgICAiICAgICBtb3YgICAgICAgICAgYXIuY2N2PSUwICAgICAgICAgXG4iCisgICAgICAgICAiICAgICBhZGQgICAgICAgICAgJTE9MSwlMCAgICAgICAgICAgOzsgXG4iCisgICAgICAgICAiICAgICBjbXB4Y2hnNC5hY3EgJTI9JTMsJTEsYXIuY2N2IDs7IFxuIgorICAgICAgICAgIiAgICAgY21wLm5lICAgICAgIHA3LHAwPSUwLCUyICAgICAgIDs7IFxuIgorICAgICAgICAgIihwNykgYnIuY29uZC5zcG50IDBiICAgICAgICAgICAgICAgIFxuIgorICAgICAgICAgIiAgICAgbW92ICAgICAgICAgICUwPSUxICAgICAgICAgICAgIDs7IFxuIgorICAgICAgICAgIjE6IiA6IAorICAgICAgICAgIj0mciIocnYpLCAiPSZyIih0bXApLCAiPSZyIih0bXAyKSwgIj1tIigqcHcpIDoKKyAgICAgICAgICJtIiggKnB3ICkgOgorICAgICAgICAgImFyLmNjdiIsICJwNyIpOworCisgICAgcmV0dXJuIHJ2OworfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIGludCB1c2VfY291bnRfOyAgICAgICAgLy8gI3NoYXJlZAorICAgIGludCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmd2Vha19jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8aW50IGNvbnN0IHZvbGF0aWxlICY+KCB1c2VfY291bnRfICk7IC8vIFRPRE8gdXNlIGxkLmFjcSBoZXJlCisgICAgfQorfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbmRpZiAgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX1NQX0NPVU5URURfQkFTRV9HQ0NfSUE2NF9IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BfY291bnRlZF9iYXNlX2djY19taXBzLmh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3BfdHlwZWluZm8uaHBwPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gKysqcHc7CisKKyAgICBpbnQgdG1wOworCisgICAgX19hc21fXyBfX3ZvbGF0aWxlX18KKyAgICAoCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICIuc2V0IHB1c2hcblx0IgorICAgICAgICAiLnNldCBtaXBzMlxuXHQiCisgICAgICAgICJsbCAlMCwgJTFcblx0IgorICAgICAgICAiYWRkaXUgJTAsIDFcblx0IgorICAgICAgICAic2MgJTAsICUxXG5cdCIKKyAgICAgICAgIi5zZXQgcG9wXG5cdCIKKyAgICAgICAgImJlcXogJTAsIDBiIjoKKyAgICAgICAgIj0mciIoIHRtcCApLCAiPW0iKCAqcHcgKToKKyAgICAgICAgIm0iKCAqcHcgKQorICAgICk7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2RlY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIHJldHVybiAtLSpwdzsKKworICAgIGludCBydiwgdG1wOworCisgICAgX19hc21fXyBfX3ZvbGF0aWxlX18KKyAgICAoCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICIuc2V0IHB1c2hcblx0IgorICAgICAgICAiLnNldCBtaXBzMlxuXHQiCisgICAgICAgICJsbCAlMSwgJTJcblx0IgorICAgICAgICAiYWRkaXUgJTAsICUxLCAtMVxuXHQiCisgICAgICAgICJzYyAlMCwgJTJcblx0IgorICAgICAgICAiLnNldCBwb3Bcblx0IgorICAgICAgICAiYmVxeiAlMCwgMGJcblx0IgorICAgICAgICAiYWRkaXUgJTAsICUxLCAtMSI6CisgICAgICAgICI9JnIiKCBydiApLCAiPSZyIiggdG1wICksICI9bSIoICpwdyApOgorICAgICAgICAibSIoICpwdyApOgorICAgICAgICAibWVtb3J5IgorICAgICk7CisKKyAgICByZXR1cm4gcnY7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIGlmKCAqcHcgIT0gMCApICsrKnB3OworICAgIC8vIHJldHVybiAqcHc7CisKKyAgICBpbnQgcnYsIHRtcDsKKworICAgIF9fYXNtX18gX192b2xhdGlsZV9fCisgICAgKAorICAgICAgICAiMDpcblx0IgorICAgICAgICAiLnNldCBwdXNoXG5cdCIKKyAgICAgICAgIi5zZXQgbWlwczJcblx0IgorICAgICAgICAibGwgJTAsICUyXG5cdCIKKyAgICAgICAgImJlcXogJTAsIDFmXG5cdCIKKyAgICAgICAgImFkZGl1ICUxLCAlMCwgMVxuXHQiCisgICAgICAgICJzYyAlMSwgJTJcblx0IgorICAgICAgICAiLnNldCBwb3Bcblx0IgorICAgICAgICAiYmVxeiAlMSwgMGJcblx0IgorICAgICAgICAiYWRkaXUgJTAsICUwLCAxXG5cdCIKKyAgICAgICAgIjE6IjoKKyAgICAgICAgIj0mciIoIHJ2ICksICI9JnIiKCB0bXAgKSwgIj1tIiggKnB3ICk6CisgICAgICAgICJtIiggKnB3ICk6CisgICAgICAgICJtZW1vcnkiCisgICAgKTsKKworICAgIHJldHVybiBydjsKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PGludCBjb25zdCB2b2xhdGlsZSAmPiggdXNlX2NvdW50XyApOworICAgIH0KK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYgIC8vICNpZm5kZWYgQk9PU1RfREVUQUlMX1NQX0NPVU5URURfQkFTRV9HQ0NfTUlQU19IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BfY291bnRlZF9iYXNlX2djY19wcGMuaHBwIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2VfZ2NjX3BwYy5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uOWJlYWNkMAotLS0gL2Rldi9udWxsCisrKyBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BfY291bnRlZF9iYXNlX2djY19wcGMuaHBwCkBAIC0wLDAgKzEsMTgyIEBACisjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9CQVNFX0dDQ19QUENfSFBQX0lOQ0xVREVECisjZGV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c7CisKKyAgICBpbnQgdG1wOworCisgICAgX19hc21fXworICAgICgKKyAgICAgICAgIjA6XG5cdCIKKyAgICAgICAgImx3YXJ4ICUxLCAwLCAlMlxuXHQiCisgICAgICAgICJhZGRpICUxLCAlMSwgMVxuXHQiCisgICAgICAgICJzdHdjeC4gJTEsIDAsICUyXG5cdCIKKyAgICAgICAgImJuZS0gMGIiOgorCisgICAgICAgICI9bSIoICpwdyApLCAiPSZiIiggdG1wICk6CisgICAgICAgICJyIiggcHcgKSwgIm0iKCAqcHcgKToKKyAgICAgICAgImNjIgorICAgICk7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2RlY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIHJldHVybiAtLSpwdzsKKworICAgIGludCBydjsKKworICAgIF9fYXNtX18gX192b2xhdGlsZV9fCisgICAgKAorICAgICAgICAic3luY1xuXHQiCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICJsd2FyeCAlMSwgMCwgJTJcblx0IgorICAgICAgICAiYWRkaSAlMSwgJTEsIC0xXG5cdCIKKyAgICAgICAgInN0d2N4LiAlMSwgMCwgJTJcblx0IgorICAgICAgICAiYm5lLSAwYlxuXHQiCisgICAgICAgICJpc3luYyI6CisKKyAgICAgICAgIj1tIiggKnB3ICksICI9JmIiKCBydiApOgorICAgICAgICAiciIoIHB3ICksICJtIiggKnB3ICk6CisgICAgICAgICJtZW1vcnkiLCAiY2MiCisgICAgKTsKKworICAgIHJldHVybiBydjsKK30KKworaW5saW5lIGludCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gaWYoICpwdyAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuICpwdzsKKworICAgIGludCBydjsKKworICAgIF9fYXNtX18KKyAgICAoCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICJsd2FyeCAlMSwgMCwgJTJcblx0IgorICAgICAgICAiY21wd2kgJTEsIDBcblx0IgorICAgICAgICAiYmVxIDFmXG5cdCIKKyAgICAgICAgImFkZGkgJTEsICUxLCAxXG5cdCIKKyAgICAgICAgIjE6XG5cdCIKKyAgICAgICAgInN0d2N4LiAlMSwgMCwgJTJcblx0IgorICAgICAgICAiYm5lLSAwYiI6CisKKyAgICAgICAgIj1tIiggKnB3ICksICI9JmIiKCBydiApOgorICAgICAgICAiciIoIHB3ICksICJtIiggKnB3ICk6CisgICAgICAgICJjYyIKKyAgICApOworCisgICAgcmV0dXJuIHJ2OworfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIGludCB1c2VfY291bnRfOyAgICAgICAgLy8gI3NoYXJlZAorICAgIGludCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmd2Vha19jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3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GlvdHIgV3lkZXJza2kKKy8vICBDb3B5cmlnaHQgKGMpIDIwMDYgVG9tYXMgUHV2ZXJsZQorLy8gIENvcHlyaWdodCAoYykgMjAwNiBQZXRlciBEaW1vdgorLy8KKy8vICBEaXN0cmlidXRlZCB1bmRlciB0aGUgQm9vc3QgU29mdHdhcmUgTGljZW5zZSwgVmVyc2lvbiAxLjAuCisvLyAgU2VlIGFjY29tcGFueWluZyBmaWxlIExJQ0VOU0VfMV8wLnR4dCBvciBjb3B5IGF0CisvLyAgaHR0cDovL3d3dy5ib29zdC5vcmcvTElDRU5TRV8xXzAudHh0CisvLworLy8gIFRoYW5rcyB0byBNaWNoYWVsIHZhbiBkZXIgV2VzdGh1aXplbgorCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKyNpbmNsdWRlIDxpbnR0eXBlcy5oPiAvLyBpbnQzMl90CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSBpbnQzMl90IGNvbXBhcmVfYW5kX3N3YXAoIGludDMyX3QgKiBkZXN0XywgaW50MzJfdCBjb21wYXJlXywgaW50MzJfdCBzd2FwXyApCit7CisgICAgX19hc21fXyBfX3ZvbGF0aWxlX18oICJjYXMgWyUxXSwgJTIsICUwIgorICAgICAgICAgICAgICAgICAgICAgICAgOiAiK3IiIChzd2FwXykKKyAgICAgICAgICAgICAgICAgICAgICAgIDogInIiIChkZXN0XyksICJyIiAoY29tcGFyZV8pCisgICAgICAgICAgICAgICAgICAgICAgICA6ICJtZW1vcnkiICk7CisKKyAgICByZXR1cm4gc3dhcF87Cit9CisKK2lubGluZSBpbnQzMl90IGF0b21pY19mZXRjaF9hbmRfYWRkKCBpbnQzMl90ICogcHcsIGludDMyX3QgZHYgKQoreworICAgIC8vIGxvbmcgciA9ICpwdzsKKyAgICAvLyAqcHcgKz0gZHY7CisgICAgLy8gcmV0dXJuIHI7CisKKyAgICBmb3IoIDs7ICkKKyAgICB7CisgICAgICAgIGludDMyX3QgciA9ICpwdzsKKworICAgICAgICBpZiggX19idWlsdGluX2V4cGVjdCgoY29tcGFyZV9hbmRfc3dhcChwdywgciwgciArIGR2KSA9PSByKSwgMSkgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorICAgIH0KK30KKworaW5saW5lIHZvaWQgYXRvbWljX2luY3JlbWVudCggaW50MzJfdCAqIHB3ICkKK3sKKyAgICBhdG9taWNfZmV0Y2hfYW5kX2FkZCggcHcsIDEgKTsKK30KKworaW5saW5lIGludDMyX3QgYXRvbWljX2RlY3JlbWVudCggaW50MzJfdCAqIHB3ICkKK3sKKyAgICByZXR1cm4gYXRvbWljX2ZldGNoX2FuZF9hZGQoIHB3LCAtMSApOworfQorCitpbmxpbmUgaW50MzJfdCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQzMl90ICogcHcgKQoreworICAgIC8vIGxvbmcgciA9ICpwdzsKKyAgICAvLyBpZiggciAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuIHI7CisKKyAgICBmb3IoIDs7ICkKKyAgICB7CisgICAgICAgIGludDMyX3QgciA9ICpwdzsKKworICAgICAgICBpZiggciA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHI7CisgICAgICAgIH0KKworICAgICAgICBpZiggX19idWlsdGluX2V4cGVjdCggKCBjb21wYXJlX2FuZF9zd2FwKCBwdywgciwgciArIDEgKSA9PSByICksIDEgKSApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiByOworICAgICAgICB9CisgICAgfSAgICAKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQzMl90IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50MzJfdCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmd2Vha19jb3VudF8gKSA9PSAxICkKKyAgICAgICAgeworICAgICAgICAgICAgZGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gY29uc3RfY2FzdDwgaW50MzJfdCBjb25zdCB2b2xhdGlsZSAmID4oIHVzZV9jb3VudF8gKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9CQVNFX0dDQ19TUEFSQ19IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BfY291bnRlZF9iYXNlX2djY194ODYuaHBwIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2VfZ2NjX3g4Ni5ocHAKbmV3IGZpbG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JlbiBIaXRjaGluZ3MgZm9yIHRoZSAjd2VhayArICgjc2hhcmVkICE9IDApCisvLyAgZm9ybXVsYXRpb24KKy8vCisKKyNpbmNsdWRlIDxuZG5ib29zdC9kZXRhaWwvc3BfdHlwZWluZm8uaHBwPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgaW50IGF0b21pY19leGNoYW5nZV9hbmRfYWRkKCBpbnQgKiBwdywgaW50IGR2ICkKK3sKKyAgICAvLyBpbnQgciA9ICpwdzsKKyAgICAvLyAqcHcgKz0gZHY7CisgICAgLy8gcmV0dXJuIHI7CisKKyAgICBpbnQgcjsKKworICAgIF9fYXNtX18gX192b2xhdGlsZV9fCisgICAgKAorICAgICAgICAibG9ja1xuXHQiCisgICAgICAgICJ4YWRkICUxLCAlMCI6CisgICAgICAgICI9bSIoICpwdyApLCAiPXIiKCByICk6IC8vIG91dHB1dHMgKCUwLCAlMSkKKyAgICAgICAgIm0iKCAqcHcgKSwgIjEiKCBkdiApOiAvLyBpbnB1dHMgKCUyLCAlMyA9PSAlMSkKKyAgICAgICAgIm1lbW9yeSIsICJjYyIgLy8gY2xvYmJlcnMKKyAgICApOworCisgICAgcmV0dXJuIHI7Cit9CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvL2F0b21pY19leGNoYW5nZV9hbmRfYWRkKCBwdywgMSApOworCisgICAgX19hc21fXworICAgICgKKyAgICAgICAgImxvY2tcblx0IgorICAgICAgICAiaW5jbCAlMCI6CisgICAgICAgICI9bSIoICpwdyApOiAvLyBvdXRwdXQgKCUwKQorICAgICAgICAibSIoICpwdyApOiAvLyBpbnB1dCAoJTEpCisgICAgICAgICJjYyIgLy8gY2xvYmJlcnMKKyAgICApOworfQorCitpbmxpbmUgaW50IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyBpbnQgcnYgPSAqcHc7CisgICAgLy8gaWYoIHJ2ICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gcnY7CisKKyAgICBpbnQgcnYsIHRtcDsKKworICAgIF9fYXNtX18KKyAgICAoCisgICAgICAgICJtb3ZsICUwLCAlJWVheFxuXHQiCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICJ0ZXN0ICUlZWF4LCAlJWVheFxuXHQiCisgICAgICAgICJqZSAxZlxuXHQiCisgICAgICAgICJtb3ZsICUlZWF4LCAlMlxuXHQiCisgICAgICAgICJpbmNsICUyXG5cdCIKKyAgICAgICAgImxvY2tcblx0IgorICAgICAgICAiY21weGNoZ2wgJTIsICUwXG5cdCIKKyAgICAgICAgImpuZSAwYlxuXHQiCisgICAgICAgICIxOiI6CisgICAgICAgICI9bSIoICpwdyApLCAiPSZhIiggcnYgKSwgIj0mciIoIHRtcCApOiAvLyBvdXRwdXRzICglMCwgJTEsICUyKQorICAgICAgICAibSIoICpwdyApOiAvLyBpbnB1dCAoJTMpCisgICAgICAgICJjYyIgLy8gY2xvYmJlcnMKKyAgICApOworCisgICAgcmV0dXJuIHJ2OworfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIGludCB1c2VfY291bnRfOyAgICAgICAgLy8gI3NoYXJlZAorICAgIGludCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19leGNoYW5nZV9hbmRfYWRkKCAmdXNlX2NvdW50XywgLTEgKSA9PSAxICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYW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KKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgKyt1c2VfY291bnRfOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICBpZiggdXNlX2NvdW50XyA9PSAwICkgcmV0dXJuIGZhbHNlOworICAgICAgICArK3VzZV9jb3VudF87CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCAtLXVzZV9jb3VudF8gPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRp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0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJm1fICk7CisgICAgICAgICsrdXNlX2NvdW50XzsKKyAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soICZtXyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soICZtXyApOworICAgICAgICBib29sIHIgPSB1c2VfY291bnRfID09IDA/IGZhbHNlOiAoICsrdXNlX2NvdW50XywgdHJ1ZSApOworICAgICAgICBwdGhyZWFkX211dGV4X3VubG9jayggJm1fICk7CisgICAgICAgIHJldHVybiByOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJm1fICk7CisgICAgICAgIGxvbmcgbmV3X3VzZV9jb3VudCA9IC0tdXNlX2NvdW50XzsKKyAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soICZtXyApOworCisgICAgICAgIGlmKCBuZXdfdXNlX2NvdW50ID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF9sb2NrKCAmbV8gKTsKKyAgICAgICAgKyt3ZWFrX2NvdW50XzsKKyAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soICZtXyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF9sb2NrKCAmbV8gKTsKKyAgICAgICAgbG9uZyBuZX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cDMyKGRlc3RfLGNvbXBhcmVfLHN3YXBfKTsKK30KKworaW5saW5lIHVpbnQzMl90IGF0b21pY19mZXRjaF9hbmRfYWRkKCB1aW50MzJfdCAqIHB3LCB1aW50MzJfdCBkdiApCit7CisgICAgLy8gbG9uZyByID0gKnB3OworICAgIC8vICpwdyArPSBkdjsKKyAgICAvLyByZXR1cm4gcjsKKworICAgIGZvciggOzsgKQorICAgIHsKKyAgICAgICAgdWludDMyX3QgciA9ICpwdzsKKworICAgICAgICBpZiggX19idWlsdGluX2V4cGVjdCgoY29tcGFyZV9hbmRfc3dhcChwdywgciwgciArIGR2KSA9PSByKSwgMSkgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorICAgIH0KK30KKworaW5saW5lIHZvaWQgYXRvbWljX2luY3JlbWVudCggdWludDMyX3QgKiBwdyApCit7CisgICAgKHZvaWQpIF9fYnVpbHRpbl9jZWxsQXRvbWljSW5jcjMyKCBwdyApOworfQorCitpbmxpbmUgdWludDMyX3QgYXRvbWljX2RlY3JlbWVudCggdWludDMyX3QgKiBwdyApCit7CisgICAgcmV0dXJuIF9fYnVpbHRpbl9jZWxsQXRvbWljRGVjcjMyKCBwdyApOworfQorCitpbmxpbmUgdWludDMyX3QgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggdWludDMyX3QgKiBwdyApCit7CisgICAgLy8gbG9uZyByID0gKnB3OworICAgIC8vIGlmKCByICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gcjsKKworICAgIGZvciggOzsgKQorICAgIHsKKyAgICAgICAgdWludDMyX3QgciA9ICpwdzsKKworICAgICAgICBpZiggciA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHI7CisgICAgICAgIH0KKworICAgICAgICBpZiggX19idWlsdGluX2V4cGVjdCggKCBjb21wYXJlX2FuZF9zd2FwKCBwdywgciwgciArIDEgKSA9PSByICksIDEgKSApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiByOworICAgICAgICB9CisgICAgfSAgICAKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICB1aW50MzJfdCB1c2VfY291bnRfOyAgICAgICAgLy8gI3NoYXJlZAorICAgIHVpbnQzMl90IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAxICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ3ZWFrX2NvdW50XyApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBjb25zdF9jYXN0PCB1aW50MzJfdCBjb25zdCB2b2xhdGlsZSAmID4oIHVzZV9jb3VudF8gKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9C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8xXzAudHh0IG9yIGNvcHkgYXQKKy8vICBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKyNpbmNsdWRlIDxuZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwaW5sb2NrX3Bvb2wuaHBwPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgaW50IGF0b21pY19leGNoYW5nZV9hbmRfYWRkKCBpbnQgKiBwdywgaW50IGR2ICkKK3sKKyAgICBzcGlubG9ja19wb29sPDE+OjpzY29wZWRfbG9jayBsb2NrKCBwdyApOworCisgICAgaW50IHIgPSAqcHc7CisgICAgKnB3ICs9IGR2OworICAgIHJldHVybiByOworfQorCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgc3BpbmxvY2tfcG9vbDwxPjo6c2NvcGVkX2xvY2sgbG9jayggcHcgKTsKKyAgICArKypwdzsKK30KKworaW5saW5lIGludCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgc3BpbmxvY2tfcG9vbDwxPjo6c2NvcGVkX2xvY2sgbG9jayggcHcgKTsKKworICAgIGludCBydiA9ICpwdzsKKyAgICBpZiggcnYgIT0gMCApICsrKnB3OworICAgIHJldHVybiBydjsKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggJnVzZV9jb3VudF8sIC0xICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggJndlYWtfY291bnRfLCAtMSApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHNwaW5sb2NrX3Bvb2w8MT46OnNjb3BlZF9sb2NrIGxvY2soICZ1c2VfY291bnRfICk7CisgICAgICAgIHJldHVybiB1c2VfY291bnRfOworICAgIH0KK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYgIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUF9DT1VOVEVEX0JBU0VfU1BJTl9IUFBfSU5DTFVERUQKZGlmZiAtLWdpdCBhL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BfY291bnRlZF9iYXNlX3N5bmMuaHBwIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2Vfc3luYy5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uNmVlN2ZhY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YWlsCit7CisKKyNpZiBJTlRfTUFYID49IDIxNDc0ODM2NDcKKwordHlwZWRlZiBpbnQgc3BfaW50MzJfdDsKKworI2Vsc2UKKwordHlwZWRlZiBsb25nIHNwX2ludDMyX3Q7CisKKyNlbmRpZgorCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBzcF9pbnQzMl90ICogcHcgKQoreworICAgIF9fc3luY19mZXRjaF9hbmRfYWRkKCBwdywgMSApOworfQorCitpbmxpbmUgc3BfaW50MzJfdCBhdG9taWNfZGVjcmVtZW50KCBzcF9pbnQzMl90ICogcHcgKQoreworICAgIHJldHVybiBfX3N5bmNfZmV0Y2hfYW5kX2FkZCggcHcsIC0xICk7Cit9CisKK2lubGluZSBzcF9pbnQzMl90IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIHNwX2ludDMyX3QgKiBwdyApCit7CisgICAgLy8gbG9uZyByID0gKnB3OworICAgIC8vIGlmKCByICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gcjsKKworICAgIHNwX2ludDMyX3QgciA9ICpwdzsKKworICAgIGZvciggOzsgKQorICAgIHsKKyAgICAgICAgaWYoIHIgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiByOworICAgICAgICB9CisKKyAgICAgICAgc3BfaW50MzJfdCByMiA9IF9fc3luY192YWxfY29tcGFyZV9hbmRfc3dhcCggcHcsIHIsIHIgKyAxICk7CisKKyAgICAgICAgaWYoIHIyID09IHIgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIHIgPSByMjsKKyAgICAgICAgfQorICAgIH0gICAgCit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3V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CisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIGNvbnN0X2Nhc3Q8IHNwX2ludDMyX3QgY29uc3Qgdm9sYXRpbGUgJiA+KCB1c2VfY291bnRfICk7CisgICAgfQorfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbmRpZiAgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX1NQX0NPVU5URURfQkFTRV9TWU5DX0hQUF9JTkNMVURFRApkaWZmIC0tZ2l0IGEvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2VfdmFjcHBfcHBjLmhwcCBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWw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aG0gYnkgQWxleGFuZGVyIFRlcmVraG92CisvLworLy8gIFRoYW5rcyB0byBCZW4gSGl0Y2hpbmdzIGZvciB0aGUgI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorLy8gIGZvcm11bGF0aW9uCisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKworZXh0ZXJuICJidWlsdGluIiB2b2lkIF9fbHdzeW5jKHZvaWQpOworZXh0ZXJuICJidWlsdGluIiB2b2lkIF9faXN5bmModm9pZCk7CitleHRlcm4gImJ1aWx0aW4iIGludCBfX2ZldGNoX2FuZF9hZGQodm9sYXRpbGUgaW50KiBhZGRyLCBpbnQgdmFsKTsKK2V4dGVybiAiYnVpbHRpbiIgaW50IF9fY29tcGFyZV9hbmRfc3dhcCh2b2xhdGlsZSBpbnQqLCBpbnQqLCBpbnQpOworCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBpbnQgKnB3ICkKK3sKKyAgIC8vICsrKnB3OworICAgX19sd3N5bmMoKTsKKyAgIF9fZmV0Y2hfYW5kX2FkZChwdywgMSk7CisgICBfX2lzeW5jKCk7Cit9IAorCitpbmxpbmUgaW50IGF0b21pY19kZWNyZW1lbnQoIGludCAqcHcgKQoreworICAgLy8gcmV0dXJuIC0tKnB3OworICAgX19sd3N5bmMoKTsKKyAgIGludCBvcmlnaW5hbFZhbHVlID0gX19mZXRjaF9hbmRfYWRkKHB3LCAtMSk7CisgICBfX2lzeW5jKCk7CisKKyAgIHJldHVybiAob3JpZ2luYWxWYWx1ZSAtIDEpOworfQorCitpbmxpbmUgaW50IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludCAqcHcgKQoreworICAgLy8gaWYoICpwdyAhPSAwICkgKysqcHc7CisgICAvLyByZXR1cm4gKnB3OworCisgICBfX2x3c3luYygpOworICAgaW50IHYgPSAqY29uc3RfY2FzdDx2b2xhdGlsZSBpbnQqPihwdyk7CisgICBmb3IgKDs7KQorICAgLy8gbG9vcCB1bnRpbCBzdGF0ZSBpcyBrbm93bgorICAgeworICAgICAgaWYgKHYgPT0gMCkgcmV0dXJuIDA7CisgICAgICBpZiAoX19jb21wYXJlX2FuZF9zd2FwKHB3LCAmdiwgdiArIDEpKQorICAgICAgeworICAgICAgICAgX19pc3luYygpOyByZXR1cm4gKHYgKyAxKTsKKyAgICAgIH0KKyAgIH0KK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKyAgICBjaGFyIHBhZFs2NF0gX19hdHRyaWJ1dGVfXygoX19hbGlnbmVkX18oNjQpKSk7CisgICAgICAgICAgICAvLyBwYWQgdG8gcHJldmVudCBmYWxzZSBzaGFyaW5nCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmd2Vha19jb3VudF8gKSA9PSAwICkKKyAg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8gKTsKKyAgICAgICAgICAgIGlmKCB0bXAgPT0gMCApIHJldHVybiBmYWxzZTsKKworI2lmIGRlZmluZWQoIEJPT1NUX01TVkMgKSAmJiBCT09TVF9XT1JLQVJPVU5EKCBCT09TVF9NU1ZDLCA9PSAxMjAwICkKKworICAgICAgICAgICAgLy8gd29yayBhcm91bmQgYSBjb2RlIGdlbmVyYXRpb24gYnVnCisKKyAgICAgICAgICAgIGxvbmcgdG1wMiA9IHRtcCArIDE7CisgICAgICAgICAgICBpZiggQk9PU1RfSU5URVJMT0NLRURfQ09NUEFSRV9FWENIQU5HRSggJnVzZV9jb3VudF8sIHRtcDIsIHRtcCApID09IHRtcDIgLSAxICkgcmV0dXJuIHRydWU7CisKKyNlbHNlCisKKyAgICAgICAgICAgIGlmKCBCT09TVF9JTlRFUkxPQ0tFRF9DT01QQVJFX0VYQ0hBTkdFKCAmdXNlX2NvdW50XywgdG1wICsgMSwgdG1wICkgPT0gdG1wICkgcmV0dXJuIHRydWU7CisKKyNlbmRpZgorICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIEJPT1NUX0lOVEVSTE9DS0VEX0RFQ1JFTUVOVCggJnVzZV9jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIEJPT1NUX0lOVEVSTE9DS0VEX0lOQ1JFTUVOVCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggQk9PU1RfSU5URVJMT0NLRURfREVDUkVNRU5UKCAmd2Vha19jb3VudF8gKSA9PSAwICkKKyAgICAgICA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worICAgICAgICBxdWlja19hbGxvY2F0b3I8dGhpc190eXBlPjo6ZGVhbGxvYyggcCApOworICAgIH0KKworI2VuZGlmCit9OworCisvLworLy8gQm9ybGFuZCdzIENvZGVndWFyZCB0cmlwcyB1cCBvdmVyIHRoZSAtVngtIG9wdGlvbiBoZXJlOgorLy8KKyNpZmRlZiBfX0NPREVHVUFSRF9fCisjIHByYWdtYSBvcHRpb24gcHVzaCAtVngtCisjZW5kaWYKKwordGVtcGxhdGU8Y2xhc3MgUCwgY2xhc3MgRD4gY2xhc3Mgc3BfY291bnRlZF9pbXBsX3BkOiBwdWJsaWMgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgUCBwdHI7IC8vIGNvcHkgY29uc3RydWN0b3IgbXVzdCBub3QgdGhyb3cKKyAgICBEIGRlbDsgLy8gY29weSBjb25zdHJ1Y3RvciBtdXN0IG5vdCB0aHJvdworCisgICAgc3BfY291bnRlZF9pbXBsX3BkKCBzcF9jb3VudGVkX2ltcGxfcGQgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfaW1wbF9wZCAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfaW1wbF9wZCBjb25zdCAmICk7CisKKyAgICB0eXBlZGVmIHNwX2NvdW50ZWRfaW1wbF9wZDxQLCBEPiB0aGlzX3R5cGU7CisKK3B1YmxpYzoKKworICAgIC8vIHByZTogZChwKSBtdXN0IG5vdCB0aHJvdworCisgICAgc3BfY291bnRlZF9pbXBsX3BkKCBQIHAsIEQgJiBkICk6IHB0ciggcCApLCBkZWwoIGQgKQorICAgIHsKKyAgICB9CisKKyAgICBzcF9jb3VudGVkX2ltcGxfcGQoIFAgcCApOiBwdHIoIHAgKSwgZGVsKCkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWwoIHB0ciApOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF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TEsIFslMl07IFxuIgorICAgICAgICAgICAgQk9PU1RfU1BfQVJNX0JBUlJJRVIgOgorICAgICAgICAgICAgIj0mciIoIHIgKTogLy8gb3V0cHV0cworICAgICAgICAgICAgInIiKCAxICksICJyIiggJnZfICk6IC8vIGlucHV0cworICAgICAgICAgICAgIm1lbW9yeSIsICJjYyIgKTsKKworI2Vsc2UKKworICAgICAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXygKKyAgICAgICAgICAgICJzd3AgJTAsICUxLCBbJTJdO1xuIgorICAgICAgICAgICAgQk9PU1RfU1BfQVJNX0JBUlJJRVIgOgorICAgICAgICAgICAgIj0mciIoIHIgKTogLy8gb3V0cHV0cworICAgICAgICAgICAgInIiKCAxICksICJyIiggJnZfICk6IC8vIGlucHV0cworICAgICAgICAgICAgIm1lbW9yeSIsICJjYyIgKTsKKworI2VuZGlmCisKKyAgICAgICAgcmV0dXJuIHIgPT0gMDsKKyAgICB9CisKKyAgICB2b2lkIGxvY2soKQorICAgIHsKKyAgICAgICAgZm9yKCB1bnNpZ25lZCBrID0gMDsgIXRyeV9sb2NrKCk7ICsrayApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpkZXRhaWw6OnlpZWxkKCBrICk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHVubG9jaygpCisgICAgeworICAgICAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXyggQk9PU1RfU1BfQVJNX0JBUlJJRVIgOjo6ICJtZW1vcnkiICk7CisgICAgICAgICpjb25zdF9jYXN0PCBpbnQgdm9sYXRpbGUqID4oICZ2XyApID0gMDsKKyAgICB9CisKK3B1YmxpYzoKKworICAgIGNsYXNzIHNjb3BlZF9sb2NrCisgICAgeworICAgIHByaXZhdGU6CisKKyAgICAgICAgc3BpbmxvY2sgJiBzcF87CisKKyAgICAgICAgc2NvcGVkX2xvY2soIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKyAgICAgICAgc2NvcGVkX2xv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Y29tcGlsZXJzIHN1cHBvcnQgI3ByYWdtYSBvbmNlCisKKyNpZiBkZWZpbmVkKF9NU0NfVkVSKSAmJiAoX01TQ19WRVIgPj0gMTAyMCkKKyMgcHJhZ21hIG9uY2UKKyNlbmRpZgorCisvLworLy8gIENvcHlyaWdodCAoYykgMjAwOCBQZXRlciBEaW1vdgorLy8KKy8vICBEaXN0cmlidXRlZCB1bmRlciB0aGUgQm9vc3QgU29mdHdhcmUgTGljZW5zZSwgVmVyc2lvbiAxLjAuCisvLyAgU2VlIGFjY29tcGFueWluZyBmaWxlIExJQ0VOU0VfMV8wLnR4dCBvciBjb3B5IGF0CisvLyAgaHR0cDovL3d3dy5ib29zdC5vcmcvTElDRU5TRV8xXzAudHh0KQorLy8KKworI2luY2x1ZGUgPG5kbmJvb3N0L2Fzc2VydC5ocHA+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2NsYXNzIHNwaW5sb2NrCit7CitwdWJsaWM6CisKKyAgICBib29sIGxvY2tlZF87CisKK3B1YmxpYzoKKworICAgIGlubGluZSBib29sIHRyeV9sb2NrKCkKKyAgICB7CisgICAgICAgIGlmKCBsb2NrZWRfICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgbG9ja2VkXyA9IHRydWU7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGlubGluZSB2b2lkIGxvY2soKQorICAgIHsKKyAgICAgICAgQk9PU1RfQVNTRVJUKCAhbG9ja2VkXyApOworICAgICAgICBsb2NrZWRfID0gdHJ1ZTsKKyAgICB9CisKKyAgICBpbmxpbmUgdm9pZCB1bmxvY2soKQorICAgIHsKKyAgICAgICAgQk9PU1RfQVNTRVJUKCBsb2NrZWRfICk7CisgICAgICAgIGxvY2tlZF8gPSBmYWxzZTsK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wKK3sKKwordGVtcGxhdGU8IGludCBJID4gY2xhc3Mgc3BpbmxvY2tfcG9vbAoreworcHJpdmF0ZToKKworICAgIHN0YXRpYyBzcGlubG9jayBwb29sX1sgNDEgXTsKKworcHVibGljOgorCisgICAgc3RhdGljIHNwaW5sb2NrICYgc3BpbmxvY2tfZm9yKCB2b2lkIGNvbnN0ICogcHYgKQorICAgIHsKKyNpZiBkZWZpbmVkKF9fVk1TKSAmJiBfX0lOSVRJQUxfUE9JTlRFUl9TSVpFID09IDY0ICAKKyAgICAgICAgc3RkOjpzaXplX3QgaSA9IHJlaW50ZXJwcmV0X2Nhc3Q8IHVuc2lnbmVkIGxvbmcgbG9uZyA+KCBwdiApICUgNDE7CisjZWxzZSAgCisgICAgICAgIHN0ZDo6c2l6ZV90IGkgPSByZWludGVycHJldF9jYXN0PCBzdGQ6OnNpemVfdCA+KCBwdiApICUgNDE7CisjZW5kaWYgIAorICAgICAgICByZXR1cm4gcG9vbF9bIGkgXTsKKyAgICB9CisKKyAgICBjbGFzcyBzY29wZWRfbG9jaworICAgIHsKKyAgICBwcml2YXRlOgorCisgICAgICAgIHNwaW5sb2NrICYgc3BfOworCisgICAgICAgIHNjb3BlZF9sb2NrKCBzY29wZWRfbG9jayBjb25zdCAmICk7CisgICAgICAgIHNjb3BlZF9sb2NrICYgb3BlcmF0b3I9KCBzY29wZWRfbG9jayBjb25zdCAmICk7CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgZXhwbGljaXQgc2NvcGVkX2xvY2soIHZvaWQgY29uc3QgKiBwdiApOiBzcF8oIHNwaW5sb2NrX2ZvciggcHYgKSApCisgICAgICAgIHsKKyAgICAgICAgICAgIHNwXy5sb2NrKCk7CisgICAgICAgIH0KKworICAgICAgICB+c2NvcGVkX2xvY2soKQorICAgICAgICB7CisgICAgICAgICAgICBzcF8udW5sb2NrKCk7CisgICAgICAgIH0KKyAgICB9OworfTsKKwordGVtcGxhdGU8IGludCBJID4gc3BpbmxvY2sgc3Bpbm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TF9TUElOTE9DS19QVF9IUFBfSU5DTFVERUQKKyNkZWZpbmUgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUElOTE9DS19QVF9IUFBfSU5DTFVERUQKKworLy8gTVMgY29tcGF0aWJsZSBjb21waWxlcnMgc3VwcG9ydCAjcHJhZ21hIG9uY2UKKworI2lmIGRlZmluZWQoX01TQ19WRVIpICYmIChfTVNDX1ZFUiA+PSAxMDIwKQorIyBwcmFnbWEgb25jZQorI2VuZGlmCisKKy8vCisvLyAgQ29weXJpZ2h0IChjKSAyMDA4IFBldGVyIERpbW92CisvLworLy8gIERpc3RyaWJ1dGVkIHVuZGVyIHRoZSBCb29zdCBTb2Z0d2FyZSBMaWNlbnNlLCBWZXJzaW9uIDEuMC4KKy8vICBTZWUgYWNjb21wYW55aW5nIGZpbGUgTElDRU5TRV8xXzAudHh0IG9yIGNvcHkgYXQKKy8vICBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworCisjaW5jbHVkZSA8cHRocmVhZC5oPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitjbGFzcyBzcGlubG9jaworeworcHVibGljOgorCisgICAgcHRocmVhZF9tdXRleF90IHZfOworCitwdWJsaWM6CisKKyAgICBib29sIHRyeV9sb2NrKCkKKyAgICB7CisgICAgICAgIHJldHVybiBwdGhyZWFkX211dGV4X3RyeWxvY2soICZ2XyApID09IDA7CisgICAgfQorCisgICAgdm9pZCBsb2NrKCkKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJnZfICk7CisgICAgfQorCisgICAgdm9pZCB1bmxvY2soKQorICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soICZ2XyApOworICAgIH0KKworcHVibGljOgorCisgICAgY2xhc3Mgc2NvcGVkX2xvY2sKKyAgICB7CisgICAgcHJpdmF0ZToKKworICAgICAgICBzcGlubG9jayAm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orICAgIH0KKworICAgIHZvaWQgdW5sb2NrKCkKKyAgICB7CisgICAgICAgIF9fc3luY19sb2NrX3JlbGVhc2UoICZ2XyApOworICAgIH0KKworcHVibGljOgorCisgICAgY2xhc3Mgc2NvcGVkX2xvY2sKKyAgICB7CisgICAgcHJpdmF0ZToKKworICAgICAgICBzcGlubG9jayAmIHNwXzsKKworICAgICAgICBzY29wZWRfbG9jayggc2NvcGVkX2xvY2sgY29uc3QgJiApOworICAgICAgICBzY29wZWRfbG9jayAmIG9wZXJhdG9yPSggc2NvcGVkX2xvY2sgY29uc3QgJiApOworCisgICAgcHVibGljOgorCisgICAgICAgIGV4cGxpY2l0IHNjb3BlZF9sb2NrKCBzcGlubG9jayAmIHNwICk6IHNwXyggc3AgKQorICAgICAgICB7CisgICAgICAgICAgICBzcC5sb2NrKCk7CisgICAgICAgIH0KKworICAgICAgICB+c2NvcGVkX2xvY2soKQorICAgICAgICB7CisgICAgICAgICAgICBzcF8udW5sb2NrKCk7CisgICAgICAgIH0KKyAgICB9OworfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZGVmaW5lIEJPT1NUX0RFVEFJTF9TUElOTE9DS19JTklUIHswfQorCisjZW5kaWYgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX1NQSU5MT0NLX1NZTkNfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwaW5sb2NrX3czMi5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwaW5sb2NrX3czMi5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMzkzYjVhMQotLS0gL2Rldi9udWxsCisrKyBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvc3BpbmxvY2tfdzMyLmhwcApAQCAtMCwwICsxLDExMyBAQA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Xcml0ZUJhcnJpZXIoKTsKKworI2VsaWYgZGVmaW5lZChfX0dOVUNfXykKKworI2RlZmluZSBCT09TVF9DT01QSUxFUl9GRU5DRSBfX2FzbV9fIF9fdm9sYXRpbGVfXyggIiIgOiA6IDogIm1lbW9yeSIgKTsKKworI2Vsc2UKKworI2RlZmluZSBCT09TVF9DT01QSUxFUl9GRU5DRQorCisjZW5kaWYKKworLy8KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworY2xhc3Mgc3BpbmxvY2sKK3sKK3B1YmxpYzoKKworICAgIGxvbmcgdl87CisKK3B1YmxpYzoKKworICAgIGJvb2wgdHJ5X2xvY2soKQorICAgIHsKKyAgICAgICAgbG9uZyByID0gQk9PU1RfSU5URVJMT0NLRURfRVhDSEFOR0UoICZ2XywgMSApOworCisgICAgICAgIEJPT1NUX0NPTVBJTEVSX0ZFTkNFCisKKyAgICAgICAgcmV0dXJuIHIgPT0gMDsKKyAgICB9CisKKyAgICB2b2lkIGxvY2soKQorICAgIHsKKyAgICAgICAgZm9yKCB1bnNpZ25lZCBrID0gMDsgIXRyeV9sb2NrKCk7ICsrayApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpkZXRhaWw6OnlpZWxkKCBrICk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHVubG9jaygpCisgICAgeworICAgICAgICBCT09TVF9DT01QSUxFUl9GRU5DRQorICAgICAgICAqY29uc3RfY2FzdDwgbG9uZyB2b2xhdGlsZSogPiggJnZfICkgPSAwOworICAgIH0KKworcHVibGljOgorCisgICAgY2xhc3Mgc2NvcGVkX2xvY2sKKyAgICB7CisgICAgcHJpdmF0ZToKKworICAgICAgICBzcGlubG9jayAmIHNwXzsKKworICAgICAgICBzY29wZWRfbG9jayggc2NvcGVkX2xvY2sgY29uc3QgJiApOworICAgICAgICBzY29wZWRfbG9jayAmIG9wZXJhdG9yPSggc2NvcGVkX2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ZWQoIF9fQ1lHV0lOX18gKQorCisjaWYgZGVmaW5lZCggQk9PU1RfVVNFX1dJTkRPV1NfSCApCisjIGluY2x1ZGUgPHdpbmRvd3MuaD4KKyNlbmRpZgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCisjaWYgIWRlZmluZWQoIEJPT1NUX1VTRV9XSU5ET1dTX0ggKQorICBleHRlcm4gIkMiIHZvaWQgX19zdGRjYWxsIFNsZWVwKCB1bnNpZ25lZCBsb25nIG1zICk7CisjZW5kaWYKKworaW5saW5lIHZvaWQgeWllbGQoIHVuc2lnbmVkIGsgKQoreworICAgIGlmKCBrIDwgNCApCisgICAgeworICAgIH0KKyNpZiBkZWZpbmVkKCBCT09TVF9TTVRfUEFVU0UgKQorICAgIGVsc2UgaWYoIGsgPCAxNiApCisgICAgeworICAgICAgICBCT09TVF9TTVRfUEFVU0UKKyAgICB9CisjZW5kaWYKKyAgICBlbHNlIGlmKCBrIDwgMzIgKQorICAgIHsKKyAgICAgICAgU2xlZXAoIDAgKTsKKyAgICB9CisgICAgZWxzZQorICAgIHsKKyAgICAgICAgU2xlZXAoIDEgKTsKKyAgICB9Cit9CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZWxpZiBkZWZpbmVkKCBCT09TVF9IQVNfUFRIUkVBRFMgKQorCisjaW5jbHVkZSA8c2NoZWQuaD4KKyNpbmNsdWRlIDx0aW1lLmg+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSB2b2lkIHlpZWxkKCB1bnNpZ25lZCBrICkKK3sKKyAgICBpZiggayA8IDQgKQorICAgIHsKKyAgICB9CisjaWYgZGVmaW5lZCggQk9PU1RfU01UX1BBVVNFICkKKyAgICBlbHNlIGlmKCBrIDwgMTYgKQorICAgIHsKKyAgICAgICAgQk9PU1RfU01UX1BBVVNFCisgICAgfQorI2VuZGlmCisgICAgZWxzZSBpZiggayA8IDMyIHx8IGsgJiAxICkKKyAgICB7CisgICAgICAgIHNjaGVkX3lpZWxkKCk7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIC8vIGcrKyAtV2V4dHJhIHdhcm5zIG9uIHt9IG9yIHswfQorICAgICAgICBzdHJ1Y3QgdGltZXNwZWMgcnF0cCA9IHsgMCwgMCB9OworCisgICAgICAgIC8vIFBPU0lYIHNheXMgdGhhdCB0aW1lc3BlYyBoYXMgdHZfc2VjIGFuZCB0dl9uc2VjCisgICAgICAgIC8vIEJ1dCBpdCBkb2Vzbid0IGd1YXJhbnRlZSBvcmRlciBvciBwbGFjZW1lbnQKKworICAgICAgICBycXRwLnR2X3NlYyA9IDA7CisgICAgICAgIHJxdHAudHZfbnNlYyA9IDEwMDA7CisKKyAgICAgICAgbmFub3NsZWVwKCAmcnF0cCwgMCApOworICAgIH0KK30KKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbHNlCisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSB2b2lkIHlpZWxkKCB1bnNpZ25lZCApCit7Cit9CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYKKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9ZSUVMRF9LX0hQUF9JTkNMVURFRAo=