// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/sais.c
// Function: LMSsort1
static
void
LMSsort1(const void *T, sais_index_type *SA,
         sais_index_type *C, sais_index_type *B,
         sais_index_type n, sais_index_type k, int cs) {
  sais_index_type *b, i, j;
  sais_index_type 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)];
  --j;
  *b++ = (chr(j) < c1) ? ~j : j;
  for(i = 0; i < n; ++i) {
    if(0 < (j = SA[i])) {
      assert(chr(j) >= chr(j + 1));
      if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
      assert(i < (b - SA));
      --j;
      *b++ = (chr(j) < c1) ? ~j : j;
      SA[i] = 0;
    } else if(j < 0) {
      SA[i] = ~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])) {
      assert(chr(j) <= chr(j + 1));
      if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
      assert((b - SA) <= i);
      --j;
      *--b = (chr(j) > c1) ? ~(j + 1) : j;
      SA[i] = 0;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x36a47
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl 0x10(%rbp), %r8d
callq 0x35f40
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x28(%rbp), %edx
xorl %ecx, %ecx
callq 0x35fe0
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36a8c
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
jmp 0x36a9b
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
movl -0x54(%rbp), %edx
movl %edx, -0x40(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36ade
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
jmp 0x36aed
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x36b00
movl -0x38(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x36b06
movl -0x38(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %ecx
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x30(%rbp)
movl %ecx, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x36d14
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, -0x38(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x36ceb
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36b5f
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x60(%rbp)
jmp 0x36b6e
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x64(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36b93
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
jmp 0x36ba7
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %eax
movl -0x68(%rbp), %ecx
cmpl %ecx, %eax
jl 0x36bb3
jmp 0x36bd2
leaq 0x22a6(%rip), %rdi      # 0x38e60
leaq 0x21bb(%rip), %rsi      # 0x38d7c
movl $0x50, %edx
leaq 0x2312(%rip), %rcx      # 0x38edf
callq 0x31c0
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36bec
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
jmp 0x36bfb
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpl -0x40(%rbp), %eax
je 0x36c42
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x3c(%rbp), %edx
movl %edx, -0x40(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movslq -0x34(%rbp), %rax
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rdx
subq %rdx, %rcx
sarq $0x2, %rcx
cmpq %rcx, %rax
jge 0x36c5c
jmp 0x36c7b
leaq 0x2212(%rip), %rdi      # 0x38e75
leaq 0x2112(%rip), %rsi      # 0x38d7c
movl $0x52, %edx
leaq 0x2269(%rip), %rcx      # 0x38edf
callq 0x31c0
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36c9e
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x70(%rbp)
jmp 0x36cad
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x36cc0
movl -0x38(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x36cc6
movl -0x38(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %ecx
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x30(%rbp)
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x36d04
cmpl $0x0, -0x38(%rbp)
jge 0x36d02
movl -0x38(%rbp), %edx
xorl $-0x1, %edx
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x36d04
jmp 0x36d06
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x36b21
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x36d35
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl 0x10(%rbp), %r8d
callq 0x35f40
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x28(%rbp), %edx
movl $0x1, %ecx
callq 0x35fe0
movl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x0, -0x40(%rbp)
movslq (%rcx), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpl -0x34(%rbp), %eax
jg 0x36f66
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, -0x38(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x36f56
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36dad
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x78(%rbp)
jmp 0x36dbc
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x7c(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36de1
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x80(%rbp)
jmp 0x36df5
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x80(%rbp)
movl -0x7c(%rbp), %eax
movl -0x80(%rbp), %ecx
cmpl %ecx, %eax
jg 0x36e01
jmp 0x36e20
leaq 0x207a(%rip), %rdi      # 0x38e82
leaq 0x1f6d(%rip), %rsi      # 0x38d7c
movl $0x5f, %edx
leaq 0x20c4(%rip), %rcx      # 0x38edf
callq 0x31c0
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36e3d
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x84(%rbp)
jmp 0x36e4f
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpl -0x40(%rbp), %eax
je 0x36e99
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x3c(%rbp), %edx
movl %edx, -0x40(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movslq -0x34(%rbp), %rcx
cmpq %rcx, %rax
jg 0x36eb3
jmp 0x36ed2
leaq 0x1fdd(%rip), %rdi      # 0x38e97
leaq 0x1ebb(%rip), %rsi      # 0x38d7c
movl $0x61, %edx
leaq 0x2012(%rip), %rcx      # 0x38edf
callq 0x31c0
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movslq 0x10(%rbp), %rax
cmpq $0x4, %rax
jne 0x36ef8
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x88(%rbp)
jmp 0x36f0a
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x40(%rbp), %eax
jle 0x36f26
movl -0x38(%rbp), %eax
addl $0x1, %eax
xorl $-0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x36f2f
movl -0x38(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %ecx
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $-0x4, %rdx
movq %rdx, -0x30(%rbp)
movl %ecx, -0x4(%rax)
movq -0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x36f58
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x36d70
addq $0x90, %rsp
popq %rbp
retq
nop