codegen: simplify code fragment in dotimes