// File: sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h
// Function: sssort64(unsigned char const*, long long const*, long long*, long long*, long long*, long long, long long, long long, int)
void
sssort(const sauchar_t *T, const sastore_t*PA,
       sastore_t *first, sastore_t*last,
       sastore_t *buf, saidx_t bufsize,
       saidx_t depth, saidx_t n, saint_t lastsuffix) {
  sastore_t *a;
#if SS_BLOCKSIZE != 0
  sastore_t *b, *middle, *curbuf;
  saidx_t j, k, curbufsize, limit;
#endif
  saidx_t i;

  if(lastsuffix != 0) { ++first; }

#if SS_BLOCKSIZE == 0
  ss_mintrosort(T, PA, first, last, depth);
#else
  if((bufsize < SS_BLOCKSIZE) &&
      (bufsize < (last - first)) &&
      (bufsize < (limit = ss_isqrt((saidx_t)(last - first))))) {
    if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; }
    buf = middle = last - limit, bufsize = limit;
  } else {
    middle = last, limit = 0;
  }
  for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) {
#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
    ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth);
#elif 1 < SS_BLOCKSIZE
    ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth);
#endif
    curbufsize = (saidx_t)(last - (a + SS_BLOCKSIZE));
    curbuf = a + SS_BLOCKSIZE;
    if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; }
    for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) {
      ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth);
    }
  }
#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
  ss_mintrosort(T, PA, a, middle, depth);
#elif 1 < SS_BLOCKSIZE
  ss_insertionsort(T, PA, a, middle, depth);
#endif
  for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) {
    if(i & 1) {
      ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth);
      a -= k;
    }
  }
  if(limit != 0) {
#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE
    ss_mintrosort(T, PA, middle, last, depth);
#elif 1 < SS_BLOCKSIZE
    ss_insertionsort(T, PA, middle, last, depth);
#endif
    ss_inplacemerge(T, PA, first, middle, last, depth);
  }
#endif

  if(lastsuffix != 0) {
    /* Insert last type B* suffix. */
    sastore_t PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2;
    for(a = first, i = *(first - 1);
        (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth)));
        ++a) {
      *(a - 1) = *a;
    }
    *(a - 1) = i;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0x52c80
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
cmpq $0x400, -0x30(%rbp)     # imm = 0x400
jge 0x52d0e
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jge 0x52d0e
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
subq %rax, %rdi
sarq $0x3, %rdi
callq 0x53040
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x70(%rbp)
cmpq %rcx, %rax
jge 0x52d0e
movl $0x400, %eax            # imm = 0x400
cmpq -0x70(%rbp), %rax
jge 0x52ceb
movq $0x400, -0x70(%rbp)     # imm = 0x400
movq -0x20(%rbp), %rax
xorl %ecx, %ecx
subq -0x70(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x28(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x52d1e
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
subq %rax, %rcx
sarq $0x3, %rcx
movl $0x400, %eax            # imm = 0x400
cmpq %rcx, %rax
jge 0x52e6d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x38(%rbp), %rcx
addq $0x2000, %rcx           # imm = 0x2000
movq 0x10(%rbp), %r8
callq 0x53270
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $0x2000, %rcx           # imm = 0x2000
subq %rcx, %rax
sarq $0x3, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
addq $0x2000, %rax           # imm = 0x2000
movq %rax, -0x50(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x30(%rbp), %rax
jg 0x52dad
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x400, -0x60(%rbp)     # imm = 0x400
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x52e4c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
xorl %eax, %eax
subq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x40(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r8
movq -0x50(%rbp), %r9
movq -0x68(%rbp), %r10
movq 0x10(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x54a50
movq -0x60(%rbp), %rdx
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
sarq %rax
movq %rax, -0x58(%rbp)
jmp 0x52dc5
jmp 0x52e4e
movq -0x38(%rbp), %rax
addq $0x2000, %rax           # imm = 0x2000
movq %rax, -0x38(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x52d2e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq 0x10(%rbp), %r8
callq 0x53270
movq $0x400, -0x60(%rbp)     # imm = 0x400
cmpq $0x0, -0x78(%rbp)
je 0x52f13
movq -0x78(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x52ef6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %eax, %eax
subq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x38(%rbp), %rcx
movq -0x48(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x30(%rbp), %r10
movq 0x10(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x54a50
movq -0x60(%rbp), %rdx
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x52ef8
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x60(%rbp)
movq -0x78(%rbp), %rax
sarq %rax
movq %rax, -0x78(%rbp)
jmp 0x52e8e
cmpq $0x0, -0x70(%rbp)
je 0x52f50
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq 0x10(%rbp), %r8
callq 0x53270
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %r8
movq 0x10(%rbp), %r9
callq 0x55800
cmpl $0x0, 0x20(%rbp)
je 0x53031
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq -0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
movq 0x18(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x99(%rbp)
jae 0x52ff9
movq -0x38(%rbp), %rcx
movb $0x1, %al
cmpq $0x0, (%rcx)
movb %al, -0x9a(%rbp)
jl 0x52fed
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x38(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq 0x10(%rbp), %rcx
callq 0x55a20
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
setl %al
movb %al, -0x9a(%rbp)
movb -0x9a(%rbp), %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x53005
jmp 0x53025
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, -0x8(%rax)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
jmp 0x52f94
movq -0x78(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, -0x8(%rax)
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)