Differentiability of the maximum For $i=1,\ldots,n$, let $f_i\colon(0,\infty)\to(0,1)$ and $g_i\colon(0,\infty)\to(0,1)$ be $C^{\infty}$ functions. 
Define $h\colon(0,\infty)\to(0,\infty)$ as follows:
$$h(t)=\max_{i=1,\ldots,n} \frac{f_i(t)}{g_i(t)}\qquad \forall t\in(0,\infty).$$
I am wondering if the following is true:

The function $h$ is differentiable almost everywhere, and there exists $f,g\colon(0,\infty)\to(0,1)$ differentiable almost everywhere such that $h(t)=\frac{f(t)}{g(t)}$ for every $t\in (0,\infty)$.

I am pretty sure it is true, but I would like to have confirmation (and, if possible, a reference).
This question is quite related however it is not exactly the same. Still the answer of @Alex R. seems to confirm my belief that the affirmation is indeed true.
Note: I don't know if it helps, but the case I am interested in have the additional properties that $h$ is strictly decreasing, $\lim_{t\to 0}h(t)=\infty$ and $\lim_{t\to \infty}h(t)=1$.
 A: As it stands you may just assume $f_i(t)>0$, and define
$$h(t):=\max_{1\leq i\leq n} f_i(t)\ .$$
For most $t_0$ there will be an  $i_0$ such that $f_{i_0}(t_0)>f_i(t_0)$ for all $i\ne i_0$. It follows that $h(t)=f_{i_0}(t)$ for all $t$ in a full neighborhood $U$ of $t_0$, hence $h\in C^\infty(U)$.
I don't know about the control you have over the "critical set"
$$C:=\bigl\{t>0\,\bigm|\,\exists i, j: \ i\ne j\ \wedge\  f_i(t)=f_j(t)\bigr\}\ .$$
If this set is, e.g., finite the function $h$ will be continuous and piecewise smooth. In order to see what's happening at points of $C$ consider the functions $f_1(t)=e^{t-1}$ and $f_2(t)=e^{1-t}$.
A: As @Christian Blatter noticed, the problem can be easily reduced to functions $h$ of the form 
$$h(t)=\max_{1\leq i \leq n} h_i(t)$$
where $h_i\colon (0,\infty)\to (0,\infty)$ is smooth ($h_i=f_i/g_i$ in OP).
Now, as $h_i$ is smooth, it is Lipschitz continuous on every closed interval. It follows that $h$ is locally Lipschitz on $(0,\infty)$.
Now,  @Anthony Carapetis suggested to use Rademacher's theorem which in facts, implies that $h$ is differentiable almost everywhere in $(0,\infty)$.
Finally,  @G. Sassatelli noticed that one can always construct $f,g\colon (0,\infty)\to(0,1)$ with the same regularity as $h$ and such that $h(t)=\frac{f(t)}{g(t)}$ for every $t>0$. Take for instance 
$$f(t)=e^{-h(t)}, \qquad g(t)=\frac{e^{-h(t)}}{h(t)}.$$
