// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/pqsort.c
// Function: pqsort
static void
_pqsort(void *a, size_t n, size_t es,
    int (*cmp) (const void *, const void *), void *lrange, void *rrange)
{
	char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
	size_t d, r;
	int swaptype, cmp_result;

loop:	SWAPINIT(a, es);
	if (n < 7) {
		for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
			for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
			     pl -= es)
				swap(pl, pl - es);
		return;
	}
	pm = (char *) a + (n / 2) * es;
	if (n > 7) {
		pl = (char *) a;
		pn = (char *) a + (n - 1) * es;
		if (n > 40) {
			d = (n / 8) * es;
			pl = med3(pl, pl + d, pl + 2 * d, cmp);
			pm = med3(pm - d, pm, pm + d, cmp);
			pn = med3(pn - 2 * d, pn - d, pn, cmp);
		}
		pm = med3(pl, pm, pn, cmp);
	}
	swap(a, pm);
	pa = pb = (char *) a + es;

	pc = pd = (char *) a + (n - 1) * es;
	for (;;) {
		while (pb <= pc && (cmp_result = cmp(pb, a)) <= 0) {
			if (cmp_result == 0) {
				swap(pa, pb);
				pa += es;
			}
			pb += es;
		}
		while (pb <= pc && (cmp_result = cmp(pc, a)) >= 0) {
			if (cmp_result == 0) {
				swap(pc, pd);
				pd -= es;
			}
			pc -= es;
		}
		if (pb > pc)
			break;
		swap(pb, pc);
		pb += es;
		pc -= es;
	}

	pn = (char *) a + n * es;
	r = min(pa - (char *) a, pb - pa);
	vecswap(a, pb - r, r);
	r = min((size_t)(pd - pc), pn - pd - es);
	vecswap(pb, pn - r, r);
	if ((r = pb - pa) > es) {
                void *_l = a, *_r = ((unsigned char*)a)+r-1;
                if (!((lrange < _l && rrange < _l) ||
                    (lrange > _r && rrange > _r)))
		    _pqsort(a, r / es, es, cmp, lrange, rrange);
        }
	if ((r = pd - pc) > es) {
                void *_l, *_r;

		/* Iterate rather than recurse to save stack space */
		a = pn - r;
		n = r / es;

                _l = a;
                _r = ((unsigned char*)a)+r-1;
                if (!((lrange < _l && rrange < _l) ||
                    (lrange > _r && rrange > _r)))
		    goto loop;
	}
/*		qsort(pn - r, r / es, es, cmp);*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, %r14
movq %rdi, %r12
movq %rdx, %rbp
negq %rbp
xorl %eax, %eax
cmpq $0x8, %rdx
setne %al
movl %eax, 0x54(%rsp)
movq %rbp, 0x40(%rsp)
movl %r12d, %eax
orl %r14d, %eax
testb $0x7, %al
pushq $0x2
popq %rcx
cmovel 0x54(%rsp), %ecx
cmpq $0x6, %rsi
movl %ecx, 0xc(%rsp)
jbe 0x336ff
movq %rsi, %rbx
shrq %rbx
imulq %r14, %rbx
addq %r12, %rbx
cmpq $0x7, %rsi
movq %rsi, 0x18(%rsp)
je 0x33461
leaq -0x1(%rsi), %r15
imulq %r14, %r15
addq %r12, %r15
cmpq $0x29, %rsi
jb 0x33444
movq %rsi, %r13
shrq $0x3, %r13
imulq %r14, %r13
leaq (%r12,%r13), %rsi
leaq (,%r13,2), %rax
movq %rax, 0x38(%rsp)
leaq (%r12,%r13,2), %rdx
movq %r12, %rdi
movq 0x20(%rsp), %rbp
movq %rbp, %rcx
callq 0x3379f
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
subq %r13, %rdi
leaq (%rbx,%r13), %rdx
movq %rbx, %rsi
movq %rbp, %rcx
callq 0x3379f
movq %rax, %rbx
movq %r15, %rdi
subq 0x38(%rsp), %rdi
movq %r15, %rsi
subq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x3379f
movq 0x48(%rsp), %rdi
movq %rax, %r15
jmp 0x3344c
movq %r12, %rdi
movq 0x20(%rsp), %rbp
movq %rbx, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x3379f
movq %rax, %rbx
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x33475
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x33761
jmp 0x33483
movq (%r12), %rax
movq (%rbx), %rcx
movq %rcx, (%r12)
movq %rax, (%rbx)
leaq (%r12,%r14), %r15
movq 0x18(%rsp), %rax
leaq -0x1(%rax), %rsi
imulq %r14, %rsi
addq %r12, %rsi
movq %rsi, %rbp
movq %r15, %r13
movq %r15, %rbx
movq %r12, 0x10(%rsp)
cmpq %rbp, %rbx
ja 0x334f6
movq %rbx, %rdi
movq %rsi, %r12
movq 0x10(%rsp), %rsi
callq *0x20(%rsp)
movq %r12, %rsi
testl %eax, %eax
jg 0x334f6
jne 0x334ee
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x334dd
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x33761
movq %r12, %rsi
jmp 0x334eb
movq (%r13), %rax
movq (%rbx), %rcx
movq %rcx, (%r13)
movq %rax, (%rbx)
addq %r14, %r13
addq %r14, %rbx
addq %r14, %r15
jmp 0x334a5
movq %r15, 0x38(%rsp)
movq %rbp, %r15
negq %r15
cmpq %rbp, %rbx
movq %rsi, %r12
ja 0x3359b
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
callq *0x20(%rsp)
testl %eax, %eax
js 0x33562
movq %r12, %rsi
je 0x33529
movq 0x40(%rsp), %rax
jmp 0x3355a
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x33544
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x33761
movq %r12, %rsi
jmp 0x33552
movq (%rbp), %rax
movq (%rsi), %rcx
movq %rcx, (%rbp)
movq %rax, (%rsi)
movq 0x40(%rsp), %rax
addq %rax, %rsi
addq %rax, %rbp
addq %r14, %r15
jmp 0x33501
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x3357a
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x33761
jmp 0x33588
movq (%rbx), %rax
movq (%rbp), %rcx
movq %rcx, (%rbx)
movq %rax, (%rbp)
movq %r12, %rsi
addq %r14, %rbx
addq 0x40(%rsp), %rbp
movq %rbx, %r15
jmp 0x334a5
movq %r13, %rax
movq 0x10(%rsp), %rdi
subq %rdi, %rax
movq 0x38(%rsp), %rbp
subq %r13, %rbp
cmpq %rbp, %rax
movq %rbp, %rdx
cmovlq %rax, %rdx
testq %rdx, %rdx
je 0x335e0
cmpq %rbp, %rax
cmovgeq %rbp, %rax
movq %rbx, %rsi
subq %rax, %rsi
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %ecx
callq 0x33761
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbp, 0x48(%rsp)
movq 0x18(%rsp), %rbp
imulq %r14, %rbp
addq %rdi, %rbp
leaq (%rsi,%r15), %rdi
movq %rbp, %rdx
subq %rsi, %rdx
subq %r14, %rdx
cmpq %rdx, %rdi
cmovbq %rdi, %rdx
testq %rdx, %rdx
je 0x33629
movq %rbp, %rsi
subq %rdx, %rsi
movq %rdi, 0x18(%rsp)
movq %rbx, %rdi
movl 0xc(%rsp), %ecx
callq 0x33761
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rbx
movq 0x48(%rsp), %rax
cmpq %r14, %rax
jbe 0x336a3
movq 0x10(%rsp), %rcx
cmpq 0x28(%rsp), %rcx
seta %dl
cmpq 0x30(%rsp), %rcx
seta %cl
testb %cl, %dl
jne 0x336a3
movq 0x10(%rsp), %rdx
subq %r13, %rdx
movq 0x38(%rsp), %rcx
addq %rcx, %rdx
decq %rdx
cmpq 0x28(%rsp), %rdx
setb %cl
cmpq 0x30(%rsp), %rdx
setb %dl
testb %dl, %cl
jne 0x336a3
xorl %edx, %edx
divq %r14
movq %rdi, %r13
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq %r14, %rdx
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %r9
callq 0x3334e
movq %r13, %rdi
movq %r12, %rsi
cmpq %r14, %rdi
movq 0x40(%rsp), %rbp
jbe 0x336f0
movq %rbx, %r12
subq %rsi, %r12
subq %r15, %r12
cmpq 0x28(%rsp), %r12
seta %al
cmpq 0x30(%rsp), %r12
seta %cl
testb %cl, %al
jne 0x336f0
decq %rbx
movq %rdi, %rax
xorl %edx, %edx
divq %r14
cmpq 0x28(%rsp), %rbx
setae %cl
cmpq 0x30(%rsp), %rbx
setae %dl
orb %cl, %dl
movq %rax, %rsi
jne 0x33389
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imulq %r14, %rsi
addq %r12, %rsi
movq %r12, %rbx
movq %rsi, 0x18(%rsp)
leaq (%rbx,%r14), %r13
cmpq %rsi, %r13
jae 0x336f0
leaq (%rbx,%r14), %r15
cmpq %r12, %r15
jbe 0x33757
movq %rbx, %rdi
movq %r15, %rsi
callq *0x20(%rsp)
testl %eax, %eax
jle 0x33757
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x33746
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x33761
jmp 0x33752
movq (%r15), %rax
movq (%rbx), %rcx
movq %rcx, (%r15)
movq %rax, (%rbx)
addq %rbp, %rbx
jmp 0x33717
movq %r13, %rbx
movq 0x18(%rsp), %rsi
jmp 0x3370e