C functions were faster

The C version was consistently and measurably faster than the equivalent C++ code, so I profiled the various parts and ended up bringing back some of the C functions. The C++ equivalents are still there but commented out. Anyway, this ended up being about 10% faster, although it's still 8% slower than the exact same code compiled with gcc. Oh well.