Competition among flow, dissolution, and precipitation in porous media