The questions I would ask as a Supreme Court Justice:
1. Is this EO the product of one person's ideas, or those of several people (including the Head of Homeland Security)?
2. If the answer is several .... Is there evidence that all of those people share an animus towards Islam?
3. If the answer is, there is not .... Then does the text of the EO exhibit religious animus?
4. If it does not .... Then if this EO was published by another President with no religious animus but a legal security purpose, would it be permissible?
5. If it was .... Then one might reasonably conclude that the President's alleged motive doesn't matter. Any animus was removed during the drafting procedure, leaving nothing malignant in the text.
6. Whereas, if you allow motive to deny the Administration its lawful power, then the Court is playing the role of Executive in matters of security. And this is a role the Supreme Court has not shown the desire to perform.