Use a state machine to reduce branching logic in decode_cabac_residual.