Emscripten plugs into llvm-gcc or CLANG and intercepts the intermediate code, which it then translates into JavaScript. That JavaScript then runs natively in modern browsers with little evidence of slowdown. As proofs of concept they compiled Unreal 3, the Nebula3 engine, ScummVM, VICE, OpenSCAD, itself (yes, it's self-hosting), and a half-dozen popular programming languages into JavaScript and run them inside of web browsers.