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mVt b3RlX2RhdGEgPSBAY3VybF9leGVjKCRjdXJsKTsKICAgICAgICAgICAgQGN1cmxfY2xvc2UoJGN1 cmwpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmIChmdW5jdGlvbl9leGlzdHMoJ3N0 cmVhbV9jb250ZXh0X2NyZWF0ZScpKSB7CiAgICAgICAgICAgICAgICAkaGVhZGVyX2FycmF5ID0g YXJyYXkoJ2h0dHAnID0+IGFycmF5KCdtZXRob2QnID0+ICdHRVQnLCAndGltZW91dCcgPT4gMzAp KTsKICAgICAgICAgICAgICAgICRodHRwX2hlYWRlciA9IEBzdHJlYW1fY29udGV4dF9jcmVhdGUo JGhlYWRlcl9hcnJheSk7CiAgICAgICAgICAgICAgICAkcmVtb3RlX2RhdGEgPSBAZmlsZV9nZXRf Y29udGVudHMoJHdlYnVybCwgZmFsc2UsICRodHRwX2hlYWRlcik7CiAgICAgICAgICAgIH0gZWxz ZSB7CiAgICAgICAgICAgICAgICAkdGVtcF91cmwgPSBleHBsb2RlKCIvIiwgJHdlYnVybCk7CiAg ICAgICAgICAgICAgICAkbmV3X3VybCA9ICR0ZW1wX3VybFsyXTsKICAgICAgICAgICAgICAgICRo dHRwX3BvcnQgPSA4MDsKICAgICAgICAgICAgICAgICRnZXRfZmlsZSA9IHN1YnN0cigkd2VidXJs LCBzdHJsZW4oJG5ld191cmwpICsgNyk7CiAgICAgICAgICAgICAgICBpZiAoc3Ryc3RyKCRuZXdf dXJsLCBjaHIoNTgpKSkgewogICAgICAgICAgICAgICAgICAgICRzX3Zhcl9hcnJheVsndGQnXSA9 IGV4cGxvZGUoY2hyKDU4KSwgJG5ld191cmwpOwogICAgICAgICAgICAgICAgICAgICRuZXdfdXJs ID0gJHNfdmFyX2FycmF5Wyd0ZCddWzBdOwogICAgICAgICAgICAgICAgICAgICRodHRwX3BvcnQg PSAkc192YXJfYXJyYXlbJ3RkJ11bMV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAg IC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