I'm not happy with this `alloca/withForeignPtr` chains. I'm looking for improvements. Comments are welcome.