You can use the following logic based on the player position $(x_p,y_p)$ and enemy position $(x_e,y_e)$.
First compute the slope of the line from the enemy to the player $$\frac{y_p-y_e}{x_p-x_e}$$
If the slope is zero, the player is on the same horizontal as the enemy, so the enemy will shoot either right or left.
If the slope is infinity (make sure you check _before_ you try to calculate the slope) the player will be either directly up or down from the enemy.
If the slope is exactly $1$ or $-1$ then you will be on one of the diagonal directions exactly.
Otherwise, if the slope has magnitude $>2$ go with the closest vertical direction. I.e. if the slope is $-3$ and the player is below the enemy, you want to shoot straight down rather than lower_right. If the slope has magnitude $<1/2$ you want to shoot at the closest horizontal direction. Finally, if the slope $m$ has magnitude $2 > |m| > 1/2$ you want to shoot at the closest diagonal direction.