I have a smooth function, say $f: \mathbb R \rightarrow \mathbb R$, such that $f' \rightarrow 1$ as $x \rightarrow \infty$ but there is a neighbourhood of zero in which $f' < 0$, possibly with a singularity (e.g. $-\sqrt{x}$). Is there a way to "flatten" the function in a neighbourhood of zero but keep its behaviour at infinity?
For instance, the function in my head looks like:
$$ F(x) = \begin{cases} 1, &|x| < R_1 \\ g, &R_1 \leq |x| < R_2 \\ f, &|x| \geq R_2. \end{cases} $$
So $F'$ is zero where $f' < 0$, has the behaviour of $f'$ at infinity, and should have behaviour "close to" the behaviour of $f'$ in between. In particular I would like $\inf F'$ close to $0$ if possible (since $f' \rightarrow 1$ and $F' = 0$ in a neighbourhood of zero) or at least $\inf F' = -\epsilon$ for some arbitrarily small $\epsilon$.
In my mind $g$ is some sort of slow interpolation (e.g. $t/C \times f + (1 - t/C)$ for some large constant $C$) between $1$ and $f$. My question is: does there exist a smooth function $F$ which has derivatives (possibly uniformly) controlled by $f$? I'm not sure how to make this intuition into an actual smooth function and estimate the derivative near the endpoints/whether this intuition is actually correct. (I also feel this might be a known result/common construction so perhaps someone knows.)
EDIT: I think I gave the wrong impression with the idea of "bad". I have edited the question to be a bit more precise, sorry.
You can use a partition of unity to make such a function $F$. More precisely, let $\{\psi_1,\psi_2\}$ be a smooth partition of unity subordinate to the cover $U_1=(-2,2),U_2=\mathbb R\smallsetminus[-1,1]$ of $\mathbb R$. The important point is that $\psi_1,\psi_2$ take values in $[0,1]$, $\psi_1(x)+\psi_2(x)=1$ for each $x\in \mathbb R$, and $\mathrm{supp} (\psi_j)\subset U_j$ for each $j = 1,2$. In particular, $\psi_2(x) = 1$ when $|x|>2$ and $\psi_2(x) = 0$ when $|x|<1$.
Setting $F(x) = f(x)\psi_2(x)$ gives the desired function since $F'(x) = 0$ for $|x|<1/2$ and $F'(x) = f'(x)$ for $|x|>3$. The graph of $F(x)$ agrees with the graph of $f(x)$ for $|x|>2$ and it smoothly flattens out and equals $0$ in a neighborhood of $0$.
A similar definition $F(x) = f(x)\psi_2(x) + g(x)\psi_1(x)$ for any function $g(x)$ gives a function which agrees with $f(x)$ for all large values of $x$ and that agrees with $g(x)$ for all small values of $x$.
Here is a wiki page where you can read more about partitions of unity. They are a standard and important construction in mathematics.