Split into functions and build with -O3