Move stat-related prologue to crtgenerate.py (close gh-30).