// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h
// Function: divsufsort64
saint_t
divsufsort(const sauchar_t *T, sastore_t* SA, saidx_t n,int threadNum) {
  saidx_t *bucket_A, *bucket_B;
  saidx_t m;
  saint_t err = 0;

  /* Check arguments. */
  if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; }
  else if(n == 0) { return 0; }
  else if(n == 1) { SA[0] = 0; return 0; }
  else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; }

  bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t));
  bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t));

  /* Suffixsort. */
  if((bucket_A != NULL) && (bucket_B != NULL)) {
    m = sort_typeBstar(T, SA, bucket_A, bucket_B, n, threadNum);
    construct_SA(T, SA, bucket_A, bucket_B, n, m);
  } else {
    err = -2;
  }

  free(bucket_B);
  free(bucket_A);

  return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %sil
orb %al, %sil
testq %rdx, %rdx
sets %al
orb %sil, %al
je 0x21722
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
testq %rdx, %rdx
je 0x2170e
movq %rdi, %r14
cmpq $0x2, %rdx
je 0x2173e
cmpq $0x1, %rdx
jne 0x2175e
andq $0x0, (%rbx)
jmp 0x2170e
movb (%r14), %al
xorl %ecx, %ecx
cmpb 0x1(%r14), %al
setb %cl
movl %ecx, %eax
xorl $0x1, %eax
andq $0x0, (%rbx,%rax,8)
movq $0x1, (%rbx,%rcx,8)
jmp 0x2170e
movq %rcx, 0x18(%rsp)
movq %rdx, 0x8(%rsp)
movl $0x800, %edi            # imm = 0x800
callq 0x4430
movq %rax, %r13
movl $0x80000, %edi          # imm = 0x80000
callq 0x4430
movq %rax, %r12
testq %r13, %r13
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x217a7
xorl %eax, %eax
cmpq $0x100, %rax            # imm = 0x100
je 0x217af
andq $0x0, (%r13,%rax,8)
incq %rax
jmp 0x21794
pushq $-0x2
popq %rbp
jmp 0x21f7b
xorl %eax, %eax
cmpq $0x10000, %rax          # imm = 0x10000
je 0x217c3
andq $0x0, (%r12,%rax,8)
incq %rax
jmp 0x217b1
movq 0x8(%rsp), %rax
leaq -0x1(%rax), %rsi
movzbl -0x1(%r14,%rax), %edx
pushq $-0x1
popq %rcx
movq %rsi, 0x50(%rsp)
testq %rsi, %rsi
js 0x21855
movl %edx, %edi
movl %edx, %edx
incq (%r13,%rdx,8)
movq %rsi, %r8
subq $0x1, %r8
jb 0x2183f
movzbl -0x1(%r14,%rsi), %edx
movl %edx, (%rsp)
movq %r8, %rsi
cmpl %edx, %edi
jle 0x217df
movl %edx, %esi
shll $0x8, %esi
orl %edi, %esi
incq (%r12,%rsi,8)
movq %r8, -0x8(%rbx,%rax,8)
decq %rax
decq %r8
movq %r8, %rsi
testq %rsi, %rsi
js 0x21843
movzbl (%r14,%rsi), %r8d
movl %r8d, (%rsp)
cmpl %r8d, %edx
jb 0x2184a
shll $0x8, %edx
orl %r8d, %edx
incq (%r12,%rdx,8)
decq %rsi
movl %r8d, %edx
jmp 0x2181a
movl %edi, %edx
jmp 0x21845
movl %edx, %edi
movq %rcx, %rsi
jmp 0x2184f
movl %edx, %edi
movl %r8d, %edx
movl %edi, 0x4(%rsp)
jmp 0x217da
movq %r12, %rcx
addq $0x800, %rcx            # imm = 0x800
pushq $0x1
popq %rdx
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
movq %r14, 0x20(%rsp)
cmpq $0x100, %rsi            # imm = 0x100
je 0x218e0
movq (%r13,%rsi,8), %r14
addq %r8, %r14
addq %rdi, %r8
movq %rsi, %r9
shlq $0x8, %r9
movq %r9, %r10
orq %rsi, %r10
addq (%r12,%r10,8), %r14
movq %r8, (%r13,%rsi,8)
movq %rdx, %r10
movq %rcx, %r11
movq %r14, %r8
cmpq $0x100, %r10            # imm = 0x100
je 0x218cc
movl %r10d, %r14d
orl %r9d, %r14d
addq (%r12,%r14,8), %rdi
movq %rdi, 0x10(%rsp)
movq %rdi, (%r12,%r14,8)
addq (%r11), %r8
addq $0x800, %r11            # imm = 0x800
incq %r10
jmp 0x218a1
incq %rsi
addq $0x808, %rcx            # imm = 0x808
incq %rdx
movq 0x20(%rsp), %r14
jmp 0x2186e
movq 0x8(%rsp), %rdx
movq %rdx, %rbp
leaq (%rbx,%rdx,8), %r11
subq %rax, %rbp
jle 0x21ecd
leaq (,%rbp,8), %rcx
movq %r11, %rsi
subq %rcx, %rsi
movq %rsi, 0x60(%rsp)
negq %rax
leaq -0x2(%rdx), %rcx
movq %rax, %rdx
addq %rcx, %rdx
js 0x21949
movq (%rbx,%rcx,8), %rsi
movzbl (%r14,%rsi), %edi
movl %edi, (%rsp)
movzbl 0x1(%r14,%rsi), %esi
movl %esi, 0x4(%rsp)
shll $0xb, %edi
leal (%rdi,%rsi,8), %esi
movq (%r12,%rsi), %rdi
leaq -0x1(%rdi), %r8
movq %r8, (%r12,%rsi)
movq %rdx, -0x8(%rbx,%rdi,8)
decq %rcx
jmp 0x2190f
leaq (%rbx,%rbp,8), %rax
movq %rax, 0x28(%rsp)
leaq -0x1(%rbp), %r15
movq 0x8(%rsp), %rsi
movq -0x8(%rbx,%rsi,8), %rax
movzbl (%r14,%rax), %ecx
movzbl 0x1(%r14,%rax), %eax
movl %eax, 0x4(%rsp)
shll $0xb, %ecx
leal (%rcx,%rax,8), %eax
movq (%r12,%rax), %rcx
leaq -0x1(%rcx), %rdx
movq %rdx, (%r12,%rax)
movq %r15, -0x8(%rbx,%rcx,8)
movq %rsi, %r9
subq %rbp, %r9
subq %rbp, %r9
movq 0x18(%rsp), %rax
cmpl $0x2, %eax
movq %r13, 0x30(%rsp)
movq %r11, 0x58(%rsp)
movq %rbp, 0x38(%rsp)
jl 0x21af8
movl %eax, %ecx
movq %rax, %r13
movq %r9, %rax
cqto
idivq %rcx
movq %rax, 0x40(%rsp)
decl %r13d
movl $0xfe, (%rsp)
movl $0xff, 0x4(%rsp)
movq %rbp, 0x10(%rsp)
callq 0x3f368
movq %rax, 0xa0(%rsp)
movq %r14, 0xa8(%rsp)
movq 0x40(%rsp), %r14
movq %rbx, 0xb0(%rsp)
movq %r12, 0xb8(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %r14, 0xc8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq %rbp, 0xd8(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %r13, %rsi
callq 0x11f04
shlq $0x3, %r13
movq %r13, 0x18(%rsp)
xorl %r13d, %r13d
leaq 0xe0(%rsp), %rbp
shlq $0x3, %r14
movq 0x28(%rsp), %rcx
movq %rcx, 0x48(%rsp)
cmpq %r13, 0x18(%rsp)
je 0x21ba8
movq %rsp, %rax
movq %rax, 0x80(%rsp)
leaq 0x4(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x68(%rsp)
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0x3c44(%rip), %rsi      # 0x256e9
leaq 0x88(%rsp), %rdx
leaq 0x80(%rsp), %rcx
leaq 0x78(%rsp), %r8
leaq 0x50(%rsp), %r9
leaq 0x70(%rsp), %rax
pushq %rax
callq 0x25c06
popq %rax
popq %rcx
movq 0x88(%rsp), %rdi
addq %r13, %rdi
movq %rbp, %rsi
callq 0x11f56
movq %rbp, %rdi
callq 0x11f70
movq 0x48(%rsp), %rcx
addq %r14, %rcx
addq $0x8, %r13
jmp 0x21a5b
movl $0xfe, (%rsp)
movq %rbp, 0x10(%rsp)
movl $0xfe, %edx
movq %rbp, %rax
testq %rax, %rax
jle 0x21bff
movl %edx, %esi
shll $0x8, %esi
movl $0xff, %r14d
movl %edx, 0x18(%rsp)
movl %esi, 0x40(%rsp)
cmpl %r14d, %edx
jge 0x21b99
movl %r14d, %ecx
orl %esi, %ecx
movslq %ecx, %rcx
movq (%r12,%rcx,8), %rbp
movq %rax, %rcx
subq %rbp, %rcx
cmpq $0x2, %rcx
jl 0x21b8c
leaq (%rbx,%rbp,8), %rdx
leaq (%rbx,%rax,8), %rcx
xorl %eax, %eax
cmpq %r15, (%rdx)
sete %al
subq $0x8, %rsp
movq 0x28(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x30(%rsp), %r8
pushq %rax
pushq 0x18(%rsp)
pushq $0x2
movq %r12, %r13
movq %r9, %r12
callq 0x220be
movl 0x60(%rsp), %esi
movl 0x38(%rsp), %edx
movq %r12, %r9
movq %r13, %r12
addq $0x20, %rsp
movq %rbp, 0x10(%rsp)
decl %r14d
movq %rbp, %rax
jmp 0x21b28
movl %r14d, 0x4(%rsp)
decl %edx
movl %edx, (%rsp)
jmp 0x21b0c
movq %rsp, %rdi
leaq 0x4(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0xa0(%rsp), %r8
callq 0x256e9
xorl %r14d, %r14d
movq 0x18(%rsp), %r13
cmpq %r14, %r13
je 0x21be5
movq 0x88(%rsp), %rdi
addq %r14, %rdi
callq 0x45a0
addq $0x8, %r14
jmp 0x21bca
leaq 0x88(%rsp), %rdi
callq 0x11f7e
leaq 0xa0(%rsp), %rdi
callq 0x1bde8
movq %r15, %rax
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %rdi
testq %rax, %rax
js 0x21c76
movq (%rbx,%rax,8), %rcx
testq %rcx, %rcx
js 0x21c46
movq %rax, 0x10(%rsp)
xorl %esi, %esi
movq %rax, %rdx
movq %rdx, (%rdi,%rcx,8)
subq $0x1, %rdx
jb 0x21c70
movq (%rbx,%rdx,8), %rcx
decq %rsi
testq %rcx, %rcx
jns 0x21c24
movq %rsi, 0x8(%rbx,%rdx,8)
testq %rdx, %rdx
jne 0x21c49
jmp 0x21c76
movq %rax, %rdx
movq %rdx, 0x10(%rsp)
leaq -0x1(%rdx), %rax
notq %rcx
movq %rcx, 0x8(%rbx,%rax,8)
movq %rdx, (%rdi,%rcx,8)
movq (%rbx,%rax,8), %rcx
decq %rax
testq %rcx, %rcx
js 0x21c52
movq %rdx, (%rdi,%rcx,8)
jmp 0x21c0c
notq %rax
movq %rax, (%rbx)
pushq $0x1
popq %r13
movq %rbx, %rsi
movq 0x38(%rsp), %rdx
movq %r13, %rcx
callq 0x23e54
movq 0x58(%rsp), %r11
movq 0x50(%rsp), %rcx
movzbl (%r14,%rcx), %edi
pushq $-0x1
popq %rax
testq %rcx, %rcx
js 0x21d16
movq %rcx, %rdx
subq $0x1, %rdx
jb 0x21cda
movzbl -0x1(%r14,%rcx), %esi
movq %rdx, %rcx
cmpl %esi, %edi
movl %esi, %edi
jle 0x21ca4
leaq -0x1(%rdx), %rcx
movq %r13, %rdi
testq %rcx, %rcx
js 0x21ce2
movzbl (%r14,%rcx), %r8d
cmpl %r8d, %esi
jb 0x21cdf
decq %rcx
incq %rdi
movl %r8d, %esi
jmp 0x21cc0
movq %rax, %rcx
jmp 0x21c9c
movl %r8d, %esi
cmpq $0x2, %rdi
movq %rdx, %rdi
notq %rdi
cmovgeq %rdx, %rdi
testq %rdx, %rdx
cmoveq %rdx, %rdi
movq 0x38(%rsp), %r8
movq 0x28(%rsp), %rdx
movq -0x8(%rdx,%r8,8), %rdx
decq %r8
movq %r8, 0x38(%rsp)
movq %rdi, (%rbx,%rdx,8)
movl %esi, %edi
jmp 0x21c9c
movq 0x8(%rsp), %rax
movq %rax, 0x7fff8(%r12)
movl $0xfe, %eax
movq 0x30(%rsp), %r13
testl %eax, %eax
js 0x21dac
movl %eax, %ecx
movq 0x8(%r13,%rcx,8), %rdx
decq %rdx
movl %eax, %ecx
shll $0x8, %ecx
movl $0xff, %esi
cmpl %esi, %eax
jge 0x21d85
movl %esi, %edi
shll $0x8, %edi
orl %eax, %edi
movslq %edi, %rdi
movq %rdx, %r8
subq (%r12,%rdi,8), %r8
movq %rdx, (%r12,%rdi,8)
movl %esi, %edx
orl %ecx, %edx
movslq %edx, %rdx
movq (%r12,%rdx,8), %rdi
movq %r8, %rdx
cmpq %r15, %rdi
jg 0x21d81
movq (%rbx,%r15,8), %r8
movq %r8, (%rbx,%rdx,8)
decq %rdx
decq %r15
jmp 0x21d6c
decl %esi
jmp 0x21d45
movl %ecx, %esi
orl %eax, %esi
movslq %esi, %rsi
movq %rdx, %rdi
subq (%r12,%rsi,8), %rdi
incq %rdi
leal 0x1(%rax), %r8d
orl %ecx, %r8d
movslq %r8d, %rcx
movq %rdi, (%r12,%rcx,8)
movq %rdx, (%r12,%rsi,8)
decl %eax
jmp 0x21d2d
movl $0xfe, %eax
pushq $-0x1
popq %rcx
testl %eax, %eax
js 0x21ecd
movl %eax, %edx
shll $0x8, %edx
leal 0x1(%rax), %esi
orl %edx, %esi
movslq %esi, %rsi
movq (%r12,%rsi,8), %rsi
leaq (%rbx,%rsi,8), %rsi
movl %eax, %edi
movq 0x8(%r13,%rdi,8), %rdi
leaq (%rbx,%rdi,8), %rdi
movslq %edx, %r8
xorl %r9d, %r9d
movl %ecx, %r10d
addq $-0x8, %rdi
cmpq %rdi, %rsi
ja 0x21ec1
movq (%rdi), %r15
movq %r15, %r11
notq %r11
testq %r15, %r15
jg 0x21e13
jne 0x21e0e
movzbl (%r14), %ebp
cmpl %ebp, %eax
jne 0x21f90
movq %r11, (%rdi)
jmp 0x21de5
movzbl (%r14,%r15), %ebp
cmpl %ebp, %eax
jne 0x2200c
leaq 0x1(%r15), %r14
cmpq 0x8(%rsp), %r14
movq 0x20(%rsp), %r13
jge 0x21faf
cmpb (%r13,%r14), %bpl
ja 0x21faf
cmpb %bpl, -0x1(%r13,%r15)
ja 0x2202b
movq %r11, (%rdi)
movzbl -0x1(%r13,%r15), %r11d
cmpq $0x1, %r15
jne 0x21e5e
xorl %r14d, %r14d
jmp 0x21e71
movq %r15, %r14
negq %r14
cmpb %r11b, -0x2(%r13,%r15)
leaq -0x1(%r15), %r15
cmovbeq %r15, %r14
movq 0x30(%rsp), %r13
cmpl %r11d, %r10d
jne 0x21e80
movl %r10d, %r11d
jmp 0x21ea4
testl %r10d, %r10d
js 0x21e96
subq %rbx, %r9
sarq $0x3, %r9
orl %edx, %r10d
movslq %r10d, %r10
movq %r9, (%r12,%r10,8)
movq %r8, %r9
orq %r11, %r9
movq (%r12,%r9,8), %r9
leaq (%rbx,%r9,8), %r9
cmpq %rdi, %r9
jae 0x2204a
movq %r14, (%r9)
addq $-0x8, %r9
movl %r11d, %r10d
movq 0x20(%rsp), %r14
jmp 0x21de5
decl %eax
movq 0x58(%rsp), %r11
jmp 0x21db4
movq 0x8(%rsp), %rcx
movzbl -0x1(%r14,%rcx), %edx
movq %rcx, %rax
negq %rax
cmpb %dl, -0x2(%r14,%rcx)
movq 0x50(%rsp), %rsi
cmovbq %rax, %rsi
movq (%r13,%rdx,8), %rax
leaq (%rbx,%rax,8), %rcx
addq $0x8, %rcx
movq %rsi, -0x8(%rcx)
movq %rbx, %rax
cmpq %r11, %rax
jae 0x21f79
movq (%rax), %r8
testq %r8, %r8
jle 0x21f3a
movzbl -0x1(%r14,%r8), %esi
cmpb (%r14,%r8), %sil
jb 0x21fce
movq %r8, %rdi
decq %rdi
je 0x21f2c
cmpb %sil, -0x2(%r14,%r8)
jae 0x21f32
negq %r8
movq %r8, %rdi
cmpl %esi, %edx
jne 0x21f48
movl %edx, %esi
jmp 0x21f61
jns 0x22069
notq %r8
movq %r8, (%rax)
jmp 0x21f73
subq %rbx, %rcx
sarq $0x3, %rcx
movl %edx, %edx
movq %rcx, (%r13,%rdx,8)
movl %esi, %ecx
movq (%r13,%rcx,8), %rcx
leaq (%rbx,%rcx,8), %rcx
cmpq %rcx, %rax
jae 0x21fed
movq %rdi, (%rcx)
addq $0x8, %rcx
movl %esi, %edx
addq $0x8, %rax
jmp 0x21f00
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x43d0
movq %r13, %rdi
callq 0x43d0
jmp 0x2170e
leaq 0x317e8(%rip), %rdi     # 0x5377f
leaq 0x316ff(%rip), %rsi     # 0x5369d
leaq 0x31745(%rip), %rcx     # 0x536ea
movl $0xfd, %edx
callq 0x4230
leaq 0x3178e(%rip), %rdi     # 0x53744
leaq 0x316e0(%rip), %rsi     # 0x5369d
leaq 0x31726(%rip), %rcx     # 0x536ea
movl $0xf1, %edx
callq 0x4230
leaq 0x317d0(%rip), %rdi     # 0x537a5
leaq 0x316c1(%rip), %rsi     # 0x5369d
leaq 0x31707(%rip), %rcx     # 0x536ea
movl $0x10b, %edx            # imm = 0x10B
callq 0x4230
leaq 0x317c2(%rip), %rdi     # 0x537b6
leaq 0x316a2(%rip), %rsi     # 0x5369d
leaq 0x316e8(%rip), %rcx     # 0x536ea
movl $0x112, %edx            # imm = 0x112
callq 0x4230
leaq 0x3167f(%rip), %rdi     # 0x53692
leaq 0x31683(%rip), %rsi     # 0x5369d
leaq 0x316c9(%rip), %rcx     # 0x536ea
movl $0xf0, %edx
callq 0x4230
leaq 0x31736(%rip), %rdi     # 0x53768
leaq 0x31664(%rip), %rsi     # 0x5369d
leaq 0x316aa(%rip), %rcx     # 0x536ea
movl $0xf2, %edx
callq 0x4230
leaq 0x31728(%rip), %rdi     # 0x53779
leaq 0x31645(%rip), %rsi     # 0x5369d
leaq 0x3168b(%rip), %rcx     # 0x536ea
movl $0xfa, %edx
callq 0x4230
leaq 0x3174c(%rip), %rdi     # 0x537bc
leaq 0x31626(%rip), %rsi     # 0x5369d
leaq 0x3166c(%rip), %rcx     # 0x536ea
movl $0x115, %edx            # imm = 0x115
callq 0x4230
jmp 0x22091
movq %rax, %rbx
jmp 0x220a1
jmp 0x22091
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x11f7e
leaq 0xa0(%rsp), %rdi
callq 0x1bde8
movq %rbx, %rdi
callq 0x4600