Is the issue that the value of the local variable tempint2 is not displayed correctly, or is the issue that the code does not run as expected?
I guess its the first one, as the tempint2 variable is only used immediately after it is assigned, and later it is always overwritten. So the compiler can just not store it in the local variable, but I see that this is not so nice for debugging. I would try to disable the -onu optimization and see if this helps. If not, (not sure), making the variable volatile (I don't like that) or checking the value in the register (with a big comment instead of the HLI STD).
Daniel