// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/is.c
// Function: induceSA
static void induceSA(const unsigned char *T, int64_t *SA, int64_t *C, int64_t *B, int64_t n, int64_t k, int64_t cs)
{
	int64_t *b, i, j;
	int64_t  c0, c1;
	/* compute SAl */
	if (C == B) getCounts(T, C, n, k, cs);
	getBuckets(C, B, k, 0);	/* find starts of buckets */
	j = n - 1;
	b = SA + B[c1 = chr(j)];
	*b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j;
	for (i = 0; i < n; ++i) {
		j = SA[i], SA[i] = ~j;
		if (0 < j) {
			--j;
			if ((c0 = chr(j)) != c1) {
				B[c1] = b - SA;
				b = SA + B[c1 = c0];
			}
			*b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j;
		}
	}
	/* compute SAs */
	if (C == B) getCounts(T, C, n, k, cs);
	getBuckets(C, B, k, 1);	/* find ends of buckets */
	for (i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
		if (0 < (j = SA[i])) {
			--j;
			if ((c0 = chr(j)) != c1) {
				B[c1] = b - SA;
				b = SA + B[c1 = c0];
			}
			*--b = ((j == 0) || (chr(j - 1) > c1)) ? ~j : j;
		} else SA[i] = ~j;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r13
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r12
movq 0x40(%rsp), %r9
cmpq %rcx, %rdx
jne 0x55a7
testq %r13, %r13
jle 0x5582
leaq (,%r13,8), %rdx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3140
movq 0x40(%rsp), %r9
testq %rbx, %rbx
jle 0x55a7
xorl %eax, %eax
cmpq $0x8, %r9
jne 0x5595
movq (%r12,%rax,8), %rcx
jmp 0x559a
movzbl (%r12,%rax), %ecx
incq (%rbp,%rcx,8)
incq %rax
cmpq %rax, %rbx
jne 0x5589
testq %r13, %r13
jle 0x55c7
xorl %ecx, %ecx
xorl %eax, %eax
movq (%rbp,%rax,8), %rdx
addq %rcx, %rdx
movq %rcx, (%r14,%rax,8)
incq %rax
movq %rdx, %rcx
cmpq %rax, %r13
jne 0x55b0
leaq -0x1(%rbx), %rdx
cmpq $0x8, %r9
jne 0x55d8
movq -0x8(%r12,%rbx,8), %rcx
jmp 0x55dd
movzbl (%r12,%rdx), %ecx
movq (%r14,%rcx,8), %rax
leaq (%r15,%rax,8), %rax
cmpq $0x2, %rbx
jl 0x560b
cmpq $0x8, %r9
jne 0x55f8
movq -0x10(%r12,%rbx,8), %rsi
jmp 0x55fe
movzbl -0x2(%r12,%rbx), %esi
movq %rbx, %rdi
negq %rdi
cmpq %rcx, %rsi
cmovlq %rdi, %rdx
movq %rdx, (%rax)
testq %rbx, %rbx
jle 0x5698
addq $0x8, %rax
xorl %edx, %edx
movq (%r15,%rdx,8), %rsi
movq %rsi, %rdi
notq %rdi
movq %rdi, (%r15,%rdx,8)
testq %rsi, %rsi
jle 0x5690
leaq -0x1(%rsi), %rdi
cmpq $0x8, %r9
jne 0x5641
movq -0x8(%r12,%rsi,8), %r8
jmp 0x5646
movzbl (%r12,%rdi), %r8d
cmpq %rcx, %r8
jne 0x5650
movq %rcx, %r8
jmp 0x5663
subq %r15, %rax
sarq $0x3, %rax
movq %rax, (%r14,%rcx,8)
movq (%r14,%r8,8), %rax
leaq (%r15,%rax,8), %rax
cmpq $0x1, %rsi
je 0x5686
cmpq $0x8, %r9
jne 0x5676
movq -0x10(%r12,%rsi,8), %rcx
jmp 0x567c
movzbl -0x2(%r12,%rsi), %ecx
negq %rsi
cmpq %r8, %rcx
cmovlq %rsi, %rdi
movq %rdi, (%rax)
addq $0x8, %rax
movq %r8, %rcx
incq %rdx
cmpq %rdx, %rbx
jne 0x561d
cmpq %r14, %rbp
jne 0x56de
testq %r13, %r13
jle 0x56b9
leaq (,%r13,8), %rdx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3140
movq 0x40(%rsp), %r9
testq %rbx, %rbx
jle 0x56de
xorl %eax, %eax
cmpq $0x8, %r9
jne 0x56cc
movq (%r12,%rax,8), %rcx
jmp 0x56d1
movzbl (%r12,%rax), %ecx
incq (%rbp,%rcx,8)
incq %rax
cmpq %rax, %rbx
jne 0x56c0
testq %r13, %r13
jle 0x56f8
xorl %eax, %eax
xorl %ecx, %ecx
addq (%rbp,%rcx,8), %rax
movq %rax, (%r14,%rcx,8)
incq %rcx
cmpq %rcx, %r13
jne 0x56e7
testq %rbx, %rbx
jle 0x5784
movq (%r14), %rax
leaq (%r15,%rax,8), %rax
xorl %esi, %esi
movq -0x8(%r15,%rbx,8), %rcx
testq %rcx, %rcx
jle 0x5725
leaq -0x1(%rcx), %rdx
cmpq $0x8, %r9
jne 0x572f
movq -0x8(%r12,%rcx,8), %rdi
jmp 0x5734
notq %rcx
movq %rcx, -0x8(%r15,%rbx,8)
jmp 0x577f
movzbl (%r12,%rdx), %edi
cmpq %rsi, %rdi
jne 0x573e
movq %rsi, %rdi
jmp 0x5751
subq %r15, %rax
sarq $0x3, %rax
movq %rax, (%r14,%rsi,8)
movq (%r14,%rdi,8), %rax
leaq (%r15,%rax,8), %rax
testq %rdx, %rdx
je 0x576e
cmpq $0x8, %r9
jne 0x5763
movq -0x10(%r12,%rcx,8), %rsi
jmp 0x5769
movzbl -0x2(%r12,%rcx), %esi
cmpq %rdi, %rsi
jle 0x5774
negq %rcx
movq %rcx, %rdx
movq %rdx, -0x8(%rax)
addq $-0x8, %rax
movq %rdi, %rsi
decq %rbx
jg 0x570a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop