LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICogILDmsb7L+dPQIChDKQ0KICoNCiAqICC5psTcICAgICAgICAgOiAgQ2NBcHDP4LnYQVS0psDtDQogKiAg1/fV3wkJIDogIA0KICogILDmsb4JCSA6ICBWMS4wDQogKiAgzeqzycjVxtogICAgIDogIDIwMTcuMi4xDQogKiAgxuTL/Mu1w/cgICAgIDoNCiAqICCyzsr9ICAgICAgICAgOg0KICogIMrkyOsgICAgICAgICA6DQogKiAgyuSz9iAgICAgICAgIDoNCiAqICC4/LjEvMfCvCAgICAgOg0KICogIMqxvOQgICAgICAgICAgINf31d8gICAgICAgICAgICAgIMTayN0NCiAqLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiAqDQogKg0KKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQojaWZuZGVmIENPTkZJR19NSU5fOE1fVkVSU0lPTg0KI2luY2x1ZGUgImF0X2NvbnRleHQuaCINCiNpbmNsdWRlICJjZmdfbnZfZGVmLmgiDQojaW5jbHVkZSAiYXRfY29tLmgiDQoNCiNkZWZpbmUgWkFUX0lOVkFMSURfTEVOICAgIC0xDQojZGVmaW5lIE1TR19SRVRSWV9OVU0gICAgNA0KI2RlZmluZSBNU0dfUkVUUllfSU5URVJWQUwgICAgNTANCg0KY2hhciogIGF0Q2NhcHBfU2VuZEF0ZFJlcSh2b2lkICpwYXJhbSkNCnsNCiAgICBNU0dfQlVGICptc2didWYgPSAoTVNHX0JVRiAqKXBhcmFtOw0KICAgIFRfekNjYXBwX0NhbGxNb1JlcSAqY2FsbFJlcSA9IChUX3pDY2FwcF9DYWxsTW9SZXEgKiltc2didWY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