Code for stackoverflow question "Why this C++ function runs 13-times slower with MinGW than with VS2012"