// File: /workspace/github_c_makefile_star2_O3/findstr[P]version-database/dc3.c
// Function: dc3_r
void
dc3_r(const int *buf, int *SA, int size, int space)
{
	int i, lexname, v[3];
	int n0, n1, n2, n12;
	int *p, *SA0, *s0, *SA12, *s12;
	n0 = (2+size) / 3;
	n1 = (2+size - 1) / 3;
	n2 = (2+size - 2) / 3;
	n12 = n0 + n2;
	//sort S1 S2
	s0 = NEW(int, n0);
	SA0 = NEW(int, n0);
	s12 = NEW(int, n12 + 3);
	SA12 = NEW(int, n12 + 3);
	s12[n12] = s12[n12+1] = s12[n12+2] = TERM;
	SA12[n12] = SA12[n12+1] = SA12[n12+2] = TERM;
	p = s12;
	for (i = 0; i < size + (n0 - n1); i++) {
		if (i % 3 != 0)
			*p++ = i;
	}
	assert(p - s12 == n12);
	radix_pass(s12, SA12, n12, buf+2, space); //tri[i+2]
	radix_pass(SA12, s12, n12, buf+1, space); //tri[i+1]
	radix_pass(s12, SA12, n12, buf+0, space); //tri[i+0]
	//build lexname for s12
	lexname = 0;
	s12[n12] = s12[n12 + 1] = s12[n12+2] = TERM;
	v[0] = v[1] = v[2] = -1;
	for (i = 0; i < n12; i++) {
		int idx12;
		int abs= SA12[i];
		if (V(abs) != v[0] || V(abs+1) != v[1] || V(abs+2) != v[2]) {
			++lexname;
			v[0] = V(abs);
			v[1] = V(abs+1);
			v[2] = V(abs+2);
		}
		assert(lexname > 0);
		assert(abs % 3 != 0);
		idx12 = ABS_TO_S12(abs);
		s12[idx12] = lexname;
	}
	assert(s12[n12] == s12[n12 + 1]);
	assert(s12[n12+1] == s12[n12+2] && s12[n12 + 2] == TERM);
	//now s12[idx] = rank which idx % 3 != 0
	if (lexname < n12) { //lexname conflict
		dc3_r(s12, SA12, n12, lexname);
		for (i = 0; i < n12; i++)
			s12[SA12[i]] = i + 1;
	} else {
		for (i = 0; i < n12; i++)
			SA12[s12[i] - 1] = i;
	}
	//sort S0
	p = s0;
	//radix pass 4
	for (i = 0; i < n12; i++) {
		int n = SA12[i];
		if (S12_IS_LEFT(n))
			*p++ = S12_TO_LABS(n) - 1;
	}
	assert(p - s0 == n0);
	radix_pass(s0, SA0, n0, buf, space);
	int k, r0 = 0, r12 = n0 - n1;
	for (k = 0; k < size; k++) {
		int i, j, i12, j12;
		i = SA12[r12];
		j = SA0[r0];
		assert(r12 < n12);
		assert(r0 < n0);
		int leq = 0;
		if (S12_IS_LEFT(i)) {	//k mod 3 == 1, i+n1 ==> k mod 3 == 2
			i = S12_TO_LABS(i);
			i12 = ABS_TO_S12(i+1);
			j12 = ABS_TO_S12(j+1);
			leq = leq2(buf[i], s12[i12], buf[j], s12[j12]);
		} else {	//k mod 3 == 2, k mode 3 + 2 => (k mod 3 == 1)+1
			i = S12_TO_RABS(i);
			i12 = ABS_TO_S12(i+2);
			j12 = ABS_TO_S12(j+2);
			leq = leq3(buf[i], buf[i+1], s12[i12], buf[j], buf[j+1], s12[j12]);
		}
		if (leq) {
			SA[k] = i;
			r12++;
			if (r12 == n12)
				break;
		} else {
			SA[k] = j;
			++r0;
			if (r0 == n0)
				break;
		}
	}
	while (r0 < n0)
		SA[++k] = SA0[r0++];
	while (r12 < n12) {
		int ii = SA12[r12++];
		SA[++k] = S12_TO_ABS(ii);
	}
	//free buffer
	free(s0);
	free(s12);
	free(SA0);
	free(SA12);
	return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, -0x4c(%rbp)
movq %rsi, -0x58(%rbp)
movq %rdi, %r15
leal 0x2(%rdx), %eax
cltq
imulq $0x55555556, %rax, %rbx # imm = 0x55555556
movq %rbx, %rax
shrq $0x3f, %rax
shrq $0x20, %rbx
addl %eax, %ebx
leal 0x1(%rdx), %eax
movl %edx, %ecx
movq %rdx, -0x88(%rbp)
notl %ecx
cltq
imulq $0x55555555, %rax, %r12 # imm = 0x55555555
shrq $0x20, %r12
addl %ecx, %r12d
movl %r12d, %eax
shrl $0x1f, %eax
sarl %r12d
addl %eax, %r12d
movslq %edx, %rax
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rax
shrq $0x3f, %rax
shrq $0x20, %rcx
addl %eax, %ecx
movq %rcx, -0x90(%rbp)
leal (%rbx,%rcx), %r13d
movslq %ebx, %rax
movq %rax, -0x60(%rbp)
leaq (,%rax,4), %r14
movq %r14, %rdi
callq 0x2200
movq %rax, -0x68(%rbp)
movq %r14, %rdi
callq 0x2200
movq %rax, -0x70(%rbp)
movl %r13d, -0x2c(%rbp)
movslq %r13d, %rax
movq %rax, -0x38(%rbp)
leaq 0xc(,%rax,4), %r14
movq %r14, %rdi
callq 0x2200
movq %rax, %r13
movq %r14, %rdi
callq 0x2200
movq -0x38(%rbp), %r8
movq -0x88(%rbp), %rsi
movq %rax, %r14
xorl %eax, %eax
movl %eax, 0x8(%r13,%r8,4)
movl %eax, 0x4(%r13,%r8,4)
movl %eax, (%r13,%r8,4)
movl %eax, 0x8(%r14,%r8,4)
movl %eax, 0x4(%r14,%r8,4)
movl %eax, (%r14,%r8,4)
leal (%r12,%rbx), %edx
movl %edx, -0x30(%rbp)
movq %r13, -0x40(%rbp)
addl %esi, %edx
jle 0x759c
addl %ebx, %r12d
addl %esi, %r12d
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
movq -0x40(%rbp), %r13
movl %eax, %esi
imulq %rdx, %rsi
shrq $0x21, %rsi
leal (%rsi,%rsi,2), %esi
cmpl %eax, %esi
je 0x7595
movl %eax, (%r13)
addq $0x4, %r13
incl %eax
cmpl %eax, %r12d
jne 0x757c
movq -0x40(%rbp), %r12
subq %r12, %r13
sarq $0x2, %r13
cmpq %r8, %r13
jne 0x7aff
leaq 0x2(%r8), %rax
movq %rax, -0x80(%rbp)
leaq 0x1(%r8), %rax
movq %rax, -0x78(%rbp)
leaq 0x8(%r15), %rcx
movq %r12, %rdi
movq %r14, %rsi
movl %r8d, %edx
movl -0x4c(%rbp), %r13d
movl %r13d, %r8d
callq 0x7b7b
leaq 0x4(%r15), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rdx
movl %r13d, %r8d
callq 0x7b7b
movq %r12, %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
movq %r15, %rcx
movl %r13d, %r8d
callq 0x7b7b
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
movq -0x80(%rbp), %rax
movl %ecx, (%r12,%rax,4)
movq -0x78(%rbp), %rax
movl %ecx, (%r12,%rax,4)
movl %ecx, (%r12,%rdx,4)
movl $0x0, %eax
testl %edx, %edx
movq -0x70(%rbp), %r13
movq %r14, -0x48(%rbp)
jle 0x76f0
movl -0x2c(%rbp), %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movslq (%r14,%rdx,4), %r9
movl (%r15,%r9,4), %r8d
movl 0x4(%r15,%r9,4), %r11d
cmpl %r10d, %r8d
jne 0x7677
cmpl %edi, %r11d
jne 0x7677
cmpl %esi, 0x8(%r15,%r9,4)
jne 0x7674
movl %r10d, %r8d
testl %ecx, %ecx
jne 0x7681
jmp 0x7ae0
movl %edi, %r11d
incl %ecx
movl 0x8(%r15,%r9,4), %esi
movl %r11d, %edi
imulq $0x55555556, %r9, %r10  # imm = 0x55555556
movq %r10, %r11
shrq $0x3f, %r11
shrq $0x20, %r10
leal (%r10,%r11), %r12d
leal (%r12,%r12,2), %r14d
subl %r14d, %r9d
cmpl $0x1, %r9d
je 0x76b9
testl %r9d, %r9d
movq -0x48(%rbp), %r14
je 0x7ac1
addl %ebx, %r12d
movl %r12d, %r10d
jmp 0x76c0
addl %r11d, %r10d
movq -0x48(%rbp), %r14
movslq %r10d, %r9
movq -0x40(%rbp), %r12
movl %ecx, (%r12,%r9,4)
incq %rdx
movl %r8d, %r10d
cmpq %rdx, %rax
jne 0x764a
movq -0x78(%rbp), %rax
movl (%r12,%rax,4), %eax
movq -0x38(%rbp), %rdx
cmpl %eax, (%r12,%rdx,4)
jne 0x7b5c
movq -0x80(%rbp), %rdx
orl (%r12,%rdx,4), %eax
movl -0x2c(%rbp), %edx
jne 0x7b1e
cmpl %edx, %ecx
jge 0x7734
movq %r12, %rdi
movq %r14, %rsi
callq 0x7464
movl -0x2c(%rbp), %edx
movq -0x68(%rbp), %rdi
movq %rdi, %rax
testl %edx, %edx
jle 0x777b
movl %edx, %eax
xorl %ecx, %ecx
movslq (%r14,%rcx,4), %rsi
incq %rcx
movl %ecx, (%r12,%rsi,4)
cmpq %rcx, %rax
jne 0x7722
jmp 0x7754
movq -0x68(%rbp), %rdi
movq %rdi, %rax
testl %edx, %edx
jle 0x777b
movl %edx, %eax
xorl %ecx, %ecx
movslq (%r12,%rcx,4), %rsi
movl %ecx, -0x4(%r14,%rsi,4)
incq %rcx
cmpq %rcx, %rax
jne 0x7743
movq %rdi, %rax
testl %edx, %edx
jle 0x777b
movl %edx, %ecx
xorl %edx, %edx
movq %rdi, %rax
movl (%r14,%rdx,4), %esi
cmpl %ebx, %esi
jge 0x7773
leal (%rsi,%rsi,2), %esi
movl %esi, (%rax)
addq $0x4, %rax
incq %rdx
cmpq %rdx, %rcx
jne 0x7762
subq %rdi, %rax
sarq $0x2, %rax
cmpq -0x60(%rbp), %rax
jne 0x7b3d
movq %r13, %rsi
movl %ebx, %edx
movq %r15, %rcx
movl -0x4c(%rbp), %r8d
callq 0x7b7b
movq -0x88(%rbp), %rax
testl %eax, %eax
jle 0x799c
movl %eax, %eax
movq %rax, -0x38(%rbp)
xorl %r12d, %r12d
xorl %eax, %eax
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %edx
cmpl %ecx, %edx
jge 0x7aa2
cmpl %ebx, %eax
jge 0x7a83
movl %edx, -0x30(%rbp)
movslq %edx, %rcx
movslq (%r14,%rcx,4), %rdi
movslq %eax, %rcx
movl (%r13,%rcx,4), %edx
movslq %edx, %rsi
cmpl %ebx, %edi
jge 0x789e
leaq (%rdi,%rdi,2), %r8
leal 0x2(%r8), %ecx
movslq %ecx, %rcx
imulq $0x55555556, %rcx, %r9  # imm = 0x55555556
movq %r9, %r10
shrq $0x3f, %r10
shrq $0x20, %r9
addl %r10d, %r9d
leal (%r9,%r9,2), %r10d
subl %r10d, %ecx
xorl %r10d, %r10d
movl $0x0, %r11d
cmpl $0x1, %ecx
je 0x7822
movl %ebx, %r11d
leal 0x1(%rdx), %ecx
movslq %ecx, %r14
imulq $0x55555556, %r14, %rcx # imm = 0x55555556
movq %rcx, %r13
shrq $0x3f, %r13
shrq $0x20, %rcx
addl %r13d, %ecx
leal (%rcx,%rcx,2), %r13d
subl %r13d, %r14d
cmpl $0x1, %r14d
je 0x784d
movl %ebx, %r10d
addl %r11d, %r9d
addl %r10d, %ecx
movl 0x4(%r15,%r8,4), %r8d
movslq %r9d, %r9
movq -0x40(%rbp), %r14
movl (%r14,%r9,4), %r9d
movslq %ecx, %r10
movl (%r15,%rsi,4), %r11d
cmpl %r11d, %r8d
sete %cl
cmpl (%r14,%r10,4), %r9d
setle %sil
leaq (%rdi,%rdi,2), %rdi
incq %rdi
cmpl %r11d, %r8d
jl 0x796d
andb %sil, %cl
movq -0x70(%rbp), %r13
movq -0x48(%rbp), %r14
je 0x7953
jmp 0x7975
subl %ebx, %edi
leal (%rdi,%rdi,2), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
imulq $0x55555556, %rcx, %r8  # imm = 0x55555556
movq %r8, %r9
shrq $0x3f, %r9
shrq $0x20, %r8
addl %r9d, %r8d
leal (%r8,%r8,2), %r9d
subl %r9d, %ecx
xorl %r10d, %r10d
movl $0x0, %r11d
cmpl $0x1, %ecx
je 0x78d6
movl %ebx, %r11d
leal 0x2(%rdx), %ecx
movslq %ecx, %rcx
imulq $0x55555556, %rcx, %r9  # imm = 0x55555556
movq %r9, %r14
shrq $0x3f, %r14
shrq $0x20, %r9
addl %r14d, %r9d
leal (%r9,%r9,2), %r14d
subl %r14d, %ecx
cmpl $0x1, %ecx
je 0x7900
movl %ebx, %r10d
leal (%rdi,%rdi,2), %ecx
leal (%rdi,%rdi,2), %edi
addl $0x2, %edi
addl %r11d, %r8d
addl %r10d, %r9d
movslq %ecx, %rcx
movl (%r15,%rsi,4), %r10d
cmpl %r10d, 0x8(%r15,%rcx,4)
jl 0x7971
movq -0x48(%rbp), %r14
jne 0x7953
movl 0xc(%r15,%rcx,4), %r10d
movslq %r8d, %r8
movl 0x4(%r15,%rsi,4), %r11d
movslq %r9d, %rcx
movq -0x40(%rbp), %r9
movl (%r9,%rcx,4), %esi
cmpl %r11d, %r10d
sete %cl
cmpl %esi, (%r9,%r8,4)
setle %sil
cmpl %r11d, %r10d
jl 0x7975
andb %sil, %cl
jne 0x7975
movq -0x58(%rbp), %rcx
movl %edx, (%rcx,%r12,4)
incl %eax
cmpl %ebx, %eax
je 0x79f2
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %edx
jmp 0x7989
movq -0x70(%rbp), %r13
movq -0x48(%rbp), %r14
movq -0x58(%rbp), %rcx
movl %edi, (%rcx,%r12,4)
movl -0x30(%rbp), %edx
incl %edx
movl -0x2c(%rbp), %ecx
cmpl %ecx, %edx
je 0x79a9
incq %r12
cmpq %r12, -0x38(%rbp)
jne 0x77bd
movq -0x38(%rbp), %r12
jmp 0x79ab
xorl %r12d, %r12d
xorl %eax, %eax
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %edx
jmp 0x79ab
movl %ecx, %edx
cmpl %ebx, %eax
jge 0x79f8
movl %edx, -0x30(%rbp)
leal 0x1(%r12), %ecx
movq -0x58(%rbp), %rdx
leaq (%rdx,%rcx,4), %rdi
movslq %eax, %r15
leaq (,%r15,4), %rsi
addq %r13, %rsi
notl %eax
addl %ebx, %eax
leaq 0x4(,%rax,4), %rdx
callq 0x21d0
movl %r12d, %r12d
subq -0x60(%rbp), %r15
xorl %eax, %eax
decq %rax
cmpq %rax, %r15
jne 0x79e7
subl %eax, %r12d
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %edx
cmpl %ecx, %edx
jge 0x7a53
movslq %edx, %rsi
movl %r12d, %eax
movq -0x58(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
addq $0x4, %rax
leaq (%r14,%rsi,4), %rcx
movslq -0x90(%rbp), %rdx
addq -0x60(%rbp), %rdx
subq %rsi, %rdx
xorl %esi, %esi
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
xorl %r9d, %r9d
cmpl %ebx, %r8d
movl %ebx, %r10d
cmovll %esi, %r10d
setl %r9b
subl %r10d, %r8d
leal (%r8,%r8,2), %r8d
subl %r9d, %r8d
addl $0x2, %r8d
movl %r8d, (%rax,%rdi,4)
incq %rdi
cmpq %rdi, %rdx
jne 0x7a24
movq -0x68(%rbp), %rdi
callq 0x2030
movq -0x40(%rbp), %rdi
callq 0x2030
movq %r13, %rdi
callq 0x2030
movq %r14, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
leaq 0x2f6d(%rip), %rdi      # 0xa9f7
leaq 0x2ebd(%rip), %rsi      # 0xa94e
leaq 0x2ebc(%rip), %rcx      # 0xa954
movl $0x86, %edx
callq 0x2130
leaq 0x2f44(%rip), %rdi      # 0xa9ed
leaq 0x2e9e(%rip), %rsi      # 0xa94e
leaq 0x2e9d(%rip), %rcx      # 0xa954
movl $0x85, %edx
callq 0x2130
leaq 0x2ec1(%rip), %rdi      # 0xa989
leaq 0x2e7f(%rip), %rsi      # 0xa94e
leaq 0x2e7e(%rip), %rcx      # 0xa954
movl $0x67, %edx
callq 0x2130
leaq 0x2e96(%rip), %rdi      # 0xa97d
leaq 0x2e60(%rip), %rsi      # 0xa94e
leaq 0x2e5f(%rip), %rcx      # 0xa954
movl $0x66, %edx
callq 0x2130
leaq 0x2e39(%rip), %rdi      # 0xa93f
leaq 0x2e41(%rip), %rsi      # 0xa94e
leaq 0x2e40(%rip), %rcx      # 0xa954
movl $0x55, %edx
callq 0x2130
leaq 0x2e8a(%rip), %rdi      # 0xa9af
leaq 0x2e22(%rip), %rsi      # 0xa94e
leaq 0x2e21(%rip), %rcx      # 0xa954
movl $0x6c, %edx
callq 0x2130
leaq 0x2e9c(%rip), %rdi      # 0xa9e0
leaq 0x2e03(%rip), %rsi      # 0xa94e
leaq 0x2e02(%rip), %rcx      # 0xa954
movl $0x7e, %edx
callq 0x2130
leaq 0x2e33(%rip), %rdi      # 0xa996
leaq 0x2de4(%rip), %rsi      # 0xa94e
leaq 0x2de3(%rip), %rcx      # 0xa954
movl $0x6b, %edx
callq 0x2130