If $g:\mathbb R\to\mathbb R$ is differentiable, how can we show that $$h(z):=\min\left(1,e^{g(z)}\right)\;\;\;\text{for }z\in\mathbb R$$ is also differentiable, except at a countable number of points, with derivative given Lebesgue almost everywhere by the function $$z\ni\mathbb R\mapsto\begin{cases}g'(z)e^{g(z)}&\text{, if }g(z)<0\\0&\text{, if }g(z)\ge0\end{cases}?\tag1$$

It's clear to me that $\min:\mathbb R^2\to\mathbb R$ is partially differentiable in both arguments, except on the diagonal $\Delta:=\left\{(x,x):x\in\mathbb R\right\}$ (which clearly has Lebesgue measure $0$). However, it's not clear to me why $h$ is differentiable except on a countable set.

*Remark 1*: I'm aware of Rademacher's theorem, which yields that $\mathbb R\ni x\mapsto\min(1,e^x)$ is differentiable Lebesgue almost everywhere (noting that this function is Lipschitz continuous). But this doesn't immediately yield that the derivative of $h$ is as claimed and it doesn't yield that the null set is countable.

*Remark 2*: We may note that the Lipschitz continuity implies absolutely continuity. So, maybe this is related to this Wikipedia entry: https://en.wikipedia.org/wiki/Absolute_continuity#Equivalent_definitions. But again, this result seems only to yield Lebesgue almost everywhere differentiability, but not the concrete shape of the derivative.

**EDIT**: We know that $$\frac{\rm d}{{\rm d}x}\min(1,e^x)=\left.\begin{cases}e^x&\text{, if }x<0\\0&\text{, if }x>0\end{cases}\right\}\;\;\;\text{for all }x\in\mathbb R.\tag2$$ So, the problematic set seems to be $\left\{x\in\mathbb R:g(x)=0\right\}$, which doesn't need to be countable ... The claim can be found here on page 12.