tcg/optimize: Use a boolean to avoid a mass of continues