#include <stddef.h>

typedef long HeapWord;

extern void _Copy_disjoint_words(HeapWord* from, HeapWord* to, size_t count);

void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
    switch (count) {
      case 0: return;
      case 1: to[0] = from[0]; return;
      case 2: {
        struct unit { HeapWord a, b; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 3: {
        struct unit { HeapWord a, b, c; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 4: {
        struct unit { HeapWord a, b, c, d; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 5: {
        struct unit { HeapWord a, b, c, d, e; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 6: {
        struct unit { HeapWord a, b, c, d, e, f; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 7: {
        struct unit { HeapWord a, b, c, d, e, f, g; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      case 8: {
        struct unit { HeapWord a, b, c, d, e, f, g, h; } *p, *q, t;
	p = (struct unit *)from;
	q = (struct unit *)to;
	t = *p;
	*q = t;
	return;
      }
      default:
        _Copy_disjoint_words(from, to, count);
    }
}
