Using volatile
This low-level purgatory is where you use C's volatile keyword. volatile signals to the compiler that a value may change under the code's feet, that you can make no assumptions about it, and that the optimizer can't cache it for repeated use.
This is just the behavior you need for hardware register access. Every time you write code that accesses a register, you want it to result in a real register access. Don't forget the volatile qualification!