Let $M$ be a differential manifold and let $f:M\to \mathbb{R}$ be a $C^{\infty}$ function such that there are exactly two points $x$ which satisfy $d_xf=0$. Let $p$ and $q$ those two points, and suppose that $f(p)=f(q)$. Prove that there is another $C^{\infty}$ function $g:M\to \mathbb{R}$ such that $p$ and $q$ are the only critical points but $g(p)\neq g(q)$.
I have been trying to solve this problem but I cannot come up with a solution. Clearly we can suppose $f(p)\neq 0$, so I intended to separate (by the $T2$ property) $p$ and $q$ with two open subsets $U$ and $V$, and letting $W$ an open set such that $p\in W\subseteq \overline{W}\subset U$ and $\overline{W}$ compact. Then I intended to make use either of a bump function or partition of unity, but I could not succeed.
How would you solve the problem?