// File: /workspace/github_cpp_makefile_star2_O1/BenLangmead[P]bowtie/./ls.h
// Function: LarssonSadakane<int>::transform(int*, int*, int, int, int, int)
inline T transform(T *x, T *p, T n, T k, T l, T q)
	{
	   T b, c, d, e, i, j, m, s;
	   T *pi, *pj;

	   for (s=0, i=k-l; i; i>>=1)
		  ++s;                      /* s is number of bits in old symbol.*/
	   e=std::numeric_limits<T>::max()>>s; /* e is for overflow checking.*/
	   for (b=d=r=0; r<n && d<=e && (c=d<<s|(k-l))<=q; ++r) {
		  b=b<<s|(x[r]-l+1);        /* b is start of x in chunk alphabet.*/
		  d=c;                      /* d is max symbol in chunk alphabet.*/
	   }
	   m=(((T)1)<<(r-1)*s)-1;            /* m masks off top old symbol from chunk.*/
	   x[n]=l-1;                    /* emulate zero terminator.*/
	   if (d<=n) {                  /* if bucketing possible, compact alphabet.*/
		  for (pi=p; pi<=p+d; ++pi)
			 *pi=0;                 /* zero transformation table.*/
		  for (pi=x+r, c=b; pi<=x+n; ++pi) {
			 p[c]=1;                /* mark used chunk symbol.*/
			 c=(c&m)<<s|(*pi-l+1);  /* shift in next old symbol in chunk.*/
		  }
		  for (i=1; i<r; ++i) {     /* handle last r-1 positions.*/
			 p[c]=1;                /* mark used chunk symbol.*/
			 c=(c&m)<<s;            /* shift in next old symbol in chunk.*/
		  }
		  for (pi=p, j=1; pi<=p+d; ++pi)
			 if (*pi)
				*pi=j++;            /* j is new alphabet size.*/
		  for (pi=x, pj=x+r, c=b; pj<=x+n; ++pi, ++pj) {
			 *pi=p[c];              /* transform to new alphabet.*/
			 c=(c&m)<<s|(*pj-l+1);  /* shift in next old symbol in chunk.*/
		  }
		  while (pi<x+n) {          /* handle last r-1 positions.*/
			 *pi++=p[c];            /* transform to new alphabet.*/
			 c=(c&m)<<s;            /* shift right-end zero in chunk.*/
		  }
	   } else {                     /* bucketing not possible, don't compact.*/
		  for (pi=x, pj=x+r, c=b; pj<=x+n; ++pi, ++pj) {
			 *pi=c;                 /* transform to new alphabet.*/
			 c=(c&m)<<s|(*pj-l+1);  /* shift in next old symbol in chunk.*/
		  }
		  while (pi<x+n) {          /* handle last r-1 positions.*/
			 *pi++=c;               /* transform to new alphabet.*/
			 c=(c&m)<<s;            /* shift right-end zero in chunk.*/
		  }
		  j=d+1;                    /* new alphabet size.*/
	   }
	   x[n]=0;                      /* end-of-string symbol is zero.*/
	   return j;                    /* return new alphabet size.*/
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r10d
movq %rdx, %r11
movq %rsi, %rbx
xorl %r14d, %r14d
movl $0x0, %ebp
subl %r9d, %r8d
je 0x1e08f
xorl %ebp, %ebp
movl %r8d, %ecx
movl %r8d, %eax
incl %ebp
sarl %eax
cmpl $0x1, %ecx
movl %eax, %ecx
ja 0x1e084
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %ebp, %ecx
shrl %cl, %eax
movl $0x0, 0x10(%rdi)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x0, %r12d
testl %r10d, %r10d
movl %r10d, 0x4(%rsp)
jle 0x1e125
movq %rdi, %r15
movl 0x60(%rsp), %edx
movl %r10d, %esi
xorl %r12d, %r12d
movl $0x1, %edi
xorl %r10d, %r10d
movl %r10d, %r14d
movl %ebp, %ecx
shll %cl, %r14d
orl %r8d, %r14d
cmpl %edx, %r14d
jg 0x1e112
movl %r12d, %r10d
movl %ebp, %ecx
shll %cl, %r10d
movl -0x4(%rbx,%rdi,4), %r12d
subl %r9d, %r12d
incl %r12d
orl %r10d, %r12d
movl %edi, 0x10(%r15)
leaq 0x1(%rdi), %rcx
cmpq %rsi, %rdi
jae 0x1e10d
movq %rcx, %rdi
movl %r14d, %r10d
cmpl %eax, %r14d
jle 0x1e0d2
decq %rcx
jmp 0x1e11b
decq %rdi
movq %rdi, %rcx
movl %r10d, %r14d
decl %ecx
movl 0x4(%rsp), %r10d
movq %r15, %rdi
imull %ebp, %ecx
shll %cl, %r13d
notl %r13d
leal -0x1(%r9), %eax
movslq %r10d, %rcx
leaq (%rbx,%rcx,4), %r15
movl %eax, (%r15)
cmpl %r10d, %r14d
jle 0x1e156
movslq 0x10(%rdi), %rdx
cmpl %r10d, %edx
jle 0x1e23a
movl %r12d, %eax
jmp 0x1e277
movslq %r14d, %r8
testl %r14d, %r14d
js 0x1e1b8
leaq (%r11,%r8,4), %rax
incq %rax
leaq 0x4(%r11), %rcx
cmpq %rcx, %rax
cmovaq %rax, %rcx
movq %r11, %rdx
notq %rdx
addq %rcx, %rdx
andq $-0x4, %rdx
addq $0x4, %rdx
movq %rdi, 0x10(%rsp)
movq %r11, %rdi
xorl %esi, %esi
movq %r9, 0x20(%rsp)
movq %r11, 0x18(%rsp)
movq %r8, 0x8(%rsp)
callq 0x51b0
movq 0x8(%rsp), %r8
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %r10d
movq 0x18(%rsp), %r11
movq 0x20(%rsp), %r9
movslq 0x10(%rdi), %rcx
movl %r12d, %eax
cmpl %r10d, %ecx
jg 0x1e1ef
leaq (%rbx,%rcx,4), %rdx
movl %r12d, %eax
movslq %eax, %rsi
movl $0x1, (%r11,%rsi,4)
andl %r13d, %esi
movl %ebp, %ecx
shll %cl, %esi
movl (%rdx), %eax
subl %r9d, %eax
incl %eax
orl %esi, %eax
addq $0x4, %rdx
cmpq %r15, %rdx
jbe 0x1e1cb
cmpl $0x2, 0x10(%rdi)
jl 0x1e212
movl $0x1, %edx
cltq
movl $0x1, (%r11,%rax,4)
andl %r13d, %eax
movl %ebp, %ecx
shll %cl, %eax
incl %edx
cmpl 0x10(%rdi), %edx
jl 0x1e1fa
testl %r14d, %r14d
js 0x1e281
leaq (%r11,%r8,4), %rax
movl $0x1, %r14d
movq %r11, %rcx
cmpl $0x0, (%rcx)
je 0x1e22f
movl %r14d, (%rcx)
incl %r14d
addq $0x4, %rcx
cmpq %rax, %rcx
jbe 0x1e224
jmp 0x1e287
shlq $0x2, %rdx
movl %r12d, (%rbx)
andl %r13d, %r12d
movl %ebp, %ecx
shll %cl, %r12d
leaq (%rbx,%rdx), %rcx
addq $0x4, %rcx
movl -0x4(%rcx), %eax
subl %r9d, %eax
incl %eax
orl %r12d, %eax
addq $0x4, %rbx
movl %eax, %r12d
cmpq %r15, %rcx
jbe 0x1e23e
jmp 0x1e277
movl %eax, (%rbx)
addq $0x4, %rbx
andl %r13d, %eax
movl %ebp, %ecx
shll %cl, %eax
cmpq %r15, %rbx
jb 0x1e26a
incl %r14d
jmp 0x1e2de
movl $0x1, %r14d
movslq 0x10(%rdi), %rax
cmpl %r10d, %eax
jg 0x1e2d9
shlq $0x2, %rax
movslq %r12d, %rdx
movl (%r11,%rdx,4), %esi
andl %r13d, %edx
movl %ebp, %ecx
shll %cl, %edx
movl %esi, (%rbx)
leaq (%rbx,%rax), %rcx
addq $0x4, %rcx
movl -0x4(%rcx), %r12d
subl %r9d, %r12d
incl %r12d
orl %edx, %r12d
addq $0x4, %rbx
cmpq %r15, %rcx
jbe 0x1e294
jmp 0x1e2d9
movslq %r12d, %r12
movl (%r11,%r12,4), %eax
movl %eax, (%rbx)
addq $0x4, %rbx
andl %r13d, %r12d
movl %ebp, %ecx
shll %cl, %r12d
cmpq %r15, %rbx
jb 0x1e2c4
movl $0x0, (%r15)
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop