Fix computatation of the stack offset and register ordering according to observed behavior.

Issue: PLCR-499