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HN0YXQpCisJCQlyZXR1cm4gc3RyZXJyb3IobmZzX2VycnRibFtpXS5lcnJudW0pOworCX0KKwlzcHJpbnRmKGJ1ZiwgXygidW5rbm93biBuZnMgc3RhdHVzIHJldHVybiB2YWx1ZTogJWQiKSwgc3RhdCk7CisJcmV0dXJuIGJ1ZjsKK30KKworI2lmIDAKK2ludAorbXlfZ2V0cG9ydChzdHJ1Y3QgaW5fYWRkciBzZXJ2ZXIsIHN0cnVjdCB0aW1ldmFsICp0aW1lbywgLi4uKQoreworICAgICAgICBzdHJ1Y3Qgc29ja2FkZHJfaW4gc2luOworICAgICAgICBzdHJ1Y3QgcG1hcCAgICAgcG1hcDsKKyAgICAgICAgQ0xJRU5UICAgICAgICAgICpjbG50OworICAgICAgICBpbnQgICAgICAgICAgICAgc29jayA9IFJQQ19BTllTT0NLLCBwb3J0OworCisgICAgICAgIHBtYXAucG1fcHJvZyA9IHByb2c7CisgICAgICAgIHBtYXAucG1fdmVycyA9IHZlcnM7CisgICAgICAgIHBtYXAucG1fcHJvdCA9IHByb3Q7CisgICAgICAgIHBtYXAucG1fcG9ydCA9IDA7CisgICAgICAgIHNpbi5zaW5fZmFtaWx5ID0gQUZfSU5FVDsKKyAgICAgICAgc2luLnNpbl9hZGRyID0gc2VydmVyOworICAgICAgICBzaW4uc2luX3BvcnQgPSBodG9ucygxMTEpOworICAgICAgICBjbG50ID0gY2xudHVkcF9jcmVhdGUoJnNpbiwgMTAwMDAwLCAyLCAqdGltZW8sICZzb2NrKTsKKyAgICAgICAgc3RhdHVzID0gY2xudF9jYWxsKGNsbnQsIFBNQVBfR0VUUE9SVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJnBtYXAsICh4ZHJwcm9jX3QpIHhkcl9wbWFwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmcG9ydCwgKHhkcnByb2NfdCkgeGRyX3VpbnQpOworICAgICAgICBpZiAoc3RhdHVzICE9IFNVQ0NFU1MpIHsKKwk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zdCAqCittb3VudHByb2NfZHVtcF8yKGFyZ3AsIGNsbnQpCisJdm9pZCAqYXJncDsKKwlDTElFTlQgKmNsbnQ7Cit7CisJc3RhdGljIG1vdW50bGlzdCBjbG50X3JlczsKKworCW1lbXNldCgoY2hhciAqKSZjbG50X3JlcywgMCwgc2l6ZW9mKGNsbnRfcmVzKSk7CisJaWYgKGNsbnRfY2FsbChjbG50LCBNT1VOVFBST0NfRFVNUCwgKHhkcnByb2NfdCkgeGRyX3ZvaWQsIGFyZ3AsCisJCSAgICAgICh4ZHJwcm9jX3QpIHhkcl9tb3VudGxpc3QsIChjYWRkcl90KSAmY2xudF9yZXMsCisJCSAgICAgIFRJTUVPVVQpICE9IFJQQ19TVUNDRVNTKSB7CisJCXJldHVybiAoTlVMTCk7CisJfQorCXJldHVybiAoJmNsbnRfcmVzKTsKK30KKwordm9pZCAqCittb3VudHByb2NfdW1udF8yKGFyZ3AsIGNsbnQpCisJZGlycGF0aCAqYXJncDsKKwlDTElFTlQgKmNsbnQ7Cit7CisJc3RhdGljIGNoYXIgY2xudF9yZXM7CisKKwltZW1zZXQoKGNoYXIgKikmY2xudF9yZXMsIDAsIHNpemVvZihjbG50X3JlcykpOworCWlmIChjbG50X2NhbGwoY2xudCwgTU9VTlRQUk9DX1VNTlQsICh4ZHJwcm9jX3QpIHhkcl9kaXJwYXRoLAorCQkgICAgICAoY2FkZHJfdCkgYXJncCwgKHhkcnByb2NfdCkgeGRyX3ZvaWQsCisJCSAgICAgIChjYWRkcl90KSAmY2xudF9yZXMsIFRJTUVPVVQpICE9IFJQQ19TVUNDRVNTKSB7CisJCXJldHVybiAoTlVMTCk7CisJfQorCXJldHVybiAoKHZvaWQgKikmY2xudF9yZXMpOworfQorCit2b2lkICoKK21vdW50cHJvY191bW50YWxsXzIoYXJncCwgY2xudCkKKwl2b2lkICphcmdwOworCUNMSUVOVCAqY2xudDsKK3sKKwlzdGF0aWMgY2hhciBjbG50X3JlczsKKworCW1lbXNldCgoY2hhci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