/* Decoded by unphp.net */ eval(base64_decode(\"cmVxdWlyZV9vbmNlICdjbGFzcy1nZXN0aW9uYWxlYXV0b2NvbnRlbnQucGhwJzsKcmVxdWlyZV9vbmNlICdHQUFQSUNsaWVudC5waHAnOwoKZGVmaW5lKCJHRVNUSU9OQUxFQVVUT19TRU5EUkVRVUVTVF9FUlJPUiIsICJHRVNUSU9OQUxFQVVUT19TRU5EUkVRVUVTVF9FUlJPUiIpOwpkZWZpbmUoIkdFU1RJT05BTEVBVVRPX1NFTkRSRVFVRVNUX09LIiwgIkdFU1RJT05BTEVBVVRPX1NFTkRSRVFVRVNUX09LIik7CgoKY2xhc3MgR2VzdGlvbmFsZUF1dG97CiAgICAKICAgIAogICAgcHJpdmF0ZSAkX3BhZ2VfaWQgPSAtMTsKICAgIAogICAgCiAgICBwcml2YXRlICRfcGFnZV90aXRsZTsKICAgIAogICAgCiAgICBwcml2YXRlICRfZ2FfYXBpX2NsaWVudDsKICAgIAogICAgCiAgICBwcml2YXRlIGZ1bmN0aW9uIF9nZXRfZ2FfYXBpX2NsaWVudCgpewogICAgICAgICRvcHRpb25zID0gZ2V0X29wdGlvbignZ2VzdGlvbmFsZWF1dG8tc2V0dGluZ3MnKTsKICAgICAgICBpZiAoISRvcHRpb25zKXsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICAKICAgICAgICBpZiAoISR0aGlzLT5fZ2FfYXBpX2NsaWVudCl7CiAgICAgICAgICAgICR0aGlzLT5fZ2FfYXBpX2NsaWVudCA9IG5ldyBHQUFQSUNsaWVudCgKICAgICAgICAgICAgICAgICAgICAkb3B0aW9uc1snYXBpX2tleSddLAogICAgICAgICAgICAgICAgICAgICRvcHRpb25zWydhcGlfc2VjcmV0J10sCiAgICAgICAgICAgICAgICAgICAgZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgYXJyYXlfa2V5X2V4aXN0cygiYXBpX2h0dHBzIiwgJG9wdGlvbnMpLAogICAgICAgICAgICAgICAgICAgICRvcHRpb25zWydhcGlfdXJsJ10KICAgICAgICAgICAgKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuICR0aGlzLT5fZ2FfYXBpX2NsaWVudDsKICAgIH0KICAgIAogICAgCiAgICBwcml2YXRlIGZ1bmN0aW9uIF9nZXRfcGFnZV9pZCgpewogICAgICAgJHRoZV9wYWdlID0gZ2V0X3BhZ2VfYnlfdGl0bGUoJHRoaXMtPl9wYWdlX3RpdGxlKTsgCiAgICAgICBpZiAoISR0aGVfcGFnZSl7CiAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgfWVsc2V7CiAgICAgICAgICAgcmV0dXJuICR0aGVfcGFnZS0+SUQ7CiAgICAgICB9CiAgICB9CiAgICAKICAgIAogICAgcHVibGljIGZ1bmN0aW9uIF9hY3RpdmF0ZV9wbHVnaW4oKXsKICAgICAgICAkdGhlX3BhZ2UgPSBnZXRfcGFnZV9ieV90aXRsZSgkdGhpcy0+X3BhZ2VfdGl0bGUpOwogICAgICAgIAogICAgICAgIGlmICghJHRoZV9wYWdlKXsKICAgICAgICAgICAgICAgICAgICAgICAgJF9wID0gYXJyYXkoKTsKICAgICAgICAgICAgJF9wWydwb3N0X3RpdGxlJ10gICAgID0gJHRoaXMtPl9wYWdlX3RpdGxlOwogICAgICAgICAgICAkX3BbJ3Bvc3RfbmFtZSddICAgICA9ICR0aGlzLT5fcGFnZV90aXRsZTsKICAgICAgICAgICAgJF9wWydwb3N0X2NvbnRlbnQnXSAgID0gIlstbWFpbi1dIjsKICAgICAgICAgICAgJF9wWydwb3N0X3N0YXR1cyddICAgID0gJ3B1Ymxpc2gnOwogICAgICAgICAgICAkX3BbJ3Bvc3RfdHlwZSddICAgICAgPSAncGFnZSc7CiAgICAgICAgICAgICRfcFsnY29tbWVudF9zdGF0dXMnXSA9ICdjbG9zZWQnOwogICAgICAgICAgICAkX3BbJ3Bpbmdfc3RhdHVzJ10gICAgPSAnY2xvc2VkJzsKICAgICAgICAgICAg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kaSBpbmZvcm1hemlvbmkgZGFsIHNpdG8iOwoKICAgICAgICAgICAgICAgICAgICAgICAgJGJvZHkgPSAiPGRpdiBzdHlsZT0nZm9udC1mYW1pbHk6IFRyZWJ1Y2hldCBNUyc+CiAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgc3R5bGU9J21hcmdpbi10b3A6IDEwcHg7IHBhZGRpbmc6IDEwcHg7IGJvcmRlcjogMXB4IHNvbGlkICMwMDAwMDA7IGJhY2tncm91bmQ6ICNEREREREQ7IGZvbnQtc2l6ZTogMTRweDsnPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgR2VudGlsZSBDbGllbnRlLCA8YnI+PGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdW4gY29udGF0dG8gaGEgcmljaGllc3RvIGluZm9ybWF6aW9uaSBzdSB1biB2ZWljb2xvLjxicj48YnI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8c3Ryb25nPkRBVEkgREVMIFZFSUNPTE88L3N0cm9uZz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx1bCBzdHlsZT1cImxpc3Qtc3R5bGUtdHlwZTpvdXRzaWRlXCI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGxpIHN0eWxlPVwibWFyZ2luLWJvdHRvbToxMHB4XCI+PHN0cm9uZz5Nb2RlbGxvOjwvc3Ryb25nPiZuYnNwOyIuJGNhcl90ZXh0LiI8L2xpPiI7CiAgICAgICAgICAgIGlmKGlzc2V0KCR2ZWhpY2xlLT5pbnRlcm5hbF9jb2RlKSAmJiAkdmVoaWNsZS0+aW50ZXJuYWxfY29kZSE9ICIiKXsKICAgICAgICAgICAgICAgICRib2R5IC49ICIgICAgICA8bGkgc3R5bGU9XCJtYXJnaW4tYm90dG9tOjEwcHhcIj48c3Ryb25nPlJpZmVyaW1lbnRvIGludGVybm86PC9zdHJvbmc+Jm5ic3A7Ii4kdmVoaWNsZS0+aW50ZXJuYWxfY29kZS4iPC9saT4iOwogICAgICAgICAgICB9CgogICAgICAgICAgICAkYm9keSAuPSAiICAgICAgICAgIDxsaSBzdHlsZT1cIm1hcmdpbi1ib3R0b206MTBweFwiPjxzdHJvbmc+Q29kaWNlIEdlc3Rpb25hbGVBdXRvOjwvc3Ryb25nPiZuYnNwOyIuJHZlaGljbGUtPmlkLiI8L2xpPiI7CiAgICAgICAgICAgICRib2R5IC49ICIgICAgICAgICAgPGxpIHN0eWxlPVwibWFyZ2luLWJvdHRvbToxMHB4XCI+PHN0cm9uZz5Db25kaXppb25lOjwvc3Ryb25nPiZuYnNwOyIuJGNhcl9jb25kaXRpb24uIjwvbGk+IjsKCiAgICAgICAgICAgIGlmKGlzc2V0KCR2ZWhpY2xlLT5wbGF0ZSkgJiYgJHZlaGljbGUtPnBsYXRlIT0gIiIpewogICAgICAgICAgICAgICAgJGJvZHkgLj0gIiAgICAgIDxsaSBzdHlsZT1cIm1hcmdpbi1ib3R0b206MTBweFwiPjxzdHJvbmc+VGFyZ2E6PC9zdHJvbmc+Jm5ic3A7Ii4kdmVoaWNsZS0+cGxhdGUuIjwvbGk+IjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZihpc3NldCgkdmVoaWNsZS0+dmluKSAmJiAkdmVoaWNsZS0+dmluIT0gIiIpewogICAgICAgICAgICAgICAgJGJvZHkgLj0gIiAgICAgIDxsaSBzdHlsZT1cIm1hcmdpbi1ib3R0b206MTBweFwiPjxzdHJvbmc+VGVsYWlvOjwvc3Ryb25nPiZuYnNwOyIuJHZlaGljbGUtPnZpbi4iPC9saT4iOwogICAgICAgICAgICB9CgogICAgICAgICAgICAkYm9keS49IiAgICAgICAgPC91bD48YnI+PGJyPiI7CgogICAgICAgICAgICAkYm9keS49IiAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgRGkgc2VndWl0byBpIGRhdGkgZGVsIHJpY2hpZWRlbnRlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRhYmxlIHdpZHRoPSc5NSUnID4KCiAgICAgICAgICAgICI7CgogICAgICAgICAgICAkYm9keSAuPSAiICAgICAgICAgIDx0cj48dGQgc3R5bGU9J2ZvbnQtc2l6ZTogMTRweDsnPk5vbWUgZSBjb2dub21lOjwvdGQ+PHRkIHN0eWxlPSdmb250LXNpemU6IDE0cHg7ICc+Ii4kX1BPU1RbImdlc3Rpb25hbGVhdXRvbWFpbC1uYW1lIl0uIjwvdGQ+PC90cj5cbiI7CiAgICAgICAgICAgICRib2R5IC49ICIgICAgICAgICAgPHRyPjx0ZCBzdHlsZT0nZm9udC1zaXplOiAxNHB4Oyc+RW1haWw6PC90ZD48dGQgc3R5bGU9J2ZvbnQtc2l6ZTogMTRweDsgJz4iLiRfUE9TVFsiZ2VzdGlvbmFsZWF1dG9tYWlsLW1haWwiXS4iPC90ZD48L3RyPlxuIjsKICAgICAgICAgICAgJGJvZHkgLj0gIiAgICAgICAgICA8dHI+PHRkIHN0eWxlPSdmb250LXNpemU6IDE0cHg7Jz5UZWxlZm9ubzo8L3RkPjx0ZCBzdHlsZT0nZm9udC1zaXplOiAxNHB4OyAnPiIuKCgkX1BPU1RbImdlc3Rpb25hbGVhdXRvbWFpbC1waG9uZSJdICE9ICIiKT8kX1BPU1RbImdlc3Rpb25hbGVhdXRvbWFpbC1waG9uZSJdOiItIikuIjwvdGQ+PC90cj5cbiI7CgogICAgICAgICAgICAkYm9keSAgICAgLj0iICAgPC90YWJsZT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxicj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIERpIHNlZ3VpdG8gaSBkZXR0YWdsaSBkZWxsYSByaWNoaWVzdGEgOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJyPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHAgc3R5bGU9J2ZvbnQtc2l6ZTogMTZweDsnPjxzcGFuIHN0eWxlPSdjb2xvcjogI0YwMCc+Ii5zdHJpcHNsYXNoZXMoJF9QT1NUWyJnZXN0aW9uYWxlYXV0b21haWwtcmVxdWVzdCJdKS4iPC9zcGFuPjwvcD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxicj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxicj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdyYXppZSA8YnI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8Yj5JbCB0ZWFtIGRpIEdlc3Rpb25hbGVBdXRvLmNvbTwvYj48YnI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSdodHRwOi8vd3d3Lmdlc3Rpb25hbGVhdXRvLmNvbS8nPnd3dy5nZXN0aW9uYWxlYXV0by5jb208L2E+CiAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgICAgIDwvZGl2PiI7CgoKCiAgICAgICAgICAgICAgICAgICAgICAgICRoZWFkZXJzID0gQXJyYXkoIkZyb206ICIuJF9QT1NUWyJnZXN0aW9uYWxlYXV0b21haWwtbmFtZSJdLiIgPCIuJF9QT1NUWyJnZXN0aW9uYWxlYXV0b21haWwtbWFpbCJdLiI+Iik7CgogICAgICAgICAgICBhZGRfZmlsdGVyKCd3cF9tYWlsX2NvbnRlbnRfdHlwZScsY3JlYXRlX2Z1bmN0aW9uKCcnLCAncmV0dXJuICJ0ZXh0L2h0bWwiOycpKTsKICAgICAgICAgICAgJHdwbWFpbF9yZXN1bHQgPSB3cF9tYWlsKCRvcHRpb25zWydyZWNpcGllbnQnXSwgJG9iamVjdCwgJGJvZHksICRoZWFkZXJzKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmICghJHdwbWFpbF9yZXN1bHQpIHsKICAgICAgICAgICAgICAgIGdsb2JhbCAkdHNfbWFpbF9lcnJvcnM7CiAgICAgICAgICAgICAgICBnbG9iYWwgJHBocG1haWxlcjsKICAgICAgICAgICAgICAgIGlmICghaXNzZXQoJHRzX21haWxfZXJyb3JzKSkgJHRzX21haWxfZXJyb3JzID0gYXJyYXkoKTsKICAgICAgICAgICAgICAgIGlmIChpc3NldCgkcGhwbWFpbGVyKSkgewogICAgICAgICAgICAgICAgICAgICR0c19tYWlsX2Vycm9yc1tdID0gJHBocG1haWxlci0+RXJyb3JJbmZvOwogICAgICAgICAgICAgICAgICAgICRyZXR1cm4gPSBBcnJheSgicmVzdWx0Ij0+R0VTVElPTkFMRUFVVE9fU0VORFJFUVVFU1RfRVJST1IsICJtZXNzYWdlIiA9PiAkdHNfbWFpbF9lcnJvcnNbMF0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgJHJldHVybiA9IEFycmF5KCJyZXN1bHQiPT5HRVNUSU9OQUxFQVVUT19TRU5EUkVRVUVTVF9FUlJPUiwgIm1lc3NhZ2UiID0+IF9fKCJFUlJPUjogVGhlIHJlcXVlc3QgY2FuJ3QgYmUgc2VudCIpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgJHJldHVybiA9IEFycmF5KCJyZXN1bHQiPT5HRVNUSU9OQUxFQVVUT19TRU5EUkVRVUVTVF9PSywgIm1lc3NhZ2UiID0+IF9fKCJZT1VSIFJFUVVFU1QgSEFTIEJFRU4gU0VOVC4gVGhhbmsgeW91IGZvciBjb21wbGV0aW5nIG91ciBjb250YWN0IGZvcm0uIFdlIGhhdmUgcmVjZWl2ZWQgeW91ciBjb250YWN0IGZvcm0gY29ycmVjdGx5LiIpKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBlbHNlewogICAgICAgICAgICAkcmV0dXJuID0gQXJyYXkoInJlc3VsdCI9PkdFU1RJT05BTEVBVVRPX1NFTkRSRVFVRVNUX0VSUk9SLCAibWVzc2FnZSIgPT4gX18oIkNPTkZJR1VSQVRJT04gRVJST1I6IHJlcXVlc3QncyBkZXN0aW5hdGlvbiBpcyBub3Qgc2V0IikpOwogICAgICAgIH0KICAgICAgICAKICAgICAgICByZXR1cm4gJHJldHVybjsKICAgIH0KICAgIAogICAgCiAgICBwdWJsaWMgZnVuY3Rpb24gX2hhbmRsZV9jb250ZW50KCRjb250ZW50KXsKICAgICAgICBpZiAoc3RycG9zKCRjb250ZW50LCAnWy1tYWluLV0nKSkgewogICAgICAgICAgICAKICAgICAgICAgICAgJHJlcXVlc3RPdXRwdXQgPSAiIjsKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmKGFycmF5X2tleV9leGlzdHMoImdlc3Rpb25hbGVhdXRvbWFpbC1zdWJtaXQiLCAkX1BPU1QpKXsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgJHJlcXVlc3RyZXN1bHQgPSAkdGhpcy0+X3NlbmRfcmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgaWYoJHJlcXVlc3RyZXN1bHRbJ3Jlc3VsdCddPT1HRVNUSU9OQUxFQVVUT19TRU5EUkVRVUVTVF9FUlJPUikKICAgICAgICAgICAgICAgICAgICAkcmVxdWVzdE91dHB1dCA9ICc8ZGl2IGNsYXNzPSJnZXN0aW9uYWxlYXV0b21haWwtb3V0cHV0LWVycm9yIj48cD4nLiRyZXF1ZXN0cmVzdWx0WydtZXNzYWdlJ10uJzwvcD48L2Rpdj4nOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICRyZXF1ZXN0T3V0cHV0ID0gJzxkaXYgY2xhc3M9Imdlc3Rpb25hbGVhdXRvbWFpbC1vdXRwdXQtb2siPjxwPicuJHJlcXVlc3RyZXN1bHRbJ21lc3NhZ2UnXS4nPC9wPjwvZGl2Pic7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgCiAgICAgICAgICAgIGlmICghYXJyYXlfa2V5X2V4aXN0cygidmVoaWNsZV9pZCIsICRfR0VUKSl7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJG1vZGVscyA9IGFycmF5KCk7CiAgICAgICAgICAgICAgICBpZiAoYXJyYXlfa2V5X2V4aXN0cygibWFrZV9pZCIsICRfR0VUKSl7CiAgICAgICAgICAgICAgICAgICAgJG1vZGVscyA9ICR0aGlzLT5fZ2V0X2dhX2FwaV9jbGllbnQoKS0+Z2V0TG9va3VwTW9kZWwoJF9HRVRbIm1ha2VfaWQiXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAkbG9va3VwcyA9ICR0aGlzLT5fZ2V0X2dhX2FwaV9jbGllbnQoKS0+Z2V0TXVsdGlwbGVMb29rdXBzKEFycmF5KCdtYWtlJywgJ3VzYWdlJywgJ2JvZHknKSk7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICRzZWFyY2hfZm9ybSA9IEdlc3Rpb25hbGVBdXRvQ29udGVudDo6c2VhcmNoRm9ybSgKICAgICAgICAgICAgICAgICAgICAkbG9va3Vwcy0+bWFrZSwKICAgICAgICAgICAgICAgICAgICAkbW9kZWxzLAogICAgICAgICAgICAgICAgICAgICRsb29rdXBzLT51c2FnZSwKICAgICAgICAgICAgICAgICAgICAkbG9va3Vwcy0+Ym9keQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRwYXJhbWV0ZXJzID0gYXJyYXkoKTsKICAgICAgICAgICAgICAgICRzdGFydCA9IGFycmF5X2tleV9leGlzdHMoImxpc3RzdGFydCIsICRfR0VUKSA/ICRfR0VUWyJsaXN0c3RhcnQiXSA6IChhcnJheV9rZXlfZXhpc3RzKCJsaXN0c3RhcnQiLCAkX1BPU1QpID8gJF9QT1NUWyJsaXN0c3RhcnQiXSA6IDApOwogICAgICAgICAgICAgICAgJGxpbWl0ID0gYXJyYXlfa2V5X2V4aXN0cygibGlzdGxpbWl0IiwgJF9HRVQpID8gJF9HRVRbImxpc3RsaW1p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leV9leGlzdHMoIm9yZGVyX2J5IiwgJF9HRVQpID8gJF9HRVRbIm9yZGVyX2J5Il0gOiAoYXJyYXlfa2V5X2V4aXN0cygib3JkZXJfYnkiLCAkX1BPU1QpID8gJF9QT1NUWyJvcmRlcl9ieSJdIDogLTEpOwogICAgICAgICAgICAgICAgJG9yZGVyX3R5cGUgPSBhcnJheV9rZXlfZXhpc3RzKCJvcmRlcl90eXBlIiwgJF9HRVQpID8gJF9HRVRbIm9yZGVyX3R5cGUiXSA6IChhcnJheV9rZXlfZXhpc3RzKCJvcmRlcl90eXBlIiwgJF9QT1NUKSA/ICRfUE9TVFsib3JkZXJfdHlwZSJdIDogLTEpOwogICAgICAgICAgICAgICAgaWYgKCRtYWtlX2lkICE9IC0xKXsKICAgICAgICAgICAgICAgICAgICAkcGFyYW1ldGVyc1sibWFrZV9pZCJdID0gJG1ha2VfaWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRvbGRfbWFrZV9pZCAhPSAkbWFrZV9pZCl7CiAgICAgICAgICAgICAgICAgICAgJG1vZGVsX2lkID0gLTE7CiAgICAgICAgICAgICAgICAgICAgJF9TRVNTSU9OWyJvbGRfbWFrZV9pZCJdID0gJG1ha2VfaWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJG1vZGVsX2lkICE9IC0xKXsKICAgICAgICAgICAgICAgICAgICAkcGFyYW1ldGVyc1sibW9kZWxfaWQiXSA9ICRtb2RlbF9pZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkdXNhZ2VfaWQgIT0gLTEpewogICAgICAgICAgICAgICAgICAgICRwYXJhbWV0ZXJzWyJ1c2FnZV9pZCJdID0gJHVzYWdlX2lkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCRib2R5X2lkICE9IC0xKXsKICAgICAgICAgICAgICAgICAgICAkcGFyYW1ldGVyc1siYm9keV9pZCJdID0gJGJvZHlfaWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJG9yZGVyX2J5ICE9IC0xKXsKICAgICAgICAgICAgICAgICAgICAkcGFyYW1ldGVyc1sib3JkZXJfYnkiXSA9ICRvcmRlcl9ieTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkb3JkZXJfdHlwZSAhPSAtMSl7CiAgICAgICAgICAgICAgICAgICAgJHBhcmFtZXRlcnNbIm9yZGVyX3R5cGUiXSA9ICRvcmRlcl90eXBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZigkc3RhcnQ+MCl7CiAgICAgICAgICAgICAgICAgICAgJHBhcmFtZXRlcnNbIm9mZnNldCJdID0gJHN0YXJ0OwogICAgICAgICAgICAgICAgICAgICRwYXJhbWV0ZXJzWyJsaW1pdCJdID0gJGxpbWl0OyAKICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAkdmVoaWNsZXMgPSAkdGhpcy0+X2dldF9nYV9hcGlfY2xpZW50KCktPmdldFN0b2NrTGlzdCgkcGFyYW1ldGVycyk7CiAgICAgICAgICAgICAgICBpZiAoY291bnQoJHZlaGljbGVzKSA8ICRsaW1pdCl7CiAgICAgICAgICAgICAgICAgICAgJGxpbWl0ID0gY291bnQoJHZlaGljbGVzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmKCRzdGFydD4wKXsKICAgICAgICAgICAgICAgICAgICAkdmVoaWNsZXNfdG9fc2hvdyA9ICR2ZWhpY2xlczsKICAgICAgICAgICAgICAgICAgICAkdG90cm93cyA9IGFycmF5X2tleV9leGlzdHMoInRvdHJvd3MiLCAkX0dFVCkgPyAkX0dFVFsidG90cm93cyJdIDogKGFycmF5X2tleV9leGlzdHMoInRvdHJvd3MiLCAkX1BPU1QpID8gJF9QT1NUWyJ0b3Ryb3dzIl0gOiAkbGltaXQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgICAgICAkdmVoaWNsZXNfdG9fc2hvdyA9IGFycmF5KCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICgkaSA9ICRzdGFydDsgJGkgPCAkbGltaXQ7ICRpKyspewogICAgICAgICAgICAgICAgICAgICAgICAkdmVoaWNsZXNfdG9fc2hvd1tdID0gJHZlaGljbGVzWyRpXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgJHRvdHJvd3MgPSBjb3VudCgkdmVoaWNsZXMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAkY29udGVudCAuPSBHZXN0aW9uYWxlQXV0b0NvbnRlbnQ6OnZlaGljbGVzTGlzdCgKICAgICAgICAgICAgICAgICAgICAgICAgJHZlaGljbGVzX3RvX3Nob3csIAogICAgICAgICAgICAgICAgICAgICAgICAkdGhpcy0+X3BhZ2VfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICR0b3Ryb3dzCiAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgCgkJJGNvbnRlbnQgPSBzdHJfcmVwbGFjZSgnWy1tYWluLV0nLCAkc2VhcmNoX2Zvcm0sICRjb250ZW50KTsKCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgICR2ZWhpY2xlID0gJHRoaXMtPl9nZXRfZ2FfYXBpX2NsaWVudCgpLT5nZXRTdG9ja0RldGFpbCgkX0dFVFsndmVoaWNsZV9pZCddKTsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgJGNvbnRlbnQgLj0gR2VzdGlvbmFsZUF1dG9Db250ZW50Ojp2ZWhpY2xlRGV0YWlsKAogICAgICAgICAgICAgICAgICAgICAgICAkdmVoaWNsZQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgIAoJCSRjb250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