Arduino's digitalWrite, precautions for direct port manipulation?
I figure they don't want an interrupt to possibly change any of the bits in the output register while it executes *out = *out &amp; ~bit?


Correct. That is known as a critical section.


  And what would the SREG have to do with it? Could the code affect SREG and why would that matter?


SREG is where the flag that says if interrupts are enable or not is stored.  Basically that is storing the current state, disabling interrupts, then restoring the current state.

The upshot is:


If interrupts are enabled to begin with, they are disabled, then re-enabled.
If interrupts are disabled to begin with, they are again disabled, and they remain disabled.


It's a way of restoring the previous state without actually having to check what the state was and set or clear accordingly.