Optimal choice for a weird leontief function Compute the optimal choice for a consumer with the following utility function:

$$u(x_1, x_2) =\max \{\min(2x_1, x_2), \min(x_1, 2x_2)\}$$

I'm familiar with computing optimal choice for perfect complements but this has 2 expressions and I'm stumped with how to go about doing this. I'd also appreciate if anyone could explain what exactly is happening in a function like this.
One needs to go case-by-case and arrive at a utility function with branches. To get you started, if $x_1 &lt; x_2/2 \implies \min(2x_1,x_2) = 2x_1$, but then also $\min(x_1,2x_2) = x_1$. Therefore in this case, $u(x_1,x_2) = 2x_1$. etc 

There are two other intervals to consider as regards the relation between $x_1$ and $x_2$, so in all you will obtain a utility function with three branches. The middle one will be a $\max$ operator, and it can usefully be split in two, resulting in four branches.