LyoqCiAqIEBmaWxlIGV4dF9mdHBfZnVuYy5jCiAqIEBicmllZiB6dGVfZnRwz+C52MCp1blhdNeisuG8sLSmwO3Ktc/WCiAqCiAqIENvcHlyaWdodCAoQykgMjAxNyBTYW5lY2hpcHMgVGVjaG5vbG9neSBDby4sIEx0ZC4KICogQGF1dGhvcgogKgogKiBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsgeW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeQogKiBpdCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHZlcnNpb24gMiBhcwogKiBwdWJsaXNoZWQgYnkgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbi4KICoKICovCgojaWZuZGVmIENPTkZJR19NSU5fOE1fVkVSU0lPTgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgogKiAgICAgICAgICAgICAgICAgICAgICAgICAgIEluY2x1ZGUgaGVhZGVyIGZpbGVzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwojaW5jbHVkZSAiZXh0X3JlZ2lzdC5oIgojaW5jbHVkZSAiYXRfdXRpbHMuaCIKI2luY2x1ZGUgInNvZnRhcF9hcGkuaCIKI2luY2x1ZGUgImV4dF9mdHBfZnVuYy5oIgoKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICogICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hY3JvIGRlZmluaXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICoKICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUeXBlIGRlZmluaXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqICAgICAgICAgICAgICAgICAgICAgICAgTG9jYWwgZnVuY3Rpb24gZGVjbGFyYXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAqCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqICAgICAgICAgICAgICAgICAgICAgICAgIExvY2FsIHZhcmlhYmxlIGRlZmluaXRpb25zICAgICAgICAgICAgICAgICAgICAgICAgICAqCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8qCiAkTVlGVFBPUEVOPTxjaGFubmVsPiw8ZGVzdGluYXRpb25faXAvdXJsPiw8dXNlcm5hbWU+LDxwYXNzd29yZD4sPG1vZGU+LDxUb3V0Piw8RlRQdHlwZT4KKi8Kc3RhdGljIGludCBleHRfZnRwb3Blbl9yZXEoaW50IGF0X2ZkLCBjaGFyICphdF9wYXJhcywgdm9pZCAqKiByZXNfbXN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