// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]lyndon-array/external/sacak-lyndon.c
// Function: induceSAs0_LA_17n
void induceSAs0_LA_17n(int_t *SA, int_t *LA, int_t *PREV, int_t *NEXT,
  int_t *s, int_t *bkt,
  int_t n, unsigned int K, int_t suffix, int cs) {
  int_t i, j;

  // find the end of each bucket.
  getBuckets_k(s, bkt, n, K, true, cs);

  for(i=n-1; i>0; i--){

		j=SA[i];

		LA[j]=NEXT[j]-j;	
		NEXT[PREV[j]]=NEXT[j];
		PREV[NEXT[j]]=PREV[j];

    if(SA[i]>0) {

      j=SA[i]-1;
      if(chr(j)<=chr(j+1) && bkt[chr(j)]<i) {
        SA[bkt[chr(j)]]=j;
        bkt[chr(j)]--;
        if(!suffix) SA[i]=0;
      }
    }
	}

	LA[n-1]=1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl 0x10(%rbp), %edx
movl 0x18(%rbp), %ecx
movl 0x28(%rbp), %r9d
movl $0x1, %r8d
callq 0x85e0
movl 0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x9080
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
subl -0x38(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x38(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x9070
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movslq 0x28(%rbp), %rax
cmpq $0x4, %rax
jne 0x8f1f
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
jmp 0x8f2e
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
movslq 0x28(%rbp), %rax
cmpq $0x4, %rax
jne 0x8f53
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
jmp 0x8f67
movq -0x28(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
movl -0x44(%rbp), %ecx
cmpl %ecx, %eax
jg 0x906e
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movslq 0x28(%rbp), %rax
cmpq $0x4, %rax
jne 0x8f97
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
jmp 0x8fa6
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x34(%rbp), %eax
jge 0x906e
movl -0x38(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
movslq 0x28(%rbp), %rax
cmpq $0x4, %rax
jne 0x8fec
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x70(%rbp)
jmp 0x8ffb
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movl -0x6c(%rbp), %edx
movq -0x60(%rbp), %rcx
movl -0x70(%rbp), %esi
movslq %esi, %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movslq 0x28(%rbp), %rax
cmpq $0x4, %rax
jne 0x9035
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
jmp 0x9044
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x7c(%rbp)
movq -0x78(%rbp), %rax
movl -0x7c(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $-0x1, %edx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, 0x20(%rbp)
jne 0x906c
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x906e
jmp 0x9070
jmp 0x9072
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x8e75
movq -0x10(%rbp), %rax
movl 0x10(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl $0x1, (%rax,%rcx,4)
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)