Let's first discuss the dot product. A·B is a measure of A's component in the direction of B or vice versa; of the magnitudes of both vectors as well as their similarity in direction. Vectors pointing in the same direction have a dot product equal to the product of their lengths, perpendicular vectors have a dot product of zero. Turn the vectors even further apart, and the dot product becomes negative. Though normally defined as (x,y)·(u,v) = xu + yv, it has the property: A·B = A B cos θ, where θ is the angle between the two vectors.
The sign of this product can be used to determine whether a vector B partly points in the same or opposing direction of a reference vector A, i.e. if A·B is positive, the angle is less than 90° (or greater than -90°). It doesn't tell us if the vector points left or right with respect to the reference. Below is a graphical description. Blue vectors B would yield a positive A·B, red vectors a negative.

We do have this information we want if we carry out the dot product of B and a different reference vector: A rotated ninety degrees clockwise (we'll call it A'). Once again, in blue vectors B that would yield a positive A'·B, negative values in red.

Note that in a coordinate system with the x-axis pointing right and the y-axis pointing down, we can rotate a vector 90° clockwise as (x,y)' = (-y,x), ergo: A'·B = (x,y)'·(u,v) = (-y,x)·(u,v) = -yu + xv. This number is positive (B is clockwise of A) if x v > y u. Those are exactly the two values your code is comparing.