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BlID09IElDTVBfUk9VVEVSQURWRVJUCiAgICAgICAgfHwgaWNtcC0+dHlwZSA9PSBJQ01QX1JPVVRFUlNPTElDSVQpKQogICAgcmV0dXJuOwogIAogIGlmIChpY21wLT5jb2RlICE9IDApIAogICAgewogICAgICB6bG9nX3dhcm4gKCJJUkRQOiBSWCBwYWNrZXQgdHlwZSAlZCBmcm9tICVzLiBCYWQgSUNNUCB0eXBlIGNvZGUsIgogICAgICAgICAgICAgICAgICIgc2lsZW50bHkgaWdub3JlZCIsCiAgICAgICAgICAgICAgICAgaWNtcC0+dHlwZSwgaW5ldF9udG9hIChzcmMpKTsKICAgICAgcmV0dXJuOwogICAgfQoKICBpZiAoISAoKG50b2hsIChpcC0+aXBfZHN0LnNfYWRkcikgPT0gSU5BRERSX0JST0FEQ0FTVCkKICAgICAgICAgJiYgKGlyZHAtPmZsYWdzICYgSUZfQlJPQURDQVNUKSkKICAgICAgICB8fAogICAgICAgIChudG9obCAoaXAtPmlwX2RzdC5zX2FkZHIpID09IElOQUREUl9BTExSVFJTX0dST1VQCiAgICAgICAgICYmICEoaXJkcC0+ZmxhZ3MgJiBJRl9CUk9BRENBU1QpKSkKICAgIHsKICAgICAgemxvZ193YXJuICgiSVJEUDogUlggaWxsZWdhbCBmcm9tICVzIHRvICVzIHdoaWxlICVzIG9wZXJhdGVzIGluICVzXG4iLAogICAgICAgICAgICAgICAgIGluZXRfbnRvYSAoc3JjKSwKICAgICAgICAgICAgICAgICBudG9obCAoaXAtPmlwX2RzdC5zX2FkZHIpID09IElOQUREUl9BTExSVFJTX0dST1VQID8KICAgICAgICAgICAgICAgICAibXVsdGljYXN0IiA6IGluZXRfbnRvYSAoaXAtPmlwX2RzdCksCiAgICAgICAgICAgICAgICAgaWZwLT5uYW1lLAogICAgICAgICAgICAgICAgIGlyZHAtPmZsYWdzICYgSUZfQlJPQURDQVNUID8gImJyb2FkY2FzdCIgOiAibXVsdGljYXN0Iik7CgogICAgICB6bG9nX3dhcm4gKCJJUk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