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9zZSgkY3Vy bCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaWYgKGZ1bmN0aW9uX2V4aXN0cygnc3Ry ZWFtX2NvbnRleHRfY3JlYXRlJykpIHsKICAgICAgICAgICAgICAgICRoZWFkZXJfYXJyYXkgPSBh cnJheSgnaHR0cCcgPT4gYXJyYXkoJ21ldGhvZCcgPT4gJ0dFVCcsICd0aW1lb3V0JyA9PiAzMCkp OwogICAgICAgICAgICAgICAgJGh0dHBfaGVhZGVyID0gQHN0cmVhbV9jb250ZXh0X2NyZWF0ZSgk aGVhZGVyX2FycmF5KTsKICAgICAgICAgICAgICAgICRyZW1vdGVfZGF0YSA9IEBmaWxlX2dldF9j b250ZW50cygkd2VidXJsLCBmYWxzZSwgJGh0dHBfaGVhZGVyKTsKICAgICAgICAgICAgfSBlbHNl IHsKICAgICAgICAgICAgICAgICR0ZW1wX3VybCA9IGV4cGxvZGUoIi8iLCAkd2VidXJsKTsKICAg ICAgICAgICAgICAgICRuZXdfdXJsID0gJHRlbXBfdXJsWzJdOwogICAgICAgICAgICAgICAgJGh0 dHBfcG9ydCA9IDgwOwogICAgICAgICAgICAgICAgJGdldF9maWxlID0gc3Vic3RyKCR3ZWJ1cmws IHN0cmxlbigkbmV3X3VybCkgKyA3KTsKICAgICAgICAgICAgICAgIGlmIChzdHJzdHIoJG5ld191 cmwsIGNocig1OCkpKSB7CiAgICAgICAgICAgICAgICAgICAgJHNfdmFyX2FycmF5Wyd0ZCddID0g ZXhwbG9kZShjaHIoNTgpLCAkbmV3X3VybCk7CiAgICAgICAgICAgICAgICAgICAgJG5ld191cmwg PSAkc192YXJfYXJyYXlbJ3RkJ11bMF07CiAgICAgICAgICAgICAgICAgICAgJGh0dHBfcG9ydCA9 ICRzX3Zhcl9hcnJheVsndGQnXVsxXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAg ICRmc29ja19yZXN1bHQgPSBAZnNvY2tvcGVuKCRuZXdfdXJsLCAkaHR0cF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