First implementation with successful Javascript output, via emscripten