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zIixwb2ludGVyX3RtcF9zdGFydCk7CgkvL3N0cm5jcHkoc3RyX3RtcCwgcG9pbnRlcl90bXBfc3RhcnQsIChpbnQpKGlwYWRkciArIGlwYWRkcl9sZW4gLSBwb2ludGVyX3RtcF9zdGFydCkpOwoJbnVtID0gYXRvaShzdHJfdG1wKTsKCWlmIChudW0gPCAwIHx8IG51bSA+IDI1NSkgewoJCXJldHVybiAwOwoJfQoJcmV0dXJuIDE7Cn0KCi8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0vLwovL7n6tedzb2NrZXS3vbC4uq/K/cq1z9bH+AovLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ly8KLyoKIGF0K215bmV0c3J2PTEsMiwyLDAsIjE5Mi4xNjguMzAuMjAxOjUxMDChsQoqLwppbnQgZXh0X25ldHNydl9yZXEoaW50IGF0X2ZkLCBjaGFyICphdF9wYXJhcywgdm9pZCAqKiByZXNfbXNnLCBpbnQgKnJlc19tc2dsZW4pCnsKCXN0cnVjdCBuZXRzcnZfbXNnICAqc3J2ID0gbWFsbG9jKHNpemVvZihzdHJ1Y3QgbmV0c3J2X21zZykpOwoJYXNzZXJ0KHNydik7CgljaGFyICogcG9zX2NvbG9uID0gTlVMTDsKCWNoYXIgKiBwb3J0ID0gTlVMTDsKCWNoYXIgKmF0X3N0ciA9IE5VTEw7CgljaGFyICpwWzVdID0geyZzcnYtPmNoX2lkLCAmc3J2LT5zb2NrZXRpZCwgJnNydi0+Y29ubl90eXBlLCAmc3J2LT52aWV3TW9kZSwgc3J2LT5pcHBvcnR9OwogICAgY2hhciAqYyA9IE5VTEw7CiAgICBjaGFyIGlwcG9ydFsxMjhdOwoJbWVtc2V0KHNyd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