// File: /workspace/github_c_makefile_star2_O0/fukunagatsu[P]RIblast/sais.c
// Function: LMSsort2
static
void
LMSsort2(const void *T, sais_index_type *SA,
         sais_index_type *C, sais_index_type *B, sais_index_type *D,
         sais_index_type n, sais_index_type k, int cs) {
  sais_index_type *b, i, j, t, d;
  sais_index_type c0, c1;
  assert(C != B);

  /* compute SAl */
  getBuckets(C, B, k, 0); /* find starts of buckets */
  j = n - 1;
  b = SA + B[c1 = chr(j)];
  --j;
  t = (chr(j) < c1);
  j += n;
  *b++ = (t & 1) ? ~j : j;
  for(i = 0, d = 0; i < n; ++i) {
    if(0 < (j = SA[i])) {
      if(n <= j) { d += 1; j -= n; }
      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;
      t = c0; t = (t << 1) | (chr(j) < c1);
      if(D[t] != d) { j += n; D[t] = d; }
      *b++ = (t & 1) ? ~j : j;
      SA[i] = 0;
    } else if(j < 0) {
      SA[i] = ~j;
    }
  }
  for(i = n - 1; 0 <= i; --i) {
    if(0 < SA[i]) {
      if(SA[i] < n) {
        SA[i] += n;
        for(j = i - 1; SA[j] < n; --j) { }
        SA[j] -= n;
        i = j;
      }
    }
  }

  /* compute SAs */
  getBuckets(C, B, k, 1); /* find ends of buckets */
  for(i = n - 1, d += 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
    if(0 < (j = SA[i])) {
      if(n <= j) { d += 1; j -= n; }
      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;
      t = c0; t = (t << 1) | (chr(j) > c1);
      if(D[t] != d) { j += n; D[t] = d; }
      *--b = (t & 1) ? ~(j + 1) : j;
      SA[i] = 0;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
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)
movl %r9d, -0x2c(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x360c5
jmp 0x360e4
leaq 0x2d46(%rip), %rdi      # 0x38e12
leaq 0x2ca9(%rip), %rsi      # 0x38d7c
movl $0x9d, %edx
leaq 0x2d3a(%rip), %rcx      # 0x38e19
callq 0x31c0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl 0x10(%rbp), %edx
xorl %ecx, %ecx
callq 0x35fe0
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x36129
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x64(%rbp)
jmp 0x36138
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
movl -0x64(%rbp), %edx
movl %edx, -0x50(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x3617b
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
jmp 0x3618a
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x50(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movl -0x2c(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x44(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x361ba
movl -0x40(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x361c0
movl -0x40(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x38(%rbp)
movl %ecx, (%rax)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x36452
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, -0x40(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x36429
movl -0x2c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jg 0x36222
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x2c(%rbp), %ecx
movl -0x40(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x40(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x3623c
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x70(%rbp)
jmp 0x3624b
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x74(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x36270
movq -0x8(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x78(%rbp)
jmp 0x36284
movq -0x8(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %eax
movl -0x78(%rbp), %ecx
cmpl %ecx, %eax
jl 0x36290
jmp 0x362af
leaq 0x2bc9(%rip), %rdi      # 0x38e60
leaq 0x2ade(%rip), %rsi      # 0x38d7c
movl $0xaa, %edx
leaq 0x2b6f(%rip), %rcx      # 0x38e19
callq 0x31c0
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x362c9
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
jmp 0x362d8
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl -0x50(%rbp), %eax
je 0x3631f
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq -0x50(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x4c(%rbp), %edx
movl %edx, -0x50(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movslq -0x3c(%rbp), %rax
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rdx
subq %rdx, %rcx
sarq $0x2, %rcx
cmpq %rcx, %rax
jge 0x36339
jmp 0x36358
leaq 0x2b35(%rip), %rdi      # 0x38e75
leaq 0x2a35(%rip), %rsi      # 0x38d7c
movl $0xac, %edx
leaq 0x2ac6(%rip), %rcx      # 0x38e19
callq 0x31c0
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shll %eax
movl %eax, -0x80(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x3638c
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x84(%rbp)
jmp 0x3639e
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x84(%rbp)
movl -0x80(%rbp), %eax
movl -0x84(%rbp), %ecx
cmpl -0x50(%rbp), %ecx
setl %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x48(%rbp), %eax
je 0x363df
movl -0x2c(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x48(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x363f8
movl -0x40(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x36401
movl -0x40(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x38(%rbp)
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x36442
cmpl $0x0, -0x40(%rbp)
jge 0x36440
movl -0x40(%rbp), %edx
xorl $-0x1, %edx
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x36442
jmp 0x36444
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x361e2
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
xorl %eax, %eax
cmpl -0x3c(%rbp), %eax
jg 0x364e7
movq -0x10(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
xorl %eax, %eax
cmpl (%rcx,%rdx,4), %eax
jge 0x364d7
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x2c(%rbp), %eax
jge 0x364d5
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x2c(%rbp), %eax
jge 0x364bc
jmp 0x364b1
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x3649f
movl -0x2c(%rbp), %esi
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %edx
subl %esi, %edx
movl %edx, (%rax,%rcx,4)
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x364d7
jmp 0x364d9
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3645b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl 0x10(%rbp), %edx
movl $0x1, %ecx
callq 0x35fe0
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x0, -0x50(%rbp)
movslq (%rcx), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpl -0x3c(%rbp), %eax
jg 0x367aa
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movl %ecx, -0x40(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jge 0x3679a
movl -0x2c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jg 0x3656a
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x2c(%rbp), %ecx
movl -0x40(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x40(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x36587
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x8c(%rbp)
jmp 0x36599
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0x90(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x365c7
movq -0x8(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x94(%rbp)
jmp 0x365de
movq -0x8(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x94(%rbp)
movl -0x90(%rbp), %eax
movl -0x94(%rbp), %ecx
cmpl %ecx, %eax
jg 0x365f0
jmp 0x3660f
leaq 0x288b(%rip), %rdi      # 0x38e82
leaq 0x277e(%rip), %rsi      # 0x38d7c
movl $0xc6, %edx
leaq 0x280f(%rip), %rcx      # 0x38e19
callq 0x31c0
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x3662c
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x98(%rbp)
jmp 0x3663e
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl -0x50(%rbp), %eax
je 0x36688
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movslq -0x50(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x4c(%rbp), %edx
movl %edx, -0x50(%rbp)
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
movslq -0x3c(%rbp), %rcx
cmpq %rcx, %rax
jg 0x366a2
jmp 0x366c1
leaq 0x27ee(%rip), %rdi      # 0x38e97
leaq 0x26cc(%rip), %rsi      # 0x38d7c
movl $0xc8, %edx
leaq 0x275d(%rip), %rcx      # 0x38e19
callq 0x31c0
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shll %eax
movl %eax, -0x9c(%rbp)
movslq 0x18(%rbp), %rax
cmpq $0x4, %rax
jne 0x366f8
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xa0(%rbp)
jmp 0x3670a
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0xa0(%rbp)
movl -0x9c(%rbp), %eax
movl -0xa0(%rbp), %ecx
cmpl -0x50(%rbp), %ecx
setg %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x48(%rbp), %eax
je 0x3674e
movl -0x2c(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x48(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3676a
movl -0x40(%rbp), %eax
addl $0x1, %eax
xorl $-0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x36773
movl -0x40(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $-0x4, %rdx
movq %rdx, -0x38(%rbp)
movl %ecx, -0x4(%rax)
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x3679c
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3652b
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)