What is the meaning of “sin lieth at the door,” etc., at Gen 4:7?

Sin is portrayed as a ravenous beast, and so brings to mind Peter’s advice: “Be sober, be vigilant; because your adversary the devil, as a roaring lion, walketh about, seeking whom he may devour.” (1 Pet. 5:8) You must assert control over it, master it. The tragedy is that in spite of this well-meant advice from God himself, Cain still immediately murders his brother out of envy.