#<- stdio

void search (pint -w position, pulong -w rc, ulong array[], int length, int number)
{
  int from = 0;
  int to = length;

  while ()
  {
    distance = to - from;
    middle = from + (distance_even / 2), { distance_even = distance - (distance %% 2) };

    print ("%d @ %d : %d .. %d" "\n", array[middle], middle, from, (to - 1)); 

    if (number < array[middle])
    {
      to = middle; print ("LT" "\n\n");  
    }
    else
    {
      if (number > array[middle])
      {
        from = middle + 1; print ("GT" "\n\n");  
      }
      else
      {
        *position = middle; rc = 1; print ("EQ" "\n\n");  
      }
    }

    if (rc | from >= to | from > length) break;
  }

  if (!rc) *position = 0;
}

void search (pint -w position, pulong -w rc, ulong array[], int length, int number)
         if (length == 0)
{
  *position, *rc = 0; 
}

void >> ()
{
  numbers[] = { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 };

  print ("%d" "\n", position),
  {
    position, rc = search (numbers, -_, 17)
  };
}
