struct rb_node *y = pa[k - 2]->rb_link[0];
if (y != NULL && y->rb_color == RB_RED)
  {
    pa[k - 1]->rb_color = y->rb_color = RB_BLACK;
    pa[k - 2]->rb_color = RB_RED;
    k -= 2;
  }
else
  {
    struct rb_node *x;

    if (da[k - 1] == 1)
      y = pa[k - 1];
    else
      {
        x = pa[k - 1];
        y = x->rb_link[0];
        x->rb_link[0] = y->rb_link[1];
        y->rb_link[1] = x;
        pa[k - 2]->rb_link[1] = y;
      }

    x = pa[k - 2];
    x->rb_color = RB_RED;
    y->rb_color = RB_BLACK;

    x->rb_link[1] = y->rb_link[0];
    y->rb_link[0] = x;
    pa[k - 3]->rb_link[da[k - 3]] = y;
    break;
  }
