Converting a piece of PIC code to Arduino

You never actually stated what you expect the code to do.
Or do we have to guess?