decoder clause reordering and unrolling to reduce `when` clauses