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