Does the red valve on right-most pipe control the water flowing into the water heater? The water heater needs to be replaced, so if the valve is closed to drain the old water heater, it would be good to know which direction the water is flowing.
The installation manual for a Rheem 40-Gal water heater shows this drawing on page 6, which superficially looks very similar to your photo:
It shows the incoming cold supply on the right and outgoing hot on the left.
What could confirm this for you (if the water heater still works) is if you run hot water for a short time and test the temperature of the pipes - you should easily be able to tell the difference between them.
Another way to confirm whether or not that valve controls the inlet or the outlet would be to raise the lever on the T&P Relief Valve on the top, then turn the wall valve off. I'm assuming that the T&P outlet pipe runs somewhere "safe" which won't cause trouble if it gets wet...
If the water stops flowing through the relief valve (or even slows down significantly) then the wall valve is on the incoming cold supply.