Use flip_sq idea in endgame.cpp

This patch reduces lines of code in endgame.cpp

Bench is unchanged which gives me reasonable confidence I didn't make any mistakes.

The line with 7 * (8 * x + y) might be a bit hacky for your taste but hopefully you like the idea in general.

P.S. After this patch the "mirror" function is no longer used so you could remove it if you think that is appropriate.