#include <sys/types.h>
#include <string.h>

int memcmp(const void * dst, const void * src, size_t length)
{
    size_t x = length >> 2;
    size_t y = length & 0xf;
    size_t i;
    
    for (i = 0; i < x; i++)
    {
	if (((unsigned long *)dst)[i] > ((unsigned long *)src)[i])
	    return 1;
	if (((unsigned long *)dst)[i] < ((unsigned long *)src)[i])
	    return -1;
    }
    
    for (i = 0; i < y; i++)
    {
	if (((char *) dst)[length-y+i] > ((char *) src)[length-y+i])
	    return 1;
	if (((char *) dst)[length-y+i] < ((char *) src)[length-y+i])
	    return -1;
    }
    
    return 0;
}

