rewrite For loop generating code, slightly improve the loop performance
gu