I see ISIS doing one of two things when they realize there finished in Iraq: retreat to the cities and conduct a final stand with urban fighting or head to Syria to continue there fight for the caliphate upon which they need to be bombarded until they're wiped out.
My guess is they’ll go back to Syria. Also, the Sunnis in Iraq stood by while ISIS went on a rampage, but by now ISIS has had time to anger them too. So in typical Arab fashion, once ISIS is retreating or vulnerable, the Sunnis will fall on them too to get their glory.
I think they’ll head back to Raqqah (in north-central Syria), which they’ve proclaimed as the capital city of their “Caliphate”. That’s not to say I can’t see some ISIS units doing a ‘last stand’, but I think the bulk of them will retreat back to Syria.
As far as Assad going after them, once they’ve outlived their usefulness to him, their turn will come. He’s basically using them as a cat’s-paw to destabilize other groups fighting against the Damascus regime.