LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCi8vDQovL8Cp1blhdMP8we65pL7fvK+jrNPD09rJ+rPJus294s72wKnVuWF0w/zB7g0KLy+2r9f3x+vH86O6YXQreHg9eXksenpcclxuDQovL7Lp0a/H68fzOiBhdCt4eD8gXHJcbg0KLy/W97avyc+xqDogXHJcbit4eDp5eSx6elxyXG4NCi8vveG5+8Lro7pcclxub2s6MlxyXG4NCi8vICAgICAgICBcclxuZXJyb3I6d3dcclxuDQovL7G416Kjusbk1tCjrHh4zqpBVMP8we7D+6O7eXnOqrLOyv0xtcTWtaOsenrOqrLOyv0ytcTWtaO7d3fOqr7fzOW1xLTtzvPC69a1o6zI57n7w7vT0LTtzvPC66OsxKzIz86qMC4NCi8vICAgDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KI2luY2x1ZGUgImF0X3V0aWxzLmgiDQojaW5jbHVkZSA8c3RkaW8uaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCiNpbmNsdWRlIDxzdHJpbmcuaD4NCiNpbmNsdWRlICJ6eGljX2Vycm5vLmgiDQojaW5jbHVkZSAiYXRfbXNnLmgiDQojaW5jbHVkZSAic29mdGFwX2xvZy5oIg0KI2luY2x1ZGUgPGN0eXBlLmg+DQojaW5jbHVkZSA8c3lzL3RpbWUuaD4NCiNpbmNsdWRlIDx0ZXJtaW9zLmg+DQoNCiNkZWZpbmUgRElGRl9WQUxVRSAoJ2EnLSdBJykNCiNkZWZpbmUgQVRfUEFSQU1fTUFYX05VTSAgKDUwKQ0KDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KLy8NCi8vyfqzyWF0tq/X98frx/PD/MHuLNK7sOPU2mFwcF9jbHRfb3BzX3TW0LX308OjrLj5vt3P+8+ixNrI3aOsyfqzydfu1tW1xGF0x+vH88P8we4NCi8vyfqzyWF0x+vH88P8we7KsaOssdjQ682ouf1tYWxsb2PJ6sfryrnTw7XExNq05qOssqK3tbvYuMPWuNXruPjN4rLjtffTw7qvyv3KudPDo6wNCi8v1+7W1dPJzeKy47X308O6r8r9ys23xbjDxNq05g0KLy9pbnB1dDogIGNtZCAgInh4Ig0KLy8gICAgICAgICAgIHBhcmFtICAgICJ5eSx6eiINCi8vb3V0cHV0OiAgIGF0K3h4PXl5LHp6XHJcbg0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCg0KY2hhciogYXRfYWN0X2J1aWxkKGNoYXIqIGNtZCwgY2hhciogcGFyYW0pDQp7DQogICAgY2hhciAqIGF0X3N0cjsNCglpZihwYXJhbSkNCgl7DQogICAgCWF0X3N0ciA9IG1hbGxvYygzMiArIHN0cmxlbihjbWQpICsgc3RybGVuKHBhcmFtKSk7DQoJfQ0KCWVsc2UNCgl7DQogICAgCWF0X3N0ciA9IG1hbGxvYygzMiArIHN0cmxlbihjbWQpKTsNCgl9DQoJYXNzZXJ0KGF0X3N0cik7DQogICAgLy9pZighYXRfc3RyKQ0KICAgICAgICAvL3JldHVybiBOVUxMOw0KICAgIGlmKHBhcmFtKQ0KICAgICAgICBzcHJpbnRmKGF0X3N0ciwiYXQrJXM9JXNcclxuIixjbWQscGFyYW0pOw0KICAgIGVsc2UNCiAgICAgICAgc3ByaW50ZihhdF9zdHIsImF0KyVzXHJcbiIsY21kKTsNCiAgICByZXR1cm4gYXRfc3RyOyAgICANCg0KfQ0KDQoNCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQovL8n6s8lhdLLp0a/H68fzw/zB7qOs0ruw49TaYXBwX2NsdF9vcHNfdNbQtffTw6OsuPm+3c/7z6LE2sjdo6zJ+rPJ1+7W1bXEYXTH68fzw/zB7g0KLy/J+rPJYXSy6dGvw/zB7sqxo6zNqLn9bWFsbG9jyerH68q508O1xMTatOajrLKit7W72LjD1rjV67j4zeKy47X308O6r8r9yrnTw6OsDQovL9fu1tXTyc3isuO199PDuq/K/crNt8W4w8TatOYNCi8vaW5wdXQ6ICBjbWQgICJ4eCIgICAgICAgICANCi8vb3V0cHV0OiAgIGF0K3h4PyBcclxuDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KY2hhciogYXRfcXVlcnlfYnVpbGQoY2hhciogY21kKQ0Kew0KICAgIGNoYXIgKiBhdF9zdHI7DQogICAgDQogICAgYXRfc3RyID0gbWFsbG9jKDMyICsgc3RybGVuKGNtZCkpOyAvL9PJYXRfY3RsuLrU8MrNt8UNCglhc3NlcnQoYXRfc3RyKTsNCiAgICAvL2lmKCFhdF9zdHIpDQogICAgICAgIC8vcmV0dXJuIE5VTEw7DQogICAgc3ByaW50ZihhdF9zdHIsImF0KyVzP1xyXG4iLGNtZCk7DQogICAgDQogICAgcmV0dXJuIGF0X3N0cjsgICAgDQoNCn0NCg0KDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KLy/J+rPJYXSy6dGvx+vH88P8we61xM/s06bD/MHuo6y1sdPQ1tC85L3hufvJz7GoyrGjrNTac2VyX29wc190MrXEcnNwX2FjdLX308OjrA0KLy+4w7qvyv3W0L2r1tC85MnPsai94bn7us1va2F0w/zB7tfp17DU2tK7xvCjrM2ouf1tYWxsb2PJ6sfryrnTw7XExNq05qOssqK3tbvYDQovL7jD1rjV67j4zeKy47X308O6r8r9yrnTw6Os1+7W1dPJzeKy47X308O6r8r9ys23xbjDxNq05g0KLy9pbnB1dDogIGNtZCAgInh4IiAgIA0KLy8gICAgICAgICAgIHBhcmFtICAgICJ5eSx6eiIgDQovL291dHB1dDogICBcclxuK3h4Onl5LHp6XHJcbg0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCmNoYXIqIGF0X3F1ZXJ5X3Jlc3VsdF9idWlsZChjaGFyKiBjbWQsIGNoYXIqIHBhcmFtKQ0Kew0KICAgIGNoYXIgKiBhdF9zdHI7DQoNCglpZihwYXJhbSkNCgl7DQogICAgCWF0X3N0ciA9IG1hbGxvYygzMiArIHN0cmxlbihjbWQpICsgc3RybGVuKHBhcmFtKSk7DQoJfQ0KCWVsc2UNCgl7DQogICAgCWF0X3N0ciA9IG1hbGxvYygzMiArIHN0cmxlbihjbWQpKTsNCgl9DQoJYXNzZXJ0KGF0X3N0cik7DQogICAgLy9pZighYXRfc3RyKQ0KICAgICAgICAvL3JldHVybiBOVUxMOw0KICAgIGlmKCFwYXJhbSkNCiAgICAgICAgc3ByaW50ZihhdF9zdHIsIlxyXG4rJXNcclxuXHJcbk9LXHJcbiIsY21kKTsNCiAgICBlbHNlDQogICAgICAgIHNwcmludGYoYXRfc3RyLCJcclxuKyVzOiAlc1xyXG5cclxuT0tcclxuIixjbWQscGFyYW0pOw0KDQogICAgcmV0dXJuIGF0X3N0cjsgICAgDQoNCn0NCg0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCi8vyfqzyWF0tcRva8/s06bD/MHuo6y4+b7dss7K/dDFz6LJ+rPJsrvNrLXEb2vP7NOmw/zB7g0KLy/NqLn9bWFsbG9jyerH68q508O1xMTatOajrLKit7W72LjD1rjV67j4zeKy47X308O6r8r9yrnTw6Os1+7W1dPJzeKy47X308O6r8r9ys23xbjDxNq05g0KLy9pbnB1dDogIHBhcmFtICAieHgiICANCg0KLy9vdXRwdXQ6ICAgXHJcbm9rOnh4DQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KDQoNCmNoYXIqIGF0X29rX2J1aWxkKCkNCnsNCiAgICBjaGFyICogYXRfc3RyOw0KICAgIA0KICAgIGF0X3N0ciA9IG1hbGxvYygzMik7IC8v08lhdF9jdGy4utTwys23xQ0KCWFzc2VydChhdF9zdHIpOw0KCQ0KCXNwcmludGYoYXRfc3RyLCJcclxuT0tcclxuIik7DQoNCiAgICAgICAgDQogICAgcmV0dXJuIGF0X3N0cjsgICAgDQoNCn0NCg0KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCi8vyfqzyWF0tcRlcnLP7NOmw/zB7qOsuPm+3bLOyv3Qxc+iyfqzybK7zay1xGVycs/s06bD/MHuDQovL82ouf1tYWxsb2PJ6sfryrnTw7XExNq05qOssqK3tbvYuMPWuNXruPjN4rLjtffTw7qvyv3KudPDo6zX7tbV08nN4rLjtffTw7qvyv3KzbfFuMPE2rTmDQovL2lucHV0OiAgcGFyYW0gIHh4ICANCi8vb3V0cHV0OiAgIFxyXG5lcnI6eHgNCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQoNCg0KY2hhciogYXRfZXJyX2J1aWxkKGludCBwYXJhbSkNCnsNCiAgICBjaGFyICphdF9zdHIgPSBOVUxMOw0KCQ0KICAgIGF0X3N0ciA9IG1hbGxvYygzMik7DQoJDQoJYXNzZXJ0KGF0X3N0cik7DQogICAgaWYocGFyYW0gPT0gMCkNCiAgICAgICAgc3ByaW50ZihhdF9zdHIsIlxyXG5FUlJPUlxyXG4iKTsNCiAgICBlbHNlDQogICAgICAgIHNwcmludGYoYXRfc3RyLCJcclxuK0NNRSBFUlJPUjogJWRcclxuIixwYXJhbSk7DQogICAgICAgIA0KICAgIHJldHVybiBhdF9zdHI7ICAgIA0KDQp9DQoNCnN0YXRpYyBpbnQgaXNfZGlnaXRfc3RyKGNvbnN0IGNoYXIgKnN0cikNCnsNCgl1bnNpZ25lZCBpbnQgZ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PyBmbXQgKyAxIDogTlVMTCk7DQoNCiAgICAgICAgaWYgKHR5cGUgPT0gJ2QnKSB7DQogICAgICAgICAgICBpZihzaXplID09IDAgfHwgc2l6ZSA9PSA0KSB7DQogICAgICAgICAgICAgICAgaWYocHN0cltwYXJhbV9zdHJfaW5kZXhdICE9IE5VTEwpIHsNCiAgICAgICAgICAgICAgICAgICAgKigoaW50ICopcHZhbFtwYXJhbV92YWxfaW5kZXhdKSA9IChpbnQpYXRvaShwc3RyW3BhcmFtX3N0cl9pbmRleF0pOw0KICAgICAgICAgICAgICAgICAgICBwYXJhbV9jb3VudCsrOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0gZWxzZSBpZihzaXplID09IDEpIHsNCiAgICAgICAgICAgICAgICBpZihwc3RyW3BhcmFtX3N0cl9pbmRleF0gIT0gTlVMTCkgew0KICAgICAgICAgICAgICAgICAgICAqKChjaGFyICopcHZhbFtwYXJhbV92YWxfaW5kZXhdKSA9IChjaGFyKWF0b2kocHN0cltwYXJhbV9zdHJfaW5kZXhdKTsNCiAgICAgICAgICAgICAgICAgICAgcGFyYW1fY291bnQrKzsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9IGVsc2UgaWYoc2l6ZSA9PSAyKSB7DQogICAgICAgICAgICAgICAgaWYocHN0cltwYXJhbV9zdHJfaW5kZXhdICE9IE5VTEwpIHsNCiAgICAgICAgICAgICAgICAgICAgKigoc2hvcnQgKilwdmFsW3BhcmFtX3ZhbF9pbmRleF0pID0gKHNob3J0KWF0b2kocHN0cltwYXJhbV9zdHJfaW5kZXhdKTsgDQogICAgICAgICAgICAgICAgICAgIHBhcmFtX2NvdW50Kys7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfWVsc2Ugew0KICAgICAgICAgICAgICAgIGFzc2VydCgwKTsNCiAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgIH0gDQogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSAncycpIHsNCiAgICAgICAgICAgIGlmIChzaXplID09IDApIHsNCiAgICAgICAgICAgICAgICBpZihwc3RyW3BhcmFtX3N0cl9pbmRleF0gIT0gTlVMTCkgew0KICAgICAgICAgICAgICAgICAgICBzdHJjcHkoKGNoYXIgKilwdmFsW3BhcmFtX3ZhbF9pbmRleF0sIHBzdHJbcGFyYW1fc3RyX2luZGV4XSk7DQogICAgICAgICAgICAgICAgICAgIHBhcmFtX2NvdW50Kys7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgIGlmKHBzdHJbcGFyYW1fc3RyX2luZGV4XSAhPSBOVUxMICYmIHNpemUgPCBzdHJsZW4ocHN0cltwYXJhbV9zdHJfaW5kZXhdKSl7DQoJCQkJICAgIHJldCA9IEFURVJSX1NUUl9UT09fTE9ORzsNCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQoJCQkgICB9DQogICAgICAgICAgICAgICBpZihwc3RyW3BhcmFtX3N0cl9pbmRleF0gIT0gTlVMTCkgew0KICAgICAgICAgICAgICAgICAgICAvL3N0cm5jcHkoKGNoYXIgKilwdmFsW3BhcmFtX3ZhbF9pbmRleF0sIHBzdHJbcGFyYW1fc3RyX2luZGV4XSwgc2l6ZSAtIDEpOw0KCQkJCQlpZihzaXplIDwgMHhmZmZmKS8va2xvY3dvcmsNCgkJCQkJc25wcmludGYoKGNoYXIgKilwdmFsW3BhcmFtX3ZhbF9pbmRleF0sc2l6ZSwiJXMiLHBzdHJbcGFyYW1fc3RyX2luZGV4XSk7DQogICAgICAgICAgICAgICAgICAgIHBhcmFtX2NvdW50Kys7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgICAgIGFzc2VydCgwKTsNCiAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgfQ0KICAgICAgICBwYXJhbV92YWxfaW5kZXgrKzsNCiAgICB9DQogICAg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yY0xlbmd0aDsgaSArPSAyKQ0KICAgIHsNCiAgICAgICAgLy8gyuSz9rjfNM67DQogICAgICAgIGlmKCpwU3JjID49ICcwJyAmJiAqcFNyYyA8PSAnOScpDQogICAgICAgIHsNCiAgICAgICAgICAgICpwRHN0ID0gKCpwU3JjIC0gJzAnKSA8PCA0Ow0KICAgICAgICB9DQogICAgICAgIGVsc2UNCiAgICAgICAgew0KICAgICAgICAgICAgKnBEc3QgPSAoKHRvdXBwZXIoKnBTcmMpIC0gJ0EnKSArIDEwKSA8PCA0Ow0KICAgICAgICB9DQoNCiAgICAgICAgcFNyYysrOw0KDQogICAgICAgIC8vIMrks/a1zTTOuw0KICAgICAgICBpZigqcFNyYyA+PSAnMCcgJiYgKnBTcmMgPD0gJzknKQ0KICAgICAgICB7DQogICAgICAgICAgICAqcERzdCB8PSAqcFNyYyAtICcwJzsNCiAgICAgICAgfQ0KICAgICAgICBlbHNlDQogICAgICAgIHsNCiAgICAgICAgICAgICpwRHN0IHw9ICh0b3VwcGVyKCpwU3JjKSAtICdBJykgKyAxMDsNCiAgICAgICAgfQ0KDQogICAgICAgIHBTcmMrKzsNCiAgICAgICAgcERzdCsrOw0KICAgIH0NCg0KICAgIC8vILe1u9jEv7Hqyv2+3bOktsgNCiAgICByZXR1cm4gblNyY0xlbmd0aCAvIDI7DQp9DQoNCi8qKg0KICogQGJyaWVmINfWvdrK/b7d16q7u86qv8m08tOh19a3+7SuIKOsyOejug0KICAgICAgICAgICAgICAgICAgICAgezB4QzgsIDB4MzIsIDB4OUIsIDB4RkQsIDB4MEUsIDB4MDF9IC0tPiAiQzgzMjlCRkQwRTAxIg0KICogQHBhcmFtIHBTcmMg1LTK/b7d1rjV6w0KICogQHBhcmFtIHBEc3QgxL+x6tfWt/u0rta41esNCiAqIEBwYXJhbSBuU3JjTGVuZ3RoINS0yv2+3bOktsgNCiAqIEByZXR1cm4gxL+x6sr9vt2zpLbIo7sNCiAqIEBub3RlICAgDQogKiBAd2FybmluZyANCiAqLw0KaW50IGJ5dGVzMnN0cmluZyhjb25zdCB1bnNpZ25lZCBjaGFyKiBwU3JjLCBjaGFyKiBwRHN0LCBpbnQgblNyY0xlbmd0aCkNCnsNCiAgICBjb25zdCBjaGFyIHRhYltdPSIwMTIzNDU2Nzg5QUJDREVGIjsJLy8gMHgwLTB4ZrXE19a3+7Lp1dKx7Q0KICAgIGludCBpID0gMDsNCg0KICAgIC8v0KPR6bLOyv0NCiAgICBpZihwU3JjID09ICBOVUxMIHx8IHBEc3QgPT0gTlVMTCB8fCBuU3JjTGVuZ3RoIDwgMCkNCiAgICB7DQogICAgICAgIHJldHVybiAtMTsNCiAgICB9DQoNCiAgICBmb3IoaT0wOyBpPG5TcmNMZW5ndGg7IGkrKykNCiAgICB7DQogICAgICAgICpwRHN0KysgPSB0YWJbKnBTcmMgPj4gNF07CQkvLyDK5LP2tc00zrsNCiAgICAgICAgKnBEc3QrKyA9IHRhYlsqcFNyYyAmIDB4MGZdOwkvLyDK5LP2uN80zrsNCiAgICAgICAgcFNyYysrOw0KICAgIH0NCg0KICAgIC8vILe1u9jEv7Hq19a3+7Sus6S2yA0KICAgIHJldHVybiBuU3JjTGVuZ3RoICogMjsNCn0NCg0KDQovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCioguq/K/cP7s8ajuiB2b2lkIHp4aWNfZXJyX3RyYWNrKGludCBlcnIpDQoqILmmxNzD6Mr2o7ogvavTptPDtO3O87rFzO2807W9bnbW0A0KKiDK5Mjrss7K/aO6ICAgICAgZXJyOiC07c7zusUNCiogt7Ugu9gg1rWjusS/serK/b7ds6S2yKO7DQoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCnZvaWQgenhpY19lcnJfdHJhY2soaW50IGVycikNCnsNCglFUlJfVFJBQ0sgZXJyVHJhY2sgPSB7MH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