Linux, C, GCC. Is it possible to get the following equivalent functionality (pseudocode):
#pragma optimizations-stop
#pragma registers-flush
a=10;
while(*b != 0) c++;
if(a == 0) { do something; }
#pragma optimizations-start
with result of location of a
being explicitly written with value 10, then every loop cycle value of b
is read from the memory and then read value compared to 0, and then if not zero c
is rmw’ed with +1, and when loop breaks location of a is being explicitly read from the memory and compared to 0?
And, what’s important, instructions are executed in the specific order programmer laid them out in the program, not as compiler or CPU thinks the best.