// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]lyndon-array/external/sacak-lyndon.c
// Function: putSubstr0
void putSubstr0(int_t *SA,
  int_t *s, int_t *bkt,
  int_t n, unsigned int K, int cs) {
  int_t i, cur_t, succ_t;

  // find the end of each bucket.
  getBuckets_k(s, bkt, n, K, true, cs);

  // set each item in SA as empty.
  for(i=0; i<n; i++) SA[i]=0;

  succ_t=0; // s[n-2] must be L-type.
  for(i=n-2; i>0; i--) {
    cur_t=(chr(i-1)<chr(i) ||
           (chr(i-1)==chr(i) && succ_t==1)
          )?1:0;
    if(cur_t==0 && succ_t==1) SA[bkt[chr(i)]--]=i;
    succ_t=cur_t;
  }

  // set the single sentinel LMS-substring.
  SA[0]=n-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movl -0x24(%rbp), %r9d
movl $0x1, %r8d
callq 0x85e0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x9665
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9643
movl $0x0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x980c
movslq -0x24(%rbp), %rax
cmpq $0x4, %rax
jne 0x969e
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
jmp 0x96b2
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movslq -0x24(%rbp), %rax
cmpq $0x4, %rax
jne 0x96d2
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
jmp 0x96e1
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, -0x3d(%rbp)
jl 0x9775
movslq -0x24(%rbp), %rax
cmpq $0x4, %rax
jne 0x9713
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
jmp 0x9727
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movslq -0x24(%rbp), %rax
cmpq $0x4, %rax
jne 0x9747
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
jmp 0x9756
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x4d(%rbp)
jne 0x976f
cmpl $0x1, -0x30(%rbp)
sete %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x97f8
cmpl $0x1, -0x30(%rbp)
jne 0x97f8
movl -0x28(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movslq -0x24(%rbp), %rax
cmpq $0x4, %rax
jne 0x97c4
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
jmp 0x97d3
movq -0x10(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movl -0x64(%rbp), %edx
movq -0x58(%rbp), %rsi
movl -0x68(%rbp), %ecx
movslq %ecx, %rdi
movl (%rsi,%rdi,4), %ecx
movl %ecx, %r8d
addl $-0x1, %r8d
movl %r8d, (%rsi,%rdi,4)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9675
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nop