Does the code execute correctly? If not, how do you know it is in error? I ask because it is possible for the compiler to allocate multiple variables to the same register.
I'd like to build your code and, just by looking at the generated assembly, see if there might be a problem. I can't build what you show here. Please preprocess your code and post it, along with the compiler (not CCS) version and the build options.
Thanks and regards,
-George