prototype of loop-finder pass