AMD interview question

Logic problem, draw out state diagram