words[]: void sort ( uint8 * a , uint8 * e , bool ( uint8 , uint8 ) gt ) { if ( a >= e ) return ; uint8 * [ ] stack = alloc uint8 * [ ] ( sizeof ( void * ) << 4 ) ; uint8 pushed = 0 ; e -- ; do { assert ( a <= e ) ; switch ( e - a ) { case 2 : if ( gt ( * a , * -- e ) ) swap ( * a , * e ) ; if ( gt ( * a , * ++ e ) ) swap ( * a , * e ) ; a ++ ; case 1 : if ( gt ( * a , * e ) ) swap ( * a , * e ) ; case 0 : if ( pushed ) { e = stack [ -- pushed ] ; a = stack [ -- pushed ] ; next ; } return ; } uint8 * a0 = a ; uint8 * e0 = e ; if ( gt ( * a , * e ) ) swap ( * a , * e ) ; uint8 a_lim = * a ++ ; uint8 e_lim = * e -- ; do { until ( a >= e ) ; if ( gt ( * a , a_lim ) ) if ( gt ( e_lim , * a ) ) a_lim = * a ++ ; else swap ( * a , * e -- ) ; else a ++ ; until ( a >= e ) ; if ( gt ( e_lim , * e ) ) if ( gt ( * e , a_lim ) ) e_lim = * e -- ; else swap ( * a ++ , * e ) ; else e -- ; } if ( gt ( * a , a_lim ) ) e -- ; else a ++ ; if ( e - a0 > e0 - a ) { stack [ pushed ++ ] = a0 ; stack [ pushed ++ ] = e ; a = e ; e = e0 ; } else { stack [ pushed ++ ] = a ; stack [ pushed ++ ] = e0 ; a = a0 ; } } } ""