*end will always != p because either p == *end - 1 or p == pc <= *end - 2. I also don't think we need to even have p in this algorithm. We could probably make due with just pc.