How can I correctly setup attachInterrupt() in this sketch?

I'm not sure how to share them.

Also, I don't know why coder added these lines either.
ref_count = ref_coil_count;
sensor_count = sensor_coil_count;