What's the purpose of the US visa waiver program ban related to certain countries (Iraq, Syria, Iran, and Sudan)?
Is it about preventing people who are likely to commit terrorism from entering? Citizens of Iran and Iraq are not especially likely to engage in terrorist attacks against the US. Saudi Arabia and Egypt, which are vaguely allied with the US, were two countries that had a high proportion of 9/11 terrorists.
Is it about punishing governments which are sponsoring terrorism against the US? The official government of Iraq (as opposed to Islamic State) is not, as far as I'm aware, dangerously hostile to the US and wanting to act as home ground for terrorists attacking the US.
Is it about deterring individuals from interacting with these countries? I can see the legislation making life difficult for people visiting Iran, in order to deter business and tourism, as a possibility. I sometimes see tourism news media talk about Iran with a certain modicum of fascination, kind of like North Korea. But by contrast, Iraq, Syria and Sudan aren't exactly topping any tourism hit lists.
I wouldn't be surprised if domestic politics, terrorist attacks within the US, the Syrian refugee crisis, and the Iran nuclear deal play a contributory role in the decision to create the ban, but even so, I would expect some sort of logic, good or bad, as to which countries are targeted.