Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 6 Jun 2014 03:53:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 05 23:53:01 2014 Received: from localhost ([127.0.0.1]:46352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1WslDA-0003WE-Er for submit <at> debbugs.gnu.org; Thu, 05 Jun 2014 23:53:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43297) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <behoffski@HIDDEN>) id 1WslD9-0003Vy-7E for submit <at> debbugs.gnu.org; Thu, 05 Jun 2014 23:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <behoffski@HIDDEN>) id 1WslCl-000084-VV for submit <at> debbugs.gnu.org; Thu, 05 Jun 2014 23:52:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <behoffski@HIDDEN>) id 1WslCl-00007y-IG for submit <at> debbugs.gnu.org; Thu, 05 Jun 2014 23:52:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <behoffski@HIDDEN>) id 1WslCV-0005Xw-JY for bug-grep@HIDDEN; Thu, 05 Jun 2014 23:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <behoffski@HIDDEN>) id 1WslCD-0008Rs-PU for bug-grep@HIDDEN; Thu, 05 Jun 2014 23:52:19 -0400 Received: from ipmail06.adl2.internode.on.net ([2001:44b8:8060:ff02:300:1:2:6]:41848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <behoffski@HIDDEN>) id 1WslC4-0008I0-T2 for bug-grep@HIDDEN; Thu, 05 Jun 2014 23:52:01 -0400 X-IronPort-Anti-Spam-NotFiltered: toobig Received: from ppp14-2-27-84.lns21.adl2.internode.on.net (HELO [192.168.1.1]) ([14.2.27.84]) by ipmail06.adl2.internode.on.net with ESMTP; 06 Jun 2014 13:21:22 +0930 Message-ID: <53913AB8.50301@HIDDEN> Date: Fri, 06 Jun 2014 13:21:20 +0930 From: behoffski <behoffski@HIDDEN> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: bug-grep@HIDDEN Subject: Updated "untangle" script: More functional, and resynced with 2.20 Content-Type: multipart/mixed; boundary="------------020206090706050709060901" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> This is a multi-part message in MIME format. --------------020206090706050709060901 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit G'day, Here's an updated "untangle" Lua script (http://www.lua.org/), resynchronised with the changes up until Grep 2.20 (specifically commit ...78f07b8c8e26, the post-release administrivia commit after the release). The original script (17 April) was fairly rough and incomplete in places; and was overshadowed by the many improvements being made in the lead-up to 2.19, especially the extremely impressive work from Norihiro, Paul and Jim at multiple levels to improve performance, documentation, and code consistency and clarity in many areas. I still believe that a more fundamental rework of dfa.c, based on making the token language more expressive, is worthwhile, but that such an invasive change could only occur if dfa.c was made easier to modify; hence, this untangle script. There are two major improvements over the 17 April version: 1. The modules now clean up after themselves, instead of leaving dangling memory blocks. Running "make check" with Valgrind, as per the script suggested by Jim in his 21 May message, now runs cleanly, although the "symlink" test hangs on my system for both the original and modified grep versions, for reasons that I haven't tried to track down. 2. I've created a new module, "mbcsets", which models multibyte character class sets at arm's length to users, in a similar fashion to the "charclass" module. The result is that the token output from fsaparse should now be identical to the token output from parse in dfa.c, whereas previously the comparison could only be made at the output of fsalex, as it did not share its internally-build mbcsets structures. There's quite a number of implementation differences that are worth inspecting in the untangled versions: 1. Charclass has moved from persistent class indices, but changing class pointers (due to realloc ()), to also explicitly supporting persistent pointers. This has facilitated better charclass caching in various places; 2. I'm still working towards a scenario where multiple lexers/parsers/etc could co-exist in different-locale and/or different-regex-option versions, with the locale captured when fsalex_syntax () is called by the client, and all other users rigorously obtain locale information directly or indirectly via the lexer. This is incomplete; one example that I haven't fixed yet is the using_utf8 () test in fsaparse; 3. find_pred (), in fsalex, exploits the charclass pointer guarantee to do lazy caching of predicate searches; 4. The treatment of \s and \S in fsalex_lex () has been rewritten to not use PUSH_LEX_STATE/POP_LEX_STATE, as it calls underlying resources such as find_pred directly. (Incidentally, the IS_WORD_CONSTITUENT implementation of \w/\W in dfa.c is quite different to the \s/\S treatment in the original dfa.c: Is this code correct in a multibyte environment?); 5. I reworked FETCH_WC/FETCH_CHAR only a few days before Paul and Norihiro mad extensive improvements; I've tried to integrate their changes into my version without compromising their excellent work; my version is sufficiently different, in documentation even if nowhere else, to be worth a look; and 6. My personal coding preference is to not guarantee single-exit functions, but instead, try to treat exceptional and/or simple cases early in the function, with an immediate function return. My hope is that this makes the remainder of the function easier to understand, as the reader knows that certain cases have been eliminated. In this vein, I (possibly rashly) decided to rewrite atom () and closure () in fsaparse; all feedback on this effort is welcome. As before, the code modifies dfa.c to create "dfa-prl.c", so that the original code and the new code can be run in "parallel", and the outputs compared. The comparison is logged in /tmp/parallel.log. The co-existence of new and old code means that the new code has to have explicit module name prefixes in many places, at least to avoid namespace clashes. This message contains the updated "untangle" Lua script, along with the "strictness" module, from LuaRocks, that I use to stop global variables (usually the result of typos) from being created freely. I'll post a follow-up message shortly, with the full set of created and/or modified files created by the script, for those that (probably quite wisely) may distrust Lua scripts from strangers. cheers, behoffski (Brenton Hoff) Programmer, Grouse Software --------------020206090706050709060901 Content-Type: text/plain; charset=us-ascii; name="untangle" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="untangle" IyEvYmluL2VudiBsdWEKCi0tLSBVbnRhbmdsZSAtLSBTY3JpcHQgdG8gZW5hYmxlIHJlZmFj dG9yaW5nIGRmYS5jICg+NDAwMCBsaW5lcykKCi0tW1sKICAgQ29weXJpZ2h0IChDKSAyMDEz LTIwMTQgR3JvdXNlIFNvZnR3YXJlLgoKICAgVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdh cmU7IHlvdSBjYW4gcmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkKICAgaXQgdW5kZXIg dGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBhcyBwdWJsaXNo ZWQgYnkKICAgdGhlIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbjsgZWl0aGVyIHZlcnNpb24g Mywgb3IgKGF0IHlvdXIgb3B0aW9uKQogICBhbnkgbGF0ZXIgdmVyc2lvbi4KCiAgIFRoaXMg cHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aG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2luZy11dGY4IiwgZGZhaCwgMTE1KQpTZWdzOlRh ZygidXNpbmctdXRmOC1leHRlcm4iLCAgICAgICAgICAgICAgMCkKCi0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tCgotLSBQcm9jZXNzIGRmYS5jClNlY3Rpb24oImRmYS5jIGhlYWRlciIsIGRmYWMs IDApCgpTZWdzOlRhZygiRGVzY3JpcHRpb24uZGZhYyIsICAgICAgICAgICAgICAgMSkKU2Vn czpUYWcoIkNvcHlyaWdodC5kZmFjIiwgICAgICAgICAgICAgICAgIDIsICAgMykKU2VnczpU YWcoIkxpY2Vuc2VXYXJyYW50eS5kZmFjIiwgICAgICAgICAgIDUsICAxOCkKU2VnczpUYWco IkF1dGhvcnMuZGZhYyIsICAgICAgICAgICAgICAgICAgMjAsICAyMSkKU2VnczpUYWcoIkNv bmZpZ0VudiIsICAgICAgICAgICAgICAgICAgICAgMjMpClNlZ3M6VGFnKCJPd25EZWZzLmRm YWMiLCAgICAgICAgICAgICAgICAgIDI1KQpTZWdzOlRhZygiR2xvYmFsSW5jbHVkZXMiLCAg ICAgICAgICAgICAgICAyNywgIDMzKQoKU2VjdGlvbigidmFyaW91cy1tYWNyb3MtYW5kLWhl bHBlci1mbnMiLCBkZmFjLCAzNSkKU2VnczpUYWcoIlNUUkVRIiwgICAgICAgICAgICAgICAg ICAgICAgICAgIDApClNlZ3M6VGFnKCJJU0FTQ0lJRElHSVQiLCAgICAgICAgICAgICAgICAg ICAyLCAgMTApClNlZ3M6VGFnKCJOYXR1cmFsTGFuZ1N1cHBvcnQiLCAgICAgICAgICAgIDEy LCAgMTMpCgpTZWdzOlRhZygiZGZhLXdjaGFyLXdjdHlwZSBpbmNsdWRlIiwgICAgICAxNSwg IDE2KQoKU2VnczpUYWcoInhhbGxvYyIsICAgICAgICAgICAgICAgICAgICAgICAgMTgpIC0t IG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yml0LWJvZHkiLCAgICAgICAg ICAgIDQsICAgNikKU2VnczpUYWcoImNoY2xhc3Mtc2V0Yml0LWRlY2wiLCAgICAgICAgICAg IDgsICAgOSkKU2VnczpUYWcoImNoY2xhc3Mtc2V0Yml0LWJvZHkiLCAgICAgICAgICAgMTAs ICAxMikKU2VnczpUYWcoImNoY2xhc3MtY2xyYml0LWRlY2wiLCAgICAgICAgICAgMTQsICAx NSkKU2VnczpUYWcoImNoY2xhc3MtY2xyYml0LWJvZHkiLCAgICAgICAgICAgMTYsICAxOSkK Ci0tIC4uLiB3aG9sZS1zZXQgY29weSwgY2xlYXIsIGludmVydCwgY29tcGFyZQpTZWN0aW9u KCJDaGFyYWN0ZXIgY2xhc3Nlcy1zZXQgb3BlcmF0aW9ucyIsIGRmYWMsIDU5NykKU2VnczpU YWcoImNoY2xhc3MtY29weXNldC1kZWNsIiwgICAgICAgICAgIDAsICAgMSkKU2VnczpUYWco ImNoY2xhc3MtY29weXNldC1ib2R5IiwgICAgICAgICAgIDIsICAgNCkKU2VnczpUYWcoImNo Y2xhc3MtemVyb3NldC1kZWNsIiwgICAgICAgICAgIDYsICAgNykKU2VnczpUYWcoImNoY2xh c3MtemVyb3NldC1ib2R5IiwgICAgICAgICAgIDgsICAxMCkKU2VnczpUYWcoImNoY2xhc3Mt bm90c2V0LWRlY2wiLCAgICAgICAgICAgMTIsICAxMykKU2VnczpUYWcoImNoY2xhc3Mtbm90 c2V0LWJvZHkiLCAgICAgICAgICAgMTQsICAxOSkKU2VnczpUYWcoImNoY2xhc3MtZXF1YWwt ZGVjbCIsICAgICAgICAgICAgMjEsICAyMikKU2VnczpUYWcoImNoY2xhc3MtZXF1YWwtYm9k eSIsICAgICAgICAgICAgMjMsICAyNSkKCi0tIG1heWJlX3JlYWxsb2MgLS0gUmVwbGFjZSBS RUFMTE9DX0lGX05FQ1NTQVJZIG1hY3JvIHdpdGggZnVuY3Rpb24KU2VjdGlvbigiTWF5YmUt cmVhbGxvYyBmbiIs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nKCJh ZGRfdXRmOF9hbnljaGFyLWRlc2NyaXB0aW9uIiwgIDM5LCAgNDgpClNlZ3M6VGFnKCJhZGRf dXRmOF9hbnljaGFyLWFkZC10b2tlbnMiLCAgIDQ5LCAgNTYpClNlZ3M6VGFnKCJhZGRfdXRm OF9hbnljaGFyLWJvZHktZW5kIiwgICAgIDU3KQoKU2VjdGlvbigiUGFyc2VyIiwgZGZhYywg MTc2MCkKU2VnczpUYWcoIkdyYW1tYXIgc3VtbWFyeSBjb21tZW50IiwgICAgICAgIDAsICAz MykKU2VnczpUYWcoImF0b20iLCAgICAgICAgICAgICAgICAgICAgICAgICAgMzUsICA5MCkK U2VnczpUYWcoIm5zdWJ0b2tzIiwgICAgICAgICAgICAgICAgICAgICAgOTIsIDExMSkKU2Vn czpUYWcoImNvcHl0b2tzIiwgICAgICAgICAgICAgICAgICAgICAxMTMsIDEyNSkKClNlY3Rp b24oIlBhcnNlciwgUGFydCAyIiwgZGZhYywgMTg4NykKU2VnczpUYWcoImNsb3N1cmUiLCAg ICAgICAgICAgICAgICAgICAgICAgIDAsICA0MCkKU2VnczpUYWcoImJyYW5jaCIsICAgICAg ICAgICAgICAgICAgICAgICAgNDIsICA1MSkKU2VnczpUYWcoInJlZ2V4cCIsICAgICAgICAg ICAgICAgICAgICAgICAgNTMsICA2MykKLS0gZGZhcGFyc2U6IEV4dGVybmFsIHVzZXIncyBt YWluIGVudHJ5IHBvaW50IGZvciB0aGUgcGFyc2VyCi0tIFN1ZGRlbmx5LCB0aGUgZGZhIHN0 cnVjdCBpcyBzZWVuIG1vcmUgaW4gcGFyYW1ldGVyIGxpc3RzIChhcyAiZCIpLAotLSBhbHRo b3VnaCBpdCdzIGNvcGllZCB0byB0aGUgZmlsZS1nbG9iYWwtc2NvcGUgdmFyaWFibGUgImRm YSIgaGVyZS4KU2VnczpUYWcoImRmYXBhcnNlLWRlY2wiLCAgICAgICAgICAgICAgICAgNjUs ICA2OSkKU2VnczpUYWcoImRmYXBhcnNl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AgICAgICAgICAgIDE2LCAgMjIpClNlZ3M6VGFnKCJp bnNlcnQiLCAgICAgICAgICAgICAgICAgICAgICAgIDI0LCAgNTQpClNlZ3M6VGFnKCJtZXJn ZSIsICAgICAgICAgICAgICAgICAgICAgICAgIDU2LCAgODQpClNlZ3M6VGFnKCJkZWxldGUi LCAgICAgICAgICAgICAgICAgICAgICAgIDg2LCAgOTgpClNlZ3M6VGFnKCJzdGF0ZV9pbmRl eCIsICAgICAgICAgICAgICAgICAgMTAwLCAxNjApIC0tIGZpbmQgYW5kL29yIGNyZWF0ZSBp dGVtClNlZ3M6VGFnKCJlcHNjbG9zdXJlIiwgICAgICAgICAgICAgICAgICAgMTYyLCAyMjYp IC0tIGVwc2lsb24gY2xvc3VyZQoKLS0gU29tZSBtb3JlIGZ1bmN0aW9ucyB0byBtYW5pcHVs YXRlIGNvbnRleHRzCgpTZWN0aW9uKCJDb250ZXh0LWZucyIsIGRmYWMsIDIyMTgpClNlZ3M6 VGFnKCJjaGFyY2xhc3NfY29udGV4dCIsICAgICAgICAgICAgICAwLCAgMjEpClNlZ3M6VGFn KCJzdGF0ZV9zZXBhcmF0ZV9jb250ZXh0cyIsICAgICAgIDIzLCAgNDQpCgpTZWN0aW9uKCJk ZmFhbmFseXplIiwgZGZhYywgMjI2NSkKU2VnczpUYWcoImRmYWFuYWx5c2Ugc3VtbWFyeSBj b21tZW50IiwgICAgIDAsICA1MSkKU2VnczpUYWcoImRmYWFuYWx5c2UiLCAgICAgICAgICAg ICAgICAgICAgNTIsIDI1OCkKClNlY3Rpb24oImRmYXN0YXRlIiwgZGZhYywgMjUyNikKU2Vn czpUYWcoImRmYXN0YXRlIHN1bW1hcnkgY29tbWVudCIsICAgICAgIDAsICAyOSkKU2VnczpU YWcoImRmYXN0YXRlIiwgICAgICAgICAgICAgICAgICAgICAgMzAsIDI4NCkKU2VnczpUYWco InJlYWxsb2NfdHJhbnNfaWZfbmVjZXNzYXJ5IiwgICAyODYsIDMwOSkKU2Vncz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ywgMzg2 NCkKU2VnczpUYWcoIm11c3QgdHlwZWRlZiIsICAgICAgICAgICAgICAgICAgIDAsICAxMSkK U2VnczpUYWcoImFsbG9jbXVzdCIsICAgICAgICAgICAgICAgICAgICAgMTMsICAyNSkKU2Vn czpUYWcoInJlc2V0bXVzdCIsICAgICAgICAgICAgICAgICAgICAgMjcsICAzNSkKU2VnczpU YWcoImZyZWVtdXN0IiwgICAgICAgICAgICAgICAgICAgICAgMzcsICA0NikKU2VnczpUYWco ImRmYW11c3QgZGVjbGFyYXRpb24iLCAgICAgICAgICAgNDgsICA0OSkKU2VnczpUYWcoImRm YW11c3QgZGVmaW5pdGlvbiIsICAgICAgICAgICAgNTAsIDI1MCkKLS0gZGZhYWxsb2Mgc2hv dWxkIGJlIG5lYXIgZGZhZnJlZSAoYXBwcm94LiBsaW5lIDM1NTApLCBhcyB0aGV5IGFyZSBh IHBhaXIKU2VnczpUYWcoImRmYWFsbG9jIiwgICAgICAgICAgICAgICAgICAgICAyNTIsIDI1 NikKU2VnczpUYWcoImRmYW11c3RzIiwgICAgICAgICAgICAgICAgICAgICAyNTgsIDI2MikK ClNlY3Rpb24oImVuZC1jb25maWd1cmUtdmltLWF0dHJpYnV0ZXMiLCBkZmFjLCA0MTI4KQoK U2VnczpUYWcoInZpbTogc2V0IHNoaWZ0d2lkdGg9MiIsICAgICAgICAgIDApCgotLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLQoKLS0gUHJvY2VzcyBNYWtlZmlsZS5hbQpTZWN0aW9uKCJBdXRvbWFr ZSBmaWxlIGhlYWRlciIsIG1ha2VmaWxlYW0sIDApClNlZ3M6VGFnKCJhdXRvbWFrZS1wcm9j ZXNzLWhpbnQiLCAgICAgICAgICAxKQpTZWdzOlRhZygiQ29weXJpZ2h0Lm1ha2VmaWxlYW0i LCAgICAgICAgICAgMikKU2VnczpUYWcoIkNvbW1lbnQtYmxvY2stc3BhY2VyLTEiLCAgICAg ICAgIDMpClNlZ3M6VGFnKCJMaWNlbnNlV2FycmFudHkubWFrZWZpbGVhbSIsICAgICA0LCAg MTUpCgotLSBEZWZpbmUgImF1dG9tYWtlLXBlcnNpc3RlbnQiIHNoYWRvdyB2ZXJzaW9ucyBv ZiBidWlsZC10aW1lIG1hY3JvcwpTZWN0aW9uKCJhbS1wZXJzaXN0ZW50LW1hY3JvcyIsIG1h a2VmaWxlYW0sIDE3KQpTZWdzOlRhZygiYW06TE4iLCAgICAgICAgICAgICAgICAgICAgICAg ICAgMCkKU2VnczpUYWcoImFtOkFNX0NGTEFHUyIsICAgICAgICAgICAgICAgICAgIDIpClNl Z3M6VGFnKCJhbTpBTV9MREZMQUdTIiwgICAgICAgICAgICAgICAgICA0LCAgIDUpCgpTZWN0 aW9uKCJhbS1wcm9ncmFtcy1nZW5lcmF0ZWQiLCBtYWtlZmlsZWFtLCAyNCkKU2VnczpUYWco ImFtOmJpbl9QUk9HUkFNUyIsICAgICAgICAgICAgICAgIDApClNlZ3M6VGFnKCJhbTpiaW5f U0NSSVBUUyIsICAgICAgICAgICAgICAgICAxKQoKU2VjdGlvbigic291cmNlcy1hbmQtaGVh ZGVycyIsIG1ha2VmaWxlYW0sIDI2KQpTZWdzOlRhZygiZ3JlcF9TT1VSQ0VTIiwgICAgICAg ICAgICAgICAgICAgMCwgICAzKQpTZWdzOlRhZygibm9pbnN0X0hFQURFUlMiLCAgICAgICAg ICAgICAgICAgNCkKClNlY3Rpb24oImFkZGl0aW9uYWwgbGluayBsaWJzIiwgbWFrZWZpbGVh bSwgMzIpClNlZ3M6VGFnKCJMSUJJTlRMIGRvY3VtZW50YXRpb24iLCAgICAgICAgICAgMCwg ICA0KQpTZWdzOlRhZygiTERBREQgZGVmbiIsICAgICAgICAgICAgICAgICAgICAgIDUsICAg NykKU2VnczpUYWcoImdyZXBfTERBREQiLCAgICAgICAgICAgICAgICAgICAgICA5KQp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lZC4gICovCnZvaWQKbWJjc2V0 c19jb21wbGV0ZWQgKG1iY3NldHNfc2V0X3QgKm1iYykKXV0KCkRlY2xzWyJtYmNzZXRzLWdl dC1jaGFyYWN0ZXJpc3RpY3MiXSA9IFtbCi8qIFJldHJpZXZlIGhpZ2gtbGV2ZWwgaW5mb3Jt YXRpb24gYWJvdXQgdGhlIGNsYXNzLCB3aGljaCBpcyB1c2VmdWwKICAgKGluIGZzYXBhcnNl KSBmb3IgZGVjaWRpbmcgb24gaG93IHRvIGRlYWwgd2l0aCBpdC4gIFdlIGFyZSBmb3JjZWQK ICAgdG8gcHJvdmlkZSBzaWduaWZpY2FudCBxdWVyeSByZXNvdXJjZXMgc2luY2Ugd2UgZGVt YW5kIHRoYXQgdGhlCiAgIHR5cGUgaW50ZXJuYWwgcmVtYWluIG9wYXF1ZSAoZXZlbiB0aG91 Z2ggdGhlIGluaXRpYWwKICAgaW1wbGVtZW50YXRpb24gbWF5IGRvIGEgcG9vciBqb2Igb2Yg dGhpcyBlZmZvcnQpLiAgKi8Kdm9pZAptYmNzZXRzX2dldF9jaGFyYWN0ZXJpc3RpY3MgKG1i Y3NldHNfc2V0X3QgKm1iYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sICpw X2ludmVydCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyY2xhc3NfdCAqKnBw X2NoYXJjbGFzcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgKnBfbmNo YXJzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCAqcF9uY2hfY2xhc3Nl cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgKnBfbnJhbmdlcywKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplX3QgKnBfbmVxdWl2cywKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBzaXplX3QgKnBfbmNvbGxfZWxlbXMpCl1dCgotLSBGdW5j dGlvbnMgZnJvbSB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HkiLAog ICAgICAgICAgICAgICAgICAiXG4gIG1lbXNldCAuLVxuIiwKICAgICAgICAgICAgICAgICAg IlxuICBtZW1zZXQgKGNjbC0+bWVtYmVycywgMCwgc2l6ZW9mKGNjbC0+bWVtYmVycykpO1xu IikKYXNzZXJ0KGY6d3JpdGUoYm9keSwgIlxuIikpCmFzc2VydChmOndyaXRlKERlY2xzWyJu b3RzZXQiXSkpCmxvY2FsIGJvZHkgPSBFZGl0ZWRUZXh0KCJjaGNsYXNzLW5vdHNldC1ib2R5 IiwKICAgICAgICAgICAgICAiICAgIHMlW2klXSA9IENIQVJDTEFTU19XT1JEX01BU0sgJiB+ cyVbaSVdIiwKICAgICAgICAgICAgICAiICAgIGNjbC0+bWVtYmVyc1tpXSA9IENIQVJDTEFT U19XT1JEX01BU0sgJiB+Y2NsLT5tZW1iZXJzW2ldIikKYXNzZXJ0KGY6d3JpdGUoYm9keSwg IlxuIikpCmFzc2VydChmOndyaXRlKERlY2xzWyJlcXVhbCJdKSkKbG9jYWwgYm9keSA9IEVk aXRlZFRleHQoImNoY2xhc3MtZXF1YWwtYm9keSIsCiAgICAgICAgICAgICAgICAgICAgICAg ICJcbiAgcmV0dXJuIC4tXG4iLAogICAgICAgICAgICAgICAgICAgICAgICAiXG4gIHJldHVy biBtZW1jbXAgKGNjbDEtPm1lbWJlcnMsIGNjbDItPm1lbWJlcnMsXG4iCiAgICAgICAgICAu LiAiICAgICAgIHNpemVvZihjY2wxLT5tZW1iZXJzKSkgPT0gMDtcbiIpCmFzc2VydChmOndy aXRlKGJvZHksICJcbiIpKQoKLS0gQWRkICJ1bmlvbnNldCIgYW5kICJpbnRlcnNlY3RzZXQi IGZ1bmN0aW9ucyBzbyB3ZSBjYW4gdXNlIGNsYXNzZXMgbW9yZQotLSBleHByZXNzaXZlbHkg YW5kIGRpcmVjdGx5Lgphc3NlcnQoZjp3cml0ZShEZWNsc1sidW5pb25zZXQiXSkpCmFzc2Vy dChmOndyaXRlKFtbCnsKICBpb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ZW5zYXRlCiAgICAgZm9yIGxpbWl0ZWQgdW5jZXJ0YWludHkgaW50cm9k dWNlZCBieSB0aGUgJXAgZm9ybWF0dGluZyBvcGVyYXRvci4gICovCiAgc3RhdGljIGNoYXIg YnVmWzI1Nl07CiAgY2hhciAqcF9idWYgPSBidWY7CiAgaW50IGk7CgogIHBfYnVmICs9IHNw cmludGYgKHBfYnVmLCAiMHglMDhseDoiLCAodW5zaWduZWQgbG9uZykgY2NsKTsKICBmb3Ig KGkgPSAwOyBpIDwgQ0hBUkNMQVNTX1dPUkRTOyBpICs9IDIpCiAgICB7CiAgICAgIGludCBq ID0gY2NsLT5tZW1iZXJzW2ldOwogICAgICAqcF9idWYrKyA9ICcgJzsKICAgICAgKnBfYnVm KysgPSBkaXNwX255YmJsZVsoaiA+PiAgMCkgJiAweDBmXTsKICAgICAgKnBfYnVmKysgPSBk aXNwX255YmJsZVsoaiA+PiAgNCkgJiAweDBmXTsKICAgICAgKnBfYnVmKysgPSBkaXNwX255 YmJsZVsoaiA+PiAgOCkgJiAweDBmXTsKICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVso aiA+PiAxMikgJiAweDBmXTsKICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAx NikgJiAweDBmXTsKICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAyMCkgJiAw eDBmXTsKICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAyNCkgJiAweDBmXTsK ICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAyOCkgJiAweDBmXTsKCiAgICAg IGogPSBjY2wtPm1lbWJlcnNbaSArIDFdOwogICAgICAqcF9idWYrKyA9IGRpc3BfbnliYmxl WyhqID4+ICAwKSAmIDB4MGZdOwogICAgICAqcF9idWYrKyA9IGRpc3BfbnliYmxlWyhqID4+ ICA0KSAmIDB4MGZdOwogICAgICAqcF9idWYrKyA9IGRpc3BfbnliYmxl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3RhdGVzOiAiKTsKICAgICAgZm9yIChjbGFzc19uciA9IDA7IGNsYXNzX25yIDwgcG9v bC0+YWxsb2M7IGNsYXNzX25yKyspCiAgICAgICAgc3dpdGNoIChwb29sLT5jbGFzc19zdGF0 ZVtjbGFzc19ucl0pIHsKICAgICAgICAgIGNhc2UgU1RBVEVfVU5VU0VEOiAgICBwdXRjaGFy ICgnLicpOyBicmVhazsKICAgICAgICAgIGNhc2UgU1RBVEVfV09SS0lORzogICBwdXRjaGFy ICgndycpOyBicmVhazsKICAgICAgICAgIGNhc2UgU1RBVEVfQ09NUExFVEVEOiBwdXRjaGFy ICgnQycpOyBicmVhazsKICAgICAgICAgIGRlZmF1bHQ6IHByaW50ZiAoIj8lMDJ4IiwgcG9v bC0+Y2xhc3Nfc3RhdGVbY2xhc3NfbnJdKTsKICAgICAgICB9CiAgICAgIHB1dGNoYXIgKCdc bicpOwogICAgfQoKICAvKiBJZiBjbGFzcyBjb250ZW50cyByZXF1ZXN0ZWQsIHByaW50IHRo ZW0gb3V0IGFzIHdlbGwuICAqLwogIGlmIChjbGFzc19jb250ZW50cykKICAgIGZvciAocG9v bF9uciA9IDA7IHBvb2xfbnIgPCBwb29sX2xpc3RfdXNlZDsgcG9vbF9ucisrKQogICAgICB7 CiAgICAgICAgcG9vbF90ICpwb29sID0gJnBvb2xfbGlzdFtwb29sX25yXTsKICAgICAgICBm b3IgKGNsYXNzX25yID0gMDsgY2xhc3NfbnIgPCBwb29sLT51c2VkOyBjbGFzc19ucisrKQog ICAgICAgICAgcHJpbnRmICgiJXNcbiIsCiAgICAgICAgICAgICAgICAgIGNoYXJjbGFzc19k ZXNjcmliZSAoJnBvb2wtPmNsYXNzZXNbY2xhc3NfbnJdKSk7CiAgICAgIH0KfQoKLyogI2Vu ZGlmICogREVCVUcgKi8KCnN0YXRpYyBwb29sX3QgKgphZGRfbmV3X3Bvb2wgKHZvaWQpCnsK ICBwb29sX3QgKnByZXYsICpwb29sOwogIHNpemVfdCBwb29s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vciBhIGNvbXBsZXRlZCBjbGFz cyBtYXRjaGluZyB0aGlzIGNsYXNzLCBhbmQsIGlmCiAgICAgZm91bmQsIHVzZSBpdCBpbiBw cmVmZXJlbmNlIHRvIHRoZSBuZXcgb25lLiAgV2hpbGUgc2VhcmNoaW5nLCBhbHNvCiAgICAg cmVjb3JkIHdoZXJlIHRoZSB3b3JrIGNsYXNzIGlzIGxvY2F0ZWQuICBJZiB3ZSBjYW4ndCBm aW5kIG91cnNlbHZlcywgdGhlCiAgICAgcG9pbnRlciBpcyBpbnZhbGlkLCBhbmQgdGhyb3cg YW4gYXNzZXJ0aW9uLiAgICovCiAgZm9yIChwb29sX25yID0gMDsgcG9vbF9uciA8IHBvb2xf bGlzdF91c2VkOyBwb29sX25yKyspCiAgICB7CiAgICAgIHBvb2wgPSAmcG9vbF9saXN0W3Bv b2xfbnJdOwogICAgICBmb3IgKGNsYXNzX25yID0gMDsgY2xhc3NfbnIgPCBwb29sLT51c2Vk OyBjbGFzc19ucisrKQogICAgICAgIHsKICAgICAgICAgIGNoYXJjbGFzc190ICpzZWFyY2gg PSAmcG9vbC0+Y2xhc3Nlc1tjbGFzc19ucl07CiAgICAgICAgICAvKiBIYXZlIHdlIGZvdW5k IG91cnNlbHZlcyBpbiB0aGUgbGlzdD8gKi8KICAgICAgICAgIGlmIChzZWFyY2ggPT0gY2Ns KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgLyogWWVzLCByZW1lbWJlciB0aGlzIHBs YWNlIGluIGNhc2Ugbm8gZHVwbGljYXRlIGlzIGZvdW5kLiAgKi8KICAgICAgICAgICAgICBt eV9wb29sID0gcG9vbDsKICAgICAgICAgICAgICBteV9jbGFzc19uciA9IGNsYXNzX25yOwog ICAgICAgICAgfQogICAgICAgICAgaWYgKHBvb2wtPmNsYXNzX3N0YXRlW2NsYXNzX25yXSAh PSBTVEFURV9DT01QTEVURUQpCiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgaWYg KGNoYXJjbG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AgICAgICAgICAgICAgICAgIGZldGNoZWQ7IHRoaXMgaXMgbmVlZGVkIHdoZW4g YmFja2luZyB1cAogICAgICAgICAgICAgICAgICAgICAgICAgICBkdXJpbmcgbGV4aW5nLiAg SW4gYSBub24tbXVsdGlieXRlIHNpdHVhdGlvbgogICAgICAgICAgICAgICAgICAgICAgICAg ICAobG9jYWxlPyksIHRoaXMgdmFyaWFibGUgcmVtYWlucyBhdCAxOwogICAgICAgICAgICAg ICAgICAgICAgICAgICBvdGhlcndpc2UsIGl0IGlzIHVwZGF0ZWQgYXMgcmVxdWlyZWQgYnkK ICAgICAgICAgICAgICAgICAgICAgICAgICAgRkVUQ0hfV0MuICAqLwoKICAvKiBUaGVzZSB2 YXJpYWJsZXMgYXJlIHVzZWQgb25seSBpZiBpbiBhIG11bHRpYnl0ZSBsb2NhbGUuICAqLwog IHdjaGFyX3Qgd2N0b2s7ICAgICAgICAgLyogU3RvcmFnZSBmb3IgYSBzaW5nbGUgbXVsdGli eXRlIGNoYXJhY3RlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZWQgYm90aCBk dXJpbmcgbGV4aW5nLCBhbmQgYXMgdGhlIGltcGxpZWQKICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHBhcmFtZXRlciBvZiBhIFdDSEFSIHRva2VuIHJldHVybmVkIGJ5IHRoZQogICAg ICAgICAgICAgICAgICAgICAgICAgICAgbGV4ZXIuICAqLwogIG1ic3RhdGVfdCBtYnJ0b3dj X3N0YXRlOyAvKiBTdGF0ZSBtYW5hZ2VtZW50IGFyZWEgZm9yIG1icnRvd2MgdG8KICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdXNlLiAqLwoKXV0pKQoKYXNzZXJ0KGY6d3JpdGUo RWRpdGVkVGV4dCgiZGZhLXN0cnVjdCBtYnJ0b3djX2NhY2hlIiwKICAgICAgICAgICAgICAg ICAgICAgICAgICAiTk9UQ0hBUiIsICJGU0FUT0tFTl9OT1RDSEFSIiksICJcb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IGhlcmUuICBJZiBubyBj aGFyYWN0ZXJzIGFyZSBhdmFpbGFibGUsCiAgIHRoZSBtYWNybyBlaXRoZXIgcmV0dXJucyBF TkQgb3IgcmVwb3J0cyBhbiBlcnJvciwgZGVwZW5kaW5nIG9uCiAgIGVvZmVyci4gIE90aGVy d2lzZSwgb25lIGNoYXJhY3RlciBpcyBjb25zdW1lZCAobGV4cHRyL2xleGxlZnQpLAogICB0 aGUgY2hhciBpcyBjb252ZXJ0ZWQgaW50byBhbiB1bnNpZ25lZCBjaGFyLCBhbmQgaXMgd3Jp dHRlbiBpbnRvCiAgIHRoZSBwYXJhbWV0ZXIgYy4gICovCiNkZWZpbmUgRkVUQ0hfU0lOR0xF X0NIQVIobGV4ZXIsIGMsIGVvZmVycikgICAgICAgICAgICAgICAgICBcCiAgZG8geyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAg ICBpZiAoISAobGV4ZXIpLT5sZXhsZWZ0KSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBcCiAgICAgIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCiAgICAgICAgaWYgKChlb2ZlcnIpICE9IDApICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgICAobGV4ZXIpLT5hYmFuZG9uX3dp dGhfZXJyb3IgKGVvZmVycik7ICAgICAgICAgICAgICBcCiAgICAgICAgZWxzZSAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgICBy ZXR1cm4gRlNBVE9LRU5fVEtfRU5EOyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAg ICAgIH0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBcCiAgICAoYykgPSB0b191Y2hhciAoKihsZXhlciktPmxleHB0cisrKTsgICAgICAg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BiYWNrIHRvIHRoZSBj YWxsZXIuICAqLwojIGRlZmluZSBGRVRDSF9XQyhsZXhlciwgYywgd2MsIGVvZmVycikgICAg ICAgICAgICAgICAgICAgICAgXAogIGRvIHsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgd2NoYXJfdCB0ZW1wX3djOyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgdW5zaWduZWQgY2hh ciB0ZW1wX3VjaGFyOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgKGxl eGVyKS0+Y3VyX21iX2xlbiA9IDE7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAogICAgRkVUQ0hfU0lOR0xFX0NIQVIgKChsZXhlciksIHRlbXBfdWNoYXIsIChlb2ZlcnIp KTsgICAgICAgXAogICAgdGVtcF93YyA9IChsZXhlciktPm1icnRvd2NfY2FjaGVbdGVtcF91 Y2hhcl07ICAgICAgICAgICAgXAogICAgaWYgKHRlbXBfd2MgIT0gV0VPRikgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICB7ICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIChjKSAgPSB0 ZW1wX3VjaGFyOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAg ICh3YykgPSB0ZW1wX3djOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAogICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgXAogICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgXAogICAgICB7ICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIHNpemVfdCBuYnl0ZXM7ICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIHRlbXBfd2Mg PSB0ZW1wX3VjaGFyOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAg IG5ieXRlcyA9IGZldGNoX29mZnNldF93aWRlX2NoYXIgKChsZXhlciksICZ0ZW1wX3djKTsg XAogICAgICAgICh3YykgPSB0ZW1wX3djOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgXAogICAgICAgIChjKSA9IG5ieXRlcyA9PSAxID8gdGVtcF91Y2hhciA6IEVP RjsgICAgICAgICAgICAgICAgXAogICAgICAgIChsZXhlciktPmN1cl9tYl9sZW4gPSBuYnl0 ZXM7ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICB9ICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogIH0gd2hpbGUgKDApCgpd XSkpCgphc3NlcnQoZjp3cml0ZShbWwovKiBHaXZlbiBhIHByZWRpY2F0ZSBuYW1lLCBmaW5k IGl0IGluIGEgbGlzdCwgYW5kIHJlcG9ydCB0aGUgbGlzdAogICBlbnRyeSB0byB0aGUgY2Fs bGVyLiAgSWYgdGhlIG5hbWUgaXMgbm90IHJlY29nbmlzZWQsIHRoZSBmdW5jdGlvbgogICBy ZXR1cm5zIE5VTEwuICBUaGUgbGlzdCBlbnRyeSBpbmNsdWRlcyBhIGNoYXJjbGFzcyBzZXQg YW5kIChpZgogICByZWxldmFudCkgYSB3aWRlLWNoYXIgZGVzY3JpcHRvciBmb3IgdGVzdGlu ZyBmb3IgdGhlIHByZWRpY2F0ZS4KICAgTGF6eSBldmFsdWF0aW9uIGFuZCBjYWNoaW5nIGFy ZSB1c2VkIHRvIGtlZXAgcHJvY2Vzc2luZyBjb3N0cwogICBkb3duLiAgKi8Kc3RhdGljIHBy ZWRpY2F0ZV9lbnRyeV90ICoKZmluZF9wcmVkIChmc2Fs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zX3NldF90ICp3b3JrX21iYyA9IE5VTEw7CgpdXSkKCi0tIFJlcGxhY2UgZGZhZXJyb3Ig YW5kIGRmYXdhcm4gd2l0aCBleHBsaWNpdGx5LXByb3ZpZGVkIGZ1bmN0aW9ucy4KUGFyc2VC cmFja2V0RXhwID0gVGV4dFN1YnN0KFBhcnNlQnJhY2tldEV4cCwKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICIgZGZhd2FybiAiLCAgIiBsZXhlci0+d2Fybl9jbGllbnQgIiwKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICIgZGZhZXJyb3IgIiwgIiBsZXhlci0+YWJhbmRv bl93aXRoX2Vycm9yICIpCgotLSA/PyBUUklBTDogUmVtb3ZlICJGSVhNRTogbXVsdGlieXRl IGNvZGUgJ3dyb25nIGluIG11bHRpcGxlIHdheXMsIGJ1dAotLSAgICAgICAgICAgICAgICAg ICBuZXZlciB1c2VkIGluIHByYWN0aWNlLiciClBhcnNlQnJhY2tldEV4cCA9IFRleHRTdWJz dChQYXJzZUJyYWNrZXRFeHAsIFtbCiAgICAgICAgICAgICAgICAgIC8qIFdoZW4gY2FzZSBm b2xkaW5nIG1hcCBhIHJhbmdlLCBzYXkgW20tel0gKG9yIGV2ZW4gW00tel0pCiAgICAgICAg ICAgICAgICAgICAgIHRvIHRoZSBwYWlyIG9mIHJhbmdlcywgW20tel0gW00tWl0uICBBbHRo b3VnaCB0aGlzIGNvZGUKICAgICAgICAgICAgICAgICAgICAgaXMgd3JvbmcgaW4gbXVsdGlw bGUgd2F5cywgaXQncyBuZXZlciB1c2VkIGluIHByYWN0aWNlLgogICAgICAgICAgICAgICAg ICAgICBGSVhNRTogUmVtb3ZlIHRoaXMgKGFuZCByZWxhdGVkKSB1bnVzZWQgY29kZS4gICov CiAgICAgICAgICAgICAgICAgIGlmICh3YyAhPSBXRU9GICYmIHdjMiAhPSBXRU9GKQogICAg ICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5yYW5n ZXMKICAgICAgICAgICAgICAgICAgICAgICAgPSBtYXliZV9yZWFsbG9jICh3b3JrX21iYy0+ cmFuZ2VzLCB3b3JrX21iYy0+bnJhbmdlcyArIDIsCiAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgJnJhbmdlc19hbCwgc2l6ZW9mICp3b3JrX21iYy0+cmFuZ2Vz KTsKICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5yYW5nZXNbd29ya19tYmMtPm5y YW5nZXNdLmJlZwogICAgICAgICAgICAgICAgICAgICAgICA9IGNhc2VfZm9sZCA/IHRvd2xv d2VyICh3YykgOiB3YzsKICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5yYW5nZXNb d29ya19tYmMtPm5yYW5nZXMrK10uZW5kCiAgICAgICAgICAgICAgICAgICAgICAgID0gY2Fz ZV9mb2xkID8gdG93bG93ZXIgKHdjMikgOiB3YzI7CgogICAgICAgICAgICAgICAgICAgICAg aWYgKGNhc2VfZm9sZCAmJiAoaXN3YWxwaGEgKHdjKSB8fCBpc3dhbHBoYSAod2MyKSkpCiAg ICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICB3b3Jr X21iYy0+cmFuZ2VzW3dvcmtfbWJjLT5ucmFuZ2VzXS5iZWcgPSB0b3d1cHBlciAod2MpOwog ICAgICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5yYW5nZXNbd29ya19tYmMtPm5y YW5nZXMrK10uZW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IHRvd3VwcGVyICh3 YzIpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQpd XSwgW1sKICAgICAgICAgICAgICAgICAgLyogTWVyZWx5IHJlY29yZCByYW5nZSBhcyBnaXZl bjsgZG9uJ3QgdHJ5IHRvIGhhbmRsZSB0aGUKICAgICAgICAgICAgICAgICAgICAgY2FzZS1m b2xkaW5nIHZhcmlhbnRzIGhlcmUgZm9yIG5vdy4gICovCiAgICAgICAgICAgICAgICAgIGlm ICh3YyAhPSBXRU9GICYmIHdjMiAhPSBXRU9GKQogICAgICAgICAgICAgICAgICAgIHsKICAg ICAgICAgICAgICAgICAgICAgIG1iY3NldHNfYWRkX3JhbmdlKHdvcmtfbWJjLCB3Yywgd2My KTsKCiAgICAgICAgICAgICAgICAgICAgICAvKiBGSVhNRSwgcGFydCAyOiAgU2luY2UgdGhl IGNhbm9uaWNhbCBtZWFzdXJlIG9mIGNhc2UKICAgICAgICAgICAgICAgICAgICAgICAgIGVx dWl2YWxlbmNlIGlzIHVwcGVyY2FzZShBKSA9PSB1cHBlcmNhc2UoQiksIHBlcmhhcHMKICAg ICAgICAgICAgICAgICAgICAgICAgIHdlIGNvdWxkIGRvIHRoaXMgdHJhbnNmb3JtYXRpb24g YWJvdmUgaWYgY2FzZV9mb2xkCiAgICAgICAgICAgICAgICAgICAgICAgICBpcyB0cnVlLi4u IGJ1dCBuZWVkIHRvIGJlIGNhcmVmdWwgbm90IHRvIHRocm93IGF3YXkKICAgICAgICAgICAg ICAgICAgICAgICAgIGluZm9ybWF0aW9uLiAgKi8KICAgICAgICAgICAgICAgICAgICB9Cl1d KQoKLS0gTUJDU0VUUzogQ2hhbmdlIG11bHRpYnl0ZSBpbml0aWFsaXNhdGlvbiB0byB1c2Ug bWJjc2V0cyBtb2R1bGUuCi0tIENoYW5nZSAid29yayIgY2hhcmNsYXNzIChjY2wpIGZyb20g bG9jYWwgdmFyaWFibGUgdG8gZXhwbGljaXRseS1hbGxvY2F0ZWQKLS0gZHluYW1pYyBjbGFz cyBmcm9tIGNoYXJjbGFzcy4KUGFyc2VCcmFja2V0RXhwID0gVGV4dFN1YnN0KFBhcnNlQnJh Y2tldEV4cCwgW1sKICAvKiBXb3JrIGFyZWEgdG8gYnVpbGQgYSBtYl9jaGFyX2NsYXNzZXMu ICAqLwogIHN0cnVjdCBtYl9j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fV0MgKGMsIHdjLCBf KCJ1bmJhbGFuY2VkIFsiKSk7CiAgICAgIGludmVydCA9IHRydWU7CiAgICAgIGtub3duX2Jy YWNrZXRfZXhwID0gdXNpbmdfc2ltcGxlX2xvY2FsZSAoKTsKICAgIH0KICBlbHNlCiAgICBp bnZlcnQgPSBmYWxzZTsKXV0sIFtbCiAgaWYgKGxleGVyLT5tdWx0aWJ5dGVfbG9jYWxlKQog ICAgewogICAgICAvKiBFbnN1cmUgd2UgaGF2ZSBzcGFjZSB0byBzdG9yZSB0aGUgbmV3IHNl dC4gICovCiAgICAgIGxleGVyLT5tYmNzZXRzID0gbWF5YmVfcmVhbGxvYyAobGV4ZXItPm1i Y3NldHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV4ZXItPm5t YmNzZXRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZsZXhlci0+ bWJjc2V0c19hbGxvYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz aXplb2Ygd29ya19tYmMpOwoKICAgICAgLyogSW5pdGlhbGl6ZSB3b3JrIGFyZWEuICAqLwog ICAgICB3b3JrX21iYyA9IG1iY3NldHNfbmV3ICgpOwogICAgICBsZXhlci0+bWJjc2V0c1ts ZXhlci0+bm1iY3NldHMrK10gPSB3b3JrX21iYzsKICAgIH0KCiAgY2NsID0gY2hhcmNsYXNz X2FsbG9jICgpOwogIEZFVENIX1dDIChjLCB3YywgXygidW5iYWxhbmNlZCBbIikpOwogIGlm IChjID09ICdeJykKICAgIHsKICAgICAgRkVUQ0hfV0MgKGMsIHdjLCBfKCJ1bmJhbGFuY2Vk IFsiKSk7CiAgICAgIGludmVydCA9IHRydWU7CiAgICAgIGtub3duX2JyYWNrZXRfZXhwID0g bGV4ZXItPnVzaW5nX3NpbXBsZV9sb2NhbGU7CiAgICB9CiAgZWxzZQogICAgaW52ZXJ0ID0g ZmFsc2U7Cl1dKQoKLS0gQ2hhbmdlIGZpbmRfcHJlZCBjb2RlIHRvIHVzZSB0aGUgdHlwZWRl ZiwgYW5kIHRvIG1lcmdlIHRoZSBmb3VuZAotLSBwcmVkaWNhdGUgc3RhdGljIGNsYXNzIGlu dG8gdGhlIGZ1bmN0aW9uJ3MgZHluYW1pYyBjbGFzcy4gIEFsc28KLS0gcmVwbGFjZSBkZmFl cnJvciB3aXRoIGludGVybmFsIGFiYW5kb25fd2l0aF9lcnJvci4KUGFyc2VCcmFja2V0RXhw ID0gVGV4dFN1YnN0KFBhcnNlQnJhY2tldEV4cCwgW1sKICAgICAgICAgICAgICBpZiAoYzEg PT0gJzonKQogICAgICAgICAgICAgICAgLyogQnVpbGQgY2hhcmFjdGVyIGNsYXNzLiAgUE9T SVggYWxsb3dzIGNoYXJhY3RlcgogICAgICAgICAgICAgICAgICAgY2xhc3NlcyB0byBtYXRj aCBtdWx0aWNoYXJhY3RlciBjb2xsYXRpbmcgZWxlbWVudHMsCiAgICAgICAgICAgICAgICAg ICBidXQgdGhlIHJlZ2V4IGNvZGUgZG9lcyBub3Qgc3VwcG9ydCB0aGF0LCBzbyBkbyBub3QK ICAgICAgICAgICAgICAgICAgIHdvcnJ5IGFib3V0IHRoYXQgcG9zc2liaWxpdHkuICAqLwog ICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICBjaGFyIGNvbnN0ICpjbGFzcwog ICAgICAgICAgICAgICAgICAgID0gKGNhc2VfZm9sZCAmJiAoU1RSRVEgKHN0ciwgInVwcGVy IikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IFNUUkVRIChzdHIs ICJsb3dlciIpKSA/ICJhbHBoYSIgOiBzdHIpOwogICAgICAgICAgICAgICAgICBjb25zdCBz dHJ1Y3QgZGZhX2N0eXBlICpwcmVkID0gZmluZF9wcmVkIChjbGFzcyk7CiAgICAgICAgICAg ICAgICAgIGlmICghcHJlZCkKICAgICAgICAgICAgICAgICAgICBkZmFlcnJvciAoXygiaW52 YWxpZCBjaGFyYWN0ZXIgY2xhc3MiKSk7CgogICAgICAgICAgICAgICAgICBpZiAoZGZhLT5t dWx0aWJ5dGUgJiYgIXByZWQtPnNpbmdsZV9ieXRlX29ubHkpCiAgICAgICAgICAgICAgICAg ICAgewogICAgICAgICAgICAgICAgICAgICAgLyogU3RvcmUgdGhlIGNoYXJhY3RlciBjbGFz cyBhcyB3Y3R5cGVfdC4gICovCiAgICAgICAgICAgICAgICAgICAgICB3Y3R5cGVfdCB3dCA9 IHdjdHlwZSAoY2xhc3MpOwoKICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5jaF9j bGFzc2VzCiAgICAgICAgICAgICAgICAgICAgICAgID0gbWF5YmVfcmVhbGxvYyAod29ya19t YmMtPmNoX2NsYXNzZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgd29ya19tYmMtPm5jaF9jbGFzc2VzLCAmY2hfY2xhc3Nlc19hbCwKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YgKndvcmtfbWJjLT5jaF9jbGFz c2VzKTsKICAgICAgICAgICAgICAgICAgICAgIHdvcmtfbWJjLT5jaF9jbGFzc2VzW3dvcmtf bWJjLT5uY2hfY2xhc3NlcysrXSA9IHd0OwogICAgICAgICAgICAgICAgICAgIH0KCiAgICAg ICAgICAgICAgICAgIGZvciAoYzIgPSAwOyBjMiA8IE5PVENIQVI7ICsrYzIpCiAgICAgICAg ICAgICAgICAgICAgaWYgKHByZWQtPmZ1bmMgKGMyKSkKICAgICAgICAgICAgICAgICAgICAg IHNldGJpdCAoYzIsIGNjbCk7CiAgICAgICAgICAgICAgICB9Cl1dLCBbWwogICAgICAgICAg ICAgIGlmIChjMSA9PSAnOicpCiAgICAgICAgICAgICAgICAvKiBGaW5kIGFuZCBtZXJnZSBu YW1lZCBjaGFyYWN0ZXIgY2xhc3MuICBQT1NJWCBhbGxvd3MKICAgICAgICAgICAgICAgICAg IGNoYXJhY3RlciBjbGFzc2VzIHRvIG1hdGNoIG11bHRpY2hhcmFjdGVyIGNvbGxhdGluZwog ICAgICAgICAgICAgICAgICAgZWxlbWVudHMsIGJ1dCB0aGUgcmVnZXggY29kZSBkb2VzIG5v dCBzdXBwb3J0IHRoYXQsCiAgICAgICAgICAgICAgICAgICBzbyBkbyBub3Qgd29ycnkgYWJv dXQgdGhhdCBwb3NzaWJpbGl0eS4gICovCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAg ICAgICAgIGNoYXIgY29uc3QgKmNsYXNzOwogICAgICAgICAgICAgICAgICBwcmVkaWNhdGVf ZW50cnlfdCAqcHJlZDsKCiAgICAgICAgICAgICAgICAgIGNsYXNzID0gc3RyOwogICAgICAg ICAgICAgICAgICBpZiAoY2FzZV9mb2xkICYmIChTVFJFUSAoY2xhc3MsICJ1cHBlciIpCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgU1RSRVEgKGNsYXNzLCAi bG93ZXIiKSkpCiAgICAgICAgICAgICAgICAgICAgY2xhc3MgPSAiYWxwaGEiOwogICAgICAg ICAgICAgICAgICBwcmVkID0gZmluZF9wcmVkIChsZXhlciwgY2xhc3MpOwogICAgICAgICAg ICAgICAgICBpZiAoISBwcmVkKQogICAgICAgICAgICAgICAgICAgIGxleGVyLT5hYmFuZG9u X3dpdGhfZXJyb3IgKF8oImludmFsaWQgY2hhcmFjdGVyIGNsYXNzIikpOwogICAgICAgICAg ICAgICAgICBjaGFyY2xhc3NfdW5pb25zZXQgKHByZWQtPmNsYXNzLCBjY2wpOwoKICAgICAg ICAgICAgICAgICAgLyogRG9lcyB0aGlzIGNsYXNzIGhhdmUgYSB3aWRlLWNoYXIgdHlwZSBk ZXNjcmlwdG9yPyAqLwogICAgICAgICAgICAgICAgICBpZiAobGV4ZXItPm11bHRpYnl0ZV9s b2NhbGUgJiYgcHJlZC0+bWF5X2JlX211bHRpYnl0ZSkKICAgICAgICAgICAgICAgICAgICB7 CiAgICAgICAgICAgICAgICAgICAgICBtYmNzZXRzX2FkZF9jbGFzcyh3b3JrX21iYywgcHJl ZC0+d2NoYXJfZGVzYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAg fQpdXSkKCi0tIE5vdyBoYXZlIGEgZmxhZywgInVzaW5nX3NpbXBsZV9sb2NhbGUiOyBhbHNv IHVzZSBzZXRiaXRfcmFuZ2UuClBhcnNlQnJhY2tldEV4cCA9IFRleHRTdWJzdChQYXJzZUJy YWNrZXRFeHAsIFtbCiAgICAgICAgICAgICAgZWxzZSBpZiAodXNpbmdfc2ltcGxlX2xvY2Fs ZSAoKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgZm9yIChjMSA9IGM7 IGMxIDw9IGMyOyBjMSsrKQogICAgICAgICAgICAgICAgICAgIHNldGJpdCAoYzEsIGNjbCk7 CiAgICAgICAgICAgICAgICAgIGlmIChjYXNlX2ZvbGQpCiAgICAgICAgICAgICAgICAgICAg ewogICAgICAgICAgICAgICAgICAgICAgaW50IHVjID0gdG91cHBlciAoYyk7CiAgICAgICAg ICAgICAgICAgICAgICBpbnQgdWMyID0gdG91cHBlciAoYzIpOwogICAgICAgICAgICAgICAg ICAgICAgZm9yIChjMSA9IDA7IGMxIDwgTk9UQ0hBUjsgYzErKykKICAgICAgICAgICAgICAg ICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgIGludCB1YzEgPSB0b3VwcGVy IChjMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVjIDw9IHVjMSAmJiB1YzEg PD0gdWMyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Yml0IChjMSwgY2NsKTsK ICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KXV0sIFtb CiAgICAgICAgICAgICAgZWxzZSBpZiAobGV4ZXItPnVzaW5nX3NpbXBsZV9sb2NhbGUpCiAg ICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIGNoYXJjbGFzc19zZXRiaXRfcmFu Z2UgKGMsIGMyLCBjY2wpOwogICAgICAgICAgICAgICAgICBpZiAoY2FzZV9mb2xkKQogICAg ICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgIGludCB1YyA9IHRvdXBw ZXIgKGMpOwogICAgICAgICAgICAgICAgICAgICAgaW50IHVjMiA9IHRvdXBwZXIgKGMyKTsK ICAgICAgICAgICAgICAgICAgICAgIGZvciAoYzEgPSAwOyBjMSA8IE5PVENIQVI7IGMxKysp CiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBp bnQgdWMxID0gdG91cHBlciAoYzEpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1 YyA8PSB1YzEgJiYgdWMxIDw9IHVjMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNo YXJjbGFzc19zZXRiaXQgKGMxLCBjY2wpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAg ICAgICAgICAgICAgICAgICAgfQpdXSkKCi0tIEtlZXAgY3JhY2tpbmcgZG93biBvbiBNQl9D VVJfTUFYLCBjYXNlLWJ5LWNhc2UKUGFyc2VCcmFja2V0RXhwID0gVGV4dFN1YnN0KFBhcnNl QnJhY2tldEV4cCwgW1sKICAgICAgaWYgKCFkZmEtPm11bHRpYnl0ZSkKICAgICAgICB7CiAg ICAgICAgICBpZiAoY2FzZV9mb2xkKQogICAgICAgICAgICBzZXRiaXRfY2FzZV9mb2xkX2Mg KGMsIGNjbCk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHNldGJpdCAoYywgY2NsKTsK ICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KXV0sIFtbCiAgICAgIGlmIChsZXhlci0+ dW5pYnl0ZV9sb2NhbGUpCiAgICAgICAgewogICAgICAgICAgaWYgKGNhc2VfZm9sZCkKICAg ICAgICAgICAgc2V0Yml0X2Nhc2VfZm9sZF9jIChjLCBjY2wpOwogICAgICAgICAgZWxzZQog ICAgICAgICAgICBjaGFyY2xhc3Nfc2V0Yml0IChjLCBjY2wpOwogICAgICAgICAgY29udGlu dWU7CiAgICAgICAgfQpdXSkKUGFyc2VCcmFja2V0RXhwID0gVGV4dFN1YnN0KFBhcnNlQnJh Y2tldEV4cCwgW1sKICAgICAgICAgIGlmIChjMiAhPSAnXScpCiAgICAgICAgICAgIHsKICAg ICAgICAgICAgICBpZiAoYzIgPT0gJ1xcJyAmJiAoc3ludGF4X2JpdHMgJiBSRV9CQUNLU0xB U0hfRVNDQVBFX0lOX0xJU1RTKSkKICAgICAgICAgICAgICAgIEZFVENIX1dDIChjMiwgd2My LCBfKCJ1bmJhbGFuY2VkIFsiKSk7CgogICAgICAgICAgICAgIGlmIChkZmEtPm11bHRpYnl0 ZSkKICAgICAgICAgICAgICAgIHsKXV0sIFtbCiAgICAgICAgICBpZiAoYzIgIT0gJ10nKQog ICAgICAgICAgICB7CiAgICAgICAgICAgICAgaWYgKGMyID09ICdcXCcgJiYgKHN5bnRheF9i aXRzICYgUkVfQkFDS1NMQVNIX0VTQ0FQRV9JTl9MSVNUUykpCiAgICAgICAgICAgICAgICBG RVRDSF9XQyAoYzIsIHdjMiwgXygidW5iYWxhbmNlZCBbIikpOwoKICAgICAgICAgICAgICBp ZiAobGV4ZXItPm11bHRpYnl0ZV9sb2NhbGUpCiAgICAgICAgICAgICAgICB7Cl1dKQoKLS0g SGFjayBhcm91bmQgd2l0aCBDQVNFX0ZPTERFRF9CVUZTSVpFIGNvZGUgYnkgaGFuZApQYXJz ZUJyYWNrZXRFeHAgPSBUZXh0U3Vic3QoUGFyc2VCcmFja2V0RXhwLCBbWwogICAgICAgICAg d2NoYXJfdCBmb2xkZWRbQ0FTRV9GT0xERURfQlVGU0laRSArIDFdOwogICAgICAgICAgaW50 IGk7CiAgICAgICAgICBpbnQgbiA9IChjYXNlX2ZvbGQgPyBjYXNlX2ZvbGRlZF9jb3VudGVy cGFydHMgKHdjLCBmb2xkZWQgKyAxKSArIDEKICAgICAgICAgICAgICAgICAgIDogMSk7CiAg ICAgICAgICBmb2xkZWRbMF0gPSB3YzsKICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBuOyBp KyspCiAgICAgICAgICAgIGlmICghc2V0Yml0X3djIChmb2xkZWRbaV0sIGNjbCkpCiAgICAg ICAgICAgICAgewogICAgICAgICAgICAgICAgd29ya19tYmMtPmNoYXJzCiAgICAgICAgICAg ICAgICAgID0gbWF5YmVfcmVhbGxvYyAod29ya19tYmMtPmNoYXJzLCB3b3JrX21iYy0+bmNo YXJzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZjaGFyc19hbCwgc2l6 ZW9mICp3b3JrX21iYy0+Y2hhcnMpOwogICAgICAgICAgICAgICAgd29ya19tYmMtPmNoYXJz W3dvcmtfbWJjLT5uY2hhcnMrK10gPSBmb2xkZWRbaV07CiAgICAgICAgICAgICAgfQpdXSwg W1sKICAgICAgICAgIHdjaGFyX3QgZm9sZGVkW0NBU0VfRk9MREVEX0JVRlNJWkUgKyAxXTsK ICAgICAgICAgIGludCBuID0gMTsKCiAgICAgICAgICBmb2xkZWRbMF0gPSB3YzsKICAgICAg ICAgIGlmIChjYXNlX2ZvbGQpCiAgICAgICAgICAgIG4gKz0gY2FzZV9mb2xkZWRfY291bnRl cnBhcnRzIChsZXhlciwgd2MsICZmb2xkZWRbMV0pOwogICAgICAgICAgbWJjc2V0c19hZGRf d2NoYXJfbGlzdCAod29ya19tYmMsIG4sIGZvbGRlZCk7Cl1dKQoKLS0gQ29udmVydCBtb2R1 bGUtZ2xvYmFsIHZhcmlhYmxlIHJlZmVyZW5jZXMgdG8gaW5zdGFuY2UtbG9jYWwgcmVmcy4K UGFyc2VCcmFja2V0RXhwID0gVGV4dFN1YnN0KFBhcnNlQnJhY2tldEV4cCwgW1sKICAgICAg ICAgICAgICAgICAgRkVUQ0hfV0MgKGMsIHdjLCBfKCJ1bmJhbGFuY2V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93biBzZXQuCiAgICAgICAgICAgICBUcmVhdCBpdCBsaWtlIFstYVsuYWEuXV0gd2hp bGUgcGFyc2luZyBpdCwgYW5kCiAgICAgICAgICAgICByZW1lbWJlciB0aGF0IHRoZSBzZXQg aXMgdW5rbm93bi4gICovCiAgICAgICAgICBpZiAoYzIgPT0gJ1snICYmICpsZXhwdHIgPT0g Jy4nKQpdPV0sIFs9WwogICAgICAgICAgLyogQSBicmFja2V0IGV4cHJlc3Npb24gbGlrZSBb YS1bLmFhLl1dIG1hdGNoZXMgYW4gdW5rbm93bgogICAgICAgICAgICAgc2V0LiAgVHJlYXQg aXQgbGlrZSBbLWFbLmFhLl1dIHdoaWxlIHBhcnNpbmcgaXQsIGFuZAogICAgICAgICAgICAg cmVtZW1iZXIgdGhhdCB0aGUgc2V0IGlzIHVua25vd24uICAqLwogICAgICAgICAgaWYgKGMy ID09ICdbJyAmJiAqbGV4ZXItPmxleHB0ciA9PSAnLicpCl09XSkKClBhcnNlQnJhY2tldEV4 cCA9IFRleHRTdWJzdChQYXJzZUJyYWNrZXRFeHAsIFtbCiAgaWYgKGRmYS0+bXVsdGlieXRl KQogICAgewogICAgICBzdGF0aWMgY2hhcmNsYXNzIHplcm9jbGFzczsKICAgICAgd29ya19t YmMtPmludmVydCA9IGludmVydDsKICAgICAgd29ya19tYmMtPmNzZXQgPSBlcXVhbCAoY2Ns LCB6ZXJvY2xhc3MpID8gLTEgOiBjaGFyY2xhc3NfaW5kZXggKGNjbCk7CiAgICAgIHJldHVy biBNQkNTRVQ7CiAgICB9CgogIGlmIChpbnZlcnQpCiAgICB7CiAgICAgIGFzc2VydCAoIWRm YS0+bXVsdGlieXRlKTsKICAgICAgbm90c2V0IChjY2wpOwogICAgICBpZiAoc3ludGF4X2Jp dHMgJiBSRV9IQVRfTElTVFNfTk9UX05FV0xJTkUpCiAgICAgICAgY2xyYml0IChlb2xieXRl LCBjY2wpOwogICAgfQoKICByZXR1cm4gQ1NFVCArIGNoYXJjbGFzc19p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PSAw OyBpIDwgMjsgKytpKQogICAgewogICAgICBGRVRDSF9XQyAoYywgd2N0b2ssIE5VTEwpOwoK ICAgICAgc3dpdGNoIChjKQogICAgICAgIHsKICAgICAgICBjYXNlICdcXCc6CiAgICAgICAg ICBpZiAoYmFja3NsYXNoKQogICAgICAgICAgICBnb3RvIG5vcm1hbF9jaGFyOwogICAgICAg ICAgaWYgKGxleGxlZnQgPT0gMCkKXV0sIFtbCiAgZm9yIChpID0gMDsgaSA8IDI7ICsraSkK ICAgIHsKICAgICAgRkVUQ0hfV0MgKGMsIGxleGVyLT53Y3RvaywgTlVMTCk7CgogICAgICBz d2l0Y2ggKGMpCiAgICAgICAgewogICAgICAgIGNhc2UgJ1xcJzoKICAgICAgICAgIGlmIChi YWNrc2xhc2gpCiAgICAgICAgICAgIGdvdG8gbm9ybWFsX2NoYXI7CiAgICAgICAgICBpZiAo bGV4ZXItPmxleGxlZnQgPT0gMCkKXV0pCgotLSBNYWtlICJub3QtUkVfTk9fR05VX09QVFMi IG1vcmUgcmVhZGFibGUgYnkgdXNpbmcgYSBkaXJlY3QgZmxhZyB2YXJpYWJsZS4KTGV4Qm9k eSA9IFRleHRTdWJzdChMZXhCb2R5LAogICAgICAgICAgICAgICAgICAgICIhKHN5bnRheF9i aXRzICYgUkVfTk9fR05VX09QUykiLAogICAgICAgICAgICAgICAgICAgICJsZXhlci0+cmVf Z251X29wcyIpCgotLSBIYW5kbGUgIlxzIiBhbmQgIlxTIiBpbiB0aGUgc2FtZSBmYXNoaW9u IGFzICJcdyIgYW1kICJcVyIuICBIb3dldmVyLAotLSBtdWx0aWJ5dGUgaXNzdWVzIGFyZSBt b3JlIG9mIGEgZGlyZWN0IGlzc3VlIGluIHRoZSBjb2RlLgpMZXhCb2R5ID0gVGV4dFN1YnN0 KExleEJvZHksIFs9PVsKICAgICAgICBjYXNlICdzJzoKICAgICAgICBjYXNlICdTJzoKICAg ICAgICAgIGlmICghYmFja3NsYXNoIHx8IChzeW50YXhfYml0cyAmIFJFX05PX0dOVV9PUFMp KQogICAgICAgICAgICBnb3RvIG5vcm1hbF9jaGFyOwogICAgICAgICAgaWYgKCFkZmEtPm11 bHRpYnl0ZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgIHplcm9zZXQgKGNjbCk7CiAg ICAgICAgICAgICAgZm9yIChjMiA9IDA7IGMyIDwgTk9UQ0hBUjsgKytjMikKICAgICAgICAg ICAgICAgIGlmIChpc3NwYWNlIChjMikpCiAgICAgICAgICAgICAgICAgIHNldGJpdCAoYzIs IGNjbCk7CiAgICAgICAgICAgICAgaWYgKGMgPT0gJ1MnKQogICAgICAgICAgICAgICAgbm90 c2V0IChjY2wpOwogICAgICAgICAgICAgIGxhc3RzdGFydCA9IGZhbHNlOwogICAgICAgICAg ICAgIHJldHVybiBsYXN0dG9rID0gQ1NFVCArIGNoYXJjbGFzc19pbmRleCAoY2NsKTsKICAg ICAgICAgICAgfQoKI2RlZmluZSBQVVNIX0xFWF9TVEFURShzKQkJCVwKICBkbwkJCQkJCVwK ICAgIHsJCQkJCQlcCiAgICAgIGNoYXIgY29uc3QgKmxleHB0cl9zYXZlZCA9IGxleHB0cjsJ XAogICAgICBzaXplX3QgbGV4bGVmdF9zYXZlZCA9IGxleGxlZnQ7CQlcCiAgICAgIGxleHB0 ciA9IChzKTsJCQkJXAogICAgICBsZXhsZWZ0ID0gc3RybGVuIChsZXhwdHIpCgojZGVmaW5l IFBPUF9MRVhfU1RBVEUoKQkJCQlcCiAgICAgIGxleHB0ciA9IGxleHB0cl9zYXZlZDsJCQlc CiAgICAgIGxleGxlZnQgPSBsZXhsZWZ0X3NhdmVkOwkJCVwKICAgIH0JCQkJCQlcCiAgd2hp bGUgKDApCgogICAgICAgICAgLyogRklYTUU6IHNlZSBpZiBvcHRpbWl6aW5nIHRoaXMsIGFz IGlzIGRvbmUgd2l0aCBBTllDSEFSIGFuZAogICAgICAgICAgICAgYWRkX3V0ZjhfYW55Y2hh ciwgbWFrZXMgc2Vuc2UuICAqLwoKICAgICAgICAgIC8qIFxzIGFuZCBcUyBhcmUgZG9jdW1l bnRlZCB0byBiZSBlcXVpdmFsZW50IHRvIFtbOnNwYWNlOl1dIGFuZAogICAgICAgICAgICAg W15bOnNwYWNlOl1dIHJlc3BlY3RpdmVseSwgc28gdGVsbCB0aGUgbGV4ZXIgdG8gcHJvY2Vz cyB0aG9zZQogICAgICAgICAgICAgc3RyaW5ncywgZWFjaCBtaW51cyBpdHMgImFscmVhZHkg cHJvY2Vzc2VkIiAnWycuICAqLwogICAgICAgICAgUFVTSF9MRVhfU1RBVEUgKGMgPT0gJ3Mn ID8gIls6c3BhY2U6XV0iIDogIl5bOnNwYWNlOl1dIik7CgogICAgICAgICAgbGFzdHRvayA9 IHBhcnNlX2JyYWNrZXRfZXhwICgpOwoKICAgICAgICAgIFBPUF9MRVhfU1RBVEUgKCk7Cgog ICAgICAgICAgbGFzdHN0YXJ0ID0gZmFsc2U7CiAgICAgICAgICByZXR1cm4gbGFzdHRvazsK XT09XSwgWz09WwogICAgICAgIGNhc2UgJ3MnOgogICAgICAgIGNhc2UgJ1MnOgogICAgICAg ICAgIC8qICJccyIgPT0gIltbOnNwYWNlOl1dIjsgIlxTIiA9PSAiW15bOnNwYWNlOl1dIi4g ICovCiAgICAgICAgICBpZiAoISAoYmFja3NsYXNoICYmIGxleGVyLT5yZV9nbnVfb3BzKSkK ICAgICAgICAgICAgZ290byBub3JtYWxfY2hhcjsKICAgICAgICAgIGxleGVyLT5sYXN0c3Rh cnQgPSBmYWxzZTsKICAgICAgICAgIGludmVydCA9IGMgPT0gJ1MnOwogICAgICAgICAgcHJl ZGljYXRlID0gZmluZF9wcmVkIChsZXhlciwgInNwYWNlIik7CiAgICAgICAgICBpZiAoYyA9 PSAncycpCiAgICAgICAgICAgIGNsYXNzX2luZGV4ID0gY2hhcmNsYXNzX2dldF9pbmRleCAo cHJlZGljYXRlLT5jbGFzcyk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAg ICAgICAgICAvKiBJbnZlcnQgdGhlIHByZWRpY2F0ZSBjbGFzcyBpbiBhIHdvcmsgY2xhc3Mu ICAqLwogICAgICAgICAgICAgIHdvcmtfY2xhc3MgPSBjaGFyY2xhc3NfYWxsb2MgKCk7CiAg ICAgICAgICAgICAgY2hhcmNsYXNzX2NvcHlzZXQgKHByZWRpY2F0ZS0+Y2xhc3MsIHdvcmtf Y2xhc3MpOwogICAgICAgICAgICAgIGNoYXJjbGFzc19ub3RzZXQgKHdvcmtfY2xhc3MpOwog ICAgICAgICAgICAgIGNsYXNzX2luZGV4ID0gY2hhcmNsYXNzX2NvbXBsZXRlZCAod29ya19j bGFzcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgIGlmIChsZXhlci0+dW5pYnl0ZV9sb2Nh bGUpCiAgICAgICAgICAgIHJldHVybiBsZXhlci0+bGFzdHRvayA9IEZTQVRPS0VOX1RLX0NT RVQgKyBjbGFzc19pbmRleDsKCiAgICAgICAgICAvKiBGSVhNRTogc2VlIGlmIG9wdGltaXpp bmcgdGhpcywgYXMgaXMgZG9uZSB3aXRoIEFOWUNIQVIgYW5kCiAgICAgICAgICAgICBhZGRf dXRmOF9hbnljaGFyLCBtYWtlcyBzZW5zZS4gICovCgogICAgICAgICAgLyogTXVsdGlieXRl IGxvY2FsZTogIEZpbGwgb3V0IGFuIGVudGlyZSBzZXQgZGVzY3JpcHRpb24uICAqLwogICAg ICAgICAgbGV4ZXItPm1iY3NldHMgPSBtYXliZV9yZWFsbG9jIChsZXhlci0+bWJjc2V0cywg bGV4ZXItPm5tYmNzZXRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAmbGV4ZXItPm1iY3NldHNfYWxsb2MsCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHNpemVvZiB3b3JrX21iYyk7CiAgICAgICAgICB3b3JrX21iYyA9 IG1iY3NldHNfbmV3ICgpOwogICAgICAgICAgbGV4ZXItPm1iY3NldHNbbGV4ZXItPm5tYmNz ZXRzKytdID0gd29ya19tYmM7CiAgICAgICAgICBtYmNzZXRzX3NldF9tYXRjaF9zZW5zZSAo d29ya19tYmMsIGludmVydCk7CiAgICAgICAgICBtYmNzZXRzX2FkZF9jbGFzcyAod29ya19t YmMsIHByZWRpY2F0ZS0+d2NoYXJfZGVzYyk7CgogICAgICAgICAgLyogPz8gUkVWSUVXTUU6 ICJpbnZlcnQiIGluIHBhcnNlX2JyYWNrZXRfZXhwIGxlYWRzIHRvIEJBQ0tSRUYKICAgICAg ICAgICAgICg9PSAidGhpcyBpcyB0b28gaGFyZCBmb3IgbWUiKSB0b2tlbiB2aWEga25vd25f YnJhY2tldF9leHAKICAgICAgICAgICAgIGZsYWcuICovCiAgICAgICAgICBpZiAoKGMgPT0g J1MnKSAmJiAhbGV4ZXItPnVzaW5nX3NpbXBsZV9sb2NhbGUpCiAgICAgICAgICAgIHJldHVy biBsZXhlci0+bGFzdHRvayA9IEZTQVRPS0VOX1RLX0JBQ0tSRUY7CiAgICAgICAgICBlbHNl CiAgICAgICAgICAgIHJldHVybiBsZXhlci0+bGFzdHRvayA9IEZTQVRPS0VOX1RLX01CQ1NF VDsKXT09XSkKCkxleEJvZHkgPSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAgICAgICBjYXNl ICd3JzoKICAgICAgICBjYXNlICdXJzoKICAgICAgICAgIGlmICghYmFja3NsYXNoIHx8IChz eW50YXhfYml0cyAmIFJFX05PX0dOVV9PUFMpKQogICAgICAgICAgICBnb3RvIG5vcm1hbF9j aGFyOwogICAgICAgICAgemVyb3NldCAoY2NsKTsKICAgICAgICAgIGZvciAoYzIgPSAwOyBj MiA8IE5PVENIQVI7ICsrYzIpCiAgICAgICAgICAgIGlmIChJU19XT1JEX0NPTlNUSVRVRU5U IChjMikpCiAgICAgICAgICAgICAgc2V0Yml0IChjMiwgY2NsKTsKICAgICAgICAgIGlmIChj ID09ICdXJykKICAgICAgICAgICAgbm90c2V0IChjY2wpOwogICAgICAgICAgbGFzdHN0YXJ0 ID0gZmFsc2U7CiAgICAgICAgICByZXR1cm4gbGFzdHRvayA9IENTRVQgKyBjaGFyY2xhc3Nf aW5kZXggKGNjbCk7Cl1dLApbPT1bCiAgICAgICAgIGNhc2UgJ3cnOgogICAgICAgICBjYXNl ICdXJzoKICAgICAgICAgICAvKiBDYW4gbWVhbiAiW19bOmFsbnVtOl1dIiAoXHcpIG9yIGl0 cyBpbnZlcnNlIChcVykuICAqLwogICAgICAgICAgIGlmICghIChiYWNrc2xhc2ggJiYgbGV4 ZXItPnJlX2dudV9vcHMpKQogICAgICAgICAgICAgZ290byBub3JtYWxfY2hhcjsKICAgICAg ICAgICBsZXhlci0+bGFzdHN0YXJ0ID0gZmFsc2U7CiAgICAgICAgICAgcHJlZGljYXRlID0g ZmluZF9wcmVkIChsZXhlciwgImFsbnVtIik7CiAgICAgICAgICAgd29ya19jbGFzcyA9IGNo YXJjbGFzc19hbGxvYyAoKTsKICAgICAgICAgICBjaGFyY2xhc3NfY29weXNldCAocHJlZGlj YXRlLT5jbGFzcywgd29ya19jbGFzcyk7CiAgICAgICAgICAgY2hhcmNsYXNzX3NldGJpdCAo J18nLCB3b3JrX2NsYXNzKTsKICAgICAgICAgICBpZiAoYyA9PSAnVycpCiAgICAgICAgICAg ICBjaGFyY2xhc3Nfbm90c2V0ICh3b3JrX2NsYXNzKTsKICAgICAgICAgICByZXR1cm4gbGFz dHRvayA9IEZTQVRPS0VOX1RLX0NTRVQKICAgICAgICAgICAgICAgICAgICAgICArIGNoYXJj bGFzc19jb21wbGV0ZWQgKHdvcmtfY2xhc3MpOwpdPT1dKQoKLS0gRWRpdCBtYXRjaC1hbnkg KCIuIikgdG8gdXNlIGEgc3RhdGljIGNsYXNzLCBpbiBhIHNpbWlsYXIgZmFzaGlvbiB0bwot LSB0aGUgc3Vic3RpdHV0aW9uIGFib3ZlLiAgVGhlIHdvcmsgaGFzIGJlZW4gc2hpZnRlZCBp bnRvIGZzYWxleF9zeW50YXguCkxleEJvZHkgPSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAg ICAgICBjYXNlICcuJzoKICAgICAgICAgIGlmIChiYWNrc2xhc2gpCiAgICAgICAgICAgIGdv dG8gbm9ybWFsX2NoYXI7CiAgICAgICAgICBpZiAoZGZhLT5tdWx0aWJ5dGUpCiAgICAgICAg ICAgIHsKICAgICAgICAgICAgICAvKiBJbiBtdWx0aWJ5dGUgZW52aXJvbm1lbnQgcGVyaW9k IG11c3QgbWF0Y2ggd2l0aCBhIHNpbmdsZQogICAgICAgICAgICAgICAgIGNoYXJhY3RlciBu b3QgYSBieXRlLiAgU28gd2UgdXNlIEFOWUNIQVIuICAqLwogICAgICAgICAgICAgIGxhc3Rz dGFydCA9IGZhbHNlOwogICAgICAgICAgICAgIHJldHVybiBsYXN0dG9rID0gQU5ZQ0hBUjsK ICAgICAgICAgICAgfQogICAgICAgICAgemVyb3NldCAoY2NsKTsKICAgICAgICAgIG5vdHNl dCAoY2NsKTsKICAgICAgICAgIGlmICghKHN5bnRheF9iaXRzICYgUkVfRE9UX05FV0xJTkUp KQogICAgICAgICAgICBjbHJiaXQgKGVvbGJ5dGUsIGNjbCk7CiAgICAgICAgICBpZiAoc3lu dGF4X2JpdHMgJiBSRV9ET1RfTk9UX05VTEwpCiAgICAgICAgICAgIGNscmJpdCAoJ1wwJywg Y2NsKTsKICAgICAgICAgIGxhc3RzdGFydCA9IGZhbHNlOwogICAgICAgICAgcmV0dXJuIGxh c3R0b2sgPSBDU0VUICsgY2hhcmNsYXNzX2luZGV4IChjY2wpOwpdXSwgW1sKICAgICAgICBj YXNlICcuJzoKICAgICAgICAgIGlmIChiYWNrc2xhc2gpCiAgICAgICAgICAgIGdvdG8gbm9y bWFsX2NoYXI7CiAgICAgICAgICBsZXhlci0+bGFzdHN0YXJ0ID0gZmFsc2U7CiAgICAgICAg ICBpZiAobGV4ZXItPm11bHRpYnl0ZV9sb2NhbGUpCiAgICAgICAg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RzLCBmb2xkaW5nIGlzIGRvbmUg aW4gYXRvbS4gIEFsd2F5cwogICAgICAgICAgICAgcmV0dXJuIFdDSEFSLiAgKi8KICAgICAg ICAgIGlmIChkZmEtPm11bHRpYnl0ZSkKICAgICAgICAgICAgcmV0dXJuIGxhc3R0b2sgPSBX Q0hBUjsKCiAgICAgICAgICBpZiAoY2FzZV9mb2xkICYmIGlzYWxwaGEgKGMpKQogICAgICAg ICAgICB7CiAgICAgICAgICAgICAgemVyb3NldCAoY2NsKTsKICAgICAgICAgICAgICBzZXRi aXRfY2FzZV9mb2xkX2MgKGMsIGNjbCk7CiAgICAgICAgICAgICAgcmV0dXJuIGxhc3R0b2sg PSBDU0VUICsgY2hhcmNsYXNzX2luZGV4IChjY2wpOwogICAgICAgICAgICB9CgogICAgICAg ICAgcmV0dXJuIGxhc3R0b2sgPSBjOwpdXSwgW1sKICAgICAgICBkZWZhdWx0OgogICAgICAg IG5vcm1hbF9jaGFyOgogICAgICAgICAgbGV4ZXItPmxhc3RzdGFydCA9IGZhbHNlOwogICAg ICAgICAgLyogRm9yIG11bHRpYnl0ZSBjaGFyYWN0ZXIgc2V0cywgZm9sZGluZyBpcyBkb25l IGluIGF0b20sIHNvCiAgICAgICAgICAgICBhbHdheXMgcmV0dXJuIFdDSEFSLiAgKi8KICAg ICAgICAgIGlmIChsZXhlci0+bXVsdGlieXRlX2xvY2FsZSkKICAgICAgICAgICAgcmV0dXJu IGxhc3R0b2sgPSBGU0FUT0tFTl9US19XQ0hBUjsKCiAgICAgICAgICBpZiAoY2FzZV9mb2xk ICYmIGlzYWxwaGEgKGMpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgY2hhcmNsYXNz X3QgKmNjbCA9IGNoYXJjbGFzc19hbGxvYyAoKTsKICAgICAgICAgICAgICBzZXRiaXRfY2Fz ZV9mb2xkX2MgKGMsIGNjbCk7CiAgICAgICAgICAgICAgcmV0dXJuIGxhc3R0b2sgPSBGU0FU T0tFTl9US19DU0VUCiAgICAgICAgICAgICAgICAgICAgICAgICAgKyBjaGFyY2xhc3NfY29t cGxldGVkIChjY2wpOwogICAgICAgICAgICB9CgogICAgICAgICAgcmV0dXJuIGxhc3R0b2sg PSBjOwpdXSkKCkxleEJvZHkgPSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAgICAgICBjYXNl ICckJzoKICAgICAgICAgIGlmIChiYWNrc2xhc2gpCiAgICAgICAgICAgIGdvdG8gbm9ybWFs X2NoYXI7CiAgICAgICAgICBpZiAoc3ludGF4X2JpdHMgJiBSRV9DT05URVhUX0lOREVQX0FO Q0hPUlMKICAgICAgICAgICAgICB8fCBsZXhsZWZ0ID09IDAKICAgICAgICAgICAgICB8fCAo c3ludGF4X2JpdHMgJiBSRV9OT19CS19QQVJFTlMKICAgICAgICAgICAgICAgICAgPyBsZXhs ZWZ0ID4gMCAmJiAqbGV4cHRyID09ICcpJwogICAgICAgICAgICAgICAgICA6IGxleGxlZnQg PiAxICYmIGxleHB0clswXSA9PSAnXFwnICYmIGxleHB0clsxXSA9PSAnKScpCiAgICAgICAg ICAgICAgfHwgKHN5bnRheF9iaXRzICYgUkVfTk9fQktfVkJBUgogICAgICAgICAgICAgICAg ICA/IGxleGxlZnQgPiAwICYmICpsZXhwdHIgPT0gJ3wnCiAgICAgICAgICAgICAgICAgIDog bGV4bGVmdCA+IDEgJiYgbGV4cHRyWzBdID09ICdcXCcgJiYgbGV4cHRyWzFdID09ICd8JykK ICAgICAgICAgICAgICB8fCAoKHN5bnRheF9iaXRzICYgUkVfTkVXTElORV9BTFQpCiAgICAg ICAgICAgICAgICAgICYmIGxleGxlZnQgPiAwICYmICpsZXhwdHIgPT0gJ1xuJykpCiAgICAg ICAgICAgIHJldHVybiBsYXN0dG9rID0gRU5ETElORTsKICAgICAgICAgIGdvdG8gbm9ybWFs X2NoYXI7Cl1dLCBbWwogICAgICAgIGNhc2UgJyQnOgogICAgICAgICAgaWYgKGJhY2tzbGFz aCkKICAgICAgICAgICAgZ290byBub3JtYWxfY2hhcjsKICAgICAgICAgIGlmIChzeW50YXhf Yml0cyAmIFJFX0NPTlRFWFRfSU5ERVBfQU5DSE9SUwogICAgICAgICAgICAgIHx8IGxleGVy LT5sZXhsZWZ0ID09IDAKICAgICAgICAgICAgICB8fCAoc3ludGF4X2JpdHMgJiBSRV9OT19C S19QQVJFTlMKICAgICAgICAgICAgICAgICAgPyBsZXhlci0+bGV4bGVmdCA+IDAgJiYgKmxl eGVyLT5sZXhwdHIgPT0gJyknCiAgICAgICAgICAgICAgICAgIDogbGV4ZXItPmxleGxlZnQg PiAxICYmIGxleGVyLT5sZXhwdHJbMF0gPT0gJ1xcJyAmJiBsZXhlci0+bGV4cHRyWzFdID09 ICcpJykKICAgICAgICAgICAgICB8fCAoc3ludGF4X2JpdHMgJiBSRV9OT19CS19WQkFSCiAg ICAgICAgICAgICAgICAgID8gbGV4ZXItPmxleGxlZnQgPiAwICYmICpsZXhlci0+bGV4cHRy ID09ICd8JwogICAgICAgICAgICAgICAgICA6IGxleGVyLT5sZXhsZWZ0ID4gMSAmJiBsZXhl ci0+bGV4cHRyWzBdID09ICdcXCcgJiYgbGV4ZXItPmxleHB0clsxXSA9PSAnfCcpCiAgICAg ICAgICAgICAgfHwgKChzeW50YXhfYml0cyAmIFJFX05FV0xJTkVfQUxUKQogICAgICAgICAg ICAgICAgICAmJiBsZXhlci0+bGV4bGVmdCA+IDAgJiYgKmxleGVyLT5sZXhwdHIgPT0gJ1xu JykpCiAgICAgICAgICAgIHJldHVybiBsYXN0dG9rID0gRU5ETElORTsKICAgICAgICAgIGdv dG8gbm9ybWFsX2NoYXI7Cl1dKQoKLS0gVXNlIHRlbXBvcmFyeSBtaW5yZXAvbWF4cmVwIHZh cmlhYmxlcyBpbiBsZXhlciAie30iIHByb2Nlc3NpbmcsIGFuZCBjb3B5Ci0tIHRoZXNlIHZh bHVlcyB0byBsZXhlci0+bWlucmVwIGFuZCBsZXhlci0+bWF4cmVwIHdoZW4gY29tcGxldGUu CkxleEJvZHkgPSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAgICAgICAgIC8qIENhc2VzOgog ICAgICAgICAgICAge019IC0gZXhhY3QgY291bnQKICAgICAgICAgICAgIHtNLH0gLSBtaW5p bXVtIGNvdW50LCBtYXhpbXVtIGlzIGluZmluaXR5CiAgICAgICAgICAgICB7LE59IC0gMCB0 aHJvdWdoIE4KICAgICAgICAgICAgIHssfSAtIDAgdG8gaW5maW5pdHkgKHNhbWUgYXMgJyon KQogICAgICAgICAgICAge00sTn0gLSBNIHRocm91Z2ggTiAqLwogICAgICAgICAgewogICAg ICAgICAgICBjaGFyIGNvbnN0ICpwID0gbGV4cHRyOwogICAgICAgICAgICBjaGFyIGNvbnN0 ICpsaW0gPSBwICsgbGV4bGVmdDsKICAgICAgICAgICAgbWlucmVwID0gbWF4cmVwID0gLTE7 Cl1dLCBbWwogICAgICAgICAgLyogQ2FzZXM6CiAgICAgICAgICAgICB7TX0gLSBleGFjdCBj b3VudAogICAgICAgICAgICAge00sfSAtIG1pbmltdW0gY291bnQsIG1heGltdW0gaXMgaW5m aW5pdHkKICAgICAgICAgICAgIHssTn0gLSAwIHRocm91Z2ggTgogICAgICAgICAgICAgeyx9 IC0gMCB0byBpbmZpbml0eSAoc2FtZSBhcyAnKicpCiAgICAgICAgICAgICB7TSxOfSAtIE0g dGhyb3VnaCBOICovCiAgICAgICAgICB7CiAgICAgICAgICAgIGNoYXIgY29uc3QgKnAgPSBs ZXhlci0+bGV4cHRyOwogICAgICAgICAgICBjaGFyIGNvbnN0ICpsaW0gPSBwICsgbGV4ZXIt PmxleGxlZnQ7CiAgICAgICAgICAgIGludCBtaW5yZXAgPSAtMTsKICAgICAgICAgICAgaW50 IG1heHJlcCA9IC0xOwpdXSkKCkxleEJvZHkgPSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAg ICAgICAgICAgaWYgKFJFX0RVUF9NQVggPCBtYXhyZXApCiAgICAgICAgICAgICAgbGV4ZXIt PmFiYW5kb25fd2l0aF9lcnJvciAoXygicmVndWxhciBleHByZXNzaW9uIHRvbyBiaWciKSk7 CiAgICAgICAgICAgIGxleHB0ciA9IHA7CiAgICAgICAgICAgIGxleGxlZnQgPSBsaW0gLSBw OwogICAgICAgICAgfQogICAgICAgICAgbGFzdHN0YXJ0ID0gZmFsc2U7CiAgICAgICAgICBy ZXR1cm4gbGFzdHRvayA9IFJFUE1OOwpdXSwgW1sKICAgICAgICAgICAgaWYgKFJFX0RVUF9N QVggPCBtYXhyZXApCiAgICAgICAgICAgICAgbGV4ZXItPmFiYW5kb25fd2l0aF9lcnJvciAo XygicmVndWxhciBleHByZXNzaW9uIHRvbyBiaWciKSk7CiAgICAgICAgICAgIGxleGVyLT5s ZXhwdHIgPSBwOwogICAgICAgICAgICBsZXhlci0+bGV4bGVmdCA9IGxpbSAtIHA7CiAgICAg ICAgICAgIGxleGVyLT5taW5yZXAgPSBtaW5yZXA7CiAgICAgICAgICAgIGxleGVyLT5tYXhy ZXAgPSBtYXhyZXA7CiAgICAgICAgICB9CiAgICAgICAgICBsZXhlci0+bGFzdHN0YXJ0ID0g ZmFsc2U7CiAgICAgICAgICByZXR1cm4gbGFzdHRvayA9IFJFUE1OOwpdXSkKCkxleEJvZHkg PSBUZXh0U3Vic3QoTGV4Qm9keSwgW1sKICAgICAgICBjYXNlICdeJzoKICAgICAgICAgIGlm IChiYWNrc2xhc2gpCiAgICAgICAgICAgIGdvdG8gbm9ybWFsX2NoYXI7CiAgICAgICAgICBp ZiAoc3ludGF4X2JpdHMgJiBSRV9DT05URVhUX0lOREVQX0FOQ0hPUlMKICAgICAgICAgICAg ICB8fCBsYXN0dG9rID09IEVORCB8fCBsYXN0dG9rID09IExQQVJFTiB8fCBsYXN0dG9rID09 IE9SKQogICAgICAgICAgICByZXR1cm4gbGFzdHRvayA9IEJFR0xJTkU7CiAgICAgICAgICBn b3RvIG5vcm1hbF9jaGFyOwpdXSwgW1sKICAgICAgICBjYXNlICdeJzoKICAgICA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dnM7CiAgc2l6ZV90IG5j b2xsX2VsZW1zOwoKICBpZiAodCAhPSBGU0FUT0tFTl9US19NQkNTRVQgfHwgcGFyc2VyLT51 bmlieXRlX2xvY2FsZSkKICAgIHsKICAgICAgYWRkdG9rX21iIChwYXJzZXIsIHQsIDMpOwog ICAgICByZXR1cm47CiAgICB9CgogIHdvcmtfbWJjID0gcGFyc2VyLT5tYmNzZXRzW3BhcnNl ci0+bm1iY3NldHMgLSAxXTsKICBtYmNzZXRzX2dldF9jaGFyYWN0ZXJpc3RpY3MgKHdvcmtf bWJjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJmludmVydCwKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICZjaGFyY2xhc3MsCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAmbmNoYXJzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm5j aF9jbGFzc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm5yYW5nZXMsCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmbmVxdWl2cywKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICZuY29sbF9lbGVtcyk7CgogIGlmIChuY2hhcnMgJiYgIWludmVy dCkKICAgIHsKICAgICAgc2l6ZV90IGk7CiAgICAgIHdjaGFyX3QgKmNoYXJfbGlzdDsKCiAg ICAgIGNoYXJfbGlzdCA9IHhubWFsbG9jIChuY2hhcnMsIHNpemVvZiAqY2hhcl9saXN0KTsK ICAgICAgbWJjc2V0c19nZXRfY2hhcnMgKHdvcmtfbWJjLCBjaGFyX2xpc3QpOwogICAgICBh ZGR0b2tfd2MgKHBhcnNlciwgY2hhcl9saXN0WzBdKTsKICAgICAgZm9yIChpID0gMTsgaSA8 IG5jaGFyczsgaSsrKQogICAgICAgIHsKICAgICAgICAgIGFkZHRva193YyAocGFyc2VyLCBj aGFyX2xpc3RbaV0pOwogICAgICAgICAgYWRkdG9rIChwYXJzZXIsIEZT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mOF9hbnljaGFyLWRlc2NyaXB0 aW9uIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAifFsweGUwLTB4ZWZbMHg4MC0weGJm XVsweDgwLTB4YmZdIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAifFsweGUwLTB4ZWZd WzB4ODAtMHhiZl1bMHg4MC0weGJmXSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgInxb MHhmMC1mN11bMHg4MC0weGJmXVsweDgwLTB4YmZdWzB4ODAtMHhiZl0iLAogICAgICAgICAg ICAgICAgICAgICAgICAgICJ8WzB4ZjAtMHhmN11bMHg4MC0weGJmXVsweDgwLTB4YmZdWzB4 ODAtMHhiZl0iCikpKQphc3NlcnQoZjp3cml0ZShbWwogIC8qIFdyaXRlIG91dCBsZWFmIHRv a2VucyBmb3IgZWFjaCBvZiB0aGUgZm91ciBwb3NzaWJsZSBzdGFydGluZyBieXRlcy4gICov CiAgZm9yIChpID0gMTsgaSA8IDU7IGkrKykKICAgIGFkZHRvayAocGFyc2VyLCBGU0FUT0tF Tl9US19DU0VUICsgcGFyc2VyLT51dGY4X2FueWNoYXJfY2xhc3Nlc1tpXSk7CiAgLyogQWRk IGZvbGxvdy1vbiBjbGFzc2VzLCBwbHVzIHRva2VucyB0byBidWlsZCBhIHBvc3RmaXggdHJl ZQogICAgIGNvdmVyaW5nIGFsbCBmb3VyIGFsdGVybmF0aXZlcyBvZiB2YWxpZCBVVEYtOCBz ZXF1ZW5jZXMuICAqLwogIGZvciAoaSA9IDE7IGkgPD0gMzsgaSsrKQogICAgewogICAgICBh ZGR0b2sgKHBhcnNlciwgRlNBVE9LRU5fVEtfQ1NFVCArIHBhcnNlci0+dXRmOF9hbnljaGFy X2NsYXNzZXNbMF0pOwogICAgICBhZGR0b2sgKHBhcnNlciwgRlNBVE9LRU5fVEtfQ0FUKTsK ICAgICAgYWRkdG9rIChwYXJzZXIsIEZTQVRPS0VOX1RLX09SKTsKICAgIH0KXV0pKQphc3Nl cnQoZjp3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AgICAgcGFyc2VyLT53aWRlX2NoYXJfbGlzdCk7 CiAgICAgICAgYXNzZXJ0KG5yX3dpZGVfY2hhcnMgPj0gMSk7CiAgICAgICAgaWYgKHBhcnNl ci0+d2lkZV9jaGFyX2xpc3RbMF0gPT0gV0VPRikKICAgICAgICAgIGFkZHRvayAocGFyc2Vy LCBGU0FUT0tFTl9US19CQUNLUkVGKTsKICAgICAgICBlbHNlCiAgICAgICAgICB7CiAgICAg ICAgICAgIGludCBpOwoKICAgICAgICAgICAgYWRkdG9rX3djIChwYXJzZXIsIHBhcnNlci0+ d2lkZV9jaGFyX2xpc3RbMF0pOwogICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDwgbnJfd2lk ZV9jaGFyczsgaSsrKQogICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGFkZHRva193 YyAocGFyc2VyLCBwYXJzZXItPndpZGVfY2hhcl9saXN0W2ldKTsKICAgICAgICAgICAgICAg IGFkZHRvayAocGFyc2VyLCBGU0FUT0tFTl9US19PUik7CiAgICAgICAgICAgICAgfQogICAg ICAgICAgfQogICAgICAgIHBhcnNlci0+bG9va2FoZWFkX3Rva2VuID0gcGFyc2VyLT5sZXhl ciAocGFyc2VyLT5sZXhfY29udGV4dCk7CiAgICAgICAgcmV0dXJuOwogICAgICB9CgogICAg Y2FzZSBGU0FUT0tFTl9US19NQkNTRVQ6CiAgICAgIHsKICAgICAgICBtYmNzZXRzX3NldF90 ICp3b3JrX21iYzsKCiAgICAgICAgLyogQWNxdWlyZSBzcGFjZSB0byBzdG9yZSBzZXQgcG9p bnRlci4gIFNhZGx5ICg/KSwgZnNhcGFyc2UKICAgICAgICAgICBtYWludGFpbnMgYSBkdXBs aWNhdGUgbGlzdCB0byBmc2FsZXggYXQgcHJlc2VudC4gICovCiAgICAgICAgcGFyc2VyLT5t YmNzZXRzID0gbWF5YmVfcmVhbGxvYyAocGFyc2VyLT5tYmNzZXRzLAogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci0+bm1iY3NldHMsCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBhcnNlci0+bWJjc2V0c19hbGxv YywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2Ygd29y a19tYmMpOwoKICAgICAgICAvKiBHZXQgc2V0IHBvaW50ZXIgZnJvbSBmc2FsZXgsIGFuZCBh ZGQgaXQgdG8gdGhlIGxpc3QuICAqLwogICAgICAgIGZzYWxleF9leGNoYW5nZSAocGFyc2Vy LT5sZXhfY29udGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgIFBST1RPX0xFWFBBUlNF X09QX0dFVF9NQkNTRVQsCiAgICAgICAgICAgICAgICAgICAgICAgICAmd29ya19tYmMpOwog ICAgICAgIHBhcnNlci0+bWJjc2V0c1twYXJzZXItPm5tYmNzZXRzKytdID0gd29ya19tYmM7 CgogICAgICAgIC8qIFdlIGNvdWxkIGZhbGwtdGhyb3VnaCBjYXNlIGxhYmVscyB0byB0aGUg YWRkdG9rIGNvZGUgYmVsb3csCiAgICAgICAgICAgYnV0IGFtIGtlZXBpbmcgY29kZSBzZWN0 aW9ucyBzZXBhcmF0ZSBkdWUgdG8gYW4gb3ZlcmFidW5kYW5jZQogICAgICAgICAgIG9mIGNh dXRpb24uICAqLwogICAgICAgIGFkZHRvayAocGFyc2VyLCB0b2spOwogICAgICAgIHBhcnNl ci0+bG9va2FoZWFkX3Rva2VuID0gcGFyc2VyLT5sZXhlciAocGFyc2VyLT5sZXhfY29udGV4 dCk7CiAgICAgICAgcmV0dXJuOwogICAgICB9CgogICAgY2FzZSBGU0FUT0tFTl9US19BTllD SEFSOgogICAgY2FzZSBGU0FUT0tFTl9US19CQUNLUkVGOgogICAgY2FzZSBGU0FUT0tFTl9U S19CRUdMSU5FOgogICAgY2FzZSBGU0FUT0tFTl9US19FTkRMSU5FOgogICAgY2FzZSBGU0FU T0tFTl9US19CRUdXT1JEOg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2tfd2MgKHdjdG9rKTsK CiAgICAgICAgICBpZiAoY2FzZV9mb2xkKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAg d2NoYXJfdCBmb2xkZWRbQ0FTRV9GT0xERURfQlVGU0laRV07CiAgICAgICAgICAgICAgaW50 IGksIG4gPSBjYXNlX2ZvbGRlZF9jb3VudGVycGFydHMgKHdjdG9rLCBmb2xkZWQpOwogICAg ICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgICAgICAgICB7CiAg ICAgICAgICAgICAgICAgIGFkZHRva193YyAoZm9sZGVkW2ldKTsKICAgICAgICAgICAgICAg ICAgYWRkdG9rIChPUik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAg ICB9Cl1dLCBbWwpzdGF0aWMgdm9pZAphdG9tIChmc2FwYXJzZV9jdHh0X3QgKnBhcnNlcikK ewogIGZzYXRva2VuX3Rva2VuX3QgdG9rID0gcGFyc2VyLT5sb29rYWhlYWRfdG9rZW47Cgog IGlmICh0b2sgPT0gV0NIQVIpCiAgICB7CiAgICAgIGludCBucl93aWRlX2NoYXJzOwoKICAg ICAgbnJfd2lkZV9jaGFycyA9IGZzYWxleF9leGNoYW5nZSAocGFyc2VyLT5sZXhfY29udGV4 dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJPVE9fTEVYUEFS U0VfT1BfR0VUX1dJREVfQ0hBUlMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHBhcnNlci0+d2lkZV9jaGFyX2xpc3QpOwogICAgICBhc3NlcnQgKG5yX3dpZGVf Y2hhcnMgPj0gMSk7CiAgICAgIGlmIChwYXJzZXItPndpZGVfY2hhcl9saXN0WzBdID09IFdF T0YpCiAgICAgICAgYWRkdG9rIChCQUNLUkVGKTsKICAgICAgZWxzZQogICAgICAgIHsKICAg ICAgICAgIGludCBpOwoKICAgICAgICAgIGFkZHRva193YyAocGFyc2VyLT53aWRlX2NoYXJf bGlzdFswXSk7CiAgICAgICAgICBmb3IgKGkgPSAxOyBpIDwgbnJfd2lkZV9jaGFyczsgaSsr KQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgYWRkdG9rX3djIChwYXJzZXItPndpZGVf Y2hhcl9saXN0W2ldKTsKICAgICAgICAgICAgICBhZGR0b2sgKEZTQVRPS0VOX1RLX09SKTsK ICAgICAgICAgICAgfQogICAgICAgIH0KXV0pCkF0b21GbiA9IFRleHRTdWJzdChBdG9tRm4s IFtbCiAgZWxzZSBpZiAodG9rID09IExQQVJFTikKICAgIHsKICAgICAgdG9rID0gbGV4ICgp OwogICAgICByZWdleHAgKCk7CiAgICAgIGlmICh0b2sgIT0gUlBBUkVOKQpdXSwgW1sKICBl bHNlIGlmICh0b2sgPT0gTFBBUkVOKQogICAgewogICAgICBwYXJzZXItPmxvb2thaGVhZF90 b2tlbiA9IHBhcnNlci0+bGV4ZXIgKHBhcnNlci0+bGV4X2NvbnRleHQpOwogICAgICByZWdl eHAgKHBhcnNlcik7CiAgICAgIHRvayA9IHBhcnNlci0+bG9va2FoZWFkX3Rva2VuOwogICAg ICBpZiAodG9rICE9IFJQQVJFTikKXV0pCkF0b21GbiA9IFRleHRTdWJzdChBdG9tRm4sCiAg ICAgICAgICIgIHRvayA9IGxleCAoKSIsCiAgICAgICAgICIgIHBhcnNlci0+bG9va2FoZWFk X3Rva2VuID0gcGFyc2VyLT5sZXhlciAocGFyc2VyLT5sZXhfY29udGV4dCkiKQpBdG9tRm4g PSBUZXh0U3Vic3QoQXRvbUZuLAogICAgICAgICAiICBkZmFlcnJvciAoXygiLAogICAgICAg ICAiICBwYXJzZXItPmFiYW5kb25fd2l0aF9lcnJvciAoXygiKQoKQXRvbUZuID0gQXRvbUZu OmdzdWIoIiAgYWRkdG9rICUoIiwgICAgIiAgYWRkdG9rIChwYXJzZXIsICIpCkF0b21GbiA9 IEF0b21Gbjpnc3ViKCIgIGFkZHRva193YyAlKCIsICIgIGFkZHRva193YyAocGFyc2VyLCAi KQpBdG9tRm4gPSBBdG9tRm46Z3N1YigiICBhZGRfdXRmOF9hbnljaGFyICUoJSkiLAogICAg ICAgICAgICAgICAgICAgICAiICBhZGRfdXRmOF9hbnljaGFyIChwYXJzZXIpIikKYXNzZXJ0 KGY6d3JpdGUoRlNBVG9rZW5TdWJzdChBdG9tRm4pLCAiXG4iKSkKLS1dPT09XQoKCmFzc2Vy dChmOndyaXRlKEZTQVRva2VuU3Vic3QoRWRpdGVkVGV4dCgibnN1YnRva3MiLAogICAgICAg ICAgICJcbm5zdWJ0b2tzICUoIiwgICJcbm5zdWJ0b2tzIChmc2FwYXJzZV9jdHh0X3QgKnBh cnNlciwgIiwKICAgICAgICAgICAiIG5zdWJ0b2tzICUoIiwgICAiIG5zdWJ0b2tzIChwYXJz ZXIsICIsCiAgICAgICAgICAgImRmYSUtPiIsICAgICAgICAgInBhcnNlci0+IikpLAogICAg ICAgICAgICAgICAiXG4iKSkKYXNzZXJ0KGY6d3JpdGUoRlNBVG9rZW5TdWJzdChFZGl0ZWRU ZXh0KCJjb3B5dG9rcyIsCiAgICAgICAgICAgIlxuY29weXRva3MgJSgiLCAgIlxuY29weXRv a3MgKGZzYXBhcnNlX2N0eHRfdCAqcGFyc2VyLCAiLAogICAgICAgICAgICIgYWRkdG9rX21i ICUoIiwgICIgYWRkdG9rX21iIChwYXJzZXIsICIsCiAgICAgICAgICAgImRmYSUtPiIsICAg ICAgICAgInBhcnNlci0+IiwKICAgICAgICAgICAiTUJfQ1VSX01BWCA+IDEiLCAicGFyc2Vy LT5tdWx0aWJ5dGVfbG9jYWxlIikpLAogICAgICAgICAgICAgICAiXG4iKSkKCmFzc2VydChm OndyaXRlKFtbCi8qIFJld3JpdGluZyBmc2FwYXJzZTpjbG9zdXJlICgpIGZyb20gc2NyYXRj aDsgb3JpZ2luYWwgaXMgY2xldmVyIGJ1dCBhCiAgIGxpdHRsZSB0cmlja3kgdG8gZm9sbG93 LCBzbyB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VhZF90b2tlbiA9IHBhcnNlci0+bGV4ZXIgKHBhcnNlci0+ bGV4X2NvbnRleHQpOwogICAgICAgICAgICBjb250aW51ZTsKCiAgICAgICAgICBjYXNlIEZT QVRPS0VOX1RLX1JFUE1OOgogICAgICAgICAgICAvKiBSRVBNTiBuZWVkcyBleHRyYSB3b3Jr OyBtb3ZlIG91dHNpZGUgdGhlIHN3aXRjaCBzdGF0ZW1lbnQuICAqLwogICAgICAgICAgICBi cmVhazsKCiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAvKiBNZXJlbHkgbGV0IHRo ZSBpbnRpYWwgYXRvbSBjYWxsIHN0YW5kIGFzIG91ciByZXR1cm4gcmVzdWx0LiAgKi8KICAg ICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KCiAgICAgIC8qIERlYWwgd2l0aCBSRVBNTntt aW4sIG1heH0gY2FzZXMgaW4gYSBzZXBhcmF0ZSBibG9jay4gICovCiAgICAgIHsKICAgICAg ICBpbnQgaTsKICAgICAgICBzaXplX3QgcHJldl9zdWJfaW5kZXgsIG50b2tlbnM7CiAgICAg ICAgaW50IG1pbnJlcCwgbWF4cmVwOwoKICAgICAgICAvKiBHZXQgdGhlIHttaW4sIG1heH0g cGFpciBkZWNvZGVkIGJ5IHRoZSBsZXhlci4gICovCiAgICAgICAgbWlucmVwID0gcGFyc2Vy LT5sZXhfZXhjaGFuZ2UgKHBhcnNlci0+bGV4X2NvbnRleHQsCiAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIFBST1RPX0xFWFBBUlNFX09QX0dFVF9SRVBNTl9NSU4s CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOwogICAgICAg IG1heHJlcCA9IHBhcnNlci0+bGV4X2V4Y2hhbmdlIChwYXJzZXItPmxleF9jb250ZXh0LAog ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQUk9UT19MRVhQQVJTRV9P UF9HRVRfUkVQTU5fTUFYLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBOVUxMKTsKCiAgICAgICAgLyogRmluZCBvdXQgaG93IG1hbnkgdG9rZW5zIGFyZSBpbiB0 aGUgcGVjZWRpbmcgdG9rZW4gbGlzdCB0aGF0IGFyZQogICAgICAgICAgIGNvdmVyZWQgYnkg dGhpcyBSRVBNTiBkaXJlY3RpdmUuICBUaGlzIGludm9sdmVzIGNhcmVmdWxseSB3b3JraW5n CiAgICAgICAgICAgYmFja3dhcmRzIHRocm91Z2ggdGhlIGxpbmVhciwgcG9zdGZpeCB0b2tl biBvcmRlcmluZy4gICovCiAgICAgICAgbnRva2VucyA9IG5zdWJ0b2tzIChwYXJzZXIsIHBh cnNlci0+dGluZGV4KTsKCiAgICAgICAgLyogSWYgbWluIGFuZCBtYXggYXJlIGJvdGggemVy bywgbWVyZWx5IHJlbW92ZSBwcmVjZWRpbmcKICAgICAgICAgICBzdWJleHByZXNzaW9uLCBn ZXQgYSBuZXcgdG9rZW4sIGFuZCByZXN0YXJ0IHRoZSBhdG9tL2Nsb3N1cmUKICAgICAgICAg ICBwcm9jZXNzaW5nIGZyb20gdGhlIHRvcCBvZiB0aGUgZnVuY3Rpb24uICBOb3Qgc3VyZSBp ZiBwZW9wbGUgd2lsbAogICAgICAgICAgIGxpa2UgdGhpcyBnb3RvIHN0YXRlbWVudCwgYnV0 IHdlJ2xsIGdpdmUgaXQgYSB3aGlybC4gICAqLwogICAgICAgIGlmIChtaW5yZXAgPT0gMCAm JiBtYXhyZXAgPT0gMCkKICAgICAgICAgIHsKICAgICAgICAgICAgcGFyc2VyLT50aW5kZXgg LT0gbnRva2VuczsKICAgICAgICAgICAgcGFyc2VyLT5sb29rYWhlYWRfdG9rZW4gPSBwYXJz ZXItPmxleGVyIChwYXJzZXItPmxleF9jb250ZXh0KTsKICAgICAgICAgICAgZ290byByZXN0 YXJ0X2Nsb3N1cmU7CiAgICAgICAgICB9CgogICAgICAgIC8qIE5vbi16ZXJvIG1pbiBvciBt YXgsIGRlZmluZWQgYXMgZm9sbG93czoKICAgICAgICAgICAgIHtufSAgIFRoZSBwcmVjZWRp bmcgaXRlbSBpcyBtYXRjaGVkIGV4YWN0bHkgbiB0aW1lcy4KICAgICAgICAgICAgIHtuLH0g IFRoZSBwcmVjZWRpbmcgaXRlbSBpcyBtYXRjaGVkIG4gb3IgbW9yZSB0aW1lcy4KICAgICAg ICAgICAgIHssbX0gIFRoZSBwcmVjZWRpbmcgaXRlbSBpcyBtYXRjaGVkIGF0IG1vc3QgbSB0 aW1lcyAoR05VIGV4dC4pCiAgICAgICAgICAgICB7bixtfSBUaGUgcHJlY2VkaW5nIGl0ZW0g aXMgbWF0Y2hlZCBhdCBsZWFzdCBuLCBidXQgbm90IG1vcmUKICAgICAgICAgICAgICAgICAg IHRoYW4gbSB0aW1lcy4KICAgICAgICAgICBGb3Ige24sfSBhbmQgeyxtfSBjYXNlcywgdGhl IG9taXR0ZWQgcGFyYW1ldGVyIGlzIHJlcG9ydGVkIGhlcmUKICAgICAgICAgICBhcyBhIG5l Z2F0aXZlIHZhbHVlLiAgKi8KICAgICAgICBwcmV2X3N1Yl9pbmRleCA9IHBhcnNlci0+dGlu ZGV4IC0gbnRva2VuczsKICAgICAgICBpZiAobWF4cmVwIDwgMCkKICAgICAgICAgIGFkZHRv ayAocGFyc2VyLCBGU0FUT0tFTl9US19QTFVTKTsKICAgICAgICBpZiAobWlucmVwID09IDAp CiAgICAgICAgICBhZGR0b2sgKHBhcnNlciwgRlNBVE9LRU5fVEtfUU1BUkspOwogICAgICAg IGZvciAoaSA9IDE7IGkgPCBtaW5yZXA7ICsraSkKICAgICAgICAgIHsKICAgICAgICAgICAg Y29weXRva3MgKHBhcnNlciwgcHJldl9zdWJfaW5kZXgsIG50b2tlbnMpOwogICAgICAgICAg ICBhZGR0b2sgKHBhcnNlciwgRlNBVE9LRU5fVEtfQ0FUKTsKICAgICAgICAgIH0KICAgICAg ICBmb3IgKDsgaSA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AgICBicmVh azsKICAgICAgICAgICAgICBpZiAoISAoaiA8IE5PVENIQVIpKQogICAgICAgICAgICAgICAg YnJlYWs7CiAgICAgICAgICAgICAgdCA9IGo7CiAgICAgICAgICAgICAgd2hpbGUgKCsraiA8 IE5PVENIQVIpCiAgICAgICAgICAgICAgICBpZiAodHN0Yml0IChqLCAqY2NsKQpdXSwgW1sK ICAgICAgICAgICAgICBjaGFyY2xhc3NfdCAqY2NsID0gY2hhcmNsYXNzX2dldF9wb2ludGVy ICh0IC0gQ1NFVCk7CiAgICAgICAgICAgICAgaW50IGo7CiAgICAgICAgICAgICAgZm9yIChq ID0gMDsgaiA8IE5PVENIQVI7IGorKykKICAgICAgICAgICAgICAgIGlmIChjaGFyY2xhc3Nf dHN0Yml0IChqLCBjY2wpKQogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAg ICBpZiAoISAoaiA8IE5PVENIQVIpKQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAg ICAgICAgdCA9IGo7CiAgICAgICAgICAgICAgd2hpbGUgKCsraiA8IE5PVENIQVIpCiAgICAg ICAgICAgICAgICBpZiAoY2hhcmNsYXNzX3RzdGJpdCAoaiwgY2NsKQpdXSkKCk11c3RCb2R5 ID0gVGV4dFN1YnN0KE11c3RCb2R5LCBbWwpkb25lOgogIGlmICgqcmVzdWx0KQogICAgewog ICAgICBkbSA9IHhtYWxsb2MgKHNpemVvZiAqZG0pOwogICAgICBkbS0+ZXhhY3QgPSBleGFj dDsKICAgICAgZG0tPmJlZ2xpbmUgPSBiZWdsaW5lOwogICAgICBkbS0+ZW5kbGluZSA9IGVu ZGxpbmU7CiAgICAgIGRtLT5tdXN0ID0geHN0cmR1cCAocmVzdWx0KTsKICAgICAgZG0tPm5l eHQgPSBtdXN0X2xpc3Q7CiAgICAgIG11c3RfbGlzdCA9IGRtOwogICAgfQoKICB3aGlsZSAo bXApCiAgICB7CiAgICAgIG11c3QgKnByZXYgPSBtcC0+cHJldjsKICAgIC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AgY29uc3QgY2hhciAqbmFtZTsKfSByZWdleF9uYW1lX21hcHBpbmdfdDsKCnN0 YXRpYyByZWdleF9uYW1lX21hcHBpbmdfdCByZWdleF9uYW1lc1tdID0gewogIHtSRV9CQUNL U0xBU0hfRVNDQVBFX0lOX0xJU1RTLCAiYmFja3NsYXNoX2VzY2FwZV9pbl9saXN0cyJ9LAog IHtSRV9CS19QTFVTX1FNLCAgICAgICAgICAgICAgICAiYmtfcGx1c19xbSJ9LAogIHtSRV9D SEFSX0NMQVNTRVMsICAgICAgICAgICAgICAiY2hhcl9jbGFzc2VzIn0sCiAge1JFX0NPTlRF WFRfSU5ERVBfQU5DSE9SUywgICAgICJjb250ZXh0X2luZGVwX2FuY2hvcnMifSwKICB7UkVf Q09OVEVYVF9JTkRFUF9PUFMsICAgICAgICAgImNvbnRleHRfaW5kZXBfb3BzIn0sCiAge1JF X0NPTlRFWFRfSU5WQUxJRF9PUFMsICAgICAgICJjb250ZXh0X2ludmFsaWRfb3BzIn0sCiAg e1JFX0RPVF9ORVdMSU5FLCAgICAgICAgICAgICAgICJkb3RfbmV3bGluZSJ9LAogIHtSRV9E T1RfTk9UX05VTEwsICAgICAgICAgICAgICAiZG90X25vdF9udWxsIn0sCiAge1JFX0hBVF9M SVNUU19OT1RfTkVXTElORSwgICAgICJoYXRfbGlzdHNfbm90X25ld2xpbmUifSwKICB7UkVf SU5URVJWQUxTLCAgICAgICAgICAgICAgICAgImludGVydmFscyJ9LAogIHtSRV9MSU1JVEVE X09QUywgICAgICAgICAgICAgICAibGltaXRlZF9vcHMifSwKICB7UkVfTkVXTElORV9BTFQs ICAgICAgICAgICAgICAgIm5ld2xpbmVfYWx0In0sCiAge1JFX05PX0JLX0JSQUNFUywgICAg ICAgICAgICAgICJub19ia19icmFjZXMifSwKICB7UkVfTk9fQktfUEFSRU5TLCAgICAgICAg ICAgICAgIm5vX2JrX3BhcmVucyJ9LAogIHtSRV9OT19CS19SRUZTLCAgICAgICAgICAgICAg ICAibm9fYmtfcmVmcyJ9LAogIHtSRV9OT19CS19WQkFSLCAgICAgICAgICAgICAgICAibm9f YmtfdmJhciJ9LAogIHtSRV9OT19FTVBUWV9SQU5HRVMsICAgICAgICAgICAibm9fZW1wdHlf cmFuZ2VzIn0sCiAge1JFX1VOTUFUQ0hFRF9SSUdIVF9QQVJFTl9PUkQsICJ1bm1hdGNoZWRf cmlnaHRfcGFyZW5fb3JkIn0sCiAge1JFX05PX1BPU0lYX0JBQ0tUUkFDS0lORywgICAgICJu b19wb3NpeF9iYWNrdHJhY2tpbmcifSwKICB7UkVfTk9fR05VX09QUywgICAgICAgICAgICAg ICAgIm5vX2dudV9vcHMifSwKICB7UkVfREVCVUcsICAgICAgICAgICAgICAgICAgICAgImRl YnVnIn0sCiAge1JFX0lOVkFMSURfSU5URVJWQUxfT1JELCAgICAgICJpbnZhbGlkX2ludGVy dmFsX29yZCJ9LAogIHtSRV9JQ0FTRSwgICAgICAgICAgICAgICAgICAgICAiaWNhc2UifSwK ICB7UkVfQ0FSRVRfQU5DSE9SU19IRVJFLCAgICAgICAgImNhcmV0X2FuY2hvcnNfaGVyZSJ9 LAogIHtSRV9DT05URVhUX0lOVkFMSURfRFVQLCAgICAgICAiY29udGV4dF9pbnZhbGlkX2R1 cCJ9LAogIHtSRV9OT19TVUIsICAgICAgICAgICAgICAgICAgICAibm9fc3ViIn0sCiAgezAs IE5VTEx9Cn07CgovKiBFbnRyeSBwb2ludCB0byBzZXQgc3ludGF4IG9wdGlvbnMuICAqLwp2 b2lkCmRmYXN5bnRheCAocmVnX3N5bnRheF90IGJpdHMsIGludCBmb2xkLCB1bnNpZ25lZCBj aGFyIGVvbCkKewogIHVuc2lnbmVkIGludCBpOwoKICAvKiBIb29rOiBEZWJ1ZyBidWZmZXIg dG8gcmVjb3JkIHNlYXJjaCBzeW50YXggc3BlY2lmaWNhdGlvbnMuICAqLwogIHN0YXRpYyBj aGFyIGJ1ZlsyNTZdOwogIGNoYXIgKnBfYnVmOwogIGN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ZCwlZH07ICAiLCBtaW5yZXAsIG1heHJlcCk7 CiAgICAgIGZwcmludGYgKHBsbF9sb2csICIgIEZTQVRPS0VOX1RLX1JFUE1OeyVkLCVkfVxu IiwgeF9taW5yZXAsIHhfbWF4cmVwKTsKICAgICAgaWYgKCh4X21pbnJlcCAhPSBtaW5yZXAp IHx8ICh4X21heHJlcCAhPSBtYXhyZXApKQogICAgICAgIGZwcmludGYgKHBsbF9sb2csICIg KioqIEVSUk9SOiBNaW4sIG1heCByZXAgZG9lc24ndCBtYXRjaFxuIik7CiAgICB9CgogIGVs c2UgaWYgKGZzYWxleF90b2tlbiA+PSBGU0FUT0tFTl9US19DU0VUKQogICAgewogICAgICBz aXplX3QgaW5kZXg7CiAgICAgIHVuc2lnbmVkIGludCAqIG9yaWdfY2NsOwogICAgICBpbnQg aTsKICAgICAgY2hhcmNsYXNzX3QgKmNoYXJzZXQ7CiAgICAgIGNoYXIgKmRlc2NyaXB0aW9u OwogICAgICBzdGF0aWMgY2hhciBidWZbMjU2XTsKICAgICAgY2hhciAqcF9idWY7CgovKiBO eWJibGUgKDRiaXQpLXRvLWNoYXIgY29udmVyc2lvbiBhcnJheSBmb3IgbGl0dGxlLWJpdC1l bmRpYW4gbnliYmxlcy4gICovCnN0YXRpYyBjb25zdCBjaGFyICpkaXNwX255YmJsZSA9ICIw ODRjMmE2ZTE5NWQzYjdmIjsKCiAgICAgIC8qIFJlcG9ydCBkZXRhaWxzIG9mIHRoZSBvcmln aW5hbCBjaGFyY2xhcyBwcm9kdWNlZCBieSBkZmEuYy4gICovCiAgICAgIGluZGV4ID0gb3Jp Z2luYWxfdG9rZW4gLSBDU0VUOwogICAgICBwX2J1ZiA9IGJ1ZjsKICAgICAgb3JpZ19jY2wg PSBkZmEtPmNoYXJjbGFzc2VzW2luZGV4XTsKICAgICAgZm9yIChpID0gMDsgaSA8IENIQVJD TEFTU19XT1JEUzsgaSArPSAyKQogICAgICAgIHsKICAgICAgICAgIGNoYXJjbGFzc193b3Jk IGogPSBvcmlnX2NjbFtpXTsKICAgICAgICAgICpwX2J1ZisrID0gJyAnOwogICAgICAgICAg KnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAgMCkgJiAweDBmXTsKICAgICAgICAgICpw X2J1ZisrID0gZGlzcF9ueWJibGVbKGogPj4gIDQpICYgMHgwZl07CiAgICAgICAgICAqcF9i dWYrKyA9IGRpc3BfbnliYmxlWyhqID4+ICA4KSAmIDB4MGZdOwogICAgICAgICAgKnBfYnVm KysgPSBkaXNwX255YmJsZVsoaiA+PiAxMikgJiAweDBmXTsKICAgICAgICAgICpwX2J1Zisr ID0gZGlzcF9ueWJibGVbKGogPj4gMTYpICYgMHgwZl07CiAgICAgICAgICAqcF9idWYrKyA9 IGRpc3BfbnliYmxlWyhqID4+IDIwKSAmIDB4MGZdOwogICAgICAgICAgKnBfYnVmKysgPSBk aXNwX255YmJsZVsoaiA+PiAyNCkgJiAweDBmXTsKICAgICAgICAgICpwX2J1ZisrID0gZGlz cF9ueWJibGVbKGogPj4gMjgpICYgMHgwZl07CgogICAgICAgICAgaiA9IG9yaWdfY2NsW2kg KyAxXTsKICAgICAgICAgICpwX2J1ZisrID0gZGlzcF9ueWJibGVbKGogPj4gIDApICYgMHgw Zl07CiAgICAgICAgICAqcF9idWYrKyA9IGRpc3BfbnliYmxlWyhqID4+ICA0KSAmIDB4MGZd OwogICAgICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAgOCkgJiAweDBmXTsK ICAgICAgICAgICpwX2J1ZisrID0gZGlzcF9ueWJibGVbKGogPj4gMTIpICYgMHgwZl07CiAg ICAgICAgICAqcF9idWYrKyA9IGRpc3BfbnliYmxlWyhqID4+IDE2KSAmIDB4MGZdOwogICAg ICAgICAgKnBfYnVmKysgPSBkaXNwX255YmJsZVsoaiA+PiAyMCkgJiAweDBmXTsKICAgICAg ICAgICpwX2J1ZisrID0gZGlzcF9ueWJibGVbKGogPj4gMjQpICYgMHgwZl07CiA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Zucl90b2tlbnMsICZ0b2tlbl9saXN0KTsKICAgIGZw cmludGYgKHBsbF9sb2csICJcbnRva2VuczogIG9yaWdpbmFsICBmc2FwYXJzZVxuIik7CiAg ICBtYXhfaW5kZXggPSBkLT50aW5kZXggPiBucl90b2tlbnMgPyBkLT50aW5kZXggOiBucl90 b2tlbnM7CiAgICBmb3IgKGogPSAwOyBqIDwgbWF4X2luZGV4OyArK2opCiAgICAgIHsKICAg ICAgICBzdGF0aWMgY2hhciBidWZbMjU2XTsKICAgICAgICBpZiAoaiA8IGQtPnRpbmRleCkK ICAgICAgICAgIHsKICAgICAgICAgICAgc3ByaW50ZiAoYnVmLCAiJTAybHgiLCBkLT50b2tl bnNbal0pOwogICAgICAgICAgICBmcHJpbnRmIChwbGxfbG9nLCAiJTE3cyAiLCBidWYpOwog ICAgICAgICAgfQogICAgICAgICAgZWxzZQogICAgICAgICAgICBmcHJpbnRmIChwbGxfbG9n LCAiJTE3cyIsICIiKTsKICAgICAgICBpZiAoaiA8IG5yX3Rva2VucykKICAgICAgICAgIHsK ICAgICAgICAgICAgc3ByaW50ZiAoYnVmLCAiJTAybHgiLCB0b2tlbl9saXN0W2pdKTsKICAg ICAgICAgICAgZnByaW50ZiAocGxsX2xvZywgIiU5cyIsIGJ1Zik7CiAgICAgICAgICB9CiAg ICAgICAgZnByaW50ZiAocGxsX2xvZywgIlxuIik7CiAgICAgIH0KCiAgICAvKiBBbmQgZmlu YWxseSwgc2VlIGhvdyBleHRyYWN0aW5nIG11c3RzIGZyb20gZGZhLmMgY29tcGFyZXMgdG8g ZXh0cmFjdGluZwogICAgICAgbXVzdHMgdmlhIHRoZSBmc2EvY2hhcmNsYXNzIGZhbWlseSBv ZiBmdW5jdGlvbnM7IGFnYWluLCB0aGVzZSBzaG91bGQKICAgICAgIGJlIGlkZW50aWNhbC4g ICovCiAgICBtdXN0cyA9IChmc2FtdXN0c19saXN0X2VsZW1lbnRfdCAqKSBkLT5tdXN0czsK ICAgIHNob3dfbXV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V4LmMgIgogICAgICAgICAgICAgICAgICAgICAuLiAiZnNhcGFyc2UuYyBmc2Ft dXN0cy5jIG1iY3NldHMuYyBkZmEtcHJsLmMgIikgdGhlbgogICB0ID0gdDpnc3ViKCJkZmEu YyAiLAogICAgICAiY2hhcmNsYXNzLmMgZnNhdG9rZW4uYyBmc2FsZXguYyAiCiAgICAgICAg ICAgIC4uICJmc2FwYXJzZS5jIGZzYW11c3RzLmMgbWJjc2V0cy5jIGRmYS1wcmwuYyAiKQoK ICAgLS0gSXQgaXMgdmVyeSBCYWQgRm9ybSB0byBtb2RpZnkgdGhlIG9yaWdpbmFsIHJhdyBz ZWdtZW50LCBidXQgd2UncmUKICAgLS0gdGlyZWQgYXQgdGhpcyBwb2ludC4KICAgU2VnLlJh d1RleHQgPSB0CgogICAtLSBXcml0ZSBvdXQgdGhlIG1vZGlmaWVkIGZpbGU7IGFzc3VtZSBi YWNrdXAgbWFkZSBzZXBhcmF0ZWx5IChHaXQ/KQogICBXcml0ZUZpbGUobWFrZWZpbGVhbSkK ZW5kCg== --------------020206090706050709060901 Content-Type: text/x-lua; name="strictness.lua" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="strictness.lua" -- ================================================================ -- "strictness" tracks declaration and assignment of globals in Lua -- Copyright (c) 2013 Roland Y., MIT License -- v0.1.0 - compatible Lua 5.1, 5.2 -- ================================================================ local setmetatable = setmetatable local getmetatable = getmetatable local type = type local rawget = rawget local rawset = rawset local unpack = unpack local error = error local getfenv = getfenv -- =================== -- Private helpers -- =================== -- Lua reserved keywords local luaKeyword = { ['and'] = true, ['break'] = true, ['do'] = true, ['else'] = true, ['elseif'] = true, ['end'] = true , ['false'] = true, ['for'] = true, ['function'] = true, ['if'] = true, ['in'] = true, ['local'] = true , ['nil'] = true, ['not'] = true , ['or'] = true, ['repeat'] = true, ['return'] = true, ['then'] = true , ['true'] = true , ['until'] = true , ['while'] = true, } -- Register for declared globals, defined as a table -- with weak values. local declared_globals = setmetatable({},{__mode = 'v'}) -- The global env _G metatable local _G_mt -- A custom error function local function err(msg, level) return error(msg, level or 3) end -- Custom assert with error level depth local function assert(cond, msg, level) if not cond then return err(msg, level or 4) end end -- Custom argument type assertion helper local function assert_type(var, expected_type, argn, level) local var_type = type(var) assert(var_type == expected_type, ('Bad argument #%d to global (%s expected, got %s)') :format(argn or 1, expected_type, var_type), level) end -- Checks in the register if the given global was declared local function is_declared(varname) return declared_globals[varname] end -- Checks if the passed-in string can be a valid Lua identifier local function is_valid_identifier(iden) return iden:match('^[%a_]+[%w_]*$') and not luaKeyword[iden] end -- ========================== -- Module functions -- ========================== -- Allows the declaration of passed in varnames local function declare_global(...) local vars = {...} assert(#vars > 0, 'bad argument #1 to global (expected strings, got nil)') for i,varname in ipairs({...}) do assert_type(varname, 'string',i, 5) assert(is_valid_identifier(varname), ('bad argument #%d to global. "%s" is not a valid Lua identifier') :format(i, varname)) declared_globals[varname] = true end end -- Allows the given function to write globals local function declare_global_func(f) assert_type(f, 'function', nil, 5) return function(...) local old_index, old_newindex = _G_mt.__index, _G_mt.__newindex _G_mt.__index, _G_mt.__newindex = nil, nil local results = {f(...)} _G_mt.__index, _G_mt.__newindex = old_index, old_newindex return unpack(results) end end -- ========================== -- Locking the global env _G -- ========================== do -- Catches the current env local ENV = _VERSION:match('5.2') and _G or getfenv() -- Preserves a possible existing metatable for the current env _G_mt = getmetatable(ENV) if not _G_mt then _G_mt = {} setmetatable(ENV,_G_mt) end -- Locks access to undeclared globals _G_mt.__index = function(env, varname) if not is_declared(varname) then err(('Attempt to read undeclared global variable "%s"') :format(varname)) end return rawget(env, varname) end -- Locks assignment of undeclared globals _G_mt.__newindex = function(env, varname, value) if not is_declared(varname) then err(('Attempt to assign undeclared global variable "%s"') :format(varname)) end rawset(env, varname, value) end rawset(ENV, 'global', declare_global) rawset(ENV, 'globalize', declare_global_func) end --------------020206090706050709060901--
behoffski <behoffski@HIDDEN>
:bug-grep@HIDDEN
.
Full text available.bug-grep@HIDDEN
:bug#17711
; Package grep
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.