If analog pins are needed for something else, it is possible to move encoder to digital pins 8,9 or 0,1 (losing serial port) with no modification of code logic.
This does not say with not modification of code. What would need to change is the PINC would become PINA or PINB.
If you look at the direct port manipulation page, you will see what pins make up a port (A, B, or C). The PINC is the P(ort)IN(put)X (A, B, or C) way of reading all pins at once.
The & 0x03 part throws away all but the low order pin states.
What you will need to figure out is the mask to keep the lowest pin states (0x03), the next two pins, and the next two pins, and use those three different masks in the three different functions.
Doing that in a MUCH smaller sketch is highly recommended.