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orI2luY2x1ZGUgPHN0ZGxpYi5oPg0KKyNpbmNsdWRlIDxwdGhyZWFkLmg+DQorI2luY2x1ZGUgPHN5cy9wcmN0bC5oPg0KKyNpbmNsdWRlIDxzeXMvaXBjLmg+DQorI2luY2x1ZGUgPGVycm5vLmg+DQorDQorI2luY2x1ZGUgImF0cmVnX2NvbW1vbi5oIg0KKyNpbmNsdWRlICJtZXNzYWdlLmgiDQorI2luY2x1ZGUgInNvZnRhcF9sb2cuaCINCisjaW5jbHVkZSAiYXRyZWdfbXNnLmgiDQorDQorDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFjcm8gZGVmaW5pdGlvbnMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKg0KKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwkNCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkJCSAgICAgICBUeXBlIGRlZmluaXRpb25zCQkJCQkgICAgICAgICAgIAkgICAqDQorICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovDQorDQorDQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCisgKiAJCQkJCSAgICAgIExvY2FsIHZhcmlhYmxlIGRlZmluaXRpb25zCQkJCQkJICAgKg0KKyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLw0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorICoJCQkJCQkgIEdsb2JhbCB2YXJpYWJsZSBkZWZpbml0aW9ucwkJCQkJCSAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkJICAgICBMb2NhbCBmdW5jdGlvbiBkZWNsYXJhdGlvbnMgCQkgICAgIAkJCSAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisNCisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqIAkJCQkgICAgICAgIExvY2FsIGZ1bmN0aW9uIGltcGxlbWVudGF0aW9ucwkJICAgCQkJCSAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCitzdGF0aWMgdm9pZCBhdHJlZ19zZXJfcmVnaXN0X3JzcF9wcm9jKHN0cnVjdCBhdHJlZ19tc2dfdCAqcGF0cmVnX21zZ2RhdGEpDQorew0KKwlzdHJ1Y3QgYXRyZWdfc2VyX2luc3RhbmNlX3QgKnBhdHJlZ19zZXJfaW5zdGFuY2UgPSBOVUxMOw0KKwkNCisJaWYgKDAgPT0gcGF0cmVnX21zZ2RhdGEtPnJlcykgew0KKwkJcGF0cmVnX3Nlcl9pbnN0YW5jZSA9IChzdHJ1Y3Qg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19wcm9jIHRoZSBtc2cgaXMgTlVMTCFcbiIpOw0KKwkJcmV0dXJuOw0KKwl9ICAgDQorDQorCXN3aXRjaChtc2ctPnVzTXNnQ21kKSB7DQorCQljYXNlIE1TR19DTURfQVRfUkVHX1JTUDoNCisJCQlhdHJlZ19yZWdpc3RfcnNwX3Byb2MobXNnLT5hdWNEYXRhQnVmKTsNCisJCQlicmVhazsNCisNCisJCWNhc2UgTVNHX0NNRF9BVF9VTlJFR19SU1A6DQorCQkJYXRyZWdfdW5yZWdpc3RfcnNwX3Byb2MobXNnLT5hdWNEYXRhQnVmKTsNCisJCQlicmVhazsNCisJCQkNCisJCWRlZmF1bHQ6DQorCQkJYXRyZWdfY2JfcHJvYyhtc2ctPnVzTXNnQ21kLCBtc2ctPmF1Y0RhdGFCdWYpOwkNCisJCQlicmVhazsNCisJfQ0KKw0KKwlyZXR1cm47DQorfQ0KKw0KKw0KKy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqDQorICogCQkJCQkgICAgR2xvYmFsIGZ1bmN0aW9uIGltcGxlbWVudGF0aW9ucwkJCQkJCSAgICoNCisgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8NCisvKioguMPP37PMtLS9qNauuvOjrL2rsru74c3Ls/YgKi8NCit2b2lkIGF0cmVnX21zZ190aHJlYWRfZW50cnkodm9pZCAqYXJnKQ0KK3sJDQorCXN0cnVjdCBhdHJlZ19jb21tb25fY29udGV4dF90ICpwYXRyZWdfY29tbW9uX2N0eCA9IChzdHJ1Y3QgYXRyZWdfY29tbW9uX2NvbnRleHRfdCAqKWFyZzsNCisJaW50IGltc2dxID0gLTE7DQorCWludCBpcmV0ID0gMDsNCisJTVNHX0JVRiBtc2didWY7DQorCWxvbmcgbXNnc2l6ZSA9ICBzaXplb2YoTVNHX0J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