Let manifold $M$, and let a Morse function $f:M \to \mathbb{R}$ the answer to my question follows from Morse theory. For fixed $f$ the manifold then decomposes as for example here.
Now, what happens if I am forced to use smooth function to $\mathbb{R}^n$, namely I consider $$\widetilde{f}:M \to \mathbb{R}^n$$
I am not an expert in topology (to say the least) but am interested in the link between the image of a given $\widetilde{f}$ and topology of $M$.
Any comments \ references are welcome!