AMD Interview Question

Logic problem, draw out state diagram