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GljbXAtPnR5cGUgPT0gSUNNUF9ST1VURVJTT0xJQ0lUKSkKICAgIHJldHVybjsKICAKICBpZiAoaWNtcC0+Y29kZSAhPSAwKSAKICAgIHsKICAgICAgemxvZ193YXJuICgiSVJEUDogUlggcGFja2V0IHR5cGUgJWQgZnJvbSAlcy4gQmFkIElDTVAgdHlwZSBjb2RlLCIKICAgICAgICAgICAgICAgICAiIHNpbGVudGx5IGlnbm9yZWQiLAogICAgICAgICAgICAgICAgIGljbXAtPnR5cGUsIGluZXRfbnRvYSAoc3JjKSk7CiAgICAgIHJldHVybjsKICAgIH0KCiAgaWYgKCEgKChudG9obCAoaXAtPmlwX2RzdC5zX2FkZHIpID09IElOQUREUl9CUk9BRENBU1QpCiAgICAgICAgICYmIChpcmRwLT5mbGFncyAmIElGX0JST0FEQ0FTVCkpCiAgICAgICAgfHwKICAgICAgICAobnRvaGwgKGlwLT5pcF9kc3Quc19hZGRyKSA9PSBJTkFERFJfQUxMUlRSU19HUk9VUAogICAgICAgICAmJiAhKGlyZHAtPmZsYWdzICYgSUZfQlJPQURDQVNUKSkpCiAgICB7CiAgICAgIHpsb2dfd2FybiAoIklSRFA6IFJYIGlsbGVnYWwgZnJvbSAlcyB0byAlcyB3aGlsZSAlcyBvcGVyYXRlcyBpbiAlc1xuIiwKICAgICAgICAgICAgICAgICBpbmV0X250b2EgKHNyYyksCiAgICAgICAgICAgICAgICAgbnRvaGwgKGlwLT5pcF9kc3Quc19hZGRyKSA9PSBJTkFERFJfQUxMUlRSU19HUk9VUCA/CiAgICAgICAgICAgICAgICAgIm11bHRpY2FzdCIgOiBpbmV0X250b2EgKGlwLT5pcF9kc3QpLAogICAgICAgICAgICAgICAgIGlmcC0+bmFtZSwKICAgICAgICAgICAgICAgICBpcmRwLT5mbGFncyAmIElGX0JST0FEQ0FTVCA/ICJicm9hZGNhc3QiIDogIm11bHRpY2FzdCIpOwoKICAgICAgemxvZ193YXJuICgiSVJEUDogUGxlYXNlIGNvcnJlY3Qgc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