How do you get this fast to the result ?
Through the ancient, long forgotten art of "staring". It works by staring at the problem until the solution emerges from the patterns. ;-)
I see that PWM = EN. That is the easy one.
DIR = IN2 is quite exactly as easy as that, really ;-)