// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/./ls.h
// Function: LarssonSadakane<int>::suffixsort(int*, int*, int, int, int)
void suffixsort(T *x, T *p, T n, T k, T l)
	{
	   T *pi, *pk;
	   T i, j, s, sl;

	   V=x;                         /* set global values.*/
	   I=p;

	   if (n>=k-l) {                /* if bucketing possible,*/
		  j=transform(V, I, n, k, l, n);
		  bucketsort(V, I, n, j);   /* bucketsort on first r positions.*/
	   } else {
		  transform(V, I, n, k, l, std::numeric_limits<T>::max());
		  for (i=0; i<=n; ++i)
			 I[i]=i;                /* initialize I with suffix numbers.*/
		  h=0;
		  sort_split(I, n+1);       /* quicksort on first r positions.*/
	   }
	   h=r;                         /* number of symbols aggregated by transform.*/

	   while (*I>=-n) {
		  pi=I;                     /* pi is first position of group.*/
		  sl=0;                     /* sl is negated length of sorted groups.*/
		  do {
			 if ((s=*pi) <= 0 && (s=*pi) != 0) {
				pi-=s;              /* skip over sorted group.*/
				sl+=s;              /* add negated length to sl.*/
			 } else {
				if (sl) {
				   *(pi+sl)=sl;     /* combine sorted groups before pi.*/
				   sl=0;
				}
				pk=I+V[s]+1;        /* pk-1 is last position of unsorted group.*/
				sort_split(pi, (T)(pk-pi));
				pi=pk;              /* next group.*/
			 }
		  } while (pi<=I+n);
		  if (sl)                   /* if the array ends with a sorted group.*/
			 *(pi+sl)=sl;           /* combine sorted groups at end of I.*/
		  h=2*h;                    /* double sorted-depth.*/
	   }

	   for (i=0; i<=n; ++i)         /* reconstruct suffix array from inverse.*/
		  I[V[i]]=i;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdi, %rbx
movq %rsi, 0x8(%rdi)
movq %rdx, (%rdi)
movl %r8d, %eax
subl %r9d, %eax
cmpl %ecx, %eax
jle 0x16a56
movl $0x7fffffff, (%rsp)     # imm = 0x7FFFFFFF
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x17854
movslq %r14d, %r15
xorl %eax, %eax
cmpq %r15, %rax
jg 0x16a7f
movq (%rbx), %rcx
movl %eax, (%rcx,%rax,4)
incq %rax
jmp 0x16a46
movl %r14d, (%rsp)
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x17854
movq (%rbx), %rdx
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
movl %r14d, %ecx
movl %eax, %r8d
callq 0x17a10
movslq %r14d, %r15
jmp 0x16a92
andl $0x0, 0x14(%rbx)
movq (%rbx), %rsi
leal 0x1(%r14), %edx
movq %rbx, %rdi
callq 0x17a98
movl 0x10(%rbx), %eax
negl %r14d
movl %eax, 0x14(%rbx)
movq (%rbx), %rax
movl (%rax), %edx
cmpl %r14d, %edx
jl 0x16b1f
xorl %ecx, %ecx
movq %rax, %rsi
testl %edx, %edx
js 0x16af2
testl %ecx, %ecx
je 0x16abb
movslq %ecx, %rax
movl %ecx, (%rsi,%rax,4)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movl %edx, %edx
movslq (%rcx,%rdx,4), %rcx
leaq (%rax,%rcx,4), %r12
addq $0x4, %r12
movq %r12, %rdx
subq %rsi, %rdx
shrq $0x2, %rdx
movq %rbx, %rdi
callq 0x17a98
movq (%rbx), %rax
leaq (%rax,%r15,4), %rdx
xorl %ecx, %ecx
movq %r12, %rsi
cmpq %rdx, %r12
jbe 0x16b07
jmp 0x16b15
movslq %edx, %rdi
shlq $0x2, %rdi
subq %rdi, %rsi
addl %edx, %ecx
leaq (%rax,%r15,4), %rdx
cmpq %rdx, %rsi
ja 0x16b0b
movl (%rsi), %edx
jmp 0x16aaa
testl %ecx, %ecx
je 0x16b15
movslq %ecx, %rax
movl %ecx, (%rsi,%rax,4)
movl 0x14(%rbx), %eax
addl %eax, %eax
jmp 0x16a98
xorl %eax, %eax
cmpq %r15, %rax
jg 0x16b39
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movslq (%rdx,%rax,4), %rdx
movl %eax, (%rcx,%rdx,4)
incq %rax
jmp 0x16b21
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop