Why does my MCU go back? (to the previous instruction)
The C standard specifies that reads and writes of volatile variables and calls to library routines are considered "observable operations".  A compiler is required to produce an executable which will produce all observable operations in the sequence that the source file directs, but the generated code is change around anything else in the code as it sees fit provided only that all observable operations happen in the same sequence.

For example, if code computes a value, performs an observable operation which does not make use of the value, and then performs one which does, the compiler may decide to perform the first observable operation before computing the value needed for the second.  Given code like:

int x = y/z;
if (volatile1)
  volatile2 = x;


if the value x is never used after the above code, and if variables y and z are not volatile, a compiler might legitimately decide that the code would be more efficient as

if (volatile1)
{
  int x = y/z;
  volatile2 = x;
}


since in the situation where volatile1 is zero it takes less time to execute, and if volatile1 is non-zero it doesn't take any longer.  Of course, the whole purpose of doing the assignment before testing volatile may have been to minimize the elapsed time between reading volatile1 and writing volatile2, but if that's the case if may be helpful to do something like:

volatile int dummy_volatile;
#define USE_VALUE(x) (dummy_volatile = (int)(x))


and then...

int x = y/z;
USE_VALUE(x);
if (volatile1)
  volatile2 = x;


That would ensure that an observable operation using the computed value would take place before the observable read of volatile1.  Some compilers may offer a means of "observably using" a value without having to actually store it anyplace, but I don't know of any standard means of doing that.