No, such function can not exist, because it would not be well-defined. For $r\in\mathbb{R}$ the function $f$ could possibly take infinite solutions, since you can write $r=x+y$ in an infinite amout of ways.
For example: $1=\frac12+\frac12$ and $1=2-1$.
Then $f(\frac12+\frac12)=\max(\frac14,\frac12)+\min(\frac14,\frac12)=\frac12+\frac14=\frac34$
Otherwise:
$f(2-1)=\max(-2,2)+\min(-2,-1)=2+(-2)=0$