Rule reminder
Both orders are equally correct: 'Se avessi tempo, studierei' = 'Studierei se avessi tempo.' The tenses do not change when the order changes. When 'se' clause is second, no comma is used before 'se'.
Rewrite with the result clause first: 'Se avessi fame, mangerei qualcosa.'