restructure C code generator