
#include <string.h>

void * memmove(void * dst, void * src, size_t acount) {
    register void * ret = dst;
    register char * d;
    register char * s;

    if (src < dst && (char *)src + acount > dst) {
        d = ((char *)dst) + acount - 1;
        s = ((char *)src) + acount - 1;
        while (acount--) {
            *d-- = *s--;
        }
    } else {
        d = dst;
        s = src;
        while (acount--) {
            *d++ = *s++;
        }
    }

    return (ret);
}
