Decision over "max" production function: I've been presented with the following problem:

$$y=3(x_3)^{\frac13}(\max\{x_1,8x_2\})^{\frac13}$$

And the objective is to both maximize profit and minimize cost. First of all, if the problems are dual, does that mean the result will be the same in variables such as demands?

STILL, MY BIGGEST ISSUE IS THIS: When you get rid of the max, this becomes a Cobb Douglas piece of cake. But I just don't understand how to do that. So far, all I've got is that this function allows corner solutions, so it's not solved just as a Leontieff function. How would you go about choosing each good? I'm also sure it has to do with input prices $w_1$ and $w_2$
Hint

For profit maximization, either $x_1$ or $x_2$ (but not both) must be zero. If not, say $x_1^*&gt;x_2^*&gt;0$ at the optimum, then one could increase profit by lowering cost by reducing $x_2^*$ without affecting output and thus revenue. 

Let $z=\max\{x_1,8x_2\}$. The profit function can be written as 
\begin{equation}
p[3(x_3)^{1/3}(z)^{1/3}]-w_3x_3-c_zz,\tag1
\end{equation}
where 
\begin{equation}
c_z=
\begin{cases}
w_1&amp;\text{if }x_1&gt;8x_2\\
w_2/8&amp;\text{if }x_1&lt;8x_2\\
\min\{w_1,w_2/8\}&amp;\text{if }x_1=8x_2
\end{cases}
\end{equation}

Solve $(1)$ for the condition determining the optimal level of $z$, and compare the costs of achieving this level using either $x_1$ or $x_2$. Use the one that entails the lower cost.