some loop optimizations, seems that gccs optimizations do
their own tricks nevertheless