Zaslat SMS: Robust quantum compilation and circuit optimisation via energy minimisation