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vKiBKb2luIHRvIHRoZSBhZGQvbGVhdmUgbXVsdGljYXN0IGdyb3VwLiAqLworaW50IGlmX2dyb3VwIChzdHJ1Y3QgaW50ZXJmYWNlICppZnAsIAorCSAgaW50IHNvY2ssIAorCSAgdV9pbnQzMl90IGdyb3VwLCAKKwkgIGludCBhZGRfbGVhdmUpCit7CisgIHN0cnVjdCB6ZWJyYV9pZiAqemk7CisgIHN0cnVjdCBpcF9tcmVxIG07CisgIHN0cnVjdCBwcmVmaXggKnA7CisgIGludCByZXQ7CisKKyAgemkgPSBpZnAtPmluZm87CisKKyAgYnplcm8gKCZtLCBzaXplb2YgKG0pKTsKKyAgbS5pbXJfbXVsdGlhZGRyLnNfYWRkciA9IGh0b25sIChncm91cCk7CisgIHAgPSBpcmRwX2dldF9wcmVmaXgoaWZwKTsKKworICBpZighcCkgeworICAgICAgICB6bG9nX3dhcm4gKCJJUkRQOiBjYW4ndCBnZXQgYWRkcmVzcyBmb3IgJXMiLCBpZnAtPm5hbWUpOworCXJldHVybiAxOworICB9CisKKyAgbS5pbXJfaW50ZXJmYWNlID0gcC0+dS5wcmVmaXg0OworCisgIHJldCA9IHNldHNvY2tvcHQgKHNvY2ssIElQUFJPVE9fSVAsIGFkZF9sZWF2ZSwKKwkJICAgIChjaGFyICopICZtLCBzaXplb2YgKHN0cnVjdCBpcF9tcmVxKSk7CisgIGlmIChyZXQgPCAwKQorICAgIHpsb2dfd2FybiAoIklSRFA6ICVzIGNhbid0IHNldHNvY2tvcHQgJXM6ICVzIiwKKwkgICAgICAgYWRkX2xlYXZlID09IElQX0FERF9NRU1CRVJTSElQPyAiam9pbiBncm91cCI6ImxlYXZlIGdyb3VwIiwgCisgICAgICAgICAgICAgICBpbmV0XzJhKGdyb3VwLCBiMSksCisgICAgICAgICAgICAgICBzdHJlcnJvciAoZXJybm8pKTsKKworICByZXR1cm4gcmV0OworfQorCitpbnQgaWZfYWRkX2dyb3VwIChzdHJ1Y3QgaW50ZXJmYWNlICppZnApCit7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FkdmVydEludGVydmFsLCBWVFlfTkVXTElORSk7CisKKyAgICB2dHlfb3V0ICh2dHksICIgaXAgaXJkcCBtYXhhZHZlcnRpbnRlcnZhbCAlbGQlcyIsICAKKwkgICAgIGlyZHAtPk1heEFkdmVydEludGVydmFsLCBWVFlfTkVXTElORSk7CisKKyAgfQorfQorCisKK0RFRlVOIChpcF9pcmRwX211bHRpY2FzdCwKKyAgICAgICBpcF9pcmRwX211bHRpY2FzdF9jbWQsCisgICAgICAgImlwIGlyZHAgbXVsdGljYXN0IiwKKyAgICAgICBJUF9TVFIKKyAgICAgICAiSUNNUCBSb3V0ZXIgZGlzY292ZXJ5IG9uIHRoaXMgaW50ZXJmYWNlIHVzaW5nIG11bHRpY2FzdFxuIikKK3sKKyAgc3RydWN0IGludGVyZmFjZSAqaWZwOworCisgIGlmcCA9IChzdHJ1Y3QgaW50ZXJmYWNlICopIHZ0eS0+aW5kZXg7CisgIGlmKCFpZnApIHsKKwkgIHJldHVybiBDTURfV0FSTklORzsKKyAgfQorCisgIGlyZHBfaWZfc3RhcnQoaWZwLCBUUlVFLCBUUlVFKTsKKyAgcmV0dXJuIENNRF9TVUNDRVNTOworfQorCitERUZVTiAoaXBfaXJkcF9icm9hZGNhc3QsCisgICAgICAgaXBfaXJkcF9icm9hZGNhc3RfY21kLAorICAgICAgICJpcCBpcmRwIGJyb2FkY2FzdCIsCisgICAgICAgSVBfU1RSCisgICAgICAgIklDTVAgUm91dGVyIGRpc2NvdmVyeSBvbiB0aGlzIGludGVyZmFjZSB1c2luZyBicm9hZGNhc3RcbiIpCit7CisgIHN0cnVjdCBpbnRlcmZhY2UgKmlmcDsKKworICBpZnAgPSAoc3RydWN0IGludGVyZmFjZSAqKSB2dHktPmluZGV4OworICBpZighaWZwKSB7CisJICByZXR1cm4gQ01EX1dBUk5JTkc7CisgIH0KKworICBpcmRwX2lmX3N0YXJ0KGlmcCwgRkFMU0UsIFRSVUUpOworICByZXR1cm4gQ01EX1NVQ0NFU1M7Cit9CisKK0RFRlVOIChpcF9pcmRwX25vLAorICAgICAgIGlwX2lyZHBfY21kX25vLAorICAgICAgICJubyBpcCBpcmRwIiwKKyAgICAgICBJUF9TVFIKKyAgICAgICAiRGlzYWJsZSBJQ01QIFJvdXRlciBkaXNjb3Zlcnkgb24gdGhpcyBpbnRlcmZhY2VcbiIpCit7CisgIHN0cnVjdCBpbnRlcmZhY2UgKmlmcDsKKworICBpZnAgPSAoc3RydWN0IGludGVyZmFjZSAqKSB2dHktPmluZGV4OworICBpZighaWZwKSB7CisJICByZXR1cm4gQ01EX1dBUk5JTkc7CisgIH0KKworICBpcmRwX2lmX3N0b3AoaWZwKTsKKyAgcmV0dXJuIENNRF9TVUNDRVNTOworfQorCitERUZVTiAoaXBfaXJkcF9zaHV0ZG93biwKKyAgICAgICBpcF9pcmRwX3NodXRkb3duX2NtZCwKKyAgICAgICAiaXAgaXJkcCBzaHV0ZG93biIsCisgICAgICAgSVBfU1RSCisgICAgICAgIklDTVAgUm91dGVyIGRpc2NvdmVyeSBzaHV0ZG93biBvbiB0aGlzIGludGVyZmFjZVxuIikKK3sKKyAgc3RydWN0IGludGVyZmFjZSAqaWZwOworCisgIGlmcCA9IChzdHJ1Y3QgaW50ZXJmYWNlICopIHZ0eS0+aW5kZXg7CisgIGlmKCFpZnApIHsKKwkgIHJldHVybiBDTURfV0FSTklORzsKKyAgfQorCisgIGlyZHBfaWZfc2h1dGRvd24oaWZwKTsKKyAgcmV0dXJuIENNRF9TVUNDRVNTOworfQorCitERUZVTiAoaXBfaXJkcF9ub19zaHV0ZG93biwKKyAgICAgICBpcF9pcmRwX25vX3NodXRkb3duX2NtZCwKKyAgICAgICAibm8gaXAgaXJkcCBzaHV0ZG93biIsCisgICAgICAgSVBfU1RSCisgICAgICAgIklDTVAgUm91dGVyIGRpc2NvdmVyeSBubyBzaHV0ZG93biBvbiB0aGlzIGludGVyZmFjZVxuIikKK3sKKyAgc3RydWN0IGludGVyZmFjZSAqaWZwOworCisgIGlmcCA9IChzdHJ1Y3QgaW50ZXJmYWNlICopIHZ0eS0+aW5kZXg7CisgIGlmKCFpZnApIHsKKwkgIHJldHVybiBDTURfV0FSTklORzsKKyAgfQorCisgIGlyZHBfaWZfbm9fc2h1dGRvd24oaWZwKTsKKyAgcmV0dXJuIENNRF9TVUNDRVNTOworfQorCitERUZVTiAoaXBfaXJkcF9ob2xkdGltZSwKKyAgICAgICBpcF9pcmRwX2hvbGR0aW1lX2NtZCwKKyAgICAgICAiaXAgaXJkcCBob2xkdGltZSA8MC05MDAwPiIsCisgICAgICAgSVBfU1RSCisgICAgICAgIklDTVAgUm91dGVyIGRpc2NvdmVyeSBvbiB0aGlzIGludGVyZmFjZVxuIgorICAgICAgICJTZXQgaG9sZHRpbWUgdmFsdWVcbiIKKyAgICAgICAiSG9sZHRpbWUgdmFsdWUgaW4gc2Vjb25kcy4gRGVmYXVsdCBpcyAxODAwIHNlY29uZHNcbiIpCit7CisgIHN0cnVjdCBpbnRlcmZhY2UgKmlmcDsKKyAgc3RydWN0IHplYnJhX2lmICp6aTsKKyAgc3RydWN0IGlyZHBfaW50ZXJmYWNlICppcmRwOworICBpZnAgPSAoc3RydWN0IGludGVyZmFjZSAqKSB2dHktPmluZGV4OworICBpZighaWZwKSB7CisJICByZXR1cm4gQ01EX1dBUk5JTkc7CisgIH0KKworICB6aT1pZnAtPmluZm87CisgIGlyZHA9JnppLT5pcmRwOworCisgIGlyZHAtPkxpZmV0aW1lID0gYXRvaShhcmd2WzBdKTsKKyAgcmV0dXJuIENNRF9TVUNDRVNTOworfQorCitERUZVTiAoaXBfaXJkcF9taW5hZHZlcnRpbnRlcnZhbCwKKyAgICAgICBpcF9pcmRwX21pbmFkdmVydGludGVydmFsX2NtZCwKKyAgICAgICAiaXAgaXJkcCBtaW5hZHZlcnRpbnRlcnZhbCA8My0xODAwPiIsCisgICAgICAgSVBfU1RSCisgICAgICAgIklDTVAgUm91dGVyIGRpc2NvdmVyeSBvbiB0aGlzIGludGVyZm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