// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h
// Function: divsufsort
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
movl %ecx, %r14d
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
sets %al
orb %cl, %al
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0x2cd8e
testl %edx, %edx
je 0x2c4fe
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x2, %edx
je 0x2c4d8
cmpl $0x1, %edx
jne 0x2c505
movl $0x0, (%rbx)
jmp 0x2c4f7
movb (%r15), %al
xorl %ecx, %ecx
xorl %edx, %edx
cmpb 0x1(%r15), %al
setb %cl
setae %dl
movl $0x0, (%rbx,%rdx,4)
movl $0x1, (%rbx,%rcx,4)
xorl %ebp, %ebp
jmp 0x2cd8e
movl %edx, %ebp
jmp 0x2cd8e
movq %rdx, 0x10(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0x4400
movq %rax, %r13
movl $0x40000, %edi          # imm = 0x40000
callq 0x4400
movq %rax, %r12
testq %r13, %r13
sete %al
testq %r12, %r12
sete %cl
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
orb %al, %cl
jne 0x2cd7e
movl $0x400, %edx            # imm = 0x400
movq %r13, %rdi
xorl %esi, %esi
callq 0x41c0
movl $0x40000, %edx          # imm = 0x40000
movq %r12, %rdi
xorl %esi, %esi
callq 0x41c0
movq 0x10(%rsp), %rax
leal -0x1(%rax), %esi
movzbl (%r15,%rsi), %r8d
movl %eax, %eax
leaq -0x1(%r15), %rcx
movq %rax, 0x28(%rsp)
movq %rsi, 0x58(%rsp)
movl %esi, %edx
movl %edx, %edi
movq %rcx, %r9
xorl %r10d, %r10d
movl %r8d, %esi
movl %esi, %r8d
movl %esi, %esi
incl (%r13,%rsi,4)
cmpq %r10, %rdi
je 0x2c602
movq %r10, %rdx
movzbl (%r9,%rdi), %esi
incq %r10
decq %r9
cmpl %esi, %r8d
jbe 0x2c585
movl %edi, %r9d
subl %r10d, %r9d
movl %esi, %r10d
shll $0x8, %r10d
orl %r8d, %r10d
incl (%r12,%r10,4)
movl %r9d, -0x4(%rbx,%rax,4)
decq %rax
incl %r9d
cmpl $0x2, %r9d
jl 0x2c602
notl %edx
addl %edi, %edx
leal -0x1(%rdx), %edi
movzbl (%r15,%rdi), %r8d
cmpl %r8d, %esi
jb 0x2c5f2
shll $0x8, %esi
orl %r8d, %esi
incl (%r12,%rsi,4)
movl %edi, %edx
movl %r8d, %esi
testl %edi, %edi
jg 0x2c5d0
jmp 0x2c602
movl %r8d, 0x8(%rsp)
movl %esi, 0x4(%rsp)
decl %edx
jmp 0x2c57a
movq %r14, %rbp
movq %r12, %rcx
addq $0x400, %rcx            # imm = 0x400
xorl %edx, %edx
movl $0x1, %esi
xorl %edi, %edi
xorl %r8d, %r8d
leal (%r8,%rdi), %r9d
addl (%r13,%rdx,4), %edi
movl %r9d, (%r13,%rdx,4)
movq %rdx, %r9
shlq $0x8, %r9
movq %r9, %r10
orq %rdx, %r10
addl (%r12,%r10,4), %edi
cmpq $0xfe, %rdx
ja 0x2c66d
movq %rcx, %r10
movq %rsi, %r11
movl %r11d, %r14d
orq %r9, %r14
addl (%r12,%r14,4), %r8d
movl %r8d, (%r12,%r14,4)
addl (%r10), %edi
incq %r11
addq $0x400, %r10            # imm = 0x400
cmpq $0x100, %r11            # imm = 0x100
jne 0x2c649
incq %rdx
incq %rsi
addq $0x404, %rcx            # imm = 0x404
cmpq $0x100, %rdx            # imm = 0x100
jne 0x2c61b
movq 0x10(%rsp), %r10
movl %r10d, %r9d
subl %eax, %r9d
jle 0x2ccc2
movq 0x28(%rsp), %rcx
leaq (%rbx,%rcx,4), %r11
movl %r9d, %r8d
leaq (,%r8,4), %rdx
subq %rdx, %r11
cmpl $0x1, %r9d
je 0x2c6f6
leal -0x2(%r9), %ecx
notl %eax
addl %r10d, %eax
shlq $0x2, %rcx
movq 0x28(%rsp), %rsi
leaq (%rcx,%rsi,4), %rcx
subq %rdx, %rcx
addq %rbx, %rcx
movslq (%rcx), %rdx
movzwl (%r15,%rdx), %edx
rolw $0x8, %dx
movzwl %dx, %edx
movslq (%r12,%rdx,4), %rsi
leaq -0x1(%rsi), %rdi
movl %edi, (%r12,%rdx,4)
decl %eax
movl %eax, -0x4(%rbx,%rsi,4)
addq $-0x4, %rcx
testl %eax, %eax
jg 0x2c6cd
movq %r13, 0x48(%rsp)
leaq (%rbx,%r8,4), %rax
movq %rax, 0x20(%rsp)
leal -0x1(%r9), %esi
movslq (%r11,%rsi,4), %rax
movzwl (%r15,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movslq (%r12,%rax,4), %rcx
leaq -0x1(%rcx), %rdx
movl %edx, (%r12,%rax,4)
movq %rsi, 0x38(%rsp)
movl %esi, -0x4(%rbx,%rcx,4)
movl %r10d, %eax
subl %r9d, %eax
subl %r9d, %eax
cmpl $0x1, %ebp
movq %r12, 0x60(%rsp)
movq %r15, 0x40(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x68(%rsp)
jle 0x2c90c
cltd
idivl %ebp
movl %eax, 0x1c(%rsp)
decl %ebp
movl $0xfe, 0x8(%rsp)
movl $0xff, 0x4(%rsp)
movl %r9d, 0xc(%rsp)
movq %r9, %r13
movq %r11, %r14
callq 0x48794
movq %rax, 0x98(%rsp)
movq %r15, 0xa0(%rsp)
movq %rbx, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
movq %r14, 0xb8(%rsp)
movl 0x1c(%rsp), %r14d
movl %r14d, 0xc0(%rsp)
movq 0x10(%rsp), %rax
movl %eax, 0xc4(%rsp)
movl %r13d, 0xc8(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbp, %r13
movq %rbp, %rsi
callq 0x15522
leaq 0x30(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rax, (%rcx)
movslq %r14d, %r14
xorl %ebp, %ebp
leaq 0x78(%rsp), %r15
movq 0x60(%rsp), %r12
leaq 0x8(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x4(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0xc(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x70(%rsp)
subq $0x8, %rsp
leaq 0x98(%rsp), %rdi
leaq 0x52c2(%rip), %rsi      # 0x31aff
leaq 0x90(%rsp), %rdx
leaq 0x88(%rsp), %rcx
movq %r15, %r8
leaq 0x38(%rsp), %r9
leaq 0x78(%rsp), %rax
pushq %rax
callq 0x31e0a
addq $0x10, %rsp
movq 0xd0(%rsp), %rax
cmpq $0x0, (%rax,%rbp,8)
jne 0x2ce7b
movq 0x90(%rsp), %rcx
movq %rcx, (%rax,%rbp,8)
incq %rbp
movq 0x30(%rsp), %rax
leaq (%rax,%r14,4), %rcx
movq %rcx, 0x30(%rsp)
cmpq %rbp, %r13
jne 0x2c7f9
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x98(%rsp), %r8
callq 0x31aff
shlq $0x3, %r13
xorl %r14d, %r14d
movq 0x40(%rsp), %r15
movq 0x50(%rsp), %rbp
movq 0xd0(%rsp), %rdi
addq %r14, %rdi
callq 0x4580
addq $0x8, %r14
cmpq %r14, %r13
jne 0x2c8ca
leaq 0xd0(%rsp), %rdi
callq 0x15590
movq 0x98(%rsp), %rdi
callq 0x487b3
movq 0x38(%rsp), %r14
movq 0x48(%rsp), %r13
jmp 0x2c9c2
movl %eax, 0x1c(%rsp)
movl $0xfe, %ebp
movl %r9d, %r13d
movl %ebp, %r15d
shll $0x8, %r15d
movl $0xff, %r14d
movl %r13d, %eax
movl %r14d, %ecx
orl %r15d, %ecx
movslq %ecx, %rcx
movl (%r12,%rcx,4), %r13d
movl %eax, %ecx
subl %r13d, %ecx
cmpl $0x2, %ecx
jl 0x2c98f
movslq %r13d, %rcx
leaq (%rbx,%rcx,4), %rdx
cltq
leaq (%rbx,%rax,4), %rcx
xorl %eax, %eax
movq 0x38(%rsp), %rsi
cmpl %esi, (%rdx)
sete %al
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq %r11, %rsi
movq 0x28(%rsp), %r8
movl 0x24(%rsp), %r9d
pushq %rax
pushq %r10
pushq $0x2
movq %r11, %r12
callq 0x2cedf
movq %r12, %r11
movq 0x80(%rsp), %r12
movq 0x30(%rsp), %r10
addq $0x20, %rsp
decl %r14d
movl %r13d, %eax
cmpl %r14d, %ebp
jl 0x2c928
decl %ebp
testl %r13d, %r13d
jg 0x2c918
movl %r14d, 0x4(%rsp)
movl %ebp, 0x8(%rsp)
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r13
movq 0x38(%rsp), %r14
movq 0x50(%rsp), %rbp
movl %r14d, %eax
movq 0x20(%rsp), %r8
movl %eax, %ecx
movl (%rbx,%rcx,4), %esi
testl %esi, %esi
js 0x2ca03
movl %eax, 0xc(%rsp)
incq %rcx
xorl %edx, %edx
movl %esi, %esi
leal (%rax,%rdx), %edi
movl %edi, (%r8,%rsi,4)
cmpq $0x1, %rcx
je 0x2ca3f
movl -0x8(%rbx,%rcx,4), %esi
decq %rcx
decl %edx
testl %esi, %esi
jns 0x2c9dc
movl %edx, (%rbx,%rcx,4)
cmpq $0x1, %rcx
je 0x2ca43
addl %edx, %eax
movl %eax, %ecx
movl %eax, 0xc(%rsp)
cltq
movl (%rbx,%rax,4), %esi
leaq 0x1(%rax), %rdx
decl %eax
movq 0x20(%rsp), %rdi
notl %esi
movl %esi, -0x4(%rbx,%rdx,4)
movslq %esi, %rsi
movl %ecx, (%rdi,%rsi,4)
movslq -0x8(%rbx,%rdx,4), %rsi
decq %rdx
decl %eax
testq %rsi, %rsi
js 0x2ca19
movl %ecx, (%rdi,%rsi,4)
cmpq $0x1, %rdx
jg 0x2c9ca
jmp 0x2ca43
notl %eax
movl %eax, (%rbx)
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq 0x68(%rsp), %rdx
movl $0x1, %ecx
callq 0x2fae4
movq 0x58(%rsp), %rdx
movzbl (%r15,%rdx), %ecx
leaq -0x1(%r15), %rax
movl %edx, %esi
movl $0x1, %r9d
movq %rax, %r8
xorl %edi, %edi
movl %ecx, %r10d
cmpq %rdi, %rsi
je 0x2cb11
movq %rdi, %rdx
movzbl (%r8,%rsi), %ecx
incq %rdi
incq %r9
decq %r8
cmpl %ecx, %r10d
movl %ecx, %r10d
jbe 0x2ca78
movq %rsi, %r8
subq %rdi, %r8
leal 0x1(%r8), %r10d
cmpl $0x1, %r10d
jle 0x2cace
notl %edx
addl %esi, %edx
movl %ecx, %r10d
leal -0x1(%rdx), %r9d
movzbl (%r15,%r9), %ecx
cmpl %ecx, %r10d
jb 0x2cad6
movl %r9d, %edx
testl %r9d, %r9d
jg 0x2caae
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
jmp 0x2cad8
movq %rsi, %rdx
subq %r9, %rdx
jmp 0x2cad8
decl %edx
movl %esi, %r9d
subl %edx, %r9d
subl %edi, %r9d
movl %esi, %r10d
notl %r10d
addl %edi, %r10d
cmpl $0x2, %r9d
cmovgel %r8d, %r10d
cmpl %edi, %esi
cmovel %r8d, %r10d
movq 0x20(%rsp), %rsi
movslq -0x4(%rsi,%rbp,4), %rsi
decq %rbp
movl %r10d, (%rbx,%rsi,4)
testl %edx, %edx
jns 0x2ca68
movq 0x10(%rsp), %rax
movl %eax, 0x3fffc(%r12)
movl $0xfe, %eax
movl 0x4(%r13,%rax,4), %ecx
decl %ecx
movl %eax, %edx
shll $0x8, %edx
movl $0xff, %esi
movl %ecx, %edi
movl %esi, %r8d
shll $0x8, %r8d
orl %eax, %r8d
movslq %r8d, %r8
subl (%r12,%r8,4), %ecx
movl %edi, (%r12,%r8,4)
movl %esi, %edi
orl %edx, %edi
movslq %edi, %rdi
movslq (%r12,%rdi,4), %rdi
cmpl %r14d, %edi
jg 0x2cb7c
movslq %ecx, %rcx
movslq %r14d, %r8
incq %r8
leal -0x1(%rdi), %r14d
movl -0x4(%rbx,%r8,4), %r9d
movl %r9d, (%rbx,%rcx,4)
decq %rcx
decq %r8
cmpq %rdi, %r8
jg 0x2cb68
decl %esi
cmpl %eax, %esi
ja 0x2cb34
movl %edx, %esi
orl %eax, %esi
movslq %esi, %rsi
movl %ecx, %edi
subl (%r12,%rsi,4), %edi
incl %edi
leal 0x1(%rax), %r8d
orl %edx, %r8d
movslq %r8d, %rdx
movl %edi, (%r12,%rdx,4)
movl %ecx, (%r12,%rsi,4)
subq $0x1, %rax
jae 0x2cb23
leaq -0x4(%rbx), %rax
movl $0xfe, %ecx
leal 0x1(%rcx), %esi
movl %ecx, %edx
shll $0x8, %edx
orl %edx, %esi
movslq %esi, %rsi
movslq (%r12,%rsi,4), %rsi
leaq (%rbx,%rsi,4), %rsi
movslq 0x4(%r13,%rcx,4), %rdi
leaq (%rax,%rdi,4), %rdi
cmpq %rdi, %rsi
ja 0x2ccb3
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
movl (%rdi), %r10d
testl %r10d, %r10d
jle 0x2cc55
movzbl (%r15,%r10), %r11d
cmpq %r11, %rcx
jne 0x2cdff
leaq 0x1(%r10), %r14
cmpl 0x10(%rsp), %r14d
jge 0x2cda2
cmpb (%r15,%r14), %r11b
ja 0x2cda2
cmpb %r11b, -0x1(%r15,%r10)
ja 0x2cdc1
movl %r10d, %r11d
notl %r11d
movl %r11d, (%rdi)
leal -0x1(%r10), %r14d
movzbl (%r15,%r14), %r11d
xorl %ebp, %ebp
cmpq $0x1, %r10
je 0x2cc4b
movl %r10d, %ebp
negl %ebp
cmpb %r11b, -0x2(%r15,%r10)
cmoval %ebp, %r14d
movl %r14d, %ebp
cmpl %r11d, %r9d
jne 0x2cc6f
movl %r9d, %r11d
jmp 0x2cc93
testq %r10, %r10
jne 0x2cc67
movzbl (%r15), %r11d
cmpq %r11, %rcx
jne 0x2ce1e
notl %r10d
movl %r10d, (%rdi)
jmp 0x2cca6
testl %r9d, %r9d
js 0x2cc85
subq %rbx, %r8
shrq $0x2, %r8
orl %edx, %r9d
movslq %r9d, %r9
movl %r8d, (%r12,%r9,4)
movslq %edx, %r8
orq %r11, %r8
movslq (%r12,%r8,4), %r8
leaq (%rbx,%r8,4), %r8
cmpq %rdi, %r8
jae 0x2cde0
movl %ebp, (%r8)
addq $-0x4, %r8
movl %r11d, %r9d
addq $-0x4, %rdi
cmpq %rdi, %rsi
jbe 0x2cbe6
subq $0x1, %rcx
jae 0x2cbb6
movq 0x10(%rsp), %r10
movq 0x28(%rsp), %rdx
movq 0x58(%rsp), %rcx
movzbl (%r15,%rcx), %esi
movl %r10d, %eax
negl %eax
cmpb %sil, -0x2(%r15,%rdx)
cmovbl %eax, %ecx
movslq (%r13,%rsi,4), %rax
movl %ecx, (%rbx,%rax,4)
xorl %ebp, %ebp
testl %r10d, %r10d
je 0x2cd7e
leaq (%rbx,%rax,4), %rcx
leaq (%rbx,%rdx,4), %rax
addq $0x4, %rcx
movq %rbx, %rdx
movslq (%rdx), %r9
testq %r9, %r9
jle 0x2cd39
movb -0x1(%r15,%r9), %dil
cmpb (%r15,%r9), %dil
jb 0x2ce5c
movl %r9d, %r8d
decl %r8d
movzbl (%r15,%r8), %edi
je 0x2cd2b
cmpb %dil, -0x2(%r15,%r9)
jae 0x2cd31
negl %r9d
movl %r9d, %r8d
cmpl %edi, %esi
jne 0x2cd4a
movl %esi, %edi
jmp 0x2cd63
testl %r9d, %r9d
jns 0x2ce80
notl %r9d
movl %r9d, (%rdx)
jmp 0x2cd75
subq %rbx, %rcx
shrq $0x2, %rcx
movl %esi, %esi
movl %ecx, (%r13,%rsi,4)
movl %edi, %ecx
movslq (%r13,%rcx,4), %rcx
leaq (%rbx,%rcx,4), %rcx
cmpq %rcx, %rdx
jae 0x2ce3d
movl %r8d, (%rcx)
addq $0x4, %rcx
movl %edi, %esi
addq $0x4, %rdx
cmpq %rax, %rdx
jb 0x2cd00
movq %r12, %rdi
callq 0x43b0
movq %r13, %rdi
callq 0x43b0
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3187b(%rip), %rdi     # 0x5e624
leaq 0x317cd(%rip), %rsi     # 0x5e57d
leaq 0x31813(%rip), %rcx     # 0x5e5ca
movl $0xf1, %edx
callq 0x4200
leaq 0x31880(%rip), %rdi     # 0x5e648
leaq 0x317ae(%rip), %rsi     # 0x5e57d
leaq 0x317f4(%rip), %rcx     # 0x5e5ca
movl $0xf2, %edx
callq 0x4200
leaq 0x31872(%rip), %rdi     # 0x5e659
leaq 0x3178f(%rip), %rsi     # 0x5e57d
leaq 0x317d5(%rip), %rcx     # 0x5e5ca
movl $0xfa, %edx
callq 0x4200
leaq 0x3176c(%rip), %rdi     # 0x5e572
leaq 0x31770(%rip), %rsi     # 0x5e57d
leaq 0x317b6(%rip), %rcx     # 0x5e5ca
movl $0xf0, %edx
callq 0x4200
leaq 0x3183a(%rip), %rdi     # 0x5e65f
leaq 0x31751(%rip), %rsi     # 0x5e57d
leaq 0x31797(%rip), %rcx     # 0x5e5ca
movl $0xfd, %edx
callq 0x4200
leaq 0x31852(%rip), %rdi     # 0x5e696
leaq 0x31732(%rip), %rsi     # 0x5e57d
leaq 0x31778(%rip), %rcx     # 0x5e5ca
movl $0x112, %edx            # imm = 0x112
callq 0x4200
leaq 0x31822(%rip), %rdi     # 0x5e685
leaq 0x31713(%rip), %rsi     # 0x5e57d
leaq 0x31759(%rip), %rcx     # 0x5e5ca
movl $0x10b, %edx            # imm = 0x10B
callq 0x4200
callq 0x40b0
leaq 0x31815(%rip), %rdi     # 0x5e69c
leaq 0x316ef(%rip), %rsi     # 0x5e57d
leaq 0x31735(%rip), %rcx     # 0x5e5ca
movl $0x115, %edx            # imm = 0x115
callq 0x4200
jmp 0x2cecf
jmp 0x2ceaa
movq %rax, %rbx
jmp 0x2ceba
jmp 0x2ceaa
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x15590
movq 0x98(%rsp), %rdi
callq 0x487b3
movq %rbx, %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x9b7c