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b25zdF9wb2ludGVyOworICAgICAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBBMjo6cmVmZXJlbmNlICAgICAgIHJlZmVyZW5jZTsKKyAgICAgICAgICAgIHR5cGVkZWYgdHlwZW5hbWUgQTI6OmNvbnN0X3JlZmVyZW5jZSBjb25zdF9yZWZlcmVuY2U7CisgICAgICAgICAgICB0eXBlZGVmIHR5cGVuYW1lIEEyOjpzaXplX3R5cGUgICAgICAgc2l6ZV90eXBlOworICAgICAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBBMjo6ZGlmZmVyZW5jZV90eXBlIGRpZmZlcmVuY2VfdHlwZTsKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFU+CisgICAgICAgICAgICBzdHJ1Y3QgcmViaW5kIHsKKyAgICAgICAgICAgICAgICB0eXBlZGVmIGFsbG9jYXRlX2FycmF5X2hlbHBlcjxBLCBUW10sIFU+IG90aGVyOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGFsbG9jYXRlX2FycmF5X2hlbHBlcihjb25zdCBBJiBhbGxvY2F0b3IsIHN0ZDo6c2l6ZV90IHNpemUsIFQqKiBkYXRhKQorICAgICAgICAgICAgICAgIDogYWxsb2NhdG9yKGFsbG9jYXRvciksCisgICAgICAgICAgICAgICAgICBzaXplKHNpemVvZihUKSAqIHNpemUpLAorICAgICAgICAgICAgICAgICAgZGF0YShkYXRhKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB0ZW1wbGF0ZTxjbGFzcyBVPgorICAgICAgICAgICAgYWxsb2NhdGVfYXJyYXlfaGVscGVyKGNvbnN0IGFsbG9jYXRlX2FycmF5X2hlbHBlcjxBLCBUW10sIFU+JiBvdGhlcikgCisgICAgICAgICAgICAgICAgOiBhbGxvY2F0b3Iob3RoZXIuYWxsb2NhdG9yKSwKKyAgICAgICAgICAgICAgICAgIHNpemUob3RoZXIuc2l6ZSksCisgICAgICAgICAgICAgICAgICBkYXRhKG90aGVyLmRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBvaW50ZXIgYWRkcmVzcyhyZWZlcmVuY2UgdmFsdWUpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWxsb2NhdG9yLmFkZHJlc3ModmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3RfcG9pbnRlciBhZGRyZXNzKGNvbnN0X3JlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IuYWRkcmVzcyh2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzaXplX3R5cGUgbWF4X3NpemUoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFsbG9jYXRvci5tYXhfc2l6ZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9pbnRlciBhbGxvY2F0ZShzaXplX3R5cGUgY291bnQsIGNvbnN0IHZvaWQqIHZhbHVlID0gMCkgeworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGExID0gbmRuYm9vc3Q6OmFsaWdubWVudF9vZjxUPjo6dmFsdWU7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgbjEgPSBjb3VudCAqIHNpemVvZihZKSArIGExIC0gMTsKKyAgICAgICAgICAgICAgICBjaGFyKiAgcDEgPSBBMyhhbGxvY2F0b3IpLmFsbG9jYXRlKG4xICsgc2l6ZSwgdmFsdWUpOworICAgICAgICAgICAgICAgIGNoYXIqICBwMiA9IHAxICsgbjE7CisgICAgICAgICAgICAgICAgd2hpbGUgKHN0ZDo6c2l6ZV90KHAyKSAlIGExICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcDItLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgKmRhdGEgPSByZWludGVycHJldF9jYXN0PFQqPihwMik7CisgICAgICAgICAgICAgICAgcmV0dXJuICByZWludGVycHJldF9jYXN0PFkqPihwMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlYWxsb2NhdGUocG9pbnRlciBtZW1vcnksIHNpemVfdHlwZSBjb3VudCkgeworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGExID0gbmRuYm9vc3Q6OmFsaWdubWVudF9vZjxUPjo6dmFsdWU7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgbjEgPSBjb3VudCAqIHNpemVvZihZKSArIGExIC0gMTsKKyAgICAgICAgICAgICAgICBjaGFyKiAgcDEgPSByZWludGVycHJldF9jYXN0PGNoYXIqPihtZW1vcnkpOworICAgICAgICAgICAgICAgIEEzKGFsbG9jYXRvcikuZGVhbGxvY2F0ZShwMSwgbjEgKyBzaXplKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgY29uc3RydWN0KHBvaW50ZXIgbWVtb3J5LCBjb25zdCBZJiB2YWx1ZSkgeworICAgICAgICAgICAgICAgIGFsbG9jYXRvci5jb25zdHJ1Y3QobWVtb3J5LCB2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlc3Ryb3kocG9pbnRlciBtZW1vcnkpIHsKKyAgICAgICAgICAgICAgICBhbGxvY2F0b3IuZGVzdHJveShtZW1vcnkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3I9PShjb25zdCBhbGxvY2F0ZV9hcnJheV9oZWxwZXI8QSwgVFtdLCBVPiYgb3RoZXIpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWxsb2NhdG9yID09IG90aGVyLmFsbG9jYXRvcjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFU+CisgICAgICAgICAgICBib29sIG9wZXJhdG9yIT0oY29uc3QgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRb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B0eXBlbmFtZSBBMjo6Y29uc3RfcmVmZXJlbmNlIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgICAgICAgIHR5cGVkZWYgdHlwZW5hbWUgQTI6OnNpemVfdHlwZSAgICAgICBzaXplX3R5cGU7CisgICAgICAgICAgICB0eXBlZGVmIHR5cGVuYW1lIEEyOjpkaWZmZXJlbmNlX3R5cGUgZGlmZmVyZW5jZV90eXBlOworICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIHN0cnVjdCByZWJpbmQgeworICAgICAgICAgICAgICAgIHR5cGVkZWYgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRbTl0sIFU+IG90aGVyOworICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGFsbG9jYXRlX2FycmF5X2hlbHBlcihjb25zdCBBJiBhbGxvY2F0b3IsIFQqKiBkYXRhKQorICAgICAgICAgICAgICAgIDogYWxsb2NhdG9yKGFsbG9jYXRvciksCisgICAgICAgICAgICAgICAgICBkYXRhKGRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPGNsYXNzIFU+CisgICAgICAgICAgICBhbGxvY2F0ZV9hcnJheV9oZWxwZXIoY29uc3QgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRbTl0sIFU+JiBvdGhlcikgCisgICAgICAgICAgICAgICAgOiBhbGxvY2F0b3Iob3RoZXIuYWxsb2NhdG9yKSwKKyAgICAgICAgICAgICAgICAgIGRhdGEob3RoZXIuZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9pbnRlciBhZGRyZXNzKHJlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IuYWRkcmVzcyh2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjb25zdF9wb2ludGVyIGFkZHJlc3MoY29uc3RfcmVmZXJlbmNlIHZhbHVlKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFsbG9jYXRvci5hZGRyZXNzKHZhbHVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNpemVfdHlwZSBtYXhfc2l6ZSgpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWxsb2NhdG9yLm1heF9zaXplKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFsbG9jYXRlKHNpemVfdHlwZSBjb3VudCwgY29uc3Qgdm9pZCogdmFsdWUgPSAwKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIGNoYXIqICBwMSA9IEEzKGFsbG9jYXRvcikuYWxsb2NhdGUobjEgKyBOMSwgdmFsdWUpOworICAgICAgICAgICAgICAgIGNoYXIqICBwMiA9IHAxICsgbjE7CisgICAgICAgICAgICAgICAgd2hpbGUgKHN0ZDo6c2l6ZV90KHAyKSAlIGExICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcDItLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgKmRhdGEgPSByZWludGVycHJldF9jYXN0PFQqPihwMik7CisgICAgICAgICAgICAgICAgcmV0dXJuICByZWludGVycHJldF9jYXN0PFkqPihwMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGRlYWxsb2NhdGUocG9pbnRlciBtZW1vcnksIHNpemVfdHlwZSBjb3VudCkgeworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGExID0gbmRuYm9vc3Q6OmFsaWdubWVudF9vZjxUPjo6dmFsdWU7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgbjEgPSBjb3VudCAqIHNpemVvZihZKSArIGExIC0gMTsKKyAgICAgICAgICAgICAgICBjaGFyKiAgcDEgPSByZWludGVycHJldF9jYXN0PGNoYXIqPihtZW1vcnkpOworICAgICAgICAgICAgICAgIEEzKGFsbG9jYXRvcikuZGVhbGxvY2F0ZShwMSwgbjEgKyBOMSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGNvbnN0cnVjdChwb2ludGVyIG1lbW9yeSwgY29uc3QgWSYgdmFsdWUpIHsKKyAgICAgICAgICAgICAgICBhbGxvY2F0b3IuY29uc3RydWN0KG1lbW9yeSwgdmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBkZXN0cm95KHBvaW50ZXIgbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgYWxsb2NhdG9yLmRlc3Ryb3kobWVtb3J5KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFU+CisgICAgICAgICAgICBib29sIG9wZXJhdG9yPT0oY29uc3QgYWxsb2NhdGVfYXJyYXlfaGVscGVyPEEsIFRbTl0sIFU+JiBvdGhlcikgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBhbGxvY2F0b3IgPT0gb3RoZXIuYWxsb2NhdG9yOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3IhPShjb25zdCBhbGxvY2F0ZV9hcnJheV9oZWxwZXI8QSwgVFtOXSwgVT4mIG90aGVyKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuICEoKnRoaXMgPT0gb3RoZXIpOyAKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIGVudW0geworICAgICAgICAgICAgICAgIE4xID0gTiAqIHNpemVvZihUKQorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIEEyIGFsbG9jYXRvcjsK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AgICAgY2xhc3MgYXJyYXlfZGVsZXRlcjsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgY2xhc3MgYXJyYXlfZGVsZXRlcjxUW10+IHsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgYXJyYXlfZGVsZXRlcihzdGQ6OnNpemVfdCBzaXplKQorICAgICAgICAgICAgICAgIDogc2l6ZShzaXplKSwKKyAgICAgICAgICAgICAgICAgIG9iamVjdCgwKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB+YXJyYXlfZGVsZXRlcigpIHsKKyAgICAgICAgICAgICAgICBpZiAob2JqZWN0KSB7CisgICAgICAgICAgICAgICAgICAgIGFycmF5X2Rlc3Ryb3kob2JqZWN0LCBzaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGluaXQoVCogbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdChtZW1vcnksIHNpemUpOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUykKKyAgICAgICAgICAgIHZvaWQgaW5pdChUKiBtZW1vcnksIFQmJiB2YWx1ZSkgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfdmFsdWUobWVtb3J5LCBzaXplLCBzcF9mb3J3YXJkPFQ+KHZhbHVlKSk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9WQVJJQURJQ19URU1QTEFURVMpCisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBBcmdzPgorICAgICAgICAgICAgdm9pZCBpbml0KFQqIG1lbW9yeSwgQXJncyYmLi4uIGFyZ3MpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0X2FyZ3MobWVtb3J5LCBzaXplLCBzcF9mb3J3YXJkPEFyZ3M+KGFyZ3MpLi4uKTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyNlbmRpZgorICAgICAgICAgICAgdm9pZCBpbml0X2xpc3QoVCogbWVtb3J5LCBjb25zdCBUKiBsaXN0KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF9saXN0KG1lbW9yeSwgc2l6ZSwgbGlzdCk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8c3RkOjpzaXplX3QgTT4KKyAgICAgICAgICAgIHZvaWQgaW5pdF9saXN0KFQqIG1lbW9yeSwgY29uc3QgVCogbGlzdCkgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfbGlzdDxULCBNPihtZW1vcnksIHNpemUsIGxpc3QpOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgbm9pbml0KFQqIG1lbW9yeSkgeworICAgICAgICAgICAgICAgIGFycmF5X25vaW5pdChtZW1vcnksIHNpemUpOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgb3BlcmF0b3IoKShjb25zdCB2b2lkKikgeworICAgICAgICAgICAgICAgIGlmIChvYmplY3QpIHsKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShvYmplY3QsIHNpemUpOworICAgICAgICAgICAgICAgICAgICBvYmplY3QgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IHNpemU7CisgICAgICAgICAgICBUKiBvYmplY3Q7CisgICAgICAgIH07CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHN0ZDo6c2l6ZV90IE4+CisgICAgICAgIGNsYXNzIGFycmF5X2RlbGV0ZXI8VFtOXT4geworICAgICAgICBwdWJsaWM6CisgICAgICAgICAgICBhcnJheV9kZWxldGVyKCkKKyAgICAgICAgICAgICAgICA6IG9iamVjdCgwKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB+YXJyYXlfZGVsZXRlcigpIHsKKyAgICAgICAgICAgICAgICBpZiAob2JqZWN0KSB7CisgICAgICAgICAgICAgICAgICAgIGFycmF5X2Rlc3Ryb3kob2JqZWN0LCBOKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICB2b2lkIGluaXQoVCogbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdChtZW1vcnksIE4pOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUykKKyAgICAgICAgICAgIHZvaWQgaW5pdChUKiBtZW1vcnksIFQmJiB2YWx1ZSkgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfdmFsdWUobWVtb3J5LCBOLCBzcF9mb3J3YXJkPFQ+KHZhbHVlKSk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9WQVJJQURJQ19URU1QTEFURVMpCisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZS4uLiBBcmdzPgorICAgICAgICAgICAgdm9pZCBpbml0KFQqIG1lbW9yeSwgQXJncyYmLi4uIGFyZ3MpIHsKKyAgICAgICAgICAgICAgICBhcnJheV9pbml0X2FyZ3MobWVtb3J5LCBOLCBzcF9mb3J3YXJkPEFyZ3M+KGFyZ3MpLi4uKTsKKyAgICAgICAgICAgICAgICBvYmplY3QgPSBtZW1vcnk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyNlbmRpZgorICAgICAgICAgICAgdm9pZCBpbml0X2xpc3QoVCogbWVtb3J5LCBjb25zdCBUKiBsaXN0KSB7CisgICAgICAgICAgICAgICAgYXJyYXlfaW5pdF9saXN0KG1lbW9yeSwgTiwgbGlzdCk7CisgICAgICAgICAgICAgICAgb2JqZWN0ID0gbWVtb3J5OworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8c3RkOjpzaXplX3QgTT4KKyAgICAgICAgICAgIHZvaWQgaW5pdF9saXN0KFQqIG1lbW9yeSwgY29uc3QgVCogbGlzdCkgeworICAgICAgICAgICAgICAgIGFycmF5X2luaXRfbGlzdDxULCBNPihtZW1vcnksIE4sIGxpc3QpOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgbm9pbml0KFQqIG1lbW9yeSkgeworICAgICAgICAgICAgICAgIGFycmF5X25vaW5pdChtZW1vcnksIE4pOworICAgICAgICAgICAgICAgIG9iamVjdCA9IG1lbW9yeTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgb3BlcmF0b3IoKShjb25zdCB2b2lkKikgeworICAgICAgICAgICAgICAgIGlmIChvYmplY3QpIHsKKyAgICAgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShvYmplY3QsIE4pOworICAgICAgICAgICAgICAgICAgICBvYmplY3QgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIFQqIG9iamVjdDsKKyAgICAgICAgfTsKKyAgICB9Cit9CisKKyNlbmRpZgpkaWZmIC0tZ2l0IGEvbmRuYm9vc3Qvc21hcnRfcHRyL2Rld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Jhc2U8VFtdPiB7CisgICAgICAgICAgICB0eXBlZGVmIHR5cGVuYW1lIGFycmF5X2Jhc2U8VD46OnR5cGUgdHlwZTsKKyAgICAgICAgfTsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgc3RkOjpzaXplX3QgTj4KKyAgICAgICAgc3RydWN0IGFycmF5X2Jhc2U8VFtOXT4geworICAgICAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBhcnJheV9iYXNlPFQ+Ojp0eXBlIHR5cGU7CisgICAgICAgIH07CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIHN0cnVjdCBhcnJheV90b3RhbCB7CisgICAgICAgICAgICBlbnVtIHsKKyAgICAgICAgICAgICAgICBzaXplID0gMQorICAgICAgICAgICAgfTsKKyAgICAgICAgfTsKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVCwgc3RkOjpzaXplX3QgTj4KKyAgICAgICAgc3RydWN0IGFycmF5X3RvdGFsPFRbTl0+IHsKKyAgICAgICAgICAgIGVudW0geworICAgICAgICAgICAgICAgIHNpemUgPSBOICogYXJyYXlfdG90YWw8VD46OnNpemUKKyAgICAgICAgICAgIH07CisgICAgICAgIH07CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+IAorICAgICAgICBzdHJ1Y3QgYXJyYXlfaW5uZXI7CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIHN0cnVjdCBhcnJheV9pbm5lcjxUW10+IHsKKyAgICAgICAgICAgIHR5cGVkZWYgVCB0eXBlOworICAgICAgICB9OworICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBULCBzdGQ6OnNpemVfdCBOPgorICAgICAgICBzdHJ1Y3QgYXJyYXlfaW5uZXI8VFtOXT4geworICAgICAgICAgICAgdHlwZWRlZiBUIHR5cGU7CisgICAgICAgIH07CisgICAgfQorfQorCisjZW5kaWYKZGlmZiAtLWdpdCBhL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RuYm9vc3Q6OmZhbHNlX3R5cGUpIHsKKyNpZiAhZGVmaW5lZChCT09TVF9OT19FWENFUFRJT05TKQorICAgICAgICAgICAgc3RkOjpzaXplX3QgaSA9IDA7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZvciAoOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG1lbW9yeSwgaSk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVCgpOworICAgICAgICAgICAgfQorI2VuZGlmCisgICAgICAgIH0KKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgaW5saW5lIHZvaWQgYXJyYXlfaW5pdChUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUpIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpoYXNfdHJpdmlhbF9kZWZhdWx0X2NvbnN0cnVjdG9yPFQ+IHR5cGU7ICAgICAgICAgICAgCisgICAgICAgICAgICBhcnJheV9pbml0KG1lbW9yeSwgc2l6ZSwgdHlwZSk7CisgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUykKKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgaW5saW5lIHZvaWQgYXJyYXlfaW5pdF92YWx1ZShUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUsIFQmJiB2YWx1ZSkgeworI2lmICFkZWZpbmVkKEJPT1NUX05PX0VYQ0VQVElPTlMpCisgICAgICAgICAgICBzdGQ6OnNpemVfdCBpID0gMDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZm9yICg7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVCh2YWx1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoLi4uKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShtZW1vcnksIGkpOworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgICAgIGZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQodmFsdWUpOworICAgICAgICAgICAgfQorI2VuZGlmCisgICAgICAgIH0KKyNpZiAhZGVmaW5lZChCT09TVF9OT19DWFgxMV9WQVJJQURJQ19URU1QTEFURVMpCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHR5cGVuYW1lLi4uIEFyZ3M+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2luaXRfYXJncyhUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUsIEFyZ3MmJi4uLiBhcmdzKSB7CisjaWYgIWRlZmluZWQoQk9PU1RfTk9fRVhDRVBUSU9OUykKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGkgPSAwOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBmb3IgKDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKGFyZ3MuLi4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gY2F0Y2ggKC4uLikgeworICAgICAgICAgICAgICAgIGFycmF5X2Rlc3Ryb3kobWVtb3J5LCBpKTsKKyAgICAgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgICAgIH0KKyNlbHNlCisgICAgICAgICAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnkgKyBpOworICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKGFyZ3MuLi4pOworICAgICAgICAgICAgfQorI2VuZGlmCisgICAgICAgIH0KKyNlbmRpZgorI2VuZGlmCisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CisgICAgICAgIGlubGluZSB2b2lkIGFycmF5X2luaXRfbGlzdChUKiBtZW1vcnksIHN0ZDo6c2l6ZV90IHNpemUsIGNvbnN0IFQqIGxpc3QpIHsKKyNpZiAhZGVmaW5lZChCT09TVF9OT19FWENFUFRJT05TKQorICAgICAgICAgICAgc3RkOjpzaXplX3QgaSA9IDA7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZvciAoOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQobGlzdFtpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoLi4uKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShtZW1vcnksIGkpOworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgICAgIGZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQobGlzdFtpXSk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBULCBzdGQ6OnNpemVfdCBOPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9pbml0X2xpc3QoVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplLCBjb25zdCBUKiBsaXN0KSB7CisjaWYgIWRlZmluZWQoQk9PU1RfTk9fRVhDRVBUSU9OUykKKyAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGkgPSAwOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBmb3IgKDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgICAgIDo6bmV3KHAxKSBUKGxpc3RbaSAlIE5dKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoICguLi4pIHsKKyAgICAgICAgICAgICAgICBhcnJheV9kZXN0cm95KG1lbW9yeSwgaSk7CisgICAgICAgICAgICAgICAgdGhyb3c7CisgICAgICAgICAgICB9CisjZWxzZQorICAgICAgICAgICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICA6Om5ldyhwMSkgVChsaXN0W2kgJSBOXSk7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9ub2luaXQoVCosIHN0ZDo6c2l6ZV90LCBuZG5ib29zdDo6dHJ1ZV90eXBlKSB7CisgICAgICAgIH0KKyAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KKyAgICAgICAgaW5saW5lIHZvaWQgYXJyYXlfbm9pbml0KFQqIG1lbW9yeSwgc3RkOjpzaXplX3Qgc2l6ZSwgbmRuYm9vc3Q6OmZhbHNlX3R5cGUpIHsKKyNpZiAhZGVmaW5lZChCT09TVF9OT19FWENFUFRJT05TKQorICAgICAgICAgICAgc3RkOjpzaXplX3QgaSA9IDA7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGZvciAoOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHZvaWQqIHAxID0gbWVtb3J5ICsgaTsKKyAgICAgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoLi4uKSB7CisgICAgICAgICAgICAgICAgYXJyYXlfZGVzdHJveShtZW1vcnksIGkpOworICAgICAgICAgICAgICAgIHRocm93OworICAgICAgICAgICAgfQorI2Vsc2UKKyAgICAgICAgICAgIGZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICB2b2lkKiBwMSA9IG1lbW9yeSArIGk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFQ7CisgICAgICAgICAgICB9CisjZW5kaWYKKyAgICAgICAgfQorICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgorICAgICAgICBpbmxpbmUgdm9pZCBhcnJheV9ub2luaXQoVCogbWVtb3J5LCBzdGQ6OnNpemVfdCBzaXplKSB7CisgICAgICAgICAgICBuZG5ib29zdDo6aGFzX3RyaXZpYWxfZGVmYXVsdF9jb25zdHJ1Y3RvcjxUPiB0eXBlOworICAgICAgICAgICAgYXJyYXlfbm9pbml0KG1lbW9yeSwgc2l6ZSwgdHlwZS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VudAoreworcHVibGljOgorCisgICAgZXhwbGljaXQgYXRvbWljX2NvdW50KCBsb25nIHYgKSA6IHZhbHVlXyggdiApIHt9CisKKyAgICBsb25nIG9wZXJhdG9yKysoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIF9fZXhjaGFuZ2VfYW5kX2FkZCggJnZhbHVlXywgKzEgKSArIDE7CisgICAgfQorCisgICAgbG9uZyBvcGVyYXRvci0tKCkKKyAgICB7CisgICAgICAgIHJldHVybiBfX2V4Y2hhbmdlX2FuZF9hZGQoICZ2YWx1ZV8sIC0xICkgLSAxOworICAgIH0KKworICAgIG9wZXJhdG9yIGxvbmcoKSBjb25zdAorICAgIHsKKyAgICAgICAgcmV0dXJuIF9fZXhjaGFuZ2VfYW5kX2FkZCggJnZhbHVlXywgMCApOworICAgIH0KKworcHJpdmF0ZToKKworICAgIGF0b21pY19jb3VudChhdG9taWNfY291bnQgY29uc3QgJik7CisgICAgYXRvbWljX2NvdW50ICYgb3BlcmF0b3I9KGF0b21pY19jb3VudCBjb25zdCAmKTsKKworICAgIG11dGFibGUgX0F0b21pY193b3JkIHZhbHVlXzsKK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX0FUT01JQ19DT1VOVF9HQ0NfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2F0b21pY19jb3VudF9nY2NfeDg2LmhwcCBiL25kbmJvb3N0L3NtYXJ0X3B0ci9kZXRhaWwvYXRvbWljX2NvdW50X2djY194ODYuaHBwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjY2NGEyYjkKLS0tIC9kZXYvbnVsbAorKysgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2F0b21pY19jb3VudF9nY2NfeDg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uc3QKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggJnZhbHVlXywgMCApOworICAgIH0KKworcHJpdmF0ZToKKworICAgIGF0b21pY19jb3VudChhdG9taWNfY291bnQgY29uc3QgJik7CisgICAgYXRvbWljX2NvdW50ICYgb3BlcmF0b3I9KGF0b21pY19jb3VudCBjb25zdCAmKTsKKworICAgIG11dGFibGUgaW50IHZhbHVlXzsKKworcHJpdmF0ZToKKworICAgIHN0YXRpYyBpbnQgYXRvbWljX2V4Y2hhbmdlX2FuZF9hZGQoIGludCAqIHB3LCBpbnQgZHYgKQorICAgIHsKKyAgICAgICAgLy8gaW50IHIgPSAqcHc7CisgICAgICAgIC8vICpwdyArPSBkdjsKKyAgICAgICAgLy8gcmV0dXJuIHI7CisKKyAgICAgICAgaW50IHI7CisKKyAgICAgICAgX19hc21fXyBfX3ZvbGF0aWxlX18KKyAgICAgICAgKAorICAgICAgICAgICAgImxvY2tcblx0IgorICAgICAgICAgICAgInhhZGQgJTEsICUwIjoKKyAgICAgICAgICAgICIrbSIoICpwdyApLCAiPXIiKCByICk6IC8vIG91dHB1dHMgKCUwLCAlMSkKKyAgICAgICAgICAgICIxIiggZHYgKTogLy8gaW5wdXRzICglMiA9PSAlMSkKKyAgICAgICAgICAgICJtZW1vcnkiLCAiY2MiIC8vIGNsb2JiZXJzCisgICAgICAgICk7CisKKyAgICAgICAgcmV0dXJuIHI7CisgICAgfQorfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbmRpZiAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfQVRPTUlDX0NPVU5UX0dDQ19YODZfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2F0b21pY19jb3VudF9wdGhyZWFkcy5ocHAgYi9uZG5ib29zdC9z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BkZXRlY3QgdGhpcyBzaXR1YXRpb24gYnkgY2hlY2tpbmcgQk9PU1RfQUNfVVNFX1BUSFJFQURTLgorLy8KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworY2xhc3MgYXRvbWljX2NvdW50Cit7Citwcml2YXRlOgorCisgICAgY2xhc3Mgc2NvcGVkX2xvY2sKKyAgICB7CisgICAgcHVibGljOgorCisgICAgICAgIHNjb3BlZF9sb2NrKHB0aHJlYWRfbXV0ZXhfdCAmIG0pOiBtXyhtKQorICAgICAgICB7CisgICAgICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soJm1fKTsKKyAgICAgICAgfQorCisgICAgICAgIH5zY29wZWRfbG9jaygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCZtXyk7CisgICAgICAgIH0KKworICAgIHByaXZhdGU6CisKKyAgICAgICAgcHRocmVhZF9tdXRleF90ICYgbV87CisgICAgfTsKKworcHVibGljOgorCisgICAgZXhwbGljaXQgYXRvbWljX2NvdW50KGxvbmcgdik6IHZhbHVlXyh2KQorICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF9pbml0KCZtdXRleF8sIDApOworICAgIH0KKworICAgIH5hdG9taWNfY291bnQoKQorICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF9kZXN0cm95KCZtdXRleF8pOworICAgIH0KKworICAgIGxvbmcgb3BlcmF0b3IrKygpCisgICAgeworICAgICAgICBzY29wZWRfbG9jayBsb2NrKG11dGV4Xyk7CisgICAgICAgIHJldHVybiArK3ZhbHVlXzsKKyAgICB9CisKKyAgICBsb25nIG9wZXJhdG9yLS0oKQorICAgIHsKKyAgICAgICAgc2NvcGVkX2xvY2sgbG9jayhtdXRleF8pOworICAgICAgICByZXR1cm4gLS12YWx1ZV87CisgICAgfQorCisgICAgb3BlcmF0b3IgbG9uZygpIGNvbnN0CisgICAgeworICAgICAgIC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jcy9nY2MtNC4xLjEvZ2NjL0F0b21pYy1CdWlsdGlucy5odG1sCisvLworLy8gIENvcHlyaWdodCAyMDA3IFBldGVyIERpbW92CisvLworLy8gIERpc3RyaWJ1dGVkIHVuZGVyIHRoZSBCb29zdCBTb2Z0d2FyZSBMaWNlbnNlLCBWZXJzaW9uIDEuMC4gKFNlZQorLy8gIGFjY29tcGFueWluZyBmaWxlIExJQ0VOU0VfMV8wLnR4dCBvciBjb3B5IGF0CisvLyAgaHR0cDovL3d3dy5ib29zdC5vcmcvTElDRU5TRV8xXzAudHh0KQorLy8KKworI2lmIGRlZmluZWQoIF9faWE2NF9fICkgJiYgZGVmaW5lZCggX19JTlRFTF9DT01QSUxFUiApCisjIGluY2x1ZGUgPGlhNjRpbnRyaW4uaD4KKyNlbmRpZgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitjbGFzcyBhdG9taWNfY291bnQKK3sKK3B1YmxpYzoKKworICAgIGV4cGxpY2l0IGF0b21pY19jb3VudCggbG9uZyB2ICkgOiB2YWx1ZV8oIHYgKSB7fQorCisgICAgbG9uZyBvcGVyYXRvcisrKCkKKyAgICB7CisgICAgICAgIHJldHVybiBfX3N5bmNfYWRkX2FuZF9mZXRjaCggJnZhbHVlXywgMSApOworICAgIH0KKworICAgIGxvbmcgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgICByZXR1cm4gX19zeW5jX2FkZF9hbmRfZmV0Y2goICZ2YWx1ZV8sIC0xICk7CisgICAgfQorCisgICAgb3BlcmF0b3IgbG9uZygpIGNvbnN0CisgICAgeworICAgICAgICByZXR1cm4gX19zeW5jX2ZldGNoX2FuZF9hZGQoICZ2YWx1ZV8sIDAgKTsKKyAgICB9CisKK3ByaXZhdGU6CisKKyAgICBhdG9taWNfY291bnQoYXRvbWljX2NvdW50IGNvbnN0ICYpOworICAgIGF0b21pY19jb3VudCAmIG9wZXJhdG9yPShhdG9taWNfY291bnQgY29uc3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UKKy8vIGFjY29tcGFueWluZyBmaWxlIExJQ0VOU0VfMV8wLnR4dCBvciBjb3B5IGF0CisvLyBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL2ludGVybG9ja2VkLmhwcD4KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworY2xhc3MgYXRvbWljX2NvdW50Cit7CitwdWJsaWM6CisKKyAgICBleHBsaWNpdCBhdG9taWNfY291bnQoIGxvbmcgdiApOiB2YWx1ZV8oIHYgKQorICAgIHsKKyAgICB9CisKKyAgICBsb25nIG9wZXJhdG9yKysoKQorICAgIHsKKyAgICAgICAgcmV0dXJuIEJPT1NUX0lOVEVSTE9DS0VEX0lOQ1JFTUVOVCggJnZhbHVlXyApOworICAgIH0KKworICAgIGxvbmcgb3BlcmF0b3ItLSgpCisgICAgeworICAgICAgICByZXR1cm4gQk9PU1RfSU5URVJMT0NLRURfREVDUkVNRU5UKCAmdmFsdWVfICk7CisgICAgfQorCisgICAgb3BlcmF0b3IgbG9uZygpIGNvbnN0CisgICAgeworICAgICAgICByZXR1cm4gc3RhdGljX2Nhc3Q8bG9uZyBjb25zdCB2b2xhdGlsZSAmPiggdmFsdWVfICk7CisgICAgfQorCitwcml2YXRlOgorCisgICAgYXRvbWljX2NvdW50KCBhdG9taWNfY291bnQgY29uc3QgJiApOworICAgIGF0b21pY19jb3VudCAmIG9wZXJhdG9yPSggYXRvbWljX2NvdW50IGNvbnN0ICYgKTsKKworICAgIGxvbmcgdmFsdWVfOworfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbmRpZiAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfQVRPTUlDX0NPVU5UX1dJTjMyX0hQUF9JTkNMVURFRAp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EJPT1NUX1ZFUklGWSggcHRocmVhZF9tdXRleF9kZXN0cm95KCAmbV8gKSA9PSAwICk7CisgICAgfQorCisgICAgY2xhc3Mgc2NvcGVkX2xvY2s7CisgICAgZnJpZW5kIGNsYXNzIHNjb3BlZF9sb2NrOworCisgICAgY2xhc3Mgc2NvcGVkX2xvY2sKKyAgICB7CisgICAgcHJpdmF0ZToKKworICAgICAgICBwdGhyZWFkX211dGV4X3QgJiBtXzsKKworICAgICAgICBzY29wZWRfbG9jayhzY29wZWRfbG9jayBjb25zdCAmKTsKKyAgICAgICAgc2NvcGVkX2xvY2sgJiBvcGVyYXRvcj0oc2NvcGVkX2xvY2sgY29uc3QgJik7CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgc2NvcGVkX2xvY2sobGlnaHR3ZWlnaHRfbXV0ZXggJiBtKTogbV8obS5tXykKKyAgICAgICAgeworICAgICAgICAgICAgQk9PU1RfVkVSSUZZKCBwdGhyZWFkX211dGV4X2xvY2soICZtXyApID09IDAgKTsKKyAgICAgICAgfQorCisgICAgICAgIH5zY29wZWRfbG9jaygpCisgICAgICAgIHsKKyAgICAgICAgICAgIEJPT1NUX1ZFUklGWSggcHRocmVhZF9tdXRleF91bmxvY2soICZtXyApID09IDAgKTsKKyAgICAgICAgfQorICAgIH07Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9MV01fUFRIUkVBRFNfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2x3bV93aW4zMl9jcy5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL2x3bV93aW4zMl9jcy5ocHAKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uZTk3NmMzMgotLS0gL2Rldi9udWx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gICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUMiwgdHlwZW5hbWUgWTI+CisgICAgICAgICAgICBmcmllbmQgY2xhc3MgbWFrZV9hcnJheV9oZWxwZXI7CisgICAgICAgIHB1YmxpYzoKKyAgICAgICAgICAgIHR5cGVkZWYgWSAgICAgICAgICAgdmFsdWVfdHlwZTsKKyAgICAgICAgICAgIHR5cGVkZWYgWSogICAgICAgICAgcG9pbnRlcjsKKyAgICAgICAgICAgIHR5cGVkZWYgY29uc3QgWSogICAgY29uc3RfcG9pbnRlcjsKKyAgICAgICAgICAgIHR5cGVkZWYgWSYgICAgICAgICAgcmVmZXJlbmNlOworICAgICAgICAgICAgdHlwZWRlZiBjb25zdCBZJiAgICBjb25zdF9yZWZlcmVuY2U7CisgICAgICAgICAgICB0eXBlZGVmIHN0ZDo6c2l6ZV90IHNpemVfdHlwZTsKKyAgICAgICAgICAgIHR5cGVkZWYgcHRyZGlmZl90ICAgZGlmZmVyZW5jZV90eXBlOworICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIHN0cnVjdCByZWJpbmQgeworICAgICAgICAgICAgICAgIHR5cGVkZWYgbWFrZV9hcnJheV9oZWxwZXI8VFtdLCBVPiBvdGhlcjsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBtYWtlX2FycmF5X2hlbHBlcihzdGQ6OnNpemVfdCBzaXplLCBUKiogZGF0YSkKKyAgICAgICAgICAgICAgICA6IHNpemUoc2l6ZW9mKFQpICogc2l6ZSksCisgICAgICAgICAgICAgICAgICBkYXRhKGRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPGNsYXNzIFU+CisgICAgICAgICAgICBtYWtlX2FycmF5X2hlbHBlcihjb25zdCBtYWtlX2FycmF5X2hlbHBlcjxUW10sIFU+JiBvdGhlcikgCisgICAgICAgICAgICAgICAgOiBzaXplKG90aGVyLnNpemUpLAorICAgICAgICAgICAgICAgICAgZGF0YShvdGhlci5kYXRhKSB7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFkZHJlc3MocmVmZXJlbmNlIHZhbHVlKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuICZ2YWx1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbnN0X3BvaW50ZXIgYWRkcmVzcyhjb25zdF9yZWZlcmVuY2UgdmFsdWUpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gJnZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2l6ZV90eXBlIG1heF9zaXplKCkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiBzdGF0aWNfY2FzdDxzdGQ6OnNpemVfdD4oLTEpIC8gc2l6ZW9mKFkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcG9pbnRlciBhbGxvY2F0ZShzaXplX3R5cGUgY291bnQsIGNvbnN0IHZvaWQqID0gMCkgeworICAgICAgICAgICAgICAgIHN0ZDo6c2l6ZV90IGExID0gbmRuYm9vc3Q6OmFsaWdubWVudF9vZjxUPjo6dmFsdWU7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgbjEgPSBjb3VudCAqIHNpemVvZihZKSArIGExIC0gMTsKKyAgICAgICAgICAgICAgICB2b2lkKiAgcDEgPSA6Om9wZXJhdG9yIG5ldyhuMSArIHNpemUpOworICAgICAgICAgICAgICAgIGNoYXIqICBwMiA9IHN0YXRpY19jYXN0PGNoYXIqPihwMSkgKyBuMTsKKyAgICAgICAgICAgICAgICB3aGlsZSAoc3RkOjpzaXplX3QocDIpICUgYTEgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBwMi0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAqZGF0YSA9IHJlaW50ZXJwcmV0X2Nhc3Q8VCo+KHAyKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gIHJlaW50ZXJwcmV0X2Nhc3Q8WSo+KHAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgZGVhbGxvY2F0ZShwb2ludGVyIG1lbW9yeSwgc2l6ZV90eXBlKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnk7CisgICAgICAgICAgICAgICAgOjpvcGVyYXRvciBkZWxldGUocDEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBjb25zdHJ1Y3QocG9pbnRlciBtZW1vcnksIGNvbnN0IFkmIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFkodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBkZXN0cm95KHBvaW50ZXIgbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgbWVtb3J5LT5+WSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3I9PShjb25zdCBtYWtlX2FycmF5X2hlbHBlcjxUW10sIFU+JiBvdGhlcikgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3IhPShjb25zdCBtYWtlX2FycmF5X2hlbHBlcjxUW10sIFU+JiBvdGhlcikgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiAhKCp0aGlzID09IG90aGVyKTsgCisgICAgICAgICAgICB9CisgICAgICAgIHByaXZhdGU6CisgICAgICAgICAgICBzdGQ6OnNpemVfdCBzaXplOworICAgICAgICAgICAgVCoqIGRhdGE7CisgICAgICAgIH07CisgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHN0ZDo6c2l6ZV90IE4sIHR5cGVuYW1lIFk+CisgICAgICAgIGNsYXNzIG1ha2VfYXJyYXlfaGVscGVyPFRbTl0sIFk+IHsKKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQyLCB0eXBlbmFtZSBZMj4KKyAgICAgICAgICAgIGZyaWVuZCBjbGFzcyBtYWtlX2FycmF5X2hlbHBlcjsKKyAgICAgICAgcHVibGljOgorICAgICAgICAgICAgdHlwZWRlZiBZICAgICAgICAgICB2YWx1ZV90eXBlOworICAgICAgICAgICAgdHlwZWRlZiBZKiAgICAgICAgICBwb2ludGVyOworICAgICAgICAgICAgdHlwZWRlZiBjb25zdCBZKiAgICBjb25zdF9wb2ludGVyOworICAgICAgICAgICAgdHlwZWRlZiBZJiAgICAgICAgICByZWZlcmVuY2U7CisgICAgICAgICAgICB0eXBlZGVmIGNvbnN0IFkmICAgIGNvbnN0X3JlZmVyZW5jZTsKKyAgICAgICAgICAgIHR5cGVkZWYgc3RkOjpzaXplX3Qgc2l6ZV90eXBlOworICAgICAgICAgICAgdHlwZWRlZiBwdHJkaWZmX3QgICBkaWZmZXJlbmNlX3R5cGU7CisgICAgICAgICAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBVPgorICAgICAgICAgICAgc3RydWN0IHJlYmluZCB7CisgICAgICAgICAgICAgICAgdHlwZWRlZiBtYWtlX2FycmF5X2hlbHBlcjxUW05dLCBVPiBvdGhlcjsKKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBtYWtlX2FycmF5X2hlbHBlcihUKiogZGF0YSkKKyAgICAgICAgICAgICAgICA6IGRhdGEoZGF0YSkgeworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8Y2xhc3MgVT4KKyAgICAgICAgICAgIG1ha2VfYXJyYXlfaGVscGVyKGNvbnN0IG1ha2VfYXJyYXlfaGVscGVyPFRbTl0sIFU+JiBvdGhlcikgCisgICAgICAgICAgICAgICAgOiBkYXRhKG90aGVyLmRhdGEpIHsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHBvaW50ZXIgYWRkcmVzcyhyZWZlcmVuY2UgdmFsdWUpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gJnZhbHVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29uc3RfcG9pbnRlciBhZGRyZXNzKGNvbnN0X3JlZmVyZW5jZSB2YWx1ZSkgY29uc3QgeworICAgICAgICAgICAgICAgIHJldHVybiAmdmFsdWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzaXplX3R5cGUgbWF4X3NpemUoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXRpY19jYXN0PHN0ZDo6c2l6ZV90PigtMSkgLyBzaXplb2YoWSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb2ludGVyIGFsbG9jYXRlKHNpemVfdHlwZSBjb3VudCwgY29uc3Qgdm9pZCogPSAwKSB7CisgICAgICAgICAgICAgICAgc3RkOjpzaXplX3QgYTEgPSBuZG5ib29zdDo6YWxpZ25tZW50X29mPFQ+Ojp2YWx1ZTsKKyAgICAgICAgICAgICAgICBzdGQ6OnNpemVfdCBuMSA9IGNvdW50ICogc2l6ZW9mKFkpICsgYTEgLSAxOworICAgICAgICAgICAgICAgIHZvaWQqICBwMSA9IDo6b3BlcmF0b3IgbmV3KG4xICsgTjEpOworICAgICAgICAgICAgICAgIGNoYXIqICBwMiA9IHN0YXRpY19jYXN0PGNoYXIqPihwMSkgKyBuMTsKKyAgICAgICAgICAgICAgICB3aGlsZSAoc3RkOjpzaXplX3QocDIpICUgYTEgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBwMi0tOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAqZGF0YSA9IHJlaW50ZXJwcmV0X2Nhc3Q8VCo+KHAyKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gIHJlaW50ZXJwcmV0X2Nhc3Q8WSo+KHAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHZvaWQgZGVhbGxvY2F0ZShwb2ludGVyIG1lbW9yeSwgc2l6ZV90eXBlKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnk7CisgICAgICAgICAgICAgICAgOjpvcGVyYXRvciBkZWxldGUocDEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBjb25zdHJ1Y3QocG9pbnRlciBtZW1vcnksIGNvbnN0IFkmIHZhbHVlKSB7CisgICAgICAgICAgICAgICAgdm9pZCogcDEgPSBtZW1vcnk7CisgICAgICAgICAgICAgICAgOjpuZXcocDEpIFkodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdm9pZCBkZXN0cm95KHBvaW50ZXIgbWVtb3J5KSB7CisgICAgICAgICAgICAgICAgbWVtb3J5LT5+WSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdGVtcGxhdGU8dHlwZW5hbWUgVT4KKyAgICAgICAgICAgIGJvb2wgb3BlcmF0b3I9PShjb25zdCBtYWtlX2FycmF5X2hlbHBlcjxUW05dLCBVPiYgb3RoZXIpIGNvbnN0IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRlbXBsYXRlPHR5cGVuYW1lIFU+CisgICAgICAgICAgICBib29sIG9wZXJhdG9yIT0oY29uc3QgbWFrZV9hcnJheV9oZWxwZXI8VFtOXSwgVT4mIG90aGVyKSBjb25zdCB7CisgICAgICAgICAgICAgICAgcmV0dXJuICEoKnRoaXMgPT0gb3RoZXIpOyAKKyAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZToKKyAgICAgICAgICAgIGVudW0geworICAgICAgICAgICAgICAgIE4xID0gTiAqIHNpemVvZihUKQorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIFQqKiBkYXRhOworICAgICAgICB9OworICAgIH0KK30KKworI2VuZGlmCmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0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HNpemUgfTsgLy8gMTA0ODU2MCAvIHNpemUKKworI2VuZGlmCisKKyNpZmRlZiBCT09TVF9IQVNfVEhSRUFEUworCisgICAgc3RhdGljIGxpZ2h0d2VpZ2h0X211dGV4ICYgbXV0ZXgoKQorICAgIHsKKyAgICAgICAgc3RhdGljIGZyZWVibG9jazwgc2l6ZW9mKCBsaWdodHdlaWdodF9tdXRleCApLCBuZG5ib29zdDo6YWxpZ25tZW50X29mPCBsaWdodHdlaWdodF9tdXRleCA+Ojp2YWx1ZSA+IGZibTsKKyAgICAgICAgc3RhdGljIGxpZ2h0d2VpZ2h0X211dGV4ICogcG0gPSBuZXcoICZmYm0gKSBsaWdodHdlaWdodF9tdXRleDsKKyAgICAgICAgcmV0dXJuICpwbTsKKyAgICB9CisKKyAgICBzdGF0aWMgbGlnaHR3ZWlnaHRfbXV0ZXggKiBtdXRleF9pbml0OworCisjZW5kaWYKKworICAgIHN0YXRpYyBibG9jayAqIGZyZWU7CisgICAgc3RhdGljIGJsb2NrICogcGFnZTsKKyAgICBzdGF0aWMgdW5zaWduZWQgbGFzdDsKKworICAgIHN0YXRpYyBpbmxpbmUgdm9pZCAqIGFsbG9jKCkKKyAgICB7CisjaWZkZWYgQk9PU1RfSEFTX1RIUkVBRFMKKyAgICAgICAgbGlnaHR3ZWlnaHRfbXV0ZXg6OnNjb3BlZF9sb2NrIGxvY2soIG11dGV4KCkgKTsKKyNlbmRpZgorICAgICAgICBpZihibG9jayAqIHggPSBmcmVlKQorICAgICAgICB7CisgICAgICAgICAgICBmcmVlID0geC0+bmV4dDsKKyAgICAgICAgICAgIHJldHVybiB4OworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgaWYobGFzdCA9PSBpdGVtc19wZXJfcGFnZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAvLyAiTGlzdGVuIHRvIG1lIGNhcmVmdWxseTogdGhlcmUgaXMgbm8gbWVtb3J5IGxlYWsiCisgICAgICAgICAgICAgICAgLy8gLS0gU2NvdHQgTWV5ZXJzLCBFZmYgQysrIDJuZCBFZCBJdGVtIDEwCisgICAgICAgICAgICAgICAgcGFnZSA9IDo6bmV3IGJsb2NrW2l0ZW1zX3Blcl9wYWdlXTsKKyAgICAgICAgICAgICAgICBsYXN0ID0gMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuICZwYWdlW2xhc3QrK107CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGF0aWMgaW5saW5lIHZvaWQgKiBhbGxvYyhzdGQ6OnNpemVfdCBuKQorICAgIHsKKyAgICAgICAgaWYobiAhPSBzaXplKSAvLyBjbGFzcy1zcGVjaWZpYyBuZXcgY2FsbGVkIGZvciBhIGRlcml2ZWQgb2JqZWN0CisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiA6Om9wZXJhdG9yIG5ldyhuKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyNpZmRlZiBCT09TVF9IQVNfVEhSRUFEUworICAgICAgICAgICAgbGlnaHR3ZWlnaHRfbXV0ZXg6OnNjb3BlZF9sb2NrIGxvY2soIG11dGV4KCkgKTsKKyNlbmRpZgorICAgICAgICAgICAgaWYoYmxvY2sgKiB4ID0gZnJlZSkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBmcmVlID0geC0+bmV4dDsKKyAgICAgICAgICAgICAgICByZXR1cm4geDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBpZihsYXN0ID09IGl0ZW1zX3Blcl9wYWdlKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgcGFnZSA9IDo6bmV3IGJsb2NrW2l0ZW1zX3Blcl9wYWdlXTsKKyAgICAgICAgICAgICAgICAgICAgbGFzdCA9IDA7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuICZwYWdlW2xhc3QrK107CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGF0aWMgaW5saW5lIHZvaWQgZGVhbGxvYyh2b2lkICogcHYpCisgICAgeworICAgICAgICBpZihwdiAhPSAwKSAvLyAxOC40LjEuMS8xMworICAgICAgICB7CisjaWZkZWYgQk9PU1RfSEFTX1RIUkVBRFMKKyAgICAgICAgICAgIGxpZ2h0d2VpZ2h0X211dGV4OjpzY29wZWRfbG9jayBsb2NrKCBtdXRleCgpICk7CisjZW5kaWYKKyAgICAgICAgICAgIGJsb2NrICogcGIgPSBzdGF0aWNfY2FzdDxibG9jayAqPihwdik7CisgICAgICAgICAgICBwYi0+bmV4dCA9IGZyZWU7CisgICAgICAgICAgICBmcmVlID0gcGI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBzdGF0aWMgaW5saW5lIHZvaWQgZGVhbGxvYyh2b2lkICogcHYsIHN0ZDo6c2l6ZV90IG4pCisgICAgeworICAgICAgICBpZihuICE9IHNpemUpIC8vIGNsYXNzLXNwZWNpZmljIGRlbGV0ZSBjYWxsZWQgZm9yIGEgZGVyaXZlZCBvYmplY3QKKyAgICAgICAgeworICAgICAgICAgICAgOjpvcGVyYXRvciBkZWxldGUocHYpOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYocHYgIT0gMCkgLy8gMTguNC4xLjEvMTMKKyAgICAgICAgeworI2lmZGVmIEJPT1NUX0hBU19USFJFQURTCisgICAgICAgICAgICBsaWdodHdlaWdodF9tdXRleDo6c2NvcGVkX2xvY2sgbG9jayggbXV0ZXgoKSApOworI2VuZGlmCisgICAgICAgICAgICBibG9jayAqIHBiID0gc3RhdGljX2Nhc3Q8YmxvY2sgKj4ocHYpOworICAgICAgICAgICAgcGItPm5leHQgPSBmcmVlOworICAgICAgICAgICAgZnJlZSA9IHBiOworICAgICAgICB9CisgICAgfQorfTsKKworI2lmZGVmIEJPT1NUX0hBU19USFJFQURTCisKK3RlbXBsYX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d3JhcHBlcjwgRCA+IHR5cGU7Cit9OworCisjZW5kaWYKKworY2xhc3Mgd2Vha19jb3VudDsKKworY2xhc3Mgc2hhcmVkX2NvdW50Cit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlICogcGlfOworCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgaW50IGlkXzsKKyNlbmRpZgorCisgICAgZnJpZW5kIGNsYXNzIHdlYWtfY291bnQ7CisKK3B1YmxpYzoKKworICAgIHNoYXJlZF9jb3VudCgpOiBwaV8oMCkgLy8gbm90aHJvdworI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyhzaGFyZWRfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisgICAgfQorCisgICAgdGVtcGxhdGU8Y2xhc3MgWT4gZXhwbGljaXQgc2hhcmVkX2NvdW50KCBZICogcCApOiBwaV8oIDAgKQorI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyhzaGFyZWRfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisjaWZuZGVmIEJPT1NUX05PX0VYQ0VQVElPTlMKKworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgcGlfID0gbmV3IHNwX2NvdW50ZWRfaW1wbF9wPFk+KCBwICk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2goLi4uKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6Y2hlY2tlZF9kZWxldGUoIHAgKTsKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcGlfID0gbmV3IHNwX2NvdW50ZWRfaW1wbF9wPFk+KCBwICk7CisKKyAgICAgICAgaWYoIHBpXyA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgbmRuYm9vc3Q6OmNoZWNrZWRfZGVsZXRlKCBwICk7CisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKCBzdGQ6OmJhZF9hbGxvYygpICk7CisgICAgICAgIH0KKworI2VuZGlmCisgICAgfQorCisjaWYgZGVmaW5lZCggQk9PU1RfTVNWQyApICYmIEJPT1NUX1dPUktBUk9VTkQoIEJPT1NUX01TVkMsIDw9IDEyMDAgKQorICAgIHRlbXBsYXRlPGNsYXNzIFksIGNsYXNzIEQ+IHNoYXJlZF9jb3VudCggWSAqIHAsIEQgZCApOiBwaV8oMCkKKyNlbHNlCisgICAgdGVtcGxhdGU8Y2xhc3MgUCwgY2xhc3MgRD4gc2hhcmVkX2NvdW50KCBQIHAsIEQgZCApOiBwaV8oMCkKKyNlbmRpZgorI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyhzaGFyZWRfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisjaWYgZGVmaW5lZCggQk9PU1RfTVNWQyApICYmIEJPT1NUX1dPUktBUk9VTkQoIEJPT1NUX01TVkMsIDw9IDEyMDAgKQorICAgICAgICB0eXBlZGVmIFkqIFA7CisjZW5kaWYKKyNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICBwaV8gPSBuZXcgc3BfY291bnRlZF9pbXBsX3BkPFAsIEQ+KHAsIGQpOworICAgICAgICB9CisgICAgICAgIGNhdGNoKC4uLikKKyAgICAgICAgeworICAgICAgICAgICAgZChwKTsgLy8gZGVsZXRlIHAKKyAgICAgICAgICAgIHRocm93OworICAgICAgICB9CisKKyNlbHNlCisKKyAgICAgICAgcGlfID0gbmV3IHNwX2NvdW50ZWRfaW1wbF9wZDxQLCBEPihwLCBkKTsKKworICAgICAgICBpZihwaV8gPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgZChwKTsgLy8gZGVsZXRlIHAKKyAgICAgICAgICAgIG5kbmJvb3N0Ojp0aHJvd19leGNlcHRpb24oc3RkOjpiYWRfYWxsb2MoKSk7CisgICAgICAgIH0KKworI2VuZGlmCisgICAgfQorCisjaWYgIWRlZmluZWQoIEJPT1NUX05PX0ZVTkNUSU9OX1RFTVBMQVRFX09SREVSSU5HICkKKworICAgIHRlbXBsYXRlPCBjbGFzcyBQLCBjbGFzcyBEID4gc2hhcmVkX2NvdW50KCBQIHAsIHNwX2lucGxhY2VfdGFnPEQ+ICk6IHBpXyggMCApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIHRyeQorICAgICAgICB7CisgICAgICAgICAgICBwaV8gPSBuZXcgc3BfY291bnRlZF9pbXBsX3BkPCBQLCBEID4oIHAgKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCggLi4uICkKKyAgICAgICAgeworICAgICAgICAgICAgRCgpKCBwICk7IC8vIGRlbGV0ZSBwCisgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgfQorCisjZWxzZQorCisgICAgICAgIHBpXyA9IG5ldyBzcF9jb3VudGVkX2ltcGxfcGQ8IFAsIEQgPiggcCApOworCisgICAgICAgIGlmKCBwaV8gPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIEQoKSggcCApOyAvLyBkZWxldGUgcAorICAgICAgICAgICAgbmRuYm9vc3Q6OnRocm93X2V4Y2VwdGlvbiggc3RkOjpiYWRfYWxsb2MoKSApOworICAgICAgICB9CisKKyNlbmRpZiAvLyAjaWZuZGVmIEJPT1NUX05PX0VYQ0VQVElPTlMKKyAgICB9CisKKyNlbmRpZiAvLyAhZGVmaW5lZCggQk9PU1RfTk9fRlVOQ1RJT05fVEVNUExBVEVfT1JERVJJTkcgKQorCisgICAgdGVtcGxhdGU8Y2xhc3MgUCwgY2xhc3MgRCwgY2xhc3MgQT4gc2hhcmVkX2NvdW50KCBQIHAsIEQgZCwgQSBhICk6IHBpXyggMCApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgdHlwZWRlZiBzcF9jb3VudGVkX2ltcGxfcGRhPFAsIEQsIEE+IGltcGxfdHlwZTsKKyAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBBOjp0ZW1wbGF0ZSByZWJpbmQ8IGltcGxfdHlwZSA+OjpvdGhlciBBMjsKKworICAgICAgICBBMiBhMiggYSApOworCisjaWZuZGVmIEJPT1NUX05PX0VYQ0VQVElPTlMKKworICAgICAgICB0cnkKKyAgICAgICAgeworICAgICAgICAgICAgcGlfID0gYTIuYWxsb2NhdGUoIDEsIHN0YXRpY19jYXN0PCBpbXBsX3R5cGUqID4oIDAgKSApOworICAgICAgICAgICAgbmV3KCBzdGF0aWNfY2FzdDwgdm9pZCogPiggcGlfICkgKSBpbXBsX3R5cGUoIHAsIGQsIGEgKTsKKyAgICAgICAgfQorICAgICAgICBjYXRjaCguLi4pCisgICAgICAgIHsKKyAgICAgICAgICAgIGQoIHAgKTsKKworICAgICAgICAgICAgaWYoIHBpXyAhPSAwICkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhMi5kZWFsbG9jYXRlKCBzdGF0aWNfY2FzdDwgaW1wbF90eXBlKiA+KCBwaV8gKSwgMSApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgfQorCisjZWxzZQorCisgICAgICAgIHBpXyA9IGEyLmFsbG9jYXRlKCAxLCBzdGF0aWNfY2FzdDwgaW1wbF90eXBlKiA+KCAwICkgKTsKKworICAgICAgICBpZiggcGlfICE9IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBuZXcoIHN0YXRpY19jYXN0PCB2b2lkKiA+KCBwaV8gKSApIGltcGxfdHlwZSggcCwgZCwgYSApOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgZCggcCApOworICAgICAgICAgICAgbmRuYm9vc3Q6OnRocm93X2V4Y2VwdGlvbiggc3RkOjpiYWRfYWxsb2MoKSApOworICAgICAgICB9CisKKyNlbmRpZgorICAgIH0KKworI2lmICFkZWZpbmVkKCBCT09TVF9OT19GVU5DVElPTl9URU1QTEFURV9PUkRFUklORyApCisKKyAgICB0ZW1wbGF0ZTwgY2xhc3MgUCwgY2xhc3MgRCwgY2xhc3MgQSA+IHNoYXJlZF9jb3VudCggUCBwLCBzcF9pbnBsYWNlX3RhZzwgRCA+LCBBIGEgKTogcGlfKCAwICkKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8oc2hhcmVkX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICB0eXBlZGVmIHNwX2NvdW50ZWRfaW1wbF9wZGE8IFAsIEQsIEEgPiBpbXBsX3R5cGU7CisgICAgICAgIHR5cGVkZWYgdHlwZW5hbWUgQTo6dGVtcGxhdGUgcmViaW5kPCBpbXBsX3R5cGUgPjo6b3RoZXIgQTI7CisKKyAgICAgICAgQTIgYTIoIGEgKTsKKworI2lmbmRlZiBCT09TVF9OT19FWENFUFRJT05TCisKKyAgICAgICAgdHJ5CisgICAgICAgIHsKKyAgICAgICAgICAgIHBpXyA9IGEyLmFsbG9jYXRlKCAxLCBzdGF0aWNfY2FzdDwgaW1wbF90eXBlKiA+KCAwICkgKTsKKyAgICAgICAgICAgIG5ldyggc3RhdGljX2Nhc3Q8IHZvaWQqID4oIHBpXyApICkgaW1wbF90eXBlKCBwLCBhICk7CisgICAgICAgIH0KKyAgICAgICAgY2F0Y2goLi4uKQorICAgICAgICB7CisgICAgICAgICAgICBEKCkoIHAgKTsKKworICAgICAgICAgICAgaWYoIHBpXyAhPSAwICkKKyAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICBhMi5kZWFsbG9jYXRlKCBzdGF0aWNfY2FzdDwgaW1wbF90eXBlKiA+KCBwaV8gKSwgMSApOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0aHJvdzsKKyAgICAgICAgfQorCisjZWxzZQorCisgICAgICAgIHBpXyA9IGEyLmFsbG9jYXRlKCAxLCBzdGF0aWNfY2FzdDwgaW1wbF90eXBlKiA+KCAwICkgKTsKKworICAgICAgICBpZiggcGlfICE9IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBuZXcoIHN0YXRpY19jYXN0PCB2b2lkKiA+KCBwaV8gKSApIGltcGxfdHlwZSggcCwgYSApOworICAgICAgICB9CisgICAgICAgIGVsc2UKKyAgICAgICAgeworICAgICAgICAgICAgRCgpKCBwICk7CisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKCBzdGQ6OmJhZF9hbGxvYygpICk7CisgICAgICAgIH0KKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworICAgIH0KKworI2VuZGlmIC8vICFkZWZpbmVkKCBCT09TVF9OT19GVU5DVElPTl9URU1QTEFURV9PUkRFUklORyApCisKKyNpZm5kZWYgQk9PU1RfTk9fQVVUT19QVFIKKworICAgIC8vIGF1dG9fcHRyPFk+IGlzIHNwZWNpYWwgY2FzZWQgdG8gcHJvdmlkZSB0aGUgc3Ryb25nIGd1YXJhbnRlZQorCisgICAgdGVtcGxhdGU8Y2xhc3MgWT4KKyAgICBleHBsaWNpdCBzaGFyZWRfY291bnQoIHN0ZDo6YXV0b19wdHI8WT4gJiByICk6IHBpXyggbmV3IHNwX2NvdW50ZWRfaW1wbF9wPFk+KCByLmdldCgpICkgKQorI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyhzaGFyZWRfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisjaWZkZWYgQk9PU1RfTk9fRVhDRVBUSU9OUworCisgICAgICAgIGlmKCBwaV8gPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0Ojp0aHJvd19leGNlcHRpb24oc3RkOjpiYWRfYWxsb2MoKSk7CisgICAgICAgIH0KKworI2VuZGlmCisKKyAgICAgICAgci5yZWxlYXNlKCk7CisgICAgfQorCisjZW5kaWYgCisKKyNpZiAhZGVmaW5lZCggQk9PU1RfTk9fQ1hYMTFfU01BUlRfUFRSICkKKworICAgIHRlbXBsYXRlPGNsYXNzIFksIGNsYXNzIEQ+CisgICAgZXhwbGljaXQgc2hhcmVkX2NvdW50KCBzdGQ6OnVuaXF1ZV9wdHI8WSwgRD4gJiByICk6IHBpXyggMCApCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBzcF9jb252ZXJ0X3JlZmVyZW5jZTxEPjo6dHlwZSBEMjsKKworICAgICAgICBEMiBkMiggci5nZXRfZGVsZXRlcigpICk7CisgICAgICAgIHBpXyA9IG5ldyBzcF9jb3VudGVkX2ltcGxfcGQ8IHR5cGVuYW1lIHN0ZDo6dW5pcXVlX3B0cjxZLCBEPjo6cG9pbnRlciwgRDIgPiggci5nZXQoKSwgZDIgKTsKKworI2lmZGVmIEJPT1NUX05PX0VYQ0VQVElPTlMKKworICAgICAgICBpZiggcGlfID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6dGhyb3dfZXhjZXB0aW9uKCBzdGQ6OmJhZF9hbGxvYygpICk7CisgICAgICAgIH0KKworI2VuZGlmCisKKyAgICAgICAgci5yZWxlYXNlKCk7CisgICAgfQorCisjZW5kaWYKKworICAgIH5zaGFyZWRfY291bnQoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggcGlfICE9IDAgKSBwaV8tPnJlbGVhc2UoKTsKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgaWRfID0gMDsKKyNlbmRpZgorICAgIH0KKworICAgIHNoYXJlZF9jb3VudChzaGFyZWRfY291bnQgY29uc3QgJiByKTogcGlfKHIucGlfKSAvLyBub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgaWYoIHBpXyAhPSAwICkgcGlfLT5hZGRfcmVmX2NvcHkoKTsKKyAgICB9CisKKyNpZiAhZGVmaW5lZCggQk9PU1RfTk9fQ1hYMTFfUlZBTFVFX1JFRkVSRU5DRVMgKQorCisgICAgc2hhcmVkX2NvdW50KHNoYXJlZF9jb3VudCAmJiByKTogcGlfKHIucGlfKSAvLyBub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHNoYXJlZF9jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgci5waV8gPSAwOworICAgIH0KKworI2VuZGlmCisKKyAgICBleHBsaWNpdCBzaGFyZWRfY291bnQod2Vha19jb3VudCBjb25zdCAmIHIpOyAvLyB0aHJvd3MgYmFkX3dlYWtfcHRyIHdoZW4gci51c2VfY291bnQoKSA9PSAwCisgICAgc2hhcmVkX2NvdW50KCB3ZWFrX2NvdW50IGNvbnN0ICYgciwgc3Bfbm90aHJvd190YWcgKTsgLy8gY29uc3RydWN0cyBhbiBlbXB0eSAqdGhpcyB3aGVuIHIudXNlX2NvdW50KCkgPT0gMAorCisgICAgc2hhcmVkX2NvdW50ICYgb3BlcmF0b3I9IChzaGFyZWRfY291bnQgY29uc3QgJiByKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcF9jb3VudGVkX2Jhc2UgKiB0bXAgPSByLnBpXzsKKworICAgICAgICBpZiggdG1wICE9IHBpXyApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKCB0bXAgIT0gMCApIHRtcC0+YWRkX3JlZl9jb3B5KCk7CisgICAgICAgICAgICBpZiggcGlfICE9IDAgKSBwaV8tPnJlbGVhc2UoKTsKKyAgICAgICAgICAgIHBpXyA9IHRtcDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyAgICB2b2lkIHN3YXAoc2hhcmVkX2NvdW50ICYgcikgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgc3BfY291bnRlZF9iYXNlICogdG1wID0gci5waV87CisgICAgICAgIHIucGlfID0gcGlfOworICAgICAgICBwaV8gPSB0bXA7CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gcGlfICE9IDA/IHBpXy0+dXNlX2NvdW50KCk6IDA7CisgICAgfQorCisgICAgYm9vbCB1bmlxdWUoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICByZXR1cm4gdXNlX2NvdW50KCkgPT0gMTsKKyAgICB9CisKKyAgICBib29sIGVtcHR5KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHBpXyA9PSAwOworICAgIH0KKworICAgIGZyaWVuZCBpbmxpbmUgYm9vbCBvcGVyYXRvcj09KHNoYXJlZF9jb3VudCBjb25zdCAmIGEsIHNoYXJlZF9jb3VudCBjb25zdCAmIGIpCisgICAgeworICAgICAgICByZXR1cm4gYS5waV8gPT0gYi5waV87CisgICAgfQorCisgICAgZnJpZW5kIGlubGluZSBib29sIG9wZXJhdG9yPChzaGFyZWRfY291bnQgY29uc3QgJiBhLCBzaGFyZWRfY291bnQgY29uc3QgJiBiKQorICAgIHsKKyAgICAgICAgcmV0dXJuIHN0ZDo6bGVzczxzcF9jb3VudGVkX2Jhc2UgKj4oKSggYS5waV8sIGIucGlfICk7CisgICAgfQorCisgICAgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgY29uc3QKKyAgICB7CisgICAgICAgIHJldHVybiBwaV8/IHBpXy0+Z2V0X2RlbGV0ZXIoIHRpICk6IDA7CisgICAgfQorCisgICAgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSBjb25zdAorICAgIHsKKyAgICAgICAgcmV0dXJuIHBpXz8gcGlfLT5nZXRfdW50eXBlZF9kZWxldGVyKCk6IDA7CisgICAgfQorfTsKKworCitjbGFzcyB3ZWFrX2NvdW50Cit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlICogcGlfOworCisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgaW50IGlkXzsKKyNlbmRpZgorCisgICAgZnJpZW5kIGNsYXNzIHNoYXJlZF9jb3VudDsKKworcHVibGljOgorCisgICAgd2Vha19jb3VudCgpOiBwaV8oMCkgLy8gbm90aHJvdworI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyh3ZWFrX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgIH0KKworICAgIHdlYWtfY291bnQoc2hhcmVkX2NvdW50IGNvbnN0ICYgcik6IHBpXyhyLnBpXykgLy8gbm90aHJvdworI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICAsIGlkXyh3ZWFrX2NvdW50X2lkKQorI2VuZGlmCisgICAgeworICAgICAgICBpZihwaV8gIT0gMCkgcGlfLT53ZWFrX2FkZF9yZWYoKTsKKyAgICB9CisKKyAgICB3ZWFrX2NvdW50KHdlYWtfY291bnQgY29uc3QgJiByKTogcGlfKHIucGlfKSAvLyBub3Rocm93CisjaWYgZGVmaW5lZChCT09TVF9TUF9FTkFCTEVfREVCVUdfSE9PS1MpCisgICAgICAgICwgaWRfKHdlYWtfY291bnRfaWQpCisjZW5kaWYKKyAgICB7CisgICAgICAgIGlmKHBpXyAhPSAwKSBwaV8tPndlYWtfYWRkX3JlZigpOworICAgIH0KKworLy8gTW92ZSBzdXBwb3J0CisKKyNpZiAhZGVmaW5lZCggQk9PU1RfTk9fQ1hYMTFfUlZBTFVFX1JFRkVSRU5DRVMgKQorCisgICAgd2Vha19jb3VudCh3ZWFrX2NvdW50ICYmIHIpOiBwaV8oci5waV8pIC8vIG5vdGhyb3cKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX0VOQUJMRV9ERUJVR19IT09LUykKKyAgICAgICAgLCBpZF8od2Vha19jb3VudF9pZCkKKyNlbmRpZgorICAgIHsKKyAgICAgICAgci5waV8gPSAwOworICAgIH0KKworI2VuZGlmCisKKyAgICB+d2Vha19jb3VudCgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKHBpXyAhPSAwKSBwaV8tPndlYWtfcmVsZWFzZSgpOworI2lmIGRlZmluZWQoQk9PU1RfU1BfRU5BQkxFX0RFQlVHX0hPT0tTKQorICAgICAgICBpZF8gPSAwOworI2VuZGlmCisgICAgfQorCisgICAgd2Vha19jb3VudCAmIG9wZXJhdG9yPSAoc2hhcmVkX2NvdW50IGNvbnN0ICYgcikgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgc3BfY291bnRlZF9iYXNlICogdG1wID0gci5waV87CisKKyAgICAgICAgaWYoIHRtcCAhPSBwaV8gKQorICAgICAgICB7CisgICAgICAgICAgICBpZih0bXAgIT0gMCkgdG1wLT53ZWFrX2FkZF9yZWYoKTsKKyAgICAgICAgICAgIGlmKHBpXyAhPSAwKSBwaV8tPndlYWtfcmVsZWFzZSgpOworICAgICAgICAgICAgcGlfID0gdG1wOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIHdlYWtfY291bnQgJiBvcGVyYXRvcj0gKHdlYWtfY291bnQgY29uc3QgJiByKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcF9jb3VudGVkX2Jhc2UgKiB0bXAgPSByLnBpXzsKKworICAgICAgICBpZiggdG1wICE9IHBpXyApCisgICAgICAgIHsKKyAgICAgICAgICAgIGlmKHRtcCAhPSAwKSB0bXAtPndlYWtfYWRkX3JlZigpOworICAgICAgICAgICAgaWYocGlfICE9IDApIHBpXy0+d2Vha19yZWxlYXNlKCk7CisgICAgICAgICAgICBwaV8gPSB0bXA7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisgICAgdm9pZCBzd2FwKHdlYWtfY291bnQgJiByKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcF9jb3VudGVkX2Jhc2UgKiB0bXAgPSByLnBpXzsKKyAgICAgICAgci5waV8gPSBwaV87CisgICAgICAgIHBpXyA9IHRtcDsKKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBwaV8gIT0gMD8gcGlfLT51c2VfY291bnQoKTogMDsKKyAgICB9CisKKyAgICBib29sIGVtcHR5KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHBpXyA9PSAwOworICAgIH0KKworICAgIGZyaWVuZCBpbmxpbmUgYm9vbCBvcGVyYXRvcj09KHdlYWtfY291bnQgY29uc3QgJiBhLCB3ZWFrX2NvdW50IGNvbnN0ICYgYikKKyAgICB7CisgICAgICAgIHJldHVybiBhLnBpXyA9PSBiLnBpXzsKKyAgICB9CisKKyAgICBmcmllbmQgaW5saW5lIGJvb2wgb3BlcmF0b3I8KHdlYWtfY291bnQgY29uc3QgJiBhLCB3ZWFrX2NvdW50IGNvbnN0ICYgYikKKyAgICB7CisgICAgICA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0aHJvdzsKKyAgICAgICAgfQorCisjZWxzZQorCisgICAgICAgIHBuID0gbmV3IGNvdW50X3R5cGUoMSk7CisKKyAgICAgICAgaWYocG4gPT0gMCkKKyAgICAgICAgeworICAgICAgICAgICAgbmRuYm9vc3Q6OmNoZWNrZWRfZGVsZXRlKHApOworICAgICAgICAgICAgbmRuYm9vc3Q6OnRocm93X2V4Y2VwdGlvbihzdGQ6OmJhZF9hbGxvYygpKTsKKyAgICAgICAgfQorCisjZW5kaWYKKyAgICB9CisKKyAgICB+c2hhcmVkX3B0cigpCisgICAgeworICAgICAgICBpZigtLSpwbiA9PSAwKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6Y2hlY2tlZF9kZWxldGUocHgpOworICAgICAgICAgICAgZGVsZXRlIHBuOworICAgICAgICB9CisgICAgfQorCisgICAgc2hhcmVkX3B0cihzaGFyZWRfcHRyIGNvbnN0ICYgcik6IHB4KHIucHgpICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIHBuID0gci5wbjsKKyAgICAgICAgKysqcG47CisgICAgfQorCisgICAgc2hhcmVkX3B0ciAmIG9wZXJhdG9yPShzaGFyZWRfcHRyIGNvbnN0ICYgcikKKyAgICB7CisgICAgICAgIHNoYXJlZF9wdHIocikuc3dhcCgqdGhpcyk7CisgICAgICAgIHJldHVybiAqdGhpczsKKyAgICB9CisKKyNpZm5kZWYgQk9PU1RfTk9fQVVUT19QVFIKKworICAgIGV4cGxpY2l0IHNoYXJlZF9wdHIoc3RkOjphdXRvX3B0cjxUPiAmIHIpCisgICAgeyAKKyAgICAgICAgcG4gPSBuZXcgY291bnRfdHlwZSgxKTsgLy8gbWF5IHRocm93CisgICAgICAgIHB4ID0gci5yZWxlYXNlKCk7IC8vIGZpeDogbW92ZWQgaGVyZSB0byBzdG9wIGxlYWsgaWYgbmV3IHRocm93cworICAgIH0gCisKKyAgICBzaGFyZWRfcHRyICYgb3BlcmF0b3I9KHN0ZDo6YXV0b19wdHI8VD4gJiByKQorICAgIHsKKyAgICAgICAgc2hhcmVkX3B0cihyKS5zd2FwKCp0aGlzKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworI2VuZGlmCisKKyAgICB2b2lkIHJlc2V0KFQgKiBwID0gMCkKKyAgICB7CisgICAgICAgIEJPT1NUX0FTU0VSVChwID09IDAgfHwgcCAhPSBweCk7CisgICAgICAgIHNoYXJlZF9wdHIocCkuc3dhcCgqdGhpcyk7CisgICAgfQorCisgICAgVCAmIG9wZXJhdG9yKigpIGNvbnN0ICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIEJPT1NUX0FTU0VSVChweCAhPSAwKTsKKyAgICAgICAgcmV0dXJuICpweDsKKyAgICB9CisKKyAgICBUICogb3BlcmF0b3ItPigpIGNvbnN0ICAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIEJPT1NUX0FTU0VSVChweCAhPSAwKTsKKyAgICAgICAgcmV0dXJuIHB4OworICAgIH0KKworICAgIFQgKiBnZXQoKSBjb25zdCAgLy8gbmV2ZXIgdGhyb3dzCisgICAgeworICAgICAgICByZXR1cm4gcHg7CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAgLy8gbmV2ZXIgdGhyb3dzCisgICAgeworICAgICAgICByZXR1cm4gKnBuOworICAgIH0KKworICAgIGJvb2wgdW5pcXVlKCkgY29uc3QgIC8vIG5ldmVyIHRocm93cworICAgIHsKKyAgICAgICAgcmV0dXJuICpwbiA9PSAxOworICAgIH0KKyAgICAKKyAgICB2b2lkIHN3YXAoc2hhcmVkX3B0cjxUPiAmIG90aGVyKSAgLy8gbmV2ZXIgdGhyb3dzCisgICAgeworICAgICAgICBzdGQ6OnN3YXAocHgsIG90aGVyLnB4KTsKKyAgICAgICAgc3RkOjpzd2FwKHBuLCBvdGhlci5wbik7CisgICAgfQorCitwcml2YXRlOgorCisgICAgVCAqIHB4OyAgICAgICAgICAgIC8vIGNvbnR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vICBodHRwOi8vd3d3LmJvb3N0Lm9yZy9MSUNFTlNFXzFfMC50eHQpCisvLworLy8KKy8vICBMb2NrLWZyZWUgYWxnb3JpdGhtIGJ5IEFsZXhhbmRlciBUZXJla2hvdgorLy8KKworI2luY2x1ZGUgPG5kbmJvb3N0L2RldGFpbC9zcF90eXBlaW5mby5ocHA+CisjaW5jbHVkZSA8bWFjaGluZS9zeXMvaW5saW5lLmg+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyArKypwdzsKKworICAgIF9Bc21fZmV0Y2hhZGQoX0ZBU1pfVywgX1NFTV9SRUwsIHB3LCArMSwgX0xESElOVF9OT05FKTsKK30gCisKK2lubGluZSBpbnQgYXRvbWljX2RlY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIHJldHVybiAtLSpwdzsKKworICAgIGludCByID0gc3RhdGljX2Nhc3Q8aW50PihfQXNtX2ZldGNoYWRkKF9GQVNaX1csIF9TRU1fUkVMLCBwdywgLTEsIF9MREhJTlRfTk9ORSkpOworICAgIGlmICgxID09IHIpCisgICAgeworICAgICAgICBfQXNtX21mKCk7CisgICAgfQorICAgIAorICAgIHJldHVybiByIC0gMTsKK30KKworaW5saW5lIGludCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gaWYoICpwdyAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuICpwdzsKKworICAgIGludCB2ID0gKnB3OworICAgIAorICAgIGZvciAoOzspCisgICAgeworICAgICAgICBpZiAoMCA9PSB2KQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgX0FzbV9tb3ZfdG9fYXIoX0FSRUdfQ0NWLAorICAgICAgICAgICAgICAgICAgICAgICB2LAorICAgICAgICAgICAgICAgICAgICAgICAoX1VQX0NBTExfRkVOQ0UgfCBfVVBfU1lTX0ZFTkNFIHwgX0RPV05fQ0FMTF9GRU5DRSB8IF9ET1dOX1NZU19GRU5DRSkpOworICAgICAgICBpbnQgciA9IHN0YXRpY19jYXN0PGludD4oX0FzbV9jbXB4Y2hnKF9TWl9XLCBfU0VNX0FDUSwgcHcsIHYgKyAxLCBfTERISU5UX05PTkUpKTsKKyAgICAgICAgaWYgKHIgPT0gdikKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHIgKyAxOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICB2ID0gcjsKKyAgICB9Cit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgaW50IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ3ZWFrX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKy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gIHJldHVybiAob3JpZ2luYWxWYWx1ZSAtIDEpOworfQorCitpbmxpbmUgaW50MzJfdCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQzMl90ICogcHcgKQoreworICAgIC8vIGlmKCAqcHcgIT0gMCApICsrKnB3OworICAgIC8vIHJldHVybiAqcHc7CisKKyAgICBpbnQzMl90IHRtcCA9IGZldGNoX2FuZF9hZGQoIHB3LCAwICk7CisgICAgZm9yKCA7OyApCisgICAgeworICAgICAgICBpZiggdG1wID09IDAgKSByZXR1cm4gMDsKKyAgICAgICAgaWYoIGNvbXBhcmVfYW5kX3N3YXAoIHB3LCAmdG1wLCB0bXAgKyAxICkgKSByZXR1cm4gKHRtcCArIDEpOworICAgIH0KK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQzMl90IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50MzJfdCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmd2Vha19jb3VudF8gKSA9PSAwICk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lzdGVyIGludCBhOworCisgICAgYXNtCisgICAgeworICAgIHN5bmMKKworbG9vcDoKKworICAgIGx3YXJ4ICAgYSwgMCwgcHcKKyAgICBhZGRpICAgIGEsIGEsIC0xCisgICAgc3R3Y3guICBhLCAwLCBwdworICAgIGJuZS0gICAgbG9vcAorCisgICAgaXN5bmMKKyAgICB9CisKKyAgICByZXR1cm4gYTsKK30KKworaW5saW5lIGxvbmcgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggcmVnaXN0ZXIgbG9uZyAqIHB3ICkKK3sKKyAgICByZWdpc3RlciBpbnQgYTsKKworICAgIGFzbQorICAgIHsKK2xvb3A6CisKKyAgICBsd2FyeCAgIGEsIDAsIHB3CisgICAgY21wd2kgICBhLCAwCisgICAgYmVxICAgICBzdG9yZQorCisgICAgYWRkaSAgICBhLCBhLCAxCisKK3N0b3JlOgorCisgICAgc3R3Y3guICBhLCAwLCBwdworICAgIGJuZS0gICAgbG9vcAorICAgIH0KKworICAgIHJldHVybiBhOworfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIGxvbmcgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBsb25nIHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworIC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ykgOgorICAgICAgICAgIm0iKCAqcHcgKSk7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2RlY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIHJldHVybiAtLSpwdzsKKworICAgIGludCBydjsKKworICAgIF9fYXNtX18gKCIgICAgIGZldGNoYWRkNC5yZWwgJTA9JTEsLTEgOzsgXG4iCisgICAgICAgICAgICAgIiAgICAgY21wLmVxICAgICAgICBwNyxwMD0xLCUwIDs7IFxuIgorICAgICAgICAgICAgICIocDcpIGxkNC5hY3EgICAgICAgJTA9JTEgICAgIiA6CisgICAgICAgICAgICAgIj0mciIocnYpLCAiPW0iKCpwdykgOgorICAgICAgICAgICAgICJtIiggKnB3ICkgOgorICAgICAgICAgICAgICJwNyIpOworCisgICAgcmV0dXJuIHJ2OworfQorCitpbmxpbmUgaW50IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyBpZiggKnB3ICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gKnB3OworCisgICAgaW50IHJ2LCB0bXAsIHRtcDI7CisKKyAgICBfX2FzbV9fICgiMDogICBsZDQgICAgICAgICAgJTA9JTMgICAgICAgICAgIDs7IFxuIgorICAgICAgICAgIiAgICAgY21wLmVxICAgICAgIHA3LHAwPTAsJTAgICAgICAgIDs7IFxuIgorICAgICAgICAgIihwNykgYnIuY29uZC5zcG50IDFmICAgICAgICAgICAgICAgIFxuIgorICAgICAgICAgIiAgICAgbW92ICAgICAgICAgIGFyLmNjdj0lMCAgICAgICAgIFxuIgorICAgICAgICAgIiAgICAgYWRkICAgICAgICAgICUxPTEsJTAgICAgICAgICAgIDs7IFxuIgorICAgICAgICAgIiAgICAgY21weGNoZzQuYWNxICUyPSUzLCUxLGFyLmNjdiA7OyBcbiIKKyAgICAgICAgICIgICAgIGNtcC5uZSAgICAgICBwNyxwMD0lMCwlMiAgICAgICA7OyBcbiIKKyAgICAgICAgICIocDcpIGJyLmNvbmQuc3BudCAwYiAgICAgICAgICAgICAgICBcbiIKKyAgICAgICAgICIgICAgIG1vdiAgICAgICAgICAlMD0lMSAgICAgICAgICAgICA7OyBcbiIKKyAgICAgICAgICIxOiIgOiAKKyAgICAgICAgICI9JnIiKHJ2KSwgIj0mciIodG1wKSwgIj0mciIodG1wMiksICI9bSIoKnB3KSA6CisgICAgICAgICAibSIoICpwdyApIDoKKyAgICAgICAgICJhci5jY3YiLCAicDciKTsKKworICAgIHJldHVybiBydjsKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIHN0YXRpY19jYX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ywgSW5jLgorLy8KKy8vICBEaXN0cmlidXRlZCB1bmRlciB0aGUgQm9vc3QgU29mdHdhcmUgTGljZW5zZSwgVmVyc2lvbiAxLjAuIChTZWUKKy8vICBhY2NvbXBhbnlpbmcgZmlsZSBMSUNFTlNFXzFfMC50eHQgb3IgY29weSBhdAorLy8gIGh0dHA6Ly93d3cuYm9vc3Qub3JnL0xJQ0VOU0VfMV8wLnR4dCkKKy8vCisvLworLy8gIExvY2stZnJlZSBhbGdvcml0aG0gYnkgQWxleGFuZGVyIFRlcmVraG92CisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworaW5saW5lIHZvaWQgYXRvbWljX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vICsrKnB3OworCisgICAgaW50IHRtcDsKKworICAgIF9fYXNtX18gX192b2xhdGlsZV9fCisgICAgKAorICAgICAgICAiMDpcblx0IgorICAgICAgICAiLnNldCBwdXNoXG5cdCIKKyAgICAgICAgIi5zZXQgbWlwczJcblx0IgorICAgICAgICAibGwgJTAsICUxXG5cdCIKKyAgICAgICAgImFkZGl1ICUwLCAxXG5cdCIKKyAgICAgICAgInNjICUwLCAlMVxuXHQiCisgICAgICAgICIuc2V0IHBvcFxuXHQiCisgICAgICAgICJiZXF6ICUwLCAwYiI6CisgICAgICAgICI9JnIiKCB0bXAgKSwgIj1tIiggKnB3ICk6CisgICAgICAgICJtIiggKnB3ICkKKyAgICApOworfQorCitpbmxpbmUgaW50IGF0b21pY19kZWNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyByZXR1cm4gLS0qcHc7CisKKyAgICBpbnQgcnYsIHRtcDsKKworICAgIF9fYXNtX18gX192b2xhdGlsZV9fCisgICAgKAorICAgICAgICAiMDpcblx0IgorICAgICAgICAiLnNldCBwdXNoXG5cdCIKKyAgICAgICAgIi5zZXQgbWlwczJcblx0IgorICAgICAgICAibGwgJTEsICUyXG5cdCIKKyAgICAgICAgImFkZGl1ICUwLCAlMSwgLTFcblx0IgorICAgICAgICAic2MgJTAsICUyXG5cdCIKKyAgICAgICAgIi5zZXQgcG9wXG5cdCIKKyAgICAgICAgImJlcXogJTAsIDBiXG5cdCIKKyAgICAgICAgImFkZGl1ICUwLCAlMSwgLTEiOgorICAgICAgICAiPSZyIiggcnYgKSwgIj0mciIoIHRtcCApLCAiPW0iKCAqcHcgKToKKyAgICAgICAgIm0iKCAqcHcgKToKKyAgICAgICAgIm1lbW9yeSIKKyAgICApOworCisgICAgcmV0dXJuIHJ2OworfQorCitpbmxpbmUgaW50IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyBpZiggKnB3ICE9IDAgKSArKypwdzsKKyAgICAvLyByZXR1cm4gKnB3OworCisgICAgaW50IHJ2LCB0bXA7CisKKyAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXworICAgICgKKyAgICAgICAgIjA6XG5cdCIKKyAgICAgICAgIi5zZXQgcHVzaFxuXHQiCisgICAgICAgICIuc2V0IG1pcHMyXG5cdCIKKyAgICAgICAgImxsICUwLCAlMlxuXHQiCisgICAgICAgICJiZXF6ICUwLCAxZlxuXHQiCisgICAgICAgICJhZGRpdSAlMSwgJTAsIDFcblx0IgorICAgICAgICAic2MgJTEsICUyXG5cdCIKKyAgICAgICAgIi5zZXQgcG9wXG5cdCIKKyAgICAgICAgImJlcXogJTEsIDBiXG5cdCIKKyAgICAgICAgImFkZGl1ICUwLCAlMCwgMVxuXHQiCisgICAgICAgICIxOiI6CisgICAgICAgICI9JnIiKCBydiApLCAiPSZyIiggdG1wICksICI9bSIoICpwdyApOgorICAgICAgICAibSIoICpwdyApOgorICAgICAgICAibWVtb3J5IgorICAgICk7CisKKyAgICByZXR1cm4gcnY7Cit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgaW50IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ3ZWFrX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBzdGF0aWNfY2FzdDxpbnQgY29uc3Qgdm9sYXRpbGUgJj4oIHVzZV9jb3VudF8gKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX0RFVEFJTF9TUF9DT1VOVEVEX0JBU0VfR0NDX01JUFNfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2NvdW50ZWRfYmFzZ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vY2stZnJlZSBhbGdvcml0aG0gYnkgQWxleGFuZGVyIFRlcmVraG92CisvLworLy8gIFRoYW5rcyB0byBCZW4gSGl0Y2hpbmdzIGZvciB0aGUgI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorLy8gIGZvcm11bGF0aW9uCisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworaW5saW5lIHZvaWQgYXRvbWljX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vICsrKnB3OworCisgICAgaW50IHRtcDsKKworICAgIF9fYXNtX18KKyAgICAoCisgICAgICAgICIwOlxuXHQiCisgICAgICAgICJsd2FyeCAlMSwgMCwgJTJcblx0IgorICAgICAgICAiYWRkaSAlMSwgJTEsIDFcblx0IgorICAgICAgICAic3R3Y3guICUxLCAwLCAlMlxuXHQiCisgICAgICAgICJibmUtIDBiIjoKKworICAgICAgICAiPW0iKCAqcHcgKSwgIj0mYiIoIHRtcCApOgorICAgICAgICAiciIoIHB3ICksICJtIiggKnB3ICk6CisgICAgICAgICJjYyIKKyAgICApOworfQorCitpbmxpbmUgaW50IGF0b21pY19kZWNyZW1lbnQoIGludCAqIHB3ICkKK3sKKyAgICAvLyByZXR1cm4gLS0qcHc7CisKKyAgICBpbnQgcnY7CisKKyAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXworICAgICgKKyAgICAgICAgInN5bmNcblx0IgorICAgICAgICAiMDpcblx0IgorICAgICAgICAibHdhcnggJTEsIDAsICUyXG5cdCIKKyAgICAgICAgImFkZGkgJTEsICUxLCAtMVxuXHQiCisgICAgICAgICJzdHdjeC4gJTEsIDAsICUyXG5cdCIKKyAgICAgICAgImJuZS0gMGJcblx0IgorICAgICAgICAiaXN5bmMiOgorCisgICAgICAgICI9bSIoICpwdyApLCAiPSZiIiggcnYgKToKKyAgICAgICAgInIiKCBwdyApLCAibSIoICpwdyApOgorICAgICAgICAibWVtb3J5IiwgImNjIgorICAgICk7CisKKyAgICByZXR1cm4gcnY7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIC8vIGlmKCAqcHcgIT0gMCApICsrKnB3OworICAgIC8vIHJldHVybiAqcHc7CisKKyAgICBpbnQgcnY7CisKKyAgICBfX2FzbV9fCisgICAgKAorICAgICAgICAiMDpcblx0IgorICAgICAgICAibHdhcnggJTEsIDAsICUyXG5cdCIKKyAgICAgICAgImNtcHdpICUxLCAwXG5cdCIKKyAgICAgICAgImJlcSAxZlxuXHQiCisgICAgICAgICJhZGRpICUxLCAlMSwgMVxuXHQiCisgICAgICAgICIxOlxuXHQiCisgICAgICAgICJzdHdjeC4gJTEsIDAsICUyXG5cdCIKKyAgICAgICAgImJuZS0gMGIiOgorCisgICAgICAgICI9bSIoICpwdyApLCAiPSZiIiggcnYgKToKKyAgICAgICAgInIiKCBwdyApLCAibSIoICpwdyApOgorICAgICAgICAiY2MiCisgICAgKTsKKworICAgIHJldHVybiBydjsKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworICAgIHNwX2NvdW50ZWRfYmFzZSAmIG9wZXJhdG9yPSAoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisKKyAgICBpbnQgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBpbnQgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfc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V0sICUyLCAlMCIKKyAgICAgICAgICAgICAgICAgICAgICAgIDogIityIiAoc3dhcF8pCisgICAgICAgICAgICAgICAgICAgICAgICA6ICJyIiAoZGVzdF8pLCAiciIgKGNvbXBhcmVfKQorICAgICAgICAgICAgICAgICAgICAgICAgOiAibWVtb3J5IiApOworCisgICAgcmV0dXJuIHN3YXBfOworfQorCitpbmxpbmUgaW50MzJfdCBhdG9taWNfZmV0Y2hfYW5kX2FkZCggaW50MzJfdCAqIHB3LCBpbnQzMl90IGR2ICkKK3sKKyAgICAvLyBsb25nIHIgPSAqcHc7CisgICAgLy8gKnB3ICs9IGR2OworICAgIC8vIHJldHVybiByOworCisgICAgZm9yKCA7OyApCisgICAgeworICAgICAgICBpbnQzMl90IHIgPSAqcHc7CisKKyAgICAgICAgaWYoIF9fYnVpbHRpbl9leHBlY3QoKGNvbXBhcmVfYW5kX3N3YXAocHcsIHIsIHIgKyBkdikgPT0gciksIDEpICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHI7CisgICAgICAgIH0KKyAgICB9Cit9CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIGludDMyX3QgKiBwdyApCit7CisgICAgYXRvbWljX2ZldGNoX2FuZF9hZGQoIHB3LCAxICk7Cit9CisKK2lubGluZSBpbnQzMl90IGF0b21pY19kZWNyZW1lbnQoIGludDMyX3QgKiBwdyApCit7CisgICAgcmV0dXJuIGF0b21pY19mZXRjaF9hbmRfYWRkKCBwdywgLTEgKTsKK30KKworaW5saW5lIGludDMyX3QgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggaW50MzJfdCAqIHB3ICkKK3sKKyAgICAvLyBsb25nIHIgPSAqcHc7CisgICAgLy8gaWYoIHIgIT0gMCApICsrKnB3OworICAgIC8vIHJldHVybiByOworCisgICAgZm9yKCA7OyApCisgICAgeworICAgICAgICBpbnQzMl90IHIgPSAqcHc7CisKKyAgICAgICAgaWYoIHIgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiByOworICAgICAgICB9CisKKyAgICAgICAgaWYoIF9fYnVpbHRpbl9leHBlY3QoICggY29tcGFyZV9hbmRfc3dhcCggcHcsIHIsIHIgKyAxICkgPT0gciApLCAxICkgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorICAgIH0gICAgCit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgaW50MzJfdCB1c2VfY291bnRfOyAgICAgICAgLy8gI3NoYXJlZAorICAgIGludDMyX3Qgd2Vha19jb3VudF87ICAgICAgIC8vICN3ZWFrICsgKCNzaGFyZWQgIT0gMCkKKworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuIGNvbnN0X2Nhc3Q8IGludDMyX3QgY29uc3Qgdm9sYXRpbGUgJiA+KCB1c2VfY291bnRfIC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weXJpZ2h0IDIwMDQtMjAwNSBQZXRlciBEaW1vdgorLy8KKy8vICBEaXN0cmlidXRlZCB1bmRlciB0aGUgQm9vc3QgU29mdHdhcmUgTGljZW5zZSwgVmVyc2lvbiAxLjAuIChTZWUKKy8vICBhY2NvbXBhbnlpbmcgZmlsZSBMSUNFTlNFXzFfMC50eHQgb3IgY29weSBhdAorLy8gIGh0dHA6Ly93d3cuYm9vc3Qub3JnL0xJQ0VOU0VfMV8wLnR4dCkKKy8vCisvLworLy8gIExvY2stZnJlZSBhbGdvcml0aG0gYnkgQWxleGFuZGVyIFRlcmVraG92CisvLworLy8gIFRoYW5rcyB0byBCZW4gSGl0Y2hpbmdzIGZvciB0aGUgI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorLy8gIGZvcm11bGF0aW9uCisvLworCisjaW5jbHVkZSA8bmRuYm9vc3QvZGV0YWlsL3NwX3R5cGVpbmZvLmhwcD4KKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworaW5saW5lIGludCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggaW50ICogcHcsIGludCBkdiApCit7CisgICAgLy8gaW50IHIgPSAqcHc7CisgICAgLy8gKnB3ICs9IGR2OworICAgIC8vIHJldHVybiByOworCisgICAgaW50IHI7CisKKyAgICBfX2FzbV9fIF9fdm9sYXRpbGVfXworICAgICgKKyAgICAgICAgImxvY2tcblx0IgorICAgICAgICAieGFkZCAlMSwgJTAiOgorICAgICAgICAiPW0iKCAqcHcgKSwgIj1yIiggciApOiAvLyBvdXRwdXRzICglMCwgJTEpCisgICAgICAgICJtIiggKnB3ICksICIxIiggZHYgKTogLy8gaW5wdXRzICglMiwgJTMgPT0gJTEpCisgICAgICAgICJtZW1vcnkiLCAiY2MiIC8vIGNsb2JiZXJzCisgICAgKTsKKworICAgIHJldHVybiByOworfQorCitpbmxpbmUgdm9pZCBhdG9taWNfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy9hdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggcHcsIDEgKTsKKworICAgIF9fYXNtX18KKyAgICAoCisgICAgICAgICJsb2NrXG5cdCIKKyAgICAgICAgImluY2wgJTAiOgorICAgICAgICAiPW0iKCAqcHcgKTogLy8gb3V0cHV0ICglMCkKKyAgICAgICAgIm0iKCAqcHcgKTogLy8gaW5wdXQgKCUxKQorICAgICAgICAiY2MiIC8vIGNsb2JiZXJzCisgICAgKTsKK30KKworaW5saW5lIGludCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQgKiBwdyApCit7CisgICAgLy8gaW50IHJ2ID0gKnB3OworICAgIC8vIGlmKCBydiAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuIHJ2OworCisgICAgaW50IHJ2LCB0bXA7CisKKyAgICBfX2FzbV9fCisgICAgKAorICAgICAgICAibW92bCAlMCwgJSVlYXhcblx0IgorICAgICAgICAiMDpcblx0IgorICAgICAgICAidGVzdCAlJWVheCwgJSVlYXhcblx0IgorICAgICAgICAiamUgMWZcblx0IgorICAgICAgICAibW92bCAlJWVheCwgJTJcblx0IgorICAgICAgICAiaW5jbCAlMlxuXHQiCisgICAgICAgICJsb2NrXG5cdCIKKyAgICAgICAgImNtcHhjaGdsICUyLCAlMFxuXHQiCisgICAgICAgICJqbmUgMGJcblx0IgorICAgICAgICAiMToiOgorICAgICAgICAiPW0iKCAqcHcgKSwgIj0mYSIoIHJ2ICksICI9JnIiKCB0bXAgKTogLy8gb3V0cHV0cyAoJTAsICUxLCAlMikKKyAgICAgICAgIm0iKCAqcHcgKTogLy8gaW5wdXQgKCUzKQorICAgICAgICAiY2MiIC8vIGNsb2JiZXJzCisgICAgKTsKKworICAgIHJldHVybiBydjsKK30KKworY2xhc3Mgc3BfY291bnRlZF9iYXNlCit7Citwcml2YXRlOgorCisgICAgc3BfY291bnRlZF9iYXNlKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiAp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CisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggJnVzZV9jb3VudF8sIC0xICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZXhjaGFuZ2VfYW5kX2FkZCggJndlYWtfY291bnRfLCAtMSApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiBzdGF0aWNfY2FzdDxpbnQgY29uc3Qgdm9sYXRpbGUgJj4oIHVzZV9jb3VudF8gKTsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9CQVNFX0dDQ19YODZfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2NvdW50ZWRfYmFzZV9udC5ocHAgYi9uZG5ib29z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9jb3B5KCkKKyAgICB7CisgICAgICAgICsrdXNlX2NvdW50XzsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgaWYoIHVzZV9jb3VudF8gPT0gMCApIHJldHVybiBmYWxzZTsKKyAgICAgICAgKyt1c2VfY291bnRfOworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggLS11c2VfY291bnRfID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgKyt3ZWFrX2NvdW50XzsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCAtLXdlYWtfY291bnRfID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHJldHVybiB1c2VfY291bnRfOworICAgIH0KK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZW5kaWYgIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUF9DT1VOVEVEX0JBU0VfTlRfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2NvdW50ZWRfYmFzZV9wdC5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2Nv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GlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soICZtXyApOworICAgICAgICArK3VzZV9jb3VudF87CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCAmbV8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcHRocmVhZF9tdXRleF9sb2NrKCAmbV8gKTsKKyAgICAgICAgYm9vbCByID0gdXNlX2NvdW50XyA9PSAwPyBmYWxzZTogKCArK3VzZV9jb3VudF8sIHRydWUgKTsKKyAgICAgICAgcHRocmVhZF9tdXRleF91bmxvY2soICZtXyApOworICAgICAgICByZXR1cm4gcjsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soICZtXyApOworICAgICAgICBsb25nIG5ld191c2VfY291bnQgPSAtLXVzZV9jb3VudF87CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCAmbV8gKTsKKworICAgICAgICBpZiggbmV3X3VzZV9jb3VudCA9PSAwICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJm1fICk7CisgICAgICAgICsrd2Vha19jb3VudF87CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCAmbV8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJm1fICk7CisgICAgICAgIGxvbmcgbmV3X3dlYWtfY291bnQgPSAtLXdlYWtfY291bnRfOworICAgICAgICBwdGhyZWFkX211dGV4X3VubG9jayggJm1fICk7CisKKyAgICAgICAgaWYoIG5ld193ZWFrX2NvdW50ID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVzZV9jb3VudCgpIGNvbnN0IC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfbG9jayggJm1fICk7CisgICAgICAgIGxvbmcgciA9IHVzZV9jb3VudF87CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCAmbV8gKTsKKworICAgICAgICByZXR1cm4gcjsKKyAgICB9Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VuZGlmICAvLyAjaWZuZGVmIEJPT1NUX1NNQVJUX1BUUl9ERVRBSUxfU1BfQ09VTlRFRF9CQVNFX1BUX0hQUF9JTkNMVURFRApkaWZmIC0tZ2l0IGEvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2Vfc25jX3BzMy5ocHAgYi9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2N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Ly8KKy8vICBUaGFua3MgdG8gTWljaGFlbCB2YW4gZGVyIFdlc3RodWl6ZW4KKworI2luY2x1ZGUgPG5kbmJvb3N0L2RldGFpbC9zcF90eXBlaW5mby5ocHA+CisjaW5jbHVkZSA8aW50dHlwZXMuaD4gLy8gdWludDMyX3QKKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworaW5saW5lIHVpbnQzMl90IGNvbXBhcmVfYW5kX3N3YXAoIHVpbnQzMl90ICogZGVzdF8sIHVpbnQzMl90IGNvbXBhcmVfLCB1aW50MzJfdCBzd2FwXyApCit7CisgICAgcmV0dXJuIF9fYnVpbHRpbl9jZWxsQXRvbWljQ29tcGFyZUFuZFN3YXAzMihkZXN0Xyxjb21wYXJlXyxzd2FwXyk7Cit9CisKK2lubGluZSB1aW50MzJfdCBhdG9taWNfZmV0Y2hfYW5kX2FkZCggdWludDMyX3QgKiBwdywgdWludDMyX3QgZHYgKQoreworICAgIC8vIGxvbmcgciA9ICpwdzsKKyAgICAvLyAqcHcgKz0gZHY7CisgICAgLy8gcmV0dXJuIHI7CisKKyAgICBmb3IoIDs7ICkKKyAgICB7CisgICAgICAgIHVpbnQzMl90IHIgPSAqcHc7CisKKyAgICAgICAgaWYoIF9fYnVpbHRpbl9leHBlY3QoKGNvbXBhcmVfYW5kX3N3YXAocHcsIHIsIHIgKyBkdikgPT0gciksIDEpICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHI7CisgICAgICAgIH0KKyAgICB9Cit9CisKK2lubGluZSB2b2lkIGF0b21pY19pbmNyZW1lbnQoIHVpbnQzMl90ICogcHcgKQoreworICAgICh2b2lkKSBfX2J1aWx0aW5fY2VsbEF0b21pY0luY3IzMiggcHcgKTsKK30KKworaW5saW5lIHVpbnQzMl90IGF0b21pY19kZWNyZW1lbnQoIHVpbnQzMl90ICogcHcgKQoreworICAgIHJldHVybiBfX2J1aWx0aW5fY2VsbEF0b21pY0RlY3IzMiggcHcgKTsKK30KKworaW5saW5lIHVpbnQzMl90IGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoIHVpbnQzMl90ICogcHcgKQoreworICAgIC8vIGxvbmcgciA9ICpwdzsKKyAgICAvLyBpZiggciAhPSAwICkgKysqcHc7CisgICAgLy8gcmV0dXJuIHI7CisKKyAgICBmb3IoIDs7ICkKKyAgICB7CisgICAgICAgIHVpbnQzMl90IHIgPSAqcHc7CisKKyAgICAgICAgaWYoIHIgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiByOworICAgICAgICB9CisKKyAgICAgICAgaWYoIF9fYnVpbHRpbl9leHBlY3QoICggY29tcGFyZV9hbmRfc3dhcCggcHcsIHIsIHIgKyAxICkgPT0gciApLCAxICkgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorICAgIH0gICAgCit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgdWludDMyX3QgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICB1aW50MzJfdCB3ZWFrX2NvdW50XzsgICAgICAgLy8gI3dlYWsgKyAoI3NoYXJlZCAhPSAwKQorCitwdWJsaWM6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoKTogdXNlX2NvdW50XyggMSApLCB3ZWFrX2NvdW50XyggMSApCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgfnNwX2NvdW50ZWRfYmFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgfQorCisgICAgLy8gZGlzcG9zZSgpIGlzIGNhbGxlZCB3aGVuIHVzZV9jb3VudF8gZHJvcHMgdG8gemVybywgdG8gcmVsZWFzZQorICAgIC8vIHRoZSByZXNvdXJjZXMgbWFuYWdlZCBieSAqdGhpcy4KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgPSAwOyAvLyBub3Rocm93CisKKyAgICAvLyBkZXN0cm95KCkgaXMgY2FsbGVkIHdoZW4gd2Vha19jb3VudF8gZHJvcHMgdG8gemVyby4KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsZXRlIHRoaXM7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X2RlbGV0ZXIoIHNwX3R5cGVpbmZvIGNvbnN0ICYgdGkgKSA9IDA7CisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpID0gMDsKKworICAgIHZvaWQgYWRkX3JlZl9jb3B5KCkKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIHJldHVybiBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApICE9IDA7CisgICAgfQorCisgICAgdm9pZCByZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ1c2VfY291bnRfICkgPT0gMSApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRpc3Bvc2UoKTsKKyAgICAgICAgICAgIHdlYWtfcmVsZWFzZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB3ZWFrX2FkZF9yZWYoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmd2Vha19jb3VudF8gKTsKKyAgICB9CisKKyAgICB2b2lkIHdlYWtfcmVsZWFzZ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qcHc7Cit9CisKK2lubGluZSBpbnQgYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggaW50ICogcHcgKQoreworICAgIHNwaW5sb2NrX3Bvb2w8MT46OnNjb3BlZF9sb2NrIGxvY2soIHB3ICk7CisKKyAgICBpbnQgcnYgPSAqcHc7CisgICAgaWYoIHJ2ICE9IDAgKSArKypwdzsKKyAgICByZXR1cm4gcnY7Cit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgaW50IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2V4Y2hhbmdlX2FuZF9hZGQoICZ1c2VfY291bnRfLCAtMSApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2V4Y2hhbmdlX2FuZF9hZGQoICZ3ZWFrX2NvdW50XywgLTEgKSA9PSAxICkKKyAgICAgICAgeworICAgICAgICAgICAgZGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorCisgICAgbG9uZyB1c2VfY291bnQoKSBjb25zdCAvLyBub3Rocm93CisgICAgeworICAgICAgICBzcGlubG9ja19wb29sPDE+OjpzY29wZWRfbG9jayBsb2NrKCAmdXNlX2N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KyAgICB7CisgICAgICAgIGlmKCByID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICByZXR1cm4gcjsKKyAgICAgICAgfQorCisgICAgICAgIHNwX2ludDMyX3QgcjIgPSBfX3N5bmNfdmFsX2NvbXBhcmVfYW5kX3N3YXAoIHB3LCByLCByICsgMSApOworCisgICAgICAgIGlmKCByMiA9PSByICkKKyAgICAgICAgeworICAgICAgICAgICAgcmV0dXJuIHI7CisgICAgICAgIH0KKyAgICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgICByID0gcjI7CisgICAgICAgIH0KKyAgICB9ICAgIAorfQorCitjbGFzcyBzcF9jb3VudGVkX2Jhc2UKK3sKK3ByaXZhdGU6CisKKyAgICBzcF9jb3VudGVkX2Jhc2UoIHNwX2NvdW50ZWRfYmFzZSBjb25zdCAmICk7CisgICAgc3BfY291bnRlZF9iYXNlICYgb3BlcmF0b3I9ICggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKworICAgIHNwX2ludDMyX3QgdXNlX2NvdW50XzsgICAgICAgIC8vICNzaGFyZWQKKyAgICBzcF9pbnQzMl90IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisKK3B1YmxpYzoKKworICAgIHNwX2NvdW50ZWRfYmFzZSgpOiB1c2VfY291bnRfKCAxICksIHdlYWtfY291bnRfKCAxICkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+c3BfY291bnRlZF9iYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICB9CisKKyAgICAvLyBkaXNwb3NlKCkgaXMgY2FsbGVkIHdoZW4gdXNlX2NvdW50XyBkcm9wcyB0byB6ZXJvLCB0byByZWxlYXNlCisgICAgLy8gdGhlIHJlc291cmNlcyBtYW5hZ2VkIGJ5ICp0aGlzLgorCisgICAgdmlydHVhbCB2b2lkIGRpc3Bvc2UoKSA9IDA7IC8vIG5vdGhyb3cKKworICAgIC8vIGRlc3Ryb3koKSBpcyBjYWxsZWQgd2hlbiB3ZWFrX2NvdW50XyBkcm9wcyB0byB6ZXJvLgorCisgICAgdmlydHVhbCB2b2lkIGRlc3Ryb3koKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBkZWxldGUgdGhpczsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggc3BfdHlwZWluZm8gY29uc3QgJiB0aSApID0gMDsKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfdW50eXBlZF9kZWxldGVyKCkgPSAwOworCisgICAgdm9pZCBhZGRfcmVmX2NvcHkoKQorICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJnVzZV9jb3VudF8gKTsKKyAgICB9CisKKyAgICBib29sIGFkZF9yZWZfbG9jaygpIC8vIHRydWUgb24gc3VjY2VzcworICAgIHsKKyAgICAgICAgcmV0dXJuIGF0b21pY19jb25kaXRpb25hbF9pbmNyZW1lbnQoICZ1c2VfY291bnRfICkgIT0gMDsKKyAgICB9CisKKyAgICB2b2lkIHJlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJnVzZV9jb3VudF8gKSA9PSAxICkKKyAgICAgICAgeworICAgICAgICAgICAgZGlzcG9zZSgpOworICAgICAgICAgICAgd2Vha19yZWxlYXNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHdlYWtfYWRkX3JlZigpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGF0b21pY19pbmNyZW1lbnQoICZ3ZWFrX2NvdW50XyApOworICAgIH0KKworICAgIHZvaWQgd2Vha19yZWxlYXNlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgaWYoIGF0b21pY19kZWNyZW1lbnQoICZ3ZWFrX2NvdW50XyApID09IDEgKQorICAgICAgICB7CisgICAgICAgICAgICBkZXN0cm95KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBsb25nIHVz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ArKypwdzsKKyAgIF9fbHdzeW5jKCk7CisgICBfX2ZldGNoX2FuZF9hZGQocHcsIDEpOworICAgX19pc3luYygpOworfSAKKworaW5saW5lIGludCBhdG9taWNfZGVjcmVtZW50KCBpbnQgKnB3ICkKK3sKKyAgIC8vIHJldHVybiAtLSpwdzsKKyAgIF9fbHdzeW5jKCk7CisgICBpbnQgb3JpZ2luYWxWYWx1ZSA9IF9fZmV0Y2hfYW5kX2FkZChwdywgLTEpOworICAgX19pc3luYygpOworCisgICByZXR1cm4gKG9yaWdpbmFsVmFsdWUgLSAxKTsKK30KKworaW5saW5lIGludCBhdG9taWNfY29uZGl0aW9uYWxfaW5jcmVtZW50KCBpbnQgKnB3ICkKK3sKKyAgIC8vIGlmKCAqcHcgIT0gMCApICsrKnB3OworICAgLy8gcmV0dXJuICpwdzsKKworICAgX19sd3N5bmMoKTsKKyAgIGludCB2ID0gKmNvbnN0X2Nhc3Q8dm9sYXRpbGUgaW50Kj4ocHcpOworICAgZm9yICg7OykKKyAgIC8vIGxvb3AgdW50aWwgc3RhdGUgaXMga25vd24KKyAgIHsKKyAgICAgIGlmICh2ID09IDApIHJldHVybiAwOworICAgICAgaWYgKF9fY29tcGFyZV9hbmRfc3dhcChwdywgJnYsIHYgKyAxKSkKKyAgICAgIHsKKyAgICAgICAgIF9faXN5bmMoKTsgcmV0dXJuICh2ICsgMSk7CisgICAgICB9CisgICB9Cit9CisKK2NsYXNzIHNwX2NvdW50ZWRfYmFzZQoreworcHJpdmF0ZToKKworICAgIHNwX2NvdW50ZWRfYmFzZSggc3BfY291bnRlZF9iYXNlIGNvbnN0ICYgKTsKKyAgICBzcF9jb3VudGVkX2Jhc2UgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2Jhc2UgY29uc3QgJiApOworCisgICAgaW50IHVzZV9jb3VudF87ICAgICAgICAvLyAjc2hhcmVkCisgICAgaW50IHdlYWtfY291bnRfOyAgICAgICAvLyAjd2VhayArICgjc2hhcmVkICE9IDApCisgICAgY2hhciBwYWRbNjRdIF9fYXR0cmlidXRlX18oKF9fYWxpZ25lZF9fKDY0KSkpOworICAgICAgICAgICAgLy8gcGFkIHRvIHByZXZlbnQgZmFsc2Ugc2hhcmluZworcHVibGljOgorCisgICAgc3BfY291bnRlZF9iYXNlKCk6IHVzZV9jb3VudF8oIDEgKSwgd2Vha19jb3VudF8oIDEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIH5zcF9jb3VudGVkX2Jhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgIH0KKworICAgIC8vIGRpc3Bvc2UoKSBpcyBjYWxsZWQgd2hlbiB1c2VfY291bnRfIGRyb3BzIHRvIHplcm8sIHRvIHJlbGVhc2UKKyAgICAvLyB0aGUgcmVzb3VyY2VzIG1hbmFnZWQgYnkgKnRoaXMuCisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpID0gMDsgLy8gbm90aHJvdworCisgICAgLy8gZGVzdHJveSgpIGlzIGNhbGxlZCB3aGVuIHdlYWtfY291bnRfIGRyb3BzIHRvIHplcm8uCisKKyAgICB2aXJ0dWFsIHZvaWQgZGVzdHJveSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRlbGV0ZSB0aGlzOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBhdG9taWNfaW5jcmVtZW50KCAmdXNlX2NvdW50XyApOworICAgIH0KKworICAgIGJvb2wgYWRkX3JlZl9sb2NrKCkgLy8gdHJ1ZSBvbiBzdWNjZXNzCisgICAgeworICAgICAgICByZXR1cm4gYXRvbWljX2NvbmRpdGlvbmFsX2luY3JlbWVudCggJnVzZV9jb3VudF8gKSAhPSAwOworICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlmKCBhdG9taWNfZGVjcmVtZW50KCAmdXNlX2NvdW50XyApID09IDAgKQorICAgICAgICB7CisgICAgICAgICAgICBkaXNwb3NlKCk7CisgICAgICAgICAgICB3ZWFrX3JlbGVhc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgd2Vha19hZGRfcmVmKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgYXRvbWljX2luY3JlbWVudCggJndlYWtfY291bnRfICk7CisgICAgfQorCisgICAgdm9pZCB3ZWFrX3JlbGVhc2UoKSAvLyBub3Rocm93CisgICAgeworICAgICAgICBpZiggYXRvbWljX2RlY3JlbWVudCggJndlYWtfY291bnRfICkgPT0gMCApCisgICAgICAgIHsKKyAgICAgICAgICAgIGRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGxvbmcgdXNlX2NvdW50KCkgY29uc3QgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgcmV0dXJuICpjb25zdF9jYXN0PHZvbGF0aWxlIGludCo+KCZ1c2VfY291bnRfKTsgCisgICAgfQorfTsKKworfSAvLyBuYW1lc3BhY2UgZGV0YWlsCisKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNlbmRpZiAgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX1NQX0NPVU5URURfQkFTRV9WQUNQUF9QUENfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3NwX2NvdW50ZWRfYmFzZV93MzIuaHBwIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC9zcF9jb3VudGVkX2Jhc2VfdzMyLmhwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4yODNmYzc5Ci0tLSAvZGV2L251bGwKKysrIG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ICAgIHZpcnR1YWwgdm9pZCAqIGdldF9kZWxldGVyKCBzcF90eXBlaW5mbyBjb25zdCAmIHRpICkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKSA9IDA7CisKKyAgICB2b2lkIGFkZF9yZWZfY29weSgpCisgICAgeworICAgICAgICBCT09TVF9JTlRFUkxPQ0tFRF9JTkNSRU1FTlQoICZ1c2VfY291bnRfICk7CisgICAgfQorCisgICAgYm9vbCBhZGRfcmVmX2xvY2soKSAvLyB0cnVlIG9uIHN1Y2Nlc3MKKyAgICB7CisgICAgICAgIGZvciggOzsgKQorICAgICAgICB7CisgICAgICAgICAgICBsb25nIHRtcCA9IHN0YXRpY19jYXN0PCBsb25nIGNvbnN0IHZvbGF0aWxlJiA+KCB1c2VfY291bnRfICk7CisgICAgICAgICAgICBpZiggdG1wID09IDAgKSByZXR1cm4gZmFsc2U7CisKKyNpZiBkZWZpbmVkKCBCT09TVF9NU1ZDICkgJiYgQk9PU1RfV09SS0FST1VORCggQk9PU1RfTVNWQywgPT0gMTIwMCApCisKKyAgICAgICAgICAgIC8vIHdvcmsgYXJvdW5kIGEgY29kZSBnZW5lcmF0aW9uIGJ1ZworCisgICAgICAgICAgICBsb25nIHRtcDIgPSB0bXAgKyAxOworICAgICAgICAgICAgaWYoIEJPT1NUX0lOVEVSTE9DS0VEX0NPTVBBUkVfRVhDSEFOR0UoICZ1c2VfY291bnRfLCB0bXAyLCB0bXAgKSA9PSB0bXAyIC0gMSApIHJldHVybiB0cnVlOworCisjZWxzZQorCisgICAgICAgICAgICBpZiggQk9PU1RfSU5URVJMT0NLRURfQ09NUEFSRV9FWENIQU5HRSggJnVzZV9jb3VudF8sIHRtcCArIDEsIHRtcCApID09IHRtcCApIHJldHVybiB0cnVlOworCisjZW5kaWYKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcmVsZWFzZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGlm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QgJiBvcGVyYXRvcj0gKCBzcF9jb3VudGVkX2ltcGxfcGQgY29uc3QgJiApOworCisgICAgdHlwZWRlZiBzcF9jb3VudGVkX2ltcGxfcGQ8UCwgRD4gdGhpc190eXBlOworCitwdWJsaWM6CisKKyAgICAvLyBwcmU6IGQocCkgbXVzdCBub3QgdGhyb3cKKworICAgIHNwX2NvdW50ZWRfaW1wbF9wZCggUCBwLCBEICYgZCApOiBwdHIoIHAgKSwgZGVsKCBkICkKKyAgICB7CisgICAgfQorCisgICAgc3BfY291bnRlZF9pbXBsX3BkKCBQIHAgKTogcHRyKCBwICksIGRlbCgpCisgICAgeworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBkaXNwb3NlKCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgZGVsKCBwdHIgKTsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggZGV0YWlsOjpzcF90eXBlaW5mbyBjb25zdCAmIHRpICkKKyAgICB7CisgICAgICAgIHJldHVybiB0aSA9PSBCT09TVF9TUF9UWVBFSUQoRCk/ICZyZWludGVycHJldF9jYXN0PGNoYXImPiggZGVsICk6IDA7CisgICAgfQorCisgICAgdmlydHVhbCB2b2lkICogZ2V0X3VudHlwZWRfZGVsZXRlcigpCisgICAgeworICAgICAgICByZXR1cm4gJnJlaW50ZXJwcmV0X2Nhc3Q8Y2hhciY+KCBkZWwgKTsKKyAgICB9CisKKyNpZiBkZWZpbmVkKEJPT1NUX1NQX1VTRV9TVERfQUxMT0NBVE9SKQorCisgICAgdm9pZCAqIG9wZXJhdG9yIG5ldyggc3RkOjpzaXplX3QgKQorICAgIHsKKyAgICAgICAgcmV0dXJuIHN0ZDo6YWxsb2NhdG9yPHRoaXNfdHlwZT4oKS5hbGxvY2F0ZSggMSwgc3RhdGljX2Nhc3Q8dGhpc190eXBlICo+KDApICk7CisgICAgfQorCisgICAgdm9pZCBvcGVyYXRvciBkZWxldGUoIHZvaWQgKiBw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HAgKSBtdXN0IG5vdCB0aHJvdworCisgICAgc3BfY291bnRlZF9pbXBsX3BkYSggUCBwLCBEICYgZCwgQSBhICk6IHBfKCBwICksIGRfKCBkICksIGFfKCBhICkKKyAgICB7CisgICAgfQorCisgICAgc3BfY291bnRlZF9pbXBsX3BkYSggUCBwLCBBIGEgKTogcF8oIHAgKSwgZF8oKSwgYV8oIGEgKQorICAgIHsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgZGlzcG9zZSgpIC8vIG5vdGhyb3cKKyAgICB7CisgICAgICAgIGRfKCBwXyApOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBkZXN0cm95KCkgLy8gbm90aHJvdworICAgIHsKKyAgICAgICAgdHlwZWRlZiB0eXBlbmFtZSBBOjp0ZW1wbGF0ZSByZWJpbmQ8IHRoaXNfdHlwZSA+OjpvdGhlciBBMjsKKworICAgICAgICBBMiBhMiggYV8gKTsKKworICAgICAgICB0aGlzLT5+dGhpc190eXBlKCk7CisgICAgICAgIGEyLmRlYWxsb2NhdGUoIHRoaXMsIDEgKTsKKyAgICB9CisKKyAgICB2aXJ0dWFsIHZvaWQgKiBnZXRfZGVsZXRlciggZGV0YWlsOjpzcF90eXBlaW5mbyBjb25zdCAmIHRpICkKKyAgICB7CisgICAgICAgIHJldHVybiB0aSA9PSBCT09TVF9TUF9UWVBFSUQoIEQgKT8gJnJlaW50ZXJwcmV0X2Nhc3Q8Y2hhciY+KCBkXyApOiAwOworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCAqIGdldF91bnR5cGVkX2RlbGV0ZXIoKQorICAgIHsKKyAgICAgICAgcmV0dXJuICZyZWludGVycHJldF9jYXN0PGNoYXImPiggZF8gKTsKKyAgICB9Cit9OworCisjaWZkZWYgX19DT0RFR1VBUkRfXworIyBwcmFnbWEgb3B0aW9uIHBvcAorI2VuZGlmCisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAor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NQX0FSTV9IQVNfTERSRVgKKworI2Vsc2UKKworIyBkZWZpbmUgQk9PU1RfU1BfQVJNX0JBUlJJRVIgIiIKKworI2VuZGlmCisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK2NsYXNzIHNwaW5sb2NrCit7CitwdWJsaWM6CisKKyAgICBpbnQgdl87CisKK3B1YmxpYzoKKworICAgIGJvb2wgdHJ5X2xvY2soKQorICAgIHsKKyAgICAgICAgaW50IHI7CisKKyNpZmRlZiBCT09TVF9TUF9BUk1fSEFTX0xEUkVYCisKKyAgICAgICAgX19hc21fXyBfX3ZvbGF0aWxlX18oCisgICAgICAgICAgICAibGRyZXggJTAsIFslMl07IFxuIgorICAgICAgICAgICAgImNtcCAlMCwgJTE7IFxuIgorICAgICAgICAgICAgInN0cmV4bmUgJTAsICUxLCBbJTJdOyBcbiIKKyAgICAgICAgICAgIEJPT1NUX1NQX0FSTV9CQVJSSUVSIDoKKyAgICAgICAgICAgICI9JnIiKCByICk6IC8vIG91dHB1dHMKKyAgICAgICAgICAgICJyIiggMSApLCAiciIoICZ2XyApOiAvLyBpbnB1dHMKKyAgICAgICAgICAgICJtZW1vcnkiLCAiY2MiICk7CisKKyNlbHNlCisKKyAgICAgICAgX19hc21fXyBfX3ZvbGF0aWxlX18oCisgICAgICAgICAgICAic3dwICUwLCAlMSwgWyUyXTtcbiIKKyAgICAgICAgICAgIEJPT1NUX1NQX0FSTV9CQVJSSUVSIDoKKyAgICAgICAgICAgICI9JnIiKCByICk6IC8vIG91dHB1dHMKKyAgICAgICAgICAgICJyIiggMSApLCAiciIoICZ2XyApOiAvLyBpbnB1dHMKKyAgICAgICAgICAgICJtZW1vcnkiLCAiY2MiICk7CisKKyNlbmRpZgorCisgICAgICAgIHJldHVybiByID09IDA7CisgICAgfQorCisgICAgdm9pZCBsb2NrKCkKKyAgICB7CisgICAgICAgIGZvciggdW5zaWduZWQgayA9IDA7ICF0cnlfbG9jaygpOyArK2sgKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6ZGV0YWlsOjp5aWVsZCggayApOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB1bmxvY2soKQorICAgIHsKKyAgICAgICAgX19hc21fXyBfX3ZvbGF0aWxlX18oIEJPT1NUX1NQX0FSTV9CQVJSSUVSIDo6OiAibWVtb3J5IiApOworICAgICAgICAqY29uc3RfY2FzdDwgaW50IHZvbGF0aWxlKiA+KCAmdl8gKSA9IDA7CisgICAgfQorCitwdWJsaWM6CisKKyAgICBjbGFzcyBzY29wZWRfbG9jaworICAgIHsKKyAgICBwcml2YXRlOgorCisgICAgICAgIHNwaW5sb2NrICYgc3BfOworCisgICAgICAgIHNjb3BlZF9sb2NrKCBzY29wZWRfbG9jayBjb25zdCAmICk7CisgICAgICAgIHNjb3BlZF9sb2NrICYgb3BlcmF0b3I9KCBzY29wZWRfbG9jayBjb25zdCAmICk7CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgZXhwbGljaXQgc2NvcGVkX2xvY2soIHNwaW5sb2NrICYgc3AgKTogc3BfKCBzcCApCisgICAgICAgIHsKKyAgICAgICAgICAgIHNwLmxvY2soKTsKKyAgICAgICAgfQorCisgICAgICAgIH5zY29wZWRfbG9jaygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHNwXy51bmxvY2soKTsKKyAgICAgICAgfQorICAgIH07Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNkZWZpbmUgQk9PU1RfREVUQUlMX1NQSU5MT0NLX0lOSVQgezB9CisKKyN1bmRlZiBCT09TVF9TUF9BUk1fQkFSUklFUgorI3VuZGVmIEJPT1NUX1NQX0FSTV9IQVNfTERSRVgKKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUElOTE9DS19HQ0NfQVJNX0hQUF9JTkNMVURFRApkaWZmIC0tZ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G9jaygpCisgICAgeworICAgICAgICBpZiggbG9ja2VkXyApCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlCisgICAgICAgIHsKKyAgICAgICAgICAgIGxvY2tlZF8gPSB0cnVlOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpbmxpbmUgdm9pZCBsb2NrKCkKKyAgICB7CisgICAgICAgIEJPT1NUX0FTU0VSVCggIWxvY2tlZF8gKTsKKyAgICAgICAgbG9ja2VkXyA9IHRydWU7CisgICAgfQorCisgICAgaW5saW5lIHZvaWQgdW5sb2NrKCkKKyAgICB7CisgICAgICAgIEJPT1NUX0FTU0VSVCggbG9ja2VkXyApOworICAgICAgICBsb2NrZWRfID0gZmFsc2U7CisgICAgfQorCitwdWJsaWM6CisKKyAgICBjbGFzcyBzY29wZWRfbG9jaworICAgIHsKKyAgICBwcml2YXRlOgorCisgICAgICAgIHNwaW5sb2NrICYgc3BfOworCisgICAgICAgIHNjb3BlZF9sb2NrKCBzY29wZWRfbG9jayBjb25zdCAmICk7CisgICAgICAgIHNjb3BlZF9sb2NrICYgb3BlcmF0b3I9KCBzY29wZWRfbG9jayBjb25zdCAmICk7CisKKyAgICBwdWJsaWM6CisKKyAgICAgICAgZXhwbGljaXQgc2NvcGVkX2xvY2soIHNwaW5sb2NrICYgc3AgKTogc3BfKCBzcCApCisgICAgICAgIHsKKyAgICAgICAgICAgIHNwLmxvY2soKTsKKyAgICAgICAgfQorCisgICAgICAgIH5zY29wZWRfbG9jaygpCisgICAgICAgIHsKKyAgICAgICAgICAgIHNwXy51bmxvY2soKTsKKyAgICAgICAgfQorICAgIH07Cit9OworCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKK30gLy8gbmFtZXNwYWNlIG5kbmJvb3N0CisKKyNkZWZpbmUgQk9PU1RfREVUQUlMX1NQSU5MT0NLX0lOSVQgeyBmYWxzZSB9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Y2sKK3sKK3B1YmxpYzoKKworICAgIHB0aHJlYWRfbXV0ZXhfdCB2XzsKKworcHVibGljOgorCisgICAgYm9vbCB0cnlfbG9jaygpCisgICAgeworICAgICAgICByZXR1cm4gcHRocmVhZF9tdXRleF90cnlsb2NrKCAmdl8gKSA9PSAwOworICAgIH0KKworICAgIHZvaWQgbG9jaygpCisgICAgeworICAgICAgICBwdGhyZWFkX211dGV4X2xvY2soICZ2XyApOworICAgIH0KKworICAgIHZvaWQgdW5sb2NrKCkKKyAgICB7CisgICAgICAgIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCAmdl8gKTsKKyAgICB9CisKK3B1YmxpYzoKKworICAgIGNsYXNzIHNjb3BlZF9sb2NrCisgICAgeworICAgIHByaXZhdGU6CisKKyAgICAgICAgc3BpbmxvY2sgJiBzcF87CisKKyAgICAgICAgc2NvcGVkX2xvY2soIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKyAgICAgICAgc2NvcGVkX2xvY2sgJiBvcGVyYXRvcj0oIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKworICAgIHB1YmxpYzoKKworICAgICAgICBleHBsaWNpdCBzY29wZWRfbG9jayggc3BpbmxvY2sgJiBzcCApOiBzcF8oIHNwICkKKyAgICAgICAgeworICAgICAgICAgICAgc3AubG9jaygpOworICAgICAgICB9CisKKyAgICAgICAgfnNjb3BlZF9sb2NrKCkKKyAgICAgICAgeworICAgICAgICAgICAgc3BfLnVubG9jaygpOworICAgICAgICB9CisgICAgfTsKK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2RlZmluZSBCT09TVF9ERVRBSUxfU1BJTkxPQ0tfSU5JVCB7IFBUSFJFQURfTVVURVhfSU5JVElBTElaRVIgfQorCisjZW5kaWYgLy8gI2lmbmRlZiBCT09TVF9TTUFSVF9QVFJfREVUQUlMX1NQSU5MT0NLX1BUX0hQUF9JTkNMVURFRApkaWZmI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mRpZgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitjbGFzcyBzcGlubG9jaworeworcHVibGljOgorCisgICAgaW50IHZfOworCitwdWJsaWM6CisKKyAgICBib29sIHRyeV9sb2NrKCkKKyAgICB7CisgICAgICAgIGludCByID0gX19zeW5jX2xvY2tfdGVzdF9hbmRfc2V0KCAmdl8sIDEgKTsKKyAgICAgICAgcmV0dXJuIHIgPT0gMDsKKyAgICB9CisKKyAgICB2b2lkIGxvY2soKQorICAgIHsKKyAgICAgICAgZm9yKCB1bnNpZ25lZCBrID0gMDsgIXRyeV9sb2NrKCk7ICsrayApCisgICAgICAgIHsKKyAgICAgICAgICAgIG5kbmJvb3N0OjpkZXRhaWw6OnlpZWxkKCBrICk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHVubG9jaygpCisgICAgeworICAgICAgICBfX3N5bmNfbG9ja19yZWxlYXNlKCAmdl8gKTsKKyAgICB9CisKK3B1YmxpYzoKKworICAgIGNsYXNzIHNjb3BlZF9sb2NrCisgICAgeworICAgIHByaXZhdGU6CisKKyAgICAgICAgc3BpbmxvY2sgJiBzcF87CisKKyAgICAgICAgc2NvcGVkX2xvY2soIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKyAgICAgICAgc2NvcGVkX2xvY2sgJiBvcGVyYXRvcj0oIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKworICAgIHB1YmxpYzoKKworICAgICAgICBleHBsaWNpdCBzY29wZWRfbG9jayggc3BpbmxvY2sgJiBzcCApOiBzcF8oIHNwICkKKyAgICAgICAgeworICAgICAgICAgICAgc3AubG9jaygpOworICAgICAgICB9CisKKyAgICAgICAgfnNjb3BlZF9sb2NrKCkKKyAgICAgICAgeworICAgICAgICAgICAgc3BfLnVubG9jaygpOworICAgICAgICB9CisgICAgfTsKK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorfSAvLyBuYW1lc3BhY2Ugbm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WQgayA9IDA7ICF0cnlfbG9jaygpOyArK2sgKQorICAgICAgICB7CisgICAgICAgICAgICBuZG5ib29zdDo6ZGV0YWlsOjp5aWVsZCggayApOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCB1bmxvY2soKQorICAgIHsKKyAgICAgICAgQk9PU1RfQ09NUElMRVJfRkVOQ0UKKyAgICAgICAgKmNvbnN0X2Nhc3Q8IGxvbmcgdm9sYXRpbGUqID4oICZ2XyApID0gMDsKKyAgICB9CisKK3B1YmxpYzoKKworICAgIGNsYXNzIHNjb3BlZF9sb2NrCisgICAgeworICAgIHByaXZhdGU6CisKKyAgICAgICAgc3BpbmxvY2sgJiBzcF87CisKKyAgICAgICAgc2NvcGVkX2xvY2soIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKyAgICAgICAgc2NvcGVkX2xvY2sgJiBvcGVyYXRvcj0oIHNjb3BlZF9sb2NrIGNvbnN0ICYgKTsKKworICAgIHB1YmxpYzoKKworICAgICAgICBleHBsaWNpdCBzY29wZWRfbG9jayggc3BpbmxvY2sgJiBzcCApOiBzcF8oIHNwICkKKyAgICAgICAgeworICAgICAgICAgICAgc3AubG9jaygpOworICAgICAgICB9CisKKyAgICAgICAgfnNjb3BlZF9sb2NrKCkKKyAgICAgICAgeworICAgICAgICAgICAgc3BfLnVubG9jaygpOworICAgICAgICB9CisgICAgfTsKK307CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2RlZmluZSBCT09TVF9ERVRBSUxfU1BJTkxPQ0tfSU5JVCB7MH0KKworI2VuZGlmIC8vICNpZm5kZWYgQk9PU1RfU01BUlRfUFRSX0RFVEFJTF9TUElOTE9DS19XMzJfSFBQX0lOQ0xVREVECmRpZmYgLS1naXQgYS9uZG5ib29zdC9zbWFydF9wdHIvZGV0YWlsL3lpZWxkX2suaHBwIGIvbmRuYm9vc3Qvc21hcnRfcHRyL2RldGFpbC95aWVsZF9rLm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KF9NX1g2NCkgKQorCitleHRlcm4gIkMiIHZvaWQgX21tX3BhdXNlKCk7CisjcHJhZ21hIGludHJpbnNpYyggX21tX3BhdXNlICkKKworI2RlZmluZSBCT09TVF9TTVRfUEFVU0UgX21tX3BhdXNlKCk7CisKKyNlbGlmIGRlZmluZWQoX19HTlVDX18pICYmICggZGVmaW5lZChfX2kzODZfXykgfHwgZGVmaW5lZChfX3g4Nl82NF9fKSApCisKKyNkZWZpbmUgQk9PU1RfU01UX1BBVVNFIF9fYXNtX18gX192b2xhdGlsZV9fKCAicmVwOyBub3AiIDogOiA6ICJtZW1vcnkiICk7CisKKyNlbmRpZgorCisvLworCisjaWYgZGVmaW5lZCggV0lOMzIgKSB8fCBkZWZpbmVkKCBfV0lOMzIgKSB8fCBkZWZpbmVkKCBfX1dJTjMyX18gKSB8fCBkZWZpbmVkKCBfX0NZR1dJTl9fICkKKworI2lmIGRlZmluZWQoIEJPT1NUX1VTRV9XSU5ET1dTX0ggKQorIyBpbmNsdWRlIDx3aW5kb3dzLmg+CisjZW5kaWYKKworbmFtZXNwYWNlIG5kbmJvb3N0Cit7CisKK25hbWVzcGFjZSBkZXRhaWwKK3sKKworI2lmICFkZWZpbmVkKCBCT09TVF9VU0VfV0lORE9XU19IICkKKyAgZXh0ZXJuICJDIiB2b2lkIF9fc3RkY2FsbCBTbGVlcCggdW5zaWduZWQgbG9uZyBtcyApOworI2VuZGlmCisKK2lubGluZSB2b2lkIHlpZWxkKCB1bnNpZ25lZCBrICkKK3sKKyAgICBpZiggayA8IDQgKQorICAgIHsKKyAgICB9CisjaWYgZGVmaW5lZCggQk9PU1RfU01UX1BBVVNFICkKKyAgICBlbHNlIGlmKCBrIDwgMTYgKQorICAgIHsKKyAgICAgICAgQk9PU1RfU01UX1BBVVNFCisgICAgfQorI2VuZGlmCisgICAgZWxzZSBpZiggayA8IDMyICkKKyAgICB7CisgICAgICAgIFNsZWVwKCAwICk7CisgICAgfQorICAgIGVsc2UKKyAgICB7CisgICAgICAgIFNsZWVwKCAxICk7CisgICAgfQorfQorCit9IC8vIG5hbWVzcGFjZSBkZXRhaWwKKworfSAvLyBuYW1lc3BhY2UgbmRuYm9vc3QKKworI2VsaWYgZGVmaW5lZCggQk9PU1RfSEFTX1BUSFJFQURTICkKKworI2luY2x1ZGUgPHNjaGVkLmg+CisjaW5jbHVkZSA8dGltZS5oPgorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFtZXNwYWNlIGRldGFpbAoreworCitpbmxpbmUgdm9pZCB5aWVsZCggdW5zaWduZWQgayApCit7CisgICAgaWYoIGsgPCA0ICkKKyAgICB7CisgICAgfQorI2lmIGRlZmluZWQoIEJPT1NUX1NNVF9QQVVTRSApCisgICAgZWxzZSBpZiggayA8IDE2ICkKKyAgICB7CisgICAgICAgIEJPT1NUX1NNVF9QQVVTRQorICAgIH0KKyNlbmRpZgorICAgIGVsc2UgaWYoIGsgPCAzMiB8fCBrICYgMSApCisgICAgeworICAgICAgICBzY2hlZF95aWVsZCgpOworICAgIH0KKyAgICBlbHNlCisgICAgeworICAgICAgICAvLyBnKysgLVdleHRyYSB3YXJucyBvbiB7fSBvciB7MH0KKyAgICAgICAgc3RydWN0IHRpbWVzcGVjIHJxdHAgPSB7IDAsIDAgfTsKKworICAgICAgICAvLyBQT1NJWCBzYXlzIHRoYXQgdGltZXNwZWMgaGFzIHR2X3NlYyBhbmQgdHZfbnNlYworICAgICAgICAvLyBCdXQgaXQgZG9lc24ndCBndWFyYW50ZWUgb3JkZXIgb3IgcGxhY2VtZW50CisKKyAgICAgICAgcnF0cC50dl9zZWMgPSAwOworICAgICAgICBycXRwLnR2X25zZWMgPSAxMDAwOworCisgICAgICAgIG5hbm9zbGVlcCggJnJxdHAsIDAgKTsKKyAgICB9Cit9CisKK30gLy8gbmFtZXNwYWNlIGRldGFpbAorCit9IC8vIG5hbWVzcGFjZSBuZG5ib29zdAorCisjZWxzZQorCituYW1lc3BhY2UgbmRuYm9vc3QKK3sKKworbmFt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WRlIDxuZXc+CisKK25hbWVzcGFjZSBuZG5ib29zdAoreworCituYW1lc3BhY2UgZGV0YWlsCit7CisKK3RlbXBsYXRlPCBzdGQ6OnNpemVfdCBOLCBzdGQ6OnNpemVfdCBBID4gc3RydWN0IHNwX2FsaWduZWRfc3RvcmFnZQoreworICAgIHVuaW9uIHR5cGUKKyAgICB7CisgICAgICAgIGNoYXIgZGF0YV9bIE4gXTsKKyAgICAgICAgdHlwZW5hbWUgbmRuYm9vc3Q6OnR5cGVfd2l0aF9hbGlnbm1lbnQ8IEEgPjo6dHlwZSBhbGlnbl87CisgICAgfTsKK307CisKK3RlbXBsYXRlPCBjbGFzcyBUID4gY2xhc3Mgc3BfbXNfZGVsZXRlcgoreworcHJpdmF0ZToKKworICAgIHR5cGVkZWYgdHlwZW5hbWUgc3BfYWxpZ25lZF9zdG9yYWdlPCBzaXplb2YoIFQgKSwgOjpuZG5ib29zdDo6YWxpZ25tZW50X29mPCBUID46OnZhbHVlID46OnR5cGUgc3RvcmFnZV90eXBlOworCisgICAgYm9vbCBpbml0aWFsaXplZF87CisgICAgc3RvcmFnZV90eXBlIHN0b3JhZ2VfOworCitwcml2YXRlOgorCisgICAgdm9pZCBkZXN0cm95KCkKKyAgICB7CisgICAgICAgIGlmKCBpbml0aWFsaXplZF8gKQorICAgICAgICB7CisjaWYgZGVmaW5lZCggX19HTlVDX18gKQorCisgICAgICAgICAgICAvLyBmaXhlcyBpbmNvcnJlY3QgYWxpYXNpbmcgd2FybmluZworICAgICAgICAgICAgVCAqIHAgPSByZWludGVycHJldF9jYXN0PCBUKiA+KCBzdG9yYWdlXy5kYXRhXyApOworICAgICAgICAgICAgcC0+flQoKTsKKworI2Vsc2UKKworICAgICAgICAgICAgcmVpbnRlcnByZXRfY2FzdDwgVCogPiggc3RvcmFnZV8uZGF0YV8gKS0+flQoKTsKKworI2VuZGlmCisKKyAgICAgICAgICAgIGluaXRpYWxpemVkXyA9IGZhbHNlOworICAgICAgICB9CisgICAgfQor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N0b3IsIGRlc3RydWN0b3IgYXJlIGZpbmUuLi4KKworI2lmICFkZWZpbmVkKCBCT09TVF9OT19DWFgxMV9SVkFMVUVfUkVGRVJFTkNFUyApCisKKy8vIC4uLiBleGNlcHQgaW4gQysrMHgsIG1vdmUgZGlzYWJsZXMgdGhlIGltcGxpY2l0IGNvcHkKKworICAgIHNoYXJlZF9wdHIoIHNoYXJlZF9wdHIgY29uc3QgJiByICkgQk9PU1RfTk9FWENFUFQgOiBweCggci5weCApLCBwbiggci5wbiApCisgICAgeworICAgIH0KKworI2VuZGlmCisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBZPgorICAgIGV4cGxpY2l0IHNoYXJlZF9wdHIoIHdlYWtfcHRyPFk+IGNvbnN0ICYgciApOiBwbiggci5wbiApIC8vIG1heSB0aHJvdworICAgIHsKKyAgICAgICAgbmRuYm9vc3Q6OmRldGFpbDo6c3BfYXNzZXJ0X2NvbnZlcnRpYmxlPCBZLCBUID4oKTsKKworICAgICAgICAvLyBpdCBpcyBub3cgc2FmZSB0byBjb3B5IHIucHgsIGFzIHBuKHIucG4pIGRpZCBub3QgdGhyb3cKKyAgICAgICAgcHggPSByLnB4OworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFk+CisgICAgc2hhcmVkX3B0ciggd2Vha19wdHI8WT4gY29uc3QgJiByLCBuZG5ib29zdDo6ZGV0YWlsOjpzcF9ub3Rocm93X3RhZyApCisgICAgQk9PU1RfTk9FWENFUFQgOiBweCggMCApLCBwbiggci5wbiwgbmRuYm9vc3Q6OmRldGFpbDo6c3Bfbm90aHJvd190YWcoKSApCisgICAgeworICAgICAgICBpZiggIXBuLmVtcHR5KCkgKQorICAgICAgICB7CisgICAgICAgICAgICBweCA9IHIucHg7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB0ZW1wbGF0ZTxjbGFzcyBZPgorI2lmICFkZWZpbmVkKCBCT09TVF9TUF9OT19TUF9DT05WRVJUSUJMRSApCisKKyAgICBzaGFyZWRfcHRyKCBzaGFyZWRfcHRyPFk+IGNvbnN0ICYgciwgdHlwZW5hbWUgbmRuYm9vc3Q6OmRldGFpbDo6c3BfZW5hYmxlX2lmX2NvbnZlcnRpYmxlPFksVD46OnR5cGUgPSBuZG5ib29zdDo6ZGV0YWlsOjpzcF9lbXB0eSgpICkKKworI2Vsc2UKKworICAgIHNoYXJlZF9wdHIoIHNoYXJlZF9wdHI8WT4gY29uc3QgJiByICkKKworI2VuZGlmCisgICAgQk9PU1RfTk9FWENFUFQgOiBweCggci5weCApLCBwbiggci5wbiApCisgICAgeworICAgICAgICBuZG5ib29zdDo6ZGV0YWlsOjpzcF9hc3NlcnRfY29udmVydGlibGU8IFksIFQgPigpOworICAgIH0KKworICAgIC8vIGFsaWFzaW5nCisgICAgdGVtcGxhdGU8IGNsYXNzIFkgPgorICAgIHNoYXJlZF9wdHIoIHNoYXJlZF9wdHI8WT4gY29uc3QgJiByLCBlbGVtZW50X3R5cGUgKiBwICkgQk9PU1RfTk9FWENFUFQgOiBweCggcCApLCBwbiggci5wbiApCisgICAgeworICAgIH0KKworI2lmbmRlZiBCT09TVF9OT19BVVRPX1BUUgorCisgICAgdGVtcGxhdGU8Y2xhc3MgWT4KKyAgICBleHBsaWNpdCBzaGFyZWRfcHRyKCBzdGQ6OmF1dG9fcHRyPFk+ICYgciApOiBweChyLmdldCgpKSwgcG4oKQorICAgIHsKKyAgICAgICAgbmRuYm9vc3Q6OmRldGFpbDo6c3BfYXNzZXJ0X2NvbnZlcnRpYmxlPCBZLCBUID4oKTsKKworICAgICAgICBZICogdG1wID0gci5nZXQoKTsKKyAgICAgICAgcG4gPSBuZG5ib29zdDo6ZGV0YWlsOjpzaGFyZWRfY291bnQoIHIgKTsKKworICAgICAgICBuZG5ib29zdDo6ZGV0YWlsOjpzcF9kZWxldGVyX2NvbnN0cnVjdCggdGhpcywgdG1wICk7CisgICAgfQorCisjaWYgIWRlZmluZWQoIEJPT1NUX05PX0NYWDExX1JWQUxVRV9SRU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sOjpzcF9hc3NlcnRfY29udmVydGlibGU8IFksIFQgPigpOworCisgICAgICAgIHBuLnN3YXAoIHIucG4gKTsKKyAgICAgICAgci5weCA9IDA7CisgICAgfQorCisgICAgc2hhcmVkX3B0ciAmIG9wZXJhdG9yPSggc2hhcmVkX3B0ciAmJiByICkgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHRoaXNfdHlwZSggc3RhdGljX2Nhc3Q8IHNoYXJlZF9wdHIgJiYgPiggciApICkuc3dhcCggKnRoaXMgKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFk+CisgICAgc2hhcmVkX3B0ciAmIG9wZXJhdG9yPSggc2hhcmVkX3B0cjxZPiAmJiByICkgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHRoaXNfdHlwZSggc3RhdGljX2Nhc3Q8IHNoYXJlZF9wdHI8WT4gJiYgPiggciApICkuc3dhcCggKnRoaXMgKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworI2VuZGlmCisKKyNpZiAhZGVmaW5lZCggQk9PU1RfTk9fQ1hYMTFfTlVMTFBUUiApCisKKyAgICBzaGFyZWRfcHRyICYgb3BlcmF0b3I9KCBuZG5ib29zdDo6ZGV0YWlsOjpzcF9udWxscHRyX3QgKSBCT09TVF9OT0VYQ0VQVCAvLyBuZXZlciB0aHJvd3MKKyAgICB7CisgICAgICAgIHRoaXNfdHlwZSgpLnN3YXAoKnRoaXMpOworICAgICAgICByZXR1cm4gKnRoaXM7CisgICAgfQorCisjZW5kaWYKKworICAgIHZvaWQgcmVzZXQoKSBCT09TVF9OT0VYQ0VQVCAvLyBuZXZlciB0aHJvd3MgaW4gMS4zMCsKKyAgICB7CisgICAgICAgIHRoaXNfdHlwZSgpLnN3YXAoKnRoaXMpOworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFk+IHZvaWQgcmVzZXQoIFkgKiBwICkgLy8gWSBtdXN0IGJlIGNvbXBsZXRlCisgICAgeworICAgICAgICBCT09TVF9BU1NFUlQoIHAgPT0gMCB8fCBwICE9IHB4ICk7IC8vIGNhdGNoIHNlbGYtcmVzZXQgZXJyb3JzCisgICAgICAgIHRoaXNfdHlwZSggcCApLnN3YXAoICp0aGlzICk7CisgICAgfQorCisgICAgdGVtcGxhdGU8Y2xhc3MgWSwgY2xhc3MgRD4gdm9pZCByZXNldCggWSAqIHAsIEQgZCApCisgICAgeworICAgICAgICB0aGlzX3R5cGUoIHAsIGQgKS5zd2FwKCAqdGhpcyApOworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFksIGNsYXNzIEQsIGNsYXNzIEE+IHZvaWQgcmVzZXQoIFkgKiBwLCBEIGQsIEEgYSApCisgICAgeworICAgICAgICB0aGlzX3R5cGUoIHAsIGQsIGEgKS5zd2FwKCAqdGhpcyApOworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFk+IHZvaWQgcmVzZXQoIHNoYXJlZF9wdHI8WT4gY29uc3QgJiByLCBlbGVtZW50X3R5cGUgKiBwICkKKyAgICB7CisgICAgICAgIHRoaXNfdHlwZSggciwgcCApLnN3YXAoICp0aGlzICk7CisgICAgfQorICAgIAorICAgIC8vIG5ldmVyIHRocm93cyAoYnV0IGhhcyBhIEJPT1NUX0FTU0VSVCBpbiBpdCwgc28gbm90IG1hcmtlZCB3aXRoIEJPT1NUX05PRVhDRVBUKQorICAgIHR5cGVuYW1lIG5kbmJvb3N0OjpkZXRhaWw6OnNwX2RlcmVmZXJlbmNlPCBUID46OnR5cGUgb3BlcmF0b3IqICgpIGNvbnN0CisgICAgeworICAgICAgICBCT09TVF9BU1NFUlQoIHB4ICE9IDAgKTsKKyAgICAgICAgcmV0dXJuICpweDsKKyAgICB9CisgICAgCisgICAgLy8gbmV2ZXIgdGhyb3dzIChidXQgaGFzIGEgQk9PU1RfQVNTRVJUIGluIGl0LCBzbyBub3QgbWFya2VkIHdpdGggQk9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GxvbmcgdXNlX2NvdW50KCkgY29uc3QgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHJldHVybiBwbi51c2VfY291bnQoKTsKKyAgICB9CisKKyAgICB2b2lkIHN3YXAoIHNoYXJlZF9wdHIgJiBvdGhlciApIEJPT1NUX05PRVhDRVBUCisgICAgeworICAgICAgICBzdGQ6OnN3YXAocHgsIG90aGVyLnB4KTsKKyAgICAgICAgcG4uc3dhcChvdGhlci5wbik7CisgICAgfQorCisgICAgdGVtcGxhdGU8Y2xhc3MgWT4gYm9vbCBvd25lcl9iZWZvcmUoIHNoYXJlZF9wdHI8WT4gY29uc3QgJiByaHMgKSBjb25zdCBCT09TVF9OT0VYQ0VQVAorICAgIHsKKyAgICAgICAgcmV0dXJuIHBuIDwgcmhzLnBuOworICAgIH0KKworICAgIHRlbXBsYXRlPGNsYXNzIFk+IGJvb2wgb3duZXJfYmVmb3JlKCB3ZWFrX3B0cjxZPiBjb25zdCAmIHJocyApIGNvbnN0IEJPT1NUX05PRVhDRVBUCisgICAgeworICAgICAgICByZXR1cm4gcG4gPCByaHMucG47CisgICAgfQorCisgICAgdm9pZCAqIF9pbnRlcm5hbF9nZXRfZGVsZXRlciggbmRuYm9vc3Q6OmRldGFpbDo6c3BfdHlwZWluZm8gY29uc3QgJiB0aSApIGNvbnN0IEJPT1NUX05PRVhDRVBUCisgICAgeworICAgICAgICByZXR1cm4gcG4uZ2V0X2RlbGV0ZXIoIHRpICk7CisgICAgfQorCisgICAgdm9pZCAqIF9pbnRlcm5hbF9nZXRfdW50eXBlZF9kZWxldGVyKCkgY29uc3QgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHJldHVybiBwbi5nZXRfdW50eXBlZF9kZWxldGVyKCk7CisgICAgfQorCisgICAgYm9vbCBfaW50ZXJuYWxfZXF1aXYoIHNoYXJlZF9wdHIgY29uc3QgJiByICkgY29uc3QgQk9PU1RfTk9FWENFUFQKKyAgICB7CisgICAgICAgIHJldHV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