GCC is able to reason about transfer->mosaics_count using Value Range
Propagation. Using transfer->mosaics_count, instead of a mosaics_count
argument, satisfies GCC that the variable-length skip array cannot be
too large.
Renamed variables to old_count and new_count to reduce ambiguity.