added logic for sethi-ullman register counting