void Octant(int r)
{
  register int  x, y, d, D, incSquareX, dSqaureX1, dSquareX2, x0;

  y = r;
  x = x0 = 0;
  D = -r - 1;

  incSquareX = r << 1;
  dSquareX2  = 4;

  while ((x << 1) < y) {
    D += incSquareX;
    incSquareX -= 2;
    while (D >= dSquareX2) {        /* double-step forward */
      D -= dSquareX2;
      dSquareX2 += 8;
      x += 2;
    }

    dSquareX1 = (x << 1) + 1;
    if (D >= dSquareX1) {          /* additional single-step forward */
       D -= dSquareX1;
       dSquareX2 += 4;
       x++;
    }

    DrawRun(x0, x, y);
    y--;
    x0 = x + 1;
  }

  x++;
  d = 1 - r + x*x + (x << 1) - (r - y) * (r + y -1);

  while (x <= y) {
    DrawPixel(x, y);
    if (d < 0) {
      d += (x << 2) - (y << 1) + 10;
      x++;
      DrawPixel(x, y);
    } else 
      d += ((x - y) << 1) + 5;

    x++;
    y--;
  }
}