// File: /workspace/github_cpp_makefile_star2_O1/shangjingbo1226[P]MACFP/src/methods/../utils/suffix_array.h
// Function: SuffixArray::dc3(int*, int*, long long, int)
void dc3(int *r, int *sa, long long n, int m) {
        int *rn = r + n, *san = sa + n, ta = 0, tb = (n + 1) / 3;
        long long i, j, p, tbc = 0;
        r[n] = r[n + 1] = 0;
        for (i = 0; i < n; ++ i) {
            if (i % 3 != 0) {
                wa[tbc ++]=i;
            }
        }
        sort(r+2, &wa[0], &wb[0], tbc, m);
        sort(r+1, &wb[0], &wa[0], tbc, m);
        sort(r, &wa[0], &wb[0], tbc, m);
        for(p = 1, rn[F(wb[0])] = 0, i = 1; i < tbc; ++ i) {
            rn[F(wb[i])] = c0(r, wb[i - 1], wb[i]) ? p - 1 : p ++;
        }
        if (p < tbc) {
            dc3(rn, san, tbc, p);
        } else {
            for (i = 0; i < tbc; ++ i) {
                san[rn[i]] = i;
            }
        }
        for (i = 0; i < tbc; ++ i) {
            if (san[i] < tb) {
                wb[ta ++] = san[i] * 3;
            }
        }
        if (n % 3 == 1) {
            wb[ta ++]=n - 1;
        }
        sort(r, &wb[0], &wa[0], ta, m);
        for (i = 0; i < tbc; ++ i) {
            wv[wb[i] = G(san[i])] = i;
        }
        for (i = 0, j = 0, p = 0; i < ta && j < tbc; ++ p) {
            sa[p] = c12(wb[j] % 3, r, wa[i], wb[j]) ? wa[i ++] : wb[j++];
        }
        for (; i < ta; ++ p) {
            sa[p] = wa[i ++];
        }
        for (; j < tbc; ++ p) {
            sa[p] = wb[j ++];
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r12d
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
leaq (%rsi,%rcx,4), %r13
leaq 0x1(%rcx), %rax
movabsq $0x5555555555555556, %rdx # imm = 0x5555555555555556
imulq %rdx
movq %rdx, %rbp
shrq $0x3f, %rbp
addl %edx, %ebp
xorl %r14d, %r14d
movl %r14d, 0x4(%r13)
movl %r14d, (%r13)
testq %rcx, %rcx
jle 0x69e8
movq 0x40(%rdi), %rsi
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r8 # imm = 0xAAAAAAAAAAAAAAAB
xorl %r9d, %r9d
movq %r9, %rax
mulq %r8
shrq %rdx
leaq (%rdx,%rdx,2), %rax
cmpq %r9, %rax
je 0x69de
movl %r9d, (%rsi,%r15,4)
incq %r15
incq %r9
cmpq %r9, %rcx
jne 0x69c5
jmp 0x69eb
xorl %r15d, %r15d
movq %rcx, 0x10(%rsp)
leaq 0x8(%rbx), %rsi
movq 0x40(%rdi), %rdx
movq 0x58(%rdi), %rcx
movq %r15, %r8
movl %r12d, %r9d
movq %rdi, 0x8(%rsp)
callq 0x71be
leaq 0x4(%rbx), %rsi
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rcx
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rdx
movq 0x8(%rsp), %rdi
movq %r15, %r8
movl %r12d, %r9d
callq 0x71be
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rdx
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rcx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %r8
movl %r12d, %r9d
callq 0x71be
movq 0x8(%rsp), %rdi
movq 0x58(%rdi), %rax
movslq (%rax), %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x20, %rdx
addl %esi, %edx
leal (%rdx,%rdx,2), %esi
subl %esi, %ecx
cmpl $0x1, %ecx
cmovnel %ebp, %r14d
addl %edx, %r14d
movslq %r14d, %rcx
movl $0x0, (%r13,%rcx,4)
movl $0x1, %r8d
cmpq $0x2, %r15
jl 0x6b2e
movl $0x1, %esi
xorl %ecx, %ecx
movl $0x1, %edx
movslq -0x4(%rax,%rdx,4), %r9
movslq (%rax,%rdx,4), %r11
movl (%rbx,%r9,4), %r10d
movb $0x1, %r8b
cmpl (%rbx,%r11,4), %r10d
jne 0x6ade
movl 0x4(%rbx,%r9,4), %r10d
cmpl 0x4(%rbx,%r11,4), %r10d
jne 0x6ade
movl 0x8(%rbx,%r9,4), %r8d
cmpl 0x8(%rbx,%r11,4), %r8d
setne %r8b
movzbl %r8b, %r9d
leaq (%rsi,%r9), %r8
xorb $0x1, %r9b
movzbl %r9b, %r9d
subl %r9d, %esi
imulq $0x55555556, %r11, %r9  # imm = 0x55555556
movq %r9, %r10
shrq $0x3f, %r10
shrq $0x20, %r9
addl %r10d, %r9d
leal (%r9,%r9,2), %r10d
subl %r10d, %r11d
cmpl $0x1, %r11d
movl %ebp, %r10d
cmovel %ecx, %r10d
addl %r9d, %r10d
movslq %r10d, %r9
movl %esi, (%r13,%r9,4)
incq %rdx
movq %r8, %rsi
cmpq %rdx, %r15
jne 0x6aae
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %r10
leaq (%rax,%r10,4), %r14
cmpq %r15, %r8
jge 0x6b60
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x696a
movq 0x10(%rsp), %r10
movabsq $0x5555555555555556, %r8 # imm = 0x5555555555555556
jmp 0x6b82
testq %r15, %r15
movabsq $0x5555555555555556, %r8 # imm = 0x5555555555555556
jle 0x6b82
xorl %eax, %eax
movslq (%r13,%rax,4), %rcx
movl %eax, (%r14,%rcx,4)
incq %rax
cmpq %rax, %r15
jne 0x6b71
movl %r12d, %r9d
testq %r15, %r15
jle 0x6bb6
movq 0x8(%rsp), %rdi
movq 0x58(%rdi), %rax
xorl %ecx, %ecx
xorl %r12d, %r12d
movl (%r14,%rcx,4), %edx
cmpl %ebp, %edx
jge 0x6bac
leal (%rdx,%rdx,2), %edx
movslq %r12d, %rsi
incl %r12d
movl %edx, (%rax,%rsi,4)
incq %rcx
cmpq %rcx, %r15
jne 0x6b98
jmp 0x6bbe
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
movq %r10, %rax
imulq %r8
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
movq %r10, %rcx
subq %rax, %rcx
cmpq $0x1, %rcx
jne 0x6bef
decl %r10d
movslq %r12d, %rax
incl %r12d
movq 0x58(%rdi), %rcx
movl %r10d, (%rcx,%rax,4)
movq 0x40(%rdi), %rcx
movq 0x58(%rdi), %rdx
movslq %r12d, %r8
movq %rbx, %rsi
movq %r8, 0x10(%rsp)
callq 0x71be
movq 0x8(%rsp), %rdi
testq %r15, %r15
jle 0x6c53
movq 0x58(%rdi), %rax
movq 0x70(%rdi), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%r14,%rsi,4), %r10d
xorl %r8d, %r8d
cmpl %ebp, %r10d
setl %r8b
movl %ebp, %r9d
cmovll %edx, %r9d
subl %r9d, %r10d
leal (%r10,%r10,2), %r9d
subl %r8d, %r9d
addl $0x2, %r9d
movl %r9d, (%rax,%rsi,4)
movslq %r9d, %r8
movl %esi, (%rcx,%r8,4)
incq %rsi
cmpq %rsi, %r15
jne 0x6c1d
testl %r12d, %r12d
setle %al
testq %r15, %r15
setle %cl
orb %al, %cl
jne 0x6d03
movq %rbx, 0x20(%rsp)
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %edx, %edx
movq %rdx, %r13
movq %rcx, %r12
movq 0x40(%rdi), %rax
movq 0x58(%rdi), %rcx
leaq (,%r12,4), %rbp
movslq (%rcx,%r12,4), %r8
imulq $0x55555556, %r8, %rcx  # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
movl %r8d, %esi
subl %ecx, %esi
leaq (,%r13,4), %rbx
movslq (%rax,%r13,4), %rcx
movq 0x20(%rsp), %rdx
callq 0x72a2
movq 0x8(%rsp), %rdi
addq 0x40(%rdi), %rbx
addq 0x58(%rdi), %rbp
xorl %ecx, %ecx
xorl %edx, %edx
testl %eax, %eax
sete %cl
setne %dl
cmovneq %rbx, %rbp
addq %r13, %rdx
addq %r12, %rcx
movl (%rbp), %eax
movq 0x18(%rsp), %rsi
movl %eax, (%rsi,%r14,4)
incq %r14
cmpq 0x10(%rsp), %rdx
jge 0x6d0a
cmpq %r15, %rcx
jl 0x6c73
jmp 0x6d0a
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r14d, %r14d
movq 0x10(%rsp), %r9
subq %rdx, %r9
jle 0x6d3a
movq 0x18(%rsp), %rax
leaq (%rax,%r14,4), %rax
shlq $0x2, %rdx
addq 0x40(%rdi), %rdx
xorl %esi, %esi
movl (%rdx,%rsi,4), %r8d
movl %r8d, (%rax,%rsi,4)
incq %rsi
cmpq %rsi, %r9
jne 0x6d27
addq %rsi, %r14
subq %rcx, %r15
jle 0x6d60
movq 0x18(%rsp), %rax
leaq (%rax,%r14,4), %rax
shlq $0x2, %rcx
addq 0x58(%rdi), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %r15
jne 0x6d52
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop