Example without an intermediate variable:
uint startTime = 9;
uint allowedTime = 7;
require(now > startTime + allowedTime);
Example with an intermediate variable:
uint startTime = 9;
uint allowedTime = 7;
uint deadline = startTime + allowedTime;
require(now > deadline);
Obviously those two blocks above are functionally equivalent, but the latter one introduces an intermediate variable to increase readability. I would expect the intermediate variable to cancelled out when source code gets compiled, so those two example should produce the same bytecode. If this is the case there should be no extra gas cost for usage of an intermediate variable.
Why bother? Those examples above are simple but in real situations sometimes intermediate variables are extremely useful to reduce congnitive load of reader (readible code -> bug-free code -> secure contract). So I wan't to use it if it's free gas-wise.
Now comes the question: Do intermediate variables get cancelled out by Solidity compiler and cost no extra gas? Or Solidity compiler is not that smart yet?