// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/sais.c
// Function: LMSpostproc2
static
sais_index_type
LMSpostproc2(sais_index_type *SA, sais_index_type n, sais_index_type m) {
  sais_index_type i, j, d, name;

  /* compact all the sorted LMS substrings into the first m items of SA */
  assert(0 < n);
  for(i = 0, name = 0; (j = SA[i]) < 0; ++i) {
    j = ~j;
    if(n <= j) { name += 1; }
    SA[i] = j;
    assert((i + 1) < n);
  }
  if(i < m) {
    for(d = i, ++i;; ++i) {
      assert(i < n);
      if((j = SA[i]) < 0) {
        j = ~j;
        if(n <= j) { name += 1; }
        SA[d++] = j; SA[i] = 0;
        if(d == m) { break; }
      }
    }
  }
  if(name < m) {
    /* store the lexicographic names */
    for(i = m - 1, d = name + 1; 0 <= i; --i) {
      if(n <= (j = SA[i])) { j -= n; --d; }
      SA[m + (j >> 1)] = d;
    }
  } else {
    /* unset flags */
    for(i = 0; i < m; ++i) {
      if(n <= (j = SA[i])) { j -= n; SA[i] = j; }
    }
  }

  return name;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
xorl %eax, %eax
cmpl -0xc(%rbp), %eax
jge 0x367db
jmp 0x367fa
leaq 0x26c3(%rip), %rdi      # 0x38ea5
leaq 0x2593(%rip), %rsi      # 0x38d7c
movl $0xd7, %edx
leaq 0x26b6(%rip), %rcx      # 0x38eab
callq 0x31c0
movl $0x0, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jge 0x3687c
movl -0x18(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x18(%rbp), %eax
jg 0x36835
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl -0xc(%rbp), %eax
jge 0x36850
jmp 0x3686f
leaq 0x2676(%rip), %rdi      # 0x38ecd
leaq 0x251e(%rip), %rsi      # 0x38d7c
movl $0xdc, %edx
leaq 0x2641(%rip), %rcx      # 0x38eab
callq 0x31c0
jmp 0x36871
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x36808
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x36932
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x368a1
jmp 0x368c0
leaq 0x2631(%rip), %rdi      # 0x38ed9
leaq 0x24cd(%rip), %rsi      # 0x38d7c
movl $0xe0, %edx
leaq 0x25f0(%rip), %rcx      # 0x38eab
callq 0x31c0
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jge 0x36920
movl -0x18(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x18(%rbp), %eax
jg 0x368ed
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %edx
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x3691e
jmp 0x36930
jmp 0x36920
jmp 0x36922
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x36897
jmp 0x36932
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x369a0
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl -0x14(%rbp), %eax
jg 0x3699e
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x18(%rbp)
cmpl %ecx, %eax
jg 0x3697c
movl -0xc(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movl -0x10(%rbp), %ecx
movl -0x18(%rbp), %esi
sarl %esi
addl %esi, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3694c
jmp 0x369ec
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x369ea
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x18(%rbp)
cmpl %ecx, %eax
jg 0x369dd
movl -0xc(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x369df
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x369a7
jmp 0x369ec
movl -0x20(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)