\[ \text{One way to buzzkill this proof is to actually recall that}\\ \boxed{\int (ax+b)^n\,dx = \frac{(ax+b)^{n+1}}{a(n+1)}+C}. \]
\begin{align*} \frac{d}{dx} \left( \frac{v^2}{2}\right) &= -n^2 (x-c)\\ \frac{v^2}{2} &= \frac{-n^2(x-c)^2}{2} + \frac{C}{2}\\ v^2 &= -n^2(x-c)^2+C \end{align*}
\[ \text{Recall that in SHM, }v=0\text{ when the particle is at its endpoints.}\\ \text{For a particle with centre of motion }c\text{ and amplitude }a,\\ \text{the endpoints of motion will be }x=c-a\text{ and }x=c+a.\]
\[ \text{Using either of these will then give}\\ 0 = -n^2a^2+C \implies \boxed{C=n^2a^2}. \]
\[ \text{Hence }v^2= -n^2(x-c)^2 + n^2a^2 = -n^2\left(a^2-(x-c)^2 \right)\]
Note that the proof should still work if we ordinarily integrate and get \( \frac{v^2}{2} = -n^2 \left( \frac{x^2}{2} - cx \right) \). My hunch, however, is that some completing the square would be needed later if we go down this route.