#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <string.h>

#define LRAND(s) (((s) = (s) * 41943011 - 2147483647) >> 32)

#define small_memcpy(to,from,n)\
{\
register x86_reg dummy;\
__asm__ volatile(\
        "rep; movsb"\
        :"=&D"(to), "=&S"(from), "=&c"(dummy)\
/* It's most portable way to notify compiler */\
/* that edi, esi and ecx are clobbered in asm block. */\
/* Thanks to A'rpi for hint!!! */\
        :"0" (to), "1" (from),"2" (n)\
        : "memory");\
}


int main(int argc, char **argv){
	const size_t n = 62;
	char from[n];
	char to[n];
	struct timeval cur;
	gettimeofday(&cur, NULL);
	uint64_t seed = (uint64_t)cur.tv_usec;
	uint32_t num1 = 0;

	for(num1=0; num1<n; num1++){
		from[num1] = LRAND(seed) % 255;
	}
	small_memcpy(to, from, 62);


	num1 = strncmp((const char *)from, (const char *)to, n);
	if(num1 == 0)
		printf("equal!\n");
	else
		printf("mismatch !\n");

	return 0;
}