memmove instead of memcpy for known overlapping copies