Vs native optimizer fixes

Adds build fixes to the native optimizer code so that it builds on Visual Studio 2013. VS2013 has only partial support for C++11, and more specifically, unrestricted unions could not be supported. It looks like those are used only for memory footprint optimization, so not that critical?

Also adds a CMake script for manually building native optimizer on different platforms.
well, the assert below happens after the write, which could segfault. but i guess that's good enough. let's leave it as is.