I have calculated the boolean functions for $r$ and $f$:
$f = \overline{s_1} \cdot s_0 + s_1 \cdot \overline{s_0}$.
$r = \overline{s_0 \cdot s_1 \cdot s_2 \cdot s_3}$.
Do you have an idea what an application for this circuit can be? I don't know where we would use it.