#include <stdio.h>

static const unsigned char utf8_skip_data[256] = {
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 32 */
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 64 */
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 96 */
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 118 */
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 150 */
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 192 */
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* 224 */
  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1  /* 256 */
};

const unsigned char * const utf8_skip = utf8_skip_data;

#define utf8_next_char(p) ( (p) + utf8_skip[*(p)])


unsigned char *
utf8_offset_to_pointer (const unsigned char *str,
                       long        offset)
{
  const unsigned char *s = str;
  
  while (offset--)
#ifdef OPT
    if (*s < 191)
	s++;
    else 
#endif
    s = utf8_next_char (s);

  return (unsigned char *)s;
}


int main ()
{
	const unsigned char *str = (const unsigned char*)"ikke gij wij";
	const unsigned char *newstr;
	register i = 0;

	while (i<90000000) {
		newstr = utf8_offset_to_pointer (str, 4);
		i++;
	}
	
	printf ("%s\n", newstr);

}
