While it does look ugly, the code 'eval'ed by GCC can be as optimized as native code, unlike JIT(which cannot spend much time optimizing).
Anyways there is a more elegant way to JIT compile C/C++ with LLVM with many
project that embed its runtime(which is quite heavy).
https://github.com/jmmartinez/easy-just-in-time