Generating code with str_replace optimizer [ci skip]