It is set up correctly. As to why... well that's just too much typing sorry.

The first integral should be pretty clear. $4 A C >0$ and $B^2 \geq 4 A C \Rightarrow B \geq \sqrt{4 A C}$

but also $B \leq 1$ and so you end up with the Min function.

The rest of it is just carefully chasing those Min functions back through the integration chain.