// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/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 $0x78, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, %r14
movq %rsi, %rbp
movq %rdi, %rsi
movq %rdx, %rbx
negq %rbx
xorl %eax, %eax
cmpq $0x8, %rdx
setne %al
movl %eax, 0x5c(%rsp)
movq %rdx, %rax
shrq $0x3, %rax
movq %rax, 0x30(%rsp)
movq %rbx, 0x20(%rsp)
movq %r9, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movq %rsi, %rax
orq %r14, %rax
movq %rax, 0x28(%rsp)
testb $0x7, %al
movl $0x2, %eax
cmovel 0x5c(%rsp), %eax
movl %eax, 0x1c(%rsp)
cmpq $0x6, %rbp
movq %rsi, 0x10(%rsp)
jbe 0x2a255
movq %rbp, %r13
shrq %r13
imulq %r14, %r13
addq %rsi, %r13
cmpq $0x7, %rbp
movq %rbp, 0x48(%rsp)
jne 0x29ce8
movq 0x30(%rsp), %rbx
jmp 0x29ebb
leaq -0x1(%rbp), %r12
imulq %r14, %r12
addq %rsi, %r12
cmpq $0x29, %rbp
jb 0x29d53
shrq $0x3, %rbp
imulq %r14, %rbp
leaq (%rsi,%rbp), %r15
leaq (%rsi,%rbp,2), %rax
movq %rax, 0x40(%rsp)
movq %rsi, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rbx
callq *%rbx
movl %eax, 0x50(%rsp)
movq %r15, 0x38(%rsp)
movq %r15, %rdi
movq 0x40(%rsp), %r15
movq %r15, %rsi
callq *%rbx
cmpl $0x0, 0x50(%rsp)
js 0x29d5b
testl %eax, %eax
jg 0x29d79
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rsp)
testl %eax, %eax
cmovsq %rbx, %r15
jmp 0x29d74
movq %rsi, %r15
jmp 0x29e48
testl %eax, %eax
js 0x29d79
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rsp)
testl %eax, %eax
cmovnsq %rbx, %r15
movq %r15, 0x38(%rsp)
movq %r13, %rdi
subq %rbp, %rdi
movq %r13, %r15
addq %rbp, %r15
movq %rdi, 0x60(%rsp)
movq %r13, %rsi
movq 0x8(%rsp), %rbx
callq *%rbx
movl %eax, 0x40(%rsp)
movq %r13, %rdi
movq %r15, 0x50(%rsp)
movq %r15, %rsi
callq *%rbx
cmpl $0x0, 0x40(%rsp)
js 0x29dc2
testl %eax, %eax
jg 0x29de0
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x50(%rsp), %r13
movq %r13, %rsi
jmp 0x29dd6
testl %eax, %eax
js 0x29de0
movq 0x60(%rsp), %r13
movq %r13, %rdi
movq 0x50(%rsp), %rbx
movq %rbx, %rsi
callq *0x8(%rsp)
testl %eax, %eax
cmovsq %rbx, %r13
leaq (,%rbp,2), %rax
negq %rbp
movq %r12, %r15
subq %rax, %r15
addq %r12, %rbp
movq %r15, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rbx
callq *%rbx
movl %eax, 0x40(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq *%rbx
cmpl $0x0, 0x40(%rsp)
js 0x29e2a
testl %eax, %eax
jg 0x29e40
movq %r15, %rdi
movq %r12, %rsi
callq *0x8(%rsp)
testl %eax, %eax
cmovsq %r15, %r12
jmp 0x29e43
testl %eax, %eax
js 0x29e40
movq %r15, %rdi
movq %r12, %rsi
callq *0x8(%rsp)
testl %eax, %eax
cmovnsq %r15, %r12
jmp 0x29e43
movq %rbp, %r12
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rbx
callq *%rbx
movl %eax, %ebp
movq %r13, %rdi
movq %r12, %rsi
callq *%rbx
testl %ebp, %ebp
js 0x29e90
testl %eax, %eax
movq 0x48(%rsp), %rbp
movq 0x30(%rsp), %rbx
movq 0x10(%rsp), %rsi
jg 0x29ebb
movq %r15, %rdi
movq %r12, %rsi
callq *0x8(%rsp)
movq 0x10(%rsp), %rsi
testl %eax, %eax
cmovsq %r15, %r12
movq %r12, %r13
jmp 0x29ebb
testl %eax, %eax
movq 0x48(%rsp), %rbp
movq 0x30(%rsp), %rbx
movq 0x10(%rsp), %rsi
js 0x29ebb
movq %r15, %rdi
movq %r12, %rsi
callq *0x8(%rsp)
movq 0x10(%rsp), %rsi
testl %eax, %eax
cmovsq %r12, %r15
movq %r15, %r13
cmpl $0x0, 0x1c(%rsp)
je 0x29ee5
testb $0x7, 0x28(%rsp)
je 0x29ef5
xorl %eax, %eax
movb (%rsi,%rax), %cl
movb (%r13,%rax), %dl
movb %dl, (%rsi,%rax)
movb %cl, (%r13,%rax)
incq %rax
cmpq %rax, %r14
jne 0x29ecb
jmp 0x29f11
movq (%rsi), %rax
movq (%r13), %rcx
movq %rcx, (%rsi)
movq %rax, (%r13)
jmp 0x29f11
xorl %eax, %eax
movq (%rsi,%rax,8), %rcx
movq (%r13,%rax,8), %rdx
movq %rdx, (%rsi,%rax,8)
movq %rcx, (%r13,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x29ef7
leaq (%rsi,%r14), %r13
leaq -0x1(%rbp), %r15
imulq %r14, %r15
addq %rsi, %r15
movq %r15, %rbp
movq %r13, %r12
cmpq %rbp, %r13
ja 0x2a02f
movq %r13, %rdi
callq *0x8(%rsp)
testl %eax, %eax
jg 0x29fad
je 0x29f43
movq 0x10(%rsp), %rsi
jmp 0x29fa5
cmpl $0x0, 0x1c(%rsp)
movq 0x10(%rsp), %rsi
je 0x29f74
testb $0x7, 0x28(%rsp)
je 0x29f86
xorl %eax, %eax
movb (%r12,%rax), %cl
movb (%r13,%rax), %dl
movb %dl, (%r12,%rax)
movb %cl, (%r13,%rax)
incq %rax
cmpq %rax, %r14
jne 0x29f58
jmp 0x29fa2
movq (%r12), %rax
movq (%r13), %rcx
movq %rcx, (%r12)
movq %rax, (%r13)
jmp 0x29fa2
xorl %eax, %eax
movq (%r12,%rax,8), %rcx
movq (%r13,%rax,8), %rdx
movq %rdx, (%r12,%rax,8)
movq %rcx, (%r13,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x29f88
addq %r14, %r12
addq %r14, %r13
jmp 0x29f26
movq 0x10(%rsp), %rsi
jmp 0x2a02f
testl %eax, %eax
je 0x29fc4
movq 0x20(%rsp), %r8
movq 0x10(%rsp), %rsi
jmp 0x2a02c
cmpl $0x0, 0x1c(%rsp)
movq 0x20(%rsp), %r8
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
je 0x29ffd
testb $0x7, 0x28(%rsp)
je 0x2a00d
xorl %eax, %eax
movb (%rbp,%rax), %cl
movb (%r15,%rax), %dl
movb %dl, (%rbp,%rax)
movb %cl, (%r15,%rax)
incq %rax
cmpq %rax, %r14
jne 0x29fe3
jmp 0x2a029
movq (%rbp), %rax
movq (%r15), %rcx
movq %rcx, (%rbp)
movq %rax, (%r15)
jmp 0x2a029
xorl %eax, %eax
movq (%rbp,%rax,8), %rcx
movq (%r15,%rax,8), %rdx
movq %rdx, (%rbp,%rax,8)
movq %rcx, (%r15,%rax,8)
incq %rax
cmpq %rax, %rdi
jne 0x2a00f
addq %r8, %r15
addq %r8, %rbp
cmpq %rbp, %r13
seta %bl
ja 0x2a0cd
movq %rbp, %rdi
callq *0x8(%rsp)
testl %eax, %eax
jns 0x29fb4
testb %bl, %bl
jne 0x2a246
cmpl $0x0, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
je 0x2a08d
testb $0x7, 0x28(%rsp)
movq 0x30(%rsp), %rbx
je 0x2a0a4
xorl %eax, %eax
movb (%r13,%rax), %cl
movb (%rbp,%rax), %dl
movb %dl, (%r13,%rax)
movb %cl, (%rbp,%rax)
incq %rax
cmpq %rax, %r14
jne 0x2a071
jmp 0x2a0c2
movq (%r13), %rax
movq (%rbp), %rcx
movq %rcx, (%r13)
movq %rax, (%rbp)
movq 0x30(%rsp), %rbx
jmp 0x2a0c2
xorl %eax, %eax
movq (%r13,%rax,8), %rcx
movq (%rbp,%rax,8), %rdx
movq %rdx, (%r13,%rax,8)
movq %rcx, (%rbp,%rax,8)
incq %rax
cmpq %rax, %rbx
jne 0x2a0a6
addq %r14, %r13
addq %rdi, %rbp
jmp 0x29f26
movq 0x20(%rsp), %rbx
movq %r13, %rax
subq %r12, %rax
subq %rsi, %r12
cmpq %rax, %r12
cmovgeq %rax, %r12
testq %r12, %r12
je 0x2a12e
movq %r13, %rcx
subq %r12, %rcx
testb $0x7, 0x28(%rsp)
je 0x2a110
xorl %edx, %edx
movb (%rsi,%rdx), %r8b
movb (%rcx,%rdx), %dil
movb %dil, (%rsi,%rdx)
movb %r8b, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %r12
jne 0x2a0f6
jmp 0x2a12e
shrq $0x3, %r12
xorl %edx, %edx
movq (%rsi,%rdx,8), %r8
movq (%rcx,%rdx,8), %rdi
movq %rdi, (%rsi,%rdx,8)
movq %r8, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %r12
jne 0x2a116
movq 0x48(%rsp), %r12
imulq %r14, %r12
addq %rsi, %r12
movq %r15, %r10
subq %rbp, %r10
addq %r14, %r15
movq %r12, %rcx
subq %r15, %rcx
cmpq %rcx, %r10
cmovbq %r10, %rcx
testq %rcx, %rcx
je 0x2a1a2
movq %r12, %rdx
subq %rcx, %rdx
testb $0x7, 0x28(%rsp)
je 0x2a181
xorl %r9d, %r9d
movb (%r13,%r9), %dil
movb (%rdx,%r9), %r8b
movb %r8b, (%r13,%r9)
movb %dil, (%rdx,%r9)
incq %r9
cmpq %r9, %rcx
jne 0x2a165
jmp 0x2a1a2
shrq $0x3, %rcx
xorl %r9d, %r9d
movq (%r13,%r9,8), %rdi
movq (%rdx,%r9,8), %r8
movq %r8, (%r13,%r9,8)
movq %rdi, (%rdx,%r9,8)
incq %r9
cmpq %r9, %rcx
jne 0x2a188
cmpq %r14, %rax
movq 0x70(%rsp), %r15
movq 0x68(%rsp), %r13
jbe 0x2a1fc
cmpq %r13, %rsi
seta %cl
cmpq %r15, %rsi
seta %dl
testb %dl, %cl
jne 0x2a1fc
leaq (%rsi,%rax), %rcx
decq %rcx
cmpq %r13, %rcx
setb %dl
cmpq %r15, %rcx
setb %cl
testb %cl, %dl
jne 0x2a1fc
xorl %edx, %edx
divq %r14
movq %rsi, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
movq %r13, %r8
movq %r15, %r9
movq %r10, %rbp
callq 0x29c52
movq %rbp, %r10
cmpq %r14, %r10
jbe 0x2a320
movq %r12, %rsi
subq %r10, %rsi
cmpq %r13, %rsi
seta %al
cmpq %r15, %rsi
seta %cl
testb %cl, %al
jne 0x2a320
movq %r10, %rax
xorl %edx, %edx
divq %r14
movq %rax, %rbp
decq %r12
cmpq %r13, %r12
setae %cl
cmpq %r15, %r12
setae %dl
orb %cl, %dl
jne 0x29c9c
jmp 0x2a320
movq 0x20(%rsp), %rbx
movq 0x10(%rsp), %rsi
jmp 0x2a0d2
imulq %r14, %rbp
cmpq %r14, %rbp
jle 0x2a320
addq %rsi, %rbp
leaq (%rsi,%r14), %r12
movq %rsi, 0x20(%rsp)
movq %rbp, 0x48(%rsp)
cmpq %rsi, %r12
jbe 0x2a30a
movq 0x20(%rsp), %rbp
movq %r12, %r15
movq %r15, %r13
addq %rbx, %r15
movq %r15, %rdi
movq %r13, %rsi
callq *0x8(%rsp)
movq 0x10(%rsp), %rsi
testl %eax, %eax
jle 0x2a30a
cmpl $0x0, 0x1c(%rsp)
je 0x2a2cc
testb $0x7, 0x28(%rsp)
je 0x2a2dc
xorl %eax, %eax
movb (%r13,%rax), %cl
movb (%rbp,%rax), %dl
movb %dl, (%r13,%rax)
movb %cl, (%rbp,%rax)
incq %rax
movq %rbx, %rcx
addq %rax, %rcx
jne 0x2a2ad
jmp 0x2a2fe
movq (%r13), %rax
movq (%r15), %rcx
movq %rcx, (%r13)
movq %rax, (%r15)
jmp 0x2a2fe
leaq (%r14,%rbp), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq (%rbp,%rcx,8), %rdi
movq %rdi, (%rax,%rcx,8)
movq %rdx, (%rbp,%rcx,8)
incq %rcx
cmpq %rcx, 0x30(%rsp)
jne 0x2a2e2
addq %rbx, %rbp
cmpq %rsi, %r15
ja 0x2a284
addq %r14, %r12
addq %r14, 0x20(%rsp)
movq 0x48(%rsp), %rbp
cmpq %rbp, %r12
jb 0x2a273
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop