Disassembly looks funny and doesn't correspond with C code
Sorry for the late reply - I tried to respond yesterday but ran into multiple, severe networking issues.
Check your project’s optimization level:
Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Optimzation -> Optimization Level.
You want “None (-O0)” or “Optimize for Debug (-Og)”.
Your “missing code” has been optimized out by the compiler. It did not see any subsequent reference to the calculated values, so it omitted the calculations themselves.
Add the “volatile” keyword to your variable declaration to force the compiler to not make assumptions about your variable usage.
More information about optimization levels in GCC:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
I hope this helps.
I originally wrote a slightly longer and more methodical response to your question, but the web site decided I was no longer logged in and “optimized” it away
Dale