6 CS_INT q, s, sparent, jprev ;
7 if (!first || !maxfirst || !prevleaf || !ancestor || !jleaf)
return (-1) ;
9 if (i <= j || first [j] <= maxfirst [i])
return (-1) ;
10 maxfirst [i] = first [j] ;
11 jprev = prevleaf [i] ;
13 *jleaf = (jprev == -1) ? 1: 2 ;
14 if (*jleaf == 1)
return (i) ;
15 for (q = jprev ; q != ancestor [q] ; q = ancestor [q]) ;
16 for (s = jprev ; s != q ; s = sparent)
18 sparent = ancestor [s] ;
CS_INT cs_leaf(CS_INT i, CS_INT j, const CS_INT *first, CS_INT *maxfirst, CS_INT *prevleaf, CS_INT *ancestor, CS_INT *jleaf)