Rewrite product codegen to work around SI-8431.