// File: /workspace/github_cpp_makefile_star2_O3/jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: QuickSortPointers::qsort(void**, int)
void QuickSortPointers::qsort(void **b,int32_t num)
{
	char *lo,*hi;
	char *mid;
	char *bottom, *top;
	int32_t size;
	char *lostk[30], *histk[30];
	int32_t stkptr;
	char **base = (char **)b;

	if (num < 2 ) return;

	stkptr = 0;

	lo = (char *)base;
	hi = (char *)base + sizeof(char **) * (num-1);

nextone:

	size = (int32_t)(hi - lo) / sizeof(char**) + 1;

	mid = lo + (size / 2) * sizeof(char **);
	swap((char **)mid,(char **)lo);
	bottom = lo;
	top = hi + sizeof(char **);

	for (;;)
	{
		do
		{
			bottom += sizeof(char **);
		} while (bottom <= hi && compare((void **)bottom,(void **)lo) <= 0);

		do
		{
			top -= sizeof(char **);
		} while (top > lo && compare((void **)top,(void **)lo) >= 0);

		if (top < bottom) break;

		swap((char **)bottom,(char **)top);

	}

	swap((char **)lo,(char **)top);

	if ( top - 1 - lo >= hi - bottom )
	{
		if (lo + sizeof(char **) < top)
		{
			lostk[stkptr] = lo;
			histk[stkptr] = top - sizeof(char **);
			stkptr++;
		}
		if (bottom < hi)
		{
			lo = bottom;
			goto nextone;
		}
	}
	else
	{
		if ( bottom < hi )
		{
			lostk[stkptr] = bottom;
			histk[stkptr] = hi;
			stkptr++;
		}
		if (lo + sizeof(char **) < top)
		{
			hi = top - sizeof(char **);
			goto nextone; 					/* do small recursion */
		}
	}

	stkptr--;

	if (stkptr >= 0)
	{
		lo = lostk[stkptr];
		hi = histk[stkptr];
		goto nextone;
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, -0x50(%rbp)
cmpl $0x2, %edx
jge 0xb303
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r8
decl %edx
leaq (%rsi,%rdx,8), %r13
movq $0x0, -0x30(%rbp)
leaq 0x8(%r13), %rax
movq %rax, -0x48(%rbp)
leaq -0x8(%r13), %rax
movq %rax, -0x58(%rbp)
movq %r13, -0x40(%rbp)
movl %r13d, %eax
subl %r8d, %eax
movslq %eax, %rcx
shrq $0x3, %rcx
leal 0x2(%rcx), %edx
movq %r8, %rax
movq -0x48(%rbp), %rsi
movq %rsi, -0x38(%rbp)
cmpl $0x3, %edx
jb 0xb36e
movl %ecx, %eax
incl %eax
shrl $0x1f, %eax
addl %ecx, %eax
incl %eax
sarl %eax
cltq
leaq (%r8,%rax,8), %r15
movq %r8, %r12
movq %r8, %rax
movq -0x48(%rbp), %rcx
movq %rcx, -0x38(%rbp)
jmp 0xb3f1
movq %rax, %r15
movq %r8, %rbx
movq -0x58(%rbp), %rcx
subq %r15, %rcx
addq $0x8, %r15
movq %r15, %rdx
movq %rdx, %r15
movq %rcx, %r14
cmpq %r13, %rdx
ja 0xb3ab
movq -0x50(%rbp), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r8, %rdx
callq *(%rax)
movq %rbx, %r8
leaq 0x8(%r15), %rdx
leaq -0x8(%r14), %rcx
testl %eax, %eax
jle 0xb382
movq -0x38(%rbp), %rax
leaq -0x8(%rax), %rcx
xorl %edx, %edx
movq %rdx, %r13
movq %rcx, %r12
cmpq %r8, %rcx
jbe 0xb3df
movq -0x50(%rbp), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movq %r8, %rdx
callq *(%rax)
movq %rbx, %r8
leaq 0x8(%r13), %rdx
leaq -0x8(%r12), %rcx
testl %eax, %eax
jns 0xb3b5
cmpq %r15, %r12
jb 0xb404
movq %r15, %rax
movq %r12, -0x38(%rbp)
movq -0x40(%rbp), %r13
je 0xb374
movq (%r15), %rcx
movq (%r12), %rdx
movq %rdx, (%r15)
movq %rcx, (%r12)
jmp 0xb36e
cmpq %r8, %r12
je 0xb417
movq (%r8), %rax
movq (%r12), %rcx
movq %rcx, (%r8)
movq %rax, (%r12)
movq -0x38(%rbp), %rax
subq %r8, %rax
subq %r13, %rax
addq $-0x9, %rax
cmpq %r14, %rax
jl 0xb46c
leaq 0x8(%r8), %rax
cmpq %r12, %rax
jae 0xb45a
movq -0x30(%rbp), %rax
cltq
movq %r8, -0x240(%rbp,%rax,8)
movq -0x38(%rbp), %rcx
subq %r13, %rcx
addq $-0x10, %rcx
movq %rcx, -0x150(%rbp,%rax,8)
incl %eax
movq %rax, -0x30(%rbp)
movq %r15, %r8
movq -0x40(%rbp), %r13
cmpq %r13, %r15
jb 0xb328
jmp 0xb4b4
movq -0x40(%rbp), %rdx
cmpq %rdx, %r15
jae 0xb490
movq -0x30(%rbp), %rcx
movslq %ecx, %rax
movq %r15, -0x240(%rbp,%rax,8)
movq %rdx, -0x150(%rbp,%rax,8)
incl %ecx
jmp 0xb494
movq -0x30(%rbp), %rcx
leaq 0x8(%r8), %rax
cmpq %r12, %rax
movq %rcx, -0x30(%rbp)
jae 0xb4b4
movq -0x38(%rbp), %rax
subq %r13, %rax
addq $-0x10, %rax
movq %rax, %r13
jmp 0xb314
movq -0x30(%rbp), %rax
testl %eax, %eax
jle 0xb2f1
decl %eax
movq -0x240(%rbp,%rax,8), %r8
movq %rax, -0x30(%rbp)
movq -0x150(%rbp,%rax,8), %r13
jmp 0xb314