very optimised code, better than -O3