As Iraqi PM balances ties with US, Iran and Arab states, Tehran weighs next move