flatten_lpi_states
state_count = flatten_lpi_states(pr, 0, prev, NULL);
state_count = flatten_lpi_states(pr, state_count, curr, prev);