How to define the "nice" contour of a "nice" two-dimensional differential surface Suppose I have a smooth function $f(x,y)$ defined on $(0,\infty)\times(0,\infty)$ (for instance, you can assume that $f(x,y)$ is $C^1$ or even $C^2$). It is "nice", in the sense that there is a constant $c>0$, and for all $x>0$
$$
f(x,0^+) = \lim_{y\rightarrow 0^+}f(x,y)\geq c, f(x,\infty) = \lim_{y\rightarrow \infty} f(x,y) = -\infty.
$$
Now I define a set
$$
S = \{(x,y):f(x,y) < 0\}.
$$
Then we can see that for any $(x,y)\in \partial S$, $f(x,y) = 0$. Moreover, it seems that there is a "nice" subset $L$ of the boundary, such that the points on $L$ are on a parametrized curve
$$
L = \{(\phi_1(t),\phi_2(t)):t\in (-T,\infty)\},
$$ 
and there is a finite $t_0$,
$$
\phi_1(t) \rightarrow 0,\ \phi_2(t) \rightarrow y_0>0, \ {\rm as}\ t\rightarrow t_0
$$
and
$$
\phi_1(t)\rightarrow \infty,\ {\rm as}\ t\rightarrow +\infty.
$$
My question is, can we define such a subset $L$ of the boundary rigorously based on $f(x,y)$ itself? An example of $L$ is shown in the picture, where the shaded area is $S$, and the red curve is the subset $L$ of boundary I wanted.

My thoughts: It seems that we can "pick" the connected component $K$ which is connected to $\{(x,\infty):x\in (0,\infty)\}$, and then we "fill in" the blank area in $K$ to make $K$ simple connected. Then $L$ can be defined as $\partial K$. But I am not sure how to rigorously define two operations "pick" and "fill in", and how to rigorously show that $L$ can be parametrized in the way described above.
Here "rigorously" means that in a way that is well accepted by the academic community of mathematicians.^_^
Thanks in advance for any help! 
 A: To elaborate on the nice comments above: You should probably assume that $f$ is transverse to zero, else you could build an example where $f^{-1}(0)$ has positive measure. An important tool here is Sard's theorem, which if I recall correctly, states that you can make an arbitrarily small smooth perturbation of $f$ that is in fact transverse to zero.
If $f$ is transverse to zero, then indeed $f^{-1}(0)$ is a submanifold. This follows from the implicit function theorem, which is used to construct submanifold charts. That is to say, about each point $(x,y)\in f^{-1}(0)$, there exists some small neighborhood $U$ such that within $U$, the set $f^{-1}(0)$ is the graph of a smooth function of $x$ or $y$.
Once you have that $f^{-1}(0)$ is a submanifold you can pick a single connected component, which is homeomorphic to the either a circle or a line. This will be your red line in the picture. Of course such submanifolds can be parametrized, which gives your $\phi_1, \phi_2$ such that $f(\phi_1(t),\phi_2(t)) = 0$ for $t>0$.
