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lTQ09ORklHX01PREVfQVVUTzsNCisgICAgICAgICAgICAgICAgKmFjcU9yZGVyICAgPSBaQVRfU1lTQ09ORklHX1BSRUZfQUNRX0FVVE87DQorCQkJfQ0KKwkJCWVsc2UgaWYoc3RyY21wKCJ5ZXMiLCBuZWVkR3NtKSA9PSAwKQ0KKwkJCXsNCisJCQkJKm1vZGUgICAgICAgPSBaQVRfU1lTQ09ORklHX01PREVfV19HU01fTFRFOw0KKyAgICAgICAgICAgICAgICAqYWNxT3JkZXIgICA9IFpBVF9TWVNDT05GSUdfUFJFRl9BQ1FfQVVUTzsNCisJCQl9DQorCQkJZWxzZSBpZihzdHJjbXAoInllcyIsIG5lZWRUZHMpID09IDApDQorCQkJew0KKwkJCQkqbW9kZSAgICAgICA9IFpBVF9TWVNDT05GSUdfTU9ERV9URF9XX0xURTsNCisgICAgICAgICAgICAgICAgKmFjcU9yZGVyICAgPSBaQVRfU1lTQ09ORklHX1BSRUZfQUNRX0FVVE87DQorCQkJfQ0KKwkJCWVsc2UNCisJCQl7DQorCQkJCSptb2RlICAgICAgID0gWkFUX1NZU0NPTkZJR19NT0RFX1dDRE1BX0xURTsNCisgICAgICAgICAgICAgICAgKmFjcU9yZGVyICAgPSBaQVRfU1lTQ09ORklHX1BSRUZfQUNRX0xURV9XX0dTTTsNCisJCQl9CQkJDQorICAgICAgICAgICAgcmV0dXJuIFRSVUU7DQorI2VuZGlmDQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsImF0QmFzZV9BdFN5c2NvbmZpZ1NldCBWYWx1ZSBJcyBub3Qgc3VwcG9ydCFcbiIpOw0KKyAgICAgICAgICAgIHJldHVybiBGQUxTRTsNCisgICAgICAgIH0NCisgICAgfQ0KKyAgICBlbHNlDQorICAgIHsNCisgICAgICAgIGZvcihpID0gMDsgaSA8IHRhYmxlU2l6ZTsgaSsrKQ0KKyAgICAgICAgew0KKyAgICAgICAg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lVGSV9OVUxMOw0KK30NCisNCit2b2lkIG5vcm1hbF9jZnVuT2tTZXQoKQ0KK3sNCisjaWYoQVBQX09TX1RZUEUgPT0gQVBQX09TX1RPUykNCisJc29mdGFwX2Fzc2VydCgiIik7DQorI2Vsc2UgDQorICAgIC8qtLS9qLaoyrFQRFDU2s/ftqjKscb3Ki8NCisgICAgQ3JlYXRlU29mdFRpbWVyKFBkcFRpbWVySUQsDQorICAgICAgICAgICAgICAgICAgICAgICAgVElNRVJfRkxBR19SRVNUQVJULA0KKyAgICAgICAgICAgICAgICAgICAgICAgIFBkcFRpbWVyX0lOVEVSVkFMLA0KKyAgICAgICAgICAgICAgICAgICAgICAgIG5vcm1hbF9wZHB0aW1lcmFjdHN0YXJ0LA0KKyAgICAgICAgICAgICAgICAgICAgICAgIE5VTEwpOw0KKyNlbmRpZiAgIA0KK30NCisNCit2b2lkKiBub3JtYWxfY29wc3RpbWVyYWN0c3RhcnQoVk9JRCAqYXJnKQ0KK3sNCisgICAgc3RhdGljIFVJTlQzMiAgaUNvdW50ID0gMDsNCisgICAgaUNvdW50Kys7DQorICAgIGlmKGlDb3VudD49MikNCisgICAgew0KKyAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsIm5vcm1hbF9jb3BzdGltZXJhY3RzdGFydCBUaW1lb3V0IVxuIik7DQorICAgICAgICBzdHJ1Y3QgYXRfY29udGV4dCAqIGNvbnRleHQgPSBjb250ZXh0X2hlYWRbTkVBUl9QU107DQorICAgICAgICBjaGFyIGF0X3N0cltBVF9DTURfTUFYXT0iQVRcclxuIjsvL7j5vt1tc2dfYnVmyfqzyWF01tC2z8P8we6jrM311de34bi61PANCisgICAgICAgIGZvcig7Y29udGV4dDtjb250ZXh0ID0gY29udGV4dC0+bmV4dCkNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihjb250ZXh0LT5jb250ZXh0X3R5cGUgPT0gQVRfQ0xJRU5UICYmIDAgPT0gYXRfc3RyY21wKGNvbnRleHQtPmF0X2Nt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ICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICIzIik7DQorICAgIH0NCisgICAgZWxzZSBpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjRfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjRfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICI0Iik7DQorICAgIH0NCisJZWxzZSBpZihyc3NpPT05OSkNCisgICAgew0KKyAgICAgICAgbm9ybWFsX2NhbGN1bmtub3dzaWduYWxiYXIoKTsJDQorICAgICAgICByZXR1cm47DQorICAgIH0JCQ0KKyAgICBlbHNlDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICI1Iik7DQorICAgIH0gICANCit9DQorDQorLyoqDQorKiogICAgICAgICAgICBSU1NJIDw9IC0xMTBkQm0gICAwuPEoMC02KQ0KKyoqICAtMTEwZEJtIDwgUlNTSSA8PSAtMTA0IGRCbSAgMbjxKDctMTIpDQorKiogIC0xMDRkQm0gPCBSU1NJIDw9IC05OCBkQm0gICAyuPEoMTMtMTgpICAgIA0KKyoqICAtOThkQm0gPCBSU1NJIDw9IC05MCBkQm0gICAgM7jxKDE5LTI2KSAgICANCisqKiAgLTkwZEJtIDwgUlNTSSA8PSAtODAgZEJtICAgIDS48SgyNy0zNikgICAgDQorKiogIC04MGRCbSA8IFJTU0kgICAgICAgICAgICAgICA1uPEoPj0zNyAgICkNCisqKi8NCit2b2lkIG5vcm1hbF9jYWxjdGRzaWduYWxiYXIobG9uZyByc3NpKQ0KK3sNCisJVF96QXRfU2lnbmFsQmFySW5mbyBzaWduYWxCYXJJbmZvID0gezB9Ow0KKwlub3JtYWxfZ2V0c2lnbmFsYmFyaW5mbygmc2lnbmFsQmFySW5mbywgWkFUX1NJR05BTEJBUl9UWVBFX1REUyk7DQorICAgIHByaW50ZigiYXRCYXNlX0NhbGNUZFNpZ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AgfQ0KKyAgICBlbHNlIGlmKChyc3NpID49IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyMl9sb3cpICYmIChyc3NpIDw9IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyMl9oaWdoKSkNCisgICAgew0KKyAgICAgICAgY2ZnX3NldCgic2lnbmFsYmFyIiwgIjIiKTsNCisgICAgfQ0KKyAgICBlbHNlIGlmKChyc3NpID49IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyM19sb3cpICYmIChyc3NpIDw9IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyM19oaWdoKSkNCisgICAgew0KKyAgICAgICAgY2ZnX3NldCgic2lnbmFsYmFyIiwgIjMiKTsNCisgICAgfQ0KKyAgICBlbHNlIGlmKChyc3NpID49IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyNF9sb3cpICYmIChyc3NpIDw9IHNpZ25hbEJhckluZm8uc2lnbmFsYmFyNF9oaWdoKSkNCisgICAgew0KKyAgICAgICAgY2ZnX3NldCgic2lnbmFsYmFyIiwgIjQiKTsNCisgICAgfQ0KKwllbHNlIGlmKHJzc2k9PTk5KQ0KKyAgICB7DQorICAgICAgICBub3JtYWxfY2FsY3Vua25vd3NpZ25hbGJhcigpOwkNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKyAgICBlbHNlDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICI1Iik7DQorICAgIH0gIA0KK30NCisNCisvKioNCisqKiAgICAgICAgICAgICAgICAgUlNTSSA8PSAtMTEwZEJtICAgMLjxKDAtMSkNCisqKiAgLTExMGRCbSA8IFJTU0kgPD0gLTEwNCBkQm0gIDG48SgyLTQpDQorKiogIC0xMDRkQm0gPCBSU1NJIDw9IC05OCBkQm0gICAyuPEoNS03KSAgICANCisqKiAgLTk4ZEJtIDwgUlNTSSA8PSAtOTAgZEJtICAgIDO48Sg4LTExKSAgICANCisqKiAgLTkwZEJtIDwgUlNTSSA8PSAtODAgZEJtICA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c3NpPT05OSkNCisgICAgew0KKwkJbm9ybWFsX2NhbGN1bmtub3dzaWduYWxiYXIoKTsJCQkNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKwlpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjBfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjBfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICIwIik7DQorICAgIH0NCisJZWxzZSBpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjFfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjFfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICIxIik7DQorICAgIH0NCisgICAgZWxzZSBpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjJfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjJfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICIyIik7DQorICAgIH0NCisgICAgZWxzZSBpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjNfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjNfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICIzIik7DQorICAgIH0NCisgICAgZWxzZSBpZigocnNzaSA+PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjRfbG93KSAmJiAocnNzaSA8PSBzaWduYWxCYXJJbmZvLnNpZ25hbGJhcjRfaGlnaCkpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInNpZ25hbGJhciIsICI0Iik7DQorICAgIH0NCisgICAgZWxzZSBpZigocnNzaT49c2lnbmFsQmFyS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UsICIiKTsNCisgICAgY2ZnX3NldChOVl9EQUlMX1NURVAsICIxIik7DQorDQorICAgIGNmZ19zZXQoTE9DS19DRUxMX1NUQVRFX0ZMQUcsICIwIik7DQorICAgIGNmZ19zZXQoInVzc2RfY2FuY2VsX2ZsYWciLCJubyIpOy8vdXNzZA0KKwkNCit9DQorDQorY2hhciAqbm9ybWFsX2ZpbmRzdWJzdHIoY29uc3QgY2hhciAqcFN0ciwgY29uc3QgY2hhciAqcFN1YlN0cikNCit7DQorICAgIGxvbmcgIGkgPSAwOw0KKyAgICBsb25nICBmbGcgPSAwOw0KKyAgICBsb25nICBuTGVuZ3RoU3RyID0gMDsNCisgICAgbG9uZyAgbkxlbmd0aFN1YlN0ciA9IDA7DQorICAgIGNvbnN0IGNoYXIgKnBjaFRlbXAgPSBaVUZJX05VTEw7DQorICAgIA0KKyAgICAvKiDIobXDwb249tfWt/u0rrXEs6S2yCAqLw0KKyAgICBuTGVuZ3RoU3RyICAgICAgPSAobG9uZylzdHJsZW4ocFN0cik7DQorICAgIG5MZW5ndGhTdWJTdHIgICA9IChsb25nKXN0cmxlbihwU3ViU3RyKTsNCisgICAgaWYgKG5MZW5ndGhTdHIgPCBuTGVuZ3RoU3ViU3RyKQ0KKyAgICB7DQorICAgICAgICByZXR1cm4gTlVMTDsNCisgICAgfQ0KKyAgICBwY2hUZW1wID0gcFN0cjsNCisgICAgLyogv6rKvLLp1dIgKi8NCisgICAgZm9yIChpID0gMDsgaSA8PSBuTGVuZ3RoU3RyIC0gbkxlbmd0aFN1YlN0cjsgaSsrKQ0KKyAgICB7DQorICAgICAgICBpZiAoJyInID09ICpwY2hUZW1wKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGlmICgwID09IGZsZykNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGZsZyA9IDE7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGZsZyA9IDA7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgaWYgKCgqcGNoVGVtcCA9PSAqcFN1YlN0cikgJiYgKDAgPT0gZmxnKSkNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZiAoMCA9PSBhdF9zdHJuY21wKHBjaFRlbXAsIHBTdWJTdHIsIChVSU5UMzIpbkxlbmd0aFN1YlN0cikpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICByZXR1cm4gKGNoYXIgKikgcGNoVGVtcDsNCisgICAgICAgICAgICB9DQorICAgICAgICB9DQorICAgICAgICBwY2hUZW1wKys7DQorICAgIH0NCisgICAgcmV0dXJuIE5VTEw7DQorfQ0KKw0KKy8q1KS0psDtKi8NCitWT0lEIG5vcm1hbF9wcmVwcm9jcmVzcGFyYWxpbmVleChjaGFyICpwUGFyYUxpbmUsaW50IHBhcmFTaXplKQ0KK3sNCisgICAgVUlOVDMyIGkgPSAwOw0KKyAgICBVSU5UMzIgbGVuZ3RoID0gMDsNCisgICAgY2hhciAqcFNvdXJjZSA9IFpVRklfTlVMTDsNCisgICAgY2hhciAqcERlc3QgPSBaVUZJX05VTEw7DQorICAgIGNoYXIgc3RyRGVzdExpbmVbQVRfQ01EX01BWF0gPSB7MH07DQorCQ0KKyAgICBpZiAoQVRfQ01EX01BWCA8PSBzdHJsZW4ocFBhcmFMaW5lKSkgLyogss7K/bzssukgoaKzpLbIvOyy6SovDQorICAgIHsNCisgICAgCXNvZnRhcF9hc3NlcnQoIiIpOw0KKyAgICAgICAgcmV0dXJuOw0KKyAgICB9DQorCWlmKDAgPT0gc3RybGVuKHBQYXJhTGluZSkpDQorCQlyZXR1cm47DQorICAgIGxlbmd0aCA9IChVSU5UMzIpc3RybGVuKHBQYXJhTGluZSk7DQorICAgIHBTb3VyY2UgPSBwUGFyYUxpbmU7ICAgICAgICAgICAgICAgIC8qINGtu7e0psDtICovDQorICAgIHBEZXN0ID0gc3RyRGVzdExpbmU7DQorICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykNCisgICAgew0KKyAgICAgICAgaWYgKCcoJyA9PSAqcFNvdXJjZSkNCisgICAgICAgIHsNCisgICAgICAgICAgICA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgLyog1/PAqLuhIMm+s/0gKi8NCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYgKCcpJyA9PSAqcFNvdXJjZSkNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZiAoJywnID09ICoocFNvdXJjZSArIDEpKSAgLyog09LAqLuhLMXQts+99Lj6xuS687XEyse38ba6usUgICAgICAgICAgICAgICAgICAgICovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBwU291cmNlKys7ICAgICAgICAgICAgICAvKiDKx7a6usWjrMm+s/3T0sCou6GyotTaxL+1xLSu1tC9q7a6usXXqru7zqq31rrFICAgKi8NCisgICAgICAgICAgICAgICAgKnBEZXN0ID0gJzsnOw0KKyAgICAgICAgICAgICAgICBwRGVzdCsrOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisgICAgICAgIGVsc2UNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcERlc3QgPSAqcFNvdXJjZTsNCisgICAgICAgICAgICBwRGVzdCsrOw0KKyAgICAgICAgfQ0KKyAgICAgICAgcFNvdXJjZSsrOw0KKyAgICB9DQorICAgIC8qIL2r1KS0psDtuvO1xMTayN2/vbG0u9iyzsr90NDW0CAqLw0KKyAgICBtZW1zZXQocFBhcmFMaW5lLCAwLCBwYXJhU2l6ZSk7DQorICAgIHN0cm5jcHkocFBhcmFMaW5lLCBzdHJEZXN0TGluZSxwYXJhU2l6ZS0xKTsNCit9DQorDQorLyrUpLSmwO0qLw0KK3ZvaWQgbm9ybWFsX3ByZXByb2NyZXNwYXJhbGlzdChUX3pBdF9SRVNfUEFSQVNfTElTVCAqcFBhcmFMaXN0LCBjb25zdCBjaGFyICpwUGFyYXMpDQorew0KKyAgICBsb25nIGkgPSAwOw0KKyAgICBjaGFyICpwSGVhZCA9IFpVRklfTlVMTDsNCisgICAgY2hhciAqcEVuZCA9IFpVRklfTlVMTDsNCisJDQorCWlmKCFhdF9zdHJjbXAocFBhcmFzLCAiT0siKSkNCisJew0KKwkJcFBhcmFMaXN0LT5saXN0Q291bnQgPSAwOw0KKwkJcmV0dXJuOw0KKwl9DQorCQ0KKyAgICAvKiDRrbu3sunV0ic7JyAqLw0KKwkNCisgICAgcEhlYWQgPSBwRW5kID0gKGNoYXIgKikgcFBhcmFzOw0KKyAgICBwRW5kID0gbm9ybWFsX2ZpbmRzdWJzdHIocEhlYWQsICI7Iik7DQorICAgIHdoaWxlIChwRW5kICE9IFpVRklfTlVMTCkNCisgICAgew0KKyAgICAgICAgLyog1dK1vSc7JyAqLw0KKyAgICAgICAgLyog1L2957Gju6QgKi8NCisgICAgICAgIGlmICgocFBhcmFMaXN0LT5saXN0Q291bnQgPj0gWkFUX1JFU19QQVJBTV9NQVhfTlVNKQ0KKyAgICAgICAgICAgIHx8IChwRW5kIC0gcEhlYWQgPj0gWkFUX1JFU19QQVJBTV9NQVhfTEVOKSkNCisgICAgICAgIHsNCisgICAgICAgICAgICByZXR1cm47DQorICAgICAgICB9DQorICAgICAgICAvKiC/vbG0xNrI3SAqLw0KKyAgICAgICAgc3RybmNweShwUGFyYUxpc3QtPnN0clBhcmFzTGluZVtpXSwgcEhlYWQsIChVSU5UMzIpKHBFbmQgLSBwSGVhZCkpOw0KKyAgICAgICAgcFBhcmFMaXN0LT5saXN0Q291bnQrKzsNCisgICAgICAgIGkrKzsNCisgICAgICAgIHBIZWFkID0gcEVuZCArIDE7DQorICAgICAgICBwRW5kID0gbm9ybWFsX2ZpbmRzdWJzdHIocEhlYWQsICI7Iik7Ly8geXggIG5ldyAgYWRkICAyMDEzLTUtMjANCisgICAgfQ0KKwkNCisgICAgaWYgKChzdHJsZW4ocEhlYWQpICE9IDApICYmIChwUGFyYUxpc3QtPmxpc3RDb3VudCA8IFp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bGxOYW1lLHNpemVvZihuZXRQcm92aWRlck5hbWUpLTEpOw0KKwkJCWNmZ19zZXQoIm5ldHdvcmtfcHJvdmlkZXIiLG5ldFByb3ZpZGVyTmFtZSk7DQorICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsIm9wZXJhdG9yIGJyYW5kIGZvdW5kIGluIHRoZSBRdWFsY29tbSBsaXN0ICEgXG4iKTsNCisJCX0NCisJCWVsc2UNCisJICAgIHsNCisJICAgICAgICBpZigwID09IHN0cmNtcChjb3BzUmVhZFBhcmEub3BlciwiQ0hJTkEgTU9CSUxFIikpDQorCSAgICAgICAgew0KKwkgICAgICAgICAgICBzdHJjcHkoY29wc1JlYWRQYXJhLm9wZXIsICJDaGluYSBNb2JpbGUiKTsNCisJICAgICAgICB9DQorCSAgICAgICAgY2ZnX3NldCgibmV0d29ya19wcm92aWRlciIsY29wc1JlYWRQYXJhLm9wZXIpOw0KKwkgICAgICAgIGF0X3ByaW50KEFUX0RFQlVHLCJvcGVyYXRvciBicmFuZCBub3QgZm91bmQgaW4gdGhlIFF1YWxjb21tIGxpc3QgISBcbiIpOw0KKwkgICAgfQ0KKwl9DQorCWVsc2UNCisgICAgew0KKyAgICAgICAgaWYoMiA9PSBjb3BzUmVhZFBhcmEuZm9ybWF0ICYmIFpVRklfU1VDQyA9PSBub3JtYWxfZ2V0bmV0d29ya3Byb3ZpZGVybmFtZShzTUNDLCBzTU5DLG5ldFByb3ZpZGVyTmFtZSxzaXplb2YobmV0UHJvdmlkZXJOYW1lKSkpDQorICAgICAgICB7DQorICAgICAgICAgICAgY2ZnX3NldChOVl9ORVRXT1JLX1BST1ZJREVSLG5ldFByb3ZpZGVyTmFtZSk7DQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgaWYoMCA9PSBzdHJjbXAoY29wc1JlYWRQYXJhLm9wZXIsIkNISU5BIE1PQklMRSIpKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICA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orICAgICAgICBpZihzdHJjbXAoInllcyIsIG5lZWRyZXN0YXJ0KSA9PSAwKS8v1tjG9LLZ1/cNCisgICAgICAgIHsNCisgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywienVzbG90IHNpbWNhcmQgcGx1Z2luLHNlbmRtc2cgdG8gTU9EVUxFX0lEX01BSU5fQ1RSTFxuIik7DQorICAgICAgICAgICAgaXBjX3NlbmRfbWVzc2FnZShNT0RVTEVfSURfQVRfQ1RMLE1PRFVMRV9JRF9NQUlOX0NUUkwsIE1TR19DTURfUkVTVEFSVF9SRVFVRVNULCAwLCBOVUxMLDApOw0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZS8vsrvW2Mb0stnX96Os1tjQwtff0rux6b+qu/rB97PMDQorICAgICAgICB7DQorICAgICAgICAgICAgZ19TaW1TbG90RmxhZyA9IFRSVUU7DQorCQkgICAgZ196VWZpX2NhblBkcERhaWwgPSBUUlVFOw0KKwkJCWdfbmVlZF9zbXNwYl9pbml0ID0gMDsNCisgICAgICAgICAgICBidWY9bm9ybWFsX2dldG1zZyhNT0RVTEVfSURfQVRfQ1RMLE1PRFVMRV9JRF9BVF9DVEwsQVRDVExfSU5ORVJfWk1TUklfTVNHLDAsTlVMTCk7DQorICAgICAgICAgICAgcmN2X2NsdF9yZXFfbXNnX3Byb2MoYnVmKTsNCisgICAgICAgICAgICBmcmVlKGJ1Zik7DQorICAgICAgICB9DQorICAgIH0JDQorICAgIHJldHVybiBOVUxMOw0KK30NCisNCitjaGFyICpzdGFydF9zZXRyb2FtX2NtZCh2b2lkICptc2csc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQpDQorew0KKyAgICByZXR1cm4gbm9ybWFsX2dldHN5c2NvbmZpZ3NldCgpOw0KK30NCisNCitpbnQgc3lzY29uZmlncmVhZF9va19hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgYXRfcHJpbnQoQVRfREVCVUcsInN5c2NvbmZpZ3JlYWRfb2tfYWN0IG1zZ19pZD0leCFcbiIsY29udGV4dC0+bXNnX2lkKTsNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgcHNpbmZvLnpyYXBfc3RhdGUgPSBaUkFQX1JFQURfRklSX0NNRDsNCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50IHN5c2NvbmZpZ3JlYWRfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBhdF9wcmludChBVF9ERUJVRywienJhcF9lcnJfYWN0IG1zZ19pZD0leCFcbiIsY29udGV4dC0+bXNnX2lkKTsNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgcHNpbmZvLnpyYXBfc3RhdGUgPSBaUkFQX1JFQURfRklSX0NNRDsNCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICB6cmFwX29rX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBhdF9wcmludChBVF9ERUJVRywienJhcF9va19hY3QgbXNnX2lkPSV4IVxuIixjb250ZXh0LT5tc2dfaWQpOw0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUElOX1JFUToNCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUFVLX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihwc2luZm8uenJhcF9zdGF0ZSA9PSBaUkFQX1JFQURfRklSX0NNRCkvL7+qu/rB97PM19+1xLfW1qcNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjcGlucmVhZCgpOw0KKwkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCQl9DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UgaWYocHNpbmZvLnpyYXBfc3RhdGUgPT0gWlJBUF9SRUFEX1NFQ19DTUQpLy9waW66zXB1a8Lr0enWpLrz19+1xLfW1qcNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNoYXIgcGluU2V0WzUwXT17MH07DQorICAgICAgICAgICAgICAgIG5vcm1hbF9yZWN2enJhcG9rKCk7DQorICAgICAgICAgICAgICAgIGNmZ19nZXRfaXRlbShOVl9QSU5TRVRfUkVTVUxULHBpblNldCxzaXplb2YocGluU2V0KSk7DQorICAgICAgICAgICAgICAgIGlmKDAgPT0gc3RyY21wKHBpblNldCwic3VjYyIpKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y2dzbigpOw0KKwkJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCQl9DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgcHNpbmZvLnpyYXBfc3RhdGU9WlJBUF9PVEhFUl9DTUQ7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9QSU5fTlVNX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICAqbmV4dF9yZXE9bWFsbG9jKDEwKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW49MTA7DQorICAgICAgICAgICAgICAgIGNmZ19nZXRfaXRlbSgicGlubnVtYmVyIiwqbmV4dF9yZXEsIDEwLTEpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKwkJCX0NCisJCQlicmVhazsgLy8gY292IAlNDQorICAgICAgICB9DQorICAgICAgICBjYXNlIE1TR19DTURfUElOX01BTkFHRV9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgbm9ybWFsX3JlY3Z6cmFwb2soKTsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KK2ludCAgenJhcF9lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIGNhc2UgQVRDVExfSU5ORVJfWk1TUklfTVNHOg0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1BJTl9NQU5BR0VfUkVROg0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1ZFUklGWV9QSU5fUkVROg0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1ZFUklGWV9QVUtfUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHBzaW5mby56cmFwX3N0YXRlPVpSQVBfT1RIRVJfQ01EOw0KKyAgICAgICAgICAgIGlmICgoMCA9PSBzdHJjbXAoYXRfc3RyLCAiMTAiKSkgICAgLypubyBzaW0gY2FyZCovDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCgwID09IHN0cmNtcChhdF9zdHIsICIxMyIpKSAgICAvKmNhcmQgaW5pdGlhbGl6ZSBmYWlsZWQqLw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwoMCA9PSBzdHJjbXAoYXRfc3RyLCAiMTUiKSkpICAgIC8qY2FyZCBlcnJvciovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBpZigwID09IHN0cmNtcChhdF9zdHIsICIxMyIpKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3NpbV9kZXN0cm95Iik7DQorICAgICAgICAgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywibW9kZW1fc2ltX2Rlc3Ryb3k6JXNcbiIsYXRfc3RyKTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfTU9ERU1fTUFJTl9TVEFURSwibW9kZW1fc2ltX3VuZGV0ZWN0ZWQiKTsNCisgICAgICAgICAgICAgICAgICAgIGF0X3ByaW50KEFUX0RFQlVHLCJtb2RlbV9zaW1fdW5kZXRlY3RlZDolc1xuIixhdF9zdHIpOw0KKyAgICAgICAgICAgICAgICB9DQorDQorCQkJCQ0KKwkJCQlpcGNfc2VuZF9tZXNzYWdlKE1PRFVMRV9JRF9BVF9DVEwsIE1PRFVMRV9JRF9NTUksIE1TR19DTURfU0lNX0FCTk9STUFMX0lORCwgMCwgTlVMTCwwKTsNCisJCQkJDQorICAgICAgICAgICAgICAgIC8qs/XKvLuvcGJttcRBUCCy4LXnu7Cxvte8sbizybmmo6y38dTyzt6/qMqxd2VidWnXqsimKi8NCisgICAgICAgICAgICAgICAgY2ZnX3NldCgicGJtX2luaXRfZmxhZyIsIjAiKTsNCisgICAgICAgICAgICAgICAgDQorICAgICAgICAgICAgICAgIC8vvfi3ydDQxKPKvQ0KKyAgICAgICAgICAgICAgICAvLypuZXh0X3JlcSA9IG5vcm1hbF9nZXRwb3dlcnNhdmUoKTsNCisgICAgICAgICAgICAgICAgLy8qbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgLy9wc2luZm8ucG93ZXJzYXZlX3N0YXRlPVBPV0VSU0FWRV9DQVJERVJST1JfQ01EOw0KKyAgICAgICAgICAgICAgICAvKnN0cnVjdCB0aW1ldmFsIHRwOw0KKyAgICAgICAgICAgICAgICBpZiAoMCAhPSBnZXR0aW1lb2ZkYXkoJnRwLE5VTEwpKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywiZ2V0IHRpbWUgb2Ygc3lzdGVtIHdyb25nIik7DQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRzeWN0aW1lc2V0KHRwLnR2X3NlYywgdHAudHZfdXNlYyk7Ki8NCisJCQkJKm5leHRfcmVxID0gbm9ybWFsX2dldG10bmV0c2V0KG1jY051bSk7DQorCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9QSU5fTlVNX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICAqbmV4dF9yZXE9bWFsbG9jKDEwKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbj0xMDsNCisgICAgICAgICAgICBzdHJjcHkoKm5leHRfcmVxLCIwIik7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisJCQl9DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50IHN5c2NvbmZpZ19hdXRvX2FjdCggY2hhciAqYXRfcGFyYXMgLGludCBpc19xdWVyeV9yZXBvcnQpDQorew0KKyAgICBpbnQgbW9kZSA9IFpBVF9TWVNDT05GSUdfTU9ERV9BVVRPOw0KKyAgICBpbnQgYWNxb3JkZXIgPSBaQVRfU1lTQ09ORklHX1BSRUZfQUNRX0FVVE87DQorICAgIGludCAgbW9kZW5vdyA9IC0xOw0KKyAgICBpbnQgIGFjcW9yZGVybm93ID0gLTE7DQorICAgIGludCAgcm9hbSA9IC0xOw0KKyAgICBpbnQgIHJvYW1ub3cgPSAtMTsNCisgICAgaW50ICBzcnZkb21haW4g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Xh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisNCisgICAgICAgIGNhc2UgQVRDVExfSU5ORVJfWk1TUklfTVNHOg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGNoYXIgc2ltUGluWzUwXSA9IHswfTsNCisgICAgICAgICAgICBjaGFyIHNpbVB1a1s1MF0gPSB7MH07DQorICAgICAgICAgICAgY2hhciBhdXRvU2ltcGluWzUwXSA9IHswfTsNCisgICAgICAgICAgICBjaGFyIGF1dG9Db2RlWzUwXSA9IHswfTsNCisgICAgICAgICAgICBjaGFyIHBpbk51bWJlcls1MF0gPSB7MH07DQorICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX1NJTV9QSU4sc2ltUGluLHNpemVvZihzaW1QaW4pKTsNCisgICAgICAgICAgICBjZmdfZ2V0X2l0ZW0oTlZfU0lNX1BVSyxzaW1QdWssc2l6ZW9mKHNpbVB1aykpOw0KKyAgICAgICAgICAgIA0KKyAgICAgICAgICAgIC8qsrvQ6NKqUElOwuujrLeiQ0dTTrLp0a/D/MHuKi8NCisgICAgICAgICAgICBpZihzdHJjbXAoIjAiLHNpbVBpbikgPT0gMCAmJiBzdHJjbXAoIjAiLHNpbVB1aykgPT0gMCApDQorICAgICAgICAgICAgewkNCisJCQkJKm5leHRfcmVxID0gbm9ybWFsX2dldGNncmVnc2V0KCIyIik7DQorCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgLyrQ6NKq0enWpCovDQorICAgICAgICAgICAgZWxzZSBpZihzdHJjbXAoIjEiLHNpbVBpbik9PTApDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgIAlpcGNfc2VuZF9tZXNzYWdlKE1PRFVMRV9JRF9BVF9DVEwsIE1PRFVMRV9JRF9NTUksIE1TR19DTURfU0lNX0FCTk9STUFMX0lORCwgMCwgTlVMTCwwKTsNCisNCisgICAgICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX0FVVE9fU0lNUElOLGF1dG9TaW1waW4sc2l6ZW9mKGF1dG9TaW1waW4pKTsNCisgICAgICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX0FVVE9fU0lNUElOX0NPREUsYXV0b0NvZGUsc2l6ZW9mKGF1dG9Db2RlKSk7DQorICAgICAgICAgICAgICAgIGNmZ19nZXRfaXRlbShOVl9QSU5OVU1CRVIscGluTnVtYmVyLHNpemVvZihwaW5OdW1iZXIpKTsNCisgICAgICAgICAgICAgICAgLyrX1LavcGluwuvR6dakKi8NCisgICAgICAgICAgICAgICAgaWYoKDAgPT0gc3RyY21wKGF1dG9TaW1waW4sIjEiKSkgJiYgKHN0cmNtcChhdXRvQ29kZSwiIikgIT0gMCkpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjcGluc2V0KGF1dG9Db2RlKTsNCisJCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQkJCX0NCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICAvKsj0cGlutcTKo9PgtM7K/c6qMKOs1PK9q8rHt/HQ6NKqUHVrwuu4xM6qMSovDQorICAgICAgICAgICAgICAgIGVsc2UgaWYoc3RyY21wKCIwIixwaW5OdW1iZXIpPT0wKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3dhaXRwdWsiKTsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgICAgICB9DQorDQorCQkJYnJlYWs7IC8vIGNvdiBNIE1JU1NJTkdfQlJFQUsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9QSU5fU1RBVFVTX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBjaGFyIHNpbVBpbls1MF0gPSB7MH07DQorICAgICAgICAgICAgY2hhciBzaW1QdWtbNTBdID0gezB9Ow0KKyAgICAgICAgICAgIA0KKyAgICAgICAgICAgIGNmZ19nZXRfaXRlbSgic2ltX3BpbiIsc2ltUGluLHNpemVvZihzaW1QaW4pKTsNCisgICAgICAgICAgICBjZmdfZ2V0X2l0ZW0oInNpbV9wdWsiLHNpbVB1ayxzaXplb2Yoc2ltUHVrKSk7ICANCisgICAgICAgICAgICAqbmV4dF9yZXE9bWFsbG9jKDEwKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbj0xMDsNCisgICAgICAgICAgICBpZihzdHJjbXAoIjAiLCBzaW1QaW4pID09IDAgJiYgc3RyY21wKCIwIiwgc2ltUHVrKSA9PSAwICkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIHNwcmludGYoKm5leHRfcmVxLCIlZCIsIFBJTl9TVEFUVVNfTk9fUElOKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZihzdHJjbXAoIjEiLCBzaW1QaW4pPT0wKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgc3ByaW50ZigqbmV4dF9yZXEsIiVkIiwgUElOX1NUQVRVU19QSU4xKTsNCisgICAgICAgICAgICB9ICANCisgICAgICAgICAgICBlbHNlIGlmKHN0cmNtcCgiMSIsIHNpbVB1ayk9PTApDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBzcHJpbnRmKCpuZXh0X3JlcSwiJWQiLCBQSU5fU1RBVFVTX1BVSzEpOw0KKyAgICAgICAgICAgIH0gIA0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorCQkJfQ0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KK2ludCBjcGluX3JlYWRfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZiAoKDAgPT0gc3RyY21wKGF0X3N0ciwgIjEwIikpICAgIC8qbm8gc2ltIGNhcmQqLw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwoMCA9PSBzdHJjbXAoYXRfc3RyLCAiMTMiKSkgICAgLypjYXJkIGluaXRpYWxpemUgZmFpbGVkKi8NCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8KDAgPT0gc3RyY21wKGF0X3N0ciwgIjE1IikpKSAgICAvKmNhcmQgZXJyb3IqLw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgaWYoMCA9PSBzdHJjbXAoYXRfc3RyLCAiMTMiKSkNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgY2ZnX3NldChOVl9NT0RFTV9NQUlOX1NUQVRFLCJtb2RlbV9zaW1fZGVzdHJveSIpOw0KKyAgICAgICAgICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsIm1vZGVtX3NpbV9kZXN0cm95OiVzXG4iLGF0X3N0cik7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgZWxzZQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3NpbV91bmRldGVjdGVkIik7DQorICAgICAgICAgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywibW9kZW1fc2ltX3VuZGV0ZWN0ZWQ6JXNcbiIsYXRfc3RyKTsJCQkJCQ0KKyAgICAgICAgICAgICAgICB9DQorDQorCQkJCWlwY19zZW5kX21lc3NhZ2UoTU9EVUxFX0lEX0FUX0NUTCwgTU9EVUxFX0lEX01NSSwgTVNHX0NNRF9TSU1fQUJOT1JNQUxfSU5ELCAwLCBOVUxMLDApOw0KKw0KKyAgICAgICAgICAgICAgICAvKrP1yry7r3BibbXEQVAgsuC157uwsb7XvLG4s8m5pqOst/HU8s7ev6jKsXdlYnVp16rIpiovDQorICAgICAgICAgICAgICAgIGNmZ19zZXQoInBibV9pbml0X2ZsYWciLCIwIik7DQorICAgICAgICAgICAgICAgIA0KKyAgICAgICAgICAgICAgICAvL734t8nQ0MSjyr0NCisgICAgICAgICAgICAgICAgLy8qbmV4dF9yZXEgPSBub3JtYWxfZ2V0cG93ZXJzYXZlKCk7DQorICAgICAgICAgICAgICAgIC8vKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIC8qc3RydWN0IHRpbWV2YWwgdHA7DQorICAgICAgICAgICAgICAgIGlmICgwICE9IGdldHRpbWVvZmRheSgmdHAsTlVMTCkpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIGF0X3ByaW50KEFUX0RFQlVHLCJnZXQgdGltZSBvZiBzeXN0ZW0gd3JvbmciKTsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldHN5Y3RpbWVzZXQodHAudHZfc2VjLCB0cC50dl91c2VjKTsqLw0KKwkJCQkqbmV4dF9yZXEgPSBub3JtYWxfZ2V0bXRuZXRzZXQobWNjTnVtKTsNCisJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIC8vcHNpbmZvLnBvd2Vyc2F2ZV9zdGF0ZT1QT1dFUlNBVkVfQ0FSREVSUk9SX0NNRDsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCQl9DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgICAgICBjYXNlIE1TR19DTURfUElOX1NUQVRVU19SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgKm5leHRfcmVxPW1hbGxvYygxMCk7DQorCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAqbmV4dF9sZW49MTA7DQorICAgICAgICAgICAgc3ByaW50ZigqbmV4dF9yZXEsIiVkIiwgUElOX1NUQVRVU19OT19QSU4pOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorCQkJfQ0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KKw0KK2ludCBjcGluX3NldF9va19hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICBjYXNlIE1TR19DTURfVkVSSUZZX1BJTl9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgY2hhciBwaW5Qcm9jZXNzWzUwXSA9IHswfTsNCisgICAgICAgICAgICBNU0dfQlVGICpidWY9TlVMTDsNCisgICAgICAgICAgICBjZmdfZ2V0X2l0ZW0oTlZfUElOX1BVS19QUk9DRVNTLHBpblByb2Nlc3Msc2l6ZW9mKHBpblByb2Nlc3MpKTsNCisgICAgICAgICAgICBpZihzdHJjbXAocGluUHJvY2VzcywiYmVnaW4iKSA9PSAwKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX3NldChOVl9QSU5fUFVLX1BST0NFU1MsICJlbmQiKTsgICAgICAgIA0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBjZmdfc2V0KE5WX1BJTlNFVF9SRVNVTFQsInN1Y2MiKTsNCisgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3JlYWR5Iik7DQorICAgICAgICAgICAgLyphdF9uZXh0PW1hbGxvYyhBVF9DTURfTUFYKTsNCisgICAgICAgICAgICAvL1BJTsLryejWw7PJuaajrLeiQVQrWlJBUD/Kx86qwcu4/NDCUElOwuu6zXB1a8LryqPT4LTOyv0NCisgICAgICAgICAgICBzcHJpbnRmKGF0X25leHQsIkFUK1pSQVA/XHJcbiIpOw0KKyAgICAgICAgICAgICpuZXh0X3JlcSA9IGF0X25leHQ7DQorICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKGF0X25leHQpOw0KKyAgICAgICAgICAgIHBzaW5mby56cmFwX3N0YXRlID0gWlJBUF9SRUFEX1NFQ19DTUQ7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOyovDQorICAgICAgICAgICAgYnVmPW5vcm1hbF9nZXRtc2coTU9EVUxFX0lEX0FUX0NUTCxNT0RVTEVfSURfQVRfQ1RMLEFUQ1RMX0lOTkVSX1pNU1JJX01TRywwLE5VTEwpOw0KKyAgICAgICAgICAgIHJjdl9jbHRfcmVxX21zZ19wcm9jKGJ1Zik7DQorICAgICAgICAgICAgZnJlZShidWYpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgICAgICBjYXNlIE1TR19DTURfVkVSSUZZX1BVS19SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgY2hhciBtb2RlbVN0YXRlWzUwXSA9IHswfTsNCisJCQljaGFyIHBpblByb2Nlc3NbNTBdID0gezB9Ow0KKw0KKwkJCWNmZ19zZXQoTlZfUElOU0VUX1JFU1VMVCwic3VjYyIpOw0KKwkJCWNmZ19nZXRfaXRlbShOVl9QSU5fUFVLX1BST0NFU1MscGluUHJvY2VzcyxzaXplb2YocGluUHJvY2VzcykpOw0KKwkJCWlmKHN0cmNtcChwaW5Qcm9jZXNzLCJiZWdpbiIpID09IDApDQorCQkgICAgew0KKwkJICAgICAgICBjZmdfc2V0KE5WX1BJTl9QVUtfUFJPQ0VTUywgImVuZCIpOw0KKwkJICAgIH0NCisgICAgICAgICAgICANCisgICAgICAgICAgICBjZmdfZ2V0X2l0ZW0oTlZfTU9ERU1fTUFJTl9TVEFURSxtb2RlbVN0YXRlLHNpemVvZihtb2RlbVN0YXRlKSk7DQorICAgICAgICAgICAgaWYoc3RyY21wKCJtb2RlbV9pbml0X2NvbXBsZXRlIixtb2RlbVN0YXRlKSkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfTU9ERU1fTUFJTl9TVEFURSwibW9kZW1fcmVhZHkiKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNsY2tzZXQoMiwiU0MiLDIpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJfQ0KKwkJCWJyZWFrOw0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1BJTl9WRVJJRllfUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpuZXh0X3JlcT1tYWxsb2MoMTApOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbj0xMDsNCisgICAgICAgICAgICAgICAgc3RyY3B5KCpuZXh0X3JlcSwiMCIpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKwkJCX0NCisJCQlicmVhazsNCisgICAgICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgY3Bpbl9zZXRfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUElOX1JFUTovL1BJTsLr0enWpA0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGNoYXIgYXV0b1NpbXBpbls1MF0gPSB7MH07DQorICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX0FVVE9fU0lNUElOLGF1dG9TaW1waW4sc2l6ZW9mKGF1dG9TaW1waW4pKTsNCisgICAgICAgICAgICBpZigwID09IHN0cmNtcChhdXRvU2ltcGluLCIxIikpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX0FVVE9fU0lNUElOLCIwIik7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGlmKDAgPT0gc3RyY21wKGF0X3N0ciwgIjE2IikpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3dhaXRwaW4iKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZiAoMCA9PSBzdHJjbXAoYXRfc3RyLCAiMTIiKSkJDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAvKsrktO0ztM5waW6jrL2rseTOqndhaXRwdWsqLw0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3dhaXRwdWsiKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgY2ZnX3NldChOVl9QSU5TRVRfUkVTVUxULCJmYWlsIik7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldHpyYXByZWFkKCk7DQorCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIHBzaW5mby56cmFwX3N0YXRlID0gWlJBUF9SRUFEX1NFQ19DTUQ7DQorICAgICAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorDQorCQkJYnJlYWs7IC8vIGNvdiBNIE1JU1NJTkdfQlJFQUsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUFVLX1JFUTovL1BVS8Lr0enWpA0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGNoYXIgbW9kZW1TdGF0ZVs1MF0gPSB7MH07DQorICAgICAgICAgICAgaWYgKDAgPT0gc3RyY21wKGF0X3N0ciwgIjE2IikpICAgICAgIA0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX01PREVNX01BSU5fU1RBVEUsbW9kZW1TdGF0ZSxzaXplb2YobW9kZW1TdGF0ZSkpOw0KKyAgICAgICAgICAgICAgICBpZihzdHJjbXAoIm1vZGVtX2luaXRfY29tcGxldGUiLG1vZGVtU3RhdGUpKQ0KKyAgICAgICAgCSAgICB7DQorICAgICAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3dhaXRwdWsiKTsNCisgICAgICAgIAkgICAgfQkJDQorICAgICAgICAgICAgfQ0KKwkJCWVsc2UgaWYgKDAgPT0gc3RyY21wKGF0X3N0ciwgIjEzIikpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX3NpbV9kZXN0cm95Iik7DQorICAgICAgICAgICAgICAgIGF0X3ByaW50KEFUX0RFQlVHLCJtb2RlbV9zaW1fZGVzdHJveTolc1xuIixhdF9zdHIpOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIAljZmdfc2V0KE5WX1BJTlNFVF9SRVNVTFQsImZhaWwiKTsNCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcHNpbmZvLnpyYXBfc3RhdGUgPSBaUkFQX1JFQURfU0VDX0NNRDsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisNCisJCQlicmVhazsgLy8gY292IE0gTUlTU0lOR19CUkVBSw0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1BJTl9WRVJJRllfUkVROi8vd2lmacSjv+m3orn9wLS1xM/7z6INCisgICAgICAgIHsNCisgICAgICAgICAgICAqbmV4dF9yZXE9bWFsbG9jKDEwKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW49MTA7DQorICAgICAgICAgICAgICAgIHN0cmNweSgqbmV4dF9yZXEsIjEiKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisJCQl9DQorDQorCQkJYnJlYWs7DQorICAgICAgICB9DQorICAgIH0NCisgICAg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X3NldChOVl9NT0RFTV9NQUlOX1NUQVRFLCJtb2RlbV93YWl0cHVrIik7DQorCQljZmdfc2V0KE5WX05FRURfU0lNX1BJTiwieWVzIik7DQorICAgIH0NCisNCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQorDQoraW50ICBjZ3NuX29rX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfR0VUX01BQ19SRVE6DQorICAgICAgICB7DQorI2lmIDAgICAgICAgIA0KKyAgICAgICAgICAgICpuZXh0X3JlcT1ub3JtYWxfZ2V0bWFjcmVhZCgpOw0KKyAgICAgICAgICAgICpuZXh0X2xlbj1zdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorI2VuZGlmCQkJDQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICBjZ3NuX2Vycl9hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBNU0dfQ01EX0dFVF9NQUNfUkVROg0KKyAgICAgICAgew0KKyNpZiAwICAgICAgICANCisgICAgICAgICAgICAqbmV4dF9yZXE9bm9ybWFsX2dldG1hY3JlYWQoKTsNCisgICAgICAgICAgICAqbmV4dF9sZW49c3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKyNlbmRpZgkJCQ0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIH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GNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgY2hhciBzdHJQbG1uWzcwXSA9IHswfTsNCisgICAgICAgICAgICBjaGFyICpwUmVzPU5VTEw7DQorICAgICAgICAgICAgY2hhciBzdHJQbG1uTGFzdFsxMF0gPSB7MH07DQorICAgICAgICAgICAgY2ZnX2dldF9pdGVtKCJjcnNtX3BsbW4iLCBzdHJQbG1uLCBzaXplb2Yoc3RyUGxtbikpOw0KKyAgICAgICAgICAgIHBSZXMgPSBzdHJzdHIoc3RyUGxtbiwgIjE0NCwwLCIpOy8vse3KvtX9yLe2wcihDQorICAgICAgICAgICAgaWYoMCA9PSBzdHJsZW4oc3RyUGxtbikgfHwgTlVMTCA9PSBwUmVzKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZ19wbG1uTGVuID0gNTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgc3RybmNweShzdHJQbG1uTGFzdCwgJnN0clBsbW5bc3RybGVuKHN0clBsbW4pLTJdLCAyKTsNCisgICAgICAgICAgICBpZigwID09IHN0cmNtcCgiMDMiLCBzdHJQbG1uTGFzdCkpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBnX3BsbW5MZW4gPSA2Ow0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBnX3BsbW5MZW4gPSA1Ow0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywiY3JzbV9va19hY3QsIGdfcGxtbkxlbiA9ICVkIFxuIiwgZ19wbG1uTGVuKTsNCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y2ltaSgpOzsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuICBBVF9DT05USU5VRTsNCisJCQl9DQorCQkJYnJlYWs7IC8vIGNvdiBNIE1JU1NJTkdfQlJFQUsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9DUlNNX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihjcnNtcnNwID09IE5VTEwpew0KKwkJCQlzb2Z0YXBfYXNzZXJ0KCIiKTsNCisJCQkJcmV0dXJuIEFUX0VORDsNCisJCQl9DQorICAgICAgICAgICAgKm5leHRfcmVxPWNyc21yc3A7DQorICAgICAgICAgICAgKm5leHRfbGVuPXN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICBjcnNtX2Vycl9hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsIlJlY3YgQ3JzbVBsbW5sZW4gRVJSLlxuIik7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNpbWkoKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorCQkJfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX0NSU01fUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQorDQoraW50IGNyc21fYXV0b19hY3QoY2hhciAqYXRfcGFyYXMgLGludCBpc19xdWVyeV9yZXBvcnQpDQoreyAgDQorICAgIHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0ID0gKHN0cnVjdCBhdF9jb250ZXh0ICopaXNfcXVlcnlfcmVwb3J0Ow0KKw0KKyAgICBpZihjb250ZXh0ID09IE5VTEwpDQorICAgICAgICByZXR1cm4gQVRfRU5EOyAgIA0KKyAgICANCisgICAgYXRfcHJpbnQoQVRfREVCVUcsImNyc21fYXV0b19hY3QgbXNnX2lkPSV4LGF0X3BhcmFzPSVzIVxuIixjb250ZXh0LT5tc2dfaWQsYXRfcGFyYXMpOw0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIHsNCisgICAgICAgICAgICBjZmdfc2V0KCJjcnNtX3BsbW4iLGF0X3BhcmFzKTsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX0NSU01fUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGNyc21yc3A9bWFsbG9jKDI1Nik7DQorICAgICAgICAgICAgaWYoY3JzbXJzcCA9PSBOVUxMKXsNCisJCQkJc29mdGFwX2Fzc2VydCgiIik7DQorCQkJCXJldHVybiBBVF9FTkQ7DQorCQkJfQ0KKyAgICAgICAgICAgIG1lbXNldChjcnNtcnNwLDAsMjU2KTsNCisgICAgICAgICAgICBzcHJpbnRmKGNyc21yc3AsYXRfcGFyYXMpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICBjaW1pX29rX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihub3JtYWxfbG9ja25ldG1hdGNoKG1jY051bSwgbW5jTnVtKSA9PSBUUlVFKQ0KKyAgICAgICAgICAgIHsNCisJICAgICAgICAgICAgLypzdHJ1Y3QgdGltZXZhbCB0cDsNCisJICAgICAgICAgICAgaWYgKDAgIT0gZ2V0dGltZW9mZGF5KCZ0cCxOVUxMKSkNCisJICAgICAgICAgICAgew0KKwkgICAgICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsImdldCB0aW1lIG9mIHN5c3RlbSB3cm9uZyIpOw0KKwkgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisJICAgICAgICAgICAgfQ0KKwkgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0c3ljdGltZXNldCh0cC50dl9zZWMsIHRwLnR2X3VzZWMpOyovDQorCQkJCSpuZXh0X3JlcSA9IG5vcm1hbF9nZXRtdG5ldHNldChtY2NOdW0pOw0KKwkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAJICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgIAkgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCX0NCisJICAgICAgICB9DQorICAgICAgICAgICAgZWxzZQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX3NldCgibW9kZW1fbWFpbl9zdGF0ZSIsIm1vZGVtX2ltc2lfd2FpdG5jayIpOyANCisgICAgICAgICAg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RSVUUpDQorICAgICAgICAgICAgew0KKwkgICAgICAgICAgICAvKnN0cnVjdCB0aW1ldmFsIHRwOw0KKwkgICAgICAgICAgICBpZiAoMCAhPSBnZXR0aW1lb2ZkYXkoJnRwLE5VTEwpKQ0KKwkgICAgICAgICAgICB7DQorCSAgICAgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywiZ2V0IHRpbWUgb2Ygc3lzdGVtIHdyb25nIik7DQorCSAgICAgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKwkgICAgICAgICAgICB9DQorCSAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRzeWN0aW1lc2V0KHRwLnR2X3NlYywgdHAudHZfdXNlYyk7Ki8NCisJCQkJKm5leHRfcmVxID0gbm9ybWFsX2dldG10bmV0c2V0KG1jY051bSk7DQorCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgIAkgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgCSAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQkJfQ0KKwkgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KCJtb2RlbV9tYWluX3N0YXRlIiwibW9kZW1faW1zaV93YWl0bmNrIik7IA0KKyAgICAgICAgICAgICAgICByZXR1cm4gIEFUX0VORDsNCisgICAgICAgICAgICB9DQorDQorCQkJYnJlYWs7IC8vIGNvdiBNIE1JU1NJTkdfQlJFQUsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9DSU1JX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKwkJY2FzZSBNU0dfQ01EX01PREVNUkVHX0lORk9fUkVROg0KKwkJew0KKwkJCSpuZXh0X3JlcSA9IG5vcm1hbF9DbnVtUmVhZCgpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAJCQlyZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJfQ0KKw0KKwkJCWJyZWFrOyAvLyBjb3YgTSBNSVNTSU5HX0JSRUFLDQorCQl9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQorLyoNCitpbnQgIHphcG5zYXZlX29rX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfSU5ORVJfUERQX0lOSVQ6DQorICAgICAgICB7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisJCS8vY2FzZSBNU0dfQ01EX1NFVF9ERUZBVUxUX0FQTl9SRVE6DQorICAgICAgICAvL3sNCisgICAgICAgIC8vICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICAvL30NCisgICAgICAgIGRlZmF1bHQ6DQorICAgICAgICAgICAgc29mdGFwX2Fzc2VydCgiIik7DQorICAgICAgICANCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIHphcG5zYXZlX2Vycl9hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc29mdGFwX2Fzc2VydCgiIik7DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKyovDQoraW50IGNpbWlfYXV0b19hY3QoY2hhciAqYXRfcGFyYXMsIGludCBpc19xdWVyeV9yZXBvcnQpDQoreyAgDQorICAgIGNoYXIgY2NtbmNOdW1bMTBdICAgICAgICAgPSB7MH07DQorICAgIHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0ID0gKHN0cnVjdCBhdF9jb250ZXh0ICopaXNfcXVlcnlfcmVwb3J0Ow0KKyAgICANCisgICAgc3RybmNweShpbXNpLGF0X3BhcmFzLHNpemVvZihpbXNpKS0xKTsNCisJaW1zaVs0OV09MDsNCisgICAgc3RybmNweShtY2NOdW0sIGltc2ksIDMpOw0KKyAgICBhdF9wcmludChBVF9ERUJVRywibWNjIGlzICVzIiwgbWNjTnVtKTsNCisjaWYgKEFQUF9PU19UWVBFID09IEFQUF9PU19MSU5VWCkJDQorICAgIGlmKDYgPT0gZ19wbG1uTGVuKQ0KKwl7DQorCQlzdHJuY3B5KG1uY051bSwgaW1zaSszLCAzKTsNCisJfQ0KKwllbHNlDQorCXsNCisJCXN0cm5jcHkobW5jTnVtLCBpbXNpKzMsIDIpOw0KKwl9DQorICAgIA0KKyAgICBzbnByaW50ZihjY21uY051bSwgMTAtMSwgIiVzJXMiLCBtY2NOdW0sIG1uY051bSk7DQorCWNmZ19zZXQoTlZfU0lNX0lNU0ksIGltc2kpOw0KKwlub3JtYWxfZ2V0X2NhcmR0eXBlKGNjbW5jTnVtKTsNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgewkJDQorCQljYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisJCWNhc2UgTVNHX0NNRF9DSU1JX1JFUToNCisJCXsNCisJCQlub3JtYWxfZ2V0YXV0b2FwbihjY21uY051bSk7DQorCQkJYnJlYWs7DQorCQl9DQorCSAgCWRlZmF1bHQ6DQorICAgICAgICB7ICAgICAgICAgICANCisgICAgICAgICAgICBicmVhazsNCisgICAgICAgIH0NCisgICAgfQ0KKyNlbmRpZg0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgc3lzY29uZmlnX29rX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfTkVUX1NFTEVDVF9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNmdW5zZXQoWkFUX1BPV0VST04pOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX05FVF9TRUxFQ1RfUkVTVUxULCAic3VjZXNzIik7DQorICAgICAgICAgICAgICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorCQkJfQ0KKw0KKwkJCWJyZWFrOyAvLyBjb3YgTSBNSVNTSU5HX0JSRUFLDQorICAgICAgICB9DQorDQorCQlkZWZhdWx0Og0KKwkJew0KKwkJICAgIGJyZWFrOw0KKwkJfQ0KKyAgICB9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KK2ludCBzeXNjb25maWdfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgIHsNCisgICAgICAgIGNhc2UgTVNHX0NNRF9ORVRfU0VMRUNUX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y2Z1bnNldChaQVRfUE9XRVJPTik7DQorCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfTkVUX1NFTEVDVF9SRVNVTFQsICJmYWlsIik7DQorICAgICAgICAgICAgICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorCQkJfQ0KKw0KKwkJCWJyZWFrOyAvLyBjb3YgTSBNSVNTSU5HX0JSRUFLDQorICAgICAgICB9DQorDQorCQlkZWZhdWx0Og0KKwkJew0KKwkJICAgIGJyZWFrOw0KKwkJfQ0KKyAgICAgfQ0KKyAgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50IGNmdW5fb2tfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorCWNmZ19zZXQoImNmdW5fd29yayIsICJub25lIik7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIC8vv6q7+sH3s8zW0EFUK0NGVU49MQ0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgY2hhciBtb2RlbVN0YXRlWzUwXSAgPSB7MH07DQorICAgICAgICAgICAgbm9ybWFsX2NmdW5Pa1NldCgpOw0KKyAgICAgICAgICAgIGNmZ19nZXRfaXRlbShOVl9NT0RFTV9NQUlOX1NUQVRFLG1vZGVtU3RhdGUsc2l6ZW9mKG1vZGVtU3RhdGUpKTsNCisgICAgICAgICAgICBpZigwID09IHN0cmNtcCgibW9kZW1fc3lzY2ZnX2V4cHRpb24iLG1vZGVtU3RhdGUpKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX3NldChOVl9NT0RFTV9NQUlOX1NUQVRFLCJtb2RlbV9kZXN0cm95Iik7IA0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KE5WX01PREVNX01BSU5fU1RBVEUsIm1vZGVtX2luaXRfY29tcGxldGUiKTsgICAgICANCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgLy8qbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y2dyZWdzZXQoIjIiKTsNCisgICAgICAgICAgICAvL3BzaW5mby56cmFwX3N0YXRlID0gWlJBUF9SRUFEX0ZJUl9DTUQ7DQorICAgICAgICAgICAgLy8qbmV4dF9yZXEgPSBub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisgICAgICAgIC8vI2lmZGVmIEdVT0RJQU4NCisgICAgICAgICAgICBpZihnX2N1c3RvbWVyX3R5cGUgPT0gQ1VTVE9NRVJfR1VPRElBTiB8fCBnX2N1c3RvbWVyX3R5cGUgPT0gQ1VTVE9NRVJfTkFORElBTikNCisgICAgICAgICAgICB7DQorCQkJICAgIHJldHVybiAgQVRfRU5EOw0KKyAgICAgICAgICAgIH0NCisJCS8vI2Vsc2UNCisJCSAgICBlbHNlDQorICAgICAgICAgICAgeyAgICAgIA0KKyAgICAJCQkqbmV4dF9yZXEgPSBub3JtYWxfZ2V0c3lzY29uZmlncmVhZCgpOw0KKwkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gIEFUX0NPTlRJTlVFOw0KKwkJCQl9DQorICAgICAgICAgICAgfQ0KKw0KKwkJCWJyZWFrOyAvLyBjb3YgTSBNSVNTSU5HX0JSRUFLDQorCQkvLyNlbmRpZg0KKyAgICAgICAgfQ0KKyAgICAgICAgLy/X1Lavy9HN+A0KKyAgICAgICAgY2FzZSBNU0dfQ01EX05FVF9TRUxFQ1RfUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIGlmKGNmdW5fc3RhdGU9PTQpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0c3lzY29uZmlnc2V0KCk7DQorCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZihjZnVuX3N0YXRlPT0xKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2hhciBtTW9kZVs1MF0gPSB7MH07DQorICAgICAgICAgICAgICAgIGNmZ19nZXRfaXRlbShOVl9NX05FVFNFTEVDVF9NT0RFLG1Nb2RlLHNpemVvZihtTW9kZSkpOw0KKyAgICAgICAgICAgICAgICBpZigwID09IHN0cmNtcCgiMSIsIG1Nb2RlKSkNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNvcHNzZXQoMSwiMCIpOw0KKwkJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICBBVF9DT05USU5VRTsNCisJCQkJCX0NCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBlbHNlDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICB9DQorCQkJDQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9BSVJNT0RFX1NFVF9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgY2Z1bl9lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorCWNmZ19zZXQoImNmdW5fd29yayIsICJub25lIik7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIC8vv6q7+sH3s8zW0EFUK0NGVU49MQ0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgY2ZnX3NldChOVl9NT0RFTV9NQUlOX1NUQVRFLCJtb2RlbV9kZXN0cm95Iik7DQorICAgICAgICAgICAgcmV0dXJuICBBVF9FTkQ7DQorICAgICAgICB9DQorICAgICAgICAvL9fUtq/L0c34DQorICAgICAgICBjYXNlIE1TR19DTURfTkVUX1NFTEVDVF9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgaWYoY2Z1bl9zdGF0ZT09NCkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRzeXNjb25maWdzZXQoKTsNCisJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuICBBVF9DT05USU5VRTsNCisJCQkJfQ0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICBlbHNlIGlmKGNmdW5fc3RhdGU9PTEpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBjaGFyIG1Nb2RlWzUwXSA9IHswfTsNCisgICAgICAgICAgICAgICAgY2ZnX2dldF9pdGVtKE5WX01fTkVUU0VMRUNUX01PREUsbU1vZGUsc2l6ZW9mKG1Nb2RlKSk7DQorICAgICAgICAgICAgICAgIGlmKDAgPT0gc3RyY21wKCIxIiwgbU1vZGUpKQ0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y29wc3NldCgxLCIwIik7DQorCQkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gIEFUX0NPTlRJTlVFOw0KKwkJCQkJfQ0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIGVsc2UNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX0FJUk1PREVfU0VUX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KK2ludCBjZ3JlZ19va19hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNlcmVnc2V0KCIyIik7DQorCWlmKCpuZXh0X3JlcSkNCisgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorfQ0KKw0KK2ludCBjZ3JlZ19lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjZXJlZ3NldCgiMiIpOw0KKwlpZigqbm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ICAgICAgICAgICBjZmdfc2V0KE5WX1NUUl9OVU1fUlBMTU4scnBsbW5UbXApOw0KKyAgICAgICAgICAgIGNmZ19zZXQoTlZfQ1VSUkVOVF9SQVQscmF0VG1wKTsNCisgICAgICAgICAgICBjZmdfc2V0KE5WX01fTkVUU0VMRUNUX01PREUsICIxIik7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldHN5c2luZm8oKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisNCisJCQlicmVhazsgLy8gY292IE0NCisgICAgICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgY29wc19zZXRfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfUVVFUllfU1lTSU5GT19SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgLy8qbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y2dtcigpOw0KKwkJCSpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjb3BzcmVhZCgpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9ORVRfU0VMRUNUX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICAgICAgY2FzZSBNU0dfQ01EX05FVFdPUktfU0VUX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBjZmdfc2V0KE5WX01fTkVUU0VMRUNUX1JFU1VMVCwgIm1hbnVhbF9mYWlsIik7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldHN5c2luZm8oKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50IGNvcHNfcmVhZF9va19hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgYXRfcHJpbnQoQVRfREVCVUcsImNvcHNfcmVhZF9va19hY3QgJXhcbiIsY29udGV4dC0+bXNnX2lkKTsNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBNU0dfQ01EX1FVRVJZX1NZU0lORk9fUkVROg0KKyAgICAgICAgY2FzZSBNU0dfQ01EX05FVFdPUktfU0VUX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihnX3pVZmlfZmlyc3RDc3EpDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICBnX3pVZmlfZmlyc3RDc3EgPSBGQUxTRTsNCisgICAgICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNzcSgpOw0KKwkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuICBBVF9DT05USU5VRTsNCisJCQkJfQ0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKwl9DQorICAgIHJldHVybiBBVF9FTkQ7DQorfQ0KKw0KK2ludCBjb3BzX3JlYWRfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBhdF9wcmludChBVF9ERUJVRywiY29wc19yZWFkX29rX2FjdCAleFxuIixjb250ZXh0LT5tc2dfaWQpOw0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfUVVFUllfU1lTSU5GT19SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgaWYoZ196VWZpX2ZpcnN0Q3NxKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgZ196VWZpX2ZpcnN0Q3NxID0gRkFMU0U7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjc3EoKTsNCisJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIHJldHVybiAgQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisJCWNhc2UgTVNHX0NNRF9NT0RFTVJFR19JTkZPX1JFUToNCisJCXsNCisJCQkqbmV4dF9yZXEgPSBub3JtYWxfZ2V0Y3NxKCk7DQorCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAqbmV4dF9sZW4gPSBzdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICByZXR1cm4gIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisJCX0NCisgICAgfQ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gICAgICAgIGF0X3ByaW50KEFUX0RFQlVHLCJnZXQgdGltZSBvZiBzeXN0ZW0gd3JvbmciKTsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldHN5Y3RpbWVzZXQodHAudHZfc2VjLCB0cC50dl91c2VjKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorCX0NCisqLwkNCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICB6dmVyc2lvbl9lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIGF0X3ByaW50KEFUX0RFQlVHLCJ6dmVyc2lvbl9lcnJfYWN0XG4iKTsNCisvKg0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIEFUQ1RMX0lOTkVSX1pNU1JJX01TRzoNCisgICAgICAgIHsNCisgICAgICAgICAgICBzdHJ1Y3QgdGltZXZhbCB0cDsNCisgICAgICAgICAgICBpZiAoMCAhPSBnZXR0aW1lb2ZkYXkoJnRwLE5VTEwpKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgYXRfcHJpbnQoQVRfREVCVUcsImdldCB0aW1lIG9mIHN5c3RlbSB3cm9uZyIpOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgICAgICAqbmV4dF9yZXEgPSBub3JtYWxfZ2V0c3ljdGltZXNldCh0cC50dl9zZWMsIHRwLnR2X3VzZWMpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisgICAgICAgIH0NCisgICAgfQ0KKyovCQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgenZlcnNpb25fYXV0b19hY3QoY2hhciAqYXRfcGFyYXMgLGludCBpc19xdWVyeV9yZXBvcnQpDQorew0KKyAgICBjZmdfc2V0KE5WX0NSX0lOTkVSX1ZFUlNJT04sYXRfcGFyYXMpOw0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIHN5Y3RpbWVfb2tfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIGNhc2UgQVRDVExfSU5ORVJfWk1TUklfTVNHOg0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjbGNrc2V0KDIsIlNDIiwyKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorICAgICAgICBjYXNlIE1TR19DTURfU1lDVElNRV9TRVRfUkVROg0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICBzeWN0aW1lX2Vycl9hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNsY2tzZXQoMiwiU0MiLDIpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9TWUNUSU1FX1NFVF9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIHpzZXRtdG5ldF9va19hY3QoY2hhciAqYXRfc3RyLHN0cnVjdCBhdF9jb250ZXh0ICpjb250ZXh0LHZvaWQgKipuZXh0X3JlcSxpbnQgKm5leHRfbGVuKQ0KK3sNCisgICAgc3dpdGNoKGNvbnRleHQtPm1zZ19pZCkNCisgICAgew0KKyAgICAgICAgY2FzZSBBVENUTF9JTk5FUl9aTVNSSV9NU0c6DQorICAgICAgICB7DQorICAgICAgICAgICAgKm5leHRfcmVxID0gbm9ybWFsX2dldGNsY2tzZXQoMiwiU0MiLDIpOw0KKwkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgKm5leHRfbGVuID0gc3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCX0NCisgICAgICAgIH0NCisgICAgICAgIGRlZmF1bHQ6DQorICAgICAgICB7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIHpzZXRtdG5ldF9lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIGNhc2UgQVRDVExfSU5ORVJfWk1TUklfTVNHOg0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpuZXh0X3JlcSA9IG5vcm1hbF9nZXRjbGNrc2V0KDIsIlNDIiwyKTsNCisJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICpuZXh0X2xlbiA9IHN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgIHJldHVybiBBVF9DT05USU5VRTsNCisJCQl9DQorICAgICAgICB9DQorICAgICAgICBkZWZhdWx0Og0KKyAgICAgICAgew0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgIH0NCisgICAgcmV0dXJuIEFUX0VORDsNCit9DQorDQoraW50ICBtYWNfb2tfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIGF0X3ByaW50KEFUX0RFQlVHLCJtYWNfb2tfYWN0XG4iKTsNCisgICAgKm5leHRfcmVxPW5vcm1hbF9nZXRtYWMycmVhZCgpOw0KKwlpZigqbmV4dF9yZXEpDQorICAgICpuZXh0X2xlbj1zdHJsZW4oKm5leHRfcmVxKTsNCisgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KK30NCisNCitpbnQgIG1hY19lcnJfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbik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X2ZsYWciLCJubyIpOw0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIGNsY2tfb2tfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIGNhc2UgTVNHX0NNRF9QSU5fTUFOQUdFX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBpZihwc2luZm8uY2xja19zdGF0ZT09Q0xDS19TRVRfQ01EKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2hhciBjbGNrTW9kZVsxMF0gPSB7MH07DQorICAgICAgICAgICAgICAgIGNmZ19nZXRfaXRlbShOVl9DTENLX1NFVF9NT0RFLGNsY2tNb2RlLHNpemVvZihjbGNrTW9kZSkpOw0KKyAgICAgICAgICAgICAgICBpZiAoMD09c3RyY21wKGNsY2tNb2RlLCIwIikpDQorICAgICAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfTkVFRF9TSU1fUElOLCIiKTsNCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgICAgICBlbHNlIGlmICgwPT1zdHJjbXAoY2xja01vZGUsIjEiKSkNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAgICAgY2ZnX3NldChOVl9ORUVEX1NJTV9QSU4sInllcyIpOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfUElOX01BTkFHRV9SRVNVTFQsICIwIik7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcT1ub3JtYWxfZ2V0Y2xja3NldCgyLCJTQyIsMik7DQorCQkJCWlmKCpuZXh0X3JlcSl7DQorICAgICAgICAgICAgICAgICpuZXh0X2xlbj1zdHJsZW4oKm5leHRfcmVxKTsNCisgICAgICAgICAgICAgICAgcHNpbmZvLmNsY2tfc3RhdGU9Q0xDS19SRVFfQ01EOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZihwc2luZm8uY2xja19zdGF0ZT09Q0xDS19SRVFfQ01EKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKm5leHRfcmVxPW5vcm1hbF9nZXR6cmFwcmVhZCgpOw0KKwkJCQlpZigqbmV4dF9yZXEpew0KKyAgICAgICAgICAgICAgICAqbmV4dF9sZW49c3RybGVuKCpuZXh0X3JlcSk7DQorICAgICAgICAgICAgICAgIHBzaW5mby5jbGNrX3N0YXRlPUNMQ0tfT1RIRVJfQ01EOw0KKyAgICAgICAgICAgICAgICByZXR1cm4gQVRfQ09OVElOVUU7DQorCQkJCX0NCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUFVLX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBNU0dfQlVGICpidWY9TlVMTDsNCisgICAgICAgICAgICBidWY9bm9ybWFsX2dldG1zZyhNT0RVTEVfSURfQVRfQ1RMLE1PRFVMRV9JRF9BVF9DVEwsQVRDVExfSU5ORVJfWk1TUklfTVNHLDAsTlVMTCk7DQorICAgICAgICAgICAgcmN2X2NsdF9yZXFfbXNnX3Byb2MoYnVmKTsNCisgICAgICAgICAgICBmcmVlKGJ1Zik7DQorICAgICAgICAgICAgcmV0dXJuIEFUX0VORDsNCisgICAgICAgIH0NCisjaWYgKEFQUF9PU19UWVBFID09IEFQUF9PU19MSU5VWCkNCisJCWNhc2UgTVNHX0NNRF9DTENLX1JFUToNCisJCXsNCisvLwkJCXJldHVybiBhdENjYXBwX1JlY3ZPayhhdF9zdHIsY29udGV4dCxuZXh0X3JlcSxuZXh0X2xlbik7DQorCQl9DQorI2VuZGlmCQkNCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIGNsY2tfZXJyX2FjdChjaGFyICphdF9zdHIsc3RydWN0IGF0X2NvbnRleHQgKmNvbnRleHQsdm9pZCAqKm5leHRfcmVxLGludCAqbmV4dF9sZW4pDQorew0KKyAgICBzd2l0Y2goY29udGV4dC0+bXNnX2lkKQ0KKyAgICB7DQorICAgICAgICBjYXNlIE1TR19DTURfUElOX01BTkFHRV9SRVE6DQorICAgICAgICB7DQorICAgICAgICAgICAgaWYocHNpbmZvLmNsY2tfc3RhdGU9PUNMQ0tfU0VUX0NNRCkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfUElOX01BTkFHRV9SRVNVTFQsICIxIik7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcT1ub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuPXN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICBwc2luZm8uY2xja19zdGF0ZT1DTENLX09USEVSX0NNRDsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCQl9DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIGVsc2UgaWYocHNpbmZvLmNsY2tfc3RhdGU9PUNMQ0tfUkVRX0NNRCkNCisgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgIGNmZ19zZXQoTlZfUElOX01BTkFHRV9SRVNVTFQsICIxIik7DQorICAgICAgICAgICAgICAgICpuZXh0X3JlcT1ub3JtYWxfZ2V0enJhcHJlYWQoKTsNCisJCQkJaWYoKm5leHRfcmVxKXsNCisgICAgICAgICAgICAgICAgKm5leHRfbGVuPXN0cmxlbigqbmV4dF9yZXEpOw0KKyAgICAgICAgICAgICAgICBwc2luZm8uY2xja19zdGF0ZT1DTENLX09USEVSX0NNRDsNCisgICAgICAgICAgICAgICAgcmV0dXJuIEFUX0NPTlRJTlVFOw0KKwkJCQl9DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIHJldHVybiBBVF9FTkQ7DQorICAgICAgICB9DQorICAgICAgICANCisgICAgICAgIGNhc2UgTVNHX0NNRF9WRVJJRllfUFVLX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBNU0dfQlVGICpidWY9TlVMTDsNCisgICAgICAgICAgICBidWY9bm9ybWFsX2dldG1zZyhNT0RVTEVfSURfQVRfQ1RMLE1PRFVMRV9JRF9BVF9DVEwsQVRDVExfSU5ORVJfWk1TUklfTVNHLDAsTlVMTCk7DQorICAgICAgICAgICAgcmN2X2NsdF9yZXFfbXNnX3Byb2MoYnVmKTsNCisgICAgICAgICAgICByZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyNpZiAoQVBQX09TX1RZUEUgPT0gQVBQX09TX0xJTlVYKQ0KKwkJY2FzZSBNU0dfQ01EX0NMQ0tfUkVROg0KKwkJew0KKy8vIGZvciBwb3J0aW5nIGF0X2N0cmwgDQorLy8gCQkJcmV0dXJuIGF0Q2NhcHBfUmVjdkVycihhdF9zdHIsY29udGV4dCxuZXh0X3JlcSxuZXh0X2xlbik7DQorCQl9DQorI2VuZGlmCQkNCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisNCitpbnQgIGNwd2Rfb2tfYWN0KGNoYXIgKmF0X3N0cixzdHJ1Y3QgYXRfY29udGV4dCAqY29udGV4dCx2b2lkICoqbmV4dF9yZXEsaW50ICpuZXh0X2xlbikNCit7DQorICAgIHN3aXRjaChjb250ZXh0LT5tc2dfaWQpDQorICAgIHsNCisgICAgICAgIGNhc2UgTVNHX0NNRF9QSU5fTUFOQUdFX1JFUToNCisgICAgICAgIHsNCisgICAgICAgICAgICBjZmdfc2V0KE5WX1BJTl9NQU5BR0VfUkVTVUxULC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orLyogICAgICAgIAljZmdfc2V0KCJpc21zX3N0YXRlIiwgIjAiKTsNCisgICAgICAgICAgICBpZihmb3JrKCkgPT0gMCkNCisgICAgICAgICAgICB7DQorICAgICAgICAJCWNmZ19zZXQoImlzbXNfc3RhdGUiLCAiMSIpOw0KKyAgICAgICAgICAgICAgICBpZihleGVjdigiL2Jpbi96dGVfaXNtcyIsIE5VTEwpIDwgMCkNCisgICAgICAgICAgICAgICAgew0KKyAgICAgICAgCQkJY2ZnX3NldCgiaXNtc19zdGF0ZSIsICIyIik7DQorICAgICAgICAgICAgICAgICAgICBhdF9wcmludChBVF9ERUJVRywiZXhlY3YgZXJyb3IoJWQpXG4iLCBlcnJubyk7DQorICAgICAgICAgICAgICAgICAgICBleGl0KDApOw0KKyAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIA0KKyAgICAgICAgCWNmZ19zZXQoImlzbXNfc3RhdGUiLCAiMyIpOyovDQorCQkJaWYoc3lzdGVtKCIvYmluL3p0ZV9pc21zICYiKSA9PSAwKQ0KKwkJCXsNCisJCQkJY2ZnX3NldCgiaXNtc19zdGF0ZSIsICIzIik7DQorCQkJfQ0KKwkJCWVsc2UNCisJCQl7DQorCQkJCWNmZ19zZXQoImlzbXNfc3RhdGUiLCAiMiIpOw0KKwkJCX0NCisgICAgICAgIH0NCisjZW5kaWYNCisjZW5kaWYNCisJICAgIGlmKGdfbW9kZW1fbW9kZWwpDQorCSAgICB7DQorCSAgICAJZ19zbXNwYl9pbml0IHw9ICgxPDxBdFJlcy5vcGVydHlwZSk7DQorCSAgICAJYXRfcHJpbnQoQVRfTk9STUFMLCIyLnNtc19wYiBpbml0IGZsYWc6ICVkXG4iLCBnX3Ntc3BiX2luaXQpOw0KKwkgICAgCWlmKCgoZ19zbXNwYl9pbml0ICYgMHgwMykgPT0gMHgwMykgJiYgKGdfbmVlZF9zbXNwYl9pbml0ID09IDApKQ0KKwkJCXsNCisJCQkJY2hhciBwcHBfc3RhdHVzWzIwXSA9IHswfTsNCisJCQkJY2ZnX2dldF9pdGVtKE5WX1BQUF9TVEFUVVMsIHBwcF9zdGF0dXMsIHNpemVvZihwcHBfc3RhdHVzKSk7DQorCQkJCWlmKDAgPT0gc3RyY21wKCJwcHBfY29ubmVjdGVkIiwgcHBwX3N0YXR1cykpDQorCQkJCQlwYnNtc19pbml0X21zZ19wcm9jKCk7Ly/I57n70tG+rbKmusWzybmmo6zWsb3TuPhwYrrNc21z06bTw7eixvCz9cq8u6/P+8+iDQorCQkJCWVsc2UNCisJCQkJCXBic21zX2luaXRfdGltZXJvdXQoJkF0UmVzKTsvL3Bius1zbXO2vLP1yry7r83qs8m687LFxNzG8LaoyrHG9w0KKwkJCX0NCisJICAgIH0NCisgICAgfQ0KKyAgICByZXR1cm4gQVRfRU5EOw0KK30NCisvL2FkZCBjb3JlbTA2MjAgYmVnaW4NCisjZGVmaW5lIFpBVF9DVVNEX01BWExFTiAgICAgICAgICAgICAgICAgICAgIDMyMA0KKyNkZWZpbmUgWkFUX01BWF9MRU4gICAgICAgICAgICAgICAgIDcxNjggLy8xMDI0DQorI2RlZmluZSBBVF9VU1NEX0RBVEFfVE9fV0VCX0xFTiAgOTAwLy91c3NkDQorI2RlZmluZSBaQVRfVEFCX1JFUExBQ0UgICAgICAgICAgICAgICAgICAgICAoKHVuc2lnbmVkIGNoYXIgKSgweEZDKSkgICAgLyog1sax7bf7zOa7u7f7ICAgICAqLw0KKyNkZWZpbmUgWkFUX05VTExfRklMTCAgICAgICAgICAgICAgICAgICAgICAgKCh1bnNpZ25lZCBjaGFyICkoMHhGRCkpICAgIC8qIL/VtK7VvM67t/sgICAgICAgKi8NCisjZGVmaW5lIFpBVF9TUEFDRV9SRVBMQUNFICAgICAgICAgICAgICAgICAgICgodW5zaWduZWQgY2hhciApKDB4RkUpKSAgICAvKiC/1bjxzOa7u7f7ICAgICAgICovDQorI2RlZmluZSBaQVRfTEZfUkVQTEFDRSAgICAgICAgICAgICAgICAgICAgICAoKHVuc2lnbmVkIGNoYXIgKSgweEZCKSkgICAgLyogTEbM5ru7t/sgICAgICAgICAqLw0KKyNkZWZpbmUgWkFUX0NSX1JFUExBQ0UgICAgICAgICAgICAgICAgICAgICAgKCh1bnNpZ25lZCBjaGFyICkoMHhGQSkpICAgIC8qIENSzOa7u7f7ICovDQorDQordHlwZWRlZiBzdHJ1Y3QNCit7DQorICAgIFNJTlQxNiAgcmVwbHlNc2c7DQorICAgIENIQVIgICAgY3VzZERhdGFTdHJbWkFUX0NVU0RfTUFYTEVOICsgMV07DQorICAgIFNJTlQxNiAgYkRjczsNCit9IFRfekF0X0N1c2RSZXM7DQorDQordHlwZWRlZiBlbnVtDQorew0KKyAgICBaQVRfR1NNN0JJVCA9IDAsDQorICAgIFpBVF84QklULA0KKyAgICBaQVRfVUNTMiwNCisgICAgWkFUX0lOVkFMSUQsDQorfSBUX3pBdF9DQlNDb2RlVHlwZTsNCitWT0lEIGF0QmFzZV9QcmVQcm9jUmVzKENIQVIgKnBQYXJhTGluZSwgaW50IHBhcmFTaXplKQ0KK3sNCisgICAgU0lOVDMyICBmbGcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSAwOw0KKyAgICBVSU5UMzIgIGkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IDA7DQorICAgIFVJTlQzMiAgbGVuZ3RoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMDsNCisgICAgQ0hBUiAgICAqcFNvdXJjZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPSBwUGFyYUxpbmU7DQorICAgIENIQVIgICAgKnBEZXN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gTlVMTDsNCisgICAgDQorICAgIENIQVIgICAgKnBTdHJEZXN0TWFsbG9jID0gKENIQVIgKiltYWxsb2MoWkFUX01BWF9MRU4pOw0KKyAgICBpZihOVUxMID09IHBTdHJEZXN0TWFsbG9jKQ0KKyAgICB7DQorICAgICAgICByZXR1cm47DQorICAgIH0NCisgICAgbWVtc2V0KHBTdHJEZXN0TWFsbG9jLCAwLCBaQVRfTUFYX0xFTik7IA0KKyAgICANCisgICAgYXNzZXJ0KHBQYXJhTGluZSAhPSBOVUxMKTsNCisgICAgcERlc3QgPSBwU3RyRGVzdE1hbGxvYzsNCisgICAgbGVuZ3RoID0gc3RybGVuKHBQYXJhTGluZSk7DQorICAgIGlmICgobGVuZ3RoID09IDApIHx8IChsZW5ndGggPj0gWkFUX01BWF9MRU4pKQ0KKyAgICB7DQorICAgICAgICBmcmVlKHBTdHJEZXN0TWFsbG9jKTsNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKyAgICBmb3IgKGkgPSAwOyAoaSA8IGxlbmd0aCApJiYgKHBEZXN0IC0gcFN0ckRlc3RNYWxsb2MgPCBaQVRfTUFYX0xFTik7IGkrKykNCisgICAgew0KKyAgICAgICAgaWYgKCciJyA9PSAqcFNvdXJjZSkNCisgICAgICAgIHsNCisgICAgICAgICAgICBmbGcgPSAoMCA9PSBmbGcpPzE6MDsgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiDLq9L9usUgyb6z/SAgKi8NCisgICAgICAgICAgICBpZiAoJyInID09ICoocFNvdXJjZSArIDEpKSAgICAgICAgICAgICAgICAgICAgICAvKiDQx7rFuvPD5r30uPrQx7rFo6yy5cjrv9W0rtW8zru3+yAqLw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKnBEZXN0KysgPSAoQ0hBUilaQVRfTlVMTF9GSUxMOw0KKyAgICAgICAgICAgIH0NCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYgKCgnLCcgPT0gKnBTb3VyY2UpICYmICgwID09IGZsZykpDQorICAgICAgICB7DQorICAgICAgICAgICAgKnBEZXN0KysgPSAnICc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogy6vS/brFzeLD5rXEtrq6xaOszOa7u7PJv9W48SAqLw0KKyAgICAgICAgICAgIGlmKCcsJyA9PSAqKHBTb3VyY2UgKyAxKSkgICAgICAgICAgICAgICAgICAgICAgIC8qILa6usW688PmvfS4+ra6usWjrLvy1d/S1La6usW94c6yo6yy5cjrv9W0rtW8zru3+yAqLw0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgKnBEZXN0KysgPSAnOSc7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL7GjwfSyzsr908M51N3KsbT6zOYNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZSBpZignXDAnID09ICoocFNvdXJjZSArIDEpKSAgICAgICAgICAgICAgICAgLyogtrq6xbrzw+a99Lj6trq6xaOsu/LV39LUtrq6xb3hzrKjrLLlyOu/1bSu1bzOu7f7ICovDQorICAgICAgICAgICAgew0KKyAgICAgICAgICAgICAgICAqcERlc3QrKyA9IChDSEFSKVpBVF9OVUxMX0ZJTEw7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIC8vKnBEZXN0KysgPSAoKCcgJyA9PSAqcFNvdXJjZSkgJiYgKDEgPT0gZmxnKSk/KENIQVIpWkFUX1NQQUNFX1JFUExBQ0U6KCgoJ1x0JyA9PSAqcFNvdXJjZSkgJiYgKDEgPT0gZmxnKSk/KENIQVIpWkFUX1RBQl9SRVBMQUNFOigoKCdcbicgPT0gKnBTb3VyY2UpICYmICgxID09IGZsZykpPyhDSEFSKVpBVF9MRl9SRVBMQUNFOigoKCdccicgPT0gKnBTb3VyY2UpICYmICgxID09IGZsZykpPyhDSEFSKVpBVF9DUl9SRVBMQUNFOigqcFNvdXJjZSkpKSk7DQorICAgICAgICAgICAgaWYoKCcgJyA9PSAqcFNvdXJjZSkgJiYgKDEgPT0gZmxnKSkNCisJCQl7DQorCQkJCSpwRGVzdCsrID0gKENIQVIpWkFUX1NQQUNFX1JFUExBQ0U7DQorCQkJfQ0KKwkJCWVsc2UgaW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aWYgKCAwID09IGxlbmd0aCkNCisgICAgew0KKyAgICAgICAgcmV0dXJuOw0KKyAgICB9DQorCQ0KKyAgICAvKiC/1bSu1bzOu7f7u9a4tCAqLw0KKyAgICBpZiAoKDEgPT0gbGVuZ3RoKSAmJiAoKENIQVIpIFpBVF9OVUxMX0ZJTEwgPT0gKnBTdHJpbmdQYXJhKSkNCisgICAgew0KKyAgICAgICAgKnBTdHJpbmdQYXJhID0gJ1wwJzsNCisgICAgICAgIHJldHVybjsNCisgICAgfQ0KKyAgICAvKiDRrbu3u9a4tL/VuPHM5ru7t/u6zdbGse23+8zmu7u3+yAqLw0KKyAgICBwc3RyVGVtcCA9IHBTdHJpbmdQYXJhOw0KKyAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspDQorICAgIHsNCisgICAgICAgIGlmICgoQ0hBUikgWkFUX1NQQUNFX1JFUExBQ0UgPT0gKnBzdHJUZW1wKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpwc3RyVGVtcCA9ICcgJzsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYgKChDSEFSKSBaQVRfVEFCX1JFUExBQ0UgPT0gKnBzdHJUZW1wKQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgICpwc3RyVGVtcCA9ICdcdCc7DQorICAgICAgICB9DQorICAgICAgICBlbHNlIGlmKChDSEFSKSBaQVRfTEZfUkVQTEFDRSA9PSAqcHN0clRlbXApDQorICAgICAgICB7DQorICAgICAgICAgICAgKnBzdHJUZW1wID0gJ1xuJzsNCisgICAgICAgIH0NCisgICAgICAgIGVsc2UgaWYoKENIQVIpIFpBVF9DUl9SRVBMQUNFID09ICpwc3RyVGVtcCkNCisgICAgICAgIHsNCisgICAgICAgICAgICAqcHN0clRlbXAgPSAnXHInOw0KKyAgICAgICAgfQ0KKyAgICAgICAgZWxzZQ0KKyAgICAgICAgew0KKyAgICAgICAgICAgIDsNCisgICAgICAgIH0NCisgICAgICAgIHBzdHJUZW1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hdGFTdHJbaURhdGFMZW5dKTsNCisJIH0NCisgICAgIH0NCisgICAgIHByaW50ZigiJXNcbiIsY29udmVydERhdGFTdHIpOw0KK30NCisNCisNCitCT09MIGF0QmFzZV9Db252ZXJ0VUNTMlNldE5WKFRfekF0X0NCU0NvZGVUeXBlIGNic0NvZGVUeXBlLGNvbnN0IENIQVIgKmN1c2REYXRhU3RyLENIQVIgKmNvbnZlcnREYXRhU3RyLFVJTlQxNiBkYXRhTGVuKQ0KK3sNCisgICAgaWYoKGNic0NvZGVUeXBlID09IFpBVF9JTlZBTElEKSB8fCAoY3VzZERhdGFTdHIgPT0gTlVMTCkgfHwgKGNvbnZlcnREYXRhU3RyID09IE5VTEwpIHx8IChkYXRhTGVuIDw9IDApKQ0KKyAgICB7DQorICAgICAgICByZXR1cm4gRkFMU0U7DQorICAgIH0NCisgICAgaWYoY2JzQ29kZVR5cGUgPT0gWkFUX0dTTTdCSVQpDQorICAgIHsNCisgICAgICAgIGF0QmFzZV9Db252ZXJ0QXNjaWlUb1VDUzIoY3VzZERhdGFTdHIsY29udmVydERhdGFTdHIsZGF0YUxlbik7DQorICAgICAgICBjZmdfc2V0KCJ1c3NkX2NvbnRlbnQiLGNvbnZlcnREYXRhU3RyKTsNCisgICAgICAgIHJldHVybiBUUlVFOw0KKyAgICB9DQorICAgIGVsc2UgaWYoY2JzQ29kZVR5cGUgPT0gWkFUXzhCSVQpDQorICAgIHsNCisgICAgICAgIGF0QmFzZV9Db252ZXJ0OEJpdFRvVUNTMihjdXNkRGF0YVN0cixjb252ZXJ0RGF0YVN0cixkYXRhTGVuKTsNCisgICAgICAgIGNmZ19zZXQoInVzc2RfY29udGVudCIsY29udmVydERhdGFTdHIpOw0KKyAgICAgICAgcmV0dXJuIFRSVUU7DQorICAgIH0NCisgICAgZWxzZSBpZihjYnNDb2RlVHlwZSA9PSBaQVRfVUNTMikNCisgICAgew0KKyAgICAgICAgY2ZnX3NldCgidXNzZF9jb250ZW50IixjdXNkRGF0YV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KyAgICAgICAgICAgIGNmZ19zZXQoInVzc2Rfd3JpdGVfZmxhZyIsIjE2Iik7DQorICAgICAgICAgICAgY2ZnX3NldCgidXNzZF9kY3MiLCI3MiIpOw0KKyAgICAgICAgICAgIGlmKGN1c2RQYXJhbS5yZXBseU1zZyA9PSAwKQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX3NldCgidXNzZF9tb2RlIiwiMCIpOw0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KCJ1c3NkX2NhbmNlbF9mbGFnIiwibm8iKTsNCisgICAgICAgICAgICB9DQorICAgICAgICAgICAgZWxzZQ0KKyAgICAgICAgICAgIHsNCisgICAgICAgICAgICAgICAgY2ZnX3NldCgidXNzZF9tb2RlIiwiMSIpOw0KKyAgICAgICAgICAgICAgICBjZmdfc2V0KCJ1c3NkX2NhbmNlbF9mbGFnIiwieWVzIik7DQorICAgICAgICAgICAgfQ0KKwkJCS8vvavK/b7dtOa0orW9yv2+3b/iDQorCQkJLy9zdG9yZV91c3NkX2RhdGFfdG9fZGIoY29udmVydERhdGFTdHIpOy8vY29yZW0wNjI1DQorICAgICAgICB9DQorICAgICAgICBlbHNlDQorICAgICAgICB7DQorICAgICAgICAgICAgY2ZnX3NldCgidXNzZF93cml0ZV9mbGFnIiwiOTkiKTsNCisgICAgICAgICAgICBjZmdfc2V0KCJ1c3NkX2NhbmNlbF9mbGFnIiwibm8iKTsNCisJCQlyZXR1cm4gQVRfRU5EOw0KKyAgICAgICAgfQ0KKyAgICB9DQorICAgIGVsc2UgaWYoY3VzZFBhcmFtLnJlcGx5TXNnID09IDIpDQorICAgIHsNCisgICAgICAgIGNmZ19zZXQoInVzc2Rfd3JpdGVfZmxhZyIsIjEzIik7DQorICAgICAgICBjZmdfc2V0KCJ1c3NkX2NhbmNlbF9mbGFnIiwibm8iKTsNCisgICAgfQ0KKyAgICBlbHNlIGlmKGN1c2RQYXJhbS5yZXBseU1zZyA9PSAzKQ0KKyAgICB7D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