Technically speaking, you should not be checking for both X & Y collisions on every brick you have, only that one or the other is taking place at the time. The direction that balls goes after this depends on which of two is making contact, but it's rare for both to take place at the same time. ie;
if collision_x() then collide = 1 : goto hit
if collision_y() then collide = 2 : goto hit
....
other code
....
hit:
if collide = 1 then reverse_ball_y()
if collide = 2 then reverse_ball_x()
...
etc.
It doesn't really matter which way you do the detection stuff in this instance but it is important to know if an up & down or left & right collision has been made. if either is true, 90% of the time you don't have to test the other. In the case of a complete reversal of the balls, like a corner, you let the detection run the above code on the two bricks making the corner space.
Any truly great code should be indisguishable from magic.