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lIGNvZGUsIgogICAgICAgICAgICAgICAgICIgc2lsZW50bHkgaWdub3JlZCIsCiAgICAgICAgICAgICAgICAgaWNtcC0+dHlwZSwgaW5ldF9udG9hIChzcmMpKTsKICAgICAgcmV0dXJuOwogICAgfQoKICBpZiAoISAoKG50b2hsIChpcC0+aXBfZHN0LnNfYWRkcikgPT0gSU5BRERSX0JST0FEQ0FTVCkKICAgICAgICAgJiYgKGlyZHAtPmZsYWdzICYgSUZfQlJPQURDQVNUKSkKICAgICAgICB8fAogICAgICAgIChudG9obCAoaXAtPmlwX2RzdC5zX2FkZHIpID09IElOQUREUl9BTExSVFJTX0dST1VQCiAgICAgICAgICYmICEoaXJkcC0+ZmxhZ3MgJiBJRl9CUk9BRENBU1QpKSkKICAgIHsKICAgICAgemxvZ193YXJuICgiSVJEUDogUlggaWxsZWdhbCBmcm9tICVzIHRvICVzIHdoaWxlICVzIG9wZXJhdGVzIGluICVzXG4iLAogICAgICAgICAgICAgICAgIGluZXRfbnRvYSAoc3JjKSwKICAgICAgICAgICAgICAgICBudG9obCAoaXAtPmlwX2RzdC5zX2FkZHIpID09IElOQUREUl9BTExSVFJTX0dST1VQID8KICAgICAgICAgICAgICAgICAibXVsdGljYXN0IiA6IGluZXRfbnRvYSAoaXAtPmlwX2RzdCksCiAgICAgICAgICAgICAgICAgaWZwLT5uYW1lLAogICAgICAgICAgICAgICAgIGlyZHAtPmZsYWdzICYgSUZfQlJPQURDQVNUID8gImJyb2FkY2FzdCIgOiAibXVsdGljYXN0Iik7CgogICAgICB6bG9nX3dhcm4gKCJJUkRQOiBQbGVhc2UgY29ycmVjdCBzZXR0aW5nc1xuIik7CiAgICAgIHJldHVybjsKICAgIH0KCiAgc3dpdGNoIChpY21wLT50eXBlKSAKICAgIHsKICAgIGNhc2UgSUNNUF9ST1VURVJBRFZFUlQ6CiAgICAgIGJyZWFrOwoKICAgIGNhc2UgSUNNUF9ST1VURVJTT0xJQ0lUOgoKICAgICAgaWYoaXJkcC0+Zmx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