// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r15
movq %r8, 0x38(%rsp)
movq %rcx, %rbp
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x8(%rdx), %r12
movq %r12, 0x50(%rsp)
cmpl $0x0, 0xc0(%rsp)
cmoveq %rdx, %r12
cmpq $0x3ff, %r9             # imm = 0x3FF
movq %rcx, 0x20(%rsp)
movq %rdx, 0x48(%rsp)
jg 0x22271
movq %rbp, %rcx
subq %r12, %rcx
movq %rcx, %rbx
sarq $0x3, %rbx
cmpq %r15, %rbx
jle 0x22271
movl $0x400, %eax            # imm = 0x400
cmpq $0xfffff, %rbx          # imm = 0xFFFFF
jg 0x22245
movabsq $0x7f8000000, %rax      # imm = 0x7F8000000
leaq 0x7f80000(%rax), %rdx
testq %rdx, %rcx
je 0x22164
testq %rax, %rcx
je 0x2217e
movl %ebx, %eax
shrl $0x18, %eax
leaq 0x318c4(%rip), %rcx     # 0x53a20
movl (%rcx,%rax,4), %ecx
addl $0x18, %ecx
jmp 0x221a4
testl $0x7f800, %ecx          # imm = 0x7F800
je 0x22197
movzbl %bh, %eax
leaq 0x318aa(%rip), %rcx     # 0x53a20
movl (%rcx,%rax,4), %ecx
addl $0x8, %ecx
jmp 0x221a4
movl %ebx, %eax
shrl $0xe, %eax
andl $0x3fc, %eax            # imm = 0x3FC
leaq 0x31891(%rip), %rcx     # 0x53a20
movl (%rax,%rcx), %ecx
addl $0x10, %ecx
jmp 0x221a4
movzbl %bl, %eax
leaq 0x3187f(%rip), %rcx     # 0x53a20
movl (%rcx,%rax,4), %ecx
movl %ecx, %eax
cmpl $0x10, %ecx
jl 0x221f8
movl %eax, %ecx
andb $-0x2, %cl
addb $-0x6, %cl
movq %rbx, %rdx
sarq %cl, %rdx
leaq 0x31c60(%rip), %rcx     # 0x53e20
movl (%rcx,%rdx,4), %edx
movl %eax, %ecx
shrl %ecx
addb $-0x7, %cl
shll %cl, %edx
movslq %edx, %rcx
cmpl $0x18, %eax
jb 0x221e5
movq %rbx, %rax
cqto
idivq %rcx
addq %rax, %rcx
incq %rcx
sarq %rcx
movq %rbx, %rax
cqto
idivq %rcx
addq %rcx, %rax
incq %rax
sarq %rax
jmp 0x22222
cmpl $0x8, %eax
jl 0x22236
movl %eax, %ecx
andb $-0x2, %cl
addb $-0x6, %cl
movq %rbx, %rdx
sarq %cl, %rdx
leaq 0x31c0e(%rip), %rcx     # 0x53e20
movl (%rcx,%rdx,4), %edx
shrl %eax
movb $0x7, %cl
subb %al, %cl
sarl %cl, %edx
incl %edx
movslq %edx, %rax
movq %rax, %rcx
imulq %rax, %rcx
xorl %edx, %edx
cmpq %rbx, %rcx
setg %dl
subq %rdx, %rax
jmp 0x22245
leaq 0x31be3(%rip), %rax     # 0x53e20
movl (%rax,%rbx,4), %eax
sarl $0x4, %eax
cltq
cmpq %r15, %rax
jle 0x22271
movl $0x400, %r15d           # imm = 0x400
cmpq %r15, %rax
cmovlq %rax, %r15
leaq (,%r15,8), %rcx
subq %rcx, %rbp
testq %rax, %rax
sete 0x7(%rsp)
movq %rbp, 0x38(%rsp)
jmp 0x22276
movb $0x1, 0x7(%rsp)
xorl %r13d, %r13d
movq %r12, 0x40(%rsp)
movq %rbp, 0x18(%rsp)
movq %r15, 0x58(%rsp)
movq %rbp, %rax
subq %r12, %rax
cmpq $0x2001, %rax           # imm = 0x2001
jl 0x2234f
leaq 0x2000(%r12), %rbx
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
movq 0xb0(%rsp), %r8
callq 0x2263c
movq 0x20(%rsp), %r14
subq %rbx, %r14
sarq $0x3, %r14
cmpq %r15, %r14
movq 0x38(%rsp), %rbp
movq %rbx, 0x28(%rsp)
cmovgq %rbx, %rbp
cmovleq %r15, %r14
movl $0x400, %r15d           # imm = 0x400
movq %r13, 0x30(%rsp)
testb $0x1, %r13b
je 0x22333
leaq (,%r15,8), %rax
movq %r12, %rbx
subq %rax, %rbx
leaq (%r12,%r15,8), %r8
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
movq %rbp, %r9
pushq 0xb0(%rsp)
pushq %r14
callq 0x23315
addq $0x10, %rsp
addq %r15, %r15
shrq %r13
movq %rbx, %r12
jmp 0x222eb
movq 0x30(%rsp), %r13
incq %r13
movq 0x28(%rsp), %r12
movq 0x18(%rsp), %rbp
movq 0x58(%rsp), %r15
jmp 0x22288
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq 0xb0(%rsp), %r8
callq 0x2263c
movl $0x400, %r14d           # imm = 0x400
testq %r13, %r13
je 0x223be
testb $0x1, %r13b
je 0x223b6
leaq (,%r14,8), %rax
movq %r12, %rbx
subq %rax, %rbx
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
movq %rbp, %r8
movq 0x38(%rsp), %r9
pushq 0xb0(%rsp)
pushq %r15
callq 0x23315
popq %rax
popq %rcx
movq %rbx, %r12
addq %r14, %r14
shrq %r13
jmp 0x22372
cmpb $0x0, 0x7(%rsp)
movq 0x20(%rsp), %r12
jne 0x225b2
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq 0xb0(%rsp), %r8
callq 0x2263c
movq %r12, %rcx
movq %rcx, 0x30(%rsp)
movq -0x8(%rcx), %rcx
movq %rcx, %rax
sarq $0x3f, %rax
movq %rcx, 0x28(%rsp)
xorq %rcx, %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
movq %rbp, 0x18(%rsp)
movq %rbp, %r14
movq 0x40(%rsp), %rbp
subq %rbp, %r14
movq %r14, %r12
sarq $0x3, %r12
sarq $0x4, %r14
pushq $-0x1
popq %r15
testq %r12, %r12
jle 0x2248f
leaq 0x8(,%r14,8), %r13
addq %rbp, %r13
movq -0x8(%r13), %rax
movq %rax, %rcx
sarq $0x3f, %rcx
xorq %rax, %rcx
movq 0x8(%rsp), %rax
leaq (%rax,%rcx,8), %rsi
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
movq 0xb0(%rsp), %rcx
callq 0x23df9
notl %r12d
andl $0x1, %r12d
testl %eax, %eax
cmovsq %r13, %rbp
movl $0x0, %ecx
cmovnsq %rcx, %r12
cmovnsl %eax, %r15d
subq %r12, %r14
movq %r14, %r12
sarq %r14
jmp 0x2242e
cmpq 0x18(%rsp), %rbp
jae 0x2255e
testl %r15d, %r15d
movq 0x20(%rsp), %r12
jne 0x224a8
notq (%rbp)
movq 0x18(%rsp), %r14
movq %r14, %rbx
subq %rbp, %rbx
sarq $0x3, %rbx
movq 0x30(%rsp), %r15
movq %r15, %rax
subq %r14, %rax
sarq $0x3, %rax
leaq -0x8(%r14), %rcx
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rdx, %r8
notq %r8
testq %rdx, %rdx
jle 0x22577
testq %rax, %rax
jle 0x22577
cmpq %rax, %rdx
je 0x2256f
jae 0x22523
addq $-0x8, %rsi
movq (%rsi), %r9
movq %rcx, %r10
movq (%r10), %r11
movq %r11, (%rsi)
movq -0x8(%rsi), %r11
addq $-0x8, %rsi
movq %r11, (%r10)
addq $-0x8, %r10
cmpq %rdi, %r10
jae 0x224fc
movq %r9, (%rsi)
addq %r8, %rax
cmpq %rdx, %rax
jg 0x224f2
jmp 0x224d9
movq %rax, %r8
notq %r8
movq (%rdi), %r9
addq $0x8, %rdi
movq %r14, %r10
movq (%r10), %r11
movq %r11, -0x8(%rdi)
movq (%rdi), %r11
movq %r11, (%r10)
addq $0x8, %r10
addq $0x8, %rdi
cmpq %r10, %rsi
ja 0x22533
movq %r9, -0x8(%rdi)
addq %r8, %rdx
cmpq %rax, %rdx
jg 0x22529
jmp 0x224d3
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rbp
movq 0x30(%rsp), %r15
jmp 0x22585
movq %r14, %rsi
callq 0x2592e
cmpq 0x40(%rsp), %rbp
je 0x225b2
shlq $0x3, %rbx
subq %rbx, %r15
movq 0x28(%rsp), %rax
addq $-0x8, %r15
testq %rax, %rax
js 0x22598
movq %r15, %rax
jmp 0x225a6
leaq -0x8(%r15), %rax
cmpq $0x0, -0x8(%r15)
movq %rax, %r15
js 0x22598
movq %rax, %rcx
cmpq %rax, %rbp
jne 0x223ee
cmpl $0x0, 0xc0(%rsp)
je 0x2262d
movq 0x48(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rax
leaq 0x60(%rsp), %rbx
movq %rax, (%rbx)
movq 0xb8(%rsp), %rax
addq $-0x2, %rax
movq %rax, 0x8(%rbx)
movq 0x50(%rsp), %rax
cmpq %r12, %rax
jae 0x22629
movq (%rax), %r15
testq %r15, %r15
js 0x2261f
movq %rax, %r13
movq 0x8(%rsp), %rax
leaq (%rax,%r15,8), %rdx
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq 0xb0(%rsp), %rcx
callq 0x23df9
testl %eax, %eax
movq %r13, %rax
jle 0x22629
movq %r15, -0x8(%rax)
addq $0x8, %rax
jmp 0x225ea
movq %r14, -0x8(%rax)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq