You can't, because whenever $f>gy+s$ (whatever the value of $y$) then $a=f$ so there is no way to invert.
One could say, more formally, that the functions $x\to\max(x,c)$ and $x\to\min(x, c)$ are not invertible, so there is no general way to find the inverse.
If you are able to spearate your domain into different parts, then it would be different, as you would analyze each of the different cases:
Suppose first that $f < c$, so $f ≤ a ≤ c$.
$f < a < c$. From $f<a$, one can deduce that $a = \min(c,gy+s)$ and from $a<c$ one can deduce that $a=gy+s$.
$a = f < c$. Then $a = f = \max(\min(c,gy+s), f)$, so you deduce that $f ≥ \min(c,gy+s)$ which means that either $f ≥ c$ (against our hypothesis) or $f ≥ gy+s$. That's the best you can get in this case.
$f < c = a$. Then, being $a\neq f$, $a = c = \min(c,gy+s)$ so $c = \min(c,gy+s)$, so $c≤gy+s$.
Now suppose $f ≥ c$. Then $f ≥ \min(c, gy+s)$ so $a=f$. No further information can be deduced about $g$, $y$ or $s$.