#include <stdlib.h>

int Results[0x100];

void Write_Num (int Number, int Offset)
{
   Offset = Offset % 256;
   Results[Offset] = Number;
}

void Caller_0 (int Num, int Ofs)
{
   Write_Num (Num, Ofs);
}

void Caller_1 (int Num, int Ofs)
{
   Write_Num (Num, Ofs);
}

void Caller_2 (int Num, int Ofs)
{
   Write_Num (Num, Ofs);
}

void Caller_3 (int Num, int Ofs)
{
   Write_Num (Num, Ofs);
}

static int cmp_function (const int *item1, const int *item2)
{
   if (*item1 < *item2)
   {
      return (-1);
   }
   else if (*item1 > *item2)
   {
      return (1);
   }
   else
   {
      return (0);
   }
}

void main ()
{
   int Rand_Num=0, Rand_Num_Old=0, Rand_Num_Older, Counter;

   Counter = 4096;
   for (;;)
   {
      Rand_Num_Older = Rand_Num_Old;
      Rand_Num_Old = Rand_Num;
      Rand_Num = rand();
      switch (Rand_Num_Old % 4) {
         case 0 :
            Caller_0 (Rand_Num, Rand_Num_Older);
            break;
         case 1 :
            Caller_1 (Rand_Num, Rand_Num_Older);
            break;
         case 2 :
            Caller_2 (Rand_Num, Rand_Num_Older);
            break;
         case 3 :
            Caller_3 (Rand_Num, Rand_Num_Older);
            break;
         default :
            break;
      }
      Counter--;
      if (Counter == 0)
      {
         qsort ((void *)Results, 0x100, sizeof(*Results),
            (int (*)(const void *, const void *))cmp_function);
         Counter = 4096;
      }
   }
}
