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LCBvdXRwdXRfbmFtZSwgaGVhZGVyX25hbWUpOworCisgIHJldHVybiBlcnJvcl9tZXNzYWdlX2NvdW50ICE9IDA7Cit9CisKKworLyogSGFuZGxlIHByb2dyYW0gYXJndW1lbnRzLiAgKi8KK3N0YXRpYyBlcnJvcl90CitwYXJzZV9vcHQgKGludCBrZXksIGNoYXIgKmFyZywgc3RydWN0IGFyZ3Bfc3RhdGUgKnN0YXRlKQoreworICBzd2l0Y2ggKGtleSkKKyAgICB7CisgICAgY2FzZSAnSCc6CisgICAgICBoZWFkZXJfbmFtZSA9IGFyZzsKKyAgICAgIGJyZWFrOworICAgIGNhc2UgT1BUX05FVzoKKyAgICAgIGZvcmNlX25ldyA9IDE7CisgICAgICBicmVhazsKKyAgICBjYXNlICdvJzoKKyAgICAgIG91dHB1dF9uYW1lID0gYXJnOworICAgICAgYnJlYWs7CisgICAgZGVmYXVsdDoKKyAgICAgIHJldHVybiBBUkdQX0VSUl9VTktOT1dOOworICAgIH0KKyAgcmV0dXJuIDA7Cit9CisKKworc3RhdGljIGNoYXIgKgorbW9yZV9oZWxwIChpbnQga2V5LCBjb25zdCBjaGFyICp0ZXh0LCB2b2lkICppbnB1dCkKK3sKKyAgY2hhciAqdHAgPSBOVUxMOworICBzd2l0Y2ggKGtleSkKKyAgICB7CisgICAgY2FzZSBBUkdQX0tFWV9IRUxQX0VYVFJBOgorICAgICAgLyogV2UgcHJpbnQgc29tZSBleHRyYSBpbmZvcm1hdGlvbi4gICovCisgICAgICBpZiAoYXNwcmludGYgKCZ0cCwgZ2V0dGV4dCAoIlwKK0ZvciBidWcgcmVwb3J0aW5nIGluc3RydWN0aW9ucywgcGxlYXNlIHNlZTpcblwKKyVzLlxuIiksIFJFUE9SVF9CVUdTX1RPKSA8IDApCisJcmV0dXJuIE5VTEw7CisgICAgICByZXR1cm4gdHA7CisgICAgZGVmYXVsdDoKKyAgICAgIGJyZWFrOworICAgIH0KKyAgcmV0dXJuIChjaGFyICopIHRleHQ7Cit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yZW50LT5sYXN0X3NldCA9IHNldF9udW1iZXI7CisJCX0KKwkgICAgICBlbHNlCisJCXsKKwkJICAvKiBTZWUgd2hldGhlciBpdCBpcyBhIHJlYXNvbmFibGUgaWRlbnRpZmllci4gICovCisJCSAgaW50IHN0YXJ0ID0gY250OworCQkgIHdoaWxlIChpc2FsbnVtICh0aGlzX2xpbmVbY250XSkgfHwgdGhpc19saW5lW2NudF0gPT0gJ18nKQorCQkgICAgKytjbnQ7CisKKwkJICBpZiAoY250ID09IHN0YXJ0KQorCQkgICAgeworCQkgICAgICAvKiBObyBjb3JyZWN0IGNoYXJhY3RlciBmb3VuZC4gICovCisJCSAgICAgIGVycm9yX2F0X2xpbmUgKDAsIDAsIGZuYW1lLCBzdGFydF9saW5lLAorCQkJCSAgICAgZ2V0dGV4dCAoImlsbGVnYWwgc2V0IG51bWJlciIpKTsKKwkJICAgICAgc2V0X251bWJlciA9IDA7CisJCSAgICB9CisJCSAgZWxzZQorCQkgICAgeworCQkgICAgICAvKiBXZSBoYXZlIGZvdW5kIHNlb210aGluZyB0aGF0IGxvb2tzIGxpa2UgYQorCQkJIGNvcnJlY3QgaWRlbnRpZmllci4gICovCisJCSAgICAgIHN0cnVjdCBzZXRfbGlzdCAqcnVucDsKKworCQkgICAgICB0aGlzX2xpbmVbY250XSA9ICdcMCc7CisJCSAgICAgIHVzZWQgPSAxOworCQkgICAgICBzeW1ib2wgPSAmdGhpc19saW5lW3N0YXJ0XTsKKworCQkgICAgICAvKiBUZXN0IHdoZXRoZXIgdGhlIGlkZW50aWZpZXIgd2FzIGFscmVhZHkgdXNlZC4gICovCisJCSAgICAgIHJ1bnAgPSBjdXJyZW50LT5hbGxfc2V0czsKKwkJICAgICAgd2hpbGUgKHJ1bnAgIT0gMCkKKwkJCWlmIChydW5wLT5zeW1ib2wgIT0gTlVMTAorCQkJICAgICYmIHN0cmNtcCAocnVucC0+c3ltYm9sLCBzeW1ib2wpID09IDApCisJCQkgIGJyZWFrOworCQkJZWx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yX3QgKnJwID0gc3RyaW5nOworICB3Y2hhcl90ICp3cCA9IHN0cmluZzsKKworICBpZiAocXVvdGVfY2hhciAhPSBMJ1wwJyAmJiAqcnAgPT0gcXVvdGVfY2hhcikKKyAgICB7CisgICAgICBpc19xdW90ZWQgPSAxOworICAgICAgKytycDsKKyAgICB9CisgIGVsc2UKKyAgICBpc19xdW90ZWQgPSAwOworCisgIHdoaWxlICgqcnAgIT0gTCdcMCcpCisgICAgaWYgKCpycCA9PSBxdW90ZV9jaGFyKQorICAgICAgLyogV2Ugc2ltcGx5IGVuZCB0aGUgc3RyaW5nIHdoZW4gd2UgZmluZCB0aGUgZmlyc3QgdGltZSBhbgorCSBub3QtZXNjYXBlZCBxdW90ZSBjaGFyYWN0ZXIuICAqLworCWJyZWFrOworICAgIGVsc2UgaWYgKCpycCA9PSBlc2NhcGVfY2hhcikKKyAgICAgIHsKKwkrK3JwOworCWlmIChxdW90ZV9jaGFyICE9IEwnXDAnICYmICpycCA9PSBxdW90ZV9jaGFyKQorCSAgLyogVGhpcyBpcyBhbiBleHRlbnNpb24gdG8gWFBHLiAgKi8KKwkgICp3cCsrID0gKnJwKys7CisJZWxzZQorCSAgLyogUmVjb2duaXplIGVzY2FwZSBzZXF1ZW5jZXMuICAqLworCSAgc3dpdGNoICgqcnApCisJICAgIHsKKwkgICAgY2FzZSBMJ24nOgorCSAgICAgICp3cCsrID0gTCdcbic7CisJICAgICAgKytycDsKKwkgICAgICBicmVhazsKKwkgICAgY2FzZSBMJ3QnOgorCSAgICAgICp3cCsrID0gTCdcdCc7CisJICAgICAgKytycDsKKwkgICAgICBicmVhazsKKwkgICAgY2FzZSBMJ3YnOgorCSAgICAgICp3cCsrID0gTCdcdic7CisJICAgICAgKytycDsKKwkgICAgICBicmVhazsKKwkgICAgY2FzZSBMJ2InOgorCSAgICAgICp3cCsrID0gTCdcYic7CisJICAgICAgKytycDsKKwkgICAgICBicmVhazsKKwkgICAgY2FzZSBMJ3InOgorCSAgICAgICp3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ICB7CisJCQkgICAgICBFTk9VR0ggKDEpOworCQkJICAgICAgYnVmW2J1ZmFjdCsrXSA9ICp0bXArKzsKKwkJCSAgICB9CisJCQkgIHdoaWxlICgqdG1wICE9ICdcMCcgJiYgKnRtcCAhPSAnLicpOworCQkJfQorCQkgICAgICBicmVhazsKKwkJICAgIGNhc2UgJ2MnOgorCQkgICAgICAvKiBVc2UgY29kZSBzZXQgZWxlbWVudCBvZiBsb2NhbGUgY2F0ZWdvcnkgdmFsdWUuICAqLworCQkgICAgICB0bXAgPSBlbnZfdmFyOworCQkgICAgICBkbworCQkJKyt0bXA7CisJCSAgICAgIHdoaWxlICgqdG1wICE9ICdcMCcgJiYgKnRtcCAhPSAnLicpOworCQkgICAgICBpZiAoKnRtcCA9PSAnLicpCisJCQl7CisJCQkgICsrdG1wOworCQkJICBkbworCQkJICAgIHsKKwkJCSAgICAgIEVOT1VHSCAoMSk7CisJCQkgICAgICBidWZbYnVmYWN0KytdID0gKnRtcCsrOworCQkJICAgIH0KKwkJCSAgd2hpbGUgKCp0bXAgIT0gJ1wwJyk7CisJCQl9CisJCSAgICAgIGJyZWFrOworCQkgICAgY2FzZSAnJSc6CisJCSAgICAgIEVOT1VHSCAoMSk7CisJCSAgICAgIGJ1ZltidWZhY3QrK10gPSAnJSc7CisJCSAgICAgIGJyZWFrOworCQkgICAgZGVmYXVsdDoKKwkJICAgICAgLyogVW5rbm93biB2YXJpYWJsZTogaWdub3JlIHRoaXMgcGF0aCBlbGVtZW50LiAgKi8KKwkJICAgICAgYnVmYWN0ID0gMDsKKwkJICAgICAgd2hpbGUgKCpydW5fbmxzcGF0aCAhPSAnXDAnICYmICpydW5fbmxzcGF0aCAhPSAnOicpCisJCQkrK3J1bl9ubHNwYXRoOworCQkgICAgICBicmVhazsKKwkJICAgIH0KKwkJfQorCSAgICAgIGVsc2UKKwkJeworCQkgIEVOT1VHSCAoMSk7CisJCSAgYnVmW2J1ZmFjdCsrXSA9ICpydW5fbmxzcGF0aCsrOworCQl9CisKKwkgIEVOT1VHSCAoMSk7CisJICBidWZbYnVmYWN0XSA9ICdcMCc7CisKKwkgIGlmIChidWZhY3QgIT0gMCkKKwkgICAgeworCSAgICAgIGZkID0gb3Blbl9ub3RfY2FuY2VsXzIgKGJ1ZiwgT19SRE9OTFkpOworCSAgICAgIGlmIChmZCA+PSAwKQorCQlicmVhazsKKwkgICAgfQorCisJICArK3J1bl9ubHNwYXRoOworCX0KKyAgICB9CisKKyAgLyogQXZvaWQgZGVhbGluZyB3aXRoIGRpcmVjdG9yaWVzIGFuZCBibG9jayBkZXZpY2VzICovCisgIGlmIChfX2J1aWx0aW5fZXhwZWN0IChmZCwgMCkgPCAwKQorICAgIHsKKyAgICAgIGZyZWUgKGJ1Zik7CisgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgIGlmIChfX2J1aWx0aW5fZXhwZWN0IChfX2Z4c3RhdDY0IChfU1RBVF9WRVIsIGZkLCAmc3QpLCAwKSA8IDApCisgICAgZ290byBjbG9zZV91bmxvY2tfcmV0dXJuOworCisgIGlmIChfX2J1aWx0aW5fZXhwZWN0ICghU19JU1JFRyAoc3Quc3RfbW9kZSksIDApCisgICAgICB8fCAoc2l6ZV90KSBzdC5zdF9zaXplIDwgc2l6ZW9mIChzdHJ1Y3QgY2F0YWxvZ19vYmopKQorICAgIHsKKyAgICAgIC8qIGBlcnJubycgaXMgbm90IHNldCBjb3JyZWN0bHkgYnV0IHRoZSBmaWxlIGlzIG5vdCB1c2FibGUuCisJIFVzZSBhbiByZWFzb25hYmxlIGVycm9yIHZhbHVlLiAgKi8KKyAgICAgIF9fc2V0X2Vycm5vIChFSU5WQUwpOworICAgICAgZ290byBjbG9zZV91bmxvY2tfcmV0dXJuOworICAgIH0KKworICBjYXRhbG9nLT5maWxlX3NpemUgPSBzdC5zdF9zaXplOworI2lmZGVmIF9QT1NJWF9NQVBQRURfRklMRVMKKyMgaWZuZGVmIE1BUF9DT1BZCisgICAgLyogTGludXggc2VlbXMgdG8g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jIChzeiArIDEpOworICBtZW1zZXQgKGJ1ZiwgJ0EnLCBzeik7CisgIGJ1Zltzel0gPSAnXDAnOworICBzZXRlbnYgKCJOTFNQQVRIIiwgYnVmLCAxKTsKKworICByZXN1bHQgPSBjYXRvcGVuIChidWYsIE5MX0NBVF9MT0NBTEUpOworICBhc3NlcnQgKHJlc3VsdCA9PSAobmxfY2F0ZCkgLTEpOworCisgIGZyZWUgKGJ1Zik7CisgIHJldHVybiAwOworfQorCisjZGVmaW5lIFJPVU5EUyA1CisKK3N0YXRpYyBpbnQKK2RvX3Rlc3QgKHZvaWQpCit7CisgIGludCBybmQ7CisgIGludCByZXN1bHQgPSAwOworCisgIG10cmFjZSAoKTsKKworICAvKiBXZSBkbyB0aGlzIGEgZmV3IHRpbWVzIHRvIHN0cmVzcyB0aGUgbWVtb3J5IGhhbmRsaW5nLiAgKi8KKyAgZm9yIChybmQgPSAwOyBybmQgPCBST1VORFM7ICsrcm5kKQorICAgIHsKKyAgICAgIG5sX2NhdGQgY2QgPSBjYXRvcGVuICgibGliYyIsIDApOworICAgICAgc2l6ZV90IGNudDsKKworICAgICAgaWYgKGNkID09IChubF9jYXRkKSAtMSkKKwl7CisJICBwcmludGYgKCJjYW5ub3QgbG9hZCBjYXRhbG9nOiAlbVxuIik7CisJICByZXN1bHQgPSAxOworCSAgYnJlYWs7CisJfQorCisgICAgICAvKiBHbyB0aHJvdWdoIGFsbCB0aGUgbWVzc2FnZXMgYW5kIGNvbXBhcmUgdGhlIHJlc3VsdC4gICovCisgICAgICBmb3IgKGNudCA9IDA7IGNudCA8IG5tc2dzOyArK2NudCkKKwl7CisJICBjaGFyICp0cmFuczsKKworCSAgdHJhbnMgPSBjYXRnZXRzIChjZCwgMSwgMSArIGNudCwKKwkJCSAgICIrIysjIGlmIHRoaXMgY29tZXMgYmFja3MgaXQncyBhbiBlcnJvciIpOworCisJICBpZiAodHJhbnMgPT0gTlVMTCkKKwkgICAgeworCSAgICAgIHByaW50ZiAoImNhdG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