#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "func.inc"

typedef void (*PfnVoid)(void);

#define TEST(where) \
	printf("\n%08p is " #where " ... ", in_##where); \
	(*(PfnVoid)in_##where)();
#define MEMCPY_TEST(where) \
	memcpy(in_##where, in_code, sizeof(in_code)); \
	TEST(where)

static char in_data[sizeof(in_code)];

int main()
{
  char* in_heap = malloc(sizeof(in_code));
  char in_stack[sizeof(in_code)];
  int rc;

  setvbuf(stdout, 0, _IONBF, 0);
  TEST(code);
  MEMCPY_TEST(data);
  MEMCPY_TEST(heap);
  MEMCPY_TEST(stack);

  return 0;
}
