cg.c optimized version, fixed .gitignore